@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.cjs
CHANGED
|
@@ -441,9 +441,9 @@ AgentDurableModule = _ts_decorate4([
|
|
|
441
441
|
{
|
|
442
442
|
provide: AGENT_DISPATCHED_STEPS,
|
|
443
443
|
useFactory: /* @__PURE__ */ __name((options, sink) => {
|
|
444
|
-
const enabled = options.dispatchedSteps
|
|
444
|
+
const enabled = options.durable === true && options.dispatchedSteps !== false;
|
|
445
445
|
if (enabled && sink instanceof InProcessTokenStreamSink) {
|
|
446
|
-
logger.warn("
|
|
446
|
+
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.");
|
|
447
447
|
}
|
|
448
448
|
return enabled;
|
|
449
449
|
}, "useFactory"),
|
|
@@ -464,7 +464,7 @@ AgentDurableModule = _ts_decorate4([
|
|
|
464
464
|
|
|
465
465
|
// src/agent.module.ts
|
|
466
466
|
var import_nestjs_agent_core17 = require("@dudousxd/nestjs-agent-core");
|
|
467
|
-
var
|
|
467
|
+
var import_common17 = require("@nestjs/common");
|
|
468
468
|
var import_core3 = require("@nestjs/core");
|
|
469
469
|
|
|
470
470
|
// src/agent-deps.factory.ts
|
|
@@ -701,20 +701,32 @@ var AgentService = class {
|
|
|
701
701
|
return this.deps.forAgent().sink.subscribe(runId);
|
|
702
702
|
}
|
|
703
703
|
async approve(actor, toolCallId) {
|
|
704
|
-
|
|
705
|
-
return this.
|
|
704
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
705
|
+
return this.signalToolCall(toolCallId, {
|
|
706
706
|
approved: true
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
709
|
async reject(actor, toolCallId, reason) {
|
|
710
|
-
|
|
711
|
-
return this.
|
|
710
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
711
|
+
return this.signalToolCall(toolCallId, {
|
|
712
712
|
approved: false,
|
|
713
713
|
...reason !== void 0 ? {
|
|
714
714
|
reason
|
|
715
715
|
} : {}
|
|
716
716
|
});
|
|
717
717
|
}
|
|
718
|
+
/**
|
|
719
|
+
* The decision core behind approve/reject, WITHOUT an ownership check: resolves the run
|
|
720
|
+
* currently awaiting `toolCallId` and signals it. `approve`/`reject` above call this after their
|
|
721
|
+
* own `assertOwnsToolCall` gate; the console `AgentApprovalPort` adapter (bound by `AgentModule`)
|
|
722
|
+
* calls it directly — a console caller is already authorized by the dashboard's own guards, and
|
|
723
|
+
* re-deriving thread ownership here would reject a legitimate operator decision (an operator is
|
|
724
|
+
* not the thread's own actor).
|
|
725
|
+
*/
|
|
726
|
+
async signalToolCall(toolCallId, decision) {
|
|
727
|
+
const runId = await this.resolveRunForToolCall(toolCallId);
|
|
728
|
+
return this.runner.signal(runId, toolCallId, decision);
|
|
729
|
+
}
|
|
718
730
|
async cancel(actor, runId) {
|
|
719
731
|
await this.assertOwnsActiveStream(actor, runId);
|
|
720
732
|
return this.runner.cancel(runId);
|
|
@@ -862,12 +874,11 @@ var AgentService = class {
|
|
|
862
874
|
}
|
|
863
875
|
}
|
|
864
876
|
/**
|
|
865
|
-
* Authorization
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
* never knows or supplies a runId; it is derived here from the tool call alone.
|
|
877
|
+
* Authorization seam for HITL approve/reject: the caller must own the tool call's thread. Split
|
|
878
|
+
* out from run resolution (see {@link resolveRunForToolCall}) so the console `AgentApprovalPort`
|
|
879
|
+
* adapter can resolve+signal a decision WITHOUT this check — it is authorized upstream instead.
|
|
869
880
|
*/
|
|
870
|
-
async
|
|
881
|
+
async assertOwnsToolCall(actor, toolCallId) {
|
|
871
882
|
const owner = await this.store.ownerOfToolCall(toolCallId);
|
|
872
883
|
if (owner === null) {
|
|
873
884
|
throw new import_common6.NotFoundException(`tool call ${toolCallId} not found`);
|
|
@@ -875,6 +886,13 @@ var AgentService = class {
|
|
|
875
886
|
if (owner !== actor.id) {
|
|
876
887
|
throw new import_common6.ForbiddenException("tool call belongs to another actor");
|
|
877
888
|
}
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Resolve the run currently awaiting `toolCallId` (its thread's active stream). That run is the
|
|
892
|
+
* sub-agent's own child run when the pending call belongs to a delegated agent — the client never
|
|
893
|
+
* knows or supplies a runId; it is derived here from the tool call alone.
|
|
894
|
+
*/
|
|
895
|
+
async resolveRunForToolCall(toolCallId) {
|
|
878
896
|
const runId = await this.store.runForToolCall(toolCallId);
|
|
879
897
|
if (runId === null) {
|
|
880
898
|
throw new import_common6.NotFoundException(`tool call ${toolCallId} has no active run to signal`);
|
|
@@ -907,8 +925,7 @@ AgentService = _ts_decorate6([
|
|
|
907
925
|
])
|
|
908
926
|
], AgentService);
|
|
909
927
|
|
|
910
|
-
// src/
|
|
911
|
-
var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
|
|
928
|
+
// src/approval-port.adapter.ts
|
|
912
929
|
var import_common7 = require("@nestjs/common");
|
|
913
930
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
914
931
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -921,6 +938,56 @@ function _ts_metadata6(k, v) {
|
|
|
921
938
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
922
939
|
}
|
|
923
940
|
__name(_ts_metadata6, "_ts_metadata");
|
|
941
|
+
var AgentApprovalPortAdapter = class {
|
|
942
|
+
static {
|
|
943
|
+
__name(this, "AgentApprovalPortAdapter");
|
|
944
|
+
}
|
|
945
|
+
agent;
|
|
946
|
+
constructor(agent) {
|
|
947
|
+
this.agent = agent;
|
|
948
|
+
}
|
|
949
|
+
async approve(toolCallId, opts) {
|
|
950
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
951
|
+
approved: true,
|
|
952
|
+
...opts?.executedByRef !== void 0 ? {
|
|
953
|
+
executedByRef: opts.executedByRef
|
|
954
|
+
} : {}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
async reject(toolCallId, opts) {
|
|
958
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
959
|
+
approved: false,
|
|
960
|
+
...opts?.executedByRef !== void 0 ? {
|
|
961
|
+
executedByRef: opts.executedByRef
|
|
962
|
+
} : {},
|
|
963
|
+
...opts?.reason !== void 0 ? {
|
|
964
|
+
reason: opts.reason
|
|
965
|
+
} : {}
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
AgentApprovalPortAdapter = _ts_decorate7([
|
|
970
|
+
(0, import_common7.Injectable)(),
|
|
971
|
+
_ts_metadata6("design:type", Function),
|
|
972
|
+
_ts_metadata6("design:paramtypes", [
|
|
973
|
+
typeof AgentService === "undefined" ? Object : AgentService
|
|
974
|
+
])
|
|
975
|
+
], AgentApprovalPortAdapter);
|
|
976
|
+
|
|
977
|
+
// src/controller/agents.controller.ts
|
|
978
|
+
var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
|
|
979
|
+
var import_common8 = require("@nestjs/common");
|
|
980
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
981
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
982
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
983
|
+
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;
|
|
984
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
985
|
+
}
|
|
986
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
987
|
+
function _ts_metadata7(k, v) {
|
|
988
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
989
|
+
}
|
|
990
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
924
991
|
function _ts_param5(paramIndex, decorator) {
|
|
925
992
|
return function(target, key) {
|
|
926
993
|
decorator(target, key, paramIndex);
|
|
@@ -948,18 +1015,18 @@ var AgentsController = class {
|
|
|
948
1015
|
}));
|
|
949
1016
|
}
|
|
950
1017
|
};
|
|
951
|
-
|
|
952
|
-
(0,
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1018
|
+
_ts_decorate8([
|
|
1019
|
+
(0, import_common8.Get)(),
|
|
1020
|
+
_ts_metadata7("design:type", Function),
|
|
1021
|
+
_ts_metadata7("design:paramtypes", []),
|
|
1022
|
+
_ts_metadata7("design:returntype", Array)
|
|
956
1023
|
], AgentsController.prototype, "list", null);
|
|
957
|
-
AgentsController =
|
|
958
|
-
(0,
|
|
959
|
-
_ts_param5(0, (0,
|
|
960
|
-
_ts_param5(1, (0,
|
|
961
|
-
|
|
962
|
-
|
|
1024
|
+
AgentsController = _ts_decorate8([
|
|
1025
|
+
(0, import_common8.Controller)("agents"),
|
|
1026
|
+
_ts_param5(0, (0, import_common8.Inject)(import_nestjs_agent_core8.AGENT_REGISTRY)),
|
|
1027
|
+
_ts_param5(1, (0, import_common8.Inject)(import_nestjs_agent_core8.AGENT_DEPS_FACTORY)),
|
|
1028
|
+
_ts_metadata7("design:type", Function),
|
|
1029
|
+
_ts_metadata7("design:paramtypes", [
|
|
963
1030
|
typeof import_nestjs_agent_core8.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core8.AgentRegistry,
|
|
964
1031
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
965
1032
|
])
|
|
@@ -967,19 +1034,19 @@ AgentsController = _ts_decorate7([
|
|
|
967
1034
|
|
|
968
1035
|
// src/controller/attachments.controller.ts
|
|
969
1036
|
var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
|
|
970
|
-
var
|
|
1037
|
+
var import_common9 = require("@nestjs/common");
|
|
971
1038
|
var import_platform_express = require("@nestjs/platform-express");
|
|
972
|
-
function
|
|
1039
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
973
1040
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
974
1041
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
975
1042
|
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;
|
|
976
1043
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
977
1044
|
}
|
|
978
|
-
__name(
|
|
979
|
-
function
|
|
1045
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1046
|
+
function _ts_metadata8(k, v) {
|
|
980
1047
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
981
1048
|
}
|
|
982
|
-
__name(
|
|
1049
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
983
1050
|
function _ts_param6(paramIndex, decorator) {
|
|
984
1051
|
return function(target, key) {
|
|
985
1052
|
decorator(target, key, paramIndex);
|
|
@@ -1021,18 +1088,18 @@ var AttachmentsController = class {
|
|
|
1021
1088
|
}
|
|
1022
1089
|
async upload(req, file) {
|
|
1023
1090
|
if (this.staging === void 0) {
|
|
1024
|
-
throw new
|
|
1091
|
+
throw new import_common9.NotImplementedException("Attachment upload is not configured on this server.");
|
|
1025
1092
|
}
|
|
1026
1093
|
if (file === void 0) {
|
|
1027
|
-
throw new
|
|
1094
|
+
throw new import_common9.BadRequestException('multipart field "file" is required');
|
|
1028
1095
|
}
|
|
1029
1096
|
const allowedContentTypes = this.options.attachments?.allowedContentTypes ?? DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES;
|
|
1030
1097
|
if (!allowedContentTypes.includes(file.mimetype)) {
|
|
1031
|
-
throw new
|
|
1098
|
+
throw new import_common9.UnsupportedMediaTypeException(`content type "${file.mimetype}" is not allowed (allowed: ${allowedContentTypes.join(", ")})`);
|
|
1032
1099
|
}
|
|
1033
1100
|
const maxBytes = this.options.attachments?.maxBytes ?? DEFAULT_MAX_ATTACHMENT_BYTES;
|
|
1034
1101
|
if (file.size > maxBytes) {
|
|
1035
|
-
throw new
|
|
1102
|
+
throw new import_common9.PayloadTooLargeException(`file exceeds the ${maxBytes}-byte limit`);
|
|
1036
1103
|
}
|
|
1037
1104
|
const actor = await this.actorResolver.resolve(req);
|
|
1038
1105
|
return this.staging.stage({
|
|
@@ -1044,26 +1111,26 @@ var AttachmentsController = class {
|
|
|
1044
1111
|
});
|
|
1045
1112
|
}
|
|
1046
1113
|
};
|
|
1047
|
-
|
|
1048
|
-
(0,
|
|
1049
|
-
(0,
|
|
1050
|
-
_ts_param6(0, (0,
|
|
1051
|
-
_ts_param6(1, (0,
|
|
1052
|
-
|
|
1053
|
-
|
|
1114
|
+
_ts_decorate9([
|
|
1115
|
+
(0, import_common9.Post)(),
|
|
1116
|
+
(0, import_common9.UseInterceptors)((0, import_platform_express.FileInterceptor)("file")),
|
|
1117
|
+
_ts_param6(0, (0, import_common9.Req)()),
|
|
1118
|
+
_ts_param6(1, (0, import_common9.UploadedFile)()),
|
|
1119
|
+
_ts_metadata8("design:type", Function),
|
|
1120
|
+
_ts_metadata8("design:paramtypes", [
|
|
1054
1121
|
typeof Request === "undefined" ? Object : Request,
|
|
1055
1122
|
Object
|
|
1056
1123
|
]),
|
|
1057
|
-
|
|
1124
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1058
1125
|
], AttachmentsController.prototype, "upload", null);
|
|
1059
|
-
AttachmentsController =
|
|
1060
|
-
(0,
|
|
1061
|
-
_ts_param6(0, (0,
|
|
1062
|
-
_ts_param6(1, (0,
|
|
1063
|
-
_ts_param6(2, (0,
|
|
1064
|
-
_ts_param6(2, (0,
|
|
1065
|
-
|
|
1066
|
-
|
|
1126
|
+
AttachmentsController = _ts_decorate9([
|
|
1127
|
+
(0, import_common9.Controller)("attachments"),
|
|
1128
|
+
_ts_param6(0, (0, import_common9.Inject)(import_nestjs_agent_core9.AGENT_OPTIONS)),
|
|
1129
|
+
_ts_param6(1, (0, import_common9.Inject)(import_nestjs_agent_core9.AGENT_ACTOR_RESOLVER)),
|
|
1130
|
+
_ts_param6(2, (0, import_common9.Optional)()),
|
|
1131
|
+
_ts_param6(2, (0, import_common9.Inject)(import_nestjs_agent_core9.AGENT_ATTACHMENT_STAGING)),
|
|
1132
|
+
_ts_metadata8("design:type", Function),
|
|
1133
|
+
_ts_metadata8("design:paramtypes", [
|
|
1067
1134
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
1068
1135
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
1069
1136
|
Object
|
|
@@ -1072,18 +1139,18 @@ AttachmentsController = _ts_decorate8([
|
|
|
1072
1139
|
|
|
1073
1140
|
// src/controller/chat.controller.ts
|
|
1074
1141
|
var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
|
|
1075
|
-
var
|
|
1076
|
-
function
|
|
1142
|
+
var import_common10 = require("@nestjs/common");
|
|
1143
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1077
1144
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1078
1145
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1079
1146
|
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;
|
|
1080
1147
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1081
1148
|
}
|
|
1082
|
-
__name(
|
|
1083
|
-
function
|
|
1149
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1150
|
+
function _ts_metadata9(k, v) {
|
|
1084
1151
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1085
1152
|
}
|
|
1086
|
-
__name(
|
|
1153
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1087
1154
|
function _ts_param7(paramIndex, decorator) {
|
|
1088
1155
|
return function(target, key) {
|
|
1089
1156
|
decorator(target, key, paramIndex);
|
|
@@ -1192,46 +1259,46 @@ data: ${JSON.stringify(payload)}
|
|
|
1192
1259
|
res.end();
|
|
1193
1260
|
}
|
|
1194
1261
|
};
|
|
1195
|
-
|
|
1196
|
-
(0,
|
|
1197
|
-
_ts_param7(0, (0,
|
|
1198
|
-
_ts_param7(1, (0,
|
|
1199
|
-
_ts_param7(2, (0,
|
|
1200
|
-
|
|
1201
|
-
|
|
1262
|
+
_ts_decorate10([
|
|
1263
|
+
(0, import_common10.Post)("chat"),
|
|
1264
|
+
_ts_param7(0, (0, import_common10.Req)()),
|
|
1265
|
+
_ts_param7(1, (0, import_common10.Res)()),
|
|
1266
|
+
_ts_param7(2, (0, import_common10.Body)()),
|
|
1267
|
+
_ts_metadata9("design:type", Function),
|
|
1268
|
+
_ts_metadata9("design:paramtypes", [
|
|
1202
1269
|
typeof Request === "undefined" ? Object : Request,
|
|
1203
1270
|
typeof Response === "undefined" ? Object : Response,
|
|
1204
1271
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
1205
1272
|
]),
|
|
1206
|
-
|
|
1273
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1207
1274
|
], ChatController.prototype, "chat", null);
|
|
1208
|
-
|
|
1209
|
-
(0,
|
|
1210
|
-
_ts_param7(0, (0,
|
|
1211
|
-
_ts_param7(1, (0,
|
|
1212
|
-
|
|
1213
|
-
|
|
1275
|
+
_ts_decorate10([
|
|
1276
|
+
(0, import_common10.Get)("chat/:runId/stream"),
|
|
1277
|
+
_ts_param7(0, (0, import_common10.Param)("runId")),
|
|
1278
|
+
_ts_param7(1, (0, import_common10.Res)()),
|
|
1279
|
+
_ts_metadata9("design:type", Function),
|
|
1280
|
+
_ts_metadata9("design:paramtypes", [
|
|
1214
1281
|
String,
|
|
1215
1282
|
typeof Response === "undefined" ? Object : Response
|
|
1216
1283
|
]),
|
|
1217
|
-
|
|
1284
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1218
1285
|
], ChatController.prototype, "stream", null);
|
|
1219
|
-
|
|
1220
|
-
(0,
|
|
1221
|
-
_ts_param7(0, (0,
|
|
1222
|
-
_ts_param7(1, (0,
|
|
1223
|
-
|
|
1224
|
-
|
|
1286
|
+
_ts_decorate10([
|
|
1287
|
+
(0, import_common10.Post)("chat/:runId/cancel"),
|
|
1288
|
+
_ts_param7(0, (0, import_common10.Req)()),
|
|
1289
|
+
_ts_param7(1, (0, import_common10.Param)("runId")),
|
|
1290
|
+
_ts_metadata9("design:type", Function),
|
|
1291
|
+
_ts_metadata9("design:paramtypes", [
|
|
1225
1292
|
typeof Request === "undefined" ? Object : Request,
|
|
1226
1293
|
String
|
|
1227
1294
|
]),
|
|
1228
|
-
|
|
1295
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1229
1296
|
], ChatController.prototype, "cancel", null);
|
|
1230
|
-
ChatController =
|
|
1231
|
-
(0,
|
|
1232
|
-
_ts_param7(1, (0,
|
|
1233
|
-
|
|
1234
|
-
|
|
1297
|
+
ChatController = _ts_decorate10([
|
|
1298
|
+
(0, import_common10.Controller)(),
|
|
1299
|
+
_ts_param7(1, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_ACTOR_RESOLVER)),
|
|
1300
|
+
_ts_metadata9("design:type", Function),
|
|
1301
|
+
_ts_metadata9("design:paramtypes", [
|
|
1235
1302
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1236
1303
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1237
1304
|
])
|
|
@@ -1239,18 +1306,18 @@ ChatController = _ts_decorate9([
|
|
|
1239
1306
|
|
|
1240
1307
|
// src/controller/quota.controller.ts
|
|
1241
1308
|
var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
|
|
1242
|
-
var
|
|
1243
|
-
function
|
|
1309
|
+
var import_common11 = require("@nestjs/common");
|
|
1310
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1244
1311
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1245
1312
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1246
1313
|
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;
|
|
1247
1314
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1248
1315
|
}
|
|
1249
|
-
__name(
|
|
1250
|
-
function
|
|
1316
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1317
|
+
function _ts_metadata10(k, v) {
|
|
1251
1318
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1252
1319
|
}
|
|
1253
|
-
__name(
|
|
1320
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1254
1321
|
function _ts_param8(paramIndex, decorator) {
|
|
1255
1322
|
return function(target, key) {
|
|
1256
1323
|
decorator(target, key, paramIndex);
|
|
@@ -1272,20 +1339,20 @@ var QuotaController = class {
|
|
|
1272
1339
|
return this.agent.quotaToday(actor.id);
|
|
1273
1340
|
}
|
|
1274
1341
|
};
|
|
1275
|
-
|
|
1276
|
-
(0,
|
|
1277
|
-
_ts_param8(0, (0,
|
|
1278
|
-
|
|
1279
|
-
|
|
1342
|
+
_ts_decorate11([
|
|
1343
|
+
(0, import_common11.Get)("today"),
|
|
1344
|
+
_ts_param8(0, (0, import_common11.Req)()),
|
|
1345
|
+
_ts_metadata10("design:type", Function),
|
|
1346
|
+
_ts_metadata10("design:paramtypes", [
|
|
1280
1347
|
typeof Request === "undefined" ? Object : Request
|
|
1281
1348
|
]),
|
|
1282
|
-
|
|
1349
|
+
_ts_metadata10("design:returntype", Promise)
|
|
1283
1350
|
], QuotaController.prototype, "today", null);
|
|
1284
|
-
QuotaController =
|
|
1285
|
-
(0,
|
|
1286
|
-
_ts_param8(1, (0,
|
|
1287
|
-
|
|
1288
|
-
|
|
1351
|
+
QuotaController = _ts_decorate11([
|
|
1352
|
+
(0, import_common11.Controller)("quota"),
|
|
1353
|
+
_ts_param8(1, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_ACTOR_RESOLVER)),
|
|
1354
|
+
_ts_metadata10("design:type", Function),
|
|
1355
|
+
_ts_metadata10("design:paramtypes", [
|
|
1289
1356
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1290
1357
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1291
1358
|
])
|
|
@@ -1293,18 +1360,18 @@ QuotaController = _ts_decorate10([
|
|
|
1293
1360
|
|
|
1294
1361
|
// src/controller/threads.controller.ts
|
|
1295
1362
|
var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
|
|
1296
|
-
var
|
|
1297
|
-
function
|
|
1363
|
+
var import_common12 = require("@nestjs/common");
|
|
1364
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1298
1365
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1299
1366
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1300
1367
|
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;
|
|
1301
1368
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1302
1369
|
}
|
|
1303
|
-
__name(
|
|
1304
|
-
function
|
|
1370
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1371
|
+
function _ts_metadata11(k, v) {
|
|
1305
1372
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1306
1373
|
}
|
|
1307
|
-
__name(
|
|
1374
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1308
1375
|
function _ts_param9(paramIndex, decorator) {
|
|
1309
1376
|
return function(target, key) {
|
|
1310
1377
|
decorator(target, key, paramIndex);
|
|
@@ -1374,92 +1441,92 @@ var ThreadsController = class {
|
|
|
1374
1441
|
};
|
|
1375
1442
|
}
|
|
1376
1443
|
};
|
|
1377
|
-
|
|
1378
|
-
(0,
|
|
1379
|
-
_ts_param9(0, (0,
|
|
1380
|
-
|
|
1381
|
-
|
|
1444
|
+
_ts_decorate12([
|
|
1445
|
+
(0, import_common12.Get)(),
|
|
1446
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1447
|
+
_ts_metadata11("design:type", Function),
|
|
1448
|
+
_ts_metadata11("design:paramtypes", [
|
|
1382
1449
|
typeof Request === "undefined" ? Object : Request
|
|
1383
1450
|
]),
|
|
1384
|
-
|
|
1451
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1385
1452
|
], ThreadsController.prototype, "list", null);
|
|
1386
|
-
|
|
1387
|
-
(0,
|
|
1388
|
-
_ts_param9(0, (0,
|
|
1389
|
-
_ts_param9(1, (0,
|
|
1390
|
-
|
|
1391
|
-
|
|
1453
|
+
_ts_decorate12([
|
|
1454
|
+
(0, import_common12.Get)(":id"),
|
|
1455
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1456
|
+
_ts_param9(1, (0, import_common12.Param)("id")),
|
|
1457
|
+
_ts_metadata11("design:type", Function),
|
|
1458
|
+
_ts_metadata11("design:paramtypes", [
|
|
1392
1459
|
typeof Request === "undefined" ? Object : Request,
|
|
1393
1460
|
String
|
|
1394
1461
|
]),
|
|
1395
|
-
|
|
1462
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1396
1463
|
], ThreadsController.prototype, "detail", null);
|
|
1397
|
-
|
|
1398
|
-
(0,
|
|
1399
|
-
_ts_param9(0, (0,
|
|
1400
|
-
_ts_param9(1, (0,
|
|
1401
|
-
|
|
1402
|
-
|
|
1464
|
+
_ts_decorate12([
|
|
1465
|
+
(0, import_common12.Delete)(":id"),
|
|
1466
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1467
|
+
_ts_param9(1, (0, import_common12.Param)("id")),
|
|
1468
|
+
_ts_metadata11("design:type", Function),
|
|
1469
|
+
_ts_metadata11("design:paramtypes", [
|
|
1403
1470
|
typeof Request === "undefined" ? Object : Request,
|
|
1404
1471
|
String
|
|
1405
1472
|
]),
|
|
1406
|
-
|
|
1473
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1407
1474
|
], ThreadsController.prototype, "remove", null);
|
|
1408
|
-
|
|
1409
|
-
(0,
|
|
1410
|
-
_ts_param9(0, (0,
|
|
1411
|
-
_ts_param9(1, (0,
|
|
1412
|
-
_ts_param9(2, (0,
|
|
1413
|
-
|
|
1414
|
-
|
|
1475
|
+
_ts_decorate12([
|
|
1476
|
+
(0, import_common12.Post)(":id/fork-from/:messageId"),
|
|
1477
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1478
|
+
_ts_param9(1, (0, import_common12.Param)("id")),
|
|
1479
|
+
_ts_param9(2, (0, import_common12.Param)("messageId")),
|
|
1480
|
+
_ts_metadata11("design:type", Function),
|
|
1481
|
+
_ts_metadata11("design:paramtypes", [
|
|
1415
1482
|
typeof Request === "undefined" ? Object : Request,
|
|
1416
1483
|
String,
|
|
1417
1484
|
String
|
|
1418
1485
|
]),
|
|
1419
|
-
|
|
1486
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1420
1487
|
], ThreadsController.prototype, "fork", null);
|
|
1421
|
-
|
|
1422
|
-
(0,
|
|
1423
|
-
_ts_param9(0, (0,
|
|
1424
|
-
_ts_param9(1, (0,
|
|
1425
|
-
_ts_param9(2, (0,
|
|
1426
|
-
|
|
1427
|
-
|
|
1488
|
+
_ts_decorate12([
|
|
1489
|
+
(0, import_common12.Patch)(":id"),
|
|
1490
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1491
|
+
_ts_param9(1, (0, import_common12.Param)("id")),
|
|
1492
|
+
_ts_param9(2, (0, import_common12.Body)()),
|
|
1493
|
+
_ts_metadata11("design:type", Function),
|
|
1494
|
+
_ts_metadata11("design:paramtypes", [
|
|
1428
1495
|
typeof Request === "undefined" ? Object : Request,
|
|
1429
1496
|
String,
|
|
1430
1497
|
typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
|
|
1431
1498
|
]),
|
|
1432
|
-
|
|
1499
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1433
1500
|
], ThreadsController.prototype, "update", null);
|
|
1434
|
-
|
|
1435
|
-
(0,
|
|
1436
|
-
_ts_param9(0, (0,
|
|
1437
|
-
_ts_param9(1, (0,
|
|
1438
|
-
|
|
1439
|
-
|
|
1501
|
+
_ts_decorate12([
|
|
1502
|
+
(0, import_common12.Post)(":id/promote"),
|
|
1503
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1504
|
+
_ts_param9(1, (0, import_common12.Param)("id")),
|
|
1505
|
+
_ts_metadata11("design:type", Function),
|
|
1506
|
+
_ts_metadata11("design:paramtypes", [
|
|
1440
1507
|
typeof Request === "undefined" ? Object : Request,
|
|
1441
1508
|
String
|
|
1442
1509
|
]),
|
|
1443
|
-
|
|
1510
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1444
1511
|
], ThreadsController.prototype, "promote", null);
|
|
1445
|
-
|
|
1446
|
-
(0,
|
|
1447
|
-
_ts_param9(0, (0,
|
|
1448
|
-
_ts_param9(1, (0,
|
|
1449
|
-
_ts_param9(2, (0,
|
|
1450
|
-
|
|
1451
|
-
|
|
1512
|
+
_ts_decorate12([
|
|
1513
|
+
(0, import_common12.Delete)(":id/from/:messageId"),
|
|
1514
|
+
_ts_param9(0, (0, import_common12.Req)()),
|
|
1515
|
+
_ts_param9(1, (0, import_common12.Param)("id")),
|
|
1516
|
+
_ts_param9(2, (0, import_common12.Param)("messageId")),
|
|
1517
|
+
_ts_metadata11("design:type", Function),
|
|
1518
|
+
_ts_metadata11("design:paramtypes", [
|
|
1452
1519
|
typeof Request === "undefined" ? Object : Request,
|
|
1453
1520
|
String,
|
|
1454
1521
|
String
|
|
1455
1522
|
]),
|
|
1456
|
-
|
|
1523
|
+
_ts_metadata11("design:returntype", Promise)
|
|
1457
1524
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
1458
|
-
ThreadsController =
|
|
1459
|
-
(0,
|
|
1460
|
-
_ts_param9(1, (0,
|
|
1461
|
-
|
|
1462
|
-
|
|
1525
|
+
ThreadsController = _ts_decorate12([
|
|
1526
|
+
(0, import_common12.Controller)("threads"),
|
|
1527
|
+
_ts_param9(1, (0, import_common12.Inject)(import_nestjs_agent_core12.AGENT_ACTOR_RESOLVER)),
|
|
1528
|
+
_ts_metadata11("design:type", Function),
|
|
1529
|
+
_ts_metadata11("design:paramtypes", [
|
|
1463
1530
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1464
1531
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1465
1532
|
])
|
|
@@ -1467,18 +1534,18 @@ ThreadsController = _ts_decorate11([
|
|
|
1467
1534
|
|
|
1468
1535
|
// src/controller/tool-call.controller.ts
|
|
1469
1536
|
var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
|
|
1470
|
-
var
|
|
1471
|
-
function
|
|
1537
|
+
var import_common13 = require("@nestjs/common");
|
|
1538
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1472
1539
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1473
1540
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1474
1541
|
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;
|
|
1475
1542
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1476
1543
|
}
|
|
1477
|
-
__name(
|
|
1478
|
-
function
|
|
1544
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1545
|
+
function _ts_metadata12(k, v) {
|
|
1479
1546
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1480
1547
|
}
|
|
1481
|
-
__name(
|
|
1548
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1482
1549
|
function _ts_param10(paramIndex, decorator) {
|
|
1483
1550
|
return function(target, key) {
|
|
1484
1551
|
decorator(target, key, paramIndex);
|
|
@@ -1510,33 +1577,33 @@ var ToolCallController = class {
|
|
|
1510
1577
|
};
|
|
1511
1578
|
}
|
|
1512
1579
|
};
|
|
1513
|
-
|
|
1514
|
-
(0,
|
|
1515
|
-
_ts_param10(0, (0,
|
|
1516
|
-
_ts_param10(1, (0,
|
|
1517
|
-
|
|
1518
|
-
|
|
1580
|
+
_ts_decorate13([
|
|
1581
|
+
(0, import_common13.Post)("approve"),
|
|
1582
|
+
_ts_param10(0, (0, import_common13.Req)()),
|
|
1583
|
+
_ts_param10(1, (0, import_common13.Body)()),
|
|
1584
|
+
_ts_metadata12("design:type", Function),
|
|
1585
|
+
_ts_metadata12("design:paramtypes", [
|
|
1519
1586
|
typeof Request === "undefined" ? Object : Request,
|
|
1520
1587
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
1521
1588
|
]),
|
|
1522
|
-
|
|
1589
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1523
1590
|
], ToolCallController.prototype, "approve", null);
|
|
1524
|
-
|
|
1525
|
-
(0,
|
|
1526
|
-
_ts_param10(0, (0,
|
|
1527
|
-
_ts_param10(1, (0,
|
|
1528
|
-
|
|
1529
|
-
|
|
1591
|
+
_ts_decorate13([
|
|
1592
|
+
(0, import_common13.Post)("reject"),
|
|
1593
|
+
_ts_param10(0, (0, import_common13.Req)()),
|
|
1594
|
+
_ts_param10(1, (0, import_common13.Body)()),
|
|
1595
|
+
_ts_metadata12("design:type", Function),
|
|
1596
|
+
_ts_metadata12("design:paramtypes", [
|
|
1530
1597
|
typeof Request === "undefined" ? Object : Request,
|
|
1531
1598
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
1532
1599
|
]),
|
|
1533
|
-
|
|
1600
|
+
_ts_metadata12("design:returntype", Promise)
|
|
1534
1601
|
], ToolCallController.prototype, "reject", null);
|
|
1535
|
-
ToolCallController =
|
|
1536
|
-
(0,
|
|
1537
|
-
_ts_param10(1, (0,
|
|
1538
|
-
|
|
1539
|
-
|
|
1602
|
+
ToolCallController = _ts_decorate13([
|
|
1603
|
+
(0, import_common13.Controller)("tool-call"),
|
|
1604
|
+
_ts_param10(1, (0, import_common13.Inject)(import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER)),
|
|
1605
|
+
_ts_metadata12("design:type", Function),
|
|
1606
|
+
_ts_metadata12("design:paramtypes", [
|
|
1540
1607
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1541
1608
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1542
1609
|
])
|
|
@@ -1544,7 +1611,7 @@ ToolCallController = _ts_decorate12([
|
|
|
1544
1611
|
|
|
1545
1612
|
// src/discovery/agent-discovery.service.ts
|
|
1546
1613
|
var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
|
|
1547
|
-
var
|
|
1614
|
+
var import_common14 = require("@nestjs/common");
|
|
1548
1615
|
var import_core = require("@nestjs/core");
|
|
1549
1616
|
|
|
1550
1617
|
// src/decorator/agent.decorator.ts
|
|
@@ -1561,17 +1628,17 @@ var SYSTEM_PROMPT_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt");
|
|
|
1561
1628
|
var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
|
|
1562
1629
|
|
|
1563
1630
|
// src/discovery/agent-discovery.service.ts
|
|
1564
|
-
function
|
|
1631
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1565
1632
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1566
1633
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1567
1634
|
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;
|
|
1568
1635
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1569
1636
|
}
|
|
1570
|
-
__name(
|
|
1571
|
-
function
|
|
1637
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1638
|
+
function _ts_metadata13(k, v) {
|
|
1572
1639
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1573
1640
|
}
|
|
1574
|
-
__name(
|
|
1641
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
1575
1642
|
function _ts_param11(paramIndex, decorator) {
|
|
1576
1643
|
return function(target, key) {
|
|
1577
1644
|
decorator(target, key, paramIndex);
|
|
@@ -1586,7 +1653,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1586
1653
|
scanner;
|
|
1587
1654
|
registry;
|
|
1588
1655
|
contributors;
|
|
1589
|
-
logger = new
|
|
1656
|
+
logger = new import_common14.Logger(_AgentDiscoveryService.name);
|
|
1590
1657
|
constructor(discovery, scanner, registry, contributors) {
|
|
1591
1658
|
this.discovery = discovery;
|
|
1592
1659
|
this.scanner = scanner;
|
|
@@ -1674,12 +1741,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1674
1741
|
return (ctx) => candidate.call(instance, ctx);
|
|
1675
1742
|
}
|
|
1676
1743
|
};
|
|
1677
|
-
AgentDiscoveryService =
|
|
1678
|
-
(0,
|
|
1679
|
-
_ts_param11(2, (0,
|
|
1680
|
-
_ts_param11(3, (0,
|
|
1681
|
-
|
|
1682
|
-
|
|
1744
|
+
AgentDiscoveryService = _ts_decorate14([
|
|
1745
|
+
(0, import_common14.Injectable)(),
|
|
1746
|
+
_ts_param11(2, (0, import_common14.Inject)(import_nestjs_agent_core14.AGENT_REGISTRY)),
|
|
1747
|
+
_ts_param11(3, (0, import_common14.Inject)(import_nestjs_agent_core14.AGENT_PROMPT_CONTRIBUTORS)),
|
|
1748
|
+
_ts_metadata13("design:type", Function),
|
|
1749
|
+
_ts_metadata13("design:paramtypes", [
|
|
1683
1750
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
1684
1751
|
typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
|
|
1685
1752
|
typeof import_nestjs_agent_core14.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core14.AgentRegistry,
|
|
@@ -1689,7 +1756,7 @@ AgentDiscoveryService = _ts_decorate13([
|
|
|
1689
1756
|
|
|
1690
1757
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1691
1758
|
var import_nestjs_agent_core15 = require("@dudousxd/nestjs-agent-core");
|
|
1692
|
-
var
|
|
1759
|
+
var import_common15 = require("@nestjs/common");
|
|
1693
1760
|
var import_core2 = require("@nestjs/core");
|
|
1694
1761
|
var import_zod = require("zod");
|
|
1695
1762
|
|
|
@@ -1709,17 +1776,17 @@ function isBrandedFunctionalTool(value) {
|
|
|
1709
1776
|
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
1710
1777
|
|
|
1711
1778
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1712
|
-
function
|
|
1779
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
1713
1780
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1714
1781
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1715
1782
|
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;
|
|
1716
1783
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1717
1784
|
}
|
|
1718
|
-
__name(
|
|
1719
|
-
function
|
|
1785
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1786
|
+
function _ts_metadata14(k, v) {
|
|
1720
1787
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1721
1788
|
}
|
|
1722
|
-
__name(
|
|
1789
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
1723
1790
|
function _ts_param12(paramIndex, decorator) {
|
|
1724
1791
|
return function(target, key) {
|
|
1725
1792
|
decorator(target, key, paramIndex);
|
|
@@ -1734,7 +1801,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1734
1801
|
registry;
|
|
1735
1802
|
agents;
|
|
1736
1803
|
options;
|
|
1737
|
-
logger = new
|
|
1804
|
+
logger = new import_common15.Logger(_AiToolDiscoveryService.name);
|
|
1738
1805
|
constructor(discovery, registry, agents, options) {
|
|
1739
1806
|
this.discovery = discovery;
|
|
1740
1807
|
this.registry = registry;
|
|
@@ -1832,13 +1899,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1832
1899
|
return true;
|
|
1833
1900
|
}
|
|
1834
1901
|
};
|
|
1835
|
-
AiToolDiscoveryService =
|
|
1836
|
-
(0,
|
|
1837
|
-
_ts_param12(1, (0,
|
|
1838
|
-
_ts_param12(2, (0,
|
|
1839
|
-
_ts_param12(3, (0,
|
|
1840
|
-
|
|
1841
|
-
|
|
1902
|
+
AiToolDiscoveryService = _ts_decorate15([
|
|
1903
|
+
(0, import_common15.Injectable)(),
|
|
1904
|
+
_ts_param12(1, (0, import_common15.Inject)(import_nestjs_agent_core15.AGENT_TOOL_REGISTRY)),
|
|
1905
|
+
_ts_param12(2, (0, import_common15.Inject)(import_nestjs_agent_core15.AGENT_REGISTRY)),
|
|
1906
|
+
_ts_param12(3, (0, import_common15.Inject)(import_nestjs_agent_core15.AGENT_OPTIONS)),
|
|
1907
|
+
_ts_metadata14("design:type", Function),
|
|
1908
|
+
_ts_metadata14("design:paramtypes", [
|
|
1842
1909
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
1843
1910
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1844
1911
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1871,18 +1938,18 @@ var LedgerQuotaStore = class {
|
|
|
1871
1938
|
|
|
1872
1939
|
// src/runner/inline-agent-runner.ts
|
|
1873
1940
|
var import_nestjs_agent_core16 = require("@dudousxd/nestjs-agent-core");
|
|
1874
|
-
var
|
|
1875
|
-
function
|
|
1941
|
+
var import_common16 = require("@nestjs/common");
|
|
1942
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
1876
1943
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1877
1944
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1878
1945
|
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;
|
|
1879
1946
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1880
1947
|
}
|
|
1881
|
-
__name(
|
|
1882
|
-
function
|
|
1948
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
1949
|
+
function _ts_metadata15(k, v) {
|
|
1883
1950
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1884
1951
|
}
|
|
1885
|
-
__name(
|
|
1952
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
1886
1953
|
function _ts_param13(paramIndex, decorator) {
|
|
1887
1954
|
return function(target, key) {
|
|
1888
1955
|
decorator(target, key, paramIndex);
|
|
@@ -1895,7 +1962,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1895
1962
|
}
|
|
1896
1963
|
factory;
|
|
1897
1964
|
store;
|
|
1898
|
-
logger = new
|
|
1965
|
+
logger = new import_common16.Logger(_InlineAgentRunner.name);
|
|
1899
1966
|
pending = /* @__PURE__ */ new Map();
|
|
1900
1967
|
constructor(factory, store) {
|
|
1901
1968
|
this.factory = factory;
|
|
@@ -2000,25 +2067,25 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
2000
2067
|
}
|
|
2001
2068
|
}
|
|
2002
2069
|
};
|
|
2003
|
-
InlineAgentRunner =
|
|
2004
|
-
(0,
|
|
2005
|
-
_ts_param13(0, (0,
|
|
2006
|
-
_ts_param13(1, (0,
|
|
2007
|
-
|
|
2008
|
-
|
|
2070
|
+
InlineAgentRunner = _ts_decorate16([
|
|
2071
|
+
(0, import_common16.Injectable)(),
|
|
2072
|
+
_ts_param13(0, (0, import_common16.Inject)(import_nestjs_agent_core16.AGENT_DEPS_FACTORY)),
|
|
2073
|
+
_ts_param13(1, (0, import_common16.Inject)(import_nestjs_agent_core16.AGENT_STORE)),
|
|
2074
|
+
_ts_metadata15("design:type", Function),
|
|
2075
|
+
_ts_metadata15("design:paramtypes", [
|
|
2009
2076
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
2010
2077
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
2011
2078
|
])
|
|
2012
2079
|
], InlineAgentRunner);
|
|
2013
2080
|
|
|
2014
2081
|
// src/agent.module.ts
|
|
2015
|
-
function
|
|
2082
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
2016
2083
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2017
2084
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2018
2085
|
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;
|
|
2019
2086
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2020
2087
|
}
|
|
2021
|
-
__name(
|
|
2088
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
2022
2089
|
var DEFAULT_PATH = "agent";
|
|
2023
2090
|
function sharedProviders(durable, includeStore) {
|
|
2024
2091
|
const providers = [
|
|
@@ -2085,7 +2152,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
2085
2152
|
AgentDiscoveryService,
|
|
2086
2153
|
AiToolDiscoveryService,
|
|
2087
2154
|
InlineAgentRunner,
|
|
2088
|
-
AgentService
|
|
2155
|
+
AgentService,
|
|
2156
|
+
// Bound ALWAYS (durable or inline) — the console's cross-thread approvals inbox routes decisions
|
|
2157
|
+
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
2158
|
+
AgentApprovalPortAdapter,
|
|
2159
|
+
{
|
|
2160
|
+
provide: import_nestjs_agent_core17.AGENT_APPROVAL_PORT,
|
|
2161
|
+
useExisting: AgentApprovalPortAdapter
|
|
2162
|
+
}
|
|
2089
2163
|
];
|
|
2090
2164
|
if (includeStore) {
|
|
2091
2165
|
providers.push({
|
|
@@ -2138,7 +2212,8 @@ function exportsFor(includeStore) {
|
|
|
2138
2212
|
import_nestjs_agent_core17.AGENT_DEPS_FACTORY,
|
|
2139
2213
|
AgentDepsFactory2,
|
|
2140
2214
|
AgentService,
|
|
2141
|
-
InlineAgentRunner
|
|
2215
|
+
InlineAgentRunner,
|
|
2216
|
+
import_nestjs_agent_core17.AGENT_APPROVAL_PORT
|
|
2142
2217
|
];
|
|
2143
2218
|
}
|
|
2144
2219
|
__name(exportsFor, "exportsFor");
|
|
@@ -2234,7 +2309,17 @@ var AgentModule = class _AgentModule {
|
|
|
2234
2309
|
providers: [
|
|
2235
2310
|
{
|
|
2236
2311
|
provide: import_nestjs_agent_core17.AGENT_OPTIONS,
|
|
2237
|
-
|
|
2312
|
+
// Stamp the STATIC wiring flags onto the factory result: `durable`/`dispatchedSteps` are
|
|
2313
|
+
// authoritative on the async config object (they decided the actual wiring above), and
|
|
2314
|
+
// `AgentDurableModule` derives the effective dispatched-steps value from AGENT_OPTIONS —
|
|
2315
|
+
// without this stamp, an async host would get in-process localSteps despite durable: true.
|
|
2316
|
+
useFactory: /* @__PURE__ */ __name(async (...args) => ({
|
|
2317
|
+
...await options.useFactory(...args),
|
|
2318
|
+
durable: options.durable ?? false,
|
|
2319
|
+
...options.dispatchedSteps !== void 0 ? {
|
|
2320
|
+
dispatchedSteps: options.dispatchedSteps
|
|
2321
|
+
} : {}
|
|
2322
|
+
}), "useFactory"),
|
|
2238
2323
|
inject: options.inject ?? []
|
|
2239
2324
|
},
|
|
2240
2325
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -2244,9 +2329,9 @@ var AgentModule = class _AgentModule {
|
|
|
2244
2329
|
};
|
|
2245
2330
|
}
|
|
2246
2331
|
};
|
|
2247
|
-
AgentModule =
|
|
2248
|
-
(0,
|
|
2249
|
-
(0,
|
|
2332
|
+
AgentModule = _ts_decorate17([
|
|
2333
|
+
(0, import_common17.Global)(),
|
|
2334
|
+
(0, import_common17.Module)({})
|
|
2250
2335
|
], AgentModule);
|
|
2251
2336
|
|
|
2252
2337
|
// src/durable/agent-durable.ts
|