/**
 * Skill health analyzer (v0.18 skill-health).
 *
 * 接 trace-adapter 输出 → 按 skill 维度聚合 coverage + gap,产出 SkillHealthReport。
 * 复用 analysis/coverage-analyzer + analysis/gap-analyzer,跳过对照组逻辑。
 * 定位是"真实使用 trace 的 skill 维度观察",不是通用 APM / 生产监控。
 *
 * 分析流水线:
 *   1. ccTracesToResultEntries(path) → segments + ResultEntry[]
 *   2. 时间窗 / skill 白名单过滤
 *   3. 按 skill name (variant key) 分别 computeCoverage + computeGapReport
 *   4. 聚合 overall 指标 + 健康度色带
 */
import { type CoverageReport } from '../analysis/coverage-analyzer.js';
import type { GapReport } from '../types/index.js';
import { type CcSession, type SkillSegment } from './trace-adapter.js';
export interface SkillHealth {
    skillName: string;
    segmentCount: number;
    toolCallCount: number;
    toolFailureCount: number;
    /** 失败率 = toolFailureCount / toolCallCount; toolCallCount=0 时为 0 */
    toolFailureRate: number;
    /**
     * 执行稳定性标签。阈值:
     *  - very-unstable: failureRate >= 0.4 (gap 信号极可能是环境问题,不是真知识缺口)
     *  - unstable:      failureRate >= 0.2 (建议排查环境后再看 gap)
     *  - stable:        否则
     */
    stability: 'stable' | 'unstable' | 'very-unstable';
    /** 成本/耗时聚合(来自 SkillSegment.metrics,第四轴). 粒度是 skill 级,非单次调用级 */
    usage: {
        inputTokens: number;
        outputTokens: number;
        cacheReadTokens: number;
        cacheCreationTokens: number;
        totalTokens: number;
        durationMs: number;
        numTurns: number;
        avgTokensPerSegment: number;
        avgDurationMsPerSegment: number;
    };
    coverage: CoverageReport | null;
    gap: GapReport;
}
export interface SkillHealthReport {
    meta: {
        tracePath: string;
        kbPath: string | null;
        sessionCount: number;
        segmentCount: number;
        messageCount: number;
        toolCallCount: number;
        toolFailureRate: number;
        timeRange: {
            from: string;
            to: string;
        };
        generatedAt: string;
    };
    bySkill: Record<string, SkillHealth>;
    overall: {
        gapRate: number;
        weightedGapRate: number;
        healthBand: 'green' | 'yellow' | 'red';
    };
}
export interface AnalyzeOptions {
    kbRoot?: string | null;
    from?: string;
    to?: string;
    skills?: string[];
}
/**
 * 主入口:从 cc trace 目录生成 SkillHealthReport。
 */
export declare function computeSkillHealthReport(tracePath: string, opts?: AnalyzeOptions): SkillHealthReport;
/**
 * 便利入口:直接从已准备好的 segments(跳过 loadCcSessions)算 report。
 * 用于测试 / 已手工组装过 segments 的场景。
 */
export declare function computeSkillHealthFromSegments(segments: SkillSegment[], sessions: CcSession[], tracePath: string, opts?: AnalyzeOptions): SkillHealthReport;
//# sourceMappingURL=skill-health-analyzer.d.ts.map