pastilhasandClaude Opus 5 41020b1b65 build the wine prefix after the display exists, not before
A cold install could never work. `winetricks -q vb6run` runs Microsoft's
redistributable, and that installer creates a window even when told to be
quiet — so with no DISPLAY wine cannot load a graphics driver, the installer
dies, and winetricks reports `returned status 43`. That message names neither
wine nor a display, and reads like a corrupt download.

ensurePrefix ran before Xvfb started, because building a prefix looks like
preparation rather than something that needs a screen.

It never showed up in testing here: this machine's prefix was seeded from the
pre-extraction one, so the build path only ever ran against a prefix that was
already complete. The first genuine cold install — alpha — failed on the first
Start. Diagnosed from `err:winediag:nodrv_CreateWindow` in the wine output,
which is the only line that says what is actually wrong.

Order is now display, prefix, game. ensurePrefix takes the display explicitly
rather than reading the ambient environment, so it cannot silently run without
one again, and a failed build now tears the display down instead of leaving an
Xvfb behind.

Verified by moving this machine's prefix aside and starting cold: prefix built
from nothing, msvbvm60.dll installed, session up with the window at 152x214,
Z: confined, socket mode 700, and RFB 003.008 through the platform relay.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043
2026-08-23 20:21:32 +00:00

Minesweeper

Minesweeper X, running under wine on a headless X display, streamed into an Officer panel.

It is a game. It is also the smallest honest proof that Officer can put an arbitrary X11 program in a panel — a framebuffer, a process on it, a VNC server reading it, a client in the browser — and it is the first plugin to use the platform's per-plugin websocket relay.

What it needs

Six host binaries, declared in manifest.ts and checked before install: wine, Xvfb, x11vnc, xdotool, xdpyinfo, winetricks.

The awkward one is wine. Minesweeper X is a 32-bit PE (machine 0x014c, Visual Basic 6), so the host needs i386 multiarch and a win32 prefix. A 64-bit-only wine cannot load it, and the failure is a bare Bad EXE format. On Debian or Ubuntu:

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install wine wine32:i386 xvfb x11vnc x11-utils xdotool winetricks

The game

Minesweeper X — the competition build, with timing and replay extras. game/Minesweeper X.exe is committed; it is 68 KB and it is the thing being run rather than state produced by running it.

zip sha256 21089193924919ef876a5b464f06bed9cc149867c51e40c259288ebe623014f0
exe sha256 e414c207adaa14999b0464c3d0a701f20ed11282d5ed0f84b27b62d25389f661

The download needs a browser User-Agent; the site answers 403 to curl's default.

Where its state lives

DATA_PATH/minesweeper/ — never in this directory, which plugins:update will git pull over.

  • prefix/ — the wine prefix, ~600 MB, built on first POST /start. Deleting it is the standard fix for a wedged wine, and it is safe: the next start rebuilds it.
  • run/ — pid state, logs, and vnc.sock. Mode 0700, and that is load-bearing.

Two things worth knowing before you change anything

x11vnc has no password, and that is correct. It binds a unix socket inside run/, not a port. The kernel refuses every other account before x11vnc is asked anything, so a password would be a second lock on a door only one person can reach. The version this replaced bound 127.0.0.1:5907 with -nopw, which is a different claim entirely — every local account could open it and take the display.

The wine prefix is confined to C: on every start. A fresh prefix maps the whole filesystem to Z: and symlinks the profile into the real home, and Minesweeper X has Open and Save dialogs for its replays. That is why this was an ungrantable execution capability in the platform. sidecar/prefix.ts closes it instead, which is what makes the plugin's permission safe to grant. Wine restores z: whenever it updates a prefix, so the confinement is re-asserted rather than done once.

Contract

GET  /api/minesweeper/status     { installed, running, window, error? }
POST /api/minesweeper/start      idempotent; builds the prefix on a cold install (minutes)
POST /api/minesweeper/stop
     /api/plugin-ws/minesweeper  the display, as RFB
S
Description
Minesweeper X under wine on a headless display, streamed into an Officer panel
Readme
449 KiB
Languages
TypeScript 100%