opencode
opencode
The opencode worker exposes the OpenCode API as iii functions. One
opencode::run call executes one headless OpenCode turn — the same agent the
user runs in their terminal, with the same tools — in a chosen working
directory, and returns the final result, token usage, and cost. Every JSON
event OpenCode emits (step_start, text, tool_use, step_finish) is
delivered verbatim on opencode::on-raw-event; a translated AgentEvent view
is delivered on opencode::on-agent-event, which the acp worker renders.
Observe either with args { session_id }
(iii.observe({ function_id: 'opencode::on-agent-event', args: { session_id }, deliver: 'output' }, target));
frames are ephemeral (not stored, not replayed).
Requires the opencode CLI on the host and an API key for the LLM provider you
use (e.g. ANTHROPIC_API_KEY, or opencode auth). When a turn needs a
capability beyond OpenCode itself, add another iii worker to the bus instead of
bolting anything onto this one.