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