import type { ArkmeEnvironment, ArkmeSourceItem, ArkmeSourceList } from '../types.js'; import { readNavigationCache, writeNavigationCache } from './navigation-cache.js'; export interface SelfTopicDirectorySnapshot { sources: ArkmeSourceItem[]; complete: boolean; loading: boolean; error: string; refreshedAtMillis: number; } export declare function mergeSelfTopicSources(current: readonly ArkmeSourceItem[], incoming: readonly ArkmeSourceItem[]): ArkmeSourceItem[]; /** One account-owned read survives menu unmounts; complete snapshots are replaced atomically. */ export declare class SelfTopicDirectoryCache { readonly userId: number; readonly environment: ArkmeEnvironment; private readonly readPage; private readonly readCache; private readonly writeCache; private readonly now; private readonly lifetime; readonly signal: AbortSignal; private snapshot; private visibleSnapshot; private archiveRemovals; private listeners; private pending; private controller; private dirty; private timer; private patches; constructor(userId: number, environment: ArkmeEnvironment, readPage?: (cursor: string | undefined, signal: AbortSignal, refresh: boolean) => Promise, readCache?: typeof readNavigationCache, writeCache?: typeof writeNavigationCache, now?: () => number); readonly getSnapshot: () => SelfTopicDirectorySnapshot; /** Navigation persistence and selection reconciliation must not treat pending intent as server truth. */ readonly getConfirmedSnapshot: () => { sources: ArkmeSourceItem[]; complete: boolean; loading: boolean; error: string; refreshedAtMillis: number; }; readonly subscribe: (listener: () => void) => () => void; private publish; private subtreeKeys; private withoutArchived; /** An account-scoped optimistic removal. Overlapping trees roll back independently. */ beginArchive(source: ArkmeSourceItem): ((confirmed: boolean) => void) | undefined; private persist; ensure(force?: boolean): Promise; /** Use confirmed mutation results, never guessed count deltas. Preserve them against an older read. */ upsert(source: ArkmeSourceItem, relatedSources?: readonly ArkmeSourceItem[]): void; /** Join older reads, then coalesce mutations into one authoritative background refresh. */ refreshAfterMutation(): Promise; invalidate(hard?: boolean): void; private schedule; dispose(): void; } export declare function activateSelfTopicDirectoryAccount(account: string): void; export declare function selfTopicDirectory(userId: number, environment: ArkmeEnvironment): SelfTopicDirectoryCache; export declare function invalidateSelfTopicDirectories(hard?: boolean): void; export declare function resetSelfTopicDirectories(): void; //# sourceMappingURL=self-topic-directory-cache.d.ts.map