/** * Debounced write-behind scheduling, shared by the disk-backed caches (model catalog, probe * cache, runtime telemetry). Each dirtying touch re-arms a short timer so bursts coalesce into * one write, while the first touch starts a max-age clock so a steady stream of touches cannot * defer the flush forever. */ export declare const DEFAULT_FLUSH_DELAY_MS = 250; export declare const MAX_FLUSH_DELAY_MS = 2000; export declare class WriteBehindTimer { private timer; private dirtySince; /** The flush the latest touch armed, kept so a shutdown can run it without waiting. */ private pending; /** True when a touch has not yet been flushed (or cancelled). */ get dirty(): boolean; /** * Re-arm the debounce. `flush` runs after the delay, with this timer already marked clean — * so a flush implementation that also calls `clear()` (eager-flush paths do) stays idempotent. */ touch(flush: () => void, now?: number): void; /** * Run the armed flush NOW when a touch is still unflushed; a clean timer does nothing. * * The shutdown seam. Every write-behind store trades a bounded crash window (`MAX_FLUSH_DELAY_MS`) * for a quiet request path, and a graceful shutdown is where that window is closed explicitly. * Returns true when a write ran, so a caller can count what it flushed. */ flushNow(): boolean; /** Cancel any pending timer and mark clean. Call from eager-flush paths before writing. */ clear(): void; } /** * The timers one store has installed, so its shutdown flush can reach every one of them without * each installer handing back a handle. * * A per-Config store (`dispatch-exhaustion-persistence.ts`, `dispatch-lane-stats.ts`, * `lane-affinity.ts`) creates one timer per install and returned only a restore count, so nothing * could flush it at shutdown: `runProxy` flushed six sibling stores and none of these. A registry * per store keeps that count-returning signature — the tests pin it — and gives the shutdown path * one call per store. */ export declare class WriteBehindRegistry { private readonly timers; /** Remember a timer; returns it so `register(new WriteBehindTimer())` reads as one expression. */ register(timer: WriteBehindTimer): WriteBehindTimer; /** * Flush every dirty timer. A write that throws never stops the others — persistence is * best-effort at every other seam in this repository and a shutdown is no place to start * failing. Returns how many writes ran. */ flushAll(): number; }