Repository navigation
Conversation
Host Settings ▸ Agent browser (per host, synced, default off) lets agents on that host open and operate web pages beside its terminal via `mpx browser` (mpx-cli PR). The app runs `mpx bridge` over its own SSH connection and serves requests against AGENT viewport tabs only. - Tabs: helpers in an isolated WKContentWorld (still no message handler — the page gets no bridge), the host's own data store, docked beside the agent's tmux session on a window that is on screen; focus taken only through AgentFocusGate (never mid-typing, once per 30 s per host). - Route: pages load THROUGH THE HOST — a loopback CONNECT proxy for the tabs' data store, every connection an SSH direct-tcpip from the host, so the device's LAN is never on the path. A real device never proxies loopback, so host localhost ports are forwarded on the device, admitted by an HttpOnly per-proxy cookie (`forward --open` opts a port out) and closed with the host's last agent tab; a loopback rule list blocks every other device port. WebRTC is removed from agent tabs. - Robustness: bounded wire integers and buffers, per-host quotas, stale requests dropped after suspension (bridge clock from trusted pongs), revocation cancels in-flight work and closes the host's tabs, the link redials on network change, backpressured tunnels.
# Conflicts: # Multiplex/Localizable.xcstrings # fastlane/testflight-whats-new.txt
…light Found reviewing the branch after merging main. Forwards - An `open` that made no tab (no terminal window for the host, a revoke) left the port it had forwarded bound on the device. Nothing closed it until some later tab opened and closed, and meanwhile the same port was `port_busy` for another host. The host's slot now counts `open`s on their way, and forwards are released when neither a tab nor one of those is left. - A host can hold 16 forwards (`too_many_forwards`). A page can ask for one per loopback port it navigates a frame to, and each is two listeners on the device. - Two ports forwarded at once compiled two rule lists, and the older one could be applied last, blocking a port that was forwarded. `contentRules` now answers only with rules for the forwards as they are when it returns. - The six-tab quota is counted again after `open`'s waits. Teardown - A link session torn down before its SSH connection existed (a redial or a stop during the keychain read) still dialled and started a second `mpx bridge`. Nobody read it or ended it, and it took the socket from the live bridge. - A proxy dial retired by a host edit, a network change, or `stop` was adopted when it finished. It is closed instead, and a stopped proxy binds nothing more. Two first tabs share one proxy listener. - A host-side connection opened for a device connection that had already closed stayed open until the far end gave up: WebKit drops spare connections, and that end had fired into no splice. A splice joined to a partner that already ended now closes its own side. - Returning to the foreground re-arms the periodic ping. It slept through the suspension, woke with the app, and could find the resume ping unanswered an instant after it left, redialling a healthy link. Tests: the splice tests connect their channels first. An EmbeddedChannel is inactive until it connects, so "the device side follows" passed without the splice doing anything. New tests cover the forward bound, a stopped proxy, and the orphaned side.
A second, independent review (Gemini) of the merged branch. Each item was confirmed by reading the code or by experiment before it was changed; the ones marked E2E were also reproduced in the simulator. Requests - A cancelled request spun on the main actor. `settle` and `wait` sleep between looks with `try?`; a cancelled task's sleep returns at once, so the loop ran flat out until its deadline (20 s, or the whole wait). The bridge's `cancel`, a redial, and a revoke all cancel requests mid-load. The polls now end on cancellation. - `eval` ran code twice when it threw a SyntaxError at run time (`r.json()` on an HTML error page): the statement-body retry could not tell that from a body that did not compile, and a POST went out twice. The bodies now catch what the code throws. (E2E) - `click` failed on an <svg> button: only HTML elements have `click()`. - `open --tab t9` opened a new tab when t9 did not exist. - `wait` capped at 300 s while the bridge allows 600 s. - `navigate`, `open`, and `forward` re-check the tab and the permission after each wait before loading: a closed tab's web view still took the load, unseen and with its navigation gate gone. Forwards - Reopening a port right after its last tab closed answered `port_busy` for about 30 s. A connection the forward closed first (a refused client, a host that closed an idle keep-alive) sits in TIME_WAIT and fails a plain re-bind. The listener now retries with SO_REUSEADDR, but only when nothing accepts on the port: on its own that option also binds over another app's wildcard listener. (E2E) - `--open` could outlive its forward. The mode is now only set for a port that is forwarded, and a client is admitted and recorded under one lock. - Clear Browsing Data wiped the forwards' admission cookie for every agent tab of the host; each forward then answered 403 until a new tab opened. The cookie is re-seeded before the reload. - A frame gets a forward only inside a page that is itself host loopback, so a page from elsewhere cannot spend the host's forwards with hidden frames. - The loopback guard missed URLs with userinfo (`http://[email protected]/`), `[::]`, and IPv4-mapped literals. A test now evaluates the rules against each spelling and compiles both lists in WebKit. Tunnels - While a tunnel's host side opens, the device socket is no longer read, so an upload that starts during an SSH dial does not buffer whole. A host side that ends before its splice joins closes the device side, and a device side that already left gets nothing sent for it. - A proxy dial abandoned on its deadline is closed; a connection retired after a failed open is not adopted again by a late waiter; a bind clears its own bookkeeping. Focus and windows - `show` and `open --focus` made the tab active inside its window but did not raise the window: the reveal went through a tab's terminal, which a ⌗ tab does not have, and a new tab's dock never called it. - A page in an agent tab behind the user's terminal could raise the external-link sheet over it. It now can only while on screen. - An address typed into an agent tab keeps `localhost` as the host's. Link - A session that opens a channel but never says hello ends after 45 s and retries, instead of sitting in `.connecting` for good.
The simulator shares the Mac's loopback, so a forward there binds the Mac's own port and would tunnel to itself. Serving the fixture on [::1] only gets around that: the forward takes 127.0.0.1, and the host side resolves localhost to ::1 first. Also notes the listener check with lsof and the sun_path limit on MPX_RUNTIME_DIR.
Host Settings ▸ Agent browser gets an INSTALL SKILL button while its switch is on. It runs `mpx skill install --json` on the host, which writes the `multiplex` skill into `~/.agents/skills` and `~/.claude/skills`, and shows the files written or what to fix. - The skill's text comes from the host's own `mpx`, never from the app, so what an agent reads matches the `mpx browser` it calls. - The command goes through the bridge's road: a throwaway connection, a PTY-less login shell, the same search for `mpx` (`AgentBrowserLaunch.exec`, now shared). An exec gets sshd's bare PATH and would report mpx missing on a host whose agent browser works. - Only the one JSON answer line is read; a login shell's own output around it is ignored. A clap usage error with no answer means an mpx from before the command, and the row says to update it. - It uses the form's credentials like the Signal check, so it works before a host is saved. Editing where the form connects retires the result; switching agents off removes the button and cancels a run. - DEBUG: `MULTIPLEX_AUTO_HOST_SETTINGS=agentbrowser` scrolls to the section and `skillinstall` also presses the button, since no headless tap reaches the chip. The section's caption now points at the button instead of telling the reader to run the command; ten new strings carry zh-Hant and ja drafts (needs_review). The TestFlight bullet mentions the button and still fits the 4,000-character cap.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Host Settings ▸ Agent browser (per host, synced, default off) lets agents on that host open and operate web pages beside its terminal with
mpx browser. CLI side: multiplex-term/mpx-cli#2, which also ships themultiplexskill.mpx bridgeon its own SSH connection (SSHConnection.openLineChannel, a PTY-less login shell) and speaks JSON lines with it (AgentBrowserWire, pure).wireInteger).ViewportController.Agent). Agents can drive only the tabs they opened.WKContentWorld. There is still no message handler, so the page gets no bridge into the app.⌗ AGENTlabel.AgentFocusGate: never while the user is typing, at most once per 30 s per host.AgentBrowserProxy).localhost, so host loopback ports are forwarded on the device.mpx browser forward <port> --openopts a port out of the cookie check. Re-checking the port closes the connections admitted while it was open.AgentProxySplice).MULTIPLEX_AGENT_ROUTE=devicekeeps the old device route, for measurement.mpx skill install --jsonon the host, which writes themultiplexskill into~/.agents/skillsand~/.claude/skills, then lists the files written or says what to fix (mpx missing, mpx older than 0.2, a directory mpx could not write).mpx, never from the app.mpx), so it finds thempxthe agent browser runs.docs/agents/links-and-viewers.md("Agent tabs"),architecture.md,e2e-headless.md. Strings are translated (zh-Hant, ja), and the TestFlight note is added.Testing
AgentFocusGate, docking order, splice backpressure, the composed AGENT label, and the skill install (script, answer parsing, wording, the sheet's button)..claude/skillsgave INSTALLED plus a CHECK row.--openbehaves: checked → refused, open → reached, re-checked → refused.local-plan/agent-browser.md(not committed).Known limits
--open.*.localhostis not admitted;https://localhostworks only on an open port.