import type { ErrorContext } from "./error-logger.js"; /** * Base error class for all CLI errors with context support */ export declare class CliError extends Error { readonly context?: ErrorContext; readonly isUserError: boolean; constructor(message: string, context?: ErrorContext, options?: { isUserError?: boolean; }); } /** * Error used purely for control flow: exits the CLI silently with code 0. */ export declare class SilentError extends CliError { constructor(message?: string, options?: { isUserError?: boolean; }); } export declare class ReportedError extends CliError { constructor(message: string); } /** * API-related errors (network, HTTP status, API responses) */ export declare class ApiError extends CliError { readonly httpStatus?: number; readonly endpoint?: string; constructor(message: string, options?: { httpStatus?: number; endpoint?: string; context?: ErrorContext; }); } /** * Configuration and validation errors (user input, config files) */ export declare class ValidationError extends CliError { constructor(message: string, context?: ErrorContext); } /** * File system operation errors */ export declare class FileSystemError extends CliError { readonly filePath?: string; readonly operation?: string; constructor(message: string, options?: { filePath?: string; operation?: string; context?: ErrorContext; }); } /** * Authentication and credential errors */ export declare class AuthenticationError extends CliError { constructor(message: string, context?: ErrorContext); } /** * Command execution errors */ export declare class CommandExecutionError extends CliError { readonly command?: string; readonly exitCode?: number; constructor(message: string, options?: { command?: string; exitCode?: number; context?: ErrorContext; }); } /** * Service provider errors (MCP, Codex, etc.) */ export declare class ServiceError extends CliError { readonly service?: string; constructor(message: string, options?: { service?: string; context?: ErrorContext; }); } /** * Graceful cancellation triggered by the user (Ctrl+C, escape, etc.) */ export declare class OperationCancelledError extends SilentError { constructor(message?: string); } /** * Detects silent control-flow exits, including cross-bundle/classloader cases * where instanceof checks may fail. */ export declare function isSilentError(error: unknown): boolean; export declare function isReportedError(error: unknown): boolean; /** * Helper to determine if an error should be shown to users */ export declare function isUserFacingError(error: unknown): boolean; /** * Helper to extract error context from any error */ export declare function extractErrorContext(error: unknown): ErrorContext | undefined; /** * Helper to create a standardized error message with context */ export declare function formatErrorWithContext(error: Error, context?: ErrorContext): string;