@copilotkit/runtime 1.2.0 → 1.2.2-feat-runtime-remote-actions.0

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