/**
 * Session Retry Utilities
 *
 * Provides sophisticated retry logic for API errors including:
 * - retry-after header parsing
 * - Exponential backoff
 * - Retryable error detection
 *
 * Inspired by OpenCode's SessionRetry system.
 */
/** Initial delay for retries (ms) */
export declare const RETRY_INITIAL_DELAY = 2000;
/** Backoff multiplier */
export declare const RETRY_BACKOFF_FACTOR = 2;
/** Max delay when no headers (30 seconds) */
export declare const RETRY_MAX_DELAY_NO_HEADERS = 30000;
/** Absolute max delay for setTimeout (max 32-bit signed int) */
export declare const RETRY_MAX_DELAY = 2147483647;
/** Max retry attempts */
export declare const MAX_RETRY_ATTEMPTS = 5;
export interface APIErrorData {
    isRetryable?: boolean;
    message?: string;
    responseHeaders?: Record<string, string>;
    status?: number;
}
export interface RetryConfig {
    maxAttempts?: number;
    initialDelay?: number;
    maxDelay?: number;
    backoffFactor?: number;
}
/**
 * Sleep with abort signal support
 */
export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
/**
 * Calculate retry delay from attempt number and optional error data
 *
 * Priority:
 * 1. retry-after-ms header
 * 2. retry-after header (seconds or HTTP date)
 * 3. Exponential backoff
 */
export declare function calculateDelay(attempt: number, errorData?: APIErrorData): number;
/**
 * Check if an error is retryable
 *
 * Returns a human-readable reason if retryable, undefined otherwise.
 */
export declare function isRetryable(error: unknown): string | undefined;
/**
 * Retry an async operation with exponential backoff
 */
export declare function withRetry<T>(operation: () => Promise<T>, config?: RetryConfig, signal?: AbortSignal): Promise<T>;
/**
 * Format delay for human readability
 */
export declare function formatDelay(ms: number): string;
