@copilotkit/react-core 1.10.0-next.3 → 1.10.0-next.4

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 (190) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{chunk-VOMGRGWT.mjs → chunk-2JAX6WE6.mjs} +7 -7
  3. package/dist/chunk-2JAX6WE6.mjs.map +1 -0
  4. package/dist/{chunk-WUORFPJ7.mjs → chunk-2WYJIO6D.mjs} +4 -4
  5. package/dist/chunk-373NOCJI.mjs +79 -0
  6. package/dist/chunk-373NOCJI.mjs.map +1 -0
  7. package/dist/{chunk-XGRBCWK6.mjs → chunk-47GMU44Z.mjs} +4 -1
  8. package/dist/chunk-47GMU44Z.mjs.map +1 -0
  9. package/dist/{chunk-DF4YG4PF.mjs → chunk-57MBVQPX.mjs} +2 -2
  10. package/dist/{chunk-JZQOCH4A.mjs → chunk-5JL5ELUS.mjs} +2 -2
  11. package/dist/{chunk-LNAQ7JG3.mjs → chunk-AC2GVFW6.mjs} +2 -2
  12. package/dist/{chunk-RGKZCCPA.mjs → chunk-AVMA2MCW.mjs} +3 -3
  13. package/dist/chunk-AWFAFFO5.mjs +221 -0
  14. package/dist/chunk-AWFAFFO5.mjs.map +1 -0
  15. package/dist/{chunk-4XVBXDCX.mjs → chunk-BBK7LXZ6.mjs} +5 -5
  16. package/dist/{chunk-YAF2LATQ.mjs → chunk-EFL5OBKN.mjs} +1 -1
  17. package/dist/chunk-EFL5OBKN.mjs.map +1 -0
  18. package/dist/{chunk-4CFY3CON.mjs → chunk-EQQSE6KM.mjs} +2 -2
  19. package/dist/{chunk-JWAXDYOW.mjs → chunk-FAUNHSQU.mjs} +3 -3
  20. package/dist/{chunk-NXCJELW7.mjs → chunk-G7J6NY5J.mjs} +3 -3
  21. package/dist/chunk-ICIK2BSB.mjs +17 -0
  22. package/dist/chunk-ICIK2BSB.mjs.map +1 -0
  23. package/dist/{chunk-PYULBXCD.mjs → chunk-JLQZVKFX.mjs} +4 -4
  24. package/dist/chunk-KDAZGZ24.mjs +1 -0
  25. package/dist/{chunk-OMVNJ7S3.mjs → chunk-L7CWMU4O.mjs} +34 -19
  26. package/dist/chunk-L7CWMU4O.mjs.map +1 -0
  27. package/dist/{chunk-3OQM3NEK.mjs → chunk-N4WEHORG.mjs} +2 -2
  28. package/dist/{chunk-Q6FZZJ5A.mjs → chunk-OL3VRQKU.mjs} +2 -2
  29. package/dist/chunk-PQ5IXT4Z.mjs +18 -0
  30. package/dist/chunk-PQ5IXT4Z.mjs.map +1 -0
  31. package/dist/{chunk-VM7CVIET.mjs → chunk-PRKL7T7P.mjs} +6 -6
  32. package/dist/chunk-PRKL7T7P.mjs.map +1 -0
  33. package/dist/{chunk-KV25ZRMH.mjs → chunk-XIHAYU6C.mjs} +4 -4
  34. package/dist/chunk-XIHAYU6C.mjs.map +1 -0
  35. package/dist/{chunk-SGF6C7I6.mjs → chunk-ZTZJIDRJ.mjs} +9 -14
  36. package/dist/chunk-ZTZJIDRJ.mjs.map +1 -0
  37. package/dist/components/copilot-provider/copilot-messages.js +12 -1
  38. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  39. package/dist/components/copilot-provider/copilot-messages.mjs +4 -4
  40. package/dist/components/copilot-provider/copilotkit-props.d.ts +1 -1
  41. package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
  42. package/dist/components/copilot-provider/copilotkit.js +307 -550
  43. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  44. package/dist/components/copilot-provider/copilotkit.mjs +9 -9
  45. package/dist/components/copilot-provider/index.d.ts +1 -1
  46. package/dist/components/copilot-provider/index.js +307 -550
  47. package/dist/components/copilot-provider/index.js.map +1 -1
  48. package/dist/components/copilot-provider/index.mjs +9 -9
  49. package/dist/components/error-boundary/error-boundary.js +172 -323
  50. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  51. package/dist/components/error-boundary/error-boundary.mjs +4 -4
  52. package/dist/components/error-boundary/error-utils.js.map +1 -1
  53. package/dist/components/error-boundary/error-utils.mjs +2 -2
  54. package/dist/components/index.d.ts +1 -1
  55. package/dist/components/index.js +307 -550
  56. package/dist/components/index.js.map +1 -1
  57. package/dist/components/index.mjs +9 -9
  58. package/dist/components/toast/toast-provider.js.map +1 -1
  59. package/dist/components/toast/toast-provider.mjs +1 -1
  60. package/dist/components/usage-banner.d.ts +8 -3
  61. package/dist/components/usage-banner.js +172 -302
  62. package/dist/components/usage-banner.js.map +1 -1
  63. package/dist/components/usage-banner.mjs +3 -1
  64. package/dist/context/copilot-context.d.ts +1 -1
  65. package/dist/context/copilot-context.js +3 -0
  66. package/dist/context/copilot-context.js.map +1 -1
  67. package/dist/context/copilot-context.mjs +1 -1
  68. package/dist/context/index.d.ts +1 -1
  69. package/dist/context/index.js +3 -0
  70. package/dist/context/index.js.map +1 -1
  71. package/dist/context/index.mjs +1 -1
  72. package/dist/{copilot-context-bd88d30d.d.ts → copilot-context-78fc727c.d.ts} +3 -1
  73. package/dist/hooks/index.d.ts +5 -3
  74. package/dist/hooks/index.js +143 -57
  75. package/dist/hooks/index.js.map +1 -1
  76. package/dist/hooks/index.mjs +32 -24
  77. package/dist/hooks/use-chat.d.ts +1 -1
  78. package/dist/hooks/use-chat.js +12 -1
  79. package/dist/hooks/use-chat.js.map +1 -1
  80. package/dist/hooks/use-chat.mjs +6 -6
  81. package/dist/hooks/use-coagent-state-render.js +3 -0
  82. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  83. package/dist/hooks/use-coagent-state-render.mjs +3 -3
  84. package/dist/hooks/use-coagent.d.ts +1 -1
  85. package/dist/hooks/use-coagent.js +15 -4
  86. package/dist/hooks/use-coagent.js.map +1 -1
  87. package/dist/hooks/use-coagent.mjs +13 -13
  88. package/dist/hooks/use-copilot-action.js +3 -0
  89. package/dist/hooks/use-copilot-action.js.map +1 -1
  90. package/dist/hooks/use-copilot-action.mjs +4 -4
  91. package/dist/hooks/use-copilot-additional-instructions.js +3 -0
  92. package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
  93. package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
  94. package/dist/hooks/use-copilot-authenticated-action.js +3 -0
  95. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  96. package/dist/hooks/use-copilot-authenticated-action.mjs +5 -5
  97. package/dist/hooks/use-copilot-chat-light.d.ts +211 -0
  98. package/dist/hooks/use-copilot-chat-light.js +1770 -0
  99. package/dist/hooks/use-copilot-chat-light.js.map +1 -0
  100. package/dist/hooks/use-copilot-chat-light.mjs +28 -0
  101. package/dist/hooks/use-copilot-chat-light.mjs.map +1 -0
  102. package/dist/hooks/use-copilot-chat.d.ts +9 -81
  103. package/dist/hooks/use-copilot-chat.js +77 -5
  104. package/dist/hooks/use-copilot-chat.js.map +1 -1
  105. package/dist/hooks/use-copilot-chat.mjs +15 -13
  106. package/dist/hooks/use-copilot-chat_internal.d.ts +91 -0
  107. package/dist/hooks/use-copilot-chat_internal.js +1760 -0
  108. package/dist/hooks/use-copilot-chat_internal.js.map +1 -0
  109. package/dist/hooks/use-copilot-chat_internal.mjs +29 -0
  110. package/dist/hooks/use-copilot-chat_internal.mjs.map +1 -0
  111. package/dist/hooks/use-copilot-readable.js +3 -0
  112. package/dist/hooks/use-copilot-readable.js.map +1 -1
  113. package/dist/hooks/use-copilot-readable.mjs +2 -2
  114. package/dist/hooks/use-copilot-runtime-client.js +9 -1
  115. package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
  116. package/dist/hooks/use-copilot-runtime-client.mjs +3 -3
  117. package/dist/hooks/use-langgraph-interrupt-render.js +3 -0
  118. package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
  119. package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
  120. package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
  121. package/dist/hooks/use-langgraph-interrupt.js +15 -4
  122. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  123. package/dist/hooks/use-langgraph-interrupt.mjs +13 -13
  124. package/dist/hooks/use-make-copilot-document-readable.js +3 -0
  125. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  126. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  127. package/dist/index.d.ts +4 -2
  128. package/dist/index.js +384 -449
  129. package/dist/index.js.map +1 -1
  130. package/dist/index.mjs +34 -26
  131. package/dist/lib/copilot-task.d.ts +1 -1
  132. package/dist/lib/copilot-task.js.map +1 -1
  133. package/dist/lib/copilot-task.mjs +10 -10
  134. package/dist/lib/index.d.ts +1 -1
  135. package/dist/lib/index.js.map +1 -1
  136. package/dist/lib/index.mjs +10 -10
  137. package/dist/types/interrupt-action.d.ts +1 -1
  138. package/dist/utils/dev-console.d.ts +1 -1
  139. package/dist/utils/dev-console.js +9 -1
  140. package/dist/utils/dev-console.js.map +1 -1
  141. package/dist/utils/dev-console.mjs +1 -1
  142. package/dist/utils/extract.d.ts +1 -1
  143. package/dist/utils/extract.js.map +1 -1
  144. package/dist/utils/extract.mjs +9 -9
  145. package/dist/utils/index.d.ts +1 -1
  146. package/dist/utils/index.js +9 -1
  147. package/dist/utils/index.js.map +1 -1
  148. package/dist/utils/index.mjs +9 -9
  149. package/dist/utils/suggestions.d.ts +1 -1
  150. package/dist/utils/suggestions.js.map +1 -1
  151. package/dist/utils/suggestions.mjs +9 -9
  152. package/package.json +3 -3
  153. package/src/components/copilot-provider/copilotkit.tsx +16 -5
  154. package/src/components/error-boundary/error-boundary.tsx +5 -15
  155. package/src/components/toast/toast-provider.tsx +1 -3
  156. package/src/components/usage-banner.tsx +187 -315
  157. package/src/context/copilot-context.tsx +12 -1
  158. package/src/hooks/__tests__/use-coagent-config.test.ts +1 -1
  159. package/src/hooks/index.ts +6 -0
  160. package/src/hooks/use-coagent.ts +1 -1
  161. package/src/hooks/use-copilot-chat-light.ts +219 -0
  162. package/src/hooks/use-copilot-chat.ts +89 -430
  163. package/src/hooks/use-copilot-chat_internal.ts +437 -0
  164. package/src/hooks/use-langgraph-interrupt.ts +1 -1
  165. package/src/utils/dev-console.ts +18 -2
  166. package/dist/chunk-57K2ZJ5F.mjs +0 -348
  167. package/dist/chunk-57K2ZJ5F.mjs.map +0 -1
  168. package/dist/chunk-CQPYJIBH.mjs +0 -1
  169. package/dist/chunk-GFJW4RIM.mjs +0 -9
  170. package/dist/chunk-GFJW4RIM.mjs.map +0 -1
  171. package/dist/chunk-KV25ZRMH.mjs.map +0 -1
  172. package/dist/chunk-OMVNJ7S3.mjs.map +0 -1
  173. package/dist/chunk-SGF6C7I6.mjs.map +0 -1
  174. package/dist/chunk-VM7CVIET.mjs.map +0 -1
  175. package/dist/chunk-VOMGRGWT.mjs.map +0 -1
  176. package/dist/chunk-XGRBCWK6.mjs.map +0 -1
  177. package/dist/chunk-YAF2LATQ.mjs.map +0 -1
  178. /package/dist/{chunk-WUORFPJ7.mjs.map → chunk-2WYJIO6D.mjs.map} +0 -0
  179. /package/dist/{chunk-DF4YG4PF.mjs.map → chunk-57MBVQPX.mjs.map} +0 -0
  180. /package/dist/{chunk-JZQOCH4A.mjs.map → chunk-5JL5ELUS.mjs.map} +0 -0
  181. /package/dist/{chunk-LNAQ7JG3.mjs.map → chunk-AC2GVFW6.mjs.map} +0 -0
  182. /package/dist/{chunk-RGKZCCPA.mjs.map → chunk-AVMA2MCW.mjs.map} +0 -0
  183. /package/dist/{chunk-4XVBXDCX.mjs.map → chunk-BBK7LXZ6.mjs.map} +0 -0
  184. /package/dist/{chunk-4CFY3CON.mjs.map → chunk-EQQSE6KM.mjs.map} +0 -0
  185. /package/dist/{chunk-JWAXDYOW.mjs.map → chunk-FAUNHSQU.mjs.map} +0 -0
  186. /package/dist/{chunk-NXCJELW7.mjs.map → chunk-G7J6NY5J.mjs.map} +0 -0
  187. /package/dist/{chunk-PYULBXCD.mjs.map → chunk-JLQZVKFX.mjs.map} +0 -0
  188. /package/dist/{chunk-CQPYJIBH.mjs.map → chunk-KDAZGZ24.mjs.map} +0 -0
  189. /package/dist/{chunk-3OQM3NEK.mjs.map → chunk-N4WEHORG.mjs.map} +0 -0
  190. /package/dist/{chunk-Q6FZZJ5A.mjs.map → chunk-OL3VRQKU.mjs.map} +0 -0
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  CopilotKit,
3
3
  defaultCopilotContextCategories
