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
test(host): exercise native macOS and Windows candidate build
Rahman11371e9af965
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex fd3db1e9..3374eb99 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -84,6 +84,35 @@ jobs:- name: Deferred shell performance journeysrun: node scripts/e2e/bundle-performance.mjs+ native-host:+ name: Native host (${{ matrix.os }})+ if: github.event_name != 'schedule'+ runs-on: ${{ matrix.os }}+ timeout-minutes: 35+ strategy:+ fail-fast: false+ matrix:+ os: [macos-latest, windows-latest]+ steps:+ - name: Checkout+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1++ - name: Setup bun+ uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2+ with:+ bun-version: 1.4.2++ - name: Setup Node+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0+ with:+ node-version: 22++ - name: Build directly on host+ run: node scripts/install-native.mjs++ - name: Health check on loopback+ run: node scripts/native-host-smoke.mjs+dependency-watch:name: Scheduled dependency auditif: github.event_name == 'schedule'diff --git a/bin/mso-host.mjs b/bin/mso-host.mjsnew file mode 100644index 00000000..49f415d4--- /dev/null+++ b/bin/mso-host.mjs@@ -0,0 +1,67 @@+#!/usr/bin/env node+// Native host launcher candidate. The full cross-platform CLI is a separate gate.+import { spawn, spawnSync } from "node:child_process";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import { fileURLToPath } from "node:url";++const root = path.dirname(path.dirname(fileURLToPath(import.meta.url)));+const next = path.join(root, "node_modules", "next", "dist", "bin", "next");+const envFile = path.join(root, ".env.local");+const port = Number(process.env.MSO_PORT || 4005);+const command = process.argv[2] || "help";++function fail(message) {+ process.stderr.write(`MSO host: ${message}\n`);+ process.exitCode = 1;+}++function ready() {+ if (!["darwin", "win32"].includes(process.platform)) {+ fail("this launcher is for a native Mac or Windows host");+ return false;+ }+ if (!Number.isInteger(port) || port < 1024 || port > 65535) {+ fail("MSO_PORT must be a local TCP port from 1024 to 65535");+ return false;+ }+ if (!fs.existsSync(envFile) || !fs.existsSync(next) || !fs.existsSync(path.join(root, ".next"))) {+ fail("run node scripts/install-native.mjs from a clean checkout first");+ return false;+ }+ try {+ const pty = spawnSync(process.execPath, ["-e", "require('node-pty')"], {+ cwd: root, timeout: 10_000, windowsHide: true,+ });+ if (pty.status !== 0) throw new Error("node-pty binding unavailable");+ } catch (error) {+ fail(error.message);+ return false;+ }+ return true;+}++if (command === "version" || command === "--version") {+ const pkg = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));+ process.stdout.write(`MSO ${pkg.version} · native ${os.platform()} host candidate\n`);+} else if (command === "doctor") {+ if (ready()) process.stdout.write(`Native host preflight passed. Run 'node bin/mso-host.mjs start', then check http://127.0.0.1:${port}/api/health and terminal login.\n`);+} else if (command === "start") {+ if (ready()) {+ process.stdout.write(`Starting MSO at http://127.0.0.1:${port} (Ctrl+C to stop)\n`);+ const child = spawn(process.execPath, [next, "start", "--hostname", "127.0.0.1", "--port", String(port)], {+ cwd: root, env: process.env, stdio: "inherit", windowsHide: true,+ });+ child.on("error", (error) => fail(error.message));+ child.on("exit", (code) => { process.exitCode = code ?? 1; });+ for (const signal of ["SIGINT", "SIGTERM"]) {+ process.on(signal, () => child.kill(signal));+ }+ }+} else if (command === "help" || command === "--help") {+ process.stdout.write("MSO native host candidate: doctor | start | version\n");+ process.stdout.write("Existing Linux CLI verbs and remote relay are not available through this launcher yet.\n");+} else {+ fail(`unknown native host command: ${command}`);+}diff --git a/docs/NATIVE-HOST-RELAY.md b/docs/NATIVE-HOST-RELAY.mdindex 5f8022fd..ba1730e3 100644--- a/docs/NATIVE-HOST-RELAY.md+++ b/docs/NATIVE-HOST-RELAY.md@@ -8,7 +8,7 @@ MSO installs and hosts directly under the user's ordinary account in macOS TermiThe public, shared control plane uses **mso.manef.dev**: `/dashboard` is the user and device console, `/mcp` is one HTTPS Streamable HTTP endpoint with OAuth. The local MSO agent makes an outbound TLS connection to that relay. Each user signs into the shared service and pairs only their own devices. MSO installations stay loopback-bound; the relay cannot read a local file or issue a host command by itself.-The current personal MSO installation at mso.rahmanef.com must remain independent. Do not redirect mso.manef.dev or expose `/mcp` as a relay until the shared service is deployed and ownership isolation is verified. A missing DNS record is not a functioning gateway.+The currently deployed personal MSO installation must remain independent. Do not redirect mso.manef.dev or expose `/mcp` as a relay until the shared service is deployed and ownership isolation is verified. A missing DNS record is not a functioning gateway.## Native host boundariesdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 91b29dc6..08640913 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,9 @@+## 2026-09-28 — Native host and shared relay groundwork++A separate design contract maps the supplied Remote Desktop Commander actions onto MSO capabilities and defines the account, device, OAuth, scope, pairing, revocation and outbound connection boundaries for a shared mso.manef.dev/dashboard and /mcp service. The shared relay is not implemented or deployed; the hostname is not yet resolving.++The host runtime now selects PowerShell for Windows PTYs, samples CPU on non-Linux systems, reads macOS/Windows process inventories, and parses OS-specific file-root delimiters. Candidate native Mac/Windows installer and foreground launcher build MSO with Node, Bun and node-pty in the host account and bind loopback; CI checks a fresh build and health route on both OS runner families. These candidates are not connected to the public installers. Physical-machine login, device approval, PTY, filesystem containment, update, service lifetime and remote MCP remain release gates. The public macOS Lima and Windows WSL2 paths remain the current installed release.+## 2026-09-28 — Portable connected app manifestsAdded a bounded connected-app manifest profile and Store file/paste → review → connect journey. Portable publisher/version/presentation metadata stays separate from per-instance IDs and endpoints; one definition can connect several instances. The shared validator rejects unsupported fields/versions and executable payloads in both client and server. Import uses existing Owner authority, revision locking, cookie isolation and atomic registry storage. Connection edits preserve the original manifest and disconnect never touches service data. The starter JSON and current contract document what works; the full feature loader, verified remote manef.dev catalog and generic installers remain pending. No dependency on unrelated manef-ui/manef-db is introduced.diff --git a/scripts/install-native.mjs b/scripts/install-native.mjsnew file mode 100644index 00000000..a6782db5--- /dev/null+++ b/scripts/install-native.mjs@@ -0,0 +1,77 @@+#!/usr/bin/env node+// Native macOS/Windows host installer candidate. Run from a fresh repository checkout.+// This path is not wired into the public installer until real-machine acceptance passes.+import { spawnSync } from "node:child_process";+import { randomBytes } from "node:crypto";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import { fileURLToPath } from "node:url";++const root = path.dirname(path.dirname(fileURLToPath(import.meta.url)));+const host = process.platform;+const home = os.homedir();+const envFile = path.join(root, ".env.local");++function fail(message) {+ process.stderr.write(`MSO native install: ${message}\n`);+ process.exit(1);+}++function run(program, args, options = {}) {+ const result = spawnSync(program, args, {+ cwd: root, stdio: options.quiet ? "pipe" : "inherit",+ encoding: "utf8", windowsHide: true, timeout: options.timeout ?? 15 * 60_000,+ });+ if (result.error || result.status !== 0) {+ fail(`${program} failed: ${result.error?.message || String(result.stderr || result.status).trim().slice(0, 300)}`);+ }+ return String(result.stdout || "").trim();+}++if (host !== "darwin" && host !== "win32") fail("use this installer only on native macOS or Windows");+const [major, minor] = process.versions.node.split(".").map(Number);+if (!((major === 22 && minor >= 12) || major === 24 || major >= 26)) {+ fail("install supported Node 22.12+, 24.x or 26+ first");+}+run("git", ["--version"], { quiet: true });+run("bun", ["--version"], { quiet: true });+if (!fs.existsSync(path.join(root, ".git"))) fail("run this file from a Git checkout of MSO");+const origin = run("git", ["remote", "get-url", "origin"], { quiet: true });+if (!/^https:\/\/github\.com\/rahmanef63\/mso(?:\.git)?\/?$/.test(origin)) {+ fail("the native candidate must run from the official public checkout");+}+if (run("git", ["status", "--porcelain"], { quiet: true })) fail("preserve uncommitted work before installation");+if (fs.existsSync(path.join(root, ".next"))) {+ fail("an existing build is present; do not replace a potentially running MSO checkout");+}++const state = path.join(home, ".mso");+fs.mkdirSync(state, { recursive: true, mode: 0o700 });+if (fs.lstatSync(state).isSymbolicLink()) fail("private state directory cannot be a symlink");+if (fs.existsSync(envFile) && fs.lstatSync(envFile).isSymbolicLink()) fail("refusing symlinked .env.local");++run("bun", ["install", "--frozen-lockfile"]);+run(process.execPath, ["-e", "require('node-pty')"], { quiet: true });+let generatedPassword = "";+if (!fs.existsSync(envFile)) {+ generatedPassword = randomBytes(24).toString("base64url");+ const secret = randomBytes(32).toString("hex");+ const content = `# Native MSO host. Keep this file private.+OS_LOGIN_PASSWORD=${generatedPassword}+OS_SESSION_SECRET=${secret}+OS_MCP_ENABLED=1+OS_MCP_MAX_SCOPE=read+`;+ fs.writeFileSync(envFile, content, { flag: "wx", mode: 0o600 });+ if (host === "win32") {+ const account = run("whoami", ["/user", "/fo", "csv", "/nh"], { quiet: true });+ const sid = account.match(/S-1-\d+(?:-\d+)+/i)?.[0];+ if (!sid) fail("could not determine the Windows user SID; review .env.local ACL before starting");+ run("icacls", [envFile, "/inheritance:r", "/grant:r", `*${sid}:(F)`], { quiet: true });+ }+}+run(process.execPath, [path.join(root, "node_modules", "next", "dist", "bin", "next"), "build"]);+process.stdout.write(`Native host build ready in ${root}\n`);+if (generatedPassword && process.env.CI !== "true") process.stdout.write(`First-login password (shown once): ${generatedPassword}\n`);+process.stdout.write("Run: node bin/mso-host.mjs doctor\nRun: node bin/mso-host.mjs start\nAfter your first browser login shows a pending device, approve its exact ID locally with: node scripts/approve-device.js <device-id> \"my device\" --role owner\n");diff --git a/scripts/native-host-smoke.mjs b/scripts/native-host-smoke.mjsnew file mode 100644index 00000000..ac3231f6--- /dev/null+++ b/scripts/native-host-smoke.mjs@@ -0,0 +1,42 @@+#!/usr/bin/env node+// Runs on macOS and Windows CI after a clean native candidate installation.+import { spawn, spawnSync } from "node:child_process";++const port = String(41000 + Math.floor(Math.random() * 20000));+const doctor = spawnSync(process.execPath, ["bin/mso-host.mjs", "doctor"], {+ encoding: "utf8", timeout: 15_000, windowsHide: true,+});+if (doctor.status !== 0) throw new Error(`native doctor failed: ${doctor.stderr || doctor.error}`);++const child = spawn(process.execPath, ["bin/mso-host.mjs", "start"], {+ env: { ...process.env, MSO_PORT: port }, stdio: ["ignore", "pipe", "pipe"], windowsHide: true,+});+let output = "";+child.stdout.on("data", (chunk) => { output = (output + chunk).slice(-3000); });+child.stderr.on("data", (chunk) => { output = (output + chunk).slice(-3000); });+const deadline = Date.now() + 45_000;+let passed = false;+try {+ while (Date.now() < deadline && child.exitCode === null) {+ try {+ const response = await fetch(`http://127.0.0.1:${port}/api/health`, {+ signal: AbortSignal.timeout(1500),+ });+ const body = await response.json();+ if (response.ok && body.status === "ok" && body.service === "mso") {+ passed = true;+ break;+ }+ throw new Error(`unexpected health response: ${response.status}`);+ } catch {+ await new Promise((resolve) => setTimeout(resolve, 400));+ }+ }+ if (!passed) throw new Error(`native server did not become healthy (exit=${child.exitCode}): ${output}`);+ console.log(`Native host healthy at loopback port ${port}`);+} finally {+ child.kill();+ if (process.platform === "win32") {+ spawnSync("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true });+ }+}