Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API overview

SlopWorld uses binary Protobuf over HTTP for requests and WebSocket for live updates and terminal input. Use API routes to find methods, paths, access groups, and message types; use shared/slopworld.proto for fields. This page covers transport and behavior beyond the schema.

Connect to the daemon

Read the URL and token from the endpoint file. Send x-slop-token on HTTP requests and the WebSocket upgrade request. Use protocol version 2 and upgrade the daemon, mod, and CLI together. HTTP has no version negotiation; WebSocket requires slopworld.protobuf.v2 or its compressed variant.

Authorization

The daemon token provides root authority. Agent tokens identify a stable agent; its current saved permissions authorize CLI and API actions on other agents and worktrees. Manual session grants are unavailable. Saving permissions applies to existing workers and open connections without restart. Already admitted operations finish under their operation guards.

Creating agents, changing permissions/configuration, external checkout registration, and host-terminal access require root. Removing, renaming, or replacing an identity revokes its credentials and closes affected WebSockets. See Agent collaboration for permission scopes.

HTTP

For /api/ routes, send Protobuf bodies with Content-Type: application/x-protobuf. Responses, including Error messages, are Protobuf. Routes without a request message take no body. Query parameters remain text.

Radio relay

GET /media/radio?station=ID&stream=KEY&listener=UUID streams the station’s encoded audio with its media content type. Use the station ID and stream key from the jukebox catalog and a fresh listener UUID for each playback attempt. An active duplicate UUID receives HTTP 409. Closing the response releases this listener’s station socket.

GET /media/radio/title?listener=UUID returns JSON with the current ICY title (string or null). HTTP 404 means the listener is absent. Both endpoints require root authorization. In slopweb, use the same paths prefixed with /host. The same-origin host supplies the daemon credential.

WebSocket

Connect to /ws with subprotocol slopworld.protobuf.v2. Each binary message contains an Event from the server or a ClientMessage from the client, with a payload oneof. Text frames are rejected.

For compressed server messages, offer Sec-WebSocket-Protocol: slopworld.protobuf.v2.deflate,slopworld.protobuf.v2 (no spaces). If the daemon selects the deflate variant, each server message is the next segment of one raw-deflate stream per connection: append 00 00 FF FF and inflate it with the decompressor used for earlier messages. Close the connection on any decoding error. Client messages stay uncompressed. Older daemons select plain v2.

Server events

EventContents
capabilitiesIntegration flags and terminal limits, including scrollback_lines and dimension bounds; sent on connect.
sessionsSession state, title, and bell.
screenTerminal content; scroll replies include off, request_id, and total scrollback rows in history.
usageQuotas, catalog metadata, and resolved rows; window is optional. See Usage polling.
projects, library, jukeboxProject and library catalogs, and jukebox state.
audioAudio state, included in the initial snapshot.
clipboardOSC 52 copy: name, run_id, and text. Sent only to root clients subscribed to that terminal.

Catalogs arrive on connect and again when changed.

Client messages

MessageAction
redrawRepaint all live panes (root only); optional cols and rows accommodate layout changes.
sub, unsubSubscribe to or unsubscribe from session screens.
keys, mouseSend keyboard or mouse input.
resize, scrollNegotiate terminal size or request scrollback.
pastePaste literal text or upload image bytes; see Clipboard.
paste_promptExpand a saved Prompt in the target session context and paste without submitting.
audioSet volume, select a source, stop playback, or operate the shared player. See Audio state.

Audio state

Audio state contains playing, source, volume, error, title, and optional session. Station titles come from ICY metadata; stream URLs are not sent to the mod.

A volume-only write or source selection defaults to zero gain when volume is absent. With shared_audio_transport advertised, a client can set keep_volume on a selection to use the current gain. The same capability enables relative transport and correlated Spotify replies. Stop and transport commands preserve gain. Browser server controls require both shared_audio_transport and audio_playback.

Clipboard

The client owns its desktop clipboard and applies subscribed OSC 52 events. There are no daemon-host clipboard HTTP routes.

paste.text is literal, including file URIs. image_data takes precedence over text and accepts PNG, JPEG, GIF, or WebP bytes up to 20 MiB and 8192 pixels per dimension. Uploads require root, a current run_id, and a Codex or Claude agent with its private image mount. The daemon stages the bytes and pastes their mounted path; this also works remotely and in sidecars. Failures appear in daemon logs.

