Skip to content
Registry

ide

(alias: shell)v0.12.32

Unix shell + filesystem worker — exec with denylist/timeout/output caps and background jobs; fs::ls|stat|mkdir|rm|chmod|mv|grep|sed|read|write with host jail, denylist, size caps, and sandbox-target forwarding

license: Apache-2.0Used in 1 kitbashexecfilesystemideshellterminal

Install

bash
iii trigger compose::add worker=ide@0.12.32

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

Functions57

coder::change-diff

Function

Internal console UI: retrieve an exact before/after snapshot by change id.

Request
  • change_idstringrequired
Response
  • is_binarybooleanrequired
  • 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.

  • pathstringrequired

coder::create-file

Function

Create 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).

Request
  • filesobject[]required
    • contentstringrequired
    • 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.

    • pathstringrequired

      File to create.

Response
  • resultsobject[]required
    • bytes_writteninteger· uint64requiredmin 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
      • codestringrequired

        Stable error code, e.g. "C211". See the README error table.

      • messagestringrequired

        Human/LLM-readable message: problem + actual values + corrective next call.

      Variant 2
      valuenull
    • pathstringrequired

      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.

    • successbooleanrequired

coder::delete-file

Function

Remove 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).

Request
  • pathsstring[]required

    Paths to remove.

  • recursiveboolean

    Required for non-empty directories. Files and empty dirs ignore it.

Response
  • 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
      • codestringrequired

        Stable error code, e.g. "C211". See the README error table.

      • messagestringrequired

        Human/LLM-readable message: problem + actual values + corrective next call.

      Variant 2
      valuenull
    • pathstringrequired

      Canonical absolute path (resolved through the jail); the caller's input verbatim when resolution failed.

    • removedbooleanrequired
    • successbooleanrequired

coder::info

Function

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.

