You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(daemon): split src/daemon/types.ts into request types and session state #2338
src/daemon/types.ts (405 lines) has 197 type importers serving two audiences: the request shape (DaemonRequest 112 importers, DaemonResponse 111, DaemonInvokeFn 14) and live session state (SessionState 112). 79 files import only request types, 35 only session types, 83 both. It sits in one real type cycle: types.ts imports RefFrame from ref-frame.ts, which imports SessionState (documented at types.ts line 18). session-script-publication-state.ts has no imports and is not in a cycle.
Required behavior
Split into a request module (DaemonRequest, DaemonRequestMeta, DaemonRequestInternal, DaemonOpenLifecycle, DaemonResponse, DaemonResponseData, DaemonInvokeFn, ...) and a session-state module (SessionState, SessionRef, SessionScope, InteractionSurfaceEntry, PendingInteractionOutcome, PostGestureStabilization, ...). Names open.
Export a wire-only request shape (DaemonRequest without internal, meta narrowed to public fields) that does not reference SessionState or DeviceLease. F1 consumes it. DaemonRequestInternal stays reachable only from the request module.
Break the ref-frame.ts cycle by declaring the ref-frame slot type below both files. ref-frame.ts keeps construction authority: its R7 rows refFrame and snapshotScopeSource in scripts/layering/session-state.ts are unchanged.
No behavior change; every importer switches to the module that owns the symbol it uses.
Completion conditions
Before/after inventory of the R9 largest type cycle (from ratchet-reference.ts) attached to the PR; the types.ts ↔ ref-frame.ts cycle is gone and no new cycle appears.
Importer split reported (files importing request-only, state-only, both) after the change; the mixed count is a measurement, not a target.
R7, R9, R10 ratchets green; DAEMON_MODULARITY_BASELINE.externalDaemonTypesImporters (client/client-normalizers.ts, remote/daemon-artifacts.ts) points at the right module.
A type-level test proves the wire-only request shape has no internal key and no path to SessionState.
Dependencies
None. F1 and F2 depend on this issue.
Non-goals
The SessionState field-ownership program (R7 owners); moving any type into a package. An R9 pass alone is not proof of decoupling; the wire-only shape and the cycle inventory are.
Activity