@copilotkit/react-core 1.10.0-next.0 → 1.10.0-next.10

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 (207) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/{chunk-YVBDAURK.mjs → chunk-2TSNHEIS.mjs} +6 -6
  3. package/dist/chunk-2TSNHEIS.mjs.map +1 -0
  4. package/dist/{chunk-DF4YG4PF.mjs → chunk-3RHHNUVV.mjs} +2 -2
  5. package/dist/{chunk-LNAQ7JG3.mjs → chunk-6EKLRL7B.mjs} +2 -2
  6. package/dist/{chunk-O5KV32S5.mjs → chunk-ADZDXHVC.mjs} +2 -2
  7. package/dist/{chunk-4CFY3CON.mjs → chunk-CLMDRYEN.mjs} +2 -2
  8. package/dist/{chunk-G35QHAQ6.mjs → chunk-COEUPDRL.mjs} +20 -21
  9. package/dist/chunk-COEUPDRL.mjs.map +1 -0
  10. package/dist/{chunk-RGKZCCPA.mjs → chunk-DLEXVOQE.mjs} +5 -5
  11. package/dist/{chunk-YAF2LATQ.mjs → chunk-EFL5OBKN.mjs} +1 -1
  12. package/dist/chunk-EFL5OBKN.mjs.map +1 -0
  13. package/dist/{chunk-JWAXDYOW.mjs → chunk-FAUNHSQU.mjs} +3 -3
  14. package/dist/chunk-ICIK2BSB.mjs +17 -0
  15. package/dist/chunk-ICIK2BSB.mjs.map +1 -0
  16. package/dist/chunk-IHAZJF3V.mjs +34 -0
  17. package/dist/chunk-IHAZJF3V.mjs.map +1 -0
  18. package/dist/{chunk-Q6FZZJ5A.mjs → chunk-IN7GE4NO.mjs} +2 -2
  19. package/dist/{chunk-YSQ5I2AE.mjs → chunk-JBLMXZ3O.mjs} +7 -7
  20. package/dist/{chunk-PZXTDFMX.mjs → chunk-JJDXTTEN.mjs} +3 -3
  21. package/dist/chunk-KDAZGZ24.mjs +1 -0
  22. package/dist/{chunk-LIGLZ53V.mjs → chunk-L6HQIJ74.mjs} +29 -13
  23. package/dist/chunk-L6HQIJ74.mjs.map +1 -0
  24. package/dist/{chunk-NAM55D5I.mjs → chunk-LVWV62JZ.mjs} +39 -26
  25. package/dist/chunk-LVWV62JZ.mjs.map +1 -0
  26. package/dist/{chunk-3OQM3NEK.mjs → chunk-N4WEHORG.mjs} +2 -2
  27. package/dist/chunk-OKRZF3DD.mjs +225 -0
  28. package/dist/chunk-OKRZF3DD.mjs.map +1 -0
  29. package/dist/{chunk-SJJNFYGQ.mjs → chunk-Q42NJFXR.mjs} +9 -14
  30. package/dist/chunk-Q42NJFXR.mjs.map +1 -0
  31. package/dist/chunk-QGE7U4NV.mjs +85 -0
  32. package/dist/chunk-QGE7U4NV.mjs.map +1 -0
  33. package/dist/{chunk-XGRBCWK6.mjs → chunk-TEMLWRRT.mjs} +3 -3
  34. package/dist/chunk-TEMLWRRT.mjs.map +1 -0
  35. package/dist/{chunk-YBDRISKO.mjs → chunk-TWYUYC4F.mjs} +43 -9
  36. package/dist/chunk-TWYUYC4F.mjs.map +1 -0
  37. package/dist/{chunk-LU5JPZ24.mjs → chunk-X2DNXTME.mjs} +6 -6
  38. package/dist/chunk-X2DNXTME.mjs.map +1 -0
  39. package/dist/{chunk-DCTJZ742.mjs → chunk-ZLQVRPDS.mjs} +5 -2
  40. package/dist/chunk-ZLQVRPDS.mjs.map +1 -0
  41. package/dist/components/copilot-provider/copilot-messages.d.ts +17 -1
  42. package/dist/components/copilot-provider/copilot-messages.js +46 -7
  43. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  44. package/dist/components/copilot-provider/copilot-messages.mjs +11 -7
  45. package/dist/components/copilot-provider/copilotkit-props.d.ts +5 -3
  46. package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
  47. package/dist/components/copilot-provider/copilotkit.d.ts +1 -2
  48. package/dist/components/copilot-provider/copilotkit.js +337 -555
  49. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  50. package/dist/components/copilot-provider/copilotkit.mjs +11 -11
  51. package/dist/components/copilot-provider/index.d.ts +1 -2
  52. package/dist/components/copilot-provider/index.js +337 -555
  53. package/dist/components/copilot-provider/index.js.map +1 -1
  54. package/dist/components/copilot-provider/index.mjs +11 -11
  55. package/dist/components/error-boundary/error-boundary.js +176 -323
  56. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  57. package/dist/components/error-boundary/error-boundary.mjs +4 -4
  58. package/dist/components/error-boundary/error-utils.js.map +1 -1
  59. package/dist/components/error-boundary/error-utils.mjs +2 -2
  60. package/dist/components/index.d.ts +1 -2
  61. package/dist/components/index.js +337 -555
  62. package/dist/components/index.js.map +1 -1
  63. package/dist/components/index.mjs +11 -11
  64. package/dist/components/toast/toast-provider.js.map +1 -1
  65. package/dist/components/toast/toast-provider.mjs +1 -1
  66. package/dist/components/usage-banner.d.ts +10 -4
  67. package/dist/components/usage-banner.js +176 -302
  68. package/dist/components/usage-banner.js.map +1 -1
  69. package/dist/components/usage-banner.mjs +3 -1
  70. package/dist/context/copilot-context.d.ts +1 -2
  71. package/dist/context/copilot-context.js +2 -2
  72. package/dist/context/copilot-context.js.map +1 -1
  73. package/dist/context/copilot-context.mjs +1 -1
  74. package/dist/context/copilot-messages-context.d.ts +11 -15
  75. package/dist/context/copilot-messages-context.js +4 -1
  76. package/dist/context/copilot-messages-context.js.map +1 -1
  77. package/dist/context/copilot-messages-context.mjs +1 -1
  78. package/dist/context/index.d.ts +2 -2
  79. package/dist/context/index.js +6 -3
  80. package/dist/context/index.js.map +1 -1
  81. package/dist/context/index.mjs +2 -2
  82. package/dist/{copilot-context-bd88d30d.d.ts → copilot-context-256f9020.d.ts} +4 -22
  83. package/dist/hooks/index.d.ts +7 -5
  84. package/dist/hooks/index.js +250 -122
  85. package/dist/hooks/index.js.map +1 -1
  86. package/dist/hooks/index.mjs +32 -24
  87. package/dist/hooks/use-chat.d.ts +1 -2
  88. package/dist/hooks/use-chat.js +11 -3
  89. package/dist/hooks/use-chat.js.map +1 -1
  90. package/dist/hooks/use-chat.mjs +6 -6
  91. package/dist/hooks/use-coagent-state-render.js +2 -2
  92. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  93. package/dist/hooks/use-coagent-state-render.mjs +3 -3
  94. package/dist/hooks/use-coagent.d.ts +4 -5
  95. package/dist/hooks/use-coagent.js +114 -81
  96. package/dist/hooks/use-coagent.js.map +1 -1
  97. package/dist/hooks/use-coagent.mjs +15 -15
  98. package/dist/hooks/use-copilot-action.d.ts +1 -1
  99. package/dist/hooks/use-copilot-action.js +2 -2
  100. package/dist/hooks/use-copilot-action.js.map +1 -1
  101. package/dist/hooks/use-copilot-action.mjs +4 -4
  102. package/dist/hooks/use-copilot-additional-instructions.js +2 -2
  103. package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
  104. package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
  105. package/dist/hooks/use-copilot-authenticated-action.js +2 -2
  106. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  107. package/dist/hooks/use-copilot-authenticated-action.mjs +5 -5
  108. package/dist/hooks/use-copilot-chat-headless_c.d.ts +33 -0
  109. package/dist/hooks/use-copilot-chat-headless_c.js +1837 -0
  110. package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -0
  111. package/dist/hooks/use-copilot-chat-headless_c.mjs +31 -0
  112. package/dist/hooks/use-copilot-chat-headless_c.mjs.map +1 -0
  113. package/dist/hooks/use-copilot-chat.d.ts +52 -82
  114. package/dist/hooks/use-copilot-chat.js +60 -13
  115. package/dist/hooks/use-copilot-chat.js.map +1 -1
  116. package/dist/hooks/use-copilot-chat.mjs +15 -16
  117. package/dist/hooks/use-copilot-chat_internal.d.ts +177 -0
  118. package/dist/hooks/use-copilot-chat_internal.js +1770 -0
  119. package/dist/hooks/use-copilot-chat_internal.js.map +1 -0
  120. package/dist/hooks/use-copilot-chat_internal.mjs +29 -0
  121. package/dist/hooks/use-copilot-chat_internal.mjs.map +1 -0
  122. package/dist/hooks/use-copilot-readable.js +2 -2
  123. package/dist/hooks/use-copilot-readable.js.map +1 -1
  124. package/dist/hooks/use-copilot-readable.mjs +2 -2
  125. package/dist/hooks/use-copilot-runtime-client.js +9 -1
  126. package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
  127. package/dist/hooks/use-copilot-runtime-client.mjs +3 -3
  128. package/dist/hooks/use-langgraph-interrupt-render.js +2 -2
  129. package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
  130. package/dist/hooks/use-langgraph-interrupt-render.mjs +3 -3
  131. package/dist/hooks/use-langgraph-interrupt.d.ts +3 -4
  132. package/dist/hooks/use-langgraph-interrupt.js +32 -11
  133. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  134. package/dist/hooks/use-langgraph-interrupt.mjs +15 -15
  135. package/dist/hooks/use-make-copilot-document-readable.js +2 -2
  136. package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
  137. package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
  138. package/dist/index-08c43df1.d.ts +36 -0
  139. package/dist/index.d.ts +5 -3
  140. package/dist/index.js +460 -471
  141. package/dist/index.js.map +1 -1
  142. package/dist/index.mjs +34 -26
  143. package/dist/lib/copilot-task.d.ts +1 -2
  144. package/dist/lib/copilot-task.js.map +1 -1
  145. package/dist/lib/copilot-task.mjs +12 -12
  146. package/dist/lib/index.d.ts +1 -2
  147. package/dist/lib/index.js.map +1 -1
  148. package/dist/lib/index.mjs +12 -12
  149. package/dist/types/interrupt-action.d.ts +2 -3
  150. package/dist/utils/dev-console.d.ts +1 -1
  151. package/dist/utils/dev-console.js +9 -1
  152. package/dist/utils/dev-console.js.map +1 -1
  153. package/dist/utils/dev-console.mjs +1 -1
  154. package/dist/utils/extract.d.ts +2 -2
  155. package/dist/utils/extract.js.map +1 -1
  156. package/dist/utils/extract.mjs +11 -11
  157. package/dist/utils/index.d.ts +3 -3
  158. package/dist/utils/index.js +9 -1
  159. package/dist/utils/index.js.map +1 -1
  160. package/dist/utils/index.mjs +11 -11
  161. package/dist/utils/suggestions.d.ts +2 -2
  162. package/dist/utils/suggestions.js.map +1 -1
  163. package/dist/utils/suggestions.mjs +11 -11
  164. package/package.json +3 -3
  165. package/src/components/copilot-provider/copilot-messages.tsx +57 -1
  166. package/src/components/copilot-provider/copilotkit-props.tsx +4 -1
  167. package/src/components/copilot-provider/copilotkit.tsx +20 -10
  168. package/src/components/error-boundary/error-boundary.tsx +5 -15
  169. package/src/components/toast/toast-provider.tsx +1 -3
  170. package/src/components/usage-banner.tsx +193 -316
  171. package/src/context/copilot-context.tsx +12 -6
  172. package/src/context/copilot-messages-context.tsx +7 -1
  173. package/src/hooks/__tests__/use-coagent-config.test.ts +8 -1
  174. package/src/hooks/index.ts +7 -2
  175. package/src/hooks/use-coagent.ts +18 -20
  176. package/src/hooks/use-copilot-action.ts +1 -1
  177. package/src/hooks/use-copilot-chat-headless_c.ts +187 -0
  178. package/src/hooks/use-copilot-chat.ts +64 -495
  179. package/src/hooks/use-copilot-chat_internal.ts +543 -0
  180. package/src/hooks/use-langgraph-interrupt.ts +1 -1
  181. package/src/utils/dev-console.ts +18 -2
  182. package/dist/chunk-57K2ZJ5F.mjs +0 -348
  183. package/dist/chunk-57K2ZJ5F.mjs.map +0 -1
  184. package/dist/chunk-CQPYJIBH.mjs +0 -1
  185. package/dist/chunk-DCTJZ742.mjs.map +0 -1
  186. package/dist/chunk-G35QHAQ6.mjs.map +0 -1
  187. package/dist/chunk-GFJW4RIM.mjs +0 -9
  188. package/dist/chunk-GFJW4RIM.mjs.map +0 -1
  189. package/dist/chunk-LIGLZ53V.mjs.map +0 -1
  190. package/dist/chunk-LU5JPZ24.mjs.map +0 -1
  191. package/dist/chunk-NAM55D5I.mjs.map +0 -1
  192. package/dist/chunk-SJJNFYGQ.mjs.map +0 -1
  193. package/dist/chunk-XGRBCWK6.mjs.map +0 -1
  194. package/dist/chunk-YAF2LATQ.mjs.map +0 -1
  195. package/dist/chunk-YBDRISKO.mjs.map +0 -1
  196. package/dist/chunk-YVBDAURK.mjs.map +0 -1
  197. /package/dist/{chunk-DF4YG4PF.mjs.map → chunk-3RHHNUVV.mjs.map} +0 -0
  198. /package/dist/{chunk-LNAQ7JG3.mjs.map → chunk-6EKLRL7B.mjs.map} +0 -0
  199. /package/dist/{chunk-O5KV32S5.mjs.map → chunk-ADZDXHVC.mjs.map} +0 -0
  200. /package/dist/{chunk-4CFY3CON.mjs.map → chunk-CLMDRYEN.mjs.map} +0 -0
  201. /package/dist/{chunk-RGKZCCPA.mjs.map → chunk-DLEXVOQE.mjs.map} +0 -0
  202. /package/dist/{chunk-JWAXDYOW.mjs.map → chunk-FAUNHSQU.mjs.map} +0 -0
  203. /package/dist/{chunk-Q6FZZJ5A.mjs.map → chunk-IN7GE4NO.mjs.map} +0 -0
  204. /package/dist/{chunk-YSQ5I2AE.mjs.map → chunk-JBLMXZ3O.mjs.map} +0 -0
  205. /package/dist/{chunk-PZXTDFMX.mjs.map → chunk-JJDXTTEN.mjs.map} +0 -0
  206. /package/dist/{chunk-CQPYJIBH.mjs.map → chunk-KDAZGZ24.mjs.map} +0 -0
  207. /package/dist/{chunk-3OQM3NEK.mjs.map → chunk-N4WEHORG.mjs.map} +0 -0
