import type { QaReport } from './report.js'; export type QaRunStatus = 'working' | 'completed' | 'failed' | 'cancelled'; export interface RunRecord { taskId: string; status: QaRunStatus; suite_name: string; project_path: string; createdAt: string; lastUpdatedAt: string; /** 终态保留时长(ms,默认 1h);透传 wire TaskStatusNotificationParams.ttl 时按目标单位换算 */ ttl: number; progress: { step: number; total: number; current?: string; }; /** 内部字段,不出 wire */ cancelRequested: boolean; /** 内部字段,不出 wire;close 收尾 await 用 */ done?: Promise; report?: QaReport; reportPaths?: { json_path: string; md_path: string; }; /** 终态失败原因(PR-1b M-8);finishRun 尾参写入 */ error?: string; } export declare class QaBusyError extends Error { readonly currentRunId: string; constructor(currentRunId: string); } export declare function registerRun(runId: string, suiteName: string, projectPath: string, stepsTotal: number): RunRecord; export declare function getRun(runId: string): RunRecord | undefined; export declare function listRuns(): RunRecord[]; export declare function activeWorkingRun(): RunRecord | undefined; export declare function requestCancel(runId: string): { ok: boolean; message?: string; }; export declare function setTerminalNotifier(fn: ((runId: string, status: 'completed' | 'failed' | 'cancelled') => void) | null): void; export declare function finishRun(runId: string, status: 'completed' | 'failed' | 'cancelled', report?: QaReport, reportPaths?: { json_path: string; md_path: string; }, error?: string): void; export declare function updateProgress(runId: string, step: number, total: number, current?: string): void; export declare function clearRegistry(): void; /** * close 优雅收尾:对 working run 置取消并等待 settle(报告落 CANCELLED + 录制证据落盘), * 供 GodotServer.close 的 safeStep 序列调用。超时放弃等——killProcess 进程级兜底已有,不重复。 * * 等待上限:spec §2.4 原文 = suite_budget_ms,registry 无 budget 字段,近似取 min(maxWaitMs, ttl)。 * settled 判定可靠性:done settle 意味着 finishRun 已执行(done = exec.then(...),finishRun * 在 exec 的 then/catch 回调内、先于 done resolve),故 await 返回后 status 必已更新。 */ export declare function cancelAndAwaitWorkingRun(maxWaitMs?: number): Promise<{ cancelled: string | null; settled: boolean; }>;