/** * attempt-result — the structured completion contract for a worker attempt. * * G-026 M3 (ADR-0004 #7/#61): attempt-result.json is the canonical completion * record. Ordinary Markdown (`success`, `N tests passed`, `status=passed`) * never constitutes strong evidence. exit_code may be null only when * exit_code_known=false is recorded explicitly. The orchestrator recomputes * artifact hashes — worker-reported hashes are never trusted. */ export type WorkerResultStatus = "passed" | "failed" | "timeout" | "cancelled" | "stalled"; export interface AttemptArtifact { /** Path relative to the attempt's artifact dir. */ relpath: string; /** Byte size on disk (orchestrator-verified). */ size: number; /** sha256 hex (orchestrator-recomputed). */ sha256: string; /** MIME-ish hint (optional). */ kind?: string; } export interface AttemptResult { attemptId: string; taskId: string; changeId: string; /** exit code if known; null only when exit_code_known=false. */ exit_code: number | null; exit_code_known: boolean; status: WorkerResultStatus; started_at: string; finished_at: string; /** Points to the worker-added state file (e.g. done.signal path). */ artifact_path?: string; artifact: AttemptArtifact[]; /** True when result was written by an orchestrator adapter (not the worker). */ producer?: "worker" | "adapter"; } export interface AttemptResultOutput { result: AttemptResult; /** Where the JSON was persisted. */ path: string; } /** Is the desired status consistent with exit code semantics? */ export declare function resultStatusFromExit(exit_code: number | null, exit_code_known: boolean, timeout_at?: number | undefined): WorkerResultStatus; /** Compute sha256 for a single artifact file (orchestrator side). */ export declare function sha256File(absPath: string): Promise; /** * Collect artifacts from a dir, recomputing size + hash (never trusting the * worker). Returns [] when the dir is missing/empty. */ export declare function collectArtifacts(artifactDir: string, kinds?: Record): Promise; /** * Persist an attempt result atomically (tmp + rename) under the current * attempt's evidence dir. Returns canonical path. */ export declare function saveAttemptResult(ctx: { evidenceDir: string; attemptDir: string; }, result: AttemptResult): Promise; /** Read and structurally validate an attempt result (fail-closed on inconsistency). */ export declare function readAttemptResult(evidenceDir: string): Promise;