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