Files
jetbrains-cc-gui/docs/opencode/samples/opencode-1.18.32/slow-tool-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":1790662547861,"sessionID":"ses_f143254daffe9NyALFG6ieUA0G","part":{"id":"prt_0ebce198a0016b8IiBNYE7NhXx","messageID":"msg_0ebcdafea001OFWW8No61QwJSQ","sessionID":"ses_f143254daffe9NyALFG6ieUA0G","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","type":"step-start"}}
{"type":"tool_use","timestamp":1790662555131,"sessionID":"ses_f143254daffe9NyALFG6ieUA0G","part":{"type":"tool","tool":"bash","callID":"call_0f859d4e04f5409482a8a7c6","state":{"status":"completed","input":{"command":"sleep 6 && echo done-sleeping"},"output":"done-sleeping\n","metadata":{"output":"done-sleeping\n","exit":0,"truncated":false},"title":"sleep 6 && echo done-sleeping","time":{"start":1790662548617,"end":1790662555046}},"id":"prt_0ebce1b9a001IeI34IAPAfeNhU","sessionID":"ses_f143254daffe9NyALFG6ieUA0G","messageID":"msg_0ebcdafea001OFWW8No61QwJSQ"}}
{"type":"step_finish","timestamp":1790662556450,"sessionID":"ses_f143254daffe9NyALFG6ieUA0G","part":{"id":"prt_0ebce3b08001qkPwWNTSLPc5Ia","reason":"tool-calls","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","messageID":"msg_0ebcdafea001OFWW8No61QwJSQ","sessionID":"ses_f143254daffe9NyALFG6ieUA0G","type":"step-finish","tokens":{"total":8770,"input":25,"output":27,"reasoning":14,"cache":{"write":0,"read":8704}},"cost":0}}
{"type":"step_start","timestamp":1790662567622,"sessionID":"ses_f143254daffe9NyALFG6ieUA0G","part":{"id":"prt_0ebce66b4001IhwwwMWLgihR5J","messageID":"msg_0ebce3f68001kxC3v3X6NM2Nv7","sessionID":"ses_f143254daffe9NyALFG6ieUA0G","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","type":"step-start"}}
{"type":"text","timestamp":1790662567623,"sessionID":"ses_f143254daffe9NyALFG6ieUA0G","part":{"id":"prt_0ebce66be0011dZGgFgQ2tzRLD","messageID":"msg_0ebce3f68001kxC3v3X6NM2Nv7","sessionID":"ses_f143254daffe9NyALFG6ieUA0G","type":"text","text":"done-sleeping","time":{"start":1790662567614,"end":1790662567618}}}
{"type":"step_finish","timestamp":1790662568277,"sessionID":"ses_f143254daffe9NyALFG6ieUA0G","part":{"id":"prt_0ebce694f001P59tsJIDG3YrLg","reason":"stop","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","messageID":"msg_0ebce3f68001kxC3v3X6NM2Nv7","sessionID":"ses_f143254daffe9NyALFG6ieUA0G","type":"step-finish","tokens":{"total":8794,"input":78,"output":6,"reasoning":6,"cache":{"write":0,"read":8704}},"cost":0}}