/**
 * Focus Store - User Focus Tracking for Multi-Turn Context
 *
 * Tracks what the user is interested in across conversation turns.
 * This enables incremental analysis that builds on previous interactions.
 *
 * Focus types:
 * 1. Entity focus - specific frame, process, thread, session
 * 2. Time range focus - specific time interval
 * 3. Metric focus - particular metric (FPS, latency, etc.)
 * 4. Question focus - conceptual question being explored
 *
 * Design principles:
 * - Decay-based weighting (recent interactions matter more)
 * - Interaction history for context
 * - Serializable for session persistence
 * - Integrates with EntityStore for entity resolution
 */
import type { EntityId, EntityStore } from './entityStore';
/**
 * Types of focus targets
 */
export type FocusType = 'entity' | 'timeRange' | 'metric' | 'question';
/**
 * Entity types for entity focus
 */
export type FocusEntityType = 'frame' | 'process' | 'thread' | 'session' | 'cpu_slice' | 'binder' | 'gc' | 'memory';
/**
 * Focus target specification
 */
export interface FocusTarget {
    entityType?: FocusEntityType;
    entityId?: EntityId;
    entityName?: string;
    timeRange?: {
        start: bigint | string;
        end: bigint | string;
    };
    metricName?: string;
    metricThreshold?: number;
    question?: string;
    questionCategory?: string;
}
/**
 * Interaction event that updates focus
 */
export interface FocusInteraction {
    type: 'click' | 'query' | 'drill_down' | 'compare' | 'extend' | 'explicit';
    target: FocusTarget;
    source: 'ui' | 'query' | 'agent' | 'system';
    timestamp: number;
    context?: Record<string, any>;
}
/**
 * User focus with weight and history
 */
export interface UserFocus {
    id: string;
    type: FocusType;
    target: FocusTarget;
    /** Weight 0-1, based on interaction frequency and recency */
    weight: number;
    /** Timestamp of last interaction */
    lastInteractionTime: number;
    /** History of interactions that built this focus */
    interactionHistory: FocusInteraction[];
    /** Creation time */
    createdAt: number;
}
/**
 * Serializable snapshot for persistence
 */
export interface FocusStoreSnapshot {
    version: number;
    focuses: UserFocus[];
}
export interface FocusStoreConfig {
    /** Maximum focuses to track */
    maxFocuses: number;
    /** Decay rate per minute (0-1) */
    decayRatePerMinute: number;
    /** Boost multiplier for new interactions */
    boostMultiplier: number;
    /** Minimum weight before focus is removed */
    minWeight: number;
    /** Maximum interaction history per focus */
    maxHistoryPerFocus: number;
}
/**
 * Tracks user focus across conversation turns.
 *
 * Usage pattern:
 * 1. Record interactions from UI (clicks) and queries
 * 2. Get top focuses for LLM context
 * 3. Use focuses to determine incremental analysis scope
 * 4. Serialize for session persistence
 */
export declare class FocusStore {
    private config;
    private focuses;
    private lastDecayTime;
    constructor(config?: Partial<FocusStoreConfig>);
    /**
     * Record a user interaction that updates focus.
     */
    recordInteraction(interaction: FocusInteraction): void;
    /**
     * Record entity click from UI.
     */
    recordEntityClick(entityType: FocusEntityType, entityId: EntityId, context?: Record<string, any>): void;
    /**
     * Record time range selection from UI.
     */
    recordTimeRangeClick(start: bigint | string, end: bigint | string, context?: Record<string, any>): void;
    /**
     * Record question from user query.
     */
    recordQuestion(question: string, category?: string): void;
    /**
     * Record drill-down action.
     */
    recordDrillDown(target: FocusTarget): void;
    /**
     * Get the top N focuses by weight.
     */
    getTopFocuses(limit?: number): UserFocus[];
    /**
     * Get focuses of a specific type.
     */
    getFocusesByType(type: FocusType): UserFocus[];
    /**
     * Get focus for a specific entity.
     */
    getEntityFocus(entityType: FocusEntityType, entityId: EntityId): UserFocus | undefined;
    /**
     * Check if an entity is currently focused.
     */
    isEntityFocused(entityType: FocusEntityType, entityId: EntityId): boolean;
    /**
     * Get current primary focus (highest weight).
     */
    getPrimaryFocus(): UserFocus | undefined;
    /**
     * Get all focuses.
     */
    getAllFocuses(): UserFocus[];
    /**
     * Build focus context string for LLM prompts.
     */
    buildFocusContext(maxFocuses?: number): string;
    /**
     * Build focus context for incremental analysis.
     */
    buildIncrementalContext(): {
        focusedEntities: Array<{
            type: FocusEntityType;
            id: EntityId;
        }>;
        focusedTimeRanges: Array<{
            start: string;
            end: string;
        }>;
        focusedQuestions: string[];
        primaryFocusType: FocusType | null;
    };
    /**
     * Describe a focus in human-readable form.
     */
    private describeFocus;
    /**
     * Apply time-based decay to all focuses.
     */
    private applyDecay;
    /**
     * Apply decay and then boost for a new interaction.
     */
    private decayAndBoost;
    /**
     * Prune focuses if exceeding max.
     */
    private pruneIfNeeded;
    /**
     * Compute unique focus ID from target.
     */
    private computeFocusId;
    /**
     * Infer focus type from interaction.
     */
    private inferFocusType;
    /**
     * Sync focused entities from EntityStore.
     * Call this after EntityStore updates to ensure focuses are valid.
     */
    syncWithEntityStore(entityStore: EntityStore): void;
    /**
     * Serialize to JSON-safe snapshot.
     */
    serialize(): FocusStoreSnapshot;
    /**
     * Deserialize from snapshot.
     */
    static deserialize(snapshot: FocusStoreSnapshot, config?: Partial<FocusStoreConfig>): FocusStore;
    /**
     * Load a snapshot into this FocusStore instance (in-place).
     * Converts any BigInt-like fields to JSON-safe representations (string).
     */
    loadSnapshot(snapshot: FocusStoreSnapshot): void;
    /**
     * Clear all focuses.
     */
    clear(): void;
    /**
     * Get statistics.
     */
    getStats(): {
        totalFocuses: number;
        byType: Record<FocusType, number>;
        averageWeight: number;
    };
    private normalizeInteractionForStorage;
    private normalizeTargetForSerialization;
    private normalizeFocusForSerialization;
}
/**
 * Create a new FocusStore instance.
 */
export declare function createFocusStore(config?: Partial<FocusStoreConfig>): FocusStore;
export default FocusStore;
//# sourceMappingURL=focusStore.d.ts.map