@copilotkit/shared 1.51.4 → 1.51.5-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  3. package/dist/constants/index.cjs +13 -0
  4. package/dist/constants/index.cjs.map +1 -0
  5. package/dist/constants/{index.d.ts → index.d.cts} +3 -1
  6. package/dist/constants/index.d.cts.map +1 -0
  7. package/dist/constants/index.d.mts +8 -0
  8. package/dist/constants/index.d.mts.map +1 -0
  9. package/dist/constants/index.mjs +8 -12
  10. package/dist/constants/index.mjs.map +1 -1
  11. package/dist/index.cjs +64 -0
  12. package/dist/index.cjs.map +1 -0
  13. package/dist/index.d.cts +22 -0
  14. package/dist/index.d.cts.map +1 -0
  15. package/dist/index.d.mts +23 -0
  16. package/dist/index.d.mts.map +1 -0
  17. package/dist/index.mjs +16 -123
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/index.umd.js +1017 -2
  20. package/dist/index.umd.js.map +1 -1
  21. package/dist/package.cjs +12 -0
  22. package/dist/package.cjs.map +1 -0
  23. package/dist/package.mjs +6 -0
  24. package/dist/package.mjs.map +1 -0
  25. package/dist/telemetry/events.d.cts +47 -0
  26. package/dist/telemetry/events.d.cts.map +1 -0
  27. package/dist/telemetry/events.d.mts +47 -0
  28. package/dist/telemetry/events.d.mts.map +1 -0
  29. package/dist/telemetry/index.d.mts +1 -0
  30. package/dist/telemetry/scarf-client.cjs +29 -0
  31. package/dist/telemetry/scarf-client.cjs.map +1 -0
  32. package/dist/telemetry/scarf-client.mjs +27 -5
  33. package/dist/telemetry/scarf-client.mjs.map +1 -1
  34. package/dist/telemetry/telemetry-client.cjs +87 -0
  35. package/dist/telemetry/telemetry-client.cjs.map +1 -0
  36. package/dist/telemetry/telemetry-client.d.cts +48 -0
  37. package/dist/telemetry/telemetry-client.d.cts.map +1 -0
  38. package/dist/telemetry/telemetry-client.d.mts +48 -0
  39. package/dist/telemetry/telemetry-client.d.mts.map +1 -0
  40. package/dist/telemetry/telemetry-client.mjs +83 -9
  41. package/dist/telemetry/telemetry-client.mjs.map +1 -1
  42. package/dist/telemetry/utils.cjs +16 -0
  43. package/dist/telemetry/utils.cjs.map +1 -0
  44. package/dist/telemetry/utils.mjs +14 -8
  45. package/dist/telemetry/utils.mjs.map +1 -1
  46. package/dist/types/{action.d.ts → action.d.cts} +32 -32
  47. package/dist/types/action.d.cts.map +1 -0
  48. package/dist/types/action.d.mts +59 -0
  49. package/dist/types/action.d.mts.map +1 -0
  50. package/dist/types/copilot-cloud-config.d.cts +15 -0
  51. package/dist/types/copilot-cloud-config.d.cts.map +1 -0
  52. package/dist/types/copilot-cloud-config.d.mts +15 -0
  53. package/dist/types/copilot-cloud-config.d.mts.map +1 -0
  54. package/dist/types/error.d.cts +57 -0
  55. package/dist/types/error.d.cts.map +1 -0
  56. package/dist/types/error.d.mts +57 -0
  57. package/dist/types/error.d.mts.map +1 -0
  58. package/dist/types/message.d.cts +31 -0
  59. package/dist/types/message.d.cts.map +1 -0
  60. package/dist/types/message.d.mts +31 -0
  61. package/dist/types/message.d.mts.map +1 -0
  62. package/dist/types/openai-assistant.d.cts +55 -0
  63. package/dist/types/openai-assistant.d.cts.map +1 -0
  64. package/dist/types/openai-assistant.d.mts +55 -0
  65. package/dist/types/openai-assistant.d.mts.map +1 -0
  66. package/dist/types/utility.d.cts +6 -0
  67. package/dist/types/utility.d.cts.map +1 -0
  68. package/dist/types/utility.d.mts +6 -0
  69. package/dist/types/utility.d.mts.map +1 -0
  70. package/dist/utils/conditions.cjs +32 -0
  71. package/dist/utils/conditions.cjs.map +1 -0
  72. package/dist/utils/{conditions.d.ts → conditions.d.cts} +16 -11
  73. package/dist/utils/conditions.d.cts.map +1 -0
  74. package/dist/utils/conditions.d.mts +31 -0
  75. package/dist/utils/conditions.d.mts.map +1 -0
  76. package/dist/utils/conditions.mjs +30 -6
  77. package/dist/utils/conditions.mjs.map +1 -1
  78. package/dist/utils/console-styling.cjs +91 -0
  79. package/dist/utils/console-styling.cjs.map +1 -0
  80. package/dist/utils/console-styling.d.cts +65 -0
  81. package/dist/utils/console-styling.d.cts.map +1 -0
  82. package/dist/utils/console-styling.d.mts +65 -0
  83. package/dist/utils/console-styling.d.mts.map +1 -0
  84. package/dist/utils/console-styling.mjs +83 -15
  85. package/dist/utils/console-styling.mjs.map +1 -1
  86. package/dist/utils/errors.cjs +439 -0
  87. package/dist/utils/errors.cjs.map +1 -0
  88. package/dist/utils/{errors.d.ts → errors.d.cts} +188 -156
  89. package/dist/utils/errors.d.cts.map +1 -0
  90. package/dist/utils/errors.d.mts +312 -0
  91. package/dist/utils/errors.d.mts.map +1 -0
  92. package/dist/utils/errors.mjs +416 -63
  93. package/dist/utils/errors.mjs.map +1 -1
  94. package/dist/utils/index.cjs +50 -0
  95. package/dist/utils/index.cjs.map +1 -0
  96. package/dist/utils/{index.d.ts → index.d.cts} +10 -11
  97. package/dist/utils/index.d.cts.map +1 -0
  98. package/dist/utils/index.d.mts +31 -0
  99. package/dist/utils/index.d.mts.map +1 -0
  100. package/dist/utils/index.mjs +47 -107
  101. package/dist/utils/index.mjs.map +1 -1
  102. package/dist/utils/json-schema.cjs +157 -0
  103. package/dist/utils/json-schema.cjs.map +1 -0
  104. package/dist/utils/{json-schema.d.ts → json-schema.d.cts} +19 -17
  105. package/dist/utils/json-schema.d.cts.map +1 -0
  106. package/dist/utils/json-schema.d.mts +36 -0
  107. package/dist/utils/json-schema.d.mts.map +1 -0
  108. package/dist/utils/json-schema.mjs +152 -12
  109. package/dist/utils/json-schema.mjs.map +1 -1
  110. package/dist/utils/random-id.cjs +38 -0
  111. package/dist/utils/random-id.cjs.map +1 -0
  112. package/dist/utils/{random-id.d.ts → random-id.d.cts} +3 -1
  113. package/dist/utils/random-id.d.cts.map +1 -0
  114. package/dist/utils/random-id.d.mts +8 -0
  115. package/dist/utils/random-id.d.mts.map +1 -0
  116. package/dist/utils/random-id.mjs +33 -12
  117. package/dist/utils/random-id.mjs.map +1 -1
  118. package/dist/utils/requests.cjs +58 -0
  119. package/dist/utils/requests.cjs.map +1 -0
  120. package/dist/utils/{requests.d.ts → requests.d.cts} +3 -1
  121. package/dist/utils/requests.d.cts.map +1 -0
  122. package/dist/utils/requests.d.mts +12 -0
  123. package/dist/utils/requests.d.mts.map +1 -0
  124. package/dist/utils/requests.mjs +56 -6
  125. package/dist/utils/requests.mjs.map +1 -1
  126. package/dist/utils/{types.d.ts → types.d.cts} +9 -7
  127. package/dist/utils/types.d.cts.map +1 -0
  128. package/dist/utils/types.d.mts +22 -0
  129. package/dist/utils/types.d.mts.map +1 -0
  130. package/package.json +17 -15
  131. package/src/types/message.ts +3 -1
  132. package/tsdown.config.ts +36 -0
  133. package/vitest.config.mjs +11 -0
  134. package/dist/chunk-2OJ5OJ2D.mjs +0 -1
  135. package/dist/chunk-2OJ5OJ2D.mjs.map +0 -1
  136. package/dist/chunk-3DK3UMRW.mjs +0 -217
  137. package/dist/chunk-3DK3UMRW.mjs.map +0 -1
  138. package/dist/chunk-6BE7PM2Q.mjs +0 -110
  139. package/dist/chunk-6BE7PM2Q.mjs.map +0 -1
  140. package/dist/chunk-BVVLGLFE.mjs +0 -435
  141. package/dist/chunk-BVVLGLFE.mjs.map +0 -1
  142. package/dist/chunk-FCCOSO5L.mjs +0 -1
  143. package/dist/chunk-FCCOSO5L.mjs.map +0 -1
  144. package/dist/chunk-GS5BLXSZ.mjs +0 -41
  145. package/dist/chunk-GS5BLXSZ.mjs.map +0 -1
  146. package/dist/chunk-HFJ7Q6KR.mjs +0 -38
  147. package/dist/chunk-HFJ7Q6KR.mjs.map +0 -1
  148. package/dist/chunk-IAFBVORQ.mjs +0 -1
  149. package/dist/chunk-IAFBVORQ.mjs.map +0 -1
  150. package/dist/chunk-M2RJI5BZ.mjs +0 -94
  151. package/dist/chunk-M2RJI5BZ.mjs.map +0 -1
  152. package/dist/chunk-MSUB6DGR.mjs +0 -1
  153. package/dist/chunk-MSUB6DGR.mjs.map +0 -1
  154. package/dist/chunk-N5EP5OD5.mjs +0 -1
  155. package/dist/chunk-N5EP5OD5.mjs.map +0 -1
  156. package/dist/chunk-NAFEBKSO.mjs +0 -1
  157. package/dist/chunk-NAFEBKSO.mjs.map +0 -1
  158. package/dist/chunk-P7STFMPO.mjs +0 -1
  159. package/dist/chunk-P7STFMPO.mjs.map +0 -1
  160. package/dist/chunk-UYARLQNA.mjs +0 -1
  161. package/dist/chunk-UYARLQNA.mjs.map +0 -1
  162. package/dist/chunk-V7BSERGI.mjs +0 -62
  163. package/dist/chunk-V7BSERGI.mjs.map +0 -1
  164. package/dist/chunk-WAZHII6M.mjs +0 -67
  165. package/dist/chunk-WAZHII6M.mjs.map +0 -1
  166. package/dist/chunk-XTHC46M2.mjs +0 -1
  167. package/dist/chunk-XTHC46M2.mjs.map +0 -1
  168. package/dist/chunk-ZIC6V6S5.mjs +0 -13
  169. package/dist/chunk-ZIC6V6S5.mjs.map +0 -1
  170. package/dist/chunk-ZUE2VR7D.mjs +0 -38
  171. package/dist/chunk-ZUE2VR7D.mjs.map +0 -1
  172. package/dist/constants/index.js +0 -40
  173. package/dist/constants/index.js.map +0 -1
  174. package/dist/index.d.ts +0 -25
  175. package/dist/index.js +0 -1138
  176. package/dist/index.js.map +0 -1
  177. package/dist/telemetry/events.d.ts +0 -45
  178. package/dist/telemetry/events.js +0 -19
  179. package/dist/telemetry/events.js.map +0 -1
  180. package/dist/telemetry/events.mjs +0 -1
  181. package/dist/telemetry/events.mjs.map +0 -1
  182. package/dist/telemetry/index.d.ts +0 -3
  183. package/dist/telemetry/index.js +0 -191
  184. package/dist/telemetry/index.js.map +0 -1
  185. package/dist/telemetry/index.mjs +0 -12
  186. package/dist/telemetry/index.mjs.map +0 -1
  187. package/dist/telemetry/scarf-client.d.ts +0 -7
  188. package/dist/telemetry/scarf-client.js +0 -59
  189. package/dist/telemetry/scarf-client.js.map +0 -1
  190. package/dist/telemetry/security-check.d.ts +0 -2
  191. package/dist/telemetry/security-check.js +0 -2
  192. package/dist/telemetry/security-check.js.map +0 -1
  193. package/dist/telemetry/security-check.mjs +0 -1
  194. package/dist/telemetry/security-check.mjs.map +0 -1
  195. package/dist/telemetry/telemetry-client.d.ts +0 -40
  196. package/dist/telemetry/telemetry-client.js +0 -189
  197. package/dist/telemetry/telemetry-client.js.map +0 -1
  198. package/dist/telemetry/utils.d.ts +0 -8
  199. package/dist/telemetry/utils.js +0 -73
  200. package/dist/telemetry/utils.js.map +0 -1
  201. package/dist/types/action.js +0 -19
  202. package/dist/types/action.js.map +0 -1
  203. package/dist/types/action.mjs +0 -2
  204. package/dist/types/action.mjs.map +0 -1
  205. package/dist/types/copilot-cloud-config.d.ts +0 -13
  206. package/dist/types/copilot-cloud-config.js +0 -19
  207. package/dist/types/copilot-cloud-config.js.map +0 -1
  208. package/dist/types/copilot-cloud-config.mjs +0 -2
  209. package/dist/types/copilot-cloud-config.mjs.map +0 -1
  210. package/dist/types/error.d.ts +0 -55
  211. package/dist/types/error.js +0 -19
  212. package/dist/types/error.js.map +0 -1
  213. package/dist/types/error.mjs +0 -2
  214. package/dist/types/error.mjs.map +0 -1
  215. package/dist/types/index.d.ts +0 -7
  216. package/dist/types/index.js +0 -19
  217. package/dist/types/index.js.map +0 -1
  218. package/dist/types/index.mjs +0 -8
  219. package/dist/types/index.mjs.map +0 -1
  220. package/dist/types/message.d.ts +0 -28
  221. package/dist/types/message.js +0 -19
  222. package/dist/types/message.js.map +0 -1
  223. package/dist/types/message.mjs +0 -2
  224. package/dist/types/message.mjs.map +0 -1
  225. package/dist/types/openai-assistant.d.ts +0 -53
  226. package/dist/types/openai-assistant.js +0 -19
  227. package/dist/types/openai-assistant.js.map +0 -1
  228. package/dist/types/openai-assistant.mjs +0 -2
  229. package/dist/types/openai-assistant.mjs.map +0 -1
  230. package/dist/types/utility.d.ts +0 -6
  231. package/dist/types/utility.js +0 -19
  232. package/dist/types/utility.js.map +0 -1
  233. package/dist/types/utility.mjs +0 -2
  234. package/dist/types/utility.mjs.map +0 -1
  235. package/dist/utils/conditions.js +0 -86
  236. package/dist/utils/conditions.js.map +0 -1
  237. package/dist/utils/console-styling.d.ts +0 -84
  238. package/dist/utils/console-styling.js +0 -123
  239. package/dist/utils/console-styling.js.map +0 -1
  240. package/dist/utils/errors.js +0 -452
  241. package/dist/utils/errors.js.map +0 -1
  242. package/dist/utils/index.js +0 -964
  243. package/dist/utils/index.js.map +0 -1
  244. package/dist/utils/json-schema.js +0 -244
  245. package/dist/utils/json-schema.js.map +0 -1
  246. package/dist/utils/random-id.js +0 -68
  247. package/dist/utils/random-id.js.map +0 -1
  248. package/dist/utils/requests.js +0 -91
  249. package/dist/utils/requests.js.map +0 -1
  250. package/dist/utils/types.js +0 -19
  251. package/dist/utils/types.js.map +0 -1
  252. package/dist/utils/types.mjs +0 -2
  253. package/dist/utils/types.mjs.map +0 -1
  254. package/jest.config.js +0 -5
  255. package/rollup.config.mjs +0 -54
  256. package/tsup.config.ts +0 -15
