/** * EXECUTION ENGINE - Orchestrate request execution across selected adapters * Handles parallel, sequential, streaming, cascade with retry logic and timeouts */ import { ExecutionMode } from '../../types/policies'; import { VendorRequest, VendorResponse, VendorStreamChunk } from '../../types/vendors'; import { RoutingDecision } from '../routing/routing-engine'; export interface ExecutionPolicy { execution_mode?: ExecutionMode; timeout_ms?: number; stop_on_first_success?: boolean; min_confidence_threshold?: number; max_cost_budget?: number; } export interface ExecutionContext { request: VendorRequest; routing_decision: RoutingDecision; execution_policy?: ExecutionPolicy; trace_id?: string; timeout_ms?: number; } export interface ExecutionResult { responses: AdapterResponse[]; execution_mode: ExecutionMode; total_duration_ms: number; success_count: number; failure_count: number; metadata: Record; } export interface AdapterResponse { connector_id: string; provider_name: string; response?: VendorResponse; error?: Error; duration_ms: number; retry_count: number; success: boolean; } export interface StreamExecutionResult { streams: AsyncIterable[]; metadata: Record; } export interface RetryConfig { max_attempts: number; initial_delay_ms: number; max_delay_ms: number; backoff_multiplier: number; retryable_errors: string[]; } export declare class ExecutionEngine { private retry_config; constructor(retry_config?: Partial); /** * Main execution method - routes to appropriate strategy */ execute(context: ExecutionContext): Promise; /** * Execute streaming requests */ executeStream(context: ExecutionContext): Promise; /** * PARALLEL execution - all adapters at once */ private executeParallel; /** * SEQUENTIAL execution - one after another */ private executeSequential; /** * CASCADE execution - try each until success or confidence threshold met */ private executeCascade; /** * Execute single request with retry logic */ private executeWithRetry; /** * Execute with timeout */ private executeWithTimeout; /** * Create timeout promise */ private timeoutPromise; /** * Check if error is retryable */ private isRetryableError; /** * Sleep utility */ private sleep; /** * Determine execution mode from routing strategy */ private determineExecutionMode; /** * Aggregate streaming responses */ aggregateStreams(streams: AsyncIterable[], strategy?: 'first' | 'merge' | 'interleave'): AsyncGenerator; /** * Get execution statistics */ getExecutionStats(result: ExecutionResult): { success_rate: number; avg_duration_ms: number; total_retries: number; }; } //# sourceMappingURL=execution-engine.d.ts.map