Skip to content
Developer Preview

FoldItems

The fold’s read-only view of its ItemStore. Every mutation goes through apply(); a directly reachable seed/applyDelta would let a consumer desync the composite view (items cleared, turn/pending maps not), breaking replay equality.

An ALLOWLIST, stated explicitly: TypeScript never checks Omit’s keys against the type, so a renamed or newly added ItemStore mutator would land on this exported surface silently. An explicit member list admits only what is written here, in both drift directions.

Hiding the mutator METHODS is only half the job. The values these accessors return ARE the fold’s stored objects and the generated wire types carry no readonly, so fold.items.get(id).revision = 0 used to typecheck AND stick — defeating the revision guard and breaking replay equality through the read surface the mutator allowlist was supposed to seal. Every accessor therefore returns DeepReadonly.

Property Type Stability Presence Description
ephemeralSessionDiscarded boolean required
size number required
Method Signature Stability Description
accumulated accumulated(itemId: string, field?: string): string | undefined
accumulatedFields accumulatedFields(itemId: string): readonly string[]
get get(itemId: string): object | undefined
has has(itemId: string): boolean
isTerminalUnknown isTerminalUnknown(itemId: string): boolean
lastOpenedItemId lastOpenedItemId(): string | undefined
list list(): readonly object[]
Source

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

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