2. migrate existing npm installs to the compiled agent - #2165
Conversation
Refs ENG-6046; fixes #2165
Refs ENG-6046; fixes #2165
3111cde to
392d3e3
Compare
Prime Agent performance — completedPR Overall: 0 regressed · 0 improved · 17 no clear change.
Python runtime
Sandbox cost: ~$0.0712 — no inference calls. Methodology and samplesMain resolved at 2026-09-12T08:05:46.939799+00:00. Harness
|
|
[written by prime-agent, checked by snimu] |
|
[written by prime-agent, checked by snimu] |
e972bd6 to
2ccbac7
Compare
2ccbac7 to
e91abad
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fbf370e. Configure here.
88bd3b2 to
202b363
Compare
202b363 to
a6ecd39
Compare

This is part of the PR stack migrating us to use Bun to compile Prime Agent for releases. This makes supported installations self-contained, removing the need to download and install Node.js and npm packages separately.
This PR moves existing users to the compiled version after they update and open Prime Agent again. Settings, credentials, and conversations stay intact. Unsupported machines continue using Node.js, and failed migrations leave the existing installation working. The old Node.js installation files are kept for now.
Tested this by simulating upgrades from ten previous releases (0.7.2 through 0.7.4, 0.8.0 through 0.8.1, and 0.9.0 through 0.9.4) to a simulated Bun-compiled release, including skipping straight to a later release. Also tested Alpine, which has no supported compiled package in this stack and automatically stayed on Node.js. An existing npm 12 restriction requires a documented recovery command.
ENG-6046 · Stack: #2140 → #2165 → #2166.
Note
Medium Risk
Changes the default npm CLI entrypoint and can download artifacts and replace the user's public command symlink; failures are designed to fall back to Node, but botched handoff or races could briefly affect how
prime-agentis invoked.Overview
Adds an npm-to-native migration bridge so users on conventional global npm installs can move to the compiled agent after updating, without losing settings or breaking launches when migration cannot complete.
Release packing (when
--binary-diris set) makesdist/bundle/cli.jsthe bridge, renames the real Node CLI tocli-node.js, and shipsinstall.shplusnative-release.jsonin the npm tarball. On supported macOS/Linux global installs whosebinlink still points at the package, the bridge can download/activate a managed release via the existing installer (foreground interactive only), reuse an equal-or-newer managed build after validation, and hand off the public command symlink to the native launcher while keeping Node as fallback. Daemon workers,--help/--version, piped/JSON runs, offline mode, unsupported hosts, competing npm installs, and failed/cancelled migrations are explicitly excluded or deferred.Adds
readNativeInstallationhelpers, a long “Migration from npm” doc section (including npm 12EALLOWREMOTErecovery), changelog notes, a largenpm-native-bridgetest suite, and small agent-traces test waits so uploads finish logging before assertions.Reviewed by Cursor Bugbot for commit a6ecd39. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Migrate global npm installs to the compiled native agent launcher
migrationTargetin npm-native-bridge.ts: for eligible interactive foreground launches on Darwin/Linux conventional global npm layouts, it downloads or reuses a compatible managed native release, validates platform and executable version, and hands off the public command link to the native launcher.cli-node.js) when migration is skipped or fails; opt-outs, offline mode, unsupported hosts, daemon/worker/version/help launches, and competing command owners all stay on Node.readNativeInstallationandgetNativeInstallationin native-installation.ts to validate managed installation layout, launcher target, checksum marker, release metadata, platform, and source URL before accepting it.cli.jsand retain the Node CLI ascli-node.js, shipping the installer and release metadata alongside.Macroscope summarized a6ecd39.