/**
 * AgentController registry — stores agent definitions (both built-in and user-defined)
 * and provides lookup/enumeration.
 *
 * Lives at the app-foundation level so both services (e.g. extension-lifecycle)
 * and orchestration (e.g. subagents, tools) can import it without violating
 * dependency boundaries.
 */
let _builtIn = [];
let _userAgents = [];
let _merged = null;
function getMerged() {
    if (!_merged) {
        const builtInNames = new Set(_builtIn.map((a) => a.name));
        const filtered = _userAgents.filter((a) => !builtInNames.has(a.name));
        _merged = [..._builtIn, ...filtered];
    }
    return _merged;
}
/** Replace the built-in agent definitions. Called during initialization and test reset. */
export function replaceBuiltInSubagents(agents) {
    _builtIn = agents;
    _merged = null;
}
/** Register user-defined agents (from extensions or resource loader). */
export function replaceUserSubagents(agents) {
    _userAgents = agents;
    _merged = null;
}
/** Reset the entire registry (primarily for tests). */
export function clearRegisteredSubagents() {
    _builtIn = [];
    _userAgents = [];
    _merged = null;
}
export function lookupRegisteredSubagent(name) {
    return getMerged().find((agent) => agent.name === name);
}
export function listRegisteredSubagentNames() {
    return getMerged().map((agent) => agent.name);
}
export function listRegisteredSubagents() {
    return getMerged();
}
//# sourceMappingURL=agent-registry.js.map