@invergent/agent-chat-react 2.19.1 → 2.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +53 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -2
- package/dist/index.d.ts +23 -2
- package/dist/index.js +53 -107
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ var nextThemes = require('next-themes');
|
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var button = require('@invergent/ui-sdk/button');
|
|
10
10
|
var dropdownMenu = require('@invergent/ui-sdk/dropdown-menu');
|
|
11
|
+
var tabStrip = require('@invergent/ui-sdk/tab-strip');
|
|
11
12
|
var toggle = require('@invergent/ui-sdk/toggle');
|
|
12
13
|
var confirmDialog = require('@invergent/ui-sdk/confirm-dialog');
|
|
13
14
|
var dialog = require('@invergent/ui-sdk/dialog');
|
|
@@ -527,12 +528,11 @@ function BrowserShell({
|
|
|
527
528
|
(onToggleControl || hasControl) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
528
529
|
toggle.Toggle,
|
|
529
530
|
{
|
|
530
|
-
size: "
|
|
531
|
+
size: "icon-xs",
|
|
531
532
|
"data-testid": "browser-shell-control",
|
|
532
533
|
"aria-label": hasControl ? "Return control" : "Take control",
|
|
533
534
|
pressed: hasControl,
|
|
534
535
|
onPressedChange: () => onToggleControl?.(),
|
|
535
|
-
className: "size-7 min-h-11 min-w-11 px-0 pointer-fine:min-h-0 pointer-fine:min-w-0",
|
|
536
536
|
children: /* @__PURE__ */ jsxRuntime.jsx(Pointer, {})
|
|
537
537
|
}
|
|
538
538
|
),
|
|
@@ -590,45 +590,21 @@ function BrowserShell({
|
|
|
590
590
|
] })
|
|
591
591
|
] }),
|
|
592
592
|
showTabs && /* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
-
|
|
593
|
+
tabStrip.TabStrip,
|
|
594
594
|
{
|
|
595
595
|
"data-testid": "browser-shell-tabs",
|
|
596
|
-
className: "
|
|
597
|
-
children: tabs.map((tab) => (
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
"
|
|
602
|
-
{
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
onKeyDown: (event) => {
|
|
609
|
-
if (event.key === "Enter") send({ t: "switch_tab", id: tab.id });
|
|
610
|
-
},
|
|
611
|
-
className: `flex h-6 max-w-33 cursor-pointer items-center gap-1 truncate rounded px-2 text-[11px] ${tab.active ? "bg-secondary text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
612
|
-
children: [
|
|
613
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: tab.title || tab.url }),
|
|
614
|
-
hasControl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
615
|
-
"button",
|
|
616
|
-
{
|
|
617
|
-
type: "button",
|
|
618
|
-
"data-testid": "browser-shell-tab-close",
|
|
619
|
-
"aria-label": `Close ${tab.title || tab.url}`,
|
|
620
|
-
onClick: (event) => {
|
|
621
|
-
event.stopPropagation();
|
|
622
|
-
command({ t: "close_tab", id: tab.id });
|
|
623
|
-
},
|
|
624
|
-
className: "flex size-3.5 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-secondary hover:text-foreground",
|
|
625
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(XSmall, {})
|
|
626
|
-
}
|
|
627
|
-
)
|
|
628
|
-
]
|
|
629
|
-
},
|
|
630
|
-
tab.id
|
|
631
|
-
)
|
|
596
|
+
className: "min-h-[34px] border-b border-line bg-card px-1.5",
|
|
597
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
598
|
+
tabStrip.TabStripTab,
|
|
599
|
+
{
|
|
600
|
+
active: tab.active,
|
|
601
|
+
"data-testid": "browser-shell-tab",
|
|
602
|
+
onSelect: () => send({ t: "switch_tab", id: tab.id }),
|
|
603
|
+
onClose: hasControl ? () => command({ t: "close_tab", id: tab.id }) : void 0,
|
|
604
|
+
closeLabel: `Close ${tab.title || tab.url}`,
|
|
605
|
+
children: tab.title || tab.url
|
|
606
|
+
},
|
|
607
|
+
tab.id
|
|
632
608
|
))
|
|
633
609
|
}
|
|
634
610
|
),
|
|
@@ -708,10 +684,6 @@ var Pointer = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...svg, children: [
|
|
|
708
684
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.586 12.586 19 19" }),
|
|
709
685
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z" })
|
|
710
686
|
] });
|
|
711
|
-
var XSmall = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...svg, width: 10, height: 10, className: "size-2.5", children: [
|
|
712
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6 6 18" }),
|
|
713
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12" })
|
|
714
|
-
] });
|
|
715
687
|
var Ellipsis = () => /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...svg, children: [
|
|
716
688
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "1" }),
|
|
717
689
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "19", cy: "12", r: "1" }),
|
|
@@ -2247,7 +2219,7 @@ var statusLabels = {
|
|
|
2247
2219
|
};
|
|
2248
2220
|
var statusTones = {
|
|
2249
2221
|
"approval-requested": "warn",
|
|
2250
|
-
"approval-responded": "
|
|
2222
|
+
"approval-responded": "info",
|
|
2251
2223
|
"input-available": "muted",
|
|
2252
2224
|
"input-streaming": "muted",
|
|
2253
2225
|
"output-available": "ok",
|
|
@@ -4556,7 +4528,7 @@ function StatusIcon({ tc }) {
|
|
|
4556
4528
|
function DefaultToolBlock({ tc }) {
|
|
4557
4529
|
const summary = toolSummary(tc);
|
|
4558
4530
|
return /* @__PURE__ */ jsxRuntime.jsxs(collapsible.Collapsible, { className: "overflow-hidden rounded-[10px] border border-foreground/[0.08]", children: [
|
|
4559
|
-
/* @__PURE__ */ jsxRuntime.jsx(collapsibleHeader.CollapsibleHeader, { variant: "section", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4531
|
+
/* @__PURE__ */ jsxRuntime.jsx(collapsibleHeader.CollapsibleHeader, { variant: "section", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
4560
4532
|
/* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { tc }),
|
|
4561
4533
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0", children: toolLabel(tc.toolName) }),
|
|
4562
4534
|
summary && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate text-xs font-normal text-muted-foreground/70", children: summary })
|
|
@@ -7293,7 +7265,7 @@ function ResearchSourcesPanel({
|
|
|
7293
7265
|
onOpenChange: setExpanded,
|
|
7294
7266
|
className: "rounded-[10px] border border-foreground/[0.08] bg-card",
|
|
7295
7267
|
children: [
|
|
7296
|
-
/* @__PURE__ */ jsxRuntime.jsxs(collapsibleHeader.CollapsibleHeader, { variant: "section", children: [
|
|
7268
|
+
/* @__PURE__ */ jsxRuntime.jsxs(collapsibleHeader.CollapsibleHeader, { variant: "section", size: "sm", children: [
|
|
7297
7269
|
"Sources \xB7 ",
|
|
7298
7270
|
sources.length
|
|
7299
7271
|
] }),
|
|
@@ -14627,8 +14599,6 @@ var TOOLS = [
|
|
|
14627
14599
|
{ id: "select", label: "Select", Icon: lucideReact.MousePointer2 },
|
|
14628
14600
|
{ id: "pan", label: "Pan", Icon: lucideReact.Hand }
|
|
14629
14601
|
];
|
|
14630
|
-
var TOOL_ITEM = "size-9 px-0 pointer-coarse:size-11";
|
|
14631
|
-
var SWATCH_ITEM = "size-7 px-0 pointer-coarse:size-11";
|
|
14632
14602
|
function ToolRail({
|
|
14633
14603
|
tool,
|
|
14634
14604
|
onToolChange,
|
|
@@ -14662,7 +14632,7 @@ function ToolRail({
|
|
|
14662
14632
|
if (next) onToolChange(next);
|
|
14663
14633
|
},
|
|
14664
14634
|
disabled,
|
|
14665
|
-
children: TOOLS.map(({ id, label, Icon }) => /* @__PURE__ */ jsxRuntime.jsx(toggleGroup.ToggleGroupItem, { value: id, "aria-label": label,
|
|
14635
|
+
children: TOOLS.map(({ id, label, Icon }) => /* @__PURE__ */ jsxRuntime.jsx(toggleGroup.ToggleGroupItem, { value: id, "aria-label": label, size: "icon", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4" }) }, id))
|
|
14666
14636
|
}
|
|
14667
14637
|
),
|
|
14668
14638
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px w-full bg-border" }),
|
|
@@ -14679,7 +14649,7 @@ function ToolRail({
|
|
|
14679
14649
|
if (next) onColorChange(next);
|
|
14680
14650
|
},
|
|
14681
14651
|
disabled,
|
|
14682
|
-
children: INK_COLORS.map((c) => /* @__PURE__ */ jsxRuntime.jsx(toggleGroup.ToggleGroupItem, { value: c, "aria-label": `Colour ${c}`,
|
|
14652
|
+
children: INK_COLORS.map((c) => /* @__PURE__ */ jsxRuntime.jsx(toggleGroup.ToggleGroupItem, { value: c, "aria-label": `Colour ${c}`, size: "icon-xs", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-5 rounded-full", style: { backgroundColor: c } }) }, c))
|
|
14683
14653
|
}
|
|
14684
14654
|
),
|
|
14685
14655
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px w-full bg-border" }),
|
|
@@ -14696,7 +14666,7 @@ function ToolRail({
|
|
|
14696
14666
|
if (next) onWidthChange(Number(next));
|
|
14697
14667
|
},
|
|
14698
14668
|
disabled,
|
|
14699
|
-
children: INK_WIDTHS.map((w) => /* @__PURE__ */ jsxRuntime.jsx(toggleGroup.ToggleGroupItem, { value: String(w), "aria-label": `Width ${w}`,
|
|
14669
|
+
children: INK_WIDTHS.map((w) => /* @__PURE__ */ jsxRuntime.jsx(toggleGroup.ToggleGroupItem, { value: String(w), "aria-label": `Width ${w}`, size: "icon-xs", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14700
14670
|
"span",
|
|
14701
14671
|
{
|
|
14702
14672
|
className: "rounded-full bg-foreground",
|
|
@@ -15810,6 +15780,7 @@ function OfficeEditorPane({ adapter, sessionId, path, view, officeEvent, onClose
|
|
|
15810
15780
|
const placeholderId = `office-editor-${react.useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
15811
15781
|
const [error, setError] = react.useState(null);
|
|
15812
15782
|
const [loading, setLoading] = react.useState(true);
|
|
15783
|
+
const [mentionTrouble, setMentionTrouble] = react.useState(null);
|
|
15813
15784
|
const [openedAfter] = react.useState(() => officeEvent?.eventId ?? 0);
|
|
15814
15785
|
const notice = officeEvent && officeEvent.eventId > openedAfter ? officeEvent : null;
|
|
15815
15786
|
const [reopenedFor, setReopenedFor] = react.useState(0);
|
|
@@ -15826,6 +15797,7 @@ function OfficeEditorPane({ adapter, sessionId, path, view, officeEvent, onClose
|
|
|
15826
15797
|
let editor = null;
|
|
15827
15798
|
setError(null);
|
|
15828
15799
|
setLoading(true);
|
|
15800
|
+
setMentionTrouble(null);
|
|
15829
15801
|
void (async () => {
|
|
15830
15802
|
try {
|
|
15831
15803
|
if (!adapter.getWorkspaceEditorConfig) throw new Error("Preview not available. Download the file to open it.");
|
|
@@ -15833,7 +15805,31 @@ function OfficeEditorPane({ adapter, sessionId, path, view, officeEvent, onClose
|
|
|
15833
15805
|
await loadDocsApi(opened.document_server_url);
|
|
15834
15806
|
if (cancelled) return;
|
|
15835
15807
|
if (!window.DocsAPI) throw new Error("The document editor could not be loaded.");
|
|
15836
|
-
|
|
15808
|
+
const users = opened.mentionable_users ?? [];
|
|
15809
|
+
const notify = adapter.notifyWorkspaceEditorMention?.bind(adapter);
|
|
15810
|
+
const events = users.length && notify ? {
|
|
15811
|
+
onRequestUsers: (event) => {
|
|
15812
|
+
const c = event.data?.c;
|
|
15813
|
+
editor?.setUsers({ c, users: c === "mention" || c === "info" ? users : [] });
|
|
15814
|
+
},
|
|
15815
|
+
onRequestSendNotify: (event) => {
|
|
15816
|
+
const mention = event.data ?? {};
|
|
15817
|
+
const emails = mention.emails ?? [];
|
|
15818
|
+
const named2 = new Set(emails.map((email) => email.toLowerCase()));
|
|
15819
|
+
if (!users.some((user) => named2.has(user.email.toLowerCase()))) return;
|
|
15820
|
+
setMentionTrouble(null);
|
|
15821
|
+
void notify({
|
|
15822
|
+
sessionId,
|
|
15823
|
+
path,
|
|
15824
|
+
emails,
|
|
15825
|
+
message: mention.message ?? "",
|
|
15826
|
+
commentId: String(mention.actionLink?.action?.data ?? mention.actionId ?? "")
|
|
15827
|
+
}).catch((sendError) => {
|
|
15828
|
+
if (!cancelled) setMentionTrouble(`The agent was not told about your comment: ${sendError.message}`);
|
|
15829
|
+
});
|
|
15830
|
+
}
|
|
15831
|
+
} : null;
|
|
15832
|
+
editor = new window.DocsAPI.DocEditor(placeholderId, events ? { ...opened.config, events } : opened.config);
|
|
15837
15833
|
} catch (openError) {
|
|
15838
15834
|
if (!cancelled) setError(openError.message);
|
|
15839
15835
|
} finally {
|
|
@@ -15885,6 +15881,7 @@ function OfficeEditorPane({ adapter, sessionId, path, view, officeEvent, onClose
|
|
|
15885
15881
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: error })
|
|
15886
15882
|
] }),
|
|
15887
15883
|
notice && saveNotice(notice) && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", className: "border-b border-line px-3 py-2 text-xs text-muted-foreground", children: saveNotice(notice) }),
|
|
15884
|
+
mentionTrouble && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", className: "border-b border-line px-3 py-2 text-xs text-muted-foreground", children: mentionTrouble }),
|
|
15888
15885
|
loading && !error && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3 text-sm text-muted-foreground", children: [
|
|
15889
15886
|
"Opening ",
|
|
15890
15887
|
fileName2,
|
|
@@ -16565,7 +16562,7 @@ function WorkspacePanel({
|
|
|
16565
16562
|
)
|
|
16566
16563
|
] }) }),
|
|
16567
16564
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16568
|
-
|
|
16565
|
+
confirmDialog.ConfirmDialog,
|
|
16569
16566
|
{
|
|
16570
16567
|
open: deleteTarget !== null,
|
|
16571
16568
|
title: "Delete file?",
|
|
@@ -16585,53 +16582,6 @@ function WorkspacePanel({
|
|
|
16585
16582
|
)
|
|
16586
16583
|
);
|
|
16587
16584
|
}
|
|
16588
|
-
function ConfirmDialog2({
|
|
16589
|
-
open,
|
|
16590
|
-
title,
|
|
16591
|
-
description,
|
|
16592
|
-
confirmLabel,
|
|
16593
|
-
loading,
|
|
16594
|
-
onConfirm,
|
|
16595
|
-
onCancel
|
|
16596
|
-
}) {
|
|
16597
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16598
|
-
dialog.Dialog,
|
|
16599
|
-
{
|
|
16600
|
-
open,
|
|
16601
|
-
onOpenChange: (nextOpen) => {
|
|
16602
|
-
if (!nextOpen && !loading) onCancel();
|
|
16603
|
-
},
|
|
16604
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16605
|
-
dialog.DialogContent,
|
|
16606
|
-
{
|
|
16607
|
-
showCloseButton: false,
|
|
16608
|
-
className: "gap-3.5 px-6 pt-6 pb-5 sm:max-w-[430px]",
|
|
16609
|
-
children: [
|
|
16610
|
-
/* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogHeader, { children: [
|
|
16611
|
-
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogTitle, { children: title }),
|
|
16612
|
-
/* @__PURE__ */ jsxRuntime.jsx(dialog.DialogDescription, { children: description })
|
|
16613
|
-
] }),
|
|
16614
|
-
/* @__PURE__ */ jsxRuntime.jsxs(dialog.DialogFooter, { className: "pt-1.5", children: [
|
|
16615
|
-
/* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "outline", disabled: loading, onClick: onCancel, children: "Cancel" }),
|
|
16616
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16617
|
-
button.Button,
|
|
16618
|
-
{
|
|
16619
|
-
variant: "destructive",
|
|
16620
|
-
disabled: loading,
|
|
16621
|
-
onClick: onConfirm,
|
|
16622
|
-
children: [
|
|
16623
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "mr-1.5 size-3.5 animate-spin" }),
|
|
16624
|
-
confirmLabel
|
|
16625
|
-
]
|
|
16626
|
-
}
|
|
16627
|
-
)
|
|
16628
|
-
] })
|
|
16629
|
-
]
|
|
16630
|
-
}
|
|
16631
|
-
)
|
|
16632
|
-
}
|
|
16633
|
-
);
|
|
16634
|
-
}
|
|
16635
16585
|
|
|
16636
16586
|
// src/agent-chat.tsx
|
|
16637
16587
|
init_utils();
|
|
@@ -16675,12 +16625,7 @@ function readOnlyReasonForSession(session) {
|
|
|
16675
16625
|
}
|
|
16676
16626
|
return { readOnly: false };
|
|
16677
16627
|
}
|
|
16678
|
-
var RIGHT_STACK_STYLE = {
|
|
16679
|
-
// Both the column's width and the chat panel's right offset read this, so
|
|
16680
|
-
// one value keeps them complementary. 50%: the browser shell renders a real
|
|
16681
|
-
// page, and page layouts are unusable in a 440px strip.
|
|
16682
|
-
["--right-stack-w"]: "50%"
|
|
16683
|
-
};
|
|
16628
|
+
var RIGHT_STACK_STYLE = { ["--right-stack-w"]: "75%" };
|
|
16684
16629
|
var MOBILE_PANE_LABELS = {
|
|
16685
16630
|
chat: "Chat",
|
|
16686
16631
|
browser: "Browser",
|
|
@@ -18695,6 +18640,7 @@ function compareNodes(a, b) {
|
|
|
18695
18640
|
}
|
|
18696
18641
|
var IDEA_STATUS_TONE = {
|
|
18697
18642
|
merged: "ok",
|
|
18643
|
+
done: "info",
|
|
18698
18644
|
running: "warn",
|
|
18699
18645
|
failed: "bad"
|
|
18700
18646
|
};
|
|
@@ -19026,7 +18972,7 @@ function TaskDetail({
|
|
|
19026
18972
|
/* @__PURE__ */ jsxRuntime.jsx(MessageResponse, { className: "text-sm leading-relaxed text-foreground/90", children: task.goal })
|
|
19027
18973
|
] }),
|
|
19028
18974
|
task.resultMetadata ? /* @__PURE__ */ jsxRuntime.jsxs(collapsible.Collapsible, { className: "rounded-[10px] border border-foreground/[0.08]", children: [
|
|
19029
|
-
/* @__PURE__ */ jsxRuntime.jsx(collapsibleHeader.CollapsibleHeader, { variant: "section", children: "Result metadata" }),
|
|
18975
|
+
/* @__PURE__ */ jsxRuntime.jsx(collapsibleHeader.CollapsibleHeader, { variant: "section", size: "sm", children: "Result metadata" }),
|
|
19030
18976
|
/* @__PURE__ */ jsxRuntime.jsx(collapsible.CollapsibleContent, { children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap border-t border-foreground/[0.08] px-3 py-2 text-[11px] text-foreground/90", children: JSON.stringify(task.resultMetadata, null, 2) }) })
|
|
19031
18977
|
] }) : null,
|
|
19032
18978
|
eventsSupported && taskEvents.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|