Skip to content

PURISTA API


PURISTA API / @purista/sandbox / TartSandboxDriver

Class: TartSandboxDriver

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:23

TartSandboxDriver - A native Apple Virtualization Framework driver for Apple Silicon. It uses the 'tart' CLI to manage Linux/macOS VMs.

Implements

Constructors

Constructor

new TartSandboxDriver(config): TartSandboxDriver

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:27

Parameters

config

TartSandboxDriverConfig

Returns

TartSandboxDriver

Properties

name

name: string = 'TartSandboxDriver'

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:24

The unique name of the driver implementation

Implementation of

SandboxDriver.name

Methods

createSandbox()

createSandbox(params): Promise<{ containerName: string; sandboxId: string; }>

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:38

Provisions and starts a new sandbox environment.

Parameters

params

Configuration for the new sandbox

gitConfig?

{ email: string; token?: string; username: string; }

gitConfig.email

string

gitConfig.token?

string

gitConfig.username

string

organizationId

string

projectId

string

sandboxId

string

userId

string

Returns

Promise<{ containerName: string; sandboxId: string; }>

The sandbox ID and underlying container name

Implementation of

SandboxDriver.createSandbox


destroySandbox()

destroySandbox(params): Promise<void>

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:98

Permanently removes a sandbox and its resources.

Parameters

params

Reference to the sandbox to destroy

sandboxId

string

Returns

Promise<void>

Implementation of

SandboxDriver.destroySandbox


executeBash()

executeBash(params): Promise<{ exitCode: number; stderr: string; stdout: string; }>

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:110

Executes a bash command within the specified sandbox.

Parameters

params

Command and execution context

command

string

cwd?

string

sandboxId

string

Returns

Promise<{ exitCode: number; stderr: string; stdout: string; }>

The result of the command execution

Implementation of

SandboxDriver.executeBash


readFile()

readFile(params): Promise<string>

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:139

Reads the content of a file from the sandbox.

Parameters

params

Path to the file

path

string

sandboxId

string

Returns

Promise<string>

Implementation of

SandboxDriver.readFile


scanRunningSandboxes()

scanRunningSandboxes(): Promise<object[]>

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:160

Scans the underlying system for running sandboxes and recovers their metadata. This is used for self-healing and service restarts.

Returns

Promise<object[]>

Implementation of

SandboxDriver.scanRunningSandboxes


writeFiles()

writeFiles(params): Promise<void>

Defined in: sandbox-service/src/driver/TartSandboxDriver/TartSandboxDriver.ts:146

Writes one or more files to the sandbox workspace.

Parameters

params

Map of file paths to their contents

files

Record<string, string>

sandboxId

string

Returns

Promise<void>

Implementation of

SandboxDriver.writeFiles