#[non_exhaustive]pub enum Event {
Init {
session_id: String,
harness: String,
api_schema: String,
model: String,
cwd: String,
max_turns: Option<u32>,
preamble: Vec<Message>,
tools: Vec<Value>,
},
Message {
message: Message,
},
MessageDelta {
text: String,
},
Result {
report: Report,
},
Error {
message: String,
},
Approval {
tool_use_id: String,
tool_name: String,
decision: String,
wait_ms: u64,
},
}Expand description
One event in the stream-json trajectory (one JSON object per line).
The stream is a self-sufficient, replayable source of the whole run: Init
carries the base prompt + tool specs + model, and each Event::Message carries a
full turn — so reconstruct_conversation rebuilds the entire history with nothing
else. (Claude Code’s stream omits system/tools, forcing a proxy capture to
recover them; Init closes that gap.) #[non_exhaustive] so events can be added
(e.g. per-turn markers) without a breaking change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Init
Emitted once at the start — everything needed to reconstruct context.
Fields
Message
A full message appended to the history (the trace): role + content blocks.
MessageDelta
An incremental assistant-text fragment during a streaming turn
(ADR-0021). Display-only: the whole Message is still appended at
turn end, so deltas are not part of the reconstructed history (the trace
stays whole-message — Q1). Emitted only when the engine runs in streaming
mode; consumers that want a whole-message trace drop this variant.
Result
The terminal event: the final report (identical to --output-format json).
Error
A non-terminal error note (e.g. a retry); terminal errors ride in Event::Result.
Approval
An approver resolution at the dispatch gate (ADR-0017) — grok’s journal
shape (PermissionResolved). Emitted for every consulted call,
allowed or denied, so interactive traces are complete; wait_ms (human
decision latency) is unrecoverable from any other artifact.