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).