mirror of
https://github.com/vercel-labs/agent-browser.git
synced 2026-11-15 14:05:28 +08:00
* Ship native binaries as per-platform packages - Publish each platform binary as an @agent-browser/cli-* optional dependency, so installs download only the host's binary - Link the global command to the native binary on first run when install scripts are blocked (npm 12, pnpm, bun), and in postinstall when they run - Release and CI publish the platform packages and test global installs with scripts blocked and allowed * fix: link the native binary on pnpm 12 and keep skills resolvable Three fixes on top of the per-platform packaging work. relinkPnpmShim compared the shim's cmd-shim-target marker to argv[1] with string equality. On pnpm 12 the marker keeps the ./ from the package's "./bin/agent-browser.js" and argv[1] does not, so the shim was never rewritten and every command still started Node. It now compares resolved paths, which also covers the pnpm 10 and 11 spellings. The launcher spawned the binary straight out of the platform package. npm hoists that package beside agent-browser, so skills.rs, chat.rs and upgrade.rs, which resolve their files by walking up from the executable, found nothing. It now materializes into agent-browser/bin first and runs from there. postinstall only linked when npm_config_global was set, which only npm does, so pnpm, yarn and bun never linked at install time. It now asks the invoking manager for its global bin directory and also considers the enclosing node_modules/.bin, which Yarn Classic links through. The probe is skipped for local installs so they do not pay a subprocess. The Windows shims are rewritten in a format npm's read-cmd-shim can parse, each file's own target is checked before it is replaced, and replacement is staged then renamed so a failure leaves the working launcher in place. Verified with real global installs on macOS and Linux: npm with scripts allowed and blocked, pnpm 11 and 12, and bun. Yarn could not be verified locally because it fails when an optionalDependency is unresolvable and the platform packages are unpublished. Windows is unverified. * fix(pnpm): link the shim to the binary in the package bin The pnpm branch wrote the platform package's own path into the shim, so once that package resolved, the binary ran from a directory with no skills/ above it. It now links the same materialized path the symlink and Windows branches already use. --------- Co-authored-by: Lahfir <70215676+lahfir@users.noreply.github.com>