UNPKG

codecrucible-synth

Version:

Production-Ready AI Development Platform with Multi-Voice Synthesis, Smithery MCP Integration, Enterprise Security, and Zero-Timeout Reliability

100 lines 2.82 kB
/** * Resilient CLI Wrapper - Iteration 5: Enhanced Error Handling & Resilience * Wraps CLI operations with comprehensive error handling and graceful degradation */ import { EventEmitter } from 'events'; export interface ResilientOptions { enableGracefulDegradation: boolean; retryAttempts: number; timeoutMs: number; fallbackMode: 'safe' | 'basic' | 'minimal'; errorNotification: boolean; } export interface OperationResult { success: boolean; data?: any; error?: string; warnings?: string[]; degraded?: boolean; fallbackUsed?: boolean; metrics?: { attempts: number; duration: number; recoveryActions: number; }; } export declare class ResilientCLIWrapper extends EventEmitter { private logger; private errorRecovery; private operationCount; private defaultOptions; constructor(options?: Partial<ResilientOptions>); /** * Execute an operation with comprehensive error handling */ executeWithRecovery<T>(operation: () => Promise<T>, context: { name: string; component: string; critical?: boolean; timeout?: number; }, options?: Partial<ResilientOptions>): Promise<OperationResult>; /** * Execute with simple retry logic (for basic operations) */ executeWithRetry<T>(operation: () => Promise<T>, operationName: string, maxAttempts?: number): Promise<T | null>; /** * Safe execution with fallback value */ executeSafely<T>(operation: () => Promise<T>, fallback: T, operationName: string): Promise<T>; /** * Batch execution with partial failure tolerance */ executeBatch<T>(operations: (() => Promise<T>)[], context: { name: string; component: string; tolerateFailures?: boolean; maxFailures?: number; }): Promise<OperationResult>; /** * Attempt graceful degradation */ private attemptGracefulDegradation; /** * Create minimal fallback response */ private createMinimalFallback; /** * Create basic fallback response */ private createBasicFallback; /** * Create safe fallback response */ private createSafeFallback; /** * Create timeout promise with cleanup */ private createTimeoutPromise; /** * Calculate backoff delay for retries */ private calculateBackoffDelay; /** * Setup error recovery event listeners */ private setupErrorRecoveryListeners; /** * Get system health and error statistics */ getSystemHealth(): any; /** * Utility sleep function */ private sleep; /** * Cleanup resources */ shutdown(): void; } export default ResilientCLIWrapper; //# sourceMappingURL=resilient-cli-wrapper.d.ts.map