Request
Empty object
Response
  • 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· uint64requiredmin 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· uint32requiredmin 0

    Default `page_size` used by `coder::list-folder` when the caller omits it.

  • list_max_page_sizeinteger· uint32requiredmin 0

    Hard cap on `page_size` accepted by `coder::list-folder`.

  • max_output_bytesinteger· uint64requiredmin 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· uint64requiredmin 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· uint64requiredmin 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 ofrequired

    `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_rootstringrequired

    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· uint32requiredmin 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· uint32requiredmin 0

    Default `max_matches` used by `coder::search` when the caller omits it.

  • search_response_budget_bytesinteger· uint64requiredmin 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· uint32requiredmin 0

    Default `max_depth` used by `coder::tree` when the caller omits it.

  • tree_per_folder_limitinteger· uint32requiredmin 0

    Maximum entries returned per folder node by `coder::tree`; folders that exceed this are flagged `truncated`.

  • versionstringrequired

    Coder worker version (`CARGO_PKG_VERSION`).

coder::list-folder

Function

List 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).

Request
  • pageinteger· uint32min 0
  • page_sizeinteger· uint32min 0

    Capped at list_max_page_size; defaults to list_default_page_size (see coder::info).

  • pathstring

    Folder to list (default `.`).

Response
  • entriesobject[]required
    • kindstringrequiredenum file, dir, symlink, other
    • mtimeinteger· int64required
    • namestringrequired

      Entry basename. The absolute path is derivable from the response's `path`: entry path = folder path + "/" + name.

    • non_accessiblebooleanrequired

      True if this entry matches `non_accessible_globs` — caller cannot read/write/delete it via `coder::*` even though it shows up here.

    • sizeinteger· uint64requiredmin 0
  • has_morebooleanrequired
  • pageinteger· uint32requiredmin 0
  • page_sizeinteger· uint32requiredmin 0
  • pathstringrequired

    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· uint64requiredmin 0

coder::list-templates

Function

List the worker templates coder::scaffold-worker creates from: id, name, description, language (node | python) and requires (the compose containers the worker needs, e.g. http). source names where they come from: a local dir, or a cached git clone with ref and revision; warning means the clone could not refresh and is stale. refresh: true re-fetches it now.

Request
  • refreshboolean

    Re-fetch the cached git clone now instead of after `code.templates.refresh_secs`. No effect on a local dir.

Response
  • sourceall ofrequired

    Where the templates were read from.

    all of (1)
    Variant 1
    • kindstringrequired

      `dir` (a local checkout) or `git` (a cached clone).

    • locationstringrequired

      The templates directory (`dir`) or the clone URL (`git`).

    • refstring

      Branch or tag of the clone (`git` only).

    • revisionstring

      Commit the clone is at (`git` only).

    • warningstring

      Set when the clone could not be refreshed and a stale copy is served.

  • templatesobject[]required
    • descriptionstringrequired
    • idstringrequired

      Pass as `template` to coder::scaffold-worker.

    • languagestringrequiredenum node, python

      Runtime of a worker template, from the template's own `requires`.

    • namestringrequired
    • requiresstring[]required

      Compose containers the worker needs, e.g. `http`.

coder::move

Function

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).

Request
  • filesobject[]required

    Entries to move. Each entry is processed independently so a single failure never aborts the rest.

    • fromstringrequired

      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.

    • tostringrequired

      Destination path.

Response
  • 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
      • codestringrequired

        Stable error code, e.g. "C211". See the README error table.

      • messagestringrequired

        Human/LLM-readable message: problem + actual values + corrective next call.

      Variant 2
      valuenull
    • fromstringrequired

      Canonical absolute path of the source (resolved through the jail); the caller's input verbatim when resolution failed.

    • movedbooleanrequired

      True only when the move fully completed; false for a no-op self-move (`from` and `to` resolve to the same file).

    • successbooleanrequired
    • tostringrequired

      Canonical absolute path of the destination (resolved through the jail); the caller's input verbatim when resolution failed.

coder::read-file

Function

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).

Request
  • 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 1
    valuestring
    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.

    • pathstringrequired

      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.

Response
  • 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
      • codestringrequired

        Stable error code, e.g. "C211". See the README error table.

      • messagestringrequired

        Human/LLM-readable message: problem + actual values + corrective next call.

      Variant 2
      valuenull
    • 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.

    • pathstringrequired

      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.

    • successbooleanrequired

      `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[]`.**

coder::scaffold-worker

Function

Create a new iii worker from a coder::list-templates template and start it: write its files into directory (default workers/<name>; its last folder must be <name>, C232 otherwise) with the template's name token replaced, all or nothing (a directory that exists and is not empty fails C233), then add it to the stack in the same call (compose::add with the worker, its start_after and the requires the stack lacks) and return operation_id and started, or start_error with the files kept. A container already named <name> fails C235 before any write. To be woken when it is up, register a trigger on an operation_id you pick and pass it here. start: false writes the files only; send the returned compose_add whole to compose::add, adding start_after to its workers entry and one entry per missing requires (never move its fields to the top level, where scripts are ignored, or use the bare worker string form, which drops them). Paths: relative to the primary root or absolute inside an allowed root (see coder::info).

Request
  • directorystring

    Folder to create the worker in: missing or empty, and its last folder must be `name` (compose names the container after it). Defaults to the template's worker folder for this name (`workers/<name>`).

  • namestringrequired

    The new worker's name: lowercase kebab-case, 1-63 chars. It replaces the template's name token, so it names the folder, the compose container and the function prefix (`<name>::hello`).

  • operation_idstring

    With start: the compose::add operation id. Pick one and register a trigger on it before this call to be woken when it ends; compose picks one when omitted.

  • startboolean

    Add the worker to the stack in this call (default true): compose::add with the worker and each requires that compose::status does not list, then return its operation_id. A container with this name already in the stack fails C235 before any file is written. false writes the files only.

  • start_afterstring[]

    With start: containers the worker cannot run without (its compose entry's start_after); compose stops it whenever one of them exits. Never the console's: a worker's UI triggers wait for the console.

  • templatestringrequired

    Template id from coder::list-templates.

Response
  • composeunknownrequired

    Container object to pass whole in `compose::add { workers: [compose] }` (the bare `worker` string form drops its scripts): `worker` is the absolute folder path; `start_after` is left to the caller.

  • compose_addunknownrequired

    The compose::add payload: send it whole (do not move its entry's fields to the top level, where scripts are ignored), adding start_after to its workers entry and, for each requires that compose::status does not list, one more entry in workers.

  • directorystringrequired

    Canonical absolute path of the new worker folder.

  • filesobject[]required
    • bytesinteger· uint64requiredmin 0
    • pathstringrequired

      Canonical absolute path.

    • revisionstringrequired

      Revision of the bytes written, as coder::read-file reports it.

  • namestringrequired
  • next_stepsstring[]required
  • operation_idstring

    With start: compose::add's operation (follow it with compose::operation, or a trigger registered on its id).

  • requiresstring[]required

    Compose containers the worker needs (e.g. `http`); add the ones `compose::status` does not list in the same `compose::add`.

  • start_errorstring

    With start: why compose::add failed. The files are written; send compose_add to compose::add to add the worker.

  • startedstring[]

    With start: the containers compose::add was asked to add, the worker first.

  • templatestringrequired

coder::search

Function

Search file contents (literal or regex) and/or paths (files and dirs); first match per line only; path may be a folder or a single file. 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).

Request
  • 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; more is clamped to 10); truncated to max_line_bytes and counted in the budget. Default 0.

  • exclude_globsstring[]

    Glob patterns (relative to the session root, like include_globs) 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.

  • ignore_caseboolean
  • include_globsstring[]

    Glob patterns paths must match, relative to the SESSION ROOT, never to `path`: with path `ade`, write `ade/README.md` or `**/README.md`, not `README.md`. 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. A `path` that names a dot-file or dot-folder is still searched: naming it is explicit intent.

  • 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 or file to search (default `.`); a file searches just that file. It only narrows the walk: globs are NOT relative to it, they match paths relative to the session root (or to the configured root that contains them; see coder::info). Result paths are absolute.

  • querystring

    Text to find: a literal substring, or a regex with `regex: true`. Always send it; `""` is allowed only when `search_content` is false, and lists every path (with `fuzzy_paths`, shallow and short paths first).

  • regexboolean
  • 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.

Response
  • 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· uint32requiredmin 0
    • lineinteger· uint32requiredmin 0
    • pathstringrequired

      Absolute path under the canonical parent; symlinks at the entry itself are not resolved. Operations on it re-validate through the jail.

    • textstringrequired

      Matched line; truncated to `max_line_bytes` and never spans newlines.

  • noticestring

    Set when the request was adjusted to run (a field read under its canonical name, or a value clamped); send the canonical form.

  • path_matchesobject[]required
    • kindall ofrequired

      What matched: `file` or `dir`. Directories match by NAME only — content search never reads them.

      all of (1)
      Variant 1
      valuestringenum file, dir
    • pathstringrequired

      Absolute path under the canonical parent; symlinks at the entry itself are not resolved. Operations on it re-validate through the jail.

  • truncatedbooleanrequired

    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.

coder::tree

Function

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).

Request
  • 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.

Response
  • pathstringrequired

    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 ofrequired

    Root node of the snapshot; its `name` is the folder's basename.

    all of (1)
    Variant 1
    • childrenunknown[]
    • kindstringrequiredenum file, dir, symlink, other
    • mtimeinteger· int64required
    • namestringrequired

      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_accessiblebooleanrequired
    • sizeinteger· uint64requiredmin 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").

      Show 2 nested
      any of (2)
      Variant 1
      • hintstringrequired
      • reasonstringrequired

        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· uint32requiredmin 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).

      Variant 2
      valuenull

coder::update-file

Function

Edit one or more files: batched line ops (1-based, inclusive, applied bottom-up), then regex replace ops; each file commits atomically. To rewrite a whole file use coder::create-file with overwrite: true. 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).

Request
  • filesobject[]required
    • opsone of[]required
      one of (4)
      Variant 1
      • at_lineinteger· uint32requiredmin 0
      • contentstringrequired
      • opstringrequiredenum insert
      Variant 2
      • from_lineinteger· uint32requiredmin 0
      • opstringrequiredenum remove
      • to_lineinteger· uint32requiredmin 0
      Variant 3
      • contentstringrequired
      • from_lineinteger· uint32requiredmin 0
      • opstringrequiredenum update_lines
      • to_lineinteger· uint32requiredmin 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.

      • ignore_caseboolean
      • opstringrequiredenum replace
      • patternstringrequired
      • replacementstringrequired

        Substitution text; $1/${1}/$name/${name} expand captures ($0 = whole match), a literal $ is written $$ (`$${name}`). Unknown references fail C210.

    • pathstringrequired

      File to edit.

Response
  • resultsobject[]required
    • appliedinteger· uint32requiredmin 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· uint64requiredmin 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· uint32requiredmin 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_truncatedbooleanrequired

      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
      • codestringrequired

        Stable error code, e.g. "C211". See the README error table.

      • messagestringrequired

        Human/LLM-readable message: problem + actual values + corrective next call.

      Variant 2
      valuenull
    • new_line_countinteger· uint64requiredmin 0

      Final line count after applying (only meaningful when `success`).

    • noticestring

      Set when ops were sent without `op` and it was inferred from their keys; send `op` explicitly.

    • pathstringrequired

      Canonical absolute path (resolved through the jail); the caller's input verbatim when resolution failed.

    • successbooleanrequired

ide::configuration-id

Function

Returns this worker instance's effective configuration entry ID, without its value.

Request
Empty object
Response
  • idstringrequired

ide::ui-content

Function

Serve the ide worker's injected console UI assets (content function for its console:script / console:style / console:module triggers).

Request
  • pathstringrequired

    The asset path from the trigger config (e.g. `state/page.js`).

Response
  • contentstringrequired

    The asset source, verbatim.

  • content_typestringrequired

    MIME type the console should serve the asset with.

shell::config-status

Function

Report 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.

Request
Empty object
Response
  • last_errorstring

    Build error from the most recent rejected reload (why it was refused).

  • last_outcomeone ofrequired

    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· uint64requiredmin 0

    Cumulative count of rejected reloads since boot (never reset).

shell::exec

Function

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.

Request
  • argsstring[]

    Arguments, in order (all strings). Omit/null to tokenize `command` shell-words style; pass an array (even empty) to use it verbatim.

  • commandstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
  • timeout_msinteger· uint64min 0

    Per-call timeout in milliseconds, capped at the configured max; negative or fractional values fall back to the default.

Response
  • duration_msinteger· uint64requiredmin 0
  • exit_codeinteger· int32
  • stderrstringrequired
  • stderr_truncatedbooleanrequired
  • stdoutstringrequired
  • stdout_truncatedbooleanrequired
  • timed_outbooleanrequired

shell::exec_bg

Function

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.

Request
  • argsstring[]

    Arguments, in order (all strings). Omit/null to tokenize `command` shell-words style; pass an array (even empty) to use it verbatim.

  • commandstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
  • timeout_msinteger· uint64min 0

    Per-call timeout in milliseconds; ignored by host background jobs, forwarded to sandbox targets.

Response
  • argvstring[]required
  • job_idstringrequired

shell::fs::chmod

Function

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.

Request
  • gidinteger· uint32min 0

    Optional chown to this numeric gid.

  • modestringrequired

    Octal permission string, e.g. "0755".

  • pathstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
  • uidinteger· uint32min 0

    Optional chown to this numeric uid.

Response
  • entries_changedinteger· uint64requiredmin 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.

shell::fs::grep

Function

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.

Request
  • 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).

  • pathstringrequired

    Jail-relative when fs.host_roots are set, else absolute.

  • patternstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • matchesobject[]required

    All collected match locations up to `max_matches`.

    • contentstringrequired
    • lineinteger· uint64requiredmin 0
    • pathstringrequired
  • truncatedbooleanrequired

    True when the result was capped by `max_matches` or `max_line_bytes`.

shell::fs::ls

Function

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.

Request
  • 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.

  • pathstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • entriesobject[]required

    Metadata for each entry on this page, sorted by name.

    • is_dirbooleanrequired
    • is_symlinkbooleanrequired
    • modestringrequired
    • mtimeinteger· int64required
    • namestringrequired
    • sizeinteger· uint64requiredmin 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.

shell::fs::mkdir

Function

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.

Request
  • modestring

    Octal permission string, e.g. "0755".

  • parentsboolean

    Create missing parent directories.

  • pathstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • already_existedboolean

    True when the path already existed and `parents` was set. Host only; sandbox targets default this to false (not a signal there).

  • createdbooleanrequired

    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.

shell::fs::mv

Function

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.

Request
  • dststringrequired

    Destination path; jail-relative when fs.host_roots are set, else absolute.

  • overwriteboolean

    Replace an existing destination instead of returning an error.

  • srcstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • dststring

    Destination path. Empty for sandbox targets.

  • movedbooleanrequired

    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.

shell::fs::read

Function

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.

Request
  • pathstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • contentall ofrequired

    Channel reference for streaming the file content back to the caller.

    all of (1)
    Variant 1
    • access_keystringrequired

      Secret key that authorises access to this channel.

    • channel_idstringrequired

      Opaque identifier for the open stream channel.

    • directionall of

      Direction of data flow: "read" (consume) or "write" (produce).

      Show 1 nested
      all of (1)
      Variant 1
      valuestringenum read, write
  • modestringrequired

    Octal permission string of the file, e.g. "0644".

  • mtimeinteger· int64required

    Last-modified time as a Unix timestamp (seconds).

  • sizeinteger· uint64requiredmin 0

    File size in bytes at the time of the read.

shell::fs::rm

Function

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.

Request
  • pathstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • pathstring

    The path that was targeted. Empty for sandbox targets.

  • removedbooleanrequired

    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.

shell::fs::sed

Function

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.

Request
  • 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`.

  • patternstringrequired

    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).

  • replacementstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • resultsobject[]required

    Per-file replacement details.

    • errorstring
    • pathstringrequired
    • replacementsinteger· uint64requiredmin 0
    • successbooleanrequired
  • total_replacementsinteger· uint64requiredmin 0

    Sum of replacements made across all files.

