feat: session-first workspace activity and installable daemon

Workspaces page:
- list the newest sessions across workspaces in the activity column; the
  daemon exposes GET /api/v1/sessions/recent as a disk projection and the
  browser enriches live rows from the per-workspace session relay
- put recent activity first below 1100px and fix the mobile page-header
  flex-basis gap

Smoke:
- pin PI2_HOST=127.0.0.1 in both smoke scripts and make the startup-line
  assertion follow the configured host; the daemon default stays 0.0.0.0

Install:
- standalone binary build/install scripts, packaging templates, CI/release
  hooks, CLI-first install docs and the supporting config/doctor changes
This commit is contained in:
yuez committed 2026-10-28 10:53:48 +08:00
1 parent fc51c3be37
commit d2e20d428a
50 files changed
+5104 -188

No files matched your search

+18
View File
@@ -85,6 +85,7 @@ Plugin obligations:
| `GET /api/v1/health` | `{ok, items:[{name, ok, detail}]}` |
| `GET /api/v1/workspaces` | `WorkspaceInfo[]` (registry + disk index + instance state) |
| `GET /api/v1/workspaces/:id/sessions` | relayed `workspace.query{kind:"sessions"}` (row fields below) |
| `GET /api/v1/sessions/recent?limit=` | disk-projected recent sessions across every workspace (below); never spawns an instance |
| `GET /api/v1/sessions/:sid/entries?before=&limit=&workspaceId=&sessionFile=` | relayed `workspace.query{kind:"entries"}`; plugin paginates |
| `GET /api/v1/attention?workspaceId=` | pending attention for one workspace |
| `GET /api/v1/devices` | paired devices (daemon-owned; `{id, name, kind, createdAt, lastSeenAt, revokedAt}`) |
@@ -156,6 +157,23 @@ A client that lets the user *choose* a workspace should list only `default` rows
default; `secondary` rows belong behind a “show hidden” toggle. Lookups by
`workspaceId` must ignore `visibility` entirely.
Recent session row (`GET /api/v1/sessions/recent?limit=`): a **disk projection**, not
session state. The daemon scans each known workspace's session directory, reads only
session headers (id, timestamp, cwd), and sorts by file mtime. It never parses
entries, never spawns an instance and never claims ownership of a live session. The
console layers live names/statuses over these rows from
`GET /api/v1/workspaces/:id/sessions` when that workspace has a connected instance.
| Field | Notes |
|---|---|
| `sessionId`, `sessionFile`, `cwd` | identity + path |
| `workspaceId`, `workspaceName` | owning workspace, resolved from the daemon's registry/discovery |
| `timestamp` | session start from the JSONL header (file-name fallback), epoch ms |
| `modified` | file mtime, epoch ms — the recency sort key |
The `limit` defaults to 20 and is clamped to 1–200. Rows are deduped by `sessionId`
(two encoded directories can resolve to the same cwd) and returned newest first.
Session row (`GET /api/v1/workspaces/:id/sessions`) — a subset of `SessionState` plus list metadata (`usage`, `flags`, `entries` and `attention` arrive via snapshot/events, not on this row):
| Field | Notes |