@copilotkit/runtime 1.50.0-beta.14 → 1.50.0-beta.15

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 (180) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{chunk-45RCC3ZS.mjs → chunk-BJEYMRDD.mjs} +2 -2
  3. package/dist/{chunk-OFSV5GET.mjs → chunk-DZV4ZIAR.mjs} +6 -17
  4. package/dist/chunk-DZV4ZIAR.mjs.map +1 -0
  5. package/dist/{chunk-AQG2SVCA.mjs → chunk-FMU55SEU.mjs} +2 -2
  6. package/dist/{chunk-DCEEHMLJ.mjs → chunk-SBCOROE4.mjs} +1 -16
  7. package/dist/chunk-SBCOROE4.mjs.map +1 -0
  8. package/dist/{chunk-ERUOA47O.mjs → chunk-TTUAEJLD.mjs} +2 -11
  9. package/dist/chunk-TTUAEJLD.mjs.map +1 -0
  10. package/dist/{chunk-4KES76K3.mjs → chunk-Z752VE75.mjs} +2 -2
  11. package/dist/graphql/types/converted/index.d.ts +1 -1
  12. package/dist/graphql/types/converted/index.js +110 -16
  13. package/dist/graphql/types/converted/index.js.map +1 -1
  14. package/dist/graphql/types/converted/index.mjs +3 -2
  15. package/dist/{groq-adapter-a6f5e9d2.d.ts → groq-adapter-50bc6e4a.d.ts} +1 -6
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{langserve-9fc76ce5.d.ts → langserve-74a52292.d.ts} +0 -1
  21. package/dist/lib/index.d.ts +59 -5
  22. package/dist/lib/index.js +779 -3678
  23. package/dist/lib/index.js.map +1 -1
  24. package/dist/lib/index.mjs +18 -20
  25. package/dist/lib/integrations/index.d.ts +9 -15
  26. package/dist/lib/integrations/index.js +187 -215
  27. package/dist/lib/integrations/index.js.map +1 -1
  28. package/dist/lib/integrations/index.mjs +7 -8
  29. package/dist/lib/integrations/nest/index.d.ts +6 -5
  30. package/dist/lib/integrations/nest/index.js +175 -197
  31. package/dist/lib/integrations/nest/index.js.map +1 -1
  32. package/dist/lib/integrations/nest/index.mjs +5 -6
  33. package/dist/lib/integrations/node-express/index.d.ts +6 -5
  34. package/dist/lib/integrations/node-express/index.js +175 -197
  35. package/dist/lib/integrations/node-express/index.js.map +1 -1
  36. package/dist/lib/integrations/node-express/index.mjs +5 -6
  37. package/dist/lib/integrations/node-http/index.d.ts +6 -5
  38. package/dist/lib/integrations/node-http/index.js +175 -197
  39. package/dist/lib/integrations/node-http/index.js.map +1 -1
  40. package/dist/lib/integrations/node-http/index.mjs +4 -5
  41. package/dist/service-adapters/index.d.ts +11 -7
  42. package/dist/service-adapters/index.js +21 -8
  43. package/dist/service-adapters/index.js.map +1 -1
  44. package/dist/service-adapters/index.mjs +4 -2
  45. package/dist/{shared-35c6eb04.d.ts → shared-f6d43ef8.d.ts} +1 -3
  46. package/package.json +2 -2
  47. package/src/lib/runtime/copilot-runtime.ts +1 -2
  48. package/src/lib/runtime/telemetry-agent-runner.ts +10 -5
  49. package/dist/chunk-27JKTS6P.mjs +0 -1704
  50. package/dist/chunk-27JKTS6P.mjs.map +0 -1
  51. package/dist/chunk-2GPTVDTO.mjs +0 -25
  52. package/dist/chunk-3AJVKDZX.mjs +0 -3097
  53. package/dist/chunk-3AJVKDZX.mjs.map +0 -1
  54. package/dist/chunk-4EHJ4XFJ.mjs +0 -25
  55. package/dist/chunk-4EHJ4XFJ.mjs.map +0 -1
  56. package/dist/chunk-4IANB4TC.mjs +0 -25
  57. package/dist/chunk-4IANB4TC.mjs.map +0 -1
  58. package/dist/chunk-4OGE3SLW.mjs +0 -3100
  59. package/dist/chunk-4OGE3SLW.mjs.map +0 -1
  60. package/dist/chunk-54YJBMCP.mjs +0 -3097
  61. package/dist/chunk-54YJBMCP.mjs.map +0 -1
  62. package/dist/chunk-6ER4SZYH.mjs +0 -74
  63. package/dist/chunk-6ER4SZYH.mjs.map +0 -1
  64. package/dist/chunk-6TNSLHVR.mjs +0 -74
  65. package/dist/chunk-6TNSLHVR.mjs.map +0 -1
  66. package/dist/chunk-7V4BK7TZ.mjs +0 -25
  67. package/dist/chunk-7V4BK7TZ.mjs.map +0 -1
  68. package/dist/chunk-7YZIEXD2.mjs +0 -74
  69. package/dist/chunk-7YZIEXD2.mjs.map +0 -1
  70. package/dist/chunk-A4XHOAFU.mjs +0 -25
  71. package/dist/chunk-A4XHOAFU.mjs.map +0 -1
  72. package/dist/chunk-A555KEAD.mjs +0 -6020
  73. package/dist/chunk-A555KEAD.mjs.map +0 -1
  74. package/dist/chunk-AF73TFTX.mjs +0 -74
  75. package/dist/chunk-AF73TFTX.mjs.map +0 -1
  76. package/dist/chunk-AQG2SVCA.mjs.map +0 -1
  77. package/dist/chunk-BJZHMXND.mjs +0 -74
  78. package/dist/chunk-BJZHMXND.mjs.map +0 -1
  79. package/dist/chunk-CB2OJXF6.mjs +0 -25
  80. package/dist/chunk-CB2OJXF6.mjs.map +0 -1
  81. package/dist/chunk-CEOMFPJU.mjs +0 -6020
  82. package/dist/chunk-CEOMFPJU.mjs.map +0 -1
  83. package/dist/chunk-CZVLR7CC.mjs +0 -175
  84. package/dist/chunk-CZVLR7CC.mjs.map +0 -1
  85. package/dist/chunk-DCEEHMLJ.mjs.map +0 -1
  86. package/dist/chunk-DE3CLKUG.mjs +0 -25
  87. package/dist/chunk-DE3CLKUG.mjs.map +0 -1
  88. package/dist/chunk-DTPRUTNV.mjs +0 -25
  89. package/dist/chunk-DTPRUTNV.mjs.map +0 -1
  90. package/dist/chunk-ERUOA47O.mjs.map +0 -1
  91. package/dist/chunk-ESSRC64W.mjs +0 -74
  92. package/dist/chunk-ESSRC64W.mjs.map +0 -1
  93. package/dist/chunk-GRAN6K6N.mjs +0 -25
  94. package/dist/chunk-GRAN6K6N.mjs.map +0 -1
  95. package/dist/chunk-I27F2UPA.mjs +0 -175
  96. package/dist/chunk-I27F2UPA.mjs.map +0 -1
  97. package/dist/chunk-IAZKTOQW.mjs +0 -25
  98. package/dist/chunk-IAZKTOQW.mjs.map +0 -1
  99. package/dist/chunk-J6XZ5MFB.mjs +0 -25
  100. package/dist/chunk-J6XZ5MFB.mjs.map +0 -1
  101. package/dist/chunk-JJ32MA4C.mjs +0 -73
  102. package/dist/chunk-JJ32MA4C.mjs.map +0 -1
  103. package/dist/chunk-JJY4ZTHQ.mjs +0 -25
  104. package/dist/chunk-JJY4ZTHQ.mjs.map +0 -1
  105. package/dist/chunk-KEYLBFU2.mjs +0 -3117
  106. package/dist/chunk-KEYLBFU2.mjs.map +0 -1
  107. package/dist/chunk-KQ53L4WZ.mjs +0 -3094
  108. package/dist/chunk-KQ53L4WZ.mjs.map +0 -1
  109. package/dist/chunk-KTELVQ67.mjs +0 -3098
  110. package/dist/chunk-KTELVQ67.mjs.map +0 -1
  111. package/dist/chunk-LPEPX6NH.mjs +0 -25
  112. package/dist/chunk-LPEPX6NH.mjs.map +0 -1
  113. package/dist/chunk-MDXE55DK.mjs +0 -3117
  114. package/dist/chunk-MDXE55DK.mjs.map +0 -1
  115. package/dist/chunk-MMFUVOXH.mjs +0 -73
  116. package/dist/chunk-MMFUVOXH.mjs.map +0 -1
  117. package/dist/chunk-N3Y4U66N.mjs +0 -253
  118. package/dist/chunk-N3Y4U66N.mjs.map +0 -1
  119. package/dist/chunk-O7UYB4MH.mjs +0 -25
  120. package/dist/chunk-O7UYB4MH.mjs.map +0 -1
  121. package/dist/chunk-OFNVQHNM.mjs +0 -3089
  122. package/dist/chunk-OFNVQHNM.mjs.map +0 -1
  123. package/dist/chunk-OFSV5GET.mjs.map +0 -1
  124. package/dist/chunk-OMRST67R.mjs +0 -25
  125. package/dist/chunk-OMRST67R.mjs.map +0 -1
  126. package/dist/chunk-PRZHE74A.mjs +0 -25
  127. package/dist/chunk-PRZHE74A.mjs.map +0 -1
  128. package/dist/chunk-PTYRVXXP.mjs +0 -80
  129. package/dist/chunk-PTYRVXXP.mjs.map +0 -1
  130. package/dist/chunk-R22B5CCO.mjs +0 -25
  131. package/dist/chunk-R22B5CCO.mjs.map +0 -1
  132. package/dist/chunk-SHBDMA63.mjs +0 -141
  133. package/dist/chunk-SHBDMA63.mjs.map +0 -1
  134. package/dist/chunk-SPVXBPRA.mjs +0 -74
  135. package/dist/chunk-SPVXBPRA.mjs.map +0 -1
  136. package/dist/chunk-T72G46ME.mjs +0 -25
  137. package/dist/chunk-T72G46ME.mjs.map +0 -1
  138. package/dist/chunk-TGELROPU.mjs +0 -25
  139. package/dist/chunk-TGELROPU.mjs.map +0 -1
  140. package/dist/chunk-UNX4IAAD.mjs +0 -25
  141. package/dist/chunk-UNX4IAAD.mjs.map +0 -1
  142. package/dist/chunk-V4DHVC7M.mjs +0 -3085
  143. package/dist/chunk-V4DHVC7M.mjs.map +0 -1
  144. package/dist/chunk-VVRFOB66.mjs +0 -25
  145. package/dist/chunk-VVRFOB66.mjs.map +0 -1
  146. package/dist/chunk-W6NVBYM6.mjs +0 -80
  147. package/dist/chunk-W6NVBYM6.mjs.map +0 -1
  148. package/dist/chunk-W7MBACGC.mjs +0 -74
  149. package/dist/chunk-W7MBACGC.mjs.map +0 -1
  150. package/dist/chunk-WMD4XZZS.mjs +0 -25
  151. package/dist/chunk-WMD4XZZS.mjs.map +0 -1
  152. package/dist/chunk-WX2ZNCRT.mjs +0 -74
  153. package/dist/chunk-WX2ZNCRT.mjs.map +0 -1
  154. package/dist/chunk-Y2Z62E2T.mjs +0 -74
  155. package/dist/chunk-Y2Z62E2T.mjs.map +0 -1
  156. package/dist/chunk-YO4I6RVI.mjs +0 -25
  157. package/dist/chunk-YO4I6RVI.mjs.map +0 -1
  158. package/dist/chunk-Z6Q5IW6I.mjs +0 -3098
  159. package/dist/chunk-Z6Q5IW6I.mjs.map +0 -1
  160. package/dist/chunk-Z726O3G2.mjs +0 -25
  161. package/dist/chunk-Z726O3G2.mjs.map +0 -1
  162. package/dist/chunk-ZE4SMZZR.mjs +0 -3097
  163. package/dist/chunk-ZE4SMZZR.mjs.map +0 -1
  164. package/dist/chunk-ZULZB33C.mjs +0 -73
  165. package/dist/chunk-ZULZB33C.mjs.map +0 -1
  166. package/dist/chunk-ZVRGXMY7.mjs +0 -25
  167. package/dist/chunk-ZVRGXMY7.mjs.map +0 -1
  168. package/dist/chunk-ZZ35WBYQ.mjs +0 -25
  169. package/dist/chunk-ZZ35WBYQ.mjs.map +0 -1
  170. package/dist/groq-adapter-540da9c3.d.ts +0 -331
  171. package/dist/groq-adapter-c8aec5c5.d.ts +0 -321
  172. package/dist/index-96b330da.d.ts +0 -119
  173. package/dist/langserve-0c6100e3.d.ts +0 -257
  174. package/dist/langserve-978d5790.d.ts +0 -243
  175. package/dist/shared-0a7346ce.d.ts +0 -466
  176. package/dist/shared-9ed1dc31.d.ts +0 -414
  177. package/dist/shared-da5708fe.d.ts +0 -449
  178. /package/dist/{chunk-45RCC3ZS.mjs.map → chunk-BJEYMRDD.mjs.map} +0 -0
  179. /package/dist/{chunk-2GPTVDTO.mjs.map → chunk-FMU55SEU.mjs.map} +0 -0
  180. /package/dist/{chunk-4KES76K3.mjs.map → chunk-Z752VE75.mjs.map} +0 -0