@@ -85,7 +85,7 @@ __export(copilotkit_exports, {
85
85
  defaultCopilotContextCategories: () => defaultCopilotContextCategories
86
86
  });
87
87
  module.exports = __toCommonJS(copilotkit_exports);
88
- var import_react10 = require("react");
88
+ var import_react9 = require("react");
89
89
 
90
90
  // src/context/copilot-context.tsx
91
91
  var import_react = __toESM(require("react"));
@@ -162,8 +162,8 @@ var emptyCopilotContext = {
162
162
  setLangGraphInterruptAction: () => null,
163
163
  removeLangGraphInterruptAction: () => null,
164
164
  onError: void 0,
165
- suggestions: [],
166
- setSuggestions: () => {
165
+ bannerError: null,
166
+ setBannerError: () => {
167
167
  }
168
168
  };
169
169
  var CopilotContext = import_react.default.createContext(emptyCopilotContext);
@@ -389,7 +389,10 @@ var import_react6 = require("react");
389
389
  var import_react4 = __toESM(require("react"));
390
390
  var emptyCopilotContext2 = {
391
391
  messages: [],
392
- setMessages: () => []
392
+ setMessages: () => [],
393
+ // suggestions state
394
+ suggestions: [],
395
+ setSuggestions: () => []
393
396
  };
394
397
  var CopilotMessagesContext = import_react4.default.createContext(emptyCopilotContext2);
395
398
 
@@ -697,18 +700,44 @@ function ToastProvider({
697
700
  }
698
701
 
699
702
  // src/utils/dev-console.ts
703
+ function isLocalhost() {
704
+ if (typeof window === "undefined")
705
+ return false;
706
+ return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
707
+ }
700
708
  function shouldShowDevConsole(showDevConsole) {
701
- return showDevConsole;
709
+ if (showDevConsole !== void 0) {
710
+ return showDevConsole;
711
+ }
712
+ return isLocalhost();
702
713
  }
703
714
 
704
715
  // src/components/copilot-provider/copilot-messages.tsx
705
716
  var import_shared4 = require("@copilotkit/shared");
706
717
  var import_jsx_runtime2 = require("react/jsx-runtime");
718
+ var MessagesTapContext = (0, import_react6.createContext)(null);
719
+ function useMessagesTap() {
720
+ const tap = (0, import_react6.useContext)(MessagesTapContext);
721
+ if (!tap)
722
+ throw new Error("useMessagesTap must be used inside <MessagesTapProvider>");
723
+ return tap;
724
+ }
725
+ function MessagesTapProvider({ children }) {
726
+ const messagesRef = (0, import_react6.useRef)([]);
727
+ const tapRef = (0, import_react6.useRef)({
728
+ getMessagesFromTap: () => messagesRef.current,
729
+ updateTapMessages: (messages) => {
730
+ messagesRef.current = messages;
731
+ }
732
+ });
733
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MessagesTapContext.Provider, { value: tapRef.current, children });
734
+ }
707
735
  function CopilotMessages({ children }) {
708
736
  const [messages, setMessages] = (0, import_react6.useState)([]);
709
737
  const lastLoadedThreadId = (0, import_react6.useRef)();
710
738
  const lastLoadedAgentName = (0, import_react6.useRef)();
711
739
  const lastLoadedMessages = (0, import_react6.useRef)();
740
+ const { updateTapMessages } = useMessagesTap();
712
741
  const { threadId, agentSession, runtimeClient, showDevConsole, onError, copilotApiConfig } = useCopilotContext();
713
742
  const { setBannerError } = useToast();
714
743
  const traceUIError = (0, import_react6.useCallback)(
@@ -845,23 +874,230 @@ function CopilotMessages({ children }) {
845
874
  });
846
875
  void fetchMessages();
847
876
  }, [threadId, agentSession == null ? void 0 : agentSession.agentName]);
