Skip to content
Developer Preview

ItemStore

Items in first-opened order, each at its latest revision.

Class in muse_code

Holds per-field delta accumulators beside the items, and the terminal-unknown annotation set an ephemeral host death produces.

ItemStore()

Property Type Description
size int How many items the store holds.
ephemeral_session_discarded bool Whether an ephemeral host death discarded this session.
Method Signature Description
apply apply(item: ItemLike) -> ItemApplyOutcome Apply an item/started | item/updated | item/completed payload.
apply_delta apply_delta(item_id: str, delta: str, field: str = 'text') -> DeltaApplyOutcome Apply an item/delta: a lossless append to a field accumulator.
accumulated accumulated(item_id: str, field: str = 'text') -> str | None The accumulated delta text for a field path, or None if none.
accumulated_fields accumulated_fields(item_id: str) -> List[str] Every field path that has accumulated deltas for this item, sorted.
get get(item_id: str) -> ItemLike | None The held item at its latest revision, or None.
has has(item_id: str) -> bool Whether the store holds this item.
list list() -> List[ItemLike] Items in first-opened order.
last_opened_item_id last_opened_item_id() -> str | None The id of the most recently opened item, or None when empty.
seed seed(items: Iterable[ItemLike]) -> None Seed from a snapshot’s state.items.
mark_ephemeral_host_death mark_ephemeral_host_death(is_in_progress: Callable[[ItemLike], bool]) -> List[TerminalUnknownItemAnnotation] Permanently discard an ephemeral session after abnormal host death.
is_terminal_unknown is_terminal_unknown(item_id: str) -> bool Whether this item carries the terminal-unknown annotation.
Source

clients/sdk-py/src/muse_code/fold/item_store.py:96