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

+51 -4
View File
@@ -53,14 +53,38 @@ describe("workspace store", () => {
for (const dir of [sessions, allowRoot, projectA, projectB, projectGhost]) mkdirSync(dir, { recursive: true });
writeSessionDir(sessions, encodedDirName(projectA), [
{ name: "2026-10-10T06-40-33-032Z_a1.jsonl", cwd: projectA, id: "a1" },
{ name: "2026-10-11T06-40-33-032Z_a2.jsonl", cwd: projectA, id: "a2" },
{
name: "2026-10-10T06-40-33-032Z_a1.jsonl",
cwd: projectA,
id: "a1",
timestamp: "2026-10-10T06:40:33.032Z",
mtime: new Date("2026-10-10T06:40:33.032Z"),
},
{
name: "2026-10-11T06-40-33-032Z_a2.jsonl",
cwd: projectA,
id: "a2",
timestamp: "2026-10-11T06:40:33.032Z",
mtime: new Date("2026-10-11T06:40:33.032Z"),
},
]);
writeSessionDir(sessions, encodedDirName(projectB), [
{ name: "2026-10-12T06-40-33-032Z_b1.jsonl", cwd: projectB, id: "b1" },
{
name: "2026-10-12T06-40-33-032Z_b1.jsonl",
cwd: projectB,
id: "b1",
timestamp: "2026-10-12T06:40:33.032Z",
mtime: new Date("2026-10-12T06:40:33.032Z"),
},
]);
writeSessionDir(sessions, encodedDirName(projectGhost), [
{ name: "2026-10-13T06-40-33-032Z_g1.jsonl", cwd: projectGhost, id: "g1" },
{
name: "2026-10-13T06-40-33-032Z_g1.jsonl",
cwd: projectGhost,
id: "g1",
timestamp: "2026-10-13T06:40:33.032Z",
mtime: new Date("2026-10-13T06:40:33.032Z"),
},
]);
rmSync(projectGhost, { recursive: true, force: true });
});
@@ -116,6 +140,29 @@ describe("workspace store", () => {
expect(ghost).toMatchObject({ exists: false, sessionCount: 1, lastActiveAt: expect.any(Number) });
});
it("lists the newest session files across workspaces for the activity feed", () => {
const { store } = setup();
const rows = store.recentSessions(3);
expect(rows.map((row) => row.sessionId)).toEqual(["g1", "b1", "a2"]);
expect(rows.map((row) => row.workspaceId)).toEqual([
workspaceIdForCwd(projectGhost),
workspaceIdForCwd(projectB),
workspaceIdForCwd(projectA),
]);
expect(rows[0]).toMatchObject({
workspaceName: "ghost",
cwd: projectGhost,
timestamp: Date.parse("2026-10-13T06:40:33.032Z"),
modified: Date.parse("2026-10-13T06:40:33.032Z"),
sessionFile: expect.stringContaining("g1"),
});
// The default (no limit) still returns every discovered session, and an
// out-of-range limit is clamped instead of exploding the header scan.
expect(store.recentSessions()).toHaveLength(4);
expect(store.recentSessions(0)).toHaveLength(4);
});
it("keeps hidden entries in list(); the UI decides ordering", async () => {
const { store } = setup();
const bId = workspaceIdForCwd(projectB);