Repository navigation
Conversation
Stop enabling the Runtime domain, which made Chromium preview console arguments in a way pages can observe. Run element helpers in an isolated world so page scripts cannot see or intercept them. Move the pointer along curved paths, hold buttons and keys, and type at a human pace, reusing the computer API's trajectory and typing cadence. Drop the synthetic input and change events from fillInput, and stop custom WebMCP from touching pages when no custom tools are registered.
Recover stale custom WebMCP registrations after an abrupt REPL exit with a dirty marker that is cleared only once every open page, including its isolated world, has been cleaned. Clear it on a graceful reset too. Check that an element is still under the parked pointer before pressing, within the original actionability deadline. Bound pointer path sampling and reject non-finite scroll coordinates. Fit typing pauses to the execution deadline using measured key command latency, and take no pauses while clearing a field.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f14fb1a. Configure here.
| } | ||
| if (at) { | ||
| const parked = deepElementFromPoint(at.x, at.y); | ||
| return parked && composedContains(el, parked) ? { status: 'ready', x: at.x, y: at.y } : { status: 'off target' }; |
There was a problem hiding this comment.
Parked click recheck requeries selector
Medium Severity
The post-move click check re-runs unique-match selector resolution before hit-testing the parked point. A hover that reveals another visible match is treated as multiple or can retarget a different element instead of asking whether the original target is still under the pointer.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit f14fb1a. Configure here.
| // Without its isolated world, a page may still hold CDP tool | ||
| // registrations from an earlier process; only disposing that world | ||
| // shows they are gone. | ||
| const isolatedDisposed = page.contextId !== null && |
There was a problem hiding this comment.
Recovery sweep misses leftover CDP world
Medium Severity
The dirty-marker recovery creates a new isolated world and treats disposing that world as proof leftover CDP tools are gone. Page.createIsolatedWorld does not return the previous process's context, so old document.modelContext registrations in the leftover world can survive while the marker is cleared.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit f14fb1a. Configure here.


Summary
Pages could tell the Browser REPL was driving them. This PR removes three of those signals and makes the REPL's input look human by default.
1. No
Runtime.enableenableDomainsno longer enables the Runtime domain. With it enabled, Chromium previews every console argument for the client, and a page can observe that preview through getters on the logged object. Nothing in the REPL consumedRuntime.*events. Evaluation works without the domain, and helper code gets its context fromPage.createIsolatedWorld(see 2).Custom WebMCP also stops enabling it.
Runtime.bindingCalledis delivered without the domain: a binding added withexecutionContextNamefires its event and stays invisible to the page's main world.2. Element helpers run in an isolated world
waitForElement,waitForLoad,pageInfo,click/fillInputtarget resolution, and the backend-node helpers (DOM.resolveNodewithexecutionContextId) evaluate in an isolated world on the attached target's main frame. The world shares the DOM but not the page's globals or prototypes, so page scripts that wrap methods likequerySelectorAll,getBoundingClientRectorscrollIntoViewno longer see helper calls, and can't read helper source throughFunction.caller.BrowserReplCdpClientcaches one world per attached document, drops it on a main-framePage.frameNavigated, and recreates it once if a command reports a missing context (the command never ran, so the retry can't repeat side effects).js()still evaluates in the page's own world, because callers use it to read page state. Its help text says so and points to the helpers for element work.3. Humanized input by default
humanize.tsports the computer API'slib/mousetrajectory(Bezier path with jitter and ease-out) andlib/typinghumanizer(word-chunked cadence, longer pauses between words and after sentences).clickmoves along a curved path from the pointer's last position on that target (a random viewport point the first time) and holds each button 60–120 ms. Points run on a wall-clock schedule and overdue points are skipped, so slowmouseMovedacknowledgements (~40 ms each) mean fewer events, not a longer move. A full-screen click takes ~1 s. For element targets, the click presses only while the element is still under the parked pointer; otherwise it moves to the element again, within the originaltimeoutSec.scrollmoves the pointer to the wheel position first, and rejects non-finite coordinates.typeTextsends key presses instead ofInput.insertText;\npresses Enter.fillInputtypes the same way and no longer dispatches syntheticinput/changeevents. Clearing (select-all, Backspace) takes no pauses.pressKeyholds the key between key-down and key-up.Typing pauses shrink to fit the cell's execution deadline, budgeting for the remaining keys' command time as measured so far, and command acknowledgement time counts toward the gap between keys. Path sampling is capped, so a huge coordinate can't allocate in proportion to its distance.
Timing differs from the computer API: the mouse step averages 10 ms instead of 20 ms and the path is capped at 80 points, which keeps clicks around a second.
4. Custom WebMCP leaves pages alone when no tools exist
Previously, every REPL start attached to each open http(s) page, enabled the Runtime domain there, created its isolated world, and left
window.__kernelCustomWebMCPPagebehind, even with no custom tools. Now:disposedeletes the page globals.Verification
make test-runtime: 74 pass. New tests cover the trajectory and typing math, the helper-world cache and retry, the absence ofRuntime.enable, click/typing command sequences, re-checking the target under the pointer, deadline fitting with a fake clock and nonzero command latency, and the custom WebMCP marker across failed attach, failed world setup, failed dispose, and graceful reset. Each regression test was confirmed to fail against the code before its fix.go vet ./cmd/api/...andgo test ./cmd/api/api/pass. The fake CDP server answersPage.createIsolatedWorld.TestBrowserReplRetriesCommandOnFreshConnectionCloseis intermittently flaky in full-package runs onmainas well, and passes alone.querySelectorAll,elementFromPoint,scrollIntoView,getBoundingClientRect,checkVisibility,focusand similar recorded zero calls acrosswaitForElement,waitForLoad,pageInfo, selector and accessibility-nodeclick,fillInput,typeTextandscroll.isTrusted;fillInputreplaced existing text correctly.cdpandpagetools invoked successfully (and, in an earlier run, through the page-side binding); removing them left no globals on the page.Not covered
The passkey hook (
lib/webauthnhook, while a passkey is armed) and telemetry (lib/cdpmonitor, when enabled) still enable the Runtime domain on their own connections.Reviewed with sol-loop: 6 rounds on extra-high reasoning. Sol verdict: approved.