Skip to content

Latest commit

 

History

History
85 lines (69 loc) · 2.43 KB

File metadata and controls

85 lines (69 loc) · 2.43 KB
description Set up the Sprites provider for ComputeSDK, configure your token, and create cloud sandboxes to run commands and expose apps.
layout
width title description tableOfContents outline pagination metadata tags actions
default
visible
true
visible
visible
true
visible
true
visible
true
visible
true
visible
true
visible
true

Sprites

Sprites provider for ComputeSDK - cloud sandboxes powered by Sprites

Installation & Setup

npm install @computesdk/sprites

Add your Sprites credentials to a .env file:

SPRITES_TOKEN=your_sprites_token

Usage

import { sprites } from '@computesdk/sprites';

const compute = sprites({
  apiKey: process.env.SPRITES_TOKEN,
});

// Create sandbox
const sandbox = await compute.sandbox.create();

// Run a command
const result = await sandbox.runCommand('echo "Hello from Sprites!"');
console.log(result.stdout); // "Hello from Sprites!"

// Clean up
await sandbox.destroy();

Configuration Options

interface SpritesConfig {
  /** Sprites API token - if not provided, will fallback to SPRITES_TOKEN environment variable */
  apiKey?: string;
  /** Base URL for the Sprites API - defaults to https://api.sprites.dev/v1 */
  baseUrl?: string;
  /** Execution timeout in milliseconds */
  timeout?: number;
}

Supported Operations

Method Supported Notes
create Provisions a new Sprite via POST /sprites.
getById Looks up a Sprite by name.
list Lists all Sprites for the token.
destroy Deletes the Sprite.
runCommand Executes commands over the bash exec endpoint; supports cwd/env.
getInfo
getUrl Returns the Sprite's public URL (Sprites are created with public auth).
filesystem Native read, write, mkdir, readdir, exists, remove.