import { capableAgents } from '../../capabilities.js';
import { listInstalledSubagentNames } from '../../subagents-registry.js';
import { lazyAgentMap } from '../writers/lazy-map.js';
function buildSubagentsDetector(agent) {
    return {
        kind: 'subagents',
        agent,
        list({ versionHome }) {
            return listInstalledSubagentNames(agent, versionHome);
        },
    };
}
export const subagentsDetectors = lazyAgentMap(() => {
    const m = {};
    for (const agent of capableAgents('subagents'))
        m[agent] = buildSubagentsDetector(agent);
    return m;
});
