/** * Provider error handling shared by the agent-core agent loop, the * coding-agent auto-retry, and the server error humanizer. * * Rate limits (HTTP 429): instead of surfacing the raw provider error JSON * we retry with an escalating backoff — 2s, 10s, 45s, 90s, 180s, then a * further 20 retries spaced 180s apart. This gives the provider quota * roughly an hour to recover before the run is allowed to fail. * * Payment required (HTTP 402): retrying cannot help (credits / key limit * exhausted), so the run fails fast with a clear contact-support message * instead of the raw provider error JSON. * * @module @spectral/ai/utils/rate-limit-retry */ /** Escalating backoff (ms) for the first rate-limit retries. */ export declare const RATE_LIMIT_RETRY_DELAYS_MS: readonly [2000, 10000, 45000, 90000, 180000]; /** Additional retries after the escalating table, all at the final delay. */ export declare const RATE_LIMIT_STEADY_RETRIES = 20; /** Total rate-limit retries before giving up: 5 escalating + 20 steady. */ export declare const MAX_RATE_LIMIT_RETRIES: number; /** * Check whether an error message (which may embed a raw provider JSON blob) * indicates the request was rejected with a rate limit / 429. */ export declare function isRateLimitError(text: string): boolean; /** * Backoff for the Nth rate-limit retry (1-based). * Attempts 1-5 follow the escalating table; attempts 6-25 wait 180s each. */ export declare function getRateLimitRetryDelayMs(attempt: number): number; /** User-facing retry notice, e.g. "Model provider rate limit hit, retrying in 45s (attempt 3/25)…" */ export declare function formatRateLimitRetryMessage(attempt: number, delayMs: number): string; /** * Check whether an error message (which may embed a raw provider JSON blob) * indicates the request was rejected with HTTP 402 — credits or per-key * limit exhausted. Unlike rate limits, this is not retryable. */ export declare function isPaymentRequiredError(text: string): boolean; /** * User-facing notice for 402 rejections. From the user's perspective the * model budget is managed on the aexol.ai side, so point them at support. */ export declare function formatPaymentRequiredMessage(model?: string): string; //# sourceMappingURL=rate-limit-retry.d.ts.map