Skip to main content

Module sidecar

Module sidecar 

Source
Expand description

The supercode-native v2 wire record for a conversation turn appended after import.

NativeTurn is a serialization of the existing ChatMessage, not a new conversation model — see the module-level note in session.rs and SPEC.md §1.1 (“one canonical Session, no second message type”). It exists only so a turn the agent loop produces after import can be appended to the native-v2 sidecar file (Session::to_native_jsonl_v2) with the same fidelity Session.raw gives the imported prefix — including metadata, which ChatMessage’s hand-rolled wire Serialize deliberately drops (message.rs:57-79) so a provider request body never sees it. Metadata (thinking, attribution, Codex phase/turn_id, …) must never reach the wire but must never be lost on disk either — NativeTurn is where that distinction is drawn.

Structs§

NativeTurn
One appended-after-import conversation turn, as written to a native-v2 sidecar file (one JSON object per line, following the imported body).
SidecarWriter
Append-only writer for a native-v2 sidecar file (A2 store layout; A3 live persistence): the durable, full-fidelity home for a live agent conversation. Every append is line-atomic — full line + \n, then flushed — so a crash mid-write can only ever leave the next unwritten record torn, never corrupt one already on disk; Session::from_native_str tolerates a torn trailing line exactly as the per-source loaders already tolerate corrupt lines.