kcode-k1-chat-codex-state 0.5.1

Deterministic open-format Codex K1 conversation state
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Open-format Codex conversation state 0.4.0

`ConversationState` applies K1-CHAT-BOX-FORMAT-001 revision 3. It reexports `ChatBox`, `BoxId`, `ToolCallId`, `BoxValue`, `Call`, and the nine familiar Chatend type-string constants. The constants are conveniences, not an exhaustive registry.

```rust
pub fn accept(&mut self, box_type: String, contents: String,
    hidden_type: String, hidden_contents: String) -> Result<(), String>;
pub fn accept_tool_return(&mut self, tool_call_id: ToolCallId,
    result: Result<String, String>) -> Result<(), String>;
```

`accept` preserves all four open strings exactly. `accept_tool_return` is a distinct constructor for the currently recognized correlated K1 tool-result convention; it does not restrict generic box values. The closed `Arrival` API is removed.

`begin` and `prepare_steer` use only Codec 0.4's generic `[Box <id> | <type>]\n<contents>` renderer. Hidden fields remain canonical and accessible but are omitted from default model input. Active arrivals are flushed as a finite FIFO, and opaque steer tokens remain stable, process-local, and exact-once.

`prepare_stage` retains native `call_ktool` validation and monotonic session-local `ToolCallId` assignment. Stalling, restart, submitted-frontier handling, and text-only terminal output are unchanged. Recovery uses stable Chatend metadata accessors, preserves unknown values, restores tool-call sequencing, and invalidates old steer tokens.

This crate performs no I/O, persistence, scheduling, tool execution, or deployment.