Repository navigation
feat(browser): let the agent operate the side browser and add page picks to the chat - #219
Merged
Merged
Conversation
…cks to the chat Part of #189 (phases 3 and 4, plus picking from the page). The agent drives the side browser of its own session through webContents.debugger and a sidecar MCP server: no remote debugging port, no control of the user's own Chrome, no new dependency. - Remove the Claude in Chrome integration - Connect the Electron main process to the sidecar over a loopback WebSocket channel with a token delivered on stdin - Fourteen browser tools (navigate, snapshot with numbered elements and deltas, scroll, click, type, press_key, screenshot, console, network, back, wait_for, styles, evaluate, emulate) with per-view call queues, a CDP allowlist and page text fenced as untrusted data - Ask before operating external origins (once, trust for the session, or deny), a trusted-site list in Settings, an activity bar with Stop, and a once-only prompt per site embedded in a local page - Address-bar search, an empty new-tab panel, and the context card fix on desktop with the side panel open - Chat reference kind `browser` with a fenced prompt format and restore parsing - Right-click selected page text to add it to the chat or copy it, with a sensitive-field probe - Pick an element: hover outline from the guest pointer events, persistent marks until send, one element screenshot, Claude Code aligned payload, sensitive fields carry no content, and the picked id is usable by the agent - Keep the tab usable after its page crashes, keep the new document's requests when the network buffer is cleared, and drop pick requests the host already gave up on - Design doc in docs/agent-browser-control-tech-design.md and CHANGELOG entries
This was referenced Oct 31, 2026
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
The agent can now operate the built-in browser of its own session, and the user can send text and elements from a page to the chat.
This is phases 3 and 4 of the RFC (agent control on local pages, then on external sites with per-site grants), plus picking from the page, which is not in the RFC. The agent drives the view through
webContents.debuggerand a sidecar MCP server. There is no remote debugging port, no control of the user's own Chrome, and no new dependency.Closes #189
Why
The browser tab from #207 is something only the user can use. The agent could not reproduce a UI bug, read the console error or check its own fix in the page the user is looking at. The design is in docs/agent-browser-control-tech-design.md; it records the decisions, the threat model and the limits.
What changed
Agent control
navigate,snapshot,scroll,click,type,press_key,screenshot,console,network,back,wait_for,styles,evaluate,emulate. Pages are read as a compact snapshot of text and numbered elements with delta updates. Each view has its own call queue and a CDP method allowlist, and a session can only reach its own views.Picking from the page
browser, with a fenced prompt format that is parsed back when a session is restored.user_pickingerror while the user is picking. A picked element is registered in the sidecar, so the agent canclickthe same id.Security notes
classifyH5Request), and the agent can now reach a loopback page itself, since local pages need no grant. The session MCP token still reaches the CLI through its environment; it is removed fromprocess.envonce read, so child processes do not inherit it, but another process of the same user may still read the CLI's initial environment.Testing
bun run lintandbun run test -- --runindesktop/: type check passes, 175 files and 2181 tests pass (4 skipped).bun test: the changed server test files pass in random order (seeds 1, 7 and 23, 501 tests each). The full run on my machine was not green: some tests timed out under load ande2e/business-flow.test.tshitEADDRINUSEbecause another app on the machine holds ports in the range it picks from. Those files pass when run alone or are not touched here.<webview>for picking, marks, screenshots and the hover outline (48 checks); the frame origins ininspect, the redirect chain kept in the network buffer, and a crashed page recovering after a reload (12 checks).Not covered
tag.class) while picking. Only the mark after the pick has one.classifyH5Requestweakness above.CHANGELOG.mdhas the entries, and the built-in browser line inREADME.mdandREADME_zh.mdnow mentions agent control and picking.