Skip to content

feat: added browser-use custom CDP domain + version bump#5

Merged
reformedot merged 12 commits intomainfrom
feat/custom-cdp-domain
Feb 22, 2026
Merged

feat: added browser-use custom CDP domain + version bump#5
reformedot merged 12 commits intomainfrom
feat/custom-cdp-domain

Conversation

@reformedot
Copy link
Copy Markdown
Collaborator

@reformedot reformedot commented Aug 25, 2025

Added browser-use custom CDP domain + option to define CDP version + updated specification


Summary by cubic

Adds a custom BrowserUse CDP domain with captcha events and ActiveTargetChanged, and lets us pin the CDP spec version. Updates the generator, syncs to the latest CDP, and adds linting, tasks, and packaging improvements.

  • New Features

    • BrowserUse events: captchaSolverStarted, captchaSolverFinished (adds success: bool), ActiveTargetChanged.
    • Pin CDP protocol via CDP_VERSION; generator pulls custom JSONs from cdp_use/custom_protocols/.
    • Protocol sync highlights: CSS.getEnvironmentVariables; DOM.forceShowPopover and new DOM events; Emulation multi‑screen APIs; Network.emulateNetworkConditionsByRule; Media.playerCreated (replaces playersCreated); Storage.getStorageKey (deprecates getStorageKeyForFrame); Target.getDevToolsTarget/openDevTools.
    • Generator/runtime: event registry now supports awaitable and sync handlers; cleaner outputs; client uses get_running_loop.
    • Tooling/packaging: Ruff lint (uv) workflow, Taskfile (generate/build/install/lint/format/format-json/example/clean), py.typed, metadata updates, version bump to 1.4.5.
  • Migration

    • Pinning: set CDP_VERSION in cdp_use/generator/constants.py and re-run the generator.
    • Custom protocols: add JSONs under cdp_use/custom_protocols/ and re-run the generator.
    • API changes: listen to Media.playerCreated instead of PlayersCreated; use Storage.getStorageKey; include success in BrowserUse.captchaSolverFinished payloads.

Written for commit 5bd5e01. Summary will update on new commits.

@reformedot reformedot requested review from gregpr07 and pirate August 25, 2025 08:57
@reformedot
Copy link
Copy Markdown
Collaborator Author

