@copilotkit/react-core 1.9.1-next.0 → 1.9.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{chunk-B5UA5G3E.mjs → chunk-2FW7HH6W.mjs} +12 -8
  3. package/dist/chunk-2FW7HH6W.mjs.map +1 -0
  4. package/dist/{chunk-ERFA53MG.mjs → chunk-6KGEF242.mjs} +2 -2
  5. package/dist/chunk-6KGEF242.mjs.map +1 -0
  6. package/dist/{chunk-2J3SMMGW.mjs → chunk-C6F6EQNA.mjs} +2 -2
  7. package/dist/chunk-CCESTGAM.mjs +102 -0
  8. package/dist/chunk-CCESTGAM.mjs.map +1 -0
  9. package/dist/chunk-GFJW4RIM.mjs +9 -0
  10. package/dist/chunk-GFJW4RIM.mjs.map +1 -0
  11. package/dist/chunk-HD2GE3DK.mjs +359 -0
  12. package/dist/chunk-HD2GE3DK.mjs.map +1 -0
  13. package/dist/{chunk-74AJEJTV.mjs → chunk-HJP2RX5R.mjs} +11 -6
  14. package/dist/chunk-HJP2RX5R.mjs.map +1 -0
  15. package/dist/{chunk-EQ4XLLT4.mjs → chunk-LDACFA2B.mjs} +3 -3
  16. package/dist/{chunk-FGBRHBRR.mjs → chunk-LZDDYZEY.mjs} +2 -2
  17. package/dist/chunk-NNSXCFQO.mjs +154 -0
  18. package/dist/chunk-NNSXCFQO.mjs.map +1 -0
  19. package/dist/{chunk-WZAEVHLK.mjs → chunk-Q5D5XQFA.mjs} +2 -2
  20. package/dist/{chunk-534J55RX.mjs → chunk-QQZLIEXK.mjs} +9 -7
  21. package/dist/chunk-QQZLIEXK.mjs.map +1 -0
  22. package/dist/chunk-RUY6MLHA.mjs +119 -0
  23. package/dist/chunk-RUY6MLHA.mjs.map +1 -0
  24. package/dist/{chunk-MDIIRGJD.mjs → chunk-SGLWMQ2J.mjs} +25 -17
  25. package/dist/chunk-SGLWMQ2J.mjs.map +1 -0
  26. package/dist/{chunk-G27C5EFO.mjs → chunk-T42PN5VN.mjs} +7 -5
  27. package/dist/{chunk-G27C5EFO.mjs.map → chunk-T42PN5VN.mjs.map} +1 -1
  28. package/dist/{chunk-VQ3VTO26.mjs → chunk-UHQMV2CE.mjs} +2 -2
  29. package/dist/{chunk-4DVPRMVH.mjs → chunk-UIT6QMUJ.mjs} +7 -7
  30. package/dist/chunk-VRXANACV.mjs +277 -0
  31. package/dist/chunk-VRXANACV.mjs.map +1 -0
  32. package/dist/{chunk-2FLZLANO.mjs → chunk-XY5BN4HZ.mjs} +19 -12
  33. package/dist/chunk-XY5BN4HZ.mjs.map +1 -0
  34. package/dist/{chunk-7HDYPEWS.mjs → chunk-YDENFEKA.mjs} +2 -2
  35. package/dist/{chunk-4VWM6JNK.mjs → chunk-YZDRMIOM.mjs} +6 -6
  36. package/dist/components/copilot-provider/copilot-messages.js +105 -11
  37. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  38. package/dist/components/copilot-provider/copilot-messages.mjs +4 -2
  39. package/dist/components/copilot-provider/copilotkit-props.d.ts +4 -3
  40. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  41. package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
  42. package/dist/components/copilot-provider/copilotkit.js +863 -441
  43. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  44. package/dist/components/copilot-provider/copilotkit.mjs +10 -9
  45. package/dist/components/copilot-provider/index.d.ts +1 -1
  46. package/dist/components/copilot-provider/index.js +863 -441
  47. package/dist/components/copilot-provider/index.js.map +1 -1
  48. package/dist/components/copilot-provider/index.mjs +10 -9
  49. package/dist/components/error-boundary/error-boundary.js +320 -159
  50. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  51. package/dist/components/error-boundary/error-boundary.mjs +4 -3
  52. package/dist/components/error-boundary/error-utils.js +2 -1
  53. package/dist/components/error-boundary/error-utils.js.map +1 -1
  54. package/dist/components/error-boundary/error-utils.mjs +2 -1
  55. package/dist/components/index.d.ts +1 -1
  56. package/dist/components/index.js +863 -441
  57. package/dist/components/index.js.map +1 -1
  58. package/dist/components/index.mjs +10 -9
  59. package/dist/components/toast/toast-provider.d.ts +9 -12
  60. package/dist/components/toast/toast-provider.js +218 -191
  61. package/dist/components/toast/toast-provider.js.map +1 -1
  62. package/dist/components/toast/toast-provider.mjs +1 -2
  63. package/dist/components/usage-banner.d.ts +3 -2
  64. package/dist/components/usage-banner.js +311 -153
  65. package/dist/components/usage-banner.js.map +1 -1
  66. package/dist/components/usage-banner.mjs +1 -1
  67. package/dist/context/copilot-context.d.ts +1 -1
  68. package/dist/context/copilot-context.js +1 -1
  69. package/dist/context/copilot-context.js.map +1 -1
  70. package/dist/context/copilot-context.mjs +1 -1
  71. package/dist/context/index.d.ts +1 -1
  72. package/dist/context/index.js +1 -1
  73. package/dist/context/index.js.map +1 -1
  74. package/dist/context/index.mjs +1 -1
  75. package/dist/{copilot-context-309906bb.d.ts → copilot-context-f9b2b4c3.d.ts} +1 -1
  76. package/dist/hooks/index.d.ts +1 -1
  77. package/dist/hooks/index.js +160 -75
  78. package/dist/hooks/index.js.map +1 -1
  79. package/dist/hooks/index.mjs +33 -32
  80. package/dist/hooks/use-chat.d.ts +1 -1
  81. package/dist/hooks/use-chat.js +243 -68
  82. package/dist/hooks/use-chat.js.map +1 -1
  83. package/dist/hooks/use-chat.mjs +6 -3
  84. package/dist/hooks/use-coagent-state-render.js +10 -5
  85. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  86. package/dist/hooks/use-coagent-state-render.mjs +3 -4
  87. package/dist/hooks/use-coagent.d.ts +1 -1
  88. package/dist/hooks/use-coagent.js +148 -67
  89. package/dist/hooks/use-coagent.js.map +1 -1
  90. package/dist/hooks/use-coagent.mjs +14 -13
  91. package/dist/hooks/use-copilot-action.js +5 -4
  92. package/dist/hooks/use-copilot-action.js.map +1 -1
  93. package/dist/hooks/use-copilot-action.mjs +4 -3
  94. package/dist/hooks/use-copilot-additional-instructions.js +1 -1
  95. package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
  96. package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
  97. package/dist/hooks/use-copilot-authenticated-action.js +5 -4
  98. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  99. package/dist/hooks/use-copilot-authenticated-action.mjs +5 -4
  100. package/dist/hooks/use-copilot-chat.d.ts +1 -1
  101. package/dist/hooks/use-copilot-chat.js +138 -62
  102. package/dist/hooks/use-copilot-chat.js.map +1 -1
  103. package/dist/hooks/use-copilot-chat.mjs +13 -12
  104. package/dist/hooks/use-copilot-readable.js +1 -1
  105. package/dist/hooks/use-copilot-readable.js.map +1 -1
  106. package/dist/hooks/use-copilot-readable.mjs +2 -2
  107. package/dist/hooks/use-copilot-runtime-client.d.ts +5 -2
  108. package/dist/hooks/use-copilot-runtime-client.js +101 -128
  109. package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
  110. package/dist/hooks/use-copilot-runtime-client.mjs +3 -3
  111. package/dist/hooks/use-langgraph-interrupt-render.js +1 -1
  112. package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
  113. package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
  114. package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
  115. package/dist/hooks/use-langgraph-interrupt.js +140 -64
  116. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  117. package/dist/hooks/use-langgraph-interrupt.mjs +14 -13
  118. package/dist/hooks/use-make-copilot-document-readable.js +1 -1
  119. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  120. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  121. package/dist/index.d.ts +1 -1
  122. package/dist/index.js +913 -480
  123. package/dist/index.js.map +1 -1
  124. package/dist/index.mjs +35 -34
  125. package/dist/lib/copilot-task.d.ts +1 -1
  126. package/dist/lib/copilot-task.js.map +1 -1
  127. package/dist/lib/copilot-task.mjs +11 -10
  128. package/dist/lib/index.d.ts +1 -1
  129. package/dist/lib/index.js.map +1 -1
  130. package/dist/lib/index.mjs +11 -10
  131. package/dist/types/interrupt-action.d.ts +1 -1
  132. package/dist/utils/dev-console.d.ts +1 -1
  133. package/dist/utils/dev-console.js +1 -10
  134. package/dist/utils/dev-console.js.map +1 -1
  135. package/dist/utils/dev-console.mjs +1 -1
  136. package/dist/utils/extract.d.ts +1 -1
  137. package/dist/utils/extract.js.map +1 -1
  138. package/dist/utils/extract.mjs +10 -9
  139. package/dist/utils/index.d.ts +1 -1
  140. package/dist/utils/index.js +7 -14
  141. package/dist/utils/index.js.map +1 -1
  142. package/dist/utils/index.mjs +12 -11
  143. package/package.json +3 -3
  144. package/src/components/copilot-provider/copilot-messages.tsx +163 -4
  145. package/src/components/copilot-provider/copilotkit-props.tsx +3 -2
  146. package/src/components/copilot-provider/copilotkit.tsx +8 -2
  147. package/src/components/error-boundary/error-boundary.tsx +6 -5
  148. package/src/components/error-boundary/error-utils.tsx +1 -1
  149. package/src/components/toast/toast-provider.tsx +260 -93
  150. package/src/components/usage-banner.tsx +311 -131
  151. package/src/context/copilot-context.tsx +2 -2
  152. package/src/hooks/use-chat.ts +4 -0
  153. package/src/hooks/use-coagent-state-render.ts +9 -3
  154. package/src/hooks/use-coagent.ts +10 -3
  155. package/src/hooks/use-copilot-runtime-client.ts +153 -12
  156. package/src/utils/dev-console.ts +2 -17
  157. package/dist/chunk-22ENANUU.mjs +0 -250
  158. package/dist/chunk-22ENANUU.mjs.map +0 -1
  159. package/dist/chunk-2FLZLANO.mjs.map +0 -1
  160. package/dist/chunk-534J55RX.mjs.map +0 -1
  161. package/dist/chunk-6PK72HMH.mjs +0 -63
  162. package/dist/chunk-6PK72HMH.mjs.map +0 -1
  163. package/dist/chunk-74AJEJTV.mjs.map +0 -1
  164. package/dist/chunk-B5UA5G3E.mjs.map +0 -1
  165. package/dist/chunk-BKTARDXX.mjs +0 -40
  166. package/dist/chunk-BKTARDXX.mjs.map +0 -1
  167. package/dist/chunk-D34OH4VN.mjs +0 -201
  168. package/dist/chunk-D34OH4VN.mjs.map +0 -1
  169. package/dist/chunk-ERFA53MG.mjs.map +0 -1
  170. package/dist/chunk-MDIIRGJD.mjs.map +0 -1
  171. package/dist/chunk-MLAS4QUR.mjs +0 -18
  172. package/dist/chunk-MLAS4QUR.mjs.map +0 -1
  173. /package/dist/{chunk-2J3SMMGW.mjs.map → chunk-C6F6EQNA.mjs.map} +0 -0
  174. /package/dist/{chunk-EQ4XLLT4.mjs.map → chunk-LDACFA2B.mjs.map} +0 -0
  175. /package/dist/{chunk-FGBRHBRR.mjs.map → chunk-LZDDYZEY.mjs.map} +0 -0
  176. /package/dist/{chunk-WZAEVHLK.mjs.map → chunk-Q5D5XQFA.mjs.map} +0 -0
  177. /package/dist/{chunk-VQ3VTO26.mjs.map → chunk-UHQMV2CE.mjs.map} +0 -0
  178. /package/dist/{chunk-4DVPRMVH.mjs.map → chunk-UIT6QMUJ.mjs.map} +0 -0
  179. /package/dist/{chunk-7HDYPEWS.mjs.map → chunk-YDENFEKA.mjs.map} +0 -0
  180. /package/dist/{chunk-4VWM6JNK.mjs.map → chunk-YZDRMIOM.mjs.map} +0 -0
