Same class as the ffi-rs fix. The WSL (Linux x64) backend loads fff's
native binary (through ffi-rs / fff-node), but resolveFffNativeDependencies
only promotes the host platform's fff binary (win32) to a direct staged
dep, so @ff-labs/fff-bin-linux-x64-gnu never shipped in the artifact. The
backend connects fine because fff loads lazily, but file-finding in WSL
would fail to load the missing binary.
For Windows builds, also promote the Linux x64 fff binaries (gnu + musl)
alongside the host's, reusing resolveFffNativeDependencies("linux", "x64").
Windows artifacts also ship the WSL (Linux x64) backend, which loads
Linux-native optional dependencies at runtime -- e.g. ffi-rs's
@yuuang/ffi-rs-linux-x64-gnu. The staged production install set pnpm's
supportedArchitectures to the host platform only (win32/x64), so just the
Windows bindings were fetched. The WSL backend then crash-looped on
require ("Cannot find module '@yuuang/ffi-rs-linux-x64-gnu'") and never
bound its port, surfacing in the app as "Couldn't connect WSL".
For Windows builds, extend supportedArchitectures to also include
linux/x64/glibc so the staged install pulls the Linux optional deps
alongside the Windows ones. Confirmed pnpm then fetches
@yuuang/ffi-rs-linux-x64-gnu into the staged tree.
Resolve scripts/build-desktop-artifact.ts: keep both our WSL node-pty
prebuild staging (decodeNodePtyManifest) and upstream's fff native binary
staging (encodeStageWorkspaceConfig / DESKTOP_ASAR_UNPACK), and collapse
the duplicated asarUnpack key the merge left behind into a single entry
that unpacks the fff native binaries, the server bundle, and the full
node_modules tree.
The WSL backend launches the server with the distro's own Linux Node, which
can't read inside app.asar. asarUnpack only covered the server bundle and
node-pty, but bin.mjs externalizes its runtime dependencies (effect, @effect/*,
...) to node_modules rather than inlining them. So the Linux Node crashed with
ERR_MODULE_NOT_FOUND ("Cannot find package 'effect'") before it even reached
node-pty, which left WSL-only mode unable to launch (the node-pty preflight had
already passed, so there was no Windows fallback).
Unpack the whole node_modules tree so every server import resolves on the real
filesystem. The Windows primary keeps reading the same files through the asar
via ELECTRON_RUN_AS_NODE, so there's no duplication.
In packaged builds the server bundle and node-pty were sealed inside app.asar,
which the WSL backend's Linux Node cannot read, so the WSL backend never started
in release builds. It dead-ended on a misleading "node-pty not prepared / run
prepare:wsl" error. node-pty also publishes no Linux prebuilt, and the Windows
artifact is built on a Windows CI runner that cannot compile one.
- asarUnpack the server bundle and node-pty, and point the WSL backend at the
app.asar.unpacked sibling. The Windows primary still reads app.asar via
ELECTRON_RUN_AS_NODE, so it is unaffected and there is no payload duplication.
- Build the Linux pty.node in a dedicated Linux CI job and hand it to the
Windows packaging job as an artifact. build-desktop-artifact stages it into
node-pty/prebuilds/linux-<arch>/ with a marker, so the packaged app ships a
ready binary and needs no compiler, node-gyp, or network on first launch.
- node-pty is N-API, so one Linux binary works across all WSL Node versions;
drop the modules ABI comparison from the preflight probe accordingly.
- Runtime compile is now dev-only (allowBuild: !isPackaged). In packaged builds
a prebuilt that cannot load surfaces a clear arch/distro diagnostic instead of
nagging for build tools or silently compiling.