@yourgpt/copilot-sdk 2.1.5-alpha.1 → 2.1.5-alpha.2
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/dist/{chunk-4QXY2PBG.js → chunk-3AONOZLY.js} +2 -2
- package/dist/{chunk-4QXY2PBG.js.map → chunk-3AONOZLY.js.map} +1 -1
- package/dist/{chunk-JKGFQUHJ.cjs → chunk-MDS23G2S.cjs} +5 -5
- package/dist/{chunk-JKGFQUHJ.cjs.map → chunk-MDS23G2S.cjs.map} +1 -1
- package/dist/{chunk-5Q72LZ5H.js → chunk-PT2TOHG5.js} +7 -3
- package/dist/chunk-PT2TOHG5.js.map +1 -0
- package/dist/{chunk-ENFWM3EY.js → chunk-RKGRQRZU.js} +3 -3
- package/dist/{chunk-ENFWM3EY.js.map → chunk-RKGRQRZU.js.map} +1 -1
- package/dist/{chunk-IXWNDR7H.cjs → chunk-TCPAT3WG.cjs} +35 -31
- package/dist/chunk-TCPAT3WG.cjs.map +1 -0
- package/dist/{chunk-246B6X5D.cjs → chunk-TPB7XED6.cjs} +2 -2
- package/dist/{chunk-246B6X5D.cjs.map → chunk-TPB7XED6.cjs.map} +1 -1
- package/dist/{chunk-I3SQUNTT.cjs → chunk-WIXFZUEZ.cjs} +23 -23
- package/dist/{chunk-I3SQUNTT.cjs.map → chunk-WIXFZUEZ.cjs.map} +1 -1
- package/dist/{chunk-UXJ6LIZB.js → chunk-WZ2TOZ7M.js} +4 -4
- package/dist/{chunk-UXJ6LIZB.js.map → chunk-WZ2TOZ7M.js.map} +1 -1
- package/dist/core/index.cjs +82 -82
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/{index-CiExk87c.d.cts → index-CzJB8Ddo.d.cts} +1 -1
- package/dist/{index-Dwrcf-CP.d.ts → index-D7169xuR.d.ts} +1 -1
- package/dist/mcp/index.d.cts +3 -3
- package/dist/mcp/index.d.ts +3 -3
- package/dist/react/index.cjs +65 -65
- package/dist/react/index.d.cts +8 -4
- package/dist/react/index.d.ts +8 -4
- package/dist/react/index.js +4 -4
- package/dist/styles.css +43 -0
- package/dist/tools/anthropic/index.d.cts +1 -1
- package/dist/tools/anthropic/index.d.ts +1 -1
- package/dist/tools/brave/index.cjs +2 -2
- package/dist/tools/brave/index.d.cts +1 -1
- package/dist/tools/brave/index.d.ts +1 -1
- package/dist/tools/brave/index.js +1 -1
- package/dist/tools/exa/index.cjs +2 -2
- package/dist/tools/exa/index.d.cts +1 -1
- package/dist/tools/exa/index.d.ts +1 -1
- package/dist/tools/exa/index.js +1 -1
- package/dist/tools/google/index.cjs +2 -2
- package/dist/tools/google/index.d.cts +1 -1
- package/dist/tools/google/index.d.ts +1 -1
- package/dist/tools/google/index.js +1 -1
- package/dist/tools/openai/index.cjs +2 -2
- package/dist/tools/openai/index.d.cts +1 -1
- package/dist/tools/openai/index.d.ts +1 -1
- package/dist/tools/openai/index.js +1 -1
- package/dist/tools/searxng/index.cjs +2 -2
- package/dist/tools/searxng/index.d.cts +1 -1
- package/dist/tools/searxng/index.d.ts +1 -1
- package/dist/tools/searxng/index.js +1 -1
- package/dist/tools/serper/index.cjs +2 -2
- package/dist/tools/serper/index.d.cts +1 -1
- package/dist/tools/serper/index.d.ts +1 -1
- package/dist/tools/serper/index.js +1 -1
- package/dist/tools/tavily/index.cjs +2 -2
- package/dist/tools/tavily/index.d.cts +1 -1
- package/dist/tools/tavily/index.d.ts +1 -1
- package/dist/tools/tavily/index.js +1 -1
- package/dist/tools/web-search/index.cjs +3 -3
- package/dist/tools/web-search/index.d.cts +2 -2
- package/dist/tools/web-search/index.d.ts +2 -2
- package/dist/tools/web-search/index.js +2 -2
- package/dist/{tools-DHZhF5km.d.cts → tools-tmksfhUo.d.cts} +9 -0
- package/dist/{tools-DHZhF5km.d.ts → tools-tmksfhUo.d.ts} +9 -0
- package/dist/{types-BdX7uPj0.d.cts → types-BLw7mxtW.d.cts} +1 -1
- package/dist/{types-BTyJu0WD.d.ts → types-BqwW3Baj.d.ts} +1 -1
- package/dist/ui/index.cjs +291 -301
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +40 -56
- package/dist/ui/index.d.ts +40 -56
- package/dist/ui/index.js +238 -248
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5Q72LZ5H.js.map +0 -1
- package/dist/chunk-IXWNDR7H.cjs.map +0 -1
package/dist/ui/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkTCPAT3WG_cjs = require('../chunk-TCPAT3WG.cjs');
|
|
4
|
+
var chunkWIXFZUEZ_cjs = require('../chunk-WIXFZUEZ.cjs');
|
|
5
5
|
var chunkJO4BHPAD_cjs = require('../chunk-JO4BHPAD.cjs');
|
|
6
6
|
require('../chunk-JGPDQDY4.cjs');
|
|
7
7
|
require('../chunk-BJYA5NDL.cjs');
|
|
8
|
-
require('../chunk-
|
|
9
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-MDS23G2S.cjs');
|
|
9
|
+
require('../chunk-TPB7XED6.cjs');
|
|
10
10
|
require('../chunk-NUXLAZOE.cjs');
|
|
11
11
|
require('../chunk-TXLIY7GF.cjs');
|
|
12
12
|
require('../chunk-CBAHCI4R.cjs');
|
|
@@ -20,7 +20,7 @@ require('../chunk-JEQ2X3Z6.cjs');
|
|
|
20
20
|
var clsx = require('clsx');
|
|
21
21
|
var tailwindMerge = require('tailwind-merge');
|
|
22
22
|
var jsxRuntime = require('react/jsx-runtime');
|
|
23
|
-
var
|
|
23
|
+
var React17 = require('react');
|
|
24
24
|
var streamdown = require('streamdown');
|
|
25
25
|
var code = require('@streamdown/code');
|
|
26
26
|
var reactSlot = require('@radix-ui/react-slot');
|
|
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
|
|
|
50
50
|
return Object.freeze(n);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var React17__namespace = /*#__PURE__*/_interopNamespace(React17);
|
|
54
54
|
var AvatarPrimitive__namespace = /*#__PURE__*/_interopNamespace(AvatarPrimitive);
|
|
55
55
|
var HoverCardPrimitive__namespace = /*#__PURE__*/_interopNamespace(HoverCardPrimitive);
|
|
56
56
|
|
|
@@ -366,7 +366,7 @@ function MarkdownComponent({
|
|
|
366
366
|
}
|
|
367
367
|
) });
|
|
368
368
|
}
|
|
369
|
-
var Markdown =
|
|
369
|
+
var Markdown = React17.memo(MarkdownComponent);
|
|
370
370
|
Markdown.displayName = "Markdown";
|
|
371
371
|
function CodeBlock({ children, className, ...props }) {
|
|
372
372
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -407,7 +407,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
);
|
|
410
|
-
var Button =
|
|
410
|
+
var Button = React17__namespace.forwardRef(
|
|
411
411
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
412
412
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
413
413
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -648,7 +648,7 @@ function TooltipTrigger({
|
|
|
648
648
|
disabled,
|
|
649
649
|
...props
|
|
650
650
|
}) {
|
|
651
|
-
if (asChild &&
|
|
651
|
+
if (asChild && React17__namespace.default.isValidElement(children)) {
|
|
652
652
|
return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Trigger, { disabled, render: children, ...props });
|
|
653
653
|
}
|
|
654
654
|
return /* @__PURE__ */ jsxRuntime.jsx(tooltip.Tooltip.Trigger, { disabled, ...props, children });
|
|
@@ -677,7 +677,7 @@ function TooltipContent({
|
|
|
677
677
|
}
|
|
678
678
|
) }) });
|
|
679
679
|
}
|
|
680
|
-
var Avatar =
|
|
680
|
+
var Avatar = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
681
681
|
AvatarPrimitive__namespace.Root,
|
|
682
682
|
{
|
|
683
683
|
ref,
|
|
@@ -689,7 +689,7 @@ var Avatar = React18__namespace.forwardRef(({ className, ...props }, ref) => /*
|
|
|
689
689
|
}
|
|
690
690
|
));
|
|
691
691
|
Avatar.displayName = AvatarPrimitive__namespace.Root.displayName;
|
|
692
|
-
var AvatarImage =
|
|
692
|
+
var AvatarImage = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
693
693
|
AvatarPrimitive__namespace.Image,
|
|
694
694
|
{
|
|
695
695
|
ref,
|
|
@@ -698,7 +698,7 @@ var AvatarImage = React18__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
698
698
|
}
|
|
699
699
|
));
|
|
700
700
|
AvatarImage.displayName = AvatarPrimitive__namespace.Image.displayName;
|
|
701
|
-
var AvatarFallback =
|
|
701
|
+
var AvatarFallback = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
702
702
|
AvatarPrimitive__namespace.Fallback,
|
|
703
703
|
{
|
|
704
704
|
ref,
|
|
@@ -758,7 +758,7 @@ var MessageContent = ({
|
|
|
758
758
|
);
|
|
759
759
|
return markdown ? /* @__PURE__ */ jsxRuntime.jsx(Markdown, { className: classNames, ...props, children }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames, ...props, children });
|
|
760
760
|
};
|
|
761
|
-
var Textarea =
|
|
761
|
+
var Textarea = React17__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
762
762
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
763
763
|
"textarea",
|
|
764
764
|
{
|
|
@@ -772,7 +772,7 @@ var Textarea = React18__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
|
772
772
|
);
|
|
773
773
|
});
|
|
774
774
|
Textarea.displayName = "Textarea";
|
|
775
|
-
var PromptInputContext =
|
|
775
|
+
var PromptInputContext = React17.createContext({
|
|
776
776
|
isLoading: false,
|
|
777
777
|
value: "",
|
|
778
778
|
setValue: () => {
|
|
@@ -783,7 +783,7 @@ var PromptInputContext = React18.createContext({
|
|
|
783
783
|
textareaRef: { current: null }
|
|
784
784
|
});
|
|
785
785
|
function usePromptInput() {
|
|
786
|
-
return
|
|
786
|
+
return React17.useContext(PromptInputContext);
|
|
787
787
|
}
|
|
788
788
|
function PromptInput({
|
|
789
789
|
className,
|
|
@@ -797,8 +797,8 @@ function PromptInput({
|
|
|
797
797
|
onClick,
|
|
798
798
|
...props
|
|
799
799
|
}) {
|
|
800
|
-
const [internalValue, setInternalValue] =
|
|
801
|
-
const textareaRef =
|
|
800
|
+
const [internalValue, setInternalValue] = React17.useState(value || "");
|
|
801
|
+
const textareaRef = React17.useRef(null);
|
|
802
802
|
const handleChange = (newValue) => {
|
|
803
803
|
setInternalValue(newValue);
|
|
804
804
|
onValueChange?.(newValue);
|
|
@@ -855,7 +855,7 @@ function PromptInputTextarea({
|
|
|
855
855
|
textareaRef.current = el;
|
|
856
856
|
adjustHeight(el);
|
|
857
857
|
};
|
|
858
|
-
|
|
858
|
+
React17.useLayoutEffect(() => {
|
|
859
859
|
if (!textareaRef.current || disableAutosize) return;
|
|
860
860
|
const el = textareaRef.current;
|
|
861
861
|
el.style.height = "auto";
|
|
@@ -922,7 +922,7 @@ function PromptInputAction({
|
|
|
922
922
|
}
|
|
923
923
|
var HoverCard = HoverCardPrimitive__namespace.Root;
|
|
924
924
|
var HoverCardTrigger = HoverCardPrimitive__namespace.Trigger;
|
|
925
|
-
var HoverCardContent =
|
|
925
|
+
var HoverCardContent = React17__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
926
926
|
HoverCardPrimitive__namespace.Content,
|
|
927
927
|
{
|
|
928
928
|
ref,
|
|
@@ -936,9 +936,9 @@ var HoverCardContent = React18__namespace.forwardRef(({ className, align = "cent
|
|
|
936
936
|
}
|
|
937
937
|
));
|
|
938
938
|
HoverCardContent.displayName = HoverCardPrimitive__namespace.Content.displayName;
|
|
939
|
-
var SourceContext =
|
|
939
|
+
var SourceContext = React17.createContext(null);
|
|
940
940
|
function useSourceContext() {
|
|
941
|
-
const ctx =
|
|
941
|
+
const ctx = React17.useContext(SourceContext);
|
|
942
942
|
if (!ctx) throw new Error("Source.* must be used inside <Source>");
|
|
943
943
|
return ctx;
|
|
944
944
|
}
|
|
@@ -1465,7 +1465,7 @@ function SourcesCollapsible({
|
|
|
1465
1465
|
defaultExpanded = false,
|
|
1466
1466
|
className
|
|
1467
1467
|
}) {
|
|
1468
|
-
const [expanded, setExpanded] =
|
|
1468
|
+
const [expanded, setExpanded] = React17__namespace.useState(defaultExpanded);
|
|
1469
1469
|
if (citations.length === 0) return null;
|
|
1470
1470
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("border rounded-lg", className), children: [
|
|
1471
1471
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1531,7 +1531,7 @@ function SourcesList({
|
|
|
1531
1531
|
if (compact) {
|
|
1532
1532
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("text-xs text-muted-foreground", className), children: [
|
|
1533
1533
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: "Sources: " }),
|
|
1534
|
-
citations.map((c, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1534
|
+
citations.map((c, i) => /* @__PURE__ */ jsxRuntime.jsxs(React17__namespace.Fragment, { children: [
|
|
1535
1535
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1536
1536
|
"a",
|
|
1537
1537
|
{
|
|
@@ -1609,11 +1609,11 @@ function resultsToCitations(results) {
|
|
|
1609
1609
|
domain: result.domain || getDomain3(result.url)
|
|
1610
1610
|
}));
|
|
1611
1611
|
}
|
|
1612
|
-
var ReasoningContext =
|
|
1612
|
+
var ReasoningContext = React17__namespace.createContext(
|
|
1613
1613
|
null
|
|
1614
1614
|
);
|
|
1615
1615
|
function useReasoningContext() {
|
|
1616
|
-
const context =
|
|
1616
|
+
const context = React17__namespace.useContext(ReasoningContext);
|
|
1617
1617
|
if (!context) {
|
|
1618
1618
|
throw new Error(
|
|
1619
1619
|
"Reasoning components must be used within a Reasoning provider"
|
|
@@ -1629,11 +1629,11 @@ function Reasoning({
|
|
|
1629
1629
|
defaultOpen = false,
|
|
1630
1630
|
className
|
|
1631
1631
|
}) {
|
|
1632
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
1633
|
-
const prevStreamingRef =
|
|
1632
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React17__namespace.useState(defaultOpen);
|
|
1633
|
+
const prevStreamingRef = React17__namespace.useRef(isStreaming);
|
|
1634
1634
|
const isControlled = controlledOpen !== void 0;
|
|
1635
1635
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1636
|
-
const setIsOpen =
|
|
1636
|
+
const setIsOpen = React17__namespace.useCallback(
|
|
1637
1637
|
(open) => {
|
|
1638
1638
|
if (onOpenChange) {
|
|
1639
1639
|
onOpenChange(open);
|
|
@@ -1644,7 +1644,7 @@ function Reasoning({
|
|
|
1644
1644
|
},
|
|
1645
1645
|
[isControlled, onOpenChange]
|
|
1646
1646
|
);
|
|
1647
|
-
|
|
1647
|
+
React17__namespace.useEffect(() => {
|
|
1648
1648
|
if (isStreaming && !prevStreamingRef.current) {
|
|
1649
1649
|
setIsOpen(true);
|
|
1650
1650
|
} else if (!isStreaming && prevStreamingRef.current) {
|
|
@@ -1700,9 +1700,9 @@ function ReasoningContent({
|
|
|
1700
1700
|
className
|
|
1701
1701
|
}) {
|
|
1702
1702
|
const { isOpen } = useReasoningContext();
|
|
1703
|
-
const contentRef =
|
|
1704
|
-
const [height, setHeight] =
|
|
1705
|
-
|
|
1703
|
+
const contentRef = React17__namespace.useRef(null);
|
|
1704
|
+
const [height, setHeight] = React17__namespace.useState(0);
|
|
1705
|
+
React17__namespace.useEffect(() => {
|
|
1706
1706
|
if (contentRef.current) {
|
|
1707
1707
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
1708
1708
|
for (const entry of entries) {
|
|
@@ -1751,11 +1751,11 @@ function SimpleReasoning({
|
|
|
1751
1751
|
/* @__PURE__ */ jsxRuntime.jsx(ReasoningContent, { markdown, children: content })
|
|
1752
1752
|
] });
|
|
1753
1753
|
}
|
|
1754
|
-
var CopilotUIContext =
|
|
1754
|
+
var CopilotUIContext = React17__namespace.createContext(
|
|
1755
1755
|
null
|
|
1756
1756
|
);
|
|
1757
1757
|
function useCopilotUI() {
|
|
1758
|
-
const context =
|
|
1758
|
+
const context = React17__namespace.useContext(CopilotUIContext);
|
|
1759
1759
|
if (!context) {
|
|
1760
1760
|
return {
|
|
1761
1761
|
debug: false,
|
|
@@ -1770,7 +1770,7 @@ function CopilotUIProvider({
|
|
|
1770
1770
|
debug = false,
|
|
1771
1771
|
defaultDebugExpanded = false
|
|
1772
1772
|
}) {
|
|
1773
|
-
const value =
|
|
1773
|
+
const value = React17__namespace.useMemo(
|
|
1774
1774
|
() => ({
|
|
1775
1775
|
debug,
|
|
1776
1776
|
defaultDebugExpanded,
|
|
@@ -1913,7 +1913,7 @@ function ToolStep({
|
|
|
1913
1913
|
}) {
|
|
1914
1914
|
const { isDebug, defaultDebugExpanded } = useCopilotUI();
|
|
1915
1915
|
const debug = debugProp ?? isDebug;
|
|
1916
|
-
const [expanded, setExpanded] =
|
|
1916
|
+
const [expanded, setExpanded] = React17__namespace.useState(
|
|
1917
1917
|
defaultExpanded ?? defaultDebugExpanded ?? false
|
|
1918
1918
|
);
|
|
1919
1919
|
const displayTitle = getDisplayTitle(step);
|
|
@@ -2394,9 +2394,9 @@ function ArrowUpRightIcon({ className }) {
|
|
|
2394
2394
|
}
|
|
2395
2395
|
);
|
|
2396
2396
|
}
|
|
2397
|
-
var ConfirmationContext =
|
|
2397
|
+
var ConfirmationContext = React17__namespace.createContext(null);
|
|
2398
2398
|
function useConfirmationContext() {
|
|
2399
|
-
const context =
|
|
2399
|
+
const context = React17__namespace.useContext(ConfirmationContext);
|
|
2400
2400
|
if (!context) {
|
|
2401
2401
|
throw new Error(
|
|
2402
2402
|
"Confirmation components must be used within a Confirmation provider"
|
|
@@ -2564,30 +2564,27 @@ function PermissionConfirmation({
|
|
|
2564
2564
|
message,
|
|
2565
2565
|
onApprove,
|
|
2566
2566
|
onReject,
|
|
2567
|
-
showPermissionOptions = true,
|
|
2568
|
-
permissionOptions = DEFAULT_PERMISSION_OPTIONS,
|
|
2569
2567
|
className
|
|
2570
2568
|
}) {
|
|
2571
|
-
const [selectedPermission, setSelectedPermission] = React18__namespace.useState("ask");
|
|
2572
|
-
const [showOptions, setShowOptions] = React18__namespace.useState(false);
|
|
2573
2569
|
const handleApprove = () => {
|
|
2574
|
-
onApprove?.(
|
|
2570
|
+
onApprove?.("ask");
|
|
2575
2571
|
};
|
|
2576
2572
|
const handleReject = () => {
|
|
2577
|
-
onReject?.(
|
|
2578
|
-
selectedPermission === "deny_always" ? "deny_always" : void 0
|
|
2579
|
-
);
|
|
2573
|
+
onReject?.(void 0);
|
|
2580
2574
|
};
|
|
2581
2575
|
if (state === "approved") {
|
|
2582
2576
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2583
2577
|
"div",
|
|
2584
2578
|
{
|
|
2585
2579
|
className: cn(
|
|
2586
|
-
"
|
|
2580
|
+
"csdk-confirm-result",
|
|
2581
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2582
|
+
"rounded-2xl border border-green-200/70 dark:border-green-900/40",
|
|
2583
|
+
"bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-400",
|
|
2587
2584
|
className
|
|
2588
2585
|
),
|
|
2589
2586
|
children: [
|
|
2590
|
-
/* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "h-
|
|
2587
|
+
/* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2591
2588
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Approved" })
|
|
2592
2589
|
]
|
|
2593
2590
|
}
|
|
@@ -2598,11 +2595,14 @@ function PermissionConfirmation({
|
|
|
2598
2595
|
"div",
|
|
2599
2596
|
{
|
|
2600
2597
|
className: cn(
|
|
2601
|
-
"
|
|
2598
|
+
"csdk-confirm-result",
|
|
2599
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2600
|
+
"rounded-2xl border border-red-200/70 dark:border-red-900/40",
|
|
2601
|
+
"bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-400",
|
|
2602
2602
|
className
|
|
2603
2603
|
),
|
|
2604
2604
|
children: [
|
|
2605
|
-
/* @__PURE__ */ jsxRuntime.jsx(XIcon2, { className: "h-
|
|
2605
|
+
/* @__PURE__ */ jsxRuntime.jsx(XIcon2, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2606
2606
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Rejected" })
|
|
2607
2607
|
]
|
|
2608
2608
|
}
|
|
@@ -2612,81 +2612,47 @@ function PermissionConfirmation({
|
|
|
2612
2612
|
"div",
|
|
2613
2613
|
{
|
|
2614
2614
|
className: cn(
|
|
2615
|
-
"
|
|
2615
|
+
"csdk-confirm-card",
|
|
2616
|
+
"w-full rounded-2xl border border-border/60 bg-card text-card-foreground shadow-sm overflow-hidden",
|
|
2616
2617
|
className
|
|
2617
2618
|
),
|
|
2618
2619
|
children: [
|
|
2619
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3
|
|
2620
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2621
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2622
|
-
toolName && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-
|
|
2623
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-
|
|
2620
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 p-4", children: [
|
|
2621
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-xl bg-amber-100 dark:bg-amber-950/50", children: /* @__PURE__ */ jsxRuntime.jsx(AlertTriangleIcon, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }) }),
|
|
2622
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0 pt-0.5", children: [
|
|
2623
|
+
toolName && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[10px] font-semibold uppercase tracking-widest text-muted-foreground mb-1", children: toolName }),
|
|
2624
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground leading-snug", children: message || "This tool requires your approval to execute." })
|
|
2624
2625
|
] })
|
|
2625
2626
|
] }),
|
|
2626
|
-
|
|
2627
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2627
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-2 px-4 pb-4", children: [
|
|
2628
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2628
2629
|
"button",
|
|
2629
2630
|
{
|
|
2630
2631
|
type: "button",
|
|
2631
|
-
onClick:
|
|
2632
|
-
className:
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
"h-4 w-4 transition-transform",
|
|
2640
|
-
showOptions && "rotate-180"
|
|
2641
|
-
),
|
|
2642
|
-
fill: "none",
|
|
2643
|
-
viewBox: "0 0 24 24",
|
|
2644
|
-
stroke: "currentColor",
|
|
2645
|
-
strokeWidth: 2,
|
|
2646
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2647
|
-
"path",
|
|
2648
|
-
{
|
|
2649
|
-
strokeLinecap: "round",
|
|
2650
|
-
strokeLinejoin: "round",
|
|
2651
|
-
d: "M19 9l-7 7-7-7"
|
|
2652
|
-
}
|
|
2653
|
-
)
|
|
2654
|
-
}
|
|
2655
|
-
)
|
|
2656
|
-
]
|
|
2632
|
+
onClick: handleReject,
|
|
2633
|
+
className: cn(
|
|
2634
|
+
"csdk-confirm-btn",
|
|
2635
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2636
|
+
"border border-border bg-transparent text-muted-foreground",
|
|
2637
|
+
"hover:bg-muted/60 hover:text-foreground"
|
|
2638
|
+
),
|
|
2639
|
+
children: "Deny"
|
|
2657
2640
|
}
|
|
2658
2641
|
),
|
|
2659
|
-
|
|
2660
|
-
"
|
|
2642
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2643
|
+
"button",
|
|
2661
2644
|
{
|
|
2645
|
+
type: "button",
|
|
2646
|
+
onClick: handleApprove,
|
|
2662
2647
|
className: cn(
|
|
2663
|
-
"
|
|
2664
|
-
|
|
2648
|
+
"csdk-confirm-btn",
|
|
2649
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2650
|
+
"bg-primary text-primary-foreground",
|
|
2651
|
+
"hover:opacity-90"
|
|
2665
2652
|
),
|
|
2666
|
-
children:
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
{
|
|
2670
|
-
type: "radio",
|
|
2671
|
-
name: "permission",
|
|
2672
|
-
value: option.value,
|
|
2673
|
-
checked: selectedPermission === option.value,
|
|
2674
|
-
onChange: () => setSelectedPermission(option.value),
|
|
2675
|
-
className: "mt-0.5"
|
|
2676
|
-
}
|
|
2677
|
-
),
|
|
2678
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2679
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-medium", children: option.label }),
|
|
2680
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: option.description })
|
|
2681
|
-
] })
|
|
2682
|
-
]
|
|
2683
|
-
},
|
|
2684
|
-
option.value
|
|
2685
|
-
)) })
|
|
2686
|
-
] }),
|
|
2687
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
2688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleReject, children: "Deny" }),
|
|
2689
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "default", size: "sm", onClick: handleApprove, children: "Allow" })
|
|
2653
|
+
children: "Allow"
|
|
2654
|
+
}
|
|
2655
|
+
)
|
|
2690
2656
|
] })
|
|
2691
2657
|
]
|
|
2692
2658
|
}
|
|
@@ -2699,23 +2665,25 @@ function CompactPermissionConfirmation({
|
|
|
2699
2665
|
onReject,
|
|
2700
2666
|
className
|
|
2701
2667
|
}) {
|
|
2702
|
-
const [rememberChoice, setRememberChoice] = React18__namespace.useState(false);
|
|
2703
2668
|
const handleApprove = () => {
|
|
2704
|
-
onApprove?.(
|
|
2669
|
+
onApprove?.("ask");
|
|
2705
2670
|
};
|
|
2706
2671
|
const handleReject = () => {
|
|
2707
|
-
onReject?.(
|
|
2672
|
+
onReject?.(void 0);
|
|
2708
2673
|
};
|
|
2709
2674
|
if (state === "approved") {
|
|
2710
2675
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2711
2676
|
"div",
|
|
2712
2677
|
{
|
|
2713
2678
|
className: cn(
|
|
2714
|
-
"
|
|
2679
|
+
"csdk-confirm-result",
|
|
2680
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2681
|
+
"rounded-2xl border border-green-200/70 dark:border-green-900/40",
|
|
2682
|
+
"bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-400",
|
|
2715
2683
|
className
|
|
2716
2684
|
),
|
|
2717
2685
|
children: [
|
|
2718
|
-
/* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "h-
|
|
2686
|
+
/* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2719
2687
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Approved" })
|
|
2720
2688
|
]
|
|
2721
2689
|
}
|
|
@@ -2726,11 +2694,14 @@ function CompactPermissionConfirmation({
|
|
|
2726
2694
|
"div",
|
|
2727
2695
|
{
|
|
2728
2696
|
className: cn(
|
|
2729
|
-
"
|
|
2697
|
+
"csdk-confirm-result",
|
|
2698
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2699
|
+
"rounded-2xl border border-red-200/70 dark:border-red-900/40",
|
|
2700
|
+
"bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-400",
|
|
2730
2701
|
className
|
|
2731
2702
|
),
|
|
2732
2703
|
children: [
|
|
2733
|
-
/* @__PURE__ */ jsxRuntime.jsx(XIcon2, { className: "h-
|
|
2704
|
+
/* @__PURE__ */ jsxRuntime.jsx(XIcon2, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2734
2705
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Rejected" })
|
|
2735
2706
|
]
|
|
2736
2707
|
}
|
|
@@ -2740,31 +2711,44 @@ function CompactPermissionConfirmation({
|
|
|
2740
2711
|
"div",
|
|
2741
2712
|
{
|
|
2742
2713
|
className: cn(
|
|
2743
|
-
"
|
|
2714
|
+
"csdk-confirm-card",
|
|
2715
|
+
"w-full rounded-2xl border border-border/60 bg-card text-card-foreground shadow-sm overflow-hidden",
|
|
2744
2716
|
className
|
|
2745
2717
|
),
|
|
2746
2718
|
children: [
|
|
2747
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3
|
|
2748
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2749
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: message || "This action requires your approval." })
|
|
2719
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 p-4", children: [
|
|
2720
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-xl bg-amber-100 dark:bg-amber-950/50", children: /* @__PURE__ */ jsxRuntime.jsx(AlertTriangleIcon, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }) }),
|
|
2721
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 min-w-0 pt-0.5 text-sm text-foreground leading-snug", children: message || "This action requires your approval." })
|
|
2750
2722
|
] }),
|
|
2751
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-
|
|
2752
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2723
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-2 px-4 pb-4", children: [
|
|
2724
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2725
|
+
"button",
|
|
2726
|
+
{
|
|
2727
|
+
type: "button",
|
|
2728
|
+
onClick: handleReject,
|
|
2729
|
+
className: cn(
|
|
2730
|
+
"csdk-confirm-btn",
|
|
2731
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2732
|
+
"border border-border bg-transparent text-muted-foreground",
|
|
2733
|
+
"hover:bg-muted/60 hover:text-foreground"
|
|
2734
|
+
),
|
|
2735
|
+
children: "Deny"
|
|
2736
|
+
}
|
|
2737
|
+
),
|
|
2738
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2739
|
+
"button",
|
|
2740
|
+
{
|
|
2741
|
+
type: "button",
|
|
2742
|
+
onClick: handleApprove,
|
|
2743
|
+
className: cn(
|
|
2744
|
+
"csdk-confirm-btn",
|
|
2745
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2746
|
+
"bg-primary text-primary-foreground",
|
|
2747
|
+
"hover:opacity-90"
|
|
2748
|
+
),
|
|
2749
|
+
children: "Allow"
|
|
2750
|
+
}
|
|
2751
|
+
)
|
|
2768
2752
|
] })
|
|
2769
2753
|
]
|
|
2770
2754
|
}
|
|
@@ -2896,8 +2880,8 @@ function DevLogger({
|
|
|
2896
2880
|
position = "bottom-right",
|
|
2897
2881
|
className
|
|
2898
2882
|
}) {
|
|
2899
|
-
const [isOpen, setIsOpen] =
|
|
2900
|
-
const [activeTab, setActiveTab] =
|
|
2883
|
+
const [isOpen, setIsOpen] = React17.useState(false);
|
|
2884
|
+
const [activeTab, setActiveTab] = React17.useState("chat");
|
|
2901
2885
|
const positionClasses = {
|
|
2902
2886
|
"bottom-left": "bottom-4 left-4",
|
|
2903
2887
|
"bottom-right": "bottom-4 right-4",
|
|
@@ -3322,9 +3306,9 @@ function ModelSelector({
|
|
|
3322
3306
|
showCapabilities = true,
|
|
3323
3307
|
className
|
|
3324
3308
|
}) {
|
|
3325
|
-
const [isOpen, setIsOpen] =
|
|
3326
|
-
const containerRef =
|
|
3327
|
-
|
|
3309
|
+
const [isOpen, setIsOpen] = React17__namespace.useState(false);
|
|
3310
|
+
const containerRef = React17__namespace.useRef(null);
|
|
3311
|
+
React17__namespace.useEffect(() => {
|
|
3328
3312
|
function handleClickOutside(event) {
|
|
3329
3313
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
3330
3314
|
setIsOpen(false);
|
|
@@ -3333,7 +3317,7 @@ function ModelSelector({
|
|
|
3333
3317
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3334
3318
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3335
3319
|
}, []);
|
|
3336
|
-
const selectedModel =
|
|
3320
|
+
const selectedModel = React17__namespace.useMemo(() => {
|
|
3337
3321
|
if (!value) return null;
|
|
3338
3322
|
if (providers) {
|
|
3339
3323
|
for (const provider of providers) {
|
|
@@ -3559,7 +3543,7 @@ function PopoverTrigger({
|
|
|
3559
3543
|
className,
|
|
3560
3544
|
...props
|
|
3561
3545
|
}) {
|
|
3562
|
-
if (asChild &&
|
|
3546
|
+
if (asChild && React17__namespace.isValidElement(children)) {
|
|
3563
3547
|
return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Trigger, { render: children, className, ...props });
|
|
3564
3548
|
}
|
|
3565
3549
|
return /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Trigger, { className, ...props, children });
|
|
@@ -3694,8 +3678,8 @@ function ThreadPicker({
|
|
|
3694
3678
|
itemClassName,
|
|
3695
3679
|
newButtonClassName
|
|
3696
3680
|
}) {
|
|
3697
|
-
const [isOpen, setIsOpen] =
|
|
3698
|
-
const selectedThread =
|
|
3681
|
+
const [isOpen, setIsOpen] = React17__namespace.useState(false);
|
|
3682
|
+
const selectedThread = React17__namespace.useMemo(() => {
|
|
3699
3683
|
if (!value) return null;
|
|
3700
3684
|
return threads.find((t) => t.id === value) ?? null;
|
|
3701
3685
|
}, [value, threads]);
|
|
@@ -3901,7 +3885,7 @@ function ThreadCard({
|
|
|
3901
3885
|
showDelete = true,
|
|
3902
3886
|
className
|
|
3903
3887
|
}) {
|
|
3904
|
-
const [isHovered, setIsHovered] =
|
|
3888
|
+
const [isHovered, setIsHovered] = React17__namespace.useState(false);
|
|
3905
3889
|
const handleDelete = (e) => {
|
|
3906
3890
|
e.stopPropagation();
|
|
3907
3891
|
onDelete?.();
|
|
@@ -4142,10 +4126,10 @@ function MCPUIFrame({
|
|
|
4142
4126
|
showLoading = true,
|
|
4143
4127
|
testId
|
|
4144
4128
|
}) {
|
|
4145
|
-
const iframeRef =
|
|
4146
|
-
const [isLoading, setIsLoading] =
|
|
4147
|
-
const [error, setError] =
|
|
4148
|
-
|
|
4129
|
+
const iframeRef = React17__namespace.useRef(null);
|
|
4130
|
+
const [isLoading, setIsLoading] = React17__namespace.useState(true);
|
|
4131
|
+
const [error, setError] = React17__namespace.useState(null);
|
|
4132
|
+
React17__namespace.useEffect(() => {
|
|
4149
4133
|
const handleMessage = (event) => {
|
|
4150
4134
|
if (event.source !== iframeRef.current?.contentWindow) {
|
|
4151
4135
|
return;
|
|
@@ -4158,17 +4142,17 @@ function MCPUIFrame({
|
|
|
4158
4142
|
window.addEventListener("message", handleMessage);
|
|
4159
4143
|
return () => window.removeEventListener("message", handleMessage);
|
|
4160
4144
|
}, [onIntent]);
|
|
4161
|
-
const handleLoad =
|
|
4145
|
+
const handleLoad = React17__namespace.useCallback(() => {
|
|
4162
4146
|
setIsLoading(false);
|
|
4163
4147
|
onLoad?.();
|
|
4164
4148
|
}, [onLoad]);
|
|
4165
|
-
const handleError =
|
|
4149
|
+
const handleError = React17__namespace.useCallback(() => {
|
|
4166
4150
|
const err = new Error("Failed to load MCP UI content");
|
|
4167
4151
|
setError(err);
|
|
4168
4152
|
setIsLoading(false);
|
|
4169
4153
|
onError?.(err);
|
|
4170
4154
|
}, [onError]);
|
|
4171
|
-
const { srcDoc, src } =
|
|
4155
|
+
const { srcDoc, src } = React17__namespace.useMemo(() => {
|
|
4172
4156
|
if (resource.mimeType === "text/html") {
|
|
4173
4157
|
let content = resource.content || "";
|
|
4174
4158
|
if (resource.blob && !resource.content) {
|
|
@@ -4348,24 +4332,24 @@ function DefaultMessage({
|
|
|
4348
4332
|
const isUser = message.role === "user";
|
|
4349
4333
|
const isCompactionMarker = message.role === "system" && message.metadata?.type === "compaction-marker";
|
|
4350
4334
|
const isStreaming = isLastMessage && isLoading;
|
|
4351
|
-
const [isEditing, setIsEditing] =
|
|
4352
|
-
const [editValue, setEditValue] =
|
|
4353
|
-
const editRef =
|
|
4354
|
-
const startEdit =
|
|
4335
|
+
const [isEditing, setIsEditing] = React17__namespace.useState(false);
|
|
4336
|
+
const [editValue, setEditValue] = React17__namespace.useState(message.content ?? "");
|
|
4337
|
+
const editRef = React17__namespace.useRef(null);
|
|
4338
|
+
const startEdit = React17__namespace.useCallback(() => {
|
|
4355
4339
|
setEditValue(message.content ?? "");
|
|
4356
4340
|
setIsEditing(true);
|
|
4357
4341
|
requestAnimationFrame(() => editRef.current?.focus());
|
|
4358
4342
|
}, [message.content]);
|
|
4359
|
-
const cancelEdit =
|
|
4343
|
+
const cancelEdit = React17__namespace.useCallback(() => {
|
|
4360
4344
|
setIsEditing(false);
|
|
4361
4345
|
}, []);
|
|
4362
|
-
const submitEdit =
|
|
4346
|
+
const submitEdit = React17__namespace.useCallback(() => {
|
|
4363
4347
|
const trimmed = editValue.trim();
|
|
4364
4348
|
if (!trimmed || !onEditMessage) return;
|
|
4365
4349
|
onEditMessage(message.id, trimmed);
|
|
4366
4350
|
setIsEditing(false);
|
|
4367
4351
|
}, [editValue, message.id, onEditMessage]);
|
|
4368
|
-
const handleEditKeyDown =
|
|
4352
|
+
const handleEditKeyDown = React17__namespace.useCallback(
|
|
4369
4353
|
(e) => {
|
|
4370
4354
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
4371
4355
|
e.preventDefault();
|
|
@@ -4407,18 +4391,18 @@ function DefaultMessage({
|
|
|
4407
4391
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 h-px bg-border" })
|
|
4408
4392
|
] });
|
|
4409
4393
|
}
|
|
4410
|
-
const { cleanContent: contentWithoutFollowUps, followUps } =
|
|
4394
|
+
const { cleanContent: contentWithoutFollowUps, followUps } = React17__namespace.useMemo(() => {
|
|
4411
4395
|
if (isUser || !message.content) {
|
|
4412
4396
|
return { cleanContent: message.content, followUps: [] };
|
|
4413
4397
|
}
|
|
4414
4398
|
return parseFollowUps(message.content);
|
|
4415
4399
|
}, [message.content, isUser]);
|
|
4416
|
-
const cleanContent =
|
|
4400
|
+
const cleanContent = React17__namespace.useMemo(() => {
|
|
4417
4401
|
if (!contentWithoutFollowUps) return contentWithoutFollowUps;
|
|
4418
4402
|
return contentWithoutFollowUps.replace(/\n*\*{0,2}Sources:?\*{0,2}\s*(\[.+?\]\(.+?\)[,\s]*)+$/gi, "").trim();
|
|
4419
4403
|
}, [contentWithoutFollowUps]);
|
|
4420
4404
|
const shouldShowFollowUps = showFollowUps && !isUser && isLastMessage && !isLoading && followUps.length > 0 && onFollowUpClick;
|
|
4421
|
-
const sources =
|
|
4405
|
+
const sources = React17__namespace.useMemo(() => {
|
|
4422
4406
|
if (isUser || !citations.enabled) return [];
|
|
4423
4407
|
const extractedSources = [];
|
|
4424
4408
|
const addSource = (url, title, description) => {
|
|
@@ -4681,7 +4665,7 @@ function DefaultMessage({
|
|
|
4681
4665
|
renderProps
|
|
4682
4666
|
);
|
|
4683
4667
|
if (output != null) {
|
|
4684
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4668
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React17__namespace.Fragment, { children: output }, exec.id);
|
|
4685
4669
|
}
|
|
4686
4670
|
}
|
|
4687
4671
|
if (mcpToolRenderer && (exec.source === "mcp" || toolDef?.source === "mcp")) {
|
|
@@ -4797,13 +4781,13 @@ function DefaultMessage({
|
|
|
4797
4781
|
const output = toolDef.render(
|
|
4798
4782
|
renderProps
|
|
4799
4783
|
);
|
|
4800
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4784
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React17__namespace.Fragment, { children: output }, tool.id);
|
|
4801
4785
|
}
|
|
4802
4786
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4803
4787
|
PermissionConfirmation,
|
|
4804
4788
|
{
|
|
4805
4789
|
state: "pending",
|
|
4806
|
-
toolName: tool.name,
|
|
4790
|
+
toolName: tool.approvalTitle ?? tool.name,
|
|
4807
4791
|
message: tool.approvalMessage || `This tool wants to execute. Do you approve?`,
|
|
4808
4792
|
onApprove: (permissionLevel) => onApproveToolExecution?.(
|
|
4809
4793
|
tool.id,
|
|
@@ -4846,7 +4830,7 @@ function DefaultMessage({
|
|
|
4846
4830
|
] });
|
|
4847
4831
|
}
|
|
4848
4832
|
function AttachmentPreview({ attachment }) {
|
|
4849
|
-
const [expanded, setExpanded] =
|
|
4833
|
+
const [expanded, setExpanded] = React17__namespace.useState(false);
|
|
4850
4834
|
if (attachment.type !== "image") {
|
|
4851
4835
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2 text-sm", children: [
|
|
4852
4836
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: attachment.type }),
|
|
@@ -4975,10 +4959,10 @@ function ChatWelcome({
|
|
|
4975
4959
|
processAttachment: processAttachmentProp,
|
|
4976
4960
|
classNames = {}
|
|
4977
4961
|
}) {
|
|
4978
|
-
const [input, setInput] =
|
|
4979
|
-
const [pendingAttachments, setPendingAttachments] =
|
|
4980
|
-
const fileInputRef =
|
|
4981
|
-
const fileInputId =
|
|
4962
|
+
const [input, setInput] = React17.useState("");
|
|
4963
|
+
const [pendingAttachments, setPendingAttachments] = React17.useState([]);
|
|
4964
|
+
const fileInputRef = React17.useRef(null);
|
|
4965
|
+
const fileInputId = React17.useId();
|
|
4982
4966
|
const title = config?.title ?? DEFAULT_TITLE;
|
|
4983
4967
|
const subtitle = config?.subtitle ?? DEFAULT_SUBTITLE;
|
|
4984
4968
|
const logo = config?.logo;
|
|
@@ -4987,7 +4971,7 @@ function ChatWelcome({
|
|
|
4987
4971
|
config?.recentChatsLabel ?? DEFAULT_RECENT_CHATS_LABEL;
|
|
4988
4972
|
const maxRecentChats = config?.maxRecentChats ?? DEFAULT_MAX_RECENT_CHATS;
|
|
4989
4973
|
config?.viewMoreLabel ?? DEFAULT_VIEW_MORE_LABEL;
|
|
4990
|
-
const isFileTypeAllowed =
|
|
4974
|
+
const isFileTypeAllowed = React17.useCallback(
|
|
4991
4975
|
(file) => {
|
|
4992
4976
|
for (const type of allowedFileTypes) {
|
|
4993
4977
|
if (type.endsWith("/*")) {
|
|
@@ -5001,7 +4985,7 @@ function ChatWelcome({
|
|
|
5001
4985
|
},
|
|
5002
4986
|
[allowedFileTypes]
|
|
5003
4987
|
);
|
|
5004
|
-
const handleFileSelect =
|
|
4988
|
+
const handleFileSelect = React17.useCallback(
|
|
5005
4989
|
async (files) => {
|
|
5006
4990
|
if (!files || !attachmentsEnabled) return;
|
|
5007
4991
|
for (const file of Array.from(files)) {
|
|
@@ -5064,7 +5048,7 @@ function ChatWelcome({
|
|
|
5064
5048
|
},
|
|
5065
5049
|
[attachmentsEnabled, maxFileSize, isFileTypeAllowed, processAttachmentProp]
|
|
5066
5050
|
);
|
|
5067
|
-
const handleInputChange =
|
|
5051
|
+
const handleInputChange = React17.useCallback(
|
|
5068
5052
|
(e) => {
|
|
5069
5053
|
handleFileSelect(e.target.files);
|
|
5070
5054
|
if (fileInputRef.current) {
|
|
@@ -5073,7 +5057,7 @@ function ChatWelcome({
|
|
|
5073
5057
|
},
|
|
5074
5058
|
[handleFileSelect]
|
|
5075
5059
|
);
|
|
5076
|
-
const removePendingAttachment =
|
|
5060
|
+
const removePendingAttachment = React17.useCallback((id) => {
|
|
5077
5061
|
setPendingAttachments((prev) => {
|
|
5078
5062
|
const att = prev.find((a) => a.id === id);
|
|
5079
5063
|
if (att) {
|
|
@@ -5082,7 +5066,7 @@ function ChatWelcome({
|
|
|
5082
5066
|
return prev.filter((a) => a.id !== id);
|
|
5083
5067
|
});
|
|
5084
5068
|
}, []);
|
|
5085
|
-
const handleSubmit =
|
|
5069
|
+
const handleSubmit = React17.useCallback(() => {
|
|
5086
5070
|
const hasContent = input.trim();
|
|
5087
5071
|
const hasAttachments = pendingAttachments.some(
|
|
5088
5072
|
(att) => att.status === "ready"
|
|
@@ -5094,7 +5078,7 @@ function ChatWelcome({
|
|
|
5094
5078
|
setPendingAttachments([]);
|
|
5095
5079
|
setInput("");
|
|
5096
5080
|
}, [input, isLoading, onSendMessage, pendingAttachments]);
|
|
5097
|
-
const handleSuggestionClick =
|
|
5081
|
+
const handleSuggestionClick = React17.useCallback(
|
|
5098
5082
|
(suggestion) => {
|
|
5099
5083
|
onSendMessage(suggestion);
|
|
5100
5084
|
},
|
|
@@ -5266,11 +5250,11 @@ function ChatWelcome({
|
|
|
5266
5250
|
}
|
|
5267
5251
|
);
|
|
5268
5252
|
}
|
|
5269
|
-
var CopilotChatContext =
|
|
5253
|
+
var CopilotChatContext = React17.createContext(
|
|
5270
5254
|
null
|
|
5271
5255
|
);
|
|
5272
5256
|
var useCopilotChatContext = () => {
|
|
5273
|
-
const ctx =
|
|
5257
|
+
const ctx = React17.useContext(CopilotChatContext);
|
|
5274
5258
|
if (!ctx) {
|
|
5275
5259
|
throw new Error(
|
|
5276
5260
|
"useCopilotChatContext must be used within CopilotChat. Make sure you're using CopilotChat.Home, CopilotChat.Input, etc. inside <CopilotChat>"
|
|
@@ -5304,10 +5288,10 @@ function ChatView({ children, className }) {
|
|
|
5304
5288
|
ChatView.displayName = "ChatView";
|
|
5305
5289
|
function chatViewHasOnlyLayoutChildren(chatViewElement) {
|
|
5306
5290
|
if (!chatViewElement?.props?.children) return false;
|
|
5307
|
-
const childArray =
|
|
5291
|
+
const childArray = React17__namespace.default.Children.toArray(chatViewElement.props.children);
|
|
5308
5292
|
if (childArray.length === 0) return false;
|
|
5309
5293
|
return childArray.every(
|
|
5310
|
-
(child) =>
|
|
5294
|
+
(child) => React17__namespace.default.isValidElement(child) && (child.type === Header || child.type === Footer)
|
|
5311
5295
|
);
|
|
5312
5296
|
}
|
|
5313
5297
|
function Header({ children, className }) {
|
|
@@ -5323,8 +5307,8 @@ function Input({ placeholder: placeholderProp, className }) {
|
|
|
5323
5307
|
onStop,
|
|
5324
5308
|
placeholder: defaultPlaceholder
|
|
5325
5309
|
} = useCopilotChatContext();
|
|
5326
|
-
const [value, setValue] =
|
|
5327
|
-
const handleSubmit =
|
|
5310
|
+
const [value, setValue] = React17.useState("");
|
|
5311
|
+
const handleSubmit = React17.useCallback(() => {
|
|
5328
5312
|
if (value.trim() && !isLoading) {
|
|
5329
5313
|
send(value.trim());
|
|
5330
5314
|
setValue("");
|
|
@@ -5445,18 +5429,18 @@ function ThreadPickerCompound(props) {
|
|
|
5445
5429
|
);
|
|
5446
5430
|
}
|
|
5447
5431
|
function hasCompoundChild(children, ...components) {
|
|
5448
|
-
return
|
|
5449
|
-
(child) =>
|
|
5432
|
+
return React17__namespace.default.Children.toArray(children).some(
|
|
5433
|
+
(child) => React17__namespace.default.isValidElement(child) && components.includes(child.type)
|
|
5450
5434
|
);
|
|
5451
5435
|
}
|
|
5452
5436
|
function findCompoundChild(children, component) {
|
|
5453
|
-
return
|
|
5454
|
-
(child) =>
|
|
5437
|
+
return React17__namespace.default.Children.toArray(children).find(
|
|
5438
|
+
(child) => React17__namespace.default.isValidElement(child) && child.type === component
|
|
5455
5439
|
);
|
|
5456
5440
|
}
|
|
5457
5441
|
function filterCompoundChildren(children, ...components) {
|
|
5458
|
-
return
|
|
5459
|
-
(child) =>
|
|
5442
|
+
return React17__namespace.default.Children.toArray(children).filter(
|
|
5443
|
+
(child) => React17__namespace.default.isValidElement(child) && components.includes(child.type)
|
|
5460
5444
|
);
|
|
5461
5445
|
}
|
|
5462
5446
|
var DEFAULT_MAX_FILE_SIZE2 = 5 * 1024 * 1024;
|
|
@@ -5541,6 +5525,7 @@ function ChatComponent({
|
|
|
5541
5525
|
// Citations/Sources
|
|
5542
5526
|
citations,
|
|
5543
5527
|
// Custom rendering
|
|
5528
|
+
messageView,
|
|
5544
5529
|
renderMessage,
|
|
5545
5530
|
renderInput,
|
|
5546
5531
|
renderHeader,
|
|
@@ -5562,12 +5547,12 @@ function ChatComponent({
|
|
|
5562
5547
|
}) {
|
|
5563
5548
|
const userAvatar = { fallback: "U", ...userAvatarProp };
|
|
5564
5549
|
const assistantAvatar = { fallback: "AI", ...assistantAvatarProp };
|
|
5565
|
-
const [input, setInput] =
|
|
5566
|
-
const [pendingAttachments, setPendingAttachments] =
|
|
5567
|
-
const [isDragging, setIsDragging] =
|
|
5568
|
-
const fileInputRef =
|
|
5569
|
-
const fileInputId =
|
|
5570
|
-
const isFileTypeAllowed =
|
|
5550
|
+
const [input, setInput] = React17.useState("");
|
|
5551
|
+
const [pendingAttachments, setPendingAttachments] = React17.useState([]);
|
|
5552
|
+
const [isDragging, setIsDragging] = React17.useState(false);
|
|
5553
|
+
const fileInputRef = React17.useRef(null);
|
|
5554
|
+
const fileInputId = React17.useId();
|
|
5555
|
+
const isFileTypeAllowed = React17.useCallback(
|
|
5571
5556
|
(file) => {
|
|
5572
5557
|
for (const type of allowedFileTypes) {
|
|
5573
5558
|
if (type.endsWith("/*")) {
|
|
@@ -5581,7 +5566,7 @@ function ChatComponent({
|
|
|
5581
5566
|
},
|
|
5582
5567
|
[allowedFileTypes]
|
|
5583
5568
|
);
|
|
5584
|
-
const handleFileSelect =
|
|
5569
|
+
const handleFileSelect = React17.useCallback(
|
|
5585
5570
|
async (files) => {
|
|
5586
5571
|
if (!files || !attachmentsEnabled) return;
|
|
5587
5572
|
for (const file of Array.from(files)) {
|
|
@@ -5644,7 +5629,7 @@ function ChatComponent({
|
|
|
5644
5629
|
},
|
|
5645
5630
|
[attachmentsEnabled, maxFileSize, isFileTypeAllowed, processAttachmentProp]
|
|
5646
5631
|
);
|
|
5647
|
-
const handleInputChange =
|
|
5632
|
+
const handleInputChange = React17.useCallback(
|
|
5648
5633
|
(e) => {
|
|
5649
5634
|
handleFileSelect(e.target.files);
|
|
5650
5635
|
if (fileInputRef.current) {
|
|
@@ -5653,7 +5638,7 @@ function ChatComponent({
|
|
|
5653
5638
|
},
|
|
5654
5639
|
[handleFileSelect]
|
|
5655
5640
|
);
|
|
5656
|
-
const removePendingAttachment =
|
|
5641
|
+
const removePendingAttachment = React17.useCallback((id) => {
|
|
5657
5642
|
setPendingAttachments((prev) => {
|
|
5658
5643
|
const att = prev.find((a) => a.id === id);
|
|
5659
5644
|
if (att) {
|
|
@@ -5662,7 +5647,7 @@ function ChatComponent({
|
|
|
5662
5647
|
return prev.filter((a) => a.id !== id);
|
|
5663
5648
|
});
|
|
5664
5649
|
}, []);
|
|
5665
|
-
const handleDragOver =
|
|
5650
|
+
const handleDragOver = React17.useCallback(
|
|
5666
5651
|
(e) => {
|
|
5667
5652
|
e.preventDefault();
|
|
5668
5653
|
e.stopPropagation();
|
|
@@ -5672,12 +5657,12 @@ function ChatComponent({
|
|
|
5672
5657
|
},
|
|
5673
5658
|
[attachmentsEnabled]
|
|
5674
5659
|
);
|
|
5675
|
-
const handleDragLeave =
|
|
5660
|
+
const handleDragLeave = React17.useCallback((e) => {
|
|
5676
5661
|
e.preventDefault();
|
|
5677
5662
|
e.stopPropagation();
|
|
5678
5663
|
setIsDragging(false);
|
|
5679
5664
|
}, []);
|
|
5680
|
-
const handleDrop =
|
|
5665
|
+
const handleDrop = React17.useCallback(
|
|
5681
5666
|
(e) => {
|
|
5682
5667
|
e.preventDefault();
|
|
5683
5668
|
e.stopPropagation();
|
|
@@ -5688,7 +5673,7 @@ function ChatComponent({
|
|
|
5688
5673
|
},
|
|
5689
5674
|
[attachmentsEnabled, handleFileSelect]
|
|
5690
5675
|
);
|
|
5691
|
-
const handleSubmit =
|
|
5676
|
+
const handleSubmit = React17.useCallback(() => {
|
|
5692
5677
|
const hasContent = input.trim();
|
|
5693
5678
|
const hasAttachments = pendingAttachments.some(
|
|
5694
5679
|
(att) => att.status === "ready"
|
|
@@ -5700,7 +5685,7 @@ function ChatComponent({
|
|
|
5700
5685
|
setPendingAttachments([]);
|
|
5701
5686
|
setInput("");
|
|
5702
5687
|
}, [input, isLoading, onSendMessage, pendingAttachments]);
|
|
5703
|
-
const handleSuggestionClick =
|
|
5688
|
+
const handleSuggestionClick = React17.useCallback(
|
|
5704
5689
|
(suggestion) => {
|
|
5705
5690
|
if (onSuggestionClick) {
|
|
5706
5691
|
onSuggestionClick(suggestion);
|
|
@@ -5727,13 +5712,13 @@ function ChatComponent({
|
|
|
5727
5712
|
const chatViewNeedsDefault = chatViewElement && (!chatViewElement.props.children || chatViewHasOnlyLayoutChildren(chatViewElement));
|
|
5728
5713
|
const showDefaultWelcome = view === "home" && !hasCustomHome && welcome !== false;
|
|
5729
5714
|
const welcomeConfig = typeof welcome === "object" ? welcome : void 0;
|
|
5730
|
-
const send =
|
|
5715
|
+
const send = React17.useCallback(
|
|
5731
5716
|
(message, attachments) => {
|
|
5732
5717
|
onSendMessage?.(message, attachments);
|
|
5733
5718
|
},
|
|
5734
5719
|
[onSendMessage]
|
|
5735
5720
|
);
|
|
5736
|
-
const contextValue =
|
|
5721
|
+
const contextValue = React17__namespace.default.useMemo(
|
|
5737
5722
|
() => ({
|
|
5738
5723
|
view,
|
|
5739
5724
|
send,
|
|
@@ -5825,84 +5810,87 @@ function ChatComponent({
|
|
|
5825
5810
|
className: cn("gap-4 p-4", classNames.messageList),
|
|
5826
5811
|
children: [
|
|
5827
5812
|
messages.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-8 text-center text-muted-foreground", children: welcomeMessage || "Send a message to start the conversation" }),
|
|
5828
|
-
|
|
5829
|
-
const
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5813
|
+
(() => {
|
|
5814
|
+
const messageElements = messages.map((message, index) => {
|
|
5815
|
+
const isLastMessage = index === messages.length - 1;
|
|
5816
|
+
const GROUP_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
5817
|
+
const shouldHideAvatar = (() => {
|
|
5818
|
+
if (!groupConsecutiveMessages || index === 0)
|
|
5819
|
+
return false;
|
|
5820
|
+
let prevIdx = index - 1;
|
|
5821
|
+
while (prevIdx >= 0) {
|
|
5822
|
+
const prev = messages[prevIdx];
|
|
5823
|
+
const isToolMsg = prev.role === "tool";
|
|
5824
|
+
const isInvisibleSystem = prev.role === "system" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5825
|
+
prev.metadata?.type !== "compaction-marker";
|
|
5826
|
+
if (!isToolMsg && !isInvisibleSystem) break;
|
|
5827
|
+
prevIdx--;
|
|
5828
|
+
}
|
|
5829
|
+
if (prevIdx < 0) return false;
|
|
5830
|
+
const prevVisible = messages[prevIdx];
|
|
5831
|
+
if (prevVisible.role !== message.role) return false;
|
|
5832
|
+
const curTs = message.timestamp;
|
|
5833
|
+
const prevTs = prevVisible.timestamp;
|
|
5834
|
+
if (curTs && prevTs && curTs - prevTs > GROUP_THRESHOLD_MS)
|
|
5835
|
+
return false;
|
|
5836
|
+
return true;
|
|
5837
|
+
})();
|
|
5838
|
+
const isEmptyAssistant = message.role === "assistant" && !message.content?.trim();
|
|
5839
|
+
const hasToolCalls = message.tool_calls && message.tool_calls.length > 0;
|
|
5840
|
+
const hasToolExecutions = message.toolExecutions && message.toolExecutions.length > 0;
|
|
5841
|
+
const hasPendingApprovals = message.toolExecutions?.some(
|
|
5842
|
+
(exec) => exec.approvalStatus === "required"
|
|
5843
|
+
);
|
|
5844
|
+
if (isEmptyAssistant) {
|
|
5845
|
+
const shouldShowMessage = hasToolCalls || hasToolExecutions || hasPendingApprovals || isLastMessage && (isLoading || isProcessing);
|
|
5846
|
+
if (!shouldShowMessage) {
|
|
5847
|
+
return null;
|
|
5848
|
+
}
|
|
5862
5849
|
}
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
}
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
);
|
|
5905
|
-
|
|
5850
|
+
const savedExecutions = message.metadata?.toolExecutions;
|
|
5851
|
+
const messageToolExecutions = message.toolExecutions || savedExecutions;
|
|
5852
|
+
const messageWithExecutions = messageToolExecutions ? { ...message, toolExecutions: messageToolExecutions } : message;
|
|
5853
|
+
const handleFollowUpClick = (question) => {
|
|
5854
|
+
if (onSuggestionClick) {
|
|
5855
|
+
onSuggestionClick(question);
|
|
5856
|
+
} else {
|
|
5857
|
+
onSendMessage?.(question);
|
|
5858
|
+
}
|
|
5859
|
+
};
|
|
5860
|
+
return renderMessage ? /* @__PURE__ */ jsxRuntime.jsx(React17__namespace.default.Fragment, { children: renderMessage(messageWithExecutions, index) }, message.id) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5861
|
+
DefaultMessage,
|
|
5862
|
+
{
|
|
5863
|
+
message: messageWithExecutions,
|
|
5864
|
+
userAvatar: shouldHideAvatar && message.role === "user" ? { ...userAvatar, className: "invisible" } : userAvatar,
|
|
5865
|
+
assistantAvatar: shouldHideAvatar && message.role === "assistant" ? { ...assistantAvatar, className: "invisible" } : assistantAvatar,
|
|
5866
|
+
showUserAvatar,
|
|
5867
|
+
userMessageClassName: classNames.userMessage,
|
|
5868
|
+
assistantMessageClassName: classNames.assistantMessage,
|
|
5869
|
+
size: fontSize,
|
|
5870
|
+
isLastMessage,
|
|
5871
|
+
isLoading,
|
|
5872
|
+
isProcessing,
|
|
5873
|
+
loaderVariant,
|
|
5874
|
+
registeredTools,
|
|
5875
|
+
toolRenderers,
|
|
5876
|
+
mcpToolRenderer,
|
|
5877
|
+
fallbackToolRenderer,
|
|
5878
|
+
onApproveToolExecution,
|
|
5879
|
+
onRejectToolExecution,
|
|
5880
|
+
showFollowUps,
|
|
5881
|
+
onFollowUpClick: handleFollowUpClick,
|
|
5882
|
+
followUpClassName,
|
|
5883
|
+
followUpButtonClassName,
|
|
5884
|
+
citations: citations === false ? { enabled: false } : citations,
|
|
5885
|
+
branchInfo: message.role === "user" ? getBranchInfo?.(message.id) ?? null : null,
|
|
5886
|
+
onSwitchBranch,
|
|
5887
|
+
onEditMessage
|
|
5888
|
+
},
|
|
5889
|
+
message.id
|
|
5890
|
+
);
|
|
5891
|
+
});
|
|
5892
|
+
return messageView?.children ? messageView.children({ messages, messageElements }) : messageElements;
|
|
5893
|
+
})(),
|
|
5906
5894
|
isLoading && !isProcessing && messages.length > 0 && messages[messages.length - 1]?.role === "user" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5907
5895
|
DefaultMessage,
|
|
5908
5896
|
{
|
|
@@ -6221,7 +6209,7 @@ function useInternalThreadManager(config = {}) {
|
|
|
6221
6209
|
saveDebounce,
|
|
6222
6210
|
autoRestoreLastThread
|
|
6223
6211
|
};
|
|
6224
|
-
const threadManager =
|
|
6212
|
+
const threadManager = chunkTCPAT3WG_cjs.useThreadManager(threadManagerConfig);
|
|
6225
6213
|
const {
|
|
6226
6214
|
currentThread,
|
|
6227
6215
|
currentThreadId,
|
|
@@ -6231,18 +6219,18 @@ function useInternalThreadManager(config = {}) {
|
|
|
6231
6219
|
clearCurrentThread,
|
|
6232
6220
|
refreshThreads
|
|
6233
6221
|
} = threadManager;
|
|
6234
|
-
const { messages, setMessages, status, isLoading, getAllMessages } =
|
|
6235
|
-
const isLoadingMessagesRef =
|
|
6236
|
-
const savingToThreadRef =
|
|
6237
|
-
const lastSavedSnapshotRef =
|
|
6238
|
-
const hasInitializedRef =
|
|
6239
|
-
const getMessageSnapshot =
|
|
6222
|
+
const { messages, setMessages, status, isLoading, getAllMessages } = chunkTCPAT3WG_cjs.useCopilot();
|
|
6223
|
+
const isLoadingMessagesRef = React17.useRef(false);
|
|
6224
|
+
const savingToThreadRef = React17.useRef(null);
|
|
6225
|
+
const lastSavedSnapshotRef = React17.useRef("");
|
|
6226
|
+
const hasInitializedRef = React17.useRef(false);
|
|
6227
|
+
const getMessageSnapshot = React17.useCallback((msgs) => {
|
|
6240
6228
|
return msgs.map((m) => {
|
|
6241
6229
|
const contentPreview = (m.content ?? "").slice(0, 20);
|
|
6242
6230
|
return `${m.id}:${contentPreview}:${m.content?.length ?? 0}`;
|
|
6243
6231
|
}).join("|");
|
|
6244
6232
|
}, []);
|
|
6245
|
-
const convertToCore =
|
|
6233
|
+
const convertToCore = React17.useCallback((msgs) => {
|
|
6246
6234
|
return msgs.map((m) => ({
|
|
6247
6235
|
id: m.id,
|
|
6248
6236
|
role: m.role,
|
|
@@ -6260,7 +6248,7 @@ function useInternalThreadManager(config = {}) {
|
|
|
6260
6248
|
}
|
|
6261
6249
|
}));
|
|
6262
6250
|
}, []);
|
|
6263
|
-
const handleSwitchThread =
|
|
6251
|
+
const handleSwitchThread = React17.useCallback(
|
|
6264
6252
|
async (threadId) => {
|
|
6265
6253
|
isLoadingMessagesRef.current = true;
|
|
6266
6254
|
const thread = await switchThread(threadId);
|
|
@@ -6291,7 +6279,7 @@ function useInternalThreadManager(config = {}) {
|
|
|
6291
6279
|
},
|
|
6292
6280
|
[switchThread, setMessages, getMessageSnapshot, onThreadChange]
|
|
6293
6281
|
);
|
|
6294
|
-
const handleNewThread =
|
|
6282
|
+
const handleNewThread = React17.useCallback(async () => {
|
|
6295
6283
|
isLoadingMessagesRef.current = true;
|
|
6296
6284
|
clearCurrentThread();
|
|
6297
6285
|
lastSavedSnapshotRef.current = "";
|
|
@@ -6302,7 +6290,7 @@ function useInternalThreadManager(config = {}) {
|
|
|
6302
6290
|
isLoadingMessagesRef.current = false;
|
|
6303
6291
|
});
|
|
6304
6292
|
}, [clearCurrentThread, setMessages, onThreadChange]);
|
|
6305
|
-
|
|
6293
|
+
React17.useEffect(() => {
|
|
6306
6294
|
if (hasInitializedRef.current || !currentThread) {
|
|
6307
6295
|
return;
|
|
6308
6296
|
}
|
|
@@ -6335,7 +6323,7 @@ function useInternalThreadManager(config = {}) {
|
|
|
6335
6323
|
isLoadingMessagesRef.current = false;
|
|
6336
6324
|
});
|
|
6337
6325
|
}, [adapter, currentThread, setMessages, getMessageSnapshot, onThreadChange]);
|
|
6338
|
-
|
|
6326
|
+
React17.useEffect(() => {
|
|
6339
6327
|
if (isLoadingMessagesRef.current) {
|
|
6340
6328
|
return;
|
|
6341
6329
|
}
|
|
@@ -6408,7 +6396,7 @@ function parsePersistenceConfig(persistence, onThreadChange) {
|
|
|
6408
6396
|
};
|
|
6409
6397
|
case "server":
|
|
6410
6398
|
return {
|
|
6411
|
-
adapter:
|
|
6399
|
+
adapter: chunkWIXFZUEZ_cjs.createServerAdapter({
|
|
6412
6400
|
endpoint: persistence.endpoint,
|
|
6413
6401
|
headers: persistence.headers
|
|
6414
6402
|
}),
|
|
@@ -6461,7 +6449,7 @@ function CopilotChatBase(props) {
|
|
|
6461
6449
|
switchBranch,
|
|
6462
6450
|
getBranchInfo,
|
|
6463
6451
|
editMessage
|
|
6464
|
-
} =
|
|
6452
|
+
} = chunkTCPAT3WG_cjs.useCopilot();
|
|
6465
6453
|
const toolExecutions = rawToolExecutions.map(
|
|
6466
6454
|
(exec) => ({
|
|
6467
6455
|
id: exec.id,
|
|
@@ -6472,6 +6460,8 @@ function CopilotChatBase(props) {
|
|
|
6472
6460
|
error: exec.error,
|
|
6473
6461
|
timestamp: exec.startedAt ? exec.startedAt.getTime() : Date.now(),
|
|
6474
6462
|
approvalStatus: exec.approvalStatus,
|
|
6463
|
+
approvalTitle: exec.approvalTitle,
|
|
6464
|
+
approvalMessage: exec.approvalMessage,
|
|
6475
6465
|
hidden: exec.hidden
|
|
6476
6466
|
})
|
|
6477
6467
|
);
|
|
@@ -6613,7 +6603,7 @@ function CopilotChatBase(props) {
|
|
|
6613
6603
|
footer: classNames.footer
|
|
6614
6604
|
} : void 0;
|
|
6615
6605
|
const { threadManager, handleSwitchThread, handleNewThread, isBusy } = threadManagerResult;
|
|
6616
|
-
const handleDeleteThread =
|
|
6606
|
+
const handleDeleteThread = React17__namespace.default.useCallback(
|
|
6617
6607
|
(threadId) => {
|
|
6618
6608
|
const isCurrentThread = threadManager.currentThreadId === threadId;
|
|
6619
6609
|
threadManager.deleteThread(threadId);
|