Repository navigation
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.
|
Field report from an agent that used this tool on Windows 11 / desktop 2.0.14 — full measurements in #50781. In short: The Also worth knowing: Happy to re-test against a build that includes the fallback. |
|
+1 for this, something that I would genuinely use and have found useful in paid for software. If any help is wanted on this I am very much willing to help push this along. |
|
@thdxr please look into this , really requested feature implemented here |
|
Would it be possible to also add the ability to open a browser tab on the right hand side panel instead of just files, that way other things can be possible in the future without leaving the app. |
|
… On Fri, Sep 25, 2026, 12:17 PM Andy Wilson ***@***.***> wrote:
*The-Code-Monkey* left a comment (anomalyco/opencode#48755)
<#48755 (comment)>
Would it be possible to also add the ability to open a browser tab on the
right hand side panel instead of just files, that way other things can be
possible in the future without leaving the app.
—
Reply to this email directly, view it on GitHub
<#48755?email_source=notifications&email_token=CMSNYI7JZ3XMERMY7NMKOOT5QZH4JA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBTGE2DOMZWGU22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-5831473655>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CMSNYIZ72DMDG5UEVTT3L635QZH4JAVCNFSNUABFKJSXA33TNF2G64TZHM4TONJXGM2DGMJZHNEXG43VMU5TKNBTG44TKNBYGEY2C5QC>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
DiazOlveraCo
left a comment
There was a problem hiding this comment.
Fix for Windows screenshot issue (fromSurface failure when tab not composited):
The issue is that Page.captureScreenshot with fromSurface: true fails on Windows with "needs a visible tab" when the tab's view isn't composited (e.g., review pane showing another session).
Suggested fix - add a fallback to fromSurface: false:
async function screenshot(browser: Browser, note: string, fullPage = false): Promise<Tool.ExecuteResult> {
let shot: { data: string }
try {
shot = await page<{ data: string }>(browser, "Page.captureScreenshot", {
format: "jpeg",
quality: 80,
fromSurface: true,
captureBeyondViewport: fullPage,
})
} catch (error) {
if (error instanceof Error && error.message.includes("visible tab")) {
shot = await page<{ data: string }>(browser, "Page.captureScreenshot", {
format: "jpeg",
quality: 80,
fromSurface: false,
captureBeyondViewport: false,
})
} else {
throw error
}
}
// ... rest unchanged
}This preserves full-page capture when fromSurface works, and falls back to viewport-only capture when it doesn't. The click/type/press/scroll actions already use Input.dispatchMouseEvent/Input.insertText which don't need a surface, so they're unaffected.
|
Thanks for the write-up and the suggested fix, both were spot on. Pushed 1dc8c2c. @4Liberty if you can retest against that build, it'd be good to know it fixes it on your end. Agreed on the |
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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