import { BRAINSTORM_SKILLS, CORE_SKILLS, DOCS_SKILLS, IDEA_SKILLS, PROJECT_MANAGEMENT_SKILLS, RESEARCH_AGENTS, RESEARCH_SKILLS, UTILITY_SKILLS, WORKFLOW_AGENTS, WORKFLOW_SKILLS, } from '../../init/tools/shared/skill-manifest.js';
const INSTALL_SYNC_CANONICAL_PATHS = Symbol('oat.installSyncCanonicalPaths');
function uniqueCanonicalPaths(paths) {
    return [...new Set(paths)];
}
export function canonicalSkillPaths(skillNames) {
    return uniqueCanonicalPaths(skillNames.map((skillName) => `.agents/skills/${skillName}`));
}
export function canonicalAgentPaths(agentNames) {
    return uniqueCanonicalPaths(agentNames.map((agentName) => `.agents/agents/${agentName}`));
}
export function canonicalPathsForPack(pack) {
    switch (pack) {
        case 'core':
            return canonicalSkillPaths(CORE_SKILLS);
        case 'ideas':
            return canonicalSkillPaths(IDEA_SKILLS);
        case 'docs':
            return canonicalSkillPaths(DOCS_SKILLS);
        case 'workflows':
            return uniqueCanonicalPaths([
                ...canonicalSkillPaths(WORKFLOW_SKILLS),
                ...canonicalAgentPaths(WORKFLOW_AGENTS),
            ]);
        case 'utility':
            return canonicalSkillPaths(UTILITY_SKILLS);
        case 'project-management':
            return canonicalSkillPaths(PROJECT_MANAGEMENT_SKILLS);
        case 'research':
            return uniqueCanonicalPaths([
                ...canonicalSkillPaths(RESEARCH_SKILLS),
                ...canonicalAgentPaths(RESEARCH_AGENTS),
            ]);
        case 'brainstorm':
            return canonicalSkillPaths(BRAINSTORM_SKILLS);
    }
}
export function canonicalPathsForPacks(packs) {
    return uniqueCanonicalPaths(packs.flatMap((pack) => canonicalPathsForPack(pack)));
}
export function setInstalledCanonicalPaths(command, canonicalPaths) {
    Reflect.set(command, INSTALL_SYNC_CANONICAL_PATHS, uniqueCanonicalPaths(canonicalPaths));
}
export function getInstalledCanonicalPaths(command) {
    const value = Reflect.get(command, INSTALL_SYNC_CANONICAL_PATHS);
    return Array.isArray(value) ? uniqueCanonicalPaths(value) : [];
}
