/** * OpencodeAgentRunner — AgentRunner impl backed by the opencode server. * * Architectural difference from ClaudeAgentRunner: * - Claude's `query()` runs the whole agent loop IN-PROCESS (tools execute * inside the same Node process as the daemon). That's why ClaudeAgentRunner * can register org tools (org_send, ask_human, …) directly via * createSdkMcpServer. * - opencode runs the agent loop in its OWN server process. The SDK is a * remote client: create a session, POST prompts, read the response. * * Verified against @opencode-ai/sdk 1.18.x (NOT the docs — the .d.ts and a * live probe): * - `createOpencode()` spawns a server and returns { client, server }. * - `client.session.create({ body: { title } })` → `{ data: { id } }`. * - `client.session.prompt({ path: { id }, body: { parts: [{ type: 'text', * text }], system?, model? } })` BLOCKS for the whole turn and returns * `{ data: { info, parts } }` — info carries tokens * ({ input, output, reasoning, cache: { read, write } }) and cost; the * assistant text lives in parts of type "text". * - Because prompt() blocks, undici's default headers timeout (~30s) kills * any real turn with UND_ERR_HEADERS_TIMEOUT. This runner installs a * dispatcher with headersTimeout matching TURN_TIMEOUT_MS — without it * every non-trivial org turn dies. * * Org tools (org_send, knowledge_search, …) travel over the shared FENCE * PROTOCOL (tool-fence.ts): rendered into the system prompt, parsed out of * the assistant text, executed in-process, results fed back into the same * session — same mechanism as KimiCodeAgentRunner. * * Non-disturbance guarantees: * - The SDK is imported dynamically; the package has no hard dependency on * @opencode-ai/sdk. Selected only via MONOMIND_RUNTIME=opencode; without * it the Claude path is byte-for-byte unchanged and run() rejects with a * clear actionable error instead of crashing at import time. */ import type { AgentMessage, AgentRunArgs, AgentRunner } from './agent-runner.js'; export declare class OpencodeAgentRunner implements AgentRunner { private opencodeUrl?; constructor(opencodeUrl?: string | undefined); run(args: AgentRunArgs): AsyncIterable; } //# sourceMappingURL=opencode-runner.d.ts.map