@copilotkit/runtime 1.5.8 → 1.5.10-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/__snapshots__/schema/schema.graphql +273 -0
  3. package/dist/chunk-44O2JGUY.mjs +12 -0
  4. package/dist/chunk-44O2JGUY.mjs.map +1 -0
  5. package/dist/chunk-5SDH2PVU.mjs +3395 -0
  6. package/dist/chunk-5SDH2PVU.mjs.map +1 -0
  7. package/dist/chunk-CLGKEUOA.mjs +1408 -0
  8. package/dist/chunk-CLGKEUOA.mjs.map +1 -0
  9. package/dist/chunk-D2WLFQS6.mjs +43 -0
  10. package/dist/chunk-D2WLFQS6.mjs.map +1 -0
  11. package/dist/chunk-DFOKBSIS.mjs +1 -0
  12. package/dist/chunk-DFOKBSIS.mjs.map +1 -0
  13. package/dist/chunk-OZLXON7T.mjs +25 -0
  14. package/dist/chunk-OZLXON7T.mjs.map +1 -0
  15. package/dist/chunk-RFF5IIZJ.mjs +66 -0
  16. package/dist/chunk-RFF5IIZJ.mjs.map +1 -0
  17. package/dist/chunk-T4EYPND5.mjs +25 -0
  18. package/dist/chunk-T4EYPND5.mjs.map +1 -0
  19. package/dist/chunk-U3V2BCGI.mjs +152 -0
  20. package/dist/chunk-U3V2BCGI.mjs.map +1 -0
  21. package/dist/chunk-YTXDY7ZM.mjs +80 -0
  22. package/dist/chunk-YTXDY7ZM.mjs.map +1 -0
  23. package/dist/copilot-runtime-36700e00.d.ts +196 -0
  24. package/dist/graphql/types/base/index.d.ts +6 -0
  25. package/dist/graphql/types/base/index.js +63 -0
  26. package/dist/graphql/types/base/index.js.map +1 -0
  27. package/dist/graphql/types/base/index.mjs +8 -0
  28. package/dist/graphql/types/base/index.mjs.map +1 -0
  29. package/dist/graphql/types/converted/index.d.ts +2 -0
  30. package/dist/graphql/types/converted/index.js +124 -0
  31. package/dist/graphql/types/converted/index.js.map +1 -0
  32. package/dist/graphql/types/converted/index.mjs +17 -0
  33. package/dist/graphql/types/converted/index.mjs.map +1 -0
  34. package/dist/groq-adapter-696b5d29.d.ts +281 -0
  35. package/dist/index-cc2b17be.d.ts +87 -0
  36. package/dist/index.d.ts +23 -0
  37. package/dist/index.js +5153 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/index.mjs +76 -0
  40. package/dist/index.mjs.map +1 -0
  41. package/dist/langserve-9125a12e.d.ts +176 -0
  42. package/dist/lib/cloud/index.d.ts +6 -0
  43. package/dist/lib/cloud/index.js +18 -0
  44. package/dist/lib/cloud/index.js.map +1 -0
  45. package/dist/lib/cloud/index.mjs +1 -0
  46. package/dist/lib/cloud/index.mjs.map +1 -0
  47. package/dist/lib/index.d.ts +20 -0
  48. package/dist/lib/index.js +4801 -0
  49. package/dist/lib/index.js.map +1 -0
  50. package/dist/lib/index.mjs +58 -0
  51. package/dist/lib/index.mjs.map +1 -0
  52. package/dist/lib/integrations/index.d.ts +33 -0
  53. package/dist/lib/integrations/index.js +2166 -0
  54. package/dist/lib/integrations/index.js.map +1 -0
  55. package/dist/lib/integrations/index.mjs +34 -0
  56. package/dist/lib/integrations/index.mjs.map +1 -0
  57. package/dist/lib/integrations/nest/index.d.ts +14 -0
  58. package/dist/lib/integrations/nest/index.js +2075 -0
  59. package/dist/lib/integrations/nest/index.js.map +1 -0
  60. package/dist/lib/integrations/nest/index.mjs +13 -0
  61. package/dist/lib/integrations/nest/index.mjs.map +1 -0
  62. package/dist/lib/integrations/node-express/index.d.ts +14 -0
  63. package/dist/lib/integrations/node-express/index.js +2075 -0
  64. package/dist/lib/integrations/node-express/index.js.map +1 -0
  65. package/dist/lib/integrations/node-express/index.mjs +13 -0
  66. package/dist/lib/integrations/node-express/index.mjs.map +1 -0
  67. package/dist/lib/integrations/node-http/index.d.ts +14 -0
  68. package/dist/lib/integrations/node-http/index.js +2061 -0
  69. package/dist/lib/integrations/node-http/index.js.map +1 -0
  70. package/dist/lib/integrations/node-http/index.mjs +12 -0
  71. package/dist/lib/integrations/node-http/index.mjs.map +1 -0
  72. package/dist/service-adapters/index.d.ts +84 -0
  73. package/dist/service-adapters/index.js +1448 -0
  74. package/dist/service-adapters/index.js.map +1 -0
  75. package/dist/service-adapters/index.mjs +26 -0
  76. package/dist/service-adapters/index.mjs.map +1 -0
  77. package/dist/utils/index.d.ts +49 -0
  78. package/dist/utils/index.js +174 -0
  79. package/dist/utils/index.js.map +1 -0
  80. package/dist/utils/index.mjs +12 -0
  81. package/dist/utils/index.mjs.map +1 -0
  82. package/package.json +2 -2
