Skip to main content

Module transcript

Module transcript 

Source
Expand description

OpenCode transcript (event-stream) parsing.

opencode run --format json emits a JSONL event stream whose envelopes carry {type, timestamp (epoch ms), sessionID, ...data}. tool_use events hold a self-contained tool part — the name at part.tool, the arguments at part.state.input, and the outcome at part.state.output (completed) or part.state.error (error) — which become ordered ToolInvocations. Token usage is summed from step_finish parts (part.tokens, cache reads excluded — matching the codex parser’s accounting), the final message is the last text part’s text, and the duration is the spread of the envelope timestamps.

Functions§

parse_opencode_events
Parse an OpenCode --format json event stream into ordered tool invocations.
parse_opencode_events_full
Parse an OpenCode --format json event stream into a full TranscriptSummary.