/**
 * Nexus Prime — Run Prepare
 *
 * Assembles the final execution packet from fast + deep bootstrap results.
 * This is the bridge between bootstrap and execution.
 */
/**
 * Prepare a run from fast + deep bootstrap results.
 * Returns the instruction packet, token budget, and worker plan.
 */
export async function runPrepare(task, fast, deep, deps) {
    const filePaths = deep.candidateFiles.map((f) => f.path);
    const phases = deps.decomposeTask(task);
    const taskGraph = deps.buildTaskGraph(task, phases);
    const plan = await deps.planExecution({
        goal: task,
        files: filePaths,
    });
    const budget = deps.computeTokenBudget(filePaths);
    return {
        packetSummary: `Task: ${task.slice(0, 100)} | ${filePaths.length} files | ${plan.totalWorkers} workers | ${phases.length} phases`,
        sourceAwareBudget: budget,
        selectedArtifacts: {
            skills: plan.selectedSkills,
            specialists: plan.selectedSpecialists,
            workflows: plan.selectedWorkflows,
            hooks: plan.selectedHooks,
        },
        workerPlan: {
            totalWorkers: plan.totalWorkers,
            mode: plan.mode,
            lanes: plan.lanes,
        },
        taskGraph,
    };
}
