@copilotkit/runtime 1.50.0 → 1.50.1-next.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 (224) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.d.ts +5 -1
  3. package/dist/index.js +10 -4
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +10 -4
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/service-adapters/google/google-genai-adapter.ts +19 -4
  9. package/dist/chunk-27JKTS6P.mjs +0 -1704
  10. package/dist/chunk-27JKTS6P.mjs.map +0 -1
  11. package/dist/chunk-2GPTVDTO.mjs +0 -25
  12. package/dist/chunk-2GPTVDTO.mjs.map +0 -1
  13. package/dist/chunk-2OZAGFV3.mjs +0 -43
  14. package/dist/chunk-2OZAGFV3.mjs.map +0 -1
  15. package/dist/chunk-3AJVKDZX.mjs +0 -3097
  16. package/dist/chunk-3AJVKDZX.mjs.map +0 -1
  17. package/dist/chunk-45RCC3ZS.mjs +0 -25
  18. package/dist/chunk-45RCC3ZS.mjs.map +0 -1
  19. package/dist/chunk-4EHJ4XFJ.mjs +0 -25
  20. package/dist/chunk-4EHJ4XFJ.mjs.map +0 -1
  21. package/dist/chunk-4IANB4TC.mjs +0 -25
  22. package/dist/chunk-4IANB4TC.mjs.map +0 -1
  23. package/dist/chunk-4KES76K3.mjs +0 -74
  24. package/dist/chunk-4KES76K3.mjs.map +0 -1
  25. package/dist/chunk-4OGE3SLW.mjs +0 -3100
  26. package/dist/chunk-4OGE3SLW.mjs.map +0 -1
  27. package/dist/chunk-54YJBMCP.mjs +0 -3097
  28. package/dist/chunk-54YJBMCP.mjs.map +0 -1
  29. package/dist/chunk-62NE5S6M.mjs +0 -226
  30. package/dist/chunk-62NE5S6M.mjs.map +0 -1
  31. package/dist/chunk-6ER4SZYH.mjs +0 -74
  32. package/dist/chunk-6ER4SZYH.mjs.map +0 -1
  33. package/dist/chunk-6TNSLHVR.mjs +0 -74
  34. package/dist/chunk-6TNSLHVR.mjs.map +0 -1
  35. package/dist/chunk-6XRUR5UK.mjs +0 -1
  36. package/dist/chunk-6XRUR5UK.mjs.map +0 -1
  37. package/dist/chunk-7V4BK7TZ.mjs +0 -25
  38. package/dist/chunk-7V4BK7TZ.mjs.map +0 -1
  39. package/dist/chunk-7YZIEXD2.mjs +0 -74
  40. package/dist/chunk-7YZIEXD2.mjs.map +0 -1
  41. package/dist/chunk-A4XHOAFU.mjs +0 -25
  42. package/dist/chunk-A4XHOAFU.mjs.map +0 -1
  43. package/dist/chunk-A555KEAD.mjs +0 -6020
  44. package/dist/chunk-A555KEAD.mjs.map +0 -1
  45. package/dist/chunk-AF73TFTX.mjs +0 -74
  46. package/dist/chunk-AF73TFTX.mjs.map +0 -1
  47. package/dist/chunk-AMUJQ6IR.mjs +0 -50
  48. package/dist/chunk-AMUJQ6IR.mjs.map +0 -1
  49. package/dist/chunk-AQG2SVCA.mjs +0 -25
  50. package/dist/chunk-AQG2SVCA.mjs.map +0 -1
  51. package/dist/chunk-BJZHMXND.mjs +0 -74
  52. package/dist/chunk-BJZHMXND.mjs.map +0 -1
  53. package/dist/chunk-CB2OJXF6.mjs +0 -25
  54. package/dist/chunk-CB2OJXF6.mjs.map +0 -1
  55. package/dist/chunk-CEOMFPJU.mjs +0 -6020
  56. package/dist/chunk-CEOMFPJU.mjs.map +0 -1
  57. package/dist/chunk-CZVLR7CC.mjs +0 -175
  58. package/dist/chunk-CZVLR7CC.mjs.map +0 -1
  59. package/dist/chunk-DCEEHMLJ.mjs +0 -1127
  60. package/dist/chunk-DCEEHMLJ.mjs.map +0 -1
  61. package/dist/chunk-DE3CLKUG.mjs +0 -25
  62. package/dist/chunk-DE3CLKUG.mjs.map +0 -1
  63. package/dist/chunk-DTPRUTNV.mjs +0 -25
  64. package/dist/chunk-DTPRUTNV.mjs.map +0 -1
  65. package/dist/chunk-ERUOA47O.mjs +0 -626
  66. package/dist/chunk-ERUOA47O.mjs.map +0 -1
  67. package/dist/chunk-ESSRC64W.mjs +0 -74
  68. package/dist/chunk-ESSRC64W.mjs.map +0 -1
  69. package/dist/chunk-FHD4JECV.mjs +0 -33
  70. package/dist/chunk-FHD4JECV.mjs.map +0 -1
  71. package/dist/chunk-GRAN6K6N.mjs +0 -25
  72. package/dist/chunk-GRAN6K6N.mjs.map +0 -1
  73. package/dist/chunk-I27F2UPA.mjs +0 -175
  74. package/dist/chunk-I27F2UPA.mjs.map +0 -1
  75. package/dist/chunk-IAZKTOQW.mjs +0 -25
  76. package/dist/chunk-IAZKTOQW.mjs.map +0 -1
  77. package/dist/chunk-J6XZ5MFB.mjs +0 -25
  78. package/dist/chunk-J6XZ5MFB.mjs.map +0 -1
  79. package/dist/chunk-JJ32MA4C.mjs +0 -73
  80. package/dist/chunk-JJ32MA4C.mjs.map +0 -1
  81. package/dist/chunk-JJY4ZTHQ.mjs +0 -25
  82. package/dist/chunk-JJY4ZTHQ.mjs.map +0 -1
  83. package/dist/chunk-KEYLBFU2.mjs +0 -3117
  84. package/dist/chunk-KEYLBFU2.mjs.map +0 -1
  85. package/dist/chunk-KQ53L4WZ.mjs +0 -3094
  86. package/dist/chunk-KQ53L4WZ.mjs.map +0 -1
  87. package/dist/chunk-KTELVQ67.mjs +0 -3098
  88. package/dist/chunk-KTELVQ67.mjs.map +0 -1
  89. package/dist/chunk-LPEPX6NH.mjs +0 -25
  90. package/dist/chunk-LPEPX6NH.mjs.map +0 -1
  91. package/dist/chunk-MDXE55DK.mjs +0 -3117
  92. package/dist/chunk-MDXE55DK.mjs.map +0 -1
  93. package/dist/chunk-MMFUVOXH.mjs +0 -73
  94. package/dist/chunk-MMFUVOXH.mjs.map +0 -1
  95. package/dist/chunk-N3Y4U66N.mjs +0 -253
  96. package/dist/chunk-N3Y4U66N.mjs.map +0 -1
  97. package/dist/chunk-O7UYB4MH.mjs +0 -25
  98. package/dist/chunk-O7UYB4MH.mjs.map +0 -1
  99. package/dist/chunk-OFNVQHNM.mjs +0 -3089
  100. package/dist/chunk-OFNVQHNM.mjs.map +0 -1
  101. package/dist/chunk-OFSV5GET.mjs +0 -3074
  102. package/dist/chunk-OFSV5GET.mjs.map +0 -1
  103. package/dist/chunk-OMRST67R.mjs +0 -25
  104. package/dist/chunk-OMRST67R.mjs.map +0 -1
  105. package/dist/chunk-OWIGJONH.mjs +0 -275
  106. package/dist/chunk-OWIGJONH.mjs.map +0 -1
  107. package/dist/chunk-PRZHE74A.mjs +0 -25
  108. package/dist/chunk-PRZHE74A.mjs.map +0 -1
  109. package/dist/chunk-PTYRVXXP.mjs +0 -80
  110. package/dist/chunk-PTYRVXXP.mjs.map +0 -1
  111. package/dist/chunk-R22B5CCO.mjs +0 -25
  112. package/dist/chunk-R22B5CCO.mjs.map +0 -1
  113. package/dist/chunk-SHBDMA63.mjs +0 -141
  114. package/dist/chunk-SHBDMA63.mjs.map +0 -1
  115. package/dist/chunk-SPVXBPRA.mjs +0 -74
  116. package/dist/chunk-SPVXBPRA.mjs.map +0 -1
  117. package/dist/chunk-T72G46ME.mjs +0 -25
  118. package/dist/chunk-T72G46ME.mjs.map +0 -1
  119. package/dist/chunk-TGELROPU.mjs +0 -25
  120. package/dist/chunk-TGELROPU.mjs.map +0 -1
  121. package/dist/chunk-UNX4IAAD.mjs +0 -25
  122. package/dist/chunk-UNX4IAAD.mjs.map +0 -1
  123. package/dist/chunk-V4DHVC7M.mjs +0 -3085
  124. package/dist/chunk-V4DHVC7M.mjs.map +0 -1
  125. package/dist/chunk-VVRFOB66.mjs +0 -25
  126. package/dist/chunk-VVRFOB66.mjs.map +0 -1
  127. package/dist/chunk-W6NVBYM6.mjs +0 -80
  128. package/dist/chunk-W6NVBYM6.mjs.map +0 -1
  129. package/dist/chunk-W7MBACGC.mjs +0 -74
  130. package/dist/chunk-W7MBACGC.mjs.map +0 -1
  131. package/dist/chunk-WMD4XZZS.mjs +0 -25
  132. package/dist/chunk-WMD4XZZS.mjs.map +0 -1
  133. package/dist/chunk-WX2ZNCRT.mjs +0 -74
  134. package/dist/chunk-WX2ZNCRT.mjs.map +0 -1
  135. package/dist/chunk-XWBDEXDA.mjs +0 -153
  136. package/dist/chunk-XWBDEXDA.mjs.map +0 -1
  137. package/dist/chunk-Y2Z62E2T.mjs +0 -74
  138. package/dist/chunk-Y2Z62E2T.mjs.map +0 -1
  139. package/dist/chunk-YO4I6RVI.mjs +0 -25
  140. package/dist/chunk-YO4I6RVI.mjs.map +0 -1
  141. package/dist/chunk-Z6Q5IW6I.mjs +0 -3098
  142. package/dist/chunk-Z6Q5IW6I.mjs.map +0 -1
  143. package/dist/chunk-Z726O3G2.mjs +0 -25
  144. package/dist/chunk-Z726O3G2.mjs.map +0 -1
  145. package/dist/chunk-ZE4SMZZR.mjs +0 -3097
  146. package/dist/chunk-ZE4SMZZR.mjs.map +0 -1
  147. package/dist/chunk-ZULZB33C.mjs +0 -73
  148. package/dist/chunk-ZULZB33C.mjs.map +0 -1
  149. package/dist/chunk-ZVRGXMY7.mjs +0 -25
  150. package/dist/chunk-ZVRGXMY7.mjs.map +0 -1
  151. package/dist/chunk-ZZ35WBYQ.mjs +0 -25
  152. package/dist/chunk-ZZ35WBYQ.mjs.map +0 -1
  153. package/dist/graphql/message-conversion/index.d.ts +0 -18
  154. package/dist/graphql/message-conversion/index.js +0 -725
  155. package/dist/graphql/message-conversion/index.js.map +0 -1
  156. package/dist/graphql/message-conversion/index.mjs +0 -245
  157. package/dist/graphql/message-conversion/index.mjs.map +0 -1
  158. package/dist/graphql/types/base/index.d.ts +0 -6
  159. package/dist/graphql/types/base/index.js +0 -63
  160. package/dist/graphql/types/base/index.js.map +0 -1
  161. package/dist/graphql/types/base/index.mjs +0 -8
  162. package/dist/graphql/types/base/index.mjs.map +0 -1
  163. package/dist/graphql/types/converted/index.d.ts +0 -2
  164. package/dist/graphql/types/converted/index.js +0 -200
  165. package/dist/graphql/types/converted/index.js.map +0 -1
  166. package/dist/graphql/types/converted/index.mjs +0 -19
  167. package/dist/graphql/types/converted/index.mjs.map +0 -1
  168. package/dist/groq-adapter-540da9c3.d.ts +0 -331
  169. package/dist/groq-adapter-a6f5e9d2.d.ts +0 -331
  170. package/dist/groq-adapter-c8aec5c5.d.ts +0 -321
  171. package/dist/index-96b330da.d.ts +0 -119
  172. package/dist/index-adbd78f1.d.ts +0 -154
  173. package/dist/langserve-0c6100e3.d.ts +0 -257
  174. package/dist/langserve-978d5790.d.ts +0 -243
  175. package/dist/langserve-9fc76ce5.d.ts +0 -243
  176. package/dist/lib/cloud/index.d.ts +0 -6
  177. package/dist/lib/cloud/index.js +0 -18
  178. package/dist/lib/cloud/index.js.map +0 -1
  179. package/dist/lib/cloud/index.mjs +0 -1
  180. package/dist/lib/cloud/index.mjs.map +0 -1
  181. package/dist/lib/index.d.ts +0 -212
  182. package/dist/lib/index.js +0 -7843
  183. package/dist/lib/index.js.map +0 -1
  184. package/dist/lib/index.mjs +0 -76
  185. package/dist/lib/index.mjs.map +0 -1
  186. package/dist/lib/integrations/index.d.ts +0 -34
  187. package/dist/lib/integrations/index.js +0 -3052
  188. package/dist/lib/integrations/index.js.map +0 -1
  189. package/dist/lib/integrations/index.mjs +0 -37
  190. package/dist/lib/integrations/index.mjs.map +0 -1
  191. package/dist/lib/integrations/nest/index.d.ts +0 -15
  192. package/dist/lib/integrations/nest/index.js +0 -2959
  193. package/dist/lib/integrations/nest/index.js.map +0 -1
  194. package/dist/lib/integrations/nest/index.mjs +0 -14
  195. package/dist/lib/integrations/nest/index.mjs.map +0 -1
  196. package/dist/lib/integrations/node-express/index.d.ts +0 -15
  197. package/dist/lib/integrations/node-express/index.js +0 -2959
  198. package/dist/lib/integrations/node-express/index.js.map +0 -1
  199. package/dist/lib/integrations/node-express/index.mjs +0 -14
  200. package/dist/lib/integrations/node-express/index.mjs.map +0 -1
  201. package/dist/lib/integrations/node-http/index.d.ts +0 -15
  202. package/dist/lib/integrations/node-http/index.js +0 -2945
  203. package/dist/lib/integrations/node-http/index.js.map +0 -1
  204. package/dist/lib/integrations/node-http/index.mjs +0 -13
  205. package/dist/lib/integrations/node-http/index.mjs.map +0 -1
  206. package/dist/service-adapters/index.d.ts +0 -162
  207. package/dist/service-adapters/index.js +0 -1787
  208. package/dist/service-adapters/index.js.map +0 -1
  209. package/dist/service-adapters/index.mjs +0 -34
  210. package/dist/service-adapters/index.mjs.map +0 -1
  211. package/dist/service-adapters/shared/index.d.ts +0 -9
  212. package/dist/service-adapters/shared/index.js +0 -72
  213. package/dist/service-adapters/shared/index.js.map +0 -1
  214. package/dist/service-adapters/shared/index.mjs +0 -8
  215. package/dist/service-adapters/shared/index.mjs.map +0 -1
  216. package/dist/shared-0a7346ce.d.ts +0 -466
  217. package/dist/shared-35c6eb04.d.ts +0 -448
  218. package/dist/shared-9ed1dc31.d.ts +0 -414
  219. package/dist/shared-da5708fe.d.ts +0 -449
  220. package/dist/utils/index.d.ts +0 -65
  221. package/dist/utils/index.js +0 -175
  222. package/dist/utils/index.js.map +0 -1
  223. package/dist/utils/index.mjs +0 -12
  224. package/dist/utils/index.mjs.map +0 -1
