import { ManagedRegistry } from '../ManagedRegistry.js';
export class AgentRegistry extends ManagedRegistry {
    constructor() {
        super({ componentName: 'AgentRegistry', computeId: (def) => def.info.id });
    }
    resolve(agentId) {
        return this.getOrThrow(agentId).typedAgent;
    }
    listByType(type) {
        return this.getAll().filter((d) => d.typedAgent.type === type);
    }
    search(query) {
        return this.getAll().filter((def) => {
            if (query.category && def.info.category !== query.category)
                return false;
            if (query.query) {
                const q = query.query.toLowerCase();
                if (!def.info.name.toLowerCase().includes(q) &&
                    !def.info.description.toLowerCase().includes(q))
                    return false;
            }
            return true;
        });
    }
}
//# sourceMappingURL=definitions.js.map