export declare class RateLimitError extends Error { readonly retryAfter: number; readonly limit: number | null; readonly remaining: number | null; readonly resetAt: Date | null; readonly scope: string | null; readonly policy: string | null; constructor(init?: { retryAfter?: number; limit?: number | null; remaining?: number | null; resetAt?: Date | null; scope?: string | null; policy?: string | null; message?: string; }); } export declare const DEFAULT_MAX_RETRIES = 3; export declare const MAX_RETRY_BACKOFF_SECONDS = 60; type FetchFn = typeof globalThis.fetch; /** * @internal RequestInit extension honored by {@link wrapFetchWithRetry}. * `replaySafe` marks a POST/PATCH whose idempotency is guaranteed by * something other than an Idempotency-Key header — today the adopt-mode * create-or-adopt calls, where the server dedupes on `external_ref`. Set * only by the curated client; never a public knob. */ export interface ReplaySafeRequestInit extends RequestInit { replaySafe?: boolean; } export interface WrapRetryOptions { /** Number of retries for transient responses. 0 disables retries. */ maxRetries?: number; /** Override for tests — called in place of `setTimeout`-based sleeping. */ sleep?: (seconds: number) => Promise; /** Override for tests — called in place of `Date.now()` (milliseconds). */ now?: () => number; /** Structured retry observation hook; never receives headers or bodies. */ onRetry?: (event: RetryEvent) => void; } export interface RetryEvent { method: string; attempt: number; reason: "transport_error" | "rate_limited" | "server_error" | "service_unavailable"; status?: number; waitSeconds: number; } /** * Wrap a `fetch` function so that 429/500/502/503/504 responses are retried per * the shared policy. The returned function is a drop-in replacement for * the global `fetch`. */ export declare function wrapFetchWithRetry(fetchFn: FetchFn, options?: WrapRetryOptions): FetchFn; export {}; //# sourceMappingURL=retry.d.ts.map