877
+ (0, import_react6.useEffect)(() => {
878
+ updateTapMessages(messages);
879
+ }, [messages, updateTapMessages]);
848
880
  const memoizedChildren = (0, import_react6.useMemo)(() => children, [children]);
881
+ const [suggestions, setSuggestions] = (0, import_react6.useState)([]);
849
882
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
850
883
  CopilotMessagesContext.Provider,
851
884
  {
852
885
  value: {
853
886
  messages,
854
- setMessages
887
+ setMessages,
888
+ suggestions,
889
+ setSuggestions
855
890
  },
856
891
  children: memoizedChildren
857
892
  }
858
893
  );
859
894
  }
860
895
 
896
+ // src/components/usage-banner.tsx
897
+ var import_shared5 = require("@copilotkit/shared");
898
+ var import_jsx_runtime3 = require("react/jsx-runtime");
899
+ function UsageBanner({
900
+ severity = import_shared5.Severity.CRITICAL,
901
+ message = "",
902
+ onClose,
903
+ actions
904
+ }) {
905
+ if (!message || !severity) {
906
+ return null;
907
+ }
908
+ const themes = {
909
+ [import_shared5.Severity.INFO]: {
910
+ bg: "#f8fafc",
911
+ border: "#e2e8f0",
912
+ text: "#475569",
913
+ accent: "#3b82f6"
914
+ },
915
+ [import_shared5.Severity.WARNING]: {
916
+ bg: "#fffbeb",
917
+ border: "#fbbf24",
918
+ text: "#92400e",
919
+ accent: "#f59e0b"
920
+ },
921
+ [import_shared5.Severity.CRITICAL]: {
922
+ bg: "#fef2f2",
923
+ border: "#fecaca",
924
+ text: "#dc2626",
925
+ accent: "#ef4444"
926
+ }
927
+ };
928
+ const theme = themes[severity];
929
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
930
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
931
+ @keyframes slideUp {
932
+ from { opacity: 0; transform: translateX(-50%) translateY(8px); }
933
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
934
+ }
935
+
936
+ .usage-banner {
937
+ position: fixed;
938
+ bottom: 24px;
939
+ left: 50%;
940
+ transform: translateX(-50%);
941
+ width: min(600px, calc(100vw - 32px));
942
+ z-index: 10000;
943
+ animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
944
+ }
945
+
946
+ .banner-content {
947
+ background: linear-gradient(135deg, ${theme.bg} 0%, ${theme.bg}f5 100%);
948
+ border: 1px solid ${theme.border};
949
+ border-radius: 12px;
950
+ padding: 18px 20px;
951
+ box-shadow:
952
+ 0 4px 24px rgba(0, 0, 0, 0.08),
953
+ 0 2px 8px rgba(0, 0, 0, 0.04),
954
+ inset 0 1px 0 rgba(255, 255, 255, 0.7);
955
+ display: flex;
956
+ align-items: center;
957
+ gap: 16px;
958
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
959
+ backdrop-filter: blur(12px);
960
+ position: relative;
961
+ overflow: hidden;
962
+ }
963
+
964
+ .banner-content::before {
965
+ content: '';
966
+ position: absolute;
967
+ top: 0;
968
+ left: 0;
969
+ right: 0;
970
+ height: 1px;
971
+ background: linear-gradient(90deg, transparent, ${theme.accent}40, transparent);
972
+ }
973
+
974
+ .banner-message {
975
+ color: ${theme.text};
976
+ font-size: 14px;
977
+ line-height: 1.5;
978
+ font-weight: 500;
979
+ flex: 1;
980
+ letter-spacing: -0.01em;
981
+ }
982
+
983
+ .close-btn {
984
+ background: rgba(0, 0, 0, 0.05);
985
+ border: none;
986
+ color: ${theme.text};
987
+ cursor: pointer;
988
+ padding: 0;
989
+ border-radius: 6px;
990
+ opacity: 0.6;
991
+ transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
992
+ font-size: 14px;
993
+ line-height: 1;
994
+ flex-shrink: 0;
995
+ width: 24px;
996
+ height: 24px;
997
+ display: flex;
998
+ align-items: center;
999
+ justify-content: center;
1000
+ }
1001
+
1002
+ .close-btn:hover {
1003
+ opacity: 1;
1004
+ background: rgba(0, 0, 0, 0.08);
1005
+ transform: scale(1.05);
1006
+ }
1007
+
1008
+ .btn-primary {
1009
+ background: linear-gradient(135deg, ${theme.accent} 0%, ${theme.accent}e6 100%);
1010
+ color: white;
1011
+ border: none;
1012
+ border-radius: 8px;
1013
+ padding: 10px 18px;
1014
+ font-size: 13px;
1015
+ font-weight: 600;
1016
+ cursor: pointer;
1017
+ transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
1018
+ font-family: inherit;
1019
+ flex-shrink: 0;
1020
+ box-shadow:
1021
+ 0 2px 8px ${theme.accent}30,
1022
+ inset 0 1px 0 rgba(255, 255, 255, 0.2);
1023
+ letter-spacing: -0.01em;
1024
+ }
1025
+
1026
+ .btn-primary:hover {
1027
+ transform: translateY(-1px) scale(1.02);
1028
+ box-shadow:
1029
+ 0 4px 12px ${theme.accent}40,
1030
+ inset 0 1px 0 rgba(255, 255, 255, 0.25);
1031
+ }
1032
+
1033
+ .btn-primary:active {
1034
+ transform: translateY(0) scale(0.98);
1035
+ transition: all 0.08s cubic-bezier(0.16, 1, 0.3, 1);
1036
+ }
1037
+
1038
+ @media (max-width: 640px) {
1039
+ .usage-banner {
1040
+ width: calc(100vw - 24px);
1041
+ }
1042
+
1043
+ .banner-content {
1044
+ padding: 16px;
1045
+ gap: 12px;
1046
+ }
1047
+
1048
+ .banner-message {
1049
+ font-size: 13px;
1050
+ line-height: 1.45;
1051
+ }
1052
+
1053
+ .btn-primary {
1054
+ padding: 8px 14px;
1055
+ font-size: 12px;
1056
+ }
1057
+
1058
+ .close-btn {
1059
+ width: 22px;
1060
+ height: 22px;
1061
+ font-size: 12px;
1062
+ }
1063
+ }
1064
+ ` }),
1065
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "usage-banner", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "banner-content", children: [
1066
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "banner-message", children: message }),
1067
+ (actions == null ? void 0 : actions.primary) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "btn-primary", onClick: actions.primary.onClick, children: actions.primary.label }),
1068
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { className: "close-btn", onClick: onClose, title: "Close", children: "\xD7" })
1069
+ ] }) })
1070
+ ] });
1071
+ }
1072
+ var getErrorActions = (error) => {
1073
+ switch (error.code) {
1074
+ case import_shared5.CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR:
1075
+ return {
1076
+ primary: {
1077
+ label: "Show me how",
1078
+ onClick: () => window.open(
1079
+ "https://docs.copilotkit.ai/docs/guides/subscription",
1080
+ "_blank",
1081
+ "noopener,noreferrer"
1082
+ )
1083
+ }
1084
+ };
1085
+ case import_shared5.CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR:
1086
+ return {
1087
+ primary: {
1088
+ label: "Upgrade",
1089
+ onClick: () => window.open("https://cloud.copilotkit.ai", "_blank", "noopener,noreferrer")
1090
+ }
1091
+ };
1092
+ default:
1093
+ return void 0;
1094
+ }
1095
+ };
1096
+
861
1097
  // src/hooks/use-copilot-runtime-client.ts
862
1098
  var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
863
1099
  var import_react7 = require("react");
864
- var import_shared5 = require("@copilotkit/shared");
1100
+ var import_shared6 = require("@copilotkit/shared");
865
1101
  var useCopilotRuntimeClient = (options) => {
866
1102
  const { setBannerError } = useToast();
867
1103
  const _a = options, { showDevConsole, onError } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onError"]);
@@ -903,7 +1139,7 @@ var useCopilotRuntimeClient = (options) => {
903
1139
  const extensions = gqlError.extensions;
904
1140
  const visibility = extensions == null ? void 0 : extensions.visibility;
905
1141
  const isDev = shouldShowDevConsole(showDevConsole != null ? showDevConsole : false);
906
- if (visibility === import_shared5.ErrorVisibility.SILENT) {
1142
+ if (visibility === import_shared6.ErrorVisibility.SILENT) {
907
1143
  console.error("CopilotKit Silent Error:", gqlError.message);
908
1144
  return;
909
1145
  }
@@ -922,9 +1158,9 @@ var useCopilotRuntimeClient = (options) => {
922
1158
  setBannerError(ckError);
923
1159
  traceUIError(ckError, gqlError);
924
1160
  } else {
925
- const fallbackError = new import_shared5.CopilotKitError({
1161
+ const fallbackError = new import_shared6.CopilotKitError({
926
1162
  message: gqlError.message,
927
- code: import_shared5.CopilotKitErrorCode.UNKNOWN
1163
+ code: import_shared6.CopilotKitErrorCode.UNKNOWN
928
1164
  });
929
1165
  setBannerError(fallbackError);
930
1166
  traceUIError(fallbackError, gqlError);
@@ -936,9 +1172,9 @@ var useCopilotRuntimeClient = (options) => {
936
1172
  if (!isDev) {
937
1173
  console.error("CopilotKit Error (hidden in production):", error);
938
1174
  } else {
939
- const fallbackError = new import_shared5.CopilotKitError({
1175
+ const fallbackError = new import_shared6.CopilotKitError({
940
1176
  message: (error == null ? void 0 : error.message) || String(error),
941
- code: import_shared5.CopilotKitErrorCode.UNKNOWN
1177
+ code: import_shared6.CopilotKitErrorCode.UNKNOWN
942
1178
  });
943
1179
  setBannerError(fallbackError);
944
1180
  traceUIError(fallbackError, error);
@@ -947,9 +1183,9 @@ var useCopilotRuntimeClient = (options) => {
947
1183
  },
948
1184
  handleGQLWarning: (message) => {
949
1185
  console.warn(message);
950
- const warningError = new import_shared5.CopilotKitError({
1186
+ const warningError = new import_shared6.CopilotKitError({
951
1187
  message,
952
- code: import_shared5.CopilotKitErrorCode.UNKNOWN
1188
+ code: import_shared6.CopilotKitErrorCode.UNKNOWN
953
1189
  });
954
1190
  setBannerError(warningError);
955
1191
  }
@@ -964,16 +1200,16 @@ function createStructuredError(gqlError) {
964
1200
  const message = (originalError == null ? void 0 : originalError.message) || gqlError.message;
965
1201
  const code = extensions == null ? void 0 : extensions.code;
966
1202
  if (code) {
967
- return new import_shared5.CopilotKitError({ message, code });
1203
+ return new import_shared6.CopilotKitError({ message, code });
968
1204
  }
969
1205
  if ((_a = originalError == null ? void 0 : originalError.stack) == null ? void 0 : _a.includes("CopilotApiDiscoveryError")) {
970
- return new import_shared5.CopilotKitApiDiscoveryError({ message });
1206
+ return new import_shared6.CopilotKitApiDiscoveryError({ message });
971
1207
  }
972
1208
  if ((_b = originalError == null ? void 0 : originalError.stack) == null ? void 0 : _b.includes("CopilotKitRemoteEndpointDiscoveryError")) {
973
- return new import_shared5.CopilotKitRemoteEndpointDiscoveryError({ message });
1209
+ return new import_shared6.CopilotKitRemoteEndpointDiscoveryError({ message });
974
1210
  }
975
1211
  if ((_c = originalError == null ? void 0 : originalError.stack) == null ? void 0 : _c.includes("CopilotKitAgentDiscoveryError")) {
976
- return new import_shared5.CopilotKitAgentDiscoveryError({
1212
+ return new import_shared6.CopilotKitAgentDiscoveryError({
977
1213
  agentName: "",
978
1214
  availableAgents: []
979
1215
  });
@@ -982,11 +1218,11 @@ function createStructuredError(gqlError) {
982
1218
  }
983
1219
 
984
1220
  // src/components/error-boundary/error-boundary.tsx
985
- var import_react9 = __toESM(require("react"));
1221
+ var import_react8 = __toESM(require("react"));
986
1222
  var import_shared8 = require("@copilotkit/shared");
987
1223
 
988
1224
  // src/lib/status-checker.ts
989
- var import_shared6 = require("@copilotkit/shared");
1225
+ var import_shared7 = require("@copilotkit/shared");
990
1226
  var STATUS_CHECK_INTERVAL = 1e3 * 60 * 5;
991
1227
  var StatusChecker = class {
992
1228
  constructor() {
@@ -1004,10 +1240,10 @@ var StatusChecker = class {
1004
1240
  clearInterval(this.intervalId);
1005
1241
  const checkStatus = () => __async(this, null, function* () {
1006
1242
  try {
1007
- const response = yield fetch(`${import_shared6.COPILOT_CLOUD_API_URL}/ciu`, {
1243
+ const response = yield fetch(`${import_shared7.COPILOT_CLOUD_API_URL}/ciu`, {
1008
1244
  method: "GET",
1009
1245
  headers: {
1010
- [import_shared6.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey
1246
+ [import_shared7.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey
1011
1247
  }
1012
1248
  }).then((response2) => response2.json());
1013
1249
  this.lastResponse = response;
@@ -1039,456 +1275,10 @@ var StatusChecker = class {
1039
1275
  }
1040
1276
  };
1041
1277
 
1042
- // src/components/usage-banner.tsx
1043
- var import_shared7 = require("@copilotkit/shared");
1044
- var import_jsx_runtime3 = require("react/jsx-runtime");
1045
- var defaultIcons = {
1046
- [import_shared7.Severity.CRITICAL]: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1047
- "svg",
1048
- {
1049
- viewBox: "0 0 24 24",
1050
- width: "16",
1051
- height: "16",
1052
- stroke: "currentColor",
1053
- strokeWidth: "2.5",
1054
- fill: "none",
1055
- strokeLinecap: "round",
1056
- strokeLinejoin: "round",
1057
- children: [
1058
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
1059
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
1060
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
1061
- ]
1062
- }
1063
- ),
1064
- [import_shared7.Severity.WARNING]: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1065
- "svg",
1066
- {
1067
- viewBox: "0 0 24 24",
1068
- width: "16",
1069
- height: "16",
1070
- stroke: "currentColor",
1071
- strokeWidth: "2.5",
1072
- fill: "none",
1073
- strokeLinecap: "round",
1074
- strokeLinejoin: "round",
1075
- children: [
1076
- /* @__PURE__ */ (0, import_jsx_runtime3.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" }),
1077
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
1078
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
1079
- ]
1080
- }
1081
- ),
1082
- [import_shared7.Severity.INFO]: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1083
- "svg",
1084
- {
1085
- viewBox: "0 0 24 24",
1086
- width: "16",
1087
- height: "16",
1088
- stroke: "currentColor",
1089
- strokeWidth: "2.5",
1090
- fill: "none",
1091
- strokeLinecap: "round",
1092
- strokeLinejoin: "round",
1093
- children: [
1094
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
1095
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
1096
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
1097
- ]
1098
- }
1099
- )
1100
- };
1101
- function UsageBanner({
1102
- severity = import_shared7.Severity.CRITICAL,
1103
- message = "",
1104
- icon,
1105
- onClose,
1106
- actions
1107
- }) {
1108
- if (!message || !severity) {
1109
- return null;
1110
- }
1111
- const parseMessage = (rawMessage) => {
1112
- if (rawMessage.toLowerCase().includes("authentication") || rawMessage.toLowerCase().includes("api key")) {
1113
- return "Authentication failed. Please check your API key.";
1114
- }
1115
- if (rawMessage.toLowerCase().includes("rate limit")) {
1116
- return "Rate limit exceeded. Please try again later.";
1117
- }
1118
- if (rawMessage.toLowerCase().includes("checkpointer")) {
1119
- return "Agent configuration error. Please check your setup.";
1120
- }
1121
- let cleanMessage2 = rawMessage;
1122
- cleanMessage2 = cleanMessage2.split(" - ")[0];
1123
- cleanMessage2 = cleanMessage2.split(": Error code")[0];
1124
- cleanMessage2 = cleanMessage2.split(": 401")[0];
1125
- cleanMessage2 = cleanMessage2.split(": 403")[0];
1126
- cleanMessage2 = cleanMessage2.split(": 404")[0];
1127
- cleanMessage2 = cleanMessage2.split(": 500")[0];
1128
- cleanMessage2 = cleanMessage2.replace(/See more:.*$/g, "").trim();
1129
- if (cleanMessage2.includes("{") || cleanMessage2.includes("'") || cleanMessage2.length > 60) {
1130
- return "Configuration error. Please check your setup.";
1131
- }
1132
- return cleanMessage2 || "An error occurred. Please check your configuration.";
1133
- };
1134
- const cleanMessage = parseMessage(message);
1135
- const Icon = icon || defaultIcons[severity];
1136
- const themeConfigs = {
1137
- [import_shared7.Severity.INFO]: {
1138
- bg: "rgba(239, 246, 255, 0.95)",
1139
- border: "#93c5fd",
1140
- text: "#1e40af",
1141
- icon: "#3b82f6",
1142
- primaryBtn: "#3b82f6",
1143
- primaryBtnHover: "#2563eb"
1144
- },
1145
- [import_shared7.Severity.WARNING]: {
1146
- bg: "rgba(255, 251, 235, 0.95)",
1147
- border: "#fbbf24",
1148
- text: "#92400e",
1149
- icon: "#f59e0b",
1150
- primaryBtn: "#f59e0b",
1151
- primaryBtnHover: "#d97706"
1152
- },
1153
- [import_shared7.Severity.CRITICAL]: {
1154
- bg: "rgba(254, 242, 242, 0.95)",
1155
- border: "#f87171",
1156
- text: "#991b1b",
1157
- icon: "#ef4444",
1158
- primaryBtn: "#ef4444",
1159
- primaryBtnHover: "#dc2626"
1160
- }
1161
- };
1162
- const themeConfig = themeConfigs[severity] || themeConfigs[import_shared7.Severity.CRITICAL];
1163
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1164
- "div",
1165
- {
1166
- style: {
1167
- position: "fixed",
1168
- bottom: "24px",
1169
- left: "50%",
1170
- transform: "translateX(-50%)",
1171
- width: "400px",
1172
- maxWidth: "90vw",
1173
- zIndex: 1e4,
1174
- animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
1175
- },
1176
- children: [
1177
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
1178
- @keyframes bannerSlideIn {
1179
- from {
1180
- opacity: 0;
1181
- transform: translateX(-50%) translateY(20px);
1182
- scale: 0.95;
1183
- }
1184
- to {
1185
- opacity: 1;
1186
- transform: translateX(-50%) translateY(0);
1187
- scale: 1;
1188
- }
1189
- }
1190
- ` }),
1191
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1192
- "div",
1193
- {
1194
- style: {
1195
- borderRadius: "12px",
1196
- border: `1px solid ${themeConfig.border}`,
1197
- background: themeConfig.bg,
1198
- padding: "14px",
1199
- boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)",
1200
- position: "relative",
1201
- backdropFilter: "blur(12px)",
1202
- WebkitBackdropFilter: "blur(12px)",
1203
- boxSizing: "border-box",
1204
- overflow: "hidden"
1205
- },
1206
- children: [
1207
- onClose && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1208
- "button",
1209
- {
1210
- onClick: onClose,
1211
- style: {
1212
- position: "absolute",
1213
- top: "8px",
1214
- right: "8px",
1215
- background: "rgba(255, 255, 255, 0.9)",
1216
- border: "none",
1217
- color: themeConfig.text,
1218
- cursor: "pointer",
1219
- fontSize: "16px",
1220
- lineHeight: "1",
1221
- padding: "4px",
1222
- borderRadius: "4px",
1223
- width: "20px",
1224
- height: "20px",
1225
- display: "flex",
1226
- alignItems: "center",
1227
- justifyContent: "center"
1228
- },
1229
- title: "Close",
1230
- children: "\xD7"
1231
- }
1232
- ),
1233
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1234
- "div",
1235
- {
1236
- style: {
1237
- fontSize: "14px",
1238
- fontWeight: 500,
1239
- color: themeConfig.text,
1240
- lineHeight: "1.4",
1241
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
1242
- paddingRight: onClose ? "30px" : "0",
1243
- marginBottom: actions ? "12px" : "0",
1244
- wordBreak: "break-word",
1245
- overflow: "hidden",
1246
- textOverflow: "ellipsis",
1247
- display: "-webkit-box",
1248
- WebkitLineClamp: 2,
1249
- WebkitBoxOrient: "vertical"
1250
- },
1251
- children: cleanMessage
1252
- }
1253
- ),
1254
- actions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1255
- "div",
1256
- {
1257
- style: {
1258
- display: "flex",
1259
- gap: "8px",
1260
- flexWrap: "wrap"
1261
- },
1262
- children: [
1263
- actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1264
- "button",
1265
- {
1266
- onClick: actions.secondary.onClick,
1267
- style: {
1268
- borderRadius: "8px",
1269
- padding: "6px 12px",
1270
- fontSize: "13px",
1271
- fontWeight: 500,
1272
- color: themeConfig.text,
1273
- backgroundColor: "rgba(255, 255, 255, 0.9)",
1274
- border: `1px solid ${themeConfig.border}`,
1275
- cursor: "pointer",
1276
- transition: "all 0.2s ease",
1277
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1278
- },
1279
- onMouseOver: (e) => {
1280
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
1281
- e.currentTarget.style.transform = "translateY(-1px)";
1282
- },
1283
- onMouseOut: (e) => {
1284
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
1285
- e.currentTarget.style.transform = "translateY(0)";
1286
- },
1287
- children: actions.secondary.label
1288
- }
1289
- ),
1290
- actions.primary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1291
- "button",
1292
- {
1293
- onClick: actions.primary.onClick,
1294
- style: {
1295
- borderRadius: "8px",
1296
- padding: "6px 12px",
1297
- fontSize: "13px",
1298
- fontWeight: 600,
1299
- color: "#fff",
1300
- backgroundColor: themeConfig.primaryBtn,
1301
- border: "none",
1302
- cursor: "pointer",
1303
- transition: "all 0.2s ease",
1304
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
1305
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1306
- },
1307
- onMouseOver: (e) => {
1308
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
1309
- e.currentTarget.style.transform = "translateY(-1px)";
1310
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
1311
- },
1312
- onMouseOut: (e) => {
1313
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
1314
- e.currentTarget.style.transform = "translateY(0)";
1315
- e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
1316
- },
1317
- children: actions.primary.label
1318
- }
1319
- )
1320
- ]
1321
- }
1322
- )
1323
- ]
1324
- }
1325
- )
1326
- ]
1327
- }
1328
- );
1329
- }
1330
- function renderCopilotKitUsage(error, onClose) {
1331
- if (error.visibility !== import_shared7.ErrorVisibility.BANNER) {
1332
- return null;
1333
- }
1334
- const extractUrlFromMessage = (message) => {
1335
- const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
1336
- const match = linkRegex.exec(message);
1337
- return match ? match[2] : null;
1338
- };
1339
- const getErrorActions = (error2) => {
1340
- switch (error2.name) {
1341
- case import_shared7.ERROR_NAMES.MISSING_PUBLIC_API_KEY_ERROR:
1342
- return {
1343
- primary: {
1344
- label: "Sign In",
1345
- onClick: () => window.location.href = "https://cloud.copilotkit.ai"
1346
- }
1347
- };
1348
- case import_shared7.ERROR_NAMES.UPGRADE_REQUIRED_ERROR:
1349
- return {
1350
- primary: {
1351
- label: "Upgrade",
1352
- onClick: () => window.location.href = "https://copilotkit.ai/"
1353
- }
1354
- };
1355
- case import_shared7.ERROR_NAMES.COPILOT_API_DISCOVERY_ERROR:
1356
- case import_shared7.ERROR_NAMES.COPILOT_REMOTE_ENDPOINT_DISCOVERY_ERROR:
1357
- case import_shared7.ERROR_NAMES.COPILOT_KIT_AGENT_DISCOVERY_ERROR:
1358
- return {
1359
- primary: {
1360
- label: "View Docs",
1361
- onClick: () => {
1362
- var _a;
1363
- const urlFromMessage = extractUrlFromMessage(error2.message);
1364
- const urlFromExtensions = (_a = error2.extensions) == null ? void 0 : _a.troubleshootingUrl;
1365
- const url = urlFromMessage || urlFromExtensions || "https://docs.copilotkit.ai/troubleshooting/common-issues";
1366
- window.open(url, "_blank");
1367
- }
1368
- }
1369
- };
1370
- default:
1371
- return void 0;
1372
- }
1373
- };
1374
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1375
- UsageBanner,
1376
- {
1377
- severity: error.severity || import_shared7.Severity.CRITICAL,
1378
- message: error.message,
1379
- onClose,
1380
- actions: getErrorActions(error)
1381
- }
1382
- );
1383
- }
1384
-
1385
- // src/components/error-boundary/error-utils.tsx
1386
- var import_react8 = require("react");
1387
-
1388
- // src/components/toast/exclamation-mark-icon.tsx
1389
- var import_jsx_runtime4 = require("react/jsx-runtime");
1390
- var ExclamationMarkIcon = ({
1391
- className,
1392
- style
1393
- }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1394
- "svg",
1395
- {
1396
- xmlns: "http://www.w3.org/2000/svg",
1397
- width: "24",
1398
- height: "24",
1399
- viewBox: "0 0 24 24",
1400
- fill: "none",
1401
- stroke: "currentColor",
1402
- strokeWidth: "2",
1403
- strokeLinecap: "round",
1404
- strokeLinejoin: "round",
1405
- className: `lucide lucide-circle-alert ${className ? className : ""}`,
1406
- style,
1407
- children: [
1408
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
1409
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
1410
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
1411
- ]
1412
- }
1413
- );
1414
-
1415
- // src/components/error-boundary/error-utils.tsx
1416
- var import_react_markdown = __toESM(require("react-markdown"));
1417
- var import_jsx_runtime5 = require("react/jsx-runtime");
1418
- function ErrorToast({ errors }) {
1419
- const errorsToRender = errors.map((error, idx) => {
1420
- var _a, _b, _c;
1421
- const originalError = "extensions" in error ? (_a = error.extensions) == null ? void 0 : _a.originalError : {};
1422
- const message = (_b = originalError == null ? void 0 : originalError.message) != null ? _b : error.message;
1423
- const code = "extensions" in error ? (_c = error.extensions) == null ? void 0 : _c.code : null;
1424
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1425
- "div",
1426
- {
1427
- style: {
1428
- marginTop: idx === 0 ? 0 : 10,
1429
- marginBottom: 14
1430
- },
1431
- children: [
1432
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ExclamationMarkIcon, { style: { marginBottom: 4 } }),
1433
- code && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1434
- "div",
1435
- {
1436
- style: {
1437
- fontWeight: "600",
1438
- marginBottom: 4
1439
- },
1440
- children: [
1441
- "Copilot Runtime Error:",
1442
- " ",
1443
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontFamily: "monospace", fontWeight: "normal" }, children: code })
1444
- ]
1445
- }
1446
- ),
1447
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_markdown.default, { children: message })
1448
- ]
1449
- },
1450
- idx
1451
- );
1452
- });
1453
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1454
- "div",
1455
- {
1456
- style: {
1457
- fontSize: "13px",
1458
- maxWidth: "600px"
1459
- },
1460
- children: [
1461
- errorsToRender,
1462
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "11px", opacity: 0.75 }, children: "NOTE: This error only displays during local development." })
1463
- ]
1464
- }
1465
- );
1466
- }
1467
- function useErrorToast() {
1468
- const { addToast } = useToast();
1469
- return (0, import_react8.useCallback)(
1470
- (error) => {
1471
- const errorId = error.map((err) => {
1472
- var _a, _b;
1473
- const message = "extensions" in err ? ((_b = (_a = err.extensions) == null ? void 0 : _a.originalError) == null ? void 0 : _b.message) || err.message : err.message;
1474
- const stack = err.stack || "";
1475
- return btoa(message + stack).slice(0, 32);
1476
- }).join("|");
1477
- addToast({
1478
- type: "error",
1479
- id: errorId,
1480
- // Toast libraries typically dedupe by id
1481
- message: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ErrorToast, { errors: error })
1482
- });
1483
- },
1484
- [addToast]
1485
- );
1486
- }
1487
-
1488
1278
  // src/components/error-boundary/error-boundary.tsx
