/** * Execution Modes - Parallel and sequential exploration strategies * * Coordinates execution of multiple explorations with different strategies */ import type { Exploration, ExplorationResults, WorktreeExploration } from '../types/exploration.types.js'; import type { ContainerConfig, ContainerManager } from './container-manager.js'; import type { ExplorationStateManager } from './exploration-state.js'; import type { ResourceAllocator } from './resource-allocator.js'; import type { SharedVolumeManager } from './shared-volume-manager.js'; import type { WorktreeManager } from './worktree-manager.js'; /** * Get error message from unknown error */ export interface ExecutionContext { containerManager: ContainerManager; exploration: Exploration; resourceAllocator: ResourceAllocator; sharedVolumeManager: SharedVolumeManager; stateManager: ExplorationStateManager; worktreeManager: WorktreeManager; } export interface ExecutionResult { completed_branches: number; duration_ms: number; exploration_id: string; mode: 'parallel' | 'sequential'; results: ExplorationResults; success: boolean; total_branches: number; winner_index?: number; } /** * Base execution strategy */ export declare abstract class ExecutionStrategy { protected context: ExecutionContext; constructor(context: ExecutionContext); /** * Execute the exploration strategy */ abstract execute(): Promise; /** * Create container configuration for a worktree */ protected createContainerConfig(worktree: WorktreeExploration, index: number): ContainerConfig; /** * Get additional environment variables (can be overridden) */ protected getAdditionalEnvironment(_worktree: WorktreeExploration): Record; /** * Get container command (can be overridden) */ protected getContainerCommand(_worktree: WorktreeExploration): string[] | undefined; /** * Monitor containers and update progress */ protected monitorContainers(containerIds: string[], worktreeIndices: number[], timeoutMs: number): Promise; /** * Single monitoring iteration */ private monitorIteration; /** * Build container names from IDs and indices */ private buildContainerNames; /** * Update worktree statistics */ private updateWorktreeStats; /** * Update worktree status based on container stats */ private updateWorktreeStatus; /** * Check if all containers have exited */ private allContainersExited; /** * Handle monitoring errors */ private handleMonitoringError; /** * Collect results from all worktrees */ protected collectResults(): Promise; /** * Count decisions with chosen options */ private countResolvedDecisions; /** * Generate comparison report */ protected generateComparisonReport(): string; /** * Sleep helper */ protected sleep(ms: number): Promise; } /** * Parallel execution strategy - run all explorations simultaneously */ export declare class ParallelExecutionStrategy extends ExecutionStrategy { execute(): Promise; } /** * Sequential execution strategy - try one approach at a time until one succeeds */ export declare class SequentialExecutionStrategy extends ExecutionStrategy { execute(): Promise; private tryWorktree; private tryWorktreesSequentially; } /** * Create execution strategy based on mode */ export declare function createExecutionStrategy(mode: 'parallel' | 'sequential', context: ExecutionContext): ExecutionStrategy; //# sourceMappingURL=execution-modes.d.ts.map