@invergent/agent-chat-react 1.4.9 → 1.4.10
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 +49 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +49 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7944,15 +7944,16 @@ function TreeNodeRow({
|
|
|
7944
7944
|
depth,
|
|
7945
7945
|
activeSessionId,
|
|
7946
7946
|
canStop,
|
|
7947
|
+
canDelete,
|
|
7948
|
+
deletingSessionId,
|
|
7947
7949
|
onSelect,
|
|
7948
|
-
onStop
|
|
7950
|
+
onStop,
|
|
7951
|
+
onDelete
|
|
7949
7952
|
}) {
|
|
7950
7953
|
const [expanded, setExpanded] = react.useState(true);
|
|
7951
7954
|
const hasChildren = entry.children.length > 0;
|
|
7952
7955
|
const isActive = entry.id === activeSessionId;
|
|
7953
7956
|
const isRunning = entry.status === "active";
|
|
7954
|
-
const messageCount = entry.messageCount ?? 0;
|
|
7955
|
-
const toolCallCount = entry.toolCallCount ?? 0;
|
|
7956
7957
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7957
7958
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7958
7959
|
"div",
|
|
@@ -7984,7 +7985,7 @@ function TreeNodeRow({
|
|
|
7984
7985
|
}
|
|
7985
7986
|
) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-4 h-4 shrink-0" }),
|
|
7986
7987
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0 flex items-center gap-1.5", children: [
|
|
7987
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: entry.title ??
|
|
7988
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: entry.title ?? "session" }),
|
|
7988
7989
|
entry.agentType && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "h-4 px-1.5 text-[10px]", children: entry.agentType }),
|
|
7989
7990
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7990
7991
|
Badge,
|
|
@@ -7995,20 +7996,6 @@ function TreeNodeRow({
|
|
|
7995
7996
|
}
|
|
7996
7997
|
)
|
|
7997
7998
|
] }),
|
|
7998
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
7999
|
-
"span",
|
|
8000
|
-
{
|
|
8001
|
-
className: "text-xs text-faint shrink-0 tabular-nums",
|
|
8002
|
-
"aria-label": `${messageCount} messages, ${toolCallCount} tool calls`,
|
|
8003
|
-
title: `${messageCount} messages, ${toolCallCount} tool calls`,
|
|
8004
|
-
children: [
|
|
8005
|
-
messageCount,
|
|
8006
|
-
"m/",
|
|
8007
|
-
toolCallCount,
|
|
8008
|
-
"t"
|
|
8009
|
-
]
|
|
8010
|
-
}
|
|
8011
|
-
),
|
|
8012
7999
|
isRunning && canStop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8013
8000
|
"button",
|
|
8014
8001
|
{
|
|
@@ -8022,6 +8009,21 @@ function TreeNodeRow({
|
|
|
8022
8009
|
title: "Stop sub-agent",
|
|
8023
8010
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SquareIcon, { className: "w-3 h-3", fill: "currentColor" })
|
|
8024
8011
|
}
|
|
8012
|
+
),
|
|
8013
|
+
canDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8014
|
+
"button",
|
|
8015
|
+
{
|
|
8016
|
+
type: "button",
|
|
8017
|
+
className: "p-1 rounded opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-50 transition-all",
|
|
8018
|
+
onClick: (e) => {
|
|
8019
|
+
e.stopPropagation();
|
|
8020
|
+
onDelete(entry.id);
|
|
8021
|
+
},
|
|
8022
|
+
"aria-label": "Delete session",
|
|
8023
|
+
title: "Delete session",
|
|
8024
|
+
disabled: deletingSessionId === entry.id,
|
|
8025
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2Icon, { className: "w-3 h-3" })
|
|
8026
|
+
}
|
|
8025
8027
|
)
|
|
8026
8028
|
]
|
|
8027
8029
|
}
|
|
@@ -8033,8 +8035,11 @@ function TreeNodeRow({
|
|
|
8033
8035
|
depth: depth + 1,
|
|
8034
8036
|
activeSessionId,
|
|
8035
8037
|
canStop,
|
|
8038
|
+
canDelete,
|
|
8039
|
+
deletingSessionId,
|
|
8036
8040
|
onSelect,
|
|
8037
|
-
onStop
|
|
8041
|
+
onStop,
|
|
8042
|
+
onDelete
|
|
8038
8043
|
},
|
|
8039
8044
|
child.id
|
|
8040
8045
|
))
|
|
@@ -8048,12 +8053,16 @@ function SessionTreePanel({
|
|
|
8048
8053
|
title = "Running",
|
|
8049
8054
|
sessionListLimit = DEFAULT_SESSION_LIST_LIMIT,
|
|
8050
8055
|
hideRoot = false,
|
|
8051
|
-
onSessionSelect
|
|
8056
|
+
onSessionSelect,
|
|
8057
|
+
onSessionDelete
|
|
8052
8058
|
}) {
|
|
8053
8059
|
const [nodes, setNodes] = react.useState([]);
|
|
8054
8060
|
const [loading, setLoading] = react.useState(false);
|
|
8055
8061
|
const [error, setError] = react.useState(null);
|
|
8056
8062
|
const [hasEverLoaded, setHasEverLoaded] = react.useState(false);
|
|
8063
|
+
const [deletingSessionId, setDeletingSessionId] = react.useState(
|
|
8064
|
+
null
|
|
8065
|
+
);
|
|
8057
8066
|
const mounted = react.useRef(true);
|
|
8058
8067
|
const requestId = react.useRef(0);
|
|
8059
8068
|
const lastFingerprint = react.useRef("");
|
|
@@ -8147,6 +8156,22 @@ function SessionTreePanel({
|
|
|
8147
8156
|
},
|
|
8148
8157
|
[adapter, refetch]
|
|
8149
8158
|
);
|
|
8159
|
+
const handleDelete = react.useCallback(
|
|
8160
|
+
async (id) => {
|
|
8161
|
+
if (!adapter.deleteSession || deletingSessionId) return;
|
|
8162
|
+
setDeletingSessionId(id);
|
|
8163
|
+
try {
|
|
8164
|
+
await adapter.deleteSession({ sessionId: id });
|
|
8165
|
+
onSessionDelete?.(id);
|
|
8166
|
+
await refetch({ silent: true });
|
|
8167
|
+
} catch (e) {
|
|
8168
|
+
setError(e instanceof Error ? e.message : "Failed to delete session");
|
|
8169
|
+
} finally {
|
|
8170
|
+
if (mounted.current) setDeletingSessionId(null);
|
|
8171
|
+
}
|
|
8172
|
+
},
|
|
8173
|
+
[adapter, deletingSessionId, onSessionDelete, refetch]
|
|
8174
|
+
);
|
|
8150
8175
|
if (!hasEverLoaded) return null;
|
|
8151
8176
|
if (nodes.length === 0) return null;
|
|
8152
8177
|
const topLevel = hideRoot ? roots.flatMap((r) => r.children) : roots;
|
|
@@ -8166,8 +8191,11 @@ function SessionTreePanel({
|
|
|
8166
8191
|
depth: 0,
|
|
8167
8192
|
activeSessionId: activeSessionId ?? "",
|
|
8168
8193
|
canStop: Boolean(adapter.stopSession),
|
|
8194
|
+
canDelete: Boolean(adapter.deleteSession),
|
|
8195
|
+
deletingSessionId,
|
|
8169
8196
|
onSelect: handleSelect,
|
|
8170
|
-
onStop: handleStop
|
|
8197
|
+
onStop: handleStop,
|
|
8198
|
+
onDelete: handleDelete
|
|
8171
8199
|
},
|
|
8172
8200
|
entry.id
|
|
8173
8201
|
)) })
|