/** * Sync state persistence — tracks source→target mapping between incremental syncs. * * State is stored as JSON at ~/.config/lark-hirono/sync-state/.json * where is derived from the source+target node tokens. */ export interface SyncState { version: 1; sourceRoot: string; targetRoot: string; lastSyncTime: string; rootContentHash: string; /** objEditTime of the root node at last sync, for fast change detection */ rootObjEditTime?: string; /** * True once a full sync (tree copy + fixupReferences) has completed at * least once. Absent/false means a prior run was interrupted; the next * run must force fixupReferences and skip orphan pruning. */ firstRunComplete?: boolean; pages: Record; } export interface PageState { targetNodeToken: string; targetObjToken: string; sourceObjToken: string; title: string; objEditTime: string; contentHash: string; lastSynced: string; /** Source image tokens that failed to sync (absent if all succeeded) */ failedImages?: string[]; } export declare function stateFilePath(srcToken: string, dstToken: string): string; export declare function loadState(srcToken: string, dstToken: string): SyncState | null; export declare function saveState(state: SyncState): void; /** * Compute a SHA-256 hash of block content, ignoring positional/identity fields. * Used to detect whether document content actually changed (vs metadata-only edits). */ export declare function computeContentHash(blocks: Record[]): string; /** Aggregate mappings across every on-disk sync-state pair. */ export interface CrossPairMapping { /** source nodeToken → target nodeToken */ nodeMap: Map; /** source objToken → target objToken */ objMap: Map; } /** Load every valid v1 sync-state file under STATE_DIR. */ export declare function loadAllStates(): SyncState[]; /** * Merge every on-disk sync-state's page mappings into a single lookup table. * When the same source token appears in multiple states, the entry with the * most recent `lastSynced` wins. * * Pass `exclude` to omit a specific pair (usually the current run's state, * since the caller already has those mappings in-memory). * * Root-page mappings are NOT included — state files don't record obj tokens * for the root, only for child pages. */ export declare function buildCrossPairMapping(exclude?: { sourceRoot: string; targetRoot: string; }): CrossPairMapping; /** * Create an initial SyncState from a completed first-run sync. */ export declare function buildInitialState(sourceRoot: string, targetRoot: string, rootContentHash: string, rootObjEditTime?: string): SyncState; //# sourceMappingURL=sync-state.d.ts.map