@invergent/agent-chat-react 2.8.0 → 2.8.1
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 +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1265,6 +1265,10 @@ declare function ScheduledWorkPanel({ adapter, agentId, title, limit, status, hi
|
|
|
1265
1265
|
interface SessionTreePanelProps {
|
|
1266
1266
|
adapter: AgentChatAdapter;
|
|
1267
1267
|
sessionId?: string | null;
|
|
1268
|
+
/**
|
|
1269
|
+
* ID of the currently highlighted session. Defaults to `sessionId`.
|
|
1270
|
+
* Pass `""` (empty string) to clear the active highlight when `sessionId` is set.
|
|
1271
|
+
*/
|
|
1268
1272
|
activeSessionId?: string;
|
|
1269
1273
|
agentId?: string;
|
|
1270
1274
|
title?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1265,6 +1265,10 @@ declare function ScheduledWorkPanel({ adapter, agentId, title, limit, status, hi
|
|
|
1265
1265
|
interface SessionTreePanelProps {
|
|
1266
1266
|
adapter: AgentChatAdapter;
|
|
1267
1267
|
sessionId?: string | null;
|
|
1268
|
+
/**
|
|
1269
|
+
* ID of the currently highlighted session. Defaults to `sessionId`.
|
|
1270
|
+
* Pass `""` (empty string) to clear the active highlight when `sessionId` is set.
|
|
1271
|
+
*/
|
|
1268
1272
|
activeSessionId?: string;
|
|
1269
1273
|
agentId?: string;
|
|
1270
1274
|
title?: string;
|
package/dist/index.js
CHANGED
|
@@ -16082,10 +16082,20 @@ function fallbackSessionTitle(entry) {
|
|
|
16082
16082
|
if (entry.runKind === "scheduled") return "Scheduled run";
|
|
16083
16083
|
return "New session";
|
|
16084
16084
|
}
|
|
16085
|
+
function rowStateClass(isActive, isInActiveGroup) {
|
|
16086
|
+
if (isActive) {
|
|
16087
|
+
return "bg-faint/30 dark:bg-[#1e2840] text-foreground border-l-primary";
|
|
16088
|
+
}
|
|
16089
|
+
if (isInActiveGroup) {
|
|
16090
|
+
return "bg-line/70 dark:bg-line/60 text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent";
|
|
16091
|
+
}
|
|
16092
|
+
return "bg-transparent text-foreground/80 hover:bg-input hover:text-foreground border-l-transparent";
|
|
16093
|
+
}
|
|
16085
16094
|
function TreeNodeRow({
|
|
16086
16095
|
entry,
|
|
16087
16096
|
depth,
|
|
16088
16097
|
activeSessionId,
|
|
16098
|
+
activeGroupRootId,
|
|
16089
16099
|
canStop,
|
|
16090
16100
|
canDelete,
|
|
16091
16101
|
onSelect,
|
|
@@ -16097,11 +16107,15 @@ function TreeNodeRow({
|
|
|
16097
16107
|
const isActive = entry.id === activeSessionId;
|
|
16098
16108
|
const isRunning = entry.status === "active";
|
|
16099
16109
|
const isChildSession = entry.parentId != null;
|
|
16110
|
+
const isInActiveGroup = activeGroupRootId !== null && (entry.id === activeGroupRootId || entry.parentId === activeGroupRootId);
|
|
16100
16111
|
const title = entry.title ?? fallbackSessionTitle(entry);
|
|
16101
16112
|
const subtitle = [
|
|
16102
16113
|
formatRunKind(entry.runKind),
|
|
16103
16114
|
formatSessionTime(entry.updatedAt)
|
|
16104
16115
|
].filter(Boolean).join(" \xB7 ");
|
|
16116
|
+
useEffect(() => {
|
|
16117
|
+
if (hasChildren) setExpanded(isInActiveGroup);
|
|
16118
|
+
}, [isInActiveGroup, hasChildren]);
|
|
16105
16119
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16106
16120
|
/* @__PURE__ */ jsxs(
|
|
16107
16121
|
"div",
|
|
@@ -16115,7 +16129,7 @@ function TreeNodeRow({
|
|
|
16115
16129
|
className: cn(
|
|
16116
16130
|
"group flex items-center gap-2 w-full py-2 pr-2 text-left cursor-pointer transition-colors border-l-2",
|
|
16117
16131
|
"min-h-11 md:min-h-0",
|
|
16118
|
-
isActive
|
|
16132
|
+
rowStateClass(isActive, isInActiveGroup)
|
|
16119
16133
|
),
|
|
16120
16134
|
style: { paddingLeft: `${depth * 12 + 12}px` },
|
|
16121
16135
|
children: [
|
|
@@ -16174,6 +16188,7 @@ function TreeNodeRow({
|
|
|
16174
16188
|
entry: child,
|
|
16175
16189
|
depth: depth + 1,
|
|
16176
16190
|
activeSessionId,
|
|
16191
|
+
activeGroupRootId,
|
|
16177
16192
|
canStop,
|
|
16178
16193
|
canDelete,
|
|
16179
16194
|
onSelect,
|
|
@@ -16290,6 +16305,21 @@ function SessionTreePanel({
|
|
|
16290
16305
|
return () => clearInterval(id);
|
|
16291
16306
|
}, [refetch, runningCount]);
|
|
16292
16307
|
const roots = useMemo(() => buildTree(nodes), [nodes]);
|
|
16308
|
+
const activeGroupRootId = useMemo(() => {
|
|
16309
|
+
if (!activeSessionId) return null;
|
|
16310
|
+
const parentOf = /* @__PURE__ */ new Map();
|
|
16311
|
+
for (const n of nodes) parentOf.set(n.id, n.parentId ?? null);
|
|
16312
|
+
const visited = /* @__PURE__ */ new Set();
|
|
16313
|
+
let current = activeSessionId;
|
|
16314
|
+
let parent = parentOf.get(current);
|
|
16315
|
+
while (parent != null) {
|
|
16316
|
+
if (visited.has(parent)) break;
|
|
16317
|
+
visited.add(current);
|
|
16318
|
+
current = parent;
|
|
16319
|
+
parent = parentOf.get(current);
|
|
16320
|
+
}
|
|
16321
|
+
return parentOf.has(current) ? current : null;
|
|
16322
|
+
}, [activeSessionId, nodes]);
|
|
16293
16323
|
const handleSelect = useCallback(
|
|
16294
16324
|
(id) => {
|
|
16295
16325
|
onSessionSelect?.(id);
|
|
@@ -16353,6 +16383,7 @@ function SessionTreePanel({
|
|
|
16353
16383
|
entry,
|
|
16354
16384
|
depth: 0,
|
|
16355
16385
|
activeSessionId: activeSessionId ?? "",
|
|
16386
|
+
activeGroupRootId,
|
|
16356
16387
|
canStop: Boolean(adapter.stopSession),
|
|
16357
16388
|
canDelete: Boolean(adapter.deleteSession),
|
|
16358
16389
|
onSelect: handleSelect,
|