@copilotkit/runtime 1.0.0-beta.0 → 1.0.0-beta.1

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.
Files changed (74) hide show
  1. package/.turbo/turbo-build.log +79 -65
  2. package/CHANGELOG.md +8 -0
  3. package/__snapshots__/schema/schema.graphql +15 -1
  4. package/dist/chunk-44O2JGUY.mjs +12 -0
  5. package/dist/chunk-5U6S5EGT.mjs +24 -0
  6. package/dist/chunk-5U6S5EGT.mjs.map +1 -0
  7. package/dist/{chunk-JBDOA7MK.mjs → chunk-7QCEK4DP.mjs} +4 -4
  8. package/dist/{chunk-6YGDE3YI.mjs → chunk-DL2QQEOR.mjs} +154 -19
  9. package/dist/chunk-DL2QQEOR.mjs.map +1 -0
  10. package/dist/{chunk-FRK6BXXV.mjs → chunk-DVDKD6F5.mjs} +3 -3
  11. package/dist/{chunk-JIKPSUGQ.mjs → chunk-F5K2JKGM.mjs} +5 -5
  12. package/dist/{chunk-OZMCHYYR.mjs → chunk-GEIBJJQ4.mjs} +3 -3
  13. package/dist/{chunk-2PJG3NAC.mjs → chunk-R25IOQB5.mjs} +17 -4
  14. package/dist/chunk-R25IOQB5.mjs.map +1 -0
  15. package/dist/{chunk-6NZ4UMOD.mjs → chunk-RMZWGQ46.mjs} +2 -2
  16. package/dist/{chunk-BYB2LNMK.mjs → chunk-U3V2BCGI.mjs} +2 -2
  17. package/dist/chunk-ZTEJCDMJ.mjs +24 -0
  18. package/dist/chunk-ZTEJCDMJ.mjs.map +1 -0
  19. package/dist/graphql/types/base/index.mjs +2 -2
  20. package/dist/graphql/types/converted/index.mjs +3 -3
  21. package/dist/index.d.ts +6 -3
  22. package/dist/index.js +187 -13
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +17 -9
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/lib/index.d.ts +6 -3
  27. package/dist/lib/index.js +187 -13
  28. package/dist/lib/index.js.map +1 -1
  29. package/dist/lib/index.mjs +17 -9
  30. package/dist/lib/integrations/index.d.ts +6 -3
  31. package/dist/lib/integrations/index.js +187 -13
  32. package/dist/lib/integrations/index.js.map +1 -1
  33. package/dist/lib/integrations/index.mjs +15 -7
  34. package/dist/lib/integrations/nest/index.d.ts +14 -0
  35. package/dist/lib/integrations/nest/index.js +1481 -0
  36. package/dist/lib/integrations/nest/index.js.map +1 -0
  37. package/dist/lib/integrations/nest/index.mjs +13 -0
  38. package/dist/lib/integrations/nest/index.mjs.map +1 -0
  39. package/dist/lib/integrations/node-express/index.d.ts +14 -0
  40. package/dist/lib/integrations/node-express/index.js +1481 -0
  41. package/dist/lib/integrations/node-express/index.js.map +1 -0
  42. package/dist/lib/integrations/node-express/index.mjs +13 -0
  43. package/dist/lib/integrations/node-express/index.mjs.map +1 -0
  44. package/dist/lib/integrations/node-http/index.d.ts +6 -2
  45. package/dist/lib/integrations/node-http/index.js +147 -13
  46. package/dist/lib/integrations/node-http/index.js.map +1 -1
  47. package/dist/lib/integrations/node-http/index.mjs +6 -6
  48. package/dist/{pages-router-e81920d5.d.ts → pages-router-24897543.d.ts} +1 -1
  49. package/dist/service-adapters/index.mjs +5 -5
  50. package/dist/{index-0e75acd2.d.ts → shared-48c0f7b8.d.ts} +2 -5
  51. package/dist/utils/index.mjs +2 -2
  52. package/package.json +2 -2
  53. package/src/graphql/inputs/cloud-guardrails.input.ts +2 -2
  54. package/src/graphql/inputs/generate-copilot-response.input.ts +10 -0
  55. package/src/graphql/resolvers/copilot.resolver.ts +12 -3
  56. package/src/graphql/types/enums.ts +13 -0
  57. package/src/lib/integrations/index.ts +2 -0
  58. package/src/lib/integrations/nest/index.ts +14 -0
  59. package/src/lib/integrations/nextjs/app-router.ts +10 -0
  60. package/src/lib/integrations/nextjs/pages-router.ts +10 -0
  61. package/src/lib/integrations/node-express/index.ts +14 -0
  62. package/src/lib/integrations/node-http/index.ts +10 -0
  63. package/src/lib/integrations/shared.ts +14 -1
  64. package/src/lib/telemetry-client.ts +9 -0
  65. package/dist/chunk-2PJG3NAC.mjs.map +0 -1
  66. package/dist/chunk-6YGDE3YI.mjs.map +0 -1
  67. package/dist/chunk-RHQLCJGG.mjs +0 -7
  68. /package/dist/{chunk-RHQLCJGG.mjs.map → chunk-44O2JGUY.mjs.map} +0 -0
  69. /package/dist/{chunk-JBDOA7MK.mjs.map → chunk-7QCEK4DP.mjs.map} +0 -0
  70. /package/dist/{chunk-FRK6BXXV.mjs.map → chunk-DVDKD6F5.mjs.map} +0 -0
  71. /package/dist/{chunk-JIKPSUGQ.mjs.map → chunk-F5K2JKGM.mjs.map} +0 -0
  72. /package/dist/{chunk-OZMCHYYR.mjs.map → chunk-GEIBJJQ4.mjs.map} +0 -0
  73. /package/dist/{chunk-6NZ4UMOD.mjs.map → chunk-RMZWGQ46.mjs.map} +0 -0
  74. /package/dist/{chunk-BYB2LNMK.mjs.map → chunk-U3V2BCGI.mjs.map} +0 -0
