Skip to content

feat(browser): standalone executables without Node, with checksums and attestations - #155

Merged
william-monroy merged 3 commits into
mainfrom
feat/standalone-binary
Nov 22, 2026
Merged

william-monroy merged 3 commits into
mainfrom
feat/standalone-binary

Conversation

@william-monroy

@william-monroy william-monroy commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

turno-browser as one file per platform for machines without Node or npm, with SHA256SUMS and build provenance attestations on its GitHub release.

What it is

A Node.js 26 single executable application (SEA) with the turno-browser npm package (installed from the published tarball with its shrinkwrap, so the same dependency tree npm users get) mounted as a read-only virtual file system inside the executable (useVfs + vfsArchive, Node 26.9+). The package runs unchanged from there: patchright-core reads its files and require.resolves its own scripts as it does on disk. One executable is both programs: turno-browser <command> and turno-browser mcp (also when renamed turno-browser-mcp). When the package spawns process.execPath <script> (the background server, patchright-core's browser installer and its forked downloader, the trace viewer), the launcher runs that script, as node would.

Two things needed code:

  • setup and init printed .../dist/bin/mcp.js as the agent's command, a path that exists only inside the executable. In a SEA (node:sea isSea()), they now give <path>/turno-browser mcp --identity <id>, and isTurnoEntry recognizes that entry. turno-browser patch changeset.
  • Node 26.13's VFS handlers lack the callback writev/readv (vfs: createVfsHandlers() does not implement writev(fd, buffers, position) nodejs/node#66532, fixed on main after 26.13.1), so with the VFS mounted any fs.writev throws, real files included. A write stream uses it with several chunks queued, which is how patchright-core saves the Chrome for Testing download, so install-browser failed. The launcher detects the missing handler (a writev on an fd no file has throws a TypeError instead of reporting EBADF) and replaces fs.writev/fs.readv with one fs.write/fs.read; the mount is read-only, so a vector call is always for a real file. It turns itself off on a Node that has the handlers.

Comparison (measured)

macOS 26.5, Apple silicon, Chrome 157, turno-browser 0.9.0. The MCP session is initialize, tools/list and browser_navigate to a page on 127.0.0.1 in headless Chrome, with a sandbox HOME; Chrome's command line was checked for --use-mock-keychain --password-store=basic. Times from a folder outside ~/Documents (file scanning there added about 1 s to every start); three runs each.

(a) Node SEA + VFS, Node 26.13 (b) bun build --compile, Bun 1.3.14 (c) deno compile, Deno 2.9.6 (d) self-extracting sh + Node 26
patchright-core inside works fails at startup: ../package.json reads resolve to /$bunfs (ENOENT); with those patched, Cannot find package 'patchright-core' (the createRequire loads are not bundled) works works (files on disk)
install-browser dry run and a real download (369 MB into a scratch cache) work, with the writev fix not reached dry run works dry run works
MCP session end to end 31 tools, navigate ok, server and Chrome exit when stdin closes fails 31 tools, navigate ok, but the server does not exit when stdin closes and leaves Chrome running (7 processes) 31 tools, navigate ok, clean exit
executable size 142 MB (stripped node + 32 MB stored payload) 71 MB (does not run) 100 MB 47 MB file, 146 MB extracted to the cache on first run
download (zip) 47.7 MB 35.7 MB (gzip) 47 MB
--version, median of 7 0.52 s (0.75 s with a deflated payload) 0.08 s 0.14 s, first run 5.2 s (extraction)
MCP initialize 0.36 to 0.88 s 0.26 to 0.59 s 0.35 to 0.82 s
RSS: --version / server in a session 113-134 MB / 175-186 MB 69 MB / 152-156 MB 87 MB / 145-151 MB
cross-compile yes: executable points at the official Node of the target; darwin-x64, linux-x64 and win-x64 built on darwin-arm64; macOS targets need codesign (Apple silicon runs no unsigned code), so the build host is macOS --target --target one wrapper per OS; a single file on Windows needs a different wrapper

Baseline, plain Node 26 on the npm install: --version 0.22 s and 101 MB, initialize 0.56 to 1.2 s, server 155-165 MB. Bun as a runtime (not compiled) runs the package from disk fine (initialize 0.79 s, 215 MB), so (b)'s blocker is bundling, not Bun. Under Rosetta the darwin-x64 SEA answers --version and initialize, but navigate times out, the same as plain x64 Node under Rosetta, so the native macos-15-intel smoke job is what checks x64.

Choice

(a), Node SEA with the VFS. It is the only single file that runs the MCP session end to end and shuts down cleanly, keeps the npm package byte for byte (no bundler, no patched sources), builds every target from one host, and stays on the Node line the package already supports. Deno is close and starts faster, but it leaves Chrome running when the agent goes away, which is what turno-browser exists to prevent; Bun would need source changes in turno-browser and in how patchright-core is loaded. The VFS is "Early development" in Node 26 and needed the writev workaround; the Node release is pinned (scripts/standalone-node.json, with the SHA-256 of each archive) and moves only on purpose.

Built by scripts/standalone-build.mjs here (all four targets in 87 s on the laptop): darwin-arm64 142.3 MB / 47.7 MB zip, darwin-x64 147.0 / 50.0, linux-x64 184.2 / 55.8 (not stripped: ELF from a macOS host), win-x64 133.7 / 47.1. Two builds from the same input give the same SHA256SUMS. Checked locally with the built darwin-arm64 executable: the MCP session above, a real install-browser and a navigate on that Chrome for Testing, add, setup (prints the executable with mcp), and do <id> open / snapshot through a background server the executable spawned of itself, then background stop; no Chrome left behind.

Release integration

  • .github/workflows/standalone.yml: build on macos-15 (all targets, uploads the zips and SHA256SUMS as an artifact), smoke on macos-15, macos-15-intel, ubuntu-latest and windows-latest (--version and an MCP initialize, with no node on the PATH; Windows has continue-on-error), then release: actions/attest-build-provenance on the zips and gh release upload to turno-browser@<version>. Only release has write permissions and it runs no project code (Harden-Runner in block mode).
  • release.yml: the tag job outputs the turno-browser version it released; a new standalone job calls the workflow with the release artifact, so the executables hold the tarball that was published. It runs after npm publish and tagging, so a failure there cannot hold back npm.
  • workflow_dispatch (version, dry-run default true) builds a version already on npm for its existing release. A pull request that touches the workflow or scripts runs it as a dry run from the checkout: artifacts only, no attestation, no upload. This pull request's run is the dry run.

Dry run on this pull request

standalone run 45060591388: build on macos-15 packed this checkout and built all four targets; each smoke job checked its zip against SHA256SUMS and ran the executable with no node on the PATH; upload to the release was skipped (dry run). The standalone artifact (200 MB, the four zips and SHA256SUMS) is kept for 7 days.

Target Runner --version MCP initialize
darwin-arm64 macos-15 508 ms 629 ms
darwin-x64 macos-15-intel 1179 ms 1072 ms
linux-x64 ubuntu-latest 421 ms 574 ms
win-x64 (experimental) windows-latest 1106 ms 776 ms

The Windows executable starts and answers initialize, but nothing drives a browser on Windows yet, so it stays experimental until the Windows pull requests land.

Signing and trust

Not signed with a vendor certificate yet. macOS: ad hoc signature only, so a browser download is stopped by Gatekeeper; the docs give xattr -d com.apple.quarantine, or System Settings, Privacy & Security, Open Anyway (Control-click Open on macOS 14 and older); curl downloads carry no quarantine mark. Windows: unsigned, SmartScreen may warn (More info, Run anyway, or Unblock-File).

What signing would need, not added since it is not a simple step and needs accounts:

  • macOS Developer ID + notarization: an Apple Developer Program membership, a Developer ID Application certificate exported as .p12 (secret, plus its password), imported into a temporary keychain on the runner; codesign --options runtime --timestamp with entitlements Node needs under the hardened runtime (com.apple.security.cs.allow-jit, allow-unsigned-executable-memory); then xcrun notarytool submit of each zip with an App Store Connect API key (secret). A bare executable cannot be stapled, so Gatekeeper checks the ticket online on first run.
  • Windows Authenticode: a code signing certificate whose key lives in an HSM or a cloud signer (for example Azure Trusted Signing with its identity validation and an Azure app registration as secrets), signtool sign /fd SHA256 /tr <timestamp URL> on the .exe after the SEA blob is injected, before it is zipped.

Verify

shasum -a 256 -c SHA256SUMS --ignore-missing      # macOS
sha256sum -c SHA256SUMS --ignore-missing          # Linux
gh attestation verify turno-browser-darwin-arm64.zip --repo wimo-dev/turno

On Windows: Get-FileHash .\turno-browser-win-x64.zip -Algorithm SHA256.

Not in this pull request

  • Windows support itself (paths, processes, pipes, secrets) is in the Windows pull requests; until they land the win-x64 executable is built, smoke-tested with continue-on-error and documented as experimental.
  • The first release that carries the executables is the next turno-browser release; 0.9.0 can get them with the workflow_dispatch path (without the setup fix, which is in this pull request).
  • Docs: only the English Get started page and the README; the Spanish page is untouched.

@william-monroy
william-monroy marked this pull request as ready for review November 22, 2026 19:44
…ath> mcp

Inside the standalone executable (a Node.js single executable application) the package's files
live in a virtual file system, so the bin/mcp.js path setup and init printed did not exist for
the agent. There, mcpCommand returns the executable itself with "mcp" before --identity, and
isTurnoEntry recognizes that entry in an agent's config.
scripts/standalone-build.mjs builds turno-browser as a Node.js 26 single executable application
with its npm package (installed with the shrinkwrap) mounted as a read-only virtual file system:
darwin-arm64, darwin-x64, linux-x64 and win-x64 from one macOS host, with the pinned Node.js
archives checked against their SHA-256, the macOS executables stripped and signed ad hoc, and
reproducible zip archives plus SHA256SUMS. One executable serves the CLI and the MCP server
(turno-browser mcp), and runs the package's own scripts when the package spawns
process.execPath with one. The launcher replaces fs.writev and fs.readv while Node.js 26.13
lacks their VFS handlers (nodejs/node#66532), which broke install-browser's download.

standalone.yml builds on macOS, smoke-tests each platform (--version and an MCP initialize,
with no node on the PATH; Windows is experimental), then attests the archives and uploads them
to the turno-browser release. release.yml calls it after a turno-browser release with the
tarball it published; a maintainer can run it for a version on npm, and a pull request that
changes it runs it as a dry run.
The standalone executable in Get started and the README: download, check the SHA-256 and the attestation, the macOS Gatekeeper and Windows SmartScreen notes, and where it keeps its data. Windows is marked experimental.
@william-monroy
william-monroy merged commit 30e4617 into main Nov 22, 2026
20 checks passed
@william-monroy
william-monroy deleted the feat/standalone-binary branch November 22, 2026 20:05
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