refactor(cli): port core browser plumbing to V4 - #2525
Draft
shrey150 wants to merge 5 commits into
Draft
Conversation
|
# Conflicts: # packages/cli/package.json # packages/cli/src/lib/driver/commands/tabs.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/identity-attribution.test.ts # packages/cli/tests/remote-options.test.ts
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
browsein the V4 pnpm lockfile and Turbo build/test graphCLI contract changes
Existing commands, flags, and successful JSON field names remain unchanged:
targetId, even though the V4 SDK calls the same underlying browser target identifierpageIdtimeoutMsremains the CLI navigation input and maps internally to V4'stimeoutbrowserbaseSessionId,browserbaseSessionUrl, and best-effortbrowserbaseDebugUrlremain present for remote sessionsOne runtime requirement changes:
browsenow requires Node.js 22.18.0 or newer, matching the V4 SDK.Stack boundary
This child ports the core browser/session plumbing only. The next child replaces the remaining V3 action, cursor, and network calls. Until that child lands, the full CLI build is expected to remain incomplete.
No Changeset is included because this stack targets the pre-release V4 spike.
E2E Test Matrix
CI=true corepack pnpm@11.10.0 install --frozen-lockfile --prefer-offlineon the exact commitcorepack pnpm@11.10.0 --dir packages/cli exec vitest run tests/remote-options.test.ts tests/remote-disabled.test.ts tests/identity-attribution.test.tstests/driver-foundation.test.tstests/driver-commands.test.tstimeoutMsmapping and V4 async tab close/selection while preserving publictargetIdoutputSummary by cubic
Ports the CLI’s browser/session plumbing to
@browserbasehq/stagehandV4, adopting async context/page APIs and V4browseroption shapes. CLI flags and output stay the same, Browserbase identity fields are preserved, and Node.js 22.18.0+ is required.Refactors
browseroptions (type: "local" | "cdp" | "browserbase") with logging off.deepLocatorwithlocator; use internalpageIdwhile continuing to outputtargetId.timeoutMsto V4timeoutand pass throughwaitUntilfor open/reload/back/forward.browserbaseSessionId,browserbaseSessionUrl, and best-effortbrowserbaseDebugUrlby resolving identity post-init withremoteBrowserbaseIdentityusing@browserbasehq/sdk.browse#buildto the Turbo graph and atest:unitscript.Migration
>=22.18.0is required to match@browserbasehq/stagehandV4.Written for commit eeb6d0b. Summary will update on new commits.