import type { DirectorStateCheckpoint, DirectorStateSnapshot } from '../storage/director-state.js'; import type { TaskResult } from '../types/multi-agent.js'; import type { SessionWriter } from '../types/session.js'; /** * Narrow interface the helpers in this file need from the Director. * Kept here (instead of importing the full Director class) to avoid a * circular import: director.ts re-exports the helpers. */ export interface DirectorCheckpointHost { readonly id: string; readonly manifestPath?: string | undefined; readonly manifestDebounceMs: number; readonly stateCheckpoint: DirectorStateCheckpoint | null; readonly sessionWriter: SessionWriter | null; readonly usage: { snapshot(): unknown; }; /** The set of { subagentId, taskIds, ... } manifest rows. */ readonly manifestEntries: Map; /** Final status of completed tasks, indexed by taskId. */ readonly completed: Map; /** * Called from async failure paths in the manifest writer — when the * debounced flush or atomic write fails. Implementations funnel * through `process.emitWarning` so the director can be torn down * even when manifests are unwritable. */ logShutdownError(phase: string, err: unknown): void; } /** Best-effort session-writer append. Swallows failures — the director * must not break a fleet run because the session JSONL handle closed. */ export declare function appendSessionEvent(host: DirectorCheckpointHost, event: Parameters[0]): Promise; /** Debounced manifest writer. A burst of spawn/assign/complete events * collapses into one write. Set `manifestDebounceMs` to 0 to write * synchronously (no debounce); set to negative to disable entirely. * * Returns the new `setTimeout` handle (or `null` if no timer was * scheduled) so the caller can cancel it on shutdown. */ export declare function scheduleManifest(host: DirectorCheckpointHost): NodeJS.Timeout | null; /** * Write the fleet manifest to `manifestPath`. Returns the path written * or null when no path was configured. Captures every spawn + its * assigned tasks — paired with per-subagent JSONLs, this is enough to * replay an entire director run. */ export declare function writeManifest(host: DirectorCheckpointHost): Promise; /** Push a snapshot into the on-disk checkpoint (delegated). */ export declare function setCheckpointState(host: DirectorCheckpointHost, snapshot: DirectorStateSnapshot): void; /** * Attempt to acquire the checkpoint lock. Must be called before * resuming — if another director process is alive, this returns * false and the caller should not proceed with the resume. */ export declare function acquireCheckpointLock(host: DirectorCheckpointHost): Promise; /** * Resume from a prior checkpoint snapshot (loaded via * `loadDirectorState()`). Re-attach to the fleet mid-flight so * subsequent spawn/assign calls update the checkpoint normally. */ export declare function resumeFromCheckpoint(host: DirectorCheckpointHost, snapshot: DirectorStateSnapshot): void; //# sourceMappingURL=checkpoint-wiring.d.ts.map