pub enum ChatEvent {
UserText {
timestamp_ms: u64,
text: String,
},
AssistantText {
timestamp_ms: u64,
message_id: String,
model: String,
text: String,
},
Thinking {
timestamp_ms: u64,
message_id: String,
model: String,
text: String,
},
ToolUse {
timestamp_ms: u64,
message_id: String,
tool_use_id: String,
name: String,
input_json: String,
},
ToolResult {
timestamp_ms: u64,
tool_use_id: String,
content: String,
is_error: bool,
},
}Expand description
Flat, timestamp-ordered event stream extracted from a Claude Code session’s
JSONL. Produced by parse_chat_events and rendered by the frontend chat
view. This is a read-only projection of the same file used by the usage
tracker — the live PTY remains the input path.
Pairing of ToolUse → ToolResult is left to the frontend via tool_use_id
so the event stream stays flat and cheap to serialize.
Variants§
UserText
A real user turn (keyboard input). Does NOT include tool_result
entries — those are emitted as ToolResult below.
AssistantText
Assistant text block. One ChatEvent::AssistantText per text block in
the assistant message; turns with no text block emit none.
Thinking
Extended-thinking block (Opus). Collapsed by default in the UI.
ToolUse
Tool invocation by the assistant. input_json is the raw JSON of the
input field, serialized as a string — the frontend decides whether to
pretty-print, truncate, or tree-render.
ToolResult
Tool result injected by the harness. Pairs with a ToolUse by
tool_use_id. content is the text payload (stringified if the JSONL
stored it as a block array).