Skip to content
Developer Preview

SessionFold

The whole client-side session view: items, session state, turns, and the pending approval/user-input sets.

Class in muse_code

SessionFold()

Property Type Description
items FoldItems Items, snapshot-only: the mutators are apply()’s, not yours.
session_state FoldSessionState The session-state families, keyed by notification method name.
active_turn_id str | None The turn currently running, if one is.
pending_gap Mapping[str, str] | None The outstanding delivery hole, or None.
current bool Is this fold current with the session view?
Method Signature Description
mark_ephemeral_host_death mark_ephemeral_host_death(is_in_progress: Callable[[ItemLike], bool]) -> list[TerminalUnknownItemAnnotation] Discharge the ephemeral host-death obligation.
gap_filled gap_filled(next_cursor: str) -> bool A recovery filled the hole up to next_cursor.
apply apply(event: Mapping[str, Any]) -> FoldOutcome Fold one view event (a wire notification’s method + params).
turns turns() -> list[TurnEntry] Turns in first-observed order.
turn turn(turn_id: str) -> TurnEntry | None One turn’s entry, or None if the fold never observed it.
pending_approvals pending_approvals() -> list[PendingApproval] Approvals awaiting a durable terminal, in first-observed order.
resolved_approvals resolved_approvals() -> list[Params] The winning durable terminal per approval, in first-observed order.
pending_user_inputs pending_user_inputs() -> list[Params] Prompts awaiting a durable settlement, in first-observed order.
settled_user_inputs settled_user_inputs() -> list[Params] The winning durable settlement per prompt, in first-observed order.
Source

clients/sdk-py/src/muse_code/fold/session_fold.py:413