@invergent/agent-chat-react 1.6.8 → 1.7.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 +22 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -908,8 +908,7 @@ var useReasoning = () => {
|
|
|
908
908
|
}
|
|
909
909
|
return context;
|
|
910
910
|
};
|
|
911
|
-
var
|
|
912
|
-
var AUTO_OPEN_DELAY = 100;
|
|
911
|
+
var MIN_DURATION_MS = 100;
|
|
913
912
|
var MS_IN_S = 1e3;
|
|
914
913
|
var Reasoning = react.memo(
|
|
915
914
|
({
|
|
@@ -923,7 +922,6 @@ var Reasoning = react.memo(
|
|
|
923
922
|
...props
|
|
924
923
|
}) => {
|
|
925
924
|
const resolvedDefaultOpen = defaultOpen ?? false;
|
|
926
|
-
const isExplicitlyClosed = defaultOpen === false;
|
|
927
925
|
const [isOpen, setIsOpen] = reactUseControllableState.useControllableState({
|
|
928
926
|
defaultProp: resolvedDefaultOpen,
|
|
929
927
|
onChange: onOpenChange,
|
|
@@ -933,8 +931,6 @@ var Reasoning = react.memo(
|
|
|
933
931
|
defaultProp: void 0,
|
|
934
932
|
prop: durationProp
|
|
935
933
|
});
|
|
936
|
-
const hasEverStreamedRef = react.useRef(false);
|
|
937
|
-
const [hasAutoClosed, setHasAutoClosed] = react.useState(false);
|
|
938
934
|
const startTimeRef = react.useRef(null);
|
|
939
935
|
react.useEffect(() => {
|
|
940
936
|
if (isStreaming) {
|
|
@@ -944,29 +940,11 @@ var Reasoning = react.memo(
|
|
|
944
940
|
} else if (startTimeRef.current !== null) {
|
|
945
941
|
const elapsed = Date.now() - startTimeRef.current;
|
|
946
942
|
startTimeRef.current = null;
|
|
947
|
-
if (elapsed >=
|
|
948
|
-
hasEverStreamedRef.current = true;
|
|
943
|
+
if (elapsed >= MIN_DURATION_MS) {
|
|
949
944
|
setDuration(Math.ceil(elapsed / MS_IN_S));
|
|
950
945
|
}
|
|
951
946
|
}
|
|
952
947
|
}, [isStreaming, setDuration]);
|
|
953
|
-
react.useEffect(() => {
|
|
954
|
-
if (!isStreaming || isOpen || isExplicitlyClosed) return;
|
|
955
|
-
const timer = setTimeout(() => {
|
|
956
|
-
hasEverStreamedRef.current = true;
|
|
957
|
-
setIsOpen(true);
|
|
958
|
-
}, AUTO_OPEN_DELAY);
|
|
959
|
-
return () => clearTimeout(timer);
|
|
960
|
-
}, [isStreaming, isOpen, setIsOpen, isExplicitlyClosed]);
|
|
961
|
-
react.useEffect(() => {
|
|
962
|
-
if (hasEverStreamedRef.current && !isStreaming && isOpen && !hasAutoClosed) {
|
|
963
|
-
const timer = setTimeout(() => {
|
|
964
|
-
setIsOpen(false);
|
|
965
|
-
setHasAutoClosed(true);
|
|
966
|
-
}, AUTO_CLOSE_DELAY);
|
|
967
|
-
return () => clearTimeout(timer);
|
|
968
|
-
}
|
|
969
|
-
}, [isStreaming, isOpen, setIsOpen, hasAutoClosed]);
|
|
970
948
|
const handleOpenChange = react.useCallback(
|
|
971
949
|
(newOpen) => {
|
|
972
950
|
setIsOpen(newOpen);
|
|
@@ -1392,7 +1370,7 @@ function TerminalCollapsible({ command, output, isRunning, hasError }) {
|
|
|
1392
1370
|
className: "not-prose w-full",
|
|
1393
1371
|
children: [
|
|
1394
1372
|
/* @__PURE__ */ jsxRuntime.jsxs(CollapsibleTrigger, { className: "group/trigger flex w-fit items-center gap-2 text-sm transition-colors", children: [
|
|
1395
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-left", children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Shimmer, { as: "span", duration: 1, children: "Running command..." }) : hasError ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-destructive", children: "Command failed" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground", children: "Command
|
|
1373
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-left", children: isRunning ? /* @__PURE__ */ jsxRuntime.jsx(Shimmer, { as: "span", duration: 1, children: "Running command..." }) : hasError ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-destructive", children: "Command failed" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground", children: "Command" }) }),
|
|
1396
1374
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1397
1375
|
lucideReact.ChevronDownIcon,
|
|
1398
1376
|
{
|
|
@@ -1443,14 +1421,16 @@ function TerminalToolBlock({ tc }) {
|
|
|
1443
1421
|
const isRunning = tc.status === "running";
|
|
1444
1422
|
const result = parseTerminalResult(tc.result, tc.args);
|
|
1445
1423
|
if (result) {
|
|
1446
|
-
const
|
|
1424
|
+
const hasError = result.exit_code !== 0 || Boolean(result.error);
|
|
1425
|
+
if (hasError) return null;
|
|
1426
|
+
const output = result.output || "";
|
|
1447
1427
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1448
1428
|
TerminalCollapsible,
|
|
1449
1429
|
{
|
|
1450
1430
|
command: result.command,
|
|
1451
1431
|
output,
|
|
1452
1432
|
isRunning,
|
|
1453
|
-
hasError:
|
|
1433
|
+
hasError: false
|
|
1454
1434
|
}
|
|
1455
1435
|
);
|
|
1456
1436
|
}
|
|
@@ -6678,6 +6658,10 @@ function messageToEntries(msg, isLast, artifactFallbacks) {
|
|
|
6678
6658
|
});
|
|
6679
6659
|
continue;
|
|
6680
6660
|
}
|
|
6661
|
+
if (tc.toolName === "terminal" && tc.status !== "running") {
|
|
6662
|
+
const parsed = parseTerminalResult(tc.result, tc.args);
|
|
6663
|
+
if (parsed && (parsed.exit_code !== 0 || parsed.error)) continue;
|
|
6664
|
+
}
|
|
6681
6665
|
entries.push({ kind: "tool", key: tc.id, tc });
|
|
6682
6666
|
}
|
|
6683
6667
|
}
|
|
@@ -9362,7 +9346,7 @@ function AgentChat({
|
|
|
9362
9346
|
"div",
|
|
9363
9347
|
{
|
|
9364
9348
|
"data-testid": "workspace-panel-frame",
|
|
9365
|
-
className: hasBrowserPanel ? "h-1/2 min-h-0 w-full overflow-hidden" : "min-h-0",
|
|
9349
|
+
className: hasBrowserPanel ? "h-1/2 min-h-0 w-full overflow-hidden" : "min-h-0 h-full",
|
|
9366
9350
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9367
9351
|
WorkspacePanel,
|
|
9368
9352
|
{
|
|
@@ -10081,10 +10065,11 @@ function formatKind(value) {
|
|
|
10081
10065
|
if (!value) return "Scheduled";
|
|
10082
10066
|
return value.split(/[_-]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
10083
10067
|
}
|
|
10084
|
-
function formatRelative2(value, label) {
|
|
10068
|
+
function formatRelative2(value, label, future = false) {
|
|
10085
10069
|
if (!value) return null;
|
|
10086
10070
|
const date = new Date(value);
|
|
10087
10071
|
if (Number.isNaN(date.getTime())) return null;
|
|
10072
|
+
if (future && date.getTime() <= Date.now()) return `${label} due now`;
|
|
10088
10073
|
return `${label} ${dateFns.formatDistanceToNow(date, { addSuffix: true })}`;
|
|
10089
10074
|
}
|
|
10090
10075
|
function formatRuns(count) {
|
|
@@ -10131,10 +10116,10 @@ function ScheduledWorkRow({
|
|
|
10131
10116
|
const lastSessionId = item.lastSessionId ?? null;
|
|
10132
10117
|
const meta = [
|
|
10133
10118
|
scheduleDisplay(item),
|
|
10134
|
-
formatRelative2(item.nextRunAt, "Next"),
|
|
10119
|
+
formatRelative2(item.nextRunAt, "Next", true),
|
|
10135
10120
|
formatRelative2(item.lastRunAt, "Last"),
|
|
10136
10121
|
formatRuns(item.runCount),
|
|
10137
|
-
item.expiresAt ? formatRelative2(item.expiresAt, "Expires") : null
|
|
10122
|
+
item.expiresAt ? formatRelative2(item.expiresAt, "Expires", true) : null
|
|
10138
10123
|
].filter(Boolean);
|
|
10139
10124
|
const openLastRun = () => {
|
|
10140
10125
|
if (lastSessionId) onOpenLastRun(lastSessionId);
|
|
@@ -10486,8 +10471,7 @@ function TreeNodeRow({
|
|
|
10486
10471
|
const title = entry.title ?? fallbackSessionTitle(entry);
|
|
10487
10472
|
const subtitle = [
|
|
10488
10473
|
formatRunKind(entry.runKind),
|
|
10489
|
-
entry.agentType,
|
|
10490
|
-
entry.model ?? "default",
|
|
10474
|
+
entry.model ?? entry.agentType,
|
|
10491
10475
|
formatSessionTime(entry.updatedAt)
|
|
10492
10476
|
].filter(Boolean).join(" \xB7 ");
|
|
10493
10477
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -10542,7 +10526,10 @@ function TreeNodeRow({
|
|
|
10542
10526
|
"button",
|
|
10543
10527
|
{
|
|
10544
10528
|
type: "button",
|
|
10545
|
-
className:
|
|
10529
|
+
className: cn(
|
|
10530
|
+
"p-1 rounded hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none transition-all",
|
|
10531
|
+
deletingSessionId === entry.id ? "opacity-100" : "opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
|
|
10532
|
+
),
|
|
10546
10533
|
onClick: (e) => {
|
|
10547
10534
|
e.stopPropagation();
|
|
10548
10535
|
onDelete(entry.id);
|
|
@@ -10550,7 +10537,7 @@ function TreeNodeRow({
|
|
|
10550
10537
|
"aria-label": "Delete session",
|
|
10551
10538
|
title: "Delete session",
|
|
10552
10539
|
disabled: deletingSessionId === entry.id,
|
|
10553
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2Icon, { className: "w-3 h-3" })
|
|
10540
|
+
children: deletingSessionId === entry.id ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "w-3 h-3 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2Icon, { className: "w-3 h-3" })
|
|
10554
10541
|
}
|
|
10555
10542
|
)
|
|
10556
10543
|
]
|