@@ -55,7 +55,7 @@ __export(error_boundary_exports, {
55
55
  });
56
56
  module.exports = __toCommonJS(error_boundary_exports);
57
57
  var import_react3 = __toESM(require("react"));
58
- var import_shared3 = require("@copilotkit/shared");
58
+ var import_shared4 = require("@copilotkit/shared");
59
59
 
60
60
  // src/lib/status-checker.ts
61
61
  var import_shared = require("@copilotkit/shared");
@@ -115,14 +115,14 @@ var StatusChecker = class {
115
115
  var import_shared2 = require("@copilotkit/shared");
116
116
  var import_jsx_runtime = require("react/jsx-runtime");
117
117
  var defaultIcons = {
118
- [import_shared2.Severity.Error]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
118
+ [import_shared2.Severity.CRITICAL]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
119
119
  "svg",
120
120
  {
121
121
  viewBox: "0 0 24 24",
122
- width: "20",
123
- height: "20",
122
+ width: "18",
123
+ height: "18",
124
124
  stroke: "currentColor",
125
- strokeWidth: "2",
125
+ strokeWidth: "2.5",
126
126
  fill: "none",
127
127
  strokeLinecap: "round",
128
128
  strokeLinejoin: "round",
@@ -132,179 +132,337 @@ var defaultIcons = {
132
132
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
133
133
  ]
134
134
  }
135
+ ),
136
+ [import_shared2.Severity.WARNING]: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
137
+ "svg",
138
+ {
139
+ viewBox: "0 0 24 24",
140
+ width: "18",
141
+ height: "18",
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: "18",
159
+ height: "18",
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
+ }
135
171
  )
