/** * Rate limiter for update checks * Prevents excessive npm registry queries */ export interface RateLimitState { lastCheck: string; checksToday: number; date: string; packageVersions: Record; } export declare function loadState(): RateLimitState; export declare function saveState(state: RateLimitState): void; export declare function shouldCheckForUpdates(intervalHours?: number): { allowed: boolean; reason?: string; }; /** * Atomically check the daily limit and pre-increment the counter. * Returns false if already at the limit. Callers MUST call recordCheck * only after a successful reserveCheck, so that limit enforcement and * increment happen in the same synchronous turn (no await gap between * them), preventing two concurrent callers both seeing "allowed". * * IMPORTANT: performs a single loadState() → check → increment → saveState() * cycle to eliminate the TOCTOU window that existed when this function * delegated to shouldCheckForUpdates() (which called loadState() itself) * and then called loadState() a second time to increment. Two callers * sharing that gap could both see allowed=true and both increment. */ export declare function reserveCheck(intervalHours?: number): { allowed: boolean; reason?: string; }; export declare function recordCheck(packageVersions: Record): void; export declare function getCachedVersions(): Record; export declare function clearCache(): void; //# sourceMappingURL=rate-limiter.d.ts.map