@dudousxd/nestjs-agent 0.3.0 → 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.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +241 -179
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/durable/index.js
CHANGED
|
@@ -215,7 +215,7 @@ AgentDurableModule = _ts_decorate3([
|
|
|
215
215
|
], AgentDurableModule);
|
|
216
216
|
|
|
217
217
|
// src/agent.module.ts
|
|
218
|
-
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5, AGENT_DEPS_FACTORY as
|
|
218
|
+
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER5, AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY5, AGENT_DURABLE_RUNNER as AGENT_DURABLE_RUNNER2, AGENT_MODEL as AGENT_MODEL2, AGENT_OPTIONS as AGENT_OPTIONS3, AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS3, AGENT_QUOTA_STORE as AGENT_QUOTA_STORE3, AGENT_REGISTRY as AGENT_REGISTRY5, AGENT_ROLES_POLICY as AGENT_ROLES_POLICY2, AGENT_RUNNER as AGENT_RUNNER2, AGENT_SINK as AGENT_SINK2, AGENT_STORE as AGENT_STORE5, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY3, AgentRegistry as AgentRegistry5, DefaultRolesPolicy, ToolRegistry as ToolRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
219
219
|
import { Global as Global2, Module as Module2 } from "@nestjs/common";
|
|
220
220
|
import { DiscoveryModule, RouterModule } from "@nestjs/core";
|
|
221
221
|
|
|
@@ -582,9 +582,9 @@ AgentService = _ts_decorate5([
|
|
|
582
582
|
])
|
|
583
583
|
], AgentService);
|
|
584
584
|
|
|
585
|
-
// src/controller/
|
|
586
|
-
import {
|
|
587
|
-
import {
|
|
585
|
+
// src/controller/agents.controller.ts
|
|
586
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY3, AGENT_REGISTRY as AGENT_REGISTRY2, AgentRegistry as AgentRegistry3 } from "@dudousxd/nestjs-agent-core";
|
|
587
|
+
import { Controller, Get, Inject as Inject4 } from "@nestjs/common";
|
|
588
588
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
589
589
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
590
590
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -602,6 +602,64 @@ function _ts_param4(paramIndex, decorator) {
|
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
604
|
__name(_ts_param4, "_ts_param");
|
|
605
|
+
var AgentsController = class {
|
|
606
|
+
static {
|
|
607
|
+
__name(this, "AgentsController");
|
|
608
|
+
}
|
|
609
|
+
agents;
|
|
610
|
+
depsFactory;
|
|
611
|
+
constructor(agents, depsFactory) {
|
|
612
|
+
this.agents = agents;
|
|
613
|
+
this.depsFactory = depsFactory;
|
|
614
|
+
}
|
|
615
|
+
list() {
|
|
616
|
+
const defaultAgentName = this.depsFactory.defaultAgentName();
|
|
617
|
+
return this.agents.list().map((definition) => ({
|
|
618
|
+
name: definition.name,
|
|
619
|
+
description: definition.description ?? "",
|
|
620
|
+
...definition.name === defaultAgentName ? {
|
|
621
|
+
isDefault: true
|
|
622
|
+
} : {}
|
|
623
|
+
}));
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
_ts_decorate6([
|
|
627
|
+
Get(),
|
|
628
|
+
_ts_metadata5("design:type", Function),
|
|
629
|
+
_ts_metadata5("design:paramtypes", []),
|
|
630
|
+
_ts_metadata5("design:returntype", Array)
|
|
631
|
+
], AgentsController.prototype, "list", null);
|
|
632
|
+
AgentsController = _ts_decorate6([
|
|
633
|
+
Controller("agents"),
|
|
634
|
+
_ts_param4(0, Inject4(AGENT_REGISTRY2)),
|
|
635
|
+
_ts_param4(1, Inject4(AGENT_DEPS_FACTORY3)),
|
|
636
|
+
_ts_metadata5("design:type", Function),
|
|
637
|
+
_ts_metadata5("design:paramtypes", [
|
|
638
|
+
typeof AgentRegistry3 === "undefined" ? Object : AgentRegistry3,
|
|
639
|
+
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory
|
|
640
|
+
])
|
|
641
|
+
], AgentsController);
|
|
642
|
+
|
|
643
|
+
// src/controller/chat.controller.ts
|
|
644
|
+
import { AGENT_ACTOR_RESOLVER, AgentStreamError } from "@dudousxd/nestjs-agent-core";
|
|
645
|
+
import { Body, Controller as Controller2, Get as Get2, Inject as Inject5, Param, Post, Req, Res } from "@nestjs/common";
|
|
646
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
647
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
648
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
649
|
+
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;
|
|
650
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
651
|
+
}
|
|
652
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
653
|
+
function _ts_metadata6(k, v) {
|
|
654
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
655
|
+
}
|
|
656
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
657
|
+
function _ts_param5(paramIndex, decorator) {
|
|
658
|
+
return function(target, key) {
|
|
659
|
+
decorator(target, key, paramIndex);
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
__name(_ts_param5, "_ts_param");
|
|
605
663
|
var ChatController = class {
|
|
606
664
|
static {
|
|
607
665
|
__name(this, "ChatController");
|
|
@@ -686,46 +744,46 @@ data: ${JSON.stringify(payload)}
|
|
|
686
744
|
res.end();
|
|
687
745
|
}
|
|
688
746
|
};
|
|
689
|
-
|
|
747
|
+
_ts_decorate7([
|
|
690
748
|
Post("chat"),
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
749
|
+
_ts_param5(0, Req()),
|
|
750
|
+
_ts_param5(1, Res()),
|
|
751
|
+
_ts_param5(2, Body()),
|
|
752
|
+
_ts_metadata6("design:type", Function),
|
|
753
|
+
_ts_metadata6("design:paramtypes", [
|
|
696
754
|
typeof Request === "undefined" ? Object : Request,
|
|
697
755
|
typeof Response === "undefined" ? Object : Response,
|
|
698
756
|
typeof ChatBody === "undefined" ? Object : ChatBody
|
|
699
757
|
]),
|
|
700
|
-
|
|
758
|
+
_ts_metadata6("design:returntype", Promise)
|
|
701
759
|
], ChatController.prototype, "chat", null);
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
760
|
+
_ts_decorate7([
|
|
761
|
+
Get2("chat/:runId/stream"),
|
|
762
|
+
_ts_param5(0, Param("runId")),
|
|
763
|
+
_ts_param5(1, Res()),
|
|
764
|
+
_ts_metadata6("design:type", Function),
|
|
765
|
+
_ts_metadata6("design:paramtypes", [
|
|
708
766
|
String,
|
|
709
767
|
typeof Response === "undefined" ? Object : Response
|
|
710
768
|
]),
|
|
711
|
-
|
|
769
|
+
_ts_metadata6("design:returntype", Promise)
|
|
712
770
|
], ChatController.prototype, "stream", null);
|
|
713
|
-
|
|
771
|
+
_ts_decorate7([
|
|
714
772
|
Post("chat/:runId/cancel"),
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
773
|
+
_ts_param5(0, Req()),
|
|
774
|
+
_ts_param5(1, Param("runId")),
|
|
775
|
+
_ts_metadata6("design:type", Function),
|
|
776
|
+
_ts_metadata6("design:paramtypes", [
|
|
719
777
|
typeof Request === "undefined" ? Object : Request,
|
|
720
778
|
String
|
|
721
779
|
]),
|
|
722
|
-
|
|
780
|
+
_ts_metadata6("design:returntype", Promise)
|
|
723
781
|
], ChatController.prototype, "cancel", null);
|
|
724
|
-
ChatController =
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
782
|
+
ChatController = _ts_decorate7([
|
|
783
|
+
Controller2(),
|
|
784
|
+
_ts_param5(1, Inject5(AGENT_ACTOR_RESOLVER)),
|
|
785
|
+
_ts_metadata6("design:type", Function),
|
|
786
|
+
_ts_metadata6("design:paramtypes", [
|
|
729
787
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
730
788
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
731
789
|
])
|
|
@@ -733,24 +791,24 @@ ChatController = _ts_decorate6([
|
|
|
733
791
|
|
|
734
792
|
// src/controller/quota.controller.ts
|
|
735
793
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER2 } from "@dudousxd/nestjs-agent-core";
|
|
736
|
-
import { Controller as
|
|
737
|
-
function
|
|
794
|
+
import { Controller as Controller3, Get as Get3, Inject as Inject6, Req as Req2 } from "@nestjs/common";
|
|
795
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
738
796
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
739
797
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
740
798
|
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;
|
|
741
799
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
742
800
|
}
|
|
743
|
-
__name(
|
|
744
|
-
function
|
|
801
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
802
|
+
function _ts_metadata7(k, v) {
|
|
745
803
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
746
804
|
}
|
|
747
|
-
__name(
|
|
748
|
-
function
|
|
805
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
806
|
+
function _ts_param6(paramIndex, decorator) {
|
|
749
807
|
return function(target, key) {
|
|
750
808
|
decorator(target, key, paramIndex);
|
|
751
809
|
};
|
|
752
810
|
}
|
|
753
|
-
__name(
|
|
811
|
+
__name(_ts_param6, "_ts_param");
|
|
754
812
|
var QuotaController = class {
|
|
755
813
|
static {
|
|
756
814
|
__name(this, "QuotaController");
|
|
@@ -766,20 +824,20 @@ var QuotaController = class {
|
|
|
766
824
|
return this.agent.quotaToday(actor.id);
|
|
767
825
|
}
|
|
768
826
|
};
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
827
|
+
_ts_decorate8([
|
|
828
|
+
Get3("today"),
|
|
829
|
+
_ts_param6(0, Req2()),
|
|
830
|
+
_ts_metadata7("design:type", Function),
|
|
831
|
+
_ts_metadata7("design:paramtypes", [
|
|
774
832
|
typeof Request === "undefined" ? Object : Request
|
|
775
833
|
]),
|
|
776
|
-
|
|
834
|
+
_ts_metadata7("design:returntype", Promise)
|
|
777
835
|
], QuotaController.prototype, "today", null);
|
|
778
|
-
QuotaController =
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
836
|
+
QuotaController = _ts_decorate8([
|
|
837
|
+
Controller3("quota"),
|
|
838
|
+
_ts_param6(1, Inject6(AGENT_ACTOR_RESOLVER2)),
|
|
839
|
+
_ts_metadata7("design:type", Function),
|
|
840
|
+
_ts_metadata7("design:paramtypes", [
|
|
783
841
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
784
842
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
785
843
|
])
|
|
@@ -787,24 +845,24 @@ QuotaController = _ts_decorate7([
|
|
|
787
845
|
|
|
788
846
|
// src/controller/threads.controller.ts
|
|
789
847
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER3 } from "@dudousxd/nestjs-agent-core";
|
|
790
|
-
import { Body as Body2, Controller as
|
|
791
|
-
function
|
|
848
|
+
import { Body as Body2, Controller as Controller4, Delete, Get as Get4, Inject as Inject7, Param as Param2, Patch, Post as Post2, Req as Req3 } from "@nestjs/common";
|
|
849
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
792
850
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
793
851
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
794
852
|
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;
|
|
795
853
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
796
854
|
}
|
|
797
|
-
__name(
|
|
798
|
-
function
|
|
855
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
856
|
+
function _ts_metadata8(k, v) {
|
|
799
857
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
800
858
|
}
|
|
801
|
-
__name(
|
|
802
|
-
function
|
|
859
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
860
|
+
function _ts_param7(paramIndex, decorator) {
|
|
803
861
|
return function(target, key) {
|
|
804
862
|
decorator(target, key, paramIndex);
|
|
805
863
|
};
|
|
806
864
|
}
|
|
807
|
-
__name(
|
|
865
|
+
__name(_ts_param7, "_ts_param");
|
|
808
866
|
var ThreadsController = class {
|
|
809
867
|
static {
|
|
810
868
|
__name(this, "ThreadsController");
|
|
@@ -856,92 +914,92 @@ var ThreadsController = class {
|
|
|
856
914
|
};
|
|
857
915
|
}
|
|
858
916
|
};
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
917
|
+
_ts_decorate9([
|
|
918
|
+
Get4(),
|
|
919
|
+
_ts_param7(0, Req3()),
|
|
920
|
+
_ts_metadata8("design:type", Function),
|
|
921
|
+
_ts_metadata8("design:paramtypes", [
|
|
864
922
|
typeof Request === "undefined" ? Object : Request
|
|
865
923
|
]),
|
|
866
|
-
|
|
924
|
+
_ts_metadata8("design:returntype", Promise)
|
|
867
925
|
], ThreadsController.prototype, "list", null);
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
926
|
+
_ts_decorate9([
|
|
927
|
+
Get4(":id"),
|
|
928
|
+
_ts_param7(0, Req3()),
|
|
929
|
+
_ts_param7(1, Param2("id")),
|
|
930
|
+
_ts_metadata8("design:type", Function),
|
|
931
|
+
_ts_metadata8("design:paramtypes", [
|
|
874
932
|
typeof Request === "undefined" ? Object : Request,
|
|
875
933
|
String
|
|
876
934
|
]),
|
|
877
|
-
|
|
935
|
+
_ts_metadata8("design:returntype", Promise)
|
|
878
936
|
], ThreadsController.prototype, "detail", null);
|
|
879
|
-
|
|
937
|
+
_ts_decorate9([
|
|
880
938
|
Delete(":id"),
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
939
|
+
_ts_param7(0, Req3()),
|
|
940
|
+
_ts_param7(1, Param2("id")),
|
|
941
|
+
_ts_metadata8("design:type", Function),
|
|
942
|
+
_ts_metadata8("design:paramtypes", [
|
|
885
943
|
typeof Request === "undefined" ? Object : Request,
|
|
886
944
|
String
|
|
887
945
|
]),
|
|
888
|
-
|
|
946
|
+
_ts_metadata8("design:returntype", Promise)
|
|
889
947
|
], ThreadsController.prototype, "remove", null);
|
|
890
|
-
|
|
948
|
+
_ts_decorate9([
|
|
891
949
|
Post2(":id/fork-from/:messageId"),
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
950
|
+
_ts_param7(0, Req3()),
|
|
951
|
+
_ts_param7(1, Param2("id")),
|
|
952
|
+
_ts_param7(2, Param2("messageId")),
|
|
953
|
+
_ts_metadata8("design:type", Function),
|
|
954
|
+
_ts_metadata8("design:paramtypes", [
|
|
897
955
|
typeof Request === "undefined" ? Object : Request,
|
|
898
956
|
String,
|
|
899
957
|
String
|
|
900
958
|
]),
|
|
901
|
-
|
|
959
|
+
_ts_metadata8("design:returntype", Promise)
|
|
902
960
|
], ThreadsController.prototype, "fork", null);
|
|
903
|
-
|
|
961
|
+
_ts_decorate9([
|
|
904
962
|
Patch(":id"),
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
963
|
+
_ts_param7(0, Req3()),
|
|
964
|
+
_ts_param7(1, Param2("id")),
|
|
965
|
+
_ts_param7(2, Body2()),
|
|
966
|
+
_ts_metadata8("design:type", Function),
|
|
967
|
+
_ts_metadata8("design:paramtypes", [
|
|
910
968
|
typeof Request === "undefined" ? Object : Request,
|
|
911
969
|
String,
|
|
912
970
|
typeof RenameThreadBody === "undefined" ? Object : RenameThreadBody
|
|
913
971
|
]),
|
|
914
|
-
|
|
972
|
+
_ts_metadata8("design:returntype", Promise)
|
|
915
973
|
], ThreadsController.prototype, "rename", null);
|
|
916
|
-
|
|
974
|
+
_ts_decorate9([
|
|
917
975
|
Post2(":id/promote"),
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
976
|
+
_ts_param7(0, Req3()),
|
|
977
|
+
_ts_param7(1, Param2("id")),
|
|
978
|
+
_ts_metadata8("design:type", Function),
|
|
979
|
+
_ts_metadata8("design:paramtypes", [
|
|
922
980
|
typeof Request === "undefined" ? Object : Request,
|
|
923
981
|
String
|
|
924
982
|
]),
|
|
925
|
-
|
|
983
|
+
_ts_metadata8("design:returntype", Promise)
|
|
926
984
|
], ThreadsController.prototype, "promote", null);
|
|
927
|
-
|
|
985
|
+
_ts_decorate9([
|
|
928
986
|
Delete(":id/from/:messageId"),
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
987
|
+
_ts_param7(0, Req3()),
|
|
988
|
+
_ts_param7(1, Param2("id")),
|
|
989
|
+
_ts_param7(2, Param2("messageId")),
|
|
990
|
+
_ts_metadata8("design:type", Function),
|
|
991
|
+
_ts_metadata8("design:paramtypes", [
|
|
934
992
|
typeof Request === "undefined" ? Object : Request,
|
|
935
993
|
String,
|
|
936
994
|
String
|
|
937
995
|
]),
|
|
938
|
-
|
|
996
|
+
_ts_metadata8("design:returntype", Promise)
|
|
939
997
|
], ThreadsController.prototype, "truncateFrom", null);
|
|
940
|
-
ThreadsController =
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
998
|
+
ThreadsController = _ts_decorate9([
|
|
999
|
+
Controller4("threads"),
|
|
1000
|
+
_ts_param7(1, Inject7(AGENT_ACTOR_RESOLVER3)),
|
|
1001
|
+
_ts_metadata8("design:type", Function),
|
|
1002
|
+
_ts_metadata8("design:paramtypes", [
|
|
945
1003
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
946
1004
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
947
1005
|
])
|
|
@@ -949,24 +1007,24 @@ ThreadsController = _ts_decorate8([
|
|
|
949
1007
|
|
|
950
1008
|
// src/controller/tool-call.controller.ts
|
|
951
1009
|
import { AGENT_ACTOR_RESOLVER as AGENT_ACTOR_RESOLVER4 } from "@dudousxd/nestjs-agent-core";
|
|
952
|
-
import { Body as Body3, Controller as
|
|
953
|
-
function
|
|
1010
|
+
import { Body as Body3, Controller as Controller5, Inject as Inject8, Post as Post3, Req as Req4 } from "@nestjs/common";
|
|
1011
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
954
1012
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
955
1013
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
956
1014
|
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;
|
|
957
1015
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
958
1016
|
}
|
|
959
|
-
__name(
|
|
960
|
-
function
|
|
1017
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1018
|
+
function _ts_metadata9(k, v) {
|
|
961
1019
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
962
1020
|
}
|
|
963
|
-
__name(
|
|
964
|
-
function
|
|
1021
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1022
|
+
function _ts_param8(paramIndex, decorator) {
|
|
965
1023
|
return function(target, key) {
|
|
966
1024
|
decorator(target, key, paramIndex);
|
|
967
1025
|
};
|
|
968
1026
|
}
|
|
969
|
-
__name(
|
|
1027
|
+
__name(_ts_param8, "_ts_param");
|
|
970
1028
|
var ToolCallController = class {
|
|
971
1029
|
static {
|
|
972
1030
|
__name(this, "ToolCallController");
|
|
@@ -992,41 +1050,41 @@ var ToolCallController = class {
|
|
|
992
1050
|
};
|
|
993
1051
|
}
|
|
994
1052
|
};
|
|
995
|
-
|
|
1053
|
+
_ts_decorate10([
|
|
996
1054
|
Post3("approve"),
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1055
|
+
_ts_param8(0, Req4()),
|
|
1056
|
+
_ts_param8(1, Body3()),
|
|
1057
|
+
_ts_metadata9("design:type", Function),
|
|
1058
|
+
_ts_metadata9("design:paramtypes", [
|
|
1001
1059
|
typeof Request === "undefined" ? Object : Request,
|
|
1002
1060
|
typeof ApproveBody === "undefined" ? Object : ApproveBody
|
|
1003
1061
|
]),
|
|
1004
|
-
|
|
1062
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1005
1063
|
], ToolCallController.prototype, "approve", null);
|
|
1006
|
-
|
|
1064
|
+
_ts_decorate10([
|
|
1007
1065
|
Post3("reject"),
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1066
|
+
_ts_param8(0, Req4()),
|
|
1067
|
+
_ts_param8(1, Body3()),
|
|
1068
|
+
_ts_metadata9("design:type", Function),
|
|
1069
|
+
_ts_metadata9("design:paramtypes", [
|
|
1012
1070
|
typeof Request === "undefined" ? Object : Request,
|
|
1013
1071
|
typeof RejectBody === "undefined" ? Object : RejectBody
|
|
1014
1072
|
]),
|
|
1015
|
-
|
|
1073
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1016
1074
|
], ToolCallController.prototype, "reject", null);
|
|
1017
|
-
ToolCallController =
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1075
|
+
ToolCallController = _ts_decorate10([
|
|
1076
|
+
Controller5("tool-call"),
|
|
1077
|
+
_ts_param8(1, Inject8(AGENT_ACTOR_RESOLVER4)),
|
|
1078
|
+
_ts_metadata9("design:type", Function),
|
|
1079
|
+
_ts_metadata9("design:paramtypes", [
|
|
1022
1080
|
typeof AgentService === "undefined" ? Object : AgentService,
|
|
1023
1081
|
typeof ActorResolver === "undefined" ? Object : ActorResolver
|
|
1024
1082
|
])
|
|
1025
1083
|
], ToolCallController);
|
|
1026
1084
|
|
|
1027
1085
|
// src/discovery/agent-discovery.service.ts
|
|
1028
|
-
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as
|
|
1029
|
-
import { Inject as
|
|
1086
|
+
import { AGENT_PROMPT_CONTRIBUTORS as AGENT_PROMPT_CONTRIBUTORS2, AGENT_REGISTRY as AGENT_REGISTRY3, AgentRegistry as AgentRegistry4 } from "@dudousxd/nestjs-agent-core";
|
|
1087
|
+
import { Inject as Inject9, Injectable as Injectable5, Logger } from "@nestjs/common";
|
|
1030
1088
|
import { DiscoveryService, MetadataScanner } from "@nestjs/core";
|
|
1031
1089
|
|
|
1032
1090
|
// src/decorator/agent.decorator.ts
|
|
@@ -1043,23 +1101,23 @@ var SYSTEM_PROMPT_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt");
|
|
|
1043
1101
|
var SYSTEM_PROMPT_CONTRIBUTOR_METADATA = Symbol.for("@dudousxd/nestjs-agent:system-prompt-contributor");
|
|
1044
1102
|
|
|
1045
1103
|
// src/discovery/agent-discovery.service.ts
|
|
1046
|
-
function
|
|
1104
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1047
1105
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1048
1106
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1049
1107
|
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;
|
|
1050
1108
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1051
1109
|
}
|
|
1052
|
-
__name(
|
|
1053
|
-
function
|
|
1110
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1111
|
+
function _ts_metadata10(k, v) {
|
|
1054
1112
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1055
1113
|
}
|
|
1056
|
-
__name(
|
|
1057
|
-
function
|
|
1114
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1115
|
+
function _ts_param9(paramIndex, decorator) {
|
|
1058
1116
|
return function(target, key) {
|
|
1059
1117
|
decorator(target, key, paramIndex);
|
|
1060
1118
|
};
|
|
1061
1119
|
}
|
|
1062
|
-
__name(
|
|
1120
|
+
__name(_ts_param9, "_ts_param");
|
|
1063
1121
|
var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
1064
1122
|
static {
|
|
1065
1123
|
__name(this, "AgentDiscoveryService");
|
|
@@ -1094,6 +1152,9 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1094
1152
|
const systemPrompt = promptMethod !== void 0 ? (ctx) => promptMethod(ctx) : meta.systemPrompt ?? "You are a helpful assistant.";
|
|
1095
1153
|
return {
|
|
1096
1154
|
name: meta.name,
|
|
1155
|
+
...meta.description !== void 0 ? {
|
|
1156
|
+
description: meta.description
|
|
1157
|
+
} : {},
|
|
1097
1158
|
systemPrompt,
|
|
1098
1159
|
...meta.tools !== void 0 ? {
|
|
1099
1160
|
tools: meta.tools
|
|
@@ -1153,22 +1214,22 @@ var AgentDiscoveryService = class _AgentDiscoveryService {
|
|
|
1153
1214
|
return (ctx) => candidate.call(instance, ctx);
|
|
1154
1215
|
}
|
|
1155
1216
|
};
|
|
1156
|
-
AgentDiscoveryService =
|
|
1217
|
+
AgentDiscoveryService = _ts_decorate11([
|
|
1157
1218
|
Injectable5(),
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1219
|
+
_ts_param9(2, Inject9(AGENT_REGISTRY3)),
|
|
1220
|
+
_ts_param9(3, Inject9(AGENT_PROMPT_CONTRIBUTORS2)),
|
|
1221
|
+
_ts_metadata10("design:type", Function),
|
|
1222
|
+
_ts_metadata10("design:paramtypes", [
|
|
1162
1223
|
typeof DiscoveryService === "undefined" ? Object : DiscoveryService,
|
|
1163
1224
|
typeof MetadataScanner === "undefined" ? Object : MetadataScanner,
|
|
1164
|
-
typeof
|
|
1225
|
+
typeof AgentRegistry4 === "undefined" ? Object : AgentRegistry4,
|
|
1165
1226
|
Array
|
|
1166
1227
|
])
|
|
1167
1228
|
], AgentDiscoveryService);
|
|
1168
1229
|
|
|
1169
1230
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1170
|
-
import { AGENT_OPTIONS as AGENT_OPTIONS2, AGENT_REGISTRY as
|
|
1171
|
-
import { Inject as
|
|
1231
|
+
import { AGENT_OPTIONS as AGENT_OPTIONS2, AGENT_REGISTRY as AGENT_REGISTRY4, AGENT_TOOL_REGISTRY as AGENT_TOOL_REGISTRY2 } from "@dudousxd/nestjs-agent-core";
|
|
1232
|
+
import { Inject as Inject10, Injectable as Injectable6, Logger as Logger2 } from "@nestjs/common";
|
|
1172
1233
|
import { DiscoveryService as DiscoveryService2 } from "@nestjs/core";
|
|
1173
1234
|
import { z } from "zod";
|
|
1174
1235
|
|
|
@@ -1188,23 +1249,23 @@ function isBrandedFunctionalTool(value) {
|
|
|
1188
1249
|
__name(isBrandedFunctionalTool, "isBrandedFunctionalTool");
|
|
1189
1250
|
|
|
1190
1251
|
// src/discovery/ai-tool-discovery.service.ts
|
|
1191
|
-
function
|
|
1252
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1192
1253
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1193
1254
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1194
1255
|
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;
|
|
1195
1256
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1196
1257
|
}
|
|
1197
|
-
__name(
|
|
1198
|
-
function
|
|
1258
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1259
|
+
function _ts_metadata11(k, v) {
|
|
1199
1260
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1200
1261
|
}
|
|
1201
|
-
__name(
|
|
1202
|
-
function
|
|
1262
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1263
|
+
function _ts_param10(paramIndex, decorator) {
|
|
1203
1264
|
return function(target, key) {
|
|
1204
1265
|
decorator(target, key, paramIndex);
|
|
1205
1266
|
};
|
|
1206
1267
|
}
|
|
1207
|
-
__name(
|
|
1268
|
+
__name(_ts_param10, "_ts_param");
|
|
1208
1269
|
var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
1209
1270
|
static {
|
|
1210
1271
|
__name(this, "AiToolDiscoveryService");
|
|
@@ -1311,13 +1372,13 @@ var AiToolDiscoveryService = class _AiToolDiscoveryService {
|
|
|
1311
1372
|
return true;
|
|
1312
1373
|
}
|
|
1313
1374
|
};
|
|
1314
|
-
AiToolDiscoveryService =
|
|
1375
|
+
AiToolDiscoveryService = _ts_decorate12([
|
|
1315
1376
|
Injectable6(),
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1377
|
+
_ts_param10(1, Inject10(AGENT_TOOL_REGISTRY2)),
|
|
1378
|
+
_ts_param10(2, Inject10(AGENT_REGISTRY4)),
|
|
1379
|
+
_ts_param10(3, Inject10(AGENT_OPTIONS2)),
|
|
1380
|
+
_ts_metadata11("design:type", Function),
|
|
1381
|
+
_ts_metadata11("design:paramtypes", [
|
|
1321
1382
|
typeof DiscoveryService2 === "undefined" ? Object : DiscoveryService2,
|
|
1322
1383
|
typeof ToolRegistry === "undefined" ? Object : ToolRegistry,
|
|
1323
1384
|
typeof AgentRegistry === "undefined" ? Object : AgentRegistry,
|
|
@@ -1417,25 +1478,25 @@ var LedgerQuotaStore = class {
|
|
|
1417
1478
|
};
|
|
1418
1479
|
|
|
1419
1480
|
// src/runner/inline-agent-runner.ts
|
|
1420
|
-
import { AGENT_DEPS_FACTORY as
|
|
1421
|
-
import { Inject as
|
|
1422
|
-
function
|
|
1481
|
+
import { AGENT_DEPS_FACTORY as AGENT_DEPS_FACTORY4, AGENT_STORE as AGENT_STORE4, QuotaExceededError as QuotaExceededError2, publishAgentRunFailed as publishAgentRunFailed2, runAgentLoop as runAgentLoop2 } from "@dudousxd/nestjs-agent-core";
|
|
1482
|
+
import { Inject as Inject11, Injectable as Injectable7, Logger as Logger3 } from "@nestjs/common";
|
|
1483
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1423
1484
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1424
1485
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1425
1486
|
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;
|
|
1426
1487
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1427
1488
|
}
|
|
1428
|
-
__name(
|
|
1429
|
-
function
|
|
1489
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1490
|
+
function _ts_metadata12(k, v) {
|
|
1430
1491
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1431
1492
|
}
|
|
1432
|
-
__name(
|
|
1433
|
-
function
|
|
1493
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
1494
|
+
function _ts_param11(paramIndex, decorator) {
|
|
1434
1495
|
return function(target, key) {
|
|
1435
1496
|
decorator(target, key, paramIndex);
|
|
1436
1497
|
};
|
|
1437
1498
|
}
|
|
1438
|
-
__name(
|
|
1499
|
+
__name(_ts_param11, "_ts_param");
|
|
1439
1500
|
var InlineAgentRunner = class _InlineAgentRunner {
|
|
1440
1501
|
static {
|
|
1441
1502
|
__name(this, "InlineAgentRunner");
|
|
@@ -1536,25 +1597,25 @@ var InlineAgentRunner = class _InlineAgentRunner {
|
|
|
1536
1597
|
}, hooks);
|
|
1537
1598
|
}
|
|
1538
1599
|
};
|
|
1539
|
-
InlineAgentRunner =
|
|
1600
|
+
InlineAgentRunner = _ts_decorate13([
|
|
1540
1601
|
Injectable7(),
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1602
|
+
_ts_param11(0, Inject11(AGENT_DEPS_FACTORY4)),
|
|
1603
|
+
_ts_param11(1, Inject11(AGENT_STORE4)),
|
|
1604
|
+
_ts_metadata12("design:type", Function),
|
|
1605
|
+
_ts_metadata12("design:paramtypes", [
|
|
1545
1606
|
typeof AgentDepsFactory === "undefined" ? Object : AgentDepsFactory,
|
|
1546
1607
|
typeof AgentStore === "undefined" ? Object : AgentStore
|
|
1547
1608
|
])
|
|
1548
1609
|
], InlineAgentRunner);
|
|
1549
1610
|
|
|
1550
1611
|
// src/agent.module.ts
|
|
1551
|
-
function
|
|
1612
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1552
1613
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1553
1614
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1554
1615
|
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;
|
|
1555
1616
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1556
1617
|
}
|
|
1557
|
-
__name(
|
|
1618
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1558
1619
|
var DEFAULT_PATH = "agent";
|
|
1559
1620
|
function sharedProviders(durable, includeStore) {
|
|
1560
1621
|
const providers = [
|
|
@@ -1564,8 +1625,8 @@ function sharedProviders(durable, includeStore) {
|
|
|
1564
1625
|
},
|
|
1565
1626
|
// Starts empty; AgentDiscoveryService populates it from `@Agent`-decorated providers at boot.
|
|
1566
1627
|
{
|
|
1567
|
-
provide:
|
|
1568
|
-
useFactory: /* @__PURE__ */ __name(() => new
|
|
1628
|
+
provide: AGENT_REGISTRY5,
|
|
1629
|
+
useFactory: /* @__PURE__ */ __name(() => new AgentRegistry5(), "useFactory")
|
|
1569
1630
|
},
|
|
1570
1631
|
// A shared, mutable list AgentDiscoveryService fills with `@SystemPromptContributor()` methods.
|
|
1571
1632
|
{
|
|
@@ -1613,7 +1674,7 @@ function sharedProviders(durable, includeStore) {
|
|
|
1613
1674
|
},
|
|
1614
1675
|
AgentDepsFactory2,
|
|
1615
1676
|
{
|
|
1616
|
-
provide:
|
|
1677
|
+
provide: AGENT_DEPS_FACTORY5,
|
|
1617
1678
|
useExisting: AgentDepsFactory2
|
|
1618
1679
|
},
|
|
1619
1680
|
// Populates the registry + contributors (onModuleInit) BEFORE AiToolDiscoveryService synthesizes
|
|
@@ -1661,7 +1722,7 @@ function exportsFor(includeStore) {
|
|
|
1661
1722
|
return [
|
|
1662
1723
|
AGENT_OPTIONS3,
|
|
1663
1724
|
AGENT_TOOL_REGISTRY3,
|
|
1664
|
-
|
|
1725
|
+
AGENT_REGISTRY5,
|
|
1665
1726
|
AGENT_SINK2,
|
|
1666
1727
|
AGENT_ROLES_POLICY2,
|
|
1667
1728
|
AGENT_ACTOR_RESOLVER5,
|
|
@@ -1671,7 +1732,7 @@ function exportsFor(includeStore) {
|
|
|
1671
1732
|
] : [],
|
|
1672
1733
|
AGENT_QUOTA_STORE3,
|
|
1673
1734
|
AGENT_PROMPT_CONTRIBUTORS3,
|
|
1674
|
-
|
|
1735
|
+
AGENT_DEPS_FACTORY5,
|
|
1675
1736
|
AgentDepsFactory2,
|
|
1676
1737
|
AgentService,
|
|
1677
1738
|
InlineAgentRunner
|
|
@@ -1682,7 +1743,8 @@ var CONTROLLERS = [
|
|
|
1682
1743
|
ChatController,
|
|
1683
1744
|
ThreadsController,
|
|
1684
1745
|
ToolCallController,
|
|
1685
|
-
QuotaController
|
|
1746
|
+
QuotaController,
|
|
1747
|
+
AgentsController
|
|
1686
1748
|
];
|
|
1687
1749
|
function routerFor(path) {
|
|
1688
1750
|
return RouterModule.register([
|
|
@@ -1743,7 +1805,7 @@ var AgentModule = class _AgentModule {
|
|
|
1743
1805
|
};
|
|
1744
1806
|
}
|
|
1745
1807
|
};
|
|
1746
|
-
AgentModule =
|
|
1808
|
+
AgentModule = _ts_decorate14([
|
|
1747
1809
|
Global2(),
|
|
1748
1810
|
Module2({})
|
|
1749
1811
|
], AgentModule);
|