# kcode-k1-codex-runtime
This crate combines `kcode-k1-codex-conversations` state with one shared, initialized `kcode-k1-codex-transport` app-server. Cloned `Adapter` handles multiplex persistent native threads by opaque conversation key; one key is sequential while different keys may progress concurrently.
`start_turn` returns a `Turn` streaming ordered text, dynamic calls, and terminal events. Results answer the exact pending call, preserving string-versus-number JSON-RPC IDs. `Turn::try_next_event` returns the next already-buffered event without waiting, returns `Ok(None)` only when presently empty, and handles terminal events or channel disconnection consistently with the existing turn lifecycle. Dropping a live turn rejects calls and interrupts it.
Inbound classification and field validation come from `kcode-k1-codex-events`. Early events are bounded, scope and correlation are strict, malformed calls are rejected when identifiable, unsupported requests are rejected, and model rerouting fails closed.
`close_conversation` is idle-only and idempotent. A mapping is forgotten only after its matching `thread/unsubscribe` succeeds; a normal rejection clears the closing transition while preserving a usable adapter and mapping.
The transport supplies global no-history configuration, reasoning effort, process I/O, diagnostics capture, and graceful close. Threads are never ephemeral, and diagnostics remain separate from `Error` display text.