import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process"; import type { ActorCapabilities } from "./actor-contract.js"; import type { CuaProvider, CuaTurn } from "./computer-use.js"; import type { ReasoningEffort } from "./reasoning-effort.js"; type JsonObject = Record; /** The transport, injected so tests drive a fake session with no CLI and no spend. */ export interface ClaudeStreamTransport { /** Write one NDJSON message to the session. */ send(message: JsonObject): void; /** Resolves with the next `result` message; rejects if the session ends first or the clock runs out. */ awaitResult(timeoutMs: number, signal?: AbortSignal): Promise; close(): void; } /** NDJSON over the child's stdio. Everything that is not a `result` is a progress line and is ignored. */ export declare function stdioClaudeTransport(child: ChildProcessWithoutNullStreams): ClaudeStreamTransport; export interface ClaudeSessionOptions { /** Absent = spawn `claude`. Injected in tests. */ transport?: ClaudeStreamTransport; model?: string; /** Recorded on the trace; Claude Code's `-p` mode takes no effort flag, so this is what was asked for, not applied. */ reasoningEffort?: ReasoningEffort; /** Per-turn wall clock. */ timeoutMs?: number; /** Scratch root for the session's working directory (the screenshots it is allowed to Read). */ workRoot?: string; /** Extra arguments, e.g. a model override. Tests never pass any. */ spawnFn?: typeof spawn; } export declare const CLAUDE_SESSION_CAPABILITIES: ActorCapabilities; export interface ClaudeSession { provider: CuaProvider; /** Ends the process and removes its scratch directory. The run owns the lifetime, not the provider. */ close(): Promise; } /** The message shape Claude Code reads on stdin in stream-json mode. */ export declare function userMessage(text: string): JsonObject; /** * Start one Claude Code session and return a provider that spends it, one user message per * computer-use turn. Started EAGERLY (before the first screenshot) so the CLI's own boot is paid * while the sandbox is still settling rather than inside turn one. */ export declare function startClaudeSession(options?: ClaudeSessionOptions): Promise; /** Read a stream-json `result` message into a CuaTurn. Exported for tests. */ export declare function turnFromResult(result: JsonObject): CuaTurn; export {};