@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/durable/index.cjs
CHANGED
|
@@ -115,12 +115,13 @@ var AgentRunSteps = class {
|
|
|
115
115
|
const opened = await deps.sink.open(input.sinkRunId);
|
|
116
116
|
writer = input.childSink ? childSinkWriter(opened) : opened;
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const frames = (0, import_nestjs_agent_core.observeTurnFrames)(writer);
|
|
119
|
+
const turn = (0, import_nestjs_agent_core.withTurnFrames)(await (0, import_nestjs_agent_core.traceLlmTurn)(input.runId, input.step, () => deps.model.runTurn({
|
|
119
120
|
system: input.system,
|
|
120
121
|
messages: input.messages,
|
|
121
122
|
tools,
|
|
122
|
-
sink: writer
|
|
123
|
-
}));
|
|
123
|
+
sink: frames.writer
|
|
124
|
+
})), frames.summary());
|
|
124
125
|
const stamped = (0, import_nestjs_agent_core.stampToolKinds)(turn, deps);
|
|
125
126
|
return buffer === void 0 ? stamped : {
|
|
126
127
|
...stamped,
|
|
@@ -787,8 +788,8 @@ AgentDurableModule = _ts_decorate4([
|
|
|
787
788
|
], AgentDurableModule);
|
|
788
789
|
|
|
789
790
|
// src/agent.module.ts
|
|
790
|
-
var
|
|
791
|
-
var
|
|
791
|
+
var import_nestjs_agent_core24 = require("@dudousxd/nestjs-agent-core");
|
|
792
|
+
var import_common21 = require("@nestjs/common");
|
|
792
793
|
var import_core4 = require("@nestjs/core");
|
|
793
794
|
|
|
794
795
|
// src/agent-deps.factory.ts
|
|
@@ -2638,9 +2639,90 @@ ToolCallController = _ts_decorate15([
|
|
|
2638
2639
|
])
|
|
2639
2640
|
], ToolCallController);
|
|
2640
2641
|
|
|
2641
|
-
// src/
|
|
2642
|
+
// src/controller/tools.controller.ts
|
|
2642
2643
|
var import_nestjs_agent_core17 = require("@dudousxd/nestjs-agent-core");
|
|
2643
2644
|
var import_common16 = require("@nestjs/common");
|
|
2645
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
2646
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2647
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2648
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2649
|
+
} else {
|
|
2650
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
2651
|
+
if (d = decorators[i]) {
|
|
2652
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2657
|
+
}
|
|
2658
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
2659
|
+
function _ts_metadata15(metadataKey, metadataValue) {
|
|
2660
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2661
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
2665
|
+
function _ts_param14(paramIndex, decorator) {
|
|
2666
|
+
return function(target, key) {
|
|
2667
|
+
decorator(target, key, paramIndex);
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
__name(_ts_param14, "_ts_param");
|
|
2671
|
+
var ToolsController = class {
|
|
2672
|
+
static {
|
|
2673
|
+
__name(this, "ToolsController");
|
|
2674
|
+
}
|
|
2675
|
+
actorResolver;
|
|
2676
|
+
depsFactory;
|
|
2677
|
+
agents;
|
|
2678
|
+
constructor(actorResolver, depsFactory, agents) {
|
|
2679
|
+
this.actorResolver = actorResolver;
|
|
2680
|
+
this.depsFactory = depsFactory;
|
|
2681
|
+
this.agents = agents;
|
|
2682
|
+
}
|
|
2683
|
+
async list(req, agent) {
|
|
2684
|
+
if (agent !== void 0 && this.agents.get(agent) === void 0) {
|
|
2685
|
+
throw new import_common16.NotFoundException(`No agent named "${agent}"`);
|
|
2686
|
+
}
|
|
2687
|
+
const actor = await this.actorResolver.resolve(req);
|
|
2688
|
+
const deps = this.depsFactory.forAgent(agent);
|
|
2689
|
+
const specs = await deps.registry.visibleSpecs(actor, deps.rolesPolicy, deps.toolAllowList);
|
|
2690
|
+
return specs.map((spec) => ({
|
|
2691
|
+
name: spec.name,
|
|
2692
|
+
kind: spec.kind,
|
|
2693
|
+
...spec.presentation !== void 0 ? {
|
|
2694
|
+
presentation: spec.presentation
|
|
2695
|
+
} : {}
|
|
2696
|
+
}));
|
|
2697
|
+
}
|
|
2698
|
+
};
|
|
2699
|
+
_ts_decorate16([
|
|
2700
|
+
(0, import_common16.Get)(),
|
|
2701
|
+
_ts_param14(0, (0, import_common16.Req)()),
|
|
2702
|
+
_ts_param14(1, (0, import_common16.Query)("agent")),
|
|
2703
|
+
_ts_metadata15("design:type", Function),
|
|
2704
|
+
_ts_metadata15("design:paramtypes", [
|
|
2705
|
+
typeof Request === "undefined" ? Object : Request,
|
|
2706
|
+
String
|
|
2707
|
+
]),
|
|
2708
|
+
_ts_metadata15("design:returntype", Promise)
|
|
2709
|
+
], ToolsController.prototype, "list", null);
|
|
2710
|
+
ToolsController = _ts_decorate16([
|
|
2711
|
+
(0, import_common16.Controller)("tools"),
|
|
2712
|
+
_ts_param14(0, (0, import_common16.Inject)(import_nestjs_agent_core17.AGENT_ACTOR_RESOLVER)),
|
|
2713
|
+
_ts_param14(1, (0, import_common16.Inject)(import_nestjs_agent_core17.AGENT_DEPS_FACTORY)),
|
|
2714
|
+
_ts_param14(2, (0, import_common16.Inject)(import_nestjs_agent_core17.AGENT_REGISTRY)),
|
|
2715
|
+
_ts_metadata15("design:type", Function),
|
|
2716
|
+
_ts_metadata15("design:paramtypes", [
|
|
2717
|
+
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
2718
|
+
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
2719
|
+
typeof import_nestjs_agent_core17.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core17.AgentRegistry
|
|
2720
|
+
])
|
|
2721
|
+
], ToolsController);
|
|
2722
|
+
|
|
2723
|
+
// src/discovery/agent-discovery.service.ts
|
|
2724
|
+
var import_nestjs_agent_core18 = require("@dudousxd/nestjs-agent-core");
|
|
2725
|
+
var import_common17 = require("@nestjs/common");
|
|
2644
2726
|
var import_core = require("@nestjs/core");
|
|
2645
2727
|
|
|
2646
2728
|
// src/decorator/agent.decorator.ts
|
|
@@ -2657,7 +2739,7 @@ var SYSTEM_PROMPT_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:
|
|
|
2657
2739
|
var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
|
|
2658
2740
|
|
|
2659
2741
|
// src/discovery/agent-discovery.service.ts
|
|
2660
|
-
function
|
|
2742
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
2661
2743
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2662
2744
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2663
2745
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2670,19 +2752,19 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
2670
2752
|
}
|
|
2671
2753
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2672
2754
|
}
|
|
2673
|
-
__name(
|
|
2674
|
-
function
|
|
2755
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
2756
|
+
function _ts_metadata16(metadataKey, metadataValue) {
|
|
2675
2757
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2676
2758
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2677
2759
|
}
|
|
2678
2760
|
}
|
|
2679
|
-
__name(
|
|
2680
|
-
function
|
|
2761
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
2762
|
+
function _ts_param15(paramIndex, decorator) {
|
|
2681
2763
|
return function(target, key) {
|
|
2682
2764
|
decorator(target, key, paramIndex);
|
|
2683
2765
|
};
|
|
2684
2766
|
}
|
|
2685
|
-
__name(
|
|
2767
|
+
__name(_ts_param15, "_ts_param");
|
|
2686
2768
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
2687
2769
|
static {
|
|
2688
2770
|
__name(this, "AgentDiscoveryService");
|
|
@@ -2691,7 +2773,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
2691
2773
|
scanner;
|
|
2692
2774
|
registry;
|
|
2693
2775
|
contributors;
|
|
2694
|
-
logger = new
|
|
2776
|
+
logger = new import_common17.Logger(_AgentDiscoveryService.name);
|
|
2695
2777
|
constructor(discovery, scanner, registry, contributors) {
|
|
2696
2778
|
this.discovery = discovery;
|
|
2697
2779
|
this.scanner = scanner;
|
|
@@ -2809,22 +2891,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
2809
2891
|
return (ctx) => candidate.call(instance, ctx);
|
|
2810
2892
|
}
|
|
2811
2893
|
};
|
|
2812
|
-
AgentDiscoveryService =
|
|
2813
|
-
(0,
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2894
|
+
AgentDiscoveryService = _ts_decorate17([
|
|
2895
|
+
(0, import_common17.Injectable)(),
|
|
2896
|
+
_ts_param15(2, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_REGISTRY)),
|
|
2897
|
+
_ts_param15(3, (0, import_common17.Inject)(import_nestjs_agent_core18.AGENT_PROMPT_CONTRIBUTORS)),
|
|
2898
|
+
_ts_metadata16("design:type", Function),
|
|
2899
|
+
_ts_metadata16("design:paramtypes", [
|
|
2818
2900
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
2819
2901
|
typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
|
|
2820
|
-
typeof
|
|
2902
|
+
typeof import_nestjs_agent_core18.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core18.AgentRegistry,
|
|
2821
2903
|
Array
|
|
2822
2904
|
])
|
|
2823
2905
|
], AgentDiscoveryService);
|
|
2824
2906
|
|
|
2825
2907
|
// src/discovery/ai-tool-discovery.service.ts
|
|
2826
|
-
var
|
|
2827
|
-
var
|
|
2908
|
+
var import_nestjs_agent_core19 = require("@dudousxd/nestjs-agent-core");
|
|
2909
|
+
var import_common18 = require("@nestjs/common");
|
|
2828
2910
|
var import_core2 = require("@nestjs/core");
|
|
2829
2911
|
var import_zod = require("zod");
|
|
2830
2912
|
|
|
@@ -2844,7 +2926,7 @@ function isBrandedFunctionalTool(value) {
|
|
|
2844
2926
|
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
2845
2927
|
|
|
2846
2928
|
// src/discovery/ai-tool-discovery.service.ts
|
|
2847
|
-
function
|
|
2929
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
2848
2930
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2849
2931
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2850
2932
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2857,19 +2939,19 @@ function _ts_decorate17(decorators, target, key, desc) {
|
|
|
2857
2939
|
}
|
|
2858
2940
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2859
2941
|
}
|
|
2860
|
-
__name(
|
|
2861
|
-
function
|
|
2942
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
2943
|
+
function _ts_metadata17(metadataKey, metadataValue) {
|
|
2862
2944
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2863
2945
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
2864
2946
|
}
|
|
2865
2947
|
}
|
|
2866
|
-
__name(
|
|
2867
|
-
function
|
|
2948
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
2949
|
+
function _ts_param16(paramIndex, decorator) {
|
|
2868
2950
|
return function(target, key) {
|
|
2869
2951
|
decorator(target, key, paramIndex);
|
|
2870
2952
|
};
|
|
2871
2953
|
}
|
|
2872
|
-
__name(
|
|
2954
|
+
__name(_ts_param16, "_ts_param");
|
|
2873
2955
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
2874
2956
|
static {
|
|
2875
2957
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -2878,7 +2960,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2878
2960
|
registry;
|
|
2879
2961
|
agents;
|
|
2880
2962
|
options;
|
|
2881
|
-
logger = new
|
|
2963
|
+
logger = new import_common18.Logger(_AiToolDiscoveryService.name);
|
|
2882
2964
|
constructor(discovery, registry, agents, options) {
|
|
2883
2965
|
this.discovery = discovery;
|
|
2884
2966
|
this.registry = registry;
|
|
@@ -2923,6 +3005,9 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2923
3005
|
} : {},
|
|
2924
3006
|
...meta.enabled !== void 0 ? {
|
|
2925
3007
|
enabled: meta.enabled
|
|
3008
|
+
} : {},
|
|
3009
|
+
...meta.presentation !== void 0 ? {
|
|
3010
|
+
presentation: meta.presentation
|
|
2926
3011
|
} : {}
|
|
2927
3012
|
}, {
|
|
2928
3013
|
execute: /* @__PURE__ */ __name((input, ctx) => instance.execute(input, ctx), "execute"),
|
|
@@ -2946,7 +3031,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2946
3031
|
let delegates = 0;
|
|
2947
3032
|
for (const definition of this.agents.list()) {
|
|
2948
3033
|
for (const edge of definition.delegatesTo ?? []) {
|
|
2949
|
-
const { agent: target, detached } = (0,
|
|
3034
|
+
const { agent: target, detached } = (0, import_nestjs_agent_core19.normalizeDelegation)(edge);
|
|
2950
3035
|
const targetDefinition = this.agents.get(target);
|
|
2951
3036
|
if (targetDefinition === void 0) {
|
|
2952
3037
|
throw new Error(`Agent "${definition.name}" hands off to "${target}", which is not a registered @Agent. Declare it as an @Agent provider or fix the reference.`);
|
|
@@ -2996,13 +3081,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
2996
3081
|
return true;
|
|
2997
3082
|
}
|
|
2998
3083
|
};
|
|
2999
|
-
AiToolDiscoveryService =
|
|
3000
|
-
(0,
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3084
|
+
AiToolDiscoveryService = _ts_decorate18([
|
|
3085
|
+
(0, import_common18.Injectable)(),
|
|
3086
|
+
_ts_param16(1, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_TOOL_REGISTRY)),
|
|
3087
|
+
_ts_param16(2, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_REGISTRY)),
|
|
3088
|
+
_ts_param16(3, (0, import_common18.Inject)(import_nestjs_agent_core19.AGENT_OPTIONS)),
|
|
3089
|
+
_ts_metadata17("design:type", Function),
|
|
3090
|
+
_ts_metadata17("design:paramtypes", [
|
|
3006
3091
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
3007
3092
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
3008
3093
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -3011,25 +3096,25 @@ AiToolDiscoveryService = _ts_decorate17([
|
|
|
3011
3096
|
], AiToolDiscoveryService);
|
|
3012
3097
|
|
|
3013
3098
|
// src/discovery/skill-discovery.service.ts
|
|
3014
|
-
var
|
|
3015
|
-
var
|
|
3099
|
+
var import_nestjs_agent_core21 = require("@dudousxd/nestjs-agent-core");
|
|
3100
|
+
var import_common19 = require("@nestjs/common");
|
|
3016
3101
|
var import_core3 = require("@nestjs/core");
|
|
3017
3102
|
|
|
3018
3103
|
// src/decorator/skill.decorator.ts
|
|
3019
3104
|
var import_reflect_metadata4 = require("reflect-metadata");
|
|
3020
|
-
var
|
|
3105
|
+
var import_nestjs_agent_core20 = require("@dudousxd/nestjs-agent-core");
|
|
3021
3106
|
var SKILL_METADATA = /* @__PURE__ */ Symbol.for("@dudousxd/nestjs-agent:skill-metadata");
|
|
3022
3107
|
function readSkillMetadata(target) {
|
|
3023
3108
|
return Reflect.getMetadata(SKILL_METADATA, target);
|
|
3024
3109
|
}
|
|
3025
3110
|
__name(readSkillMetadata, "readSkillMetadata");
|
|
3026
3111
|
function skillScope(options) {
|
|
3027
|
-
return options.scope ??
|
|
3112
|
+
return options.scope ?? import_nestjs_agent_core20.GLOBAL_SCOPE;
|
|
3028
3113
|
}
|
|
3029
3114
|
__name(skillScope, "skillScope");
|
|
3030
3115
|
|
|
3031
3116
|
// src/discovery/skill-discovery.service.ts
|
|
3032
|
-
function
|
|
3117
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
3033
3118
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3034
3119
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3035
3120
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3042,26 +3127,26 @@ function _ts_decorate18(decorators, target, key, desc) {
|
|
|
3042
3127
|
}
|
|
3043
3128
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3044
3129
|
}
|
|
3045
|
-
__name(
|
|
3046
|
-
function
|
|
3130
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
3131
|
+
function _ts_metadata18(metadataKey, metadataValue) {
|
|
3047
3132
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3048
3133
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3049
3134
|
}
|
|
3050
3135
|
}
|
|
3051
|
-
__name(
|
|
3052
|
-
function
|
|
3136
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
3137
|
+
function _ts_param17(paramIndex, decorator) {
|
|
3053
3138
|
return function(target, key) {
|
|
3054
3139
|
decorator(target, key, paramIndex);
|
|
3055
3140
|
};
|
|
3056
3141
|
}
|
|
3057
|
-
__name(
|
|
3142
|
+
__name(_ts_param17, "_ts_param");
|
|
3058
3143
|
var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
3059
3144
|
static {
|
|
3060
3145
|
__name(this, "SkillDiscoveryService");
|
|
3061
3146
|
}
|
|
3062
3147
|
discovery;
|
|
3063
3148
|
declared;
|
|
3064
|
-
logger = new
|
|
3149
|
+
logger = new import_common19.Logger(_SkillDiscoveryService.name);
|
|
3065
3150
|
constructor(discovery, declared) {
|
|
3066
3151
|
this.discovery = discovery;
|
|
3067
3152
|
this.declared = declared;
|
|
@@ -3098,11 +3183,11 @@ var SkillDiscoveryService = class _SkillDiscoveryService {
|
|
|
3098
3183
|
return flat === void 0 ? void 0 : () => flat;
|
|
3099
3184
|
}
|
|
3100
3185
|
};
|
|
3101
|
-
SkillDiscoveryService =
|
|
3102
|
-
(0,
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3186
|
+
SkillDiscoveryService = _ts_decorate19([
|
|
3187
|
+
(0, import_common19.Injectable)(),
|
|
3188
|
+
_ts_param17(1, (0, import_common19.Inject)(import_nestjs_agent_core21.AGENT_SKILL_SOURCES)),
|
|
3189
|
+
_ts_metadata18("design:type", Function),
|
|
3190
|
+
_ts_metadata18("design:paramtypes", [
|
|
3106
3191
|
typeof import_core3.DiscoveryService === "undefined" ? Object : import_core3.DiscoveryService,
|
|
3107
3192
|
Array
|
|
3108
3193
|
])
|
|
@@ -3132,9 +3217,9 @@ var LedgerQuotaStore = class {
|
|
|
3132
3217
|
};
|
|
3133
3218
|
|
|
3134
3219
|
// src/runner/inline-agent-runner.ts
|
|
3135
|
-
var
|
|
3136
|
-
var
|
|
3137
|
-
function
|
|
3220
|
+
var import_nestjs_agent_core22 = require("@dudousxd/nestjs-agent-core");
|
|
3221
|
+
var import_common20 = require("@nestjs/common");
|
|
3222
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
3138
3223
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3139
3224
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3140
3225
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3147,26 +3232,26 @@ function _ts_decorate19(decorators, target, key, desc) {
|
|
|
3147
3232
|
}
|
|
3148
3233
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3149
3234
|
}
|
|
3150
|
-
__name(
|
|
3151
|
-
function
|
|
3235
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
3236
|
+
function _ts_metadata19(metadataKey, metadataValue) {
|
|
3152
3237
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
3153
3238
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
3154
3239
|
}
|
|
3155
3240
|
}
|
|
3156
|
-
__name(
|
|
3157
|
-
function
|
|
3241
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
3242
|
+
function _ts_param18(paramIndex, decorator) {
|
|
3158
3243
|
return function(target, key) {
|
|
3159
3244
|
decorator(target, key, paramIndex);
|
|
3160
3245
|
};
|
|
3161
3246
|
}
|
|
3162
|
-
__name(
|
|
3247
|
+
__name(_ts_param18, "_ts_param");
|
|
3163
3248
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
3164
3249
|
static {
|
|
3165
3250
|
__name(this, "InlineAgentRunner");
|
|
3166
3251
|
}
|
|
3167
3252
|
factory;
|
|
3168
3253
|
store;
|
|
3169
|
-
logger = new
|
|
3254
|
+
logger = new import_common20.Logger(_InlineAgentRunner.name);
|
|
3170
3255
|
pending = /* @__PURE__ */ new Map();
|
|
3171
3256
|
/**
|
|
3172
3257
|
* Runs someone has asked to stop. In-process, like `pending`, and for the same reason: this runner
|
|
@@ -3195,18 +3280,18 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3195
3280
|
] : []
|
|
3196
3281
|
]
|
|
3197
3282
|
});
|
|
3198
|
-
void (0,
|
|
3283
|
+
void (0, import_nestjs_agent_core22.runAgentLoop)({
|
|
3199
3284
|
...deps,
|
|
3200
3285
|
day
|
|
3201
3286
|
}, input, hooks).then(() => this.store.setActiveStream(input.threadId, null)).catch(async (error) => {
|
|
3202
|
-
if (error instanceof
|
|
3287
|
+
if (error instanceof import_nestjs_agent_core22.RunCancelledError) {
|
|
3203
3288
|
await this.settleCancelled(runId, input.threadId, deps);
|
|
3204
3289
|
return;
|
|
3205
3290
|
}
|
|
3206
3291
|
const message = error instanceof Error ? error.message : String(error);
|
|
3207
|
-
const code = (0,
|
|
3292
|
+
const code = (0, import_nestjs_agent_core22.agentFailureCode)(error);
|
|
3208
3293
|
this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
|
|
3209
|
-
(0,
|
|
3294
|
+
(0, import_nestjs_agent_core22.publishAgentRunFailed)({
|
|
3210
3295
|
runId,
|
|
3211
3296
|
code,
|
|
3212
3297
|
message
|
|
@@ -3255,7 +3340,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3255
3340
|
for (const [key, waiter] of this.pending) {
|
|
3256
3341
|
if (key.startsWith(`${runId}:`)) {
|
|
3257
3342
|
this.pending.delete(key);
|
|
3258
|
-
waiter.reject(new
|
|
3343
|
+
waiter.reject(new import_nestjs_agent_core22.RunCancelledError());
|
|
3259
3344
|
}
|
|
3260
3345
|
}
|
|
3261
3346
|
await Promise.resolve();
|
|
@@ -3270,7 +3355,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3270
3355
|
this.logger.log(`agent run ${runId} cancelled`);
|
|
3271
3356
|
await this.store.setActiveStream(threadId, null);
|
|
3272
3357
|
const writer = await deps.sink.open(runId);
|
|
3273
|
-
await writer.write((0,
|
|
3358
|
+
await writer.write((0, import_nestjs_agent_core22.encodeStreamEvent)({
|
|
3274
3359
|
kind: "cancelled"
|
|
3275
3360
|
}));
|
|
3276
3361
|
await writer.end();
|
|
@@ -3301,7 +3386,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3301
3386
|
awaitApproval: /* @__PURE__ */ __name((call) => this.park(runId, call.id), "awaitApproval"),
|
|
3302
3387
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
3303
3388
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
3304
|
-
parallel:
|
|
3389
|
+
parallel: import_nestjs_agent_core22.settleAll,
|
|
3305
3390
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
3306
3391
|
runAgent: /* @__PURE__ */ __name((agentName, task) => this.runNested({
|
|
3307
3392
|
agentName,
|
|
@@ -3352,7 +3437,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3352
3437
|
awaitApproval: /* @__PURE__ */ __name((call) => this.park(runId, call.id), "awaitApproval"),
|
|
3353
3438
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
3354
3439
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
3355
|
-
parallel:
|
|
3440
|
+
parallel: import_nestjs_agent_core22.settleAll,
|
|
3356
3441
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId), "cancelled"),
|
|
3357
3442
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested({
|
|
3358
3443
|
agentName: childName,
|
|
@@ -3385,7 +3470,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3385
3470
|
}
|
|
3386
3471
|
}), "startAgent")
|
|
3387
3472
|
};
|
|
3388
|
-
void (0,
|
|
3473
|
+
void (0, import_nestjs_agent_core22.runAgentLoop)({
|
|
3389
3474
|
...deps,
|
|
3390
3475
|
day
|
|
3391
3476
|
}, {
|
|
@@ -3399,13 +3484,13 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3399
3484
|
parentRunId,
|
|
3400
3485
|
deliverTo
|
|
3401
3486
|
}, hooks).catch(async (error) => {
|
|
3402
|
-
const cancelled = error instanceof
|
|
3487
|
+
const cancelled = error instanceof import_nestjs_agent_core22.RunCancelledError;
|
|
3403
3488
|
const message = error instanceof Error ? error.message : String(error);
|
|
3404
3489
|
if (!cancelled) {
|
|
3405
3490
|
this.logger.error(`detached agent run ${runId} failed: ${message}`);
|
|
3406
|
-
(0,
|
|
3491
|
+
(0, import_nestjs_agent_core22.publishAgentRunFailed)({
|
|
3407
3492
|
runId,
|
|
3408
|
-
code: (0,
|
|
3493
|
+
code: (0, import_nestjs_agent_core22.agentFailureCode)(error),
|
|
3409
3494
|
message
|
|
3410
3495
|
});
|
|
3411
3496
|
}
|
|
@@ -3413,11 +3498,11 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3413
3498
|
runId,
|
|
3414
3499
|
status: cancelled ? "cancelled" : "failed",
|
|
3415
3500
|
...cancelled ? {} : {
|
|
3416
|
-
errorCode: (0,
|
|
3501
|
+
errorCode: (0, import_nestjs_agent_core22.agentFailureCode)(error),
|
|
3417
3502
|
errorMessage: message
|
|
3418
3503
|
}
|
|
3419
3504
|
});
|
|
3420
|
-
await (0,
|
|
3505
|
+
await (0, import_nestjs_agent_core22.settleUnsettledDelegation)({
|
|
3421
3506
|
store: this.store,
|
|
3422
3507
|
delivery: deliverTo,
|
|
3423
3508
|
agent: agentName,
|
|
@@ -3456,7 +3541,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3456
3541
|
awaitApproval: /* @__PURE__ */ __name((call) => this.park(runId, call.id), "awaitApproval"),
|
|
3457
3542
|
awaitAnswers: /* @__PURE__ */ __name((request) => this.park(runId, request.id), "awaitAnswers"),
|
|
3458
3543
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
3459
|
-
parallel:
|
|
3544
|
+
parallel: import_nestjs_agent_core22.settleAll,
|
|
3460
3545
|
// A child stops when it is cancelled OR when the run a human is actually watching is: the
|
|
3461
3546
|
// canceller names the top-level run, which is the only id that ever left the server.
|
|
3462
3547
|
cancelled: /* @__PURE__ */ __name(async () => this.cancelled.has(runId) || this.cancelled.has(sinkRunId), "cancelled"),
|
|
@@ -3491,7 +3576,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3491
3576
|
}), "startAgent")
|
|
3492
3577
|
};
|
|
3493
3578
|
try {
|
|
3494
|
-
return await (0,
|
|
3579
|
+
return await (0, import_nestjs_agent_core22.runAgentLoop)({
|
|
3495
3580
|
...deps,
|
|
3496
3581
|
day
|
|
3497
3582
|
}, {
|
|
@@ -3510,19 +3595,19 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
3510
3595
|
}
|
|
3511
3596
|
}
|
|
3512
3597
|
};
|
|
3513
|
-
InlineAgentRunner =
|
|
3514
|
-
(0,
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3598
|
+
InlineAgentRunner = _ts_decorate20([
|
|
3599
|
+
(0, import_common20.Injectable)(),
|
|
3600
|
+
_ts_param18(0, (0, import_common20.Inject)(import_nestjs_agent_core22.AGENT_DEPS_FACTORY)),
|
|
3601
|
+
_ts_param18(1, (0, import_common20.Inject)(import_nestjs_agent_core22.AGENT_STORE)),
|
|
3602
|
+
_ts_metadata19("design:type", Function),
|
|
3603
|
+
_ts_metadata19("design:paramtypes", [
|
|
3519
3604
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
3520
3605
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
3521
3606
|
])
|
|
3522
3607
|
], InlineAgentRunner);
|
|
3523
3608
|
|
|
3524
3609
|
// src/skills-config.ts
|
|
3525
|
-
var
|
|
3610
|
+
var import_nestjs_agent_core23 = require("@dudousxd/nestjs-agent-core");
|
|
3526
3611
|
function declaredSkillProvider(declared) {
|
|
3527
3612
|
return {
|
|
3528
3613
|
list: /* @__PURE__ */ __name(({ scopes }) => declared.filter((skill) => scopes.includes(skill.scope)).map(({ name, description, scope }) => ({
|
|
@@ -3548,7 +3633,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
3548
3633
|
declaredSkillProvider(declared)
|
|
3549
3634
|
];
|
|
3550
3635
|
return {
|
|
3551
|
-
provider: providers.length === 1 ? providers[0] : (0,
|
|
3636
|
+
provider: providers.length === 1 ? providers[0] : (0, import_nestjs_agent_core23.compositeSkillProvider)(providers),
|
|
3552
3637
|
...options.scopes !== void 0 ? {
|
|
3553
3638
|
scopes: options.scopes
|
|
3554
3639
|
} : {},
|
|
@@ -3560,7 +3645,7 @@ function resolveSkillsConfig(options, declared) {
|
|
|
3560
3645
|
__name(resolveSkillsConfig, "resolveSkillsConfig");
|
|
3561
3646
|
|
|
3562
3647
|
// src/agent.module.ts
|
|
3563
|
-
function
|
|
3648
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
3564
3649
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3565
3650
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
3566
3651
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3573,92 +3658,92 @@ function _ts_decorate20(decorators, target, key, desc) {
|
|
|
3573
3658
|
}
|
|
3574
3659
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3575
3660
|
}
|
|
3576
|
-
__name(
|
|
3661
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
3577
3662
|
var DEFAULT_PATH = "agent";
|
|
3578
3663
|
function sharedProviders(durable, includeStore) {
|
|
3579
3664
|
const providers = [
|
|
3580
3665
|
{
|
|
3581
|
-
provide:
|
|
3582
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
3666
|
+
provide: import_nestjs_agent_core24.AGENT_TOOL_REGISTRY,
|
|
3667
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core24.ToolRegistry(), "useFactory")
|
|
3583
3668
|
},
|
|
3584
3669
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
3585
3670
|
{
|
|
3586
|
-
provide:
|
|
3587
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
3671
|
+
provide: import_nestjs_agent_core24.AGENT_REGISTRY,
|
|
3672
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core24.AgentRegistry(), "useFactory")
|
|
3588
3673
|
},
|
|
3589
3674
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
3590
3675
|
{
|
|
3591
|
-
provide:
|
|
3676
|
+
provide: import_nestjs_agent_core24.AGENT_PROMPT_CONTRIBUTORS,
|
|
3592
3677
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
3593
3678
|
},
|
|
3594
3679
|
// Likewise for `@Skill`-decorated providers — filled by SkillDiscoveryService at onModuleInit,
|
|
3595
3680
|
// read lazily by the AGENT_SKILLS provider below (which DI builds before discovery has run).
|
|
3596
3681
|
{
|
|
3597
|
-
provide:
|
|
3682
|
+
provide: import_nestjs_agent_core24.AGENT_SKILL_SOURCES,
|
|
3598
3683
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
3599
3684
|
},
|
|
3600
3685
|
{
|
|
3601
3686
|
// One resolution, shared by the loop's deps and the listing endpoint: a second one would
|
|
3602
3687
|
// drift, and a user would be offered a skill the agent cannot reach. `undefined` when the
|
|
3603
3688
|
// host configured none — which is what keeps the turn's checkpoint sequence unchanged.
|
|
3604
|
-
provide:
|
|
3689
|
+
provide: import_nestjs_agent_core24.AGENT_SKILLS,
|
|
3605
3690
|
useFactory: /* @__PURE__ */ __name((options, declared) => resolveSkillsConfig(options.skills, declared), "useFactory"),
|
|
3606
3691
|
inject: [
|
|
3607
|
-
|
|
3608
|
-
|
|
3692
|
+
import_nestjs_agent_core24.AGENT_OPTIONS,
|
|
3693
|
+
import_nestjs_agent_core24.AGENT_SKILL_SOURCES
|
|
3609
3694
|
]
|
|
3610
3695
|
},
|
|
3611
3696
|
{
|
|
3612
3697
|
// One resolution, shared by the loop's deps and the read-back endpoint: a person has to be
|
|
3613
3698
|
// shown what the model was shown, and two resolutions would eventually disagree about that.
|
|
3614
|
-
provide:
|
|
3699
|
+
provide: import_nestjs_agent_core24.AGENT_MEMORY,
|
|
3615
3700
|
useFactory: /* @__PURE__ */ __name((options) => options.memory, "useFactory"),
|
|
3616
3701
|
inject: [
|
|
3617
|
-
|
|
3702
|
+
import_nestjs_agent_core24.AGENT_OPTIONS
|
|
3618
3703
|
]
|
|
3619
3704
|
},
|
|
3620
3705
|
{
|
|
3621
|
-
provide:
|
|
3706
|
+
provide: import_nestjs_agent_core24.AGENT_SINK,
|
|
3622
3707
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
3623
3708
|
inject: [
|
|
3624
|
-
|
|
3709
|
+
import_nestjs_agent_core24.AGENT_OPTIONS
|
|
3625
3710
|
]
|
|
3626
3711
|
},
|
|
3627
3712
|
{
|
|
3628
|
-
provide:
|
|
3629
|
-
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new
|
|
3713
|
+
provide: import_nestjs_agent_core24.AGENT_ROLES_POLICY,
|
|
3714
|
+
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core24.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
|
|
3630
3715
|
inject: [
|
|
3631
|
-
|
|
3716
|
+
import_nestjs_agent_core24.AGENT_OPTIONS
|
|
3632
3717
|
]
|
|
3633
3718
|
},
|
|
3634
3719
|
{
|
|
3635
|
-
provide:
|
|
3720
|
+
provide: import_nestjs_agent_core24.AGENT_ACTOR_RESOLVER,
|
|
3636
3721
|
useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
|
|
3637
3722
|
inject: [
|
|
3638
|
-
|
|
3723
|
+
import_nestjs_agent_core24.AGENT_OPTIONS
|
|
3639
3724
|
]
|
|
3640
3725
|
},
|
|
3641
3726
|
{
|
|
3642
|
-
provide:
|
|
3727
|
+
provide: import_nestjs_agent_core24.AGENT_MODEL,
|
|
3643
3728
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
3644
3729
|
inject: [
|
|
3645
|
-
|
|
3730
|
+
import_nestjs_agent_core24.AGENT_OPTIONS
|
|
3646
3731
|
]
|
|
3647
3732
|
},
|
|
3648
3733
|
{
|
|
3649
3734
|
// An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
|
|
3650
3735
|
// store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
|
|
3651
3736
|
// the loop already writes, so enforcement needs no extra shared state across replicas.
|
|
3652
|
-
provide:
|
|
3737
|
+
provide: import_nestjs_agent_core24.AGENT_QUOTA_STORE,
|
|
3653
3738
|
useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
|
|
3654
3739
|
inject: [
|
|
3655
|
-
|
|
3656
|
-
|
|
3740
|
+
import_nestjs_agent_core24.AGENT_OPTIONS,
|
|
3741
|
+
import_nestjs_agent_core24.AGENT_STORE
|
|
3657
3742
|
]
|
|
3658
3743
|
},
|
|
3659
3744
|
AgentDepsFactory2,
|
|
3660
3745
|
{
|
|
3661
|
-
provide:
|
|
3746
|
+
provide: import_nestjs_agent_core24.AGENT_DEPS_FACTORY,
|
|
3662
3747
|
useExisting: AgentDepsFactory2
|
|
3663
3748
|
},
|
|
3664
3749
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -3672,22 +3757,22 @@ function sharedProviders(durable, includeStore) {
|
|
|
3672
3757
|
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
3673
3758
|
AgentApprovalPortAdapter,
|
|
3674
3759
|
{
|
|
3675
|
-
provide:
|
|
3760
|
+
provide: import_nestjs_agent_core24.AGENT_APPROVAL_PORT,
|
|
3676
3761
|
useExisting: AgentApprovalPortAdapter
|
|
3677
3762
|
}
|
|
3678
3763
|
];
|
|
3679
3764
|
if (includeStore) {
|
|
3680
3765
|
providers.push({
|
|
3681
|
-
provide:
|
|
3766
|
+
provide: import_nestjs_agent_core24.AGENT_STORE,
|
|
3682
3767
|
useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
|
|
3683
3768
|
inject: [
|
|
3684
|
-
|
|
3769
|
+
import_nestjs_agent_core24.AGENT_OPTIONS
|
|
3685
3770
|
]
|
|
3686
3771
|
});
|
|
3687
3772
|
}
|
|
3688
3773
|
if (durable) {
|
|
3689
3774
|
providers.push({
|
|
3690
|
-
provide:
|
|
3775
|
+
provide: import_nestjs_agent_core24.AGENT_RUNNER,
|
|
3691
3776
|
useFactory: /* @__PURE__ */ __name((durableRunner) => {
|
|
3692
3777
|
if (durableRunner === void 0) {
|
|
3693
3778
|
throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
|
|
@@ -3696,14 +3781,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
3696
3781
|
}, "useFactory"),
|
|
3697
3782
|
inject: [
|
|
3698
3783
|
{
|
|
3699
|
-
token:
|
|
3784
|
+
token: import_nestjs_agent_core24.AGENT_DURABLE_RUNNER,
|
|
3700
3785
|
optional: true
|
|
3701
3786
|
}
|
|
3702
3787
|
]
|
|
3703
3788
|
});
|
|
3704
3789
|
} else {
|
|
3705
3790
|
providers.push({
|
|
3706
|
-
provide:
|
|
3791
|
+
provide: import_nestjs_agent_core24.AGENT_RUNNER,
|
|
3707
3792
|
useExisting: InlineAgentRunner
|
|
3708
3793
|
});
|
|
3709
3794
|
}
|
|
@@ -3712,25 +3797,25 @@ function sharedProviders(durable, includeStore) {
|
|
|
3712
3797
|
__name(sharedProviders, "sharedProviders");
|
|
3713
3798
|
function exportsFor(includeStore) {
|
|
3714
3799
|
return [
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3800
|
+
import_nestjs_agent_core24.AGENT_OPTIONS,
|
|
3801
|
+
import_nestjs_agent_core24.AGENT_TOOL_REGISTRY,
|
|
3802
|
+
import_nestjs_agent_core24.AGENT_REGISTRY,
|
|
3803
|
+
import_nestjs_agent_core24.AGENT_SINK,
|
|
3804
|
+
import_nestjs_agent_core24.AGENT_ROLES_POLICY,
|
|
3805
|
+
import_nestjs_agent_core24.AGENT_ACTOR_RESOLVER,
|
|
3806
|
+
import_nestjs_agent_core24.AGENT_MODEL,
|
|
3722
3807
|
...includeStore ? [
|
|
3723
|
-
|
|
3808
|
+
import_nestjs_agent_core24.AGENT_STORE
|
|
3724
3809
|
] : [],
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3810
|
+
import_nestjs_agent_core24.AGENT_QUOTA_STORE,
|
|
3811
|
+
import_nestjs_agent_core24.AGENT_PROMPT_CONTRIBUTORS,
|
|
3812
|
+
import_nestjs_agent_core24.AGENT_SKILLS,
|
|
3813
|
+
import_nestjs_agent_core24.AGENT_MEMORY,
|
|
3814
|
+
import_nestjs_agent_core24.AGENT_DEPS_FACTORY,
|
|
3730
3815
|
AgentDepsFactory2,
|
|
3731
3816
|
AgentService,
|
|
3732
3817
|
InlineAgentRunner,
|
|
3733
|
-
|
|
3818
|
+
import_nestjs_agent_core24.AGENT_APPROVAL_PORT
|
|
3734
3819
|
];
|
|
3735
3820
|
}
|
|
3736
3821
|
__name(exportsFor, "exportsFor");
|
|
@@ -3741,7 +3826,8 @@ var BASE_CONTROLLERS = [
|
|
|
3741
3826
|
QuotaController,
|
|
3742
3827
|
AgentsController,
|
|
3743
3828
|
SkillsController,
|
|
3744
|
-
MemoriesController
|
|
3829
|
+
MemoriesController,
|
|
3830
|
+
ToolsController
|
|
3745
3831
|
];
|
|
3746
3832
|
var GUARDABLE_CONTROLLERS = [
|
|
3747
3833
|
...BASE_CONTROLLERS,
|
|
@@ -3799,7 +3885,7 @@ var AgentModule = class _AgentModule {
|
|
|
3799
3885
|
controllers: controllersForSurface(options.surface, options.attachments?.upload === true),
|
|
3800
3886
|
providers: [
|
|
3801
3887
|
{
|
|
3802
|
-
provide:
|
|
3888
|
+
provide: import_nestjs_agent_core24.AGENT_OPTIONS,
|
|
3803
3889
|
useValue: options
|
|
3804
3890
|
},
|
|
3805
3891
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -3823,7 +3909,7 @@ var AgentModule = class _AgentModule {
|
|
|
3823
3909
|
controllers: controllersForSurface(options.surface, options.attachmentsUpload === true),
|
|
3824
3910
|
providers: [
|
|
3825
3911
|
{
|
|
3826
|
-
provide:
|
|
3912
|
+
provide: import_nestjs_agent_core24.AGENT_OPTIONS,
|
|
3827
3913
|
// Stamp the STATIC wiring flags onto the factory result: `durable`/`surface` are
|
|
3828
3914
|
// authoritative on the async config object (they decided the actual wiring above), and
|
|
3829
3915
|
// the durable module reads `durable` back off AGENT_OPTIONS. `surface` isn't read back by
|
|
@@ -3844,9 +3930,9 @@ var AgentModule = class _AgentModule {
|
|
|
3844
3930
|
};
|
|
3845
3931
|
}
|
|
3846
3932
|
};
|
|
3847
|
-
AgentModule =
|
|
3848
|
-
(0,
|
|
3849
|
-
(0,
|
|
3933
|
+
AgentModule = _ts_decorate21([
|
|
3934
|
+
(0, import_common21.Global)(),
|
|
3935
|
+
(0, import_common21.Module)({})
|
|
3850
3936
|
], AgentModule);
|
|
3851
3937
|
|
|
3852
3938
|
// src/durable/agent-durable.ts
|