@dudousxd/nestjs-agent 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3384,19 +3384,34 @@ var ToolsController = class {
3384
3384
  this.agents = agents;
3385
3385
  }
3386
3386
  async list(req, agent) {
3387
- if (agent !== void 0 && this.agents.get(agent) === void 0) {
3387
+ if (agent !== void 0 && agent !== import_nestjs_agent_core20.ALL_AGENTS && this.agents.get(agent) === void 0) {
3388
3388
  throw new import_common19.NotFoundException(`No agent named "${agent}"`);
3389
3389
  }
3390
3390
  const actor = await this.actorResolver.resolve(req);
3391
- const deps = this.depsFactory.forAgent(agent);
3392
- const specs = await deps.registry.visibleSpecs(actor, deps.rolesPolicy, deps.toolAllowList);
3393
- return specs.map((spec) => ({
3394
- name: spec.name,
3395
- kind: spec.kind,
3396
- ...spec.presentation !== void 0 ? {
3397
- presentation: spec.presentation
3398
- } : {}
3399
- }));
3391
+ const names = agent === import_nestjs_agent_core20.ALL_AGENTS ? [
3392
+ void 0,
3393
+ ...this.agents.list().map((definition) => definition.name)
3394
+ ] : [
3395
+ agent
3396
+ ];
3397
+ const entries = /* @__PURE__ */ new Map();
3398
+ for (const name of names) {
3399
+ const deps = this.depsFactory.forAgent(name);
3400
+ const specs = await deps.registry.visibleSpecs(actor, deps.rolesPolicy, deps.toolAllowList);
3401
+ for (const spec of specs) {
3402
+ if (entries.has(spec.name)) continue;
3403
+ entries.set(spec.name, {
3404
+ name: spec.name,
3405
+ kind: spec.kind,
3406
+ ...spec.presentation !== void 0 ? {
3407
+ presentation: spec.presentation
3408
+ } : {}
3409
+ });
3410
+ }
3411
+ }
3412
+ return [
3413
+ ...entries.values()
3414
+ ];
3400
3415
  }
3401
3416
  };
3402
3417
  _ts_decorate19([