@@ -0,0 +1,2075 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from3, except, desc) => {
16
+ if (from3 && typeof from3 === "object" || typeof from3 === "function") {
17
+ for (let key of __getOwnPropNames(from3))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // package.json
34
+ var require_package = __commonJS({
35
+ "package.json"(exports, module2) {
36
+ module2.exports = {
37
+ name: "@copilotkit/runtime",
38
+ private: false,
39
+ homepage: "https://github.com/CopilotKit/CopilotKit",
40
+ repository: {
41
+ type: "git",
42
+ url: "https://github.com/CopilotKit/CopilotKit.git"
43
+ },
44
+ publishConfig: {
45
+ access: "public"
46
+ },
47
+ version: "1.5.10-next.0",
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
+ "@swc/core": "1.5.28",
68
+ "@types/express": "^4.17.21",
69
+ "@types/jest": "^29.5.4",
70
+ "@types/node": "^18.11.17",
71
+ "@whatwg-node/server": "^0.9.34",
72
+ eslint: "^8.56.0",
73
+ "eslint-config-custom": "workspace:*",
74
+ jest: "^29.6.4",
75
+ nodemon: "^3.1.3",
76
+ "ts-jest": "^29.1.1",
77
+ "ts-node": "^10.9.2",
78
+ tsconfig: "workspace:*",
79
+ tsup: "^6.7.0",
80
+ typescript: "^5.2.3",
81
+ "zod-to-json-schema": "^3.23.5"
82
+ },
83
+ dependencies: {
84
+ "@anthropic-ai/sdk": "^0.27.3",
85
+ "@copilotkit/shared": "workspace:*",
86
+ "@graphql-yoga/plugin-defer-stream": "^3.3.1",
87
+ "@langchain/community": "^0.0.53",
88
+ "@langchain/core": "^0.3.13",
89
+ "@langchain/google-gauth": "^0.1.0",
90
+ "@langchain/langgraph-sdk": "^0.0.16",
91
+ "@langchain/openai": "^0.0.28",
92
+ "class-transformer": "^0.5.1",
93
+ express: "^4.19.2",
94
+ graphql: "^16.8.1",
95
+ "graphql-scalars": "^1.23.0",
96
+ "graphql-yoga": "^5.3.1",
97
+ "groq-sdk": "^0.5.0",
98
+ langchain: "^0.3.3",
99
+ openai: "^4.50.0",
100
+ "partial-json": "^0.1.7",
101
+ pino: "^9.2.0",
102
+ "pino-pretty": "^11.2.1",
103
+ "reflect-metadata": "^0.2.2",
104
+ rxjs: "^7.8.1",
105
+ "type-graphql": "2.0.0-rc.1",
106
+ zod: "^3.23.3"
107
+ },
108
+ keywords: [
109
+ "copilotkit",
110
+ "copilot",
111
+ "react",
112
+ "nextjs",
113
+ "nodejs",
114
+ "ai",
115
+ "assistant",
116
+ "javascript",
117
+ "automation",
118
+ "textarea"
119
+ ]
120
+ };
121
+ }
122
+ });
123
+
124
+ // src/lib/integrations/node-express/index.ts
125
+ var node_express_exports = {};
126
+ __export(node_express_exports, {
127
+ copilotRuntimeNodeExpressEndpoint: () => copilotRuntimeNodeExpressEndpoint
128
+ });
129
+ module.exports = __toCommonJS(node_express_exports);
130
+
131
+ // src/lib/integrations/node-http/index.ts
132
+ var import_graphql_yoga2 = require("graphql-yoga");
133
+
134
+ // src/lib/integrations/shared.ts
135
+ var import_type_graphql17 = require("type-graphql");
136
+
137
+ // src/graphql/resolvers/copilot.resolver.ts
138
+ var import_type_graphql16 = require("type-graphql");
139
+ var import_rxjs3 = require("rxjs");
140
+
141
+ // src/graphql/inputs/generate-copilot-response.input.ts
142
+ var import_type_graphql11 = require("type-graphql");
143
+
144
+ // src/graphql/inputs/message.input.ts
145
+ var import_type_graphql3 = require("type-graphql");
146
+
147
+ // src/graphql/types/enums.ts
148
+ var import_type_graphql = require("type-graphql");
149
+ var MessageRole;
150
+ (function(MessageRole2) {
151
+ MessageRole2["user"] = "user";
152
+ MessageRole2["assistant"] = "assistant";
153
+ MessageRole2["system"] = "system";
154
+ MessageRole2["tool"] = "tool";
155
+ })(MessageRole || (MessageRole = {}));
156
+ var CopilotRequestType;
157
+ (function(CopilotRequestType2) {
158
+ CopilotRequestType2["Chat"] = "Chat";
159
+ CopilotRequestType2["Task"] = "Task";
160
+ CopilotRequestType2["TextareaCompletion"] = "TextareaCompletion";
161
+ CopilotRequestType2["TextareaPopover"] = "TextareaPopover";
162
+ CopilotRequestType2["Suggestion"] = "Suggestion";
163
+ })(CopilotRequestType || (CopilotRequestType = {}));
164
+ var ActionInputAvailability;
165
+ (function(ActionInputAvailability2) {
166
+ ActionInputAvailability2["disabled"] = "disabled";
167
+ ActionInputAvailability2["enabled"] = "enabled";
168
+ ActionInputAvailability2["remote"] = "remote";
169
+ })(ActionInputAvailability || (ActionInputAvailability = {}));
170
+ (0, import_type_graphql.registerEnumType)(MessageRole, {
171
+ name: "MessageRole",
172
+ description: "The role of the message"
173
+ });
174
+ (0, import_type_graphql.registerEnumType)(CopilotRequestType, {
175
+ name: "CopilotRequestType",
176
+ description: "The type of Copilot request"
177
+ });
178
+ (0, import_type_graphql.registerEnumType)(ActionInputAvailability, {
179
+ name: "ActionInputAvailability",
180
+ description: "The availability of the frontend action"
181
+ });
182
+
183
+ // src/graphql/types/base/index.ts
184
+ var import_type_graphql2 = require("type-graphql");
185
+ function _ts_decorate(decorators, target, key, desc) {
186
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
187
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
188
+ r = Reflect.decorate(decorators, target, key, desc);
189
+ else
190
+ for (var i = decorators.length - 1; i >= 0; i--)
191
+ if (d = decorators[i])
192
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
193
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
194
+ }
195
+ __name(_ts_decorate, "_ts_decorate");
196
+ function _ts_metadata(k, v) {
197
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
198
+ return Reflect.metadata(k, v);
199
+ }
200
+ __name(_ts_metadata, "_ts_metadata");
201
+ var BaseMessageInput = class {
202
+ id;
203
+ createdAt;
204
+ };
205
+ __name(BaseMessageInput, "BaseMessageInput");
206
+ _ts_decorate([
207
+ (0, import_type_graphql2.Field)(() => String),
208
+ _ts_metadata("design:type", String)
209
+ ], BaseMessageInput.prototype, "id", void 0);
210
+ _ts_decorate([
211
+ (0, import_type_graphql2.Field)(() => Date),
212
+ _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
213
+ ], BaseMessageInput.prototype, "createdAt", void 0);
214
+ BaseMessageInput = _ts_decorate([
215
+ (0, import_type_graphql2.InputType)()
216
+ ], BaseMessageInput);
217
+
218
+ // src/graphql/inputs/message.input.ts
219
+ function _ts_decorate2(decorators, target, key, desc) {
220
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
221
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
222
+ r = Reflect.decorate(decorators, target, key, desc);
223
+ else
224
+ for (var i = decorators.length - 1; i >= 0; i--)
225
+ if (d = decorators[i])
226
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
227
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
228
+ }
229
+ __name(_ts_decorate2, "_ts_decorate");
230
+ function _ts_metadata2(k, v) {
231
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
232
+ return Reflect.metadata(k, v);
233
+ }
234
+ __name(_ts_metadata2, "_ts_metadata");
235
+ var MessageInput = class extends BaseMessageInput {
236
+ textMessage;
237
+ actionExecutionMessage;
238
+ resultMessage;
239
+ agentStateMessage;
240
+ };
241
+ __name(MessageInput, "MessageInput");
242
+ _ts_decorate2([
243
+ (0, import_type_graphql3.Field)(() => TextMessageInput, {
244
+ nullable: true
245
+ }),
246
+ _ts_metadata2("design:type", typeof TextMessageInput === "undefined" ? Object : TextMessageInput)
247
+ ], MessageInput.prototype, "textMessage", void 0);
248
+ _ts_decorate2([
249
+ (0, import_type_graphql3.Field)(() => ActionExecutionMessageInput, {
250
+ nullable: true
251
+ }),
252
+ _ts_metadata2("design:type", typeof ActionExecutionMessageInput === "undefined" ? Object : ActionExecutionMessageInput)
253
+ ], MessageInput.prototype, "actionExecutionMessage", void 0);
254
+ _ts_decorate2([
255
+ (0, import_type_graphql3.Field)(() => ResultMessageInput, {
256
+ nullable: true
257
+ }),
258
+ _ts_metadata2("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
259
+ ], MessageInput.prototype, "resultMessage", void 0);
260
+ _ts_decorate2([
261
+ (0, import_type_graphql3.Field)(() => AgentStateMessageInput, {
262
+ nullable: true
263
+ }),
264
+ _ts_metadata2("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
265
+ ], MessageInput.prototype, "agentStateMessage", void 0);
266
+ MessageInput = _ts_decorate2([
267
+ (0, import_type_graphql3.InputType)()
268
+ ], MessageInput);
269
+ var TextMessageInput = class {
270
+ content;
271
+ parentMessageId;
272
+ role;
273
+ };
274
+ __name(TextMessageInput, "TextMessageInput");
275
+ _ts_decorate2([
276
+ (0, import_type_graphql3.Field)(() => String),
277
+ _ts_metadata2("design:type", String)
278
+ ], TextMessageInput.prototype, "content", void 0);
279
+ _ts_decorate2([
280
+ (0, import_type_graphql3.Field)(() => String, {
281
+ nullable: true
282
+ }),
283
+ _ts_metadata2("design:type", String)
284
+ ], TextMessageInput.prototype, "parentMessageId", void 0);
285
+ _ts_decorate2([
286
+ (0, import_type_graphql3.Field)(() => MessageRole),
287
+ _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
288
+ ], TextMessageInput.prototype, "role", void 0);
289
+ TextMessageInput = _ts_decorate2([
290
+ (0, import_type_graphql3.InputType)()
291
+ ], TextMessageInput);
292
+ var ActionExecutionMessageInput = class {
293
+ name;
294
+ arguments;
295
+ parentMessageId;
296
+ scope;
297
+ };
298
+ __name(ActionExecutionMessageInput, "ActionExecutionMessageInput");
299
+ _ts_decorate2([
300
+ (0, import_type_graphql3.Field)(() => String),
301
+ _ts_metadata2("design:type", String)
302
+ ], ActionExecutionMessageInput.prototype, "name", void 0);
303
+ _ts_decorate2([
304
+ (0, import_type_graphql3.Field)(() => String),
305
+ _ts_metadata2("design:type", String)
306
+ ], ActionExecutionMessageInput.prototype, "arguments", void 0);
307
+ _ts_decorate2([
308
+ (0, import_type_graphql3.Field)(() => String, {
309
+ nullable: true
310
+ }),
311
+ _ts_metadata2("design:type", String)
312
+ ], ActionExecutionMessageInput.prototype, "parentMessageId", void 0);
313
+ _ts_decorate2([
314
+ (0, import_type_graphql3.Field)(() => String, {
315
+ nullable: true,
316
+ deprecationReason: "This field will be removed in a future version"
317
+ }),
318
+ _ts_metadata2("design:type", typeof String === "undefined" ? Object : String)
319
+ ], ActionExecutionMessageInput.prototype, "scope", void 0);
320
+ ActionExecutionMessageInput = _ts_decorate2([
321
+ (0, import_type_graphql3.InputType)()
322
+ ], ActionExecutionMessageInput);
323
+ var ResultMessageInput = class {
324
+ actionExecutionId;
325
+ actionName;
326
+ parentMessageId;
327
+ result;
328
+ };
329
+ __name(ResultMessageInput, "ResultMessageInput");
330
+ _ts_decorate2([
331
+ (0, import_type_graphql3.Field)(() => String),
332
+ _ts_metadata2("design:type", String)
333
+ ], ResultMessageInput.prototype, "actionExecutionId", void 0);
334
+ _ts_decorate2([
335
+ (0, import_type_graphql3.Field)(() => String),
336
+ _ts_metadata2("design:type", String)
337
+ ], ResultMessageInput.prototype, "actionName", void 0);
338
+ _ts_decorate2([
339
+ (0, import_type_graphql3.Field)(() => String, {
340
+ nullable: true
341
+ }),
342
+ _ts_metadata2("design:type", String)
343
+ ], ResultMessageInput.prototype, "parentMessageId", void 0);
344
+ _ts_decorate2([
345
+ (0, import_type_graphql3.Field)(() => String),
346
+ _ts_metadata2("design:type", String)
347
+ ], ResultMessageInput.prototype, "result", void 0);
348
+ ResultMessageInput = _ts_decorate2([
349
+ (0, import_type_graphql3.InputType)()
350
+ ], ResultMessageInput);
351
+ var AgentStateMessageInput = class {
352
+ threadId;
353
+ agentName;
354
+ role;
355
+ state;
356
+ running;
357
+ nodeName;
358
+ runId;
359
+ active;
360
+ };
361
+ __name(AgentStateMessageInput, "AgentStateMessageInput");
362
+ _ts_decorate2([
363
+ (0, import_type_graphql3.Field)(() => String),
364
+ _ts_metadata2("design:type", String)
365
+ ], AgentStateMessageInput.prototype, "threadId", void 0);
366
+ _ts_decorate2([
367
+ (0, import_type_graphql3.Field)(() => String),
368
+ _ts_metadata2("design:type", String)
369
+ ], AgentStateMessageInput.prototype, "agentName", void 0);
370
+ _ts_decorate2([
371
+ (0, import_type_graphql3.Field)(() => MessageRole),
372
+ _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
373
+ ], AgentStateMessageInput.prototype, "role", void 0);
374
+ _ts_decorate2([
375
+ (0, import_type_graphql3.Field)(() => String),
376
+ _ts_metadata2("design:type", String)
377
+ ], AgentStateMessageInput.prototype, "state", void 0);
378
+ _ts_decorate2([
379
+ (0, import_type_graphql3.Field)(() => Boolean),
380
+ _ts_metadata2("design:type", Boolean)
381
+ ], AgentStateMessageInput.prototype, "running", void 0);
382
+ _ts_decorate2([
383
+ (0, import_type_graphql3.Field)(() => String),
384
+ _ts_metadata2("design:type", String)
385
+ ], AgentStateMessageInput.prototype, "nodeName", void 0);
386
+ _ts_decorate2([
387
+ (0, import_type_graphql3.Field)(() => String),
388
+ _ts_metadata2("design:type", String)
389
+ ], AgentStateMessageInput.prototype, "runId", void 0);
390
+ _ts_decorate2([
391
+ (0, import_type_graphql3.Field)(() => Boolean),
392
+ _ts_metadata2("design:type", Boolean)
393
+ ], AgentStateMessageInput.prototype, "active", void 0);
394
+ AgentStateMessageInput = _ts_decorate2([
395
+ (0, import_type_graphql3.InputType)()
396
+ ], AgentStateMessageInput);
397
+
398
+ // src/graphql/inputs/frontend.input.ts
399
+ var import_type_graphql5 = require("type-graphql");
400
+
401
+ // src/graphql/inputs/action.input.ts
402
+ var import_type_graphql4 = require("type-graphql");
403
+ function _ts_decorate3(decorators, target, key, desc) {
404
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
405
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
406
+ r = Reflect.decorate(decorators, target, key, desc);
407
+ else
408
+ for (var i = decorators.length - 1; i >= 0; i--)
409
+ if (d = decorators[i])
410
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
411
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
412
+ }
413
+ __name(_ts_decorate3, "_ts_decorate");
414
+ function _ts_metadata3(k, v) {
415
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
416
+ return Reflect.metadata(k, v);
417
+ }
418
+ __name(_ts_metadata3, "_ts_metadata");
419
+ var ActionInput = class {
420
+ name;
421
+ description;
422
+ jsonSchema;
423
+ available;
424
+ };
425
+ __name(ActionInput, "ActionInput");
426
+ _ts_decorate3([
427
+ (0, import_type_graphql4.Field)(() => String),
428
+ _ts_metadata3("design:type", String)
429
+ ], ActionInput.prototype, "name", void 0);
430
+ _ts_decorate3([
431
+ (0, import_type_graphql4.Field)(() => String),
432
+ _ts_metadata3("design:type", String)
433
+ ], ActionInput.prototype, "description", void 0);
434
+ _ts_decorate3([
435
+ (0, import_type_graphql4.Field)(() => String),
436
+ _ts_metadata3("design:type", String)
437
+ ], ActionInput.prototype, "jsonSchema", void 0);
438
+ _ts_decorate3([
439
+ (0, import_type_graphql4.Field)(() => ActionInputAvailability, {
440
+ nullable: true
441
+ }),
442
+ _ts_metadata3("design:type", typeof ActionInputAvailability === "undefined" ? Object : ActionInputAvailability)
443
+ ], ActionInput.prototype, "available", void 0);
444
+ ActionInput = _ts_decorate3([
445
+ (0, import_type_graphql4.InputType)()
446
+ ], ActionInput);
447
+
448
+ // src/graphql/inputs/frontend.input.ts
449
+ function _ts_decorate4(decorators, target, key, desc) {
450
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
451
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
452
+ r = Reflect.decorate(decorators, target, key, desc);
453
+ else
454
+ for (var i = decorators.length - 1; i >= 0; i--)
455
+ if (d = decorators[i])
456
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
457
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
458
+ }
459
+ __name(_ts_decorate4, "_ts_decorate");
460
+ function _ts_metadata4(k, v) {
461
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
462
+ return Reflect.metadata(k, v);
463
+ }
464
+ __name(_ts_metadata4, "_ts_metadata");
465
+ var FrontendInput = class {
466
+ toDeprecate_fullContext;
467
+ actions;
468
+ url;
469
+ };
470
+ __name(FrontendInput, "FrontendInput");
471
+ _ts_decorate4([
472
+ (0, import_type_graphql5.Field)(() => String, {
473
+ nullable: true
474
+ }),
475
+ _ts_metadata4("design:type", String)
476
+ ], FrontendInput.prototype, "toDeprecate_fullContext", void 0);
477
+ _ts_decorate4([
478
+ (0, import_type_graphql5.Field)(() => [
479
+ ActionInput
480
+ ]),
481
+ _ts_metadata4("design:type", Array)
482
+ ], FrontendInput.prototype, "actions", void 0);
483
+ _ts_decorate4([
484
+ (0, import_type_graphql5.Field)(() => String, {
485
+ nullable: true
486
+ }),
487
+ _ts_metadata4("design:type", String)
488
+ ], FrontendInput.prototype, "url", void 0);
489
+ FrontendInput = _ts_decorate4([
490
+ (0, import_type_graphql5.InputType)()
491
+ ], FrontendInput);
492
+
493
+ // src/graphql/inputs/cloud.input.ts
494
+ var import_type_graphql7 = require("type-graphql");
495
+
496
+ // src/graphql/inputs/cloud-guardrails.input.ts
497
+ var import_type_graphql6 = require("type-graphql");
498
+ function _ts_decorate5(decorators, target, key, desc) {
499
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
500
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
501
+ r = Reflect.decorate(decorators, target, key, desc);
502
+ else
503
+ for (var i = decorators.length - 1; i >= 0; i--)
504
+ if (d = decorators[i])
505
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
506
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
507
+ }
508
+ __name(_ts_decorate5, "_ts_decorate");
509
+ function _ts_metadata5(k, v) {
510
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
511
+ return Reflect.metadata(k, v);
512
+ }
513
+ __name(_ts_metadata5, "_ts_metadata");
514
+ var GuardrailsRuleInput = class {
515
+ allowList = [];
516
+ denyList = [];
517
+ };
518
+ __name(GuardrailsRuleInput, "GuardrailsRuleInput");
519
+ _ts_decorate5([
520
+ (0, import_type_graphql6.Field)(() => [
521
+ String
522
+ ], {
523
+ nullable: true
524
+ }),
525
+ _ts_metadata5("design:type", Array)
526
+ ], GuardrailsRuleInput.prototype, "allowList", void 0);
527
+ _ts_decorate5([
528
+ (0, import_type_graphql6.Field)(() => [
529
+ String
530
+ ], {
531
+ nullable: true
532
+ }),
533
+ _ts_metadata5("design:type", Array)
534
+ ], GuardrailsRuleInput.prototype, "denyList", void 0);
535
+ GuardrailsRuleInput = _ts_decorate5([
536
+ (0, import_type_graphql6.InputType)()
537
+ ], GuardrailsRuleInput);
538
+ var GuardrailsInput = class {
539
+ inputValidationRules;
540
+ };
541
+ __name(GuardrailsInput, "GuardrailsInput");
542
+ _ts_decorate5([
543
+ (0, import_type_graphql6.Field)(() => GuardrailsRuleInput, {
544
+ nullable: false
545
+ }),
546
+ _ts_metadata5("design:type", typeof GuardrailsRuleInput === "undefined" ? Object : GuardrailsRuleInput)
547
+ ], GuardrailsInput.prototype, "inputValidationRules", void 0);
548
+ GuardrailsInput = _ts_decorate5([
549
+ (0, import_type_graphql6.InputType)()
550
+ ], GuardrailsInput);
551
+
552
+ // src/graphql/inputs/cloud.input.ts
553
+ function _ts_decorate6(decorators, target, key, desc) {
554
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
555
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
556
+ r = Reflect.decorate(decorators, target, key, desc);
557
+ else
558
+ for (var i = decorators.length - 1; i >= 0; i--)
559
+ if (d = decorators[i])
560
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
561
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
562
+ }
563
+ __name(_ts_decorate6, "_ts_decorate");
564
+ function _ts_metadata6(k, v) {
565
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
566
+ return Reflect.metadata(k, v);
567
+ }
568
+ __name(_ts_metadata6, "_ts_metadata");
569
+ var CloudInput = class {
570
+ guardrails;
571
+ };
572
+ __name(CloudInput, "CloudInput");
573
+ _ts_decorate6([
574
+ (0, import_type_graphql7.Field)(() => GuardrailsInput, {
575
+ nullable: true
576
+ }),
577
+ _ts_metadata6("design:type", typeof GuardrailsInput === "undefined" ? Object : GuardrailsInput)
578
+ ], CloudInput.prototype, "guardrails", void 0);
579
+ CloudInput = _ts_decorate6([
580
+ (0, import_type_graphql7.InputType)()
581
+ ], CloudInput);
582
+
583
+ // src/graphql/inputs/forwarded-parameters.input.ts
584
+ var import_type_graphql8 = require("type-graphql");
585
+ function _ts_decorate7(decorators, target, key, desc) {
586
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
587
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
588
+ r = Reflect.decorate(decorators, target, key, desc);
589
+ else
590
+ for (var i = decorators.length - 1; i >= 0; i--)
591
+ if (d = decorators[i])
592
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
593
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
594
+ }
595
+ __name(_ts_decorate7, "_ts_decorate");
596
+ function _ts_metadata7(k, v) {
597
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
598
+ return Reflect.metadata(k, v);
599
+ }
600
+ __name(_ts_metadata7, "_ts_metadata");
601
+ var ForwardedParametersInput = class {
602
+ model;
603
+ maxTokens;
604
+ stop;
605
+ toolChoice;
606
+ toolChoiceFunctionName;
607
+ temperature;
608
+ };
609
+ __name(ForwardedParametersInput, "ForwardedParametersInput");
610
+ _ts_decorate7([
611
+ (0, import_type_graphql8.Field)(() => String, {
612
+ nullable: true
613
+ }),
614
+ _ts_metadata7("design:type", String)
615
+ ], ForwardedParametersInput.prototype, "model", void 0);
616
+ _ts_decorate7([
617
+ (0, import_type_graphql8.Field)(() => Number, {
618
+ nullable: true
619
+ }),
620
+ _ts_metadata7("design:type", Number)
621
+ ], ForwardedParametersInput.prototype, "maxTokens", void 0);
622
+ _ts_decorate7([
623
+ (0, import_type_graphql8.Field)(() => [
624
+ String
625
+ ], {
626
+ nullable: true
627
+ }),
628
+ _ts_metadata7("design:type", Array)
629
+ ], ForwardedParametersInput.prototype, "stop", void 0);
630
+ _ts_decorate7([
631
+ (0, import_type_graphql8.Field)(() => String, {
632
+ nullable: true
633
+ }),
634
+ _ts_metadata7("design:type", typeof String === "undefined" ? Object : String)
635
+ ], ForwardedParametersInput.prototype, "toolChoice", void 0);
636
+ _ts_decorate7([
637
+ (0, import_type_graphql8.Field)(() => String, {
638
+ nullable: true
639
+ }),
640
+ _ts_metadata7("design:type", String)
641
+ ], ForwardedParametersInput.prototype, "toolChoiceFunctionName", void 0);
642
+ _ts_decorate7([
643
+ (0, import_type_graphql8.Field)(() => Number, {
644
+ nullable: true
645
+ }),
646
+ _ts_metadata7("design:type", Number)
647
+ ], ForwardedParametersInput.prototype, "temperature", void 0);
648
+ ForwardedParametersInput = _ts_decorate7([
649
+ (0, import_type_graphql8.InputType)()
650
+ ], ForwardedParametersInput);
651
+
652
+ // src/graphql/inputs/agent-session.input.ts
653
+ var import_type_graphql9 = require("type-graphql");
654
+ function _ts_decorate8(decorators, target, key, desc) {
655
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
656
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
657
+ r = Reflect.decorate(decorators, target, key, desc);
658
+ else
659
+ for (var i = decorators.length - 1; i >= 0; i--)
660
+ if (d = decorators[i])
661
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
662
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
663
+ }
664
+ __name(_ts_decorate8, "_ts_decorate");
665
+ function _ts_metadata8(k, v) {
666
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
667
+ return Reflect.metadata(k, v);
668
+ }
669
+ __name(_ts_metadata8, "_ts_metadata");
670
+ var AgentSessionInput = class {
671
+ agentName;
672
+ threadId;
673
+ nodeName;
674
+ };
675
+ __name(AgentSessionInput, "AgentSessionInput");
676
+ _ts_decorate8([
677
+ (0, import_type_graphql9.Field)(() => String),
678
+ _ts_metadata8("design:type", String)
679
+ ], AgentSessionInput.prototype, "agentName", void 0);
680
+ _ts_decorate8([
681
+ (0, import_type_graphql9.Field)(() => String, {
682
+ nullable: true
683
+ }),
684
+ _ts_metadata8("design:type", String)
685
+ ], AgentSessionInput.prototype, "threadId", void 0);
686
+ _ts_decorate8([
687
+ (0, import_type_graphql9.Field)(() => String, {
688
+ nullable: true
689
+ }),
690
+ _ts_metadata8("design:type", String)
691
+ ], AgentSessionInput.prototype, "nodeName", void 0);
692
+ AgentSessionInput = _ts_decorate8([
693
+ (0, import_type_graphql9.InputType)()
694
+ ], AgentSessionInput);
695
+
696
+ // src/graphql/inputs/agent-state.input.ts
697
+ var import_type_graphql10 = require("type-graphql");
698
+ function _ts_decorate9(decorators, target, key, desc) {
699
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
700
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
701
+ r = Reflect.decorate(decorators, target, key, desc);
702
+ else
703
+ for (var i = decorators.length - 1; i >= 0; i--)
704
+ if (d = decorators[i])
705
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
706
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
707
+ }
708
+ __name(_ts_decorate9, "_ts_decorate");
709
+ function _ts_metadata9(k, v) {
710
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
711
+ return Reflect.metadata(k, v);
712
+ }
713
+ __name(_ts_metadata9, "_ts_metadata");
714
+ var AgentStateInput = class {
715
+ agentName;
716
+ state;
717
+ };
718
+ __name(AgentStateInput, "AgentStateInput");
719
+ _ts_decorate9([
720
+ (0, import_type_graphql10.Field)(() => String),
721
+ _ts_metadata9("design:type", String)
722
+ ], AgentStateInput.prototype, "agentName", void 0);
723
+ _ts_decorate9([
724
+ (0, import_type_graphql10.Field)(() => String),
725
+ _ts_metadata9("design:type", String)
726
+ ], AgentStateInput.prototype, "state", void 0);
727
+ AgentStateInput = _ts_decorate9([
728
+ (0, import_type_graphql10.InputType)()
729
+ ], AgentStateInput);
730
+
731
+ // src/graphql/inputs/generate-copilot-response.input.ts
732
+ function _ts_decorate10(decorators, target, key, desc) {
733
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
734
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
735
+ r = Reflect.decorate(decorators, target, key, desc);
736
+ else
737
+ for (var i = decorators.length - 1; i >= 0; i--)
738
+ if (d = decorators[i])
739
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
740
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
741
+ }
742
+ __name(_ts_decorate10, "_ts_decorate");
743
+ function _ts_metadata10(k, v) {
744
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
745
+ return Reflect.metadata(k, v);
746
+ }
747
+ __name(_ts_metadata10, "_ts_metadata");
748
+ var GenerateCopilotResponseMetadataInput = class {
749
+ requestType;
750
+ };
751
+ __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
752
+ _ts_decorate10([
753
+ (0, import_type_graphql11.Field)(() => CopilotRequestType, {
754
+ nullable: true
755
+ }),
756
+ _ts_metadata10("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
757
+ ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
758
+ GenerateCopilotResponseMetadataInput = _ts_decorate10([
759
+ (0, import_type_graphql11.InputType)()
760
+ ], GenerateCopilotResponseMetadataInput);
761
+ var GenerateCopilotResponseInput = class {
762
+ metadata;
763
+ threadId;
764
+ runId;
765
+ messages;
766
+ frontend;
767
+ cloud;
768
+ forwardedParameters;
769
+ agentSession;
770
+ agentState;
771
+ agentStates;
772
+ };
773
+ __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
774
+ _ts_decorate10([
775
+ (0, import_type_graphql11.Field)(() => GenerateCopilotResponseMetadataInput, {
776
+ nullable: false
777
+ }),
778
+ _ts_metadata10("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
779
+ ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
780
+ _ts_decorate10([
781
+ (0, import_type_graphql11.Field)(() => String, {
782
+ nullable: true
783
+ }),
784
+ _ts_metadata10("design:type", String)
785
+ ], GenerateCopilotResponseInput.prototype, "threadId", void 0);
786
+ _ts_decorate10([
787
+ (0, import_type_graphql11.Field)(() => String, {
788
+ nullable: true
789
+ }),
790
+ _ts_metadata10("design:type", String)
791
+ ], GenerateCopilotResponseInput.prototype, "runId", void 0);
792
+ _ts_decorate10([
793
+ (0, import_type_graphql11.Field)(() => [
794
+ MessageInput
795
+ ]),
796
+ _ts_metadata10("design:type", Array)
797
+ ], GenerateCopilotResponseInput.prototype, "messages", void 0);
798
+ _ts_decorate10([
799
+ (0, import_type_graphql11.Field)(() => FrontendInput),
800
+ _ts_metadata10("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
801
+ ], GenerateCopilotResponseInput.prototype, "frontend", void 0);
802
+ _ts_decorate10([
803
+ (0, import_type_graphql11.Field)(() => CloudInput, {
804
+ nullable: true
805
+ }),
806
+ _ts_metadata10("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
807
+ ], GenerateCopilotResponseInput.prototype, "cloud", void 0);
808
+ _ts_decorate10([
809
+ (0, import_type_graphql11.Field)(() => ForwardedParametersInput, {
810
+ nullable: true
811
+ }),
812
+ _ts_metadata10("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
813
+ ], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
814
+ _ts_decorate10([
815
+ (0, import_type_graphql11.Field)(() => AgentSessionInput, {
816
+ nullable: true
817
+ }),
818
+ _ts_metadata10("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
819
+ ], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
820
+ _ts_decorate10([
821
+ (0, import_type_graphql11.Field)(() => AgentStateInput, {
822
+ nullable: true
823
+ }),
824
+ _ts_metadata10("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
825
+ ], GenerateCopilotResponseInput.prototype, "agentState", void 0);
826
+ _ts_decorate10([
827
+ (0, import_type_graphql11.Field)(() => [
828
+ AgentStateInput
829
+ ], {
830
+ nullable: true
831
+ }),
832
+ _ts_metadata10("design:type", Array)
833
+ ], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
834
+ GenerateCopilotResponseInput = _ts_decorate10([
835
+ (0, import_type_graphql11.InputType)()
836
+ ], GenerateCopilotResponseInput);
837
+
838
+ // src/graphql/types/copilot-response.type.ts
839
+ var import_type_graphql14 = require("type-graphql");
840
+
841
+ // src/graphql/types/message-status.type.ts
842
+ var import_type_graphql12 = require("type-graphql");
843
+ function _ts_decorate11(decorators, target, key, desc) {
844
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
845
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
846
+ r = Reflect.decorate(decorators, target, key, desc);
847
+ else
848
+ for (var i = decorators.length - 1; i >= 0; i--)
849
+ if (d = decorators[i])
850
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
851
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
852
+ }
853
+ __name(_ts_decorate11, "_ts_decorate");
854
+ function _ts_metadata11(k, v) {
855
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
856
+ return Reflect.metadata(k, v);
857
+ }
858
+ __name(_ts_metadata11, "_ts_metadata");
859
+ var MessageStatusCode;
860
+ (function(MessageStatusCode2) {
861
+ MessageStatusCode2["Pending"] = "pending";
862
+ MessageStatusCode2["Success"] = "success";
863
+ MessageStatusCode2["Failed"] = "failed";
864
+ })(MessageStatusCode || (MessageStatusCode = {}));
865
+ (0, import_type_graphql12.registerEnumType)(MessageStatusCode, {
866
+ name: "MessageStatusCode"
867
+ });
868
+ var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
869
+ code;
870
+ }, "BaseMessageStatus");
871
+ _ts_decorate11([
872
+ (0, import_type_graphql12.Field)(() => MessageStatusCode),
873
+ _ts_metadata11("design:type", String)
874
+ ], BaseMessageStatus.prototype, "code", void 0);
875
+ BaseMessageStatus = _ts_decorate11([
876
+ (0, import_type_graphql12.ObjectType)()
877
+ ], BaseMessageStatus);
878
+ var PendingMessageStatus = class extends BaseMessageStatus {
879
+ code = "pending";
880
+ };
881
+ __name(PendingMessageStatus, "PendingMessageStatus");
882
+ PendingMessageStatus = _ts_decorate11([
883
+ (0, import_type_graphql12.ObjectType)()
884
+ ], PendingMessageStatus);
885
+ var SuccessMessageStatus = class extends BaseMessageStatus {
886
+ code = "success";
887
+ };
888
+ __name(SuccessMessageStatus, "SuccessMessageStatus");
889
+ SuccessMessageStatus = _ts_decorate11([
890
+ (0, import_type_graphql12.ObjectType)()
891
+ ], SuccessMessageStatus);
892
+ var FailedMessageStatus = class extends BaseMessageStatus {
893
+ code = "failed";
894
+ reason;
895
+ };
896
+ __name(FailedMessageStatus, "FailedMessageStatus");
897
+ _ts_decorate11([
898
+ (0, import_type_graphql12.Field)(() => String),
899
+ _ts_metadata11("design:type", String)
900
+ ], FailedMessageStatus.prototype, "reason", void 0);
901
+ FailedMessageStatus = _ts_decorate11([
902
+ (0, import_type_graphql12.ObjectType)()
903
+ ], FailedMessageStatus);
904
+ var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
905
+ name: "MessageStatus",
906
+ types: () => [
907
+ PendingMessageStatus,
908
+ SuccessMessageStatus,
909
+ FailedMessageStatus
910
+ ]
911
+ });
912
+
913
+ // src/graphql/types/response-status.type.ts
914
+ var import_graphql_scalars = require("graphql-scalars");
915
+ var import_type_graphql13 = require("type-graphql");
916
+ function _ts_decorate12(decorators, target, key, desc) {
917
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
918
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
919
+ r = Reflect.decorate(decorators, target, key, desc);
920
+ else
921
+ for (var i = decorators.length - 1; i >= 0; i--)
922
+ if (d = decorators[i])
923
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
924
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
925
+ }
926
+ __name(_ts_decorate12, "_ts_decorate");
927
+ function _ts_metadata12(k, v) {
928
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
929
+ return Reflect.metadata(k, v);
930
+ }
931
+ __name(_ts_metadata12, "_ts_metadata");
932
+ var ResponseStatusCode;
933
+ (function(ResponseStatusCode2) {
934
+ ResponseStatusCode2["Pending"] = "pending";
935
+ ResponseStatusCode2["Success"] = "success";
936
+ ResponseStatusCode2["Failed"] = "failed";
937
+ })(ResponseStatusCode || (ResponseStatusCode = {}));
938
+ (0, import_type_graphql13.registerEnumType)(ResponseStatusCode, {
939
+ name: "ResponseStatusCode"
940
+ });
941
+ var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
942
+ code;
943
+ }, "BaseResponseStatus");
944
+ _ts_decorate12([
945
+ (0, import_type_graphql13.Field)(() => ResponseStatusCode),
946
+ _ts_metadata12("design:type", String)
947
+ ], BaseResponseStatus.prototype, "code", void 0);
948
+ BaseResponseStatus = _ts_decorate12([
949
+ (0, import_type_graphql13.InterfaceType)({
950
+ resolveType(value) {
951
+ if (value.code === "success") {
952
+ return SuccessResponseStatus;
953
+ } else if (value.code === "failed") {
954
+ return FailedResponseStatus;
955
+ } else if (value.code === "pending") {
956
+ return PendingResponseStatus;
957
+ }
958
+ return void 0;
959
+ }
960
+ }),
961
+ (0, import_type_graphql13.ObjectType)()
962
+ ], BaseResponseStatus);
963
+ var PendingResponseStatus = class extends BaseResponseStatus {
964
+ code = "pending";
965
+ };
966
+ __name(PendingResponseStatus, "PendingResponseStatus");
967
+ PendingResponseStatus = _ts_decorate12([
968
+ (0, import_type_graphql13.ObjectType)({
969
+ implements: BaseResponseStatus
970
+ })
971
+ ], PendingResponseStatus);
972
+ var SuccessResponseStatus = class extends BaseResponseStatus {
973
+ code = "success";
974
+ };
975
+ __name(SuccessResponseStatus, "SuccessResponseStatus");
976
+ SuccessResponseStatus = _ts_decorate12([
977
+ (0, import_type_graphql13.ObjectType)({
978
+ implements: BaseResponseStatus
979
+ })
980
+ ], SuccessResponseStatus);
981
+ var FailedResponseStatusReason;
982
+ (function(FailedResponseStatusReason2) {
983
+ FailedResponseStatusReason2["GUARDRAILS_VALIDATION_FAILED"] = "GUARDRAILS_VALIDATION_FAILED";
984
+ FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
985
+ FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
986
+ })(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
987
+ (0, import_type_graphql13.registerEnumType)(FailedResponseStatusReason, {
988
+ name: "FailedResponseStatusReason"
989
+ });
990
+ var FailedResponseStatus = class extends BaseResponseStatus {
991
+ code = "failed";
992
+ reason;
993
+ details = null;
994
+ };
995
+ __name(FailedResponseStatus, "FailedResponseStatus");
996
+ _ts_decorate12([
997
+ (0, import_type_graphql13.Field)(() => FailedResponseStatusReason),
998
+ _ts_metadata12("design:type", String)
999
+ ], FailedResponseStatus.prototype, "reason", void 0);
1000
+ _ts_decorate12([
1001
+ (0, import_type_graphql13.Field)(() => import_graphql_scalars.GraphQLJSON, {
1002
+ nullable: true
1003
+ }),
1004
+ _ts_metadata12("design:type", typeof Record === "undefined" ? Object : Record)
1005
+ ], FailedResponseStatus.prototype, "details", void 0);
1006
+ FailedResponseStatus = _ts_decorate12([
1007
+ (0, import_type_graphql13.ObjectType)({
1008
+ implements: BaseResponseStatus
1009
+ })
1010
+ ], FailedResponseStatus);
1011
+ var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
1012
+ name: "ResponseStatus",
1013
+ types: () => [
1014
+ PendingResponseStatus,
1015
+ SuccessResponseStatus,
1016
+ FailedResponseStatus
1017
+ ]
1018
+ });
1019
+
1020
+ // src/graphql/types/copilot-response.type.ts
1021
+ function _ts_decorate13(decorators, target, key, desc) {
1022
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1023
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1024
+ r = Reflect.decorate(decorators, target, key, desc);
1025
+ else
1026
+ for (var i = decorators.length - 1; i >= 0; i--)
1027
+ if (d = decorators[i])
1028
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1029
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1030
+ }
1031
+ __name(_ts_decorate13, "_ts_decorate");
1032
+ function _ts_metadata13(k, v) {
1033
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1034
+ return Reflect.metadata(k, v);
1035
+ }
1036
+ __name(_ts_metadata13, "_ts_metadata");
1037
+ var BaseMessageOutput = /* @__PURE__ */ __name(class BaseMessageOutput2 {
1038
+ id;
1039
+ createdAt;
1040
+ status;
1041
+ }, "BaseMessageOutput");
1042
+ _ts_decorate13([
1043
+ (0, import_type_graphql14.Field)(() => String),
1044
+ _ts_metadata13("design:type", String)
1045
+ ], BaseMessageOutput.prototype, "id", void 0);
1046
+ _ts_decorate13([
1047
+ (0, import_type_graphql14.Field)(() => Date),
1048
+ _ts_metadata13("design:type", typeof Date === "undefined" ? Object : Date)
1049
+ ], BaseMessageOutput.prototype, "createdAt", void 0);
1050
+ _ts_decorate13([
1051
+ (0, import_type_graphql14.Field)(() => MessageStatusUnion),
1052
+ _ts_metadata13("design:type", Object)
1053
+ ], BaseMessageOutput.prototype, "status", void 0);
1054
+ BaseMessageOutput = _ts_decorate13([
1055
+ (0, import_type_graphql14.InterfaceType)({
1056
+ resolveType(value) {
1057
+ if (value.hasOwnProperty("content")) {
1058
+ return TextMessageOutput;
1059
+ } else if (value.hasOwnProperty("name")) {
1060
+ return ActionExecutionMessageOutput;
1061
+ } else if (value.hasOwnProperty("result")) {
1062
+ return ResultMessageOutput;
1063
+ } else if (value.hasOwnProperty("state")) {
1064
+ return AgentStateMessageOutput;
1065
+ }
1066
+ return void 0;
1067
+ }
1068
+ })
1069
+ ], BaseMessageOutput);
1070
+ var TextMessageOutput = class {
1071
+ role;
1072
+ content;
1073
+ parentMessageId;
1074
+ };
1075
+ __name(TextMessageOutput, "TextMessageOutput");
1076
+ _ts_decorate13([
1077
+ (0, import_type_graphql14.Field)(() => MessageRole),
1078
+ _ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1079
+ ], TextMessageOutput.prototype, "role", void 0);
1080
+ _ts_decorate13([
1081
+ (0, import_type_graphql14.Field)(() => [
1082
+ String
1083
+ ]),
1084
+ _ts_metadata13("design:type", Array)
1085
+ ], TextMessageOutput.prototype, "content", void 0);
1086
+ _ts_decorate13([
1087
+ (0, import_type_graphql14.Field)(() => String, {
1088
+ nullable: true
1089
+ }),
1090
+ _ts_metadata13("design:type", String)
1091
+ ], TextMessageOutput.prototype, "parentMessageId", void 0);
1092
+ TextMessageOutput = _ts_decorate13([
1093
+ (0, import_type_graphql14.ObjectType)({
1094
+ implements: BaseMessageOutput
1095
+ })
1096
+ ], TextMessageOutput);
1097
+ var ActionExecutionMessageOutput = class {
1098
+ name;
1099
+ scope;
1100
+ arguments;
1101
+ parentMessageId;
1102
+ };
1103
+ __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
1104
+ _ts_decorate13([
1105
+ (0, import_type_graphql14.Field)(() => String),
1106
+ _ts_metadata13("design:type", String)
1107
+ ], ActionExecutionMessageOutput.prototype, "name", void 0);
1108
+ _ts_decorate13([
1109
+ (0, import_type_graphql14.Field)(() => String, {
1110
+ nullable: true,
1111
+ deprecationReason: "This field will be removed in a future version"
1112
+ }),
1113
+ _ts_metadata13("design:type", String)
1114
+ ], ActionExecutionMessageOutput.prototype, "scope", void 0);
1115
+ _ts_decorate13([
1116
+ (0, import_type_graphql14.Field)(() => [
1117
+ String
1118
+ ]),
1119
+ _ts_metadata13("design:type", Array)
1120
+ ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
1121
+ _ts_decorate13([
1122
+ (0, import_type_graphql14.Field)(() => String, {
1123
+ nullable: true
1124
+ }),
1125
+ _ts_metadata13("design:type", String)
1126
+ ], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
1127
+ ActionExecutionMessageOutput = _ts_decorate13([
1128
+ (0, import_type_graphql14.ObjectType)({
1129
+ implements: BaseMessageOutput
1130
+ })
1131
+ ], ActionExecutionMessageOutput);
1132
+ var ResultMessageOutput = class {
1133
+ actionExecutionId;
1134
+ actionName;
1135
+ result;
1136
+ };
1137
+ __name(ResultMessageOutput, "ResultMessageOutput");
1138
+ _ts_decorate13([
1139
+ (0, import_type_graphql14.Field)(() => String),
1140
+ _ts_metadata13("design:type", String)
1141
+ ], ResultMessageOutput.prototype, "actionExecutionId", void 0);
1142
+ _ts_decorate13([
1143
+ (0, import_type_graphql14.Field)(() => String),
1144
+ _ts_metadata13("design:type", String)
1145
+ ], ResultMessageOutput.prototype, "actionName", void 0);
1146
+ _ts_decorate13([
1147
+ (0, import_type_graphql14.Field)(() => String),
1148
+ _ts_metadata13("design:type", String)
1149
+ ], ResultMessageOutput.prototype, "result", void 0);
1150
+ ResultMessageOutput = _ts_decorate13([
1151
+ (0, import_type_graphql14.ObjectType)({
1152
+ implements: BaseMessageOutput
1153
+ })
1154
+ ], ResultMessageOutput);
1155
+ var AgentStateMessageOutput = class {
1156
+ threadId;
1157
+ agentName;
1158
+ nodeName;
1159
+ runId;
1160
+ active;
1161
+ role;
1162
+ state;
1163
+ running;
1164
+ };
1165
+ __name(AgentStateMessageOutput, "AgentStateMessageOutput");
1166
+ _ts_decorate13([
1167
+ (0, import_type_graphql14.Field)(() => String),
1168
+ _ts_metadata13("design:type", String)
1169
+ ], AgentStateMessageOutput.prototype, "threadId", void 0);
1170
+ _ts_decorate13([
1171
+ (0, import_type_graphql14.Field)(() => String),
1172
+ _ts_metadata13("design:type", String)
1173
+ ], AgentStateMessageOutput.prototype, "agentName", void 0);
1174
+ _ts_decorate13([
1175
+ (0, import_type_graphql14.Field)(() => String),
1176
+ _ts_metadata13("design:type", String)
1177
+ ], AgentStateMessageOutput.prototype, "nodeName", void 0);
1178
+ _ts_decorate13([
1179
+ (0, import_type_graphql14.Field)(() => String),
1180
+ _ts_metadata13("design:type", String)
1181
+ ], AgentStateMessageOutput.prototype, "runId", void 0);
1182
+ _ts_decorate13([
1183
+ (0, import_type_graphql14.Field)(() => Boolean),
1184
+ _ts_metadata13("design:type", Boolean)
1185
+ ], AgentStateMessageOutput.prototype, "active", void 0);
1186
+ _ts_decorate13([
1187
+ (0, import_type_graphql14.Field)(() => MessageRole),
1188
+ _ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1189
+ ], AgentStateMessageOutput.prototype, "role", void 0);
1190
+ _ts_decorate13([
1191
+ (0, import_type_graphql14.Field)(() => String),
1192
+ _ts_metadata13("design:type", String)
1193
+ ], AgentStateMessageOutput.prototype, "state", void 0);
1194
+ _ts_decorate13([
1195
+ (0, import_type_graphql14.Field)(() => Boolean),
1196
+ _ts_metadata13("design:type", Boolean)
1197
+ ], AgentStateMessageOutput.prototype, "running", void 0);
1198
+ AgentStateMessageOutput = _ts_decorate13([
1199
+ (0, import_type_graphql14.ObjectType)({
1200
+ implements: BaseMessageOutput
1201
+ })
1202
+ ], AgentStateMessageOutput);
1203
+ var CopilotResponse = class {
1204
+ threadId;
1205
+ status;
1206
+ runId;
1207
+ messages;
1208
+ };
1209
+ __name(CopilotResponse, "CopilotResponse");
1210
+ _ts_decorate13([
1211
+ (0, import_type_graphql14.Field)(() => String),
1212
+ _ts_metadata13("design:type", String)
1213
+ ], CopilotResponse.prototype, "threadId", void 0);
1214
+ _ts_decorate13([
1215
+ (0, import_type_graphql14.Field)(() => ResponseStatusUnion),
1216
+ _ts_metadata13("design:type", Object)
1217
+ ], CopilotResponse.prototype, "status", void 0);
1218
+ _ts_decorate13([
1219
+ (0, import_type_graphql14.Field)({
1220
+ nullable: true
1221
+ }),
1222
+ _ts_metadata13("design:type", String)
1223
+ ], CopilotResponse.prototype, "runId", void 0);
1224
+ _ts_decorate13([
1225
+ (0, import_type_graphql14.Field)(() => [
1226
+ BaseMessageOutput
1227
+ ]),
1228
+ _ts_metadata13("design:type", Array)
1229
+ ], CopilotResponse.prototype, "messages", void 0);
1230
+ CopilotResponse = _ts_decorate13([
1231
+ (0, import_type_graphql14.ObjectType)()
1232
+ ], CopilotResponse);
1233
+
1234
+ // src/graphql/resolvers/copilot.resolver.ts
1235
+ var import_graphql_yoga = require("graphql-yoga");
1236
+
1237
+ // src/service-adapters/events.ts
1238
+ var import_shared3 = require("@copilotkit/shared");
1239
+ var import_rxjs2 = require("rxjs");
1240
+
1241
+ // src/lib/telemetry-client.ts
1242
+ var import_shared2 = require("@copilotkit/shared");
1243
+
1244
+ // src/lib/runtime/remote-actions.ts
1245
+ var EndpointType;
1246
+ (function(EndpointType2) {
1247
+ EndpointType2["CopilotKit"] = "copilotKit";
1248
+ EndpointType2["LangGraphPlatform"] = "langgraph-platform";
1249
+ })(EndpointType || (EndpointType = {}));
1250
+
1251
+ // src/lib/telemetry-client.ts
1252
+ var import_node_crypto = require("crypto");
1253
+
1254
+ // src/lib/runtime/copilot-runtime.ts
1255
+ var import_shared = require("@copilotkit/shared");
1256
+
1257
+ // src/graphql/types/converted/index.ts
1258
+ var Message = class extends BaseMessageInput {
1259
+ type;
1260
+ isTextMessage() {
1261
+ return this.type === "TextMessage";
1262
+ }
1263
+ isActionExecutionMessage() {
1264
+ return this.type === "ActionExecutionMessage";
1265
+ }
1266
+ isResultMessage() {
1267
+ return this.type === "ResultMessage";
1268
+ }
1269
+ isAgentStateMessage() {
1270
+ return this.type === "AgentStateMessage";
1271
+ }
1272
+ };
1273
+ __name(Message, "Message");
1274
+ var TextMessage = class extends Message {
1275
+ type = "TextMessage";
1276
+ content;
1277
+ role;
1278
+ parentMessageId;
1279
+ };
1280
+ __name(TextMessage, "TextMessage");
1281
+ var ActionExecutionMessage = class extends Message {
1282
+ type = "ActionExecutionMessage";
1283
+ name;
1284
+ arguments;
1285
+ parentMessageId;
1286
+ };
1287
+ __name(ActionExecutionMessage, "ActionExecutionMessage");
1288
+ var ResultMessage = class extends Message {
1289
+ type = "ResultMessage";
1290
+ actionExecutionId;
1291
+ actionName;
1292
+ result;
1293
+ };
1294
+ __name(ResultMessage, "ResultMessage");
1295
+ var AgentStateMessage = class extends Message {
1296
+ type = "AgentStateMessage";
1297
+ threadId;
1298
+ agentName;
1299
+ nodeName;
1300
+ runId;
1301
+ active;
1302
+ role;
1303
+ state;
1304
+ running;
1305
+ };
1306
+ __name(AgentStateMessage, "AgentStateMessage");
1307
+
1308
+ // src/lib/runtime/copilot-runtime.ts
1309
+ var import_rxjs = require("rxjs");
1310
+ function resolveEndpointType(endpoint) {
1311
+ if (!endpoint.type) {
1312
+ if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
1313
+ return EndpointType.LangGraphPlatform;
1314
+ } else {
1315
+ return EndpointType.CopilotKit;
1316
+ }
1317
+ }
1318
+ return endpoint.type;
1319
+ }
1320
+ __name(resolveEndpointType, "resolveEndpointType");
1321
+
1322
+ // src/lib/telemetry-client.ts
1323
+ var packageJson = require_package();
1324
+ var telemetryClient = new import_shared2.TelemetryClient({
1325
+ packageName: packageJson.name,
1326
+ packageVersion: packageJson.version
1327
+ });
1328
+ function getRuntimeInstanceTelemetryInfo(runtime) {
1329
+ const endpointsInfo = runtime.remoteEndpointDefinitions.reduce((acc, endpoint) => {
1330
+ let info = {
1331
+ ...acc
1332
+ };
1333
+ const endpointType = resolveEndpointType(endpoint);
1334
+ if (!info.endpointTypes.includes(endpointType)) {
1335
+ info = {
1336
+ ...info,
1337
+ endpointTypes: [
1338
+ ...info.endpointTypes,
1339
+ endpointType
1340
+ ]
1341
+ };
1342
+ }
1343
+ if (endpointType === EndpointType.LangGraphPlatform) {
1344
+ const ep = endpoint;
1345
+ info = {
1346
+ ...info,
1347
+ agentsAmount: ep.agents.length,
1348
+ hashedKey: (0, import_node_crypto.createHash)("sha256").update(ep.langsmithApiKey).digest("hex")
1349
+ };
1350
+ }
1351
+ return info;
1352
+ }, {
1353
+ endpointTypes: [],
1354
+ agentsAmount: null,
1355
+ hashedKey: null
1356
+ });
1357
+ return {
1358
+ actionsAmount: runtime.actions.length,
1359
+ endpointsAmount: runtime.remoteEndpointDefinitions.length,
1360
+ endpointTypes: endpointsInfo.endpointTypes,
1361
+ agentsAmount: endpointsInfo.agentsAmount,
1362
+ hashedLgcKey: endpointsInfo.hashedKey
1363
+ };
1364
+ }
1365
+ __name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
1366
+ var telemetry_client_default = telemetryClient;
1367
+
1368
+ // src/service-adapters/events.ts
1369
+ var import_class_transformer = require("class-transformer");
1370
+ var RuntimeEventTypes;
1371
+ (function(RuntimeEventTypes2) {
1372
+ RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
1373
+ RuntimeEventTypes2["TextMessageContent"] = "TextMessageContent";
1374
+ RuntimeEventTypes2["TextMessageEnd"] = "TextMessageEnd";
1375
+ RuntimeEventTypes2["ActionExecutionStart"] = "ActionExecutionStart";
1376
+ RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
1377
+ RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
1378
+ RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
1379
+ RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
1380
+ })(RuntimeEventTypes || (RuntimeEventTypes = {}));
1381
+
1382
+ // src/graphql/resolvers/copilot.resolver.ts
1383
+ var import_graphql_scalars2 = require("graphql-scalars");
1384
+ var import_class_transformer2 = require("class-transformer");
1385
+ var import_graphql = require("graphql");
1386
+
1387
+ // src/utils/failed-response-status-reasons.ts
1388
+ var GuardrailsValidationFailureResponse = class extends FailedResponseStatus {
1389
+ reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;
1390
+ constructor({ guardrailsReason }) {
1391
+ super();
1392
+ this.details = {
1393
+ guardrailsReason
1394
+ };
1395
+ }
1396
+ };
1397
+ __name(GuardrailsValidationFailureResponse, "GuardrailsValidationFailureResponse");
1398
+ var MessageStreamInterruptedResponse = class extends FailedResponseStatus {
1399
+ reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;
1400
+ constructor({ messageId }) {
1401
+ super();
1402
+ this.details = {
1403
+ messageId,
1404
+ description: "Check the message for mode details"
1405
+ };
1406
+ }
1407
+ };
1408
+ __name(MessageStreamInterruptedResponse, "MessageStreamInterruptedResponse");
1409
+ var UnknownErrorResponse = class extends FailedResponseStatus {
1410
+ reason = FailedResponseStatusReason.UNKNOWN_ERROR;
1411
+ constructor({ description }) {
1412
+ super();
1413
+ this.details = {
1414
+ description
1415
+ };
1416
+ }
1417
+ };
1418
+ __name(UnknownErrorResponse, "UnknownErrorResponse");
1419
+
1420
+ // src/graphql/resolvers/copilot.resolver.ts
1421
+ var import_shared4 = require("@copilotkit/shared");
1422
+
1423
+ // src/graphql/types/agents-response.type.ts
1424
+ var import_type_graphql15 = require("type-graphql");
1425
+ function _ts_decorate14(decorators, target, key, desc) {
1426
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1427
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1428
+ r = Reflect.decorate(decorators, target, key, desc);
1429
+ else
1430
+ for (var i = decorators.length - 1; i >= 0; i--)
1431
+ if (d = decorators[i])
1432
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1433
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1434
+ }
1435
+ __name(_ts_decorate14, "_ts_decorate");
1436
+ function _ts_metadata14(k, v) {
1437
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1438
+ return Reflect.metadata(k, v);
1439
+ }
1440
+ __name(_ts_metadata14, "_ts_metadata");
1441
+ var Agent = class {
1442
+ id;
1443
+ name;
1444
+ description;
1445
+ };
1446
+ __name(Agent, "Agent");
1447
+ _ts_decorate14([
1448
+ (0, import_type_graphql15.Field)(() => String),
1449
+ _ts_metadata14("design:type", String)
1450
+ ], Agent.prototype, "id", void 0);
1451
+ _ts_decorate14([
1452
+ (0, import_type_graphql15.Field)(() => String),
1453
+ _ts_metadata14("design:type", String)
1454
+ ], Agent.prototype, "name", void 0);
1455
+ _ts_decorate14([
1456
+ (0, import_type_graphql15.Field)(() => String),
1457
+ _ts_metadata14("design:type", String)
1458
+ ], Agent.prototype, "description", void 0);
1459
+ Agent = _ts_decorate14([
1460
+ (0, import_type_graphql15.ObjectType)()
1461
+ ], Agent);
1462
+ var AgentsResponse = class {
1463
+ agents;
1464
+ };
1465
+ __name(AgentsResponse, "AgentsResponse");
1466
+ _ts_decorate14([
1467
+ (0, import_type_graphql15.Field)(() => [
1468
+ Agent
1469
+ ]),
1470
+ _ts_metadata14("design:type", Array)
1471
+ ], AgentsResponse.prototype, "agents", void 0);
1472
+ AgentsResponse = _ts_decorate14([
1473
+ (0, import_type_graphql15.ObjectType)()
1474
+ ], AgentsResponse);
1475
+
1476
+ // src/graphql/resolvers/copilot.resolver.ts
1477
+ function _ts_decorate15(decorators, target, key, desc) {
1478
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1479
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1480
+ r = Reflect.decorate(decorators, target, key, desc);
1481
+ else
1482
+ for (var i = decorators.length - 1; i >= 0; i--)
1483
+ if (d = decorators[i])
1484
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1485
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1486
+ }
1487
+ __name(_ts_decorate15, "_ts_decorate");
1488
+ function _ts_metadata15(k, v) {
1489
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1490
+ return Reflect.metadata(k, v);
1491
+ }
1492
+ __name(_ts_metadata15, "_ts_metadata");
1493
+ function _ts_param(paramIndex, decorator) {
1494
+ return function(target, key) {
1495
+ decorator(target, key, paramIndex);
1496
+ };
1497
+ }
1498
+ __name(_ts_param, "_ts_param");
1499
+ var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
1500
+ var _a;
1501
+ if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
1502
+ const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
1503
+ role: m.textMessage.role,
1504
+ content: m.textMessage.content
1505
+ }));
1506
+ const lastMessage = messages[messages.length - 1];
1507
+ const restOfMessages = messages.slice(0, -1);
1508
+ const body = {
1509
+ input: lastMessage.content,
1510
+ validTopics: data.cloud.guardrails.inputValidationRules.allowList,
1511
+ invalidTopics: data.cloud.guardrails.inputValidationRules.denyList,
1512
+ messages: restOfMessages
1513
+ };
1514
+ const guardrailsResult = await fetch(`${baseUrl}/guardrails/validate`, {
1515
+ method: "POST",
1516
+ headers: {
1517
+ "Content-Type": "application/json",
1518
+ "X-CopilotCloud-Public-API-Key": copilotCloudPublicApiKey
1519
+ },
1520
+ body: JSON.stringify(body)
1521
+ });
1522
+ if (guardrailsResult.ok) {
1523
+ const resultJson = await guardrailsResult.json();
1524
+ onResult(resultJson);
1525
+ } else {
1526
+ onError(await guardrailsResult.json());
1527
+ }
1528
+ }
1529
+ }, "invokeGuardrails");
1530
+ var CopilotResolver = class {
1531
+ async hello() {
1532
+ return "Hello World";
1533
+ }
1534
+ async availableAgents(ctx) {
1535
+ let logger2 = ctx.logger.child({
1536
+ component: "CopilotResolver.availableAgents"
1537
+ });
1538
+ logger2.debug("Processing");
1539
+ const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
1540
+ logger2.debug("Event source created, creating response");
1541
+ return {
1542
+ agents
1543
+ };
1544
+ }
1545
+ async generateCopilotResponse(ctx, data, properties) {
1546
+ var _a, _b, _c;
1547
+ telemetry_client_default.capture("oss.runtime.copilot_request_created", {
1548
+ "cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
1549
+ requestType: data.metadata.requestType
1550
+ });
1551
+ let logger2 = ctx.logger.child({
1552
+ component: "CopilotResolver.generateCopilotResponse"
1553
+ });
1554
+ logger2.debug({
1555
+ data
1556
+ }, "Generating Copilot response");
1557
+ if (properties) {
1558
+ logger2.debug("Properties provided, merging with context properties");
1559
+ ctx.properties = {
1560
+ ...ctx.properties,
1561
+ ...properties
1562
+ };
1563
+ }
1564
+ const copilotRuntime = ctx._copilotkit.runtime;
1565
+ const serviceAdapter = ctx._copilotkit.serviceAdapter;
1566
+ let copilotCloudPublicApiKey = null;
1567
+ let copilotCloudBaseUrl;
1568
+ if (data.cloud) {
1569
+ logger2 = logger2.child({
1570
+ cloud: true
1571
+ });
1572
+ logger2.debug("Cloud configuration provided, checking for public API key in headers");
1573
+ const key = ctx.request.headers.get("x-copilotcloud-public-api-key");
1574
+ if (key) {
1575
+ logger2.debug("Public API key found in headers");
1576
+ copilotCloudPublicApiKey = key;
1577
+ } else {
1578
+ logger2.error("Public API key not found in headers");
1579
+ throw new import_graphql.GraphQLError("X-CopilotCloud-Public-API-Key header is required");
1580
+ }
1581
+ if (process.env.COPILOT_CLOUD_BASE_URL) {
1582
+ copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
1583
+ } else if ((_b = ctx._copilotkit.cloud) == null ? void 0 : _b.baseUrl) {
1584
+ copilotCloudBaseUrl = (_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl;
1585
+ } else {
1586
+ copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
1587
+ }
1588
+ logger2 = logger2.child({
1589
+ copilotCloudBaseUrl
1590
+ });
1591
+ }
1592
+ logger2.debug("Setting up subjects");
1593
+ const responseStatus$ = new import_rxjs3.ReplaySubject();
1594
+ const interruptStreaming$ = new import_rxjs3.ReplaySubject();
1595
+ const guardrailsResult$ = new import_rxjs3.ReplaySubject();
1596
+ let outputMessages = [];
1597
+ let resolveOutputMessagesPromise;
1598
+ let rejectOutputMessagesPromise;
1599
+ const outputMessagesPromise = new Promise((resolve, reject) => {
1600
+ resolveOutputMessagesPromise = resolve;
1601
+ rejectOutputMessagesPromise = reject;
1602
+ });
1603
+ logger2.debug("Processing");
1604
+ const { eventSource, threadId = (0, import_shared4.randomId)(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
1605
+ serviceAdapter,
1606
+ messages: data.messages,
1607
+ actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
1608
+ threadId: data.threadId,
1609
+ runId: data.runId,
1610
+ publicApiKey: void 0,
1611
+ outputMessagesPromise,
1612
+ graphqlContext: ctx,
1613
+ forwardedParameters: data.forwardedParameters,
1614
+ agentSession: data.agentSession,
1615
+ agentStates: data.agentStates,
1616
+ url: data.frontend.url
1617
+ });
1618
+ logger2.debug("Event source created, creating response");
1619
+ const response = {
1620
+ threadId,
1621
+ runId,
1622
+ status: (0, import_rxjs3.firstValueFrom)(responseStatus$),
1623
+ messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
1624
+ var _a2, _b2;
1625
+ logger2.debug("Messages repeater created");
1626
+ if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
1627
+ logger2 = logger2.child({
1628
+ guardrails: true
1629
+ });
1630
+ logger2.debug("Guardrails is enabled, validating input");
1631
+ invokeGuardrails({
1632
+ baseUrl: copilotCloudBaseUrl,
1633
+ copilotCloudPublicApiKey,
1634
+ data,
1635
+ onResult: (result) => {
1636
+ logger2.debug({
1637
+ status: result.status
1638
+ }, "Guardrails validation done");
1639
+ guardrailsResult$.next(result);
1640
+ if (result.status === "denied") {
1641
+ responseStatus$.next(new GuardrailsValidationFailureResponse({
1642
+ guardrailsReason: result.reason
1643
+ }));
1644
+ interruptStreaming$.next({
1645
+ reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
1646
+ });
1647
+ outputMessages = [
1648
+ (0, import_class_transformer2.plainToInstance)(TextMessage, {
1649
+ id: (0, import_shared4.randomId)(),
1650
+ createdAt: /* @__PURE__ */ new Date(),
1651
+ content: result.reason,
1652
+ role: MessageRole.assistant
1653
+ })
1654
+ ];
1655
+ resolveOutputMessagesPromise(outputMessages);
1656
+ }
1657
+ },
1658
+ onError: (err) => {
1659
+ logger2.error({
1660
+ err
1661
+ }, "Error in guardrails validation");
1662
+ responseStatus$.next(new UnknownErrorResponse({
1663
+ description: `An unknown error has occurred in the guardrails validation`
1664
+ }));
1665
+ interruptStreaming$.next({
1666
+ reason: `Interrupted due to unknown error in guardrails validation`
1667
+ });
1668
+ rejectOutputMessagesPromise(err);
1669
+ }
1670
+ });
1671
+ }
1672
+ let eventStreamSubscription;
1673
+ const eventStream = eventSource.processRuntimeEvents({
1674
+ serverSideActions,
1675
+ guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null,
1676
+ actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
1677
+ // TODO-AGENTS: do not exclude ALL server side actions
1678
+ (action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
1679
+ )
1680
+ }).pipe(
1681
+ // shareReplay() ensures that later subscribers will see the whole stream instead of
1682
+ // just the events that were emitted after the subscriber was added.
1683
+ (0, import_rxjs3.shareReplay)(),
1684
+ (0, import_rxjs3.finalize)(() => {
1685
+ logger2.debug("Event stream finalized");
1686
+ })
1687
+ );
1688
+ logger2.debug("Event stream created, subscribing to event stream");
1689
+ eventStreamSubscription = eventStream.subscribe({
1690
+ next: async (event) => {
1691
+ switch (event.type) {
1692
+ case RuntimeEventTypes.TextMessageStart:
1693
+ const textMessageContentStream = eventStream.pipe(
1694
+ // skip until this message start event
1695
+ (0, import_rxjs3.skipWhile)((e) => e !== event),
1696
+ // take until the message end event
1697
+ (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
1698
+ // filter out any other message events or message ids
1699
+ (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
1700
+ );
1701
+ const streamingTextStatus = new import_rxjs3.Subject();
1702
+ const messageId = event.messageId;
1703
+ pushMessage({
1704
+ id: messageId,
1705
+ parentMessageId: event.parentMessageId,
1706
+ status: (0, import_rxjs3.firstValueFrom)(streamingTextStatus),
1707
+ createdAt: /* @__PURE__ */ new Date(),
1708
+ role: MessageRole.assistant,
1709
+ content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
1710
+ logger2.debug("Text message content repeater created");
1711
+ const textChunks = [];
1712
+ let textSubscription;
1713
+ interruptStreaming$.pipe((0, import_rxjs3.shareReplay)(), (0, import_rxjs3.take)(1), (0, import_rxjs3.tap)(({ reason, messageId: messageId2 }) => {
1714
+ logger2.debug({
1715
+ reason,
1716
+ messageId: messageId2
1717
+ }, "Text streaming interrupted");
1718
+ streamingTextStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
1719
+ reason
1720
+ }));
1721
+ responseStatus$.next(new MessageStreamInterruptedResponse({
1722
+ messageId: messageId2
1723
+ }));
1724
+ stopStreamingText();
1725
+ textSubscription == null ? void 0 : textSubscription.unsubscribe();
1726
+ })).subscribe();
1727
+ logger2.debug("Subscribing to text message content stream");
1728
+ textSubscription = textMessageContentStream.subscribe({
1729
+ next: async (e) => {
1730
+ if (e.type == RuntimeEventTypes.TextMessageContent) {
1731
+ await pushTextChunk(e.content);
1732
+ textChunks.push(e.content);
1733
+ }
1734
+ },
1735
+ error: (err) => {
1736
+ logger2.error({
1737
+ err
1738
+ }, "Error in text message content stream");
1739
+ interruptStreaming$.next({
1740
+ reason: "Error streaming message content",
1741
+ messageId
1742
+ });
1743
+ stopStreamingText();
1744
+ textSubscription == null ? void 0 : textSubscription.unsubscribe();
1745
+ },
1746
+ complete: () => {
1747
+ logger2.debug("Text message content stream completed");
1748
+ streamingTextStatus.next(new SuccessMessageStatus());
1749
+ stopStreamingText();
1750
+ textSubscription == null ? void 0 : textSubscription.unsubscribe();
1751
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(TextMessage, {
1752
+ id: messageId,
1753
+ createdAt: /* @__PURE__ */ new Date(),
1754
+ content: textChunks.join(""),
1755
+ role: MessageRole.assistant
1756
+ }));
1757
+ }
1758
+ });
1759
+ })
1760
+ });
1761
+ break;
1762
+ case RuntimeEventTypes.ActionExecutionStart:
1763
+ logger2.debug("Action execution start event received");
1764
+ const actionExecutionArgumentStream = eventStream.pipe(
1765
+ (0, import_rxjs3.skipWhile)((e) => e !== event),
1766
+ // take until the action execution end event
1767
+ (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
1768
+ // filter out any other action execution events or action execution ids
1769
+ (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
1770
+ );
1771
+ const streamingArgumentsStatus = new import_rxjs3.Subject();
1772
+ pushMessage({
1773
+ id: event.actionExecutionId,
1774
+ parentMessageId: event.parentMessageId,
1775
+ status: (0, import_rxjs3.firstValueFrom)(streamingArgumentsStatus),
1776
+ createdAt: /* @__PURE__ */ new Date(),
1777
+ name: event.actionName,
1778
+ arguments: new import_graphql_yoga.Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
1779
+ logger2.debug("Action execution argument stream created");
1780
+ const argumentChunks = [];
1781
+ let actionExecutionArgumentSubscription;
1782
+ actionExecutionArgumentSubscription = actionExecutionArgumentStream.subscribe({
1783
+ next: async (e) => {
1784
+ if (e.type == RuntimeEventTypes.ActionExecutionArgs) {
1785
+ await pushArgumentsChunk(e.args);
1786
+ argumentChunks.push(e.args);
1787
+ }
1788
+ },
1789
+ error: (err) => {
1790
+ logger2.error({
1791
+ err
1792
+ }, "Error in action execution argument stream");
1793
+ streamingArgumentsStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
1794
+ reason: "An unknown error has occurred in the action execution argument stream"
1795
+ }));
1796
+ stopStreamingArguments();
1797
+ actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
1798
+ },
1799
+ complete: () => {
1800
+ logger2.debug("Action execution argument stream completed");
1801
+ streamingArgumentsStatus.next(new SuccessMessageStatus());
1802
+ stopStreamingArguments();
1803
+ actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
1804
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
1805
+ id: event.actionExecutionId,
1806
+ createdAt: /* @__PURE__ */ new Date(),
1807
+ name: event.actionName,
1808
+ arguments: argumentChunks.join("")
1809
+ }));
1810
+ }
1811
+ });
1812
+ })
1813
+ });
1814
+ break;
1815
+ case RuntimeEventTypes.ActionExecutionResult:
1816
+ logger2.debug({
1817
+ result: event.result
1818
+ }, "Action execution result event received");
1819
+ pushMessage({
1820
+ id: "result-" + event.actionExecutionId,
1821
+ status: new SuccessMessageStatus(),
1822
+ createdAt: /* @__PURE__ */ new Date(),
1823
+ actionExecutionId: event.actionExecutionId,
1824
+ actionName: event.actionName,
1825
+ result: event.result
1826
+ });
1827
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(ResultMessage, {
1828
+ id: "result-" + event.actionExecutionId,
1829
+ createdAt: /* @__PURE__ */ new Date(),
1830
+ actionExecutionId: event.actionExecutionId,
1831
+ actionName: event.actionName,
1832
+ result: event.result
1833
+ }));
1834
+ break;
1835
+ case RuntimeEventTypes.AgentStateMessage:
1836
+ logger2.debug({
1837
+ event
1838
+ }, "Agent message event received");
1839
+ pushMessage({
1840
+ id: (0, import_shared4.randomId)(),
1841
+ status: new SuccessMessageStatus(),
1842
+ threadId: event.threadId,
1843
+ agentName: event.agentName,
1844
+ nodeName: event.nodeName,
1845
+ runId: event.runId,
1846
+ active: event.active,
1847
+ state: event.state,
1848
+ running: event.running,
1849
+ role: MessageRole.assistant,
1850
+ createdAt: /* @__PURE__ */ new Date()
1851
+ });
1852
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
1853
+ id: (0, import_shared4.randomId)(),
1854
+ threadId: event.threadId,
1855
+ agentName: event.agentName,
1856
+ nodeName: event.nodeName,
1857
+ runId: event.runId,
1858
+ active: event.active,
1859
+ state: event.state,
1860
+ running: event.running,
1861
+ role: MessageRole.assistant,
1862
+ createdAt: /* @__PURE__ */ new Date()
1863
+ }));
1864
+ break;
1865
+ }
1866
+ },
1867
+ error: (err) => {
1868
+ logger2.error({
1869
+ err
1870
+ }, "Error in event stream");
1871
+ responseStatus$.next(new UnknownErrorResponse({
1872
+ description: `An unknown error has occurred in the event stream`
1873
+ }));
1874
+ eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
1875
+ stopStreamingMessages();
1876
+ rejectOutputMessagesPromise(err);
1877
+ },
1878
+ complete: async () => {
1879
+ var _a3;
1880
+ logger2.debug("Event stream completed");
1881
+ if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
1882
+ logger2.debug("Guardrails is enabled, waiting for guardrails result");
1883
+ await (0, import_rxjs3.firstValueFrom)(guardrailsResult$);
1884
+ }
1885
+ responseStatus$.next(new SuccessResponseStatus());
1886
+ eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
1887
+ stopStreamingMessages();
1888
+ resolveOutputMessagesPromise(outputMessages);
1889
+ }
1890
+ });
1891
+ })
1892
+ };
1893
+ return response;
1894
+ }
1895
+ };
1896
+ __name(CopilotResolver, "CopilotResolver");
1897
+ _ts_decorate15([
1898
+ (0, import_type_graphql16.Query)(() => String),
1899
+ _ts_metadata15("design:type", Function),
1900
+ _ts_metadata15("design:paramtypes", []),
1901
+ _ts_metadata15("design:returntype", Promise)
1902
+ ], CopilotResolver.prototype, "hello", null);
1903
+ _ts_decorate15([
1904
+ (0, import_type_graphql16.Query)(() => AgentsResponse),
1905
+ _ts_param(0, (0, import_type_graphql16.Ctx)()),
1906
+ _ts_metadata15("design:type", Function),
1907
+ _ts_metadata15("design:paramtypes", [
1908
+ typeof GraphQLContext === "undefined" ? Object : GraphQLContext
1909
+ ]),
1910
+ _ts_metadata15("design:returntype", Promise)
1911
+ ], CopilotResolver.prototype, "availableAgents", null);
1912
+ _ts_decorate15([
1913
+ (0, import_type_graphql16.Mutation)(() => CopilotResponse),
1914
+ _ts_param(0, (0, import_type_graphql16.Ctx)()),
1915
+ _ts_param(1, (0, import_type_graphql16.Arg)("data")),
1916
+ _ts_param(2, (0, import_type_graphql16.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
1917
+ nullable: true
1918
+ })),
1919
+ _ts_metadata15("design:type", Function),
1920
+ _ts_metadata15("design:paramtypes", [
1921
+ typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
1922
+ typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
1923
+ typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
1924
+ ]),
1925
+ _ts_metadata15("design:returntype", Promise)
1926
+ ], CopilotResolver.prototype, "generateCopilotResponse", null);
1927
+ CopilotResolver = _ts_decorate15([
1928
+ (0, import_type_graphql16.Resolver)(() => CopilotResponse)
1929
+ ], CopilotResolver);
1930
+
1931
+ // src/lib/integrations/shared.ts
1932
+ var import_plugin_defer_stream = require("@graphql-yoga/plugin-defer-stream");
1933
+
1934
+ // src/lib/logger.ts
1935
+ var import_pino = __toESM(require("pino"));
1936
+ var import_pino_pretty = __toESM(require("pino-pretty"));
1937
+ function createLogger(options) {
1938
+ const { level, component } = options || {};
1939
+ const stream = (0, import_pino_pretty.default)({
1940
+ colorize: true
1941
+ });
1942
+ const logger2 = (0, import_pino.default)({
1943
+ level: process.env.LOG_LEVEL || level || "error",
1944
+ redact: {
1945
+ paths: [
1946
+ "pid",
1947
+ "hostname"
1948
+ ],
1949
+ remove: true
1950
+ }
1951
+ }, stream);
1952
+ if (component) {
1953
+ return logger2.child({
1954
+ component
1955
+ });
1956
+ } else {
1957
+ return logger2;
1958
+ }
1959
+ }
1960
+ __name(createLogger, "createLogger");
1961
+
1962
+ // src/lib/integrations/shared.ts
1963
+ var logger = createLogger();
1964
+ async function createContext(initialContext, copilotKitContext, contextLogger, properties = {}) {
1965
+ logger.debug({
1966
+ copilotKitContext
1967
+ }, "Creating GraphQL context");
1968
+ const ctx = {
1969
+ ...initialContext,
1970
+ _copilotkit: {
1971
+ ...copilotKitContext
1972
+ },
1973
+ properties: {
1974
+ ...properties
1975
+ },
1976
+ logger: contextLogger
1977
+ };
1978
+ return ctx;
1979
+ }
1980
+ __name(createContext, "createContext");
1981
+ function buildSchema(options = {}) {
1982
+ logger.debug("Building GraphQL schema...");
1983
+ const schema = (0, import_type_graphql17.buildSchemaSync)({
1984
+ resolvers: [
1985
+ CopilotResolver
1986
+ ],
1987
+ emitSchemaFile: options.emitSchemaFile
1988
+ });
1989
+ logger.debug("GraphQL schema built successfully");
1990
+ return schema;
1991
+ }
1992
+ __name(buildSchema, "buildSchema");
1993
+ function getCommonConfig(options) {
1994
+ var _a;
1995
+ const logLevel = process.env.LOG_LEVEL || options.logLevel || "error";
1996
+ const logger2 = createLogger({
1997
+ level: logLevel,
1998
+ component: "getCommonConfig"
1999
+ });
2000
+ const contextLogger = createLogger({
2001
+ level: logLevel
2002
+ });
2003
+ if (options.cloud) {
2004
+ telemetry_client_default.setCloudConfiguration({
2005
+ publicApiKey: options.cloud.publicApiKey,
2006
+ baseUrl: options.cloud.baseUrl
2007
+ });
2008
+ }
2009
+ if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2010
+ telemetry_client_default.setGlobalProperties({
2011
+ _copilotkit: {
2012
+ ...options.properties._copilotkit
2013
+ }
2014
+ });
2015
+ }
2016
+ telemetry_client_default.setGlobalProperties({
2017
+ runtime: {
2018
+ serviceAdapter: options.serviceAdapter.constructor.name
2019
+ }
2020
+ });
2021
+ return {
2022
+ logging: createLogger({
2023
+ component: "Yoga GraphQL",
2024
+ level: logLevel
2025
+ }),
2026
+ schema: buildSchema(),
2027
+ plugins: [
2028
+ (0, import_plugin_defer_stream.useDeferStream)()
2029
+ ],
2030
+ context: (ctx) => createContext(ctx, options, contextLogger, options.properties)
2031
+ };
2032
+ }
2033
+ __name(getCommonConfig, "getCommonConfig");
2034
+
2035
+ // src/lib/integrations/node-http/index.ts
2036
+ function copilotRuntimeNodeHttpEndpoint(options) {
2037
+ var _a;
2038
+ const commonConfig = getCommonConfig(options);
2039
+ telemetry_client_default.setGlobalProperties({
2040
+ runtime: {
2041
+ framework: "node-http"
2042
+ }
2043
+ });
2044
+ if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2045
+ telemetry_client_default.setGlobalProperties({
2046
+ _copilotkit: options.properties._copilotkit
2047
+ });
2048
+ }
2049
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
2050
+ const logger2 = commonConfig.logging;
2051
+ logger2.debug("Creating Node HTTP endpoint");
2052
+ const yoga = (0, import_graphql_yoga2.createYoga)({
2053
+ ...commonConfig,
2054
+ graphqlEndpoint: options.endpoint
2055
+ });
2056
+ return yoga;
2057
+ }
2058
+ __name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
2059
+
2060
+ // src/lib/integrations/node-express/index.ts
2061
+ function copilotRuntimeNodeExpressEndpoint(options) {
2062
+ telemetry_client_default.setGlobalProperties({
2063
+ runtime: {
2064
+ framework: "node-express"
2065
+ }
2066
+ });
2067
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
2068
+ return copilotRuntimeNodeHttpEndpoint(options);
2069
+ }
2070
+ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
2071
+ // Annotate the CommonJS export names for ESM import in node:
2072
+ 0 && (module.exports = {
2073
+ copilotRuntimeNodeExpressEndpoint
2074
+ });
2075
+ //# sourceMappingURL=index.js.map