/**
 * Error Handler Utility for Any Browser MCP
 * Provides centralized error handling, logging, and reporting
 */
import { MCPError } from '../types/errors.js';
export interface ErrorHandlerOptions {
    verbose?: boolean;
    logToConsole?: boolean;
    includeStack?: boolean;
    maxErrorHistory?: number;
}
export interface ErrorReport {
    error: MCPError;
    timestamp: Date;
    handled: boolean;
    context?: any;
}
export declare class ErrorHandler {
    private options;
    private errorHistory;
    private static instance;
    constructor(options?: ErrorHandlerOptions);
    static getInstance(options?: ErrorHandlerOptions): ErrorHandler;
    /**
     * Handle an error with appropriate logging and reporting
     */
    handleError(error: Error | MCPError, context?: any): ErrorReport;
    /**
     * Convert any error to MCPError if needed
     */
    private ensureMCPError;
    /**
     * Log error to console with formatting
     */
    private logError;
    /**
     * Add error to history with size management
     */
    private addToHistory;
    /**
     * Get recent error history
     */
    getErrorHistory(limit?: number): ErrorReport[];
    /**
     * Get error statistics
     */
    getErrorStats(): {
        total: number;
        byCode: Record<string, number>;
        byComponent: Record<string, number>;
        recent: number;
    };
    /**
     * Clear error history
     */
    clearHistory(): void;
    /**
     * Check if system is experiencing high error rates
     */
    isHighErrorRate(): boolean;
    /**
     * Get health status based on error patterns
     */
    getHealthStatus(): {
        status: 'healthy' | 'warning' | 'critical';
        message: string;
        recommendations: string[];
    };
    /**
     * Export error data for debugging
     */
    exportErrorData(): {
        timestamp: string;
        stats: any;
        recentErrors: any[];
        healthStatus: any;
    };
    /**
     * Set error handler options
     */
    setOptions(options: Partial<ErrorHandlerOptions>): void;
}
/**
 * Global error handler instance
 */
export declare const globalErrorHandler: ErrorHandler;
/**
 * Convenience function for handling errors
 */
export declare function handleError(error: Error | MCPError, context?: any): ErrorReport;
/**
 * Convenience function for getting error stats
 */
export declare function getErrorStats(): {
    total: number;
    byCode: Record<string, number>;
    byComponent: Record<string, number>;
    recent: number;
};
/**
 * Convenience function for getting health status
 */
export declare function getHealthStatus(): {
    status: "warning" | "critical" | "healthy";
    message: string;
    recommendations: string[];
};
//# sourceMappingURL=ErrorHandler.d.ts.map