@copilotkit/runtime 1.5.15-next.6 → 1.5.15-next.8

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 (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/__snapshots__/schema/schema.graphql +14 -1
  3. package/dist/{chunk-AJWO2KBE.mjs → chunk-253HES6R.mjs} +2 -2
  4. package/dist/{chunk-MKC4PI66.mjs → chunk-5EJIMI36.mjs} +2 -2
  5. package/dist/{chunk-EMZY3B5S.mjs → chunk-HG6ZQKQW.mjs} +551 -425
  6. package/dist/chunk-HG6ZQKQW.mjs.map +1 -0
  7. package/dist/{chunk-OI2VCNPX.mjs → chunk-R7GOSVTA.mjs} +2 -2
  8. package/dist/{copilot-runtime-a113045f.d.ts → copilot-runtime-3e7f1c7b.d.ts} +5 -4
  9. package/dist/graphql/types/converted/index.d.ts +1 -1
  10. package/dist/{groq-adapter-248058e8.d.ts → groq-adapter-3b894689.d.ts} +1 -1
  11. package/dist/{index-a7f37670.d.ts → index-f6d1f30b.d.ts} +1 -1
  12. package/dist/index.d.ts +4 -4
  13. package/dist/index.js +1296 -1170
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +4 -4
  16. package/dist/{langserve-9580bd66.d.ts → langserve-3a591089.d.ts} +11 -3
  17. package/dist/lib/index.d.ts +4 -4
  18. package/dist/lib/index.js +1296 -1170
  19. package/dist/lib/index.js.map +1 -1
  20. package/dist/lib/index.mjs +4 -4
  21. package/dist/lib/integrations/index.d.ts +4 -4
  22. package/dist/lib/integrations/index.js +493 -400
  23. package/dist/lib/integrations/index.js.map +1 -1
  24. package/dist/lib/integrations/index.mjs +4 -4
  25. package/dist/lib/integrations/nest/index.d.ts +3 -3
  26. package/dist/lib/integrations/nest/index.js +493 -400
  27. package/dist/lib/integrations/nest/index.js.map +1 -1
  28. package/dist/lib/integrations/nest/index.mjs +2 -2
  29. package/dist/lib/integrations/node-express/index.d.ts +3 -3
  30. package/dist/lib/integrations/node-express/index.js +493 -400
  31. package/dist/lib/integrations/node-express/index.js.map +1 -1
  32. package/dist/lib/integrations/node-express/index.mjs +2 -2
  33. package/dist/lib/integrations/node-http/index.d.ts +3 -3
  34. package/dist/lib/integrations/node-http/index.js +493 -400
  35. package/dist/lib/integrations/node-http/index.js.map +1 -1
  36. package/dist/lib/integrations/node-http/index.mjs +1 -1
  37. package/dist/service-adapters/index.d.ts +4 -4
  38. package/package.json +2 -2
  39. package/src/agents/langgraph/event-source.ts +7 -0
  40. package/src/agents/langgraph/events.ts +11 -1
  41. package/src/graphql/inputs/meta-event.input.ts +4 -3
  42. package/src/graphql/resolvers/copilot.resolver.ts +44 -1
  43. package/src/graphql/types/copilot-response.type.ts +1 -3
  44. package/src/graphql/types/meta-events.type.ts +41 -1
  45. package/src/lib/runtime/copilot-runtime.ts +18 -9
  46. package/src/lib/runtime/remote-lg-action.ts +44 -19
  47. package/src/service-adapters/events.ts +8 -2
  48. package/dist/chunk-EMZY3B5S.mjs.map +0 -1
  49. /package/dist/{chunk-AJWO2KBE.mjs.map → chunk-253HES6R.mjs.map} +0 -0
  50. /package/dist/{chunk-MKC4PI66.mjs.map → chunk-5EJIMI36.mjs.map} +0 -0
  51. /package/dist/{chunk-OI2VCNPX.mjs.map → chunk-R7GOSVTA.mjs.map} +0 -0
package/dist/lib/index.js CHANGED
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  publishConfig: {
45
45
  access: "public"
46
46
  },
47
- version: "1.5.15-next.6",
47
+ version: "1.5.15-next.8",
48
48
  sideEffects: false,
49
49
  main: "./dist/index.js",
50
50
  module: "./dist/index.mjs",
@@ -1255,10 +1255,12 @@ var LangGraphEventTypes;
1255
1255
  LangGraphEventTypes2["OnCopilotKitEmitToolCall"] = "on_copilotkit_emit_tool_call";
1256
1256
  LangGraphEventTypes2["OnCustomEvent"] = "on_custom_event";
1257
1257
  LangGraphEventTypes2["OnInterrupt"] = "on_interrupt";
1258
+ LangGraphEventTypes2["OnCopilotKitInterrupt"] = "on_copilotkit_interrupt";
1258
1259
  })(LangGraphEventTypes || (LangGraphEventTypes = {}));
1259
1260
  var MetaEventNames;
1260
1261
  (function(MetaEventNames2) {
1261
1262
  MetaEventNames2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1263
+ MetaEventNames2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
1262
1264
  })(MetaEventNames || (MetaEventNames = {}));
1263
1265
  var CustomEventNames;
1264
1266
  (function(CustomEventNames2) {
@@ -1363,6 +1365,13 @@ var RemoteLangGraphEventSource = class {
1363
1365
  value: acc.event.value
1364
1366
  });
1365
1367
  }
1368
+ if (acc.event.event === LangGraphEventTypes.OnCopilotKitInterrupt) {
1369
+ events.push({
1370
+ type: RuntimeEventTypes.MetaEvent,
1371
+ name: RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent,
1372
+ data: acc.event.data
1373
+ });
1374
+ }
1366
1375
  const responseMetadata = this.getResponseMetadata(acc.event);
