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(managed-apps): add 9Router as a one-click managed app
Rahman7f81eed8ccf6
diff --git a/.env.example b/.env.exampleindex 54858cbf..c77da60f 100644--- a/.env.example+++ b/.env.example@@ -74,6 +74,7 @@ OS_SESSION_SECRET=# optional split-origin proxy.# HERMES_DASHBOARD_URL=http://127.0.0.1:9119# OPENCLAW_DASHBOARD_URL=http://127.0.0.1:18789+# NINE_ROUTER_DASHBOARD_URL=http://127.0.0.1:20128# Hermes install home. Default ~/.hermes. Absolute, or "~/…" for the home of the# user running mso. This is the tree the managed-app backup action copies.# HERMES_HOME=/home/you/.hermesdiff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 02468a28..61396cfd 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -6,6 +6,10 @@ this is the *what*, and it is what Settings → About shows as “What's new”.## 2026-08-24+**Added**++- `managed-apps` add 9Router as a one-click managed app+**Fixed**- harden security state and credential guardsdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex a53f4104..95e9ee77 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -9,7 +9,24 @@ Running log of what shipped each phase. Newest at top.> [`docs/README.md`](./README.md) and [`docs/ARCHITECTURE.md`](./ARCHITECTURE.md); keep old> entries intact as historical evidence even when their commands/counts have been superseded.-## 2026-08-24 — Fable/Ultracode security audit + security-state hardening (DONE)+## 2026-08-24 — 9Router joins the managed apps (one-click install/update/uninstall) (DONE)++Third managed app: 9Router (decolua/9router), the Docker-only AI gateway already serving+9-router.rahmanef.com from host port 20128. Unlike Hermes/OpenClaw it ships no CLI, so the+adapter contract is spoken by `scripts/managed-app-9router` — a repo-owned wrapper whose+verbs map onto Docker (`--version` reads the image's OCI version label, `check --json`+relays the app's own `/api/version` self-check, `update --yes` pulls latest and recreates+the container with the `~/.9router` data mount intact, `uninstall --yes [--dry-run]`+removes only the container). Two small seams were added to the definition for it:+`healthPath` (9Router answers `/api/health`, and the default `/health` 404s — which would+read as unhealthy forever) and `commandProvesInstall: false` (the wrapper exists on every+checkout, so its presence must not make an uninstalled 9Router read as "package" and lock+the Install button out). Everything else — install/update/rollback/uninstall jobs, backups,+the split-origin dashboard proxy, the Details panel — is the existing generic machinery;+`9router.mso.rahmanef.com` was added to the Traefik managed-apps file and the wildcard DNS+already covered it. The container itself was updated 0.5.50 → 0.5.55 the same day.++A point-in-time security audit combined Claude Fable 5 in Ultracode mode with an independentdynamic/manual lane. Fable actually fan-out to 8 workstreams / 27 sub-agents (7 domain findersdiff --git a/frontend/slices/managed-apps/app-support.ts b/frontend/slices/managed-apps/app-support.tsindex b5793bcb..fb39e1fb 100644--- a/frontend/slices/managed-apps/app-support.ts+++ b/frontend/slices/managed-apps/app-support.ts@@ -69,6 +69,22 @@ const SUPPORT: Record<ManagedAppId, AppSupport> = {"Removes the gateway service and local state; the `openclaw` CLI itself stays on PATH. `--dry-run` prints the actions, `--all` also removes the workspace.",stateDir: "~/.openclaw",},+ "9router": {+ dryRun: false,+ rollbackPin: false,+ pinLabel: "Version",+ pinHint:+ "9Router ships one Docker tag (latest), so there is no version pin. A rollback restores the ~/.9router data snapshot; the image stays whatever is installed. Running an older image is a by-hand `docker run` with an explicit tag.",+ pinPlaceholder: "0.5.55",+ installCommand:+ "docker run -d --name 9router --restart unless-stopped -p 20128:20128 -v ~/.9router:/app/data -e DATA_DIR=/app/data decolua/9router:latest",+ installNote:+ "Pulls the decolua/9router image and starts it on port 20128 with its data in ~/.9router. Needs a user in the docker group; no sudo, no systemd unit — Docker's restart policy keeps it up.",+ uninstallCommand: "docker rm -f 9router",+ uninstallEffect:+ "Stops and removes the container. The image and ~/.9router data (providers, keys, stats) stay, so a reinstall comes back configured.",+ stateDir: "~/.9router",+ },};export const supportFor = (id: ManagedAppId): AppSupport => SUPPORT[id];diff --git a/frontend/slices/managed-apps/app.tsx b/frontend/slices/managed-apps/app.tsxindex 83e4ce20..569d18c7 100644--- a/frontend/slices/managed-apps/app.tsx+++ b/frontend/slices/managed-apps/app.tsx@@ -1,7 +1,7 @@"use client";import { useCallback, useEffect, useMemo, useState } from "react";-import { Bot, FileText, Loader2, Play, RefreshCw, Save, SlidersHorizontal, Square, Workflow } from "lucide-react";+import { Bot, FileText, Loader2, Play, RefreshCw, Route, Save, SlidersHorizontal, Square, Workflow, type LucideIcon } from "lucide-react";import { Button } from "@/components/ui/button";import type { ManagedAppAction, ManagedAppId, ManagedAppView } from "@/lib/managed-apps/types";import { dashboardFeature } from "./feature-cli";@@ -79,11 +79,27 @@ export function OpenClawApp() {return <ManagedAppsSurface focus="openclaw" />;}-const NAME: Record<ManagedAppId, string> = { hermes: "Hermes", openclaw: "OpenClaw" };+export function NineRouterApp() {+ return <ManagedAppsSurface focus="9router" />;+}++const NAME: Record<ManagedAppId, string> = { hermes: "Hermes", openclaw: "OpenClaw", "9router": "9Router" };++const MARK: Record<ManagedAppId, { Icon: LucideIcon; tone: string }> = {+ hermes: { Icon: Bot, tone: "text-violet-400" },+ openclaw: { Icon: Workflow, tone: "text-orange-400" },+ "9router": { Icon: Route, tone: "text-sky-400" },+};++function AppMark({ id, className }: { id: ManagedAppId; className?: string }) {+ const { Icon, tone } = MARK[id];+ return <Icon className={`${className ?? "size-4"} ${tone}`} />;+}const ICON: Record<ManagedAppId, React.ReactNode> = {- hermes: <Bot className="size-4 text-violet-400" />,- openclaw: <Workflow className="size-4 text-orange-400" />,+ hermes: <AppMark id="hermes" />,+ openclaw: <AppMark id="openclaw" />,+ "9router": <AppMark id="9router" />,};/** ONE surface, and what it shows is the thing itself: the app's own dashboard when the@@ -199,7 +215,7 @@ function ManagePane({ focus, state }: { focus: ManagedAppId; state: ReturnType<tfunction ManagedCard({ app, busy, onAction, onChanged }: { app: ManagedAppView; busy: string | null; onAction: (id: ManagedAppId, action: ManagedAppAction) => Promise<void>; onChanged: () => void }) {const [logs, setLogs] = useState<string[] | null>(null);- const icon = app.id === "hermes" ? <Bot className="size-5 text-violet-400" /> : <Workflow className="size-5 text-orange-400" />;+ const icon = <AppMark id={app.id} className="size-5" />;const run = app.state === "running";async function loadLogs() {const response = await fetch(`/api/v1/managed-apps/${app.id}/logs`, { cache: "no-store" });diff --git a/frontend/slices/managed-apps/index.ts b/frontend/slices/managed-apps/index.tsindex 8ef20e46..2b5dbd5a 100644--- a/frontend/slices/managed-apps/index.ts+++ b/frontend/slices/managed-apps/index.ts@@ -1,21 +1,27 @@-import { Bot, Workflow } from "lucide-react";+import { Bot, Route, Workflow, type LucideIcon } from "lucide-react";import type { AppDescriptor } from "@/features/os-shell";-type ManagedApp = "hermes" | "openclaw";+type ManagedApp = "hermes" | "openclaw" | "9router";++const LOOK: Record<ManagedApp, { title: string; icon: LucideIcon; gradient: string; loader: string }> = {+ hermes: { title: "Hermes", icon: Bot, gradient: "linear-gradient(160deg,#8b5cf6,#4f46e5)", loader: "HermesApp" },+ openclaw: { title: "OpenClaw", icon: Workflow, gradient: "linear-gradient(160deg,#f97316,#dc2626)", loader: "OpenClawApp" },+ "9router": { title: "9Router", icon: Route, gradient: "linear-gradient(160deg,#0ea5e9,#2563eb)", loader: "NineRouterApp" },+};// Ordinary apps, dock and all. They were `noDock` while MSO could swap its whole shell// into a Hermes/OpenClaw "workspace mode" that opened them by itself — that is gone: each// ships its own sidebar, so re-hosting its navigation bought nothing. One window per app.function managedDescriptor(app: ManagedApp): AppDescriptor {- const hermes = app === "hermes";+ const look = LOOK[app];return {id: app,- title: hermes ? "Hermes" : "OpenClaw",- icon: hermes ? Bot : Workflow,- gradient: hermes ? "linear-gradient(160deg,#8b5cf6,#4f46e5)" : "linear-gradient(160deg,#f97316,#dc2626)",+ title: look.title,+ icon: look.icon,+ gradient: look.gradient,load: async () => {const loaded = await import("./app");- return { default: hermes ? loaded.HermesApp : loaded.OpenClawApp };+ return { default: loaded[look.loader as "HermesApp" | "OpenClawApp" | "NineRouterApp"] };},defaultSize: { w: 1100, h: 720 },};@@ -23,3 +29,4 @@ function managedDescriptor(app: ManagedApp): AppDescriptor {export const hermesApp = managedDescriptor("hermes");export const openclawApp = managedDescriptor("openclaw");+export const nineRouterApp = managedDescriptor("9router");diff --git a/frontend/slices/os-shell/shell.manifest.ts b/frontend/slices/os-shell/shell.manifest.tsindex c3263107..2992244d 100644--- a/frontend/slices/os-shell/shell.manifest.ts+++ b/frontend/slices/os-shell/shell.manifest.ts@@ -15,7 +15,7 @@ import { appStoreApp } from "@/features/app-store";import { createAppApp } from "@/features/create-app";import { systemMonitorApp } from "@/features/system-monitor";import { assistantApp } from "@/features/assistant";-import { hermesApp, openclawApp } from "@/features/managed-apps";+import { hermesApp, nineRouterApp, openclawApp } from "@/features/managed-apps";import { osSettingsApp } from "@/features/os-settings";import { quicklinksApp } from "@/features/quicklinks";import { docsApp } from "@/features/docs";@@ -61,6 +61,7 @@ export const BUILTIN_APPS: AppDescriptor[] = [withSlug(withArtwork(assistantApp), "assistant"),withSlug(withArtwork(hermesApp), "hermes"),withSlug(withArtwork(openclawApp), "openclaw"),+ withSlug(withArtwork(nineRouterApp), "9router"),withSlug(withArtwork(quicklinksApp), "links"),// Docs is deliberately dockable, not noDock: for a signed-out visitor it is the// only app that explains what they are looking at and how to get their own.diff --git a/lib/managed-apps/catalog.test.ts b/lib/managed-apps/catalog.test.tsindex fb091866..3def2863 100644--- a/lib/managed-apps/catalog.test.ts+++ b/lib/managed-apps/catalog.test.ts@@ -3,24 +3,26 @@ import { getManagedAppDefinition, isManagedAppId, listManagedAppDefinitions } frimport { MANAGED_APP_ACTIONS } from "./types";describe("managed app catalog", () => {- it("uses one shared catalog for exactly Hermes and OpenClaw", () => {+ it("uses one shared catalog for exactly Hermes, OpenClaw and 9Router", () => {const definitions = listManagedAppDefinitions();- expect(definitions.map((item) => item.id)).toEqual(["hermes", "openclaw"]);- expect(new Set(definitions.map((item) => item.id)).size).toBe(2);+ expect(definitions.map((item) => item.id)).toEqual(["hermes", "openclaw", "9router"]);+ expect(new Set(definitions.map((item) => item.id)).size).toBe(3);});it("rejects arbitrary application ids and commands", () => {expect(isManagedAppId("hermes")).toBe(true);expect(isManagedAppId("openclaw")).toBe(true);+ expect(isManagedAppId("9router")).toBe(true);expect(isManagedAppId("hermes;rm -rf /")).toBe(false);expect(MANAGED_APP_ACTIONS).toEqual(["start", "stop", "restart", "backup"]);});it("keeps runtime-specific configuration separate", () => {+ const definitions = listManagedAppDefinitions();+ expect(new Set(definitions.map((item) => item.command)).size).toBe(definitions.length);+ expect(new Set(definitions.map((item) => item.stateDirName)).size).toBe(definitions.length);const hermes = getManagedAppDefinition("hermes");const openclaw = getManagedAppDefinition("openclaw");- expect(hermes.command).not.toBe(openclaw.command);expect(hermes.serviceNames).not.toEqual(openclaw.serviceNames);- expect(hermes.stateDirName).not.toBe(openclaw.stateDirName);});});diff --git a/lib/managed-apps/catalog.ts b/lib/managed-apps/catalog.tsindex f8bf8202..a09fe698 100644--- a/lib/managed-apps/catalog.ts+++ b/lib/managed-apps/catalog.ts@@ -1,6 +1,6 @@import { homedir } from "node:os";import { join } from "node:path";-import type { ManagedAppDefinition, ManagedAppId } from "./types";+import { MANAGED_APP_IDS, type ManagedAppDefinition, type ManagedAppId } from "./types";/** Env overrides are hand-written, so a leading `~` is expected — `join()` alone would* keep it literal and every path built from it would silently miss. */@@ -44,10 +44,27 @@ const definitions = {stateDirName: ".openclaw",gradient: "linear-gradient(160deg,#f97316,#dc2626)",},+ "9router": {+ id: "9router",+ name: "9Router",+ description: "9Router AI gateway — one endpoint routing coding agents across 40+ providers",+ // No upstream CLI exists: 9Router ships only a Docker image. The command is a+ // wrapper script in this repo speaking the verbs the adapter drives+ // (--version / check / update / uninstall), which is why commandProvesInstall+ // is false — the script exists on every checkout, installed or not.+ command: join(process.cwd(), "scripts", "managed-app-9router"),+ commandProvesInstall: false,+ serviceNames: [],+ containerNames: ["9router"],+ dashboardUrl: process.env.NINE_ROUTER_DASHBOARD_URL ?? "http://127.0.0.1:20128",+ healthPath: "/api/health",+ stateDirName: ".9router",+ gradient: "linear-gradient(160deg,#0ea5e9,#2563eb)",+ },} as const satisfies Record<ManagedAppId, ManagedAppDefinition>;export function isManagedAppId(value: string): value is ManagedAppId {- return value === "hermes" || value === "openclaw";+ return (MANAGED_APP_IDS as readonly string[]).includes(value);}export function getManagedAppDefinition(id: ManagedAppId): ManagedAppDefinition {@@ -55,5 +72,5 @@ export function getManagedAppDefinition(id: ManagedAppId): ManagedAppDefinition}export function listManagedAppDefinitions(): ManagedAppDefinition[] {- return [definitions.hermes, definitions.openclaw];+ return MANAGED_APP_IDS.map((id) => definitions[id]);}diff --git a/lib/managed-apps/install.ts b/lib/managed-apps/install.tsindex eac28bd7..7144389c 100644--- a/lib/managed-apps/install.ts+++ b/lib/managed-apps/install.ts@@ -28,7 +28,7 @@ const INSTALL_SCRIPT = path.join(process.cwd(), "scripts", "managed-app-install"/** Hermes fetches uv, a Python, Node and ffmpeg before it does anything of its* own, so it needs a budget several times OpenClaw's `npm i -g`. Both stay* under the job layer's 1 h ceiling. */-const INSTALL_TIMEOUT_MS: Record<ManagedAppId, number> = { hermes: 2_700_000, openclaw: 900_000 };+const INSTALL_TIMEOUT_MS: Record<ManagedAppId, number> = { hermes: 2_700_000, openclaw: 900_000, "9router": 900_000 };/** A key is never inspected beyond this: it is opaque upstream credential* material, so the only questions worth asking are "could it break thediff --git a/lib/managed-apps/manager.ts b/lib/managed-apps/manager.tsindex fef55a10..d0ba4144 100644--- a/lib/managed-apps/manager.ts+++ b/lib/managed-apps/manager.ts@@ -49,7 +49,7 @@ async function detect(definition: ManagedAppDefinition): Promise<Installation> {const containerName = definition.containerNames.find((name) => names.has(name));if (containerName) return { type: "docker", containerName };}- if (await commandExists(definition.command)) return { type: "package" };+ if (definition.commandProvesInstall !== false && await commandExists(definition.command)) return { type: "package" };return { type: "not-installed" };}@@ -64,7 +64,7 @@ async function running(installation: Installation): Promise<boolean> {async function health(definition: ManagedAppDefinition): Promise<boolean | null> {try {- const response = await fetch(`${definition.dashboardUrl.replace(/\/$/, "")}/health`, { cache: "no-store", signal: AbortSignal.timeout(4_000) });+ const response = await fetch(`${definition.dashboardUrl.replace(/\/$/, "")}${definition.healthPath ?? "/health"}`, { cache: "no-store", signal: AbortSignal.timeout(4_000) });return response.ok;} catch {return null;diff --git a/lib/managed-apps/types.ts b/lib/managed-apps/types.tsindex 0de0122e..3de1c125 100644--- a/lib/managed-apps/types.ts+++ b/lib/managed-apps/types.ts@@ -1,4 +1,4 @@-export const MANAGED_APP_IDS = ["hermes", "openclaw"] as const;+export const MANAGED_APP_IDS = ["hermes", "openclaw", "9router"] as const;export type ManagedAppId = (typeof MANAGED_APP_IDS)[number];export const MANAGED_APP_ACTIONS = ["start", "stop", "restart", "backup"] as const;@@ -24,6 +24,14 @@ export interface ManagedAppDefinition {gradient: string;/** Override for the upstream state/install home. Empty = `~/<stateDirName>`. */homeDir?: string;+ /** Health endpoint path on `dashboardUrl`. Default "/health"; 9Router answers+ * at "/api/health" and 404s the default, which would read as unhealthy. */+ healthPath?: string;+ /** false = the command's mere presence proves nothing about the install.+ * 9Router's `command` is a wrapper script SHIPPED IN THIS REPO, so it exists+ * on every checkout — detection must rest on its container alone, or an+ * uninstalled 9Router reads as "package" and Install is refused forever. */+ commandProvesInstall?: boolean;}export interface ManagedAppView {diff --git a/lib/managed-apps/update-cli.test.ts b/lib/managed-apps/update-cli.test.tsindex 5b824285..2dfe8d39 100644--- a/lib/managed-apps/update-cli.test.ts+++ b/lib/managed-apps/update-cli.test.ts@@ -160,3 +160,20 @@ describe("reading what Hermes says back", () => {expect(parseHermesCheck(result("", 1)).updateAvailable).toBeNull();});});++describe("the 9Router wrapper argv", () => {+ const NINE = "/home/rahman/projects/mso/scripts/managed-app-9router";++ it("builds update and uninstall in the wrapper's own grammar", () => {+ expect(updateAdapter("9router").updateArgv(NINE, {})).toEqual([NINE, "update", "--yes"]);+ expect(updateAdapter("9router").uninstallArgv(NINE, false)).toEqual([NINE, "uninstall", "--yes"]);+ expect(updateAdapter("9router").uninstallArgv(NINE, true)).toEqual([NINE, "uninstall", "--yes", UNINSTALL_PREVIEW_FLAG]);+ });++ it("refuses every option the single-tag Docker flow cannot honour", () => {+ for (const options of [{ dryRun: true }, { channel: "beta" }, { tag: "latest" }, { branch: "main" }, { noRestart: true }]) {+ expect(() => updateAdapter("9router").updateArgv(NINE, options)).toThrow("not supported for 9router");+ }+ expect(updateAdapter("9router").pin).toBeNull();+ });+});diff --git a/lib/managed-apps/update-cli.ts b/lib/managed-apps/update-cli.tsindex 58f9672a..c13d89b1 100644--- a/lib/managed-apps/update-cli.ts+++ b/lib/managed-apps/update-cli.ts@@ -1,6 +1,6 @@import "server-only";import type { ManagedAppId } from "./types";-import { probeHermes, probeOpenclaw, type ProbeResult } from "./update-probe";+import { probe9Router, probeHermes, probeOpenclaw, type ProbeResult } from "./update-probe";import { MANAGED_APP_UPDATE_CHANNELS } from "./update-types";import type { ManagedAppUpdateCapabilities, ManagedAppUpdateOptions } from "./update-types";@@ -166,6 +166,34 @@ const ADAPTERS: Record<ManagedAppId, UpdateAdapter> = {uninstallArgv: (program, dryRun) => [program, "uninstall", "--non-interactive", "--yes", "--service", "--state", ...(dryRun ? [UNINSTALL_PREVIEW_FLAG] : [])],probe: probeOpenclaw,},+ "9router": {+ capabilities: {+ check: true,+ apply: true,+ // The wrapper's update is pull + recreate; a rehearsal of a docker pull+ // predicts nothing useful, so there is no dry run.+ dryRun: false,+ channel: false,+ rollback: true,+ uninstall: true,+ installCommand:+ "docker run -d --name 9router --restart unless-stopped -p 20128:20128 -v ~/.9router:/app/data -e DATA_DIR=/app/data decolua/9router:latest",+ uninstallCommand: null,+ },+ // No pin: the image ships one meaningful tag (latest). A rollback restores+ // the ~/.9router data snapshot; the image stays whatever is installed.+ pin: null,+ updateArgv: (program, options) => {+ if (options.dryRun) reject("dry run", "9router");+ if (options.channel) reject("channel switching", "9router");+ if (options.tag) reject("tag pinning", "9router");+ if (options.branch) reject("branch switching", "9router");+ if (options.noRestart) reject("--no-restart", "9router");+ return [program, "update", "--yes"];+ },+ uninstallArgv: (program, dryRun) => [program, "uninstall", "--yes", ...(dryRun ? [UNINSTALL_PREVIEW_FLAG] : [])],+ probe: probe9Router,+ },};export function updateAdapter(id: ManagedAppId): UpdateAdapter {diff --git a/lib/managed-apps/update-probe.ts b/lib/managed-apps/update-probe.tsindex dcf9b5e8..5088fa38 100644--- a/lib/managed-apps/update-probe.ts+++ b/lib/managed-apps/update-probe.ts@@ -95,6 +95,33 @@ function parseJson(text: string): Record<string, unknown> | null {const asRecord = (value: unknown): Record<string, unknown> => (value && typeof value === "object" ? (value as Record<string, unknown>) : {});const asString = (value: unknown): string | null => (typeof value === "string" && value ? value : null);+// --------------------------------------------------------------- 9Router ----+// The "CLI" is scripts/managed-app-9router (this repo). Its `check --json`+// relays the app's own /api/version — {currentVersion, latestVersion,+// hasUpdate} — which 9Router computes against Docker Hub itself.++export const NINE_ROUTER_CHANNEL_NOTE =+ "9Router ships a single Docker tag (latest); an update pulls the newest image and recreates the container with ~/.9router data intact.";++export async function probe9Router(program: string): Promise<ProbeResult> {+ const channel: ManagedAppChannel = { value: null, kind: null, available: [], switchable: false, reason: NINE_ROUTER_CHANNEL_NOTE };+ const check = await runProgram(program, ["check", "--json"], 60_000);+ const parsed = parseJson(clean(check.stdout));+ if (check.code !== 0 || !parsed) {+ const why = clean(check.stderr).split(/\r?\n/).find(Boolean) ?? "9router check --json returned no JSON";+ return { currentVersion: null, latestVersion: null, updateAvailable: null, detail: null, channel, installKind: "docker", error: redact(why) };+ }+ return {+ currentVersion: asString(parsed.currentVersion),+ latestVersion: asString(parsed.latestVersion),+ updateAvailable: typeof parsed.hasUpdate === "boolean" ? parsed.hasUpdate : null,+ detail: asString(parsed.detail),+ channel,+ installKind: "docker",+ error: null,+ };+}+export async function probeOpenclaw(program: string): Promise<ProbeResult> {const version = await runProgram(program, ["--version"], 20_000);const currentVersion = version.code === 0 ? clean(version.stdout).split(/\r?\n/)[0]?.trim().slice(0, 160) || null : null;diff --git a/scripts/managed-app-9router b/scripts/managed-app-9routernew file mode 100755index 00000000..6bc63411--- /dev/null+++ b/scripts/managed-app-9router@@ -0,0 +1,126 @@+#!/usr/bin/env bash+# The "CLI" for 9Router, which ships no CLI of its own — only a Docker image+# (decolua/9router). lib/managed-apps drives every app through one adapter+# contract (--version / check / update / uninstall), so this script speaks it.+# The catalog points `command` here with commandProvesInstall: false, because+# this file exists on every checkout whether or not 9Router is installed.+#+# Docker is called bare, not via sudo: mso runs as a user in the docker group,+# and that is already what manager.ts assumes for start/stop/restart/logs.+set -euo pipefail++NAME="${NINE_ROUTER_CONTAINER:-9router}"+PORT="${NINE_ROUTER_PORT:-20128}"+IMAGE="${NINE_ROUTER_IMAGE:-decolua/9router:latest}"+DATA="${NINE_ROUTER_DATA:-$HOME/.9router}"+BASE="http://127.0.0.1:${PORT}"++installed() { docker ps -a --format '{{.Names}}' | grep -qx "$NAME"; }++# The running image's own version label — offline, no fork of the app.+label_version() {+ docker inspect --format '{{index .Config.Labels "org.opencontainers.image.version"}}' \+ "$(docker inspect --format '{{.Image}}' "$NAME" 2>/dev/null)" 2>/dev/null || true+}++cmd_version() {+ installed || { echo "9router container not found" >&2; exit 1; }+ local v+ v="$(label_version)"+ [ -n "$v" ] && { echo "$v"; return; }+ # Image built without the label: ask the app itself.+ curl -fsS -m 5 "$BASE/api/version" | sed -n 's/.*"currentVersion":"\([^"]*\)".*/\1/p'+}++# 9Router self-checks against Docker Hub and answers+# {"currentVersion":"…","latestVersion":"…","hasUpdate":bool} at /api/version —+# relayed verbatim (update-probe.ts parses exactly this shape).+cmd_check() {+ installed || { echo "9router container not found" >&2; exit 1; }+ curl -fsS -m 30 "$BASE/api/version" || { echo "9router is not answering on $BASE — is it running?" >&2; exit 1; }+ echo+}++# Pull latest, recreate the container, keep the data mount. Also the install:+# `docker run` against an absent container IS installing it.+cmd_update() {+ echo "==> pull $IMAGE"+ docker pull "$IMAGE"++ # Port guard: recreating onto a port some OTHER container holds would rm the+ # wrong thing's ability to come back up and fail late. Named container wins.+ local owner+ owner="$(docker ps -a --format '{{.Names}} {{.Ports}}' | grep ":${PORT}->" | awk '{print $1}' || true)"+ if [ -n "$owner" ] && [ "$owner" != "$NAME" ]; then+ echo "abort: port $PORT is held by container '$owner', not $NAME" >&2+ exit 1+ fi++ mkdir -p "$DATA"+ echo "==> recreate $NAME"+ docker rm -f "$NAME" 2>/dev/null || true+ docker run -d \+ --name "$NAME" \+ --restart unless-stopped \+ -p "$PORT:$PORT" \+ -v "$DATA:/app/data" \+ -e DATA_DIR=/app/data \+ "$IMAGE"++ echo "==> wait for $BASE"+ local i+ for i in $(seq 1 30); do+ sleep 1+ if curl -fsS -o /dev/null -m 3 "$BASE/api/health"; then+ echo "==> healthy after ${i}s ($(label_version))"+ return 0+ fi+ done+ echo "container is running but $BASE/api/health has not answered within 30s" >&2+ docker ps --filter "name=$NAME" --format '{{.Status}} {{.Ports}}' >&2+ exit 1+}++# Conservative, like the Hermes uninstall: the container goes, the image and+# ~/.9router data stay. A reinstall finds its providers and stats untouched.+cmd_uninstall() {+ local dry=0+ case "${1:-}" in --dry-run) dry=1 ;; esac+ if [ "$dry" = 1 ]; then+ echo "would remove container: $NAME"+ echo "kept: image $IMAGE, data $DATA"+ exit 0+ fi+ installed || { echo "9router container not found — nothing to remove" >&2; exit 0; }+ docker rm -f "$NAME"+ echo "removed container $NAME (kept image $IMAGE and data $DATA)"+}++case "${1:-}" in+--version) cmd_version ;;+check) cmd_check ;;+status)+ installed && docker ps --filter "name=$NAME" --format '{{.Status}} {{.Ports}}' || echo "not installed"+ ;;+install | update)+ [ "${2:-}" = "--yes" ] || [ "$1" = "install" ] || { echo "update requires --yes" >&2; exit 2; }+ cmd_update+ ;;+uninstall)+ shift+ case "${1:-}" in+ --help)+ # update.ts reads this output to verify --dry-run is still honoured+ # before offering "Preview removal".+ echo "usage: managed-app-9router uninstall --yes [--dry-run]"+ exit 0+ ;;+ --yes) shift; cmd_uninstall "${1:-}" ;;+ *) echo "uninstall requires --yes" >&2; exit 2 ;;+ esac+ ;;+*)+ echo "usage: managed-app-9router --version|check [--json]|status|install|update --yes|uninstall --yes [--dry-run]" >&2+ exit 2+ ;;+esacdiff --git a/scripts/managed-app-install b/scripts/managed-app-installindex ece51922..80740647 100755--- a/scripts/managed-app-install+++ b/scripts/managed-app-install@@ -35,13 +35,20 @@ APP_ORIGIN="${MSO_INSTALL_APP_ORIGIN:-}"log() { printf '\n=== %s\n' "$*"; }case "$APP" in-hermes | openclaw) ;;+hermes | openclaw | 9router) ;;*)- echo "usage: managed-app-install <hermes|openclaw>" >&2+ echo "usage: managed-app-install <hermes|openclaw|9router>" >&2exit 2;;esac+# 9Router is a Docker container, not a systemd user unit — the user-bus+# preflight below protects installs it will never perform, and failing on it+# would block a docker-only install for no reason. Hand off and stop here.+if [ "$APP" = "9router" ]; then+ exec "$(dirname "$0")/managed-app-9router" install+fi+# Both apps are installed as systemd USER units, and `systemctl --user` finds the# user's systemd instance through XDG_RUNTIME_DIR. MSO may be running as a systemd# SYSTEM unit with `User=`, which inherits no login session and therefore no such