Skip to content
Developer Preview

FoldSessionState

The fold’s read-only view of its SessionStateStore, stated explicitly rather than derived: the store’s get/has take a bare string, so get("session/modelchanged") would typecheck and silently read undefined. The family key IS protocol vocabulary, so name it — this surface goes public in this PR, and narrowing it later is a break.

Method Signature Stability Description
families families(): readonly SessionStateMethod[] Every family that holds a value, in insertion order. Narrowed in the RETURN position too, so the obvious consumer loop — for (const f of families()) get(f) — round-trips against this same interface instead of forcing the bare-string cast the parameter narrowing exists to forbid.
get get(family: M): DeepReadonly<Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object> | Extract<object, object>["params"]> | null | undefined GENERIC in the family, so the return type is that family’s params object rather than the 7-way union. With the union, a wrong-family cast (get("session/goalChanged") as SessionTokenUsageParams) was a legal narrowing and read the wrong shape silently — the same invisible-miss class the key narrowing closed on the argument side. The method→params map already exists in ViewEvent; this just reuses it.
has has(family: SessionStateMethod): boolean
Source

clients/sdk-ts/src/fold/session-fold.ts:356

{
"kind": "Interface",
"canonicalPath": "FoldSessionState"
}