@yourgpt/copilot-sdk 2.1.5-alpha.0 → 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-6BMQZIS3.js → chunk-PT2TOHG5.js} +23 -8
- 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-76RE7AJE.cjs → chunk-TCPAT3WG.cjs} +51 -36
- 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 +434 -449
- 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 +381 -396
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6BMQZIS3.js.map +0 -1
- package/dist/chunk-76RE7AJE.cjs.map +0 -1
package/dist/ui/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useCopilot, useThreadManager } from '../chunk-
|
|
2
|
-
import { createServerAdapter } from '../chunk-
|
|
1
|
+
import { useCopilot, useThreadManager } from '../chunk-PT2TOHG5.js';
|
|
2
|
+
import { createServerAdapter } from '../chunk-WZ2TOZ7M.js';
|
|
3
3
|
import { DEFAULT_MCP_UI_SANDBOX, parseMCPUIMessage } from '../chunk-G4SF2PNQ.js';
|
|
4
4
|
import '../chunk-EWVQWTNV.js';
|
|
5
5
|
import '../chunk-VNLLW3ZI.js';
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-RKGRQRZU.js';
|
|
7
|
+
import '../chunk-3AONOZLY.js';
|
|
8
8
|
import '../chunk-LLM7AHMO.js';
|
|
9
9
|
import '../chunk-RQ74USYU.js';
|
|
10
10
|
import '../chunk-7W7QLZNC.js';
|
|
@@ -18,8 +18,8 @@ import '../chunk-DGUM43GV.js';
|
|
|
18
18
|
import { clsx } from 'clsx';
|
|
19
19
|
import { twMerge } from 'tailwind-merge';
|
|
20
20
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
|
-
import * as
|
|
22
|
-
import
|
|
21
|
+
import * as React17 from 'react';
|
|
22
|
+
import React17__default, { memo, createContext, useState, useRef, useId, useCallback, useLayoutEffect, useContext, useEffect } from 'react';
|
|
23
23
|
import { Streamdown } from 'streamdown';
|
|
24
24
|
import { code } from '@streamdown/code';
|
|
25
25
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -384,7 +384,7 @@ var buttonVariants = cva(
|
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
);
|
|
387
|
-
var Button =
|
|
387
|
+
var Button = React17.forwardRef(
|
|
388
388
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
389
389
|
const Comp = asChild ? Slot : "button";
|
|
390
390
|
return /* @__PURE__ */ jsx(
|
|
@@ -625,7 +625,7 @@ function TooltipTrigger({
|
|
|
625
625
|
disabled,
|
|
626
626
|
...props
|
|
627
627
|
}) {
|
|
628
|
-
if (asChild &&
|
|
628
|
+
if (asChild && React17__default.isValidElement(children)) {
|
|
629
629
|
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, { disabled, render: children, ...props });
|
|
630
630
|
}
|
|
631
631
|
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, { disabled, ...props, children });
|
|
@@ -654,7 +654,7 @@ function TooltipContent({
|
|
|
654
654
|
}
|
|
655
655
|
) }) });
|
|
656
656
|
}
|
|
657
|
-
var Avatar =
|
|
657
|
+
var Avatar = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
658
658
|
AvatarPrimitive.Root,
|
|
659
659
|
{
|
|
660
660
|
ref,
|
|
@@ -666,7 +666,7 @@ var Avatar = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
666
666
|
}
|
|
667
667
|
));
|
|
668
668
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
669
|
-
var AvatarImage =
|
|
669
|
+
var AvatarImage = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
670
670
|
AvatarPrimitive.Image,
|
|
671
671
|
{
|
|
672
672
|
ref,
|
|
@@ -675,7 +675,7 @@ var AvatarImage = React18.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
675
675
|
}
|
|
676
676
|
));
|
|
677
677
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
678
|
-
var AvatarFallback =
|
|
678
|
+
var AvatarFallback = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
679
679
|
AvatarPrimitive.Fallback,
|
|
680
680
|
{
|
|
681
681
|
ref,
|
|
@@ -735,7 +735,7 @@ var MessageContent = ({
|
|
|
735
735
|
);
|
|
736
736
|
return markdown ? /* @__PURE__ */ jsx(Markdown, { className: classNames, ...props, children }) : /* @__PURE__ */ jsx("div", { className: classNames, ...props, children });
|
|
737
737
|
};
|
|
738
|
-
var Textarea =
|
|
738
|
+
var Textarea = React17.forwardRef(({ className, ...props }, ref) => {
|
|
739
739
|
return /* @__PURE__ */ jsx(
|
|
740
740
|
"textarea",
|
|
741
741
|
{
|
|
@@ -899,7 +899,7 @@ function PromptInputAction({
|
|
|
899
899
|
}
|
|
900
900
|
var HoverCard = HoverCardPrimitive.Root;
|
|
901
901
|
var HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
902
|
-
var HoverCardContent =
|
|
902
|
+
var HoverCardContent = React17.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
903
903
|
HoverCardPrimitive.Content,
|
|
904
904
|
{
|
|
905
905
|
ref,
|
|
@@ -1442,7 +1442,7 @@ function SourcesCollapsible({
|
|
|
1442
1442
|
defaultExpanded = false,
|
|
1443
1443
|
className
|
|
1444
1444
|
}) {
|
|
1445
|
-
const [expanded, setExpanded] =
|
|
1445
|
+
const [expanded, setExpanded] = React17.useState(defaultExpanded);
|
|
1446
1446
|
if (citations.length === 0) return null;
|
|
1447
1447
|
return /* @__PURE__ */ jsxs("div", { className: cn("border rounded-lg", className), children: [
|
|
1448
1448
|
/* @__PURE__ */ jsxs(
|
|
@@ -1508,7 +1508,7 @@ function SourcesList({
|
|
|
1508
1508
|
if (compact) {
|
|
1509
1509
|
return /* @__PURE__ */ jsxs("div", { className: cn("text-xs text-muted-foreground", className), children: [
|
|
1510
1510
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Sources: " }),
|
|
1511
|
-
citations.map((c, i) => /* @__PURE__ */ jsxs(
|
|
1511
|
+
citations.map((c, i) => /* @__PURE__ */ jsxs(React17.Fragment, { children: [
|
|
1512
1512
|
/* @__PURE__ */ jsxs(
|
|
1513
1513
|
"a",
|
|
1514
1514
|
{
|
|
@@ -1586,11 +1586,11 @@ function resultsToCitations(results) {
|
|
|
1586
1586
|
domain: result.domain || getDomain3(result.url)
|
|
1587
1587
|
}));
|
|
1588
1588
|
}
|
|
1589
|
-
var ReasoningContext =
|
|
1589
|
+
var ReasoningContext = React17.createContext(
|
|
1590
1590
|
null
|
|
1591
1591
|
);
|
|
1592
1592
|
function useReasoningContext() {
|
|
1593
|
-
const context =
|
|
1593
|
+
const context = React17.useContext(ReasoningContext);
|
|
1594
1594
|
if (!context) {
|
|
1595
1595
|
throw new Error(
|
|
1596
1596
|
"Reasoning components must be used within a Reasoning provider"
|
|
@@ -1606,11 +1606,11 @@ function Reasoning({
|
|
|
1606
1606
|
defaultOpen = false,
|
|
1607
1607
|
className
|
|
1608
1608
|
}) {
|
|
1609
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
1610
|
-
const prevStreamingRef =
|
|
1609
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React17.useState(defaultOpen);
|
|
1610
|
+
const prevStreamingRef = React17.useRef(isStreaming);
|
|
1611
1611
|
const isControlled = controlledOpen !== void 0;
|
|
1612
1612
|
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1613
|
-
const setIsOpen =
|
|
1613
|
+
const setIsOpen = React17.useCallback(
|
|
1614
1614
|
(open) => {
|
|
1615
1615
|
if (onOpenChange) {
|
|
1616
1616
|
onOpenChange(open);
|
|
@@ -1621,7 +1621,7 @@ function Reasoning({
|
|
|
1621
1621
|
},
|
|
1622
1622
|
[isControlled, onOpenChange]
|
|
1623
1623
|
);
|
|
1624
|
-
|
|
1624
|
+
React17.useEffect(() => {
|
|
1625
1625
|
if (isStreaming && !prevStreamingRef.current) {
|
|
1626
1626
|
setIsOpen(true);
|
|
1627
1627
|
} else if (!isStreaming && prevStreamingRef.current) {
|
|
@@ -1677,9 +1677,9 @@ function ReasoningContent({
|
|
|
1677
1677
|
className
|
|
1678
1678
|
}) {
|
|
1679
1679
|
const { isOpen } = useReasoningContext();
|
|
1680
|
-
const contentRef =
|
|
1681
|
-
const [height, setHeight] =
|
|
1682
|
-
|
|
1680
|
+
const contentRef = React17.useRef(null);
|
|
1681
|
+
const [height, setHeight] = React17.useState(0);
|
|
1682
|
+
React17.useEffect(() => {
|
|
1683
1683
|
if (contentRef.current) {
|
|
1684
1684
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
1685
1685
|
for (const entry of entries) {
|
|
@@ -1728,11 +1728,11 @@ function SimpleReasoning({
|
|
|
1728
1728
|
/* @__PURE__ */ jsx(ReasoningContent, { markdown, children: content })
|
|
1729
1729
|
] });
|
|
1730
1730
|
}
|
|
1731
|
-
var CopilotUIContext =
|
|
1731
|
+
var CopilotUIContext = React17.createContext(
|
|
1732
1732
|
null
|
|
1733
1733
|
);
|
|
1734
1734
|
function useCopilotUI() {
|
|
1735
|
-
const context =
|
|
1735
|
+
const context = React17.useContext(CopilotUIContext);
|
|
1736
1736
|
if (!context) {
|
|
1737
1737
|
return {
|
|
1738
1738
|
debug: false,
|
|
@@ -1747,7 +1747,7 @@ function CopilotUIProvider({
|
|
|
1747
1747
|
debug = false,
|
|
1748
1748
|
defaultDebugExpanded = false
|
|
1749
1749
|
}) {
|
|
1750
|
-
const value =
|
|
1750
|
+
const value = React17.useMemo(
|
|
1751
1751
|
() => ({
|
|
1752
1752
|
debug,
|
|
1753
1753
|
defaultDebugExpanded,
|
|
@@ -1890,7 +1890,7 @@ function ToolStep({
|
|
|
1890
1890
|
}) {
|
|
1891
1891
|
const { isDebug, defaultDebugExpanded } = useCopilotUI();
|
|
1892
1892
|
const debug = debugProp ?? isDebug;
|
|
1893
|
-
const [expanded, setExpanded] =
|
|
1893
|
+
const [expanded, setExpanded] = React17.useState(
|
|
1894
1894
|
defaultExpanded ?? defaultDebugExpanded ?? false
|
|
1895
1895
|
);
|
|
1896
1896
|
const displayTitle = getDisplayTitle(step);
|
|
@@ -2371,9 +2371,9 @@ function ArrowUpRightIcon({ className }) {
|
|
|
2371
2371
|
}
|
|
2372
2372
|
);
|
|
2373
2373
|
}
|
|
2374
|
-
var ConfirmationContext =
|
|
2374
|
+
var ConfirmationContext = React17.createContext(null);
|
|
2375
2375
|
function useConfirmationContext() {
|
|
2376
|
-
const context =
|
|
2376
|
+
const context = React17.useContext(ConfirmationContext);
|
|
2377
2377
|
if (!context) {
|
|
2378
2378
|
throw new Error(
|
|
2379
2379
|
"Confirmation components must be used within a Confirmation provider"
|
|
@@ -2541,30 +2541,27 @@ function PermissionConfirmation({
|
|
|
2541
2541
|
message,
|
|
2542
2542
|
onApprove,
|
|
2543
2543
|
onReject,
|
|
2544
|
-
showPermissionOptions = true,
|
|
2545
|
-
permissionOptions = DEFAULT_PERMISSION_OPTIONS,
|
|
2546
2544
|
className
|
|
2547
2545
|
}) {
|
|
2548
|
-
const [selectedPermission, setSelectedPermission] = React18.useState("ask");
|
|
2549
|
-
const [showOptions, setShowOptions] = React18.useState(false);
|
|
2550
2546
|
const handleApprove = () => {
|
|
2551
|
-
onApprove?.(
|
|
2547
|
+
onApprove?.("ask");
|
|
2552
2548
|
};
|
|
2553
2549
|
const handleReject = () => {
|
|
2554
|
-
onReject?.(
|
|
2555
|
-
selectedPermission === "deny_always" ? "deny_always" : void 0
|
|
2556
|
-
);
|
|
2550
|
+
onReject?.(void 0);
|
|
2557
2551
|
};
|
|
2558
2552
|
if (state === "approved") {
|
|
2559
2553
|
return /* @__PURE__ */ jsxs(
|
|
2560
2554
|
"div",
|
|
2561
2555
|
{
|
|
2562
2556
|
className: cn(
|
|
2563
|
-
"
|
|
2557
|
+
"csdk-confirm-result",
|
|
2558
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2559
|
+
"rounded-2xl border border-green-200/70 dark:border-green-900/40",
|
|
2560
|
+
"bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-400",
|
|
2564
2561
|
className
|
|
2565
2562
|
),
|
|
2566
2563
|
children: [
|
|
2567
|
-
/* @__PURE__ */ jsx(CheckIcon, { className: "h-
|
|
2564
|
+
/* @__PURE__ */ jsx(CheckIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2568
2565
|
/* @__PURE__ */ jsx("span", { children: "Approved" })
|
|
2569
2566
|
]
|
|
2570
2567
|
}
|
|
@@ -2575,11 +2572,14 @@ function PermissionConfirmation({
|
|
|
2575
2572
|
"div",
|
|
2576
2573
|
{
|
|
2577
2574
|
className: cn(
|
|
2578
|
-
"
|
|
2575
|
+
"csdk-confirm-result",
|
|
2576
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2577
|
+
"rounded-2xl border border-red-200/70 dark:border-red-900/40",
|
|
2578
|
+
"bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-400",
|
|
2579
2579
|
className
|
|
2580
2580
|
),
|
|
2581
2581
|
children: [
|
|
2582
|
-
/* @__PURE__ */ jsx(XIcon2, { className: "h-
|
|
2582
|
+
/* @__PURE__ */ jsx(XIcon2, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2583
2583
|
/* @__PURE__ */ jsx("span", { children: "Rejected" })
|
|
2584
2584
|
]
|
|
2585
2585
|
}
|
|
@@ -2589,81 +2589,47 @@ function PermissionConfirmation({
|
|
|
2589
2589
|
"div",
|
|
2590
2590
|
{
|
|
2591
2591
|
className: cn(
|
|
2592
|
-
"
|
|
2592
|
+
"csdk-confirm-card",
|
|
2593
|
+
"w-full rounded-2xl border border-border/60 bg-card text-card-foreground shadow-sm overflow-hidden",
|
|
2593
2594
|
className
|
|
2594
2595
|
),
|
|
2595
2596
|
children: [
|
|
2596
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3
|
|
2597
|
-
/* @__PURE__ */ jsx(
|
|
2598
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2599
|
-
toolName && /* @__PURE__ */ jsx("p", { className: "text-
|
|
2600
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-
|
|
2597
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-4", children: [
|
|
2598
|
+
/* @__PURE__ */ 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__ */ jsx(AlertTriangleIcon, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }) }),
|
|
2599
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 pt-0.5", children: [
|
|
2600
|
+
toolName && /* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold uppercase tracking-widest text-muted-foreground mb-1", children: toolName }),
|
|
2601
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-foreground leading-snug", children: message || "This tool requires your approval to execute." })
|
|
2601
2602
|
] })
|
|
2602
2603
|
] }),
|
|
2603
|
-
|
|
2604
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 pb-4", children: [
|
|
2605
|
+
/* @__PURE__ */ jsx(
|
|
2605
2606
|
"button",
|
|
2606
2607
|
{
|
|
2607
2608
|
type: "button",
|
|
2608
|
-
onClick:
|
|
2609
|
-
className:
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
"h-4 w-4 transition-transform",
|
|
2617
|
-
showOptions && "rotate-180"
|
|
2618
|
-
),
|
|
2619
|
-
fill: "none",
|
|
2620
|
-
viewBox: "0 0 24 24",
|
|
2621
|
-
stroke: "currentColor",
|
|
2622
|
-
strokeWidth: 2,
|
|
2623
|
-
children: /* @__PURE__ */ jsx(
|
|
2624
|
-
"path",
|
|
2625
|
-
{
|
|
2626
|
-
strokeLinecap: "round",
|
|
2627
|
-
strokeLinejoin: "round",
|
|
2628
|
-
d: "M19 9l-7 7-7-7"
|
|
2629
|
-
}
|
|
2630
|
-
)
|
|
2631
|
-
}
|
|
2632
|
-
)
|
|
2633
|
-
]
|
|
2609
|
+
onClick: handleReject,
|
|
2610
|
+
className: cn(
|
|
2611
|
+
"csdk-confirm-btn",
|
|
2612
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2613
|
+
"border border-border bg-transparent text-muted-foreground",
|
|
2614
|
+
"hover:bg-muted/60 hover:text-foreground"
|
|
2615
|
+
),
|
|
2616
|
+
children: "Deny"
|
|
2634
2617
|
}
|
|
2635
2618
|
),
|
|
2636
|
-
|
|
2637
|
-
"
|
|
2619
|
+
/* @__PURE__ */ jsx(
|
|
2620
|
+
"button",
|
|
2638
2621
|
{
|
|
2622
|
+
type: "button",
|
|
2623
|
+
onClick: handleApprove,
|
|
2639
2624
|
className: cn(
|
|
2640
|
-
"
|
|
2641
|
-
|
|
2625
|
+
"csdk-confirm-btn",
|
|
2626
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2627
|
+
"bg-primary text-primary-foreground",
|
|
2628
|
+
"hover:opacity-90"
|
|
2642
2629
|
),
|
|
2643
|
-
children:
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
{
|
|
2647
|
-
type: "radio",
|
|
2648
|
-
name: "permission",
|
|
2649
|
-
value: option.value,
|
|
2650
|
-
checked: selectedPermission === option.value,
|
|
2651
|
-
onChange: () => setSelectedPermission(option.value),
|
|
2652
|
-
className: "mt-0.5"
|
|
2653
|
-
}
|
|
2654
|
-
),
|
|
2655
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2656
|
-
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: option.label }),
|
|
2657
|
-
option.description && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: option.description })
|
|
2658
|
-
] })
|
|
2659
|
-
]
|
|
2660
|
-
},
|
|
2661
|
-
option.value
|
|
2662
|
-
)) })
|
|
2663
|
-
] }),
|
|
2664
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
2665
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: handleReject, children: "Deny" }),
|
|
2666
|
-
/* @__PURE__ */ jsx(Button, { variant: "default", size: "sm", onClick: handleApprove, children: "Allow" })
|
|
2630
|
+
children: "Allow"
|
|
2631
|
+
}
|
|
2632
|
+
)
|
|
2667
2633
|
] })
|
|
2668
2634
|
]
|
|
2669
2635
|
}
|
|
@@ -2676,23 +2642,25 @@ function CompactPermissionConfirmation({
|
|
|
2676
2642
|
onReject,
|
|
2677
2643
|
className
|
|
2678
2644
|
}) {
|
|
2679
|
-
const [rememberChoice, setRememberChoice] = React18.useState(false);
|
|
2680
2645
|
const handleApprove = () => {
|
|
2681
|
-
onApprove?.(
|
|
2646
|
+
onApprove?.("ask");
|
|
2682
2647
|
};
|
|
2683
2648
|
const handleReject = () => {
|
|
2684
|
-
onReject?.(
|
|
2649
|
+
onReject?.(void 0);
|
|
2685
2650
|
};
|
|
2686
2651
|
if (state === "approved") {
|
|
2687
2652
|
return /* @__PURE__ */ jsxs(
|
|
2688
2653
|
"div",
|
|
2689
2654
|
{
|
|
2690
2655
|
className: cn(
|
|
2691
|
-
"
|
|
2656
|
+
"csdk-confirm-result",
|
|
2657
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2658
|
+
"rounded-2xl border border-green-200/70 dark:border-green-900/40",
|
|
2659
|
+
"bg-green-50 dark:bg-green-950/20 text-green-700 dark:text-green-400",
|
|
2692
2660
|
className
|
|
2693
2661
|
),
|
|
2694
2662
|
children: [
|
|
2695
|
-
/* @__PURE__ */ jsx(CheckIcon, { className: "h-
|
|
2663
|
+
/* @__PURE__ */ jsx(CheckIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2696
2664
|
/* @__PURE__ */ jsx("span", { children: "Approved" })
|
|
2697
2665
|
]
|
|
2698
2666
|
}
|
|
@@ -2703,11 +2671,14 @@ function CompactPermissionConfirmation({
|
|
|
2703
2671
|
"div",
|
|
2704
2672
|
{
|
|
2705
2673
|
className: cn(
|
|
2706
|
-
"
|
|
2674
|
+
"csdk-confirm-result",
|
|
2675
|
+
"inline-flex items-center gap-2 px-3 py-1.5 text-sm",
|
|
2676
|
+
"rounded-2xl border border-red-200/70 dark:border-red-900/40",
|
|
2677
|
+
"bg-red-50 dark:bg-red-950/20 text-red-700 dark:text-red-400",
|
|
2707
2678
|
className
|
|
2708
2679
|
),
|
|
2709
2680
|
children: [
|
|
2710
|
-
/* @__PURE__ */ jsx(XIcon2, { className: "h-
|
|
2681
|
+
/* @__PURE__ */ jsx(XIcon2, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
2711
2682
|
/* @__PURE__ */ jsx("span", { children: "Rejected" })
|
|
2712
2683
|
]
|
|
2713
2684
|
}
|
|
@@ -2717,31 +2688,44 @@ function CompactPermissionConfirmation({
|
|
|
2717
2688
|
"div",
|
|
2718
2689
|
{
|
|
2719
2690
|
className: cn(
|
|
2720
|
-
"
|
|
2691
|
+
"csdk-confirm-card",
|
|
2692
|
+
"w-full rounded-2xl border border-border/60 bg-card text-card-foreground shadow-sm overflow-hidden",
|
|
2721
2693
|
className
|
|
2722
2694
|
),
|
|
2723
2695
|
children: [
|
|
2724
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3
|
|
2725
|
-
/* @__PURE__ */ jsx(
|
|
2726
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-foreground", children: message || "This action requires your approval." })
|
|
2696
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 p-4", children: [
|
|
2697
|
+
/* @__PURE__ */ 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__ */ jsx(AlertTriangleIcon, { className: "h-3.5 w-3.5 text-amber-600 dark:text-amber-400" }) }),
|
|
2698
|
+
/* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 pt-0.5 text-sm text-foreground leading-snug", children: message || "This action requires your approval." })
|
|
2727
2699
|
] }),
|
|
2728
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2700
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 pb-4", children: [
|
|
2701
|
+
/* @__PURE__ */ jsx(
|
|
2702
|
+
"button",
|
|
2703
|
+
{
|
|
2704
|
+
type: "button",
|
|
2705
|
+
onClick: handleReject,
|
|
2706
|
+
className: cn(
|
|
2707
|
+
"csdk-confirm-btn",
|
|
2708
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2709
|
+
"border border-border bg-transparent text-muted-foreground",
|
|
2710
|
+
"hover:bg-muted/60 hover:text-foreground"
|
|
2711
|
+
),
|
|
2712
|
+
children: "Deny"
|
|
2713
|
+
}
|
|
2714
|
+
),
|
|
2715
|
+
/* @__PURE__ */ jsx(
|
|
2716
|
+
"button",
|
|
2717
|
+
{
|
|
2718
|
+
type: "button",
|
|
2719
|
+
onClick: handleApprove,
|
|
2720
|
+
className: cn(
|
|
2721
|
+
"csdk-confirm-btn",
|
|
2722
|
+
"px-4 py-1.5 text-sm font-medium rounded-xl",
|
|
2723
|
+
"bg-primary text-primary-foreground",
|
|
2724
|
+
"hover:opacity-90"
|
|
2725
|
+
),
|
|
2726
|
+
children: "Allow"
|
|
2727
|
+
}
|
|
2728
|
+
)
|
|
2745
2729
|
] })
|
|
2746
2730
|
]
|
|
2747
2731
|
}
|
|
@@ -3299,9 +3283,9 @@ function ModelSelector({
|
|
|
3299
3283
|
showCapabilities = true,
|
|
3300
3284
|
className
|
|
3301
3285
|
}) {
|
|
3302
|
-
const [isOpen, setIsOpen] =
|
|
3303
|
-
const containerRef =
|
|
3304
|
-
|
|
3286
|
+
const [isOpen, setIsOpen] = React17.useState(false);
|
|
3287
|
+
const containerRef = React17.useRef(null);
|
|
3288
|
+
React17.useEffect(() => {
|
|
3305
3289
|
function handleClickOutside(event) {
|
|
3306
3290
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
3307
3291
|
setIsOpen(false);
|
|
@@ -3310,7 +3294,7 @@ function ModelSelector({
|
|
|
3310
3294
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3311
3295
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3312
3296
|
}, []);
|
|
3313
|
-
const selectedModel =
|
|
3297
|
+
const selectedModel = React17.useMemo(() => {
|
|
3314
3298
|
if (!value) return null;
|
|
3315
3299
|
if (providers) {
|
|
3316
3300
|
for (const provider of providers) {
|
|
@@ -3536,7 +3520,7 @@ function PopoverTrigger({
|
|
|
3536
3520
|
className,
|
|
3537
3521
|
...props
|
|
3538
3522
|
}) {
|
|
3539
|
-
if (asChild &&
|
|
3523
|
+
if (asChild && React17.isValidElement(children)) {
|
|
3540
3524
|
return /* @__PURE__ */ jsx(Popover$1.Trigger, { render: children, className, ...props });
|
|
3541
3525
|
}
|
|
3542
3526
|
return /* @__PURE__ */ jsx(Popover$1.Trigger, { className, ...props, children });
|
|
@@ -3671,8 +3655,8 @@ function ThreadPicker({
|
|
|
3671
3655
|
itemClassName,
|
|
3672
3656
|
newButtonClassName
|
|
3673
3657
|
}) {
|
|
3674
|
-
const [isOpen, setIsOpen] =
|
|
3675
|
-
const selectedThread =
|
|
3658
|
+
const [isOpen, setIsOpen] = React17.useState(false);
|
|
3659
|
+
const selectedThread = React17.useMemo(() => {
|
|
3676
3660
|
if (!value) return null;
|
|
3677
3661
|
return threads.find((t) => t.id === value) ?? null;
|
|
3678
3662
|
}, [value, threads]);
|
|
@@ -3878,7 +3862,7 @@ function ThreadCard({
|
|
|
3878
3862
|
showDelete = true,
|
|
3879
3863
|
className
|
|
3880
3864
|
}) {
|
|
3881
|
-
const [isHovered, setIsHovered] =
|
|
3865
|
+
const [isHovered, setIsHovered] = React17.useState(false);
|
|
3882
3866
|
const handleDelete = (e) => {
|
|
3883
3867
|
e.stopPropagation();
|
|
3884
3868
|
onDelete?.();
|
|
@@ -4119,10 +4103,10 @@ function MCPUIFrame({
|
|
|
4119
4103
|
showLoading = true,
|
|
4120
4104
|
testId
|
|
4121
4105
|
}) {
|
|
4122
|
-
const iframeRef =
|
|
4123
|
-
const [isLoading, setIsLoading] =
|
|
4124
|
-
const [error, setError] =
|
|
4125
|
-
|
|
4106
|
+
const iframeRef = React17.useRef(null);
|
|
4107
|
+
const [isLoading, setIsLoading] = React17.useState(true);
|
|
4108
|
+
const [error, setError] = React17.useState(null);
|
|
4109
|
+
React17.useEffect(() => {
|
|
4126
4110
|
const handleMessage = (event) => {
|
|
4127
4111
|
if (event.source !== iframeRef.current?.contentWindow) {
|
|
4128
4112
|
return;
|
|
@@ -4135,17 +4119,17 @@ function MCPUIFrame({
|
|
|
4135
4119
|
window.addEventListener("message", handleMessage);
|
|
4136
4120
|
return () => window.removeEventListener("message", handleMessage);
|
|
4137
4121
|
}, [onIntent]);
|
|
4138
|
-
const handleLoad =
|
|
4122
|
+
const handleLoad = React17.useCallback(() => {
|
|
4139
4123
|
setIsLoading(false);
|
|
4140
4124
|
onLoad?.();
|
|
4141
4125
|
}, [onLoad]);
|
|
4142
|
-
const handleError =
|
|
4126
|
+
const handleError = React17.useCallback(() => {
|
|
4143
4127
|
const err = new Error("Failed to load MCP UI content");
|
|
4144
4128
|
setError(err);
|
|
4145
4129
|
setIsLoading(false);
|
|
4146
4130
|
onError?.(err);
|
|
4147
4131
|
}, [onError]);
|
|
4148
|
-
const { srcDoc, src } =
|
|
4132
|
+
const { srcDoc, src } = React17.useMemo(() => {
|
|
4149
4133
|
if (resource.mimeType === "text/html") {
|
|
4150
4134
|
let content = resource.content || "";
|
|
4151
4135
|
if (resource.blob && !resource.content) {
|
|
@@ -4325,24 +4309,24 @@ function DefaultMessage({
|
|
|
4325
4309
|
const isUser = message.role === "user";
|
|
4326
4310
|
const isCompactionMarker = message.role === "system" && message.metadata?.type === "compaction-marker";
|
|
4327
4311
|
const isStreaming = isLastMessage && isLoading;
|
|
4328
|
-
const [isEditing, setIsEditing] =
|
|
4329
|
-
const [editValue, setEditValue] =
|
|
4330
|
-
const editRef =
|
|
4331
|
-
const startEdit =
|
|
4312
|
+
const [isEditing, setIsEditing] = React17.useState(false);
|
|
4313
|
+
const [editValue, setEditValue] = React17.useState(message.content ?? "");
|
|
4314
|
+
const editRef = React17.useRef(null);
|
|
4315
|
+
const startEdit = React17.useCallback(() => {
|
|
4332
4316
|
setEditValue(message.content ?? "");
|
|
4333
4317
|
setIsEditing(true);
|
|
4334
4318
|
requestAnimationFrame(() => editRef.current?.focus());
|
|
4335
4319
|
}, [message.content]);
|
|
4336
|
-
const cancelEdit =
|
|
4320
|
+
const cancelEdit = React17.useCallback(() => {
|
|
4337
4321
|
setIsEditing(false);
|
|
4338
4322
|
}, []);
|
|
4339
|
-
const submitEdit =
|
|
4323
|
+
const submitEdit = React17.useCallback(() => {
|
|
4340
4324
|
const trimmed = editValue.trim();
|
|
4341
4325
|
if (!trimmed || !onEditMessage) return;
|
|
4342
4326
|
onEditMessage(message.id, trimmed);
|
|
4343
4327
|
setIsEditing(false);
|
|
4344
4328
|
}, [editValue, message.id, onEditMessage]);
|
|
4345
|
-
const handleEditKeyDown =
|
|
4329
|
+
const handleEditKeyDown = React17.useCallback(
|
|
4346
4330
|
(e) => {
|
|
4347
4331
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
4348
4332
|
e.preventDefault();
|
|
@@ -4384,18 +4368,18 @@ function DefaultMessage({
|
|
|
4384
4368
|
/* @__PURE__ */ jsx("div", { className: "flex-1 h-px bg-border" })
|
|
4385
4369
|
] });
|
|
4386
4370
|
}
|
|
4387
|
-
const { cleanContent: contentWithoutFollowUps, followUps } =
|
|
4371
|
+
const { cleanContent: contentWithoutFollowUps, followUps } = React17.useMemo(() => {
|
|
4388
4372
|
if (isUser || !message.content) {
|
|
4389
4373
|
return { cleanContent: message.content, followUps: [] };
|
|
4390
4374
|
}
|
|
4391
4375
|
return parseFollowUps(message.content);
|
|
4392
4376
|
}, [message.content, isUser]);
|
|
4393
|
-
const cleanContent =
|
|
4377
|
+
const cleanContent = React17.useMemo(() => {
|
|
4394
4378
|
if (!contentWithoutFollowUps) return contentWithoutFollowUps;
|
|
4395
4379
|
return contentWithoutFollowUps.replace(/\n*\*{0,2}Sources:?\*{0,2}\s*(\[.+?\]\(.+?\)[,\s]*)+$/gi, "").trim();
|
|
4396
4380
|
}, [contentWithoutFollowUps]);
|
|
4397
4381
|
const shouldShowFollowUps = showFollowUps && !isUser && isLastMessage && !isLoading && followUps.length > 0 && onFollowUpClick;
|
|
4398
|
-
const sources =
|
|
4382
|
+
const sources = React17.useMemo(() => {
|
|
4399
4383
|
if (isUser || !citations.enabled) return [];
|
|
4400
4384
|
const extractedSources = [];
|
|
4401
4385
|
const addSource = (url, title, description) => {
|
|
@@ -4449,127 +4433,121 @@ function DefaultMessage({
|
|
|
4449
4433
|
const shouldShowSources = citations.enabled && sources.length > 0;
|
|
4450
4434
|
if (isUser) {
|
|
4451
4435
|
const hasAttachments = message.attachments && message.attachments.length > 0;
|
|
4452
|
-
return /* @__PURE__ */ jsxs(
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4436
|
+
return /* @__PURE__ */ jsxs(Message, { className: cn("flex gap-2 group/user-msg justify-end"), children: [
|
|
4437
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col items-end max-w-[80%] min-w-0", children: isEditing ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 w-full min-w-[200px]", children: [
|
|
4438
|
+
/* @__PURE__ */ jsx(
|
|
4439
|
+
"textarea",
|
|
4440
|
+
{
|
|
4441
|
+
ref: editRef,
|
|
4442
|
+
value: editValue,
|
|
4443
|
+
onChange: (e) => setEditValue(e.target.value),
|
|
4444
|
+
onKeyDown: handleEditKeyDown,
|
|
4445
|
+
rows: Math.max(2, (editValue.match(/\n/g) || []).length + 1),
|
|
4446
|
+
className: cn(
|
|
4447
|
+
"csdk-edit-textarea w-full rounded-lg px-3 py-2 text-sm resize-none",
|
|
4448
|
+
"bg-primary text-primary-foreground placeholder:text-primary-foreground/50",
|
|
4449
|
+
"focus:outline-none focus:ring-2 focus:ring-primary-foreground/30",
|
|
4450
|
+
userMessageClassName
|
|
4451
|
+
)
|
|
4452
|
+
}
|
|
4453
|
+
),
|
|
4454
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 justify-end", children: [
|
|
4455
|
+
/* @__PURE__ */ jsx(
|
|
4456
|
+
"button",
|
|
4457
|
+
{
|
|
4458
|
+
type: "button",
|
|
4459
|
+
onClick: cancelEdit,
|
|
4460
|
+
className: "csdk-edit-cancel px-3 py-1 text-xs rounded-md bg-muted text-muted-foreground hover:bg-muted/80 transition-colors",
|
|
4461
|
+
children: "Cancel"
|
|
4462
|
+
}
|
|
4463
|
+
),
|
|
4464
|
+
/* @__PURE__ */ jsx(
|
|
4465
|
+
"button",
|
|
4466
|
+
{
|
|
4467
|
+
type: "button",
|
|
4468
|
+
onClick: submitEdit,
|
|
4469
|
+
disabled: !editValue.trim(),
|
|
4470
|
+
className: "csdk-edit-submit px-3 py-1 text-xs rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors",
|
|
4471
|
+
children: "Send"
|
|
4472
|
+
}
|
|
4473
|
+
)
|
|
4474
|
+
] })
|
|
4475
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4476
|
+
message.content && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
4477
|
+
/* @__PURE__ */ jsx(
|
|
4478
|
+
MessageContent,
|
|
4479
|
+
{
|
|
4480
|
+
className: cn(
|
|
4481
|
+
"csdk-message-user rounded-lg px-4 py-2 bg-primary text-primary-foreground",
|
|
4482
|
+
userMessageClassName
|
|
4483
4483
|
),
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
"csdk-message-user rounded-lg px-4 py-2 bg-primary text-primary-foreground",
|
|
4502
|
-
userMessageClassName
|
|
4503
|
-
),
|
|
4504
|
-
markdown: true,
|
|
4505
|
-
size,
|
|
4506
|
-
children: message.content
|
|
4507
|
-
}
|
|
4484
|
+
markdown: true,
|
|
4485
|
+
size,
|
|
4486
|
+
children: message.content
|
|
4487
|
+
}
|
|
4488
|
+
),
|
|
4489
|
+
showEditBtn && /* @__PURE__ */ jsx(
|
|
4490
|
+
"button",
|
|
4491
|
+
{
|
|
4492
|
+
type: "button",
|
|
4493
|
+
onClick: startEdit,
|
|
4494
|
+
"aria-label": "Edit message",
|
|
4495
|
+
className: cn(
|
|
4496
|
+
"csdk-edit-btn absolute -left-7 top-1/2 -translate-y-1/2",
|
|
4497
|
+
"size-6 flex items-center justify-center rounded-full",
|
|
4498
|
+
"text-muted-foreground bg-background border border-border shadow-sm",
|
|
4499
|
+
"opacity-0 group-hover/user-msg:opacity-100 transition-opacity",
|
|
4500
|
+
"hover:text-foreground hover:bg-muted"
|
|
4508
4501
|
),
|
|
4509
|
-
|
|
4510
|
-
"
|
|
4502
|
+
children: /* @__PURE__ */ jsxs(
|
|
4503
|
+
"svg",
|
|
4511
4504
|
{
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
{
|
|
4525
|
-
width: "12",
|
|
4526
|
-
height: "12",
|
|
4527
|
-
viewBox: "0 0 24 24",
|
|
4528
|
-
fill: "none",
|
|
4529
|
-
stroke: "currentColor",
|
|
4530
|
-
strokeWidth: 2,
|
|
4531
|
-
strokeLinecap: "round",
|
|
4532
|
-
strokeLinejoin: "round",
|
|
4533
|
-
children: [
|
|
4534
|
-
/* @__PURE__ */ jsx("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
4535
|
-
/* @__PURE__ */ jsx("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
4536
|
-
]
|
|
4537
|
-
}
|
|
4538
|
-
)
|
|
4505
|
+
width: "12",
|
|
4506
|
+
height: "12",
|
|
4507
|
+
viewBox: "0 0 24 24",
|
|
4508
|
+
fill: "none",
|
|
4509
|
+
stroke: "currentColor",
|
|
4510
|
+
strokeWidth: 2,
|
|
4511
|
+
strokeLinecap: "round",
|
|
4512
|
+
strokeLinejoin: "round",
|
|
4513
|
+
children: [
|
|
4514
|
+
/* @__PURE__ */ jsx("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
4515
|
+
/* @__PURE__ */ jsx("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
4516
|
+
]
|
|
4539
4517
|
}
|
|
4540
4518
|
)
|
|
4541
|
-
] }),
|
|
4542
|
-
hasAttachments && /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2 justify-end", children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsx(AttachmentPreview, { attachment }, index)) }),
|
|
4543
|
-
showBranchNav && /* @__PURE__ */ jsx(
|
|
4544
|
-
BranchNavigator,
|
|
4545
|
-
{
|
|
4546
|
-
siblingIndex: branchInfo.siblingIndex,
|
|
4547
|
-
totalSiblings: branchInfo.totalSiblings,
|
|
4548
|
-
hasPrevious: branchInfo.hasPrevious,
|
|
4549
|
-
hasNext: branchInfo.hasNext,
|
|
4550
|
-
onPrevious: () => onSwitchBranch(
|
|
4551
|
-
branchInfo.siblingIds[branchInfo.siblingIndex - 1]
|
|
4552
|
-
),
|
|
4553
|
-
onNext: () => onSwitchBranch(
|
|
4554
|
-
branchInfo.siblingIds[branchInfo.siblingIndex + 1]
|
|
4555
|
-
),
|
|
4556
|
-
className: "mt-1"
|
|
4557
|
-
}
|
|
4558
|
-
)
|
|
4559
|
-
] }) }),
|
|
4560
|
-
showUserAvatar && /* @__PURE__ */ jsx(
|
|
4561
|
-
MessageAvatar,
|
|
4562
|
-
{
|
|
4563
|
-
src: userAvatar.src,
|
|
4564
|
-
alt: "User",
|
|
4565
|
-
fallback: userAvatar.fallback,
|
|
4566
|
-
className: userAvatar.className,
|
|
4567
|
-
children: userAvatar.component
|
|
4568
4519
|
}
|
|
4569
4520
|
)
|
|
4570
|
-
]
|
|
4571
|
-
|
|
4572
|
-
|
|
4521
|
+
] }),
|
|
4522
|
+
hasAttachments && /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-wrap gap-2 justify-end", children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsx(AttachmentPreview, { attachment }, index)) }),
|
|
4523
|
+
showBranchNav && /* @__PURE__ */ jsx(
|
|
4524
|
+
BranchNavigator,
|
|
4525
|
+
{
|
|
4526
|
+
siblingIndex: branchInfo.siblingIndex,
|
|
4527
|
+
totalSiblings: branchInfo.totalSiblings,
|
|
4528
|
+
hasPrevious: branchInfo.hasPrevious,
|
|
4529
|
+
hasNext: branchInfo.hasNext,
|
|
4530
|
+
onPrevious: () => onSwitchBranch(
|
|
4531
|
+
branchInfo.siblingIds[branchInfo.siblingIndex - 1]
|
|
4532
|
+
),
|
|
4533
|
+
onNext: () => onSwitchBranch(
|
|
4534
|
+
branchInfo.siblingIds[branchInfo.siblingIndex + 1]
|
|
4535
|
+
),
|
|
4536
|
+
className: "mt-1"
|
|
4537
|
+
}
|
|
4538
|
+
)
|
|
4539
|
+
] }) }),
|
|
4540
|
+
showUserAvatar && /* @__PURE__ */ jsx(
|
|
4541
|
+
MessageAvatar,
|
|
4542
|
+
{
|
|
4543
|
+
src: userAvatar.src,
|
|
4544
|
+
alt: "User",
|
|
4545
|
+
fallback: userAvatar.fallback,
|
|
4546
|
+
className: userAvatar.className,
|
|
4547
|
+
children: userAvatar.component
|
|
4548
|
+
}
|
|
4549
|
+
)
|
|
4550
|
+
] });
|
|
4573
4551
|
}
|
|
4574
4552
|
const isToolHidden = (exec) => {
|
|
4575
4553
|
if (exec.hidden === true) return true;
|
|
@@ -4643,10 +4621,34 @@ function DefaultMessage({
|
|
|
4643
4621
|
}
|
|
4644
4622
|
),
|
|
4645
4623
|
toolsWithCustomRender && toolsWithCustomRender.length > 0 && /* @__PURE__ */ jsx("div", { className: cn("space-y-2", cleanContent?.trim() && "mt-2"), children: toolsWithCustomRender.map((exec) => {
|
|
4646
|
-
const
|
|
4647
|
-
|
|
4624
|
+
const toolDef = registeredTools?.find(
|
|
4625
|
+
(t) => t.name === exec.name
|
|
4626
|
+
);
|
|
4627
|
+
if (toolDef?.render) {
|
|
4628
|
+
let status = "pending";
|
|
4629
|
+
if (exec.status === "executing") status = "executing";
|
|
4630
|
+
else if (exec.status === "completed") status = "completed";
|
|
4631
|
+
else if (exec.status === "error" || exec.status === "failed" || exec.status === "rejected")
|
|
4632
|
+
status = "error";
|
|
4633
|
+
const renderProps = {
|
|
4634
|
+
status,
|
|
4635
|
+
args: exec.args,
|
|
4636
|
+
result: exec.result,
|
|
4637
|
+
error: exec.error,
|
|
4638
|
+
toolCallId: exec.id,
|
|
4639
|
+
toolName: exec.name
|
|
4640
|
+
};
|
|
4641
|
+
const output = toolDef.render(
|
|
4642
|
+
renderProps
|
|
4643
|
+
);
|
|
4644
|
+
if (output != null) {
|
|
4645
|
+
return /* @__PURE__ */ jsx(React17.Fragment, { children: output }, exec.id);
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
if (mcpToolRenderer && (exec.source === "mcp" || toolDef?.source === "mcp")) {
|
|
4649
|
+
const MCPRenderer = mcpToolRenderer;
|
|
4648
4650
|
return /* @__PURE__ */ jsx(
|
|
4649
|
-
|
|
4651
|
+
MCPRenderer,
|
|
4650
4652
|
{
|
|
4651
4653
|
execution: {
|
|
4652
4654
|
id: exec.id,
|
|
@@ -4655,20 +4657,16 @@ function DefaultMessage({
|
|
|
4655
4657
|
status: exec.status,
|
|
4656
4658
|
result: exec.result,
|
|
4657
4659
|
error: exec.error,
|
|
4658
|
-
|
|
4659
|
-
source: exec.source
|
|
4660
|
+
source: exec.source || toolDef?.source
|
|
4660
4661
|
}
|
|
4661
4662
|
},
|
|
4662
4663
|
exec.id
|
|
4663
4664
|
);
|
|
4664
4665
|
}
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
);
|
|
4668
|
-
if (mcpToolRenderer && (exec.source === "mcp" || toolDef?.source === "mcp")) {
|
|
4669
|
-
const MCPRenderer = mcpToolRenderer;
|
|
4666
|
+
if (fallbackToolRenderer) {
|
|
4667
|
+
const FallbackRenderer = fallbackToolRenderer;
|
|
4670
4668
|
return /* @__PURE__ */ jsx(
|
|
4671
|
-
|
|
4669
|
+
FallbackRenderer,
|
|
4672
4670
|
{
|
|
4673
4671
|
execution: {
|
|
4674
4672
|
id: exec.id,
|
|
@@ -4677,16 +4675,16 @@ function DefaultMessage({
|
|
|
4677
4675
|
status: exec.status,
|
|
4678
4676
|
result: exec.result,
|
|
4679
4677
|
error: exec.error,
|
|
4680
|
-
source: exec.source
|
|
4678
|
+
source: exec.source
|
|
4681
4679
|
}
|
|
4682
4680
|
},
|
|
4683
4681
|
exec.id
|
|
4684
4682
|
);
|
|
4685
4683
|
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4684
|
+
const Renderer = toolRenderers?.[exec.name];
|
|
4685
|
+
if (Renderer) {
|
|
4688
4686
|
return /* @__PURE__ */ jsx(
|
|
4689
|
-
|
|
4687
|
+
Renderer,
|
|
4690
4688
|
{
|
|
4691
4689
|
execution: {
|
|
4692
4690
|
id: exec.id,
|
|
@@ -4695,32 +4693,13 @@ function DefaultMessage({
|
|
|
4695
4693
|
status: exec.status,
|
|
4696
4694
|
result: exec.result,
|
|
4697
4695
|
error: exec.error,
|
|
4696
|
+
approvalStatus: exec.approvalStatus,
|
|
4698
4697
|
source: exec.source
|
|
4699
4698
|
}
|
|
4700
4699
|
},
|
|
4701
4700
|
exec.id
|
|
4702
4701
|
);
|
|
4703
4702
|
}
|
|
4704
|
-
const toolDefForRender = toolDef ?? registeredTools?.find((t) => t.name === exec.name);
|
|
4705
|
-
if (toolDefForRender?.render) {
|
|
4706
|
-
let status = "pending";
|
|
4707
|
-
if (exec.status === "executing") status = "executing";
|
|
4708
|
-
else if (exec.status === "completed") status = "completed";
|
|
4709
|
-
else if (exec.status === "error" || exec.status === "failed" || exec.status === "rejected")
|
|
4710
|
-
status = "error";
|
|
4711
|
-
const renderProps = {
|
|
4712
|
-
status,
|
|
4713
|
-
args: exec.args,
|
|
4714
|
-
result: exec.result,
|
|
4715
|
-
error: exec.error,
|
|
4716
|
-
toolCallId: exec.id,
|
|
4717
|
-
toolName: exec.name
|
|
4718
|
-
};
|
|
4719
|
-
const output = toolDefForRender.render(
|
|
4720
|
-
renderProps
|
|
4721
|
-
);
|
|
4722
|
-
return /* @__PURE__ */ jsx(React18.Fragment, { children: output }, exec.id);
|
|
4723
|
-
}
|
|
4724
4703
|
return null;
|
|
4725
4704
|
}) }),
|
|
4726
4705
|
toolSteps && toolSteps.length > 0 && /* @__PURE__ */ jsx(
|
|
@@ -4779,13 +4758,13 @@ function DefaultMessage({
|
|
|
4779
4758
|
const output = toolDef.render(
|
|
4780
4759
|
renderProps
|
|
4781
4760
|
);
|
|
4782
|
-
return /* @__PURE__ */ jsx(
|
|
4761
|
+
return /* @__PURE__ */ jsx(React17.Fragment, { children: output }, tool.id);
|
|
4783
4762
|
}
|
|
4784
4763
|
return /* @__PURE__ */ jsx(
|
|
4785
4764
|
PermissionConfirmation,
|
|
4786
4765
|
{
|
|
4787
4766
|
state: "pending",
|
|
4788
|
-
toolName: tool.name,
|
|
4767
|
+
toolName: tool.approvalTitle ?? tool.name,
|
|
4789
4768
|
message: tool.approvalMessage || `This tool wants to execute. Do you approve?`,
|
|
4790
4769
|
onApprove: (permissionLevel) => onApproveToolExecution?.(
|
|
4791
4770
|
tool.id,
|
|
@@ -4828,7 +4807,7 @@ function DefaultMessage({
|
|
|
4828
4807
|
] });
|
|
4829
4808
|
}
|
|
4830
4809
|
function AttachmentPreview({ attachment }) {
|
|
4831
|
-
const [expanded, setExpanded] =
|
|
4810
|
+
const [expanded, setExpanded] = React17.useState(false);
|
|
4832
4811
|
if (attachment.type !== "image") {
|
|
4833
4812
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-lg border bg-muted/50 px-3 py-2 text-sm", children: [
|
|
4834
4813
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: attachment.type }),
|
|
@@ -5286,10 +5265,10 @@ function ChatView({ children, className }) {
|
|
|
5286
5265
|
ChatView.displayName = "ChatView";
|
|
5287
5266
|
function chatViewHasOnlyLayoutChildren(chatViewElement) {
|
|
5288
5267
|
if (!chatViewElement?.props?.children) return false;
|
|
5289
|
-
const childArray =
|
|
5268
|
+
const childArray = React17__default.Children.toArray(chatViewElement.props.children);
|
|
5290
5269
|
if (childArray.length === 0) return false;
|
|
5291
5270
|
return childArray.every(
|
|
5292
|
-
(child) =>
|
|
5271
|
+
(child) => React17__default.isValidElement(child) && (child.type === Header || child.type === Footer)
|
|
5293
5272
|
);
|
|
5294
5273
|
}
|
|
5295
5274
|
function Header({ children, className }) {
|
|
@@ -5427,18 +5406,18 @@ function ThreadPickerCompound(props) {
|
|
|
5427
5406
|
);
|
|
5428
5407
|
}
|
|
5429
5408
|
function hasCompoundChild(children, ...components) {
|
|
5430
|
-
return
|
|
5431
|
-
(child) =>
|
|
5409
|
+
return React17__default.Children.toArray(children).some(
|
|
5410
|
+
(child) => React17__default.isValidElement(child) && components.includes(child.type)
|
|
5432
5411
|
);
|
|
5433
5412
|
}
|
|
5434
5413
|
function findCompoundChild(children, component) {
|
|
5435
|
-
return
|
|
5436
|
-
(child) =>
|
|
5414
|
+
return React17__default.Children.toArray(children).find(
|
|
5415
|
+
(child) => React17__default.isValidElement(child) && child.type === component
|
|
5437
5416
|
);
|
|
5438
5417
|
}
|
|
5439
5418
|
function filterCompoundChildren(children, ...components) {
|
|
5440
|
-
return
|
|
5441
|
-
(child) =>
|
|
5419
|
+
return React17__default.Children.toArray(children).filter(
|
|
5420
|
+
(child) => React17__default.isValidElement(child) && components.includes(child.type)
|
|
5442
5421
|
);
|
|
5443
5422
|
}
|
|
5444
5423
|
var DEFAULT_MAX_FILE_SIZE2 = 5 * 1024 * 1024;
|
|
@@ -5523,6 +5502,7 @@ function ChatComponent({
|
|
|
5523
5502
|
// Citations/Sources
|
|
5524
5503
|
citations,
|
|
5525
5504
|
// Custom rendering
|
|
5505
|
+
messageView,
|
|
5526
5506
|
renderMessage,
|
|
5527
5507
|
renderInput,
|
|
5528
5508
|
renderHeader,
|
|
@@ -5715,7 +5695,7 @@ function ChatComponent({
|
|
|
5715
5695
|
},
|
|
5716
5696
|
[onSendMessage]
|
|
5717
5697
|
);
|
|
5718
|
-
const contextValue =
|
|
5698
|
+
const contextValue = React17__default.useMemo(
|
|
5719
5699
|
() => ({
|
|
5720
5700
|
view,
|
|
5721
5701
|
send,
|
|
@@ -5807,84 +5787,87 @@ function ChatComponent({
|
|
|
5807
5787
|
className: cn("gap-4 p-4", classNames.messageList),
|
|
5808
5788
|
children: [
|
|
5809
5789
|
messages.length === 0 && /* @__PURE__ */ jsx("div", { className: "py-8 text-center text-muted-foreground", children: welcomeMessage || "Send a message to start the conversation" }),
|
|
5810
|
-
|
|
5811
|
-
const
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5790
|
+
(() => {
|
|
5791
|
+
const messageElements = messages.map((message, index) => {
|
|
5792
|
+
const isLastMessage = index === messages.length - 1;
|
|
5793
|
+
const GROUP_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
5794
|
+
const shouldHideAvatar = (() => {
|
|
5795
|
+
if (!groupConsecutiveMessages || index === 0)
|
|
5796
|
+
return false;
|
|
5797
|
+
let prevIdx = index - 1;
|
|
5798
|
+
while (prevIdx >= 0) {
|
|
5799
|
+
const prev = messages[prevIdx];
|
|
5800
|
+
const isToolMsg = prev.role === "tool";
|
|
5801
|
+
const isInvisibleSystem = prev.role === "system" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5802
|
+
prev.metadata?.type !== "compaction-marker";
|
|
5803
|
+
if (!isToolMsg && !isInvisibleSystem) break;
|
|
5804
|
+
prevIdx--;
|
|
5805
|
+
}
|
|
5806
|
+
if (prevIdx < 0) return false;
|
|
5807
|
+
const prevVisible = messages[prevIdx];
|
|
5808
|
+
if (prevVisible.role !== message.role) return false;
|
|
5809
|
+
const curTs = message.timestamp;
|
|
5810
|
+
const prevTs = prevVisible.timestamp;
|
|
5811
|
+
if (curTs && prevTs && curTs - prevTs > GROUP_THRESHOLD_MS)
|
|
5812
|
+
return false;
|
|
5813
|
+
return true;
|
|
5814
|
+
})();
|
|
5815
|
+
const isEmptyAssistant = message.role === "assistant" && !message.content?.trim();
|
|
5816
|
+
const hasToolCalls = message.tool_calls && message.tool_calls.length > 0;
|
|
5817
|
+
const hasToolExecutions = message.toolExecutions && message.toolExecutions.length > 0;
|
|
5818
|
+
const hasPendingApprovals = message.toolExecutions?.some(
|
|
5819
|
+
(exec) => exec.approvalStatus === "required"
|
|
5820
|
+
);
|
|
5821
|
+
if (isEmptyAssistant) {
|
|
5822
|
+
const shouldShowMessage = hasToolCalls || hasToolExecutions || hasPendingApprovals || isLastMessage && (isLoading || isProcessing);
|
|
5823
|
+
if (!shouldShowMessage) {
|
|
5824
|
+
return null;
|
|
5825
|
+
}
|
|
5824
5826
|
}
|
|
5825
|
-
|
|
5826
|
-
const
|
|
5827
|
-
|
|
5828
|
-
const
|
|
5829
|
-
|
|
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
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
loaderVariant,
|
|
5870
|
-
registeredTools,
|
|
5871
|
-
toolRenderers,
|
|
5872
|
-
mcpToolRenderer,
|
|
5873
|
-
fallbackToolRenderer,
|
|
5874
|
-
onApproveToolExecution,
|
|
5875
|
-
onRejectToolExecution,
|
|
5876
|
-
showFollowUps,
|
|
5877
|
-
onFollowUpClick: handleFollowUpClick,
|
|
5878
|
-
followUpClassName,
|
|
5879
|
-
followUpButtonClassName,
|
|
5880
|
-
citations: citations === false ? { enabled: false } : citations,
|
|
5881
|
-
branchInfo: message.role === "user" ? getBranchInfo?.(message.id) ?? null : null,
|
|
5882
|
-
onSwitchBranch,
|
|
5883
|
-
onEditMessage
|
|
5884
|
-
},
|
|
5885
|
-
message.id
|
|
5886
|
-
);
|
|
5887
|
-
}),
|
|
5827
|
+
const savedExecutions = message.metadata?.toolExecutions;
|
|
5828
|
+
const messageToolExecutions = message.toolExecutions || savedExecutions;
|
|
5829
|
+
const messageWithExecutions = messageToolExecutions ? { ...message, toolExecutions: messageToolExecutions } : message;
|
|
5830
|
+
const handleFollowUpClick = (question) => {
|
|
5831
|
+
if (onSuggestionClick) {
|
|
5832
|
+
onSuggestionClick(question);
|
|
5833
|
+
} else {
|
|
5834
|
+
onSendMessage?.(question);
|
|
5835
|
+
}
|
|
5836
|
+
};
|
|
5837
|
+
return renderMessage ? /* @__PURE__ */ jsx(React17__default.Fragment, { children: renderMessage(messageWithExecutions, index) }, message.id) : /* @__PURE__ */ jsx(
|
|
5838
|
+
DefaultMessage,
|
|
5839
|
+
{
|
|
5840
|
+
message: messageWithExecutions,
|
|
5841
|
+
userAvatar: shouldHideAvatar && message.role === "user" ? { ...userAvatar, className: "invisible" } : userAvatar,
|
|
5842
|
+
assistantAvatar: shouldHideAvatar && message.role === "assistant" ? { ...assistantAvatar, className: "invisible" } : assistantAvatar,
|
|
5843
|
+
showUserAvatar,
|
|
5844
|
+
userMessageClassName: classNames.userMessage,
|
|
5845
|
+
assistantMessageClassName: classNames.assistantMessage,
|
|
5846
|
+
size: fontSize,
|
|
5847
|
+
isLastMessage,
|
|
5848
|
+
isLoading,
|
|
5849
|
+
isProcessing,
|
|
5850
|
+
loaderVariant,
|
|
5851
|
+
registeredTools,
|
|
5852
|
+
toolRenderers,
|
|
5853
|
+
mcpToolRenderer,
|
|
5854
|
+
fallbackToolRenderer,
|
|
5855
|
+
onApproveToolExecution,
|
|
5856
|
+
onRejectToolExecution,
|
|
5857
|
+
showFollowUps,
|
|
5858
|
+
onFollowUpClick: handleFollowUpClick,
|
|
5859
|
+
followUpClassName,
|
|
5860
|
+
followUpButtonClassName,
|
|
5861
|
+
citations: citations === false ? { enabled: false } : citations,
|
|
5862
|
+
branchInfo: message.role === "user" ? getBranchInfo?.(message.id) ?? null : null,
|
|
5863
|
+
onSwitchBranch,
|
|
5864
|
+
onEditMessage
|
|
5865
|
+
},
|
|
5866
|
+
message.id
|
|
5867
|
+
);
|
|
5868
|
+
});
|
|
5869
|
+
return messageView?.children ? messageView.children({ messages, messageElements }) : messageElements;
|
|
5870
|
+
})(),
|
|
5888
5871
|
isLoading && !isProcessing && messages.length > 0 && messages[messages.length - 1]?.role === "user" && /* @__PURE__ */ jsx(
|
|
5889
5872
|
DefaultMessage,
|
|
5890
5873
|
{
|
|
@@ -6454,6 +6437,8 @@ function CopilotChatBase(props) {
|
|
|
6454
6437
|
error: exec.error,
|
|
6455
6438
|
timestamp: exec.startedAt ? exec.startedAt.getTime() : Date.now(),
|
|
6456
6439
|
approvalStatus: exec.approvalStatus,
|
|
6440
|
+
approvalTitle: exec.approvalTitle,
|
|
6441
|
+
approvalMessage: exec.approvalMessage,
|
|
6457
6442
|
hidden: exec.hidden
|
|
6458
6443
|
})
|
|
6459
6444
|
);
|
|
@@ -6595,7 +6580,7 @@ function CopilotChatBase(props) {
|
|
|
6595
6580
|
footer: classNames.footer
|
|
6596
6581
|
} : void 0;
|
|
6597
6582
|
const { threadManager, handleSwitchThread, handleNewThread, isBusy } = threadManagerResult;
|
|
6598
|
-
const handleDeleteThread =
|
|
6583
|
+
const handleDeleteThread = React17__default.useCallback(
|
|
6599
6584
|
(threadId) => {
|
|
6600
6585
|
const isCurrentThread = threadManager.currentThreadId === threadId;
|
|
6601
6586
|
threadManager.deleteThread(threadId);
|