Files
t3code/packages/client-runtime
b603bacfd0 fix(mobile): probe on network path changes, report leases on reconnect
Rebuilt on main after #5561 and #5404 landed overlapping reconnect
work. What main already covers is dropped from this branch: the backoff
ladder rework replaces our jitter, wakeProbeFailed replaces our
probe-failure fast path, and the authoritative-session guard replaces
our shell warm-cache short-circuit.

What remains is the mobile-specific delta:

- New advisory `network-path-changed` wakeup: WiFi<->cellular keeps
  isConnected true while invalidating the socket's path, so the mobile
  adapter emits a wakeup on interface-type changes while active and the
  supervisor probes the session (3s bound) instead of waiting for the
  ping timeout. A failed probe rides main's wakeProbeFailed fast path;
  flapping interfaces cannot cut backoff delays short.
- Client activity is re-reported on every newly connected session
  generation; the AppState-triggered report races the reconnect and is
  dropped, leaving provider/VCS work paused server-side for up to 25s
  after a resume. Generation dedup is per-supervisor since replacements
  restart the counter.
- The RPC onPingTimeout hook is wired to logging so zombie-socket
  disconnects are distinguishable from ordinary closes.
- Server websocket idleTimeout drops to 30s from Bun's 120s default
  (clients ping every 5s, so live connections never idle), releasing a
  suspended phone's half-dead socket and buffers four times sooner.

Co-Authored-By: Claude Fable 5 <[email protected]>
Co-authored-by: codex <[email protected]>
2026-08-10 12:58:27 +02: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.