One turn through OpenCode
architecture node:
User input:
Representation at this boundary
Source modules
Loop map
One pass — user input →
session/prompt.ts runloop → tool registry → stream processor → LLM via AI SDK → tool execution with deferred permissions → SQLite persist → compaction check. The tool surface is rebuilt per request.Deferred permissions — permission decisions happen at the moment of use, not upfront. The model proposes; the permission layer disposes — per tool, per call.
Dual runtime — the session loop runs on two runtimes with Effect-TS dependency injection, and compiler feedback arrives inside the tool call via LSP rather than as a separate repair loop. The next user message re-enters at step 1.