4
- } from "../../chunk-OMVNJ7S3.mjs";
5
- import "../../chunk-PYULBXCD.mjs";
6
- import "../../chunk-SGF6C7I6.mjs";
4
+ } from "../../chunk-L7CWMU4O.mjs";
5
+ import "../../chunk-JLQZVKFX.mjs";
6
+ import "../../chunk-ZTZJIDRJ.mjs";
7
7
  import "../../chunk-2IDV5OHF.mjs";
8
8
  import "../../chunk-PMAFHQ7P.mjs";
9
9
  import "../../chunk-5FHSUKQL.mjs";
10
10
  import "../../chunk-RKTVJRK7.mjs";
11
- import "../../chunk-JWAXDYOW.mjs";
12
- import "../../chunk-GFJW4RIM.mjs";
13
- import "../../chunk-3OQM3NEK.mjs";
11
+ import "../../chunk-FAUNHSQU.mjs";
12
+ import "../../chunk-ICIK2BSB.mjs";
13
+ import "../../chunk-N4WEHORG.mjs";
14
14
  import "../../chunk-O7ARI5CV.mjs";
15
- import "../../chunk-YAF2LATQ.mjs";
16
- import "../../chunk-57K2ZJ5F.mjs";
17
- import "../../chunk-XGRBCWK6.mjs";
15
+ import "../../chunk-EFL5OBKN.mjs";
16
+ import "../../chunk-AWFAFFO5.mjs";
17
+ import "../../chunk-47GMU44Z.mjs";
18
18
  import "../../chunk-DCTJZ742.mjs";
