# kcode-k1-codex-runtime
`Adapter` is the public Codex runtime facade. Cloned adapters share one app-server process; each conversation key remains bound to its complete configuration profile.
## Public API
`Config`, `DynamicTool`, `Error`, `ErrorKind`, `Event`, `ToolCall`, and `ToolResult` are reexports of their identically named `kcode-k1-codex-conversations` types. `RuntimeObservation` and `UsageObservation` are reexports of their identically named `kcode-k1-codex-runtime-actor` types.
`Adapter: Clone`.
- `async fn open(config: Config) -> Result<Adapter, Error>` validates and opens the app-server profile. For a practical profile, local startup is ordinarily under five seconds.
- `fn with_config(&self, config: Config) -> Result<Adapter, Error>` validates a derived profile; its executable and working directory must equal those of the opening profile. Validation is local and small.
- `async fn start_turn(&self, conversation_key: impl Into<String>, input: impl Into<String>) -> Result<Turn, Error>` starts an ordered event stream for the key. Local work is proportional to the input copied into the actor command.
- `async fn steer(&self, conversation_key: impl Into<String>, input: impl Into<String>) -> Result<(), Error>` submits text to the active native turn and waits for its correlated provider response. Local work is proportional to the input copied into the actor command; provider completion is external.
- `async fn subscribe_usage(&self, key: String) -> Result<mpsc::UnboundedReceiver<RuntimeObservation>, Error>` installs the sole live usage-observation receiver for the key; a second live receiver returns `ErrorKind::Busy`, and a dropped receiver may be replaced. Subscription is constant-time.
- `async fn close_conversation(&self, key: impl Into<String>) -> Result<(), Error>` closes an idle, profile-bound conversation and is idempotent. Local work is small apart from actor coordination.
- `fn diagnostics(&self) -> Vec<u8>` returns the current diagnostic stamp. It copies the stamp.
`Turn: Debug`.
- `async fn next_event(&mut self) -> Option<Event>` receives the next ordered event, or `None` after stream closure. Local work is constant-time apart from waiting for the actor.
- `fn try_next_event(&mut self) -> Result<Option<Event>, Error>` returns `Ok(None)` for an empty live stream and `ErrorKind::Unavailable` after disconnection. Local work is constant-time.
- `async fn respond(&self, call_id: impl Into<String>, result: ToolResult) -> Result<(), Error>` answers one exact pending dynamic call. Local work is proportional to the copied call data; provider completion is external.
Dropping a nonterminal `Turn` abandons it through the actor. This facade does not decode, route, associate, or deduplicate observations.