refactor(agents): share connector validation and load the CDP spec from a live session - #2369
Merged
ben-reitz merged 1 commit intoOct 1, 2026
Conversation
🦋 Changeset detectedLatest commit: 83479fd 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 |
ben-reitz
added this pull request to stack #2373
September 25, 2026 08:21
Contributor
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
from
September 25, 2026 09:13
171b973 to
a7313e9
Compare
ben-reitz
marked this pull request as ready for review
September 25, 2026 11:13
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
4 times, most recently
from
September 25, 2026 13:48
c9af3a3 to
130c478
Compare
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
from
September 25, 2026 13:57
130c478 to
cab6893
Compare
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
5 times, most recently
from
September 28, 2026 12:29
4f8b8d1 to
cfd3bdc
Compare
ben-reitz
removed this pull request from stack #2373
September 29, 2026 13:34
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
from
September 29, 2026 13:36
cfd3bdc to
ef73b6a
Compare
ben-reitz
added this pull request to stack #2412
September 29, 2026 13:36
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
from
September 30, 2026 09:25
ef73b6a to
6f49524
Compare
…om a live session
ben-reitz
force-pushed
the
refactor/browser-connector-shared-helpers
branch
from
October 1, 2026 10:08
6f49524 to
83479fd
Compare
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.
TL;DR: Groundwork refactor shared by later PRs
Groundwork for the persistent browser connector: #2370 and #2371 build on it.
BrowserConnectorbehaves the same as before.connector-validation.ts: the JSON-schema argument validation moves out ofconnector.tsunchanged, so the second connector can reuse it.loadCdpSpeccan read from a live session, so a connected browser'sspec()(feat(agents): add active-tab tracking and spec() to named browsers #2370) doesn't create an extra browser just to fetch the protocol:loadCdpSpec({ browser }) // create session → GET /json/protocol → delete +loadCdpSpec({ browser, sessionId }) // GET /json/protocol from that sessionResults are still cached per binding. The two paths are covered in the new
browser-spec.test.ts.Architecture diff
Outlined boxes are components this PR changes, with one box per change (green added, red removed). Green-filled boxes are new. Grey boxes are unchanged, and dashed boxes arrive later in the stack.
flowchart TB classDef ctx fill:none,stroke:#8c959f,color:#8c959f classDef changes fill:#dafbe1,stroke:#1a7f37,color:#1f2328 classDef removed fill:#ffebe9,stroke:#cf222e,color:#1f2328 classDef later fill:none,stroke:#8c959f,stroke-dasharray:4 3,color:#8c959f Runtime["codemode runtime"]:::ctx subgraph BC["BrowserConnector · connector.ts"] C1["− inline argument validation (moved out)"]:::removed end subgraph Val["connector-validation.ts (new)"] V1["+ validateConnectorArgs(connector, name, tool)"]:::changes end subgraph Spec["loadCdpSpec · spec.ts"] S1["+ optional sessionId: read the protocol from that session"]:::changes end BR["Browser Run"]:::ctx NextSpec["BrowserConnection.spec() (#2370)<br/>reads the spec from its own browser"]:::later Next["BrowserSessionConnector (#2371)<br/>validates args"]:::later Runtime -->|"tool calls"| BC BC --> Val BC -->|"no sessionId: temporary session, as before"| Spec Spec --> BR Next -.-> Val NextSpec -.->|"with sessionId"| Spec style BC stroke:#1a7f37,stroke-width:2px style Val fill:#dafbe1,stroke:#1a7f37,stroke-width:2px,color:#1f2328 style Spec stroke:#1a7f37,stroke-width:2px