@@ -1,8 +1,8 @@
1
1
 
2
- > @copilotkit/runtime@1.0.0-beta.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/runtime
2
+ > @copilotkit/runtime@1.0.0-beta.1 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/runtime
3
3
  > tsup --clean
4
4
 
5
- CLI 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
5
+ CLI 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/nest/index.ts, src/lib/integrations/node-express/index.ts, src/lib/integrations/node-http/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v6.7.0
8
8
  CLI Using tsup config: /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/runtime/tsup.config.ts
@@ -10,76 +10,90 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/graphql/types/base/index.js 2.44 KB
14
- CJS dist/graphql/types/converted/index.js 3.04 KB
15
- CJS dist/index.js 90.21 KB
16
- CJS dist/lib/index.js 89.86 KB
17
- CJS dist/service-adapters/index.js 32.69 KB
18
- CJS dist/utils/index.js 6.32 KB
19
- CJS dist/lib/cloud/index.js 787.00 B
20
- CJS dist/lib/integrations/index.js 52.20 KB
21
- CJS dist/lib/integrations/node-http/index.js 50.54 KB
22
- CJS dist/graphql/types/base/index.js.map 645.00 B
23
- CJS dist/graphql/types/converted/index.js.map 1.76 KB
24
- CJS dist/index.js.map 141.53 KB
25
- CJS dist/lib/index.js.map 141.87 KB
26
- CJS dist/service-adapters/index.js.map 62.05 KB
27
- CJS dist/utils/index.js.map 5.63 KB
28
- CJS dist/lib/cloud/index.js.map 217.00 B
29
- CJS dist/lib/integrations/index.js.map 64.90 KB
30
- CJS dist/lib/integrations/node-http/index.js.map 61.99 KB
31
- CJS ⚡️ Build success in 216ms
32
- ESM dist/index.mjs 1.22 KB
33
- ESM dist/lib/index.mjs 1007.00 B
34
- ESM dist/service-adapters/index.mjs 427.00 B
35
- ESM dist/utils/index.mjs 315.00 B
36
- ESM dist/lib/cloud/index.mjs 34.00 B
37
- ESM dist/lib/integrations/index.mjs 664.00 B
38
- ESM dist/chunk-JIKPSUGQ.mjs 4.67 KB
39
- ESM dist/chunk-JBDOA7MK.mjs 21.31 KB
40
- ESM dist/chunk-2PJG3NAC.mjs 1.41 KB
41
- ESM dist/chunk-6YGDE3YI.mjs 44.14 KB
42
- ESM dist/chunk-FRK6BXXV.mjs 7.85 KB
43
- ESM dist/chunk-BYB2LNMK.mjs 4.91 KB
44
- ESM dist/chunk-OZMCHYYR.mjs 645.00 B
45
- ESM dist/chunk-6NZ4UMOD.mjs 1.36 KB
46
- ESM dist/chunk-RHQLCJGG.mjs 194.00 B
47
- ESM dist/lib/integrations/node-http/index.mjs 349.00 B
48
- ESM dist/index.mjs.map 216.00 B
49
- ESM dist/lib/index.mjs.map 71.00 B
50
- ESM dist/service-adapters/index.mjs.map 71.00 B
51
- ESM dist/utils/index.mjs.map 71.00 B
52
- ESM dist/lib/cloud/index.mjs.map 71.00 B
53
- ESM dist/lib/integrations/index.mjs.map 71.00 B
54
- ESM dist/graphql/types/base/index.mjs 159.00 B
55
- ESM dist/chunk-JIKPSUGQ.mjs.map 13.94 KB
56
- ESM dist/chunk-JBDOA7MK.mjs.map 45.36 KB
57
- ESM dist/chunk-2PJG3NAC.mjs.map 2.79 KB
58
- ESM dist/chunk-6YGDE3YI.mjs.map 58.33 KB
59
- ESM dist/chunk-FRK6BXXV.mjs.map 14.76 KB
60
- ESM dist/chunk-BYB2LNMK.mjs.map 5.63 KB
61
- ESM dist/chunk-OZMCHYYR.mjs.map 1.18 KB
62
- ESM dist/chunk-6NZ4UMOD.mjs.map 645.00 B
63
- ESM dist/chunk-RHQLCJGG.mjs.map 71.00 B
64
- ESM dist/graphql/types/converted/index.mjs 283.00 B
65
- ESM dist/lib/integrations/node-http/index.mjs.map 71.00 B
66
- ESM dist/graphql/types/base/index.mjs.map 71.00 B
67
- ESM dist/graphql/types/converted/index.mjs.map 71.00 B
68
- ESM ⚡️ Build success in 219ms
13
+ ESM dist/index.mjs 1.43 KB
14
+ ESM dist/lib/index.mjs 1.19 KB
15
+ ESM dist/service-adapters/index.mjs 427.00 B
16
+ ESM dist/utils/index.mjs 315.00 B
17
+ ESM dist/lib/cloud/index.mjs 34.00 B
18
+ ESM dist/lib/integrations/index.mjs 884.00 B
19
+ ESM dist/chunk-F5K2JKGM.mjs 4.67 KB
20
+ ESM dist/chunk-7QCEK4DP.mjs 21.31 KB
21
+ ESM dist/chunk-R25IOQB5.mjs 1.80 KB
22
+ ESM dist/chunk-ZTEJCDMJ.mjs 611.00 B
23
+ ESM dist/chunk-5U6S5EGT.mjs 655.00 B
24
+ ESM dist/chunk-DVDKD6F5.mjs 7.85 KB
25
+ ESM dist/chunk-DL2QQEOR.mjs 48.70 KB
26
+ ESM dist/chunk-U3V2BCGI.mjs 4.91 KB
27
+ ESM dist/chunk-RMZWGQ46.mjs 1.36 KB
28
+ ESM dist/chunk-GEIBJJQ4.mjs 645.00 B
29
+ ESM dist/chunk-44O2JGUY.mjs 418.00 B
30
+ ESM dist/lib/integrations/nest/index.mjs 379.00 B
31
+ ESM dist/lib/integrations/node-express/index.mjs 393.00 B
32
+ ESM dist/lib/integrations/node-http/index.mjs 349.00 B
33
+ ESM dist/graphql/types/base/index.mjs 159.00 B
34
+ ESM dist/index.mjs.map 222.00 B
35
+ ESM dist/lib/index.mjs.map 71.00 B
36
+ ESM dist/service-adapters/index.mjs.map 71.00 B
37
+ ESM dist/utils/index.mjs.map 71.00 B
38
+ ESM dist/lib/integrations/index.mjs.map 71.00 B
39
+ ESM dist/lib/cloud/index.mjs.map 71.00 B
40
+ ESM dist/chunk-F5K2JKGM.mjs.map 13.94 KB
41
+ ESM dist/chunk-7QCEK4DP.mjs.map 45.36 KB
42
+ ESM dist/chunk-R25IOQB5.mjs.map 3.55 KB
43
+ ESM dist/chunk-ZTEJCDMJ.mjs.map 901.00 B
44
+ ESM dist/chunk-5U6S5EGT.mjs.map 931.00 B
45
+ ESM dist/chunk-DVDKD6F5.mjs.map 14.76 KB
46
+ ESM dist/chunk-DL2QQEOR.mjs.map 64.60 KB
47
+ ESM dist/chunk-U3V2BCGI.mjs.map 5.63 KB
48
+ ESM dist/graphql/types/converted/index.mjs 283.00 B
49
+ ESM dist/chunk-RMZWGQ46.mjs.map 645.00 B
50
+ ESM dist/chunk-GEIBJJQ4.mjs.map 1.18 KB
51
+ ESM dist/chunk-44O2JGUY.mjs.map 71.00 B
52
+ ESM dist/lib/integrations/nest/index.mjs.map 71.00 B
53
+ ESM dist/lib/integrations/node-express/index.mjs.map 71.00 B
54
+ ESM dist/lib/integrations/node-http/index.mjs.map 71.00 B
55
+ ESM dist/graphql/types/base/index.mjs.map 71.00 B
56
+ ESM dist/graphql/types/converted/index.mjs.map 71.00 B
57
+ ESM ⚡️ Build success in 220ms
58
+ CJS dist/index.js 96.29 KB
59
+ CJS dist/lib/index.js 95.93 KB
60
+ CJS dist/service-adapters/index.js 32.69 KB
61
+ CJS dist/utils/index.js 6.32 KB
62
+ CJS dist/lib/cloud/index.js 787.00 B
63
+ CJS dist/lib/integrations/index.js 58.28 KB
64
+ CJS dist/graphql/types/base/index.js 2.44 KB
65
+ CJS dist/graphql/types/converted/index.js 3.04 KB
66
+ CJS dist/lib/integrations/nest/index.js 55.65 KB
67
+ CJS dist/lib/integrations/node-express/index.js 55.74 KB
68
+ CJS dist/lib/integrations/node-http/index.js 55.27 KB
69
+ CJS dist/index.js.map 150.25 KB
70
+ CJS dist/lib/index.js.map 150.60 KB
71
+ CJS dist/service-adapters/index.js.map 62.05 KB
72
+ CJS dist/utils/index.js.map 5.63 KB
73
+ CJS dist/lib/cloud/index.js.map 217.00 B
74
+ CJS dist/lib/integrations/index.js.map 73.68 KB
75
+ CJS dist/graphql/types/base/index.js.map 645.00 B
76
+ CJS dist/graphql/types/converted/index.js.map 1.76 KB
77
+ CJS dist/lib/integrations/nest/index.js.map 69.13 KB
78
+ CJS dist/lib/integrations/node-express/index.js.map 69.16 KB
79
+ CJS dist/lib/integrations/node-http/index.js.map 68.31 KB
80
+ CJS ⚡️ Build success in 228ms
69
81
  DTS Build start
