feat(sdk): ship the extension build fingerprint in both SDK packages

Merged
MI
6d ago
+303-20

why

The release builds the extension once and checks its fingerprint in CI, but neither SDK package carries that fingerprint at run time. An SDK should be able to name the exact extension build it ships. Then a browser host that fetches a published build can be asked for that build and can check the bytes it loads against it. Nothing reads the fingerprint yet.

what changed

  • The npm package ships dist/assets/extension-build.json and the wheel ships stagehand/_extension_build.json. Both are copies of the build's extension-build.json.
  • Each SDK has an internal reader: getExtensionFingerprint() in TypeScript and _extension_fingerprint() in Python. The TypeScript path takes a STAGEHAND_EXTENSION_BUILD_INFO_PATH override, like the archive and directory paths next to it. A missing or malformed file fails with a clear error.
  • check-extension-build.ts requires each package's embedded file to match the release build byte for byte. If one differs, it prints both versions.
  • The wheel smoke test checks that the reader finds its file in an installed wheel.
  • The fingerprint definition is unchanged.
  • Adds a patch changeset for both SDKs.

test plan

  • Unit tests for both readers, the release check and the packed-package contract
  • Built the extension with just _build-release-extension, then the npm package and the wheel. Ran check-extension-build.ts --expect against both: it passes, and the embedded files are byte-identical.
  • A reformatted embedded file makes the check fail and print both versions
  • smoke.py passes against the installed wheel
  • typecheck, oxlint, oxfmt, ruff, ty, check-changesets

Summary by cubic

Ships the extension build fingerprint in both SDK packages so a browser host can verify the bytes it loads match a published build. The npm package now includes dist/assets/extension-build.json and the wheel includes stagehand/_extension_build.json. Each SDK adds an internal reader (getExtensionFingerprint() and _extension_fingerprint()) that validates the fingerprint format, and check-extension-build.ts now requires each package's embedded file to match the release build byte for byte. Nothing reads the fingerprint at runtime yet.