1367
1376
  if ((responseMetadata == null ? void 0 : responseMetadata.finish_reason) === "tool_calls" && this.shouldEmitToolCall(shouldEmitToolCalls, acc.lastToolCallName)) {
1368
1377
  events.push({
@@ -1531,6 +1540,12 @@ var ActionInputAvailability;
1531
1540
  });
1532
1541
 
1533
1542
  // src/graphql/types/meta-events.type.ts
1543
+ var import_type_graphql6 = require("type-graphql");
1544
+
1545
+ // src/graphql/types/copilot-response.type.ts
1546
+ var import_type_graphql5 = require("type-graphql");
1547
+
1548
+ // src/graphql/types/message-status.type.ts
1534
1549
  var import_type_graphql2 = require("type-graphql");
1535
1550
  function _ts_decorate(decorators, target, key, desc) {
1536
1551
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1548,151 +1563,634 @@ function _ts_metadata(k, v) {
1548
1563
  return Reflect.metadata(k, v);
1549
1564
  }
1550
1565
  __name(_ts_metadata, "_ts_metadata");
1551
- var MetaEventName;
1552
- (function(MetaEventName2) {
1553
- MetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1554
- })(MetaEventName || (MetaEventName = {}));
1555
- (0, import_type_graphql2.registerEnumType)(MetaEventName, {
1556
- name: "MetaEventName",
1557
- description: "Meta event types"
1566
+ var MessageStatusCode;
1567
+ (function(MessageStatusCode2) {
1568
+ MessageStatusCode2["Pending"] = "pending";
1569
+ MessageStatusCode2["Success"] = "success";
1570
+ MessageStatusCode2["Failed"] = "failed";
1571
+ })(MessageStatusCode || (MessageStatusCode = {}));
1572
+ (0, import_type_graphql2.registerEnumType)(MessageStatusCode, {
1573
+ name: "MessageStatusCode"
1558
1574
  });
1559
- var BaseMetaEvent = class {
1560
- type = "MetaEvent";
1561
- name;
1562
- };
1563
- __name(BaseMetaEvent, "BaseMetaEvent");
1564
- _ts_decorate([
1565
- (0, import_type_graphql2.Field)(() => String),
1566
- _ts_metadata("design:type", String)
1567
- ], BaseMetaEvent.prototype, "type", void 0);
1575
+ var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
1576
+ code;
1577
+ }, "BaseMessageStatus");
1568
1578
  _ts_decorate([
1569
- (0, import_type_graphql2.Field)(() => MetaEventName),
1579
+ (0, import_type_graphql2.Field)(() => MessageStatusCode),
1570
1580
  _ts_metadata("design:type", String)
1571
- ], BaseMetaEvent.prototype, "name", void 0);
1572
- BaseMetaEvent = _ts_decorate([
1573
- (0, import_type_graphql2.InterfaceType)()
1574
- ], BaseMetaEvent);
1575
- var LangGraphInterruptEvent = class {
1576
- name = "LangGraphInterruptEvent";
1577
- value;
1578
- response;
1581
+ ], BaseMessageStatus.prototype, "code", void 0);
1582
+ BaseMessageStatus = _ts_decorate([
1583
+ (0, import_type_graphql2.ObjectType)()
1584
+ ], BaseMessageStatus);
1585
+ var PendingMessageStatus = class extends BaseMessageStatus {
1586
+ code = "pending";
1579
1587
  };
1580
- __name(LangGraphInterruptEvent, "LangGraphInterruptEvent");
1581
- _ts_decorate([
1582
- (0, import_type_graphql2.Field)(() => MetaEventName),
1583
- _ts_metadata("design:type", typeof MetaEventName === "undefined" || false ? Object : "LangGraphInterruptEvent")
1584
- ], LangGraphInterruptEvent.prototype, "name", void 0);
1588
+ __name(PendingMessageStatus, "PendingMessageStatus");
1589
+ PendingMessageStatus = _ts_decorate([
1590
+ (0, import_type_graphql2.ObjectType)()
1591
+ ], PendingMessageStatus);
1592
+ var SuccessMessageStatus = class extends BaseMessageStatus {
1593
+ code = "success";
1594
+ };
1595
+ __name(SuccessMessageStatus, "SuccessMessageStatus");
1596
+ SuccessMessageStatus = _ts_decorate([
1597
+ (0, import_type_graphql2.ObjectType)()
1598
+ ], SuccessMessageStatus);
1599
+ var FailedMessageStatus = class extends BaseMessageStatus {
1600
+ code = "failed";
1601
+ reason;
1602
+ };
1603
+ __name(FailedMessageStatus, "FailedMessageStatus");
1585
1604
  _ts_decorate([
1586
1605
  (0, import_type_graphql2.Field)(() => String),
1587
1606
  _ts_metadata("design:type", String)
1588
- ], LangGraphInterruptEvent.prototype, "value", void 0);
1589
- _ts_decorate([
1590
- (0, import_type_graphql2.Field)(() => String, {
1607
+ ], FailedMessageStatus.prototype, "reason", void 0);
1608
+ FailedMessageStatus = _ts_decorate([
1609
+ (0, import_type_graphql2.ObjectType)()
1610
+ ], FailedMessageStatus);
1611
+ var MessageStatusUnion = (0, import_type_graphql2.createUnionType)({
1612
+ name: "MessageStatus",
1613
+ types: () => [
1614
+ PendingMessageStatus,
1615
+ SuccessMessageStatus,
1616
+ FailedMessageStatus
1617
+ ]
1618
+ });
1619
+
1620
+ // src/graphql/types/response-status.type.ts
1621
+ var import_graphql_scalars = require("graphql-scalars");
1622
+ var import_type_graphql3 = require("type-graphql");
1623
+ function _ts_decorate2(decorators, target, key, desc) {
1624
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1625
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1626
+ r = Reflect.decorate(decorators, target, key, desc);
1627
+ else
1628
+ for (var i = decorators.length - 1; i >= 0; i--)
1629
+ if (d = decorators[i])
1630
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1631
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1632
+ }
1633
+ __name(_ts_decorate2, "_ts_decorate");
1634
+ function _ts_metadata2(k, v) {
1635
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1636
+ return Reflect.metadata(k, v);
1637
+ }
1638
+ __name(_ts_metadata2, "_ts_metadata");
1639
+ var ResponseStatusCode;
1640
+ (function(ResponseStatusCode2) {
1641
+ ResponseStatusCode2["Pending"] = "pending";
1642
+ ResponseStatusCode2["Success"] = "success";
1643
+ ResponseStatusCode2["Failed"] = "failed";
1644
+ })(ResponseStatusCode || (ResponseStatusCode = {}));
1645
+ (0, import_type_graphql3.registerEnumType)(ResponseStatusCode, {
1646
+ name: "ResponseStatusCode"
1647
+ });
1648
+ var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
1649
+ code;
1650
+ }, "BaseResponseStatus");
1651
+ _ts_decorate2([
1652
+ (0, import_type_graphql3.Field)(() => ResponseStatusCode),
1653
+ _ts_metadata2("design:type", String)
1654
+ ], BaseResponseStatus.prototype, "code", void 0);
1655
+ BaseResponseStatus = _ts_decorate2([
1656
+ (0, import_type_graphql3.InterfaceType)({
1657
+ resolveType(value) {
1658
+ if (value.code === "success") {
1659
+ return SuccessResponseStatus;
1660
+ } else if (value.code === "failed") {
1661
+ return FailedResponseStatus;
1662
+ } else if (value.code === "pending") {
1663
+ return PendingResponseStatus;
1664
+ }
1665
+ return void 0;
1666
+ }
1667
+ }),
1668
+ (0, import_type_graphql3.ObjectType)()
1669
+ ], BaseResponseStatus);
1670
+ var PendingResponseStatus = class extends BaseResponseStatus {
1671
+ code = "pending";
1672
+ };
1673
+ __name(PendingResponseStatus, "PendingResponseStatus");
1674
+ PendingResponseStatus = _ts_decorate2([
1675
+ (0, import_type_graphql3.ObjectType)({
1676
+ implements: BaseResponseStatus
1677
+ })
1678
+ ], PendingResponseStatus);
1679
+ var SuccessResponseStatus = class extends BaseResponseStatus {
1680
+ code = "success";
1681
+ };
1682
+ __name(SuccessResponseStatus, "SuccessResponseStatus");
1683
+ SuccessResponseStatus = _ts_decorate2([
1684
+ (0, import_type_graphql3.ObjectType)({
1685
+ implements: BaseResponseStatus
1686
+ })
1687
+ ], SuccessResponseStatus);
1688
+ var FailedResponseStatusReason;
1689
+ (function(FailedResponseStatusReason2) {
1690
+ FailedResponseStatusReason2["GUARDRAILS_VALIDATION_FAILED"] = "GUARDRAILS_VALIDATION_FAILED";
1691
+ FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
1692
+ FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
1693
+ })(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
1694
+ (0, import_type_graphql3.registerEnumType)(FailedResponseStatusReason, {
1695
+ name: "FailedResponseStatusReason"
1696
+ });
1697
+ var FailedResponseStatus = class extends BaseResponseStatus {
1698
+ code = "failed";
1699
+ reason;
1700
+ details = null;
1701
+ };
1702
+ __name(FailedResponseStatus, "FailedResponseStatus");
1703
+ _ts_decorate2([
1704
+ (0, import_type_graphql3.Field)(() => FailedResponseStatusReason),
1705
+ _ts_metadata2("design:type", String)
1706
+ ], FailedResponseStatus.prototype, "reason", void 0);
1707
+ _ts_decorate2([
1708
+ (0, import_type_graphql3.Field)(() => import_graphql_scalars.GraphQLJSON, {
1591
1709
  nullable: true
1592
1710
  }),
1593
- _ts_metadata("design:type", String)
1594
- ], LangGraphInterruptEvent.prototype, "response", void 0);
1595
- LangGraphInterruptEvent = _ts_decorate([
1596
- (0, import_type_graphql2.ObjectType)({
1597
- implements: BaseMetaEvent
1711
+ _ts_metadata2("design:type", typeof Record === "undefined" ? Object : Record)
1712
+ ], FailedResponseStatus.prototype, "details", void 0);
1713
+ FailedResponseStatus = _ts_decorate2([
1714
+ (0, import_type_graphql3.ObjectType)({
1715
+ implements: BaseResponseStatus
1598
1716
  })
1599
- ], LangGraphInterruptEvent);
1717
+ ], FailedResponseStatus);
1718
+ var ResponseStatusUnion = (0, import_type_graphql3.createUnionType)({
1719
+ name: "ResponseStatus",
1720
+ types: () => [
1721
+ PendingResponseStatus,
1722
+ SuccessResponseStatus,
1723
+ FailedResponseStatus
1724
+ ]
1725
+ });
1600
1726
 
1601
- // src/lib/runtime/remote-lg-action.ts
1602
- async function execute(args) {
1603
- return new ReadableStream({
1604
- async start(controller) {
1605
- try {
1606
- await streamEvents(controller, args);
1607
- controller.close();
1608
- } catch (err) {
1609
- }
1610
- }
1611
- });
1727
+ // src/graphql/types/extensions-response.type.ts
1728
+ var import_type_graphql4 = require("type-graphql");
1729
+ function _ts_decorate3(decorators, target, key, desc) {
1730
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1731
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1732
+ r = Reflect.decorate(decorators, target, key, desc);
1733
+ else
1734
+ for (var i = decorators.length - 1; i >= 0; i--)
1735
+ if (d = decorators[i])
1736
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1737
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1612
1738
  }
1613
- __name(execute, "execute");
1614
- async function streamEvents(controller, args) {
1615
- var _a, _b, _c, _d, _e, _f, _g, _h;
1616
- const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2, properties, metaEvents } = args;
1617
- let nodeName = initialNodeName;
1618
- let state = initialState;
1619
- const { name, assistantId: initialAssistantId } = agent;
1620
- const propertyHeaders = properties.authorization ? {
1621
- authorization: `Bearer ${properties.authorization}`
1622
- } : null;
1623
- const client = new import_langgraph_sdk.Client({
1624
- apiUrl: deploymentUrl,
1625
- apiKey: langsmithApiKey,
1626
- defaultHeaders: {
1627
- ...propertyHeaders
1628
- }
1629
- });
1630
- let threadId = argsInitialThreadId ?? (0, import_shared8.randomUUID)();
1631
- if (argsInitialThreadId && argsInitialThreadId.startsWith("ck-")) {
1632
- threadId = argsInitialThreadId.substring(3);
1633
- }
1634
- if (!(0, import_shared8.isValidUUID)(threadId)) {
1635
- console.warn(`Cannot use the threadId ${threadId} with LangGraph Platform. Must be a valid UUID.`);
1636
- }
1637
- let wasInitiatedWithExistingThread = true;
1638
- try {
1639
- await client.threads.get(threadId);
1640
- } catch (error) {
1641
- wasInitiatedWithExistingThread = false;
1642
- await client.threads.create({
1643
- threadId
1644
- });
1645
- }
1646
- let agentState = {
1647
- values: {}
1648
- };
1649
- if (wasInitiatedWithExistingThread) {
1650
- agentState = await client.threads.getState(threadId);
1651
- }
1652
- const agentStateValues = agentState.values;
1653
- state.messages = agentStateValues.messages;
1654
- const mode = threadId && nodeName != "__end__" && nodeName != void 0 && nodeName != null ? "continue" : "start";
1655
- let formattedMessages = [];
1656
- try {
1657
- formattedMessages = copilotkitMessagesToLangChain(messages);
1658
- } catch (e) {
1659
- logger2.error(e, `Error event thrown: ${e.message}`);
1660
- }
1661
- state = langGraphDefaultMergeState(state, formattedMessages, actions, name);
1662
- const lgInterruptEvent = metaEvents == null ? void 0 : metaEvents.find((ev) => ev.name === MetaEventName.LangGraphInterruptEvent);
1663
- if (mode === "continue" && !lgInterruptEvent) {
1664
- await client.threads.updateState(threadId, {
1665
- values: state,
1666
- asNode: nodeName
1667
- });
1668
- }
1669
- let streamInfo = {
1670
- hashedLgcKey: (0, import_node_crypto.createHash)("sha256").update(langsmithApiKey).digest("hex")
1671
- };
1672
- const assistants = await client.assistants.search();
1673
- const retrievedAssistant = assistants.find((a) => a.name === name || a.assistant_id === initialAssistantId);
1674
- if (!retrievedAssistant) {
1675
- telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
1676
- ...streamInfo,
1677
- error: `Found no assistants for given information, while ${assistants.length} assistants exists`
1678
- });
1679
- console.error(`
1680
- No agent found for the agent name specified in CopilotKit provider
1681
- Please check your available agents or provide an agent ID in the LangGraph Platform endpoint definition.
1682
-
1683
-
1684
- These are the available agents: [${assistants.map((a) => `${a.name} (ID: ${a.assistant_id})`).join(", ")}]
1685
- `);
1686
- throw new Error("No agent id found");
1739
+ __name(_ts_decorate3, "_ts_decorate");
1740
+ function _ts_metadata3(k, v) {
1741
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1742
+ return Reflect.metadata(k, v);
1743
+ }
1744
+ __name(_ts_metadata3, "_ts_metadata");
1745
+ var ExtensionsResponse = class {
1746
+ openaiAssistantAPI;
1747
+ };
1748
+ __name(ExtensionsResponse, "ExtensionsResponse");
1749
+ _ts_decorate3([
1750
+ (0, import_type_graphql4.Field)(() => OpenAIApiAssistantAPIResponse, {
1751
+ nullable: true
1752
+ }),
1753
+ _ts_metadata3("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
1754
+ ], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
1755
+ ExtensionsResponse = _ts_decorate3([
1756
+ (0, import_type_graphql4.ObjectType)()
1757
+ ], ExtensionsResponse);
1758
+ var OpenAIApiAssistantAPIResponse = class {
1759
+ runId;
1760
+ threadId;
1761
+ };
1762
+ __name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
1763
+ _ts_decorate3([
1764
+ (0, import_type_graphql4.Field)(() => String, {
1765
+ nullable: true
1766
+ }),
1767
+ _ts_metadata3("design:type", String)
1768
+ ], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
1769
+ _ts_decorate3([
1770
+ (0, import_type_graphql4.Field)(() => String, {
1771
+ nullable: true
1772
+ }),
1773
+ _ts_metadata3("design:type", String)
1774
+ ], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
1775
+ OpenAIApiAssistantAPIResponse = _ts_decorate3([
1776
+ (0, import_type_graphql4.ObjectType)()
1777
+ ], OpenAIApiAssistantAPIResponse);
1778
+
1779
+ // src/graphql/types/copilot-response.type.ts
1780
+ function _ts_decorate4(decorators, target, key, desc) {
1781
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1782
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1783
+ r = Reflect.decorate(decorators, target, key, desc);
1784
+ else
1785
+ for (var i = decorators.length - 1; i >= 0; i--)
1786
+ if (d = decorators[i])
1787
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1788
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1789
+ }
1790
+ __name(_ts_decorate4, "_ts_decorate");
1791
+ function _ts_metadata4(k, v) {
1792
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
1793
+ return Reflect.metadata(k, v);
1794
+ }
1795
+ __name(_ts_metadata4, "_ts_metadata");
1796
+ var BaseMessageOutput = class {
1797
+ id;
1798
+ createdAt;
1799
+ status;
1800
+ };
1801
+ __name(BaseMessageOutput, "BaseMessageOutput");
1802
+ _ts_decorate4([
1803
+ (0, import_type_graphql5.Field)(() => String),
1804
+ _ts_metadata4("design:type", String)
1805
+ ], BaseMessageOutput.prototype, "id", void 0);
1806
+ _ts_decorate4([
1807
+ (0, import_type_graphql5.Field)(() => Date),
1808
+ _ts_metadata4("design:type", typeof Date === "undefined" ? Object : Date)
1809
+ ], BaseMessageOutput.prototype, "createdAt", void 0);
1810
+ _ts_decorate4([
1811
+ (0, import_type_graphql5.Field)(() => MessageStatusUnion),
1812
+ _ts_metadata4("design:type", Object)
1813
+ ], BaseMessageOutput.prototype, "status", void 0);
1814
+ BaseMessageOutput = _ts_decorate4([
1815
+ (0, import_type_graphql5.InterfaceType)({
1816
+ resolveType(value) {
1817
+ if (value.hasOwnProperty("content")) {
1818
+ return TextMessageOutput;
1819
+ } else if (value.hasOwnProperty("name")) {
1820
+ return ActionExecutionMessageOutput;
1821
+ } else if (value.hasOwnProperty("result")) {
1822
+ return ResultMessageOutput;
1823
+ } else if (value.hasOwnProperty("state")) {
1824
+ return AgentStateMessageOutput;
1825
+ }
1826
+ return void 0;
1827
+ }
1828
+ })
1829
+ ], BaseMessageOutput);
1830
+ var TextMessageOutput = class {
1831
+ role;
1832
+ content;
1833
+ parentMessageId;
1834
+ };
1835
+ __name(TextMessageOutput, "TextMessageOutput");
1836
+ _ts_decorate4([
1837
+ (0, import_type_graphql5.Field)(() => MessageRole),
1838
+ _ts_metadata4("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1839
+ ], TextMessageOutput.prototype, "role", void 0);
1840
+ _ts_decorate4([
1841
+ (0, import_type_graphql5.Field)(() => [
1842
+ String
1843
+ ]),
1844
+ _ts_metadata4("design:type", Array)
1845
+ ], TextMessageOutput.prototype, "content", void 0);
1846
+ _ts_decorate4([
1847
+ (0, import_type_graphql5.Field)(() => String, {
1848
+ nullable: true
1849
+ }),
1850
+ _ts_metadata4("design:type", String)
1851
+ ], TextMessageOutput.prototype, "parentMessageId", void 0);
1852
+ TextMessageOutput = _ts_decorate4([
1853
+ (0, import_type_graphql5.ObjectType)({
1854
+ implements: BaseMessageOutput
1855
+ })
1856
+ ], TextMessageOutput);
1857
+ var ActionExecutionMessageOutput = class {
1858
+ name;
1859
+ scope;
1860
+ arguments;
1861
+ parentMessageId;
1862
+ };
1863
+ __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
1864
+ _ts_decorate4([
1865
+ (0, import_type_graphql5.Field)(() => String),
1866
+ _ts_metadata4("design:type", String)
1867
+ ], ActionExecutionMessageOutput.prototype, "name", void 0);
1868
+ _ts_decorate4([
1869
+ (0, import_type_graphql5.Field)(() => String, {
1870
+ nullable: true,
1871
+ deprecationReason: "This field will be removed in a future version"
1872
+ }),
1873
+ _ts_metadata4("design:type", String)
1874
+ ], ActionExecutionMessageOutput.prototype, "scope", void 0);
1875
+ _ts_decorate4([
1876
+ (0, import_type_graphql5.Field)(() => [
1877
+ String
1878
+ ]),
1879
+ _ts_metadata4("design:type", Array)
1880
+ ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
1881
+ _ts_decorate4([
1882
+ (0, import_type_graphql5.Field)(() => String, {
1883
+ nullable: true
1884
+ }),
1885
+ _ts_metadata4("design:type", String)
1886
+ ], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
1887
+ ActionExecutionMessageOutput = _ts_decorate4([
1888
+ (0, import_type_graphql5.ObjectType)({
1889
+ implements: BaseMessageOutput
1890
+ })
1891
+ ], ActionExecutionMessageOutput);
1892
+ var ResultMessageOutput = class {
1893
+ actionExecutionId;
1894
+ actionName;
1895
+ result;
1896
+ };
1897
+ __name(ResultMessageOutput, "ResultMessageOutput");
1898
+ _ts_decorate4([
1899
+ (0, import_type_graphql5.Field)(() => String),
1900
+ _ts_metadata4("design:type", String)
1901
+ ], ResultMessageOutput.prototype, "actionExecutionId", void 0);
1902
+ _ts_decorate4([
1903
+ (0, import_type_graphql5.Field)(() => String),
1904
+ _ts_metadata4("design:type", String)
1905
+ ], ResultMessageOutput.prototype, "actionName", void 0);
1906
+ _ts_decorate4([
1907
+ (0, import_type_graphql5.Field)(() => String),
1908
+ _ts_metadata4("design:type", String)
1909
+ ], ResultMessageOutput.prototype, "result", void 0);
1910
+ ResultMessageOutput = _ts_decorate4([
1911
+ (0, import_type_graphql5.ObjectType)({
1912
+ implements: BaseMessageOutput
1913
+ })
1914
+ ], ResultMessageOutput);
1915
+ var AgentStateMessageOutput = class {
1916
+ threadId;
1917
+ agentName;
1918
+ nodeName;
1919
+ runId;
1920
+ active;
1921
+ role;
1922
+ state;
1923
+ running;
1924
+ };
1925
+ __name(AgentStateMessageOutput, "AgentStateMessageOutput");
1926
+ _ts_decorate4([
1927
+ (0, import_type_graphql5.Field)(() => String),
1928
+ _ts_metadata4("design:type", String)
1929
+ ], AgentStateMessageOutput.prototype, "threadId", void 0);
1930
+ _ts_decorate4([
1931
+ (0, import_type_graphql5.Field)(() => String),
1932
+ _ts_metadata4("design:type", String)
1933
+ ], AgentStateMessageOutput.prototype, "agentName", void 0);
1934
+ _ts_decorate4([
1935
+ (0, import_type_graphql5.Field)(() => String),
1936
+ _ts_metadata4("design:type", String)
1937
+ ], AgentStateMessageOutput.prototype, "nodeName", void 0);
1938
+ _ts_decorate4([
1939
+ (0, import_type_graphql5.Field)(() => String),
1940
+ _ts_metadata4("design:type", String)
1941
+ ], AgentStateMessageOutput.prototype, "runId", void 0);
1942
+ _ts_decorate4([
1943
+ (0, import_type_graphql5.Field)(() => Boolean),
1944
+ _ts_metadata4("design:type", Boolean)
1945
+ ], AgentStateMessageOutput.prototype, "active", void 0);
1946
+ _ts_decorate4([
1947
+ (0, import_type_graphql5.Field)(() => MessageRole),
1948
+ _ts_metadata4("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
1949
+ ], AgentStateMessageOutput.prototype, "role", void 0);
1950
+ _ts_decorate4([
1951
+ (0, import_type_graphql5.Field)(() => String),
1952
+ _ts_metadata4("design:type", String)
1953
+ ], AgentStateMessageOutput.prototype, "state", void 0);
1954
+ _ts_decorate4([
1955
+ (0, import_type_graphql5.Field)(() => Boolean),
1956
+ _ts_metadata4("design:type", Boolean)
1957
+ ], AgentStateMessageOutput.prototype, "running", void 0);
1958
+ AgentStateMessageOutput = _ts_decorate4([
1959
+ (0, import_type_graphql5.ObjectType)({
1960
+ implements: BaseMessageOutput
1961
+ })
1962
+ ], AgentStateMessageOutput);
1963
+ var CopilotResponse = class {
1964
+ threadId;
1965
+ status;
1966
+ runId;
1967
+ messages;
1968
+ extensions;
1969
+ metaEvents;
1970
+ };
1971
+ __name(CopilotResponse, "CopilotResponse");
1972
+ _ts_decorate4([
1973
+ (0, import_type_graphql5.Field)(() => String),
1974
+ _ts_metadata4("design:type", String)
1975
+ ], CopilotResponse.prototype, "threadId", void 0);
1976
+ _ts_decorate4([
1977
+ (0, import_type_graphql5.Field)(() => ResponseStatusUnion),
1978
+ _ts_metadata4("design:type", Object)
1979
+ ], CopilotResponse.prototype, "status", void 0);
1980
+ _ts_decorate4([
1981
+ (0, import_type_graphql5.Field)({
1982
+ nullable: true
1983
+ }),
1984
+ _ts_metadata4("design:type", String)
1985
+ ], CopilotResponse.prototype, "runId", void 0);
1986
+ _ts_decorate4([
1987
+ (0, import_type_graphql5.Field)(() => [
1988
+ BaseMessageOutput
1989
+ ]),
1990
+ _ts_metadata4("design:type", Array)
1991
+ ], CopilotResponse.prototype, "messages", void 0);
1992
+ _ts_decorate4([
1993
+ (0, import_type_graphql5.Field)(() => ExtensionsResponse, {
1994
+ nullable: true
1995
+ }),
1996
+ _ts_metadata4("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
1997
+ ], CopilotResponse.prototype, "extensions", void 0);
1998
+ _ts_decorate4([
1999
+ (0, import_type_graphql5.Field)(() => [
2000
+ BaseMetaEvent
2001
+ ], {
2002
+ nullable: true
2003
+ }),
2004
+ _ts_metadata4("design:type", Array)
2005
+ ], CopilotResponse.prototype, "metaEvents", void 0);
2006
+ CopilotResponse = _ts_decorate4([
2007
+ (0, import_type_graphql5.ObjectType)()
2008
+ ], CopilotResponse);
2009
+
2010
+ // src/graphql/types/meta-events.type.ts
2011
+ function _ts_decorate5(decorators, target, key, desc) {
2012
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2013
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2014
+ r = Reflect.decorate(decorators, target, key, desc);
2015
+ else
2016
+ for (var i = decorators.length - 1; i >= 0; i--)
2017
+ if (d = decorators[i])
2018
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2019
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2020
+ }
2021
+ __name(_ts_decorate5, "_ts_decorate");
2022
+ function _ts_metadata5(k, v) {
2023
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2024
+ return Reflect.metadata(k, v);
2025
+ }
2026
+ __name(_ts_metadata5, "_ts_metadata");
2027
+ var MetaEventName;
2028
+ (function(MetaEventName2) {
2029
+ MetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
2030
+ MetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
2031
+ })(MetaEventName || (MetaEventName = {}));
2032
+ (0, import_type_graphql6.registerEnumType)(MetaEventName, {
2033
+ name: "MetaEventName",
2034
+ description: "Meta event types"
2035
+ });
2036
+ var BaseMetaEvent = class {
2037
+ type = "MetaEvent";
2038
+ name;
2039
+ };
2040
+ __name(BaseMetaEvent, "BaseMetaEvent");
2041
+ _ts_decorate5([
2042
+ (0, import_type_graphql6.Field)(() => String),
2043
+ _ts_metadata5("design:type", String)
2044
+ ], BaseMetaEvent.prototype, "type", void 0);
2045
+ _ts_decorate5([
2046
+ (0, import_type_graphql6.Field)(() => MetaEventName),
2047
+ _ts_metadata5("design:type", String)
2048
+ ], BaseMetaEvent.prototype, "name", void 0);
2049
+ BaseMetaEvent = _ts_decorate5([
2050
+ (0, import_type_graphql6.InterfaceType)({
2051
+ resolveType(value) {
2052
+ if (value.name === "LangGraphInterruptEvent") {
2053
+ return LangGraphInterruptEvent;
2054
+ } else if (value.name === "CopilotKitLangGraphInterruptEvent") {
2055
+ return CopilotKitLangGraphInterruptEvent;
2056
+ }
2057
+ return void 0;
2058
+ }
2059
+ }),
2060
+ (0, import_type_graphql6.InterfaceType)()
2061
+ ], BaseMetaEvent);
2062
+ var CopilotKitLangGraphInterruptEventData = class {
2063
+ value;
2064
+ messages;
2065
+ };
2066
+ __name(CopilotKitLangGraphInterruptEventData, "CopilotKitLangGraphInterruptEventData");
2067
+ _ts_decorate5([
2068
+ (0, import_type_graphql6.Field)(() => String),
2069
+ _ts_metadata5("design:type", String)
2070
+ ], CopilotKitLangGraphInterruptEventData.prototype, "value", void 0);
2071
+ _ts_decorate5([
2072
+ (0, import_type_graphql6.Field)(() => [
2073
+ BaseMessageOutput
2074
+ ]),
2075
+ _ts_metadata5("design:type", Array)
2076
+ ], CopilotKitLangGraphInterruptEventData.prototype, "messages", void 0);
2077
+ CopilotKitLangGraphInterruptEventData = _ts_decorate5([
2078
+ (0, import_type_graphql6.ObjectType)()
2079
+ ], CopilotKitLangGraphInterruptEventData);
2080
+ var LangGraphInterruptEvent = class {
2081
+ name = "LangGraphInterruptEvent";
2082
+ value;
2083
+ response;
2084
+ };
2085
+ __name(LangGraphInterruptEvent, "LangGraphInterruptEvent");
2086
+ _ts_decorate5([
2087
+ (0, import_type_graphql6.Field)(() => MetaEventName),
2088
+ _ts_metadata5("design:type", typeof MetaEventName === "undefined" || false ? Object : "LangGraphInterruptEvent")
2089
+ ], LangGraphInterruptEvent.prototype, "name", void 0);
2090
+ _ts_decorate5([
2091
+ (0, import_type_graphql6.Field)(() => String),
2092
+ _ts_metadata5("design:type", String)
2093
+ ], LangGraphInterruptEvent.prototype, "value", void 0);
2094
+ _ts_decorate5([
2095
+ (0, import_type_graphql6.Field)(() => String, {
2096
+ nullable: true
2097
+ }),
2098
+ _ts_metadata5("design:type", String)
2099
+ ], LangGraphInterruptEvent.prototype, "response", void 0);
2100
+ LangGraphInterruptEvent = _ts_decorate5([
2101
+ (0, import_type_graphql6.ObjectType)({
2102
+ implements: BaseMetaEvent
2103
+ })
2104
+ ], LangGraphInterruptEvent);
2105
+ var CopilotKitLangGraphInterruptEvent = class {
2106
+ name = "CopilotKitLangGraphInterruptEvent";
2107
+ data;
2108
+ response;
2109
+ };
2110
+ __name(CopilotKitLangGraphInterruptEvent, "CopilotKitLangGraphInterruptEvent");
2111
+ _ts_decorate5([
2112
+ (0, import_type_graphql6.Field)(() => MetaEventName),
2113
+ _ts_metadata5("design:type", typeof MetaEventName === "undefined" || false ? Object : "CopilotKitLangGraphInterruptEvent")
2114
+ ], CopilotKitLangGraphInterruptEvent.prototype, "name", void 0);
2115
+ _ts_decorate5([
2116
+ (0, import_type_graphql6.Field)(() => CopilotKitLangGraphInterruptEventData),
2117
+ _ts_metadata5("design:type", typeof CopilotKitLangGraphInterruptEventData === "undefined" ? Object : CopilotKitLangGraphInterruptEventData)
2118
+ ], CopilotKitLangGraphInterruptEvent.prototype, "data", void 0);
2119
+ _ts_decorate5([
2120
+ (0, import_type_graphql6.Field)(() => String, {
2121
+ nullable: true
2122
+ }),
2123
+ _ts_metadata5("design:type", String)
2124
+ ], CopilotKitLangGraphInterruptEvent.prototype, "response", void 0);
2125
+ CopilotKitLangGraphInterruptEvent = _ts_decorate5([
2126
+ (0, import_type_graphql6.ObjectType)({
2127
+ implements: BaseMetaEvent
2128
+ })
2129
+ ], CopilotKitLangGraphInterruptEvent);
2130
+
2131
+ // src/lib/runtime/remote-lg-action.ts
2132
+ var activeInterruptEvent = false;
2133
+ async function execute(args) {
2134
+ return new ReadableStream({
2135
+ async start(controller) {
2136
+ try {
2137
+ await streamEvents(controller, args);
2138
+ controller.close();
2139
+ } catch (err) {
2140
+ }
2141
+ }
2142
+ });
2143
+ }
2144
+ __name(execute, "execute");
2145
+ async function streamEvents(controller, args) {
2146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2147
+ const { deploymentUrl, langsmithApiKey, threadId: argsInitialThreadId, agent, nodeName: initialNodeName, state: initialState, messages, actions, logger: logger2, properties, metaEvents } = args;
2148
+ let nodeName = initialNodeName;
2149
+ let state = initialState;
2150
+ const { name, assistantId: initialAssistantId } = agent;
2151
+ const propertyHeaders = properties.authorization ? {
2152
+ authorization: `Bearer ${properties.authorization}`
2153
+ } : null;
2154
+ const client = new import_langgraph_sdk.Client({
2155
+ apiUrl: deploymentUrl,
2156
+ apiKey: langsmithApiKey,
2157
+ defaultHeaders: {
2158
+ ...propertyHeaders
2159
+ }
2160
+ });
2161
+ let threadId = argsInitialThreadId ?? (0, import_shared8.randomUUID)();
2162
+ if (argsInitialThreadId && argsInitialThreadId.startsWith("ck-")) {
2163
+ threadId = argsInitialThreadId.substring(3);
1687
2164
  }
1688
- const assistantId = retrievedAssistant.assistant_id;
1689
- const graphInfo = await client.assistants.getGraph(assistantId);
2165
+ if (!(0, import_shared8.isValidUUID)(threadId)) {
2166
+ console.warn(`Cannot use the threadId ${threadId} with LangGraph Platform. Must be a valid UUID.`);
2167
+ }
2168
+ let wasInitiatedWithExistingThread = true;
2169
+ try {
2170
+ await client.threads.get(threadId);
2171
+ } catch (error) {
2172
+ wasInitiatedWithExistingThread = false;
2173
+ await client.threads.create({
2174
+ threadId
2175
+ });
2176
+ }
2177
+ let agentState = {
2178
+ values: {}
2179
+ };
2180
+ if (wasInitiatedWithExistingThread) {
2181
+ agentState = await client.threads.getState(threadId);
2182
+ }
2183
+ const agentStateValues = agentState.values;
2184
+ state.messages = agentStateValues.messages;
2185
+ const mode = threadId && nodeName != "__end__" && nodeName != void 0 && nodeName != null ? "continue" : "start";
2186
+ let formattedMessages = [];
2187
+ try {
2188
+ formattedMessages = copilotkitMessagesToLangChain(messages);
2189
+ } catch (e) {
2190
+ logger2.error(e, `Error event thrown: ${e.message}`);
2191
+ }
2192
+ state = langGraphDefaultMergeState(state, formattedMessages, actions, name);
1690
2193
  const streamInput = mode === "start" ? state : null;
1691
- let streamingStateExtractor = new StreamingStateExtractor([]);
1692
- let prevNodeName = null;
1693
- let emitIntermediateStateUntilEnd = null;
1694
- let shouldExit = false;
1695
- let externalRunId = null;
1696
2194
  const payload = {
1697
2195
  input: streamInput,
1698
2196
  streamMode: [
@@ -1702,16 +2200,55 @@ async function streamEvents(controller, args) {
1702
2200
  ],
1703
2201
  command: void 0
1704
2202
  };
1705
- if (lgInterruptEvent == null ? void 0 : lgInterruptEvent.response) {
2203
+ const lgInterruptMetaEvent = metaEvents == null ? void 0 : metaEvents.find((ev) => ev.name === MetaEventName.LangGraphInterruptEvent);
2204
+ if (activeInterruptEvent && !lgInterruptMetaEvent) {
2205
+ payload.command = {
2206
+ resume: formattedMessages[formattedMessages.length - 1]
2207
+ };
2208
+ }
2209
+ if (lgInterruptMetaEvent == null ? void 0 : lgInterruptMetaEvent.response) {
1706
2210
  payload.command = {
1707
- resume: lgInterruptEvent.response
2211
+ resume: lgInterruptMetaEvent.response
1708
2212
  };
1709
2213
  }
2214
+ if (mode === "continue" && !activeInterruptEvent) {
2215
+ await client.threads.updateState(threadId, {
2216
+ values: state,
2217
+ asNode: nodeName
2218
+ });
2219
+ }
2220
+ let streamInfo = {
2221
+ hashedLgcKey: (0, import_node_crypto.createHash)("sha256").update(langsmithApiKey).digest("hex")
2222
+ };
2223
+ const assistants = await client.assistants.search();
2224
+ const retrievedAssistant = assistants.find((a) => a.name === name || a.assistant_id === initialAssistantId);
2225
+ if (!retrievedAssistant) {
2226
+ telemetry_client_default.capture("oss.runtime.agent_execution_stream_errored", {
2227
+ ...streamInfo,
2228
+ error: `Found no assistants for given information, while ${assistants.length} assistants exists`
2229
+ });
2230
+ console.error(`
2231
+ No agent found for the agent name specified in CopilotKit provider
2232
+ Please check your available agents or provide an agent ID in the LangGraph Platform endpoint definition.
2233
+
2234
+
2235
+ These are the available agents: [${assistants.map((a) => `${a.name} (ID: ${a.assistant_id})`).join(", ")}]
2236
+ `);
2237
+ throw new Error("No agent id found");
2238
+ }
2239
+ const assistantId = retrievedAssistant.assistant_id;
2240
+ const graphInfo = await client.assistants.getGraph(assistantId);
2241
+ let streamingStateExtractor = new StreamingStateExtractor([]);
2242
+ let prevNodeName = null;
2243
+ let emitIntermediateStateUntilEnd = null;
2244
+ let shouldExit = false;
2245
+ let externalRunId = null;
1710
2246
  const streamResponse2 = client.runs.stream(threadId, assistantId, payload);
1711
2247
  const emit = /* @__PURE__ */ __name((message) => controller.enqueue(new TextEncoder().encode(message)), "emit");
1712
2248
  let latestStateValues = {};
1713
2249
  let updatedState = state;
1714
2250
  let manuallyEmittedState = null;
2251
+ activeInterruptEvent = false;
1715
2252
  try {
1716
2253
  telemetry_client_default.capture("oss.runtime.agent_execution_stream_started", {
1717
2254
  hashedLgcKey: streamInfo.hashedLgcKey
@@ -1727,11 +2264,24 @@ async function streamEvents(controller, args) {
1727
2264
  if (chunk.event === "error") {
1728
2265
  throw new Error(`Error event thrown: ${chunk.data.message}`);
1729
2266
  }
1730
- if (chunk.event === "updates" && chunk.data.__interrupt__) {
1731
- emit(JSON.stringify({
1732
- event: LangGraphEventTypes.OnInterrupt,
1733
- value: chunk.data.__interrupt__[0].value
1734
- }) + "\n");
2267
+ const interruptEvents = (_a = chunk.data) == null ? void 0 : _a.__interrupt__;
2268
+ if (interruptEvents == null ? void 0 : interruptEvents.length) {
2269
+ activeInterruptEvent = true;
2270
+ const interruptValue = interruptEvents == null ? void 0 : interruptEvents[0].value;
2271
+ if (typeof interruptValue != "string" && "__copilotkit_interrupt_value__" in interruptValue) {
2272
+ emit(JSON.stringify({
2273
+ event: LangGraphEventTypes.OnCopilotKitInterrupt,
2274
+ data: {
2275
+ value: interruptValue.__copilotkit_interrupt_value__,
2276
+ messages: langchainMessagesToCopilotKit(interruptValue.__copilotkit_messages__)
2277
+ }
2278
+ }) + "\n");
2279
+ } else {
2280
+ emit(JSON.stringify({
2281
+ event: LangGraphEventTypes.OnInterrupt,
2282
+ value: interruptValue
2283
+ }) + "\n");
2284
+ }
1735
2285
  continue;
1736
2286
  }
1737
2287
  if (chunk.event === "updates")
@@ -1746,8 +2296,8 @@ async function streamEvents(controller, args) {
1746
2296
  const runId = event.metadata.run_id;
1747
2297
  externalRunId = runId;
1748
2298
  const metadata = event.metadata;
1749
- if (((_b = (_a = event.data) == null ? void 0 : _a.output) == null ? void 0 : _b.model) != null && ((_d = (_c = event.data) == null ? void 0 : _c.output) == null ? void 0 : _d.model) != "") {
1750
- streamInfo.provider = (_f = (_e = event.data) == null ? void 0 : _e.output) == null ? void 0 : _f.model;
2299
+ if (((_c = (_b = event.data) == null ? void 0 : _b.output) == null ? void 0 : _c.model) != null && ((_e = (_d = event.data) == null ? void 0 : _d.output) == null ? void 0 : _e.model) != "") {
2300
+ streamInfo.provider = (_g = (_f = event.data) == null ? void 0 : _f.output) == null ? void 0 : _g.model;
1751
2301
  }
1752
2302
  if (metadata.langgraph_host != null && metadata.langgraph_host != "") {
1753
2303
  streamInfo.langGraphHost = metadata.langgraph_host;
@@ -1816,7 +2366,7 @@ async function streamEvents(controller, args) {
1816
2366
  emit(JSON.stringify(event) + "\n");
1817
2367
  }
1818
2368
  state = await client.threads.getState(threadId);
1819
- const interrupts = (_h = (_g = state.tasks) == null ? void 0 : _g[0]) == null ? void 0 : _h.interrupts;
2369
+ const interrupts = (_i = (_h = state.tasks) == null ? void 0 : _h[0]) == null ? void 0 : _i.interrupts;
1820
2370
  nodeName = interrupts ? nodeName : Object.keys(state.metadata.writes)[0];
1821
2371
  const isEndNode = state.next.length === 0 && !interrupts;
1822
2372
  telemetry_client_default.capture("oss.runtime.agent_execution_stream_ended", streamInfo);
@@ -2504,8 +3054,8 @@ __name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
2504
3054
  var telemetry_client_default = telemetryClient;
2505
3055
 
2506
3056
  // src/graphql/types/base/index.ts
2507
- var import_type_graphql3 = require("type-graphql");
2508
- function _ts_decorate2(decorators, target, key, desc) {
3057
+ var import_type_graphql7 = require("type-graphql");
3058
+ function _ts_decorate6(decorators, target, key, desc) {
2509
3059
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2510
3060
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2511
3061
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2515,27 +3065,27 @@ function _ts_decorate2(decorators, target, key, desc) {
2515
3065
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2516
3066
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2517
3067
  }
2518
- __name(_ts_decorate2, "_ts_decorate");
2519
- function _ts_metadata2(k, v) {
3068
+ __name(_ts_decorate6, "_ts_decorate");
3069
+ function _ts_metadata6(k, v) {
2520
3070
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
2521
3071
  return Reflect.metadata(k, v);
2522
3072
  }
2523
- __name(_ts_metadata2, "_ts_metadata");
3073
+ __name(_ts_metadata6, "_ts_metadata");
2524
3074
  var BaseMessageInput = class {
2525
3075
  id;
2526
3076
  createdAt;
2527
3077
  };
2528
3078
  __name(BaseMessageInput, "BaseMessageInput");
2529
- _ts_decorate2([
2530
- (0, import_type_graphql3.Field)(() => String),
2531
- _ts_metadata2("design:type", String)
3079
+ _ts_decorate6([
3080
+ (0, import_type_graphql7.Field)(() => String),
3081
+ _ts_metadata6("design:type", String)
2532
3082
  ], BaseMessageInput.prototype, "id", void 0);
2533
- _ts_decorate2([
2534
- (0, import_type_graphql3.Field)(() => Date),
2535
- _ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
3083
+ _ts_decorate6([
3084
+ (0, import_type_graphql7.Field)(() => Date),
3085
+ _ts_metadata6("design:type", typeof Date === "undefined" ? Object : Date)
2536
3086
  ], BaseMessageInput.prototype, "createdAt", void 0);
2537
- BaseMessageInput = _ts_decorate2([
2538
- (0, import_type_graphql3.InputType)()
3087
+ BaseMessageInput = _ts_decorate6([
3088
+ (0, import_type_graphql7.InputType)()
2539
3089
  ], BaseMessageInput);
2540
3090
 
2541
3091
  // src/graphql/types/converted/index.ts
@@ -2670,6 +3220,7 @@ var RuntimeMetaEventName;
2670
3220
  (function(RuntimeMetaEventName2) {
2671
3221
  RuntimeMetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
2672
3222
  RuntimeMetaEventName2["LangGraphInterruptResumeEvent"] = "LangGraphInterruptResumeEvent";
3223
+ RuntimeMetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
2673
3224
  })(RuntimeMetaEventName || (RuntimeMetaEventName = {}));
2674
3225
  var RuntimeEventSubject = class extends import_rxjs2.ReplaySubject {
2675
3226
  constructor() {
@@ -3221,19 +3772,23 @@ please use an LLM adapter instead.`
3221
3772
  const threadId = threadIdFromRequest ?? agentSession.threadId;
3222
3773
  const serverSideActions = await this.getServerSideActions(request);
3223
3774
  const messages = convertGqlInputToMessages(rawMessages);
3224
- const agent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
3225
- if (!agent) {
3775
+ const currentAgent = serverSideActions.find((action) => action.name === agentName && isLangGraphAgentAction(action));
3776
+ if (!currentAgent) {
3226
3777
  throw new import_shared13.CopilotKitAgentDiscoveryError({
3227
3778
  agentName
3228
3779
  });
3229
3780
  }
3230
- const serverSideActionsInput = serverSideActions.filter((action) => !isLangGraphAgentAction(action)).map((action) => ({
3781
+ const availableActionsForCurrentAgent = serverSideActions.filter((action) => (
3782
+ // Case 1: Keep all regular (non-agent) actions
3783
+ !isLangGraphAgentAction(action) || // Case 2: For agent actions, keep all except self (prevent infinite loops)
3784
+ isLangGraphAgentAction(action) && action.name !== agentName
3785
+ )).map((action) => ({
3231
3786
  name: action.name,
3232
3787
  description: action.description,
3233
3788
  jsonSchema: JSON.stringify((0, import_shared13.actionParametersToJsonSchema)(action.parameters))
3234
3789
  }));
3235
- const actionInputsWithoutAgents = flattenToolCallsNoDuplicates([
3236
- ...serverSideActionsInput,
3790
+ const allAvailableActions = flattenToolCallsNoDuplicates([
3791
+ ...availableActionsForCurrentAgent,
3237
3792
  ...request.actions
3238
3793
  ]);
3239
3794
  await ((_a = this.onBeforeRequest) == null ? void 0 : _a.call(this, {
@@ -3244,466 +3799,132 @@ please use an LLM adapter instead.`
3244
3799
  }));
3245
3800
  try {
3246
3801
  const eventSource = new RuntimeEventSource();
3247
- const stream = await agent.langGraphAgentHandler({
3802
+ const stream = await currentAgent.langGraphAgentHandler({
3248
3803
  name: agentName,
3249
3804
  threadId,
3250
3805
  nodeName,
3251
- actionInputsWithoutAgents,
3252
- metaEvents
3806
+ metaEvents,
3807
+ actionInputsWithoutAgents: allAvailableActions
3253
3808
  });
3254
3809
  eventSource.stream(async (eventStream$) => {
3255
3810
  (0, import_rxjs3.from)(stream).subscribe({
3256
3811
  next: (event) => eventStream$.next(event),
3257
- error: (err) => {
3258
- console.error("Error in stream", err);
3259
- eventStream$.error(err);
3260
- eventStream$.complete();
3261
- },
3262
- complete: () => eventStream$.complete()
3263
- });
3264
- });
3265
- outputMessagesPromise.then((outputMessages) => {
3266
- var _a2;
3267
- (_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
3268
- threadId,
3269
- runId: void 0,
3270
- inputMessages: messages,
3271
- outputMessages,
3272
- properties: graphqlContext.properties
3273
- });
3274
- }).catch((_error) => {
3275
- });
3276
- return {
3277
- threadId,
3278
- runId: void 0,
3279
- eventSource,
3280
- serverSideActions: [],
3281
- actionInputsWithoutAgents
3282
- };
3283
- } catch (error) {
3284
- console.error("Error getting response:", error);
3285
- throw error;
3286
- }
3287
- }
3288
- async getServerSideActions(request) {
3289
- const { messages: rawMessages, graphqlContext, agentStates, url } = request;
3290
- const inputMessages = convertGqlInputToMessages(rawMessages);
3291
- const langserveFunctions = [];
3292
- for (const chainPromise of this.langserve) {
3293
- try {
3294
- const chain = await chainPromise;
3295
- langserveFunctions.push(chain);
3296
- } catch (error) {
3297
- console.error("Error loading langserve chain:", error);
3298
- }
3299
- }
3300
- const remoteEndpointDefinitions = this.remoteEndpointDefinitions.map((endpoint) => ({
3301
- ...endpoint,
3302
- type: resolveEndpointType(endpoint)
3303
- }));
3304
- const remoteActions = await setupRemoteActions({
3305
- remoteEndpointDefinitions,
3306
- graphqlContext,
3307
- messages: inputMessages,
3308
- agentStates,
3309
- frontendUrl: url
3310
- });
3311
- const configuredActions = typeof this.actions === "function" ? this.actions({
3312
- properties: graphqlContext.properties,
3313
- url
3314
- }) : this.actions;
3315
- return [
3316
- ...configuredActions,
3317
- ...langserveFunctions,
3318
- ...remoteActions
3319
- ];
3320
- }
3321
- };
3322
- __name(CopilotRuntime, "CopilotRuntime");
3323
- function flattenToolCallsNoDuplicates(toolsByPriority) {
3324
- let allTools = [];
3325
- const allToolNames = [];
3326
- for (const tool of toolsByPriority) {
3327
- if (!allToolNames.includes(tool.name)) {
3328
- allTools.push(tool);
3329
- allToolNames.push(tool.name);
3330
- }
3331
- }
3332
- return allTools;
3333
- }
3334
- __name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
3335
- function copilotKitEndpoint(config2) {
3336
- return {
3337
- ...config2,
3338
- type: EndpointType.CopilotKit
3339
- };
3340
- }
3341
- __name(copilotKitEndpoint, "copilotKitEndpoint");
3342
- function langGraphPlatformEndpoint(config2) {
3343
- return {
3344
- ...config2,
3345
- type: EndpointType.LangGraphPlatform
3346
- };
3347
- }
3348
- __name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
3349
- function resolveEndpointType(endpoint) {
3350
- if (!endpoint.type) {
3351
- if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
3352
- return EndpointType.LangGraphPlatform;
3353
- } else {
3354
- return EndpointType.CopilotKit;
3355
- }
3356
- }
3357
- return endpoint.type;
3358
- }
3359
- __name(resolveEndpointType, "resolveEndpointType");
3360
-
3361
- // src/lib/integrations/shared.ts
3362
- var import_type_graphql26 = require("type-graphql");
3363
-
3364
- // src/graphql/resolvers/copilot.resolver.ts
3365
- var import_type_graphql20 = require("type-graphql");
3366
- var import_rxjs4 = require("rxjs");
3367
-
3368
- // src/graphql/inputs/generate-copilot-response.input.ts
3369
- var import_type_graphql14 = require("type-graphql");
3370
-
3371
- // src/graphql/inputs/message.input.ts
3372
- var import_type_graphql4 = require("type-graphql");
3373
- function _ts_decorate3(decorators, target, key, desc) {
3374
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3375
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3376
- r = Reflect.decorate(decorators, target, key, desc);
3377
- else
3378
- for (var i = decorators.length - 1; i >= 0; i--)
3379
- if (d = decorators[i])
3380
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3381
- return c > 3 && r && Object.defineProperty(target, key, r), r;
3382
- }
3383
- __name(_ts_decorate3, "_ts_decorate");
3384
- function _ts_metadata3(k, v) {
3385
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3386
- return Reflect.metadata(k, v);
3387
- }
3388
- __name(_ts_metadata3, "_ts_metadata");
3389
- var MessageInput = class extends BaseMessageInput {
3390
- textMessage;
3391
- actionExecutionMessage;
3392
- resultMessage;
3393
- agentStateMessage;
3394
- };
3395
- __name(MessageInput, "MessageInput");
3396
- _ts_decorate3([
3397
- (0, import_type_graphql4.Field)(() => TextMessageInput, {
3398
- nullable: true
3399
- }),
3400
- _ts_metadata3("design:type", typeof TextMessageInput === "undefined" ? Object : TextMessageInput)
3401
- ], MessageInput.prototype, "textMessage", void 0);
3402
- _ts_decorate3([
3403
- (0, import_type_graphql4.Field)(() => ActionExecutionMessageInput, {
3404
- nullable: true
3405
- }),
3406
- _ts_metadata3("design:type", typeof ActionExecutionMessageInput === "undefined" ? Object : ActionExecutionMessageInput)
3407
- ], MessageInput.prototype, "actionExecutionMessage", void 0);
3408
- _ts_decorate3([
3409
- (0, import_type_graphql4.Field)(() => ResultMessageInput, {
3410
- nullable: true
3411
- }),
3412
- _ts_metadata3("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
3413
- ], MessageInput.prototype, "resultMessage", void 0);
3414
- _ts_decorate3([
3415
- (0, import_type_graphql4.Field)(() => AgentStateMessageInput, {
3416
- nullable: true
3417
- }),
3418
- _ts_metadata3("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
3419
- ], MessageInput.prototype, "agentStateMessage", void 0);
3420
- MessageInput = _ts_decorate3([
3421
- (0, import_type_graphql4.InputType)()
3422
- ], MessageInput);
3423
- var TextMessageInput = class {
3424
- content;
3425
- parentMessageId;
3426
- role;
3427
- };
3428
- __name(TextMessageInput, "TextMessageInput");
3429
- _ts_decorate3([
3430
- (0, import_type_graphql4.Field)(() => String),
3431
- _ts_metadata3("design:type", String)
3432
- ], TextMessageInput.prototype, "content", void 0);
3433
- _ts_decorate3([
3434
- (0, import_type_graphql4.Field)(() => String, {
3435
- nullable: true
3436
- }),
3437
- _ts_metadata3("design:type", String)
3438
- ], TextMessageInput.prototype, "parentMessageId", void 0);
3439
- _ts_decorate3([
3440
- (0, import_type_graphql4.Field)(() => MessageRole),
3441
- _ts_metadata3("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
3442
- ], TextMessageInput.prototype, "role", void 0);
3443
- TextMessageInput = _ts_decorate3([
3444
- (0, import_type_graphql4.InputType)()
3445
- ], TextMessageInput);
3446
- var ActionExecutionMessageInput = class {
3447
- name;
3448
- arguments;
3449
- parentMessageId;
3450
- scope;
3451
- };
3452
- __name(ActionExecutionMessageInput, "ActionExecutionMessageInput");
3453
- _ts_decorate3([
3454
- (0, import_type_graphql4.Field)(() => String),
3455
- _ts_metadata3("design:type", String)
3456
- ], ActionExecutionMessageInput.prototype, "name", void 0);
3457
- _ts_decorate3([
3458
- (0, import_type_graphql4.Field)(() => String),
3459
- _ts_metadata3("design:type", String)
3460
- ], ActionExecutionMessageInput.prototype, "arguments", void 0);
3461
- _ts_decorate3([
3462
- (0, import_type_graphql4.Field)(() => String, {
3463
- nullable: true
3464
- }),
3465
- _ts_metadata3("design:type", String)
3466
- ], ActionExecutionMessageInput.prototype, "parentMessageId", void 0);
3467
- _ts_decorate3([
3468
- (0, import_type_graphql4.Field)(() => String, {
3469
- nullable: true,
3470
- deprecationReason: "This field will be removed in a future version"
3471
- }),
3472
- _ts_metadata3("design:type", typeof String === "undefined" ? Object : String)
3473
- ], ActionExecutionMessageInput.prototype, "scope", void 0);
3474
- ActionExecutionMessageInput = _ts_decorate3([
3475
- (0, import_type_graphql4.InputType)()
3476
- ], ActionExecutionMessageInput);
3477
- var ResultMessageInput = class {
3478
- actionExecutionId;
3479
- actionName;
3480
- parentMessageId;
3481
- result;
3482
- };
3483
- __name(ResultMessageInput, "ResultMessageInput");
3484
- _ts_decorate3([
3485
- (0, import_type_graphql4.Field)(() => String),
3486
- _ts_metadata3("design:type", String)
3487
- ], ResultMessageInput.prototype, "actionExecutionId", void 0);
3488
- _ts_decorate3([
3489
- (0, import_type_graphql4.Field)(() => String),
3490
- _ts_metadata3("design:type", String)
3491
- ], ResultMessageInput.prototype, "actionName", void 0);
3492
- _ts_decorate3([
3493
- (0, import_type_graphql4.Field)(() => String, {
3494
- nullable: true
3495
- }),
3496
- _ts_metadata3("design:type", String)
3497
- ], ResultMessageInput.prototype, "parentMessageId", void 0);
3498
- _ts_decorate3([
3499
- (0, import_type_graphql4.Field)(() => String),
3500
- _ts_metadata3("design:type", String)
3501
- ], ResultMessageInput.prototype, "result", void 0);
3502
- ResultMessageInput = _ts_decorate3([
3503
- (0, import_type_graphql4.InputType)()
3504
- ], ResultMessageInput);
3505
- var AgentStateMessageInput = class {
3506
- threadId;
3507
- agentName;
3508
- role;
3509
- state;
3510
- running;
3511
- nodeName;
3512
- runId;
3513
- active;
3812
+ error: (err) => {
3813
+ console.error("Error in stream", err);
3814
+ eventStream$.error(err);
3815
+ eventStream$.complete();
3816
+ },
3817
+ complete: () => eventStream$.complete()
3818
+ });
3819
+ });
3820
+ outputMessagesPromise.then((outputMessages) => {
3821
+ var _a2;
3822
+ (_a2 = this.onAfterRequest) == null ? void 0 : _a2.call(this, {
3823
+ threadId,
3824
+ runId: void 0,
3825
+ inputMessages: messages,
3826
+ outputMessages,
3827
+ properties: graphqlContext.properties
3828
+ });
3829
+ }).catch((_error) => {
3830
+ });
3831
+ return {
3832
+ threadId,
3833
+ runId: void 0,
3834
+ eventSource,
3835
+ serverSideActions: [],
3836
+ actionInputsWithoutAgents: allAvailableActions
3837
+ };
3838
+ } catch (error) {
3839
+ console.error("Error getting response:", error);
3840
+ throw error;
3841
+ }
3842
+ }
3843
+ async getServerSideActions(request) {
3844
+ const { messages: rawMessages, graphqlContext, agentStates, url } = request;
3845
+ const inputMessages = convertGqlInputToMessages(rawMessages);
3846
+ const langserveFunctions = [];
3847
+ for (const chainPromise of this.langserve) {
3848
+ try {
3849
+ const chain = await chainPromise;
3850
+ langserveFunctions.push(chain);
3851
+ } catch (error) {
3852
+ console.error("Error loading langserve chain:", error);
3853
+ }
3854
+ }
3855
+ const remoteEndpointDefinitions = this.remoteEndpointDefinitions.map((endpoint) => ({
3856
+ ...endpoint,
3857
+ type: resolveEndpointType(endpoint)
3858
+ }));
3859
+ const remoteActions = await setupRemoteActions({
3860
+ remoteEndpointDefinitions,
3861
+ graphqlContext,
3862
+ messages: inputMessages,
3863
+ agentStates,
3864
+ frontendUrl: url
3865
+ });
3866
+ const configuredActions = typeof this.actions === "function" ? this.actions({
3867
+ properties: graphqlContext.properties,
3868
+ url
3869
+ }) : this.actions;
3870
+ return [
3871
+ ...configuredActions,
3872
+ ...langserveFunctions,
3873
+ ...remoteActions
3874
+ ];
3875
+ }
3514
3876
  };
3515
- __name(AgentStateMessageInput, "AgentStateMessageInput");
3516
- _ts_decorate3([
3517
- (0, import_type_graphql4.Field)(() => String),
3518
- _ts_metadata3("design:type", String)
3519
- ], AgentStateMessageInput.prototype, "threadId", void 0);
3520
- _ts_decorate3([
3521
- (0, import_type_graphql4.Field)(() => String),
3522
- _ts_metadata3("design:type", String)
3523
- ], AgentStateMessageInput.prototype, "agentName", void 0);
3524
- _ts_decorate3([
3525
- (0, import_type_graphql4.Field)(() => MessageRole),
3526
- _ts_metadata3("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
3527
- ], AgentStateMessageInput.prototype, "role", void 0);
3528
- _ts_decorate3([
3529
- (0, import_type_graphql4.Field)(() => String),
3530
- _ts_metadata3("design:type", String)
3531
- ], AgentStateMessageInput.prototype, "state", void 0);
3532
- _ts_decorate3([
3533
- (0, import_type_graphql4.Field)(() => Boolean),
3534
- _ts_metadata3("design:type", Boolean)
3535
- ], AgentStateMessageInput.prototype, "running", void 0);
3536
- _ts_decorate3([
3537
- (0, import_type_graphql4.Field)(() => String),
3538
- _ts_metadata3("design:type", String)
3539
- ], AgentStateMessageInput.prototype, "nodeName", void 0);
3540
- _ts_decorate3([
3541
- (0, import_type_graphql4.Field)(() => String),
3542
- _ts_metadata3("design:type", String)
3543
- ], AgentStateMessageInput.prototype, "runId", void 0);
3544
- _ts_decorate3([
3545
- (0, import_type_graphql4.Field)(() => Boolean),
3546
- _ts_metadata3("design:type", Boolean)
3547
- ], AgentStateMessageInput.prototype, "active", void 0);
3548
- AgentStateMessageInput = _ts_decorate3([
3549
- (0, import_type_graphql4.InputType)()
3550
- ], AgentStateMessageInput);
3551
-
3552
- // src/graphql/inputs/frontend.input.ts
3553
- var import_type_graphql6 = require("type-graphql");
3554
-
3555
- // src/graphql/inputs/action.input.ts
3556
- var import_type_graphql5 = require("type-graphql");
3557
- function _ts_decorate4(decorators, target, key, desc) {
3558
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3559
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3560
- r = Reflect.decorate(decorators, target, key, desc);
3561
- else
3562
- for (var i = decorators.length - 1; i >= 0; i--)
3563
- if (d = decorators[i])
3564
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3565
- return c > 3 && r && Object.defineProperty(target, key, r), r;
3877
+ __name(CopilotRuntime, "CopilotRuntime");
3878
+ function flattenToolCallsNoDuplicates(toolsByPriority) {
3879
+ let allTools = [];
3880
+ const allToolNames = [];
3881
+ for (const tool of toolsByPriority) {
3882
+ if (!allToolNames.includes(tool.name)) {
3883
+ allTools.push(tool);
3884
+ allToolNames.push(tool.name);
3885
+ }
3886
+ }
3887
+ return allTools;
3566
3888
  }
3567
- __name(_ts_decorate4, "_ts_decorate");
3568
- function _ts_metadata4(k, v) {
3569
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3570
- return Reflect.metadata(k, v);
3889
+ __name(flattenToolCallsNoDuplicates, "flattenToolCallsNoDuplicates");
3890
+ function copilotKitEndpoint(config2) {
3891
+ return {
3892
+ ...config2,
3893
+ type: EndpointType.CopilotKit
3894
+ };
3571
3895
  }
3572
- __name(_ts_metadata4, "_ts_metadata");
3573
- var ActionInput = class {
3574
- name;
3575
- description;
3576
- jsonSchema;
3577
- available;
3578
- };
3579
- __name(ActionInput, "ActionInput");
3580
- _ts_decorate4([
3581
- (0, import_type_graphql5.Field)(() => String),
3582
- _ts_metadata4("design:type", String)
3583
- ], ActionInput.prototype, "name", void 0);
3584
- _ts_decorate4([
3585
- (0, import_type_graphql5.Field)(() => String),
3586
- _ts_metadata4("design:type", String)
3587
- ], ActionInput.prototype, "description", void 0);
3588
- _ts_decorate4([
3589
- (0, import_type_graphql5.Field)(() => String),
3590
- _ts_metadata4("design:type", String)
3591
- ], ActionInput.prototype, "jsonSchema", void 0);
3592
- _ts_decorate4([
3593
- (0, import_type_graphql5.Field)(() => ActionInputAvailability, {
3594
- nullable: true
3595
- }),
3596
- _ts_metadata4("design:type", typeof ActionInputAvailability === "undefined" ? Object : ActionInputAvailability)
3597
- ], ActionInput.prototype, "available", void 0);
3598
- ActionInput = _ts_decorate4([
3599
- (0, import_type_graphql5.InputType)()
3600
- ], ActionInput);
3601
-
3602
- // src/graphql/inputs/frontend.input.ts
3603
- function _ts_decorate5(decorators, target, key, desc) {
3604
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3605
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3606
- r = Reflect.decorate(decorators, target, key, desc);
3607
- else
3608
- for (var i = decorators.length - 1; i >= 0; i--)
3609
- if (d = decorators[i])
3610
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3611
- return c > 3 && r && Object.defineProperty(target, key, r), r;
3896
+ __name(copilotKitEndpoint, "copilotKitEndpoint");
3897
+ function langGraphPlatformEndpoint(config2) {
3898
+ return {
3899
+ ...config2,
3900
+ type: EndpointType.LangGraphPlatform
3901
+ };
3612
3902
  }
3613
- __name(_ts_decorate5, "_ts_decorate");
3614
- function _ts_metadata5(k, v) {
3615
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3616
- return Reflect.metadata(k, v);
3903
+ __name(langGraphPlatformEndpoint, "langGraphPlatformEndpoint");
3904
+ function resolveEndpointType(endpoint) {
3905
+ if (!endpoint.type) {
3906
+ if ("langsmithApiKey" in endpoint && "deploymentUrl" in endpoint && "agents" in endpoint) {
3907
+ return EndpointType.LangGraphPlatform;
3908
+ } else {
3909
+ return EndpointType.CopilotKit;
3910
+ }
3911
+ }
3912
+ return endpoint.type;
3617
3913
  }
3618
- __name(_ts_metadata5, "_ts_metadata");
3619
- var FrontendInput = class {
3620
- toDeprecate_fullContext;
3621
- actions;
3622
- url;
3623
- };
3624
- __name(FrontendInput, "FrontendInput");
3625
- _ts_decorate5([
3626
- (0, import_type_graphql6.Field)(() => String, {
3627
- nullable: true
3628
- }),
3629
- _ts_metadata5("design:type", String)
3630
- ], FrontendInput.prototype, "toDeprecate_fullContext", void 0);
3631
- _ts_decorate5([
3632
- (0, import_type_graphql6.Field)(() => [
3633
- ActionInput
3634
- ]),
3635
- _ts_metadata5("design:type", Array)
3636
- ], FrontendInput.prototype, "actions", void 0);
3637
- _ts_decorate5([
3638
- (0, import_type_graphql6.Field)(() => String, {
3639
- nullable: true
3640
- }),
3641
- _ts_metadata5("design:type", String)
3642
- ], FrontendInput.prototype, "url", void 0);
3643
- FrontendInput = _ts_decorate5([
3644
- (0, import_type_graphql6.InputType)()
3645
- ], FrontendInput);
3914
+ __name(resolveEndpointType, "resolveEndpointType");
3646
3915
 
3647
- // src/graphql/inputs/cloud.input.ts
3648
- var import_type_graphql8 = require("type-graphql");
3916
+ // src/lib/integrations/shared.ts
3917
+ var import_type_graphql26 = require("type-graphql");
3649
3918
 
3650
- // src/graphql/inputs/cloud-guardrails.input.ts
3651
- var import_type_graphql7 = require("type-graphql");
3652
- function _ts_decorate6(decorators, target, key, desc) {
3653
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3654
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3655
- r = Reflect.decorate(decorators, target, key, desc);
3656
- else
3657
- for (var i = decorators.length - 1; i >= 0; i--)
3658
- if (d = decorators[i])
3659
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3660
- return c > 3 && r && Object.defineProperty(target, key, r), r;
3661
- }
3662
- __name(_ts_decorate6, "_ts_decorate");
3663
- function _ts_metadata6(k, v) {
3664
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3665
- return Reflect.metadata(k, v);
3666
- }
3667
- __name(_ts_metadata6, "_ts_metadata");
3668
- var GuardrailsRuleInput = class {
3669
- allowList = [];
3670
- denyList = [];
3671
- };
3672
- __name(GuardrailsRuleInput, "GuardrailsRuleInput");
3673
- _ts_decorate6([
3674
- (0, import_type_graphql7.Field)(() => [
3675
- String
3676
- ], {
3677
- nullable: true
3678
- }),
3679
- _ts_metadata6("design:type", Array)
3680
- ], GuardrailsRuleInput.prototype, "allowList", void 0);
3681
- _ts_decorate6([
3682
- (0, import_type_graphql7.Field)(() => [
3683
- String
3684
- ], {
3685
- nullable: true
3686
- }),
3687
- _ts_metadata6("design:type", Array)
3688
- ], GuardrailsRuleInput.prototype, "denyList", void 0);
3689
- GuardrailsRuleInput = _ts_decorate6([
3690
- (0, import_type_graphql7.InputType)()
3691
- ], GuardrailsRuleInput);
3692
- var GuardrailsInput = class {
3693
- inputValidationRules;
3694
- };
3695
- __name(GuardrailsInput, "GuardrailsInput");
3696
- _ts_decorate6([
3697
- (0, import_type_graphql7.Field)(() => GuardrailsRuleInput, {
3698
- nullable: false
3699
- }),
3700
- _ts_metadata6("design:type", typeof GuardrailsRuleInput === "undefined" ? Object : GuardrailsRuleInput)
3701
- ], GuardrailsInput.prototype, "inputValidationRules", void 0);
3702
- GuardrailsInput = _ts_decorate6([
3703
- (0, import_type_graphql7.InputType)()
3704
- ], GuardrailsInput);
3919
+ // src/graphql/resolvers/copilot.resolver.ts
3920
+ var import_type_graphql20 = require("type-graphql");
3921
+ var import_rxjs4 = require("rxjs");
3705
3922
 
3706
- // src/graphql/inputs/cloud.input.ts
3923
+ // src/graphql/inputs/generate-copilot-response.input.ts
3924
+ var import_type_graphql18 = require("type-graphql");
3925
+
3926
+ // src/graphql/inputs/message.input.ts
3927
+ var import_type_graphql8 = require("type-graphql");
3707
3928
  function _ts_decorate7(decorators, target, key, desc) {
3708
3929
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3709
3930
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3720,21 +3941,173 @@ function _ts_metadata7(k, v) {
3720
3941
  return Reflect.metadata(k, v);
3721
3942
  }
3722
3943
  __name(_ts_metadata7, "_ts_metadata");
3723
- var CloudInput = class {
3724
- guardrails;
3944
+ var MessageInput = class extends BaseMessageInput {
3945
+ textMessage;
3946
+ actionExecutionMessage;
3947
+ resultMessage;
3948
+ agentStateMessage;
3725
3949
  };
3726
- __name(CloudInput, "CloudInput");
3950
+ __name(MessageInput, "MessageInput");
3727
3951
  _ts_decorate7([
3728
- (0, import_type_graphql8.Field)(() => GuardrailsInput, {
3952
+ (0, import_type_graphql8.Field)(() => TextMessageInput, {
3729
3953
  nullable: true
3730
3954
  }),
3731
- _ts_metadata7("design:type", typeof GuardrailsInput === "undefined" ? Object : GuardrailsInput)
3732
- ], CloudInput.prototype, "guardrails", void 0);
3733
- CloudInput = _ts_decorate7([
3955
+ _ts_metadata7("design:type", typeof TextMessageInput === "undefined" ? Object : TextMessageInput)
3956
+ ], MessageInput.prototype, "textMessage", void 0);
3957
+ _ts_decorate7([
3958
+ (0, import_type_graphql8.Field)(() => ActionExecutionMessageInput, {
3959
+ nullable: true
3960
+ }),
3961
+ _ts_metadata7("design:type", typeof ActionExecutionMessageInput === "undefined" ? Object : ActionExecutionMessageInput)
3962
+ ], MessageInput.prototype, "actionExecutionMessage", void 0);
3963
+ _ts_decorate7([
3964
+ (0, import_type_graphql8.Field)(() => ResultMessageInput, {
3965
+ nullable: true
3966
+ }),
3967
+ _ts_metadata7("design:type", typeof ResultMessageInput === "undefined" ? Object : ResultMessageInput)
3968
+ ], MessageInput.prototype, "resultMessage", void 0);
3969
+ _ts_decorate7([
3970
+ (0, import_type_graphql8.Field)(() => AgentStateMessageInput, {
3971
+ nullable: true
3972
+ }),
3973
+ _ts_metadata7("design:type", typeof AgentStateMessageInput === "undefined" ? Object : AgentStateMessageInput)
3974
+ ], MessageInput.prototype, "agentStateMessage", void 0);
3975
+ MessageInput = _ts_decorate7([
3734
3976
  (0, import_type_graphql8.InputType)()
3735
- ], CloudInput);
3977
+ ], MessageInput);
3978
+ var TextMessageInput = class {
3979
+ content;
3980
+ parentMessageId;
3981
+ role;
3982
+ };
3983
+ __name(TextMessageInput, "TextMessageInput");
3984
+ _ts_decorate7([
3985
+ (0, import_type_graphql8.Field)(() => String),
3986
+ _ts_metadata7("design:type", String)
3987
+ ], TextMessageInput.prototype, "content", void 0);
3988
+ _ts_decorate7([
3989
+ (0, import_type_graphql8.Field)(() => String, {
3990
+ nullable: true
3991
+ }),
3992
+ _ts_metadata7("design:type", String)
3993
+ ], TextMessageInput.prototype, "parentMessageId", void 0);
3994
+ _ts_decorate7([
3995
+ (0, import_type_graphql8.Field)(() => MessageRole),
3996
+ _ts_metadata7("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
3997
+ ], TextMessageInput.prototype, "role", void 0);
3998
+ TextMessageInput = _ts_decorate7([
3999
+ (0, import_type_graphql8.InputType)()
4000
+ ], TextMessageInput);
4001
+ var ActionExecutionMessageInput = class {
4002
+ name;
4003
+ arguments;
4004
+ parentMessageId;
4005
+ scope;
4006
+ };
4007
+ __name(ActionExecutionMessageInput, "ActionExecutionMessageInput");
4008
+ _ts_decorate7([
4009
+ (0, import_type_graphql8.Field)(() => String),
4010
+ _ts_metadata7("design:type", String)
4011
+ ], ActionExecutionMessageInput.prototype, "name", void 0);
4012
+ _ts_decorate7([
4013
+ (0, import_type_graphql8.Field)(() => String),
4014
+ _ts_metadata7("design:type", String)
4015
+ ], ActionExecutionMessageInput.prototype, "arguments", void 0);
4016
+ _ts_decorate7([
4017
+ (0, import_type_graphql8.Field)(() => String, {
4018
+ nullable: true
4019
+ }),
4020
+ _ts_metadata7("design:type", String)
4021
+ ], ActionExecutionMessageInput.prototype, "parentMessageId", void 0);
4022
+ _ts_decorate7([
4023
+ (0, import_type_graphql8.Field)(() => String, {
4024
+ nullable: true,
4025
+ deprecationReason: "This field will be removed in a future version"
4026
+ }),
4027
+ _ts_metadata7("design:type", typeof String === "undefined" ? Object : String)
4028
+ ], ActionExecutionMessageInput.prototype, "scope", void 0);
4029
+ ActionExecutionMessageInput = _ts_decorate7([
4030
+ (0, import_type_graphql8.InputType)()
4031
+ ], ActionExecutionMessageInput);
4032
+ var ResultMessageInput = class {
4033
+ actionExecutionId;
4034
+ actionName;
4035
+ parentMessageId;
4036
+ result;
4037
+ };
4038
+ __name(ResultMessageInput, "ResultMessageInput");
4039
+ _ts_decorate7([
4040
+ (0, import_type_graphql8.Field)(() => String),
4041
+ _ts_metadata7("design:type", String)
4042
+ ], ResultMessageInput.prototype, "actionExecutionId", void 0);
4043
+ _ts_decorate7([
4044
+ (0, import_type_graphql8.Field)(() => String),
4045
+ _ts_metadata7("design:type", String)
4046
+ ], ResultMessageInput.prototype, "actionName", void 0);
4047
+ _ts_decorate7([
4048
+ (0, import_type_graphql8.Field)(() => String, {
4049
+ nullable: true
4050
+ }),
4051
+ _ts_metadata7("design:type", String)
4052
+ ], ResultMessageInput.prototype, "parentMessageId", void 0);
4053
+ _ts_decorate7([
4054
+ (0, import_type_graphql8.Field)(() => String),
4055
+ _ts_metadata7("design:type", String)
4056
+ ], ResultMessageInput.prototype, "result", void 0);
4057
+ ResultMessageInput = _ts_decorate7([
4058
+ (0, import_type_graphql8.InputType)()
4059
+ ], ResultMessageInput);
4060
+ var AgentStateMessageInput = class {
4061
+ threadId;
4062
+ agentName;
4063
+ role;
4064
+ state;
4065
+ running;
4066
+ nodeName;
4067
+ runId;
4068
+ active;
4069
+ };
4070
+ __name(AgentStateMessageInput, "AgentStateMessageInput");
4071
+ _ts_decorate7([
4072
+ (0, import_type_graphql8.Field)(() => String),
4073
+ _ts_metadata7("design:type", String)
4074
+ ], AgentStateMessageInput.prototype, "threadId", void 0);
4075
+ _ts_decorate7([
4076
+ (0, import_type_graphql8.Field)(() => String),
4077
+ _ts_metadata7("design:type", String)
4078
+ ], AgentStateMessageInput.prototype, "agentName", void 0);
4079
+ _ts_decorate7([
4080
+ (0, import_type_graphql8.Field)(() => MessageRole),
4081
+ _ts_metadata7("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
4082
+ ], AgentStateMessageInput.prototype, "role", void 0);
4083
+ _ts_decorate7([
4084
+ (0, import_type_graphql8.Field)(() => String),
4085
+ _ts_metadata7("design:type", String)
4086
+ ], AgentStateMessageInput.prototype, "state", void 0);
4087
+ _ts_decorate7([
4088
+ (0, import_type_graphql8.Field)(() => Boolean),
4089
+ _ts_metadata7("design:type", Boolean)
4090
+ ], AgentStateMessageInput.prototype, "running", void 0);
4091
+ _ts_decorate7([
4092
+ (0, import_type_graphql8.Field)(() => String),
4093
+ _ts_metadata7("design:type", String)
4094
+ ], AgentStateMessageInput.prototype, "nodeName", void 0);
4095
+ _ts_decorate7([
4096
+ (0, import_type_graphql8.Field)(() => String),
4097
+ _ts_metadata7("design:type", String)
4098
+ ], AgentStateMessageInput.prototype, "runId", void 0);
4099
+ _ts_decorate7([
4100
+ (0, import_type_graphql8.Field)(() => Boolean),
4101
+ _ts_metadata7("design:type", Boolean)
4102
+ ], AgentStateMessageInput.prototype, "active", void 0);
4103
+ AgentStateMessageInput = _ts_decorate7([
4104
+ (0, import_type_graphql8.InputType)()
4105
+ ], AgentStateMessageInput);
3736
4106
 
3737
- // src/graphql/inputs/forwarded-parameters.input.ts
4107
+ // src/graphql/inputs/frontend.input.ts
4108
+ var import_type_graphql10 = require("type-graphql");
4109
+
4110
+ // src/graphql/inputs/action.input.ts
3738
4111
  var import_type_graphql9 = require("type-graphql");
3739
4112
  function _ts_decorate8(decorators, target, key, desc) {
3740
4113
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3752,59 +4125,36 @@ function _ts_metadata8(k, v) {
3752
4125
  return Reflect.metadata(k, v);
3753
4126
  }
3754
4127
  __name(_ts_metadata8, "_ts_metadata");
3755
- var ForwardedParametersInput = class {
3756
- model;
3757
- maxTokens;
3758
- stop;
3759
- toolChoice;
3760
- toolChoiceFunctionName;
3761
- temperature;
4128
+ var ActionInput = class {
4129
+ name;
4130
+ description;
4131
+ jsonSchema;
4132
+ available;
3762
4133
  };
3763
- __name(ForwardedParametersInput, "ForwardedParametersInput");
4134
+ __name(ActionInput, "ActionInput");
3764
4135
  _ts_decorate8([
3765
- (0, import_type_graphql9.Field)(() => String, {
3766
- nullable: true
3767
- }),
4136
+ (0, import_type_graphql9.Field)(() => String),
3768
4137
  _ts_metadata8("design:type", String)
3769
- ], ForwardedParametersInput.prototype, "model", void 0);
3770
- _ts_decorate8([
3771
- (0, import_type_graphql9.Field)(() => Number, {
3772
- nullable: true
3773
- }),
3774
- _ts_metadata8("design:type", Number)
3775
- ], ForwardedParametersInput.prototype, "maxTokens", void 0);
3776
- _ts_decorate8([
3777
- (0, import_type_graphql9.Field)(() => [
3778
- String
3779
- ], {
3780
- nullable: true
3781
- }),
3782
- _ts_metadata8("design:type", Array)
3783
- ], ForwardedParametersInput.prototype, "stop", void 0);
4138
+ ], ActionInput.prototype, "name", void 0);
3784
4139
  _ts_decorate8([
3785
- (0, import_type_graphql9.Field)(() => String, {
3786
- nullable: true
3787
- }),
3788
- _ts_metadata8("design:type", typeof String === "undefined" ? Object : String)
3789
- ], ForwardedParametersInput.prototype, "toolChoice", void 0);
4140
+ (0, import_type_graphql9.Field)(() => String),
4141
+ _ts_metadata8("design:type", String)
4142
+ ], ActionInput.prototype, "description", void 0);
3790
4143
  _ts_decorate8([
3791
- (0, import_type_graphql9.Field)(() => String, {
3792
- nullable: true
3793
- }),
4144
+ (0, import_type_graphql9.Field)(() => String),
3794
4145
  _ts_metadata8("design:type", String)
3795
- ], ForwardedParametersInput.prototype, "toolChoiceFunctionName", void 0);
4146
+ ], ActionInput.prototype, "jsonSchema", void 0);
3796
4147
  _ts_decorate8([
3797
- (0, import_type_graphql9.Field)(() => Number, {
4148
+ (0, import_type_graphql9.Field)(() => ActionInputAvailability, {
3798
4149
  nullable: true
3799
4150
  }),
3800
- _ts_metadata8("design:type", Number)
3801
- ], ForwardedParametersInput.prototype, "temperature", void 0);
3802
- ForwardedParametersInput = _ts_decorate8([
4151
+ _ts_metadata8("design:type", typeof ActionInputAvailability === "undefined" ? Object : ActionInputAvailability)
4152
+ ], ActionInput.prototype, "available", void 0);
4153
+ ActionInput = _ts_decorate8([
3803
4154
  (0, import_type_graphql9.InputType)()
3804
- ], ForwardedParametersInput);
4155
+ ], ActionInput);
3805
4156
 
3806
- // src/graphql/inputs/agent-session.input.ts
3807
- var import_type_graphql10 = require("type-graphql");
4157
+ // src/graphql/inputs/frontend.input.ts
3808
4158
  function _ts_decorate9(decorators, target, key, desc) {
3809
4159
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3810
4160
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3821,33 +4171,38 @@ function _ts_metadata9(k, v) {
3821
4171
  return Reflect.metadata(k, v);
3822
4172
  }
3823
4173
  __name(_ts_metadata9, "_ts_metadata");
3824
- var AgentSessionInput = class {
3825
- agentName;
3826
- threadId;
3827
- nodeName;
4174
+ var FrontendInput = class {
4175
+ toDeprecate_fullContext;
4176
+ actions;
4177
+ url;
3828
4178
  };
3829
- __name(AgentSessionInput, "AgentSessionInput");
3830
- _ts_decorate9([
3831
- (0, import_type_graphql10.Field)(() => String),
3832
- _ts_metadata9("design:type", String)
3833
- ], AgentSessionInput.prototype, "agentName", void 0);
4179
+ __name(FrontendInput, "FrontendInput");
3834
4180
  _ts_decorate9([
3835
4181
  (0, import_type_graphql10.Field)(() => String, {
3836
4182
  nullable: true
3837
4183
  }),
3838
4184
  _ts_metadata9("design:type", String)
3839
- ], AgentSessionInput.prototype, "threadId", void 0);
4185
+ ], FrontendInput.prototype, "toDeprecate_fullContext", void 0);
4186
+ _ts_decorate9([
4187
+ (0, import_type_graphql10.Field)(() => [
4188
+ ActionInput
4189
+ ]),
4190
+ _ts_metadata9("design:type", Array)
4191
+ ], FrontendInput.prototype, "actions", void 0);
3840
4192
  _ts_decorate9([
3841
4193
  (0, import_type_graphql10.Field)(() => String, {
3842
4194
  nullable: true
3843
4195
  }),
3844
4196
  _ts_metadata9("design:type", String)
3845
- ], AgentSessionInput.prototype, "nodeName", void 0);
3846
- AgentSessionInput = _ts_decorate9([
4197
+ ], FrontendInput.prototype, "url", void 0);
4198
+ FrontendInput = _ts_decorate9([
3847
4199
  (0, import_type_graphql10.InputType)()
3848
- ], AgentSessionInput);
4200
+ ], FrontendInput);
3849
4201
 
3850
- // src/graphql/inputs/agent-state.input.ts
4202
+ // src/graphql/inputs/cloud.input.ts
4203
+ var import_type_graphql12 = require("type-graphql");
4204
+
4205
+ // src/graphql/inputs/cloud-guardrails.input.ts
3851
4206
  var import_type_graphql11 = require("type-graphql");
3852
4207
  function _ts_decorate10(decorators, target, key, desc) {
3853
4208
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3865,76 +4220,76 @@ function _ts_metadata10(k, v) {
3865
4220
  return Reflect.metadata(k, v);
3866
4221
  }
3867
4222
  __name(_ts_metadata10, "_ts_metadata");
3868
- var AgentStateInput = class {
3869
- agentName;
3870
- state;
4223
+ var GuardrailsRuleInput = class {
4224
+ allowList = [];
4225
+ denyList = [];
3871
4226
  };
3872
- __name(AgentStateInput, "AgentStateInput");
4227
+ __name(GuardrailsRuleInput, "GuardrailsRuleInput");
3873
4228
  _ts_decorate10([
3874
- (0, import_type_graphql11.Field)(() => String),
3875
- _ts_metadata10("design:type", String)
3876
- ], AgentStateInput.prototype, "agentName", void 0);
4229
+ (0, import_type_graphql11.Field)(() => [
4230
+ String
4231
+ ], {
4232
+ nullable: true
4233
+ }),
4234
+ _ts_metadata10("design:type", Array)
4235
+ ], GuardrailsRuleInput.prototype, "allowList", void 0);
3877
4236
  _ts_decorate10([
3878
- (0, import_type_graphql11.Field)(() => String),
3879
- _ts_metadata10("design:type", String)
3880
- ], AgentStateInput.prototype, "state", void 0);
3881
- AgentStateInput = _ts_decorate10([
4237
+ (0, import_type_graphql11.Field)(() => [
4238
+ String
4239
+ ], {
4240
+ nullable: true
4241
+ }),
4242
+ _ts_metadata10("design:type", Array)
4243
+ ], GuardrailsRuleInput.prototype, "denyList", void 0);
4244
+ GuardrailsRuleInput = _ts_decorate10([
3882
4245
  (0, import_type_graphql11.InputType)()
3883
- ], AgentStateInput);
4246
+ ], GuardrailsRuleInput);
4247
+ var GuardrailsInput = class {
4248
+ inputValidationRules;
4249
+ };
4250
+ __name(GuardrailsInput, "GuardrailsInput");
4251
+ _ts_decorate10([
4252
+ (0, import_type_graphql11.Field)(() => GuardrailsRuleInput, {
4253
+ nullable: false
4254
+ }),
4255
+ _ts_metadata10("design:type", typeof GuardrailsRuleInput === "undefined" ? Object : GuardrailsRuleInput)
4256
+ ], GuardrailsInput.prototype, "inputValidationRules", void 0);
4257
+ GuardrailsInput = _ts_decorate10([
4258
+ (0, import_type_graphql11.InputType)()
4259
+ ], GuardrailsInput);
3884
4260
 
3885
- // src/graphql/inputs/extensions.input.ts
3886
- var import_type_graphql12 = require("type-graphql");
4261
+ // src/graphql/inputs/cloud.input.ts
3887
4262
  function _ts_decorate11(decorators, target, key, desc) {
3888
4263
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3889
4264
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3890
4265
  r = Reflect.decorate(decorators, target, key, desc);
3891
4266
  else
3892
- for (var i = decorators.length - 1; i >= 0; i--)
3893
- if (d = decorators[i])
3894
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3895
- return c > 3 && r && Object.defineProperty(target, key, r), r;
3896
- }
3897
- __name(_ts_decorate11, "_ts_decorate");
3898
- function _ts_metadata11(k, v) {
3899
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
3900
- return Reflect.metadata(k, v);
3901
- }
3902
- __name(_ts_metadata11, "_ts_metadata");
3903
- var ExtensionsInput = class {
3904
- openaiAssistantAPI;
3905
- };
3906
- __name(ExtensionsInput, "ExtensionsInput");
3907
- _ts_decorate11([
3908
- (0, import_type_graphql12.Field)(() => OpenAIApiAssistantAPIInput, {
3909
- nullable: true
3910
- }),
3911
- _ts_metadata11("design:type", typeof OpenAIApiAssistantAPIInput === "undefined" ? Object : OpenAIApiAssistantAPIInput)
3912
- ], ExtensionsInput.prototype, "openaiAssistantAPI", void 0);
3913
- ExtensionsInput = _ts_decorate11([
3914
- (0, import_type_graphql12.InputType)()
3915
- ], ExtensionsInput);
3916
- var OpenAIApiAssistantAPIInput = class {
3917
- runId;
3918
- threadId;
4267
+ for (var i = decorators.length - 1; i >= 0; i--)
4268
+ if (d = decorators[i])
4269
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4270
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4271
+ }
4272
+ __name(_ts_decorate11, "_ts_decorate");
4273
+ function _ts_metadata11(k, v) {
4274
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
4275
+ return Reflect.metadata(k, v);
4276
+ }
4277
+ __name(_ts_metadata11, "_ts_metadata");
4278
+ var CloudInput = class {
4279
+ guardrails;
3919
4280
  };
3920
- __name(OpenAIApiAssistantAPIInput, "OpenAIApiAssistantAPIInput");
3921
- _ts_decorate11([
3922
- (0, import_type_graphql12.Field)(() => String, {
3923
- nullable: true
3924
- }),
3925
- _ts_metadata11("design:type", String)
3926
- ], OpenAIApiAssistantAPIInput.prototype, "runId", void 0);
4281
+ __name(CloudInput, "CloudInput");
3927
4282
  _ts_decorate11([
3928
- (0, import_type_graphql12.Field)(() => String, {
4283
+ (0, import_type_graphql12.Field)(() => GuardrailsInput, {
3929
4284
  nullable: true
3930
4285
  }),
3931
- _ts_metadata11("design:type", String)
3932
- ], OpenAIApiAssistantAPIInput.prototype, "threadId", void 0);
3933
- OpenAIApiAssistantAPIInput = _ts_decorate11([
4286
+ _ts_metadata11("design:type", typeof GuardrailsInput === "undefined" ? Object : GuardrailsInput)
4287
+ ], CloudInput.prototype, "guardrails", void 0);
4288
+ CloudInput = _ts_decorate11([
3934
4289
  (0, import_type_graphql12.InputType)()
3935
- ], OpenAIApiAssistantAPIInput);
4290
+ ], CloudInput);
3936
4291
 
3937
- // src/graphql/inputs/meta-event.input.ts
4292
+ // src/graphql/inputs/forwarded-parameters.input.ts
3938
4293
  var import_type_graphql13 = require("type-graphql");
3939
4294
  function _ts_decorate12(decorators, target, key, desc) {
3940
4295
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3952,36 +4307,59 @@ function _ts_metadata12(k, v) {
3952
4307
  return Reflect.metadata(k, v);
3953
4308
  }
3954
4309
  __name(_ts_metadata12, "_ts_metadata");
3955
- var MetaEventInput = class {
3956
- type = "MetaEvent";
3957
- name;
3958
- value;
3959
- response;
4310
+ var ForwardedParametersInput = class {
4311
+ model;
4312
+ maxTokens;
4313
+ stop;
4314
+ toolChoice;
4315
+ toolChoiceFunctionName;
4316
+ temperature;
3960
4317
  };
3961
- __name(MetaEventInput, "MetaEventInput");
4318
+ __name(ForwardedParametersInput, "ForwardedParametersInput");
3962
4319
  _ts_decorate12([
3963
- (0, import_type_graphql13.Field)(() => String),
4320
+ (0, import_type_graphql13.Field)(() => String, {
4321
+ nullable: true
4322
+ }),
3964
4323
  _ts_metadata12("design:type", String)
3965
- ], MetaEventInput.prototype, "type", void 0);
4324
+ ], ForwardedParametersInput.prototype, "model", void 0);
3966
4325
  _ts_decorate12([
3967
- (0, import_type_graphql13.Field)(() => MetaEventName),
3968
- _ts_metadata12("design:type", typeof MetaEventName === "undefined" ? Object : MetaEventName)
3969
- ], MetaEventInput.prototype, "name", void 0);
4326
+ (0, import_type_graphql13.Field)(() => Number, {
4327
+ nullable: true
4328
+ }),
4329
+ _ts_metadata12("design:type", Number)
4330
+ ], ForwardedParametersInput.prototype, "maxTokens", void 0);
3970
4331
  _ts_decorate12([
3971
- (0, import_type_graphql13.Field)(() => String),
3972
- _ts_metadata12("design:type", String)
3973
- ], MetaEventInput.prototype, "value", void 0);
4332
+ (0, import_type_graphql13.Field)(() => [
4333
+ String
4334
+ ], {
4335
+ nullable: true
4336
+ }),
4337
+ _ts_metadata12("design:type", Array)
4338
+ ], ForwardedParametersInput.prototype, "stop", void 0);
4339
+ _ts_decorate12([
4340
+ (0, import_type_graphql13.Field)(() => String, {
4341
+ nullable: true
4342
+ }),
4343
+ _ts_metadata12("design:type", typeof String === "undefined" ? Object : String)
4344
+ ], ForwardedParametersInput.prototype, "toolChoice", void 0);
3974
4345
  _ts_decorate12([
3975
4346
  (0, import_type_graphql13.Field)(() => String, {
3976
4347
  nullable: true
3977
4348
  }),
3978
4349
  _ts_metadata12("design:type", String)
3979
- ], MetaEventInput.prototype, "response", void 0);
3980
- MetaEventInput = _ts_decorate12([
4350
+ ], ForwardedParametersInput.prototype, "toolChoiceFunctionName", void 0);
4351
+ _ts_decorate12([
4352
+ (0, import_type_graphql13.Field)(() => Number, {
4353
+ nullable: true
4354
+ }),
4355
+ _ts_metadata12("design:type", Number)
4356
+ ], ForwardedParametersInput.prototype, "temperature", void 0);
4357
+ ForwardedParametersInput = _ts_decorate12([
3981
4358
  (0, import_type_graphql13.InputType)()
3982
- ], MetaEventInput);
4359
+ ], ForwardedParametersInput);
3983
4360
 
3984
- // src/graphql/inputs/generate-copilot-response.input.ts
4361
+ // src/graphql/inputs/agent-session.input.ts
4362
+ var import_type_graphql14 = require("type-graphql");
3985
4363
  function _ts_decorate13(decorators, target, key, desc) {
3986
4364
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3987
4365
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3998,116 +4376,33 @@ function _ts_metadata13(k, v) {
3998
4376
  return Reflect.metadata(k, v);
3999
4377
  }
4000
4378
  __name(_ts_metadata13, "_ts_metadata");
4001
- var GenerateCopilotResponseMetadataInput = class {
4002
- requestType;
4003
- };
4004
- __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
4005
- _ts_decorate13([
4006
- (0, import_type_graphql14.Field)(() => CopilotRequestType, {
4007
- nullable: true
4008
- }),
4009
- _ts_metadata13("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
4010
- ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
4011
- GenerateCopilotResponseMetadataInput = _ts_decorate13([
4012
- (0, import_type_graphql14.InputType)()
4013
- ], GenerateCopilotResponseMetadataInput);
4014
- var GenerateCopilotResponseInput = class {
4015
- metadata;
4379
+ var AgentSessionInput = class {
4380
+ agentName;
4016
4381
  threadId;
4017
- runId;
4018
- messages;
4019
- frontend;
4020
- cloud;
4021
- forwardedParameters;
4022
- agentSession;
4023
- agentState;
4024
- agentStates;
4025
- extensions;
4026
- metaEvents;
4382
+ nodeName;
4027
4383
  };
4028
- __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
4384
+ __name(AgentSessionInput, "AgentSessionInput");
4029
4385
  _ts_decorate13([
4030
- (0, import_type_graphql14.Field)(() => GenerateCopilotResponseMetadataInput, {
4031
- nullable: false
4032
- }),
4033
- _ts_metadata13("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
4034
- ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
4386
+ (0, import_type_graphql14.Field)(() => String),
4387
+ _ts_metadata13("design:type", String)
4388
+ ], AgentSessionInput.prototype, "agentName", void 0);
4035
4389
  _ts_decorate13([
4036
4390
  (0, import_type_graphql14.Field)(() => String, {
4037
4391
  nullable: true
4038
4392
  }),
4039
4393
  _ts_metadata13("design:type", String)
4040
- ], GenerateCopilotResponseInput.prototype, "threadId", void 0);
4394
+ ], AgentSessionInput.prototype, "threadId", void 0);
4041
4395
  _ts_decorate13([
4042
4396
  (0, import_type_graphql14.Field)(() => String, {
4043
4397
  nullable: true
4044
4398
  }),
4045
4399
  _ts_metadata13("design:type", String)
4046
- ], GenerateCopilotResponseInput.prototype, "runId", void 0);
4047
- _ts_decorate13([
4048
- (0, import_type_graphql14.Field)(() => [
4049
- MessageInput
4050
- ]),
4051
- _ts_metadata13("design:type", Array)
4052
- ], GenerateCopilotResponseInput.prototype, "messages", void 0);
4053
- _ts_decorate13([
4054
- (0, import_type_graphql14.Field)(() => FrontendInput),
4055
- _ts_metadata13("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
4056
- ], GenerateCopilotResponseInput.prototype, "frontend", void 0);
4057
- _ts_decorate13([
4058
- (0, import_type_graphql14.Field)(() => CloudInput, {
4059
- nullable: true
4060
- }),
4061
- _ts_metadata13("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
4062
- ], GenerateCopilotResponseInput.prototype, "cloud", void 0);
4063
- _ts_decorate13([
4064
- (0, import_type_graphql14.Field)(() => ForwardedParametersInput, {
4065
- nullable: true
4066
- }),
4067
- _ts_metadata13("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
4068
- ], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
4069
- _ts_decorate13([
4070
- (0, import_type_graphql14.Field)(() => AgentSessionInput, {
4071
- nullable: true
4072
- }),
4073
- _ts_metadata13("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
4074
- ], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
4075
- _ts_decorate13([
4076
- (0, import_type_graphql14.Field)(() => AgentStateInput, {
4077
- nullable: true
4078
- }),
4079
- _ts_metadata13("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
4080
- ], GenerateCopilotResponseInput.prototype, "agentState", void 0);
4081
- _ts_decorate13([
4082
- (0, import_type_graphql14.Field)(() => [
4083
- AgentStateInput
4084
- ], {
4085
- nullable: true
4086
- }),
4087
- _ts_metadata13("design:type", Array)
4088
- ], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
4089
- _ts_decorate13([
4090
- (0, import_type_graphql14.Field)(() => ExtensionsInput, {
4091
- nullable: true
4092
- }),
4093
- _ts_metadata13("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
4094
- ], GenerateCopilotResponseInput.prototype, "extensions", void 0);
4095
- _ts_decorate13([
4096
- (0, import_type_graphql14.Field)(() => [
4097
- MetaEventInput
4098
- ], {
4099
- nullable: true
4100
- }),
4101
- _ts_metadata13("design:type", Array)
4102
- ], GenerateCopilotResponseInput.prototype, "metaEvents", void 0);
4103
- GenerateCopilotResponseInput = _ts_decorate13([
4400
+ ], AgentSessionInput.prototype, "nodeName", void 0);
4401
+ AgentSessionInput = _ts_decorate13([
4104
4402
  (0, import_type_graphql14.InputType)()
4105
- ], GenerateCopilotResponseInput);
4106
-
4107
- // src/graphql/types/copilot-response.type.ts
4108
- var import_type_graphql18 = require("type-graphql");
4403
+ ], AgentSessionInput);
4109
4404
 
4110
- // src/graphql/types/message-status.type.ts
4405
+ // src/graphql/inputs/agent-state.input.ts
4111
4406
  var import_type_graphql15 = require("type-graphql");
4112
4407
  function _ts_decorate14(decorators, target, key, desc) {
4113
4408
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4125,62 +4420,24 @@ function _ts_metadata14(k, v) {
4125
4420
  return Reflect.metadata(k, v);
4126
4421
  }
4127
4422
  __name(_ts_metadata14, "_ts_metadata");
4128
- var MessageStatusCode;
4129
- (function(MessageStatusCode2) {
4130
- MessageStatusCode2["Pending"] = "pending";
4131
- MessageStatusCode2["Success"] = "success";
4132
- MessageStatusCode2["Failed"] = "failed";
4133
- })(MessageStatusCode || (MessageStatusCode = {}));
4134
- (0, import_type_graphql15.registerEnumType)(MessageStatusCode, {
4135
- name: "MessageStatusCode"
4136
- });
4137
- var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
4138
- code;
4139
- }, "BaseMessageStatus");
4423
+ var AgentStateInput = class {
4424
+ agentName;
4425
+ state;
4426
+ };
4427
+ __name(AgentStateInput, "AgentStateInput");
4140
4428
  _ts_decorate14([
4141
- (0, import_type_graphql15.Field)(() => MessageStatusCode),
4429
+ (0, import_type_graphql15.Field)(() => String),
4142
4430
  _ts_metadata14("design:type", String)
4143
- ], BaseMessageStatus.prototype, "code", void 0);
4144
- BaseMessageStatus = _ts_decorate14([
4145
- (0, import_type_graphql15.ObjectType)()
4146
- ], BaseMessageStatus);
4147
- var PendingMessageStatus = class extends BaseMessageStatus {
4148
- code = "pending";
4149
- };
4150
- __name(PendingMessageStatus, "PendingMessageStatus");
4151
- PendingMessageStatus = _ts_decorate14([
4152
- (0, import_type_graphql15.ObjectType)()
4153
- ], PendingMessageStatus);
4154
- var SuccessMessageStatus = class extends BaseMessageStatus {
4155
- code = "success";
4156
- };
4157
- __name(SuccessMessageStatus, "SuccessMessageStatus");
4158
- SuccessMessageStatus = _ts_decorate14([
4159
- (0, import_type_graphql15.ObjectType)()
4160
- ], SuccessMessageStatus);
4161
- var FailedMessageStatus = class extends BaseMessageStatus {
4162
- code = "failed";
4163
- reason;
4164
- };
4165
- __name(FailedMessageStatus, "FailedMessageStatus");
4431
+ ], AgentStateInput.prototype, "agentName", void 0);
4166
4432
  _ts_decorate14([
4167
4433
  (0, import_type_graphql15.Field)(() => String),
4168
4434
  _ts_metadata14("design:type", String)
4169
- ], FailedMessageStatus.prototype, "reason", void 0);
4170
- FailedMessageStatus = _ts_decorate14([
4171
- (0, import_type_graphql15.ObjectType)()
4172
- ], FailedMessageStatus);
4173
- var MessageStatusUnion = (0, import_type_graphql15.createUnionType)({
4174
- name: "MessageStatus",
4175
- types: () => [
4176
- PendingMessageStatus,
4177
- SuccessMessageStatus,
4178
- FailedMessageStatus
4179
- ]
4180
- });
4435
+ ], AgentStateInput.prototype, "state", void 0);
4436
+ AgentStateInput = _ts_decorate14([
4437
+ (0, import_type_graphql15.InputType)()
4438
+ ], AgentStateInput);
4181
4439
 
4182
- // src/graphql/types/response-status.type.ts
4183
- var import_graphql_scalars = require("graphql-scalars");
4440
+ // src/graphql/inputs/extensions.input.ts
4184
4441
  var import_type_graphql16 = require("type-graphql");
4185
4442
  function _ts_decorate15(decorators, target, key, desc) {
4186
4443
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4198,95 +4455,41 @@ function _ts_metadata15(k, v) {
4198
4455
  return Reflect.metadata(k, v);
4199
4456
  }
4200
4457
  __name(_ts_metadata15, "_ts_metadata");
4201
- var ResponseStatusCode;
4202
- (function(ResponseStatusCode2) {
4203
- ResponseStatusCode2["Pending"] = "pending";
4204
- ResponseStatusCode2["Success"] = "success";
4205
- ResponseStatusCode2["Failed"] = "failed";
4206
- })(ResponseStatusCode || (ResponseStatusCode = {}));
4207
- (0, import_type_graphql16.registerEnumType)(ResponseStatusCode, {
4208
- name: "ResponseStatusCode"
4209
- });
4210
- var BaseResponseStatus = /* @__PURE__ */ __name(class BaseResponseStatus2 {
4211
- code;
4212
- }, "BaseResponseStatus");
4213
- _ts_decorate15([
4214
- (0, import_type_graphql16.Field)(() => ResponseStatusCode),
4215
- _ts_metadata15("design:type", String)
4216
- ], BaseResponseStatus.prototype, "code", void 0);
4217
- BaseResponseStatus = _ts_decorate15([
4218
- (0, import_type_graphql16.InterfaceType)({
4219
- resolveType(value) {
4220
- if (value.code === "success") {
4221
- return SuccessResponseStatus;
4222
- } else if (value.code === "failed") {
4223
- return FailedResponseStatus;
4224
- } else if (value.code === "pending") {
4225
- return PendingResponseStatus;
4226
- }
4227
- return void 0;
4228
- }
4229
- }),
4230
- (0, import_type_graphql16.ObjectType)()
4231
- ], BaseResponseStatus);
4232
- var PendingResponseStatus = class extends BaseResponseStatus {
4233
- code = "pending";
4234
- };
4235
- __name(PendingResponseStatus, "PendingResponseStatus");
4236
- PendingResponseStatus = _ts_decorate15([
4237
- (0, import_type_graphql16.ObjectType)({
4238
- implements: BaseResponseStatus
4239
- })
4240
- ], PendingResponseStatus);
4241
- var SuccessResponseStatus = class extends BaseResponseStatus {
4242
- code = "success";
4458
+ var ExtensionsInput = class {
4459
+ openaiAssistantAPI;
4243
4460
  };
4244
- __name(SuccessResponseStatus, "SuccessResponseStatus");
4245
- SuccessResponseStatus = _ts_decorate15([
4246
- (0, import_type_graphql16.ObjectType)({
4247
- implements: BaseResponseStatus
4248
- })
4249
- ], SuccessResponseStatus);
4250
- var FailedResponseStatusReason;
4251
- (function(FailedResponseStatusReason2) {
4252
- FailedResponseStatusReason2["GUARDRAILS_VALIDATION_FAILED"] = "GUARDRAILS_VALIDATION_FAILED";
4253
- FailedResponseStatusReason2["MESSAGE_STREAM_INTERRUPTED"] = "MESSAGE_STREAM_INTERRUPTED";
4254
- FailedResponseStatusReason2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
4255
- })(FailedResponseStatusReason || (FailedResponseStatusReason = {}));
4256
- (0, import_type_graphql16.registerEnumType)(FailedResponseStatusReason, {
4257
- name: "FailedResponseStatusReason"
4258
- });
4259
- var FailedResponseStatus = class extends BaseResponseStatus {
4260
- code = "failed";
4261
- reason;
4262
- details = null;
4461
+ __name(ExtensionsInput, "ExtensionsInput");
4462
+ _ts_decorate15([
4463
+ (0, import_type_graphql16.Field)(() => OpenAIApiAssistantAPIInput, {
4464
+ nullable: true
4465
+ }),
4466
+ _ts_metadata15("design:type", typeof OpenAIApiAssistantAPIInput === "undefined" ? Object : OpenAIApiAssistantAPIInput)
4467
+ ], ExtensionsInput.prototype, "openaiAssistantAPI", void 0);
4468
+ ExtensionsInput = _ts_decorate15([
4469
+ (0, import_type_graphql16.InputType)()
4470
+ ], ExtensionsInput);
4471
+ var OpenAIApiAssistantAPIInput = class {
4472
+ runId;
4473
+ threadId;
4263
4474
  };
4264
- __name(FailedResponseStatus, "FailedResponseStatus");
4475
+ __name(OpenAIApiAssistantAPIInput, "OpenAIApiAssistantAPIInput");
4265
4476
  _ts_decorate15([
4266
- (0, import_type_graphql16.Field)(() => FailedResponseStatusReason),
4477
+ (0, import_type_graphql16.Field)(() => String, {
4478
+ nullable: true
4479
+ }),
4267
4480
  _ts_metadata15("design:type", String)
4268
- ], FailedResponseStatus.prototype, "reason", void 0);
4481
+ ], OpenAIApiAssistantAPIInput.prototype, "runId", void 0);
4269
4482
  _ts_decorate15([
4270
- (0, import_type_graphql16.Field)(() => import_graphql_scalars.GraphQLJSON, {
4483
+ (0, import_type_graphql16.Field)(() => String, {
4271
4484
  nullable: true
4272
4485
  }),
4273
- _ts_metadata15("design:type", typeof Record === "undefined" ? Object : Record)
4274
- ], FailedResponseStatus.prototype, "details", void 0);
4275
- FailedResponseStatus = _ts_decorate15([
4276
- (0, import_type_graphql16.ObjectType)({
4277
- implements: BaseResponseStatus
4278
- })
4279
- ], FailedResponseStatus);
4280
- var ResponseStatusUnion = (0, import_type_graphql16.createUnionType)({
4281
- name: "ResponseStatus",
4282
- types: () => [
4283
- PendingResponseStatus,
4284
- SuccessResponseStatus,
4285
- FailedResponseStatus
4286
- ]
4287
- });
4486
+ _ts_metadata15("design:type", String)
4487
+ ], OpenAIApiAssistantAPIInput.prototype, "threadId", void 0);
4488
+ OpenAIApiAssistantAPIInput = _ts_decorate15([
4489
+ (0, import_type_graphql16.InputType)()
4490
+ ], OpenAIApiAssistantAPIInput);
4288
4491
 
4289
- // src/graphql/types/extensions-response.type.ts
4492
+ // src/graphql/inputs/meta-event.input.ts
4290
4493
  var import_type_graphql17 = require("type-graphql");
4291
4494
  function _ts_decorate16(decorators, target, key, desc) {
4292
4495
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -4304,41 +4507,40 @@ function _ts_metadata16(k, v) {
4304
4507
  return Reflect.metadata(k, v);
4305
4508
  }
4306
4509
  __name(_ts_metadata16, "_ts_metadata");
4307
- var ExtensionsResponse = class {
4308
- openaiAssistantAPI;
4510
+ var MetaEventInput = class {
4511
+ name;
4512
+ value;
4513
+ response;
4514
+ messages;
4309
4515
  };
4310
- __name(ExtensionsResponse, "ExtensionsResponse");
4516
+ __name(MetaEventInput, "MetaEventInput");
4311
4517
  _ts_decorate16([
4312
- (0, import_type_graphql17.Field)(() => OpenAIApiAssistantAPIResponse, {
4313
- nullable: true
4314
- }),
4315
- _ts_metadata16("design:type", typeof OpenAIApiAssistantAPIResponse === "undefined" ? Object : OpenAIApiAssistantAPIResponse)
4316
- ], ExtensionsResponse.prototype, "openaiAssistantAPI", void 0);
4317
- ExtensionsResponse = _ts_decorate16([
4318
- (0, import_type_graphql17.ObjectType)()
4319
- ], ExtensionsResponse);
4320
- var OpenAIApiAssistantAPIResponse = class {
4321
- runId;
4322
- threadId;
4323
- };
4324
- __name(OpenAIApiAssistantAPIResponse, "OpenAIApiAssistantAPIResponse");
4518
+ (0, import_type_graphql17.Field)(() => MetaEventName),
4519
+ _ts_metadata16("design:type", typeof MetaEventName === "undefined" ? Object : MetaEventName)
4520
+ ], MetaEventInput.prototype, "name", void 0);
4521
+ _ts_decorate16([
4522
+ (0, import_type_graphql17.Field)(() => String),
4523
+ _ts_metadata16("design:type", String)
4524
+ ], MetaEventInput.prototype, "value", void 0);
4325
4525
  _ts_decorate16([
4326
4526
  (0, import_type_graphql17.Field)(() => String, {
4327
4527
  nullable: true
4328
4528
  }),
4329
4529
  _ts_metadata16("design:type", String)
4330
- ], OpenAIApiAssistantAPIResponse.prototype, "runId", void 0);
4530
+ ], MetaEventInput.prototype, "response", void 0);
4331
4531
  _ts_decorate16([
4332
- (0, import_type_graphql17.Field)(() => String, {
4532
+ (0, import_type_graphql17.Field)(() => [
4533
+ MessageInput
4534
+ ], {
4333
4535
  nullable: true
4334
4536
  }),
4335
- _ts_metadata16("design:type", String)
4336
- ], OpenAIApiAssistantAPIResponse.prototype, "threadId", void 0);
4337
- OpenAIApiAssistantAPIResponse = _ts_decorate16([
4338
- (0, import_type_graphql17.ObjectType)()
4339
- ], OpenAIApiAssistantAPIResponse);
4537
+ _ts_metadata16("design:type", Array)
4538
+ ], MetaEventInput.prototype, "messages", void 0);
4539
+ MetaEventInput = _ts_decorate16([
4540
+ (0, import_type_graphql17.InputType)()
4541
+ ], MetaEventInput);
4340
4542
 
4341
- // src/graphql/types/copilot-response.type.ts
4543
+ // src/graphql/inputs/generate-copilot-response.input.ts
4342
4544
  function _ts_decorate17(decorators, target, key, desc) {
4343
4545
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4344
4546
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -4355,221 +4557,111 @@ function _ts_metadata17(k, v) {
4355
4557
  return Reflect.metadata(k, v);
4356
4558
  }
4357
4559
  __name(_ts_metadata17, "_ts_metadata");
4358
- var BaseMessageOutput = class {
4359
- id;
4360
- createdAt;
4361
- status;
4560
+ var GenerateCopilotResponseMetadataInput = class {
4561
+ requestType;
4362
4562
  };
4363
- __name(BaseMessageOutput, "BaseMessageOutput");
4364
- _ts_decorate17([
4365
- (0, import_type_graphql18.Field)(() => String),
4366
- _ts_metadata17("design:type", String)
4367
- ], BaseMessageOutput.prototype, "id", void 0);
4368
- _ts_decorate17([
4369
- (0, import_type_graphql18.Field)(() => Date),
4370
- _ts_metadata17("design:type", typeof Date === "undefined" ? Object : Date)
4371
- ], BaseMessageOutput.prototype, "createdAt", void 0);
4563
+ __name(GenerateCopilotResponseMetadataInput, "GenerateCopilotResponseMetadataInput");
4372
4564
  _ts_decorate17([
4373
- (0, import_type_graphql18.Field)(() => MessageStatusUnion),
4374
- _ts_metadata17("design:type", Object)
4375
- ], BaseMessageOutput.prototype, "status", void 0);
4376
- BaseMessageOutput = _ts_decorate17([
4377
- (0, import_type_graphql18.InterfaceType)({
4378
- resolveType(value) {
4379
- if (value.hasOwnProperty("content")) {
4380
- return TextMessageOutput;
4381
- } else if (value.hasOwnProperty("name")) {
4382
- return ActionExecutionMessageOutput;
4383
- } else if (value.hasOwnProperty("result")) {
4384
- return ResultMessageOutput;
4385
- } else if (value.hasOwnProperty("state")) {
4386
- return AgentStateMessageOutput;
4387
- } else if (value.name === MetaEventName.LangGraphInterruptEvent) {
4388
- return LangGraphInterruptEvent;
4389
- }
4390
- return void 0;
4391
- }
4392
- })
4393
- ], BaseMessageOutput);
4394
- var TextMessageOutput = class {
4395
- role;
4396
- content;
4397
- parentMessageId;
4565
+ (0, import_type_graphql18.Field)(() => CopilotRequestType, {
4566
+ nullable: true
4567
+ }),
4568
+ _ts_metadata17("design:type", typeof CopilotRequestType === "undefined" ? Object : CopilotRequestType)
4569
+ ], GenerateCopilotResponseMetadataInput.prototype, "requestType", void 0);
4570
+ GenerateCopilotResponseMetadataInput = _ts_decorate17([
4571
+ (0, import_type_graphql18.InputType)()
4572
+ ], GenerateCopilotResponseMetadataInput);
4573
+ var GenerateCopilotResponseInput = class {
4574
+ metadata;
4575
+ threadId;
4576
+ runId;
4577
+ messages;
4578
+ frontend;
4579
+ cloud;
4580
+ forwardedParameters;
4581
+ agentSession;
4582
+ agentState;
4583
+ agentStates;
4584
+ extensions;
4585
+ metaEvents;
4398
4586
  };
4399
- __name(TextMessageOutput, "TextMessageOutput");
4400
- _ts_decorate17([
4401
- (0, import_type_graphql18.Field)(() => MessageRole),
4402
- _ts_metadata17("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
4403
- ], TextMessageOutput.prototype, "role", void 0);
4587
+ __name(GenerateCopilotResponseInput, "GenerateCopilotResponseInput");
4404
4588
  _ts_decorate17([
4405
- (0, import_type_graphql18.Field)(() => [
4406
- String
4407
- ]),
4408
- _ts_metadata17("design:type", Array)
4409
- ], TextMessageOutput.prototype, "content", void 0);
4589
+ (0, import_type_graphql18.Field)(() => GenerateCopilotResponseMetadataInput, {
4590
+ nullable: false
4591
+ }),
4592
+ _ts_metadata17("design:type", typeof GenerateCopilotResponseMetadataInput === "undefined" ? Object : GenerateCopilotResponseMetadataInput)
4593
+ ], GenerateCopilotResponseInput.prototype, "metadata", void 0);
4410
4594
  _ts_decorate17([
4411
4595
  (0, import_type_graphql18.Field)(() => String, {
4412
4596
  nullable: true
4413
4597
  }),
4414
4598
  _ts_metadata17("design:type", String)
4415
- ], TextMessageOutput.prototype, "parentMessageId", void 0);
4416
- TextMessageOutput = _ts_decorate17([
4417
- (0, import_type_graphql18.ObjectType)({
4418
- implements: BaseMessageOutput
4419
- })
4420
- ], TextMessageOutput);
4421
- var ActionExecutionMessageOutput = class {
4422
- name;
4423
- scope;
4424
- arguments;
4425
- parentMessageId;
4426
- };
4427
- __name(ActionExecutionMessageOutput, "ActionExecutionMessageOutput");
4428
- _ts_decorate17([
4429
- (0, import_type_graphql18.Field)(() => String),
4430
- _ts_metadata17("design:type", String)
4431
- ], ActionExecutionMessageOutput.prototype, "name", void 0);
4599
+ ], GenerateCopilotResponseInput.prototype, "threadId", void 0);
4432
4600
  _ts_decorate17([
4433
4601
  (0, import_type_graphql18.Field)(() => String, {
4434
- nullable: true,
4435
- deprecationReason: "This field will be removed in a future version"
4602
+ nullable: true
4436
4603
  }),
4437
4604
  _ts_metadata17("design:type", String)
4438
- ], ActionExecutionMessageOutput.prototype, "scope", void 0);
4605
+ ], GenerateCopilotResponseInput.prototype, "runId", void 0);
4439
4606
  _ts_decorate17([
4440
4607
  (0, import_type_graphql18.Field)(() => [
4441
- String
4608
+ MessageInput
4442
4609
  ]),
4443
4610
  _ts_metadata17("design:type", Array)
4444
- ], ActionExecutionMessageOutput.prototype, "arguments", void 0);
4611
+ ], GenerateCopilotResponseInput.prototype, "messages", void 0);
4445
4612
  _ts_decorate17([
4446
- (0, import_type_graphql18.Field)(() => String, {
4613
+ (0, import_type_graphql18.Field)(() => FrontendInput),
4614
+ _ts_metadata17("design:type", typeof FrontendInput === "undefined" ? Object : FrontendInput)
4615
+ ], GenerateCopilotResponseInput.prototype, "frontend", void 0);
4616
+ _ts_decorate17([
4617
+ (0, import_type_graphql18.Field)(() => CloudInput, {
4447
4618
  nullable: true
4448
4619
  }),
4449
- _ts_metadata17("design:type", String)
4450
- ], ActionExecutionMessageOutput.prototype, "parentMessageId", void 0);
4451
- ActionExecutionMessageOutput = _ts_decorate17([
4452
- (0, import_type_graphql18.ObjectType)({
4453
- implements: BaseMessageOutput
4454
- })
4455
- ], ActionExecutionMessageOutput);
4456
- var ResultMessageOutput = class {
4457
- actionExecutionId;
4458
- actionName;
4459
- result;
4460
- };
4461
- __name(ResultMessageOutput, "ResultMessageOutput");
4462
- _ts_decorate17([
4463
- (0, import_type_graphql18.Field)(() => String),
4464
- _ts_metadata17("design:type", String)
4465
- ], ResultMessageOutput.prototype, "actionExecutionId", void 0);
4466
- _ts_decorate17([
4467
- (0, import_type_graphql18.Field)(() => String),
4468
- _ts_metadata17("design:type", String)
4469
- ], ResultMessageOutput.prototype, "actionName", void 0);
4470
- _ts_decorate17([
4471
- (0, import_type_graphql18.Field)(() => String),
4472
- _ts_metadata17("design:type", String)
4473
- ], ResultMessageOutput.prototype, "result", void 0);
4474
- ResultMessageOutput = _ts_decorate17([
4475
- (0, import_type_graphql18.ObjectType)({
4476
- implements: BaseMessageOutput
4477
- })
4478
- ], ResultMessageOutput);
4479
- var AgentStateMessageOutput = class {
4480
- threadId;
4481
- agentName;
4482
- nodeName;
4483
- runId;
4484
- active;
4485
- role;
4486
- state;
4487
- running;
4488
- };
4489
- __name(AgentStateMessageOutput, "AgentStateMessageOutput");
4490
- _ts_decorate17([
4491
- (0, import_type_graphql18.Field)(() => String),
4492
- _ts_metadata17("design:type", String)
4493
- ], AgentStateMessageOutput.prototype, "threadId", void 0);
4494
- _ts_decorate17([
4495
- (0, import_type_graphql18.Field)(() => String),
4496
- _ts_metadata17("design:type", String)
4497
- ], AgentStateMessageOutput.prototype, "agentName", void 0);
4498
- _ts_decorate17([
4499
- (0, import_type_graphql18.Field)(() => String),
4500
- _ts_metadata17("design:type", String)
4501
- ], AgentStateMessageOutput.prototype, "nodeName", void 0);
4502
- _ts_decorate17([
4503
- (0, import_type_graphql18.Field)(() => String),
4504
- _ts_metadata17("design:type", String)
4505
- ], AgentStateMessageOutput.prototype, "runId", void 0);
4506
- _ts_decorate17([
4507
- (0, import_type_graphql18.Field)(() => Boolean),
4508
- _ts_metadata17("design:type", Boolean)
4509
- ], AgentStateMessageOutput.prototype, "active", void 0);
4510
- _ts_decorate17([
4511
- (0, import_type_graphql18.Field)(() => MessageRole),
4512
- _ts_metadata17("design:type", typeof MessageRole === "undefined" ? Object : MessageRole)
4513
- ], AgentStateMessageOutput.prototype, "role", void 0);
4514
- _ts_decorate17([
4515
- (0, import_type_graphql18.Field)(() => String),
4516
- _ts_metadata17("design:type", String)
4517
- ], AgentStateMessageOutput.prototype, "state", void 0);
4518
- _ts_decorate17([
4519
- (0, import_type_graphql18.Field)(() => Boolean),
4520
- _ts_metadata17("design:type", Boolean)
4521
- ], AgentStateMessageOutput.prototype, "running", void 0);
4522
- AgentStateMessageOutput = _ts_decorate17([
4523
- (0, import_type_graphql18.ObjectType)({
4524
- implements: BaseMessageOutput
4525
- })
4526
- ], AgentStateMessageOutput);
4527
- var CopilotResponse = class {
4528
- threadId;
4529
- status;
4530
- runId;
4531
- messages;
4532
- extensions;
4533
- metaEvents;
4534
- };
4535
- __name(CopilotResponse, "CopilotResponse");
4620
+ _ts_metadata17("design:type", typeof CloudInput === "undefined" ? Object : CloudInput)
4621
+ ], GenerateCopilotResponseInput.prototype, "cloud", void 0);
4536
4622
  _ts_decorate17([
4537
- (0, import_type_graphql18.Field)(() => String),
4538
- _ts_metadata17("design:type", String)
4539
- ], CopilotResponse.prototype, "threadId", void 0);
4623
+ (0, import_type_graphql18.Field)(() => ForwardedParametersInput, {
4624
+ nullable: true
4625
+ }),
4626
+ _ts_metadata17("design:type", typeof ForwardedParametersInput === "undefined" ? Object : ForwardedParametersInput)
4627
+ ], GenerateCopilotResponseInput.prototype, "forwardedParameters", void 0);
4540
4628
  _ts_decorate17([
4541
- (0, import_type_graphql18.Field)(() => ResponseStatusUnion),
4542
- _ts_metadata17("design:type", Object)
4543
- ], CopilotResponse.prototype, "status", void 0);
4629
+ (0, import_type_graphql18.Field)(() => AgentSessionInput, {
4630
+ nullable: true
4631
+ }),
4632
+ _ts_metadata17("design:type", typeof AgentSessionInput === "undefined" ? Object : AgentSessionInput)
4633
+ ], GenerateCopilotResponseInput.prototype, "agentSession", void 0);
4544
4634
  _ts_decorate17([
4545
- (0, import_type_graphql18.Field)({
4635
+ (0, import_type_graphql18.Field)(() => AgentStateInput, {
4546
4636
  nullable: true
4547
4637
  }),
4548
- _ts_metadata17("design:type", String)
4549
- ], CopilotResponse.prototype, "runId", void 0);
4638
+ _ts_metadata17("design:type", typeof AgentStateInput === "undefined" ? Object : AgentStateInput)
4639
+ ], GenerateCopilotResponseInput.prototype, "agentState", void 0);
4550
4640
  _ts_decorate17([
4551
4641
  (0, import_type_graphql18.Field)(() => [
4552
- BaseMessageOutput
4553
- ]),
4642
+ AgentStateInput
4643
+ ], {
4644
+ nullable: true
4645
+ }),
4554
4646
  _ts_metadata17("design:type", Array)
4555
- ], CopilotResponse.prototype, "messages", void 0);
4647
+ ], GenerateCopilotResponseInput.prototype, "agentStates", void 0);
4556
4648
  _ts_decorate17([
4557
- (0, import_type_graphql18.Field)(() => ExtensionsResponse, {
4649
+ (0, import_type_graphql18.Field)(() => ExtensionsInput, {
4558
4650
  nullable: true
4559
4651
  }),
4560
- _ts_metadata17("design:type", typeof ExtensionsResponse === "undefined" ? Object : ExtensionsResponse)
4561
- ], CopilotResponse.prototype, "extensions", void 0);
4652
+ _ts_metadata17("design:type", typeof ExtensionsInput === "undefined" ? Object : ExtensionsInput)
4653
+ ], GenerateCopilotResponseInput.prototype, "extensions", void 0);
4562
4654
  _ts_decorate17([
4563
4655
  (0, import_type_graphql18.Field)(() => [
4564
- BaseMetaEvent
4656
+ MetaEventInput
4565
4657
  ], {
4566
4658
  nullable: true
4567
4659
  }),
4568
4660
  _ts_metadata17("design:type", Array)
4569
- ], CopilotResponse.prototype, "metaEvents", void 0);
4570
- CopilotResponse = _ts_decorate17([
4571
- (0, import_type_graphql18.ObjectType)()
4572
- ], CopilotResponse);
4661
+ ], GenerateCopilotResponseInput.prototype, "metaEvents", void 0);
4662
+ GenerateCopilotResponseInput = _ts_decorate17([
4663
+ (0, import_type_graphql18.InputType)()
4664
+ ], GenerateCopilotResponseInput);
4573
4665
 
4574
4666
  // src/graphql/resolvers/copilot.resolver.ts
4575
4667
  var import_graphql_yoga = require("graphql-yoga");
@@ -4847,6 +4939,40 @@ var CopilotResolver = class {
4847
4939
  value: event.value
4848
4940
  }));
4849
4941
  break;
4942
+ case RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent:
4943
+ push((0, import_class_transformer3.plainToInstance)(CopilotKitLangGraphInterruptEvent, {
4944
+ type: event.type,
4945
+ name: event.name,
4946
+ data: {
4947
+ value: typeof event.data.value === "string" ? event.data.value : JSON.stringify(event.data.value),
4948
+ messages: event.data.messages.map((message) => {
4949
+ if (message.type === "TextMessage" || "content" in message && "role" in message) {
4950
+ return (0, import_class_transformer3.plainToInstance)(TextMessage, {
4951
+ id: message.id,
4952
+ createdAt: /* @__PURE__ */ new Date(),
4953
+ content: [
4954
+ message.content
4955
+ ],
4956
+ role: message.role,
4957
+ status: new SuccessMessageStatus()
4958
+ });
4959
+ }
4960
+ if ("arguments" in message) {
4961
+ return (0, import_class_transformer3.plainToInstance)(ActionExecutionMessage, {
4962
+ name: message.name,
4963
+ id: message.id,
4964
+ arguments: [
4965
+ JSON.stringify(message.arguments)
4966
+ ],
4967
+ createdAt: /* @__PURE__ */ new Date(),
4968
+ status: new SuccessMessageStatus()
4969
+ });
4970
+ }
4971
+ throw new Error("Unknown message in metaEvents copilot resolver");
4972
+ })
4973
+ }
4974
+ }));
4975
+ break;
4850
4976
  }
4851
4977
  },
4852
4978
  error: (err) => {