/** * Memory import functionality for Signet * * Handles importing existing memory logs (markdown files) into SQLite * for search and sync capabilities. */ import type { Database } from "./database"; /** * Result of a chunk operation */ export interface ChunkResult { /** The chunked text content */ text: string; /** Estimated token count for this chunk */ tokenCount: number; } /** * Hierarchical chunk that preserves markdown section structure. * Each chunk knows its section header and whether it's a full section * or a paragraph within a section. */ export interface HierarchicalChunk { /** The chunked text content (includes header for context) */ text: string; /** Estimated token count for this chunk */ tokenCount: number; /** The section heading (e.g., "## Signet npm Package Publishing") */ header: string; /** Whether this is a full section or a paragraph within a section */ level: "section" | "paragraph"; /** Index of this chunk within the document */ chunkIndex: number; } /** * Result of an import operation */ export interface ImportResult { /** Number of memories successfully imported */ imported: number; /** Number of files skipped (e.g., already imported, invalid) */ skipped: number; /** Error messages encountered during import */ errors: string[]; } /** * Options for chunking content */ export interface ChunkOptions { /** Maximum tokens per chunk */ maxTokens: number; } /** * Split content into chunks of approximately the specified token size. * Attempts to split on paragraph boundaries when possible. */ export declare function chunkContent(content: string, options: ChunkOptions): ChunkResult[]; /** * Split markdown content into hierarchical chunks that preserve section structure. * * This uses a two-level approach: * 1. Section chunks: Embed each section's heading + full content when it fits * 2. Paragraph chunks: Split long sections into smaller pieces with header context * * Benefits: * - Context preservation: Retrieved chunks include their section header * - Better retrieval: Search matches fine-grained paragraphs with section context * - Deduplication: Track by document + section + chunk index * * @param content - The markdown content to chunk * @param options - Chunking options (maxTokens defaults to 512) * @returns Array of hierarchical chunks with header and level information */ export declare function chunkMarkdownHierarchically(content: string, options?: ChunkOptions): HierarchicalChunk[]; /** * Import memory logs from a base path into the database. * * Reads all .md files from the `memory/` subdirectory (excluding files * starting with TEMPLATE), extracts dates from filenames, chunks content, * and inserts into the memories table. * * @param basePath - The base directory containing the `memory/` subdirectory * @param db - The initialized Database instance * @returns ImportResult with counts of imported, skipped, and any errors */ export declare function importMemoryLogs(basePath: string, db: Database): ImportResult; //# sourceMappingURL=import.d.ts.map