feat: right-click menus everywhere, workspace/session cost, long-term DB safety

Right-click menus: one portal shell (components/ContextMenu.tsx) for every
item with actions - sidebar/Recents/archived session rows (SessionMenu),
console tabs, pane headers, the Changes panel's files/tree/commits, the
workspace home, sessions outside a workspace (SessionRowMenu: Sessions
table, Dashboard, Activity, Workflow runs), prompt images, every Settings
list and every Claude Code/Codex config list (FileItemMenu). Buttons stay;
a delete keeps its button's confirm; the shell stops portal clicks from
reaching the card that opened it.

Status bar: Workspace $ and Session $ on the Workspace page, from
?lane= on GET /api/pricing/cost and the focused/replayed session's cost.

Database, no data dropped: synchronous=NORMAL, journal_size_limit 64 MB,
hourly PASSIVE checkpoint + PRAGMA optimize, idx_events_session_created
(replacing the redundant idx_events_session), watchdog reads
sessions.transcript_path, transcript parsed before the hook's write
transaction, GET /api/sessions/:id?events=0 for the web page (reloads only
on its own session, debounced), streamed export, transactional clear-data
and chunked cleanup, subagent import reads tool_use_ids once, runtime logs
rotated past 5 MB.
This commit is contained in:
2026-10-05 09:37:48 +07:00
parent 65fe680d38
commit ad6e80192d
80 changed files with 2914 additions and 489 deletions
@@ -468,6 +468,39 @@ describe("LaneChangesPanel", () => {
});
});
it("right-click on a changed file offers stage, a two-click discard and copy path", async () => {
const user = userEvent.setup();
render(<LaneChangesPanel laneId={7} />);
const list = await screen.findByTestId("lane-changes-overview");
const row = within(list).getByText("server/lib/git-ops.js");
const right = () => user.pointer({ keys: "[MouseRight]", target: row });
await right();
await user.click(
within(screen.getByTestId("lane-changes-file-menu")).getByText("Stage this file")
);
expect(api.lanes.gitAction).toHaveBeenCalledWith(7, "stage", {
paths: ["server/lib/git-ops.js"],
});
vi.mocked(api.lanes.gitAction).mockClear();
await right();
await user.click(screen.getByTestId("lane-changes-menu-discard"));
expect(api.lanes.gitAction).not.toHaveBeenCalled();
expect(screen.getByTestId("lane-changes-menu-discard")).toHaveTextContent("Click again");
await user.click(screen.getByTestId("lane-changes-menu-discard"));
expect(api.lanes.gitAction).toHaveBeenCalledWith(7, "discard", {
paths: ["server/lib/git-ops.js"],
confirm: true,
});
await right();
await user.click(
within(screen.getByTestId("lane-changes-file-menu")).getByText("Copy relative path")
);
expect(await navigator.clipboard.readText()).toBe("server/lib/git-ops.js");
});
it("disarms a pending discard when the lane changes, so one click cannot discard in another lane", async () => {
const user = userEvent.setup();
const { rerender } = render(<LaneChangesPanel laneId={7} />);
@@ -439,6 +439,43 @@ describe("WorkspaceHome", () => {
expect(within(dialog).getByText("Rules here")).toBeInTheDocument();
expect(within(dialog).queryByRole("textbox")).toBeNull();
});
it("shows one memory file per tab", async () => {
vi.mocked(api.lanes.memory).mockResolvedValueOnce({
files: [
{
label: "CLAUDE.md",
path: "/r/CLAUDE.md",
content: "# Rules here",
size: 0,
mtime: "",
truncated: false,
},
{
label: "memory/a.md",
path: "/m/a.md",
content: "# Note A",
size: 0,
mtime: "",
truncated: false,
},
],
});
const user = userEvent.setup();
renderHome();
expect(await screen.findByText("2 files the agent reads")).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "View memory" }));
const dialog = screen.getByRole("dialog", { name: "Memory" });
expect(within(dialog).getByRole("tab", { name: "CLAUDE.md" })).toHaveAttribute(
"aria-selected",
"true"
);
expect(within(dialog).getByText("Rules here")).toBeInTheDocument();
expect(within(dialog).queryByText("Note A")).toBeNull();
await user.click(within(dialog).getByRole("tab", { name: "memory/a.md" }));
expect(within(dialog).getByText("Note A")).toBeInTheDocument();
expect(within(dialog).queryByText("Rules here")).toBeNull();
});
});
describe("WorkspaceHome across workspaces", () => {