@copilotkit/react-core 1.9.2-next.8 → 1.9.2-next.9

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 (99) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{chunk-CCESTGAM.mjs → chunk-3OQM3NEK.mjs} +2 -2
  3. package/dist/{chunk-T4ZKC4X4.mjs → chunk-3YHYWAHK.mjs} +2 -2
  4. package/dist/{chunk-ISYBUDL4.mjs → chunk-55QZ2SVJ.mjs} +4 -5
  5. package/dist/chunk-55QZ2SVJ.mjs.map +1 -0
  6. package/dist/chunk-57K2ZJ5F.mjs +348 -0
  7. package/dist/chunk-57K2ZJ5F.mjs.map +1 -0
  8. package/dist/{chunk-ZHEEHGLS.mjs → chunk-ADIITPD2.mjs} +8 -5
  9. package/dist/{chunk-ZHEEHGLS.mjs.map → chunk-ADIITPD2.mjs.map} +1 -1
  10. package/dist/{chunk-S4BOATBG.mjs → chunk-EF5BNM34.mjs} +2 -2
  11. package/dist/{chunk-I4JPQECN.mjs → chunk-EXU7GWLC.mjs} +4 -4
  12. package/dist/{chunk-7G6RR4HE.mjs → chunk-FXK6RQIN.mjs} +2 -2
  13. package/dist/{chunk-JXF732XG.mjs → chunk-G7LYGERN.mjs} +80 -13
  14. package/dist/chunk-G7LYGERN.mjs.map +1 -0
  15. package/dist/{chunk-VJCHRQ7Q.mjs → chunk-JDEWNLNP.mjs} +37 -4
  16. package/dist/chunk-JDEWNLNP.mjs.map +1 -0
  17. package/dist/{chunk-JHIZ5HAI.mjs → chunk-NQVCZQ5T.mjs} +3 -3
  18. package/dist/{chunk-VF6UPRKM.mjs → chunk-OF4SZTLL.mjs} +3 -3
  19. package/dist/{chunk-QQZLIEXK.mjs → chunk-SJJNFYGQ.mjs} +3 -3
  20. package/dist/{chunk-RN3ZRHI7.mjs → chunk-WOGURSAL.mjs} +5 -5
  21. package/dist/chunk-YAF2LATQ.mjs +310 -0
  22. package/dist/chunk-YAF2LATQ.mjs.map +1 -0
  23. package/dist/components/copilot-provider/copilot-messages.js +35 -2
  24. package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
  25. package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
  26. package/dist/components/copilot-provider/copilotkit.js +289 -234
  27. package/dist/components/copilot-provider/copilotkit.js.map +1 -1
  28. package/dist/components/copilot-provider/copilotkit.mjs +7 -7
  29. package/dist/components/copilot-provider/index.js +289 -234
  30. package/dist/components/copilot-provider/index.js.map +1 -1
  31. package/dist/components/copilot-provider/index.mjs +7 -7
  32. package/dist/components/error-boundary/error-boundary.js +135 -146
  33. package/dist/components/error-boundary/error-boundary.js.map +1 -1
  34. package/dist/components/error-boundary/error-boundary.mjs +4 -4
  35. package/dist/components/error-boundary/error-utils.js.map +1 -1
  36. package/dist/components/error-boundary/error-utils.mjs +2 -2
  37. package/dist/components/index.js +289 -234
  38. package/dist/components/index.js.map +1 -1
  39. package/dist/components/index.mjs +7 -7
  40. package/dist/components/toast/toast-provider.js +118 -85
  41. package/dist/components/toast/toast-provider.js.map +1 -1
  42. package/dist/components/toast/toast-provider.mjs +1 -1
  43. package/dist/components/usage-banner.js +135 -146
  44. package/dist/components/usage-banner.js.map +1 -1
  45. package/dist/components/usage-banner.mjs +1 -1
  46. package/dist/hooks/index.js +75 -10
  47. package/dist/hooks/index.js.map +1 -1
  48. package/dist/hooks/index.mjs +14 -14
  49. package/dist/hooks/use-chat.js +72 -10
  50. package/dist/hooks/use-chat.js.map +1 -1
  51. package/dist/hooks/use-chat.mjs +4 -4
  52. package/dist/hooks/use-coagent-state-render.js.map +1 -1
  53. package/dist/hooks/use-coagent-state-render.mjs +2 -2
  54. package/dist/hooks/use-coagent.js +75 -10
  55. package/dist/hooks/use-coagent.js.map +1 -1
  56. package/dist/hooks/use-coagent.mjs +10 -10
  57. package/dist/hooks/use-copilot-action.js.map +1 -1
  58. package/dist/hooks/use-copilot-action.mjs +3 -3
  59. package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
  60. package/dist/hooks/use-copilot-authenticated-action.mjs +4 -4
  61. package/dist/hooks/use-copilot-chat.js +72 -10
  62. package/dist/hooks/use-copilot-chat.js.map +1 -1
  63. package/dist/hooks/use-copilot-chat.mjs +9 -9
  64. package/dist/hooks/use-copilot-runtime-client.js +1 -1
  65. package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
  66. package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
  67. package/dist/hooks/use-langgraph-interrupt.js +72 -10
  68. package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
  69. package/dist/hooks/use-langgraph-interrupt.mjs +10 -10
  70. package/dist/index.js +363 -243
  71. package/dist/index.js.map +1 -1
  72. package/dist/index.mjs +15 -15
  73. package/dist/lib/copilot-task.mjs +8 -8
  74. package/dist/lib/index.mjs +8 -8
  75. package/dist/utils/extract.mjs +7 -7
  76. package/dist/utils/index.mjs +7 -7
  77. package/package.json +3 -3
  78. package/src/components/copilot-provider/copilot-messages.tsx +42 -3
  79. package/src/components/toast/toast-provider.tsx +49 -24
  80. package/src/components/usage-banner.tsx +144 -147
  81. package/src/hooks/use-chat.ts +106 -6
  82. package/src/hooks/use-coagent.ts +5 -0
  83. package/src/hooks/use-copilot-runtime-client.ts +2 -39
  84. package/dist/chunk-HD2GE3DK.mjs +0 -359
  85. package/dist/chunk-HD2GE3DK.mjs.map +0 -1
  86. package/dist/chunk-ISYBUDL4.mjs.map +0 -1
  87. package/dist/chunk-JXF732XG.mjs.map +0 -1
  88. package/dist/chunk-VJCHRQ7Q.mjs.map +0 -1
  89. package/dist/chunk-VRXANACV.mjs +0 -277
  90. package/dist/chunk-VRXANACV.mjs.map +0 -1
  91. /package/dist/{chunk-CCESTGAM.mjs.map → chunk-3OQM3NEK.mjs.map} +0 -0
  92. /package/dist/{chunk-T4ZKC4X4.mjs.map → chunk-3YHYWAHK.mjs.map} +0 -0
  93. /package/dist/{chunk-S4BOATBG.mjs.map → chunk-EF5BNM34.mjs.map} +0 -0
  94. /package/dist/{chunk-I4JPQECN.mjs.map → chunk-EXU7GWLC.mjs.map} +0 -0
  95. /package/dist/{chunk-7G6RR4HE.mjs.map → chunk-FXK6RQIN.mjs.map} +0 -0
  96. /package/dist/{chunk-JHIZ5HAI.mjs.map → chunk-NQVCZQ5T.mjs.map} +0 -0
  97. /package/dist/{chunk-VF6UPRKM.mjs.map → chunk-OF4SZTLL.mjs.map} +0 -0
  98. /package/dist/{chunk-QQZLIEXK.mjs.map → chunk-SJJNFYGQ.mjs.map} +0 -0
  99. /package/dist/{chunk-RN3ZRHI7.mjs.map → chunk-WOGURSAL.mjs.map} +0 -0
