import type { CodingAgentSessionProvider } from "./agent-session-provider.js"; import type { ClaudeAgentRow } from "./claude-terminal-agent-adapter.js"; import type { CodexLocalSessionAdapter } from "./codex-local-session-provider.js"; import type { ExecutorKind } from "./executors.js"; import type { TerminalThreadLifecycleCandidateProvider } from "./terminal-agent-adapter.js"; import type { TerminalControlProviderRegistry } from "./terminal-control-provider.js"; import type { TerminalProcessSource } from "./terminal-process-source.js"; type CliDependencyOptions = Readonly>; /** * Process-level dependencies used by an imported CLI command execution. * * Every dependency is scoped to one async execution. This deliberately avoids * mutating process globals, so independent in-process commands can run in * parallel without sharing providers, output, environment, or clocks. */ export interface CliCommandDependencies { terminalControlProviderRegistry?: TerminalControlProviderRegistry; terminalProcessSource?: TerminalProcessSource; createAgentSessionProvider?: (agent: "codex", options: Options) => CodingAgentSessionProvider; codexLocalSessionAdapter?: CodexLocalSessionAdapter | ((options: Options) => CodexLocalSessionAdapter); codexThreadLifecycleProvider?: TerminalThreadLifecycleCandidateProvider; loadClaudeAgentRows?: (options: Options, observation: { required?: boolean; }) => ClaudeAgentRow[]; agentVersionForRunningProcess?: (agent: ExecutorKind, pid: number, options: Options) => string | undefined; codexProcessBirthForPid?: (pid: number) => string; /** Adapter-neutral process birth used to fence physical terminal actions. */ processBirthForPid?: (pid: number) => string; stdout?: (text: string) => void; cwd?: string | (() => string); env?: NodeJS.ProcessEnv; pid?: number; now?: () => Date | number; /** Monotonic clock for terminal composer settling; production uses performance.now. */ monotonicNowMs?: () => number; sleep?: (milliseconds: number) => Promise; sleepSync?: (milliseconds: number) => void; exit?: (code: number) => never; runtimeLog?: (level: "info" | "warn" | "error", event: string, fields: Record) => void; } export interface CliCommandExecutionResult { exitCode: number; stdout: string; } /** Run one CLI command inside its async-local dependency and output boundary. */ export declare function runCliCommandExecution(commandName: string | undefined, options: Options, dependencies: CliCommandDependencies, command: () => Promise): Promise; export declare function cliDependencies(): Readonly>; export declare function writeCliStdout(text: string): void; export declare function setCliExitCode(exitCode: number): void; export declare function cliCwd(): string; export declare function cliEnv(): NodeJS.ProcessEnv; export declare function cliPid(): number; export declare function cliNow(): Date; export declare function cliNowMs(): number; export declare function cliSleep(milliseconds: number): Promise; export declare function cliSleepSync(milliseconds: number): void; export declare function cliExit(code: number): never; export declare function cliRuntimeLog(level: "info" | "warn" | "error", event: string, fields?: Record): void; export {};