// The persistence seam. The UI + evolution layers depend only on this interface, so the // in-memory store (now), IndexedDB (offline v1), and atproto (v2) are interchangeable. // // Lineage is a DAG (crossover -> multiple parents). It is pointer-based: a record stores only // its `parents`, and the graph is reconstructed by traversal — `children` (downward) and // `ancestry` (upward). Records are never rewritten, so parent ids stay stable. import type { OrganismRecord } from "./record"; export interface StoredRecord { id: string; record: OrganismRecord; } export interface Repository { /** Persist a record; returns its freshly assigned id. */ save(record: OrganismRecord): Promise; get(id: string): Promise; /** Remove a record by id. Used to refresh regenerable built-in imports (which, being sterile, * are never anyone's parent, so deletion can't orphan a lineage). */ delete(id: string): Promise; list(): Promise; /** Records that name `id` among their parents (one step down the DAG). */ children(id: string): Promise; /** All ancestors of `id` (full upward DAG closure), nearest-first, de-duplicated. */ ancestry(id: string): Promise; }