export type DistillProvenance = 'oracle:test-exec' | 'judge:fable' | 'proxy:structural'; export interface DistillOptions { dbPath: string; /** Restrict to these namespaces (default: all namespaces with embeddings). */ namespaces?: string[]; /** Rows per transaction (default 200). */ batchSize?: number; /** Hard cap on rows processed this invocation (default: unbounded within a run). */ maxEntries?: number; /** Cosine distance below which two entries collapse into one pattern (default 0.2, the ADR-174 M4-tuned platform default: ~37% fewer patterns, retrieval-neutral). */ dedupDistance?: number; /** Report counts, write nothing (default false). */ dryRun?: boolean; /** Judge tier. Only 'structural' ($0) is implemented here; 'fable' is reserved (ADR-172). */ judge?: 'structural' | 'fable'; /** Ignore the cursor and re-scan from this rowid (default: cursor-driven). */ sinceRowid?: number; verbose?: boolean; } export interface DistillReport { processed: number; episodes: number; episodeEmbeddings: number; patterns: number; patternEmbeddings: number; causalEdges: number; promoted: number; byProvenance: Record; namespaces: string[]; dryRun: boolean; spendUsd: number; corrupt?: boolean; skipped?: string; } /** * Distill accumulated memory into the structured intelligence tables. * Incremental, $0, transactional, provenance-tagged. */ export declare function runDistillation(options: DistillOptions): Promise; /** * The two stores the CLI/MCP surface can write: * - memory.db is the sql.js/CLI store (also used with encryption at rest); * - agentdb-memory.db is the native AgentDB store the MCP bridge writes to. * * #3446: distillation used to default to memory.db only. In an MCP-only * project that file often has no AgentDB target tables, so the daemon's * consolidate worker skipped every tick while the rows accumulated in the * sibling store. Keep both paths here (same root resolution as backup) so * callers can cover every store without guessing which surface wrote. */ export declare function projectMemoryDbPaths(cwd?: string): string[]; /** Where the primary memory DB lives, for callers that still need one path. */ export declare function defaultMemoryDbPath(cwd?: string): string; export interface StoreDistillResult { dbPath: string; report: DistillReport; } export interface MultiStoreDistillResult { stores: StoreDistillResult[]; report: DistillReport; } /** * Merge per-store reports without hiding a store's outcome. A run over both * stores is only `skipped` when every store skipped; if one store distilled * and the other had no schema/DB, the successful counts remain authoritative * and the per-store skip stays available in `stores`. */ export declare function aggregateDistillReports(stores: StoreDistillResult[], dryRun?: boolean): DistillReport; /** * Run one distillation pass against each provided store. * * `runner` is injectable so callers/tests can exercise the multi-store * orchestration without a native SQLite build; the default is the real * service. A runner failure is converted to a per-store skip so one bad store * cannot prevent the other from being distilled. */ export declare function runDistillationForStores(dbPaths: string[], options?: Omit, runner?: (options: DistillOptions) => Promise): Promise; //# sourceMappingURL=memory-distillation.d.ts.map