/**
 * Memory Store - SQLite Storage Backend
 * Provides persistent storage for memory module with entity tracking, associations, and conversation history
 */
export interface Entity {
    id?: number;
    type: 'file' | 'module' | 'topic' | 'url';
    value: string;
    normalized_value: string;
    first_seen_at: string;
    last_seen_at: string;
    metadata?: string;
}
export interface AccessLog {
    id?: number;
    entity_id: number;
    action: 'read' | 'write' | 'mention';
    session_id?: string;
    timestamp: string;
    context_summary?: string;
}
export interface EntityStats {
    entity_id: number;
    read_count: number;
    write_count: number;
    mention_count: number;
    heat_score: number;
}
export interface Association {
    source_id: number;
    target_id: number;
    weight: number;
    last_interaction_at?: string;
}
export interface PromptHistory {
    id?: number;
    session_id: string;
    project_path?: string;
    prompt_text?: string;
    context_summary?: string;
    timestamp: number;
    hash?: string;
    quality_score?: number;
    intent_label?: string;
}
export interface PromptPattern {
    id?: number;
    pattern_type?: string;
    frequency: number;
    example_ids?: string;
    last_detected?: number;
}
export interface Conversation {
    id: string;
    source?: string;
    external_id?: string;
    project_name?: string;
    git_branch?: string;
    created_at: string;
    updated_at: string;
    quality_score?: number;
    turn_count: number;
    prompt_preview?: string;
}
export interface Message {
    id?: number;
    conversation_id: string;
    role: 'user' | 'assistant' | 'system';
    content_text?: string;
    content_json?: string;
    timestamp: string;
    token_count?: number;
}
export interface ToolCall {
    id?: number;
    message_id: number;
    tool_name: string;
    tool_args?: string;
    tool_output?: string;
    status?: string;
    duration_ms?: number;
}
export interface HotEntity extends Entity {
    stats: EntityStats;
}
export interface EntityWithAssociations extends Entity {
    associations: Array<{
        target: Entity;
        weight: number;
        last_interaction_at?: string;
    }>;
}
/**
 * Memory Store using SQLite
 */
export declare class MemoryStore {
    private db;
    private dbPath;
    private projectPath;
    constructor(projectPath: string);
    /**
     * Initialize database schema
     */
    private initDatabase;
    /**
     * Migrate schema for existing databases
     */
    private migrateSchema;
    /**
     * Upsert an entity
     */
    upsertEntity(entity: Entity): number;
    /**
     * Get entity by type and normalized value
     */
    getEntity(type: string, normalizedValue: string): Entity | null;
    /**
     * Get entity by ID
     */
    getEntityById(id: number): Entity | null;
    /**
     * Get hot entities (by heat score)
     */
    getHotEntities(limit?: number): HotEntity[];
    /**
     * Log entity access
     */
    logAccess(log: AccessLog): void;
    /**
     * Get recent access logs for an entity
     */
    getRecentAccess(entityId: number, limit?: number): AccessLog[];
    /**
     * Update entity statistics
     */
    updateStats(entityId: number, action: 'read' | 'write' | 'mention'): void;
    /**
     * Get entity statistics
     */
    getStats(entityId: number): EntityStats | null;
    /**
     * Calculate and update heat score for an entity
     */
    calculateHeatScore(entityId: number): number;
    /**
     * Record association between entities
     */
    recordAssociation(sourceId: number, targetId: number, timestamp?: string): void;
    /**
     * Get associations for an entity
     */
    getAssociations(entityId: number, limit?: number): EntityWithAssociations['associations'];
    /**
     * Save prompt to history
     */
    savePrompt(prompt: PromptHistory): number;
    /**
     * Get prompt history for a session
     */
    getPromptHistory(sessionId: string, limit?: number): PromptHistory[];
    /**
     * Search prompts by text
     */
    searchPrompts(query: string, limit?: number): PromptHistory[];
    /**
     * Save or update a conversation
     */
    saveConversation(conversation: Conversation): void;
    /**
     * Get conversations
     */
    getConversations(limit?: number, offset?: number): Conversation[];
    /**
     * Get conversation by ID
     */
    getConversation(id: string): Conversation | null;
    /**
     * Save message
     */
    saveMessage(message: Message): number;
    /**
     * Get messages for a conversation
     */
    getMessages(conversationId: string): Message[];
    /**
     * Save tool call
     */
    saveToolCall(toolCall: ToolCall): number;
    /**
     * Get tool calls for a message
     */
    getToolCalls(messageId: number): ToolCall[];
    /**
     * Close database connection
     */
    close(): void;
}
/**
 * Get or create a store instance for a project
 * Uses normalized project ID as cache key to handle path casing differences
 */
export declare function getMemoryStore(projectPath: string): MemoryStore;
/**
 * Get aggregated stats from parent and all child projects
 * @param projectPath - Parent project path
 * @returns Aggregated statistics from all projects
 */
export declare function getAggregatedStats(projectPath: string): Promise<{
    entities: number;
    prompts: number;
    conversations: number;
    total: number;
    projects: Array<{
        path: string;
        stats: {
            entities: number;
            prompts: number;
            conversations: number;
        };
    }>;
}>;
/**
 * Get aggregated entities from parent and all child projects
 * @param projectPath - Parent project path
 * @param options - Query options
 * @returns Combined entities from all projects with source information
 */
export declare function getAggregatedEntities(projectPath: string, options?: {
    type?: string;
    limit?: number;
    offset?: number;
}): Promise<Array<HotEntity & {
    sourceProject?: string;
}>>;
/**
 * Get aggregated prompts from parent and all child projects
 * @param projectPath - Parent project path
 * @param limit - Maximum number of prompts to return
 * @returns Combined prompts from all projects with source information
 */
export declare function getAggregatedPrompts(projectPath: string, limit?: number): Promise<Array<PromptHistory & {
    sourceProject?: string;
}>>;
/**
 * Close all store instances
 */
export declare function closeAllStores(): void;
export default MemoryStore;
//# sourceMappingURL=memory-store.d.ts.map