Files
t3code/packages/client-runtime
Josh Gratton bb6fafc16a Merge upstream/main into josh/desktop-wsl-parallel-backends (auth migration)
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.
2026-06-19 17:17:17 -04:00
..

Client Runtime

Shared client behavior for web and mobile. Public APIs are organized by package subpath. The package intentionally has no root export.

Public subpaths

Subpath Responsibility
authorization Bearer and DPoP authorization plus token persistence contracts
connection Targets, catalog, supervision, retries, registry, and onboarding
environment Environment identity, descriptors, endpoints, and scoped keys
errors Shared client error inspection
operations Multi-step application workflows
operations/projects Multi-step project creation workflows
platform Platform capability and persistence service contracts
relay Managed relay API and environment discovery
rpc HTTP/RPC clients, protocol, sessions, and subscriptions
state/<domain> Focused shared state, retention, reducers, and Atom constructors

Dependency direction

Platform applications provide platform services. connection composes those capabilities with authorization, relay, and rpc to supervise environment sessions. Independent state modules consume the connection registry and expose focused state or Atom constructors to application-owned runtimes.

Applications should import the narrowest relevant subpath. There is no broad state export: use domain paths such as state/shell, state/threads, state/terminal, or state/vcs. Subpath indices and explicitly exported domain files are public API boundaries; all other files remain implementation details.