@@ -1,3052 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from3, except, desc) => {
16
- if (from3 && typeof from3 === "object" || typeof from3 === "function") {
17
- for (let key of __getOwnPropNames(from3))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
-
33
- // package.json
34
- var require_package = __commonJS({
35
- "package.json"(exports, module2) {
36
- module2.exports = {
37
- name: "@copilotkit/runtime",
38
- private: false,
39
- homepage: "https://github.com/CopilotKit/CopilotKit",
40
- repository: {
41
- type: "git",
42
- url: "https://github.com/CopilotKit/CopilotKit.git"
43
- },
44
- publishConfig: {
45
- access: "public"
46
- },
47
- version: "1.10.6",
48
- sideEffects: false,
49
- main: "./dist/index.js",
50
- module: "./dist/index.mjs",
51
- exports: {
52
- ".": "./dist/index.js"
53
- },
54
- types: "./dist/index.d.ts",
55
- license: "MIT",
56
- scripts: {
57
- build: 'tsup --onSuccess "pnpm run generate-graphql-schema"',
58
- dev: 'tsup --watch --onSuccess "pnpm run generate-graphql-schema"',
59
- test: "jest --passWithNoTests",
60
- "check-types": "tsc --noEmit",
61
- clean: "rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next && rm -rf __snapshots__",
62
- "generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts",
63
- "link:global": "pnpm link --global",
64
- "unlink:global": "pnpm unlink --global"
65
- },
66
- devDependencies: {
67
- "@jest/globals": "^29.7.0",
68
- "@swc/core": "1.5.28",
69
- "@types/express": "^4.17.21",
70
- "@types/jest": "^29.5.12",
71
- "@types/node": "^18.11.17",
72
- "@whatwg-node/server": "^0.9.34",
73
- eslint: "^8.56.0",
74
- "eslint-config-custom": "workspace:*",
75
- jest: "^29.6.4",
76
- nodemon: "^3.1.3",
77
- "ts-jest": "^29.1.1",
78
- "ts-node": "^10.9.2",
79
- tsconfig: "workspace:*",
80
- tsup: "^6.7.0",
81
- typescript: "^5.2.3",
82
- "zod-to-json-schema": "^3.23.5"
83
- },
84
- dependencies: {
85
- "@anthropic-ai/sdk": "^0.57.0",
86
- "@copilotkit/shared": "workspace:*",
87
- "@graphql-yoga/plugin-defer-stream": "^3.3.1",
88
- "@langchain/aws": "^0.1.9",
89
- "@langchain/community": "^0.3.29",
90
- "@langchain/core": "^0.3.38",
91
- "@langchain/google-gauth": "^0.1.0",
92
- "@langchain/langgraph-sdk": "^0.0.70",
93
- "@langchain/openai": "^0.4.2",
94
- "@scarf/scarf": "^1.3.0",
95
- "class-transformer": "^0.5.1",
96
- "class-validator": "^0.14.1",
97
- express: "^4.19.2",
98
- graphql: "^16.8.1",
99
- "graphql-scalars": "^1.23.0",
100
- "graphql-yoga": "^5.3.1",
101
- "groq-sdk": "^0.5.0",
102
- langchain: "^0.3.3",
103
- openai: "^4.85.1",
104
- "partial-json": "^0.1.7",
105
- pino: "^9.2.0",
106
- "pino-pretty": "^11.2.1",
107
- "reflect-metadata": "^0.2.2",
108
- rxjs: "7.8.1",
109
- "type-graphql": "2.0.0-rc.1",
110
- zod: "^3.23.3"
111
- },
112
- peerDependencies: {
113
- "@ag-ui/client": ">=0.0.39",
114
- "@ag-ui/core": ">=0.0.39",
115
- "@ag-ui/encoder": ">=0.0.39",
116
- "@ag-ui/langgraph": ">=0.0.18",
117
- "@ag-ui/proto": ">=0.0.39"
118
- },
119
- keywords: [
120
- "copilotkit",
121
- "copilot",
122
- "react",
123
- "nextjs",
124
- "nodejs",
125
- "ai",
126
- "assistant",
127
- "javascript",
128
- "automation",
129
- "textarea"
130
- ]
131
- };
132
- }
133
- });
134
-
135
- // src/lib/integrations/index.ts
136
- var integrations_exports = {};
137
- __export(integrations_exports, {
138
- addCustomHeaderPlugin: () => addCustomHeaderPlugin,
139
- buildSchema: () => buildSchema,
140
- config: () => config,
141
- copilotRuntimeNestEndpoint: () => copilotRuntimeNestEndpoint,
142
- copilotRuntimeNextJSAppRouterEndpoint: () => copilotRuntimeNextJSAppRouterEndpoint,
143
- copilotRuntimeNextJSPagesRouterEndpoint: () => copilotRuntimeNextJSPagesRouterEndpoint,
144
- copilotRuntimeNodeExpressEndpoint: () => copilotRuntimeNodeExpressEndpoint,
145
- copilotRuntimeNodeHttpEndpoint: () => copilotRuntimeNodeHttpEndpoint,
146
- createContext: () => createContext,
147
- getCommonConfig: () => getCommonConfig
148
- });
149
- module.exports = __toCommonJS(integrations_exports);
150
-
151
- // src/lib/integrations/shared.ts
152
- var import_type_graphql27 = require("type-graphql");
153
-
154
- // src/graphql/resolvers/copilot.resolver.ts
155
- var import_type_graphql21 = require("type-graphql");
156
- var import_rxjs3 = require("rxjs");
157
-
158
- // src/graphql/inputs/generate-copilot-response.input.ts
159
- var import_type_graphql19 = require("type-graphql");
160
-
161
- // src/graphql/inputs/message.input.ts
162
- var import_type_graphql3 = require("type-graphql");
163
-
164
- // src/graphql/types/enums.ts
165
- var import_type_graphql = require("type-graphql");
166
- var MessageRole;
167
- (function(MessageRole2) {
168
- MessageRole2["user"] = "user";
169
- MessageRole2["assistant"] = "assistant";
170
- MessageRole2["system"] = "system";
171
- MessageRole2["tool"] = "tool";
172
- MessageRole2["developer"] = "developer";
173
- })(MessageRole || (MessageRole = {}));
174
- var CopilotRequestType;
175
- (function(CopilotRequestType2) {
176
- CopilotRequestType2["Chat"] = "Chat";
177
- CopilotRequestType2["Task"] = "Task";
178
- CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
179
- CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
180
- CopilotRequestType2["Suggestion"] = "Suggestion";
181
- })(CopilotRequestType || (CopilotRequestType = {}));
182
- var ActionInputAvailability;
183
- (function(ActionInputAvailability2) {
184
- ActionInputAvailability2["disabled"] = "disabled";
185
- ActionInputAvailability2["enabled"] = "enabled";
186
- ActionInputAvailability2["remote"] = "remote";
187
- })(ActionInputAvailability || (ActionInputAvailability = {}));
188
- (0, import_type_graphql.registerEnumType)(MessageRole, {
189
- name: "MessageRole",
190
- description: "The role of the message"
191
- });
192
- (0, import_type_graphql.registerEnumType)(CopilotRequestType, {
193
- name: "CopilotRequestType",
194
- description: "The type of Copilot request"
195
- });
196
- (0, import_type_graphql.registerEnumType)(ActionInputAvailability, {
197
- name: "ActionInputAvailability",
198
- description: "The availability of the frontend action"
199
- });
200
-
201
- // src/graphql/types/base/index.ts
202
- var import_type_graphql2 = require("type-graphql");
203
- function _ts_decorate(decorators, target, key, desc) {
204
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
205
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
206
- r = Reflect.decorate(decorators, target, key, desc);
207
- else
208
- for (var i = decorators.length - 1; i >= 0; i--)
209
- if (d = decorators[i])
210
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
211
- return c > 3 && r && Object.defineProperty(target, key, r), r;
212
- }
213
- __name(_ts_decorate, "_ts_decorate");
214
- function _ts_metadata(k, v) {
215
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
216
- return Reflect.metadata(k, v);
217
- }
218
- __name(_ts_metadata, "_ts_metadata");
219
- var BaseMessageInput = class {
220
- id;
221
- createdAt;
222
- };
223
- __name(BaseMessageInput, "BaseMessageInput");
224
- _ts_decorate([
225
- (0, import_type_graphql2.Field)(() => String),
226
- _ts_metadata("design:type", String)
227
- ], BaseMessageInput.prototype, "id", void 0);
228
- _ts_decorate([
229
- (0, import_type_graphql2.Field)(() => Date),
230
- _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
231
- ], BaseMessageInput.prototype, "createdAt", void 0);
232
- BaseMessageInput = _ts_decorate([
233
- (0, import_type_graphql2.InputType)()
234
- ], BaseMessageInput);
235
-
236
- // src/graphql/inputs/message.input.ts
237
- function _ts_decorate2(decorators, target, key, desc) {
238
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
239
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
240
- r = Reflect.decorate(decorators, target, key, desc);
241
- else
242
- for (var i = decorators.length - 1; i >= 0; i--)
243
- if (d = decorators[i])
244
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
245
- return c > 3 && r && Object.defineProperty(target, key, r), r;
246
- }
247
- __name(_ts_decorate2, "_ts_decorate");
248
- function _ts_metadata2(k, v) {
249
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
250
- return Reflect.metadata(k, v);
251
- }
252
- __name(_ts_metadata2, "_ts_metadata");
253
- var MessageInput = class extends BaseMessageInput {
254
- textMessage;
255
- actionExecutionMessage;
256
- resultMessage;
257
- agentStateMessage;
258
- imageMessage;
259
- };
260
- __name(MessageInput, "MessageInput");
261
- _ts_decorate2([
262
- (0, import_type_graphql3.Field)(() => TextMessageInput, {
263
- nullable: true
264
- }),
265
- _ts_metadata2("design:type", typeof TextMessageInput === "undefined" ? Object : TextMessageInput)
266
- ], MessageInput.prototype, "textMessage", void 0);
267
- _ts_decorate2([
268
- (0, import_type_graphql3.Field)(() => ActionExecutionMessageInput, {
269
- nullable: true
270
- }),
271
- _ts_metadata2("design:type", typeof ActionExecutionMessageInput === "undefined" ? Object : ActionExecutionMessageInput)
272
- ], MessageInput.prototype, "actionExecutionMessage", void 0);
273
- _ts_decorate2([
274
- (0, import_type_graphql3.Field)(() => ResultMessageInput, {
275
- nullable: true
276
- }),
277
- _ts_metadata2("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
278
- ], MessageInput.prototype, "resultMessage", void 0);
279
- _ts_decorate2([
280
- (0, import_type_graphql3.Field)(() => AgentStateMessageInput, {
281
- nullable: true
282
- }),
283
- _ts_metadata2("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
284
- ], MessageInput.prototype, "agentStateMessage", void 0);
285
- _ts_decorate2([
286
- (0, import_type_graphql3.Field)(() => ImageMessageInput, {
287
- nullable: true
288
- }),
289
- _ts_metadata2("design:type", typeof ImageMessageInput === "undefined" ? Object : ImageMessageInput)
290
- ], MessageInput.prototype, "imageMessage", void 0);
291
- MessageInput = _ts_decorate2([
292
- (0, import_type_graphql3.InputType)()
293
- ], MessageInput);
294
- var TextMessageInput = class {
295
- content;
296
- parentMessageId;
297
- role;
298
- };
299
- __name(TextMessageInput, "TextMessageInput");
300
- _ts_decorate2([
301
- (0, import_type_graphql3.Field)(() => String),
302
- _ts_metadata2("design:type", String)
303
- ], TextMessageInput.prototype, "content", void 0);
304
- _ts_decorate2([
305
- (0, import_type_graphql3.Field)(() => String, {
306
- nullable: true
307
- }),
308
- _ts_metadata2("design:type", String)
309
- ], TextMessageInput.prototype, "parentMessageId", void 0);
310
- _ts_decorate2([
311
- (0, import_type_graphql3.Field)(() => MessageRole),
312
- _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
313
- ], TextMessageInput.prototype, "role", void 0);
314
- TextMessageInput = _ts_decorate2([
315
- (0, import_type_graphql3.InputType)()
316
- ], TextMessageInput);
317
- var ActionExecutionMessageInput = class {
318
- name;
319
- arguments;
320
- parentMessageId;
321
- scope;
322
- };
323
- __name(ActionExecutionMessageInput, "ActionExecutionMessageInput");
324
- _ts_decorate2([
325
- (0, import_type_graphql3.Field)(() => String),
326
- _ts_metadata2("design:type", String)
327
- ], ActionExecutionMessageInput.prototype, "name", void 0);
328
- _ts_decorate2([
329
- (0, import_type_graphql3.Field)(() => String),
330
- _ts_metadata2("design:type", String)
331
- ], ActionExecutionMessageInput.prototype, "arguments", void 0);
332
- _ts_decorate2([
333
- (0, import_type_graphql3.Field)(() => String, {
334
- nullable: true
335
- }),
336
- _ts_metadata2("design:type", String)
337
- ], ActionExecutionMessageInput.prototype, "parentMessageId", void 0);
338
- _ts_decorate2([
339
- (0, import_type_graphql3.Field)(() => String, {
340
- nullable: true,
341
- deprecationReason: "This field will be removed in a future version"
342
- }),
343
- _ts_metadata2("design:type", typeof String === "undefined" ? Object : String)
344
- ], ActionExecutionMessageInput.prototype, "scope", void 0);
345
- ActionExecutionMessageInput = _ts_decorate2([
346
- (0, import_type_graphql3.InputType)()
347
- ], ActionExecutionMessageInput);
348
- var ResultMessageInput = class {
349
- actionExecutionId;
350
- actionName;
351
- parentMessageId;
352
- result;
353
- };
354
- __name(ResultMessageInput, "ResultMessageInput");
355
- _ts_decorate2([
356
- (0, import_type_graphql3.Field)(() => String),
357
- _ts_metadata2("design:type", String)
358
- ], ResultMessageInput.prototype, "actionExecutionId", void 0);
359
- _ts_decorate2([
360
- (0, import_type_graphql3.Field)(() => String),
361
- _ts_metadata2("design:type", String)
362
- ], ResultMessageInput.prototype, "actionName", void 0);
363
- _ts_decorate2([
364
- (0, import_type_graphql3.Field)(() => String, {
365
- nullable: true
366
- }),
367
- _ts_metadata2("design:type", String)
368
- ], ResultMessageInput.prototype, "parentMessageId", void 0);
369
- _ts_decorate2([
370
- (0, import_type_graphql3.Field)(() => String),
371
- _ts_metadata2("design:type", String)
372
- ], ResultMessageInput.prototype, "result", void 0);
373
- ResultMessageInput = _ts_decorate2([
374
- (0, import_type_graphql3.InputType)()
375
- ], ResultMessageInput);
376
- var AgentStateMessageInput = class {
377
- threadId;
378
- agentName;
379
- role;
380
- state;
381
- running;
382
- nodeName;
383
- runId;
384
- active;
385
- };
386
- __name(AgentStateMessageInput, "AgentStateMessageInput");
387
- _ts_decorate2([
388
- (0, import_type_graphql3.Field)(() => String),
389
- _ts_metadata2("design:type", String)
390
- ], AgentStateMessageInput.prototype, "threadId", void 0);
391
- _ts_decorate2([
392
- (0, import_type_graphql3.Field)(() => String),
393
- _ts_metadata2("design:type", String)
394
- ], AgentStateMessageInput.prototype, "agentName", void 0);
395
- _ts_decorate2([
396
- (0, import_type_graphql3.Field)(() => MessageRole),
397
- _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
398
- ], AgentStateMessageInput.prototype, "role", void 0);
399
- _ts_decorate2([
400
- (0, import_type_graphql3.Field)(() => String),
401
- _ts_metadata2("design:type", String)
402
- ], AgentStateMessageInput.prototype, "state", void 0);
403
- _ts_decorate2([
404
- (0, import_type_graphql3.Field)(() => Boolean),
405
- _ts_metadata2("design:type", Boolean)
406
- ], AgentStateMessageInput.prototype, "running", void 0);
407
- _ts_decorate2([
408
- (0, import_type_graphql3.Field)(() => String),
409
- _ts_metadata2("design:type", String)
410
- ], AgentStateMessageInput.prototype, "nodeName", void 0);
411
- _ts_decorate2([
412
- (0, import_type_graphql3.Field)(() => String),
413
- _ts_metadata2("design:type", String)
414
- ], AgentStateMessageInput.prototype, "runId", void 0);
415
- _ts_decorate2([
416
- (0, import_type_graphql3.Field)(() => Boolean),
417
- _ts_metadata2("design:type", Boolean)
418
- ], AgentStateMessageInput.prototype, "active", void 0);
419
- AgentStateMessageInput = _ts_decorate2([
420
- (0, import_type_graphql3.InputType)()
421
- ], AgentStateMessageInput);
422
- var ImageMessageInput = class {
423
- format;
424
- bytes;
425
- parentMessageId;
426
- role;
427
- };
428
- __name(ImageMessageInput, "ImageMessageInput");
429
- _ts_decorate2([
430
- (0, import_type_graphql3.Field)(() => String),
431
- _ts_metadata2("design:type", String)
432
- ], ImageMessageInput.prototype, "format", void 0);
433
- _ts_decorate2([
434
- (0, import_type_graphql3.Field)(() => String),
435
- _ts_metadata2("design:type", String)
436
- ], ImageMessageInput.prototype, "bytes", void 0);
437
- _ts_decorate2([
438
- (0, import_type_graphql3.Field)(() => String, {
439
- nullable: true
440
- }),
441
- _ts_metadata2("design:type", String)
442
- ], ImageMessageInput.prototype, "parentMessageId", void 0);
443
- _ts_decorate2([
444
- (0, import_type_graphql3.Field)(() => MessageRole),
445
- _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
446
- ], ImageMessageInput.prototype, "role", void 0);
447
- ImageMessageInput = _ts_decorate2([
448
- (0, import_type_graphql3.InputType)()
449
- ], ImageMessageInput);
450
-
451
- // src/graphql/inputs/frontend.input.ts
452
- var import_type_graphql5 = require("type-graphql");
453
-
454
- // src/graphql/inputs/action.input.ts
455
- var import_type_graphql4 = require("type-graphql");
456
- function _ts_decorate3(decorators, target, key, desc) {
457
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
458
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
459
- r = Reflect.decorate(decorators, target, key, desc);
460
- else
461
- for (var i = decorators.length - 1; i >= 0; i--)
462
- if (d = decorators[i])
463
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
464
- return c > 3 && r && Object.defineProperty(target, key, r), r;
465
- }
466
- __name(_ts_decorate3, "_ts_decorate");
467
- function _ts_metadata3(k, v) {
468
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
469
- return Reflect.metadata(k, v);
470
- }
471
- __name(_ts_metadata3, "_ts_metadata");
472
- var ActionInput = class {
473
- name;
474
- description;
475
- jsonSchema;
476
- available;
477
- };
478
- __name(ActionInput, "ActionInput");
479
- _ts_decorate3([
480
- (0, import_type_graphql4.Field)(() => String),
481
- _ts_metadata3("design:type", String)
482
- ], ActionInput.prototype, "name", void 0);
483
- _ts_decorate3([
484
- (0, import_type_graphql4.Field)(() => String),
485
- _ts_metadata3("design:type", String)
486
- ], ActionInput.prototype, "description", void 0);
487
- _ts_decorate3([
488
- (0, import_type_graphql4.Field)(() => String),
489
- _ts_metadata3("design:type", String)
490
- ], ActionInput.prototype, "jsonSchema", void 0);
491
- _ts_decorate3([
492
- (0, import_type_graphql4.Field)(() => ActionInputAvailability, {
493
- nullable: true
494
- }),
495
- _ts_metadata3("design:type", typeof ActionInputAvailability === "undefined" ? Object : ActionInputAvailability)
496
- ], ActionInput.prototype, "available", void 0);
497
- ActionInput = _ts_decorate3([
498
- (0, import_type_graphql4.InputType)()
499
- ], ActionInput);
500
-
501
- // src/graphql/inputs/frontend.input.ts
502
- function _ts_decorate4(decorators, target, key, desc) {
503
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
504
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
505
- r = Reflect.decorate(decorators, target, key, desc);
506
- else
507
- for (var i = decorators.length - 1; i >= 0; i--)
508
- if (d = decorators[i])
509
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
510
- return c > 3 && r && Object.defineProperty(target, key, r), r;
511
- }
512
- __name(_ts_decorate4, "_ts_decorate");
513
- function _ts_metadata4(k, v) {
514
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
515
- return Reflect.metadata(k, v);
516
- }
517
- __name(_ts_metadata4, "_ts_metadata");
518
- var FrontendInput = class {
519
- toDeprecate_fullContext;
520
- actions;
521
- url;
522
- };
523
- __name(FrontendInput, "FrontendInput");
524
- _ts_decorate4([
525
- (0, import_type_graphql5.Field)(() => String, {
526
- nullable: true
527
- }),
528
- _ts_metadata4("design:type", String)
529
- ], FrontendInput.prototype, "toDeprecate_fullContext", void 0);
530
- _ts_decorate4([
531
- (0, import_type_graphql5.Field)(() => [
532
- ActionInput
533
- ]),
534
- _ts_metadata4("design:type", Array)
535
- ], FrontendInput.prototype, "actions", void 0);
536
- _ts_decorate4([
537
- (0, import_type_graphql5.Field)(() => String, {
538
- nullable: true
539
- }),
540
- _ts_metadata4("design:type", String)
541
- ], FrontendInput.prototype, "url", void 0);
542
- FrontendInput = _ts_decorate4([
543
- (0, import_type_graphql5.InputType)()
544
- ], FrontendInput);
545
-
546
- // src/graphql/inputs/cloud.input.ts
547
- var import_type_graphql7 = require("type-graphql");
548
-
549
- // src/graphql/inputs/cloud-guardrails.input.ts
550
- var import_type_graphql6 = require("type-graphql");
551
- function _ts_decorate5(decorators, target, key, desc) {
552
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
553
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
554
- r = Reflect.decorate(decorators, target, key, desc);
555
- else
556
- for (var i = decorators.length - 1; i >= 0; i--)
557
- if (d = decorators[i])
558
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
559
- return c > 3 && r && Object.defineProperty(target, key, r), r;
560
- }
561
- __name(_ts_decorate5, "_ts_decorate");
562
- function _ts_metadata5(k, v) {
563
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
564
- return Reflect.metadata(k, v);
565
- }
566
- __name(_ts_metadata5, "_ts_metadata");
567
- var GuardrailsRuleInput = class {
568
- allowList = [];
569
- denyList = [];
570
- };
571
- __name(GuardrailsRuleInput, "GuardrailsRuleInput");
572
- _ts_decorate5([
573
- (0, import_type_graphql6.Field)(() => [
574
- String
575
- ], {
576
- nullable: true
577
- }),
578
- _ts_metadata5("design:type", Array)
579
- ], GuardrailsRuleInput.prototype, "allowList", void 0);
580
- _ts_decorate5([
581
- (0, import_type_graphql6.Field)(() => [
582
- String
583
- ], {
584
- nullable: true
585
- }),
586
- _ts_metadata5("design:type", Array)
587
- ], GuardrailsRuleInput.prototype, "denyList", void 0);
588
- GuardrailsRuleInput = _ts_decorate5([
589
- (0, import_type_graphql6.InputType)()
590
- ], GuardrailsRuleInput);
591
- var GuardrailsInput = class {
592
- inputValidationRules;
593
- };
594
- __name(GuardrailsInput, "GuardrailsInput");
595
- _ts_decorate5([
596
- (0, import_type_graphql6.Field)(() => GuardrailsRuleInput, {
597
- nullable: false
598
- }),
599
- _ts_metadata5("design:type", typeof GuardrailsRuleInput === "undefined" ? Object : GuardrailsRuleInput)
600
- ], GuardrailsInput.prototype, "inputValidationRules", void 0);
601
- GuardrailsInput = _ts_decorate5([
602
- (0, import_type_graphql6.InputType)()
603
- ], GuardrailsInput);
604
-
605
- // src/graphql/inputs/cloud.input.ts
606
- function _ts_decorate6(decorators, target, key, desc) {
607
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
608
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
609
- r = Reflect.decorate(decorators, target, key, desc);
610
- else
611
- for (var i = decorators.length - 1; i >= 0; i--)
612
- if (d = decorators[i])
613
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
614
- return c > 3 && r && Object.defineProperty(target, key, r), r;
615
- }
616
- __name(_ts_decorate6, "_ts_decorate");
617
- function _ts_metadata6(k, v) {
618
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
619
- return Reflect.metadata(k, v);
620
- }
621
- __name(_ts_metadata6, "_ts_metadata");
622
- var CloudInput = class {
623
- guardrails;
624
- };
625
- __name(CloudInput, "CloudInput");
626
- _ts_decorate6([
627
- (0, import_type_graphql7.Field)(() => GuardrailsInput, {
628
- nullable: true
629
- }),
630
- _ts_metadata6("design:type", typeof GuardrailsInput === "undefined" ? Object : GuardrailsInput)
631
- ], CloudInput.prototype, "guardrails", void 0);
632
- CloudInput = _ts_decorate6([
633
- (0, import_type_graphql7.InputType)()
634
- ], CloudInput);
635
-
636
- // src/graphql/inputs/forwarded-parameters.input.ts
637
- var import_type_graphql8 = require("type-graphql");
638
- function _ts_decorate7(decorators, target, key, desc) {
639
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
640
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
641
- r = Reflect.decorate(decorators, target, key, desc);
642
- else
643
- for (var i = decorators.length - 1; i >= 0; i--)
644
- if (d = decorators[i])
645
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
646
- return c > 3 && r && Object.defineProperty(target, key, r), r;
647
- }
648
- __name(_ts_decorate7, "_ts_decorate");
649
- function _ts_metadata7(k, v) {
650
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
651
- return Reflect.metadata(k, v);
652
- }
653
- __name(_ts_metadata7, "_ts_metadata");
654
- var ForwardedParametersInput = class {
655
- model;
656
- maxTokens;
657
- stop;
658
- toolChoice;
659
- toolChoiceFunctionName;
660
- temperature;
661
- };
662
- __name(ForwardedParametersInput, "ForwardedParametersInput");
663
- _ts_decorate7([
664
- (0, import_type_graphql8.Field)(() => String, {
665
- nullable: true
666
- }),
667
- _ts_metadata7("design:type", String)
668
- ], ForwardedParametersInput.prototype, "model", void 0);
669
- _ts_decorate7([
670
- (0, import_type_graphql8.Field)(() => Number, {
671
- nullable: true
672
- }),
673
- _ts_metadata7("design:type", Number)
674
- ], ForwardedParametersInput.prototype, "maxTokens", void 0);
675
- _ts_decorate7([
676
- (0, import_type_graphql8.Field)(() => [
677
- String
678
- ], {
679
- nullable: true
680
- }),
681
- _ts_metadata7("design:type", Array)
682
- ], ForwardedParametersInput.prototype, "stop", void 0);
683
- _ts_decorate7([
684
- (0, import_type_graphql8.Field)(() => String, {
685
- nullable: true
686
- }),
687
- _ts_metadata7("design:type", typeof String === "undefined" ? Object : String)
688
- ], ForwardedParametersInput.prototype, "toolChoice", void 0);
689
- _ts_decorate7([
690
- (0, import_type_graphql8.Field)(() => String, {
691
- nullable: true
692
- }),
693
- _ts_metadata7("design:type", String)
694
- ], ForwardedParametersInput.prototype, "toolChoiceFunctionName", void 0);
695
- _ts_decorate7([
696
- (0, import_type_graphql8.Field)(() => Number, {
697
- nullable: true
698
- }),
699
- _ts_metadata7("design:type", Number)
700
- ], ForwardedParametersInput.prototype, "temperature", void 0);
701
- ForwardedParametersInput = _ts_decorate7([
702
- (0, import_type_graphql8.InputType)()
703
- ], ForwardedParametersInput);
704
-
705
- // src/graphql/inputs/agent-session.input.ts
706
- var import_type_graphql9 = require("type-graphql");
707
- function _ts_decorate8(decorators, target, key, desc) {
708
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
709
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
710
- r = Reflect.decorate(decorators, target, key, desc);
711
- else
712
- for (var i = decorators.length - 1; i >= 0; i--)
713
- if (d = decorators[i])
714
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
715
- return c > 3 && r && Object.defineProperty(target, key, r), r;
716
- }
717
- __name(_ts_decorate8, "_ts_decorate");
718
- function _ts_metadata8(k, v) {
719
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
720
- return Reflect.metadata(k, v);
721
- }
722
- __name(_ts_metadata8, "_ts_metadata");
723
- var AgentSessionInput = class {
724
- agentName;
725
- threadId;
726
- nodeName;
727
- };
728
- __name(AgentSessionInput, "AgentSessionInput");
729
- _ts_decorate8([
730
- (0, import_type_graphql9.Field)(() => String),
731
- _ts_metadata8("design:type", String)
732
- ], AgentSessionInput.prototype, "agentName", void 0);
733
- _ts_decorate8([
734
- (0, import_type_graphql9.Field)(() => String, {
735
- nullable: true
736
- }),
737
- _ts_metadata8("design:type", String)
738
- ], AgentSessionInput.prototype, "threadId", void 0);
739
- _ts_decorate8([
740
- (0, import_type_graphql9.Field)(() => String, {
741
- nullable: true
742
- }),
743
- _ts_metadata8("design:type", String)
744
- ], AgentSessionInput.prototype, "nodeName", void 0);
745
- AgentSessionInput = _ts_decorate8([
746
- (0, import_type_graphql9.InputType)()
747
- ], AgentSessionInput);
748
-
749
- // src/graphql/inputs/agent-state.input.ts
750
- var import_type_graphql10 = require("type-graphql");
751
- function _ts_decorate9(decorators, target, key, desc) {
752
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
753
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
754
- r = Reflect.decorate(decorators, target, key, desc);
755
- else
756
- for (var i = decorators.length - 1; i >= 0; i--)
757
- if (d = decorators[i])
758
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
759
- return c > 3 && r && Object.defineProperty(target, key, r), r;
760
- }
761
- __name(_ts_decorate9, "_ts_decorate");
762
- function _ts_metadata9(k, v) {
763
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
764
- return Reflect.metadata(k, v);
765
- }
766
- __name(_ts_metadata9, "_ts_metadata");
767
- var AgentStateInput = class {
768
- agentName;
769
- state;
770
- config;
771
- };
772
- __name(AgentStateInput, "AgentStateInput");
773
- _ts_decorate9([
774
- (0, import_type_graphql10.Field)(() => String),
775
- _ts_metadata9("design:type", String)
776
- ], AgentStateInput.prototype, "agentName", void 0);
777
- _ts_decorate9([
778
- (0, import_type_graphql10.Field)(() => String),
779
- _ts_metadata9("design:type", String)
780
- ], AgentStateInput.prototype, "state", void 0);
781
- _ts_decorate9([
782
- (0, import_type_graphql10.Field)(() => String, {
783
- nullable: true
784
- }),
785
- _ts_metadata9("design:type", String)
786
- ], AgentStateInput.prototype, "config", void 0);
787
- AgentStateInput = _ts_decorate9([
788
- (0, import_type_graphql10.InputType)()
789
- ], AgentStateInput);
790
-
791
- // src/graphql/inputs/extensions.input.ts
792
- var import_type_graphql11 = require("type-graphql");
793
- function _ts_decorate10(decorators, target, key, desc) {
794
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
795
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
796
- r = Reflect.decorate(decorators, target, key, desc);
797
- else
798
- for (var i = decorators.length - 1; i >= 0; i--)
799
- if (d = decorators[i])
800
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
801
- return c > 3 && r && Object.defineProperty(target, key, r), r;
802
- }
803
- __name(_ts_decorate10, "_ts_decorate");
804
- function _ts_metadata10(k, v) {
805
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
806
- return Reflect.metadata(k, v);
807
- }
808
- __name(_ts_metadata10, "_ts_metadata");
809
- var ExtensionsInput = class {
810
- openaiAssistantAPI;
811
- };
812
- __name(ExtensionsInput, "ExtensionsInput");
813
- _ts_decorate10([
814
- (0, import_type_graphql11.Field)(() => OpenAIApiAssistantAPIInput, {
815
- nullable: true
816
- }),
817
- _ts_metadata10("design:type", typeof OpenAIApiAssistantAPIInput === "undefined" ? Object : OpenAIApiAssistantAPIInput)
818
- ], ExtensionsInput.prototype, "openaiAssistantAPI", void 0);
819
- ExtensionsInput = _ts_decorate10([
820
- (0, import_type_graphql11.InputType)()
821
- ], ExtensionsInput);
822
- var OpenAIApiAssistantAPIInput = class {
823
- runId;
824
- threadId;
825
- };
826
- __name(OpenAIApiAssistantAPIInput, "OpenAIApiAssistantAPIInput");
827
- _ts_decorate10([
828
- (0, import_type_graphql11.Field)(() => String, {
829
- nullable: true
830
- }),
831
- _ts_metadata10("design:type", String)
832
- ], OpenAIApiAssistantAPIInput.prototype, "runId", void 0);
833
- _ts_decorate10([
834
- (0, import_type_graphql11.Field)(() => String, {
835
- nullable: true
836
- }),
837
- _ts_metadata10("design:type", String)
838
- ], OpenAIApiAssistantAPIInput.prototype, "threadId", void 0);
839
- OpenAIApiAssistantAPIInput = _ts_decorate10([
840
- (0, import_type_graphql11.InputType)()
841
- ], OpenAIApiAssistantAPIInput);
842
-
843
- // src/graphql/inputs/meta-event.input.ts
844
- var import_type_graphql17 = require("type-graphql");
845
-
846
- // src/graphql/types/meta-events.type.ts
847
- var import_type_graphql16 = require("type-graphql");
848
-
849
- // src/graphql/types/copilot-response.type.ts
850
- var import_type_graphql15 = require("type-graphql");
851
-
852
- // src/graphql/types/message-status.type.ts
853
- var import_type_graphql12 = require("type-graphql");
854
- function _ts_decorate11(decorators, target, key, desc) {
855
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
856
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
857
- r = Reflect.decorate(decorators, target, key, desc);
858
- else
859
- for (var i = decorators.length - 1; i >= 0; i--)
860
- if (d = decorators[i])
861
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
862
- return c > 3 && r && Object.defineProperty(target, key, r), r;
863
- }
864
- __name(_ts_decorate11, "_ts_decorate");
865
- function _ts_metadata11(k, v) {
866
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
867
- return Reflect.metadata(k, v);
868
- }
869
- __name(_ts_metadata11, "_ts_metadata");
870
- var MessageStatusCode;
871
- (function(MessageStatusCode2) {
872
- MessageStatusCode2["Pending"] = "pending";
873
- MessageStatusCode2["Success"] = "success";
874
- MessageStatusCode2["Failed"] = "failed";
875
- })(MessageStatusCode || (MessageStatusCode = {}));
876
- (0, import_type_graphql12.registerEnumType)(MessageStatusCode, {
877
- name: "MessageStatusCode"
878
- });
879
- var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
880
- code;
881
- }, "BaseMessageStatus");
882
- _ts_decorate11([
883
- (0, import_type_graphql12.Field)(() => MessageStatusCode),
884
- _ts_metadata11("design:type", String)
885
- ], BaseMessageStatus.prototype, "code", void 0);
886
- BaseMessageStatus = _ts_decorate11([
887
- (0, import_type_graphql12.ObjectType)()
888
- ], BaseMessageStatus);
889
- var PendingMessageStatus = class extends BaseMessageStatus {
890
- code = "pending";
891
- };
892
- __name(PendingMessageStatus, "PendingMessageStatus");
893
- PendingMessageStatus = _ts_decorate11([
894
- (0, import_type_graphql12.ObjectType)()
895
- ], PendingMessageStatus);
896
- var SuccessMessageStatus = class extends BaseMessageStatus {
897
- code = "success";
898
- };
899
- __name(SuccessMessageStatus, "SuccessMessageStatus");
900
- SuccessMessageStatus = _ts_decorate11([
901
- (0, import_type_graphql12.ObjectType)()
902
- ], SuccessMessageStatus);
903
- var FailedMessageStatus = class extends BaseMessageStatus {
904
- code = "failed";
905
- reason;
906
- };
907
- __name(FailedMessageStatus, "FailedMessageStatus");
908
- _ts_decorate11([
909
- (0, import_type_graphql12.Field)(() => String),
910
- _ts_metadata11("design:type", String)
911
- ], FailedMessageStatus.prototype, "reason", void 0);
912
- FailedMessageStatus = _ts_decorate11([
913
- (0, import_type_graphql12.ObjectType)()
914
- ], FailedMessageStatus);
915
- var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
916
- name: "MessageStatus",
917
- types: () => [
918
- PendingMessageStatus,
919
- SuccessMessageStatus,
920
- FailedMessageStatus
921
- ]
922
- });
923
-
924
- // src/graphql/types/response-status.type.ts
925
- var import_graphql_scalars = require("graphql-scalars");
926
- var import_type_graphql13 = require("type-graphql");
927
- function _ts_decorate12(decorators, target, key, desc) {
928
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
929
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
930
- r = Reflect.decorate(decorators, target, key, desc);
931
- else
932
- for (var i = decorators.length - 1; i >= 0; i--)
933
- if (d = decorators[i])
934
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
935
- return c > 3 && r && Object.defineProperty(target, key, r), r;
936
- }
937
- __name(_ts_decorate12, "_ts_decorate");
938
- function _ts_metadata12(k, v) {
939
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
940
- return Reflect.metadata(k, v);
941
- }
942
- __name(_ts_metadata12, "_ts_metadata");
943
- var ResponseStatusCode;
944
- (function(ResponseStatusCode2) {
945
- ResponseStatusCode2["Pending"] = "pending";
946
- ResponseStatusCode2["Success"] = "success";
947
- ResponseStatusCode2["Failed"] = "failed";
948
- })(ResponseStatusCode || (ResponseStatusCode = {}));
949
- (0, import_type_graphql13.registerEnumType)(ResponseStatusCode, {
950
- name: "ResponseStatusCode"
951
- });
952
- var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
953
- code;
954
- }, "BaseResponseStatus");
955
- _ts_decorate12([
956
- (0, import_type_graphql13.Field)(() => ResponseStatusCode),
957
- _ts_metadata12("design:type", String)
958
- ], BaseResponseStatus.prototype, "code", void 0);
959
- BaseResponseStatus = _ts_decorate12([
960
- (0, import_type_graphql13.InterfaceType)({
961
- resolveType(value) {
962
- if (value.code === "success") {
963
- return SuccessResponseStatus;
964
- } else if (value.code === "failed") {
965
- return FailedResponseStatus;
966
- } else if (value.code === "pending") {
967
- return PendingResponseStatus;
968
- }
969
- return void 0;
970
- }
971
- }),
972
- (0, import_type_graphql13.ObjectType)()
973
- ], BaseResponseStatus);
974
- var PendingResponseStatus = class extends BaseResponseStatus {
975
- code = "pending";
976
- };
977
- __name(PendingResponseStatus, "PendingResponseStatus");
978
- PendingResponseStatus = _ts_decorate12([
979
- (0, import_type_graphql13.ObjectType)({
980
- implements: BaseResponseStatus
981
- })
982
- ], PendingResponseStatus);
983
- var SuccessResponseStatus = class extends BaseResponseStatus {
984
- code = "success";
985
- };
986
- __name(SuccessResponseStatus, "SuccessResponseStatus");
987
- SuccessResponseStatus = _ts_decorate12([
988
- (0, import_type_graphql13.ObjectType)({
989
- implements: BaseResponseStatus
990
- })
991
- ], SuccessResponseStatus);
992
- var FailedResponseStatusReason;
993
- (function(FailedResponseStatusReason2) {
994
- FailedResponseStatusReason2["GUARDRAILS_VALIDATION_FAILED"] = "GUARDRAILS_VALIDATION_FAILED";
995
- FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
996
- FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
997
- })(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
998
- (0, import_type_graphql13.registerEnumType)(FailedResponseStatusReason, {
999
- name: "FailedResponseStatusReason"
1000
- });
1001
- var FailedResponseStatus = class extends BaseResponseStatus {
1002
- code = "failed";
1003
- reason;
1004
- details = null;
1005
- };
1006
- __name(FailedResponseStatus, "FailedResponseStatus");
1007
- _ts_decorate12([
1008
- (0, import_type_graphql13.Field)(() => FailedResponseStatusReason),
1009
- _ts_metadata12("design:type", String)
1010
- ], FailedResponseStatus.prototype, "reason", void 0);
1011
- _ts_decorate12([
1012
- (0, import_type_graphql13.Field)(() => import_graphql_scalars.GraphQLJSON, {
1013
- nullable: true
1014
- }),
1015
- _ts_metadata12("design:type", typeof Record === "undefined" ? Object : Record)
1016
- ], FailedResponseStatus.prototype, "details", void 0);
1017
- FailedResponseStatus = _ts_decorate12([
1018
- (0, import_type_graphql13.ObjectType)({
1019
- implements: BaseResponseStatus
1020
- })
1021
- ], FailedResponseStatus);
1022
- var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
1023
- name: "ResponseStatus",
1024
- types: () => [
1025
- PendingResponseStatus,
1026
- SuccessResponseStatus,
1027
- FailedResponseStatus
1028
- ]
1029
- });
1030
-
1031
- // src/graphql/types/extensions-response.type.ts
1032
- var import_type_graphql14 = require("type-graphql");
1033
- function _ts_decorate13(decorators, target, key, desc) {
1034
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1035
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1036
- r = Reflect.decorate(decorators, target, key, desc);
1037
- else
1038
- for (var i = decorators.length - 1; i >= 0; i--)
1039
- if (d = decorators[i])
1040
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1041
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1042
- }
1043
- __name(_ts_decorate13, "_ts_decorate");
1044
- function _ts_metadata13(k, v) {
1045
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1046
- return Reflect.metadata(k, v);
1047
- }
1048
- __name(_ts_metadata13, "_ts_metadata");
1049
- var ExtensionsResponse = class {
1050
- openaiAssistantAPI;
1051
- };
1052
- __name(ExtensionsResponse, "ExtensionsResponse");
1053
- _ts_decorate13([
1054
- (0, import_type_graphql14.Field)(() => OpenAIApiAssistantAPIResponse, {
1055
- nullable: true
1056
- }),
1057
- _ts_metadata13("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
1058
- ], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
1059
- ExtensionsResponse = _ts_decorate13([
1060
- (0, import_type_graphql14.ObjectType)()
1061
- ], ExtensionsResponse);
1062
- var OpenAIApiAssistantAPIResponse = class {
1063
- runId;
1064
- threadId;
1065
- };
1066
- __name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
1067
- _ts_decorate13([
1068
- (0, import_type_graphql14.Field)(() => String, {
1069
- nullable: true
1070
- }),
1071
- _ts_metadata13("design:type", String)
1072
- ], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
1073
- _ts_decorate13([
1074
- (0, import_type_graphql14.Field)(() => String, {
1075
- nullable: true
1076
- }),
1077
- _ts_metadata13("design:type", String)
1078
- ], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
1079
- OpenAIApiAssistantAPIResponse = _ts_decorate13([
1080
- (0, import_type_graphql14.ObjectType)()
1081
- ], OpenAIApiAssistantAPIResponse);
1082
-
1083
- // src/graphql/types/copilot-response.type.ts
1084
- function _ts_decorate14(decorators, target, key, desc) {
1085
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1086
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1087
- r = Reflect.decorate(decorators, target, key, desc);
1088
- else
1089
- for (var i = decorators.length - 1; i >= 0; i--)
1090
- if (d = decorators[i])
1091
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1092
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1093
- }
1094
- __name(_ts_decorate14, "_ts_decorate");
1095
- function _ts_metadata14(k, v) {
1096
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1097
- return Reflect.metadata(k, v);
1098
- }
1099
- __name(_ts_metadata14, "_ts_metadata");
1100
- var BaseMessageOutput = class {
1101
- id;
1102
- createdAt;
1103
- status;
1104
- };
1105
- __name(BaseMessageOutput, "BaseMessageOutput");
1106
- _ts_decorate14([
1107
- (0, import_type_graphql15.Field)(() => String),
1108
- _ts_metadata14("design:type", String)
1109
- ], BaseMessageOutput.prototype, "id", void 0);
1110
- _ts_decorate14([
1111
- (0, import_type_graphql15.Field)(() => Date),
1112
- _ts_metadata14("design:type", typeof Date === "undefined" ? Object : Date)
1113
- ], BaseMessageOutput.prototype, "createdAt", void 0);
1114
- _ts_decorate14([
1115
- (0, import_type_graphql15.Field)(() => MessageStatusUnion),
1116
- _ts_metadata14("design:type", Object)
1117
- ], BaseMessageOutput.prototype, "status", void 0);
1118
- BaseMessageOutput = _ts_decorate14([
1119
- (0, import_type_graphql15.InterfaceType)({
1120
- resolveType(value) {
1121
- if (value.hasOwnProperty("content")) {
1122
- return TextMessageOutput;
1123
- } else if (value.hasOwnProperty("name")) {
1124
- return ActionExecutionMessageOutput;
1125
- } else if (value.hasOwnProperty("result")) {
1126
- return ResultMessageOutput;
1127
- } else if (value.hasOwnProperty("state")) {
1128
- return AgentStateMessageOutput;
1129
- } else if (value.hasOwnProperty("format") && value.hasOwnProperty("bytes")) {
1130
- return ImageMessageOutput;
1131
- }
1132
- return void 0;
1133
- }
1134
- })
1135
- ], BaseMessageOutput);
1136
- var TextMessageOutput = class {
1137
- role;
1138
- content;
1139
- parentMessageId;
1140
- };
1141
- __name(TextMessageOutput, "TextMessageOutput");
1142
- _ts_decorate14([
1143
- (0, import_type_graphql15.Field)(() => MessageRole),
1144
- _ts_metadata14("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1145
- ], TextMessageOutput.prototype, "role", void 0);
1146
- _ts_decorate14([
1147
- (0, import_type_graphql15.Field)(() => [
1148
- String
1149
- ]),
1150
- _ts_metadata14("design:type", Array)
1151
- ], TextMessageOutput.prototype, "content", void 0);
1152
- _ts_decorate14([
1153
- (0, import_type_graphql15.Field)(() => String, {
1154
- nullable: true
1155
- }),
1156
- _ts_metadata14("design:type", String)
1157
- ], TextMessageOutput.prototype, "parentMessageId", void 0);
1158
- TextMessageOutput = _ts_decorate14([
1159
- (0, import_type_graphql15.ObjectType)({
1160
- implements: BaseMessageOutput
1161
- })
1162
- ], TextMessageOutput);
1163
- var ActionExecutionMessageOutput = class {
1164
- name;
1165
- scope;
1166
- arguments;
1167
- parentMessageId;
1168
- };
1169
- __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
1170
- _ts_decorate14([
1171
- (0, import_type_graphql15.Field)(() => String),
1172
- _ts_metadata14("design:type", String)
1173
- ], ActionExecutionMessageOutput.prototype, "name", void 0);
1174
- _ts_decorate14([
1175
- (0, import_type_graphql15.Field)(() => String, {
1176
- nullable: true,
1177
- deprecationReason: "This field will be removed in a future version"
1178
- }),
1179
- _ts_metadata14("design:type", String)
1180
- ], ActionExecutionMessageOutput.prototype, "scope", void 0);
1181
- _ts_decorate14([
1182
- (0, import_type_graphql15.Field)(() => [
1183
- String
1184
- ]),
1185
- _ts_metadata14("design:type", Array)
1186
- ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
1187
- _ts_decorate14([
1188
- (0, import_type_graphql15.Field)(() => String, {
1189
- nullable: true
1190
- }),
1191
- _ts_metadata14("design:type", String)
1192
- ], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
1193
- ActionExecutionMessageOutput = _ts_decorate14([
1194
- (0, import_type_graphql15.ObjectType)({
1195
- implements: BaseMessageOutput
1196
- })
1197
- ], ActionExecutionMessageOutput);
1198
- var ResultMessageOutput = class {
1199
- actionExecutionId;
1200
- actionName;
1201
- result;
1202
- };
1203
- __name(ResultMessageOutput, "ResultMessageOutput");
1204
- _ts_decorate14([
1205
- (0, import_type_graphql15.Field)(() => String),
1206
- _ts_metadata14("design:type", String)
1207
- ], ResultMessageOutput.prototype, "actionExecutionId", void 0);
1208
- _ts_decorate14([
1209
- (0, import_type_graphql15.Field)(() => String),
1210
- _ts_metadata14("design:type", String)
1211
- ], ResultMessageOutput.prototype, "actionName", void 0);
1212
- _ts_decorate14([
1213
- (0, import_type_graphql15.Field)(() => String),
1214
- _ts_metadata14("design:type", String)
1215
- ], ResultMessageOutput.prototype, "result", void 0);
1216
- ResultMessageOutput = _ts_decorate14([
1217
- (0, import_type_graphql15.ObjectType)({
1218
- implements: BaseMessageOutput
1219
- })
1220
- ], ResultMessageOutput);
1221
- var AgentStateMessageOutput = class {
1222
- threadId;
1223
- agentName;
1224
- nodeName;
1225
- runId;
1226
- active;
1227
- role;
1228
- state;
1229
- running;
1230
- };
1231
- __name(AgentStateMessageOutput, "AgentStateMessageOutput");
1232
- _ts_decorate14([
1233
- (0, import_type_graphql15.Field)(() => String),
1234
- _ts_metadata14("design:type", String)
1235
- ], AgentStateMessageOutput.prototype, "threadId", void 0);
1236
- _ts_decorate14([
1237
- (0, import_type_graphql15.Field)(() => String),
1238
- _ts_metadata14("design:type", String)
1239
- ], AgentStateMessageOutput.prototype, "agentName", void 0);
1240
- _ts_decorate14([
1241
- (0, import_type_graphql15.Field)(() => String),
1242
- _ts_metadata14("design:type", String)
1243
- ], AgentStateMessageOutput.prototype, "nodeName", void 0);
1244
- _ts_decorate14([
1245
- (0, import_type_graphql15.Field)(() => String),
1246
- _ts_metadata14("design:type", String)
1247
- ], AgentStateMessageOutput.prototype, "runId", void 0);
1248
- _ts_decorate14([
1249
- (0, import_type_graphql15.Field)(() => Boolean),
1250
- _ts_metadata14("design:type", Boolean)
1251
- ], AgentStateMessageOutput.prototype, "active", void 0);
1252
- _ts_decorate14([
1253
- (0, import_type_graphql15.Field)(() => MessageRole),
1254
- _ts_metadata14("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1255
- ], AgentStateMessageOutput.prototype, "role", void 0);
1256
- _ts_decorate14([
1257
- (0, import_type_graphql15.Field)(() => String),
1258
- _ts_metadata14("design:type", String)
1259
- ], AgentStateMessageOutput.prototype, "state", void 0);
1260
- _ts_decorate14([
1261
- (0, import_type_graphql15.Field)(() => Boolean),
1262
- _ts_metadata14("design:type", Boolean)
1263
- ], AgentStateMessageOutput.prototype, "running", void 0);
1264
- AgentStateMessageOutput = _ts_decorate14([
1265
- (0, import_type_graphql15.ObjectType)({
1266
- implements: BaseMessageOutput
1267
- })
1268
- ], AgentStateMessageOutput);
1269
- var ImageMessageOutput = class {
1270
- format;
1271
- bytes;
1272
- role;
1273
- parentMessageId;
1274
- };
1275
- __name(ImageMessageOutput, "ImageMessageOutput");
1276
- _ts_decorate14([
1277
- (0, import_type_graphql15.Field)(() => String),
1278
- _ts_metadata14("design:type", String)
1279
- ], ImageMessageOutput.prototype, "format", void 0);
1280
- _ts_decorate14([
1281
- (0, import_type_graphql15.Field)(() => String),
1282
- _ts_metadata14("design:type", String)
1283
- ], ImageMessageOutput.prototype, "bytes", void 0);
1284
- _ts_decorate14([
1285
- (0, import_type_graphql15.Field)(() => MessageRole),
1286
- _ts_metadata14("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1287
- ], ImageMessageOutput.prototype, "role", void 0);
1288
- _ts_decorate14([
1289
- (0, import_type_graphql15.Field)(() => String, {
1290
- nullable: true
1291
- }),
1292
- _ts_metadata14("design:type", String)
1293
- ], ImageMessageOutput.prototype, "parentMessageId", void 0);
1294
- ImageMessageOutput = _ts_decorate14([
1295
- (0, import_type_graphql15.ObjectType)({
1296
- implements: BaseMessageOutput
1297
- })
1298
- ], ImageMessageOutput);
1299
- var CopilotResponse = class {
1300
- threadId;
1301
- status;
1302
- runId;
1303
- messages;
1304
- extensions;
1305
- metaEvents;
1306
- };
1307
- __name(CopilotResponse, "CopilotResponse");
1308
- _ts_decorate14([
1309
- (0, import_type_graphql15.Field)(() => String),
1310
- _ts_metadata14("design:type", String)
1311
- ], CopilotResponse.prototype, "threadId", void 0);
1312
- _ts_decorate14([
1313
- (0, import_type_graphql15.Field)(() => ResponseStatusUnion),
1314
- _ts_metadata14("design:type", Object)
1315
- ], CopilotResponse.prototype, "status", void 0);
1316
- _ts_decorate14([
1317
- (0, import_type_graphql15.Field)({
1318
- nullable: true
1319
- }),
1320
- _ts_metadata14("design:type", String)
1321
- ], CopilotResponse.prototype, "runId", void 0);
1322
- _ts_decorate14([
1323
- (0, import_type_graphql15.Field)(() => [
1324
- BaseMessageOutput
1325
- ]),
1326
- _ts_metadata14("design:type", Array)
1327
- ], CopilotResponse.prototype, "messages", void 0);
1328
- _ts_decorate14([
1329
- (0, import_type_graphql15.Field)(() => ExtensionsResponse, {
1330
- nullable: true
1331
- }),
1332
- _ts_metadata14("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
1333
- ], CopilotResponse.prototype, "extensions", void 0);
1334
- _ts_decorate14([
1335
- (0, import_type_graphql15.Field)(() => [
1336
- BaseMetaEvent
1337
- ], {
1338
- nullable: true
1339
- }),
1340
- _ts_metadata14("design:type", Array)
1341
- ], CopilotResponse.prototype, "metaEvents", void 0);
1342
- CopilotResponse = _ts_decorate14([
1343
- (0, import_type_graphql15.ObjectType)()
1344
- ], CopilotResponse);
1345
-
1346
- // src/graphql/types/meta-events.type.ts
1347
- function _ts_decorate15(decorators, target, key, desc) {
1348
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1349
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1350
- r = Reflect.decorate(decorators, target, key, desc);
1351
- else
1352
- for (var i = decorators.length - 1; i >= 0; i--)
1353
- if (d = decorators[i])
1354
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1355
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1356
- }
1357
- __name(_ts_decorate15, "_ts_decorate");
1358
- function _ts_metadata15(k, v) {
1359
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1360
- return Reflect.metadata(k, v);
1361
- }
1362
- __name(_ts_metadata15, "_ts_metadata");
1363
- var MetaEventName;
1364
- (function(MetaEventName2) {
1365
- MetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1366
- MetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
1367
- })(MetaEventName || (MetaEventName = {}));
1368
- (0, import_type_graphql16.registerEnumType)(MetaEventName, {
1369
- name: "MetaEventName",
1370
- description: "Meta event types"
1371
- });
1372
- var BaseMetaEvent = class {
1373
- type = "MetaEvent";
1374
- name;
1375
- };
1376
- __name(BaseMetaEvent, "BaseMetaEvent");
1377
- _ts_decorate15([
1378
- (0, import_type_graphql16.Field)(() => String),
1379
- _ts_metadata15("design:type", String)
1380
- ], BaseMetaEvent.prototype, "type", void 0);
1381
- _ts_decorate15([
1382
- (0, import_type_graphql16.Field)(() => MetaEventName),
1383
- _ts_metadata15("design:type", String)
1384
- ], BaseMetaEvent.prototype, "name", void 0);
1385
- BaseMetaEvent = _ts_decorate15([
1386
- (0, import_type_graphql16.InterfaceType)({
1387
- resolveType(value) {
1388
- if (value.name === "LangGraphInterruptEvent") {
1389
- return LangGraphInterruptEvent;
1390
- } else if (value.name === "CopilotKitLangGraphInterruptEvent") {
1391
- return CopilotKitLangGraphInterruptEvent;
1392
- }
1393
- return void 0;
1394
- }
1395
- }),
1396
- (0, import_type_graphql16.InterfaceType)()
1397
- ], BaseMetaEvent);
1398
- var CopilotKitLangGraphInterruptEventData = class {
1399
- value;
1400
- messages;
1401
- };
1402
- __name(CopilotKitLangGraphInterruptEventData, "CopilotKitLangGraphInterruptEventData");
1403
- _ts_decorate15([
1404
- (0, import_type_graphql16.Field)(() => String),
1405
- _ts_metadata15("design:type", String)
1406
- ], CopilotKitLangGraphInterruptEventData.prototype, "value", void 0);
1407
- _ts_decorate15([
1408
- (0, import_type_graphql16.Field)(() => [
1409
- BaseMessageOutput
1410
- ]),
1411
- _ts_metadata15("design:type", Array)
1412
- ], CopilotKitLangGraphInterruptEventData.prototype, "messages", void 0);
1413
- CopilotKitLangGraphInterruptEventData = _ts_decorate15([
1414
- (0, import_type_graphql16.ObjectType)()
1415
- ], CopilotKitLangGraphInterruptEventData);
1416
- var LangGraphInterruptEvent = class {
1417
- name = "LangGraphInterruptEvent";
1418
- value;
1419
- response;
1420
- };
1421
- __name(LangGraphInterruptEvent, "LangGraphInterruptEvent");
1422
- _ts_decorate15([
1423
- (0, import_type_graphql16.Field)(() => MetaEventName),
1424
- _ts_metadata15("design:type", typeof MetaEventName === "undefined" || false ? Object : "LangGraphInterruptEvent")
1425
- ], LangGraphInterruptEvent.prototype, "name", void 0);
1426
- _ts_decorate15([
1427
- (0, import_type_graphql16.Field)(() => String),
1428
- _ts_metadata15("design:type", String)
1429
- ], LangGraphInterruptEvent.prototype, "value", void 0);
1430
- _ts_decorate15([
1431
- (0, import_type_graphql16.Field)(() => String, {
1432
- nullable: true
1433
- }),
1434
- _ts_metadata15("design:type", String)
1435
- ], LangGraphInterruptEvent.prototype, "response", void 0);
1436
- LangGraphInterruptEvent = _ts_decorate15([
1437
- (0, import_type_graphql16.ObjectType)({
1438
- implements: BaseMetaEvent
1439
- })
1440
- ], LangGraphInterruptEvent);
1441
- var CopilotKitLangGraphInterruptEvent = class {
1442
- name = "CopilotKitLangGraphInterruptEvent";
1443
- data;
1444
- response;
1445
- };
1446
- __name(CopilotKitLangGraphInterruptEvent, "CopilotKitLangGraphInterruptEvent");
1447
- _ts_decorate15([
1448
- (0, import_type_graphql16.Field)(() => MetaEventName),
1449
- _ts_metadata15("design:type", typeof MetaEventName === "undefined" || false ? Object : "CopilotKitLangGraphInterruptEvent")
1450
- ], CopilotKitLangGraphInterruptEvent.prototype, "name", void 0);
1451
- _ts_decorate15([
1452
- (0, import_type_graphql16.Field)(() => CopilotKitLangGraphInterruptEventData),
1453
- _ts_metadata15("design:type", typeof CopilotKitLangGraphInterruptEventData === "undefined" ? Object : CopilotKitLangGraphInterruptEventData)
1454
- ], CopilotKitLangGraphInterruptEvent.prototype, "data", void 0);
1455
- _ts_decorate15([
1456
- (0, import_type_graphql16.Field)(() => String, {
1457
- nullable: true
1458
- }),
1459
- _ts_metadata15("design:type", String)
1460
- ], CopilotKitLangGraphInterruptEvent.prototype, "response", void 0);
1461
- CopilotKitLangGraphInterruptEvent = _ts_decorate15([
1462
- (0, import_type_graphql16.ObjectType)({
1463
- implements: BaseMetaEvent
1464
- })
1465
- ], CopilotKitLangGraphInterruptEvent);
1466
-
1467
- // src/graphql/inputs/meta-event.input.ts
1468
- function _ts_decorate16(decorators, target, key, desc) {
1469
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1470
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1471
- r = Reflect.decorate(decorators, target, key, desc);
1472
- else
1473
- for (var i = decorators.length - 1; i >= 0; i--)
1474
- if (d = decorators[i])
1475
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1476
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1477
- }
1478
- __name(_ts_decorate16, "_ts_decorate");
1479
- function _ts_metadata16(k, v) {
1480
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1481
- return Reflect.metadata(k, v);
1482
- }
1483
- __name(_ts_metadata16, "_ts_metadata");
1484
- var MetaEventInput = class {
1485
- name;
1486
- value;
1487
- response;
1488
- messages;
1489
- };
1490
- __name(MetaEventInput, "MetaEventInput");
1491
- _ts_decorate16([
1492
- (0, import_type_graphql17.Field)(() => MetaEventName),
1493
- _ts_metadata16("design:type", typeof MetaEventName === "undefined" ? Object : MetaEventName)
1494
- ], MetaEventInput.prototype, "name", void 0);
1495
- _ts_decorate16([
1496
- (0, import_type_graphql17.Field)(() => String),
1497
- _ts_metadata16("design:type", String)
1498
- ], MetaEventInput.prototype, "value", void 0);
1499
- _ts_decorate16([
1500
- (0, import_type_graphql17.Field)(() => String, {
1501
- nullable: true
1502
- }),
1503
- _ts_metadata16("design:type", String)
1504
- ], MetaEventInput.prototype, "response", void 0);
1505
- _ts_decorate16([
1506
- (0, import_type_graphql17.Field)(() => [
1507
- MessageInput
1508
- ], {
1509
- nullable: true
1510
- }),
1511
- _ts_metadata16("design:type", Array)
1512
- ], MetaEventInput.prototype, "messages", void 0);
1513
- MetaEventInput = _ts_decorate16([
1514
- (0, import_type_graphql17.InputType)()
1515
- ], MetaEventInput);
1516
-
1517
- // src/graphql/inputs/copilot-context.input.ts
1518
- var import_type_graphql18 = require("type-graphql");
1519
- function _ts_decorate17(decorators, target, key, desc) {
1520
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1521
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1522
- r = Reflect.decorate(decorators, target, key, desc);
1523
- else
1524
- for (var i = decorators.length - 1; i >= 0; i--)
1525
- if (d = decorators[i])
1526
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1527
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1528
- }
1529
- __name(_ts_decorate17, "_ts_decorate");
1530
- function _ts_metadata17(k, v) {
1531
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1532
- return Reflect.metadata(k, v);
1533
- }
1534
- __name(_ts_metadata17, "_ts_metadata");
1535
- var CopilotContextInput = class {
1536
- description;
1537
- value;
1538
- };
1539
- __name(CopilotContextInput, "CopilotContextInput");
1540
- _ts_decorate17([
1541
- (0, import_type_graphql18.Field)(() => String),
1542
- _ts_metadata17("design:type", String)
1543
- ], CopilotContextInput.prototype, "description", void 0);
1544
- _ts_decorate17([
1545
- (0, import_type_graphql18.Field)(() => String),
1546
- _ts_metadata17("design:type", String)
1547
- ], CopilotContextInput.prototype, "value", void 0);
1548
- CopilotContextInput = _ts_decorate17([
1549
- (0, import_type_graphql18.InputType)()
1550
- ], CopilotContextInput);
1551
-
1552
- // src/graphql/inputs/generate-copilot-response.input.ts
1553
- function _ts_decorate18(decorators, target, key, desc) {
1554
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1555
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1556
- r = Reflect.decorate(decorators, target, key, desc);
1557
- else
1558
- for (var i = decorators.length - 1; i >= 0; i--)
1559
- if (d = decorators[i])
1560
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1561
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1562
- }
1563
- __name(_ts_decorate18, "_ts_decorate");
1564
- function _ts_metadata18(k, v) {
1565
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1566
- return Reflect.metadata(k, v);
1567
- }
1568
- __name(_ts_metadata18, "_ts_metadata");
1569
- var GenerateCopilotResponseMetadataInput = class {
1570
- requestType;
1571
- };
1572
- __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
1573
- _ts_decorate18([
1574
- (0, import_type_graphql19.Field)(() => CopilotRequestType, {
1575
- nullable: true
1576
- }),
1577
- _ts_metadata18("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
1578
- ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
1579
- GenerateCopilotResponseMetadataInput = _ts_decorate18([
1580
- (0, import_type_graphql19.InputType)()
1581
- ], GenerateCopilotResponseMetadataInput);
1582
- var GenerateCopilotResponseInput = class {
1583
- metadata;
1584
- threadId;
1585
- runId;
1586
- messages;
1587
- frontend;
1588
- cloud;
1589
- forwardedParameters;
1590
- agentSession;
1591
- agentState;
1592
- agentStates;
1593
- extensions;
1594
- metaEvents;
1595
- context;
1596
- };
1597
- __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
1598
- _ts_decorate18([
1599
- (0, import_type_graphql19.Field)(() => GenerateCopilotResponseMetadataInput, {
1600
- nullable: false
1601
- }),
1602
- _ts_metadata18("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
1603
- ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
1604
- _ts_decorate18([
1605
- (0, import_type_graphql19.Field)(() => String, {
1606
- nullable: true
1607
- }),
1608
- _ts_metadata18("design:type", String)
1609
- ], GenerateCopilotResponseInput.prototype, "threadId", void 0);
1610
- _ts_decorate18([
1611
- (0, import_type_graphql19.Field)(() => String, {
1612
- nullable: true
1613
- }),
1614
- _ts_metadata18("design:type", String)
1615
- ], GenerateCopilotResponseInput.prototype, "runId", void 0);
1616
- _ts_decorate18([
1617
- (0, import_type_graphql19.Field)(() => [
1618
- MessageInput
1619
- ]),
1620
- _ts_metadata18("design:type", Array)
1621
- ], GenerateCopilotResponseInput.prototype, "messages", void 0);
1622
- _ts_decorate18([
1623
- (0, import_type_graphql19.Field)(() => FrontendInput),
1624
- _ts_metadata18("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
1625
- ], GenerateCopilotResponseInput.prototype, "frontend", void 0);
1626
- _ts_decorate18([
1627
- (0, import_type_graphql19.Field)(() => CloudInput, {
1628
- nullable: true
1629
- }),
1630
- _ts_metadata18("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
1631
- ], GenerateCopilotResponseInput.prototype, "cloud", void 0);
1632
- _ts_decorate18([
1633
- (0, import_type_graphql19.Field)(() => ForwardedParametersInput, {
1634
- nullable: true
1635
- }),
1636
- _ts_metadata18("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
1637
- ], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
1638
- _ts_decorate18([
1639
- (0, import_type_graphql19.Field)(() => AgentSessionInput, {
1640
- nullable: true
1641
- }),
1642
- _ts_metadata18("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
1643
- ], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
1644
- _ts_decorate18([
1645
- (0, import_type_graphql19.Field)(() => AgentStateInput, {
1646
- nullable: true
1647
- }),
1648
- _ts_metadata18("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
1649
- ], GenerateCopilotResponseInput.prototype, "agentState", void 0);
1650
- _ts_decorate18([
1651
- (0, import_type_graphql19.Field)(() => [
1652
- AgentStateInput
1653
- ], {
1654
- nullable: true
1655
- }),
1656
- _ts_metadata18("design:type", Array)
1657
- ], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
1658
- _ts_decorate18([
1659
- (0, import_type_graphql19.Field)(() => ExtensionsInput, {
1660
- nullable: true
1661
- }),
1662
- _ts_metadata18("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
1663
- ], GenerateCopilotResponseInput.prototype, "extensions", void 0);
1664
- _ts_decorate18([
1665
- (0, import_type_graphql19.Field)(() => [
1666
- MetaEventInput
1667
- ], {
1668
- nullable: true
1669
- }),
1670
- _ts_metadata18("design:type", Array)
1671
- ], GenerateCopilotResponseInput.prototype, "metaEvents", void 0);
1672
- _ts_decorate18([
1673
- (0, import_type_graphql19.Field)(() => [
1674
- CopilotContextInput
1675
- ], {
1676
- nullable: true
1677
- }),
1678
- _ts_metadata18("design:type", Array)
1679
- ], GenerateCopilotResponseInput.prototype, "context", void 0);
1680
- GenerateCopilotResponseInput = _ts_decorate18([
1681
- (0, import_type_graphql19.InputType)()
1682
- ], GenerateCopilotResponseInput);
1683
-
1684
- // src/graphql/resolvers/copilot.resolver.ts
1685
- var import_graphql_yoga = require("graphql-yoga");
1686
-
1687
- // src/service-adapters/events.ts
1688
- var import_shared5 = require("@copilotkit/shared");
1689
- var import_class_transformer = require("class-transformer");
1690
- var import_rxjs2 = require("rxjs");
1691
-
1692
- // src/graphql/types/converted/index.ts
1693
- var Message = class extends BaseMessageInput {
1694
- type;
1695
- isTextMessage() {
1696
- return this.type === "TextMessage";
1697
- }
1698
- isActionExecutionMessage() {
1699
- return this.type === "ActionExecutionMessage";
1700
- }
1701
- isResultMessage() {
1702
- return this.type === "ResultMessage";
1703
- }
1704
- isAgentStateMessage() {
1705
- return this.type === "AgentStateMessage";
1706
- }
1707
- isImageMessage() {
1708
- return this.type === "ImageMessage";
1709
- }
1710
- };
1711
- __name(Message, "Message");
1712
- var TextMessage = class extends Message {
1713
- type = "TextMessage";
1714
- content;
1715
- role;
1716
- parentMessageId;
1717
- };
1718
- __name(TextMessage, "TextMessage");
1719
- var ActionExecutionMessage = class extends Message {
1720
- type = "ActionExecutionMessage";
1721
- name;
1722
- arguments;
1723
- parentMessageId;
1724
- };
1725
- __name(ActionExecutionMessage, "ActionExecutionMessage");
1726
- var ResultMessage = class extends Message {
1727
- type = "ResultMessage";
1728
- actionExecutionId;
1729
- actionName;
1730
- result;
1731
- static encodeResult(result, error) {
1732
- const errorObj = error ? typeof error === "string" ? {
1733
- code: "ERROR",
1734
- message: error
1735
- } : error instanceof Error ? {
1736
- code: "ERROR",
1737
- message: error.message
1738
- } : error : void 0;
1739
- if (errorObj) {
1740
- return JSON.stringify({
1741
- error: errorObj,
1742
- result: result || ""
1743
- });
1744
- }
1745
- if (result === void 0) {
1746
- return "";
1747
- }
1748
- return typeof result === "string" ? result : JSON.stringify(result);
1749
- }
1750
- static decodeResult(result) {
1751
- if (!result) {
1752
- return {
1753
- result: ""
1754
- };
1755
- }
1756
- try {
1757
- const parsed = JSON.parse(result);
1758
- if (parsed && typeof parsed === "object") {
1759
- if ("error" in parsed) {
1760
- return {
1761
- error: parsed.error,
1762
- result: parsed.result || ""
1763
- };
1764
- }
1765
- return {
1766
- result: JSON.stringify(parsed)
1767
- };
1768
- }
1769
- return {
1770
- result
1771
- };
1772
- } catch (e) {
1773
- return {
1774
- result
1775
- };
1776
- }
1777
- }
1778
- hasError() {
1779
- try {
1780
- const { error } = ResultMessage.decodeResult(this.result);
1781
- return !!error;
1782
- } catch {
1783
- return false;
1784
- }
1785
- }
1786
- getError() {
1787
- try {
1788
- const { error } = ResultMessage.decodeResult(this.result);
1789
- return error;
1790
- } catch {
1791
- return void 0;
1792
- }
1793
- }
1794
- };
1795
- __name(ResultMessage, "ResultMessage");
1796
- var AgentStateMessage = class extends Message {
1797
- type = "AgentStateMessage";
1798
- threadId;
1799
- agentName;
1800
- nodeName;
1801
- runId;
1802
- active;
1803
- role;
1804
- state;
1805
- running;
1806
- };
1807
- __name(AgentStateMessage, "AgentStateMessage");
1808
-
1809
- // src/lib/runtime/remote-actions.ts
1810
- var import_shared3 = require("@copilotkit/shared");
1811
-
1812
- // src/lib/telemetry-client.ts
1813
- var import_shared2 = require("@copilotkit/shared");
1814
- var import_node_crypto = require("crypto");
1815
-
1816
- // src/lib/runtime/copilot-runtime.ts
1817
- var import_shared = require("@copilotkit/shared");
1818
- var import_rxjs = require("rxjs");
1819
- var import_langgraph_sdk = require("@langchain/langgraph-sdk");
1820
-
1821
- // src/agents/langgraph/events.ts
1822
- var LangGraphEventTypes;
1823
- (function(LangGraphEventTypes2) {
1824
- LangGraphEventTypes2["OnChainStart"] = "on_chain_start";
1825
- LangGraphEventTypes2["OnChainStream"] = "on_chain_stream";
1826
- LangGraphEventTypes2["OnChainEnd"] = "on_chain_end";
1827
- LangGraphEventTypes2["OnChatModelStart"] = "on_chat_model_start";
1828
- LangGraphEventTypes2["OnChatModelStream"] = "on_chat_model_stream";
1829
- LangGraphEventTypes2["OnChatModelEnd"] = "on_chat_model_end";
1830
- LangGraphEventTypes2["OnToolStart"] = "on_tool_start";
1831
- LangGraphEventTypes2["OnToolEnd"] = "on_tool_end";
1832
- LangGraphEventTypes2["OnCopilotKitStateSync"] = "on_copilotkit_state_sync";
1833
- LangGraphEventTypes2["OnCopilotKitEmitMessage"] = "on_copilotkit_emit_message";
1834
- LangGraphEventTypes2["OnCopilotKitEmitToolCall"] = "on_copilotkit_emit_tool_call";
1835
- LangGraphEventTypes2["OnCustomEvent"] = "on_custom_event";
1836
- LangGraphEventTypes2["OnInterrupt"] = "on_interrupt";
1837
- LangGraphEventTypes2["OnCopilotKitInterrupt"] = "on_copilotkit_interrupt";
1838
- LangGraphEventTypes2["OnCopilotKitError"] = "on_copilotkit_error";
1839
- })(LangGraphEventTypes || (LangGraphEventTypes = {}));
1840
- var MetaEventNames;
1841
- (function(MetaEventNames2) {
1842
- MetaEventNames2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1843
- MetaEventNames2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
1844
- })(MetaEventNames || (MetaEventNames = {}));
1845
- var CustomEventNames;
1846
- (function(CustomEventNames2) {
1847
- CustomEventNames2["CopilotKitManuallyEmitMessage"] = "copilotkit_manually_emit_message";
1848
- CustomEventNames2["CopilotKitManuallyEmitToolCall"] = "copilotkit_manually_emit_tool_call";
1849
- CustomEventNames2["CopilotKitManuallyEmitIntermediateState"] = "copilotkit_manually_emit_intermediate_state";
1850
- CustomEventNames2["CopilotKitExit"] = "copilotkit_exit";
1851
- })(CustomEventNames || (CustomEventNames = {}));
1852
-
1853
- // src/lib/runtime/copilot-runtime.ts
1854
- function resolveEndpointType(endpoint) {
1855
- if (!endpoint.type) {
1856
- if ("deploymentUrl" in endpoint && "agents" in endpoint) {
1857
- return EndpointType.LangGraphPlatform;
1858
- } else {
1859
- return EndpointType.CopilotKit;
1860
- }
1861
- }
1862
- return endpoint.type;
1863
- }
1864
- __name(resolveEndpointType, "resolveEndpointType");
1865
-
1866
- // src/lib/telemetry-client.ts
1867
- var packageJson = require_package();
1868
- var telemetryClient = new import_shared2.TelemetryClient({
1869
- packageName: packageJson.name,
1870
- packageVersion: packageJson.version
1871
- });
1872
- function getRuntimeInstanceTelemetryInfo(options) {
1873
- var _a, _b;
1874
- const runtime = options.runtime;
1875
- const endpointsInfo = runtime.remoteEndpointDefinitions.reduce((acc, endpoint) => {
1876
- let info = {
1877
- ...acc
1878
- };
1879
- const endpointType = resolveEndpointType(endpoint);
1880
- if (!info.endpointTypes.includes(endpointType)) {
1881
- info = {
1882
- ...info,
1883
- endpointTypes: [
1884
- ...info.endpointTypes,
1885
- endpointType
1886
- ]
1887
- };
1888
- }
1889
- if (endpointType === EndpointType.LangGraphPlatform) {
1890
- const ep = endpoint;
1891
- info = {
1892
- ...info,
1893
- agentsAmount: ep.agents.length,
1894
- hashedKey: ep.langsmithApiKey ? (0, import_node_crypto.createHash)("sha256").update(ep.langsmithApiKey).digest("hex") : null
1895
- };
1896
- }
1897
- return info;
1898
- }, {
1899
- endpointTypes: [],
1900
- agentsAmount: null,
1901
- hashedKey: null
1902
- });
1903
- const publicApiKey = (_a = options.cloud) == null ? void 0 : _a.publicApiKey;
1904
- const apiKeyProvided = !!publicApiKey && publicApiKey.trim().length > 0;
1905
- return {
1906
- actionsAmount: runtime.actions.length,
1907
- endpointsAmount: runtime.remoteEndpointDefinitions.length,
1908
- endpointTypes: endpointsInfo.endpointTypes,
1909
- agentsAmount: endpointsInfo.agentsAmount,
1910
- hashedLgcKey: endpointsInfo.hashedKey,
1911
- "cloud.api_key_provided": apiKeyProvided,
1912
- ...apiKeyProvided ? {
1913
- "cloud.public_api_key": publicApiKey
1914
- } : {},
1915
- ...((_b = options.cloud) == null ? void 0 : _b.baseUrl) ? {
1916
- "cloud.base_url": options.cloud.baseUrl
1917
- } : {}
1918
- };
1919
- }
1920
- __name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
1921
- var telemetry_client_default = telemetryClient;
1922
-
1923
- // src/lib/runtime/remote-actions.ts
1924
- var import_shared4 = require("@copilotkit/shared");
1925
- var EndpointType;
1926
- (function(EndpointType2) {
1927
- EndpointType2["CopilotKit"] = "copilotKit";
1928
- EndpointType2["LangGraphPlatform"] = "langgraph-platform";
1929
- })(EndpointType || (EndpointType = {}));
1930
-
1931
- // src/service-adapters/events.ts
1932
- var RuntimeEventTypes;
1933
- (function(RuntimeEventTypes2) {
1934
- RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
1935
- RuntimeEventTypes2["TextMessageContent"] = "TextMessageContent";
1936
- RuntimeEventTypes2["TextMessageEnd"] = "TextMessageEnd";
1937
- RuntimeEventTypes2["ActionExecutionStart"] = "ActionExecutionStart";
1938
- RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
1939
- RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
1940
- RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
1941
- RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
1942
- RuntimeEventTypes2["MetaEvent"] = "MetaEvent";
1943
- RuntimeEventTypes2["RunError"] = "RunError";
1944
- })(RuntimeEventTypes || (RuntimeEventTypes = {}));
1945
- var RuntimeMetaEventName;
1946
- (function(RuntimeMetaEventName2) {
1947
- RuntimeMetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1948
- RuntimeMetaEventName2["LangGraphInterruptResumeEvent"] = "LangGraphInterruptResumeEvent";
1949
- RuntimeMetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
1950
- })(RuntimeMetaEventName || (RuntimeMetaEventName = {}));
1951
-
1952
- // src/graphql/resolvers/copilot.resolver.ts
1953
- var import_graphql_scalars2 = require("graphql-scalars");
1954
- var import_class_transformer2 = require("class-transformer");
1955
- var import_graphql = require("graphql");
1956
-
1957
- // src/utils/failed-response-status-reasons.ts
1958
- var GuardrailsValidationFailureResponse = class extends FailedResponseStatus {
1959
- reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;
1960
- constructor({ guardrailsReason }) {
1961
- super();
1962
- this.details = {
1963
- guardrailsReason
1964
- };
1965
- }
1966
- };
1967
- __name(GuardrailsValidationFailureResponse, "GuardrailsValidationFailureResponse");
1968
- var MessageStreamInterruptedResponse = class extends FailedResponseStatus {
1969
- reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;
1970
- constructor({ messageId }) {
1971
- super();
1972
- this.details = {
1973
- messageId,
1974
- description: "Check the message for mode details"
1975
- };
1976
- }
1977
- };
1978
- __name(MessageStreamInterruptedResponse, "MessageStreamInterruptedResponse");
1979
- var UnknownErrorResponse = class extends FailedResponseStatus {
1980
- reason = FailedResponseStatusReason.UNKNOWN_ERROR;
1981
- constructor({ description, originalError }) {
1982
- super();
1983
- this.details = {
1984
- description,
1985
- originalError
1986
- };
1987
- }
1988
- };
1989
- __name(UnknownErrorResponse, "UnknownErrorResponse");
1990
-
1991
- // src/graphql/resolvers/copilot.resolver.ts
1992
- var import_shared6 = require("@copilotkit/shared");
1993
-
1994
- // src/graphql/types/agents-response.type.ts
1995
- var import_type_graphql20 = require("type-graphql");
1996
- function _ts_decorate19(decorators, target, key, desc) {
1997
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1998
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1999
- r = Reflect.decorate(decorators, target, key, desc);
2000
- else
2001
- for (var i = decorators.length - 1; i >= 0; i--)
2002
- if (d = decorators[i])
2003
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2004
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2005
- }
2006
- __name(_ts_decorate19, "_ts_decorate");
2007
- function _ts_metadata19(k, v) {
2008
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2009
- return Reflect.metadata(k, v);
2010
- }
2011
- __name(_ts_metadata19, "_ts_metadata");
2012
- var Agent = class {
2013
- id;
2014
- name;
2015
- description;
2016
- };
2017
- __name(Agent, "Agent");
2018
- _ts_decorate19([
2019
- (0, import_type_graphql20.Field)(() => String),
2020
- _ts_metadata19("design:type", String)
2021
- ], Agent.prototype, "id", void 0);
2022
- _ts_decorate19([
2023
- (0, import_type_graphql20.Field)(() => String),
2024
- _ts_metadata19("design:type", String)
2025
- ], Agent.prototype, "name", void 0);
2026
- _ts_decorate19([
2027
- (0, import_type_graphql20.Field)(() => String),
2028
- _ts_metadata19("design:type", String)
2029
- ], Agent.prototype, "description", void 0);
2030
- Agent = _ts_decorate19([
2031
- (0, import_type_graphql20.ObjectType)()
2032
- ], Agent);
2033
- var AgentsResponse = class {
2034
- agents;
2035
- };
2036
- __name(AgentsResponse, "AgentsResponse");
2037
- _ts_decorate19([
2038
- (0, import_type_graphql20.Field)(() => [
2039
- Agent
2040
- ]),
2041
- _ts_metadata19("design:type", Array)
2042
- ], AgentsResponse.prototype, "agents", void 0);
2043
- AgentsResponse = _ts_decorate19([
2044
- (0, import_type_graphql20.ObjectType)()
2045
- ], AgentsResponse);
2046
-
2047
- // src/graphql/resolvers/copilot.resolver.ts
2048
- var import_shared7 = require("@copilotkit/shared");
2049
- function _ts_decorate20(decorators, target, key, desc) {
2050
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2051
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2052
- r = Reflect.decorate(decorators, target, key, desc);
2053
- else
2054
- for (var i = decorators.length - 1; i >= 0; i--)
2055
- if (d = decorators[i])
2056
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2057
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2058
- }
2059
- __name(_ts_decorate20, "_ts_decorate");
2060
- function _ts_metadata20(k, v) {
2061
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2062
- return Reflect.metadata(k, v);
2063
- }
2064
- __name(_ts_metadata20, "_ts_metadata");
2065
- function _ts_param(paramIndex, decorator) {
2066
- return function(target, key) {
2067
- decorator(target, key, paramIndex);
2068
- };
2069
- }
2070
- __name(_ts_param, "_ts_param");
2071
- var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
2072
- var _a;
2073
- if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
2074
- const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
2075
- role: m.textMessage.role,
2076
- content: m.textMessage.content
2077
- }));
2078
- const lastMessage = messages[messages.length - 1];
2079
- const restOfMessages = messages.slice(0, -1);
2080
- const body = {
2081
- input: lastMessage.content,
2082
- validTopics: data.cloud.guardrails.inputValidationRules.allowList,
2083
- invalidTopics: data.cloud.guardrails.inputValidationRules.denyList,
2084
- messages: restOfMessages
2085
- };
2086
- const guardrailsResult = await fetch(`${baseUrl}/guardrails/validate`, {
2087
- method: "POST",
2088
- headers: {
2089
- "Content-Type": "application/json",
2090
- "X-CopilotCloud-Public-API-Key": copilotCloudPublicApiKey
2091
- },
2092
- body: JSON.stringify(body)
2093
- });
2094
- if (guardrailsResult.ok) {
2095
- const resultJson = await guardrailsResult.json();
2096
- onResult(resultJson);
2097
- } else {
2098
- onError(await guardrailsResult.json());
2099
- }
2100
- }
2101
- }, "invokeGuardrails");
2102
- var CopilotResolver = class {
2103
- async hello() {
2104
- return "Hello World";
2105
- }
2106
- async availableAgents(ctx) {
2107
- let logger2 = ctx.logger.child({
2108
- component: "CopilotResolver.availableAgents"
2109
- });
2110
- logger2.debug("Processing");
2111
- const agentsWithEndpoints = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
2112
- logger2.debug("Event source created, creating response");
2113
- return {
2114
- agents: agentsWithEndpoints.map(({ endpoint, ...agentWithoutEndpoint }) => agentWithoutEndpoint)
2115
- };
2116
- }
2117
- async generateCopilotResponse(ctx, data, properties) {
2118
- var _a, _b, _c, _d, _e, _f, _g;
2119
- telemetry_client_default.capture("oss.runtime.copilot_request_created", {
2120
- "cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
2121
- requestType: data.metadata.requestType,
2122
- "cloud.api_key_provided": !!ctx.request.headers.get("x-copilotcloud-public-api-key"),
2123
- ...ctx.request.headers.get("x-copilotcloud-public-api-key") ? {
2124
- "cloud.public_api_key": ctx.request.headers.get("x-copilotcloud-public-api-key")
2125
- } : {},
2126
- ...ctx._copilotkit.baseUrl ? {
2127
- "cloud.base_url": ctx._copilotkit.baseUrl
2128
- } : {
2129
- "cloud.base_url": "https://api.cloud.copilotkit.ai"
2130
- }
2131
- });
2132
- let logger2 = ctx.logger.child({
2133
- component: "CopilotResolver.generateCopilotResponse"
2134
- });
2135
- logger2.debug({
2136
- data
2137
- }, "Generating Copilot response");
2138
- if (properties) {
2139
- logger2.debug("Properties provided, merging with context properties");
2140
- ctx.properties = {
2141
- ...ctx.properties,
2142
- ...properties
2143
- };
2144
- }
2145
- const copilotRuntime = ctx._copilotkit.runtime;
2146
- const serviceAdapter = ctx._copilotkit.serviceAdapter;
2147
- let copilotCloudPublicApiKey = null;
2148
- let copilotCloudBaseUrl;
2149
- const publicApiKeyFromHeaders = ctx.request.headers.get("x-copilotcloud-public-api-key");
2150
- if (publicApiKeyFromHeaders) {
2151
- copilotCloudPublicApiKey = publicApiKeyFromHeaders;
2152
- }
2153
- if (data.cloud) {
2154
- logger2 = logger2.child({
2155
- cloud: true
2156
- });
2157
- logger2.debug("Cloud configuration provided, checking for public API key in headers");
2158
- if (!copilotCloudPublicApiKey) {
2159
- logger2.error("Public API key not found in headers");
2160
- await copilotRuntime.errorGraphQLError({
2161
- message: "X-CopilotCloud-Public-API-Key header is required",
2162
- code: "MISSING_PUBLIC_API_KEY",
2163
- type: "GraphQLError"
2164
- }, {
2165
- operation: "generateCopilotResponse",
2166
- cloudConfigPresent: Boolean(data.cloud),
2167
- guardrailsEnabled: Boolean((_b = data.cloud) == null ? void 0 : _b.guardrails)
2168
- });
2169
- throw new import_graphql.GraphQLError("X-CopilotCloud-Public-API-Key header is required");
2170
- }
2171
- if (process.env.COPILOT_CLOUD_BASE_URL) {
2172
- copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
2173
- } else if ((_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl) {
2174
- copilotCloudBaseUrl = (_d = ctx._copilotkit.cloud) == null ? void 0 : _d.baseUrl;
2175
- } else {
2176
- copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
2177
- }
2178
- logger2 = logger2.child({
2179
- copilotCloudBaseUrl
2180
- });
2181
- }
2182
- logger2.debug("Setting up subjects");
2183
- const responseStatus$ = new import_rxjs3.ReplaySubject();
2184
- const interruptStreaming$ = new import_rxjs3.ReplaySubject();
2185
- const guardrailsResult$ = new import_rxjs3.ReplaySubject();
2186
- let outputMessages = [];
2187
- let resolveOutputMessagesPromise;
2188
- let rejectOutputMessagesPromise;
2189
- const outputMessagesPromise = new Promise((resolve, reject) => {
2190
- resolveOutputMessagesPromise = resolve;
2191
- rejectOutputMessagesPromise = reject;
2192
- });
2193
- if (copilotCloudPublicApiKey) {
2194
- ctx.properties["copilotCloudPublicApiKey"] = copilotCloudPublicApiKey;
2195
- }
2196
- logger2.debug("Processing");
2197
- let runtimeResponse;
2198
- try {
2199
- runtimeResponse = await copilotRuntime.processRuntimeRequest({
2200
- serviceAdapter,
2201
- messages: data.messages,
2202
- actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
2203
- threadId: data.threadId,
2204
- runId: data.runId,
2205
- publicApiKey: copilotCloudPublicApiKey,
2206
- outputMessagesPromise,
2207
- graphqlContext: ctx,
2208
- forwardedParameters: data.forwardedParameters,
2209
- agentSession: data.agentSession,
2210
- agentStates: data.agentStates,
2211
- url: data.frontend.url,
2212
- extensions: data.extensions,
2213
- metaEvents: data.metaEvents,
2214
- context: data.context
2215
- });
2216
- } catch (error) {
2217
- if ((0, import_shared7.isStructuredCopilotKitError)(error) || ((_e = error == null ? void 0 : error.extensions) == null ? void 0 : _e.visibility)) {
2218
- throw new import_graphql.GraphQLError(error.message || "Agent error occurred", {
2219
- extensions: {
2220
- ...error.extensions,
2221
- code: error.code || ((_f = error.extensions) == null ? void 0 : _f.code) || "AGENT_ERROR",
2222
- originalError: error
2223
- }
2224
- });
2225
- }
2226
- throw error;
2227
- }
2228
- const { eventSource, threadId = (0, import_shared6.randomId)(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = runtimeResponse;
2229
- logger2.debug("Event source created, creating response");
2230
- const eventStream = eventSource.processRuntimeEvents({
2231
- serverSideActions,
2232
- guardrailsResult$: ((_g = data.cloud) == null ? void 0 : _g.guardrails) ? guardrailsResult$ : null,
2233
- actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
2234
- // TODO-AGENTS: do not exclude ALL server side actions
2235
- (action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
2236
- ),
2237
- threadId
2238
- }).pipe(
2239
- // shareReplay() ensures that later subscribers will see the whole stream instead of
2240
- // just the events that were emitted after the subscriber was added.
2241
- (0, import_rxjs3.shareReplay)(),
2242
- (0, import_rxjs3.finalize)(() => {
2243
- logger2.debug("Event stream finalized");
2244
- })
2245
- );
2246
- const response = {
2247
- threadId,
2248
- runId,
2249
- status: (0, import_rxjs3.firstValueFrom)(responseStatus$),
2250
- extensions,
2251
- metaEvents: new import_graphql_yoga.Repeater(async (push, stop) => {
2252
- let eventStreamSubscription;
2253
- eventStreamSubscription = eventStream.subscribe({
2254
- next: async (event) => {
2255
- if (event.type != RuntimeEventTypes.MetaEvent) {
2256
- return;
2257
- }
2258
- switch (event.name) {
2259
- case LangGraphEventTypes.OnInterrupt:
2260
- push((0, import_class_transformer2.plainToInstance)(LangGraphInterruptEvent, {
2261
- // @ts-ignore
2262
- type: event.type,
2263
- // @ts-ignore
2264
- name: RuntimeMetaEventName.LangGraphInterruptEvent,
2265
- // @ts-ignore
2266
- value: event.value
2267
- }));
2268
- break;
2269
- case RuntimeMetaEventName.LangGraphInterruptEvent:
2270
- push((0, import_class_transformer2.plainToInstance)(LangGraphInterruptEvent, {
2271
- type: event.type,
2272
- name: event.name,
2273
- value: event.value
2274
- }));
2275
- break;
2276
- case RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent:
2277
- push((0, import_class_transformer2.plainToInstance)(CopilotKitLangGraphInterruptEvent, {
2278
- type: event.type,
2279
- name: event.name,
2280
- data: {
2281
- value: event.data.value,
2282
- messages: event.data.messages.map((message) => {
2283
- if (message.type === "TextMessage" || "content" in message && "role" in message) {
2284
- return (0, import_class_transformer2.plainToInstance)(TextMessage, {
2285
- id: message.id,
2286
- createdAt: /* @__PURE__ */ new Date(),
2287
- content: [
2288
- message.content
2289
- ],
2290
- role: message.role,
2291
- status: new SuccessMessageStatus()
2292
- });
2293
- }
2294
- if ("arguments" in message) {
2295
- return (0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
2296
- name: message.name,
2297
- id: message.id,
2298
- arguments: [
2299
- JSON.stringify(message.arguments)
2300
- ],
2301
- createdAt: /* @__PURE__ */ new Date(),
2302
- status: new SuccessMessageStatus()
2303
- });
2304
- }
2305
- throw new Error("Unknown message in metaEvents copilot resolver");
2306
- })
2307
- }
2308
- }));
2309
- break;
2310
- }
2311
- },
2312
- error: (err) => {
2313
- var _a2, _b2;
2314
- if (((_a2 = err == null ? void 0 : err.name) == null ? void 0 : _a2.includes("CopilotKit")) || ((_b2 = err == null ? void 0 : err.extensions) == null ? void 0 : _b2.visibility)) {
2315
- responseStatus$.next(new UnknownErrorResponse({
2316
- description: err.message || "Agent error occurred"
2317
- }));
2318
- } else {
2319
- responseStatus$.next(new UnknownErrorResponse({
2320
- description: `An unknown error has occurred in the event stream`
2321
- }));
2322
- }
2323
- eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2324
- stop();
2325
- },
2326
- complete: async () => {
2327
- logger2.debug("Meta events stream completed");
2328
- responseStatus$.next(new SuccessResponseStatus());
2329
- eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2330
- stop();
2331
- }
2332
- });
2333
- }),
2334
- messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
2335
- var _a2;
2336
- logger2.debug("Messages repeater created");
2337
- if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
2338
- logger2 = logger2.child({
2339
- guardrails: true
2340
- });
2341
- logger2.debug("Guardrails is enabled, validating input");
2342
- invokeGuardrails({
2343
- baseUrl: copilotCloudBaseUrl,
2344
- copilotCloudPublicApiKey,
2345
- data,
2346
- onResult: (result) => {
2347
- logger2.debug({
2348
- status: result.status
2349
- }, "Guardrails validation done");
2350
- guardrailsResult$.next(result);
2351
- if (result.status === "denied") {
2352
- responseStatus$.next(new GuardrailsValidationFailureResponse({
2353
- guardrailsReason: result.reason
2354
- }));
2355
- interruptStreaming$.next({
2356
- reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
2357
- });
2358
- outputMessages = [
2359
- (0, import_class_transformer2.plainToInstance)(TextMessage, {
2360
- id: (0, import_shared6.randomId)(),
2361
- createdAt: /* @__PURE__ */ new Date(),
2362
- content: result.reason,
2363
- role: MessageRole.assistant
2364
- })
2365
- ];
2366
- resolveOutputMessagesPromise(outputMessages);
2367
- }
2368
- },
2369
- onError: (err) => {
2370
- logger2.error({
2371
- err
2372
- }, "Error in guardrails validation");
2373
- responseStatus$.next(new UnknownErrorResponse({
2374
- description: `An unknown error has occurred in the guardrails validation`
2375
- }));
2376
- interruptStreaming$.next({
2377
- reason: `Interrupted due to unknown error in guardrails validation`
2378
- });
2379
- rejectOutputMessagesPromise(err);
2380
- }
2381
- });
2382
- }
2383
- let eventStreamSubscription;
2384
- logger2.debug("Event stream created, subscribing to event stream");
2385
- eventStreamSubscription = eventStream.subscribe({
2386
- next: async (event) => {
2387
- switch (event.type) {
2388
- case RuntimeEventTypes.MetaEvent:
2389
- break;
2390
- case RuntimeEventTypes.TextMessageStart:
2391
- const textMessageContentStream = eventStream.pipe(
2392
- // skip until this message start event
2393
- (0, import_rxjs3.skipWhile)((e) => e !== event),
2394
- // take until the message end event
2395
- (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
2396
- // filter out any other message events or message ids
2397
- (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
2398
- );
2399
- const streamingTextStatus = new import_rxjs3.Subject();
2400
- const messageId = event.messageId;
2401
- pushMessage({
2402
- id: messageId,
2403
- parentMessageId: event.parentMessageId,
2404
- status: (0, import_rxjs3.firstValueFrom)(streamingTextStatus),
2405
- createdAt: /* @__PURE__ */ new Date(),
2406
- role: MessageRole.assistant,
2407
- content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
2408
- logger2.debug("Text message content repeater created");
2409
- const textChunks = [];
2410
- let textSubscription;
2411
- interruptStreaming$.pipe((0, import_rxjs3.shareReplay)(), (0, import_rxjs3.take)(1), (0, import_rxjs3.tap)(({ reason, messageId: messageId2 }) => {
2412
- logger2.debug({
2413
- reason,
2414
- messageId: messageId2
2415
- }, "Text streaming interrupted");
2416
- streamingTextStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
2417
- reason
2418
- }));
2419
- responseStatus$.next(new MessageStreamInterruptedResponse({
2420
- messageId: messageId2
2421
- }));
2422
- stopStreamingText();
2423
- textSubscription == null ? void 0 : textSubscription.unsubscribe();
2424
- })).subscribe();
2425
- logger2.debug("Subscribing to text message content stream");
2426
- textSubscription = textMessageContentStream.subscribe({
2427
- next: async (e) => {
2428
- if (e.type == RuntimeEventTypes.TextMessageContent) {
2429
- await pushTextChunk(e.content);
2430
- textChunks.push(e.content);
2431
- }
2432
- },
2433
- error: (err) => {
2434
- logger2.error({
2435
- err
2436
- }, "Error in text message content stream");
2437
- interruptStreaming$.next({
2438
- reason: "Error streaming message content",
2439
- messageId
2440
- });
2441
- stopStreamingText();
2442
- textSubscription == null ? void 0 : textSubscription.unsubscribe();
2443
- },
2444
- complete: () => {
2445
- logger2.debug("Text message content stream completed");
2446
- streamingTextStatus.next(new SuccessMessageStatus());
2447
- stopStreamingText();
2448
- textSubscription == null ? void 0 : textSubscription.unsubscribe();
2449
- outputMessages.push((0, import_class_transformer2.plainToInstance)(TextMessage, {
2450
- id: messageId,
2451
- createdAt: /* @__PURE__ */ new Date(),
2452
- content: textChunks.join(""),
2453
- role: MessageRole.assistant
2454
- }));
2455
- }
2456
- });
2457
- })
2458
- });
2459
- break;
2460
- case RuntimeEventTypes.ActionExecutionStart:
2461
- logger2.debug("Action execution start event received");
2462
- const actionExecutionArgumentStream = eventStream.pipe(
2463
- (0, import_rxjs3.skipWhile)((e) => e !== event),
2464
- // take until the action execution end event
2465
- (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
2466
- // filter out any other action execution events or action execution ids
2467
- (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
2468
- );
2469
- const streamingArgumentsStatus = new import_rxjs3.Subject();
2470
- pushMessage({
2471
- id: event.actionExecutionId,
2472
- parentMessageId: event.parentMessageId,
2473
- status: (0, import_rxjs3.firstValueFrom)(streamingArgumentsStatus),
2474
- createdAt: /* @__PURE__ */ new Date(),
2475
- name: event.actionName,
2476
- arguments: new import_graphql_yoga.Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
2477
- logger2.debug("Action execution argument stream created");
2478
- const argumentChunks = [];
2479
- let actionExecutionArgumentSubscription;
2480
- actionExecutionArgumentSubscription = actionExecutionArgumentStream.subscribe({
2481
- next: async (e) => {
2482
- if (e.type == RuntimeEventTypes.ActionExecutionArgs) {
2483
- await pushArgumentsChunk(e.args);
2484
- argumentChunks.push(e.args);
2485
- }
2486
- },
2487
- error: (err) => {
2488
- logger2.error({
2489
- err
2490
- }, "Error in action execution argument stream");
2491
- streamingArgumentsStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
2492
- reason: "An unknown error has occurred in the action execution argument stream"
2493
- }));
2494
- stopStreamingArguments();
2495
- actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
2496
- },
2497
- complete: () => {
2498
- logger2.debug("Action execution argument stream completed");
2499
- streamingArgumentsStatus.next(new SuccessMessageStatus());
2500
- stopStreamingArguments();
2501
- actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
2502
- outputMessages.push((0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
2503
- id: event.actionExecutionId,
2504
- createdAt: /* @__PURE__ */ new Date(),
2505
- name: event.actionName,
2506
- arguments: argumentChunks.join("")
2507
- }));
2508
- }
2509
- });
2510
- })
2511
- });
2512
- break;
2513
- case RuntimeEventTypes.ActionExecutionResult:
2514
- logger2.debug({
2515
- result: event.result
2516
- }, "Action execution result event received");
2517
- pushMessage({
2518
- id: "result-" + event.actionExecutionId,
2519
- status: new SuccessMessageStatus(),
2520
- createdAt: /* @__PURE__ */ new Date(),
2521
- actionExecutionId: event.actionExecutionId,
2522
- actionName: event.actionName,
2523
- result: event.result
2524
- });
2525
- outputMessages.push((0, import_class_transformer2.plainToInstance)(ResultMessage, {
2526
- id: "result-" + event.actionExecutionId,
2527
- createdAt: /* @__PURE__ */ new Date(),
2528
- actionExecutionId: event.actionExecutionId,
2529
- actionName: event.actionName,
2530
- result: event.result
2531
- }));
2532
- break;
2533
- case RuntimeEventTypes.AgentStateMessage:
2534
- logger2.debug({
2535
- event
2536
- }, "Agent message event received");
2537
- pushMessage({
2538
- id: (0, import_shared6.randomId)(),
2539
- status: new SuccessMessageStatus(),
2540
- threadId: event.threadId,
2541
- agentName: event.agentName,
2542
- nodeName: event.nodeName,
2543
- runId: event.runId,
2544
- active: event.active,
2545
- state: event.state,
2546
- running: event.running,
2547
- role: MessageRole.assistant,
2548
- createdAt: /* @__PURE__ */ new Date()
2549
- });
2550
- outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
2551
- id: (0, import_shared6.randomId)(),
2552
- threadId: event.threadId,
2553
- agentName: event.agentName,
2554
- nodeName: event.nodeName,
2555
- runId: event.runId,
2556
- active: event.active,
2557
- state: event.state,
2558
- running: event.running,
2559
- role: MessageRole.assistant,
2560
- createdAt: /* @__PURE__ */ new Date()
2561
- }));
2562
- break;
2563
- }
2564
- },
2565
- error: (err) => {
2566
- var _a3, _b2, _c2, _d2, _e2, _f2;
2567
- if (err instanceof import_shared7.CopilotKitError || err instanceof import_shared7.CopilotKitLowLevelError || err instanceof Error && err.name && err.name.includes("CopilotKit") || ((_a3 = err == null ? void 0 : err.extensions) == null ? void 0 : _a3.visibility)) {
2568
- responseStatus$.next(new UnknownErrorResponse({
2569
- description: err.message || "Agent error occurred",
2570
- // Include original error information for frontend to extract
2571
- originalError: {
2572
- code: err.code || ((_b2 = err.extensions) == null ? void 0 : _b2.code),
2573
- statusCode: err.statusCode || ((_c2 = err.extensions) == null ? void 0 : _c2.statusCode),
2574
- severity: err.severity || ((_d2 = err.extensions) == null ? void 0 : _d2.severity),
2575
- visibility: err.visibility || ((_e2 = err.extensions) == null ? void 0 : _e2.visibility),
2576
- originalErrorType: err.originalErrorType || ((_f2 = err.extensions) == null ? void 0 : _f2.originalErrorType),
2577
- extensions: err.extensions
2578
- }
2579
- }));
2580
- eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2581
- rejectOutputMessagesPromise(err);
2582
- stopStreamingMessages();
2583
- return;
2584
- }
2585
- responseStatus$.next(new UnknownErrorResponse({
2586
- description: `An unknown error has occurred in the event stream`
2587
- }));
2588
- eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2589
- stopStreamingMessages();
2590
- rejectOutputMessagesPromise(err);
2591
- },
2592
- complete: async () => {
2593
- var _a3;
2594
- logger2.debug("Event stream completed");
2595
- if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
2596
- logger2.debug("Guardrails is enabled, waiting for guardrails result");
2597
- await (0, import_rxjs3.firstValueFrom)(guardrailsResult$);
2598
- }
2599
- responseStatus$.next(new SuccessResponseStatus());
2600
- eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2601
- stopStreamingMessages();
2602
- resolveOutputMessagesPromise(outputMessages);
2603
- }
2604
- });
2605
- })
2606
- };
2607
- return response;
2608
- }
2609
- };
2610
- __name(CopilotResolver, "CopilotResolver");
2611
- _ts_decorate20([
2612
- (0, import_type_graphql21.Query)(() => String),
2613
- _ts_metadata20("design:type", Function),
2614
- _ts_metadata20("design:paramtypes", []),
2615
- _ts_metadata20("design:returntype", Promise)
2616
- ], CopilotResolver.prototype, "hello", null);
2617
- _ts_decorate20([
2618
- (0, import_type_graphql21.Query)(() => AgentsResponse),
2619
- _ts_param(0, (0, import_type_graphql21.Ctx)()),
2620
- _ts_metadata20("design:type", Function),
2621
- _ts_metadata20("design:paramtypes", [
2622
- typeof GraphQLContext === "undefined" ? Object : GraphQLContext
2623
- ]),
2624
- _ts_metadata20("design:returntype", Promise)
2625
- ], CopilotResolver.prototype, "availableAgents", null);
2626
- _ts_decorate20([
2627
- (0, import_type_graphql21.Mutation)(() => CopilotResponse),
2628
- _ts_param(0, (0, import_type_graphql21.Ctx)()),
2629
- _ts_param(1, (0, import_type_graphql21.Arg)("data")),
2630
- _ts_param(2, (0, import_type_graphql21.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
2631
- nullable: true
2632
- })),
2633
- _ts_metadata20("design:type", Function),
2634
- _ts_metadata20("design:paramtypes", [
2635
- typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
2636
- typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
2637
- typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
2638
- ]),
2639
- _ts_metadata20("design:returntype", Promise)
2640
- ], CopilotResolver.prototype, "generateCopilotResponse", null);
2641
- CopilotResolver = _ts_decorate20([
2642
- (0, import_type_graphql21.Resolver)(() => CopilotResponse)
2643
- ], CopilotResolver);
2644
-
2645
- // src/lib/integrations/shared.ts
2646
- var import_plugin_defer_stream = require("@graphql-yoga/plugin-defer-stream");
2647
-
2648
- // src/lib/logger.ts
2649
- var import_pino = __toESM(require("pino"));
2650
- var import_pino_pretty = __toESM(require("pino-pretty"));
2651
- function createLogger(options) {
2652
- const { level, component } = options || {};
2653
- const stream = (0, import_pino_pretty.default)({
2654
- colorize: true
2655
- });
2656
- const logger2 = (0, import_pino.default)({
2657
- level: process.env.LOG_LEVEL || level || "error",
2658
- redact: {
2659
- paths: [
2660
- "pid",
2661
- "hostname"
2662
- ],
2663
- remove: true
2664
- }
2665
- }, stream);
2666
- if (component) {
2667
- return logger2.child({
2668
- component
2669
- });
2670
- } else {
2671
- return logger2;
2672
- }
2673
- }
2674
- __name(createLogger, "createLogger");
2675
-
2676
- // src/graphql/resolvers/state.resolver.ts
2677
- var import_type_graphql24 = require("type-graphql");
2678
- var import_type_graphql25 = require("type-graphql");
2679
- var import_type_graphql26 = require("type-graphql");
2680
-
2681
- // src/graphql/types/load-agent-state-response.type.ts
2682
- var import_type_graphql22 = require("type-graphql");
2683
- function _ts_decorate21(decorators, target, key, desc) {
2684
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2685
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2686
- r = Reflect.decorate(decorators, target, key, desc);
2687
- else
2688
- for (var i = decorators.length - 1; i >= 0; i--)
2689
- if (d = decorators[i])
2690
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2691
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2692
- }
2693
- __name(_ts_decorate21, "_ts_decorate");
2694
- function _ts_metadata21(k, v) {
2695
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2696
- return Reflect.metadata(k, v);
2697
- }
2698
- __name(_ts_metadata21, "_ts_metadata");
2699
- var LoadAgentStateResponse = class {
2700
- threadId;
2701
- threadExists;
2702
- state;
2703
- messages;
2704
- };
2705
- __name(LoadAgentStateResponse, "LoadAgentStateResponse");
2706
- _ts_decorate21([
2707
- (0, import_type_graphql22.Field)(() => String),
2708
- _ts_metadata21("design:type", String)
2709
- ], LoadAgentStateResponse.prototype, "threadId", void 0);
2710
- _ts_decorate21([
2711
- (0, import_type_graphql22.Field)(() => Boolean),
2712
- _ts_metadata21("design:type", Boolean)
2713
- ], LoadAgentStateResponse.prototype, "threadExists", void 0);
2714
- _ts_decorate21([
2715
- (0, import_type_graphql22.Field)(() => String),
2716
- _ts_metadata21("design:type", String)
2717
- ], LoadAgentStateResponse.prototype, "state", void 0);
2718
- _ts_decorate21([
2719
- (0, import_type_graphql22.Field)(() => String),
2720
- _ts_metadata21("design:type", String)
2721
- ], LoadAgentStateResponse.prototype, "messages", void 0);
2722
- LoadAgentStateResponse = _ts_decorate21([
2723
- (0, import_type_graphql22.ObjectType)()
2724
- ], LoadAgentStateResponse);
2725
-
2726
- // src/graphql/inputs/load-agent-state.input.ts
2727
- var import_type_graphql23 = require("type-graphql");
2728
- function _ts_decorate22(decorators, target, key, desc) {
2729
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2730
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2731
- r = Reflect.decorate(decorators, target, key, desc);
2732
- else
2733
- for (var i = decorators.length - 1; i >= 0; i--)
2734
- if (d = decorators[i])
2735
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2736
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2737
- }
2738
- __name(_ts_decorate22, "_ts_decorate");
2739
- function _ts_metadata22(k, v) {
2740
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2741
- return Reflect.metadata(k, v);
2742
- }
2743
- __name(_ts_metadata22, "_ts_metadata");
2744
- var LoadAgentStateInput = class {
2745
- threadId;
2746
- agentName;
2747
- };
2748
- __name(LoadAgentStateInput, "LoadAgentStateInput");
2749
- _ts_decorate22([
2750
- (0, import_type_graphql23.Field)(() => String),
2751
- _ts_metadata22("design:type", String)
2752
- ], LoadAgentStateInput.prototype, "threadId", void 0);
2753
- _ts_decorate22([
2754
- (0, import_type_graphql23.Field)(() => String),
2755
- _ts_metadata22("design:type", String)
2756
- ], LoadAgentStateInput.prototype, "agentName", void 0);
2757
- LoadAgentStateInput = _ts_decorate22([
2758
- (0, import_type_graphql23.InputType)()
2759
- ], LoadAgentStateInput);
2760
-
2761
- // src/graphql/resolvers/state.resolver.ts
2762
- var import_shared8 = require("@copilotkit/shared");
2763
- function _ts_decorate23(decorators, target, key, desc) {
2764
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2765
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2766
- r = Reflect.decorate(decorators, target, key, desc);
2767
- else
2768
- for (var i = decorators.length - 1; i >= 0; i--)
2769
- if (d = decorators[i])
2770
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2771
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2772
- }
2773
- __name(_ts_decorate23, "_ts_decorate");
2774
- function _ts_metadata23(k, v) {
2775
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2776
- return Reflect.metadata(k, v);
2777
- }
2778
- __name(_ts_metadata23, "_ts_metadata");
2779
- function _ts_param2(paramIndex, decorator) {
2780
- return function(target, key) {
2781
- decorator(target, key, paramIndex);
2782
- };
2783
- }
2784
- __name(_ts_param2, "_ts_param");
2785
- var StateResolver = class {
2786
- async loadAgentState(ctx, data) {
2787
- const agents = await ctx._copilotkit.runtime.getAllAgents(ctx);
2788
- const hasAgent = agents.some((agent) => agent.name === data.agentName);
2789
- if (!hasAgent) {
2790
- throw new import_shared8.CopilotKitAgentDiscoveryError({
2791
- agentName: data.agentName,
2792
- availableAgents: agents.map((a) => ({
2793
- name: a.name,
2794
- id: a.name
2795
- }))
2796
- });
2797
- }
2798
- const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
2799
- return state;
2800
- }
2801
- };
2802
- __name(StateResolver, "StateResolver");
2803
- _ts_decorate23([
2804
- (0, import_type_graphql26.Query)(() => LoadAgentStateResponse),
2805
- _ts_param2(0, (0, import_type_graphql25.Ctx)()),
2806
- _ts_param2(1, (0, import_type_graphql24.Arg)("data")),
2807
- _ts_metadata23("design:type", Function),
2808
- _ts_metadata23("design:paramtypes", [
2809
- typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
2810
- typeof LoadAgentStateInput === "undefined" ? Object : LoadAgentStateInput
2811
- ]),
2812
- _ts_metadata23("design:returntype", Promise)
2813
- ], StateResolver.prototype, "loadAgentState", null);
2814
- StateResolver = _ts_decorate23([
2815
- (0, import_type_graphql24.Resolver)(() => LoadAgentStateResponse)
2816
- ], StateResolver);
2817
-
2818
- // src/lib/integrations/shared.ts
2819
- var packageJson2 = __toESM(require_package());
2820
- var import_shared9 = require("@copilotkit/shared");
2821
- var logger = createLogger();
2822
- var addCustomHeaderPlugin = {
2823
- onResponse({ response }) {
2824
- response.headers.set("X-CopilotKit-Runtime-Version", packageJson2.version);
2825
- }
2826
- };
2827
- async function createContext(initialContext, copilotKitContext, contextLogger, properties = {}) {
2828
- logger.debug({
2829
- copilotKitContext
2830
- }, "Creating GraphQL context");
2831
- const ctx = {
2832
- ...initialContext,
2833
- _copilotkit: {
2834
- ...copilotKitContext
2835
- },
2836
- properties: {
2837
- ...properties
2838
- },
2839
- logger: contextLogger
2840
- };
2841
- return ctx;
2842
- }
2843
- __name(createContext, "createContext");
2844
- function buildSchema(options = {}) {
2845
- logger.debug("Building GraphQL schema...");
2846
- const schema = (0, import_type_graphql27.buildSchemaSync)({
2847
- resolvers: [
2848
- CopilotResolver,
2849
- StateResolver
2850
- ],
2851
- emitSchemaFile: options.emitSchemaFile
2852
- });
2853
- logger.debug("GraphQL schema built successfully");
2854
- return schema;
2855
- }
2856
- __name(buildSchema, "buildSchema");
2857
- function getCommonConfig(options) {
2858
- var _a;
2859
- const logLevel = process.env.LOG_LEVEL || options.logLevel || "error";
2860
- const logger2 = createLogger({
2861
- level: logLevel,
2862
- component: "getCommonConfig"
2863
- });
2864
- const contextLogger = createLogger({
2865
- level: logLevel
2866
- });
2867
- if (options.cloud) {
2868
- telemetry_client_default.setCloudConfiguration({
2869
- publicApiKey: options.cloud.publicApiKey,
2870
- baseUrl: options.cloud.baseUrl
2871
- });
2872
- }
2873
- if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2874
- telemetry_client_default.setGlobalProperties({
2875
- _copilotkit: {
2876
- ...options.properties._copilotkit
2877
- }
2878
- });
2879
- }
2880
- telemetry_client_default.setGlobalProperties({
2881
- runtime: {
2882
- serviceAdapter: options.serviceAdapter.constructor.name
2883
- }
2884
- });
2885
- const userErrorCodes = [
2886
- import_shared9.CopilotKitErrorCode.AGENT_NOT_FOUND,
2887
- import_shared9.CopilotKitErrorCode.API_NOT_FOUND,
2888
- import_shared9.CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND,
2889
- import_shared9.CopilotKitErrorCode.CONFIGURATION_ERROR,
2890
- import_shared9.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR
2891
- ];
2892
- return {
2893
- logging: createLogger({
2894
- component: "Yoga GraphQL",
2895
- level: logLevel
2896
- }),
2897
- schema: buildSchema(),
2898
- plugins: [
2899
- (0, import_plugin_defer_stream.useDeferStream)(),
2900
- addCustomHeaderPlugin
2901
- ],
2902
- context: (ctx) => createContext(ctx, options, contextLogger, options.properties),
2903
- // Suppress logging for user configuration errors
2904
- maskedErrors: {
2905
- maskError: (error, message, isDev) => {
2906
- const originalError = error.originalError || error;
2907
- const extensions = error.extensions;
2908
- const errorCode = extensions == null ? void 0 : extensions.code;
2909
- if (errorCode && userErrorCodes.includes(errorCode)) {
2910
- console.debug("User configuration error:", error.message);
2911
- return error;
2912
- }
2913
- if (originalError instanceof import_shared9.CopilotKitError && userErrorCodes.includes(originalError.code)) {
2914
- console.debug("User configuration error:", error.message);
2915
- return error;
2916
- }
2917
- console.error("Application error:", error);
2918
- return error;
2919
- }
2920
- }
2921
- };
2922
- }
2923
- __name(getCommonConfig, "getCommonConfig");
2924
-
2925
- // src/lib/integrations/nextjs/app-router.ts
2926
- var import_graphql_yoga2 = require("graphql-yoga");
2927
- function copilotRuntimeNextJSAppRouterEndpoint(options) {
2928
- var _a;
2929
- const commonConfig = getCommonConfig(options);
2930
- telemetry_client_default.setGlobalProperties({
2931
- runtime: {
2932
- framework: "nextjs-app-router"
2933
- }
2934
- });
2935
- if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2936
- telemetry_client_default.setGlobalProperties({
2937
- _copilotkit: options.properties._copilotkit
2938
- });
2939
- }
2940
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
2941
- const logger2 = commonConfig.logging;
2942
- logger2.debug("Creating NextJS App Router endpoint");
2943
- const yoga = (0, import_graphql_yoga2.createYoga)({
2944
- ...commonConfig,
2945
- graphqlEndpoint: options.endpoint,
2946
- fetchAPI: {
2947
- Response: globalThis.Response
2948
- }
2949
- });
2950
- return {
2951
- handleRequest: yoga,
2952
- GET: yoga,
2953
- POST: yoga,
2954
- OPTIONS: yoga
2955
- };
2956
- }
2957
- __name(copilotRuntimeNextJSAppRouterEndpoint, "copilotRuntimeNextJSAppRouterEndpoint");
2958
-
2959
- // src/lib/integrations/nextjs/pages-router.ts
2960
- var import_graphql_yoga3 = require("graphql-yoga");
2961
- var config = {
2962
- api: {
2963
- bodyParser: false
2964
- }
2965
- };
2966
- function copilotRuntimeNextJSPagesRouterEndpoint(options) {
2967
- var _a;
2968
- const commonConfig = getCommonConfig(options);
2969
- telemetry_client_default.setGlobalProperties({
2970
- runtime: {
2971
- framework: "nextjs-pages-router"
2972
- }
2973
- });
2974
- if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2975
- telemetry_client_default.setGlobalProperties({
2976
- _copilotkit: options.properties._copilotkit
2977
- });
2978
- }
2979
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
2980
- const logger2 = commonConfig.logging;
2981
- logger2.debug("Creating NextJS Pages Router endpoint");
2982
- const yoga = (0, import_graphql_yoga3.createYoga)({
2983
- ...commonConfig,
2984
- graphqlEndpoint: options.endpoint
2985
- });
2986
- return yoga;
2987
- }
2988
- __name(copilotRuntimeNextJSPagesRouterEndpoint, "copilotRuntimeNextJSPagesRouterEndpoint");
2989
-
2990
- // src/lib/integrations/node-http/index.ts
2991
- var import_graphql_yoga4 = require("graphql-yoga");
2992
- function copilotRuntimeNodeHttpEndpoint(options) {
2993
- var _a;
2994
- const commonConfig = getCommonConfig(options);
2995
- telemetry_client_default.setGlobalProperties({
2996
- runtime: {
2997
- framework: "node-http"
2998
- }
2999
- });
3000
- if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
3001
- telemetry_client_default.setGlobalProperties({
3002
- _copilotkit: options.properties._copilotkit
3003
- });
3004
- }
3005
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
3006
- const logger2 = commonConfig.logging;
3007
- logger2.debug("Creating Node HTTP endpoint");
3008
- const yoga = (0, import_graphql_yoga4.createYoga)({
3009
- ...commonConfig,
3010
- graphqlEndpoint: options.endpoint
3011
- });
3012
- return yoga;
3013
- }
3014
- __name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
3015
-
3016
- // src/lib/integrations/node-express/index.ts
3017
- function copilotRuntimeNodeExpressEndpoint(options) {
3018
- telemetry_client_default.setGlobalProperties({
3019
- runtime: {
3020
- framework: "node-express"
3021
- }
3022
- });
3023
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
3024
- return copilotRuntimeNodeHttpEndpoint(options);
3025
- }
3026
- __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
3027
-
3028
- // src/lib/integrations/nest/index.ts
3029
- function copilotRuntimeNestEndpoint(options) {
3030
- telemetry_client_default.setGlobalProperties({
3031
- runtime: {
3032
- framework: "nest"
3033
- }
3034
- });
3035
- telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
3036
- return copilotRuntimeNodeHttpEndpoint(options);
3037
- }
3038
- __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
3039
- // Annotate the CommonJS export names for ESM import in node:
3040
- 0 && (module.exports = {
3041
- addCustomHeaderPlugin,
3042
- buildSchema,
3043
- config,
3044
- copilotRuntimeNestEndpoint,
3045
- copilotRuntimeNextJSAppRouterEndpoint,
3046
- copilotRuntimeNextJSPagesRouterEndpoint,
3047
- copilotRuntimeNodeExpressEndpoint,
3048
- copilotRuntimeNodeHttpEndpoint,
3049
- createContext,
3050
- getCommonConfig
3051
- });
3052
- //# sourceMappingURL=index.js.map