/** * Task Orchestrator — coordinates StageRouter + GateEngine + Ledger * into a complete pipeline execution flow. * (arc42 §5, spec §FR-01/FR-02/FR-04) */ import type { ArtifactRef, ClarificationSummary, GateVerdict, StageId } from '../types/index.js'; import { StageRouter } from '../router/stage-router.js'; import { GateEngine } from '../gate/gate-engine.js'; import { OrchestratorEmitter } from './orchestrator-events.js'; import { PipelineRun, type PipelineStatus, type TaskPayload } from './pipeline-run.js'; import type { ClarificationCoordinator } from '../clarification/index.js'; import type { ClarificationRecord } from '../clarification/clarification-record.js'; export interface OrchestratorOptions { /** Maximum retained runs. When exceeded, oldest completed/failed runs are evicted. */ maxRuns?: number; /** Optional ClarificationCoordinator for FR-11 proactive clarification. */ clarificationCoordinator?: ClarificationCoordinator; } export declare class TaskOrchestrator { private readonly router; private readonly gateEngine; private readonly runs; private readonly maxRuns; private readonly clarificationCoordinator?; readonly events: OrchestratorEmitter; constructor(router?: StageRouter, gateEngine?: GateEngine, options?: OrchestratorOptions); /** * Start a new pipeline run. */ startPipeline(payload: TaskPayload): PipelineRun; /** * Submit artifacts for the current stage of a pipeline run. */ submitArtifacts(runId: string, artifacts: ArtifactRef[]): void; /** * Evaluate the gate for the current stage and advance if passed. * Uses GateEngine (rule-based) for artifact evaluation, then * StageRouter for determining the next stage. */ evaluateAndAdvance(runId: string): { verdict: GateVerdict; nextStage: StageId | null; }; /** * Get the current status of a pipeline run. */ getPipelineStatus(runId: string): PipelineStatus; /** * Mark a pipeline as failed. */ failPipeline(runId: string, reason: string): void; /** * Remove a completed or failed run from memory. * Returns true if the run was removed, false if it's still running or not found. */ cleanupRun(runId: string): boolean; /** * Remove all completed/failed runs from memory. * Returns the number of runs removed. */ cleanupCompleted(): number; /** * Scan stage artifacts for ambiguity, open clarification records, * and dispatch them. Returns opened records (empty if no coordinator or no findings). */ scanClarifications(runId: string): ClarificationRecord[]; /** * Check whether the current stage is blocked by outstanding clarifications. */ hasBlockingClarifications(runId: string): boolean; /** * Build a ClarificationSummary for the current stage of a run. */ getClarificationSummary(runId: string): ClarificationSummary | undefined; /** * Notify the orchestrator that a clarification has been settled. * Emits event and checks if stage can resume. */ onClarificationSettled(runId: string, clarificationId: string): void; private buildStageRecord; private getRun; /** * Auto-evict oldest completed/failed runs when maxRuns is exceeded. */ private evictIfNeeded; } //# sourceMappingURL=task-orchestrator.d.ts.map