import type { FailureLedger, FailureCategory } from './FailureLedger.js';
export { scrubSecrets } from './scrubSecrets.js';
/** What the poller needs to know about a mapped initiative (a subset of Initiative). */
export interface CiInitiativeRef {
    id: string;
    projectId?: string;
    specPath?: string;
    origin?: string;
}
export interface CiFailurePollerOptions {
    ledger: FailureLedger;
    /** Exact-OID reverse lookup (InitiativeTracker.findByMergeCommit). */
    resolveByMergeCommit: (oid: string) => CiInitiativeRef | undefined;
    /** Resolve the `owner/name` repo (validated by the poller). Return null if none. */
    resolveRepo: () => string | null;
    /** Injectable gh runner (args array). Default: execFileSync('gh', args). */
    runGh?: (args: string[]) => string;
    /** Only poll when this returns true (fenced-lease holder). Default: always. */
    isLeaseHolder?: () => boolean;
    /** Poll interval (ms). Default 6h. */
    intervalMs?: number;
    /** Max failed runs filed per tick (spec §5). Default 50. */
    maxRunsPerTick?: number;
    /** gh run list --limit value (the query window). Default 50. */
    ghLimit?: number;
    onError?: (err: unknown) => void;
}
interface GhRun {
    databaseId?: number;
    conclusion?: string;
    status?: string;
    headBranch?: string;
    headSha?: string;
    name?: string;
    createdAt?: string;
}
/** Deterministic CI job-name → FailureCategory (fixed allow-list, never raw name). */
export declare function ciCategoryFromName(name: string | undefined): FailureCategory;
/**
 * Keep only genuine current failures: group runs by head SHA, take the LATEST
 * by createdAt per SHA, and return those whose latest conclusion is 'failure'.
 * A SHA whose latest run succeeded (a re-run recovery) is dropped (flaky guard).
 */
export declare function currentFailures(runs: GhRun[]): GhRun[];
export declare class CiFailurePoller {
    private readonly ledger;
    private readonly resolveByMergeCommit;
    private readonly resolveRepo;
    private readonly runGh;
    private readonly isLeaseHolder;
    private readonly intervalMs;
    private readonly maxRunsPerTick;
    private readonly ghLimit;
    private readonly onError;
    private timer;
    private running;
    constructor(opts: CiFailurePollerOptions);
    start(): void;
    stop(): void;
    /** One poll. Public for tests. Fail-open throughout. Returns # records filed. */
    tick(): number;
}
//# sourceMappingURL=CiFailurePoller.d.ts.map