/** * Worker pool task execution strategy. * * Runs tasks using a fixed-size worker pool. Each worker picks up the next * available task as soon as it finishes the current one, maximizing slot * utilization. Works for both sequential (concurrency=1) and parallel * (concurrency>1) execution through the same code path. * * Polls for newly added tasks at a configurable interval so that tasks * added to .takt/tasks.yaml during execution are picked up without waiting * for an active task to complete. */ import type { TaskRunner, TaskInfo } from '../../../infra/task/index.js'; import type { TaskExecutionOptions } from './types.js'; export interface WorkerPoolResult { success: number; fail: number; executedTaskNames: string[]; } interface RunWorkerOptions { ignoreIterationLimit?: boolean; autoRequeueMaxAttempts?: number; } export interface WorkerPoolShutdownSignals { readonly schedulingSignal: AbortSignal; readonly taskAbortSignal: AbortSignal; readonly onTasksClaimed?: () => void; } /** * Run tasks using a worker pool with the given concurrency. * * Algorithm: * 1. Separate scheduling shutdown from task interruption * 2. Maintain a queue of pending tasks and a set of active promises * 3. Fill available slots from the queue * 4. Wait for any active task to complete OR a poll timer to fire (Promise.race) * 5. On task completion: record result * 6. On poll tick or completion: claim new tasks and fill freed slots * 7. Run drains the queue; watch stays resident until interrupted */ export declare function runWithWorkerPool(taskRunner: TaskRunner, initialTasks: TaskInfo[], concurrency: number, cwd: string, taskExecutionOptions: TaskExecutionOptions | undefined, runOptions: RunWorkerOptions | undefined, pollIntervalMs: number, mode?: 'run' | 'watch', shutdownSignals?: WorkerPoolShutdownSignals, goalTasksOnly?: boolean): Promise; export declare function requeueExistingFailedTasks(taskRunner: TaskRunner, maxAttempts: number | undefined, signal?: AbortSignal, failedTasks?: readonly Pick[]): number; export declare function attemptAutoRequeueTask(taskRunner: TaskRunner, taskName: string, maxAttempts: number): boolean; export {}; //# sourceMappingURL=parallelExecution.d.ts.map