Skip to content

API overview

HyperToken exposes game pieces, containers, and the Engine. The public package entrypoint is core/index.ts (published as dist/core/index.js).

The root export surface currently includes:

Token, Stack, Space, Source, Chronicle, ConsensusCore, the typed SyncTransport port and SyncPeerRef, Emitter, mulberry32, shuffleArray, parseTokenSetObject, loadTokenSetJSON, and Engine.

Storage adapters and network classes are not re-exported by core/index.ts; use their documented deep module paths.

The most common path is:

  1. Create the game document (Chronicle).
  2. Attach a deck (Stack), board (Space), or combined draw pool (Source) to that same document.
  3. Construct an Engine with those components.
  4. Mutate through await engine.dispatch(type, payload).
  5. Observe state:changed on the Chronicle or state:updated on the Engine.

All containers are views over one Automerge document. Tokens are immutable values. Concurrent changes merge using Automerge CRDT semantics; this is not transactional last-command-wins gameplay.

See Engine API, Token API, and the storage and network pages for operational integrations.