/**
 * Retry helper with exponential backoff and jitter.
 *
 * Used by the HTTP client to transparently retry transient failures
 * (network errors, 5xx, 429). Honors a server-provided Retry-After when
 * present.
 */
export interface RetryOptions {
    /** Maximum number of retries after the initial attempt. 0 disables retry. */
    maxRetries: number;
    /** Base delay for exponential backoff, in ms. Default 500. */
    baseDelayMs?: number;
    /** Cap on the computed exponential delay, in ms. Default 5000. */
    maxDelayMs?: number;
}
export interface RetryContext {
    /** Attempt number, 1-indexed. The first attempt is 1. */
    attempt: number;
    /** The error from the last attempt. */
    error: unknown;
    /** Optional server-provided Retry-After (in seconds, per HTTP spec). */
    retryAfterSeconds?: number;
}
export type ShouldRetry = (ctx: RetryContext) => boolean;
/**
 * Default retry policy: retries on transient connection failures, server errors,
 * and rate-limit responses.
 */
export declare const defaultShouldRetry: ShouldRetry;
/**
 * Computes the backoff delay for a given attempt with full jitter.
 * Exposed for testing; the algorithm is otherwise an implementation detail.
 */
export declare function computeDelayMs(attempt: number, baseDelayMs: number, maxDelayMs: number, retryAfterSeconds: number | undefined, random?: () => number): number;
/**
 * Runs `fn`, retrying transient failures up to `options.maxRetries` times.
 * Throws the final error if retries are exhausted or the error isn't retryable.
 */
export declare function withRetry<T>(fn: () => Promise<T>, options: RetryOptions, shouldRetry?: ShouldRetry): Promise<T>;
//# sourceMappingURL=retry.d.ts.map