shell::fs::stat

Function

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.

Request
  • pathstringrequired

    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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • is_dirbooleanrequired
  • is_symlinkbooleanrequired
  • modestringrequired
  • mtimeinteger· int64required
  • namestringrequired
  • sizeinteger· uint64requiredmin 0

shell::fs::write

Function

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.

Request
  • 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 1
    valuestring
    Variant 2
    all of (1)
    Variant 1
    • access_keystringrequired

      Secret key that authorises access to this channel.

    • channel_idstringrequired

      Opaque identifier for the open stream channel.

    • directionall of

      Direction of data flow: "read" (consume) or "write" (produce).

      Show 1 nested
      all of (1)
      Variant 1
      valuestringenum read, write
    Variant 2
    valuenull
  • filesobject[]

    Batch form: write several files in one call. When present, the single-file fields (`path`/`content`/`mode`/`parents`) must be omitted.

    • contentall ofrequired

      Inline string (recommended) or a streaming ContentRef.

      all of (1)
      Variant 1
      any of (2)
      Variant 1
      valuestring
      Variant 2
      all of (1)
      Variant 1
      • access_keystringrequired

        Secret key that authorises access to this channel.

      • channel_idstringrequired

        Opaque identifier for the open stream channel.

      • directionall of

        Direction of data flow: "read" (consume) or "write" (produce).

        Show 1 nested
        all of (1)
        Variant 1
        valuestringenum read, write
    • modestring

      Octal permission string, e.g. "0644".

    • parentsboolean

      Create missing parent directories.

    • pathstringrequired

      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
    • kindstringrequiredenum host
    Variant 2
    • kindstringrequiredenum sandbox
    • sandbox_idstring· uuidrequired
