/**
 * Incremental Analyzer
 *
 * Enables incremental analysis based on user focus.
 * Instead of re-running full analysis on every turn, this module:
 * 1. Determines what's already analyzed
 * 2. Identifies what needs to be analyzed based on user focus
 * 3. Merges new findings with previous results
 *
 * This significantly improves multi-turn conversation efficiency.
 *
 * Design principles:
 * - Focus-driven scope determination
 * - Avoid redundant analysis
 * - Merge findings intelligently
 * - Track analysis coverage
 */
import type { Finding } from '../types';
import type { FocusStore, FocusEntityType } from '../context/focusStore';
import type { EntityStore, EntityId } from '../context/entityStore';
import type { FocusInterval } from '../strategies/types';
/**
 * Scope of incremental analysis
 */
export interface IncrementalScope {
    /** Type of analysis scope */
    type: 'entity' | 'timeRange' | 'question' | 'full';
    /** Entities to analyze (for entity scope) */
    entities?: Array<{
        type: FocusEntityType;
        id: EntityId;
    }>;
    /** Time ranges to analyze (for timeRange scope) */
    timeRanges?: Array<{
        start: string;
        end: string;
    }>;
    /** Focus intervals derived from scope */
    focusIntervals?: FocusInterval[];
    /** Agents to involve */
    relevantAgents: string[];
    /** Skills to use */
    relevantSkills: string[];
    /** Whether this is a new analysis or extension */
    isExtension: boolean;
    /** Reason for scope determination */
    reason: string;
}
/**
 * Result of incremental analysis
 */
export interface IncrementalResult {
    /** Newly discovered findings */
    newFindings: Finding[];
    /** Merged findings (new + previous) */
    mergedFindings: Finding[];
    /** Scope that was analyzed */
    analysisScope: IncrementalScope;
    /** Focuses that drove this analysis */
    focusesUsed: string[];
    /** Coverage tracking */
    coverage: {
        entitiesAnalyzed: number;
        timeRangesCovered: number;
        questionsAddressed: number;
    };
}
/**
 * Previous analysis state for merging
 */
export interface PreviousAnalysisState {
    findings: Finding[];
    analyzedEntityIds: Set<string>;
    analyzedTimeRanges: Array<{
        start: string;
        end: string;
    }>;
    analyzedQuestions: Set<string>;
}
export interface IncrementalAnalyzerConfig {
    /** Minimum focus weight to include in scope */
    minFocusWeight: number;
    /** Maximum entities to analyze per turn */
    maxEntitiesPerTurn: number;
    /** Maximum time ranges per turn */
    maxTimeRangesPerTurn: number;
    /** Whether to always include primary focus */
    alwaysIncludePrimaryFocus: boolean;
}
/**
 * Manages incremental analysis based on user focus.
 */
export declare class IncrementalAnalyzer {
    private config;
    constructor(config?: Partial<IncrementalAnalyzerConfig>);
    /**
     * Determine the scope of incremental analysis based on user focus.
     *
     * @param query - Current user query
     * @param focusStore - User focus tracking
     * @param entityStore - Entity cache
     * @param previousState - Previous analysis state
     * @returns Scope for incremental analysis
     */
    determineScope(query: string, focusStore: FocusStore, entityStore: EntityStore, previousState?: PreviousAnalysisState): IncrementalScope;
    /**
     * Build entity-focused scope.
     */
    private buildEntityScope;
    /**
     * Build time range-focused scope.
     */
    private buildTimeRangeScope;
    /**
     * Build question-focused scope.
     */
    private buildQuestionScope;
    /**
     * Build full analysis scope.
     */
    private buildFullScope;
    /**
     * Merge new findings with previous findings.
     */
    mergeFindings(previousFindings: Finding[], newFindings: Finding[]): Finding[];
    /**
     * Merge a single finding (update with new data).
     */
    private mergeSingleFinding;
    /**
     * Sort findings by importance.
     */
    private sortFindings;
    /**
     * Check if should do full analysis vs incremental.
     */
    shouldDoFullAnalysis(focusStore: FocusStore, previousState?: PreviousAnalysisState): boolean;
    /**
     * Get agents relevant for entity types.
     */
    private getAgentsForEntityTypes;
    /**
     * Get skills for given agents.
     */
    private getSkillsForAgents;
    /**
     * Infer relevant agents from question content.
     */
    private inferAgentsFromQuestions;
    /**
     * Get entity data from EntityStore.
     */
    private getEntityData;
    /**
     * Check if two time ranges overlap.
     */
    private rangesOverlap;
}
/**
 * Create an incremental analyzer instance.
 */
export declare function createIncrementalAnalyzer(config?: Partial<IncrementalAnalyzerConfig>): IncrementalAnalyzer;
export default IncrementalAnalyzer;
//# sourceMappingURL=incrementalAnalyzer.d.ts.map