19
19
  import "../../chunk-SKC7AJIV.mjs";
20
20
  export {
@@ -114,345 +114,199 @@ var StatusChecker = class {
114
114
  // src/components/usage-banner.tsx
115
115
  var import_shared2 = require("@copilotkit/shared");
116
116
  var import_jsx_runtime = require("react/jsx-runtime");
117
- var defaultIcons = {
118
- [import_shared2.Severity.CRITICAL]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
119
- "svg",
120
- {
121
- viewBox: "0 0 24 24",
122
- width: "16",
123
- height: "16",
124
- stroke: "currentColor",
125
- strokeWidth: "2.5",
126
- fill: "none",
127
- strokeLinecap: "round",
128
- strokeLinejoin: "round",
129
- children: [
130
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
131
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
132
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
133
- ]
134
- }
135
- ),
136
- [import_shared2.Severity.WARNING]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
137
- "svg",
138
- {
139
- viewBox: "0 0 24 24",
140
- width: "16",
141
- height: "16",
142
- stroke: "currentColor",
143
- strokeWidth: "2.5",
144
- fill: "none",
145
- strokeLinecap: "round",
146
- strokeLinejoin: "round",
147
- children: [
148
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
149
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
150
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
151
- ]
152
- }
153
- ),
154
- [import_shared2.Severity.INFO]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
155
- "svg",
156
- {
157
- viewBox: "0 0 24 24",
158
- width: "16",
159
- height: "16",
160
- stroke: "currentColor",
161
- strokeWidth: "2.5",
162
- fill: "none",
163
- strokeLinecap: "round",
164
- strokeLinejoin: "round",
165
- children: [
166
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
167
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
168
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
169
- ]
170
- }
171
- )
172
- };
173
117
  function UsageBanner({
174
118
  severity = import_shared2.Severity.CRITICAL,
175
119
  message = "",
176
- icon,
177
120
  onClose,
178
121
  actions
179
122
  }) {
180
123
  if (!message || !severity) {
181
124
  return null;
182
125
  }
183
- const parseMessage = (rawMessage) => {
184
- if (rawMessage.toLowerCase().includes("authentication") || rawMessage.toLowerCase().includes("api key")) {
185
- return "Authentication failed. Please check your API key.";
186
- }
187
- if (rawMessage.toLowerCase().includes("rate limit")) {
188
- return "Rate limit exceeded. Please try again later.";
189
- }
190
- if (rawMessage.toLowerCase().includes("checkpointer")) {
191
- return "Agent configuration error. Please check your setup.";
192
- }
193
- let cleanMessage2 = rawMessage;
194
- cleanMessage2 = cleanMessage2.split(" - ")[0];
195
- cleanMessage2 = cleanMessage2.split(": Error code")[0];
196
- cleanMessage2 = cleanMessage2.split(": 401")[0];
197
- cleanMessage2 = cleanMessage2.split(": 403")[0];
198
- cleanMessage2 = cleanMessage2.split(": 404")[0];
199
- cleanMessage2 = cleanMessage2.split(": 500")[0];
200
- cleanMessage2 = cleanMessage2.replace(/See more:.*$/g, "").trim();
201
- if (cleanMessage2.includes("{") || cleanMessage2.includes("'") || cleanMessage2.length > 60) {
202
- return "Configuration error. Please check your setup.";
203
- }
204
- return cleanMessage2 || "An error occurred. Please check your configuration.";
205
- };
206
- const cleanMessage = parseMessage(message);
207
- const Icon = icon || defaultIcons[severity];
208
- const themeConfigs = {
126
+ const themes = {
209
127
  [import_shared2.Severity.INFO]: {
210
- bg: "rgba(239, 246, 255, 0.95)",
211
- border: "#93c5fd",
212
- text: "#1e40af",
213
- icon: "#3b82f6",
214
- primaryBtn: "#3b82f6",
215
- primaryBtnHover: "#2563eb"
128
+ bg: "#f8fafc",
129
+ border: "#e2e8f0",
130
+ text: "#475569",
131
+ accent: "#3b82f6"
216
132
  },
217
133
  [import_shared2.Severity.WARNING]: {
218
- bg: "rgba(255, 251, 235, 0.95)",
134
+ bg: "#fffbeb",
219
135
  border: "#fbbf24",
220
136
  text: "#92400e",
221
- icon: "#f59e0b",
222
- primaryBtn: "#f59e0b",
223
- primaryBtnHover: "#d97706"
137
+ accent: "#f59e0b"
224
138
  },
225
139
  [import_shared2.Severity.CRITICAL]: {
226
- bg: "rgba(254, 242, 242, 0.95)",
227
- border: "#f87171",
228
- text: "#991b1b",
229
- icon: "#ef4444",
230
- primaryBtn: "#ef4444",
231
- primaryBtnHover: "#dc2626"
140
+ bg: "#fef2f2",
141
+ border: "#fecaca",
142
+ text: "#dc2626",
143
+ accent: "#ef4444"
232
144
  }
233
145
  };
234
- const themeConfig = themeConfigs[severity] || themeConfigs[import_shared2.Severity.CRITICAL];
235
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
236
- "div",
237
- {
238
- style: {
239
- position: "fixed",
240
- bottom: "24px",
241
- left: "50%",
242
- transform: "translateX(-50%)",
243
- width: "400px",
244
- maxWidth: "90vw",
245
- zIndex: 1e4,
246
- animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
247
- },
248
- children: [
249
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
250
- @keyframes bannerSlideIn {
251
- from {
252
- opacity: 0;
253
- transform: translateX(-50%) translateY(20px);
254
- scale: 0.95;
255
- }
256
- to {
257
- opacity: 1;
258
- transform: translateX(-50%) translateY(0);
259
- scale: 1;
260
- }
146
+ const theme = themes[severity];
147
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
149
+ @keyframes slideUp {
150
+ from { opacity: 0; transform: translateX(-50%) translateY(8px); }
151
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
261
152
  }
262
- ` }),
263
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
264
- "div",
265
- {
266
- style: {
267
- borderRadius: "12px",
268
- border: `1px solid ${themeConfig.border}`,
269
- background: themeConfig.bg,
270
- padding: "14px",
271
- boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)",
272
- position: "relative",
273
- backdropFilter: "blur(12px)",
274
- WebkitBackdropFilter: "blur(12px)",
275
- boxSizing: "border-box",
276
- overflow: "hidden"
277
- },
278
- children: [
279
- onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
280
- "button",
281
- {
282
- onClick: onClose,
283
- style: {
284
- position: "absolute",
285
- top: "8px",
286
- right: "8px",
287
- background: "rgba(255, 255, 255, 0.9)",
288
- border: "none",
289
- color: themeConfig.text,
290
- cursor: "pointer",
291
- fontSize: "16px",
292
- lineHeight: "1",
293
- padding: "4px",
294
- borderRadius: "4px",
295
- width: "20px",
296
- height: "20px",
297
- display: "flex",
298
- alignItems: "center",
299
- justifyContent: "center"
300
- },
301
- title: "Close",
302
- children: "\xD7"
303
- }
304
- ),
305
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
306
- "div",
307
- {
308
- style: {
309
- fontSize: "14px",
310
- fontWeight: 500,
311
- color: themeConfig.text,
312
- lineHeight: "1.4",
313
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
314
- paddingRight: onClose ? "30px" : "0",
315
- marginBottom: actions ? "12px" : "0",
316
- wordBreak: "break-word",
317
- overflow: "hidden",
318
- textOverflow: "ellipsis",
319
- display: "-webkit-box",
320
- WebkitLineClamp: 2,
321
- WebkitBoxOrient: "vertical"
322
- },
323
- children: cleanMessage
324
- }
325
- ),
326
- actions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
327
- "div",
328
- {
329
- style: {
330
- display: "flex",
331
- gap: "8px",
332
- flexWrap: "wrap"
333
- },
334
- children: [
335
- actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
336
- "button",
337
- {
338
- onClick: actions.secondary.onClick,
339
- style: {
340
- borderRadius: "8px",
341
- padding: "6px 12px",
342
- fontSize: "13px",
343
- fontWeight: 500,
344
- color: themeConfig.text,
345
- backgroundColor: "rgba(255, 255, 255, 0.9)",
346
- border: `1px solid ${themeConfig.border}`,
347
- cursor: "pointer",
348
- transition: "all 0.2s ease",
349
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
350
- },
351
- onMouseOver: (e) => {
352
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
353
- e.currentTarget.style.transform = "translateY(-1px)";
354
- },
355
- onMouseOut: (e) => {
356
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
357
- e.currentTarget.style.transform = "translateY(0)";
358
- },
359
- children: actions.secondary.label
360
- }
361
- ),
362
- actions.primary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
363
- "button",
364
- {
365
- onClick: actions.primary.onClick,
366
- style: {
367
- borderRadius: "8px",
368
- padding: "6px 12px",
369
- fontSize: "13px",
370
- fontWeight: 600,
371
- color: "#fff",
372
- backgroundColor: themeConfig.primaryBtn,
373
- border: "none",
374
- cursor: "pointer",
375
- transition: "all 0.2s ease",
376
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
377
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
378
- },
379
- onMouseOver: (e) => {
380
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
381
- e.currentTarget.style.transform = "translateY(-1px)";
382
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
383
- },
384
- onMouseOut: (e) => {
385
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
386
- e.currentTarget.style.transform = "translateY(0)";
387
- e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
388
- },
389
- children: actions.primary.label
390
- }
391
- )
392
- ]
393
- }
394
- )
395
- ]
153
+
154
+ .usage-banner {
155
+ position: fixed;
156
+ bottom: 24px;
157
+ left: 50%;
158
+ transform: translateX(-50%);
159
+ width: min(600px, calc(100vw - 32px));
160
+ z-index: 10000;
161
+ animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
396
162
  }
397
- )
398
- ]
399
- }
400
- );
401
- }
402
- function renderCopilotKitUsage(error, onClose) {
403
- if (error.visibility !== import_shared2.ErrorVisibility.BANNER) {
404
- return null;
405
- }
406
- const extractUrlFromMessage = (message) => {
407
- const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
408
- const match = linkRegex.exec(message);
409
- return match ? match[2] : null;
410
- };
411
- const getErrorActions = (error2) => {
412
- switch (error2.name) {
413
- case import_shared2.ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:
414
- return {
415
- primary: {
416
- label: "Sign In",
417
- onClick: () => window.location.href = "https://cloud.copilotkit.ai"
163
+
164
+ .banner-content {
165
+ background: linear-gradient(135deg, ${theme.bg} 0%, ${theme.bg}f5 100%);
166
+ border: 1px solid ${theme.border};
167
+ border-radius: 12px;
168
+ padding: 18px 20px;
169
+ box-shadow:
170
+ 0 4px 24px rgba(0, 0, 0, 0.08),
171
+ 0 2px 8px rgba(0, 0, 0, 0.04),
172
+ inset 0 1px 0 rgba(255, 255, 255, 0.7);
173
+ display: flex;
174
+ align-items: center;
175
+ gap: 16px;
176
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
177
+ backdrop-filter: blur(12px);
178
+ position: relative;
179
+ overflow: hidden;
180
+ }
181
+
182
+ .banner-content::before {
183
+ content: '';
184
+ position: absolute;
185
+ top: 0;
186
+ left: 0;
187
+ right: 0;
188
+ height: 1px;
189
+ background: linear-gradient(90deg, transparent, ${theme.accent}40, transparent);
418
190
  }
419
- };
420
- case import_shared2.ERROR_NAMES.UPGRADE_REQUIRED_ERROR:
421
- return {
422
- primary: {
423
- label: "Upgrade",
424
- onClick: () => window.location.href = "https://copilotkit.ai/"
191
+
192
+ .banner-message {
193
+ color: ${theme.text};
194
+ font-size: 14px;
195
+ line-height: 1.5;
196
+ font-weight: 500;
197
+ flex: 1;
198
+ letter-spacing: -0.01em;
425
199
  }
426
- };
427
- case import_shared2.ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR:
428
- case import_shared2.ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:
429
- case import_shared2.ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR:
430
- return {
431
- primary: {
432
- label: "View Docs",
433
- onClick: () => {
434
- var _a;
435
- const urlFromMessage = extractUrlFromMessage(error2.message);
436
- const urlFromExtensions = (_a = error2.extensions) == null ? void 0 : _a.troubleshootingUrl;
437
- const url = urlFromMessage || urlFromExtensions || "https://docs.copilotkit.ai/troubleshooting/common-issues";
438
- window.open(url, "_blank");
200
+
201
+ .close-btn {
202
+ background: rgba(0, 0, 0, 0.05);
203
+ border: none;
204
+ color: ${theme.text};
205
+ cursor: pointer;
206
+ padding: 0;
207
+ border-radius: 6px;
208
+ opacity: 0.6;
209
+ transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
210
+ font-size: 14px;
211
+ line-height: 1;
212
+ flex-shrink: 0;
213
+ width: 24px;
214
+ height: 24px;
215
+ display: flex;
216
+ align-items: center;
217
+ justify-content: center;
218
+ }
219
+
220
+ .close-btn:hover {
221
+ opacity: 1;
222
+ background: rgba(0, 0, 0, 0.08);
223
+ transform: scale(1.05);
224
+ }
225
+
226
+ .btn-primary {
227
+ background: linear-gradient(135deg, ${theme.accent} 0%, ${theme.accent}e6 100%);
228
+ color: white;
229
+ border: none;
230
+ border-radius: 8px;
231
+ padding: 10px 18px;
232
+ font-size: 13px;
233
+ font-weight: 600;
234
+ cursor: pointer;
235
+ transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
236
+ font-family: inherit;
237
+ flex-shrink: 0;
238
+ box-shadow:
239
+ 0 2px 8px ${theme.accent}30,
240
+ inset 0 1px 0 rgba(255, 255, 255, 0.2);
241
+ letter-spacing: -0.01em;
242
+ }
243
+
244
+ .btn-primary:hover {
245
+ transform: translateY(-1px) scale(1.02);
246
+ box-shadow:
247
+ 0 4px 12px ${theme.accent}40,
248
+ inset 0 1px 0 rgba(255, 255, 255, 0.25);
249
+ }
250
+
251
+ .btn-primary:active {
252
+ transform: translateY(0) scale(0.98);
253
+ transition: all 0.08s cubic-bezier(0.16, 1, 0.3, 1);
254
+ }
255
+
256
+ @media (max-width: 640px) {
257
+ .usage-banner {
258
+ width: calc(100vw - 24px);
259
+ }
260
+
261
+ .banner-content {
262
+ padding: 16px;
263
+ gap: 12px;
264
+ }
265
+
266
+ .banner-message {
267
+ font-size: 13px;
268
+ line-height: 1.45;
269
+ }
270
+
271
+ .btn-primary {
272
+ padding: 8px 14px;
273
+ font-size: 12px;
274
+ }
275
+
276
+ .close-btn {
277
+ width: 22px;
278
+ height: 22px;
279
+ font-size: 12px;
439
280
  }
440
281
  }
441
- };
442
- default:
443
- return void 0;
444
- }
445
- };
446
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
447
- UsageBanner,
448
- {
449
- severity: error.severity || import_shared2.Severity.CRITICAL,
450
- message: error.message,
451
- onClose,
452
- actions: getErrorActions(error)
453
- }
454
- );
282
+ ` }),
283
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "usage-banner", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "banner-content", children: [
284
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "banner-message", children: message }),
285
+ (actions == null ? void 0 : actions.primary) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "btn-primary", onClick: actions.primary.onClick, children: actions.primary.label }),
286
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: "close-btn", onClick: onClose, title: "Close", children: "\xD7" })
287
+ ] }) })
288
+ ] });
455
289
  }
