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