/**
 * Page-level versioning with history and revert (issue #371).
 *
 * Provides snapshot-based versioning for memory files using a sidecar
 * directory layout.  Each memory page gets a `.versions/<pageName>/`
 * subdirectory containing numbered snapshots and a `manifest.json` that
 * records the version history.
 *
 * Storage layout:
 *   memoryDir/
 *     facts/preferences.md              <- current file
 *     .versions/
 *       facts__preferences/
 *         manifest.json                  <- VersionHistory
 *         1.md                           <- version 1 snapshot
 *         2.md                           <- version 2 snapshot
 */
interface PageVersion {
    versionId: string;
    timestamp: string;
    contentHash: string;
    sizeBytes: number;
    trigger: VersionTrigger;
    note?: string;
}
type VersionTrigger = "write" | "consolidation" | "revert" | "manual";
interface VersionHistory {
    pagePath: string;
    versions: PageVersion[];
    currentVersion: string;
}
interface VersioningConfig {
    enabled: boolean;
    maxVersionsPerPage: number;
    sidecarDir: string;
}
interface VersioningLogger {
    debug(msg: string): void;
    warn(msg: string): void;
}
/**
 * Derive a filesystem-safe sidecar key from a page path relative to memoryDir.
 *
 * `facts/2026-01-15/pref-001.md` -> `facts__2026-01-15__pref-001`
 *
 * Exported so the `remnic doctor` consolidation-provenance check (issue
 * #561 PR 4) resolves snapshot locations using the canonical algorithm
 * without re-implementing it — preventing silent drift if the key
 * format ever changes.
 */
declare function sidecarKey(pagePath: string): string;
/**
 * Create a new version snapshot for a page.
 *
 * Call this BEFORE overwriting the current file so the previous content is
 * preserved. If the file does not exist yet (first write), the provided
 * `content` is snapshotted as version 1.
 *
 * Pruning: when the number of versions exceeds `config.maxVersionsPerPage`,
 * the oldest snapshots (and their files) are removed.
 */
declare function createVersion(pagePath: string, content: string, trigger: VersionTrigger, config: VersioningConfig, log?: VersioningLogger, note?: string, memoryDir?: string): Promise<PageVersion>;
/**
 * List all versions for a page.
 */
declare function listVersions(pagePath: string, config: VersioningConfig, memoryDir?: string): Promise<VersionHistory>;
/**
 * Read the content of a specific version.
 */
declare function getVersion(pagePath: string, versionId: string, config: VersioningConfig, memoryDir?: string): Promise<string>;
/**
 * Revert a page to a previous version.
 *
 * 1. Reads the target version's content.
 * 2. Snapshots the CURRENT content as a new version (trigger: "revert").
 * 3. Writes the reverted content to the page file.
 *
 * Returns the newly created version entry for the revert snapshot.
 */
declare function revertToVersion(pagePath: string, versionId: string, config: VersioningConfig, log?: VersioningLogger, memoryDir?: string): Promise<PageVersion>;
/**
 * Simple line-based diff between two versions.
 *
 * Returns a unified-style diff string showing added (+) and removed (-) lines.
 */
declare function diffVersions(pagePath: string, v1: string, v2: string, config: VersioningConfig, memoryDir?: string): Promise<string>;

export { type PageVersion, type VersionHistory, type VersionTrigger, type VersioningConfig, type VersioningLogger, createVersion, diffVersions, getVersion, listVersions, revertToVersion, sidecarKey };
