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
#!/usr/bin/env bash
# Quiesce runtime, install dependencies/config, and build Sourced by the verified installer core after checkout.
INSTALL_PHASE=runtime-safety
# ---- freeze every runtime that can read this checkout before dependency/build mutation ----
# The lifecycle remains open through service refresh. A pre-mutation abort restores the
# known-good service/fallbacks; after mutation starts EXIT preserves recovery intent and
# never serves the possibly changed tree.
# shellcheck source=scripts/lib/install-runtime-lifecycle.sh
. "$DIR/scripts/lib/install-runtime-lifecycle.sh"
trap install_runtime_lifecycle_cleanup EXIT
trap 'exit 129' HUP; trap 'exit 130' INT; trap 'exit 143' TERM
install_runtime_lifecycle_begin
INSTALL_PHASE=dependencies
# ---- deps (compiles node-pty) ----
# [email protected] falls back to the `node-gyp` command when no Linux prebuild is
# available. Minimal/Codespaces images can have a complete compiler toolchain but
# no standalone node-gyp binary. Provide a pinned user-local runner before Bun
# executes dependency lifecycle scripts; do not mutate global npm state.
# shellcheck source=scripts/install/node-gyp.sh
. "$DIR/scripts/install/node-gyp.sh"
node_pty_ready() {
node -e 'require("node-pty")' >/dev/null 2>&1
}
ensure_node_gyp_runner
info "installing dependencies…"
install_runtime_lifecycle_mark_mutation_started
bun install --frozen-lockfile || bun install
# A package-manager retry may report "no changes" after a failed lifecycle
# script. Verify the native binding immediately so Next.js cannot fail much later
# while collecting route configuration. One explicit rebuild is safe/idempotent.
if ! node_pty_ready; then
warn "node-pty native binding missing after dependency install — rebuilding once…"
"$NODE_GYP_BIN" rebuild --directory="$DIR/node_modules/node-pty"
fi
node_pty_ready || die "node-pty native binding is still unavailable after rebuild."
INSTALL_PHASE=configuration
# ---- data dir + secrets (write .env.local only if absent) ----
mkdir -p "$HOME/.mso" && chmod 700 "$HOME/.mso"
GEN_PW=""
if [ ! -f .env.local ]; then
SECRET="$(rand_hex 32)"
GEN_PW="$(rand_password)"
( umask 077
cat > .env.local <<EOF
# mso — generated by install.sh. Private; NEVER commit.
OS_LOGIN_PASSWORD=$GEN_PW
OS_SESSION_SECRET=$SECRET
# OAuth-protected MCP is available on fresh installs; consent/bearer auth still gates every call.
OS_MCP_ENABLED=1
# SECURITY: exec bearer compromise means remote command execution as this service user.
OS_MCP_MAX_SCOPE=exec
# SESSION_EXPIRY_HOURS=24
# OS_FS_READ_ROOTS=~:~/projects
# OS_FS_WRITE_ROOTS=~:~/projects
# OS_AUDIT_LOG=~/.mso/audit.log
EOF
)
chmod 600 .env.local
ok "wrote .env.local (login password + session secret generated; OAuth MCP enabled with exec ceiling)"
else
info ".env.local exists — left untouched (existing secrets preserved)"
fi
INSTALL_PHASE=build
# ---- build ----
# Do not invoke Next through `bun run build` here. Bun resolves package binaries
# through node_modules/.bin metadata, and Bun 1.3.x can occasionally leave that
# metadata unreadable on WSL even when node_modules/next itself is intact. The
# package entrypoint is ordinary Node.js, so invoke it directly and bypass the
# remapper entirely. Only force-reinstall when the package payload itself is absent.
NEXT_BIN="$DIR/node_modules/next/dist/bin/next"
if [ ! -f "$NEXT_BIN" ]; then
warn "Next.js package entrypoint is missing after bun install — repairing dependencies once…"
bun install --force --frozen-lockfile || bun install --force
fi
[ -f "$NEXT_BIN" ] || die "Next.js package entrypoint is still missing after dependency repair: $NEXT_BIN"
info "building (next build via Node entrypoint)…"
node "$NEXT_BIN" build