/**
 * Exponential Backoff with Jitter
 *
 * Generic exponential backoff for retryable operations.
 * Base delay doubles each attempt: 1s, 2s, 4s, 8s, 16s (capped at 30s).
 * Jitter adds +/-25% randomness to prevent thundering herd.
 *
 * CRITICAL: NEVER use console.log() - stdout is JSON-RPC protocol.
 *
 * @module utils/backoff
 */
export interface BackoffConfig {
    /** Base delay in milliseconds (default: 1000) */
    baseDelayMs: number;
    /** Maximum delay in milliseconds (default: 30000) */
    maxDelayMs: number;
    /** Maximum number of retry attempts (default: 3) */
    maxAttempts: number;
    /** Jitter fraction +/- (default: 0.25 = +/-25%) */
    jitterFraction: number;
}
/**
 * Calculate delay for a given attempt (0-indexed) with jitter.
 *
 * Formula: min(baseDelay * 2^attempt, maxDelay) +/- jitter
 *
 * @param attempt - Zero-indexed attempt number
 * @param config - Optional partial backoff configuration
 * @returns Delay in milliseconds (always >= 0)
 */
export declare function calculateBackoffDelay(attempt: number, config?: Partial<BackoffConfig>): number;
/**
 * Sleep for the backoff duration.
 *
 * @param attempt - Zero-indexed attempt number
 * @param config - Optional partial backoff configuration
 * @returns Promise that resolves after the delay
 */
export declare function backoffSleep(attempt: number, config?: Partial<BackoffConfig>): Promise<void>;
/**
 * Execute a function with automatic retry and exponential backoff.
 *
 * Retries on errors that pass the shouldRetry predicate, up to maxAttempts.
 * Non-retryable errors are re-thrown immediately.
 *
 * @param fn - Async function to execute
 * @param shouldRetry - Predicate to determine if an error is retryable
 * @param config - Optional partial backoff configuration
 * @returns The result of fn on success
 * @throws The last error if all attempts fail
 */
export declare function withRetry<T>(fn: () => Promise<T>, shouldRetry: (error: unknown) => boolean, config?: Partial<BackoffConfig>): Promise<T>;
//# sourceMappingURL=backoff.d.ts.map