Files
t3code/packages/client-runtime
Theo BrowneandClaude Fable 5 eb5f14bc15 feat: promote T3 Connect environments to local connections
Relay-connected environments now discover direct LAN and Tailscale routes
to the same server and reconnect through them automatically, with the
relay as fallback.

- Server: authenticated GET /api/remote-access/endpoints (relay:read)
  advertises the server's own loopback/LAN/Tailscale endpoints, aware of
  the configured binding. Tailscale endpoint synthesis hoisted from
  desktop into @t3tools/tailscale and shared.
- Client: while relay-connected, a scoped discovery fiber fetches
  advertised endpoints through the tunnel, probes direct candidates,
  verifies the environment id, and stores a per-environment route
  override. The supervisor replaces the lease without backoff and the
  relay broker connects through the override using the cached DPoP
  access token (host-independent; only per-request proofs are URL-bound).
  A failed direct route clears the override, starts a cooldown to
  prevent route flapping, and falls back to the relay in the same
  prepare call.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-05 19:41:41 -07: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.