feat: expose reusable Functions core - #40
Draft
shrey150 wants to merge 3 commits into
Draft
Conversation
This was referenced Aug 13, 2026
shrey150
force-pushed
the
agent/extract-functions-core
branch
from
August 28, 2026 18:57
4d7db8b to
c74bea6
Compare
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.
BLUF
Expose the canonical Functions implementation as
@browserbasehq/sdk-functions/coreand makebb functionsa thin CLI adapter over it. Browse and future host CLIs can import one implementation instead of copying the Functions API/archive/runtime logic.Root cause and design
The Functions HTTP API did not make a breaking change. The SDK/CLI implementation evolved—scaffold metadata/dependencies, project inference, archive validation, local runtime behavior, invocation/build polling—and Browse retained an older parallel copy.
This PR creates a headless core boundary:
@browserbasehq/sdk-functions/core; importing it does not execute the bundledbbCLI.The public surface includes:
createFunctionProject,createFunctionArchive,listFunctionArchiveEntries,validateFunctionArchiveSize, andMAX_FUNCTION_ARCHIVE_SIZE_BYTES.publishFunction,getBuildStatus,invokeFunction, andgetInvocationStatus.startDevServerand its typed handle/options/log events.FunctionsCoreErrorwith stable error codes.Compatibility and package shape
@browserbasehq/sdk-functions/coreships ESM, CommonJS, and declarations from the existing package.@browserbasehq/sdk-functionsroot export andbbbinary remain intact.Review boundary
Review the reusable implementation and Commander-to-core adaptation here. The downstream Stagehand #2701 is a separate, top-of-stack V4 fast-follow containing only the Browse/Oclif adapters, dependency wiring, and host contract tests.
The branch is rebased on current SDK
main; exact tested head:c74bea65c3dd645470e0fc80e65cfff283310665.E2E test matrix
pnpm lintand buildpnpm testpnpm test:integrationagainst the packed tarballpnpm test:e2ewith real Functions credentialsbbinvocation passedLive validation used synthetic functions and public targets. Secrets, account identifiers, resource IDs, and connection URLs are intentionally omitted.
Release and rollout
This repository has CI but no automated npm release workflow. Because
./coreis a new public API, the recommended release is1.1.0:package.jsonandpnpm-lock.yamlto1.1.0.main, run frozen install, lint, unit, packed integration, build, and pack checks.npm view @browserbasehq/sdk-functions@1.1.0 exports --jsonincludes./core, then smoke-import both module formats.^1.1.0, remove the temporary build allowance, regenerate the lockfile, and rerun the full matrix including fresh npm and pnpm scaffold live-cloud smokes.Downstream #2701 is intentionally draft and must not be merged or published while it references the GitHub commit.