/**
 * Nexus Prime — Worker Topology Planner
 *
 * Decides worker count, roles, and file assignment.
 * Uses intent, complexity, and candidate file count as inputs.
 */
export class WorkerTopologyPlanner {
    /** Plan worker topology for a given task. */
    plan(params) {
        // TODO: extract from SubAgentRuntime — topology decision logic
        const { candidateFileCount, complexity, maxWorkers = 8 } = params;
        // Simple heuristic — will be replaced with extracted logic
        let totalWorkers = 1;
        if (candidateFileCount > 5 && complexity > 3)
            totalWorkers = 2;
        if (candidateFileCount > 15 && complexity > 6)
            totalWorkers = 3;
        totalWorkers = Math.min(totalWorkers, maxWorkers);
        const mode = totalWorkers > 1 ? 'parallel' : 'sequential';
        return {
            totalWorkers,
            mode,
            lanes: Array.from({ length: totalWorkers }, (_, i) => ({
                role: i === 0 ? 'coder' : i === totalWorkers - 1 ? 'verifier' : 'coder',
                files: [], // assigned later by coordinator
            })),
            rationale: `${totalWorkers} workers for ${candidateFileCount} files at complexity ${complexity}`,
        };
    }
}