Response
  • bytes_writteninteger· uint64requiredmin 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· uint64requiredmin 0

      Bytes written to this file.

    • pathstringrequired

      Path of the written file.

  • pathstringrequired

    Path written for a single write; empty for a batch (see `files`).

shell::kill

Function

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.

Request
  • job_idstringrequired
Response
  • job_idstringrequired
  • killedbooleanrequired
  • reasonstring
  • statusstringrequiredenum running, finished, killed, failed

shell::list

Function

List background jobs (running + recently completed). Takes no arguments.

Request
Empty object
Response
  • countinteger· uintrequiredmin 0
  • jobsobject[]required
    • exit_codeinteger· int32
    • finished_at_msinteger· uint64min 0
    • idstringrequired
    • started_at_msinteger· uint64requiredmin 0
    • statusstringrequiredenum running, finished, killed, failed
    • stderr_truncatedbooleanrequired
    • stdout_truncatedbooleanrequired

shell::on-config-change

Function

Internal: reload the security policy + fs backend on configuration change.

Request
  • 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.

Response
  • okbooleanrequired

shell::pty::adopt

Function

Take 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.

Request
  • after_sequenceinteger· uint64min 0
  • colsinteger· uint16requiredmin 0
  • output_function_idstringrequired

    Where output goes next; must belong to the same console page family as the target it replaces.

  • rowsinteger· uint16requiredmin 0
  • session_idstringrequired
