Storage API¶
Persistence uses the StorageAdapter interface; it is an adapter boundary, not
an ActionRegistry category.
interface StorageAdapter {
save(name: string, data: string, description?: string): Promise<void>;
load(name: string): Promise<SavedGame | null>;
delete(name: string): Promise<void>;
list(): Promise<SaveMetadata[]>;
}
SavedGame contains { metadata, data }. Metadata contains name,
timestamp, version, optional description, and size; data is the
base64-encoded Automerge document produced by Chronicle.saveToBase64().
Built-in adapters are available from their deep module paths:
MemoryAdapter— process-localMap, withclear()for tests.FilesystemAdapter({ dir? })— Node.js JSON files, defaulting to./saves.IndexedDBAdapter({ dbName? })— browser storage, defaulting tohypertoken.
Use engine.useStorage(adapter), then persist, resume, listSaves, and
deleteSave. Resume is prohibited while network or sync is attached and clears
stale local action history after loading.