Skip to content

An open-source, faster Devin alternative

TypeScript

Tighten docs rewrite plan and stub contracts

Igor Zalutskic4030968e190
diff --git a/.agents_wip/docs-plan.md b/.agents_wip/docs-plan.md
index db19483c..6cdd58f6 100644
--- a/.agents_wip/docs-plan.md
+++ b/.agents_wip/docs-plan.md
@@ -3,13 +3,14 @@
## Guiding Principles
1. **Single sidebar, no tabs.** Every page lives in one navigation tree.
-2. **Entity-first.** Pages organized around things the user encounters (sandboxes, agents, checkpoints, templates), not by SDK or abstract category. Each entity page is self-contained: what it is, how to use it, full API reference.
+2. **Entity-first.** Pages organized around things the user encounters (sandboxes, agents, checkpoints, templates), not by SDK or abstract category. Each entity page should be self-contained conceptually: what it is, when to use it, and the common workflows.
3. **Three-tab examples.** Every code example wraps in tabs: TypeScript / Python / HTTP API (where applicable). The user picks their preferred surface once and sees it everywhere. Some examples are SDK-only (no HTTP equivalent for streaming); some are HTTP-only (auth headers). Use judgement — include a tab only when it adds value.
4. **Quality over quantity.** If it can be said in fewer words, it should be. No filler sections. Every page earns its place.
-5. **Entity → Example → Reference** flow on each page. Open with what the entity *is* (2-3 sentences), show a working code example, then provide the full API reference below.
+5. **Entity → Example → API At A Glance** flow on each page. Open with what the entity *is* (2-3 sentences), show a working code example, then summarize the methods most readers need before linking down to exhaustive reference.
6. **Code-forward.** The first thing on every entity page (after the short explanation) should be a working code example. Parameters and types come after.
-7. **Reference section is exhaustive.** The Agents/Sandboxes pages teach with curated examples. The Reference pages document every endpoint, method, type, and parameter — the source of truth when the entity pages aren't enough.
-8. **Honest about gaps.** Don't document features that don't exist yet. Mark experimental/beta features clearly.
+7. **Reference pages are contract-authoritative.** The Agents/Sandboxes pages teach with curated examples and stable behavioral guidance. The Reference pages document exact endpoints, methods, types, parameters, flags, and payloads.
+8. **Contracts come from code, not guesswork.** Do not hand-spec request/response fields, status enums, defaults, or CLI flags unless they were checked against the current handlers, SDK types, and command source.
+9. **Honest about gaps.** Don't document features that don't exist yet. Mark experimental/beta features clearly.
---
@@ -26,7 +27,7 @@
### Key problems (why we're rewriting)
1. **Tab separation creates duplication.** "Running Commands" exists as a feature page, a TS SDK page, a Python SDK page, and a CLI page. Four places for one concept.
2. **No conceptual foundation.** Docs jump straight to API calls without explaining what a sandbox *is*, its lifecycle, resource model, or how persistence works.
-3. **Missing critical content.** No sandbox specs (OS, storage, network), no error reference, no troubleshooting, no architecture overview.
+3. **Missing critical content.** No connection-model explanation (control plane vs worker), no error reference, no troubleshooting, no architecture overview.
4. **SDK/code gaps.** `resume` in Agent sessions, `maxRunAfterDisconnect` in exec, hibernation semantics, preview URL domain verification — all in code but undocumented.
5. **Inconsistent API naming between SDKs.** `sandbox.exec` vs `sandbox.commands` (deprecated alias still used in Python quickstart examples).
@@ -148,10 +149,17 @@ The page stubs are the **source of truth** for page-level content decisions.
Each entity page follows this pattern:
1. **What is this** — 2-3 sentences explaining the entity
2. **Primary code example** in tabs (TypeScript / Python / HTTP API where applicable)
-3. **API reference** with `<ParamField>` for each method
+3. **API at a glance** — the common methods, parameters, and caveats
4. **Additional examples** (also tabbed where applicable)
5. **Cross-links** — `<Tip>` at the bottom with CLI equivalent + Reference page links
+### Contract discipline
+
+- **Reference pages own exact contracts.** Request bodies, response shapes, enum values, CLI flags, and route availability live in `reference/*`.
+- **Entity and CLI guide pages stay curated.** They explain workflows, tradeoffs, and the few methods/flags most readers need, but they should not mirror exhaustive contract detail.
+- **Document surface differences explicitly.** When behavior differs across TS / Python / HTTP / CLI, call it out with availability notes instead of forcing parity in prose.
+- **Explain the connection model centrally.** `how-it-works` and `reference/api` must both cover control plane vs worker-direct access, `connectURL`, JWT auth, and worker-only operations.
+
### Cross-linking pattern
Entity pages link down to CLI guide + Reference. CLI guide pages link to the SDK entity page + `reference/cli.mdx`. This creates a navigable triangle: entity page ↔ CLI guide ↔ reference. A reader never hits a dead end.
@@ -168,6 +176,11 @@ Two-tier model:
Each CLI guide page ends with a `<Tip>` linking to the SDK entity page + `reference/cli.mdx`.
+### Migration discipline
+
+- Remove or redirect the replaced page in the same change that lands its replacement. Do not keep old and new canonical pages alive in parallel longer than necessary.
+- Add migration callouts when the public story changed (`sandbox.commands` -> `sandbox.exec`, legacy `/commands`, `base` vs `default`, CLI renames).
+
---
## Pages to Delete
diff --git a/docs/agents/events.mdx b/docs/agents/events.mdx
index 05137bfa..08006bb3 100644
--- a/docs/agents/events.mdx
+++ b/docs/agents/events.mdx
@@ -6,8 +6,9 @@ description: "Understanding the agent event stream"
{/*
TODO: Expand this stub into full content.
- GOAL: Complete reference for understanding what comes back from an agent session.
- A developer should be able to look at any event and know exactly what it means and how to handle it.
+ GOAL: Explain the common agent events and how to handle them safely.
+ The wrapper mostly forwards Claude Agent SDK messages through as-is, so this page should document
+ the common events and patterns without pretending the event taxonomy is narrower or more stable than it is.
*/}
## Overview
@@ -16,13 +17,16 @@ description: "Understanding the agent event stream"
## Event Lifecycle
-{/* Typical order for a successful session:
- ready -> configured -> assistant -> tool_use_summary -> assistant -> ... -> result -> turn_complete
+{/* Show a typical successful flow, but note this is illustrative rather than exhaustive:
+ ready -> configured -> assistant/system/tool_use_summary/... -> result -> turn_complete
*/}
## Event Reference
-{/* One subsection per event type. Each with: what it means, when it fires, fields/payload, code example. */}
+{/* Cover the common event families. Each subsection should explain what it means, when it fires,
+ the fields people usually care about, and a code example.
+ Add a note near the top: preserve unknown fields and tolerate unknown event types.
+*/}
### `ready`
@@ -34,19 +38,25 @@ description: "Understanding the agent event stream"
### `assistant`
-{/* Claude's text output. Fields: content. The most common event — this is the agent "talking". */}
+{/* Claude's text output. Do not hard-code a single payload shape; current wrapper comments show `message`,
+ and upstream Claude SDK event fields may evolve. Document the common fields and show how to inspect raw events.
+*/}
### `tool_use_summary`
-{/* Agent used a tool (bash, file, etc.). Fields: tool, input summary, output summary. */}
+{/* Tool summary event from the wrapper/SDK stream. Document common fields only; do not overfit the exact shape. */}
### `system`
-{/* System-level message from the agent process. */}
+{/* System-level messages from the SDK stream. Call out common subtypes like init, task_started, and task_progress. */}
+
+### `tool_progress`
+
+{/* Long-running tool progress updates. Call out common fields like tool_name and elapsed_time_seconds. */}
### `result`
-{/* Final structured result. Fields: result. Only emitted if the agent produces a final answer. */}
+{/* Final result event. Document common fields like subtype plus result or structured_output, but note the payload varies by run/output mode. */}
### `turn_complete`
@@ -58,14 +68,15 @@ description: "Understanding the agent event stream"
### `error`
-{/* Agent encountered an error. Fields: error message. */}
+{/* Agent emitted an explicit error event. Message field is common, but preserve unknown fields. */}
## Filtering Events
{/* Practical patterns:
- Log only assistant messages
- Capture the final result
- - Build a progress indicator from tool_use_summary events
+ - Build progress indicators from system/task/tool_progress events
+ - Preserve unknown events for forward compatibility
*/}
## Error Handling
diff --git a/docs/agents/multi-turn.mdx b/docs/agents/multi-turn.mdx
index 0a7ebd83..d026aa5b 100644
--- a/docs/agents/multi-turn.mdx
+++ b/docs/agents/multi-turn.mdx
@@ -10,7 +10,8 @@ description: "Follow-ups, resume, and session management"
follow-ups, resuming across sessions, and managing running sessions.
KEY NOTES:
- - resume is TS-only. Show HTTP API workaround or mark as TS-only for Python.
+ - resume is TS-only in the SDK surface. If showing an HTTP workaround, document the real flow:
+ create agent session with resume, then attach via exec-session WebSocket.
- Distinguish attach (reconnect to running session) vs resume (new session continuing old conversation, TS only).
- Agent sessions are SDK-only — no CLI command yet.
*/}
@@ -26,7 +27,7 @@ description: "Follow-ups, resume, and session management"
- 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: Python SDK does not support resume. If including HTTP, use the real agent-create + exec-attach flow.
*/}
<Note>
diff --git a/docs/cli/checkpoint.mdx b/docs/cli/checkpoint.mdx
index ca6c9bc2..eb5bbe75 100644
--- a/docs/cli/checkpoint.mdx
+++ b/docs/cli/checkpoint.mdx
@@ -24,12 +24,12 @@ oc checkpoint create sb-abc123 --name before-migration
```bash
# Spawn two independent sandboxes from the same checkpoint
-ID1=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.id')
-ID2=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.id')
+ID1=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.sandboxID')
+ID2=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.sandboxID')
# Run different experiments
-oc exec $ID1 -- ./experiment-a.sh
-oc exec $ID2 -- ./experiment-b.sh
+oc exec $ID1 --wait -- ./experiment-a.sh
+oc exec $ID2 --wait -- ./experiment-b.sh
```
## Restoring
diff --git a/docs/cli/exec.mdx b/docs/cli/exec.mdx
index c3b8d6ef..f2b67a8a 100644
--- a/docs/cli/exec.mdx
+++ b/docs/cli/exec.mdx
@@ -8,14 +8,22 @@ description: "Execute shell commands from the CLI"
GOAL: Guide-like page for running commands via CLI.
When to use exec vs shell, scripting patterns, session management.
+
+ KEY NOTES:
+ - `oc exec` defaults to creating an exec session, not waiting for command completion
+ - `--wait` switches to synchronous exec/run behavior and mirrors the remote exit code
+ - `oc exec attach` is not implemented yet in the CLI; say that explicitly
*/}
## Running a Command
-{/* oc exec <id> -- <command>. How it works: command runs inside sandbox, stdout/stderr stream to terminal, CLI exits with same exit code. */}
+{/* Start with the synchronous mode most readers expect:
+ oc exec <id> --wait -- <command>
+ Explain that plain `oc exec` creates a session and prints attach instructions instead.
+*/}
```bash
-oc exec sb-abc123 -- echo "Hello, World!"
+oc exec sb-abc123 --wait -- echo "Hello, World!"
```
## Working Directory & Environment
@@ -23,25 +31,29 @@ oc exec sb-abc123 -- echo "Hello, World!"
{/* --cwd and --env flags. When to use them. */}
```bash
-oc exec sb-abc123 --cwd /app --env NODE_ENV=production -- npm run build
+oc exec sb-abc123 --wait --cwd /app --env NODE_ENV=production -- npm run build
```
## Timeouts
{/* --timeout flag. Default 60s. What happens when exceeded. */}
+## Creating an Exec Session
+
+{/* Plain `oc exec` creates a session for long-running commands and prints the session ID plus attach hint. */}
+
## Capturing Output as JSON
-{/* --json flag gives ProcessResult object. Pipe to jq for scripting. */}
+{/* `--json` with `--wait` gives ProcessResult output for scripting. */}
```bash
-RESULT=$(oc exec sb-abc123 --json -- node -e 'console.log("hello")')
+RESULT=$(oc exec sb-abc123 --json --wait -- node -e 'console.log("hello")')
echo $RESULT | jq '.stdout'
```
## Managing Exec Sessions
-{/* oc exec list, attach, kill — for long-running processes started via SDK. */}
+{/* oc exec list and kill are available. `oc exec attach` exists as a command name but is not implemented yet in the CLI; point users to the SDK or raw WebSocket if needed. */}
## Shell vs Exec
diff --git a/docs/cli/overview.mdx b/docs/cli/overview.mdx
index edea0aee..71a92fee 100644
--- a/docs/cli/overview.mdx
+++ b/docs/cli/overview.mdx
@@ -13,6 +13,7 @@ description: "Manage sandboxes from your terminal"
- 4 platform install: macOS Apple Silicon/Intel, Linux x86_64/ARM64
- Config resolution: flags > env > config file > defaults
- Top-level shortcuts: oc create = oc sandbox create, oc ls = oc sandbox list
+ - `oc exec` creates a session by default; use `--wait` for synchronous command execution
- JSON output mode + jq patterns for scripting
*/}
@@ -85,8 +86,8 @@ chmod +x /usr/local/bin/oc
# Create a sandbox
oc create
-# Run a command
-oc exec sb-abc123 -- echo "Hello from the cloud"
+# Run a command and wait for the result
+oc exec sb-abc123 --wait -- echo "Hello from the cloud"
# Open an interactive shell
oc shell sb-abc123
@@ -123,3 +124,4 @@ oc ls --json | jq -r '.[].sandboxID'
| [checkpoint](/cli/checkpoint) | Snapshot, fork, restore |
| [patch](/cli/patch) | Checkpoint-attached scripts |
| [preview](/cli/preview) | Expose ports to the internet |
+| [config](/reference/cli#oc-config) | Configure API key and API URL |
diff --git a/docs/cli/sandbox.mdx b/docs/cli/sandbox.mdx
index ed54e11f..0f19cd70 100644
--- a/docs/cli/sandbox.mdx
+++ b/docs/cli/sandbox.mdx
@@ -17,7 +17,9 @@ description: "Create, manage, and control sandbox lifecycles from the CLI"
## Creating a Sandbox
-{/* oc create (shortcut for oc sandbox create). Template, resources, env vars. */}
+{/* oc create (shortcut for oc sandbox create). Timeout, resources, env vars, metadata.
+ Do not mention a --template flag unless the CLI grows one.
+*/}
```bash
oc create
@@ -35,7 +37,7 @@ oc sandbox get sb-abc123
## Hibernation & Wake
-{/* Save state and stop paying. Resume exactly where you left off. */}
+{/* Save state and stop paying. Resume the same sandbox later; keep the wording practical rather than over-promising exact process continuity. */}
```bash
oc sandbox hibernate sb-abc123
diff --git a/docs/how-it-works.mdx b/docs/how-it-works.mdx
index 3fdb2c56..1246f94a 100644
--- a/docs/how-it-works.mdx
+++ b/docs/how-it-works.mdx
@@ -15,7 +15,7 @@ description: "Architecture and key technical decisions"
## 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. */}
+{/* One paragraph: your code talks to the control plane, which provisions a Firecracker microVM and returns a worker connectURL/token for data-plane operations. Agents and commands run inside that VM. Events and I/O stream back over WebSocket. */}
## Firecracker microVMs
@@ -23,11 +23,11 @@ description: "Architecture and key technical decisions"
## 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. */}
+{/* VM state is snapshotted so wake is usually fast. Explain warm-restore behavior and the cold-boot fallback path when exact snapshot restore is unavailable. 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. */}
+{/* Named snapshots. Forking tries warm restore first and falls back to cold boot if needed. Emphasize the user-visible guarantee: preserved filesystem state and a reproducible starting point, not always literal process continuity. */}
## Templates
diff --git a/docs/introduction.mdx b/docs/introduction.mdx
index da56bfcd..658bfe90 100644
--- a/docs/introduction.mdx
+++ b/docs/introduction.mdx
@@ -62,7 +62,7 @@ pip install opencomputer-sdk
```
```bash CLI
-brew install opencomputer/tap/oc
+# See /cli/overview for the current install commands for your platform
```
</CodeGroup>
diff --git a/docs/reference/api.mdx b/docs/reference/api.mdx
index 389087ae..c24b09d4 100644
--- a/docs/reference/api.mdx
+++ b/docs/reference/api.mdx
@@ -13,28 +13,34 @@ description: "Complete REST API reference"
agent_session.go, filesystem.go, templates.go (handlers).
KEY NOTES:
- - Each endpoint: method, path, request body (JSON), response body (JSON), status codes, curl example
+ - Each endpoint: method, path, request body, response body, status codes, curl example
+ - Separate control plane routes from worker-direct routes. Hosted/server mode uses both surfaces.
+ - Derive exact field names from current handler/types source. Do not normalize casing by hand.
- Dual auth: X-API-Key for control plane, JWT Bearer for worker direct access
- WebSocket binary protocol section is essential for non-SDK users
- - Token refresh: POST /sandboxes/:id/token/refresh — returns new JWT
+ - Token refresh: POST /sandboxes/:id/token/refresh — worker-only, returns new JWT
*/}
## Base URL & Authentication
-{/* Base: https://app.opencomputer.dev/api
- - Control plane auth: X-API-Key header (or api_key query param)
+{/* Document both surfaces explicitly:
+ - Control plane base: https://app.opencomputer.dev/api
+ - Worker direct base: connectURL from sandbox create/get response (no /api prefix)
+ - Control plane auth: X-API-Key header
- 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)
- - Token refresh: POST /sandboxes/:id/token/refresh — returns new JWT (worker auth)
+ - Add a route-availability matrix: control plane only / worker only / both
+ - File reads return raw content, not JSON. File writes use raw request body + path query param.
+ - Token refresh: POST /sandboxes/:id/token/refresh — worker auth only
*/}
## Sandbox Lifecycle
### `POST /api/sandboxes` — Create
-{/* Params: templateID, timeout, envs, metadata, cpuCount, memoryMB.
- Response: sandboxID, status, connectURL, token, cpuCount, memoryMB, startedAt, endAt.
+{/* Body matches SandboxConfig: templateID, timeout, envs, metadata, cpuCount, memoryMB.
+ Hosted/server-mode response is currently minimal: sandboxID, status, connectURL, token, region, workerID.
+ Do not promise cpuCount/memoryMB/startedAt/endAt on create unless verified for the served surface.
Curl example. */}
### `GET /api/sandboxes` — List
@@ -51,7 +57,9 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/timeout` — Set Timeout
-{/* Body: { timeout: seconds }. */}
+{/* Body: { timeout }.
+ Important: in hosted/server mode this must be sent to the worker via connectURL; control plane returns an error telling the client to use the worker directly.
+*/}
### `POST /api/sandboxes/:id/hibernate` — Hibernate
@@ -65,11 +73,15 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/exec/run` — Run Command
-{/* Body: { command, timeout?, env?, cwd? }. Response: { exitCode, stdout, stderr }. */}
+{/* Body matches ProcessConfig: cmd, optional args, envs, cwd, timeout.
+ Response: { exitCode, stdout, stderr }.
+*/}
### `POST /api/sandboxes/:id/exec` — Create Exec Session
-{/* Body: { command, args?, env?, cwd?, timeout? }. Response: { sessionId }. */}
+{/* Body matches ExecSessionCreateRequest: cmd, optional args, envs, cwd, timeout, maxRunAfterDisconnect.
+ Response is ExecSessionInfo with sessionID casing, not sessionId.
+*/}
### `GET /api/sandboxes/:id/exec` — List Sessions
@@ -87,7 +99,9 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/agent` — Create Agent Session
-{/* Body: { prompt, model?, systemPrompt?, allowedTools?, permissionMode?, maxTurns?, cwd?, mcpServers?, resume? }. */}
+{/* Body matches AgentSessionCreateRequest: prompt, model, systemPrompt, allowedTools, permissionMode, maxTurns, cwd, mcpServers, resume.
+ Note: there is no separate agent WebSocket endpoint; attach uses the exec session WebSocket transport.
+*/}
### `GET /api/sandboxes/:id/agent` — List Agent Sessions
@@ -95,7 +109,7 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/agent/:sid/prompt` — Send Follow-up
-{/* Body: { prompt }. */}
+{/* Body: { text }. */}
### `POST /api/sandboxes/:id/agent/:sid/interrupt` — Interrupt
@@ -113,7 +127,7 @@ description: "Complete REST API reference"
### `PUT /api/sandboxes/:id/files` — Write File
-{/* Body: { path, content }. */}
+{/* Raw request body is written as file contents. `path` is a required query parameter. */}
### `GET /api/sandboxes/:id/files/list?path=...` — List Directory
@@ -121,7 +135,7 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/files/mkdir` — Create Directory
-{/* Body: { path }. */}
+{/* `path` is a required query parameter. */}
### `DELETE /api/sandboxes/:id/files?path=...` — Remove
@@ -167,7 +181,9 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/preview` — Create
-{/* Body: { port, domain? }. Response: { url }. */}
+{/* Body: { port, domain?, authConfig? }.
+ Response is the full preview object: id, sandboxId, orgId, hostname, optional customHostname, port, sslStatus, authConfig, createdAt, and optional cfHostnameId.
+*/}
### `GET /api/sandboxes/:id/preview` — List
@@ -181,7 +197,9 @@ description: "Complete REST API reference"
### `POST /api/templates` — Build
-{/* Body: { name, dockerfile }. Response: TemplateInfo. */}
+{/* Body: { name, dockerfile, tag? }.
+ Response shape comes from the current template store record. Verify field names from the handler/store before writing the final page.
+*/}
### `GET /api/templates` — List
@@ -199,7 +217,7 @@ description: "Complete REST API reference"
### `POST /api/sandboxes/:id/pty` — Create
-{/* Body: { cols?, rows?, shell? }. Response: { sessionId }. */}
+{/* Body: { cols?, rows?, shell? }. Response uses sessionID casing. */}
### `GET /api/sandboxes/:id/pty/:sessionID` — WebSocket
diff --git a/docs/reference/cli.mdx b/docs/reference/cli.mdx
index 73e2e5ab..73d51afa 100644
--- a/docs/reference/cli.mdx
+++ b/docs/reference/cli.mdx
@@ -31,7 +31,7 @@ description: "Every command, subcommand, and flag"
### `oc sandbox create` / `oc create`
-{/* Flags: --template, --timeout, --cpu, --memory, --env, --metadata. Output: sandbox ID. */}
+{/* Flags: --timeout, --cpu, --memory, --env, --metadata. Output: sandbox ID. */}
### `oc sandbox list` / `oc ls`
@@ -55,12 +55,16 @@ description: "Every command, subcommand, and flag"
### `oc exec <id> -- <command...>`
-{/* Flags: --cwd, --timeout, --env. Exit code passthrough. JSON output: ProcessResult. */}
+{/* Flags: --cwd, --timeout, --env, --wait.
+ Important: plain `oc exec` creates a session. `--wait` uses synchronous exec/run behavior with exit-code passthrough.
+*/}
### `oc exec list <id>`
### `oc exec attach <id> <session-id>`
+{/* Command exists, but the CLI implementation is currently a stub that prints guidance instead of attaching. */}
+
### `oc exec kill <id> <session-id>`
## `oc shell`
diff --git a/docs/reference/python-sdk.mdx b/docs/reference/python-sdk.mdx
index ade4baa8..2c04f25c 100644
--- a/docs/reference/python-sdk.mdx
+++ b/docs/reference/python-sdk.mdx
@@ -16,7 +16,7 @@ description: "Complete Python SDK reference"
- Not available: hibernate/wake, cpuCount/memoryMB, exec streaming, exec.attach, agent resume
- Python-unique: collect_events(), wait(), recv(), context manager
- Include ExecSessionInfo.attachedClients
- - Template class is singular (not Templates)
+ - Template class is singular (not Templates), but verify the public construction story before documenting usage examples
*/}
## Installation
@@ -77,7 +77,7 @@ async with await Sandbox.create() as sandbox:
#### `await sandbox.delete_preview_url(port): None`
-#### `sandbox.close(): None`
+#### `await sandbox.close(): None`
### Not Available in Python
@@ -95,7 +95,7 @@ async with await Sandbox.create() as sandbox:
### `await sandbox.agent.attach(session_id, on_event?, on_error?): AgentSession`
-### `await sandbox.agent.list(): list[dict]`
+### `await sandbox.agent.list(): list[AgentSessionInfo]`
### AgentSession
@@ -111,7 +111,9 @@ async with await Sandbox.create() as sandbox:
### AgentEvent
-{/* Dataclass: type, data. Dict-like access: event['type'], event.get('content'). */}
+{/* Dataclass: type, data. Dict-like access: event['type'], event.get(...).
+ Do not hard-code a single event payload shape; assistant/result/system payloads vary.
+*/}
## Exec
@@ -123,7 +125,7 @@ async with await Sandbox.create() as sandbox:
{/* Returns session ID (string), NOT an ExecSession object. No streaming callbacks. */}
-### `await sandbox.exec.list(): list[dict]`
+### `await sandbox.exec.list(): list[ExecSessionInfo]`
### `await sandbox.exec.kill(session_id, signal?): None`
@@ -149,7 +151,7 @@ async with await Sandbox.create() as sandbox:
### EntryInfo
-{/* name, is_dir, size, mod_time */}
+{/* name, is_dir, path, size */}
## Pty
@@ -162,13 +164,11 @@ async with await Sandbox.create() as sandbox:
## Template
<Note>
- `Template` is a standalone class (singular, not `Templates`). Import: `from opencomputer import Template`.
+ `Template` is a standalone type (singular, not `Templates`), but the current SDK does not expose an obvious public constructor/helper in the same way the other surfaces do. Before publishing examples here, either document the real public entry point or improve the SDK ergonomics and then document that.
</Note>
-### `await Template.build(name, dockerfile, api_key?, api_url?): dict`
-
-### `await Template.list(api_key?, api_url?): list[dict]`
+### Template API
-### `await Template.get(name, api_key?, api_url?): dict`
-
-### `await Template.delete(name, api_key?, api_url?): None`
+{/* Do not publish fictional classmethods like Template.build(...) unless they actually exist.
+ Document the real callable surface or explicitly route readers to the HTTP API until the Python SDK ergonomics are fixed.
+*/}
diff --git a/docs/reference/typescript-sdk.mdx b/docs/reference/typescript-sdk.mdx
index bd63e3ac..f31d5ca0 100644
--- a/docs/reference/typescript-sdk.mdx
+++ b/docs/reference/typescript-sdk.mdx
@@ -159,16 +159,18 @@ import { Sandbox, Templates } from "@opencomputer/sdk";
## Templates
<Note>
- `Templates` is a standalone class (not a Sandbox property). Import: `import { Templates } from "@opencomputer/sdk"`.
+ `Templates` is not a Sandbox property. Document the real public construction pattern: `const templates = new Templates(apiUrl, apiKey)`.
</Note>
-### `Templates.build(name, dockerfile, opts?): Promise<TemplateInfo>`
+### `new Templates(apiUrl, apiKey)`
-### `Templates.list(opts?): Promise<TemplateInfo[]>`
+### `templates.build(name, dockerfile): Promise<TemplateInfo>`
-### `Templates.get(name, opts?): Promise<TemplateInfo>`
+### `templates.list(): Promise<TemplateInfo[]>`
-### `Templates.delete(name, opts?): Promise<void>`
+### `templates.get(name): Promise<TemplateInfo>`
+
+### `templates.delete(name): Promise<void>`
### Types
diff --git a/docs/sandboxes/checkpoints.mdx b/docs/sandboxes/checkpoints.mdx
index ee9e625a..bbde8509 100644
--- a/docs/sandboxes/checkpoints.mdx
+++ b/docs/sandboxes/checkpoints.mdx
@@ -15,11 +15,12 @@ description: "Snapshot and fork sandbox state"
- CheckpointInfo fields differ per surface: TS has sandboxConfig + orgId, HTTP has sizeBytes, Python returns raw dict
- Status: processing → ready (or failed)
- Key difference from hibernation: hibernation resumes SAME sandbox, checkpoints create NEW sandboxes
+ - Avoid "exactly where it left off" wording. Warm restore exists, but fork/restore can fall back to cold boot.
*/}
## 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. */}
+{/* Named snapshot of a running sandbox's state. Fork new sandboxes from it to start from the same saved environment. Like git commits for VMs. Be precise about guarantees: preserved filesystem state and a reproducible starting point, with warm restore when available. */}
## Quick Example
diff --git a/docs/sandboxes/overview.mdx b/docs/sandboxes/overview.mdx
index f7791585..cf9d284c 100644
--- a/docs/sandboxes/overview.mdx
+++ b/docs/sandboxes/overview.mdx
@@ -12,10 +12,11 @@ description: "The compute primitive — full Linux VMs in the cloud"
ABSORBS: sdks/typescript/sandbox.mdx, sdks/python/sandbox.mdx.
KEY NOTES:
- - Python context manager: async with Sandbox.create() as sandbox: (auto-kills on exit)
+ - Python context manager: async with await Sandbox.create() as sandbox: (auto-kills on exit)
- TS-only: cpuCount, memoryMB on create. Python must use HTTP API for custom resources.
- Lifecycle states: running, hibernated, stopped, error
- Rolling timeout resets on every operation, default 300s
+ - Distinguish sandbox guarantees from default-template contents and deployment-specific resource defaults
*/}
## What is a Sandbox
@@ -41,12 +42,9 @@ description: "The compute primitive — full Linux VMs in the cloud"
## 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
+ - Keep this focused on sandbox/runtime guarantees: isolated VM, filesystem, network, lifecycle, configurable resources
+ - Do not hard-code hosted defaults for CPU/memory unless verified against the current hosted deployment
+ - Move package lists (Python, Node, common CLI tools) to the default-template section/page, not the sandbox primitive
*/}
## Creating a Sandbox
@@ -71,9 +69,9 @@ description: "The compute primitive — full Linux VMs in the cloud"
## Hibernation & Wake
-{/* Like closing a laptop lid: memory + disk snapshotted, sandbox ID stays same.
+{/* Like closing a laptop lid: sandbox identity stays the same and the platform attempts a fast snapshot-based resume.
- sandbox.hibernate(), sandbox.wake() — TS SDK
- - Resume in seconds, no cost while hibernated
+ - Usually resumes quickly, 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.
@@ -85,12 +83,14 @@ description: "The compute primitive — full Linux VMs in the cloud"
## Other Methods
-{/* kill(), isRunning()/is_running(), setTimeout()/set_timeout() */}
+{/* kill(), isRunning()/is_running(), setTimeout()/set_timeout()
+ Note: document the SDK normally; reserve the worker-direct hosted API nuance for reference/api.
+*/}
## Properties
{/* sandboxId, agent, exec, files, pty
- Python-specific: async with Sandbox.create() as sandbox: (context manager, auto-kills on exit)
+ Python-specific: async with await Sandbox.create() as sandbox: (context manager, auto-kills on exit)
*/}
## Related
diff --git a/docs/sandboxes/templates.mdx b/docs/sandboxes/templates.mdx
index dad4a4e3..99a88d8a 100644
--- a/docs/sandboxes/templates.mdx
+++ b/docs/sandboxes/templates.mdx
@@ -12,9 +12,12 @@ description: "Pre-built base images for sandboxes"
ABSORBS: sdks/typescript/templates.mdx, sdks/python/templates.mdx.
KEY NOTES:
- - Templates is a standalone class, NOT a Sandbox property
+ - Templates is not a Sandbox property
- TS: Templates (plural), Python: Template (singular)
- - TemplateInfo: templateID/template_id, name, tag, status (building → ready | error)
+ - Do not invent static helper APIs. Document the actual exported construction/usage pattern for each SDK.
+ - Python template ergonomics are currently awkward; if no public construction helper exists, either improve the SDK first or make this section HTTP-first.
+ - Template status depends on template type. Dockerfile builds currently return ready immediately; sandbox-snapshot templates use processing -> ready.
+ - Be explicit about `default` vs legacy `base` naming where relevant
- Default template: derive pre-installed list from Dockerfile.default
*/}
@@ -24,16 +27,18 @@ description: "Pre-built base images for sandboxes"
## Quick Example
-{/* Build template -> create sandbox from it. TS + Python CodeGroup. */}
+{/* Build template -> create sandbox from it.
+ Use real SDK construction only. If Python still lacks a public ergonomic entry point, use HTTP for the primary example and call the SDK gap out explicitly.
+*/}
<CodeGroup>
```typescript TypeScript
-// TODO: Templates.build('my-env', dockerfile) -> Sandbox.create({ template: 'my-env' })
+// TODO: use the real exported Templates construction pattern, then build/list/get/delete from that instance
```
```python Python
-# TODO: Template.build('my-env', dockerfile) -> Sandbox.create(template='my-env')
+# TODO: only add a Python SDK example if there is a public construction path worth documenting; otherwise use HTTP and note the SDK ergonomics gap
```
</CodeGroup>
@@ -50,19 +55,23 @@ description: "Pre-built base images for sandboxes"
### Build Template
-{/* templates.build(name, dockerfile) / Template.build(name, dockerfile). ParamField. */}
+{/* Document the real SDK invocation pattern and the HTTP API.
+ Do not publish fictional static helpers if the SDK requires an instance.
+*/}
### List Templates
-{/* templates.list() / Template.list(). Returns TemplateInfo[]. */}
+{/* Document the real SDK callable surface for listing templates plus the HTTP API.
+ Avoid implying Python classmethods if the SDK does not expose them.
+*/}
### Get Template
-{/* templates.get(name) / Template.get(name). */}
+{/* Document the real SDK callable surface for fetching a template plus the HTTP API. */}
### Delete Template
-{/* templates.delete(name) / Template.delete(name). */}
+{/* Document the real SDK callable surface for deleting a template plus the HTTP API. */}
### Using with Sandbox.create
@@ -70,8 +79,8 @@ description: "Pre-built base images for sandboxes"
## TemplateInfo
-{/* Fields: templateID/template_id, name, tag, status.
- Status: building -> ready (or error).
+{/* Fields: verify against the current handler/SDK mapping before writing the final page.
+ Status is not one universal enum across all template creation flows.
*/}
## Example
diff --git a/docs/sandboxes/working-with-files.mdx b/docs/sandboxes/working-with-files.mdx
index 866e877e..df155dd5 100644
--- a/docs/sandboxes/working-with-files.mdx
+++ b/docs/sandboxes/working-with-files.mdx
@@ -12,7 +12,7 @@ description: "Read, write, and manage files inside a sandbox"
KEY NOTES:
- Current structure is already good — merge TS/Python into CodeGroups and ensure consistency.
- - exists() is a client-side SDK wrapper (HEAD request), not a separate HTTP endpoint.
+ - exists() is a client-side SDK wrapper built on a normal file read request, not a separate HTTP endpoint.
*/}
## Reading Files
@@ -33,7 +33,9 @@ description: "Read, write, and manage files inside a sandbox"
### EntryInfo
-{/* Table: name, isDir/is_dir, size, modTime/mod_time */}
+{/* Table: name, isDir/is_dir, path, size.
+ Do not document modTime/mod_time on EntryInfo unless the SDK starts returning it.
+*/}
## Managing Files
@@ -49,7 +51,7 @@ description: "Read, write, and manage files inside a sandbox"
### Check Existence
-{/* sandbox.files.exists(path) — client-side wrapper (HEAD request). Both SDKs. */}
+{/* sandbox.files.exists(path) — client-side convenience wrapper, not a dedicated HTTP endpoint. Both SDKs. */}
## Examples