Devbox SDK
Api

Type Definitions

Complete type definitions for Devbox SDK

Type Definitions

Complete TypeScript type definitions for Devbox SDK.

DevboxSDKConfig

Configuration for DevboxSDK.

interface DevboxSDKConfig {
  kubeconfig: string
  baseUrl?: string
  http?: HttpClientConfig
}

DevboxCreateConfig

Configuration for creating a sandbox.

interface DevboxCreateConfig {
  name: string
  runtime: DevboxRuntime
  resource: ResourceInfo
  ports?: PortConfig[]
  env?: Record<string, string>
}

ResourceInfo

Resource allocation information.

interface ResourceInfo {
  cpu: number      // CPU cores
  memory: number   // Memory in MB
}

ProcessExecOptions

Options for process execution.

interface ProcessExecOptions {
  command: string
  args?: string[]
  cwd?: string
  env?: Record<string, string>
  shell?: string
  timeout?: number
}

CodeRunOptions

Options for code execution.

interface CodeRunOptions {
  language?: 'node' | 'python'
  cwd?: string
  env?: Record<string, string>
  timeout?: number
  argv?: string[]
}

SyncExecutionResponse

Response from synchronous execution.

interface SyncExecutionResponse {
  stdout: string
  stderr: string
  exitCode: number
  durationMs: number
  startTime: number
  endTime: number
  success: boolean
}

ProcessExecResponse

Response from asynchronous execution.

interface ProcessExecResponse {
  processId: string
  pid: number
  processStatus: string
}

FileChangeEvent

File change event from file watching.

interface FileChangeEvent {
  type: 'create' | 'update' | 'delete'
  path: string
  timestamp: number
}

GitCloneOptions

Options for cloning a Git repository.

interface GitCloneOptions {
  url: string
  targetDir: string
  branch?: string
  depth?: number
  auth?: {
    type: 'https' | 'ssh'
    username?: string
    password?: string
    privateKey?: string
    passphrase?: string
  }
}

Error Types

DevboxSDKError

Base error class.

class DevboxSDKError extends Error {
  code: string
  statusCode?: number
}

AuthenticationError

Authentication failures.

class AuthenticationError extends DevboxSDKError {}

ConnectionError

Connection failures.

class ConnectionError extends DevboxSDKError {}

FileOperationError

File operation errors.

class FileOperationError extends DevboxSDKError {}

DevboxNotFoundError

Sandbox not found.

class DevboxNotFoundError extends DevboxSDKError {}

ValidationError

Validation errors.

class ValidationError extends DevboxSDKError {}

Import Types

import type {
  DevboxSDKConfig,
  DevboxCreateConfig,
  DevboxInfo,
  ResourceInfo,
  ProcessExecOptions,
  CodeRunOptions,
  SyncExecutionResponse,
  ProcessExecResponse,
  FileChangeEvent,
  GitCloneOptions
} from '@labring/devbox-sdk'

Next Steps

On this page