70
- DTS ⚡️ Build success in 7048ms
71
- DTS dist/index.d.ts 1.28 KB
82
+ DTS ⚡️ Build success in 8126ms
83
+ DTS dist/index.d.ts 1.50 KB
84
+ DTS dist/lib/integrations/node-http/index.d.ts 586.00 B
85
+ DTS dist/lib/integrations/node-express/index.d.ts 592.00 B
86
+ DTS dist/lib/integrations/nest/index.d.ts 578.00 B
72
87
  DTS dist/lib/cloud/index.d.ts 116.00 B
73
88
  DTS dist/graphql/types/base/index.d.ts 92.00 B
74
- DTS dist/lib/index.d.ts 1.11 KB
89
+ DTS dist/lib/index.d.ts 1.32 KB
75
90
  DTS dist/service-adapters/index.d.ts 543.00 B
76
91
  DTS dist/utils/index.d.ts 172.00 B
77
- DTS dist/lib/integrations/index.d.ts 688.00 B
78
- DTS dist/lib/integrations/node-http/index.d.ts 338.00 B
92
+ DTS dist/lib/integrations/index.d.ts 862.00 B
79
93
  DTS dist/graphql/types/converted/index.d.ts 153.00 B
80
- DTS dist/index-0e75acd2.d.ts 7.66 KB
94
+ DTS dist/shared-48c0f7b8.d.ts 7.43 KB
81
95
  DTS dist/langchain-adapter-a02d1d38.d.ts 5.74 KB
