Skip to content
Developer Preview

PendingCommandSet

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.

Property Type Stability Presence Description
discarded boolean required Has the ephemeral discard closed this set?
size number required
Method Signature Stability Description
constructor new PendingCommandSet(options?: PendingCommandSetOptions)
acked acked(commandId: string, ack: PendingCommandAck): void The submit (or a replay) was acked.
ackErrored ackErrored(commandId: string, error: CommandErrorResponse): "held" | PendingRetirement<I> The submit (or a replay) answered with an error.
discardEphemeral discardEphemeral(): readonly PendingRetirement<I>[] Abnormal death of an EPHEMERAL-profile host (carve-out): nothing is ever settled, replaying a commandId at a new host is forbidden, and every entry falls under the discard obligation as terminal-unknown — a client-side annotation, never a wire fact.
get get(commandId: string): PendingCommandEntry<I> | undefined
has has(commandId: string): boolean
joinSnapshot joinSnapshot(facts: SnapshotJoinFacts): PendingJoinPlan<I> Join local entries against an authoritative snapshot, by commandId. The five arms, in the order states them.
list list(): readonly PendingCommandEntry<I>[] Entries in render order.
observedQueueMovement observedQueueMovement(turnId: string): readonly string[] Queue movement: a turn/started or turn/completed for a turn that is NOT the entry’s own.
observedReclaim observedReclaim(commandId: string): PendingRetirement<I> | undefined A reclaim this client actually observed. Retire immediately — same composer restore, without waiting for a snapshot join (“Reclaimed”).
observedUserMessage observedUserMessage(commandId: string, itemId: string): PendingRetirement<I> | undefined A userMessage item carrying this commandId folded in: the entry materialized and the item replaces it at the item’s own transcript position (“Materialized”).
reconnectedWithoutSnapshot reconnectedWithoutSnapshot(): PendingJoinPlan<I> Reconnect with NO snapshot (history.mode: "none", the default cursor-resume path). There is no join to run, so reconnect itself is the trigger: replay each ACKED entry’s commandId once; resubmit each UNACKED entry’s same commandId once before any retire-to-composer.
replayAnswered replayAnswered(commandId: string, answer: ReplayAnswer): "held" | PendingRetirement<I> Feed back a commandId replay answer (always safe).
resolveReplayAtJoin resolveReplayAtJoin(commandId: string, answer: ReplayAnswer, snapshotQueuedCommandIds: Iterable<string>): "held" | PendingRetirement<I> The reclaimed signature, decidable only with a snapshot in hand: an acked-queued entry ABSENT from the snapshot’s queuedTurns whose replay still answers the stale "queued" ack retires as reclaimed at the snapshot join (“Reclaimed”).
stopRetrying stopRetrying(commandId: string): PendingRetirement<I> | undefined The client has decided to stop retrying a nothing-admitted error. The entry must not linger as a durable-looking echo.
submitted submitted(params: object): void Record a submission. anchorAfterItemId is the last item present in the client’s fold right now (insertion point).
isSettlement static isSettlement(error: CommandErrorResponse): boolean Only a durable commandRejected (-32030) settles a command. Everything else admitted nothing.
Source

clients/sdk-ts/src/pending/pending-command-set.ts:227

{
"kind": "Class",
"canonicalPath": "PendingCommandSet"
}