Re-integrates the WSL parallel-backends renderer onto upstream's rewritten
connection/RPC architecture (#2978), which deleted the saved-env / environmentApi
/ serverState / wsConnectionState subsystem this branch was built on.
Core (packages/client-runtime/connection):
- Add dynamic platform-managed bearer environments: a PlatformConnectionRegistration
union (Primary|Bearer) and registry.reconcilePlatform(set), which adds/removes
platform-managed environments as the host topology changes and stashes the bearer
credential. This models the dual-mode WSL secondary (separate loopback origin,
bearer auth, dynamic port so it is rederived rather than persisted). The primary
and the WSL-only primary keep the same-origin cookie path.
Web platform source (apps/web/src/connection/platform.ts):
- Emit the platform set from the plural getLocalEnvironmentBootstraps() IPC: the
primary (cookie) plus each WSL backend (bearer via bootstrap-token exchange),
polling and reconciling on toggle. Replaces the deleted 541-line reconciler.
Renderer re-home:
- Drop the old subsystem (environmentApi, rpc/serverState, rpc/wsConnectionState,
environments/runtime/*, environments/local/*) and their tests.
- Re-home the Sidebar cold-boot indicator, the ConnectionsSettings WSL picker, and
the multi-environment provider-update feature onto the new hooks (useEnvironments,
serverEnvironment.updateProvider, the primaryServer* atoms). Desktop-local
environments are identified by a BearerConnectionTarget with a "local:"
connection id.
- Drop the inert swap-suppression surface superseded by parallel backends.
Verified: typecheck (web, desktop, client-runtime), connection / provider /
localApi / authBootstrap tests, and lint all pass.
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 previous change made activate ignore the connecting splash so a
failed post-readiness open would retry instead of latching onto it. That
regressed the cold-boot case: before the backend is ready,
createMainIfBackendReady is a no-op, so taskbar/dock activation while the
splash was hidden or minimized left the user with nothing until the
backend finished.
Branch activate on backend readiness: reveal the real main if present;
while still cold-booting (not ready) re-reveal the splash; once ready,
fall through to createMainIfBackendReady so the failed-open retry is
preserved.
Share the fake-ElectronWindow setup between the splash regression tests
via makeSplashScenario, and add a test that activation during cold boot
re-reveals the splash without creating a window.
The connecting splash is a real BrowserWindow, so currentMainOrFirst /
focusedMainOrFirst (which fall back to "any first window") return it
while the app is still booting. Only createMainIfBackendReady excluded
it; ensureMain, revealOrCreateMain, activate, and dispatchMenuAction
still treated it as the main window.
The backend pool deliberately swallows window-open errors raised after
backend readiness (so they cannot block restartAttempt reset). In
WSL-only mode a failed main open therefore left the splash up with no
real main while the backend was ready, and activation only re-revealed
the splash and never retried the open, stranding the user on
"Connecting to WSL".
Centralize splash exclusion in a withoutSplash helper and route every
main-window lookup (currentMainWindow / focusedMainWindow) through it, so
activate retries the open instead of latching onto the splash.
dispatchMenuAction now falls back to ensureMain rather than createMain to
avoid opening a duplicate main when one already exists.
Add a regression test: a swallowed post-readiness open failure leaves
only the splash, and activate must bring up the real main.
In WSL-only mode the renderer is served by the WSL backend (distro IP),
so the main window cannot load until WSL has cold-booted. That left the
app with no window at all for several seconds after launch, which reads
as a hang.
Show a lightweight frameless "Connecting to WSL" splash window as soon
as bootstrap starts (gated on wslOnly + wslBackendEnabled), and dismiss
it the moment the real main window reveals. Dual mode opens fast off the
Windows primary, so no splash is shown there.
- DesktopWindow: add showConnectingSplash, tracked in its own
splashWindowRef so currentMainOrFirst and createMainIfBackendReady
never mistake the splash for the real main window; dismiss on reveal.
- DesktopApp bootstrap: trigger the splash before primary start when the
persisted settings select WSL-only mode.
- Drop the now-unused DesktopState import left over from the
backendReadyRef refactor.
- Add shared compact subheader styling for preview, file, and diff panels
- Open diff files in the thread file viewer when available
- Fix macOS cursor auto-hide and Option-modified shortcut matching