Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
feat(settings): add an Account section for profile, password, devices, and about
Cursor Agent1135767444a7
diff --git a/.env.example b/.env.exampleindex efdf2c75..62c0d398 100644--- a/.env.example+++ b/.env.example@@ -243,6 +243,7 @@ OS_SESSION_SECRET=# --- Storage paths (optional overrides) ---# OS_DEVICE_STORE=~/.mso/auth-devices.json # approved devices + live roles+# OS_ACCOUNT_STORE=~/.mso/account.json # owner display name and icon (not the login password)# OS_CONFIG_STORE=~/.mso/config.json # BYOK key + model# OS_PREFS_PATH=~/.mso/prefs.json # synced UI prefs (theme, layout)# OS_MEMORY_STORE=~/.mso/memory.json # Alfa assistant long-term memorydiff --git a/AGENTS.md b/AGENTS.mdindex 4e84b5bf..50444444 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -57,7 +57,7 @@ When a user asks an agent to "install MSO from this repo" or "update MSO", do nosetup flow. Read `README.md` + `docs/INSTALL.md` and use the repository-owned entry points:- fresh install or legacy install without `mso update`: run the official `scripts/install.sh` bootstrap;-- current install: prefer `mso update` or the equivalent Settings → About action;+- current install: prefer `mso update` or the equivalent Settings → Account → About action;- never create a second checkout when `mso.service` already owns one; preserve `.env.local`, `~/.mso`,and any dirty/diverged source rather than resetting it;- finish with `mso doctor` plus runtime health, and report only the remaining action the user must take;diff --git a/CLAUDE.md b/CLAUDE.mdindex 764f1889..736d40b0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -46,7 +46,7 @@ back in; the root `progress.md` is gitignored local scratch and claims authoritydoes not have.) `docs/CHANGELOG.md` exists again as of 2026-08-11 but is **generatedfrom git subjects** by `scripts/gen-changelog.mjs` and gated stale-by-`gates.sh`, sothere is nothing to keep in sync and no way for it to disagree with history. PROGRESS-is the WHY; CHANGELOG is the WHAT, and it is what Settings → About renders as+is the WHY; CHANGELOG is the WHAT, and it is what Settings → Account → About renders as"What's new" so a shipped change is visible in the running app.@@ -202,7 +202,7 @@ to `resources/` (rr) and drive any project from one manifest:changelog, runs committed pre-push gates/out-of-tree build, pushes the exact SHA, then finalizesthe supported service replacement/chunk verification. Through MSO/MCP, finalization runs in`mso-self-update.service`; completion is proven only when the log ends `UPDATE OK`. Operator- update/recovery is Settings → About or `mso update [--rebuild]`. Do not use a bare in-place+ update/recovery is Settings → Account → About or `mso update [--rebuild]`. Do not use a bare in-placebuild merely to verify code.- **Service worker** is served from `app/api/sw/route.ts` with a `beforeFiles` rewrite`/sw.js`→`/api/sw`. It caches only icons+manifest, never chunks/HTML, and bakes `BUILD_ID` into@@ -294,7 +294,7 @@ the real runtime and working analogue before changing a tool or skill contract.## Install/update requests from an AI agentWhen a user points an agent at this repository and asks to install or update MSO, the agent must use`scripts/install.sh` / `mso update`, not hand-roll a competing setup. The installer is also the backward--compatible bridge for old installations that predate `mso update` and Settings → About: it detects the+compatible bridge for old installations that predate `mso update` and Settings → Account → About: it detects theactive service checkout, preserves `.env.local` + `~/.mso`, and updates in place. Never create a secondinstall beside an owned service or reset dirty/diverged source. End with `mso doctor` and health proof.Credential prompts remain hidden/STDIN; tell the user where to create/store a required key, never put itdiff --git a/README.md b/README.mdindex f93f47e3..d7ee5ddc 100644--- a/README.md+++ b/README.md@@ -66,7 +66,7 @@ The raw application binds to **127.0.0.1** by default. Compatibility hosts manag`mso update` updates from main. `mso reset` and `mso reset --scope all` preview configuration/factory resets;`mso uninstall --purge --remove-code` previews removal of owned data and a clean standalone clone.Applying reset/uninstall requires an offline runtime and an exact confirmation token from an independent terminal.-Browser reset is separate in **Settings → About**. [Backups, scope and safeguards](./docs/MAINTENANCE.md).+Browser reset is separate in **Settings → Account → About**. [Backups, scope and safeguards](./docs/MAINTENANCE.md).</details>diff --git a/SECURITY.md b/SECURITY.mdindex de0b17c0..6b6a3914 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -243,8 +243,8 @@ app identity, state path and symlink collisions before writing, then creates an## Rotation and retention- change `OS_SESSION_SECRET` to invalidate browser sessions;-- change `OS_LOGIN_PASSWORD` to rotate the owner password;-- change device roles or revoke browsers in Settings → Devices / `mso device`; use the local CLI for recovery;+- change `OS_LOGIN_PASSWORD`, or use Settings → Account → Reset password, to rotate the owner password;+- change device roles or revoke browsers in Settings → Account → Devices / `mso device`; use the local CLI for recovery;- remove/revoke MCP tokens from Settings → MCP;- rotate provider credentials from Settings → AI or the corresponding environment source;- rotate managed-app credentials if a state snapshot containing them was exposed.diff --git a/app/api/auth/account/route.test.ts b/app/api/auth/account/route.test.tsnew file mode 100644index 00000000..18ab35eb--- /dev/null+++ b/app/api/auth/account/route.test.ts@@ -0,0 +1,66 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import { NextRequest } from "next/server";++const session = { role: "owner" as "viewer" | "operator" | "owner" | null };+const mocks = vi.hoisted(() => ({+ read: vi.fn(async () => ({ name: "Owner", icon: { type: "preset", id: "user" } })),+ write: vi.fn(async () => ({ name: "Rahman", icon: { type: "preset", id: "star" } })),+ audit: vi.fn(async () => {}),+}));++vi.mock("@/lib/auth/require-session", () => ({+ getSessionContext: vi.fn(async () => session.role ? ({+ session: { device_id: "b".repeat(32), issued_at: 1, expires_at: 2, cookie_scope: "host", cookie_epoch: "epoch-0000000000000000" },+ device: { label: "current", approvedAt: 1, role: session.role },+ role: session.role,+ }) : null),+}));+vi.mock("@/lib/auth/account-profile", () => ({+ readAccountProfile: mocks.read,+ writeAccountProfile: mocks.write,+ AccountProfileError: class AccountProfileError extends Error {+ code: string;+ constructor(code: string) { super(code); this.code = code; }+ },+}));+vi.mock("@/lib/host/audit-api", () => ({ audit: mocks.audit }));++const post = (body: unknown) => new NextRequest("https://mso.example/api/auth/account", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify(body),+});++beforeEach(() => {+ session.role = "owner";+ mocks.read.mockClear();+ mocks.write.mockClear();+ mocks.audit.mockClear();+});++describe("account profile route", () => {+ it("lets any signed-in device read the display profile and only an owner change it", async () => {+ const { GET, POST } = await import("./route");+ session.role = "viewer";+ expect((await GET()).status).toBe(200);+ expect((await POST(post({ name: "Rahman" }))).status).toBe(403);+ expect(mocks.write).not.toHaveBeenCalled();+ session.role = null;+ expect((await GET()).status).toBe(401);+ });++ it("saves a name or icon and audits the field, not the image bytes", async () => {+ const { POST } = await import("./route");+ const secret = "data:image/png;base64,SECRETPIXELS";+ expect((await POST(post({ icon: { type: "image", src: secret } }))).status).toBe(200);+ expect(mocks.write).toHaveBeenCalledWith({ name: undefined, icon: { type: "image", src: secret } });+ expect(mocks.audit).toHaveBeenCalledWith(expect.objectContaining({ action: "auth.account", detail: "icon" }));+ expect(JSON.stringify(mocks.audit.mock.calls)).not.toContain("SECRETPIXELS");+ });++ it("rejects an empty change", async () => {+ const { POST } = await import("./route");+ expect((await POST(post({}))).status).toBe(400);+ expect(mocks.write).not.toHaveBeenCalled();+ });+});diff --git a/app/api/auth/account/route.ts b/app/api/auth/account/route.tsnew file mode 100644index 00000000..c6984bc5--- /dev/null+++ b/app/api/auth/account/route.ts@@ -0,0 +1,52 @@+import { NextRequest, NextResponse } from "next/server";+import { AccountProfileError, readAccountProfile, writeAccountProfile } from "@/lib/auth/account-profile";+import { getSessionContext } from "@/lib/auth/require-session";+import { audit } from "@/lib/host/audit-api";+import { IS_DEMO } from "@/lib/demo";++export const runtime = "nodejs";+export const dynamic = "force-dynamic";++const noStore = { "Cache-Control": "no-store" };++export async function GET() {+ if (IS_DEMO) return NextResponse.json({ error: "demo" }, { status: 403, headers: noStore });+ if (!(await getSessionContext())) return NextResponse.json({ error: "unauthorized" }, { status: 401, headers: noStore });+ try {+ return NextResponse.json(await readAccountProfile(), { headers: noStore });+ } catch (error) {+ const code = error instanceof AccountProfileError ? error.code : "corrupt";+ return NextResponse.json({ error: code }, { status: 500, headers: noStore });+ }+}++export async function POST(req: NextRequest) {+ if (IS_DEMO) return NextResponse.json({ error: "demo" }, { status: 403, headers: noStore });+ const context = await getSessionContext();+ if (!context || context.role !== "owner") {+ return NextResponse.json({ error: "owner_required" }, { status: 403, headers: noStore });+ }+ let body: { name?: unknown; icon?: unknown };+ try {+ body = await req.json();+ } catch {+ return NextResponse.json({ error: "invalid_body" }, { status: 400, headers: noStore });+ }+ if (body.name === undefined && body.icon === undefined) {+ return NextResponse.json({ error: "invalid_body" }, { status: 400, headers: noStore });+ }+ try {+ const profile = await writeAccountProfile({ name: body.name, icon: body.icon });+ await audit({+ action: "auth.account",+ actor: context.session.device_id,+ ok: true,+ detail: body.name !== undefined && body.icon !== undefined ? "name,icon" : body.icon !== undefined ? "icon" : "name",+ });+ return NextResponse.json(profile, { headers: noStore });+ } catch (error) {+ const code = error instanceof AccountProfileError ? error.code : "invalid";+ const status = code === "corrupt" ? 500 : 400;+ return NextResponse.json({ error: code }, { status, headers: noStore });+ }+}diff --git a/app/api/auth/password/route.test.ts b/app/api/auth/password/route.test.tsnew file mode 100644index 00000000..fdebefa2--- /dev/null+++ b/app/api/auth/password/route.test.ts@@ -0,0 +1,60 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import { NextRequest } from "next/server";+import { LoginPasswordError } from "@/lib/auth/login-password";++const session = { role: "owner" as "viewer" | "owner" | null };+const mocks = vi.hoisted(() => ({+ rotate: vi.fn(async () => {}),+ audit: vi.fn(async () => {}),+}));++vi.mock("@/lib/auth/require-session", () => ({+ getSessionContext: vi.fn(async () => session.role ? ({+ session: { device_id: "b".repeat(32), issued_at: 1, expires_at: 2, cookie_scope: "host", cookie_epoch: "epoch-0000000000000000" },+ device: { label: "current", approvedAt: 1, role: session.role },+ role: session.role,+ }) : null),+}));+vi.mock("@/lib/auth/login-password", () => ({+ rotateLoginPassword: mocks.rotate,+ LoginPasswordError: class LoginPasswordError extends Error {+ code: string;+ constructor(code: string) { super(code); this.code = code; }+ },+}));+vi.mock("@/lib/host/audit-api", () => ({ audit: mocks.audit }));++const post = (body: unknown) => new NextRequest("https://mso.example/api/auth/password", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify(body),+});++beforeEach(() => {+ session.role = "owner";+ mocks.rotate.mockReset().mockResolvedValue(undefined);+ mocks.audit.mockClear();+});++describe("password rotation route", () => {+ it("requires an owner and never audits the submitted passwords", async () => {+ const { POST } = await import("./route");+ session.role = "viewer";+ expect((await POST(post({ currentPassword: "current-pass", newPassword: "next-pass-1", confirmPassword: "next-pass-1" }))).status).toBe(403);+ expect(mocks.rotate).not.toHaveBeenCalled();+ session.role = "owner";+ expect((await POST(post({ currentPassword: "current-pass", newPassword: "next-pass-1", confirmPassword: "next-pass-1" }))).status).toBe(200);+ expect(mocks.audit).toHaveBeenCalledWith(expect.objectContaining({ action: "auth.password", ok: true, detail: "rotated" }));+ expect(JSON.stringify(mocks.audit.mock.calls)).not.toContain("current-pass");+ expect(JSON.stringify(mocks.audit.mock.calls)).not.toContain("next-pass-1");+ });++ it("maps a wrong current password to 401 without writing an audit secret", async () => {+ mocks.rotate.mockRejectedValue(new LoginPasswordError("bad_current"));+ const { POST } = await import("./route");+ const response = await POST(post({ currentPassword: "wrong-pass", newPassword: "next-pass-1", confirmPassword: "next-pass-1" }));+ expect(response.status).toBe(401);+ expect(await response.json()).toEqual({ error: "bad_current" });+ expect(JSON.stringify(mocks.audit.mock.calls)).not.toContain("wrong-pass");+ });+});diff --git a/app/api/auth/password/route.ts b/app/api/auth/password/route.tsnew file mode 100644index 00000000..c1359d6c--- /dev/null+++ b/app/api/auth/password/route.ts@@ -0,0 +1,54 @@+import { NextRequest, NextResponse } from "next/server";+import { LoginPasswordError, rotateLoginPassword, type LoginPasswordCode } from "@/lib/auth/login-password";+import { getSessionContext } from "@/lib/auth/require-session";+import { audit } from "@/lib/host/audit-api";+import { IS_DEMO } from "@/lib/demo";++export const runtime = "nodejs";+export const dynamic = "force-dynamic";++const noStore = { "Cache-Control": "no-store" };++const STATUS: Record<LoginPasswordCode, number> = {+ bad_current: 401,+ rate_limited: 429,+ password_source_mismatch: 409,+ password_file_unsafe: 409,+ not_configured: 500,+ mismatch: 400,+ weak_password: 400,+ unchanged: 400,+};++export async function POST(req: NextRequest) {+ if (IS_DEMO) return NextResponse.json({ error: "demo" }, { status: 403, headers: noStore });+ const context = await getSessionContext();+ if (!context || context.role !== "owner") {+ return NextResponse.json({ error: "owner_required" }, { status: 403, headers: noStore });+ }+ let body: { currentPassword?: unknown; newPassword?: unknown; confirmPassword?: unknown };+ try {+ body = await req.json();+ } catch {+ return NextResponse.json({ error: "invalid_body" }, { status: 400, headers: noStore });+ }+ if (typeof body.currentPassword !== "string" || typeof body.newPassword !== "string" || typeof body.confirmPassword !== "string") {+ return NextResponse.json({ error: "invalid_body" }, { status: 400, headers: noStore });+ }+ try {+ await rotateLoginPassword({+ current: body.currentPassword,+ next: body.newPassword,+ confirm: body.confirmPassword,+ actor: context.session.device_id ?? "owner",+ });+ } catch (error) {+ const code: LoginPasswordCode = error instanceof LoginPasswordError ? error.code : "password_file_unsafe";+ if (code === "bad_current" || code === "rate_limited") {+ await audit({ action: "auth.password", actor: context.session.device_id, ok: false, detail: code });+ }+ return NextResponse.json({ error: code }, { status: STATUS[code], headers: noStore });+ }+ await audit({ action: "auth.password", actor: context.session.device_id, ok: true, detail: "rotated" });+ return NextResponse.json({ ok: true }, { headers: noStore });+}diff --git a/app/api/changelog/route.ts b/app/api/changelog/route.tsindex 09898679..c33071c2 100644--- a/app/api/changelog/route.ts+++ b/app/api/changelog/route.ts@@ -3,7 +3,7 @@ import path from "node:path";import { NextResponse } from "next/server";import { requireSession } from "@/lib/auth/require-session";-// Serves docs/CHANGELOG.md so Settings → About can show "What's new" in the running+// Serves docs/CHANGELOG.md so Settings → Account → About can show "What's new" in the running// app. The point of the whole thing: a shipped change should be visible where the// owner already is, not only in a terminal they would have to go and open.//diff --git a/app/install/page.test.ts b/app/install/page.test.tsindex 5e28fa68..883a21f0 100644--- a/app/install/page.test.ts+++ b/app/install/page.test.ts@@ -24,7 +24,7 @@ describe("public install guide", () => {it("gives AI agents one canonical install/update path including legacy upgrades", () => {expect(source).toContain("Install or update MSO from this repo");expect(source).toContain("mso update");- expect(source).toContain("Settings → About");+ expect(source).toContain("Settings → Account → About");expect(source).toContain("older build");expect(source).toContain("preserves existing configuration/state");});diff --git a/app/install/page.tsx b/app/install/page.tsxindex f67ef7c5..851ee6b8 100644--- a/app/install/page.tsx+++ b/app/install/page.tsx@@ -107,7 +107,7 @@ export default function InstallPage() {</p><Copy text={AGENT_PROMPT} /><p className="mt-3 text-sm leading-relaxed text-muted-foreground">- Already installed? Current MSO uses <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">mso update</code> or Settings → About.+ Already installed? Current MSO uses <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">mso update</code> or Settings → Account → About.For an older build where those do not exist, re-run the installer above; it upgrades the existing checkout in place and preserves existing configuration/state.</p></section>diff --git a/bin/mso b/bin/msoindex 1d28f484..f6bf305a 100755--- a/bin/mso+++ b/bin/mso@@ -81,7 +81,7 @@# federation * Batonly capability federation worker: status# models * Configure AI providers/auth; inspect model catalog# skills * Discover host skills + curated market: available/install/remove-# changelog What shipped, newest first (same text Settings → About shows)+# changelog What shipped, newest first (same text Settings → Account → About shows)# mcp * MCP tokens + live activity: list | pat <label> [scope] [ttlDays] | activity [n] | revoke <id> | revoke all# oauth <prov> * Provider sign-in (device code): start | poll# audit [n] [prefix] Audit trail, newest first (writes/exec/auth; reads are not logged)diff --git a/bin/mso.test.ts b/bin/mso.test.tsindex 712194aa..9f0d3fe8 100644--- a/bin/mso.test.ts+++ b/bin/mso.test.ts@@ -132,6 +132,10 @@ describe("bin/mso", () => {"POST /api/v1/channels/discord/[id]", // Provider callback: requires Discord Ed25519 signature, not a user CLI action."/api/v1/managed-apps/[id]/proxy/[[...path]]","/api/auth/devices",+ // Settings → Account owns display name, icon, and password rotation.+ // Passwords stay in OS_LOGIN_PASSWORD and must not be placed on a shell argv.+ "/api/auth/account",+ "/api/auth/password",// Internal transport between scripts/mso-agent.mjs and the authenticated// server-side MCP catalog. It is not a user-facing CLI verb by design."/api/v1/agent-tools",diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 672938aa..20556221 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -310,7 +310,7 @@ build/restart/final verification to the owner user manager when launched throughBefore push, the out-of-tree build runs required browser journeys against synthetic device/credential stores and a local provider fixture.A successful finalizer ends `~/.mso/self-update.log` with `UPDATE OK`.-For operator updates use Settings → About or `mso update`; use `--rebuild` for the+For operator updates use Settings → Account → About or `mso update`; use `--rebuild` for thesupported recovery rebuild. See `docs/INSTALL.md`, `docs/DEVELOPMENT.md` and`docs/TROUBLESHOOTING.md`.diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 1ab332c1..d93620c5 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -2,7 +2,7 @@**Generated — do not edit.** `node scripts/gen-changelog.mjs`, run by `bun run ship`.Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;-this is the *what*, and it is what Settings → About shows as “What's new”.+this is the *what*, and it is what Settings → Account → About shows as “What's new”.## 2026-09-26diff --git a/docs/CLI.md b/docs/CLI.mdindex e9fa9ae2..085c060d 100644--- a/docs/CLI.md+++ b/docs/CLI.md@@ -121,7 +121,7 @@ Commands:federation * Batonly capability federation worker: statusmodels * Configure AI providers/auth; inspect model catalogskills * Discover host skills + curated market: available/install/remove- changelog What shipped, newest first (same text Settings → About shows)+ changelog What shipped, newest first (same text Settings → Account → About shows)mcp * MCP tokens + live activity: list | pat <label> [scope] [ttlDays] | activity [n] | revoke <id> | revoke alloauth <prov> * Provider sign-in (device code): start | pollaudit [n] [prefix] Audit trail, newest first (writes/exec/auth; reads are not logged)diff --git a/docs/INSTALL.md b/docs/INSTALL.mdindex 8bf569b1..9c0f4973 100644--- a/docs/INSTALL.md+++ b/docs/INSTALL.md@@ -102,7 +102,7 @@ avoid them unless you are deliberately changing those boundaries.### Upgrading an older MSO install-Modern installations update through **Settings → About** or `mso update`. Releases from before those+Modern installations update through **Settings → Account → About** or `mso update`. Releases from before thosesurfaces existed cannot invoke an updater they do not have. For those installations, re-run the currentone-line installer exactly as if installing fresh. Before choosing `$HOME/mso`, it reads the active`mso.service` WorkingDirectory and upgrades that checkout in place. Existing `.env.local` credentials and@@ -374,7 +374,7 @@ origin, and the hostname change has a different browser-scoped device identity.The local CLI device created by `mso onboard`/`mso doctor --fix` is approved as **Owner** on thehost and remains the recovery path. The first correct login from a browser creates a **pendingdevice**. Bootstrap the browser with the role you intend, then approve additional devices from-Settings → Devices or the CLI:+Settings → Account → Devices or the CLI:```bashmso device approve <device-id> "owner laptop" --role owner@@ -600,7 +600,7 @@ no API-key storage. Do not toggle demo mode in the production owner checkout.### Operator update-Use Settings → About or:+Use Settings → Account → About or:```bashmso update status # fetch + show incoming commits and labeled CLI/build identity@@ -609,7 +609,7 @@ mso update # preferred: update safely even if :4005 is downmso update log```-MSO has two explicitly labeled version domains: the app/package version shown in Settings → About and the independently versioned CLI contract shown by `mso --version`. The Git commit/build remains update authority. If commits changed without a CLI bump, status says `N new commits on mso CLI X` rather than rendering `X -> X`.+MSO has two explicitly labeled version domains: the app/package version shown in Settings → Account → About and the independently versioned CLI contract shown by `mso --version`. The Git commit/build remains update authority. If commits changed without a CLI bump, status says `N new commits on mso CLI X` rather than rendering `X -> X`.The updater verifies the incoming checkout/build before replacing the service. Re-running the installer on an existing checkout acquires the same checkout-scoped transaction lock **before** Git fetch/checkout mutation and hands that open lock FD to the post-checkout runtime lifecycle, so installer, `mso update`, and `mso deploy` cannot mutate one checkout concurrently. The lock primitive is carried by the verified installer payload itself, so older MSO checkouts that predate the current private-state helper remain upgradeable in place. A normal `mso update` treats fetched `origin/main` as the release authority: after any fast-forward, local `main` must equal that remote commit exactly. A clean branch that is locally ahead or diverged is refused before dependency/build mutation instead of deploying unpushed code. `mso update status` reports that state explicitly; `mso update reconcile` makes recovery explicit and lossless by preserving the previous HEAD on a timestamped local `rescue/mso-update-*` branch before resetting clean `main` to fetched `origin/main`. `mso update --rebuild` is different by design: it rebuilds the already-selected clean checkout without changing Git history. With an active`mso.service` it first canonicalizes the unit's `WorkingDirectory` and requires it to equal the checkoutdiff --git a/docs/MAINTENANCE.md b/docs/MAINTENANCE.mdindex d2320e2b..5ac9fb36 100644--- a/docs/MAINTENANCE.md+++ b/docs/MAINTENANCE.md@@ -8,8 +8,8 @@ installation owner on Linux, from an independent local/SSH terminal—not inside| Action | Removes from active use | Preserves ||---|---|---|-| Settings → About → Appearance only | This browser's appearance cache | Identity, drafts, server data |-| Settings → About → All MSO browser data | MSO layouts, Playbooks, drafts and owned local storage | Device approval, unrelated browser storage, server files |+| Settings → Account → About → Appearance only | This browser's appearance cache | Identity, drafts, server data |+| Settings → Account → About → All MSO browser data | MSO layouts, Playbooks, drafts and owned local storage | Device approval, unrelated browser storage, server files || `mso reset` | Managed server preferences and model/infrastructure configuration | Authentication, history, `.env.local`, source, external apps || `mso reset --scope all` | Known MSO configuration, identity/token stores, memory, sessions/history, `.env.local` | Source, unknown files, other projects and external providers || `mso uninstall` | Verified service registrations and CLI/skill symlinks belonging to this checkout | Source, all server data, browser storage |diff --git a/docs/MCP-HOW-TO.md b/docs/MCP-HOW-TO.mdindex 65cac31c..3db5180b 100644--- a/docs/MCP-HOW-TO.md+++ b/docs/MCP-HOW-TO.md@@ -32,7 +32,7 @@ OS_MCP_ENABLED=1OS_MCP_MAX_SCOPE=read```-Jangan mengganti seluruh `.env.local`. Terapkan perubahan melalui **Settings → About**+Jangan mengganti seluruh `.env.local`. Terapkan perubahan melalui **Settings → Account → About**atau `mso update --rebuild`, lalu ulangi otorisasi bila scope koneksi perlu berubah.| Scope | Pemakaian |diff --git a/docs/MCP.md b/docs/MCP.mdindex c8eb8c00..41be4d5e 100644--- a/docs/MCP.md+++ b/docs/MCP.md@@ -52,7 +52,7 @@ For a public connector use a stable HTTPS origin, normally a named Cloudflare Turandom `*.trycloudflare.com` Quick Tunnel URL as `OS_PUBLIC_ORIGIN`.After changing deployment environment or `OS_MCP_MAX_SCOPE`, use the normal MSO update/rebuild path-(Settings → About or `mso update --rebuild`), then repeat/refresh the OAuth consent flow in ChatGPT so+(Settings → Account → About or `mso update --rebuild`), then repeat/refresh the OAuth consent flow in ChatGPT sothe connector receives the new scope ceiling. A Git push or editing `.env.local` does not change therunning service by itself, and existing tokens are not magically widened.diff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 337f0037..8c70f3a4 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,13 @@+## 2026-09-26 — Settings Account section++Settings now opens on an Account section. Rename, icon, and password reset live+there, and Devices and About are reached from inside Account instead of as+sibling sections. The display name and icon are the owner profile in+`~/.mso/account.json`. Password reset still rotates `OS_LOGIN_PASSWORD` in+`.env.local` with the existing constant-time compare; it does not add a second+password store. Deep links to `?section=devices` and `?section=about` still open+those panels, and mobile back returns to Account.+## 2026-09-26 — Crash-safe continuation and source-isolated agent workChatGPT/MCP continuation no longer depends on the user recovering a dead tab ordiff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdindex f9d7cab1..addd973a 100644--- a/docs/TROUBLESHOOTING.md+++ b/docs/TROUBLESHOOTING.md@@ -38,7 +38,7 @@ forward the real client IP consistently so every user does not share the proxy a### Correct password but "pending approval"Expected for a new browser. Approve the shown device id from an already-approved browser-(Settings → Devices) or from the server using the approval script. Pair and re-check from the+(Settings → Account → Devices) or from the server using the approval script. Pair and re-check from the**same browser origin**. Device identity is browser-origin scoped, so approving an ID from`http://server-ip:4005` and then switching to `https://mso.example.com` creates a different ID.@@ -223,7 +223,7 @@ the expected release. If the deployment is correct but the build tree is inconsi### Update button says a newer version exists forever-Check Settings → About and `~/.mso/self-update.log`. A successful self-update ends with+Check Settings → Account → About and `~/.mso/self-update.log`. A successful self-update ends with`UPDATE OK`. Also verify only one production process is serving the public origin. If thebrowser cached an old service worker, unregister it once and hard reload after the server isconfirmed healthy.diff --git a/docs/reference/WORKSPACE-GUIDE.md b/docs/reference/WORKSPACE-GUIDE.mdindex 15f987a2..11614d13 100644--- a/docs/reference/WORKSPACE-GUIDE.md+++ b/docs/reference/WORKSPACE-GUIDE.md@@ -50,7 +50,7 @@ CLI, and optional MCP interface use the same guarded host capabilities.- **Inspect system health** — view live CPU, memory, disk, network, process, and uptime signals.- **Operate services safely** — inventory system and user `systemd` units, read bounded journal output, and expose start/stop/restart only for exact owner-configured allowlist entries.- **See pending package updates** — read the package manager’s existing local cache without refreshing repositories or applying an upgrade.-- **Update itself** — A clean local main that is ahead of or diverged from origin/main is reported explicitly and refused until reconciled; unpushed work is not silently overwritten. Settings → About shows what is on `origin/main`, lists the incoming commits, and runs the whole deploy (pull → verify the build out-of-tree → build → restart) from a button. The verification runs first on purpose: a commit that does not compile becomes a refusal, not an outage. The updater runs in the owner's systemd user manager and does not require passwordless sudo. Same thing from a shell: `mso update` (`mso update run` remains a compatibility alias). The CLI update path is Git-based and still works when the web runtime is down.+- **Update itself** — A clean local main that is ahead of or diverged from origin/main is reported explicitly and refused until reconciled; unpushed work is not silently overwritten. Settings → Account → About shows what is on `origin/main`, lists the incoming commits, and runs the whole deploy (pull → verify the build out-of-tree → build → restart) from a button. The verification runs first on purpose: a commit that does not compile becomes a refusal, not an outage. The updater runs in the owner's systemd user manager and does not require passwordless sudo. Same thing from a shell: `mso update` (`mso update run` remains a compatibility alias). The CLI update path is Git-based and still works when the web runtime is down.- **Manage other apps on the box** — detect, start/stop/restart, health, version, logs, and state backups for separate applications you already run (Hermes, OpenClaw, 9Router), driven through their own systemd/Docker/CLI contracts. 9Router uses its configured application domain or split-origin host as the in-shell dashboard; its Docker port is loopback-only unless public exposure is explicitly enabled. See [docs/MANAGED-APPS.md](../MANAGED-APPS.md).**Work** — code/text editor, browser, and media tools in the same workspace.@@ -123,7 +123,7 @@ The repository carries the rest of the contract. The agent should use MSO's offipaths rather than reconstructing setup commands by hand, preserve an existing `.env.local` and`~/.mso`, update the checkout already owned by `mso.service` instead of creating a second clone, andfinish with `mso doctor`. For a current install it may use `mso update` (the same lifecycle exposed by-Settings → About). If the installed build is old enough that `mso update` or the About updater does not+Settings → Account → About). If the installed build is old enough that `mso update` or the About updater does notexist yet, the universal upgrade/recovery path is simply to re-run the current one-line installer below.Only credentials or choices that cannot be inferred should come back to the user; provider secrets muststay in hidden/STDIN onboarding prompts rather than command arguments or chat logs.@@ -186,7 +186,7 @@ curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/installAlready installed? Use the least surprising path:-- **Current MSO:** `mso update`, or Settings → About → Update.+- **Current MSO:** `mso update`, or Settings → Account → About → Update.- **Older/legacy MSO where that updater is missing or broken:** re-run the same one-line installer.It discovers an existing `mso.service` WorkingDirectory before choosing a default directory, updatesthat checkout in place, preserves `.env.local` + `~/.mso`, and does not repeat onboarding unlessdiff --git a/frontend/slices/auth/components/login-screen.tsx b/frontend/slices/auth/components/login-screen.tsxindex 39947169..66aa8a0c 100644--- a/frontend/slices/auth/components/login-screen.tsx+++ b/frontend/slices/auth/components/login-screen.tsx@@ -78,7 +78,7 @@ export function LoginCard({ onAuthed }: { onAuthed: () => void }) {<ShieldQuestion className="mt-0.5 size-4 shrink-0" /><p>This device isn’t approved yet. Send the ID below to an approved- device’s <strong>Settings → Devices</strong>, or to the owner.+ device’s <strong>Settings → Account → Devices</strong>, or to the owner.</p></div><div className="flex items-center gap-2">diff --git a/frontend/slices/os-settings/app.tsx b/frontend/slices/os-settings/app.tsxindex 6c8acb26..ce0df686 100644--- a/frontend/slices/os-settings/app.tsx+++ b/frontend/slices/os-settings/app.tsx@@ -1,7 +1,7 @@"use client";import { useSearchParams } from "next/navigation";-import { SECTIONS } from "./lib/sections";+import { sectionFromSearch } from "./lib/sections";import { useEffect, useState } from "react";import { useAppearance, effectiveServerTarget } from "@/lib/appearance";import { useSession } from "@/features/auth";@@ -17,7 +17,7 @@ import { SettingsShell } from "./components/settings-shell";// Default export so os-shell can lazy-load it as a window app.export default function OsSettings() {const params = useSearchParams();- const initial = SECTIONS.find(section => section.id === params.get("section"))?.id;+ const initial = sectionFromSearch(params.get("section"));const { tweaks } = useAppearance();const { status, role } = useSession();// Shared Settings state stays here; SettingsShell selects the presentation profile.diff --git a/frontend/slices/os-settings/components/account-avatar.tsx b/frontend/slices/os-settings/components/account-avatar.tsxnew file mode 100644index 00000000..f05460b7--- /dev/null+++ b/frontend/slices/os-settings/components/account-avatar.tsx@@ -0,0 +1,61 @@+"use client";++import { Compass, Heart, Leaf, Shield, Sparkles, Star, UserRound, Zap, type LucideIcon } from "lucide-react";+import type { AccountIcon, AccountPreset } from "@/lib/auth/account-profile-model";+import { cn } from "@/lib/utils";++const PRESET_ICON: Record<AccountPreset, LucideIcon> = {+ user: UserRound,+ spark: Sparkles,+ shield: Shield,+ star: Star,+ heart: Heart,+ zap: Zap,+ leaf: Leaf,+ compass: Compass,+};++export function AccountAvatar({ icon, className }: { icon: AccountIcon; className?: string }) {+ if (icon.type === "image") {+ // Owner-uploaded data URLs are authenticated bytes, not optimizer inputs.+ return (+ // eslint-disable-next-line @next/next/no-img-element+ <img src={icon.src} alt="" className={cn("size-16 rounded-full object-cover", className)} />+ );+ }+ const Icon = PRESET_ICON[icon.id];+ return (+ <span className={cn("grid size-16 place-items-center rounded-full bg-primary text-primary-foreground", className)}>+ <Icon className="size-8" aria-hidden />+ </span>+ );+}++export function AccountPresetButton({+ id,+ pressed,+ disabled,+ onSelect,+}: {+ id: AccountPreset;+ pressed: boolean;+ disabled: boolean;+ onSelect: (id: AccountPreset) => void;+}) {+ const Icon = PRESET_ICON[id];+ return (+ <button+ type="button"+ aria-pressed={pressed}+ aria-label={`Use ${id} icon`}+ disabled={disabled}+ onClick={() => onSelect(id)}+ className={cn(+ "grid min-h-11 place-items-center rounded-lg border",+ pressed ? "border-primary bg-primary text-primary-foreground" : "border-border bg-secondary text-foreground",+ )}+ >+ <Icon className="size-5" aria-hidden />+ </button>+ );+}diff --git a/frontend/slices/os-settings/components/account-password-card.tsx b/frontend/slices/os-settings/components/account-password-card.tsxnew file mode 100644index 00000000..5e5999ce--- /dev/null+++ b/frontend/slices/os-settings/components/account-password-card.tsx@@ -0,0 +1,96 @@+"use client";++import { useState, type FormEvent } from "react";+import Link from "next/link";+import { KeyRound } from "lucide-react";+import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { IS_DEMO } from "@/lib/demo";+import { SettingsBlock, SettingsSection } from "@/features/shell-settings";+import type { DeviceRole } from "@/lib/auth/roles";+import type { SessionStatus } from "@/features/auth";++const MESSAGES: Record<string, string> = {+ bad_current: "Current password is incorrect.",+ mismatch: "New password and confirmation do not match.",+ weak_password: "Use 6–128 letters, numbers, or basic symbols. Spaces, quotes, and $ are not accepted.",+ unchanged: "Choose a different password.",+ password_source_mismatch: "The login password is not stored in .env.local, so Settings cannot rotate it.",+ password_file_unsafe: "The password file cannot be updated safely.",+ not_configured: "Login password is not configured.",+ rate_limited: "Too many attempts. Try again in a minute.",+ invalid_body: "Enter the current password, a new password, and a confirmation.",+ owner_required: "An Owner device is required to reset the password.",+ demo: "Password reset is unavailable in this demo.",+};++export function AccountPasswordCard({ status, role }: { status: SessionStatus; role: DeviceRole | null }) {+ const owner = status === "in" && role === "owner";+ const [currentPassword, setCurrent] = useState("");+ const [newPassword, setNext] = useState("");+ const [confirmPassword, setConfirm] = useState("");+ const [error, setError] = useState<string | null>(null);+ const [notice, setNotice] = useState<string | null>(null);+ const [busy, setBusy] = useState(false);++ async function submit(event: FormEvent) {+ event.preventDefault();+ setError(null);+ setNotice(null);+ if (newPassword !== confirmPassword) {+ setError(MESSAGES.mismatch);+ return;+ }+ setBusy(true);+ try {+ const response = await fetch("/api/auth/password", {+ method: "POST",+ credentials: "same-origin",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ currentPassword, newPassword, confirmPassword }),+ });+ const body = (await response.json().catch(() => ({}))) as { error?: string };+ if (!response.ok) {+ setError(MESSAGES[body.error ?? ""] ?? "Couldn't reset the password.");+ return;+ }+ setCurrent("");+ setNext("");+ setConfirm("");+ setNotice("Password updated. This session stays signed in; use the new password next time.");+ } catch {+ setError("Couldn't reset the password.");+ } finally {+ setBusy(false);+ }+ }++ return (+ <SettingsSection icon={<KeyRound />} title="Reset password" footnote="This changes the shared login password. It does not create a separate password store.">+ {IS_DEMO || status !== "in" || !owner ? <SettingsBlock className="space-y-3">+ <p className="text-sm text-muted-foreground">{IS_DEMO ? MESSAGES.demo : status === "loading" ? "Checking access…" : "An Owner device is required to reset the password."}</p>+ {!IS_DEMO && status === "out" ? <Button asChild className="min-h-11"><Link prefetch={false} href="/login?returnTo=%2Fsettings%3Fsection%3Daccount">Sign in</Link></Button> : null}+ </SettingsBlock> : (+ <SettingsBlock>+ <form onSubmit={(event) => void submit(event)} className="space-y-3">+ <label className="block space-y-1.5 text-sm">+ <span>Current password</span>+ <Input required type="password" autoComplete="current-password" aria-label="Current password" className="h-11" value={currentPassword} onChange={(event) => setCurrent(event.target.value)} />+ </label>+ <label className="block space-y-1.5 text-sm">+ <span>New password</span>+ <Input required type="password" autoComplete="new-password" aria-label="New password" className="h-11" value={newPassword} onChange={(event) => setNext(event.target.value)} />+ </label>+ <label className="block space-y-1.5 text-sm">+ <span>Confirm new password</span>+ <Input required type="password" autoComplete="new-password" aria-label="Confirm new password" className="h-11" value={confirmPassword} onChange={(event) => setConfirm(event.target.value)} />+ </label>+ {error ? <p role="alert" className="text-sm text-destructive">{error}</p> : null}+ {notice ? <p role="status" className="text-sm text-muted-foreground">{notice}</p> : null}+ <Button type="submit" className="min-h-11" disabled={busy}>{busy ? "Resetting…" : "Reset password"}</Button>+ </form>+ </SettingsBlock>+ )}+ </SettingsSection>+ );+}diff --git a/frontend/slices/os-settings/components/account-profile-card.tsx b/frontend/slices/os-settings/components/account-profile-card.tsxnew file mode 100644index 00000000..8d9151aa--- /dev/null+++ b/frontend/slices/os-settings/components/account-profile-card.tsx@@ -0,0 +1,130 @@+"use client";++import { useEffect, useRef, useState } from "react";+import Link from "next/link";+import { UserRound } from "lucide-react";+import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { ACCOUNT_PRESETS, DEFAULT_ACCOUNT_PROFILE, type AccountIcon, type AccountProfile } from "@/lib/auth/account-profile-model";+import { IS_DEMO } from "@/lib/demo";+import { SettingsBlock, SettingsSection } from "@/features/shell-settings";+import type { DeviceRole } from "@/lib/auth/roles";+import type { SessionStatus } from "@/features/auth";+import { AccountAvatar, AccountPresetButton } from "./account-avatar";++const MAX_IMAGE_BYTES = 24 * 1024;++async function saveProfile(patch: { name?: string; icon?: AccountIcon }): Promise<AccountProfile> {+ const response = await fetch("/api/auth/account", {+ method: "POST",+ credentials: "same-origin",+ headers: { "content-type": "application/json" },+ body: JSON.stringify(patch),+ });+ const body = (await response.json().catch(() => ({}))) as AccountProfile & { error?: string };+ if (!response.ok) throw new Error(body.error || "save_failed");+ return body;+}++export function AccountProfileCard({ status, role }: { status: SessionStatus; role: DeviceRole | null }) {+ const owner = status === "in" && role === "owner";+ const [profile, setProfile] = useState<AccountProfile>(DEFAULT_ACCOUNT_PROFILE);+ const [name, setName] = useState(DEFAULT_ACCOUNT_PROFILE.name);+ const [error, setError] = useState<string | null>(null);+ const [notice, setNotice] = useState<string | null>(null);+ const [busy, setBusy] = useState(false);+ const [loaded, setLoaded] = useState(false);+ const fileRef = useRef<HTMLInputElement>(null);++ useEffect(() => {+ if (IS_DEMO || status !== "in") return;+ let alive = true;+ fetch("/api/auth/account", { cache: "no-store", credentials: "same-origin" })+ .then(async (response) => {+ const body = (await response.json().catch(() => ({}))) as AccountProfile & { error?: string };+ if (!response.ok) throw new Error(body.error || "load_failed");+ return body;+ })+ .then((next) => {+ if (!alive) return;+ setProfile(next);+ setName(next.name);+ setLoaded(true);+ })+ .catch(() => { if (alive) { setLoaded(true); setError("Couldn't load the account profile."); } });+ return () => { alive = false; };+ }, [status]);++ async function commit(patch: { name?: string; icon?: AccountIcon }, noticeText: string) {+ setBusy(true);+ setError(null);+ setNotice(null);+ try {+ const next = await saveProfile(patch);+ setProfile(next);+ setName(next.name);+ setNotice(noticeText);+ } catch {+ setError(patch.icon ? "Couldn't change the icon." : "Couldn't rename the account.");+ } finally {+ setBusy(false);+ }+ }++ function onFile(file: File | undefined) {+ if (!file) return;+ if (!["image/png", "image/jpeg", "image/webp", "image/gif"].includes(file.type) || file.size > MAX_IMAGE_BYTES) {+ setError("Use a PNG, JPEG, WebP, or GIF under 24 KB.");+ return;+ }+ const reader = new FileReader();+ reader.onload = () => {+ const src = typeof reader.result === "string" ? reader.result : "";+ if (!src.startsWith("data:image/")) {+ setError("Couldn't read that image.");+ return;+ }+ void commit({ icon: { type: "image", src } }, "Icon updated.");+ };+ reader.readAsDataURL(file);+ }++ return (+ <SettingsSection icon={<UserRound />} title="Profile" footnote={owner ? "The display name and icon are for this server's owner account. They are not the login secret." : undefined}>+ {IS_DEMO ? <SettingsBlock><p className="text-sm text-muted-foreground">Account name and icon are unavailable in this demo.</p></SettingsBlock> : null}+ {!IS_DEMO && status === "loading" ? <SettingsBlock><p role="status" className="text-sm text-muted-foreground">Checking access…</p></SettingsBlock> : null}+ {!IS_DEMO && status === "out" ? <SettingsBlock className="space-y-3">+ <p className="text-sm text-muted-foreground">Sign in with an Owner device to rename the account or change its icon.</p>+ <Button asChild className="min-h-11"><Link prefetch={false} href="/login?returnTo=%2Fsettings%3Fsection%3Daccount">Sign in</Link></Button>+ </SettingsBlock> : null}+ {!IS_DEMO && status === "in" ? <SettingsBlock className="space-y-4">+ <div className="flex items-center gap-3">+ <AccountAvatar icon={profile.icon} />+ <div className="min-w-0">+ <p className="truncate text-sm font-medium">{error ? "Account" : loaded ? profile.name : "Loading account…"}</p>+ <p className="text-xs text-muted-foreground">{owner ? "Owner account" : "Visible to signed-in devices"}</p>+ </div>+ </div>+ {owner ? <>+ <label className="block space-y-1.5 text-sm">+ <span>Display name</span>+ <Input value={name} maxLength={40} autoComplete="nickname" aria-label="Display name" className="h-11" onChange={(event) => setName(event.target.value)} />+ </label>+ <Button type="button" className="min-h-11" disabled={busy || name.trim() === profile.name} onClick={() => void commit({ name }, "Account renamed.")}>Rename account</Button>+ <div className="space-y-2">+ <p className="text-sm">Change icon</p>+ <div className="grid grid-cols-4 gap-2" role="group" aria-label="Change icon">+ {ACCOUNT_PRESETS.map((id) => (+ <AccountPresetButton key={id} id={id} disabled={busy} pressed={profile.icon.type === "preset" && profile.icon.id === id} onSelect={(preset) => void commit({ icon: { type: "preset", id: preset } }, "Icon updated.")} />+ ))}+ </div>+ <Button type="button" variant="secondary" className="min-h-11" disabled={busy} onClick={() => fileRef.current?.click()}>Upload icon</Button>+ <input ref={fileRef} type="file" accept="image/png,image/jpeg,image/webp,image/gif" className="sr-only" aria-label="Upload icon" onChange={(event) => { onFile(event.target.files?.[0]); event.target.value = ""; }} />+ </div>+ </> : <p className="text-sm text-muted-foreground">An Owner device can rename this account or change its icon.</p>}+ {error ? <p role="alert" className="text-sm text-destructive">{error}</p> : null}+ {notice ? <p role="status" className="text-sm text-muted-foreground">{notice}</p> : null}+ </SettingsBlock> : null}+ </SettingsSection>+ );+}diff --git a/frontend/slices/os-settings/components/account-section.tsx b/frontend/slices/os-settings/components/account-section.tsxnew file mode 100644index 00000000..0b11be00--- /dev/null+++ b/frontend/slices/os-settings/components/account-section.tsx@@ -0,0 +1,22 @@+"use client";++import { ChevronRight, ShieldCheck } from "lucide-react";+import { useSession } from "@/features/auth";+import { SettingsActionRow, SettingsSection } from "@/features/shell-settings";+import type { SectionId } from "../lib/sections";+import { AccountPasswordCard } from "./account-password-card";+import { AccountProfileCard } from "./account-profile-card";++export function AccountSection({ onOpen }: { onOpen: (id: SectionId) => void }) {+ const { status, role } = useSession();+ return (+ <div className="space-y-4 sm:space-y-5">+ <AccountProfileCard status={status} role={role} />+ <AccountPasswordCard status={status} role={role} />+ <SettingsSection icon={<ShieldCheck />} title="Also in Account" footnote="Devices and About live here. They are not separate Settings sections.">+ <SettingsActionRow label="Devices" onClick={() => onOpen("devices")} trailing={<ChevronRight className="size-4" aria-hidden />} />+ <SettingsActionRow label="About" onClick={() => onOpen("about")} trailing={<ChevronRight className="size-4" aria-hidden />} />+ </SettingsSection>+ </div>+ );+}diff --git a/frontend/slices/os-settings/components/ios-settings.tsx b/frontend/slices/os-settings/components/ios-settings.tsxindex 08f7512f..16370d87 100644--- a/frontend/slices/os-settings/components/ios-settings.tsx+++ b/frontend/slices/os-settings/components/ios-settings.tsx@@ -17,7 +17,7 @@ export function IosSettings({onSelect: (id: SectionId) => void;}) {return active ? (- <IosSettingsDetail id={active} />+ <IosSettingsDetail id={active} onOpen={onSelect} />) : (<IosSettingsIndex onSelect={onSelect} />);@@ -84,7 +84,7 @@ function IosSettingsIndex({ onSelect }: { onSelect: (id: SectionId) => void }) {);}-function IosSettingsDetail({ id }: { id: SectionId }) {+function IosSettingsDetail({ id, onOpen }: { id: SectionId; onOpen: (id: SectionId) => void }) {const meta = settingsSection(id);// Appearance/Theme are control-first. About already has the Manef Shell OS// identity block, so a second category hero would duplicate its header.@@ -103,7 +103,7 @@ function IosSettingsDetail({ id }: { id: SectionId }) {<p className="mx-auto mt-2 max-w-[32rem] text-[16px] leading-[1.35] text-foreground/90">{meta.blurb}</p></section>)}- <SettingsSectionBody id={id} />+ <SettingsSectionBody id={id} onOpen={onOpen} /></div></div>);diff --git a/frontend/slices/os-settings/components/nav.tsx b/frontend/slices/os-settings/components/nav.tsxindex 45a44519..dec393c3 100644--- a/frontend/slices/os-settings/components/nav.tsx+++ b/frontend/slices/os-settings/components/nav.tsx@@ -5,7 +5,7 @@ import { Input } from "@/components/ui/input";import { cn } from "@/lib/utils";import { Monitor, Search } from "lucide-react";import { useState } from "react";-import { filterSettingsSections, groupSettingsSections, SECTIONS, type SectionId } from "../lib/sections";+import { filterSettingsSections, groupSettingsSections, SECTIONS, settingsNavActive, type SectionId } from "../lib/sections";export type { SectionId } from "../lib/sections";@@ -13,7 +13,7 @@ export function SettingsTabs({ active, onSelect }: { active: SectionId; onSelectreturn (<nav aria-label="Settings" data-slot="settings-desktop-tabs" className="flex gap-1 overflow-x-auto p-2 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden">{SECTIONS.map(({ id, label, icon: Icon, blurb }) => {- const on = id === active;+ const on = settingsNavActive(id, active);return (<button key={id} type="button" aria-current={on ? "page" : undefined} title={blurb} onClick={() => onSelect(id)}className={cn("flex min-h-11 shrink-0 items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-medium leading-none transition-colors", on ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:bg-accent hover:text-foreground")}@@ -33,7 +33,7 @@ export function SettingsSidebar({ active, onSelect, windows = false }: { active:return (<div className="flex h-full min-h-0 flex-col"><div className={cn("space-y-4 px-3 pb-3 pt-5", windows && "px-4")}>- <Button variant="ghost" onClick={() => onSelect("about")} className="h-auto w-full justify-start gap-3 px-1 py-2 text-left">+ <Button variant="ghost" onClick={() => onSelect("account")} className="h-auto w-full justify-start gap-3 px-1 py-2 text-left"><span className={cn("grid size-11 shrink-0 place-items-center bg-secondary", windows ? "rounded-full" : "rounded-xl")}><Monitor className="size-6 text-muted-foreground" /></span><span><span className="block text-sm font-semibold">MSO</span><span className="block text-xs font-normal text-muted-foreground">{windows ? "Settings" : "System Settings"}</span></span></Button>@@ -46,7 +46,7 @@ export function SettingsSidebar({ active, onSelect, windows = false }: { active:{groups.map((group) => <div key={group[0].group} className="space-y-0.5"><p className="px-2 pb-1 text-[11px] font-medium text-muted-foreground">{({ personalization: "Personalization", services: "Apps & connections", system: "System" })[group[0].group]}</p>{group.map(({ id, label, icon: Icon, color, blurb }) => {- const on = id === active;+ const on = settingsNavActive(id, active);return <Button key={id} variant="ghost" aria-current={on ? "page" : undefined} title={blurb} onClick={() => onSelect(id)}className={cn("relative h-auto min-h-11 w-full justify-start gap-2.5 rounded-md px-2 py-1.5 text-left text-[13px] font-normal", on ? windows ? "bg-accent text-accent-foreground hover:bg-accent" : "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground" : "text-foreground hover:bg-accent")}>{windows && on && <span className="absolute left-0 h-4 w-[3px] rounded-full bg-primary" />}diff --git a/frontend/slices/os-settings/components/sections.tsx b/frontend/slices/os-settings/components/sections.tsxindex 32592ed5..60f1d3bf 100644--- a/frontend/slices/os-settings/components/sections.tsx+++ b/frontend/slices/os-settings/components/sections.tsx@@ -9,7 +9,7 @@ import { DevicesPanel, useSession } from "@/features/auth";import { SettingsSection } from "@/features/shell-settings";import { cn } from "@/lib/utils";import { Lock, ShieldCheck } from "lucide-react";-import { SECTIONS, type SectionId } from "../lib/sections";+import { settingsSection, type SectionId } from "../lib/sections";import { AutoLockRow } from "./auto-lock-row";@@ -17,6 +17,7 @@ import { AutoLockRow } from "./auto-lock-row";// fetches before its existing role gate allows it; inactive sections stay deferred.const loadingSection = () => <p role="status" className="p-3 text-sm text-muted-foreground">Loading settings…</p>;const A2ASection = dynamic(() => import("./a2a-section").then((module) => module.A2ASection), { loading: loadingSection });+const AccountSection = dynamic(() => import("./account-section").then((module) => module.AccountSection), { loading: loadingSection });const AboutSection = dynamic(() => import("./about-section").then((module) => module.AboutSection), { loading: loadingSection });const AiSection = dynamic(() => import("./ai-section").then((module) => module.AiSection), { loading: loadingSection });const AppearanceSection = dynamic(() => import("./appearance-section").then((module) => module.AppearanceSection), { loading: loadingSection });@@ -43,7 +44,7 @@ const OWNER_ONLY = new Set<SectionId>(["backup",]);-export function SettingsSectionBody({ id }: { id: SectionId }) {+export function SettingsSectionBody({ id, onOpen }: { id: SectionId; onOpen?: (id: SectionId) => void }) {const { status, role } = useSession();const privateSection = ["a2a", "devices", "cleanup", "ai"].includes(id);if (privateSection && status !== "in") return <SettingsSection icon={<Lock />} title="Sign in to manage this section">@@ -64,6 +65,8 @@ export function SettingsSectionBody({ id }: { id: SectionId }) {);}switch (id) {+ case "account":+ return <AccountSection onOpen={onOpen ?? (() => {})} />;case "appearance":return <AppearanceSection />;case "theme":@@ -115,12 +118,14 @@ export function SettingsSectionBody({ id }: { id: SectionId }) {export function SectionDetail({id,showHeading = true,+ onOpen,}: {id: SectionId;showHeading?: boolean;+ onOpen?: (id: SectionId) => void;}) {const { id: shellId } = useActiveShell();- const meta = SECTIONS.find((s) => s.id === id);+ const meta = settingsSection(id);return (<ScrollArea className="h-full"><div@@ -142,7 +147,7 @@ export function SectionDetail({<p className="text-xs text-muted-foreground">{meta.blurb}</p></header>)}- <SettingsSectionBody id={id} />+ <SettingsSectionBody id={id} onOpen={onOpen} /></div></ScrollArea>);diff --git a/frontend/slices/os-settings/components/settings-shell.tsx b/frontend/slices/os-settings/components/settings-shell.tsxindex 4bf258dd..bf3f7620 100644--- a/frontend/slices/os-settings/components/settings-shell.tsx+++ b/frontend/slices/os-settings/components/settings-shell.tsx@@ -5,7 +5,7 @@ import { PanelLeft } from "lucide-react";import { Button } from "@/components/ui/button";import { AppSidebar, AppFrame, usePublishMobileNavigation, useShellDesign } from "@/features/appshell";import type { SectionId } from "../lib/sections";-import { settingsSection } from "../lib/sections";+import { settingsBackTarget, settingsSection } from "../lib/sections";import { SettingsSidebar, SettingsTabs } from "./nav";import { IosSettings } from "./ios-settings";import { SectionDetail } from "./sections";@@ -16,11 +16,12 @@ export function SettingsShell({ active, onSelect }: { active: SectionId | null;const [sidebarOpen, setSidebarOpen] = useState(false);const detail = active ? settingsSection(active) : null;const mobile = design.mobileNavigation !== "none";+ const backTo = active ? settingsBackTarget(active) : null;usePublishMobileNavigation("os-settings",- mobile && detail ? { title: detail.label, backLabel: "Settings", onBack: () => onSelect(null) } : null,- [mobile, detail?.id, detail?.label, onSelect],+ mobile && detail ? { title: detail.label, backLabel: backTo ? "Account" : "Settings", onBack: () => onSelect(backTo) } : null,+ [mobile, detail?.id, detail?.label, backTo, onSelect],);if (design.settingsNavigation === "ios-stack") {@@ -34,7 +35,7 @@ export function SettingsShell({ active, onSelect }: { active: SectionId | null;if (design.settingsNavigation === "android-stack") {return (<AppFrame safeArea={false} bodyClassName="overflow-hidden bg-background">- {active ? <SectionDetail id={active} showHeading={false} /> : <AndroidSettingsIndex onSelect={(id) => onSelect(id)} />}+ {active ? <SectionDetail id={active} showHeading={false} onOpen={(id) => onSelect(id)} /> : <AndroidSettingsIndex onSelect={(id) => onSelect(id)} />}</AppFrame>);}@@ -50,7 +51,7 @@ export function SettingsShell({ active, onSelect }: { active: SectionId | null;<AppFrame className="min-w-0 flex-1" toolbar={<div className="hidden border-b border-border p-1 @max-[600px]:block"><Button variant="ghost" size="sm" onClick={() => setSidebarOpen(true)}><PanelLeft className="size-4" /> Settings sections</Button></div>}>- <SectionDetail id={desktopActive} />+ <SectionDetail id={desktopActive} onOpen={(id) => onSelect(id)} /></AppFrame></div>);@@ -58,7 +59,7 @@ export function SettingsShell({ active, onSelect }: { active: SectionId | null;return (<AppFrame toolbar={<div className="bg-sidebar/40"><SettingsTabs active={desktopActive} onSelect={(id) => onSelect(id)} /></div>}>- <SectionDetail id={desktopActive} />+ <SectionDetail id={desktopActive} onOpen={(id) => onSelect(id)} /></AppFrame>);}diff --git a/frontend/slices/os-settings/lib/changelog.test.ts b/frontend/slices/os-settings/lib/changelog.test.tsindex 0ef846df..9c1a4fe6 100644--- a/frontend/slices/os-settings/lib/changelog.test.ts+++ b/frontend/slices/os-settings/lib/changelog.test.ts@@ -1,4 +1,4 @@-// The generated changelog is what Settings → About shows as "What's new", so what+// The generated changelog is what Settings → Account → About shows as "What's new", so what// this parser drops, the owner never sees. These pin the two things that were// actually wrong when it was rendered as markdown: the developer preamble reached// the reader, and the `scope` chip was just more prose.diff --git a/frontend/slices/os-settings/lib/sections.test.ts b/frontend/slices/os-settings/lib/sections.test.tsindex 195c9c6f..4087d5bc 100644--- a/frontend/slices/os-settings/lib/sections.test.ts+++ b/frontend/slices/os-settings/lib/sections.test.ts@@ -1,21 +1,33 @@import { describe, expect, it } from "vitest";-import { filterSettingsSections, groupSettingsSections, settingsSection } from "./sections";+import { filterSettingsSections, groupSettingsSections, sectionFromSearch, settingsBackTarget, settingsNavActive, settingsSection, SECTIONS } from "./sections";describe("settings section model", () => {it("filters metadata without depending on a renderer", () => {expect(filterSettingsSections("chatgpt").map((x) => x.id)).toEqual(["mcp"]);expect(filterSettingsSections("wallpaper").map((x) => x.id)).toEqual(["appearance"]);+ expect(filterSettingsSections("devices").map((x) => x.id)).toEqual(["account"]);+ expect(filterSettingsSections("system info").map((x) => x.id)).toEqual(["account"]);});- it("groups by semantic category instead of array indexes", () => {+ it("groups Account with personalization and keeps Devices and About nested", () => {+ expect(SECTIONS.map((section) => section.id)).not.toContain("devices");+ expect(SECTIONS.map((section) => section.id)).not.toContain("about");expect(groupSettingsSections().map((group) => group.map((x) => x.id))).toEqual([- ["appearance", "theme"],+ ["account", "appearance", "theme"],["ai", "quicklinks", "mcp", "a2a"],- ["devices", "server", "cleanup", "backup", "about"],+ ["server", "cleanup", "backup"],]);});- it("keeps About content identity separate from the category metadata", () => {+ it("opens Devices and About from Account, including old deep links", () => {+ expect(settingsSection("account")).toMatchObject({ label: "Account" });expect(settingsSection("about")).toMatchObject({ label: "About", blurb: "System info and reset" });+ expect(settingsSection("devices").label).toBe("Devices");+ expect(sectionFromSearch("devices")).toBe("devices");+ expect(sectionFromSearch("about")).toBe("about");+ expect(settingsNavActive("account", "about")).toBe(true);+ expect(settingsNavActive("server", "about")).toBe(false);+ expect(settingsBackTarget("devices")).toBe("account");+ expect(settingsBackTarget("appearance")).toBeNull();});});diff --git a/frontend/slices/os-settings/lib/sections.ts b/frontend/slices/os-settings/lib/sections.tsindex 8cd11728..4ae57be1 100644--- a/frontend/slices/os-settings/lib/sections.ts+++ b/frontend/slices/os-settings/lib/sections.ts@@ -1,19 +1,21 @@import {-DatabaseBackup,-Info,-Link2,-Network,-Paintbrush,-Palette,-Plug,-Server,-ShieldCheck,-Sparkles,-Trash2,+ DatabaseBackup,+ Info,+ Link2,+ Network,+ Paintbrush,+ Palette,+ Plug,+ Server,+ ShieldCheck,+ Sparkles,+ Trash2,+ UserRound,} from "lucide-react";import type { ComponentType } from "react";export type SectionId =+ | "account"| "appearance"| "theme"| "ai"@@ -36,109 +38,141 @@ export type SettingsSectionMeta = {group: SettingsGroup;};-/** Presentation-agnostic Settings navigation model. */-export const SECTIONS: ReadonlyArray<SettingsSectionMeta> = [- {- id: "appearance",+type SectionFields = Omit<SettingsSectionMeta, "id">;++const CATALOG: Record<SectionId, SectionFields> = {+ account: {+ label: "Account",+ blurb: "Name, icon, password, devices, and about",+ icon: UserRound,+ color: "var(--primary)",+ group: "personalization",+ },+ appearance: {label: "Appearance",blurb: "Style, accent, wallpaper, device",icon: Palette,color: "var(--primary)",group: "personalization",},- {- id: "theme",+ theme: {label: "Theme",blurb: "Mode, presets, font, contrast",icon: Paintbrush,color: "var(--primary)",group: "personalization",},- {- id: "ai",+ ai: {label: "AI",blurb: "Model and API key",icon: Sparkles,color: "var(--primary)",group: "services",},- {- id: "quicklinks",+ quicklinks: {label: "Quicklink",blurb: "Website shortcuts with favicons",icon: Link2,color: "var(--primary)",group: "services",},- {- id: "mcp",+ mcp: {label: "MCP",blurb: "Connect ChatGPT, Cursor & AI apps; manage access and activity",icon: Plug,color: "var(--primary)",group: "services",},- {- id: "a2a",+ a2a: {label: "A2A",blurb: "Connect agents and review their tasks",icon: Network,color: "var(--primary)",group: "services",},- {- id: "devices",+ devices: {label: "Devices",blurb: "Approved browsers and sessions",icon: ShieldCheck,color: "var(--primary)",group: "system",},- {- id: "server",+ server: {label: "Server",blurb: "Mock or live host data",icon: Server,color: "var(--primary)",group: "system",},- {- id: "cleanup",+ cleanup: {label: "Cleanup",blurb: "Free disk space safely",icon: Trash2,color: "var(--primary)",group: "system",},- {- id: "backup",+ backup: {label: "Backup",blurb: "Export or restore browser data",icon: DatabaseBackup,color: "var(--primary)",group: "system",},- {- id: "about",+ about: {label: "About",blurb: "System info and reset",icon: Info,color: "var(--primary)",group: "system",},+};++const NAV_ORDER: readonly SectionId[] = [+ "account",+ "appearance",+ "theme",+ "ai",+ "quicklinks",+ "mcp",+ "a2a",+ "server",+ "cleanup",+ "backup",];+const SEARCH_EXTRA: Partial<Record<SectionId, string>> = {+ account: "devices approved browsers sessions about system info reset rename password icon",+};++function meta(id: SectionId): SettingsSectionMeta {+ return { id, ...CATALOG[id] };+}++/** Top-level Settings navigation. Devices and About are opened from Account. */+export const SECTIONS: ReadonlyArray<SettingsSectionMeta> = NAV_ORDER.map(meta);+export function settingsSection(id: SectionId): SettingsSectionMeta {- return SECTIONS.find((section) => section.id === id)!;+ return meta(id);+}++export function sectionFromSearch(value: string | null): SectionId | undefined {+ if (value === "devices" || value === "about") return value;+ return SECTIONS.find((section) => section.id === value)?.id;+}++export function settingsNavActive(id: SectionId, active: SectionId): boolean {+ return id === active || (id === "account" && (active === "devices" || active === "about"));+}++export function settingsBackTarget(active: SectionId): SectionId | null {+ return active === "devices" || active === "about" ? "account" : null;}-export function filterSettingsSections(- query: string,-): ReadonlyArray<SettingsSectionMeta> {+export function filterSettingsSections(query: string): ReadonlyArray<SettingsSectionMeta> {const q = query.trim().toLowerCase();if (!q) return SECTIONS;return SECTIONS.filter((section) =>- `${section.label} ${section.blurb}`.toLowerCase().includes(q),+ `${section.label} ${section.blurb} ${SEARCH_EXTRA[section.id] ?? ""}`.toLowerCase().includes(q),);}diff --git a/lib/auth/account-profile-model.ts b/lib/auth/account-profile-model.tsnew file mode 100644index 00000000..e2016b28--- /dev/null+++ b/lib/auth/account-profile-model.ts@@ -0,0 +1,36 @@+// Display identity for the single owner account. This is not a login secret,+// a second user directory, or a password store. The login password remains+// OS_LOGIN_PASSWORD.++export const ACCOUNT_PRESETS = ["user", "spark", "shield", "star", "heart", "zap", "leaf", "compass"] as const;+export type AccountPreset = (typeof ACCOUNT_PRESETS)[number];++export type AccountIcon =+ | { type: "preset"; id: AccountPreset }+ | { type: "image"; src: string };++export type AccountProfile = {+ name: string;+ icon: AccountIcon;+};++export const DEFAULT_ACCOUNT_PROFILE: AccountProfile = {+ name: "Owner",+ icon: { type: "preset", id: "user" },+};++export function cleanAccountName(value: unknown): string | null {+ if (typeof value !== "string") return null;+ if (/[\u0000-\u001F\u007F]/.test(value)) return null;+ const name = value.trim().replace(/ {2,}/g, " ");+ if (name.length < 1 || name.length > 40) return null;+ return name;+}++export function presetIcon(value: unknown): AccountIcon | null {+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;+ const row = value as Record<string, unknown>;+ if (row.type !== "preset" || typeof row.id !== "string") return null;+ if (!(ACCOUNT_PRESETS as readonly string[]).includes(row.id)) return null;+ return { type: "preset", id: row.id as AccountPreset };+}diff --git a/lib/auth/account-profile.test.ts b/lib/auth/account-profile.test.tsnew file mode 100644index 00000000..b96d0ac6--- /dev/null+++ b/lib/auth/account-profile.test.ts@@ -0,0 +1,60 @@+import { promises as fs } from "fs";+import os from "os";+import path from "path";+import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { DEFAULT_ACCOUNT_PROFILE } from "./account-profile-model";+import { AccountProfileError, readAccountProfile, writeAccountProfile } from "./account-profile";++let dir: string;+let file: string;++function dataUrl(kind: string, bytes: number[]): string {+ return `data:image/${kind};base64,${Buffer.from(bytes).toString("base64")}`;+}++const png = dataUrl("png", [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0, 0, 0, 0, 0, 0, 0, 0]);++beforeEach(async () => {+ dir = await fs.mkdtemp(path.join(os.tmpdir(), "mso-account-"));+ file = path.join(dir, "account.json");+ process.env.OS_ACCOUNT_STORE = file;+});++afterEach(async () => {+ delete process.env.OS_ACCOUNT_STORE;+ await fs.rm(dir, { recursive: true, force: true });+});++describe("account profile", () => {+ it("returns the default owner identity when no profile has been saved", async () => {+ expect(await readAccountProfile()).toEqual(DEFAULT_ACCOUNT_PROFILE);+ });++ it("saves a display name and a preset or raster icon without a password field", async () => {+ await writeAccountProfile({ name: " Rahman " });+ expect(await readAccountProfile()).toEqual({ name: "Rahman", icon: { type: "preset", id: "user" } });+ await writeAccountProfile({ icon: { type: "preset", id: "star" } });+ await writeAccountProfile({ icon: { type: "image", src: png } });+ const saved = JSON.parse(await fs.readFile(file, "utf8")) as Record<string, unknown>;+ expect(saved).toEqual({ name: "Rahman", icon: { type: "image", src: png } });+ expect(saved).not.toHaveProperty("password");+ const stat = await fs.stat(file);+ expect(stat.mode & 0o077).toBe(0);+ });++ it("rejects control characters, oversized names, and non-raster icons", async () => {+ await expect(writeAccountProfile({ name: "bad\nname" })).rejects.toMatchObject({ code: "invalid" });+ await expect(writeAccountProfile({ name: "x".repeat(41) })).rejects.toBeInstanceOf(AccountProfileError);+ await expect(writeAccountProfile({ icon: { type: "preset", id: "root" } })).rejects.toMatchObject({ code: "invalid" });+ await expect(writeAccountProfile({ icon: { type: "image", src: "data:image/svg+xml;base64,PHN2Zy8+" } })).rejects.toMatchObject({ code: "invalid" });+ expect(await readAccountProfile()).toEqual(DEFAULT_ACCOUNT_PROFILE);+ });++ it("fails closed on a corrupt profile instead of replacing it", async () => {+ await fs.mkdir(dir, { recursive: true });+ await fs.writeFile(file, "{", "utf8");+ await expect(readAccountProfile()).rejects.toMatchObject({ code: "corrupt" });+ await expect(writeAccountProfile({ name: "Rahman" })).rejects.toMatchObject({ code: "corrupt" });+ expect(await fs.readFile(file, "utf8")).toBe("{");+ });+});diff --git a/lib/auth/account-profile.ts b/lib/auth/account-profile.tsnew file mode 100644index 00000000..4a3ad426--- /dev/null+++ b/lib/auth/account-profile.ts@@ -0,0 +1,95 @@+import { expandOwnerStorePath } from "@/lib/owner-store-path.js";+import { promises as fs } from "fs";+import os from "os";+import path from "path";+import {+ cleanAccountName,+ DEFAULT_ACCOUNT_PROFILE,+ presetIcon,+ type AccountIcon,+ type AccountProfile,+} from "./account-profile-model";++const PNG = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);+const DATA_URL = /^data:image\/(png|jpeg|webp|gif);base64,([A-Za-z0-9+/]+={0,2})$/;++export class AccountProfileError extends Error {+ constructor(readonly code: "corrupt" | "invalid") {+ super(code);+ this.name = "AccountProfileError";+ }+}++function storePath(): string {+ return expandOwnerStorePath(process.env.OS_ACCOUNT_STORE ?? path.join(os.homedir(), ".mso", "account.json"));+}++function imageIcon(value: unknown): AccountIcon | null {+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;+ const row = value as Record<string, unknown>;+ if (row.type !== "image" || typeof row.src !== "string" || row.src.length > 48_000) return null;+ const match = DATA_URL.exec(row.src);+ if (!match) return null;+ const bytes = Buffer.from(match[2], "base64");+ if (bytes.length < 16 || bytes.length > 32_000) return null;+ const kind = match[1];+ const gif = bytes.subarray(0, 6).toString("ascii");+ const ok = kind === "png" ? bytes.subarray(0, 8).equals(PNG)+ : kind === "jpeg" ? bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff+ : kind === "gif" ? gif === "GIF87a" || gif === "GIF89a"+ : bytes.subarray(0, 4).toString("ascii") === "RIFF" && bytes.subarray(8, 12).toString("ascii") === "WEBP";+ return ok ? { type: "image", src: row.src } : null;+}++export function cleanAccountIcon(value: unknown): AccountIcon | null {+ return presetIcon(value) ?? imageIcon(value);+}++function parseProfile(raw: string): AccountProfile {+ let parsed: unknown;+ try {+ parsed = JSON.parse(raw);+ } catch {+ throw new AccountProfileError("corrupt");+ }+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new AccountProfileError("corrupt");+ const row = parsed as Record<string, unknown>;+ const name = cleanAccountName(row.name);+ const icon = cleanAccountIcon(row.icon);+ if (!name || !icon) throw new AccountProfileError("corrupt");+ return { name, icon };+}++export async function readAccountProfile(): Promise<AccountProfile> {+ try {+ return parseProfile(await fs.readFile(storePath(), "utf8"));+ } catch (error) {+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return { ...DEFAULT_ACCOUNT_PROFILE };+ if (error instanceof AccountProfileError) throw error;+ throw new AccountProfileError("corrupt");+ }+}++let writeChain: Promise<unknown> = Promise.resolve();++async function persist(profile: AccountProfile): Promise<void> {+ const file = storePath();+ await fs.mkdir(path.dirname(file), { recursive: true, mode: 0o700 });+ const tmp = `${file}.${process.pid}.tmp`;+ await fs.writeFile(tmp, JSON.stringify(profile), { encoding: "utf8", mode: 0o600 });+ await fs.rename(tmp, file);+}++export async function writeAccountProfile(patch: { name?: unknown; icon?: unknown }): Promise<AccountProfile> {+ const run = writeChain.then(async () => {+ const current = await readAccountProfile();+ const name = patch.name === undefined ? current.name : cleanAccountName(patch.name);+ const icon = patch.icon === undefined ? current.icon : cleanAccountIcon(patch.icon);+ if (!name || !icon) throw new AccountProfileError("invalid");+ const next: AccountProfile = { name, icon };+ await persist(next);+ return next;+ });+ writeChain = run.catch(() => undefined);+ return run;+}diff --git a/lib/auth/login-password.test.ts b/lib/auth/login-password.test.tsnew file mode 100644index 00000000..db7066ba--- /dev/null+++ b/lib/auth/login-password.test.ts@@ -0,0 +1,91 @@+import { promises as fs } from "fs";+import os from "os";+import path from "path";+import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { resetLoginPasswordAttempts, rotateLoginPassword } from "./login-password";++const CURRENT = "current-pass";+const NEXT = "next-pass-1";+let dir: string;+let file: string;+let previous: string | undefined;++async function put(contents: string, mode = 0o600) {+ await fs.writeFile(file, contents, { mode: 0o600 });+ await fs.chmod(file, mode);+}++beforeEach(async () => {+ dir = await fs.mkdtemp(path.join(os.tmpdir(), "mso-login-pw-"));+ file = path.join(dir, ".env.local");+ previous = process.env.OS_LOGIN_PASSWORD;+ process.env.OS_LOGIN_PASSWORD = CURRENT;+ resetLoginPasswordAttempts();+ await put(`OS_SESSION_SECRET=fixture-session-secret-long-enough\nOS_LOGIN_PASSWORD=${CURRENT}\n`);+});++afterEach(async () => {+ if (previous === undefined) delete process.env.OS_LOGIN_PASSWORD;+ else process.env.OS_LOGIN_PASSWORD = previous;+ resetLoginPasswordAttempts();+ await fs.rm(dir, { recursive: true, force: true });+});++const rotate = (patch: Partial<{ current: string; next: string; confirm: string; file: string }> = {}) =>+ rotateLoginPassword({+ current: patch.current ?? CURRENT,+ next: patch.next ?? NEXT,+ confirm: patch.confirm ?? NEXT,+ actor: "device-1",+ file: patch.file ?? file,+ });++describe("login password rotation", () => {+ it("rewrites only the login secret and keeps the running process in sync", async () => {+ await rotate();+ const text = await fs.readFile(file, "utf8");+ expect(text).toContain(`OS_LOGIN_PASSWORD=${NEXT}`);+ expect(text).toContain("OS_SESSION_SECRET=fixture-session-secret-long-enough");+ expect(text).not.toContain(CURRENT);+ expect(process.env.OS_LOGIN_PASSWORD).toBe(NEXT);+ });++ it("rejects a wrong, mismatched, weak, or unchanged password without writing", async () => {+ const before = await fs.readFile(file, "utf8");+ await expect(rotate({ current: "nope-pass" })).rejects.toMatchObject({ code: "bad_current" });+ await expect(rotate({ confirm: "other-pass" })).rejects.toMatchObject({ code: "mismatch" });+ await expect(rotate({ next: "bad pass", confirm: "bad pass" })).rejects.toMatchObject({ code: "weak_password" });+ await expect(rotate({ next: CURRENT, confirm: CURRENT })).rejects.toMatchObject({ code: "unchanged" });+ expect(await fs.readFile(file, "utf8")).toBe(before);+ expect(process.env.OS_LOGIN_PASSWORD).toBe(CURRENT);+ });++ it("does not follow a symlink or a group-readable env file", async () => {+ const link = path.join(dir, "linked.env");+ await fs.symlink(file, link);+ await expect(rotate({ file: link })).rejects.toMatchObject({ code: "password_file_unsafe" });+ await put(`OS_LOGIN_PASSWORD=${CURRENT}\n`, 0o640);+ await expect(rotate()).rejects.toMatchObject({ code: "password_file_unsafe" });+ expect(process.env.OS_LOGIN_PASSWORD).toBe(CURRENT);+ });++ it("refuses to rotate when the file is not the live password source", async () => {+ await put("OS_LOGIN_PASSWORD=someone-else\n");+ await expect(rotate()).rejects.toMatchObject({ code: "password_source_mismatch" });+ expect(await fs.readFile(file, "utf8")).toBe("OS_LOGIN_PASSWORD=someone-else\n");+ });++ it("stops guessing after five wrong passwords and never echoes the secret", async () => {+ for (let i = 0; i < 5; i += 1) {+ await expect(rotate({ current: "nope-pass" })).rejects.toMatchObject({ code: "bad_current" });+ }+ try {+ await rotate({ current: NEXT });+ expect.unreachable();+ } catch (error) {+ expect(error).toMatchObject({ code: "rate_limited" });+ expect(String(error)).not.toContain(NEXT);+ expect(String(error)).not.toContain(CURRENT);+ }+ });+});diff --git a/lib/auth/login-password.ts b/lib/auth/login-password.tsnew file mode 100644index 00000000..c8f60621--- /dev/null+++ b/lib/auth/login-password.ts@@ -0,0 +1,147 @@+import { constants as fsConstants, promises as fs } from "fs";+import path from "path";+import { constantTimeEq, MAX_COMPARE_BYTES } from "./session";++// Rotates the existing login secret. There is no password hash and no second+// credential store: login still compares OS_LOGIN_PASSWORD in constant time,+// and the durable copy remains the service EnvironmentFile (.env.local).++const WINDOW_MS = 60_000;+const MAX_FAILURES = 5;+const SAFE_PASSWORD = /^[A-Za-z0-9!@%^*_+\-=.,:?~]{6,128}$/;+const failures = new Map<string, { count: number; resetAt: number }>();++export type LoginPasswordCode =+ | "not_configured"+ | "bad_current"+ | "mismatch"+ | "weak_password"+ | "unchanged"+ | "password_source_mismatch"+ | "password_file_unsafe"+ | "rate_limited";++export class LoginPasswordError extends Error {+ constructor(readonly code: LoginPasswordCode) {+ super(code);+ this.name = "LoginPasswordError";+ }+}++export function resetLoginPasswordAttempts(): void {+ failures.clear();+}++export function loginPasswordPath(): string {+ return path.join(process.cwd(), ".env.local");+}++function bounded(value: string): boolean {+ return value.length > 0 && Buffer.byteLength(value, "utf8") <= MAX_COMPARE_BYTES;+}++export function passwordPolicyError(value: string): "weak_password" | null {+ if (!bounded(value) || !SAFE_PASSWORD.test(value)) return "weak_password";+ return null;+}++function limited(actor: string): boolean {+ const now = Date.now();+ const entry = failures.get(actor);+ return Boolean(entry && now <= entry.resetAt && entry.count >= MAX_FAILURES);+}++function noteFailure(actor: string): void {+ const now = Date.now();+ const entry = failures.get(actor);+ if (!entry || now > entry.resetAt) failures.set(actor, { count: 1, resetAt: now + WINDOW_MS });+ else entry.count += 1;+}++export function extractLoginPassword(text: string): string {+ const hits = text.split(/\n/).map((line) => line.replace(/\r$/, "")).filter((line) => line.startsWith("OS_LOGIN_PASSWORD="));+ if (hits.length !== 1) throw new LoginPasswordError("password_source_mismatch");+ let value = hits[0].slice("OS_LOGIN_PASSWORD=".length);+ if (value.startsWith("\"") && value.endsWith("\"") && value.length >= 2) {+ value = value.slice(1, -1).replace(/\\"/g, "\"").replace(/\\\\/g, "\\");+ }+ if (!bounded(value)) throw new LoginPasswordError("password_source_mismatch");+ return value;+}++export function replaceLoginPassword(text: string, next: string): string {+ if (passwordPolicyError(next)) throw new LoginPasswordError("weak_password");+ let seen = 0;+ const lines = text.split(/\n/).map((line) => {+ const bare = line.replace(/\r$/, "");+ if (!bare.startsWith("OS_LOGIN_PASSWORD=")) return line;+ seen += 1;+ return line.endsWith("\r") ? `OS_LOGIN_PASSWORD=${next}\r` : `OS_LOGIN_PASSWORD=${next}`;+ });+ if (seen !== 1) throw new LoginPasswordError("password_source_mismatch");+ return lines.join("\n");+}++async function readEnvFile(file: string): Promise<string> {+ let handle: Awaited<ReturnType<typeof fs.open>> | null = null;+ try {+ handle = await fs.open(file, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW);+ const stat = await handle.stat();+ const uid = process.getuid?.();+ if (!stat.isFile() || stat.size > 256 * 1024 || (stat.mode & 0o077) || (uid !== undefined && stat.uid !== uid)) {+ throw new LoginPasswordError("password_file_unsafe");+ }+ return await handle.readFile("utf8");+ } catch (error) {+ if (error instanceof LoginPasswordError) throw error;+ const code = (error as NodeJS.ErrnoException).code;+ if (code === "ENOENT") throw new LoginPasswordError("password_source_mismatch");+ throw new LoginPasswordError("password_file_unsafe");+ } finally {+ await handle?.close();+ }+}++async function writeEnvFile(file: string, text: string): Promise<void> {+ const tmp = `${file}.${process.pid}.tmp`;+ let handle: Awaited<ReturnType<typeof fs.open>> | null = null;+ try {+ handle = await fs.open(tmp, fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL | fsConstants.O_NOFOLLOW, 0o600);+ await handle.writeFile(text, "utf8");+ await handle.close();+ handle = null;+ await fs.rename(tmp, file);+ } catch (error) {+ if (handle) await handle.close();+ await fs.unlink(tmp).catch(() => undefined);+ if (error instanceof LoginPasswordError) throw error;+ throw new LoginPasswordError("password_file_unsafe");+ }+}++export async function rotateLoginPassword(input: {+ current: string;+ next: string;+ confirm: string;+ actor: string;+ file?: string;+}): Promise<void> {+ const actor = input.actor || "owner";+ if (limited(actor)) throw new LoginPasswordError("rate_limited");+ if (passwordPolicyError(input.next)) throw new LoginPasswordError("weak_password");+ if (!bounded(input.confirm) || !constantTimeEq(input.next, input.confirm)) throw new LoginPasswordError("mismatch");+ const configured = process.env.OS_LOGIN_PASSWORD ?? "";+ if (configured.length < 6 || !bounded(configured)) throw new LoginPasswordError("not_configured");+ if (!bounded(input.current) || !constantTimeEq(configured, input.current)) {+ noteFailure(actor);+ throw new LoginPasswordError("bad_current");+ }+ if (constantTimeEq(configured, input.next)) throw new LoginPasswordError("unchanged");+ const file = input.file ?? loginPasswordPath();+ const text = await readEnvFile(file);+ const stored = extractLoginPassword(text);+ if (!constantTimeEq(stored, configured)) throw new LoginPasswordError("password_source_mismatch");+ await writeEnvFile(file, replaceLoginPassword(text, input.next));+ process.env.OS_LOGIN_PASSWORD = input.next;+ failures.delete(actor);+}diff --git a/lib/contracts/audit.ts b/lib/contracts/audit.tsindex 68cc543a..123aa7c6 100644--- a/lib/contracts/audit.ts+++ b/lib/contracts/audit.ts@@ -16,7 +16,7 @@ export type AuditAction =| "sys.cleanup"| "sys.memory-backup"| "sys.service"- /** The cockpit replacing its own code (Settings → About, or `mso update run`). */+ /** The cockpit replacing its own code (Settings → Account → About, or `mso update run`). */| "sys.update"| "managed-app.action"| "infra.write"@@ -48,4 +48,6 @@ export type AuditAction =| "auth.ratelimited"| "auth.logout"| "auth.device"+ | "auth.account"+ | "auth.password"| "framework.error";diff --git a/lib/install-docs-contract.test.ts b/lib/install-docs-contract.test.tsindex 29920126..504df706 100644--- a/lib/install-docs-contract.test.ts+++ b/lib/install-docs-contract.test.ts@@ -73,7 +73,7 @@ describe("installer documentation contract", () => {it("prints modern update surfaces plus a legacy fallback after installation", () => {expect(core).toContain("Update: mso update");- expect(core).toContain("Settings → About");+ expect(core).toContain("Settings → Account → About");expect(core).toContain("Legacy: re-run the official one-line installer");expect(core).toContain('ok "mso updated at $DIR"');const pairing = core.indexOf("Pair your first device after the API is running");diff --git a/lib/os-api/format.ts b/lib/os-api/format.tsindex 2d69f7bd..1523abd5 100644--- a/lib/os-api/format.ts+++ b/lib/os-api/format.ts@@ -1,5 +1,5 @@// Telemetry formatters shared by every surface that renders SysStats/FsUsage-// (System Monitor, Settings → About, terminal neofetch…). One machine → one+// (System Monitor, Settings → Account → About, terminal neofetch…). One machine → one// set of numbers: binary GiB everywhere, uptime from the ms contract.const GiB = 1024 ** 3;diff --git a/next.config.mjs b/next.config.mjsindex 479a9dfb..4c632d3b 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -8,7 +8,7 @@ const BUILD_ID =// WHICH COMMIT THIS BUILD IS, baked in at build time — the only way the running app// can know it, since `git rev-parse HEAD` at runtime answers for the CHECKOUT, which-// moves whenever someone pulls. Settings → About compares the two: equal means the+// moves whenever someone pulls. Settings → Account → About compares the two: equal means the// running build is current, different means a build is pending and the update panel// offers the rebuild. Empty is fine and expected — scripts/verify-build.sh compiles// a `git archive` export with no .git in it.diff --git a/scripts/cli/commands-admin.sh b/scripts/cli/commands-admin.shindex 3796a5a1..7873ca09 100755--- a/scripts/cli/commands-admin.sh+++ b/scripts/cli/commands-admin.sh@@ -83,7 +83,7 @@ case "$cmd" in# checkout-wide quiesce/build/restart/restore lifecycle as service self-update.build) (cd "$ROOT" && bash scripts/verify-build.sh) ;;deploy) deploy_safe ;;- # The same self-update Settings → About drives, so both surfaces get the same+ # The same self-update Settings → Account → About drives, so both surfaces get the same# preflight and the same transient-unit handoff (a build spawned from the service# would be killed by the restart it performs).update) local_url="$(gateway_local_url)"; MSO_UPDATE_ROOT="$ROOT" MSO_UPDATE_LOCAL_URL="$local_url" "$ROOT/scripts/mso-update" "$@" ;;diff --git a/scripts/e2e/preview.mjs b/scripts/e2e/preview.mjsindex e74854da..7ae85046 100644--- a/scripts/e2e/preview.mjs+++ b/scripts/e2e/preview.mjs@@ -201,10 +201,13 @@ const run = async () => {await open("report.docx");check(/No browser can render this format/i.test(await scope(page, "report.docx").innerText()), "DOCX says why, and offers the download");- // Settings → About: the update panel is the other thing that can only be wrong live.+ // Settings → Account → About: the update panel is the other thing that can only be wrong live.await page.goto(`${BASE}/settings`, { waitUntil: "domcontentloaded" });await page.waitForTimeout(2500);- const about = page.getByText("About", { exact: true }).first();+ const account = page.getByRole("button", { name: "Account", exact: true }).first();+ if (await account.count()) await account.click().catch(() => {});+ await page.waitForTimeout(800);+ const about = page.getByRole("button", { name: "About", exact: true }).first();if (await about.count()) await about.click().catch(() => {});await page.waitForTimeout(3500);const settings = await (MOBILE ? page.locator("#main-content") : page.locator("[data-window]").last()).innerText();diff --git a/scripts/gates.sh b/scripts/gates.shindex a8782b58..9ccbdbd6 100755--- a/scripts/gates.sh+++ b/scripts/gates.sh@@ -53,7 +53,7 @@ bun run verify || fail "verify failed." "reproduce: bun run verify"node scripts/check-cycles.mjs || fail "check-cycles: new import cycle introduced."node scripts/check-docs.mjs || fail "documentation drift detected." "fix current docs or their machine-readable markers before pushing."# docs/CHANGELOG.md is derived from git, so it can only be stale, never wrong —-# and a stale one is what Settings → About would show. `bun run ship` regenerates+# and a stale one is what Settings → Account → About would show. `bun run ship` regenerates# it before committing; this catches a plain `git push`.node scripts/gen-changelog.mjs --check || fail "changelog stale — run: node scripts/gen-changelog.mjs (or use \`bun run ship\`)."node scripts/check-contrast.mjs || fail "contrast regression detected."diff --git a/scripts/gen-changelog.mjs b/scripts/gen-changelog.mjsindex 68981c82..c89f1bf8 100644--- a/scripts/gen-changelog.mjs+++ b/scripts/gen-changelog.mjs@@ -6,7 +6,7 @@// reason. This does not reopen that: nothing is written here by hand, so there is// no second thing to keep in sync and no way for it to disagree with history.// PROGRESS.md stays the SSOT for WHY; this is a reverse-chronological WHAT, and it-// is what Settings → About renders as "What's new" so a change is visible in the+// is what Settings → Account → About renders as "What's new" so a change is visible in the// running app instead of only in a terminal.//// node scripts/gen-changelog.mjs # write docs/CHANGELOG.md@@ -95,7 +95,7 @@ const out = ["","**Generated — do not edit.** `node scripts/gen-changelog.mjs`, run by `bun run ship`.","Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;",- "this is the *what*, and it is what Settings → About shows as “What's new”.",+ "this is the *what*, and it is what Settings → Account → About shows as “What's new”.","",];diff --git a/scripts/gen-readme-media.mjs b/scripts/gen-readme-media.mjsindex dd682afa..6b8a4b1d 100644--- a/scripts/gen-readme-media.mjs+++ b/scripts/gen-readme-media.mjs@@ -5,7 +5,7 @@// OS_MEDIA_DEVICE=<approved-device-id> node scripts/gen-readme-media.mjs//// Requires: the server running (default http://127.0.0.1:4005), an APPROVED device-// id (Settings → Devices, or scripts/approve-device.js --list), OS_SESSION_SECRET in+// id (Settings → Account → Devices, or scripts/approve-device.js --list), OS_SESSION_SECRET in// .env.local, the Playwright install under os-browser/, and ffmpeg (for the gif).//// It also shot docs/media/hero-desktop.png until 2026-07-30. README.md:42 has rendereddiff --git a/scripts/install/finalize.sh b/scripts/install/finalize.shindex 8e3c6d5d..8b73ec9a 100755--- a/scripts/install/finalize.sh+++ b/scripts/install/finalize.sh@@ -91,7 +91,7 @@ cat <<EOF3. On this server:node $DIR/scripts/approve-device.js --list # see the pending idnode $DIR/scripts/approve-device.js <deviceId> "my phone" # approve it- 4. In that SAME browser origin, click "Check again". Approve later devices from Settings → Devices.+ 4. In that SAME browser origin, click "Check again". Approve later devices from Settings → Account → Devices.EOFficat <<EOF@@ -101,7 +101,7 @@ cat <<EOFOnboard: mso onboardPublic: mso gateway domain set https://mso.example.com (replace with your stable HTTPS hostname)then use a named Cloudflare Tunnel; Quick Tunnel is preview-only and never OS_PUBLIC_ORIGIN- Update: mso update (or Settings → About in the web UI)+ Update: mso update (or Settings → Account → About in the web UI)Legacy: re-run the official one-line installer to upgrade/recover an older installUninstall: re-run the installer with --uninstallListen: $BIND:$PORT (change with --bind / MSO_BIND)diff --git a/scripts/ship.sh b/scripts/ship.shindex 50072b37..14bb2c6c 100755--- a/scripts/ship.sh+++ b/scripts/ship.sh@@ -97,4 +97,4 @@ fiechoecho "✅ shipped ${RELEASE_SHA:0:7} → ${OS_PUBLIC_ORIGIN:-http://localhost:4005}"-echo " What's new is in Settings → About (docs/CHANGELOG.md, regenerated above)."+echo " What's new is in Settings → Account → About (docs/CHANGELOG.md, regenerated above)."