290
+ var getErrorActions = (error) => {
291
+ switch (error.code) {
292
+ case import_shared2.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR:
293
+ return {
294
+ primary: {
295
+ label: "Get Free API Key",
296
+ onClick: () => window.open("https://cloud.copilotkit.ai", "_blank", "noopener,noreferrer")
297
+ }
298
+ };
299
+ case import_shared2.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR:
300
+ return {
301
+ primary: {
302
+ label: "Upgrade",
303
+ onClick: () => window.open("https://cloud.copilotkit.ai", "_blank", "noopener,noreferrer")
304
+ }
305
+ };
306
+ default:
307
+ return void 0;
308
+ }
309
+ };
456
310
 
457
311
  // src/components/error-boundary/error-utils.tsx
458
312
  var import_react2 = require("react");
@@ -603,22 +457,17 @@ var CopilotErrorBoundary = class extends import_react3.default.Component {
603
457
  console.error("CopilotKit Error:", error, errorInfo);
604
458
  }
605
459
  render() {
606
- var _a, _b;
460
+ var _a, _b, _c, _d;
607
461
  if (this.state.hasError) {
608
462
  if (this.state.error instanceof import_shared4.CopilotKitError) {
609
- if (this.state.error.visibility === import_shared4.ErrorVisibility.BANNER) {
610
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(
611
- this.state.error,
612
- () => this.setState({ hasError: false, error: void 0 })
613
- ) });
614
- }
615
463
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
616
464
  this.props.children,
617
465
  this.props.showUsageBanner && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
618
466
  UsageBanner,
619
467
  {
620
- severity: (_a = this.state.status) == null ? void 0 : _a.severity,
621
- message: (_b = this.state.status) == null ? void 0 : _b.message
468
+ severity: (_b = (_a = this.state.status) == null ? void 0 : _a.severity) != null ? _b : this.state.error.severity,
469
+ message: (_d = (_c = this.state.status) == null ? void 0 : _c.message) != null ? _d : this.state.error.message,
470
+ actions: getErrorActions(this.state.error)
622
471
  }
623
472
  )
624
473
  ] });