Conversation
Add a built-in browser tool that drives headless Chrome, Chromium, or Edge over the Chrome DevTools Protocol. It opens pages, returns screenshots as image attachments, and supports clicking, typing, pressing keys, scrolling, and reading page text so the agent can verify front-end work end to end. - no new dependencies: raw CDP over a WebSocket connection - cross-platform browser discovery with OPENCODE_BROWSER_PATH override - permission key "browser" with per-action patterns - idle shutdown plus process exit cleanup - unit tests and a Chrome-gated integration test
Run the browser tool with a visible window when a display is available so the user can watch the agent work. Pass `headless: true` or set `OPENCODE_BROWSER_HEADLESS=1` to hide it, and fall back to headless on Linux hosts without a display.
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.
Issue for this PR
Closes #48377
Related: #40782
Supersedes #48505, which was closed by the compliance bot before the description was updated to match the template. Same branch and commits.
Type of change
What does this PR do?
Adds a built-in
browsertool so the agent can see and interact with web pages.open,screenshot,click(selector or coordinates),type,press,scroll,read,back,forward,reload,close.Bun.spawn— no new dependencies.OPENCODE_BROWSER_PATHoverrides.browserpermission key;docs/tools.mdxanddocs/permissions.mdxupdated.Scoped to the browser; OS-level desktop control is out of scope for this PR. Happy to adjust the tool surface (naming, action granularity, gating) based on maintainer feedback.
How did you verify your code works?
bun typecheckinpackages/opencode— clean.bun test test/tool— 350 pass, including new tests for URL normalization, key parsing, and platform browser discovery.Screenshots / recordings
N/A — no UI changes. The tool returns page screenshots to the model as attachments.
Checklist