import type { GuardConfig } from "#src/guard-config"; import type { HarnessRegistry } from "#src/harness/registry"; import { type LifecycleRegistry } from "#src/lifecycle-controller"; import type { ResolvedSandboxPolicy, SandboxAvailability, SandboxProvider } from "#src/sandbox/types"; import { type TmuxManager } from "#src/tmux-manager"; import type { SubagentTracker } from "#src/tracker"; import type { SpawnParams } from "#src/types"; /** Test hook: reset in-flight spawn reservations. */ /** Sandbox wiring passed into the spawner (subagent-os-sandbox §6.1). */ export interface SandboxSpawnDeps { policy: ResolvedSandboxPolicy; /** Security-relevant policy errors from resolution (task 2.3). */ policyErrors: string[]; provider: SandboxProvider; /** Cached provider availability (probed once per process). */ availability?: SandboxAvailability; } export declare function clearSpawnReservations(): void; /** * Spawn a subagent as a real coding agent in a tmux window. * * Lifecycle (called by the dispatcher): * 1. Resolve harness * 2. setupEnvironment() — prepare files, configs, hooks * 3. createWorktree() — git worktree isolation (NEW, between setupEnv and buildCmd) * 4. bootstrapWorktree() — symlinks, cache copy * 5. buildLaunchCommand() — build the TUI command * 6. createWindow() — create the tmux window with the command * 7. waitForReady() — poll readiness, discover session file * 8. sendKeys() — deliver the prompt * 9. monitor() — LifecycleController watches for completion (fire-and-forget) * 10. on completion: tryMerge() — squash-merge ephemeral worktree (NEW) * 11. cleanup() — remove temp files, restore configs, remove ephemeral worktree */ export declare function spawnSubagent(params: SpawnParams, parentSessionId: string, tracker: SubagentTracker, tmux: TmuxManager, harnessRegistry: HarnessRegistry, abortSignal?: AbortSignal, guardConfig?: GuardConfig, maxConcurrentAgents?: number, stopKeyCombo?: string, enableSubagentCleanup?: boolean, registry?: LifecycleRegistry, /** Ms to wait after terminal before physical cleanup. 0 = immediate. */ cleanupLingerMs?: number, /** Presentation hook invoked synchronously once the spawn UUID exists. */ onAgentIdAllocated?: (agentId: string) => void, /** * Optional sandbox wiring (subagent-os-sandbox). When absent or the policy * is disabled, the launch is byte-for-byte unchanged. When enabled the * spawner wraps the fully assembled command before `createWindow`, refuses * before window creation on invalid policy / fail-closed unavailability, * and persists the audit on the record. */ sandboxDeps?: SandboxSpawnDeps, /** * Optional host-registry lookup (HostAdapter.lookupContextWindow). When it * returns a positive number for the resolved provider/model, the spawner * stamps `record.contextWindow` so the health bar's denominator reflects the * real (possibly long-context) window. Absent/undefined → no stamp; the * health bar falls through to session-reported or static-table denominators. */ lookupContextWindow?: (provider: string | undefined, model: string | undefined) => number | undefined): Promise; /** * Apply harness config-dir redirect env so it covers the full launch command * (including any leading `cd … &&` from the harness). Exported for tests. */ export declare function applyRedirectEnv(command: string, redirectEnv: Record): string; //# sourceMappingURL=spawner.d.ts.map