#[non_exhaustive]pub enum RunEvent {
Started {
run_id: String,
},
Session {
run_id: String,
session_id: Option<String>,
model: Option<String>,
},
Text {
run_id: String,
delta: String,
},
Thinking {
run_id: String,
delta: String,
},
ToolStart {
run_id: String,
tool_call_id: String,
name: String,
input: Option<String>,
},
ToolEnd {
run_id: String,
tool_call_id: String,
ok: bool,
output: Option<String>,
},
SuggestedEdits {
run_id: String,
edits: Vec<SuggestedEdit>,
},
Activity {
run_id: String,
message: String,
},
Usage {
run_id: String,
input_tokens: Option<u64>,
output_tokens: Option<u64>,
total_tokens: Option<u64>,
},
Error {
run_id: String,
message: String,
},
Exited {
run_id: String,
exit_code: Option<i32>,
cancelled: bool,
},
}Expand description
The normalized event stream. #[serde(tag = "kind")] +
camelCase mirrors the existing ProcessEvent wire contract the TS
store already reads (event.kind, event.runId, …), so the
front-end consumes one shape regardless of which harness produced it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Started
First event, before any output. UI shows “thinking…”. Fired the
instant the process spawns — before the CLI reports its
session/model, which arrive separately as RunEvent::Session.
Session
The agent session is established — its id and the model in use.
Distinct from Started because it arrives a beat later, in the
CLI’s first output line (bob’s init, Claude’s system/init,
codex’s thread.started); keeping Started instant matters for
the “thinking…” feedback. Either field may be absent when the CLI
doesn’t report it (e.g. codex gives a thread id but no model).
Text
A chunk of assistant text. Appended to the active message.
Thinking
A chunk of model reasoning (“thinking”), rendered distinctly from
Text so the UI can show reasoning without mixing it into the
answer (e.g. Claude’s thinking_delta).
ToolStart
A tool call started — render a state-ful card keyed by id.
input is the call’s arguments when delivered inline (omitted
from the wire when absent, e.g. Claude streams them separately).
ToolEnd
A tool call finished (matched to its start by id). output is the
tool’s result when the harness reports it inline (omitted when absent).
SuggestedEdits
One or more proposed edits. The app prepares + previews them.
Activity
A human-readable status line (tool call, file touch, edit count). Replaces the message’s transient activity text.
Usage
Token accounting for the run, emitted near its end (from the
CLI’s result / turn.completed). Neutral tokens only —
harness-specific costs/credits (bob’s coins) are NOT here; a
consumer that wants them reads the harness’s own output. Any
field may be absent when the CLI doesn’t break usage down.
Fields
Error
Spawn / IO / parse failure. Terminal — followed by Exited.
Exited
The run finished. Sent exactly once.