@@ -517,12 +517,14 @@ function ToastProvider({
517
517
  border: `1px solid ${colors.border}`,
518
518
  borderLeft: `4px solid ${colors.border}`,
519
519
  borderRadius: "8px",
520
- padding: "10px 14px",
520
+ padding: "12px 16px",
521
521
  fontSize: "13px",
522
522
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
523
523
  backdropFilter: "blur(8px)",
524
- maxWidth: "500px",
525
- minWidth: "350px"
524
+ maxWidth: "min(90vw, 700px)",
525
+ width: "100%",
526
+ boxSizing: "border-box",
527
+ overflow: "hidden"
526
528
  },
527
529
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
528
530
  "div",
@@ -534,94 +536,125 @@ function ToastProvider({
534
536
  gap: "10px"
535
537
  },
536
538
  children: [
537
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px", flex: 1 }, children: [
538
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
539
- "div",
540
- {
541
- style: {
542
- width: "12px",
543
- height: "12px",
544
- borderRadius: "50%",
545
- backgroundColor: colors.border,
546
- flexShrink: 0
547
- }
548
- }
549
- ),
550
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "10px", flex: 1 }, children: [
551
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
552
- "div",
553
- {
554
- style: {
555
- color: colors.text,
556
- lineHeight: "1.4",
557
- fontWeight: "400",
558
- fontSize: "13px",
559
- flex: 1,
560
- wordWrap: "break-word",
561
- overflowWrap: "break-word",
562
- hyphens: "auto"
563
- },
564
- children: (() => {
565
- const message = bannerError.message;
566
- const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
567
- const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
568
- let cleanMessage = message.replace(markdownLinkRegex, "").replace(plainUrlRegex, "").replace(/See more:\s*/g, "").replace(/\s+/g, " ").trim();
569
- if (cleanMessage.length > 120) {
570
- cleanMessage = cleanMessage.substring(0, 117) + "...";
539
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
540
+ "div",
541
+ {
542
+ style: {
543
+ display: "flex",
544
+ alignItems: "center",
545
+ gap: "8px",
546
+ flex: 1,
547
+ minWidth: 0
548
+ },
549
+ children: [
550
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
551
+ "div",
552
+ {
553
+ style: {
554
+ width: "12px",
555
+ height: "12px",
556
+ borderRadius: "50%",
557
+ backgroundColor: colors.border,
558
+ flexShrink: 0
571
559
  }
572
- return cleanMessage;
573
- })()
574
- }
575
- ),
576
- (() => {
577
- const message = bannerError.message;
578
- const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
579
- const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
580
- let url = null;
581
- let buttonText = "See More";
582
- const markdownMatch = markdownLinkRegex.exec(message);
583
- if (markdownMatch) {
584
- url = markdownMatch[2];
585
- buttonText = "See More";
586
- } else {
587
- const urlMatch = plainUrlRegex.exec(message);
588
- if (urlMatch) {
589
- url = urlMatch[0];
590
- buttonText = "See More";
591
560
  }
592
- }
593
- if (!url)
594
- return null;
595
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
596
- "button",
561
+ ),
562
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
563
+ "div",
597
564
  {
598
- onClick: () => window.open(url, "_blank", "noopener,noreferrer"),
599
565
  style: {
600
- background: colors.border,
601
- color: "white",
602
- border: "none",
603
- borderRadius: "5px",
604
- padding: "4px 10px",
605
- fontSize: "11px",
606
- fontWeight: "500",
607
- cursor: "pointer",
608
- transition: "all 0.2s ease",
609
- flexShrink: 0
610
- },
611
- onMouseEnter: (e) => {
612
- e.currentTarget.style.opacity = "0.9";
613
- e.currentTarget.style.transform = "translateY(-1px)";
614
- },
615
- onMouseLeave: (e) => {
616
- e.currentTarget.style.opacity = "1";
617
- e.currentTarget.style.transform = "translateY(0)";
566
+ display: "flex",
567
+ alignItems: "center",
568
+ gap: "10px",
569
+ flex: 1,
570
+ minWidth: 0
618
571
  },
619
- children: buttonText
572
+ children: [
573
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
574
+ "div",
575
+ {
576
+ style: {
577
+ color: colors.text,
578
+ lineHeight: "1.4",
579
+ fontWeight: "400",
580
+ fontSize: "13px",
581
+ flex: 1,
582
+ wordBreak: "break-all",
583
+ overflowWrap: "break-word",
584
+ maxWidth: "550px",
585
+ overflow: "hidden",
586
+ display: "-webkit-box",
587
+ WebkitLineClamp: 10,
588
+ WebkitBoxOrient: "vertical"
589
+ },
590
+ children: (() => {
591
+ let message = bannerError.message;
592
+ const jsonMatch = message.match(/'message':\s*'([^']+)'/);
593
+ if (jsonMatch) {
594
+ return jsonMatch[1];
595
+ }
596
+ message = message.split(" - ")[0];
597
+ message = message.split(": Error code")[0];
598
+ message = message.replace(/:\s*\d{3}$/, "");
599
+ message = message.replace(/See more:.*$/g, "");
600
+ message = message.trim();
601
+ return message || "Configuration error occurred.";
602
+ })()
603
+ }
604
+ ),
605
+ (() => {
606
+ const message = bannerError.message;
607
+ const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
608
+ const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
609
+ let url = null;
610
+ let buttonText = "See More";
611
+ const markdownMatch = markdownLinkRegex.exec(message);
612
+ if (markdownMatch) {
613
+ url = markdownMatch[2];
614
+ buttonText = "See More";
615
+ } else {
616
+ const urlMatch = plainUrlRegex.exec(message);
617
+ if (urlMatch) {
618
+ url = urlMatch[0].replace(/[.,;:'"]*$/, "");
619
+ buttonText = "See More";
620
+ }
621
+ }
622
+ if (!url)
623
+ return null;
624
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
625
+ "button",
626
+ {
627
+ onClick: () => window.open(url, "_blank", "noopener,noreferrer"),
628
+ style: {
629
+ background: colors.border,
630
+ color: "white",
631
+ border: "none",
632
+ borderRadius: "5px",
633
+ padding: "4px 10px",
634
+ fontSize: "11px",
635
+ fontWeight: "500",
636
+ cursor: "pointer",
637
+ transition: "all 0.2s ease",
638
+ flexShrink: 0
639
+ },
640
+ onMouseEnter: (e) => {
641
+ e.currentTarget.style.opacity = "0.9";
642
+ e.currentTarget.style.transform = "translateY(-1px)";
643
+ },
644
+ onMouseLeave: (e) => {
645
+ e.currentTarget.style.opacity = "1";
646
+ e.currentTarget.style.transform = "translateY(0)";
647
+ },
648
+ children: buttonText
649
+ }
650
+ );
651
+ })()
652
+ ]
620
653
  }
621
- );
622
- })()
623
- ] })
624
- ] }),
654
+ )
655
+ ]
656
+ }
657
+ ),
625
658
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
626
659
  "button",
