@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.
- package/dist/durable/index.cjs +25 -10
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +26 -11
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +25 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +26 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -795,7 +795,11 @@ declare class ToolsController {
|
|
|
795
795
|
private readonly agents;
|
|
796
796
|
constructor(actorResolver: ActorResolver, depsFactory: AgentDepsFactory, agents: AgentRegistry);
|
|
797
797
|
list(req: Request,
|
|
798
|
-
/**
|
|
798
|
+
/**
|
|
799
|
+
* The agent whose tools to list. Omitted → the default agent, the one a turn naming none uses.
|
|
800
|
+
* `*` → every agent's: the union of what this actor reaches through any of them, each tool once
|
|
801
|
+
* — for a surface that shows several agents' conversations.
|
|
802
|
+
*/
|
|
799
803
|
agent?: string): Promise<ToolCatalogEntry[]>;
|
|
800
804
|
}
|
|
801
805
|
|
package/dist/index.d.ts
CHANGED
|
@@ -795,7 +795,11 @@ declare class ToolsController {
|
|
|
795
795
|
private readonly agents;
|
|
796
796
|
constructor(actorResolver: ActorResolver, depsFactory: AgentDepsFactory, agents: AgentRegistry);
|
|
797
797
|
list(req: Request,
|
|
798
|
-
/**
|
|
798
|
+
/**
|
|
799
|
+
* The agent whose tools to list. Omitted → the default agent, the one a turn naming none uses.
|
|
800
|
+
* `*` → every agent's: the union of what this actor reaches through any of them, each tool once
|
|
801
|
+
* — for a surface that shows several agents' conversations.
|
|
802
|
+
*/
|
|
799
803
|
agent?: string): Promise<ToolCatalogEntry[]>;
|
|
800
804
|
}
|
|
801
805
|
|
package/dist/index.js
CHANGED
|
@@ -2535,7 +2535,7 @@ ToolCallController = _ts_decorate14([
|
|
|
2535
2535
|
], ToolCallController);
|
|
2536
2536
|
|
|
2537
2537
|
// src/controller/tools.controller.ts
|
|
2538
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER11, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
2538
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER11, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_REGISTRY as AGENT_REGISTRY3, ALL_AGENTS, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
2539
2539
|
import { Controller as Controller12, Get as Get10, Inject as Inject14, NotFoundException as NotFoundException3, Query as Query5, Req as Req11 } from "@nestjs/common";
|
|
2540
2540
|
function _ts_decorate15(decorators, target, key, desc) {
|
|
2541
2541
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2576,19 +2576,34 @@ var ToolsController = class {
|
|
|
2576
2576
|
this.agents = agents;
|
|
2577
2577
|
}
|
|
2578
2578
|
async list(req, agent) {
|
|
2579
|
-
if (agent !== void 0 && this.agents.get(agent) === void 0) {
|
|
2579
|
+
if (agent !== void 0 && agent !== ALL_AGENTS && this.agents.get(agent) === void 0) {
|
|
2580
2580
|
throw new NotFoundException3(`No agent named "${agent}"`);
|
|
2581
2581
|
}
|
|
2582
2582
|
const actor = await this.actorResolver.resolve(req);
|
|
2583
|
-
const
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2583
|
+
const names = agent === ALL_AGENTS ? [
|
|
2584
|
+
void 0,
|
|
2585
|
+
...this.agents.list().map((definition) => definition.name)
|
|
2586
|
+
] : [
|
|
2587
|
+
agent
|
|
2588
|
+
];
|
|
2589
|
+
const entries = /* @__PURE__ */ new Map();
|
|
2590
|
+
for (const name of names) {
|
|
2591
|
+
const deps = this.depsFactory.forAgent(name);
|
|
2592
|
+
const specs = await deps.registry.visibleSpecs(actor, deps.rolesPolicy, deps.toolAllowList);
|
|
2593
|
+
for (const spec of specs) {
|
|
2594
|
+
if (entries.has(spec.name)) continue;
|
|
2595
|
+
entries.set(spec.name, {
|
|
2596
|
+
name: spec.name,
|
|
2597
|
+
kind: spec.kind,
|
|
2598
|
+
...spec.presentation !== void 0 ? {
|
|
2599
|
+
presentation: spec.presentation
|
|
2600
|
+
} : {}
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
return [
|
|
2605
|
+
...entries.values()
|
|
2606
|
+
];
|
|
2592
2607
|
}
|
|
2593
2608
|
};
|
|
2594
2609
|
_ts_decorate15([
|