@copilotkit/runtime 0.38.0-mme-alpha.0 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +41 -41
- package/CHANGELOG.md +10 -4
- package/dist/{chunk-6OJ47NCG.mjs → chunk-2PJG3NAC.mjs} +2 -2
- package/dist/{chunk-EWS5TMDA.mjs → chunk-6YGDE3YI.mjs} +91 -84
- package/dist/chunk-6YGDE3YI.mjs.map +1 -0
- package/dist/{chunk-XI3HBDMA.mjs → chunk-JBDOA7MK.mjs} +22 -11
- package/dist/chunk-JBDOA7MK.mjs.map +1 -0
- package/dist/{chunk-XXYCNRFT.mjs → chunk-JIKPSUGQ.mjs} +36 -69
- package/dist/chunk-JIKPSUGQ.mjs.map +1 -0
- package/dist/{index-d5ba24be.d.ts → index-0e75acd2.d.ts} +64 -38
- package/dist/index.d.ts +4 -4
- package/dist/index.js +163 -186
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{langchain-adapter-54784d29.d.ts → langchain-adapter-a02d1d38.d.ts} +4 -4
- package/dist/{langserve-63794237.d.ts → langserve-75ebbc38.d.ts} +1 -2
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +163 -186
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -10
- package/dist/lib/integrations/index.d.ts +3 -3
- package/dist/lib/integrations/index.js +118 -95
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +2 -2
- package/dist/lib/integrations/node-http/index.js +118 -95
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/{pages-router-d94f01da.d.ts → pages-router-e81920d5.d.ts} +1 -1
- package/dist/service-adapters/index.d.ts +2 -2
- package/dist/service-adapters/index.js +28 -17
- package/dist/service-adapters/index.js.map +1 -1
- package/dist/service-adapters/index.mjs +1 -1
- package/package.json +4 -4
- package/src/graphql/resolvers/copilot.resolver.ts +95 -24
- package/src/lib/copilot-runtime.ts +106 -36
- package/src/lib/index.ts +0 -1
- package/src/lib/integrations/shared.ts +1 -1
- package/src/service-adapters/experimental/groq/groq-adapter.ts +3 -1
- package/src/service-adapters/experimental/ollama/ollama-adapter.ts +3 -1
- package/src/service-adapters/google/google-genai-adapter.ts +3 -1
- package/src/service-adapters/langchain/langchain-adapter.ts +8 -9
- package/src/service-adapters/openai/openai-adapter.ts +8 -7
- package/src/service-adapters/openai/openai-assistant-adapter.ts +6 -8
- package/src/service-adapters/service-adapter.ts +1 -2
- package/dist/chunk-EWS5TMDA.mjs.map +0 -1
- package/dist/chunk-XI3HBDMA.mjs.map +0 -1
- package/dist/chunk-XXYCNRFT.mjs.map +0 -1
- package/src/lib/copilot-cloud.ts +0 -63
- /package/dist/{chunk-6OJ47NCG.mjs.map → chunk-2PJG3NAC.mjs.map} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @copilotkit/runtime@0.
|
|
2
|
+
> @copilotkit/runtime@1.0.0-beta.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/runtime
|
|
3
3
|
> tsup --clean
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts, src/lib/index.ts, src/service-adapters/index.ts, src/utils/index.ts, src/lib/cloud/index.ts, src/lib/integrations/index.ts, src/graphql/types/base/index.ts, src/graphql/types/converted/index.ts, src/lib/integrations/node-http/index.ts
|
|
@@ -10,76 +10,76 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.js
|
|
14
|
-
[32mCJS[39m [1mdist/
|
|
15
|
-
[32mCJS[39m [1mdist/
|
|
13
|
+
[32mCJS[39m [1mdist/graphql/types/base/index.js [22m[32m2.44 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist/graphql/types/converted/index.js [22m[32m3.04 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m90.21 KB[39m
|
|
16
|
+
[32mCJS[39m [1mdist/lib/index.js [22m[32m89.86 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/service-adapters/index.js [22m[32m32.69 KB[39m
|
|
16
18
|
[32mCJS[39m [1mdist/utils/index.js [22m[32m6.32 KB[39m
|
|
17
19
|
[32mCJS[39m [1mdist/lib/cloud/index.js [22m[32m787.00 B[39m
|
|
18
|
-
[32mCJS[39m [1mdist/lib/integrations/index.js [22m[
|
|
19
|
-
[32mCJS[39m [1mdist/lib/integrations/node-http/index.js [22m[
|
|
20
|
-
[32mCJS[39m [1mdist/graphql/types/converted/index.js [22m[32m3.04 KB[39m
|
|
21
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m138.89 KB[39m
|
|
22
|
-
[32mCJS[39m [1mdist/service-adapters/index.js.map [22m[32m61.49 KB[39m
|
|
23
|
-
[32mCJS[39m [1mdist/lib/index.js.map [22m[32m139.27 KB[39m
|
|
24
|
-
[32mCJS[39m [1mdist/lib/cloud/index.js.map [22m[32m217.00 B[39m
|
|
25
|
-
[32mCJS[39m [1mdist/utils/index.js.map [22m[32m5.63 KB[39m
|
|
26
|
-
[32mCJS[39m [1mdist/lib/integrations/index.js.map [22m[32m60.77 KB[39m
|
|
27
|
-
[32mCJS[39m [1mdist/lib/integrations/node-http/index.js.map [22m[32m57.87 KB[39m
|
|
28
|
-
[32mCJS[39m [1mdist/graphql/types/base/index.js [22m[32m2.44 KB[39m
|
|
29
|
-
[32mCJS[39m [1mdist/graphql/types/converted/index.js.map [22m[32m1.76 KB[39m
|
|
20
|
+
[32mCJS[39m [1mdist/lib/integrations/index.js [22m[32m52.20 KB[39m
|
|
21
|
+
[32mCJS[39m [1mdist/lib/integrations/node-http/index.js [22m[32m50.54 KB[39m
|
|
30
22
|
[32mCJS[39m [1mdist/graphql/types/base/index.js.map [22m[32m645.00 B[39m
|
|
31
|
-
[32mCJS[39m
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
23
|
+
[32mCJS[39m [1mdist/graphql/types/converted/index.js.map [22m[32m1.76 KB[39m
|
|
24
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m141.53 KB[39m
|
|
25
|
+
[32mCJS[39m [1mdist/lib/index.js.map [22m[32m141.87 KB[39m
|
|
26
|
+
[32mCJS[39m [1mdist/service-adapters/index.js.map [22m[32m62.05 KB[39m
|
|
27
|
+
[32mCJS[39m [1mdist/utils/index.js.map [22m[32m5.63 KB[39m
|
|
28
|
+
[32mCJS[39m [1mdist/lib/cloud/index.js.map [22m[32m217.00 B[39m
|
|
29
|
+
[32mCJS[39m [1mdist/lib/integrations/index.js.map [22m[32m64.90 KB[39m
|
|
30
|
+
[32mCJS[39m [1mdist/lib/integrations/node-http/index.js.map [22m[32m61.99 KB[39m
|
|
31
|
+
[32mCJS[39m ⚡️ Build success in 216ms
|
|
32
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.22 KB[39m
|
|
33
|
+
[32mESM[39m [1mdist/lib/index.mjs [22m[32m1007.00 B[39m
|
|
35
34
|
[32mESM[39m [1mdist/service-adapters/index.mjs [22m[32m427.00 B[39m
|
|
36
|
-
[32mESM[39m [1mdist/chunk-XXYCNRFT.mjs [22m[32m5.50 KB[39m
|
|
37
|
-
[32mESM[39m [1mdist/chunk-XI3HBDMA.mjs [22m[32m20.99 KB[39m
|
|
38
35
|
[32mESM[39m [1mdist/utils/index.mjs [22m[32m315.00 B[39m
|
|
39
36
|
[32mESM[39m [1mdist/lib/cloud/index.mjs [22m[32m34.00 B[39m
|
|
40
37
|
[32mESM[39m [1mdist/lib/integrations/index.mjs [22m[32m664.00 B[39m
|
|
41
|
-
[32mESM[39m [1mdist/chunk-
|
|
42
|
-
[32mESM[39m [1mdist/chunk-
|
|
38
|
+
[32mESM[39m [1mdist/chunk-JIKPSUGQ.mjs [22m[32m4.67 KB[39m
|
|
39
|
+
[32mESM[39m [1mdist/chunk-JBDOA7MK.mjs [22m[32m21.31 KB[39m
|
|
40
|
+
[32mESM[39m [1mdist/chunk-2PJG3NAC.mjs [22m[32m1.41 KB[39m
|
|
41
|
+
[32mESM[39m [1mdist/chunk-6YGDE3YI.mjs [22m[32m44.14 KB[39m
|
|
43
42
|
[32mESM[39m [1mdist/chunk-FRK6BXXV.mjs [22m[32m7.85 KB[39m
|
|
44
43
|
[32mESM[39m [1mdist/chunk-BYB2LNMK.mjs [22m[32m4.91 KB[39m
|
|
45
44
|
[32mESM[39m [1mdist/chunk-OZMCHYYR.mjs [22m[32m645.00 B[39m
|
|
46
45
|
[32mESM[39m [1mdist/chunk-6NZ4UMOD.mjs [22m[32m1.36 KB[39m
|
|
47
46
|
[32mESM[39m [1mdist/chunk-RHQLCJGG.mjs [22m[32m194.00 B[39m
|
|
48
|
-
[32mESM[39m [1mdist/lib/integrations/node-http/index.mjs
|
|
49
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[
|
|
47
|
+
[32mESM[39m [1mdist/lib/integrations/node-http/index.mjs [22m[32m349.00 B[39m
|
|
48
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m216.00 B[39m
|
|
50
49
|
[32mESM[39m [1mdist/lib/index.mjs.map [22m[32m71.00 B[39m
|
|
51
50
|
[32mESM[39m [1mdist/service-adapters/index.mjs.map [22m[32m71.00 B[39m
|
|
52
|
-
[32mESM[39m [1mdist/chunk-XXYCNRFT.mjs.map [22m[32m14.96 KB[39m
|
|
53
|
-
[32mESM[39m [1mdist/chunk-XI3HBDMA.mjs.map [22m[32m44.81 KB[39m
|
|
54
51
|
[32mESM[39m [1mdist/utils/index.mjs.map [22m[32m71.00 B[39m
|
|
55
|
-
[32mESM[39m [1mdist/lib/integrations/index.mjs.map [22m[32m71.00 B[39m
|
|
56
52
|
[32mESM[39m [1mdist/lib/cloud/index.mjs.map [22m[32m71.00 B[39m
|
|
57
|
-
[32mESM[39m [1mdist/
|
|
53
|
+
[32mESM[39m [1mdist/lib/integrations/index.mjs.map [22m[32m71.00 B[39m
|
|
54
|
+
[32mESM[39m [1mdist/graphql/types/base/index.mjs [22m[32m159.00 B[39m
|
|
55
|
+
[32mESM[39m [1mdist/chunk-JIKPSUGQ.mjs.map [22m[32m13.94 KB[39m
|
|
56
|
+
[32mESM[39m [1mdist/chunk-JBDOA7MK.mjs.map [22m[32m45.36 KB[39m
|
|
57
|
+
[32mESM[39m [1mdist/chunk-2PJG3NAC.mjs.map [22m[32m2.79 KB[39m
|
|
58
|
+
[32mESM[39m [1mdist/chunk-6YGDE3YI.mjs.map [22m[32m58.33 KB[39m
|
|
58
59
|
[32mESM[39m [1mdist/chunk-FRK6BXXV.mjs.map [22m[32m14.76 KB[39m
|
|
59
|
-
[32mESM[39m [1mdist/chunk-6OJ47NCG.mjs.map [22m[32m2.79 KB[39m
|
|
60
60
|
[32mESM[39m [1mdist/chunk-BYB2LNMK.mjs.map [22m[32m5.63 KB[39m
|
|
61
|
-
[32mESM[39m [1mdist/chunk-6NZ4UMOD.mjs.map [22m[32m645.00 B[39m
|
|
62
61
|
[32mESM[39m [1mdist/chunk-OZMCHYYR.mjs.map [22m[32m1.18 KB[39m
|
|
62
|
+
[32mESM[39m [1mdist/chunk-6NZ4UMOD.mjs.map [22m[32m645.00 B[39m
|
|
63
63
|
[32mESM[39m [1mdist/chunk-RHQLCJGG.mjs.map [22m[32m71.00 B[39m
|
|
64
|
-
[32mESM[39m [1mdist/graphql/types/base/index.mjs [22m[32m159.00 B[39m
|
|
65
64
|
[32mESM[39m [1mdist/graphql/types/converted/index.mjs [22m[32m283.00 B[39m
|
|
65
|
+
[32mESM[39m [1mdist/lib/integrations/node-http/index.mjs.map [22m[32m71.00 B[39m
|
|
66
66
|
[32mESM[39m [1mdist/graphql/types/base/index.mjs.map [22m[32m71.00 B[39m
|
|
67
67
|
[32mESM[39m [1mdist/graphql/types/converted/index.mjs.map [22m[32m71.00 B[39m
|
|
68
|
-
[32mESM[39m ⚡️ Build success in
|
|
68
|
+
[32mESM[39m ⚡️ Build success in 219ms
|
|
69
69
|
[34mDTS[39m Build start
|
|
70
|
-
[32mDTS[39m ⚡️ Build success in
|
|
71
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.
|
|
70
|
+
[32mDTS[39m ⚡️ Build success in 7048ms
|
|
71
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.28 KB[39m
|
|
72
72
|
[32mDTS[39m [1mdist/lib/cloud/index.d.ts [22m[32m116.00 B[39m
|
|
73
73
|
[32mDTS[39m [1mdist/graphql/types/base/index.d.ts [22m[32m92.00 B[39m
|
|
74
|
-
[32mDTS[39m [1mdist/lib/index.d.ts [22m[32m1.
|
|
74
|
+
[32mDTS[39m [1mdist/lib/index.d.ts [22m[32m1.11 KB[39m
|
|
75
75
|
[32mDTS[39m [1mdist/service-adapters/index.d.ts [22m[32m543.00 B[39m
|
|
76
76
|
[32mDTS[39m [1mdist/utils/index.d.ts [22m[32m172.00 B[39m
|
|
77
77
|
[32mDTS[39m [1mdist/lib/integrations/index.d.ts [22m[32m688.00 B[39m
|
|
78
78
|
[32mDTS[39m [1mdist/lib/integrations/node-http/index.d.ts [22m[32m338.00 B[39m
|
|
79
79
|
[32mDTS[39m [1mdist/graphql/types/converted/index.d.ts [22m[32m153.00 B[39m
|
|
80
|
-
[32mDTS[39m [1mdist/index-
|
|
81
|
-
[32mDTS[39m [1mdist/langchain-adapter-
|
|
82
|
-
[32mDTS[39m [1mdist/pages-router-
|
|
80
|
+
[32mDTS[39m [1mdist/index-0e75acd2.d.ts [22m[32m7.66 KB[39m
|
|
81
|
+
[32mDTS[39m [1mdist/langchain-adapter-a02d1d38.d.ts [22m[32m5.74 KB[39m
|
|
82
|
+
[32mDTS[39m [1mdist/pages-router-e81920d5.d.ts [22m[32m891.00 B[39m
|
|
83
83
|
[32mDTS[39m [1mdist/failed-response-status-reasons-0ab19e06.d.ts [22m[32m1.41 KB[39m
|
|
84
|
-
[32mDTS[39m [1mdist/langserve-
|
|
84
|
+
[32mDTS[39m [1mdist/langserve-75ebbc38.d.ts [22m[32m3.59 KB[39m
|
|
85
85
|
[32mDTS[39m [1mdist/index-aa091e3c.d.ts [22m[32m1.33 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 1.0.0-beta.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- V1.0 Release Candidate
|
|
8
|
+
|
|
9
|
+
- A robust new protocol between the frontend and the Copilot Runtime
|
|
10
|
+
- Support for Copilot Cloud
|
|
11
|
+
- Generative UI
|
|
12
|
+
- Support for LangChain universal tool calling
|
|
13
|
+
- OpenAI assistant API streaming
|
|
8
14
|
|
|
9
15
|
### Patch Changes
|
|
10
16
|
|
|
11
17
|
- Updated dependencies
|
|
12
|
-
- @copilotkit/shared@0.
|
|
18
|
+
- @copilotkit/shared@1.0.0-beta.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCommonConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6YGDE3YI.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-RHQLCJGG.mjs";
|
|
@@ -51,4 +51,4 @@ export {
|
|
|
51
51
|
config,
|
|
52
52
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-2PJG3NAC.mjs.map
|
|
@@ -8,6 +8,11 @@ import {
|
|
|
8
8
|
SuccessResponseStatus,
|
|
9
9
|
UnknownErrorResponse
|
|
10
10
|
} from "./chunk-BYB2LNMK.mjs";
|
|
11
|
+
import {
|
|
12
|
+
ActionExecutionMessage,
|
|
13
|
+
ResultMessage,
|
|
14
|
+
TextMessage
|
|
15
|
+
} from "./chunk-OZMCHYYR.mjs";
|
|
11
16
|
import {
|
|
12
17
|
BaseMessage
|
|
13
18
|
} from "./chunk-6NZ4UMOD.mjs";
|
|
@@ -765,9 +770,7 @@ __name(executeAction, "executeAction");
|
|
|
765
770
|
// src/graphql/resolvers/copilot.resolver.ts
|
|
766
771
|
import { GraphQLJSONObject } from "graphql-scalars";
|
|
767
772
|
import { plainToInstance } from "class-transformer";
|
|
768
|
-
|
|
769
|
-
// src/graphql/types/guardrails-result.type.ts
|
|
770
|
-
import { Field as Field9, ObjectType as ObjectType3, registerEnumType as registerEnumType3 } from "type-graphql";
|
|
773
|
+
import { GraphQLError } from "graphql";
|
|
771
774
|
function _ts_decorate9(decorators, target, key, desc) {
|
|
772
775
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
773
776
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -784,59 +787,13 @@ function _ts_metadata9(k, v) {
|
|
|
784
787
|
return Reflect.metadata(k, v);
|
|
785
788
|
}
|
|
786
789
|
__name(_ts_metadata9, "_ts_metadata");
|
|
787
|
-
var GuardrailsResultStatus;
|
|
788
|
-
(function(GuardrailsResultStatus2) {
|
|
789
|
-
GuardrailsResultStatus2["ALLOWED"] = "allowed";
|
|
790
|
-
GuardrailsResultStatus2["DENIED"] = "denied";
|
|
791
|
-
})(GuardrailsResultStatus || (GuardrailsResultStatus = {}));
|
|
792
|
-
registerEnumType3(GuardrailsResultStatus, {
|
|
793
|
-
name: "GuardrailsResultStatus",
|
|
794
|
-
description: "The status of the guardrails check"
|
|
795
|
-
});
|
|
796
|
-
var GuardrailsResult = class {
|
|
797
|
-
status;
|
|
798
|
-
reason;
|
|
799
|
-
};
|
|
800
|
-
__name(GuardrailsResult, "GuardrailsResult");
|
|
801
|
-
_ts_decorate9([
|
|
802
|
-
Field9(() => GuardrailsResultStatus),
|
|
803
|
-
_ts_metadata9("design:type", String)
|
|
804
|
-
], GuardrailsResult.prototype, "status", void 0);
|
|
805
|
-
_ts_decorate9([
|
|
806
|
-
Field9(() => String, {
|
|
807
|
-
nullable: true
|
|
808
|
-
}),
|
|
809
|
-
_ts_metadata9("design:type", String)
|
|
810
|
-
], GuardrailsResult.prototype, "reason", void 0);
|
|
811
|
-
GuardrailsResult = _ts_decorate9([
|
|
812
|
-
ObjectType3()
|
|
813
|
-
], GuardrailsResult);
|
|
814
|
-
|
|
815
|
-
// src/graphql/resolvers/copilot.resolver.ts
|
|
816
|
-
import { GraphQLError } from "graphql";
|
|
817
|
-
function _ts_decorate10(decorators, target, key, desc) {
|
|
818
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
819
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
820
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
821
|
-
else
|
|
822
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
823
|
-
if (d = decorators[i])
|
|
824
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
825
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
826
|
-
}
|
|
827
|
-
__name(_ts_decorate10, "_ts_decorate");
|
|
828
|
-
function _ts_metadata10(k, v) {
|
|
829
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
830
|
-
return Reflect.metadata(k, v);
|
|
831
|
-
}
|
|
832
|
-
__name(_ts_metadata10, "_ts_metadata");
|
|
833
790
|
function _ts_param(paramIndex, decorator) {
|
|
834
791
|
return function(target, key) {
|
|
835
792
|
decorator(target, key, paramIndex);
|
|
836
793
|
};
|
|
837
794
|
}
|
|
838
795
|
__name(_ts_param, "_ts_param");
|
|
839
|
-
var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data,
|
|
796
|
+
var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
|
|
840
797
|
var _a;
|
|
841
798
|
if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
|
|
842
799
|
const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
|
|
@@ -859,18 +816,12 @@ var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPubl
|
|
|
859
816
|
},
|
|
860
817
|
body: JSON.stringify(body)
|
|
861
818
|
});
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
throw new GraphQLError("Failed to invoke guardrails");
|
|
819
|
+
if (guardrailsResult.ok) {
|
|
820
|
+
const resultJson = await guardrailsResult.json();
|
|
821
|
+
onResult(resultJson);
|
|
822
|
+
} else {
|
|
823
|
+
onError(await guardrailsResult.json());
|
|
868
824
|
}
|
|
869
|
-
onResult(responseBody);
|
|
870
|
-
} else {
|
|
871
|
-
onResult({
|
|
872
|
-
status: GuardrailsResultStatus.ALLOWED
|
|
873
|
-
});
|
|
874
825
|
}
|
|
875
826
|
}, "invokeGuardrails");
|
|
876
827
|
var CopilotResolver = class {
|
|
@@ -923,6 +874,13 @@ var CopilotResolver = class {
|
|
|
923
874
|
const responseStatus$ = new ReplaySubject2();
|
|
924
875
|
const interruptStreaming$ = new ReplaySubject2();
|
|
925
876
|
const guardrailsResult$ = new ReplaySubject2();
|
|
877
|
+
let outputMessages = [];
|
|
878
|
+
let resolveOutputMessagesPromise;
|
|
879
|
+
let rejectOutputMessagesPromise;
|
|
880
|
+
const outputMessagesPromise = new Promise((resolve, reject) => {
|
|
881
|
+
resolveOutputMessagesPromise = resolve;
|
|
882
|
+
rejectOutputMessagesPromise = reject;
|
|
883
|
+
});
|
|
926
884
|
logger2.debug("Processing");
|
|
927
885
|
const { eventSource, threadId = nanoid(), runId, actions } = await copilotRuntime.process({
|
|
928
886
|
serviceAdapter,
|
|
@@ -930,7 +888,9 @@ var CopilotResolver = class {
|
|
|
930
888
|
actions: data.frontend.actions,
|
|
931
889
|
threadId: data.threadId,
|
|
932
890
|
runId: data.runId,
|
|
933
|
-
publicApiKey: void 0
|
|
891
|
+
publicApiKey: void 0,
|
|
892
|
+
properties: ctx.properties || {},
|
|
893
|
+
outputMessagesPromise
|
|
934
894
|
});
|
|
935
895
|
logger2.debug("Event source created, creating response");
|
|
936
896
|
const response = {
|
|
@@ -949,7 +909,6 @@ var CopilotResolver = class {
|
|
|
949
909
|
baseUrl: copilotCloudBaseUrl,
|
|
950
910
|
copilotCloudPublicApiKey,
|
|
951
911
|
data,
|
|
952
|
-
logger: logger2,
|
|
953
912
|
onResult: (result) => {
|
|
954
913
|
logger2.debug({
|
|
955
914
|
status: result.status
|
|
@@ -962,21 +921,41 @@ var CopilotResolver = class {
|
|
|
962
921
|
interruptStreaming$.next({
|
|
963
922
|
reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
|
|
964
923
|
});
|
|
924
|
+
outputMessages = [
|
|
925
|
+
plainToInstance(TextMessage, {
|
|
926
|
+
id: nanoid(),
|
|
927
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
928
|
+
content: result.reason,
|
|
929
|
+
role: MessageRole.assistant
|
|
930
|
+
})
|
|
931
|
+
];
|
|
932
|
+
resolveOutputMessagesPromise(outputMessages);
|
|
965
933
|
}
|
|
934
|
+
},
|
|
935
|
+
onError: (err) => {
|
|
936
|
+
logger2.error({
|
|
937
|
+
err
|
|
938
|
+
}, "Error in guardrails validation");
|
|
939
|
+
responseStatus$.next(new UnknownErrorResponse({
|
|
940
|
+
description: `An unknown error has occurred in the guardrails validation`
|
|
941
|
+
}));
|
|
942
|
+
interruptStreaming$.next({
|
|
943
|
+
reason: `Interrupted due to unknown error in guardrails validation`
|
|
944
|
+
});
|
|
945
|
+
rejectOutputMessagesPromise(err);
|
|
966
946
|
}
|
|
967
947
|
});
|
|
968
948
|
}
|
|
969
949
|
let eventStreamSubscription;
|
|
970
950
|
const eventStream = eventSource.process({
|
|
971
|
-
serversideActions:
|
|
951
|
+
serversideActions: actions,
|
|
972
952
|
guardrailsResult$: ((_b = data.cloud) == null ? void 0 : _b.guardrails) ? guardrailsResult$ : null
|
|
973
953
|
}).pipe(
|
|
974
954
|
// shareReplay() ensures that later subscribers will see the whole stream instead of
|
|
975
955
|
// just the events that were emitted after the subscriber was added.
|
|
976
956
|
shareReplay(),
|
|
977
957
|
finalize(() => {
|
|
978
|
-
logger2.debug("Event stream finalized
|
|
979
|
-
stopStreamingMessages();
|
|
958
|
+
logger2.debug("Event stream finalized");
|
|
980
959
|
})
|
|
981
960
|
);
|
|
982
961
|
logger2.debug("Event stream created, subscribing to event stream");
|
|
@@ -999,6 +978,7 @@ var CopilotResolver = class {
|
|
|
999
978
|
role: MessageRole.assistant,
|
|
1000
979
|
content: new Repeater(async (pushTextChunk, stopStreamingText) => {
|
|
1001
980
|
logger2.debug("Text message content repeater created");
|
|
981
|
+
const textChunks = [];
|
|
1002
982
|
let textSubscription;
|
|
1003
983
|
interruptStreaming$.pipe(shareReplay(), take(1), tap(({ reason, messageId: messageId2 }) => {
|
|
1004
984
|
logger2.debug({
|
|
@@ -1012,13 +992,14 @@ var CopilotResolver = class {
|
|
|
1012
992
|
messageId: messageId2
|
|
1013
993
|
}));
|
|
1014
994
|
stopStreamingText();
|
|
1015
|
-
textSubscription.unsubscribe();
|
|
995
|
+
textSubscription == null ? void 0 : textSubscription.unsubscribe();
|
|
1016
996
|
})).subscribe();
|
|
1017
997
|
logger2.debug("Subscribing to text message content stream");
|
|
1018
998
|
textSubscription = textMessageContentStream.subscribe({
|
|
1019
999
|
next: async (e) => {
|
|
1020
1000
|
if (e.type == RuntimeEventTypes.TextMessageContent) {
|
|
1021
1001
|
await pushTextChunk(e.content);
|
|
1002
|
+
textChunks.push(e.content);
|
|
1022
1003
|
}
|
|
1023
1004
|
},
|
|
1024
1005
|
error: (err) => {
|
|
@@ -1030,13 +1011,19 @@ var CopilotResolver = class {
|
|
|
1030
1011
|
messageId
|
|
1031
1012
|
});
|
|
1032
1013
|
stopStreamingText();
|
|
1033
|
-
textSubscription.unsubscribe();
|
|
1014
|
+
textSubscription == null ? void 0 : textSubscription.unsubscribe();
|
|
1034
1015
|
},
|
|
1035
1016
|
complete: () => {
|
|
1036
1017
|
logger2.debug("Text message content stream completed");
|
|
1037
1018
|
streamingTextStatus.next(new SuccessMessageStatus());
|
|
1038
1019
|
stopStreamingText();
|
|
1039
|
-
textSubscription.unsubscribe();
|
|
1020
|
+
textSubscription == null ? void 0 : textSubscription.unsubscribe();
|
|
1021
|
+
outputMessages.push(plainToInstance(TextMessage, {
|
|
1022
|
+
id: messageId,
|
|
1023
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
1024
|
+
content: textChunks.join(""),
|
|
1025
|
+
role: MessageRole.assistant
|
|
1026
|
+
}));
|
|
1040
1027
|
}
|
|
1041
1028
|
});
|
|
1042
1029
|
})
|
|
@@ -1054,11 +1041,13 @@ var CopilotResolver = class {
|
|
|
1054
1041
|
scope: event.scope,
|
|
1055
1042
|
arguments: new Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
|
|
1056
1043
|
logger2.debug("Action execution argument stream created");
|
|
1044
|
+
const argumentChunks = [];
|
|
1057
1045
|
let actionExecutionArgumentSubscription;
|
|
1058
1046
|
actionExecutionArgumentSubscription = actionExecutionArgumentStream.subscribe({
|
|
1059
1047
|
next: async (e) => {
|
|
1060
1048
|
if (e.type == RuntimeEventTypes.ActionExecutionArgs) {
|
|
1061
1049
|
await pushArgumentsChunk(e.args);
|
|
1050
|
+
argumentChunks.push(e.args);
|
|
1062
1051
|
}
|
|
1063
1052
|
},
|
|
1064
1053
|
error: (err) => {
|
|
@@ -1069,20 +1058,29 @@ var CopilotResolver = class {
|
|
|
1069
1058
|
reason: "An unknown error has occurred in the action execution argument stream"
|
|
1070
1059
|
}));
|
|
1071
1060
|
stopStreamingArguments();
|
|
1072
|
-
actionExecutionArgumentSubscription.unsubscribe();
|
|
1061
|
+
actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
|
|
1073
1062
|
},
|
|
1074
1063
|
complete: () => {
|
|
1075
1064
|
logger2.debug("Action execution argument stream completed");
|
|
1076
1065
|
streamingArgumentsStatus.next(new SuccessMessageStatus());
|
|
1077
1066
|
stopStreamingArguments();
|
|
1078
|
-
actionExecutionArgumentSubscription.unsubscribe();
|
|
1067
|
+
actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
|
|
1068
|
+
outputMessages.push(plainToInstance(ActionExecutionMessage, {
|
|
1069
|
+
id: event.actionExecutionId,
|
|
1070
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
1071
|
+
name: event.actionName,
|
|
1072
|
+
scope: event.scope,
|
|
1073
|
+
arguments: argumentChunks.join("")
|
|
1074
|
+
}));
|
|
1079
1075
|
}
|
|
1080
1076
|
});
|
|
1081
1077
|
})
|
|
1082
1078
|
});
|
|
1083
1079
|
break;
|
|
1084
1080
|
case RuntimeEventTypes.ActionExecutionResult:
|
|
1085
|
-
logger2.debug(
|
|
1081
|
+
logger2.debug({
|
|
1082
|
+
result: event.result
|
|
1083
|
+
}, "Action execution result event received");
|
|
1086
1084
|
pushMessage({
|
|
1087
1085
|
id: nanoid(),
|
|
1088
1086
|
status: new SuccessMessageStatus(),
|
|
@@ -1091,6 +1089,13 @@ var CopilotResolver = class {
|
|
|
1091
1089
|
actionName: event.actionName,
|
|
1092
1090
|
result: event.result
|
|
1093
1091
|
});
|
|
1092
|
+
outputMessages.push(plainToInstance(ResultMessage, {
|
|
1093
|
+
id: nanoid(),
|
|
1094
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
1095
|
+
actionExecutionId: event.actionExecutionId,
|
|
1096
|
+
actionName: event.actionName,
|
|
1097
|
+
result: event.result
|
|
1098
|
+
}));
|
|
1094
1099
|
break;
|
|
1095
1100
|
}
|
|
1096
1101
|
},
|
|
@@ -1101,8 +1106,9 @@ var CopilotResolver = class {
|
|
|
1101
1106
|
responseStatus$.next(new UnknownErrorResponse({
|
|
1102
1107
|
description: `An unknown error has occurred in the event stream`
|
|
1103
1108
|
}));
|
|
1104
|
-
eventStreamSubscription.unsubscribe();
|
|
1109
|
+
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
1105
1110
|
stopStreamingMessages();
|
|
1111
|
+
rejectOutputMessagesPromise(err);
|
|
1106
1112
|
},
|
|
1107
1113
|
complete: async () => {
|
|
1108
1114
|
var _a2;
|
|
@@ -1112,8 +1118,9 @@ var CopilotResolver = class {
|
|
|
1112
1118
|
await firstValueFrom2(guardrailsResult$);
|
|
1113
1119
|
}
|
|
1114
1120
|
responseStatus$.next(new SuccessResponseStatus());
|
|
1115
|
-
eventStreamSubscription.unsubscribe();
|
|
1121
|
+
eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
|
|
1116
1122
|
stopStreamingMessages();
|
|
1123
|
+
resolveOutputMessagesPromise(outputMessages);
|
|
1117
1124
|
}
|
|
1118
1125
|
});
|
|
1119
1126
|
})
|
|
@@ -1122,28 +1129,28 @@ var CopilotResolver = class {
|
|
|
1122
1129
|
}
|
|
1123
1130
|
};
|
|
1124
1131
|
__name(CopilotResolver, "CopilotResolver");
|
|
1125
|
-
|
|
1132
|
+
_ts_decorate9([
|
|
1126
1133
|
Query(() => String),
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1134
|
+
_ts_metadata9("design:type", Function),
|
|
1135
|
+
_ts_metadata9("design:paramtypes", []),
|
|
1136
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1130
1137
|
], CopilotResolver.prototype, "hello", null);
|
|
1131
|
-
|
|
1138
|
+
_ts_decorate9([
|
|
1132
1139
|
Mutation(() => CopilotResponse),
|
|
1133
1140
|
_ts_param(0, Ctx()),
|
|
1134
1141
|
_ts_param(1, Arg("data")),
|
|
1135
1142
|
_ts_param(2, Arg("properties", () => GraphQLJSONObject, {
|
|
1136
1143
|
nullable: true
|
|
1137
1144
|
})),
|
|
1138
|
-
|
|
1139
|
-
|
|
1145
|
+
_ts_metadata9("design:type", Function),
|
|
1146
|
+
_ts_metadata9("design:paramtypes", [
|
|
1140
1147
|
typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
|
|
1141
1148
|
typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
|
|
1142
1149
|
typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
|
|
1143
1150
|
]),
|
|
1144
|
-
|
|
1151
|
+
_ts_metadata9("design:returntype", Promise)
|
|
1145
1152
|
], CopilotResolver.prototype, "generateCopilotResponse", null);
|
|
1146
|
-
CopilotResolver =
|
|
1153
|
+
CopilotResolver = _ts_decorate9([
|
|
1147
1154
|
Resolver(() => CopilotResponse)
|
|
1148
1155
|
], CopilotResolver);
|
|
1149
1156
|
|
|
@@ -1253,4 +1260,4 @@ export {
|
|
|
1253
1260
|
getCommonConfig,
|
|
1254
1261
|
copilotRuntimeNodeHttpEndpoint
|
|
1255
1262
|
};
|
|
1256
|
-
//# sourceMappingURL=chunk-
|
|
1263
|
+
//# sourceMappingURL=chunk-6YGDE3YI.mjs.map
|