/**
 * Error Recovery System for Code Buddy
 *
 * Provides intelligent error handling with:
 * - Error classification and categorization
 * - Automatic recovery strategies
 * - User-friendly error messages
 * - Debugging context collection
 */
import { EventEmitter } from 'events';
export type ErrorCategory = 'network' | 'api' | 'authentication' | 'rate_limit' | 'validation' | 'file_system' | 'permission' | 'timeout' | 'internal' | 'unknown';
export type ErrorSeverity = 'low' | 'medium' | 'high' | 'critical';
export interface ClassifiedError {
    original: Error;
    category: ErrorCategory;
    severity: ErrorSeverity;
    recoverable: boolean;
    userMessage: string;
    technicalMessage: string;
    suggestedActions: string[];
    context: Record<string, unknown>;
    timestamp: Date;
}
export interface RecoveryStrategy {
    name: string;
    canRecover: (error: ClassifiedError) => boolean;
    recover: (error: ClassifiedError) => Promise<boolean>;
    maxAttempts: number;
}
/**
 * Classify an error based on patterns
 */
export declare function classifyError(error: unknown, context?: Record<string, unknown>): ClassifiedError;
/**
 * Error Recovery Manager
 */
export declare class ErrorRecoveryManager extends EventEmitter {
    private strategies;
    private errorHistory;
    private maxHistory;
    constructor();
    /**
     * Register default recovery strategies
     */
    private registerDefaultStrategies;
    /**
     * Register a recovery strategy
     */
    registerStrategy(strategy: RecoveryStrategy): void;
    /**
     * Handle an error with automatic recovery
     */
    handleError(error: unknown, context?: Record<string, unknown>): Promise<{
        classified: ClassifiedError;
        recovered: boolean;
        strategy?: string;
    }>;
    /**
     * Format error for user display
     */
    formatError(classified: ClassifiedError): string;
    /**
     * Format error for debugging
     */
    formatDebug(classified: ClassifiedError): string;
    /**
     * Get error statistics
     */
    getStats(): {
        total: number;
        byCategory: Record<ErrorCategory, number>;
        bySeverity: Record<ErrorSeverity, number>;
        recoveryRate: number;
    };
    /**
     * Get recent errors
     */
    getRecentErrors(count?: number): ClassifiedError[];
    /**
     * Clear error history
     */
    clearHistory(): void;
    private sleep;
    /**
     * Dispose and cleanup
     */
    dispose(): void;
}
/**
 * Get or create the error recovery manager
 */
export declare function getErrorRecoveryManager(): ErrorRecoveryManager;
/**
 * Reset the error recovery manager
 */
export declare function resetErrorRecoveryManager(): void;
