Skip to content

refactor(cli): consume shared Functions core - #2701

Draft
shrey150 wants to merge 1 commit into
agent/browse-v4-7-context-namesfrom
agent/use-functions-core
Draft

refactor(cli): consume shared Functions core#2701
shrey150 wants to merge 1 commit into
agent/browse-v4-7-context-namesfrom
agent/use-functions-core

Conversation

@shrey150

@shrey150 shrey150 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Make Browse a thin Oclif adapter over the canonical @browserbasehq/sdk-functions/core library.

  • Remove roughly 1,300 lines of duplicate archive, HTTP, polling, scaffold, and local-runtime logic.
  • Preserve Browse flags, structured JSON, telemetry classification, exit codes, stderr logging, and signal ownership.
  • Carry the SDK-compatible --api-url/-u alias and optional --project-id behavior that fix(cli): align Functions with SDK on v3 CLI #2704 hotfixed only on the V3 release branch.
  • Keep bb functions and Browse on one implementation so they cannot drift independently again.

Stack (#2872)

  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 runtime and standard command parity
  3. feat(cli): restore cursor overlay through page.evaluate #2869 — CLI-owned cursor overlay
  4. fix(cli): restore V3 network capture through a CDP sidecar #2849 — CLI-private CDP sidecar; V3 network parity
  5. refactor(cli): remove coordinate XPath return flag #2835 — remove --return-xpath; supported V3 parity/release checkpoint
  6. test(evals): exercise the workspace V4 CLI #2838 — eval and packaging integration
  7. fix(cli): persist context names in Browserbase #2839 — managed Context names (fast-follow)
  8. refactor(cli): consume shared Functions core #2701 — shared Functions core consumer (fast-follow)

Dependency and release gate

This PR depends on sdk-functions-node #40, which exposes and hardens the shared core. The catalog is temporarily pinned to exact tested SDK commit 097ad455f4af8ca2f4932da7641373d77963d2d1; the Git dependency requires its prepare build and a temporary pnpm allowBuilds entry.

Keep this PR draft and do not merge or publish Browse from the commit pin. After @browserbasehq/sdk-functions@1.1.0 is published:

  1. Replace the catalog pin with ^1.1.0.
  2. Remove the temporary allowBuilds entry and TODO.
  3. Regenerate the lockfile from a clean install.
  4. Rerun frozen install, the full matrix, package/consumer checks, and fresh npm/pnpm scaffold live-cloud smokes.

Review boundary

The SDK core owns scaffolding, safe archive construction, Functions HTTP operations, project inference/override, build/invocation polling, local runtime, and typed failures. This PR owns only Oclif flags, Browse output/telemetry/error adaptation, signals, and dependency wiring. A contract test verifies that importing the /core subpath does not execute the Commander CLI.

E2E verification

Current remote head: 7197805bceed223120406c2828883e61327a8e2f. The complete Stagehand matrix below ran at 19b899d63ef3b3fb8cc40613e512c04297fc77e8; the only inherited change since then is #2849's test-helper timeout diagnostic, whose focused network tests and Browse lint/typecheck passed at sidecar head 9887732b6.

Flow Observed result
Exact SDK #40 lint/build/unit Passed; 66/66 SDK tests
Exact SDK #40 packed-tarball suite 58/58 across ESM, CJS, declarations, CLI, scaffold, manifest, and a TypeScript consumer
Exact SDK #40 live cloud matrix 4/4 starter templates packed, published, built, and invoked successfully
Stagehand frozen install with exact SDK pin Passed under pnpm 11.10
Fully verified head Stagehand SDK + Browse build and Browse lint/typecheck Passed
Fully verified head Functions adapter contracts 15/15 passed
Fully verified head full Browse suite 27 files / 394 tests passed
Fully verified head local dev with real Browserbase Runtime connected, invoked a managed browser against a public page, returned live page data, and the CLI exited successfully on shutdown
Browse adapter cloud interoperability Browse publish + sync invoke, async invoke/status, and cross-host bb invocation all returned the same synthetic result

Live validation used synthetic functions and public targets. Secrets, account identifiers, resource IDs, and connection URLs are omitted. A fresh registry install of eventual 1.1.0 remains mandatory and is why this PR stays draft.

@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7197805

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
browse Patch

Not sure what this means? Click here to learn what changesets are.

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

Replace Browse's parallel Functions implementation with @browserbasehq/sdk-functions/core adapters while preserving Browse command flags, output, telemetry, and error mapping.
@shrey150
shrey150 force-pushed the agent/use-functions-core branch from 19b899d to 7197805 Compare September 11, 2026 20:19
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