Important files to review are in:
cdp_use/cdp/browseruse/* and cdp_use/custom_protocols/browseruse.json

@gregpr07 @pirate

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 41 files

@reformedot
Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented Nov 26, 2025

@cubic-dev-ai review this

@reformedot I've started the AI code review. It'll take a few minutes to complete.

@reformedot reformedot removed the request for review from pirate November 26, 2025 19:26
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 279 files (reviewed changes from recent commits).

Note: This PR contains a large number of files. cubic only reviews up to 150 files per PR, so some files may not have been reviewed.

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="cdp_use/cdp/accessibility/types.py">

<violation number="1" location="cdp_use/cdp/accessibility/types.py:182">
Fix the typo in the AXPropertyName docstring so it reads &quot;node&quot; instead of &quot;noode&quot; to keep the generated documentation accurate.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Comment thread cdp_use/cdp/accessibility/types.py
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 286 files

Note: This PR contains a large number of files. cubic only reviews up to 150 files per PR, so some files may not have been reviewed.

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="Taskfile.yml">

<violation number="1" location="Taskfile.yml:33">
format-json fails when no custom protocol files exist because the unmatched glob is treated as a literal path. Add a guard so the loop skips/terminates when no files match.</violation>
</file>

<file name="cdp_use/cdp/accessibility/types.py">

<violation number="1" location="cdp_use/cdp/accessibility/types.py:182">
The new docstring line describing hidden-node reasons contains a typo (“noode” instead of “node”), which should be corrected for clarity.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Comment thread Taskfile.yml
desc: "Format JSON protocol files"
cmds:
- |
for file in cdp_use/custom_protocols/*.json; do
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format-json fails when no custom protocol files exist because the unmatched glob is treated as a literal path. Add a guard so the loop skips/terminates when no files match.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Taskfile.yml, line 33:

<comment>format-json fails when no custom protocol files exist because the unmatched glob is treated as a literal path. Add a guard so the loop skips/terminates when no files match.</comment>

<file context>
@@ -0,0 +1,46 @@
+    desc: &quot;Format JSON protocol files&quot;
+    cmds:
+      - |
+        for file in cdp_use/custom_protocols/*.json; do
+          python3 -m json.tool &quot;$file&quot; &quot;$file.tmp&quot; &amp;&amp; mv &quot;$file.tmp&quot; &quot;$file&quot;
+        done
</file context>

✅ Addressed in b3ee5c0

Comment thread cdp_use/cdp/accessibility/types.py
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 issues found across 255 files (changes from recent commits).

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cdp_use/cdp/dom/commands.py">

<violation number="1" location="cdp_use/cdp/dom/commands.py:243">
P3: Fix the typo in the docstring (“attibutes” → “attributes”) to keep documentation accurate.</violation>
</file>

<file name="cdp_use/cdp/dom/events.py">

<violation number="1" location="cdp_use/cdp/dom/events.py:151">
P3: Fix the misspelling in the distributed nodes comment.</violation>
</file>

<file name="cdp_use/cdp/css/events.py">

<violation number="1" location="cdp_use/cdp/css/events.py:25">
P2: FontsUpdatedEvent is now an empty TypedDict, but the CDP spec defines a `font` field for this event. This change drops the event payload (FontFace) that clients should receive.</violation>
</file>

<file name="cdp_use/cdp/debugger/commands.py">

<violation number="1" location="cdp_use/cdp/debugger/commands.py:138">
P2: SetScriptSourceParameters drops the optional `allowTopFrameEditing` field that CDP still documents for Debugger.setScriptSource.</violation>

<violation number="2" location="cdp_use/cdp/debugger/commands.py:156">
P2: exceptionDetails should be optional in EvaluateOnCallFrameReturns; the protocol only includes it when an exception occurs.</violation>

<violation number="3" location="cdp_use/cdp/debugger/commands.py:189">
P2: EvaluateOnCallFrameParameters drops the optional `timeout` parameter, but CDP still supports it. This removes a documented option from the generated typing and blocks callers from using timeouts.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread cdp_use/cdp/css/events.py Outdated
Comment thread cdp_use/cdp/debugger/commands.py
"""Whether the operation was successful or not. Only `Ok` denotes a
successful live edit while the other enum variants denote why
the live edit failed."""
exceptionDetails: "ExceptionDetails"
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: exceptionDetails should be optional in EvaluateOnCallFrameReturns; the protocol only includes it when an exception occurs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cdp_use/cdp/debugger/commands.py, line 156:

<comment>exceptionDetails should be optional in EvaluateOnCallFrameReturns; the protocol only includes it when an exception occurs.</comment>

<file context>
@@ -201,146 +135,86 @@ class SearchInContentReturns(TypedDict):
+    """Async stack trace, if any."""
+    asyncStackTraceId: "StackTraceId"
+    """Async stack trace, if any."""
+    exceptionDetails: "ExceptionDetails"
+    """Exception details if any."""
 
</file context>
Suggested change
exceptionDetails: "ExceptionDetails"
exceptionDetails: "NotRequired[ExceptionDetails]"
Fix with Cubic

Comment thread cdp_use/cdp/debugger/commands.py Outdated
Comment thread cdp_use/cdp/dom/commands.py Outdated
Comment thread cdp_use/cdp/dom/events.py Outdated
@reformedot
Copy link
Copy Markdown
Collaborator Author

@cubic review this

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented Feb 22, 2026

@cubic review this

@reformedot I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 312 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cdp_use/cdp/accessibility/commands.py">

<violation number="1" location="cdp_use/cdp/accessibility/commands.py:17">
P2: GetPartialAXTreeParameters no longer models backendNodeId/objectId and makes nodeId required, but the CDP spec allows any of nodeId/backendNodeId/objectId optionally. This breaks the protocol typing and blocks valid calls that identify nodes by backendNodeId/objectId.</violation>
</file>

<file name="cdp_use/cdp/dom/registration.py">

<violation number="1" location="cdp_use/cdp/dom/registration.py:240">
P3: Fix the typo in the distributedNodesUpdated docstring ("distrubution" → "distribution").</violation>
</file>

<file name="cdp_use/cdp/dom/events.py">

<violation number="1" location="cdp_use/cdp/dom/events.py:91">
P3: Fix the typo in the previous sibling description to keep the event documentation accurate.</violation>

<violation number="2" location="cdp_use/cdp/dom/events.py:151">
P3: Fix the spelling in the distributedNodes description.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread cdp_use/cdp/accessibility/commands.py Outdated
Comment thread cdp_use/cdp/dom/registration.py Outdated
Comment thread cdp_use/cdp/dom/events.py Outdated
Comment thread cdp_use/cdp/dom/events.py Outdated
@reformedot
Copy link
Copy Markdown
Collaborator Author

@cubic check this out

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented Feb 22, 2026

@cubic check this out

@reformedot I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 70 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="cdp_use/cdp/accessibility/types.py">

<violation number="1" location="cdp_use/cdp/accessibility/types.py:100">
P3: Fix the typo in the docstring ("noode" → "node") to keep the generated type documentation readable.</violation>
</file>

<file name="cdp_use/cdp/network/types.py">

<violation number="1" location="cdp_use/cdp/network/types.py:476">
P2: Cookie.expires is documented as nullable, but the type annotation is still a plain float. This makes the type definition inconsistent with the documented payloads and will reject valid null values during typing/validation. Consider allowing None in the type (e.g., float | None).</violation>
</file>

<file name="cdp_use/generator/registry_generator.py">

<violation number="1" location="cdp_use/generator/registry_generator.py:85">
P2: handle_event only awaits handlers detected by inspect.iscoroutinefunction, so async callable objects/partials won’t be awaited and their coroutines are dropped. Invoke the handler first and await the result when it’s awaitable to avoid silently skipping async handlers.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"""Cookie expiration date as the number of seconds since the UNIX epoch."""
"""Cookie expiration date as the number of seconds since the UNIX epoch.
The value is set to -1 if the expiry date is not set.
The value can be null for values that cannot be represented in
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Cookie.expires is documented as nullable, but the type annotation is still a plain float. This makes the type definition inconsistent with the documented payloads and will reject valid null values during typing/validation. Consider allowing None in the type (e.g., float | None).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cdp_use/cdp/network/types.py, line 476:

<comment>Cookie.expires is documented as nullable, but the type annotation is still a plain float. This makes the type definition inconsistent with the documented payloads and will reject valid null values during typing/validation. Consider allowing None in the type (e.g., float | None).</comment>

<file context>
@@ -469,7 +471,10 @@ class Cookie(TypedDict):
-    """Cookie expiration date as the number of seconds since the UNIX epoch."""
+    """Cookie expiration date as the number of seconds since the UNIX epoch.
+The value is set to -1 if the expiry date is not set.
+The value can be null for values that cannot be represented in
+JSON (±Inf)."""
     size: "int"
</file context>
Fix with Cubic

Comment thread cdp_use/generator/registry_generator.py Outdated
- from 'checked' to 'selected': states which apply to widgets
- from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling."""
- from 'activedescendant' to 'owns': relationships between elements other than parent/child/sibling
- from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden"""
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Fix the typo in the docstring ("noode" → "node") to keep the generated type documentation readable.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cdp_use/cdp/accessibility/types.py, line 100:

<comment>Fix the typo in the docstring ("noode" → "node") to keep the generated type documentation readable.</comment>

<file context>
@@ -90,13 +90,14 @@ class AXValue(TypedDict):
 - from 'checked' to 'selected': states which apply to widgets
-- from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling."""
+- from 'activedescendant' to 'owns': relationships between elements other than parent/child/sibling
+- from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden"""
 
 
</file context>
Suggested change
- from 'activeFullscreenElement' to 'uninteresting': reasons why this noode is hidden"""
- from 'activeFullscreenElement' to 'uninteresting': reasons why this node is hidden"""
Fix with Cubic

@reformedot
Copy link
Copy Markdown
Collaborator Author

@cubic check this out man!

@cubic-dev-ai
Copy link
Copy Markdown

cubic-dev-ai Bot commented Feb 22, 2026

@cubic check this out man!

@reformedot I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 70 files

@reformedot reformedot merged commit 8512c59 into main Feb 22, 2026
6 checks passed
@reformedot reformedot deleted the feat/custom-cdp-domain branch February 22, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant