feat: add READMEs to sprites packages and fix blocks.yml schema

- Add README documentation for all 11 sprites packages
- Fix blocks.yml to be compatible with blocks CLI validator
- Add project wrapper and type fields to blocks.yml
- Bump sprites packages to v0.1.2
This commit is contained in:
Ajax Davis 2026-01-14 16:22:39 +10:00
parent 0c78c1bf1f
commit ce3596ea22
23 changed files with 995 additions and 16 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,68 @@
# @tpmjs/sprites-checkpoint-create
Create a point-in-time snapshot (checkpoint) of a sprite's filesystem state for later restoration.
## Installation
```bash
npm install @tpmjs/sprites-checkpoint-create
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesCheckpointCreateTool } from '@tpmjs/sprites-checkpoint-create';
const result = await spritesCheckpointCreateTool.execute({
name: 'my-sandbox',
checkpointName: 'before-experiment'
});
console.log(result);
// {
// id: 'chk_abc123',
// name: 'before-experiment',
// createdAt: '2024-01-15T10:30:00Z',
// size: 52428800
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to checkpoint |
| `checkpointName` | `string` | No | Optional human-readable name for the checkpoint |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `id` | `string` | Unique checkpoint identifier (use this for restore) |
| `name` | `string?` | Human-readable checkpoint name if provided |
| `createdAt` | `string` | ISO 8601 timestamp of creation |
| `size` | `number?` | Checkpoint size in bytes |
## Use Cases
- Save state before risky operations
- Create restore points for experiments
- Backup filesystem before installing packages
- Version control for sprite state
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (120 second limit for large checkpoints)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-checkpoint-create",
"version": "0.1.1",
"version": "0.1.2",
"description": "Create a point-in-time snapshot of a sprite's filesystem state for later restoration",
"type": "module",
"keywords": [

View file

@ -0,0 +1,74 @@
# @tpmjs/sprites-checkpoint-list
List all checkpoints for a sprite ordered by creation time.
## Installation
```bash
npm install @tpmjs/sprites-checkpoint-list
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesCheckpointListTool } from '@tpmjs/sprites-checkpoint-list';
const result = await spritesCheckpointListTool.execute({
name: 'my-sandbox'
});
console.log(result);
// {
// checkpoints: [
// { id: 'chk_abc123', name: 'before-experiment', createdAt: '2024-01-15T10:30:00Z', size: 52428800 },
// { id: 'chk_def456', name: 'initial-setup', createdAt: '2024-01-14T08:00:00Z', size: 10485760 }
// ],
// count: 2
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to list checkpoints for |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `checkpoints` | `Checkpoint[]` | Array of checkpoints ordered by creation time |
| `count` | `number` | Total number of checkpoints |
### Checkpoint Object
| Field | Type | Description |
|-------|------|-------------|
| `id` | `string` | Unique checkpoint identifier (use this for restore) |
| `name` | `string?` | Optional human-readable name |
| `createdAt` | `string` | ISO 8601 timestamp of creation |
| `size` | `number?` | Checkpoint size in bytes |
## Use Cases
- Find checkpoint IDs for restoration
- Review available restore points
- Audit checkpoint history
- Clean up old checkpoints
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-checkpoint-list",
"version": "0.1.1",
"version": "0.1.2",
"description": "List all checkpoints for a sprite ordered by creation time",
"type": "module",
"keywords": [

View file

@ -0,0 +1,84 @@
# @tpmjs/sprites-checkpoint-restore
Restore a sprite to a previous checkpoint state, reverting all filesystem changes.
## Installation
```bash
npm install @tpmjs/sprites-checkpoint-restore
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesCheckpointRestoreTool } from '@tpmjs/sprites-checkpoint-restore';
const result = await spritesCheckpointRestoreTool.execute({
name: 'my-sandbox',
checkpointId: 'chk_abc123'
});
console.log(result);
// {
// restored: true,
// checkpointId: 'chk_abc123',
// sprite: {
// name: 'my-sandbox',
// status: 'running',
// createdAt: '2024-01-15T10:30:00Z'
// }
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to restore |
| `checkpointId` | `string` | Yes | ID of the checkpoint to restore to |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `restored` | `boolean` | Whether restoration was successful |
| `checkpointId` | `string` | ID of the checkpoint that was restored |
| `sprite` | `Sprite` | Updated sprite details after restoration |
### Sprite Object
| Field | Type | Description |
|-------|------|-------------|
| `name` | `string` | Name of the sprite |
| `status` | `'creating' \| 'running' \| 'stopped' \| 'error'` | Current status |
| `createdAt` | `string` | ISO 8601 timestamp of creation |
| `runtime` | `string?` | Optional runtime configuration |
| `metadata` | `object?` | Optional custom metadata |
## Use Cases
- Undo changes after failed experiments
- Recover from errors or corrupted state
- Reset to a known good state
- Rollback after testing
## Warning
Restoring a checkpoint will **replace** the current filesystem state. Any changes made after the checkpoint was created will be lost.
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite or checkpoint not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (120 second limit for large restorations)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-checkpoint-restore",
"version": "0.1.1",
"version": "0.1.2",
"description": "Restore a sprite to a previous checkpoint state",
"type": "module",
"keywords": [

View file

@ -0,0 +1,67 @@
# @tpmjs/sprites-create
Create a new isolated Linux sandbox environment (sprite) with persistent filesystem.
## Installation
```bash
npm install @tpmjs/sprites-create
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesCreateTool } from '@tpmjs/sprites-create';
const result = await spritesCreateTool.execute({
name: 'my-new-sandbox'
});
console.log(result);
// {
// name: 'my-new-sandbox',
// status: 'creating',
// createdAt: '2024-01-15T10:30:00Z'
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Unique name for the sprite (lowercase alphanumeric with hyphens, 3-63 characters) |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `name` | `string` | Name of the created sprite |
| `status` | `'creating' \| 'running' \| 'stopped' \| 'error'` | Current status |
| `createdAt` | `string` | ISO 8601 timestamp of creation |
| `runtime` | `string?` | Optional runtime configuration |
| `metadata` | `object?` | Optional custom metadata |
## Name Validation
Sprite names must:
- Be 3-63 characters long
- Start and end with a lowercase letter or number
- Contain only lowercase letters, numbers, and hyphens
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Invalid sprite name format
- Sprite name already exists (HTTP 409)
- Invalid or expired API token (HTTP 401)
- Network timeout (60 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-create",
"version": "0.1.1",
"version": "0.1.2",
"description": "Create a new isolated Linux sandbox environment (sprite) with persistent filesystem using the Sprites API",
"type": "module",
"keywords": [

View file

@ -0,0 +1,64 @@
# @tpmjs/sprites-delete
Delete a sprite and all its associated data including checkpoints.
## Installation
```bash
npm install @tpmjs/sprites-delete
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesDeleteTool } from '@tpmjs/sprites-delete';
const result = await spritesDeleteTool.execute({
name: 'my-sandbox'
});
console.log(result);
// {
// deleted: true,
// name: 'my-sandbox'
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to delete |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `deleted` | `boolean` | Whether deletion was successful |
| `name` | `string` | Name of the deleted sprite |
## Warning
This action is **irreversible**. All data associated with the sprite, including:
- Filesystem contents
- All checkpoints
- Execution history
will be permanently deleted.
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-delete",
"version": "0.1.1",
"version": "0.1.2",
"description": "Delete a sprite and all its associated data including checkpoints",
"type": "module",
"keywords": [

View file

@ -0,0 +1,71 @@
# @tpmjs/sprites-exec
Execute a command inside a sprite and return the output.
## Installation
```bash
npm install @tpmjs/sprites-exec
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesExecTool } from '@tpmjs/sprites-exec';
// Run a simple command
const result = await spritesExecTool.execute({
name: 'my-sandbox',
cmd: 'ls -la /home'
});
console.log(result);
// {
// exitCode: 0,
// stdout: 'total 4\ndrwxr-xr-x 2 root root 4096 Jan 15 10:30 .\n...',
// stderr: '',
// duration: 45
// }
// Run with stdin input
const pythonResult = await spritesExecTool.execute({
name: 'my-sandbox',
cmd: 'python3',
stdin: 'print("Hello from stdin!")'
});
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to execute command in |
| `cmd` | `string` | Yes | Command to execute (e.g., 'ls -la', 'python script.py') |
| `stdin` | `string` | No | Optional stdin input to pass to the command |
| `timeoutMs` | `number` | No | Execution timeout in milliseconds (default: 60000) |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `exitCode` | `number` | Command exit code (0 = success) |
| `stdout` | `string` | Standard output from the command |
| `stderr` | `string` | Standard error from the command |
| `duration` | `number` | Execution duration in milliseconds |
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Command execution timeout
- Invalid or expired API token (HTTP 401)
- Network errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-exec",
"version": "0.1.1",
"version": "0.1.2",
"description": "Execute a command inside a sprite and return the output with exit code",
"type": "module",
"keywords": [

View file

@ -0,0 +1,60 @@
# @tpmjs/sprites-get
Retrieve details of a specific sprite by name including status and configuration.
## Installation
```bash
npm install @tpmjs/sprites-get
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesGetTool } from '@tpmjs/sprites-get';
const result = await spritesGetTool.execute({
name: 'my-sandbox'
});
console.log(result);
// {
// name: 'my-sandbox',
// status: 'running',
// createdAt: '2024-01-15T10:30:00Z',
// runtime: 'node:20'
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to retrieve |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `name` | `string` | Name of the sprite |
| `status` | `'creating' \| 'running' \| 'stopped' \| 'error'` | Current status |
| `createdAt` | `string` | ISO 8601 timestamp of creation |
| `runtime` | `string?` | Optional runtime configuration |
| `metadata` | `object?` | Optional custom metadata |
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-get",
"version": "0.1.1",
"version": "0.1.2",
"description": "Retrieve details of a specific sprite by name including status and configuration",
"type": "module",
"keywords": [

View file

@ -0,0 +1,63 @@
# @tpmjs/sprites-list
List all sprites in your account with their current status and metadata.
## Installation
```bash
npm install @tpmjs/sprites-list
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesListTool } from '@tpmjs/sprites-list';
const result = await spritesListTool.execute({});
console.log(result);
// {
// sprites: [
// { name: 'my-sandbox', status: 'running', createdAt: '2024-01-15T10:30:00Z' },
// { name: 'test-env', status: 'stopped', createdAt: '2024-01-14T08:00:00Z' }
// ],
// count: 2
// }
```
## Input Parameters
This tool takes no input parameters.
## Output
| Field | Type | Description |
|-------|------|-------------|
| `sprites` | `Sprite[]` | Array of sprites in the account |
| `count` | `number` | Total number of sprites |
### Sprite Object
| Field | Type | Description |
|-------|------|-------------|
| `name` | `string` | Unique name of the sprite |
| `status` | `'creating' \| 'running' \| 'stopped' \| 'error'` | Current status |
| `createdAt` | `string` | ISO 8601 timestamp of creation |
| `runtime` | `string?` | Optional runtime configuration |
| `metadata` | `object?` | Optional custom metadata |
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-list",
"version": "0.1.1",
"version": "0.1.2",
"description": "List all sprites in the account with their current status and metadata",
"type": "module",
"keywords": [

View file

@ -0,0 +1,69 @@
# @tpmjs/sprites-policy-get
Retrieve the current network policy for a sprite including allowed domains.
## Installation
```bash
npm install @tpmjs/sprites-policy-get
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesPolicyGetTool } from '@tpmjs/sprites-policy-get';
const result = await spritesPolicyGetTool.execute({
name: 'my-sandbox'
});
console.log(result);
// {
// mode: 'allow',
// domains: ['api.github.com', 'registry.npmjs.org'],
// rules: []
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to get policy for |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `mode` | `'allow' \| 'deny'` | Policy mode |
| `domains` | `string[]` | List of domains affected by the policy |
| `rules` | `object[]?` | Optional additional filtering rules |
## Policy Modes
- **`allow` mode**: Blocks all outbound traffic EXCEPT to listed domains
- **`deny` mode**: Allows all outbound traffic EXCEPT to listed domains
## Use Cases
- Audit current network access for a sprite
- Verify security policies are correctly applied
- Debug connectivity issues
- Review allowed domains before running sensitive code
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-policy-get",
"version": "0.1.1",
"version": "0.1.2",
"description": "Retrieve the current network policy for a sprite including allowed domains",
"type": "module",
"keywords": [

View file

@ -0,0 +1,95 @@
# @tpmjs/sprites-policy-set
Update the network policy for a sprite to control outbound network access.
## Installation
```bash
npm install @tpmjs/sprites-policy-set
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesPolicySetTool } from '@tpmjs/sprites-policy-set';
// Allow only specific domains (block everything else)
const result = await spritesPolicySetTool.execute({
name: 'my-sandbox',
mode: 'allow',
domains: ['api.github.com', 'registry.npmjs.org', 'pypi.org']
});
console.log(result);
// {
// policy: {
// mode: 'allow',
// domains: ['api.github.com', 'registry.npmjs.org', 'pypi.org']
// },
// applied: true
// }
// Block specific domains (allow everything else)
const blockResult = await spritesPolicySetTool.execute({
name: 'my-sandbox',
mode: 'deny',
domains: ['malicious-site.com', 'tracking.example.com']
});
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to update policy for |
| `mode` | `'allow' \| 'deny'` | Yes | Policy mode |
| `domains` | `string[]` | Yes | List of domains to allow or deny based on mode |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `policy` | `NetworkPolicy` | The applied network policy |
| `applied` | `boolean` | Whether the policy was successfully applied |
### NetworkPolicy Object
| Field | Type | Description |
|-------|------|-------------|
| `mode` | `'allow' \| 'deny'` | Policy mode |
| `domains` | `string[]` | List of domains affected by the policy |
| `rules` | `object[]?` | Optional additional filtering rules |
## Policy Modes
- **`allow` mode**: Blocks all outbound traffic EXCEPT to listed domains
- Use for maximum security when you know exactly which APIs are needed
- **`deny` mode**: Allows all outbound traffic EXCEPT to listed domains
- Use to block known-bad domains while allowing general access
## Use Cases
- Restrict sprite to only access required APIs
- Block access to potentially harmful domains
- Implement defense-in-depth security
- Ensure code can only communicate with trusted services
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Invalid mode (must be 'allow' or 'deny')
- Domains must be an array
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-policy-set",
"version": "0.1.1",
"version": "0.1.2",
"description": "Update the network policy for a sprite to control outbound network access",
"type": "module",
"keywords": [

View file

@ -0,0 +1,73 @@
# @tpmjs/sprites-sessions
List active execution sessions for a sprite.
## Installation
```bash
npm install @tpmjs/sprites-sessions
```
## Requirements
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
## Usage
```typescript
import { spritesSessionsTool } from '@tpmjs/sprites-sessions';
const result = await spritesSessionsTool.execute({
name: 'my-sandbox'
});
console.log(result);
// {
// sessions: [
// { id: 'sess_123', status: 'active', startedAt: '2024-01-15T10:30:00Z', command: 'python server.py' },
// { id: 'sess_124', status: 'completed', startedAt: '2024-01-15T10:25:00Z' }
// ],
// count: 2
// }
```
## Input Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the sprite to list sessions for |
## Output
| Field | Type | Description |
|-------|------|-------------|
| `sessions` | `ExecSession[]` | Array of execution sessions |
| `count` | `number` | Total number of sessions |
### ExecSession Object
| Field | Type | Description |
|-------|------|-------------|
| `id` | `string` | Unique session identifier |
| `status` | `'active' \| 'completed' \| 'terminated'` | Session status |
| `startedAt` | `string` | ISO 8601 timestamp when session started |
| `command` | `string?` | Optional command that started the session |
## Use Cases
- Monitor running commands in a sprite
- Check if long-running processes are still active
- Debug execution issues by reviewing session history
## Error Handling
The tool throws errors in these cases:
- `SPRITES_TOKEN` environment variable is not set
- Sprite not found (HTTP 404)
- Invalid or expired API token (HTTP 401)
- Network timeout (30 second limit)
- API errors with descriptive messages
## License
MIT

View file

@ -1,6 +1,6 @@
{
"name": "@tpmjs/tools-sprites-sessions",
"version": "0.1.1",
"version": "0.1.2",
"description": "List active execution sessions for a sprite",
"type": "module",
"keywords": [