@dudousxd/nestjs-agent 0.3.1 → 0.3.2
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/durable/index.cjs +298 -236
- package/dist/durable/index.cjs.map +1 -1
- package/dist/durable/index.js +241 -179
- package/dist/durable/index.js.map +1 -1
- package/dist/index.cjs +298 -236
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +241 -179
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -49,8 +49,8 @@ __export(index_exports, {
|
|
|
49
49
|
module.exports = __toCommonJS(index_exports);
|
|
50
50
|
|
|
51
51
|
// src/agent.module.ts
|
|
52
|
-
var
|
|
53
|
-
var
|
|
52
|
+
var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
|
|
53
|
+
var import_common11 = require("@nestjs/common");
|
|
54
54
|
var import_core3 = require("@nestjs/core");
|
|
55
55
|
|
|
56
56
|
// src/agent-deps.factory.ts
|
|
@@ -434,7 +434,7 @@ AgentService = _ts_decorate2([
|
|
|
434
434
|
])
|
|
435
435
|
], AgentService);
|
|
436
436
|
|
|
437
|
-
// src/controller/
|
|
437
|
+
// src/controller/agents.controller.ts
|
|
438
438
|
var import_nestjs_agent_core4 = require("@dudousxd/nestjs-agent-core");
|
|
439
439
|
var import_common3 = require("@nestjs/common");
|
|
440
440
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -454,6 +454,64 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
456
|
__name(_ts_param3, "_ts_param");
|
|
457
|
+
var AgentsController = class {
|
|
458
|
+
static {
|
|
459
|
+
__name(this, "AgentsController");
|
|
460
|
+
}
|
|
461
|
+
agents;
|
|
462
|
+
depsFactory;
|
|
463
|
+
constructor(agents, depsFactory) {
|
|
464
|
+
this.agents = agents;
|
|
465
|
+
this.depsFactory = depsFactory;
|
|
466
|
+
}
|
|
467
|
+
list() {
|
|
468
|
+
const defaultAgentName = this.depsFactory.defaultAgentName();
|
|
469
|
+
return this.agents.list().map((definition) => ({
|
|
470
|
+
name: definition.name,
|
|
471
|
+
description: definition.description ?? "",
|
|
472
|
+
...definition.name === defaultAgentName ? {
|
|
473
|
+
isDefault: true
|
|
474
|
+
} : {}
|
|
475
|
+
}));
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
_ts_decorate3([
|
|
479
|
+
(0, import_common3.Get)(),
|
|
480
|
+
_ts_metadata3("design:type", Function),
|
|
481
|
+
_ts_metadata3("design:paramtypes", []),
|
|
482
|
+
_ts_metadata3("design:returntype", Array)
|
|
483
|
+
], AgentsController.prototype, "list", null);
|
|
484
|
+
AgentsController = _ts_decorate3([
|
|
485
|
+
(0, import_common3.Controller)("agents"),
|
|
486
|
+
_ts_param3(0, (0, import_common3.Inject)(import_nestjs_agent_core4.AGENT_REGISTRY)),
|
|
487
|
+
_ts_param3(1, (0, import_common3.Inject)(import_nestjs_agent_core4.AGENT_DEPS_FACTORY)),
|
|
488
|
+
_ts_metadata3("design:type", Function),
|
|
489
|
+
_ts_metadata3("design:paramtypes", [
|
|
490
|
+
typeof import_nestjs_agent_core4.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core4.AgentRegistry,
|
|
491
|
+
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
492
|
+
])
|
|
493
|
+
], AgentsController);
|
|
494
|
+
|
|
495
|
+
// src/controller/chat.controller.ts
|
|
496
|
+
var import_nestjs_agent_core5 = require("@dudousxd/nestjs-agent-core");
|
|
497
|
+
var import_common4 = require("@nestjs/common");
|
|
498
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
499
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
500
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
501
|
+
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;
|
|
502
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
503
|
+
}
|
|
504
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
505
|
+
function _ts_metadata4(k, v) {
|
|
506
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
507
|
+
}
|
|
508
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
509
|
+
function _ts_param4(paramIndex, decorator) {
|
|
510
|
+
return function(target, key) {
|
|
511
|
+
decorator(target, key, paramIndex);
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
__name(_ts_param4, "_ts_param");
|
|
457
515
|
var ChatController = class {
|
|
458
516
|
static {
|
|
459
517
|
__name(this, "ChatController");
|
|
@@ -523,7 +581,7 @@ data: ${JSON.stringify({
|
|
|
523
581
|
}
|
|
524
582
|
res.write("event: done\ndata: {}\n\n");
|
|
525
583
|
} catch (error) {
|
|
526
|
-
const payload = error instanceof
|
|
584
|
+
const payload = error instanceof import_nestjs_agent_core5.AgentStreamError ? {
|
|
527
585
|
code: error.code,
|
|
528
586
|
message: error.message
|
|
529
587
|
} : {
|
|
@@ -538,71 +596,71 @@ data: ${JSON.stringify(payload)}
|
|
|
538
596
|
res.end();
|
|
539
597
|
}
|
|
540
598
|
};
|
|
541
|
-
|
|
542
|
-
(0,
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
599
|
+
_ts_decorate4([
|
|
600
|
+
(0, import_common4.Post)("chat"),
|
|
601
|
+
_ts_param4(0, (0, import_common4.Req)()),
|
|
602
|
+
_ts_param4(1, (0, import_common4.Res)()),
|
|
603
|
+
_ts_param4(2, (0, import_common4.Body)()),
|
|
604
|
+
_ts_metadata4("design:type", Function),
|
|
605
|
+
_ts_metadata4("design:paramtypes", [
|
|
548
606
|
typeof Request === "undefined" ? Object : Request,
|
|
549
607
|
typeof Response === "undefined" ? Object : Response,
|
|
550
608
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
551
609
|
]),
|
|
552
|
-
|
|
610
|
+
_ts_metadata4("design:returntype", Promise)
|
|
553
611
|
], ChatController.prototype, "chat", null);
|
|
554
|
-
|
|
555
|
-
(0,
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
612
|
+
_ts_decorate4([
|
|
613
|
+
(0, import_common4.Get)("chat/:runId/stream"),
|
|
614
|
+
_ts_param4(0, (0, import_common4.Param)("runId")),
|
|
615
|
+
_ts_param4(1, (0, import_common4.Res)()),
|
|
616
|
+
_ts_metadata4("design:type", Function),
|
|
617
|
+
_ts_metadata4("design:paramtypes", [
|
|
560
618
|
String,
|
|
561
619
|
typeof Response === "undefined" ? Object : Response
|
|
562
620
|
]),
|
|
563
|
-
|
|
621
|
+
_ts_metadata4("design:returntype", Promise)
|
|
564
622
|
], ChatController.prototype, "stream", null);
|
|
565
|
-
|
|
566
|
-
(0,
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
623
|
+
_ts_decorate4([
|
|
624
|
+
(0, import_common4.Post)("chat/:runId/cancel"),
|
|
625
|
+
_ts_param4(0, (0, import_common4.Req)()),
|
|
626
|
+
_ts_param4(1, (0, import_common4.Param)("runId")),
|
|
627
|
+
_ts_metadata4("design:type", Function),
|
|
628
|
+
_ts_metadata4("design:paramtypes", [
|
|
571
629
|
typeof Request === "undefined" ? Object : Request,
|
|
572
630
|
String
|
|
573
631
|
]),
|
|
574
|
-
|
|
632
|
+
_ts_metadata4("design:returntype", Promise)
|
|
575
633
|
], ChatController.prototype, "cancel", null);
|
|
576
|
-
ChatController =
|
|
577
|
-
(0,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
634
|
+
ChatController = _ts_decorate4([
|
|
635
|
+
(0, import_common4.Controller)(),
|
|
636
|
+
_ts_param4(1, (0, import_common4.Inject)(import_nestjs_agent_core5.AGENT_ACTOR_RESOLVER)),
|
|
637
|
+
_ts_metadata4("design:type", Function),
|
|
638
|
+
_ts_metadata4("design:paramtypes", [
|
|
581
639
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
582
640
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
583
641
|
])
|
|
584
642
|
], ChatController);
|
|
585
643
|
|
|
586
644
|
// src/controller/quota.controller.ts
|
|
587
|
-
var
|
|
588
|
-
var
|
|
589
|
-
function
|
|
645
|
+
var import_nestjs_agent_core6 = require("@dudousxd/nestjs-agent-core");
|
|
646
|
+
var import_common5 = require("@nestjs/common");
|
|
647
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
590
648
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
591
649
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
592
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;
|
|
593
651
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
594
652
|
}
|
|
595
|
-
__name(
|
|
596
|
-
function
|
|
653
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
654
|
+
function _ts_metadata5(k, v) {
|
|
597
655
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
598
656
|
}
|
|
599
|
-
__name(
|
|
600
|
-
function
|
|
657
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
658
|
+
function _ts_param5(paramIndex, decorator) {
|
|
601
659
|
return function(target, key) {
|
|
602
660
|
decorator(target, key, paramIndex);
|
|
603
661
|
};
|
|
604
662
|
}
|
|
605
|
-
__name(
|
|
663
|
+
__name(_ts_param5, "_ts_param");
|
|
606
664
|
var QuotaController = class {
|
|
607
665
|
static {
|
|
608
666
|
__name(this, "QuotaController");
|
|
@@ -618,45 +676,45 @@ var QuotaController = class {
|
|
|
618
676
|
return this.agent.quotaToday(actor.id);
|
|
619
677
|
}
|
|
620
678
|
};
|
|
621
|
-
|
|
622
|
-
(0,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
679
|
+
_ts_decorate5([
|
|
680
|
+
(0, import_common5.Get)("today"),
|
|
681
|
+
_ts_param5(0, (0, import_common5.Req)()),
|
|
682
|
+
_ts_metadata5("design:type", Function),
|
|
683
|
+
_ts_metadata5("design:paramtypes", [
|
|
626
684
|
typeof Request === "undefined" ? Object : Request
|
|
627
685
|
]),
|
|
628
|
-
|
|
686
|
+
_ts_metadata5("design:returntype", Promise)
|
|
629
687
|
], QuotaController.prototype, "today", null);
|
|
630
|
-
QuotaController =
|
|
631
|
-
(0,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
688
|
+
QuotaController = _ts_decorate5([
|
|
689
|
+
(0, import_common5.Controller)("quota"),
|
|
690
|
+
_ts_param5(1, (0, import_common5.Inject)(import_nestjs_agent_core6.AGENT_ACTOR_RESOLVER)),
|
|
691
|
+
_ts_metadata5("design:type", Function),
|
|
692
|
+
_ts_metadata5("design:paramtypes", [
|
|
635
693
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
636
694
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
637
695
|
])
|
|
638
696
|
], QuotaController);
|
|
639
697
|
|
|
640
698
|
// src/controller/threads.controller.ts
|
|
641
|
-
var
|
|
642
|
-
var
|
|
643
|
-
function
|
|
699
|
+
var import_nestjs_agent_core7 = require("@dudousxd/nestjs-agent-core");
|
|
700
|
+
var import_common6 = require("@nestjs/common");
|
|
701
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
644
702
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
645
703
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
646
704
|
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;
|
|
647
705
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
648
706
|
}
|
|
649
|
-
__name(
|
|
650
|
-
function
|
|
707
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
708
|
+
function _ts_metadata6(k, v) {
|
|
651
709
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
652
710
|
}
|
|
653
|
-
__name(
|
|
654
|
-
function
|
|
711
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
712
|
+
function _ts_param6(paramIndex, decorator) {
|
|
655
713
|
return function(target, key) {
|
|
656
714
|
decorator(target, key, paramIndex);
|
|
657
715
|
};
|
|
658
716
|
}
|
|
659
|
-
__name(
|
|
717
|
+
__name(_ts_param6, "_ts_param");
|
|
660
718
|
var ThreadsController = class {
|
|
661
719
|
static {
|
|
662
720
|
__name(this, "ThreadsController");
|
|
@@ -708,117 +766,117 @@ var ThreadsController = class {
|
|
|
708
766
|
};
|
|
709
767
|
}
|
|
710
768
|
};
|
|
711
|
-
|
|
712
|
-
(0,
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
769
|
+
_ts_decorate6([
|
|
770
|
+
(0, import_common6.Get)(),
|
|
771
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
772
|
+
_ts_metadata6("design:type", Function),
|
|
773
|
+
_ts_metadata6("design:paramtypes", [
|
|
716
774
|
typeof Request === "undefined" ? Object : Request
|
|
717
775
|
]),
|
|
718
|
-
|
|
776
|
+
_ts_metadata6("design:returntype", Promise)
|
|
719
777
|
], ThreadsController.prototype, "list", null);
|
|
720
|
-
|
|
721
|
-
(0,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
778
|
+
_ts_decorate6([
|
|
779
|
+
(0, import_common6.Get)(":id"),
|
|
780
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
781
|
+
_ts_param6(1, (0, import_common6.Param)("id")),
|
|
782
|
+
_ts_metadata6("design:type", Function),
|
|
783
|
+
_ts_metadata6("design:paramtypes", [
|
|
726
784
|
typeof Request === "undefined" ? Object : Request,
|
|
727
785
|
String
|
|
728
786
|
]),
|
|
729
|
-
|
|
787
|
+
_ts_metadata6("design:returntype", Promise)
|
|
730
788
|
], ThreadsController.prototype, "detail", null);
|
|
731
|
-
|
|
732
|
-
(0,
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
789
|
+
_ts_decorate6([
|
|
790
|
+
(0, import_common6.Delete)(":id"),
|
|
791
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
792
|
+
_ts_param6(1, (0, import_common6.Param)("id")),
|
|
793
|
+
_ts_metadata6("design:type", Function),
|
|
794
|
+
_ts_metadata6("design:paramtypes", [
|
|
737
795
|
typeof Request === "undefined" ? Object : Request,
|
|
738
796
|
String
|
|
739
797
|
]),
|
|
740
|
-
|
|
798
|
+
_ts_metadata6("design:returntype", Promise)
|
|
741
799
|
], ThreadsController.prototype, "remove", null);
|
|
742
|
-
|
|
743
|
-
(0,
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
800
|
+
_ts_decorate6([
|
|
801
|
+
(0, import_common6.Post)(":id/fork-from/:messageId"),
|
|
802
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
803
|
+
_ts_param6(1, (0, import_common6.Param)("id")),
|
|
804
|
+
_ts_param6(2, (0, import_common6.Param)("messageId")),
|
|
805
|
+
_ts_metadata6("design:type", Function),
|
|
806
|
+
_ts_metadata6("design:paramtypes", [
|
|
749
807
|
typeof Request === "undefined" ? Object : Request,
|
|
750
808
|
String,
|
|
751
809
|
String
|
|
752
810
|
]),
|
|
753
|
-
|
|
811
|
+
_ts_metadata6("design:returntype", Promise)
|
|
754
812
|
], ThreadsController.prototype, "fork", null);
|
|
755
|
-
|
|
756
|
-
(0,
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
813
|
+
_ts_decorate6([
|
|
814
|
+
(0, import_common6.Patch)(":id"),
|
|
815
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
816
|
+
_ts_param6(1, (0, import_common6.Param)("id")),
|
|
817
|
+
_ts_param6(2, (0, import_common6.Body)()),
|
|
818
|
+
_ts_metadata6("design:type", Function),
|
|
819
|
+
_ts_metadata6("design:paramtypes", [
|
|
762
820
|
typeof Request === "undefined" ? Object : Request,
|
|
763
821
|
String,
|
|
764
822
|
typeof RenameThreadBody === "undefined" ? Object : RenameThreadBody
|
|
765
823
|
]),
|
|
766
|
-
|
|
824
|
+
_ts_metadata6("design:returntype", Promise)
|
|
767
825
|
], ThreadsController.prototype, "rename", null);
|
|
768
|
-
|
|
769
|
-
(0,
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
826
|
+
_ts_decorate6([
|
|
827
|
+
(0, import_common6.Post)(":id/promote"),
|
|
828
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
829
|
+
_ts_param6(1, (0, import_common6.Param)("id")),
|
|
830
|
+
_ts_metadata6("design:type", Function),
|
|
831
|
+
_ts_metadata6("design:paramtypes", [
|
|
774
832
|
typeof Request === "undefined" ? Object : Request,
|
|
775
833
|
String
|
|
776
834
|
]),
|
|
777
|
-
|
|
835
|
+
_ts_metadata6("design:returntype", Promise)
|
|
778
836
|
], ThreadsController.prototype, "promote", null);
|
|
779
|
-
|
|
780
|
-
(0,
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
837
|
+
_ts_decorate6([
|
|
838
|
+
(0, import_common6.Delete)(":id/from/:messageId"),
|
|
839
|
+
_ts_param6(0, (0, import_common6.Req)()),
|
|
840
|
+
_ts_param6(1, (0, import_common6.Param)("id")),
|
|
841
|
+
_ts_param6(2, (0, import_common6.Param)("messageId")),
|
|
842
|
+
_ts_metadata6("design:type", Function),
|
|
843
|
+
_ts_metadata6("design:paramtypes", [
|
|
786
844
|
typeof Request === "undefined" ? Object : Request,
|
|
787
845
|
String,
|
|
788
846
|
String
|
|
789
847
|
]),
|
|
790
|
-
|
|
848
|
+
_ts_metadata6("design:returntype", Promise)
|
|
791
849
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
792
|
-
ThreadsController =
|
|
793
|
-
(0,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
850
|
+
ThreadsController = _ts_decorate6([
|
|
851
|
+
(0, import_common6.Controller)("threads"),
|
|
852
|
+
_ts_param6(1, (0, import_common6.Inject)(import_nestjs_agent_core7.AGENT_ACTOR_RESOLVER)),
|
|
853
|
+
_ts_metadata6("design:type", Function),
|
|
854
|
+
_ts_metadata6("design:paramtypes", [
|
|
797
855
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
798
856
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
799
857
|
])
|
|
800
858
|
], ThreadsController);
|
|
801
859
|
|
|
802
860
|
// src/controller/tool-call.controller.ts
|
|
803
|
-
var
|
|
804
|
-
var
|
|
805
|
-
function
|
|
861
|
+
var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
|
|
862
|
+
var import_common7 = require("@nestjs/common");
|
|
863
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
806
864
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
807
865
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
808
866
|
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;
|
|
809
867
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
810
868
|
}
|
|
811
|
-
__name(
|
|
812
|
-
function
|
|
869
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
870
|
+
function _ts_metadata7(k, v) {
|
|
813
871
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
814
872
|
}
|
|
815
|
-
__name(
|
|
816
|
-
function
|
|
873
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
874
|
+
function _ts_param7(paramIndex, decorator) {
|
|
817
875
|
return function(target, key) {
|
|
818
876
|
decorator(target, key, paramIndex);
|
|
819
877
|
};
|
|
820
878
|
}
|
|
821
|
-
__name(
|
|
879
|
+
__name(_ts_param7, "_ts_param");
|
|
822
880
|
var ToolCallController = class {
|
|
823
881
|
static {
|
|
824
882
|
__name(this, "ToolCallController");
|
|
@@ -844,41 +902,41 @@ var ToolCallController = class {
|
|
|
844
902
|
};
|
|
845
903
|
}
|
|
846
904
|
};
|
|
847
|
-
|
|
848
|
-
(0,
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
905
|
+
_ts_decorate7([
|
|
906
|
+
(0, import_common7.Post)("approve"),
|
|
907
|
+
_ts_param7(0, (0, import_common7.Req)()),
|
|
908
|
+
_ts_param7(1, (0, import_common7.Body)()),
|
|
909
|
+
_ts_metadata7("design:type", Function),
|
|
910
|
+
_ts_metadata7("design:paramtypes", [
|
|
853
911
|
typeof Request === "undefined" ? Object : Request,
|
|
854
912
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
855
913
|
]),
|
|
856
|
-
|
|
914
|
+
_ts_metadata7("design:returntype", Promise)
|
|
857
915
|
], ToolCallController.prototype, "approve", null);
|
|
858
|
-
|
|
859
|
-
(0,
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
916
|
+
_ts_decorate7([
|
|
917
|
+
(0, import_common7.Post)("reject"),
|
|
918
|
+
_ts_param7(0, (0, import_common7.Req)()),
|
|
919
|
+
_ts_param7(1, (0, import_common7.Body)()),
|
|
920
|
+
_ts_metadata7("design:type", Function),
|
|
921
|
+
_ts_metadata7("design:paramtypes", [
|
|
864
922
|
typeof Request === "undefined" ? Object : Request,
|
|
865
923
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
866
924
|
]),
|
|
867
|
-
|
|
925
|
+
_ts_metadata7("design:returntype", Promise)
|
|
868
926
|
], ToolCallController.prototype, "reject", null);
|
|
869
|
-
ToolCallController =
|
|
870
|
-
(0,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
927
|
+
ToolCallController = _ts_decorate7([
|
|
928
|
+
(0, import_common7.Controller)("tool-call"),
|
|
929
|
+
_ts_param7(1, (0, import_common7.Inject)(import_nestjs_agent_core8.AGENT_ACTOR_RESOLVER)),
|
|
930
|
+
_ts_metadata7("design:type", Function),
|
|
931
|
+
_ts_metadata7("design:paramtypes", [
|
|
874
932
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
875
933
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
876
934
|
])
|
|
877
935
|
], ToolCallController);
|
|
878
936
|
|
|
879
937
|
// src/discovery/agent-discovery.service.ts
|
|
880
|
-
var
|
|
881
|
-
var
|
|
938
|
+
var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
|
|
939
|
+
var import_common8 = require("@nestjs/common");
|
|
882
940
|
var import_core = require("@nestjs/core");
|
|
883
941
|
|
|
884
942
|
// src/decorator/agent.decorator.ts
|
|
@@ -913,23 +971,23 @@ function SystemPromptContributor() {
|
|
|
913
971
|
__name(SystemPromptContributor, "SystemPromptContributor");
|
|
914
972
|
|
|
915
973
|
// src/discovery/agent-discovery.service.ts
|
|
916
|
-
function
|
|
974
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
917
975
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
918
976
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
919
977
|
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;
|
|
920
978
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
921
979
|
}
|
|
922
|
-
__name(
|
|
923
|
-
function
|
|
980
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
981
|
+
function _ts_metadata8(k, v) {
|
|
924
982
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
925
983
|
}
|
|
926
|
-
__name(
|
|
927
|
-
function
|
|
984
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
985
|
+
function _ts_param8(paramIndex, decorator) {
|
|
928
986
|
return function(target, key) {
|
|
929
987
|
decorator(target, key, paramIndex);
|
|
930
988
|
};
|
|
931
989
|
}
|
|
932
|
-
__name(
|
|
990
|
+
__name(_ts_param8, "_ts_param");
|
|
933
991
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
934
992
|
static {
|
|
935
993
|
__name(this, "AgentDiscoveryService");
|
|
@@ -938,7 +996,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
938
996
|
scanner;
|
|
939
997
|
registry;
|
|
940
998
|
contributors;
|
|
941
|
-
logger = new
|
|
999
|
+
logger = new import_common8.Logger(_AgentDiscoveryService.name);
|
|
942
1000
|
constructor(discovery, scanner, registry, contributors) {
|
|
943
1001
|
this.discovery = discovery;
|
|
944
1002
|
this.scanner = scanner;
|
|
@@ -964,6 +1022,9 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
964
1022
|
const systemPrompt = promptMethod !== void 0 ? (ctx) => promptMethod(ctx) : meta.systemPrompt ?? "You are a helpful assistant.";
|
|
965
1023
|
return {
|
|
966
1024
|
name: meta.name,
|
|
1025
|
+
...meta.description !== void 0 ? {
|
|
1026
|
+
description: meta.description
|
|
1027
|
+
} : {},
|
|
967
1028
|
systemPrompt,
|
|
968
1029
|
...meta.tools !== void 0 ? {
|
|
969
1030
|
tools: meta.tools
|
|
@@ -1023,22 +1084,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1023
1084
|
return (ctx) => candidate.call(instance, ctx);
|
|
1024
1085
|
}
|
|
1025
1086
|
};
|
|
1026
|
-
AgentDiscoveryService =
|
|
1027
|
-
(0,
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1087
|
+
AgentDiscoveryService = _ts_decorate8([
|
|
1088
|
+
(0, import_common8.Injectable)(),
|
|
1089
|
+
_ts_param8(2, (0, import_common8.Inject)(import_nestjs_agent_core9.AGENT_REGISTRY)),
|
|
1090
|
+
_ts_param8(3, (0, import_common8.Inject)(import_nestjs_agent_core9.AGENT_PROMPT_CONTRIBUTORS)),
|
|
1091
|
+
_ts_metadata8("design:type", Function),
|
|
1092
|
+
_ts_metadata8("design:paramtypes", [
|
|
1032
1093
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
1033
1094
|
typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
|
|
1034
|
-
typeof
|
|
1095
|
+
typeof import_nestjs_agent_core9.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core9.AgentRegistry,
|
|
1035
1096
|
Array
|
|
1036
1097
|
])
|
|
1037
1098
|
], AgentDiscoveryService);
|
|
1038
1099
|
|
|
1039
1100
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1040
|
-
var
|
|
1041
|
-
var
|
|
1101
|
+
var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
|
|
1102
|
+
var import_common9 = require("@nestjs/common");
|
|
1042
1103
|
var import_core2 = require("@nestjs/core");
|
|
1043
1104
|
var import_zod = require("zod");
|
|
1044
1105
|
|
|
@@ -1087,23 +1148,23 @@ function provideAgentTool(factoryOrTool, inject) {
|
|
|
1087
1148
|
__name(provideAgentTool, "provideAgentTool");
|
|
1088
1149
|
|
|
1089
1150
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1090
|
-
function
|
|
1151
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1091
1152
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1092
1153
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1093
1154
|
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;
|
|
1094
1155
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1095
1156
|
}
|
|
1096
|
-
__name(
|
|
1097
|
-
function
|
|
1157
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1158
|
+
function _ts_metadata9(k, v) {
|
|
1098
1159
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1099
1160
|
}
|
|
1100
|
-
__name(
|
|
1101
|
-
function
|
|
1161
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1162
|
+
function _ts_param9(paramIndex, decorator) {
|
|
1102
1163
|
return function(target, key) {
|
|
1103
1164
|
decorator(target, key, paramIndex);
|
|
1104
1165
|
};
|
|
1105
1166
|
}
|
|
1106
|
-
__name(
|
|
1167
|
+
__name(_ts_param9, "_ts_param");
|
|
1107
1168
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
1108
1169
|
static {
|
|
1109
1170
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -1112,7 +1173,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1112
1173
|
registry;
|
|
1113
1174
|
agents;
|
|
1114
1175
|
options;
|
|
1115
|
-
logger = new
|
|
1176
|
+
logger = new import_common9.Logger(_AiToolDiscoveryService.name);
|
|
1116
1177
|
constructor(discovery, registry, agents, options) {
|
|
1117
1178
|
this.discovery = discovery;
|
|
1118
1179
|
this.registry = registry;
|
|
@@ -1210,13 +1271,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1210
1271
|
return true;
|
|
1211
1272
|
}
|
|
1212
1273
|
};
|
|
1213
|
-
AiToolDiscoveryService =
|
|
1214
|
-
(0,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1274
|
+
AiToolDiscoveryService = _ts_decorate9([
|
|
1275
|
+
(0, import_common9.Injectable)(),
|
|
1276
|
+
_ts_param9(1, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_TOOL_REGISTRY)),
|
|
1277
|
+
_ts_param9(2, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_REGISTRY)),
|
|
1278
|
+
_ts_param9(3, (0, import_common9.Inject)(import_nestjs_agent_core10.AGENT_OPTIONS)),
|
|
1279
|
+
_ts_metadata9("design:type", Function),
|
|
1280
|
+
_ts_metadata9("design:paramtypes", [
|
|
1220
1281
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
1221
1282
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1222
1283
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1225,7 +1286,7 @@ AiToolDiscoveryService = _ts_decorate8([
|
|
|
1225
1286
|
], AiToolDiscoveryService);
|
|
1226
1287
|
|
|
1227
1288
|
// src/in-process-sink.ts
|
|
1228
|
-
var
|
|
1289
|
+
var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
|
|
1229
1290
|
var InProcessTokenStreamSink = class {
|
|
1230
1291
|
static {
|
|
1231
1292
|
__name(this, "InProcessTokenStreamSink");
|
|
@@ -1280,7 +1341,7 @@ var InProcessTokenStreamSink = class {
|
|
|
1280
1341
|
}
|
|
1281
1342
|
if (buf.ended) {
|
|
1282
1343
|
if (buf.failure !== void 0) {
|
|
1283
|
-
throw new
|
|
1344
|
+
throw new import_nestjs_agent_core11.AgentStreamError(buf.failure);
|
|
1284
1345
|
}
|
|
1285
1346
|
return;
|
|
1286
1347
|
}
|
|
@@ -1316,32 +1377,32 @@ var LedgerQuotaStore = class {
|
|
|
1316
1377
|
};
|
|
1317
1378
|
|
|
1318
1379
|
// src/runner/inline-agent-runner.ts
|
|
1319
|
-
var
|
|
1320
|
-
var
|
|
1321
|
-
function
|
|
1380
|
+
var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
|
|
1381
|
+
var import_common10 = require("@nestjs/common");
|
|
1382
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1322
1383
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1323
1384
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1324
1385
|
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;
|
|
1325
1386
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1326
1387
|
}
|
|
1327
|
-
__name(
|
|
1328
|
-
function
|
|
1388
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1389
|
+
function _ts_metadata10(k, v) {
|
|
1329
1390
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1330
1391
|
}
|
|
1331
|
-
__name(
|
|
1332
|
-
function
|
|
1392
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1393
|
+
function _ts_param10(paramIndex, decorator) {
|
|
1333
1394
|
return function(target, key) {
|
|
1334
1395
|
decorator(target, key, paramIndex);
|
|
1335
1396
|
};
|
|
1336
1397
|
}
|
|
1337
|
-
__name(
|
|
1398
|
+
__name(_ts_param10, "_ts_param");
|
|
1338
1399
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
1339
1400
|
static {
|
|
1340
1401
|
__name(this, "InlineAgentRunner");
|
|
1341
1402
|
}
|
|
1342
1403
|
factory;
|
|
1343
1404
|
store;
|
|
1344
|
-
logger = new
|
|
1405
|
+
logger = new import_common10.Logger(_InlineAgentRunner.name);
|
|
1345
1406
|
pending = /* @__PURE__ */ new Map();
|
|
1346
1407
|
constructor(factory, store) {
|
|
1347
1408
|
this.factory = factory;
|
|
@@ -1352,14 +1413,14 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1352
1413
|
const day = input.day ?? utcDay();
|
|
1353
1414
|
const deps = this.factory.forAgent(input.agentName);
|
|
1354
1415
|
const hooks = this.topLevelHooks(runId, deps, input.actor, day);
|
|
1355
|
-
void (0,
|
|
1416
|
+
void (0, import_nestjs_agent_core12.runAgentLoop)({
|
|
1356
1417
|
...deps,
|
|
1357
1418
|
day
|
|
1358
1419
|
}, input, hooks).catch(async (error) => {
|
|
1359
1420
|
const message = error instanceof Error ? error.message : String(error);
|
|
1360
|
-
const code = error instanceof
|
|
1421
|
+
const code = error instanceof import_nestjs_agent_core12.QuotaExceededError ? "quota_exceeded" : "run_failed";
|
|
1361
1422
|
this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
|
|
1362
|
-
(0,
|
|
1423
|
+
(0, import_nestjs_agent_core12.publishAgentRunFailed)({
|
|
1363
1424
|
runId,
|
|
1364
1425
|
code,
|
|
1365
1426
|
message
|
|
@@ -1421,7 +1482,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1421
1482
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
1422
1483
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested(childName, childTask, actor, day, depth + 1, sinkRunId), "runAgent")
|
|
1423
1484
|
};
|
|
1424
|
-
return (0,
|
|
1485
|
+
return (0, import_nestjs_agent_core12.runAgentLoop)({
|
|
1425
1486
|
...deps,
|
|
1426
1487
|
day
|
|
1427
1488
|
}, {
|
|
@@ -1435,84 +1496,84 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1435
1496
|
}, hooks);
|
|
1436
1497
|
}
|
|
1437
1498
|
};
|
|
1438
|
-
InlineAgentRunner =
|
|
1439
|
-
(0,
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1499
|
+
InlineAgentRunner = _ts_decorate10([
|
|
1500
|
+
(0, import_common10.Injectable)(),
|
|
1501
|
+
_ts_param10(0, (0, import_common10.Inject)(import_nestjs_agent_core12.AGENT_DEPS_FACTORY)),
|
|
1502
|
+
_ts_param10(1, (0, import_common10.Inject)(import_nestjs_agent_core12.AGENT_STORE)),
|
|
1503
|
+
_ts_metadata10("design:type", Function),
|
|
1504
|
+
_ts_metadata10("design:paramtypes", [
|
|
1444
1505
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1445
1506
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1446
1507
|
])
|
|
1447
1508
|
], InlineAgentRunner);
|
|
1448
1509
|
|
|
1449
1510
|
// src/agent.module.ts
|
|
1450
|
-
function
|
|
1511
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1451
1512
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1452
1513
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1453
1514
|
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;
|
|
1454
1515
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1455
1516
|
}
|
|
1456
|
-
__name(
|
|
1517
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1457
1518
|
var DEFAULT_PATH = "agent";
|
|
1458
1519
|
function sharedProviders(durable, includeStore) {
|
|
1459
1520
|
const providers = [
|
|
1460
1521
|
{
|
|
1461
|
-
provide:
|
|
1462
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
1522
|
+
provide: import_nestjs_agent_core13.AGENT_TOOL_REGISTRY,
|
|
1523
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core13.ToolRegistry(), "useFactory")
|
|
1463
1524
|
},
|
|
1464
1525
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
1465
1526
|
{
|
|
1466
|
-
provide:
|
|
1467
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
1527
|
+
provide: import_nestjs_agent_core13.AGENT_REGISTRY,
|
|
1528
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core13.AgentRegistry(), "useFactory")
|
|
1468
1529
|
},
|
|
1469
1530
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
1470
1531
|
{
|
|
1471
|
-
provide:
|
|
1532
|
+
provide: import_nestjs_agent_core13.AGENT_PROMPT_CONTRIBUTORS,
|
|
1472
1533
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
1473
1534
|
},
|
|
1474
1535
|
{
|
|
1475
|
-
provide:
|
|
1536
|
+
provide: import_nestjs_agent_core13.AGENT_SINK,
|
|
1476
1537
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
1477
1538
|
inject: [
|
|
1478
|
-
|
|
1539
|
+
import_nestjs_agent_core13.AGENT_OPTIONS
|
|
1479
1540
|
]
|
|
1480
1541
|
},
|
|
1481
1542
|
{
|
|
1482
|
-
provide:
|
|
1483
|
-
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new
|
|
1543
|
+
provide: import_nestjs_agent_core13.AGENT_ROLES_POLICY,
|
|
1544
|
+
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core13.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
|
|
1484
1545
|
inject: [
|
|
1485
|
-
|
|
1546
|
+
import_nestjs_agent_core13.AGENT_OPTIONS
|
|
1486
1547
|
]
|
|
1487
1548
|
},
|
|
1488
1549
|
{
|
|
1489
|
-
provide:
|
|
1550
|
+
provide: import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER,
|
|
1490
1551
|
useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
|
|
1491
1552
|
inject: [
|
|
1492
|
-
|
|
1553
|
+
import_nestjs_agent_core13.AGENT_OPTIONS
|
|
1493
1554
|
]
|
|
1494
1555
|
},
|
|
1495
1556
|
{
|
|
1496
|
-
provide:
|
|
1557
|
+
provide: import_nestjs_agent_core13.AGENT_MODEL,
|
|
1497
1558
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
1498
1559
|
inject: [
|
|
1499
|
-
|
|
1560
|
+
import_nestjs_agent_core13.AGENT_OPTIONS
|
|
1500
1561
|
]
|
|
1501
1562
|
},
|
|
1502
1563
|
{
|
|
1503
1564
|
// An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
|
|
1504
1565
|
// store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
|
|
1505
1566
|
// the loop already writes, so enforcement needs no extra shared state across replicas.
|
|
1506
|
-
provide:
|
|
1567
|
+
provide: import_nestjs_agent_core13.AGENT_QUOTA_STORE,
|
|
1507
1568
|
useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
|
|
1508
1569
|
inject: [
|
|
1509
|
-
|
|
1510
|
-
|
|
1570
|
+
import_nestjs_agent_core13.AGENT_OPTIONS,
|
|
1571
|
+
import_nestjs_agent_core13.AGENT_STORE
|
|
1511
1572
|
]
|
|
1512
1573
|
},
|
|
1513
1574
|
AgentDepsFactory2,
|
|
1514
1575
|
{
|
|
1515
|
-
provide:
|
|
1576
|
+
provide: import_nestjs_agent_core13.AGENT_DEPS_FACTORY,
|
|
1516
1577
|
useExisting: AgentDepsFactory2
|
|
1517
1578
|
},
|
|
1518
1579
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -1524,16 +1585,16 @@ function sharedProviders(durable, includeStore) {
|
|
|
1524
1585
|
];
|
|
1525
1586
|
if (includeStore) {
|
|
1526
1587
|
providers.push({
|
|
1527
|
-
provide:
|
|
1588
|
+
provide: import_nestjs_agent_core13.AGENT_STORE,
|
|
1528
1589
|
useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
|
|
1529
1590
|
inject: [
|
|
1530
|
-
|
|
1591
|
+
import_nestjs_agent_core13.AGENT_OPTIONS
|
|
1531
1592
|
]
|
|
1532
1593
|
});
|
|
1533
1594
|
}
|
|
1534
1595
|
if (durable) {
|
|
1535
1596
|
providers.push({
|
|
1536
|
-
provide:
|
|
1597
|
+
provide: import_nestjs_agent_core13.AGENT_RUNNER,
|
|
1537
1598
|
useFactory: /* @__PURE__ */ __name((durableRunner) => {
|
|
1538
1599
|
if (durableRunner === void 0) {
|
|
1539
1600
|
throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
|
|
@@ -1542,14 +1603,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
1542
1603
|
}, "useFactory"),
|
|
1543
1604
|
inject: [
|
|
1544
1605
|
{
|
|
1545
|
-
token:
|
|
1606
|
+
token: import_nestjs_agent_core13.AGENT_DURABLE_RUNNER,
|
|
1546
1607
|
optional: true
|
|
1547
1608
|
}
|
|
1548
1609
|
]
|
|
1549
1610
|
});
|
|
1550
1611
|
} else {
|
|
1551
1612
|
providers.push({
|
|
1552
|
-
provide:
|
|
1613
|
+
provide: import_nestjs_agent_core13.AGENT_RUNNER,
|
|
1553
1614
|
useExisting: InlineAgentRunner
|
|
1554
1615
|
});
|
|
1555
1616
|
}
|
|
@@ -1558,19 +1619,19 @@ function sharedProviders(durable, includeStore) {
|
|
|
1558
1619
|
__name(sharedProviders, "sharedProviders");
|
|
1559
1620
|
function exportsFor(includeStore) {
|
|
1560
1621
|
return [
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1622
|
+
import_nestjs_agent_core13.AGENT_OPTIONS,
|
|
1623
|
+
import_nestjs_agent_core13.AGENT_TOOL_REGISTRY,
|
|
1624
|
+
import_nestjs_agent_core13.AGENT_REGISTRY,
|
|
1625
|
+
import_nestjs_agent_core13.AGENT_SINK,
|
|
1626
|
+
import_nestjs_agent_core13.AGENT_ROLES_POLICY,
|
|
1627
|
+
import_nestjs_agent_core13.AGENT_ACTOR_RESOLVER,
|
|
1628
|
+
import_nestjs_agent_core13.AGENT_MODEL,
|
|
1568
1629
|
...includeStore ? [
|
|
1569
|
-
|
|
1630
|
+
import_nestjs_agent_core13.AGENT_STORE
|
|
1570
1631
|
] : [],
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1632
|
+
import_nestjs_agent_core13.AGENT_QUOTA_STORE,
|
|
1633
|
+
import_nestjs_agent_core13.AGENT_PROMPT_CONTRIBUTORS,
|
|
1634
|
+
import_nestjs_agent_core13.AGENT_DEPS_FACTORY,
|
|
1574
1635
|
AgentDepsFactory2,
|
|
1575
1636
|
AgentService,
|
|
1576
1637
|
InlineAgentRunner
|
|
@@ -1581,7 +1642,8 @@ var CONTROLLERS = [
|
|
|
1581
1642
|
ChatController,
|
|
1582
1643
|
ThreadsController,
|
|
1583
1644
|
ToolCallController,
|
|
1584
|
-
QuotaController
|
|
1645
|
+
QuotaController,
|
|
1646
|
+
AgentsController
|
|
1585
1647
|
];
|
|
1586
1648
|
function routerFor(path) {
|
|
1587
1649
|
return import_core3.RouterModule.register([
|
|
@@ -1609,7 +1671,7 @@ var AgentModule = class _AgentModule {
|
|
|
1609
1671
|
controllers: CONTROLLERS,
|
|
1610
1672
|
providers: [
|
|
1611
1673
|
{
|
|
1612
|
-
provide:
|
|
1674
|
+
provide: import_nestjs_agent_core13.AGENT_OPTIONS,
|
|
1613
1675
|
useValue: options
|
|
1614
1676
|
},
|
|
1615
1677
|
...sharedProviders(options.durable ?? false, includeStore)
|
|
@@ -1630,7 +1692,7 @@ var AgentModule = class _AgentModule {
|
|
|
1630
1692
|
controllers: CONTROLLERS,
|
|
1631
1693
|
providers: [
|
|
1632
1694
|
{
|
|
1633
|
-
provide:
|
|
1695
|
+
provide: import_nestjs_agent_core13.AGENT_OPTIONS,
|
|
1634
1696
|
useFactory: options.useFactory,
|
|
1635
1697
|
inject: options.inject ?? []
|
|
1636
1698
|
},
|
|
@@ -1642,9 +1704,9 @@ var AgentModule = class _AgentModule {
|
|
|
1642
1704
|
};
|
|
1643
1705
|
}
|
|
1644
1706
|
};
|
|
1645
|
-
AgentModule =
|
|
1646
|
-
(0,
|
|
1647
|
-
(0,
|
|
1707
|
+
AgentModule = _ts_decorate11([
|
|
1708
|
+
(0, import_common11.Global)(),
|
|
1709
|
+
(0, import_common11.Module)({})
|
|
1648
1710
|
], AgentModule);
|
|
1649
1711
|
|
|
1650
1712
|
// src/resolver/header-actor-resolver.ts
|