/** * Provider retry-hint parsing — the transport seam for `Retry-After` and * the rate-limit header family (#186). * * A supplier that answers with a delay hint is telling the caller when to * come back; the shared executor already honours the parsed value as a * floor over its own backoff (`lib/execution.ts`). This module is the * producer end: Adapters hand the Response headers in where the status * map throws, and get back a millisecond number — or nothing. * * Sources, in precedence order (first PARSEABLE wins): * 1. `Retry-After` — RFC 9110 §10.2.1: `delay-seconds` (`1*DIGIT`, an * integer — never fractional) or an HTTP-date. * 2. `X-RateLimit-Retry-After` — integer delta-seconds. * 3. `X-RateLimit-Reset` — SECONDS UNTIL RESET, relative (OpenAlex's * documented semantic), not an epoch timestamp. * * Header VALUES never leave this module: callers receive a number only, * so provider-controlled text cannot reach an error message, a log, or * the public envelope. Anything unparseable — garbage, empty, negative, * non-integer, absent — contributes nothing and falls through to the * next source; nothing parseable yields `undefined`, which the Adapters * turn into an OMITTED error field (byte-identical error path). */ /** Minimal header surface — a fetch `Headers` satisfies it directly. */ export interface RetryHintHeaders { get?(name: string): string | null; } /** * Read the first parseable retry hint off a Response's headers. * * `now` is injectable so the HTTP-date form is deterministic under test; * production callers take the default `Date.now`. */ export declare function parseRetryAfterHintMs(headers: RetryHintHeaders | null | undefined, now?: () => number): number | undefined; /** * #186 ocr review finding: brave and jina adapters carried identical * read-and-wrap helpers — hoisted here so the forwarding rule changes in * exactly one place. */ export declare function retryHintOptionsFromError(error: unknown): { retryAfterMs?: number; }; /** * Error-constructor options carrying the hint, or NOTHING when there was * no parseable hint — the options object omits the key entirely, so nothing * is attached and the error message and stdout envelope stay byte-identical. * (The instance itself still materializes an own `retryAfterMs: undefined` * — the constructor's standing idiom, same as `statusCode`/`help`.) */ export declare function retryHintOptions(retryAfterMs: number | undefined): { retryAfterMs?: number; }; //# sourceMappingURL=retry-after.d.ts.map