feat(workspaces): title recent-activity rows from a bounded preview

The activity column's disk-only rows had no title: the recent feed carried file
metadata only, so every session outside a live instance rendered "(unnamed)".

recentSessions() now projects a display title for the rows it returns — the
latest `session_info` name and the first user message — from a 128 KiB head +
32 KiB tail of each session file, cached by (mtime, size). Entries are never
parsed into session state: the read is bounded, opt-in, and only paid for the
≤limit rows the caller renders, so the daemon stays a router.

The web client keeps the disk title as a fallback under the live state, and the
B4 e2e scenario asserts session-first rows with their links and titles.
This commit is contained in:
yuez committed 2026-10-30 15:15:09 +08:00
1 parent 086cac8c8e
commit 17fcf931c0
11 files changed
+431 -30

No files matched your search

+11 -3
View File
@@ -321,9 +321,10 @@ export type WorkspaceVisibilityReason = "hidden" | "ghost" | "temp" | "outside-r
/**
* One disk-projected session row for the cross-workspace recent-activity feed.
*
* This is file metadata only (header id/timestamp + mtime); the daemon never
* parses entries or owns session state (docs/protocol.md §3.1). Live names and
* statuses are layered on by the client through `/workspaces/:id/sessions`.
* This is file metadata plus an optional bounded display title (latest
* `session_info` name / first user message); the daemon never parses entries
* into session state (docs/protocol.md §3.1). Live names and statuses are
* layered on by the client through `/workspaces/:id/sessions`.
*/
export interface RecentSessionInfo {
sessionId: string;
@@ -336,6 +337,13 @@ export interface RecentSessionInfo {
timestamp: number;
/** File mtime, epoch ms — the recency sort key. */
modified: number;
/**
* Latest `session_info.name` from the session file's bounded preview
* windows. Display metadata only; absent when the file has no name yet.
*/
name?: string;
/** First user message preview (flattened, ≤80 chars), when readable. */
firstMessage?: string;
}
export type DaemonCommandMethod =