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:
@@ -737,13 +737,15 @@ export const api = {
|
||||
* @param id The session id.
|
||||
* @returns `{ session, agents, events, workflows }` for the detail view.
|
||||
*/
|
||||
get: (id: string) =>
|
||||
/** `events: false` sends `?events=0`: `events` comes back empty instead of
|
||||
* every event of the session with its full payload. */
|
||||
get: (id: string, opts: { events?: boolean } = {}) =>
|
||||
request<{
|
||||
session: Session;
|
||||
agents: Agent[];
|
||||
events: DashboardEvent[];
|
||||
workflows: WorkflowRun[];
|
||||
}>(`/sessions/${encodeURIComponent(id)}`),
|
||||
}>(`/sessions/${encodeURIComponent(id)}${opts.events === false ? "?events=0" : ""}`),
|
||||
/**
|
||||
* GET /api/sessions/:id/stats - per-session rollups for the detail page.
|
||||
*
|
||||
@@ -1334,11 +1336,13 @@ export const api = {
|
||||
*
|
||||
* @returns {@link CostResult} — the aggregate cost breakdown across sessions.
|
||||
*/
|
||||
totalCost: () => {
|
||||
totalCost: (opts: { lane?: number } = {}) => {
|
||||
// Scope the aggregate to the active data-scope, exactly like the sessions /
|
||||
// stats / analytics endpoints — otherwise switching the Data scope selector
|
||||
// left the Dashboard "total cost" showing the un-narrowed global total.
|
||||
// `lane`: only the sessions that workspace owns.
|
||||
const qs = new URLSearchParams({ tz_offset: String(new Date().getTimezoneOffset()) });
|
||||
if (opts.lane !== undefined) qs.set("lane", String(opts.lane));
|
||||
applyScope(qs);
|
||||
return request<CostResult>(`/pricing/cost?${qs.toString()}`);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user