From 324d9364aab99a3828fd57085de6970258f52b0c Mon Sep 17 00:00:00 2001 From: clover caruso Date: Tue, 20 Oct 2026 13:16:29 -0700 Subject: [PATCH] Integrate the Mac development VM into the authenticated dashboard Register the existing Tart guest through a pinned, restricted SSH bridge. Keep its identity visible when Mac Studio is unreachable; expose supported power controls, reconnectable screen streaming, and Unicode clipboard transfer without a public VNC listener. Preserve local VM behavior and exclude remote memory from Snow Globe capacity. Bound lifecycle cleanup, retain observed hardware separately from live availability, and document the persistent host entry point. Verified: Rust 57 tests; host/VM Python checks; five Mac protocol/failure tests; 25 Linux stream tests; TypeScript and web build; NixOS system build; preview sign-in and inventory; isolated real lifecycle, ISO, preset, clone and path-boundary checks; repeated Mac RFB stream connections. Personal Mac guest remained running. Assisted-by: gpt-6-astra --- config/mac-studio-sandbox.json | 3 +- dashboard/src/apps.rs | 7 +- dashboard/src/host.rs | 2 + dashboard/web/api.contract.ts | 5 +- dashboard/web/components/VMConsole.tsx | 20 +- dashboard/web/pages/VMs.tsx | 58 +++-- dashboard/web/types/vms.ts | 16 +- nixos/configuration.nix | 2 +- nixos/mac-studio-sandbox.nix | 2 +- nixos/mac-vm.nix | 17 ++ nixos/snowglobe.nix | 4 +- tools/code-vm | 22 ++ tools/dashboard-host.py | 14 +- tools/mac-agent-gui.swift | 164 ++++++++++++++ tools/mac-agent-vm.md | 215 ++++++++++++++++++ tools/mac-agent-vm.py | 292 +++++++++++++++++++++++++ tools/mac-vm-bridge.py | 103 +++++++++ tools/mac-vm-test.py | 127 +++++++++++ tools/mac-vms.py | 119 ++++++++++ tools/release.py | 2 +- tools/vm-screen.py | 29 +-- tools/vms.py | 20 +- 22 files changed, 1180 insertions(+), 63 deletions(-) create mode 100644 nixos/mac-vm.nix create mode 100755 tools/code-vm create mode 100644 tools/mac-agent-gui.swift create mode 100644 tools/mac-agent-vm.md create mode 100644 tools/mac-agent-vm.py create mode 100644 tools/mac-vm-bridge.py create mode 100644 tools/mac-vm-test.py create mode 100644 tools/mac-vms.py diff --git a/config/mac-studio-sandbox.json b/config/mac-studio-sandbox.json index 2c6f6328055dfcd772d866d91f8360ed92453ddc..5c369e99f3ceeed7cc38bac3cddcebe155dd0a8d 100644 --- a/config/mac-studio-sandbox.json +++ b/config/mac-studio-sandbox.json @@ -1,4 +1,5 @@ { "dataset": "globe/clover/mac-studio-sandbox", - "mountPoint": "/srv/mac-studio-vm/sandbox" + "mountPoint": "/srv/mac-studio-vm/sandbox", + "clientAddress": "10.0.0.222" } diff --git a/dashboard/src/apps.rs b/dashboard/src/apps.rs index a9d0fa10154a357f3abfb8b6f31e536262674f31..2ba9e755d8234f9dad4b0e833d763d159df6bd07 100644 --- a/dashboard/src/apps.rs +++ b/dashboard/src/apps.rs @@ -299,7 +299,7 @@ pub async fn route( } let allocated: f64 = array(&values[1]) .iter() - .filter(|vm| !["shutoff", "crashed"].contains(&string(&vm["state"]))) + .filter(|vm| vm["host"] == values[0]["name"] && !["shutoff", "crashed"].contains(&string(&vm["state"]))) .map(|vm| number(&vm["balloon"])) .sum(); values[0]["availableMemory"] = @@ -361,6 +361,9 @@ pub async fn route( ["vms", name, tail @ ..] => { vm_name(name)?; match tail { + ["clipboard"] if method == Method::POST => { + vm_call("clipboard", Some(json!({"name":name,"text":body["text"]}))).await?; + } ["access"] if method == Method::GET => { let mut response = Document::new(vm_call("access", Some(json!({"name":name}))).await?) @@ -410,7 +413,7 @@ pub async fn route( } [action] if method == Method::POST - && ["start", "shutdown", "reboot", "destroy", "resume"] + && ["start", "shutdown", "reboot", "destroy", "resume", "suspend"] .contains(action) => { vm_call("act", Some(json!({"name":name,"action":action}))).await?; diff --git a/dashboard/src/host.rs b/dashboard/src/host.rs index 614bba347bdba754ca7729abaa75488d6b41f95c..15b310924166ff3a833d46112e15b9994405f082 100644 --- a/dashboard/src/host.rs +++ b/dashboard/src/host.rs @@ -34,6 +34,8 @@ pub async fn open(request: Value) -> Result<(Value, tokio::net::UnixStream)> { Some("vm.create" | "vm.media" | "vm.preset") ) { 910 + } else if request["operation"] == "vm.act" { + 240 } else if request["operation"] == "copyparty.manage" { 310 } else { diff --git a/dashboard/web/api.contract.ts b/dashboard/web/api.contract.ts index 03aa202ec49da1cdc42c30649378f20c3f9ac16c..8b727100e352371b30ff33a2ff518e8b9eb007a2 100644 --- a/dashboard/web/api.contract.ts +++ b/dashboard/web/api.contract.ts @@ -320,6 +320,9 @@ export type Api = Hono<{}, { "/vms/:name/media": { $put: Endpoint; }; + "/vms/:name/clipboard": { + $post: Endpoint; + }; "/vms/:name/access": { $get: Endpoint<{ username: string; password: string; hostname: string } | null, { param: { name: string } }>; }; @@ -327,7 +330,7 @@ export type Api = Hono<{}, { $post: Endpoint; }; "/vms/:name/:action": { - $post: Endpoint; + $post: Endpoint; }; "/account": { $get: Endpoint; diff --git a/dashboard/web/components/VMConsole.tsx b/dashboard/web/components/VMConsole.tsx index 1263edcf49ce81a097475716d40eb62406248690..3079ba17f2736bf29b8adba802689595a648bb7a 100644 --- a/dashboard/web/components/VMConsole.tsx +++ b/dashboard/web/components/VMConsole.tsx @@ -9,6 +9,7 @@ import Check from "lucide-solid/icons/check"; import RemoteKeyboard from "@novnc/keyboard"; import { VM_SETUP, type Domain } from "../types/vms.ts"; import { StatusLabel } from "./Status.tsx"; +import { toast } from "./Toast.tsx"; type WindowSurface = { id: number; x: number; y: number; width: number; height: number; atlas_x: number; atlas_y: number; @@ -16,7 +17,7 @@ type WindowSurface = { }; type WindowFrame = { windows: WindowSurface[]; rtpTimestamp: number }; -export function VMConsole(props: { name: string; enabled: boolean; active: boolean; setup?: Domain["setup"]; toolbar: JSX.Element; content: (toolbar: HTMLDivElement) => JSX.Element }) { +export function VMConsole(props: { name: string; platform: Domain["platform"]; enabled: boolean; active: boolean; setup?: Domain["setup"]; unavailable?: string; clipboard?: (text: string) => Promise; toolbar: JSX.Element; content: (toolbar: HTMLDivElement) => JSX.Element }) { const enabled = createMemo(() => props.enabled); const preparing = () => !!props.setup && props.setup !== "ready"; let reconnectTimer: number | undefined; @@ -72,6 +73,7 @@ export function VMConsole(props: { name: string; enabled: boolean; active: boole const connected = () => state() === "Connected"; const [problem, setProblem] = createSignal(""); const [clipboard, setClipboard] = createSignal(""); + const [sendingClipboard, setSendingClipboard] = createSignal(false); const [showClipboard, setShowClipboard] = createSignal(false); const [windowsAvailable, setWindowsAvailable] = createSignal(false); const [separateWindows, setSeparateWindows] = createSignal(false); @@ -389,7 +391,7 @@ export function VMConsole(props: { name: string; enabled: boolean; active: boole {props.toolbar} - + @@ -404,7 +406,7 @@ export function VMConsole(props: { name: string; enabled: boolean; active: boole Ctrl+Alt+Esc releases keyboard - {preparing() ? "" : props.enabled ? state() : "Off"} + {preparing() ? "" : props.enabled ? state() : props.unavailable ? "Unavailable" : "Off"} @@ -418,9 +420,15 @@ export function VMConsole(props: { name: string; enabled: boolean; active: boole