export interface ToolErrorConfig { maxRetries?: number; retryDelayMs?: number; fallbackValue?: T; onError?: (error: Error, attempt: number) => Promise; shouldRetry?: (error: Error) => boolean; } export interface ToolResult { success: boolean; data?: T; error?: Error; attempts: number; totalTimeMs: number; } export declare function withErrorHandling>(fn: (...args: Args) => T, config?: ToolErrorConfig): (...args: Args) => Promise>; export declare function executeWithRetry(fn: () => Promise, config?: { maxRetries?: number; delayMs?: number; backoffMultiplier?: number; maxDelayMs?: number; onRetry?: (error: Error, attempt: number) => void; }): Promise; export type CircuitState = 'CLOSED' | 'OPEN' | 'HALF_OPEN'; export declare function createCircuitBreaker(fn: (...args: Args) => Promise, config?: { failureThreshold?: number; resetTimeoutMs?: number; }): (...args: Args) => Promise; export declare function isPermanentError(error: Error): boolean; export declare class CircuitOpenError extends Error { constructor(message: string); } export declare function isCircuitOpenError(error: unknown): error is CircuitOpenError; export declare class ToolTimeoutError extends Error { constructor(message?: string); } export declare function withTimeout(fn: () => Promise, timeoutMs: number, error?: Error): Promise;