/**
 * REST-backed reads for PR CI state — the engine behind the `gh` overload shim.
 *
 * The problem this exists for: the whole fleet shares one GitHub token, and the
 * merge loop's `gh pr checks/view/list` are all **GraphQL**-backed. GraphQL is
 * metered on a 5000-POINT/hr budget separate from REST core (5000 req/hr), so the
 * fleet drains GraphQL while REST core sits idle, and every agent's CI watch dies
 * with `GraphQL: API rate limit already exceeded`. These functions answer the same
 * questions over REST, which is the budget nobody is using.
 *
 * They also fix PHNX-3042 (a superseded run's red reported as the current verdict):
 * `commits/{sha}/check-runs` returns ONLY runs for that exact SHA, so anchoring on
 * the PR's live head SHA can never surface a stale run from a superseded commit —
 * the head-exact property `gh pr checks`'s denormalized GraphQL rollup lacks.
 *
 * `gh api …` here draws REST core, and reuses {@link ghExec}'s hardened env
 * (`ghEnv` strips FORCE_COLOR / pins GH_NO_COLOR — this fleet exports FORCE_COLOR
 * and gh otherwise paints the JSON payload and JSON.parse dies).
 */
import { type GhExec } from './pr-mergeable.js';
import type { StatusCheck } from './pr-verdict.js';
/** A rollup item shaped like `gh pr checks --json`, built from REST. */
export interface RollupItem extends StatusCheck {
    /** Check name / status context. */
    name: string;
    /** html_url (check-run) or target_url (legacy status); may be empty. */
    link?: string;
}
/** PR head identity — the SHA every check query must anchor to. */
export interface PrHead {
    number: number;
    sha: string;
}
/**
 * Resolve a PR's current head SHA over REST (`GET repos/{repo}/pulls/{n}`).
 *
 * This is the anchor for every check query: pinning to the live head SHA is what
 * makes the watch immune to a superseded run's verdict (PHNX-3042). Throws if the
 * PR has no head SHA (deleted / not found) rather than returning a wrong empty.
 */
export declare function prHead(repo: string, number: number, gh?: GhExec): Promise<PrHead>;
/**
 * The status-check rollup for ONE commit SHA, over REST — the union of the two
 * GitHub subsystems `gh pr checks`'s GraphQL rollup merges for you:
 *
 *   - `GET commits/{sha}/check-runs` — GitHub Actions + check-run apps (paginated).
 *   - `GET commits/{sha}/status`     — legacy commit statuses (external CI).
 *
 * Deduped by name; a check-run wins over a legacy status of the same context.
 * Fields are ASCII-upper-cased to match {@link StatusCheck}, which
 * {@link isCiGreen} reads as `conclusion || state || status`.
 */
export declare function rollupForSha(repo: string, sha: string, gh?: GhExec): Promise<RollupItem[]>;
/**
 * How many check-suites are still queued/in_progress for a SHA.
 *
 * Disambiguates the empty rollup: a suite that is `queued`/`in_progress` with no
 * runs yet means "checks are coming, not registered" (keep polling), NOT "this PR
 * has no checks" (terminal). Without this, a `--watch` on a freshly-pushed SHA
 * would read an empty rollup as green before CI registers.
 */
export declare function pendingCheckSuites(repo: string, sha: string, gh?: GhExec): Promise<number>;
/** True when gh stderr is the rate-limit outcome the shim should switch to REST on. */
export declare function isRateLimitError(stderr: string): boolean;
