/** * Dedicated exit codes per error type. * 0 = success, 1 = general/unknown, 2 = validation, 3 = auth, * 5 = rate limited, 6 = upstream API error. * (4 is reserved — it belonged to a removed not-found error type; existing * agents may still special-case it, so it is not reused.) */ export declare const EXIT_CODES: { readonly SUCCESS: 0; readonly GENERAL: 1; readonly VALIDATION: 2; readonly AUTH: 3; readonly RATE_LIMIT: 5; readonly API: 6; }; export declare class CliError extends Error { readonly userMessage: string; readonly suggestion?: string; readonly exitCode: number; /** * Optional structured payload merged into the JSON error envelope. Used to * expose machine-readable detail (HTTP status, upstream body, retry-after) * so an agent can self-correct without guessing. */ readonly data?: Record; constructor(message: string, options?: { suggestion?: string; exitCode?: number; data?: Record; }); } export declare class AuthError extends CliError { constructor(message?: string, suggestion?: string); } export declare class ValidationError extends CliError { constructor(message: string, suggestion?: string, data?: Record); } /** Raised when Merit returns HTTP 429. Carries the parsed retry-after (ms). */ export declare class RateLimitError extends CliError { readonly retryAfterMs: number; constructor(retryAfterMs: number, data?: Record); } /** * Raised when Merit returns a non-2xx HTTP status, or a 200 whose body is an * ASP.NET stack trace (Merit signals malformed payloads this way). Carries the * HTTP status and a redacted snippet of the upstream body for diagnosis. */ export declare class ApiError extends CliError { readonly status: number; constructor(status: number, message: string, data?: Record); }