Skip to content

Latest commit

 

History

History

desktop

README.md

Agentic Desktop Layer

Let authorized agents (Claude Code, OpenCode, Codex) operate your real desktop with mouse and keyboard, behind a switch you control. Your desktop. Your agents. Your switch.

Spec: docs/agentic-desktop-layer-prd.md (PRD v0.2) · Page: https://w3bs.org/desktop · License: Apache-2.0

Status

Milestone State
M0: PRD, schemas, ADR, public page Done
M1: broker, input engine, mock adapter, native control, enable/disable, leases, cancellation, identity tests Done (terminal native control control; StatusNotifierItem tray tray with an emergency-stop shortcut, verified on KDE Plasma; GNOME Shell top-bar indicator from the W3BS Shell extension, verified on GNOME Shell 50.5)
M2: KDE Plasma + GNOME real input KDE Plasma 6.7.5 (KWin Wayland, Fedora 44): real typing (incl. non-ASCII), pointer, clicks, portal screenshot, disable mid-typing and portal revocation pass on a headless test rig (tests/rig/kde-portal.sh, 33/33). Window list, geometry, focus, stacking (occlusion) and activation on Plasma come from KWin scripts (kwin.rs), so targeted typing/clicks and restricted per-app grants work there. Interlocks on the rig: a window carrying the polkit-kde agent's app id (the KWin observer's key) refuses input while it is up and the broker stays enabled; locking through KWin's own screen locker (org.freedesktop.ScreenSaver.Lock) disables the broker from the locker's ActiveChanged(true) signal, with no logind. The real polkit-kde agent cannot take requests in the container (no logind session, and the rig runs as root, whom polkit never asks), and the lock cannot be undone there (no password), so that check runs last. With TRAY=1 the same rig makes the tray the only native control (kded6 as the StatusNotifierWatcher) and passes 27 more checks (60/60 with the interlock stage): item registration and Disabled/Enabled title, enable from the dbusmenu menu (also while the shortcut dialog is open), an approval shown with Approve/Deny and approved from the menu, left click disables but never enables, Quit and disable, and SIGKILL of the tray disabling the broker; Open control panel… mints a one-time control-app link that signs in once (agent bearer refused) and disables access, the Agents submenu lists the agents and revokes one, Recent activity shows it; the emergency stop is bound through the GlobalShortcuts portal as Super+Alt+Escape (Plasma's confirmation dialog answered in-session) and fires from a real key chord through KWin. The tray names itself org.w3bs.Desktop to the portal and installs a hidden desktop entry for it, since GlobalShortcuts refuses host apps without an app id. The tray on GNOME (AppIndicator extension) is untested. GNOME Shell 50.5 (Mutter Wayland, xdg-desktop-portal-gnome 50.0, Fedora 44): pointer, clicks, typing checked against the live keymap (Mutter silently drops a keysym the active layout has no key for, so text containing one is refused whole with unsupported, naming the characters, before anything is typed; on us é ü ß are refused and € arrives through AltGr, on de ä ö ü ß € arrive exactly and é is refused), portal screenshot (and a fast refusal without a grant), disable mid-typing, restore-token re-enable, top-bar Stop and portal-backend restart pass on a headless rig (tests/rig/gnome-portal.sh); the consent dialog is answered in-session by the rig (GNOME has no headless pre-authorization). The W3BS GNOME Shell extension (gnome-extension/, installed with w3bs desktop setup gnome-extension, GNOME Shell 46-50) adds window data and a top-bar native control; on the same rig (78/78 with it): --adapter auto picks portal+gnome, windows list matches Mutter's frame rects with exactly one focused window, typing to the focused window works and to an unfocused one is refused target_stale, a click on a covered part is refused, the Activities overview blocks input (shell-modal interlock), a restricted agent is confined to its app, window data is refused to any D-Bus caller but the connected broker; the indicator shows state as icon plus text, enables from its menu, shows an approval with Approve/Deny and approves it, Disable and Quit and disable work, and disabling the extension while enabled disables the broker; Open control panel… mints a control-app link over the panel's connection, the Agents and Recent activity submenus list the agents and the approval, and the control app (signed in from control --open in a terminal) disables access, while control --open without a terminal is refused. A RemoteDesktop session stopped through the portal backend (an impl Session.Close, which xdg-desktop-portal-gnome never reports to the client) is caught from the extension's list of Mutter remote-access sessions and disables the broker; later input exits 4. Interlocks on the rig: GNOME Shell's own polkit authentication dialog (opened through its polkit agent component, since that agent cannot register with polkitd without logind) refuses input while it is up; switching the shell into its lock-screen session mode (what the lock screen does; extensions are unloaded) disables the broker, and so does org.gnome.ScreenSaver.ActiveChanged(true). Not exercisable in the container: the real lock screen (GNOME Shell 50 builds it only when logind is present) and a polkit request from pkexec. Known GNOME gaps: characters with no key on the active layout cannot be typed (they are refused, never dropped), notification banners are not counted as occluders, and a newly installed extension loads only at the next login. Not certified
Vela Observation, focus, occlusion and lock/polkit interlocks (clean-room); input needs VELA_DEBUG_INPUT=1 + the wlroots virtual-input backend (pending)
macOS --adapter native (adl-macos): Core Graphics events from a private, tagged event source; CGWindowList windows, focus and stacking; Accessibility focus and inspect; CGDisplayCreateImage captures (screencapture fallback); polled lock/console/sleep state; HID-idle takeover detection; menu-bar native control (tray) with a Carbon emergency-stop hot key (Control+Option+Command+Escape). On GitHub's macos-latest runner (macOS 26.6.2, arm64, 1024x768, Accessibility + PostEvent + Screen Recording pre-granted to /bin/bash by the image, which our broker inherits when started from the job shell) tests/rig/macos-e2e.sh passes 23/23: doctor reports the three permissions; windows list matches AppKit frames with exactly one focused window; typing héllo € 😀 lands exactly; typing into an unfocused window is refused target_stale; Backspace and primary+a (Command+A) work; pointer move reads back exactly; a click focuses another window; a double click arrives with clickCount 2; capture is the display's pixel size; inspect returns the AXTextField with its value; disable mid-typing stops it and later input exits 4; the menu-bar item says Agents: Disabled, lists Open control panel…, enables and disables from its menu and its title follows; the hot key (a posted CGEvent chord) disables. Not exercised there: permission-denied paths (the runner grants everything), HiDPI/multi-display/rotated layouts, lock screen, secure-input and authentication-prompt interlocks, sleep detection, physical takeover (no human), permission revocation while enabled. Not certified
Windows Native adapter (adl-windows: SendInput, EnumWindows/DWM, WindowFromPoint occlusion, GDI capture, UI Automation, WTS/power/display events, Win+Alt+Esc emergency hotkey), named-pipe transport and a notification-area tray. On GitHub's windows-latest runner (Windows Server, 1024x768 at 96 dpi, broker elevated like everything on the runner) tests/windows/e2e-native.ps1 drives the release binary against two WinForms windows: window list with HWND ids, DWM rects and one focused window; typing incl. héllo € 😀 lands exactly in the target TextBox; typing into an unfocused window and clicking a covered part of a window are refused target_stale; pointer moves land on the exact physical pixel (corners included); a click moves focus; scroll; per-monitor PNG at the monitor's pixel size with real content; UI Automation returns the edit control with its value; disable mid-type stops typing part-way and later input exits 4; the injected Win+Alt+Esc chord disables (audited as emergency stop); the tray adds its icon, opens its menu (status in words, Enable, Stop all, Quit and disable), enables from the menu, Open control panel… mints a control-app link with which Disable works, left click disables but never enables, Explorer exiting disables and its restart re-adds the icon (TaskbarCreated), Quit and disable. The mock-adapter end-to-end and the named-pipe tests (concurrent read/write on one connection, first-instance ownership, parallel clients, peer SID) run there too. Not exercised on the runner: mixed-DPI and multi-monitor layouts with negative origins (code paths only; the runner has one 96 dpi monitor), lock/UAC/secure-desktop interlocks, suspend and logoff events, UIPI refusal of elevated windows (the runner broker is itself elevated), and physical-mouse takeover (all synthetic input carries the injected flag the adapter keys on). Not certified
Other Linux desktops Not started

No platform is certified. Release binaries and installers are not code-signed.

Install

Every installer is per-user (no root or administrator), checks the release archive against the release's SHA256SUMS, starts the broker Disabled and never enables access; you enable it from the native control.

Linux (x86_64, aarch64; glibc 2.28+ or musl):

curl --proto '=https' --proto-redir '=https' -fsSL https://w3bs.org/desktop/install.sh | sh

Installs ~/.local/bin/w3bs-desktop, a systemd user service for the broker, and the tray (KDE and others) or the GNOME Shell extension (GNOME) in your session.

Alpine / postmarketOS (musl; x86_64, aarch64), same command. The installer detects musl and installs the static *-unknown-linux-musl build (override with W3BS_LIBC=gnu|musl). Without a systemd user manager (OpenRC) the broker starts with your graphical session from ~/.config/autostart/w3bs-desktop-broker.desktop, still Disabled. The Linux backend talks to your session's portal and PipeWire; the installer installs no system packages and instead prints the apk add line for whichever of these are missing:

doas apk add xdg-desktop-portal xdg-desktop-portal-kde pipewire wireplumber dbus    # Plasma
doas apk add xdg-desktop-portal xdg-desktop-portal-gnome pipewire wireplumber dbus  # GNOME

macOS 11+ (Apple silicon and Intel), same command. It installs ~/.local/bin/w3bs-desktop and two LaunchAgents in your login session, and starts both:

  • ~/Library/LaunchAgents/org.w3bs.desktop.broker.plist: w3bs-desktop daemon --adapter auto, at login, restarted by launchd if it crashes (not after a clean exit). Log: ~/Library/Logs/w3bs-desktop/broker.log.
  • ~/Library/LaunchAgents/org.w3bs.desktop.menubar.plist: the menu-bar control (w3bs desktop tray), at login only; Quit keeps it quit (and disables access).

Then grant the permissions below to ~/.local/bin/w3bs-desktop (see macOS onboarding). Uninstall with curl -fsSL https://w3bs.org/desktop/install.sh | sh -s -- --uninstall (keeps ~/.config/w3bs/desktop, your agents and settings).

Windows 10/11 (x86_64; ARM64 under emulation), in PowerShell 5.1 or 7:

irm https://w3bs.org/desktop/install.ps1 | iex

Installs to %LOCALAPPDATA%\Programs\w3bs-desktop (bin\w3bs-desktop.exe, the console CLI, and bin\w3bs-desktopw.exe, the same program built for the GUI subsystem), adds bin to your user PATH, and registers the broker and the notification-area tray to start at sign-in (HKCU Run entries W3BS Desktop Broker and W3BS Desktop Tray, both running w3bs-desktopw.exe, so no console window opens), then starts both. Their output goes to %LOCALAPPDATA%\w3bs\desktop\state\logs\{daemon,tray}.log. Emergency stop: Win+Alt+Esc. Options go through a script block:

& ([scriptblock]::Create((irm https://w3bs.org/desktop/install.ps1))) -Version 0.2.0 -NoService
& ([scriptblock]::Create((irm https://w3bs.org/desktop/install.ps1))) -Uninstall   # add -Purge to delete agents and settings

Then, on any system:

w3bs desktop agents add claude-code --preset broad
w3bs desktop setup claude-code --agent claude-code   # prints the `claude mcp add` line

OpenCode: register an agent for it and merge the printed mcp block into ~/.config/opencode/opencode.json (or a project opencode.json). Add --http to point it at the broker's MCP endpoint instead of spawning a stdio server; the bearer token is read from the token file with OpenCode's {file:...} substitution, so it never lands in the config.

w3bs desktop agents add opencode --preset broad
w3bs desktop setup opencode --agent opencode          # {"mcp": {"w3bs-desktop": {"type": "local", ...}}}
w3bs desktop setup opencode --agent opencode --http   # {"mcp": {"w3bs-desktop": {"type": "remote", ...}}}

Tools appear in OpenCode as w3bs-desktop_desktop_*. Screenshots come back as image content, so the model must take image input: for a custom provider, declare it on the model or OpenCode drops the image and tells the model it cannot see it:

"models": { "<model>": { "tool_call": true, "modalities": { "input": ["text", "image"], "output": ["text"] } } }

Testing hooks (all installers): W3BS_DESKTOP_VERSION, W3BS_DESKTOP_NO_SERVICE=1, and W3BS_DESKTOP_ARCHIVE (a local archive) with W3BS_DESKTOP_SHA256 (its checksum, required). The installer-macos and installer-windows CI jobs install a freshly packaged build this way on GitHub's runners and check the result, then uninstall (tests/installer/).

Layout

crates/adl-schema    versioned schemas: states, errors, coordinate spaces, actions, results
crates/adl-broker    authorization + task broker, input engine, leases, approvals, audit, mock adapter
crates/adl-macos     macOS adapter: CGEvent input, CGWindowList, Accessibility, capture, session polling, TCC checks, hot key
crates/adl-windows   Windows adapter: SendInput, UI Automation, GDI capture, DWM windows, session events, hotkey
crates/adl-linux     Vela command-socket adapter, XDG portal adapter (KDE/GNOME), KWin and GNOME Shell window observers, logind, keymaps
crates/w3bs-desktop  `w3bs desktop` CLI, broker daemon, terminal and tray native controls, MCP (stdio, HTTP), control app (assets/control)
gnome-extension/     GNOME Shell extension: top-bar native control + window data (org.w3bs.Desktop.Shell)
packaging/           install.sh (Linux, macOS), install.ps1 (Windows), package.sh (release archives), systemd user unit
docs/                ADRs and the clean-room record

Try it (mock desktop)

cargo build --release -p w3bs-desktop
B=target/release/w3bs-desktop
$B daemon --adapter mock &               # starts Disabled
$B agents add claude-code --preset broad # saves a 0600 token
$B control                               # native control; type `enable`
                                         # (or `$B tray`: StatusNotifierItem + Super+Alt+Escape stop)
# in another terminal:
$B mouse click --agent claude-code --window w-editor --x 40 --y 40
$B setup claude-code --agent claude-code # prints `claude mcp add ...`

On a real session use --adapter auto (Vela if present, else portals, plus the KWin window observer on Plasma or the W3BS Shell extension on GNOME). It refuses to fall back to the mock.

On GNOME, install the extension once, then log out and back in (GNOME Shell loads new extensions only at startup); its top-bar indicator is then the native control:

$B setup gnome-extension   # writes ~/.local/share/gnome-shell/extensions/[email protected], enables it
$B doctor                  # gnome_shell_extension: ok once it is loaded

Without it the portal backend still types and clicks, but window listing is unsupported and targeted input is refused.

Hyprland (and W3BS DE)

Hyprland's portal (xdg-desktop-portal-hyprland) has no RemoteDesktop interface, so the portal backend cannot type or click there. --adapter auto therefore picks a Hyprland backend (linux-hyprland) whenever HYPRLAND_INSTANCE_SIGNATURE points at a live Hyprland IPC socket:

  • Layout and windows: Hyprland's IPC (j/monitors, j/clients, j/cursorpos). Hyprland serves one request per connection, synchronously, so each request opens, writes, reads and closes. Windows are ordered topmost first (special workspace, fullscreen, floating and pinned, then tiled) for occlusion checks. Monitor hotplug and config reloads on .socket2.sock mark captures stale.
  • Input: the backend's own Wayland connection with zwlr_virtual_pointer_v1 and zwp_virtual_keyboard_v1, with a keymap it generates. Hyprland resolves its key bindings through the seat's keymap, not the virtual keyboard's, so keycodes matter: every key a US keyboard has sits at its real position with both levels (Shift goes through the modifier state, as with real keys, and SUPER+1 still reaches the workspace binding); other characters (é, ✓, 日) go on keycodes the seat's keymap leaves empty (read from the compositor; 14 on a US map), so no binding can swallow them, and text needing more is typed in parts. (A wtype-style keymap that numbers keysyms from keycode 9 loses c, d and e: on a US map those codes are Mute and Volume.) Closing the connection (Stop, Disable) destroys both devices, which releases anything held.
  • Captures: grim (wlr-screencopy).
  • Interlocks: input is refused while hyprlock or swaylock runs, or while an authentication dialog (polkit agent, pinentry, GCR prompter, ssh-askpass) is mapped.
  • Takeover: the pointer moving away from where the agent left it is physical input, which disables access. Hyprland cannot tell a person's keys from virtual ones, so keyboard takeover is not detected; use the mouse or the emergency stop.
  • Native control: the tray (StatusNotifierItem) shows in waybar. W3BS DE (w3bs.org/de) also puts an agent indicator in its bar (w3bs-desktop status --waybar) and binds SUPER+ALT+Escape to w3bs-desktop disable.

Verified on the Hyprland 0.56.2 rig (tests/rig/hyprland.sh, then tests/rig/hyprland-e2e.sh), with W3BS DE's bindings loaded: backend auto-detected, windows and layout, a 1920x1080 capture, every US key on both levels plus accents and 20 CJK characters typed exactly, absolute pointer motion, a click, and SUPER+2 switching workspaces.

If Hyprland's permission system is on (ecosystem.enforce_permissions), allow grim the screencopy permission.

Drive prompt

Before an agent takes the pointer and keyboard, the person at the desktop is asked: " wants to drive your desktop", with the task's description and four answers.

Answer What it does
Allow The agent drives. The answer lasts while it keeps working (every lease extends it) and lapses after 10 minutes without one, so a CLI that starts a task per command is asked once, not per click.
Deny The agent is refused for 10 minutes (denied, with retry_after_ms), then may ask again.
Postpone "Not now": the agent is told busy with retry_after_ms (10 minutes by default, 1 minute to 4 hours) and asked again after.
Always allow For when you are away from the desk: this and every later request is allowed without asking, until you turn it off. It is saved with your agent grants.

The prompt pops up as a desktop notification with those four buttons (KDE Plasma tray; the GNOME panel extension), and is in the tray, panel and macOS menu bar menus, the Windows tray menu (with a balloon tip), the control app and w3bs desktop control. Each surface also has the Always allow agents to drive (I'm away) switch. From a terminal:

w3bs desktop drive list
w3bs desktop drive allow <id>        # also: deny <id>, postpone <id> --minutes 30, always <id>
w3bs desktop drive always-allow on   # off: ask before every agent drives again

Agents wait for the answer: MCP task_begin and the CLI input commands retry for up to two minutes (W3BS_DESKTOP_DRIVE_WAIT_S), then report approval_required with the drive_request_id. Only the human answers: agents' process trees are refused on every drive method. Stop all agent activity forgets every answer, so agents ask again. Non-desktop instances (--enabled-by-default) have nobody to ask and skip the prompt.

Human steps (CAPTCHA, 2FA, sign-in, payment)

Agents that work from screenshots and OS input can be trained to beat CAPTCHAs: a fast detector for familiar puzzles, a vision model for new ones, and every model answer becomes a label for the detector (Schneier, 2026-10-19, arXiv 2609.02393). This layer goes the other way. Agents do not solve "are you human" checks. They hand them to the person, along with one-time codes, passwords and payment confirmations.

Kind For
captcha A CAPTCHA or any other bot check
two_factor A one-time code, security key, passkey or authenticator prompt
login A password or sign-in the agent should not hold
payment Confirming a purchase, payment or transfer
other Anything else only the person should do

When an agent asks:

  • The input lease is revoked (whoever held it), and no agent can take it until the step ends (busy with human_step_id).
  • Your own clicks and typing while the step is open are not a takeover, so the layer stays on.
  • You get " needs you for a human check (CAPTCHA)" with the agent's message and two buttons: Done and Cancel. It appears as a notification and in the menu on the KDE tray and the GNOME panel, as a banner in the control app, and in w3bs desktop control (done, cancel). The Windows and macOS menus do not show it yet; use the control app there.
  • Done drops every capture taken before the step. The agent must look at the screen again and call task_begin to continue. Cancel tells the agent to stop and tell its user.
  • An unanswered step lapses after 15 minutes. Stop withdraws open steps.

The audit log keeps only the kind, never the message. From a terminal:

w3bs desktop human list
w3bs desktop human done <id>      # cancel <id> refuses it
# the agent side (MCP tool `human_step`, or the CLI):
w3bs desktop human ask --agent opencode --kind captcha "Solve the CAPTCHA on the sign-up page in Firefox"

MCP human_step and w3bs desktop human ask wait up to two minutes (W3BS_DESKTOP_HUMAN_WAIT_S). If the step is still pending after that, poll human_step_status. Only the human resolves a step: agents' process trees are refused.

Screen memory (locate fast path)

An agent working from screenshots pays for a full vision-model pass every time it looks for the same button. Screen memory is the fast path, after the detector-plus-VLM split in the same paper (arXiv 2609.02393). It is used for finding your own UI again, never for bot checks; those are human steps.

  1. Slow path: the agent finds a target in desktop_screenshot, acts on it, and it works.
  2. Label: it calls desktop_remember {label, capture, x, y}. The broker saves a small grayscale patch around that point (48x48 by default, radius 12-64) from the agent's latest capture.
  3. Fast path: next time it calls desktop_locate {label, display}. The broker takes a fresh capture and searches it for the patch (zero-mean normalized cross-correlation, coarse-to-fine; about 0.13 s on a 4K frame in a release build). It returns either:
    • found: true with a point in that new capture (space=capture), when the match scores at least min_score (0.9 by default) and nothing else comes close, or
    • found: false. The agent goes back to the slow path and remembers the target again, so the memory catches up when an app changes its look.

Safety rules:

  • No old coordinates: every point belongs to a capture taken just now, and the usual layout and capture checks apply when the agent clicks it.
  • Ambiguous matches are refused: when two places match within 0.03 of each other, it does not guess (two identical "OK" buttons). A larger radius adds context.
  • Flat patches are refused: a blank field or plain background has nothing to match on.
  • Same access as a screenshot: it needs display capture and broad_desktop.
  • Nothing is saved during a human step, so a password being typed is never captured.
  • Per agent, small, and yours to delete: each agent keeps its own patches (at most 128, least recently used go first) in screen-memory.json in the state directory, mode 0600. Removing an agent deletes its patches. The audit log keeps the display and score, never the label or the pixels.
w3bs desktop memory list [--of AGENT]        # labels, sizes, hits and misses (no pixels)
w3bs desktop memory forget AGENT [LABEL]     # one label, or everything that agent saved
# agent side (MCP: desktop_locate, desktop_remember, desktop_memory):
w3bs desktop memory remember --agent A --capture cap_x --x 450 --y 315 "Editor: Save button"
w3bs desktop memory locate --agent A --display DP-1 "Editor: Save button"

Browser channel (DevTools, not screenshots)

Anything in a web page goes through Chrome DevTools (CDP), the protocol chrome-devtools-mcp uses, instead of the screenshot, find-the-pixel, click loop. The agent reads the page as an accessibility outline whose lines carry uids, then acts by uid:

uid=31 textbox "Username" focused
uid=42 button "Sign in"

browser_snapshot → browser_fill {uid, value} / browser_click {uid} → browser_snapshot again to verify. One round trip per step, no image, no coordinates, no screen capture permission, and it works on a window that is covered or on another workspace. Also browser_type, browser_press_key (Enter, Control+A), browser_scroll, browser_navigate (http/https only, or back, forward, reload), browser_new_page (like_page keeps an incognito context), browser_close_page, browser_wait_for, browser_evaluate, browser_pages, browser_screenshot (the page itself).

The agent browser. w3bs desktop browser launch [--profile agent] [--headless] starts TronBrowser's managed session (tron browser launch): its own profile (~/.tronbrowser-agent) with DevTools on a loopback port. Your everyday browser is never opened to DevTools. The broker finds it through the session file tron writes, then any DevToolsActivePort in a TronBrowser, Chromium or Chrome profile, then 127.0.0.1:9222; daemon --browser-cdp URL (W3BS_DESKTOP_BROWSER_CDP) pins one instead.

No silent fallback. When DevTools cannot reach a browser, every browser_* call fails with blocked and details.browser_unavailable: true, and w3bs desktop capabilities shows browser unsupported. Agents are told to stop and say so (a training run is reported as failed with that error) instead of quietly going back to screenshots. The screenshot and mouse/keyboard tools stay as the fallback when the person says to use them, and for everything that is not a web page.

Safety: the same gates as desktop input. Reading needs the layer Enabled and the browser grant (the broad preset includes it; agents update NAME --policy broad adds it to an existing agent). Every act needs task_begin's input lease, so the drive prompt, human steps, training recordings, emergency stop and takeover all apply; --approve-for browser (or one tool, browser_click) makes each act wait for your approval; the per-minute action limit counts them. A uid only resolves in the page's current document, so a uid from the previous page fails as target_stale instead of clicking whatever is now at its old position. The audit log keeps the operation and page id, never typed text, values or page content.

w3bs desktop browser launch                    # the agent browser (TronBrowser, own profile, loopback DevTools)
w3bs desktop browser status                    # reachable? product, endpoint, pages
# agent side (MCP: browser_*), one tool per command; acts take the lease for that call:
w3bs desktop browser call --agent A browser_snapshot
w3bs desktop browser call --agent A browser_fill '{"uid": 31, "value": "riotcoder"}'
w3bs desktop browser call --agent A browser_click '{"uid": 42}'

Control app

A local, installable web app with everything the tray has and more: status (Disabled, Enabling, Enabled, Stopping, Blocked, as an icon and a word), the active agent, task and input lease, Enable/Disable, Stop all agent activity, Quit and disable, the emergency shortcut, approvals with Approve/Deny, agents and permissions (preset, mode, capabilities, apps; change the preset and apps, revoke), tasks (cancel), recent activity (audit metadata only; export, delete) and the settings the broker actually has (shortcut, audit retention, MCP endpoint).

Open it from the tray, the GNOME panel or the macOS menu bar (Open control panel…, the first menu item), with open in w3bs desktop control, or from your own terminal:

w3bs desktop control --open              # opens http://127.0.0.1:7801/control in your browser
w3bs desktop control --open --no-browser # prints the one-time link instead

The broker serves it on the same loopback listener as MCP over HTTP (daemon --mcp-http); if the daemon runs without it, opening the app starts the listener on 127.0.0.1:7801 with /mcp off (W3BS_DESKTOP_CONTROL_ADDR moves it). Install it from the browser's menu to keep it in your app launcher: the service worker caches only the app shell, never data.

It can grant agents the mouse and keyboard, so it is guarded like a native control:

  • Sign-in only from the human side. Each opening mints a one-time link (/control/login?t=…, 60 seconds, single use) over the control socket, which only the native control or an interactive terminal outside any agent's process tree may do. The link is swapped for an HttpOnly, SameSite=Strict session cookie scoped to /control and removed from the URL. An installed app whose session has expired asks you to open it from the tray or the terminal again.
  • Never with an agent token. Any request carrying Authorization is refused (403) on every /control route, and on Linux a browser started from an agent's process tree is refused; the control cookie is never sent to, or accepted by, /mcp.
  • Loopback and same-origin only. Host must be this listener's loopback address and port (DNS rebinding); state-changing requests need Origin equal to that origin, a JSON body and the session's CSRF token. The page loads nothing from anywhere else (CSP default-src 'self').
  • Same rules as the other controls. Enabling still needs a tray, panel or terminal control running, and a terminal's enable request is confirmed in the app as in the tray. Every action is audited (control.login, control.session, and the broker's own records with reasons such as "disabled from the control app").
  • Closing the app never disables access, unlike quitting the tray or the terminal control: the app is not the switch that guards the session, the tray or panel is. Use Disable, Quit and disable (disables and signs the app out) or the emergency shortcut.

The tray menu mirrors the app: Open control panel… on top, an Agents submenu (each agent with its mode, and Revoke) and Recent activity (the last five audit entries, read-only), next to the existing items; left click still only disables. The GNOME panel has the same three items; the Windows tray and the macOS menu bar have Open control panel… (no submenus there yet).

Training mode (record demonstrations for W3BS Training)

Teach an agent by doing the task yourself. Recording is part of this layer; reviewing, curating and sharing the result is W3BS Training (w3bs training).

  • Start: tray → Start training… opens the control app at its Training section: choose Teach this task (with a goal) or Observe my work, tick the applications it may see, and start. Or w3bs desktop training teach --goal-file goal.txt --app org.kde.kate.
  • While recording the tray shows Training: Recording · Teach: … with Pause recording, Mark task boundary (observe mode) and Finish task → Complete / Partial / Failed / Not sure. The control app has the same, plus Discard, an explanation box and Delete last 10 minutes.
  • What it captures: the focused window of an approved application, cropped to that window, on every focus change and whenever the window visibly changes. On Linux the frames come from the ScreenCast stream the portal session already shares (PipeWire, at most 5 a second; no new consent and no screenshot per frame); elsewhere, or with W3BS_DESKTOP_CAPTURE=screenshot, from screenshots every few seconds. A frame is kept only when at least 1 in 1,000 of the window's pixels changed since the last kept one (a blinking caret or a passing pointer is not activity; small changes add up and are kept once they pass that), and the end state is always kept when you finish. An unapproved window in focus, or overlapping the approved one, is recorded as a gap, never captured. No keystrokes, typed text, clipboard or audio: Wayland offers no passive input tap, so recordings are the visual-review profile and steps are window-focus changes with origin unknown.
  • Who can start it: only the person (tray, control app, or your own terminal); an agent's process tree is refused. Pausing, finishing and deleting are always allowed.
  • Agents while you teach: their input lease is revoked and refused until you finish, unless you tick "Let agents keep working" (steps are then marked mixed-origin).
  • Fail closed: it starts idle after every daemon start and stops (as interrupted) whenever the layer is disabled: lock, suspend, logout, emergency stop, tray gone. Resuming needs you.
  • Handoff: frames stay in memory. Finish pipes the bundle to w3bs training import -; if W3BS Training is not installed (curl -fsSL https://w3bs.org/training/install.sh | sh, or irm https://w3bs.org/training/install.ps1 | iex on Windows), or on Linux has no keyring access (sudo apt install libsecret-tools), the recording waits in memory (Try again in the app, w3bs desktop training handoff) and is lost if the daemon stops. Nothing is written to disk unencrypted. W3BS_DESKTOP_TRAINING_HANDOFF replaces the command (sh -c, bundle on stdin).

The control socket gains training.* methods; agents get none. w3bs desktop training --help lists the CLI.

macOS onboarding

The broker needs two privacy permissions, granted to the process macOS holds responsible for it: ~/.local/bin/w3bs-desktop when the installer's LaunchAgent runs it (the normal case), or your terminal app (Terminal, iTerm) when you start w3bs desktop daemon from it yourself. After granting, restart the broker (launchctl kickstart -k gui/$(id -u)/org.w3bs.desktop.broker). The binary is not code-signed, so macOS may ask again after an upgrade replaces it:

  1. Accessibility (System Settings > Privacy & Security > Accessibility): posting input events, focus and inspect. Without it, enabling is refused (Blocked) with the pane named.
  2. Screen Recording (System Settings > Privacy & Security > Screen Recording, called "Screen & System Audio Recording" on macOS 15 and later): screenshots and window titles. Without it, captures are refused and window titles are empty (windows are reported as degraded).

Input Monitoring is not needed: the layer never reads keys; takeover is detected from HID idle time, and the emergency stop is a registered hot key. w3bs desktop doctor shows what is allowed without prompting; w3bs desktop doctor --prompt (or "Check macOS permissions" in the menu-bar control) shows macOS's prompts. Run w3bs desktop daemon --adapter native, then w3bs desktop tray for the menu-bar control (its title reads Agents: Disabled / Agents: Enabled; emergency stop: Control+Option+Command+Escape).

Known macOS gaps: Char keys in shortcuts use US ANSI positions (text is layout-independent); without Accessibility the Dock bar is not counted as an occluder (its whole-display overlay window is ignored) and focus falls back to the front-most normal window; our own posted events also reset the HID idle clock, so human input landing within ~50 ms of agent input is not told apart; Mission Control / Launchpad are not detected as modal.

Safety model, in one screen

  • Starts Disabled after install, login, restart or crash. Only a human enables: the code goes to the native control, and control requests from an agent's process tree are refused. The one exception is opt-in: w3bs desktop daemon --enabled-by-default (or W3BS_DESKTOP_ENABLED_BY_DEFAULT=1) is for non-desktop instances (containers, VMs, CI) with nobody at the screen. That broker starts Enabled, needs no native control, and w3bs desktop enable skips the code; disable and the interlocks still work. Never use it on a person's own desktop. tests/rig/headless-kde.sh proves it on KDE Plasma in Docker.
  • Disable closes everything the layer mediates: an atomic gate plus a revocation generation reject new work immediately, then leases, tasks, approvals, captures and streams are dropped and any synthetic held keys/buttons are released. Lock, suspend, logout, VT switch, portal revocation, adapter loss, native-control loss and human takeover all disable. Nothing re-enables on its own.
  • Authorization is checked before every primitive event, not when work is queued. One agent holds the desktop input lease at a time. Batches are bounded (256 actions, 4096 characters, 5 s holds) and nothing stays held after its batch.
  • Targets are validated: every point names its coordinate space; screenshot points die with the layout generation; a covered target or a focus change stops the batch (target_stale).
  • Agents ask before they drive (the drive prompt above): Allow, Deny, Postpone or Always allow, answered only by the human; Stop forgets every answer.
  • Agents hand human checks to the person (human steps above): CAPTCHAs, one-time codes, passwords and payments are never attempted by the agent; agent input pauses until the person presses Done or Cancel.
  • Approvals bind the exact request (agent, task, target, argument digest, expiry); agent input is suspended while one is pending; the agent surface has no enable/grant/approve methods.
  • Audit is metadata only (7-day default retention): never screenshots, typed text or bodies.
  • Limits: broker policy cannot contain a hostile process that already runs as you. Broad desktop control cannot enforce business intent (a draft-only mail grant does not stop a browser send). Disabling cannot unsend, retract delivered input, or erase what an agent already received.

Interfaces

  • CLI: w3bs desktop … (this binary is w3bs-desktop until the W3BS package manager dispatches w3bs <sub> to w3bs-<sub>).
  • Local API: newline-delimited JSON over $XDG_RUNTIME_DIR/w3bs-desktop/{agent,control}.sock (0600, 0700 dir, same-uid peers only); on Windows over \\.\pipe\w3bs-desktop-<user>-{agent,control} (owner and only ACE = the current user's SID, first instance owned by the broker, remote clients rejected, clients refuse a pipe another user owns). Tokens live under %LOCALAPPDATA%\w3bs\desktop, whose inherited ACL grants the user, SYSTEM and Administrators. Schemas in crates/adl-schema.
  • MCP: w3bs desktop mcp serve --stdio --agent NAME, or Streamable HTTP from the broker itself with w3bs desktop daemon --mcp-http 127.0.0.1:7801 (POST /mcp, agent bearer token).
  • Control app: http://127.0.0.1:7801/control on the same listener, for the human (see above).

Tests

cargo test --workspace   # broker conformance, Vela fake socket, KWin and GNOME Shell canned reports, end-to-end daemon/CLI/MCP
desktop/tests/rig/kde-portal.sh     # KDE Plasma in a container (TRAY=1 adds the tray stage)
desktop/tests/rig/gnome-portal.sh   # GNOME Shell in a container, with the W3BS Shell extension
desktop/tests/rig/macos-e2e.sh      # macOS logged-in session (GitHub macos-latest job `macos-e2e`)
desktop/tests/rig/browser-cdp.sh    # browser channel against a real headless Chrome (CHROME=..., W3BS_DESKTOP_BIN=...)
desktop/tests/installer/alpine.sh    # install.sh on Alpine (musl, no systemd) in alpine:3.24, x86_64 + aarch64 (job `installer-alpine`)
desktop/tests/installer/macos.sh     # install.sh on macOS: LaunchAgents, launchd broker, menu bar, uninstall (job `installer-macos`)
desktop/tests/installer/windows.ps1  # install.ps1 on Windows: autostart, windowless broker + tray, uninstall (job `installer-windows`)