import type { EngineResult } from "./types.js"; /** Whether error text reads as a quota window rather than a fault. Engine * results are one caller; a settled attempt's stored error is the other, and * both have to reach the same verdict or the same outage reads two ways. * * Throttling and allowance are one verdict here: the caller waits either way. */ export declare function isRateLimitMessage(text: string | null | undefined): boolean; export interface RateLimitDetection { limited: boolean; /** Unix timestamp in seconds */ resetsAt?: number; } /** Human-facing provider/engine name for rate-limit state and notifications. */ export declare function rateLimitEngineLabel(engine: string): string; /** * Detect whether an engine result indicates a dead/expired session rather than * a transient or rate-limit error. A dead session is one where the engine exited * with an error but did zero work (no cost, no turns) and there is no rate-limit * signal — meaning the --resume ID is stale and should not be retried. */ export declare function isDeadSessionError(result: EngineResult): boolean; export declare function detectRateLimit(result: EngineResult): RateLimitDetection; export declare function computeRateLimitDeadlineMs(resetsAtSeconds?: number, extraMs?: number): number; export declare function computeNextRetryDelayMs(resetsAtSeconds?: number): { delayMs: number; resumeAt?: Date; }; /** * A limit that named no reset gives a parked session nothing to sleep to, so * every retry against it is a guess. These two bound the guessing: the wait * doubles until it settles at half an hour, and the park gives up well before * the six-hour deadline would have let it poke the engine ~360 times. * * A limit that later does name a reset leaves this path entirely — the stated * reset is slept to, exactly as before. */ export declare const MAX_UNSTATED_PARK_DELAY_MS: number; export declare const MAX_UNSTATED_PARK_ATTEMPTS = 12; /** The next guess: never shorter than the last one, never past the cap. */ export declare function nextUnstatedParkDelayMs(previousDelayMs: number): number; //# sourceMappingURL=rateLimit.d.ts.map