/**
 * Orchestrates the auto-memory → opensquid sync (G.6 + MAU.1).
 *
 * Reads every `*.md` (minus `MEMORY.md`, the index) in a source directory,
 * parses each via the reader, and reconciles it against the libSQL MemoryStore
 * (retire-Rust RES-5b — engine-free):
 *   - name not present              → `store.create`  (imported)
 *   - name present, content changed → `store.update`  (refreshed)
 *   - name present, content same    → no-op           (skipped)
 *
 * Identity: the auto-memory file's frontmatter `name` field. Engine
 * `MemoryListRow` has no `name` column, so the slug round-trips through
 * `origin.host` via the `IMPORT_HOST_PREFIX` marker. `fetchExistingImportIndex`
 * pages `memory.list` once and returns a `name → { id }` map; the caller passes
 * it in via `opts.existingIndex` so iteration is purely local.
 *
 * Refresh detection (MAU.1): `MemoryListRow` carries no `content`, and
 * `memoryUpdate` cannot write `origin` — so a content hash stashed in
 * `origin.host` would go stale after an update and re-trigger forever. Instead,
 * for an existing entry we `memoryGet({ id })` (returns the FULL body) and
 * compare against the file body; equal → skip, differ → update. After an update
 * the stored content matches the file, so the next run no-ops (self-terminating).
 * `dryRun` performs NO engine reads or writes — it reports existing entries as
 * `skipped` (a coarse preview; refresh detection needs a live read).
 *
 * Scope mapping (Phase-2 lock): feedback / user / reference → user-scope;
 * project → project-scope. All imports tagged `authored_by: 'user'`
 * (auto-memory is by definition user-authored → eviction-immune).
 *
 * `fileWhitelist` is the G.7 hook hand-off: when set, only basenames in the
 * list are candidates. Undefined → all `.md` files except `MEMORY.md`.
 *
 * Imports from: node:fs, node:path, ./memory_store_handle.js, ./auto_memory_reader.js.
 * Imported by: setup/cli/memory.ts, auto_memory_snapshot.ts, auto_memory_importer.test.ts.
 */
import { type MemoryStore } from './memory_store_handle.js';
/** Marker that lets us re-derive the auto-memory `name` slug from the engine row. */
export declare const IMPORT_HOST_PREFIX = "opensquid-import:auto-memory:";
/** An engine memory previously imported from auto-memory, keyed by name slug. */
export interface ImportIndexEntry {
    id: string;
}
export interface ImportResult {
    imported: number;
    refreshed: number;
    skipped: number;
    errors: {
        path: string;
        reason: string;
    }[];
}
export interface ImportOpts {
    dryRun: boolean;
    /** Pre-fetched `name → { id }` map of auto-memory entries already in the engine. */
    existingIndex: Map<string, ImportIndexEntry>;
    /** G.7 snapshot hook hand-off; undefined → all .md files except MEMORY.md. */
    fileWhitelist?: string[];
    /**
     * Resolved umbrella namespace for `project`-scoped imports (T-memory-scope-isolation). The CALLER
     * resolves it from the project cwd the auto-memory dir was derived from (NOT the importer's process
     * cwd — every file in this `dir` belongs to that one project, so one namespace is correct). Undefined
     * ⇒ project-scoped imports get a null namespace (recallable only with no project context).
     */
    namespace?: string | null;
}
export declare function importAutoMemoryDir(dir: string, store: MemoryStore, opts: ImportOpts): Promise<ImportResult>;
/**
 * Returns a `name → { id }` map of auto-memory entries already in the store, via
 * `store.listImportIndex()` (which pages the libSQL memory rows + extracts the slug from the
 * `origin:import:` marker tag). Non-import rows (no marker) are ignored.
 *
 * The caller passes the map to `importAutoMemoryDir` (so iteration is local) and to
 * `pruneOrphanedImports` (MAU.2). The `{ id }` lets the importer `store.get` / `store.update` the
 * right row on refresh.
 */
export declare function fetchExistingImportIndex(store: MemoryStore): Promise<Map<string, ImportIndexEntry>>;
/**
 * Deletion propagation (MAU.2): remove engine memories whose auto-memory source
 * file no longer exists, so the derived recall index reflects the source.
 *
 * Marker-guarded: only entries in `existingIndex` (i.e. carrying the
 * `IMPORT_HOST_PREFIX` marker) are deletion candidates — engine-native and
 * user-`memorize`d entries are never in that map, so they are structurally
 * unreachable here. `force: true` because import entries are tagged
 * `authored_by: 'user'` (eviction-immune); the marker + an absent source is the
 * authority, and pruning a derived copy does not evict a hand-authored lesson.
 *
 * Safety net for the on-disk set: an entry is kept if its name matches EITHER a
 * file's frontmatter `name` (authoritative; handles name != basename) OR a
 * file's basename. The basename fallback means a transiently-malformed file
 * (which `readAutoMemory` would throw on) still protects its engine copy from
 * being orphaned by a parse error.
 *
 * `dryRun` counts candidates without deleting.
 */
export declare function pruneOrphanedImports(dir: string, store: MemoryStore, existingIndex: Map<string, ImportIndexEntry>, opts: {
    dryRun: boolean;
}): Promise<{
    pruned: number;
}>;
//# sourceMappingURL=auto_memory_importer.d.ts.map