import { type ChildProcess } from 'node:child_process'; /** * Warm-launch fast path. * * This module is the only code that runs before the harness child is spawned * on a warm launch, so it must stay dependency-light: node builtins only, no * workspace packages, no npm deps. The heavy CLI module graph * (`cli-impl.js`) is imported by the thin entry *after* the child is already * running. * * The contract: a prior full launch wrote a {@link LaunchPlan} recording the * exact spawn (bin + argv), the warm mount location, and stat-level digests * of every input that fed persona resolution. `tryFastAgentLaunch` re-checks * those digests, atomically claims the warm mount via rename, and spawns. * Any doubt — missing plan, changed digest, set env var, claimed mount — * returns null and the caller takes the full launch path, which rebuilds * both the plan and the warm mount at exit. Correctness never depends on the * fast path engaging; it only depends on the digests being strict enough to * refuse when the slow path would have produced different session inputs. */ export declare const LAUNCH_PLAN_SCHEMA_VERSION = 1; export interface StatDigest { path: string; /** null = the path did not exist at plan time (and must still not exist). */ size: number | null; mtimeMs: number | null; } export interface LaunchPlan { schemaVersion: number; cliVersion: string; cwd: string; selector: string; personaId: string; harness: string; model: string; /** * Stat digests of every file/dir that feeds persona resolution or mount * pattern construction. All must match exactly for the plan to be trusted. */ digests: StatDigest[]; /** * Env vars that fed resolution, pinned to their plan-time values * (null = unset). Persona input names, workforce-home overrides, and — for * harnesses where relay MCP injection applies — the RELAY_* config. Any * difference at fast-launch time means the resolved spec could differ, so * the fast path refuses. */ envExact: Record; skillCache: { dir: string; fingerprint: string; /** Raw AGENTWORKFORCE_SKILL_CACHE_CHECK_INTERVAL at plan time (null = unset). */ upstreamIntervalRaw: string | null; /** Parsed interval; null = checks disabled. */ upstreamIntervalMs: number | null; }; spawn: { /** Absolute path resolved at plan time; must still exist. */ binPath: string; args: string[]; /** * Env vars layered over process.env for the child. Only persona-input * values resolved from declared defaults land here — literal strings * from the digest-pinned persona spec, never values sourced from the * caller's environment. */ envAdditions: Record; }; mount: { warmDir: string; ignoredPatterns: string[]; readonlyPatterns: string[]; }; } export interface FastLaunch { plan: LaunchPlan; child: ChildProcess; sessionRoot: string; mountDir: string; /** Path to the claimed autosync state snapshot from the previous session. */ statePath: string; /** * Set when the child emitted 'error' before the session manager attached * its listeners (e.g. the recorded binary vanished between the existence * check and the spawn). The session manager treats it as exit code 127. */ spawnFailure: { error: Error | null; }; startedAt: number; } export declare function launchPlanKey(cwd: string, selector: string): string; export declare function launchPlanPath(cwd: string, selector: string): string; export declare function warmMountDir(cwd: string, selector: string): string; export declare function statDigestOf(path: string): StatDigest; /** * Attempt the warm fast launch for `agentworkforce agent `. * * Returns the spawned child (plus everything the post-spawn bookkeeping * needs) when every validation held and the warm mount was claimed, or null * when the caller must run the full launch path. Never throws for "plan is * stale" conditions — only for programmer errors. */ export declare function tryFastAgentLaunch(rest: readonly string[]): FastLaunch | null; /** * Persist a launch plan (0600 — it holds no secrets by construction, but * there's no reason to share it either). Written by the full launch path * after a successful session. */ export declare function writeLaunchPlan(plan: LaunchPlan): void; /** Remove a stale plan so the next launch takes the full path. */ export declare function deleteLaunchPlan(cwd: string, selector: string): void; //# sourceMappingURL=fast-launch.d.ts.map