export interface StopResult { stopped: boolean; runId: string; killedPid?: number; fallbackFlagOnly?: boolean; } export interface SpawnAck { runId: string; task: string; pid?: number; cwd: string; spawnError?: string; } /** * Injected spawn fn — default wraps execa. Tests pass a fake that records * args + returns a fake child without launching a real process. */ export type SpawnFn = (file: string, args: string[], options: { cwd: string; detached: boolean; stdio: "ignore"; }) => { pid?: number; unref: () => void; }; /** Injected kill function. Defaults to process.kill. Tests pass a fake. */ export type KillFn = (pid: number, signal?: string | number) => void; export interface RunSpawnerOptions { projectRoot: string; sessionId: string; /** Injected spawn function. Defaults to a thin execa wrapper. */ spawn?: SpawnFn; /** Injected CLI entry path. Defaults to resolveCliEntry(). */ cliEntry?: string; /** Injected Node.js binary path. Defaults to process.execPath. */ nodeBin?: string; /** Injected clock returning ISO string. Defaults to () => new Date().toISOString(). */ now?: () => string; /** Injected kill function. Defaults to process.kill. Tests pass a fake. */ kill?: KillFn; } export declare class RunSpawner { private readonly projectRoot; private readonly sessionId; private readonly spawnFn; private readonly killFn; private readonly cliEntry; private readonly nodeBin; private readonly now; private readonly sidecar; constructor(opts: RunSpawnerOptions); /** * Write the roster state.json, launch a detached child, record the pid, * and return an immediate SpawnAck without waiting for the child to finish. * * @param opts.careful - When true, appends --approve-gates with the curated * gate list to the child args. Default false (autopilot — byte-for-byte * identical to Phase 1 behavior). */ spawn(task: string, runId: string, opts?: { careful?: boolean; }): Promise; /** * Stop a running run by its runId. * Resolves the PID from the session sidecar and sends SIGTERM. * If no sidecar entry is found, flips state to 'aborted' on disk only. * Tolerates ESRCH (already-dead pid) — treat as already stopped. */ stop(runId: string, reason: string): Promise; } //# sourceMappingURL=run-spawner.d.ts.map