import type { Anomaly } from '../debug/detector.js'; import type { CheckResult } from './runner.js'; import type { Check } from './spec.js'; import { type CheckRule } from './types.js'; /** The rule's numbers default to CHECK_RULE: two in a row, or three of the last ten — a check failing every third time never fails twice in a row. */ export interface CheckWatchOptions extends Partial { /** * After an anomaly the same check — and, when nothing accepted the connection, the same address — is quiet for this * long, whatever happens meanwhile. Default 5 min, like the detector. */ cooldownMs?: number; } export declare class CheckWatch { readonly options: Required; private readonly recent; private readonly lastReportedMs; /** When an outage of an address was last reported. */ private readonly addressReportedMs; /** Checks whose latest run got no connection, with the address they could not reach. */ private readonly down; private pending; private seq; constructor(options?: CheckWatchOptions); /** The numbers in force — what the Checks page colours by. */ get rule(): CheckRule; /** * The runner's `onResult`; `failures` is its count of failed runs in a row — the same number the Checks page shows. * `url` is where the request really went (a check's own `url` may be just a path): the address is taken from it. */ observe: (check: Check, result: CheckResult, failures: number, url: string) => void; /** New anomalies since the last call. */ take(): Anomaly[]; }