1489
- var import_jsx_runtime6 = require("react/jsx-runtime");
1279
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1490
1280
  var statusChecker = new StatusChecker();
1491
- var CopilotErrorBoundary = class extends import_react9.default.Component {
1281
+ var CopilotErrorBoundary = class extends import_react8.default.Component {
1492
1282
  constructor(props) {
1493
1283
  super(props);
1494
1284
  this.state = {
@@ -1518,22 +1308,17 @@ var CopilotErrorBoundary = class extends import_react9.default.Component {
1518
1308
  console.error("CopilotKit Error:", error, errorInfo);
1519
1309
  }
1520
1310
  render() {
1521
- var _a, _b;
1311
+ var _a, _b, _c, _d;
1522
1312
  if (this.state.hasError) {
1523
1313
  if (this.state.error instanceof import_shared8.CopilotKitError) {
1524
- if (this.state.error.visibility === import_shared8.ErrorVisibility.BANNER) {
1525
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ErrorToast2, { error: this.state.error, children: renderCopilotKitUsage(
1526
- this.state.error,
1527
- () => this.setState({ hasError: false, error: void 0 })
1528
- ) });
1529
- }
1530
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1314
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1531
1315
  this.props.children,
1532
- this.props.showUsageBanner && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1316
+ this.props.showUsageBanner && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1533
1317
  UsageBanner,
1534
1318
  {
1535
- severity: (_a = this.state.status) == null ? void 0 : _a.severity,
1536
- message: (_b = this.state.status) == null ? void 0 : _b.message
1319
+ severity: (_b = (_a = this.state.status) == null ? void 0 : _a.severity) != null ? _b : this.state.error.severity,
1320
+ message: (_d = (_c = this.state.status) == null ? void 0 : _c.message) != null ? _d : this.state.error.message,
1321
+ actions: getErrorActions(this.state.error)
1537
1322
  }
1538
1323
  )
1539
1324
  ] });
@@ -1543,80 +1328,66 @@ var CopilotErrorBoundary = class extends import_react9.default.Component {
1543
1328
  return this.props.children;
1544
1329
  }
1545
1330
  };
1546
- function ErrorToast2({ error, children }) {
1547
- const addErrorToast = useErrorToast();
1548
- (0, import_react9.useEffect)(() => {
1549
- if (error) {
1550
- addErrorToast([error]);
1551
- }
1552
- }, [error, addErrorToast]);
1553
- if (!error)
1554
- throw error;
1555
- return children;
1556
- }
1557
1331
 
1558
1332
  // src/components/copilot-provider/copilotkit.tsx
1559
- var import_jsx_runtime7 = require("react/jsx-runtime");
1333
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1560
1334
  function CopilotKit(_a) {
1561
1335
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
1562
- var _a2;
1563
- const showDevConsole = (_a2 = props.showDevConsole) != null ? _a2 : false;
1564
- const enabled = shouldShowDevConsole(showDevConsole);
1565
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotErrorBoundary, { publicApiKey: props.publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) }) });
1336
+ const enabled = shouldShowDevConsole(props.showDevConsole);
1337
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToastProvider, { enabled, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CopilotErrorBoundary, { publicApiKey: props.publicApiKey, showUsageBanner: enabled, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CopilotKitInternal, __spreadProps(__spreadValues({}, props), { children })) }) });
1566
1338
  }
