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