/**
 * Resilience utilities for retry logic and timeout handling
 */
interface RetryConfig {
    maxRetries?: number;
    initialDelay?: number;
    maxDelay?: number;
    backoffMultiplier?: number;
    retryableErrors?: string[];
    onRetry?: (attempt: number, error: Error) => void;
}
/**
 * Retry a fetch request with exponential backoff
 *
 * @param url - Request URL
 * @param options - Fetch options
 * @param retryConfig - Retry configuration
 * @returns Response from fetch
 *
 * @example
 * ```typescript
 * const response = await fetchWithRetry(
 *   'https://api.example.com/data',
 *   { method: 'POST', body: JSON.stringify(data) },
 *   { maxRetries: 5, initialDelay: 500 }
 * );
 * ```
 */
declare function fetchWithRetry(url: string, options: RequestInit, retryConfig?: RetryConfig): Promise<Response>;
/**
 * Add timeout to any promise
 *
 * @param promise - Promise to wrap with timeout
 * @param timeoutMs - Timeout in milliseconds
 * @param errorMessage - Optional custom error message
 * @returns Promise that rejects if timeout is reached
 *
 * @example
 * ```typescript
 * const result = await withTimeout(
 *   fetchData(),
 *   5000,
 *   'Data fetch timed out'
 * );
 * ```
 */
declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;
/**
 * Unified error type for all tools
 */
declare class MorphError extends Error {
    code: string;
    statusCode?: number | undefined;
    retryable: boolean;
    constructor(message: string, code: string, statusCode?: number | undefined, retryable?: boolean);
}

export { MorphError, type RetryConfig, fetchWithRetry, withTimeout };