627
660
  {
@@ -674,8 +707,38 @@ function CopilotMessages({ children }) {
674
707
  const lastLoadedThreadId = (0, import_react6.useRef)();
675
708
  const lastLoadedAgentName = (0, import_react6.useRef)();
676
709
  const lastLoadedMessages = (0, import_react6.useRef)();
677
- const { threadId, agentSession, runtimeClient, showDevConsole } = useCopilotContext();
710
+ const { threadId, agentSession, runtimeClient, showDevConsole, onTrace, copilotApiConfig } = useCopilotContext();
678
711
  const { setBannerError } = useToast();
712
+ const traceUIError = (0, import_react6.useCallback)(
713
+ (error, originalError) => __async(this, null, function* () {
714
+ if (!onTrace || !copilotApiConfig.publicApiKey)
715
+ return;
716
+ try {
717
+ const traceEvent = {
718
+ type: "error",
719
+ timestamp: Date.now(),
720
+ context: {
721
+ source: "ui",
722
+ request: {
723
+ operation: "loadAgentState",
724
+ url: copilotApiConfig.chatApiEndpoint,
725
+ startTime: Date.now()
726
+ },
727
+ technical: {
728
+ environment: "browser",
729
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
730
+ stackTrace: originalError instanceof Error ? originalError.stack : void 0
731
+ }
732
+ },
733
+ error
734
+ };
735
+ yield onTrace(traceEvent);
736
+ } catch (traceError) {
737
+ console.error("Error in CopilotMessages onTrace handler:", traceError);
738
+ }
739
+ }),
740
+ [onTrace, copilotApiConfig.publicApiKey, copilotApiConfig.chatApiEndpoint]
741
+ );
679
742
  const createStructuredError2 = (gqlError) => {
680
743
  const extensions = gqlError.extensions;
681
744
  const originalError = extensions == null ? void 0 : extensions.originalError;
@@ -720,12 +783,14 @@ function CopilotMessages({ children }) {
720
783
  const ckError = createStructuredError2(gqlError);
721
784
  if (ckError) {
722
785
  setBannerError(ckError);
786
+ traceUIError(ckError, gqlError);
723
787
  } else {
724
788
  const fallbackError = new import_shared4.CopilotKitError({
725
789
  message: gqlError.message,
726
790
  code: import_shared4.CopilotKitErrorCode.UNKNOWN
727
791
  });
728
792
  setBannerError(fallbackError);
793
+ traceUIError(fallbackError, gqlError);
729
794
  }
730
795
  };
731
796
  graphQLErrors.forEach(routeError);
@@ -739,10 +804,11 @@ function CopilotMessages({ children }) {
739
804
  code: import_shared4.CopilotKitErrorCode.UNKNOWN
740
805
  });
741
806
  setBannerError(fallbackError);
807
+ traceUIError(fallbackError, error);
742
808
  }
743
809
  }