Response
  • access_keystringrequired
  • cwdstringrequired
  • framesobject[]required
    • datastringrequired
    • sequenceinteger· uint64requiredmin 0
  • next_sequenceinteger· uint64requiredmin 0
  • reconnect_tokenstringrequired
  • statusone ofrequired
    one of (2)
    Variant 1
    valuestringenum attached, detached
    Variant 2
    • exitedobjectrequired
      Show 3 nested
      • errorstring
      • exit_codeinteger· uint32min 0
      • signalstring
  • truncatedbooleanrequired

shell::pty::attach

Function

Attach to a retained PTY session and replay buffered output.

Request
  • after_sequenceinteger· uint64requiredmin 0
  • colsinteger· uint16requiredmin 0
  • output_function_idstringrequired
  • reconnect_tokenstringrequired
  • request_idstring
  • rowsinteger· uint16requiredmin 0
  • session_idstringrequired
Response
  • access_keystringrequired
  • cwdstringrequired
  • framesobject[]required
    • datastringrequired
    • sequenceinteger· uint64requiredmin 0
  • next_sequenceinteger· uint64requiredmin 0
  • reconnect_tokenstringrequired
  • statusone ofrequired
    one of (2)
    Variant 1
    valuestringenum attached, detached
    Variant 2
    • exitedobjectrequired
      Show 3 nested
      • errorstring
      • exit_codeinteger· uint32min 0
      • signalstring
  • truncatedbooleanrequired

shell::pty::close

Function

Terminate and close a PTY session.

Request
  • access_keystringrequired
  • session_idstringrequired
Response
  • closedbooleanrequired

shell::pty::detach

Function

Detach a browser output target while retaining its PTY session.

Request
  • access_keystringrequired
  • session_idstringrequired
Response
  • statusone ofrequired
    one of (2)
    Variant 1
    valuestringenum attached, detached
    Variant 2
    • exitedobjectrequired
      Show 3 nested
      • errorstring
      • exit_codeinteger· uint32min 0
      • signalstring

shell::pty::open

Function

Open a persistent host PTY running the user's login shell, or the program named in `program`.

Request
  • argsstring[]

    argv for `program`. Ignored without `program` (a login shell takes no arguments here).

  • colsinteger· uint16requiredmin 0
  • cwdstringrequired
  • envobject

    Extra environment on top of what the worker forwards; exec-hijacking keys (PATH, LD_*, DYLD_*, BASH_ENV, …) fail the call.

  • output_function_idstringrequired
  • programstring

    Program to run instead of the user's login shell (an agent CLI, REPL, TUI), resolved on the worker's PATH.

  • request_idstring
  • rowsinteger· uint16requiredmin 0
Response
  • access_keystringrequired
  • cwdstringrequired
  • pidinteger· uint32min 0
  • programstring

    The program the session runs; absent for a login shell.

  • reconnect_tokenstringrequired
  • session_idstringrequired

shell::pty::resize

Function

Resize a PTY session in terminal columns and rows.

Request
  • access_keystringrequired
  • colsinteger· uint16requiredmin 0
  • rowsinteger· uint16requiredmin 0
  • session_idstringrequired
Response
  • colsinteger· uint16requiredmin 0
  • rowsinteger· uint16requiredmin 0

shell::pty::sessions

Function

List live PTY sessions with program, cwd, sequence, replay buffer size, and output target. Diagnostics only — no credentials.

Request
Empty object
Response
  • sessionsobject[]required
    • cwdstringrequired
    • frame_bytesinteger· uintrequiredmin 0
    • framesinteger· uintrequiredmin 0

      Frames still replayable from the ring buffer.

    • output_function_idstring

      Where output is being delivered; absent while detached.

    • pidinteger· uint32min 0
    • programstring
    • sequenceinteger· uint64requiredmin 0

      Sequence number of the last frame the session produced.

    • session_idstringrequired
    • statusone ofrequired
      one of (2)
      Variant 1
      valuestringenum attached, detached
      Variant 2
      • exitedobjectrequired
        Show 3 nested
        • errorstring
        • exit_codeinteger· uint32min 0
        • signalstring
    • truncatedbooleanrequired

      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

Function

Write base64-encoded keyboard input to a PTY session.

Request
  • access_keystringrequired
  • datastringrequired
  • session_idstringrequired
Response
  • writteninteger· uintrequiredmin 0

shell::scm::commit-message

Function

Console-only: write a git commit message for the diff text `changes` (stat + unified diff, capped at 60000 chars) with an LLM through router::complete. Optional `recent_subjects` give the repository's style; `fallback_model` (provider::model) is used when commit_messages.model is unset. Returns { message, model }. Errors return { code, message }: NO_MODEL no model configured or passed, EMPTY_CHANGES blank diff, ROUTER_FAILED the model call failed, EMPTY_MESSAGE the model returned no text.

Request
  • changesstringrequired

    Diff text prepared by the UI (stat + unified diff). Capped at 60000 characters; the rest is cut and marked `[diff truncated]`.

  • fallback_modelstring

    `provider::model` (or bare model id) used when `commit_messages.model` is unset: the chat's default model.

  • recent_subjectsstring[]

    Recent commit subjects of the repository, for style.

Response
  • messagestringrequired

    The commit message: summary line, and a body when the change needs one.

  • modelstringrequired

    The model id actually used, as configured or passed.

shell::scm::commit-message-config

Function

