Hide a field from everyone
Use.hidden() for deck order, unrevealed results, and similar secrets:
deck:
Reveal a safe summary
You can expose a derived value without exposing the secret itself:Show a field to its owner
First identify the field that stores the owning player ID. Then mark private fields as visible to that player:hand. Other players and spectators receive only its count.
Use visibleToSelf() without options when non-owners should receive only { __hidden: true }.
Create views
The executor accepts a player or spectator viewer:game and progression. It never includes runtime RNG state or command history.
The client view type automatically includes the full value or hidden-envelope union. Narrow it with "__hidden" in value before rendering private fields.
Read views in the client
Render the current viewer-safe state.