kcode-k1-codex-shim 0.3.1

Per-conversation K1 bridge for multiplexed Codex turns
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# kcode-k1-codex-shim

This crate provides the sequential per-conversation bridge over the compatible `kcode-k1-codex-runtime` 0.3 line and reexports its facade types.
`ToolCallLauncher<B>::launch_stage(text, boxes)` accepts one assistant-output stage: text accumulated since the preceding wave plus an ordered vector of converted, valid tool-call boxes.
On the first tool call, `infer` nonblockingly drains only already-buffered consecutive calls into the same wave; it uses no timer and preserves the first non-call event as ordered lookahead.
After conversion, `BoxCodec::malformed_tool_call_message` may classify a box as malformed by returning a fixed, safely displayable codec validation message. Its default returns `None`, so existing codecs and all previously valid calls retain their behavior. A codec must not construct this message from raw arbitrary tool-call values.

The launcher is invoked exactly once per buffered call wave with the accumulated stage text and only valid boxes, in provider order. It is invoked with an empty box vector when every call in the wave is malformed, so stage text still reaches the consumer. Malformed boxes are never dispatched.
Launcher success means all consumer-required work for the wave has completed, including optional active-turn flush, persistence, projection, steering, and commit. It is the complete response barrier. After success, the shim responds to every native call ID in original provider order: valid calls receive the successful `ASYNC_TOOL_ACKNOWLEDGEMENT`, while malformed calls receive `ToolResult { success: false, output: <the codec validation message> }`. The same native turn then continues through later text, tool waves, and terminal text.
Launcher failure can occur after durable wave acceptance or launch and does not certify replayability. The shim responds to none of that wave and remains unusable.
Calls that arrive only after a response form later waves. Stage text and calls are not returned again. `ShimOutput` contains only assistant text accumulated after the final wave, or no items.
`ASYNC_TOOL_ACKNOWLEDGEMENT` is the exact successful native result. Available results may be supplied at a later inference boundary within the continuing native turn.
Externally recorded boxes prefix the next fresh turn and clear only after start acceptance. `close_conversation` is ready-only and retains pending boxes.
Tool execution, persistence, steering, scheduling, retries, recovery, UI, HTTP, actors, and daemon behavior remain outside this crate.