import { ErrorDetails_Error } from "@anysphere/proto/aiserver/v1/utils_pb.js"; import { Code, ConnectError } from "@connectrpc/connect"; /** * Base error class for all Cursor Agent SDK errors. * * This can wrap internal ConnectError objects from gRPC calls, or represent * SDK-level errors (like API key exchange failures) that occur before any RPC. */ export declare class CursorAgentError extends Error { /** * Whether this error is retryable (based on backend's retry flag or error type). */ readonly isRetryable: boolean; /** * The Connect gRPC error code (if this wraps a ConnectError). */ readonly code?: Code; /** * The original ConnectError (for debugging purposes, if this wraps a ConnectError). */ readonly cause?: ConnectError; /** * Internal proto error code (if available from a ConnectError). */ readonly protoErrorCode?: ErrorDetails_Error; constructor(message: string, options?: { code?: Code; isRetryable?: boolean; cause?: ConnectError; protoErrorCode?: ErrorDetails_Error; }); } /** * Authentication-related errors (401). * * Examples: Invalid API key, not logged in, insufficient permissions. */ export declare class AuthenticationError extends CursorAgentError { } /** * Rate limiting errors (429). * * Examples: Too many requests, usage limits exceeded. */ export declare class RateLimitError extends CursorAgentError { } /** * Configuration errors (400, 404). * * Examples: Bad API key, invalid model name, invalid request parameters. */ export declare class ConfigurationError extends CursorAgentError { } /** * The caller has not connected the SCM integration for the target * repository's provider. Distinct from `[repository_access]`, which means * the integration is connected but doesn't cover that repo. */ export declare class IntegrationNotConnectedError extends ConfigurationError { readonly helpUrl: string; readonly provider: string; constructor(message: string, options: { helpUrl: string; provider: string; code?: Code; isRetryable?: boolean; cause?: ConnectError; protoErrorCode?: ErrorDetails_Error; }); } /** * Network/server errors (503, 504, etc.). * * Examples: Service unavailable, timeout, internal server errors. */ export declare class NetworkError extends CursorAgentError { } /** * Unknown or unclassified errors. */ export declare class UnknownAgentError extends CursorAgentError { } /** * Convert a generic Error to an SDK error if it represents a ConnectError. * * Handles cases where errors may be wrapped or serialized. */ export declare function convertError(err: unknown): CursorAgentError | Error; /** * Convert a ConnectError to a user-friendly SDK error. * * Extracts the ErrorDetails proto, reads the user-facing message, * and wraps it in an appropriate SDK error class. */ export declare function convertConnectError(error: ConnectError): CursorAgentError; //# sourceMappingURL=errors.d.ts.map