@copilotkit/runtime 0.0.0-mme-load-agent-state-20250117154700

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 (176) hide show
  1. package/.eslintrc.js +7 -0
  2. package/CHANGELOG.md +929 -0
  3. package/README.md +46 -0
  4. package/__snapshots__/schema/schema.graphql +306 -0
  5. package/dist/chunk-44O2JGUY.mjs +12 -0
  6. package/dist/chunk-44O2JGUY.mjs.map +1 -0
  7. package/dist/chunk-4BWLNVK4.mjs +80 -0
  8. package/dist/chunk-4BWLNVK4.mjs.map +1 -0
  9. package/dist/chunk-4QJA7OT2.mjs +3395 -0
  10. package/dist/chunk-4QJA7OT2.mjs.map +1 -0
  11. package/dist/chunk-4YJIXJLO.mjs +25 -0
  12. package/dist/chunk-4YJIXJLO.mjs.map +1 -0
  13. package/dist/chunk-67KK2GZ5.mjs +3765 -0
  14. package/dist/chunk-67KK2GZ5.mjs.map +1 -0
  15. package/dist/chunk-7BOVBWKI.mjs +25 -0
  16. package/dist/chunk-7BOVBWKI.mjs.map +1 -0
  17. package/dist/chunk-B5KHNAW5.mjs +25 -0
  18. package/dist/chunk-B5KHNAW5.mjs.map +1 -0
  19. package/dist/chunk-CLGKEUOA.mjs +1408 -0
  20. package/dist/chunk-CLGKEUOA.mjs.map +1 -0
  21. package/dist/chunk-D2WLFQS6.mjs +43 -0
  22. package/dist/chunk-D2WLFQS6.mjs.map +1 -0
  23. package/dist/chunk-DFOKBSIS.mjs +1 -0
  24. package/dist/chunk-DFOKBSIS.mjs.map +1 -0
  25. package/dist/chunk-DKLATJGV.mjs +25 -0
  26. package/dist/chunk-DKLATJGV.mjs.map +1 -0
  27. package/dist/chunk-FYONHPZL.mjs +3397 -0
  28. package/dist/chunk-FYONHPZL.mjs.map +1 -0
  29. package/dist/chunk-HNUNXFTW.mjs +129 -0
  30. package/dist/chunk-HNUNXFTW.mjs.map +1 -0
  31. package/dist/chunk-OKUXS4SE.mjs +25 -0
  32. package/dist/chunk-OKUXS4SE.mjs.map +1 -0
  33. package/dist/chunk-P4PPTGPJ.mjs +25 -0
  34. package/dist/chunk-P4PPTGPJ.mjs.map +1 -0
  35. package/dist/chunk-RFF5IIZJ.mjs +66 -0
  36. package/dist/chunk-RFF5IIZJ.mjs.map +1 -0
  37. package/dist/chunk-U3V2BCGI.mjs +152 -0
  38. package/dist/chunk-U3V2BCGI.mjs.map +1 -0
  39. package/dist/chunk-U7EKYV47.mjs +80 -0
  40. package/dist/chunk-U7EKYV47.mjs.map +1 -0
  41. package/dist/chunk-XXYYCH4X.mjs +80 -0
  42. package/dist/chunk-XXYYCH4X.mjs.map +1 -0
  43. package/dist/chunk-YT7A6V5T.mjs +1420 -0
  44. package/dist/chunk-YT7A6V5T.mjs.map +1 -0
  45. package/dist/copilot-runtime-36700e00.d.ts +196 -0
  46. package/dist/copilot-runtime-8c442d65.d.ts +209 -0
  47. package/dist/graphql/types/base/index.d.ts +6 -0
  48. package/dist/graphql/types/base/index.js +63 -0
  49. package/dist/graphql/types/base/index.js.map +1 -0
  50. package/dist/graphql/types/base/index.mjs +8 -0
  51. package/dist/graphql/types/base/index.mjs.map +1 -0
  52. package/dist/graphql/types/converted/index.d.ts +2 -0
  53. package/dist/graphql/types/converted/index.js +187 -0
  54. package/dist/graphql/types/converted/index.js.map +1 -0
  55. package/dist/graphql/types/converted/index.mjs +17 -0
  56. package/dist/graphql/types/converted/index.mjs.map +1 -0
  57. package/dist/groq-adapter-696b5d29.d.ts +281 -0
  58. package/dist/groq-adapter-7a82cd22.d.ts +301 -0
  59. package/dist/index-a7f37670.d.ts +103 -0
  60. package/dist/index-cc2b17be.d.ts +87 -0
  61. package/dist/index.d.ts +23 -0
  62. package/dist/index.js +5597 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/index.mjs +76 -0
  65. package/dist/index.mjs.map +1 -0
  66. package/dist/langserve-9125a12e.d.ts +176 -0
  67. package/dist/langserve-e308c437.d.ts +209 -0
  68. package/dist/lib/cloud/index.d.ts +6 -0
  69. package/dist/lib/cloud/index.js +18 -0
  70. package/dist/lib/cloud/index.js.map +1 -0
  71. package/dist/lib/cloud/index.mjs +1 -0
  72. package/dist/lib/cloud/index.mjs.map +1 -0
  73. package/dist/lib/index.d.ts +20 -0
  74. package/dist/lib/index.js +5256 -0
  75. package/dist/lib/index.js.map +1 -0
  76. package/dist/lib/index.mjs +58 -0
  77. package/dist/lib/index.mjs.map +1 -0
  78. package/dist/lib/integrations/index.d.ts +33 -0
  79. package/dist/lib/integrations/index.js +2488 -0
  80. package/dist/lib/integrations/index.js.map +1 -0
  81. package/dist/lib/integrations/index.mjs +34 -0
  82. package/dist/lib/integrations/index.mjs.map +1 -0
  83. package/dist/lib/integrations/nest/index.d.ts +14 -0
  84. package/dist/lib/integrations/nest/index.js +2397 -0
  85. package/dist/lib/integrations/nest/index.js.map +1 -0
  86. package/dist/lib/integrations/nest/index.mjs +13 -0
  87. package/dist/lib/integrations/nest/index.mjs.map +1 -0
  88. package/dist/lib/integrations/node-express/index.d.ts +14 -0
  89. package/dist/lib/integrations/node-express/index.js +2397 -0
  90. package/dist/lib/integrations/node-express/index.js.map +1 -0
  91. package/dist/lib/integrations/node-express/index.mjs +13 -0
  92. package/dist/lib/integrations/node-express/index.mjs.map +1 -0
  93. package/dist/lib/integrations/node-http/index.d.ts +14 -0
  94. package/dist/lib/integrations/node-http/index.js +2383 -0
  95. package/dist/lib/integrations/node-http/index.js.map +1 -0
  96. package/dist/lib/integrations/node-http/index.mjs +12 -0
  97. package/dist/lib/integrations/node-http/index.mjs.map +1 -0
  98. package/dist/service-adapters/index.d.ts +84 -0
  99. package/dist/service-adapters/index.js +1460 -0
  100. package/dist/service-adapters/index.js.map +1 -0
  101. package/dist/service-adapters/index.mjs +26 -0
  102. package/dist/service-adapters/index.mjs.map +1 -0
  103. package/dist/utils/index.d.ts +49 -0
  104. package/dist/utils/index.js +174 -0
  105. package/dist/utils/index.js.map +1 -0
  106. package/dist/utils/index.mjs +12 -0
  107. package/dist/utils/index.mjs.map +1 -0
  108. package/jest.config.js +5 -0
  109. package/package.json +85 -0
  110. package/scripts/generate-gql-schema.ts +13 -0
  111. package/src/agents/langgraph/event-source.ts +287 -0
  112. package/src/agents/langgraph/events.ts +338 -0
  113. package/src/graphql/inputs/action.input.ts +16 -0
  114. package/src/graphql/inputs/agent-session.input.ts +13 -0
  115. package/src/graphql/inputs/agent-state.input.ts +10 -0
  116. package/src/graphql/inputs/cloud-guardrails.input.ts +16 -0
  117. package/src/graphql/inputs/cloud.input.ts +8 -0
  118. package/src/graphql/inputs/context-property.input.ts +10 -0
  119. package/src/graphql/inputs/custom-property.input.ts +15 -0
  120. package/src/graphql/inputs/extensions.input.ts +21 -0
  121. package/src/graphql/inputs/forwarded-parameters.input.ts +22 -0
  122. package/src/graphql/inputs/frontend.input.ts +14 -0
  123. package/src/graphql/inputs/generate-copilot-response.input.ts +51 -0
  124. package/src/graphql/inputs/load-agent-state.input.ts +10 -0
  125. package/src/graphql/inputs/message.input.ts +92 -0
  126. package/src/graphql/resolvers/copilot.resolver.ts +561 -0
  127. package/src/graphql/resolvers/state.resolver.ts +23 -0
  128. package/src/graphql/types/agents-response.type.ts +19 -0
  129. package/src/graphql/types/base/index.ts +10 -0
  130. package/src/graphql/types/converted/index.ts +136 -0
  131. package/src/graphql/types/copilot-response.type.ts +117 -0
  132. package/src/graphql/types/enums.ts +37 -0
  133. package/src/graphql/types/extensions-response.type.ts +23 -0
  134. package/src/graphql/types/guardrails-result.type.ts +20 -0
  135. package/src/graphql/types/load-agent-state-response.type.ts +17 -0
  136. package/src/graphql/types/message-status.type.ts +40 -0
  137. package/src/graphql/types/response-status.type.ts +66 -0
  138. package/src/index.ts +4 -0
  139. package/src/lib/cloud/index.ts +4 -0
  140. package/src/lib/index.ts +8 -0
  141. package/src/lib/integrations/index.ts +6 -0
  142. package/src/lib/integrations/nest/index.ts +17 -0
  143. package/src/lib/integrations/nextjs/app-router.ts +40 -0
  144. package/src/lib/integrations/nextjs/pages-router.ts +49 -0
  145. package/src/lib/integrations/node-express/index.ts +17 -0
  146. package/src/lib/integrations/node-http/index.ts +34 -0
  147. package/src/lib/integrations/shared.ts +110 -0
  148. package/src/lib/logger.ts +28 -0
  149. package/src/lib/runtime/copilot-runtime.ts +571 -0
  150. package/src/lib/runtime/remote-action-constructors.ts +304 -0
  151. package/src/lib/runtime/remote-actions.ts +174 -0
  152. package/src/lib/runtime/remote-lg-action.ts +669 -0
  153. package/src/lib/telemetry-client.ts +52 -0
  154. package/src/service-adapters/anthropic/anthropic-adapter.ts +204 -0
  155. package/src/service-adapters/anthropic/utils.ts +144 -0
  156. package/src/service-adapters/conversion.ts +64 -0
  157. package/src/service-adapters/events.ts +424 -0
  158. package/src/service-adapters/experimental/empty/empty-adapter.ts +33 -0
  159. package/src/service-adapters/experimental/ollama/ollama-adapter.ts +79 -0
  160. package/src/service-adapters/google/google-genai-adapter.ts +39 -0
  161. package/src/service-adapters/groq/groq-adapter.ts +173 -0
  162. package/src/service-adapters/index.ts +16 -0
  163. package/src/service-adapters/langchain/langchain-adapter.ts +106 -0
  164. package/src/service-adapters/langchain/langserve.ts +87 -0
  165. package/src/service-adapters/langchain/types.ts +14 -0
  166. package/src/service-adapters/langchain/utils.ts +306 -0
  167. package/src/service-adapters/openai/openai-adapter.ts +211 -0
  168. package/src/service-adapters/openai/openai-assistant-adapter.ts +315 -0
  169. package/src/service-adapters/openai/utils.ts +161 -0
  170. package/src/service-adapters/service-adapter.ts +34 -0
  171. package/src/service-adapters/unify/unify-adapter.ts +144 -0
  172. package/src/utils/failed-response-status-reasons.ts +48 -0
  173. package/src/utils/index.ts +1 -0
  174. package/tsconfig.json +11 -0
  175. package/tsup.config.ts +16 -0
  176. package/typedoc.json +4 -0
