/** * ClaudeCodeDriver — second proof-of-pattern driver in the new ProviderRuntime contract. * * Like CodexDriver, this driver wraps the Claude Code CLI behind a structured * event stream. The transport is injected so tests can run without the real * `claude` binary. Real protocol parsing is intentionally minimal here — the * structure is locked, the parsing fills in driver-by-driver during the live * cut-over (see commits 12+ for the new RPC surface that becomes the caller). * * Claude Code emits JSON-line events on stdout. Recognized event kinds: * - assistant_delta → message.assistant.delta * - assistant_message → message.assistant.complete * - tool_use_start → tool.call.started * - tool_use_output → tool.call.output * - tool_use_complete → tool.call.completed * - turn_complete → turn.completed (+ session ready) * - usage → usage.updated * - mcp_status → mcp.status.updated * - approval_request → approval.requested * * Anything else is surfaced as a diagnostic.warn. */ import { Effect } from "effect"; import { type HarnessError } from "../contracts/errors.js"; import { BaseHarnessDriver, type HarnessDriverConfig, type HarnessTurnRequest } from "./base.js"; export interface ClaudeCodeTransport { 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 ClaudeCodeTransportFactory { (opts: { model: string; env: NodeJS.ProcessEnv; cwd: string; }): Promise; } export interface ClaudeCodeDriverOptions extends Record { model?: string; cwd?: string; env?: NodeJS.ProcessEnv; spawnTransport: ClaudeCodeTransportFactory; } /** Canonical HarnessId for the Claude Code driver. */ export declare const CLAUDE_CODE_HARNESS_ID: import("../contracts/ids.js").Brand; export declare class ClaudeCodeDriver 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; }