# Open-format K1 Chatend 0.5.0
`ChatBox` is the canonical immutable box value. It contains a consecutive one-based `BoxId` plus four open UTF-8 strings: `type`, `contents`, `hidden_type`, and `hidden_contents`. `ChatBox::new` and the accessors preserve all strings exactly. Box types are not an enum or a closed registry. Hidden fields are ordinary accessible data omitted only from default model input for token efficiency; they are not a security boundary.
`Chatend` owns append order, provider rounds, active-arrival FIFO behavior, and K1 tool-call correlation. `accept_box` admits any generic box. Convenience methods produce `System Message`, `User Message`, and `Attachment`; attachments always carry caller-supplied contents. Provider stages append optional `Agent Message` output and `Tool Call` boxes. Tool returns append `Tool Result` boxes. Recognized tool conventions use versioned hidden types and owner-defined metadata, while unfamiliar types and hidden conventions remain inert and round-trip unchanged.
`start_round` enters provider mode without appending a box. Provider-mode arrivals queue in memory. `flush_active_arrivals` appends and returns one finite FIFO snapshot while keeping the round active. `done` appends optional final agent text, exits provider mode, and drains only arrivals still queued. Idle arrivals append immediately. Duplicate calls, unknown or duplicate returns, invalid phases, and ID overflow reject transactionally.
`recover` requires contiguous IDs beginning at one. It validates only recognized K1 tool conventions: call IDs are unique and every result references its unique earlier call. Unknown box types and hidden conventions are accepted unchanged. Recovered state is idle and future IDs continue monotonically.
All retained operations are linear in the boxes or arrivals they inspect or append.