Repository navigation
Conversation
Hona
force-pushed
the
browser-tools-rebuild
branch
2 times, most recently
from
October 9, 2026 02:58
de31f2e to
b99d81d
Compare
One locator grammar for every element parameter, wait as a result instead of an error, new read/type/watch/emulate/storage/addInitScript/handoff tools, local files served to tabs by path, screenshots and large results saved to server paths, subagents borrowing the parent's browser, and per-action deadlines. Protocol version 5.
…new browser tools Agent tabs are offscreen pages that paint, lay out, and take input whether or not the Review pane or window is visible; a presenter view streams their frames into the pane and forwards the user's input. Idle unwatched tabs stop painting. The page driver resolves locators in the page (shadow DOM included), waits for actionable elements, sends trusted input, and reports what each action changed.
Hona
force-pushed
the
browser-tools-rebuild
branch
from
October 9, 2026 03:09
b99d81d to
7fb2d4c
Compare
- Wire the desktop RPC port, theme and storage events only to app windows, not to offscreen agent tabs that load web content. - Keep browser saves inside the workspace, through symlinks, and never replace a file the browser did not save. - Serve local files without following symlinks out of the folder. - Fail at once on malformed CSS, XPath and regex; report a wait script's last error; take gone as a locator; honor frameID with target. - Reload a re-run HTML preview; SVG stays a media preview. - Keep agent tabs at their own size while watched, scaled to fit. - Bound frame encoding to a quarter of the main thread and shrink frames to the pane's pixel size; paint at 30 fps. - Run macOS edit chords as commands in agent tabs, send selectAll with Cmd+A, and pass modifier keys and the Space key through. - Cap tabs opened by pages, drop the unused Command.generation, and format with prettier.
- Save agent tabs' owner, key and viewport, so they come back as agent
tabs after a restart, and reuse a restored tab for tabs.open({ key }).
- Serve a workspace page with its folder only outside dot-folders; any
other HTML or SVG page is served alone, and other files are refused.
- Refuse saves through broken symlinks or onto a saved file that became
a link.
- wait: a removed ref is detached, state needs target or text, text
honors attached and detached, and enabled treats a removed element as
not enabled.
- Report the tab's own viewport after a screenshot at another size, and
size captures with the viewport's device scale.
- Do not treat button, hidden or file inputs as editable.
- Focus offscreen tabs only on Windows: elsewhere it shows their window.
- Size the presenter canvas before its first frame, and fetch the frame
again when the pane grows.
- Give type a deadline that covers its text, end watch's last sleep with
its duration, and key previews by their served URL.
- Do not test idle's reset in happy-dom, which holds observer callbacks
weakly; Electron covers it.
This was referenced Oct 19, 2026
Open
3 tasks
This was referenced Oct 28, 2026
Contributor
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.
Agents used the desktop browser in 96 recorded sessions (2,226 Code Mode calls, 7,967 browser sub-calls), and 29% of those sub-calls failed. Most failures had a few root causes:
screenshotfailed (57%),clickandhoverthrew a bareUnknownVizError(43%), key presses were lost, andrequestAnimationFramenever ran.wait({ text: "zzzz-never", timeout })as a sleep: 2,012 calls failed at once on a missingconditionand were hidden by.catch(() => {}).findsearched an accessibility tree 8 levels deep, so agents fell back toevaluatefor clicks, typing, waiting, and reading (3,456 calls).expression,query,requestID), and nothing rejected them.file://was refused, so agents started ad-hoc servers.browser.disconnected.This PR rebuilds the tool surface around three guarantees: agent tabs always render, every element parameter takes one locator, and waiting returns a result.
Agent tabs render offscreen
tabs.opencreates are offscreen pages, so painting, layout, input, andrequestAnimationFramedo not depend on the pane or the window. On Electron 44, offscreen rendering was the only setup that passed visibility, animation frames, click, typing, and capture with the window normal, minimized, and hidden.WebContentsView(presenter.ts) takes the page's place in the embed system. It pulls the newest frame as JPEG, shrunk to the pane's pixel size, through a protocol handler in its own partition, and forwards the user's input (presenter-input.ts). The page keeps its own size (1280x800, or a pinned viewport) and the presenter scales it to fit, so watching never changes the agent's layout.getMainWindows), so offscreen pages that load web content never receive the privileged port.tab_hiddenand points totabs.open, instead ofUnknownVizErroror a hang.One locator for every element
target,from, andtoaccept refs, CSS,text=,role=…[name=…],label=,placeholder=,testid=, andxpath=, chained with>>andnth=(locator.ts). Locators resolve in the page through open shadow roots (page.ts). Before an action runs, the element must be attached, visible, stable, enabled, and not covered.When nothing matches, the error lists visible elements that look related:
Tool surface
wait({condition, text, timeoutMs ≤ 30s})throws on timeoutwait({ load | text | gone | target+state | url | script | idle })→{ met, elapsedMs, observed }; no condition means a delay, the way to pause in Code Mode;timeoutis accepted astimeoutMsclick/hover/fill({ ref }), plusselect,check,fill_formclick/hover/drag/fill/type/press/scrolltaketarget;fillsets any control;typesends real keystrokesfind(8-level accessibility search),evaluatefor readingfindsearches the whole DOM with refs, boxes, styles, and attributes; newread(text or Markdown, paginated)evaluate({ script })takes expressions onlyreturn, or functions withargs; each call has its own scope;saveTofor large resultsfile://refused, 480 px pagestabs.open/navigate({ path })serves the page on loopback: a workspace page with its folder (no dotfiles, parents, or symlinks out), any other HTML page alone; stops with the plugin;viewportandemulatetrace.*,cpu.*, 5heap.*toolsprofile.start/stopwith the analysis inline, andheap.snapshotwithcompareTowatch,storage,addInitScript,tabs.open({ key })for reuseconsoleandnetwork.listkeep entries across navigations and acceptsincecursors.network.getreturns WebSocket frames.reloadreturns the errors it caused.screenshot.path,files.get.path, andevaluate.saveTomust name a path inside the workspace (checked through symlinks) and never replace a file the browser did not save, because the plugin cannot ask for edit permission./regex/fails at once withinvalidinstead of waiting out the timeout.waitandwatchcan run longer than the old fixed 60 seconds.previewreportsopened, or the reason it could not open. An HTML preview opens as an agent tab and returns itstabID; previewing the same file again reloads it.Hidden-window capture
Screenshot needs a visible tab. Call browser.tabs.focus…(122 failures)