/** * Error hierarchy for the MCP server integration. * * All errors extend PaduaError so callers can catch at different granularities. * Token redaction is applied to every message at construction time to prevent * credential exposure in logs and error reporting pipelines. */ /** * Replaces credential-like patterns in a message string with [REDACTED]. * * Patterns covered: * - Bearer in Authorization headers * - access_token / refresh_token / accessToken / refreshToken in JSON or query strings * - Credential field names (token, api_key, secret, password, client_secret, session_token) * echoed as field=value or field: value patterns (case-insensitive) * - GitLab provider tokens by shape regardless of the field name they appear under: * glpat-, glrt-, glcbt-, glptt-, glsoat-, glfeat-, gldt- prefixes (SEC-CRED-02) * - Hex strings longer than 20 characters (encryption keys, nonces) * - Base64-like strings longer than 30 characters (JWT segments, encoded secrets), * matching both standard base64 and base64url alphabets */ export declare function redactTokens(message: string): string; /** * Base error for all Padua MCP operations. * Carries a machine-readable code alongside the human-readable message. * Messages are token-redacted at construction time. */ export declare class PaduaError extends Error { readonly code: string; constructor(message: string, code: string); } /** Errors originating from the encrypted SQLite token store. */ export declare class StoreError extends PaduaError { constructor(message: string, code: string); } /** Errors originating from OAuth flows and token lifecycle management. */ export declare class AuthError extends PaduaError { constructor(message: string, code: string); } /** Errors originating from the background daemon process lifecycle. */ export declare class DaemonError extends PaduaError { constructor(message: string, code: string); } /** Errors originating from config or input validation failures. */ export declare class ValidationError extends PaduaError { constructor(message: string, code: string); } /** * Errors originating from a specific provider (GitLab, Atlassian). * The `provider` property identifies which provider produced the error. */ export declare class ProviderError extends PaduaError { readonly provider: string; constructor(message: string, code: string, provider: string); } /** * Exhaustive catalog of machine-readable error codes used throughout the MCP * server integration. Every error instantiation must use one of these constants. * * Grouped by the error subclass that typically throws them. */ export declare const ErrorCodes: { readonly ENCRYPTION_KEY_UNAVAILABLE: "ENCRYPTION_KEY_UNAVAILABLE"; readonly TOKEN_DECRYPTION_FAILED: "TOKEN_DECRYPTION_FAILED"; readonly DB_OPEN_FAILED: "DB_OPEN_FAILED"; readonly DB_WRITE_FAILED: "DB_WRITE_FAILED"; readonly CALLBACK_PORT_IN_USE: "CALLBACK_PORT_IN_USE"; readonly OAUTH_CALLBACK_ERROR: "OAUTH_CALLBACK_ERROR"; readonly OAUTH_STATE_EXPIRED: "OAUTH_STATE_EXPIRED"; readonly OAUTH_CALLBACK_TIMEOUT: "OAUTH_CALLBACK_TIMEOUT"; readonly OAUTH_CODE_EXCHANGE_FAILED: "OAUTH_CODE_EXCHANGE_FAILED"; readonly TOKEN_REFRESH_FAILED: "TOKEN_REFRESH_FAILED"; readonly CIRCUIT_BREAKER_OPEN: "CIRCUIT_BREAKER_OPEN"; readonly DAEMON_START_TIMEOUT: "DAEMON_START_TIMEOUT"; readonly DAEMON_ALREADY_RUNNING: "DAEMON_ALREADY_RUNNING"; readonly DAEMON_STALE_PID: "DAEMON_STALE_PID"; readonly DAEMON_HEALTH_FAILED: "DAEMON_HEALTH_FAILED"; readonly DAEMON_PORT_IN_USE: "DAEMON_PORT_IN_USE"; readonly INVALID_CONFIG: "INVALID_CONFIG"; readonly MARKDOWN_TOO_LARGE: "MARKDOWN_TOO_LARGE"; readonly API_TIMEOUT: "API_TIMEOUT"; readonly API_NETWORK_ERROR: "API_NETWORK_ERROR"; readonly API_RATE_LIMITED: "API_RATE_LIMITED"; readonly API_UNAUTHORIZED: "API_UNAUTHORIZED"; readonly CLOUD_ID_RESOLUTION_FAILED: "CLOUD_ID_RESOLUTION_FAILED"; readonly HTTP_ERROR: "HTTP_ERROR"; readonly HTTP_TOO_MANY_REDIRECTS: "HTTP_TOO_MANY_REDIRECTS"; readonly HTTP_INVALID_REDIRECT: "HTTP_INVALID_REDIRECT"; }; /** Union type of all valid error code string literals. */ export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes]; //# sourceMappingURL=types.d.ts.map