/** * Resilient Executor Implementation * * Implements resilient task execution with retry logic and circuit breakers. * Wraps the Engine Layer with fault tolerance mechanisms. * * @module execution/resilience/resilient-executor */ import type { IExecutionEngine } from "../engine/engine.js"; import type { ExecutionTask } from "../engine/types.js"; import type { IResilientExecutor } from "./executor.js"; import type { RetryPolicy, CircuitBreaker, RetryMetrics, ResilientExecutionResult, RetryAttemptHandler, CircuitOpenHandler } from "./types.js"; /** * ResilientExecutor - Main implementation of resilient task execution * * Provides retry logic and circuit breaker protection for task execution. * Wraps an IExecutionEngine with fault tolerance mechanisms. * * @example * ```typescript * const engine = new SimpleExecutionEngine(processManager); * const executor = new ResilientExecutor(engine); * * const task: ExecutionTask = { * id: 'task-1', * type: 'issue', * prompt: 'Fix the bug in authentication', * workDir: '/path/to/project', * priority: 0, * dependencies: [], * createdAt: new Date(), * config: {}, * }; * * const result = await executor.executeTask(task); * console.log(`Completed after ${result.totalAttempts} attempts`); * ``` */ export declare class ResilientExecutor implements IResilientExecutor { private _engine; private _circuitManager; private _defaultPolicy; private _metrics; private _retryHandlers; private _circuitOpenHandlers; constructor(engine: IExecutionEngine, defaultPolicy?: RetryPolicy); /** * Execute a single task with retry and circuit breaker protection */ executeTask(task: ExecutionTask, policy?: RetryPolicy): Promise; /** * Execute multiple tasks with retry and circuit breaker protection */ executeTasks(tasks: ExecutionTask[], policy?: RetryPolicy): Promise; /** * Get circuit breaker by name */ getCircuitBreaker(name: string): CircuitBreaker | null; /** * Reset a circuit breaker to closed state */ resetCircuitBreaker(name: string): void; /** * Get aggregate retry metrics */ getRetryMetrics(): RetryMetrics; /** * Register handler for retry attempt events */ onRetryAttempt(handler: RetryAttemptHandler): void; /** * Register handler for circuit breaker open events */ onCircuitOpen(handler: CircuitOpenHandler): void; /** * Helper to create ResilientExecutionResult from engine result * @private */ private _createResilientResult; /** * Helper to update average attempts to success metric * @private */ private _updateAverageAttempts; } //# sourceMappingURL=resilient-executor.d.ts.map