import type { BlockReason } from "./accounts.js"; export interface FailureClassification { /** How to block the account, or `undefined` to leave it selectable. */ block?: BlockReason; /** Whether another account should be tried for this same request. */ failover: boolean; /** Upstream-supplied retry delay in milliseconds, when present. */ retryAfterMs?: number; /** * The upstream was busy, not this account. Retrying the same account shortly * is correct; blocking it would take a healthy subscription out of the pool * over a condition it did not cause. */ transient?: boolean; } /** Delay before retrying a congested upstream, when it names no delay itself. */ export declare const TRANSIENT_RETRY_MS = 400; /** * Extract a retry delay from an error. * * Accepts an explicit numeric field, a `retry-after-ms` value, or a plain * `retry-after` in seconds (the form Kiro and Anthropic actually send). */ export declare function retryAfterMs(error: unknown): number | undefined; /** HTTP status carried by an error, when it exposes one. */ export declare function statusOf(error: unknown): number | undefined; /** * Decide what a request failure means for the account that produced it. * * - 429 / rate-limit / quota -> block this account, try the next one. * - 401 / 403 auth failures -> block until re-login, try the next one. * - 5xx / overloaded -> brief block, try the next one. * - anything else -> surface to the caller untouched; retrying on a * different account would just repeat a client-side error on someone else's * quota. */ export declare function classifyFailure(error: unknown): FailureClassification;