744
810
  },
745
- [setBannerError, showDevConsole]
811
+ [setBannerError, showDevConsole, traceUIError]
746
812
  );
747
813
  (0, import_react6.useEffect)(() => {
748
814
  if (!threadId || threadId === lastLoadedThreadId.current)
@@ -813,7 +879,7 @@ var useCopilotRuntimeClient = (options) => {
813
879
  startTime: Date.now()
814
880
  },
815
881
  technical: {
816
- environment: process.env.NODE_ENV,
882
+ environment: "browser",
817
883
  userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
818
884
  stackTrace: originalError instanceof Error ? originalError.stack : void 0
819
885
  }
@@ -979,8 +1045,8 @@ var defaultIcons = {
979
1045
  "svg",
980
1046
  {
981
1047
  viewBox: "0 0 24 24",
982
- width: "18",
983
- height: "18",
1048
+ width: "16",
1049
+ height: "16",
984
1050
  stroke: "currentColor",
985
1051
  strokeWidth: "2.5",
986
1052
  fill: "none",
@@ -997,8 +1063,8 @@ var defaultIcons = {
997
1063
  "svg",
998
1064
  {
999
1065
  viewBox: "0 0 24 24",
1000
- width: "18",
1001
- height: "18",
1066
+ width: "16",
1067
+ height: "16",
1002
1068
  stroke: "currentColor",
1003
1069
  strokeWidth: "2.5",
1004
1070
  fill: "none",
@@ -1015,8 +1081,8 @@ var defaultIcons = {
1015
1081
  "svg",
1016
1082
  {
1017
1083
  viewBox: "0 0 24 24",
1018
- width: "18",
1019
- height: "18",
1084
+ width: "16",
1085
+ height: "16",
1020
1086
  stroke: "currentColor",
1021
1087
  strokeWidth: "2.5",
1022
1088
  fill: "none",
@@ -1041,19 +1107,33 @@ function UsageBanner({
1041
1107
  return null;
1042
1108
  }
1043
1109
  const parseMessage = (rawMessage) => {
1044
- const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
1045
- const matches = Array.from(rawMessage.matchAll(linkRegex));
1046
- if (matches.length > 0) {
1047
- let cleanMessage2 = rawMessage.replace(/\.\s*See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, ".").replace(/See more:\s*\[([^\]]+)\]\(([^)]+)\)/g, "").trim();
1048
- return cleanMessage2;
1110
+ if (rawMessage.toLowerCase().includes("authentication") || rawMessage.toLowerCase().includes("api key")) {
1111
+ return "Authentication failed. Please check your API key.";
1112
+ }
1113
+ if (rawMessage.toLowerCase().includes("rate limit")) {
1114
+ return "Rate limit exceeded. Please try again later.";
1115
+ }
1116
+ if (rawMessage.toLowerCase().includes("checkpointer")) {
1117
+ return "Agent configuration error. Please check your setup.";
1049
1118
  }
1050
- return rawMessage;
1119
+ let cleanMessage2 = rawMessage;
1120
+ cleanMessage2 = cleanMessage2.split(" - ")[0];
1121
+ cleanMessage2 = cleanMessage2.split(": Error code")[0];
1122
+ cleanMessage2 = cleanMessage2.split(": 401")[0];
1123
+ cleanMessage2 = cleanMessage2.split(": 403")[0];
1124
+ cleanMessage2 = cleanMessage2.split(": 404")[0];
1125
+ cleanMessage2 = cleanMessage2.split(": 500")[0];
1126
+ cleanMessage2 = cleanMessage2.replace(/See more:.*$/g, "").trim();
1127
+ if (cleanMessage2.includes("{") || cleanMessage2.includes("'") || cleanMessage2.length > 60) {
1128
+ return "Configuration error. Please check your setup.";
1129
+ }
1130
+ return cleanMessage2 || "An error occurred. Please check your configuration.";
1051
1131
  };
1052
1132
  const cleanMessage = parseMessage(message);
1053
1133
  const Icon = icon || defaultIcons[severity];
1054
1134
  const themeConfigs = {
1055
1135
  [import_shared7.Severity.INFO]: {
1056
- bg: "linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)",
1136
+ bg: "rgba(239, 246, 255, 0.95)",
1057
1137
  border: "#93c5fd",
1058
1138
  text: "#1e40af",
1059
1139
  icon: "#3b82f6",
@@ -1061,7 +1141,7 @@ function UsageBanner({
1061
1141
  primaryBtnHover: "#2563eb"
1062
1142
  },
1063
1143
  [import_shared7.Severity.WARNING]: {
1064
- bg: "linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%)",
1144
+ bg: "rgba(255, 251, 235, 0.95)",
1065
1145
  border: "#fbbf24",
1066
1146
  text: "#92400e",
1067
1147
  icon: "#f59e0b",
@@ -1069,7 +1149,7 @@ function UsageBanner({
1069
1149
  primaryBtnHover: "#d97706"
1070
1150
  },
1071
1151
  [import_shared7.Severity.CRITICAL]: {
1072
- bg: "linear-gradient(135deg, #fef2f2 0%, #fecaca 100%)",
1152
+ bg: "rgba(254, 242, 242, 0.95)",
1073
1153
  border: "#f87171",
1074
1154
  text: "#991b1b",
1075
1155
  icon: "#ef4444",
@@ -1083,24 +1163,26 @@ function UsageBanner({
1083
1163
  {
1084
1164
  style: {
1085
1165
  position: "fixed",
1086
- bottom: "20px",
1166
+ bottom: "24px",
1087
1167
  left: "50%",
1088
1168
  transform: "translateX(-50%)",
1089
- maxWidth: "min(95vw, 680px)",
1090
- width: "100%",
1169
+ width: "400px",
1170
+ maxWidth: "90vw",
1091
1171
  zIndex: 1e4,
1092
- animation: "bannerSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
1172
+ animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
1093
1173
  },
1094
1174
  children: [
1095
1175
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
1096
1176
  @keyframes bannerSlideIn {
1097
1177
  from {
1098
1178
  opacity: 0;
1099
- transform: translateX(-50%) translateY(10px);
1179
+ transform: translateX(-50%) translateY(20px);
1180
+ scale: 0.95;
1100
1181
  }
1101
1182
  to {
1102
1183
  opacity: 1;
1103
1184
  transform: translateX(-50%) translateY(0);
1185
+ scale: 1;
1104
1186
  }
1105
1187
  }
1106
1188
  ` }),
@@ -1108,17 +1190,16 @@ function UsageBanner({
1108
1190
  "div",
1109
1191
  {
1110
1192
  style: {
1111
- display: "flex",
1112
- alignItems: "flex-start",
1113
- gap: "14px",
1114
- borderRadius: "16px",
1193
+ borderRadius: "12px",
1115
1194
  border: `1px solid ${themeConfig.border}`,
1116
1195
  background: themeConfig.bg,
1117
- padding: "18px 20px",
1118
- boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",
1196
+ padding: "14px",
1197
+ boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08)",
1119
1198
  position: "relative",
1120
- backdropFilter: "blur(10px)",
1121
- WebkitBackdropFilter: "blur(10px)"
1199
+ backdropFilter: "blur(12px)",
1200
+ WebkitBackdropFilter: "blur(12px)",
1201
+ boxSizing: "border-box",
1202
+ overflow: "hidden"
1122
1203
  },
1123
1204
  children: [
1124
1205
  onClose && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -1127,35 +1208,23 @@ function UsageBanner({
1127
1208
  onClick: onClose,
1128
1209
  style: {
1129
1210
  position: "absolute",
1130
- top: "12px",
1131
- right: "12px",
1132
- background: "rgba(255, 255, 255, 0.8)",
1211
+ top: "8px",
1212
+ right: "8px",
1213
+ background: "rgba(255, 255, 255, 0.9)",
1133
1214
  border: "none",
1134
1215
  color: themeConfig.text,
1135
1216
  cursor: "pointer",
1136
- fontSize: "18px",
1217
+ fontSize: "16px",
1137
1218
  lineHeight: "1",
1138
- padding: "6px",
1139
- borderRadius: "8px",
1140
- opacity: 0.7,
1141
- transition: "all 0.2s ease",
1219
+ padding: "4px",
1220
+ borderRadius: "4px",
1221
+ width: "20px",
1222
+ height: "20px",
1142
1223
  display: "flex",
1143
1224
  alignItems: "center",
1144
- justifyContent: "center",
1145
- width: "28px",
1146
- height: "28px"
1225
+ justifyContent: "center"
1147
1226
  },
1148
1227
  title: "Close",
1149
- onMouseOver: (e) => {
1150
- e.currentTarget.style.opacity = "1";
1151
- e.currentTarget.style.background = "rgba(255, 255, 255, 1)";
1152
- e.currentTarget.style.transform = "scale(1.05)";
1153
- },
1154
- onMouseOut: (e) => {
1155
- e.currentTarget.style.opacity = "0.7";
1156
- e.currentTarget.style.background = "rgba(255, 255, 255, 0.8)";
1157
- e.currentTarget.style.transform = "scale(1)";
1158
- },
1159
1228
  children: "\xD7"
1160
1229
  }
1161
1230
  ),
@@ -1163,106 +1232,92 @@ function UsageBanner({
1163
1232
  "div",
1164
1233
  {
1165
1234
  style: {
1166
- color: themeConfig.icon,
1167
- flexShrink: 0,
1168
- marginTop: "1px",
1169
- padding: "6px",
1170
- borderRadius: "10px",
1171
- background: "rgba(255, 255, 255, 0.7)",
1172
- display: "flex",
1173
- alignItems: "center",
1174
- justifyContent: "center"
1235
+ fontSize: "14px",
1236
+ fontWeight: 500,
1237
+ color: themeConfig.text,
1238
+ lineHeight: "1.4",
1239
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
1240
+ paddingRight: onClose ? "30px" : "0",
1241
+ marginBottom: actions ? "12px" : "0",
1242
+ wordBreak: "break-word",
1243
+ overflow: "hidden",
1244
+ textOverflow: "ellipsis",
1245
+ display: "-webkit-box",
1246
+ WebkitLineClamp: 2,
1247
+ WebkitBoxOrient: "vertical"
1175
1248
  },
1176
- children: Icon
1249
+ children: cleanMessage
1177
1250
  }
1178
1251
  ),
1179
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { flex: 1, paddingRight: onClose ? "40px" : "0" }, children: [
1180
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1181
- "div",
1182
- {
1183
- style: {
1184
- fontSize: "15px",
1185
- fontWeight: 600,
1186
- color: themeConfig.text,
1187
- lineHeight: "1.5",
1188
- marginBottom: actions ? "12px" : "0",
1189
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1190
- },
1191
- children: cleanMessage
1192
- }
1193
- ),
1194
- actions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1195
- "div",
1196
- {
1197
- style: {
1198
- display: "flex",
1199
- gap: "10px",
1200
- flexWrap: "wrap"
1201
- },
1202
- children: [
1203
- actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1204
- "button",
1205
- {
1206
- onClick: actions.secondary.onClick,
1207
- style: {
1208
- borderRadius: "10px",
1209
- padding: "8px 16px",
1210
- fontSize: "14px",
1211
- fontWeight: 500,
1212
- color: themeConfig.text,
1213
- backgroundColor: "rgba(255, 255, 255, 0.8)",
1214
- border: `1.5px solid ${themeConfig.border}`,
1215
- cursor: "pointer",
1216
- transition: "all 0.2s ease",
1217
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1218
- },
1219
- onMouseOver: (e) => {
1220
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
1221
- e.currentTarget.style.transform = "translateY(-1px)";
1222
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
1223
- },
1224
- onMouseOut: (e) => {
1225
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
1226
- e.currentTarget.style.transform = "translateY(0)";
1227
- e.currentTarget.style.boxShadow = "none";
1228
- },
1229
- children: actions.secondary.label
1230
- }
1231
- ),
1232
- actions.primary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1233
- "button",
1234
- {
1235
- onClick: actions.primary.onClick,
1236
- style: {
1237
- borderRadius: "10px",
1238
- padding: "8px 16px",
1239
- fontSize: "14px",
1240
- fontWeight: 600,
1241
- color: "#fff",
1242
- backgroundColor: themeConfig.primaryBtn,
1243
- border: "none",
1244
- cursor: "pointer",
1245
- transition: "all 0.2s ease",
1246
- boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
1247
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1248
- },
1249
- onMouseOver: (e) => {
1250
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
1251
- e.currentTarget.style.transform = "translateY(-1px)";
1252
- e.currentTarget.style.boxShadow = "0 6px 16px rgba(0, 0, 0, 0.2)";
1253
- },
1254
- onMouseOut: (e) => {
1255
- e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
1256
- e.currentTarget.style.transform = "translateY(0)";
1257
- e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
1258
- },
1259
- children: actions.primary.label
1260
- }
1261
- )
1262
- ]
1263
- }
1264
- )
1265
- ] })
1252
+ actions && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
1253
+ "div",
1254
+ {
1255
+ style: {
1256
+ display: "flex",
1257
+ gap: "8px",
1258
+ flexWrap: "wrap"
1259
+ },
1260
+ children: [
1261
+ actions.secondary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1262
+ "button",
1263
+ {
1264
+ onClick: actions.secondary.onClick,
1265
+ style: {
1266
+ borderRadius: "8px",
1267
+ padding: "6px 12px",
1268
+ fontSize: "13px",
1269
+ fontWeight: 500,
1270
+ color: themeConfig.text,
1271
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
1272
+ border: `1px solid ${themeConfig.border}`,
1273
+ cursor: "pointer",
1274
+ transition: "all 0.2s ease",
1275
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1276
+ },
1277
+ onMouseOver: (e) => {
1278
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
1279
+ e.currentTarget.style.transform = "translateY(-1px)";
1280
+ },
1281
+ onMouseOut: (e) => {
1282
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.9)";
1283
+ e.currentTarget.style.transform = "translateY(0)";
1284
+ },
1285
+ children: actions.secondary.label
1286
+ }
1287
+ ),
1288
+ actions.primary && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1289
+ "button",
1290
+ {
1291
+ onClick: actions.primary.onClick,
1292
+ style: {
1293
+ borderRadius: "8px",
1294
+ padding: "6px 12px",
1295
+ fontSize: "13px",
1296
+ fontWeight: 600,
1297
+ color: "#fff",
1298
+ backgroundColor: themeConfig.primaryBtn,
1299
+ border: "none",
1300
+ cursor: "pointer",
1301
+ transition: "all 0.2s ease",
1302
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
1303
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1304
+ },
1305
+ onMouseOver: (e) => {
1306
+ e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
1307
+ e.currentTarget.style.transform = "translateY(-1px)";
1308
+ e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.2)";
1309
+ },
1310
+ onMouseOut: (e) => {
1311
+ e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
1312
+ e.currentTarget.style.transform = "translateY(0)";
1313
+ e.currentTarget.style.boxShadow = "0 2px 8px rgba(0, 0, 0, 0.15)";
1314
+ },
1315
+ children: actions.primary.label
1316
+ }
1317
+ )
1318
+ ]
1319
+ }
1320
+ )
1266
1321
  ]
1267
1322
  }
1268
1323
  )