82
- DTS dist/pages-router-e81920d5.d.ts 891.00 B
96
+ DTS dist/pages-router-24897543.d.ts 892.00 B
83
97
  DTS dist/failed-response-status-reasons-0ab19e06.d.ts 1.41 KB
84
98
  DTS dist/langserve-75ebbc38.d.ts 3.59 KB
85
99
  DTS dist/index-aa091e3c.d.ts 1.33 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @copilotkit/runtime
2
2
 
3
+ ## 1.0.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Introduce anonymous telemetry
8
+ - Updated dependencies
9
+ - @copilotkit/shared@1.0.0-beta.1
10
+
3
11
  ## 1.0.0-beta.0
4
12
 
5
13
  ### Major Changes
@@ -44,6 +44,15 @@ input CloudInput {
44
44
  guardrails: GuardrailsInput
45
45
  }
46
46
 
47
+ """The type of Copilot request"""
48
+ enum CopilotRequestType {
49
+ Chat
50
+ Suggestion
51
+ Task
52
+ TextareaCompletion
53
+ TextareaPopover
54
+ }
55
+
47
56
  type CopilotResponse {
48
57
  messages: [BaseMessageOutput!]!
49
58
  runId: String
@@ -82,12 +91,17 @@ input GenerateCopilotResponseInput {
82
91
  cloud: CloudInput
83
92
  frontend: FrontendInput!
84
93
  messages: [MessageInput!]!
94
+ metadata: GenerateCopilotResponseMetadataInput!
85
95
  runId: String
86
96
  threadId: String
87
97
  }
88
98
 
99
+ input GenerateCopilotResponseMetadataInput {
100
+ requestType: CopilotRequestType
101
+ }
102
+
89
103
  input GuardrailsInput {
90
- inputValidationRules: GuardrailsRuleInput = {allowList: [], denyList: []}
104
+ inputValidationRules: GuardrailsRuleInput!
91
105
  }
92
106
 
93
107
  input GuardrailsRuleInput {
@@ -0,0 +1,12 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ var __commonJS = (cb, mod) => function __require() {
5
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
+ };
7
+
8
+ export {
9
+ __name,
10
+ __commonJS
11
+ };
12
+ //# sourceMappingURL=chunk-44O2JGUY.mjs.map
@@ -0,0 +1,24 @@
1
+ import {
2
+ copilotRuntimeNodeHttpEndpoint,
3
+ telemetry_client_default
4
+ } from "./chunk-DL2QQEOR.mjs";
5
+ import {
6
+ __name
7
+ } from "./chunk-44O2JGUY.mjs";
8
+
9
+ // src/lib/integrations/node-express/index.ts
10
+ function copilotRuntimeNodeExpressEndpoint(options) {
11
+ telemetry_client_default.setGlobalProperties({
12
+ runtime: {
13
+ framework: "node-express"
14
+ }
15
+ });
16
+ telemetry_client_default.capture("oss.runtime.instance_created", {});
17
+ return copilotRuntimeNodeHttpEndpoint(options);
18
+ }
19
+ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
20
+
21
+ export {
22
+ copilotRuntimeNodeExpressEndpoint
23
+ };
24
+ //# sourceMappingURL=chunk-5U6S5EGT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/integrations/node-express/index.ts"],"sourcesContent":["import { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { copilotRuntimeNodeHttpEndpoint } from \"../node-http\";\nimport telemetry from \"../../telemetry-client\";\n\nexport function copilotRuntimeNodeExpressEndpoint(options: CreateCopilotRuntimeServerOptions) {\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"node-express\",\n },\n });\n\n telemetry.capture(\"oss.runtime.instance_created\", {});\n return copilotRuntimeNodeHttpEndpoint(options);\n}\n"],"mappings":";;;;;;;;;AAIO,SAASA,kCAAkCC,SAA0C;AAC1FC,2BAAUC,oBAAoB;IAC5BC,SAAS;MACPC,WAAW;IACb;EACF,CAAA;AAEAH,2BAAUI,QAAQ,gCAAgC,CAAC,CAAA;AACnD,SAAOC,+BAA+BN,OAAAA;AACxC;AATgBD;","names":["copilotRuntimeNodeExpressEndpoint","options","telemetry","setGlobalProperties","runtime","framework","capture","copilotRuntimeNodeHttpEndpoint"]}
@@ -2,15 +2,15 @@ import {
2
2
  convertActionInputToLangChainTool,
3
3
  convertMessageToLangChainMessage,
4
4
  streamLangChainResponse
5
- } from "./chunk-FRK6BXXV.mjs";
5
+ } from "./chunk-DVDKD6F5.mjs";
6
6
  import {
7
7
  ActionExecutionMessage,
8
8
  ResultMessage,
9
9
  TextMessage
10
- } from "./chunk-OZMCHYYR.mjs";
10
+ } from "./chunk-GEIBJJQ4.mjs";
11
11
  import {
12
12
  __name
13
- } from "./chunk-RHQLCJGG.mjs";
13
+ } from "./chunk-44O2JGUY.mjs";
14
14
 
