Skip to content

refactor(cli): restore Stagehand V4 command parity - #2868

Merged
shrey150 merged 3 commits into
agent/browse-v4-4-runtimefrom
agent/browse-v4-standard-commands
Aug 31, 2026
Merged

refactor(cli): restore Stagehand V4 command parity#2868
shrey150 merged 3 commits into
agent/browse-v4-4-runtimefrom
agent/browse-v4-standard-commands

Conversation

@shrey150

@shrey150 shrey150 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Restore the standard Browse command surface on top of #2834's isolated Stagehand V4 browser/session foundation.

  • Navigation: open/back/forward/reload and wait.
  • Page information: snapshot, get/is, HTML/markdown, viewport, screenshot, and eval.
  • Element actions: click, fill, select, upload, and highlight through V4 locators—without act() or a model.
  • Input: keyboard/type/press and raw mouse operations.
  • Tabs: list/new/switch/close with V4 async page/context APIs.
  • Omit undefined optional values from V4 RPC payloads.

Cursor and network deliberately remain explicit stack gaps. The legacy coordinate returnXPath request is still accepted but fails explicitly until #2835 removes the option.

Stack (#2870)

  1. chore(cli): import Browse V3 baseline #2833 — exact Browse V3 baseline import
  2. refactor(cli): migrate Browse runtime and commands to Stagehand V4 #2834 — Stagehand V4 browser/session foundation
  3. refactor(cli): restore Stagehand V4 command parity #2868 — standard V4 command parity
  4. feat(cli): restore cursor overlay through page.evaluate #2869 — CLI-owned cursor overlay
  5. fix(cli): restore V3 network capture through a CDP sidecar #2849 — CLI-private CDP sidecar; V3 network parity
  6. refactor(cli): remove coordinate XPath return flag #2835 — remove --return-xpath; supported V3 parity/release checkpoint
  7. test(evals): exercise the workspace V4 CLI #2838 — eval and packaging integration
  8. fix(cli): persist context names in Browserbase #2839 — managed Context names (fast-follow)
  9. refactor(cli): consume shared Functions core #2701 — shared Functions core consumer (fast-follow)

Why this is separate

This is the large, mechanical V3-to-V4 command translation layer. It can be reviewed against a stable lifecycle below it and exercised without mixing in cursor DOM code or private CDP transport. The test additions are correspondingly command-focused.

E2E verification

The actual built CLI was run against a synthetic page in a real Browserbase browser; the same implementation is on final head 1f13d2ba24:

Flow Observed result
Open and read page <h1> returned Ready
Fill and read input Returned Ada
Select and read option Returned b
Click checkbox and query state checked: true
Click button and read result Returned Clicked
Viewport and screenshot Screenshot written, 8,130 bytes
Tabs new/list/close Count changed 1 → 2 → 1
Cursor, network, and coordinate XPath gaps Each failed explicitly as designed
Supported commands and cleanup Exit 0; Browserbase session stopped
pnpm --filter browse lint Prettier, ESLint, and TypeScript passed
pnpm --filter browse test 25 files / 381 tests passed

The fixture is synthetic and deterministic; no LLM path is involved.

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1f13d2b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@shrey150
shrey150 merged commit 1f13d2b into main Aug 31, 2026
23 checks passed
@shrey150

Copy link
Copy Markdown
Contributor Author

Superseded by the combined review boundary in #2834. The #2868 head and commits were fast-forwarded unchanged into #2834, so GitHub correctly marked this PR merged when its head became reachable from its base. This removes the temporary delete/stub/re-add review churn while preserving separate lifecycle and command commits inside #2834. The next stack PR is now #2869 directly on #2834.

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