Console-only: the live `commit_messages` settings behind the Commit panel's Generate button. Returns { model: string|null, thinking: string, instructions: string }; `model` is null when unset (the panel then passes the chat's default model as `fallback_model`).

Request
Empty object
Response
  • instructionsstringrequired

    Configured `commit_messages.instructions`.

  • modelstring

    Configured `commit_messages.model`, trimmed; null when unset.

  • thinkingall ofrequired

    Configured reasoning effort: default|minimal|low|medium|high|xhigh.

    all of (1)
    Variant 1
    valuestringenum default, minimal, low, medium, high, xhigh

shell::status

Function

Fetch the full record (status, exit_code, timing) of a background job by job_id. Errors return { code, message }; common: S211 no such job.

Request
  • job_idstringrequired
Response
  • jobobjectrequired
    • argvstring[]required
    • exit_codeinteger· int32
    • finished_at_msinteger· uint64min 0
    • idstringrequired
    • started_at_msinteger· uint64requiredmin 0
    • statusstringrequiredenum running, finished, killed, failed
    • stderrstringrequired
    • stderr_truncatedbooleanrequired
    • stdoutstringrequired
    • stdout_truncatedbooleanrequired

shell::turns::adopt-root

Function

Internal: add a newly created project root to the active Harness turn after a confirmed workspace proposal.

Request
  • rootstringrequired
  • session_idstringrequired
  • turn_idstringrequired
Response
  • recordedinteger· uintrequiredmin 0

shell::turns::get

Function

Fetch one turn of a session's change history: every file it changed, the change kind, the function that made it, the sub-agent that did it when one did, the file's body before the turn and, once the turn has ended or a later turn kept it, the body it left behind (`after`). Bodies come from the root's tree snapshots when the turn has them, hooked or not, else from the hooks' pre-images; 1 MiB of bodies per response. Omit turn_id for the newest turn.

Request
  • session_idstringrequired
  • turn_idstring

    Omit for the newest turn.

