import { type Incident, type IncidentKind } from "./incidents.js"; export interface Heal { at: string; kind: IncidentKind; shape: string; commit: string; } export interface ActiveGroup { kind: IncidentKind; message: string; /** Occurrences in the window AFTER the latest matching heal. */ count: number; latest: Incident; /** Healed before, and it came back. */ recurred: boolean; /** Reverted heal attempts on record for this group. */ failedAttempts: number; } /** * The heals a checkout has on record. Null for an installed package, which * cannot heal at all, so it has none rather than an empty file somewhere. */ export declare function readHeals(checkout: string | null): Heal[]; export declare function recordHeal(checkout: string, heal: Heal): void; /** * The groups still exerting pressure: windowed occurrences after the latest * matching heal, with the failed-attempt count that says "needs a person". */ export declare function activeGroups(incidents: Incident[], heals: Heal[], opts?: { sinceDays?: number; now?: string; }): ActiveGroup[]; /** * The one group this run works on: the heaviest active group that is not a * record of healing itself failing and has not already burned two attempts. */ export declare function pickGroup(groups: ActiveGroup[]): { picked: ActiveGroup | null; skipped: { group: ActiveGroup; why: string; }[]; }; /** * Projects whose frozen sets can grade a heal, newest incident first. Used * when --project was not given: the replay gate should not be an opt-in * while the protocol describes it as part of the bar. */ export declare function discoverReplayProjects(incidents: Incident[], limit?: number): Promise; /** * Drop incidents older than 90 days once a log exceeds 2000 lines. Called * only under the self-heal lock, the one writer allowed to rewrite the files * everybody else only appends to, and called once per source: each project * keeps its own log and each grows at its own rate. */ export declare function compactIncidents(projectDir: string, now?: string): number;