/**
 * Retry Infrastructure
 *
 * Provides configurable retry mechanisms with exponential backoff,
 * jitter, and custom retry conditions.
 */
export interface RetryConfig {
    /** Maximum number of retry attempts */
    attempts?: number;
    /** Minimum delay between retries in milliseconds */
    minDelayMs?: number;
    /** Maximum delay between retries in milliseconds */
    maxDelayMs?: number;
    /** Jitter factor (0-1) to randomize delays */
    jitter?: number;
}
export interface RetryInfo {
    attempt: number;
    maxAttempts: number;
    delayMs: number;
    error: unknown;
    label?: string;
}
export interface RetryOptions extends RetryConfig {
    /** Label for logging */
    label?: string;
    /** Custom function to determine if error is retryable */
    shouldRetry?: (error: unknown, attempt: number) => boolean;
    /** Extract retry-after delay from error (e.g., rate limit) */
    retryAfterMs?: (error: unknown) => number | undefined;
    /** Callback on each retry attempt */
    onRetry?: (info: RetryInfo) => void;
}
/**
 * Sleep utility
 */
export declare function sleep(ms: number): Promise<void>;
/**
 * Resolve retry configuration with defaults
 */
export declare function resolveRetryConfig(defaults?: Required<RetryConfig>, overrides?: RetryConfig): Required<RetryConfig>;
/**
 * Execute a function with retry logic
 */
export declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
/**
 * Telegram-specific recoverable error codes
 */
export declare const RECOVERABLE_ERROR_CODES: Set<string>;
/**
 * Telegram-specific recoverable error names
 */
export declare const RECOVERABLE_ERROR_NAMES: Set<string>;
/**
 * Check if an error is a recoverable network error
 */
export declare function isRecoverableNetworkError(error: unknown, context?: 'polling' | 'send' | 'webhook' | 'unknown'): boolean;
/**
 * Create a retry runner with Telegram-specific defaults
 */
export declare function createRetryRunner(options?: RetryOptions): <T>(fn: () => Promise<T>, label?: string) => Promise<T>;
