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(install): add cross-platform host adapters
Rahmanb39c194a6c19
diff --git a/README.md b/README.mdindex 0994b493..69431894 100644--- a/README.md+++ b/README.md@@ -41,23 +41,24 @@ flowchart LR[Private session screenshots](./docs/SESSION-ARTIFACTS.md) · [How the agent runtime works](./docs/COGNITIVE-RUNTIME.md) · [Architecture](./docs/ARCHITECTURE.md) · [Native Integrations](./docs/INTEGRATIONS.md)## Install or update MSO from this repo+**Linux, macOS, Windows/WSL2, Android/Termux · iOS/iPadOS client.** MSO keeps one Linux host-runtime contract and adapts the machine around it.-**Linux · normal non-root user · Node 22.** One application; no required database or separate agent service.-Review [scripts/install.sh](./scripts/install.sh), then:-+| Machine | Supported path |+|---|---|+| Linux | Native host — canonical POSIX installer |+| macOS | Lima Linux guest — canonical POSIX installer auto-routes |+| Windows | WSL2 Linux distro — PowerShell bootstrap |+| Android | Termux + Ubuntu PRoot — canonical POSIX installer auto-routes |+| iOS / iPadOS | PWA/client to a protected MSO host |```bashcurl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash+mso doctor+mso+mso web```+Windows PowerShell: `iwr -useb https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install-windows.ps1 | iex`.-```bash-mso doctor # check the installation-mso # work with the terminal agent-mso web # open the browser workspace-mso --continue # resume your last session-```--The application binds to **127.0.0.1** by default. Use a VPN or protected HTTPS proxy for remote access.-[Full installation and WSL guide](./docs/INSTALL.md) · [Android / Termux one-paste install](./docs/TERMUX.md) · [CLI reference](./docs/CLI.md)+The raw application binds to **127.0.0.1** by default. Compatibility hosts manage their Linux runtime, not native parent-OS services. [Platform support](./docs/PLATFORMS.md) · [Full installation guide](./docs/INSTALL.md) · [Android / Termux details](./docs/TERMUX.md) · [CLI reference](./docs/CLI.md)<details><summary><strong>Update, reset or uninstall — preview before changing anything</strong></summary>diff --git a/app/install/page.tsx b/app/install/page.tsxindex 5c6eeab2..3449a0f0 100644--- a/app/install/page.tsx+++ b/app/install/page.tsx@@ -1,85 +1,112 @@import type { Metadata } from "next";+import { PLATFORM_SUPPORT } from "@/lib/platform-support";import { Copy } from "./copy";-// A PUBLIC page: no session, no shell, no client data fetch. Someone evaluating-// MSO lands here from a shared link and has to be able to read the whole story —-// what it is, what it costs them in risk, and the exact commands — without an-// account. It deliberately does NOT render the OS shell: the shell is ~338 KB of-// JS for a page whose job is to be read.export const metadata: Metadata = {- title: "Install Manef Shell OS on your own server",+ title: "Install Manef Shell OS",description:- "One command installs MSO, makes the mso CLI immediately available, and opens guided terminal onboarding for AI providers, optional managed apps and reviewed skills.",+ "Install MSO on Linux, macOS, Windows/WSL2 or Android/Termux, or use iOS/iPadOS as the PWA client.",};const INSTALL = "curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash";const AGENT_PROMPT = "Install or update MSO from this repo: https://github.com/rahmanef63/mso";const REQUIREMENTS = [- ["A Linux server you own", "A $5 VPS is enough. Debian/Ubuntu, Fedora and Arch are covered by the installer."],- ["Node 22.12+, 24.x or 26+", "The installer adds it via NodeSource if it is missing."],- ["A normal, non-root user", "MSO runs as that user and can do whatever that user can do. Never install it as root."],- ["About 2 GB free disk", "Mostly the build. The app itself is small; there is no database."],-];+ ["A machine you control", "Linux runs natively; macOS, Windows and Android use a supported Linux compatibility host."],+ ["Node 22.12+, 24.x or 26+", "The Linux runtime uses Node; the compatibility installers provision the same runtime inside their Linux guest."],+ ["A normal, non-root runtime user", "MSO executes host operations with that user's authority. Do not run the MSO runtime as root."],+ ["About 2 GB free disk", "Mostly the production build and dependencies. There is no required application database."],+] as const;const STEPS = [{n: 1,- title: "Run the installer",- body: "As your normal user, not root. It installs prerequisites, clones the repo, builds production, generates owner credentials, installs the service, and makes `mso` resolvable immediately through a guarded /usr/local/bin launcher plus the ~/.local/bin fallback.",+ title: "Run the platform installer",+ body: "Use the platform card above. Linux uses the canonical installer directly; the same POSIX command auto-routes macOS and Termux. Windows uses the PowerShell/WSL2 bootstrap.",code: INSTALL,- note: "It prints your login password once. Save it — the secret is written only to .env.local on the server.",+ note: "Compatibility hosts keep the Linux runtime contract intact instead of faking Linux host primitives on another OS.",},{n: 2,title: "Complete terminal onboarding",- body: "On a fresh interactive install, the same command opens /dev/tty after the service is healthy. Connect an Alfa AI platform from MSO's live supported-provider catalog, where explicitly zero-cost agent-capable models are marked FREE; OpenCode Zen and OpenRouter are supported API-key platforms, while OpenAI ChatGPT uses its separate device OAuth path. Then choose a model, response preset, optional Hermes/OpenClaw installs, and reviewed skills. If no terminal exists, nothing hangs: run `mso onboard` later.",+ body: "On a fresh interactive host install, connect an Alfa AI platform from MSO's live supported-provider catalog. Explicitly zero-cost agent-capable models are marked FREE; OpenCode Zen and OpenRouter are supported API-key platforms, while OpenAI ChatGPT uses its separate device OAuth path. Then choose the model/preset and optionally add managed apps and reviewed skills. Headless installs do not hang; run mso onboard later.",code: "mso onboard\nmso skills available\nmso skills install ponytail caveman rtk -y",- note: "`-y` is available for a safe non-interactive install, but it does not silently connect accounts, install managed apps, or trust community skills you did not select.",+ note: "Safe non-interactive defaults never silently connect accounts, install managed apps, or trust community skills.",},{n: 3,- title: "Reach it",- body: "The installer binds 127.0.0.1, so :4005 is closed to other machines by default. Tunnel in from whatever you browse on. Pair the device only after you are on HTTPS or http://localhost: a plain-http server IP cannot store MSO's Secure session cookie, and changing hostnames creates a different browser device ID.",+ title: "Reach it safely",+ body: "MSO binds 127.0.0.1 by default. Use the local machine, SSH/WSL/Lima forwarding, Tailscale Serve, or a protected TLS reverse proxy instead of publishing the raw app port.",code: "ssh -N -L 4005:127.0.0.1:4005 you@your-server",- note: "Then open http://localhost:4005. For something permanent use `tailscale serve 4005`, or a TLS reverse proxy pointed at 127.0.0.1:4005.",+ note: "Pair a browser only after you are on HTTPS or localhost so the Secure session cookie can be stored correctly.",},{n: 4,title: "Pair your browser",- body: "Open the app and enter the password. Your browser lands PENDING and shows a device id. Terminal onboarding approves only the local CLI device; browser devices remain explicit owner approvals.",- code: "mso device pending\nmso device approve <deviceId> \"my laptop\"\n# back in the SAME HTTPS/localhost browser: click Check again",- note: "Device approval is a browser allowlist, not standards-based 2FA. Approve only devices you own.",+ body: "Open MSO and enter the owner password. New browser devices remain pending until explicitly approved.",+ code: "mso device pending\nmso device approve <deviceId> \"my laptop\"",+ note: "Approve only devices you control.",},{n: 5,- title: "Reload and sign in",- body: "That browser can now log in. Approve later devices from Settings → Devices. Re-run `mso onboard` whenever you want to change the first-run choices.",- code: undefined,- note: undefined,+ title: "Verify the runtime",+ body: "Verify the actual host path rather than assuming an install succeeded because files exist.",+ code: "mso doctor\nmso --version",+ note: "Platform-specific capability gaps should be reported, not disguised as a healthy Linux host.",},] as const;export default function InstallPage() {return (- <main className="mx-auto min-h-dvh w-full max-w-3xl px-5 py-14 text-foreground sm:px-8">- <header className="mb-12">+ <main className="mx-auto min-h-dvh w-full max-w-4xl px-5 py-14 text-foreground sm:px-8">+ <header className="mb-10"><p className="text-xs font-medium uppercase tracking-widest text-muted-foreground">Manef Shell OS</p><h1 className="mt-3 text-3xl font-semibold tracking-tight sm:text-4xl">- Install it on your own server+ Install MSO on your machine</h1><p className="mt-4 text-balance text-base leading-relaxed text-muted-foreground">- A browser terminal, file manager, live system metrics and a bring-your-own-key AI- assistant for one Linux server you control. Open source, self-hosted, no account and- no database. This page needs no login — the install does.+ One Linux host-runtime contract, multiple machine adapters. Linux runs directly; macOS+ uses Lima, Windows uses WSL2, and Android uses Termux + Ubuntu PRoot. iPhone and iPad+ use the full browser/PWA workspace against an MSO host.</p><p className="mt-4 rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm leading-relaxed text-muted-foreground">- <strong className="font-medium text-foreground">Public Alpha.</strong> MSO is a normal- non-root Node process on top of Linux. It is not an operating system, a distribution,- or a hardened multi-tenant platform. One owner, one server.+ <strong className="font-medium text-foreground">Public Alpha.</strong> MSO can execute+ commands as its runtime user. Compatibility layers preserve the Linux host contract;+ they do not claim Linux guest services are native macOS, Windows, Android or iOS services.</p></header>+ <section className="mb-12">+ <h2 className="mb-4 text-lg font-semibold">Supported platforms</h2>+ <div className="grid gap-3 md:grid-cols-2">+ {PLATFORM_SUPPORT.map((platform) => (+ <article key={platform.id} className="rounded-lg border border-border p-4">+ <div className="flex flex-wrap items-baseline justify-between gap-2">+ <h3 className="text-base font-semibold">{platform.label}</h3>+ <span className="rounded-full border border-border px-2 py-0.5 text-xs text-muted-foreground">+ {platform.modeLabel}+ </span>+ </div>+ <p className="mt-2 text-sm leading-relaxed text-muted-foreground">{platform.summary}</p>+ <p className="mt-2 text-xs text-muted-foreground">+ Manages: <span className="font-medium text-foreground">{platform.hostScope}</span>+ </p>+ {platform.installCommand ? <Copy text={platform.installCommand} /> : (+ <p className="mt-3 rounded-md bg-muted px-3 py-2 text-sm text-muted-foreground">+ Open your protected MSO HTTPS URL in Safari, then Share → Add to Home Screen.+ </p>+ )}+ {platform.verifyCommand ? (+ <p className="mt-2 break-words font-mono text-xs text-muted-foreground">{platform.verifyCommand}</p>+ ) : null}+ <ul className="mt-3 space-y-1 text-xs leading-relaxed text-muted-foreground">+ {platform.notes.map((note) => <li key={note}>• {note}</li>)}+ </ul>+ </article>+ ))}+ </div>+ </section>+<section className="mb-12"><h2 className="mb-4 text-lg font-semibold">Before you start</h2><dl className="grid gap-3 sm:grid-cols-2">@@ -95,36 +122,31 @@ export default function InstallPage() {<section className="mb-12 rounded-lg border border-border p-4"><h2 className="text-lg font-semibold">Using an AI agent?</h2><p className="mt-2 text-sm leading-relaxed text-muted-foreground">- Give it the repository and one sentence. The repo tells capable agents to use the official- installer/update path, preserve an existing install, and verify with <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">mso doctor</code>.+ Give it the repository and one sentence. It should detect the machine, use the supported+ platform bootstrap, preserve an existing install, and finish with mso doctor.</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.- For an older build where those do not exist, re-run the installer above; it upgrades the service checkout in place and preserves existing configuration/state.+ 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><section className="mb-12"><h2 className="mb-5 text-lg font-semibold">Five steps</h2><ol className="space-y-8">- {STEPS.map((s) => (- <li key={s.n} className="grid grid-cols-[2rem_1fr] gap-x-3">- <span- aria-hidden- className="mt-0.5 flex size-7 items-center justify-center rounded-full border border-border text-sm font-medium tabular-nums"- >- {s.n}+ {STEPS.map((step) => (+ <li key={step.n} className="grid grid-cols-[2rem_1fr] gap-x-3">+ <span aria-hidden className="mt-0.5 flex size-7 items-center justify-center rounded-full border border-border text-sm font-medium tabular-nums">+ {step.n}</span><div className="min-w-0">- <h3 className="text-base font-medium">{s.title}</h3>- <p className="mt-1.5 text-sm leading-relaxed text-muted-foreground">{s.body}</p>- {s.code ? <Copy text={s.code} /> : null}- {s.note ? (- <p className="mt-2 text-sm leading-relaxed text-muted-foreground">- <span className="font-medium text-foreground">Note:</span> {s.note}- </p>- ) : null}+ <h3 className="text-base font-medium">{step.title}</h3>+ <p className="mt-1.5 text-sm leading-relaxed text-muted-foreground">{step.body}</p>+ <Copy text={step.code} />+ <p className="mt-2 text-sm leading-relaxed text-muted-foreground">+ <span className="font-medium text-foreground">Note:</span> {step.note}+ </p></div></li>))}@@ -134,16 +156,15 @@ export default function InstallPage() {<section className="mb-12"><h2 className="mb-3 text-lg font-semibold">Drive it from a shell</h2><p className="text-sm leading-relaxed text-muted-foreground">- The service install creates a guarded <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">/usr/local/bin/mso</code> launcher,- because a child <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">curl | bash</code> process cannot export PATH back into its parent shell.- The normal <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">~/.local/bin</code> fallback is persisted too. So the first command after install can be <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">mso -h</code>.+ On native Linux, the service installer creates a guarded <code className="rounded bg-muted px-1 py-0.5 text-[0.85em]">/usr/local/bin/mso</code> launcher plus the user-local fallback. Compatibility launchers delegate into the same Linux runtime so the CLI contract stays consistent across machines.</p>- <Copy text={'mso -h\nmso doctor\nmso onboard\nmso skills available'} />+ <Copy text={"mso -h\nmso doctor\nmso onboard\nmso skills available\nmso skills install ponytail caveman rtk -y"} /></section><footer className="flex flex-wrap gap-x-6 gap-y-2 border-t border-border pt-6 text-sm">{[["Source + full docs", "https://github.com/rahmanef63/mso"],+ ["Platform matrix", "https://github.com/rahmanef63/mso/blob/main/docs/PLATFORMS.md"],["Install reference", "https://github.com/rahmanef63/mso/blob/main/docs/INSTALL.md"],["CLI reference", "https://github.com/rahmanef63/mso/blob/main/docs/CLI.md"],["Security model", "https://github.com/rahmanef63/mso/blob/main/SECURITY.md"],diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 352b79d1..3bc44dcd 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -4,9 +4,11 @@> `docs/PROGRESS.md` records why the architecture changed; dated plans and audits are> historical inputs, not runtime contracts.-MSO is one self-hosted Next.js application running as a non-root Linux user. The-browser UI, CLI, Alfa assistant, and optional MCP connector all converge on the same-bounded host layer rather than each implementing filesystem or process access.+MSO is one self-hosted Next.js application running under a non-root Linux runtime.+On Linux that runtime is native; macOS, Windows and Android can supply it through the platform+adapters documented in [PLATFORMS.md](./PLATFORMS.md). iOS/iPadOS is a client/PWA surface.+The browser UI, CLI, Alfa assistant, and optional MCP connector all converge on the same bounded+host layer rather than each implementing filesystem or process access.```mermaidflowchart LRdiff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 8d56f792..9e0d6221 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,12 +8,14 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Added**+- `install` add cross-platform host adapters- `integrations` add safe Convex Cloud deploy runner- `workflows` add reviewed external editor tabs- `organization` add internal project flows with callable CRUD**Fixed**+- `integrations` allow Convex snapshot imports- `review` preserve session and surface store invariants- `security` validate cache exceptions from raw report- `security` scope passive cache review by pathdiff --git a/docs/INSTALL.md b/docs/INSTALL.mdindex e4827d42..10ca05c3 100644--- a/docs/INSTALL.md+++ b/docs/INSTALL.md@@ -1,20 +1,32 @@-# Installing MSO on a Linux server+# Installing MSO across machines-> **Current reference.** The one-command installer is the supported path for a normal-> deployment. Manual commands below explain the model and recovery boundaries; release-> developers should use `bun run ship`, while operators update through Settings → About or-> `mso update` (`mso update run` remains accepted).+> **Current reference.** MSO keeps one Linux host-runtime contract and adapts the machine+> around it. This preserves terminal/process/filesystem/gateway safety semantics while allowing+> the same product to run from Linux, macOS, Windows and Android machines. iOS/iPadOS is a+> first-class browser/PWA client surface.-## 0. Requirements+## 0. Platform support-- Linux; systemd is required for the installed background service, but not for the CLI;-- WSL2 is supported for the CLI. Full service mode requires systemd enabled as PID 1;-- Node.js 22.12+, 24.x or 26+ (Node 22 recommended/current production runtime);+| Machine | Mode | Install |+|---|---|---|+| Linux | Native host | `curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh \| bash` |+| macOS | Lima Linux guest | same POSIX command; Darwin auto-routes |+| Windows | WSL2 Linux distro | `iwr -useb https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install-windows.ps1 \| iex` |+| Android | Termux + Ubuntu PRoot | same POSIX command; Termux auto-routes |+| iOS / iPadOS | PWA/client | open the protected MSO HTTPS URL in Safari and Add to Home Screen |++See [PLATFORMS.md](./PLATFORMS.md) for the exact host scope and limitations.++### Runtime requirements++- canonical host runtime: Linux userspace;+- systemd is optional for the CLI/web fallback runtime and required only for features that explicitly depend on systemd;+- Node.js 22.12+, 24.x or 26+ inside the Linux runtime;- Bun for dependency installation/scripts;-- a non-root user that owns MSO;-- enough memory/swap for a Next production build (build needs more than idle runtime);-- HTTPS through Tailscale Serve or a reverse proxy for normal non-localhost browser use.-- CLI runtime tools `curl`, `jq`, GNU coreutils and util-linux `flock` (the installer adds missing packages on supported package managers).+- a normal non-root runtime user;+- enough memory/swap for a Next production build;+- HTTPS through Tailscale Serve or a reverse proxy for normal non-localhost browser use;+- CLI runtime tools `curl`, `jq`, GNU coreutils and util-linux `flock` inside the Linux runtime.Optional Browser support additionally needs Camoufox, Xvfb, a lightweight X window manager,x11vnc, noVNC/websockify and a user systemd runtime.@@ -34,10 +46,11 @@ for a current install when available, fall back to this installer for older builand finish with `mso doctor`. It should ask the user only for non-inferable choices/credentials; secretsbelong in MSO's hidden/STDIN onboarding prompts, never CLI argv or chat transcripts.-`scripts/install.sh` is intentionally a tiny bootstrap. It downloads `scripts/install-core.sh`-completely into a private temporary file, retries transient transfers, checks a committed SHA-256,-requires the exact EOF marker, runs `bash -n`, and only then executes the payload. The large-installer is therefore never executed while bytes are still arriving over the network.+`scripts/install.sh` is the public dispatcher. On Linux it downloads and verifies+`scripts/install-core.sh`; on macOS and Termux it downloads and verifies the matching compatibility+bootstrap before handing off. Git Bash/MSYS/Cygwin prints the supported PowerShell/WSL2 entrypoint.+The verified payload is downloaded completely before execution, so a truncated network stream cannot+look like a successful install.The installer core:diff --git a/docs/PLATFORMS.md b/docs/PLATFORMS.mdnew file mode 100644index 00000000..9e5f46fc--- /dev/null+++ b/docs/PLATFORMS.md@@ -0,0 +1,123 @@+# MSO platform support++MSO is **machine-adaptable**, not a collection of unrelated OS forks. The host-capability+layer keeps one Linux runtime contract so terminal, process identity, filesystem safety,+locking, gateway lifecycle and agent execution behave consistently.++The platform adapter decides **where that Linux runtime lives**.++| Machine | Mode | Runtime managed by MSO | Install path |+|---|---|---|---|+| Linux | Native host | The Linux machine itself | canonical POSIX installer |+| macOS | Linux guest host | Lima Linux guest on the Mac | canonical POSIX installer auto-routes to Lima |+| Windows | Linux guest host | WSL2 Linux distro | PowerShell bootstrap |+| Android | Linux guest host | Ubuntu PRoot inside Termux | canonical POSIX installer auto-routes to Termux |+| iOS / iPadOS | Client / PWA | Another MSO host | Safari + Add to Home Screen |++## Why this shape++MSO has host features that are materially Linux-specific today: procfs process identity,+systemd-aware service inventory, kernel-backed file locking and Linux-oriented gateway/process+ownership checks. Pretending those primitives are identical on macOS, Win32, Android or iOS+would produce partial installs that look healthy but fail under real host operations.++The compatibility hosts therefore preserve the same Linux execution environment instead of+duplicating safety logic per OS. This is similar to treating deployment/runtime details as adapters:+the UI and agent surface stay the same, while the machine-specific bootstrap supplies the runtime.++## Linux++Run:++~~~bash+curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash+~~~++Linux is the native and fullest host path. systemd is used when it is really PID 1, but the+CLI and foreground/web fallback remain usable on no-systemd hosts such as containers and+hosted workspaces.++## macOS++Run the same public command:++~~~bash+curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash+~~~++The bootstrap detects Darwin, verifies `scripts/install-macos.sh`, then creates or reuses a+Lima Linux VM. A `~/.local/bin/mso` launcher on macOS delegates commands into that guest.++Requirements:++- Lima, installed automatically with Homebrew when Homebrew is already available;+- enough disk/RAM for the Linux guest and Next production build.++The MSO host tools manage the **Linux guest**, not native launchd services or arbitrary macOS+processes. That boundary is intentional until native macOS host adapters provide equivalent safety.++## Windows++From PowerShell:++~~~powershell+iwr -useb https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install-windows.ps1 | iex+~~~++The bootstrap installs or reuses WSL2 Ubuntu and runs the canonical Linux installer inside it.+A first-time WSL setup can require a Windows reboot or first-launch Linux user creation; rerun the+same MSO command afterward.++The MSO host tools manage the **WSL2 Linux distro**, not Windows Service Control Manager or+arbitrary Win32 processes.++## Android++From Termux, the canonical command now auto-routes:++~~~bash+curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash+~~~++The Android adapter creates or reuses Ubuntu PRoot and exposes a Termux-side `mso` launcher.+No Android root access is required. Because Android may suspend background processes, this is best+for local/personal use; an always-on Linux host is still the stronger production target.++See [TERMUX.md](./TERMUX.md) for repair and PRoot details.++## iOS / iPadOS++iOS/iPadOS is a **first-class client surface**, not a host-runtime target. Open the protected+HTTPS MSO URL in Safari and use **Share → Add to Home Screen**.++This is a technical boundary, not a missing shell theme: iOS does not expose the unrestricted,+persistent Node/Bun host execution and process/service APIs that MSO's host runtime requires.+The iOS shell UI, device approval, terminal, files, agents and MCP-backed workflows still operate+against the connected MSO host.++## Shared invariants++All host paths keep these rules:++- raw MSO bind defaults to `127.0.0.1`;+- Cloudflare, Tailscale, Dokploy and any specific supervisor are optional adapters, not core requirements;+- a missing supervisor must degrade to foreground/fallback runtime rather than make installation impossible;+- platform-specific capability gaps must be reported explicitly;+- installers never claim a guest-controlled service is a native parent-OS service;+- `mso doctor` is the post-install verification surface.++## Verification++On Linux, macOS or Android after the launcher is installed:++~~~bash+mso --version+mso doctor+mso -h+~~~++On Windows, enter WSL2 first and run the same commands there.++The repository test suite pins the five-platform catalog and verifies that the public POSIX+dispatcher still contains macOS and Android routing. This prevents the install UI from regressing+back to a Linux-only presentation.diff --git a/docs/README.md b/docs/README.mdindex e79565d6..7a8e6b85 100644--- a/docs/README.md+++ b/docs/README.md@@ -27,6 +27,7 @@ evidence and review freshness. The repository quality gate runs both automatical| [`COMPARISON.md`](./COMPARISON.md) | Generated product comparison methodology, evidence and notes || [`COMPETITIVE-ROADMAP.md`](./COMPETITIVE-ROADMAP.md) | Executed comparison plan, deliberate specialist boundaries and next investments || [`INSTALL.md`](./INSTALL.md) | Owner installation, TLS, updates, backup and uninstall |+| [`PLATFORMS.md`](./PLATFORMS.md) | Linux/macOS/Windows/Android/iOS support modes and machine adapters || [`TERMUX.md`](./TERMUX.md) | Android/Termux bootstrap through Ubuntu PRoot, repair path and verification || [`INFRASTRUCTURE-PROVIDERS.md`](./INFRASTRUCTURE-PROVIDERS.md) | Interactive MSO Agent TUI/approval/error contract plus Dokploy/Cloudflare/Hostinger/Composio credentials, tools and deployment boundary || [`DEVELOPMENT.md`](./DEVELOPMENT.md) | Development and release workflow |diff --git a/docs/TERMUX.md b/docs/TERMUX.mdindex 236d6ca2..13f97492 100644--- a/docs/TERMUX.md+++ b/docs/TERMUX.md@@ -11,14 +11,16 @@ References:## One-paste install-Run this in Termux:+Run the canonical public installer in Termux:```bash-apt update && apt full-upgrade -y && \-apt install -y curl ca-certificates proot-distro && \-curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install-termux.sh | bash+curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash```+The public bootstrap detects Termux, verifies `scripts/install-termux.sh`, and hands off to it.+If a partial Termux package upgrade has broken `curl` before that command can run, use the repair+steps below first.+The Termux bootstrap is idempotent. Re-running the same command repairs/upgrades the host packages, reuses the `mso-ubuntu` PRoot environment when it already exists, and runs the normal MSO installer again to update the existing checkout.The script deliberately does **not** enable YOLO mode.diff --git a/docs/reference/WORKSPACE-GUIDE.md b/docs/reference/WORKSPACE-GUIDE.mdindex 5c84e61c..15f987a2 100644--- a/docs/reference/WORKSPACE-GUIDE.md+++ b/docs/reference/WORKSPACE-GUIDE.md@@ -524,26 +524,19 @@ See [the generated product comparison](../COMPARISON.md).## Tested platforms<details>-<summary><strong>Linux / WSL deployment support and untested platforms</strong></summary>+<summary><strong>Machine / runtime support</strong></summary>-Not yet formally tested across a full distro matrix.+The canonical runtime is Linux; platform adapters decide where that Linux runtime lives.-Tested:+Validated Linux baselines include Ubuntu 22.04 and Ubuntu 24.04. Supported machine paths are:-- Ubuntu 22.04-- Ubuntu 24.04+- Linux: native host; systemd service when available, foreground/no-systemd fallback otherwise.+- Windows: WSL2 Linux distro; MSO manages the distro rather than native Win32 services.+- macOS: Lima Linux guest; MSO manages the guest rather than native launchd services.+- Android: Termux + Ubuntu PRoot; local hosts remain subject to Android battery/background policy.+- iOS/iPadOS: browser/PWA client to an MSO host; no native host-runtime claim.-Supported deployment shapes:--- WSL2 Ubuntu: CLI/install path works without systemd; the background service requires systemd enabled in WSL-- Debian 12 and other systemd-based Linux distributions with Node.js 22.12+, 24.x or 26+ and build tools--Not currently supported:--- Windows host-- macOS host-- Automatic service install on non-systemd hosts-- Root deployment+Root deployment remains unsupported. See [PLATFORMS.md](../PLATFORMS.md).</details>diff --git a/lib/platform-support.test.ts b/lib/platform-support.test.tsnew file mode 100644index 00000000..1984f542--- /dev/null+++ b/lib/platform-support.test.ts@@ -0,0 +1,121 @@+import { spawnSync } from "node:child_process";+import { createHash } from "node:crypto";+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import { describe, expect, it } from "vitest";+import { PLATFORM_SUPPORT, platformSupport } from "./platform-support";++const ROOT = path.join(__dirname, "..");+const INSTALL_PAGE = fs.readFileSync(path.join(ROOT, "app/install/page.tsx"), "utf8");+const INSTALLER_PATH = path.join(ROOT, "scripts/install.sh");+const INSTALLER = fs.readFileSync(INSTALLER_PATH, "utf8");+const MACOS_INSTALLER = fs.readFileSync(path.join(ROOT, "scripts/install-macos.sh"), "utf8");+const TERMUX_INSTALLER = fs.readFileSync(path.join(ROOT, "scripts/install-termux.sh"), "utf8");+const WINDOWS_INSTALLER = fs.readFileSync(path.join(ROOT, "scripts/install-windows.ps1"), "utf8");++const sha256 = (value: string) => createHash("sha256").update(value).digest("hex");++function dispatcherSmoke(uname: string, extraEnv: Partial<NodeJS.ProcessEnv> = {}) {+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "mso-platform-dispatch-"));+ const log = path.join(tmp, "dispatch.log");+ fs.writeFileSync(path.join(tmp, "uname"), "#!/bin/sh\nprintf '%s\\n' \"$FAKE_UNAME\"\n", { mode: 0o755 });+ fs.writeFileSync(+ path.join(tmp, "bash"),+ `#!/bin/sh+[ "\${1:-}" = -n ] && exit 0+if grep -q 'macOS compatibility bootstrap' "\${1:-}" 2>/dev/null; then printf macos >"$MSO_TEST_DISPATCH_LOG"; fi+if grep -q 'MSO bootstrap for Termux/Android' "\${1:-}" 2>/dev/null; then printf android >"$MSO_TEST_DISPATCH_LOG"; fi+exit 0+`,+ { mode: 0o755 },+ );+ const result = spawnSync("/bin/bash", [INSTALLER_PATH], {+ cwd: ROOT,+ env: {+ ...process.env,+ ...extraEnv,+ PATH: `${tmp}:${process.env.PATH ?? ""}`,+ FAKE_UNAME: uname,+ MSO_TEST_DISPATCH_LOG: log,+ MSO_INSTALL_RAW_BASE: `file://${path.join(ROOT, "scripts")}`,+ },+ encoding: "utf8",+ });+ const dispatched = fs.existsSync(log) ? fs.readFileSync(log, "utf8") : "";+ fs.rmSync(tmp, { recursive: true, force: true });+ return { ...result, dispatched };+}++describe("MSO platform support contract", () => {+ it("keeps every published machine/client platform visible", () => {+ expect(PLATFORM_SUPPORT.map((item) => item.id)).toEqual([+ "linux",+ "macos",+ "windows",+ "android",+ "ios",+ ]);+ expect(INSTALL_PAGE).toContain("PLATFORM_SUPPORT.map((platform)");+ });++ it("prevents macOS from silently disappearing from install UX", () => {+ const mac = platformSupport("macos");+ expect(mac.installCommand).toContain("scripts/install.sh");+ expect(mac.mode).toBe("linux-guest-host");+ expect(INSTALLER).toContain("Darwin)");+ expect(MACOS_INSTALLER).toContain("limactl");+ });++ it("keeps truthful host boundaries", () => {+ expect(platformSupport("linux").mode).toBe("native-host");+ expect(platformSupport("windows").mode).toBe("linux-guest-host");+ expect(platformSupport("android").mode).toBe("linux-guest-host");+ expect(platformSupport("ios").mode).toBe("client");+ expect(platformSupport("ios").installCommand).toBeUndefined();+ expect(WINDOWS_INSTALLER).toContain("WSL2");+ });++ it("pins compatibility bootstraps from the public dispatcher", () => {+ expect(INSTALLER).toContain('MACOS_SHA256="' + sha256(MACOS_INSTALLER) + '"');+ expect(INSTALLER).toContain('TERMUX_SHA256="' + sha256(TERMUX_INSTALLER) + '"');+ expect(INSTALLER).toContain("*/com.termux/files/usr)");+ expect(INSTALLER).toContain("MINGW*|MSYS*|CYGWIN*)");+ });++ it("keeps the Windows bootstrap structurally singular", () => {+ expect(WINDOWS_INSTALLER.split("$Script = @'").length - 1).toBe(1);+ expect(WINDOWS_INSTALLER.split("\n'@\n").length - 1).toBe(1);+ expect(WINDOWS_INSTALLER.split("Installing/updating MSO inside WSL2").length - 1).toBe(1);+ expect(WINDOWS_INSTALLER).toContain('Get-Command "wsl.exe"');+ expect(WINDOWS_INSTALLER).toContain('Where-Object { $_ -and ($_ -notlike "docker-desktop*") }');+ });++ it("prevents Termux recursion inside the Ubuntu guest", () => {+ expect(TERMUX_INSTALLER).toContain("unset PREFIX TERMUX_VERSION");+ });++ it("keeps guest-side shell variables literal until guest execution", () => {+ expect(MACOS_INSTALLER).toContain('export PATH="\\$HOME/.local/bin:\\$HOME/.bun/bin:\\$PATH"');+ expect(MACOS_INSTALLER).toContain('exec mso "\\$@"');+ expect(WINDOWS_INSTALLER).toContain("$Script = @'");+ expect(WINDOWS_INSTALLER).toContain('export PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH"');+ });++ it("actually routes Darwin and Termux through verified compatibility payloads", () => {+ const mac = dispatcherSmoke("Darwin");+ expect(mac.status, mac.stderr).toBe(0);+ expect(mac.dispatched).toBe("macos");++ const android = dispatcherSmoke("Linux", { PREFIX: "/data/data/com.termux/files/usr" });+ expect(android.status, android.stderr).toBe(0);+ expect(android.dispatched).toBe("android");+ });++ it("redirects Windows POSIX shells to the PowerShell/WSL2 entrypoint", () => {+ const windows = dispatcherSmoke("MINGW64_NT-10.0");+ expect(windows.status).toBe(64);+ expect(windows.stdout).toContain("install-windows.ps1");+ expect(windows.stdout).toContain("WSL2");+ });+});diff --git a/lib/platform-support.ts b/lib/platform-support.tsnew file mode 100644index 00000000..0412b38b--- /dev/null+++ b/lib/platform-support.ts@@ -0,0 +1,79 @@+export type MsoPlatformId = "linux" | "macos" | "windows" | "android" | "ios";+export type MsoPlatformMode = "native-host" | "linux-guest-host" | "client";++export type MsoPlatformSupport = {+ id: MsoPlatformId;+ label: string;+ mode: MsoPlatformMode;+ modeLabel: string;+ summary: string;+ installCommand?: string;+ verifyCommand?: string;+ hostScope: string;+ notes: readonly string[];+};++const RAW = "https://raw.githubusercontent.com/rahmanef63/mso/main/scripts";+const POSIX_INSTALL = `curl -fsSL ${RAW}/install.sh | bash`;++export const PLATFORM_SUPPORT: readonly MsoPlatformSupport[] = [+ {+ id: "linux",+ label: "Linux",+ mode: "native-host",+ modeLabel: "Native host",+ summary: "Runs the canonical MSO runtime directly as a non-root Linux process.",+ installCommand: POSIX_INSTALL,+ verifyCommand: "mso doctor",+ hostScope: "This Linux machine",+ notes: ["Full host-runtime path.", "systemd is optional for the CLI/web fallback runtime.", "Binds 127.0.0.1 by default."],+ },+ {+ id: "macos",+ label: "macOS",+ mode: "linux-guest-host",+ modeLabel: "Host via Lima",+ summary: "The public installer detects macOS, creates or reuses a Lima Linux VM, and delegates the mso CLI into it.",+ installCommand: POSIX_INSTALL,+ verifyCommand: "mso doctor",+ hostScope: "Linux guest on this Mac",+ notes: ["Keeps /proc, PTY, locking and process semantics consistent.", "Lima handles localhost forwarding between guest and Mac."],+ },+ {+ id: "windows",+ label: "Windows",+ mode: "linux-guest-host",+ modeLabel: "Host via WSL2",+ summary: "The PowerShell bootstrap installs or reuses WSL2 Ubuntu, then runs the canonical MSO Linux installer there.",+ installCommand: `iwr -useb ${RAW}/install-windows.ps1 | iex`,+ verifyCommand: "Open WSL2, then run: mso doctor",+ hostScope: "Linux distro inside WSL2",+ notes: ["WSL2 is the stable Windows host path.", "First-time WSL setup can require a reboot or Ubuntu first-run before rerunning MSO."],+ },+ {+ id: "android",+ label: "Android",+ mode: "linux-guest-host",+ modeLabel: "Host via Termux + Ubuntu PRoot",+ summary: "The public installer detects Termux, creates or reuses Ubuntu PRoot, and exposes a Termux-side mso launcher.",+ installCommand: POSIX_INSTALL,+ verifyCommand: "mso doctor",+ hostScope: "Ubuntu PRoot guest on this Android device",+ notes: ["No Android root access is required.", "Android battery/background policy can suspend long-running local hosts."],+ },+ {+ id: "ios",+ label: "iOS / iPadOS",+ mode: "client",+ modeLabel: "PWA / client",+ summary: "Uses the full MSO browser workspace against another MSO host; native host execution is not claimed on iOS/iPadOS.",+ hostScope: "Remote MSO host",+ notes: ["Open the protected HTTPS MSO URL in Safari and Add to Home Screen.", "iPhone/iPad remains the operator surface; host execution stays on a supported MSO host."],+ },+] as const;++export function platformSupport(id: MsoPlatformId): MsoPlatformSupport {+ const entry = PLATFORM_SUPPORT.find((item) => item.id === id);+ if (!entry) throw new Error(`Unknown MSO platform: ${id}`);+ return entry;+}diff --git a/scripts/install-macos.sh b/scripts/install-macos.shnew file mode 100644index 00000000..d27c89ad--- /dev/null+++ b/scripts/install-macos.sh@@ -0,0 +1,76 @@+#!/usr/bin/env bash+# macOS compatibility bootstrap for MSO.+#+# MSO's host layer intentionally keeps one Linux runtime contract. On macOS,+# Lima supplies that Linux runtime and this script installs a host-side mso+# launcher that delegates commands into the guest.+set -Eeuo pipefail+umask 077++INSTANCE="${MSO_LIMA_INSTANCE:-mso}"+INSTALL_URL="${MSO_INSTALL_URL:-https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh}"+BIN_DIR="${MSO_BIN_DIR:-$HOME/.local/bin}"++info() { printf '· %s\n' "$*"; }+ok() { printf '✓ %s\n' "$*"; }+fail() { printf '✗ %s\n' "$*" >&2; exit 1; }++[ "$(uname -s)" = "Darwin" ] || fail "run this bootstrap on macOS."++if ! command -v limactl >/dev/null 2>&1; then+ command -v brew >/dev/null 2>&1 || fail "Lima is required. Install Homebrew, then rerun; or install Lima yourself."+ info "installing Lima with Homebrew"+ brew install lima+fi++if limactl list --format '{{.Name}}' 2>/dev/null | grep -Fxq "$INSTANCE"; then+ info "starting/reusing Lima instance: $INSTANCE"+ limactl start "$INSTANCE"+else+ info "creating Lima Linux instance: $INSTANCE"+ limactl start --name="$INSTANCE" --tty=false template:default+fi++info "installing/updating MSO inside Lima"+limactl shell "$INSTANCE" bash -lc "+ set -Eeuo pipefail+ unset PREFIX TERMUX_VERSION+ export PATH=\"\$HOME/.local/bin:\$HOME/.bun/bin:\$PATH\"+ curl -fsSL '$INSTALL_URL' | bash -s -- --no-service --no-onboard+ command -v mso >/dev/null+ mso --version+ mso -h >/dev/null+"++mkdir -p "$BIN_DIR"+LAUNCHER="$BIN_DIR/mso"+cat > "$LAUNCHER" <<EOF_LAUNCHER+#!/usr/bin/env bash+set -Eeuo pipefail+limactl start "$INSTANCE" >/dev/null+exec limactl shell "$INSTANCE" bash -lc 'export PATH="\$HOME/.local/bin:\$HOME/.bun/bin:\$PATH"; exec mso "\$@"' mso "\$@"+EOF_LAUNCHER+chmod 0755 "$LAUNCHER"++persist_path() {+ local rc="$1"+ touch "$rc"+ grep -Fq '# >>> mso cli >>>' "$rc" 2>/dev/null && return+ cat >> "$rc" <<'EOF_PATH'++# >>> mso cli >>>+case ":$PATH:" in+ *":$HOME/.local/bin:"*) ;;+ *) export PATH="$HOME/.local/bin:$PATH" ;;+esac+# <<< mso cli <<<+EOF_PATH+}+persist_path "$HOME/.zprofile"+persist_path "$HOME/.bash_profile"++ok "MSO is installed for macOS through Lima."+printf '\nFor this shell if needed:\n export PATH="$HOME/.local/bin:$PATH"\n'+printf 'Verify:\n mso --version\n mso doctor\n'+printf 'Start workspace:\n mso web\n'+printf '\nMSO manages the Linux guest, not macOS launchd/processes directly. The raw app bind remains loopback-only by default.\n'diff --git a/scripts/install-termux.sh b/scripts/install-termux.shindex 606d510f..39f6c9bb 100755--- a/scripts/install-termux.sh+++ b/scripts/install-termux.sh@@ -65,6 +65,7 @@ proot-distro login "$DISTRO" -- bash -lc "info 'installing/updating MSO inside Ubuntu'proot-distro login "$DISTRO" --user "$GUEST_USER" -- bash -lc "set -Eeuo pipefail+ unset PREFIX TERMUX_VERSIONexport PATH=\"\$HOME/.local/bin:\$HOME/.bun/bin:\$PATH\"curl -fsSL '$INSTALL_URL' | bash -s -- --no-service --no-onboardcommand -v mso >/dev/null 2>&1diff --git a/scripts/install-windows.ps1 b/scripts/install-windows.ps1new file mode 100644index 00000000..baa6645e--- /dev/null+++ b/scripts/install-windows.ps1@@ -0,0 +1,78 @@+# Windows compatibility bootstrap for MSO.+# The stable Windows host path is WSL2 + a normal Linux distro, preserving the+# same Linux host-runtime contract used by every other MSO host adapter.+$ErrorActionPreference = "Stop"++$RequestedDistro = $env:MSO_WSL_DISTRO+$InstallUrl = if ($env:MSO_INSTALL_URL) {+ $env:MSO_INSTALL_URL+} else {+ "https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh"+}++function Info([string]$Message) { Write-Host "· $Message" }+function Ok([string]$Message) { Write-Host "✓ $Message" }+function Fail([string]$Message) {+ Write-Error $Message+ exit 1+}++if ($RequestedDistro -and ($RequestedDistro -notmatch '^[A-Za-z0-9._-]+$')) {+ Fail "Invalid WSL distro name."+}++if (-not (Get-Command "wsl.exe" -ErrorAction SilentlyContinue)) {+ Fail "WSL2 is required. Enable Windows Subsystem for Linux, then rerun this installer."+}++$RawDistros = & wsl.exe -l -q 2>$null+$Distros = @(+ $RawDistros |+ ForEach-Object { $_.Trim([char]0).Trim() } |+ Where-Object { $_ -and ($_ -notlike "docker-desktop*") }+)++$Distro = if ($RequestedDistro) {+ $RequestedDistro+} elseif ($Distros.Count -gt 0) {+ $Distros[0]+} else {+ "Ubuntu"+}++if ($Distros -notcontains $Distro) {+ Info "Installing WSL2 distro: $Distro"+ & wsl.exe --install -d $Distro+ if ($LASTEXITCODE -ne 0) {+ Fail "WSL installation failed."+ }+ Write-Host ""+ Write-Host "Windows may require a reboot or first-launch Linux user setup."+ Write-Host "Complete that setup, then rerun this same MSO installer command."+ exit 0+}++Info "Installing/updating MSO inside WSL2 ($Distro)"+$Script = @'+set -Eeuo pipefail+unset PREFIX TERMUX_VERSION+export PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH"+curl -fsSL "$MSO_INSTALL_URL" | bash -s -- --no-onboard+command -v mso >/dev/null+mso --version+mso -h >/dev/null+'@++& wsl.exe -d $Distro -- env "MSO_INSTALL_URL=$InstallUrl" bash -lc $Script+if ($LASTEXITCODE -ne 0) {+ Fail "MSO install inside WSL2 failed."+}++Ok "MSO is installed for Windows through WSL2."+Write-Host ""+Write-Host "Verify inside WSL2:"+Write-Host " wsl -d $Distro"+Write-Host ' export PATH="$HOME/.local/bin:$HOME/.bun/bin:$PATH"'+Write-Host " mso doctor"+Write-Host ""+Write-Host "MSO manages the WSL2 Linux distro, not Windows services/processes directly."diff --git a/scripts/install.sh b/scripts/install.shindex 0cc0fdb9..dd41dedd 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -1,38 +1,87 @@#!/usr/bin/env bash-trap 'case $? in 0) trap - EXIT; [ -z "${TMP_INSTALLER:-}" ] || rm -f "$TMP_INSTALLER"; printf "mso installer bootstrap ended before verified-core handoff; retry the download.\n" >&2; exit 97 ;; *) trap - EXIT; [ -z "${TMP_INSTALLER:-}" ] || rm -f "$TMP_INSTALLER"; exit 1 ;; esac' EXIT-# MSO one-line installer bootstrap.+trap 'rc=$?; trap - EXIT; [ -z "${TMP_INSTALLER:-}" ] || rm -f "$TMP_INSTALLER"; [ -z "${TMP_PLATFORM:-}" ] || rm -f "$TMP_PLATFORM"; if [ "$rc" -eq 0 ]; then printf "mso installer bootstrap ended before verified-core handoff; retry the download.\n" >&2; exit 97; fi; exit "$rc"' EXIT+# MSO public installer bootstrap.#-# curl -fsSL https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install.sh | bash-#-# Keep this file intentionally tiny. Streaming a large shell script directly into-# bash can produce a false success if an intermediary closes the response at a-# syntactically complete line. This bootstrap downloads the real installer to a-# private temporary file, proves completeness + SHA-256 + syntax, then executes it.+# Linux executes the verified Linux installer core. macOS and Android/Termux are+# routed to verified compatibility bootstraps first. Git Bash/MSYS/Cygwin prints+# the supported Windows/WSL2 PowerShell entrypoint instead of pretending Win32+# provides the Linux host primitives MSO requires.set -Eeuo pipefailumask 077+RAW_BASE="${MSO_INSTALL_RAW_BASE:-https://raw.githubusercontent.com/rahmanef63/mso/main/scripts}"CORE_URL="${MSO_INSTALL_CORE_URL:-https://raw.githubusercontent.com/rahmanef63/mso/main/scripts/install-core.sh}"CORE_SHA256="c2b5685734c9474c56b8d4a20cde3d4d4e9e1cfa0209744c4e3b337590a27144"CORE_EOF='# MSO_INSTALLER_CORE_EOF'+MACOS_SHA256="c0d71002cba03b2fe06821e2327c08e15f69e707b060bac6eee050e139c93b96"+TERMUX_SHA256="27c1a7d558c51ec875d17fd4a02a49e9e309eeb57fb306f62ea8de890ae2e65d"TMP_INSTALLER=''+TMP_PLATFORM=''+fail() { printf 'mso installer bootstrap: %s\n' "$*" >&2; exit 1; }command -v curl >/dev/null 2>&1 || fail 'curl is required.'-command -v sha256sum >/dev/null 2>&1 || fail 'sha256sum is required to verify the installer payload.'++sha256_file() {+ if command -v sha256sum >/dev/null 2>&1; then+ sha256sum "$1" | awk '{print $1}'+ elif command -v shasum >/dev/null 2>&1; then+ shasum -a 256 "$1" | awk '{print $1}'+ else+ fail 'sha256sum or shasum is required to verify installer payloads.'+ fi+}++run_platform_bootstrap() {+ local name="$1" expected="$2" url="$RAW_BASE/$1"+ shift 2+ TMP_PLATFORM="$(mktemp "${TMPDIR:-/tmp}/mso-platform.XXXXXX")"+ curl -fsSL --retry 3 --retry-delay 1 --connect-timeout 15 --max-time 180 "$url" -o "$TMP_PLATFORM" \+ || fail "$name download failed."+ [ "$(sha256_file "$TMP_PLATFORM")" = "$expected" ] || fail "$name hash mismatch (main may have changed during download); retry."+ bash -n "$TMP_PLATFORM" || fail "$name failed shell syntax validation."++ trap - EXIT+ set +e+ bash "$TMP_PLATFORM" "$@"+ local rc=$?+ set -e+ rm -f "$TMP_PLATFORM"+ TMP_PLATFORM=''+ exit "$rc"+}++case "$(uname -s 2>/dev/null || printf unknown)" in+ Darwin)+ run_platform_bootstrap install-macos.sh "$MACOS_SHA256" "$@"+ ;;+ Linux)+ case "${PREFIX:-}" in+ */com.termux/files/usr)+ run_platform_bootstrap install-termux.sh "$TERMUX_SHA256" "$@"+ ;;+ esac+ ;;+ MINGW*|MSYS*|CYGWIN*)+ printf '%s\n' 'MSO on Windows uses WSL2. Open PowerShell and run:'+ printf '%s\n' "iwr -useb $RAW_BASE/install-windows.ps1 | iex"+ exit 64+ ;;+esacTMP_INSTALLER="$(mktemp "${TMPDIR:-/tmp}/mso-install-core.XXXXXX")"-# Download FIRST; never execute bytes while they are still arriving.-curl -fsSL --retry 3 --retry-delay 1 --connect-timeout 15 --max-time 180 "$CORE_URL" -o "$TMP_INSTALLER" || fail 'installer payload download failed.'+curl -fsSL --retry 3 --retry-delay 1 --connect-timeout 15 --max-time 180 \+ "$CORE_URL" -o "$TMP_INSTALLER" || fail 'installer payload download failed.'[ "$(wc -c <"$TMP_INSTALLER")" -ge 20000 ] || fail 'installer payload is unexpectedly short; refusing partial execution.'[ "$(tail -n 1 "$TMP_INSTALLER")" = "$CORE_EOF" ] || fail 'installer payload is incomplete; EOF marker missing.'-ACTUAL_SHA="$(sha256sum "$TMP_INSTALLER" | awk '{print $1}')"+ACTUAL_SHA="$(sha256_file "$TMP_INSTALLER")"[ "$ACTUAL_SHA" = "$CORE_SHA256" ] || fail 'installer payload hash mismatch (main may have changed during download); retry.'bash -n "$TMP_INSTALLER" || fail 'installer payload failed shell syntax validation.'-# Keep the verified payload alive on an fd, unlink its pathname, then replace this-# streamed bootstrap process. If the network stream ends before the final exec,-# the EXIT trap above converts even a syntactically complete prefix into failure.+# Linux has /proc/self/fd. The Darwin/Android compatibility paths have already+# exited above, so retaining the verified payload by fd keeps the Linux bootstrap+# atomic without adding a second pathname race.exec 3<"$TMP_INSTALLER"rm -f "$TMP_INSTALLER"TMP_INSTALLER=''