/**
 * EnhancedParallelOrchestrator — think, mcp, skills, variant 모드 병렬 오케스트레이터
 *
 * 단일모델 DAG subagents 알고리즘 고도화:
 *  - think:  각 서브에이전트가 CoT 추론 트레이스를 남김
 *  - mcp:    MCP 서버를 live 바인딩하여 노드에 주입
 *  - skills: 스킬 자동 할당 + 사용 증거 트래킹
 *  - variant: 동일 작업 여러 variant 실행 → ensemble/best-score 선택
 */
import type { Dag, DagNode } from "./dag.js";
import type { RunCapabilityAssignment } from "../contracts/orchestration.js";
import { type ExecutionPlan } from "./execution-planner.js";
import { type OrchestrationEvent, type WorkerState } from "./orchestration-state.js";
import { type LogEntry } from "./log-streamer.js";
import { type NodeCapabilityScopes } from "./capability-routing.js";
import type { TaskRunContext, WorkerManifest } from "../contracts/worker-context.js";
import { type EnhancedMode, type EnhancedModeConfig, type ThinkingSession, type ThinkingTrace, type SkillEvidence, type VariantSelection, type ModeRoutingInjection } from "./enhanced-modes.js";
export interface EnhancedOrchestratorOptions {
    dag: Dag;
    runId: string;
    goalId?: string;
    objective?: string;
    maxWorkers: number;
    cwd?: string;
    timeout?: number;
    /** Enhanced mode config (think, mcp, skills, variant) */
    modeConfig?: Partial<EnhancedModeConfig>;
    onProgress?: (state: EnhancedOrchestrationState) => void;
    onLog?: (entry: LogEntry) => void;
    onThinking?: (trace: ThinkingTrace) => void;
}
export interface EnhancedOrchestrationState {
    runId: string;
    status: "initializing" | "running" | "paused" | "completed" | "failed" | "cancelled";
    progress: {
        completed: number;
        total: number;
        percentage: number;
    };
    workers: WorkerState[];
    nodeRuntimes?: Record<string, string>;
    thinkingSessions?: Record<string, ThinkingSession>;
    skillEvidences?: SkillEvidence[];
    variantResults?: Record<string, VariantSelection>;
    startedAt: string;
    completedAt?: string;
    error?: string;
    activeModes: readonly EnhancedMode[];
}
export interface EnhancedOrchestrationResult {
    success: boolean;
    state: EnhancedOrchestrationState;
    executionPlan: ExecutionPlan;
    events: OrchestrationEvent[];
    /** All thinking traces collected across all nodes */
    thinkingTraces: ThinkingTrace[];
    /** All skill evidences */
    skillEvidences: SkillEvidence[];
    /** Variant selections per node */
    variantSelections: Record<string, VariantSelection>;
    error?: string;
}
export interface EnhancedWorkerCapabilityContext {
    readonly node: DagNode;
    readonly scopes: NodeCapabilityScopes;
    readonly assignment: RunCapabilityAssignment;
    readonly env: Record<string, string>;
    readonly workerManifest: WorkerManifest;
    readonly runContext: TaskRunContext;
    readonly modeInjection: ModeRoutingInjection;
}
export declare function buildEnhancedWorkerCapabilityContext(node: DagNode, modeConfig: EnhancedModeConfig, dag?: Dag, options?: {
    readonly runId?: string;
    readonly root?: string;
    readonly goalId?: string;
    readonly objective?: string;
}): EnhancedWorkerCapabilityContext;
export declare class EnhancedParallelOrchestrator {
    private dag;
    private runId;
    private goalId?;
    private objective?;
    private maxWorkers;
    private cwd;
    private timeout;
    private modeConfig;
    private executionPlan;
    private stateManager;
    private logStreamer;
    private activeWorkers;
    private completedNodes;
    private failedNodes;
    private nodeRuntimeMap;
    private thinkingSessions;
    private skillEvidences;
    private variantSelections;
    private allThinkingTraces;
    private nodeVariants;
    private onProgress?;
    private onLog?;
    private onThinking?;
    private abortController;
    private runtimeRouter;
    private adaptiveMaxWorkers;
    private consecutiveFailures;
    constructor(options: EnhancedOrchestratorOptions);
    execute(): Promise<EnhancedOrchestrationResult>;
    abort(): Promise<void>;
    private initialize;
    private executeLoop;
    private executeEnhancedBatch;
    private executeNodeWithVariants;
    private executeSingleVariant;
    private executeEnhancedWorker;
    private handleEnhancedWorkerResult;
    private handleEnhancedWorkerFailure;
    private calculateVariantScore;
    private waitForCompletion;
    private isComplete;
    private terminalNodes;
    private isAborted;
    private verifyCompletion;
    private emitProgress;
    private createResult;
    private cleanup;
    private sleep;
}
