Skip to content

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

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

refactor(cli): consume shared Functions core#2701
shrey150 wants to merge 7 commits 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 the shared core. The catalog is temporarily pinned to exact tested SDK commit c74bea65c3dd645470e0fc80e65cfff283310665; 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, archive rules, 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

Flow Observed result
SDK lint/build/unit Passed; 63/63 SDK tests
SDK packed-tarball suite 58/58 across ESM, CJS, declarations, CLI, scaffold, manifest, and TS consumer
SDK live templates 4/4 starter templates scaffolded, installed, published, built, and invoked
Stagehand frozen install with exact SDK pin Passed under pnpm 11.10
Current-head Browse lint/build Passed on 373e24061e
Current-head full Browse suite 27 files / 386 tests passed
Local dev with real credentials and no project env Connected, invoked a managed session, returned Example Domain, and cleaned up
Browse publish + synchronous invoke Build completed; invocation returned shared-core-ok
Async invoke + independent status lookup PENDING progressed to COMPLETED with the same result
Cross-host invoke Exact SDK #40 bb CLI invoked the Function published by Browse and got the same 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: 373e240

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

@shrey150
shrey150 force-pushed the agent/use-functions-core branch from 090cef8 to a7a72ab Compare August 28, 2026 19:38
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