Ordinary paste and keys may include run_id to discard input for a replaced run.

Sessions and tasks

Workers

POST /api/workers creates a task-owned child and returns task and worker IDs. Fields are name, project, template, body, durable, worktree, new_worktree, base, and worktree_name. Root may select any template; scoped callers must use their own project and an allowed template.

Omit name or leave it empty for automatic naming: <project>-worker for the host, <caller>-worker for agents, with numeric suffixes when needed. An explicit name must be valid and unused; duplicate names fail without creating a task.

Workers receive the template’s captured settings and fresh private state. The caller determines task and sidebar parentage and limits the child’s permissions and delegation policy. See Parent-worker access for inheritance rules; host-owned workers have delegation disabled.

Sandbox inspection

GET /api/sessions/:name/sandbox checks self or current diagnostic access. It returns a sanitized saved launch plan and a best-effort live process tree. The plan survives process exit and does not prove startup succeeded. Host terminals have no plan.

Ephemeral errands

POST /api/run selects one execution context:

FieldContext
host: trueOutside bwrap, using tmux’s environment plus TERM, COLORTERM, and SLOPWORLD_*.
agent_templateA named template.
likeA named session’s presets, network, DNS, and limits.

Conflicting choices or missing sandbox settings are rejected. Projects supply mounts. An empty host shell command uses the daemon’s $SHELL, falling back to its configured shell. Sandboxed shell errands use defaults.shell. Only an empty host shell command attached to a project without temp creates a saved host tab. Explicit host commands and file actions are temporary. See Library items and errands for workflows.

Task batch operations

Cancellation and removal validate the whole selection before changing it. Disk failures can still leave partial completion: replies distinguish committed, unchanged or absent, failed, and unattempted IDs. Clients can refresh their task lists after partial failure.

Retries are safe: canceled tasks stay canceled and removed tasks stay absent. Storage requests may finish after the client disconnects.

Project boards

GET /api/boards returns a BoardCatalog. Use ?task=TASK_ID to return only linked cards and their containing columns and boards. Array order is display order. Reads and mutation replies contain only the caller’s selected boards. The catalog reports effective write and admin capabilities. Off denies board requests, Read permits queries, and Write permits card and column edits and link changes. Admin is required to change prefixes or delete cards, columns, discussion entries, or archives. POST /api/boards accepts one BoardEdit and returns the committed catalog. Card references accept either an internal ID or the issued public key. Moves stay within one board. A move identifies its destination board, column and optional insertion anchor by ID. A stale destination fails the transaction.

ActionFields in addition to action and board
enable-boardProject ID in board, board name in text, optional prefix. Creates or updates the board. Requires host access.
disable-boardProject ID in board. Hides the board and retains its contents. Requires host access.
set-prefixNew prefix in text. Rekeys every card on the board in one transaction, preserving card numbers, internal IDs, and task links. Each card accepts its immediately preceding key until the next prefix change.
edit-commentcard, numeric entry_id, replacement text. Requires Admin. Preserves the author and timestamp.
remove-comment, remove-activitycard, decimal entry ID in text. Requires Admin.
add-columnName in text, optional column ID in before
rename-column, remove-columncolumn, new name in text for rename. Removal requires an empty column.
move-columncolumn, optional column ID in before
add-cardcolumn, title in text, optional card ID in before
move-cardcard, destination column, optional card ID in before
title, describe, assign, commentcard, value in text. Empty assignment clears the assignee. Comments use the authenticated author.
link, unlinkcard, resource kind, target in text
remove-cardcard
delete-archiveconfirm set to true

Archived boards support browsing, moving a card out, and confirmed permanent deletion. Project removal archives the board. Moving to Done only changes the card’s position.

Workspace and files

Browse, read, search, and Git

OperationContract
BrowseDirectory entries with file, hidden, gitignore, and limit flags; maximum 500 entries. A case-sensitive filter substring applies before the cap. Narrow it when truncated is true.
Read / ImageBounded UTF-8 text / image bytes.
SearchProject path and query required; maximum 1,000 matching lines per checkout. Supports regex, case, word, hidden, and gitignore flags, plus include/exclude paths or globs. Literal paths include descendants; exclusions win.
GitRepository status, or repo: false. Line counts have a two-second budget; counts=false skips them. counts_complete is false when skipped or timed out.

