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:
1 parent
fc51c3be37
commit
d2e20d428a
50 files changed
+5104
-188
No files matched your search
@@ -337,6 +337,27 @@ async function handleApi(req, res, url) {
|
||||
if (pathname === "/api/v1/workspaces" && method === "GET") {
|
||||
return sendJson(res, 200, FIXTURES.workspaces);
|
||||
}
|
||||
// Disk-projected recent sessions (see docs/protocol.md §3.1). The mock has
|
||||
// no live/disk split, so it projects the fixture rows and lets the browser
|
||||
// merge the `/sessions` relay over them, exactly like the real console.
|
||||
if (pathname === "/api/v1/sessions/recent" && method === "GET") {
|
||||
const raw = Number(url.searchParams.get("limit"));
|
||||
const limit = Number.isFinite(raw) && raw > 0 ? Math.min(200, Math.floor(raw)) : 20;
|
||||
const nameById = new Map(FIXTURES.workspaces.map((workspace) => [workspace.workspaceId, workspace.name]));
|
||||
const rows = FIXTURES.sessions
|
||||
.map((session) => ({
|
||||
sessionId: session.sessionId,
|
||||
workspaceId: session.workspaceId,
|
||||
workspaceName: nameById.get(session.workspaceId) ?? session.workspaceId,
|
||||
cwd: session.cwd ?? "",
|
||||
sessionFile: `/sessions/${session.sessionId}.jsonl`,
|
||||
timestamp: session.createdAt ?? session.lastActiveAt ?? 0,
|
||||
modified: session.lastActiveAt ?? session.modified ?? 0,
|
||||
}))
|
||||
.sort((a, b) => b.modified - a.modified || a.sessionId.localeCompare(b.sessionId))
|
||||
.slice(0, limit);
|
||||
return sendJson(res, 200, { v: 1, sessions: rows });
|
||||
}
|
||||
let match = /^\/api\/v1\/workspaces\/([^/]+)\/sessions$/.exec(pathname);
|
||||
if (match && method === "GET") {
|
||||
const workspaceId = decodeURIComponent(match[1]);
|
||||
|
||||
Reference in new issue
Block a user