import { isProcessAlive } from "./process-liveness.ts"; export declare const ACTIVE_TURN_TTL_MS: number; export declare const AUTO_RELOAD_COORDINATOR_TTL_MS: number; export declare function getReloadCoordinationDir(agentDir?: string): string; export interface ReloadSessionRecord { key: string; source: "active-turn" | "coordinator"; pid?: number; sessionId?: string; sessionFile?: string; cwd?: string; active?: boolean; updatedAt?: number; seenAt?: number; reloadedAt?: number; reason?: string; } export interface PendingReloadBlockers { pending: boolean; reason: string; blockers: ReloadSessionRecord[]; descriptions: string[]; } export interface ReloadBlockerOptions { agentDir?: string; now?: number; ownKey?: string; ownPid?: number; ownSessionId?: string; ownSessionFile?: string; activeTurnTtlMs?: number; coordinatorTtlMs?: number; /** Auto Learn workers are memory-first, short-lived, and should not block foreground reload/adaptive work by default. */ includeAutoLearnSessions?: boolean; isProcessAlive?: (pid: number | undefined) => boolean; } export { isProcessAlive as isReloadSessionProcessAlive }; export declare function describeReloadSession(record: Pick): string; export declare function getPendingReloadBlockers(options?: ReloadBlockerOptions): PendingReloadBlockers; /** * In-process quiesce registry: the reload gate's unified source of truth for background work * running IN THIS PROCESS that must finish before a `/reload`, profile switch, or live extension * load/unload/reconcile may proceed — background lanes (research/worker/model-fitness), the * context-scout's own Agent, and isolated completions (through their single choke point, * `ReflectionController.runIsolatedCompletion`) all register here. Foreground streaming/compaction * are NOT registered here — the host already exposes those via `RuntimeBuilderDeps.isStreaming`/`isCompacting`, * and the gate checks both alongside this registry instead of duplicating that state into a second tracker. * * Keyed by `agentDir`, matching every cross-process function above, so two sessions rooted at * different agent dirs (as every test harness in this repo constructs them) never see each other's * in-flight work. * * Registration is a plain in-memory counter, not file-backed — nothing here survives a process * restart, and nothing needs to: a crashed process cannot hold its own reload gate hostage. The * returned deregister function MUST be called from a `finally` block by every caller — an * un-deregistered unit would wedge the gate forever — so deregistering twice is a safe no-op rather * than a footgun for a caller that also deregisters on an early-return path. */ export type InFlightWorkKind = "lane" | "scout" | "isolated-completion"; export interface InFlightWorkUnit { id: number; kind: InFlightWorkKind; label: string; registeredAt: number; } /** Registers one in-flight background work unit for `agentDir`. Returns its deregister function. */ export declare function registerInFlightWork(agentDir: string, kind: InFlightWorkKind, label: string): () => void; /** Live in-flight units for `agentDir`, oldest first. Empty when nothing is registered. */ export declare function getInFlightWorkUnits(agentDir: string): InFlightWorkUnit[]; export declare function describeInFlightWorkUnit(unit: InFlightWorkUnit): string; /** * Test-only escape hatch: clears every agentDir's registry so one test's leaked registration cannot * block another's reload gate or status text. */ export declare function resetInFlightWorkRegistryForTests(): void; //# sourceMappingURL=reload-blockers.d.ts.map