Skip to main content
Version: 0.1.22
Last Verified: 2025-01-27
Package: @hopx-ai/sdk on npm

Overview

The JavaScript SDK provides comprehensive TypeScript type definitions for all API responses and objects.

Core Types

SandboxInfo

Sandbox information type.
interface SandboxInfo {
    sandboxId: string;
    templateId: string;
    templateName: string;
    organizationId: string;
    nodeId: string;
    region: string;
    status: 'running' | 'stopped' | 'paused' | 'creating';
    publicHost: string;
    resources: Resources;
    startedAt: Date;
    endAt?: Date;
    createdAt: Date;
}

TemplateInfo

Template information type.
interface TemplateInfo {
    id: string;
    name: string;
    displayName: string;
    description: string;
    category: string;
    language: string;
    defaultResources: TemplateResources;
    // ... more fields
}

ExecutionResult

Result of code execution.
interface ExecutionResult {
    success: boolean;
    stdout: string;
    stderr: string;
    exitCode: number;
    executionTime: number;
    richOutputs: RichOutput[];
}

CommandResponse

Result of command execution.
interface CommandResponse {
    stdout: string;
    stderr: string;
    exitCode: number;
    executionTime: number;
}

FileInfo

File or directory information.
interface FileInfo {
    name: string;
    path: string;
    size: number;
    isDirectory: boolean;
    permissions: string;
    modifiedTime: Date;
}

Options Types

SandboxCreateOptions

Options for creating a sandbox.
interface SandboxCreateOptions {
    template?: string;
    templateId?: string;
    region?: string;
    timeoutSeconds?: number;
    internetAccess?: boolean;
    envVars?: Record<string, string>;
    apiKey?: string;
    baseURL?: string;
}

CodeExecutionOptions

Options for code execution.
interface CodeExecutionOptions {
    language?: string;
    timeout?: number;
    workingDir?: string;
    env?: Record<string, string>;
}

CommandOptions

Options for command execution.
interface CommandOptions {
    timeout?: number;
    background?: boolean;
    workingDir?: string;
    env?: Record<string, string>;
}

  • Errors - Error classes and exception handling
  • Sandbox - Use types with sandbox operations

See Also

Next Steps

Now that you understand TypeScript types, explore: