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