Files
57ggfk e2e2264d76 feat(opencode): show tool calls and thinking in the process stream
OpenCode 1.18 run --format json pushes each part only once with
terminal state: text/reasoning arrive as complete parts and the tool
part arrives as a single completed event. The parser assumed a
two-phase started->completed tool flow, so it emitted orphan
tool_results that never rendered, and the missing --thinking flag made
the CLI suppress reasoning parts entirely.

- classify events by part.type (text/reasoning/tool), keeping legacy
  top-level type matching as fallback
- synthesize the tool_use + tool_result pair from the single terminal
  tool event, keyed on part.callID; started-dedup keeps future
  two-phase pushes converging on one card
- pass the plugin thinking toggle down to --thinking (Java stdin ->
  channel -> argv); bypassPermissions maps to --auto
- emit only the novel suffix when a part is re-pushed with cumulative
  text, so text never doubles in the UI
- capture real 1.18.32 event samples and replay them as test fixtures

The streaming toggle stays a documented no-op for OpenCode until a
serve-based integration lands (see docs/plans plan for the matrix).
2026-09-30 23:18:22 +08:00

4 lines
1.0 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"type":"step_start","timestamp":1790662444627,"sessionID":"ses_f1433d0b4ffeqPsO1S5RiM2ybC","part":{"id":"prt_0ebcc863b0015A5GRfLWlIlkob","messageID":"msg_0ebcc3431001Rzy63AKesXVRxE","sessionID":"ses_f1433d0b4ffeqPsO1S5RiM2ybC","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","type":"step-start"}}
{"type":"text","timestamp":1790662445460,"sessionID":"ses_f1433d0b4ffeqPsO1S5RiM2ybC","part":{"id":"prt_0ebcc87ef001xvCmSQ68XrgHNP","messageID":"msg_0ebcc3431001Rzy63AKesXVRxE","sessionID":"ses_f1433d0b4ffeqPsO1S5RiM2ybC","type":"text","text":"17 × 23 = 17 × (20 + 3) = 340 + 51 = **391**","time":{"start":1790662445039,"end":1790662445455}}}
{"type":"step_finish","timestamp":1790662446931,"sessionID":"ses_f1433d0b4ffeqPsO1S5RiM2ybC","part":{"id":"prt_0ebcc8f4c0017ttbX09DrTIY4R","reason":"stop","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","messageID":"msg_0ebcc3431001Rzy63AKesXVRxE","sessionID":"ses_f1433d0b4ffeqPsO1S5RiM2ybC","type":"step-finish","tokens":{"total":8779,"input":26,"output":35,"reasoning":14,"cache":{"write":0,"read":8704}},"cost":0}}