/**
 * Session Clustering Service
 * Intelligently groups related sessions into clusters using multi-dimensional similarity analysis
 */
import { SessionMetadataCache } from './core-memory-store.js';
export interface ClusteringOptions {
    scope?: 'all' | 'recent' | 'unclustered';
    timeRange?: {
        start: string;
        end: string;
    };
    minClusterSize?: number;
}
export interface ClusteringResult {
    clustersCreated: number;
    sessionsProcessed: number;
    sessionsClustered: number;
}
export declare class SessionClusteringService {
    private coreMemoryStore;
    private cliHistoryStore;
    private projectPath;
    constructor(projectPath: string);
    /**
     * Collect all session sources
     */
    collectSessions(options?: ClusteringOptions): Promise<SessionMetadataCache[]>;
    /**
     * Extract metadata from a session
     */
    extractMetadata(session: any, type: 'core_memory' | 'workflow' | 'cli_history' | 'native'): SessionMetadataCache;
    /**
     * Extract keywords from content
     */
    private extractKeywords;
    /**
     * Extract file patterns from content
     */
    private extractFilePatterns;
    /**
     * Calculate relevance score between two sessions
     */
    calculateRelevance(session1: SessionMetadataCache, session2: SessionMetadataCache): number;
    /**
     * Calculate file path overlap score (Jaccard similarity)
     */
    private calculateFileOverlap;
    /**
     * Calculate temporal proximity score
     * 24h: 1.0, 7d: 0.7, 30d: 0.4, >30d: 0.1
     */
    private calculateTemporalProximity;
    /**
     * Calculate semantic similarity using keyword overlap (Jaccard similarity)
     */
    private calculateSemanticSimilarity;
    /**
     * Calculate intent alignment score
     * Based on title/summary keyword matching
     */
    private calculateIntentAlignment;
    /**
     * Calculate vector similarity using pre-computed embeddings from memory_chunks
     * Returns average cosine similarity of chunk embeddings
     */
    private calculateVectorSimilarity;
    /**
     * Get session embedding by averaging all chunk embeddings
     */
    private getSessionEmbedding;
    /**
     * Calculate cosine similarity between two vectors
     */
    private cosineSimilarity;
    /**
     * Find the most relevant existing cluster for a set of session IDs
     * Returns the cluster with highest session overlap
     */
    private findExistingClusterForSessions;
    /**
     * Determine if a new cluster should merge with an existing one
     * Based on 70% session overlap threshold
     */
    private shouldMergeWithExisting;
    /**
     * Run auto-clustering algorithm
     * Optimized to prevent duplicate clusters by checking existing clusters first
     */
    autocluster(options?: ClusteringOptions): Promise<ClusteringResult>;
    /**
     * Deduplicate clusters by merging similar ones
     * Clusters with same name or >50% member overlap are merged
     * @returns Statistics about deduplication
     */
    deduplicateClusters(): Promise<{
        merged: number;
        deleted: number;
        remaining: number;
    }>;
    /**
     * Agglomerative clustering algorithm
     * Returns array of clusters (each cluster is array of sessions)
     */
    private agglomerativeClustering;
    /**
     * Calculate average linkage between two clusters
     */
    private averageLinkage;
    /**
     * Generate cluster name from members
     */
    private generateClusterName;
    /**
     * Generate cluster intent from members
     */
    private generateClusterIntent;
    /**
     * Get progressive disclosure index for hook
     * @param options - Configuration options
     * @param options.type - 'session-start' returns recent sessions, 'context' returns intent-matched sessions
     * @param options.sessionId - Current session ID (optional)
     * @param options.prompt - User prompt for intent matching (required for 'context' type)
     */
    getProgressiveIndex(options: {
        type: 'session-start' | 'context';
        sessionId?: string;
        prompt?: string;
    }): Promise<string>;
    /**
     * Get recent sessions index (for session-start)
     * Shows sessions grouped by clusters with progressive disclosure
     */
    private getRecentSessionsIndex;
    /**
     * Get intent-matched sessions index (for context with prompt)
     * Shows sessions grouped by clusters and ranked by relevance
     */
    private getIntentMatchedIndex;
    /**
     * Legacy method for backward compatibility
     * @deprecated Use getProgressiveIndex({ type, sessionId, prompt }) instead
     */
    getProgressiveIndexLegacy(sessionId?: string): Promise<string>;
    /**
     * Parse workflow session files
     */
    private parseWorkflowSessions;
    /**
     * Update metadata cache for all sessions
     */
    refreshMetadataCache(): Promise<number>;
}
//# sourceMappingURL=session-clustering-service.d.ts.map