/** * hashline-errors.ts — exit-code/stderr taxonomy mapping (plan D.2). * * The hashline binary is authoritative for failure semantics: exit 0 is a * valid payload (even for `*** Abort` no-ops); exit 1 is any logical error * with the diagnostic on stderr (pretty `Error: ...\nHint: ...` or a single * JSON object in `--json` mode). The wrapper never re-parses hashes or * re-derives staleness; it classifies the binary's stderr and adds model * teaching text. */ import { type ErrorPayload } from "./hashline-core"; /** Structured error kinds the host can react to (plan D.2). */ export type ErrorKind = "stale_anchor" | "empty_patch" | "ambiguous_hash" | "hash_not_found" | "out_of_range" | "invalid_anchor" | "binary_not_found" | "io"; export interface FormattedHashlineError { text: string; kind: ErrorKind; } /** Map the binary's structured `kind` to our host-facing kind. */ export declare function mapErrorKind(payload: ErrorPayload): ErrorKind; /** Parse the binary's stderr into a structured error, or null when unparseable. */ export declare function parseStderr(stderr: string): ErrorPayload | null; /** * Format an exit-1 stderr stream into the model-facing message plus a kind. * Always appends a re-read teaching line for stale-anchor/ambiguous cases. */ export declare function formatHashlineError(stderr: string, exitCode: number): FormattedHashlineError; /** Model-facing guidance appended for stale anchors. */ export declare const RE_READ_HINT = "Re-read the file with hashline_read and retry with a fresh N:hh anchor."; /** Install hint when the binary cannot be spawned (ENOENT). */ export declare const INSTALL_HINT = "hashline binary not found. Install it (add to PATH) or set HASHLINE_BIN to the absolute path of the binary."; //# sourceMappingURL=hashline-errors.d.ts.map