/** * Whole-run analysis: metrics, findings, verdict, stop point. * * Deterministic by construction. The same Run always produces the same Analysis, * which is what makes the detectors themselves testable and what makes a future * LLM narrator measurable against a fixed baseline. */ import { type Finding, type Label, type Run, type Severity } from "../model.js"; import { type Verification } from "./verify.js"; /** * Bumped when grading changes in a way that would relabel a stored run. * * 1.1.0 added the `unchanged` label, so a store graded by 1.0.0 still shows those * runs as `questionable`. `flightrec list` and the dashboard say so rather than * leaving a silent mix — the store is an archive, so deleting it is not an answer. * * 1.2.0 stopped treating elapsed time as evidence of waste, so long no-diff runs * that a 1.1.0 store graded `wasteful` are now `unchanged`. Since 1.2.0 `ingest` * regrades on an analyzer change instead of skipping unchanged files, so this is * the last version that needs `--force` to take effect. */ export declare const ANALYZER_VERSION = "1.2.0"; export interface StopPoint { eventIdx: number; ts: string | null; reason: string; trigger: string; findingId: string; eventsAfter: number; minutesAfter: number | null; editsAfter: number; checksAfter: number; } export interface Metrics { filesChanged: number; linesAdded: number; linesRemoved: number; churnedLines: number; toolCalls: number; commands: number; failedCommands: number; durationS: number | null; totalTokens: number; costUsd: number | null; costKnown: boolean; compactions: number; loopFindings: number; highFindings: number; /** commands that plausibly wrote files the trace cannot show */ unrecordedWrites: number; } export interface Analysis { runId: string; label: Label; labelReason: string; /** Which branch of the cascade decided the label — the explanation, not decoration. */ labelRule: LabelRule; findings: Finding[]; verification: Verification; stopPoint: StopPoint | null; metrics: Metrics; maxSeverity: Severity; /** no tool calls, no diff, no commands, seconds long — noise, not a run */ trivial: boolean; analyzerVersion: string; } export declare function analyze(run: Run): Analysis; /** Stable identifier for which branch of the cascade decided the label. */ export type LabelRule = "risk-override" | "no-diff-opaque" | "no-diff-spent" | "changed-looping-unverified" | "changed-verified" | "changed-failing" | "changed-unverified" | "no-diff-no-signal" | "fallback"; export type { Verification } from "./verify.js";