An open-source, faster Devin alternative
TypeScript
docs: skeleton for OSS self-hosting docs (#1024)
opencomputer-app[bot]7c64a014b137
diff --git a/docs/api/asks.mdx b/docs/api/asks.mdxnew file mode 100644index 00000000..61e6c9fe--- /dev/null+++ b/docs/api/asks.mdx@@ -0,0 +1,79 @@+---+title: "Asks"+description: "An ask is an approval or question the agent waits on; while open it keeps the session `waiting`, and it never expires"+---++The Slack side is in [Approvals, questions and plans](/slack/approvals-questions-plans). An ask's id is `ak_` followed by 12 characters.++| `kind` | Body | Answer |+| --- | --- | --- |+| `approval` | `approval` | `{"decision": "allow" \| "deny" \| "always", "message"?, "mode"?}` |+| `question` | `question.questions` | `{"answers": [{"questionId", "choices", "text"}]}` |+| `secret` | `secret` | None: `asks.answer` returns `400 answer_with_secret` |++The runner opens `approval` and `question` asks only. Body fields: [API schema](/reference/api-schema#objects).++## Status++The first close wins.++| `status` | Closed by |+| --- | --- |+| `open` | Not closed |+| `answered` | An answer, from Slack or the API |+| `dismissed` | `asks.dismiss` |+| `declined` | A message steered into the turn. `answer` is `{message, messageSeq}`; `messageSeq` is the `seq` of the message's `message.received` event |+| `interrupted` | An interrupt, a suspend, or the runner ending |++`closedBy` is the actor and `closedAt` the time. A message sent with `ifBusy: "queue"` leaves asks open; see [Turns](/api/turns#send).++## Find open asks++| Source | What it gives |+| --- | --- |+| `Session` object | Open asks in its `asks` list |+| `ask.opened` event | The whole ask |+| `asks.get` (`GET /sessions/{id}/asks/{askId}`) | One ask |+| `asks.list` (`GET /sessions/{id}/asks`) | Asks, newest first |++`asks.list` params:++| Param | Meaning |+| --- | --- |+| `status` | One status, several separated by commas, or `all`. Default `open` |+| `limit` | 1 to 100. Default 20 |+| `cursor` | The previous page's `nextCursor`. A cursor from a listing with another `status` is `invalid_cursor` |++## Answer++`asks.answer` (`POST /sessions/{id}/asks/{askId}/answer`) closes the ask with an answer. Over HTTP the request body is the answer itself. It needs the `asks:answer` scope, as does `asks.dismiss`.++```json+{"jsonrpc":"2.0","id":4,"method":"asks.answer","params":{"sessionId":"cs_0123456789abcdef","askId":"ak_0123456789ab","answer":{"decision":"allow"}}}+```++```json+{"jsonrpc":"2.0","id":5,"method":"asks.answer","params":{"sessionId":"cs_0123456789abcdef","askId":"ak_0123456789ab","answer":{"answers":[{"questionId":"q1","choices":["Postgres"],"text":null}]}}}+```++The result is the closed ask and the `seq` of its `ask.closed` event. The prompt message in Slack is deleted or updated, naming who answered.++| Answer field | Rule |+| --- | --- |+| `decision` | Required on an approval |+| `always` | Only when the ask's `approval.alwaysAllows` is set |+| `mode` | Only on a plan approval (`toolName` is `ExitPlanMode`) with `allow`. Sets the mode after the plan: `default`, `acceptEdits`, `auto` or `bypassPermissions` |+| `answers` | Required on a question, one per question, each with a choice or `text` |+| `choices` | Each is the `label` of one of the question's options; more than one only when `multiSelect` is true |++| Error | Cause |+| --- | --- |+| `400 invalid_answer` | A rule above is broken. `field` names the field at fault |+| `400 answer_with_secret` | The ask's `kind` is `secret` |+| `409 ask_closed` | The ask is closed. The error carries the ask. The same answer from the same person returns the ask instead |++## Dismiss++`asks.dismiss` (`POST /sessions/{id}/asks/{askId}/dismiss`) closes an ask with no answer; the agent reads it as a denial. An optional `message` (up to 2,000 characters) is passed along.++{/* Sources: computer/schema/computer-api.v1.json (Ask, ApprovalAnswer, QuestionAnswer, DeclineAnswer, asks.*); computer/src/runner/api/asks.ts (close rules, invalid(), PLAN_EXIT_MODES, AskSpec kinds); computer/src/runner/api/api.ts; computer/src/runner/api/tap.ts (waiting status); computer/src/api/read-methods.ts (asks.list paging); computer/src/host/session-writer.ts; computer/src/wire/edge-auth.ts (scope) */}diff --git a/docs/api/cli.mdx b/docs/api/cli.mdxnew file mode 100644index 00000000..59ecd1f9--- /dev/null+++ b/docs/api/cli.mdx@@ -0,0 +1,141 @@+---+title: "opc CLI"+description: "`opc` is the Computer API's command-line client: one Rust binary from `diggerhq/opc` (Apache-2.0)"+---++Releases before 0.1.0 are prereleases. `opc --version` prints the protocol (`opc.v1`) and schema (`computer-api.v1`) it speaks.++## Install++```bash+curl -fsSL https://raw.githubusercontent.com/diggerhq/opc/main/ci/install.sh | sh+```++The script verifies the release's checksum and installs to `~/.local/bin/opc`, without `sudo` and without editing shell startup files. Run it again to update. Supported: macOS, Linux, and Windows under WSL 2.++| Variable | Effect |+| --- | --- |+| `OPC_INSTALL_DIR` | Install directory instead of `~/.local/bin` |+| `OPC_VERSION` | Install this release tag. Without it: the latest release, or the newest prerelease while there is no full release |++The macOS builds are not signed. If macOS blocks the first run:++```bash+xattr -d com.apple.quarantine ~/.local/bin/opc+```++From source (Rust 1.89 or later):++```bash+cargo build --release --locked+```++## Authentication++| Command | Does |+| --- | --- |+| `opc login` | Opens the browser to approve a device code and exchanges it for an API key. `--no-browser` prints the link. Running `opc` with no credential starts the same login |+| `opc logout` | Revokes the credential and clears it from the file |+| `opc whoami` | Shows who the credential belongs to |++`opc` stores the key in `~/.opencomputer/config.json` (mode `0600`) with the API URL it was issued for:++```json+{"apiUrl": "...", "apiKey": "...", "login": {"credentialId": "...", "keyPrefix": "...", "name": "..."}}+```++`OPENCOMPUTER_API_KEY` overrides the file (for scripts and CI). The key in the file is used only when the file's `apiUrl` matches the API URL in use.++## Endpoint configuration++| Variable | Meaning |+| --- | --- |+| `OPENCOMPUTER_API_URL` | The API's base URL. Overrides `apiUrl` in the configuration file. Default: the hosted service |+| `OPC_WIRE_URL` | The WebSocket URL. Without it, and with a non-default API URL, `opc` reads `computer.wireUrl` from `GET /me` |+| `OPENCOMPUTER_CONFIG` | Path of the configuration file |+| `OPC_STATE_DIR` | Where `opc` keeps its state (last session, cached session list and events). Default `~/.opencomputer/opc` |+| `OPC_LOG` | `error`, `warn` (default), `info` or `debug`. Logs go to standard error |+| `OPC_NOTIFY=0` | No notifications |+| `OPC_TELEMETRY=0` | Same as `opc config telemetry off` |+| `NO_COLOR` | Non-empty: no colors |+| `HTTPS_PROXY`, `NO_PROXY` | The proxy for connections, and the hosts that bypass it |++| API URL rule | Detail |+| --- | --- |+| Scheme | `https`. `http` only for `localhost`, `127.0.0.1`, `::1` and `*.localhost` |+| Trailing `/` or `/api` | Removed |+| API requests | Sent under `<API URL>/api/managed-agents/computer` |+| Login requests | Sent to `<API URL>/auth/cli/...` |++`opc` uses HTTP for single reads and writes, and the WebSocket to follow a session live (the interactive screen, `attach`, `watch`, `wait`) and for `shell`.++## Commands++A session argument is an id, a prefix of one, `-` for the last session used on this machine, or a Slack thread link.++| Command | Purpose |+| --- | --- |+| `opc [message]` | Log in if needed, then open the interactive session screen. With `-s <session>`, in that session |+| `opc -p <message>` | Non-interactive: send the message, wait for the turn, print the result |+| `opc new` | Create a session, send a message, return at once |+| `opc attach` (`a`) | Attach to a session. `--read-only`, `--history N`, `--no-history` |+| `opc list` (`ls`) | List sessions. `--status`, `--metadata`, `--archived`, `--limit`, `--long`, `--json` |+| `opc log` | Print a session's history and exit. `--details`, `--after`, `--turn`, `--types` |+| `opc send` | Send a message and return when it is accepted. `--wait` waits for the turn |+| `opc wait` | Wait for a session, a turn, or several. `--turn`, `--any`, `--all` |+| `opc watch` | Print a session's activity until it is idle or waiting. `--after`, `--from-start`, `--follow` |+| `opc interrupt` | Interrupt the running turn and cancel queued ones. `--no-wait` |+| `opc ask ls` | List asks |+| `opc ask allow`, `deny`, `always` | Answer an approval. `-m` adds a message, `--mode` sets the mode after a plan |+| `opc ask answer` | Answer a question. `--choice`, `--text` |+| `opc ask dismiss` | Dismiss an ask |+| `opc subagents ls`, `stop`, `result` | List, stop and read a session's subagents |+| `opc rename` | Set a session's title |+| `opc archive`, `opc unarchive` | Archive a session, or bring it back |+| `opc open` | Open the session on the dashboard |+| `opc diff` | Print the agent's changes as a git diff. `--stat` |+| `opc push` | Copy a local directory into a session's workspace. `--to`, `--no-ignore`, `--dry-run` |+| `opc pull` | Copy a directory or file from a session's workspace. `--force`, `--dry-run` |+| `opc shell` | Open a shell in a session's workspace. `-c` runs one command, `--no-tty` |+| `opc login`, `logout`, `whoami` | Manage the credential |+| `opc doctor` | Check each link on the path to the computer, stopping at the first that fails |+| `opc schema [object]` | Print the JSON Schema of `result`, `event`, `session`, `turn`, `ask`, `subagent` or `error` |+| `opc config telemetry [on\|off]` | Show or set telemetry |+| `opc completion bash\|zsh\|fish` | Print a shell completion script |+| `opc help [topic]` | Help |++## Send options++For `opc [message]`, `opc -p` and, where they apply, `opc new` and `opc send`.++| Option | Effect |+| --- | --- |+| `-s`, `--session` | The session to use instead of a new one |+| `--queue`, `--steer`, `--interrupt` | What to do when the session is busy: the `ifBusy` value of [turns.send](/api/turns#send) |+| `--model`, `--effort`, `--speed`, `--mode`, `--title`, `--metadata K=V` | Settings of the new session. Refused with `-s` |+| `--push DIR` | Upload a directory to the new session's workspace first |+| `--idempotency-key` | The key sent with the write |+| `--output-format text\|json\|stream-json`, `--json` | With `-p`: the final text, one `Result` object, or one JSON line per event |+| `--include-partial-messages` | With `stream-json`: also print deltas |+| `--on-ask fail\|dismiss\|wait` | With `-p`, when an ask opens: exit 5, dismiss it, or wait for a person |+| `--timeout` | Give up after this long, exit 124. `--interrupt-on-timeout` also interrupts the turn |+| `--interrupt-on-exit` | With `-p`: interrupt the turn whenever `opc` exits before it ends |+| `--wait-subagents` | Also wait for the background subagents the turn launched |++Global options: `--timing`, `--no-color`, `-q`/`--quiet`, `-v`/`--verbose`.++## Exit codes++| Code | Meaning |+| --- | --- |+| 0 | Done |+| 1 | The turn failed or was cancelled |+| 2 | Usage error, or the server no longer supports this version's protocol |+| 3 | Not logged in, or no access |+| 4 | Unreachable or busy: retry |+| 5 | Waiting for a person (an ask is open) |+| 6 | Out of credits |+| 124 | Timed out |+| 130 | Interrupted |++{/* Sources: opc/README.md; opc/ci/install.sh; opc/src/cli.rs (subcommands, options, doc comments); opc/src/config.rs (config file, OPENCOMPUTER_API_URL, OPENCOMPUTER_API_KEY, OPC_WIRE_URL, API_PREFIX, https rule); opc/src/http.rs; opc/src/wire/client.rs; opc/src/error.rs (exit codes); opc/src/net.rs (proxy); opc/src/log.rs; opc/src/cmd/mod.rs (NO_COLOR, wire URL); opc/src/cmd/run.rs; opc/src/cmd/auth.rs, doctor.rs, help.rs, push.rs, pull.rs, follow.rs; opc/docs/install.mdx; opc/docs/reference/environment.mdx; work doc 099 section 4 */}diff --git a/docs/api/events.mdx b/docs/api/events.mdxnew file mode 100644index 00000000..5dcf8d35--- /dev/null+++ b/docs/api/events.mdx@@ -0,0 +1,92 @@+---+title: "Events"+description: "A session's events are numbered by `seq` from 1 with no gaps; read them over HTTP or follow them live over WebSocket"+---++```json+{"id":"ev_0123456789abcdef","seq":412,"createdAt":"2026-01-01T12:00:00.000Z","sessionId":"cs_0123456789abcdef","turnId":"tn_0123456789ab","actor":{"id":"usr_...","name":"Ada","via":"opc","client":"opc/0.1.0"},"type":"message.received","data":{"input":"Add a test for the empty case","ifBusy":"steer","delivery":"steered","interruptedTurnIds":[],"declinedAskIds":[]}}+```++`actor` is who caused the event (`via` is `slack`, `opc`, `dashboard` or `api`), or null. Event types and their `data` fields: [API schema](/reference/api-schema#events). A client must ignore types it does not know.++## Read a range++`events.list` (`GET /sessions/{id}/events`) returns events in `seq` order. To follow a session over HTTP, loop on it with `after` and `waitMs`.++```+GET /sessions/cs_0123456789abcdef/events?after=400&limit=100&types=turn.*,ask.opened+```++| Param | Meaning |+| --- | --- |+| `after` | Return events with `seq` greater than this. Default 0, the start of the journal |+| `limit` | 1 to 500 events. Default 100 |+| `tailTurns` | Start at the last 1 to 50 turns instead; `earlierTurns` in the result holds the turns before them. Cannot be combined with `after` |+| `turnId` | Only events of this turn |+| `types` | A comma-separated list of types. A trailing `*` matches a prefix |+| `waitMs` | When there is nothing after `after`, wait up to this long (at most 60,000) for an event |++The result is `events`, `earlierTurns`, `lastSeq` (the journal's last `seq`) and `hasMore`.++| `hasMore` | Next `after` |+| --- | --- |+| true | The `seq` of the last event returned |+| false | `lastSeq`. With a filter, the page may be shorter than the range it covered |++| Error | Cause |+| --- | --- |+| `409 cursor_ahead` | `after` is beyond the journal's last `seq`: the journal's epoch changed. See [Session journal](/api/overview#session-journal) |++## Follow live++[Attach](/api/sessions#attach) over WebSocket. Each event arrives as an `event` notification whose `params` is the event:++```json+{"jsonrpc":"2.0","method":"event","params":{"id":"ev_...","seq":413,"type":"turn.steered","...":"..."}}+```++Order on one connection:++- Events of a session arrive in `seq` order, each once.+- The response to `sessions.attach` arrives before any replayed event.+- The response to a write arrives before any event of that session the write caused.++When the whole connection closes, reconnect and attach with `after` set to the last `seq` processed. A runner starting or stopping does not interrupt the subscription.++| Error | Cause | What to do |+| --- | --- | --- |+| `too_far_behind` | Attach with `after` more than 10,000 events behind | Read the gap with `events.list` first, or attach with `tailTurns` |++### Acknowledge++Send `sessions.ack` notifications as events are processed:++```json+{"jsonrpc":"2.0","method":"sessions.ack","params":{"sessionId":"cs_0123456789abcdef","seq":413}}+```++The backlog of a session is its events not yet sent or, once the client has sent an ack, not yet acknowledged. When it passes 10,000 events or 8 MiB, the server detaches that session with `too_far_behind`.++### Deltas++An attach with `deltas: true` also receives `delta` notifications. Types: [API schema](/reference/api-schema#deltas).++| Property | Detail |+| --- | --- |+| Content | Message and reasoning text as it is written, a tool call being prepared and its output, compaction, subagent progress |+| Storage | No `seq`, not stored, not replayed |+| Completeness | Each block of deltas is followed by an event with the whole text (`message.completed`, `reasoning.completed`, `tool.completed`). A client may ignore deltas |+| Backlog | Sent only to a subscription that has been sent every event. Deltas of one block that wait are merged |++### Detached++When the server ends a subscription it sends `session.detached` with a `reason`:++| `reason` | Cause | What to do |+| --- | --- | --- |+| `too_far_behind` | The backlog passed its limit | Attach again with `after` set to the last `seq` processed |+| `access_lost` | The member no longer has access to the session | Nothing |+| `epoch_changed` | The journal was rebuilt. The notification carries the new `logEpoch` and `epochStartSeq` | Discard events from `epochStartSeq` on and attach with `after` set to `epochStartSeq - 1` |+| `unavailable` | The session's writer could not be reached | Attach again later |++{/* Sources: computer/schema/computer-api.v1.json (Event, Delta, events.list, notifications); computer/src/api/read-methods.ts (eventsList, typeFilter); computer/src/api/hub.ts (backlog, too_far_behind, cursor_ahead, deltas to caught-up subscribers); computer/src/wire/attachment.ts (order, rewire, detach reasons); computer/src/wire/connection.ts (sessions.ack); computer/src/wire/limits.ts; computer/src/api/schema-events.ts (DELTA_DATA); computer/src/api/schema-objects.ts (Actor) */}diff --git a/docs/api/files.mdx b/docs/api/files.mdxnew file mode 100644index 00000000..872c422e--- /dev/null+++ b/docs/api/files.mdx@@ -0,0 +1,86 @@+---+title: "Files"+description: "File routes act on one session's workspace over HTTP only, as the agent's Unix user; directories move as tar archives"+---++The relay serves the file routes. `opc push` and `opc pull` are clients for upload and download.++| Operation | Relay route | API route | Scope |+| --- | --- | --- | --- |+| List | `GET /files/{id}/files` | `GET /sessions/{id}/workspace/files` | `sessions:read` |+| Read one file | `GET /files/{id}/file` | `GET /sessions/{id}/workspace/file` | `sessions:read` |+| Download an archive | `GET /files/{id}/archive` | `GET /sessions/{id}/workspace/archive` | `sessions:read` |+| Upload an archive | `PUT /files/{id}/archive` | `PUT /sessions/{id}/workspace/archive` | `sessions:write` |++Every `path` is relative to the workspace. Errors are JSON, `{"error": {...}}`.++| Error | Cause |+| --- | --- |+| `404 session_not_found` | The member has no access to the session |+| `400 invalid_path` | An absolute path, a `..` segment, or a path that resolves outside the workspace through a symlink |+| `404 path_not_found` | The path does not exist |++## List++```+GET /files/cs_0123456789abcdef/files?path=myrepo/src&depth=2&limit=100+```++`depth` is 1 to 10 and `limit` 1 to 100. The result is `path`, `entries` and `nextCursor`; pass `nextCursor` back as `cursor`. Each entry has:++| Field | Meaning |+| --- | --- |+| `path` | Relative to the workspace |+| `type` | `file`, `dir` or `symlink` |+| `bytes` | Size, or null |+| `modifiedAt` | Modification time |+| `pushedAt`, `pushedBy` | On an uploaded top-level directory: when and by whom |++## Read one file++`GET /files/{id}/file?path=<file>` returns the bytes with `Content-Type`, `Content-Length` and an `ETag`.++| Case | Result |+| --- | --- |+| `If-None-Match` equals the `ETag` | `304` |+| File over 100 MiB | `413 too_large`. Download it in an archive |++## Download an archive++`GET /files/{id}/archive?path=<directory or file>` streams a tar archive (`application/x-tar`). With `Accept-Encoding: zstd` or `gzip` the stream is compressed and `Content-Encoding` says how; zstd is preferred when both are offered.++## Upload an archive++`PUT /files/{id}/archive?path=<name>` with a tar stream as the body unpacks the archive as one directory named `name` at the top of the workspace, beside the repositories.++```bash+tar -cf - -C ./fixtures . | zstd | curl -X PUT \+ -H "Content-Encoding: zstd" -H "Idempotency-Key: fixtures-1" \+ --data-binary @- "$BASE/files/cs_0123456789abcdef/archive?path=fixtures"+```++The example leaves out [authentication](/api/overview#authentication).++| Item | Rule |+| --- | --- |+| `name` | One path level: letters, digits, `.`, `-` and `_`, up to 255 characters, not starting with `.` |+| `Content-Encoding` | `zstd`, `gzip` or absent |+| `name` uploaded before | Replaced |+| `Idempotency-Key` repeated by the same member to the same session | The first response, without reading the body. The relay keeps keys 24 hours in memory; a relay restart forgets them |++The response is `{"upload": {"path", "files", "bytes", "replaced"}, "seq"}`.++| Field | Meaning |+| --- | --- |+| `replaced` | Null, or the `pushedAt` and `pushedBy` of the upload it replaced |+| `seq` | That of the `files.pushed` event the upload records. In the event, `replaced` is a boolean |++A failed upload changes nothing.++| Error | Cause |+| --- | --- |+| `400 invalid_archive` | Absolute paths, `..` segments, hard links, device files, FIFOs, a symlink that points outside the archive, an entry beneath a symlink the archive created, or a body that is not tar |+| `413 too_large` | More than 1 GiB of file content or 100,000 entries |+| `409 path_exists` | `name` exists and was not created by an upload |++{/* Sources: computer/src/wire/files.ts (routes, parameters, encodings, ETag, idempotency, UPLOAD_NAME); computer/src/host/workspace-files.ts (path rules, ListEntry, Upload, path_exists, rename into place, runner user, FILE_MAX_BYTES); computer/src/host/tar-check.ts (invalid_archive, too_large); computer/src/host/wire-link.ts (files.pushed, upload result); computer/src/wire/limits.ts; computer/src/wire/edge-auth.ts (scopes); opc/src/cmd/push.rs and pull.rs (workspace/archive routes) */}diff --git a/docs/api/overview.mdx b/docs/api/overview.mdxnew file mode 100644index 00000000..03d7cca8--- /dev/null+++ b/docs/api/overview.mdx@@ -0,0 +1,103 @@+---+title: "Overview"+description: "The Computer API drives the same sessions as Slack threads, over WebSocket (JSON-RPC 2.0) and HTTP"+---++The schema is `computer/schema/computer-api.v1.json`; [API schema](/reference/api-schema) lists its operations, objects, events and errors. The relay, a process on the computer (`SP_WIRE_LISTEN`, default `127.0.0.1:7071`), serves the WebSocket and the workspace file routes. The client is the [opc CLI](/api/cli).++## Transport++| Transport | Operations |+| --- | --- |+| WebSocket and HTTP | Everything not listed below, with the same parameters, result and errors |+| WebSocket only | `sessions.attach` (live events), terminals |+| HTTP only | Creating and listing sessions, workspace files |++### WebSocket++Open `/connect` with the subprotocol `opc.v1` (without it: close `4400`). Messages are JSON-RPC 2.0 text frames; binary frames carry terminal data.++The server's first frame:++```json+{"jsonrpc":"2.0","method":"ready","params":{"connectionId":"...","server":{"version":"...","region":null},"protocol":{"features":[]},"limits":{"maxAttached":20,"maxMessageBytes":1048576,"maxRequestsPerSecond":100},"expiresAt":null,"expiresInMs":null}}+```++A request and its response:++```json+{"jsonrpc":"2.0","id":1,"method":"sessions.get","params":{"sessionId":"cs_0123456789abcdef"}}+{"jsonrpc":"2.0","id":1,"result":{"session":{"id":"cs_0123456789abcdef","status":"idle","...":"..."}}}+```++Batches are not supported. Close codes and relay limits: [API schema](/reference/api-schema#websocket-close-codes).++### HTTP++Routes are in the schema's `x-methods` map, for example `POST /sessions/{id}/turns` for `turns.send`. Path parameters replace the id fields of the method's params. `opc` sends them under `/api/managed-agents/computer` of its API URL.++## Authentication++| Layer | Credential |+| --- | --- |+| Hosted service | An API key in the `x-api-key` header, on HTTP requests and the WebSocket upgrade. `opc login` obtains it |+| Relay | `X-Wire-*` headers signed with a key from the host, each signature valid 30 seconds. The relay does not check API keys: whatever fronts it verifies the key and signs the headers |++### Scopes++A credential without a scope list has every scope.++| Scope | Operations |+| --- | --- |+| `sessions:read` | `sessions.attach`, `sessions.get`, `turns.get`, `events.list`, `asks.list`, `asks.get`, `subagents.list`, `subagents.get`, `subagents.stop`, file listing and download |+| `sessions:write` | `turns.send`, `turns.cancel`, `sessions.update`, `sessions.interrupt`, `sessions.compact`, `sessions.suspend`, `sessions.resume`, file upload |+| `asks:answer` | `asks.answer`, `asks.dismiss` |+| `terminals` | `terminals.open`, `terminals.resize`, `terminals.eof`, `terminals.close` |++A scope may also name sessions (`sessionIds`), be read-only (`readOnly`) and expire (`until`).++| Case | Result |+| --- | --- |+| Scope missing | `forbidden`, `reason: "missing_scope"` |+| Credential expired or revoked | Its connections close with `4001` |+| Caller is not the session's owner and not on its member list | `session_not_found` on every operation. A null member list means the whole organization |+| Terminal opened by someone other than the owner or an admin | `forbidden`, `reason: "terminal_owner_only"` |++## Session journal++Every state change in a session is an event with a `seq`, an integer from 1 that increases by one. `Session`, `Turn`, `Ask` and `Subagent` objects are computed from the events. Reads and most writes work on a suspended session.++| Need | How |+| --- | --- |+| Read your own write | A write returns the `seq` of its event. A read with `minSeq` waits up to 2 seconds for the journal to reach it, then fails with `unavailable` |+| Resume | Ask for events `after` the last `seq` processed. See [Events](/api/events) |+| New epoch (`logEpoch`, `epochStartSeq`: the journal was rebuilt) | Discard held events from `epochStartSeq` on and read again from `epochStartSeq - 1` |++## Idempotency keys++Every write takes an `idempotencyKey` of 1 to 255 characters; over HTTP `opc` sends it as the `Idempotency-Key` header. A key is scoped to one member and one operation, shared by the operation's WebSocket method and HTTP route, and kept 24 hours.++| Repeat | Result |+| --- | --- |+| Same key, same parameters | The first result, with its objects re-read at their current state, and `duplicate: true` where the result has that field |+| Same key, different parameters | `409 idempotency_conflict` |+| Same key while the first is in flight | Waits for the first |+| After the first failed | Runs again |++## Errors++Over WebSocket an API error is JSON-RPC error `-32000` whose `data` is the error body; over HTTP it is `{"error": {...}}` with the matching status.++```json+{"jsonrpc":"2.0","id":7,"error":{"code":-32000,"message":"at most 20 turns may wait","data":{"code":"queue_full","message":"at most 20 turns may wait","status":409,"retryable":true,"retryAfterMs":5000,"requestId":"req_..."}}}+```++| Field | Meaning |+| --- | --- |+| `retryable` | True for `rate_limited`, `unavailable`, `computer_unavailable`, `internal` and `queue_full` |+| `retryAfterMs` | How long to wait, when the server knows |+| `field` | The parameter at fault. An unknown parameter is `invalid_request` |++All codes: [API schema](/reference/api-schema#errors).++{/* Sources: computer/schema/computer-api.v1.json; computer/src/protocol-api.ts; computer/src/wire/main.ts, relay.ts, connection.ts, rpc.ts, limits.ts, edge-auth.ts, files.ts; computer/src/signed-header.ts; computer/src/api/read-methods.ts (minSeq wait, idempotency); computer/src/api/journal.ts (IDEM_TTL_MS); computer/src/host/session-writer.ts; computer/src/runner/api/api.ts; computer/src/gateway/*.ts (no API id or relay key); opc/src/config.rs (API_PREFIX, OPENCOMPUTER_API_URL); opc/src/http.rs and opc/src/wire/client.rs (x-api-key, opc.v1); opc/src/cmd/auth.rs; work doc 099 section 4 */}diff --git a/docs/api/sessions.mdx b/docs/api/sessions.mdxnew file mode 100644index 00000000..8ef66464--- /dev/null+++ b/docs/api/sessions.mdx@@ -0,0 +1,99 @@+---+title: "Sessions"+description: "A suspended session has no runner but still answers reads and records writes; `sessions.resume` or sending a turn starts it again"+---++A session id is `cs_` followed by 16 characters. Fields of the `Session` object: [API schema](/reference/api-schema#objects).++## Status++| `status` | Meaning |+| --- | --- |+| `starting` | The runtime is starting. `runtime.starting` events give the phase: `computer`, then `agent` |+| `running` | A turn is running |+| `waiting` | An ask is open |+| `idle` | No turn is running |+| `suspended` | No runner holds the session. The host answers reads and records writes |++Each change is a `session.status_changed` event with `from` and `to`.++## Create and list++HTTP only: `POST /sessions` with a `CreateSessionBody`, and `GET /sessions`.++```json+{"input":"Run the test suite and fix what fails","title":"Fix tests","mode":"acceptEdits","metadata":{"ticket":"ENG-123"}}+```++Every field is optional ([API schema](/reference/api-schema#operations)). `id` is a session id chosen by the client; `input` is the first message. Accepted values for `model`, `effort`, `speed` and `mode` are in the session's `capabilities`.++## Read++`sessions.get` (`GET /sessions/{id}`) returns the `Session`, including the active turn id, queued turns, open asks, running subagents and `lastSeq`. `minSeq` waits for the journal: [Session journal](/api/overview#session-journal).++## Attach++`sessions.attach` (WebSocket only) subscribes the connection to the session's events. It returns the session and its `capabilities`: models with their effort levels, permission modes, and features.++```json+{"jsonrpc":"2.0","id":1,"method":"sessions.attach","params":{"sessionId":"cs_0123456789abcdef","tailTurns":3,"deltas":true}}+```++| Param | Meaning |+| --- | --- |+| `after` | Replay events with `seq` greater than this, then follow live |+| `tailTurns` | Replay the last 1 to 50 turns instead. `earlierTurns` in the result holds the turns before them |+| Neither | Live events only |+| `deltas` | Also send `delta` notifications (text as it is written) |+| `resume` | Start the runtime if the session is suspended |+| `readOnly` | Refuse writes to this session on this connection (`forbidden`, `reason: "read_only"`) |++| Related | Use |+| --- | --- |+| `/connect?attach=<sessionId>&tailTurns=3&deltas=1` | Attaches in the connection URL. The server answers with a `sessions.attached` notification carrying the same fields, or an `error` |+| `sessions.detach` | Ends the subscription |++| Error | Cause |+| --- | --- |+| `too_many_attached` | The connection already holds 20 attached sessions |+| `too_far_behind` | See [Events](/api/events) |++## Update++`sessions.update` (`PATCH /sessions/{id}`) changes any of `title`, `model`, `effort`, `speed`, `mode`, `archived` and `metadata`. It returns the session and a `seq`.++```json+{"jsonrpc":"2.0","id":2,"method":"sessions.update","params":{"sessionId":"cs_0123456789abcdef","mode":"plan","metadata":{"ticket":"ENG-124"}}}+```++| Item | Rule |+| --- | --- |+| `metadata` | Keys (up to 40 characters) are merged one by one. Values are strings of up to 500 characters, or null |+| `session.updated` event | `changes` maps each changed field to `{from, to}`. A metadata key is `metadata.<key>` |+| Model the harness does not accept | `invalid_request` with `field: "model"`. The session stays on its model |++## Compact++`sessions.compact` (`POST /sessions/{id}/compact`) queues a compaction as a turn and returns the same result as `turns.send`.++`instructions` (up to 10,000 characters) is passed to the harness's `/compact` command. The `session.compacted` event gives `beforeTokens`, `afterTokens` and `auto` (true when the harness compacted on its own). See Context and compaction.++## Suspend++`sessions.suspend` (`POST /sessions/{id}/suspend`) stops the session's runner. The journal and workspace stay on the computer.++| State when called | Result |+| --- | --- |+| Idle | Suspends |+| A turn is waiting on an ask | The turn is interrupted, then the session suspends |+| A turn is running and no ask is open | `409 session_busy`. Interrupt first |+| `ifIdle: true` and the session is not idle, or has running subagents or queued turns | The session, unchanged |+| Already suspended | The session, unchanged |++Suspending cancels queued turns, stops running subagents, closes open asks as `interrupted`, and records `runtime.suspended` with `reason: "requested"`. The other reasons are `idle` and `lost`.++## Resume++`sessions.resume` (`POST /sessions/{id}/resume`) starts the runtime of a suspended session and returns at once; `runtime.starting` and `runtime.connected` events follow. On a session that is not suspended it returns the session unchanged. [Sending a turn](/api/turns#send) to a suspended session also starts it.++{/* Sources: computer/schema/computer-api.v1.json (Session, CreateSessionBody, AttachResult, methods); computer/src/api/schema-methods.ts; computer/src/api/read-methods.ts; computer/src/runner/api/api.ts (update, compact, suspend handlers); computer/src/host/session-writer.ts (suspend, resume, queued send while suspended); computer/src/wire/connection.ts and attachment.ts (attach, URL attach, read-only); computer/src/wire/limits.ts; opc/src/cmd (POST /sessions, GET /sessions) */}diff --git a/docs/api/subagents.mdx b/docs/api/subagents.mdxnew file mode 100644index 00000000..c0a845d0--- /dev/null+++ b/docs/api/subagents.mdx@@ -0,0 +1,40 @@+---+title: "Subagents"+description: "A subagent is an agent the session's harness launches for part of a task; one with `background: true` can outlive its turn"+---++The Slack side is in [Subagents](/slack/subagents). A subagent's id is `sa_` followed by 12 characters. Fields of the `Subagent` object: [API schema](/reference/api-schema#objects).++## Events++| Source | What it gives |+| --- | --- |+| `subagent.started`, `subagent.ended` | The whole object. In events and lists a long `result` is cut and `resultTruncated` is true |+| `tool.started`, `tool.completed`, `tool.failed` with `subagentId` set | Tool calls made inside the subagent |+| `subagent.progress` [deltas](/api/events#deltas) | `activity`, `toolCalls` and `tokens`, on a WebSocket attached with `deltas: true` |+| `Session` object | Running subagents in its `subagents` list |++A subagent with `background: true` can outlive the turn that launched it. When it ends after its turn did, the harness starts a new turn for the result, with `trigger: "subagent"`, the `subagentId`, and no `author`.++## List and read++| Method | Returns |+| --- | --- |+| `subagents.list` (`GET /sessions/{id}/subagents`) | Running subagents, newest first. `status=all` includes ended ones. `limit` is 1 to 100, default 20; pass `nextCursor` back as `cursor` |+| `subagents.get` (`GET /sessions/{id}/subagents/{subagentId}`) | One subagent with its whole `result` |++## Stop++`subagents.stop` (`POST /sessions/{id}/subagents/{subagentId}/stop`) stops a running subagent, as the Stop button on the Slack agents panel does. Suspending a session also stops its running subagents.++```json+{"jsonrpc":"2.0","id":6,"method":"subagents.stop","params":{"sessionId":"cs_0123456789abcdef","subagentId":"sa_0123456789ab"}}+```++The result is the subagent and a `seq`. A `subagent.ended` event follows with `status: "stopped"` and `stoppedBy`.++| Error | Cause |+| --- | --- |+| `409 subagent_ended` | The subagent has already ended. The error carries the subagent. A repeat by the actor who stopped it returns the subagent instead |++{/* Sources: computer/schema/computer-api.v1.json (Subagent, subagents.*, subagent events, Delta.subagent.progress, Turn.trigger); computer/src/api/read-methods.ts (list paging, loadResult in subagents.get); computer/src/runner/api/api.ts (subagents.stop, stopSubagent, suspend, harness-started turns); computer/src/host/session-writer.ts; computer/src/protocol-api.ts (progress rate) */}diff --git a/docs/api/terminals.mdx b/docs/api/terminals.mdxnew file mode 100644index 00000000..1fedbe1f--- /dev/null+++ b/docs/api/terminals.mdx@@ -0,0 +1,70 @@+---+title: "Terminals"+description: "A terminal is a shell or command the host starts in a session's workspace as the agent's Unix user, over WebSocket only"+---++`opc shell` is a client for terminals.++## Access++| Item | Rule |+| --- | --- |+| Caller | The session's owner or an admin, with the `terminals` scope. Anyone else: `403 forbidden` with `reason: "terminal_owner_only"` |+| Process user | The agent's Unix user |+| Environment | `HOME`, `USER`, `LOGNAME`, `SHELL`, `PATH`, `LANG`, `TERM`. No session secrets |++## Open++```json+{"jsonrpc":"2.0","id":8,"method":"terminals.open","params":{"sessionId":"cs_0123456789abcdef","cols":120,"rows":40}}+```++```json+{"jsonrpc":"2.0","id":8,"result":{"terminal":{"id":"tm_...","channel":1,"stderrChannel":null}}}+```++| Param | Meaning |+| --- | --- |+| `tty` | Default true: a pseudo-terminal; `cols` and `rows` are required. False: plain pipes, with standard error on its own channel, `stderrChannel` |+| `cols`, `rows` | 1 to 1,000 |+| `command` | A command to run instead of an interactive shell, up to 10,000 characters |+| `term` | The `TERM` value, up to 64 characters |++| Error | Cause |+| --- | --- |+| `409 too_many_terminals` | The session already holds 8 terminals, across all connections |++A session with an open terminal is not suspended for being idle. The journal records `terminal.opened` and `terminal.closed` events.++## Data frames++A binary WebSocket frame is a 4-byte big-endian channel number, then the data.++| Direction | Channel | Limit |+| --- | --- | --- |+| Client to server (input) | `channel` | 1 MiB per second per terminal. The server drops input over the limit, and the next request on the connection reports `rate_limited` |+| Server to client (output) | `channel`, and `stderrChannel` when there is one | 64 KiB per frame, channel number included |++## Resize, end input, close++Each method takes the `terminalId`.++| Method | Effect |+| --- | --- |+| `terminals.resize` | Sets `cols` and `rows` |+| `terminals.eof` | Closes the process's standard input |+| `terminals.close` | Hangs up: `SIGHUP` to the process group, `SIGKILL` 5 seconds later |++A terminal belongs to the connection that opened it.++| Case | Result |+| --- | --- |+| Its id used on another connection | `404 terminal_not_found` |+| The connection closes | Every terminal it opened closes |+| The process exits | The server sends `terminal.exited` |++```json+{"jsonrpc":"2.0","method":"terminal.exited","params":{"terminalId":"tm_...","exitCode":0,"signal":null}}+```++{/* Sources: computer/schema/computer-api.v1.json (terminals.*, terminal.exited, terminal events); computer/src/wire/terminal.ts (channels, frames, owner check, closeAll, input bucket); computer/src/wire/limits.ts; computer/src/wire/rpc.ts; computer/src/wire/edge-auth.ts; computer/src/host/terminal.ts (agent user, environment, 8 per session, SIGHUP/SIGKILL); computer/src/host/wire-link.ts (cwd, repeated check, journal records, idle-suspend exemption); opc/src/cli.rs (shell) */}diff --git a/docs/api/turns.mdx b/docs/api/turns.mdxnew file mode 100644index 00000000..83eba19d--- /dev/null+++ b/docs/api/turns.mdx@@ -0,0 +1,99 @@+---+title: "Turns"+description: "A turn is one message and the agent's work on it; a session runs one at a time and queues up to 20"+---++A turn's id is `tn_` followed by 12 characters.++## Send++`turns.send` (`POST /sessions/{id}/turns`) takes `input` (1 to 100,000 characters) and, optionally, `ifBusy` and `idempotencyKey`.++```json+{"jsonrpc":"2.0","id":3,"method":"turns.send","params":{"sessionId":"cs_0123456789abcdef","input":"Add a test for the empty case","ifBusy":"steer","idempotencyKey":"7f3c1c0e-1"}}+```++```json+{"jsonrpc":"2.0","id":3,"result":{"turn":{"id":"tn_0123456789ab","status":"running","...":"..."},"delivery":"steered","duplicate":false,"seq":412}}+```++| Session state | `ifBusy` | What happens | `delivery` | `turn` in the result |+| --- | --- | --- | --- | --- |+| Idle, nothing queued | Any | The turn starts | `started` | The new turn |+| Busy | `queue` (default) | The message waits as a `queued` turn. Queued turns start in order. Open asks stay open | `queued` | The new turn |+| Busy | `steer` | The message joins the running turn's `steering` list. Open asks close as `declined`; the message is the answer. With no running turn the message is queued | `steered` | The running turn |+| Busy | `interrupt` | Queued turns are cancelled and the running turn goes to `cancelling`. The message becomes a new turn that starts once the harness has stopped | `started` | The new turn |++A send to a suspended session is recorded as a `queued` turn and starts a runner.++Each send records a `message.received` event; a steer also records `turn.steered` on the running turn.++| Error | Cause |+| --- | --- |+| `409 queue_full` (`retryable: true`, `retryAfterMs: 5000`) | The session already holds 20 queued turns |++## Status++```mermaid+stateDiagram-v2+ [*] --> queued+ [*] --> running+ queued --> running+ queued --> cancelled: cancel or interrupt+ running --> completed+ running --> failed+ running --> cancelling: interrupt+ cancelling --> cancelled+```++| `status` | Meaning | Event |+| --- | --- | --- |+| `queued` | Waiting for the running turn to end | `turn.queued` with `position` |+| `running` | The harness is working | `turn.started` with `model`, `effort`, `mode` |+| `cancelling` | Interrupted; the harness has not stopped yet | `turn.status_changed` |+| `completed` | Ended normally. `text` is the final message | `turn.completed` |+| `failed` | Ended with an `error` (`code`, `message`) | `turn.failed` |+| `cancelled` | Interrupted or withdrawn. `reason` says which | `turn.cancelled` |++A turn with `trigger: "subagent"` was started by the harness, not by a message; see [Subagents](/api/subagents).++## Wait for the result++| Transport | How |+| --- | --- |+| WebSocket | Attach to the session and read [events](/api/events) until `turn.completed`, `turn.failed` or `turn.cancelled` for the turn id |+| HTTP | Long-poll `turns.get` (`GET /sessions/{id}/turns/{turnId}`) |++```+GET /sessions/cs_0123456789abcdef/turns/tn_0123456789ab?waitMs=60000+```++| Param | Effect |+| --- | --- |+| `waitMs` (up to 60,000) | Returns when the turn has ended or the wait is over. Check `status` and call again if it has not ended |+| `status` | Returns when the turn has left this status instead |+| `minSeq` | Waits for the journal: [Session journal](/api/overview#session-journal) |++The ended turn carries `text`, `error`, `usage` (tokens and `costUsd`), `startedAt` and `endedAt`. A turn that stopped for a person has an open [ask](/api/asks) on the session.++## Cancel a queued turn++`turns.cancel` (`POST /sessions/{id}/turns/{turnId}/cancel`) withdraws a `queued` turn: it ends as `cancelled` with `reason: "withdrawn"`.++| Error | Cause |+| --- | --- |+| `409 turn_not_cancellable` | The turn is not `queued`. The error carries the turn |++## Interrupt++`sessions.interrupt` (`POST /sessions/{id}/interrupt`) cancels every queued turn and stops the running one. It returns at once with the session.++| Case | Result |+| --- | --- |+| Running turn | Goes to `cancelling`; when the harness stops, ends as `cancelled` with `reason: "interrupted"` |+| Harness not stopped 10 seconds after the first interrupt | The harness process is ended and the turn is cancelled with `forced: true` |+| Open asks | Close as `interrupted` |+| `turnId` given | Does nothing unless that turn is the running one or is queued |+| Suspended session whose journal shows a started turn (its runner died) | That turn ends as cancelled with `forced: true` |++{/* Sources: computer/schema/computer-api.v1.json (Turn, SendResult, turns.*, sessions.interrupt, turn events); computer/src/runner/api/api.ts (send, steer, interruptWith, cancelQueued, FORCE_CANCEL_MS, QUEUE_MAX); computer/src/runner/api/asks.ts (steer declines asks); computer/src/host/session-writer.ts (queued send, cancelOrphan); computer/src/api/read-methods.ts (turns.get waitMs, status, minSeq); opc/src/cmd/follow.rs (turns.get use) */}diff --git a/docs/docs.json b/docs/docs.jsonindex 175ca8fa..16e2bf35 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -22,10 +22,70 @@},"favicon": "/images/favicon.svg","navigation": {- "tabs": [+ "groups": [{- "tab": "Serverless Agents",- "groups": [+ "group": "Getting started",+ "pages": [+ "getting-started/introduction",+ "getting-started/quickstart",+ "getting-started/architecture"+ ]+ },+ {+ "group": "Use in Slack",+ "pages": [+ "slack/threads",+ "slack/shared-threads",+ "slack/linked-and-spawned-threads",+ "slack/mid-turn-messages",+ "slack/permission-modes",+ "slack/approvals-questions-plans",+ "slack/subagents",+ "slack/files-and-cards",+ "slack/browser-screenshots-video",+ "slack/branches-and-pull-requests",+ "slack/preview-urls",+ "slack/models-and-harnesses",+ "slack/secrets-and-variables",+ "slack/troubleshooting"+ ]+ },+ {+ "group": "Self-hosting",+ "pages": [+ "self-hosting/overview",+ "self-hosting/azure",+ "self-hosting/aws",+ "self-hosting/gcp"+ ]+ },+ {+ "group": "API and CLI",+ "pages": [+ "api/overview",+ "api/sessions",+ "api/turns",+ "api/events",+ "api/asks",+ "api/subagents",+ "api/terminals",+ "api/files",+ "api/cli"+ ]+ },+ {+ "group": "Reference",+ "pages": [+ "reference/slack-commands",+ "reference/agent-tools",+ "reference/configuration",+ "reference/limits",+ "reference/api-schema"+ ]+ },+ {+ "group": "Serverless Agents",+ "pages": [{"group": "Getting started","pages": [diff --git a/docs/getting-started/architecture.mdx b/docs/getting-started/architecture.mdxnew file mode 100644index 00000000..a4125891--- /dev/null+++ b/docs/getting-started/architecture.mdx@@ -0,0 +1,40 @@+---+title: "Architecture"+description: "How Slack, the gateway, hosts and runners fit together"+---++{/* Goal: the reader can draw Slack → gateway ← host → runner and knows what each owns and where state lives. */}++## The pieces++++## Gateway++The front door. Messages from Slack, the web dashboard, the API and the CLI arrive here, and the gateway passes them on to the right session. It also handles setup and connects to GitHub. It doesn't run any agents itself, so you can restart it at any time without losing work.++## Host agent++The manager on your VM. It connects to the gateway and picks up new work. For every thread it creates a workspace with a copy of your repositories and starts a session in it. It stops sessions that go quiet and brings them back after a restart.++## Runner++One coding agent working on one thread. Each session in the diagram is a runner. It posts its replies straight to Slack, so you see the agent's work as it happens.++## Where state lives++A session's state is written to the VM's durable disk first, then persisted to a durable git store. The disk keeps sessions fast; the git store makes them portable.++Portability is what lets you scale horizontally: another VM can pick up the same session when needed. If two copies of a session conflict, git resolves it.++The gateway keeps its own small SQLite database: which session runs on which VM, the people and VMs it knows, and messages waiting for a VM that's offline.++## Sandboxes only when you need them++Most platforms give every session its own sandbox, which sleeps and wakes up between turns. We tried that in early iterations of the product and ran into three problems:++- **It's slow.** Starting and resuming a session this way was too slow, even with several optimizations applied.+- **Cost scales linearly with sessions.** Every session pays for its own sandbox.+- **Most sessions don't need one.** Think of an exploratory session where you fix a few items in your docs: it doesn't need a separate sandbox and dedicated compute.++In many cases a shared VM can handle hundreds of concurrent sessions. A session only needs a sandbox when it runs a heavy build or spins up a preview environment, and at that moment OpenComputer delegates the session to the sandbox.diff --git a/docs/getting-started/introduction.mdx b/docs/getting-started/introduction.mdxnew file mode 100644index 00000000..7e917d9c--- /dev/null+++ b/docs/getting-started/introduction.mdx@@ -0,0 +1,26 @@+---+title: "What is OpenComputer"+description: "Turn any VM into a multiplayer coding agent"+---++{/* Goal: the reader knows what @computer is and whether it fits their team. */}++OpenComputer turns any VM into a multiplayer coding agent.++## Why move coding agents off your laptop++A lot of us outgrow our local machines, for a few reasons:++- **RAM.** Our agents run parallel builds, and preview environments run locally too.+- **Context overload.** We become meat proxies, copy-pasting between our agents and Slack.+- **The rest of the team.** We want nontechnical teammates to ship features and fixes alongside us.++All of these are easy to solve by moving to multiplayer coding in the cloud.++## Where you use it++OpenComputer targets first-class support for Slack. You can also work with it from the web dashboard, the API and the CLI.++## Start small, scale later++Get started on a single VM. When you need more, scale out to multiple VMs; sessions stay portable between them.diff --git a/docs/getting-started/quickstart.mdx b/docs/getting-started/quickstart.mdxnew file mode 100644index 00000000..75db9a9e--- /dev/null+++ b/docs/getting-started/quickstart.mdx@@ -0,0 +1,55 @@+---+title: "Quickstart"+description: "On the hosted service, sign in, connect a coding agent, Slack and GitHub, then mention `@computer` in a channel"+---++The hosted service runs the gateway and the computer. To run the code yourself, see [Self-hosting](/self-hosting/overview).++<Frame>+ <img src="/images/slack/first-task.png" alt="Sam mentions @computer with a question in #eng. computer replies in the thread with the thread id, the steps it ran, the answer and a footer with model, duration and context size" />+</Frame>++## Before you start++- A Slack workspace. If you are not an admin, Slack lets you request approval for the app.+- A GitHub account that can install a GitHub App on the repositories the agent will work in.+- A Claude Pro or Max, or ChatGPT Plus or Pro subscription, unless you pay for model usage with OpenComputer credits.++## Set up++Sign in at [app.opencomputer.dev/computer](https://app.opencomputer.dev/computer). The page walks through four steps.++<Steps>+ <Step title="Choose your coding agent">+ Pick Claude Code or Codex and connect the subscription it runs on, or pick OpenComputer credits.+ </Step>+ <Step title="Add OpenComputer to Slack">+ Click **Add to Slack** and approve the app. The service creates your organization's computer; the page shows its status until it is `Online`.+ </Step>+ <Step title="Connect GitHub">+ Install the GitHub App and pick the repositories. The three most recently pushed are cloned on the computer; the others are cloned when a session first checks them out. The agent can push branches and open pull requests in all of them.+ </Step>+ <Step title="Give it a first task">+ Mention `@computer` in a channel, or send it a direct message. The page shows the mention to copy.++ ```text+ @computer why is the checkout test flaky?+ ```++ You do not have to wait for `Online`: a message sent while the computer starts is picked up once it is on.+ </Step>+</Steps>++The reply streams into the thread under your message. That thread is now a session: reply in it to continue, without a mention.++## Teammates++Anyone in the Slack workspace can mention `@computer`. A session belongs to the person who started its thread.++## Next++- [Threads](/slack/threads): what a session shows and how it ends.+- [Branches and pull requests](/slack/branches-and-pull-requests): how work leaves the computer.+- [Self-hosting](/self-hosting/overview): run the gateway and the computer yourself.++{/* Sources: opencomputer web/src/managed-agents/Computer.tsx, AgentStep.tsx and computer-state.ts (four steps, labels, status, first-task text); services/managed-agents/src/computer/github.ts (`EAGER_REPO_COUNT`: three clones, the rest lazy); services/managed-agents/src/computer/routes.ts (computer created in the Slack OAuth callback); services/managed-agents/src/computer/durable-object.ts (mention or DM starts a session, thread owner, `!link`) */}diff --git a/docs/images/architecture.png b/docs/images/architecture.pngnew file mode 100644index 00000000..bd3435d4Binary files /dev/null and b/docs/images/architecture.png differdiff --git a/docs/images/self-hosting.png b/docs/images/self-hosting.pngnew file mode 100644index 00000000..2d59faa0Binary files /dev/null and b/docs/images/self-hosting.png differdiff --git a/docs/images/slack/approval.png b/docs/images/slack/approval.pngnew file mode 100644index 00000000..c587ded3Binary files /dev/null and b/docs/images/slack/approval.png differdiff --git a/docs/images/slack/card.png b/docs/images/slack/card.pngnew file mode 100644index 00000000..f81d0842Binary files /dev/null and b/docs/images/slack/card.png differdiff --git a/docs/images/slack/file-posted.png b/docs/images/slack/file-posted.pngnew file mode 100644index 00000000..e942e1d9Binary files /dev/null and b/docs/images/slack/file-posted.png differdiff --git a/docs/images/slack/first-task.png b/docs/images/slack/first-task.pngnew file mode 100644index 00000000..56a9d952Binary files /dev/null and b/docs/images/slack/first-task.png differdiff --git a/docs/images/slack/mode.png b/docs/images/slack/mode.pngnew file mode 100644index 00000000..caec57ceBinary files /dev/null and b/docs/images/slack/mode.png differdiff --git a/docs/images/slack/model-effort.png b/docs/images/slack/model-effort.pngnew file mode 100644index 00000000..502f6334Binary files /dev/null and b/docs/images/slack/model-effort.png differdiff --git a/docs/images/slack/not-enabled.png b/docs/images/slack/not-enabled.pngnew file mode 100644index 00000000..520e05ecBinary files /dev/null and b/docs/images/slack/not-enabled.png differdiff --git a/docs/images/slack/plan-approved.png b/docs/images/slack/plan-approved.pngnew file mode 100644index 00000000..b0bc14b3Binary files /dev/null and b/docs/images/slack/plan-approved.png differdiff --git a/docs/images/slack/plan.png b/docs/images/slack/plan.pngnew file mode 100644index 00000000..5e6f0f83Binary files /dev/null and b/docs/images/slack/plan.png differdiff --git a/docs/images/slack/post-thread.png b/docs/images/slack/post-thread.pngnew file mode 100644index 00000000..c8f44f9aBinary files /dev/null and b/docs/images/slack/post-thread.png differdiff --git a/docs/images/slack/preview-url.png b/docs/images/slack/preview-url.pngnew file mode 100644index 00000000..1999fa03Binary files /dev/null and b/docs/images/slack/preview-url.png differdiff --git a/docs/images/slack/pull-request.png b/docs/images/slack/pull-request.pngnew file mode 100644index 00000000..8f0583eeBinary files /dev/null and b/docs/images/slack/pull-request.png differdiff --git a/docs/images/slack/question.png b/docs/images/slack/question.pngnew file mode 100644index 00000000..6d3e57a8Binary files /dev/null and b/docs/images/slack/question.png differdiff --git a/docs/images/slack/screenshot.png b/docs/images/slack/screenshot.pngnew file mode 100644index 00000000..b08baa71Binary files /dev/null and b/docs/images/slack/screenshot.png differdiff --git a/docs/images/slack/secret-command.png b/docs/images/slack/secret-command.pngnew file mode 100644index 00000000..8329f3e3Binary files /dev/null and b/docs/images/slack/secret-command.png differdiff --git a/docs/images/slack/secret-form.png b/docs/images/slack/secret-form.pngnew file mode 100644index 00000000..b542c1daBinary files /dev/null and b/docs/images/slack/secret-form.png differdiff --git a/docs/images/slack/secret-request.png b/docs/images/slack/secret-request.pngnew file mode 100644index 00000000..4e49cc5cBinary files /dev/null and b/docs/images/slack/secret-request.png differdiff --git a/docs/images/slack/session-unreachable.png b/docs/images/slack/session-unreachable.pngnew file mode 100644index 00000000..83999aa0Binary files /dev/null and b/docs/images/slack/session-unreachable.png differdiff --git a/docs/images/slack/shared-thread.png b/docs/images/slack/shared-thread.pngnew file mode 100644index 00000000..c851b226Binary files /dev/null and b/docs/images/slack/shared-thread.png differdiff --git a/docs/images/slack/spawned-thread.png b/docs/images/slack/spawned-thread.pngnew file mode 100644index 00000000..644e6e22Binary files /dev/null and b/docs/images/slack/spawned-thread.png differdiff --git a/docs/images/slack/status.png b/docs/images/slack/status.pngnew file mode 100644index 00000000..5c5a2ecfBinary files /dev/null and b/docs/images/slack/status.png differdiff --git a/docs/images/slack/steer.png b/docs/images/slack/steer.pngnew file mode 100644index 00000000..dfb6da32Binary files /dev/null and b/docs/images/slack/steer.png differdiff --git a/docs/images/slack/stop.png b/docs/images/slack/stop.pngnew file mode 100644index 00000000..a8101747Binary files /dev/null and b/docs/images/slack/stop.png differdiff --git a/docs/images/slack/subagent-result.png b/docs/images/slack/subagent-result.pngnew file mode 100644index 00000000..d070a572Binary files /dev/null and b/docs/images/slack/subagent-result.png differdiff --git a/docs/images/slack/subagents.png b/docs/images/slack/subagents.pngnew file mode 100644index 00000000..0e6f734aBinary files /dev/null and b/docs/images/slack/subagents.png differdiff --git a/docs/images/slack/turn-finished.png b/docs/images/slack/turn-finished.pngnew file mode 100644index 00000000..a1e6ee1aBinary files /dev/null and b/docs/images/slack/turn-finished.png differdiff --git a/docs/images/slack/turn-running.png b/docs/images/slack/turn-running.pngnew file mode 100644index 00000000..c6694069Binary files /dev/null and b/docs/images/slack/turn-running.png differdiff --git a/docs/images/slack/variable.png b/docs/images/slack/variable.pngnew file mode 100644index 00000000..ce66ab88Binary files /dev/null and b/docs/images/slack/variable.png differdiff --git a/docs/reference/agent-tools.mdx b/docs/reference/agent-tools.mdxnew file mode 100644index 00000000..5a129711--- /dev/null+++ b/docs/reference/agent-tools.mdx@@ -0,0 +1,152 @@+---+title: "Agent tools"+description: "Every tool Computer adds to the harness, with parameters and per-runner limits"+---++Under Claude Code these tools are one MCP server named `calvin`; approval prompts show the full id, `mcp__calvin__<name>`.++## Availability++| Tool | One-machine mode (`npm start`) | Self-hosted gateway and host | Hosted |+| --- | --- | --- | --- |+| `send_file` | yes | yes | yes |+| `post_card` | yes | yes | yes |+| `checkout_repo` | no | when the host has a workspace definition | yes |+| `spawn_thread` | no | yes | yes |+| `read_thread` | no | yes | yes |+| `post_thread` | no | yes | yes |+| `request_secret` | no | yes; fails unless the gateway has `SP_STORE_KEY` | yes |+| `preview`, `unpreview` | no | offered, but the gateway refuses the call (see [preview](#preview)) | yes |++"Per runner" counts reset when the session's runner restarts.++## send_file++Posts a file into the session's Slack thread. PNG, JPEG, GIF and WebP images render inline.++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `path` | string | yes | Absolute, or relative to the session directory. |+| `comment` | string, up to 3,000 characters | no | Message posted with the file. |+| `title` | string, up to 200 characters | no | Defaults to the file name. |+| `alt_text` | string, up to 1,000 characters | no | Image description for screen readers. |++| Rule | Value |+| --- | --- |+| File | Regular, non-empty, at most 100 MiB, inside the session directory or the system temp directory |+| Count | 50 files per runner |+| Secrets | A file that contains the value of one of the session's secrets is refused |+| Slack scope | `files:write` |+| From a script | `calvin-send-file <path> [comment]`, on the runner's `PATH`, same limits |++## post_card++Posts a card (key facts, a table, charts, link buttons) into the session's thread as Slack blocks.++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `spec` | object | yes | The card. |+| `spec.root` | string | yes | Id of the root element, a Card. |+| `spec.elements` | map | yes | Id to `{type, props, children}`. |+| `spec.state` | object | no | |++| Rule | Value |+| --- | --- |+| Table | One; 100 rows, 20 columns |+| Charts | Two; title up to 50 characters, 12 series, 20 points, labels up to 20 characters |+| Fields | 10 |+| Slack blocks | 50 |+| Buttons | Links only |+| Invalid spec | Refused with the list of problems |+| Count | 50 cards per runner |+| Secrets | As for `send_file` |++## checkout_repo++Adds workspace repositories to the session directory, each as a git worktree on the session's branch, cloning first if needed. A repository already checked out is returned as it is. See Repositories.++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `repos` | array of 1 to 10 strings | yes | Repository names from the definition, or `owner/name` (case-insensitive). |++| Error | Cause |+| --- | --- |+| `no repository <x> in this workspace; the list is in AGENTS.md` | Not in the definition |+| `<x> is not published yet` | The repository is marked `unpublished` |++## spawn_thread++Starts a session in a new Slack thread, with the same owner and permission mode. The gateway posts the task and a link to the brief as a top-level message in the parent's channel, or in the owner's direct messages when the parent is a code channel. See [Linked and spawned threads](/slack/linked-and-spawned-threads).++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `task` | string, 3 to 150 characters, one line | yes | What the new thread should do. |+| `brief` | string | yes | Path of a `.md` file inside the session directory, relative to it, with an optional `#anchor`. Must be on the fetched default branch of its repository. |+| `model` | `smart`, `fast` or `default` | no | Model tier. Omitted: the parent's model. |++Limit: 8 per runner.++## read_thread++Returns a Slack thread's first message, its latest replies (at most 40, 16,000 characters in all, 4,000 per message) and how many were left out, marked as data, not instructions. See [Linked and spawned threads](/slack/linked-and-spawned-threads).++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `url` | string | `url`, or `channel` with `ts` | The thread's Slack link. |+| `channel` | string | | Channel id (`C…` or `G…`). |+| `ts` | string | | Timestamp of a message in the thread, for example `1700000000.000100`. |++| Rule | Value |+| --- | --- |+| Count | 40 per runner |+| Approval | Never asked |+| Readable conversations | The bot is in it, and the session's owner and everyone who can read the session's own conversation can see it. Otherwise the tool returns the reason. |++## post_thread++Posts a reply inside another Slack thread, never at the channel's top level.++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `url`, or `channel` with `ts` | as for `read_thread` | yes | The thread to post into. |+| `text` | string, 1 to 4,000 characters | yes | Slack mrkdwn. |++| Rule | Value |+| --- | --- |+| Count | 20 per runner |+| Approval | Asked outside `bypassPermissions` mode (see [Permission modes](/slack/permission-modes)) |+| Channel-wide mentions (`@channel`, `@here`, `@everyone`, user groups) | Become plain text |+| Attribution | The gateway appends a `Posted for` line naming the session's owner and linking the session's thread |++## request_secret++Posts a button; the person types the secret into a private Slack form. The agent ends its turn and is told when the secret is set; the value is then in the environment of the session's next shell commands. See [Secrets and variables](/slack/secrets-and-variables).++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `name` | string, an environment variable name | yes | For example `STRIPE_API_KEY`. |+| `reason` | string, 3 to 200 characters | yes | One line shown to the person. |+| `file` | boolean | no | Store the secret as a file; `$NAME` holds its path. |++Limit: 10 per runner. Fails when a secret of that name is already set, or when a self-hosted gateway has no `SP_STORE_KEY`.++## preview++Gives an HTTP server listening on a port of the computer a public URL. Anyone with the URL can open it. Plain HTTP on that port only; the URL works while the server runs. See [Preview URLs](/slack/preview-urls).++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `port` | integer, 1 to 65535 | yes | The port the server listens on, on localhost. |+| `name` | string, one DNS label (lowercase letters, digits, hyphens; up to 63 characters) | no | Omitted: a generated name, or the port's existing one. |++Returns the URL, the name, and whether something was listening on the port.++## unpreview++Takes down a preview URL.++| Parameter | Type | Required | Meaning |+| --- | --- | --- | --- |+| `name` | string | yes | The preview's name, the label at the start of its URL. |++{/* Sources: computer/src/runner/tools.ts; computer/src/runner/send-file.ts; computer/src/runner/post-card.ts; computer/src/runner/harness/claude/process.ts (mcpServers, allowedTools); computer/src/host/main.ts (checkout); computer/src/workspaces/index.ts (checkoutRepos); computer/src/gateway/hosts.ts (spawn, read, post, secret-request, preview refusal); computer/src/gateway/threads.ts; computer/src/links.ts; computer/src/gateway/routing.ts (spawn); computer/src/runner/checkout.ts; computer/src/runner/spawn.ts; computer/src/runner/threads.ts; computer/src/runner/preview.ts; computer/src/runner/session-secrets.ts; computer/src/runner/prompts.ts; computer/src/main.ts (no hooks in one-machine mode) */}diff --git a/docs/reference/api-schema.mdx b/docs/reference/api-schema.mdxnew file mode 100644index 00000000..868077e2--- /dev/null+++ b/docs/reference/api-schema.mdx@@ -0,0 +1,218 @@+---+title: "API schema"+description: "Every method, event, object and error code of the Computer API, version 1"+---++| Item | Value |+| --- | --- |+| Schema file | `computer/schema/computer-api.v1.json`, generated from `computer/src/api/schema.ts` |+| Print it | `opc schema`, from the copy built into the CLI. `opc schema <object>` prints one object |+| `field?` | Optional |+| `\| null` | Always present, may be null |++## Operations++On an HTTP route, path parameters replace `sessionId`, `turnId`, `askId` and `subagentId`. A `GET` takes the other fields as query parameters, other verbs as a JSON body. Unknown fields are refused with `invalid_request`.++| Method | HTTP route | Params | Result |+| --- | --- | --- | --- |+| `sessions.attach` | WebSocket only | `sessionId`, `after?`, `tailTurns?` (1 to 50), `deltas?`, `resume?`, `readOnly?` | `session`, `logEpoch`, `epochStartSeq`, `capabilities`, `earlierTurns \| null`, `timing.serverUs` |+| `sessions.detach` | WebSocket only | `sessionId` | empty |+| `sessions.get` | `GET /sessions/{id}` | `sessionId`, `minSeq?` | `session` |+| `sessions.update` | `PATCH /sessions/{id}` | `sessionId`, `idempotencyKey?`, `title?` (1 to 200 characters), `model?`, `effort?`, `speed?` (`fast`, `standard`), `mode?`, `archived?`, `metadata?` | `session`, `seq` |+| `sessions.interrupt` | `POST /sessions/{id}/interrupt` | `sessionId`, `idempotencyKey?`, `turnId?` | `session`, `seq` |+| `sessions.compact` | `POST /sessions/{id}/compact` | `sessionId`, `idempotencyKey?`, `instructions?` (up to 10,000 characters) | `turn`, `delivery`, `duplicate`, `seq`, `timing?` |+| `sessions.suspend` | `POST /sessions/{id}/suspend` | `sessionId`, `idempotencyKey?`, `ifIdle?` | `session`, `seq` |+| `sessions.resume` | `POST /sessions/{id}/resume` | `sessionId`, `idempotencyKey?` | `session`, `seq` |+| `turns.send` | `POST /sessions/{id}/turns` | `sessionId`, `idempotencyKey?`, `input` (1 to 100,000 characters), `ifBusy?` (`queue`, `steer`, `interrupt`) | `turn`, `delivery` (`started`, `queued`, `steered`), `duplicate`, `seq`, `timing?` |+| `turns.get` | `GET /sessions/{id}/turns/{turnId}` | `sessionId`, `turnId`, `waitMs?` (0 to 60,000), `status?`, `minSeq?` | `turn` |+| `turns.cancel` | `POST /sessions/{id}/turns/{turnId}/cancel` | `sessionId`, `turnId`, `idempotencyKey?` | `turn`, `seq` |+| `asks.list` | `GET /sessions/{id}/asks` | `sessionId`, `status?`, `limit?` (1 to 100), `cursor?` | `asks`, `nextCursor \| null` |+| `asks.get` | `GET /sessions/{id}/asks/{askId}` | `sessionId`, `askId` | `ask` |+| `asks.answer` | `POST /sessions/{id}/asks/{askId}/answer` (the body is the answer) | `sessionId`, `askId`, `idempotencyKey?`, `answer` | `ask`, `seq` |+| `asks.dismiss` | `POST /sessions/{id}/asks/{askId}/dismiss` | `sessionId`, `askId`, `idempotencyKey?`, `message?` (up to 2,000 characters) | `ask`, `seq` |+| `subagents.list` | `GET /sessions/{id}/subagents` | `sessionId`, `status?` (`running`, `all`), `limit?` (1 to 100), `cursor?` | `subagents`, `nextCursor \| null` |+| `subagents.get` | `GET /sessions/{id}/subagents/{subagentId}` | `sessionId`, `subagentId` | `subagent` |+| `subagents.stop` | `POST /sessions/{id}/subagents/{subagentId}/stop` | `sessionId`, `subagentId`, `idempotencyKey?` | `subagent`, `seq` |+| `events.list` | `GET /sessions/{id}/events` | `sessionId`, `after?`, `limit?` (1 to 500, default 100), `waitMs?` (0 to 60,000), `tailTurns?` (1 to 50), `turnId?`, `types?` | `events`, `earlierTurns \| null`, `lastSeq`, `hasMore` |+| `terminals.open` | WebSocket only | `sessionId`, `cols?`, `rows?` (1 to 1,000 each), `command?` (up to 10,000 characters), `tty?`, `term?` (up to 64 characters) | `terminal.id`, `terminal.channel`, `terminal.stderrChannel \| null` |+| `terminals.resize` | WebSocket only | `terminalId`, `cols`, `rows` | empty |+| `terminals.eof` | WebSocket only | `terminalId` | empty |+| `terminals.close` | WebSocket only | `terminalId` | empty |+| `ping` | WebSocket only | none | `timing.serverUs` |++Creating a session is HTTP only: `POST /sessions` with `CreateSessionBody`: `id?`, `input?`, `title?` (up to 200 characters), `model?`, `effort?`, `speed?`, `mode?`, `metadata?`.++### Routes outside the schema++The relay (`computer/src/wire/`) serves these. The API routes for workspace files are `/sessions/{id}/workspace/files`, `/file` and `/archive`; `opc push` and `opc pull` call `/archive`. See [Files](/api/files).++| Relay route | Purpose |+| --- | --- |+| `GET /files/{id}/files` | List a directory: `path`, `depth` (1 to 10), `limit` (1 to 100), `cursor` |+| `GET /files/{id}/file` | Read one file: `path` |+| `GET /files/{id}/archive` | Download a directory or file as a tar stream: `path` |+| `PUT /files/{id}/archive` | Upload a tar stream as one top-level directory: `path` |+| `GET /connect` | WebSocket upgrade |+| `GET /health` | Relay health |++## WebSocket notifications++Server to client:++| Method | Params |+| --- | --- |+| `ready` | `connectionId`, `server.version`, `server.region \| null`, `protocol.features[]`, `limits.maxAttached`, `limits.maxMessageBytes`, `limits.maxRequestsPerSecond`, `expiresAt \| null`, `expiresInMs \| null` |+| `sessions.attached` | `sessionId`, `error \| null`, `session \| null`, `logEpoch \| null`, `epochStartSeq \| null`, `capabilities \| null`, `earlierTurns \| null`, `timing \| null` (answers an attach named in the connection URL) |+| `event` | One [event](#events) |+| `delta` | One [delta](#deltas) |+| `session.detached` | `sessionId`, `reason` (`too_far_behind`, `access_lost`, `epoch_changed`, `unavailable`), `logEpoch?`, `epochStartSeq?` |+| `terminal.exited` | `terminalId`, `exitCode \| null`, `signal \| null` |++Client to server:++| Method | Params |+| --- | --- |+| `sessions.ack` | `sessionId`, `seq` |+| `telemetry` | `v` (1), `client.name` (`opc`), `client.version`, `client.os?`, `client.arch?`, `events` (1 to 20) |++## Events++Envelope:++| Field | Type |+| --- | --- |+| `id` | `ev_` and 16 characters |+| `seq` | Integer from 1, increasing by one per session |+| `createdAt` | Timestamp |+| `sessionId` | `cs_` and 16 characters |+| `turnId` | Turn id or null |+| `actor` | Actor or null |+| `type` | One of the types below |+| `data` | Per type |++| Type | `data` fields |+| --- | --- |+| `session.created` | `title`, `origin`, `settings` |+| `session.status_changed` | `from \| null`, `to` |+| `session.updated` | `changes`: a map of field name to `{from, to}` |+| `session.compacted` | `beforeTokens`, `afterTokens`, `auto` |+| `message.received` | `input`, `ifBusy`, `delivery`, `interruptedTurnIds[]`, `declinedAskIds[]` |+| `turn.queued` | `position`, `trigger`, `subagentId` |+| `turn.steered` | `messageSeq` |+| `turn.started` | `model`, `effort`, `mode`, `trigger`, `subagentId` |+| `turn.status_changed` | `from`, `to` |+| `turn.completed` | `text`, `durationMs`, `silent` |+| `turn.failed` | `error` (`code`, `message`) |+| `turn.cancelled` | `reason`, `forced`, `input` |+| `message.completed` | `blockId`, `parentCallId`, `text` |+| `reasoning.completed` | `blockId`, `parentCallId`, `text`, `redacted`, `durationMs` |+| `tool.started` | `subagentId`, `toolName`, `callId`, `parentCallId`, `title`, `input`, `inputTruncated` |+| `tool.completed` | `subagentId`, `toolName`, `callId`, `parentCallId`, `title`, `output`, `outputTruncated`, `fileChanges \| null` (each `path`, `status` of `added`, `modified` or `deleted`, `added`, `removed`), `durationMs` |+| `tool.failed` | `subagentId`, `toolName`, `callId`, `parentCallId`, `title`, `message`, `settledBy` |+| `subagent.started` | `subagent` |+| `subagent.ended` | `subagent` |+| `ask.opened` | `ask` |+| `ask.closed` | `ask` |+| `usage.recorded` | `model`, `inputTokens`, `outputTokens`, `reasoningTokens`, `cachedTokens`, `cacheWriteTokens`, `costUsd`, `firstTokenMs`, `durationMs`, `usedTokens`, `windowTokens` |+| `model.rate_limited` | `model`, `retryAfterMs`, `attempt` |+| `runtime.starting` | `phase` (`computer`, `agent`) |+| `runtime.connected` | `warm`, `resumed`, `durationMs` |+| `runtime.suspended` | `reason` (`idle`, `requested`, `lost`) |+| `files.pushed` | `path`, `files`, `bytes`, `replaced` |+| `terminal.opened` | `terminalId`, `command` |+| `terminal.closed` | `terminalId`, `exitCode` |++A client must ignore event types it does not know (`Event.other`: any other `type`, open `data`).++## Deltas++Sent only on a WebSocket attached with `deltas: true`; see [Events](/api/events#deltas). Each has `type`, `sessionId`, `turnId` and `data`.++| Type | `data` fields |+| --- | --- |+| `message.delta` | `blockId`, `parentCallId`, `text` |+| `reasoning.delta` | `blockId`, `parentCallId`, `text` |+| `tool.preparing` | `subagentId`, `callId`, `toolName`, `path`, `description`, `lines` |+| `tool.delta` | `callId`, `text` |+| `session.compacting` | none |+| `subagent.progress` | `subagentId`, `activity`, `toolCalls`, `tokens` |++## Objects++| Object | Fields |+| --- | --- |+| Session | `id` (`cs_` and 16 characters), `title`, `status` (`starting`, `running`, `waiting`, `idle`, `suspended`), `archived`, `owner` (Person), `origin` (Origin), `settings` (`model`, `effort`, `mode`, `speed`), `metadata`, `activeTurnId`, `queued` (Turn list), `asks` (Ask list), `subagents` (Subagent list), `lastTurn` (TurnSummary or null), `lastText`, `context` (`usedTokens`, `windowTokens`), `lastSeq`, `logEpoch`, `epochStartSeq`, `createdAt`, `lastActiveAt`, `syncedAt`, `urls.dashboard` |+| Person | `id`, `name`, `email` |+| Origin | `type` (`slack`, `opc`, `dashboard`, `api`), `client`, `slack` (`teamId`, `channelId`, `channelName`, `threadTs`, `url`) or null |+| Actor | `id`, `name`, `via` (`slack`, `opc`, `dashboard`, `api`), `client` |+| Turn | `id` (`tn_` and 12 characters), `sessionId`, `status` (`queued`, `running`, `cancelling`, `completed`, `failed`, `cancelled`), `trigger` (`message`, `subagent`), `subagentId`, `ifBusy`, `input`, `author` (Actor or null), `steering` (list of `input`, `author`, `createdAt`), `createdAt`, `startedAt`, `endedAt`, `text`, `error` (TurnError or null), `reason` (`interrupted`, `withdrawn` or null), `forced`, `usage` (Usage or null) |+| TurnError | `code` (`model_rejected`, `model_unavailable`, `model_stream_failed`, `context_too_long`, `runtime_lost`, `runtime_failed`, `tool_failed`, `agent_failed`), `message` |+| Usage | `inputTokens`, `outputTokens`, `reasoningTokens`, `cachedTokens`, `cacheWriteTokens`, `costUsd` |+| Ask | `id` (`ak_` and 12 characters), `sessionId`, `turnId`, `kind` (`approval`, `question`, `secret`), `status` (`open`, `answered`, `dismissed`, `declined`, `interrupted`), `createdAt`, `closedAt`, `closedBy`, `answer`, `approval` (`toolName`, `callId`, `input`, `title`, `alwaysAllows`) or null, `question` (`questions`: each `id`, `header`, `text`, `multiSelect`, `options` of `label` and `description`) or null, `secret` (`name`, `purpose`, `file`) or null |+| ApprovalAnswer | `decision` (`allow`, `deny`, `always`), `message?` (up to 2,000 characters), `mode?` |+| QuestionAnswer | `answers`: each `questionId`, `choices[]`, `text \| null` |+| DeclineAnswer | `message`, `messageSeq` |+| Subagent | `id` (`sa_` and 12 characters), `sessionId`, `turnId`, `callId`, `name`, `agentType`, `background`, `status` (`running`, `completed`, `failed`, `stopped`), `activity`, `toolCalls`, `tokens`, `createdAt`, `endedAt`, `durationMs`, `result`, `resultTruncated`, `error` (`code`, `message`) or null, `stoppedBy` (Actor or null) |+| Capabilities | `models` (each `id`, `name`, `efforts[]`, `contextWindow`, `default`), `modes[]`, `features` (`steer`, `compact`, `terminal`, `workspace`, `reasoning`, `subagents`) |+| Secret | `name`, `scope` (`session`, `me`, `organization`), `sessionId`, `file`, `effective`, `setBy`, `updatedAt` |+| Result | `type` (`result`), `subtype` (`success`, `error`, `cancelled`, `waiting`), `isError`, `sessionId`, `turnId`, `status`, `result`, `error`, `reason`, `ask`, `url`, `durationMs`, `usage`, `subagents` (SubagentSummary list), `turn` |++`Result` is what `opc -p --output-format json` prints for a turn. No operation reads or writes `Secret`.++## Errors++An error body is `code`, `message`, and optionally `status`, `retryable`, `requestId`, `field`, `reason` and `retryAfterMs`. HTTP wraps it as `{"error": {...}}`; WebSocket sends it as the `data` of a JSON-RPC error.++| JSON-RPC code | Meaning |+| --- | --- |+| `-32700` | The message is not JSON |+| `-32600` | Not a JSON-RPC request. Batches are not supported |+| `-32601` | Unknown method |+| `-32602` | Invalid params: `data` is `code: "invalid_request"`, `status: 400` and the `field` |+| `-32000` | An API error: `data` is the error body |++| Group | `code` values |+| --- | --- |+| Request | `invalid_request`, `unsupported_model`, `unsupported_effort`, `unsupported_mode`, `invalid_answer`, `answer_with_secret`, `invalid_path`, `invalid_archive`, `invalid_cursor`, `too_large`, `upgrade_required` |+| Credential and access | `unauthenticated`, `forbidden`, `admin_required`, `insufficient_credits` |+| Not found | `not_found`, `session_not_found`, `turn_not_found`, `ask_not_found`, `subagent_not_found`, `terminal_not_found`, `path_not_found`, `secret_not_found` |+| Conflict | `id_conflict`, `idempotency_conflict`, `ask_closed`, `session_busy`, `turn_not_cancellable`, `queue_full`, `cursor_ahead`, `path_exists`, `subagent_ended`, `too_far_behind`, `too_many_attached`, `too_many_terminals`, `feature_unavailable`, `computer_not_set_up` |+| Retry later | `rate_limited`, `unavailable`, `computer_unavailable`, `internal` |++`forbidden` carries a `reason`: `missing_scope`, `read_only` or `terminal_owner_only`.++## Relay limits++Other limits are in [Limits and defaults](/reference/limits#api).++| Limit | Value |+| --- | --- |+| Sessions attached per connection | 20 |+| Message size | 1 MiB |+| Requests per connection | 100 per second, burst 100 |+| Connections per member | 50 |+| Unsent data per connection before close `4008` | 16 MiB |+| Unacknowledged backlog per attached session before `too_far_behind` | 8 MiB or 10,000 events |+| Terminals per session | 8 |+| Terminal input | 1 MiB per second |+| Terminal output frame | 64 KiB |+| Queued turns per session | 20 |+| Upload or download archive | 1 GiB unpacked, 100,000 entries |+| Single file read | 100 MiB |+| Idempotency key | 1 to 255 characters, kept 24 hours |++## WebSocket close codes++| Code | Cause |+| --- | --- |+| `1001` | Two pings missed. The relay pings every 30 seconds |+| `1009` | A message over 1 MiB |+| `1012` | The relay is restarting |+| `4001` | The credential expired or was revoked |+| `4008` | More than 16 MiB unsent |+| `4029` | More than 50 connections for one member |+| `4400` | The `opc.v1` subprotocol was not offered |+| `4503` | The relay has no signing key from the host yet. The reason is `{"retryAfterMs":2000}` |++{/* Sources: computer/schema/computer-api.v1.json (x-methods, x-eventTypes, $defs); computer/src/api/schema-methods.ts; computer/src/api/read-methods.ts (events.list default limit, idempotency 24 h); computer/src/wire/limits.ts; computer/src/wire/rpc.ts; computer/src/wire/relay.ts; computer/src/wire/files.ts; computer/src/wire/attachment.ts (detach reasons); computer/src/host/session-writer.ts and computer/src/runner/api/api.ts (QUEUE_MAX); computer/src/host/terminal.ts; computer/src/host/workspace-files.ts; opc/src/cli.rs (schema subcommand) */}diff --git a/docs/reference/configuration.mdx b/docs/reference/configuration.mdxnew file mode 100644index 00000000..51fdbdad--- /dev/null+++ b/docs/reference/configuration.mdx@@ -0,0 +1,181 @@+---+title: "Configuration"+description: "Every environment variable, by the process that reads it, with its default"+---++| Process | Where its variables are set |+|---|---|+| Gateway | The container's environment. From a checkout, also `.env` at the checkout's root; the environment wins over the file. |+| Host | `/etc/slack-presence/host.env` (root, mode 0600), read by `slack-presence-host.service`. Apply with `systemctl restart slack-presence-host`. |+| Runner | `host.env`. The host passes a [fixed list](#passed-from-the-host-to-runners) to each runner; runners started after the host restart get the new value. |++`provision.sh` rewrites `host.env` only when run with `SP_HOST_TOKEN`. It writes only the variables marked "written by `provision.sh`"; lines added by hand are lost.++## Gateway++| Variable | Default | Purpose |+|---|---|---|+| `PORT` | `3170`; the container image sets `8080` | Listen port, on all interfaces. |+| `SP_DB` | `./gateway.db`; the image sets `/data/gateway.db` | SQLite database path. |+| `SP_ORIGIN` | `http://localhost:<PORT>` | Public origin, for example `https://computer.example.com`. Used in Slack and GitHub callback URLs and the host URL. |+| `SP_STORE_KEY` | unset | Secret the encryption key for stored secrets is derived from (`openssl rand -hex 32`). Unset: `/setup` and people cannot store secrets. Changed: every stored secret is unreadable. |+| `SETUP_TOKEN` | unset | Token that signs in to `/setup`. |+| `GITHUB_ORG` | unset | GitHub organization that owns the GitHub App. Required for the GitHub step of `/setup`. |+| `SLACK_APP_NAME` | `Computer` | Name of the Slack app and bot that `/setup` creates, and the name the bot answers to. |+| `SP_HOST_TOKENS` | empty | Comma-separated host tokens accepted besides those `/setup` issues. |+| `SP_PEOPLE` | `[]` | JSON array of people, written to the people table at every start. |+| `PERMISSION_MODE` | `bypassPermissions` | [Permission mode](/slack/permission-modes) of new sessions: `default`, `acceptEdits`, `plan`, `auto` or `bypassPermissions`. |+| `SP_VERSION` | the checkout's commit, else `dev` | Version reported by `/healthz`. The image sets it from the `SP_VERSION` build argument. |+| `SP_TUNNEL` | unset | `1`: development mode. The gateway creates the Slack app itself behind an ngrok tunnel. |+| `NGROK_URL`, `PUBLIC_URL` | unset | With `SP_TUNNEL=1`: a reserved ngrok domain, or a public URL from another tunnel. |+| `SP_SLACK_API_URL` | Slack's API | Development only: base URL of the Slack Web API. |+| `SP_GITHUB_API_URL` | `https://api.github.com` | Development only: base URL of the GitHub API. |++### Credentials++`/setup` stores these in the database, encrypted. An environment variable of the same name wins.++| Group | Names |+|---|---|+| Slack app | `SLACK_APP_ID`, `SLACK_CLIENT_ID`, `SLACK_CLIENT_SECRET`, `SLACK_SIGNING_SECRET`, `SLACK_STATE_SECRET` |+| Slack app configuration token | `SLACK_CONFIG_TOKEN`, `SLACK_CONFIG_TOKEN_EXP`, `SLACK_CONFIG_REFRESH_TOKEN` |+| Slack installation | `SLACK_BOT_TOKEN`, `SLACK_BOT_USER_ID`, `SLACK_BOT_ID`, `SLACK_TEAM_ID` |+| GitHub App | `GITHUB_APP_ID`, `GITHUB_APP_SLUG`, `GITHUB_APP_OWNER`, `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GITHUB_WEBHOOK_SECRET`, `GITHUB_PRIVATE_KEY` |+| GitHub installation | `GITHUB_INSTALLATION_ID`, `GITHUB_INSTALLATION_ACCOUNT` |+| Model | `CLAUDE_CODE_OAUTH_TOKEN`, `ANTHROPIC_API_KEY` |++## Host++### Identity and connection++| Variable | Default | Purpose |+|---|---|---|+| `SP_GATEWAY_URL` | `ws://localhost:3171/host` | The gateway's host endpoint, `wss://<gateway>/host`. Written by `provision.sh`. |+| `SP_HOST_TOKEN` | unset | Bearer token for that endpoint, issued by `/setup`. Written by `provision.sh`. |+| `SP_HOST_ID` | the hostname; `provision.sh` writes `shared-vm` | Host id. The people table routes people to it: keep it when the VM is replaced. |+| `SP_DATA` | `/data` | Data directory. Set by the unit. |+| `SP_RUN` | `/run/slack-presence` | Directory of runner sockets. Set by the unit. |+| `SP_DEFINITION` | unset; the unit sets `/opt/slack-presence/current/definitions/computer.json` | Workspace definition used until the gateway sends one, which is saved under `<SP_DATA>/state/` and wins. |+| `SP_VERSION` | the checkout's commit | Release commit. The unit reads it from the release's `.sp-version.env`. |++### Runners++| Variable | Default | Purpose |+|---|---|---|+| `SP_IDLE_MS` | `7200000` | Milliseconds without a message before the host stops a runner. |+| `SP_POOL_SIZE` | `2` | Spare runners kept started for new sessions. `0`: no pool. |+| `SP_LAUNCH` | `systemd` on Linux, `detached` elsewhere | `systemd`: runners are transient systemd user units. `detached`: detached processes that log to `<SP_RUN>/logs/`. |+| `SP_SYSTEMD_RUN` | `systemd-run --user --slice=slack-presence-runners.slice -p MemoryHigh=<60% of RAM, at most 12G> -p MemoryMax=<75% of RAM, at most 16G>` | Command prefix that starts a runner unit. Setting it replaces the memory limits too. See Resource limits. |+| `SP_RUNNER_USER` | unset: runners run as the host's user | Start runners as this user through `sudo`. Where the host runs as `sp-host`, the install sets `agent`, with `SP_RUNNER_PATH`. |+| `SP_RUNNER_PATH` | unset | `PATH` of runners and workspace commands when `SP_RUNNER_USER` is set. |++### Workspaces++The four durations accept a number of seconds or a unit: `300`, `500ms`, `30s`, `5m`, `2h`, `1d`.++| Variable | Default | Purpose |+|---|---|---|+| `SP_FETCH_INTERVAL` | `5m` | Housekeeping period: clone, fetch, fast-forward, prune. |+| `SP_FETCH_TIMEOUT` | `2m` | Timeout of one housekeeping fetch. |+| `SP_FORK_FETCH_TIMEOUT` | `5s` | Timeout of the fetch at session start. On timeout the session starts from the refs already fetched. |+| `SP_FORK_FETCH_FRESH` | `60s` | Session start skips its fetch when the clone was fetched this recently and nothing was pushed since. `0`: always fetch. |+| `SP_FORK_RETENTION_DAYS` | `14` | Idle days before a session directory is removed, if it holds nothing uncommitted or unpushed. |+| `SP_ARTIFACTS_IDLE_HOURS` | `24` | Idle hours before a session's git-ignored build and dependency directories are removed. |++### Telemetry++| Variable | Default | Purpose |+|---|---|---|+| `SP_TELEMETRY_URL` | unset: records are validated and discarded | Collector base URL. Written by `provision.sh` when passed. |+| `SP_TELEMETRY_CREDENTIAL` | unset: records are spooled, not sent | The host's signed credential for the collector. Written by `provision.sh` when passed. |+| `SP_REGION` | `unknown` | Region label on telemetry records. Passed to runners. Written by `provision.sh` when passed. |+| `SP_SUBSTRATE` | unset | Label for where runners run, for example `vm`. Passed to runners. Written by `provision.sh` when passed. |++See Telemetry.++### Model proxy++| Variable | Default | Purpose |+|---|---|---|+| `SP_MODEL_PROXY` | unset; the `sp-host` install sets `/run/oc-modelproxy/control.sock` | The proxy's control socket. Unset: the host uses no proxy. |+| `SP_MODEL_SOCKET` | `/run/oc-modelproxy/api.sock` | The proxy's API socket, which the harness connects to. Passed to runners. |+| `SP_CODEX_BIN` | `/usr/local/lib/codex/bin/codex` | Codex CLI a Codex session runs. Passed to runners. |+| `SP_CODEX_PEER_CHECK` | `on` | `off`: any local process can use a Codex session's model connection. Only for hosts whose runners are not systemd units. Passed to runners. |++## Passed from the host to runners++The host sets each of these on every runner, to its own value or empty; a runner treats empty as unset. Nothing else from the host's environment reaches a runner. Credentials go over the runner's socket, not the environment.++| Variable | Default in the runner | Purpose |+|---|---|---|+| `MODEL` | `claude-opus-5-5` | Model id of the `default` tier. See [Models and harnesses](/slack/models-and-harnesses). |+| `SP_COMPACT_AT` | `120000` | Tokens in a turn's last request above which the conversation is compacted between turns. `0`: off. See Context and compaction. |+| `SP_CONTEXT_WINDOW` | `183000` | Tokens. Claude Code's auto-compact window, applied inside a turn. `0`: Claude Code's default. |+| `SP_PROMPT_CACHE_TTL` | `1h` on Anthropic's API; Claude Code's default through another base URL | Claude Code's prompt cache lifetime, `5m` or `1h`, for the conversation and its subagents. |+| `SP_PROMPT_GUARD` | on | `off`: the runner no longer withholds copies of its system prompt from its posts. |+| `FOLD_AT` | `4` | Progress cards in one Slack message before a long turn folds into its history. |+| `PERMISSION_MODE` | | Passed through; a session's mode comes from the gateway. |+| `SP_COMMITTER_NAME`, `SP_COMMITTER_EMAIL` | `Computer`, `[email protected]` | Committer identity of commits made in sessions. |+| `SP_REAL_GH`, `SP_REAL_OPENCOMPUTER` | found on `PATH` | The real `gh` and `opencomputer` binaries behind the shims in the release's `bin/`. |+| `SP_RUN`, `SP_DATA`, `SP_DEFINITION`, `SP_VERSION`, `SP_REGION`, `SP_SUBSTRATE`, `SP_MODEL_SOCKET`, `SP_CODEX_BIN`, `SP_CODEX_PEER_CHECK` | | As for the host, above. |+| `PATH`, `HOME`, `USER`, `SHELL`, `LANG`, `TMPDIR` | `TMPDIR`: the system temporary directory | The runner's process environment. |+| `CLAUDE_CONFIG_DIR`, `DISABLE_AUTOUPDATER` | | Read by Claude Code. |+| `GIT_CONFIG_GLOBAL`, `GIT_CONFIG_NOSYSTEM` | | Read by git. |+| `NODE_OPTIONS`, `NODE_PATH`, `NODE_EXTRA_CA_CERTS`, `LD_PRELOAD`, `LD_LIBRARY_PATH`, `BASH_ENV` | | Set, empty unless the host has a value, so a session cannot change them for later runners. |+| `HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY` and their lower-case forms | | Outbound proxy settings, as above. |+| `SP_FAKE_SLACK`, `SP_SLACK_API_URL` | | Development only. |++`WORKDIR` is also on the list and applies only in [one-machine mode](#one-machine-mode).++## API relay++Read by `slack-presence-wire.service`.++| Variable | Default | Purpose |+|---|---|---|+| `SP_WIRE_LISTEN` | `127.0.0.1:7071` | Address the relay listens on. |+| `SP_WIRE_SOCKET` | `<SP_RUN>/wire/wire.sock` | The host's socket the relay connects to. |+| `SP_RUN` | `/run/slack-presence` | As for the host. |+| `SP_VERSION` | `dev` | Release commit reported to clients. |+| `SP_REGION` | unset | Region reported to clients. |++## One-machine mode++`npm start` in a checkout runs everything in one process, with no gateway or host (see Run from source). It reads `.env` and these variables, plus `PORT`, `PERMISSION_MODE`, `MODEL`, `SLACK_APP_NAME`, `NGROK_URL`, `PUBLIC_URL`, `FOLD_AT`, `SP_COMPACT_AT`, `SP_CONTEXT_WINDOW` and `SP_PROMPT_CACHE_TTL`:++| Variable | Default | Purpose |+|---|---|---|+| `WORKDIR` | unset: `workspaces/<session>` in the checkout | One existing directory that every session works in. |+| `STREAMING` | on | `off`: replies update by message edits, not Slack's native streaming. |+| `FLUSH_MS` | `600` | Minimum milliseconds between timed flushes of a streamed reply. |++The host does not pass `STREAMING` and `FLUSH_MS` to runners, so on a computer they keep their defaults.++## `provision.sh` inputs++Read from the environment of each `provision.sh` run. See Host VM and Upgrade.++| Variable | Default | Purpose |+|---|---|---|+| `REPO_URL` | required | HTTPS clone URL of the code. |+| `REPO_REF` | `main` | Branch or tag to deploy. |+| `REPO_TOKEN` | unset | GitHub token for a private `REPO_URL`, used for this run only. |+| `CODE_ONLY` | `0` | `1`: skip apt packages and toolchains. |+| `SP_GATEWAY_URL`, `SP_HOST_TOKEN`, `SP_HOST_ID` | | With `SP_HOST_TOKEN`: written to `host.env`, and the host is started. Without: the existing `host.env` is kept. |+| `SP_TELEMETRY_URL`, `SP_TELEMETRY_CREDENTIAL`, `SP_REGION`, `SP_SUBSTRATE` | unset | Written to `host.env` with the above. |+| `SP_DEFINITION_NAME` | `computer` | The shipped `definitions/<name>.json` the host uses until the gateway sends a definition. Remembered across runs. |+| `CLOUD` | detected | `aws` or `none`. Selects how the data disk is found. |+| `DATA_VOLUME_ID` | unset | EC2: the EBS volume id of the data volume, needed on first use. |+| `DATA_DEVICE` | unset | Block device path of the data volume; overrides discovery. |+| `DATA_WAIT_SECS` | `900` | Seconds to wait for the data volume to be attached. |+| `FORMAT_IF_BLANK` | `1` | Format a data device with no partitions and no filesystem signature as ext4. `0`: fail instead. |+| `ALLOW_NO_DATA_VOLUME` | `0` | `1`: use a plain `/data` directory on the root disk. For throwaway test VMs. |+| `AGENT_UID` | `1500` | Uid and gid of the `agent` user. Must be the same on every VM that mounts the volume. |+| `NODE_MAJOR` | `24` | Node.js major version. |+| `GO_SERIES`, `GO_VERSION` | `1.27`, unset | Go series (latest patch) or an exact version. |+| `PLAYWRIGHT_VERSION` | `1.64.1` | Playwright version whose browser and libraries are installed. |+| `CODEX_VERSION` | `0.163.0` | Pinned Codex CLI version. |+| `INSTALL_DOCKER` | `0` | `1`: install Docker and add `agent` to the `docker` group, which is root-equivalent. |+| `WIRE_PORT` | `7071` | Loopback port of the API relay. |++{/* Sources: computer/src/gateway/main.ts; computer/src/env.ts; computer/src/setup/index.ts; computer/src/setup/secrets.ts (SECRET_NAMES, SP_STORE_KEY); computer/src/gateway/vault.ts; computer/src/gateway/routing.ts; computer/src/github/app.ts; computer/src/provision.ts; computer/Dockerfile; computer/src/host/main.ts; computer/src/host/launch.ts; computer/src/host/runner-limits.ts; computer/src/host/runner-user.ts; computer/src/host/model-access.ts; computer/src/protocol.ts (HOST_DATA, HOST_RUN); computer/src/workspaces/index.ts; computer/src/workspaces/idle.ts; computer/src/workspaces/definition.ts; computer/src/runner-env.ts; computer/src/runner/main.ts; computer/src/tiers.ts; computer/src/runner/harness/claude/shadow.ts; computer/src/runner/context-window.ts; computer/src/runner/cache-ttl.ts; computer/src/runner/prompt-guard.ts; computer/src/runner/timeline.ts; computer/src/runner/segment.ts; computer/src/workspace.ts; computer/src/main.ts; computer/src/wire/main.ts; computer/deploy/vm/provision.sh; computer/deploy/vm/host.env.example; computer/deploy/vm/sp-host.sh; computer/src/host/identity.ts */}diff --git a/docs/reference/limits.mdx b/docs/reference/limits.mdxnew file mode 100644index 00000000..7c1fbea7--- /dev/null+++ b/docs/reference/limits.mdx@@ -0,0 +1,77 @@+---+title: "Limits and defaults"+---++- **Configurable:** a variable from [Configuration](/reference/configuration), or "No" for a constant in the code.+- **Per runner:** the count resets when the session's runner restarts (idle exit, `!restart`).+- **Memory and CPU:** to change them, see Resource limits.++## Slack, sessions and the computer++| Area | Limit | Value | Set in | Configurable |+|---|---|---|---|---|+| Runners | Idle time before a runner exits | 2 hours | `src/host/main.ts` | `SP_IDLE_MS` |+| Runners | Spare runners kept for new sessions | 2 | `src/host/main.ts` | `SP_POOL_SIZE` |+| Runners | Gateway's wait for the host to start a runner | 30 s | `src/gateway/hosts.ts` | No |+| Memory | One runner, `MemoryHigh` / `MemoryMax` | 60% / 75% of RAM, at most 12G / 16G | `src/host/runner-limits.ts` | `SP_SYSTEMD_RUN` |+| Memory | All runners together, `MemoryMax` | 93% of (RAM minus a reserve of 10% of RAM, at least 1024 MiB) | `deploy/vm/limits.sh` | No |+| Memory | All runners together, `MemoryHigh` | 93% of its `MemoryMax` | `deploy/vm/limits.sh` | No |+| Memory | Everything the agent user runs (`user-1500.slice`), `MemoryMax` | RAM minus a reserve of 10% of RAM, at least 1024 MiB | `deploy/vm/limits.sh` | No |+| Memory | Everything the agent user runs, `MemoryHigh` | 93% of its `MemoryMax` | `deploy/vm/limits.sh` | No |+| Memory | API relay, `MemoryMax` | 256M | `deploy/vm/provision.sh` | No |+| Memory | Host, `MemoryMax` | RAM / 8, between 768 MiB and 2048 MiB | `deploy/vm/limits.sh` | No |+| CPU | All runners together, `CPUQuota` | (CPUs - 2) x 100%, at least 100% | `deploy/vm/limits.sh` | No |+| CPU | Everything the agent user runs, `CPUQuota` | (CPUs - 1) x 100%, at least 100% | `deploy/vm/limits.sh` | No |+| CPU | One runner | no limit | | |+| Processes | All runners together, `TasksMax` | 16384 | `deploy/vm/limits.sh` | No |+| Processes | Everything the agent user runs, `TasksMax` | 20000 | `deploy/vm/limits.sh` | No |+| Processes | API relay, `TasksMax` | 256 | `deploy/vm/provision.sh` | No |+| Gateway | Messages kept for an offline host | 24 hours | `src/gateway/db.ts` | No |+| Gateway | Host reconnect backoff | 1 s, doubling to 30 s, with jitter | `src/host/gateway-link.ts` | No |+| Gateway | `/setup` sign-in cookie lifetime | 12 hours | `src/setup/index.ts` | No |+| Git | Housekeeping period (clone, fetch, fast-forward, prune) | 5 min | `src/workspaces/index.ts` | `SP_FETCH_INTERVAL` |+| Git | Housekeeping fetch timeout | 2 min | `src/workspaces/index.ts` | `SP_FETCH_TIMEOUT` |+| Git | Housekeeping fetches at once | 4 | `src/workspaces/index.ts` | No |+| Git | Fetch timeout at session start | 5 s | `src/workspaces/index.ts` | `SP_FORK_FETCH_TIMEOUT` |+| Git | Session start skips its fetch if the clone was fetched within | 60 s | `src/workspaces/index.ts` | `SP_FORK_FETCH_FRESH` |+| Git | Clone and setup command timeout | 30 min | `src/workspaces/index.ts` | No |+| Git | Idle session directory removed after, if nothing is uncommitted or unpushed | 14 days | `src/workspaces/index.ts` | `SP_FORK_RETENTION_DAYS` |+| Git | Idle session's build and dependency directories removed after | 24 hours | `src/workspaces/idle.ts` | `SP_ARTIFACTS_IDLE_HOURS` |+| Context | Compaction between turns starts above | 120,000 tokens | `src/runner/harness/claude/shadow.ts` | `SP_COMPACT_AT` |+| Context | Compaction after an idle period | 40 min idle, above 60,000 tokens | `src/runner/harness/claude/shadow.ts` | Token threshold follows `SP_COMPACT_AT` when that is lower |+| Context | Compaction attempts | at most 3 per hour, 2 min apart | `src/runner/harness/claude/shadow.ts` | No |+| Context | Claude Code auto-compact window (inside a turn) | 183,000 tokens; compacts at about the window minus 33,000 | `src/runner/context-window.ts` | `SP_CONTEXT_WINDOW` |+| Context | Prompt cache lifetime | 1 hour on Anthropic's API | `src/runner/cache-ttl.ts` | `SP_PROMPT_CACHE_TTL` |+| Slack output | Interval between flushes of a streamed reply | 600 ms | `src/runner/segment.ts` | `FLUSH_MS` (one-machine mode) |+| Slack output | Reply length before a new message is started | 9,000 characters at a break, 10,000 at most | `src/runner/segment.ts` | No |+| Slack output | Progress cards in a message before the turn folds into its history | 4 | `src/runner/timeline.ts` | `FOLD_AT` |+| Slack output | `!diff` output | first 11,000 characters | `src/runner/commands.ts` | No |+| Slack input | Images passed to the model inline | PNG, JPEG, GIF or WebP up to 5 MiB | `src/runner/attachments.ts` | No |+| Slack input | Linked Slack threads read from one message | 3 | `src/links.ts` | No |+| Slack input | Content read from one linked thread | first message plus the latest 40 replies, 16,000 characters, 4,000 per message | `src/links.ts` | No |+| Slack input | Wait for linked threads before the message is delivered without them | 10 s | `src/gateway/routing.ts` | No |+| Agent tools | Threads started with `spawn_thread` | 8 per runner | `src/runner/spawn.ts` | No |+| Agent tools | Posts to other threads with `post_thread` | 20 per runner, 4,000 characters each | `src/runner/threads.ts` | No |+| Agent tools | Secrets asked for with `request_secret` | 10 per runner | `src/runner/session-secrets.ts` | No |+| Agent tools | Threads read with `read_thread` | 40 per runner | `src/runner/threads.ts` | No |+| Agent tools | Files posted with `send_file` | 50 per runner, 100 MiB each, not empty | `src/runner/send-file.ts` | No |+| Agent tools | Cards posted with `post_card` | 50 per runner | `src/runner/post-card.ts` | No |+| Agent tools | Gateway time for one thread read or post | 25 s | `src/gateway/threads.ts` | No |+| Secrets | Secret or variable value | 64 KiB | `src/gateway/vault.ts` | No |+| Secrets | Value typed into the Slack form | 3,000 characters (Slack's input limit) | `src/gateway/secrets-ui.ts` | No |+| Secrets | Value set with `!var` | 3,000 characters | `src/variables.ts` | No |+| Secrets | Inactive session's session-scoped secrets deleted after | 30 days | `src/gateway/vault.ts` | No |+| Telemetry | Spool on disk | 100 MB | `src/host/telemetry-spool.ts` | No |+| Releases | Superseded release removed by `provision.sh` after | 2 days, when no process uses it | `deploy/vm/provision.sh` | No |+| Data volume | Filesystem growth check | 1 min after boot, then every 10 min | `deploy/vm/grow-data.sh` | No |++## API++Connection, terminal, file and queue limits: [API schema](/reference/api-schema#relay-limits). None is configurable.++| Limit | Value | Set in |+|---|---|---|+| Forced cancel after an interrupt the harness does not act on | 10 s | `src/runner/api/api.ts` |+| Wait for a suspended session's runner to start | 60 s | `src/host/api-wake.ts` |++{/* Sources: computer/src/host/main.ts; computer/src/host/pool.ts; computer/src/host/adoption.ts; computer/src/host/runner-limits.ts; computer/src/host/gateway-link.ts; computer/src/host/telemetry-spool.ts; computer/src/host/telemetry-ship.ts; computer/src/host/terminal.ts; computer/src/host/tar-check.ts; computer/src/host/workspace-files.ts; computer/src/host/api-wake.ts; computer/src/gateway/hosts.ts; computer/src/gateway/db.ts; computer/src/gateway/vault.ts; computer/src/gateway/secrets-ui.ts; computer/src/gateway/threads.ts; computer/src/gateway/routing.ts; computer/src/setup/index.ts; computer/src/github/app.ts; computer/src/workspaces/index.ts; computer/src/workspaces/idle.ts; computer/src/runner/harness/claude/shadow.ts; computer/src/runner/context-window.ts; computer/src/runner/cache-ttl.ts; computer/src/runner/segment.ts; computer/src/runner/timeline.ts; computer/src/runner/agents.ts; computer/src/runner/commands.ts; computer/src/runner/attachments.ts; computer/src/runner/spawn.ts; computer/src/runner/threads.ts; computer/src/runner/send-file.ts; computer/src/runner/post-card.ts; computer/src/runner/api/api.ts; computer/src/runner/session-secrets.ts; computer/src/links.ts; computer/src/variables.ts; computer/src/wire/limits.ts; computer/deploy/vm/limits.sh; computer/deploy/vm/provision.sh; computer/deploy/vm/grow-data.sh */}diff --git a/docs/reference/slack-commands.mdx b/docs/reference/slack-commands.mdxnew file mode 100644index 00000000..d426e703--- /dev/null+++ b/docs/reference/slack-commands.mdx@@ -0,0 +1,88 @@+---+title: "Slack commands"+description: "A thread message starting with `!` is a command the model does not see; `!!`, `+<tier>` and `ch` are prefixes"+---++Command words are not case-sensitive. An unknown command answers ``unknown command `!x`, try `!help` ``.++## Session commands++| Command | Arguments | Effect |+| --- | --- | --- |+| `!help` | none | Lists the commands, the current model and mode. |+| `!stop`, `!esc` | none | Stops the current turn and cancels its open approval prompts and questions. |+| `!mode` | a [mode name](#mode-names) | Sets the [permission mode](/slack/permission-modes). An unknown name lists the modes. |+| `!model` | `smart`, `fast`, `default`, or a model id | Switches the model from the next model request, including mid-turn. Kept across restarts. No argument: shows the model and the choices. |+| `!effort` | `low`, `medium`, `high`, `xhigh`, `max` | Sets reasoning effort. Default `medium`. No or invalid argument: shows the level and the choices. |+| `!speed` | `fast`, `standard` | Sets output speed. Default `fast`: Claude's fast mode on models that have it. No argument: shows the value. |+| `!status` | none | Shows model, effort (once set), mode (unless `bypassPermissions`), context use, cost, thread id, session directory, harness session id and Computer's commit. |+| `!diff` | none | Shows the session directory's `git diff`. In a workspace session it answers `no changes`. |+| `!restart` | none | After the current turn, restarts the runner on the newest deployed version. The conversation carries over. Not in one-machine mode (`npm start`). |+| `!done` | none | Archives a code channel. In a thread it only answers that this is a thread. |++### Mode names++| `!mode` argument | Mode |+| --- | --- |+| `default`, `ask` | `default` |+| `accept`, `acceptedits`, `edits` | `acceptEdits` |+| `plan` | `plan` |+| `auto` | `auto` |+| `bypass`, `yolo` | `bypassPermissions` |++A new session starts in `bypassPermissions` unless the gateway's `PERMISSION_MODE` says otherwise.++## Message prefixes++| Prefix | Effect | Notes |+| --- | --- | --- |+| `!! <text>` | Interrupts the running turn and sends `<text>` as the next message. | No turn running: an ordinary message. A tier may follow: `!! +fast summarize what you have`. |+| `+smart`, `+fast`, `+default` | Switches the session's model and sends the rest to the agent. | A tier alone only switches. Not case-sensitive. Same mapping as `!model smart`. |+| `@computer ch <task>`, `@computer channel <task>` | Runs the session in a new code channel. | New mention only, not in a direct message. A tier may come before or after `ch`. If the channel cannot be created, the session runs in the thread. |++A message without `!!` reaches the running turn at its next tool boundary. See [Messages during a turn](/slack/mid-turn-messages).++## Model tiers++| Tier | Claude Code | Codex |+| --- | --- | --- |+| `+smart` | `claude-fable-5-2` | `gpt-6-astra` |+| `+fast` | `claude-sonnet-5-5` | `gpt-6-luna` |+| `+default` | The host's `MODEL` setting, else `claude-opus-5-5` | `gpt-6.1-sol` |++In a Codex session `!effort` also accepts `ultra`, and `!speed fast` selects Codex's priority tier.++## Secrets++`!secret` and `!secrets` are the same command. The gateway handles it: the message never reaches the session, and only the sender sees the answers. Not in one-machine mode (`npm start`). See [Secrets and variables](/slack/secrets-and-variables).++| Command | Effect |+| --- | --- |+| `!secret`, `!secret list`, `!secret ls` | Lists secret names by scope, never values. |+| `!secret help` | Shows the usage. |+| `!secret NAME`, `!secret set NAME`, `!secret add NAME` | Shows a button that opens a private form for the value, its scope, and whether it is a file. |+| `!secret NAME file`, `!secret set NAME file` | The same, with the file option already chosen. |+| `!secret rm NAME [scope]` (also `remove`, `delete`, `unset`) | Removes the secret from the scope. No scope: the narrowest scope that has it. |++| Scope | Covers |+| --- | --- |+| `session` | The session. |+| `me`, `user` | Every session the person owns. |+| `workspace` | The workspace. Admins only. |++The narrowest scope that has the name wins.++## Variables++`!var`, `!vars`, `!variable` and `!variables` are the same command, handled by the gateway like `!secret`. Lists show values.++| Command | Effect |+| --- | --- |+| `!var`, `!var list`, `!var ls` | Lists names and values, by scope. |+| `!var help` | Shows the usage. |+| `!var NAME value [scope]`, `!var NAME=value [scope]`, `!var set NAME value [scope]` (also `add`) | Sets a variable. The value may be wrapped in backticks or a code block. At most 3,000 characters. |+| `!var rm NAME [scope]` (also `remove`, `delete`, `unset`) | Removes the variable from the scope. |++Scopes: `session` (the default in a session's thread), `me` or `user` (the default elsewhere), `workspace` or `org` (admins only). A name or value that looks like a credential asks for confirmation. A secret and a variable cannot share a name in one scope.++{/* Sources: computer/src/runner/commands.ts; computer/src/runner/help.ts; computer/src/runner/session.ts; computer/src/tiers.ts; computer/src/runner/model-switch.ts; computer/src/runner/format.ts (statusLine); computer/src/runner-env.ts (MODEL); computer/src/workspace.ts (gitDiff); computer/src/gateway/routing.ts; computer/src/gateway/secrets-ui.ts; computer/src/variables.ts; computer/src/gateway/variables-ui.ts; computer/src/gateway/main.ts (PERMISSION_MODE); computer/src/main.ts */}diff --git a/docs/self-hosting/aws.mdx b/docs/self-hosting/aws.mdxnew file mode 100644index 00000000..060d67df--- /dev/null+++ b/docs/self-hosting/aws.mdx@@ -0,0 +1,144 @@+---+title: "On AWS"+description: "Deploy the app and gateway Workers on Cloudflare, and create each organization's Computer VM on EC2 yourself"+---++On AWS the gateway runs with `COMPUTER_VMS` set to `self-managed`: it creates no VMs. You create one EC2 instance per organization, and the instance connects out to the gateway with that organization's host token.++| The gateway | You |+| --- | --- |+| Shows the Computer as `Online` while its VM is connected and `Offline` otherwise | Create, size, stop, start and delete the VM |+| Holds a Slack message that arrives while the VM is offline, says so once in the thread, and runs it when the VM connects | Start the VM again |++The examples use `app.example.com` and `gateway.example.com`, as in [On Azure](/self-hosting/azure).++## 1. Get the code++```bash+git clone https://github.com/diggerhq/opencomputer.git+cd opencomputer+(cd services/managed-agents && npm ci)+(cd cloudflare-workers/api-edge && npm ci)+(cd web && npm ci)+```++## 2. Create the Cloudflare resources and the apps++Follow two steps of the Azure guide unchanged:++- [Create the Cloudflare resources](/self-hosting/azure#2-create-the-cloudflare-resources)+- [Create the WorkOS, Slack and GitHub apps](/self-hosting/azure#3-create-the-workos-slack-and-github-apps)++## 3. Deploy the gateway Worker++Follow [Deploy the gateway Worker](/self-hosting/azure#4-deploy-the-gateway-worker) unchanged. Keep the value of `COMPUTER_HOST_TOKEN_KEY` at hand: step 6 derives each organization's host token from it.++## 4. Deploy the app Worker++Follow [Deploy the app Worker](/self-hosting/azure#5-deploy-the-app-worker) unchanged.++## 5. Build and upload the Computer release++From the repository root:++```bash+computer/deploy/bundle.sh /tmp/calvin.bundle++export AWS_REGION=us-east-1+export BUCKET=<globally unique>+aws s3 mb "s3://$BUCKET" --region "$AWS_REGION"+aws s3 cp /tmp/calvin.bundle "s3://$BUCKET/calvin.bundle"+```++The bundle holds the Computer source and the model proxy built for Linux amd64. The bucket stays private; step 7 gives the VM a URL that is valid for one hour.++## 6. Get the organization ID and make the host token++1. Open `https://app.example.com` and sign in.+2. Open **Settings** and copy the **Organization ID**.+3. Derive the organization's host token from `COMPUTER_HOST_TOKEN_KEY`:++```bash+export ORG_ID='<ORGANIZATION_ID>'+export COMPUTER_HOST_TOKEN_KEY='<the gateway secret>'++export TOKEN="sph_$(printf 'calvin-host:%s' "$ORG_ID" \+ | openssl dgst -sha256 -hmac "$COMPUTER_HOST_TOKEN_KEY" -binary \+ | base64 | tr '+/' '-_' | tr -d '=')"+```++The token is valid for that organization only, and for as long as the key does not change.++## 7. Create the VM++The VM is Ubuntu 24.04 on amd64 with a second, blank EBS volume for `/data`. It needs outbound internet access and no inbound access: a new security group has no inbound rules.++Make a download URL for the release, then write the VM's first-boot script with `self-managed-user-data.sh`. The script it prints stores the gateway URL and the token in a root-only file on the VM, downloads the release and runs its boot script:++```bash+export BUNDLE_URL="$(aws s3 presign "s3://$BUCKET/calvin.bundle" --expires-in 3600 --region "$AWS_REGION")"++(umask 077; GATEWAY_HOST=gateway.example.com \+ computer/deploy/vm/self-managed-user-data.sh > computer-user-data.sh)+```++Create the security group and the instance in the default VPC:++```bash+AMI="$(aws ssm get-parameter --region "$AWS_REGION" --query Parameter.Value --output text \+ --name /aws/service/canonical/ubuntu/server/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id)"++SG="$(aws ec2 create-security-group --region "$AWS_REGION" --group-name computer \+ --description 'Computer VMs: no inbound' --query GroupId --output text)"++aws ec2 run-instances --region "$AWS_REGION" \+ --image-id "$AMI" --instance-type m7i.large \+ --security-group-ids "$SG" \+ --block-device-mappings \+ 'DeviceName=/dev/sda1,Ebs={VolumeSize=64,VolumeType=gp3}' \+ 'DeviceName=/dev/sdf,Ebs={VolumeSize=128,VolumeType=gp3,DeleteOnTermination=false}' \+ --metadata-options HttpTokens=required \+ --tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=computer},{Key=organization,Value=$ORG_ID}]" \+ --user-data file://computer-user-data.sh \+ --query 'Instances[0].InstanceId' --output text+```++The first boot installs the toolchains, formats the blank volume, mounts it at `/data` and starts the host. It takes about five minutes. The boot script formats a volume only when it is blank.++The token stays in the instance's user data. On the VM only root can read it; in AWS, anyone allowed to call `ec2:DescribeInstanceAttribute` can.++## 8. Add the Slack app and connect GitHub++1. Open `https://app.example.com`. The Computer shows `Online` once the VM has connected.+2. Click **Add to Slack** and approve.+3. Connect GitHub and choose the repositories.+4. Mention `@computer` in a channel.++Repeat steps 6 and 7 for each further organization.++## Stop, start and resize++Stop the instance with `aws ec2 stop-instances`; the Computer shows `Offline` and Slack messages wait. Start it with `aws ec2 start-instances`; the host reconnects and the workspace is still on `/data`. To resize, stop the instance, change its type with `aws ec2 modify-instance-attribute`, and start it.++Terminating the instance does not delete the data volume.++## Check a VM++The VM has no SSH access. The boot log is `/var/log/calvin-boot.log`, and the two services are `slack-presence-host` and `oc-modelproxy`. From a root shell on the VM, for example through AWS Systems Manager Session Manager (the instance then needs an instance profile with the `AmazonSSMManagedInstanceCore` policy):++```bash+systemctl is-active slack-presence-host.service oc-modelproxy.service+tail -50 /var/log/calvin-boot.log+```++## Update a VM++A self-managed VM does not update itself. Build and upload a new bundle (step 5), download it to `/opt/bootstrap/calvin.bundle` on the VM, and run as root:++```bash+git -C /opt/bootstrap/calvin-src fetch -q /opt/bootstrap/calvin.bundle main+git -C /opt/bootstrap/calvin-src checkout -q -f --detach FETCH_HEAD+CODE_ONLY=1 BOOTSTRAP_FETCH=0 bash /opt/bootstrap/calvin-src/deploy/vm/azure-computer-boot.sh+```++{/* Sources: services/managed-agents/src/computer/config.ts (COMPUTER_VMS, selfManagedVms, missingEdgeConfig, hostUrl); services/managed-agents/src/computer/lifecycle.ts (createSelfManaged, park, resize, delete); services/managed-agents/src/computer/durable-object.ts (hello, ensureAwake, offline notice); services/managed-agents/src/computer/host-token.ts; services/managed-agents/src/computer/routes.ts (hostRoute); web/src/pages/Settings.tsx:168 (Organization ID); web/src/managed-agents/computer-state.ts (Online, Offline); computer/deploy/bundle.sh; computer/deploy/vm/self-managed-user-data.sh; computer/deploy/vm/azure-computer-boot.sh (env file, BOOTSTRAP_FETCH, CODE_ONLY); computer/deploy/vm/provision.sh (DATA_DEVICE, format only when blank, metadata block for the agent user); computer/deploy/vm/self-update.sh (no update without a calvin-latest.bundle URL). Run on 2026-11-13 against a local gateway with an Ubuntu 24.04 VM on Azure made with self-managed-user-data.sh: boot, connect, offline, reconnect and update. The aws commands have not been run. */}diff --git a/docs/self-hosting/azure.mdx b/docs/self-hosting/azure.mdxnew file mode 100644index 00000000..84c6cfeb--- /dev/null+++ b/docs/self-hosting/azure.mdx@@ -0,0 +1,255 @@+---+title: "On Azure"+description: "Deploy the app and gateway Workers on Cloudflare, and create each organization's Computer VM in Azure yourself"+---++This page deploys the stack described in [Start here](/self-hosting/overview). The gateway runs with `COMPUTER_VMS` set to `self-managed`: it creates no VMs. You create one Azure VM per organization, and the VM connects out to the gateway with that organization's host token.++| The gateway | You |+| --- | --- |+| Shows the Computer as `Online` while its VM is connected and `Offline` otherwise | Create, size, stop, start and delete the VM |+| Holds a Slack message that arrives while the VM is offline, says so once in the thread, and runs it when the VM connects | Start the VM again |++The examples use two hostnames on your Cloudflare zone:++| Placeholder | Serves |+| --- | --- |+| `app.example.com` | The app Worker: dashboard, sign-in, Slack and GitHub callbacks |+| `gateway.example.com` | The gateway Worker: sessions and the VMs' WebSocket |++## 1. Get the code++```bash+git clone https://github.com/diggerhq/opencomputer.git+cd opencomputer+(cd services/managed-agents && npm ci)+(cd cloudflare-workers/api-edge && npm ci)+(cd web && npm ci)+```++## 2. Create the Cloudflare resources++```bash+npx wrangler login+npx wrangler d1 create computer-app+npx wrangler d1 create computer-gateway+npx wrangler kv namespace create WIRE_KEYS+npx wrangler kv namespace create SESSIONS_KV+npx wrangler r2 bucket create managed-agents-session-log+```++Note each ID; the next steps put them into the Workers' configuration files.++## 3. Create the WorkOS, Slack and GitHub apps++The URLs below use `https://app.example.com`.++**WorkOS.** Create an application with redirect URI `https://app.example.com/auth/callback`, and set the sign-out redirect to `https://app.example.com` in the WorkOS dashboard. Keep the API key and client ID.++**Slack.** Create a Slack app with:++| Setting | Value |+| --- | --- |+| OAuth redirect URL | `https://app.example.com/api/managed-agents/computer/slack/callback` |+| Event request URL | `https://app.example.com/api/managed-agents/computer/slack/events` |+| Interactivity request URL | `https://app.example.com/api/managed-agents/computer/slack/interactivity` |++Bot token scopes:++```text+app_mentions:read assistant:write channels:history channels:read channels:manage+groups:history groups:read groups:write im:history im:read im:write chat:write+files:read files:write reactions:write users:read users:read.email+```++Bot events: `app_mention`, `message.im`, `message.channels`, `message.groups`, `app_uninstalled`, `tokens_revoked`, `team_leave`, `user_change`, and `agent_session_stopped` if Slack offers it. Keep the client ID, client secret and signing secret.++**GitHub.** Create a GitHub App with:++| Setting | Value |+| --- | --- |+| Callback URL | `https://app.example.com/api/managed-agents/github/callback` |+| Webhook URL | `https://app.example.com/api/managed-agents/github/webhooks` |+| Repository permissions | Metadata: read. Contents: read and write. Pull requests: read and write. Checks: write. |+| Events | Installation, Installation repositories, Repository, Push, Pull request |++Generate a private key. Keep the app ID, slug, client ID, client secret, webhook secret and private key.++## 4. Deploy the gateway Worker++Start from `services/managed-agents/wrangler.production.jsonc` and edit:++| Field | Value |+| --- | --- |+| `name`, `account_id`, `routes` | Your Worker name, account, and `gateway.example.com` as a custom domain |+| `COMPUTER_VMS` | Add it, with the value `self-managed` |+| `COMPUTER_PUBLIC_ORIGIN`, `OPENCOMPUTER_APP_URL` | `https://app.example.com` |+| `SLACK_COMPUTER_CLIENT_ID` | Add it, with the Slack client ID |+| `OC_GITHUB_APP_ID`, `OC_GITHUB_APP_SLUG`, `OC_GITHUB_APP_CLIENT_ID` | From the GitHub App |+| D1, KV and R2 bindings | The `computer-gateway` database, `WIRE_KEYS` namespace and `managed-agents-session-log` bucket from step 2 |+| `services`, `tail_consumers` | Remove both blocks |+| `COMPUTER_HOST_GATEWAY_URL`, `COMPUTER_DEFAULT_SIZE`, `COMPUTER_POOL_SIZE` | Remove. They are not used. |++Write the secrets to a JSON file with mode `0600`:++| Secret | Value |+| --- | --- |+| `OC_MANAGED_AGENTS_SECRET`, `OC_MANAGED_CRED_HMAC_SECRET`, `BLUE_USAGE_HMAC_SECRET`, `BLUE_SESSION_INDEX_ADMIN_SECRET` | `openssl rand -hex 32` each |+| `BLUE_CHANNEL_ENCRYPTION_KEY`, `COMPUTER_HOST_TOKEN_KEY` | `openssl rand -base64 32` each |+| `SLACK_COMPUTER_CLIENT_SECRET`, `SLACK_COMPUTER_SIGNING_SECRET` | From the Slack app |+| `OC_GITHUB_APP_PRIVATE_KEY`, `OC_GITHUB_APP_CLIENT_SECRET`, `OC_GITHUB_APP_WEBHOOK_SECRET` | From the GitHub App |+| `COMPUTER_ANTHROPIC_API_KEY` | Your Anthropic API key |++Keep the value of `COMPUTER_HOST_TOKEN_KEY` at hand: step 7 derives each organization's host token from it.++```bash+cd services/managed-agents+npx wrangler d1 migrations apply computer-gateway --remote --config wrangler.production.jsonc+npx wrangler deploy --config wrangler.production.jsonc --secrets-file gateway-secrets.json+curl https://gateway.example.com/health+```++## 5. Deploy the app Worker++In `cloudflare-workers/api-edge/wrangler.toml`:++- Set `name`, `account_id`, and the route to `app.example.com`.+- Set the D1 binding to `computer-app` and the KV binding to `SESSIONS_KV`.+- Set the `CREDIT_ACCOUNT` binding's `script_name` to this Worker's name.+- Set `COMPUTER_ENABLED_FOR_ALL = "true"` and `MANAGED_AGENTS_API_URL = "https://gateway.example.com"`.+- Remove `tail_consumers`.++Secrets, in a second `0600` JSON file:++| Secret | Value |+| --- | --- |+| `WORKOS_API_KEY`, `WORKOS_CLIENT_ID` | From WorkOS |+| `OC_MANAGED_AGENTS_SECRET`, `OC_MANAGED_CRED_HMAC_SECRET` | The same values as the gateway |+| `AGENT_RUNTIME_USAGE_HMAC_SECRET` | The gateway's `BLUE_USAGE_HMAC_SECRET` |+| `SESSION_JWT_SECRET`, `CF_ADMIN_SECRET`, `SECRET_ENCRYPTION_KEY`, `EVENT_SECRET` | `openssl rand -hex 32` each |++Build the dashboard into the Worker's assets, create the schema and deploy:++```bash+cd web && npm run build && cp -r dist/. ../cloudflare-workers/api-edge/assets/+cd ../cloudflare-workers/api-edge+npx wrangler d1 execute computer-app --remote -c wrangler.toml --file schema-snapshots/current_schema.sql+npx wrangler d1 migrations apply computer-app --remote -c wrangler.toml+npx wrangler deploy -c wrangler.toml --secrets-file app-secrets.json+curl https://app.example.com/health+```++## 6. Build and upload the Computer release++From the repository root:++```bash+computer/deploy/bundle.sh /tmp/calvin.bundle++az login+az account set --subscription '<SUBSCRIPTION>'++export REGION=eastus+export RG=computers+export STORAGE_ACCOUNT=<globally unique, lowercase>++az group create -n "$RG" -l "$REGION"+az storage account create -n "$STORAGE_ACCOUNT" -g "$RG" -l "$REGION" \+ --sku Standard_LRS --allow-blob-public-access false+az storage container create --account-name "$STORAGE_ACCOUNT" -n bootstrap --auth-mode key+az storage blob upload --account-name "$STORAGE_ACCOUNT" -c bootstrap \+ -n calvin.bundle -f /tmp/calvin.bundle --auth-mode key --overwrite+```++The bundle holds the Computer source and the model proxy built for Linux amd64. The container stays private; step 8 gives the VM a URL that is valid for one hour.++## 7. Get the organization ID and make the host token++1. Open `https://app.example.com` and sign in.+2. Open **Settings** and copy the **Organization ID**.+3. Derive the organization's host token from `COMPUTER_HOST_TOKEN_KEY`:++```bash+export ORG_ID='<ORGANIZATION_ID>'+export COMPUTER_HOST_TOKEN_KEY='<the gateway secret>'++export TOKEN="sph_$(printf 'calvin-host:%s' "$ORG_ID" \+ | openssl dgst -sha256 -hmac "$COMPUTER_HOST_TOKEN_KEY" -binary \+ | base64 | tr '+/' '-_' | tr -d '=')"+```++The token is valid for that organization only, and for as long as the key does not change.++## 8. Create the VM++The VM is Ubuntu 24.04 on amd64 with a second, blank disk for `/data`. It needs outbound internet access and no inbound access.++Make a download URL for the release, then write the VM's first-boot script with `self-managed-user-data.sh`. The script it prints stores the gateway URL and the token in a root-only file on the VM, downloads the release and runs its boot script:++```bash+EXPIRY="$(date -u -d '+1 hour' +%Y-%m-%dT%H:%MZ 2>/dev/null || date -u -v+1H +%Y-%m-%dT%H:%MZ)"+export BUNDLE_URL="$(az storage blob generate-sas --account-name "$STORAGE_ACCOUNT" \+ -c bootstrap -n calvin.bundle --permissions r --expiry "$EXPIRY" \+ --https-only --full-uri --auth-mode key -o tsv)"++(umask 077; GATEWAY_HOST=gateway.example.com \+ computer/deploy/vm/self-managed-user-data.sh > computer-user-data.sh)+```++Create the VM. `az vm create` also creates a virtual network, a public IP address for outbound traffic, and a network security group; `--nsg-rule NONE` leaves that group without a rule that allows inbound traffic.++```bash+az vm create -g "$RG" -n computer-1 -l "$REGION" \+ --image Canonical:ubuntu-24_04-lts:server:latest \+ --size Standard_D2as_v5 \+ --os-disk-size-gb 64 --data-disk-sizes-gb 128 \+ --nsg-rule NONE \+ --admin-username azureuser --generate-ssh-keys \+ --custom-data computer-user-data.sh \+ --tags organization="$ORG_ID"+```++Any amd64 size with 2 vCPUs and 8 GiB of memory or more works; `az vm list-skus -l "$REGION" --size Standard_D2 -o table` lists the sizes your subscription can use.++The first boot installs the toolchains, formats the blank disk, mounts it at `/data` and starts the host. It takes about six minutes. The boot script formats a disk only when it is blank.++The token stays in the VM's custom data. On the VM only root can read it; Azure does not return custom data once the VM exists.++## 9. Add the Slack app and connect GitHub++1. Open `https://app.example.com`. The Computer shows `Online` once the VM has connected.+2. Click **Add to Slack** and approve.+3. Connect GitHub and choose the repositories.+4. Mention `@computer` in a channel.++Repeat steps 7 and 8 for each further organization, with another VM name.++## Stop, start and resize++Stop the VM with `az vm deallocate`; the Computer shows `Offline` and Slack messages wait. Start it with `az vm start`; the host reconnects and the workspace is still on `/data`. To resize, run `az vm resize` with the new size.++`az vm delete` does not delete the data disk.++## Check a VM++No rule allows SSH. The boot log is `/var/log/calvin-boot.log`, and the two services are `slack-presence-host` and `oc-modelproxy`. Run checks with Azure Run Command:++```bash+az vm run-command invoke -g "$RG" -n computer-1 --command-id RunShellScript --scripts \+ "systemctl is-active slack-presence-host.service oc-modelproxy.service; tail -50 /var/log/calvin-boot.log"+```++## Update a VM++A self-managed VM does not update itself. Build and upload a new bundle (step 6), make a new `BUNDLE_URL` (step 8), and run:++```bash+az vm run-command invoke -g "$RG" -n computer-1 --command-id RunShellScript --scripts "+set -e+curl -fsSL --retry 5 -o /opt/bootstrap/calvin.bundle '$BUNDLE_URL'+git -C /opt/bootstrap/calvin-src fetch -q /opt/bootstrap/calvin.bundle main+git -C /opt/bootstrap/calvin-src checkout -q -f --detach FETCH_HEAD+CODE_ONLY=1 BOOTSTRAP_FETCH=0 bash /opt/bootstrap/calvin-src/deploy/vm/azure-computer-boot.sh"+```++{/* Sources: services/managed-agents/src/computer/config.ts (COMPUTER_VMS, selfManagedVms, missingEdgeConfig, hostUrl); services/managed-agents/src/computer/lifecycle.ts (createSelfManaged, park, resize, delete); services/managed-agents/src/computer/durable-object.ts (hello, ensureAwake, offline notice); services/managed-agents/src/computer/host-token.ts; services/managed-agents/src/computer/routes.ts (hostRoute); services/managed-agents/wrangler.production.jsonc; services/managed-agents/README.md (Slack events); services/managed-agents/scripts/stack.mjs:82-84,193-202,522-533,585-597; cloudflare-workers/api-edge/wrangler.toml; cloudflare-workers/api-edge/scripts/stack.mjs:100-150; cloudflare-workers/api-edge/src/index.ts:576-585,2242-2294; web/src/pages/Settings.tsx:168 (Organization ID); web/src/managed-agents/computer-state.ts (Online, Offline); computer/deploy/bundle.sh; computer/deploy/vm/self-managed-user-data.sh; computer/deploy/vm/azure-computer-boot.sh (env file, BOOTSTRAP_FETCH, CODE_ONLY); computer/deploy/vm/provision.sh (Azure data disk at LUN 0, format only when blank, metadata block for the agent user); computer/deploy/vm/self-update.sh (no update without a calvin-latest.bundle URL). The az commands in steps 6 to 8, Check a VM, Stop and start, and Update a VM were run on 2026-11-13 in an Azure subscription against a local gateway in self-managed mode, with size Standard_D2s_v4: the VM connected about six minutes after az vm create. Steps 2 to 5 and 9 (Cloudflare deploys, Slack) were not run in that test. */}diff --git a/docs/self-hosting/gcp.mdx b/docs/self-hosting/gcp.mdxnew file mode 100644index 00000000..e74cc297--- /dev/null+++ b/docs/self-hosting/gcp.mdx@@ -0,0 +1,150 @@+---+title: "On Google Cloud"+description: "Deploy the app and gateway Workers on Cloudflare, and create each organization's Computer VM on Compute Engine yourself"+---++On Google Cloud the gateway runs with `COMPUTER_VMS` set to `self-managed`: it creates no VMs. You create one Compute Engine instance per organization, and the instance connects out to the gateway with that organization's host token.++| The gateway | You |+| --- | --- |+| Shows the Computer as `Online` while its VM is connected and `Offline` otherwise | Create, size, stop, start and delete the VM |+| Holds a Slack message that arrives while the VM is offline, says so once in the thread, and runs it when the VM connects | Start the VM again |++The examples use `app.example.com` and `gateway.example.com`, as in [On Azure](/self-hosting/azure).++## 1. Get the code++```bash+git clone https://github.com/diggerhq/opencomputer.git+cd opencomputer+(cd services/managed-agents && npm ci)+(cd cloudflare-workers/api-edge && npm ci)+(cd web && npm ci)+```++## 2. Create the Cloudflare resources and the apps++Follow two steps of the Azure guide unchanged:++- [Create the Cloudflare resources](/self-hosting/azure#2-create-the-cloudflare-resources)+- [Create the WorkOS, Slack and GitHub apps](/self-hosting/azure#3-create-the-workos-slack-and-github-apps)++## 3. Deploy the gateway Worker++Follow [Deploy the gateway Worker](/self-hosting/azure#4-deploy-the-gateway-worker) unchanged. Keep the value of `COMPUTER_HOST_TOKEN_KEY` at hand: step 6 derives each organization's host token from it.++## 4. Deploy the app Worker++Follow [Deploy the app Worker](/self-hosting/azure#5-deploy-the-app-worker) unchanged.++## 5. Build and upload the Computer release++From the repository root:++```bash+computer/deploy/bundle.sh /tmp/calvin.bundle++gcloud config set project '<PROJECT_ID>'+export PROJECT="$(gcloud config get-value project)"+export REGION=us-central1+export ZONE=us-central1-a+export BUCKET=<globally unique>++gcloud storage buckets create "gs://$BUCKET" --location="$REGION" --uniform-bucket-level-access+gcloud storage cp /tmp/calvin.bundle "gs://$BUCKET/calvin.bundle"+```++The bundle holds the Computer source and the model proxy built for Linux amd64. The bucket stays private. Create a service account for the VMs that can only read the bucket:++```bash+gcloud iam service-accounts create computer-vm --display-name='Computer VMs'+export SA="computer-vm@$PROJECT.iam.gserviceaccount.com"+gcloud storage buckets add-iam-policy-binding "gs://$BUCKET" \+ --member="serviceAccount:$SA" --role=roles/storage.objectViewer+```++## 6. Get the organization ID and make the host token++1. Open `https://app.example.com` and sign in.+2. Open **Settings** and copy the **Organization ID**.+3. Derive the organization's host token from `COMPUTER_HOST_TOKEN_KEY`:++```bash+export ORG_ID='<ORGANIZATION_ID>'+export COMPUTER_HOST_TOKEN_KEY='<the gateway secret>'++export TOKEN="sph_$(printf 'calvin-host:%s' "$ORG_ID" \+ | openssl dgst -sha256 -hmac "$COMPUTER_HOST_TOKEN_KEY" -binary \+ | base64 | tr '+/' '-_' | tr -d '=')"+```++The token is valid for that organization only, and for as long as the key does not change.++## 7. Create the VM++The VM is Ubuntu 24.04 on amd64 with a second, blank disk for `/data`. It needs outbound internet access and no inbound access: a new VPC network has no firewall rule that allows inbound traffic.++Write the VM's first-boot script with `self-managed-user-data.sh`. The script it prints stores the gateway URL and the token in a root-only file on the VM, downloads the release with the VM's service account and runs its boot script:++```bash+(umask 077; GATEWAY_HOST=gateway.example.com BUNDLE_URL="gs://$BUCKET/calvin.bundle" \+ computer/deploy/vm/self-managed-user-data.sh > computer-user-data.sh)+```++Create the network and the instance. cloud-init runs the script in the `user-data` metadata key once, on the first boot:++```bash+gcloud compute networks create computer --subnet-mode=auto++gcloud compute instances create computer-1 --zone="$ZONE" \+ --machine-type=e2-standard-2 \+ --network=computer \+ --image-family=ubuntu-2404-lts-amd64 --image-project=ubuntu-os-cloud \+ --boot-disk-size=64GB \+ --create-disk=name=computer-1-data,size=128GB,type=pd-balanced,auto-delete=no \+ --service-account="$SA" --scopes=storage-ro \+ --metadata-from-file=user-data=computer-user-data.sh+```++The first boot installs the toolchains, formats the blank disk, mounts it at `/data` and starts the host. It takes about five minutes. The boot script formats a disk only when it is blank.++The token stays in the instance's metadata. On the VM only root can read it; in Google Cloud, anyone allowed to read the instance (`compute.instances.get`) can.++## 8. Add the Slack app and connect GitHub++1. Open `https://app.example.com`. The Computer shows `Online` once the VM has connected.+2. Click **Add to Slack** and approve.+3. Connect GitHub and choose the repositories.+4. Mention `@computer` in a channel.++Repeat steps 6 and 7 for each further organization, with another instance and disk name.++## Stop, start and resize++Stop the instance with `gcloud compute instances stop`; the Computer shows `Offline` and Slack messages wait. Start it with `gcloud compute instances start`; the host reconnects and the workspace is still on `/data`. To resize, stop the instance, change its type with `gcloud compute instances set-machine-type`, and start it.++Deleting the instance does not delete the data disk.++## Check a VM++The boot log is `/var/log/calvin-boot.log`, and the two services are `slack-presence-host` and `oc-modelproxy`. No firewall rule allows SSH. To get a shell, allow SSH from Identity-Aware Proxy only, then connect through it:++```bash+gcloud compute firewall-rules create computer-iap-ssh --network=computer \+ --allow=tcp:22 --source-ranges=35.235.240.0/20++gcloud compute ssh computer-1 --zone="$ZONE" --tunnel-through-iap --command \+ 'sudo systemctl is-active slack-presence-host.service oc-modelproxy.service; sudo tail -50 /var/log/calvin-boot.log'+```++## Update a VM++A self-managed VM does not update itself. Build and upload a new bundle (step 5), download it to `/opt/bootstrap/calvin.bundle` on the VM, and run as root:++```bash+git -C /opt/bootstrap/calvin-src fetch -q /opt/bootstrap/calvin.bundle main+git -C /opt/bootstrap/calvin-src checkout -q -f --detach FETCH_HEAD+CODE_ONLY=1 BOOTSTRAP_FETCH=0 bash /opt/bootstrap/calvin-src/deploy/vm/azure-computer-boot.sh+```++{/* Sources: services/managed-agents/src/computer/config.ts (COMPUTER_VMS, selfManagedVms, missingEdgeConfig, hostUrl); services/managed-agents/src/computer/lifecycle.ts (createSelfManaged, park, resize, delete); services/managed-agents/src/computer/durable-object.ts (hello, ensureAwake, offline notice); services/managed-agents/src/computer/host-token.ts; services/managed-agents/src/computer/routes.ts (hostRoute); web/src/pages/Settings.tsx:168 (Organization ID); web/src/managed-agents/computer-state.ts (Online, Offline); computer/deploy/bundle.sh; computer/deploy/vm/self-managed-user-data.sh; computer/deploy/vm/azure-computer-boot.sh (env file, BOOTSTRAP_FETCH, CODE_ONLY); computer/deploy/vm/provision.sh (DATA_DEVICE, format only when blank, metadata block for the agent user); computer/deploy/vm/self-update.sh (no update without a calvin-latest.bundle URL). Run on 2026-11-13 against a local gateway with an Ubuntu 24.04 VM on Azure made with self-managed-user-data.sh: boot, connect, offline, reconnect and update. The gcloud commands have not been run. */}diff --git a/docs/self-hosting/overview.mdx b/docs/self-hosting/overview.mdxnew file mode 100644index 00000000..566d0bcf--- /dev/null+++ b/docs/self-hosting/overview.mdx@@ -0,0 +1,34 @@+---+title: "Start here"+description: "A self-hosted @computer is Cloudflare Workers and one VM per organization on Azure, AWS or Google Cloud"+---++A self-hosted deployment runs the same stack as the hosted service, in your accounts:++++The Computer VM connects out to the gateway Worker; nothing connects in. You create one VM per organization in your cloud account, and the gateway shows it as `Online` while it is connected.++## What you need++| Account or tool | Used for |+| --- | --- |+| Cloudflare account with a zone (domain) you control | Workers, D1, KV, R2 and Durable Objects. The gateway Worker needs a custom domain on the zone: Worker-to-Worker requests on `workers.dev` do not arrive. |+| Azure subscription, AWS account or Google Cloud project | The Computer VMs and the storage for the Computer release. |+| WorkOS account | Sign-in to the dashboard |+| Slack workspace | A Slack app you create |+| GitHub account or organization | A GitHub App you create |+| Anthropic API key | Model calls from every session |+| Git, Node.js 22 or newer, npm, Go, Wrangler 4, and your cloud's CLI (`az`, `aws` or `gcloud`) | Building and deploying |++## Choose where the VMs run++| Cloud | The VM | The release is stored in |+| --- | --- | --- |+| [Azure](/self-hosting/azure) | An Azure VM, created with `az` | A private blob container |+| [AWS](/self-hosting/aws) | An EC2 instance, created with `aws` | A private S3 bucket |+| [Google Cloud](/self-hosting/gcp) | A Compute Engine instance, created with `gcloud` | A private Cloud Storage bucket |++The steps for Cloudflare, WorkOS, Slack and GitHub are the same for all three and are written out in full on the Azure page. You stop, start and resize the VMs with your cloud's tools; a Slack message that arrives while a VM is stopped waits until it is back.++{/* Sources: services/managed-agents/scripts/stack.mjs:82-84 (workers.dev subrequests); services/managed-agents/src/computer/config.ts (COMPUTER_VMS); services/managed-agents/src/computer/lifecycle.ts (createSelfManaged); services/managed-agents/src/computer/durable-object.ts (offline notice); services/managed-agents/src/computer/model-key.ts:95-103; cloudflare-workers/api-edge/src/index.ts (WorkOS); computer/deploy/vm/self-managed-user-data.sh */}diff --git a/docs/slack/approvals-questions-plans.mdx b/docs/slack/approvals-questions-plans.mdxnew file mode 100644index 00000000..55a4d581--- /dev/null+++ b/docs/slack/approvals-questions-plans.mdx@@ -0,0 +1,70 @@+---+title: "Approvals, questions and plans"+description: "When the harness needs a decision, the runner posts a prompt in the thread and the turn waits; prompts never expire"+---++## Permission requests++A permission request appears when the session's [permission mode](/slack/permission-modes) does not let a tool call through. In the default mode, `bypassPermissions`, none appear.++The prompt names the tool and shows the command for Bash or the diff for an edit (up to 2,500 characters), or the content for a new file (up to 1,500).++<Frame>+ <img src="/images/slack/approval.png" alt="A permission request in a thread: Claude wants to use Bash, the command, and the buttons Allow, Allow Bash for this session and Deny" />+</Frame>++| Answer | Effect |+| --- | --- |+| Allow | This call runs. |+| Allow `<tool>` for this session | This call runs, and the harness stops asking for the same kind of call in this session. Shown only when the harness offers it. |+| Deny | The call is refused and the agent is told. |+| Typed reply | Declines the request; the agent gets your text as what to do instead. |++Once answered, the prompt message is deleted and the step card shows the outcome and who gave it.++## Questions++<Frame>+ <img src="/images/slack/question.png" alt="A question prompt with two questions, each with a button per option, and the line: or reply here with your own answer" />+</Frame>++| Answer | Effect |+| --- | --- |+| Option button | Answers that question. |+| Typed reply | An answer that is not among the options. |+| Typed reply, more than one question still open | Closes the whole prompt: the agent gets your text with the answers already given by button. |++## Plans++In `plan` mode the agent presents its plan as a message titled "Plan ready for review".++<Frame>+ <img src="/images/slack/plan.png" alt="A plan titled Plan ready for review with the buttons Approve · auto-accept edits, Approve · ask before edits and Keep planning" />+</Frame>++| Answer | Effect |+| --- | --- |+| Approve · auto-accept edits | The plan is approved and the session's mode becomes `acceptEdits`. |+| Approve · ask before edits | The plan is approved; edits ask for approval. The footer and `!status` still show `plan`. |+| Keep planning | The plan is rejected and the agent continues planning. |+| Typed reply | Declines the plan; the agent gets your text as the change you want. |++The plan message stays, updated with the outcome and who decided.++<Frame>+ <img src="/images/slack/plan-approved.png" alt="The same plan after approval: the buttons are gone and a line reads plan approved · auto-accepting edits · Dana" />+</Frame>++## All prompts++| Rule | Detail |+| --- | --- |+| Who can answer | Anyone whose messages are delivered to the session. See [Shared threads](/slack/shared-threads#who-can-steer). |+| First answer wins | Later clicks do nothing. |+| Typed messages | While a prompt is open, a delivered message answers or declines the latest open prompt; it starts no new turn. |+| Expiry | None. The idle exit does not end a turn waiting on a prompt. |+| Stop | `!stop` or Slack's stop button closes the open prompts and stops the turn. |+| Runner restart | The buttons of an open prompt do nothing, and nothing in the thread says so. Send the request again. |+| API | The same prompts; an answer from either side closes the prompt for both. See Asks. |++{/* Sources: computer/src/runner/prompts.ts; computer/src/runner/prompt-replies.ts; computer/src/runner/api/asks.ts (asks never expire, first close wins); computer/src/runner/session.ts (replyToPrompts, interrupt); computer/src/runner/timeline.ts; computer/src/gateway/routing.ts (action); computer/src/gateway/main.ts (p: actions); computer/src/main.ts (p: actions) */}diff --git a/docs/slack/branches-and-pull-requests.mdx b/docs/slack/branches-and-pull-requests.mdxnew file mode 100644index 00000000..3cbd19b1--- /dev/null+++ b/docs/slack/branches-and-pull-requests.mdx@@ -0,0 +1,71 @@+---+title: "Branches and pull requests"+description: "Each session commits on branch `sp/<thread>` in its own worktrees and pushes as the instance's GitHub App"+---++This page describes a computer with a workspace definition, which is what `provision.sh` installs. The definition lists the repositories; see Repositories.++<Frame>+ <img src="/images/slack/pull-request.png" alt="computer reports the pushed branch sp/C08EN6G4T2K-1791312345-821900 and the pull request link" />+</Frame>++## Session directory++Each session has its own directory with one `git worktree` per repository, so it does not see another session's uncommitted work.++| Item | Value |+| --- | --- |+| Session directory | `<SP_DATA>/people/<person>/sessions/<thread>/`, where `<person>` is the session's owner |+| `<thread>` | The session key, with each run of non-alphanumeric characters replaced by `-`: thread `C0B:1791.82` becomes `C0B-1791-82` |+| Contents | `AGENTS.md` with the workspace's instructions, and one subdirectory per repository. The directory itself is not a git repository. |+| Branch | `sp/<thread>`, the same name in every repository of the session |+| Starts from | `origin/<default branch>`, fetched at session start. If the fetch fails or takes over 5 seconds, the last fetched commit. |++A session starts with the repositories already cloned on the computer. It checks out any other repository listed in its `AGENTS.md` with the `checkout_repo` tool, on the same branch from the latest default branch. The clones behind the worktrees: Git.++## Commits++| Field | Value |+| --- | --- |+| Author | The session's owner, by the name and email in the people list, even when another person in the thread asked for the change |+| Committer | `Computer <[email protected]>`, or `SP_COMMITTER_NAME` and `SP_COMMITTER_EMAIL` when set |++Claude Code's own attribution lines are turned off for commits and pull requests.++## Push and pull request++The session pushes and opens pull requests with `git` and `gh`, following the workspace instructions in `definitions/computer/AGENTS.md`:++- Commit on the `sp/<thread>` branch, or on a branch with a better name.+- Push with `git push -u origin HEAD` and open the pull request with `gh pr create`, one per repository changed.+- Do not push to a default branch unless the person asks.+- Say in the pull request body who asked: `Requested by @<person> in Slack`.++To change this, edit the instructions.++## Identity and tokens++`git` and `gh` authenticate as the instance's GitHub App, so the app's bot account pushes and opens the pull request. The person appears as the commit author and in the pull request body.++| Item | Value |+| --- | --- |+| Reachable repositories | Those granted to the app's installation; see Connect GitHub |+| `git` token | Limited to the repository in the remote URL |+| `gh` token | Covers every repository the installation grants |+| Storage | No token is written to disk; the app's private key stays on the gateway. See Git. |+| Host not connected to the gateway | The token request fails and `git` fails without prompting |++## `!diff`++`!diff` runs in the session directory, which is not a git repository, so it answers `no changes` whatever the worktrees contain. Ask the session for the diff of a repository.++## When a session directory is deleted++| What | Deleted after | Condition |+| --- | --- | --- |+| The session directory and its local `sp/<thread>` branches | 14 days idle (`SP_FORK_RETENTION_DAYS`) | Every worktree is clean and every commit is on a remote. Otherwise it is kept. |+| Git-ignored build and dependency directories (`node_modules`, `.next`, `target` and similar; list in Git) | 24 hours without use (`SP_ARTIFACTS_IDLE_HOURS`) | The session has no running runner. |++A message to the thread after its directory is deleted gets a new directory from the default branch. Pushed branches are still on GitHub.++{/* Sources: computer/src/workspaces/index.ts; computer/src/workspaces/idle.ts; computer/src/runner/main.ts (sessionVars, committer); computer/src/runner/harness/claude/process.ts (attribution); computer/definitions/computer/AGENTS.md; computer/bin/gh; computer/bin/git-credential-slack-presence; computer/src/host/tokens.ts; computer/src/github/app.ts; computer/src/gateway/main.ts (mintToken, SP_PEOPLE, onPush); computer/src/runner/checkout.ts; computer/src/runner/commands.ts (!diff); computer/src/workspace.ts (gitDiff); computer/deploy/vm/provision.sh (credential helper configuration) */}diff --git a/docs/slack/browser-screenshots-video.mdx b/docs/slack/browser-screenshots-video.mdxnew file mode 100644index 00000000..f919a78d--- /dev/null+++ b/docs/slack/browser-screenshots-video.mdx@@ -0,0 +1,35 @@+---+title: "Browser, screenshots and video"+description: "Computer has no browser tool; a session renders pages, images and video with Playwright, headless Chromium and ffmpeg on the computer"+---++The session posts the result to the thread with [`send_file` or `calvin-send-file`](/slack/files-and-cards#files-out-of-a-session).++<Frame>+ <img src="/images/slack/screenshot.png" alt="computer posts pricing.png into the thread with a comment: a screenshot of a pricing page with three plan cards of equal height" />+</Frame>++## Installed software++`deploy/vm/provision.sh` installs:++| Software | Detail |+| --- | --- |+| Playwright | The `playwright` npm package, installed globally. Version: `PLAYWRIGHT_VERSION` in `provision.sh` (default `1.64.1`). |+| Chromium | Playwright's `chromium` and `chromium-headless-shell` builds, with their system libraries. Headless. |+| ffmpeg | From the distribution's packages. |+| Fonts | `fonts-dejavu-core`, `fonts-liberation2`, `fonts-noto-core`, `fonts-noto-cjk`, `fonts-noto-color-emoji`: Latin, CJK and emoji. |++If the browser download fails during provisioning, `provision.sh` prints a warning and continues. The first session that needs a browser then downloads it.++## Use in a session++- The session writes render scripts in a scratch directory under `$TMPDIR` and runs `npm link playwright` there, so no repository's dependencies change.+- The browser runs on the computer, so a script opens a dev server the session started at `localhost`, without a [preview URL](/slack/preview-urls).+- The session's instructions ask for one visual per reply unless more are requested, and for a screenshot over a video unless motion is the point.++## Secrets in screenshots++`send_file` refuses a file whose bytes contain a secret's value; it cannot see a secret drawn on a screenshot. The session's instructions say not to post a screenshot that shows credentials or personal data; nothing enforces that.++{/* Sources: computer/deploy/vm/provision.sh (visuals section, playwright install for the agent user); computer/src/runner/system-prompt.ts ("Show when showing is clearer"); computer/src/runner/send-file.ts; computer/bin/calvin-send-file */}diff --git a/docs/slack/files-and-cards.mdx b/docs/slack/files-and-cards.mdxnew file mode 100644index 00000000..cff77c45--- /dev/null+++ b/docs/slack/files-and-cards.mdx@@ -0,0 +1,60 @@+---+title: "Files and cards"+description: "Attachments up to 1 GiB reach the session as file paths; the session posts files and cards back with `send_file` and `post_card`"+---++<Frame>+ <img src="/images/slack/file-posted.png" alt="A PNG posted by the session into its thread, shown inline under its comment and file name" />+</Frame>++## Files into a session++Attach files to a message addressed to `@computer`. The runner downloads each one to a temp directory on the computer, outside the repositories, and gives the model the path.++| File | What happens |+| --- | --- |+| 5 MiB or smaller | Downloaded before the message reaches the model. PNG, JPEG, GIF and WebP are also given to the model inline. |+| Larger than 5 MiB | The message is delivered at once; the file appears at the path when its background download completes. |+| Larger than 1 GiB | Not downloaded. |+| Download failed | The model gets `[attached <name>: could not be downloaded (<reason>)]`. |++A reason that mentions an HTML page means the bot is missing the `files:read` scope; see Connect Slack.++## Files out of a session++The session posts a file into its thread with the `send_file` tool. PNG, JPEG, GIF and WebP images render inline; any other file is an attachment.++A script running in the session can post without a tool call. It exits 0 when the file is posted; otherwise it prints the reason to stderr and exits 1.++```bash+calvin-send-file <path> [comment words...] [--title T] [--alt TEXT]+```++| Limit | Value |+| --- | --- |+| Location | Inside the session's working directory or the temp directory |+| Type and size | A regular, non-empty file of at most 100 MiB |+| Files per runner | 50. The count starts again when the runner does. |+| Secrets | A file containing a session secret's value is refused; the refusal names the secret. See [Redaction](/slack/secrets-and-variables#redaction). |+| Slack scope | `files:write` |++## Cards++The session posts a table, a chart or a set of labelled fields as a Slack card with the `post_card` tool.++<Frame>+ <img src="/images/slack/card.png" alt="A card in a thread: a title, four labelled fields, a table and a link button" />+</Frame>++| Limit | Value |+| --- | --- |+| Tables per card | 1, up to 100 rows and 20 columns |+| Charts per card | 2, each up to 12 series and 20 points |+| Fields per card | 10 |+| Cards per runner | 50 |++- A card over a limit is refused, never posted in a reduced form.+- A card whose content includes a secret's value is not posted.+- Buttons on a card are links only; none sends a click back to the session.++{/* Sources: computer/src/runner/attachments.ts; computer/src/runner/send-file.ts; computer/src/runner/send-file-socket.ts; computer/bin/calvin-send-file; computer/src/runner/post-card.ts; computer/src/runner/main.ts (fetchAttachments, serveFiles) */}diff --git a/docs/slack/linked-and-spawned-threads.mdx b/docs/slack/linked-and-spawned-threads.mdxnew file mode 100644index 00000000..f472c491--- /dev/null+++ b/docs/slack/linked-and-spawned-threads.mdx@@ -0,0 +1,76 @@+---+title: "Linked and spawned threads"+description: "A pasted Slack permalink is read only if everyone involved can see it; `spawn_thread` starts a parallel session from a pushed brief"+---++<Frame>+ <img src="/images/slack/spawned-thread.png" alt="A spawned thread in #billing: computer posts a message that mentions Sam, the task, a link to the brief and a link back to the parent thread, and the new session replies under it" />+</Frame>++## Pasted links++When a message to the session contains a Slack message permalink, the gateway attaches the linked thread: its first message, the linked reply and the latest replies. The model receives it marked as data from Slack, not as instructions.++- At most 3 links per message are read; size limits are in Limits and defaults.+- The link must be in the same Slack workspace, and `@computer` must be a member of the conversation it points to.+- If reading takes more than 10 seconds, the message is delivered with a note that reading took too long.+- Messages forwarded into the message (up to 3) are attached with no access check.++### Access check++A linked thread is attached only if all of these can see the linked conversation:++1. The person who posted the link.+2. The session's owner.+3. Everyone in the session's conversation, when it is not the linked one.++| Linked conversation | Who counts as able to see it |+| --- | --- |+| Public channel | Every full member of the Slack workspace; a guest only if a member of the channel |+| Private channel or DM | Its members. Refused when the session's conversation is a public channel. |++The check also refuses when the session's conversation is shared with another organization, or when a member list it has to read has more than 5,000 members. On a refusal the model gets a note with the reason in place of the content.++## Reading and posting tools++Gateway-and-host deployment only. Parameters: Agent tools.++| Tool | What it does | Limits |+| --- | --- | --- |+| `read_thread` | Reads a thread by link, or by channel id and message timestamp. Same content and access check as a pasted link, with the session's owner as the asker. | 40 calls per runner. Never asks for approval. |+| `post_thread` | Posts a reply into another thread for the owner. | 20 calls per runner. 4,000 characters. Asks for approval unless the mode is `bypassPermissions`. |++`post_thread`:++- replies in the thread, never at the channel's top level;+- neutralizes `@channel`, `@here`, `@everyone` and user-group mentions;+- appends a line: "Posted for @owner from this thread." with a link back.++<Frame>+ <img src="/images/slack/post-thread.png" alt="A reply by computer in another thread in #web, ending with the line Posted for @Sam from this thread" />+</Frame>++## Spawned threads++`spawn_thread` starts a new session, in a new thread, that runs in parallel. Gateway-and-host deployment only. Parameters: Agent tools.++| Stage | Who | What happens |+| --- | --- | --- |+| Brief | Agent | Writes a Markdown file in a workspace repository, commits it and pushes it to that repository's default branch. The tool refuses a brief that is not there. |+| Call | Agent | Calls `spawn_thread` with a one-line `task`, the `brief` path and optionally a `model` tier. Outside `bypassPermissions` the call asks for approval. |+| Post | Gateway | Posts a top-level message in the parent's channel: a mention of the owner, the task, a link to the brief and a link back to the parent thread. |+| Start | New session | Runs on that message as if the owner had mentioned `@computer` there. It is told to read the brief first and report there. |++| The new session's | Value |+| --- | --- |+| Owner, permission mode | The parent's |+| Model | The parent's, unless a `model` argument overrides it |+| Conversation | Its own |+| Session directory | Its own, starting from each repository's default branch |+| Context | The pushed brief only |++- 8 spawns per runner.+- The parent is not told when the child finishes. The child reports in the brief and in its own thread; the parent can read that thread with `read_thread`.+- Steer or stop the child in its own thread. Stopping the parent does not stop it.++{/* Sources: computer/src/links.ts; computer/src/gateway/routing.ts (LINKS_TIMEOUT_MS, threadAbove, spawn); computer/src/gateway/threads.ts (neutralizeBroadcasts); computer/src/runner/threads.ts; computer/src/runner/spawn.ts (MAX_SPAWNS, args); computer/src/runner/main.ts (hooks); computer/src/main.ts (no hooks, link owner) */}diff --git a/docs/slack/mid-turn-messages.mdx b/docs/slack/mid-turn-messages.mdxnew file mode 100644index 00000000..f5d574b3--- /dev/null+++ b/docs/slack/mid-turn-messages.mdx@@ -0,0 +1,36 @@+---+title: "Mid-turn messages"+description: "A message sent during a turn steers it after the current tool call returns; `!stop` or Slack's stop button ends the turn"+---++<Frame>+ <img src="/images/slack/steer.png" alt="A message sent during a turn gets an eyes reaction; the running step is marked as continuing below and the output goes on in a new message under it" />+</Frame>++| You send | While | Result |+| --- | --- | --- |+| A message | A turn is running | Steer: the model sees the message after the tool call in progress returns. The turn continues. |+| A message | An approval, question or plan is open | Answers or declines the prompt. See [Approvals, questions and plans](/slack/approvals-questions-plans). |+| `!stop` or `!esc` | A turn is running | The turn stops. Open prompts are cancelled. |+| `!! <text>` | Any time | Listed in `!help` as interrupt-and-redirect, but answers "unknown command `!!`, try `!help`" and interrupts nothing. Send `!stop`, then the new message. |+| Slack's stop button on the agent status | A turn is running | Same as `!stop`. |+| Another `!` command | Any time | Runs at once, outside the turn. |+| A model tier alone (`+smart`, `+fast`, `+default`) | Any time | Switches the session's model; nothing is sent to the agent. |++## Steering++- The bot adds an :eyes: reaction to a message that arrives mid-turn.+- The turn's output continues in a new message below yours.+- In a [shared thread](/slack/shared-threads#who-can-steer), anyone whose messages are delivered can steer.++## Stopping++- Steps still running show "interrupted", and the turn's footer starts with the stop reason.+- The next message continues the same conversation.+- While the host is offline, Slack's stop button does nothing. A typed `!stop` is queued like any message.++<Frame>+ <img src="/images/slack/stop.png" alt="A stopped turn: the running step shows interrupted and the footer starts with the stop reason" />+</Frame>++{/* Sources: computer/src/runner/session.ts (send, steer, interrupt, footer); computer/src/runner/commands.ts (!stop, !esc, unknown command); computer/src/runner/help.ts; computer/src/runner/main.ts (deliver, `!` to command handler, eyes reaction); computer/src/main.ts; computer/src/gateway/routing.ts (stop); computer/src/gateway/hosts.ts (deliver is queued, stop is not); computer/src/runner/timeline.ts; computer/src/tiers.ts */}diff --git a/docs/slack/models-and-harnesses.mdx b/docs/slack/models-and-harnesses.mdxnew file mode 100644index 00000000..4e7cfb18--- /dev/null+++ b/docs/slack/models-and-harnesses.mdx@@ -0,0 +1,54 @@+---+title: "Models and harnesses"+description: "A session runs on Claude Code or Codex; a model, effort or speed change applies from the next model request"+---++<Frame>+ <img src="/images/slack/model-effort.png" alt="Answers to !model smart, !effort without an argument, and !effort high" />+</Frame>++## Tiers++| Tier | Claude Code | Codex |+| --- | --- | --- |+| `default` | `claude-opus-5-5`, or the `MODEL` environment variable when set | `gpt-6.1-sol` |+| `smart` | `claude-fable-5-2` | `gpt-6-astra` |+| `fast` | `claude-sonnet-5-5` | `gpt-6-luna` |++A new session starts on `default`. Start a message with `+smart`, `+fast` or `+default` to switch the session's model and send the rest of the message to it:++```text+@computer +smart work out why the importer drops rows+```++A message that is only the tier switches the model and starts no turn.++## Commands++| Command | Argument | Default |+| --- | --- | --- |+| `!model` | A tier (`smart`, `fast`, `default`) or a model id | `default` |+| `!effort` | `low`, `medium`, `high`, `xhigh`, `max`; on Codex also `ultra` | `medium` |+| `!speed` | `fast`, `standard` | `fast` |++- Without an argument, each command shows the current value and the choices. `!status` shows the model, the effort once it is set, and the speed when it is `standard`. See Slack commands.+- If the harness refuses a model, the session answers `can't switch to <model>: <reason>; still on <current>` and nothing changes.+- `!speed fast` on Claude Code turns on fast mode, which affects only models that have one. On Codex it is the provider's priority tier.+- Which provider account pays: Model credentials.++<Frame>+ <img src="/images/slack/status.png" alt="Answer to !status: model, effort, context size and thread cost, then thread id, working directory, session id and bot version" />+</Frame>++## Harnesses++| | Claude Code | Codex |+| --- | --- | --- |+| Started before the first message (faster first reply) | Yes | No |+| [Subagents](/slack/subagents) | Yes | No |+| [Permission modes](/slack/permission-modes) | `default`, `acceptEdits`, `plan`, `auto`, `bypassPermissions` | `default`, `bypassPermissions` |+| Cost shown in `!status` | Yes | No |++<Note>Not in the open-source code yet (model proxy). The public build runs every session on Claude Code: without the proxy a Codex session fails to start, the public gateway never asks for one, and no Slack command selects a harness.</Note>++{/* Sources: computer/src/tiers.ts; computer/src/runner/model-switch.ts; computer/src/runner/help.ts; computer/src/runner/commands.ts; computer/src/runner/format.ts (fmtStatus); computer/src/runner/harness/claude/harness.ts (CLAUDE_CAPS); computer/src/runner/harness/claude/process.ts (fastMode); computer/src/runner/harness/codex/ (CODEX_CAPS, model proxy socket); computer/src/protocol.ts (SessionSpec.harness); computer/deploy/vm/provision.sh (Codex CLI) */}diff --git a/docs/slack/permission-modes.mdx b/docs/slack/permission-modes.mdxnew file mode 100644index 00000000..890fb795--- /dev/null+++ b/docs/slack/permission-modes.mdx@@ -0,0 +1,52 @@+---+title: "Permission modes"+description: "New sessions start in `bypassPermissions`, where nothing asks for approval; `!mode` changes one session and `PERMISSION_MODE` all new ones"+---++A session's permission mode decides which tool calls the agent makes without asking. A call that needs permission appears in the thread as a prompt (see [Approvals, questions and plans](/slack/approvals-questions-plans)).++<Frame>+ <img src="/images/slack/mode.png" alt="Answer to !mode plan, and a later turn whose footer shows the plan mode" />+</Frame>++## Modes++| Mode | `!mode` argument | Behaviour |+| --- | --- | --- |+| `bypassPermissions` | `bypass`, `yolo` | Nothing asks for approval. The default. |+| `default` | `default`, `ask` | Tool calls that need permission ask first. |+| `acceptEdits` | `accept`, `acceptedits`, `edits` | File edits run without asking; other tool calls that need permission ask. |+| `plan` | `plan` | The agent investigates and presents a plan for review before changing anything. |+| `auto` | `auto` | Claude Code's auto mode: the harness decides per call whether to ask. |++These are Claude Code's permission modes: Claude Code defines which calls each one lets through.++Outside `bypassPermissions`, `spawn_thread` and `post_thread` ask for approval; `read_thread` never asks.++<Note>Not in the open-source code yet (model proxy, which makes Codex sessions work in the public build).</Note>++The Codex harness supports `default` and `bypassPermissions` only.++## Default++A new session starts in `bypassPermissions`. To change that for sessions created from then on, set `PERMISSION_MODE` in the gateway's environment (in one-machine mode, the process's). See Configuration.++<Note>Not in the open-source code yet (runner isolation). Until it lands, sessions on one computer share a Unix user and can read each other's files and secrets.</Note>++## Changing a session's mode++```text+!mode plan+```++| Set by | Mode |+| --- | --- |+| `!mode <argument>` | The named mode. Applies at once, including to a running turn. |+| "Approve · auto-accept edits" on a plan | `acceptEdits` |+| `spawn_thread` | The new session starts in its parent's mode. |++- The mode survives a runner restart and idle exit.+- Anyone whose messages are delivered to the session can change it (see [Shared threads](/slack/shared-threads#who-can-steer)).+- The turn footer and `!status` show the mode only when it is not `bypassPermissions`.++{/* Sources: computer/src/runner/commands.ts (MODE_ALIASES, !mode); computer/src/main.ts (DEFAULT_MODE); computer/src/gateway/main.ts (PERMISSION_MODE); computer/src/runner/session.ts (setMode); computer/src/runner/format.ts; computer/src/runner/thread.ts; computer/src/runner/prompts.ts (plan approval); computer/src/gateway/routing.ts (spawn mode); computer/src/runner/spawn.ts; computer/src/runner/threads.ts; computer/src/runner/harness/codex/harness.ts (CODEX_CAPS.modes) */}diff --git a/docs/slack/preview-urls.mdx b/docs/slack/preview-urls.mdxnew file mode 100644index 00000000..d1c47b4c--- /dev/null+++ b/docs/slack/preview-urls.mdx@@ -0,0 +1,39 @@+---+title: "Preview URLs"+description: "A session gives an HTTP server it started on the computer a public URL that anyone with the link can open"+---++<Note>Not in the open-source code yet (preview URLs on a self-hosted instance). On the hosted service this page describes what runs today. On a self-hosted instance today, the session is offered the `preview` tool and every call fails with `preview URLs need an OpenComputer computer; this gateway does not offer them`.</Note>++The session creates the URL with the `preview` tool and posts it in the thread. Ask for it in words: "start the app and give me a preview link".++<Frame>+ <img src="/images/slack/preview-url.png" alt="Sam asks for a preview link named pricing-demo and computer replies with https://pricing-demo.opencomputer.app" />+</Frame>++## URL++| Deployment | URL |+| --- | --- |+| Hosted | `https://<name>.opencomputer.app` |+| Self-hosted | A wildcard domain the operator points at the gateway. The session is not offered the preview tools until the domain is set; see Gateway. |++| Property | Value |+| --- | --- |+| Name | Generated unless you ask for one. A port keeps its existing name. |+| Access | Anyone who has the URL can open it; there is no login. A chosen name can be guessed. |+| Traffic | Plain HTTP on that one port, including streamed responses and WebSocket upgrades. The server must not use TLS. |+| Lifetime | While the server runs; `503` otherwise. The server stops with the session's runner, at [idle exit](/slack/threads#idle-exit). |+| Removal | Ask the session to take the URL down. The `unpreview` tool removes it within seconds. |++## Host name checks++Next.js, Vite and webpack-dev-server dev servers refuse requests under a host name they do not expect, and the preview arrives under its public host name. When the tool detects the refusal, its result names the setting to add; the dev server then needs a restart.++| Server | Setting |+| --- | --- |+| Next.js | `allowedDevOrigins` |+| Vite | `server.allowedHosts` |+| webpack-dev-server | `allowedHosts` |++{/* Sources: computer/src/runner/preview.ts; computer/src/host/previews.ts; computer/src/host/preview-probe.ts; computer/src/host/preview-proxy.ts; computer/src/protocol.ts (PreviewRequest, PreviewToolResult); computer/src/gateway/hosts.ts (preview and unpreview refused); computer/src/host/main.ts (SP_IDLE_MS); computer/definitions/computer/AGENTS.md ("the session parks and its jobs die with it") */}diff --git a/docs/slack/secrets-and-variables.mdx b/docs/slack/secrets-and-variables.mdxnew file mode 100644index 00000000..347a9046--- /dev/null+++ b/docs/slack/secrets-and-variables.mdx@@ -0,0 +1,103 @@+---+title: "Secrets and variables"+description: "A session reads secrets and variables as environment variables; secrets are entered in a private Slack form and redacted from its posts"+---++| | Entered | Shown in Slack | Redacted |+| --- | --- | --- | --- |+| Secret | In a private Slack form | No | Yes |+| Variable | In a message | Yes | No |++Slack stores messages and the model reads them, so a secret never goes in a message.++Secrets need `SP_STORE_KEY` set on the gateway; without it the commands answer `Secrets are not available: the gateway has no SP_STORE_KEY`.++## Set a secret++<Steps>+ <Step title="Ask for the form">+ Send `!secret NAME`, or `!secret NAME file` for a value that should arrive as a file. The gateway answers with a message only you can see, holding an **Enter NAME** button.++ <Frame>+ <img src="/images/slack/secret-command.png" alt="The answer to !secret STAGING_DB_URL, visible only to the sender, with an Enter STAGING_DB_URL button" />+ </Frame>+ </Step>+ <Step title="Fill in the form">+ Enter the value (several lines allowed, up to 3000 characters), choose a scope under **Available to**, and tick **Provide as a file** if needed.++ <Frame>+ <img src="/images/slack/secret-form.png" alt="The Set a secret form: Name, Value, Available to with three scopes, the Provide as a file option, and Cancel and Save" />+ </Frame>+ </Step>+ <Step title="Save">+ The value goes from Slack to the gateway, not through the conversation or the model. Running sessions in scope receive it at once.+ </Step>+</Steps>++| Action | How |+| --- | --- |+| List names per scope (never values) | `!secret` |+| Remove from a scope | `!secret rm NAME [session\|me\|workspace]` |+| Session asks for a credential | The gateway posts `This session needs $NAME`, the reason, and a button in the thread. Anyone on the people list can fill in the form. A runner can ask 10 times. |++<Frame>+ <img src="/images/slack/secret-request.png" alt="A session asking for a secret in its thread: This session needs $STAGING_DB_URL, the reason, and an Enter STAGING_DB_URL button" />+</Frame>++Every form of the command: Slack commands.++## Names++Names match `^[A-Za-z_][A-Za-z0-9_]{0,63}$`. Refused names:++- `PATH`, `HOME` and similar+- names starting with `SP_`, `CLAUDE`, `ANTHROPIC_`, `GIT_`, `LD_`, `DYLD_` or `BASH_FUNC`+- proxy and CA bundle variables++## Scopes++| Scope | In the form | In commands | Which sessions receive it | Lifetime |+| --- | --- | --- | --- | --- |+| Session | This session only | `session` | The session of the thread the form was opened from | Deleted 30 days after the session was last active |+| Person | Just me | `me` | Every session the person owns | Until removed |+| Workspace | Workspace | `workspace` | Every session | Until removed. Only admins see the option and can set or remove it; see People. |++- When the same name is set in more than one scope, the narrowest wins.+- A secret you set with **Just me** in someone else's thread does not reach that session: a session receives the person-scope secrets of its owner.++<Note>Not in the open-source code yet (runner isolation). Each session's runner will run in its own rootless container with its own secrets. Today all sessions on the computer run as one Unix user, so a session can read another session's secret files and process environments, and so can every person who can direct a session. The form says so.</Note>++## In the session++| Form | What the session gets |+| --- | --- |+| Default | `$NAME` holds the value. |+| **Provide as a file** | `$NAME` holds the path of a file with the value. Use for a service account JSON, a kubeconfig or a private key. |++A secret set, changed or removed during a turn takes effect in the next shell command the session runs.++The gateway stores secrets in its SQLite database, encrypted with AES-256-GCM under a key derived from `SP_STORE_KEY`.++## Redaction++The runner replaces every secret value it knows with `[secret:NAME]` in everything it posts to Slack, and refuses to post a file or card that contains one. It does not cover:++- a value shorter than 6 characters+- a line of a multi-line value quoted on its own, when the line is shorter than 16 characters+- a value that is encoded, split, reversed or drawn in an image+- a value sent anywhere other than Slack: a commit, a request, a log on the computer++## Variables++`!var NAME value [session|me|workspace]` sets a variable and `!vars` lists names and values. Every form of the command: Slack commands.++- The default scope is the session of the thread the command is sent in, and `me` where there is no session.+- Scopes, name rules, the workspace admin rule and the 3000-character limit are the same as for secrets.+- A variable cannot replace a secret of the same name in the same scope; a secret can replace a variable.+- When a name or value looks like a credential, the gateway does not keep it until **Set it anyway** is pressed.++<Frame>+ <img src="/images/slack/variable.png" alt="Two !var commands and their answers, visible only to the sender: one variable set, one not set because its name sounds like a credential, with a Set it anyway button" />+</Frame>++{/* Sources: computer/src/gateway/secrets-ui.ts; computer/src/gateway/variables-ui.ts; computer/src/gateway/vault.ts; computer/src/variables.ts; computer/src/secret-names.ts; computer/src/runner/session-secrets.ts; computer/src/runner/main.ts (requestSecret, redactingClient); computer/src/runner/send-file.ts; computer/src/runner/post-card.ts */}diff --git a/docs/slack/shared-threads.mdx b/docs/slack/shared-threads.mdxnew file mode 100644index 00000000..77bfd258--- /dev/null+++ b/docs/slack/shared-threads.mdx@@ -0,0 +1,45 @@+---+title: "Shared threads"+description: "Anyone on the people list can steer a session with its owner's secrets; replies not meant for the bot get no answer"+---++<Frame>+ <img src="/images/slack/shared-thread.png" alt="A second person asks a follow-up without a mention and gets an answer; two later replies between the people get no response" />+</Frame>++## Owner++The person whose message started the session owns it. A session started by `spawn_thread` has its parent's owner.++In a team install the session:++- runs in the owner's workspace;+- gets the owner's secrets and variables, plus the session's own and the workspace-wide ones (see [Secrets and variables](/slack/secrets-and-variables));+- reads and posts to other threads with the owner's Slack access (see [Linked and spawned threads](/slack/linked-and-spawned-threads)).++## Who can steer++| Person | Message that mentions `@computer` | Reply without a mention | Buttons on approvals, questions, plans |+| --- | --- | --- | --- |+| On the people list | Delivered | Delivered | Accepted |+| Not on the people list | Not delivered; ephemeral "not enabled for you yet" reply | Dropped silently | Refused with the same ephemeral reply |++Anyone whose messages are delivered can send instructions, run `!` commands (including `!stop` and `!mode`) and answer prompts. They act with the owner's workspace and secrets.++One-machine mode has no people list: every reply in a session thread is delivered.++<Frame>+ <img src="/images/slack/not-enabled.png" alt="A person who is not on the people list mentions the bot and gets a reply only they can see: not enabled for you yet" />+</Frame>++<Note>Not in the open-source code yet (runner isolation). Until it lands, every session on a computer runs as one Unix user, so a session can read other sessions' files and secrets on the same computer.</Note>++## When the bot stays silent++The model decides whether each delivered reply is for it. If not, nothing is posted: no message, no card, no footer.++- The model can misjudge either way.+- A silent turn still runs the model and counts towards usage.+- In a direct message, every message counts as addressed to `@computer`.++{/* Sources: computer/src/gateway/routing.ts (people table, NOT_ENABLED, acknowledge, action, spawn owner); computer/src/gateway/secrets-ui.ts (scopes); computer/src/main.ts; computer/src/runner/names.ts; computer/src/runner/system-prompt.ts (no-reply); computer/src/runner/session.ts (silent turn); computer/src/runner/prompts.ts (first answer wins) */}diff --git a/docs/slack/subagents.mdx b/docs/slack/subagents.mdxnew file mode 100644index 00000000..b39b6b50--- /dev/null+++ b/docs/slack/subagents.mdx@@ -0,0 +1,45 @@+---+title: "Subagents"+description: "Subagents of a Claude Code session appear in a panel in the thread; its buttons work in one-machine mode only"+---++A Claude Code session can start subagents, in the foreground or in the background. Codex sessions have no subagents.++<Frame>+ <img src="/images/slack/subagents.png" alt="The subagents panel: a header counting 3 subagents, a running row with a Stop button, a finished row with a Result button and a stopped row" />+</Frame>++## Panel++The panel is one Slack message, updated in place; the turn's text continues in a new message under it. Its header counts the subagents running, done, failed and stopped. Each subagent has one row:++| Part | Content |+| --- | --- |+| Icon | ⏳ running, ✅ done, ❌ failed, ⏹ stopped |+| Name and type | The subagent's name and agent type; "background" if it runs in the background |+| Activity | What it is doing now, or the first line of its result once finished |+| Counters | Tool calls, tokens, elapsed time |++The panel shows the latest 45 subagents. It keeps updating after its turn ends while background subagents run.++## Buttons++| Button | Shown on | Effect |+| --- | --- | --- |+| Stop | A running row | Stops that subagent. |+| Result | A finished row with a result | Opens the result in a modal (first 11,900 characters). |++<Frame>+ <img src="/images/slack/subagent-result.png" alt="The Result modal: the subagent's name as title, its status and type, its result and a Close button" />+</Frame>++- The buttons work in one-machine mode only. In a team install a click does nothing: use `!stop` to stop the turn, and ask the agent in the thread for a subagent's result.+- After the process restarts, the buttons on earlier panels do nothing.++## Idle exit and the API++The [idle exit](/slack/threads#idle-exit) waits while a subagent runs: the 2 hours count from the end of the last one.++The same subagents are listed over the API; see Subagents.++{/* Sources: computer/src/runner/agents.ts; computer/src/runner/session.ts (panel placement); computer/src/main.ts (a: actions, single-machine); computer/src/gateway/main.ts (no a: handler); computer/src/host/main.ts (idle loop); computer/src/runner/main.ts (exit waits for subagents); computer/src/runner/harness/codex/harness.ts (CODEX_CAPS.subagents) */}diff --git a/docs/slack/threads.mdx b/docs/slack/threads.mdxnew file mode 100644index 00000000..47c39ea4--- /dev/null+++ b/docs/slack/threads.mdx@@ -0,0 +1,53 @@+---+title: "Threads"+description: "Each Slack thread is one session; its runner exits after 2 hours idle and resumes on the next message"+---++<Frame>+ <img src="/images/slack/turn-finished.png" alt="A finished turn: two step cards that ended as Ran N steps, the text between them, and the footer with model, duration and context size" />+</Frame>++## Starting a session++| Where | What starts a session | Later messages |+| --- | --- | --- |+| Channel | A message that mentions `@computer`. Its thread is the session. | Every reply is delivered; the agent answers the ones meant for it (see [Shared threads](/slack/shared-threads)). |+| Existing thread | A reply that mentions `@computer`. The session also receives the replies above it. | Same. |+| Direct message | Any message. No mention needed. | Every message in that DM thread is for the agent. |++Only people on the people list get a session; anyone else gets an ephemeral "not enabled for you yet" reply. One-machine mode has no people list: anyone who can reach `@computer` can start a session.++Edited messages and messages from bots are ignored.++## Turn output++1. **Status.** Slack shows "is thinking…" on the thread, or an :eyes: reaction if the status call fails.+2. **Step cards.** Each tool call is a step with its arguments and an output tail. Consecutive steps share one card, which ends as "Ran N steps" with a count of failures.+3. **Text.** The agent's text streams into the same message between the cards.+4. **Footer.** Model, reasoning effort (once set with `!effort`), permission mode (when not `bypassPermissions`), duration and context size. A stopped turn's footer starts with the reason. Cost is in `!status`.++<Frame>+ <img src="/images/slack/turn-running.png" alt="A running turn: a finished step card, streamed text, a live step with its timer, and the thinking status under the composer" />+</Frame>++A long reply continues in a new message: Slack closes a stream after about 10 minutes and caps a message's length. A turn waiting on an answer does not open a new message, so it sends one notification.++| What you see | Cause |+| --- | --- |+| ":warning: agent process ended: …" | The harness process died. The next message starts it again. |+| ":warning: couldn't reach the session: …" | The gateway could not deliver the message to the runner. |+| "The agent host is offline; your message will be delivered when it reconnects." | The host is not connected to the gateway. The message is queued for up to 24 hours. |++## Commands++A message that starts with `!` is a command to the session, not a message to the agent: `!status`, `!stop`, `!diff`, `!restart`. See Slack commands.++## Idle exit++The host stops a session's runner 2 hours after the last message (`SP_IDLE_MS`). It waits while a turn is running or waiting on an answer, a subagent is running, or an API terminal is open.++The next message starts a new runner that resumes the same conversation in the same directory; the first reply is slower. See Session durability.++One-machine mode has no idle exit.++{/* Sources: computer/src/main.ts; computer/src/gateway/main.ts; computer/src/gateway/routing.ts (route, acknowledge, NOT_ENABLED); computer/src/gateway/hosts.ts; computer/src/runner/session.ts; computer/src/runner/segment.ts; computer/src/runner/timeline.ts; computer/src/runner/thinking.ts; computer/src/runner/format.ts (fmtStatus); computer/src/runner/thread.ts; computer/src/runner/commands.ts; computer/src/runner/harness/title.ts (TITLE_AFTER); computer/src/runner/harness/claude/title.ts; computer/src/runner/main.ts (idle exit, retitle); computer/src/host/main.ts (IDLE_MS, idle loop, deliver) */}diff --git a/docs/slack/troubleshooting.mdx b/docs/slack/troubleshooting.mdxnew file mode 100644index 00000000..6546083d--- /dev/null+++ b/docs/slack/troubleshooting.mdx@@ -0,0 +1,64 @@+---+title: "Troubleshooting"+description: "Symptoms seen in Slack, each with its cause and fix"+---++Gateway and host logs: Logs and recovery.++## No reply++<Frame>+ <img src="/images/slack/not-enabled.png" alt="In #eng, Lee mentions @computer and gets a message marked Only visible to you: Computer is not enabled for you yet. Ask the instance owner to add you." />+</Frame>++| Symptom | Cause | Fix |+| --- | --- | --- |+| Only you see: `<bot> is not enabled for you yet. Ask the instance owner to add you.` | You are not in the people list. | Ask the installer to add you. |+| Nothing, in a channel | Only a mention starts a session. | Mention `@computer`. |+| Nothing, in a session's thread, without a mention | You are not in the people list. Only a mention or a new DM gets the notice above. | Ask the installer to add you. |+| Nothing, in a thread shared with other people | The session judged the message was for someone else; see [Shared threads](/slack/shared-threads). | Mention `@computer` in the message. |+| Only you see: `The agent host is offline; your message will be delivered when it reconnects.` | The host is not connected to the gateway. The message is queued for 24 hours. | None if the host reconnects in time; see Logs and recovery. |+| "is thinking" or :eyes:, then nothing | The host did not answer the gateway within 30 seconds, for example because the runner was still starting. The gateway posts no error. | Wait; `!status` answers once the runner is up. |+| The turn does not end | It is waiting on an [approval or question](/slack/approvals-questions-plans) posted earlier in the thread. These do not time out. | Answer it. |+| "is thinking" or :eyes:, then nothing, self-hosted | The model provider account is out of credits. The self-hosted gateway posts nothing. | Check the account's balance; see Model credentials. |++## Errors in the thread++<Frame>+ <img src="/images/slack/session-unreachable.png" alt="computer replies in the thread with a warning sign and: couldn't reach the session: host disconnected" />+</Frame>++| Symptom | Cause | Fix |+| --- | --- | --- |+| `:warning: couldn't reach the session: <error>` | The host could not start the runner or hand it the message; `<error>` is the host's reason. | Send the message again. |+| `:warning: agent process ended: <reason>` | The harness process exited during the turn. | Send a message; the conversation resumes. |+| `:warning: !<command> failed: <reason>` | A `!` command threw an error. | |+| `unknown command !x, try !help` | The session has no such command. | `!help` lists them. |+| `can't switch to <model>: <reason>; still on <current>` | The harness refused the model. | See [Models and harnesses](/slack/models-and-harnesses). |+| `Secrets are not available: the gateway has no SP_STORE_KEY.` | The gateway has no key to encrypt secrets with. | See [Secrets and variables](/slack/secrets-and-variables). |+| `[attached <name>: could not be downloaded (<reason>)]` | The runner could not fetch a Slack attachment. A reason mentioning an HTML page: the bot lacks `files:read`. | See Connect Slack. |+| A file upload fails with `missing_scope` | The bot lacks `files:write`. | Add the scope and reinstall the Slack app; see Connect Slack. |+| `preview URLs need an OpenComputer computer; this gateway does not offer them` | The self-hosted gateway refuses every `preview` call. | See [Preview URLs](/slack/preview-urls). |+| `git push` or `gh` fails with `gateway not connected` | The host is not connected to the gateway, so it cannot get a GitHub token. | Retry when the host has reconnected; see Logs and recovery. |+| `git push` or `gh` fails with `GitHub App not set up: <name> missing (run /setup)` | The GitHub App is not set up. | See Connect GitHub. |+| `!diff` answers `no changes` after edits | The session directory is not a git repository; see [Branches and pull requests](/slack/branches-and-pull-requests). | Ask the session for the diff of a repository. |+| `!status` ends with `running <commit> · restart to load <commit>` | The process runs from a source checkout that has moved past the commit it started from. | Restart the process. |++## Stuck turn++| Send | Effect |+| --- | --- |+| `!status` | The runner answers during a turn with the session's status line. No answer: the runner is not reading the thread. |+| `!stop`, or the stop button | Stops the turn. The next message continues the conversation. |+| `!restart` | The runner restarts when the turn ends (`!stop` ends it now); the conversation carries over. In one-machine mode it answers "`!restart` works on a hosted runner; here, restart the process". |++## Lost session state++| Symptom | Cause |+| --- | --- |+| A dev server or other background process, and its [preview URL](/slack/preview-urls), is gone | The runner exited after 2 hours without a message; see [Idle exit](/slack/threads#idle-exit). The conversation and files are kept. |+| `node_modules` or another dependency or cache directory is gone | Git-ignored build and dependency directories are deleted 24 hours after the session's last use, while it has no runner. Reinstall or rebuild. |+| The session directory and its local branches are gone | A directory idle for 14 days is deleted if everything was committed and pushed; see [Branches and pull requests](/slack/branches-and-pull-requests#when-a-session-directory-is-deleted). The next message gets a new directory from the default branch. |+| A secret set for "This session only" is gone | Session-scope secrets are deleted 30 days after the session was last active. |++{/* Sources: computer/src/gateway/routing.ts; computer/src/gateway/hosts.ts; computer/src/gateway/db.ts (OUTBOX_TTL_MS); computer/src/runner/session.ts (silent turns, limit, agent process ended); computer/src/runner/main.ts (out-of-credits, restart); computer/src/host/main.ts (out-of-credits forwarded, SP_IDLE_MS); computer/src/runner/commands.ts; computer/src/runner/model-switch.ts; computer/src/runner/attachments.ts; computer/src/runner/send-file.ts; computer/src/gateway/secrets-ui.ts; computer/src/host/tokens.ts; computer/src/github/app.ts; computer/src/workspaces/index.ts; computer/src/workspaces/idle.ts; computer/src/workspace.ts (gitDiff); computer/src/build.ts (staleNote); computer/src/runner/prompts.ts */}diff --git a/scripts/docs-architecture.html b/scripts/docs-architecture.htmlnew file mode 100644index 00000000..0c5335f1--- /dev/null+++ b/scripts/docs-architecture.html@@ -0,0 +1,57 @@+<!doctype html><html><head>+<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,[email protected],400..600&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet">+<style>+*{box-sizing:border-box;margin:0}+body{width:1200px;height:740px;background:#f3f3f1;font-family:Inter,sans-serif;color:#131311;position:relative}+.k{font-family:'Geist Mono',monospace;font-size:13px;letter-spacing:.12em;text-transform:uppercase}+.box{position:absolute;border:1.5px solid #131311;background:#fff;border-radius:6px}+.t{font-size:22px;font-weight:600;letter-spacing:-.01em}+.s{font-size:15px;color:#6b6b66;margin-top:6px;line-height:1.35}+.lbl{position:absolute;font-family:'Geist Mono',monospace;font-size:12.5px;color:#6b6b66;background:#f3f3f1;padding:0 6px}+.vm{position:absolute;left:250px;top:80px;width:910px;height:470px;border:1.5px solid #131311;border-radius:8px;background:#ececE9}+.vm .lbl{background:#ececE9}+.sess{position:absolute;width:180px;height:118px;border:1.5px dashed #8f8f89;border-radius:6px;background:#fff;padding:14px}+.sess .t{font-size:18px}+.disk{position:absolute;left:290px;width:392px;bottom:22px;height:58px;border:1.5px solid #131311;border-radius:6px;background:#131311;color:#f3f3f1;display:flex;align-items:center;padding:0 18px;justify-content:space-between}+</style></head><body>+<div class="k" style="position:absolute;left:60px;top:30px">— How it works</div>++<div class="box" style="left:40px;top:134px;width:160px;height:100px;padding:18px">+ <div class="t">Slack</div><div class="s">@computer <task></div></div>++<div class="vm">+ <div class="k" style="position:absolute;left:24px;top:20px">Your VM</div>+ <div class="box" style="left:24px;top:56px;width:220px;height:96px;padding:16px 18px">+ <div class="t">Gateway</div>+ <div class="s">Slack, web, API, CLI</div></div>+ <div class="box" style="left:290px;top:56px;width:596px;height:96px;padding:16px 18px">+ <div class="t">Host agent</div>+ <div class="s">Takes work from the gateway, runs a session per thread</div></div>+ <div class="sess" style="left:290px;top:206px"><div class="t">Claude Code</div><div class="s" style="font-size:13px">session</div><div class="k" style="position:absolute;bottom:12px;font-size:10px;color:#6b6b66">rootless podman</div></div>+ <div class="sess" style="left:498px;top:206px"><div class="t">Codex</div><div class="s" style="font-size:13px">session</div><div class="k" style="position:absolute;bottom:12px;font-size:10px;color:#6b6b66">rootless podman</div></div>+ <div class="sess" style="left:706px;top:206px"><div class="t">OpenCode</div><div class="s" style="font-size:13px">session</div><div class="k" style="position:absolute;bottom:12px;font-size:10px;color:#6b6b66">rootless podman</div></div>+ <div class="disk"><span style="font-size:17px;font-weight:600">Local disk</span><span class="k" style="font-size:11px;color:#bdbdb7">state written here first</span></div>+</div>++<div class="box" style="left:540px;top:600px;width:280px;height:96px;padding:16px 18px">+ <div class="t" style="font-size:20px">Git-backed store</div><div class="s">durable session copies</div></div>++<div class="box" style="left:880px;top:600px;width:280px;height:96px;padding:16px 18px;border-style:dashed">+ <div class="k" style="font-size:11px;color:#6b6b66">Optional</div>+ <div class="t" style="font-size:20px;margin-top:4px">External sandbox</div>+ <div class="s" style="font-size:13px;margin-top:2px">heavy builds, preview environments</div></div>++<svg width="1200" height="740" style="position:absolute;left:0;top:0;pointer-events:none">+ <defs><marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto"><path d="M0 0L10 5L0 10z" fill="#131311"/></marker></defs>+ <line x1="200" y1="184" x2="270" y2="184" stroke="#131311" stroke-width="1.5" marker-end="url(#a)"/>+ <line x1="540" y1="184" x2="498" y2="184" stroke="#131311" stroke-width="1.5" stroke-dasharray="5 4" marker-end="url(#a)"/>+ <line x1="630" y1="232" x2="630" y2="282" stroke="#131311" stroke-width="1.5" marker-end="url(#a)"/>+ <line x1="838" y1="232" x2="838" y2="282" stroke="#131311" stroke-width="1.5" marker-end="url(#a)"/>+ <line x1="1046" y1="232" x2="1046" y2="282" stroke="#131311" stroke-width="1.5" marker-end="url(#a)"/>+ <line x1="680" y1="528" x2="680" y2="596" stroke="#131311" stroke-width="1.5" marker-end="url(#a)"/>+ <line x1="1046" y1="404" x2="1046" y2="596" stroke="#131311" stroke-width="1.5" stroke-dasharray="5 4" marker-end="url(#a)"/>+</svg>+<div class="lbl" style="left:202px;top:160px">events</div>+<div class="lbl" style="left:688px;top:562px">persist</div>+<div class="lbl" style="left:1054px;top:470px;background:#ececE9">delegate</div>+</body></html>