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 jsonevent stream into ordered tool invocations. - parse_
opencode_ events_ full - Parse an OpenCode
--format jsonevent stream into a fullTranscriptSummary.