/** * Provider-agnostic memory import — business logic extracted from `cleo memory import`. * * Reads `*.md` files from a provider memory directory, parses YAML frontmatter, * deduplicates by content hash, and dispatches observations into `brain.db` via * the CLEO dispatch layer. The CLI handler calls {@link importMemoryFiles}. * * @module memory/import-from-provider * @epic T9833 * @task T10062 */ /** Options for {@link importMemoryFiles}. */ export interface ImportMemoryFilesOptions { /** * Source directory containing `*.md` memory files. * Defaults to `~/.claude/projects/-mnt-projects-cleocode/memory`. */ sourceDir?: string; /** When true, log what would be imported without writing to `brain.db`. */ dryRun?: boolean; /** Project root used to locate the dedup state file. */ projectRoot: string; /** CLEO directory name inside the project root (default: `.cleo`). */ cleoDirName?: string; /** File name for the import-hash dedup state (default: `migrate-memory-hashes.json`). */ hasheFileName?: string; /** * Dispatch function — matches the `dispatchFromCli` signature from the CLI * adapter. Injected here to keep the core module decoupled from CLI internals. */ dispatch: (gateway: 'mutate' | 'query', domain: string, operation: string, params: Record, output: { command: string; operation: string; }) => Promise; } /** Per-entry import record. */ export interface ImportedEntry { file: string; type: string; title: string; } /** Per-entry skip record. */ export interface SkippedEntry { file: string; reason: string; } /** Per-entry error record. */ export interface ErrorEntry { file: string; error: string; } /** Summary returned by {@link importMemoryFiles}. */ export interface ImportMemoryResult { total: number; imported: number; skipped: number; errors: number; dryRun: boolean; importedEntries: ImportedEntry[]; skippedEntries: SkippedEntry[]; errorEntries: ErrorEntry[]; } /** * Parse YAML frontmatter from a markdown string. * * Supports simple `key: value` pairs only (no nested YAML). * * @param raw - Raw file content * @returns Extracted frontmatter fields and body text */ export declare function parseMemoryFileFrontmatter(raw: string): { name?: string; description?: string; type?: string; body: string; }; /** * Compute a 16-char hex content fingerprint for deduplication. * * @param title - Entry title * @param body - Entry body text * @returns 16-char hex prefix of SHA-256 hash */ export declare function memoryContentHash(title: string, body: string): string; /** * Import `*.md` memory files from a provider directory into `brain.db`. * * Skips `MEMORY.md`, empty files, and previously imported entries (by content * hash). Routes `feedback` type entries to `memory.learning.store`; all other * types go to `memory.observe`. * * @param opts - Import options * @returns Summary of the import operation * @throws {Error} When the source directory does not exist */ export declare function importMemoryFiles(opts: ImportMemoryFilesOptions): Promise; //# sourceMappingURL=import-from-provider.d.ts.map