@copilotkit/react-core 1.9.2-next.1 → 1.9.2-next.11
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 +78 -0
- package/dist/{chunk-CCESTGAM.mjs → chunk-3OQM3NEK.mjs} +2 -2
- package/dist/{chunk-2FW7HH6W.mjs → chunk-3YHYWAHK.mjs} +3 -3
- package/dist/{chunk-RUY6MLHA.mjs → chunk-55QZ2SVJ.mjs} +36 -6
- 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-UIT6QMUJ.mjs → chunk-7BYXCFPB.mjs} +5 -5
- package/dist/{chunk-HJP2RX5R.mjs → chunk-AFDL5JI3.mjs} +82 -15
- package/dist/chunk-AFDL5JI3.mjs.map +1 -0
- package/dist/{chunk-SGLWMQ2J.mjs → chunk-BEDNUHSA.mjs} +15 -12
- package/dist/chunk-BEDNUHSA.mjs.map +1 -0
- package/dist/{chunk-Q5D5XQFA.mjs → chunk-CMQV4XNY.mjs} +2 -2
- package/dist/{chunk-LDACFA2B.mjs → chunk-EF5BNM34.mjs} +3 -3
- package/dist/{chunk-UHQMV2CE.mjs → chunk-ERXWDCY6.mjs} +2 -2
- package/dist/{chunk-NNSXCFQO.mjs → chunk-JDEWNLNP.mjs} +41 -7
- package/dist/chunk-JDEWNLNP.mjs.map +1 -0
- package/dist/{chunk-C6F6EQNA.mjs → chunk-JPMIAGI6.mjs} +2 -2
- package/dist/{chunk-T42PN5VN.mjs → chunk-NQVCZQ5T.mjs} +4 -4
- package/dist/{chunk-YZDRMIOM.mjs → chunk-OIPDW3UR.mjs} +4 -4
- package/dist/{chunk-XY5BN4HZ.mjs → chunk-RYREGU4E.mjs} +11 -8
- package/dist/{chunk-XY5BN4HZ.mjs.map → chunk-RYREGU4E.mjs.map} +1 -1
- package/dist/{chunk-QQZLIEXK.mjs → chunk-SJJNFYGQ.mjs} +3 -3
- package/dist/{chunk-YDENFEKA.mjs → chunk-U4LIYN3I.mjs} +2 -2
- package/dist/{chunk-LZDDYZEY.mjs → chunk-UBNRUXEK.mjs} +2 -2
- package/dist/{chunk-6KGEF242.mjs → chunk-XFOTNHYA.mjs} +3 -2
- package/dist/chunk-XFOTNHYA.mjs.map +1 -0
- package/dist/chunk-YAF2LATQ.mjs +310 -0
- package/dist/chunk-YAF2LATQ.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +39 -4
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
- package/dist/components/copilot-provider/copilotkit-props.d.ts +21 -2
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +330 -240
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +10 -10
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +330 -240
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -10
- 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.d.ts +1 -1
- package/dist/components/index.js +330 -240
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -10
- 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/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +2 -1
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +2 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-f9b2b4c3.d.ts → copilot-context-3da805ab.d.ts} +5 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +108 -12
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +32 -32
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +105 -12
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +6 -6
- package/dist/hooks/use-coagent-state-render.js +2 -1
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +3 -3
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +108 -12
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +14 -14
- package/dist/hooks/use-copilot-action.js +2 -1
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +4 -4
- package/dist/hooks/use-copilot-additional-instructions.js +2 -1
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +2 -1
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +5 -5
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +105 -12
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +13 -13
- package/dist/hooks/use-copilot-readable.js +2 -1
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-copilot-runtime-client.d.ts +2 -0
- package/dist/hooks/use-copilot-runtime-client.js +52 -2
- 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-render.js +2 -1
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +105 -12
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +14 -14
- package/dist/hooks/use-make-copilot-document-readable.js +2 -1
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +404 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -33
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +11 -11
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +11 -11
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +10 -10
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +10 -10
- package/jest.config.js +7 -3
- package/package.json +4 -3
- package/src/components/copilot-provider/__tests__/copilotkit-trace.test.tsx +75 -0
- package/src/components/copilot-provider/copilot-messages.tsx +46 -5
- package/src/components/copilot-provider/copilotkit-props.tsx +21 -0
- package/src/components/copilot-provider/copilotkit.tsx +5 -1
- package/src/components/toast/toast-provider.tsx +49 -24
- package/src/components/usage-banner.tsx +144 -147
- package/src/context/copilot-context.tsx +7 -1
- package/src/hooks/use-chat.ts +106 -6
- package/src/hooks/use-coagent.ts +5 -0
- package/src/hooks/use-copilot-runtime-client.ts +41 -39
- package/tsconfig.json +1 -8
- package/tsup.config.ts +6 -6
- package/dist/chunk-6KGEF242.mjs.map +0 -1
- package/dist/chunk-HD2GE3DK.mjs +0 -359
- package/dist/chunk-HD2GE3DK.mjs.map +0 -1
- package/dist/chunk-HJP2RX5R.mjs.map +0 -1
- package/dist/chunk-NNSXCFQO.mjs.map +0 -1
- package/dist/chunk-RUY6MLHA.mjs.map +0 -1
- package/dist/chunk-SGLWMQ2J.mjs.map +0 -1
- package/dist/chunk-VRXANACV.mjs +0 -277
- package/dist/chunk-VRXANACV.mjs.map +0 -1
- package/dist/utils/utils.test.d.ts +0 -2
- package/dist/utils/utils.test.js +0 -9
- package/dist/utils/utils.test.js.map +0 -1
- package/dist/utils/utils.test.mjs +0 -7
- package/dist/utils/utils.test.mjs.map +0 -1
- /package/dist/{chunk-CCESTGAM.mjs.map → chunk-3OQM3NEK.mjs.map} +0 -0
- /package/dist/{chunk-2FW7HH6W.mjs.map → chunk-3YHYWAHK.mjs.map} +0 -0
- /package/dist/{chunk-UIT6QMUJ.mjs.map → chunk-7BYXCFPB.mjs.map} +0 -0
- /package/dist/{chunk-Q5D5XQFA.mjs.map → chunk-CMQV4XNY.mjs.map} +0 -0
- /package/dist/{chunk-LDACFA2B.mjs.map → chunk-EF5BNM34.mjs.map} +0 -0
- /package/dist/{chunk-UHQMV2CE.mjs.map → chunk-ERXWDCY6.mjs.map} +0 -0
- /package/dist/{chunk-C6F6EQNA.mjs.map → chunk-JPMIAGI6.mjs.map} +0 -0
- /package/dist/{chunk-T42PN5VN.mjs.map → chunk-NQVCZQ5T.mjs.map} +0 -0
- /package/dist/{chunk-YZDRMIOM.mjs.map → chunk-OIPDW3UR.mjs.map} +0 -0
- /package/dist/{chunk-QQZLIEXK.mjs.map → chunk-SJJNFYGQ.mjs.map} +0 -0
- /package/dist/{chunk-YDENFEKA.mjs.map → chunk-U4LIYN3I.mjs.map} +0 -0
- /package/dist/{chunk-LZDDYZEY.mjs.map → chunk-UBNRUXEK.mjs.map} +0 -0
|
@@ -160,7 +160,8 @@ var emptyCopilotContext = {
|
|
|
160
160
|
},
|
|
161
161
|
langGraphInterruptAction: null,
|
|
162
162
|
setLangGraphInterruptAction: () => null,
|
|
163
|
-
removeLangGraphInterruptAction: () => null
|
|
163
|
+
removeLangGraphInterruptAction: () => null,
|
|
164
|
+
onTrace: void 0
|
|
164
165
|
};
|
|
165
166
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
166
167
|
function useCopilotContext() {
|
|
@@ -515,12 +516,14 @@ function ToastProvider({
|
|
|
515
516
|
border: `1px solid ${colors.border}`,
|
|
516
517
|
borderLeft: `4px solid ${colors.border}`,
|
|
517
518
|
borderRadius: "8px",
|
|
518
|
-
padding: "
|
|
519
|
+
padding: "12px 16px",
|
|
519
520
|
fontSize: "13px",
|
|
520
521
|
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
521
522
|
backdropFilter: "blur(8px)",
|
|
522
|
-
maxWidth: "
|
|
523
|
-
|
|
523
|
+
maxWidth: "min(90vw, 700px)",
|
|
524
|
+
width: "100%",
|
|
525
|
+
boxSizing: "border-box",
|
|
526
|
+
overflow: "hidden"
|
|
524
527
|
},
|
|
525
528
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
526
529
|
"div",
|
|
@@ -532,94 +535,125 @@ function ToastProvider({
|
|
|
532
535
|
gap: "10px"
|
|
533
536
|
},
|
|
534
537
|
children: [
|
|
535
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
{
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
fontWeight: "400",
|
|
556
|
-
fontSize: "13px",
|
|
557
|
-
flex: 1,
|
|
558
|
-
wordWrap: "break-word",
|
|
559
|
-
overflowWrap: "break-word",
|
|
560
|
-
hyphens: "auto"
|
|
561
|
-
},
|
|
562
|
-
children: (() => {
|
|
563
|
-
const message = bannerError.message;
|
|
564
|
-
const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
565
|
-
const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
|
|
566
|
-
let cleanMessage = message.replace(markdownLinkRegex, "").replace(plainUrlRegex, "").replace(/See more:\s*/g, "").replace(/\s+/g, " ").trim();
|
|
567
|
-
if (cleanMessage.length > 120) {
|
|
568
|
-
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
|
|
569
558
|
}
|
|
570
|
-
return cleanMessage;
|
|
571
|
-
})()
|
|
572
|
-
}
|
|
573
|
-
),
|
|
574
|
-
(() => {
|
|
575
|
-
const message = bannerError.message;
|
|
576
|
-
const markdownLinkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
577
|
-
const plainUrlRegex = /(https?:\/\/[^\s)]+)/g;
|
|
578
|
-
let url = null;
|
|
579
|
-
let buttonText = "See More";
|
|
580
|
-
const markdownMatch = markdownLinkRegex.exec(message);
|
|
581
|
-
if (markdownMatch) {
|
|
582
|
-
url = markdownMatch[2];
|
|
583
|
-
buttonText = "See More";
|
|
584
|
-
} else {
|
|
585
|
-
const urlMatch = plainUrlRegex.exec(message);
|
|
586
|
-
if (urlMatch) {
|
|
587
|
-
url = urlMatch[0];
|
|
588
|
-
buttonText = "See More";
|
|
589
559
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
594
|
-
"button",
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
562
|
+
"div",
|
|
595
563
|
{
|
|
596
|
-
onClick: () => window.open(url, "_blank", "noopener,noreferrer"),
|
|
597
564
|
style: {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
fontSize: "11px",
|
|
604
|
-
fontWeight: "500",
|
|
605
|
-
cursor: "pointer",
|
|
606
|
-
transition: "all 0.2s ease",
|
|
607
|
-
flexShrink: 0
|
|
608
|
-
},
|
|
609
|
-
onMouseEnter: (e) => {
|
|
610
|
-
e.currentTarget.style.opacity = "0.9";
|
|
611
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
565
|
+
display: "flex",
|
|
566
|
+
alignItems: "center",
|
|
567
|
+
gap: "10px",
|
|
568
|
+
flex: 1,
|
|
569
|
+
minWidth: 0
|
|
612
570
|
},
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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
|
+
]
|
|
618
652
|
}
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
653
|
+
)
|
|
654
|
+
]
|
|
655
|
+
}
|
|
656
|
+
),
|
|
623
657
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
624
658
|
"button",
|
|
625
659
|
{
|
|
@@ -672,8 +706,38 @@ function CopilotMessages({ children }) {
|
|
|
672
706
|
const lastLoadedThreadId = (0, import_react6.useRef)();
|
|
673
707
|
const lastLoadedAgentName = (0, import_react6.useRef)();
|
|
674
708
|
const lastLoadedMessages = (0, import_react6.useRef)();
|
|
675
|
-
const { threadId, agentSession, runtimeClient, showDevConsole } = useCopilotContext();
|
|
709
|
+
const { threadId, agentSession, runtimeClient, showDevConsole, onTrace, copilotApiConfig } = useCopilotContext();
|
|
676
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
|
+
);
|
|
677
741
|
const createStructuredError2 = (gqlError) => {
|
|
678
742
|
const extensions = gqlError.extensions;
|
|
679
743
|
const originalError = extensions == null ? void 0 : extensions.originalError;
|
|
@@ -718,12 +782,14 @@ function CopilotMessages({ children }) {
|
|
|
718
782
|
const ckError = createStructuredError2(gqlError);
|
|
719
783
|
if (ckError) {
|
|
720
784
|
setBannerError(ckError);
|
|
785
|
+
traceUIError(ckError, gqlError);
|
|
721
786
|
} else {
|
|
722
787
|
const fallbackError = new import_shared4.CopilotKitError({
|
|
723
788
|
message: gqlError.message,
|
|
724
789
|
code: import_shared4.CopilotKitErrorCode.UNKNOWN
|
|
725
790
|
});
|
|
726
791
|
setBannerError(fallbackError);
|
|
792
|
+
traceUIError(fallbackError, gqlError);
|
|
727
793
|
}
|
|
728
794
|
};
|
|
729
795
|
graphQLErrors.forEach(routeError);
|
|
@@ -737,10 +803,11 @@ function CopilotMessages({ children }) {
|
|
|
737
803
|
code: import_shared4.CopilotKitErrorCode.UNKNOWN
|
|
738
804
|
});
|
|
739
805
|
setBannerError(fallbackError);
|
|
806
|
+
traceUIError(fallbackError, error);
|
|
740
807
|
}
|
|
741
808
|
}
|
|
742
809
|
},
|
|
743
|
-
[setBannerError, showDevConsole]
|
|
810
|
+
[setBannerError, showDevConsole, traceUIError]
|
|
744
811
|
);
|
|
745
812
|
(0, import_react6.useEffect)(() => {
|
|
746
813
|
if (!threadId || threadId === lastLoadedThreadId.current)
|
|
@@ -775,6 +842,7 @@ function CopilotMessages({ children }) {
|
|
|
775
842
|
});
|
|
776
843
|
void fetchMessages();
|
|
777
844
|
}, [threadId, agentSession == null ? void 0 : agentSession.agentName, runtimeClient]);
|
|
845
|
+
const memoizedChildren = (0, import_react6.useMemo)(() => children, [children]);
|
|
778
846
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
779
847
|
CopilotMessagesContext.Provider,
|
|
780
848
|
{
|
|
@@ -782,7 +850,7 @@ function CopilotMessages({ children }) {
|
|
|
782
850
|
messages,
|
|
783
851
|
setMessages
|
|
784
852
|
},
|
|
785
|
-
children
|
|
853
|
+
children: memoizedChildren
|
|
786
854
|
}
|
|
787
855
|
);
|
|
788
856
|
}
|
|
@@ -793,8 +861,35 @@ var import_react7 = require("react");
|
|
|
793
861
|
var import_shared5 = require("@copilotkit/shared");
|
|
794
862
|
var useCopilotRuntimeClient = (options) => {
|
|
795
863
|
const { setBannerError } = useToast();
|
|
796
|
-
const _a = options, { showDevConsole } = _a, runtimeOptions = __objRest(_a, ["showDevConsole"]);
|
|
864
|
+
const _a = options, { showDevConsole, onTrace } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onTrace"]);
|
|
797
865
|
const lastStructuredErrorRef = (0, import_react7.useRef)(null);
|
|
866
|
+
const traceUIError = (error, originalError) => __async(void 0, null, function* () {
|
|
867
|
+
if (!onTrace || !runtimeOptions.publicApiKey)
|
|
868
|
+
return;
|
|
869
|
+
try {
|
|
870
|
+
const traceEvent = {
|
|
871
|
+
type: "error",
|
|
872
|
+
timestamp: Date.now(),
|
|
873
|
+
context: {
|
|
874
|
+
source: "ui",
|
|
875
|
+
request: {
|
|
876
|
+
operation: "runtimeClient",
|
|
877
|
+
url: runtimeOptions.url,
|
|
878
|
+
startTime: Date.now()
|
|
879
|
+
},
|
|
880
|
+
technical: {
|
|
881
|
+
environment: "browser",
|
|
882
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
|
|
883
|
+
stackTrace: originalError instanceof Error ? originalError.stack : void 0
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
error
|
|
887
|
+
};
|
|
888
|
+
yield onTrace(traceEvent);
|
|
889
|
+
} catch (traceError) {
|
|
890
|
+
console.error("Error in onTrace handler:", traceError);
|
|
891
|
+
}
|
|
892
|
+
});
|
|
798
893
|
const runtimeClient = (0, import_react7.useMemo)(() => {
|
|
799
894
|
return new import_runtime_client_gql2.CopilotRuntimeClient(__spreadProps(__spreadValues({}, runtimeOptions), {
|
|
800
895
|
handleGQLErrors: (error) => {
|
|
@@ -822,12 +917,14 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
822
917
|
const ckError = createStructuredError(gqlError);
|
|
823
918
|
if (ckError) {
|
|
824
919
|
setBannerError(ckError);
|
|
920
|
+
traceUIError(ckError, gqlError);
|
|
825
921
|
} else {
|
|
826
922
|
const fallbackError = new import_shared5.CopilotKitError({
|
|
827
923
|
message: gqlError.message,
|
|
828
924
|
code: import_shared5.CopilotKitErrorCode.UNKNOWN
|
|
829
925
|
});
|
|
830
926
|
setBannerError(fallbackError);
|
|
927
|
+
traceUIError(fallbackError, gqlError);
|
|
831
928
|
}
|
|
832
929
|
};
|
|
833
930
|
graphQLErrors.forEach(routeError);
|
|
@@ -841,6 +938,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
841
938
|
code: import_shared5.CopilotKitErrorCode.UNKNOWN
|
|
842
939
|
});
|
|
843
940
|
setBannerError(fallbackError);
|
|
941
|
+
traceUIError(fallbackError, error);
|
|
844
942
|
}
|
|
845
943
|
}
|
|
846
944
|
},
|
|
@@ -853,7 +951,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
853
951
|
setBannerError(warningError);
|
|
854
952
|
}
|
|
855
953
|
}));
|
|
856
|
-
}, [runtimeOptions, setBannerError, showDevConsole]);
|
|
954
|
+
}, [runtimeOptions, setBannerError, showDevConsole, onTrace]);
|
|
857
955
|
return runtimeClient;
|
|
858
956
|
};
|
|
859
957
|
function createStructuredError(gqlError) {
|
|
@@ -946,8 +1044,8 @@ var defaultIcons = {
|
|
|
946
1044
|
"svg",
|
|
947
1045
|
{
|
|
948
1046
|
viewBox: "0 0 24 24",
|
|
949
|
-
width: "
|
|
950
|
-
height: "
|
|
1047
|
+
width: "16",
|
|
1048
|
+
height: "16",
|
|
951
1049
|
stroke: "currentColor",
|
|
952
1050
|
strokeWidth: "2.5",
|
|
953
1051
|
fill: "none",
|
|
@@ -964,8 +1062,8 @@ var defaultIcons = {
|
|
|
964
1062
|
"svg",
|
|
965
1063
|
{
|
|
966
1064
|
viewBox: "0 0 24 24",
|
|
967
|
-
width: "
|
|
968
|
-
height: "
|
|
1065
|
+
width: "16",
|
|
1066
|
+
height: "16",
|
|
969
1067
|
stroke: "currentColor",
|
|
970
1068
|
strokeWidth: "2.5",
|
|
971
1069
|
fill: "none",
|
|
@@ -982,8 +1080,8 @@ var defaultIcons = {
|
|
|
982
1080
|
"svg",
|
|
983
1081
|
{
|
|
984
1082
|
viewBox: "0 0 24 24",
|
|
985
|
-
width: "
|
|
986
|
-
height: "
|
|
1083
|
+
width: "16",
|
|
1084
|
+
height: "16",
|
|
987
1085
|
stroke: "currentColor",
|
|
988
1086
|
strokeWidth: "2.5",
|
|
989
1087
|
fill: "none",
|
|
@@ -1008,19 +1106,33 @@ function UsageBanner({
|
|
|
1008
1106
|
return null;
|
|
1009
1107
|
}
|
|
1010
1108
|
const parseMessage = (rawMessage) => {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
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.";
|
|
1117
|
+
}
|
|
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.";
|
|
1016
1128
|
}
|
|
1017
|
-
return
|
|
1129
|
+
return cleanMessage2 || "An error occurred. Please check your configuration.";
|
|
1018
1130
|
};
|
|
1019
1131
|
const cleanMessage = parseMessage(message);
|
|
1020
1132
|
const Icon = icon || defaultIcons[severity];
|
|
1021
1133
|
const themeConfigs = {
|
|
1022
1134
|
[import_shared7.Severity.INFO]: {
|
|
1023
|
-
bg: "
|
|
1135
|
+
bg: "rgba(239, 246, 255, 0.95)",
|
|
1024
1136
|
border: "#93c5fd",
|
|
1025
1137
|
text: "#1e40af",
|
|
1026
1138
|
icon: "#3b82f6",
|
|
@@ -1028,7 +1140,7 @@ function UsageBanner({
|
|
|
1028
1140
|
primaryBtnHover: "#2563eb"
|
|
1029
1141
|
},
|
|
1030
1142
|
[import_shared7.Severity.WARNING]: {
|
|
1031
|
-
bg: "
|
|
1143
|
+
bg: "rgba(255, 251, 235, 0.95)",
|
|
1032
1144
|
border: "#fbbf24",
|
|
1033
1145
|
text: "#92400e",
|
|
1034
1146
|
icon: "#f59e0b",
|
|
@@ -1036,7 +1148,7 @@ function UsageBanner({
|
|
|
1036
1148
|
primaryBtnHover: "#d97706"
|
|
1037
1149
|
},
|
|
1038
1150
|
[import_shared7.Severity.CRITICAL]: {
|
|
1039
|
-
bg: "
|
|
1151
|
+
bg: "rgba(254, 242, 242, 0.95)",
|
|
1040
1152
|
border: "#f87171",
|
|
1041
1153
|
text: "#991b1b",
|
|
1042
1154
|
icon: "#ef4444",
|
|
@@ -1050,24 +1162,26 @@ function UsageBanner({
|
|
|
1050
1162
|
{
|
|
1051
1163
|
style: {
|
|
1052
1164
|
position: "fixed",
|
|
1053
|
-
bottom: "
|
|
1165
|
+
bottom: "24px",
|
|
1054
1166
|
left: "50%",
|
|
1055
1167
|
transform: "translateX(-50%)",
|
|
1056
|
-
|
|
1057
|
-
|
|
1168
|
+
width: "400px",
|
|
1169
|
+
maxWidth: "90vw",
|
|
1058
1170
|
zIndex: 1e4,
|
|
1059
|
-
animation: "bannerSlideIn 0.
|
|
1171
|
+
animation: "bannerSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1)"
|
|
1060
1172
|
},
|
|
1061
1173
|
children: [
|
|
1062
1174
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
|
|
1063
1175
|
@keyframes bannerSlideIn {
|
|
1064
1176
|
from {
|
|
1065
1177
|
opacity: 0;
|
|
1066
|
-
transform: translateX(-50%) translateY(
|
|
1178
|
+
transform: translateX(-50%) translateY(20px);
|
|
1179
|
+
scale: 0.95;
|
|
1067
1180
|
}
|
|
1068
1181
|
to {
|
|
1069
1182
|
opacity: 1;
|
|
1070
1183
|
transform: translateX(-50%) translateY(0);
|
|
1184
|
+
scale: 1;
|
|
1071
1185
|
}
|
|
1072
1186
|
}
|
|
1073
1187
|
` }),
|
|
@@ -1075,17 +1189,16 @@ function UsageBanner({
|
|
|
1075
1189
|
"div",
|
|
1076
1190
|
{
|
|
1077
1191
|
style: {
|
|
1078
|
-
|
|
1079
|
-
alignItems: "flex-start",
|
|
1080
|
-
gap: "14px",
|
|
1081
|
-
borderRadius: "16px",
|
|
1192
|
+
borderRadius: "12px",
|
|
1082
1193
|
border: `1px solid ${themeConfig.border}`,
|
|
1083
1194
|
background: themeConfig.bg,
|
|
1084
|
-
padding: "
|
|
1085
|
-
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)",
|
|
1086
1197
|
position: "relative",
|
|
1087
|
-
backdropFilter: "blur(
|
|
1088
|
-
WebkitBackdropFilter: "blur(
|
|
1198
|
+
backdropFilter: "blur(12px)",
|
|
1199
|
+
WebkitBackdropFilter: "blur(12px)",
|
|
1200
|
+
boxSizing: "border-box",
|
|
1201
|
+
overflow: "hidden"
|
|
1089
1202
|
},
|
|
1090
1203
|
children: [
|
|
1091
1204
|
onClose && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -1094,35 +1207,23 @@ function UsageBanner({
|
|
|
1094
1207
|
onClick: onClose,
|
|
1095
1208
|
style: {
|
|
1096
1209
|
position: "absolute",
|
|
1097
|
-
top: "
|
|
1098
|
-
right: "
|
|
1099
|
-
background: "rgba(255, 255, 255, 0.
|
|
1210
|
+
top: "8px",
|
|
1211
|
+
right: "8px",
|
|
1212
|
+
background: "rgba(255, 255, 255, 0.9)",
|
|
1100
1213
|
border: "none",
|
|
1101
1214
|
color: themeConfig.text,
|
|
1102
1215
|
cursor: "pointer",
|
|
1103
|
-
fontSize: "
|
|
1216
|
+
fontSize: "16px",
|
|
1104
1217
|
lineHeight: "1",
|
|
1105
|
-
padding: "
|
|
1106
|
-
borderRadius: "
|
|
1107
|
-
|
|
1108
|
-
|
|
1218
|
+
padding: "4px",
|
|
1219
|
+
borderRadius: "4px",
|
|
1220
|
+
width: "20px",
|
|
1221
|
+
height: "20px",
|
|
1109
1222
|
display: "flex",
|
|
1110
1223
|
alignItems: "center",
|
|
1111
|
-
justifyContent: "center"
|
|
1112
|
-
width: "28px",
|
|
1113
|
-
height: "28px"
|
|
1224
|
+
justifyContent: "center"
|
|
1114
1225
|
},
|
|
1115
1226
|
title: "Close",
|
|
1116
|
-
onMouseOver: (e) => {
|
|
1117
|
-
e.currentTarget.style.opacity = "1";
|
|
1118
|
-
e.currentTarget.style.background = "rgba(255, 255, 255, 1)";
|
|
1119
|
-
e.currentTarget.style.transform = "scale(1.05)";
|
|
1120
|
-
},
|
|
1121
|
-
onMouseOut: (e) => {
|
|
1122
|
-
e.currentTarget.style.opacity = "0.7";
|
|
1123
|
-
e.currentTarget.style.background = "rgba(255, 255, 255, 0.8)";
|
|
1124
|
-
e.currentTarget.style.transform = "scale(1)";
|
|
1125
|
-
},
|
|
1126
1227
|
children: "\xD7"
|
|
1127
1228
|
}
|
|
1128
1229
|
),
|
|
@@ -1130,106 +1231,92 @@ function UsageBanner({
|
|
|
1130
1231
|
"div",
|
|
1131
1232
|
{
|
|
1132
1233
|
style: {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
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"
|
|
1142
1247
|
},
|
|
1143
|
-
children:
|
|
1248
|
+
children: cleanMessage
|
|
1144
1249
|
}
|
|
1145
1250
|
),
|
|
1146
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
{
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
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
|
-
onMouseOver: (e) => {
|
|
1217
|
-
e.currentTarget.style.backgroundColor = themeConfig.primaryBtnHover;
|
|
1218
|
-
e.currentTarget.style.transform = "translateY(-1px)";
|
|
1219
|
-
e.currentTarget.style.boxShadow = "0 6px 16px rgba(0, 0, 0, 0.2)";
|
|
1220
|
-
},
|
|
1221
|
-
onMouseOut: (e) => {
|
|
1222
|
-
e.currentTarget.style.backgroundColor = themeConfig.primaryBtn;
|
|
1223
|
-
e.currentTarget.style.transform = "translateY(0)";
|
|
1224
|
-
e.currentTarget.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)";
|
|
1225
|
-
},
|
|
1226
|
-
children: actions.primary.label
|
|
1227
|
-
}
|
|
1228
|
-
)
|
|
1229
|
-
]
|
|
1230
|
-
}
|
|
1231
|
-
)
|
|
1232
|
-
] })
|
|
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
|
+
)
|
|
1233
1320
|
]
|
|
1234
1321
|
}
|
|
1235
1322
|
)
|
|
@@ -1633,7 +1720,8 @@ ${nonDocumentStrings}`;
|
|
|
1633
1720
|
publicApiKey: copilotApiConfig.publicApiKey,
|
|
1634
1721
|
headers,
|
|
1635
1722
|
credentials: copilotApiConfig.credentials,
|
|
1636
|
-
showDevConsole: (_b = props.showDevConsole) != null ? _b : false
|
|
1723
|
+
showDevConsole: (_b = props.showDevConsole) != null ? _b : false,
|
|
1724
|
+
onTrace: props.onTrace
|
|
1637
1725
|
});
|
|
1638
1726
|
const [chatSuggestionConfiguration, setChatSuggestionConfiguration] = (0, import_react10.useState)({});
|
|
1639
1727
|
const addChatSuggestionConfiguration = (id, suggestion) => {
|
|
@@ -1723,6 +1811,7 @@ ${nonDocumentStrings}`;
|
|
|
1723
1811
|
const removeLangGraphInterruptAction = (0, import_react10.useCallback)(() => {
|
|
1724
1812
|
setLangGraphInterruptAction(null);
|
|
1725
1813
|
}, []);
|
|
1814
|
+
const memoizedChildren = (0, import_react10.useMemo)(() => children, [children]);
|
|
1726
1815
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1727
1816
|
CopilotContext.Provider,
|
|
1728
1817
|
{
|
|
@@ -1775,9 +1864,10 @@ ${nonDocumentStrings}`;
|
|
|
1775
1864
|
setExtensions,
|
|
1776
1865
|
langGraphInterruptAction,
|
|
1777
1866
|
setLangGraphInterruptAction,
|
|
1778
|
-
removeLangGraphInterruptAction
|
|
1867
|
+
removeLangGraphInterruptAction,
|
|
1868
|
+
onTrace: props.onTrace
|
|
1779
1869
|
},
|
|
1780
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotMessages, { children })
|
|
1870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopilotMessages, { children: memoizedChildren })
|
|
1781
1871
|
}
|
|
1782
1872
|
);
|
|
1783
1873
|
}
|