import { checkParallelSafety } from '../engine/parallel-safety-engine.js';
/**
 * Handle check_parallel_safety tool call.
 * Returns worktree collision risk assessment and safe agent names.
 */
export function handleCheckParallelSafety(input) {
    const { projectPath, numAgents = 6 } = input;
    const result = checkParallelSafety(process.cwd(), projectPath, numAgents);
    const riskEmoji = {
        safe: 'GREEN',
        warning: 'YELLOW',
        danger: 'RED',
    };
    const lines = [
        `Parallel Safety Check`,
        `=====================`,
        `Risk Level: ${riskEmoji[result.riskLevel] ?? result.riskLevel} (${result.riskLevel.toUpperCase()})`,
        `Inside Worktree: ${result.isInsideWorktree ? `yes (agent-${result.currentWorktreeId})` : 'no'}`,
        `Active Worktrees: ${result.activeWorktreeIds.length > 0 ? result.activeWorktreeIds.map((id) => `agent-${id}`).join(', ') : 'none'}`,
        ``,
        `Safe Agent Names (${result.safeAgentNames.length} prepared):`,
        ...result.safeAgentNames.map((n) => `  - ${n}`),
        ``,
        `Recommendations:`,
        ...result.recommendations.map((r) => `  * ${r}`),
    ];
    return { content: [{ type: 'text', text: lines.join('\n') }] };
}
//# sourceMappingURL=parallel-safety-handler.js.map