/** A gateway-facing classification of an arbitrary upstream/internal error. */ export interface GatewayErrorClassification { status: number; type: string; message: string; } /** * Classify an upstream / gateway-internal error into a status code and a * format-neutral type. The order is intentional: * * 1. Honour an explicit numeric `status` property on the thrown error. * 2. Parse a status code embedded in the message string. Provider errors * virtually always carry one (`Google API error (400): …`, `HTTP 429`, * `status=503`) and the embedded value is authoritative. * 3. Fall through to **word-boundaried** substring heuristics. The old * `lower.includes("rate")` test famously matched `GenerateContentRequest`, * surfacing every Google 400 as a 429 `rate_limit_error`. The patterns here * all require boundaries so they don't collide with provider field names. */ export declare function classifyGatewayError(err: unknown): GatewayErrorClassification;