@invergent/agent-chat-react 1.4.13 → 1.5.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/dist/index.cjs +85 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +86 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -191,7 +191,7 @@ function Button({
|
|
|
191
191
|
var Conversation = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
192
|
useStickToBottom.StickToBottom,
|
|
193
193
|
{
|
|
194
|
-
className: cn("relative flex-1 overflow-y-
|
|
194
|
+
className: cn("relative flex-1 overflow-y-auto", className),
|
|
195
195
|
initial: "smooth",
|
|
196
196
|
resize: "smooth",
|
|
197
197
|
role: "log",
|
|
@@ -204,7 +204,7 @@ var ConversationContent = ({
|
|
|
204
204
|
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
205
205
|
useStickToBottom.StickToBottom.Content,
|
|
206
206
|
{
|
|
207
|
-
className: cn("flex flex-col gap-
|
|
207
|
+
className: cn("flex flex-col gap-6 py-6 px-6", className),
|
|
208
208
|
...props
|
|
209
209
|
}
|
|
210
210
|
);
|
|
@@ -219,15 +219,15 @@ var ConversationEmptyState = ({
|
|
|
219
219
|
"div",
|
|
220
220
|
{
|
|
221
221
|
className: cn(
|
|
222
|
-
"flex size-full flex-col items-center justify-center gap-
|
|
222
|
+
"flex size-full flex-col items-center justify-center gap-4 p-8 text-center",
|
|
223
223
|
className
|
|
224
224
|
),
|
|
225
225
|
...props,
|
|
226
226
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
227
|
-
icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground", children: icon }),
|
|
228
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-
|
|
230
|
-
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: description })
|
|
227
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center size-14 rounded-2xl bg-muted/60 text-muted-foreground/60", children: icon }),
|
|
228
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
229
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-base text-foreground/80", children: title }),
|
|
230
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground/60 text-sm max-w-sm", children: description })
|
|
231
231
|
] })
|
|
232
232
|
] })
|
|
233
233
|
}
|
|
@@ -244,7 +244,7 @@ var ConversationScrollButton = ({
|
|
|
244
244
|
Button,
|
|
245
245
|
{
|
|
246
246
|
className: cn(
|
|
247
|
-
"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",
|
|
247
|
+
"absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full shadow-lg border-border/50 dark:bg-background dark:hover:bg-muted",
|
|
248
248
|
className
|
|
249
249
|
),
|
|
250
250
|
onClick: handleScrollToBottom,
|
|
@@ -306,8 +306,8 @@ var Message = ({ className, from, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
306
306
|
"div",
|
|
307
307
|
{
|
|
308
308
|
className: cn(
|
|
309
|
-
"group flex w-full
|
|
310
|
-
from === "user" ? "is-user" : "is-assistant",
|
|
309
|
+
"group flex w-full flex-col gap-2",
|
|
310
|
+
from === "user" ? "is-user max-w-[85%]" : "is-assistant max-w-full",
|
|
311
311
|
className
|
|
312
312
|
),
|
|
313
313
|
...props
|
|
@@ -321,8 +321,8 @@ var MessageContent = ({
|
|
|
321
321
|
"div",
|
|
322
322
|
{
|
|
323
323
|
className: cn(
|
|
324
|
-
"
|
|
325
|
-
"group-[.is-user]:ml-auto group-[.is-user]:rounded-
|
|
324
|
+
"flex w-full min-w-0 max-w-full flex-col gap-2 overflow-hidden break-words",
|
|
325
|
+
"group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:bg-primary/10 group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground group-[.is-user]:border group-[.is-user]:border-primary/15",
|
|
326
326
|
"group-[.is-assistant]:text-foreground",
|
|
327
327
|
className
|
|
328
328
|
),
|
|
@@ -590,7 +590,7 @@ function Timeline({
|
|
|
590
590
|
"div",
|
|
591
591
|
{
|
|
592
592
|
className: cn(
|
|
593
|
-
"group/timeline flex
|
|
593
|
+
"group/timeline flex flex-col",
|
|
594
594
|
className
|
|
595
595
|
),
|
|
596
596
|
"data-orientation": orientation,
|
|
@@ -609,7 +609,7 @@ function TimelineContent({
|
|
|
609
609
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
610
610
|
"div",
|
|
611
611
|
{
|
|
612
|
-
className: cn("text-foreground text-sm", className),
|
|
612
|
+
className: cn("text-foreground text-sm min-w-0 overflow-hidden", className),
|
|
613
613
|
"data-slot": "timeline-content",
|
|
614
614
|
...props
|
|
615
615
|
}
|
|
@@ -633,7 +633,7 @@ function TimelineIndicator({
|
|
|
633
633
|
{
|
|
634
634
|
"aria-hidden": "true",
|
|
635
635
|
className: cn(
|
|
636
|
-
"border-primary/20 group-data-completed/timeline-item:border-primary absolute size-4 rounded-full border-2
|
|
636
|
+
"border-primary/20 group-data-completed/timeline-item:border-primary absolute size-4 rounded-full border-2 top-1.25 -left-6 -translate-x-1/2",
|
|
637
637
|
className
|
|
638
638
|
),
|
|
639
639
|
"data-slot": "timeline-indicator",
|
|
@@ -648,7 +648,7 @@ function TimelineItem({ step, className, ...props }) {
|
|
|
648
648
|
"div",
|
|
649
649
|
{
|
|
650
650
|
className: cn(
|
|
651
|
-
"group/timeline-item has-[+[data-completed]]:**:data-[slot=timeline-separator]:bg-primary relative flex flex-
|
|
651
|
+
"group/timeline-item has-[+[data-completed]]:**:data-[slot=timeline-separator]:bg-primary relative flex flex-col gap-0.5 ms-8 not-last:pb-6",
|
|
652
652
|
className
|
|
653
653
|
),
|
|
654
654
|
"data-completed": step <= activeStep || void 0,
|
|
@@ -666,7 +666,7 @@ function TimelineSeparator({
|
|
|
666
666
|
{
|
|
667
667
|
"aria-hidden": "true",
|
|
668
668
|
className: cn(
|
|
669
|
-
"bg-primary/10 absolute self-start group-last/timeline-item:hidden
|
|
669
|
+
"bg-primary/10 absolute self-start group-last/timeline-item:hidden -left-6 h-[calc(100%-1rem-0.25rem)] w-0.5 -translate-x-1/2 translate-y-4.5",
|
|
670
670
|
className
|
|
671
671
|
),
|
|
672
672
|
"data-slot": "timeline-separator",
|
|
@@ -1608,9 +1608,14 @@ function SessionSearchBlock({ tc }) {
|
|
|
1608
1608
|
query = args.query ?? "";
|
|
1609
1609
|
} catch {
|
|
1610
1610
|
}
|
|
1611
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-
|
|
1612
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1613
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
1611
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm py-0.5", children: [
|
|
1612
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchIcon, { className: "size-3.5 text-muted-foreground/60 shrink-0" }),
|
|
1613
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-foreground", children: "Session Search" }),
|
|
1614
|
+
query && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground/70 truncate text-xs italic", children: [
|
|
1615
|
+
"\u201C",
|
|
1616
|
+
query,
|
|
1617
|
+
"\u201D"
|
|
1618
|
+
] })
|
|
1614
1619
|
] });
|
|
1615
1620
|
}
|
|
1616
1621
|
function WebToolBlock({ tc }) {
|
|
@@ -1627,14 +1632,15 @@ function WebToolBlock({ tc }) {
|
|
|
1627
1632
|
}
|
|
1628
1633
|
} catch {
|
|
1629
1634
|
}
|
|
1630
|
-
const
|
|
1635
|
+
const toolLabel2 = {
|
|
1631
1636
|
web_extract: "Web Fetch",
|
|
1632
1637
|
web_search: "Web Search",
|
|
1633
1638
|
web_crawl: "Web Crawl"
|
|
1634
1639
|
}[tc.toolName] ?? tc.toolName;
|
|
1635
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-
|
|
1636
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1637
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-
|
|
1640
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm py-0.5", children: [
|
|
1641
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.GlobeIcon, { className: "size-3.5 text-muted-foreground/60 shrink-0" }),
|
|
1642
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-foreground", children: toolLabel2 }),
|
|
1643
|
+
displayText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 truncate text-xs", children: displayText })
|
|
1638
1644
|
] });
|
|
1639
1645
|
}
|
|
1640
1646
|
function Dialog({
|
|
@@ -3648,38 +3654,74 @@ function CoordinatorToolBlock({ tc }) {
|
|
|
3648
3654
|
] })
|
|
3649
3655
|
] });
|
|
3650
3656
|
}
|
|
3657
|
+
var TOOL_LABELS = {
|
|
3658
|
+
kb_list_pages: "Knowledge Base",
|
|
3659
|
+
kb_read_page: "Read KB Page",
|
|
3660
|
+
consult_expert: "Expert",
|
|
3661
|
+
delegate_task: "Delegate",
|
|
3662
|
+
memory: "Memory",
|
|
3663
|
+
skills_list: "Skills",
|
|
3664
|
+
skill_view: "Skill",
|
|
3665
|
+
create_artifact: "Artifact",
|
|
3666
|
+
process: "Process"
|
|
3667
|
+
};
|
|
3668
|
+
function toolLabel(name) {
|
|
3669
|
+
return TOOL_LABELS[name] ?? name.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
3670
|
+
}
|
|
3671
|
+
function toolSummary(tc) {
|
|
3672
|
+
try {
|
|
3673
|
+
const args = JSON.parse(tc.args);
|
|
3674
|
+
if (tc.toolName === "kb_list_pages") return args.kb_id ? `Listing pages` : "";
|
|
3675
|
+
if (tc.toolName === "kb_read_page") return args.path ?? "";
|
|
3676
|
+
if (tc.toolName === "consult_expert") return args.question?.slice(0, 60) ?? "";
|
|
3677
|
+
if (tc.toolName === "memory") return args.action ?? "";
|
|
3678
|
+
return "";
|
|
3679
|
+
} catch {
|
|
3680
|
+
return "";
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
function StatusIcon({ tc }) {
|
|
3684
|
+
const status = effectiveStatus(tc);
|
|
3685
|
+
if (status === "running") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-3.5 animate-spin text-primary" });
|
|
3686
|
+
if (status === "error") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-3.5 text-red-500" });
|
|
3687
|
+
if (status === "cancelled") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircleIcon, { className: "size-3.5 text-muted-foreground/40" });
|
|
3688
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle2Icon, { className: "size-3.5 text-emerald-500" });
|
|
3689
|
+
}
|
|
3651
3690
|
function DefaultToolBlock({ tc }) {
|
|
3652
3691
|
const [expanded, setExpanded] = react.useState(false);
|
|
3653
|
-
|
|
3692
|
+
const summary = toolSummary(tc);
|
|
3693
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-border/60 bg-muted/20 overflow-hidden", children: [
|
|
3654
3694
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3655
3695
|
"button",
|
|
3656
3696
|
{
|
|
3657
3697
|
type: "button",
|
|
3658
3698
|
onClick: () => setExpanded(!expanded),
|
|
3659
3699
|
className: cn(
|
|
3660
|
-
"flex w-full items-center gap-
|
|
3661
|
-
"text-sm
|
|
3700
|
+
"flex w-full items-center gap-2 px-3 py-2",
|
|
3701
|
+
"text-sm hover:bg-muted/40 transition-colors cursor-pointer"
|
|
3662
3702
|
),
|
|
3663
3703
|
children: [
|
|
3704
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { tc }),
|
|
3705
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-foreground", children: toolLabel(tc.toolName) }),
|
|
3706
|
+
summary && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 truncate text-xs flex-1 text-left", children: summary }),
|
|
3664
3707
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3665
3708
|
lucideReact.ChevronRightIcon,
|
|
3666
3709
|
{
|
|
3667
3710
|
className: cn(
|
|
3668
|
-
"size-3 shrink-0 transition-transform duration-150",
|
|
3711
|
+
"size-3.5 shrink-0 text-muted-foreground/50 transition-transform duration-150 ml-auto",
|
|
3669
3712
|
expanded && "rotate-90"
|
|
3670
3713
|
)
|
|
3671
3714
|
}
|
|
3672
|
-
)
|
|
3673
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-foreground/80", children: tc.toolName })
|
|
3715
|
+
)
|
|
3674
3716
|
]
|
|
3675
3717
|
}
|
|
3676
3718
|
),
|
|
3677
|
-
expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
3678
|
-
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "overflow-x-auto rounded bg-muted/
|
|
3679
|
-
tc.result && /* @__PURE__ */ jsxRuntime.jsxs("pre", { className: "overflow-x-auto rounded bg-muted/
|
|
3680
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-emerald-600 dark:text-emerald-400", children: "Result
|
|
3719
|
+
expanded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border/40 px-3 py-2 space-y-2", children: [
|
|
3720
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "overflow-x-auto rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground font-mono whitespace-pre-wrap break-all", children: formatArgs(tc.args) }),
|
|
3721
|
+
tc.result && /* @__PURE__ */ jsxRuntime.jsxs("pre", { className: "overflow-x-auto rounded-md bg-muted/50 px-3 py-2 text-xs font-mono whitespace-pre-wrap break-all max-h-48 overflow-y-auto", children: [
|
|
3722
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-emerald-600 dark:text-emerald-400 font-semibold", children: "Result" }),
|
|
3681
3723
|
"\n",
|
|
3682
|
-
truncate(tc.result, 2e3)
|
|
3724
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: truncate(tc.result, 2e3) })
|
|
3683
3725
|
] })
|
|
3684
3726
|
] })
|
|
3685
3727
|
] });
|
|
@@ -6138,14 +6180,14 @@ function ChatThread({
|
|
|
6138
6180
|
}
|
|
6139
6181
|
return null;
|
|
6140
6182
|
}, [messages]);
|
|
6141
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
6183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden bg-background text-sm", children: [
|
|
6142
6184
|
/* @__PURE__ */ jsxRuntime.jsxs(Conversation, { className: "relative flex-1 min-h-0", children: [
|
|
6143
|
-
/* @__PURE__ */ jsxRuntime.jsx(ConversationContent, { className: "mx-auto", children: messages.length === 0 && !disabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6185
|
+
/* @__PURE__ */ jsxRuntime.jsx(ConversationContent, { className: "mx-auto w-full max-w-3xl", children: messages.length === 0 && !disabled ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6144
6186
|
ConversationEmptyState,
|
|
6145
6187
|
{
|
|
6146
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquareIcon, { className: "size-
|
|
6147
|
-
title: "
|
|
6148
|
-
description: "
|
|
6188
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquareIcon, { className: "size-8 opacity-40" }),
|
|
6189
|
+
title: "Start a conversation",
|
|
6190
|
+
description: "Ask me anything \u2014 I can search, analyze, write code, and more."
|
|
6149
6191
|
}
|
|
6150
6192
|
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6151
6193
|
groups.map((group) => {
|
|
@@ -6193,7 +6235,7 @@ function ChatThread({
|
|
|
6193
6235
|
] }) }),
|
|
6194
6236
|
/* @__PURE__ */ jsxRuntime.jsx(ConversationScrollButton, {})
|
|
6195
6237
|
] }),
|
|
6196
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto w-full max-w-
|
|
6238
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mx-auto w-full max-w-3xl px-6 pb-5 pt-3", children: [
|
|
6197
6239
|
retryIndicator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(RetryBanner, { indicator: retryIndicator }) }),
|
|
6198
6240
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6199
6241
|
ChatComposer,
|
|
@@ -7835,8 +7877,8 @@ function AgentChat({
|
|
|
7835
7877
|
sessionId,
|
|
7836
7878
|
onFileSelect: handleFileSelect
|
|
7837
7879
|
},
|
|
7838
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex
|
|
7839
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7880
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "flex flex-1 min-h-0 overflow-hidden bg-background text-sm text-foreground", children: [
|
|
7881
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7840
7882
|
ChatThread,
|
|
7841
7883
|
{
|
|
7842
7884
|
sessionId,
|