'use server';
import { resolve } from '../../lib/server-container.js';
const AGENT_TOOL_MAP = {
    'claude-code': 'claude-code',
    cursor: 'cursor-cli',
    'gemini-cli': 'gemini-cli',
    'copilot-cli': 'copilot-cli',
    'codex-cli': 'codex-cli',
};
/**
 * Returns a map of agentType → installed (boolean) for all known agents.
 * Agents without a tool mapping (e.g. "dev") are considered installed.
 */
export async function checkAllAgentsStatus() {
    try {
        const useCase = resolve('ListToolsUseCase');
        const tools = await useCase.execute();
        const result = {};
        for (const [agentType, toolId] of Object.entries(AGENT_TOOL_MAP)) {
            const tool = tools.find((t) => t.id === toolId);
            result[agentType] = tool?.status.status === 'available';
        }
        // Dev/demo agents are always "installed"
        result['dev'] = true;
        return result;
    }
    catch {
        return {};
    }
}
