35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.AGENTS = void 0;
|
|
exports.registerAgent = registerAgent;
|
|
exports.getAgent = getAgent;
|
|
exports.allAgents = allAgents;
|
|
exports.pick = pick;
|
|
const tools_1 = require("../tools");
|
|
const _registry = new Map();
|
|
function registerAgent(config) {
|
|
_registry.set(config.name, config);
|
|
}
|
|
function getAgent(name) {
|
|
return _registry.get(name);
|
|
}
|
|
function allAgents() {
|
|
return [..._registry.values()];
|
|
}
|
|
/**
|
|
* Backwards-compatible AGENTS object — populated as agents register.
|
|
* server.ts uses AGENTS[name] and Object.values(AGENTS).
|
|
*/
|
|
exports.AGENTS = new Proxy({}, {
|
|
get(_target, prop) { return _registry.get(prop); },
|
|
ownKeys() { return [..._registry.keys()]; },
|
|
getOwnPropertyDescriptor(_target, prop) {
|
|
const v = _registry.get(prop);
|
|
return v ? { configurable: true, enumerable: true, value: v } : undefined;
|
|
}
|
|
});
|
|
/** Pick tools from ALL_TOOLS by name. */
|
|
function pick(names) {
|
|
return tools_1.ALL_TOOLS.filter(t => names.includes(t.name));
|
|
}
|