@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/durable/index.cjs
CHANGED
|
@@ -242,8 +242,8 @@ AgentDurableModule = _ts_decorate3([
|
|
|
242
242
|
], AgentDurableModule);
|
|
243
243
|
|
|
244
244
|
// src/agent.module.ts
|
|
245
|
-
var
|
|
246
|
-
var
|
|
245
|
+
var import_nestjs_agent_core15 = require("@dudousxd/nestjs-agent-core");
|
|
246
|
+
var import_common14 = require("@nestjs/common");
|
|
247
247
|
var import_core3 = require("@nestjs/core");
|
|
248
248
|
|
|
249
249
|
// src/agent-deps.factory.ts
|
|
@@ -609,7 +609,7 @@ AgentService = _ts_decorate5([
|
|
|
609
609
|
])
|
|
610
610
|
], AgentService);
|
|
611
611
|
|
|
612
|
-
// src/controller/
|
|
612
|
+
// src/controller/agents.controller.ts
|
|
613
613
|
var import_nestjs_agent_core6 = require("@dudousxd/nestjs-agent-core");
|
|
614
614
|
var import_common6 = require("@nestjs/common");
|
|
615
615
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
@@ -629,6 +629,64 @@ function _ts_param4(paramIndex, decorator) {
|
|
|
629
629
|
};
|
|
630
630
|
}
|
|
631
631
|
__name(_ts_param4, "_ts_param");
|
|
632
|
+
var AgentsController = class {
|
|
633
|
+
static {
|
|
634
|
+
__name(this, "AgentsController");
|
|
635
|
+
}
|
|
636
|
+
agents;
|
|
637
|
+
depsFactory;
|
|
638
|
+
constructor(agents, depsFactory) {
|
|
639
|
+
this.agents = agents;
|
|
640
|
+
this.depsFactory = depsFactory;
|
|
641
|
+
}
|
|
642
|
+
list() {
|
|
643
|
+
const defaultAgentName = this.depsFactory.defaultAgentName();
|
|
644
|
+
return this.agents.list().map((definition) => ({
|
|
645
|
+
name: definition.name,
|
|
646
|
+
description: definition.description ?? "",
|
|
647
|
+
...definition.name === defaultAgentName ? {
|
|
648
|
+
isDefault: true
|
|
649
|
+
} : {}
|
|
650
|
+
}));
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
_ts_decorate6([
|
|
654
|
+
(0, import_common6.Get)(),
|
|
655
|
+
_ts_metadata5("design:type", Function),
|
|
656
|
+
_ts_metadata5("design:paramtypes", []),
|
|
657
|
+
_ts_metadata5("design:returntype", Array)
|
|
658
|
+
], AgentsController.prototype, "list", null);
|
|
659
|
+
AgentsController = _ts_decorate6([
|
|
660
|
+
(0, import_common6.Controller)("agents"),
|
|
661
|
+
_ts_param4(0, (0, import_common6.Inject)(import_nestjs_agent_core6.AGENT_REGISTRY)),
|
|
662
|
+
_ts_param4(1, (0, import_common6.Inject)(import_nestjs_agent_core6.AGENT_DEPS_FACTORY)),
|
|
663
|
+
_ts_metadata5("design:type", Function),
|
|
664
|
+
_ts_metadata5("design:paramtypes", [
|
|
665
|
+
typeof import_nestjs_agent_core6.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core6.AgentRegistry,
|
|
666
|
+
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
667
|
+
])
|
|
668
|
+
], AgentsController);
|
|
669
|
+
|
|
670
|
+
// src/controller/chat.controller.ts
|
|
671
|
+
var import_nestjs_agent_core7 = require("@dudousxd/nestjs-agent-core");
|
|
672
|
+
var import_common7 = require("@nestjs/common");
|
|
673
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
674
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
675
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
676
|
+
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;
|
|
677
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
678
|
+
}
|
|
679
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
680
|
+
function _ts_metadata6(k, v) {
|
|
681
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
682
|
+
}
|
|
683
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
684
|
+
function _ts_param5(paramIndex, decorator) {
|
|
685
|
+
return function(target, key) {
|
|
686
|
+
decorator(target, key, paramIndex);
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
__name(_ts_param5, "_ts_param");
|
|
632
690
|
var ChatController = class {
|
|
633
691
|
static {
|
|
634
692
|
__name(this, "ChatController");
|
|
@@ -698,7 +756,7 @@ data: ${JSON.stringify({
|
|
|
698
756
|
}
|
|
699
757
|
res.write("event: done\ndata: {}\n\n");
|
|
700
758
|
} catch (error) {
|
|
701
|
-
const payload = error instanceof
|
|
759
|
+
const payload = error instanceof import_nestjs_agent_core7.AgentStreamError ? {
|
|
702
760
|
code: error.code,
|
|
703
761
|
message: error.message
|
|
704
762
|
} : {
|
|
@@ -713,71 +771,71 @@ data: ${JSON.stringify(payload)}
|
|
|
713
771
|
res.end();
|
|
714
772
|
}
|
|
715
773
|
};
|
|
716
|
-
|
|
717
|
-
(0,
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
774
|
+
_ts_decorate7([
|
|
775
|
+
(0, import_common7.Post)("chat"),
|
|
776
|
+
_ts_param5(0, (0, import_common7.Req)()),
|
|
777
|
+
_ts_param5(1, (0, import_common7.Res)()),
|
|
778
|
+
_ts_param5(2, (0, import_common7.Body)()),
|
|
779
|
+
_ts_metadata6("design:type", Function),
|
|
780
|
+
_ts_metadata6("design:paramtypes", [
|
|
723
781
|
typeof Request === "undefined" ? Object : Request,
|
|
724
782
|
typeof Response === "undefined" ? Object : Response,
|
|
725
783
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
726
784
|
]),
|
|
727
|
-
|
|
785
|
+
_ts_metadata6("design:returntype", Promise)
|
|
728
786
|
], ChatController.prototype, "chat", null);
|
|
729
|
-
|
|
730
|
-
(0,
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
787
|
+
_ts_decorate7([
|
|
788
|
+
(0, import_common7.Get)("chat/:runId/stream"),
|
|
789
|
+
_ts_param5(0, (0, import_common7.Param)("runId")),
|
|
790
|
+
_ts_param5(1, (0, import_common7.Res)()),
|
|
791
|
+
_ts_metadata6("design:type", Function),
|
|
792
|
+
_ts_metadata6("design:paramtypes", [
|
|
735
793
|
String,
|
|
736
794
|
typeof Response === "undefined" ? Object : Response
|
|
737
795
|
]),
|
|
738
|
-
|
|
796
|
+
_ts_metadata6("design:returntype", Promise)
|
|
739
797
|
], ChatController.prototype, "stream", null);
|
|
740
|
-
|
|
741
|
-
(0,
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
798
|
+
_ts_decorate7([
|
|
799
|
+
(0, import_common7.Post)("chat/:runId/cancel"),
|
|
800
|
+
_ts_param5(0, (0, import_common7.Req)()),
|
|
801
|
+
_ts_param5(1, (0, import_common7.Param)("runId")),
|
|
802
|
+
_ts_metadata6("design:type", Function),
|
|
803
|
+
_ts_metadata6("design:paramtypes", [
|
|
746
804
|
typeof Request === "undefined" ? Object : Request,
|
|
747
805
|
String
|
|
748
806
|
]),
|
|
749
|
-
|
|
807
|
+
_ts_metadata6("design:returntype", Promise)
|
|
750
808
|
], ChatController.prototype, "cancel", null);
|
|
751
|
-
ChatController =
|
|
752
|
-
(0,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
809
|
+
ChatController = _ts_decorate7([
|
|
810
|
+
(0, import_common7.Controller)(),
|
|
811
|
+
_ts_param5(1, (0, import_common7.Inject)(import_nestjs_agent_core7.AGENT_ACTOR_RESOLVER)),
|
|
812
|
+
_ts_metadata6("design:type", Function),
|
|
813
|
+
_ts_metadata6("design:paramtypes", [
|
|
756
814
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
757
815
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
758
816
|
])
|
|
759
817
|
], ChatController);
|
|
760
818
|
|
|
761
819
|
// src/controller/quota.controller.ts
|
|
762
|
-
var
|
|
763
|
-
var
|
|
764
|
-
function
|
|
820
|
+
var import_nestjs_agent_core8 = require("@dudousxd/nestjs-agent-core");
|
|
821
|
+
var import_common8 = require("@nestjs/common");
|
|
822
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
765
823
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
766
824
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
767
825
|
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;
|
|
768
826
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
769
827
|
}
|
|
770
|
-
__name(
|
|
771
|
-
function
|
|
828
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
829
|
+
function _ts_metadata7(k, v) {
|
|
772
830
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
773
831
|
}
|
|
774
|
-
__name(
|
|
775
|
-
function
|
|
832
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
833
|
+
function _ts_param6(paramIndex, decorator) {
|
|
776
834
|
return function(target, key) {
|
|
777
835
|
decorator(target, key, paramIndex);
|
|
778
836
|
};
|
|
779
837
|
}
|
|
780
|
-
__name(
|
|
838
|
+
__name(_ts_param6, "_ts_param");
|
|
781
839
|
var QuotaController = class {
|
|
782
840
|
static {
|
|
783
841
|
__name(this, "QuotaController");
|
|
@@ -793,45 +851,45 @@ var QuotaController = class {
|
|
|
793
851
|
return this.agent.quotaToday(actor.id);
|
|
794
852
|
}
|
|
795
853
|
};
|
|
796
|
-
|
|
797
|
-
(0,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
854
|
+
_ts_decorate8([
|
|
855
|
+
(0, import_common8.Get)("today"),
|
|
856
|
+
_ts_param6(0, (0, import_common8.Req)()),
|
|
857
|
+
_ts_metadata7("design:type", Function),
|
|
858
|
+
_ts_metadata7("design:paramtypes", [
|
|
801
859
|
typeof Request === "undefined" ? Object : Request
|
|
802
860
|
]),
|
|
803
|
-
|
|
861
|
+
_ts_metadata7("design:returntype", Promise)
|
|
804
862
|
], QuotaController.prototype, "today", null);
|
|
805
|
-
QuotaController =
|
|
806
|
-
(0,
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
863
|
+
QuotaController = _ts_decorate8([
|
|
864
|
+
(0, import_common8.Controller)("quota"),
|
|
865
|
+
_ts_param6(1, (0, import_common8.Inject)(import_nestjs_agent_core8.AGENT_ACTOR_RESOLVER)),
|
|
866
|
+
_ts_metadata7("design:type", Function),
|
|
867
|
+
_ts_metadata7("design:paramtypes", [
|
|
810
868
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
811
869
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
812
870
|
])
|
|
813
871
|
], QuotaController);
|
|
814
872
|
|
|
815
873
|
// src/controller/threads.controller.ts
|
|
816
|
-
var
|
|
817
|
-
var
|
|
818
|
-
function
|
|
874
|
+
var import_nestjs_agent_core9 = require("@dudousxd/nestjs-agent-core");
|
|
875
|
+
var import_common9 = require("@nestjs/common");
|
|
876
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
819
877
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
820
878
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
821
879
|
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;
|
|
822
880
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
823
881
|
}
|
|
824
|
-
__name(
|
|
825
|
-
function
|
|
882
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
883
|
+
function _ts_metadata8(k, v) {
|
|
826
884
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
827
885
|
}
|
|
828
|
-
__name(
|
|
829
|
-
function
|
|
886
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
887
|
+
function _ts_param7(paramIndex, decorator) {
|
|
830
888
|
return function(target, key) {
|
|
831
889
|
decorator(target, key, paramIndex);
|
|
832
890
|
};
|
|
833
891
|
}
|
|
834
|
-
__name(
|
|
892
|
+
__name(_ts_param7, "_ts_param");
|
|
835
893
|
var ThreadsController = class {
|
|
836
894
|
static {
|
|
837
895
|
__name(this, "ThreadsController");
|
|
@@ -883,117 +941,117 @@ var ThreadsController = class {
|
|
|
883
941
|
};
|
|
884
942
|
}
|
|
885
943
|
};
|
|
886
|
-
|
|
887
|
-
(0,
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
944
|
+
_ts_decorate9([
|
|
945
|
+
(0, import_common9.Get)(),
|
|
946
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
947
|
+
_ts_metadata8("design:type", Function),
|
|
948
|
+
_ts_metadata8("design:paramtypes", [
|
|
891
949
|
typeof Request === "undefined" ? Object : Request
|
|
892
950
|
]),
|
|
893
|
-
|
|
951
|
+
_ts_metadata8("design:returntype", Promise)
|
|
894
952
|
], ThreadsController.prototype, "list", null);
|
|
895
|
-
|
|
896
|
-
(0,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
953
|
+
_ts_decorate9([
|
|
954
|
+
(0, import_common9.Get)(":id"),
|
|
955
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
956
|
+
_ts_param7(1, (0, import_common9.Param)("id")),
|
|
957
|
+
_ts_metadata8("design:type", Function),
|
|
958
|
+
_ts_metadata8("design:paramtypes", [
|
|
901
959
|
typeof Request === "undefined" ? Object : Request,
|
|
902
960
|
String
|
|
903
961
|
]),
|
|
904
|
-
|
|
962
|
+
_ts_metadata8("design:returntype", Promise)
|
|
905
963
|
], ThreadsController.prototype, "detail", null);
|
|
906
|
-
|
|
907
|
-
(0,
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
964
|
+
_ts_decorate9([
|
|
965
|
+
(0, import_common9.Delete)(":id"),
|
|
966
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
967
|
+
_ts_param7(1, (0, import_common9.Param)("id")),
|
|
968
|
+
_ts_metadata8("design:type", Function),
|
|
969
|
+
_ts_metadata8("design:paramtypes", [
|
|
912
970
|
typeof Request === "undefined" ? Object : Request,
|
|
913
971
|
String
|
|
914
972
|
]),
|
|
915
|
-
|
|
973
|
+
_ts_metadata8("design:returntype", Promise)
|
|
916
974
|
], ThreadsController.prototype, "remove", null);
|
|
917
|
-
|
|
918
|
-
(0,
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
975
|
+
_ts_decorate9([
|
|
976
|
+
(0, import_common9.Post)(":id/fork-from/:messageId"),
|
|
977
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
978
|
+
_ts_param7(1, (0, import_common9.Param)("id")),
|
|
979
|
+
_ts_param7(2, (0, import_common9.Param)("messageId")),
|
|
980
|
+
_ts_metadata8("design:type", Function),
|
|
981
|
+
_ts_metadata8("design:paramtypes", [
|
|
924
982
|
typeof Request === "undefined" ? Object : Request,
|
|
925
983
|
String,
|
|
926
984
|
String
|
|
927
985
|
]),
|
|
928
|
-
|
|
986
|
+
_ts_metadata8("design:returntype", Promise)
|
|
929
987
|
], ThreadsController.prototype, "fork", null);
|
|
930
|
-
|
|
931
|
-
(0,
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
988
|
+
_ts_decorate9([
|
|
989
|
+
(0, import_common9.Patch)(":id"),
|
|
990
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
991
|
+
_ts_param7(1, (0, import_common9.Param)("id")),
|
|
992
|
+
_ts_param7(2, (0, import_common9.Body)()),
|
|
993
|
+
_ts_metadata8("design:type", Function),
|
|
994
|
+
_ts_metadata8("design:paramtypes", [
|
|
937
995
|
typeof Request === "undefined" ? Object : Request,
|
|
938
996
|
String,
|
|
939
997
|
typeof RenameThreadBody === "undefined" ? Object : RenameThreadBody
|
|
940
998
|
]),
|
|
941
|
-
|
|
999
|
+
_ts_metadata8("design:returntype", Promise)
|
|
942
1000
|
], ThreadsController.prototype, "rename", null);
|
|
943
|
-
|
|
944
|
-
(0,
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1001
|
+
_ts_decorate9([
|
|
1002
|
+
(0, import_common9.Post)(":id/promote"),
|
|
1003
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
1004
|
+
_ts_param7(1, (0, import_common9.Param)("id")),
|
|
1005
|
+
_ts_metadata8("design:type", Function),
|
|
1006
|
+
_ts_metadata8("design:paramtypes", [
|
|
949
1007
|
typeof Request === "undefined" ? Object : Request,
|
|
950
1008
|
String
|
|
951
1009
|
]),
|
|
952
|
-
|
|
1010
|
+
_ts_metadata8("design:returntype", Promise)
|
|
953
1011
|
], ThreadsController.prototype, "promote", null);
|
|
954
|
-
|
|
955
|
-
(0,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1012
|
+
_ts_decorate9([
|
|
1013
|
+
(0, import_common9.Delete)(":id/from/:messageId"),
|
|
1014
|
+
_ts_param7(0, (0, import_common9.Req)()),
|
|
1015
|
+
_ts_param7(1, (0, import_common9.Param)("id")),
|
|
1016
|
+
_ts_param7(2, (0, import_common9.Param)("messageId")),
|
|
1017
|
+
_ts_metadata8("design:type", Function),
|
|
1018
|
+
_ts_metadata8("design:paramtypes", [
|
|
961
1019
|
typeof Request === "undefined" ? Object : Request,
|
|
962
1020
|
String,
|
|
963
1021
|
String
|
|
964
1022
|
]),
|
|
965
|
-
|
|
1023
|
+
_ts_metadata8("design:returntype", Promise)
|
|
966
1024
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
967
|
-
ThreadsController =
|
|
968
|
-
(0,
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1025
|
+
ThreadsController = _ts_decorate9([
|
|
1026
|
+
(0, import_common9.Controller)("threads"),
|
|
1027
|
+
_ts_param7(1, (0, import_common9.Inject)(import_nestjs_agent_core9.AGENT_ACTOR_RESOLVER)),
|
|
1028
|
+
_ts_metadata8("design:type", Function),
|
|
1029
|
+
_ts_metadata8("design:paramtypes", [
|
|
972
1030
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
973
1031
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
974
1032
|
])
|
|
975
1033
|
], ThreadsController);
|
|
976
1034
|
|
|
977
1035
|
// src/controller/tool-call.controller.ts
|
|
978
|
-
var
|
|
979
|
-
var
|
|
980
|
-
function
|
|
1036
|
+
var import_nestjs_agent_core10 = require("@dudousxd/nestjs-agent-core");
|
|
1037
|
+
var import_common10 = require("@nestjs/common");
|
|
1038
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
981
1039
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
982
1040
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
983
1041
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
984
1042
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
985
1043
|
}
|
|
986
|
-
__name(
|
|
987
|
-
function
|
|
1044
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1045
|
+
function _ts_metadata9(k, v) {
|
|
988
1046
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
989
1047
|
}
|
|
990
|
-
__name(
|
|
991
|
-
function
|
|
1048
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1049
|
+
function _ts_param8(paramIndex, decorator) {
|
|
992
1050
|
return function(target, key) {
|
|
993
1051
|
decorator(target, key, paramIndex);
|
|
994
1052
|
};
|
|
995
1053
|
}
|
|
996
|
-
__name(
|
|
1054
|
+
__name(_ts_param8, "_ts_param");
|
|
997
1055
|
var ToolCallController = class {
|
|
998
1056
|
static {
|
|
999
1057
|
__name(this, "ToolCallController");
|
|
@@ -1019,41 +1077,41 @@ var ToolCallController = class {
|
|
|
1019
1077
|
};
|
|
1020
1078
|
}
|
|
1021
1079
|
};
|
|
1022
|
-
|
|
1023
|
-
(0,
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1080
|
+
_ts_decorate10([
|
|
1081
|
+
(0, import_common10.Post)("approve"),
|
|
1082
|
+
_ts_param8(0, (0, import_common10.Req)()),
|
|
1083
|
+
_ts_param8(1, (0, import_common10.Body)()),
|
|
1084
|
+
_ts_metadata9("design:type", Function),
|
|
1085
|
+
_ts_metadata9("design:paramtypes", [
|
|
1028
1086
|
typeof Request === "undefined" ? Object : Request,
|
|
1029
1087
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
1030
1088
|
]),
|
|
1031
|
-
|
|
1089
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1032
1090
|
], ToolCallController.prototype, "approve", null);
|
|
1033
|
-
|
|
1034
|
-
(0,
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1091
|
+
_ts_decorate10([
|
|
1092
|
+
(0, import_common10.Post)("reject"),
|
|
1093
|
+
_ts_param8(0, (0, import_common10.Req)()),
|
|
1094
|
+
_ts_param8(1, (0, import_common10.Body)()),
|
|
1095
|
+
_ts_metadata9("design:type", Function),
|
|
1096
|
+
_ts_metadata9("design:paramtypes", [
|
|
1039
1097
|
typeof Request === "undefined" ? Object : Request,
|
|
1040
1098
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
1041
1099
|
]),
|
|
1042
|
-
|
|
1100
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1043
1101
|
], ToolCallController.prototype, "reject", null);
|
|
1044
|
-
ToolCallController =
|
|
1045
|
-
(0,
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1102
|
+
ToolCallController = _ts_decorate10([
|
|
1103
|
+
(0, import_common10.Controller)("tool-call"),
|
|
1104
|
+
_ts_param8(1, (0, import_common10.Inject)(import_nestjs_agent_core10.AGENT_ACTOR_RESOLVER)),
|
|
1105
|
+
_ts_metadata9("design:type", Function),
|
|
1106
|
+
_ts_metadata9("design:paramtypes", [
|
|
1049
1107
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1050
1108
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1051
1109
|
])
|
|
1052
1110
|
], ToolCallController);
|
|
1053
1111
|
|
|
1054
1112
|
// src/discovery/agent-discovery.service.ts
|
|
1055
|
-
var
|
|
1056
|
-
var
|
|
1113
|
+
var import_nestjs_agent_core11 = require("@dudousxd/nestjs-agent-core");
|
|
1114
|
+
var import_common11 = require("@nestjs/common");
|
|
1057
1115
|
var import_core = require("@nestjs/core");
|
|
1058
1116
|
|
|
1059
1117
|
// src/decorator/agent.decorator.ts
|
|
@@ -1070,23 +1128,23 @@ var SYSTEM_PROMPT_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt");
|
|
|
1070
1128
|
var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
|
|
1071
1129
|
|
|
1072
1130
|
// src/discovery/agent-discovery.service.ts
|
|
1073
|
-
function
|
|
1131
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1074
1132
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1075
1133
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1076
1134
|
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;
|
|
1077
1135
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1078
1136
|
}
|
|
1079
|
-
__name(
|
|
1080
|
-
function
|
|
1137
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1138
|
+
function _ts_metadata10(k, v) {
|
|
1081
1139
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1082
1140
|
}
|
|
1083
|
-
__name(
|
|
1084
|
-
function
|
|
1141
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1142
|
+
function _ts_param9(paramIndex, decorator) {
|
|
1085
1143
|
return function(target, key) {
|
|
1086
1144
|
decorator(target, key, paramIndex);
|
|
1087
1145
|
};
|
|
1088
1146
|
}
|
|
1089
|
-
__name(
|
|
1147
|
+
__name(_ts_param9, "_ts_param");
|
|
1090
1148
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
1091
1149
|
static {
|
|
1092
1150
|
__name(this, "AgentDiscoveryService");
|
|
@@ -1095,7 +1153,7 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1095
1153
|
scanner;
|
|
1096
1154
|
registry;
|
|
1097
1155
|
contributors;
|
|
1098
|
-
logger = new
|
|
1156
|
+
logger = new import_common11.Logger(_AgentDiscoveryService.name);
|
|
1099
1157
|
constructor(discovery, scanner, registry, contributors) {
|
|
1100
1158
|
this.discovery = discovery;
|
|
1101
1159
|
this.scanner = scanner;
|
|
@@ -1121,6 +1179,9 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1121
1179
|
const systemPrompt = promptMethod !== void 0 ? (ctx) => promptMethod(ctx) : meta.systemPrompt ?? "You are a helpful assistant.";
|
|
1122
1180
|
return {
|
|
1123
1181
|
name: meta.name,
|
|
1182
|
+
...meta.description !== void 0 ? {
|
|
1183
|
+
description: meta.description
|
|
1184
|
+
} : {},
|
|
1124
1185
|
systemPrompt,
|
|
1125
1186
|
...meta.tools !== void 0 ? {
|
|
1126
1187
|
tools: meta.tools
|
|
@@ -1180,22 +1241,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1180
1241
|
return (ctx) => candidate.call(instance, ctx);
|
|
1181
1242
|
}
|
|
1182
1243
|
};
|
|
1183
|
-
AgentDiscoveryService =
|
|
1184
|
-
(0,
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1244
|
+
AgentDiscoveryService = _ts_decorate11([
|
|
1245
|
+
(0, import_common11.Injectable)(),
|
|
1246
|
+
_ts_param9(2, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_REGISTRY)),
|
|
1247
|
+
_ts_param9(3, (0, import_common11.Inject)(import_nestjs_agent_core11.AGENT_PROMPT_CONTRIBUTORS)),
|
|
1248
|
+
_ts_metadata10("design:type", Function),
|
|
1249
|
+
_ts_metadata10("design:paramtypes", [
|
|
1189
1250
|
typeof import_core.DiscoveryService === "undefined" ? Object : import_core.DiscoveryService,
|
|
1190
1251
|
typeof import_core.MetadataScanner === "undefined" ? Object : import_core.MetadataScanner,
|
|
1191
|
-
typeof
|
|
1252
|
+
typeof import_nestjs_agent_core11.AgentRegistry === "undefined" ? Object : import_nestjs_agent_core11.AgentRegistry,
|
|
1192
1253
|
Array
|
|
1193
1254
|
])
|
|
1194
1255
|
], AgentDiscoveryService);
|
|
1195
1256
|
|
|
1196
1257
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1197
|
-
var
|
|
1198
|
-
var
|
|
1258
|
+
var import_nestjs_agent_core12 = require("@dudousxd/nestjs-agent-core");
|
|
1259
|
+
var import_common12 = require("@nestjs/common");
|
|
1199
1260
|
var import_core2 = require("@nestjs/core");
|
|
1200
1261
|
var import_zod = require("zod");
|
|
1201
1262
|
|
|
@@ -1215,23 +1276,23 @@ function isBrandedFunctionalTool(value) {
|
|
|
1215
1276
|
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
1216
1277
|
|
|
1217
1278
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1218
|
-
function
|
|
1279
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1219
1280
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1220
1281
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1221
1282
|
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;
|
|
1222
1283
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1223
1284
|
}
|
|
1224
|
-
__name(
|
|
1225
|
-
function
|
|
1285
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1286
|
+
function _ts_metadata11(k, v) {
|
|
1226
1287
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1227
1288
|
}
|
|
1228
|
-
__name(
|
|
1229
|
-
function
|
|
1289
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1290
|
+
function _ts_param10(paramIndex, decorator) {
|
|
1230
1291
|
return function(target, key) {
|
|
1231
1292
|
decorator(target, key, paramIndex);
|
|
1232
1293
|
};
|
|
1233
1294
|
}
|
|
1234
|
-
__name(
|
|
1295
|
+
__name(_ts_param10, "_ts_param");
|
|
1235
1296
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
1236
1297
|
static {
|
|
1237
1298
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -1240,7 +1301,7 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1240
1301
|
registry;
|
|
1241
1302
|
agents;
|
|
1242
1303
|
options;
|
|
1243
|
-
logger = new
|
|
1304
|
+
logger = new import_common12.Logger(_AiToolDiscoveryService.name);
|
|
1244
1305
|
constructor(discovery, registry, agents, options) {
|
|
1245
1306
|
this.discovery = discovery;
|
|
1246
1307
|
this.registry = registry;
|
|
@@ -1338,13 +1399,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1338
1399
|
return true;
|
|
1339
1400
|
}
|
|
1340
1401
|
};
|
|
1341
|
-
AiToolDiscoveryService =
|
|
1342
|
-
(0,
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1402
|
+
AiToolDiscoveryService = _ts_decorate12([
|
|
1403
|
+
(0, import_common12.Injectable)(),
|
|
1404
|
+
_ts_param10(1, (0, import_common12.Inject)(import_nestjs_agent_core12.AGENT_TOOL_REGISTRY)),
|
|
1405
|
+
_ts_param10(2, (0, import_common12.Inject)(import_nestjs_agent_core12.AGENT_REGISTRY)),
|
|
1406
|
+
_ts_param10(3, (0, import_common12.Inject)(import_nestjs_agent_core12.AGENT_OPTIONS)),
|
|
1407
|
+
_ts_metadata11("design:type", Function),
|
|
1408
|
+
_ts_metadata11("design:paramtypes", [
|
|
1348
1409
|
typeof import_core2.DiscoveryService === "undefined" ? Object : import_core2.DiscoveryService,
|
|
1349
1410
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1350
1411
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1353,7 +1414,7 @@ AiToolDiscoveryService = _ts_decorate11([
|
|
|
1353
1414
|
], AiToolDiscoveryService);
|
|
1354
1415
|
|
|
1355
1416
|
// src/in-process-sink.ts
|
|
1356
|
-
var
|
|
1417
|
+
var import_nestjs_agent_core13 = require("@dudousxd/nestjs-agent-core");
|
|
1357
1418
|
var InProcessTokenStreamSink = class {
|
|
1358
1419
|
static {
|
|
1359
1420
|
__name(this, "InProcessTokenStreamSink");
|
|
@@ -1408,7 +1469,7 @@ var InProcessTokenStreamSink = class {
|
|
|
1408
1469
|
}
|
|
1409
1470
|
if (buf.ended) {
|
|
1410
1471
|
if (buf.failure !== void 0) {
|
|
1411
|
-
throw new
|
|
1472
|
+
throw new import_nestjs_agent_core13.AgentStreamError(buf.failure);
|
|
1412
1473
|
}
|
|
1413
1474
|
return;
|
|
1414
1475
|
}
|
|
@@ -1444,32 +1505,32 @@ var LedgerQuotaStore = class {
|
|
|
1444
1505
|
};
|
|
1445
1506
|
|
|
1446
1507
|
// src/runner/inline-agent-runner.ts
|
|
1447
|
-
var
|
|
1448
|
-
var
|
|
1449
|
-
function
|
|
1508
|
+
var import_nestjs_agent_core14 = require("@dudousxd/nestjs-agent-core");
|
|
1509
|
+
var import_common13 = require("@nestjs/common");
|
|
1510
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1450
1511
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1451
1512
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1452
1513
|
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;
|
|
1453
1514
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1454
1515
|
}
|
|
1455
|
-
__name(
|
|
1456
|
-
function
|
|
1516
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1517
|
+
function _ts_metadata12(k, v) {
|
|
1457
1518
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1458
1519
|
}
|
|
1459
|
-
__name(
|
|
1460
|
-
function
|
|
1520
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1521
|
+
function _ts_param11(paramIndex, decorator) {
|
|
1461
1522
|
return function(target, key) {
|
|
1462
1523
|
decorator(target, key, paramIndex);
|
|
1463
1524
|
};
|
|
1464
1525
|
}
|
|
1465
|
-
__name(
|
|
1526
|
+
__name(_ts_param11, "_ts_param");
|
|
1466
1527
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
1467
1528
|
static {
|
|
1468
1529
|
__name(this, "InlineAgentRunner");
|
|
1469
1530
|
}
|
|
1470
1531
|
factory;
|
|
1471
1532
|
store;
|
|
1472
|
-
logger = new
|
|
1533
|
+
logger = new import_common13.Logger(_InlineAgentRunner.name);
|
|
1473
1534
|
pending = /* @__PURE__ */ new Map();
|
|
1474
1535
|
constructor(factory, store) {
|
|
1475
1536
|
this.factory = factory;
|
|
@@ -1480,14 +1541,14 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1480
1541
|
const day = input.day ?? utcDay();
|
|
1481
1542
|
const deps = this.factory.forAgent(input.agentName);
|
|
1482
1543
|
const hooks = this.topLevelHooks(runId, deps, input.actor, day);
|
|
1483
|
-
void (0,
|
|
1544
|
+
void (0, import_nestjs_agent_core14.runAgentLoop)({
|
|
1484
1545
|
...deps,
|
|
1485
1546
|
day
|
|
1486
1547
|
}, input, hooks).catch(async (error) => {
|
|
1487
1548
|
const message = error instanceof Error ? error.message : String(error);
|
|
1488
|
-
const code = error instanceof
|
|
1549
|
+
const code = error instanceof import_nestjs_agent_core14.QuotaExceededError ? "quota_exceeded" : "run_failed";
|
|
1489
1550
|
this.logger.error(`agent run ${runId} failed (${code}): ${message}`);
|
|
1490
|
-
(0,
|
|
1551
|
+
(0, import_nestjs_agent_core14.publishAgentRunFailed)({
|
|
1491
1552
|
runId,
|
|
1492
1553
|
code,
|
|
1493
1554
|
message
|
|
@@ -1549,7 +1610,7 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1549
1610
|
step: /* @__PURE__ */ __name((_name, fn) => fn(), "step"),
|
|
1550
1611
|
runAgent: /* @__PURE__ */ __name((childName, childTask) => this.runNested(childName, childTask, actor, day, depth + 1, sinkRunId), "runAgent")
|
|
1551
1612
|
};
|
|
1552
|
-
return (0,
|
|
1613
|
+
return (0, import_nestjs_agent_core14.runAgentLoop)({
|
|
1553
1614
|
...deps,
|
|
1554
1615
|
day
|
|
1555
1616
|
}, {
|
|
@@ -1563,84 +1624,84 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1563
1624
|
}, hooks);
|
|
1564
1625
|
}
|
|
1565
1626
|
};
|
|
1566
|
-
InlineAgentRunner =
|
|
1567
|
-
(0,
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1627
|
+
InlineAgentRunner = _ts_decorate13([
|
|
1628
|
+
(0, import_common13.Injectable)(),
|
|
1629
|
+
_ts_param11(0, (0, import_common13.Inject)(import_nestjs_agent_core14.AGENT_DEPS_FACTORY)),
|
|
1630
|
+
_ts_param11(1, (0, import_common13.Inject)(import_nestjs_agent_core14.AGENT_STORE)),
|
|
1631
|
+
_ts_metadata12("design:type", Function),
|
|
1632
|
+
_ts_metadata12("design:paramtypes", [
|
|
1572
1633
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1573
1634
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1574
1635
|
])
|
|
1575
1636
|
], InlineAgentRunner);
|
|
1576
1637
|
|
|
1577
1638
|
// src/agent.module.ts
|
|
1578
|
-
function
|
|
1639
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1579
1640
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1580
1641
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1581
1642
|
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;
|
|
1582
1643
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1583
1644
|
}
|
|
1584
|
-
__name(
|
|
1645
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1585
1646
|
var DEFAULT_PATH = "agent";
|
|
1586
1647
|
function sharedProviders(durable, includeStore) {
|
|
1587
1648
|
const providers = [
|
|
1588
1649
|
{
|
|
1589
|
-
provide:
|
|
1590
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
1650
|
+
provide: import_nestjs_agent_core15.AGENT_TOOL_REGISTRY,
|
|
1651
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core15.ToolRegistry(), "useFactory")
|
|
1591
1652
|
},
|
|
1592
1653
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
1593
1654
|
{
|
|
1594
|
-
provide:
|
|
1595
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
1655
|
+
provide: import_nestjs_agent_core15.AGENT_REGISTRY,
|
|
1656
|
+
useFactory: /* @__PURE__ */ __name(() => new import_nestjs_agent_core15.AgentRegistry(), "useFactory")
|
|
1596
1657
|
},
|
|
1597
1658
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
1598
1659
|
{
|
|
1599
|
-
provide:
|
|
1660
|
+
provide: import_nestjs_agent_core15.AGENT_PROMPT_CONTRIBUTORS,
|
|
1600
1661
|
useFactory: /* @__PURE__ */ __name(() => [], "useFactory")
|
|
1601
1662
|
},
|
|
1602
1663
|
{
|
|
1603
|
-
provide:
|
|
1664
|
+
provide: import_nestjs_agent_core15.AGENT_SINK,
|
|
1604
1665
|
useFactory: /* @__PURE__ */ __name((options) => options.sink ?? new InProcessTokenStreamSink(), "useFactory"),
|
|
1605
1666
|
inject: [
|
|
1606
|
-
|
|
1667
|
+
import_nestjs_agent_core15.AGENT_OPTIONS
|
|
1607
1668
|
]
|
|
1608
1669
|
},
|
|
1609
1670
|
{
|
|
1610
|
-
provide:
|
|
1611
|
-
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new
|
|
1671
|
+
provide: import_nestjs_agent_core15.AGENT_ROLES_POLICY,
|
|
1672
|
+
useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core15.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
|
|
1612
1673
|
inject: [
|
|
1613
|
-
|
|
1674
|
+
import_nestjs_agent_core15.AGENT_OPTIONS
|
|
1614
1675
|
]
|
|
1615
1676
|
},
|
|
1616
1677
|
{
|
|
1617
|
-
provide:
|
|
1678
|
+
provide: import_nestjs_agent_core15.AGENT_ACTOR_RESOLVER,
|
|
1618
1679
|
useFactory: /* @__PURE__ */ __name((options) => options.actorResolver, "useFactory"),
|
|
1619
1680
|
inject: [
|
|
1620
|
-
|
|
1681
|
+
import_nestjs_agent_core15.AGENT_OPTIONS
|
|
1621
1682
|
]
|
|
1622
1683
|
},
|
|
1623
1684
|
{
|
|
1624
|
-
provide:
|
|
1685
|
+
provide: import_nestjs_agent_core15.AGENT_MODEL,
|
|
1625
1686
|
useFactory: /* @__PURE__ */ __name((o) => o.model, "useFactory"),
|
|
1626
1687
|
inject: [
|
|
1627
|
-
|
|
1688
|
+
import_nestjs_agent_core15.AGENT_OPTIONS
|
|
1628
1689
|
]
|
|
1629
1690
|
},
|
|
1630
1691
|
{
|
|
1631
1692
|
// An explicit `quota` wins; otherwise `quotaLimitTokens` binds the built-in ledger-backed
|
|
1632
1693
|
// store; otherwise quotas are off (undefined). The ledger store reads the same usage rows
|
|
1633
1694
|
// the loop already writes, so enforcement needs no extra shared state across replicas.
|
|
1634
|
-
provide:
|
|
1695
|
+
provide: import_nestjs_agent_core15.AGENT_QUOTA_STORE,
|
|
1635
1696
|
useFactory: /* @__PURE__ */ __name((o, store) => o.quota ?? (o.quotaLimitTokens !== void 0 ? new LedgerQuotaStore(store, o.quotaLimitTokens) : void 0), "useFactory"),
|
|
1636
1697
|
inject: [
|
|
1637
|
-
|
|
1638
|
-
|
|
1698
|
+
import_nestjs_agent_core15.AGENT_OPTIONS,
|
|
1699
|
+
import_nestjs_agent_core15.AGENT_STORE
|
|
1639
1700
|
]
|
|
1640
1701
|
},
|
|
1641
1702
|
AgentDepsFactory2,
|
|
1642
1703
|
{
|
|
1643
|
-
provide:
|
|
1704
|
+
provide: import_nestjs_agent_core15.AGENT_DEPS_FACTORY,
|
|
1644
1705
|
useExisting: AgentDepsFactory2
|
|
1645
1706
|
},
|
|
1646
1707
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -1652,16 +1713,16 @@ function sharedProviders(durable, includeStore) {
|
|
|
1652
1713
|
];
|
|
1653
1714
|
if (includeStore) {
|
|
1654
1715
|
providers.push({
|
|
1655
|
-
provide:
|
|
1716
|
+
provide: import_nestjs_agent_core15.AGENT_STORE,
|
|
1656
1717
|
useFactory: /* @__PURE__ */ __name((o) => o.store, "useFactory"),
|
|
1657
1718
|
inject: [
|
|
1658
|
-
|
|
1719
|
+
import_nestjs_agent_core15.AGENT_OPTIONS
|
|
1659
1720
|
]
|
|
1660
1721
|
});
|
|
1661
1722
|
}
|
|
1662
1723
|
if (durable) {
|
|
1663
1724
|
providers.push({
|
|
1664
|
-
provide:
|
|
1725
|
+
provide: import_nestjs_agent_core15.AGENT_RUNNER,
|
|
1665
1726
|
useFactory: /* @__PURE__ */ __name((durableRunner) => {
|
|
1666
1727
|
if (durableRunner === void 0) {
|
|
1667
1728
|
throw new Error("AgentModule.forRoot({ durable: true }) requires importing AgentDurableModule from '@dudousxd/nestjs-agent/durable' (alongside a configured DurableModule). It was not found.");
|
|
@@ -1670,14 +1731,14 @@ function sharedProviders(durable, includeStore) {
|
|
|
1670
1731
|
}, "useFactory"),
|
|
1671
1732
|
inject: [
|
|
1672
1733
|
{
|
|
1673
|
-
token:
|
|
1734
|
+
token: import_nestjs_agent_core15.AGENT_DURABLE_RUNNER,
|
|
1674
1735
|
optional: true
|
|
1675
1736
|
}
|
|
1676
1737
|
]
|
|
1677
1738
|
});
|
|
1678
1739
|
} else {
|
|
1679
1740
|
providers.push({
|
|
1680
|
-
provide:
|
|
1741
|
+
provide: import_nestjs_agent_core15.AGENT_RUNNER,
|
|
1681
1742
|
useExisting: InlineAgentRunner
|
|
1682
1743
|
});
|
|
1683
1744
|
}
|
|
@@ -1686,19 +1747,19 @@ function sharedProviders(durable, includeStore) {
|
|
|
1686
1747
|
__name(sharedProviders, "sharedProviders");
|
|
1687
1748
|
function exportsFor(includeStore) {
|
|
1688
1749
|
return [
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1750
|
+
import_nestjs_agent_core15.AGENT_OPTIONS,
|
|
1751
|
+
import_nestjs_agent_core15.AGENT_TOOL_REGISTRY,
|
|
1752
|
+
import_nestjs_agent_core15.AGENT_REGISTRY,
|
|
1753
|
+
import_nestjs_agent_core15.AGENT_SINK,
|
|
1754
|
+
import_nestjs_agent_core15.AGENT_ROLES_POLICY,
|
|
1755
|
+
import_nestjs_agent_core15.AGENT_ACTOR_RESOLVER,
|
|
1756
|
+
import_nestjs_agent_core15.AGENT_MODEL,
|
|
1696
1757
|
...includeStore ? [
|
|
1697
|
-
|
|
1758
|
+
import_nestjs_agent_core15.AGENT_STORE
|
|
1698
1759
|
] : [],
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1760
|
+
import_nestjs_agent_core15.AGENT_QUOTA_STORE,
|
|
1761
|
+
import_nestjs_agent_core15.AGENT_PROMPT_CONTRIBUTORS,
|
|
1762
|
+
import_nestjs_agent_core15.AGENT_DEPS_FACTORY,
|
|
1702
1763
|
AgentDepsFactory2,
|
|
1703
1764
|
AgentService,
|
|
1704
1765
|
InlineAgentRunner
|
|
@@ -1709,7 +1770,8 @@ var CONTROLLERS = [
|
|
|
1709
1770
|
ChatController,
|
|
1710
1771
|
ThreadsController,
|
|
1711
1772
|
ToolCallController,
|
|
1712
|
-
QuotaController
|
|
1773
|
+
QuotaController,
|
|
1774
|
+
AgentsController
|
|
1713
1775
|
];
|
|
1714
1776
|
function routerFor(path) {
|
|
1715
1777
|
return import_core3.RouterModule.register([
|
|
@@ -1737,7 +1799,7 @@ var AgentModule = class _AgentModule {
|
|
|
1737
1799
|
controllers: CONTROLLERS,
|
|
1738
1800
|
providers: [
|
|
1739
1801
|
{
|
|
1740
|
-
provide:
|
|
1802
|
+
provide: import_nestjs_agent_core15.AGENT_OPTIONS,
|
|
1741
1803
|
useValue: options
|
|
1742
1804
|
},
|
|
1743
1805
|
...sharedProviders(options.durable ?? false, includeStore)
|
|
@@ -1758,7 +1820,7 @@ var AgentModule = class _AgentModule {
|
|
|
1758
1820
|
controllers: CONTROLLERS,
|
|
1759
1821
|
providers: [
|
|
1760
1822
|
{
|
|
1761
|
-
provide:
|
|
1823
|
+
provide: import_nestjs_agent_core15.AGENT_OPTIONS,
|
|
1762
1824
|
useFactory: options.useFactory,
|
|
1763
1825
|
inject: options.inject ?? []
|
|
1764
1826
|
},
|
|
@@ -1770,9 +1832,9 @@ var AgentModule = class _AgentModule {
|
|
|
1770
1832
|
};
|
|
1771
1833
|
}
|
|
1772
1834
|
};
|
|
1773
|
-
AgentModule =
|
|
1774
|
-
(0,
|
|
1775
|
-
(0,
|
|
1835
|
+
AgentModule = _ts_decorate14([
|
|
1836
|
+
(0, import_common14.Global)(),
|
|
1837
|
+
(0, import_common14.Module)({})
|
|
1776
1838
|
], AgentModule);
|
|
1777
1839
|
|
|
1778
1840
|
// src/durable/agent-durable.ts
|