/**
 * RAG Circuit Breaker
 *
 * Implements circuit breaker pattern for RAG operations including
 * vector store queries, embeddings, and reranking calls.
 * Provides fault tolerance and prevents cascading failures.
 */
import { TypedEventEmitter } from "../../core/infrastructure/index.js";
import type { CircuitState, RAGCircuitBreakerConfig, RAGCircuitBreakerEvents, RAGCircuitBreakerStats } from "../../types/index.js";
/**
 * RAG Circuit Breaker
 *
 * Provides circuit breaker pattern implementation for RAG operations
 * with comprehensive statistics and event handling.
 */
export declare class RAGCircuitBreaker extends TypedEventEmitter<RAGCircuitBreakerEvents> {
    private name;
    private state;
    private config;
    private callHistory;
    private lastFailureTime;
    private halfOpenCalls;
    private lastStateChange;
    private cleanupTimer?;
    constructor(name: string, config?: Partial<RAGCircuitBreakerConfig>);
    /**
     * Execute an operation with circuit breaker protection
     */
    execute<T>(operation: () => Promise<T>, operationType?: string): 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;
    /**
     * Calculate percentile latency
     */
    private calculatePercentileLatency;
    /**
     * Get current statistics
     */
    getStats(): RAGCircuitBreakerStats;
    /**
     * 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;
    /**
     * Get current state
     */
    getState(): CircuitState;
    /**
     * Destroy the circuit breaker and clean up resources
     */
    destroy(): void;
}
/**
 * Circuit breaker manager for RAG operations
 */
export declare class RAGCircuitBreakerManager {
    private breakers;
    /**
     * Get or create a circuit breaker
     */
    getBreaker(name: string, config?: Partial<RAGCircuitBreakerConfig>): RAGCircuitBreaker;
    /**
     * Remove a circuit breaker
     */
    removeBreaker(name: string): boolean;
    /**
     * Get all circuit breaker names
     */
    getBreakerNames(): string[];
    /**
     * Get statistics for all circuit breakers
     */
    getAllStats(): Record<string, RAGCircuitBreakerStats>;
    /**
     * Reset all circuit breakers
     */
    resetAll(): void;
    /**
     * Get health summary
     */
    getHealthSummary(): {
        totalBreakers: number;
        closedBreakers: number;
        openBreakers: number;
        halfOpenBreakers: number;
        unhealthyBreakers: string[];
    };
    /**
     * Destroy all circuit breakers
     */
    destroyAll(): void;
}
/**
 * Global circuit breaker manager for RAG operations
 */
export declare const ragCircuitBreakerManager: RAGCircuitBreakerManager;
/**
 * Convenience function to get a circuit breaker
 */
export declare function getCircuitBreaker(name: string, config?: Partial<RAGCircuitBreakerConfig>): RAGCircuitBreaker;
/**
 * Convenience function to execute with circuit breaker
 */
export declare function executeWithCircuitBreaker<T>(breakerName: string, operation: () => Promise<T>, operationType?: string, config?: Partial<RAGCircuitBreakerConfig>): Promise<T>;
