Skip to content
Developer Preview

PendingCommandSet

The client-local pending-command set.

Class in muse_code

Tracks the commands you have submitted that the server has not yet woven into the view: their optimistic display order, acknowledgements, replay answers at reconnect, and retirements. Session owns and drives one per conversation; read it through the session’s pending view.

A client that never renders optimistically simply holds no entries and the fold degenerates to — that is a supported mode, not a degraded one.

Property Type Description
discarded_command_ids set[str] Where discard_ephemeral() records the ids it retired, and where every replay guard reads (“do not replay the session’s commandId\ s”). Injected BY REFERENCE so one client can share a single set across the sessions it opens: the clause constrains what this CLIENT does next, and a per-instance set would let a FRESH session replay a dead host’s ids at a new host. Omitted, the set owns a private one and behaves exactly as before.
discarded bool Whether the ephemeral discard has closed this set.
size int The number of pending entries.
Method Signature Description
submitted submitted(command_id: str, input: I, *, display_text: str | None = None, anchor_after_item_id: str | None = None) -> None Records a submission.
acked acked(command_id: str, ack: PendingCommandAck) -> None Records that the submit (or a replay) was acked.
ack_errored ack_errored(command_id: str, error: CommandErrorResponse) -> PendingRetirement[I] | Held The submit (or a replay) answered with an error.
stop_retrying stop_retrying(command_id: str) -> PendingRetirement[I] | None The client has decided to stop retrying a nothing-admitted error.
observed_user_message observed_user_message(command_id: str, item_id: str) -> PendingRetirement[I] | None A userMessage item carrying this commandId folded in.
observed_reclaim observed_reclaim(command_id: str) -> PendingRetirement[I] | None A reclaim this client actually observed.
observed_queue_movement observed_queue_movement(turn_id: str) -> tuple[str, ...] Queue movement: a turn event for a turn that is NOT the entry’s own.
replay_answered replay_answered(command_id: str, answer: ReplayAnswer[I]) -> PendingRetirement[I] | Held Feeds back a commandId replay answer (always safe).
reconnected_without_snapshot reconnected_without_snapshot() -> PendingJoinPlan[I] Reconnect with NO snapshot (the default cursor-resume path).
join_snapshot join_snapshot(facts: SnapshotJoinFacts) -> PendingJoinPlan[I] Joins local entries against an authoritative snapshot.
resolve_replay_at_join resolve_replay_at_join(command_id: str, answer: ReplayAnswer[I], snapshot_queued_command_ids: Iterable[str]) -> PendingRetirement[I] | Held Resolves a must_replay answer with the snapshot in hand.
discard_ephemeral discard_ephemeral() -> tuple[PendingRetirement[I], ...] Abnormal death of an EPHEMERAL-profile host.
list list() -> tuple[PendingCommandEntry[I], ...] Entries in render order.
get get(command_id: str) -> PendingCommandEntry[I] | None The entry snapshot for command_id, or None.
has has(command_id: str) -> bool Whether an entry with command_id is pending.
Source

clients/sdk-py/src/muse_code/pending/pending_command_set.py:341