@@ -12,11 +12,11 @@ var __export = (target, all) => {
12
12
  for (var name in all)
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
- var __copyProps = (to, from3, except, desc) => {
16
- if (from3 && typeof from3 === "object" || typeof from3 === "function") {
17
- for (let key of __getOwnPropNames(from3))
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
18
  if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
20
  }
21
21
  return to;
22
22
  };
@@ -79,11 +79,14 @@ var require_package = __commonJS({
79
79
  tsconfig: "workspace:*",
80
80
  tsup: "^6.7.0",
81
81
  typescript: "^5.2.3",
82
+ vitest: "^3.2.4",
82
83
  "zod-to-json-schema": "^3.23.5"
83
84
  },
84
85
  dependencies: {
85
86
  "@anthropic-ai/sdk": "^0.57.0",
86
87
  "@copilotkit/shared": "workspace:*",
88
+ "@copilotkitnext/agent": "^0.0.17",
89
+ "@copilotkitnext/runtime": "^0.0.17",
87
90
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
88
91
  "@langchain/aws": "^0.1.9",
89
92
  "@langchain/community": "^0.3.29",
@@ -140,14 +143,14 @@ __export(nest_exports, {
140
143
  module.exports = __toCommonJS(nest_exports);
141
144
 
142
145
  // src/lib/integrations/node-http/index.ts
143
- var import_graphql_yoga2 = require("graphql-yoga");
146
+ var import_runtime32 = require("@copilotkitnext/runtime");
144
147
 
145
148
  // src/lib/integrations/shared.ts
146
149
  var import_type_graphql27 = require("type-graphql");
147
150
 
148
151
  // src/graphql/resolvers/copilot.resolver.ts
149
152
  var import_type_graphql21 = require("type-graphql");
150
- var import_rxjs3 = require("rxjs");
153
+ var import_rxjs2 = require("rxjs");
151
154
 
152
155
  // src/graphql/inputs/generate-copilot-response.input.ts
153
156
  var import_type_graphql19 = require("type-graphql");
@@ -159,11 +162,11 @@ var import_type_graphql3 = require("type-graphql");
159
162
  var import_type_graphql = require("type-graphql");
160
163
  var MessageRole;
161
164
  (function(MessageRole2) {
162
- MessageRole2["user"] = "user";
163
165
  MessageRole2["assistant"] = "assistant";
166
+ MessageRole2["developer"] = "developer";
164
167
  MessageRole2["system"] = "system";
165
168
  MessageRole2["tool"] = "tool";
166
- MessageRole2["developer"] = "developer";
169
+ MessageRole2["user"] = "user";
167
170
  })(MessageRole || (MessageRole = {}));
168
171
  var CopilotRequestType;
169
172
  (function(CopilotRequestType2) {
@@ -870,9 +873,10 @@ var MessageStatusCode;
870
873
  (0, import_type_graphql12.registerEnumType)(MessageStatusCode, {
871
874
  name: "MessageStatusCode"
872
875
  });
873
- var BaseMessageStatus = /* @__PURE__ */ __name(class BaseMessageStatus2 {
876
+ var BaseMessageStatus = class {
874
877
  code;
875
- }, "BaseMessageStatus");
878
+ };
879
+ __name(BaseMessageStatus, "BaseMessageStatus");
876
880
  _ts_decorate11([
877
881
  (0, import_type_graphql12.Field)(() => MessageStatusCode),
878
882
  _ts_metadata11("design:type", String)
@@ -1679,13 +1683,24 @@ GenerateCopilotResponseInput = _ts_decorate18([
1679
1683
  var import_graphql_yoga = require("graphql-yoga");
1680
1684
 
1681
1685
  // src/service-adapters/events.ts
1682
- var import_shared5 = require("@copilotkit/shared");
1683
- var import_class_transformer = require("class-transformer");
1684
- var import_rxjs2 = require("rxjs");
1686
+ var import_shared2 = require("@copilotkit/shared");
1687
+ var import_rxjs = require("rxjs");
1685
1688
 
1686
1689
  // src/graphql/types/converted/index.ts
1687
- var Message = class extends BaseMessageInput {
1690
+ var import_shared = require("@copilotkit/shared");
1691
+ var Message = class {
1688
1692
  type;
1693
+ id;
1694
+ createdAt;
1695
+ status;
1696
+ constructor(props) {
1697
+ props.id ?? (props.id = (0, import_shared.randomId)());
1698
+ props.status ?? (props.status = {
1699
+ code: MessageStatusCode.Success
1700
+ });
1701
+ props.createdAt ?? (props.createdAt = /* @__PURE__ */ new Date());
1702
+ Object.assign(this, props);
1703
+ }
1689
1704
  isTextMessage() {
1690
1705
  return this.type === "TextMessage";
1691
1706
  }
@@ -1704,10 +1719,14 @@ var Message = class extends BaseMessageInput {
1704
1719
  };
1705
1720
  __name(Message, "Message");
1706
1721
  var TextMessage = class extends Message {
1707
- type = "TextMessage";
1708
1722
  content;
1709
- role;
1710
1723
  parentMessageId;
1724
+ role;
1725
+ type = "TextMessage";
1726
+ constructor(props) {
1727
+ super(props);
1728
+ this.type = "TextMessage";
1729
+ }
1711
1730
  };
1712
1731
  __name(TextMessage, "TextMessage");
1713
1732
  var ActionExecutionMessage = class extends Message {
@@ -1800,17 +1819,80 @@ var AgentStateMessage = class extends Message {
1800
1819
  };
1801
1820
  __name(AgentStateMessage, "AgentStateMessage");
1802
1821
 
1803
- // src/lib/runtime/remote-actions.ts
1804
- var import_shared3 = require("@copilotkit/shared");
1822
+ // src/service-adapters/events.ts
1823
+ var RuntimeEventTypes;
1824
+ (function(RuntimeEventTypes2) {
1825
+ RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
1826
+ RuntimeEventTypes2["TextMessageContent"] = "TextMessageContent";
1827
+ RuntimeEventTypes2["TextMessageEnd"] = "TextMessageEnd";
1828
+ RuntimeEventTypes2["ActionExecutionStart"] = "ActionExecutionStart";
1829
+ RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
1830
+ RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
1831
+ RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
1832
+ RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
1833
+ RuntimeEventTypes2["MetaEvent"] = "MetaEvent";
1834
+ RuntimeEventTypes2["RunError"] = "RunError";
1835
+ })(RuntimeEventTypes || (RuntimeEventTypes = {}));
1836
+ var RuntimeMetaEventName;
1837
+ (function(RuntimeMetaEventName2) {
1838
+ RuntimeMetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1839
+ RuntimeMetaEventName2["LangGraphInterruptResumeEvent"] = "LangGraphInterruptResumeEvent";
1840
+ RuntimeMetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
1841
+ })(RuntimeMetaEventName || (RuntimeMetaEventName = {}));
1842
+
1843
+ // src/graphql/resolvers/copilot.resolver.ts
1844
+ var import_graphql_scalars2 = require("graphql-scalars");
1845
+ var import_class_transformer = require("class-transformer");
1846
+ var import_graphql = require("graphql");
1847
+
1848
+ // src/utils/failed-response-status-reasons.ts
1849
+ var GuardrailsValidationFailureResponse = class extends FailedResponseStatus {
1850
+ reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;
1851
+ constructor({ guardrailsReason }) {
1852
+ super();
1853
+ this.details = {
1854
+ guardrailsReason
1855
+ };
1856
+ }
1857
+ };
1858
+ __name(GuardrailsValidationFailureResponse, "GuardrailsValidationFailureResponse");
1859
+ var MessageStreamInterruptedResponse = class extends FailedResponseStatus {
1860
+ reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;
1861
+ constructor({ messageId }) {
1862
+ super();
1863
+ this.details = {
1864
+ messageId,
1865
+ description: "Check the message for mode details"
1866
+ };
1867
+ }
1868
+ };
1869
+ __name(MessageStreamInterruptedResponse, "MessageStreamInterruptedResponse");
1870
+ var UnknownErrorResponse = class extends FailedResponseStatus {
1871
+ reason = FailedResponseStatusReason.UNKNOWN_ERROR;
1872
+ constructor({ description, originalError }) {
1873
+ super();
1874
+ this.details = {
1875
+ description,
1876
+ originalError
1877
+ };
1878
+ }
1879
+ };
1880
+ __name(UnknownErrorResponse, "UnknownErrorResponse");
1805
1881
 
1806
1882
  // src/lib/telemetry-client.ts
1807
- var import_shared2 = require("@copilotkit/shared");
1883
+ var import_shared4 = require("@copilotkit/shared");
1808
1884
  var import_node_crypto = require("crypto");
1809
1885
 
1810
1886
  // src/lib/runtime/copilot-runtime.ts
1811
- var import_shared = require("@copilotkit/shared");
1812
- var import_rxjs = require("rxjs");
1813
- var import_langgraph_sdk = require("@langchain/langgraph-sdk");
1887
+ var import_shared3 = require("@copilotkit/shared");
1888
+ var import_runtime22 = require("@copilotkitnext/runtime");
1889
+
1890
+ // src/lib/runtime/types.ts
1891
+ var EndpointType;
1892
+ (function(EndpointType2) {
1893
+ EndpointType2["CopilotKit"] = "copilotKit";
1894
+ EndpointType2["LangGraphPlatform"] = "langgraph-platform";
1895
+ })(EndpointType || (EndpointType = {}));
1814
1896
 
1815
1897
  // src/agents/langgraph/events.ts
1816
1898
  var LangGraphEventTypes;
@@ -1845,6 +1927,7 @@ var CustomEventNames;
1845
1927
  })(CustomEventNames || (CustomEventNames = {}));
1846
1928
 
1847
1929
  // src/lib/runtime/copilot-runtime.ts
1930
+ var import_agent = require("@copilotkitnext/agent");
1848
1931
  function resolveEndpointType(endpoint) {
1849
1932
  if (!endpoint.type) {
1850
1933
  if ("deploymentUrl" in endpoint && "agents" in endpoint) {
@@ -1859,14 +1942,15 @@ __name(resolveEndpointType, "resolveEndpointType");
1859
1942
 
1860
1943
  // src/lib/telemetry-client.ts
1861
1944
  var packageJson = require_package();
1862
- var telemetryClient = new import_shared2.TelemetryClient({
1945
+ var telemetryClient = new import_shared4.TelemetryClient({
1863
1946
  packageName: packageJson.name,
1864
1947
  packageVersion: packageJson.version
1865
1948
  });
1866
1949
  function getRuntimeInstanceTelemetryInfo(options) {
1867
- var _a, _b;
1950
+ var _a, _b, _c, _d, _e;
1868
1951
  const runtime = options.runtime;
1869
- const endpointsInfo = runtime.remoteEndpointDefinitions.reduce((acc, endpoint) => {
1952
+ const remoteEndpoints = ((_a = runtime.params) == null ? void 0 : _a.remoteEndpoints) ?? [];
1953
+ const endpointsInfo = remoteEndpoints.reduce((acc, endpoint) => {
1870
1954
  let info = {
1871
1955
  ...acc
1872
1956
  };
@@ -1894,19 +1978,19 @@ function getRuntimeInstanceTelemetryInfo(options) {
1894
1978
  agentsAmount: null,
1895
1979
  hashedKey: null
1896
1980
  });
1897
- const publicApiKey = (_a = options.cloud) == null ? void 0 : _a.publicApiKey;
1981
+ const publicApiKey = (_b = options.cloud) == null ? void 0 : _b.publicApiKey;
1898
1982
  const apiKeyProvided = !!publicApiKey && publicApiKey.trim().length > 0;
1899
1983
  return {
1900
- actionsAmount: runtime.actions.length,
1901
- endpointsAmount: runtime.remoteEndpointDefinitions.length,
1984
+ actionsAmount: ((_d = (_c = runtime.params) == null ? void 0 : _c.actions) == null ? void 0 : _d.length) ?? 0,
1985
+ endpointsAmount: remoteEndpoints.length,
1902
1986
  endpointTypes: endpointsInfo.endpointTypes,
1903
- agentsAmount: endpointsInfo.agentsAmount,
1987
+ agentsAmount: Object.keys(runtime.instance.agents).length,
1904
1988
  hashedLgcKey: endpointsInfo.hashedKey,
1905
1989
  "cloud.api_key_provided": apiKeyProvided,
1906
1990
  ...apiKeyProvided ? {
1907
1991
  "cloud.public_api_key": publicApiKey
1908
1992
  } : {},
1909
- ...((_b = options.cloud) == null ? void 0 : _b.baseUrl) ? {
1993
+ ...((_e = options.cloud) == null ? void 0 : _e.baseUrl) ? {
1910
1994
  "cloud.base_url": options.cloud.baseUrl
1911
1995
  } : {}
1912
1996
  };
@@ -1914,76 +1998,8 @@ function getRuntimeInstanceTelemetryInfo(options) {
1914
1998
  __name(getRuntimeInstanceTelemetryInfo, "getRuntimeInstanceTelemetryInfo");
1915
1999
  var telemetry_client_default = telemetryClient;
1916
2000
 
1917
- // src/lib/runtime/remote-actions.ts
1918
- var import_shared4 = require("@copilotkit/shared");
1919
- var EndpointType;
1920
- (function(EndpointType2) {
1921
- EndpointType2["CopilotKit"] = "copilotKit";
1922
- EndpointType2["LangGraphPlatform"] = "langgraph-platform";
1923
- })(EndpointType || (EndpointType = {}));
1924
-
1925
- // src/service-adapters/events.ts
1926
- var RuntimeEventTypes;
1927
- (function(RuntimeEventTypes2) {
1928
- RuntimeEventTypes2["TextMessageStart"] = "TextMessageStart";
1929
- RuntimeEventTypes2["TextMessageContent"] = "TextMessageContent";
1930
- RuntimeEventTypes2["TextMessageEnd"] = "TextMessageEnd";
1931
- RuntimeEventTypes2["ActionExecutionStart"] = "ActionExecutionStart";
1932
- RuntimeEventTypes2["ActionExecutionArgs"] = "ActionExecutionArgs";
1933
- RuntimeEventTypes2["ActionExecutionEnd"] = "ActionExecutionEnd";
1934
- RuntimeEventTypes2["ActionExecutionResult"] = "ActionExecutionResult";
1935
- RuntimeEventTypes2["AgentStateMessage"] = "AgentStateMessage";
1936
- RuntimeEventTypes2["MetaEvent"] = "MetaEvent";
1937
- RuntimeEventTypes2["RunError"] = "RunError";
1938
- })(RuntimeEventTypes || (RuntimeEventTypes = {}));
1939
- var RuntimeMetaEventName;
1940
- (function(RuntimeMetaEventName2) {
1941
- RuntimeMetaEventName2["LangGraphInterruptEvent"] = "LangGraphInterruptEvent";
1942
- RuntimeMetaEventName2["LangGraphInterruptResumeEvent"] = "LangGraphInterruptResumeEvent";
1943
- RuntimeMetaEventName2["CopilotKitLangGraphInterruptEvent"] = "CopilotKitLangGraphInterruptEvent";
1944
- })(RuntimeMetaEventName || (RuntimeMetaEventName = {}));
1945
-
1946
- // src/graphql/resolvers/copilot.resolver.ts
1947
- var import_graphql_scalars2 = require("graphql-scalars");
1948
- var import_class_transformer2 = require("class-transformer");
1949
- var import_graphql = require("graphql");
1950
-
1951
- // src/utils/failed-response-status-reasons.ts
1952
- var GuardrailsValidationFailureResponse = class extends FailedResponseStatus {
1953
- reason = FailedResponseStatusReason.GUARDRAILS_VALIDATION_FAILED;
1954
- constructor({ guardrailsReason }) {
1955
- super();
1956
- this.details = {
1957
- guardrailsReason
1958
- };
1959
- }
1960
- };
1961
- __name(GuardrailsValidationFailureResponse, "GuardrailsValidationFailureResponse");
1962
- var MessageStreamInterruptedResponse = class extends FailedResponseStatus {
1963
- reason = FailedResponseStatusReason.MESSAGE_STREAM_INTERRUPTED;
1964
- constructor({ messageId }) {
1965
- super();
1966
- this.details = {
1967
- messageId,
1968
- description: "Check the message for mode details"
1969
- };
1970
- }
1971
- };
1972
- __name(MessageStreamInterruptedResponse, "MessageStreamInterruptedResponse");
1973
- var UnknownErrorResponse = class extends FailedResponseStatus {
1974
- reason = FailedResponseStatusReason.UNKNOWN_ERROR;
1975
- constructor({ description, originalError }) {
1976
- super();
1977
- this.details = {
1978
- description,
1979
- originalError
1980
- };
1981
- }
1982
- };
1983
- __name(UnknownErrorResponse, "UnknownErrorResponse");
1984
-
1985
2001
  // src/graphql/resolvers/copilot.resolver.ts
1986
- var import_shared6 = require("@copilotkit/shared");
2002
+ var import_shared5 = require("@copilotkit/shared");
1987
2003
 
1988
2004
  // src/graphql/types/agents-response.type.ts
1989
2005
  var import_type_graphql20 = require("type-graphql");
@@ -2039,7 +2055,7 @@ AgentsResponse = _ts_decorate19([
2039
2055
  ], AgentsResponse);
2040
2056
 
2041
2057
  // src/graphql/resolvers/copilot.resolver.ts
2042
- var import_shared7 = require("@copilotkit/shared");
2058
+ var import_shared6 = require("@copilotkit/shared");
2043
2059
  function _ts_decorate20(decorators, target, key, desc) {
2044
2060
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2045
2061
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2102,14 +2118,14 @@ var CopilotResolver = class {
2102
2118
  component: "CopilotResolver.availableAgents"
2103
2119
  });
2104
2120
  logger2.debug("Processing");
2105
- const agentsWithEndpoints = await ctx._copilotkit.runtime.discoverAgentsFromEndpoints(ctx);
2121
+ const agentsWithEndpoints = [];
2106
2122
  logger2.debug("Event source created, creating response");
2107
2123
  return {
2108
2124
  agents: agentsWithEndpoints.map(({ endpoint, ...agentWithoutEndpoint }) => agentWithoutEndpoint)
2109
2125
  };
2110
2126
  }
2111
2127
  async generateCopilotResponse(ctx, data, properties) {
2112
- var _a, _b, _c, _d, _e, _f, _g;
2128
+ var _a, _b, _c, _d;
2113
2129
  telemetry_client_default.capture("oss.runtime.copilot_request_created", {
2114
2130
  "cloud.guardrails.enabled": ((_a = data.cloud) == null ? void 0 : _a.guardrails) !== void 0,
2115
2131
  requestType: data.metadata.requestType,
@@ -2151,21 +2167,12 @@ var CopilotResolver = class {
2151
2167
  logger2.debug("Cloud configuration provided, checking for public API key in headers");
2152
2168
  if (!copilotCloudPublicApiKey) {
2153
2169
  logger2.error("Public API key not found in headers");
2154
- await copilotRuntime.errorGraphQLError({
2155
- message: "X-CopilotCloud-Public-API-Key header is required",
2156
- code: "MISSING_PUBLIC_API_KEY",
2157
- type: "GraphQLError"
2158
- }, {
2159
- operation: "generateCopilotResponse",
2160
- cloudConfigPresent: Boolean(data.cloud),
2161
- guardrailsEnabled: Boolean((_b = data.cloud) == null ? void 0 : _b.guardrails)
2162
- });
2163
2170
  throw new import_graphql.GraphQLError("X-CopilotCloud-Public-API-Key header is required");
2164
2171
  }
2165
2172
  if (process.env.COPILOT_CLOUD_BASE_URL) {
2166
2173
  copilotCloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL;
2167
- } else if ((_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl) {
2168
- copilotCloudBaseUrl = (_d = ctx._copilotkit.cloud) == null ? void 0 : _d.baseUrl;
2174
+ } else if ((_b = ctx._copilotkit.cloud) == null ? void 0 : _b.baseUrl) {
2175
+ copilotCloudBaseUrl = (_c = ctx._copilotkit.cloud) == null ? void 0 : _c.baseUrl;
2169
2176
  } else {
2170
2177
  copilotCloudBaseUrl = "https://api.cloud.copilotkit.ai";
2171
2178
  }
@@ -2174,9 +2181,9 @@ var CopilotResolver = class {
2174
2181
  });
2175
2182
  }
2176
2183
  logger2.debug("Setting up subjects");
2177
- const responseStatus$ = new import_rxjs3.ReplaySubject();
2178
- const interruptStreaming$ = new import_rxjs3.ReplaySubject();
2179
- const guardrailsResult$ = new import_rxjs3.ReplaySubject();
2184
+ const responseStatus$ = new import_rxjs2.ReplaySubject();
2185
+ const interruptStreaming$ = new import_rxjs2.ReplaySubject();
2186
+ const guardrailsResult$ = new import_rxjs2.ReplaySubject();
2180
2187
  let outputMessages = [];
2181
2188
  let resolveOutputMessagesPromise;
2182
2189
  let rejectOutputMessagesPromise;
@@ -2189,41 +2196,11 @@ var CopilotResolver = class {
2189
2196
  }
2190
2197
  logger2.debug("Processing");
2191
2198
  let runtimeResponse;
2192
- try {
2193
- runtimeResponse = await copilotRuntime.processRuntimeRequest({
2194
- serviceAdapter,
2195
- messages: data.messages,
2196
- actions: data.frontend.actions.filter((action) => action.available !== ActionInputAvailability.disabled),
2197
- threadId: data.threadId,
2198
- runId: data.runId,
2199
- publicApiKey: copilotCloudPublicApiKey,
2200
- outputMessagesPromise,
2201
- graphqlContext: ctx,
2202
- forwardedParameters: data.forwardedParameters,
2203
- agentSession: data.agentSession,
2204
- agentStates: data.agentStates,
2205
- url: data.frontend.url,
2206
- extensions: data.extensions,
2207
- metaEvents: data.metaEvents,
2208
- context: data.context
2209
- });
2210
- } catch (error) {
2211
- if ((0, import_shared7.isStructuredCopilotKitError)(error) || ((_e = error == null ? void 0 : error.extensions) == null ? void 0 : _e.visibility)) {
2212
- throw new import_graphql.GraphQLError(error.message || "Agent error occurred", {
2213
- extensions: {
2214
- ...error.extensions,
2215
- code: error.code || ((_f = error.extensions) == null ? void 0 : _f.code) || "AGENT_ERROR",
2216
- originalError: error
2217
- }
2218
- });
2219
- }
2220
- throw error;
2221
- }
2222
- const { eventSource, threadId = (0, import_shared6.randomId)(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = runtimeResponse;
2199
+ const { eventSource, threadId = (0, import_shared5.randomId)(), runId, serverSideActions, actionInputsWithoutAgents, extensions } = runtimeResponse;
2223
2200
  logger2.debug("Event source created, creating response");
2224
2201
  const eventStream = eventSource.processRuntimeEvents({
2225
2202
  serverSideActions,
2226
- guardrailsResult$: ((_g = data.cloud) == null ? void 0 : _g.guardrails) ? guardrailsResult$ : null,
2203
+ guardrailsResult$: ((_d = data.cloud) == null ? void 0 : _d.guardrails) ? guardrailsResult$ : null,
2227
2204
  actionInputsWithoutAgents: actionInputsWithoutAgents.filter(
2228
2205
  // TODO-AGENTS: do not exclude ALL server side actions
2229
2206
  (action) => !serverSideActions.find((serverSideAction) => serverSideAction.name == action.name)
@@ -2232,15 +2209,15 @@ var CopilotResolver = class {
2232
2209
  }).pipe(
2233
2210
  // shareReplay() ensures that later subscribers will see the whole stream instead of
2234
2211
  // just the events that were emitted after the subscriber was added.
2235
- (0, import_rxjs3.shareReplay)(),
2236
- (0, import_rxjs3.finalize)(() => {
2212
+ (0, import_rxjs2.shareReplay)(),
2213
+ (0, import_rxjs2.finalize)(() => {
2237
2214
  logger2.debug("Event stream finalized");
2238
2215
  })
2239
2216
  );
2240
2217
  const response = {
2241
2218
  threadId,
2242
2219
  runId,
2243
- status: (0, import_rxjs3.firstValueFrom)(responseStatus$),
2220
+ status: (0, import_rxjs2.firstValueFrom)(responseStatus$),
2244
2221
  extensions,
2245
2222
  metaEvents: new import_graphql_yoga.Repeater(async (push, stop) => {
2246
2223
  let eventStreamSubscription;
@@ -2251,7 +2228,7 @@ var CopilotResolver = class {
2251
2228
  }
2252
2229
  switch (event.name) {
2253
2230
  case LangGraphEventTypes.OnInterrupt:
2254
- push((0, import_class_transformer2.plainToInstance)(LangGraphInterruptEvent, {
2231
+ push((0, import_class_transformer.plainToInstance)(LangGraphInterruptEvent, {
2255
2232
  // @ts-ignore
2256
2233
  type: event.type,
2257
2234
  // @ts-ignore
@@ -2261,21 +2238,21 @@ var CopilotResolver = class {
2261
2238
  }));
2262
2239
  break;
2263
2240
  case RuntimeMetaEventName.LangGraphInterruptEvent:
2264
- push((0, import_class_transformer2.plainToInstance)(LangGraphInterruptEvent, {
2241
+ push((0, import_class_transformer.plainToInstance)(LangGraphInterruptEvent, {
2265
2242
  type: event.type,
2266
2243
  name: event.name,
2267
2244
  value: event.value
2268
2245
  }));
2269
2246
  break;
2270
2247
  case RuntimeMetaEventName.CopilotKitLangGraphInterruptEvent:
2271
- push((0, import_class_transformer2.plainToInstance)(CopilotKitLangGraphInterruptEvent, {
2248
+ push((0, import_class_transformer.plainToInstance)(CopilotKitLangGraphInterruptEvent, {
2272
2249
  type: event.type,
2273
2250
  name: event.name,
2274
2251
  data: {
2275
2252
  value: event.data.value,
2276
2253
  messages: event.data.messages.map((message) => {
2277
2254
  if (message.type === "TextMessage" || "content" in message && "role" in message) {
2278
- return (0, import_class_transformer2.plainToInstance)(TextMessage, {
2255
+ return (0, import_class_transformer.plainToInstance)(TextMessage, {
2279
2256
  id: message.id,
2280
2257
  createdAt: /* @__PURE__ */ new Date(),
2281
2258
  content: [
@@ -2286,7 +2263,7 @@ var CopilotResolver = class {
2286
2263
  });
2287
2264
  }
2288
2265
  if ("arguments" in message) {
2289
- return (0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
2266
+ return (0, import_class_transformer.plainToInstance)(ActionExecutionMessage, {
2290
2267
  name: message.name,
2291
2268
  id: message.id,
2292
2269
  arguments: [
@@ -2350,8 +2327,8 @@ var CopilotResolver = class {
2350
2327
  reason: `Interrupted due to Guardrails validation failure. Reason: ${result.reason}`
2351
2328
  });
2352
2329
  outputMessages = [
2353
- (0, import_class_transformer2.plainToInstance)(TextMessage, {
2354
- id: (0, import_shared6.randomId)(),
2330
+ (0, import_class_transformer.plainToInstance)(TextMessage, {
2331
+ id: (0, import_shared5.randomId)(),
2355
2332
  createdAt: /* @__PURE__ */ new Date(),
2356
2333
  content: result.reason,
2357
2334
  role: MessageRole.assistant
@@ -2384,30 +2361,30 @@ var CopilotResolver = class {
2384
2361
  case RuntimeEventTypes.TextMessageStart:
2385
2362
  const textMessageContentStream = eventStream.pipe(
2386
2363
  // skip until this message start event
2387
- (0, import_rxjs3.skipWhile)((e) => e !== event),
2364
+ (0, import_rxjs2.skipWhile)((e) => e !== event),
2388
2365
  // take until the message end event
2389
- (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
2366
+ (0, import_rxjs2.takeWhile)((e) => !(e.type === RuntimeEventTypes.TextMessageEnd && e.messageId == event.messageId)),
2390
2367
  // filter out any other message events or message ids
2391
- (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
2368
+ (0, import_rxjs2.filter)((e) => e.type == RuntimeEventTypes.TextMessageContent && e.messageId == event.messageId)
2392
2369
  );
2393
- const streamingTextStatus = new import_rxjs3.Subject();
2370
+ const streamingTextStatus = new import_rxjs2.Subject();
2394
2371
  const messageId = event.messageId;
2395
2372
  pushMessage({
2396
2373
  id: messageId,
2397
2374
  parentMessageId: event.parentMessageId,
2398
- status: (0, import_rxjs3.firstValueFrom)(streamingTextStatus),
2375
+ status: (0, import_rxjs2.firstValueFrom)(streamingTextStatus),
2399
2376
  createdAt: /* @__PURE__ */ new Date(),
2400
2377
  role: MessageRole.assistant,
2401
2378
  content: new import_graphql_yoga.Repeater(async (pushTextChunk, stopStreamingText) => {
2402
2379
  logger2.debug("Text message content repeater created");
2403
2380
  const textChunks = [];
2404
2381
  let textSubscription;
2405
- interruptStreaming$.pipe((0, import_rxjs3.shareReplay)(), (0, import_rxjs3.take)(1), (0, import_rxjs3.tap)(({ reason, messageId: messageId2 }) => {
2382
+ interruptStreaming$.pipe((0, import_rxjs2.shareReplay)(), (0, import_rxjs2.take)(1), (0, import_rxjs2.tap)(({ reason, messageId: messageId2 }) => {
2406
2383
  logger2.debug({
2407
2384
  reason,
2408
2385
  messageId: messageId2
2409
2386
  }, "Text streaming interrupted");
2410
- streamingTextStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
2387
+ streamingTextStatus.next((0, import_class_transformer.plainToInstance)(FailedMessageStatus, {
2411
2388
  reason
2412
2389
  }));
2413
2390
  responseStatus$.next(new MessageStreamInterruptedResponse({
@@ -2440,7 +2417,7 @@ var CopilotResolver = class {
2440
2417
  streamingTextStatus.next(new SuccessMessageStatus());
2441
2418
  stopStreamingText();
2442
2419
  textSubscription == null ? void 0 : textSubscription.unsubscribe();
2443
- outputMessages.push((0, import_class_transformer2.plainToInstance)(TextMessage, {
2420
+ outputMessages.push((0, import_class_transformer.plainToInstance)(TextMessage, {
2444
2421
  id: messageId,
2445
2422
  createdAt: /* @__PURE__ */ new Date(),
2446
2423
  content: textChunks.join(""),
@@ -2454,17 +2431,17 @@ var CopilotResolver = class {
2454
2431
  case RuntimeEventTypes.ActionExecutionStart:
2455
2432
  logger2.debug("Action execution start event received");
2456
2433
  const actionExecutionArgumentStream = eventStream.pipe(
2457
- (0, import_rxjs3.skipWhile)((e) => e !== event),
2434
+ (0, import_rxjs2.skipWhile)((e) => e !== event),
2458
2435
  // take until the action execution end event
2459
- (0, import_rxjs3.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
2436
+ (0, import_rxjs2.takeWhile)((e) => !(e.type === RuntimeEventTypes.ActionExecutionEnd && e.actionExecutionId == event.actionExecutionId)),
2460
2437
  // filter out any other action execution events or action execution ids
2461
- (0, import_rxjs3.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
2438
+ (0, import_rxjs2.filter)((e) => e.type == RuntimeEventTypes.ActionExecutionArgs && e.actionExecutionId == event.actionExecutionId)
2462
2439
  );
2463
- const streamingArgumentsStatus = new import_rxjs3.Subject();
2440
+ const streamingArgumentsStatus = new import_rxjs2.Subject();
2464
2441
  pushMessage({
2465
2442
  id: event.actionExecutionId,
2466
2443
  parentMessageId: event.parentMessageId,
2467
- status: (0, import_rxjs3.firstValueFrom)(streamingArgumentsStatus),
2444
+ status: (0, import_rxjs2.firstValueFrom)(streamingArgumentsStatus),
2468
2445
  createdAt: /* @__PURE__ */ new Date(),
2469
2446
  name: event.actionName,
2470
2447
  arguments: new import_graphql_yoga.Repeater(async (pushArgumentsChunk, stopStreamingArguments) => {
@@ -2482,7 +2459,7 @@ var CopilotResolver = class {
2482
2459
  logger2.error({
2483
2460
  err
2484
2461
  }, "Error in action execution argument stream");
2485
- streamingArgumentsStatus.next((0, import_class_transformer2.plainToInstance)(FailedMessageStatus, {
2462
+ streamingArgumentsStatus.next((0, import_class_transformer.plainToInstance)(FailedMessageStatus, {
2486
2463
  reason: "An unknown error has occurred in the action execution argument stream"
2487
2464
  }));
2488
2465
  stopStreamingArguments();
@@ -2493,7 +2470,7 @@ var CopilotResolver = class {
2493
2470
  streamingArgumentsStatus.next(new SuccessMessageStatus());
2494
2471
  stopStreamingArguments();
2495
2472
  actionExecutionArgumentSubscription == null ? void 0 : actionExecutionArgumentSubscription.unsubscribe();
2496
- outputMessages.push((0, import_class_transformer2.plainToInstance)(ActionExecutionMessage, {
2473
+ outputMessages.push((0, import_class_transformer.plainToInstance)(ActionExecutionMessage, {
2497
2474
  id: event.actionExecutionId,
2498
2475
  createdAt: /* @__PURE__ */ new Date(),
2499
2476
  name: event.actionName,
@@ -2516,7 +2493,7 @@ var CopilotResolver = class {
2516
2493
  actionName: event.actionName,
2517
2494
  result: event.result
2518
2495
  });
2519
- outputMessages.push((0, import_class_transformer2.plainToInstance)(ResultMessage, {
2496
+ outputMessages.push((0, import_class_transformer.plainToInstance)(ResultMessage, {
2520
2497
  id: "result-" + event.actionExecutionId,
2521
2498
  createdAt: /* @__PURE__ */ new Date(),
2522
2499
  actionExecutionId: event.actionExecutionId,
@@ -2529,7 +2506,7 @@ var CopilotResolver = class {
2529
2506
  event
2530
2507
  }, "Agent message event received");
2531
2508
  pushMessage({
2532
- id: (0, import_shared6.randomId)(),
2509
+ id: (0, import_shared5.randomId)(),
2533
2510
  status: new SuccessMessageStatus(),
2534
2511
  threadId: event.threadId,
2535
2512
  agentName: event.agentName,
@@ -2541,8 +2518,8 @@ var CopilotResolver = class {
2541
2518
  role: MessageRole.assistant,
2542
2519
  createdAt: /* @__PURE__ */ new Date()
2543
2520
  });
2544
- outputMessages.push((0, import_class_transformer2.plainToInstance)(AgentStateMessage, {
2545
- id: (0, import_shared6.randomId)(),
2521
+ outputMessages.push((0, import_class_transformer.plainToInstance)(AgentStateMessage, {
2522
+ id: (0, import_shared5.randomId)(),
2546
2523
  threadId: event.threadId,
2547
2524
  agentName: event.agentName,
2548
2525
  nodeName: event.nodeName,
@@ -2557,8 +2534,8 @@ var CopilotResolver = class {
2557
2534
  }
2558
2535
  },
2559
2536
  error: (err) => {
2560
- var _a3, _b2, _c2, _d2, _e2, _f2;
2561
- if (err instanceof import_shared7.CopilotKitError || err instanceof import_shared7.CopilotKitLowLevelError || err instanceof Error && err.name && err.name.includes("CopilotKit") || ((_a3 = err == null ? void 0 : err.extensions) == null ? void 0 : _a3.visibility)) {
2537
+ var _a3, _b2, _c2, _d2, _e, _f;
2538
+ if (err instanceof import_shared6.CopilotKitError || err instanceof import_shared6.CopilotKitLowLevelError || err instanceof Error && err.name && err.name.includes("CopilotKit") || ((_a3 = err == null ? void 0 : err.extensions) == null ? void 0 : _a3.visibility)) {
2562
2539
  responseStatus$.next(new UnknownErrorResponse({
2563
2540
  description: err.message || "Agent error occurred",
2564
2541
  // Include original error information for frontend to extract
@@ -2566,8 +2543,8 @@ var CopilotResolver = class {
2566
2543
  code: err.code || ((_b2 = err.extensions) == null ? void 0 : _b2.code),
2567
2544
  statusCode: err.statusCode || ((_c2 = err.extensions) == null ? void 0 : _c2.statusCode),
2568
2545
  severity: err.severity || ((_d2 = err.extensions) == null ? void 0 : _d2.severity),
2569
- visibility: err.visibility || ((_e2 = err.extensions) == null ? void 0 : _e2.visibility),
2570
- originalErrorType: err.originalErrorType || ((_f2 = err.extensions) == null ? void 0 : _f2.originalErrorType),
2546
+ visibility: err.visibility || ((_e = err.extensions) == null ? void 0 : _e.visibility),
2547
+ originalErrorType: err.originalErrorType || ((_f = err.extensions) == null ? void 0 : _f.originalErrorType),
2571
2548
  extensions: err.extensions
2572
2549
  }
2573
2550
  }));
@@ -2588,7 +2565,7 @@ var CopilotResolver = class {
2588
2565
  logger2.debug("Event stream completed");
2589
2566
  if ((_a3 = data.cloud) == null ? void 0 : _a3.guardrails) {
2590
2567
  logger2.debug("Guardrails is enabled, waiting for guardrails result");
2591
- await (0, import_rxjs3.firstValueFrom)(guardrailsResult$);
2568
+ await (0, import_rxjs2.firstValueFrom)(guardrailsResult$);
2592
2569
  }
2593
2570
  responseStatus$.next(new SuccessResponseStatus());
2594
2571
  eventStreamSubscription == null ? void 0 : eventStreamSubscription.unsubscribe();
@@ -2753,7 +2730,7 @@ LoadAgentStateInput = _ts_decorate22([
2753
2730
  ], LoadAgentStateInput);
2754
2731
 
2755
2732
  // src/graphql/resolvers/state.resolver.ts
2756
- var import_shared8 = require("@copilotkit/shared");
2733
+ var import_shared7 = require("@copilotkit/shared");
2757
2734
  function _ts_decorate23(decorators, target, key, desc) {
2758
2735
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2759
2736
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -2778,10 +2755,10 @@ function _ts_param2(paramIndex, decorator) {
2778
2755
  __name(_ts_param2, "_ts_param");
2779
2756
  var StateResolver = class {
2780
2757
  async loadAgentState(ctx, data) {
2781
- const agents = await ctx._copilotkit.runtime.getAllAgents(ctx);
2758
+ const agents = [];
2782
2759
  const hasAgent = agents.some((agent) => agent.name === data.agentName);
2783
2760
  if (!hasAgent) {
2784
- throw new import_shared8.CopilotKitAgentDiscoveryError({
2761
+ throw new import_shared7.CopilotKitAgentDiscoveryError({
2785
2762
  agentName: data.agentName,
2786
2763
  availableAgents: agents.map((a) => ({
2787
2764
  name: a.name,
@@ -2789,7 +2766,7 @@ var StateResolver = class {
2789
2766
  }))
2790
2767
  });
2791
2768
  }
2792
- const state = await ctx._copilotkit.runtime.loadAgentState(ctx, data.threadId, data.agentName);
2769
+ const state = {};
2793
2770
  return state;
2794
2771
  }
2795
2772
  };
@@ -2811,7 +2788,7 @@ StateResolver = _ts_decorate23([
2811
2788
 
2812
2789
  // src/lib/integrations/shared.ts
2813
2790
  var packageJson2 = __toESM(require_package());
2814
- var import_shared9 = require("@copilotkit/shared");
2791
+ var import_shared8 = require("@copilotkit/shared");
2815
2792
  var logger = createLogger();
2816
2793
  var addCustomHeaderPlugin = {
2817
2794
  onResponse({ response }) {
@@ -2877,11 +2854,11 @@ function getCommonConfig(options) {
2877
2854
  }
2878
2855
  });
2879
2856
  const userErrorCodes = [
2880
- import_shared9.CopilotKitErrorCode.AGENT_NOT_FOUND,
2881
- import_shared9.CopilotKitErrorCode.API_NOT_FOUND,
2882
- import_shared9.CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND,
2883
- import_shared9.CopilotKitErrorCode.CONFIGURATION_ERROR,
2884
- import_shared9.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR
2857
+ import_shared8.CopilotKitErrorCode.AGENT_NOT_FOUND,
2858
+ import_shared8.CopilotKitErrorCode.API_NOT_FOUND,
2859
+ import_shared8.CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND,
2860
+ import_shared8.CopilotKitErrorCode.CONFIGURATION_ERROR,
2861
+ import_shared8.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR
2885
2862
  ];
2886
2863
  return {
2887
2864
  logging: createLogger({
@@ -2904,7 +2881,7 @@ function getCommonConfig(options) {
2904
2881
  console.debug("User configuration error:", error.message);
2905
2882
  return error;
2906
2883
  }
2907
- if (originalError instanceof import_shared9.CopilotKitError && userErrorCodes.includes(originalError.code)) {
2884
+ if (originalError instanceof import_shared8.CopilotKitError && userErrorCodes.includes(originalError.code)) {
2908
2885
  console.debug("User configuration error:", error.message);
2909
2886
  return error;
2910
2887
  }
@@ -2933,11 +2910,12 @@ function copilotRuntimeNodeHttpEndpoint(options) {
2933
2910
  telemetry_client_default.capture("oss.runtime.instance_created", getRuntimeInstanceTelemetryInfo(options));
2934
2911
  const logger2 = commonConfig.logging;
2935
2912
  logger2.debug("Creating Node HTTP endpoint");
2936
- const yoga = (0, import_graphql_yoga2.createYoga)({
2937
- ...commonConfig,
2938
- graphqlEndpoint: options.endpoint
2913
+ const serviceAdapter = options.serviceAdapter;
2914
+ options.runtime.handleServiceAdapter(serviceAdapter);
2915
+ return (0, import_runtime32.createCopilotEndpoint)({
2916
+ runtime: options.runtime.instance,
2917
+ basePath: options.baseUrl
2939
2918
  });
2940
- return yoga;
2941
2919
  }
2942
2920
  __name(copilotRuntimeNodeHttpEndpoint, "copilotRuntimeNodeHttpEndpoint");
2943
2921