136
172
  };
137
173
  function UsageBanner({
138
- severity = import_shared2.Severity.Error,
174
+ severity = import_shared2.Severity.CRITICAL,
139
175
  message = "",
140
176
  icon,
177
+ onClose,
141
178
  actions
142
179
  }) {
143
180
  if (!message || !severity) {
144
181
  return null;
145
182
  }
183
+ const parseMessage = (rawMessage) => {
184
+ const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
185
+ const matches = Array.from(rawMessage.matchAll(linkRegex));
186
+ if (matches.length > 0) {
187
+ let cleanMessage2 = rawMessage.replace(/\.\s*See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, ".").replace(/See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, "").trim();
188
+ return cleanMessage2;
189
+ }
190
+ return rawMessage;
191
+ };
192
+ const cleanMessage = parseMessage(message);
146
193
  const Icon = icon || defaultIcons[severity];
147
- const bgColor = {
148
- info: "#dbeafe",
149
- warning: "#fef3c7",
150
- error: "#fee2e2"
151
- }[severity];
152
- const textColor = {
153
- info: "#1e40af",
154
- warning: "#854d0e",
155
- error: "#991b1b"
156
- }[severity];
157
- const iconColor = {
158
- info: "#3b82f6",
159
- warning: "#eab308",
160
- error: "#ef4444"
161
- }[severity];
162
- const primaryButtonColor = {
163
- info: "#3b82f6",
164
- warning: "#eab308",
165
- error: "#ef4444"
166
- }[severity];
167
- const primaryButtonHoverColor = {
168
- info: "#2563eb",
169
- warning: "#ca8a04",
170
- error: "#dc2626"
171
- }[severity];
172
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
194
+ const themeConfigs = {
195
+ [import_shared2.Severity.INFO]: {
196
+ bg: "linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)",
197
+ border: "#93c5fd",
198
+ text: "#1e40af",
199
+ icon: "#3b82f6",
200
+ primaryBtn: "#3b82f6",
201
+ primaryBtnHover: "#2563eb"
202
+ },
203
+ [import_shared2.Severity.WARNING]: {
204
+ bg: "linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)",
205
+ border: "#fbbf24",
206
+ text: "#92400e",
207
+ icon: "#f59e0b",
208
+ primaryBtn: "#f59e0b",
209
+ primaryBtnHover: "#d97706"
210
+ },
211
+ [import_shared2.Severity.CRITICAL]: {
212
+ bg: "linear-gradient(135deg, #fef2f2 0%, #fecaca 100%)",
213
+ border: "#f87171",
214
+ text: "#991b1b",
215
+ icon: "#ef4444",
216
+ primaryBtn: "#ef4444",
217
+ primaryBtnHover: "#dc2626"
218
+ }
219
+ };
220
+ const themeConfig = themeConfigs[severity] || themeConfigs[import_shared2.Severity.CRITICAL];
221
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
173
222
  "div",
174
223
  {
175
224
  style: {
176
225
  position: "fixed",
177
- bottom: "16px",
226
+ bottom: "20px",
178
227
  left: "50%",
179
228
  transform: "translateX(-50%)",
180
- maxWidth: "90%",
181
- zIndex: 9999
229
+ maxWidth: "min(95vw, 680px)",
230
+ width: "100%",
231
+ zIndex: 1e4,
232
+ animation: "bannerSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
182
233
  },
183
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
184
- "div",
185
- {
186
- style: {
187
- display: "flex",
188
- flexWrap: "wrap",
189
- alignItems: "center",
190
- gap: "12px",
191
- borderRadius: "9999px",
192
- border: "1px solid #e5e7eb",
193
- backgroundColor: bgColor,
194
- padding: "8px 16px",
195
- boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1)"
196
- },
197
- children: [
198
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { color: iconColor }, children: Icon }),
199
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
200
- "span",
201
- {
202
- style: {
203
- flex: 1,
204
- fontSize: "14px",
205
- fontWeight: 500,
206
- color: textColor,
207
- whiteSpace: "normal",
208
- wordBreak: "break-word"
209
- },
210
- children: message
211
- }
212
- ),
213
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
214
- "div",
215
- {
216
- style: {
217
- display: "flex",
218
- gap: "8px",
219
- flexWrap: "wrap"
220
- },
221
- children: [
222
- (actions == null ? void 0 : actions.secondary) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
- "button",
224
- {
225
- onClick: actions.secondary.onClick,
226
- style: {
227
- borderRadius: "9999px",
228
- padding: "4px 12px",
229
- fontSize: "14px",
230
- fontWeight: 500,
231
- color: textColor,
232
- backgroundColor: "transparent",
233
- border: "none",
234
- cursor: "pointer",
235
- transition: "background-color 0.2s"
236
- },
237
- onMouseOver: (e) => e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.5)",
238
- onMouseOut: (e) => e.currentTarget.style.backgroundColor = "transparent",
239
- children: actions.secondary.label
240
- }
241
- ),
242
- (actions == null ? void 0 : actions.primary) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
243
- "button",
244
- {
245
- onClick: actions.primary.onClick,
246
- style: {
247
- borderRadius: "9999px",
248
- padding: "4px 12px",
249
- fontSize: "14px",
250
- fontWeight: 500,
251
- color: "#fff",
252
- backgroundColor: primaryButtonColor,
253
- border: "none",
254
- cursor: "pointer",
255
- transition: "background-color 0.2s"
256
- },
257
- onMouseOver: (e) => e.currentTarget.style.backgroundColor = primaryButtonHoverColor,
258
- onMouseOut: (e) => e.currentTarget.style.backgroundColor = primaryButtonColor,
259
- children: actions.primary.label
260
- }
261
- )
262
- ]
263
- }
264
- )
265
- ]
266
- }
267
- )
234
+ children: [
235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
236
+ @keyframes bannerSlideIn {
237
+ from {
238
+ opacity: 0;
239
+ transform: translateX(-50%) translateY(10px);
240
+ }
241
+ to {
242
+ opacity: 1;
243
+ transform: translateX(-50%) translateY(0);
244
+ }
245
+ }
246
+ ` }),
247
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
248
+ "div",
249
+ {
250
+ style: {
251
+ display: "flex",
252
+ alignItems: "flex-start",
253
+ gap: "14px",
254
+ borderRadius: "16px",
255
+ border: `1px solid ${themeConfig.border}`,
256
+ background: themeConfig.bg,
257
+ padding: "18px 20px",
258
+ boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
259
+ position: "relative",
260
+ backdropFilter: "blur(10px)",
261
+ WebkitBackdropFilter: "blur(10px)"
262
+ },
263
+ children: [
264
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
265
+ "button",
266
+ {
267
+ onClick: onClose,
268
+ style: {
269
+ position: "absolute",
270
+ top: "12px",
271
+ right: "12px",
272
+ background: "rgba(255, 255, 255, 0.8)",
273
+ border: "none",
274
+ color: themeConfig.text,
275
+ cursor: "pointer",
276
+ fontSize: "18px",
277
+ lineHeight: "1",
278
+ padding: "6px",
279
+ borderRadius: "8px",
280
+ opacity: 0.7,
281
+ transition: "all 0.2s ease",
282
+ display: "flex",
283
+ alignItems: "center",
284
+ justifyContent: "center",
285
+ width: "28px",
286
+ height: "28px"
287
+ },
288
+ title: "Close",
289
+ onMouseOver: (e) => {
290
+ e.currentTarget.style.opacity = "1";
291
+ e.currentTarget.style.background = "rgba(255, 255, 255, 1)";
292
+ e.currentTarget.style.transform = "scale(1.05)";
293
+ },
294
+ onMouseOut: (e) => {
295
+ e.currentTarget.style.opacity = "0.7";
296
+ e.currentTarget.style.background = "rgba(255, 255, 255, 0.8)";
297
+ e.currentTarget.style.transform = "scale(1)";
298
+ },
299
+ children: "\xD7"
300
+ }
301
+ ),
302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
303
+ "div",
304
+ {
305
+ style: {
306
+ color: themeConfig.icon,
307
+ flexShrink: 0,
308
+ marginTop: "1px",
309
+ padding: "6px",
310
+ borderRadius: "10px",
311
+ background: "rgba(255, 255, 255, 0.7)",
312
+ display: "flex",
313
+ alignItems: "center",
314
+ justifyContent: "center"
315
+ },
316
+ children: Icon
317
+ }
318
+ ),
319
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { flex: 1, paddingRight: onClose ? "40px" : "0" }, children: [
320
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
321
+ "div",
322
+ {
323
+ style: {
324
+ fontSize: "15px",
325
+ fontWeight: 600,
326
+ color: themeConfig.text,
327
+ lineHeight: "1.5",
328
+ marginBottom: actions ? "12px" : "0",
329
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
330
+ },
331
+ children: cleanMessage
332
+ }
333
+ ),
334
+ actions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
335
+ "div",
336
+ {
337
+ style: {
338
+ display: "flex",
339
+ gap: "10px",
340
+ flexWrap: "wrap"
341
+ },
342
+ children: [
343
+ actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
344
+ "button",
345
+ {
346
+ onClick: actions.secondary.onClick,
347
+ style: {
348
+ borderRadius: "10px",
349
+ padding: "8px 16px",
350
+ fontSize: "14px",
351
+ fontWeight: 500,
352
+ color: themeConfig.text,
353
+ backgroundColor: "rgba(255, 255, 255, 0.8)",
354
+ border: `1.5px solid ${themeConfig.border}`,
355
+ cursor: "pointer",
356
+ transition: "all 0.2s ease",
357
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
358
+ },
359
+ onMouseOver: (e) => {
360
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
361
+ e.currentTarget.style.transform = "translateY(-1px)";
362
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
363
+ },
364
+ onMouseOut: (e) => {
365
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
366
+ e.currentTarget.style.transform = "translateY(0)";
367
+ e.currentTarget.style.boxShadow = "none";
368
+ },
369
+ children: actions.secondary.label
370
+ }
371
+ ),
372
+ actions.primary && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
373
+ "button",
374
+ {
375
+ onClick: actions.primary.onClick,
376
+ style: {
377
+ borderRadius: "10px",
378
+ padding: "8px 16px",
379
+ fontSize: "14px",
380
+ fontWeight: 600,
381
+ color: "#fff",
382
+ backgroundColor: themeConfig.primaryBtn,
383
+ border: "none",
384
+ cursor: "pointer",
385
+ transition: "all 0.2s ease",
386
+ boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
387
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
388
+ },
389
+ onMouseOver: (e) => {
390
+ e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
391
+ e.currentTarget.style.transform = "translateY(-1px)";
392
+ e.currentTarget.style.boxShadow = "0 6px 16px rgba(0, 0, 0, 0.2)";
393
+ },
394
+ onMouseOut: (e) => {
395
+ e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
396
+ e.currentTarget.style.transform = "translateY(0)";
397
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
398
+ },
399
+ children: actions.primary.label
400
+ }
401
+ )
402
+ ]
403
+ }
404
+ )
405
+ ] })
406
+ ]
407
+ }
408
+ )
409
+ ]
268
410
  }
269
411
  );
270
412
  }
271
- function renderCopilotKitUsage(error) {
272
- switch (error.name) {
273
- case import_shared2.ERROR_NAMES.CONFIGURATION_ERROR:
274
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UsageBanner, { severity: error.severity, message: error.message });
275
- case import_shared2.ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:
276
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
277
- UsageBanner,
278
- {
279
- severity: error.severity,
280
- message: error.message,
281
- actions: {
282
- primary: {
283
- label: "Sign In",
284
- onClick: () => {
285
- window.location.href = "https://cloud.copilotkit.ai";
286
- }
287
- }
413
+ function renderCopilotKitUsage(error, onClose) {
414
+ if (error.visibility !== import_shared2.ErrorVisibility.BANNER) {
415
+ return null;
416
+ }
417
+ const extractUrlFromMessage = (message) => {
418
+ const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
419
+ const match = linkRegex.exec(message);
420
+ return match ? match[2] : null;
421
+ };
422
+ const getErrorActions = (error2) => {
423
+ switch (error2.name) {
424
+ case import_shared2.ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:
425
+ return {
426
+ primary: {
427
+ label: "Sign In",
428
+ onClick: () => window.location.href = "https://cloud.copilotkit.ai"
288
429
  }
289
- }
290
- );
291
- case import_shared2.ERROR_NAMES.UPGRADE_REQUIRED_ERROR:
292
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
293
- UsageBanner,
294
- {
295
- severity: error.severity,
296
- message: error.message,
297
- actions: {
298
- primary: {
299
- label: "Upgrade",
300
- onClick: () => {
301
- window.location.href = "https://copilotkit.ai/";
302
- }
430
+ };
431
+ case import_shared2.ERROR_NAMES.UPGRADE_REQUIRED_ERROR:
432
+ return {
433
+ primary: {
434
+ label: "Upgrade",
435
+ onClick: () => window.location.href = "https://copilotkit.ai/"
436
+ }
437
+ };
438
+ case import_shared2.ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR:
439
+ case import_shared2.ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:
440
+ case import_shared2.ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR:
441
+ return {
442
+ primary: {
443
+ label: "View Docs",
444
+ onClick: () => {
445
+ var _a;
446
+ const urlFromMessage = extractUrlFromMessage(error2.message);
447
+ const urlFromExtensions = (_a = error2.extensions) == null ? void 0 : _a.troubleshootingUrl;
448
+ const url = urlFromMessage || urlFromExtensions || "https://docs.copilotkit.ai/troubleshooting/common-issues";
449
+ window.open(url, "_blank");
303
450
  }
304
451
  }
305
- }
306
- );
307
- }
452
+ };
453
+ default:
454
+ return void 0;
455
+ }
456
+ };
457
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
458
+ UsageBanner,
459
+ {
460
+ severity: error.severity || import_shared2.Severity.CRITICAL,
461
+ message: error.message,
462
+ onClose,
463
+ actions: getErrorActions(error)
464
+ }
465
+ );
308
466
  }
309
467
 
310
468
  // src/components/error-boundary/error-utils.tsx
@@ -312,6 +470,7 @@ var import_react2 = require("react");
312
470
 
313
471
  // src/components/toast/toast-provider.tsx
314
472
  var import_react = require("react");
473
+ var import_shared3 = require("@copilotkit/shared");
315
474
  var import_jsx_runtime2 = require("react/jsx-runtime");
316
475
  var ToastContext = (0, import_react.createContext)(void 0);
317
476
  function useToast() {
@@ -375,7 +534,7 @@ function ErrorToast({ errors }) {
375
534
  marginBottom: 4
376
535
  },
377
536
  children: [
378
- "Copilot Cloud Error:",
537
+ "Copilot Runtime Error:",
379
538
  " ",
380
539
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
381
540
  ]
@@ -423,7 +582,6 @@ function useErrorToast() {
423
582
  }
424
583
 
425
584
  // src/components/error-boundary/error-boundary.tsx
426
- var import_shared4 = require("@copilotkit/shared");
427
585
  var import_jsx_runtime5 = require("react/jsx-runtime");
428
586
  var statusChecker = new StatusChecker();
429
587
  var CopilotErrorBoundary = class extends import_react3.default.Component {
@@ -458,9 +616,12 @@ var CopilotErrorBoundary = class extends import_react3.default.Component {
458
616
  render() {
459
617
  var _a, _b;
460
618
  if (this.state.hasError) {
461
- if (this.state.error instanceof import_shared3.CopilotKitError) {
462
- if (import_shared4.COPILOT_CLOUD_ERROR_NAMES.includes(this.state.error.name)) {
463
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(this.state.error) });
619
+ if (this.state.error instanceof import_shared4.CopilotKitError) {
620
+ if (this.state.error.visibility === import_shared4.ErrorVisibility.BANNER) {
621
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(
622
+ this.state.error,
623
+ () => this.setState({ hasError: false, error: void 0 })
624
+ ) });
464
625
  }
465
626
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
466
627
  this.props.children,