/** * Safe diagnostic identity for a terminal failure. * * A failure report names its failure only from sets the CLI can enumerate: * an application error's problem or code, a typed failure's tag, a defect's * built-in error kind or tag. Nothing here reads a detail, message, metadata, * cause text, argument, or path, so none of them can reach a report. */ import * as Cause from "effect/Cause"; import * as Option from "effect/Option"; import { type AppErrorCode } from "../app-error/index.js"; import type { TelemetryFailurePhase } from "../telemetry/index.js"; export interface FailureIdentity { /** Stable diagnostic identifier; `unknown` when no enumerable one applies. */ readonly kind: string; readonly code: AppErrorCode; /** False for a defect. */ readonly handled: boolean; } export interface TerminalFailure extends FailureIdentity { readonly phase: TelemetryFailurePhase; } /** Identity of an expected failure the CLI handled and rendered. */ export declare const handledFailureIdentity: (failure: unknown) => FailureIdentity; /** Identity of an unexpected defect: its tag, else its built-in error kind. */ export declare const defectIdentity: (defect: unknown) => FailureIdentity; /** The defect a cause carries: its first die, else what the cause squashes to. */ export declare const causeDefect: (cause: Cause.Cause) => unknown; /** Whether any failure or defect in the cause is an output write failure. */ export declare const causeCarriesOutputFailure: (cause: Cause.Cause) => boolean; /** * The terminal failure a cause ends an invocation with outside every runtime * envelope: none for a cancellation or a help request that exits successfully. * An output failure settles in the output phase. Anything else settles in * `phase`: startup for a failure that escaped before any command ran — a * workspace failure there is one of configuration — or the command phase for * a command that runs without the envelope. */ export declare const processTerminalFailure: (cause: Cause.Cause, phase?: "bootstrap" | "command") => Option.Option; //# sourceMappingURL=failure-identity.d.ts.map