15
15
  // src/service-adapters/openai/openai-adapter.ts
16
16
  import OpenAI from "openai";
@@ -694,4 +694,4 @@ export {
694
694
  LangChainAdapter,
695
695
  RemoteChain
696
696
  };
697
- //# sourceMappingURL=chunk-JBDOA7MK.mjs.map
697
+ //# sourceMappingURL=chunk-7QCEK4DP.mjs.map
@@ -1,24 +1,96 @@
1
1
  import {
2
2
  streamLangChainResponse
3
- } from "./chunk-FRK6BXXV.mjs";
3
+ } from "./chunk-DVDKD6F5.mjs";
4
4
  import {
5
5
  GuardrailsValidationFailureResponse,
6
6
  MessageStreamInterruptedResponse,
7
7
  ResponseStatusUnion,
8
8
  SuccessResponseStatus,
9
9
  UnknownErrorResponse
10
- } from "./chunk-BYB2LNMK.mjs";
10
+ } from "./chunk-U3V2BCGI.mjs";
11
11
  import {
12
12
  ActionExecutionMessage,
13
13
  ResultMessage,
14
14
  TextMessage
15
- } from "./chunk-OZMCHYYR.mjs";
15
+ } from "./chunk-GEIBJJQ4.mjs";
16
16
  import {
17
17
  BaseMessage
18
- } from "./chunk-6NZ4UMOD.mjs";
18
+ } from "./chunk-RMZWGQ46.mjs";
19
19
  import {
20
+ __commonJS,
20
21
  __name
21
- } from "./chunk-RHQLCJGG.mjs";
22
+ } from "./chunk-44O2JGUY.mjs";
23
+
24
+ // package.json
25
+ var require_package = __commonJS({
26
+ "package.json"(exports, module) {
27
+ module.exports = {
28
+ name: "@copilotkit/runtime",
29
+ private: false,
30
+ publishConfig: {
31
+ access: "public"
32
+ },
33
+ version: "1.0.0-beta.1",
34
+ sideEffects: false,
35
+ main: "./dist/index.js",
36
+ module: "./dist/index.mjs",
37
+ exports: {
38
+ ".": "./dist/index.js"
39
+ },
40
+ types: "./dist/index.d.ts",
41
+ license: "MIT",
42
+ scripts: {
43
+ build: "tsup --clean",
44
+ dev: 'tsup --watch --onSuccess "pnpm run generate-graphql-schema"',
45
+ test: "jest --passWithNoTests",
46
+ "check-types": "tsc --noEmit",
47
+ clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next",
48
+ "generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts"
49
+ },
50
+ devDependencies: {
51
+ "@swc/core": "1.5.28",
52
+ "@types/express": "^4.17.21",
53
+ "@types/jest": "^29.5.4",
54
+ "@types/node": "^18.11.17",
55
+ "@whatwg-node/server": "^0.9.34",
56
+ eslint: "^8.56.0",
57
+ "eslint-config-custom": "workspace:*",
58
+ jest: "^29.6.4",
59
+ nodemon: "^3.1.3",
60
+ "ts-jest": "^29.1.1",
61
+ "ts-node": "^10.9.2",
62
+ tsconfig: "workspace:*",
63
+ tsup: "^6.7.0",
64
+ typescript: "^5.2.3"
65
+ },
66
+ dependencies: {
67
+ "@copilotkit/shared": "workspace:*",
68
+ "@google/generative-ai": "^0.11.2",
69
+ "@graphql-yoga/plugin-defer-stream": "^3.3.1",
70
+ "@langchain/community": "^0.0.53",
71
+ "@langchain/core": "^0.1.61",
72
+ "@langchain/openai": "^0.0.28",
73
+ "class-transformer": "^0.5.1",
74
+ express: "^4.19.2",
75
+ graphql: "^16.8.1",
76
+ "graphql-scalars": "^1.23.0",
77
+ "graphql-yoga": "^5.3.1",
78
+ "groq-sdk": "^0.5.0",
79
+ "js-tiktoken": "^1.0.8",
80
+ langchain: "^0.1.36",
81
+ nanoid: "3.3.4",
82
+ openai: "^4.50.0",
83
+ pino: "^9.2.0",
84
+ "pino-pretty": "^11.2.1",
85
+ "reflect-metadata": "^0.2.2",
86
+ rxjs: "^7.8.1",
87
+ tiktoken: "^1.0.15",
88
+ "type-graphql": "2.0.0-rc.1",
89
+ zod: "^3.23.3"
90
+ }
91
+ };
92
+ }
93
+ });
22
94
 
