/** * Was this sandbox proven reachable recently enough to skip re-proving it? * * Every turn re-ran two network waits before the model saw the prompt — a * `WaitForSandboxRunning` long-poll and a `/health` GET through the cf-proxy — * even when the previous turn had finished seconds earlier. That is a constant * tax on the hot path, paid most visibly in voice, where it sits between the * user finishing a sentence and hearing anything at all. * * The probe is not pointless: a sandbox can expire on its TTL or have its pod * reclaimed while still briefly reporting RUNNING, and proxying to a dead pod * fails in ways that are worse to surface than a re-provision. So this does not * remove the check — it stops repeating a check that just passed. * * ★ The TTL is deliberately far shorter than the sandbox's own lifetime. Each * turn extends the sandbox by 600s, so a 60s readiness window can never outlive * the thing it describes; the worst case is that a sandbox dies inside the * window and one turn fails, which is exactly what happens today when it dies * mid-turn — and the caller already handles that by dropping it and * provisioning a fresh one. * * Correctness rests on the caller invalidating on failure. A cache that only * ever gets written on success, and never cleared, would pin a dead sandbox and * turn a recoverable error into a loop. */ /** How long a successful reachability proof stays good for. */ export declare const SANDBOX_READY_TTL_MS = 60000; /** * `now` is injected rather than read so the rule is testable and a clock skew * cannot make a passing check fail mysteriously. */ export declare function isRecentlyVerified(lastVerifiedAt: number | null | undefined, now: number, ttlMs?: number): boolean; export declare function createReadinessTracker(clock?: () => number): { /** True when this sandbox was proven reachable inside the TTL. */ isFresh(sandboxId: string): boolean; /** Record a successful proof. */ markVerified(sandboxId: string): void; /** * Drop a proof. MUST be called whenever a turn fails against this sandbox, * so a dead one is re-probed rather than trusted until the TTL lapses. */ invalidate(sandboxId: string | null | undefined): void; }; export type ReadinessTracker = ReturnType; //# sourceMappingURL=sandboxReadiness.d.ts.map