@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.
- package/CHANGELOG.md +9 -0
- package/dist/{chunk-CCESTGAM.mjs → chunk-3OQM3NEK.mjs} +2 -2
- package/dist/{chunk-T4ZKC4X4.mjs → chunk-3YHYWAHK.mjs} +2 -2
- package/dist/{chunk-ISYBUDL4.mjs → chunk-55QZ2SVJ.mjs} +4 -5
- package/dist/chunk-55QZ2SVJ.mjs.map +1 -0
- package/dist/chunk-57K2ZJ5F.mjs +348 -0
- package/dist/chunk-57K2ZJ5F.mjs.map +1 -0
- package/dist/{chunk-ZHEEHGLS.mjs → chunk-ADIITPD2.mjs} +8 -5
- package/dist/{chunk-ZHEEHGLS.mjs.map → chunk-ADIITPD2.mjs.map} +1 -1
- package/dist/{chunk-S4BOATBG.mjs → chunk-EF5BNM34.mjs} +2 -2
- package/dist/{chunk-I4JPQECN.mjs → chunk-EXU7GWLC.mjs} +4 -4
- package/dist/{chunk-7G6RR4HE.mjs → chunk-FXK6RQIN.mjs} +2 -2
- package/dist/{chunk-JXF732XG.mjs → chunk-G7LYGERN.mjs} +80 -13
- package/dist/chunk-G7LYGERN.mjs.map +1 -0
- package/dist/{chunk-VJCHRQ7Q.mjs → chunk-JDEWNLNP.mjs} +37 -4
- package/dist/chunk-JDEWNLNP.mjs.map +1 -0
- package/dist/{chunk-JHIZ5HAI.mjs → chunk-NQVCZQ5T.mjs} +3 -3
- package/dist/{chunk-VF6UPRKM.mjs → chunk-OF4SZTLL.mjs} +3 -3
- package/dist/{chunk-QQZLIEXK.mjs → chunk-SJJNFYGQ.mjs} +3 -3
- package/dist/{chunk-RN3ZRHI7.mjs → chunk-WOGURSAL.mjs} +5 -5
- package/dist/chunk-YAF2LATQ.mjs +310 -0
- package/dist/chunk-YAF2LATQ.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +35 -2
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
- package/dist/components/copilot-provider/copilotkit.js +289 -234
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +7 -7
- package/dist/components/copilot-provider/index.js +289 -234
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +7 -7
- package/dist/components/error-boundary/error-boundary.js +135 -146
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +4 -4
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +2 -2
- package/dist/components/index.js +289 -234
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +7 -7
- package/dist/components/toast/toast-provider.js +118 -85
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -1
- package/dist/components/usage-banner.js +135 -146
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +1 -1
- package/dist/hooks/index.js +75 -10
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +14 -14
- package/dist/hooks/use-chat.js +72 -10
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +4 -4
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.js +75 -10
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +10 -10
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +3 -3
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +4 -4
- package/dist/hooks/use-copilot-chat.js +72 -10
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +9 -9
- package/dist/hooks/use-copilot-runtime-client.js +1 -1
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.js +72 -10
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +10 -10
- package/dist/index.js +363 -243
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/dist/lib/copilot-task.mjs +8 -8
- package/dist/lib/index.mjs +8 -8
- package/dist/utils/extract.mjs +7 -7
- package/dist/utils/index.mjs +7 -7
- package/package.json +3 -3
- package/src/components/copilot-provider/copilot-messages.tsx +42 -3
- package/src/components/toast/toast-provider.tsx +49 -24
- package/src/components/usage-banner.tsx +144 -147
- package/src/hooks/use-chat.ts +106 -6
- package/src/hooks/use-coagent.ts +5 -0
- package/src/hooks/use-copilot-runtime-client.ts +2 -39
- package/dist/chunk-HD2GE3DK.mjs +0 -359
- package/dist/chunk-HD2GE3DK.mjs.map +0 -1
- package/dist/chunk-ISYBUDL4.mjs.map +0 -1
- package/dist/chunk-JXF732XG.mjs.map +0 -1
- package/dist/chunk-VJCHRQ7Q.mjs.map +0 -1
- package/dist/chunk-VRXANACV.mjs +0 -277
- package/dist/chunk-VRXANACV.mjs.map +0 -1
- /package/dist/{chunk-CCESTGAM.mjs.map → chunk-3OQM3NEK.mjs.map} +0 -0
- /package/dist/{chunk-T4ZKC4X4.mjs.map → chunk-3YHYWAHK.mjs.map} +0 -0
- /package/dist/{chunk-S4BOATBG.mjs.map → chunk-EF5BNM34.mjs.map} +0 -0
- /package/dist/{chunk-I4JPQECN.mjs.map → chunk-EXU7GWLC.mjs.map} +0 -0
- /package/dist/{chunk-7G6RR4HE.mjs.map → chunk-FXK6RQIN.mjs.map} +0 -0
- /package/dist/{chunk-JHIZ5HAI.mjs.map → chunk-NQVCZQ5T.mjs.map} +0 -0
- /package/dist/{chunk-VF6UPRKM.mjs.map → chunk-OF4SZTLL.mjs.map} +0 -0
- /package/dist/{chunk-QQZLIEXK.mjs.map → chunk-SJJNFYGQ.mjs.map} +0 -0
- /package/dist/{chunk-RN3ZRHI7.mjs.map → chunk-WOGURSAL.mjs.map} +0 -0
package/dist/components/index.js
CHANGED
|
@@ -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: "
|
|
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: "
|
|
525
|
-
|
|
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)(
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
{
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
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
|
-
|
|
594
|
-
|
|
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
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
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:
|
|
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:
|
|
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: "
|
|
983
|
-
height: "
|
|
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: "
|
|
1001
|
-
height: "
|
|
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: "
|
|
1019
|
-
height: "
|
|
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
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
return
|
|
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
|
-
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
1166
|
+
bottom: "24px",
|
|
1087
1167
|
left: "50%",
|
|
1088
1168
|
transform: "translateX(-50%)",
|
|
1089
|
-
|
|
1090
|
-
|
|
1169
|
+
width: "400px",
|
|
1170
|
+
maxWidth: "90vw",
|
|
1091
1171
|
zIndex: 1e4,
|
|
1092
|
-
animation: "bannerSlideIn 0.
|
|
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(
|
|
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
|
-
|
|
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: "
|
|
1118
|
-
boxShadow: "0
|
|
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(
|
|
1121
|
-
WebkitBackdropFilter: "blur(
|
|
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: "
|
|
1131
|
-
right: "
|
|
1132
|
-
background: "rgba(255, 255, 255, 0.
|
|
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: "
|
|
1217
|
+
fontSize: "16px",
|
|
1137
1218
|
lineHeight: "1",
|
|
1138
|
-
padding: "
|
|
1139
|
-
borderRadius: "
|
|
1140
|
-
|
|
1141
|
-
|
|
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
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
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:
|
|
1249
|
+
children: cleanMessage
|
|
1177
1250
|
}
|
|
1178
1251
|
),
|
|
1179
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
{
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
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
|
)
|