"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SkillNetworkRegistry = void 0;
class SkillNetworkRegistry {
    networks = [];
    constructor(seed) {
        if (seed?.length)
            this.networks = seed;
    }
    list() { return [...this.networks]; }
    upsert(network) {
        const idx = this.networks.findIndex(n => n.id === network.id);
        if (idx >= 0)
            this.networks[idx] = network;
        else
            this.networks.push(network);
    }
    resolveCapabilities(domain, goal) {
        const net = this.networks.find(n => n.domain === domain);
        if (!net)
            return [];
        const normalized = goal.toLowerCase();
        return net.nodes
            .filter(node => node.capabilities.some(c => normalized.includes(c.toLowerCase())))
            .flatMap(node => node.capabilities)
            .slice(0, 20);
    }
}
exports.SkillNetworkRegistry = SkillNetworkRegistry;
