/** * Per-pattern variable concentration analysis. * * Given a set of encoded events for one template and the template's slot * definitions, tally the distinct values per slot and compute each slot's * dominant values with percentages. * * Semantic naming is honest: structured-log slots get high-confidence * names from their preceding JSON/logfmt keys; free-text slots with * natural-language preceding tokens get medium-confidence inferred names; * positional-only slots get `slot_` with low confidence and no * hallucinated name. */ import type { EncodedEvent, Template } from './cli-output-parser.js'; export interface SlotConcentration { slot: number; precedingToken?: string; inferredName: string; namingConfidence: 'high' | 'medium' | 'low'; distinctCount: number; topValues: { value: string; count: number; pct: number; }[]; } export interface PatternConcentration { templateHash: string; symbolMessage?: string; template: string; count: number; severityDistribution: Record; dominantSeverity?: string; /** Concentration analysis per slot, sorted by strength of concentration (highest first). */ slots: SlotConcentration[]; /** Max top-value pct across all slots — "how concentrated is this pattern on one dimension". */ maxConcentration: number; } export interface VariableConcentrationOptions { /** How many top values per slot to surface. Default 3. */ topN?: number; /** Minimum events per pattern to bother computing concentration. Default 2. */ minCount?: number; /** Whether to sort slots by concentration strength (true) or by position (false). Default true. */ sortByStrength?: boolean; } /** * Compute per-pattern concentration from a list of encoded events grouped by template hash. * * @param events - encoded events, will be grouped by templateHash internally * @param templates - map of templateHash → Template (from parseTemplates) * @param options - optional tuning knobs */ export declare function computeConcentration(events: EncodedEvent[], templates: Map, options?: VariableConcentrationOptions): PatternConcentration[];