Skip to content

Stack actions

These actions operate on the Engine's attached Stack. A stack action fails if no stack is attached. Optional shuffle seeds use the shared seeded random implementation, which is useful for reproducible tests and replays.

Type Payload Result / effect
stack:draw { count? } One token for count 1, otherwise an array; draws up to available
stack:peek { count? } Materialized top tokens, newest first
stack:shuffle { seed? } Reorders stack ranks
stack:burn { count? } Moves top tokens to discards and returns them
stack:reset none Restores the document's reset template
stack:cut { position? } Rotates logical order
stack:insertAt { position?, card } Inserts a token
stack:removeAt { position? } Removes and returns a token
stack:swap { i, j } Swaps two positions
stack:reverse none Reverses the full stack
stack:discard { card } Adds a token to discards and returns it

All state-changing operations are Chronicle transactions. Concurrent ordering is represented by CRDT rank sidecars; the action is not a replacement of the whole membership list.