/**
 * Jank Cause Summarizer
 *
 * Aggregates jank root causes and produces a structured summary for
 * ConclusionGenerator. The preferred data source is per-frame mechanism records
 * captured from direct skill execution. Findings remain a compatibility fallback.
 */
import { Finding } from '../types';
import type { FrameMechanismRecord } from '../types/jankCause';
/**
 * Statistics for a single cause type.
 */
export interface CauseTypeStats {
    /** Cause type key (e.g., 'slice', 'gpu_fence', 'sched_latency') */
    causeType: string;
    /** Human-readable label (e.g., '主线程耗时操作') */
    label: string;
    /** Number of frames with this cause */
    frameCount: number;
    /** Percentage of total jank frames */
    percentage: number;
    /** Highest severity among frames with this cause */
    severity: 'critical' | 'warning' | 'info';
    /** Sample primary_cause descriptions (max 3 unique) */
    exampleCauses: string[];
}
/**
 * Clustered pattern across multiple jank frames.
 *
 * Cluster key is mechanism signature (trigger + supply + amplification),
 * sorted by frameCount so developers can fix the largest bucket first.
 */
export interface JankCluster {
    /** Stable display id (K1, K2, ...), assigned after sorting by size. */
    clusterId: string;
    /** Frame count in this cluster. */
    frameCount: number;
    /** Share among total jank frames (%). */
    percentage: number;
    /** Trigger-side label (usually cause_type label). */
    triggerFactor: string;
    /** Supply-side constraint label. */
    supplyConstraint: string;
    /** Amplification-path label. */
    amplificationPath: string;
    /** Representative cause_type key for this cluster. */
    causeType: string;
    frameIds: string[];
    representativeFrames: string[];
    /** Optional short examples from primary_cause. */
    samplePrimaryCauses: string[];
}
/**
 * Complete jank cause summary.
 */
export interface JankCauseSummary {
    /** Total number of analyzed jank frames */
    totalJankFrames: number;
    /** Most common cause (null if no causes found) */
    primaryCause: CauseTypeStats | null;
    /** Other significant causes (>=10% of frames) */
    secondaryCauses: CauseTypeStats[];
    /** Full breakdown of all causes */
    allCauses: CauseTypeStats[];
    /** Clustered patterns, sorted by frame count desc */
    clusters: JankCluster[];
    /** Pre-formatted summary text for LLM prompt */
    summaryText: string;
}
/**
 * Mapping from cause_type to human-readable Chinese labels.
 * These must match the cause_type values in jank_frame_detail.skill.yaml root_cause_summary SQL.
 */
export declare const CAUSE_TYPE_LABELS: Record<string, string>;
/**
 * Summarize jank causes.
 *
 * Preferred source: frameMechanismRecords (per-frame, dedupe-resistant).
 * Fallback source: findings with details.cause_type.
 */
export declare function summarizeJankCauses(findings: Finding[], frameMechanismRecords?: FrameMechanismRecord[]): JankCauseSummary;
/**
 * Format a JankCauseSummary for inclusion in conclusion generator prompt.
 * Returns empty string if no meaningful summary exists.
 */
export declare function formatJankSummaryForPrompt(summary: JankCauseSummary | undefined): string;
//# sourceMappingURL=jankCauseSummarizer.d.ts.map