An open-source, faster Devin alternative
TypeScript
Scaffold all 28 docs pages as stubs with new nav structure
Igor Zalutskia0c19271588c
diff --git a/docs/agents/events.mdx b/docs/agents/events.mdxnew file mode 100644index 00000000..68acb81a--- /dev/null+++ b/docs/agents/events.mdx@@ -0,0 +1,68 @@+---+title: "Events"+description: "Understanding the agent event stream"+---++{/* STUB — Progressive JPEG pass 1. Complete reference for agent session events. */}++## Overview++{/* Brief intro: agent sessions emit typed events via onEvent callback. Each event has a `type` field. */}++## Event Lifecycle++{/* Typical order for a successful session:+ ready -> configured -> assistant -> tool_use_summary -> assistant -> ... -> result -> turn_complete+*/}++## Event Reference++{/* One subsection per event type. Each with: what it means, when it fires, fields/payload, code example. */}++### `ready`++{/* Agent process started, waiting for configuration. */}++### `configured`++{/* Agent configured and working on the prompt. */}++### `assistant`++{/* Claude's text output. Fields: content. The most common event — this is the agent "talking". */}++### `tool_use_summary`++{/* Agent used a tool (bash, file, etc.). Fields: tool, input summary, output summary. */}++### `system`++{/* System-level message from the agent process. */}++### `result`++{/* Final structured result. Fields: result. Only emitted if the agent produces a final answer. */}++### `turn_complete`++{/* Turn finished. Fields: claude_session_id (used for resume). Emitted after result. */}++### `interrupted`++{/* Agent was interrupted via session.interrupt(). */}++### `error`++{/* Agent encountered an error. Fields: error message. */}++## Filtering Events++{/* Practical patterns:+ - Log only assistant messages+ - Capture the final result+ - Build a progress indicator from tool_use_summary events+*/}++## Error Handling++{/* error events vs onError (stderr) vs rejected promises. When each fires, how to respond. */}diff --git a/docs/agents/multi-turn.mdx b/docs/agents/multi-turn.mdxnew file mode 100644index 00000000..8686ea6d--- /dev/null+++ b/docs/agents/multi-turn.mdx@@ -0,0 +1,52 @@+---+title: "Multi-turn"+description: "Follow-ups, resume, and session management"+---++{/* STUB — Progressive JPEG pass 1. Conversations beyond a single prompt. */}++## Follow-up Prompts++{/* session.sendPrompt(text) to continue within same session.+ Example: start a task, wait for completion, send follow-up. TS + Python CodeGroup. */}++## Resuming Across Sessions++{/* TS only. resume parameter in agent.start().+ - Capture claude_session_id from turn_complete event+ - Pass as resume in new agent.start() call+ - Example: save session ID, create sandbox from checkpoint, resume conversation+ - Note: Python SDK does not support resume. Show HTTP API tab as workaround.+*/}++<Note>+ Resume is currently available in the TypeScript SDK only. Python SDK support is planned.+</Note>++## Interrupting++{/* session.interrupt() to stop the current turn. Both SDKs. */}++## Reconfiguring Mid-Session++{/* session.configure() to change model, tools, etc. while session is running. */}++## Managing Sessions++{/* List, attach, and manage running agent sessions. */}++### Listing Sessions++{/* sandbox.agent.list() — both SDKs. */}++### Attaching to a Running Session++{/* sandbox.agent.attach(sessionId) — reconnect to running session. Both SDKs.+ When to use attach vs resume:+ - attach = same session still running, reconnect to event stream+ - resume = new session continuing old conversation (TS only)+*/}++<Note>+ Agent sessions are SDK-only — there is no CLI command for agents yet.+</Note>diff --git a/docs/agents/overview.mdx b/docs/agents/overview.mdxnew file mode 100644index 00000000..7652e177--- /dev/null+++ b/docs/agents/overview.mdx@@ -0,0 +1,64 @@+---+title: "Agents"+description: "Run Claude inside sandboxes"+---++{/* STUB — Progressive JPEG pass 1. Entity page: what agents are, how they work, full API reference. */}++## What is an Agent Session++{/* 2-3 sentences: A Claude Agent SDK instance running inside a sandbox (cloud VM). You send a prompt, it works autonomously — writing files, running commands, iterating — and streams events back. */}++## Quick Example++{/* sandbox.agent.start() with event handling. TS + Python CodeGroup. The simplest working agent. */}++<CodeGroup>++```typescript TypeScript+// TODO: Sandbox.create -> agent.start({ prompt, onEvent }) -> session.done -> kill+```++```python Python+# TODO: Sandbox.create -> agent.start(prompt, on_event) -> session.wait() -> kill+```++</CodeGroup>++## How It Works++{/* Brief (3-4 sentences): SDK spawns Claude inside sandbox VM, Claude gets bash/file tools, works in think->act->observe loop, events stream back via WebSocket. */}++## `sandbox.agent.start(opts)`++{/* Full param reference with ParamField:+ - prompt (required)+ - model, systemPrompt, allowedTools, permissionMode, maxTurns, cwd+ - mcpServers (Record<string, McpServerConfig>)+ - onEvent, onError+ - TS-only: resume, onExit, onScrollbackEnd+*/}++## AgentSession++{/* Properties and methods table:+ - Both SDKs: sessionId, done, sendPrompt, interrupt, configure, kill, close+ - Python-specific: collect_events(), wait()+ - TS-specific: done returns Promise<number>+*/}++## Next++{/* Quick links to sub-pages: Events, Tools, Multi-turn */}++<CardGroup cols={3}>+ <Card title="Events" icon="stream" href="/agents/events">+ Understanding the event stream+ </Card>+ <Card title="Tools" icon="wrench" href="/agents/tools">+ Configure tools and MCP servers+ </Card>+ <Card title="Multi-turn" icon="comments" href="/agents/multi-turn">+ Follow-ups, resume, session management+ </Card>+</CardGroup>diff --git a/docs/agents/tools.mdx b/docs/agents/tools.mdxnew file mode 100644index 00000000..80093e37--- /dev/null+++ b/docs/agents/tools.mdx@@ -0,0 +1,37 @@+---+title: "Tools"+description: "Configure what tools an agent can use"+---++{/* STUB — Progressive JPEG pass 1. Tools configuration including MCP servers. */}++## Default Tools++{/* What the agent can do out of the box: bash, file read/write, Python. Brief explanation of allowedTools param to restrict. */}++## MCP Servers++{/* Main event on this page. What MCP is (one sentence), then how to configure:+ - mcpServers param structure: Record<string, { command, args?, env? }>+ - MCP servers run inside the sandbox, agent discovers tools via protocol+*/}++### Example: SQLite Database Tool++{/* TS + Python CodeGroup showing mcpServers config with sqlite MCP server */}++### Example: Custom API Tool++{/* TS + Python CodeGroup showing custom MCP server */}++## System Prompt++{/* systemPrompt param — how to steer agent behavior with custom instructions. Example. */}++## Permission Mode++{/* permissionMode param — what it controls, available values. */}++## Max Turns++{/* maxTurns param — limiting agent iterations. When to use it. */}diff --git a/docs/cli/checkpoint.mdx b/docs/cli/checkpoint.mdxnew file mode 100644index 00000000..4ddc82f6--- /dev/null+++ b/docs/cli/checkpoint.mdx@@ -0,0 +1,50 @@+---+title: "checkpoint"+description: "Snapshot, fork, and restore sandboxes"+---++{/* STUB — Renamed from checkpoints.mdx. Content will be migrated with minor updates. */}++{/* Sections:+ - oc checkpoint create <sandbox-id> --name <name>+ - oc checkpoint list <sandbox-id>+ - oc checkpoint restore <sandbox-id> <checkpoint-id>+ - oc checkpoint spawn <checkpoint-id> [--timeout]+ - oc checkpoint delete <sandbox-id> <checkpoint-id>+ - Alias: oc cp+ - Examples: save before risky op, fork for parallel testing, checkpoint vs hibernate table+*/}++## Create a Checkpoint++```bash+oc checkpoint create sb-abc123 --name my-checkpoint+```++## List Checkpoints++```bash+oc checkpoint list sb-abc123+```++## Restore++```bash+oc checkpoint restore sb-abc123 cp-7f3a1b2c+```++## Spawn (Fork)++```bash+oc checkpoint spawn cp-7f3a1b2c+```++## Delete++```bash+oc checkpoint delete sb-abc123 cp-7f3a1b2c+```++## Examples++{/* Save before risky op, fork for parallel testing, checkpoint vs hibernate comparison */}diff --git a/docs/cli/exec.mdx b/docs/cli/exec.mdxnew file mode 100644index 00000000..f1ec37e4--- /dev/null+++ b/docs/cli/exec.mdx@@ -0,0 +1,48 @@+---+title: "exec"+description: "Execute shell commands inside a sandbox"+---++{/* STUB — Renamed from commands.mdx. Content will be migrated with minor updates (oc exec naming). */}++{/* Sections:+ - oc exec <id> -- <command...> (run and wait)+ - Flags: --cwd, --timeout, --env+ - oc exec list <id> — list running exec sessions+ - oc exec attach <id> <session-id> — attach to running session+ - oc exec kill <id> <session-id> — kill session+ - ProcessResult (JSON output)+ - Examples: cwd, env, timeout, chaining, capture JSON output+*/}++## Running a Command++```bash+oc exec sb-abc123 -- echo "Hello, World!"+```++### `oc exec <id> -- <command...>`++{/* Flags table: --cwd, --timeout, --env. JSON output mode. */}++## List Exec Sessions++```bash+oc exec list sb-abc123+```++## Attach to a Session++```bash+oc exec attach sb-abc123 sess-xyz+```++## Kill a Session++```bash+oc exec kill sb-abc123 sess-xyz+```++## Examples++{/* Working directory, env vars, timeout, chaining, JSON capture */}diff --git a/docs/cli/patch.mdx b/docs/cli/patch.mdxnew file mode 100644index 00000000..70b31057--- /dev/null+++ b/docs/cli/patch.mdx@@ -0,0 +1,41 @@+---+title: "patch"+description: "Apply scripted modifications to checkpoints"+---++{/* STUB — Renamed from patches.mdx. Content will be migrated with minor updates. */}++{/* Sections:+ - oc patch create <checkpoint-id> --script <file|-> [--description]+ - oc patch list <checkpoint-id>+ - oc patch delete <checkpoint-id> <patch-id>+ - Examples: layer setup, stdin one-liners, inspect before spawning+*/}++## Create a Patch++```bash+oc patch create cp-7f3a1b2c --script ./setup.sh --description "Install dependencies"+```++From stdin:++```bash+echo "apt install -y curl jq" | oc patch create cp-7f3a1b2c --script=-+```++## List Patches++```bash+oc patch list cp-7f3a1b2c+```++## Delete a Patch++```bash+oc patch delete cp-7f3a1b2c patch-3c8d2e1a+```++## Examples++{/* Layer setup steps, stdin one-liners, inspect before spawning */}diff --git a/docs/cli/preview.mdx b/docs/cli/preview.mdxnew file mode 100644index 00000000..b29a3c7d--- /dev/null+++ b/docs/cli/preview.mdx@@ -0,0 +1,41 @@+---+title: "preview"+description: "Expose sandbox ports to the internet"+---++{/* STUB — Renamed from previews.mdx. Content will be migrated with minor updates. */}++{/* Sections:+ - oc preview create <sandbox-id> --port <port> [--domain]+ - oc preview list <sandbox-id>+ - oc preview delete <sandbox-id> <port>+ - Examples: share dev server, multiple ports, custom domain, scripted URL capture+*/}++## Create a Preview URL++```bash+oc preview create sb-abc123 --port 3000+```++With custom domain:++```bash+oc preview create sb-abc123 --port 8080 --domain preview.example.com+```++## List Preview URLs++```bash+oc preview list sb-abc123+```++## Delete a Preview URL++```bash+oc preview delete sb-abc123 3000+```++## Examples++{/* Share dev server, multiple ports, custom domain, scripted URL capture */}diff --git a/docs/how-it-works.mdx b/docs/how-it-works.mdxnew file mode 100644index 00000000..36c803f8--- /dev/null+++ b/docs/how-it-works.mdx@@ -0,0 +1,34 @@+---+title: "How It Works"+description: "Architecture and key technical decisions"+---++{/* STUB — Progressive JPEG pass 1. Goal: clear mental model in under 3 minutes. Concise, technical, opinionated. No marketing. */}++## Overview++{/* One paragraph: Your code talks to the OpenComputer API. The API provisions a Firecracker microVM. Your agent (or commands) run inside that VM. Events stream back to your code. */}++## Firecracker microVMs++{/* Why not containers? Each sandbox is a real VM with its own kernel, memory, and disk. Hardware-level isolation (KVM). Boot in ~150ms. Same technology AWS Lambda uses. */}++## Hibernation++{/* VM's full state (memory + disk) snapshotted to S3. Resume is fast — kernel doesn't reboot, picks up where it left off. Tradeoff: snapshot size scales with memory allocation. */}++## Checkpoints & Forking++{/* Named snapshots. Forking creates a new VM from a checkpoint with copy-on-write semantics. Enables parallel exploration (try 5 approaches from same starting point) and reproducibility. */}++## Templates++{/* Built from Dockerfiles but converted to VM root filesystems (not run as containers). Docker produces a filesystem image, Firecracker boots from it directly. */}++## Networking++{/* Each VM gets a TAP device with NAT. Full outbound internet. Inbound access via preview URLs (reverse-proxied through the host). */}++## Agent Sessions++{/* Claude Agent SDK runs inside the VM as a regular process. SDK spawns Claude, gives it bash + file tools, manages think->act->observe loop. Events parsed from stdout, streamed to your code over WebSocket. */}diff --git a/docs/introduction.mdx b/docs/introduction.mdxindex ae28d4c5..7ea5461c 100644--- a/docs/introduction.mdx+++ b/docs/introduction.mdx@@ -1,31 +1,42 @@---title: "Introduction"-description: "Cloud sandboxes dedicated to running AI agents"+description: "Cloud sandboxes for AI agents"----# OpenComputer+{/* STUB — Progressive JPEG pass 1. Each section below describes planned content. */}-OpenComputer is a cloud sandbox platform dedicated to running the **Claude Agent SDK** inside isolated virtual machines. Each sandbox is a full Linux environment where agents can execute commands, read and write files, and run for as long as they need.+## What is OpenComputer-## Built for AI agents+{/* One-sentence tagline: cloud sandboxes for AI agents. 3-4 sentences explaining: what a sandbox is, how it differs from containers/serverless (persistent full Linux VM, hibernates, checkpoints). */}++## Key Features++{/* Feature cards (4):+ - Claude Agent SDK built in+ - Long-running (hours/days, not minutes)+ - Checkpoint/fork like git branches+ - Full Linux VM (not a container)+*/}<CardGroup cols={2}>- <Card title="Claude Agent SDK inside the sandbox" icon="robot">- Start a Claude agent session with `sandbox.agent.start()`. The agent runs directly inside the VM with full access to the filesystem and shell.+ <Card title="Claude Agent SDK built in" icon="robot">+ {/* Agent runs inside VM with full filesystem and shell access */}</Card>- <Card title="Optimised for long-running agents" icon="clock">- Sandboxes stay alive for hours or days. Agents can install packages, build projects, run tests, and iterate — without time pressure.+ <Card title="Long-running" icon="clock">+ {/* Hours/days, not minutes. Install packages, build, test, iterate. */}</Card>- <Card title="Run agent tasks easily" icon="play">- Pass a prompt to `sandbox.agent.start()` and get back a stream of events — assistant messages, tool calls, and results — as the agent works.+ <Card title="Checkpoint & fork" icon="code-branch">+ {/* Named snapshots. Fork new sandboxes from any checkpoint. Like git branches for VMs. */}</Card>- <Card title="Snapshot, restore, fork any VM" icon="code-branch">- Create checkpoints of a running sandbox, restore to any previous state, or fork new sandboxes from a checkpoint. Branch your agent's work like git branches.+ <Card title="Full Linux VM" icon="server">+ {/* Not a container. Real VM with its own kernel, memory, disk. Hardware isolation via Firecracker. */}</Card></CardGroup>## Install+{/* CodeGroup: npm / pip / CLI install commands. Set OPENCOMPUTER_API_KEY env var. */}+<CodeGroup>```bash npm@@ -36,43 +47,33 @@ npm install @opencomputer/sdkpip install opencomputer-sdk```-</CodeGroup>--## Quick example--```typescript-import { Sandbox } from "@opencomputer/sdk";+```bash CLI+brew install opencomputer/tap/oc+```-const sandbox = await Sandbox.create({ template: "default" });+</CodeGroup>-const session = await sandbox.agent.start({- prompt: "Create a hello world Express server and test it",- onEvent: (event) => {- if (event.type === "assistant") {- console.log(event.content);- }- },-});+```bash+export OPENCOMPUTER_API_KEY=your-api-key+```-const exitCode = await session.done;-console.log(`Agent finished with exit code: ${exitCode}`);+## Quick Example-await sandbox.kill();-```+{/* Minimal: create sandbox -> run agent -> get result. TS + Python CodeGroup. Keep very short — quickstart has the full walkthrough. */}-## Next steps+## Next Steps<CardGroup cols={2}><Card title="Quickstart" icon="rocket" href="/quickstart">- Run your first agent in 5 minutes.+ {/* Working agent in 2 minutes */}</Card>- <Card title="Agents" icon="robot" href="/agents">- Full reference for sandbox.agent.+ <Card title="How It Works" icon="microchip" href="/how-it-works">+ {/* Architecture: Firecracker VMs, hibernation, checkpoints */}</Card>- <Card title="Running Commands" icon="terminal" href="/running-commands">- Execute shell commands directly.+ <Card title="Agents" icon="robot" href="/agents/overview">+ {/* Run Claude inside sandboxes */}</Card>- <Card title="Working with Files" icon="file" href="/working-with-files">- Read, write, and manage files in the sandbox.+ <Card title="Sandboxes" icon="box" href="/sandboxes/overview">+ {/* The compute primitive */}</Card></CardGroup>diff --git a/docs/mint.json b/docs/mint.jsonindex 7668d942..6fe672a1 100644--- a/docs/mint.json+++ b/docs/mint.json@@ -25,78 +25,64 @@"name": "Get Started","url": "/quickstart"},- "tabs": [- {- "name": "TypeScript SDK",- "url": "sdks/typescript"- },- {- "name": "Python SDK",- "url": "sdks/python"- },- {- "name": "CLI",- "url": "cli"- }- ],+ "tabs": [],"navigation": [{"group": "Getting Started","pages": ["introduction",- "quickstart"+ "quickstart",+ "how-it-works"]},{- "group": "Using OpenComputer",+ "group": "Agents","pages": [- "agents",- "running-commands",- "working-with-files"+ "agents/overview",+ "agents/events",+ "agents/tools",+ "agents/multi-turn"]},{- "group": "Guides",+ "group": "Sandboxes","pages": [- "guides/build-a-lovable-clone"+ "sandboxes/overview",+ "sandboxes/running-commands",+ "sandboxes/working-with-files",+ "sandboxes/interactive-terminals",+ "sandboxes/checkpoints",+ "sandboxes/templates",+ "sandboxes/patches",+ "sandboxes/preview-urls"]},{- "group": "TypeScript SDK",+ "group": "Guides","pages": [- "sdks/typescript/overview",- "sdks/typescript/sandbox",- "sdks/typescript/commands",- "sdks/typescript/filesystem",- "sdks/typescript/pty",- "sdks/typescript/templates",- "sdks/typescript/checkpoints",- "sdks/typescript/patches"+ "guides/build-a-lovable-clone",+ "guides/agent-skill"]},{- "group": "Python SDK",+ "group": "Reference","pages": [- "sdks/python/overview",- "sdks/python/sandbox",- "sdks/python/commands",- "sdks/python/filesystem",- "sdks/python/pty",- "sdks/python/templates",- "sdks/python/checkpoints",- "sdks/python/patches"+ "reference/api",+ "reference/typescript-sdk",+ "reference/python-sdk",+ "cli/overview",+ "cli/sandbox",+ "cli/exec",+ "cli/shell",+ "cli/checkpoint",+ "cli/patch",+ "cli/preview"]},{- "group": "CLI Reference",+ "group": "Resources","pages": [- "cli/overview",- "cli/sandbox",- "cli/commands",- "cli/shell",- "cli/checkpoints",- "cli/patches",- "cli/previews"+ "troubleshooting"]}],diff --git a/docs/quickstart.mdx b/docs/quickstart.mdxindex 65241e91..fbaf40f7 100644--- a/docs/quickstart.mdx+++ b/docs/quickstart.mdx@@ -1,84 +1,53 @@---title: "Quickstart"-description: "Run your first AI agent inside a sandbox"+description: "Working agent in 2 minutes"----## 1. Get your API key+{/* STUB — Progressive JPEG pass 1. Goal: one focused example, zero detours. */}-Sign up at [app.opencomputer.dev](https://app.opencomputer.dev) and grab your API key from the dashboard.+## Prerequisites-## 2. Install the SDK--<CodeGroup>--```bash npm-npm install @opencomputer/sdk-```--```bash pip-pip install opencomputer-sdk-```--</CodeGroup>--## 3. Set your API key+{/* API key + SDK installed (link to intro for install). */}```bash-export OPENCOMPUTER_API_KEY="your-api-key"+export OPENCOMPUTER_API_KEY=your-api-key```-## 4. Run your first agent+## Run an Agent++{/* Single example: create sandbox, agent.start() with a real task, stream events, print result.+ TS + Python CodeGroup. This is the ONLY example on this page.+ Python example must use sandbox.agent (NOT sandbox.commands). */}<CodeGroup>```typescript TypeScript-import { Sandbox } from "@opencomputer/sdk";--// Create a sandbox-const sandbox = await Sandbox.create({ template: "default" });--// Start an agent session with a task-const session = await sandbox.agent.start({- prompt: "Create a Python script that prints the Fibonacci sequence up to 100, then run it",- onEvent: (event) => {- if (event.type === "assistant") {- console.log(event.content);- }- if (event.type === "result") {- console.log("Result:", event.result);- }- },-});--// Wait for the agent to finish-const exitCode = await session.done;-console.log(`Agent exited with code: ${exitCode}`);--// Clean up-await sandbox.kill();+// TODO: create sandbox -> agent.start() -> stream events -> print result -> kill``````python Python-import asyncio-from opencomputer import Sandbox--async def main():- sandbox = await Sandbox.create(template="default")-- result = await sandbox.commands.run('echo "Hello from OpenComputer!"')- print(result.stdout)-- await sandbox.kill()--asyncio.run(main())+# TODO: create sandbox -> agent.start() -> collect_events() -> print result -> kill```</CodeGroup>-The agent will create the file, write the code, and execute it — all inside the sandbox.--## Next steps--- [Agents](/agents) — full reference for `sandbox.agent`-- [Running Commands](/running-commands) — run shell commands directly with `sandbox.exec`-- [Working with Files](/working-with-files) — read, write, and manage files+## What Just Happened++{/* 2-3 sentences: you created a cloud VM (Firecracker microVM), Claude ran inside it with bash and file tools, worked autonomously, and streamed events back to your code. */}++## Next Steps++<CardGroup cols={2}>+ <Card title="How It Works" icon="microchip" href="/how-it-works">+ {/* Architecture and technical decisions */}+ </Card>+ <Card title="Agents" icon="robot" href="/agents/overview">+ {/* Events, tools, multi-turn conversations */}+ </Card>+ <Card title="Sandboxes" icon="box" href="/sandboxes/overview">+ {/* Lifecycle, running commands, files */}+ </Card>+ <Card title="Checkpoints" icon="code-branch" href="/sandboxes/checkpoints">+ {/* Snapshot and fork VMs */}+ </Card>+</CardGroup>diff --git a/docs/reference/api.mdx b/docs/reference/api.mdxnew file mode 100644index 00000000..3ef61368--- /dev/null+++ b/docs/reference/api.mdx@@ -0,0 +1,213 @@+---+title: "HTTP API"+description: "Complete REST API reference"+---++{/* STUB — Progressive JPEG pass 1. Every endpoint, request/response format, auth, status codes. */}++## Base URL & Authentication++{/* Base: https://app.opencomputer.dev/api+ - Control plane auth: X-API-Key header (or api_key query param)+ - Worker direct auth: Authorization: Bearer <JWT> (or token query param for WS)+ - SDK users only need API key — SDK handles JWT transparently+ - All JSON except file read (plain text)+*/}++## Sandbox Lifecycle++### `POST /api/sandboxes` — Create++{/* Params: templateID, timeout, envs, metadata, cpuCount, memoryMB.+ Response: sandboxID, status, connectURL, token, cpuCount, memoryMB, startedAt, endAt.+ Curl example. */}++### `GET /api/sandboxes` — List++{/* Response: array of sandbox objects. */}++### `GET /api/sandboxes/:id` — Get++{/* Response: sandbox details. */}++### `DELETE /api/sandboxes/:id` — Kill++{/* 204 on success. */}++### `POST /api/sandboxes/:id/timeout` — Set Timeout++{/* Body: { timeout: seconds }. */}++### `POST /api/sandboxes/:id/hibernate` — Hibernate++{/* Snapshot VM state. */}++### `POST /api/sandboxes/:id/wake` — Wake++{/* Resume from hibernation. */}++## Commands (Exec)++### `POST /api/sandboxes/:id/exec/run` — Run Command++{/* Body: { command, timeout?, env?, cwd? }. Response: { exitCode, stdout, stderr }. */}++### `POST /api/sandboxes/:id/exec` — Create Exec Session++{/* Body: { command, args?, env?, cwd?, timeout? }. Response: { sessionId }. */}++### `GET /api/sandboxes/:id/exec` — List Sessions++{/* Response: array of ExecSessionInfo. */}++### `GET /api/sandboxes/:id/exec/:sessionID` — WebSocket Attach++{/* Upgrade to WebSocket. Binary protocol. */}++### `POST /api/sandboxes/:id/exec/:sessionID/kill` — Kill Session++{/* Body: { signal? }. */}++## Agent Sessions++### `POST /api/sandboxes/:id/agent` — Create Agent Session++{/* Body: { prompt, model?, systemPrompt?, allowedTools?, permissionMode?, maxTurns?, cwd?, mcpServers?, resume? }. */}++### `GET /api/sandboxes/:id/agent` — List Agent Sessions++{/* Response: array of session objects. */}++### `POST /api/sandboxes/:id/agent/:sid/prompt` — Send Follow-up++{/* Body: { prompt }. */}++### `POST /api/sandboxes/:id/agent/:sid/interrupt` — Interrupt++{/* Stop current turn. */}++### `POST /api/sandboxes/:id/agent/:sid/kill` — Kill++{/* Terminate agent session. */}++## Filesystem++### `GET /api/sandboxes/:id/files?path=...` — Read File++{/* Returns file content as plain text. */}++### `PUT /api/sandboxes/:id/files` — Write File++{/* Body: { path, content }. */}++### `GET /api/sandboxes/:id/files/list?path=...` — List Directory++{/* Response: array of EntryInfo. */}++### `POST /api/sandboxes/:id/files/mkdir` — Create Directory++{/* Body: { path }. */}++### `DELETE /api/sandboxes/:id/files?path=...` — Remove++{/* Delete file or directory. */}++## Checkpoints++### `POST /api/sandboxes/:id/checkpoints` — Create++{/* Body: { name }. Response: CheckpointInfo. */}++### `GET /api/sandboxes/:id/checkpoints` — List++{/* Response: array of CheckpointInfo. */}++### `POST /api/sandboxes/:id/checkpoints/:checkpointId/restore` — Restore++{/* Revert sandbox in-place. */}++### `POST /api/sandboxes/from-checkpoint/:checkpointId` — Fork++{/* Create new sandbox from checkpoint. Response: sandbox object. */}++### `DELETE /api/sandboxes/:id/checkpoints/:checkpointId` — Delete++{/* 204 on success. */}++## Checkpoint Patches++### `POST /api/sandboxes/checkpoints/:checkpointId/patches` — Create++{/* Body: { script, description? }. */}++### `GET /api/sandboxes/checkpoints/:checkpointId/patches` — List++{/* Response: array of PatchInfo. */}++### `DELETE /api/sandboxes/checkpoints/:checkpointId/patches/:patchId` — Delete++{/* 204 on success. */}++## Preview URLs++### `POST /api/sandboxes/:id/preview` — Create++{/* Body: { port, domain? }. Response: { url }. */}++### `GET /api/sandboxes/:id/preview` — List++{/* Response: array of preview URL objects. */}++### `DELETE /api/sandboxes/:id/preview/:port` — Delete++{/* 204 on success. */}++## Templates++### `POST /api/templates` — Build++{/* Body: { name, dockerfile }. Response: TemplateInfo. */}++### `GET /api/templates` — List++{/* Response: array of TemplateInfo. */}++### `GET /api/templates/:name` — Get++{/* Response: TemplateInfo. */}++### `DELETE /api/templates/:name` — Delete++{/* 204 on success. */}++## PTY++### `POST /api/sandboxes/:id/pty` — Create++{/* Body: { cols?, rows? }. Response: { sessionId }. */}++### `GET /api/sandboxes/:id/pty/:sessionID` — WebSocket++{/* Upgrade to WebSocket. Binary protocol same as exec. */}++### `POST /api/sandboxes/:id/pty/:sessionID/resize` — Resize++{/* Body: { cols, rows }. */}++### `DELETE /api/sandboxes/:id/pty/:sessionID` — Kill++{/* Terminate PTY session. */}++## WebSocket Binary Protocol++{/* Exec and PTY sessions use binary WebSocket frames.+ Input: prefix 0x00 + stdin data.+ Output: 0x01 (stdout), 0x02 (stderr), 0x03 (exit code, 4-byte BE int32), 0x04 (scrollback end marker).+ On connect: server replays scrollback buffer, sends 0x04, then live-streams.+*/}++## Error Format++{/* All errors: {"error": "message"} envelope.+ Common codes: 400, 401, 403, 404, 409, 500.+*/}diff --git a/docs/reference/python-sdk.mdx b/docs/reference/python-sdk.mdxnew file mode 100644index 00000000..0e23ffcc--- /dev/null+++ b/docs/reference/python-sdk.mdx@@ -0,0 +1,160 @@+---+title: "Python SDK"+description: "Complete Python SDK reference"+---++{/* STUB — Progressive JPEG pass 1. Every class, method, type. Accurate to actual Python SDK. */}++## Installation++```bash+pip install opencomputer-sdk+```++```python+from opencomputer import Sandbox, Template+```++## Sandbox++### Class Methods++#### `await Sandbox.create(template?, timeout?, api_key?, api_url?, envs?, metadata?): Sandbox`++{/* No cpuCount/memoryMB — use HTTP API for custom resources */}++#### `await Sandbox.connect(sandbox_id, api_key?, api_url?): Sandbox`++#### `await Sandbox.create_from_checkpoint(checkpoint_id, ...): Sandbox`++#### `await Sandbox.create_checkpoint_patch(checkpoint_id, script, description?, ...): dict`++#### `await Sandbox.list_checkpoint_patches(checkpoint_id, ...): list[dict]`++#### `await Sandbox.delete_checkpoint_patch(checkpoint_id, patch_id, ...): None`++### Context Manager++```python+async with await Sandbox.create() as sandbox:+ # sandbox auto-kills on exit+ pass+```++### Instance Methods++#### `await sandbox.kill(): None`++#### `await sandbox.is_running(): bool`++#### `await sandbox.set_timeout(timeout): None`++#### `await sandbox.create_checkpoint(name): dict`++#### `await sandbox.list_checkpoints(): list[dict]`++#### `await sandbox.restore_checkpoint(checkpoint_id): None`++#### `await sandbox.delete_checkpoint(checkpoint_id): None`++#### `await sandbox.create_preview_url(port, domain?): dict`++#### `await sandbox.list_preview_urls(): list[dict]`++#### `await sandbox.delete_preview_url(port): None`++#### `sandbox.close(): None`++### Not Available in Python++{/* hibernate(), wake(), cpuCount/memoryMB on create — use HTTP API directly */}++### Properties++{/* sandbox_id, agent, exec, files, pty */}++## Agent++### `await sandbox.agent.start(prompt, model?, system_prompt?, allowed_tools?, permission_mode?, max_turns?, cwd?, mcp_servers?, on_event?, on_error?): AgentSession`++{/* No resume param. No on_exit, on_scrollback_end. */}++### `await sandbox.agent.attach(session_id, on_event?, on_error?): AgentSession`++### `await sandbox.agent.list(): list[dict]`++### AgentSession++{/* session_id, collect_events(), wait(), send_prompt(), interrupt(), configure(), kill(), close() */}++#### `session.collect_events(): list[AgentEvent]`++{/* Python-unique: returns all events since last call */}++#### `await session.wait(): int`++{/* Python-unique: waits for session to complete, returns exit code */}++### AgentEvent++{/* Dataclass: type, data. Dict-like access: event['type'], event.get('content'). */}++## Exec++### `await sandbox.exec.run(command, timeout?, env?, cwd?): ProcessResult`++{/* ProcessResult: exit_code, stdout, stderr */}++### `await sandbox.exec.start(command, args?, env?, cwd?, timeout?): str`++{/* Returns session ID (string), NOT an ExecSession object. No streaming callbacks. */}++### `await sandbox.exec.list(): list[dict]`++### `await sandbox.exec.kill(session_id, signal?): None`++### Not Available in Python++{/* attach(), streaming callbacks (onStdout, onStderr, onExit), maxRunAfterDisconnect, ExecSession object */}++## Filesystem++### `await sandbox.files.read(path): str`++### `await sandbox.files.read_bytes(path): bytes`++### `await sandbox.files.write(path, content): None`++### `await sandbox.files.list(path?): list[EntryInfo]`++### `await sandbox.files.make_dir(path): None`++### `await sandbox.files.remove(path): None`++### `await sandbox.files.exists(path): bool`++### EntryInfo++{/* name, is_dir, size, mod_time */}++## Pty++### `await sandbox.pty.create(cols?, rows?, on_output?): PtySession`++### PtySession++{/* session_id, send(data), recv() (Python-unique: returns bytes), close() */}++## Template++<Note>+ `Template` is a standalone class (singular, not `Templates`). Import: `from opencomputer import Template`.+</Note>++### `await Template.build(name, dockerfile, api_key?, api_url?): dict`++### `await Template.list(api_key?, api_url?): list[dict]`++### `await Template.get(name, api_key?, api_url?): dict`++### `await Template.delete(name, api_key?, api_url?): None`diff --git a/docs/reference/typescript-sdk.mdx b/docs/reference/typescript-sdk.mdxnew file mode 100644index 00000000..03f844a0--- /dev/null+++ b/docs/reference/typescript-sdk.mdx@@ -0,0 +1,163 @@+---+title: "TypeScript SDK"+description: "Complete TypeScript SDK reference"+---++{/* STUB — Progressive JPEG pass 1. Every class, method, type, parameter. */}++## Installation++```bash+npm install @opencomputer/sdk+```++```typescript+import { Sandbox, Templates } from "@opencomputer/sdk";+```++## Sandbox++{/* Static methods: create(opts?), connect(sandboxId, opts?), createFromCheckpoint(checkpointId, opts?),+ createCheckpointPatch(checkpointId, opts), listCheckpointPatches(checkpointId, opts?), deleteCheckpointPatch(checkpointId, patchId, opts?) */}++### Static Methods++#### `Sandbox.create(opts?): Promise<Sandbox>`++{/* SandboxOpts: template, timeout, apiKey, apiUrl, envs, metadata, cpuCount, memoryMB */}++#### `Sandbox.connect(sandboxId, opts?): Promise<Sandbox>`++#### `Sandbox.createFromCheckpoint(checkpointId, opts?): Promise<Sandbox>`++#### `Sandbox.createCheckpointPatch(checkpointId, opts): Promise<PatchResult>`++#### `Sandbox.listCheckpointPatches(checkpointId, opts?): Promise<PatchInfo[]>`++#### `Sandbox.deleteCheckpointPatch(checkpointId, patchId, opts?): Promise<void>`++### Instance Methods++#### `sandbox.kill(): Promise<void>`++#### `sandbox.isRunning(): Promise<boolean>`++#### `sandbox.hibernate(): Promise<void>`++#### `sandbox.wake(opts?): Promise<void>`++#### `sandbox.setTimeout(timeout): Promise<void>`++#### `sandbox.createCheckpoint(name): Promise<CheckpointInfo>`++#### `sandbox.listCheckpoints(): Promise<CheckpointInfo[]>`++#### `sandbox.restoreCheckpoint(checkpointId): Promise<void>`++#### `sandbox.deleteCheckpoint(checkpointId): Promise<void>`++#### `sandbox.createPreviewURL(opts): Promise<PreviewURLResult>`++#### `sandbox.listPreviewURLs(): Promise<PreviewURLResult[]>`++#### `sandbox.deletePreviewURL(port): Promise<void>`++### Properties++{/* sandboxId: string, agent: Agent, exec: Exec, files: Filesystem, pty: Pty */}++### Types++{/* SandboxOpts, CheckpointInfo, PatchInfo, PatchResult, PreviewURLResult */}++## Agent++### `sandbox.agent.start(opts?): Promise<AgentSession>`++{/* AgentStartOpts extends AgentConfig: prompt, model, systemPrompt, allowedTools, permissionMode, maxTurns, cwd, mcpServers, onEvent, onError, resume, onExit, onScrollbackEnd */}++### `sandbox.agent.attach(sessionId, opts?): Promise<AgentSession>`++### `sandbox.agent.list(): Promise<AgentSessionInfo[]>`++### AgentSession++{/* sessionId, done: Promise<number>, sendPrompt(), interrupt(), configure(), kill(), close() */}++### Types++{/* AgentStartOpts, AgentConfig, AgentEvent, McpServerConfig */}++## Exec++### `sandbox.exec.run(command, opts?): Promise<ProcessResult>`++{/* RunOpts: timeout, env, cwd */}++### `sandbox.exec.start(command, opts?): Promise<ExecSession>`++{/* ExecStartOpts: args, env, cwd, timeout, maxRunAfterDisconnect, onStdout, onStderr, onExit */}++### `sandbox.exec.attach(sessionId, opts?): Promise<ExecSession>`++{/* ExecAttachOpts: onStdout, onStderr, onExit, onScrollbackEnd */}++### `sandbox.exec.list(): Promise<ExecSessionInfo[]>`++### `sandbox.exec.kill(sessionId, signal?): Promise<void>`++### ExecSession++{/* sessionId, done: Promise<number>, sendStdin(), kill(), close() */}++### Types++{/* RunOpts, ExecStartOpts, ExecAttachOpts, ProcessResult, ExecSessionInfo */}++## Filesystem++### `sandbox.files.read(path): Promise<string>`++### `sandbox.files.readBytes(path): Promise<Uint8Array>`++### `sandbox.files.write(path, content): Promise<void>`++### `sandbox.files.list(path?): Promise<EntryInfo[]>`++### `sandbox.files.makeDir(path): Promise<void>`++### `sandbox.files.remove(path): Promise<void>`++### `sandbox.files.exists(path): Promise<boolean>`++### Types++{/* EntryInfo: name, isDir, size, modTime */}++## Pty++### `sandbox.pty.create(opts?): Promise<PtySession>`++{/* PtyOpts: cols, rows, onOutput */}++### PtySession++{/* sessionId, send(data), close() */}++## Templates++<Note>+ `Templates` is a standalone class (not a Sandbox property). Import: `import { Templates } from "@opencomputer/sdk"`.+</Note>++### `Templates.build(name, dockerfile, opts?): Promise<TemplateInfo>`++### `Templates.list(opts?): Promise<TemplateInfo[]>`++### `Templates.get(name, opts?): Promise<TemplateInfo>`++### `Templates.delete(name, opts?): Promise<void>`++### Types++{/* TemplateInfo: templateID, name, tag, status */}diff --git a/docs/sandboxes/checkpoints.mdx b/docs/sandboxes/checkpoints.mdxnew file mode 100644index 00000000..009e747c--- /dev/null+++ b/docs/sandboxes/checkpoints.mdx@@ -0,0 +1,69 @@+---+title: "Checkpoints"+description: "Snapshot and fork sandbox state"+---++{/* STUB — Progressive JPEG pass 1. Entity page: named VM snapshots. */}++## What is a Checkpoint++{/* Named snapshot of a running sandbox's full state (memory, disk, processes). Fork new sandboxes from it — each fork starts exactly where the checkpoint left off. Like git commits for VMs. */}++## Quick Example++{/* Create checkpoint -> fork new sandbox -> verify state preserved. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: sandbox.createCheckpoint('before-deploy') -> Sandbox.createFromCheckpoint(id) -> verify+```++```python Python+# TODO: sandbox.create_checkpoint('before-deploy') -> Sandbox.create_from_checkpoint(id) -> verify+```++</CodeGroup>++## Checkpoints vs Hibernation++{/* Key difference:+ - Hibernation pauses and resumes the SAME sandbox+ - Checkpoints create NEW sandboxes from saved state+ - A sandbox can have many checkpoints; hibernation is a single pause/resume+*/}++## API Reference++### Create Checkpoint++{/* sandbox.createCheckpoint(name) / create_checkpoint(name). ParamField. */}++### List Checkpoints++{/* sandbox.listCheckpoints() / list_checkpoints(). Returns CheckpointInfo[]. */}++### Fork from Checkpoint++{/* Sandbox.createFromCheckpoint(checkpointId) / create_from_checkpoint(). Creates new sandbox. */}++### Restore Checkpoint++{/* sandbox.restoreCheckpoint(checkpointId) / restore_checkpoint(). Reverts sandbox in-place. */}++### Delete Checkpoint++{/* sandbox.deleteCheckpoint(checkpointId) / delete_checkpoint(). */}++## CheckpointInfo++{/* Fields:+ - TS: id, sandboxId, orgId, name, sandboxConfig, status, sizeBytes, createdAt+ - Python: returns raw dict from API+ - HTTP: id, sandboxId, orgId, name, status, sizeBytes, createdAt+ Status: processing -> ready (or failed)+*/}++## Examples++{/* Checkpoint before risky operation. Fork for parallel exploration (try 5 approaches from same state). */}diff --git a/docs/sandboxes/interactive-terminals.mdx b/docs/sandboxes/interactive-terminals.mdxnew file mode 100644index 00000000..41ccbf0e--- /dev/null+++ b/docs/sandboxes/interactive-terminals.mdx@@ -0,0 +1,51 @@+---+title: "Interactive Terminals"+description: "Full PTY sessions inside sandboxes"+---++{/* STUB — Progressive JPEG pass 1. PTY sessions — like SSH but over WebSocket. */}++## What is a PTY Session++{/* A full interactive terminal inside the sandbox. Supports colors, full-screen apps (vim, top). Like SSH but over WebSocket. */}++## Quick Example++{/* Create PTY, send command, read output. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: sandbox.pty.create({ onOutput }) -> session.send('ls\n') -> close+```++```python Python+# TODO: sandbox.pty.create(on_output=...) -> session.send('ls\n') -> recv() -> close+```++</CodeGroup>++## Creating a PTY++{/* sandbox.pty.create(opts) */}++### PtyOpts++{/* ParamField: cols (default 80), rows (default 24), onOutput callback */}++## PtySession++{/* Methods table:+ - send(data) — both SDKs+ - close() — both SDKs+ - recv() — Python-only (returns bytes; pull-based alternative to onOutput callback)+ - Note: resize() not available in SDKs. HTTP API has POST /sandboxes/:id/pty/:sessionID/resize but no SDK wrapper.+*/}++## Examples++{/* Run interactive commands, pipe stdin. */}++## CLI++{/* oc shell <sandbox-id> — opens interactive terminal. Supports --shell flag (default /bin/bash). */}diff --git a/docs/sandboxes/overview.mdx b/docs/sandboxes/overview.mdxnew file mode 100644index 00000000..190ebe5f--- /dev/null+++ b/docs/sandboxes/overview.mdx@@ -0,0 +1,85 @@+---+title: "Sandboxes"+description: "The compute primitive — full Linux VMs in the cloud"+---++{/* STUB — Progressive JPEG pass 1. The definitive sandbox page: concept + lifecycle + API. */}++## What is a Sandbox++{/* A full Linux virtual machine in the cloud. Isolated environment: own filesystem, network, processes. Think of it as a laptop that sleeps when idle and wakes instantly. */}++## Quick Example++{/* Create -> run command -> kill. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: Sandbox.create -> exec.run('echo hello') -> kill+```++```python Python+# TODO: Sandbox.create -> exec.run('echo hello') -> kill+```++</CodeGroup>++## Specs++{/* Table:+ - OS: Ubuntu-based Linux+ - Default CPU: 1 vCPU (configurable up to 4 via cpuCount — TS + HTTP; not yet Python)+ - Default memory: 512MB (configurable up to 2048MB via memoryMB — TS + HTTP; not yet Python)+ - Storage: 20GB workspace+ - Network: full outbound internet+ - Pre-installed: Python 3, Node.js, common CLI tools+*/}++## Creating a Sandbox++{/* Sandbox.create(opts) with ParamField reference:+ - Both SDKs: template, timeout, apiKey/api_key, apiUrl/api_url, envs, metadata+ - TS-only: cpuCount, memoryMB+ - Note for Python: use HTTP API for custom resources+*/}++## Connecting to an Existing Sandbox++{/* Sandbox.connect(sandboxId) — TS + Python CodeGroup */}++## Lifecycle++{/* Status states: running, hibernated, stopped, error.+ Text-based lifecycle: running <-> hibernated -> stopped; running -> error+ Rolling timeout: resets on every operation, default 300s.+ What happens on timeout: auto-hibernate if possible, else stop.+*/}++## Hibernation & Wake++{/* Like closing a laptop lid: memory + disk snapshotted, sandbox ID stays same.+ - sandbox.hibernate(), sandbox.wake() — TS SDK+ - Resume in seconds, no cost while hibernated+ - Auto-triggered on idle timeout+ - Difference from checkpoints: hibernation = transparent resume; checkpoints = named snapshots you fork from+ - Note: Python SDK doesn't have hibernate/wake. HTTP API: POST /api/sandboxes/:id/hibernate, wake. CLI: oc sandbox hibernate, wake.+*/}++<Note>+ `hibernate()` and `wake()` are available in the TypeScript SDK and CLI. Python SDK support is planned — use the HTTP API directly for now.+</Note>++## Other Methods++{/* kill(), isRunning()/is_running(), setTimeout()/set_timeout() */}++## Properties++{/* sandboxId, agent, exec, files, pty+ Python-specific: async with Sandbox.create() as sandbox: (context manager, auto-kills on exit)+*/}++## Related++{/* Links to: Agents overview (agents run inside sandboxes), Running Commands, Files, Terminals, Checkpoints, Templates */}diff --git a/docs/sandboxes/patches.mdx b/docs/sandboxes/patches.mdxnew file mode 100644index 00000000..20f30c14--- /dev/null+++ b/docs/sandboxes/patches.mdx@@ -0,0 +1,56 @@+---+title: "Patches"+description: "Scripts that run when forking from a checkpoint"+---++{/* STUB — Progressive JPEG pass 1. Entity page: checkpoint-attached scripts. */}++## What is a Patch++{/* A shell script attached to a checkpoint that runs every time a sandbox is forked from that checkpoint. Inject config, update deps, or customize state at fork time without modifying the checkpoint. */}++## Quick Example++{/* Create patch on checkpoint. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: Sandbox.createCheckpointPatch(checkpointId, { script: '...', description: '...' })+```++```python Python+# TODO: Sandbox.create_checkpoint_patch(checkpoint_id, script='...', description='...')+```++</CodeGroup>++## API Reference++### Create Patch++{/* Sandbox.createCheckpointPatch(checkpointId, { script, description }). ParamField. */}++### List Patches++{/* Sandbox.listCheckpointPatches(checkpointId). Returns PatchInfo[]. */}++### Delete Patch++{/* Sandbox.deleteCheckpointPatch(checkpointId, patchId). */}++## When Patches Run++{/* Applied on wake/boot from checkpoint. Strategy is always `on_wake`. */}++## Execution Order++{/* Patches run in creation order. */}++## Failure Handling++{/* What happens if a patch script fails. */}++## Example++{/* Inject API keys at fork time. Update packages without rebuilding checkpoint. */}diff --git a/docs/sandboxes/preview-urls.mdx b/docs/sandboxes/preview-urls.mdxnew file mode 100644index 00000000..dbc9023f--- /dev/null+++ b/docs/sandboxes/preview-urls.mdx@@ -0,0 +1,56 @@+---+title: "Preview URLs"+description: "Expose sandbox ports to the internet"+---++{/* STUB — Progressive JPEG pass 1. Entity page: public HTTPS URLs for sandbox ports. */}++## What is a Preview URL++{/* A public HTTPS URL that exposes a port inside your sandbox to the internet. Start a web server on port 3000, create a preview URL, and anyone can access it. */}++## Quick Example++{/* Create preview URL. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: sandbox.createPreviewURL({ port: 3000 }) -> url+```++```python Python+# TODO: sandbox.create_preview_url(port=3000) -> url+```++</CodeGroup>++## API Reference++### Create Preview URL++{/* sandbox.createPreviewURL({ port, domain?, authConfig? }). ParamField. */}++### List Preview URLs++{/* sandbox.listPreviewURLs(). */}++### Delete Preview URL++{/* sandbox.deletePreviewURL(port). */}++## Custom Domains++{/* Requires Cloudflare integration on deployment.+ - Pass domain param when creating+ - SSL automatic via Cloudflare+ - Custom domain setup is org-level config (dashboard, not SDK)+*/}++## Persistence++{/* Preview URLs persist across hibernation/wake cycles. */}++## Examples++{/* Share a dev server. Multiple ports. Custom domain. */}diff --git a/docs/sandboxes/running-commands.mdx b/docs/sandboxes/running-commands.mdxnew file mode 100644index 00000000..489d7c7e--- /dev/null+++ b/docs/sandboxes/running-commands.mdx@@ -0,0 +1,73 @@+---+title: "Running Commands"+description: "Execute shell commands inside a sandbox"+---++{/* STUB — Progressive JPEG pass 1. Two modes: run() (sync) and start() (streaming/async). */}++## Quick Commands: `sandbox.exec.run()`++{/* Run a shell command and wait for the result. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: sandbox.exec.run('echo "hello"') -> result.stdout+```++```python Python+# TODO: sandbox.exec.run('echo "hello"') -> result.stdout+```++</CodeGroup>++### Parameters++{/* ParamField: command (required), timeout (default 60), env, cwd */}++### ProcessResult++{/* Table: exitCode/exit_code, stdout, stderr */}++### Examples++{/* Working directory, env vars, timeout, chaining commands. TS + Python CodeGroup. */}++## Async Commands: `sandbox.exec.start()`++{/* Start long-running command, stream output.+ - TS: full streaming — returns ExecSession with onStdout, onStderr, onExit callbacks, sendStdin(), kill(), close(). Supports maxRunAfterDisconnect.+ - Python: returns str (session ID only). No streaming callbacks, no ExecSession. Use exec.list() and exec.kill().+*/}++### TypeScript — Full Streaming++{/* TS example with onStdout, onStderr, onExit, sendStdin, kill */}++### Python — Session ID++{/* Python example: start() returns session_id, then list/kill */}++### ExecSession (TypeScript)++{/* Table: sessionId, done, sendStdin, kill, close */}++## Managing Sessions++{/* exec.list() — both SDKs. exec.attach() — TS only. exec.kill() — both SDKs. */}++### List Sessions++{/* TS + Python CodeGroup */}++### Attach to Running Session (TypeScript only)++{/* Reconnect to running session by ID. TS example with onStdout, onScrollbackEnd. */}++### Kill a Session++{/* TS + Python CodeGroup */}++## Examples++{/* Dev server (TS streaming), long-running process, reconnect pattern (TS only) */}diff --git a/docs/sandboxes/templates.mdx b/docs/sandboxes/templates.mdxnew file mode 100644index 00000000..398bc33b--- /dev/null+++ b/docs/sandboxes/templates.mdx@@ -0,0 +1,66 @@+---+title: "Templates"+description: "Pre-built base images for sandboxes"+---++{/* STUB — Progressive JPEG pass 1. Entity page: Dockerfile-based base images. */}++## What is a Template++{/* Pre-built base image that sandboxes start from. The `default` template includes Ubuntu, Python, Node.js. Build custom templates from Dockerfiles to skip setup time. */}++## Quick Example++{/* Build template -> create sandbox from it. TS + Python CodeGroup. */}++<CodeGroup>++```typescript TypeScript+// TODO: Templates.build('my-env', dockerfile) -> Sandbox.create({ template: 'my-env' })+```++```python Python+# TODO: Template.build('my-env', dockerfile) -> Sandbox.create(template='my-env')+```++</CodeGroup>++## Default Template++{/* What's pre-installed: Ubuntu, Python 3, Node.js, common CLI tools. Derived from Dockerfile.default. */}++## API Reference++<Note>+ Templates is a standalone class, not a property on Sandbox. TypeScript exports `Templates` (plural), Python exports `Template` (singular).+</Note>++### Build Template++{/* templates.build(name, dockerfile) / Template.build(name, dockerfile). ParamField. */}++### List Templates++{/* templates.list() / Template.list(). Returns TemplateInfo[]. */}++### Get Template++{/* templates.get(name) / Template.get(name). */}++### Delete Template++{/* templates.delete(name) / Template.delete(name). */}++### Using with Sandbox.create++{/* Sandbox.create({ template: 'my-template' }) */}++## TemplateInfo++{/* Fields: templateID/template_id, name, tag, status.+ Status: building -> ready (or error).+*/}++## Example++{/* Template with specific language/framework pre-installed (e.g., Node 20 + pnpm). */}diff --git a/docs/sandboxes/working-with-files.mdx b/docs/sandboxes/working-with-files.mdxnew file mode 100644index 00000000..421689ba--- /dev/null+++ b/docs/sandboxes/working-with-files.mdx@@ -0,0 +1,46 @@+---+title: "Working with Files"+description: "Read, write, and manage files inside a sandbox"+---++{/* STUB — Progressive JPEG pass 1. Filesystem operations via sandbox.files. */}++## Reading Files++{/* sandbox.files.read(path) — returns string content. TS + Python CodeGroup. */}++### Read as Bytes++{/* sandbox.files.readBytes(path) / read_bytes(path) — returns binary. TS + Python CodeGroup. */}++## Writing Files++{/* sandbox.files.write(path, content) — text and binary. TS + Python CodeGroup. */}++## Listing Directories++{/* sandbox.files.list(path) — returns EntryInfo[]. TS + Python CodeGroup. */}++### EntryInfo++{/* Table: name, isDir/is_dir, size, modTime/mod_time */}++## Managing Files++{/* make_dir, remove, exists. TS + Python CodeGroup for each. */}++### Create Directory++{/* sandbox.files.makeDir(path) / make_dir(path) */}++### Remove++{/* sandbox.files.remove(path) */}++### Check Existence++{/* sandbox.files.exists(path) — client-side wrapper (HEAD request). Both SDKs. */}++## Examples++{/* Upload & run a script. Copy files between paths. */}diff --git a/docs/troubleshooting.mdx b/docs/troubleshooting.mdxnew file mode 100644index 00000000..3e48dead--- /dev/null+++ b/docs/troubleshooting.mdx@@ -0,0 +1,37 @@+---+title: "Troubleshooting"+description: "Common errors and debugging tips"+---++{/* STUB — Progressive JPEG pass 1. */}++## Common Errors++### `401 Unauthorized`++{/* Check API key, env var name (OPENCOMPUTER_API_KEY). */}++### `Sandbox not found`++{/* Sandbox may have been killed or timed out. Check with oc ls or sandbox.isRunning(). */}++### `Connection refused`++{/* Sandbox still creating, or hibernated. Check status. */}++### Timeout errors++{/* Increase timeout. Check idle timeout (rolling, resets on every operation). */}++## Debugging Tips++{/*+ - Check sandbox status with sandbox.isRunning() / is_running()+ - Use sandbox.exec.list() to see running processes+ - Agent stderr via onError callback+ - CLI: oc sandbox get <id> for full details+*/}++## Getting Help++{/* GitHub issues: https://github.com/diggerhq/opencomputer/issues */}