Files
17ac74a90c fix: make npm shims relocatable, link Windows CRT statically and trust Homebrew helper dirs (#782)
* fix: make npm shims relocatable and forward signals through the launcher

Windows shims held the absolute install path, so a Volta staging move or
a non-ASCII profile path broke them, and the extensionless sh shim that
Git Bash runs kept the Node launcher. One contract in windows-bin.js now
writes .cmd (%~dp0), .ps1 ($PSScriptRoot) and the sh shim with a path
relative to the shim, all plain ASCII, and keeps the launcher when a
target cannot be carried safely.

The launcher left its native child running when it got SIGINT or SIGTERM.
Its child lifecycle is now an explicit state machine (starting, running,
stopping, done) with one transition function. It forwards every signal to
the child, waits for the child to exit, then mirrors the exit code or
re-raises the child's signal. An exhaustive test covers every event
sequence to depth 6; real runs cover the signals.

The launcher notice no longer suggests --allow-scripts, which npm 11
rejects.

Fixes #532
Fixes #618
Fixes #653
Supersedes #536
Supersedes #620
Supersedes #655
Supersedes #489

* fix: build from the workspace root on every OS and link the Windows CRT statically

A bare cargo build at the workspace root compiled the macOS, Windows and
Linux adapters on every host, so it failed on two of three. The default
members are now core and the CLI; the CLI pulls in the host adapter
through its target-gated dependency.

The Windows release imported VCRUNTIME140.dll and the dynamic UCRT, so on a
machine without the Visual C++ Redistributable it exited with
STATUS_DLL_NOT_FOUND and printed nothing. .cargo/config.toml now links the
CRT statically for MSVC targets. The release and dry-run workflows run
scripts/check-windows-crt-imports.py on the built exe, which fails on any
redistributable import, and CI runs its unit test.

On Apple Silicon Homebrew the clipboard helper was rejected twice: the
symlinked bin entry made the helper a symlink, and the group-writable
Cellar failed the ancestor check. Discovery now resolves the executable to
its real directory, and a directory writable only by the macOS admin group
is trusted next to root and the calling user. World-writable directories
without the sticky bit, other users' directories and other groups stay
untrusted, and the helper file keeps its no-group-or-world-write rule.

Fixes #510
Fixes #542
Fixes #629
Supersedes #515
Supersedes #543

* test: pin the launcher lifecycle states

* test: require the admin group in the helper trust integration test

* refactor: replace the CRT import checker with a short byte scan and fold the trust rule into its module

The 168-line Python PE parser and its test become a six-line PowerShell scan
for runtime DLL names, which fails on the unflagged exe and passes on the
static one. The 19-line directory trust file moves into the helper identity
module that owns it, with its tests.

* fix(npm): raise thin-wrapper package size limit to 40 KB

Relocatable Windows shims and the signal-forwarding launcher bring the unpacked npm package to 27,410 bytes across its five JS/JSON files, exceeding the old 25 KB thin-wrapper check.

* chore: update yanked pin-project-lite to 0.2.19 in Cargo.lock

* fix: stage macOS clipboard helper from group-writable dirs and match suffixed CRT DLLs

Staging verified open-fd helper bytes into a private 0700 directory closes the cross-UID swap race in Homebrew admin-group directories, and updating the CRT byte-scan regex catches suffixed DLL names such as VCRUNTIME140_1.dll and MSVCP140_1.dll.

* fix(macos): stage clipboard helper under canonical ACL-checked directory and verify fds

safe_base now returns the canonicalized base path after checking all ancestors for ownership, mode and mutating ACLs, and rejects any non-self ACL on the base, staging directory or staged executable via acl_get_fd_np before spawning.

* fix(ci): ensure Windows CRT scan exits 0 before version smoke test and sync default-members docs

Add explicit exit 0 to scripts/check-windows-crt-imports.ps1 and null-safe LASTEXITCODE guards in release.yml and release-dry-run.yml so the Windows binary smoke test runs, and align AGENTS.md and CONTRIBUTING.md with workspace default-members.

* fix(npm): keep Windows shims read-cmd-shim compatible and forward SIGHUP/SIGQUIT

Use read-cmd-shim's expected %~dp0\ and $basedir/ call shapes in generated Windows shims so npm relinking does not fail with ENOTASHIM/EEXIST, and forward SIGHUP and SIGQUIT in npm/bin/agent-desktop so terminating signals never orphan the native child.

* chore: credit co-authors for superseded PRs

Co-Authored-By: Rudy Mizrahi Celekli <47457359+rudycelekli@users.noreply.github.com>
Co-Authored-By: mola <229602071+Mola-maker@users.noreply.github.com>
Co-Authored-By: Shaikh Fardin <152140625+SrkianFardin25@users.noreply.github.com>
Co-Authored-By: Lixin2026 <126993554+2023Anita@users.noreply.github.com>
Co-Authored-By: Muhammad Abdullah Butt <168034895+1AbdullahButt@users.noreply.github.com>
Co-Authored-By: Ethereal49 <128294874+Ethereal49@users.noreply.github.com>

---------

Co-authored-by: Rudy Mizrahi Celekli <47457359+rudycelekli@users.noreply.github.com>
Co-authored-by: mola <229602071+Mola-maker@users.noreply.github.com>
Co-authored-by: Shaikh Fardin <152140625+SrkianFardin25@users.noreply.github.com>
Co-authored-by: Lixin2026 <126993554+2023Anita@users.noreply.github.com>
Co-authored-by: Muhammad Abdullah Butt <168034895+1AbdullahButt@users.noreply.github.com>
Co-authored-by: Ethereal49 <128294874+Ethereal49@users.noreply.github.com>
2026-12-02 19:28:33 -08:00
..