refactor(cli): migrate Browse runtime to Stagehand V4 - #2834
Draft
shrey150 wants to merge 12 commits into
Draft
Conversation
|
This was referenced Aug 27, 2026
shrey150
force-pushed
the
agent/browse-v4-4-runtime
branch
from
August 28, 2026 02:52
7e9c944 to
34c5c7d
Compare
This was referenced Aug 28, 2026
…runtime # Conflicts: # packages/cli/src/lib/driver/commands/elements.ts # packages/cli/src/lib/driver/commands/keyboard.ts # packages/cli/src/lib/driver/commands/mouse.ts # packages/cli/src/lib/driver/commands/navigation.ts # packages/cli/src/lib/driver/commands/page-info.ts # packages/cli/src/lib/driver/commands/runtime.ts # packages/cli/src/lib/driver/commands/tabs.ts # packages/cli/src/lib/driver/daemon/client.ts # packages/cli/src/lib/driver/network-capture.ts # packages/cli/src/lib/driver/remote-types.ts # packages/cli/src/lib/driver/remote.disabled.ts # packages/cli/src/lib/driver/remote.ts # packages/cli/src/lib/driver/session-manager.ts # packages/cli/tests/driver-commands.test.ts # packages/cli/tests/driver-foundation.test.ts # packages/cli/tests/identity-attribution.test.ts # packages/cli/tests/remote-disabled.test.ts # packages/cli/tests/remote-options.test.ts # pnpm-lock.yaml # turbo.json
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
Migrate the exact Browse V3 baseline from #2833 onto the workspace Stagehand V4 SDK while preserving the existing CLI surface.
Stagehand.create().act()or a model.page.evaluate()snippet.Stack
--return-xpath; complete supported V3 parityReview boundary
This PR carries the reviewable V4 runtime migration with two explicit stack boundaries.
browse network onreportsnetwork_capture_unavailableuntil #2849 supplies the CLI-private CDP sidecar, and the legacy coordinate-action--return-xpathoption is accepted but fails clearly until #2835 removes it. XPath selectors and snapshotxpathMapremain supported throughout.This does not add model-free structured
act()to core Stagehand. Browse's clicks are deterministic locator operations and do not require a model.E2E Test Matrix
All flows below used the actual built CLI against real local Chromium on this PR.
get/isHello V4Restack; refs and XPath selectors resolvedact()typewith no options, delay, and mistakesBareTypeWorks; all variants passed34c5c7d2fcursorinstalled__browse_cursor_overlay__; hover moved it to400px, 300px; the overlay contained its SVG at z-index2147483647page.evaluate()overlay and V4 coordinate input work together in real Chromiumnetwork onon rewritten headdf9111578network_capture_unavailable)mouse click ... --return-xpathCoordinate XPath lookup is not exposed by Stagehand V4df9111578Cursor proof
The screenshot above was captured from the built CLI on this PR after
browse cursorandbrowse mouse hover 400 300; the DOM assertion returned{ left: "400px", top: "300px", svg: true }.Browserbase remote mode is covered by the retained unit/contract tests; this local E2E matrix exercises the full user command surface without consuming a remote session.