import type { LoopPhase, LoopState } from "./types.ts"; export declare function isTerminalPhase(phase: LoopPhase): boolean; export interface WorkerTaskState { /** "pending" | "running" | "completed" | "error" | "cancelled" | "timeout" */ status: string; /** False when the task ID is unknown to the dispatch system. */ exists: boolean; } export declare class LoopStore { private directory; private dirHash; private _latestLoops; private _dirty; private _debounceTimer; private _resolveFns; constructor(directory: string); private statePath; private toFile; /** * Debounced save: stores the latest loops reference, sets dirty flag, * and restarts a 200ms timer. When the timer fires, the I/O is performed * and all pending promises are resolved. * * Multiple rapid calls are coalesced into a single I/O operation. */ save(loops: Map): Promise; /** Resolve all pending save promises. */ private _flushResolves; private _doSave; saveSync(loops: Map): void; load(): Map | null; /** * Reconcile persisted loops against dispatch task state after a restart. * * For each non-terminal loop with an active worker task, queries dispatch * state to decide the correct recovery action. Terminal loops are pruned. * * @returns The mutated `loadedLoops` map (same reference) with recovery applied. */ reconcile(loadedLoops: Map, getWorkerState: (taskId: string) => Promise): Promise>; /** * Clean up the pending debounce timer. Should be called when the store * is being disposed to prevent stale timer callbacks. */ dispose(): void; } //# sourceMappingURL=loop-store.d.ts.map