@dudousxd/nestjs-agent 0.5.0 → 0.6.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/{agent-deps.factory-DGM0IVtA.d.cts → agent-deps.factory-BlC9tumI.d.cts} +17 -10
- package/dist/{agent-deps.factory-DGM0IVtA.d.ts → agent-deps.factory-BlC9tumI.d.ts} +17 -10
- package/dist/durable/index.cjs +313 -228
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.d.cts +19 -17
- package/dist/durable/index.d.ts +19 -17
- package/dist/durable/index.js +231 -146
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +313 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -9
- package/dist/index.d.ts +48 -9
- package/dist/index.js +230 -144
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/durable/index.js
CHANGED
|
@@ -412,9 +412,9 @@ AgentDurableModule = _ts_decorate4([
|
|
|
412
412
|
{
|
|
413
413
|
provide: AGENT_DISPATCHED_STEPS,
|
|
414
414
|
useFactory: /* @__PURE__ */ __name((options, sink) => {
|
|
415
|
-
const enabled = options.dispatchedSteps
|
|
415
|
+
const enabled = options.durable === true && options.dispatchedSteps !== false;
|
|
416
416
|
if (enabled && sink instanceof InProcessTokenStreamSink) {
|
|
417
|
-
logger.warn("
|
|
417
|
+
logger.warn("Dispatched steps are active (the default under durable: true) with the default InProcessTokenStreamSink, which only buffers tokens in-process. A dispatched `llm` step served by a different worker cannot stream into this buffer. Wire a cross-process TokenStreamSink (e.g. a Redis pub/sub sink) via AgentModule.forRoot({ sink }) before running multi-pod, or set dispatchedSteps: false to keep the turn in-process localSteps.");
|
|
418
418
|
}
|
|
419
419
|
return enabled;
|
|
420
420
|
}, "useFactory"),
|
|
@@ -434,7 +434,7 @@ AgentDurableModule = _ts_decorate4([
|
|
|
434
434
|
], AgentDurableModule);
|
|
435
435
|
|
|
436
436
|
// src/agent.module.ts
|
|
437
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY6, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS5, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK3, AGENT_STORE as AGENT_STORE5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry5, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
437
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER6, AGENT_APPROVAL_PORT, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY6, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS5, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK3, AGENT_STORE as AGENT_STORE5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry5, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
438
438
|
import { Global as Global2, Module as Module2 } from "@nestjs/common";
|
|
439
439
|
import { DiscoveryModule, RouterModule } from "@nestjs/core";
|
|
440
440
|
|
|
@@ -672,20 +672,32 @@ var AgentService = class {
|
|
|
672
672
|
return this.deps.forAgent().sink.subscribe(runId);
|
|
673
673
|
}
|
|
674
674
|
async approve(actor, toolCallId) {
|
|
675
|
-
|
|
676
|
-
return this.
|
|
675
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
676
|
+
return this.signalToolCall(toolCallId, {
|
|
677
677
|
approved: true
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
680
|
async reject(actor, toolCallId, reason) {
|
|
681
|
-
|
|
682
|
-
return this.
|
|
681
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
682
|
+
return this.signalToolCall(toolCallId, {
|
|
683
683
|
approved: false,
|
|
684
684
|
...reason !== void 0 ? {
|
|
685
685
|
reason
|
|
686
686
|
} : {}
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
|
+
/**
|
|
690
|
+
* The decision core behind approve/reject, WITHOUT an ownership check: resolves the run
|
|
691
|
+
* currently awaiting `toolCallId` and signals it. `approve`/`reject` above call this after their
|
|
692
|
+
* own `assertOwnsToolCall` gate; the console `AgentApprovalPort` adapter (bound by `AgentModule`)
|
|
693
|
+
* calls it directly — a console caller is already authorized by the dashboard's own guards, and
|
|
694
|
+
* re-deriving thread ownership here would reject a legitimate operator decision (an operator is
|
|
695
|
+
* not the thread's own actor).
|
|
696
|
+
*/
|
|
697
|
+
async signalToolCall(toolCallId, decision) {
|
|
698
|
+
const runId = await this.resolveRunForToolCall(toolCallId);
|
|
699
|
+
return this.runner.signal(runId, toolCallId, decision);
|
|
700
|
+
}
|
|
689
701
|
async cancel(actor, runId) {
|
|
690
702
|
await this.assertOwnsActiveStream(actor, runId);
|
|
691
703
|
return this.runner.cancel(runId);
|
|
@@ -833,12 +845,11 @@ var AgentService = class {
|
|
|
833
845
|
}
|
|
834
846
|
}
|
|
835
847
|
/**
|
|
836
|
-
* Authorization
|
|
837
|
-
*
|
|
838
|
-
*
|
|
839
|
-
* never knows or supplies a runId; it is derived here from the tool call alone.
|
|
848
|
+
* Authorization seam for HITL approve/reject: the caller must own the tool call's thread. Split
|
|
849
|
+
* out from run resolution (see {@link resolveRunForToolCall}) so the console `AgentApprovalPort`
|
|
850
|
+
* adapter can resolve+signal a decision WITHOUT this check — it is authorized upstream instead.
|
|
840
851
|
*/
|
|
841
|
-
async
|
|
852
|
+
async assertOwnsToolCall(actor, toolCallId) {
|
|
842
853
|
const owner = await this.store.ownerOfToolCall(toolCallId);
|
|
843
854
|
if (owner === null) {
|
|
844
855
|
throw new NotFoundException(`tool call ${toolCallId} not found`);
|
|
@@ -846,6 +857,13 @@ var AgentService = class {
|
|
|
846
857
|
if (owner !== actor.id) {
|
|
847
858
|
throw new ForbiddenException("tool call belongs to another actor");
|
|
848
859
|
}
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Resolve the run currently awaiting `toolCallId` (its thread's active stream). That run is the
|
|
863
|
+
* sub-agent's own child run when the pending call belongs to a delegated agent — the client never
|
|
864
|
+
* knows or supplies a runId; it is derived here from the tool call alone.
|
|
865
|
+
*/
|
|
866
|
+
async resolveRunForToolCall(toolCallId) {
|
|
849
867
|
const runId = await this.store.runForToolCall(toolCallId);
|
|
850
868
|
if (runId === null) {
|
|
851
869
|
throw new NotFoundException(`tool call ${toolCallId} has no active run to signal`);
|
|
@@ -878,9 +896,8 @@ AgentService = _ts_decorate6([
|
|
|
878
896
|
])
|
|
879
897
|
], AgentService);
|
|
880
898
|
|
|
881
|
-
// src/
|
|
882
|
-
import {
|
|
883
|
-
import { Controller, Get, Inject as Inject5 } from "@nestjs/common";
|
|
899
|
+
// src/approval-port.adapter.ts
|
|
900
|
+
import { Injectable as Injectable6 } from "@nestjs/common";
|
|
884
901
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
885
902
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
886
903
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -892,6 +909,56 @@ function _ts_metadata6(k, v) {
|
|
|
892
909
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
893
910
|
}
|
|
894
911
|
__name(_ts_metadata6, "_ts_metadata");
|
|
912
|
+
var AgentApprovalPortAdapter = class {
|
|
913
|
+
static {
|
|
914
|
+
__name(this, "AgentApprovalPortAdapter");
|
|
915
|
+
}
|
|
916
|
+
agent;
|
|
917
|
+
constructor(agent) {
|
|
918
|
+
this.agent = agent;
|
|
919
|
+
}
|
|
920
|
+
async approve(toolCallId, opts) {
|
|
921
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
922
|
+
approved: true,
|
|
923
|
+
...opts?.executedByRef !== void 0 ? {
|
|
924
|
+
executedByRef: opts.executedByRef
|
|
925
|
+
} : {}
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
async reject(toolCallId, opts) {
|
|
929
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
930
|
+
approved: false,
|
|
931
|
+
...opts?.executedByRef !== void 0 ? {
|
|
932
|
+
executedByRef: opts.executedByRef
|
|
933
|
+
} : {},
|
|
934
|
+
...opts?.reason !== void 0 ? {
|
|
935
|
+
reason: opts.reason
|
|
936
|
+
} : {}
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
AgentApprovalPortAdapter = _ts_decorate7([
|
|
941
|
+
Injectable6(),
|
|
942
|
+
_ts_metadata6("design:type", Function),
|
|
943
|
+
_ts_metadata6("design:paramtypes", [
|
|
944
|
+
typeof AgentService === "undefined" ? Object : AgentService
|
|
945
|
+
])
|
|
946
|
+
], AgentApprovalPortAdapter);
|
|
947
|
+
|
|
948
|
+
// src/controller/agents.controller.ts
|
|
949
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_REGISTRY as AGENT_REGISTRY2, AgentRegistry as AgentRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
950
|
+
import { Controller, Get, Inject as Inject5 } from "@nestjs/common";
|
|
951
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
952
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
953
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
954
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
955
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
956
|
+
}
|
|
957
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
958
|
+
function _ts_metadata7(k, v) {
|
|
959
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
960
|
+
}
|
|
961
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
895
962
|
function _ts_param5(paramIndex, decorator) {
|
|
896
963
|
return function(target, key) {
|
|
897
964
|
decorator(target, key, paramIndex);
|
|
@@ -919,18 +986,18 @@ var AgentsController = class {
|
|
|
919
986
|
}));
|
|
920
987
|
}
|
|
921
988
|
};
|
|
922
|
-
|
|
989
|
+
_ts_decorate8([
|
|
923
990
|
Get(),
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
991
|
+
_ts_metadata7("design:type", Function),
|
|
992
|
+
_ts_metadata7("design:paramtypes", []),
|
|
993
|
+
_ts_metadata7("design:returntype", Array)
|
|
927
994
|
], AgentsController.prototype, "list", null);
|
|
928
|
-
AgentsController =
|
|
995
|
+
AgentsController = _ts_decorate8([
|
|
929
996
|
Controller("agents"),
|
|
930
997
|
_ts_param5(0, Inject5(AGENT_REGISTRY2)),
|
|
931
998
|
_ts_param5(1, Inject5(AGENT_DEPS_FACTORY4)),
|
|
932
|
-
|
|
933
|
-
|
|
999
|
+
_ts_metadata7("design:type", Function),
|
|
1000
|
+
_ts_metadata7("design:paramtypes", [
|
|
934
1001
|
typeof AgentRegistry3 === "undefined" ? Object : AgentRegistry3,
|
|
935
1002
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
936
1003
|
])
|
|
@@ -940,17 +1007,17 @@ AgentsController = _ts_decorate7([
|
|
|
940
1007
|
import { AGENT_ACTOR_RESOLVER, AGENT_ATTACHMENT_STAGING, AGENT_OPTIONS as AGENT_OPTIONS3 } from "@dudousxd/nestjs-agent-core";
|
|
941
1008
|
import { BadRequestException as BadRequestException2, Controller as Controller2, Inject as Inject6, NotImplementedException as NotImplementedException2, Optional as Optional2, PayloadTooLargeException, Post, Req, UnsupportedMediaTypeException, UploadedFile, UseInterceptors } from "@nestjs/common";
|
|
942
1009
|
import { FileInterceptor } from "@nestjs/platform-express";
|
|
943
|
-
function
|
|
1010
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
944
1011
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
945
1012
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
946
1013
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
947
1014
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
948
1015
|
}
|
|
949
|
-
__name(
|
|
950
|
-
function
|
|
1016
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1017
|
+
function _ts_metadata8(k, v) {
|
|
951
1018
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
952
1019
|
}
|
|
953
|
-
__name(
|
|
1020
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
954
1021
|
function _ts_param6(paramIndex, decorator) {
|
|
955
1022
|
return function(target, key) {
|
|
956
1023
|
decorator(target, key, paramIndex);
|
|
@@ -1015,26 +1082,26 @@ var AttachmentsController = class {
|
|
|
1015
1082
|
});
|
|
1016
1083
|
}
|
|
1017
1084
|
};
|
|
1018
|
-
|
|
1085
|
+
_ts_decorate9([
|
|
1019
1086
|
Post(),
|
|
1020
1087
|
UseInterceptors(FileInterceptor("file")),
|
|
1021
1088
|
_ts_param6(0, Req()),
|
|
1022
1089
|
_ts_param6(1, UploadedFile()),
|
|
1023
|
-
|
|
1024
|
-
|
|
1090
|
+
_ts_metadata8("design:type", Function),
|
|
1091
|
+
_ts_metadata8("design:paramtypes", [
|
|
1025
1092
|
typeof Request === "undefined" ? Object : Request,
|
|
1026
1093
|
Object
|
|
1027
1094
|
]),
|
|
1028
|
-
|
|
1095
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1029
1096
|
], AttachmentsController.prototype, "upload", null);
|
|
1030
|
-
AttachmentsController =
|
|
1097
|
+
AttachmentsController = _ts_decorate9([
|
|
1031
1098
|
Controller2("attachments"),
|
|
1032
1099
|
_ts_param6(0, Inject6(AGENT_OPTIONS3)),
|
|
1033
1100
|
_ts_param6(1, Inject6(AGENT_ACTOR_RESOLVER)),
|
|
1034
1101
|
_ts_param6(2, Optional2()),
|
|
1035
1102
|
_ts_param6(2, Inject6(AGENT_ATTACHMENT_STAGING)),
|
|
1036
|
-
|
|
1037
|
-
|
|
1103
|
+
_ts_metadata8("design:type", Function),
|
|
1104
|
+
_ts_metadata8("design:paramtypes", [
|
|
1038
1105
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
1039
1106
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
1040
1107
|
Object
|
|
@@ -1044,17 +1111,17 @@ AttachmentsController = _ts_decorate8([
|
|
|
1044
1111
|
// src/controller/chat.controller.ts
|
|
1045
1112
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2, AgentStreamError as AgentStreamError2 } from "@dudousxd/nestjs-agent-core";
|
|
1046
1113
|
import { Body, Controller as Controller3, Get as Get2, Inject as Inject7, Param, Post as Post2, Req as Req2, Res } from "@nestjs/common";
|
|
1047
|
-
function
|
|
1114
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1048
1115
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1049
1116
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1050
1117
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1051
1118
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1052
1119
|
}
|
|
1053
|
-
__name(
|
|
1054
|
-
function
|
|
1120
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1121
|
+
function _ts_metadata9(k, v) {
|
|
1055
1122
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1056
1123
|
}
|
|
1057
|
-
__name(
|
|
1124
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1058
1125
|
function _ts_param7(paramIndex, decorator) {
|
|
1059
1126
|
return function(target, key) {
|
|
1060
1127
|
decorator(target, key, paramIndex);
|
|
@@ -1163,46 +1230,46 @@ data: ${JSON.stringify(payload)}
|
|
|
1163
1230
|
res.end();
|
|
1164
1231
|
}
|
|
1165
1232
|
};
|
|
1166
|
-
|
|
1233
|
+
_ts_decorate10([
|
|
1167
1234
|
Post2("chat"),
|
|
1168
1235
|
_ts_param7(0, Req2()),
|
|
1169
1236
|
_ts_param7(1, Res()),
|
|
1170
1237
|
_ts_param7(2, Body()),
|
|
1171
|
-
|
|
1172
|
-
|
|
1238
|
+
_ts_metadata9("design:type", Function),
|
|
1239
|
+
_ts_metadata9("design:paramtypes", [
|
|
1173
1240
|
typeof Request === "undefined" ? Object : Request,
|
|
1174
1241
|
typeof Response === "undefined" ? Object : Response,
|
|
1175
1242
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
1176
1243
|
]),
|
|
1177
|
-
|
|
1244
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1178
1245
|
], ChatController.prototype, "chat", null);
|
|
1179
|
-
|
|
1246
|
+
_ts_decorate10([
|
|
1180
1247
|
Get2("chat/:runId/stream"),
|
|
1181
1248
|
_ts_param7(0, Param("runId")),
|
|
1182
1249
|
_ts_param7(1, Res()),
|
|
1183
|
-
|
|
1184
|
-
|
|
1250
|
+
_ts_metadata9("design:type", Function),
|
|
1251
|
+
_ts_metadata9("design:paramtypes", [
|
|
1185
1252
|
String,
|
|
1186
1253
|
typeof Response === "undefined" ? Object : Response
|
|
1187
1254
|
]),
|
|
1188
|
-
|
|
1255
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1189
1256
|
], ChatController.prototype, "stream", null);
|
|
1190
|
-
|
|
1257
|
+
_ts_decorate10([
|
|
1191
1258
|
Post2("chat/:runId/cancel"),
|
|
1192
1259
|
_ts_param7(0, Req2()),
|
|
1193
1260
|
_ts_param7(1, Param("runId")),
|
|
1194
|
-
|
|
1195
|
-
|
|
1261
|
+
_ts_metadata9("design:type", Function),
|
|
1262
|
+
_ts_metadata9("design:paramtypes", [
|
|
1196
1263
|
typeof Request === "undefined" ? Object : Request,
|
|
1197
1264
|
String
|
|
1198
1265
|
]),
|
|
1199
|
-
|
|
1266
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1200
1267
|
], ChatController.prototype, "cancel", null);
|
|
1201
|
-
ChatController =
|
|
1268
|
+
ChatController = _ts_decorate10([
|
|
1202
1269
|
Controller3(),
|
|
1203
1270
|
_ts_param7(1, Inject7(AGENT_ACTOR_RESOLVER2)),
|
|
1204
|
-
|
|
1205
|
-
|
|
1271
|
+
_ts_metadata9("design:type", Function),
|
|
1272
|
+
_ts_metadata9("design:paramtypes", [
|
|
1206
1273
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1207
1274
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1208
1275
|
])
|
|
@@ -1211,17 +1278,17 @@ ChatController = _ts_decorate9([
|
|
|
1211
1278
|
// src/controller/quota.controller.ts
|
|
1212
1279
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3 } from "@dudousxd/nestjs-agent-core";
|
|
1213
1280
|
import { Controller as Controller4, Get as Get3, Inject as Inject8, Req as Req3 } from "@nestjs/common";
|
|
1214
|
-
function
|
|
1281
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1215
1282
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1216
1283
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1217
1284
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1218
1285
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1219
1286
|
}
|
|
1220
|
-
__name(
|
|
1221
|
-
function
|
|
1287
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1288
|
+
function _ts_metadata10(k, v) {
|
|
1222
1289
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1223
1290
|
}
|
|
1224
|
-
__name(
|
|
1291
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1225
1292
|
function _ts_param8(paramIndex, decorator) {
|
|
1226
1293
|
return function(target, key) {
|
|
1227
1294
|
decorator(target, key, paramIndex);
|
|
@@ -1243,20 +1310,20 @@ var QuotaController = class {
|
|
|
1243
1310
|
return this.agent.quotaToday(actor.id);
|
|
1244
1311
|
}
|
|
1245
1312
|
};
|
|
1246
|
-
|
|
1313
|
+
_ts_decorate11([
|
|
1247
1314
|
Get3("today"),
|
|
1248
1315
|
_ts_param8(0, Req3()),
|
|
1249
|
-
|
|
1250
|
-
|
|
1316
|
+
_ts_metadata10("design:type", Function),
|
|
1317
|
+
_ts_metadata10("design:paramtypes", [
|
|
1251
1318
|
typeof Request === "undefined" ? Object : Request
|
|
1252
1319
|
]),
|
|
1253
|
-
|
|
1320
|
+
_ts_metadata10("design:returntype", Promise)
|
|
1254
1321
|
], QuotaController.prototype, "today", null);
|
|
1255
|
-
QuotaController =
|
|
1322
|
+
QuotaController = _ts_decorate11([
|
|
1256
1323
|
Controller4("quota"),
|
|
1257
1324
|
_ts_param8(1, Inject8(AGENT_ACTOR_RESOLVER3)),
|
|
1258
|
-
|
|
1259
|
-
|
|
1325
|
+
_ts_metadata10("design:type", Function),
|
|
1326
|
+
_ts_metadata10("design:paramtypes", [
|
|
1260
1327
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1261
1328
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1262
1329
|
])
|
|
@@ -1265,17 +1332,17 @@ QuotaController = _ts_decorate10([
|
|
|
1265
1332
|
// src/controller/threads.controller.ts
|
|
1266
1333
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4 } from "@dudousxd/nestjs-agent-core";
|
|
1267
1334
|
import { Body as Body2, Controller as Controller5, Delete, Get as Get4, Inject as Inject9, Param as Param2, Patch, Post as Post3, Req as Req4 } from "@nestjs/common";
|
|
1268
|
-
function
|
|
1335
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1269
1336
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1270
1337
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1271
1338
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1272
1339
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1273
1340
|
}
|
|
1274
|
-
__name(
|
|
1275
|
-
function
|
|
1341
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1342
|
+
function _ts_metadata11(k, v) {
|
|
1276
1343
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1277
1344
|
}
|
|
1278
|
-
__name(
|
|
1345
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1279
1346
|
function _ts_param9(paramIndex, decorator) {
|
|
1280
1347
|
return function(target, key) {
|
|
1281
1348
|
decorator(target, key, paramIndex);
|
|
@@ -1345,92 +1412,92 @@ var ThreadsController = class {
|
|
|
1345
1412
|
};
|
|
1346
1413
|
}
|
|
1347
1414
|
};
|
|
1348
|
-
|
|
1415
|
+
_ts_decorate12([
|
|
1349
1416
|
Get4(),
|
|
1350
1417
|
_ts_param9(0, Req4()),
|
|
1351
|
-
|
|
1352
|
-
|
|
1418
|
+
_ts_metadata11("design:type", Function),
|
|
1419
|
+
_ts_metadata11("design:paramtypes", [
|
|
1353
1420
|
typeof Request === "undefined" ? Object : Request
|
|
1354
1421
|
]),
|
|
1355
|
-
|
|
1422
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1356
1423
|
], ThreadsController.prototype, "list", null);
|
|
1357
|
-
|
|
1424
|
+
_ts_decorate12([
|
|
1358
1425
|
Get4(":id"),
|
|
1359
1426
|
_ts_param9(0, Req4()),
|
|
1360
1427
|
_ts_param9(1, Param2("id")),
|
|
1361
|
-
|
|
1362
|
-
|
|
1428
|
+
_ts_metadata11("design:type", Function),
|
|
1429
|
+
_ts_metadata11("design:paramtypes", [
|
|
1363
1430
|
typeof Request === "undefined" ? Object : Request,
|
|
1364
1431
|
String
|
|
1365
1432
|
]),
|
|
1366
|
-
|
|
1433
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1367
1434
|
], ThreadsController.prototype, "detail", null);
|
|
1368
|
-
|
|
1435
|
+
_ts_decorate12([
|
|
1369
1436
|
Delete(":id"),
|
|
1370
1437
|
_ts_param9(0, Req4()),
|
|
1371
1438
|
_ts_param9(1, Param2("id")),
|
|
1372
|
-
|
|
1373
|
-
|
|
1439
|
+
_ts_metadata11("design:type", Function),
|
|
1440
|
+
_ts_metadata11("design:paramtypes", [
|
|
1374
1441
|
typeof Request === "undefined" ? Object : Request,
|
|
1375
1442
|
String
|
|
1376
1443
|
]),
|
|
1377
|
-
|
|
1444
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1378
1445
|
], ThreadsController.prototype, "remove", null);
|
|
1379
|
-
|
|
1446
|
+
_ts_decorate12([
|
|
1380
1447
|
Post3(":id/fork-from/:messageId"),
|
|
1381
1448
|
_ts_param9(0, Req4()),
|
|
1382
1449
|
_ts_param9(1, Param2("id")),
|
|
1383
1450
|
_ts_param9(2, Param2("messageId")),
|
|
1384
|
-
|
|
1385
|
-
|
|
1451
|
+
_ts_metadata11("design:type", Function),
|
|
1452
|
+
_ts_metadata11("design:paramtypes", [
|
|
1386
1453
|
typeof Request === "undefined" ? Object : Request,
|
|
1387
1454
|
String,
|
|
1388
1455
|
String
|
|
1389
1456
|
]),
|
|
1390
|
-
|
|
1457
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1391
1458
|
], ThreadsController.prototype, "fork", null);
|
|
1392
|
-
|
|
1459
|
+
_ts_decorate12([
|
|
1393
1460
|
Patch(":id"),
|
|
1394
1461
|
_ts_param9(0, Req4()),
|
|
1395
1462
|
_ts_param9(1, Param2("id")),
|
|
1396
1463
|
_ts_param9(2, Body2()),
|
|
1397
|
-
|
|
1398
|
-
|
|
1464
|
+
_ts_metadata11("design:type", Function),
|
|
1465
|
+
_ts_metadata11("design:paramtypes", [
|
|
1399
1466
|
typeof Request === "undefined" ? Object : Request,
|
|
1400
1467
|
String,
|
|
1401
1468
|
typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
|
|
1402
1469
|
]),
|
|
1403
|
-
|
|
1470
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1404
1471
|
], ThreadsController.prototype, "update", null);
|
|
1405
|
-
|
|
1472
|
+
_ts_decorate12([
|
|
1406
1473
|
Post3(":id/promote"),
|
|
1407
1474
|
_ts_param9(0, Req4()),
|
|
1408
1475
|
_ts_param9(1, Param2("id")),
|
|
1409
|
-
|
|
1410
|
-
|
|
1476
|
+
_ts_metadata11("design:type", Function),
|
|
1477
|
+
_ts_metadata11("design:paramtypes", [
|
|
1411
1478
|
typeof Request === "undefined" ? Object : Request,
|
|
1412
1479
|
String
|
|
1413
1480
|
]),
|
|
1414
|
-
|
|
1481
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1415
1482
|
], ThreadsController.prototype, "promote", null);
|
|
1416
|
-
|
|
1483
|
+
_ts_decorate12([
|
|
1417
1484
|
Delete(":id/from/:messageId"),
|
|
1418
1485
|
_ts_param9(0, Req4()),
|
|
1419
1486
|
_ts_param9(1, Param2("id")),
|
|
1420
1487
|
_ts_param9(2, Param2("messageId")),
|
|
1421
|
-
|
|
1422
|
-
|
|
1488
|
+
_ts_metadata11("design:type", Function),
|
|
1489
|
+
_ts_metadata11("design:paramtypes", [
|
|
1423
1490
|
typeof Request === "undefined" ? Object : Request,
|
|
1424
1491
|
String,
|
|
1425
1492
|
String
|
|
1426
1493
|
]),
|
|
1427
|
-
|
|
1494
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1428
1495
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
1429
|
-
ThreadsController =
|
|
1496
|
+
ThreadsController = _ts_decorate12([
|
|
1430
1497
|
Controller5("threads"),
|
|
1431
1498
|
_ts_param9(1, Inject9(AGENT_ACTOR_RESOLVER4)),
|
|
1432
|
-
|
|
1433
|
-
|
|
1499
|
+
_ts_metadata11("design:type", Function),
|
|
1500
|
+
_ts_metadata11("design:paramtypes", [
|
|
1434
1501
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1435
1502
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1436
1503
|
])
|
|
@@ -1439,17 +1506,17 @@ ThreadsController = _ts_decorate11([
|
|
|
1439
1506
|
// src/controller/tool-call.controller.ts
|
|
1440
1507
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5 } from "@dudousxd/nestjs-agent-core";
|
|
1441
1508
|
import { Body as Body3, Controller as Controller6, Inject as Inject10, Post as Post4, Req as Req5 } from "@nestjs/common";
|
|
1442
|
-
function
|
|
1509
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1443
1510
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1444
1511
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1445
1512
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1446
1513
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1447
1514
|
}
|
|
1448
|
-
__name(
|
|
1449
|
-
function
|
|
1515
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1516
|
+
function _ts_metadata12(k, v) {
|
|
1450
1517
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1451
1518
|
}
|
|
1452
|
-
__name(
|
|
1519
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1453
1520
|
function _ts_param10(paramIndex, decorator) {
|
|
1454
1521
|
return function(target, key) {
|
|
1455
1522
|
decorator(target, key, paramIndex);
|
|
@@ -1481,33 +1548,33 @@ var ToolCallController = class {
|
|
|
1481
1548
|
};
|
|
1482
1549
|
}
|
|
1483
1550
|
};
|
|
1484
|
-
|
|
1551
|
+
_ts_decorate13([
|
|
1485
1552
|
Post4("approve"),
|
|
1486
1553
|
_ts_param10(0, Req5()),
|
|
1487
1554
|
_ts_param10(1, Body3()),
|
|
1488
|
-
|
|
1489
|
-
|
|
1555
|
+
_ts_metadata12("design:type", Function),
|
|
1556
|
+
_ts_metadata12("design:paramtypes", [
|
|
1490
1557
|
typeof Request === "undefined" ? Object : Request,
|
|
1491
1558
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
1492
1559
|
]),
|
|
1493
|
-
|
|
1560
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1494
1561
|
], ToolCallController.prototype, "approve", null);
|
|
1495
|
-
|
|
1562
|
+
_ts_decorate13([
|
|
1496
1563
|
Post4("reject"),
|
|
1497
1564
|
_ts_param10(0, Req5()),
|
|
1498
1565
|
_ts_param10(1, Body3()),
|
|
1499
|
-
|
|
1500
|
-
|
|
1566
|
+
_ts_metadata12("design:type", Function),
|
|
1567
|
+
_ts_metadata12("design:paramtypes", [
|
|
1501
1568
|
typeof Request === "undefined" ? Object : Request,
|
|
1502
1569
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
1503
1570
|
]),
|
|
1504
|
-
|
|
1571
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1505
1572
|
], ToolCallController.prototype, "reject", null);
|
|
1506
|
-
ToolCallController =
|
|
1573
|
+
ToolCallController = _ts_decorate13([
|
|
1507
1574
|
Controller6("tool-call"),
|
|
1508
1575
|
_ts_param10(1, Inject10(AGENT_ACTOR_RESOLVER5)),
|
|
1509
|
-
|
|
1510
|
-
|
|
1576
|
+
_ts_metadata12("design:type", Function),
|
|
1577
|
+
_ts_metadata12("design:paramtypes", [
|
|
1511
1578
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1512
1579
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1513
1580
|
])
|
|
@@ -1515,7 +1582,7 @@ ToolCallController = _ts_decorate12([
|
|
|
1515
1582
|
|
|
1516
1583
|
// src/discovery/agent-discovery.service.ts
|
|
1517
1584
|
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
1518
|
-
import { Inject as Inject11, Injectable as
|
|
1585
|
+
import { Inject as Inject11, Injectable as Injectable7, Logger as Logger2 } from "@nestjs/common";
|
|
1519
1586
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
1520
1587
|
|
|
1521
1588
|
// src/decorator/agent.decorator.ts
|
|
@@ -1532,17 +1599,17 @@ var SYSTEM_PROMPT_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt");
|
|
|
1532
1599
|
var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
|
|
1533
1600
|
|
|
1534
1601
|
// src/discovery/agent-discovery.service.ts
|
|
1535
|
-
function
|
|
1602
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1536
1603
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1537
1604
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1538
1605
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1539
1606
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1540
1607
|
}
|
|
1541
|
-
__name(
|
|
1542
|
-
function
|
|
1608
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1609
|
+
function _ts_metadata13(k, v) {
|
|
1543
1610
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1544
1611
|
}
|
|
1545
|
-
__name(
|
|
1612
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
1546
1613
|
function _ts_param11(paramIndex, decorator) {
|
|
1547
1614
|
return function(target, key) {
|
|
1548
1615
|
decorator(target, key, paramIndex);
|
|
@@ -1645,12 +1712,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1645
1712
|
return (ctx) => candidate.call(instance, ctx);
|
|
1646
1713
|
}
|
|
1647
1714
|
};
|
|
1648
|
-
AgentDiscoveryService =
|
|
1649
|
-
|
|
1715
|
+
AgentDiscoveryService = _ts_decorate14([
|
|
1716
|
+
Injectable7(),
|
|
1650
1717
|
_ts_param11(2, Inject11(AGENT_REGISTRY3)),
|
|
1651
1718
|
_ts_param11(3, Inject11(AGENT_PROMPT_CONTRIBUTORS2)),
|
|
1652
|
-
|
|
1653
|
-
|
|
1719
|
+
_ts_metadata13("design:type", Function),
|
|
1720
|
+
_ts_metadata13("design:paramtypes", [
|
|
1654
1721
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
1655
1722
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
1656
1723
|
typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4,
|
|
@@ -1660,7 +1727,7 @@ AgentDiscoveryService = _ts_decorate13([
|
|
|
1660
1727
|
|
|
1661
1728
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1662
1729
|
import { AGENT_OPTIONS as AGENT_OPTIONS4, AGENT_REGISTRY as AGENT_REGISTRY4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2 } from "@dudousxd/nestjs-agent-core";
|
|
1663
|
-
import { Inject as Inject12, Injectable as
|
|
1730
|
+
import { Inject as Inject12, Injectable as Injectable8, Logger as Logger3 } from "@nestjs/common";
|
|
1664
1731
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
1665
1732
|
import { z } from "zod";
|
|
1666
1733
|
|
|
@@ -1680,17 +1747,17 @@ function isBrandedFunctionalTool(value) {
|
|
|
1680
1747
|
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
1681
1748
|
|
|
1682
1749
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1683
|
-
function
|
|
1750
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
1684
1751
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1685
1752
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1686
1753
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1687
1754
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1688
1755
|
}
|
|
1689
|
-
__name(
|
|
1690
|
-
function
|
|
1756
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1757
|
+
function _ts_metadata14(k, v) {
|
|
1691
1758
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1692
1759
|
}
|
|
1693
|
-
__name(
|
|
1760
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
1694
1761
|
function _ts_param12(paramIndex, decorator) {
|
|
1695
1762
|
return function(target, key) {
|
|
1696
1763
|
decorator(target, key, paramIndex);
|
|
@@ -1803,13 +1870,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1803
1870
|
return true;
|
|
1804
1871
|
}
|
|
1805
1872
|
};
|
|
1806
|
-
AiToolDiscoveryService =
|
|
1807
|
-
|
|
1873
|
+
AiToolDiscoveryService = _ts_decorate15([
|
|
1874
|
+
Injectable8(),
|
|
1808
1875
|
_ts_param12(1, Inject12(AGENT_TOOL_REGISTRY2)),
|
|
1809
1876
|
_ts_param12(2, Inject12(AGENT_REGISTRY4)),
|
|
1810
1877
|
_ts_param12(3, Inject12(AGENT_OPTIONS4)),
|
|
1811
|
-
|
|
1812
|
-
|
|
1878
|
+
_ts_metadata14("design:type", Function),
|
|
1879
|
+
_ts_metadata14("design:paramtypes", [
|
|
1813
1880
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
1814
1881
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1815
1882
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1842,18 +1909,18 @@ var LedgerQuotaStore = class {
|
|
|
1842
1909
|
|
|
1843
1910
|
// src/runner/inline-agent-runner.ts
|
|
1844
1911
|
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_STORE as AGENT_STORE4, QuotaExceededError as QuotaExceededError2, publishAgentRunFailed as publishAgentRunFailed2, runAgentLoop as runAgentLoop2 } from "@dudousxd/nestjs-agent-core";
|
|
1845
|
-
import { Inject as Inject13, Injectable as
|
|
1846
|
-
function
|
|
1912
|
+
import { Inject as Inject13, Injectable as Injectable9, Logger as Logger4 } from "@nestjs/common";
|
|
1913
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
1847
1914
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1848
1915
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1849
1916
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1850
1917
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1851
1918
|
}
|
|
1852
|
-
__name(
|
|
1853
|
-
function
|
|
1919
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
1920
|
+
function _ts_metadata15(k, v) {
|
|
1854
1921
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1855
1922
|
}
|
|
1856
|
-
__name(
|
|
1923
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
1857
1924
|
function _ts_param13(paramIndex, decorator) {
|
|
1858
1925
|
return function(target, key) {
|
|
1859
1926
|
decorator(target, key, paramIndex);
|
|
@@ -1971,25 +2038,25 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1971
2038
|
}
|
|
1972
2039
|
}
|
|
1973
2040
|
};
|
|
1974
|
-
InlineAgentRunner =
|
|
1975
|
-
|
|
2041
|
+
InlineAgentRunner = _ts_decorate16([
|
|
2042
|
+
Injectable9(),
|
|
1976
2043
|
_ts_param13(0, Inject13(AGENT_DEPS_FACTORY5)),
|
|
1977
2044
|
_ts_param13(1, Inject13(AGENT_STORE4)),
|
|
1978
|
-
|
|
1979
|
-
|
|
2045
|
+
_ts_metadata15("design:type", Function),
|
|
2046
|
+
_ts_metadata15("design:paramtypes", [
|
|
1980
2047
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1981
2048
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1982
2049
|
])
|
|
1983
2050
|
], InlineAgentRunner);
|
|
1984
2051
|
|
|
1985
2052
|
// src/agent.module.ts
|
|
1986
|
-
function
|
|
2053
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
1987
2054
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1988
2055
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1989
2056
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1990
2057
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1991
2058
|
}
|
|
1992
|
-
__name(
|
|
2059
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
1993
2060
|
var DEFAULT_PATH = "agent";
|
|
1994
2061
|
function sharedProviders(durable, includeStore) {
|
|
1995
2062
|
const providers = [
|
|
@@ -2056,7 +2123,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
2056
2123
|
AgentDiscoveryService,
|
|
2057
2124
|
AiToolDiscoveryService,
|
|
2058
2125
|
InlineAgentRunner,
|
|
2059
|
-
AgentService
|
|
2126
|
+
AgentService,
|
|
2127
|
+
// Bound ALWAYS (durable or inline) — the console's cross-thread approvals inbox routes decisions
|
|
2128
|
+
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
2129
|
+
AgentApprovalPortAdapter,
|
|
2130
|
+
{
|
|
2131
|
+
provide: AGENT_APPROVAL_PORT,
|
|
2132
|
+
useExisting: AgentApprovalPortAdapter
|
|
2133
|
+
}
|
|
2060
2134
|
];
|
|
2061
2135
|
if (includeStore) {
|
|
2062
2136
|
providers.push({
|
|
@@ -2109,7 +2183,8 @@ function exportsFor(includeStore) {
|
|
|
2109
2183
|
AGENT_DEPS_FACTORY6,
|
|
2110
2184
|
AgentDepsFactory2,
|
|
2111
2185
|
AgentService,
|
|
2112
|
-
InlineAgentRunner
|
|
2186
|
+
InlineAgentRunner,
|
|
2187
|
+
AGENT_APPROVAL_PORT
|
|
2113
2188
|
];
|
|
2114
2189
|
}
|
|
2115
2190
|
__name(exportsFor, "exportsFor");
|
|
@@ -2205,7 +2280,17 @@ var AgentModule = class _AgentModule {
|
|
|
2205
2280
|
providers: [
|
|
2206
2281
|
{
|
|
2207
2282
|
provide: AGENT_OPTIONS5,
|
|
2208
|
-
|
|
2283
|
+
// Stamp the STATIC wiring flags onto the factory result: `durable`/`dispatchedSteps` are
|
|
2284
|
+
// authoritative on the async config object (they decided the actual wiring above), and
|
|
2285
|
+
// `AgentDurableModule` derives the effective dispatched-steps value from AGENT_OPTIONS —
|
|
2286
|
+
// without this stamp, an async host would get in-process localSteps despite durable: true.
|
|
2287
|
+
useFactory: /* @__PURE__ */ __name(async (...args) => ({
|
|
2288
|
+
...await options.useFactory(...args),
|
|
2289
|
+
durable: options.durable ?? false,
|
|
2290
|
+
...options.dispatchedSteps !== void 0 ? {
|
|
2291
|
+
dispatchedSteps: options.dispatchedSteps
|
|
2292
|
+
} : {}
|
|
2293
|
+
}), "useFactory"),
|
|
2209
2294
|
inject: options.inject ?? []
|
|
2210
2295
|
},
|
|
2211
2296
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -2215,7 +2300,7 @@ var AgentModule = class _AgentModule {
|
|
|
2215
2300
|
};
|
|
2216
2301
|
}
|
|
2217
2302
|
};
|
|
2218
|
-
AgentModule =
|
|
2303
|
+
AgentModule = _ts_decorate17([
|
|
2219
2304
|
Global2(),
|
|
2220
2305
|
Module2({})
|
|
2221
2306
|
], AgentModule);
|