/**
 * SDK Error System
 *
 * This module provides type-safe error classes that wrap ErrorResponse from the container.
 * All error classes provide:
 * - Type-safe accessors for error context
 * - instanceof checks for error handling
 * - Full ErrorResponse preservation via errorResponse property
 * - Custom toJSON() for logging
 *
 * @example Basic error handling
 * ```typescript
 * import { FileNotFoundError } from './errors';
 *
 * try {
 *   await sandbox.file.read('/missing.txt');
 * } catch (error) {
 *   if (error instanceof FileNotFoundError) {
 *     console.log(error.path);         // Type-safe! string
 *     console.log(error.operation);    // Type-safe! OperationType
 *     console.log(error.code);         // "FILE_NOT_FOUND"
 *     console.log(error.suggestion);   // Helpful message
 *   }
 * }
 * ```
 *
 * @example Error serialization
 * ```typescript
 * try {
 *   await sandbox.file.read('/missing.txt');
 * } catch (error) {
 *   // Full context available
 *   console.log(error.errorResponse);
 *
 *   // Pretty-prints with custom toJSON
 *   console.log(JSON.stringify(error, null, 2));
 * }
 * ```
 */

// Re-export context types for advanced usage
export type {
  BackupCreateContext,
  BackupExpiredContext,
  BackupNotFoundContext,
  BackupRestoreContext,
  CodeExecutionContext,
  CommandErrorContext,
  CommandNotFoundContext,
  ContextNotFoundContext,
  ErrorCodeType,
  ErrorResponse,
  FileExistsContext,
  FileNotFoundContext,
  FileSystemContext,
  GitAuthFailedContext,
  GitBranchNotFoundContext,
  GitErrorContext,
  GitRepositoryNotFoundContext,
  InternalErrorContext,
  InterpreterNotReadyContext,
  InvalidBackupConfigContext,
  InvalidPortContext,
  OperationType,
  PortAlreadyExposedContext,
  PortErrorContext,
  PortNotExposedContext,
  ProcessErrorContext,
  ProcessExitedBeforeReadyContext,
  ProcessNotFoundContext,
  ProcessReadyTimeoutContext,
  RPCTransportContext,
  RPCTransportErrorKind,
  SessionDestroyedContext,
  SessionTerminatedContext,
  ValidationFailedContext
} from '@repo/shared/errors';
// Re-export shared types and constants
export { ErrorCode, Operation } from '@repo/shared/errors';

// Export adapter function
export { createErrorFromResponse } from './adapter';
// Export all error classes
export {
  // Backup Errors
  BackupCreateError,
  BackupExpiredError,
  BackupNotFoundError,
  BackupRestoreError,
  CodeExecutionError,
  CommandError,
  // Command Errors
  CommandNotFoundError,
  ContextNotFoundError,
  CustomDomainRequiredError,
  FileExistsError,
  // File System Errors
  FileNotFoundError,
  FileSystemError,
  FileTooLargeError,
  GitAuthenticationError,
  GitBranchNotFoundError,
  GitCheckoutError,
  GitCloneError,
  GitError,
  GitNetworkError,
  // Git Errors
  GitRepositoryNotFoundError,
  // Code Interpreter Errors
  InterpreterNotReadyError,
  InvalidBackupConfigError,
  InvalidGitUrlError,
  InvalidPortError,
  PermissionDeniedError,
  // Port Errors
  PortAlreadyExposedError,
  PortError,
  PortInUseError,
  PortNotExposedError,
  ProcessError,
  // Process Readiness Errors
  ProcessExitedBeforeReadyError,
  // Process Errors
  ProcessNotFoundError,
  ProcessReadyTimeoutError,
  // RPC Transport Errors (SDK-side, raised on WebSocket failures)
  RPCTransportError,
  SandboxError,
  ServiceNotRespondingError,
  // Session Errors
  SessionAlreadyExistsError,
  SessionDestroyedError,
  SessionTerminatedError,
  // Validation Errors
  ValidationFailedError
} from './classes';
