Expand description
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.
A connection must carry a lease token (x-agentmux-lease) signed for this lease and workspace, checked against the
public keys the host was given (lease_token). A token opens one connection; a second connection while one is open is
refused. The page, the stream and the input are the same code as the headless pane’s.
Settings: --browser-host-listen <address:port> (default 0.0.0.0:8291), and the environment
AGENTMUX_BROWSER_HOST_PUBLIC_KEYS (JSON, key id to base64 SPKI), AGENTMUX_BROWSER_HOST_LEASE and
AGENTMUX_BROWSER_HOST_WORKSPACE. The profile is a fresh folder under the temp directory.
Structs§
- Host 🔒
- What the server holds: the gate, whether a connection is open, the signal that ends the server and its pane, and
since when no accepted pane has been open (
Nonewhile one is). - Open 🔒
- Releases the one open connection when the pane ends, however it ends.
- Serving 🔒
- Held by a pane the host let in: while it lives the host is not idle, and when it goes the idle clock starts over.
Constants§
- DEFAULT_
LISTEN 🔒 - FLAG
- The flag that starts srv in this mode.
- IDLE_
CHECK_ 🔒EVERY - How often the idle clock is looked at.
- IDLE_
EXIT 🔒 - How long the host may have no pane open before it ends itself: the task then stops, and the lease that named it ends with it. Counted from the start, and again from each time a pane that was let in goes away.
- KEYS_
ENV 🔒 - LEASE_
ENV 🔒 - LISTEN_
FLAG 🔒 - STOP_
GRACE 🔒 - How long an open pane gets to end after the server is told to stop.
- TOKEN_
HEADER - The header the lease token arrives in.
- WORKSPACE_
ENV 🔒
Functions§
- connect 🔒
GET /agentmux/streamed-browser?url=&w=&h=with a lease token, upgraded to a WebSocket.- end_
when_ 🔒idle - Ends the server once it has had no accepted pane for
limit, looking everyevery. A refused connection (no token, a bad token) does not count as a pane, so it cannot keep the host alive. - exit_
if_ 🔒requested - Runs the browser host and exits when srv was started as one; returns when it was not.
- host_
from 🔒 - listen_
from 🔒 - The address to listen on: the flag’s value, else the default.
- private_
dir 🔒 - A folder only this process can open, named at random: the browser’s profile lives under it, and it is removed at exit.
- requested 🔒
- Was srv started as the browser host?
- router 🔒
- run 🔒
- serve 🔒
- shutdown 🔒
- SIGTERM (a task being stopped) and SIGINT end the server; as a container’s first process it has no default for them.