/**
 * Generic retry utility with exponential backoff
 *
 * Provides configurable retry logic for any async operation with:
 * - Exponential backoff
 * - Jitter to prevent thundering herd
 * - Customizable retry conditions
 * - Timeout support
 * - Event callbacks
 */
export interface RetryOptions {
    /** Maximum number of retry attempts (default: 3) */
    maxRetries?: number;
    /** Base delay in ms between retries (default: 1000) */
    baseDelay?: number;
    /** Maximum delay in ms (default: 30000) */
    maxDelay?: number;
    /** Backoff multiplier (default: 2) */
    backoffFactor?: number;
    /** Add random jitter 0-25% (default: true) */
    jitter?: boolean;
    /** Timeout for entire operation in ms (default: none) */
    timeout?: number;
    /** Function to determine if error is retryable */
    isRetryable?: (error: unknown) => boolean;
    /** Callback before each retry */
    onRetry?: (error: unknown, attempt: number, delay: number) => void;
    /** Callback on final failure */
    onFailed?: (error: unknown, attempts: number) => void;
    /** Callback on success */
    onSuccess?: (result: unknown, attempts: number) => void;
    /** Abort signal to cancel retries */
    signal?: AbortSignal;
}
export interface RetryResult<T> {
    success: boolean;
    result?: T;
    error?: Error;
    attempts: number;
    totalTime: number;
}
/**
 * Execute a function with retry logic
 *
 * @param fn - The async function to retry
 * @param options - Retry configuration options
 * @returns Promise with the function result
 *
 * @example
 * ```typescript
 * const result = await retry(
 *   async () => fetch('https://api.example.com/data'),
 *   {
 *     maxRetries: 5,
 *     baseDelay: 500,
 *     isRetryable: (err) => err.message.includes('timeout'),
 *     onRetry: (err, attempt, delay) => {
 *       console.log(`Retry ${attempt} after ${delay}ms`);
 *     }
 *   }
 * );
 * ```
 */
export declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
/**
 * Execute with retry and return a result object instead of throwing
 */
export declare function retryWithResult<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<RetryResult<T>>;
/**
 * Create a retryable version of a function
 */
export declare function withRetry<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, options?: RetryOptions): (...args: TArgs) => Promise<TResult>;
/**
 * Retry decorator for class methods
 */
export declare function Retry(options?: RetryOptions): <T extends (...args: unknown[]) => Promise<unknown>>(_target: unknown, _propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
/**
 * Common retry predicates for specific error types
 */
export declare const RetryPredicates: {
    /** Retry on network errors */
    networkError: (error: unknown) => boolean;
    /** Retry on HTTP 5xx errors */
    serverError: (error: unknown) => boolean;
    /** Retry on rate limit errors (429) */
    rateLimitError: (error: unknown) => boolean;
    /** Retry on OpenAI/LLM API specific errors */
    llmApiError: (error: unknown) => boolean;
    /** Retry on cloud storage errors */
    cloudStorageError: (error: unknown) => boolean;
    /** Retry on any transient error */
    transientError: (error: unknown) => boolean;
    /** Never retry (for explicit no-retry scenarios) */
    never: () => boolean;
    /** Always retry (default behavior) */
    always: () => boolean;
};
/**
 * Pre-configured retry strategies
 */
export declare const RetryStrategies: {
    /** Fast retries for local operations */
    fast: RetryOptions;
    /** Standard retries for API calls */
    standard: RetryOptions;
    /** Aggressive retries for critical operations */
    aggressive: RetryOptions;
    /** Patient retries for rate-limited APIs */
    patient: RetryOptions;
    /** LLM API retries (Grok, OpenAI, Anthropic, etc.) */
    llmApi: RetryOptions;
    /** Cloud storage retries (S3, GCS, Azure) */
    cloudStorage: RetryOptions;
    /** Web search/fetch retries */
    webRequest: RetryOptions;
    /** No retries */
    none: RetryOptions;
};
