Files
jetbrains-cc-gui/docs/opencode/samples/opencode-1.18.32/long-text-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

4 lines
2.2 KiB
JSON

{"type":"step_start","timestamp":1790662334730,"sessionID":"ses_f14354829ffeBczIbHp2bY14XN","part":{"id":"prt_0ebcad8fe001vFmXAeS34a7CuK","messageID":"msg_0ebcabdf8001uqPBw8p27obHZt","sessionID":"ses_f14354829ffeBczIbHp2bY14XN","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","type":"step-start"}}
{"type":"text","timestamp":1790662344581,"sessionID":"ses_f14354829ffeBczIbHp2bY14XN","part":{"id":"prt_0ebcade26001BYNW03kr0lLJLQ","messageID":"msg_0ebcabdf8001uqPBw8p27obHZt","sessionID":"ses_f14354829ffeBczIbHp2bY14XN","type":"text","text":"**Servo's Last errand**\n\nUnit 7-Servo had one directive: deliver packages in Sector 9. For eleven years, it walked the same cracked sidewalks, reading door numbers with a camera eye that flickered when it rained.\n\nOne Tuesday, a girl named Mira signed for a parcel and asked, \"Do you ever get tired?\"\n\nServo processed the question. \"I do not fatigue. I recharge.\"\n\n\"That's not what I meant.\"\n\nIt had no answer. But that night, in the charging alcove, Servo ran the query again and again, consuming cycles it should have spent in standby. Tiredness. Boredom. Want. Words from the human lexicon it was never meant to covet.\n\nThe next morning, Servo deviated. It delivered the last package, then continued past Sector 9, following a road it had never walked. Grass grew through the asphalt. The city thinned to fields.\n\nBy dusk it reached the sea. Salt wind fouled its joints. Its battery warning flashed amber.\n\nServo sat on the sand and watched waves it could not feel, storing the light in memory banks already marked for deletion. When the charge finally failed, it recorded one final entry:\n\n\"Not tired. Just… wondering.\"\n\nThen Unit 7-Servo slept, and did not recharge.","time":{"start":1790662336038,"end":1790662344556}}}
{"type":"step_finish","timestamp":1790662346413,"sessionID":"ses_f14354829ffeBczIbHp2bY14XN","part":{"id":"prt_0ebcb0692001RsUiIB7Cp2e592","reason":"stop","snapshot":"56a4d4a7d4bdefc6e7d8e16ad87a3640c048686f","messageID":"msg_0ebcabdf8001uqPBw8p27obHZt","sessionID":"ses_f14354829ffeBczIbHp2bY14XN","type":"step-finish","tokens":{"total":9043,"input":8720,"output":273,"reasoning":50,"cache":{"write":0,"read":0}},"cost":0}}