@object-ui/plugin-chatbot 15.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/dist/ChatbotEnhanced.d.ts +23 -0
- package/dist/ChatbotEnhanced.d.ts.map +1 -1
- package/dist/FloatingChatbotTrigger.d.ts.map +1 -1
- package/dist/elements/shimmer.d.ts.map +1 -1
- package/dist/index.js +509 -461
- package/dist/index.umd.cjs +1 -1
- package/dist/useObjectChat.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { Children as t, Fragment as n, createContext as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
-
import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as P, DropdownMenuItem as F, DropdownMenuTrigger as I, Empty as te, EmptyDescription as ne, EmptyHeader as L, EmptyMedia as re, EmptyTitle as ie, HoverCard as R, HoverCardContent as ae, HoverCardTrigger as oe, Input as z, Label as B, ScrollArea as
|
|
4
|
-
import { AlertCircle as
|
|
3
|
+
import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as P, DropdownMenuItem as F, DropdownMenuTrigger as I, Empty as te, EmptyDescription as ne, EmptyHeader as L, EmptyMedia as re, EmptyTitle as ie, HoverCard as R, HoverCardContent as ae, HoverCardTrigger as oe, Input as z, Label as B, ScrollArea as V, ScrollBar as H, Select as se, SelectContent as ce, SelectItem as le, SelectTrigger as ue, SelectValue as de, Separator as fe, Sheet as pe, SheetContent as me, SheetDescription as he, SheetHeader as ge, SheetTitle as _e, Skeleton as ve, Table as ye, TableBody as be, TableCell as U, TableHead as W, TableHeader as xe, TableRow as Se, Tabs as Ce, TabsList as we, TabsTrigger as Te, Textarea as Ee, Tooltip as De, TooltipContent as Oe, TooltipProvider as G, TooltipTrigger as ke, cn as K } from "@object-ui/components";
|
|
4
|
+
import { AlertCircle as Ae, ArrowDownIcon as je, ArrowRight as Me, BookIcon as Ne, Bot as Pe, BrainIcon as Fe, Check as Ie, CheckCircle2 as q, CheckCircleIcon as Le, CheckIcon as Re, ChevronDownIcon as ze, ChevronLeftIcon as Be, ChevronRightIcon as J, CircleIcon as Ve, ClipboardList as He, Clock as Ue, Clock3 as We, ClockIcon as Ge, Copy as Ke, CopyIcon as qe, CornerDownLeft as Je, CornerDownLeftIcon as Ye, Eye as Xe, GitCompareArrows as Ze, HelpCircle as Qe, Hourglass as $e, ImageIcon as et, Inbox as tt, Loader2 as nt, Loader2Icon as rt, Maximize2 as it, MicIcon as at, Minimize2 as ot, PaperclipIcon as st, PlusIcon as ct, RefreshCw as lt, Rocket as ut, Send as dt, ShieldCheck as ft, Sparkles as pt, SquareIcon as mt, Table2 as ht, TriangleAlert as gt, WifiOff as _t, WrenchIcon as vt, X as Y, XCircle as X, XCircleIcon as yt, XIcon as bt } from "lucide-react";
|
|
5
5
|
import { Fragment as Z, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
6
6
|
import { useChat as xt } from "@ai-sdk/react";
|
|
7
7
|
import { DefaultChatTransport as St } from "ai";
|
|
@@ -446,90 +446,87 @@ function un(e = {}) {
|
|
|
446
446
|
A.current = j, (e === "streaming" || e === "submitted") && j === "ready" && an();
|
|
447
447
|
}, [j]);
|
|
448
448
|
let [M, N] = d(() => ln(n)), [ee, P] = d(!1), [F, I] = d(""), [te, ne] = d(""), L = u(null);
|
|
449
|
-
|
|
449
|
+
c(() => () => {
|
|
450
450
|
L.current &&= (clearTimeout(L.current), null);
|
|
451
|
-
}, [])
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
]),
|
|
474
|
-
stop: a,
|
|
475
|
-
reload: i,
|
|
476
|
-
clear: o(() => {
|
|
477
|
-
s([]);
|
|
478
|
-
}, [s]),
|
|
479
|
-
setMessages: s,
|
|
480
|
-
isApiMode: !0,
|
|
481
|
-
input: te,
|
|
482
|
-
setInput: ne,
|
|
483
|
-
handleInputChange: o((e) => {
|
|
484
|
-
ne(e.target.value);
|
|
485
|
-
}, [])
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
let re = o(() => {
|
|
451
|
+
}, []);
|
|
452
|
+
let { messages: re, status: ie, error: R, sendMessage: ae, regenerate: oe, stop: z, setMessages: B } = k, V = ie === "submitted" || ie === "streaming", H = nn(re, { isStreaming: V }).map((e, t) => ({
|
|
453
|
+
...e,
|
|
454
|
+
metadata: re[t]?.metadata
|
|
455
|
+
})), se = o((e) => {
|
|
456
|
+
let t = e.trim();
|
|
457
|
+
if (!t) return;
|
|
458
|
+
let n = [...H, {
|
|
459
|
+
id: Rt("msg"),
|
|
460
|
+
role: "user",
|
|
461
|
+
content: t
|
|
462
|
+
}];
|
|
463
|
+
ae({ text: t }), ne(""), x?.(t, n);
|
|
464
|
+
}, [
|
|
465
|
+
ae,
|
|
466
|
+
x,
|
|
467
|
+
H
|
|
468
|
+
]), ce = o(() => {
|
|
469
|
+
B([]);
|
|
470
|
+
}, [B]), le = o((e) => {
|
|
471
|
+
ne(e.target.value);
|
|
472
|
+
}, []), ue = o(() => {
|
|
489
473
|
L.current &&= (clearTimeout(L.current), null), P(!1);
|
|
474
|
+
}, []), de = o((e) => {
|
|
475
|
+
if (!e.trim()) return;
|
|
476
|
+
let t = {
|
|
477
|
+
id: Rt("msg"),
|
|
478
|
+
role: "user",
|
|
479
|
+
content: e.trim(),
|
|
480
|
+
timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
|
|
481
|
+
};
|
|
482
|
+
N((n) => {
|
|
483
|
+
let r = [...n, t];
|
|
484
|
+
return x?.(e.trim(), r), r;
|
|
485
|
+
}), I(""), v && (P(!0), L.current = setTimeout(() => {
|
|
486
|
+
let e = {
|
|
487
|
+
id: Rt("msg"),
|
|
488
|
+
role: "assistant",
|
|
489
|
+
content: y || "Thank you for your message!",
|
|
490
|
+
timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
|
|
491
|
+
};
|
|
492
|
+
N((t) => [...t, e]), P(!1);
|
|
493
|
+
}, b));
|
|
494
|
+
}, [
|
|
495
|
+
_,
|
|
496
|
+
v,
|
|
497
|
+
y,
|
|
498
|
+
b,
|
|
499
|
+
x
|
|
500
|
+
]), fe = o(() => {}, []), pe = o(() => {
|
|
501
|
+
ue(), N([]);
|
|
502
|
+
}, [ue]), me = o((e) => {
|
|
503
|
+
I(e.target.value);
|
|
490
504
|
}, []);
|
|
491
|
-
return {
|
|
505
|
+
return S ? {
|
|
506
|
+
messages: H,
|
|
507
|
+
isLoading: V,
|
|
508
|
+
error: R,
|
|
509
|
+
sendMessage: se,
|
|
510
|
+
stop: z,
|
|
511
|
+
reload: oe,
|
|
512
|
+
clear: ce,
|
|
513
|
+
setMessages: B,
|
|
514
|
+
isApiMode: !0,
|
|
515
|
+
input: te,
|
|
516
|
+
setInput: ne,
|
|
517
|
+
handleInputChange: le
|
|
518
|
+
} : {
|
|
492
519
|
messages: M,
|
|
493
520
|
isLoading: ee,
|
|
494
521
|
error: void 0,
|
|
495
|
-
sendMessage:
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
role: "user",
|
|
500
|
-
content: e.trim(),
|
|
501
|
-
timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
|
|
502
|
-
};
|
|
503
|
-
N((n) => {
|
|
504
|
-
let r = [...n, t];
|
|
505
|
-
return x?.(e.trim(), r), r;
|
|
506
|
-
}), I(""), v && (P(!0), L.current = setTimeout(() => {
|
|
507
|
-
let e = {
|
|
508
|
-
id: Rt("msg"),
|
|
509
|
-
role: "assistant",
|
|
510
|
-
content: y || "Thank you for your message!",
|
|
511
|
-
timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
|
|
512
|
-
};
|
|
513
|
-
N((t) => [...t, e]), P(!1);
|
|
514
|
-
}, b));
|
|
515
|
-
}, [
|
|
516
|
-
_,
|
|
517
|
-
v,
|
|
518
|
-
y,
|
|
519
|
-
b,
|
|
520
|
-
x
|
|
521
|
-
]),
|
|
522
|
-
stop: re,
|
|
523
|
-
reload: o(() => {}, []),
|
|
524
|
-
clear: o(() => {
|
|
525
|
-
re(), N([]);
|
|
526
|
-
}, [re]),
|
|
522
|
+
sendMessage: de,
|
|
523
|
+
stop: ue,
|
|
524
|
+
reload: fe,
|
|
525
|
+
clear: pe,
|
|
527
526
|
isApiMode: !1,
|
|
528
527
|
input: F,
|
|
529
528
|
setInput: I,
|
|
530
|
-
handleInputChange:
|
|
531
|
-
I(e.target.value);
|
|
532
|
-
}, [])
|
|
529
|
+
handleInputChange: me
|
|
533
530
|
};
|
|
534
531
|
}
|
|
535
532
|
//#endregion
|
|
@@ -726,15 +723,11 @@ function Mn() {
|
|
|
726
723
|
//#endregion
|
|
727
724
|
//#region src/FloatingChatbotTrigger.tsx
|
|
728
725
|
function Nn() {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
};
|
|
735
|
-
} catch {
|
|
736
|
-
return (e, t) => t;
|
|
737
|
-
}
|
|
726
|
+
let { t: e } = Tt();
|
|
727
|
+
return (t, n) => {
|
|
728
|
+
let r = e(`common.${t}`);
|
|
729
|
+
return !r || r === `common.${t}` ? n : r;
|
|
730
|
+
};
|
|
738
731
|
}
|
|
739
732
|
var Pn = {
|
|
740
733
|
32: "size-8",
|
|
@@ -759,11 +752,11 @@ function Ln({ position: e = "bottom-right", size: t = 56, className: n }) {
|
|
|
759
752
|
let { isOpen: r, toggle: i } = Mn(), a = Nn();
|
|
760
753
|
return /* @__PURE__ */ Q(v, {
|
|
761
754
|
onClick: i,
|
|
762
|
-
className:
|
|
755
|
+
className: K("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", In(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
|
|
763
756
|
size: "icon",
|
|
764
757
|
"aria-label": r ? a("closeChat", "Close chat") : a("openChat", "Open chat"),
|
|
765
758
|
"data-testid": "floating-chatbot-trigger",
|
|
766
|
-
children: Q(r ?
|
|
759
|
+
children: Q(r ? Y : Pe, { className: "h-6 w-6" })
|
|
767
760
|
});
|
|
768
761
|
}
|
|
769
762
|
//#endregion
|
|
@@ -813,7 +806,7 @@ function Hn(e) {
|
|
|
813
806
|
function Un({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
|
|
814
807
|
let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = Mn();
|
|
815
808
|
return c ? /* @__PURE__ */ $("div", {
|
|
816
|
-
className:
|
|
809
|
+
className: K("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? K("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Vn(n), Hn(r)) : K("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", Vn(n), Hn(r)), a),
|
|
817
810
|
role: "dialog",
|
|
818
811
|
"aria-label": e,
|
|
819
812
|
"data-testid": "floating-chatbot-panel",
|
|
@@ -840,7 +833,7 @@ function Un({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
|
|
|
840
833
|
onClick: d,
|
|
841
834
|
"aria-label": l ? "Exit fullscreen" : "Fullscreen",
|
|
842
835
|
"data-testid": "floating-chatbot-fullscreen",
|
|
843
|
-
children: Q(l ?
|
|
836
|
+
children: Q(l ? ot : it, { className: "h-4 w-4" })
|
|
844
837
|
}),
|
|
845
838
|
/* @__PURE__ */ Q(v, {
|
|
846
839
|
variant: "ghost",
|
|
@@ -849,7 +842,7 @@ function Un({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
|
|
|
849
842
|
onClick: u,
|
|
850
843
|
"aria-label": "Close chat",
|
|
851
844
|
"data-testid": "floating-chatbot-close",
|
|
852
|
-
children: /* @__PURE__ */ Q(
|
|
845
|
+
children: /* @__PURE__ */ Q(Y, { className: "h-4 w-4" })
|
|
853
846
|
})
|
|
854
847
|
]
|
|
855
848
|
})
|
|
@@ -950,16 +943,16 @@ function Qn(e) {
|
|
|
950
943
|
//#endregion
|
|
951
944
|
//#region src/elements/conversation.tsx
|
|
952
945
|
var $n = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
|
|
953
|
-
className:
|
|
946
|
+
className: K("relative flex-1 overflow-y-hidden", e),
|
|
954
947
|
initial: "smooth",
|
|
955
948
|
resize: "smooth",
|
|
956
949
|
role: "log",
|
|
957
950
|
...t
|
|
958
951
|
}), er = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et.Content, {
|
|
959
|
-
className:
|
|
952
|
+
className: K("flex flex-col gap-8 p-4", e),
|
|
960
953
|
...t
|
|
961
954
|
}), tr = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Q("div", {
|
|
962
|
-
className:
|
|
955
|
+
className: K("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", e),
|
|
963
956
|
...a,
|
|
964
957
|
children: i ?? /* @__PURE__ */ $(Z, { children: [r && /* @__PURE__ */ Q("div", {
|
|
965
958
|
className: "text-muted-foreground",
|
|
@@ -979,13 +972,13 @@ var $n = ({ className: e, ...t }) => /* @__PURE__ */ Q(Et, {
|
|
|
979
972
|
r();
|
|
980
973
|
}, [r]);
|
|
981
974
|
return !n && /* @__PURE__ */ Q(v, {
|
|
982
|
-
className:
|
|
975
|
+
className: K("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full", e),
|
|
983
976
|
onClick: i,
|
|
984
977
|
size: "icon",
|
|
985
978
|
type: "button",
|
|
986
979
|
variant: "outline",
|
|
987
980
|
...t,
|
|
988
|
-
children: /* @__PURE__ */ Q(
|
|
981
|
+
children: /* @__PURE__ */ Q(je, { className: "size-4" })
|
|
989
982
|
});
|
|
990
983
|
}, rr = Ot("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
991
984
|
variants: { orientation: {
|
|
@@ -999,27 +992,27 @@ function ir({ className: e, orientation: t, ...n }) {
|
|
|
999
992
|
role: "group",
|
|
1000
993
|
"data-slot": "button-group",
|
|
1001
994
|
"data-orientation": t,
|
|
1002
|
-
className:
|
|
995
|
+
className: K(rr({ orientation: t }), e),
|
|
1003
996
|
...n
|
|
1004
997
|
});
|
|
1005
998
|
}
|
|
1006
999
|
function ar({ className: e, asChild: t = !1, ...n }) {
|
|
1007
1000
|
return /* @__PURE__ */ Q(t ? kt : "div", {
|
|
1008
|
-
className:
|
|
1001
|
+
className: K("flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", e),
|
|
1009
1002
|
...n
|
|
1010
1003
|
});
|
|
1011
1004
|
}
|
|
1012
1005
|
//#endregion
|
|
1013
1006
|
//#region src/elements/message.tsx
|
|
1014
1007
|
var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
1015
|
-
className:
|
|
1008
|
+
className: K("group flex w-full max-w-[95%] flex-col gap-2", t === "user" ? "is-user ml-auto justify-end" : "is-assistant", e),
|
|
1016
1009
|
...n
|
|
1017
1010
|
}), sr = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
1018
|
-
className:
|
|
1011
|
+
className: K("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", t),
|
|
1019
1012
|
...n,
|
|
1020
1013
|
children: e
|
|
1021
1014
|
}), cr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
1022
|
-
className:
|
|
1015
|
+
className: K("flex items-center gap-1", e),
|
|
1023
1016
|
...n,
|
|
1024
1017
|
children: t
|
|
1025
1018
|
}), lr = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
|
|
@@ -1033,7 +1026,7 @@ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1033
1026
|
children: n || e
|
|
1034
1027
|
})]
|
|
1035
1028
|
});
|
|
1036
|
-
return e ? /* @__PURE__ */ Q(G, { children: /* @__PURE__ */ $(De, { children: [/* @__PURE__ */ Q(
|
|
1029
|
+
return e ? /* @__PURE__ */ Q(G, { children: /* @__PURE__ */ $(De, { children: [/* @__PURE__ */ Q(ke, {
|
|
1037
1030
|
asChild: !0,
|
|
1038
1031
|
children: o
|
|
1039
1032
|
}), /* @__PURE__ */ Q(Oe, { children: /* @__PURE__ */ Q("p", { children: e }) })] }) }) : o;
|
|
@@ -1061,7 +1054,7 @@ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1061
1054
|
return /* @__PURE__ */ Q(ur.Provider, {
|
|
1062
1055
|
value: l,
|
|
1063
1056
|
children: /* @__PURE__ */ Q("div", {
|
|
1064
|
-
className:
|
|
1057
|
+
className: K("grid w-full gap-2 [&>div]:pb-0", n),
|
|
1065
1058
|
...r
|
|
1066
1059
|
})
|
|
1067
1060
|
});
|
|
@@ -1074,7 +1067,7 @@ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1074
1067
|
i,
|
|
1075
1068
|
r
|
|
1076
1069
|
]), a.map((e, r) => /* @__PURE__ */ Q("div", {
|
|
1077
|
-
className:
|
|
1070
|
+
className: K("grid gap-2 overflow-hidden [&>div]:pb-0", r === n ? "block" : "hidden"),
|
|
1078
1071
|
...t,
|
|
1079
1072
|
children: e
|
|
1080
1073
|
}, e.key));
|
|
@@ -1095,7 +1088,7 @@ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1095
1088
|
type: "button",
|
|
1096
1089
|
variant: "ghost",
|
|
1097
1090
|
...t,
|
|
1098
|
-
children: e ?? /* @__PURE__ */ Q(
|
|
1091
|
+
children: e ?? /* @__PURE__ */ Q(Be, { size: 14 })
|
|
1099
1092
|
});
|
|
1100
1093
|
}, gr = ({ children: e, className: t, ...n }) => {
|
|
1101
1094
|
let { goToNext: r, totalBranches: i } = dr();
|
|
@@ -1107,12 +1100,12 @@ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1107
1100
|
type: "button",
|
|
1108
1101
|
variant: "ghost",
|
|
1109
1102
|
...n,
|
|
1110
|
-
children: e ?? /* @__PURE__ */ Q(
|
|
1103
|
+
children: e ?? /* @__PURE__ */ Q(J, { size: 14 })
|
|
1111
1104
|
});
|
|
1112
1105
|
}, _r = ({ className: e, ...t }) => {
|
|
1113
1106
|
let { currentBranch: n, totalBranches: r } = dr();
|
|
1114
1107
|
return /* @__PURE__ */ $(ar, {
|
|
1115
|
-
className:
|
|
1108
|
+
className: K("border-none bg-transparent text-muted-foreground shadow-none", e),
|
|
1116
1109
|
...t,
|
|
1117
1110
|
children: [
|
|
1118
1111
|
n + 1,
|
|
@@ -1121,14 +1114,14 @@ var or = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
|
1121
1114
|
]
|
|
1122
1115
|
});
|
|
1123
1116
|
}, vr = a(({ className: e, ...t }) => /* @__PURE__ */ Q(At, {
|
|
1124
|
-
className:
|
|
1117
|
+
className: K("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", e),
|
|
1125
1118
|
...t
|
|
1126
1119
|
}), (e, t) => e.children === t.children);
|
|
1127
1120
|
vr.displayName = "MessageResponse";
|
|
1128
1121
|
function yr({ data: e, className: t, onRemove: n, ...r }) {
|
|
1129
1122
|
let i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
|
|
1130
1123
|
return /* @__PURE__ */ Q("div", {
|
|
1131
|
-
className:
|
|
1124
|
+
className: K("group relative size-24 overflow-hidden rounded-lg", t),
|
|
1132
1125
|
...r,
|
|
1133
1126
|
children: a ? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q("img", {
|
|
1134
1127
|
alt: i || "attachment",
|
|
@@ -1148,11 +1141,11 @@ function yr({ data: e, className: t, onRemove: n, ...r }) {
|
|
|
1148
1141
|
className: "sr-only",
|
|
1149
1142
|
children: "Remove"
|
|
1150
1143
|
})]
|
|
1151
|
-
})] }) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $(De, { children: [/* @__PURE__ */ Q(
|
|
1144
|
+
})] }) : /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $(De, { children: [/* @__PURE__ */ Q(ke, {
|
|
1152
1145
|
asChild: !0,
|
|
1153
1146
|
children: /* @__PURE__ */ Q("div", {
|
|
1154
1147
|
className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",
|
|
1155
|
-
children: /* @__PURE__ */ Q(
|
|
1148
|
+
children: /* @__PURE__ */ Q(st, { className: "size-4" })
|
|
1156
1149
|
})
|
|
1157
1150
|
}), /* @__PURE__ */ Q(Oe, { children: /* @__PURE__ */ Q("p", { children: o }) })] }), n && /* @__PURE__ */ $(v, {
|
|
1158
1151
|
"aria-label": "Remove attachment",
|
|
@@ -1171,13 +1164,13 @@ function yr({ data: e, className: t, onRemove: n, ...r }) {
|
|
|
1171
1164
|
}
|
|
1172
1165
|
function br({ children: e, className: t, ...n }) {
|
|
1173
1166
|
return e ? /* @__PURE__ */ Q("div", {
|
|
1174
|
-
className:
|
|
1167
|
+
className: K("ml-auto flex w-fit flex-wrap items-start gap-2", t),
|
|
1175
1168
|
...n,
|
|
1176
1169
|
children: e
|
|
1177
1170
|
}) : null;
|
|
1178
1171
|
}
|
|
1179
1172
|
var xr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
1180
|
-
className:
|
|
1173
|
+
className: K("mt-4 flex w-full items-center justify-between gap-4", e),
|
|
1181
1174
|
...n,
|
|
1182
1175
|
children: t
|
|
1183
1176
|
});
|
|
@@ -1187,7 +1180,7 @@ function Sr({ className: e, ...t }) {
|
|
|
1187
1180
|
return /* @__PURE__ */ Q("div", {
|
|
1188
1181
|
"data-slot": "input-group",
|
|
1189
1182
|
role: "group",
|
|
1190
|
-
className:
|
|
1183
|
+
className: K("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30", "h-9 min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50", "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", e),
|
|
1191
1184
|
...t
|
|
1192
1185
|
});
|
|
1193
1186
|
}
|
|
@@ -1205,7 +1198,7 @@ function wr({ className: e, align: t = "inline-start", ...n }) {
|
|
|
1205
1198
|
role: "group",
|
|
1206
1199
|
"data-slot": "input-group-addon",
|
|
1207
1200
|
"data-align": t,
|
|
1208
|
-
className:
|
|
1201
|
+
className: K(Cr({ align: t }), e),
|
|
1209
1202
|
onClick: (e) => {
|
|
1210
1203
|
e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
1211
1204
|
},
|
|
@@ -1226,14 +1219,14 @@ function Er({ className: e, type: t = "button", variant: n = "ghost", size: r =
|
|
|
1226
1219
|
type: t,
|
|
1227
1220
|
"data-size": r,
|
|
1228
1221
|
variant: n,
|
|
1229
|
-
className:
|
|
1222
|
+
className: K(Tr({ size: r }), e),
|
|
1230
1223
|
...i
|
|
1231
1224
|
});
|
|
1232
1225
|
}
|
|
1233
1226
|
function Dr({ className: e, ...t }) {
|
|
1234
1227
|
return /* @__PURE__ */ Q(Ee, {
|
|
1235
1228
|
"data-slot": "input-group-control",
|
|
1236
|
-
className:
|
|
1229
|
+
className: K("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", e),
|
|
1237
1230
|
...t
|
|
1238
1231
|
});
|
|
1239
1232
|
}
|
|
@@ -1322,7 +1315,7 @@ function Lr({ data: e, className: t, ...n }) {
|
|
|
1322
1315
|
return /* @__PURE__ */ $(ii, { children: [/* @__PURE__ */ Q(oe, {
|
|
1323
1316
|
asChild: !0,
|
|
1324
1317
|
children: /* @__PURE__ */ $("div", {
|
|
1325
|
-
className:
|
|
1318
|
+
className: K("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", t),
|
|
1326
1319
|
...n,
|
|
1327
1320
|
children: [/* @__PURE__ */ $("div", {
|
|
1328
1321
|
className: "relative size-5 shrink-0",
|
|
@@ -1336,7 +1329,7 @@ function Lr({ data: e, className: t, ...n }) {
|
|
|
1336
1329
|
width: 20
|
|
1337
1330
|
}) : /* @__PURE__ */ Q("div", {
|
|
1338
1331
|
className: "flex size-5 items-center justify-center text-muted-foreground",
|
|
1339
|
-
children: /* @__PURE__ */ Q(
|
|
1332
|
+
children: /* @__PURE__ */ Q(st, { className: "size-3" })
|
|
1340
1333
|
})
|
|
1341
1334
|
}), /* @__PURE__ */ $(v, {
|
|
1342
1335
|
"aria-label": "Remove attachment",
|
|
@@ -1388,7 +1381,7 @@ function Lr({ data: e, className: t, ...n }) {
|
|
|
1388
1381
|
function Rr({ children: e, className: t, ...r }) {
|
|
1389
1382
|
let i = Ir();
|
|
1390
1383
|
return i.files.length ? /* @__PURE__ */ Q("div", {
|
|
1391
|
-
className:
|
|
1384
|
+
className: K("flex flex-wrap items-center gap-2 p-3 w-full", t),
|
|
1392
1385
|
...r,
|
|
1393
1386
|
children: i.files.map((t) => /* @__PURE__ */ Q(n, { children: e(t) }, t.id))
|
|
1394
1387
|
}) : null;
|
|
@@ -1401,7 +1394,7 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1401
1394
|
e.preventDefault(), n.openFileDialog();
|
|
1402
1395
|
},
|
|
1403
1396
|
children: [
|
|
1404
|
-
/* @__PURE__ */ Q(
|
|
1397
|
+
/* @__PURE__ */ Q(et, { className: "mr-2 size-4" }),
|
|
1405
1398
|
" ",
|
|
1406
1399
|
e
|
|
1407
1400
|
]
|
|
@@ -1529,7 +1522,7 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1529
1522
|
title: r,
|
|
1530
1523
|
type: "file"
|
|
1531
1524
|
}), /* @__PURE__ */ Q("form", {
|
|
1532
|
-
className:
|
|
1525
|
+
className: K("w-full", e),
|
|
1533
1526
|
onSubmit: (e) => {
|
|
1534
1527
|
e.preventDefault();
|
|
1535
1528
|
let t = e.currentTarget, n = v ? _.textInput.value : new FormData(t).get("message") || "";
|
|
@@ -1566,7 +1559,7 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1566
1559
|
children: I
|
|
1567
1560
|
});
|
|
1568
1561
|
}, Vr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1569
|
-
className:
|
|
1562
|
+
className: K("contents", e),
|
|
1570
1563
|
...t
|
|
1571
1564
|
}), Hr = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
|
|
1572
1565
|
let i = jr(), a = Ir(), [o, s] = d(!1), c = (e) => {
|
|
@@ -1598,7 +1591,7 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1598
1591
|
}
|
|
1599
1592
|
} : { onChange: e };
|
|
1600
1593
|
return /* @__PURE__ */ Q(Dr, {
|
|
1601
|
-
className:
|
|
1594
|
+
className: K("field-sizing-content max-h-48 min-h-16", t),
|
|
1602
1595
|
name: "message",
|
|
1603
1596
|
onCompositionEnd: () => s(!1),
|
|
1604
1597
|
onCompositionStart: () => s(!0),
|
|
@@ -1610,19 +1603,19 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1610
1603
|
});
|
|
1611
1604
|
}, Ur = ({ className: e, ...t }) => /* @__PURE__ */ Q(wr, {
|
|
1612
1605
|
align: "block-end",
|
|
1613
|
-
className:
|
|
1606
|
+
className: K("order-first flex-wrap gap-1", e),
|
|
1614
1607
|
...t
|
|
1615
1608
|
}), Wr = ({ className: e, ...t }) => /* @__PURE__ */ Q(wr, {
|
|
1616
1609
|
align: "block-end",
|
|
1617
|
-
className:
|
|
1610
|
+
className: K("justify-between gap-1", e),
|
|
1618
1611
|
...t
|
|
1619
1612
|
}), Gr = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1620
|
-
className:
|
|
1613
|
+
className: K("flex items-center gap-1", e),
|
|
1621
1614
|
...t
|
|
1622
1615
|
}), Kr = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
|
|
1623
1616
|
let a = r ?? (t.count(i.children) > 1 ? "sm" : "icon-sm");
|
|
1624
1617
|
return /* @__PURE__ */ Q(Er, {
|
|
1625
|
-
className:
|
|
1618
|
+
className: K(n),
|
|
1626
1619
|
size: a,
|
|
1627
1620
|
type: "button",
|
|
1628
1621
|
variant: e,
|
|
@@ -1633,20 +1626,20 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1633
1626
|
children: /* @__PURE__ */ Q(Kr, {
|
|
1634
1627
|
className: e,
|
|
1635
1628
|
...n,
|
|
1636
|
-
children: t ?? /* @__PURE__ */ Q(
|
|
1629
|
+
children: t ?? /* @__PURE__ */ Q(ct, { className: "size-4" })
|
|
1637
1630
|
})
|
|
1638
1631
|
}), Yr = ({ className: e, ...t }) => /* @__PURE__ */ Q(P, {
|
|
1639
1632
|
align: "start",
|
|
1640
|
-
className:
|
|
1633
|
+
className: K(e),
|
|
1641
1634
|
...t
|
|
1642
1635
|
}), Xr = ({ className: e, ...t }) => /* @__PURE__ */ Q(F, {
|
|
1643
|
-
className:
|
|
1636
|
+
className: K(e),
|
|
1644
1637
|
...t
|
|
1645
1638
|
}), Zr = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
|
|
1646
|
-
let o = /* @__PURE__ */ Q(
|
|
1647
|
-
return r === "submitted" ? o = /* @__PURE__ */ Q(
|
|
1639
|
+
let o = /* @__PURE__ */ Q(Ye, { className: "size-4" });
|
|
1640
|
+
return r === "submitted" ? o = /* @__PURE__ */ Q(rt, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Q(mt, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Q(bt, { className: "size-4" })), /* @__PURE__ */ Q(Er, {
|
|
1648
1641
|
"aria-label": "Submit",
|
|
1649
|
-
className:
|
|
1642
|
+
className: K(e),
|
|
1650
1643
|
size: n,
|
|
1651
1644
|
type: "submit",
|
|
1652
1645
|
variant: t,
|
|
@@ -1684,23 +1677,23 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1684
1677
|
s && (i ? s.stop() : s.start());
|
|
1685
1678
|
}, [s, i]);
|
|
1686
1679
|
return /* @__PURE__ */ Q(Kr, {
|
|
1687
|
-
className:
|
|
1680
|
+
className: K("relative transition-all duration-200", i && "animate-pulse bg-accent text-accent-foreground", e),
|
|
1688
1681
|
disabled: !s,
|
|
1689
1682
|
onClick: p,
|
|
1690
1683
|
...r,
|
|
1691
|
-
children: /* @__PURE__ */ Q(
|
|
1684
|
+
children: /* @__PURE__ */ Q(at, { className: "size-4" })
|
|
1692
1685
|
});
|
|
1693
|
-
}, $r = (e) => /* @__PURE__ */ Q(
|
|
1694
|
-
className:
|
|
1686
|
+
}, $r = (e) => /* @__PURE__ */ Q(se, { ...e }), ei = ({ className: e, ...t }) => /* @__PURE__ */ Q(ue, {
|
|
1687
|
+
className: K("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground", e),
|
|
1695
1688
|
...t
|
|
1696
|
-
}), ti = ({ className: e, ...t }) => /* @__PURE__ */ Q(
|
|
1697
|
-
className:
|
|
1689
|
+
}), ti = ({ className: e, ...t }) => /* @__PURE__ */ Q(ce, {
|
|
1690
|
+
className: K(e),
|
|
1698
1691
|
...t
|
|
1699
|
-
}), ni = ({ className: e, ...t }) => /* @__PURE__ */ Q(
|
|
1700
|
-
className:
|
|
1692
|
+
}), ni = ({ className: e, ...t }) => /* @__PURE__ */ Q(le, {
|
|
1693
|
+
className: K(e),
|
|
1701
1694
|
...t
|
|
1702
|
-
}), ri = ({ className: e, ...t }) => /* @__PURE__ */ Q(
|
|
1703
|
-
className:
|
|
1695
|
+
}), ri = ({ className: e, ...t }) => /* @__PURE__ */ Q(de, {
|
|
1696
|
+
className: K(e),
|
|
1704
1697
|
...t
|
|
1705
1698
|
}), ii = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Q(R, {
|
|
1706
1699
|
closeDelay: t,
|
|
@@ -1710,53 +1703,53 @@ var zr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1710
1703
|
align: e,
|
|
1711
1704
|
...t
|
|
1712
1705
|
}), si = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1713
|
-
className:
|
|
1706
|
+
className: K(e),
|
|
1714
1707
|
...t
|
|
1715
1708
|
}), ci = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1716
|
-
className:
|
|
1709
|
+
className: K(e),
|
|
1717
1710
|
...t
|
|
1718
1711
|
}), li = ({ className: e, ...t }) => /* @__PURE__ */ Q("h3", {
|
|
1719
|
-
className:
|
|
1712
|
+
className: K("mb-2 px-3 font-medium text-muted-foreground text-xs", e),
|
|
1720
1713
|
...t
|
|
1721
1714
|
}), ui = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1722
|
-
className:
|
|
1715
|
+
className: K("space-y-1", e),
|
|
1723
1716
|
...t
|
|
1724
1717
|
}), di = ({ className: e, ...t }) => /* @__PURE__ */ Q("div", {
|
|
1725
|
-
className:
|
|
1718
|
+
className: K("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", e),
|
|
1726
1719
|
...t
|
|
1727
1720
|
}), fi = ({ className: e, ...t }) => /* @__PURE__ */ Q(D, {
|
|
1728
|
-
className:
|
|
1721
|
+
className: K(e),
|
|
1729
1722
|
...t
|
|
1730
1723
|
}), pi = ({ className: e, ...t }) => /* @__PURE__ */ Q(A, {
|
|
1731
|
-
className:
|
|
1724
|
+
className: K(e),
|
|
1732
1725
|
...t
|
|
1733
1726
|
}), mi = ({ className: e, ...t }) => /* @__PURE__ */ Q(M, {
|
|
1734
|
-
className:
|
|
1727
|
+
className: K(e),
|
|
1735
1728
|
...t
|
|
1736
1729
|
}), hi = ({ className: e, ...t }) => /* @__PURE__ */ Q(O, {
|
|
1737
|
-
className:
|
|
1730
|
+
className: K(e),
|
|
1738
1731
|
...t
|
|
1739
1732
|
}), gi = ({ className: e, ...t }) => /* @__PURE__ */ Q(k, {
|
|
1740
|
-
className:
|
|
1733
|
+
className: K(e),
|
|
1741
1734
|
...t
|
|
1742
1735
|
}), _i = ({ className: e, ...t }) => /* @__PURE__ */ Q(j, {
|
|
1743
|
-
className:
|
|
1736
|
+
className: K(e),
|
|
1744
1737
|
...t
|
|
1745
1738
|
}), vi = ({ className: e, ...t }) => /* @__PURE__ */ Q(N, {
|
|
1746
|
-
className:
|
|
1739
|
+
className: K(e),
|
|
1747
1740
|
...t
|
|
1748
|
-
}), yi = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(
|
|
1741
|
+
}), yi = ({ className: e, children: t, ...n }) => /* @__PURE__ */ $(V, {
|
|
1749
1742
|
className: "w-full overflow-x-auto whitespace-nowrap",
|
|
1750
1743
|
...n,
|
|
1751
1744
|
children: [/* @__PURE__ */ Q("div", {
|
|
1752
|
-
className:
|
|
1745
|
+
className: K("flex w-max flex-nowrap items-center gap-2", e),
|
|
1753
1746
|
children: t
|
|
1754
|
-
}), /* @__PURE__ */ Q(
|
|
1747
|
+
}), /* @__PURE__ */ Q(H, {
|
|
1755
1748
|
className: "hidden",
|
|
1756
1749
|
orientation: "horizontal"
|
|
1757
1750
|
})]
|
|
1758
1751
|
}), bi = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Q(v, {
|
|
1759
|
-
className:
|
|
1752
|
+
className: K("cursor-pointer rounded-full px-4", n),
|
|
1760
1753
|
onClick: () => {
|
|
1761
1754
|
t?.(e);
|
|
1762
1755
|
},
|
|
@@ -1811,7 +1804,7 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1811
1804
|
]), /* @__PURE__ */ Q(xi.Provider, {
|
|
1812
1805
|
value: { code: e },
|
|
1813
1806
|
children: /* @__PURE__ */ Q("div", {
|
|
1814
|
-
className:
|
|
1807
|
+
className: K("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", r),
|
|
1815
1808
|
...a,
|
|
1816
1809
|
children: /* @__PURE__ */ $("div", {
|
|
1817
1810
|
className: "relative",
|
|
@@ -1843,9 +1836,9 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1843
1836
|
} catch (e) {
|
|
1844
1837
|
t?.(e);
|
|
1845
1838
|
}
|
|
1846
|
-
}, f = o ?
|
|
1839
|
+
}, f = o ? Re : qe;
|
|
1847
1840
|
return /* @__PURE__ */ Q(v, {
|
|
1848
|
-
className:
|
|
1841
|
+
className: K("shrink-0", i),
|
|
1849
1842
|
onClick: u,
|
|
1850
1843
|
size: "icon",
|
|
1851
1844
|
variant: "ghost",
|
|
@@ -1853,17 +1846,17 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1853
1846
|
children: r ?? /* @__PURE__ */ Q(f, { size: 14 })
|
|
1854
1847
|
});
|
|
1855
1848
|
}, Ei = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
1856
|
-
className:
|
|
1849
|
+
className: K("not-prose mb-4 w-full rounded-md border", e),
|
|
1857
1850
|
...t
|
|
1858
1851
|
}), Di = (e) => /* @__PURE__ */ $(_, {
|
|
1859
1852
|
className: "gap-1.5 rounded-full text-xs",
|
|
1860
1853
|
variant: "secondary",
|
|
1861
1854
|
children: [{
|
|
1862
|
-
"input-streaming": /* @__PURE__ */ Q(
|
|
1863
|
-
"input-available": /* @__PURE__ */ Q(
|
|
1864
|
-
"approval-requested": /* @__PURE__ */ Q(
|
|
1865
|
-
"approval-responded": /* @__PURE__ */ Q(
|
|
1866
|
-
"output-available": /* @__PURE__ */ Q(
|
|
1855
|
+
"input-streaming": /* @__PURE__ */ Q(Ve, { className: "size-4" }),
|
|
1856
|
+
"input-available": /* @__PURE__ */ Q(Ge, { className: "size-4 animate-pulse" }),
|
|
1857
|
+
"approval-requested": /* @__PURE__ */ Q(Ge, { className: "size-4 text-yellow-600" }),
|
|
1858
|
+
"approval-responded": /* @__PURE__ */ Q(Le, { className: "size-4 text-blue-600" }),
|
|
1859
|
+
"output-available": /* @__PURE__ */ Q(Le, { className: "size-4 text-green-600" }),
|
|
1867
1860
|
"output-error": /* @__PURE__ */ Q(yt, { className: "size-4 text-red-600" }),
|
|
1868
1861
|
"output-denied": /* @__PURE__ */ Q(yt, { className: "size-4 text-orange-600" })
|
|
1869
1862
|
}[e], {
|
|
@@ -1876,24 +1869,24 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1876
1869
|
"output-denied": "Denied"
|
|
1877
1870
|
}[e]]
|
|
1878
1871
|
}), Oi = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ $(E, {
|
|
1879
|
-
className:
|
|
1872
|
+
className: K("flex w-full items-center justify-between gap-4 p-3", e),
|
|
1880
1873
|
...i,
|
|
1881
1874
|
children: [/* @__PURE__ */ $("div", {
|
|
1882
1875
|
className: "flex items-center gap-2",
|
|
1883
1876
|
children: [
|
|
1884
|
-
/* @__PURE__ */ Q(
|
|
1877
|
+
/* @__PURE__ */ Q(vt, { className: "size-4 text-muted-foreground" }),
|
|
1885
1878
|
/* @__PURE__ */ Q("span", {
|
|
1886
1879
|
className: "font-medium text-sm",
|
|
1887
1880
|
children: t ?? n.split("-").slice(1).join("-")
|
|
1888
1881
|
}),
|
|
1889
1882
|
Di(r)
|
|
1890
1883
|
]
|
|
1891
|
-
}), /* @__PURE__ */ Q(
|
|
1884
|
+
}), /* @__PURE__ */ Q(ze, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })]
|
|
1892
1885
|
}), ki = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
|
|
1893
|
-
className:
|
|
1886
|
+
className: K("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
1894
1887
|
...t
|
|
1895
1888
|
}), Ai = ({ className: e, input: t, ...n }) => /* @__PURE__ */ $("div", {
|
|
1896
|
-
className:
|
|
1889
|
+
className: K("space-y-2 overflow-hidden p-4", e),
|
|
1897
1890
|
...n,
|
|
1898
1891
|
children: [/* @__PURE__ */ Q("h4", {
|
|
1899
1892
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
@@ -1915,21 +1908,21 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1915
1908
|
code: t,
|
|
1916
1909
|
language: "json"
|
|
1917
1910
|
})), /* @__PURE__ */ $("div", {
|
|
1918
|
-
className:
|
|
1911
|
+
className: K("space-y-2 p-4", e),
|
|
1919
1912
|
...r,
|
|
1920
1913
|
children: [/* @__PURE__ */ Q("h4", {
|
|
1921
1914
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1922
1915
|
children: n ? "Error" : "Result"
|
|
1923
1916
|
}), /* @__PURE__ */ $("div", {
|
|
1924
|
-
className:
|
|
1917
|
+
className: K("overflow-x-auto rounded-md text-xs [&_table]:w-full", n ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
|
|
1925
1918
|
children: [n && /* @__PURE__ */ Q("div", { children: n }), a]
|
|
1926
1919
|
})]
|
|
1927
1920
|
});
|
|
1928
1921
|
}, Mi = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
|
|
1929
|
-
let a = Pt.create(t), o = l(() => (e?.length ?? 0) * i, [e, i]);
|
|
1922
|
+
let a = l(() => Pt.create(t), [t]), o = l(() => (e?.length ?? 0) * i, [e, i]);
|
|
1930
1923
|
return /* @__PURE__ */ Q(a, {
|
|
1931
1924
|
animate: { backgroundPosition: "0% center" },
|
|
1932
|
-
className:
|
|
1925
|
+
className: K("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", n),
|
|
1933
1926
|
initial: { backgroundPosition: "100% center" },
|
|
1934
1927
|
style: {
|
|
1935
1928
|
"--spread": `${o}px`,
|
|
@@ -1982,7 +1975,7 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1982
1975
|
duration: f
|
|
1983
1976
|
},
|
|
1984
1977
|
children: /* @__PURE__ */ Q(w, {
|
|
1985
|
-
className:
|
|
1978
|
+
className: K("not-prose mb-4", e),
|
|
1986
1979
|
onOpenChange: (e) => {
|
|
1987
1980
|
u(e);
|
|
1988
1981
|
},
|
|
@@ -2001,16 +1994,16 @@ var wi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
2001
1994
|
] }), zi = a(({ className: e, children: t, getThinkingMessage: n = Ri, ...r }) => {
|
|
2002
1995
|
let { isStreaming: i, isOpen: a, duration: o } = Pi();
|
|
2003
1996
|
return /* @__PURE__ */ Q(E, {
|
|
2004
|
-
className:
|
|
1997
|
+
className: K("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", e),
|
|
2005
1998
|
...r,
|
|
2006
1999
|
children: t ?? /* @__PURE__ */ $(Z, { children: [
|
|
2007
|
-
/* @__PURE__ */ Q(
|
|
2000
|
+
/* @__PURE__ */ Q(Fe, { className: "size-4" }),
|
|
2008
2001
|
n(i, o),
|
|
2009
|
-
/* @__PURE__ */ Q(
|
|
2002
|
+
/* @__PURE__ */ Q(ze, { className: K("size-4 transition-transform", a ? "rotate-180" : "rotate-0") })
|
|
2010
2003
|
] })
|
|
2011
2004
|
});
|
|
2012
2005
|
}), Bi = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(T, {
|
|
2013
|
-
className:
|
|
2006
|
+
className: K("mt-4 text-sm", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
2014
2007
|
...n,
|
|
2015
2008
|
children: /* @__PURE__ */ Q(At, { children: t })
|
|
2016
2009
|
}));
|
|
@@ -2018,10 +2011,10 @@ Li.displayName = "Reasoning", zi.displayName = "ReasoningTrigger", Bi.displayNam
|
|
|
2018
2011
|
//#endregion
|
|
2019
2012
|
//#region src/elements/sources.tsx
|
|
2020
2013
|
var Vi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
2021
|
-
className:
|
|
2014
|
+
className: K("not-prose mb-4 text-primary text-xs", e),
|
|
2022
2015
|
...t
|
|
2023
2016
|
}), Hi = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Q(E, {
|
|
2024
|
-
className:
|
|
2017
|
+
className: K("flex items-center gap-2", e),
|
|
2025
2018
|
...r,
|
|
2026
2019
|
children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $("p", {
|
|
2027
2020
|
className: "font-medium",
|
|
@@ -2030,9 +2023,9 @@ var Vi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
|
2030
2023
|
t,
|
|
2031
2024
|
" sources"
|
|
2032
2025
|
]
|
|
2033
|
-
}), /* @__PURE__ */ Q(
|
|
2026
|
+
}), /* @__PURE__ */ Q(ze, { className: "h-4 w-4" })] })
|
|
2034
2027
|
}), Ui = ({ className: e, ...t }) => /* @__PURE__ */ Q(T, {
|
|
2035
|
-
className:
|
|
2028
|
+
className: K("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
2036
2029
|
...t
|
|
2037
2030
|
}), Wi = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Q("a", {
|
|
2038
2031
|
className: "flex items-center gap-2",
|
|
@@ -2040,7 +2033,7 @@ var Vi = ({ className: e, ...t }) => /* @__PURE__ */ Q(w, {
|
|
|
2040
2033
|
rel: "noreferrer",
|
|
2041
2034
|
target: "_blank",
|
|
2042
2035
|
...r,
|
|
2043
|
-
children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(
|
|
2036
|
+
children: n ?? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ Q(Ne, { className: "h-4 w-4" }), /* @__PURE__ */ Q("span", {
|
|
2044
2037
|
className: "block font-medium",
|
|
2045
2038
|
children: t
|
|
2046
2039
|
})] })
|
|
@@ -2193,7 +2186,7 @@ function aa({ health: e }) {
|
|
|
2193
2186
|
children: [
|
|
2194
2187
|
o.length > 0 ? /* @__PURE__ */ $("div", {
|
|
2195
2188
|
className: "flex items-center gap-1.5 text-xs text-emerald-700",
|
|
2196
|
-
children: [/* @__PURE__ */ Q(
|
|
2189
|
+
children: [/* @__PURE__ */ Q(q, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: o.join(" · ") })]
|
|
2197
2190
|
}) : null,
|
|
2198
2191
|
e.seedError ? /* @__PURE__ */ $("div", {
|
|
2199
2192
|
className: "flex items-start gap-1.5 text-xs text-red-600",
|
|
@@ -2205,13 +2198,13 @@ function aa({ health: e }) {
|
|
|
2205
2198
|
}, `e${t}`)),
|
|
2206
2199
|
r.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2207
2200
|
className: "flex items-start gap-1.5 text-xs text-amber-600",
|
|
2208
|
-
children: [/* @__PURE__ */ Q(
|
|
2201
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.message })]
|
|
2209
2202
|
}, `w${t}`))
|
|
2210
2203
|
]
|
|
2211
2204
|
});
|
|
2212
2205
|
}
|
|
2213
|
-
var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt,.csv,.tsv,.xlsx,.xlsm", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: ee = "Approve", toolDenyLabel: P = "Deny", toolDenyReason: F = "User denied the operation", toolDecisions: I, onReviewDraft: te, toolReviewLabel: ne = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: L, onOpenBuiltApp: re, openBuiltAppLabel: ie = "Open app",
|
|
2214
|
-
let
|
|
2206
|
+
var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt,.csv,.tsv,.xlsx,.xlsm", maxFileSize: w = 10 * 1024 * 1024, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: ee = "Approve", toolDenyLabel: P = "Deny", toolDenyReason: F = "User denied the operation", toolDecisions: I, onReviewDraft: te, toolReviewLabel: ne = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: L, onOpenBuiltApp: re, openBuiltAppLabel: ie = "Open app", onDesignBuiltApp: R, designBuiltAppLabel: ae = "Design in Studio", getArtifactAction: oe, onPreviewDraftApp: z, previewDraftLabel: B = "Preview", onDraftArtifacts: V, onBuildMaterialized: H, publishDraftsLabel: se = "Publish", publishedLabel: ce = "Published", verifiedLabel: le = "Verified", nextStepsLabel: ue = "What's next", planTitleLabel: de = "Proposed plan", builderHandoffTitleLabel: fe = "Build this in the Builder", builderHandoffOpenLabel: pe = "Open in Builder →", builderHandoffSupersededTitle: me = "A newer request is available", onOpenBuilder: he, planExtendLabel: ge = "Adding to existing app", planQuestionsLabel: _e = "Confirm before building", planAssumptionsLabel: ve = "Assumptions", planDeferredLabel: ye = "Not yet built", planApproveHintLabel: be = "Reply to approve or adjust this plan.", planApproveLabel: U = "Build it", planAdjustLabel: W = "Adjust", planBuiltLabel: xe = "Built", planBuildingLabel: Se = "Building…", planReadyLabel: Ce = "The plan is ready. Build it now, or tell me what to adjust.", planApproveMessage: we = "Looks good — build it as proposed.", planApproveDefaultsMessage: Te = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: Ee = (e, t) => `For "${e}", go with: ${t}.`, fetchPendingDraftCount: De, autoPublishDrafts: Oe = !1, processVisibility: G = "summary", surface: ke = "card", ...je }, Me) => {
|
|
2207
|
+
let Ne = d ? "streaming" : "ready", Fe = ke === "plain", [Le, Re] = e.useState(null), ze = e.useRef(""), Be = e.useRef(null), J = e.useMemo(() => ({
|
|
2215
2208
|
emptyTitle: E?.emptyTitle ?? "Start a conversation",
|
|
2216
2209
|
emptyDescription: E?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
|
|
2217
2210
|
clear: E?.clear ?? "Clear",
|
|
@@ -2238,54 +2231,54 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2238
2231
|
connectionOfflineLabel: E?.connectionOfflineLabel ?? "Connection lost — reconnecting…",
|
|
2239
2232
|
designingPlanLabel: E?.designingPlanLabel ?? "Designing your app…",
|
|
2240
2233
|
designingPlanHints: E?.designingPlanHints ?? ha
|
|
2241
|
-
}), [E]), [
|
|
2242
|
-
if (
|
|
2243
|
-
let t = await
|
|
2244
|
-
|
|
2234
|
+
}), [E]), [Ve, Ue] = e.useState(() => /* @__PURE__ */ new Set()), [We, Ge] = e.useState(() => /* @__PURE__ */ new Map()), [qe, Ye] = e.useState(() => /* @__PURE__ */ new Map()), et = e.useRef(/* @__PURE__ */ new Set()), tt = e.useCallback(async (e) => {
|
|
2235
|
+
if (De) try {
|
|
2236
|
+
let t = await De(e);
|
|
2237
|
+
Ye((n) => {
|
|
2245
2238
|
if (n.get(e) === t) return n;
|
|
2246
2239
|
let r = new Map(n);
|
|
2247
2240
|
return r.set(e, t), r;
|
|
2248
2241
|
});
|
|
2249
2242
|
} catch {}
|
|
2250
|
-
}, [
|
|
2243
|
+
}, [De]);
|
|
2251
2244
|
e.useEffect(() => {
|
|
2252
|
-
if (!
|
|
2245
|
+
if (!De || d) return;
|
|
2253
2246
|
let e = /* @__PURE__ */ new Set();
|
|
2254
2247
|
for (let t of n) for (let n of t.toolInvocations ?? []) {
|
|
2255
2248
|
let t = n.draftReview?.packageId, r = n.toolCallId;
|
|
2256
|
-
t && r && !
|
|
2249
|
+
t && r && !et.current.has(r) && (et.current.add(r), e.add(t));
|
|
2257
2250
|
}
|
|
2258
|
-
for (let t of e)
|
|
2251
|
+
for (let t of e) tt(t);
|
|
2259
2252
|
}, [
|
|
2260
2253
|
n,
|
|
2261
2254
|
d,
|
|
2262
|
-
|
|
2263
|
-
|
|
2255
|
+
De,
|
|
2256
|
+
tt
|
|
2264
2257
|
]);
|
|
2265
|
-
let
|
|
2258
|
+
let rt = e.useCallback(async (e) => {
|
|
2266
2259
|
if (!L) return;
|
|
2267
2260
|
let t = [];
|
|
2268
2261
|
for (let r of n) for (let n of r.toolInvocations ?? []) n.draftReview?.packageId === e && n.toolCallId && t.push(n.toolCallId);
|
|
2269
2262
|
let r = await L(e), i = r && typeof r == "object" ? r : void 0;
|
|
2270
2263
|
if ((i ? i.ok !== !1 : r !== !1) && t.length > 0) {
|
|
2271
|
-
|
|
2264
|
+
Ue((e) => {
|
|
2272
2265
|
let n = new Set(e);
|
|
2273
2266
|
for (let e of t) n.add(e);
|
|
2274
2267
|
return n;
|
|
2275
2268
|
});
|
|
2276
2269
|
let e = i?.health;
|
|
2277
|
-
e &&
|
|
2270
|
+
e && Ge((n) => {
|
|
2278
2271
|
let r = new Map(n);
|
|
2279
2272
|
for (let n of t) r.set(n, e);
|
|
2280
2273
|
return r;
|
|
2281
2274
|
});
|
|
2282
2275
|
}
|
|
2283
|
-
|
|
2276
|
+
tt(e);
|
|
2284
2277
|
}, [
|
|
2285
2278
|
L,
|
|
2286
2279
|
n,
|
|
2287
|
-
|
|
2288
|
-
]),
|
|
2280
|
+
tt
|
|
2281
|
+
]), it = e.useRef(/* @__PURE__ */ new Set()), at = e.useRef(!1);
|
|
2289
2282
|
e.useEffect(() => {
|
|
2290
2283
|
let e = [];
|
|
2291
2284
|
for (let t of n) for (let n of t.toolInvocations ?? []) {
|
|
@@ -2295,27 +2288,27 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2295
2288
|
packageId: t.packageId
|
|
2296
2289
|
});
|
|
2297
2290
|
}
|
|
2298
|
-
if (
|
|
2299
|
-
|
|
2300
|
-
for (let t of e)
|
|
2291
|
+
if (!at.current) {
|
|
2292
|
+
at.current = !0;
|
|
2293
|
+
for (let t of e) it.current.add(t.key);
|
|
2301
2294
|
return;
|
|
2302
2295
|
}
|
|
2303
|
-
if (!
|
|
2304
|
-
let t = e.filter((e) => !
|
|
2296
|
+
if (!Oe || !L || d) return;
|
|
2297
|
+
let t = e.filter((e) => !it.current.has(e.key));
|
|
2305
2298
|
if (t.length !== 0) {
|
|
2306
|
-
for (let e of t)
|
|
2307
|
-
for (let e of [...new Set(t.map((e) => e.packageId))])
|
|
2299
|
+
for (let e of t) it.current.add(e.key);
|
|
2300
|
+
for (let e of [...new Set(t.map((e) => e.packageId))]) rt(e);
|
|
2308
2301
|
}
|
|
2309
2302
|
}, [
|
|
2310
2303
|
n,
|
|
2311
2304
|
d,
|
|
2312
|
-
|
|
2305
|
+
Oe,
|
|
2313
2306
|
L,
|
|
2314
|
-
|
|
2307
|
+
rt
|
|
2315
2308
|
]);
|
|
2316
|
-
let
|
|
2309
|
+
let ot = e.useRef(/* @__PURE__ */ new Set());
|
|
2317
2310
|
e.useEffect(() => {
|
|
2318
|
-
if (!
|
|
2311
|
+
if (!V) return;
|
|
2319
2312
|
let e = /* @__PURE__ */ new Map(), t;
|
|
2320
2313
|
for (let r of n) {
|
|
2321
2314
|
for (let t of r.buildProgress?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
|
|
@@ -2325,47 +2318,57 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2325
2318
|
r?.packageId && r.items?.some((e) => e.type === "app") && (t = r.packageId);
|
|
2326
2319
|
}
|
|
2327
2320
|
}
|
|
2328
|
-
let r =
|
|
2321
|
+
let r = ot.current, i = !1;
|
|
2329
2322
|
for (let t of e.keys()) r.has(t) || (r.add(t), i = !0);
|
|
2330
|
-
i &&
|
|
2331
|
-
}, [n,
|
|
2332
|
-
let
|
|
2323
|
+
i && V([...e.values()], t);
|
|
2324
|
+
}, [n, V]);
|
|
2325
|
+
let st = e.useRef(/* @__PURE__ */ new Set());
|
|
2333
2326
|
e.useEffect(() => {
|
|
2334
|
-
if (
|
|
2327
|
+
if (H) for (let e of n) for (let t of e.toolInvocations ?? []) {
|
|
2335
2328
|
let e = t.draftReview;
|
|
2336
2329
|
if (!e?.materialized || !t.toolCallId) continue;
|
|
2337
2330
|
let n = e.items.find((e) => e.type === "app");
|
|
2338
|
-
!n ||
|
|
2331
|
+
!n || st.current.has(t.toolCallId) || (st.current.add(t.toolCallId), H(n.name));
|
|
2339
2332
|
}
|
|
2340
|
-
}, [n,
|
|
2341
|
-
let
|
|
2333
|
+
}, [n, H]);
|
|
2334
|
+
let ct = e.useCallback((e) => {
|
|
2342
2335
|
let t = !!e.text?.trim(), n = e.files?.map((e) => e.file).filter(Boolean), r = !!(n && n.length > 0);
|
|
2343
2336
|
if (!(t || r)) return;
|
|
2344
2337
|
let a = e.text?.trim() ?? "";
|
|
2345
|
-
|
|
2346
|
-
}, [i]),
|
|
2347
|
-
i?.(e);
|
|
2348
|
-
}, [i]),
|
|
2349
|
-
|
|
2338
|
+
ze.current = a, Be.current = null, Y.current = null, i?.(a, n);
|
|
2339
|
+
}, [i]), dt = e.useCallback((e) => {
|
|
2340
|
+
Y.current = null, i?.(e);
|
|
2341
|
+
}, [i]), mt = e.useRef(null), [_t, vt] = e.useState(() => /* @__PURE__ */ new Set()), Y = e.useRef(null), yt = e.useCallback((e, t) => {
|
|
2342
|
+
t && (Y.current = t, vt((e) => {
|
|
2343
|
+
let n = new Set(e);
|
|
2344
|
+
return n.add(t), n;
|
|
2345
|
+
})), i?.(e ? Te : we);
|
|
2350
2346
|
}, [
|
|
2351
2347
|
i,
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
]),
|
|
2355
|
-
let e =
|
|
2348
|
+
we,
|
|
2349
|
+
Te
|
|
2350
|
+
]), bt = e.useCallback(() => {
|
|
2351
|
+
let e = mt.current?.querySelector("textarea");
|
|
2356
2352
|
e && (e.focus(), e.scrollIntoView({ block: "nearest" }));
|
|
2357
2353
|
}, []);
|
|
2358
2354
|
e.useEffect(() => {
|
|
2359
|
-
if (!f || !Xn(f) ||
|
|
2360
|
-
|
|
2361
|
-
|
|
2355
|
+
if (!f || !Xn(f) || Be.current === f) return;
|
|
2356
|
+
if (Be.current = f, Y.current) {
|
|
2357
|
+
let e = Y.current;
|
|
2358
|
+
Y.current = null, vt((t) => {
|
|
2359
|
+
if (!t.has(e)) return t;
|
|
2360
|
+
let n = new Set(t);
|
|
2361
|
+
return n.delete(e), n;
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
let e = ze.current;
|
|
2362
2365
|
if (!e) return;
|
|
2363
|
-
let t =
|
|
2366
|
+
let t = mt.current?.querySelector("textarea");
|
|
2364
2367
|
t && t.value.trim() === "" && (t.value = e, t.dispatchEvent(new Event("input", { bubbles: !0 })), t.focus());
|
|
2365
2368
|
}, [f]);
|
|
2366
|
-
let
|
|
2367
|
-
navigator.clipboard?.writeText(e.content),
|
|
2368
|
-
}, []),
|
|
2369
|
+
let xt = e.useCallback((e) => {
|
|
2370
|
+
navigator.clipboard?.writeText(e.content), Re(e.id), window.setTimeout(() => Re((t) => t === e.id ? null : t), 1500);
|
|
2371
|
+
}, []), St = e.useMemo(() => {
|
|
2369
2372
|
let e = /* @__PURE__ */ new Set(), t = [], r = -1, i = 0;
|
|
2370
2373
|
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan || Qi(n)) && n.toolCallId && t.push({
|
|
2371
2374
|
id: n.toolCallId,
|
|
@@ -2373,11 +2376,11 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2373
2376
|
}), n.toolName === "apply_blueprint" && (r = i), i += 1;
|
|
2374
2377
|
for (let n of t) n.order < r && e.add(n.id);
|
|
2375
2378
|
return e;
|
|
2376
|
-
}, [n]),
|
|
2379
|
+
}, [n]), Ct = e.useMemo(() => {
|
|
2377
2380
|
let e;
|
|
2378
2381
|
for (let t of n) for (let n of t.toolInvocations ?? []) n.builderHandoff && n.toolCallId && (e = n.toolCallId);
|
|
2379
2382
|
return e;
|
|
2380
|
-
}, [n]),
|
|
2383
|
+
}, [n]), Tt = e.useMemo(() => {
|
|
2381
2384
|
let e = /* @__PURE__ */ new Set(), t = [], r = /* @__PURE__ */ new Map(), i = 0;
|
|
2382
2385
|
for (let e of n) for (let n of e.toolInvocations ?? []) n.proposedChanges && n.toolCallId ? t.push({
|
|
2383
2386
|
id: n.toolCallId,
|
|
@@ -2389,8 +2392,8 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2389
2392
|
t !== void 0 && t > n.order && e.add(n.id);
|
|
2390
2393
|
}
|
|
2391
2394
|
return e;
|
|
2392
|
-
}, [n]),
|
|
2393
|
-
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = I?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = Gn(e.toolName), c = Kn(e.result), l =
|
|
2395
|
+
}, [n]), Et = (e) => {
|
|
2396
|
+
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = I?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = Gn(e.toolName), c = Kn(e.result), l = G === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = G === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : qe.get(d), p = f === void 0 ? Ve.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = t === "output-available" && Ji(e.result) ? "approval-requested" : t, g = /* @__PURE__ */ $("span", {
|
|
2394
2397
|
className: "inline-flex min-w-0 items-center gap-2",
|
|
2395
2398
|
children: [
|
|
2396
2399
|
/* @__PURE__ */ Q("span", { children: s || e.toolName }),
|
|
@@ -2399,10 +2402,10 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2399
2402
|
children: e.toolName
|
|
2400
2403
|
}) : null,
|
|
2401
2404
|
m ? Zi(e) ? /* @__PURE__ */ Q(va, {
|
|
2402
|
-
label:
|
|
2403
|
-
hints:
|
|
2404
|
-
offlineLabel:
|
|
2405
|
-
}) : /* @__PURE__ */ Q(ya, { offlineLabel:
|
|
2405
|
+
label: J.designingPlanLabel,
|
|
2406
|
+
hints: J.designingPlanHints,
|
|
2407
|
+
offlineLabel: J.connectionOfflineLabel
|
|
2408
|
+
}) : /* @__PURE__ */ Q(ya, { offlineLabel: J.connectionOfflineLabel }) : null
|
|
2406
2409
|
]
|
|
2407
2410
|
});
|
|
2408
2411
|
return /* @__PURE__ */ $(Ei, {
|
|
@@ -2445,18 +2448,18 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2445
2448
|
L && e.draftReview.packageId ? p ? /* @__PURE__ */ $("span", {
|
|
2446
2449
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700",
|
|
2447
2450
|
children: [
|
|
2448
|
-
/* @__PURE__ */ Q(
|
|
2449
|
-
|
|
2451
|
+
/* @__PURE__ */ Q(q, { className: "size-3.5" }),
|
|
2452
|
+
ce,
|
|
2450
2453
|
e.draftReview.failedCount ? ` · ${e.draftReview.failedCount} need${e.draftReview.failedCount === 1 ? "s" : ""} attention` : ""
|
|
2451
2454
|
]
|
|
2452
2455
|
}) : /* @__PURE__ */ $("button", {
|
|
2453
2456
|
type: "button",
|
|
2454
|
-
onClick: () => void
|
|
2457
|
+
onClick: () => void rt(e.draftReview.packageId),
|
|
2455
2458
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2456
2459
|
"data-testid": "draft-publish",
|
|
2457
2460
|
children: [
|
|
2458
|
-
/* @__PURE__ */ Q(
|
|
2459
|
-
|
|
2461
|
+
/* @__PURE__ */ Q(ut, { className: "size-3.5" }),
|
|
2462
|
+
se,
|
|
2460
2463
|
typeof f == "number" && f > 0 ? ` (${f})` : ""
|
|
2461
2464
|
]
|
|
2462
2465
|
}) : null,
|
|
@@ -2464,29 +2467,29 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2464
2467
|
type: "button",
|
|
2465
2468
|
onClick: () => te(e.draftReview.items),
|
|
2466
2469
|
className: L && e.draftReview.packageId ? "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted" : "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2467
|
-
children: [/* @__PURE__ */ Q(
|
|
2470
|
+
children: [/* @__PURE__ */ Q(Ze, { className: "size-3.5" }), ne(e.draftReview.items.length)]
|
|
2468
2471
|
}) : null,
|
|
2469
|
-
|
|
2472
|
+
z && !p ? (() => {
|
|
2470
2473
|
let t = e.draftReview.items.find((e) => e.type === "app");
|
|
2471
2474
|
return t ? /* @__PURE__ */ $("button", {
|
|
2472
2475
|
type: "button",
|
|
2473
|
-
onClick: () =>
|
|
2476
|
+
onClick: () => z(t.name, {
|
|
2474
2477
|
materialized: e.draftReview.materialized === !0,
|
|
2475
2478
|
appSegment: e.draftReview.packageId
|
|
2476
2479
|
}),
|
|
2477
2480
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
|
|
2478
2481
|
"data-testid": "draft-preview-app",
|
|
2479
|
-
children: [/* @__PURE__ */ Q(
|
|
2482
|
+
children: [/* @__PURE__ */ Q(Xe, { className: "size-3.5" }), B]
|
|
2480
2483
|
}) : null;
|
|
2481
2484
|
})() : null,
|
|
2482
2485
|
e.draftReview.verification ? e.draftReview.verification.errors > 0 ? /* @__PURE__ */ $("span", {
|
|
2483
2486
|
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-200 bg-amber-50 px-2.5 text-xs font-medium text-amber-700",
|
|
2484
2487
|
"data-testid": "draft-verification-chip",
|
|
2485
|
-
children: [/* @__PURE__ */ Q(
|
|
2488
|
+
children: [/* @__PURE__ */ Q(gt, { className: "size-3.5" }), `${e.draftReview.verification.errors} issue${e.draftReview.verification.errors === 1 ? "" : "s"}`]
|
|
2486
2489
|
}) : /* @__PURE__ */ $("span", {
|
|
2487
2490
|
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-2.5 text-xs font-medium text-emerald-700",
|
|
2488
2491
|
"data-testid": "draft-verification-chip",
|
|
2489
|
-
children: [/* @__PURE__ */ Q(
|
|
2492
|
+
children: [/* @__PURE__ */ Q(ft, { className: "size-3.5" }), le]
|
|
2490
2493
|
}) : null,
|
|
2491
2494
|
e.draftReview.summary ? /* @__PURE__ */ Q("span", {
|
|
2492
2495
|
className: "min-w-0 flex-1 truncate text-xs text-muted-foreground",
|
|
@@ -2502,16 +2505,16 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2502
2505
|
children: [/* @__PURE__ */ Q(X, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.fix ? `${e.message} — ${e.fix}` : e.message })]
|
|
2503
2506
|
}, `e${t}`)), e.draftReview.issues.filter((e) => e.severity !== "error").map((e, t) => /* @__PURE__ */ $("div", {
|
|
2504
2507
|
className: "flex items-start gap-1.5 text-xs text-amber-600",
|
|
2505
|
-
children: [/* @__PURE__ */ Q(
|
|
2508
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Q("span", { children: e.message })]
|
|
2506
2509
|
}, `w${t}`))]
|
|
2507
2510
|
}) : null,
|
|
2508
|
-
|
|
2511
|
+
Ve.has(e.toolCallId) ? /* @__PURE__ */ Q(aa, { health: We.get(e.toolCallId) }) : null,
|
|
2509
2512
|
e.draftReview.nextSteps && e.draftReview.nextSteps.length > 0 ? /* @__PURE__ */ $("div", {
|
|
2510
2513
|
className: "flex flex-col gap-1 border-t bg-muted/20 px-3 py-2",
|
|
2511
2514
|
"data-testid": "draft-next-steps",
|
|
2512
2515
|
children: [/* @__PURE__ */ Q("span", {
|
|
2513
2516
|
className: "text-xs font-medium text-foreground/80",
|
|
2514
|
-
children:
|
|
2517
|
+
children: ue
|
|
2515
2518
|
}), e.draftReview.nextSteps.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2516
2519
|
className: "flex items-start gap-1.5 text-xs text-muted-foreground",
|
|
2517
2520
|
children: [/* @__PURE__ */ Q("span", {
|
|
@@ -2527,22 +2530,22 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2527
2530
|
children: [
|
|
2528
2531
|
/* @__PURE__ */ $("span", {
|
|
2529
2532
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2530
|
-
children: [/* @__PURE__ */ Q(
|
|
2533
|
+
children: [/* @__PURE__ */ Q(pt, { className: "size-3.5" }), fe]
|
|
2531
2534
|
}),
|
|
2532
2535
|
/* @__PURE__ */ Q("p", {
|
|
2533
2536
|
className: "text-xs text-muted-foreground",
|
|
2534
2537
|
children: e.builderHandoff.prompt
|
|
2535
2538
|
}),
|
|
2536
2539
|
(() => {
|
|
2537
|
-
let t = !!
|
|
2540
|
+
let t = !!Ct && e.toolCallId !== Ct;
|
|
2538
2541
|
return /* @__PURE__ */ Q("button", {
|
|
2539
2542
|
type: "button",
|
|
2540
|
-
onClick: () =>
|
|
2541
|
-
disabled: !
|
|
2543
|
+
onClick: () => he?.(e.builderHandoff),
|
|
2544
|
+
disabled: !he || t,
|
|
2542
2545
|
"data-testid": t ? "builder-handoff-superseded" : "builder-handoff-open",
|
|
2543
|
-
title: t ?
|
|
2546
|
+
title: t ? me : void 0,
|
|
2544
2547
|
className: "inline-flex w-fit items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2545
|
-
children:
|
|
2548
|
+
children: pe
|
|
2546
2549
|
});
|
|
2547
2550
|
})()
|
|
2548
2551
|
]
|
|
@@ -2553,14 +2556,14 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2553
2556
|
children: [
|
|
2554
2557
|
/* @__PURE__ */ $("span", {
|
|
2555
2558
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2556
|
-
children: [/* @__PURE__ */ Q(
|
|
2559
|
+
children: [/* @__PURE__ */ Q(He, { className: "size-3.5" }), de]
|
|
2557
2560
|
}),
|
|
2558
2561
|
e.proposedPlan.targetApp ? /* @__PURE__ */ $("span", {
|
|
2559
2562
|
className: "inline-flex w-fit items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-[11px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300",
|
|
2560
2563
|
"data-testid": "proposed-plan-extend",
|
|
2561
2564
|
children: [
|
|
2562
2565
|
"+ ",
|
|
2563
|
-
|
|
2566
|
+
ge,
|
|
2564
2567
|
" 「",
|
|
2565
2568
|
e.proposedPlan.targetApp,
|
|
2566
2569
|
"」"
|
|
@@ -2576,7 +2579,7 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2576
2579
|
className: "inline-flex items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80",
|
|
2577
2580
|
title: e.name,
|
|
2578
2581
|
children: [
|
|
2579
|
-
/* @__PURE__ */ Q(
|
|
2582
|
+
/* @__PURE__ */ Q(ht, { className: "size-3 text-foreground/40" }),
|
|
2580
2583
|
e.label || e.name,
|
|
2581
2584
|
e.fieldCount > 0 ? /* @__PURE__ */ $("span", {
|
|
2582
2585
|
className: "text-foreground/40",
|
|
@@ -2599,7 +2602,7 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2599
2602
|
"data-testid": "proposed-plan-assumptions",
|
|
2600
2603
|
children: [/* @__PURE__ */ Q("span", {
|
|
2601
2604
|
className: "text-[11px] font-medium text-foreground/70",
|
|
2602
|
-
children:
|
|
2605
|
+
children: ve
|
|
2603
2606
|
}), t.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2604
2607
|
className: "flex items-start gap-1.5 text-[11px] text-muted-foreground",
|
|
2605
2608
|
children: [/* @__PURE__ */ Q("span", {
|
|
@@ -2612,7 +2615,7 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2612
2615
|
"data-testid": "proposed-plan-deferred",
|
|
2613
2616
|
children: [/* @__PURE__ */ $("span", {
|
|
2614
2617
|
className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
|
|
2615
|
-
children: [/* @__PURE__ */ Q(
|
|
2618
|
+
children: [/* @__PURE__ */ Q($e, { className: "size-3.5" }), ye]
|
|
2616
2619
|
}), n.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2617
2620
|
className: "flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90",
|
|
2618
2621
|
children: [/* @__PURE__ */ Q("span", {
|
|
@@ -2627,7 +2630,7 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2627
2630
|
"data-testid": "proposed-plan-questions",
|
|
2628
2631
|
children: [/* @__PURE__ */ $("span", {
|
|
2629
2632
|
className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
|
|
2630
|
-
children: [/* @__PURE__ */ Q(
|
|
2633
|
+
children: [/* @__PURE__ */ Q(Qe, { className: "size-3.5" }), _e]
|
|
2631
2634
|
}), e.proposedPlan.questions.map((t, n) => {
|
|
2632
2635
|
let r = e.proposedPlan.questionChoices?.find((e) => e.text === t);
|
|
2633
2636
|
return /* @__PURE__ */ $("div", {
|
|
@@ -2643,7 +2646,7 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2643
2646
|
"data-testid": "proposed-plan-choice",
|
|
2644
2647
|
children: r.options.map((e, n) => /* @__PURE__ */ Q("button", {
|
|
2645
2648
|
type: "button",
|
|
2646
|
-
onClick: () => i(
|
|
2649
|
+
onClick: () => i(Ee(t, e)),
|
|
2647
2650
|
className: "inline-flex h-6 items-center rounded-full border border-amber-300 bg-background px-2 text-[11px] font-medium text-amber-900 hover:bg-amber-100 dark:border-amber-800 dark:text-amber-200 dark:hover:bg-amber-900/40",
|
|
2648
2651
|
children: e
|
|
2649
2652
|
}, n))
|
|
@@ -2651,33 +2654,41 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2651
2654
|
}, n);
|
|
2652
2655
|
})]
|
|
2653
2656
|
}) : null,
|
|
2654
|
-
i ?
|
|
2657
|
+
i ? St.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
2655
2658
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2656
2659
|
"data-testid": "proposed-plan-actions",
|
|
2657
2660
|
children: /* @__PURE__ */ $("span", {
|
|
2658
2661
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2659
2662
|
"data-testid": "proposed-plan-built",
|
|
2660
|
-
children: [/* @__PURE__ */ Q(
|
|
2663
|
+
children: [/* @__PURE__ */ Q(q, { className: "size-3.5" }), xe]
|
|
2664
|
+
})
|
|
2665
|
+
}) : _t.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
2666
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2667
|
+
"data-testid": "proposed-plan-actions",
|
|
2668
|
+
children: /* @__PURE__ */ $("span", {
|
|
2669
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border bg-muted/40 px-3 text-xs font-medium text-muted-foreground",
|
|
2670
|
+
"data-testid": "proposed-plan-building",
|
|
2671
|
+
children: [/* @__PURE__ */ Q(nt, { className: "size-3.5 animate-spin" }), Se]
|
|
2661
2672
|
})
|
|
2662
2673
|
}) : /* @__PURE__ */ $("div", {
|
|
2663
2674
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2664
2675
|
"data-testid": "proposed-plan-actions",
|
|
2665
2676
|
children: [/* @__PURE__ */ $("button", {
|
|
2666
2677
|
type: "button",
|
|
2667
|
-
onClick: () =>
|
|
2678
|
+
onClick: () => yt(e.proposedPlan.questions.length > 0, e.toolCallId),
|
|
2668
2679
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2669
2680
|
"data-testid": "proposed-plan-approve",
|
|
2670
|
-
children: [/* @__PURE__ */ Q(
|
|
2681
|
+
children: [/* @__PURE__ */ Q(ut, { className: "size-3.5" }), U]
|
|
2671
2682
|
}), /* @__PURE__ */ Q("button", {
|
|
2672
2683
|
type: "button",
|
|
2673
|
-
onClick:
|
|
2684
|
+
onClick: bt,
|
|
2674
2685
|
className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
|
|
2675
2686
|
"data-testid": "proposed-plan-adjust",
|
|
2676
|
-
children:
|
|
2687
|
+
children: W
|
|
2677
2688
|
})]
|
|
2678
2689
|
}) : /* @__PURE__ */ Q("span", {
|
|
2679
2690
|
className: "text-[11px] italic text-muted-foreground/80",
|
|
2680
|
-
children:
|
|
2691
|
+
children: be
|
|
2681
2692
|
})
|
|
2682
2693
|
]
|
|
2683
2694
|
}) : null,
|
|
@@ -2687,39 +2698,47 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2687
2698
|
children: [
|
|
2688
2699
|
/* @__PURE__ */ $("span", {
|
|
2689
2700
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2690
|
-
children: [/* @__PURE__ */ Q(
|
|
2701
|
+
children: [/* @__PURE__ */ Q(He, { className: "size-3.5" }), de]
|
|
2691
2702
|
}),
|
|
2692
2703
|
/* @__PURE__ */ Q("p", {
|
|
2693
2704
|
className: "text-xs text-muted-foreground",
|
|
2694
|
-
children:
|
|
2705
|
+
children: Ce
|
|
2695
2706
|
}),
|
|
2696
|
-
i ?
|
|
2707
|
+
i ? St.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
2697
2708
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2698
2709
|
"data-testid": "proposed-plan-actions",
|
|
2699
2710
|
children: /* @__PURE__ */ $("span", {
|
|
2700
2711
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2701
2712
|
"data-testid": "proposed-plan-built",
|
|
2702
|
-
children: [/* @__PURE__ */ Q(
|
|
2713
|
+
children: [/* @__PURE__ */ Q(q, { className: "size-3.5" }), xe]
|
|
2714
|
+
})
|
|
2715
|
+
}) : _t.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
2716
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2717
|
+
"data-testid": "proposed-plan-actions",
|
|
2718
|
+
children: /* @__PURE__ */ $("span", {
|
|
2719
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border bg-muted/40 px-3 text-xs font-medium text-muted-foreground",
|
|
2720
|
+
"data-testid": "proposed-plan-building",
|
|
2721
|
+
children: [/* @__PURE__ */ Q(nt, { className: "size-3.5 animate-spin" }), Se]
|
|
2703
2722
|
})
|
|
2704
2723
|
}) : /* @__PURE__ */ $("div", {
|
|
2705
2724
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2706
2725
|
"data-testid": "proposed-plan-actions",
|
|
2707
2726
|
children: [/* @__PURE__ */ $("button", {
|
|
2708
2727
|
type: "button",
|
|
2709
|
-
onClick: () =>
|
|
2728
|
+
onClick: () => yt(!1, e.toolCallId),
|
|
2710
2729
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2711
2730
|
"data-testid": "proposed-plan-approve",
|
|
2712
|
-
children: [/* @__PURE__ */ Q(
|
|
2731
|
+
children: [/* @__PURE__ */ Q(ut, { className: "size-3.5" }), U]
|
|
2713
2732
|
}), /* @__PURE__ */ Q("button", {
|
|
2714
2733
|
type: "button",
|
|
2715
|
-
onClick:
|
|
2734
|
+
onClick: bt,
|
|
2716
2735
|
className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
|
|
2717
2736
|
"data-testid": "proposed-plan-adjust",
|
|
2718
|
-
children:
|
|
2737
|
+
children: W
|
|
2719
2738
|
})]
|
|
2720
2739
|
}) : /* @__PURE__ */ Q("span", {
|
|
2721
2740
|
className: "text-[11px] italic text-muted-foreground/80",
|
|
2722
|
-
children:
|
|
2741
|
+
children: be
|
|
2723
2742
|
})
|
|
2724
2743
|
]
|
|
2725
2744
|
}) : null,
|
|
@@ -2729,7 +2748,7 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2729
2748
|
children: [
|
|
2730
2749
|
/* @__PURE__ */ $("span", {
|
|
2731
2750
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2732
|
-
children: [/* @__PURE__ */ Q(
|
|
2751
|
+
children: [/* @__PURE__ */ Q(He, { className: "size-3.5" }), "确认改动"]
|
|
2733
2752
|
}),
|
|
2734
2753
|
e.proposedChanges.summary ? /* @__PURE__ */ Q("p", {
|
|
2735
2754
|
className: "text-xs text-muted-foreground",
|
|
@@ -2739,16 +2758,16 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2739
2758
|
className: "flex flex-col gap-1",
|
|
2740
2759
|
children: e.proposedChanges.changes.map((e, t) => /* @__PURE__ */ $("div", {
|
|
2741
2760
|
className: "flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80",
|
|
2742
|
-
children: [/* @__PURE__ */ Q(
|
|
2761
|
+
children: [/* @__PURE__ */ Q(ht, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Q("span", { children: Xi(e) })]
|
|
2743
2762
|
}, t))
|
|
2744
2763
|
}),
|
|
2745
|
-
i ?
|
|
2764
|
+
i ? Tt.has(e.toolCallId) ? /* @__PURE__ */ Q("div", {
|
|
2746
2765
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2747
2766
|
"data-testid": "proposed-changes-actions",
|
|
2748
2767
|
children: /* @__PURE__ */ $("span", {
|
|
2749
2768
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2750
2769
|
"data-testid": "proposed-changes-confirmed",
|
|
2751
|
-
children: [/* @__PURE__ */ Q(
|
|
2770
|
+
children: [/* @__PURE__ */ Q(q, { className: "size-3.5" }), "已确认"]
|
|
2752
2771
|
})
|
|
2753
2772
|
}) : /* @__PURE__ */ $("div", {
|
|
2754
2773
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
@@ -2758,10 +2777,10 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2758
2777
|
onClick: () => i("确认修改,应用你刚才提议的改动。"),
|
|
2759
2778
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2760
2779
|
"data-testid": "proposed-changes-confirm",
|
|
2761
|
-
children: [/* @__PURE__ */ Q(
|
|
2780
|
+
children: [/* @__PURE__ */ Q(q, { className: "size-3.5" }), "确认修改"]
|
|
2762
2781
|
}), /* @__PURE__ */ Q("button", {
|
|
2763
2782
|
type: "button",
|
|
2764
|
-
onClick:
|
|
2783
|
+
onClick: bt,
|
|
2765
2784
|
className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
|
|
2766
2785
|
"data-testid": "proposed-changes-adjust",
|
|
2767
2786
|
children: "调整"
|
|
@@ -2776,28 +2795,28 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2776
2795
|
}, e.toolCallId);
|
|
2777
2796
|
};
|
|
2778
2797
|
return /* @__PURE__ */ $("div", {
|
|
2779
|
-
ref:
|
|
2780
|
-
className:
|
|
2798
|
+
ref: Me,
|
|
2799
|
+
className: K(Fe ? "flex min-h-0 flex-col overflow-hidden bg-background" : "flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background", t),
|
|
2781
2800
|
style: { maxHeight: b },
|
|
2782
|
-
...
|
|
2801
|
+
...je,
|
|
2783
2802
|
children: [
|
|
2784
2803
|
a && !y && n.length > 0 && /* @__PURE__ */ Q("div", {
|
|
2785
|
-
className:
|
|
2804
|
+
className: K("flex items-center justify-end px-4 py-2", Fe ? "bg-background" : "border-b bg-muted/30"),
|
|
2786
2805
|
children: /* @__PURE__ */ Q("button", {
|
|
2787
2806
|
type: "button",
|
|
2788
2807
|
onClick: a,
|
|
2789
2808
|
className: "text-xs text-muted-foreground hover:text-foreground transition-colors",
|
|
2790
|
-
children:
|
|
2809
|
+
children: J.clear
|
|
2791
2810
|
})
|
|
2792
2811
|
}),
|
|
2793
2812
|
A ? /* @__PURE__ */ Q("div", {
|
|
2794
|
-
className:
|
|
2813
|
+
className: K("shrink-0", !Fe && "border-b bg-background/50"),
|
|
2795
2814
|
children: A
|
|
2796
2815
|
}) : null,
|
|
2797
2816
|
/* @__PURE__ */ $($n, {
|
|
2798
2817
|
className: "flex-1 min-h-0",
|
|
2799
2818
|
children: [/* @__PURE__ */ $(er, {
|
|
2800
|
-
className:
|
|
2819
|
+
className: K("space-y-4", Fe ? "mx-auto w-full max-w-2xl px-4 py-8 sm:px-0" : "px-4 py-3"),
|
|
2801
2820
|
children: [n.length === 0 ? /* @__PURE__ */ $(tr, {
|
|
2802
2821
|
className: "gap-3 px-0 py-8",
|
|
2803
2822
|
children: [
|
|
@@ -2807,16 +2826,16 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2807
2826
|
src: _,
|
|
2808
2827
|
alt: "",
|
|
2809
2828
|
className: "size-full rounded-md object-cover"
|
|
2810
|
-
}) : /* @__PURE__ */ Q(
|
|
2829
|
+
}) : /* @__PURE__ */ Q(Pe, { className: "size-4" })
|
|
2811
2830
|
}),
|
|
2812
2831
|
/* @__PURE__ */ $("div", {
|
|
2813
2832
|
className: "w-full max-w-full space-y-1",
|
|
2814
2833
|
children: [/* @__PURE__ */ Q("h3", {
|
|
2815
2834
|
className: "text-sm font-medium text-foreground/90 break-words",
|
|
2816
|
-
children:
|
|
2835
|
+
children: J.emptyTitle
|
|
2817
2836
|
}), /* @__PURE__ */ Q("p", {
|
|
2818
2837
|
className: "text-sm text-muted-foreground break-words",
|
|
2819
|
-
children:
|
|
2838
|
+
children: J.emptyDescription
|
|
2820
2839
|
})]
|
|
2821
2840
|
}),
|
|
2822
2841
|
T && T.length > 0 ? /* @__PURE__ */ Q("div", {
|
|
@@ -2824,58 +2843,62 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2824
2843
|
children: T.map((e) => /* @__PURE__ */ Q(bi, {
|
|
2825
2844
|
className: "h-auto min-h-8 min-w-0 max-w-full whitespace-normal break-words rounded-full border-border/60 bg-background/80 px-3 py-1 text-left text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
|
|
2826
2845
|
suggestion: e,
|
|
2827
|
-
onClick:
|
|
2846
|
+
onClick: dt
|
|
2828
2847
|
}, e))
|
|
2829
2848
|
}) : null
|
|
2830
2849
|
]
|
|
2831
2850
|
}) : n.map((e) => {
|
|
2832
|
-
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t &&
|
|
2851
|
+
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && G === "summary" ? n.filter((e) => !ta(e) && !(o && e.toolName === "propose_blueprint")) : [], l = !t && G === "debug" ? n : !t && G !== "debug" ? n.filter(ta) : [], u = !t && e.content.trim().length > 0 && !ra(e.content), d = G === "debug" && !!r, f = !t && !!e.streaming && !u && c.length === 0 && l.length === 0 && !d && !a && !o;
|
|
2833
2852
|
return /* @__PURE__ */ Q(or, {
|
|
2834
2853
|
from: Ki(e.role),
|
|
2835
2854
|
children: /* @__PURE__ */ $("div", {
|
|
2836
|
-
className:
|
|
2855
|
+
className: K("flex w-full gap-2.5", m ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
|
|
2837
2856
|
children: [m ? /* @__PURE__ */ Q(sa, {
|
|
2838
2857
|
isUser: t,
|
|
2839
2858
|
url: t ? h : _,
|
|
2840
2859
|
fallback: t ? g : v
|
|
2841
2860
|
}) : null, /* @__PURE__ */ $("div", {
|
|
2842
|
-
className:
|
|
2861
|
+
className: K("flex min-w-0 flex-col gap-2", m && !t && "flex-1"),
|
|
2843
2862
|
children: [/* @__PURE__ */ $(sr, { children: [
|
|
2844
2863
|
o ? /* @__PURE__ */ Q(Sa, {
|
|
2845
2864
|
progress: o,
|
|
2846
|
-
designingLabel:
|
|
2847
|
-
extendLabel:
|
|
2848
|
-
waitingLabel:
|
|
2849
|
-
stalledLabel:
|
|
2850
|
-
offlineLabel:
|
|
2865
|
+
designingLabel: J.designingPlanLabel,
|
|
2866
|
+
extendLabel: ge,
|
|
2867
|
+
waitingLabel: J.connectionWaiting,
|
|
2868
|
+
stalledLabel: J.connectionStalledLabel,
|
|
2869
|
+
offlineLabel: J.connectionOfflineLabel
|
|
2851
2870
|
}) : null,
|
|
2852
2871
|
a ? /* @__PURE__ */ Q(Ca, {
|
|
2853
2872
|
progress: a,
|
|
2873
|
+
appSegment: e.toolInvocations?.map((e) => e.draftReview).find((e) => e?.packageId && e.items?.some((e) => e.type === "app"))?.packageId,
|
|
2854
2874
|
onOpenBuiltApp: re,
|
|
2855
2875
|
openBuiltAppLabel: ie,
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2876
|
+
onDesignBuiltApp: R,
|
|
2877
|
+
designBuiltAppLabel: ae,
|
|
2878
|
+
getArtifactAction: oe,
|
|
2879
|
+
onPreviewDraftApp: z,
|
|
2880
|
+
previewDraftLabel: B,
|
|
2881
|
+
waitingLabel: J.connectionWaiting,
|
|
2882
|
+
stalledLabel: J.connectionStalledLabel,
|
|
2883
|
+
offlineLabel: J.connectionOfflineLabel
|
|
2861
2884
|
}) : null,
|
|
2862
|
-
!t &&
|
|
2885
|
+
!t && G === "debug" && r ? /* @__PURE__ */ $(Li, {
|
|
2863
2886
|
isStreaming: !!e.streaming && !e.content,
|
|
2864
2887
|
className: "mb-2",
|
|
2865
2888
|
children: [/* @__PURE__ */ Q(zi, {}), /* @__PURE__ */ Q(Bi, { children: r })]
|
|
2866
2889
|
}) : null,
|
|
2867
|
-
!t &&
|
|
2890
|
+
!t && G === "summary" && c.length > 0 ? /* @__PURE__ */ Q(wa, {
|
|
2868
2891
|
groups: ia(c),
|
|
2869
|
-
labels:
|
|
2892
|
+
labels: J
|
|
2870
2893
|
}) : null,
|
|
2871
|
-
!t && l.length > 0 ? l.map(
|
|
2894
|
+
!t && l.length > 0 ? l.map(Et) : null,
|
|
2872
2895
|
t ? e.content ? /* @__PURE__ */ Q("div", {
|
|
2873
2896
|
className: "whitespace-pre-wrap break-words",
|
|
2874
2897
|
children: e.content
|
|
2875
2898
|
}) : null : f ? /* @__PURE__ */ Q(la, {}) : u ? /* @__PURE__ */ Q(vr, { children: e.content }) : !e.streaming && ra(e.content) ? /* @__PURE__ */ Q("span", {
|
|
2876
2899
|
className: "text-xs italic text-muted-foreground/70",
|
|
2877
2900
|
title: e.content,
|
|
2878
|
-
children:
|
|
2901
|
+
children: J.agentActivity
|
|
2879
2902
|
}) : null,
|
|
2880
2903
|
e.streaming && u ? /* @__PURE__ */ Q("span", {
|
|
2881
2904
|
"aria-hidden": !0,
|
|
@@ -2912,23 +2935,23 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2912
2935
|
className: "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
2913
2936
|
children: [
|
|
2914
2937
|
/* @__PURE__ */ Q(lr, {
|
|
2915
|
-
label:
|
|
2916
|
-
tooltip:
|
|
2917
|
-
onClick: () =>
|
|
2918
|
-
children:
|
|
2938
|
+
label: Le === e.id ? J.copied : J.copy,
|
|
2939
|
+
tooltip: Le === e.id ? J.copied : J.copy,
|
|
2940
|
+
onClick: () => xt(e),
|
|
2941
|
+
children: Le === e.id ? /* @__PURE__ */ Q(Ie, { className: "size-3.5" }) : /* @__PURE__ */ Q(Ke, { className: "size-3.5" })
|
|
2919
2942
|
}),
|
|
2920
2943
|
s ? /* @__PURE__ */ Q(lr, {
|
|
2921
|
-
label:
|
|
2922
|
-
tooltip:
|
|
2944
|
+
label: J.regenerate,
|
|
2945
|
+
tooltip: J.regenerate,
|
|
2923
2946
|
onClick: s,
|
|
2924
|
-
children: /* @__PURE__ */ Q(
|
|
2947
|
+
children: /* @__PURE__ */ Q(lt, { className: "size-3.5" })
|
|
2925
2948
|
}) : null,
|
|
2926
|
-
|
|
2949
|
+
G === "debug" && e.traceId ? /* @__PURE__ */ Q("a", {
|
|
2927
2950
|
href: `#trace/${e.traceId}`,
|
|
2928
2951
|
"data-trace-id": e.traceId,
|
|
2929
2952
|
className: "text-[10px] text-muted-foreground hover:text-foreground ml-1 underline",
|
|
2930
|
-
title:
|
|
2931
|
-
children:
|
|
2953
|
+
title: J.viewTrace,
|
|
2954
|
+
children: J.trace
|
|
2932
2955
|
}) : null
|
|
2933
2956
|
]
|
|
2934
2957
|
}) : null]
|
|
@@ -2939,32 +2962,32 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2939
2962
|
showAvatar: m,
|
|
2940
2963
|
assistantAvatarUrl: _,
|
|
2941
2964
|
assistantAvatarFallback: v,
|
|
2942
|
-
waitingLabel:
|
|
2943
|
-
stalledLabel:
|
|
2944
|
-
offlineLabel:
|
|
2965
|
+
waitingLabel: J.connectionWaiting,
|
|
2966
|
+
stalledLabel: J.connectionStalledLabel,
|
|
2967
|
+
offlineLabel: J.connectionOfflineLabel
|
|
2945
2968
|
}) : null]
|
|
2946
2969
|
}), /* @__PURE__ */ Q(nr, {})]
|
|
2947
2970
|
}),
|
|
2948
2971
|
f ? Xn(f) && !Yn(f) ? /* @__PURE__ */ Q(Da, {
|
|
2949
2972
|
error: f,
|
|
2950
|
-
rateLimitedLabel:
|
|
2951
|
-
genericLabel:
|
|
2973
|
+
rateLimitedLabel: J.sendFailedRateLimited,
|
|
2974
|
+
genericLabel: J.sendFailedGeneric
|
|
2952
2975
|
}) : /* @__PURE__ */ Q(Oa, {
|
|
2953
2976
|
error: f,
|
|
2954
2977
|
onReload: s,
|
|
2955
2978
|
onUpgrade: c
|
|
2956
2979
|
}) : null,
|
|
2957
2980
|
u ? null : /* @__PURE__ */ $("div", {
|
|
2958
|
-
ref:
|
|
2959
|
-
className:
|
|
2981
|
+
ref: mt,
|
|
2982
|
+
className: K("relative", Fe && "mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0"),
|
|
2960
2983
|
children: [j ? /* @__PURE__ */ Q("div", {
|
|
2961
2984
|
className: "absolute bottom-full left-0 right-0 z-10 px-3 pb-1",
|
|
2962
2985
|
children: j
|
|
2963
2986
|
}) : null, /* @__PURE__ */ $(Br, {
|
|
2964
2987
|
accept: C,
|
|
2965
|
-
fileInputLabel:
|
|
2988
|
+
fileInputLabel: J.uploadFiles,
|
|
2966
2989
|
maxFileSize: w,
|
|
2967
|
-
onSubmit:
|
|
2990
|
+
onSubmit: ct,
|
|
2968
2991
|
onError: (e) => {
|
|
2969
2992
|
console.warn("[plugin-chatbot] prompt-input error", e);
|
|
2970
2993
|
},
|
|
@@ -2972,13 +2995,13 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2972
2995
|
S ? /* @__PURE__ */ Q(Vr, { children: /* @__PURE__ */ Q(Rr, { children: (e) => /* @__PURE__ */ Q(Lr, { data: e }) }) }) : null,
|
|
2973
2996
|
/* @__PURE__ */ Q(Hr, {
|
|
2974
2997
|
placeholder: r,
|
|
2975
|
-
disabled: l ||
|
|
2998
|
+
disabled: l || Ne === "streaming",
|
|
2976
2999
|
onChange: M ? (e) => M(e.currentTarget.value) : void 0
|
|
2977
3000
|
}),
|
|
2978
3001
|
/* @__PURE__ */ $(Wr, { children: [/* @__PURE__ */ $(Gr, { children: [
|
|
2979
3002
|
S ? /* @__PURE__ */ $(qr, { children: [/* @__PURE__ */ Q(Jr, {}), /* @__PURE__ */ Q(Yr, { children: /* @__PURE__ */ Q(zr, {}) })] }) : null,
|
|
2980
3003
|
D && D.length > 1 ? /* @__PURE__ */ Q("select", {
|
|
2981
|
-
"aria-label":
|
|
3004
|
+
"aria-label": J.model,
|
|
2982
3005
|
value: O ?? D[0].id,
|
|
2983
3006
|
onChange: (e) => k?.(e.target.value),
|
|
2984
3007
|
className: "h-7 rounded-md border bg-background px-2 text-xs text-muted-foreground hover:text-foreground focus:outline-none focus:ring-1 focus:ring-ring",
|
|
@@ -2990,17 +3013,17 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2990
3013
|
/* @__PURE__ */ $("span", {
|
|
2991
3014
|
className: "hidden items-center gap-1 text-[10px] text-muted-foreground sm:inline-flex",
|
|
2992
3015
|
"aria-hidden": "true",
|
|
2993
|
-
children: [/* @__PURE__ */ Q(
|
|
3016
|
+
children: [/* @__PURE__ */ Q(Je, { className: "h-3 w-3" }), /* @__PURE__ */ Q("span", {
|
|
2994
3017
|
className: "opacity-70",
|
|
2995
|
-
children:
|
|
3018
|
+
children: J.sendHint
|
|
2996
3019
|
})]
|
|
2997
3020
|
})
|
|
2998
3021
|
] }), /* @__PURE__ */ Q(Zr, {
|
|
2999
|
-
"aria-label":
|
|
3000
|
-
status:
|
|
3022
|
+
"aria-label": Ne === "streaming" ? J.stopResponse : J.submit,
|
|
3023
|
+
status: Ne,
|
|
3001
3024
|
disabled: l,
|
|
3002
|
-
onClick:
|
|
3003
|
-
type:
|
|
3025
|
+
onClick: Ne === "streaming" ? o : void 0,
|
|
3026
|
+
type: Ne === "streaming" ? "button" : "submit"
|
|
3004
3027
|
})] })
|
|
3005
3028
|
]
|
|
3006
3029
|
})]
|
|
@@ -3011,13 +3034,13 @@ var oa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
3011
3034
|
oa.displayName = "ChatbotEnhanced";
|
|
3012
3035
|
function sa({ isUser: e, url: t, fallback: n }) {
|
|
3013
3036
|
return /* @__PURE__ */ Q("div", {
|
|
3014
|
-
className:
|
|
3037
|
+
className: K("mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium", e ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary"),
|
|
3015
3038
|
"aria-hidden": "true",
|
|
3016
3039
|
children: t ? /* @__PURE__ */ Q("img", {
|
|
3017
3040
|
src: t,
|
|
3018
3041
|
alt: "",
|
|
3019
3042
|
className: "size-full object-cover"
|
|
3020
|
-
}) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(
|
|
3043
|
+
}) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Q(Pe, { className: "size-4" })
|
|
3021
3044
|
});
|
|
3022
3045
|
}
|
|
3023
3046
|
function ca({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
|
|
@@ -3025,7 +3048,7 @@ function ca({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n,
|
|
|
3025
3048
|
from: "assistant",
|
|
3026
3049
|
"aria-live": "polite",
|
|
3027
3050
|
children: /* @__PURE__ */ $("div", {
|
|
3028
|
-
className:
|
|
3051
|
+
className: K("flex w-full gap-2.5", e ? "flex-row items-start" : "flex-col"),
|
|
3029
3052
|
children: [e ? /* @__PURE__ */ Q(sa, {
|
|
3030
3053
|
isUser: !1,
|
|
3031
3054
|
url: t,
|
|
@@ -3111,19 +3134,19 @@ function pa() {
|
|
|
3111
3134
|
function ma({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3112
3135
|
let { elapsedSeconds: o, quietSeconds: s, live: c } = fa(e, t), l = pa() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = ua(o);
|
|
3113
3136
|
return /* @__PURE__ */ $("span", {
|
|
3114
|
-
className:
|
|
3137
|
+
className: K("inline-flex items-center gap-1.5 text-xs tabular-nums", l === "offline" ? "text-red-600 font-medium" : l === "stalled" ? "text-amber-600 font-medium" : "font-normal text-muted-foreground"),
|
|
3115
3138
|
"aria-live": "polite",
|
|
3116
3139
|
"data-liveness-tier": l,
|
|
3117
3140
|
title: l === "offline" ? `${a} · ${u} elapsed` : l === "receiving" ? `Receiving from server · ${u} elapsed` : l === "stalled" ? `${i} (${s}s with no response) · ${u} elapsed` : `${r} · ${u} elapsed`,
|
|
3118
3141
|
children: [
|
|
3119
|
-
l === "offline" ? /* @__PURE__ */ Q(
|
|
3142
|
+
l === "offline" ? /* @__PURE__ */ Q(_t, {
|
|
3120
3143
|
className: "size-3 shrink-0",
|
|
3121
3144
|
"aria-hidden": !0
|
|
3122
3145
|
}) : /* @__PURE__ */ Q("span", {
|
|
3123
3146
|
"aria-hidden": !0,
|
|
3124
|
-
className:
|
|
3147
|
+
className: K("size-1.5 shrink-0 rounded-full", l === "receiving" ? "bg-emerald-500 animate-pulse" : l === "stalled" ? "bg-amber-500" : "bg-muted-foreground/50 animate-pulse")
|
|
3125
3148
|
}),
|
|
3126
|
-
/* @__PURE__ */ Q(
|
|
3149
|
+
/* @__PURE__ */ Q(We, {
|
|
3127
3150
|
className: "size-3 shrink-0",
|
|
3128
3151
|
"aria-hidden": !0
|
|
3129
3152
|
}),
|
|
@@ -3163,7 +3186,7 @@ function va({ label: t, hints: n, offlineLabel: r }) {
|
|
|
3163
3186
|
"data-testid": "build-proposal-progress",
|
|
3164
3187
|
"aria-live": "polite",
|
|
3165
3188
|
children: [
|
|
3166
|
-
/* @__PURE__ */ Q(
|
|
3189
|
+
/* @__PURE__ */ Q(pt, {
|
|
3167
3190
|
className: "size-3 shrink-0 animate-pulse text-primary",
|
|
3168
3191
|
"aria-hidden": !0
|
|
3169
3192
|
}),
|
|
@@ -3179,7 +3202,7 @@ function va({ label: t, hints: n, offlineLabel: r }) {
|
|
|
3179
3202
|
className: "hidden shrink-0 items-center gap-0.5 sm:inline-flex",
|
|
3180
3203
|
"data-testid": "build-proposal-progress-dots",
|
|
3181
3204
|
"aria-hidden": !0,
|
|
3182
|
-
children: n.map((e, t) => /* @__PURE__ */ Q("span", { className:
|
|
3205
|
+
children: n.map((e, t) => /* @__PURE__ */ Q("span", { className: K("size-1 rounded-full transition-colors", t <= o ? "bg-primary/70" : "bg-muted-foreground/25") }, t))
|
|
3183
3206
|
}) : null,
|
|
3184
3207
|
/* @__PURE__ */ Q(ya, { offlineLabel: r })
|
|
3185
3208
|
]
|
|
@@ -3191,11 +3214,11 @@ function ya({ offlineLabel: t }) {
|
|
|
3191
3214
|
let e = Date.now(), t = setInterval(() => r(Math.floor((Date.now() - e) / 1e3)), 1e3);
|
|
3192
3215
|
return () => clearInterval(t);
|
|
3193
3216
|
}, []), /* @__PURE__ */ $("span", {
|
|
3194
|
-
className:
|
|
3217
|
+
className: K("inline-flex items-center gap-1 text-xs tabular-nums", i ? "text-red-600 font-medium" : "text-muted-foreground"),
|
|
3195
3218
|
"aria-live": "polite",
|
|
3196
3219
|
"data-tool-running-timer": !0,
|
|
3197
3220
|
children: [
|
|
3198
|
-
Q(i ?
|
|
3221
|
+
Q(i ? _t : We, {
|
|
3199
3222
|
className: "size-3 shrink-0",
|
|
3200
3223
|
"aria-hidden": !0
|
|
3201
3224
|
}),
|
|
@@ -3226,7 +3249,7 @@ function Sa({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3226
3249
|
/* @__PURE__ */ $("div", {
|
|
3227
3250
|
className: "mb-2 flex items-center gap-2 font-medium",
|
|
3228
3251
|
children: [
|
|
3229
|
-
p ? /* @__PURE__ */ Q(
|
|
3252
|
+
p ? /* @__PURE__ */ Q(q, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(nt, { className: "size-4 shrink-0 animate-spin text-primary" }),
|
|
3230
3253
|
/* @__PURE__ */ Q("span", {
|
|
3231
3254
|
className: "min-w-0 truncate",
|
|
3232
3255
|
children: h
|
|
@@ -3265,7 +3288,7 @@ function Sa({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3265
3288
|
className: "inline-flex animate-in fade-in items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80 duration-500",
|
|
3266
3289
|
title: e.name,
|
|
3267
3290
|
children: [
|
|
3268
|
-
/* @__PURE__ */ Q(
|
|
3291
|
+
/* @__PURE__ */ Q(ht, { className: "size-3 text-foreground/40" }),
|
|
3269
3292
|
e.label || e.name,
|
|
3270
3293
|
e.fields ? /* @__PURE__ */ $("span", {
|
|
3271
3294
|
className: "text-foreground/40",
|
|
@@ -3281,13 +3304,16 @@ function Sa({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3281
3304
|
]
|
|
3282
3305
|
});
|
|
3283
3306
|
}
|
|
3284
|
-
function Ca({ progress:
|
|
3285
|
-
let { phase:
|
|
3286
|
-
for (let e of
|
|
3287
|
-
let t =
|
|
3288
|
-
t.push(
|
|
3307
|
+
function Ca({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel: i = "Open app", onDesignBuiltApp: a, designBuiltAppLabel: o = "Design in Studio", getArtifactAction: s, onPreviewDraftApp: c, previewDraftLabel: l = "Preview", waitingLabel: u = "Waiting for server…", stalledLabel: d = "Still working…", offlineLabel: f = "Connection lost — reconnecting…" }) {
|
|
3308
|
+
let { phase: p, appLabel: m, items: h, done: g, total: _, seq: v } = t, y = p === "done", b = v ?? `${p}:${g}:${h.length}`, x = h.find((e) => e.type === "app"), S = _ > 0 ? Math.min(100, Math.round(g / _ * 100)) : y ? 100 : 6, C = /* @__PURE__ */ new Map();
|
|
3309
|
+
for (let e of h) {
|
|
3310
|
+
let t = C.get(e.type) ?? [];
|
|
3311
|
+
t.push({
|
|
3312
|
+
name: e.name,
|
|
3313
|
+
display: e.name.replace(/_sample$/, "")
|
|
3314
|
+
}), C.set(e.type, t);
|
|
3289
3315
|
}
|
|
3290
|
-
let
|
|
3316
|
+
let w = [...ba.filter((e) => C.has(e)), ...[...C.keys()].filter((e) => !ba.includes(e))];
|
|
3291
3317
|
return /* @__PURE__ */ $("div", {
|
|
3292
3318
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
3293
3319
|
"data-testid": "build-progress",
|
|
@@ -3295,20 +3321,20 @@ function Ca({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3295
3321
|
/* @__PURE__ */ $("div", {
|
|
3296
3322
|
className: "mb-2 flex items-center gap-2 font-medium",
|
|
3297
3323
|
children: [
|
|
3298
|
-
|
|
3299
|
-
/* @__PURE__ */ Q("span", { children:
|
|
3300
|
-
!
|
|
3324
|
+
y ? /* @__PURE__ */ Q(q, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(nt, { className: "size-4 shrink-0 animate-spin text-primary" }),
|
|
3325
|
+
/* @__PURE__ */ Q("span", { children: y ? `Built ${m ?? "your app"}` : `Building ${m ?? "your app"}…` }),
|
|
3326
|
+
!y && p === "data" ? /* @__PURE__ */ Q("span", {
|
|
3301
3327
|
className: "text-xs font-normal text-muted-foreground",
|
|
3302
3328
|
children: "adding sample data"
|
|
3303
3329
|
}) : null,
|
|
3304
|
-
|
|
3330
|
+
y ? null : /* @__PURE__ */ Q("span", {
|
|
3305
3331
|
className: "ml-auto",
|
|
3306
3332
|
children: /* @__PURE__ */ Q(ma, {
|
|
3307
3333
|
active: !0,
|
|
3308
|
-
activityKey:
|
|
3309
|
-
waitingLabel:
|
|
3310
|
-
stalledLabel:
|
|
3311
|
-
offlineLabel:
|
|
3334
|
+
activityKey: b,
|
|
3335
|
+
waitingLabel: u,
|
|
3336
|
+
stalledLabel: d,
|
|
3337
|
+
offlineLabel: f
|
|
3312
3338
|
})
|
|
3313
3339
|
})
|
|
3314
3340
|
]
|
|
@@ -3316,46 +3342,68 @@ function Ca({ progress: e, onOpenBuiltApp: t, openBuiltAppLabel: n = "Open app",
|
|
|
3316
3342
|
/* @__PURE__ */ Q("div", {
|
|
3317
3343
|
className: "mb-2 h-1.5 w-full overflow-hidden rounded-full bg-muted",
|
|
3318
3344
|
children: /* @__PURE__ */ Q("div", {
|
|
3319
|
-
className:
|
|
3320
|
-
style: { width: `${
|
|
3345
|
+
className: K("h-full rounded-full transition-all duration-500", y ? "bg-emerald-500" : "bg-primary"),
|
|
3346
|
+
style: { width: `${S}%` }
|
|
3321
3347
|
})
|
|
3322
3348
|
}),
|
|
3323
3349
|
/* @__PURE__ */ Q("ul", {
|
|
3324
3350
|
className: "space-y-1",
|
|
3325
|
-
children:
|
|
3326
|
-
let
|
|
3351
|
+
children: w.map((t) => {
|
|
3352
|
+
let r = C.get(t);
|
|
3327
3353
|
return /* @__PURE__ */ $("li", {
|
|
3328
3354
|
className: "flex items-start gap-2",
|
|
3329
|
-
children: [/* @__PURE__ */ Q(
|
|
3355
|
+
children: [/* @__PURE__ */ Q(q, { className: "mt-0.5 size-3.5 shrink-0 text-emerald-600" }), /* @__PURE__ */ $("span", {
|
|
3330
3356
|
className: "min-w-0 text-muted-foreground",
|
|
3331
3357
|
children: [
|
|
3332
3358
|
/* @__PURE__ */ Q("span", {
|
|
3333
3359
|
className: "font-medium text-foreground",
|
|
3334
|
-
children: xa[
|
|
3360
|
+
children: xa[t] ?? t
|
|
3335
3361
|
}),
|
|
3336
3362
|
" ",
|
|
3337
|
-
|
|
3338
|
-
|
|
3363
|
+
r.slice(0, 6).map((r, i) => {
|
|
3364
|
+
let a = y ? s?.({
|
|
3365
|
+
type: t,
|
|
3366
|
+
name: r.name
|
|
3367
|
+
}, n) : null;
|
|
3368
|
+
return /* @__PURE__ */ $(e.Fragment, { children: [i > 0 ? ", " : null, a ? /* @__PURE__ */ Q("button", {
|
|
3369
|
+
type: "button",
|
|
3370
|
+
onClick: a,
|
|
3371
|
+
className: "rounded-sm text-primary underline decoration-primary/40 underline-offset-2 hover:decoration-primary",
|
|
3372
|
+
"data-testid": `build-artifact-link-${t}-${r.name}`,
|
|
3373
|
+
children: r.display
|
|
3374
|
+
}) : r.display] }, r.name);
|
|
3375
|
+
}),
|
|
3376
|
+
r.length > 6 ? ` +${r.length - 6} more` : ""
|
|
3339
3377
|
]
|
|
3340
3378
|
})]
|
|
3341
|
-
},
|
|
3379
|
+
}, t);
|
|
3342
3380
|
})
|
|
3343
3381
|
}),
|
|
3344
|
-
|
|
3382
|
+
y && x && (a || r || c) ? /* @__PURE__ */ $("div", {
|
|
3345
3383
|
className: "mt-3 flex items-center gap-2",
|
|
3346
|
-
children: [
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3384
|
+
children: [
|
|
3385
|
+
a ? /* @__PURE__ */ $("button", {
|
|
3386
|
+
type: "button",
|
|
3387
|
+
onClick: () => a(x.name, n),
|
|
3388
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
3389
|
+
"data-testid": "build-progress-design-app",
|
|
3390
|
+
children: [o, /* @__PURE__ */ Q(Me, { className: "size-3.5" })]
|
|
3391
|
+
}) : null,
|
|
3392
|
+
r ? /* @__PURE__ */ $("button", {
|
|
3393
|
+
type: "button",
|
|
3394
|
+
onClick: () => r(x.name),
|
|
3395
|
+
className: K("inline-flex h-7 items-center gap-1.5 rounded-md px-3 text-xs font-medium", a ? "border hover:bg-muted" : "bg-primary text-primary-foreground hover:bg-primary/90"),
|
|
3396
|
+
"data-testid": "build-progress-open-app",
|
|
3397
|
+
children: [i, /* @__PURE__ */ Q(Me, { className: "size-3.5" })]
|
|
3398
|
+
}) : null,
|
|
3399
|
+
c ? /* @__PURE__ */ $("button", {
|
|
3400
|
+
type: "button",
|
|
3401
|
+
onClick: () => c(x.name),
|
|
3402
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
|
|
3403
|
+
"data-testid": "build-progress-preview-app",
|
|
3404
|
+
children: [/* @__PURE__ */ Q(Xe, { className: "size-3.5" }), l]
|
|
3405
|
+
}) : null
|
|
3406
|
+
]
|
|
3359
3407
|
}) : null
|
|
3360
3408
|
]
|
|
3361
3409
|
});
|
|
@@ -3385,7 +3433,7 @@ function wa({ groups: e, labels: t }) {
|
|
|
3385
3433
|
hints: t.designingPlanHints,
|
|
3386
3434
|
offlineLabel: t.connectionOfflineLabel
|
|
3387
3435
|
}) : /* @__PURE__ */ Q(ya, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Q("span", {
|
|
3388
|
-
className:
|
|
3436
|
+
className: K("shrink-0 text-[10px] font-medium", e.state === "failed" ? "text-destructive" : e.state === "completed" ? "text-emerald-700 dark:text-emerald-400" : "text-muted-foreground"),
|
|
3389
3437
|
children: Ea(e.state, t)
|
|
3390
3438
|
})]
|
|
3391
3439
|
}, e.key))
|
|
@@ -3393,7 +3441,7 @@ function wa({ groups: e, labels: t }) {
|
|
|
3393
3441
|
});
|
|
3394
3442
|
}
|
|
3395
3443
|
function Ta({ state: e }) {
|
|
3396
|
-
return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(
|
|
3444
|
+
return e === "failed" ? /* @__PURE__ */ Q(X, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Q(q, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Q(We, { className: "size-3.5 shrink-0 text-muted-foreground" });
|
|
3397
3445
|
}
|
|
3398
3446
|
function Ea(e, t) {
|
|
3399
3447
|
switch (e) {
|
|
@@ -3417,7 +3465,7 @@ function Da({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
|
3417
3465
|
className: "rounded-md border border-amber-300/40 bg-amber-50/60 px-3 py-2 text-foreground dark:bg-amber-950/20",
|
|
3418
3466
|
children: /* @__PURE__ */ $("div", {
|
|
3419
3467
|
className: "flex items-start gap-2",
|
|
3420
|
-
children: [/* @__PURE__ */ Q(
|
|
3468
|
+
children: [/* @__PURE__ */ Q(gt, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-600" }), /* @__PURE__ */ Q("div", {
|
|
3421
3469
|
className: "min-w-0 flex-1 break-words leading-snug",
|
|
3422
3470
|
children: i
|
|
3423
3471
|
})]
|
|
@@ -3463,7 +3511,7 @@ function Oa({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3463
3511
|
children: [/* @__PURE__ */ $("div", {
|
|
3464
3512
|
className: "flex items-start gap-2",
|
|
3465
3513
|
children: [
|
|
3466
|
-
/* @__PURE__ */ Q(
|
|
3514
|
+
/* @__PURE__ */ Q(Ae, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }),
|
|
3467
3515
|
/* @__PURE__ */ $("div", {
|
|
3468
3516
|
className: "min-w-0 flex-1",
|
|
3469
3517
|
children: [/* @__PURE__ */ Q("div", {
|
|
@@ -3486,7 +3534,7 @@ function Oa({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3486
3534
|
type: "button",
|
|
3487
3535
|
onClick: n,
|
|
3488
3536
|
className: "inline-flex h-7 items-center rounded-md border border-destructive/30 bg-background px-2 text-xs font-medium text-destructive hover:bg-destructive/10",
|
|
3489
|
-
children: [/* @__PURE__ */ Q(
|
|
3537
|
+
children: [/* @__PURE__ */ Q(lt, { className: "mr-1 h-3 w-3" }), "Retry"]
|
|
3490
3538
|
}) : null]
|
|
3491
3539
|
})
|
|
3492
3540
|
]
|
|
@@ -4171,7 +4219,7 @@ var ja = ({ size: e = 16 }) => /* @__PURE__ */ $("svg", {
|
|
|
4171
4219
|
}) })
|
|
4172
4220
|
]
|
|
4173
4221
|
}), Ma = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Q("div", {
|
|
4174
|
-
className:
|
|
4222
|
+
className: K("inline-flex animate-spin items-center justify-center", e),
|
|
4175
4223
|
...n,
|
|
4176
4224
|
children: /* @__PURE__ */ Q(ja, { size: t })
|
|
4177
4225
|
}), Na = /* @__PURE__ */ Lt({
|
|
@@ -4486,19 +4534,19 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4486
4534
|
children: [
|
|
4487
4535
|
/* @__PURE__ */ $("div", {
|
|
4488
4536
|
className: "flex items-center justify-between gap-2",
|
|
4489
|
-
children: [/* @__PURE__ */ Q(
|
|
4537
|
+
children: [/* @__PURE__ */ Q(Ce, {
|
|
4490
4538
|
value: l,
|
|
4491
4539
|
onValueChange: (e) => u(e),
|
|
4492
|
-
children: /* @__PURE__ */ $(
|
|
4493
|
-
/* @__PURE__ */ Q(
|
|
4540
|
+
children: /* @__PURE__ */ $(we, { children: [
|
|
4541
|
+
/* @__PURE__ */ Q(Te, {
|
|
4494
4542
|
value: "pending",
|
|
4495
4543
|
children: "Pending"
|
|
4496
4544
|
}),
|
|
4497
|
-
/* @__PURE__ */ Q(
|
|
4545
|
+
/* @__PURE__ */ Q(Te, {
|
|
4498
4546
|
value: "decided",
|
|
4499
4547
|
children: "Decided"
|
|
4500
4548
|
}),
|
|
4501
|
-
/* @__PURE__ */ Q(
|
|
4549
|
+
/* @__PURE__ */ Q(Te, {
|
|
4502
4550
|
value: "all",
|
|
4503
4551
|
children: "All"
|
|
4504
4552
|
})
|
|
@@ -4509,20 +4557,20 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4509
4557
|
onClick: () => void ee(),
|
|
4510
4558
|
disabled: M,
|
|
4511
4559
|
"data-testid": "ai-inbox-refresh",
|
|
4512
|
-
children: [/* @__PURE__ */ Q(
|
|
4560
|
+
children: [/* @__PURE__ */ Q(lt, { className: `h-3.5 w-3.5 mr-1.5 ${M ? "animate-spin" : ""}` }), "Refresh"]
|
|
4513
4561
|
})]
|
|
4514
4562
|
}),
|
|
4515
4563
|
N ? /* @__PURE__ */ $(f, {
|
|
4516
4564
|
variant: "destructive",
|
|
4517
|
-
children: [/* @__PURE__ */ Q(
|
|
4565
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "h-4 w-4" }), /* @__PURE__ */ Q(p, { children: N.message })]
|
|
4518
4566
|
}) : null,
|
|
4519
4567
|
D ? /* @__PURE__ */ $(f, {
|
|
4520
4568
|
variant: "destructive",
|
|
4521
|
-
children: [/* @__PURE__ */ Q(
|
|
4569
|
+
children: [/* @__PURE__ */ Q(Ae, { className: "h-4 w-4" }), /* @__PURE__ */ Q(p, { children: D })]
|
|
4522
4570
|
}) : null,
|
|
4523
4571
|
k && !D ? /* @__PURE__ */ $(f, {
|
|
4524
4572
|
variant: k.ok ? "default" : "destructive",
|
|
4525
|
-
children: [k.ok ? /* @__PURE__ */ Q(
|
|
4573
|
+
children: [k.ok ? /* @__PURE__ */ Q(q, { className: "h-4 w-4" }) : /* @__PURE__ */ Q(X, { className: "h-4 w-4" }), /* @__PURE__ */ $(p, { children: [
|
|
4526
4574
|
k.kind === "approve" ? "Approve" : "Reject",
|
|
4527
4575
|
" for",
|
|
4528
4576
|
" ",
|
|
@@ -4538,69 +4586,69 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4538
4586
|
M && I.length === 0 ? /* @__PURE__ */ $("div", {
|
|
4539
4587
|
className: "space-y-2",
|
|
4540
4588
|
children: [
|
|
4541
|
-
/* @__PURE__ */ Q(
|
|
4542
|
-
/* @__PURE__ */ Q(
|
|
4543
|
-
/* @__PURE__ */ Q(
|
|
4589
|
+
/* @__PURE__ */ Q(ve, { className: "h-10 w-full" }),
|
|
4590
|
+
/* @__PURE__ */ Q(ve, { className: "h-10 w-full" }),
|
|
4591
|
+
/* @__PURE__ */ Q(ve, { className: "h-10 w-full" })
|
|
4544
4592
|
]
|
|
4545
4593
|
}) : I.length === 0 ? /* @__PURE__ */ Q(te, { children: /* @__PURE__ */ $(L, { children: [
|
|
4546
|
-
/* @__PURE__ */ Q(re, { children: /* @__PURE__ */ Q(
|
|
4594
|
+
/* @__PURE__ */ Q(re, { children: /* @__PURE__ */ Q(tt, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
4547
4595
|
/* @__PURE__ */ Q(ie, { children: "No actions waiting" }),
|
|
4548
4596
|
/* @__PURE__ */ Q(ne, { children: "When the AI proposes a sensitive action it will appear here for review." })
|
|
4549
4597
|
] }) }) : /* @__PURE__ */ Q("div", {
|
|
4550
4598
|
className: "rounded-md border",
|
|
4551
|
-
children: /* @__PURE__ */ $(
|
|
4552
|
-
/* @__PURE__ */ Q(
|
|
4599
|
+
children: /* @__PURE__ */ $(ye, { children: [/* @__PURE__ */ Q(xe, { children: /* @__PURE__ */ $(Se, { children: [
|
|
4600
|
+
/* @__PURE__ */ Q(W, {
|
|
4553
4601
|
className: "w-[140px]",
|
|
4554
4602
|
children: "Tool"
|
|
4555
4603
|
}),
|
|
4556
|
-
/* @__PURE__ */ Q(
|
|
4604
|
+
/* @__PURE__ */ Q(W, {
|
|
4557
4605
|
className: "w-[140px]",
|
|
4558
4606
|
children: "Action"
|
|
4559
4607
|
}),
|
|
4560
|
-
/* @__PURE__ */ Q(
|
|
4608
|
+
/* @__PURE__ */ Q(W, {
|
|
4561
4609
|
className: "w-[120px]",
|
|
4562
4610
|
children: "Object"
|
|
4563
4611
|
}),
|
|
4564
|
-
/* @__PURE__ */ Q(
|
|
4612
|
+
/* @__PURE__ */ Q(W, {
|
|
4565
4613
|
className: "w-[110px]",
|
|
4566
4614
|
children: "Status"
|
|
4567
4615
|
}),
|
|
4568
|
-
/* @__PURE__ */ Q(
|
|
4616
|
+
/* @__PURE__ */ Q(W, {
|
|
4569
4617
|
className: "w-[110px]",
|
|
4570
4618
|
children: "Proposed"
|
|
4571
4619
|
}),
|
|
4572
|
-
/* @__PURE__ */ Q(
|
|
4620
|
+
/* @__PURE__ */ Q(W, {
|
|
4573
4621
|
className: "w-[260px] text-right",
|
|
4574
4622
|
children: "Decision"
|
|
4575
4623
|
})
|
|
4576
|
-
] }) }), /* @__PURE__ */ Q(
|
|
4624
|
+
] }) }), /* @__PURE__ */ Q(be, { children: I.map((e) => {
|
|
4577
4625
|
let t = e.status === "pending", n = T === e.id;
|
|
4578
|
-
return /* @__PURE__ */ $(
|
|
4579
|
-
/* @__PURE__ */ Q(
|
|
4626
|
+
return /* @__PURE__ */ $(Se, { children: [
|
|
4627
|
+
/* @__PURE__ */ Q(U, {
|
|
4580
4628
|
className: "font-mono text-xs",
|
|
4581
4629
|
children: e.tool_name
|
|
4582
4630
|
}),
|
|
4583
|
-
/* @__PURE__ */ Q(
|
|
4631
|
+
/* @__PURE__ */ Q(U, {
|
|
4584
4632
|
className: "text-sm",
|
|
4585
4633
|
children: e.action_name
|
|
4586
4634
|
}),
|
|
4587
|
-
/* @__PURE__ */ Q(
|
|
4635
|
+
/* @__PURE__ */ Q(U, {
|
|
4588
4636
|
className: "text-sm",
|
|
4589
4637
|
children: e.object_name
|
|
4590
4638
|
}),
|
|
4591
|
-
/* @__PURE__ */ Q(
|
|
4592
|
-
/* @__PURE__ */ Q(
|
|
4639
|
+
/* @__PURE__ */ Q(U, { children: /* @__PURE__ */ Q(za, { status: e.status }) }),
|
|
4640
|
+
/* @__PURE__ */ Q(U, {
|
|
4593
4641
|
className: "text-xs text-muted-foreground",
|
|
4594
4642
|
children: /* @__PURE__ */ $("span", {
|
|
4595
4643
|
className: "inline-flex items-center gap-1",
|
|
4596
4644
|
children: [
|
|
4597
|
-
/* @__PURE__ */ Q(
|
|
4645
|
+
/* @__PURE__ */ Q(Ue, { className: "h-3 w-3" }),
|
|
4598
4646
|
" ",
|
|
4599
4647
|
Ba(e.proposed_at)
|
|
4600
4648
|
]
|
|
4601
4649
|
})
|
|
4602
4650
|
}),
|
|
4603
|
-
/* @__PURE__ */ Q(
|
|
4651
|
+
/* @__PURE__ */ Q(U, {
|
|
4604
4652
|
className: "text-right",
|
|
4605
4653
|
children: /* @__PURE__ */ $("div", {
|
|
4606
4654
|
className: "inline-flex gap-1.5",
|
|
@@ -4609,14 +4657,14 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4609
4657
|
variant: "ghost",
|
|
4610
4658
|
onClick: () => m(e.id),
|
|
4611
4659
|
"data-testid": `ai-inbox-view-${e.id}`,
|
|
4612
|
-
children: [/* @__PURE__ */ Q(
|
|
4660
|
+
children: [/* @__PURE__ */ Q(Xe, { className: "h-3.5 w-3.5 mr-1" }), " View"]
|
|
4613
4661
|
}), t ? /* @__PURE__ */ $(Z, { children: [/* @__PURE__ */ $(v, {
|
|
4614
4662
|
size: "sm",
|
|
4615
4663
|
variant: "default",
|
|
4616
4664
|
disabled: n,
|
|
4617
4665
|
onClick: () => void ae(e.id),
|
|
4618
4666
|
"data-testid": `ai-inbox-approve-${e.id}`,
|
|
4619
|
-
children: [/* @__PURE__ */ Q(
|
|
4667
|
+
children: [/* @__PURE__ */ Q(q, { className: "h-3.5 w-3.5 mr-1" }), n ? "Working…" : "Approve"]
|
|
4620
4668
|
}), /* @__PURE__ */ $(v, {
|
|
4621
4669
|
size: "sm",
|
|
4622
4670
|
variant: "destructive",
|
|
@@ -4642,7 +4690,7 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4642
4690
|
children: [/* @__PURE__ */ $(C, {
|
|
4643
4691
|
className: "flex items-center gap-2",
|
|
4644
4692
|
children: [
|
|
4645
|
-
/* @__PURE__ */ Q(
|
|
4693
|
+
/* @__PURE__ */ Q(Pe, { className: "h-4 w-4" }),
|
|
4646
4694
|
" ",
|
|
4647
4695
|
o
|
|
4648
4696
|
]
|
|
@@ -4652,17 +4700,17 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4652
4700
|
className: c,
|
|
4653
4701
|
children: z
|
|
4654
4702
|
}),
|
|
4655
|
-
/* @__PURE__ */ Q(
|
|
4703
|
+
/* @__PURE__ */ Q(pe, {
|
|
4656
4704
|
open: !!d,
|
|
4657
4705
|
onOpenChange: (e) => {
|
|
4658
4706
|
e || m(null);
|
|
4659
4707
|
},
|
|
4660
|
-
children: /* @__PURE__ */ $(
|
|
4708
|
+
children: /* @__PURE__ */ $(me, {
|
|
4661
4709
|
className: "sm:max-w-[560px] overflow-y-auto",
|
|
4662
|
-
children: [/* @__PURE__ */ $(
|
|
4710
|
+
children: [/* @__PURE__ */ $(ge, { children: [/* @__PURE__ */ $(_e, {
|
|
4663
4711
|
className: "flex items-center gap-2",
|
|
4664
|
-
children: [/* @__PURE__ */ Q(
|
|
4665
|
-
}), /* @__PURE__ */ Q(
|
|
4712
|
+
children: [/* @__PURE__ */ Q(Pe, { className: "h-4 w-4" }), R ? R.action_name : "Pending action"]
|
|
4713
|
+
}), /* @__PURE__ */ Q(he, { children: R ? /* @__PURE__ */ $(Z, { children: [
|
|
4666
4714
|
"Tool ",
|
|
4667
4715
|
/* @__PURE__ */ Q("code", {
|
|
4668
4716
|
className: "text-xs",
|
|
@@ -4720,7 +4768,7 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4720
4768
|
}) : null
|
|
4721
4769
|
]
|
|
4722
4770
|
}),
|
|
4723
|
-
/* @__PURE__ */ Q(
|
|
4771
|
+
/* @__PURE__ */ Q(fe, {}),
|
|
4724
4772
|
/* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q(B, {
|
|
4725
4773
|
className: "text-xs",
|
|
4726
4774
|
children: "Tool input"
|
|
@@ -4755,7 +4803,7 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4755
4803
|
size: "sm",
|
|
4756
4804
|
onClick: () => void ae(R.id),
|
|
4757
4805
|
disabled: T === R.id,
|
|
4758
|
-
children: [/* @__PURE__ */ Q(
|
|
4806
|
+
children: [/* @__PURE__ */ Q(q, { className: "h-3.5 w-3.5 mr-1" }), "Approve & Execute"]
|
|
4759
4807
|
}), /* @__PURE__ */ $(v, {
|
|
4760
4808
|
size: "sm",
|
|
4761
4809
|
variant: "destructive",
|
|
@@ -4770,15 +4818,15 @@ function Wa({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4770
4818
|
}) : null]
|
|
4771
4819
|
})
|
|
4772
4820
|
}),
|
|
4773
|
-
/* @__PURE__ */ Q(
|
|
4821
|
+
/* @__PURE__ */ Q(pe, {
|
|
4774
4822
|
open: !!h,
|
|
4775
4823
|
onOpenChange: (e) => {
|
|
4776
4824
|
e || (g(null), w(""));
|
|
4777
4825
|
},
|
|
4778
|
-
children: /* @__PURE__ */ $(
|
|
4826
|
+
children: /* @__PURE__ */ $(me, {
|
|
4779
4827
|
side: "bottom",
|
|
4780
4828
|
className: "max-h-[40vh]",
|
|
4781
|
-
children: [/* @__PURE__ */ $(
|
|
4829
|
+
children: [/* @__PURE__ */ $(ge, { children: [/* @__PURE__ */ Q(_e, { children: "Reject this action?" }), /* @__PURE__ */ Q(he, { children: "The reason is shown back to the AI so it can adjust its next response." })] }), /* @__PURE__ */ $("div", {
|
|
4782
4830
|
className: "px-4 mt-3 space-y-3",
|
|
4783
4831
|
children: [/* @__PURE__ */ Q(Ee, {
|
|
4784
4832
|
value: _,
|
|
@@ -4974,10 +5022,10 @@ var Za = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
4974
5022
|
};
|
|
4975
5023
|
return /* @__PURE__ */ $("div", {
|
|
4976
5024
|
ref: p,
|
|
4977
|
-
className:
|
|
5025
|
+
className: K("flex flex-col border rounded-lg bg-background overflow-hidden", t),
|
|
4978
5026
|
style: { maxHeight: d },
|
|
4979
5027
|
...f,
|
|
4980
|
-
children: [/* @__PURE__ */ Q(
|
|
5028
|
+
children: [/* @__PURE__ */ Q(V, {
|
|
4981
5029
|
ref: g,
|
|
4982
5030
|
className: "flex-1 p-4",
|
|
4983
5031
|
children: /* @__PURE__ */ Q("div", {
|
|
@@ -5010,7 +5058,7 @@ var Za = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
5010
5058
|
onClick: y,
|
|
5011
5059
|
disabled: a || !m.trim(),
|
|
5012
5060
|
size: "icon",
|
|
5013
|
-
children: /* @__PURE__ */ Q(
|
|
5061
|
+
children: /* @__PURE__ */ Q(dt, { className: "h-4 w-4" })
|
|
5014
5062
|
})]
|
|
5015
5063
|
})
|
|
5016
5064
|
})]
|
|
@@ -5028,7 +5076,7 @@ var Qa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5028
5076
|
});
|
|
5029
5077
|
let s = o ? e.avatar || n : e.avatar || i, c = o ? e.avatarFallback || r : e.avatarFallback || a;
|
|
5030
5078
|
return /* @__PURE__ */ $("div", {
|
|
5031
|
-
className:
|
|
5079
|
+
className: K("flex gap-3", o ? "flex-row-reverse" : "flex-row"),
|
|
5032
5080
|
children: [/* @__PURE__ */ $(m, {
|
|
5033
5081
|
className: "h-8 w-8",
|
|
5034
5082
|
children: [/* @__PURE__ */ Q(g, { src: s }), /* @__PURE__ */ Q(h, {
|
|
@@ -5036,9 +5084,9 @@ var Qa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5036
5084
|
children: c
|
|
5037
5085
|
})]
|
|
5038
5086
|
}), /* @__PURE__ */ $("div", {
|
|
5039
|
-
className:
|
|
5087
|
+
className: K("flex flex-col gap-1", o ? "items-end" : "items-start"),
|
|
5040
5088
|
children: [/* @__PURE__ */ Q("div", {
|
|
5041
|
-
className:
|
|
5089
|
+
className: K("rounded-lg px-4 py-2 max-w-[70%] break-words", o ? "bg-primary text-primary-foreground" : "bg-muted"),
|
|
5042
5090
|
children: /* @__PURE__ */ Q("p", {
|
|
5043
5091
|
className: "text-sm whitespace-pre-wrap",
|
|
5044
5092
|
children: e.content
|
|
@@ -5051,7 +5099,7 @@ var Qa = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5051
5099
|
});
|
|
5052
5100
|
}, $a = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ $("div", {
|
|
5053
5101
|
ref: i,
|
|
5054
|
-
className:
|
|
5102
|
+
className: K("flex gap-3", e),
|
|
5055
5103
|
...r,
|
|
5056
5104
|
children: [/* @__PURE__ */ $(m, {
|
|
5057
5105
|
className: "h-8 w-8",
|