@copilotkit/runtime 1.50.0-beta.8 → 1.50.0-beta.9

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