23
95
  // src/lib/integrations/node-http/index.ts
24
96
  import { createYoga } from "graphql-yoga";
@@ -49,6 +121,14 @@ var ActionExecutionScope;
49
121
  ActionExecutionScope2["server"] = "server";
50
122
  ActionExecutionScope2["client"] = "client";
51
123
  })(ActionExecutionScope || (ActionExecutionScope = {}));
124
+ var CopilotRequestType;
125
+ (function(CopilotRequestType2) {
126
+ CopilotRequestType2["Chat"] = "Chat";
127
+ CopilotRequestType2["Task"] = "Task";
128
+ CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
129
+ CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
130
+ CopilotRequestType2["Suggestion"] = "Suggestion";
131
+ })(CopilotRequestType || (CopilotRequestType = {}));
52
132
  registerEnumType(MessageRole, {
53
133
  name: "MessageRole",
54
134
  description: "The role of the message"
@@ -57,6 +137,10 @@ registerEnumType(ActionExecutionScope, {
57
137
  name: "ActionExecutionScope",
58
138
  description: "The scope of the action"
59
139
  });
140
+ registerEnumType(CopilotRequestType, {
141
+ name: "CopilotRequestType",
142
+ description: "The type of Copilot request"
143
+ });
60
144
 
61
145
  // src/graphql/inputs/message.input.ts
62
146
  function _ts_decorate(decorators, target, key, desc) {
@@ -288,15 +372,12 @@ GuardrailsRuleInput = _ts_decorate4([
288
372
  InputType4()
289
373
  ], GuardrailsRuleInput);
290
374
  var GuardrailsInput = class {
291
- inputValidationRules = {
292
- allowList: [],
293
- denyList: []
294
- };
375
+ inputValidationRules;
295
376
  };
296
377
  __name(GuardrailsInput, "GuardrailsInput");
297
378
  _ts_decorate4([
298
379
  Field4(() => GuardrailsRuleInput, {
299
- nullable: true
380
+ nullable: false
300
381
  }),
301
382
  _ts_metadata4("design:type", typeof GuardrailsRuleInput === "undefined" ? Object : GuardrailsRuleInput)
302
383
  ], GuardrailsInput.prototype, "inputValidationRules", void 0);
@@ -352,7 +433,21 @@ function _ts_metadata6(k, v) {
352
433
  return Reflect.metadata(k, v);
353
434
  }
354
435
  __name(_ts_metadata6, "_ts_metadata");
436
+ var GenerateCopilotResponseMetadataInput = class {
437
+ requestType;
438
+ };
439
+ __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
440
+ _ts_decorate6([
441
+ Field6(() => CopilotRequestType, {
442
+ nullable: true
443
+ }),
444
+ _ts_metadata6("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
445
+ ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
446
+ GenerateCopilotResponseMetadataInput = _ts_decorate6([
447
+ InputType6()
448
+ ], GenerateCopilotResponseMetadataInput);
355
449
  var GenerateCopilotResponseInput = class {
450
+ metadata;
356
451
  threadId;
357
452
  runId;
358
453
  messages;
@@ -360,6 +455,12 @@ var GenerateCopilotResponseInput = class {
360
455
  cloud;
361
456
  };
362
457
  __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
458
+ _ts_decorate6([
459
+ Field6(() => GenerateCopilotResponseMetadataInput, {
460
+ nullable: false
461
+ }),
462
+ _ts_metadata6("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
463
+ ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
363
464
  _ts_decorate6([
364
465
  Field6(() => String, {
365
466
  nullable: true
@@ -771,6 +872,17 @@ __name(executeAction, "executeAction");
771
872
  import { GraphQLJSONObject } from "graphql-scalars";
772
873
  import { plainToInstance } from "class-transformer";
773
874
  import { GraphQLError } from "graphql";
875
+
876
+ // src/lib/telemetry-client.ts
877
+ import { TelemetryClient } from "@copilotkit/shared";
878
+ var packageJson = require_package();
879
+ var telemetryClient = new TelemetryClient({
880
+ packageName: packageJson.name,
881
+ packageVersion: packageJson.version
882
+ });
883
+ var telemetry_client_default = telemetryClient;
884
+
885
+ // src/graphql/resolvers/copilot.resolver.ts
774
886
  function _ts_decorate9(decorators, target, key, desc) {
775
887
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
776
888
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -795,6 +907,7 @@ function _ts_param(paramIndex, decorator) {
795
907
  __name(_ts_param, "_ts_param");
796
908
  var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
797
909
  var _a;
910
+ console.log("invokeGuardrails.baseUrl", baseUrl);
798
911
  if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
799
912
  const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
800
913
  role: m.textMessage.role,
@@ -829,6 +942,11 @@ var CopilotResolver = class {
829
942
  return "Hello World";
830
943
  }
831
944
  async generateCopilotResponse(ctx, data, properties) {
945
+ var _a, _b, _c;
946
+ telemetry_client_default.capture("oss.runtime.copilot_request_created", {
947
+ "cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
948
+ requestType: data.metadata.requestType
949
+ });
832
950
  let logger2 = ctx.logger.child({
833
951
  component: "CopilotResolver.generateCopilotResponse"
834
952
  });
@@ -861,8 +979,8 @@ var CopilotResolver = class {
861
979
  }
862
980
  if (process.env.COPILOT_CLOUD_BASE_URL) {
863
981
  copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
864
- } else if (ctx._copilotkit.baseUrl) {
865
- copilotCloudBaseUrl = ctx._copilotkit.baseUrl;
982
+ } else if ((_b = ctx._copilotkit.cloud) == null ? void 0 : _b.baseUrl) {
983
+ copilotCloudBaseUrl = (_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl;
866
984
  } else {
867
985
  copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
868
986
  }
@@ -898,9 +1016,9 @@ var CopilotResolver = class {
898
1016
  runId,
899
1017
  status: firstValueFrom2(responseStatus$),
900
1018
  messages: new Repeater(async (pushMessage, stopStreamingMessages) => {
901
- var _a, _b;
1019
+ var _a2, _b2;
902
1020
  logger2.debug("Messages repeater created");
903
- if ((_a = data.cloud) == null ? void 0 : _a.guardrails) {
1021
+ if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
904
1022
  logger2 = logger2.child({
905
1023
  guardrails: true
906
1024
  });
@@ -949,7 +1067,7 @@ var CopilotResolver = class {
949
1067
  let eventStreamSubscription;
950
1068
  const eventStream = eventSource.process({
951
1069
  serversideActions: actions,
952
- guardrailsResult$: ((_b = data.cloud) == null ? void 0 : _b.guardrails) ? guardrailsResult$ : null
1070
+ guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null
953
1071
  }).pipe(
954
1072
  // shareReplay() ensures that later subscribers will see the whole stream instead of
955
1073
  // just the events that were emitted after the subscriber was added.
@@ -1111,9 +1229,9 @@ var CopilotResolver = class {
1111
1229
  rejectOutputMessagesPromise(err);
1112
1230
  },
1113
1231
  complete: async () => {
1114
- var _a2;
1232
+ var _a3;
1115
1233
  logger2.debug("Event stream completed");
1116
- if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
1234
+ if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
1117
1235
  logger2.debug("Guardrails is enabled, waiting for guardrails result");
1118
1236
  await firstValueFrom2(guardrailsResult$);
1119
1237
  }
@@ -1222,10 +1340,20 @@ function getCommonConfig(options) {
1222
1340
  level: logLevel,
1223
1341
  component: "getCommonConfig"
1224
1342
  });
1225
- logger2.debug("Getting common config");
1226
1343
  const contextLogger = createLogger({
1227
1344
  level: logLevel
1228
1345
  });
1346
+ if (options.cloud) {
1347
+ telemetry_client_default.setCloudConfiguration({
1348
+ publicApiKey: options.cloud.publicApiKey,
1349
+ baseUrl: options.cloud.baseUrl
1350
+ });
1351
+ }
1352
+ telemetry_client_default.setGlobalProperties({
1353
+ runtime: {
1354
+ serviceAdapter: options.serviceAdapter.constructor.name
1355
+ }
1356
+ });
1229
1357
  return {
1230
1358
  logging: createLogger({
1231
1359
  component: "Yoga GraphQL",
@@ -1243,6 +1371,12 @@ __name(getCommonConfig, "getCommonConfig");
1243
1371
  // src/lib/integrations/node-http/index.ts
1244
1372
  function copilotRuntimeNodeHttpEndpoint(options) {
1245
1373
  const commonConfig = getCommonConfig(options);
1374
+ telemetry_client_default.setGlobalProperties({
1375
+ runtime: {
1376
+ framework: "node-http"
1377
+ }
1378
+ });
1379
+ telemetry_client_default.capture("oss.runtime.instance_created", {});
1246
1380
  const logger2 = commonConfig.logging;
1247
1381
  logger2.debug("Creating Node HTTP endpoint");
1248
1382
  const yoga = createYoga({
@@ -1255,9 +1389,10 @@ __name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
1255
1389
 
1256
1390
  export {
1257
1391
  RuntimeEventSource,
1392
+ telemetry_client_default,
1258
1393
  createContext,
1259
1394
  buildSchema,
1260
1395
  getCommonConfig,
1261
1396
  copilotRuntimeNodeHttpEndpoint
1262
1397
  };
1263
- //# sourceMappingURL=chunk-6YGDE3YI.mjs.map
1398
+ //# sourceMappingURL=chunk-DL2QQEOR.mjs.map