coder::change-diff
functionInternal console UI: retrieve an exact before/after snapshot by change id.
is_binaryboolean*required
new_contentsstring
Exact post-mutation body. Missing when either side is not UTF-8.
old_contentsstring
Exact pre-mutation body. Missing when either side is not UTF-8.
coder::create-file
functionCreate one or more files atomically; per-file overwrite and parents flags. For a conflict-safe overwrite pass the revision from coder::read-file as expected_revision (stale revision: C221, nothing written). Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
filesobject[]*required
expected_revisionstring
Optimistic-concurrency guard for an overwrite: the `revision` from coder::read-file; if the content changed the entry fails C221 unwritten.
modestring
Octal permission bits as a string, e.g. "0644". Defaults to "0644".
overwriteboolean
When false (the default), refuse to write if `path` already exists.
parentsboolean
Create missing parent directories. Defaults to true so a single `coder::create-file` call can scaffold a fresh subtree.
pathstring*required
File to create.
resultsobject[]*required
bytes_writteninteger· uint64*requiredmin 0
errorany of
Structured error for this entry. `code` is stable for programmatic branching (e.g. `"C213"` means already-exists; pass `overwrite=true` to replace). `message` carries the corrective action an LLM agent needs to make a successful second call.
any of (2)
variant 1
codestring*required
Stable error code, e.g. "C211". See the README error table.
messagestring*required
Human/LLM-readable message: problem + actual values + corrective next call.
pathstring*required
Canonical absolute path (resolved through the jail); the caller's input verbatim when resolution failed.
revisionstring
Opaque revision for the exact bytes written. Supply this as `expected_revision` on a later overwrite to avoid lost updates.
coder::delete-file
functionRemove one or more paths. Directories need recursive: true; missing paths succeed; recursion refuses to descend through non-accessible entries. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
pathsstring[]*required
Paths to remove.
recursiveboolean
Required for non-empty directories. Files and empty dirs ignore it.
resultsobject[]*required
errorany of
Structured error for this entry. `code` is stable for programmatic branching (e.g. `"C211"` for not-found-or-denied; `"C210"` for refusing to delete an allowed root). `message` carries the corrective action an LLM agent needs to make a successful second call.
any of (2)
variant 1
codestring*required
Stable error code, e.g. "C211". See the README error table.
messagestring*required
Human/LLM-readable message: problem + actual values + corrective next call.
pathstring*required
Canonical absolute path (resolved through the jail); the caller's input verbatim when resolution failed.
Report the coder access contract: mode (jailed | unjailed), allowed roots (primary first), the session_root relative paths anchor against, size caps, response budgets, listing/search limits, non-accessible globs and default_exclude_globs. Call it first when a path is rejected.
base_pathsstring[]*required
Canonical absolute paths of the allowed roots, in configuration order. The primary root (index 0) is where relative wire paths resolve; an absolute path is accepted when it canonicalises inside ANY of these (in `unjailed` mode: anywhere on the host). In `jailed` mode paths outside every root are rejected — use `shell::fs::*` instead.
batch_read_budget_bytesinteger· uint64*requiredmin 0
Aggregate budget across a single `paths[]` batch call to `coder::read-file`, measured in bytes of returned content (after UTF-8 sanitization — invalid bytes expand to U+FFFD before being counted, so the cap bounds what the caller actually receives). Entries are collected in request order; each entry may consume up to `min(remaining_budget, max_read_bytes)`. An entry reached with zero remaining budget receives a per-entry C218 naming this key, its value, and the bytes already consumed, with recovery guidance. Budget topology: batch reads are governed by this key; single-path full reads by `max_output_bytes`; windowed reads by `max_read_bytes` applied per returned window — `max_read_bytes` is also the per-file IO ceiling for all of them.
default_exclude_globsstring[]*required
Noise-exclusion globs (root-relative, same matching as `non_accessible_globs`): matching paths (node_modules, .git, …) are omitted from `coder::search` results and pruned from `coder::tree` descent — the directory surfaces as a childless `truncated` stub. Hide-only — no access protection. Pass `use_default_excludes: false` on those calls to look inside.
list_default_page_sizeinteger· uint32*requiredmin 0
Default `page_size` used by `coder::list-folder` when the caller omits it.
list_max_page_sizeinteger· uint32*requiredmin 0
Hard cap on `page_size` accepted by `coder::list-folder`.
max_output_bytesinteger· uint64*requiredmin 0
Context budget for single-path FULL reads in `coder::read-file`, in bytes of returned content. Full reads larger than this return C218 with the file's size/line count and window/stat recovery guidance; a per-call `max_output_bytes` override is available on `coder::read-file` (clamped to `max_read_bytes`).
max_read_bytesinteger· uint64*requiredmin 0
Per-file IO ceiling for `coder::read-file`. Full reads of files larger than this are rejected with C218; windowed reads cap the returned window bytes instead, so larger files stay readable window by window. Also the ceiling for `coder::search` content scanning — larger files are silently skipped during search.
max_write_bytesinteger· uint64*requiredmin 0
Maximum bytes that `coder::create-file` or `coder::update-file` will accept for a single file write. Larger writes are rejected with C218.
modeall of*required
`jailed`: paths must stay inside `base_paths`. `unjailed`: absolute paths anywhere on the host are accepted (deny-only, like `shell::fs::*`) and `base_paths` only anchor relative paths.
all of (1)
variant 1
one of (2)
variant 1
valuestringenum: jailed
variant 2
valuestringenum: unjailed
non_accessible_globsstring[]*required
Glob patterns matched per root (root-relative). Files whose root-relative path matches are listable but not readable/writable/deletable/creatable; they return C211.
primary_rootstring*required
Convenience duplicate of `base_paths[0]` — the primary allowed root. Relative paths resolve against this directory UNLESS `session_root` is set, which takes precedence.
search_default_max_line_bytesinteger· uint32*requiredmin 0
Per-line byte cap in `coder::search`: matching considers at most this many bytes of each line, and matched/context lines are truncated to it.
search_default_max_matchesinteger· uint32*requiredmin 0
Default `max_matches` used by `coder::search` when the caller omits it.
search_response_budget_bytesinteger· uint64*requiredmin 0
Aggregate byte budget for one `coder::search` response, measured in payload bytes (paths + matched text + context lines). When the budget is hit the response sets `truncated: true` — refine the query or add `include_globs`.
session_rootstring
The session's working directory when the caller runs under a harness-stamped filesystem scope; `null` otherwise. When set, THIS is what relative wire paths (and `coder::search` glob matching) anchor against — not `primary_root`. In `unjailed` mode it may sit outside every `base_paths` entry, so a relative path that looks wrong against the allowed roots can still be correct here. Check it first when a relative path was rejected.
tree_default_depthinteger· uint32*requiredmin 0
Default `max_depth` used by `coder::tree` when the caller omits it.
tree_per_folder_limitinteger· uint32*requiredmin 0
Maximum entries returned per folder node by `coder::tree`; folders that exceed this are flagged `truncated`.
versionstring*required
Coder worker version (`CARGO_PKG_VERSION`).
coder::list-folder
functionList one folder, paginated and sorted by name. Entries carry only name; entry path = response path + '/' + name. Non-accessible entries are listed with non_accessible: true. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
page_sizeinteger· uint32min 0
Capped at list_max_page_size; defaults to list_default_page_size (see coder::info).
pathstring
Folder to list (default `.`).
entriesobject[]*required
kindstring*requiredenum: file, dir, symlink, other
mtimeinteger· int64*required
namestring*required
Entry basename. The absolute path is derivable from the response's `path`: entry path = folder path + "/" + name.
non_accessibleboolean*required
True if this entry matches `non_accessible_globs` — caller cannot read/write/delete it via `coder::*` even though it shows up here.
sizeinteger· uint64*requiredmin 0
pageinteger· uint32*requiredmin 0
page_sizeinteger· uint32*requiredmin 0
pathstring*required
Canonical absolute path of the listed folder (resolved through the jail). Entries carry only `name`; derive an entry's absolute path by joining: entry path = this path + "/" + name. Operations on derived paths re-validate through the jail.
totalinteger· uint64*requiredmin 0
Move or rename one or more paths; per-entry overwrite and parents flags. Same-root moves rename atomically; cross-root moves copy+delete files only (move directory contents individually) and remove the copy if the delete fails. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
filesobject[]*required
Entries to move. Each entry is processed independently so a single failure never aborts the rest.
fromstring*required
Source path.
overwriteboolean
When false (the default), refuse to overwrite an existing destination. Pass `overwrite: true` to replace an existing file at `to`.
parentsboolean
Create missing parent directories of the destination. Defaults to true.
tostring*required
Destination path.
resultsobject[]*required
errorany of
Structured error for this entry. `code` is stable for programmatic branching (e.g. `"C213"` means destination exists; pass `overwrite=true` to replace; `"C210"` for disallowed operations such as cross-root directory moves, moving a root itself, or a destination that is a directory — the message then names the corrected target path). `message` carries the corrective action an LLM agent needs to make a successful second call.
any of (2)
variant 1
codestring*required
Stable error code, e.g. "C211". See the README error table.
messagestring*required
Human/LLM-readable message: problem + actual values + corrective next call.
fromstring*required
Canonical absolute path of the source (resolved through the jail); the caller's input verbatim when resolution failed.
movedboolean*required
True only when the move fully completed; false for a no-op self-move (`from` and `to` resolve to the same file).
tostring*required
Canonical absolute path of the destination (resolved through the jail); the caller's input verbatim when resolution failed.
Read a file. stat: true probes size/mtime/total_lines without content; line_from/line_to (1-based, inclusive) read a window of a file of any size; numbered: true prefixes absolute line numbers; paths[] (XOR path) batch-reads. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
encodingall of
Content encoding for full reads; `base64` returns the exact file bytes (encoded length is budgeted). C210 with stat/window/numbered.
all of (1)
variant 1
one of (2)
variant 1
valuestringenum: text
variant 2
valuestringenum: base64
line_frominteger· uint64min 1
First line (1-based, >= 1) of a windowed read; windows keep files over max_read_bytes readable slice by slice. `path` mode only.
line_tointeger· uint64min 1
Last line of the window, 1-based inclusive, >= `line_from`; omit to read from `line_from` to EOF. `path` mode only.
max_output_bytesinteger· uint64min 0
Full-read byte budget (returned bytes, clamped to max_read_bytes); over budget fails C218 naming size/total_lines. C210 with a window.
numberedboolean
Prefix each line with its absolute 1-based file line number (`N→`), matching coder::update-file line ops; C210 with `stat`. `path` mode only.
pathstring
Single file to read; XOR with `paths` (C210 if both or neither is set).
pathsany of[]
Batch of files to read in one call (bare path strings or window objects), processed in order against batch_read_budget_bytes; XOR with `path`.
any of (2)
variant 2
line_frominteger· uint64min 1
First line of the window, 1-based inclusive (>= 1); defaults to 1 when only `line_to` is set.
line_tointeger· uint64min 1
Last line of the window, 1-based inclusive, >= `line_from`; omit to read to EOF.
numberedboolean
Prefix this entry's lines with their absolute 1-based line numbers (`N→`); prefix bytes count toward the batch budget.
pathstring*required
File to read.
statboolean
Metadata probe for this entry: size/mode/mtime plus total_lines, content null, no budget consumed; C210 with a window or `numbered`.
statboolean
Metadata probe: size/mode/mtime plus total_lines/is_utf8, no content; C210 with line_from/line_to/numbered/max_output_bytes.
contentstring
File content as a UTF-8 string — the whole file, or just the requested window when `line_from`/`line_to` was given (window lines keep their newline terminators). Binary content is returned with invalid bytes replaced by U+FFFD; request `encoding: "base64"` when exact bytes matter (content is then the file's bytes base64-encoded). **Single-path mode only; null when the request used `paths[]`.**
is_utf8boolean
Whether `content` survived UTF-8 conversion without losing bytes. Reflects the RETURNED content only: a clean window inside an otherwise-binary file is still `true`. **Single-path mode only; null when the request used `paths[]`.**
lines_returnedinteger· uint64min 0
Number of lines in `content`. For full reads this equals the file's total line count. **Single-path mode only; null when the request used `paths[]`.**
modeinteger· uint32min 0
Unix permission bits (lower 9 bits of `st_mode`), e.g. 0o644. **Single-path mode only; null when the request used `paths[]`.**
more_linesboolean
True when the file has content beyond what `content` includes: the window ended before EOF, or the byte budget cut the window short. Always false for full reads. **Single-path mode only; null when the request used `paths[]`.**
mtimeinteger· int64
Last-modified time as a Unix epoch in seconds. **Single-path mode only; null when the request used `paths[]`.**
pathstring
Canonical absolute path of the file read (resolved through the jail). **Single-path mode only; null when the request used `paths[]`.**
resultsobject[]
Per-entry results for a batch `paths[]` request. **Present only when the request used `paths[]`; null in single-path mode.**
contentstring
File content as a UTF-8 string — the whole file or the requested window. Binary bytes are replaced by U+FFFD (`is_utf8: false`). `null` on failure.
errorany of
Structured error — present only when `success: false`.
any of (2)
variant 1
codestring*required
Stable error code, e.g. "C211". See the README error table.
messagestring*required
Human/LLM-readable message: problem + actual values + corrective next call.
is_utf8boolean
Whether `content` survived UTF-8 conversion without losing bytes. `null` on failure.
lines_returnedinteger· uint64min 0
Number of lines returned in `content`. `null` on failure.
modeinteger· uint32min 0
Unix permission bits (lower 9 bits of `st_mode`), e.g. 0o644. `null` on failure.
more_linesboolean
`true` when the file has content beyond what `content` includes (window ended before EOF, or byte budget cut the window short). `null` on failure.
mtimeinteger· int64
Last-modified time as a Unix epoch in seconds. `null` on failure.
pathstring*required
Canonical absolute path of the file (resolved through the jail). If resolution failed, this echoes the caller's input verbatim.
sizeinteger· uint64min 0
Size of the FILE in bytes (from metadata). `null` on failure or when the entry budget was exhausted before the file was opened.
successboolean*required
`true` when the read succeeded (content/metadata fields are populated); `false` when an error occurred (only `error` is set).
total_linesinteger· uint64min 0
Total lines in the file; present when the stream reached EOF during this entry's read. `null` when not traversed or on failure.
revisionstring
Opaque identity of the file's exact bytes. Present for complete single-path reads only; pass it as `expected_revision` to `coder::create-file` for a conflict-safe whole-file overwrite.
sizeinteger· uint64min 0
Size of the FILE in bytes (from metadata) — not the size of `content`; in windowed mode the two differ. **Single-path mode only; null when the request used `paths[]`.**
total_linesinteger· uint64min 0
Total number of lines in the file. Present only when the read traversed the whole file: always for full reads; for windowed reads only when the stream naturally reached EOF within the byte cap. Never computed by forcing an extra full scan — absent means the file was not fully traversed. **Single-path mode only; null when the request used `paths[]`.**
Search file contents (literal or regex) and/or paths (files and dirs); first match per line only. default_exclude_globs noise is skipped unless use_default_excludes: false. truncated: true means refine the query, not paginate. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
context_lines_afterinteger· uint32min 0
Lines of context after each content match; same rules as `context_lines_before`.
context_lines_beforeinteger· uint32min 0
Lines of context before each content match (max 10, C210 above); truncated to max_line_bytes and counted in the budget. Default 0.
exclude_globsstring[]
Glob patterns (same relative-to-root matching) that exclude paths.
fuzzy_pathsboolean
Rank path matches by fuzzy subsequence score (quick-open style) instead of substring/regex matching; `path_matches` then comes back best first. Content matching is unaffected.
include_globsstring[]
Root-relative glob patterns paths must match; empty = everything.
include_hiddenboolean
Walk dot-files and dot-folders (`.github`, `.env`, …); default true. `false` leaves them out, the way an editor's quick open does.
max_line_bytesinteger· uint32min 0
Bytes per line to consider when scanning content; longer lines are truncated for the match snippet.
max_matchesinteger· uint32min 0
Optional explicit cap. Falls back to config when unset.
pathstring
Folder to search (default `.`); globs match relative to its root, result paths are absolute.
querystring*required
Pattern to search for. Treated as a regex when `regex: true`, otherwise as a literal substring. May be empty only when `search_content` is false: a path-only search with no query lists every path (with `fuzzy_paths`, shallow and short paths first).
respect_gitignoreboolean
Honour `.gitignore`/`.ignore` rules (inside a Git repository) while walking, the way an editor's search does; default false keeps every non-excluded file searchable.
search_contentboolean
Search file contents (default true).
search_pathsboolean
Search file paths (default true).
use_default_excludesboolean
Skip paths matching default_exclude_globs (.git, node_modules, …; see coder::info) in content and path results; false searches inside them.
content_matchesobject[]*required
afterstring[]
Context lines immediately after the matched line — same file only, in file order, each truncated to `max_line_bytes`. Omitted when empty (no `context_lines_after` requested, or the match is at the end of the file).
beforestring[]
Context lines immediately before the matched line — same file only, in file order, each truncated to `max_line_bytes`. Omitted when empty (no `context_lines_before` requested, or the match is at the start of the file).
columninteger· uint32*requiredmin 0
lineinteger· uint32*requiredmin 0
pathstring*required
Absolute path under the canonical parent; symlinks at the entry itself are not resolved. Operations on it re-validate through the jail.
textstring*required
Matched line; truncated to `max_line_bytes` and never spans newlines.
path_matchesobject[]*required
kindall of*required
What matched: `file` or `dir`. Directories match by NAME only — content search never reads them.
all of (1)
variant 1
valuestringenum: file, dir
pathstring*required
Absolute path under the canonical parent; symlinks at the entry itself are not resolved. Operations on it re-validate through the jail.
truncatedboolean*required
True if results were cut off — either match list hit the `max_matches` cap, or the response hit the `search_response_budget_bytes` byte budget. When true, refine the query or add include_globs rather than paginate.
Show a directory tree, bounded by max_depth, per_folder_limit and a node budget. Nodes carry only name (child path = parent path + '/' + name); over-limit folders are truncated stubs to paginate with coder::list-folder. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
include_hiddenboolean
List dot-prefixed entries; false omits them at every level (they then don't count toward per_folder_limit). The requested root is exempt.
max_depthinteger· uint32min 0
Maximum depth to descend; the root node is depth 0.
pathstring
Base folder for the snapshot (default `.`).
per_folder_limitinteger· uint32min 0
Maximum children listed per folder. When more exist, the folder is flagged `truncated` and callers should switch to `coder::list-folder`.
use_default_excludesboolean
Prune directories matching default_exclude_globs (see coder::info) into childless `truncated` stubs; false lists everything.
pathstring*required
Canonical absolute path of the requested folder (resolved through the jail). Nodes carry only `name`, and the root node's path IS this `path` — do not join the root's `name` onto it; derive children by joining from here: child path = parent path + "/" + name. Operations on derived paths re-validate through the jail.
rootall of*required
Root node of the snapshot; its `name` is the folder's basename.
all of (1)
variant 1
kindstring*requiredenum: file, dir, symlink, other
mtimeinteger· int64*required
namestring*required
Entry basename. The ROOT node's path is the response's top-level `path` itself; every other node's path derives by joining from there: child path = parent path + "/" + name.
non_accessibleboolean*required
sizeinteger· uint64*requiredmin 0
truncatedany of
Set on directories whose `children` was capped at `per_folder_limit`, whose subtree was cut off by `max_depth`, which matched `default_exclude_globs` or omitted matching non-directory children (reason "default_exclude"), or where the snapshot's node budget ran out (reason "max_nodes").
… expand 2 nestedcollapse
any of (2)
variant 1
reasonstring*required
Reason this folder was truncated: hit `per_folder_limit`, cut off by `max_depth`, matched `default_exclude_globs` (`default_exclude`), omitted matching non-directory children, or the snapshot's total node budget ran out (`max_nodes`).
showninteger· uint32*requiredmin 0
Number of children actually returned.
totalinteger· uint32min 0
Total number of children eligible for listing in the folder, counted after hidden and default-exclude filtering (only populated when `reason == "per_folder_limit"`; for depth truncation we don't peek into the folder).
coder::update-file
functionEdit one or more files: batched line ops (1-based, inclusive, applied bottom-up), then regex replace ops; each file commits atomically. To replace a large region use two short anchors joined by .*? with dot_matches_newline: true instead of quoting it. Paths: relative to the primary root or absolute inside an allowed root (see coder::info).
filesobject[]*required
opsone of[]*required
one of (4)
variant 1
at_lineinteger· uint32*requiredmin 0
opstring*requiredenum: insert
variant 2
from_lineinteger· uint32*requiredmin 0
opstring*requiredenum: remove
to_lineinteger· uint32*requiredmin 0
variant 3
from_lineinteger· uint32*requiredmin 0
opstring*requiredenum: update_lines
to_lineinteger· uint32*requiredmin 0
variant 4
dot_matches_newlineboolean
When true `.` also matches newline, so a short pattern like `start.*?end` spans lines; by default a multi-line pattern matches nothing.
expect_matchesinteger· uint64min 0
Expected match count; a mismatch fails this file with C210 and writes nothing (0 asserts absence). Omit to replace all matches.
opstring*requiredenum: replace
replacementstring*required
Substitution text; $1/${1}/$name/${name} expand captures ($0 = whole match), a literal $ is written $$ (`$${name}`). Unknown references fail C210.
pathstring*required
File to edit.
resultsobject[]*required
appliedinteger· uint32*requiredmin 0
Number of operations applied (only meaningful when `success`).
echoesobject[]*required
Per-op bounded post-apply echoes for edit verification; each applied op returns a snapshot of the affected region (±2 context lines) so the caller can confirm the edit landed at the right position without receiving the full file body. See `OpEcho` for field semantics. Empty on failure. Always present on the wire.
elidedinteger· uint64min 0
Number of middle lines elided from a large region: for line ops, set when the affected region exceeded the per-echo cap; for replace sites, the count of inner lines between the region's echoed first and last line (set when the region spans >2 lines).
from_lineinteger· uint64*requiredmin 0
1-based line number of the first echoed line (after all ops applied).
linesstring[]*required
The echoed lines, post-apply. When the region is large, middle lines are elided and `elided` is set to indicate how many were skipped.
op_indexinteger· uint32*requiredmin 0
Index of the op in the request's ops array (0-based).
total_replacementsinteger· uint64min 0
Total number of replacements the regex op made across the whole file (set only on replace-op site echoes, duplicated on each site). Sites are capped at 5 — when more matched, this count is the only record of the extras.
echoes_truncatedboolean*required
True when the total echo budget (~4 KiB) was exhausted before all op echoes could be emitted. Use `coder::read-file` to inspect the full result if needed. Always present on the wire.
errorany of
Structured error for this entry. `code` is stable for programmatic branching (e.g. `"C211"` for not-found-or-denied; `"C210"` for bad input such as overlapping ops). `message` carries the corrective action an LLM agent needs to make a successful second call.
any of (2)
variant 1
codestring*required
Stable error code, e.g. "C211". See the README error table.
messagestring*required
Human/LLM-readable message: problem + actual values + corrective next call.
new_line_countinteger· uint64*requiredmin 0
Final line count after applying (only meaningful when `success`).
pathstring*required
Canonical absolute path (resolved through the jail); the caller's input verbatim when resolution failed.
Serve the ide worker's injected console UI assets (content function for its console:script / console:style triggers).
pathstring*required
The asset path from the trigger config (e.g. `state/page.js`).
contentstring*required
The asset source, verbatim.
content_typestring*required
MIME type the console should serve the asset with.
shell::config-status
functionReport the last configuration hot-reload outcome: last_outcome (applied|rejected), last_error, and rejected_reloads since boot. A rejected outcome means shell is enforcing an older policy than the central store. Takes no arguments.
last_errorstring
Build error from the most recent rejected reload (why it was refused).
last_outcomeone of*required
Outcome of the most recent hot-reload attempt, exposed via `shell::config-status`.
one of (2)
variant 1
valuestringenum: applied
variant 2
valuestringenum: rejected
rejected_reloadsinteger· uint64*requiredmin 0
Cumulative count of rejected reloads since boot (never reset).
Run a command in the foreground and return its full output. Put the program in `command` (string) and arguments in `args` (string[]), never argv in `command`. Host-only cwd/env/stdin reject S210 on a sandbox target. Errors return { code, message }; common: S216 host exec error, S300 VM boot failed, S200 in-VM failure.
argsstring[]
Arguments, in order (all strings). Omit/null to tokenize `command` shell-words style; pass an array (even empty) to use it verbatim.
commandstring*required
Program name (PATH-resolved) or path to an executable, as a string; put arguments in `args`.
cwdstring
Working directory (host only, S210 on sandbox); jail-confined like shell::fs::* paths (S215 on escape), must be an existing directory.
envobject
Per-call env values (host only, S210 on sandbox); exec-hijacking keys (PATH, IFS, HOME, LD_*/DYLD_*, …) reject the whole call S210.
stdinstring
Bytes written to the program's stdin, then EOF (host only, S210 on sandbox); omit to leave stdin at /dev/null.
targetall of
Where to run the command. Defaults to the host worker; pass `{ kind: "sandbox", sandbox_id }` to forward the call to a microVM.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
timeout_msinteger· uint64min 0
Per-call timeout in milliseconds, capped at the configured max; negative or fractional values fall back to the default.
duration_msinteger· uint64*requiredmin 0
stderr_truncatedboolean*required
stdout_truncatedboolean*required
timed_outboolean*required
Spawn a background job; returns { job_id, argv } immediately. Accepts the shell::exec payload plus optional job_id. Register shell::job-finished with a fresh job_id before calling exec_bg with that same ID, or omit job_id to generate one. Duplicate retained IDs reject before execution. Host jobs ignore timeout_ms and use the configured background hard cap; read output with shell::status, list jobs with shell::list. Spawn-time failures are plain-string messages; later failures emit shell::job-finished and appear in shell::status.
argsstring[]
Arguments, in order (all strings). Omit/null to tokenize `command` shell-words style; pass an array (even empty) to use it verbatim.
commandstring*required
Program name (PATH-resolved) or path to an executable, as a string; put arguments in `args`.
cwdstring
Working directory (host only, S210 on sandbox); jail-confined like shell::fs::* paths (S215 on escape), must be an existing directory.
envobject
Per-call env values (host only, S210 on sandbox); exec-hijacking keys (PATH, IFS, HOME, LD_*/DYLD_*, …) reject the whole call S210.
job_idstringmin 1 chars
Optional non-blank ID for registering shell::job-finished before execution. Must be unique among retained jobs in this worker. Omit or pass null to generate a job-UUID automatically.
stdinstring
Bytes written to the program's stdin, then EOF (host only, S210 on sandbox); omit to leave stdin at /dev/null.
targetall of
Where to run: the host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
timeout_msinteger· uint64min 0
Per-call timeout in milliseconds; ignored by host background jobs, forwarded to sandbox targets.
Change a file or directory's permissions. `mode` is an octal string like "0644". `uid`/`gid` optionally chown. `recursive: true` walks the tree (symlinks skipped). Returns { entries_changed, path, recursive }. Errors return { code, message }; common: S210 bad mode, S211 not found or not accessible, S215 jail escape.
gidinteger· uint32min 0
Optional chown to this numeric gid.
modestring*required
Octal permission string, e.g. "0755".
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
recursiveboolean
Apply mode/owner change to all files under the path recursively.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
uidinteger· uint32min 0
Optional chown to this numeric uid.
entries_changedinteger· uint64*requiredmin 0
Number of filesystem entries whose mode/owner changed.
pathstring
The path that was targeted. Empty for sandbox targets.
recursiveboolean
Whether the change was applied recursively. Host only.
Search file contents for a pattern (Rust regex, RE2-like); `include_glob`/`exclude_glob` filter paths. Returns { matches, truncated }. Errors return { code, message }; common: S217 bad regex, S215 jail escape. coder::search adds context lines and noise filtering.
exclude_globstring[]
Glob filters excluding file paths from the search.
ignore_caseboolean
Match pattern case-insensitively.
include_globstring[]
Glob filters restricting which file paths are searched.
max_line_bytesinteger· uint64min 0
Skip lines longer than this many bytes (default 4 096).
max_matchesinteger· uint64min 0
Stop collecting matches after this many results (default 10 000).
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
patternstring*required
Rust regex (RE2-like) matched against each line.
recursiveboolean
Descend into subdirectories (default true).
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
matchesobject[]*required
All collected match locations up to `max_matches`.
lineinteger· uint64*requiredmin 0
truncatedboolean*required
True when the result was capped by `max_matches` or `max_line_bytes`.
List the files and subdirectories of a directory on the filesystem, sorted by name and paginated: `page` (1-based, default 1) and `page_size` (default 500, max 2000); `has_more: true` means request the next page. Errors return { code, message }; common: S210 bad path, S211 not found or not accessible, S212 not a directory, S215 jail escape. For recursive listings prefer coder::tree.
pageinteger· uint32min 0
1-based page of the name-sorted listing. Default 1.
page_sizeinteger· uint32min 0
Entries per page. Default 500, clamped to 2000. A directory larger than one page answers `has_more: true` — request the next `page` rather than expecting the whole directory in one result.
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
entriesobject[]*required
Metadata for each entry on this page, sorted by name.
is_symlinkboolean*required
mtimeinteger· int64*required
sizeinteger· uint64*requiredmin 0
has_moreboolean
True when later pages exist; request `page + 1` to continue.
pageinteger· uint32min 0
The 1-based page this response carries.
page_sizeinteger· uint32min 0
The page size actually applied (after clamping).
totalinteger· uint64min 0
Entries in the whole directory, across every page.
Create a directory. `mode` is an octal string like "0755". `parents: true` creates missing parents and is idempotent. Returns { created, path, already_existed }. Errors return { code, message }; common: S210 bad mode, S213 exists, S215 jail escape.
modestring
Octal permission string, e.g. "0755".
parentsboolean
Create missing parent directories.
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
already_existedboolean
True when the path already existed and `parents` was set. Host only; sandbox targets default this to false (not a signal there).
createdboolean*required
True when a new directory was created; false when it already existed (only possible with `parents: true`, which is idempotent).
pathstring
The directory path that was targeted. Empty for sandbox targets.
Move or rename a file or directory. `overwrite: true` allows replacing an existing dst. Returns { moved, src, dst, overwrote }. Errors return { code, message }; common: S211 src not found or not accessible, S213 dst exists, S215 jail escape. coder::move moves several paths per call.
dststring*required
Destination path; jail-relative when fs.host_roots are set, else absolute.
overwriteboolean
Replace an existing destination instead of returning an error.
srcstring*required
Source path; jail-relative when fs.host_roots are set, else absolute.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
dststring
Destination path. Empty for sandbox targets.
movedboolean*required
True when the move/rename succeeded.
overwroteboolean
True when an existing destination was overwritten. Host only (sandbox targets default this to false, not a signal there). Best-effort: derived from a pre-rename existence check, so under a concurrent writer racing the destination it may under-report (and an `overwrite:false` move can still replace a file created in that window).
srcstring
Source path. Empty for sandbox targets.
Stream a file: returns a ContentRef handle (channel_id/access_key) plus size/mode/mtime, NOT the text — for text use coder::read-file, which returns content inline. Errors return { code, message }; common: S211 not found or not accessible, S212 is a directory, S218 over max_read_bytes, S216 channel/IO error.
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
contentall of*required
Channel reference for streaming the file content back to the caller.
all of (1)
variant 1
access_keystring*required
Secret key that authorises access to this channel.
channel_idstring*required
Opaque identifier for the open stream channel.
directionall of
Direction of data flow: "read" (consume) or "write" (produce).
… expand 1 nestedcollapse
all of (1)
variant 1
valuestringenum: read, write
modestring*required
Octal permission string of the file, e.g. "0644".
mtimeinteger· int64*required
Last-modified time as a Unix timestamp (seconds).
sizeinteger· uint64*requiredmin 0
File size in bytes at the time of the read.
Delete a file or directory. `recursive: true` is required for a non-empty directory. Returns { removed, path, was_present }. Errors return { code, message }; common: S211 not found or not accessible, S214 dir not empty, S215 jail escape. coder::delete-file removes several paths per call.
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
recursiveboolean
Required to delete a non-empty directory.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
pathstring
The path that was targeted. Empty for sandbox targets.
removedboolean*required
True when the path was removed.
was_presentboolean
True when the path existed before removal. Host only; sandbox targets default this to false, which does NOT mean the path was absent.
Find-and-replace across files. `pattern` is a Rust regex (regex: false for a literal). Provide either `files` or `path` (+ recursive). Returns { results, total_replacements }. Errors return { code, message }; common: S217 bad regex, S211 not found, S215 jail escape.
exclude_globstring[]
Glob filters excluding file paths from editing.
filesstring[]
Explicit list of file paths to edit; provide either this or `path`, not both.
first_onlyboolean
Replace only the first match per file instead of all matches.
ignore_caseboolean
Match pattern case-insensitively.
include_globstring[]
Glob filters restricting which file paths are edited.
pathstring
Root path to walk for files; used with `recursive`, `include_glob`, `exclude_glob`.
patternstring*required
Rust regex by default; set regex:false for a literal string.
recursiveboolean
Descend into subdirectories when `path` is set (default true).
regexboolean
Treat pattern as a regex (default true) or a literal string (false).
replacementstring*required
String to substitute for each match.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
resultsobject[]*required
Per-file replacement details.
replacementsinteger· uint64*requiredmin 0
total_replacementsinteger· uint64*requiredmin 0
Sum of replacements made across all files.
Stat one file or directory: its type, size, mode, and mtime (paths jail-relative when fs.host_roots are set). Errors return { code, message }; common: S211 not found or not accessible, S215 jail escape. coder::read-file with stat: true additionally reports total_lines.
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
is_symlinkboolean*required
mtimeinteger· int64*required
sizeinteger· uint64*requiredmin 0
Write a file. A string `content` is written inline (host only); large payloads or a sandbox target need a ContentRef { channel_id, access_key, direction } from a write stream channel. `files: [...]` writes several files (host, inline). Errors return { code, message }; common: S210 bad mode or inline-on-sandbox, S218 over max_write_bytes.
contentany of
Single-file content: an inline string (host only) or a ContentRef { channel_id, access_key, direction } for an open write stream; omit with `files`.
any of (2)
variant 1
any of (2)
variant 2
all of (1)
variant 1
access_keystring*required
Secret key that authorises access to this channel.
channel_idstring*required
Opaque identifier for the open stream channel.
directionall of
Direction of data flow: "read" (consume) or "write" (produce).
… expand 1 nestedcollapse
all of (1)
variant 1
valuestringenum: read, write
filesobject[]
Batch form: write several files in one call. When present, the single-file fields (`path`/`content`/`mode`/`parents`) must be omitted.
contentall of*required
Inline string (recommended) or a streaming ContentRef.
all of (1)
variant 1
any of (2)
variant 2
all of (1)
variant 1
access_keystring*required
Secret key that authorises access to this channel.
channel_idstring*required
Opaque identifier for the open stream channel.
directionall of
Direction of data flow: "read" (consume) or "write" (produce).
… expand 1 nestedcollapse
all of (1)
variant 1
valuestringenum: read, write
modestring
Octal permission string, e.g. "0644".
parentsboolean
Create missing parent directories.
pathstring*required
Jail-relative when fs.host_roots are set, else absolute.
modestring
Octal permission string for the single-file form, e.g. "0644" (the default); omit when using `files`.
parentsboolean
Create missing parent directories (single-file form, default false); omit when using `files`.
pathstring
Single-file form: the path to write. Jail-relative when fs.host_roots are set, else absolute. Omit when using `files`.
targetall of
host (default) or { kind: "sandbox", sandbox_id }.
all of (1)
variant 1
one of (2)
variant 1
kindstring*requiredenum: host
variant 2
kindstring*requiredenum: sandbox
sandbox_idstring· uuid*required
bytes_writteninteger· uint64*requiredmin 0
Bytes written: this file for a single write; the sum across `files` for a batch write.
filesobject[]
Per-file results for a batch (`files: [...]`) write; empty for a single-file write.
bytes_writteninteger· uint64*requiredmin 0
Bytes written to this file.
pathstring*required
Path of the written file.
pathstring*required
Path written for a single write; empty for a batch (see `files`).
Terminate a running background job by job_id (returned by shell::exec_bg). Errors return { code, message }; common: S211 no such job, S216 kill/signal delivery failure.
statusstring*requiredenum: running, finished, killed, failed
List background jobs (running + recently completed). Takes no arguments.
countinteger· uint*requiredmin 0
jobsobject[]*required
finished_at_msinteger· uint64min 0
started_at_msinteger· uint64*requiredmin 0
statusstring*requiredenum: running, finished, killed, failed
stderr_truncatedboolean*required
stdout_truncatedboolean*required
shell::on-config-change
functionInternal: reload the security policy + fs backend on configuration change.
idstring
Configuration id that changed (advisory; the handler re-fetches the value). Schema-only: kept to publish a typed request schema; the handler ignores it.
shell::pty::adopt
functionTake back an unattached PTY session whose reconnect token is gone, from the console page that owns it. Refuses a session someone is attached to, and a page that is not the session's own.
after_sequenceinteger· uint64min 0
colsinteger· uint16*requiredmin 0
output_function_idstring*required
Where output goes next; must belong to the same console page family as the target it replaces.
rowsinteger· uint16*requiredmin 0
session_idstring*required
access_keystring*required
framesobject[]*required
sequenceinteger· uint64*requiredmin 0
next_sequenceinteger· uint64*requiredmin 0
reconnect_tokenstring*required
statusone of*required
one of (2)
variant 1
valuestringenum: attached, detached
variant 2
exitedobject*required
… expand 3 nestedcollapse
exit_codeinteger· uint32min 0
truncatedboolean*required
shell::pty::attach
functionAttach to a retained PTY session and replay buffered output.
after_sequenceinteger· uint64*requiredmin 0
colsinteger· uint16*requiredmin 0
output_function_idstring*required
reconnect_tokenstring*required
rowsinteger· uint16*requiredmin 0
session_idstring*required
access_keystring*required
framesobject[]*required
sequenceinteger· uint64*requiredmin 0
next_sequenceinteger· uint64*requiredmin 0
reconnect_tokenstring*required
statusone of*required
one of (2)
variant 1
valuestringenum: attached, detached
variant 2
exitedobject*required
… expand 3 nestedcollapse
exit_codeinteger· uint32min 0
truncatedboolean*required
shell::pty::close
functionTerminate and close a PTY session.
access_keystring*required
session_idstring*required
shell::pty::detach
functionDetach a browser output target while retaining its PTY session.
access_keystring*required
session_idstring*required
statusone of*required
one of (2)
variant 1
valuestringenum: attached, detached
variant 2
exitedobject*required
… expand 3 nestedcollapse
exit_codeinteger· uint32min 0
Open a persistent host PTY running the user's login shell, or the program named in `program`.
argsstring[]
argv for `program`. Ignored without `program` (a login shell takes no arguments here).
colsinteger· uint16*requiredmin 0
envobject
Extra environment on top of what the worker forwards; exec-hijacking keys (PATH, LD_*, DYLD_*, BASH_ENV, …) fail the call.
output_function_idstring*required
programstring
Program to run instead of the user's login shell (an agent CLI, REPL, TUI), resolved on the worker's PATH.
rowsinteger· uint16*requiredmin 0
access_keystring*required
programstring
The program the session runs; absent for a login shell.
reconnect_tokenstring*required
session_idstring*required
shell::pty::resize
functionResize a PTY session in terminal columns and rows.
access_keystring*required
colsinteger· uint16*requiredmin 0
rowsinteger· uint16*requiredmin 0
session_idstring*required
colsinteger· uint16*requiredmin 0
rowsinteger· uint16*requiredmin 0
shell::pty::sessions
functionList live PTY sessions with program, cwd, sequence, replay buffer size, and output target. Diagnostics only — no credentials.
sessionsobject[]*required
frame_bytesinteger· uint*requiredmin 0
framesinteger· uint*requiredmin 0
Frames still replayable from the ring buffer.
output_function_idstring
Where output is being delivered; absent while detached.
sequenceinteger· uint64*requiredmin 0
Sequence number of the last frame the session produced.
session_idstring*required
statusone of*required
one of (2)
variant 1
valuestringenum: attached, detached
variant 2
exitedobject*required
… expand 3 nestedcollapse
exit_codeinteger· uint32min 0
truncatedboolean*required
Whether the buffer has dropped frames a full replay would need.
uistring
The console page family this session belongs to — the `<name>` in `iii::<name>-ui::pty-output::console-<browser>`. Present whether or not anyone is attached, because it is what a page uses to recognise its own orphaned session; it names a page, never a browser.
shell::pty::write
functionWrite base64-encoded keyboard input to a PTY session.
access_keystring*required
session_idstring*required
writteninteger· uint*requiredmin 0
Fetch the full record (status, exit_code, timing) of a background job by job_id. Errors return { code, message }; common: S211 no such job.
jobobject*required
finished_at_msinteger· uint64min 0
started_at_msinteger· uint64*requiredmin 0
statusstring*requiredenum: running, finished, killed, failed
stderr_truncatedboolean*required
stdout_truncatedboolean*required
shell::workspace::list
functionConsole-only workspace picker control plane: list child directories under an existing host directory. Returns canonical paths and never returns files.
page_sizeinteger· uintmin 0
entriesobject[]*required
kindstring*requiredenum: dir
Console-only: one bounded byte range of a file, base64 (at most 4 MiB raw per call), so a page can stream a large image without one oversized frame.
lengthinteger· uint64min 0
Bytes to return; omitted or over the cap = `READ_BYTES_MAX_CHUNK`.
offsetinteger· uint64min 0
First byte of the range (default 0).
pathstring*required
Absolute path, or relative to the primary root (same rules as coder::read-file).
contentstring*required
The chunk, base64 (standard alphabet, padded).
eofboolean*required
True when `offset + length` reached the end of the file.
lengthinteger· uint64*requiredmin 0
Raw bytes in this chunk (before base64).
mtimeinteger· int64*required
Last-modified time as a Unix epoch in seconds.
offsetinteger· uint64*requiredmin 0
Offset the returned range starts at.
pathstring*required
Canonical absolute path.
sizeinteger· uint64*requiredmin 0
Size of the whole file in bytes.
shell::workspace::roots
functionConsole-only workspace picker control plane: return canonical host directory anchors that an operator can browse before choosing a per-session working directory.
Console-only workspace picker control plane: validate that `path` is an existing host directory and return its canonical path.