@@ -0,0 +1,2397 @@
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.12-next.4",
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/nest/index.ts
125
+ var nest_exports = {};
126
+ __export(nest_exports, {
127
+ copilotRuntimeNestEndpoint: () => copilotRuntimeNestEndpoint
128
+ });
129
+ module.exports = __toCommonJS(nest_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_graphql24 = require("type-graphql");
136
+
137
+ // src/graphql/resolvers/copilot.resolver.ts
138
+ var import_type_graphql18 = require("type-graphql");
139
+ var import_rxjs3 = require("rxjs");
140
+
141
+ // src/graphql/inputs/generate-copilot-response.input.ts
142
+ var import_type_graphql12 = 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/extensions.input.ts
732
+ var import_type_graphql11 = require("type-graphql");
733
+ function _ts_decorate10(decorators, target, key, desc) {
734
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
735
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
736
+ r = Reflect.decorate(decorators, target, key, desc);
737
+ else
738
+ for (var i = decorators.length - 1; i >= 0; i--)
739
+ if (d = decorators[i])
740
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
741
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
742
+ }
743
+ __name(_ts_decorate10, "_ts_decorate");
744
+ function _ts_metadata10(k, v) {
745
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
746
+ return Reflect.metadata(k, v);
747
+ }
748
+ __name(_ts_metadata10, "_ts_metadata");
749
+ var ExtensionsInput = class {
750
+ openaiAssistantAPI;
751
+ };
752
+ __name(ExtensionsInput, "ExtensionsInput");
753
+ _ts_decorate10([
754
+ (0, import_type_graphql11.Field)(() => OpenAIApiAssistantAPIInput, {
755
+ nullable: true
756
+ }),
757
+ _ts_metadata10("design:type", typeof OpenAIApiAssistantAPIInput === "undefined" ? Object : OpenAIApiAssistantAPIInput)
758
+ ], ExtensionsInput.prototype, "openaiAssistantAPI", void 0);
759
+ ExtensionsInput = _ts_decorate10([
760
+ (0, import_type_graphql11.InputType)()
761
+ ], ExtensionsInput);
762
+ var OpenAIApiAssistantAPIInput = class {
763
+ runId;
764
+ threadId;
765
+ };
766
+ __name(OpenAIApiAssistantAPIInput, "OpenAIApiAssistantAPIInput");
767
+ _ts_decorate10([
768
+ (0, import_type_graphql11.Field)(() => String, {
769
+ nullable: true
770
+ }),
771
+ _ts_metadata10("design:type", String)
772
+ ], OpenAIApiAssistantAPIInput.prototype, "runId", void 0);
773
+ _ts_decorate10([
774
+ (0, import_type_graphql11.Field)(() => String, {
775
+ nullable: true
776
+ }),
777
+ _ts_metadata10("design:type", String)
778
+ ], OpenAIApiAssistantAPIInput.prototype, "threadId", void 0);
779
+ OpenAIApiAssistantAPIInput = _ts_decorate10([
780
+ (0, import_type_graphql11.InputType)()
781
+ ], OpenAIApiAssistantAPIInput);
782
+
783
+ // src/graphql/inputs/generate-copilot-response.input.ts
784
+ function _ts_decorate11(decorators, target, key, desc) {
785
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
786
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
787
+ r = Reflect.decorate(decorators, target, key, desc);
788
+ else
789
+ for (var i = decorators.length - 1; i >= 0; i--)
790
+ if (d = decorators[i])
791
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
792
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
793
+ }
794
+ __name(_ts_decorate11, "_ts_decorate");
795
+ function _ts_metadata11(k, v) {
796
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
797
+ return Reflect.metadata(k, v);
798
+ }
799
+ __name(_ts_metadata11, "_ts_metadata");
800
+ var GenerateCopilotResponseMetadataInput = class {
801
+ requestType;
802
+ };
803
+ __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
804
+ _ts_decorate11([
805
+ (0, import_type_graphql12.Field)(() => CopilotRequestType, {
806
+ nullable: true
807
+ }),
808
+ _ts_metadata11("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
809
+ ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
810
+ GenerateCopilotResponseMetadataInput = _ts_decorate11([
811
+ (0, import_type_graphql12.InputType)()
812
+ ], GenerateCopilotResponseMetadataInput);
813
+ var GenerateCopilotResponseInput = class {
814
+ metadata;
815
+ threadId;
816
+ runId;
817
+ messages;
818
+ frontend;
819
+ cloud;
820
+ forwardedParameters;
821
+ agentSession;
822
+ agentState;
823
+ agentStates;
824
+ extensions;
825
+ };
826
+ __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
827
+ _ts_decorate11([
828
+ (0, import_type_graphql12.Field)(() => GenerateCopilotResponseMetadataInput, {
829
+ nullable: false
830
+ }),
831
+ _ts_metadata11("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
832
+ ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
833
+ _ts_decorate11([
834
+ (0, import_type_graphql12.Field)(() => String, {
835
+ nullable: true
836
+ }),
837
+ _ts_metadata11("design:type", String)
838
+ ], GenerateCopilotResponseInput.prototype, "threadId", void 0);
839
+ _ts_decorate11([
840
+ (0, import_type_graphql12.Field)(() => String, {
841
+ nullable: true
842
+ }),
843
+ _ts_metadata11("design:type", String)
844
+ ], GenerateCopilotResponseInput.prototype, "runId", void 0);
845
+ _ts_decorate11([
846
+ (0, import_type_graphql12.Field)(() => [
847
+ MessageInput
848
+ ]),
849
+ _ts_metadata11("design:type", Array)
850
+ ], GenerateCopilotResponseInput.prototype, "messages", void 0);
851
+ _ts_decorate11([
852
+ (0, import_type_graphql12.Field)(() => FrontendInput),
853
+ _ts_metadata11("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
854
+ ], GenerateCopilotResponseInput.prototype, "frontend", void 0);
855
+ _ts_decorate11([
856
+ (0, import_type_graphql12.Field)(() => CloudInput, {
857
+ nullable: true
858
+ }),
859
+ _ts_metadata11("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
860
+ ], GenerateCopilotResponseInput.prototype, "cloud", void 0);
861
+ _ts_decorate11([
862
+ (0, import_type_graphql12.Field)(() => ForwardedParametersInput, {
863
+ nullable: true
864
+ }),
865
+ _ts_metadata11("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
866
+ ], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
867
+ _ts_decorate11([
868
+ (0, import_type_graphql12.Field)(() => AgentSessionInput, {
869
+ nullable: true
870
+ }),
871
+ _ts_metadata11("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
872
+ ], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
873
+ _ts_decorate11([
874
+ (0, import_type_graphql12.Field)(() => AgentStateInput, {
875
+ nullable: true
876
+ }),
877
+ _ts_metadata11("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
878
+ ], GenerateCopilotResponseInput.prototype, "agentState", void 0);
879
+ _ts_decorate11([
880
+ (0, import_type_graphql12.Field)(() => [
881
+ AgentStateInput
882
+ ], {
883
+ nullable: true
884
+ }),
885
+ _ts_metadata11("design:type", Array)
886
+ ], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
887
+ _ts_decorate11([
888
+ (0, import_type_graphql12.Field)(() => ExtensionsInput, {
889
+ nullable: true
890
+ }),
891
+ _ts_metadata11("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
892
+ ], GenerateCopilotResponseInput.prototype, "extensions", void 0);
893
+ GenerateCopilotResponseInput = _ts_decorate11([
894
+ (0, import_type_graphql12.InputType)()
895
+ ], GenerateCopilotResponseInput);
896
+
897
+ // src/graphql/types/copilot-response.type.ts
898
+ var import_type_graphql16 = require("type-graphql");
899
+
900
+ // src/graphql/types/message-status.type.ts
901
+ var import_type_graphql13 = require("type-graphql");
902
+ function _ts_decorate12(decorators, target, key, desc) {
903
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
904
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
905
+ r = Reflect.decorate(decorators, target, key, desc);
906
+ else
907
+ for (var i = decorators.length - 1; i >= 0; i--)
908
+ if (d = decorators[i])
909
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
910
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
911
+ }
912
+ __name(_ts_decorate12, "_ts_decorate");
913
+ function _ts_metadata12(k, v) {
914
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
915
+ return Reflect.metadata(k, v);
916
+ }
917
+ __name(_ts_metadata12, "_ts_metadata");
918
+ var MessageStatusCode;
919
+ (function(MessageStatusCode2) {
920
+ MessageStatusCode2["Pending"] = "pending";
921
+ MessageStatusCode2["Success"] = "success";
922
+ MessageStatusCode2["Failed"] = "failed";
923
+ })(MessageStatusCode || (MessageStatusCode = {}));
924
+ (0, import_type_graphql13.registerEnumType)(MessageStatusCode, {
925
+ name: "MessageStatusCode"
926
+ });
927
+ var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
928
+ code;
929
+ }, "BaseMessageStatus");
930
+ _ts_decorate12([
931
+ (0, import_type_graphql13.Field)(() => MessageStatusCode),
932
+ _ts_metadata12("design:type", String)
933
+ ], BaseMessageStatus.prototype, "code", void 0);
934
+ BaseMessageStatus = _ts_decorate12([
935
+ (0, import_type_graphql13.ObjectType)()
936
+ ], BaseMessageStatus);
937
+ var PendingMessageStatus = class extends BaseMessageStatus {
938
+ code = "pending";
939
+ };
940
+ __name(PendingMessageStatus, "PendingMessageStatus");
941
+ PendingMessageStatus = _ts_decorate12([
942
+ (0, import_type_graphql13.ObjectType)()
943
+ ], PendingMessageStatus);
944
+ var SuccessMessageStatus = class extends BaseMessageStatus {
945
+ code = "success";
946
+ };
947
+ __name(SuccessMessageStatus, "SuccessMessageStatus");
948
+ SuccessMessageStatus = _ts_decorate12([
949
+ (0, import_type_graphql13.ObjectType)()
950
+ ], SuccessMessageStatus);
951
+ var FailedMessageStatus = class extends BaseMessageStatus {
952
+ code = "failed";
953
+ reason;
954
+ };
955
+ __name(FailedMessageStatus, "FailedMessageStatus");
956
+ _ts_decorate12([
957
+ (0, import_type_graphql13.Field)(() => String),
958
+ _ts_metadata12("design:type", String)
959
+ ], FailedMessageStatus.prototype, "reason", void 0);
960
+ FailedMessageStatus = _ts_decorate12([
961
+ (0, import_type_graphql13.ObjectType)()
962
+ ], FailedMessageStatus);
963
+ var MessageStatusUnion = (0, import_type_graphql13.createUnionType)({
964
+ name: "MessageStatus",
965
+ types: () => [
966
+ PendingMessageStatus,
967
+ SuccessMessageStatus,
968
+ FailedMessageStatus
969
+ ]
970
+ });
971
+
972
+ // src/graphql/types/response-status.type.ts
973
+ var import_graphql_scalars = require("graphql-scalars");
974
+ var import_type_graphql14 = require("type-graphql");
975
+ function _ts_decorate13(decorators, target, key, desc) {
976
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
977
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
978
+ r = Reflect.decorate(decorators, target, key, desc);
979
+ else
980
+ for (var i = decorators.length - 1; i >= 0; i--)
981
+ if (d = decorators[i])
982
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
983
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
984
+ }
985
+ __name(_ts_decorate13, "_ts_decorate");
986
+ function _ts_metadata13(k, v) {
987
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
988
+ return Reflect.metadata(k, v);
989
+ }
990
+ __name(_ts_metadata13, "_ts_metadata");
991
+ var ResponseStatusCode;
992
+ (function(ResponseStatusCode2) {
993
+ ResponseStatusCode2["Pending"] = "pending";
994
+ ResponseStatusCode2["Success"] = "success";
995
+ ResponseStatusCode2["Failed"] = "failed";
996
+ })(ResponseStatusCode || (ResponseStatusCode = {}));
997
+ (0, import_type_graphql14.registerEnumType)(ResponseStatusCode, {
998
+ name: "ResponseStatusCode"
999
+ });
1000
+ var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
1001
+ code;
1002
+ }, "BaseResponseStatus");
1003
+ _ts_decorate13([
1004
+ (0, import_type_graphql14.Field)(() => ResponseStatusCode),
1005
+ _ts_metadata13("design:type", String)
1006
+ ], BaseResponseStatus.prototype, "code", void 0);
1007
+ BaseResponseStatus = _ts_decorate13([
1008
+ (0, import_type_graphql14.InterfaceType)({
1009
+ resolveType(value) {
1010
+ if (value.code === "success") {
1011
+ return SuccessResponseStatus;
1012
+ } else if (value.code === "failed") {
1013
+ return FailedResponseStatus;
1014
+ } else if (value.code === "pending") {
1015
+ return PendingResponseStatus;
1016
+ }
1017
+ return void 0;
1018
+ }
1019
+ }),
1020
+ (0, import_type_graphql14.ObjectType)()
1021
+ ], BaseResponseStatus);
1022
+ var PendingResponseStatus = class extends BaseResponseStatus {
1023
+ code = "pending";
1024
+ };
1025
+ __name(PendingResponseStatus, "PendingResponseStatus");
1026
+ PendingResponseStatus = _ts_decorate13([
1027
+ (0, import_type_graphql14.ObjectType)({
1028
+ implements: BaseResponseStatus
1029
+ })
1030
+ ], PendingResponseStatus);
1031
+ var SuccessResponseStatus = class extends BaseResponseStatus {
1032
+ code = "success";
1033
+ };
1034
+ __name(SuccessResponseStatus, "SuccessResponseStatus");
1035
+ SuccessResponseStatus = _ts_decorate13([
1036
+ (0, import_type_graphql14.ObjectType)({
1037
+ implements: BaseResponseStatus
1038
+ })
1039
+ ], SuccessResponseStatus);
1040
+ var FailedResponseStatusReason;
1041
+ (function(FailedResponseStatusReason2) {
1042
+ FailedResponseStatusReason2["GUARDRAILS_VALIDATION_FAILED"] = "GUARDRAILS_VALIDATION_FAILED";
1043
+ FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
1044
+ FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
1045
+ })(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
1046
+ (0, import_type_graphql14.registerEnumType)(FailedResponseStatusReason, {
1047
+ name: "FailedResponseStatusReason"
1048
+ });
1049
+ var FailedResponseStatus = class extends BaseResponseStatus {
1050
+ code = "failed";
1051
+ reason;
1052
+ details = null;
1053
+ };
1054
+ __name(FailedResponseStatus, "FailedResponseStatus");
1055
+ _ts_decorate13([
1056
+ (0, import_type_graphql14.Field)(() => FailedResponseStatusReason),
1057
+ _ts_metadata13("design:type", String)
1058
+ ], FailedResponseStatus.prototype, "reason", void 0);
1059
+ _ts_decorate13([
1060
+ (0, import_type_graphql14.Field)(() => import_graphql_scalars.GraphQLJSON, {
1061
+ nullable: true
1062
+ }),
1063
+ _ts_metadata13("design:type", typeof Record === "undefined" ? Object : Record)
1064
+ ], FailedResponseStatus.prototype, "details", void 0);
1065
+ FailedResponseStatus = _ts_decorate13([
1066
+ (0, import_type_graphql14.ObjectType)({
1067
+ implements: BaseResponseStatus
1068
+ })
1069
+ ], FailedResponseStatus);
1070
+ var ResponseStatusUnion = (0, import_type_graphql14.createUnionType)({
1071
+ name: "ResponseStatus",
1072
+ types: () => [
1073
+ PendingResponseStatus,
1074
+ SuccessResponseStatus,
1075
+ FailedResponseStatus
1076
+ ]
1077
+ });
1078
+
1079
+ // src/graphql/types/extensions-response.type.ts
1080
+ var import_type_graphql15 = require("type-graphql");
1081
+ function _ts_decorate14(decorators, target, key, desc) {
1082
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1083
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1084
+ r = Reflect.decorate(decorators, target, key, desc);
1085
+ else
1086
+ for (var i = decorators.length - 1; i >= 0; i--)
1087
+ if (d = decorators[i])
1088
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1089
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1090
+ }
1091
+ __name(_ts_decorate14, "_ts_decorate");
1092
+ function _ts_metadata14(k, v) {
1093
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1094
+ return Reflect.metadata(k, v);
1095
+ }
1096
+ __name(_ts_metadata14, "_ts_metadata");
1097
+ var ExtensionsResponse = class {
1098
+ openaiAssistantAPI;
1099
+ };
1100
+ __name(ExtensionsResponse, "ExtensionsResponse");
1101
+ _ts_decorate14([
1102
+ (0, import_type_graphql15.Field)(() => OpenAIApiAssistantAPIResponse, {
1103
+ nullable: true
1104
+ }),
1105
+ _ts_metadata14("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
1106
+ ], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
1107
+ ExtensionsResponse = _ts_decorate14([
1108
+ (0, import_type_graphql15.ObjectType)()
1109
+ ], ExtensionsResponse);
1110
+ var OpenAIApiAssistantAPIResponse = class {
1111
+ runId;
1112
+ threadId;
1113
+ };
1114
+ __name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
1115
+ _ts_decorate14([
1116
+ (0, import_type_graphql15.Field)(() => String, {
1117
+ nullable: true
1118
+ }),
1119
+ _ts_metadata14("design:type", String)
1120
+ ], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
1121
+ _ts_decorate14([
1122
+ (0, import_type_graphql15.Field)(() => String, {
1123
+ nullable: true
1124
+ }),
1125
+ _ts_metadata14("design:type", String)
1126
+ ], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
1127
+ OpenAIApiAssistantAPIResponse = _ts_decorate14([
1128
+ (0, import_type_graphql15.ObjectType)()
1129
+ ], OpenAIApiAssistantAPIResponse);
1130
+
1131
+ // src/graphql/types/copilot-response.type.ts
1132
+ function _ts_decorate15(decorators, target, key, desc) {
1133
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1134
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1135
+ r = Reflect.decorate(decorators, target, key, desc);
1136
+ else
1137
+ for (var i = decorators.length - 1; i >= 0; i--)
1138
+ if (d = decorators[i])
1139
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1140
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1141
+ }
1142
+ __name(_ts_decorate15, "_ts_decorate");
1143
+ function _ts_metadata15(k, v) {
1144
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1145
+ return Reflect.metadata(k, v);
1146
+ }
1147
+ __name(_ts_metadata15, "_ts_metadata");
1148
+ var BaseMessageOutput = class {
1149
+ id;
1150
+ createdAt;
1151
+ status;
1152
+ };
1153
+ __name(BaseMessageOutput, "BaseMessageOutput");
1154
+ _ts_decorate15([
1155
+ (0, import_type_graphql16.Field)(() => String),
1156
+ _ts_metadata15("design:type", String)
1157
+ ], BaseMessageOutput.prototype, "id", void 0);
1158
+ _ts_decorate15([
1159
+ (0, import_type_graphql16.Field)(() => Date),
1160
+ _ts_metadata15("design:type", typeof Date === "undefined" ? Object : Date)
1161
+ ], BaseMessageOutput.prototype, "createdAt", void 0);
1162
+ _ts_decorate15([
1163
+ (0, import_type_graphql16.Field)(() => MessageStatusUnion),
1164
+ _ts_metadata15("design:type", Object)
1165
+ ], BaseMessageOutput.prototype, "status", void 0);
1166
+ BaseMessageOutput = _ts_decorate15([
1167
+ (0, import_type_graphql16.InterfaceType)({
1168
+ resolveType(value) {
1169
+ if (value.hasOwnProperty("content")) {
1170
+ return TextMessageOutput;
1171
+ } else if (value.hasOwnProperty("name")) {
1172
+ return ActionExecutionMessageOutput;
1173
+ } else if (value.hasOwnProperty("result")) {
1174
+ return ResultMessageOutput;
1175
+ } else if (value.hasOwnProperty("state")) {
1176
+ return AgentStateMessageOutput;
1177
+ }
1178
+ return void 0;
1179
+ }
1180
+ })
1181
+ ], BaseMessageOutput);
1182
+ var TextMessageOutput = class {
1183
+ role;
1184
+ content;
1185
+ parentMessageId;
1186
+ };
1187
+ __name(TextMessageOutput, "TextMessageOutput");
1188
+ _ts_decorate15([
1189
+ (0, import_type_graphql16.Field)(() => MessageRole),
1190
+ _ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1191
+ ], TextMessageOutput.prototype, "role", void 0);
1192
+ _ts_decorate15([
1193
+ (0, import_type_graphql16.Field)(() => [
1194
+ String
1195
+ ]),
1196
+ _ts_metadata15("design:type", Array)
1197
+ ], TextMessageOutput.prototype, "content", void 0);
1198
+ _ts_decorate15([
1199
+ (0, import_type_graphql16.Field)(() => String, {
1200
+ nullable: true
1201
+ }),
1202
+ _ts_metadata15("design:type", String)
1203
+ ], TextMessageOutput.prototype, "parentMessageId", void 0);
1204
+ TextMessageOutput = _ts_decorate15([
1205
+ (0, import_type_graphql16.ObjectType)({
1206
+ implements: BaseMessageOutput
1207
+ })
1208
+ ], TextMessageOutput);
1209
+ var ActionExecutionMessageOutput = class {
1210
+ name;
1211
+ scope;
1212
+ arguments;
1213
+ parentMessageId;
1214
+ };
1215
+ __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
1216
+ _ts_decorate15([
1217
+ (0, import_type_graphql16.Field)(() => String),
1218
+ _ts_metadata15("design:type", String)
1219
+ ], ActionExecutionMessageOutput.prototype, "name", void 0);
1220
+ _ts_decorate15([
1221
+ (0, import_type_graphql16.Field)(() => String, {
1222
+ nullable: true,
1223
+ deprecationReason: "This field will be removed in a future version"
1224
+ }),
1225
+ _ts_metadata15("design:type", String)
1226
+ ], ActionExecutionMessageOutput.prototype, "scope", void 0);
1227
+ _ts_decorate15([
1228
+ (0, import_type_graphql16.Field)(() => [
1229
+ String
1230
+ ]),
1231
+ _ts_metadata15("design:type", Array)
1232
+ ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
1233
+ _ts_decorate15([
1234
+ (0, import_type_graphql16.Field)(() => String, {
1235
+ nullable: true
1236
+ }),
1237
+ _ts_metadata15("design:type", String)
1238
+ ], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
1239
+ ActionExecutionMessageOutput = _ts_decorate15([
1240
+ (0, import_type_graphql16.ObjectType)({
1241
+ implements: BaseMessageOutput
1242
+ })
1243
+ ], ActionExecutionMessageOutput);
1244
+ var ResultMessageOutput = class {
1245
+ actionExecutionId;
1246
+ actionName;
1247
+ result;
1248
+ };
1249
+ __name(ResultMessageOutput, "ResultMessageOutput");
1250
+ _ts_decorate15([
1251
+ (0, import_type_graphql16.Field)(() => String),
1252
+ _ts_metadata15("design:type", String)
1253
+ ], ResultMessageOutput.prototype, "actionExecutionId", void 0);
1254
+ _ts_decorate15([
1255
+ (0, import_type_graphql16.Field)(() => String),
1256
+ _ts_metadata15("design:type", String)
1257
+ ], ResultMessageOutput.prototype, "actionName", void 0);
1258
+ _ts_decorate15([
1259
+ (0, import_type_graphql16.Field)(() => String),
1260
+ _ts_metadata15("design:type", String)
1261
+ ], ResultMessageOutput.prototype, "result", void 0);
1262
+ ResultMessageOutput = _ts_decorate15([
1263
+ (0, import_type_graphql16.ObjectType)({
1264
+ implements: BaseMessageOutput
1265
+ })
1266
+ ], ResultMessageOutput);
1267
+ var AgentStateMessageOutput = class {
1268
+ threadId;
1269
+ agentName;
1270
+ nodeName;
1271
+ runId;
1272
+ active;
1273
+ role;
1274
+ state;
1275
+ running;
1276
+ };
1277
+ __name(AgentStateMessageOutput, "AgentStateMessageOutput");
1278
+ _ts_decorate15([
1279
+ (0, import_type_graphql16.Field)(() => String),
1280
+ _ts_metadata15("design:type", String)
1281
+ ], AgentStateMessageOutput.prototype, "threadId", void 0);
1282
+ _ts_decorate15([
1283
+ (0, import_type_graphql16.Field)(() => String),
1284
+ _ts_metadata15("design:type", String)
1285
+ ], AgentStateMessageOutput.prototype, "agentName", void 0);
1286
+ _ts_decorate15([
1287
+ (0, import_type_graphql16.Field)(() => String),
1288
+ _ts_metadata15("design:type", String)
1289
+ ], AgentStateMessageOutput.prototype, "nodeName", void 0);
1290
+ _ts_decorate15([
1291
+ (0, import_type_graphql16.Field)(() => String),
1292
+ _ts_metadata15("design:type", String)
1293
+ ], AgentStateMessageOutput.prototype, "runId", void 0);
1294
+ _ts_decorate15([
1295
+ (0, import_type_graphql16.Field)(() => Boolean),
1296
+ _ts_metadata15("design:type", Boolean)
1297
+ ], AgentStateMessageOutput.prototype, "active", void 0);
1298
+ _ts_decorate15([
1299
+ (0, import_type_graphql16.Field)(() => MessageRole),
1300
+ _ts_metadata15("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1301
+ ], AgentStateMessageOutput.prototype, "role", void 0);
1302
+ _ts_decorate15([
1303
+ (0, import_type_graphql16.Field)(() => String),
1304
+ _ts_metadata15("design:type", String)
1305
+ ], AgentStateMessageOutput.prototype, "state", void 0);
1306
+ _ts_decorate15([
1307
+ (0, import_type_graphql16.Field)(() => Boolean),
1308
+ _ts_metadata15("design:type", Boolean)
1309
+ ], AgentStateMessageOutput.prototype, "running", void 0);
1310
+ AgentStateMessageOutput = _ts_decorate15([
1311
+ (0, import_type_graphql16.ObjectType)({
1312
+ implements: BaseMessageOutput
1313
+ })
1314
+ ], AgentStateMessageOutput);
1315
+ var CopilotResponse = class {
1316
+ threadId;
1317
+ status;
1318
+ runId;
1319
+ messages;
1320
+ extensions;
1321
+ };
1322
+ __name(CopilotResponse, "CopilotResponse");
1323
+ _ts_decorate15([
1324
+ (0, import_type_graphql16.Field)(() => String),
1325
+ _ts_metadata15("design:type", String)
1326
+ ], CopilotResponse.prototype, "threadId", void 0);
1327
+ _ts_decorate15([
1328
+ (0, import_type_graphql16.Field)(() => ResponseStatusUnion),
1329
+ _ts_metadata15("design:type", Object)
1330
+ ], CopilotResponse.prototype, "status", void 0);
1331
+ _ts_decorate15([
1332
+ (0, import_type_graphql16.Field)({
1333
+ nullable: true
1334
+ }),
1335
+ _ts_metadata15("design:type", String)
1336
+ ], CopilotResponse.prototype, "runId", void 0);
1337
+ _ts_decorate15([
1338
+ (0, import_type_graphql16.Field)(() => [
1339
+ BaseMessageOutput
1340
+ ]),
1341
+ _ts_metadata15("design:type", Array)
1342
+ ], CopilotResponse.prototype, "messages", void 0);
1343
+ _ts_decorate15([
1344
+ (0, import_type_graphql16.Field)(() => ExtensionsResponse, {
1345
+ nullable: true
1346
+ }),
1347
+ _ts_metadata15("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
1348
+ ], CopilotResponse.prototype, "extensions", void 0);
1349
+ CopilotResponse = _ts_decorate15([
1350
+ (0, import_type_graphql16.ObjectType)()
1351
+ ], CopilotResponse);
1352
+
1353
+ // src/graphql/resolvers/copilot.resolver.ts
1354
+ var import_graphql_yoga = require("graphql-yoga");
1355
+
1356
+ // src/service-adapters/events.ts
1357
+ var import_shared3 = require("@copilotkit/shared");
1358
+ var import_rxjs2 = require("rxjs");
1359
+
1360
+ // src/lib/telemetry-client.ts
1361
+ var import_shared2 = require("@copilotkit/shared");
1362
+
1363
+ // src/lib/runtime/remote-actions.ts
1364
+ var EndpointType;
1365
+ (function(EndpointType2) {
1366
+ EndpointType2["CopilotKit"] = "copilotKit";
1367
+ EndpointType2["LangGraphPlatform"] = "langgraph-platform";
1368
+ })(EndpointType || (EndpointType = {}));
1369
+
1370
+ // src/lib/telemetry-client.ts
1371
+ var import_node_crypto = require("crypto");
1372
+
1373
+ // src/lib/runtime/copilot-runtime.ts
1374
+ var import_shared = require("@copilotkit/shared");
1375
+
1376
+ // src/graphql/types/converted/index.ts
1377
+ var Message = class extends BaseMessageInput {
1378
+ type;
1379
+ isTextMessage() {
1380
+ return this.type === "TextMessage";
1381
+ }
1382
+ isActionExecutionMessage() {
1383
+ return this.type === "ActionExecutionMessage";
1384
+ }
1385
+ isResultMessage() {
1386
+ return this.type === "ResultMessage";
1387
+ }
1388
+ isAgentStateMessage() {
1389
+ return this.type === "AgentStateMessage";
1390
+ }
1391
+ };
1392
+ __name(Message, "Message");
1393
+ var TextMessage = class extends Message {
1394
+ type = "TextMessage";
1395
+ content;
1396
+ role;
1397
+ parentMessageId;
1398
+ };
1399
+ __name(TextMessage, "TextMessage");
1400
+ var ActionExecutionMessage = class extends Message {
1401
+ type = "ActionExecutionMessage";
1402
+ name;
1403
+ arguments;
1404
+ parentMessageId;
1405
+ };
1406
+ __name(ActionExecutionMessage, "ActionExecutionMessage");
1407
+ var ResultMessage = class extends Message {
1408
+ type = "ResultMessage";
1409
+ actionExecutionId;
1410
+ actionName;
1411
+ result;
1412
+ static encodeResult(result, error) {
1413
+ const errorObj = error ? typeof error === "string" ? {
1414
+ code: "ERROR",
1415
+ message: error
1416
+ } : error instanceof Error ? {
1417
+ code: "ERROR",
1418
+ message: error.message
1419
+ } : error : void 0;
1420
+ if (errorObj) {
1421
+ return JSON.stringify({
1422
+ error: errorObj,
1423
+ result: result || ""
1424
+ });
1425
+ }
1426
+ if (result === void 0) {
1427
+ return "";
1428
+ }
1429
+ return typeof result === "string" ? result : JSON.stringify(result);
1430
+ }
1431
+ static decodeResult(result) {
1432
+ if (!result) {
1433
+ return {
1434
+ result: ""
1435
+ };
1436
+ }
1437
+ try {
1438
+ const parsed = JSON.parse(result);
1439
+ if (parsed && typeof parsed === "object") {
1440
+ if ("error" in parsed) {
1441
+ return {
1442
+ error: parsed.error,
1443
+ result: parsed.result || ""
1444
+ };
1445
+ }
1446
+ return {
1447
+ result: JSON.stringify(parsed)
1448
+ };
1449
+ }
1450
+ return {
1451
+ result
1452
+ };
1453
+ } catch (e) {
1454
+ return {
1455
+ result
1456
+ };
1457
+ }
1458
+ }
1459
+ hasError() {
1460
+ try {
1461
+ const { error } = ResultMessage.decodeResult(this.result);
1462
+ return !!error;
1463
+ } catch {
1464
+ return false;
1465
+ }
1466
+ }
1467
+ getError() {
1468
+ try {
1469
+ const { error } = ResultMessage.decodeResult(this.result);
1470
+ return error;
1471
+ } catch {
1472
+ return void 0;
1473
+ }
1474
+ }
1475
+ };
1476
+ __name(ResultMessage, "ResultMessage");
1477
+ var AgentStateMessage = class extends Message {
1478
+ type = "AgentStateMessage";
1479
+ threadId;
1480
+ agentName;
1481
+ nodeName;
1482
+ runId;
1483
+ active;
1484
+ role;
1485
+ state;
1486
+ running;
1487
+ };
1488
+ __name(AgentStateMessage, "AgentStateMessage");
1489
+
1490
+ // src/lib/runtime/copilot-runtime.ts
1491
+ var import_rxjs = require("rxjs");
1492
+ var import_langgraph_sdk = require("@langchain/langgraph-sdk");
1493
+ function resolveEndpointType(endpoint) {
1494
+ if (!endpoint.type) {
1495
+ if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
1496
+ return EndpointType.LangGraphPlatform;
1497
+ } else {
1498
+ return EndpointType.CopilotKit;
1499
+ }
1500
+ }
1501
+ return endpoint.type;
1502
+ }
1503
+ __name(resolveEndpointType, "resolveEndpointType");
1504
+
1505
+ // src/lib/telemetry-client.ts
1506
+ var packageJson = require_package();
1507
+ var telemetryClient = new import_shared2.TelemetryClient({
1508
+ packageName: packageJson.name,
1509
+ packageVersion: packageJson.version
1510
+ });
1511
+ function getRuntimeInstanceTelemetryInfo(runtime) {
1512
+ const endpointsInfo = runtime.remoteEndpointDefinitions.reduce((acc, endpoint) => {
1513
+ let info = {
1514
+ ...acc
1515
+ };
1516
+ const endpointType = resolveEndpointType(endpoint);
1517
+ if (!info.endpointTypes.includes(endpointType)) {
1518
+ info = {
1519
+ ...info,
1520
+ endpointTypes: [
1521
+ ...info.endpointTypes,
1522
+ endpointType
1523
+ ]
1524
+ };
1525
+ }
1526
+ if (endpointType === EndpointType.LangGraphPlatform) {
1527
+ const ep = endpoint;
1528
+ info = {
1529
+ ...info,
1530
+ agentsAmount: ep.agents.length,
1531
+ hashedKey: (0, import_node_crypto.createHash)("sha256").update(ep.langsmithApiKey).digest("hex")
1532
+ };
1533
+ }
1534
+ return info;
1535
+ }, {
1536
+ endpointTypes: [],
1537
+ agentsAmount: null,
1538
+ hashedKey: null
1539
+ });
1540
+ return {
1541
+ actionsAmount: runtime.actions.length,
1542
+ endpointsAmount: runtime.remoteEndpointDefinitions.length,
1543
+ endpointTypes: endpointsInfo.endpointTypes,
1544
+ agentsAmount: endpointsInfo.agentsAmount,
1545
+ hashedLgcKey: endpointsInfo.hashedKey
1546
+ };
1547
+ }
1548
+ __name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
1549
+ var telemetry_client_default = telemetryClient;
1550
+
1551
+ // src/service-adapters/events.ts
1552
+ var import_class_transformer = require("class-transformer");
1553
+ var RuntimeEventTypes;
1554
+ (function(RuntimeEventTypes2) {
1555
+ RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
1556
+ RuntimeEventTypes2["TextMessageContent"] = "TextMessageContent";
1557
+ RuntimeEventTypes2["TextMessageEnd"] = "TextMessageEnd";
1558
+ RuntimeEventTypes2["ActionExecutionStart"] = "ActionExecutionStart";
1559
+ RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
1560
+ RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
1561
+ RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
1562
+ RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
1563
+ })(RuntimeEventTypes || (RuntimeEventTypes = {}));
1564
+
1565
+ // src/graphql/resolvers/copilot.resolver.ts
1566
+ var import_graphql_scalars2 = require("graphql-scalars");
1567
+ var import_class_transformer2 = require("class-transformer");
1568
+ var import_graphql = require("graphql");
1569
+
1570
+ // src/utils/failed-response-status-reasons.ts
1571
+ var GuardrailsValidationFailureResponse = class extends FailedResponseStatus {
1572
+ reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;
1573
+ constructor({ guardrailsReason }) {
1574
+ super();
1575
+ this.details = {
1576
+ guardrailsReason
1577
+ };
1578
+ }
1579
+ };
1580
+ __name(GuardrailsValidationFailureResponse, "GuardrailsValidationFailureResponse");
1581
+ var MessageStreamInterruptedResponse = class extends FailedResponseStatus {
1582
+ reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;
1583
+ constructor({ messageId }) {
1584
+ super();
1585
+ this.details = {
1586
+ messageId,
1587
+ description: "Check the message for mode details"
1588
+ };
1589
+ }
1590
+ };
1591
+ __name(MessageStreamInterruptedResponse, "MessageStreamInterruptedResponse");
1592
+ var UnknownErrorResponse = class extends FailedResponseStatus {
1593
+ reason = FailedResponseStatusReason.UNKNOWN_ERROR;
1594
+ constructor({ description }) {
1595
+ super();
1596
+ this.details = {
1597
+ description
1598
+ };
1599
+ }
1600
+ };
1601
+ __name(UnknownErrorResponse, "UnknownErrorResponse");
1602
+
1603
+ // src/graphql/resolvers/copilot.resolver.ts
1604
+ var import_shared4 = require("@copilotkit/shared");
1605
+
1606
+ // src/graphql/types/agents-response.type.ts
1607
+ var import_type_graphql17 = require("type-graphql");
1608
+ function _ts_decorate16(decorators, target, key, desc) {
1609
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1610
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1611
+ r = Reflect.decorate(decorators, target, key, desc);
1612
+ else
1613
+ for (var i = decorators.length - 1; i >= 0; i--)
1614
+ if (d = decorators[i])
1615
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1616
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1617
+ }
1618
+ __name(_ts_decorate16, "_ts_decorate");
1619
+ function _ts_metadata16(k, v) {
1620
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1621
+ return Reflect.metadata(k, v);
1622
+ }
1623
+ __name(_ts_metadata16, "_ts_metadata");
1624
+ var Agent = class {
1625
+ id;
1626
+ name;
1627
+ description;
1628
+ };
1629
+ __name(Agent, "Agent");
1630
+ _ts_decorate16([
1631
+ (0, import_type_graphql17.Field)(() => String),
1632
+ _ts_metadata16("design:type", String)
1633
+ ], Agent.prototype, "id", void 0);
1634
+ _ts_decorate16([
1635
+ (0, import_type_graphql17.Field)(() => String),
1636
+ _ts_metadata16("design:type", String)
1637
+ ], Agent.prototype, "name", void 0);
1638
+ _ts_decorate16([
1639
+ (0, import_type_graphql17.Field)(() => String),
1640
+ _ts_metadata16("design:type", String)
1641
+ ], Agent.prototype, "description", void 0);
1642
+ Agent = _ts_decorate16([
1643
+ (0, import_type_graphql17.ObjectType)()
1644
+ ], Agent);
1645
+ var AgentsResponse = class {
1646
+ agents;
1647
+ };
1648
+ __name(AgentsResponse, "AgentsResponse");
1649
+ _ts_decorate16([
1650
+ (0, import_type_graphql17.Field)(() => [
1651
+ Agent
1652
+ ]),
1653
+ _ts_metadata16("design:type", Array)
1654
+ ], AgentsResponse.prototype, "agents", void 0);
1655
+ AgentsResponse = _ts_decorate16([
1656
+ (0, import_type_graphql17.ObjectType)()
1657
+ ], AgentsResponse);
1658
+
1659
+ // src/graphql/resolvers/copilot.resolver.ts
1660
+ function _ts_decorate17(decorators, target, key, desc) {
1661
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1662
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1663
+ r = Reflect.decorate(decorators, target, key, desc);
1664
+ else
1665
+ for (var i = decorators.length - 1; i >= 0; i--)
1666
+ if (d = decorators[i])
1667
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1668
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1669
+ }
1670
+ __name(_ts_decorate17, "_ts_decorate");
1671
+ function _ts_metadata17(k, v) {
1672
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1673
+ return Reflect.metadata(k, v);
1674
+ }
1675
+ __name(_ts_metadata17, "_ts_metadata");
1676
+ function _ts_param(paramIndex, decorator) {
1677
+ return function(target, key) {
1678
+ decorator(target, key, paramIndex);
1679
+ };
1680
+ }
1681
+ __name(_ts_param, "_ts_param");
1682
+ var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
1683
+ var _a;
1684
+ if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
1685
+ const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
1686
+ role: m.textMessage.role,
1687
+ content: m.textMessage.content
1688
+ }));
1689
+ const lastMessage = messages[messages.length - 1];
1690
+ const restOfMessages = messages.slice(0, -1);
1691
+ const body = {
1692
+ input: lastMessage.content,
1693
+ validTopics: data.cloud.guardrails.inputValidationRules.allowList,
1694
+ invalidTopics: data.cloud.guardrails.inputValidationRules.denyList,
1695
+ messages: restOfMessages
1696
+ };
1697
+ const guardrailsResult = await fetch(`${baseUrl}/guardrails/validate`, {
1698
+ method: "POST",
1699
+ headers: {
1700
+ "Content-Type": "application/json",
1701
+ "X-CopilotCloud-Public-API-Key": copilotCloudPublicApiKey
1702
+ },
1703
+ body: JSON.stringify(body)
1704
+ });
1705
+ if (guardrailsResult.ok) {
1706
+ const resultJson = await guardrailsResult.json();
1707
+ onResult(resultJson);
1708
+ } else {
1709
+ onError(await guardrailsResult.json());
1710
+ }
1711
+ }
1712
+ }, "invokeGuardrails");
1713
+ var CopilotResolver = class {
1714
+ async hello() {
1715
+ return "Hello World";
1716
+ }
1717
+ async availableAgents(ctx) {
1718
+ let logger2 = ctx.logger.child({
1719
+ component: "CopilotResolver.availableAgents"
1720
+ });
1721
+ logger2.debug("Processing");
1722
+ const agentsWithEndpoints = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
1723
+ logger2.debug("Event source created, creating response");
1724
+ return {
1725
+ agents: agentsWithEndpoints.map(({ endpoint, ...agentWithoutEndpoint }) => agentWithoutEndpoint)
1726
+ };
1727
+ }
1728
+ async generateCopilotResponse(ctx, data, properties) {
1729
+ var _a, _b, _c;
1730
+ telemetry_client_default.capture("oss.runtime.copilot_request_created", {
1731
+ "cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
1732
+ requestType: data.metadata.requestType
1733
+ });
1734
+ let logger2 = ctx.logger.child({
1735
+ component: "CopilotResolver.generateCopilotResponse"
1736
+ });
1737
+ logger2.debug({
1738
+ data
1739
+ }, "Generating Copilot response");
1740
+ if (properties) {
1741
+ logger2.debug("Properties provided, merging with context properties");
1742
+ ctx.properties = {
1743
+ ...ctx.properties,
1744
+ ...properties
1745
+ };
1746
+ }
1747
+ const copilotRuntime = ctx._copilotkit.runtime;
1748
+ const serviceAdapter = ctx._copilotkit.serviceAdapter;
1749
+ let copilotCloudPublicApiKey = null;
1750
+ let copilotCloudBaseUrl;
1751
+ if (data.cloud) {
1752
+ logger2 = logger2.child({
1753
+ cloud: true
1754
+ });
1755
+ logger2.debug("Cloud configuration provided, checking for public API key in headers");
1756
+ const key = ctx.request.headers.get("x-copilotcloud-public-api-key");
1757
+ if (key) {
1758
+ logger2.debug("Public API key found in headers");
1759
+ copilotCloudPublicApiKey = key;
1760
+ } else {
1761
+ logger2.error("Public API key not found in headers");
1762
+ throw new import_graphql.GraphQLError("X-CopilotCloud-Public-API-Key header is required");
1763
+ }
1764
+ if (process.env.COPILOT_CLOUD_BASE_URL) {
1765
+ copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
1766
+ } else if ((_b = ctx._copilotkit.cloud) == null ? void 0 : _b.baseUrl) {
1767
+ copilotCloudBaseUrl = (_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl;
1768
+ } else {
1769
+ copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
1770
+ }
1771
+ logger2 = logger2.child({
1772
+ copilotCloudBaseUrl
1773
+ });
1774
+ }
1775
+ logger2.debug("Setting up subjects");
1776
+ const responseStatus$ = new import_rxjs3.ReplaySubject();
1777
+ const interruptStreaming$ = new import_rxjs3.ReplaySubject();
1778
+ const guardrailsResult$ = new import_rxjs3.ReplaySubject();
1779
+ let outputMessages = [];
1780
+ let resolveOutputMessagesPromise;
1781
+ let rejectOutputMessagesPromise;
1782
+ const outputMessagesPromise = new Promise((resolve, reject) => {
1783
+ resolveOutputMessagesPromise = resolve;
1784
+ rejectOutputMessagesPromise = reject;
1785
+ });
1786
+ logger2.debug("Processing");
1787
+ const { eventSource, threadId = (0, import_shared4.randomId)(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = await copilotRuntime.processRuntimeRequest({
1788
+ serviceAdapter,
1789
+ messages: data.messages,
1790
+ actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
1791
+ threadId: data.threadId,
1792
+ runId: data.runId,
1793
+ publicApiKey: void 0,
1794
+ outputMessagesPromise,
1795
+ graphqlContext: ctx,
1796
+ forwardedParameters: data.forwardedParameters,
1797
+ agentSession: data.agentSession,
1798
+ agentStates: data.agentStates,
1799
+ url: data.frontend.url,
1800
+ extensions: data.extensions
1801
+ });
1802
+ logger2.debug("Event source created, creating response");
1803
+ const response = {
1804
+ threadId,
1805
+ runId,
1806
+ status: (0, import_rxjs3.firstValueFrom)(responseStatus$),
1807
+ extensions,
1808
+ messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
1809
+ var _a2, _b2;
1810
+ logger2.debug("Messages repeater created");
1811
+ if ((_a2 = data.cloud) == null ? void 0 : _a2.guardrails) {
1812
+ logger2 = logger2.child({
1813
+ guardrails: true
1814
+ });
1815
+ logger2.debug("Guardrails is enabled, validating input");
1816
+ invokeGuardrails({
1817
+ baseUrl: copilotCloudBaseUrl,
1818
+ copilotCloudPublicApiKey,
1819
+ data,
1820
+ onResult: (result) => {
1821
+ logger2.debug({
1822
+ status: result.status
1823
+ }, "Guardrails validation done");
1824
+ guardrailsResult$.next(result);
1825
+ if (result.status === "denied") {
1826
+ responseStatus$.next(new GuardrailsValidationFailureResponse({
1827
+ guardrailsReason: result.reason
1828
+ }));
1829
+ interruptStreaming$.next({
1830
+ reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
1831
+ });
1832
+ outputMessages = [
1833
+ (0, import_class_transformer2.plainToInstance)(TextMessage, {
1834
+ id: (0, import_shared4.randomId)(),
1835
+ createdAt: /* @__PURE__ */ new Date(),
1836
+ content: result.reason,
1837
+ role: MessageRole.assistant
1838
+ })
1839
+ ];
1840
+ resolveOutputMessagesPromise(outputMessages);
1841
+ }
1842
+ },
1843
+ onError: (err) => {
1844
+ logger2.error({
1845
+ err
1846
+ }, "Error in guardrails validation");
1847
+ responseStatus$.next(new UnknownErrorResponse({
1848
+ description: `An unknown error has occurred in the guardrails validation`
1849
+ }));
1850
+ interruptStreaming$.next({
1851
+ reason: `Interrupted due to unknown error in guardrails validation`
1852
+ });
1853
+ rejectOutputMessagesPromise(err);
1854
+ }
1855
+ });
1856
+ }
1857
+ let eventStreamSubscription;
1858
+ const eventStream = eventSource.processRuntimeEvents({
1859
+ serverSideActions,
1860
+ guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null,
1861
+ actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
1862
+ // TODO-AGENTS: do not exclude ALL server side actions
1863
+ (action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
1864
+ ),
1865
+ threadId
1866
+ }).pipe(
1867
+ // shareReplay() ensures that later subscribers will see the whole stream instead of
1868
+ // just the events that were emitted after the subscriber was added.
1869
+ (0, import_rxjs3.shareReplay)(),
1870
+ (0, import_rxjs3.finalize)(() => {
1871
+ logger2.debug("Event stream finalized");
1872
+ })
1873
+ );
1874
+ logger2.debug("Event stream created, subscribing to event stream");
1875
+ eventStreamSubscription = eventStream.subscribe({
1876
+ next: async (event) => {
1877
+ switch (event.type) {
1878
+ case RuntimeEventTypes.TextMessageStart:
1879
+ const textMessageContentStream = eventStream.pipe(
1880
+ // skip until this message start event
1881
+ (0, import_rxjs3.skipWhile)((e) => e !== event),
1882
+ // take until the message end event
1883
+ (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
1884
+ // filter out any other message events or message ids
1885
+ (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
1886
+ );
1887
+ const streamingTextStatus = new import_rxjs3.Subject();
1888
+ const messageId = event.messageId;
1889
+ pushMessage({
1890
+ id: messageId,
1891
+ parentMessageId: event.parentMessageId,
1892
+ status: (0, import_rxjs3.firstValueFrom)(streamingTextStatus),
1893
+ createdAt: /* @__PURE__ */ new Date(),
1894
+ role: MessageRole.assistant,
1895
+ content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
1896
+ logger2.debug("Text message content repeater created");
1897
+ const textChunks = [];
1898
+ let textSubscription;
1899
+ interruptStreaming$.pipe((0, import_rxjs3.shareReplay)(), (0, import_rxjs3.take)(1), (0, import_rxjs3.tap)(({ reason, messageId: messageId2 }) => {
1900
+ logger2.debug({
1901
+ reason,
1902
+ messageId: messageId2
1903
+ }, "Text streaming interrupted");
1904
+ streamingTextStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
1905
+ reason
1906
+ }));
1907
+ responseStatus$.next(new MessageStreamInterruptedResponse({
1908
+ messageId: messageId2
1909
+ }));
1910
+ stopStreamingText();
1911
+ textSubscription == null ? void 0 : textSubscription.unsubscribe();
1912
+ })).subscribe();
1913
+ logger2.debug("Subscribing to text message content stream");
1914
+ textSubscription = textMessageContentStream.subscribe({
1915
+ next: async (e) => {
1916
+ if (e.type == RuntimeEventTypes.TextMessageContent) {
1917
+ await pushTextChunk(e.content);
1918
+ textChunks.push(e.content);
1919
+ }
1920
+ },
1921
+ error: (err) => {
1922
+ logger2.error({
1923
+ err
1924
+ }, "Error in text message content stream");
1925
+ interruptStreaming$.next({
1926
+ reason: "Error streaming message content",
1927
+ messageId
1928
+ });
1929
+ stopStreamingText();
1930
+ textSubscription == null ? void 0 : textSubscription.unsubscribe();
1931
+ },
1932
+ complete: () => {
1933
+ logger2.debug("Text message content stream completed");
1934
+ streamingTextStatus.next(new SuccessMessageStatus());
1935
+ stopStreamingText();
1936
+ textSubscription == null ? void 0 : textSubscription.unsubscribe();
1937
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(TextMessage, {
1938
+ id: messageId,
1939
+ createdAt: /* @__PURE__ */ new Date(),
1940
+ content: textChunks.join(""),
1941
+ role: MessageRole.assistant
1942
+ }));
1943
+ }
1944
+ });
1945
+ })
1946
+ });
1947
+ break;
1948
+ case RuntimeEventTypes.ActionExecutionStart:
1949
+ logger2.debug("Action execution start event received");
1950
+ const actionExecutionArgumentStream = eventStream.pipe(
1951
+ (0, import_rxjs3.skipWhile)((e) => e !== event),
1952
+ // take until the action execution end event
1953
+ (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
1954
+ // filter out any other action execution events or action execution ids
1955
+ (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
1956
+ );
1957
+ const streamingArgumentsStatus = new import_rxjs3.Subject();
1958
+ pushMessage({
1959
+ id: event.actionExecutionId,
1960
+ parentMessageId: event.parentMessageId,
1961
+ status: (0, import_rxjs3.firstValueFrom)(streamingArgumentsStatus),
1962
+ createdAt: /* @__PURE__ */ new Date(),
1963
+ name: event.actionName,
1964
+ arguments: new import_graphql_yoga.Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
1965
+ logger2.debug("Action execution argument stream created");
1966
+ const argumentChunks = [];
1967
+ let actionExecutionArgumentSubscription;
1968
+ actionExecutionArgumentSubscription = actionExecutionArgumentStream.subscribe({
1969
+ next: async (e) => {
1970
+ if (e.type == RuntimeEventTypes.ActionExecutionArgs) {
1971
+ await pushArgumentsChunk(e.args);
1972
+ argumentChunks.push(e.args);
1973
+ }
1974
+ },
1975
+ error: (err) => {
1976
+ logger2.error({
1977
+ err
1978
+ }, "Error in action execution argument stream");
1979
+ streamingArgumentsStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
1980
+ reason: "An unknown error has occurred in the action execution argument stream"
1981
+ }));
1982
+ stopStreamingArguments();
1983
+ actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
1984
+ },
1985
+ complete: () => {
1986
+ logger2.debug("Action execution argument stream completed");
1987
+ streamingArgumentsStatus.next(new SuccessMessageStatus());
1988
+ stopStreamingArguments();
1989
+ actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
1990
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
1991
+ id: event.actionExecutionId,
1992
+ createdAt: /* @__PURE__ */ new Date(),
1993
+ name: event.actionName,
1994
+ arguments: argumentChunks.join("")
1995
+ }));
1996
+ }
1997
+ });
1998
+ })
1999
+ });
2000
+ break;
2001
+ case RuntimeEventTypes.ActionExecutionResult:
2002
+ logger2.debug({
2003
+ result: event.result
2004
+ }, "Action execution result event received");
2005
+ pushMessage({
2006
+ id: "result-" + event.actionExecutionId,
2007
+ status: new SuccessMessageStatus(),
2008
+ createdAt: /* @__PURE__ */ new Date(),
2009
+ actionExecutionId: event.actionExecutionId,
2010
+ actionName: event.actionName,
2011
+ result: event.result
2012
+ });
2013
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(ResultMessage, {
2014
+ id: "result-" + event.actionExecutionId,
2015
+ createdAt: /* @__PURE__ */ new Date(),
2016
+ actionExecutionId: event.actionExecutionId,
2017
+ actionName: event.actionName,
2018
+ result: event.result
2019
+ }));
2020
+ break;
2021
+ case RuntimeEventTypes.AgentStateMessage:
2022
+ logger2.debug({
2023
+ event
2024
+ }, "Agent message event received");
2025
+ pushMessage({
2026
+ id: (0, import_shared4.randomId)(),
2027
+ status: new SuccessMessageStatus(),
2028
+ threadId: event.threadId,
2029
+ agentName: event.agentName,
2030
+ nodeName: event.nodeName,
2031
+ runId: event.runId,
2032
+ active: event.active,
2033
+ state: event.state,
2034
+ running: event.running,
2035
+ role: MessageRole.assistant,
2036
+ createdAt: /* @__PURE__ */ new Date()
2037
+ });
2038
+ outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
2039
+ id: (0, import_shared4.randomId)(),
2040
+ threadId: event.threadId,
2041
+ agentName: event.agentName,
2042
+ nodeName: event.nodeName,
2043
+ runId: event.runId,
2044
+ active: event.active,
2045
+ state: event.state,
2046
+ running: event.running,
2047
+ role: MessageRole.assistant,
2048
+ createdAt: /* @__PURE__ */ new Date()
2049
+ }));
2050
+ break;
2051
+ }
2052
+ },
2053
+ error: (err) => {
2054
+ logger2.error({
2055
+ err
2056
+ }, "Error in event stream");
2057
+ responseStatus$.next(new UnknownErrorResponse({
2058
+ description: `An unknown error has occurred in the event stream`
2059
+ }));
2060
+ eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2061
+ stopStreamingMessages();
2062
+ rejectOutputMessagesPromise(err);
2063
+ },
2064
+ complete: async () => {
2065
+ var _a3;
2066
+ logger2.debug("Event stream completed");
2067
+ if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
2068
+ logger2.debug("Guardrails is enabled, waiting for guardrails result");
2069
+ await (0, import_rxjs3.firstValueFrom)(guardrailsResult$);
2070
+ }
2071
+ responseStatus$.next(new SuccessResponseStatus());
2072
+ eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
2073
+ stopStreamingMessages();
2074
+ resolveOutputMessagesPromise(outputMessages);
2075
+ }
2076
+ });
2077
+ })
2078
+ };
2079
+ return response;
2080
+ }
2081
+ };
2082
+ __name(CopilotResolver, "CopilotResolver");
2083
+ _ts_decorate17([
2084
+ (0, import_type_graphql18.Query)(() => String),
2085
+ _ts_metadata17("design:type", Function),
2086
+ _ts_metadata17("design:paramtypes", []),
2087
+ _ts_metadata17("design:returntype", Promise)
2088
+ ], CopilotResolver.prototype, "hello", null);
2089
+ _ts_decorate17([
2090
+ (0, import_type_graphql18.Query)(() => AgentsResponse),
2091
+ _ts_param(0, (0, import_type_graphql18.Ctx)()),
2092
+ _ts_metadata17("design:type", Function),
2093
+ _ts_metadata17("design:paramtypes", [
2094
+ typeof GraphQLContext === "undefined" ? Object : GraphQLContext
2095
+ ]),
2096
+ _ts_metadata17("design:returntype", Promise)
2097
+ ], CopilotResolver.prototype, "availableAgents", null);
2098
+ _ts_decorate17([
2099
+ (0, import_type_graphql18.Mutation)(() => CopilotResponse),
2100
+ _ts_param(0, (0, import_type_graphql18.Ctx)()),
2101
+ _ts_param(1, (0, import_type_graphql18.Arg)("data")),
2102
+ _ts_param(2, (0, import_type_graphql18.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
2103
+ nullable: true
2104
+ })),
2105
+ _ts_metadata17("design:type", Function),
2106
+ _ts_metadata17("design:paramtypes", [
2107
+ typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
2108
+ typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
2109
+ typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
2110
+ ]),
2111
+ _ts_metadata17("design:returntype", Promise)
2112
+ ], CopilotResolver.prototype, "generateCopilotResponse", null);
2113
+ CopilotResolver = _ts_decorate17([
2114
+ (0, import_type_graphql18.Resolver)(() => CopilotResponse)
2115
+ ], CopilotResolver);
2116
+
2117
+ // src/lib/integrations/shared.ts
2118
+ var import_plugin_defer_stream = require("@graphql-yoga/plugin-defer-stream");
2119
+
2120
+ // src/lib/logger.ts
2121
+ var import_pino = __toESM(require("pino"));
2122
+ var import_pino_pretty = __toESM(require("pino-pretty"));
2123
+ function createLogger(options) {
2124
+ const { level, component } = options || {};
2125
+ const stream = (0, import_pino_pretty.default)({
2126
+ colorize: true
2127
+ });
2128
+ const logger2 = (0, import_pino.default)({
2129
+ level: process.env.LOG_LEVEL || level || "error",
2130
+ redact: {
2131
+ paths: [
2132
+ "pid",
2133
+ "hostname"
2134
+ ],
2135
+ remove: true
2136
+ }
2137
+ }, stream);
2138
+ if (component) {
2139
+ return logger2.child({
2140
+ component
2141
+ });
2142
+ } else {
2143
+ return logger2;
2144
+ }
2145
+ }
2146
+ __name(createLogger, "createLogger");
2147
+
2148
+ // src/graphql/resolvers/state.resolver.ts
2149
+ var import_type_graphql21 = require("type-graphql");
2150
+ var import_type_graphql22 = require("type-graphql");
2151
+ var import_type_graphql23 = require("type-graphql");
2152
+
2153
+ // src/graphql/types/load-agent-state-response.type.ts
2154
+ var import_type_graphql19 = require("type-graphql");
2155
+ function _ts_decorate18(decorators, target, key, desc) {
2156
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2157
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2158
+ r = Reflect.decorate(decorators, target, key, desc);
2159
+ else
2160
+ for (var i = decorators.length - 1; i >= 0; i--)
2161
+ if (d = decorators[i])
2162
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2163
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2164
+ }
2165
+ __name(_ts_decorate18, "_ts_decorate");
2166
+ function _ts_metadata18(k, v) {
2167
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2168
+ return Reflect.metadata(k, v);
2169
+ }
2170
+ __name(_ts_metadata18, "_ts_metadata");
2171
+ var LoadAgentStateResponse = class {
2172
+ threadId;
2173
+ threadExists;
2174
+ state;
2175
+ messages;
2176
+ };
2177
+ __name(LoadAgentStateResponse, "LoadAgentStateResponse");
2178
+ _ts_decorate18([
2179
+ (0, import_type_graphql19.Field)(() => String),
2180
+ _ts_metadata18("design:type", String)
2181
+ ], LoadAgentStateResponse.prototype, "threadId", void 0);
2182
+ _ts_decorate18([
2183
+ (0, import_type_graphql19.Field)(() => Boolean),
2184
+ _ts_metadata18("design:type", Boolean)
2185
+ ], LoadAgentStateResponse.prototype, "threadExists", void 0);
2186
+ _ts_decorate18([
2187
+ (0, import_type_graphql19.Field)(() => String),
2188
+ _ts_metadata18("design:type", String)
2189
+ ], LoadAgentStateResponse.prototype, "state", void 0);
2190
+ _ts_decorate18([
2191
+ (0, import_type_graphql19.Field)(() => String),
2192
+ _ts_metadata18("design:type", String)
2193
+ ], LoadAgentStateResponse.prototype, "messages", void 0);
2194
+ LoadAgentStateResponse = _ts_decorate18([
2195
+ (0, import_type_graphql19.ObjectType)()
2196
+ ], LoadAgentStateResponse);
2197
+
2198
+ // src/graphql/inputs/load-agent-state.input.ts
2199
+ var import_type_graphql20 = require("type-graphql");
2200
+ function _ts_decorate19(decorators, target, key, desc) {
2201
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2202
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2203
+ r = Reflect.decorate(decorators, target, key, desc);
2204
+ else
2205
+ for (var i = decorators.length - 1; i >= 0; i--)
2206
+ if (d = decorators[i])
2207
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2208
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2209
+ }
2210
+ __name(_ts_decorate19, "_ts_decorate");
2211
+ function _ts_metadata19(k, v) {
2212
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2213
+ return Reflect.metadata(k, v);
2214
+ }
2215
+ __name(_ts_metadata19, "_ts_metadata");
2216
+ var LoadAgentStateInput = class {
2217
+ threadId;
2218
+ agentName;
2219
+ };
2220
+ __name(LoadAgentStateInput, "LoadAgentStateInput");
2221
+ _ts_decorate19([
2222
+ (0, import_type_graphql20.Field)(() => String),
2223
+ _ts_metadata19("design:type", String)
2224
+ ], LoadAgentStateInput.prototype, "threadId", void 0);
2225
+ _ts_decorate19([
2226
+ (0, import_type_graphql20.Field)(() => String),
2227
+ _ts_metadata19("design:type", String)
2228
+ ], LoadAgentStateInput.prototype, "agentName", void 0);
2229
+ LoadAgentStateInput = _ts_decorate19([
2230
+ (0, import_type_graphql20.InputType)()
2231
+ ], LoadAgentStateInput);
2232
+
2233
+ // src/graphql/resolvers/state.resolver.ts
2234
+ function _ts_decorate20(decorators, target, key, desc) {
2235
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2236
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2237
+ r = Reflect.decorate(decorators, target, key, desc);
2238
+ else
2239
+ for (var i = decorators.length - 1; i >= 0; i--)
2240
+ if (d = decorators[i])
2241
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2242
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2243
+ }
2244
+ __name(_ts_decorate20, "_ts_decorate");
2245
+ function _ts_metadata20(k, v) {
2246
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2247
+ return Reflect.metadata(k, v);
2248
+ }
2249
+ __name(_ts_metadata20, "_ts_metadata");
2250
+ function _ts_param2(paramIndex, decorator) {
2251
+ return function(target, key) {
2252
+ decorator(target, key, paramIndex);
2253
+ };
2254
+ }
2255
+ __name(_ts_param2, "_ts_param");
2256
+ var StateResolver = class {
2257
+ async loadAgentState(ctx, data) {
2258
+ const agents = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
2259
+ const agent = agents.find((agent2) => agent2.name === data.agentName);
2260
+ if (!agent) {
2261
+ throw new Error("Agent not found");
2262
+ }
2263
+ const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
2264
+ return state;
2265
+ }
2266
+ };
2267
+ __name(StateResolver, "StateResolver");
2268
+ _ts_decorate20([
2269
+ (0, import_type_graphql23.Query)(() => LoadAgentStateResponse),
2270
+ _ts_param2(0, (0, import_type_graphql22.Ctx)()),
2271
+ _ts_param2(1, (0, import_type_graphql21.Arg)("data")),
2272
+ _ts_metadata20("design:type", Function),
2273
+ _ts_metadata20("design:paramtypes", [
2274
+ typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
2275
+ typeof LoadAgentStateInput === "undefined" ? Object : LoadAgentStateInput
2276
+ ]),
2277
+ _ts_metadata20("design:returntype", Promise)
2278
+ ], StateResolver.prototype, "loadAgentState", null);
2279
+ StateResolver = _ts_decorate20([
2280
+ (0, import_type_graphql21.Resolver)(() => LoadAgentStateResponse)
2281
+ ], StateResolver);
2282
+
2283
+ // src/lib/integrations/shared.ts
2284
+ var logger = createLogger();
2285
+ async function createContext(initialContext, copilotKitContext, contextLogger, properties = {}) {
2286
+ logger.debug({
2287
+ copilotKitContext
2288
+ }, "Creating GraphQL context");
2289
+ const ctx = {
2290
+ ...initialContext,
2291
+ _copilotkit: {
2292
+ ...copilotKitContext
2293
+ },
2294
+ properties: {
2295
+ ...properties
2296
+ },
2297
+ logger: contextLogger
2298
+ };
2299
+ return ctx;
2300
+ }
2301
+ __name(createContext, "createContext");
2302
+ function buildSchema(options = {}) {
2303
+ logger.debug("Building GraphQL schema...");
2304
+ const schema = (0, import_type_graphql24.buildSchemaSync)({
2305
+ resolvers: [
2306
+ CopilotResolver,
2307
+ StateResolver
2308
+ ],
2309
+ emitSchemaFile: options.emitSchemaFile
2310
+ });
2311
+ logger.debug("GraphQL schema built successfully");
2312
+ return schema;
2313
+ }
2314
+ __name(buildSchema, "buildSchema");
2315
+ function getCommonConfig(options) {
2316
+ var _a;
2317
+ const logLevel = process.env.LOG_LEVEL || options.logLevel || "error";
2318
+ const logger2 = createLogger({
2319
+ level: logLevel,
2320
+ component: "getCommonConfig"
2321
+ });
2322
+ const contextLogger = createLogger({
2323
+ level: logLevel
2324
+ });
2325
+ if (options.cloud) {
2326
+ telemetry_client_default.setCloudConfiguration({
2327
+ publicApiKey: options.cloud.publicApiKey,
2328
+ baseUrl: options.cloud.baseUrl
2329
+ });
2330
+ }
2331
+ if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2332
+ telemetry_client_default.setGlobalProperties({
2333
+ _copilotkit: {
2334
+ ...options.properties._copilotkit
2335
+ }
2336
+ });
2337
+ }
2338
+ telemetry_client_default.setGlobalProperties({
2339
+ runtime: {
2340
+ serviceAdapter: options.serviceAdapter.constructor.name
2341
+ }
2342
+ });
2343
+ return {
2344
+ logging: createLogger({
2345
+ component: "Yoga GraphQL",
2346
+ level: logLevel
2347
+ }),
2348
+ schema: buildSchema(),
2349
+ plugins: [
2350
+ (0, import_plugin_defer_stream.useDeferStream)()
2351
+ ],
2352
+ context: (ctx) => createContext(ctx, options, contextLogger, options.properties)
2353
+ };
2354
+ }
2355
+ __name(getCommonConfig, "getCommonConfig");
2356
+
2357
+ // src/lib/integrations/node-http/index.ts
2358
+ function copilotRuntimeNodeHttpEndpoint(options) {
2359
+ var _a;
2360
+ const commonConfig = getCommonConfig(options);
2361
+ telemetry_client_default.setGlobalProperties({
2362
+ runtime: {
2363
+ framework: "node-http"
2364
+ }
2365
+ });
2366
+ if ((_a = options.properties) == null ? void 0 : _a._copilotkit) {
2367
+ telemetry_client_default.setGlobalProperties({
2368
+ _copilotkit: options.properties._copilotkit
2369
+ });
2370
+ }
2371
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
2372
+ const logger2 = commonConfig.logging;
2373
+ logger2.debug("Creating Node HTTP endpoint");
2374
+ const yoga = (0, import_graphql_yoga2.createYoga)({
2375
+ ...commonConfig,
2376
+ graphqlEndpoint: options.endpoint
2377
+ });
2378
+ return yoga;
2379
+ }
2380
+ __name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
2381
+
2382
+ // src/lib/integrations/nest/index.ts
2383
+ function copilotRuntimeNestEndpoint(options) {
2384
+ telemetry_client_default.setGlobalProperties({
2385
+ runtime: {
2386
+ framework: "nest"
2387
+ }
2388
+ });
2389
+ telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options.runtime));
2390
+ return copilotRuntimeNodeHttpEndpoint(options);
2391
+ }
2392
+ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
2393
+ // Annotate the CommonJS export names for ESM import in node:
2394
+ 0 && (module.exports = {
2395
+ copilotRuntimeNestEndpoint
2396
+ });
2397
+ //# sourceMappingURL=index.js.map