Skip to main content

Module types

Module types 

Source
Expand description

On-disk schema for Codex CLI rollout JSONL files.

Mirrors the upstream Rust types in openai/codex:codex-rs/protocol/src/{protocol,models}.rs closely enough for fidelity, but uses Value fallbacks on enum variants we don’t exhaustively enumerate so unknown future payloads survive round-trip. Each top-level line is a RolloutLine:

{"timestamp":"2026-04-20T16:44:37.772Z","type":"session_meta","payload":{...}}

The type field discriminates at the outer level. payload.type discriminates inside response_item and event_msg payloads.

Structs§

BaseInstructions
CustomToolCall
CustomToolCallOutput
ExecCommandEnd
FunctionCall
FunctionCallOutput
GitInfo
Message
PatchApplyEnd
Reasoning
RolloutLine
One JSONL line from a rollout file — a tagged payload with a timestamp. The struct preserves unknown fields and unknown type tags verbatim so round-trip re-serialization stays faithful.
SandboxPolicy
Session
A parsed session: the sequence of lines plus derived first-line metadata and a reference to the file on disk.
SessionMeta
First line of every rollout file; session_meta payload.
SessionMetadata
Lightweight session metadata (no full parse).
TokenCountEvent
TokenCountInfo
TokenUsage
TurnContext
Per-turn context snapshot.

Enums§

ContentPart
EventMsg
Non-model events: task lifecycle, exec results, patch application, token accounting, and a long tail of less common variants. The crate strongly-types the common ones and captures the rest as raw Value.
PatchChange
One file’s change within a PatchApplyEnd. Three type values documented upstream: add, update, delete. We strongly-type the common two (add has content, update has unified_diff and optional move_path) and leave room for more.
ResponseItem
Items emitted by the model — messages, reasoning, and tool calls.
RolloutItem
Typed view of a RolloutLine::payload by kind.