Expand description
A Browser pane for the web UI of a headless srv: a Chromium on the server, its page streamed to the
pane as JPEG frames over a WebSocket, input sent back. Opt-in (AGENTMUX_STREAMED_BROWSER=1,
headless only); see docs/specs/SPEC_STREAMED_BROWSER_PANE_DEMO_2026_11_15.md for the conditions it runs
under (our own hosts, behind the sign-in, its own profile, --no-sandbox for the demo only).
The route is behind the same layers as /ws: the key, or a signed-in browser’s cookie and token.
Modules§
- address_
policy 🔒 - Which addresses a page in the server’s Chromium may connect to. The browser opens pages from the web on a
machine that holds the user’s workspace, so everything it connects to goes through
address_proxy, which asks this module about each address it is about to connect to, after it has resolved the name itself. Plain data and functions, so every rule is tested without a network. - address_
proxy 🔒 - The one way out for the server’s Chromium: a SOCKS5 proxy on the loopback address that connects only where
address_policyallows. Chromium is told to use it for every connection (page loads, scripts, WebSocket, and the browser’s own requests), to ask it for name resolution too, and to refuse a local lookup, so a page cannot reach the cloud metadata address, a private range, or this server’s own ports, by an address or by a name. - cdp 🔒
- A small Chrome DevTools Protocol client over a pipe: JSON messages each ended by a NUL byte
(what
--remote-debugging-pipespeaks). Calls are matched to their answers by id; events go to the session they belong to, each session with a queue of its own, so a screencast frame is never dropped (a frame that is not acknowledged stops the stream). docs/specs/SPEC_STREAMED_BROWSER_PANE_DEMO_2026_11_15.md §3. - chromium 🔒
- The server-side Chromium: found, started once with a profile of its own and a CDP pipe, shared by the panes, and stopped when the last pane has been gone a while. docs/specs/SPEC_STREAMED_BROWSER_PANE_DEMO_2026_11_15.md §2 and §3.
- host 🔒
agentmux-srv --streamed-browser-host: the streamed browser as a server of its own. It runs in a task made for one person’s browser and serves nothing else: the pane’s WebSocket and/health. No database, no agents, no auth key, none of srv’s other routes.- lease_
token 🔒 - The lease token a streamed-browser host accepts: who may open this browser, signed by a key the host only holds the public half of.
- nav 🔒
- The address bar’s side of a streamed pane: where the page is, whether it can go back or forward, and the moves the bar asks for. docs/specs/SPEC_STREAMED_BROWSER_PANE_DEMO_2026_11_15.md §4.
- pane 🔒
- One streamed pane: its windows (a page of the server’s Chromium each,
windows.rs) behind one WebSocket. Frames of the shown window go out as JPEG and are acknowledged only once handed to the socket; input comes in and goes to the shown window. docs/specs/SPEC_STREAMED_BROWSER_PANE_DEMO_2026_11_15.md §4 to §6. - popups 🔒
- Who owns the pages of the browser. The browser tells everyone about every new page and every page that ends. Each pane claims the pages it shows, so a window opened by one of a pane’s pages is told to that pane (which shows it). The rule is that no page exists in the browser that no pane lists: a new page nobody claims is closed as it appears, whether or not it has an opener. The pages srv makes for itself are known because srv made them, not because they lack an opener: a pane marks that it is making a page before it asks for it, and claims the page the moment it has its id; the browser’s own first (blank) page is marked when the browser starts.
- protocol 🔒
- What the pane in the web UI says to srv, and how each message becomes a CDP call. docs/specs/SPEC_STREAMED_BROWSER_PANE_DEMO_2026_11_15.md §4.
- screen 🔒
- Screen mode: a Browser pane whose browser is an ordinary, visible Chrome on a virtual X screen, with nothing attached to it. The pane
gets the same frames and sends the same messages as the streamed browser (
pane.rs,protocol.rs), but a frame is the whole screen (the browser’s own tab strip and address bar included) and input goes to the screen as a person’s mouse and keyboard would, so the browser does not report itself as remote-controlled (Chromium turns that report on for a debugging pipe, an automation or headless switch). A prototype for the decision in task 48354: no agent driving, no windows list, a US keyboard. The screen follows the pane’s size (randr). - windows 🔒
- The windows of one streamed pane: the page it started with, and the windows that page (or a window of it) opened. Only one is shown at a time. A window a page opens (a sign-in pop-up, a link to a new tab) becomes the shown one, so the person sees it and its address; it can return its result to the page that opened it; it ends when its page closes it, and the pane goes back to the window that opened it. A page cannot open windows without limit.
Structs§
- Params 🔒
Constants§
- ENABLE_
ENV 1in the environment turns the streamed browser on.- ROUTE
- The route (the same literal is registered in
routes.rs; a test holds them together).
Functions§
- enabled
- Is the streamed browser on? Only a headless srv, only when asked, only on Unix.
- enabled_
by 🔒 - handle 🔒
GET /agentmux/streamed-browser?url=&w=&h=, upgraded to a WebSocket.- note_
own_ port - Note a port this server listens on: a page in the browser may never connect to it (
address_policy). - open_
pane 🔒 - Open the pane’s browser for the mode asked for: the full browser a person drives (
screen), or the streamed browser. One dispatch for every route that opens a pane (this server’s and the dedicated browser host’s), so each honours the mode. - screen_
pane 🔒 - A screen-mode pane, when this server has that mode on.
- start_
from 🔒 - The pane’s start: a web address (or none) and a size within the limits.
- streamed_
closed 🔒 - upgrade 🔒
- Upgrade to the pane’s WebSocket and run the pane until it ends (or
endeddoes).