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

+4 -8
View File
@@ -14,7 +14,7 @@
* is actually reachable on, so it always matches the pairing link.
*/
import type { NetworkInterfaceInfo } from "node:os";
import { fileURLToPath } from "node:url";
import { defaultStaticDir } from "./core/install.js";
import { isLoopbackHost, isWildcardHost, localOrigins } from "./core/network.js";
import { daemonTokenPath, dataDir } from "./core/paths.js";
@@ -36,7 +36,7 @@ export interface Config {
host: string;
/** TCP port; `0` asks the OS for an ephemeral port (tests). */
port: number;
/** Built web UI (`<repo>/web/dist` by default). */
/** built web UI — PI2_STATIC_DIR wins, else the install layout (<prefix>/share/pi2d/web/dist for the compiled binary, web/dist for an npm/dev checkout). */
staticDir: string;
corsOrigins: string[];
limits: Limits;
@@ -53,11 +53,7 @@ export interface ConfigOptions {
interfaces?: NodeJS.Dict<NetworkInterfaceInfo[]>;
}
function defaultStaticDir(): string {
return fileURLToPath(new URL("../web/dist", import.meta.url));
}
function parsePort(raw: string | undefined): number {
export function parsePort(raw: string | undefined): number {
if (raw === undefined || raw.trim() === "") return DEFAULT_PORT;
if (!/^\d+$/.test(raw.trim())) throw new Error(`PI2_PORT must be an integer, got "${raw}"`);
const port = Number(raw);
@@ -73,7 +69,7 @@ function normalizeOrigin(raw: string): string | null {
return value === "" ? null : value;
}
function normalizePublicUrl(raw: string | undefined): string | null {
export function normalizePublicUrl(raw: string | undefined): string | null {
if (raw === undefined) return null;
return normalizeOrigin(raw);
}