import { PersonaMemoryEntry, MemorySearchResult, EmbeddingModel } from '../types/index.js';
export type MemoryType = 'fact' | 'preference' | 'experience' | 'emotional' | 'context' | 'instruction' | 'general';
export interface EnhancedMemoryEntry extends PersonaMemoryEntry {
    memory_type?: MemoryType;
    access_count?: number;
    last_accessed?: number;
    decay_factor?: number;
    consolidated_from?: string[];
}
export declare class MemoryService {
    private db;
    private embeddingModels;
    constructor();
    /**
     * Ensure database is available
     */
    private ensureDatabase;
    private initializeTables;
    /**
     * Migrate database to add new columns for existing tables
     */
    private migrateDatabase;
    /**
     * Get SQLite column type for a given column name
     */
    private getColumnType;
    /**
     * Classify memory content into a type
     */
    classifyMemoryType(content: string): MemoryType;
    /**
     * Calculate enhanced importance score based on multiple factors
     */
    calculateEnhancedImportance(content: string, memoryType: MemoryType, _context?: string): number;
    /**
     * Apply time-based decay to importance score
     */
    applyDecay(originalImportance: number, timestamp: number, accessCount?: number, lastAccessed?: number): number;
    /**
     * Get available embedding models
     */
    getEmbeddingModels(): EmbeddingModel[];
    /**
     * Generate embedding for text using specified model
     */
    private generateEmbedding;
    /**
     * Store a memory entry with embedding and automatic classification
     */
    storeMemory(userId: string, personaId: string, content: string, embeddingModel: string, context?: string, importanceScore?: number, memoryType?: MemoryType): Promise<EnhancedMemoryEntry>;
    /**
     * Find similar memories (for deduplication)
     */
    private findSimilarMemories;
    /**
     * Reinforce a memory (increases importance and access count)
     */
    reinforceMemory(memoryId: string): Promise<boolean>;
    /**
     * Calculate cosine similarity between two vectors
     */
    private cosineSimilarity;
    /**
     * Search memories using semantic similarity with enhanced relevance scoring
     */
    searchMemories(userId: string, personaId: string, query: string, embeddingModel: string, topK?: number, minSimilarity?: number, memoryTypes?: MemoryType[]): Promise<MemorySearchResult[]>;
    /**
     * Update memory access tracking
     */
    private updateMemoryAccess;
    /**
     * Get all memories for a persona
     */
    getMemories(userId: string, personaId: string, limit?: number, offset?: number): Promise<PersonaMemoryEntry[]>;
    /**
     * Get memory count for a persona
     */
    getMemoryCount(userId: string, personaId: string): Promise<number>;
    /**
     * Get memory status for a persona
     */
    getMemoryStatus(userId: string, personaId: string): Promise<{
        memory_count: number;
        last_backup?: number;
        size_mb: number;
    }>;
    /**
     * Delete all memories for a persona (wipe)
     */
    wipeMemories(userId: string, personaId: string): Promise<number>;
    /**
     * Export memories for backup
     */
    exportMemories(userId: string, personaId: string): Promise<PersonaMemoryEntry[]>;
    /**
     * Import memories from backup
     */
    importMemories(memories: PersonaMemoryEntry[], targetUserId: string): Promise<number>;
    /**
     * Update memory importance score
     */
    updateMemoryImportance(memoryId: string, importanceScore: number): Promise<boolean>;
    /**
     * Delete old memories based on retention policy
     */
    cleanupOldMemories(userId: string, personaId: string, retentionDays: number): Promise<number>;
    /**
     * Consolidate similar memories to reduce redundancy and save space
     * This merges memories with high similarity into a single, more comprehensive memory
     */
    consolidateMemories(userId: string, personaId: string, embeddingModel: string, similarityThreshold?: number): Promise<{
        consolidated: number;
        deleted: number;
    }>;
    /**
     * Create consolidated content from multiple similar memories
     */
    private createConsolidatedContent;
    /**
     * Get memory statistics for a persona
     */
    getMemoryStats(userId: string, personaId: string): Promise<{
        total_count: number;
        by_type: Record<string, number>;
        avg_importance: number;
        oldest_memory: number | null;
        newest_memory: number | null;
        total_accesses: number;
    }>;
    /**
     * Apply decay to all memories (should be called periodically)
     */
    applyGlobalDecay(userId: string, personaId: string): Promise<number>;
    /**
     * Get important memories (facts, preferences, instructions) that should always be included
     */
    getCoreMemories(userId: string, personaId: string, limit?: number): Promise<PersonaMemoryEntry[]>;
}
export declare const memoryService: MemoryService;
//# sourceMappingURL=memoryService.d.ts.map