@dudousxd/nestjs-agent 1.1.1 → 1.2.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/README.md +29 -0
- package/dist/durable/index.cjs +224 -138
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +154 -68
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +226 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +150 -64
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamicModule, OnModuleInit, Type, OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-OjrLyAZo.cjs';
|
|
3
3
|
export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, i as delegateToolName, p as provideAgentTool, u as utcDay } from './agent-deps.factory-OjrLyAZo.cjs';
|
|
4
|
-
import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
|
|
4
|
+
import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
export * from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
import { Request } from 'express';
|
|
7
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -315,6 +315,22 @@ interface AiToolOptions {
|
|
|
315
315
|
* role-based policy, which uses `roles`.
|
|
316
316
|
*/
|
|
317
317
|
ability?: string;
|
|
318
|
+
/**
|
|
319
|
+
* How a chat surface talks about this tool without naming it — sentence templates over the
|
|
320
|
+
* call's input, an icon key, the approval prompt's wording, and how its output reads. Never shown
|
|
321
|
+
* to the model. Served by `GET <base>/tools` to the actors who can reach the tool:
|
|
322
|
+
*
|
|
323
|
+
* ```ts
|
|
324
|
+
* @AiTool({
|
|
325
|
+
* name: 'purgeCache', kind: 'action', description: '…', input,
|
|
326
|
+
* presentation: {
|
|
327
|
+
* label: 'Cache purge', running: 'Purging {key}', done: 'Purged {key}', icon: 'cache',
|
|
328
|
+
* tone: 'destructive', confirm: { title: 'Purge {key}?', verb: 'Purge' },
|
|
329
|
+
* },
|
|
330
|
+
* })
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
presentation?: ToolPresentation;
|
|
318
334
|
}
|
|
319
335
|
/**
|
|
320
336
|
* Marks a provider class as an AI tool. The class must implement `execute(input, ctx)`.
|
|
@@ -610,6 +626,30 @@ declare class SkillsController {
|
|
|
610
626
|
threadId?: string): Promise<SkillCatalogEntry[]>;
|
|
611
627
|
}
|
|
612
628
|
|
|
629
|
+
/**
|
|
630
|
+
* The tools THIS caller can reach through an agent, with how a chat surface should talk about each
|
|
631
|
+
* one (`@AiTool({ presentation })`) — so a client narrates "Querying orders" instead of printing
|
|
632
|
+
* `executeSql`, from words declared beside the tool's input schema rather than a client-side map
|
|
633
|
+
* that goes stale on the next rename.
|
|
634
|
+
*
|
|
635
|
+
* THE SAME LIST THE MODEL IS OFFERED: built by `ToolRegistry.visibleSpecs`, the call behind
|
|
636
|
+
* `definitionsFor`, against the agent's own allow-list, the roles policy and each tool's
|
|
637
|
+
* `isEnabled`/`canUse`. Built-in tools the loop serves itself (`ask`, `skill`, `remember`) are not
|
|
638
|
+
* registry tools and are not listed.
|
|
639
|
+
*
|
|
640
|
+
* Posture mirrors `GET /agent/skills`: a plain array, and nothing the caller can pass to widen it —
|
|
641
|
+
* the actor comes from the resolver, and `agent` only ever narrows to that agent's allow-list.
|
|
642
|
+
*/
|
|
643
|
+
declare class ToolsController {
|
|
644
|
+
private readonly actorResolver;
|
|
645
|
+
private readonly depsFactory;
|
|
646
|
+
private readonly agents;
|
|
647
|
+
constructor(actorResolver: ActorResolver, depsFactory: AgentDepsFactory, agents: AgentRegistry);
|
|
648
|
+
list(req: Request,
|
|
649
|
+
/** The agent whose tools to list. Omitted → the default agent, the one a turn naming none uses. */
|
|
650
|
+
agent?: string): Promise<ToolCatalogEntry[]>;
|
|
651
|
+
}
|
|
652
|
+
|
|
613
653
|
/**
|
|
614
654
|
* What the assistant believes about THIS caller — and how they take one of those beliefs back.
|
|
615
655
|
*
|
|
@@ -783,4 +823,4 @@ declare class HeaderActorResolver implements ActorResolver {
|
|
|
783
823
|
resolve(req: unknown): Actor;
|
|
784
824
|
}
|
|
785
825
|
|
|
786
|
-
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
|
|
826
|
+
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, ToolsController, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamicModule, OnModuleInit, Type, OnApplicationBootstrap } from '@nestjs/common';
|
|
2
2
|
import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-OjrLyAZo.js';
|
|
3
3
|
export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, i as delegateToolName, p as provideAgentTool, u as utcDay } from './agent-deps.factory-OjrLyAZo.js';
|
|
4
|
-
import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
|
|
4
|
+
import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
|
|
5
5
|
export * from '@dudousxd/nestjs-agent-core';
|
|
6
6
|
import { Request } from 'express';
|
|
7
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -315,6 +315,22 @@ interface AiToolOptions {
|
|
|
315
315
|
* role-based policy, which uses `roles`.
|
|
316
316
|
*/
|
|
317
317
|
ability?: string;
|
|
318
|
+
/**
|
|
319
|
+
* How a chat surface talks about this tool without naming it — sentence templates over the
|
|
320
|
+
* call's input, an icon key, the approval prompt's wording, and how its output reads. Never shown
|
|
321
|
+
* to the model. Served by `GET <base>/tools` to the actors who can reach the tool:
|
|
322
|
+
*
|
|
323
|
+
* ```ts
|
|
324
|
+
* @AiTool({
|
|
325
|
+
* name: 'purgeCache', kind: 'action', description: '…', input,
|
|
326
|
+
* presentation: {
|
|
327
|
+
* label: 'Cache purge', running: 'Purging {key}', done: 'Purged {key}', icon: 'cache',
|
|
328
|
+
* tone: 'destructive', confirm: { title: 'Purge {key}?', verb: 'Purge' },
|
|
329
|
+
* },
|
|
330
|
+
* })
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
presentation?: ToolPresentation;
|
|
318
334
|
}
|
|
319
335
|
/**
|
|
320
336
|
* Marks a provider class as an AI tool. The class must implement `execute(input, ctx)`.
|
|
@@ -610,6 +626,30 @@ declare class SkillsController {
|
|
|
610
626
|
threadId?: string): Promise<SkillCatalogEntry[]>;
|
|
611
627
|
}
|
|
612
628
|
|
|
629
|
+
/**
|
|
630
|
+
* The tools THIS caller can reach through an agent, with how a chat surface should talk about each
|
|
631
|
+
* one (`@AiTool({ presentation })`) — so a client narrates "Querying orders" instead of printing
|
|
632
|
+
* `executeSql`, from words declared beside the tool's input schema rather than a client-side map
|
|
633
|
+
* that goes stale on the next rename.
|
|
634
|
+
*
|
|
635
|
+
* THE SAME LIST THE MODEL IS OFFERED: built by `ToolRegistry.visibleSpecs`, the call behind
|
|
636
|
+
* `definitionsFor`, against the agent's own allow-list, the roles policy and each tool's
|
|
637
|
+
* `isEnabled`/`canUse`. Built-in tools the loop serves itself (`ask`, `skill`, `remember`) are not
|
|
638
|
+
* registry tools and are not listed.
|
|
639
|
+
*
|
|
640
|
+
* Posture mirrors `GET /agent/skills`: a plain array, and nothing the caller can pass to widen it —
|
|
641
|
+
* the actor comes from the resolver, and `agent` only ever narrows to that agent's allow-list.
|
|
642
|
+
*/
|
|
643
|
+
declare class ToolsController {
|
|
644
|
+
private readonly actorResolver;
|
|
645
|
+
private readonly depsFactory;
|
|
646
|
+
private readonly agents;
|
|
647
|
+
constructor(actorResolver: ActorResolver, depsFactory: AgentDepsFactory, agents: AgentRegistry);
|
|
648
|
+
list(req: Request,
|
|
649
|
+
/** The agent whose tools to list. Omitted → the default agent, the one a turn naming none uses. */
|
|
650
|
+
agent?: string): Promise<ToolCatalogEntry[]>;
|
|
651
|
+
}
|
|
652
|
+
|
|
613
653
|
/**
|
|
614
654
|
* What the assistant believes about THIS caller — and how they take one of those beliefs back.
|
|
615
655
|
*
|
|
@@ -783,4 +823,4 @@ declare class HeaderActorResolver implements ActorResolver {
|
|
|
783
823
|
resolve(req: unknown): Actor;
|
|
784
824
|
}
|
|
785
825
|
|
|
786
|
-
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
|
|
826
|
+
export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, ToolsController, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/agent.module.ts
|
|
5
|
-
import { AGENT_ACTOR_RESOLVER as
|
|
5
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER9, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_DURABLE_RUNNER, AGENT_MEMORY as AGENT_MEMORY3, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS4, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY6, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK2, AGENT_SKILLS as AGENT_SKILLS3, AGENT_SKILL_SOURCES as AGENT_SKILL_SOURCES2, AGENT_STORE as AGENT_STORE4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry6, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
6
6
|
import { Global, Module } from "@nestjs/common";
|
|
7
7
|
import { DiscoveryModule, RouterModule } from "@nestjs/core";
|
|
8
8
|
|
|
@@ -1871,9 +1871,90 @@ ToolCallController = _ts_decorate11([
|
|
|
1871
1871
|
])
|
|
1872
1872
|
], ToolCallController);
|
|
1873
1873
|
|
|
1874
|
+
// src/controller/tools.controller.ts
|
|
1875
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER8, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
1876
|
+
import { Controller as Controller9, Get as Get8, Inject as Inject11, NotFoundException as NotFoundException3, Query as Query3, Req as Req8 } from "@nestjs/common";
|
|
1877
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1878
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1879
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1880
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1881
|
+
} else {
|
|
1882
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1883
|
+
if (d = decorators[i]) {
|
|
1884
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1889
|
+
}
|
|
1890
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1891
|
+
function _ts_metadata12(metadataKey, metadataValue) {
|
|
1892
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1893
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1897
|
+
function _ts_param11(paramIndex, decorator) {
|
|
1898
|
+
return function(target, key) {
|
|
1899
|
+
decorator(target, key, paramIndex);
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
__name(_ts_param11, "_ts_param");
|
|
1903
|
+
var ToolsController = class {
|
|
1904
|
+
static {
|
|
1905
|
+
__name(this, "ToolsController");
|
|
1906
|
+
}
|
|
1907
|
+
actorResolver;
|
|
1908
|
+
depsFactory;
|
|
1909
|
+
agents;
|
|
1910
|
+
constructor(actorResolver, depsFactory, agents) {
|
|
1911
|
+
this.actorResolver = actorResolver;
|
|
1912
|
+
this.depsFactory = depsFactory;
|
|
1913
|
+
this.agents = agents;
|
|
1914
|
+
}
|
|
1915
|
+
async list(req, agent) {
|
|
1916
|
+
if (agent !== void 0 && this.agents.get(agent) === void 0) {
|
|
1917
|
+
throw new NotFoundException3(`No agent named "${agent}"`);
|
|
1918
|
+
}
|
|
1919
|
+
const actor = await this.actorResolver.resolve(req);
|
|
1920
|
+
const deps = this.depsFactory.forAgent(agent);
|
|
1921
|
+
const specs = await deps.registry.visibleSpecs(actor, deps.rolesPolicy, deps.toolAllowList);
|
|
1922
|
+
return specs.map((spec) => ({
|
|
1923
|
+
name: spec.name,
|
|
1924
|
+
kind: spec.kind,
|
|
1925
|
+
...spec.presentation !== void 0 ? {
|
|
1926
|
+
presentation: spec.presentation
|
|
1927
|
+
} : {}
|
|
1928
|
+
}));
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
_ts_decorate12([
|
|
1932
|
+
Get8(),
|
|
1933
|
+
_ts_param11(0, Req8()),
|
|
1934
|
+
_ts_param11(1, Query3("agent")),
|
|
1935
|
+
_ts_metadata12("design:type", Function),
|
|
1936
|
+
_ts_metadata12("design:paramtypes", [
|
|
1937
|
+
typeof Request === "undefined" ? Object : Request,
|
|
1938
|
+
String
|
|
1939
|
+
]),
|
|
1940
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1941
|
+
], ToolsController.prototype, "list", null);
|
|
1942
|
+
ToolsController = _ts_decorate12([
|
|
1943
|
+
Controller9("tools"),
|
|
1944
|
+
_ts_param11(0, Inject11(AGENT_ACTOR_RESOLVER8)),
|
|
1945
|
+
_ts_param11(1, Inject11(AGENT_DEPS_FACTORY3)),
|
|
1946
|
+
_ts_param11(2, Inject11(AGENT_REGISTRY3)),
|
|
1947
|
+
_ts_metadata12("design:type", Function),
|
|
1948
|
+
_ts_metadata12("design:paramtypes", [
|
|
1949
|
+
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
1950
|
+
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1951
|
+
typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4
|
|
1952
|
+
])
|
|
1953
|
+
], ToolsController);
|
|
1954
|
+
|
|
1874
1955
|
// src/discovery/agent-discovery.service.ts
|
|
1875
|
-
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as
|
|
1876
|
-
import { Inject as
|
|
1956
|
+
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY4, AgentRegistry as AgentRegistry5 } from "@dudousxd/nestjs-agent-core";
|
|
1957
|
+
import { Inject as Inject12, Injectable as Injectable4, Logger } from "@nestjs/common";
|
|
1877
1958
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
1878
1959
|
|
|
1879
1960
|
// src/decorator/agent.decorator.ts
|
|
@@ -1908,7 +1989,7 @@ function SystemPromptContributor() {
|
|
|
1908
1989
|
__name(SystemPromptContributor, "SystemPromptContributor");
|
|
1909
1990
|
|
|
1910
1991
|
// src/discovery/agent-discovery.service.ts
|
|
1911
|
-
function
|
|
1992
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1912
1993
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1913
1994
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1914
1995
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1921,19 +2002,19 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
1921
2002
|
}
|
|
1922
2003
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1923
2004
|
}
|
|
1924
|
-
__name(
|
|
1925
|
-
function
|
|
2005
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
2006
|
+
function _ts_metadata13(metadataKey, metadataValue) {
|
|
1926
2007
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1927
2008
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1928
2009
|
}
|
|
1929
2010
|
}
|
|
1930
|
-
__name(
|
|
1931
|
-
function
|
|
2011
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
2012
|
+
function _ts_param12(paramIndex, decorator) {
|
|
1932
2013
|
return function(target, key) {
|
|
1933
2014
|
decorator(target, key, paramIndex);
|
|
1934
2015
|
};
|
|
1935
2016
|
}
|
|
1936
|
-
__name(
|
|
2017
|
+
__name(_ts_param12, "_ts_param");
|
|
1937
2018
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
1938
2019
|
static {
|
|
1939
2020
|
__name(this, "AgentDiscoveryService");
|
|
@@ -2060,22 +2141,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
2060
2141
|
return (ctx) => candidate.call(instance, ctx);
|
|
2061
2142
|
}
|
|
2062
2143
|
};
|
|
2063
|
-
AgentDiscoveryService =
|
|
2144
|
+
AgentDiscoveryService = _ts_decorate13([
|
|
2064
2145
|
Injectable4(),
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2146
|
+
_ts_param12(2, Inject12(AGENT_REGISTRY4)),
|
|
2147
|
+
_ts_param12(3, Inject12(AGENT_PROMPT_CONTRIBUTORS2)),
|
|
2148
|
+
_ts_metadata13("design:type", Function),
|
|
2149
|
+
_ts_metadata13("design:paramtypes", [
|
|
2069
2150
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
2070
2151
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
2071
|
-
typeof
|
|
2152
|
+
typeof AgentRegistry5 === "undefined" ? Object : AgentRegistry5,
|
|
2072
2153
|
Array
|
|
2073
2154
|
])
|
|
2074
2155
|
], AgentDiscoveryService);
|
|
2075
2156
|
|
|
2076
2157
|
// src/discovery/ai-tool-discovery.service.ts
|
|
2077
|
-
import { AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_REGISTRY as
|
|
2078
|
-
import { Inject as
|
|
2158
|
+
import { AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2, normalizeDelegation as normalizeDelegation2 } from "@dudousxd/nestjs-agent-core";
|
|
2159
|
+
import { Inject as Inject13, Injectable as Injectable5, Logger as Logger2 } from "@nestjs/common";
|
|
2079
2160
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
2080
2161
|
import { z } from "zod";
|
|
2081
2162
|
|
|
@@ -2124,7 +2205,7 @@ function provideAgentTool(factoryOrTool, inject) {
|
|
|
2124
2205
|
__name(provideAgentTool, "provideAgentTool");
|
|
2125
2206
|
|
|
2126
2207
|
// src/discovery/ai-tool-discovery.service.ts
|
|
2127
|
-
function
|
|
2208
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
2128
2209
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2129
2210
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2130
2211
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2137,19 +2218,19 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
2137
2218
|
}
|
|
2138
2219
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2139
2220
|
}
|
|
2140
|
-
__name(
|
|
2141
|
-
function
|
|
2221
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
2222
|
+
function _ts_metadata14(metadataKey, metadataValue) {
|
|
2142
2223
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2143
2224
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2144
2225
|
}
|
|
2145
2226
|
}
|
|
2146
|
-
__name(
|
|
2147
|
-
function
|
|
2227
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
2228
|
+
function _ts_param13(paramIndex, decorator) {
|
|
2148
2229
|
return function(target, key) {
|
|
2149
2230
|
decorator(target, key, paramIndex);
|
|
2150
2231
|
};
|
|
2151
2232
|
}
|
|
2152
|
-
__name(
|
|
2233
|
+
__name(_ts_param13, "_ts_param");
|
|
2153
2234
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
2154
2235
|
static {
|
|
2155
2236
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -2203,6 +2284,9 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2203
2284
|
} : {},
|
|
2204
2285
|
...meta.enabled !== void 0 ? {
|
|
2205
2286
|
enabled: meta.enabled
|
|
2287
|
+
} : {},
|
|
2288
|
+
...meta.presentation !== void 0 ? {
|
|
2289
|
+
presentation: meta.presentation
|
|
2206
2290
|
} : {}
|
|
2207
2291
|
}, {
|
|
2208
2292
|
execute: /* @__PURE__ */ __name((input, ctx) => instance.execute(input, ctx), "execute"),
|
|
@@ -2276,13 +2360,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2276
2360
|
return true;
|
|
2277
2361
|
}
|
|
2278
2362
|
};
|
|
2279
|
-
AiToolDiscoveryService =
|
|
2363
|
+
AiToolDiscoveryService = _ts_decorate14([
|
|
2280
2364
|
Injectable5(),
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2365
|
+
_ts_param13(1, Inject13(AGENT_TOOL_REGISTRY2)),
|
|
2366
|
+
_ts_param13(2, Inject13(AGENT_REGISTRY5)),
|
|
2367
|
+
_ts_param13(3, Inject13(AGENT_OPTIONS3)),
|
|
2368
|
+
_ts_metadata14("design:type", Function),
|
|
2369
|
+
_ts_metadata14("design:paramtypes", [
|
|
2286
2370
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
2287
2371
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
2288
2372
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -2292,7 +2376,7 @@ AiToolDiscoveryService = _ts_decorate13([
|
|
|
2292
2376
|
|
|
2293
2377
|
// src/discovery/skill-discovery.service.ts
|
|
2294
2378
|
import { AGENT_SKILL_SOURCES } from "@dudousxd/nestjs-agent-core";
|
|
2295
|
-
import { Inject as
|
|
2379
|
+
import { Inject as Inject14, Injectable as Injectable6, Logger as Logger3 } from "@nestjs/common";
|
|
2296
2380
|
import { DiscoveryService as DiscoveryService3 } from "@nestjs/core";
|
|
2297
2381
|
|
|
2298
2382
|
// src/decorator/skill.decorator.ts
|
|
@@ -2315,7 +2399,7 @@ function skillScope(options) {
|
|
|
2315
2399
|
__name(skillScope, "skillScope");
|
|
2316
2400
|
|
|
2317
2401
|
// src/discovery/skill-discovery.service.ts
|
|
2318
|
-
function
|
|
2402
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
2319
2403
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2320
2404
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2321
2405
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2328,19 +2412,19 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
2328
2412
|
}
|
|
2329
2413
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2330
2414
|
}
|
|
2331
|
-
__name(
|
|
2332
|
-
function
|
|
2415
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
2416
|
+
function _ts_metadata15(metadataKey, metadataValue) {
|
|
2333
2417
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2334
2418
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2335
2419
|
}
|
|
2336
2420
|
}
|
|
2337
|
-
__name(
|
|
2338
|
-
function
|
|
2421
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
2422
|
+
function _ts_param14(paramIndex, decorator) {
|
|
2339
2423
|
return function(target, key) {
|
|
2340
2424
|
decorator(target, key, paramIndex);
|
|
2341
2425
|
};
|
|
2342
2426
|
}
|
|
2343
|
-
__name(
|
|
2427
|
+
__name(_ts_param14, "_ts_param");
|
|
2344
2428
|
var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
2345
2429
|
static {
|
|
2346
2430
|
__name(this, "SkillDiscoveryService");
|
|
@@ -2384,11 +2468,11 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
|
2384
2468
|
return flat === void 0 ? void 0 : () => flat;
|
|
2385
2469
|
}
|
|
2386
2470
|
};
|
|
2387
|
-
SkillDiscoveryService =
|
|
2471
|
+
SkillDiscoveryService = _ts_decorate15([
|
|
2388
2472
|
Injectable6(),
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2473
|
+
_ts_param14(1, Inject14(AGENT_SKILL_SOURCES)),
|
|
2474
|
+
_ts_metadata15("design:type", Function),
|
|
2475
|
+
_ts_metadata15("design:paramtypes", [
|
|
2392
2476
|
typeof DiscoveryService3 === "undefined" ? Object : DiscoveryService3,
|
|
2393
2477
|
Array
|
|
2394
2478
|
])
|
|
@@ -2486,9 +2570,9 @@ var LedgerQuotaStore = class {
|
|
|
2486
2570
|
};
|
|
2487
2571
|
|
|
2488
2572
|
// src/runner/inline-agent-runner.ts
|
|
2489
|
-
import { AGENT_DEPS_FACTORY as
|
|
2490
|
-
import { Inject as
|
|
2491
|
-
function
|
|
2573
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_STORE as AGENT_STORE3, RunCancelledError, agentFailureCode, encodeStreamEvent, publishAgentRunFailed, runAgentLoop, settleAll, settleUnsettledDelegation } from "@dudousxd/nestjs-agent-core";
|
|
2574
|
+
import { Inject as Inject15, Injectable as Injectable7, Logger as Logger4 } from "@nestjs/common";
|
|
2575
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
2492
2576
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2493
2577
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2494
2578
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2501,19 +2585,19 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
2501
2585
|
}
|
|
2502
2586
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2503
2587
|
}
|
|
2504
|
-
__name(
|
|
2505
|
-
function
|
|
2588
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
2589
|
+
function _ts_metadata16(metadataKey, metadataValue) {
|
|
2506
2590
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2507
2591
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2508
2592
|
}
|
|
2509
2593
|
}
|
|
2510
|
-
__name(
|
|
2511
|
-
function
|
|
2594
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
2595
|
+
function _ts_param15(paramIndex, decorator) {
|
|
2512
2596
|
return function(target, key) {
|
|
2513
2597
|
decorator(target, key, paramIndex);
|
|
2514
2598
|
};
|
|
2515
2599
|
}
|
|
2516
|
-
__name(
|
|
2600
|
+
__name(_ts_param15, "_ts_param");
|
|
2517
2601
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
2518
2602
|
static {
|
|
2519
2603
|
__name(this, "InlineAgentRunner");
|
|
@@ -2864,12 +2948,12 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
2864
2948
|
}
|
|
2865
2949
|
}
|
|
2866
2950
|
};
|
|
2867
|
-
InlineAgentRunner =
|
|
2951
|
+
InlineAgentRunner = _ts_decorate16([
|
|
2868
2952
|
Injectable7(),
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2953
|
+
_ts_param15(0, Inject15(AGENT_DEPS_FACTORY4)),
|
|
2954
|
+
_ts_param15(1, Inject15(AGENT_STORE3)),
|
|
2955
|
+
_ts_metadata16("design:type", Function),
|
|
2956
|
+
_ts_metadata16("design:paramtypes", [
|
|
2873
2957
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
2874
2958
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
2875
2959
|
])
|
|
@@ -2914,7 +2998,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
2914
2998
|
__name(resolveSkillsConfig, "resolveSkillsConfig");
|
|
2915
2999
|
|
|
2916
3000
|
// src/agent.module.ts
|
|
2917
|
-
function
|
|
3001
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
2918
3002
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2919
3003
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2920
3004
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2927,7 +3011,7 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
2927
3011
|
}
|
|
2928
3012
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2929
3013
|
}
|
|
2930
|
-
__name(
|
|
3014
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
2931
3015
|
var DEFAULT_PATH = "agent";
|
|
2932
3016
|
function sharedProviders(durable, includeStore) {
|
|
2933
3017
|
const providers = [
|
|
@@ -2937,8 +3021,8 @@ function sharedProviders(durable, includeStore) {
|
|
|
2937
3021
|
},
|
|
2938
3022
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
2939
3023
|
{
|
|
2940
|
-
provide:
|
|
2941
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
3024
|
+
provide: AGENT_REGISTRY6,
|
|
3025
|
+
useFactory: /* @__PURE__ */ __name(() => new AgentRegistry6(), "useFactory")
|
|
2942
3026
|
},
|
|
2943
3027
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
2944
3028
|
{
|
|
@@ -2986,7 +3070,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
2986
3070
|
]
|
|
2987
3071
|
},
|
|
2988
3072
|
{
|
|
2989
|
-
provide:
|
|
3073
|
+
provide: AGENT_ACTOR_RESOLVER9,
|
|
2990
3074
|
useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
|
|
2991
3075
|
inject: [
|
|
2992
3076
|
AGENT_OPTIONS4
|
|
@@ -3012,7 +3096,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
3012
3096
|
},
|
|
3013
3097
|
AgentDepsFactory2,
|
|
3014
3098
|
{
|
|
3015
|
-
provide:
|
|
3099
|
+
provide: AGENT_DEPS_FACTORY5,
|
|
3016
3100
|
useExisting: AgentDepsFactory2
|
|
3017
3101
|
},
|
|
3018
3102
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -3068,10 +3152,10 @@ function exportsFor(includeStore) {
|
|
|
3068
3152
|
return [
|
|
3069
3153
|
AGENT_OPTIONS4,
|
|
3070
3154
|
AGENT_TOOL_REGISTRY3,
|
|
3071
|
-
|
|
3155
|
+
AGENT_REGISTRY6,
|
|
3072
3156
|
AGENT_SINK2,
|
|
3073
3157
|
AGENT_ROLES_POLICY2,
|
|
3074
|
-
|
|
3158
|
+
AGENT_ACTOR_RESOLVER9,
|
|
3075
3159
|
AGENT_MODEL2,
|
|
3076
3160
|
...includeStore ? [
|
|
3077
3161
|
AGENT_STORE4
|
|
@@ -3080,7 +3164,7 @@ function exportsFor(includeStore) {
|
|
|
3080
3164
|
AGENT_PROMPT_CONTRIBUTORS3,
|
|
3081
3165
|
AGENT_SKILLS3,
|
|
3082
3166
|
AGENT_MEMORY3,
|
|
3083
|
-
|
|
3167
|
+
AGENT_DEPS_FACTORY5,
|
|
3084
3168
|
AgentDepsFactory2,
|
|
3085
3169
|
AgentService,
|
|
3086
3170
|
InlineAgentRunner,
|
|
@@ -3095,7 +3179,8 @@ var BASE_CONTROLLERS = [
|
|
|
3095
3179
|
QuotaController,
|
|
3096
3180
|
AgentsController,
|
|
3097
3181
|
SkillsController,
|
|
3098
|
-
MemoriesController
|
|
3182
|
+
MemoriesController,
|
|
3183
|
+
ToolsController
|
|
3099
3184
|
];
|
|
3100
3185
|
var GUARDABLE_CONTROLLERS = [
|
|
3101
3186
|
...BASE_CONTROLLERS,
|
|
@@ -3198,7 +3283,7 @@ var AgentModule = class _AgentModule {
|
|
|
3198
3283
|
};
|
|
3199
3284
|
}
|
|
3200
3285
|
};
|
|
3201
|
-
AgentModule =
|
|
3286
|
+
AgentModule = _ts_decorate17([
|
|
3202
3287
|
Global(),
|
|
3203
3288
|
Module({})
|
|
3204
3289
|
], AgentModule);
|
|
@@ -3265,6 +3350,7 @@ export {
|
|
|
3265
3350
|
SkillsController,
|
|
3266
3351
|
SystemPrompt,
|
|
3267
3352
|
SystemPromptContributor,
|
|
3353
|
+
ToolsController,
|
|
3268
3354
|
declaredSkillProvider,
|
|
3269
3355
|
delegateToolName,
|
|
3270
3356
|
provideAgentTool,
|