Files
jetbrains-cc-gui/docs/opencode/samples/opencode-1.18.32/tool-call-turn.jsonl
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

7 lines
2.3 KiB
JSON

{"type":"step_start","timestamp":1790662231361,"sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","part":{"id":"prt_0ebc944f00015sAso5vtigGK3J","messageID":"msg_0ebc8c4590010Q1IjVdoFXwtiw","sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","type":"step-start"}}
{"type":"tool_use","timestamp":1790662232106,"sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","part":{"type":"tool","tool":"bash","callID":"call_2b401be8a6be4077ba939fae","state":{"status":"completed","input":{"command":"echo hello-from-opencode"},"output":"hello-from-opencode\n","metadata":{"output":"hello-from-opencode\n","exit":0,"truncated":false},"title":"echo hello-from-opencode","time":{"start":1790662231524,"end":1790662232071}},"id":"prt_0ebc945b200153eO9FgEJoC3f9","sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","messageID":"msg_0ebc8c4590010Q1IjVdoFXwtiw"}}
{"type":"step_finish","timestamp":1790662234565,"sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","part":{"id":"prt_0ebc95195001ab36HkNnzUZYLf","reason":"tool-calls","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","messageID":"msg_0ebc8c4590010Q1IjVdoFXwtiw","sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","type":"step-finish","tokens":{"total":8759,"input":8725,"output":23,"reasoning":11,"cache":{"write":0,"read":0}},"cost":0}}
{"type":"step_start","timestamp":1790662265050,"sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","part":{"id":"prt_0ebc9c8cb001gDbt7fjJ2iGFzL","messageID":"msg_0ebc95a13001cJlf5sguxIQiVn","sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","type":"step-start"}}
{"type":"text","timestamp":1790662265393,"sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","part":{"id":"prt_0ebc9c9f0001P9bhtegsrjdu3l","messageID":"msg_0ebc95a13001cJlf5sguxIQiVn","sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","type":"text","text":"`hello-from-opencode`","time":{"start":1790662265328,"end":1790662265388}}}
{"type":"step_finish","timestamp":1790662266335,"sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","part":{"id":"prt_0ebc9cdba001nhi7nN68HvXAzf","reason":"stop","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","messageID":"msg_0ebc95a13001cJlf5sguxIQiVn","sessionID":"ses_f14373e58ffeeZuGhIhktclFxr","type":"step-finish","tokens":{"total":8794,"input":6723,"output":8,"reasoning":15,"cache":{"write":0,"read":2048}},"cost":0}}