import { nowIso } from '../fsx.js';
import { allocateWorkerWorktreesBatch as allocateBatch } from './git-worktree-manager.js';
export function planGitWorktreePool(input) {
    const reusable = [...(input.reusableWorktrees || [])];
    const assignments = input.workerIds.map((workerId) => {
        const worktree = reusable.shift() || null;
        return {
            worker_id: workerId,
            action: worktree ? 'reuse' : 'allocate',
            worktree_path: worktree
        };
    });
    return {
        schema: 'sks.git-worktree-pool.v1',
        ok: true,
        generated_at: nowIso(),
        requested_workers: input.workerIds.length,
        reusable_count: (input.reusableWorktrees || []).length,
        allocate_count: assignments.filter((row) => row.action === 'allocate').length,
        assignments,
        blockers: []
    };
}
export async function allocateWorkerWorktreesBatch(input) {
    return allocateBatch(input);
}
//# sourceMappingURL=git-worktree-pool.js.map