/**
 * Memory Lifecycle Hooks
 *
 * Inspired by OpenClaw's lifecycle hooks for memory management.
 * Automatically injects relevant memories before agent execution
 * and captures important information after conversations.
 *
 * Hooks:
 * - before_agent_execute: Inject relevant memories into context
 * - after_agent_response: Capture important information
 * - session_end: Summarize and store conversation
 */
import { EventEmitter } from 'events';
import { EnhancedMemory, MemoryEntry } from './enhanced-memory.js';
import { AutoCaptureManager } from './auto-capture.js';
export interface MemoryHookContext {
    sessionId: string;
    projectId?: string;
    query: string;
    messages?: Array<{
        role: string;
        content: string;
    }>;
}
export interface BeforeExecuteResult {
    injectedContext: string;
    recalledMemories: MemoryEntry[];
    tokenCount: number;
}
export interface AfterResponseResult {
    capturedCount: number;
    capturedMemories: string[];
}
export interface SessionEndResult {
    summaryId?: string;
    memoriesStored: number;
}
export interface MemoryLifecycleConfig {
    /** Enable memory injection before execution */
    enableRecall: boolean;
    /** Enable auto-capture after responses */
    enableCapture: boolean;
    /** Enable session summarization */
    enableSummarization: boolean;
    /** Maximum tokens for memory injection */
    maxRecallTokens: number;
    /** Minimum messages before summarization */
    minMessagesForSummary: number;
    /** Memory types to recall */
    recallTypes?: string[];
}
/**
 * Memory Lifecycle Hooks Manager
 *
 * Manages automatic memory recall and capture during agent execution.
 */
export declare class MemoryLifecycleHooks extends EventEmitter {
    private config;
    private memory;
    private autoCapture;
    private sessionMessages;
    constructor(memory: EnhancedMemory, config?: Partial<MemoryLifecycleConfig>);
    /**
     * Hook called before agent execution
     * Injects relevant memories into the context
     */
    beforeExecute(context: MemoryHookContext): Promise<BeforeExecuteResult>;
    /**
     * Hook called after agent response
     * Captures important information from user messages
     */
    afterResponse(context: MemoryHookContext, userMessage: string, assistantResponse: string): Promise<AfterResponseResult>;
    /**
     * Hook called when session ends
     * Summarizes conversation and stores key information
     */
    sessionEnd(sessionId: string, projectId?: string): Promise<SessionEndResult>;
    /**
     * Track a message for session summarization
     */
    private trackMessage;
    /**
     * Extract key information from conversation messages
     */
    private extractKeyInformation;
    /**
     * Generate a simple summary from messages
     */
    private generateSimpleSummary;
    /**
     * Get lifecycle hooks statistics
     */
    getStats(): {
        activeSessions: number;
        totalMessagesTracked: number;
        autoCaptureStats: ReturnType<AutoCaptureManager['getStats']>;
    };
    /**
     * Clear all session data
     */
    clearSessions(): void;
}
/**
 * Get memory lifecycle hooks instance
 */
export declare function getMemoryLifecycleHooks(memory?: EnhancedMemory): MemoryLifecycleHooks;
/**
 * Reset memory lifecycle hooks
 */
export declare function resetMemoryLifecycleHooks(): void;
export default MemoryLifecycleHooks;
