Files
t3code/packages/client-runtime
Theo BrowneandClaude Fable 5 2218b91213 review round 3: event-driven pending-start guard, queue ack in all phases, attachment cleanup
- Add pendingTurnStart to the thread read model, set by
  thread.turn-start-requested and cleared when the session adopts the
  turn (running with activeTurnId) or fails/stops. The decider's
  queue-by-default, drain, and steer guards now cover the window between
  dispatching a turn start and the provider reporting session status —
  a send racing in behind a drain queues instead of opening a second
  concurrent turn (Bugbot + Macroscope). Hydrated from the existing SQL
  pending-turn-start rows on restart; the settle guard keeps its
  timestamp heuristic (renamed hasRecentUnadoptedUserMessage) since
  client-supplied clocks must not drive dispatch decisions.
- Acknowledge a projected expectedMessageId in every composer phase,
  not just running: sends during 'connecting' also queue server-side
  (Bugbot + Macroscope).
- Prune attachment files when a queued message is removed by the user;
  dispatch removals keep them since the same attachments re-enter the
  timeline via the paired message-sent (Macroscope).
- Restrict the Codex turn/steer fallback to receive-response request
  errors (server rejected the steer). Response-decode failures on an
  accepted steer propagate instead of double-sending the input via
  turn/start (Macroscope).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 16:24:38 -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.