import { type RunCliSessionOptions, type SpawnLike } from './cli-session.js';
import type { Driver, DriverEvent, DriverPromptOptions, DriverQuota, DriverSession, DriverStartOptions, DriverTurn } from './types.js';
/** Claude Code permission modes we pass through to the CLI. */
export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
/** A stdio MCP server spec, as written into the `--mcp-config` file (#452). */
export interface McpServerSpec {
    command: string;
    args?: string[];
    env?: Record<string, string>;
}
/** Options for {@link ClaudeCodeDriver}. */
export interface ClaudeCodeDriverOptions {
    /** CLI binary to spawn. Default `"claude"` (resolved on `PATH`). */
    bin?: string;
    /**
     * Permission mode. Default `"acceptEdits"` so file writes are non-interactive.
     * A fully autonomous build that also runs installs / tests needs
     * `"bypassPermissions"` (or {@link dangerouslySkipPermissions}).
     */
    permissionMode?: PermissionMode;
    /** Add `--dangerously-skip-permissions`. Only for sandboxes with no network. */
    dangerouslySkipPermissions?: boolean;
    /** Extra CLI args appended verbatim (escape hatch). */
    extraArgs?: string[];
    /**
     * MCP servers to expose to the agent for this session (#452). Written to a
     * temp config file passed via `--mcp-config`, so they merge with the user's
     * own configured MCP servers rather than replacing them. Used by `--browser`
     * to wire chrome-devtools-mcp (a real browser + DevTools tools) into the agent.
     */
    mcpServers?: Record<string, McpServerSpec>;
    /** Environment for the child process. Default `process.env`. */
    env?: NodeJS.ProcessEnv;
    /** `spawn` override for tests. Default `node:child_process.spawn`. */
    spawn?: SpawnLike;
}
/**
 * The first real {@link Driver}: wraps the **Claude Code CLI** in print mode
 * (`claude -p --output-format stream-json`). Each {@link DriverSession.prompt}
 * spawns a fresh non-interactive invocation, so every loop pass gets fresh
 * context (option A). We stream its JSON events to {@link DriverStartOptions.onEvent}
 * for the dashboard and return the final `result` text as the turn.
 *
 * True black box: we prompt and read the result; Claude Code owns its own loop,
 * tools, and (subscription-based) auth. A second agent slots in behind the same
 * `Driver` interface without touching the orchestration above it.
 */
export declare class ClaudeCodeDriver implements Driver {
    private readonly opts;
    readonly id = "claude-code";
    constructor(opts?: ClaudeCodeDriverOptions);
    start(opts: DriverStartOptions): Promise<DriverSession>;
    /** Where the account's subscription quota stands (#521). Account-wide, so no session. */
    readQuota(opts?: {
        signal?: AbortSignal;
    }): Promise<DriverQuota>;
}
/** One workspace-bound Claude Code session. `prompt` is a fresh CLI invocation. */
export declare class ClaudeCodeSession implements DriverSession {
    private readonly config;
    private readonly startOpts;
    readonly id: string;
    readonly cwd: string;
    /** Path to the written `--mcp-config` file, lazily created on first use. */
    private mcpConfigPath;
    /**
     * The agent's own session id from the last turn (#714). Retained so a
     * {@link DriverPromptOptions.resume} prompt can `--resume` the same
     * conversation; resume keeps the id stable, so consecutive chat messages chain.
     */
    private lastSessionId;
    constructor(config: ClaudeCodeDriverOptions, startOpts: DriverStartOptions);
    prompt(text: string, opts?: DriverPromptOptions): Promise<DriverTurn>;
    readCode(path: string): Promise<string>;
    dispose(): Promise<void>;
    private buildArgs;
    /**
     * Lazily materialize the `--mcp-config` file for {@link ClaudeCodeDriverOptions.mcpServers}.
     * Written once and reused across the session's prompts; `undefined` when no
     * servers are configured. Not `--strict-mcp-config`, so these merge with the
     * user's own MCP servers rather than replacing them.
     */
    private mcpConfigFile;
}
/** Spawn one Claude Code invocation and resolve with its final turn. */
export declare function runClaude(opts: Omit<RunCliSessionOptions, 'parser' | 'driver'>): Promise<DriverTurn>;
/**
 * Incremental parser for Claude Code's `stream-json` output: newline-delimited
 * JSON, one object per line. We surface assistant text + tool names as
 * {@link DriverEvent}s and keep the final `result` line as the turn text.
 * Kept separate from the process plumbing so it is unit-testable in isolation.
 */
export declare class StreamJsonParser {
    private finalText;
    private assistantText;
    private sessionId?;
    private usage?;
    /** Feed one line; returns the events it produced (may be empty). */
    push(line: string): DriverEvent[];
    private handleAssistant;
    /** The final turn: the `result` text, falling back to accumulated assistant text. */
    result(): DriverTurn;
}
//# sourceMappingURL=claude-code.d.ts.map