Repository navigation
v8.0.0
What's Changed
GhostDesk is rewritten in Rust on NestRS, and it is no longer a Linux-only product: the same binary now drives a macOS desktop. That is what the rewrite bought. Every version through v7.5.0 spoke Wayland and nothing else, with the compositor's assumptions spread across the codebase; the port put the operating system behind five traits, and a second implementation of those five is what macOS support is — not a compatibility layer bolted on beside the first.
The rest follows from the same move. The framework underneath is a real dependency-injection container rather than a set of decorators, so composition is explicit and the whole graph is verified before a port opens instead of failing on the first tool call. Observability stops being a bespoke subsystem and becomes structured tracing: four lines joined by a trace_id say what the desktop did, which tool was addressed, what the endpoint served and what it cost. And there is no interpreter left in the image — one root-owned binary, no site-packages, no virtual environment, no committed protocol bindings.
The fourteen tools keep their names, their parameters and their result shapes, so a client that calls tools needs no reconfiguration — but the endpoint is authenticated by default, the two MCP resources are gone, and every environment variable is renamed.
Changed
-
The server is a single binary.
apps/ghostdeskwires modules and owns no logic;crates/featuresholds one folder per domain (screen, input, programs, clipboard, auth, idle) — amodule.rsthat registers it, aservice.rs, or aservices/directory when there is more than one — plus one#[mcp]host per domain under<domain>/mcp/, and nothing but the*Moduletypes is public;crates/platformis the OS substrate — Wayland, Sway IPC,grimand.desktopon Linux, Quartz, Accessibility and the pasteboard on macOS, plus the coordinate space both share — and carries no framework types. The whole dependency graph is verified at boot — a missing provider fails the boot naming it, rather than surfacing on the first tool call. -
The OS boundary is five traits.
InputBackend,ScreenBackend,WindowManager,ClipboardandAppCatalogare the only doors between the feature layer and the desktop. Each OS is a directory undercrates/platform/src/whose modules mirror those five contracts by name, andplatform::hostis the single point where one is chosen. Window identity is opaque per backend — Sway'scon_idis an implementation detail, not the contract — and no compositor JSON ever crosses into the feature crate. Adding an OS is a new sibling directory plus one arm per selector; nothing infeaturesor the MCP hosts names an operating system — and the macOS backend, below, is that claim tested rather than asserted. -
The Wayland stack loses 6 400 lines.
pywaylandneeded committed CFFI bindings forwl_*,zwlr_virtual_pointer_v1andzwp_virtual_keyboard_v1— 6 400 lines of generated Python under version control.wayland-clientgenerates them at build time from the protocol XML, so there are none. The connection now lives on one dedicated thread that owns the event queue and consumes commands off a channel; that single consumer is the serialisation the protocol needs, replacing the explicit lock every call site had to remember to take. -
The keyboard grammar is published from one table, and both directions are checked.
platform::chordholds the modifier and key names the tool description promises on any desktop. A test in each backend proves it serves everything the table publishes, andnormalizerefuses a name the table does not carry before either backend's map is consulted. Previously only half of that existed, and a name likeoptionresolved on one desktop while failing on the other under a single published description. -
Every environment variable is renamed, and there is now only one name for each. The deployment sets
NESTRS_ENV_PREFIX=GHOSTDESK— both images bake it, theJustfileexports it, and the entrypoint refuses to start without it — so the framework readsGHOSTDESK_HTTP__PORTwhere a stock NestRS app would readNESTRS_HTTP__PORT. The entrypoint'sGHOSTDESK_* → NESTRS_*translation layer is gone with it: what you set is what the server reads. Settings are#[config]structs validated at boot, one per feature module rather than one catch-all —screen,idleandauthalongside the framework's ownhttp,mcpandhealth. Read a name asGHOSTDESK_<NAMESPACE>__<KEY>; a single underscore (GHOSTDESK_VNC_PASSWORD) marks a container knob the entrypoint consumes itself.Was Is GHOSTDESK_PORTGHOSTDESK_HTTP__PORTGHOSTDESK_HOSTGHOSTDESK_HTTP__HOSTGHOSTDESK_ALLOWED_ORIGINSGHOSTDESK_HTTP__CORS_ORIGINSGHOSTDESK_ALLOWED_HOSTSGHOSTDESK_MCP__ALLOWED_HOSTSGHOSTDESK_SCREEN_WIDTH/_HEIGHTGHOSTDESK_SCREEN__WIDTH/__HEIGHTGHOSTDESK_IDLE_TIMEOUTGHOSTDESK_IDLE__TIMEOUT_SECSGHOSTDESK_AUTH_TOKENGHOSTDESK_AUTH__TOKENGHOSTDESK_VNC_PASSWORD,GHOSTDESK_USERandGHOSTDESK_DIRkeep their names — the entrypoint reads them, not the server.GHOSTDESK_TLS_CERT/_KEYkeep theirs too, and now name the paths the entrypoint hands the server asGHOSTDESK_HTTP__TLS_CERT_FILE/_KEY_FILE; the framework terminates TLS, so those two are what a binary started outside the container sets. -
The environment contract is committed.
.env.exampledocuments every variable the server reads with its default and the reason it exists;.env.developmentcarries the dev posture.GHOSTDESK_ENVpicks the cascade and, likeNESTRS_ENV_PREFIX, has to be on the process — both select which files load, so neither can come from one. -
A malformed setting now fails the boot naming the variable, instead of quietly falling back to a default.
GHOSTDESK_IDLE__TIMEOUT_SECS=18OOused to be indistinguishable from deliberately choosing 1800. -
mouse_scrollrefuses an out-of-band notch count instead of clamping it silently. The tool advertised 1–5 and quietly clamped anything above it, so a model asking for 20 got 5 and was never told.amountis validated at the edge and an out-of-band value comes back asinvalid_paramsnaming the field — the one MCP error a model can correct itself from. -
app_launchwaits for the window and hands back the settled screen. It polls for the first window the launched PID owns (up to 10 s), reports how long that took, and attaches the settled capture to the result — so the common launch-then-screenshot pair is one call. When the process exits without a window, or none appears in time, the result says which of the two happened and what to do about it.wait_for_window: falserestores the old fire-and-forget behaviour for apps with no UI. -
screen_changedis measured in pixels, not in the box around them. The previous test took the bounding rectangle of every differing pixel, so a cursor blink in one corner and a tooltip in the other reported a full-screen change. Frames are decoded once and diffed row at a time, which is also what makes the comparison cheap enough to run on every input. -
The idle watchdog is a
#[scheduled]method on a regular provider, ticking every 5 s and comparing one atomic. The previous hand-rolledasynciotask derived its poll interval from the timeout (timeout/10, clamped); a fixed cadence costs nothing and fires within seconds of the deadline whatever it is set to. -
app_statusno longer reports a dead app as running, and no longer panics on a PID the kernel will not take. Launched children are reaped in the background, so a crashed process disappears from the liveness check instead of lingering as a zombie that still answers it, and only PIDs this session launched are accepted — the registry that remembers them is what keeps the tool from reading a log path built out of an arbitrary number. -
The container healthcheck asks whether the desk answers, not whether the wrappers are up.
supervisorctl statusreports RUNNING for a program that is merely waiting on a socket, so on its own it certified containers whose desktop was not there yet. The check now asks supervisord for the siblings only it can see (wayvnc, websockify — a desk no human can watch is broken even while every tool answers), then/health/liveand/health/readyfor what only the server knows. Service start-up ordering collapses into onewait-for-waylandgate for the programs that exit rather than wait; GhostDesk deliberately does not come through it, because its boot hook retries the Wayland connect itself and that retry is the real bind.
Security
- The endpoint is closed by default, and the bearer check covers every route. Authentication is a NestRS
authnstrategy behind the framework'sAuthnGuard, mounted at the composition root rather than on the MCP edge — so the open dev posture is something GhostDesk declares out loud rather than something it can fall into by forgetting a middleware, and a route added later is closed the day it is added. Bearer comparison is constant-time. - The TLS-without-a-token check runs on every start path. It is a boot-time lifecycle hook, and init hooks are strict: the first error aborts before any port opens, so there is no window where an HTTPS endpoint serves unauthenticated. The container entrypoint keeps its own check.
- A token given is a token required, certificate or not. The entrypoint used to discard
GHOSTDESK_AUTH__TOKENwhen no certificate was mounted, on the argument that a static secret over cleartext is theatre — while the server armed the gate for any token it was handed. One set of variables had two behaviours, and an operator who set a token got a closed desk from the binary and an open one from the image. The script now passes the token through and keeps the warning that the credential crosses in cleartext. The VNC password is still dropped without a certificate, and that asymmetry is deliberate: wayvnc's RFB security type 2 is a DES challenge that means something only inside thewss://envelope. - DNS-rebinding defence is now a
Hostallow-list (GHOSTDESK_MCP__ALLOWED_HOSTS, default loopback only) enforced by the MCP transport, in addition to theOrigin/CORS policy (GHOSTDESK_HTTP__CORS_ORIGINS) which now covers every route rather than/mcpalone. A deployment reached under a real hostname must name itself or it will answer 403. - Launched apps are scrubbed of the entire
GHOSTDESK_*namespace, not just the two names the Python port listed. It carries the bearer token and TLS paths, and a browser the agent spawns has no business with any of it. One prefix rather than a list of names means a setting added later cannot be forgotten here. - Image hardening collapses to one line. The Python build byte-compiled the venv, stripped every source file and
chmod-ed a tree of thousands, because an interpreter loads whatever code is on disk. The binary is one root-owned0555file: nosite-packagesfor a dependency-confusion attack to land in, and no interpreter onPATHto re-enter the product through. Release builds run--locked, so a tagged image cannot resolve a different dependency than the reviewed one. - The runtime image drops
libwayland-client0— the protocol is spoken from pure Rust — and no longer ships a language runtime for GhostDesk.python3remains only becausewebsockifyis a Python program. unsafe_codeis denied workspace-wide and lifted one file at a time withexpectrather thanallow, so the exemption leaves with the lastunsafeit covered instead of outliving it in silence.
Removed
- The two MCP resources,
ghostdesk://appsandghostdesk://clipboard. They duplicatedapp_listandclipboard_getunder a second addressing scheme and no client read them. This is the one client-visible break in the tool surface: a caller that subscribed to either reads the corresponding tool instead, which returns the same data. - The session-accounting subsystem — roughly 1 500 lines of hand-rolled per-session bookkeeping, replaced by plain
tracing. Four lines now make one record, joined bytrace_id: what the desktop did, which tool was addressed, what the endpoint served, and what the request cost. Every act on the desk is logged atinfoby the service that performs it, spelled in fields, with typed and copied text counted rather than quoted — and the record is filed the moment the act lands, never once its effect has been judged, so a capture that fails to decode cannot erase the fact that the desktop was touched. - MCP logging notifications (
notifications/message), which the Python port used to push a warning when an input produced no visible change. Logging is deprecated by SEP-2577 and slated for removal. The signal the model actually reads —screen_changed: falsein every input tool's result — is unchanged, and the server-sidewarnis still emitted. - The argument-coercion middleware. It repaired
x="383, 22"intox=383, y=22, a shape a JSON-Schema-typed integer parameter cannot take: the model now gets a validation error naming the field and corrects itself. - Python,
uv, and the.venv.pyproject.toml,uv.lock,src/ghostdesk/andtests/are gone, along with theuv syncstep in the entrypoint and thepython3-dev/libwayland-devbuild dependencies. No Python remains in the workspace.
Added
- GhostDesk runs on macOS. Five backends answer the same five contracts the Wayland ones do: Quartz Event Services for the pointer and keyboard, the Accessibility API for windows,
screencapturefor frames, the pasteboard for the clipboard, and.appbundles for the catalogue. The tool surface is identical — an agent callsmouse_clickandapp_launchwithout knowing which desktop it is on — and the difference the model must see is published rather than assumed:conventions()states the desktop and its primary modifier, so the instructions saycmd+con macOS andctrl+con Linux, built from the same constant the key table presses. Two permissions must be granted by hand, per binary, in System Settings — Accessibility for input and windows, Screen Recording for capture. Neither can be requested from code, so a backend without one fails naming the setting to open instead of appearing to work. The container image remains Linux; macOS is for running the binary directly. - The current MCP revision, and every one a client might still ask for. The endpoint answers
2025-11-25by default and negotiates2024-11-05,2025-03-26,2025-06-18,2025-11-25and the2026-07-28draft on request, falling back to the current revision for anything it does not know. The SDK isrmcp3.1. - Liveness, readiness and startup probes at
/health/{live,ready,startup}. They answer about the desktop rather than about the process:readygoes down when the compositor stops answering the window seam,livewhen the connection behind the virtual pointer and keyboard is gone — a state in which every tool still replies and none of them does anything. Two indicators back them — a compositor roundtrip and a window-tree query — each bounded in milliseconds (GHOSTDESK_HEALTH__INDICATOR_TIMEOUT_MS,GHOSTDESK_HEALTH__PROBE_DEADLINE_MS) so a stalled seam reads as a nameddowninstead of a client-side timeout that says nothing about which seam went away. - Every structured tool publishes an
outputSchema. The eleven tools that answer with data (mouse_*,key_*,app_*) derive the schema a client validates against from the same type that produced the result. The three that answer with an image or plain text (screen_shot,clipboard_get,clipboard_set) carry none, correctly. The Python port advertised no output schemas at all. - A refusal the model can act on, or nothing at all. A domain error declares whose mistake it is; the MCP adapter turns that into either a message the model reads verbatim and can correct itself from, or the framework's opaque answer. The decision is made once at the crate root rather than per adapter, because a copy that forgets the refusal branch still compiles, still answers, and leaks.
- A Rust devcontainer with the pinned toolchain,
moldfor fast incremental links,rust-analyzerwired toclippy, and apostCreateCommandthat installsnest-rs-cliat the exact version the workspace depends on and builds the binary once, so a fresh clone opens on a warmtarget/.rust-toolchain.tomlcarriesllvm-tools, sojust covworks without a per-machinerustup component add.
What's Changed
Full Changelog: v7.5.0...v8.0.0