UNPKG

@ai-capabilities-suite/mcp-debugger-core

Version:

Core debugging engine for Node.js and TypeScript applications. Provides Inspector Protocol integration, breakpoint management, variable inspection, execution control, profiling, hang detection, and source map support.

67 lines (66 loc) 1.84 kB
/** * Retry Handler with Exponential Backoff * Implements retry logic for transient failures */ export interface RetryConfig { /** * Maximum number of retry attempts */ maxAttempts: number; /** * Initial delay in milliseconds */ initialDelay: number; /** * Maximum delay in milliseconds */ maxDelay: number; /** * Backoff multiplier (default: 2 for exponential) */ backoffMultiplier: number; /** * Add random jitter to prevent thundering herd (0-1) */ jitter: number; /** * Function to determine if error is retryable */ isRetryable?: (error: Error) => boolean; } export interface RetryStats { attempts: number; totalDelay: number; lastError?: Error; success: boolean; } export declare class RetryHandler { private static readonly DEFAULT_CONFIG; /** * Execute an operation with retry logic * @param operation The async operation to execute * @param config Retry configuration * @returns The result of the operation * @throws The last error if all retries fail */ static execute<T>(operation: () => Promise<T>, config?: Partial<RetryConfig>): Promise<T>; /** * Calculate delay with exponential backoff and jitter */ private static calculateDelay; /** * Sleep for specified milliseconds */ private static sleep; /** * Execute with retry and return stats */ static executeWithStats<T>(operation: () => Promise<T>, config?: Partial<RetryConfig>): Promise<{ result: T; stats: RetryStats; }>; } /** * Decorator for adding retry logic to methods */ export declare function Retryable(config?: Partial<RetryConfig>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;