/** * The review's numbers (DES-RUNS-REVIEW-001 §4-§5): a snapshot of {@link RunFact}s in, `facts.json` out. Pure and * deterministic. The workflow's `analyze` Tool phase runs it (`analyze-cli.ts`), so every metric, interval and * candidate recommendation is computed by code, never by the model. The `interpret` seat only reads the result. */ import type { RunFact } from './run-facts.js'; import { type Interval, type Verdict } from './stats.js'; export declare const FACTS_VERSION = 1; /** The most recommendations one review makes; the rest are watched. */ export declare const MAX_RECOMMENDATIONS = 5; /** A single-cause pattern needs this many runs behind it. */ export declare const PATTERN_MIN_RUNS = 3; /** "Working well": a segment's pass rate at or above this, on at least MIN_SAMPLE runs. */ export declare const WORKING_WELL_RATE = 0.8; export interface Window { startMs: number; endMs: number; } export interface Snapshot { version: 1; generatedAtMs: number; window: Window; /** The previous windows (same length), newest first. Their runs together are the baseline. */ baselineWindows: Window[]; projectIds: string[]; runs: RunFact[]; } export type MetricId = 'pass_rate' | 'override_rate' | 'unresolved_rate' | 'time_to_pr' | 'floor_minutes' | 'wait_on_people' | 'spend' | 'retries'; export type MetricKind = 'rate' | 'median'; export interface MetricDef { id: MetricId; label: string; kind: MetricKind; unit: 'ratio' | 'minutes' | 'usd' | 'count'; higherIsBetter: boolean; } export declare const METRICS: readonly MetricDef[]; export interface SampleStat { n: number; /** The rate, or the median. `null` with no sample. */ value: number | null; interval: Interval | null; p75?: number | null; p90?: number | null; } export interface MetricResult { metric: MetricId; /** `all`, `repo:`, `agent:`, `workflow:`. */ segment: string; window: SampleStat; baseline: SampleStat; verdict: Verdict; /** The run ids the window sample counted (evidence). */ runs: string[]; } export type RecommendationKind = 'steering-rule' | 'memory' | 'setting' | 'issue' | 'resolve-stale'; export type Confidence = 'high' | 'medium' | 'low'; export interface EvidenceRun { id: string; title: string; } export interface Candidate { /** Stable for the same cause: re-derived reviews name the same id. */ id: string; kind: RecommendationKind; title: string; evidence: { line: string; runs: EvidenceRun[]; metric?: MetricId; segment?: string; n: number; value?: number | null; baseline?: number | null; interval?: Interval | null; }; expectedEffect: string; confidence: Confidence; changeMind: string; /** runs affected + hours at stake + dollars at stake: the ranking key. */ impact: number; /** Why it qualified: a notable change, or a single-cause pattern. */ basis: 'notable' | 'pattern'; action: { setting?: string; issue?: { repoRef: string | null; title: string; body: string; }; runs?: string[]; proposal?: { kindType: string; content: string; severity?: string; }; }; } export interface Finding { metric: MetricId; segment: string; line: string; window: SampleStat; baseline: SampleStat; } export interface Facts { version: typeof FACTS_VERSION; generatedAtMs: number; window: Window; baselineWindows: Window[]; projectIds: string[]; totals: { runs: number; baselineRuns: number; passed: number; failed: number; cancelled: number; open: number; spendUsd: number; tokens: number; }; minSample: number; metrics: MetricResult[]; /** What got better (a notable improvement) and what is working (a high pass rate on enough runs). */ improvements: Finding[]; regressions: Finding[]; /** Every candidate, ranked by impact (highest first). */ candidates: Candidate[]; /** The candidate ids recommended (≤ MAX_RECOMMENDATIONS) and the ones watched. */ recommended: string[]; watching: string[]; } export declare function formatValue(def: MetricDef, v: number | null): string; export declare function segmentWords(segment: string): string; export declare function analyze(snapshot: Snapshot): Facts; //# sourceMappingURL=analyze.d.ts.map