Repository navigation
feat(browser): run browserTool on a BrowserSession, without codemode - #2667
Merged
Merged
Conversation
ben-reitz
force-pushed
the
browser-tool/session
branch
from
October 22, 2026 15:40
b0877b3 to
f3ab829
Compare
🦋 Changeset detectedLatest commit: cf57109 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
🔴 agents import sizes: 1 entry point over threshold
Changed exports (8)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
ben-reitz
marked this pull request as ready for review
October 22, 2026 21:52
ben-reitz
force-pushed
the
browser-tool/session
branch
2 times, most recently
from
October 23, 2026 10:52
da1c8c2 to
db07ae5
Compare
ben-reitz
force-pushed
the
browser-tool/session
branch
2 times, most recently
from
October 23, 2026 13:00
2ef8ad3 to
61e313c
Compare
ben-reitz
force-pushed
the
browser-tool/session
branch
2 times, most recently
from
October 26, 2026 10:32
d6bce55 to
9226d98
Compare
browserTool's code now runs in a fresh Dynamic Worker from `loader` (browser/sandbox.ts) with no network access and a frozen `cdp` object as its only way out, instead of on a codemode facet. It no longer needs `ctx` (now ignored) or a `CodemodeRuntime` export, and its output drops the `calls` log. The per-run CDP logic moves from session-connector.ts into BrowserSession (browser/session.ts), returned by `browser.session()`: the "active" tab, attach handles, error hints, refusing Browser.close, and the end-of-run report. truncate.ts is a copy of codemode's truncateResult. BrowserConnector is marked deprecated. Ported from #2612, keeping the browserTool name. Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
- Statements with no return get a notice instead of a silent undefined. - Rule and docs say only screenshots over 1 MB fail, and why the limit stays. - Pi docs drop the CodemodeRuntime export. - Design record: browserTool first, codemode connector under Deprecated. Co-authored-by: Matt Carey <77928207+mattzcarey@users.noreply.github.com>
…every empty body run A `return` inside a string no longer hides the statements notice. Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
…precated part Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
…lled Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Model code could mint a Live View link with Cloudflare.getLiveView, or wrap a refused command in Target.sendMessageToTarget. Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Model code could cancel the sandbox's timer and hold the scope's queue. Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
A returned browser_screenshot must be a png, jpeg or webp of base64 data within the 1 MB limit; anything else is cut down like any other result. Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
…lled Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
ben-reitz
force-pushed
the
browser-tool/session
branch
from
October 26, 2026 10:51
db22a53 to
cf57109
Compare
Merged
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
browserToolruns the model's code in its own Dynamic Worker on a newBrowserSession, instead of on@cloudflare/codemode.browser.session({ scope })is public, so your own code gets the samesessionId: "active"handling, validation and error hints.browserToolno longer needsctxor aCodemodeRuntimeexport, and its output drops thecallslog.@cloudflare/codemodemust stay installed whileagents/browserstill exports the deprecated codemode APIs.Cloudflare.getLiveView,Cloudflare.handoff), or tunnel commands past that check (Target.sendMessageToTarget,Target.exposeDevToolsProtocol).browser_screenshotis kept whole only if it's a png, jpeg or webp of base64 data under 1 MB; anything else is cut down like any result. Console logs are capped at 100 lines.session-connector.tsis gone;truncate.tskeeps results under the token budget.Ported from #2612 by @mattzcarey (co-authored). Computer
ws:browsermentions are removed here; that comes later in its own PR. This stack supersedes #2612.