import type { Command } from "commander"; import type { EmitContext, HarneryProgramContext } from "../commander.js"; import { type QaRunStage, type QaRunVerdict } from "../lib/browser/qa-run-contracts.js"; /** A running state whose heartbeat is older than this earns a staleness * warning, but stays "running" while the PID is alive. */ export declare const QA_STATUS_HEARTBEAT_STALE_MS = 120000; export type RunDirResolution = { ok: true; runDir: string; } | { ok: false; error: string; }; /** * Resolve `[path]` to a run directory. A file is a result document (its * directory is the run directory); a directory carrying a status or result * document is the run directory itself; any other directory is treated as a * run PARENT: its `run-*` children are scanned and the one with the newest * started_at wins, falling back to the `latest.json` pointer when no child * carries a status or result. Without a path, the newest managed QA artifact * under the repository's `.harnery/artifacts/` store is used. */ export declare function resolveRunDir(inputPath?: string, repoRoot?: string): RunDirResolution; export type QaStatusState = QaRunVerdict | "launching" | "queued" | "running" | "dead"; export interface QaStatusReport { state: QaStatusState; /** The result document exists; state is the run's final verdict. */ terminal: boolean; /** 0 completed-passed · 2 completed-failed · 4 completed-incomplete or * dead · 5 still in progress. */ exit: 0 | 2 | 4 | 5; run_id: string | null; pid: number | null; stage: QaRunStage | null; started_at: string | null; updated_at: string | null; completed_at: string | null; /** now minus the status document's updated_at; null without a heartbeat. */ heartbeat_age_ms: number | null; verdict?: QaRunVerdict; result_path?: string; log_path?: string; queue?: { resource: string; waiting_since: string; }; wall_time_ms?: Record; warnings: string[]; } export interface QaStatusDeps { /** PID liveness probe (injectable for tests). Default: process.kill(pid, 0). */ pidAlive?: (pid: number) => boolean; /** Evaluation instant in epoch milliseconds. Default: Date.now(). */ now?: () => number; } export type QaStatusClassification = { ok: true; report: QaStatusReport; } | { ok: false; error: string; }; /** * Classify one run directory, fail-closed. The result document is terminal * and authoritative when it exists; otherwise the status document plus a PID * liveness probe decides between a live state and "dead". Neither file is a * usage error, not a state. */ export declare function classifyRun(runDir: string, deps?: QaStatusDeps): QaStatusClassification; export declare function registerQaStatusCommand(program: Command, emit: EmitContext, context?: HarneryProgramContext): void; //# sourceMappingURL=qa-status.d.ts.map