/**
 * MCP Circuit Breaker
 * Implements circuit breaker pattern for external MCP operations
 * Provides fault tolerance and prevents cascading failures
 */
import { EventEmitter } from "events";
import type { CircuitBreakerConfig, CircuitBreakerStats } from "../types/index.js";
export { CircuitBreakerOpenError } from "../types/index.js";
/**
 * MCPCircuitBreaker
 * Implements circuit breaker pattern for fault tolerance
 */
export declare class MCPCircuitBreaker extends EventEmitter {
    private name;
    private state;
    private config;
    private callHistory;
    private lastFailureTime;
    private halfOpenCalls;
    private lastStateChange;
    private cleanupTimer?;
    constructor(name: string, config?: Partial<CircuitBreakerConfig>);
    /**
     * Execute an operation with circuit breaker protection
     */
    execute<T>(operation: () => Promise<T>): Promise<T>;
    /**
     * Record a call in the history
     */
    private recordCall;
    /**
     * Check if failure threshold is exceeded
     */
    private checkFailureThreshold;
    /**
     * Change circuit breaker state
     */
    private changeState;
    /**
     * Create a timeout promise
     */
    private timeoutPromise;
    /**
     * Clean up old call records
     */
    private cleanupCallHistory;
    /**
     * Get current statistics
     */
    getStats(): CircuitBreakerStats;
    /**
     * Manually reset the circuit breaker
     */
    reset(): void;
    /**
     * Force open the circuit breaker
     */
    forceOpen(reason?: string): void;
    /**
     * Get circuit breaker name
     */
    getName(): string;
    /**
     * Check if circuit is open
     */
    isOpen(): boolean;
    /**
     * Check if circuit is closed
     */
    isClosed(): boolean;
    /**
     * Check if circuit is half-open
     */
    isHalfOpen(): boolean;
    /**
     * Destroy the circuit breaker and clean up resources
     * This method should be called when the circuit breaker is no longer needed
     * to prevent memory leaks from the cleanup timer
     */
    destroy(): void;
}
/**
 * Circuit breaker manager for multiple circuit breakers
 */
export declare class CircuitBreakerManager {
    private breakers;
    /**
     * Get or create a circuit breaker
     */
    getBreaker(name: string, config?: Partial<CircuitBreakerConfig>): MCPCircuitBreaker;
    /**
     * Remove a circuit breaker and clean up its resources
     */
    removeBreaker(name: string): boolean;
    /**
     * Get all circuit breaker names
     */
    getBreakerNames(): string[];
    /**
     * Get statistics for all circuit breakers
     */
    getAllStats(): Record<string, CircuitBreakerStats>;
    /**
     * Reset all circuit breakers
     */
    resetAll(): void;
    /**
     * Get health summary
     */
    getHealthSummary(): {
        totalBreakers: number;
        closedBreakers: number;
        openBreakers: number;
        halfOpenBreakers: number;
        unhealthyBreakers: string[];
    };
    /**
     * Destroy all circuit breakers and clean up their resources
     * This should be called during application shutdown to prevent memory leaks
     */
    destroyAll(): void;
}
export declare const globalCircuitBreakerManager: CircuitBreakerManager;