1567
1339
  function CopilotKitInternal(cpkProps) {
1568
- var _b, _c;
1569
1340
  const _a = cpkProps, { children } = _a, props = __objRest(_a, ["children"]);
1570
1341
  validateProps(cpkProps);
1571
1342
  const chatApiEndpoint = props.runtimeUrl || import_shared9.COPILOT_CLOUD_CHAT_URL;
1572
- const [actions, setActions] = (0, import_react10.useState)({});
1573
- const [coAgentStateRenders, setCoAgentStateRenders] = (0, import_react10.useState)({});
1574
- const chatComponentsCache = (0, import_react10.useRef)({
1343
+ const [actions, setActions] = (0, import_react9.useState)({});
1344
+ const [coAgentStateRenders, setCoAgentStateRenders] = (0, import_react9.useState)({});
1345
+ const chatComponentsCache = (0, import_react9.useRef)({
1575
1346
  actions: {},
1576
1347
  coAgentStateRenders: {}
1577
1348
  });
1578
1349
  const { addElement, removeElement, printTree, getAllElements } = use_tree_default();
1579
- const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
1580
- const [chatInstructions, setChatInstructions] = (0, import_react10.useState)("");
1581
- const [authStates, setAuthStates] = (0, import_react10.useState)({});
1582
- const [extensions, setExtensions] = (0, import_react10.useState)({});
1583
- const [additionalInstructions, setAdditionalInstructions] = (0, import_react10.useState)([]);
1350
+ const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
1351
+ const [chatInstructions, setChatInstructions] = (0, import_react9.useState)("");
1352
+ const [authStates, setAuthStates] = (0, import_react9.useState)({});
1353
+ const [extensions, setExtensions] = (0, import_react9.useState)({});
1354
+ const [additionalInstructions, setAdditionalInstructions] = (0, import_react9.useState)([]);
1584
1355
  const {
1585
1356
  addElement: addDocument,
1586
1357
  removeElement: removeDocument,
1587
1358
  allElements: allDocuments
1588
1359
  } = use_flat_category_store_default();
1589
- const statusChecker2 = (0, import_react10.useMemo)(() => new StatusChecker(), []);
1590
- const [usageBannerStatus, setUsageBannerStatus] = (0, import_react10.useState)(null);
1591
- const setAction = (0, import_react10.useCallback)((id, action) => {
1360
+ const statusChecker2 = (0, import_react9.useMemo)(() => new StatusChecker(), []);
1361
+ const [usageBannerStatus, setUsageBannerStatus] = (0, import_react9.useState)(null);
1362
+ const setAction = (0, import_react9.useCallback)((id, action) => {
1592
1363
  setActions((prevPoints) => {
1593
1364
  return __spreadProps(__spreadValues({}, prevPoints), {
1594
1365
  [id]: action
1595
1366
  });
1596
1367
  });
1597
1368
  }, []);
1598
- const removeAction = (0, import_react10.useCallback)((id) => {
1369
+ const removeAction = (0, import_react9.useCallback)((id) => {
1599
1370
  setActions((prevPoints) => {
1600
1371
  const newPoints = __spreadValues({}, prevPoints);
1601
1372
  delete newPoints[id];
1602
1373
  return newPoints;
1603
1374
  });
1604
1375
  }, []);
1605
- const setCoAgentStateRender = (0, import_react10.useCallback)((id, stateRender) => {
1376
+ const setCoAgentStateRender = (0, import_react9.useCallback)((id, stateRender) => {
1606
1377
  setCoAgentStateRenders((prevPoints) => {
1607
1378
  return __spreadProps(__spreadValues({}, prevPoints), {
1608
1379
  [id]: stateRender
1609
1380
  });
1610
1381
  });
1611
1382
  }, []);
1612
- const removeCoAgentStateRender = (0, import_react10.useCallback)((id) => {
1383
+ const removeCoAgentStateRender = (0, import_react9.useCallback)((id) => {
1613
1384
  setCoAgentStateRenders((prevPoints) => {
1614
1385
  const newPoints = __spreadValues({}, prevPoints);
1615
1386
  delete newPoints[id];
1616
1387
  return newPoints;
1617
1388
  });
1618
1389
  }, []);
1619
- const getContextString = (0, import_react10.useCallback)(
1390
+ const getContextString = (0, import_react9.useCallback)(
1620
1391
  (documents, categories) => {
1621
1392
  const documentsString = documents.map((document) => {
1622
1393
  return `${document.name} (${document.sourceApplication}):
@@ -1629,47 +1400,47 @@ ${nonDocumentStrings}`;
1629
1400
  },
1630
1401
  [printTree]
1631
1402
  );
1632
- const addContext = (0, import_react10.useCallback)(
1403
+ const addContext = (0, import_react9.useCallback)(
1633
1404
  (context, parentId, categories = defaultCopilotContextCategories) => {
1634
1405
  return addElement(context, categories, parentId);
1635
1406
  },
1636
1407
  [addElement]
1637
1408
  );
1638
- const removeContext = (0, import_react10.useCallback)(
1409
+ const removeContext = (0, import_react9.useCallback)(
1639
1410
  (id) => {
1640
1411
  removeElement(id);
1641
1412
  },
1642
1413
  [removeElement]
1643
1414
  );
1644
- const getAllContext = (0, import_react10.useCallback)(() => {
1415
+ const getAllContext = (0, import_react9.useCallback)(() => {
1645
1416
  return getAllElements();
1646
1417
  }, [getAllElements]);
1647
- const getFunctionCallHandler = (0, import_react10.useCallback)(
1418
+ const getFunctionCallHandler = (0, import_react9.useCallback)(
1648
1419
  (customEntryPoints) => {
1649
1420
  return entryPointsToFunctionCallHandler(Object.values(customEntryPoints || actions));
1650
1421
  },
1651
1422
  [actions]
1652
1423
  );
1653
- const getDocumentsContext = (0, import_react10.useCallback)(
1424
+ const getDocumentsContext = (0, import_react9.useCallback)(
1654
1425
  (categories) => {
1655
1426
  return allDocuments(categories);
1656
1427
  },
1657
1428
  [allDocuments]
1658
1429
  );
1659
- const addDocumentContext = (0, import_react10.useCallback)(
1430
+ const addDocumentContext = (0, import_react9.useCallback)(
1660
1431
  (documentPointer, categories = defaultCopilotContextCategories) => {
1661
1432
  return addDocument(documentPointer, categories);
1662
1433
  },
1663
1434
  [addDocument]
1664
1435
  );
1665
- const removeDocumentContext = (0, import_react10.useCallback)(
1436
+ const removeDocumentContext = (0, import_react9.useCallback)(
1666
1437
  (documentId) => {
1667
1438
  removeDocument(documentId);
1668
1439
  },
1669
1440
  [removeDocument]
1670
1441
  );
1671
- const copilotApiConfig = (0, import_react10.useMemo)(() => {
1672
- var _a2, _b2;
1442
+ const copilotApiConfig = (0, import_react9.useMemo)(() => {
1443
+ var _a2, _b;
1673
1444
  let cloud = void 0;
1674
1445
  if (props.publicApiKey) {
1675
1446
  cloud = {
@@ -1678,7 +1449,7 @@ ${nonDocumentStrings}`;
1678
1449
  restrictToTopic: {
1679
1450
  enabled: Boolean(props.guardrails_c),
1680
1451
  validTopics: ((_a2 = props.guardrails_c) == null ? void 0 : _a2.validTopics) || [],
1681
- invalidTopics: ((_b2 = props.guardrails_c) == null ? void 0 : _b2.invalidTopics) || []
1452
+ invalidTopics: ((_b = props.guardrails_c) == null ? void 0 : _b.invalidTopics) || []
1682
1453
  }
1683
1454
  }
1684
1455
  }
@@ -1704,7 +1475,7 @@ ${nonDocumentStrings}`;
1704
1475
  props.cloudRestrictToTopic,
1705
1476
  props.guardrails_c
1706
1477
  ]);
1707
- const headers = (0, import_react10.useMemo)(() => {
1478
+ const headers = (0, import_react9.useMemo)(() => {
1708
1479
  const authHeaders = Object.values(authStates || {}).reduce((acc, state) => {
1709
1480
  if (state.status === "authenticated" && state.authHeaders) {
1710
1481
  return __spreadValues(__spreadValues({}, acc), Object.entries(state.authHeaders).reduce(
@@ -1723,17 +1494,17 @@ ${nonDocumentStrings}`;
1723
1494
  publicApiKey: copilotApiConfig.publicApiKey,
1724
1495
  headers,
1725
1496
  credentials: copilotApiConfig.credentials,
1726
- showDevConsole: (_b = props.showDevConsole) != null ? _b : false,
1497
+ showDevConsole: shouldShowDevConsole(props.showDevConsole),
1727
1498
  onError: props.onError
1728
1499
  });
1729
- const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = (0, import_react10.useState)({});
1730
- const addChatSuggestionConfiguration = (0, import_react10.useCallback)(
1500
+ const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = (0, import_react9.useState)({});
1501
+ const addChatSuggestionConfiguration = (0, import_react9.useCallback)(
1731
1502
  (id, suggestion) => {
1732
1503
  setChatSuggestionConfiguration((prev) => __spreadProps(__spreadValues({}, prev), { [id]: suggestion }));
1733
1504
  },
1734
1505
  [setChatSuggestionConfiguration]
1735
1506
  );
1736
- const removeChatSuggestionConfiguration = (0, import_react10.useCallback)(
1507
+ const removeChatSuggestionConfiguration = (0, import_react9.useCallback)(
1737
1508
  (id) => {
1738
1509
  setChatSuggestionConfiguration((prev) => {
1739
1510
  const _a2 = prev, { [id]: _ } = _a2, rest = __objRest(_a2, [__restKey(id)]);
@@ -1742,10 +1513,10 @@ ${nonDocumentStrings}`;
1742
1513
  },
1743
1514
  [setChatSuggestionConfiguration]
1744
1515
  );
1745
- const [availableAgents, setAvailableAgents] = (0, import_react10.useState)([]);
1746
- const [coagentStates, setCoagentStates] = (0, import_react10.useState)({});
1747
- const coagentStatesRef = (0, import_react10.useRef)({});
1748
- const setCoagentStatesWithRef = (0, import_react10.useCallback)(
1516
+ const [availableAgents, setAvailableAgents] = (0, import_react9.useState)([]);
1517
+ const [coagentStates, setCoagentStates] = (0, import_react9.useState)({});
1518
+ const coagentStatesRef = (0, import_react9.useRef)({});
1519
+ const setCoagentStatesWithRef = (0, import_react9.useCallback)(
1749
1520
  (value) => {
1750
1521
  const newValue = typeof value === "function" ? value(coagentStatesRef.current) : value;
1751
1522
  coagentStatesRef.current = newValue;
@@ -1755,8 +1526,8 @@ ${nonDocumentStrings}`;
1755
1526
  },
1756
1527
  []
1757
1528
  );
1758
- const hasLoadedAgents = (0, import_react10.useRef)(false);
1759
- (0, import_react10.useEffect)(() => {
1529
+ const hasLoadedAgents = (0, import_react9.useRef)(false);
1530
+ (0, import_react9.useEffect)(() => {
1760
1531
  if (hasLoadedAgents.current)
1761
1532
  return;
1762
1533
  const fetchData = () => __async(this, null, function* () {
@@ -1775,8 +1546,8 @@ ${nonDocumentStrings}`;
1775
1546
  agentName: props.agent
1776
1547
  };
1777
1548
  }
1778
- const [agentSession, setAgentSession] = (0, import_react10.useState)(initialAgentSession);
1779
- (0, import_react10.useEffect)(() => {
1549
+ const [agentSession, setAgentSession] = (0, import_react9.useState)(initialAgentSession);
1550
+ (0, import_react9.useEffect)(() => {
1780
1551
  if (props.agent) {
1781
1552
  setAgentSession({
1782
1553
  agentName: props.agent
@@ -1785,8 +1556,8 @@ ${nonDocumentStrings}`;
1785
1556
  setAgentSession(null);
1786
1557
  }
1787
1558
  }, [props.agent]);
1788
- const [internalThreadId, setInternalThreadId] = (0, import_react10.useState)(props.threadId || (0, import_shared9.randomUUID)());
1789
- const setThreadId = (0, import_react10.useCallback)(
1559
+ const [internalThreadId, setInternalThreadId] = (0, import_react9.useState)(props.threadId || (0, import_shared9.randomUUID)());
1560
+ const setThreadId = (0, import_react9.useCallback)(
1790
1561
  (value) => {
1791
1562
  if (props.threadId) {
1792
1563
  throw new Error("Cannot call setThreadId() when threadId is provided via props.");
@@ -1795,16 +1566,16 @@ ${nonDocumentStrings}`;
1795
1566
  },
1796
1567
  [props.threadId]
1797
1568
  );
1798
- (0, import_react10.useEffect)(() => {
1569
+ (0, import_react9.useEffect)(() => {
1799
1570
  if (props.threadId !== void 0) {
1800
1571
  setInternalThreadId(props.threadId);
1801
1572
  }
1802
1573
  }, [props.threadId]);
1803
- const [runId, setRunId] = (0, import_react10.useState)(null);
1804
- const chatAbortControllerRef = (0, import_react10.useRef)(null);
1805
- const showDevConsole = (_c = props.showDevConsole) != null ? _c : false;
1806
- const [langGraphInterruptAction, _setLangGraphInterruptAction] = (0, import_react10.useState)(null);
1807
- const setLangGraphInterruptAction = (0, import_react10.useCallback)((action) => {
1574
+ const [runId, setRunId] = (0, import_react9.useState)(null);
1575
+ const chatAbortControllerRef = (0, import_react9.useRef)(null);
1576
+ const showDevConsole = shouldShowDevConsole(props.showDevConsole);
1577
+ const [langGraphInterruptAction, _setLangGraphInterruptAction] = (0, import_react9.useState)(null);
1578
+ const setLangGraphInterruptAction = (0, import_react9.useCallback)((action) => {
1808
1579
  _setLangGraphInterruptAction((prev) => {
1809
1580
  if (prev == null)
1810
1581
  return action;
@@ -1817,23 +1588,23 @@ ${nonDocumentStrings}`;
1817
1588
  return __spreadProps(__spreadValues(__spreadValues({}, prev), action), { event });
1818
1589
  });
1819
1590
  }, []);
1820
- const removeLangGraphInterruptAction = (0, import_react10.useCallback)(() => {
1591
+ const removeLangGraphInterruptAction = (0, import_react9.useCallback)(() => {
1821
1592
  setLangGraphInterruptAction(null);
1822
1593
  }, []);
1823
- const memoizedChildren = (0, import_react10.useMemo)(() => children, [children]);
1824
- const [suggestions, setSuggestions] = (0, import_react10.useState)([]);
1825
- const agentLock = (0, import_react10.useMemo)(() => {
1594
+ const memoizedChildren = (0, import_react9.useMemo)(() => children, [children]);
1595
+ const [bannerError, setBannerError] = (0, import_react9.useState)(null);
1596
+ const agentLock = (0, import_react9.useMemo)(() => {
1826
1597
  var _a2;
1827
1598
  return (_a2 = props.agent) != null ? _a2 : null;
1828
1599
  }, [props.agent]);
1829
- const forwardedParameters = (0, import_react10.useMemo)(
1600
+ const forwardedParameters = (0, import_react9.useMemo)(
1830
1601
  () => {
1831
1602
  var _a2;
1832
1603
  return (_a2 = props.forwardedParameters) != null ? _a2 : {};
1833
1604
  },
1834
1605
  [props.forwardedParameters]
1835
1606
  );
1836
- const updateExtensions = (0, import_react10.useCallback)(
1607
+ const updateExtensions = (0, import_react9.useCallback)(
1837
1608
  (newExtensions) => {
1838
1609
  setExtensions((prev) => {
1839
1610
  const resolved = typeof newExtensions === "function" ? newExtensions(prev) : newExtensions;
@@ -1845,7 +1616,7 @@ ${nonDocumentStrings}`;
1845
1616
  },
1846
1617
  [setExtensions]
1847
1618
  );
1848
- const updateAuthStates = (0, import_react10.useCallback)(
1619
+ const updateAuthStates = (0, import_react9.useCallback)(
1849
1620
  (newAuthStates) => {
1850
1621
  setAuthStates((prev) => {
1851
1622
  const resolved = typeof newAuthStates === "function" ? newAuthStates(prev) : newAuthStates;
@@ -1857,7 +1628,7 @@ ${nonDocumentStrings}`;
1857
1628
  },
1858
1629
  [setAuthStates]
1859
1630
  );
1860
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1631
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1861
1632
  CopilotContext.Provider,
1862
1633
  {
1863
1634
  value: {
@@ -1911,10 +1682,21 @@ ${nonDocumentStrings}`;
1911
1682
  setLangGraphInterruptAction,
1912
1683
  removeLangGraphInterruptAction,
1913
1684
  onError: props.onError,
1914
- suggestions,
1915
- setSuggestions
1685
+ bannerError,
1686
+ setBannerError
1916
1687
  },
1917
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotMessages, { children: memoizedChildren })
1688
+ children: [
1689
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MessagesTapProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CopilotMessages, { children: memoizedChildren }) }),
1690
+ bannerError && showDevConsole && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1691
+ UsageBanner,
1692
+ {
1693
+ severity: bannerError.severity,
1694
+ message: bannerError.message,
1695
+ onClose: () => setBannerError(null),
1696
+ actions: getErrorActions(bannerError)
1697
+ }
1698
+ )
1699
+ ]
1918
1700
  }
1919
1701
  );
1920
1702
  }