@copilotkit/runtime 1.5.15-next.2 → 1.5.15-next.4
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/CHANGELOG.md +17 -0
- package/__snapshots__/schema/schema.graphql +26 -0
- package/dist/{chunk-C2HNOETE.mjs → chunk-6Z3DFNOC.mjs} +2 -2
- package/dist/{chunk-OTB2F27M.mjs → chunk-EC2ZHPRU.mjs} +2 -2
- package/dist/{chunk-I33ESKDS.mjs → chunk-QDK4OP2Y.mjs} +2 -2
- package/dist/{chunk-4KT3HMC3.mjs → chunk-W4G47FRC.mjs} +539 -303
- package/dist/chunk-W4G47FRC.mjs.map +1 -0
- package/dist/{copilot-runtime-e6c34790.d.ts → copilot-runtime-a113045f.d.ts} +13 -1
- package/dist/{groq-adapter-acb6ed0b.d.ts → groq-adapter-248058e8.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +808 -574
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{langserve-9614171f.d.ts → langserve-9580bd66.d.ts} +16 -2
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.js +808 -574
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +500 -319
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +2 -2
- package/dist/lib/integrations/nest/index.js +500 -319
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +2 -2
- package/dist/lib/integrations/node-express/index.js +500 -319
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +2 -2
- package/dist/lib/integrations/node-http/index.js +500 -319
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/service-adapters/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/agents/langgraph/event-source.ts +14 -2
- package/src/agents/langgraph/events.ts +12 -1
- package/src/graphql/inputs/generate-copilot-response.input.ts +4 -0
- package/src/graphql/inputs/meta-event.input.ts +17 -0
- package/src/graphql/resolvers/copilot.resolver.ts +67 -22
- package/src/graphql/types/copilot-response.type.ts +6 -0
- package/src/graphql/types/meta-events.type.ts +31 -0
- package/src/lib/runtime/copilot-runtime.ts +14 -0
- package/src/lib/runtime/remote-action-constructors.ts +5 -1
- package/src/lib/runtime/remote-actions.ts +2 -0
- package/src/lib/runtime/remote-lg-action.ts +46 -10
- package/src/service-adapters/events.ts +20 -1
- package/dist/chunk-4KT3HMC3.mjs.map +0 -1
- /package/dist/{chunk-C2HNOETE.mjs.map → chunk-6Z3DFNOC.mjs.map} +0 -0
- /package/dist/{chunk-OTB2F27M.mjs.map → chunk-EC2ZHPRU.mjs.map} +0 -0
- /package/dist/{chunk-I33ESKDS.mjs.map → chunk-QDK4OP2Y.mjs.map} +0 -0
|
@@ -38,7 +38,7 @@ var require_package = __commonJS({
|
|
|
38
38
|
publishConfig: {
|
|
39
39
|
access: "public"
|
|
40
40
|
},
|
|
41
|
-
version: "1.5.15-next.
|
|
41
|
+
version: "1.5.15-next.4",
|
|
42
42
|
sideEffects: false,
|
|
43
43
|
main: "./dist/index.js",
|
|
44
44
|
module: "./dist/index.mjs",
|
|
@@ -81,7 +81,7 @@ var require_package = __commonJS({
|
|
|
81
81
|
"@langchain/community": "^0.0.53",
|
|
82
82
|
"@langchain/core": "^0.3.13",
|
|
83
83
|
"@langchain/google-gauth": "^0.1.0",
|
|
84
|
-
"@langchain/langgraph-sdk": "^0.0.
|
|
84
|
+
"@langchain/langgraph-sdk": "^0.0.36",
|
|
85
85
|
"@langchain/openai": "^0.0.28",
|
|
86
86
|
"class-transformer": "^0.5.1",
|
|
87
87
|
express: "^4.19.2",
|
|
@@ -126,7 +126,7 @@ import { Arg, Ctx, Mutation, Query, Resolver } from "type-graphql";
|
|
|
126
126
|
import { ReplaySubject as ReplaySubject3, Subject, filter, finalize, firstValueFrom as firstValueFrom2, shareReplay, skipWhile, take, takeWhile, tap } from "rxjs";
|
|
127
127
|
|
|
128
128
|
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
129
|
-
import { Field as
|
|
129
|
+
import { Field as Field12, InputType as InputType11 } from "type-graphql";
|
|
130
130
|
|
|
131
131
|
// src/graphql/inputs/message.input.ts
|
|
132
132
|
import { Field, InputType } from "type-graphql";
|
|
@@ -732,7 +732,11 @@ OpenAIApiAssistantAPIInput = _ts_decorate9([
|
|
|
732
732
|
InputType9()
|
|
733
733
|
], OpenAIApiAssistantAPIInput);
|
|
734
734
|
|
|
735
|
-
// src/graphql/inputs/
|
|
735
|
+
// src/graphql/inputs/meta-event.input.ts
|
|
736
|
+
import { Field as Field11, InputType as InputType10 } from "type-graphql";
|
|
737
|
+
|
|
738
|
+
// src/graphql/types/meta-events.type.ts
|
|
739
|
+
import { Field as Field10, InterfaceType, ObjectType, registerEnumType as registerEnumType2 } from "type-graphql";
|
|
736
740
|
function _ts_decorate10(decorators, target, key, desc) {
|
|
737
741
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
738
742
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -749,18 +753,131 @@ function _ts_metadata10(k, v) {
|
|
|
749
753
|
return Reflect.metadata(k, v);
|
|
750
754
|
}
|
|
751
755
|
__name(_ts_metadata10, "_ts_metadata");
|
|
756
|
+
var MetaEventName;
|
|
757
|
+
(function(MetaEventName2) {
|
|
758
|
+
MetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
|
|
759
|
+
})(MetaEventName || (MetaEventName = {}));
|
|
760
|
+
registerEnumType2(MetaEventName, {
|
|
761
|
+
name: "MetaEventName",
|
|
762
|
+
description: "Meta event types"
|
|
763
|
+
});
|
|
764
|
+
var BaseMetaEvent = class {
|
|
765
|
+
type = "MetaEvent";
|
|
766
|
+
name;
|
|
767
|
+
};
|
|
768
|
+
__name(BaseMetaEvent, "BaseMetaEvent");
|
|
769
|
+
_ts_decorate10([
|
|
770
|
+
Field10(() => String),
|
|
771
|
+
_ts_metadata10("design:type", String)
|
|
772
|
+
], BaseMetaEvent.prototype, "type", void 0);
|
|
773
|
+
_ts_decorate10([
|
|
774
|
+
Field10(() => MetaEventName),
|
|
775
|
+
_ts_metadata10("design:type", String)
|
|
776
|
+
], BaseMetaEvent.prototype, "name", void 0);
|
|
777
|
+
BaseMetaEvent = _ts_decorate10([
|
|
778
|
+
InterfaceType()
|
|
779
|
+
], BaseMetaEvent);
|
|
780
|
+
var LangGraphInterruptEvent = class {
|
|
781
|
+
name = "LangGraphInterruptEvent";
|
|
782
|
+
value;
|
|
783
|
+
response;
|
|
784
|
+
};
|
|
785
|
+
__name(LangGraphInterruptEvent, "LangGraphInterruptEvent");
|
|
786
|
+
_ts_decorate10([
|
|
787
|
+
Field10(() => MetaEventName),
|
|
788
|
+
_ts_metadata10("design:type", typeof MetaEventName === "undefined" || false ? Object : "LangGraphInterruptEvent")
|
|
789
|
+
], LangGraphInterruptEvent.prototype, "name", void 0);
|
|
790
|
+
_ts_decorate10([
|
|
791
|
+
Field10(() => String),
|
|
792
|
+
_ts_metadata10("design:type", String)
|
|
793
|
+
], LangGraphInterruptEvent.prototype, "value", void 0);
|
|
794
|
+
_ts_decorate10([
|
|
795
|
+
Field10(() => String, {
|
|
796
|
+
nullable: true
|
|
797
|
+
}),
|
|
798
|
+
_ts_metadata10("design:type", String)
|
|
799
|
+
], LangGraphInterruptEvent.prototype, "response", void 0);
|
|
800
|
+
LangGraphInterruptEvent = _ts_decorate10([
|
|
801
|
+
ObjectType({
|
|
802
|
+
implements: BaseMetaEvent
|
|
803
|
+
})
|
|
804
|
+
], LangGraphInterruptEvent);
|
|
805
|
+
|
|
806
|
+
// src/graphql/inputs/meta-event.input.ts
|
|
807
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
808
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
809
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
810
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
811
|
+
else
|
|
812
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
813
|
+
if (d = decorators[i])
|
|
814
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
815
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
816
|
+
}
|
|
817
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
818
|
+
function _ts_metadata11(k, v) {
|
|
819
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
820
|
+
return Reflect.metadata(k, v);
|
|
821
|
+
}
|
|
822
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
823
|
+
var MetaEventInput = class {
|
|
824
|
+
type = "MetaEvent";
|
|
825
|
+
name;
|
|
826
|
+
value;
|
|
827
|
+
response;
|
|
828
|
+
};
|
|
829
|
+
__name(MetaEventInput, "MetaEventInput");
|
|
830
|
+
_ts_decorate11([
|
|
831
|
+
Field11(() => String),
|
|
832
|
+
_ts_metadata11("design:type", String)
|
|
833
|
+
], MetaEventInput.prototype, "type", void 0);
|
|
834
|
+
_ts_decorate11([
|
|
835
|
+
Field11(() => MetaEventName),
|
|
836
|
+
_ts_metadata11("design:type", typeof MetaEventName === "undefined" ? Object : MetaEventName)
|
|
837
|
+
], MetaEventInput.prototype, "name", void 0);
|
|
838
|
+
_ts_decorate11([
|
|
839
|
+
Field11(() => String),
|
|
840
|
+
_ts_metadata11("design:type", String)
|
|
841
|
+
], MetaEventInput.prototype, "value", void 0);
|
|
842
|
+
_ts_decorate11([
|
|
843
|
+
Field11(() => String, {
|
|
844
|
+
nullable: true
|
|
845
|
+
}),
|
|
846
|
+
_ts_metadata11("design:type", String)
|
|
847
|
+
], MetaEventInput.prototype, "response", void 0);
|
|
848
|
+
MetaEventInput = _ts_decorate11([
|
|
849
|
+
InputType10()
|
|
850
|
+
], MetaEventInput);
|
|
851
|
+
|
|
852
|
+
// src/graphql/inputs/generate-copilot-response.input.ts
|
|
853
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
854
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
855
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
856
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
857
|
+
else
|
|
858
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
859
|
+
if (d = decorators[i])
|
|
860
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
861
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
862
|
+
}
|
|
863
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
864
|
+
function _ts_metadata12(k, v) {
|
|
865
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
866
|
+
return Reflect.metadata(k, v);
|
|
867
|
+
}
|
|
868
|
+
__name(_ts_metadata12, "_ts_metadata");
|
|
752
869
|
var GenerateCopilotResponseMetadataInput = class {
|
|
753
870
|
requestType;
|
|
754
871
|
};
|
|
755
872
|
__name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
|
|
756
|
-
|
|
757
|
-
|
|
873
|
+
_ts_decorate12([
|
|
874
|
+
Field12(() => CopilotRequestType, {
|
|
758
875
|
nullable: true
|
|
759
876
|
}),
|
|
760
|
-
|
|
877
|
+
_ts_metadata12("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
|
|
761
878
|
], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
|
|
762
|
-
GenerateCopilotResponseMetadataInput =
|
|
763
|
-
|
|
879
|
+
GenerateCopilotResponseMetadataInput = _ts_decorate12([
|
|
880
|
+
InputType11()
|
|
764
881
|
], GenerateCopilotResponseMetadataInput);
|
|
765
882
|
var GenerateCopilotResponseInput = class {
|
|
766
883
|
metadata;
|
|
@@ -774,84 +891,93 @@ var GenerateCopilotResponseInput = class {
|
|
|
774
891
|
agentState;
|
|
775
892
|
agentStates;
|
|
776
893
|
extensions;
|
|
894
|
+
metaEvents;
|
|
777
895
|
};
|
|
778
896
|
__name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
|
|
779
|
-
|
|
780
|
-
|
|
897
|
+
_ts_decorate12([
|
|
898
|
+
Field12(() => GenerateCopilotResponseMetadataInput, {
|
|
781
899
|
nullable: false
|
|
782
900
|
}),
|
|
783
|
-
|
|
901
|
+
_ts_metadata12("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
|
|
784
902
|
], GenerateCopilotResponseInput.prototype, "metadata", void 0);
|
|
785
|
-
|
|
786
|
-
|
|
903
|
+
_ts_decorate12([
|
|
904
|
+
Field12(() => String, {
|
|
787
905
|
nullable: true
|
|
788
906
|
}),
|
|
789
|
-
|
|
907
|
+
_ts_metadata12("design:type", String)
|
|
790
908
|
], GenerateCopilotResponseInput.prototype, "threadId", void 0);
|
|
791
|
-
|
|
792
|
-
|
|
909
|
+
_ts_decorate12([
|
|
910
|
+
Field12(() => String, {
|
|
793
911
|
nullable: true
|
|
794
912
|
}),
|
|
795
|
-
|
|
913
|
+
_ts_metadata12("design:type", String)
|
|
796
914
|
], GenerateCopilotResponseInput.prototype, "runId", void 0);
|
|
797
|
-
|
|
798
|
-
|
|
915
|
+
_ts_decorate12([
|
|
916
|
+
Field12(() => [
|
|
799
917
|
MessageInput
|
|
800
918
|
]),
|
|
801
|
-
|
|
919
|
+
_ts_metadata12("design:type", Array)
|
|
802
920
|
], GenerateCopilotResponseInput.prototype, "messages", void 0);
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
921
|
+
_ts_decorate12([
|
|
922
|
+
Field12(() => FrontendInput),
|
|
923
|
+
_ts_metadata12("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
|
|
806
924
|
], GenerateCopilotResponseInput.prototype, "frontend", void 0);
|
|
807
|
-
|
|
808
|
-
|
|
925
|
+
_ts_decorate12([
|
|
926
|
+
Field12(() => CloudInput, {
|
|
809
927
|
nullable: true
|
|
810
928
|
}),
|
|
811
|
-
|
|
929
|
+
_ts_metadata12("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
|
|
812
930
|
], GenerateCopilotResponseInput.prototype, "cloud", void 0);
|
|
813
|
-
|
|
814
|
-
|
|
931
|
+
_ts_decorate12([
|
|
932
|
+
Field12(() => ForwardedParametersInput, {
|
|
815
933
|
nullable: true
|
|
816
934
|
}),
|
|
817
|
-
|
|
935
|
+
_ts_metadata12("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
|
|
818
936
|
], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
|
|
819
|
-
|
|
820
|
-
|
|
937
|
+
_ts_decorate12([
|
|
938
|
+
Field12(() => AgentSessionInput, {
|
|
821
939
|
nullable: true
|
|
822
940
|
}),
|
|
823
|
-
|
|
941
|
+
_ts_metadata12("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
|
|
824
942
|
], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
|
|
825
|
-
|
|
826
|
-
|
|
943
|
+
_ts_decorate12([
|
|
944
|
+
Field12(() => AgentStateInput, {
|
|
827
945
|
nullable: true
|
|
828
946
|
}),
|
|
829
|
-
|
|
947
|
+
_ts_metadata12("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
|
|
830
948
|
], GenerateCopilotResponseInput.prototype, "agentState", void 0);
|
|
831
|
-
|
|
832
|
-
|
|
949
|
+
_ts_decorate12([
|
|
950
|
+
Field12(() => [
|
|
833
951
|
AgentStateInput
|
|
834
952
|
], {
|
|
835
953
|
nullable: true
|
|
836
954
|
}),
|
|
837
|
-
|
|
955
|
+
_ts_metadata12("design:type", Array)
|
|
838
956
|
], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
|
|
839
|
-
|
|
840
|
-
|
|
957
|
+
_ts_decorate12([
|
|
958
|
+
Field12(() => ExtensionsInput, {
|
|
841
959
|
nullable: true
|
|
842
960
|
}),
|
|
843
|
-
|
|
961
|
+
_ts_metadata12("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
|
|
844
962
|
], GenerateCopilotResponseInput.prototype, "extensions", void 0);
|
|
845
|
-
|
|
846
|
-
|
|
963
|
+
_ts_decorate12([
|
|
964
|
+
Field12(() => [
|
|
965
|
+
MetaEventInput
|
|
966
|
+
], {
|
|
967
|
+
nullable: true
|
|
968
|
+
}),
|
|
969
|
+
_ts_metadata12("design:type", Array)
|
|
970
|
+
], GenerateCopilotResponseInput.prototype, "metaEvents", void 0);
|
|
971
|
+
GenerateCopilotResponseInput = _ts_decorate12([
|
|
972
|
+
InputType11()
|
|
847
973
|
], GenerateCopilotResponseInput);
|
|
848
974
|
|
|
849
975
|
// src/graphql/types/copilot-response.type.ts
|
|
850
|
-
import { Field as
|
|
976
|
+
import { Field as Field15, InterfaceType as InterfaceType2, ObjectType as ObjectType4 } from "type-graphql";
|
|
851
977
|
|
|
852
978
|
// src/graphql/types/message-status.type.ts
|
|
853
|
-
import { Field as
|
|
854
|
-
function
|
|
979
|
+
import { Field as Field13, ObjectType as ObjectType2, createUnionType, registerEnumType as registerEnumType3 } from "type-graphql";
|
|
980
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
855
981
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
856
982
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
857
983
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -861,56 +987,56 @@ function _ts_decorate11(decorators, target, key, desc) {
|
|
|
861
987
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
862
988
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
863
989
|
}
|
|
864
|
-
__name(
|
|
865
|
-
function
|
|
990
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
991
|
+
function _ts_metadata13(k, v) {
|
|
866
992
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
867
993
|
return Reflect.metadata(k, v);
|
|
868
994
|
}
|
|
869
|
-
__name(
|
|
995
|
+
__name(_ts_metadata13, "_ts_metadata");
|
|
870
996
|
var MessageStatusCode;
|
|
871
997
|
(function(MessageStatusCode2) {
|
|
872
998
|
MessageStatusCode2["Pending"] = "pending";
|
|
873
999
|
MessageStatusCode2["Success"] = "success";
|
|
874
1000
|
MessageStatusCode2["Failed"] = "failed";
|
|
875
1001
|
})(MessageStatusCode || (MessageStatusCode = {}));
|
|
876
|
-
|
|
1002
|
+
registerEnumType3(MessageStatusCode, {
|
|
877
1003
|
name: "MessageStatusCode"
|
|
878
1004
|
});
|
|
879
1005
|
var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
|
|
880
1006
|
code;
|
|
881
1007
|
}, "BaseMessageStatus");
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1008
|
+
_ts_decorate13([
|
|
1009
|
+
Field13(() => MessageStatusCode),
|
|
1010
|
+
_ts_metadata13("design:type", String)
|
|
885
1011
|
], BaseMessageStatus.prototype, "code", void 0);
|
|
886
|
-
BaseMessageStatus =
|
|
887
|
-
|
|
1012
|
+
BaseMessageStatus = _ts_decorate13([
|
|
1013
|
+
ObjectType2()
|
|
888
1014
|
], BaseMessageStatus);
|
|
889
1015
|
var PendingMessageStatus = class extends BaseMessageStatus {
|
|
890
1016
|
code = "pending";
|
|
891
1017
|
};
|
|
892
1018
|
__name(PendingMessageStatus, "PendingMessageStatus");
|
|
893
|
-
PendingMessageStatus =
|
|
894
|
-
|
|
1019
|
+
PendingMessageStatus = _ts_decorate13([
|
|
1020
|
+
ObjectType2()
|
|
895
1021
|
], PendingMessageStatus);
|
|
896
1022
|
var SuccessMessageStatus = class extends BaseMessageStatus {
|
|
897
1023
|
code = "success";
|
|
898
1024
|
};
|
|
899
1025
|
__name(SuccessMessageStatus, "SuccessMessageStatus");
|
|
900
|
-
SuccessMessageStatus =
|
|
901
|
-
|
|
1026
|
+
SuccessMessageStatus = _ts_decorate13([
|
|
1027
|
+
ObjectType2()
|
|
902
1028
|
], SuccessMessageStatus);
|
|
903
1029
|
var FailedMessageStatus = class extends BaseMessageStatus {
|
|
904
1030
|
code = "failed";
|
|
905
1031
|
reason;
|
|
906
1032
|
};
|
|
907
1033
|
__name(FailedMessageStatus, "FailedMessageStatus");
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1034
|
+
_ts_decorate13([
|
|
1035
|
+
Field13(() => String),
|
|
1036
|
+
_ts_metadata13("design:type", String)
|
|
911
1037
|
], FailedMessageStatus.prototype, "reason", void 0);
|
|
912
|
-
FailedMessageStatus =
|
|
913
|
-
|
|
1038
|
+
FailedMessageStatus = _ts_decorate13([
|
|
1039
|
+
ObjectType2()
|
|
914
1040
|
], FailedMessageStatus);
|
|
915
1041
|
var MessageStatusUnion = createUnionType({
|
|
916
1042
|
name: "MessageStatus",
|
|
@@ -922,8 +1048,8 @@ var MessageStatusUnion = createUnionType({
|
|
|
922
1048
|
});
|
|
923
1049
|
|
|
924
1050
|
// src/graphql/types/extensions-response.type.ts
|
|
925
|
-
import { Field as
|
|
926
|
-
function
|
|
1051
|
+
import { Field as Field14, ObjectType as ObjectType3 } from "type-graphql";
|
|
1052
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
927
1053
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
928
1054
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
929
1055
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -933,48 +1059,48 @@ function _ts_decorate12(decorators, target, key, desc) {
|
|
|
933
1059
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
934
1060
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
935
1061
|
}
|
|
936
|
-
__name(
|
|
937
|
-
function
|
|
1062
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1063
|
+
function _ts_metadata14(k, v) {
|
|
938
1064
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
939
1065
|
return Reflect.metadata(k, v);
|
|
940
1066
|
}
|
|
941
|
-
__name(
|
|
1067
|
+
__name(_ts_metadata14, "_ts_metadata");
|
|
942
1068
|
var ExtensionsResponse = class {
|
|
943
1069
|
openaiAssistantAPI;
|
|
944
1070
|
};
|
|
945
1071
|
__name(ExtensionsResponse, "ExtensionsResponse");
|
|
946
|
-
|
|
947
|
-
|
|
1072
|
+
_ts_decorate14([
|
|
1073
|
+
Field14(() => OpenAIApiAssistantAPIResponse, {
|
|
948
1074
|
nullable: true
|
|
949
1075
|
}),
|
|
950
|
-
|
|
1076
|
+
_ts_metadata14("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
|
|
951
1077
|
], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
|
|
952
|
-
ExtensionsResponse =
|
|
953
|
-
|
|
1078
|
+
ExtensionsResponse = _ts_decorate14([
|
|
1079
|
+
ObjectType3()
|
|
954
1080
|
], ExtensionsResponse);
|
|
955
1081
|
var OpenAIApiAssistantAPIResponse = class {
|
|
956
1082
|
runId;
|
|
957
1083
|
threadId;
|
|
958
1084
|
};
|
|
959
1085
|
__name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
|
|
960
|
-
|
|
961
|
-
|
|
1086
|
+
_ts_decorate14([
|
|
1087
|
+
Field14(() => String, {
|
|
962
1088
|
nullable: true
|
|
963
1089
|
}),
|
|
964
|
-
|
|
1090
|
+
_ts_metadata14("design:type", String)
|
|
965
1091
|
], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
|
|
966
|
-
|
|
967
|
-
|
|
1092
|
+
_ts_decorate14([
|
|
1093
|
+
Field14(() => String, {
|
|
968
1094
|
nullable: true
|
|
969
1095
|
}),
|
|
970
|
-
|
|
1096
|
+
_ts_metadata14("design:type", String)
|
|
971
1097
|
], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
|
|
972
|
-
OpenAIApiAssistantAPIResponse =
|
|
973
|
-
|
|
1098
|
+
OpenAIApiAssistantAPIResponse = _ts_decorate14([
|
|
1099
|
+
ObjectType3()
|
|
974
1100
|
], OpenAIApiAssistantAPIResponse);
|
|
975
1101
|
|
|
976
1102
|
// src/graphql/types/copilot-response.type.ts
|
|
977
|
-
function
|
|
1103
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
978
1104
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
979
1105
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
980
1106
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -984,32 +1110,32 @@ function _ts_decorate13(decorators, target, key, desc) {
|
|
|
984
1110
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
985
1111
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
986
1112
|
}
|
|
987
|
-
__name(
|
|
988
|
-
function
|
|
1113
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1114
|
+
function _ts_metadata15(k, v) {
|
|
989
1115
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
990
1116
|
return Reflect.metadata(k, v);
|
|
991
1117
|
}
|
|
992
|
-
__name(
|
|
1118
|
+
__name(_ts_metadata15, "_ts_metadata");
|
|
993
1119
|
var BaseMessageOutput = class {
|
|
994
1120
|
id;
|
|
995
1121
|
createdAt;
|
|
996
1122
|
status;
|
|
997
1123
|
};
|
|
998
1124
|
__name(BaseMessageOutput, "BaseMessageOutput");
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1125
|
+
_ts_decorate15([
|
|
1126
|
+
Field15(() => String),
|
|
1127
|
+
_ts_metadata15("design:type", String)
|
|
1002
1128
|
], BaseMessageOutput.prototype, "id", void 0);
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1129
|
+
_ts_decorate15([
|
|
1130
|
+
Field15(() => Date),
|
|
1131
|
+
_ts_metadata15("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1006
1132
|
], BaseMessageOutput.prototype, "createdAt", void 0);
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1133
|
+
_ts_decorate15([
|
|
1134
|
+
Field15(() => MessageStatusUnion),
|
|
1135
|
+
_ts_metadata15("design:type", Object)
|
|
1010
1136
|
], BaseMessageOutput.prototype, "status", void 0);
|
|
1011
|
-
BaseMessageOutput =
|
|
1012
|
-
|
|
1137
|
+
BaseMessageOutput = _ts_decorate15([
|
|
1138
|
+
InterfaceType2({
|
|
1013
1139
|
resolveType(value) {
|
|
1014
1140
|
if (value.hasOwnProperty("content")) {
|
|
1015
1141
|
return TextMessageOutput;
|
|
@@ -1019,6 +1145,8 @@ BaseMessageOutput = _ts_decorate13([
|
|
|
1019
1145
|
return ResultMessageOutput;
|
|
1020
1146
|
} else if (value.hasOwnProperty("state")) {
|
|
1021
1147
|
return AgentStateMessageOutput;
|
|
1148
|
+
} else if (value.name === MetaEventName.LangGraphInterruptEvent) {
|
|
1149
|
+
return LangGraphInterruptEvent;
|
|
1022
1150
|
}
|
|
1023
1151
|
return void 0;
|
|
1024
1152
|
}
|
|
@@ -1030,24 +1158,24 @@ var TextMessageOutput = class {
|
|
|
1030
1158
|
parentMessageId;
|
|
1031
1159
|
};
|
|
1032
1160
|
__name(TextMessageOutput, "TextMessageOutput");
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1161
|
+
_ts_decorate15([
|
|
1162
|
+
Field15(() => MessageRole),
|
|
1163
|
+
_ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
1036
1164
|
], TextMessageOutput.prototype, "role", void 0);
|
|
1037
|
-
|
|
1038
|
-
|
|
1165
|
+
_ts_decorate15([
|
|
1166
|
+
Field15(() => [
|
|
1039
1167
|
String
|
|
1040
1168
|
]),
|
|
1041
|
-
|
|
1169
|
+
_ts_metadata15("design:type", Array)
|
|
1042
1170
|
], TextMessageOutput.prototype, "content", void 0);
|
|
1043
|
-
|
|
1044
|
-
|
|
1171
|
+
_ts_decorate15([
|
|
1172
|
+
Field15(() => String, {
|
|
1045
1173
|
nullable: true
|
|
1046
1174
|
}),
|
|
1047
|
-
|
|
1175
|
+
_ts_metadata15("design:type", String)
|
|
1048
1176
|
], TextMessageOutput.prototype, "parentMessageId", void 0);
|
|
1049
|
-
TextMessageOutput =
|
|
1050
|
-
|
|
1177
|
+
TextMessageOutput = _ts_decorate15([
|
|
1178
|
+
ObjectType4({
|
|
1051
1179
|
implements: BaseMessageOutput
|
|
1052
1180
|
})
|
|
1053
1181
|
], TextMessageOutput);
|
|
@@ -1058,31 +1186,31 @@ var ActionExecutionMessageOutput = class {
|
|
|
1058
1186
|
parentMessageId;
|
|
1059
1187
|
};
|
|
1060
1188
|
__name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1189
|
+
_ts_decorate15([
|
|
1190
|
+
Field15(() => String),
|
|
1191
|
+
_ts_metadata15("design:type", String)
|
|
1064
1192
|
], ActionExecutionMessageOutput.prototype, "name", void 0);
|
|
1065
|
-
|
|
1066
|
-
|
|
1193
|
+
_ts_decorate15([
|
|
1194
|
+
Field15(() => String, {
|
|
1067
1195
|
nullable: true,
|
|
1068
1196
|
deprecationReason: "This field will be removed in a future version"
|
|
1069
1197
|
}),
|
|
1070
|
-
|
|
1198
|
+
_ts_metadata15("design:type", String)
|
|
1071
1199
|
], ActionExecutionMessageOutput.prototype, "scope", void 0);
|
|
1072
|
-
|
|
1073
|
-
|
|
1200
|
+
_ts_decorate15([
|
|
1201
|
+
Field15(() => [
|
|
1074
1202
|
String
|
|
1075
1203
|
]),
|
|
1076
|
-
|
|
1204
|
+
_ts_metadata15("design:type", Array)
|
|
1077
1205
|
], ActionExecutionMessageOutput.prototype, "arguments", void 0);
|
|
1078
|
-
|
|
1079
|
-
|
|
1206
|
+
_ts_decorate15([
|
|
1207
|
+
Field15(() => String, {
|
|
1080
1208
|
nullable: true
|
|
1081
1209
|
}),
|
|
1082
|
-
|
|
1210
|
+
_ts_metadata15("design:type", String)
|
|
1083
1211
|
], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
|
|
1084
|
-
ActionExecutionMessageOutput =
|
|
1085
|
-
|
|
1212
|
+
ActionExecutionMessageOutput = _ts_decorate15([
|
|
1213
|
+
ObjectType4({
|
|
1086
1214
|
implements: BaseMessageOutput
|
|
1087
1215
|
})
|
|
1088
1216
|
], ActionExecutionMessageOutput);
|
|
@@ -1092,20 +1220,20 @@ var ResultMessageOutput = class {
|
|
|
1092
1220
|
result;
|
|
1093
1221
|
};
|
|
1094
1222
|
__name(ResultMessageOutput, "ResultMessageOutput");
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1223
|
+
_ts_decorate15([
|
|
1224
|
+
Field15(() => String),
|
|
1225
|
+
_ts_metadata15("design:type", String)
|
|
1098
1226
|
], ResultMessageOutput.prototype, "actionExecutionId", void 0);
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1227
|
+
_ts_decorate15([
|
|
1228
|
+
Field15(() => String),
|
|
1229
|
+
_ts_metadata15("design:type", String)
|
|
1102
1230
|
], ResultMessageOutput.prototype, "actionName", void 0);
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1231
|
+
_ts_decorate15([
|
|
1232
|
+
Field15(() => String),
|
|
1233
|
+
_ts_metadata15("design:type", String)
|
|
1106
1234
|
], ResultMessageOutput.prototype, "result", void 0);
|
|
1107
|
-
ResultMessageOutput =
|
|
1108
|
-
|
|
1235
|
+
ResultMessageOutput = _ts_decorate15([
|
|
1236
|
+
ObjectType4({
|
|
1109
1237
|
implements: BaseMessageOutput
|
|
1110
1238
|
})
|
|
1111
1239
|
], ResultMessageOutput);
|
|
@@ -1120,40 +1248,40 @@ var AgentStateMessageOutput = class {
|
|
|
1120
1248
|
running;
|
|
1121
1249
|
};
|
|
1122
1250
|
__name(AgentStateMessageOutput, "AgentStateMessageOutput");
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1251
|
+
_ts_decorate15([
|
|
1252
|
+
Field15(() => String),
|
|
1253
|
+
_ts_metadata15("design:type", String)
|
|
1126
1254
|
], AgentStateMessageOutput.prototype, "threadId", void 0);
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1255
|
+
_ts_decorate15([
|
|
1256
|
+
Field15(() => String),
|
|
1257
|
+
_ts_metadata15("design:type", String)
|
|
1130
1258
|
], AgentStateMessageOutput.prototype, "agentName", void 0);
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1259
|
+
_ts_decorate15([
|
|
1260
|
+
Field15(() => String),
|
|
1261
|
+
_ts_metadata15("design:type", String)
|
|
1134
1262
|
], AgentStateMessageOutput.prototype, "nodeName", void 0);
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1263
|
+
_ts_decorate15([
|
|
1264
|
+
Field15(() => String),
|
|
1265
|
+
_ts_metadata15("design:type", String)
|
|
1138
1266
|
], AgentStateMessageOutput.prototype, "runId", void 0);
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1267
|
+
_ts_decorate15([
|
|
1268
|
+
Field15(() => Boolean),
|
|
1269
|
+
_ts_metadata15("design:type", Boolean)
|
|
1142
1270
|
], AgentStateMessageOutput.prototype, "active", void 0);
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1271
|
+
_ts_decorate15([
|
|
1272
|
+
Field15(() => MessageRole),
|
|
1273
|
+
_ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
|
|
1146
1274
|
], AgentStateMessageOutput.prototype, "role", void 0);
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1275
|
+
_ts_decorate15([
|
|
1276
|
+
Field15(() => String),
|
|
1277
|
+
_ts_metadata15("design:type", String)
|
|
1150
1278
|
], AgentStateMessageOutput.prototype, "state", void 0);
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1279
|
+
_ts_decorate15([
|
|
1280
|
+
Field15(() => Boolean),
|
|
1281
|
+
_ts_metadata15("design:type", Boolean)
|
|
1154
1282
|
], AgentStateMessageOutput.prototype, "running", void 0);
|
|
1155
|
-
AgentStateMessageOutput =
|
|
1156
|
-
|
|
1283
|
+
AgentStateMessageOutput = _ts_decorate15([
|
|
1284
|
+
ObjectType4({
|
|
1157
1285
|
implements: BaseMessageOutput
|
|
1158
1286
|
})
|
|
1159
1287
|
], AgentStateMessageOutput);
|
|
@@ -1163,36 +1291,45 @@ var CopilotResponse = class {
|
|
|
1163
1291
|
runId;
|
|
1164
1292
|
messages;
|
|
1165
1293
|
extensions;
|
|
1294
|
+
metaEvents;
|
|
1166
1295
|
};
|
|
1167
1296
|
__name(CopilotResponse, "CopilotResponse");
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1297
|
+
_ts_decorate15([
|
|
1298
|
+
Field15(() => String),
|
|
1299
|
+
_ts_metadata15("design:type", String)
|
|
1171
1300
|
], CopilotResponse.prototype, "threadId", void 0);
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1301
|
+
_ts_decorate15([
|
|
1302
|
+
Field15(() => ResponseStatusUnion),
|
|
1303
|
+
_ts_metadata15("design:type", Object)
|
|
1175
1304
|
], CopilotResponse.prototype, "status", void 0);
|
|
1176
|
-
|
|
1177
|
-
|
|
1305
|
+
_ts_decorate15([
|
|
1306
|
+
Field15({
|
|
1178
1307
|
nullable: true
|
|
1179
1308
|
}),
|
|
1180
|
-
|
|
1309
|
+
_ts_metadata15("design:type", String)
|
|
1181
1310
|
], CopilotResponse.prototype, "runId", void 0);
|
|
1182
|
-
|
|
1183
|
-
|
|
1311
|
+
_ts_decorate15([
|
|
1312
|
+
Field15(() => [
|
|
1184
1313
|
BaseMessageOutput
|
|
1185
1314
|
]),
|
|
1186
|
-
|
|
1315
|
+
_ts_metadata15("design:type", Array)
|
|
1187
1316
|
], CopilotResponse.prototype, "messages", void 0);
|
|
1188
|
-
|
|
1189
|
-
|
|
1317
|
+
_ts_decorate15([
|
|
1318
|
+
Field15(() => ExtensionsResponse, {
|
|
1190
1319
|
nullable: true
|
|
1191
1320
|
}),
|
|
1192
|
-
|
|
1321
|
+
_ts_metadata15("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
|
|
1193
1322
|
], CopilotResponse.prototype, "extensions", void 0);
|
|
1194
|
-
|
|
1195
|
-
|
|
1323
|
+
_ts_decorate15([
|
|
1324
|
+
Field15(() => [
|
|
1325
|
+
BaseMetaEvent
|
|
1326
|
+
], {
|
|
1327
|
+
nullable: true
|
|
1328
|
+
}),
|
|
1329
|
+
_ts_metadata15("design:type", Array)
|
|
1330
|
+
], CopilotResponse.prototype, "metaEvents", void 0);
|
|
1331
|
+
CopilotResponse = _ts_decorate15([
|
|
1332
|
+
ObjectType4()
|
|
1196
1333
|
], CopilotResponse);
|
|
1197
1334
|
|
|
1198
1335
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
@@ -1209,7 +1346,7 @@ import { TelemetryClient } from "@copilotkit/shared";
|
|
|
1209
1346
|
import { createHash as createHash2 } from "crypto";
|
|
1210
1347
|
|
|
1211
1348
|
// src/agents/langgraph/event-source.ts
|
|
1212
|
-
import {
|
|
1349
|
+
import { catchError, mergeMap, ReplaySubject, scan } from "rxjs";
|
|
1213
1350
|
|
|
1214
1351
|
// src/agents/langgraph/events.ts
|
|
1215
1352
|
var LangGraphEventTypes;
|
|
@@ -1226,7 +1363,12 @@ var LangGraphEventTypes;
|
|
|
1226
1363
|
LangGraphEventTypes2["OnCopilotKitEmitMessage"] = "on_copilotkit_emit_message";
|
|
1227
1364
|
LangGraphEventTypes2["OnCopilotKitEmitToolCall"] = "on_copilotkit_emit_tool_call";
|
|
1228
1365
|
LangGraphEventTypes2["OnCustomEvent"] = "on_custom_event";
|
|
1366
|
+
LangGraphEventTypes2["OnInterrupt"] = "on_interrupt";
|
|
1229
1367
|
})(LangGraphEventTypes || (LangGraphEventTypes = {}));
|
|
1368
|
+
var MetaEventNames;
|
|
1369
|
+
(function(MetaEventNames2) {
|
|
1370
|
+
MetaEventNames2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
|
|
1371
|
+
})(MetaEventNames || (MetaEventNames = {}));
|
|
1230
1372
|
var CustomEventNames;
|
|
1231
1373
|
(function(CustomEventNames2) {
|
|
1232
1374
|
CustomEventNames2["CopilotKitManuallyEmitMessage"] = "copilotkit_manually_emit_message";
|
|
@@ -1323,6 +1465,13 @@ var RemoteLangGraphEventSource = class {
|
|
|
1323
1465
|
shouldEmitMessages = acc.event.metadata["copilotkit:emit-messages"];
|
|
1324
1466
|
}
|
|
1325
1467
|
}
|
|
1468
|
+
if (acc.event.event === LangGraphEventTypes.OnInterrupt) {
|
|
1469
|
+
events.push({
|
|
1470
|
+
type: RuntimeEventTypes.MetaEvent,
|
|
1471
|
+
name: RuntimeMetaEventName.LangGraphInterruptEvent,
|
|
1472
|
+
value: acc.event.value
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1326
1475
|
const responseMetadata = this.getResponseMetadata(acc.event);
|
|
1327
1476
|
if ((responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls" && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)) {
|
|
1328
1477
|
events.push({
|
|
@@ -1449,9 +1598,9 @@ var RemoteLangGraphEventSource = class {
|
|
|
1449
1598
|
__name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
|
|
1450
1599
|
|
|
1451
1600
|
// src/lib/runtime/remote-lg-action.ts
|
|
1452
|
-
import { Client } from "@langchain/langgraph-sdk";
|
|
1601
|
+
import { Client as LangGraphClient } from "@langchain/langgraph-sdk";
|
|
1453
1602
|
import { createHash } from "crypto";
|
|
1454
|
-
import {
|
|
1603
|
+
import { isValidUUID, randomUUID } from "@copilotkit/shared";
|
|
1455
1604
|
import { parse as parsePartialJson } from "partial-json";
|
|
1456
1605
|
async function execute(args) {
|
|
1457
1606
|
return new ReadableStream({
|
|
@@ -1466,14 +1615,20 @@ async function execute(args) {
|
|
|
1466
1615
|
}
|
|
1467
1616
|
__name(execute, "execute");
|
|
1468
1617
|
async function streamEvents(controller, args) {
|
|
1469
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1470
|
-
const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2 } = args;
|
|
1618
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1619
|
+
const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2, properties, metaEvents } = args;
|
|
1471
1620
|
let nodeName = initialNodeName;
|
|
1472
1621
|
let state = initialState;
|
|
1473
1622
|
const { name, assistantId: initialAssistantId } = agent;
|
|
1474
|
-
const
|
|
1623
|
+
const propertyHeaders = properties.authorization ? {
|
|
1624
|
+
authorization: `Bearer ${properties.authorization}`
|
|
1625
|
+
} : null;
|
|
1626
|
+
const client = new LangGraphClient({
|
|
1475
1627
|
apiUrl: deploymentUrl,
|
|
1476
|
-
apiKey: langsmithApiKey
|
|
1628
|
+
apiKey: langsmithApiKey,
|
|
1629
|
+
defaultHeaders: {
|
|
1630
|
+
...propertyHeaders
|
|
1631
|
+
}
|
|
1477
1632
|
});
|
|
1478
1633
|
let threadId = argsInitialThreadId ?? randomUUID();
|
|
1479
1634
|
if (argsInitialThreadId && argsInitialThreadId.startsWith("ck-")) {
|
|
@@ -1507,7 +1662,8 @@ async function streamEvents(controller, args) {
|
|
|
1507
1662
|
logger2.error(e, `Error event thrown: ${e.message}`);
|
|
1508
1663
|
}
|
|
1509
1664
|
state = langGraphDefaultMergeState(state, formattedMessages, actions, name);
|
|
1510
|
-
|
|
1665
|
+
const lgInterruptEvent = metaEvents == null ? void 0 : metaEvents.find((ev) => ev.name === MetaEventName.LangGraphInterruptEvent);
|
|
1666
|
+
if (mode === "continue" && !lgInterruptEvent) {
|
|
1511
1667
|
await client.threads.updateState(threadId, {
|
|
1512
1668
|
values: state,
|
|
1513
1669
|
asNode: nodeName
|
|
@@ -1540,13 +1696,21 @@ async function streamEvents(controller, args) {
|
|
|
1540
1696
|
let emitIntermediateStateUntilEnd = null;
|
|
1541
1697
|
let shouldExit = false;
|
|
1542
1698
|
let externalRunId = null;
|
|
1543
|
-
const
|
|
1699
|
+
const payload = {
|
|
1544
1700
|
input: streamInput,
|
|
1545
1701
|
streamMode: [
|
|
1546
1702
|
"events",
|
|
1547
|
-
"values"
|
|
1548
|
-
|
|
1549
|
-
|
|
1703
|
+
"values",
|
|
1704
|
+
"updates"
|
|
1705
|
+
],
|
|
1706
|
+
command: void 0
|
|
1707
|
+
};
|
|
1708
|
+
if (lgInterruptEvent == null ? void 0 : lgInterruptEvent.response) {
|
|
1709
|
+
payload.command = {
|
|
1710
|
+
resume: lgInterruptEvent.response
|
|
1711
|
+
};
|
|
1712
|
+
}
|
|
1713
|
+
const streamResponse2 = client.runs.stream(threadId, assistantId, payload);
|
|
1550
1714
|
const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
|
|
1551
1715
|
let latestStateValues = {};
|
|
1552
1716
|
let updatedState = state;
|
|
@@ -1559,12 +1723,22 @@ async function streamEvents(controller, args) {
|
|
|
1559
1723
|
if (![
|
|
1560
1724
|
"events",
|
|
1561
1725
|
"values",
|
|
1562
|
-
"error"
|
|
1726
|
+
"error",
|
|
1727
|
+
"updates"
|
|
1563
1728
|
].includes(chunk.event))
|
|
1564
1729
|
continue;
|
|
1565
1730
|
if (chunk.event === "error") {
|
|
1566
1731
|
throw new Error(`Error event thrown: ${chunk.data.message}`);
|
|
1567
1732
|
}
|
|
1733
|
+
if (chunk.event === "updates" && chunk.data.__interrupt__) {
|
|
1734
|
+
emit(JSON.stringify({
|
|
1735
|
+
event: LangGraphEventTypes.OnInterrupt,
|
|
1736
|
+
value: chunk.data.__interrupt__[0].value
|
|
1737
|
+
}) + "\n");
|
|
1738
|
+
continue;
|
|
1739
|
+
}
|
|
1740
|
+
if (chunk.event === "updates")
|
|
1741
|
+
continue;
|
|
1568
1742
|
if (chunk.event === "values") {
|
|
1569
1743
|
latestStateValues = chunk.data;
|
|
1570
1744
|
continue;
|
|
@@ -1645,8 +1819,9 @@ async function streamEvents(controller, args) {
|
|
|
1645
1819
|
emit(JSON.stringify(event) + "\n");
|
|
1646
1820
|
}
|
|
1647
1821
|
state = await client.threads.getState(threadId);
|
|
1648
|
-
const
|
|
1649
|
-
nodeName = Object.keys(state.metadata.writes)[0];
|
|
1822
|
+
const interrupts = (_h = (_g = state.tasks) == null ? void 0 : _g[0]) == null ? void 0 : _h.interrupts;
|
|
1823
|
+
nodeName = interrupts ? nodeName : Object.keys(state.metadata.writes)[0];
|
|
1824
|
+
const isEndNode = state.next.length === 0 && !interrupts;
|
|
1650
1825
|
telemetry_client_default.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
|
|
1651
1826
|
emit(getStateSyncEvent({
|
|
1652
1827
|
threadId,
|
|
@@ -1927,7 +2102,7 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
1927
2102
|
parameters: [],
|
|
1928
2103
|
handler: async (_args) => {
|
|
1929
2104
|
},
|
|
1930
|
-
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [] }) => {
|
|
2105
|
+
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
|
|
1931
2106
|
var _a;
|
|
1932
2107
|
logger2.debug({
|
|
1933
2108
|
actionName: agent.name
|
|
@@ -1947,7 +2122,9 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
1947
2122
|
}
|
|
1948
2123
|
try {
|
|
1949
2124
|
const response = await execute({
|
|
1950
|
-
logger: logger2
|
|
2125
|
+
logger: logger2.child({
|
|
2126
|
+
component: "remote-actions.remote-lg-action.streamEvents"
|
|
2127
|
+
}),
|
|
1951
2128
|
deploymentUrl: endpoint.deploymentUrl,
|
|
1952
2129
|
langsmithApiKey: endpoint.langsmithApiKey,
|
|
1953
2130
|
agent,
|
|
@@ -1963,7 +2140,8 @@ function constructLGCRemoteAction({ endpoint, graphqlContext, logger: logger2, m
|
|
|
1963
2140
|
name: action.name,
|
|
1964
2141
|
description: action.description,
|
|
1965
2142
|
parameters: JSON.parse(action.jsonSchema)
|
|
1966
|
-
}))
|
|
2143
|
+
})),
|
|
2144
|
+
metaEvents
|
|
1967
2145
|
});
|
|
1968
2146
|
const eventSource = new RemoteLangGraphEventSource();
|
|
1969
2147
|
streamResponse(response, eventSource.eventStream$);
|
|
@@ -2043,7 +2221,7 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2043
2221
|
parameters: [],
|
|
2044
2222
|
handler: async (_args) => {
|
|
2045
2223
|
},
|
|
2046
|
-
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [] }) => {
|
|
2224
|
+
langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName, additionalMessages = [], metaEvents }) => {
|
|
2047
2225
|
var _a;
|
|
2048
2226
|
logger2.debug({
|
|
2049
2227
|
actionName: agent.name
|
|
@@ -2080,7 +2258,8 @@ function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, lo
|
|
|
2080
2258
|
name: action.name,
|
|
2081
2259
|
description: action.description,
|
|
2082
2260
|
parameters: JSON.parse(action.jsonSchema)
|
|
2083
|
-
}))
|
|
2261
|
+
})),
|
|
2262
|
+
metaEvents
|
|
2084
2263
|
})
|
|
2085
2264
|
});
|
|
2086
2265
|
if (!response.ok) {
|
|
@@ -2336,7 +2515,7 @@ __name(convertGqlInputToMessages, "convertGqlInputToMessages");
|
|
|
2336
2515
|
|
|
2337
2516
|
// src/lib/runtime/copilot-runtime.ts
|
|
2338
2517
|
import { from } from "rxjs";
|
|
2339
|
-
import { Client as
|
|
2518
|
+
import { Client as LangGraphClient2 } from "@langchain/langgraph-sdk";
|
|
2340
2519
|
var CopilotRuntime = class {
|
|
2341
2520
|
actions;
|
|
2342
2521
|
remoteEndpointDefinitions;
|
|
@@ -2442,9 +2621,15 @@ please use an LLM adapter instead.`
|
|
|
2442
2621
|
const agents = this.remoteEndpointDefinitions.reduce(async (acc, endpoint) => {
|
|
2443
2622
|
const agents2 = await acc;
|
|
2444
2623
|
if (endpoint.type === EndpointType.LangGraphPlatform) {
|
|
2445
|
-
const
|
|
2624
|
+
const propertyHeaders = graphqlContext.properties.authorization ? {
|
|
2625
|
+
authorization: `Bearer ${graphqlContext.properties.authorization}`
|
|
2626
|
+
} : null;
|
|
2627
|
+
const client = new LangGraphClient2({
|
|
2446
2628
|
apiUrl: endpoint.deploymentUrl,
|
|
2447
|
-
apiKey: endpoint.langsmithApiKey
|
|
2629
|
+
apiKey: endpoint.langsmithApiKey,
|
|
2630
|
+
defaultHeaders: {
|
|
2631
|
+
...propertyHeaders
|
|
2632
|
+
}
|
|
2448
2633
|
});
|
|
2449
2634
|
const data = await client.assistants.search();
|
|
2450
2635
|
const endpointAgents = (data ?? []).map((entry) => ({
|
|
@@ -2507,9 +2692,15 @@ please use an LLM adapter instead.`
|
|
|
2507
2692
|
}
|
|
2508
2693
|
const headers = createHeaders(null, graphqlContext);
|
|
2509
2694
|
if (agentWithEndpoint.endpoint.type === EndpointType.LangGraphPlatform) {
|
|
2510
|
-
const
|
|
2695
|
+
const propertyHeaders = graphqlContext.properties.authorization ? {
|
|
2696
|
+
authorization: `Bearer ${graphqlContext.properties.authorization}`
|
|
2697
|
+
} : null;
|
|
2698
|
+
const client = new LangGraphClient2({
|
|
2511
2699
|
apiUrl: agentWithEndpoint.endpoint.deploymentUrl,
|
|
2512
|
-
apiKey: agentWithEndpoint.endpoint.langsmithApiKey
|
|
2700
|
+
apiKey: agentWithEndpoint.endpoint.langsmithApiKey,
|
|
2701
|
+
defaultHeaders: {
|
|
2702
|
+
...propertyHeaders
|
|
2703
|
+
}
|
|
2513
2704
|
});
|
|
2514
2705
|
let state = {};
|
|
2515
2706
|
try {
|
|
@@ -2555,7 +2746,7 @@ please use an LLM adapter instead.`
|
|
|
2555
2746
|
}
|
|
2556
2747
|
async processAgentRequest(request) {
|
|
2557
2748
|
var _a;
|
|
2558
|
-
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession, threadId: threadIdFromRequest } = request;
|
|
2749
|
+
const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession, threadId: threadIdFromRequest, metaEvents } = request;
|
|
2559
2750
|
const { agentName, nodeName } = agentSession;
|
|
2560
2751
|
const threadId = threadIdFromRequest ?? agentSession.threadId;
|
|
2561
2752
|
const serverSideActions = await this.getServerSideActions(request);
|
|
@@ -2587,7 +2778,8 @@ please use an LLM adapter instead.`
|
|
|
2587
2778
|
name: agentName,
|
|
2588
2779
|
threadId,
|
|
2589
2780
|
nodeName,
|
|
2590
|
-
actionInputsWithoutAgents
|
|
2781
|
+
actionInputsWithoutAgents,
|
|
2782
|
+
metaEvents
|
|
2591
2783
|
});
|
|
2592
2784
|
eventSource.stream(async (eventStream$) => {
|
|
2593
2785
|
from(stream).subscribe({
|
|
@@ -2754,7 +2946,13 @@ var RuntimeEventTypes;
|
|
|
2754
2946
|
RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
|
|
2755
2947
|
RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
|
|
2756
2948
|
RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
|
|
2949
|
+
RuntimeEventTypes2["MetaEvent"] = "MetaEvent";
|
|
2757
2950
|
})(RuntimeEventTypes || (RuntimeEventTypes = {}));
|
|
2951
|
+
var RuntimeMetaEventName;
|
|
2952
|
+
(function(RuntimeMetaEventName2) {
|
|
2953
|
+
RuntimeMetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
|
|
2954
|
+
RuntimeMetaEventName2["LangGraphInterruptResumeEvent"] = "LangGraphInterruptResumeEvent";
|
|
2955
|
+
})(RuntimeMetaEventName || (RuntimeMetaEventName = {}));
|
|
2758
2956
|
var RuntimeEventSubject = class extends ReplaySubject2 {
|
|
2759
2957
|
constructor() {
|
|
2760
2958
|
super();
|
|
@@ -3026,8 +3224,8 @@ import { GraphQLError } from "graphql";
|
|
|
3026
3224
|
import { randomId as randomId4 } from "@copilotkit/shared";
|
|
3027
3225
|
|
|
3028
3226
|
// src/graphql/types/agents-response.type.ts
|
|
3029
|
-
import { Field as
|
|
3030
|
-
function
|
|
3227
|
+
import { Field as Field16, ObjectType as ObjectType5 } from "type-graphql";
|
|
3228
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
3031
3229
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3032
3230
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3033
3231
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3037,49 +3235,49 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
3037
3235
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3038
3236
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3039
3237
|
}
|
|
3040
|
-
__name(
|
|
3041
|
-
function
|
|
3238
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
3239
|
+
function _ts_metadata16(k, v) {
|
|
3042
3240
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3043
3241
|
return Reflect.metadata(k, v);
|
|
3044
3242
|
}
|
|
3045
|
-
__name(
|
|
3243
|
+
__name(_ts_metadata16, "_ts_metadata");
|
|
3046
3244
|
var Agent = class {
|
|
3047
3245
|
id;
|
|
3048
3246
|
name;
|
|
3049
3247
|
description;
|
|
3050
3248
|
};
|
|
3051
3249
|
__name(Agent, "Agent");
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3250
|
+
_ts_decorate16([
|
|
3251
|
+
Field16(() => String),
|
|
3252
|
+
_ts_metadata16("design:type", String)
|
|
3055
3253
|
], Agent.prototype, "id", void 0);
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3254
|
+
_ts_decorate16([
|
|
3255
|
+
Field16(() => String),
|
|
3256
|
+
_ts_metadata16("design:type", String)
|
|
3059
3257
|
], Agent.prototype, "name", void 0);
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3258
|
+
_ts_decorate16([
|
|
3259
|
+
Field16(() => String),
|
|
3260
|
+
_ts_metadata16("design:type", String)
|
|
3063
3261
|
], Agent.prototype, "description", void 0);
|
|
3064
|
-
Agent =
|
|
3065
|
-
|
|
3262
|
+
Agent = _ts_decorate16([
|
|
3263
|
+
ObjectType5()
|
|
3066
3264
|
], Agent);
|
|
3067
3265
|
var AgentsResponse = class {
|
|
3068
3266
|
agents;
|
|
3069
3267
|
};
|
|
3070
3268
|
__name(AgentsResponse, "AgentsResponse");
|
|
3071
|
-
|
|
3072
|
-
|
|
3269
|
+
_ts_decorate16([
|
|
3270
|
+
Field16(() => [
|
|
3073
3271
|
Agent
|
|
3074
3272
|
]),
|
|
3075
|
-
|
|
3273
|
+
_ts_metadata16("design:type", Array)
|
|
3076
3274
|
], AgentsResponse.prototype, "agents", void 0);
|
|
3077
|
-
AgentsResponse =
|
|
3078
|
-
|
|
3275
|
+
AgentsResponse = _ts_decorate16([
|
|
3276
|
+
ObjectType5()
|
|
3079
3277
|
], AgentsResponse);
|
|
3080
3278
|
|
|
3081
3279
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
3082
|
-
function
|
|
3280
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
3083
3281
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3084
3282
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3085
3283
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3089,12 +3287,12 @@ function _ts_decorate15(decorators, target, key, desc) {
|
|
|
3089
3287
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3090
3288
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3091
3289
|
}
|
|
3092
|
-
__name(
|
|
3093
|
-
function
|
|
3290
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
3291
|
+
function _ts_metadata17(k, v) {
|
|
3094
3292
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3095
3293
|
return Reflect.metadata(k, v);
|
|
3096
3294
|
}
|
|
3097
|
-
__name(
|
|
3295
|
+
__name(_ts_metadata17, "_ts_metadata");
|
|
3098
3296
|
function _ts_param(paramIndex, decorator) {
|
|
3099
3297
|
return function(target, key) {
|
|
3100
3298
|
decorator(target, key, paramIndex);
|
|
@@ -3148,7 +3346,7 @@ var CopilotResolver = class {
|
|
|
3148
3346
|
};
|
|
3149
3347
|
}
|
|
3150
3348
|
async generateCopilotResponse(ctx, data, properties) {
|
|
3151
|
-
var _a, _b, _c;
|
|
3349
|
+
var _a, _b, _c, _d;
|
|
3152
3350
|
telemetry_client_default.capture("oss.runtime.copilot_request_created", {
|
|
3153
3351
|
"cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
|
|
3154
3352
|
requestType: data.metadata.requestType
|
|
@@ -3219,16 +3417,68 @@ var CopilotResolver = class {
|
|
|
3219
3417
|
agentSession: data.agentSession,
|
|
3220
3418
|
agentStates: data.agentStates,
|
|
3221
3419
|
url: data.frontend.url,
|
|
3222
|
-
extensions: data.extensions
|
|
3420
|
+
extensions: data.extensions,
|
|
3421
|
+
metaEvents: data.metaEvents
|
|
3223
3422
|
});
|
|
3224
3423
|
logger2.debug("Event source created, creating response");
|
|
3424
|
+
const eventStream = eventSource.processRuntimeEvents({
|
|
3425
|
+
serverSideActions,
|
|
3426
|
+
guardrailsResult$: ((_d = data.cloud) == null ? void 0 : _d.guardrails) ? guardrailsResult$ : null,
|
|
3427
|
+
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
3428
|
+
// TODO-AGENTS: do not exclude ALL server side actions
|
|
3429
|
+
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
3430
|
+
),
|
|
3431
|
+
threadId
|
|
3432
|
+
}).pipe(
|
|
3433
|
+
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
3434
|
+
// just the events that were emitted after the subscriber was added.
|
|
3435
|
+
shareReplay(),
|
|
3436
|
+
finalize(() => {
|
|
3437
|
+
logger2.debug("Event stream finalized");
|
|
3438
|
+
})
|
|
3439
|
+
);
|
|
3225
3440
|
const response = {
|
|
3226
3441
|
threadId,
|
|
3227
3442
|
runId,
|
|
3228
3443
|
status: firstValueFrom2(responseStatus$),
|
|
3229
3444
|
extensions,
|
|
3445
|
+
metaEvents: new Repeater(async (push, stop) => {
|
|
3446
|
+
let eventStreamSubscription;
|
|
3447
|
+
eventStreamSubscription = eventStream.subscribe({
|
|
3448
|
+
next: async (event) => {
|
|
3449
|
+
if (event.type != RuntimeEventTypes.MetaEvent) {
|
|
3450
|
+
return;
|
|
3451
|
+
}
|
|
3452
|
+
switch (event.name) {
|
|
3453
|
+
case RuntimeMetaEventName.LangGraphInterruptEvent:
|
|
3454
|
+
push(plainToInstance3(LangGraphInterruptEvent, {
|
|
3455
|
+
type: event.type,
|
|
3456
|
+
name: event.name,
|
|
3457
|
+
value: event.value
|
|
3458
|
+
}));
|
|
3459
|
+
break;
|
|
3460
|
+
}
|
|
3461
|
+
},
|
|
3462
|
+
error: (err) => {
|
|
3463
|
+
logger2.error({
|
|
3464
|
+
err
|
|
3465
|
+
}, "Error in meta events stream");
|
|
3466
|
+
responseStatus$.next(new UnknownErrorResponse({
|
|
3467
|
+
description: `An unknown error has occurred in the event stream`
|
|
3468
|
+
}));
|
|
3469
|
+
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
3470
|
+
stop();
|
|
3471
|
+
},
|
|
3472
|
+
complete: async () => {
|
|
3473
|
+
logger2.debug("Meta events stream completed");
|
|
3474
|
+
responseStatus$.next(new SuccessResponseStatus());
|
|
3475
|
+
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
3476
|
+
stop();
|
|
3477
|
+
}
|
|
3478
|
+
});
|
|
3479
|
+
}),
|
|
3230
3480
|
messages: new Repeater(async (pushMessage, stopStreamingMessages) => {
|
|
3231
|
-
var _a2
|
|
3481
|
+
var _a2;
|
|
3232
3482
|
logger2.debug("Messages repeater created");
|
|
3233
3483
|
if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
|
|
3234
3484
|
logger2 = logger2.child({
|
|
@@ -3277,26 +3527,12 @@ var CopilotResolver = class {
|
|
|
3277
3527
|
});
|
|
3278
3528
|
}
|
|
3279
3529
|
let eventStreamSubscription;
|
|
3280
|
-
const eventStream = eventSource.processRuntimeEvents({
|
|
3281
|
-
serverSideActions,
|
|
3282
|
-
guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null,
|
|
3283
|
-
actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
|
|
3284
|
-
// TODO-AGENTS: do not exclude ALL server side actions
|
|
3285
|
-
(action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
|
|
3286
|
-
),
|
|
3287
|
-
threadId
|
|
3288
|
-
}).pipe(
|
|
3289
|
-
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
3290
|
-
// just the events that were emitted after the subscriber was added.
|
|
3291
|
-
shareReplay(),
|
|
3292
|
-
finalize(() => {
|
|
3293
|
-
logger2.debug("Event stream finalized");
|
|
3294
|
-
})
|
|
3295
|
-
);
|
|
3296
3530
|
logger2.debug("Event stream created, subscribing to event stream");
|
|
3297
3531
|
eventStreamSubscription = eventStream.subscribe({
|
|
3298
3532
|
next: async (event) => {
|
|
3299
3533
|
switch (event.type) {
|
|
3534
|
+
case RuntimeEventTypes.MetaEvent:
|
|
3535
|
+
break;
|
|
3300
3536
|
case RuntimeEventTypes.TextMessageStart:
|
|
3301
3537
|
const textMessageContentStream = eventStream.pipe(
|
|
3302
3538
|
// skip until this message start event
|
|
@@ -3502,37 +3738,37 @@ var CopilotResolver = class {
|
|
|
3502
3738
|
}
|
|
3503
3739
|
};
|
|
3504
3740
|
__name(CopilotResolver, "CopilotResolver");
|
|
3505
|
-
|
|
3741
|
+
_ts_decorate17([
|
|
3506
3742
|
Query(() => String),
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3743
|
+
_ts_metadata17("design:type", Function),
|
|
3744
|
+
_ts_metadata17("design:paramtypes", []),
|
|
3745
|
+
_ts_metadata17("design:returntype", Promise)
|
|
3510
3746
|
], CopilotResolver.prototype, "hello", null);
|
|
3511
|
-
|
|
3747
|
+
_ts_decorate17([
|
|
3512
3748
|
Query(() => AgentsResponse),
|
|
3513
3749
|
_ts_param(0, Ctx()),
|
|
3514
|
-
|
|
3515
|
-
|
|
3750
|
+
_ts_metadata17("design:type", Function),
|
|
3751
|
+
_ts_metadata17("design:paramtypes", [
|
|
3516
3752
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext
|
|
3517
3753
|
]),
|
|
3518
|
-
|
|
3754
|
+
_ts_metadata17("design:returntype", Promise)
|
|
3519
3755
|
], CopilotResolver.prototype, "availableAgents", null);
|
|
3520
|
-
|
|
3756
|
+
_ts_decorate17([
|
|
3521
3757
|
Mutation(() => CopilotResponse),
|
|
3522
3758
|
_ts_param(0, Ctx()),
|
|
3523
3759
|
_ts_param(1, Arg("data")),
|
|
3524
3760
|
_ts_param(2, Arg("properties", () => GraphQLJSONObject, {
|
|
3525
3761
|
nullable: true
|
|
3526
3762
|
})),
|
|
3527
|
-
|
|
3528
|
-
|
|
3763
|
+
_ts_metadata17("design:type", Function),
|
|
3764
|
+
_ts_metadata17("design:paramtypes", [
|
|
3529
3765
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
3530
3766
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
3531
3767
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
3532
3768
|
]),
|
|
3533
|
-
|
|
3769
|
+
_ts_metadata17("design:returntype", Promise)
|
|
3534
3770
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
3535
|
-
CopilotResolver =
|
|
3771
|
+
CopilotResolver = _ts_decorate17([
|
|
3536
3772
|
Resolver(() => CopilotResponse)
|
|
3537
3773
|
], CopilotResolver);
|
|
3538
3774
|
|
|
@@ -3573,8 +3809,8 @@ import { Ctx as Ctx2 } from "type-graphql";
|
|
|
3573
3809
|
import { Query as Query2 } from "type-graphql";
|
|
3574
3810
|
|
|
3575
3811
|
// src/graphql/types/load-agent-state-response.type.ts
|
|
3576
|
-
import { Field as
|
|
3577
|
-
function
|
|
3812
|
+
import { Field as Field17, ObjectType as ObjectType6 } from "type-graphql";
|
|
3813
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
3578
3814
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3579
3815
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3580
3816
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3584,12 +3820,12 @@ function _ts_decorate16(decorators, target, key, desc) {
|
|
|
3584
3820
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3585
3821
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3586
3822
|
}
|
|
3587
|
-
__name(
|
|
3588
|
-
function
|
|
3823
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
3824
|
+
function _ts_metadata18(k, v) {
|
|
3589
3825
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3590
3826
|
return Reflect.metadata(k, v);
|
|
3591
3827
|
}
|
|
3592
|
-
__name(
|
|
3828
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
3593
3829
|
var LoadAgentStateResponse = class {
|
|
3594
3830
|
threadId;
|
|
3595
3831
|
threadExists;
|
|
@@ -3597,29 +3833,29 @@ var LoadAgentStateResponse = class {
|
|
|
3597
3833
|
messages;
|
|
3598
3834
|
};
|
|
3599
3835
|
__name(LoadAgentStateResponse, "LoadAgentStateResponse");
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3836
|
+
_ts_decorate18([
|
|
3837
|
+
Field17(() => String),
|
|
3838
|
+
_ts_metadata18("design:type", String)
|
|
3603
3839
|
], LoadAgentStateResponse.prototype, "threadId", void 0);
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3840
|
+
_ts_decorate18([
|
|
3841
|
+
Field17(() => Boolean),
|
|
3842
|
+
_ts_metadata18("design:type", Boolean)
|
|
3607
3843
|
], LoadAgentStateResponse.prototype, "threadExists", void 0);
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3844
|
+
_ts_decorate18([
|
|
3845
|
+
Field17(() => String),
|
|
3846
|
+
_ts_metadata18("design:type", String)
|
|
3611
3847
|
], LoadAgentStateResponse.prototype, "state", void 0);
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3848
|
+
_ts_decorate18([
|
|
3849
|
+
Field17(() => String),
|
|
3850
|
+
_ts_metadata18("design:type", String)
|
|
3615
3851
|
], LoadAgentStateResponse.prototype, "messages", void 0);
|
|
3616
|
-
LoadAgentStateResponse =
|
|
3617
|
-
|
|
3852
|
+
LoadAgentStateResponse = _ts_decorate18([
|
|
3853
|
+
ObjectType6()
|
|
3618
3854
|
], LoadAgentStateResponse);
|
|
3619
3855
|
|
|
3620
3856
|
// src/graphql/inputs/load-agent-state.input.ts
|
|
3621
|
-
import { Field as
|
|
3622
|
-
function
|
|
3857
|
+
import { Field as Field18, InputType as InputType12 } from "type-graphql";
|
|
3858
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
3623
3859
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3624
3860
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3625
3861
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3629,31 +3865,31 @@ function _ts_decorate17(decorators, target, key, desc) {
|
|
|
3629
3865
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3630
3866
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3631
3867
|
}
|
|
3632
|
-
__name(
|
|
3633
|
-
function
|
|
3868
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
3869
|
+
function _ts_metadata19(k, v) {
|
|
3634
3870
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3635
3871
|
return Reflect.metadata(k, v);
|
|
3636
3872
|
}
|
|
3637
|
-
__name(
|
|
3873
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
3638
3874
|
var LoadAgentStateInput = class {
|
|
3639
3875
|
threadId;
|
|
3640
3876
|
agentName;
|
|
3641
3877
|
};
|
|
3642
3878
|
__name(LoadAgentStateInput, "LoadAgentStateInput");
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3879
|
+
_ts_decorate19([
|
|
3880
|
+
Field18(() => String),
|
|
3881
|
+
_ts_metadata19("design:type", String)
|
|
3646
3882
|
], LoadAgentStateInput.prototype, "threadId", void 0);
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3883
|
+
_ts_decorate19([
|
|
3884
|
+
Field18(() => String),
|
|
3885
|
+
_ts_metadata19("design:type", String)
|
|
3650
3886
|
], LoadAgentStateInput.prototype, "agentName", void 0);
|
|
3651
|
-
LoadAgentStateInput =
|
|
3652
|
-
|
|
3887
|
+
LoadAgentStateInput = _ts_decorate19([
|
|
3888
|
+
InputType12()
|
|
3653
3889
|
], LoadAgentStateInput);
|
|
3654
3890
|
|
|
3655
3891
|
// src/graphql/resolvers/state.resolver.ts
|
|
3656
|
-
function
|
|
3892
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
3657
3893
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3658
3894
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3659
3895
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3663,12 +3899,12 @@ function _ts_decorate18(decorators, target, key, desc) {
|
|
|
3663
3899
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3664
3900
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3665
3901
|
}
|
|
3666
|
-
__name(
|
|
3667
|
-
function
|
|
3902
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
3903
|
+
function _ts_metadata20(k, v) {
|
|
3668
3904
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
3669
3905
|
return Reflect.metadata(k, v);
|
|
3670
3906
|
}
|
|
3671
|
-
__name(
|
|
3907
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
3672
3908
|
function _ts_param2(paramIndex, decorator) {
|
|
3673
3909
|
return function(target, key) {
|
|
3674
3910
|
decorator(target, key, paramIndex);
|
|
@@ -3687,18 +3923,18 @@ var StateResolver = class {
|
|
|
3687
3923
|
}
|
|
3688
3924
|
};
|
|
3689
3925
|
__name(StateResolver, "StateResolver");
|
|
3690
|
-
|
|
3926
|
+
_ts_decorate20([
|
|
3691
3927
|
Query2(() => LoadAgentStateResponse),
|
|
3692
3928
|
_ts_param2(0, Ctx2()),
|
|
3693
3929
|
_ts_param2(1, Arg2("data")),
|
|
3694
|
-
|
|
3695
|
-
|
|
3930
|
+
_ts_metadata20("design:type", Function),
|
|
3931
|
+
_ts_metadata20("design:paramtypes", [
|
|
3696
3932
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
3697
3933
|
typeof LoadAgentStateInput === "undefined" ? Object : LoadAgentStateInput
|
|
3698
3934
|
]),
|
|
3699
|
-
|
|
3935
|
+
_ts_metadata20("design:returntype", Promise)
|
|
3700
3936
|
], StateResolver.prototype, "loadAgentState", null);
|
|
3701
|
-
StateResolver =
|
|
3937
|
+
StateResolver = _ts_decorate20([
|
|
3702
3938
|
Resolver2(() => LoadAgentStateResponse)
|
|
3703
3939
|
], StateResolver);
|
|
3704
3940
|
|
|
@@ -3814,4 +4050,4 @@ export {
|
|
|
3814
4050
|
getCommonConfig,
|
|
3815
4051
|
copilotRuntimeNodeHttpEndpoint
|
|
3816
4052
|
};
|
|
3817
|
-
//# sourceMappingURL=chunk-
|
|
4053
|
+
//# sourceMappingURL=chunk-W4G47FRC.mjs.map
|