@@ -1,452 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/utils/errors.ts
21
- var errors_exports = {};
22
- __export(errors_exports, {
23
- BANNER_ERROR_NAMES: () => BANNER_ERROR_NAMES,
24
- COPILOT_CLOUD_ERROR_NAMES: () => COPILOT_CLOUD_ERROR_NAMES,
25
- ConfigurationError: () => ConfigurationError,
26
- CopilotKitAgentDiscoveryError: () => CopilotKitAgentDiscoveryError,
27
- CopilotKitApiDiscoveryError: () => CopilotKitApiDiscoveryError,
28
- CopilotKitError: () => CopilotKitError,
29
- CopilotKitErrorCode: () => CopilotKitErrorCode,
30
- CopilotKitLowLevelError: () => CopilotKitLowLevelError,
31
- CopilotKitMisuseError: () => CopilotKitMisuseError,
32
- CopilotKitRemoteEndpointDiscoveryError: () => CopilotKitRemoteEndpointDiscoveryError,
33
- CopilotKitVersionMismatchError: () => CopilotKitVersionMismatchError,
34
- ERROR_CONFIG: () => ERROR_CONFIG,
35
- ERROR_NAMES: () => ERROR_NAMES,
36
- ErrorVisibility: () => ErrorVisibility,
37
- MissingPublicApiKeyError: () => MissingPublicApiKeyError,
38
- ResolvedCopilotKitError: () => ResolvedCopilotKitError,
39
- Severity: () => Severity,
40
- UpgradeRequiredError: () => UpgradeRequiredError,
41
- ensureStructuredError: () => ensureStructuredError,
42
- getPossibleVersionMismatch: () => getPossibleVersionMismatch,
43
- isStructuredCopilotKitError: () => isStructuredCopilotKitError
44
- });
45
- module.exports = __toCommonJS(errors_exports);
46
- var import_graphql = require("graphql");
47
-
48
- // package.json
49
- var version = "1.51.4";
50
-
51
- // src/index.ts
52
- var COPILOTKIT_VERSION = version;
53
-
54
- // src/utils/errors.ts
55
- var Severity = /* @__PURE__ */ ((Severity2) => {
56
- Severity2["CRITICAL"] = "critical";
57
- Severity2["WARNING"] = "warning";
58
- Severity2["INFO"] = "info";
59
- return Severity2;
60
- })(Severity || {});
61
- var ErrorVisibility = /* @__PURE__ */ ((ErrorVisibility2) => {
62
- ErrorVisibility2["BANNER"] = "banner";
63
- ErrorVisibility2["TOAST"] = "toast";
64
- ErrorVisibility2["SILENT"] = "silent";
65
- ErrorVisibility2["DEV_ONLY"] = "dev_only";
66
- return ErrorVisibility2;
67
- })(ErrorVisibility || {});
68
- var ERROR_NAMES = {
69
- COPILOT_ERROR: "CopilotError",
70
- COPILOT_API_DISCOVERY_ERROR: "CopilotApiDiscoveryError",
71
- COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR: "CopilotKitRemoteEndpointDiscoveryError",
72
- COPILOT_KIT_AGENT_DISCOVERY_ERROR: "CopilotKitAgentDiscoveryError",
73
- COPILOT_KIT_LOW_LEVEL_ERROR: "CopilotKitLowLevelError",
74
- COPILOT_KIT_VERSION_MISMATCH_ERROR: "CopilotKitVersionMismatchError",
75
- RESOLVED_COPILOT_KIT_ERROR: "ResolvedCopilotKitError",
76
- CONFIGURATION_ERROR: "ConfigurationError",
77
- MISSING_PUBLIC_API_KEY_ERROR: "MissingPublicApiKeyError",
78
- UPGRADE_REQUIRED_ERROR: "UpgradeRequiredError"
79
- };
80
- var BANNER_ERROR_NAMES = [
81
- ERROR_NAMES.CONFIGURATION_ERROR,
82
- ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,
83
- ERROR_NAMES.UPGRADE_REQUIRED_ERROR,
84
- ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,
85
- ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,
86
- ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR
87
- ];
88
- var COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;
89
- var CopilotKitErrorCode = /* @__PURE__ */ ((CopilotKitErrorCode2) => {
90
- CopilotKitErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
91
- CopilotKitErrorCode2["NOT_FOUND"] = "NOT_FOUND";
92
- CopilotKitErrorCode2["AGENT_NOT_FOUND"] = "AGENT_NOT_FOUND";
93
- CopilotKitErrorCode2["API_NOT_FOUND"] = "API_NOT_FOUND";
94
- CopilotKitErrorCode2["REMOTE_ENDPOINT_NOT_FOUND"] = "REMOTE_ENDPOINT_NOT_FOUND";
95
- CopilotKitErrorCode2["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
96
- CopilotKitErrorCode2["MISUSE"] = "MISUSE";
97
- CopilotKitErrorCode2["UNKNOWN"] = "UNKNOWN";
98
- CopilotKitErrorCode2["VERSION_MISMATCH"] = "VERSION_MISMATCH";
99
- CopilotKitErrorCode2["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
100
- CopilotKitErrorCode2["MISSING_PUBLIC_API_KEY_ERROR"] = "MISSING_PUBLIC_API_KEY_ERROR";
101
- CopilotKitErrorCode2["UPGRADE_REQUIRED_ERROR"] = "UPGRADE_REQUIRED_ERROR";
102
- return CopilotKitErrorCode2;
103
- })(CopilotKitErrorCode || {});
104
- var BASE_URL = "https://docs.copilotkit.ai";
105
- var getSeeMoreMarkdown = (link) => `See more: [${link}](${link})`;
106
- var ERROR_CONFIG = {
107
- ["NETWORK_ERROR" /* NETWORK_ERROR */]: {
108
- statusCode: 503,
109
- troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,
110
- visibility: "banner" /* BANNER */,
111
- severity: "critical" /* CRITICAL */
112
- },
113
- ["NOT_FOUND" /* NOT_FOUND */]: {
114
- statusCode: 404,
115
- troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,
116
- visibility: "banner" /* BANNER */,
117
- severity: "critical" /* CRITICAL */
118
- },
119
- ["AGENT_NOT_FOUND" /* AGENT_NOT_FOUND */]: {
120
- statusCode: 500,
121
- troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,
122
- visibility: "banner" /* BANNER */,
123
- severity: "critical" /* CRITICAL */
124
- },
125
- ["API_NOT_FOUND" /* API_NOT_FOUND */]: {
126
- statusCode: 404,
127
- troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,
128
- visibility: "banner" /* BANNER */,
129
- severity: "critical" /* CRITICAL */
130
- },
131
- ["REMOTE_ENDPOINT_NOT_FOUND" /* REMOTE_ENDPOINT_NOT_FOUND */]: {
132
- statusCode: 404,
133
- troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,
134
- visibility: "banner" /* BANNER */,
135
- severity: "critical" /* CRITICAL */
136
- },
137
- ["AUTHENTICATION_ERROR" /* AUTHENTICATION_ERROR */]: {
138
- statusCode: 401,
139
- troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#authentication-errors`,
140
- visibility: "banner" /* BANNER */,
141
- severity: "critical" /* CRITICAL */
142
- },
143
- ["MISUSE" /* MISUSE */]: {
144
- statusCode: 400,
145
- troubleshootingUrl: null,
146
- visibility: "dev_only" /* DEV_ONLY */,
147
- severity: "warning" /* WARNING */
148
- },
149
- ["UNKNOWN" /* UNKNOWN */]: {
150
- statusCode: 500,
151
- visibility: "toast" /* TOAST */,
152
- severity: "critical" /* CRITICAL */
153
- },
154
- ["CONFIGURATION_ERROR" /* CONFIGURATION_ERROR */]: {
155
- statusCode: 400,
156
- troubleshootingUrl: null,
157
- severity: "warning" /* WARNING */,
158
- visibility: "banner" /* BANNER */
159
- },
160
- ["MISSING_PUBLIC_API_KEY_ERROR" /* MISSING_PUBLIC_API_KEY_ERROR */]: {
161
- statusCode: 400,
162
- troubleshootingUrl: null,
163
- severity: "critical" /* CRITICAL */,
164
- visibility: "banner" /* BANNER */
165
- },
166
- ["UPGRADE_REQUIRED_ERROR" /* UPGRADE_REQUIRED_ERROR */]: {
167
- statusCode: 402,
168
- troubleshootingUrl: null,
169
- severity: "warning" /* WARNING */,
170
- visibility: "banner" /* BANNER */
171
- },
172
- ["VERSION_MISMATCH" /* VERSION_MISMATCH */]: {
173
- statusCode: 400,
174
- troubleshootingUrl: null,
175
- visibility: "dev_only" /* DEV_ONLY */,
176
- severity: "info" /* INFO */
177
- }
178
- };
179
- var CopilotKitError = class extends import_graphql.GraphQLError {
180
- constructor({
181
- message = "Unknown error occurred",
182
- code,
183
- severity,
184
- visibility
185
- }) {
186
- const name = ERROR_NAMES.COPILOT_ERROR;
187
- const config = ERROR_CONFIG[code];
188
- const { statusCode } = config;
189
- const resolvedVisibility = visibility ?? config.visibility ?? "toast" /* TOAST */;
190
- const resolvedSeverity = severity ?? ("severity" in config ? config.severity : void 0);
191
- super(message, {
192
- extensions: {
193
- name,
194
- statusCode,
195
- code,
196
- visibility: resolvedVisibility,
197
- severity: resolvedSeverity,
198
- troubleshootingUrl: "troubleshootingUrl" in config ? config.troubleshootingUrl : null,
199
- originalError: {
200
- message,
201
- stack: new Error().stack
202
- }
203
- }
204
- });
205
- this.code = code;
206
- this.name = name;
207
- this.statusCode = statusCode;
208
- this.severity = resolvedSeverity;
209
- this.visibility = resolvedVisibility;
210
- }
211
- };
212
- var CopilotKitMisuseError = class extends CopilotKitError {
213
- constructor({
214
- message,
215
- code = "MISUSE" /* MISUSE */
216
- }) {
217
- const docsLink = "troubleshootingUrl" in ERROR_CONFIG[code] && ERROR_CONFIG[code].troubleshootingUrl ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl) : null;
218
- const finalMessage = docsLink ? `${message}.
219
-
220
- ${docsLink}` : message;
221
- super({ message: finalMessage, code });
222
- this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;
223
- }
224
- };
225
- var getVersionMismatchErrorMessage = ({
226
- reactCoreVersion,
227
- runtimeVersion,
228
- runtimeClientGqlVersion
229
- }) => `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? ""} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;
230
- var CopilotKitVersionMismatchError = class extends CopilotKitError {
231
- constructor({
232
- reactCoreVersion,
233
- runtimeVersion,
234
- runtimeClientGqlVersion
235
- }) {
236
- const code = "VERSION_MISMATCH" /* VERSION_MISMATCH */;
237
- super({
238
- message: getVersionMismatchErrorMessage({
239
- reactCoreVersion,
240
- runtimeVersion,
241
- runtimeClientGqlVersion
242
- }),
243
- code
244
- });
245
- this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;
246
- }
247
- };
248
- var CopilotKitApiDiscoveryError = class extends CopilotKitError {
249
- constructor(params = {}) {
250
- const url = params.url ?? "";
251
- let operationSuffix = "";
252
- if (url == null ? void 0 : url.includes("/info"))
253
- operationSuffix = `when fetching CopilotKit info`;
254
- else if (url.includes("/actions/execute"))
255
- operationSuffix = `when attempting to execute actions.`;
256
- else if (url.includes("/agents/state"))
257
- operationSuffix = `when attempting to get agent state.`;
258
- else if (url.includes("/agents/execute"))
259
- operationSuffix = `when attempting to execute agent(s).`;
260
- const message = params.message ?? (params.url ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}` : `Failed to find CopilotKit API endpoint.`);
261
- const code = params.code ?? "API_NOT_FOUND" /* API_NOT_FOUND */;
262
- const errorMessage = `${message}.
263
-
264
- ${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;
265
- super({ message: errorMessage, code });
266
- this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;
267
- }
268
- };
269
- var CopilotKitRemoteEndpointDiscoveryError = class extends CopilotKitApiDiscoveryError {
270
- constructor(params) {
271
- const message = (params == null ? void 0 : params.message) ?? ((params == null ? void 0 : params.url) ? `Failed to find or contact remote endpoint at url ${params.url}` : "Failed to find or contact remote endpoint");
272
- const code = "REMOTE_ENDPOINT_NOT_FOUND" /* REMOTE_ENDPOINT_NOT_FOUND */;
273
- super({ message, code });
274
- this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;
275
- }
276
- };
277
- var CopilotKitAgentDiscoveryError = class extends CopilotKitError {
278
- constructor(params) {
279
- const { agentName, availableAgents } = params;
280
- const code = "AGENT_NOT_FOUND" /* AGENT_NOT_FOUND */;
281
- const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);
282
- let message;
283
- if (availableAgents.length) {
284
- const agentList = availableAgents.map((agent) => agent.name).join(", ");
285
- if (agentName) {
286
- message = `Agent '${agentName}' was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.
287
-
288
- ${seeMore}`;
289
- } else {
290
- message = `The requested agent was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.
291
-
292
- ${seeMore}`;
293
- }
294
- } else {
295
- message = `${agentName ? `Agent '${agentName}'` : "The requested agent"} was not found. Please set up at least one agent before proceeding. ${seeMore}`;
296
- }
297
- super({ message, code });
298
- this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;
299
- }
300
- };
301
- var CopilotKitLowLevelError = class extends CopilotKitError {
302
- constructor({
303
- error,
304
- url,
305
- message
306
- }) {
307
- let code = "NETWORK_ERROR" /* NETWORK_ERROR */;
308
- const errorCode = error.code;
309
- const errorMessage = message ?? resolveLowLevelErrorMessage({ errorCode, url });
310
- super({ message: errorMessage, code });
311
- this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;
312
- }
313
- };
314
- var ResolvedCopilotKitError = class extends CopilotKitError {
315
- constructor({
316
- status,
317
- message,
318
- code,
319
- isRemoteEndpoint,
320
- url
321
- }) {
322
- let resolvedCode = code;
323
- if (!resolvedCode) {
324
- switch (status) {
325
- case 400:
326
- throw new CopilotKitApiDiscoveryError({ message, url });
327
- case 404:
328
- throw isRemoteEndpoint ? new CopilotKitRemoteEndpointDiscoveryError({ message, url }) : new CopilotKitApiDiscoveryError({ message, url });
329
- default:
330
- resolvedCode = "UNKNOWN" /* UNKNOWN */;
331
- break;
332
- }
333
- }
334
- super({ message, code: resolvedCode });
335
- this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;
336
- }
337
- };
338
- var ConfigurationError = class extends CopilotKitError {
339
- constructor(message) {
340
- super({ message, code: "CONFIGURATION_ERROR" /* CONFIGURATION_ERROR */ });
341
- this.name = ERROR_NAMES.CONFIGURATION_ERROR;
342
- this.severity = "warning" /* WARNING */;
343
- }
344
- };
345
- var MissingPublicApiKeyError = class extends ConfigurationError {
346
- constructor(message) {
347
- super(message);
348
- this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;
349
- this.severity = "critical" /* CRITICAL */;
350
- }
351
- };
352
- var UpgradeRequiredError = class extends ConfigurationError {
353
- constructor(message) {
354
- super(message);
355
- this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;
356
- this.severity = "warning" /* WARNING */;
357
- }
358
- };
359
- function isStructuredCopilotKitError(error) {
360
- var _a;
361
- return error instanceof CopilotKitError || error instanceof CopilotKitLowLevelError || (error == null ? void 0 : error.name) && error.name.includes("CopilotKit") || ((_a = error == null ? void 0 : error.extensions) == null ? void 0 : _a.code) !== void 0;
362
- }
363
- function ensureStructuredError(error, converter) {
364
- return isStructuredCopilotKitError(error) ? error : converter(error);
365
- }
366
- async function getPossibleVersionMismatch({
367
- runtimeVersion,
368
- runtimeClientGqlVersion
369
- }) {
370
- if (!runtimeVersion || runtimeVersion === "" || !runtimeClientGqlVersion)
371
- return;
372
- if (COPILOTKIT_VERSION !== runtimeVersion || COPILOTKIT_VERSION !== runtimeClientGqlVersion || runtimeVersion !== runtimeClientGqlVersion) {
373
- return {
374
- runtimeVersion,
375
- runtimeClientGqlVersion,
376
- reactCoreVersion: COPILOTKIT_VERSION,
377
- message: getVersionMismatchErrorMessage({
378
- runtimeVersion,
379
- runtimeClientGqlVersion,
380
- reactCoreVersion: COPILOTKIT_VERSION
381
- })
382
- };
383
- }
384
- return;
385
- }
386
- var resolveLowLevelErrorMessage = ({
387
- errorCode,
388
- url
389
- }) => {
390
- const troubleshootingLink = ERROR_CONFIG["NETWORK_ERROR" /* NETWORK_ERROR */].troubleshootingUrl;
391
- const genericMessage = (description = `Failed to fetch from url ${url}.`) => `${description}.
392
-
393
- Possible reasons:
394
- - -The server may have an error preventing it from returning a response (Check the server logs for more info).
395
- - -The server might be down or unreachable
396
- - -There might be a network issue (e.g., DNS failure, connection timeout)
397
- - -The URL might be incorrect
398
- - -The server is not running on the specified port
399
-
400
- ${getSeeMoreMarkdown(troubleshootingLink)}`;
401
- if (url.includes("/info"))
402
- return genericMessage(
403
- `Failed to fetch CopilotKit agents/action information from url ${url}.`
404
- );
405
- if (url.includes("/actions/execute"))
406
- return genericMessage(`Fetch call to ${url} to execute actions failed.`);
407
- if (url.includes("/agents/state"))
408
- return genericMessage(`Fetch call to ${url} to get agent state failed.`);
409
- if (url.includes("/agents/execute"))
410
- return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);
411
- switch (errorCode) {
412
- case "ECONNREFUSED":
413
- return `Connection to ${url} was refused. Ensure the server is running and accessible.
414
-
415
- ${getSeeMoreMarkdown(troubleshootingLink)}`;
416
- case "ENOTFOUND":
417
- return `The server on ${url} could not be found. Check the URL or your network configuration.
418
-
419
- ${getSeeMoreMarkdown(ERROR_CONFIG["NOT_FOUND" /* NOT_FOUND */].troubleshootingUrl)}`;
420
- case "ETIMEDOUT":
421
- return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.
422
-
423
- ${getSeeMoreMarkdown(troubleshootingLink)}`;
424
- default:
425
- return;
426
- }
427
- };
428
- // Annotate the CommonJS export names for ESM import in node:
429
- 0 && (module.exports = {
430
- BANNER_ERROR_NAMES,
431
- COPILOT_CLOUD_ERROR_NAMES,
432
- ConfigurationError,
433
- CopilotKitAgentDiscoveryError,
434
- CopilotKitApiDiscoveryError,
435
- CopilotKitError,
436
- CopilotKitErrorCode,
437
- CopilotKitLowLevelError,
438
- CopilotKitMisuseError,
439
- CopilotKitRemoteEndpointDiscoveryError,
440
- CopilotKitVersionMismatchError,
441
- ERROR_CONFIG,
442
- ERROR_NAMES,
443
- ErrorVisibility,
444
- MissingPublicApiKeyError,
445
- ResolvedCopilotKitError,
446
- Severity,
447
- UpgradeRequiredError,
448
- ensureStructuredError,
449
- getPossibleVersionMismatch,
450
- isStructuredCopilotKitError
451
- });
452
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/errors.ts","../../package.json","../../src/index.ts"],"sourcesContent":["import { GraphQLError } from \"graphql\";\nimport { COPILOTKIT_VERSION } from \"../index\";\n\nexport enum Severity {\n CRITICAL = \"critical\", // Critical errors that block core functionality\n WARNING = \"warning\", // Configuration/setup issues that need attention\n INFO = \"info\", // General errors and network issues\n}\n\nexport enum ErrorVisibility {\n BANNER = \"banner\", // Critical errors shown as fixed banners\n TOAST = \"toast\", // Regular errors shown as dismissible toasts\n SILENT = \"silent\", // Errors logged but not shown to user\n DEV_ONLY = \"dev_only\", // Errors only shown in development mode\n}\n\nexport const ERROR_NAMES = {\n COPILOT_ERROR: \"CopilotError\",\n COPILOT_API_DISCOVERY_ERROR: \"CopilotApiDiscoveryError\",\n COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:\n \"CopilotKitRemoteEndpointDiscoveryError\",\n COPILOT_KIT_AGENT_DISCOVERY_ERROR: \"CopilotKitAgentDiscoveryError\",\n COPILOT_KIT_LOW_LEVEL_ERROR: \"CopilotKitLowLevelError\",\n COPILOT_KIT_VERSION_MISMATCH_ERROR: \"CopilotKitVersionMismatchError\",\n RESOLVED_COPILOT_KIT_ERROR: \"ResolvedCopilotKitError\",\n CONFIGURATION_ERROR: \"ConfigurationError\",\n MISSING_PUBLIC_API_KEY_ERROR: \"MissingPublicApiKeyError\",\n UPGRADE_REQUIRED_ERROR: \"UpgradeRequiredError\",\n} as const;\n\n// Banner errors - critical configuration/discovery issues\nexport const BANNER_ERROR_NAMES = [\n ERROR_NAMES.CONFIGURATION_ERROR,\n ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR,\n ERROR_NAMES.UPGRADE_REQUIRED_ERROR,\n ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR,\n ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR,\n];\n\n// Legacy cloud error names for backward compatibility\nexport const COPILOT_CLOUD_ERROR_NAMES = BANNER_ERROR_NAMES;\n\nexport enum CopilotKitErrorCode {\n NETWORK_ERROR = \"NETWORK_ERROR\",\n NOT_FOUND = \"NOT_FOUND\",\n AGENT_NOT_FOUND = \"AGENT_NOT_FOUND\",\n API_NOT_FOUND = \"API_NOT_FOUND\",\n REMOTE_ENDPOINT_NOT_FOUND = \"REMOTE_ENDPOINT_NOT_FOUND\",\n AUTHENTICATION_ERROR = \"AUTHENTICATION_ERROR\",\n MISUSE = \"MISUSE\",\n UNKNOWN = \"UNKNOWN\",\n VERSION_MISMATCH = \"VERSION_MISMATCH\",\n CONFIGURATION_ERROR = \"CONFIGURATION_ERROR\",\n MISSING_PUBLIC_API_KEY_ERROR = \"MISSING_PUBLIC_API_KEY_ERROR\",\n UPGRADE_REQUIRED_ERROR = \"UPGRADE_REQUIRED_ERROR\",\n}\n\nconst BASE_URL = \"https://docs.copilotkit.ai\";\n\nconst getSeeMoreMarkdown = (link: string) => `See more: [${link}](${link})`;\n\nexport const ERROR_CONFIG = {\n [CopilotKitErrorCode.NETWORK_ERROR]: {\n statusCode: 503,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.AGENT_NOT_FOUND]: {\n statusCode: 500,\n troubleshootingUrl: `${BASE_URL}/coagents/troubleshooting/common-issues#i-am-getting-agent-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.API_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-a-network-errors--api-not-found`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND]: {\n statusCode: 404,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#i-am-getting-copilotkits-remote-endpoint-not-found-error`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.AUTHENTICATION_ERROR]: {\n statusCode: 401,\n troubleshootingUrl: `${BASE_URL}/troubleshooting/common-issues#authentication-errors`,\n visibility: ErrorVisibility.BANNER,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.MISUSE]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.WARNING,\n },\n [CopilotKitErrorCode.UNKNOWN]: {\n statusCode: 500,\n visibility: ErrorVisibility.TOAST,\n severity: Severity.CRITICAL,\n },\n [CopilotKitErrorCode.CONFIGURATION_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR]: {\n statusCode: 400,\n troubleshootingUrl: null,\n severity: Severity.CRITICAL,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR]: {\n statusCode: 402,\n troubleshootingUrl: null,\n severity: Severity.WARNING,\n visibility: ErrorVisibility.BANNER,\n },\n [CopilotKitErrorCode.VERSION_MISMATCH]: {\n statusCode: 400,\n troubleshootingUrl: null,\n visibility: ErrorVisibility.DEV_ONLY,\n severity: Severity.INFO,\n },\n};\n\nexport class CopilotKitError extends GraphQLError {\n code: CopilotKitErrorCode;\n statusCode: number;\n severity?: Severity;\n visibility: ErrorVisibility;\n\n constructor({\n message = \"Unknown error occurred\",\n code,\n severity,\n visibility,\n }: {\n message?: string;\n code: CopilotKitErrorCode;\n severity?: Severity;\n visibility?: ErrorVisibility;\n }) {\n const name = ERROR_NAMES.COPILOT_ERROR;\n const config = ERROR_CONFIG[code];\n const { statusCode } = config;\n const resolvedVisibility =\n visibility ?? config.visibility ?? ErrorVisibility.TOAST;\n const resolvedSeverity =\n severity ?? (\"severity\" in config ? config.severity : undefined);\n\n super(message, {\n extensions: {\n name,\n statusCode,\n code,\n visibility: resolvedVisibility,\n severity: resolvedSeverity,\n troubleshootingUrl:\n \"troubleshootingUrl\" in config ? config.troubleshootingUrl : null,\n originalError: {\n message,\n stack: new Error().stack,\n },\n },\n });\n\n this.code = code;\n this.name = name;\n this.statusCode = statusCode;\n this.severity = resolvedSeverity;\n this.visibility = resolvedVisibility;\n }\n}\n\n/**\n * Error thrown when we can identify wrong usage of our components.\n * This helps us notify the developer before real errors can happen\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitMisuseError extends CopilotKitError {\n constructor({\n message,\n code = CopilotKitErrorCode.MISUSE,\n }: {\n message: string;\n code?: CopilotKitErrorCode;\n }) {\n const docsLink =\n \"troubleshootingUrl\" in ERROR_CONFIG[code] &&\n ERROR_CONFIG[code].troubleshootingUrl\n ? getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl as string)\n : null;\n const finalMessage = docsLink ? `${message}.\\n\\n${docsLink}` : message;\n super({ message: finalMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\nconst getVersionMismatchErrorMessage = ({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n}: VersionMismatchResponse) =>\n `Version mismatch detected: @copilotkit/runtime@${runtimeVersion ?? \"\"} is not compatible with @copilotkit/react-core@${reactCoreVersion} and @copilotkit/runtime-client-gql@${runtimeClientGqlVersion}. Please ensure all installed copilotkit packages are on the same version.`;\n/**\n * Error thrown when CPK versions does not match\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitVersionMismatchError extends CopilotKitError {\n constructor({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }: VersionMismatchResponse) {\n const code = CopilotKitErrorCode.VERSION_MISMATCH;\n super({\n message: getVersionMismatchErrorMessage({\n reactCoreVersion,\n runtimeVersion,\n runtimeClientGqlVersion,\n }),\n code,\n });\n this.name = ERROR_NAMES.COPILOT_KIT_VERSION_MISMATCH_ERROR;\n }\n}\n\n/**\n * Error thrown when the CopilotKit API endpoint cannot be discovered or accessed.\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n * - There are network/firewall issues preventing access\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitApiDiscoveryError extends CopilotKitError {\n constructor(\n params: {\n message?: string;\n code?:\n | CopilotKitErrorCode.API_NOT_FOUND\n | CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n url?: string;\n } = {},\n ) {\n const url = params.url ?? \"\";\n let operationSuffix = \"\";\n if (url?.includes(\"/info\"))\n operationSuffix = `when fetching CopilotKit info`;\n else if (url.includes(\"/actions/execute\"))\n operationSuffix = `when attempting to execute actions.`;\n else if (url.includes(\"/agents/state\"))\n operationSuffix = `when attempting to get agent state.`;\n else if (url.includes(\"/agents/execute\"))\n operationSuffix = `when attempting to execute agent(s).`;\n const message =\n params.message ??\n (params.url\n ? `Failed to find CopilotKit API endpoint at url ${params.url} ${operationSuffix}`\n : `Failed to find CopilotKit API endpoint.`);\n const code = params.code ?? CopilotKitErrorCode.API_NOT_FOUND;\n const errorMessage = `${message}.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl)}`;\n super({ message: errorMessage, code });\n this.name = ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR;\n }\n}\n\n/**\n * This error is used for endpoints specified in runtime's remote endpoints. If they cannot be contacted\n * This typically occurs when:\n * - The API endpoint URL is invalid or misconfigured\n * - The API service is not running at the expected location\n *\n * @extends CopilotKitApiDiscoveryError\n */\nexport class CopilotKitRemoteEndpointDiscoveryError extends CopilotKitApiDiscoveryError {\n constructor(params?: { message?: string; url?: string }) {\n const message =\n params?.message ??\n (params?.url\n ? `Failed to find or contact remote endpoint at url ${params.url}`\n : \"Failed to find or contact remote endpoint\");\n const code = CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND;\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Error thrown when a LangGraph agent cannot be found or accessed.\n * This typically occurs when:\n * - The specified agent name does not exist in the deployment\n * - The agent configuration is invalid or missing\n * - The agent service is not properly deployed or initialized\n *\n * @extends CopilotKitError\n */\nexport class CopilotKitAgentDiscoveryError extends CopilotKitError {\n constructor(params: {\n agentName?: string;\n availableAgents: { name: string; id: string }[];\n }) {\n const { agentName, availableAgents } = params;\n const code = CopilotKitErrorCode.AGENT_NOT_FOUND;\n\n const seeMore = getSeeMoreMarkdown(ERROR_CONFIG[code].troubleshootingUrl);\n let message;\n\n if (availableAgents.length) {\n const agentList = availableAgents.map((agent) => agent.name).join(\", \");\n\n if (agentName) {\n message = `Agent '${agentName}' was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n } else {\n message = `The requested agent was not found. Available agents are: ${agentList}. Please verify the agent name in your configuration and ensure it matches one of the available agents.\\n\\n${seeMore}`;\n }\n } else {\n message = `${agentName ? `Agent '${agentName}'` : \"The requested agent\"} was not found. Please set up at least one agent before proceeding. ${seeMore}`;\n }\n\n super({ message, code });\n this.name = ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR;\n }\n}\n\n/**\n * Handles low-level networking errors that occur before a request reaches the server.\n * These errors arise from issues in the underlying communication infrastructure rather than\n * application-level logic or server responses. Typically used to handle \"fetch failed\" errors\n * where no HTTP status code is available.\n *\n * Common scenarios include:\n * - Connection failures (ECONNREFUSED) when server is down/unreachable\n * - DNS resolution failures (ENOTFOUND) when domain can't be resolved\n * - Timeouts (ETIMEDOUT) when request takes too long\n * - Protocol/transport layer errors like SSL/TLS issues\n */\nexport class CopilotKitLowLevelError extends CopilotKitError {\n constructor({\n error,\n url,\n message,\n }: {\n error: Error;\n url: string;\n message?: string;\n }) {\n let code = CopilotKitErrorCode.NETWORK_ERROR;\n\n // @ts-expect-error -- code may exist\n const errorCode = error.code as string;\n const errorMessage =\n message ?? resolveLowLevelErrorMessage({ errorCode, url });\n\n super({ message: errorMessage, code });\n\n this.name = ERROR_NAMES.COPILOT_KIT_LOW_LEVEL_ERROR;\n }\n}\n\n/**\n * Generic catch-all error handler for HTTP responses from the CopilotKit API where a status code is available.\n * Used when we receive an HTTP error status and wish to handle broad range of them\n *\n * This differs from CopilotKitLowLevelError in that:\n * - ResolvedCopilotKitError: Server was reached and returned an HTTP status\n * - CopilotKitLowLevelError: Error occurred before reaching server (e.g. network failure)\n *\n * @param status - The HTTP status code received from the API response\n * @param message - Optional error message to include\n * @param code - Optional specific CopilotKitErrorCode to override default behavior\n *\n * Default behavior:\n * - 400 Bad Request: Maps to CopilotKitApiDiscoveryError\n * - All other status codes: Maps to UNKNOWN error code if no specific code provided\n */\nexport class ResolvedCopilotKitError extends CopilotKitError {\n constructor({\n status,\n message,\n code,\n isRemoteEndpoint,\n url,\n }: {\n status: number;\n message?: string;\n code?: CopilotKitErrorCode;\n isRemoteEndpoint?: boolean;\n url?: string;\n }) {\n let resolvedCode = code;\n if (!resolvedCode) {\n switch (status) {\n case 400:\n throw new CopilotKitApiDiscoveryError({ message, url });\n case 404:\n throw isRemoteEndpoint\n ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n : new CopilotKitApiDiscoveryError({ message, url });\n default:\n resolvedCode = CopilotKitErrorCode.UNKNOWN;\n break;\n }\n }\n\n super({ message, code: resolvedCode });\n this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n constructor(message: string) {\n super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });\n this.name = ERROR_NAMES.CONFIGURATION_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\nexport class MissingPublicApiKeyError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR;\n this.severity = Severity.CRITICAL;\n }\n}\n\nexport class UpgradeRequiredError extends ConfigurationError {\n constructor(message: string) {\n super(message);\n this.name = ERROR_NAMES.UPGRADE_REQUIRED_ERROR;\n this.severity = Severity.WARNING;\n }\n}\n\n/**\n * Checks if an error is already a structured CopilotKit error.\n * This utility centralizes the logic for detecting structured errors across the codebase.\n *\n * @param error - The error to check\n * @returns true if the error is already structured, false otherwise\n */\nexport function isStructuredCopilotKitError(error: any): boolean {\n return (\n error instanceof CopilotKitError ||\n error instanceof CopilotKitLowLevelError ||\n (error?.name && error.name.includes(\"CopilotKit\")) ||\n error?.extensions?.code !== undefined // Check if it has our structured error properties\n );\n}\n\n/**\n * Returns the error as-is if it's already structured, otherwise converts it using the provided converter function.\n * This utility centralizes the pattern of preserving structured errors while converting unstructured ones.\n *\n * @param error - The error to process\n * @param converter - Function to convert unstructured errors to structured ones\n * @returns The structured error\n */\nexport function ensureStructuredError<T extends CopilotKitError>(\n error: any,\n converter: (error: any) => T,\n): T | any {\n return isStructuredCopilotKitError(error) ? error : converter(error);\n}\n\ninterface VersionMismatchResponse {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n reactCoreVersion: string;\n}\n\nexport async function getPossibleVersionMismatch({\n runtimeVersion,\n runtimeClientGqlVersion,\n}: {\n runtimeVersion?: string;\n runtimeClientGqlVersion: string;\n}) {\n if (!runtimeVersion || runtimeVersion === \"\" || !runtimeClientGqlVersion)\n return;\n if (\n COPILOTKIT_VERSION !== runtimeVersion ||\n COPILOTKIT_VERSION !== runtimeClientGqlVersion ||\n runtimeVersion !== runtimeClientGqlVersion\n ) {\n return {\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n message: getVersionMismatchErrorMessage({\n runtimeVersion,\n runtimeClientGqlVersion,\n reactCoreVersion: COPILOTKIT_VERSION,\n }),\n };\n }\n\n return;\n}\n\nconst resolveLowLevelErrorMessage = ({\n errorCode,\n url,\n}: {\n errorCode?: string;\n url: string;\n}) => {\n const troubleshootingLink =\n ERROR_CONFIG[CopilotKitErrorCode.NETWORK_ERROR].troubleshootingUrl;\n const genericMessage = (\n description = `Failed to fetch from url ${url}.`,\n ) => `${description}.\n\nPossible reasons:\n- -The server may have an error preventing it from returning a response (Check the server logs for more info).\n- -The server might be down or unreachable\n- -There might be a network issue (e.g., DNS failure, connection timeout) \n- -The URL might be incorrect\n- -The server is not running on the specified port\n\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n\n if (url.includes(\"/info\"))\n return genericMessage(\n `Failed to fetch CopilotKit agents/action information from url ${url}.`,\n );\n if (url.includes(\"/actions/execute\"))\n return genericMessage(`Fetch call to ${url} to execute actions failed.`);\n if (url.includes(\"/agents/state\"))\n return genericMessage(`Fetch call to ${url} to get agent state failed.`);\n if (url.includes(\"/agents/execute\"))\n return genericMessage(`Fetch call to ${url} to execute agent(s) failed.`);\n\n switch (errorCode) {\n case \"ECONNREFUSED\":\n return `Connection to ${url} was refused. Ensure the server is running and accessible.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n case \"ENOTFOUND\":\n return `The server on ${url} could not be found. Check the URL or your network configuration.\\n\\n${getSeeMoreMarkdown(ERROR_CONFIG[CopilotKitErrorCode.NOT_FOUND].troubleshootingUrl)}`;\n case \"ETIMEDOUT\":\n return `The connection to ${url} timed out. The server might be overloaded or taking too long to respond.\\n\\n${getSeeMoreMarkdown(troubleshootingLink)}`;\n default:\n return;\n }\n};\n","{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.51.4\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"unpkg\": \"./dist/index.umd.js\",\n \"jsdelivr\": \"./dist/index.umd.js\",\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean && rollup -c rollup.config.mjs\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"dependencies\": {\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"graphql\": \"^16.8.1\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\"\n },\n \"peerDependencies\": {\n \"@ag-ui/core\": \"^0.0.43\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n","export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport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