@copilotkit/runtime 1.1.3-feat-runtime-remote-actions.2 → 1.2.1

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 (75) hide show
  1. package/CHANGELOG.md +17 -13
  2. package/__snapshots__/schema/schema.graphql +0 -41
  3. package/dist/{chunk-BJ2LVHWA.mjs → chunk-736EEICU.mjs} +3 -3
  4. package/dist/{chunk-W7RRKPE2.mjs → chunk-DMO6FA25.mjs} +2 -2
  5. package/dist/{chunk-JYLUCJP7.mjs → chunk-DYF5MUAH.mjs} +2 -2
  6. package/dist/{chunk-TBZGOJJX.mjs → chunk-GEIBJJQ4.mjs} +2 -14
  7. package/dist/chunk-GEIBJJQ4.mjs.map +1 -0
  8. package/dist/chunk-PB24CCIJ.mjs +158 -0
  9. package/dist/chunk-PB24CCIJ.mjs.map +1 -0
  10. package/dist/{chunk-7FSNQXPE.mjs → chunk-Q5ZTE7WH.mjs} +158 -786
  11. package/dist/chunk-Q5ZTE7WH.mjs.map +1 -0
  12. package/dist/{chunk-73NMP3DI.mjs → chunk-URMISMK2.mjs} +2 -2
  13. package/dist/{chunk-WRPRFRSL.mjs → chunk-YMUS43FR.mjs} +2 -2
  14. package/dist/graphql/types/converted/index.d.ts +1 -1
  15. package/dist/graphql/types/converted/index.js +0 -13
  16. package/dist/graphql/types/converted/index.js.map +1 -1
  17. package/dist/graphql/types/converted/index.mjs +1 -3
  18. package/dist/{index-079752b9.d.ts → index-13aa818e.d.ts} +1 -1
  19. package/dist/{index-0476e4f7.d.ts → index-aa091e3c.d.ts} +2 -24
  20. package/dist/index.d.ts +7 -7
  21. package/dist/index.js +245 -982
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +8 -8
  24. package/dist/{langserve-d6073a3b.d.ts → langserve-a54438c6.d.ts} +11 -24
  25. package/dist/lib/index.d.ts +7 -7
  26. package/dist/lib/index.js +245 -982
  27. package/dist/lib/index.js.map +1 -1
  28. package/dist/lib/index.mjs +8 -8
  29. package/dist/lib/integrations/index.d.ts +6 -6
  30. package/dist/lib/integrations/index.js +182 -437
  31. package/dist/lib/integrations/index.js.map +1 -1
  32. package/dist/lib/integrations/index.mjs +6 -6
  33. package/dist/lib/integrations/nest/index.d.ts +5 -5
  34. package/dist/lib/integrations/nest/index.js +182 -437
  35. package/dist/lib/integrations/nest/index.js.map +1 -1
  36. package/dist/lib/integrations/nest/index.mjs +4 -4
  37. package/dist/lib/integrations/node-express/index.d.ts +5 -5
  38. package/dist/lib/integrations/node-express/index.js +182 -437
  39. package/dist/lib/integrations/node-express/index.js.map +1 -1
  40. package/dist/lib/integrations/node-express/index.mjs +4 -4
  41. package/dist/lib/integrations/node-http/index.d.ts +5 -5
  42. package/dist/lib/integrations/node-http/index.js +182 -437
  43. package/dist/lib/integrations/node-http/index.js.map +1 -1
  44. package/dist/lib/integrations/node-http/index.mjs +3 -3
  45. package/dist/service-adapters/index.d.ts +3 -3
  46. package/dist/service-adapters/index.js.map +1 -1
  47. package/dist/service-adapters/index.mjs +3 -3
  48. package/dist/{copilot-runtime-d427e991.d.ts → shared-c5362338.d.ts} +38 -65
  49. package/package.json +5 -7
  50. package/src/graphql/inputs/generate-copilot-response.input.ts +0 -11
  51. package/src/graphql/inputs/message.input.ts +0 -30
  52. package/src/graphql/resolvers/copilot.resolver.ts +12 -56
  53. package/src/graphql/types/converted/index.ts +0 -15
  54. package/src/graphql/types/copilot-response.type.ts +0 -29
  55. package/src/graphql/types/enums.ts +0 -1
  56. package/src/lib/copilot-runtime.ts +231 -0
  57. package/src/lib/index.ts +1 -1
  58. package/src/lib/integrations/shared.ts +1 -1
  59. package/src/service-adapters/conversion.ts +0 -16
  60. package/src/service-adapters/events.ts +19 -101
  61. package/dist/chunk-5TYP4A3G.mjs +0 -260
  62. package/dist/chunk-5TYP4A3G.mjs.map +0 -1
  63. package/dist/chunk-7FSNQXPE.mjs.map +0 -1
  64. package/dist/chunk-TBZGOJJX.mjs.map +0 -1
  65. package/src/agents/langgraph/event-source.ts +0 -222
  66. package/src/agents/langgraph/events.ts +0 -309
  67. package/src/graphql/inputs/agent-session.input.ts +0 -13
  68. package/src/graphql/inputs/agent-state.input.ts +0 -10
  69. package/src/lib/runtime/copilot-runtime.ts +0 -360
  70. package/src/lib/runtime/remote-actions.ts +0 -241
  71. /package/dist/{chunk-BJ2LVHWA.mjs.map → chunk-736EEICU.mjs.map} +0 -0
  72. /package/dist/{chunk-W7RRKPE2.mjs.map → chunk-DMO6FA25.mjs.map} +0 -0
  73. /package/dist/{chunk-JYLUCJP7.mjs.map → chunk-DYF5MUAH.mjs.map} +0 -0
  74. /package/dist/{chunk-73NMP3DI.mjs.map → chunk-URMISMK2.mjs.map} +0 -0
  75. /package/dist/{chunk-WRPRFRSL.mjs.map → chunk-YMUS43FR.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -12,11 +12,11 @@ var __export = (target, all) => {
12
12
  for (var name in all)
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
- var __copyProps = (to, from3, except, desc) => {
16
- if (from3 && typeof from3 === "object" || typeof from3 === "function") {
17
- for (let key of __getOwnPropNames(from3))
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
18
  if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
20
  }
21
21
  return to;
22
22
  };
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.1.3-feat-runtime-remote-actions.2",
47
+ version: "1.2.1",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -59,9 +59,7 @@ var require_package = __commonJS({
59
59
  test: "jest --passWithNoTests",
60
60
  "check-types": "tsc --noEmit",
61
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"
62
+ "generate-graphql-schema": "rm -rf __snapshots__ && ts-node ./scripts/generate-gql-schema.ts"
65
63
  },
66
64
  devDependencies: {
67
65
  "@swc/core": "1.5.28",
@@ -144,8 +142,8 @@ __export(src_exports, {
144
142
  module.exports = __toCommonJS(src_exports);
145
143
  var import_reflect_metadata = require("reflect-metadata");
146
144
 
147
- // src/lib/runtime/copilot-runtime.ts
148
- var import_shared8 = require("@copilotkit/shared");
145
+ // src/lib/copilot-runtime.ts
146
+ var import_shared7 = require("@copilotkit/shared");
149
147
 
150
148
  // src/service-adapters/openai/openai-adapter.ts
151
149
  var import_openai = __toESM(require("openai"));
@@ -203,17 +201,6 @@ var ResultMessage = class extends BaseMessage {
203
201
  result;
204
202
  };
205
203
  __name(ResultMessage, "ResultMessage");
206
- var AgentStateMessage = class extends BaseMessage {
207
- threadId;
208
- agentName;
209
- nodeName;
210
- runId;
211
- active;
212
- role;
213
- state;
214
- running;
215
- };
216
- __name(AgentStateMessage, "AgentStateMessage");
217
204
 
218
205
  // src/service-adapters/openai/utils.ts
219
206
  function limitMessagesToTokenCount(messages, tools, model, maxTokens) {
@@ -1283,366 +1270,7 @@ var GroqAdapter = class {
1283
1270
  __name(GroqAdapter, "GroqAdapter");
1284
1271
 
1285
1272
  // src/service-adapters/events.ts
1286
- var import_rxjs2 = require("rxjs");
1287
-
1288
- // src/lib/telemetry-client.ts
1289
- var import_shared7 = require("@copilotkit/shared");
1290
- var packageJson = require_package();
1291
- var telemetryClient = new import_shared7.TelemetryClient({
1292
- packageName: packageJson.name,
1293
- packageVersion: packageJson.version
1294
- });
1295
- var telemetry_client_default = telemetryClient;
1296
-
1297
- // src/agents/langgraph/event-source.ts
1298
1273
  var import_rxjs = require("rxjs");
1299
-
1300
- // src/agents/langgraph/events.ts
1301
- var LangGraphEventTypes;
1302
- (function(LangGraphEventTypes2) {
1303
- LangGraphEventTypes2["OnChainStart"] = "on_chain_start";
1304
- LangGraphEventTypes2["OnChainStream"] = "on_chain_stream";
1305
- LangGraphEventTypes2["OnChainEnd"] = "on_chain_end";
1306
- LangGraphEventTypes2["OnChatModelStart"] = "on_chat_model_start";
1307
- LangGraphEventTypes2["OnChatModelStream"] = "on_chat_model_stream";
1308
- LangGraphEventTypes2["OnChatModelEnd"] = "on_chat_model_end";
1309
- LangGraphEventTypes2["OnToolStart"] = "on_tool_start";
1310
- LangGraphEventTypes2["OnToolEnd"] = "on_tool_end";
1311
- LangGraphEventTypes2["OnCopilotKitStateSync"] = "on_copilotkit_state_sync";
1312
- })(LangGraphEventTypes || (LangGraphEventTypes = {}));
1313
-
1314
- // src/agents/langgraph/event-source.ts
1315
- var RemoteLangGraphEventSource = class {
1316
- eventStream$ = new import_rxjs.ReplaySubject();
1317
- async streamResponse(response) {
1318
- const reader = response.body.getReader();
1319
- const decoder = new TextDecoder();
1320
- let buffer = [];
1321
- const eventStream$ = this.eventStream$;
1322
- function flushBuffer() {
1323
- const currentBuffer = buffer.join("");
1324
- if (currentBuffer.trim().length === 0) {
1325
- return;
1326
- }
1327
- const parts = currentBuffer.split("\n");
1328
- if (parts.length === 0) {
1329
- return;
1330
- }
1331
- const lastPartIsComplete = currentBuffer.endsWith("\n");
1332
- buffer = [];
1333
- if (!lastPartIsComplete) {
1334
- buffer.push(parts.pop());
1335
- }
1336
- parts.map((part) => part.trim()).filter((part) => part != "").forEach((part) => {
1337
- eventStream$.next(JSON.parse(part));
1338
- });
1339
- }
1340
- __name(flushBuffer, "flushBuffer");
1341
- while (true) {
1342
- const { done, value } = await reader.read();
1343
- if (!done) {
1344
- buffer.push(decoder.decode(value, {
1345
- stream: true
1346
- }));
1347
- }
1348
- flushBuffer();
1349
- if (done) {
1350
- break;
1351
- }
1352
- }
1353
- eventStream$.complete();
1354
- }
1355
- processLangGraphEvents() {
1356
- return this.eventStream$.pipe((0, import_rxjs.scan)((acc, event) => {
1357
- var _a, _b, _c, _d, _e, _f, _g, _h;
1358
- if (event.event === LangGraphEventTypes.OnChatModelStream) {
1359
- if ((_c = (_b = (_a = event.data) == null ? void 0 : _a.chunk) == null ? void 0 : _b.kwargs) == null ? void 0 : _c.tool_call_chunks) {
1360
- acc.prevToolCallId = acc.toolCallId;
1361
- acc.toolCallId = (_d = event.data.chunk.kwargs) == null ? void 0 : _d.id;
1362
- if ((_e = event.data.chunk.kwargs.tool_call_chunks[0]) == null ? void 0 : _e.name) {
1363
- acc.toolCallName = event.data.chunk.kwargs.tool_call_chunks[0].name;
1364
- }
1365
- }
1366
- acc.prevMessageId = acc.messageId;
1367
- acc.messageId = (_h = (_g = (_f = event.data) == null ? void 0 : _f.chunk) == null ? void 0 : _g.kwargs) == null ? void 0 : _h.id;
1368
- } else {
1369
- acc.prevToolCallId = acc.toolCallId;
1370
- acc.toolCallId = null;
1371
- acc.prevMessageId = acc.messageId;
1372
- acc.messageId = null;
1373
- acc.toolCallName = null;
1374
- }
1375
- acc.event = event;
1376
- return acc;
1377
- }, {
1378
- event: null,
1379
- toolCallId: null,
1380
- prevToolCallId: null,
1381
- messageId: null,
1382
- toolCallName: null,
1383
- prevMessageId: null
1384
- }), (0, import_rxjs.mergeMap)((eventWithState) => {
1385
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1386
- const events = [];
1387
- let shouldEmitMessages = false;
1388
- let shouldEmitToolCalls = false;
1389
- if (eventWithState.event.event == LangGraphEventTypes.OnChatModelStream) {
1390
- if ((_a = eventWithState.event.tags) == null ? void 0 : _a.includes("copilotkit:emit-tool-calls")) {
1391
- shouldEmitToolCalls = true;
1392
- }
1393
- if ((_b = eventWithState.event.tags) == null ? void 0 : _b.includes("copilotkit:emit-messages")) {
1394
- shouldEmitMessages = true;
1395
- }
1396
- }
1397
- if (eventWithState.prevToolCallId !== null && eventWithState.prevToolCallId !== eventWithState.toolCallId && shouldEmitToolCalls) {
1398
- events.push({
1399
- type: RuntimeEventTypes.ActionExecutionEnd
1400
- });
1401
- }
1402
- if (eventWithState.prevMessageId !== null && eventWithState.prevMessageId !== eventWithState.messageId && shouldEmitMessages) {
1403
- events.push({
1404
- type: RuntimeEventTypes.TextMessageEnd
1405
- });
1406
- }
1407
- switch (eventWithState.event.event) {
1408
- case LangGraphEventTypes.OnCopilotKitStateSync:
1409
- events.push({
1410
- type: RuntimeEventTypes.AgentStateMessage,
1411
- threadId: eventWithState.event.thread_id,
1412
- role: eventWithState.event.role,
1413
- agentName: eventWithState.event.agent_name,
1414
- nodeName: eventWithState.event.node_name,
1415
- runId: eventWithState.event.run_id,
1416
- active: eventWithState.event.active,
1417
- state: JSON.stringify(eventWithState.event.state),
1418
- running: eventWithState.event.running
1419
- });
1420
- break;
1421
- case LangGraphEventTypes.OnToolEnd:
1422
- break;
1423
- case LangGraphEventTypes.OnChatModelStream:
1424
- if (eventWithState.toolCallId !== null && eventWithState.prevToolCallId !== eventWithState.toolCallId) {
1425
- if (shouldEmitToolCalls) {
1426
- events.push({
1427
- type: RuntimeEventTypes.ActionExecutionStart,
1428
- actionExecutionId: eventWithState.toolCallId,
1429
- actionName: eventWithState.toolCallName,
1430
- scope: "client"
1431
- });
1432
- }
1433
- } else if (eventWithState.messageId !== null && eventWithState.prevMessageId !== eventWithState.messageId) {
1434
- if (shouldEmitMessages) {
1435
- events.push({
1436
- type: RuntimeEventTypes.TextMessageStart,
1437
- messageId: eventWithState.messageId
1438
- });
1439
- }
1440
- }
1441
- const args = (_g = (_f = (_e = (_d = (_c = eventWithState.event.data) == null ? void 0 : _c.chunk) == null ? void 0 : _d.kwargs) == null ? void 0 : _e.tool_call_chunks) == null ? void 0 : _f[0]) == null ? void 0 : _g.args;
1442
- const content = (_j = (_i = (_h = eventWithState.event.data) == null ? void 0 : _h.chunk) == null ? void 0 : _i.kwargs) == null ? void 0 : _j.content;
1443
- if (args) {
1444
- if (shouldEmitToolCalls) {
1445
- events.push({
1446
- type: RuntimeEventTypes.ActionExecutionArgs,
1447
- args
1448
- });
1449
- }
1450
- } else if (eventWithState.messageId !== null && content) {
1451
- if (shouldEmitMessages) {
1452
- events.push({
1453
- type: RuntimeEventTypes.TextMessageContent,
1454
- content
1455
- });
1456
- }
1457
- }
1458
- break;
1459
- }
1460
- return events;
1461
- }));
1462
- }
1463
- };
1464
- __name(RemoteLangGraphEventSource, "RemoteLangGraphEventSource");
1465
-
1466
- // src/lib/runtime/remote-actions.ts
1467
- function isLangGraphAgentAction(action) {
1468
- if (!action) {
1469
- return false;
1470
- }
1471
- return typeof action.langGraphAgentHandler === "function";
1472
- }
1473
- __name(isLangGraphAgentAction, "isLangGraphAgentAction");
1474
- function createHeaders(onBeforeRequest, graphqlContext) {
1475
- const headers = {
1476
- "Content-Type": "application/json"
1477
- };
1478
- if (onBeforeRequest) {
1479
- const { headers: additionalHeaders } = onBeforeRequest({
1480
- ctx: graphqlContext
1481
- });
1482
- if (additionalHeaders) {
1483
- Object.assign(headers, additionalHeaders);
1484
- }
1485
- }
1486
- return headers;
1487
- }
1488
- __name(createHeaders, "createHeaders");
1489
- async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: logger2 }) {
1490
- logger2.debug({
1491
- url
1492
- }, "Fetching actions from url");
1493
- const headers = createHeaders(onBeforeRequest, graphqlContext);
1494
- const response = await fetch(`${url}/info`, {
1495
- method: "POST",
1496
- headers,
1497
- body: JSON.stringify({
1498
- properties: graphqlContext.properties
1499
- })
1500
- });
1501
- if (!response.ok) {
1502
- logger2.error({
1503
- url,
1504
- status: response.status,
1505
- body: await response.text()
1506
- }, "Failed to fetch actions from url");
1507
- return [];
1508
- }
1509
- const json = await response.json();
1510
- logger2.debug({
1511
- json
1512
- }, "Fetched actions from url");
1513
- return json;
1514
- }
1515
- __name(fetchRemoteInfo, "fetchRemoteInfo");
1516
- function constructRemoteActions({ json, url, onBeforeRequest, graphqlContext, logger: logger2, messages, agentStates }) {
1517
- const actions = json["actions"].map((action) => ({
1518
- name: action.name,
1519
- description: action.description,
1520
- parameters: action.parameters,
1521
- handler: async (args) => {
1522
- logger2.debug({
1523
- actionName: action.name,
1524
- args
1525
- }, "Executing remote action");
1526
- const headers = createHeaders(onBeforeRequest, graphqlContext);
1527
- telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
1528
- const response = await fetch(`${url}/actions/execute`, {
1529
- method: "POST",
1530
- headers,
1531
- body: JSON.stringify({
1532
- name: action.name,
1533
- arguments: args,
1534
- properties: graphqlContext.properties
1535
- })
1536
- });
1537
- if (!response.ok) {
1538
- logger2.error({
1539
- url,
1540
- status: response.status,
1541
- body: await response.text()
1542
- }, "Failed to execute remote action");
1543
- return "Failed to execute remote action";
1544
- }
1545
- const requestResult = await response.json();
1546
- const result = requestResult["result"];
1547
- logger2.debug({
1548
- actionName: action.name,
1549
- result
1550
- }, "Executed remote action");
1551
- return result;
1552
- }
1553
- }));
1554
- const agents = json["agents"].map((agent) => ({
1555
- name: agent.name,
1556
- description: agent.description,
1557
- parameters: [],
1558
- handler: async (_args) => {
1559
- },
1560
- langGraphAgentHandler: async ({ name, actionInputsWithoutAgents, threadId, nodeName }) => {
1561
- var _a;
1562
- logger2.debug({
1563
- actionName: agent.name
1564
- }, "Executing remote agent");
1565
- const headers = createHeaders(onBeforeRequest, graphqlContext);
1566
- telemetry_client_default.capture("oss.runtime.remote_action_executed", {});
1567
- let state = {};
1568
- if (agentStates) {
1569
- const jsonState = (_a = agentStates.find((state2) => state2.agentName === name)) == null ? void 0 : _a.state;
1570
- if (jsonState) {
1571
- state = JSON.parse(jsonState);
1572
- }
1573
- }
1574
- const response = await fetch(`${url}/agents/execute`, {
1575
- method: "POST",
1576
- headers,
1577
- body: JSON.stringify({
1578
- name,
1579
- threadId,
1580
- nodeName,
1581
- messages,
1582
- state,
1583
- properties: graphqlContext.properties,
1584
- actions: actionInputsWithoutAgents.map((action) => ({
1585
- name: action.name,
1586
- description: action.description,
1587
- parameters: JSON.parse(action.jsonSchema)
1588
- }))
1589
- })
1590
- });
1591
- if (!response.ok) {
1592
- logger2.error({
1593
- url,
1594
- status: response.status,
1595
- body: await response.text()
1596
- }, "Failed to execute remote agent");
1597
- throw new Error("Failed to execute remote agent");
1598
- }
1599
- const eventSource = new RemoteLangGraphEventSource();
1600
- eventSource.streamResponse(response);
1601
- return eventSource.processLangGraphEvents();
1602
- }
1603
- }));
1604
- return [
1605
- ...actions,
1606
- ...agents
1607
- ];
1608
- }
1609
- __name(constructRemoteActions, "constructRemoteActions");
1610
- async function setupRemoteActions({ remoteActionDefinitions, graphqlContext, messages, agentStates }) {
1611
- const logger2 = graphqlContext.logger.child({
1612
- component: "remote-actions.fetchRemoteActions"
1613
- });
1614
- logger2.debug({
1615
- remoteActionDefinitions
1616
- }, "Fetching remote actions");
1617
- const filtered = remoteActionDefinitions.filter((value, index, self) => index === self.findIndex((t) => t.url === value.url));
1618
- const result = await Promise.all(filtered.map(async (actionDefinition) => {
1619
- const json = await fetchRemoteInfo({
1620
- url: actionDefinition.url,
1621
- onBeforeRequest: actionDefinition.onBeforeRequest,
1622
- graphqlContext,
1623
- logger: logger2.child({
1624
- component: "remote-actions.fetchActionsFromUrl",
1625
- actionDefinition
1626
- })
1627
- });
1628
- return constructRemoteActions({
1629
- json,
1630
- messages,
1631
- url: actionDefinition.url,
1632
- onBeforeRequest: actionDefinition.onBeforeRequest,
1633
- graphqlContext,
1634
- logger: logger2.child({
1635
- component: "remote-actions.constructActions",
1636
- actionDefinition
1637
- }),
1638
- agentStates
1639
- });
1640
- }));
1641
- return result.flat();
1642
- }
1643
- __name(setupRemoteActions, "setupRemoteActions");
1644
-
1645
- // src/service-adapters/events.ts
1646
1274
  var RuntimeEventTypes;
1647
1275
  (function(RuntimeEventTypes2) {
1648
1276
  RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
@@ -1652,9 +1280,8 @@ var RuntimeEventTypes;
1652
1280
  RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
1653
1281
  RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
1654
1282
  RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
1655
- RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
1656
1283
  })(RuntimeEventTypes || (RuntimeEventTypes = {}));
1657
- var RuntimeEventSubject = class extends import_rxjs2.ReplaySubject {
1284
+ var RuntimeEventSubject = class extends import_rxjs.ReplaySubject {
1658
1285
  constructor() {
1659
1286
  super();
1660
1287
  }
@@ -1711,19 +1338,6 @@ var RuntimeEventSubject = class extends import_rxjs2.ReplaySubject {
1711
1338
  result
1712
1339
  });
1713
1340
  }
1714
- sendAgentStateMessage(threadId, agentName, nodeName, runId, active, role, state, running) {
1715
- this.next({
1716
- type: "AgentStateMessage",
1717
- threadId,
1718
- agentName,
1719
- nodeName,
1720
- runId,
1721
- active,
1722
- role,
1723
- state,
1724
- running
1725
- });
1726
- }
1727
1341
  };
1728
1342
  __name(RuntimeEventSubject, "RuntimeEventSubject");
1729
1343
  var RuntimeEventSource = class {
@@ -1732,31 +1346,26 @@ var RuntimeEventSource = class {
1732
1346
  async stream(callback) {
1733
1347
  this.callback = callback;
1734
1348
  }
1735
- processRuntimeEvents({ serverSideActions, guardrailsResult$, actionInputsWithoutAgents }) {
1349
+ process({ serversideActions, guardrailsResult$ }) {
1736
1350
  this.callback(this.eventStream$).catch((error) => {
1737
1351
  console.error("Error in event source callback", error);
1738
1352
  });
1739
1353
  return this.eventStream$.pipe(
1740
1354
  // mark tools for server side execution
1741
- (0, import_rxjs2.map)((event) => {
1355
+ (0, import_rxjs.map)((event) => {
1742
1356
  if (event.type === "ActionExecutionStart") {
1743
- if (event.scope !== "passThrough") {
1744
- event.scope = serverSideActions.find((action) => action.name === event.actionName) ? "server" : "client";
1745
- }
1357
+ event.scope = serversideActions.find((action) => action.name === event.actionName) ? "server" : "client";
1746
1358
  }
1747
1359
  return event;
1748
1360
  }),
1749
1361
  // track state
1750
- (0, import_rxjs2.scan)((acc, event) => {
1751
- acc = {
1752
- ...acc
1753
- };
1362
+ (0, import_rxjs.scan)((acc, event) => {
1754
1363
  if (event.type === "ActionExecutionStart") {
1755
1364
  acc.callActionServerSide = event.scope === "server";
1756
1365
  acc.args = "";
1757
1366
  acc.actionExecutionId = event.actionExecutionId;
1758
1367
  if (acc.callActionServerSide) {
1759
- acc.action = serverSideActions.find((action) => action.name === event.actionName);
1368
+ acc.action = serversideActions.find((action) => action.name === event.actionName);
1760
1369
  }
1761
1370
  } else if (event.type === "ActionExecutionArgs") {
1762
1371
  acc.args += event.args;
@@ -1770,26 +1379,24 @@ var RuntimeEventSource = class {
1770
1379
  actionExecutionId: null,
1771
1380
  action: null
1772
1381
  }),
1773
- (0, import_rxjs2.concatMap)((eventWithState) => {
1382
+ (0, import_rxjs.concatMap)((eventWithState) => {
1774
1383
  if (eventWithState.event.type === "ActionExecutionEnd" && eventWithState.callActionServerSide) {
1775
1384
  const toolCallEventStream$ = new RuntimeEventSubject();
1776
- executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId, actionInputsWithoutAgents).catch((error) => {
1385
+ executeAction(toolCallEventStream$, guardrailsResult$ ? guardrailsResult$ : null, eventWithState.action, eventWithState.args, eventWithState.actionExecutionId).catch((error) => {
1777
1386
  console.error(error);
1778
1387
  });
1779
- telemetry_client_default.capture("oss.runtime.server_action_executed", {});
1780
- return (0, import_rxjs2.concat)((0, import_rxjs2.of)(eventWithState.event), toolCallEventStream$);
1388
+ return (0, import_rxjs.concat)((0, import_rxjs.of)(eventWithState.event), toolCallEventStream$);
1781
1389
  } else {
1782
- return (0, import_rxjs2.of)(eventWithState.event);
1390
+ return (0, import_rxjs.of)(eventWithState.event);
1783
1391
  }
1784
1392
  })
1785
1393
  );
1786
1394
  }
1787
1395
  };
1788
1396
  __name(RuntimeEventSource, "RuntimeEventSource");
1789
- async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId, actionInputsWithoutAgents) {
1790
- var _a;
1397
+ async function executeAction(eventStream$, guardrailsResult$, action, actionArguments, actionExecutionId) {
1791
1398
  if (guardrailsResult$) {
1792
- const { status } = await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
1399
+ const { status } = await (0, import_rxjs.firstValueFrom)(guardrailsResult$);
1793
1400
  if (status === "denied") {
1794
1401
  eventStream$.complete();
1795
1402
  return;
@@ -1799,28 +1406,15 @@ async function executeAction(eventStream$, guardrailsResult$, action, actionArgu
1799
1406
  if (actionArguments) {
1800
1407
  args = JSON.parse(actionArguments);
1801
1408
  }
1802
- if (isLangGraphAgentAction(action)) {
1803
- eventStream$.sendActionExecutionResult(actionExecutionId, action.name, `${action.name} agent started`);
1804
- const stream = await action.langGraphAgentHandler({
1409
+ const result = await action.handler(args);
1410
+ await streamLangChainResponse({
1411
+ result,
1412
+ eventStream$,
1413
+ actionExecution: {
1805
1414
  name: action.name,
1806
- actionInputsWithoutAgents
1807
- });
1808
- (0, import_rxjs2.from)(stream).subscribe({
1809
- next: (event) => eventStream$.next(event),
1810
- error: (err) => console.error("Error in stream", err),
1811
- complete: () => eventStream$.complete()
1812
- });
1813
- } else {
1814
- const result = await ((_a = action.handler) == null ? void 0 : _a.call(action, args));
1815
- await streamLangChainResponse({
1816
- result,
1817
- eventStream$,
1818
- actionExecution: {
1819
- name: action.name,
1820
- id: actionExecutionId
1821
- }
1822
- });
1823
- }
1415
+ id: actionExecutionId
1416
+ }
1417
+ });
1824
1418
  }
1825
1419
  __name(executeAction, "executeAction");
1826
1420
 
@@ -1852,30 +1446,15 @@ function convertGqlInputToMessages(inputMessages) {
1852
1446
  actionName: message.resultMessage.actionName,
1853
1447
  result: message.resultMessage.result
1854
1448
  }));
1855
- } else if (message.agentStateMessage) {
1856
- messages.push((0, import_class_transformer.plainToInstance)(AgentStateMessage, {
1857
- id: message.id,
1858
- threadId: message.agentStateMessage.threadId,
1859
- createdAt: message.createdAt,
1860
- agentName: message.agentStateMessage.agentName,
1861
- nodeName: message.agentStateMessage.nodeName,
1862
- runId: message.agentStateMessage.runId,
1863
- active: message.agentStateMessage.active,
1864
- role: message.agentStateMessage.role,
1865
- state: JSON.parse(message.agentStateMessage.state),
1866
- running: message.agentStateMessage.running
1867
- }));
1868
1449
  }
1869
1450
  }
1870
1451
  return messages;
1871
1452
  }
1872
1453
  __name(convertGqlInputToMessages, "convertGqlInputToMessages");
1873
1454
 
1874
- // src/lib/runtime/copilot-runtime.ts
1875
- var import_rxjs3 = require("rxjs");
1455
+ // src/lib/copilot-runtime.ts
1876
1456
  var CopilotRuntime = class {
1877
1457
  actions;
1878
- remoteActionDefinitions;
1879
1458
  langserve = [];
1880
1459
  onBeforeRequest;
1881
1460
  onAfterRequest;
@@ -1886,33 +1465,44 @@ var CopilotRuntime = class {
1886
1465
  const remoteChain = new RemoteChain(chain);
1887
1466
  this.langserve.push(remoteChain.toAction());
1888
1467
  }
1889
- this.remoteActionDefinitions = (params == null ? void 0 : params.remoteActions) || [];
1890
1468
  this.onBeforeRequest = (_a = params == null ? void 0 : params.middleware) == null ? void 0 : _a.onBeforeRequest;
1891
1469
  this.onAfterRequest = (_b = params == null ? void 0 : params.middleware) == null ? void 0 : _b.onAfterRequest;
1892
1470
  }
1893
- async processRuntimeRequest(request) {
1471
+ async process(request) {
1894
1472
  var _a;
1895
- const { serviceAdapter, messages: rawMessages, actions: clientSideActionsInput, threadId, runId, outputMessagesPromise, graphqlContext, forwardedParameters, agentSession, url } = request;
1896
- if (agentSession) {
1897
- return this.processAgentRequest(request);
1473
+ const { serviceAdapter, messages, actions: clientSideActionsInput, threadId, runId, properties, outputMessagesPromise, forwardedParameters, url } = request;
1474
+ const langserveFunctions = [];
1475
+ for (const chainPromise of this.langserve) {
1476
+ try {
1477
+ const chain = await chainPromise;
1478
+ langserveFunctions.push(chain);
1479
+ } catch (error) {
1480
+ console.error("Error loading langserve chain:", error);
1481
+ }
1898
1482
  }
1899
- const messages = rawMessages.filter((message) => !message.agentStateMessage);
1900
- const inputMessages = convertGqlInputToMessages(messages);
1901
- const serverSideActions = await this.getServerSideActions(request);
1902
- const serverSideActionsInput = serverSideActions.map((action) => ({
1483
+ const configuredActions = typeof this.actions === "function" ? this.actions({
1484
+ properties,
1485
+ url
1486
+ }) : this.actions;
1487
+ const actions = [
1488
+ ...configuredActions,
1489
+ ...langserveFunctions
1490
+ ];
1491
+ const serverSideActionsInput = actions.map((action) => ({
1903
1492
  name: action.name,
1904
1493
  description: action.description,
1905
- jsonSchema: JSON.stringify((0, import_shared8.actionParametersToJsonSchema)(action.parameters))
1494
+ jsonSchema: JSON.stringify((0, import_shared7.actionParametersToJsonSchema)(action.parameters))
1906
1495
  }));
1907
1496
  const actionInputs = flattenToolCallsNoDuplicates([
1908
1497
  ...serverSideActionsInput,
1909
1498
  ...clientSideActionsInput
1910
1499
  ]);
1500
+ const inputMessages = convertGqlInputToMessages(messages);
1911
1501
  await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
1912
1502
  threadId,
1913
1503
  runId,
1914
1504
  inputMessages,
1915
- properties: graphqlContext.properties,
1505
+ properties,
1916
1506
  url
1917
1507
  }));
1918
1508
  try {
@@ -1932,7 +1522,7 @@ var CopilotRuntime = class {
1932
1522
  runId: result.runId,
1933
1523
  inputMessages,
1934
1524
  outputMessages,
1935
- properties: graphqlContext.properties,
1525
+ properties,
1936
1526
  url
1937
1527
  });
1938
1528
  }).catch((_error) => {
@@ -1941,108 +1531,13 @@ var CopilotRuntime = class {
1941
1531
  threadId: result.threadId,
1942
1532
  runId: result.runId,
1943
1533
  eventSource,
1944
- serverSideActions,
1945
- actionInputsWithoutAgents: actionInputs.filter((action) => (
1946
- // TODO-AGENTS: do not exclude ALL server side actions
1947
- !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
1948
- ))
1949
- };
1950
- } catch (error) {
1951
- console.error("Error getting response:", error);
1952
- throw error;
1953
- }
1954
- }
1955
- async processAgentRequest(request) {
1956
- var _a;
1957
- const { messages: rawMessages, outputMessagesPromise, graphqlContext, agentSession } = request;
1958
- const { threadId = (0, import_shared8.randomId)(), agentName, nodeName } = agentSession;
1959
- const serverSideActions = await this.getServerSideActions(request);
1960
- const messages = convertGqlInputToMessages(rawMessages);
1961
- const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
1962
- if (!agent) {
1963
- throw new Error(`Agent ${agentName} not found`);
1964
- }
1965
- const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
1966
- name: action.name,
1967
- description: action.description,
1968
- jsonSchema: JSON.stringify((0, import_shared8.actionParametersToJsonSchema)(action.parameters))
1969
- }));
1970
- const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
1971
- ...serverSideActionsInput,
1972
- ...request.actions
1973
- ]);
1974
- await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
1975
- threadId,
1976
- runId: void 0,
1977
- inputMessages: messages,
1978
- properties: graphqlContext.properties
1979
- }));
1980
- try {
1981
- const eventSource = new RuntimeEventSource();
1982
- const stream = await agent.langGraphAgentHandler({
1983
- name: agentName,
1984
- threadId,
1985
- nodeName,
1986
- actionInputsWithoutAgents
1987
- });
1988
- eventSource.stream(async (eventStream$) => {
1989
- (0, import_rxjs3.from)(stream).subscribe({
1990
- next: (event) => eventStream$.next(event),
1991
- error: (err) => console.error("Error in stream", err),
1992
- complete: () => eventStream$.complete()
1993
- });
1994
- });
1995
- outputMessagesPromise.then((outputMessages) => {
1996
- var _a2;
1997
- (_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
1998
- threadId,
1999
- runId: void 0,
2000
- inputMessages: messages,
2001
- outputMessages,
2002
- properties: graphqlContext.properties
2003
- });
2004
- }).catch((_error) => {
2005
- });
2006
- return {
2007
- threadId,
2008
- runId: void 0,
2009
- eventSource,
2010
- serverSideActions: [],
2011
- actionInputsWithoutAgents
1534
+ actions
2012
1535
  };
2013
1536
  } catch (error) {
2014
1537
  console.error("Error getting response:", error);
2015
1538
  throw error;
2016
1539
  }
2017
1540
  }
2018
- async getServerSideActions(request) {
2019
- const { messages: rawMessages, graphqlContext, agentStates, url } = request;
2020
- const inputMessages = convertGqlInputToMessages(rawMessages);
2021
- const langserveFunctions = [];
2022
- for (const chainPromise of this.langserve) {
2023
- try {
2024
- const chain = await chainPromise;
2025
- langserveFunctions.push(chain);
2026
- } catch (error) {
2027
- console.error("Error loading langserve chain:", error);
2028
- }
2029
- }
2030
- const remoteActions = await setupRemoteActions({
2031
- remoteActionDefinitions: this.remoteActionDefinitions,
2032
- graphqlContext,
2033
- messages: inputMessages,
2034
- agentStates
2035
- });
2036
- const configuredActions = typeof this.actions === "function" ? this.actions({
2037
- properties: graphqlContext.properties,
2038
- url
2039
- }) : this.actions;
2040
- return [
2041
- ...configuredActions,
2042
- ...langserveFunctions,
2043
- ...remoteActions
2044
- ];
2045
- }
2046
1541
  };
2047
1542
  __name(CopilotRuntime, "CopilotRuntime");
2048
1543
  function flattenToolCallsNoDuplicates(toolsByPriority) {
@@ -2059,14 +1554,14 @@ function flattenToolCallsNoDuplicates(toolsByPriority) {
2059
1554
  __name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
2060
1555
 
2061
1556
  // src/lib/integrations/shared.ts
2062
- var import_type_graphql16 = require("type-graphql");
1557
+ var import_type_graphql14 = require("type-graphql");
2063
1558
 
2064
1559
  // src/graphql/resolvers/copilot.resolver.ts
2065
- var import_type_graphql15 = require("type-graphql");
2066
- var import_rxjs4 = require("rxjs");
1560
+ var import_type_graphql13 = require("type-graphql");
1561
+ var import_rxjs2 = require("rxjs");
2067
1562
 
2068
1563
  // src/graphql/inputs/generate-copilot-response.input.ts
2069
- var import_type_graphql11 = require("type-graphql");
1564
+ var import_type_graphql9 = require("type-graphql");
2070
1565
 
2071
1566
  // src/graphql/inputs/message.input.ts
2072
1567
  var import_type_graphql3 = require("type-graphql");
@@ -2083,7 +1578,6 @@ var ActionExecutionScope;
2083
1578
  (function(ActionExecutionScope2) {
2084
1579
  ActionExecutionScope2["server"] = "server";
2085
1580
  ActionExecutionScope2["client"] = "client";
2086
- ActionExecutionScope2["passThrough"] = "passThrough";
2087
1581
  })(ActionExecutionScope || (ActionExecutionScope = {}));
2088
1582
  var CopilotRequestType;
2089
1583
  (function(CopilotRequestType2) {
@@ -2127,7 +1621,6 @@ var MessageInput = class extends BaseMessage {
2127
1621
  textMessage;
2128
1622
  actionExecutionMessage;
2129
1623
  resultMessage;
2130
- agentStateMessage;
2131
1624
  };
2132
1625
  __name(MessageInput, "MessageInput");
2133
1626
  _ts_decorate2([
@@ -2148,12 +1641,6 @@ _ts_decorate2([
2148
1641
  }),
2149
1642
  _ts_metadata2("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
2150
1643
  ], MessageInput.prototype, "resultMessage", void 0);
2151
- _ts_decorate2([
2152
- (0, import_type_graphql3.Field)(() => AgentStateMessageInput, {
2153
- nullable: true
2154
- }),
2155
- _ts_metadata2("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
2156
- ], MessageInput.prototype, "agentStateMessage", void 0);
2157
1644
  MessageInput = _ts_decorate2([
2158
1645
  (0, import_type_graphql3.InputType)()
2159
1646
  ], MessageInput);
@@ -2215,52 +1702,6 @@ _ts_decorate2([
2215
1702
  ResultMessageInput = _ts_decorate2([
2216
1703
  (0, import_type_graphql3.InputType)()
2217
1704
  ], ResultMessageInput);
2218
- var AgentStateMessageInput = class {
2219
- threadId;
2220
- agentName;
2221
- role;
2222
- state;
2223
- running;
2224
- nodeName;
2225
- runId;
2226
- active;
2227
- };
2228
- __name(AgentStateMessageInput, "AgentStateMessageInput");
2229
- _ts_decorate2([
2230
- (0, import_type_graphql3.Field)(() => String),
2231
- _ts_metadata2("design:type", String)
2232
- ], AgentStateMessageInput.prototype, "threadId", void 0);
2233
- _ts_decorate2([
2234
- (0, import_type_graphql3.Field)(() => String),
2235
- _ts_metadata2("design:type", String)
2236
- ], AgentStateMessageInput.prototype, "agentName", void 0);
2237
- _ts_decorate2([
2238
- (0, import_type_graphql3.Field)(() => MessageRole),
2239
- _ts_metadata2("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
2240
- ], AgentStateMessageInput.prototype, "role", void 0);
2241
- _ts_decorate2([
2242
- (0, import_type_graphql3.Field)(() => String),
2243
- _ts_metadata2("design:type", String)
2244
- ], AgentStateMessageInput.prototype, "state", void 0);
2245
- _ts_decorate2([
2246
- (0, import_type_graphql3.Field)(() => Boolean),
2247
- _ts_metadata2("design:type", Boolean)
2248
- ], AgentStateMessageInput.prototype, "running", void 0);
2249
- _ts_decorate2([
2250
- (0, import_type_graphql3.Field)(() => String),
2251
- _ts_metadata2("design:type", String)
2252
- ], AgentStateMessageInput.prototype, "nodeName", void 0);
2253
- _ts_decorate2([
2254
- (0, import_type_graphql3.Field)(() => String),
2255
- _ts_metadata2("design:type", String)
2256
- ], AgentStateMessageInput.prototype, "runId", void 0);
2257
- _ts_decorate2([
2258
- (0, import_type_graphql3.Field)(() => Boolean),
2259
- _ts_metadata2("design:type", Boolean)
2260
- ], AgentStateMessageInput.prototype, "active", void 0);
2261
- AgentStateMessageInput = _ts_decorate2([
2262
- (0, import_type_graphql3.InputType)()
2263
- ], AgentStateMessageInput);
2264
1705
 
2265
1706
  // src/graphql/inputs/frontend.input.ts
2266
1707
  var import_type_graphql5 = require("type-graphql");
@@ -2502,8 +1943,7 @@ ForwardedParametersInput = _ts_decorate7([
2502
1943
  (0, import_type_graphql8.InputType)()
2503
1944
  ], ForwardedParametersInput);
2504
1945
 
2505
- // src/graphql/inputs/agent-session.input.ts
2506
- var import_type_graphql9 = require("type-graphql");
1946
+ // src/graphql/inputs/generate-copilot-response.input.ts
2507
1947
  function _ts_decorate8(decorators, target, key, desc) {
2508
1948
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2509
1949
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2520,96 +1960,18 @@ function _ts_metadata8(k, v) {
2520
1960
  return Reflect.metadata(k, v);
2521
1961
  }
2522
1962
  __name(_ts_metadata8, "_ts_metadata");
2523
- var AgentSessionInput = class {
2524
- agentName;
2525
- threadId;
2526
- nodeName;
2527
- };
2528
- __name(AgentSessionInput, "AgentSessionInput");
2529
- _ts_decorate8([
2530
- (0, import_type_graphql9.Field)(() => String),
2531
- _ts_metadata8("design:type", String)
2532
- ], AgentSessionInput.prototype, "agentName", void 0);
2533
- _ts_decorate8([
2534
- (0, import_type_graphql9.Field)(() => String, {
2535
- nullable: true
2536
- }),
2537
- _ts_metadata8("design:type", String)
2538
- ], AgentSessionInput.prototype, "threadId", void 0);
2539
- _ts_decorate8([
2540
- (0, import_type_graphql9.Field)(() => String, {
2541
- nullable: true
2542
- }),
2543
- _ts_metadata8("design:type", String)
2544
- ], AgentSessionInput.prototype, "nodeName", void 0);
2545
- AgentSessionInput = _ts_decorate8([
2546
- (0, import_type_graphql9.InputType)()
2547
- ], AgentSessionInput);
2548
-
2549
- // src/graphql/inputs/agent-state.input.ts
2550
- var import_type_graphql10 = require("type-graphql");
2551
- function _ts_decorate9(decorators, target, key, desc) {
2552
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2553
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2554
- r = Reflect.decorate(decorators, target, key, desc);
2555
- else
2556
- for (var i = decorators.length - 1; i >= 0; i--)
2557
- if (d = decorators[i])
2558
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2559
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2560
- }
2561
- __name(_ts_decorate9, "_ts_decorate");
2562
- function _ts_metadata9(k, v) {
2563
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2564
- return Reflect.metadata(k, v);
2565
- }
2566
- __name(_ts_metadata9, "_ts_metadata");
2567
- var AgentStateInput = class {
2568
- agentName;
2569
- state;
2570
- };
2571
- __name(AgentStateInput, "AgentStateInput");
2572
- _ts_decorate9([
2573
- (0, import_type_graphql10.Field)(() => String),
2574
- _ts_metadata9("design:type", String)
2575
- ], AgentStateInput.prototype, "agentName", void 0);
2576
- _ts_decorate9([
2577
- (0, import_type_graphql10.Field)(() => String),
2578
- _ts_metadata9("design:type", String)
2579
- ], AgentStateInput.prototype, "state", void 0);
2580
- AgentStateInput = _ts_decorate9([
2581
- (0, import_type_graphql10.InputType)()
2582
- ], AgentStateInput);
2583
-
2584
- // src/graphql/inputs/generate-copilot-response.input.ts
2585
- function _ts_decorate10(decorators, target, key, desc) {
2586
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2587
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2588
- r = Reflect.decorate(decorators, target, key, desc);
2589
- else
2590
- for (var i = decorators.length - 1; i >= 0; i--)
2591
- if (d = decorators[i])
2592
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2593
- return c > 3 && r && Object.defineProperty(target, key, r), r;
2594
- }
2595
- __name(_ts_decorate10, "_ts_decorate");
2596
- function _ts_metadata10(k, v) {
2597
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2598
- return Reflect.metadata(k, v);
2599
- }
2600
- __name(_ts_metadata10, "_ts_metadata");
2601
1963
  var GenerateCopilotResponseMetadataInput = class {
2602
1964
  requestType;
2603
1965
  };
2604
1966
  __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
2605
- _ts_decorate10([
2606
- (0, import_type_graphql11.Field)(() => CopilotRequestType, {
1967
+ _ts_decorate8([
1968
+ (0, import_type_graphql9.Field)(() => CopilotRequestType, {
2607
1969
  nullable: true
2608
1970
  }),
2609
- _ts_metadata10("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
1971
+ _ts_metadata8("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
2610
1972
  ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
2611
- GenerateCopilotResponseMetadataInput = _ts_decorate10([
2612
- (0, import_type_graphql11.InputType)()
1973
+ GenerateCopilotResponseMetadataInput = _ts_decorate8([
1974
+ (0, import_type_graphql9.InputType)()
2613
1975
  ], GenerateCopilotResponseMetadataInput);
2614
1976
  var GenerateCopilotResponseInput = class {
2615
1977
  metadata;
@@ -2619,81 +1981,58 @@ var GenerateCopilotResponseInput = class {
2619
1981
  frontend;
2620
1982
  cloud;
2621
1983
  forwardedParameters;
2622
- agentSession;
2623
- agentState;
2624
- agentStates;
2625
1984
  };
2626
1985
  __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
2627
- _ts_decorate10([
2628
- (0, import_type_graphql11.Field)(() => GenerateCopilotResponseMetadataInput, {
1986
+ _ts_decorate8([
1987
+ (0, import_type_graphql9.Field)(() => GenerateCopilotResponseMetadataInput, {
2629
1988
  nullable: false
2630
1989
  }),
2631
- _ts_metadata10("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
1990
+ _ts_metadata8("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
2632
1991
  ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
2633
- _ts_decorate10([
2634
- (0, import_type_graphql11.Field)(() => String, {
1992
+ _ts_decorate8([
1993
+ (0, import_type_graphql9.Field)(() => String, {
2635
1994
  nullable: true
2636
1995
  }),
2637
- _ts_metadata10("design:type", String)
1996
+ _ts_metadata8("design:type", String)
2638
1997
  ], GenerateCopilotResponseInput.prototype, "threadId", void 0);
2639
- _ts_decorate10([
2640
- (0, import_type_graphql11.Field)(() => String, {
1998
+ _ts_decorate8([
1999
+ (0, import_type_graphql9.Field)(() => String, {
2641
2000
  nullable: true
2642
2001
  }),
2643
- _ts_metadata10("design:type", String)
2002
+ _ts_metadata8("design:type", String)
2644
2003
  ], GenerateCopilotResponseInput.prototype, "runId", void 0);
2645
- _ts_decorate10([
2646
- (0, import_type_graphql11.Field)(() => [
2004
+ _ts_decorate8([
2005
+ (0, import_type_graphql9.Field)(() => [
2647
2006
  MessageInput
2648
2007
  ]),
2649
- _ts_metadata10("design:type", Array)
2008
+ _ts_metadata8("design:type", Array)
2650
2009
  ], GenerateCopilotResponseInput.prototype, "messages", void 0);
2651
- _ts_decorate10([
2652
- (0, import_type_graphql11.Field)(() => FrontendInput),
2653
- _ts_metadata10("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
2010
+ _ts_decorate8([
2011
+ (0, import_type_graphql9.Field)(() => FrontendInput),
2012
+ _ts_metadata8("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
2654
2013
  ], GenerateCopilotResponseInput.prototype, "frontend", void 0);
2655
- _ts_decorate10([
2656
- (0, import_type_graphql11.Field)(() => CloudInput, {
2014
+ _ts_decorate8([
2015
+ (0, import_type_graphql9.Field)(() => CloudInput, {
2657
2016
  nullable: true
2658
2017
  }),
2659
- _ts_metadata10("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
2018
+ _ts_metadata8("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
2660
2019
  ], GenerateCopilotResponseInput.prototype, "cloud", void 0);
2661
- _ts_decorate10([
2662
- (0, import_type_graphql11.Field)(() => ForwardedParametersInput, {
2020
+ _ts_decorate8([
2021
+ (0, import_type_graphql9.Field)(() => ForwardedParametersInput, {
2663
2022
  nullable: true
2664
2023
  }),
2665
- _ts_metadata10("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
2024
+ _ts_metadata8("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
2666
2025
  ], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
2667
- _ts_decorate10([
2668
- (0, import_type_graphql11.Field)(() => AgentSessionInput, {
2669
- nullable: true
2670
- }),
2671
- _ts_metadata10("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
2672
- ], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
2673
- _ts_decorate10([
2674
- (0, import_type_graphql11.Field)(() => AgentStateInput, {
2675
- nullable: true
2676
- }),
2677
- _ts_metadata10("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
2678
- ], GenerateCopilotResponseInput.prototype, "agentState", void 0);
2679
- _ts_decorate10([
2680
- (0, import_type_graphql11.Field)(() => [
2681
- AgentStateInput
2682
- ], {
2683
- nullable: true
2684
- }),
2685
- _ts_metadata10("design:type", Array)
2686
- ], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
2687
- GenerateCopilotResponseInput = _ts_decorate10([
2688
- (0, import_type_graphql11.InputType)()
2026
+ GenerateCopilotResponseInput = _ts_decorate8([
2027
+ (0, import_type_graphql9.InputType)()
2689
2028
  ], GenerateCopilotResponseInput);
2690
2029
 
2691
2030
  // src/graphql/types/copilot-response.type.ts
2692
- var import_type_graphql14 = require("type-graphql");
2031
+ var import_type_graphql12 = require("type-graphql");
2693
2032
 
2694
2033
  // src/graphql/types/message-status.type.ts
2695
- var import_type_graphql12 = require("type-graphql");
2696
- function _ts_decorate11(decorators, target, key, desc) {
2034
+ var import_type_graphql10 = require("type-graphql");
2035
+ function _ts_decorate9(decorators, target, key, desc) {
2697
2036
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2698
2037
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2699
2038
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2703,58 +2042,58 @@ function _ts_decorate11(decorators, target, key, desc) {
2703
2042
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2704
2043
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2705
2044
  }
2706
- __name(_ts_decorate11, "_ts_decorate");
2707
- function _ts_metadata11(k, v) {
2045
+ __name(_ts_decorate9, "_ts_decorate");
2046
+ function _ts_metadata9(k, v) {
2708
2047
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2709
2048
  return Reflect.metadata(k, v);
2710
2049
  }
2711
- __name(_ts_metadata11, "_ts_metadata");
2050
+ __name(_ts_metadata9, "_ts_metadata");
2712
2051
  var MessageStatusCode;
2713
2052
  (function(MessageStatusCode2) {
2714
2053
  MessageStatusCode2["Pending"] = "pending";
2715
2054
  MessageStatusCode2["Success"] = "success";
2716
2055
  MessageStatusCode2["Failed"] = "failed";
2717
2056
  })(MessageStatusCode || (MessageStatusCode = {}));
2718
- (0, import_type_graphql12.registerEnumType)(MessageStatusCode, {
2057
+ (0, import_type_graphql10.registerEnumType)(MessageStatusCode, {
2719
2058
  name: "MessageStatusCode"
2720
2059
  });
2721
2060
  var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
2722
2061
  code;
2723
2062
  }, "BaseMessageStatus");
2724
- _ts_decorate11([
2725
- (0, import_type_graphql12.Field)(() => MessageStatusCode),
2726
- _ts_metadata11("design:type", String)
2063
+ _ts_decorate9([
2064
+ (0, import_type_graphql10.Field)(() => MessageStatusCode),
2065
+ _ts_metadata9("design:type", String)
2727
2066
  ], BaseMessageStatus.prototype, "code", void 0);
2728
- BaseMessageStatus = _ts_decorate11([
2729
- (0, import_type_graphql12.ObjectType)()
2067
+ BaseMessageStatus = _ts_decorate9([
2068
+ (0, import_type_graphql10.ObjectType)()
2730
2069
  ], BaseMessageStatus);
2731
2070
  var PendingMessageStatus = class extends BaseMessageStatus {
2732
2071
  code = "pending";
2733
2072
  };
2734
2073
  __name(PendingMessageStatus, "PendingMessageStatus");
2735
- PendingMessageStatus = _ts_decorate11([
2736
- (0, import_type_graphql12.ObjectType)()
2074
+ PendingMessageStatus = _ts_decorate9([
2075
+ (0, import_type_graphql10.ObjectType)()
2737
2076
  ], PendingMessageStatus);
2738
2077
  var SuccessMessageStatus = class extends BaseMessageStatus {
2739
2078
  code = "success";
2740
2079
  };
2741
2080
  __name(SuccessMessageStatus, "SuccessMessageStatus");
2742
- SuccessMessageStatus = _ts_decorate11([
2743
- (0, import_type_graphql12.ObjectType)()
2081
+ SuccessMessageStatus = _ts_decorate9([
2082
+ (0, import_type_graphql10.ObjectType)()
2744
2083
  ], SuccessMessageStatus);
2745
2084
  var FailedMessageStatus = class extends BaseMessageStatus {
2746
2085
  code = "failed";
2747
2086
  reason;
2748
2087
  };
2749
2088
  __name(FailedMessageStatus, "FailedMessageStatus");
2750
- _ts_decorate11([
2751
- (0, import_type_graphql12.Field)(() => String),
2752
- _ts_metadata11("design:type", String)
2089
+ _ts_decorate9([
2090
+ (0, import_type_graphql10.Field)(() => String),
2091
+ _ts_metadata9("design:type", String)
2753
2092
  ], FailedMessageStatus.prototype, "reason", void 0);
2754
- FailedMessageStatus = _ts_decorate11([
2755
- (0, import_type_graphql12.ObjectType)()
2093
+ FailedMessageStatus = _ts_decorate9([
2094
+ (0, import_type_graphql10.ObjectType)()
2756
2095
  ], FailedMessageStatus);
2757
- var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
2096
+ var MessageStatusUnion = (0, import_type_graphql10.createUnionType)({
2758
2097
  name: "MessageStatus",
2759
2098
  types: () => [
2760
2099
  PendingMessageStatus,
@@ -2765,8 +2104,8 @@ var MessageStatusUnion = (0, import_type_graphql12.createUnionType)({
2765
2104
 
2766
2105
  // src/graphql/types/response-status.type.ts
2767
2106
  var import_graphql_scalars = require("graphql-scalars");
2768
- var import_type_graphql13 = require("type-graphql");
2769
- function _ts_decorate12(decorators, target, key, desc) {
2107
+ var import_type_graphql11 = require("type-graphql");
2108
+ function _ts_decorate10(decorators, target, key, desc) {
2770
2109
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2771
2110
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2772
2111
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2776,30 +2115,30 @@ function _ts_decorate12(decorators, target, key, desc) {
2776
2115
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2777
2116
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2778
2117
  }
2779
- __name(_ts_decorate12, "_ts_decorate");
2780
- function _ts_metadata12(k, v) {
2118
+ __name(_ts_decorate10, "_ts_decorate");
2119
+ function _ts_metadata10(k, v) {
2781
2120
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2782
2121
  return Reflect.metadata(k, v);
2783
2122
  }
2784
- __name(_ts_metadata12, "_ts_metadata");
2123
+ __name(_ts_metadata10, "_ts_metadata");
2785
2124
  var ResponseStatusCode;
2786
2125
  (function(ResponseStatusCode2) {
2787
2126
  ResponseStatusCode2["Pending"] = "pending";
2788
2127
  ResponseStatusCode2["Success"] = "success";
2789
2128
  ResponseStatusCode2["Failed"] = "failed";
2790
2129
  })(ResponseStatusCode || (ResponseStatusCode = {}));
2791
- (0, import_type_graphql13.registerEnumType)(ResponseStatusCode, {
2130
+ (0, import_type_graphql11.registerEnumType)(ResponseStatusCode, {
2792
2131
  name: "ResponseStatusCode"
2793
2132
  });
2794
2133
  var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
2795
2134
  code;
2796
2135
  }, "BaseResponseStatus");
2797
- _ts_decorate12([
2798
- (0, import_type_graphql13.Field)(() => ResponseStatusCode),
2799
- _ts_metadata12("design:type", String)
2136
+ _ts_decorate10([
2137
+ (0, import_type_graphql11.Field)(() => ResponseStatusCode),
2138
+ _ts_metadata10("design:type", String)
2800
2139
  ], BaseResponseStatus.prototype, "code", void 0);
2801
- BaseResponseStatus = _ts_decorate12([
2802
- (0, import_type_graphql13.InterfaceType)({
2140
+ BaseResponseStatus = _ts_decorate10([
2141
+ (0, import_type_graphql11.InterfaceType)({
2803
2142
  resolveType(value) {
2804
2143
  if (value.code === "success") {
2805
2144
  return SuccessResponseStatus;
@@ -2811,14 +2150,14 @@ BaseResponseStatus = _ts_decorate12([
2811
2150
  return void 0;
2812
2151
  }
2813
2152
  }),
2814
- (0, import_type_graphql13.ObjectType)()
2153
+ (0, import_type_graphql11.ObjectType)()
2815
2154
  ], BaseResponseStatus);
2816
2155
  var PendingResponseStatus = class extends BaseResponseStatus {
2817
2156
  code = "pending";
2818
2157
  };
2819
2158
  __name(PendingResponseStatus, "PendingResponseStatus");
2820
- PendingResponseStatus = _ts_decorate12([
2821
- (0, import_type_graphql13.ObjectType)({
2159
+ PendingResponseStatus = _ts_decorate10([
2160
+ (0, import_type_graphql11.ObjectType)({
2822
2161
  implements: BaseResponseStatus
2823
2162
  })
2824
2163
  ], PendingResponseStatus);
@@ -2826,8 +2165,8 @@ var SuccessResponseStatus = class extends BaseResponseStatus {
2826
2165
  code = "success";
2827
2166
  };
2828
2167
  __name(SuccessResponseStatus, "SuccessResponseStatus");
2829
- SuccessResponseStatus = _ts_decorate12([
2830
- (0, import_type_graphql13.ObjectType)({
2168
+ SuccessResponseStatus = _ts_decorate10([
2169
+ (0, import_type_graphql11.ObjectType)({
2831
2170
  implements: BaseResponseStatus
2832
2171
  })
2833
2172
  ], SuccessResponseStatus);
@@ -2837,7 +2176,7 @@ var FailedResponseStatusReason;
2837
2176
  FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
2838
2177
  FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
2839
2178
  })(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
2840
- (0, import_type_graphql13.registerEnumType)(FailedResponseStatusReason, {
2179
+ (0, import_type_graphql11.registerEnumType)(FailedResponseStatusReason, {
2841
2180
  name: "FailedResponseStatusReason"
2842
2181
  });
2843
2182
  var FailedResponseStatus = class extends BaseResponseStatus {
@@ -2846,22 +2185,22 @@ var FailedResponseStatus = class extends BaseResponseStatus {
2846
2185
  details = null;
2847
2186
  };
2848
2187
  __name(FailedResponseStatus, "FailedResponseStatus");
2849
- _ts_decorate12([
2850
- (0, import_type_graphql13.Field)(() => FailedResponseStatusReason),
2851
- _ts_metadata12("design:type", String)
2188
+ _ts_decorate10([
2189
+ (0, import_type_graphql11.Field)(() => FailedResponseStatusReason),
2190
+ _ts_metadata10("design:type", String)
2852
2191
  ], FailedResponseStatus.prototype, "reason", void 0);
2853
- _ts_decorate12([
2854
- (0, import_type_graphql13.Field)(() => import_graphql_scalars.GraphQLJSON, {
2192
+ _ts_decorate10([
2193
+ (0, import_type_graphql11.Field)(() => import_graphql_scalars.GraphQLJSON, {
2855
2194
  nullable: true
2856
2195
  }),
2857
- _ts_metadata12("design:type", typeof Record === "undefined" ? Object : Record)
2196
+ _ts_metadata10("design:type", typeof Record === "undefined" ? Object : Record)
2858
2197
  ], FailedResponseStatus.prototype, "details", void 0);
2859
- FailedResponseStatus = _ts_decorate12([
2860
- (0, import_type_graphql13.ObjectType)({
2198
+ FailedResponseStatus = _ts_decorate10([
2199
+ (0, import_type_graphql11.ObjectType)({
2861
2200
  implements: BaseResponseStatus
2862
2201
  })
2863
2202
  ], FailedResponseStatus);
2864
- var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
2203
+ var ResponseStatusUnion = (0, import_type_graphql11.createUnionType)({
2865
2204
  name: "ResponseStatus",
2866
2205
  types: () => [
2867
2206
  PendingResponseStatus,
@@ -2871,7 +2210,7 @@ var ResponseStatusUnion = (0, import_type_graphql13.createUnionType)({
2871
2210
  });
2872
2211
 
2873
2212
  // src/graphql/types/copilot-response.type.ts
2874
- function _ts_decorate13(decorators, target, key, desc) {
2213
+ function _ts_decorate11(decorators, target, key, desc) {
2875
2214
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2876
2215
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2877
2216
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2881,31 +2220,31 @@ function _ts_decorate13(decorators, target, key, desc) {
2881
2220
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2882
2221
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2883
2222
  }
2884
- __name(_ts_decorate13, "_ts_decorate");
2885
- function _ts_metadata13(k, v) {
2223
+ __name(_ts_decorate11, "_ts_decorate");
2224
+ function _ts_metadata11(k, v) {
2886
2225
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2887
2226
  return Reflect.metadata(k, v);
2888
2227
  }
2889
- __name(_ts_metadata13, "_ts_metadata");
2228
+ __name(_ts_metadata11, "_ts_metadata");
2890
2229
  var BaseMessageOutput = /* @__PURE__ */ __name(class BaseMessageOutput2 {
2891
2230
  id;
2892
2231
  createdAt;
2893
2232
  status;
2894
2233
  }, "BaseMessageOutput");
2895
- _ts_decorate13([
2896
- (0, import_type_graphql14.Field)(() => String),
2897
- _ts_metadata13("design:type", String)
2234
+ _ts_decorate11([
2235
+ (0, import_type_graphql12.Field)(() => String),
2236
+ _ts_metadata11("design:type", String)
2898
2237
  ], BaseMessageOutput.prototype, "id", void 0);
2899
- _ts_decorate13([
2900
- (0, import_type_graphql14.Field)(() => Date),
2901
- _ts_metadata13("design:type", typeof Date === "undefined" ? Object : Date)
2238
+ _ts_decorate11([
2239
+ (0, import_type_graphql12.Field)(() => Date),
2240
+ _ts_metadata11("design:type", typeof Date === "undefined" ? Object : Date)
2902
2241
  ], BaseMessageOutput.prototype, "createdAt", void 0);
2903
- _ts_decorate13([
2904
- (0, import_type_graphql14.Field)(() => MessageStatusUnion),
2905
- _ts_metadata13("design:type", Object)
2242
+ _ts_decorate11([
2243
+ (0, import_type_graphql12.Field)(() => MessageStatusUnion),
2244
+ _ts_metadata11("design:type", Object)
2906
2245
  ], BaseMessageOutput.prototype, "status", void 0);
2907
- BaseMessageOutput = _ts_decorate13([
2908
- (0, import_type_graphql14.InterfaceType)({
2246
+ BaseMessageOutput = _ts_decorate11([
2247
+ (0, import_type_graphql12.InterfaceType)({
2909
2248
  resolveType(value) {
2910
2249
  if (value.hasOwnProperty("content")) {
2911
2250
  return TextMessageOutput;
@@ -2913,8 +2252,6 @@ BaseMessageOutput = _ts_decorate13([
2913
2252
  return ActionExecutionMessageOutput;
2914
2253
  } else if (value.hasOwnProperty("result")) {
2915
2254
  return ResultMessageOutput;
2916
- } else if (value.hasOwnProperty("state")) {
2917
- return AgentStateMessageOutput;
2918
2255
  }
2919
2256
  return void 0;
2920
2257
  }
@@ -2925,18 +2262,18 @@ var TextMessageOutput = class {
2925
2262
  content;
2926
2263
  };
2927
2264
  __name(TextMessageOutput, "TextMessageOutput");
2928
- _ts_decorate13([
2929
- (0, import_type_graphql14.Field)(() => MessageRole),
2930
- _ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
2265
+ _ts_decorate11([
2266
+ (0, import_type_graphql12.Field)(() => MessageRole),
2267
+ _ts_metadata11("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
2931
2268
  ], TextMessageOutput.prototype, "role", void 0);
2932
- _ts_decorate13([
2933
- (0, import_type_graphql14.Field)(() => [
2269
+ _ts_decorate11([
2270
+ (0, import_type_graphql12.Field)(() => [
2934
2271
  String
2935
2272
  ]),
2936
- _ts_metadata13("design:type", Array)
2273
+ _ts_metadata11("design:type", Array)
2937
2274
  ], TextMessageOutput.prototype, "content", void 0);
2938
- TextMessageOutput = _ts_decorate13([
2939
- (0, import_type_graphql14.ObjectType)({
2275
+ TextMessageOutput = _ts_decorate11([
2276
+ (0, import_type_graphql12.ObjectType)({
2940
2277
  implements: BaseMessageOutput
2941
2278
  })
2942
2279
  ], TextMessageOutput);
@@ -2946,22 +2283,22 @@ var ActionExecutionMessageOutput = class {
2946
2283
  arguments;
2947
2284
  };
2948
2285
  __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
2949
- _ts_decorate13([
2950
- (0, import_type_graphql14.Field)(() => String),
2951
- _ts_metadata13("design:type", String)
2286
+ _ts_decorate11([
2287
+ (0, import_type_graphql12.Field)(() => String),
2288
+ _ts_metadata11("design:type", String)
2952
2289
  ], ActionExecutionMessageOutput.prototype, "name", void 0);
2953
- _ts_decorate13([
2954
- (0, import_type_graphql14.Field)(() => ActionExecutionScope),
2955
- _ts_metadata13("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
2290
+ _ts_decorate11([
2291
+ (0, import_type_graphql12.Field)(() => ActionExecutionScope),
2292
+ _ts_metadata11("design:type", typeof ActionExecutionScope === "undefined" ? Object : ActionExecutionScope)
2956
2293
  ], ActionExecutionMessageOutput.prototype, "scope", void 0);
2957
- _ts_decorate13([
2958
- (0, import_type_graphql14.Field)(() => [
2294
+ _ts_decorate11([
2295
+ (0, import_type_graphql12.Field)(() => [
2959
2296
  String
2960
2297
  ]),
2961
- _ts_metadata13("design:type", Array)
2298
+ _ts_metadata11("design:type", Array)
2962
2299
  ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
2963
- ActionExecutionMessageOutput = _ts_decorate13([
2964
- (0, import_type_graphql14.ObjectType)({
2300
+ ActionExecutionMessageOutput = _ts_decorate11([
2301
+ (0, import_type_graphql12.ObjectType)({
2965
2302
  implements: BaseMessageOutput
2966
2303
  })
2967
2304
  ], ActionExecutionMessageOutput);
@@ -2971,71 +2308,23 @@ var ResultMessageOutput = class {
2971
2308
  result;
2972
2309
  };
2973
2310
  __name(ResultMessageOutput, "ResultMessageOutput");
2974
- _ts_decorate13([
2975
- (0, import_type_graphql14.Field)(() => String),
2976
- _ts_metadata13("design:type", String)
2311
+ _ts_decorate11([
2312
+ (0, import_type_graphql12.Field)(() => String),
2313
+ _ts_metadata11("design:type", String)
2977
2314
  ], ResultMessageOutput.prototype, "actionExecutionId", void 0);
2978
- _ts_decorate13([
2979
- (0, import_type_graphql14.Field)(() => String),
2980
- _ts_metadata13("design:type", String)
2315
+ _ts_decorate11([
2316
+ (0, import_type_graphql12.Field)(() => String),
2317
+ _ts_metadata11("design:type", String)
2981
2318
  ], ResultMessageOutput.prototype, "actionName", void 0);
2982
- _ts_decorate13([
2983
- (0, import_type_graphql14.Field)(() => String),
2984
- _ts_metadata13("design:type", String)
2319
+ _ts_decorate11([
2320
+ (0, import_type_graphql12.Field)(() => String),
2321
+ _ts_metadata11("design:type", String)
2985
2322
  ], ResultMessageOutput.prototype, "result", void 0);
2986
- ResultMessageOutput = _ts_decorate13([
2987
- (0, import_type_graphql14.ObjectType)({
2323
+ ResultMessageOutput = _ts_decorate11([
2324
+ (0, import_type_graphql12.ObjectType)({
2988
2325
  implements: BaseMessageOutput
2989
2326
  })
2990
2327
  ], ResultMessageOutput);
2991
- var AgentStateMessageOutput = class {
2992
- threadId;
2993
- agentName;
2994
- nodeName;
2995
- runId;
2996
- active;
2997
- role;
2998
- state;
2999
- running;
3000
- };
3001
- __name(AgentStateMessageOutput, "AgentStateMessageOutput");
3002
- _ts_decorate13([
3003
- (0, import_type_graphql14.Field)(() => String),
3004
- _ts_metadata13("design:type", String)
3005
- ], AgentStateMessageOutput.prototype, "threadId", void 0);
3006
- _ts_decorate13([
3007
- (0, import_type_graphql14.Field)(() => String),
3008
- _ts_metadata13("design:type", String)
3009
- ], AgentStateMessageOutput.prototype, "agentName", void 0);
3010
- _ts_decorate13([
3011
- (0, import_type_graphql14.Field)(() => String),
3012
- _ts_metadata13("design:type", String)
3013
- ], AgentStateMessageOutput.prototype, "nodeName", void 0);
3014
- _ts_decorate13([
3015
- (0, import_type_graphql14.Field)(() => String),
3016
- _ts_metadata13("design:type", String)
3017
- ], AgentStateMessageOutput.prototype, "runId", void 0);
3018
- _ts_decorate13([
3019
- (0, import_type_graphql14.Field)(() => Boolean),
3020
- _ts_metadata13("design:type", Boolean)
3021
- ], AgentStateMessageOutput.prototype, "active", void 0);
3022
- _ts_decorate13([
3023
- (0, import_type_graphql14.Field)(() => MessageRole),
3024
- _ts_metadata13("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
3025
- ], AgentStateMessageOutput.prototype, "role", void 0);
3026
- _ts_decorate13([
3027
- (0, import_type_graphql14.Field)(() => String),
3028
- _ts_metadata13("design:type", String)
3029
- ], AgentStateMessageOutput.prototype, "state", void 0);
3030
- _ts_decorate13([
3031
- (0, import_type_graphql14.Field)(() => Boolean),
3032
- _ts_metadata13("design:type", Boolean)
3033
- ], AgentStateMessageOutput.prototype, "running", void 0);
3034
- AgentStateMessageOutput = _ts_decorate13([
3035
- (0, import_type_graphql14.ObjectType)({
3036
- implements: BaseMessageOutput
3037
- })
3038
- ], AgentStateMessageOutput);
3039
2328
  var CopilotResponse = class {
3040
2329
  threadId;
3041
2330
  status;
@@ -3043,28 +2332,28 @@ var CopilotResponse = class {
3043
2332
  messages;
3044
2333
  };
3045
2334
  __name(CopilotResponse, "CopilotResponse");
3046
- _ts_decorate13([
3047
- (0, import_type_graphql14.Field)(() => String),
3048
- _ts_metadata13("design:type", String)
2335
+ _ts_decorate11([
2336
+ (0, import_type_graphql12.Field)(() => String),
2337
+ _ts_metadata11("design:type", String)
3049
2338
  ], CopilotResponse.prototype, "threadId", void 0);
3050
- _ts_decorate13([
3051
- (0, import_type_graphql14.Field)(() => ResponseStatusUnion),
3052
- _ts_metadata13("design:type", Object)
2339
+ _ts_decorate11([
2340
+ (0, import_type_graphql12.Field)(() => ResponseStatusUnion),
2341
+ _ts_metadata11("design:type", Object)
3053
2342
  ], CopilotResponse.prototype, "status", void 0);
3054
- _ts_decorate13([
3055
- (0, import_type_graphql14.Field)({
2343
+ _ts_decorate11([
2344
+ (0, import_type_graphql12.Field)({
3056
2345
  nullable: true
3057
2346
  }),
3058
- _ts_metadata13("design:type", String)
2347
+ _ts_metadata11("design:type", String)
3059
2348
  ], CopilotResponse.prototype, "runId", void 0);
3060
- _ts_decorate13([
3061
- (0, import_type_graphql14.Field)(() => [
2349
+ _ts_decorate11([
2350
+ (0, import_type_graphql12.Field)(() => [
3062
2351
  BaseMessageOutput
3063
2352
  ]),
3064
- _ts_metadata13("design:type", Array)
2353
+ _ts_metadata11("design:type", Array)
3065
2354
  ], CopilotResponse.prototype, "messages", void 0);
3066
- CopilotResponse = _ts_decorate13([
3067
- (0, import_type_graphql14.ObjectType)()
2355
+ CopilotResponse = _ts_decorate11([
2356
+ (0, import_type_graphql12.ObjectType)()
3068
2357
  ], CopilotResponse);
3069
2358
 
3070
2359
  // src/graphql/resolvers/copilot.resolver.ts
@@ -3106,9 +2395,18 @@ var UnknownErrorResponse = class extends FailedResponseStatus {
3106
2395
  };
3107
2396
  __name(UnknownErrorResponse, "UnknownErrorResponse");
3108
2397
 
2398
+ // src/lib/telemetry-client.ts
2399
+ var import_shared8 = require("@copilotkit/shared");
2400
+ var packageJson = require_package();
2401
+ var telemetryClient = new import_shared8.TelemetryClient({
2402
+ packageName: packageJson.name,
2403
+ packageVersion: packageJson.version
2404
+ });
2405
+ var telemetry_client_default = telemetryClient;
2406
+
3109
2407
  // src/graphql/resolvers/copilot.resolver.ts
3110
2408
  var import_shared9 = require("@copilotkit/shared");
3111
- function _ts_decorate14(decorators, target, key, desc) {
2409
+ function _ts_decorate12(decorators, target, key, desc) {
3112
2410
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3113
2411
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3114
2412
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3118,12 +2416,12 @@ function _ts_decorate14(decorators, target, key, desc) {
3118
2416
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3119
2417
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3120
2418
  }
3121
- __name(_ts_decorate14, "_ts_decorate");
3122
- function _ts_metadata14(k, v) {
2419
+ __name(_ts_decorate12, "_ts_decorate");
2420
+ function _ts_metadata12(k, v) {
3123
2421
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3124
2422
  return Reflect.metadata(k, v);
3125
2423
  }
3126
- __name(_ts_metadata14, "_ts_metadata");
2424
+ __name(_ts_metadata12, "_ts_metadata");
3127
2425
  function _ts_param(paramIndex, decorator) {
3128
2426
  return function(target, key) {
3129
2427
  decorator(target, key, paramIndex);
@@ -3132,6 +2430,7 @@ function _ts_param(paramIndex, decorator) {
3132
2430
  __name(_ts_param, "_ts_param");
3133
2431
  var invokeGuardrails = /* @__PURE__ */ __name(async ({ baseUrl, copilotCloudPublicApiKey, data, onResult, onError }) => {
3134
2432
  var _a;
2433
+ console.log("invokeGuardrails.baseUrl", baseUrl);
3135
2434
  if (data.messages.length && ((_a = data.messages[data.messages.length - 1].textMessage) == null ? void 0 : _a.role) === MessageRole.user) {
3136
2435
  const messages = data.messages.filter((m) => m.textMessage !== void 0 && (m.textMessage.role === MessageRole.user || m.textMessage.role === MessageRole.assistant)).map((m) => ({
3137
2436
  role: m.textMessage.role,
@@ -3177,6 +2476,8 @@ var CopilotResolver = class {
3177
2476
  logger2.debug({
3178
2477
  data
3179
2478
  }, "Generating Copilot response");
2479
+ const copilotRuntime = ctx._copilotkit.runtime;
2480
+ const serviceAdapter = ctx._copilotkit.serviceAdapter;
3180
2481
  if (properties) {
3181
2482
  logger2.debug("Properties provided, merging with context properties");
3182
2483
  ctx.properties = {
@@ -3184,8 +2485,6 @@ var CopilotResolver = class {
3184
2485
  ...properties
3185
2486
  };
3186
2487
  }
3187
- const copilotRuntime = ctx._copilotkit.runtime;
3188
- const serviceAdapter = ctx._copilotkit.serviceAdapter;
3189
2488
  let copilotCloudPublicApiKey = null;
3190
2489
  let copilotCloudBaseUrl;
3191
2490
  if (data.cloud) {
@@ -3213,9 +2512,9 @@ var CopilotResolver = class {
3213
2512
  });
3214
2513
  }
3215
2514
  logger2.debug("Setting up subjects");
3216
- const responseStatus$ = new import_rxjs4.ReplaySubject();
3217
- const interruptStreaming$ = new import_rxjs4.ReplaySubject();
3218
- const guardrailsResult$ = new import_rxjs4.ReplaySubject();
2515
+ const responseStatus$ = new import_rxjs2.ReplaySubject();
2516
+ const interruptStreaming$ = new import_rxjs2.ReplaySubject();
2517
+ const guardrailsResult$ = new import_rxjs2.ReplaySubject();
3219
2518
  let outputMessages = [];
3220
2519
  let resolveOutputMessagesPromise;
3221
2520
  let rejectOutputMessagesPromise;
@@ -3224,25 +2523,23 @@ var CopilotResolver = class {
3224
2523
  rejectOutputMessagesPromise = reject;
3225
2524
  });
3226
2525
  logger2.debug("Processing");
3227
- const { eventSource, threadId = (0, import_shared9.randomId)(), runId, serverSideActions, actionInputsWithoutAgents } = await copilotRuntime.processRuntimeRequest({
2526
+ const { eventSource, threadId = (0, import_shared9.randomId)(), runId, actions } = await copilotRuntime.process({
3228
2527
  serviceAdapter,
3229
2528
  messages: data.messages,
3230
2529
  actions: data.frontend.actions,
3231
2530
  threadId: data.threadId,
3232
2531
  runId: data.runId,
3233
2532
  publicApiKey: void 0,
2533
+ properties: ctx.properties || {},
3234
2534
  outputMessagesPromise,
3235
- graphqlContext: ctx,
3236
2535
  forwardedParameters: data.forwardedParameters,
3237
- agentSession: data.agentSession,
3238
- agentStates: data.agentStates,
3239
2536
  url: data.frontend.url
3240
2537
  });
3241
2538
  logger2.debug("Event source created, creating response");
3242
2539
  const response = {
3243
2540
  threadId,
3244
2541
  runId,
3245
- status: (0, import_rxjs4.firstValueFrom)(responseStatus$),
2542
+ status: (0, import_rxjs2.firstValueFrom)(responseStatus$),
3246
2543
  messages: new import_graphql_yoga.Repeater(async (pushMessage, stopStreamingMessages) => {
3247
2544
  var _a2, _b2;
3248
2545
  logger2.debug("Messages repeater created");
@@ -3293,18 +2590,14 @@ var CopilotResolver = class {
3293
2590
  });
3294
2591
  }
3295
2592
  let eventStreamSubscription;
3296
- const eventStream = eventSource.processRuntimeEvents({
3297
- serverSideActions,
3298
- guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null,
3299
- actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
3300
- // TODO-AGENTS: do not exclude ALL server side actions
3301
- (action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
3302
- )
2593
+ const eventStream = eventSource.process({
2594
+ serversideActions: actions,
2595
+ guardrailsResult$: ((_b2 = data.cloud) == null ? void 0 : _b2.guardrails) ? guardrailsResult$ : null
3303
2596
  }).pipe(
3304
2597
  // shareReplay() ensures that later subscribers will see the whole stream instead of
3305
2598
  // just the events that were emitted after the subscriber was added.
3306
- (0, import_rxjs4.shareReplay)(),
3307
- (0, import_rxjs4.finalize)(() => {
2599
+ (0, import_rxjs2.shareReplay)(),
2600
+ (0, import_rxjs2.finalize)(() => {
3308
2601
  logger2.debug("Event stream finalized");
3309
2602
  })
3310
2603
  );
@@ -3315,22 +2608,22 @@ var CopilotResolver = class {
3315
2608
  case RuntimeEventTypes.TextMessageStart:
3316
2609
  const textMessageContentStream = eventStream.pipe(
3317
2610
  // skip until this message start event
3318
- (0, import_rxjs4.skipWhile)((e) => e !== event),
2611
+ (0, import_rxjs2.skipWhile)((e) => e !== event),
3319
2612
  // take until the message end event
3320
- (0, import_rxjs4.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
2613
+ (0, import_rxjs2.takeWhile)((e) => e.type != RuntimeEventTypes.TextMessageEnd)
3321
2614
  );
3322
- const streamingTextStatus = new import_rxjs4.Subject();
2615
+ const streamingTextStatus = new import_rxjs2.Subject();
3323
2616
  const messageId = (0, import_shared9.randomId)();
3324
2617
  pushMessage({
3325
2618
  id: messageId,
3326
- status: (0, import_rxjs4.firstValueFrom)(streamingTextStatus),
2619
+ status: (0, import_rxjs2.firstValueFrom)(streamingTextStatus),
3327
2620
  createdAt: /* @__PURE__ */ new Date(),
3328
2621
  role: MessageRole.assistant,
3329
2622
  content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
3330
2623
  logger2.debug("Text message content repeater created");
3331
2624
  const textChunks = [];
3332
2625
  let textSubscription;
3333
- interruptStreaming$.pipe((0, import_rxjs4.shareReplay)(), (0, import_rxjs4.take)(1), (0, import_rxjs4.tap)(({ reason, messageId: messageId2 }) => {
2626
+ interruptStreaming$.pipe((0, import_rxjs2.shareReplay)(), (0, import_rxjs2.take)(1), (0, import_rxjs2.tap)(({ reason, messageId: messageId2 }) => {
3334
2627
  logger2.debug({
3335
2628
  reason,
3336
2629
  messageId: messageId2
@@ -3381,11 +2674,11 @@ var CopilotResolver = class {
3381
2674
  break;
3382
2675
  case RuntimeEventTypes.ActionExecutionStart:
3383
2676
  logger2.debug("Action execution start event received");
3384
- const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs4.skipWhile)((e) => e !== event), (0, import_rxjs4.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
3385
- const streamingArgumentsStatus = new import_rxjs4.Subject();
2677
+ const actionExecutionArgumentStream = eventStream.pipe((0, import_rxjs2.skipWhile)((e) => e !== event), (0, import_rxjs2.takeWhile)((e) => e.type != RuntimeEventTypes.ActionExecutionEnd));
2678
+ const streamingArgumentsStatus = new import_rxjs2.Subject();
3386
2679
  pushMessage({
3387
2680
  id: event.actionExecutionId,
3388
- status: (0, import_rxjs4.firstValueFrom)(streamingArgumentsStatus),
2681
+ status: (0, import_rxjs2.firstValueFrom)(streamingArgumentsStatus),
3389
2682
  createdAt: /* @__PURE__ */ new Date(),
3390
2683
  name: event.actionName,
3391
2684
  scope: event.scope,
@@ -3447,36 +2740,6 @@ var CopilotResolver = class {
3447
2740
  result: event.result
3448
2741
  }));
3449
2742
  break;
3450
- case RuntimeEventTypes.AgentStateMessage:
3451
- logger2.debug({
3452
- event
3453
- }, "Agent message event received");
3454
- pushMessage({
3455
- id: (0, import_shared9.randomId)(),
3456
- status: new SuccessMessageStatus(),
3457
- threadId: event.threadId,
3458
- agentName: event.agentName,
3459
- nodeName: event.nodeName,
3460
- runId: event.runId,
3461
- active: event.active,
3462
- state: event.state,
3463
- running: event.running,
3464
- role: MessageRole.assistant,
3465
- createdAt: /* @__PURE__ */ new Date()
3466
- });
3467
- outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
3468
- id: (0, import_shared9.randomId)(),
3469
- threadId: event.threadId,
3470
- agentName: event.agentName,
3471
- nodeName: event.nodeName,
3472
- runId: event.runId,
3473
- active: event.active,
3474
- state: event.state,
3475
- running: event.running,
3476
- role: MessageRole.assistant,
3477
- createdAt: /* @__PURE__ */ new Date()
3478
- }));
3479
- break;
3480
2743
  }
3481
2744
  },
3482
2745
  error: (err) => {
@@ -3495,7 +2758,7 @@ var CopilotResolver = class {
3495
2758
  logger2.debug("Event stream completed");
3496
2759
  if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
3497
2760
  logger2.debug("Guardrails is enabled, waiting for guardrails result");
3498
- await (0, import_rxjs4.firstValueFrom)(guardrailsResult$);
2761
+ await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
3499
2762
  }
3500
2763
  responseStatus$.next(new SuccessResponseStatus());
3501
2764
  eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
@@ -3509,29 +2772,29 @@ var CopilotResolver = class {
3509
2772
  }
3510
2773
  };
3511
2774
  __name(CopilotResolver, "CopilotResolver");
3512
- _ts_decorate14([
3513
- (0, import_type_graphql15.Query)(() => String),
3514
- _ts_metadata14("design:type", Function),
3515
- _ts_metadata14("design:paramtypes", []),
3516
- _ts_metadata14("design:returntype", Promise)
2775
+ _ts_decorate12([
2776
+ (0, import_type_graphql13.Query)(() => String),
2777
+ _ts_metadata12("design:type", Function),
2778
+ _ts_metadata12("design:paramtypes", []),
2779
+ _ts_metadata12("design:returntype", Promise)
3517
2780
  ], CopilotResolver.prototype, "hello", null);
3518
- _ts_decorate14([
3519
- (0, import_type_graphql15.Mutation)(() => CopilotResponse),
3520
- _ts_param(0, (0, import_type_graphql15.Ctx)()),
3521
- _ts_param(1, (0, import_type_graphql15.Arg)("data")),
3522
- _ts_param(2, (0, import_type_graphql15.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
2781
+ _ts_decorate12([
2782
+ (0, import_type_graphql13.Mutation)(() => CopilotResponse),
2783
+ _ts_param(0, (0, import_type_graphql13.Ctx)()),
2784
+ _ts_param(1, (0, import_type_graphql13.Arg)("data")),
2785
+ _ts_param(2, (0, import_type_graphql13.Arg)("properties", () => import_graphql_scalars2.GraphQLJSONObject, {
3523
2786
  nullable: true
3524
2787
  })),
3525
- _ts_metadata14("design:type", Function),
3526
- _ts_metadata14("design:paramtypes", [
2788
+ _ts_metadata12("design:type", Function),
2789
+ _ts_metadata12("design:paramtypes", [
3527
2790
  typeof GraphQLContext === "undefined" ? Object : GraphQLContext,
3528
2791
  typeof GenerateCopilotResponseInput === "undefined" ? Object : GenerateCopilotResponseInput,
3529
2792
  typeof CopilotRequestContextProperties === "undefined" ? Object : CopilotRequestContextProperties
3530
2793
  ]),
3531
- _ts_metadata14("design:returntype", Promise)
2794
+ _ts_metadata12("design:returntype", Promise)
3532
2795
  ], CopilotResolver.prototype, "generateCopilotResponse", null);
3533
- CopilotResolver = _ts_decorate14([
3534
- (0, import_type_graphql15.Resolver)(() => CopilotResponse)
2796
+ CopilotResolver = _ts_decorate12([
2797
+ (0, import_type_graphql13.Resolver)(() => CopilotResponse)
3535
2798
  ], CopilotResolver);
3536
2799
 
3537
2800
  // src/lib/integrations/shared.ts
@@ -3586,7 +2849,7 @@ async function createContext(initialContext, copilotKitContext, contextLogger, p
3586
2849
  __name(createContext, "createContext");
3587
2850
  function buildSchema(options = {}) {
3588
2851
  logger.debug("Building GraphQL schema...");
3589
- const schema = (0, import_type_graphql16.buildSchemaSync)({
2852
+ const schema = (0, import_type_graphql14.buildSchemaSync)({
3590
2853
  resolvers: [
3591
2854
  CopilotResolver
3592
2855
  ],