Chronicle¶
core/Chronicle.ts is the active IChronicle implementation. It wraps A.Doc<HyperTokenState> from @automerge/automerge, exposes the current state, applies changes with A.change, and emits state:changed with a source such as local, sync, merge, or load.
Chronicle also owns Automerge serialization, load, merge, fork, and sync protocol calls. save() and saveToBase64() support adapters and snapshots. fork() clones the current document into a new actor branch; merge() combines documents through Automerge.
newEpoch() creates a fresh document from current state with A.from(A.toJS(doc)). This is compaction: pre-epoch CRDT history is discarded. The Engine refuses compaction while network or sync is attached, and all peers must compact at the same game boundary.
IChronicle keeps Engine, ConsensusCore, and HistoryManager backend-agnostic, but the repository currently has only the TypeScript Chronicle implementation.