Response
  • session_idstringrequired
  • turnany of
    any of (2)
    Variant 1
    • ended_atinteger· uint64min 0
    • filesobject[]
      Show 11 nested
      • afterany of

        The body after this turn's last write, when a later turn kept it as its own pre-image. Never stored; filled in by `shell::turns::get`. Absent means the working copy is the body after this turn.

        Show 2 nested
        any of (2)
        Variant 1
        • binaryboolean
        • contentstring

          UTF-8 body before the write. Never stored in the record; filled in by `shell::turns::get` from the blob store, up to `MAX_PRE_IMAGE_BYTES`.

        • missingboolean

          The path did not exist before the call.

        • revisionstring

          `sha256:<hex>` of the bytes before the write; absent when the file did not exist or could not be read. Doubles as the blob key.

        • storedboolean

          A blob for `revision` exists in the store.

        • truncatedboolean

          The body was larger than the cap (not kept) or did not fit the response budget; the revision still identifies it.

        Variant 2
        valuenull
      • after_revisionstring

        Revision after the last write, when the file could be read back.

      • agentany of

        The sub-agent session that made the change, when it was not the turn's own session. Children's changes are recorded under the turn of the top-level agent that spawned them, so one turn reads as one unit of work whoever did the typing.

        Show 2 nested
        any of (2)
        Variant 1
        • namestring

          The `subagent_display` name the harness stamped, when it did.

        • session_idstringrequired
        Variant 2
        valuenull
      • beforeany of
        Show 2 nested
        any of (2)
        Variant 1
        • binaryboolean
        • contentstring

          UTF-8 body before the write. Never stored in the record; filled in by `shell::turns::get` from the blob store, up to `MAX_PRE_IMAGE_BYTES`.

        • missingboolean

          The path did not exist before the call.

        • revisionstring

          `sha256:<hex>` of the bytes before the write; absent when the file did not exist or could not be read. Doubles as the blob key.

        • storedboolean

          A blob for `revision` exists in the store.

        • truncatedboolean

          The body was larger than the cap (not kept) or did not fit the response budget; the revision still identifies it.

        Variant 2
        valuenull
      • causestringrequired

        Function id that made the change.

      • first_seeninteger· uint64requiredmin 0
      • fromstring

        Set for a `moved` record: where the file came from.

      • kindstringrequired

        `created` | `modified` | `deleted` | `moved`.

      • last_seeninteger· uint64requiredmin 0
      • pathstringrequired

        Absolute path on the host.

      • rootstring

        The session's workspace root at the time, when the harness named one.

    • snapshotany of

      Trees of the root around the turn (see `turn_snapshot`): where `shell::turns::get` reads the sides of every file from, hooked or not.

      Show 2 nested
      any of (2)
      Variant 1
      • afterstring

        The tree when the turn ended; absent while it runs.

      • after_atinteger· uint64min 0

        When `after` was taken. A file the turn was still gaining after that (a sub-agent at work past its parent's end) is not in the tree; its after side is the working copy.

      • beforestring

        The tree when the turn started.

      • before_atinteger· uint64min 0

        When `before` was taken, unix ms.

      • rootstringrequired

        The canonical root the trees describe.

      Variant 2
      valuenull
    • started_atinteger· uint64requiredmin 0
    • titlestring

      The first characters of the message that started the turn, from the harness `turn-started` event; what a timeline calls the turn.

    • turn_idstringrequired
    Variant 2
    valuenull

shell::turns::list

Function

List the turns of a harness session with the files each one changed through shell or coder functions, newest first. Paths and kinds only; use shell::turns::get for the pre-images.

Request
  • session_idstringrequired
Response
  • session_idstringrequired
  • turnsobject[]required

    Newest first.

    • ended_atinteger· uint64min 0
    • file_countinteger· uintrequiredmin 0
    • filesobject[]required

      Paths with their change kind, without bodies.

      • agentany of

        The sub-agent that made the change, when it was not the turn's own session.

        Show 2 nested
        any of (2)
        Variant 1
        • namestring

          The `subagent_display` name the harness stamped, when it did.

        • session_idstringrequired
        Variant 2
        valuenull
      • kindstringrequired
      • pathstringrequired
      • rootstring
    • started_atinteger· uint64requiredmin 0
    • titlestring

      First characters of the message that started the turn.

    • turn_idstringrequired

shell::turns::on-post-trigger

Function

Internal: records a file change made through a shell or coder call into the session's durable change history. Observes only; always continues.

Request
  • callany of
    any of (2)
    Variant 1
    • argumentsunknown
    • function_idstringrequired
    Variant 2
    valuenull
  • metadataunknown
  • resultany of
    any of (2)
    Variant 1
    • detailsunknown

      The call's return value (`post_trigger` only). `touches` reads the files `coder::scaffold-worker` wrote from it.

    • is_errorboolean
    Variant 2
    valuenull
  • session_idstring
  • turn_idstring
Response
  • decisionstringrequired

shell::turns::on-post-turn

Function

Internal: photographs the session's workspace root as a turn ends, the after side of every file it changed. Observes only; always continues.

Request
  • callany of
    any of (2)
    Variant 1
    • argumentsunknown
    • function_idstringrequired
    Variant 2
    valuenull
  • metadataunknown
  • resultany of
    any of (2)
    Variant 1
    • detailsunknown

      The call's return value (`post_trigger` only). `touches` reads the files `coder::scaffold-worker` wrote from it.

    • is_errorboolean
    Variant 2
    valuenull
  • session_idstring
  • turn_idstring
Response
  • decisionstringrequired

shell::turns::on-pre-trigger

Function

Internal: keeps the pre-image of a file a shell or coder call is about to change. Observes only; always continues.

Request
  • callany of
    any of (2)
    Variant 1
    • argumentsunknown
    • function_idstringrequired
    Variant 2
    valuenull
  • metadataunknown
  • resultany of
    any of (2)
    Variant 1
    • detailsunknown

      The call's return value (`post_trigger` only). `touches` reads the files `coder::scaffold-worker` wrote from it.

    • is_errorboolean
    Variant 2
    valuenull
  • session_idstring
  • turn_idstring
Response
  • decisionstringrequired

shell::turns::on-pre-turn

Function

Internal: photographs the session's workspace root before a turn's first call, so every file the turn changes has an exact before, however it is written. Observes only; always continues.

Request
  • callany of
    any of (2)
    Variant 1
    • argumentsunknown
    • function_idstringrequired
    Variant 2
    valuenull
  • metadataunknown
  • resultany of
    any of (2)
    Variant 1
    • detailsunknown

      The call's return value (`post_trigger` only). `touches` reads the files `coder::scaffold-worker` wrote from it.

    • is_errorboolean
    Variant 2
    valuenull
  • session_idstring
  • turn_idstring
Response
  • decisionstringrequired

shell::turns::on-turn-completed

Function

Internal: closes a turn in the session's change history.

Request
  • message_previewstring

    First characters of the message that started the turn.

  • parentany of

    The spawning turn, for a sub-agent session.

    any of (2)
    Variant 1
    • session_idstring
    • turn_idstring
    Variant 2
    valuenull
  • session_idstring
  • turn_idstring
Response
  • okbooleanrequired

shell::turns::on-turn-started

Function

Internal: opens a turn in the session's change history.

Request
  • message_previewstring

    First characters of the message that started the turn.

  • parentany of

    The spawning turn, for a sub-agent session.

    any of (2)
    Variant 1
    • session_idstring
    • turn_idstring
    Variant 2
    valuenull
  • session_idstring
  • turn_idstring
Response
  • okbooleanrequired

shell::turns::revert

Function

Undo the file changes one turn made, from the pre-images kept in the change history: created files are removed, modified and deleted files get their earlier body back, moved files return to their original path. Pass `paths` to revert a subset. Per-file results say what happened; bodies that were never stored are reported, not guessed.

Request
  • pathsstring[]

    Restrict the revert to these absolute paths; omit for every file the turn changed.

  • session_idstringrequired
  • turn_idstringrequired
Response
  • failedinteger· uintrequiredmin 0

    Files whose revert failed; their `error` says why.

  • resultsobject[]required
    • actionstringrequired

      `restored` (body written back), `removed`, `moved-back`, or `skipped` (nothing to undo, e.g. a delete of a file that never existed).

    • errorstring
    • kindstringrequired

      The recorded change kind that was undone.

    • pathstringrequired
    • successbooleanrequired
  • revertedinteger· uintrequiredmin 0

    Files whose revert succeeded (skips included).

  • session_idstringrequired
  • turn_idstringrequired

shell::ui-state::get

Function

Console-only: the explorer page's stored state for one pane (`key` is the console pane id; `legacy_key`, the workspace tab id, is read when the pane has nothing stored). `state` is null when nothing is stored. Kept under the worker's data directory, per pane.

Request
  • keystringrequired

    The pane's state key (the console pane id).

  • legacy_keystring

    The workspace tab id: saves made before panes had ids are read from here when `key` has nothing stored.

Response
  • keystringrequired
  • stateunknown

    The stored object, or null when nothing is stored.

shell::ui-state::set

Function

Console-only: replace the explorer page's stored state for one pane. Writes only that pane's file, atomically, so panes never clobber each other.

Request
  • keystringrequired
  • stateunknownrequired

    The pane's whole state; replaces what was stored.

Response
  • bytesinteger· uintrequiredmin 0

    Size of the stored document.

  • keystringrequired

shell::workspace::list

Function

Console-only workspace picker control plane: list child directories under an existing host directory. Returns canonical paths and never returns files.

Request
  • page_sizeinteger· uintmin 0
  • pathstringrequired
Response
  • entriesobject[]required
    • kindstringrequiredenum dir
    • namestringrequired
    • pathstringrequired
  • pathstringrequired

shell::workspace::read-bytes

Function

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.

Request
  • 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).

  • pathstringrequired

    Absolute path, or relative to the primary root (same rules as coder::read-file).

