@copilotkit/runtime 1.50.0-beta.8 → 1.50.0

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