/** * OpenCodeDriver — port of the OpenCode CLI harness to the new ProviderRuntime contract. * * OpenCode is an OpenAI-compatible Codex-like agent. Its stdout protocol is * structurally identical to Codex's (same JSON-line `kind` field, same * tool/turn lifecycle), but with model identifiers and a few different setup * conventions. This driver intentionally shares the Codex parser shape so a * future refactor can extract the shared "JSON-line agent" base class. * * Recognized event kinds (same as Codex): * - assistant_delta, assistant_message * - tool_started, tool_output, tool_completed * - turn_completed, usage */ import { Effect } from "effect"; import { type HarnessError } from "../contracts/errors.js"; import { BaseHarnessDriver, type HarnessDriverConfig, type HarnessTurnRequest } from "./base.js"; export interface OpenCodeTransport { write(line: string): Promise; close(reason?: string): Promise; kill(signal?: NodeJS.Signals): Promise; onLine(cb: (line: string, stream: "stdout" | "stderr") => void): () => void; onExit(cb: (code: number | null, signal: NodeJS.Signals | null) => void): () => void; } export interface OpenCodeTransportFactory { (opts: { model: string; baseUrl?: string; env: NodeJS.ProcessEnv; cwd: string; }): Promise; } export interface OpenCodeDriverOptions extends Record { model?: string; baseUrl?: string; cwd?: string; env?: NodeJS.ProcessEnv; spawnTransport: OpenCodeTransportFactory; } /** Canonical HarnessId for the OpenCode driver. */ export declare const OPENCODE_HARNESS_ID: import("../contracts/ids.js").Brand; export declare class OpenCodeDriver extends BaseHarnessDriver { private transport; private offLine; private offExit; constructor(config: HarnessDriverConfig); private opts; start(): Effect.Effect; sendTurn(req: HarnessTurnRequest): Effect.Effect; interrupt(reason?: string): Effect.Effect; shutdown(): Effect.Effect; private handleLine; private handleExit; }