@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/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
AGENT_TOOL_BRAND: () => AGENT_TOOL_BRAND,
|
|
27
27
|
AI_TOOL_METADATA: () => AI_TOOL_METADATA,
|
|
28
28
|
Agent: () => Agent,
|
|
29
|
+
AgentApprovalPortAdapter: () => AgentApprovalPortAdapter,
|
|
29
30
|
AgentDepsFactory: () => AgentDepsFactory2,
|
|
30
31
|
AgentDiscoveryService: () => AgentDiscoveryService,
|
|
31
32
|
AgentModule: () => AgentModule,
|
|
@@ -53,7 +54,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
53
54
|
|
|
54
55
|
// src/agent.module.ts
|
|
55
56
|
var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
|
|
56
|
-
var
|
|
57
|
+
var import_common13 = require("@nestjs/common");
|
|
57
58
|
var import_core3 = require("@nestjs/core");
|
|
58
59
|
|
|
59
60
|
// src/agent-deps.factory.ts
|
|
@@ -308,20 +309,32 @@ var AgentService = class {
|
|
|
308
309
|
return this.deps.forAgent().sink.subscribe(runId);
|
|
309
310
|
}
|
|
310
311
|
async approve(actor, toolCallId) {
|
|
311
|
-
|
|
312
|
-
return this.
|
|
312
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
313
|
+
return this.signalToolCall(toolCallId, {
|
|
313
314
|
approved: true
|
|
314
315
|
});
|
|
315
316
|
}
|
|
316
317
|
async reject(actor, toolCallId, reason) {
|
|
317
|
-
|
|
318
|
-
return this.
|
|
318
|
+
await this.assertOwnsToolCall(actor, toolCallId);
|
|
319
|
+
return this.signalToolCall(toolCallId, {
|
|
319
320
|
approved: false,
|
|
320
321
|
...reason !== void 0 ? {
|
|
321
322
|
reason
|
|
322
323
|
} : {}
|
|
323
324
|
});
|
|
324
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* The decision core behind approve/reject, WITHOUT an ownership check: resolves the run
|
|
328
|
+
* currently awaiting `toolCallId` and signals it. `approve`/`reject` above call this after their
|
|
329
|
+
* own `assertOwnsToolCall` gate; the console `AgentApprovalPort` adapter (bound by `AgentModule`)
|
|
330
|
+
* calls it directly — a console caller is already authorized by the dashboard's own guards, and
|
|
331
|
+
* re-deriving thread ownership here would reject a legitimate operator decision (an operator is
|
|
332
|
+
* not the thread's own actor).
|
|
333
|
+
*/
|
|
334
|
+
async signalToolCall(toolCallId, decision) {
|
|
335
|
+
const runId = await this.resolveRunForToolCall(toolCallId);
|
|
336
|
+
return this.runner.signal(runId, toolCallId, decision);
|
|
337
|
+
}
|
|
325
338
|
async cancel(actor, runId) {
|
|
326
339
|
await this.assertOwnsActiveStream(actor, runId);
|
|
327
340
|
return this.runner.cancel(runId);
|
|
@@ -469,12 +482,11 @@ var AgentService = class {
|
|
|
469
482
|
}
|
|
470
483
|
}
|
|
471
484
|
/**
|
|
472
|
-
* Authorization
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* never knows or supplies a runId; it is derived here from the tool call alone.
|
|
485
|
+
* Authorization seam for HITL approve/reject: the caller must own the tool call's thread. Split
|
|
486
|
+
* out from run resolution (see {@link resolveRunForToolCall}) so the console `AgentApprovalPort`
|
|
487
|
+
* adapter can resolve+signal a decision WITHOUT this check — it is authorized upstream instead.
|
|
476
488
|
*/
|
|
477
|
-
async
|
|
489
|
+
async assertOwnsToolCall(actor, toolCallId) {
|
|
478
490
|
const owner = await this.store.ownerOfToolCall(toolCallId);
|
|
479
491
|
if (owner === null) {
|
|
480
492
|
throw new import_common2.NotFoundException(`tool call ${toolCallId} not found`);
|
|
@@ -482,6 +494,13 @@ var AgentService = class {
|
|
|
482
494
|
if (owner !== actor.id) {
|
|
483
495
|
throw new import_common2.ForbiddenException("tool call belongs to another actor");
|
|
484
496
|
}
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Resolve the run currently awaiting `toolCallId` (its thread's active stream). That run is the
|
|
500
|
+
* sub-agent's own child run when the pending call belongs to a delegated agent — the client never
|
|
501
|
+
* knows or supplies a runId; it is derived here from the tool call alone.
|
|
502
|
+
*/
|
|
503
|
+
async resolveRunForToolCall(toolCallId) {
|
|
485
504
|
const runId = await this.store.runForToolCall(toolCallId);
|
|
486
505
|
if (runId === null) {
|
|
487
506
|
throw new import_common2.NotFoundException(`tool call ${toolCallId} has no active run to signal`);
|
|
@@ -514,8 +533,7 @@ AgentService = _ts_decorate2([
|
|
|
514
533
|
])
|
|
515
534
|
], AgentService);
|
|
516
535
|
|
|
517
|
-
// src/
|
|
518
|
-
var import_nestjs_agent_core4 = require("@dudousxd/nestjs-agent-core");
|
|
536
|
+
// src/approval-port.adapter.ts
|
|
519
537
|
var import_common3 = require("@nestjs/common");
|
|
520
538
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
521
539
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -528,6 +546,56 @@ function _ts_metadata3(k, v) {
|
|
|
528
546
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
529
547
|
}
|
|
530
548
|
__name(_ts_metadata3, "_ts_metadata");
|
|
549
|
+
var AgentApprovalPortAdapter = class {
|
|
550
|
+
static {
|
|
551
|
+
__name(this, "AgentApprovalPortAdapter");
|
|
552
|
+
}
|
|
553
|
+
agent;
|
|
554
|
+
constructor(agent) {
|
|
555
|
+
this.agent = agent;
|
|
556
|
+
}
|
|
557
|
+
async approve(toolCallId, opts) {
|
|
558
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
559
|
+
approved: true,
|
|
560
|
+
...opts?.executedByRef !== void 0 ? {
|
|
561
|
+
executedByRef: opts.executedByRef
|
|
562
|
+
} : {}
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
async reject(toolCallId, opts) {
|
|
566
|
+
await this.agent.signalToolCall(toolCallId, {
|
|
567
|
+
approved: false,
|
|
568
|
+
...opts?.executedByRef !== void 0 ? {
|
|
569
|
+
executedByRef: opts.executedByRef
|
|
570
|
+
} : {},
|
|
571
|
+
...opts?.reason !== void 0 ? {
|
|
572
|
+
reason: opts.reason
|
|
573
|
+
} : {}
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
AgentApprovalPortAdapter = _ts_decorate3([
|
|
578
|
+
(0, import_common3.Injectable)(),
|
|
579
|
+
_ts_metadata3("design:type", Function),
|
|
580
|
+
_ts_metadata3("design:paramtypes", [
|
|
581
|
+
typeof AgentService === "undefined" ? Object : AgentService
|
|
582
|
+
])
|
|
583
|
+
], AgentApprovalPortAdapter);
|
|
584
|
+
|
|
585
|
+
// src/controller/agents.controller.ts
|
|
586
|
+
var import_nestjs_agent_core4 = require("@dudousxd/nestjs-agent-core");
|
|
587
|
+
var import_common4 = require("@nestjs/common");
|
|
588
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
589
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
590
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
591
|
+
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;
|
|
592
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
593
|
+
}
|
|
594
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
595
|
+
function _ts_metadata4(k, v) {
|
|
596
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
597
|
+
}
|
|
598
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
531
599
|
function _ts_param3(paramIndex, decorator) {
|
|
532
600
|
return function(target, key) {
|
|
533
601
|
decorator(target, key, paramIndex);
|
|
@@ -555,18 +623,18 @@ var AgentsController = class {
|
|
|
555
623
|
}));
|
|
556
624
|
}
|
|
557
625
|
};
|
|
558
|
-
|
|
559
|
-
(0,
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
626
|
+
_ts_decorate4([
|
|
627
|
+
(0, import_common4.Get)(),
|
|
628
|
+
_ts_metadata4("design:type", Function),
|
|
629
|
+
_ts_metadata4("design:paramtypes", []),
|
|
630
|
+
_ts_metadata4("design:returntype", Array)
|
|
563
631
|
], AgentsController.prototype, "list", null);
|
|
564
|
-
AgentsController =
|
|
565
|
-
(0,
|
|
566
|
-
_ts_param3(0, (0,
|
|
567
|
-
_ts_param3(1, (0,
|
|
568
|
-
|
|
569
|
-
|
|
632
|
+
AgentsController = _ts_decorate4([
|
|
633
|
+
(0, import_common4.Controller)("agents"),
|
|
634
|
+
_ts_param3(0, (0, import_common4.Inject)(import_nestjs_agent_core4.AGENT_REGISTRY)),
|
|
635
|
+
_ts_param3(1, (0, import_common4.Inject)(import_nestjs_agent_core4.AGENT_DEPS_FACTORY)),
|
|
636
|
+
_ts_metadata4("design:type", Function),
|
|
637
|
+
_ts_metadata4("design:paramtypes", [
|
|
570
638
|
typeof import_nestjs_agent_core4.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core4.AgentRegistry,
|
|
571
639
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
572
640
|
])
|
|
@@ -574,19 +642,19 @@ AgentsController = _ts_decorate3([
|
|
|
574
642
|
|
|
575
643
|
// src/controller/attachments.controller.ts
|
|
576
644
|
var import_nestjs_agent_core5 = require("@dudousxd/nestjs-agent-core");
|
|
577
|
-
var
|
|
645
|
+
var import_common5 = require("@nestjs/common");
|
|
578
646
|
var import_platform_express = require("@nestjs/platform-express");
|
|
579
|
-
function
|
|
647
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
580
648
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
581
649
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
582
650
|
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;
|
|
583
651
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
584
652
|
}
|
|
585
|
-
__name(
|
|
586
|
-
function
|
|
653
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
654
|
+
function _ts_metadata5(k, v) {
|
|
587
655
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
588
656
|
}
|
|
589
|
-
__name(
|
|
657
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
590
658
|
function _ts_param4(paramIndex, decorator) {
|
|
591
659
|
return function(target, key) {
|
|
592
660
|
decorator(target, key, paramIndex);
|
|
@@ -628,18 +696,18 @@ var AttachmentsController = class {
|
|
|
628
696
|
}
|
|
629
697
|
async upload(req, file) {
|
|
630
698
|
if (this.staging === void 0) {
|
|
631
|
-
throw new
|
|
699
|
+
throw new import_common5.NotImplementedException("Attachment upload is not configured on this server.");
|
|
632
700
|
}
|
|
633
701
|
if (file === void 0) {
|
|
634
|
-
throw new
|
|
702
|
+
throw new import_common5.BadRequestException('multipart field "file" is required');
|
|
635
703
|
}
|
|
636
704
|
const allowedContentTypes = this.options.attachments?.allowedContentTypes ?? DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES;
|
|
637
705
|
if (!allowedContentTypes.includes(file.mimetype)) {
|
|
638
|
-
throw new
|
|
706
|
+
throw new import_common5.UnsupportedMediaTypeException(`content type "${file.mimetype}" is not allowed (allowed: ${allowedContentTypes.join(", ")})`);
|
|
639
707
|
}
|
|
640
708
|
const maxBytes = this.options.attachments?.maxBytes ?? DEFAULT_MAX_ATTACHMENT_BYTES;
|
|
641
709
|
if (file.size > maxBytes) {
|
|
642
|
-
throw new
|
|
710
|
+
throw new import_common5.PayloadTooLargeException(`file exceeds the ${maxBytes}-byte limit`);
|
|
643
711
|
}
|
|
644
712
|
const actor = await this.actorResolver.resolve(req);
|
|
645
713
|
return this.staging.stage({
|
|
@@ -651,26 +719,26 @@ var AttachmentsController = class {
|
|
|
651
719
|
});
|
|
652
720
|
}
|
|
653
721
|
};
|
|
654
|
-
|
|
655
|
-
(0,
|
|
656
|
-
(0,
|
|
657
|
-
_ts_param4(0, (0,
|
|
658
|
-
_ts_param4(1, (0,
|
|
659
|
-
|
|
660
|
-
|
|
722
|
+
_ts_decorate5([
|
|
723
|
+
(0, import_common5.Post)(),
|
|
724
|
+
(0, import_common5.UseInterceptors)((0, import_platform_express.FileInterceptor)("file")),
|
|
725
|
+
_ts_param4(0, (0, import_common5.Req)()),
|
|
726
|
+
_ts_param4(1, (0, import_common5.UploadedFile)()),
|
|
727
|
+
_ts_metadata5("design:type", Function),
|
|
728
|
+
_ts_metadata5("design:paramtypes", [
|
|
661
729
|
typeof Request === "undefined" ? Object : Request,
|
|
662
730
|
Object
|
|
663
731
|
]),
|
|
664
|
-
|
|
732
|
+
_ts_metadata5("design:returntype", Promise)
|
|
665
733
|
], AttachmentsController.prototype, "upload", null);
|
|
666
|
-
AttachmentsController =
|
|
667
|
-
(0,
|
|
668
|
-
_ts_param4(0, (0,
|
|
669
|
-
_ts_param4(1, (0,
|
|
670
|
-
_ts_param4(2, (0,
|
|
671
|
-
_ts_param4(2, (0,
|
|
672
|
-
|
|
673
|
-
|
|
734
|
+
AttachmentsController = _ts_decorate5([
|
|
735
|
+
(0, import_common5.Controller)("attachments"),
|
|
736
|
+
_ts_param4(0, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_OPTIONS)),
|
|
737
|
+
_ts_param4(1, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_ACTOR_RESOLVER)),
|
|
738
|
+
_ts_param4(2, (0, import_common5.Optional)()),
|
|
739
|
+
_ts_param4(2, (0, import_common5.Inject)(import_nestjs_agent_core5.AGENT_ATTACHMENT_STAGING)),
|
|
740
|
+
_ts_metadata5("design:type", Function),
|
|
741
|
+
_ts_metadata5("design:paramtypes", [
|
|
674
742
|
typeof AgentModuleOptions === "undefined" ? Object : AgentModuleOptions,
|
|
675
743
|
typeof ActorResolver === "undefined" ? Object : ActorResolver,
|
|
676
744
|
Object
|
|
@@ -679,18 +747,18 @@ AttachmentsController = _ts_decorate4([
|
|
|
679
747
|
|
|
680
748
|
// src/controller/chat.controller.ts
|
|
681
749
|
var import_nestjs_agent_core6 = require("@dudousxd/nestjs-agent-core");
|
|
682
|
-
var
|
|
683
|
-
function
|
|
750
|
+
var import_common6 = require("@nestjs/common");
|
|
751
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
684
752
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
685
753
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
686
754
|
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;
|
|
687
755
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
688
756
|
}
|
|
689
|
-
__name(
|
|
690
|
-
function
|
|
757
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
758
|
+
function _ts_metadata6(k, v) {
|
|
691
759
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
692
760
|
}
|
|
693
|
-
__name(
|
|
761
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
694
762
|
function _ts_param5(paramIndex, decorator) {
|
|
695
763
|
return function(target, key) {
|
|
696
764
|
decorator(target, key, paramIndex);
|
|
@@ -799,46 +867,46 @@ data: ${JSON.stringify(payload)}
|
|
|
799
867
|
res.end();
|
|
800
868
|
}
|
|
801
869
|
};
|
|
802
|
-
|
|
803
|
-
(0,
|
|
804
|
-
_ts_param5(0, (0,
|
|
805
|
-
_ts_param5(1, (0,
|
|
806
|
-
_ts_param5(2, (0,
|
|
807
|
-
|
|
808
|
-
|
|
870
|
+
_ts_decorate6([
|
|
871
|
+
(0, import_common6.Post)("chat"),
|
|
872
|
+
_ts_param5(0, (0, import_common6.Req)()),
|
|
873
|
+
_ts_param5(1, (0, import_common6.Res)()),
|
|
874
|
+
_ts_param5(2, (0, import_common6.Body)()),
|
|
875
|
+
_ts_metadata6("design:type", Function),
|
|
876
|
+
_ts_metadata6("design:paramtypes", [
|
|
809
877
|
typeof Request === "undefined" ? Object : Request,
|
|
810
878
|
typeof Response === "undefined" ? Object : Response,
|
|
811
879
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
812
880
|
]),
|
|
813
|
-
|
|
881
|
+
_ts_metadata6("design:returntype", Promise)
|
|
814
882
|
], ChatController.prototype, "chat", null);
|
|
815
|
-
|
|
816
|
-
(0,
|
|
817
|
-
_ts_param5(0, (0,
|
|
818
|
-
_ts_param5(1, (0,
|
|
819
|
-
|
|
820
|
-
|
|
883
|
+
_ts_decorate6([
|
|
884
|
+
(0, import_common6.Get)("chat/:runId/stream"),
|
|
885
|
+
_ts_param5(0, (0, import_common6.Param)("runId")),
|
|
886
|
+
_ts_param5(1, (0, import_common6.Res)()),
|
|
887
|
+
_ts_metadata6("design:type", Function),
|
|
888
|
+
_ts_metadata6("design:paramtypes", [
|
|
821
889
|
String,
|
|
822
890
|
typeof Response === "undefined" ? Object : Response
|
|
823
891
|
]),
|
|
824
|
-
|
|
892
|
+
_ts_metadata6("design:returntype", Promise)
|
|
825
893
|
], ChatController.prototype, "stream", null);
|
|
826
|
-
|
|
827
|
-
(0,
|
|
828
|
-
_ts_param5(0, (0,
|
|
829
|
-
_ts_param5(1, (0,
|
|
830
|
-
|
|
831
|
-
|
|
894
|
+
_ts_decorate6([
|
|
895
|
+
(0, import_common6.Post)("chat/:runId/cancel"),
|
|
896
|
+
_ts_param5(0, (0, import_common6.Req)()),
|
|
897
|
+
_ts_param5(1, (0, import_common6.Param)("runId")),
|
|
898
|
+
_ts_metadata6("design:type", Function),
|
|
899
|
+
_ts_metadata6("design:paramtypes", [
|
|
832
900
|
typeof Request === "undefined" ? Object : Request,
|
|
833
901
|
String
|
|
834
902
|
]),
|
|
835
|
-
|
|
903
|
+
_ts_metadata6("design:returntype", Promise)
|
|
836
904
|
], ChatController.prototype, "cancel", null);
|
|
837
|
-
ChatController =
|
|
838
|
-
(0,
|
|
839
|
-
_ts_param5(1, (0,
|
|
840
|
-
|
|
841
|
-
|
|
905
|
+
ChatController = _ts_decorate6([
|
|
906
|
+
(0, import_common6.Controller)(),
|
|
907
|
+
_ts_param5(1, (0, import_common6.Inject)(import_nestjs_agent_core6.AGENT_ACTOR_RESOLVER)),
|
|
908
|
+
_ts_metadata6("design:type", Function),
|
|
909
|
+
_ts_metadata6("design:paramtypes", [
|
|
842
910
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
843
911
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
844
912
|
])
|
|
@@ -846,18 +914,18 @@ ChatController = _ts_decorate5([
|
|
|
846
914
|
|
|
847
915
|
// src/controller/quota.controller.ts
|
|
848
916
|
var import_nestjs_agent_core7 = require("@dudousxd/nestjs-agent-core");
|
|
849
|
-
var
|
|
850
|
-
function
|
|
917
|
+
var import_common7 = require("@nestjs/common");
|
|
918
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
851
919
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
852
920
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
853
921
|
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;
|
|
854
922
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
855
923
|
}
|
|
856
|
-
__name(
|
|
857
|
-
function
|
|
924
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
925
|
+
function _ts_metadata7(k, v) {
|
|
858
926
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
859
927
|
}
|
|
860
|
-
__name(
|
|
928
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
861
929
|
function _ts_param6(paramIndex, decorator) {
|
|
862
930
|
return function(target, key) {
|
|
863
931
|
decorator(target, key, paramIndex);
|
|
@@ -879,20 +947,20 @@ var QuotaController = class {
|
|
|
879
947
|
return this.agent.quotaToday(actor.id);
|
|
880
948
|
}
|
|
881
949
|
};
|
|
882
|
-
|
|
883
|
-
(0,
|
|
884
|
-
_ts_param6(0, (0,
|
|
885
|
-
|
|
886
|
-
|
|
950
|
+
_ts_decorate7([
|
|
951
|
+
(0, import_common7.Get)("today"),
|
|
952
|
+
_ts_param6(0, (0, import_common7.Req)()),
|
|
953
|
+
_ts_metadata7("design:type", Function),
|
|
954
|
+
_ts_metadata7("design:paramtypes", [
|
|
887
955
|
typeof Request === "undefined" ? Object : Request
|
|
888
956
|
]),
|
|
889
|
-
|
|
957
|
+
_ts_metadata7("design:returntype", Promise)
|
|
890
958
|
], QuotaController.prototype, "today", null);
|
|
891
|
-
QuotaController =
|
|
892
|
-
(0,
|
|
893
|
-
_ts_param6(1, (0,
|
|
894
|
-
|
|
895
|
-
|
|
959
|
+
QuotaController = _ts_decorate7([
|
|
960
|
+
(0, import_common7.Controller)("quota"),
|
|
961
|
+
_ts_param6(1, (0, import_common7.Inject)(import_nestjs_agent_core7.AGENT_ACTOR_RESOLVER)),
|
|
962
|
+
_ts_metadata7("design:type", Function),
|
|
963
|
+
_ts_metadata7("design:paramtypes", [
|
|
896
964
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
897
965
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
898
966
|
])
|
|
@@ -900,18 +968,18 @@ QuotaController = _ts_decorate6([
|
|
|
900
968
|
|
|
901
969
|
// src/controller/threads.controller.ts
|
|
902
970
|
var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
|
|
903
|
-
var
|
|
904
|
-
function
|
|
971
|
+
var import_common8 = require("@nestjs/common");
|
|
972
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
905
973
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
906
974
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
907
975
|
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;
|
|
908
976
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
909
977
|
}
|
|
910
|
-
__name(
|
|
911
|
-
function
|
|
978
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
979
|
+
function _ts_metadata8(k, v) {
|
|
912
980
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
913
981
|
}
|
|
914
|
-
__name(
|
|
982
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
915
983
|
function _ts_param7(paramIndex, decorator) {
|
|
916
984
|
return function(target, key) {
|
|
917
985
|
decorator(target, key, paramIndex);
|
|
@@ -981,92 +1049,92 @@ var ThreadsController = class {
|
|
|
981
1049
|
};
|
|
982
1050
|
}
|
|
983
1051
|
};
|
|
984
|
-
|
|
985
|
-
(0,
|
|
986
|
-
_ts_param7(0, (0,
|
|
987
|
-
|
|
988
|
-
|
|
1052
|
+
_ts_decorate8([
|
|
1053
|
+
(0, import_common8.Get)(),
|
|
1054
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1055
|
+
_ts_metadata8("design:type", Function),
|
|
1056
|
+
_ts_metadata8("design:paramtypes", [
|
|
989
1057
|
typeof Request === "undefined" ? Object : Request
|
|
990
1058
|
]),
|
|
991
|
-
|
|
1059
|
+
_ts_metadata8("design:returntype", Promise)
|
|
992
1060
|
], ThreadsController.prototype, "list", null);
|
|
993
|
-
|
|
994
|
-
(0,
|
|
995
|
-
_ts_param7(0, (0,
|
|
996
|
-
_ts_param7(1, (0,
|
|
997
|
-
|
|
998
|
-
|
|
1061
|
+
_ts_decorate8([
|
|
1062
|
+
(0, import_common8.Get)(":id"),
|
|
1063
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1064
|
+
_ts_param7(1, (0, import_common8.Param)("id")),
|
|
1065
|
+
_ts_metadata8("design:type", Function),
|
|
1066
|
+
_ts_metadata8("design:paramtypes", [
|
|
999
1067
|
typeof Request === "undefined" ? Object : Request,
|
|
1000
1068
|
String
|
|
1001
1069
|
]),
|
|
1002
|
-
|
|
1070
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1003
1071
|
], ThreadsController.prototype, "detail", null);
|
|
1004
|
-
|
|
1005
|
-
(0,
|
|
1006
|
-
_ts_param7(0, (0,
|
|
1007
|
-
_ts_param7(1, (0,
|
|
1008
|
-
|
|
1009
|
-
|
|
1072
|
+
_ts_decorate8([
|
|
1073
|
+
(0, import_common8.Delete)(":id"),
|
|
1074
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1075
|
+
_ts_param7(1, (0, import_common8.Param)("id")),
|
|
1076
|
+
_ts_metadata8("design:type", Function),
|
|
1077
|
+
_ts_metadata8("design:paramtypes", [
|
|
1010
1078
|
typeof Request === "undefined" ? Object : Request,
|
|
1011
1079
|
String
|
|
1012
1080
|
]),
|
|
1013
|
-
|
|
1081
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1014
1082
|
], ThreadsController.prototype, "remove", null);
|
|
1015
|
-
|
|
1016
|
-
(0,
|
|
1017
|
-
_ts_param7(0, (0,
|
|
1018
|
-
_ts_param7(1, (0,
|
|
1019
|
-
_ts_param7(2, (0,
|
|
1020
|
-
|
|
1021
|
-
|
|
1083
|
+
_ts_decorate8([
|
|
1084
|
+
(0, import_common8.Post)(":id/fork-from/:messageId"),
|
|
1085
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1086
|
+
_ts_param7(1, (0, import_common8.Param)("id")),
|
|
1087
|
+
_ts_param7(2, (0, import_common8.Param)("messageId")),
|
|
1088
|
+
_ts_metadata8("design:type", Function),
|
|
1089
|
+
_ts_metadata8("design:paramtypes", [
|
|
1022
1090
|
typeof Request === "undefined" ? Object : Request,
|
|
1023
1091
|
String,
|
|
1024
1092
|
String
|
|
1025
1093
|
]),
|
|
1026
|
-
|
|
1094
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1027
1095
|
], ThreadsController.prototype, "fork", null);
|
|
1028
|
-
|
|
1029
|
-
(0,
|
|
1030
|
-
_ts_param7(0, (0,
|
|
1031
|
-
_ts_param7(1, (0,
|
|
1032
|
-
_ts_param7(2, (0,
|
|
1033
|
-
|
|
1034
|
-
|
|
1096
|
+
_ts_decorate8([
|
|
1097
|
+
(0, import_common8.Patch)(":id"),
|
|
1098
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1099
|
+
_ts_param7(1, (0, import_common8.Param)("id")),
|
|
1100
|
+
_ts_param7(2, (0, import_common8.Body)()),
|
|
1101
|
+
_ts_metadata8("design:type", Function),
|
|
1102
|
+
_ts_metadata8("design:paramtypes", [
|
|
1035
1103
|
typeof Request === "undefined" ? Object : Request,
|
|
1036
1104
|
String,
|
|
1037
1105
|
typeof UpdateThreadBody === "undefined" ? Object : UpdateThreadBody
|
|
1038
1106
|
]),
|
|
1039
|
-
|
|
1107
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1040
1108
|
], ThreadsController.prototype, "update", null);
|
|
1041
|
-
|
|
1042
|
-
(0,
|
|
1043
|
-
_ts_param7(0, (0,
|
|
1044
|
-
_ts_param7(1, (0,
|
|
1045
|
-
|
|
1046
|
-
|
|
1109
|
+
_ts_decorate8([
|
|
1110
|
+
(0, import_common8.Post)(":id/promote"),
|
|
1111
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1112
|
+
_ts_param7(1, (0, import_common8.Param)("id")),
|
|
1113
|
+
_ts_metadata8("design:type", Function),
|
|
1114
|
+
_ts_metadata8("design:paramtypes", [
|
|
1047
1115
|
typeof Request === "undefined" ? Object : Request,
|
|
1048
1116
|
String
|
|
1049
1117
|
]),
|
|
1050
|
-
|
|
1118
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1051
1119
|
], ThreadsController.prototype, "promote", null);
|
|
1052
|
-
|
|
1053
|
-
(0,
|
|
1054
|
-
_ts_param7(0, (0,
|
|
1055
|
-
_ts_param7(1, (0,
|
|
1056
|
-
_ts_param7(2, (0,
|
|
1057
|
-
|
|
1058
|
-
|
|
1120
|
+
_ts_decorate8([
|
|
1121
|
+
(0, import_common8.Delete)(":id/from/:messageId"),
|
|
1122
|
+
_ts_param7(0, (0, import_common8.Req)()),
|
|
1123
|
+
_ts_param7(1, (0, import_common8.Param)("id")),
|
|
1124
|
+
_ts_param7(2, (0, import_common8.Param)("messageId")),
|
|
1125
|
+
_ts_metadata8("design:type", Function),
|
|
1126
|
+
_ts_metadata8("design:paramtypes", [
|
|
1059
1127
|
typeof Request === "undefined" ? Object : Request,
|
|
1060
1128
|
String,
|
|
1061
1129
|
String
|
|
1062
1130
|
]),
|
|
1063
|
-
|
|
1131
|
+
_ts_metadata8("design:returntype", Promise)
|
|
1064
1132
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
1065
|
-
ThreadsController =
|
|
1066
|
-
(0,
|
|
1067
|
-
_ts_param7(1, (0,
|
|
1068
|
-
|
|
1069
|
-
|
|
1133
|
+
ThreadsController = _ts_decorate8([
|
|
1134
|
+
(0, import_common8.Controller)("threads"),
|
|
1135
|
+
_ts_param7(1, (0, import_common8.Inject)(import_nestjs_agent_core8.AGENT_ACTOR_RESOLVER)),
|
|
1136
|
+
_ts_metadata8("design:type", Function),
|
|
1137
|
+
_ts_metadata8("design:paramtypes", [
|
|
1070
1138
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1071
1139
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1072
1140
|
])
|
|
@@ -1074,18 +1142,18 @@ ThreadsController = _ts_decorate7([
|
|
|
1074
1142
|
|
|
1075
1143
|
// src/controller/tool-call.controller.ts
|
|
1076
1144
|
var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
|
|
1077
|
-
var
|
|
1078
|
-
function
|
|
1145
|
+
var import_common9 = require("@nestjs/common");
|
|
1146
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1079
1147
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1080
1148
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1081
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;
|
|
1082
1150
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1083
1151
|
}
|
|
1084
|
-
__name(
|
|
1085
|
-
function
|
|
1152
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1153
|
+
function _ts_metadata9(k, v) {
|
|
1086
1154
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1087
1155
|
}
|
|
1088
|
-
__name(
|
|
1156
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1089
1157
|
function _ts_param8(paramIndex, decorator) {
|
|
1090
1158
|
return function(target, key) {
|
|
1091
1159
|
decorator(target, key, paramIndex);
|
|
@@ -1117,33 +1185,33 @@ var ToolCallController = class {
|
|
|
1117
1185
|
};
|
|
1118
1186
|
}
|
|
1119
1187
|
};
|
|
1120
|
-
|
|
1121
|
-
(0,
|
|
1122
|
-
_ts_param8(0, (0,
|
|
1123
|
-
_ts_param8(1, (0,
|
|
1124
|
-
|
|
1125
|
-
|
|
1188
|
+
_ts_decorate9([
|
|
1189
|
+
(0, import_common9.Post)("approve"),
|
|
1190
|
+
_ts_param8(0, (0, import_common9.Req)()),
|
|
1191
|
+
_ts_param8(1, (0, import_common9.Body)()),
|
|
1192
|
+
_ts_metadata9("design:type", Function),
|
|
1193
|
+
_ts_metadata9("design:paramtypes", [
|
|
1126
1194
|
typeof Request === "undefined" ? Object : Request,
|
|
1127
1195
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
1128
1196
|
]),
|
|
1129
|
-
|
|
1197
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1130
1198
|
], ToolCallController.prototype, "approve", null);
|
|
1131
|
-
|
|
1132
|
-
(0,
|
|
1133
|
-
_ts_param8(0, (0,
|
|
1134
|
-
_ts_param8(1, (0,
|
|
1135
|
-
|
|
1136
|
-
|
|
1199
|
+
_ts_decorate9([
|
|
1200
|
+
(0, import_common9.Post)("reject"),
|
|
1201
|
+
_ts_param8(0, (0, import_common9.Req)()),
|
|
1202
|
+
_ts_param8(1, (0, import_common9.Body)()),
|
|
1203
|
+
_ts_metadata9("design:type", Function),
|
|
1204
|
+
_ts_metadata9("design:paramtypes", [
|
|
1137
1205
|
typeof Request === "undefined" ? Object : Request,
|
|
1138
1206
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
1139
1207
|
]),
|
|
1140
|
-
|
|
1208
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1141
1209
|
], ToolCallController.prototype, "reject", null);
|
|
1142
|
-
ToolCallController =
|
|
1143
|
-
(0,
|
|
1144
|
-
_ts_param8(1, (0,
|
|
1145
|
-
|
|
1146
|
-
|
|
1210
|
+
ToolCallController = _ts_decorate9([
|
|
1211
|
+
(0, import_common9.Controller)("tool-call"),
|
|
1212
|
+
_ts_param8(1, (0, import_common9.Inject)(import_nestjs_agent_core9.AGENT_ACTOR_RESOLVER)),
|
|
1213
|
+
_ts_metadata9("design:type", Function),
|
|
1214
|
+
_ts_metadata9("design:paramtypes", [
|
|
1147
1215
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1148
1216
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1149
1217
|
])
|
|
@@ -1151,7 +1219,7 @@ ToolCallController = _ts_decorate8([
|
|
|
1151
1219
|
|
|
1152
1220
|
// src/discovery/agent-discovery.service.ts
|
|
1153
1221
|
var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
|
|
1154
|
-
var
|
|
1222
|
+
var import_common10 = require("@nestjs/common");
|
|
1155
1223
|
var import_core = require("@nestjs/core");
|
|
1156
1224
|
|
|
1157
1225
|
// src/decorator/agent.decorator.ts
|
|
@@ -1186,17 +1254,17 @@ function SystemPromptContributor() {
|
|
|
1186
1254
|
__name(SystemPromptContributor, "SystemPromptContributor");
|
|
1187
1255
|
|
|
1188
1256
|
// src/discovery/agent-discovery.service.ts
|
|
1189
|
-
function
|
|
1257
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1190
1258
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1191
1259
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1192
1260
|
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;
|
|
1193
1261
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1194
1262
|
}
|
|
1195
|
-
__name(
|
|
1196
|
-
function
|
|
1263
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1264
|
+
function _ts_metadata10(k, v) {
|
|
1197
1265
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1198
1266
|
}
|
|
1199
|
-
__name(
|
|
1267
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1200
1268
|
function _ts_param9(paramIndex, decorator) {
|
|
1201
1269
|
return function(target, key) {
|
|
1202
1270
|
decorator(target, key, paramIndex);
|
|
@@ -1211,7 +1279,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1211
1279
|
scanner;
|
|
1212
1280
|
registry;
|
|
1213
1281
|
contributors;
|
|
1214
|
-
logger = new
|
|
1282
|
+
logger = new import_common10.Logger(_AgentDiscoveryService.name);
|
|
1215
1283
|
constructor(discovery, scanner, registry, contributors) {
|
|
1216
1284
|
this.discovery = discovery;
|
|
1217
1285
|
this.scanner = scanner;
|
|
@@ -1299,12 +1367,12 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1299
1367
|
return (ctx) => candidate.call(instance, ctx);
|
|
1300
1368
|
}
|
|
1301
1369
|
};
|
|
1302
|
-
AgentDiscoveryService =
|
|
1303
|
-
(0,
|
|
1304
|
-
_ts_param9(2, (0,
|
|
1305
|
-
_ts_param9(3, (0,
|
|
1306
|
-
|
|
1307
|
-
|
|
1370
|
+
AgentDiscoveryService = _ts_decorate10([
|
|
1371
|
+
(0, import_common10.Injectable)(),
|
|
1372
|
+
_ts_param9(2, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_REGISTRY)),
|
|
1373
|
+
_ts_param9(3, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_PROMPT_CONTRIBUTORS)),
|
|
1374
|
+
_ts_metadata10("design:type", Function),
|
|
1375
|
+
_ts_metadata10("design:paramtypes", [
|
|
1308
1376
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
1309
1377
|
typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
|
|
1310
1378
|
typeof import_nestjs_agent_core10.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core10.AgentRegistry,
|
|
@@ -1314,7 +1382,7 @@ AgentDiscoveryService = _ts_decorate9([
|
|
|
1314
1382
|
|
|
1315
1383
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1316
1384
|
var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
|
|
1317
|
-
var
|
|
1385
|
+
var import_common11 = require("@nestjs/common");
|
|
1318
1386
|
var import_core2 = require("@nestjs/core");
|
|
1319
1387
|
var import_zod = require("zod");
|
|
1320
1388
|
|
|
@@ -1363,17 +1431,17 @@ function provideAgentTool(factoryOrTool, inject) {
|
|
|
1363
1431
|
__name(provideAgentTool, "provideAgentTool");
|
|
1364
1432
|
|
|
1365
1433
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1366
|
-
function
|
|
1434
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1367
1435
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1368
1436
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1369
1437
|
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;
|
|
1370
1438
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1371
1439
|
}
|
|
1372
|
-
__name(
|
|
1373
|
-
function
|
|
1440
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1441
|
+
function _ts_metadata11(k, v) {
|
|
1374
1442
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1375
1443
|
}
|
|
1376
|
-
__name(
|
|
1444
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1377
1445
|
function _ts_param10(paramIndex, decorator) {
|
|
1378
1446
|
return function(target, key) {
|
|
1379
1447
|
decorator(target, key, paramIndex);
|
|
@@ -1388,7 +1456,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1388
1456
|
registry;
|
|
1389
1457
|
agents;
|
|
1390
1458
|
options;
|
|
1391
|
-
logger = new
|
|
1459
|
+
logger = new import_common11.Logger(_AiToolDiscoveryService.name);
|
|
1392
1460
|
constructor(discovery, registry, agents, options) {
|
|
1393
1461
|
this.discovery = discovery;
|
|
1394
1462
|
this.registry = registry;
|
|
@@ -1486,13 +1554,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1486
1554
|
return true;
|
|
1487
1555
|
}
|
|
1488
1556
|
};
|
|
1489
|
-
AiToolDiscoveryService =
|
|
1490
|
-
(0,
|
|
1491
|
-
_ts_param10(1, (0,
|
|
1492
|
-
_ts_param10(2, (0,
|
|
1493
|
-
_ts_param10(3, (0,
|
|
1494
|
-
|
|
1495
|
-
|
|
1557
|
+
AiToolDiscoveryService = _ts_decorate11([
|
|
1558
|
+
(0, import_common11.Injectable)(),
|
|
1559
|
+
_ts_param10(1, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_TOOL_REGISTRY)),
|
|
1560
|
+
_ts_param10(2, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_REGISTRY)),
|
|
1561
|
+
_ts_param10(3, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_OPTIONS)),
|
|
1562
|
+
_ts_metadata11("design:type", Function),
|
|
1563
|
+
_ts_metadata11("design:paramtypes", [
|
|
1496
1564
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
1497
1565
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1498
1566
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1593,18 +1661,18 @@ var LedgerQuotaStore = class {
|
|
|
1593
1661
|
|
|
1594
1662
|
// src/runner/inline-agent-runner.ts
|
|
1595
1663
|
var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
|
|
1596
|
-
var
|
|
1597
|
-
function
|
|
1664
|
+
var import_common12 = require("@nestjs/common");
|
|
1665
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1598
1666
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1599
1667
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1600
1668
|
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;
|
|
1601
1669
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1602
1670
|
}
|
|
1603
|
-
__name(
|
|
1604
|
-
function
|
|
1671
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1672
|
+
function _ts_metadata12(k, v) {
|
|
1605
1673
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1606
1674
|
}
|
|
1607
|
-
__name(
|
|
1675
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1608
1676
|
function _ts_param11(paramIndex, decorator) {
|
|
1609
1677
|
return function(target, key) {
|
|
1610
1678
|
decorator(target, key, paramIndex);
|
|
@@ -1617,7 +1685,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1617
1685
|
}
|
|
1618
1686
|
factory;
|
|
1619
1687
|
store;
|
|
1620
|
-
logger = new
|
|
1688
|
+
logger = new import_common12.Logger(_InlineAgentRunner.name);
|
|
1621
1689
|
pending = /* @__PURE__ */ new Map();
|
|
1622
1690
|
constructor(factory, store) {
|
|
1623
1691
|
this.factory = factory;
|
|
@@ -1722,25 +1790,25 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1722
1790
|
}
|
|
1723
1791
|
}
|
|
1724
1792
|
};
|
|
1725
|
-
InlineAgentRunner =
|
|
1726
|
-
(0,
|
|
1727
|
-
_ts_param11(0, (0,
|
|
1728
|
-
_ts_param11(1, (0,
|
|
1729
|
-
|
|
1730
|
-
|
|
1793
|
+
InlineAgentRunner = _ts_decorate12([
|
|
1794
|
+
(0, import_common12.Injectable)(),
|
|
1795
|
+
_ts_param11(0, (0, import_common12.Inject)(import_nestjs_agent_core13.AGENT_DEPS_FACTORY)),
|
|
1796
|
+
_ts_param11(1, (0, import_common12.Inject)(import_nestjs_agent_core13.AGENT_STORE)),
|
|
1797
|
+
_ts_metadata12("design:type", Function),
|
|
1798
|
+
_ts_metadata12("design:paramtypes", [
|
|
1731
1799
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1732
1800
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1733
1801
|
])
|
|
1734
1802
|
], InlineAgentRunner);
|
|
1735
1803
|
|
|
1736
1804
|
// src/agent.module.ts
|
|
1737
|
-
function
|
|
1805
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1738
1806
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1739
1807
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1740
1808
|
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;
|
|
1741
1809
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1742
1810
|
}
|
|
1743
|
-
__name(
|
|
1811
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1744
1812
|
var DEFAULT_PATH = "agent";
|
|
1745
1813
|
function sharedProviders(durable, includeStore) {
|
|
1746
1814
|
const providers = [
|
|
@@ -1807,7 +1875,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
1807
1875
|
AgentDiscoveryService,
|
|
1808
1876
|
AiToolDiscoveryService,
|
|
1809
1877
|
InlineAgentRunner,
|
|
1810
|
-
AgentService
|
|
1878
|
+
AgentService,
|
|
1879
|
+
// Bound ALWAYS (durable or inline) — the console's cross-thread approvals inbox routes decisions
|
|
1880
|
+
// through AgentService.signalToolCall, which reaches whichever AGENT_RUNNER is bound above.
|
|
1881
|
+
AgentApprovalPortAdapter,
|
|
1882
|
+
{
|
|
1883
|
+
provide: import_nestjs_agent_core14.AGENT_APPROVAL_PORT,
|
|
1884
|
+
useExisting: AgentApprovalPortAdapter
|
|
1885
|
+
}
|
|
1811
1886
|
];
|
|
1812
1887
|
if (includeStore) {
|
|
1813
1888
|
providers.push({
|
|
@@ -1860,7 +1935,8 @@ function exportsFor(includeStore) {
|
|
|
1860
1935
|
import_nestjs_agent_core14.AGENT_DEPS_FACTORY,
|
|
1861
1936
|
AgentDepsFactory2,
|
|
1862
1937
|
AgentService,
|
|
1863
|
-
InlineAgentRunner
|
|
1938
|
+
InlineAgentRunner,
|
|
1939
|
+
import_nestjs_agent_core14.AGENT_APPROVAL_PORT
|
|
1864
1940
|
];
|
|
1865
1941
|
}
|
|
1866
1942
|
__name(exportsFor, "exportsFor");
|
|
@@ -1956,7 +2032,17 @@ var AgentModule = class _AgentModule {
|
|
|
1956
2032
|
providers: [
|
|
1957
2033
|
{
|
|
1958
2034
|
provide: import_nestjs_agent_core14.AGENT_OPTIONS,
|
|
1959
|
-
|
|
2035
|
+
// Stamp the STATIC wiring flags onto the factory result: `durable`/`dispatchedSteps` are
|
|
2036
|
+
// authoritative on the async config object (they decided the actual wiring above), and
|
|
2037
|
+
// `AgentDurableModule` derives the effective dispatched-steps value from AGENT_OPTIONS —
|
|
2038
|
+
// without this stamp, an async host would get in-process localSteps despite durable: true.
|
|
2039
|
+
useFactory: /* @__PURE__ */ __name(async (...args) => ({
|
|
2040
|
+
...await options.useFactory(...args),
|
|
2041
|
+
durable: options.durable ?? false,
|
|
2042
|
+
...options.dispatchedSteps !== void 0 ? {
|
|
2043
|
+
dispatchedSteps: options.dispatchedSteps
|
|
2044
|
+
} : {}
|
|
2045
|
+
}), "useFactory"),
|
|
1960
2046
|
inject: options.inject ?? []
|
|
1961
2047
|
},
|
|
1962
2048
|
...sharedProviders(options.durable ?? false, includeStore),
|
|
@@ -1966,9 +2052,9 @@ var AgentModule = class _AgentModule {
|
|
|
1966
2052
|
};
|
|
1967
2053
|
}
|
|
1968
2054
|
};
|
|
1969
|
-
AgentModule =
|
|
1970
|
-
(0,
|
|
1971
|
-
(0,
|
|
2055
|
+
AgentModule = _ts_decorate13([
|
|
2056
|
+
(0, import_common13.Global)(),
|
|
2057
|
+
(0, import_common13.Module)({})
|
|
1972
2058
|
], AgentModule);
|
|
1973
2059
|
|
|
1974
2060
|
// src/resolver/header-actor-resolver.ts
|
|
@@ -2009,6 +2095,7 @@ __reExport(index_exports, require("@dudousxd/nestjs-agent-core"), module.exports
|
|
|
2009
2095
|
AGENT_TOOL_BRAND,
|
|
2010
2096
|
AI_TOOL_METADATA,
|
|
2011
2097
|
Agent,
|
|
2098
|
+
AgentApprovalPortAdapter,
|
|
2012
2099
|
AgentDepsFactory,
|
|
2013
2100
|
AgentDiscoveryService,
|
|
2014
2101
|
AgentModule,
|