Response
  • contentstringrequired

    The chunk, base64 (standard alphabet, padded).

  • eofbooleanrequired

    True when `offset + length` reached the end of the file.

  • lengthinteger· uint64requiredmin 0

    Raw bytes in this chunk (before base64).

  • mtimeinteger· int64required

    Last-modified time as a Unix epoch in seconds.

  • offsetinteger· uint64requiredmin 0

    Offset the returned range starts at.

  • pathstringrequired

    Canonical absolute path.

  • sizeinteger· uint64requiredmin 0

    Size of the whole file in bytes.

shell::workspace::roots

Function

Console-only workspace picker control plane: return canonical host directory anchors that an operator can browse before choosing a per-session working directory.

Request
Empty object
Response
  • rootsstring[]required

shell::workspace::validate

Function

Console-only workspace picker control plane: validate that `path` is an existing host directory and return its canonical path.

Request
  • pathstringrequired
Response
  • pathstringrequired

Triggers4

shell::changed

Trigger

Fires when anything under the watched directory changes, whoever changed it — bind with config: { path } naming the directory (jail-checked like every coder::* path). Ignored paths (git-ignored; outside a repository data/, config/, .iii/, node_modules/) are skipped unless config also sets include_ignored: true, which also watches inside ignored trees. Symlinks are not followed. A tree holding more than 32768 directories (fewer on a host with a low inotify limit) is watched breadth-first from the top for that many: changes deeper down go unreported.

Invocation
valueunknown
Return
valueunknown

shell::git-changed

Trigger

Fires when the git repository a directory sits in changes state — bind with config: { path } naming any directory in the worktree (jail-checked like every coder::* path). One event per ~200 ms batch, listing what moved in `changes`: head (this worktree's HEAD: a switch, a checkout), index (staged changes, a commit), refs (branches, tags, remotes, packed-refs), worktrees (another worktree's HEAD, a worktree added or removed), repository (the repository appeared, disappeared or moved — re-read everything). A path in no repository fires repository once a .git appears in it. Worktree file edits are not reported here: bind shell::changed for those.

Invocation
  • pathstringrequired

    The directory whose repository to follow (jail-checked).

Return
  • changesstring[]required

    What moved in this batch, sorted: `head`, `index`, `refs`, `worktrees`, `repository`.

  • common_dirstring

    The repository's common dir (refs, packed-refs, worktrees).

  • git_dirstring

    The worktree's own git dir (`.git`, or `<common>/worktrees/<name>`).

  • pathstringrequired

    The watched directory: the binding's `path`, canonical.

  • worktreestring

    The worktree's top level; absent while `path` is in no repository.

shell::job-finished

Trigger

Fires once when a shell::exec_bg background job reaches a terminal status (finished, killed, or failed). Bind with config: { job_id } to wake on one job (replaying its result if already terminal and still retained), or omit it to receive future completions. The event carries job_id, argv, status, exit_code and timings; call shell::status for the job's output.

Invocation
  • job_idstring

    Replay a terminal job while its record is retained in worker memory.

Return
  • argvstring[]required

    The command as spawned, so a subscriber bound without a `job_id` filter can tell jobs apart without a second call.

  • duration_msinteger· uint64requiredmin 0
  • exit_codeinteger· int32

    `None` when the job never produced one (killed before exit, or a sandbox response that carried no code).

  • finished_at_msinteger· uint64requiredmin 0
  • job_idstringrequired
  • started_at_msinteger· uint64requiredmin 0
  • statusall ofrequired

    `finished`, `killed`, or `failed` — never `running`.

    all of (1)
    Variant 1
    valuestringenum running, finished, killed, failed

shell::turns::changed

Trigger

Fires when a session's change history (shell::turns::list) changes: a turn opened or closed, a file change recorded, a snapshot taken. Bind with config: { session_id } for one top-level session, or omit it for every session. At most one event per session per ~200 ms, carrying { session_id }; read the turns with shell::turns::list.

Invocation
  • session_idstring

    The top-level session to follow. A sub-agent's changes are recorded under the session that spawned it, so they wake this binding too.

Return
  • session_idstringrequired

Search the registry

Find workers, kits and executables, or jump to a page.