export interface MCPResponse { content: Array<{ type: "text"; text: string; }>; } export interface ErrorContext { operation: string; component: string; processingMode?: 'subscription' | 'api'; conversationId?: string; timestamp: number; userInput?: string; systemState?: any; } export interface StandardErrorResponse { success: false; error: string; errorType: string; correlationId: string; context: ErrorContext; timestamp: number; retryable: boolean; suggestions?: string[]; } export declare enum ErrorType { SYSTEM_ERROR = "SYSTEM_ERROR", MEMORY_ERROR = "MEMORY_ERROR", CONFIGURATION_ERROR = "CONFIGURATION_ERROR", ANTHROPIC_API_ERROR = "ANTHROPIC_API_ERROR", TASKMASTER_API_ERROR = "TASKMASTER_API_ERROR", MCP_TRANSPORT_ERROR = "MCP_TRANSPORT_ERROR", INVALID_INPUT_ERROR = "INVALID_INPUT_ERROR", STATE_ERROR = "STATE_ERROR", WORKFLOW_ERROR = "WORKFLOW_ERROR", EXTENDED_THINKING_ERROR = "EXTENDED_THINKING_ERROR", THINKING_BLOCK_ERROR = "THINKING_BLOCK_ERROR", MODE_COMPATIBILITY_ERROR = "MODE_COMPATIBILITY_ERROR", FEATURE_UNAVAILABLE_ERROR = "FEATURE_UNAVAILABLE_ERROR" } /** * Centralized Error Handler * Provides consistent error response formatting across all system components */ export declare class MCPErrorHandler { private static correlationMap; /** * Create a standardized MCP error response */ static formatResponse(error: Error | string, context: ErrorContext, errorType?: ErrorType, correlationId?: string): MCPResponse; /** * Handle Extended Thinking API errors specifically * Critical fix for the exception propagation issue identified in analysis */ static handleExtendedThinkingError(error: Error | string, context: ErrorContext, userInput: string, correlationId?: string): MCPResponse; /** * Handle Task Master AI integration errors */ static handleTaskMasterError(error: Error | string, context: ErrorContext, documentType?: string, correlationId?: string): MCPResponse; /** * Handle processing mode compatibility errors */ static handleModeCompatibilityError(requestedFeature: string, currentMode: 'subscription' | 'api', requiredMode: 'subscription' | 'api', context: ErrorContext, correlationId?: string): MCPResponse; /** * Log errors with full context for debugging */ private static logError; /** * Generate correlation ID for error tracking */ private static generateCorrelationId; /** * Link error correlation ID with main correlation tracker for enhanced debugging */ private static linkWithCorrelationTracker; /** * Determine if an error type is retryable */ private static isRetryableError; /** * Provide context-specific suggestions for error resolution */ private static getSuggestions; /** * Get error context by correlation ID for debugging */ static getErrorContext(correlationId: string): ErrorContext | null; /** * Clean up old error contexts to prevent memory leaks */ static cleanupErrorContexts(maxAge?: number): void; /** * Get system-wide error statistics for monitoring */ static getErrorStatistics(): { totalErrors: number; errorsByType: Record; recentErrors: number; }; } /** * Convenience functions for common error scenarios */ export declare function handleExtendedThinkingError(error: Error | string, userInput: string, correlationId?: string): MCPResponse; export declare function handleTaskMasterError(error: Error | string, documentType?: string, correlationId?: string): MCPResponse; export declare function handleModeCompatibilityError(requestedFeature: string, currentMode: 'subscription' | 'api', requiredMode: 'subscription' | 'api', correlationId?: string): MCPResponse; //# sourceMappingURL=errorHandler.d.ts.map