File mutations

Root can create, rename, and recursively delete files. Names must be single, nonempty path components; ., .., slash, backslash, and NUL are rejected. Other dots are allowed. Existing targets are preserved.

File actions

POST /api/file-action and /api/run with path run on the daemon host without private agent state. A project scopes the path and working directory. worktree selects a registered, ready checkout; empty selects Main. Other checkouts must be named explicitly. An explicit worktree ID rejects paths in other checkouts, including those nested under Main. Symlink escapes are rejected.

With host: true and no project, an absolute host path is accepted.

Configuration and templates

Read configuration

GET /api/config separates editable values from response-only metadata: factory defaults, usage catalog, temporary-root policy, terminal limits, and auto_commands. Auto reader commands resolve against the daemon’s PATH while editable values retain auto. Clients enforce their own allocation limits.

Configuration patching

ConfigPatch contains values and leaf paths. Only listed paths are merged and validated; explicit paths allow false, zero, and empty lists. Escape tilde as ~0 and dot as ~1 in map keys. Root, unknown, and overlapping paths are rejected.

Patching requires root authority. daemon.bind applies on daemon restart; daemon.token rotates authentication and local endpoint credentials immediately. Token reads are redacted.

Project and session fields

Projects contain dir, a temporary flag, and shared mounts. Responses also include expanded_dir, resolved against the daemon’s home and environment. Mounts use literal from and to paths and a mode in both TOML and the API.

Sessions carry network, DNS, limits, and startup settings directly. DNS specifies mode resolved, or mode servers with an IPv4 server list.

Agent templates

Template routes require root except GET /api/templates/spawnable. Scoped callers see worker-enabled templates in their project; root may select a project or omit it for the enabled catalog without project context. GET /api/templates returns user definitions; its optional project query validates and returns project context without filtering the catalog.

OperationRequest
Create templatePOST /api/templates: name, description, and either source to capture an agent’s choices and dependencies or duplicate to copy a template. Alternatively, send a complete definition without version.
Create agentPOST /api/templates/:name/create: new name, registered project, optional session overrides, and optional start. Copies portable settings into fresh private state; the project supplies mounts.
Replace or renamePUT /api/templates/:name: complete definition and expected version. For renames, the path may name the old definition. Replacement is atomic.
DeleteDELETE /api/templates/:name?version=N: expected version required.

Templates exclude project settings and have daemon-owned, increasing versions. Stale edits/deletes return 409 Conflict; missing targets return 404. Duplicate destinations are rejected; conflicts are never retried automatically. See Configuring agents for defaults.

Preview settings and projects

Root-only POST /api/settings/preview accepts a complete session draft, existing agent name to retain saved snapshots, project draft, and/or template. For a recipe without a destination project, use recipe: true and omit session.

It returns display title, subtitle, notes, and fields (label, values), plus captured command and sandbox definitions. Launch resolvers supply effective values and their sources. Preview neither saves nor launches: it describes the next launch, whose paths are still checked before execution.

POST /api/projects/preview accepts name and temp: true. It returns the prospective temporary directory using the same normalization as project writes, without creating the project.

Settings discovery and highlighting

Root-only GET /api/whereis resolves executables against the daemon’s PATH. GET /api/highlight/themes accepts command as a query parameter; POST /api/highlight accepts it in the body:

commandResult
OmittedDaemon default.
Empty (Off)Plain text.
autoInstalled highlighter, or unchanged input if none is available.

Overrides do not save configuration. Profile-local engine and theme must match the highlighter engine; mismatches are rejected.

Private state

Reset moves configured agents’ private state to trash for at least 14 days. Root-only inventory lists active, orphan, and trash entries; only orphan and trash entries can be permanently deleted.

GET /api/state measures sizes. With ?sizes=false, it returns names, ownership, paths, and modification times without walking trees or purging expired trash; bytes: 0 then means unmeasured.

Reset uses the session state route; deletion and restore use /api/state routes. DELETE /api/state/trash permanently deletes all trash. Restore requires no replacement state tree. Deleted agents can be recreated if their saved name, project, and mounts remain valid.