Wave 6 chunk A: sidebar context menu (Rename/Delete) + the two-option delete dialog
- Right-click any session row: MenuShell context menu, exactly two actions (owner ruling): Rename and Delete… — MenuShell discipline (placement, focus, arrow cycling, lh:menu-open announcements), agent-section's outside-click/Esc contract with [data-lh-menu] carve-outs. - Rename is INLINE in the row (owner ruling): select-all entry, Enter/blur commits through the existing plumbing — PUT /api/chats/:id then lh:chat-renamed. The open chat header now LISTENS for the event too, so renaming the active session from the sidebar updates the header in place (it only dispatched before). - Delete opens the two-option dialog (locked design, DELETE_OPTIONS pure seam for render pins): "Delete the session only" (preserve-graph — the graph keeps every contribution) vs "Also remove its graph traces" (delete-nodes — shared topics survive, only-this-session topics die). 409 turn_in_flight/jobs_running and 503 extraction_winding_down render the server's line verbatim with a same-mode Try-again. - Success: the sidebar patches its snapshot instantly, the active session navigates home (chat unmounts — drafts die with it), and lh:graph-revision announces the returned revision — the graph view refetches the snapshot AND costs (deletion is the one writer the status poll can't see). - ChatDeleteMode type re-exported through the core barrel (the shell's one needed seam from core/graph-deletion.ts). Gates: tsc clean, 909/909, lint 0, build ok. Live-verified on :3001: context menu open/Esc, inline rename (row + API + active header), both delete modes on scratch sessions, simulated 409 + retry-then-succeed, active-session navigation home, graph+costs refetch deltas on home.
This commit is contained in:
@@ -904,6 +904,21 @@ export function GraphView() {
|
||||
costsHadRunning.current = pipelineRuns.length > 0;
|
||||
}, [pipelineRuns, refreshCosts]);
|
||||
|
||||
/* Deletion refresh (wave 6 chunk A): the DELETE /api/chats/:id response
|
||||
carries the new graphRevision, and the sidebar (which owns the delete
|
||||
flow) announces it as lh:graph-revision. The status poll above can't
|
||||
see a deletion — no pipeline run ever transitions some→none for it —
|
||||
so this event is the one seam. Refetch the snapshot and the costs on
|
||||
every announcement: deletions are rare, a redundant fetch is free. */
|
||||
useEffect(() => {
|
||||
const onRevision = () => {
|
||||
setRefreshTick((t) => t + 1);
|
||||
refreshCosts();
|
||||
};
|
||||
window.addEventListener("lh:graph-revision", onRevision);
|
||||
return () => window.removeEventListener("lh:graph-revision", onRevision);
|
||||
}, [refreshCosts]);
|
||||
|
||||
// Layout (Option A): the positions ledger (written by the server's
|
||||
// incremental settle after every merge) IS the layout — the renderer
|
||||
// receives it as frozen data. The local one-shot forceAtlas2 pass runs
|
||||
|
||||
Reference in New Issue
Block a user