import { StorageManager } from './storage.js';
import './page-versioning.js';
import './consolidation-operator.js';
import './types.js';
import './memory-projection-store-D3vBHS4J.js';
import 'better-sqlite3';

/**
 * Consolidation provenance integrity check (issue #561 PR 4).
 *
 * Validates that every memory carrying consolidation provenance frontmatter
 * (`derived_from`, `derived_via`) resolves to real data:
 *
 *   - Each `derived_from` entry `"<path>:<version>"` must name a
 *     page-version snapshot that exists on disk (via the sidecar layout
 *     documented in `page-versioning.ts`).
 *   - Each `derived_via` must be one of the known
 *     `ConsolidationOperator` values — malformed values are surfaced as
 *     warnings rather than crashes so legacy or future operators survive a
 *     rollback.
 *
 * Non-fatal: every failure renders a warning with the offending file path
 * and a human-readable reason.  Integrity problems are informational for
 * now — we do not auto-heal or archive broken memories.
 */

/**
 * One integrity warning attached to a specific memory.
 */
interface ConsolidationProvenanceIssue {
    /** Absolute path to the memory markdown file. */
    memoryPath: string;
    /** Memory id from frontmatter. */
    memoryId: string;
    /** Type of integrity issue. */
    kind: "derived_from_missing_snapshot" | "derived_from_malformed_entry" | "derived_via_unknown_operator";
    /** Human-readable detail — includes the offending value when relevant. */
    detail: string;
}
/**
 * Summary of a provenance-integrity scan.  Used by the operator-doctor
 * report and surfaced in the CLI output.
 */
interface ConsolidationProvenanceReport {
    /** Total memories inspected. */
    scanned: number;
    /** Memories that carry `derived_from` and/or `derived_via`. */
    withProvenance: number;
    /** One entry per problem detected (may be empty). */
    issues: ConsolidationProvenanceIssue[];
}
/**
 * Scan every memory under `storage` and flag consolidation-provenance
 * problems.  Does not throw on individual failures — collects them in the
 * returned report.
 */
declare function runConsolidationProvenanceCheck(options: {
    storage: StorageManager;
    memoryDir: string;
    /**
     * Page-versioning sidecar directory name.  Defaults to `.versions` —
     * matches the baked-in default used by `setVersioningConfig` when
     * versioning is enabled via config.
     */
    sidecarDir?: string;
}): Promise<ConsolidationProvenanceReport>;

export { type ConsolidationProvenanceIssue, type ConsolidationProvenanceReport, runConsolidationProvenanceCheck };
