Resolve conflicts from upstream's Effect-service normalization batch while
preserving the WSL parallel-backend feature set.
Key resolutions:
- ipc/methods/window.ts: adopt the DesktopIpc.makeIpcMethod /
DesktopIpc.makeSyncIpcMethod namespace convention; keep our plural
getLocalEnvironmentBootstraps and the getLocalEnvironmentBearerToken
method.
- app/DesktopState.ts: adopt upstream's Context.Service class with
backendReady + quitting. The window keeps its own backendReadyRef, so
state.backendReady is unused but harmless.
- app/DesktopObservability.ts: keep our per-instance
DesktopBackendOutputLogFactory (per-instance backend logs are required
for parallel backends). Drop upstream's newly-extracted single-instance
DesktopBackendOutputLog.ts: zero consumers in this tree, fully
superseded by the factory (primary maps to forInstance(primary), same
server-child.log path).
- backend/DesktopBackendManager.test.ts: keep our factory-based harness.
Upstream's side provisioned the removed DesktopBackendManager.layer
service model (DesktopState / DesktopWindow / DesktopBackendConfiguration
deps), which no longer exists in this tree.
- Adapt DesktopObservability.ts + ipc/methods/wsl.test.ts to upstream's
removal of the standalone DesktopEnvironmentShape export: use
DesktopEnvironment.DesktopEnvironment["Service"] (the normalized form).
Verified: web + desktop typecheck clean; affected desktop tests pass
(DesktopObservability, DesktopBackendPool, DesktopBackendManager, wsl).
Brings in upstream's desktop-auth to Clerk-bridge migration (#3092) plus 9 other
commits. Resolution preserves the WSL parallel-backends work while adopting the
new primary-auth flow.
Contracts / IPC: keep our plural getLocalEnvironmentBootstraps; add upstream's
new getLocalEnvironmentBearerToken (primary bearer token) across the bridge,
preload, and the IPC channel / method / handlers.
Desktop:
- DesktopLocalEnvironmentAuth (upstream's new primary-auth service) now reads the
primary instance from our DesktopBackendPool instead of the removed legacy
DesktopBackendManager.
- main.ts composes both our WSL backend layer and the new local-environment-auth
and Clerk layers.
- DesktopWindow adopts upstream's local-client window loading (getDesktopUrl /
t3:// scheme) rather than loading the backend URL, dropping the now-obsolete
backend-URL plumbing. The "Connecting to WSL" splash is kept, re-pointed onto
the existing backend-ready latch (upstream's DesktopState.backendReady addition
did not land in this merge; the backend pool drives readiness through
handleBackendReady / handleBackendNotReady).
Web: keep our Layer.effect platform source (primary plus WSL secondaries); the
primary now authenticates via upstream's primaryEnvironmentHttpLayer and the
secondaries via FetchHttpClient.
Verified: typecheck (web, desktop), web tests (connection / provider /
authBootstrap / desktopAuth), desktop tests (DesktopWindow splash,
DesktopLocalEnvironmentAuth), and lint all pass.
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.
- Replace attachment and favicon routes with signed asset URLs
- Harden workspace and attachment asset resolution
- Update browser preview components and shared contracts
Adds a desktop-only browser preview that lives in the right panel slot
alongside plan/diff. Lets the user point an Electron <webview> at any
URL — typed into a chrome-style URL bar, clicked from the empty-state
list of detected localhost dev servers, or auto-opened by a project
script with `previewUrl` set. Single-tab per thread.
Server (Effect/Layers):
- PreviewManager: per-(thread, tab) session metadata via SynchronizedRef
+ PubSub<PreviewEvent>; survives WS reconnect via `list`/replay.
- PreviewPortScanner: lsof on macOS/Linux, TCP probe fallback on
Windows; reference-counted polling so we only scan when subscribed.
- WS RPC + streams (`preview.open|navigate|refresh|close|list|reportStatus`,
`subscribePreviewEvents`, `subscribeDiscoveredLocalServers`).
Desktop:
- PreviewViewManager owns Chromium WebContents per tab, mediates
navigation/zoom/devtools/clear-storage. registerWebview gates by
webContents.getType() === "webview" and host-window match.
- IPC channels for create/close/register/navigate/back/forward/refresh/
zoom/hardReload/openDevTools/clearCookies/clearCache/getBrowserPartition.
- Forwards app-level shortcuts (mod+shift+J, mod+K, mod+,, mod+W) from
the webview back to the main window.
- Persisted browser session partition (cookies, cache).
Web:
- PreviewPanel/PreviewView/PreviewWebview render the surface; chrome row
with back/forward/refresh + URL input + Open-in-browser + 3-dot menu
(Hard reload, DevTools, Zoom −/+/reset, Clear cookies/cache).
- usePreviewSession subscribes to server events; usePreviewBridge
mirrors desktop state into the store and forwards Loading→Success/
LoadFailed back to the server.
- previewStateStore: per-thread snapshot + desktopOverlay + recently-
seen URLs (Zustand).
- rightPanelStore arbitrates plan vs. preview vs. diff; ChatView's
toggles strip the `?diff=1` URL hint when switching to preview and
vice versa so the panels are mutually exclusive.
- Top-nav Globe toggle in ChatHeader (desktop builds only) and a
`mod+shift+J` keybinding routed via a typed previewActionBus.
- PreviewEmptyState lists detected localhost servers (scanner +
configured project URLs + recently-seen) with live "listening" pulse.
- PreviewUnreachable: theme-aware port of Chromium's "site can't be
reached" page.
- Resizable inline panel (RightPanelResizeHandle + useResizableWidth);
width persists to localStorage on drag-end.
- Terminal link "Open in preview" context-menu integration for loopback
URLs.
Contracts:
- preview.ts schemas (PreviewSessionSnapshot, PreviewNavStatus,
PreviewEvent, RPC inputs/results, DiscoveredLocalServer).
- ProjectScript schema gains optional `previewUrl` + `autoOpenPreview`.
- New keybinding commands: preview.toggle/refresh/focusUrl/zoomIn/Out/
resetZoom; new `when:` contexts `previewFocus` / `previewOpen`.
Shared:
- @t3tools/shared/preview: normalizePreviewUrl, isPreviewableUrl,
isLoopbackHost, newPreviewTabId, LSOF_LOCAL_HOST_TOKENS.
Tests:
- contracts: schema decode tests for all preview events/snapshots/inputs.
- shared: URL normalization coverage.
- server: PreviewManager (open/navigate/reportStatus/refresh/close,
multi-subscriber isolation, idempotency); PortScanner (lsof parsing
including IPv6, TCP probe, reference-counted polling).
- web: previewStateStore (per-tab event application, dedupe,
reconnect recovery); rightPanelStore arbitration.