editor::buffers::close
functionClose one open buffer. The file on disk is untouched.
pathstring*required
Root-relative path of the buffer to close.
buffersobject[]*required
languagestring*required
Monaco language id for the path.
mtimeinteger· int64*required
Last-modified time this buffer was read at, Unix seconds.
pathstring*required
Path relative to the workspace root.
versionstring
Opaque version of the content this buffer was read at — the same fact `mtime` carries, in the form that survives two writes inside one second. A surface saves against it by sending it as `expected_version`.
Defaulted so a session persisted before this field existed still loads. Empty means "unknown": a surface holding an empty version has only the mtime to save against, which is the behaviour it had all along.
closedboolean*required
False when nothing was open at that path.
editor::buffers::list
functionFiles currently open in the workspace.
buffersobject[]*required
languagestring*required
Monaco language id for the path.
mtimeinteger· int64*required
Last-modified time this buffer was read at, Unix seconds.
pathstring*required
Path relative to the workspace root.
versionstring
Opaque version of the content this buffer was read at — the same fact `mtime` carries, in the form that survives two writes inside one second. A surface saves against it by sending it as `expected_version`.
Defaulted so a session persisted before this field existed still loads. Empty means "unknown": a surface holding an empty version has only the mtime to save against, which is the behaviour it had all along.
Recent file changes in the workspace, newest first, one entry per path. Recorded by the observer for every change however it was made, so it answers what happened while nothing was watching. Each entry carries the patch, the line counts, the function that performed the write, and the harness session and turn it happened in.
changesobject[]*required
Newest first, one entry per path.
addedinteger· uint32*requiredmin 0
causestring*required
Function that performed the write, e.g. `shell::fs::write`.
kindstring*required
`created`, `modified`, `deleted`, or `moved`.
patchstring
Unified patch for the change, empty when there was nothing to compare.
pathstring*required
Path relative to the workspace root the change was recorded against.
removedinteger· uint32*requiredmin 0
session_idstring
The harness session and turn the write happened in, absent when it happened outside a turn.
Create a file or folder in the workspace, with parents as needed. A file may be seeded with content.
contentstring
Initial contents for a file. Ignored for a folder.
kindall of
What to create. Defaults to a file.
all of (1)
variant 1
valuestringenum: file, folder
pathstring*required
Root-relative path to create. Missing parent folders are created.
createdboolean*required
Always true on success; the call errors rather than reporting false.
kindstring*requiredenum: file, folder
Create a file or a folder.
Remove a path and close any buffer it held. An open buffer for a deleted file would recreate it on the next save.
pathstring*required
Root-relative path to remove.
recursiveboolean
Required to remove a non-empty folder.
buffersobject[]*required
languagestring*required
Monaco language id for the path.
mtimeinteger· int64*required
Last-modified time this buffer was read at, Unix seconds.
pathstring*required
Path relative to the workspace root.
versionstring
Opaque version of the content this buffer was read at — the same fact `mtime` carries, in the form that survives two writes inside one second. A surface saves against it by sending it as `expected_version`.
Defaulted so a session persisted before this field existed still loads. Empty means "unknown": a surface holding an empty version has only the mtime to save against, which is the behaviour it had all along.
buffers_closedstring[]*required
Buffers closed because their file is gone. Leaving them open would let the next save recreate a file the user just deleted.
Unified diff between two texts. Pure: nothing is read from disk. Use it to show what an edit will do before writing it, or to explain what a write did.
afterstring*required
The text as it will be.
beforestring*required
The text as it was.
context_linesinteger· uint32min 0
Unchanged lines kept around each hunk (`-U` of `git diff`). Defaults to the worker's `diff_context_lines`.
pathstring
Path used to label the patch header. Nothing is read from disk — this is presentation only.
addedinteger· uint32*requiredmin 0
Total lines added across every hunk.
hunksobject[]*required
One entry per `@@` block, in file order.
addedinteger· uint32*requiredmin 0
Lines added within this hunk.
new_linesinteger· uint32*requiredmin 0
Number of "after" lines the hunk spans.
new_startinteger· uint32*requiredmin 0
First line of the hunk on the "after" side, 1-based.
old_linesinteger· uint32*requiredmin 0
Number of "before" lines the hunk spans.
old_startinteger· uint32*requiredmin 0
First line of the hunk on the "before" side, 1-based. `0` when the before side is empty (pure addition), matching unified-diff convention.
removedinteger· uint32*requiredmin 0
Lines removed within this hunk.
identicalboolean*required
True when `before` and `after` are byte-identical.
patchstring*required
Unified diff. Empty when the two sides are identical.
removedinteger· uint32*requiredmin 0
Total lines removed across every hunk.
truncatedboolean*required
True when either side exceeded `max_bytes` and the diff was skipped. `patch` and `hunks` are empty in that case — a caller that ignores this flag would read "no changes" from a file that was simply too big.
Fuzzy file finder over the workspace, ranked the way an editor's open-file palette ranks. Candidates come from git when the root is a repository and from the folder listing when it is not.
include_untrackedboolean
Include files git does not track yet (still honouring `.gitignore`). On by default — a file the agent just created is exactly the one you are looking for. Ignored outside a repository, where the workspace listing is the source of candidates.
limitinteger· uint32min 0
Rows to return. Defaults to the worker's `find_limit`.
querystring*required
Fuzzy query. Matched as a subsequence against every tracked path, with basename and word-boundary hits ranked highest. Empty returns the first `limit` paths unranked.
from_gitboolean*required
True when candidates came from git's listing (so `.gitignore` was honoured), false when they came from the folder walk.
matchesobject[]*required
positionsinteger[]· uint32*requiredmin 0
Byte offsets into `path` that matched, in order — enough to highlight the match without re-running the matcher in the UI.
scoreinteger· int32*required
Higher is better. Comparable only within one response.
scannedinteger· uint32*requiredmin 0
Paths considered. Compare against `truncated` to know whether the whole repo was ranked.
truncatedboolean*required
True when not every path in the workspace was ranked: it held more than `max_find_candidates`, or the folder walk stopped at its visit budget. Either way this ranking is over a prefix of the workspace.
editor::git::commit
functionStage and commit. Returns the new SHA, or committed:false when there was nothing staged.
cwdstring
Repository to run in. Defaults to the workspace root.
messagestring*required
Commit message. Passed as a single `-m` argument.
stage_allboolean
Stage every change first (`git add -A`). On by default, matching what an editor's commit command does; pass false to commit only the index.
committedboolean*required
False when there was nothing staged to commit.
shastring
Full SHA of the new commit, when one was made.
summarystring*required
git's own summary line, verbatim.
editor::git::hunks
functionWhat changed in one file: the rendered patch plus its line ranges. Compares the working tree against the index, the index against HEAD, or the working tree against HEAD — so it shows an edit made by anything, including an agent that never called this worker.
againstall of
Which comparison to make. Defaults to `worktree`.
all of (1)
variant 1
one of (4)
variant 1
valuestringenum: worktree
variant 2
valuestringenum: index
variant 3
valuestringenum: head
variant 4
valuestringenum: upstream
context_linesinteger· uint32min 0
Unchanged lines kept around each hunk in `patch`. Defaults to 0, which keeps `hunks` exactly the lines that changed — the ranges a gutter paints. Pass 3 or so for a patch a person will read, and note that the reported ranges widen to include the context you asked for.
cwdstring
Directory to run git in. Defaults to the workspace root.
pathstring*required
Repository-relative path to inspect.
addedinteger· uint32*requiredmin 0
againstall of*required
Echo of the comparison performed, so a cached response is self-describing.
all of (1)
variant 1
one of (4)
variant 1
valuestringenum: worktree
variant 2
valuestringenum: index
variant 3
valuestringenum: head
variant 4
valuestringenum: upstream
hunksobject[]*required
Changed ranges, in file order. Empty when the file matches.
addedinteger· uint32*requiredmin 0
Lines added within this hunk.
new_linesinteger· uint32*requiredmin 0
Number of "after" lines the hunk spans.
new_startinteger· uint32*requiredmin 0
First line of the hunk on the "after" side, 1-based.
old_linesinteger· uint32*requiredmin 0
Number of "before" lines the hunk spans.
old_startinteger· uint32*requiredmin 0
First line of the hunk on the "before" side, 1-based. `0` when the before side is empty (pure addition), matching unified-diff convention.
removedinteger· uint32*requiredmin 0
Lines removed within this hunk.
patchstring*required
The rendered unified patch, for showing a person what changed. Empty when there is no difference, and capped by `max_diff_bytes` — a caller that only wants the ranges can ignore it.
removedinteger· uint32*requiredmin 0
untrackedboolean*required
True when git reports the path as untracked, in which case there is nothing to compare against and `hunks` is empty.
editor::git::show
functionRead a file's contents at a revision (HEAD by default). Pair it with the working copy to render a real side-by-side or unified diff, rather than parsing a patch.
cwdstring
Repository to run in. Defaults to the workspace root.
pathstring*required
Root-relative path.
revstring
Revision to read the file at. Defaults to `HEAD`.
contentstring*required
The file's contents at that revision. Empty when the path did not exist there — which is what `exists: false` distinguishes from an empty file.
existsboolean*required
False when the path is absent at that revision (a file being added).
editor::git::stash
functionStash the working tree, or pop the most recent stash.
actionall of*required
Stash the working tree, or restore the most recent stash.
all of (1)
variant 1
valuestringenum: push, pop
cwdstring
Repository to run in. Defaults to the workspace root.
actionstring*requiredenum: push, pop
editor::git::status
functionWorking-tree status as typed rows: branch, upstream, ahead/behind, and one entry per changed path. Fails when the root is not a repository — that is an absent overlay, not a broken workspace.
cwdstring
Directory to run git in. Defaults to the workspace root. Confined by shell's jail exactly like any other `shell::exec` call.
aheadinteger· uint32*requiredmin 0
Commits on this branch the upstream does not have.
behindinteger· uint32*requiredmin 0
Commits on the upstream this branch does not have.
branchstring
Current branch, or `None` on a detached HEAD.
cleanboolean*required
True when nothing is modified, staged, or untracked.
entriesobject[]*required
One row per changed path, in git's order.
indexstring*required
Status of the staged copy: `modified`, `added`, `deleted`, `renamed`, `copied`, `untracked`, `ignored`, `conflicted`, or `unchanged`.
pathstring*required
Path relative to the repository root.
renamed_fromstring
Original path for a rename or copy.
stagedboolean*required
True when the staged copy differs from HEAD.
worktreestring*required
Status of the working-tree copy, same vocabulary as `index`.
upstreamstring
Configured upstream, e.g. `origin/main`.
editor::git::sync
functionFetch, fast-forward pull, or push. Pull is --ff-only on purpose: a merge under open buffers is how an editor ends up showing a conflicted tree it never asked for.
actionall of*required
Which remote operation to run.
all of (1)
variant 1
one of (2)
variant 1
valuestringenum: fetch, push
variant 2
valuestringenum: pull
cwdstring
Repository to run in. Defaults to the workspace root.
actionone of*required
Which remote operation to run.
one of (2)
variant 1
valuestringenum: fetch, push
variant 2
valuestringenum: pull
aheadinteger· uint32*requiredmin 0
Ahead/behind after the operation, so a caller does not need a second round trip to find out whether it changed anything.
behindinteger· uint32*requiredmin 0
summarystring*required
git's output, trimmed. Both streams: git reports progress on stderr.
editor::git::undo-commit
functionUndo the last commit, keeping its changes staged (reset --soft HEAD~1). Returns the SHA and message that were undone.
cwdstring
Repository to run in. Defaults to the workspace root.
messagestring*required
Its message, so a caller can put it straight back in a commit box.
undone_shastring*required
SHA that was undone.
Move or rename a path and rewrite every open buffer and expanded folder at or under it. Moving a folder with `shell::fs::mv` alone leaves buffers pointing at the old location, which silently recreates it on the next save.
fromstring*required
Existing root-relative path.
tostring*required
Destination root-relative path.
buffersobject[]*required
languagestring*required
Monaco language id for the path.
mtimeinteger· int64*required
Last-modified time this buffer was read at, Unix seconds.
pathstring*required
Path relative to the workspace root.
versionstring
Opaque version of the content this buffer was read at — the same fact `mtime` carries, in the form that survives two writes inside one second. A surface saves against it by sending it as `expected_version`.
Defaulted so a session persisted before this field existed still loads. Empty means "unknown": a surface holding an empty version has only the mtime to save against, which is the behaviour it had all along.
remappedinteger· uint32*requiredmin 0
Open buffers and expanded folders rewritten to the new location. A folder move rewrites everything beneath it, which is the whole reason moves go through this function instead of `shell::fs::mv` directly.
editor::on-config-change
functionInternal: hot-reload the editor's limits from the authoritative configuration when it changes.
idstring
Configuration id that changed (advisory; the handler re-fetches).
editor::on-file-change
functionInternal: turns a filesystem call made by anything into an editor::changed event. Observes only — always continues.
callany of
any of (2)
variant 1
function_idstring*required
resultany of
Outcome of the call this hook is reporting on. A write that failed did not change anything, and the hook fires either way.
Read a text file and record it as an open buffer, with the metadata needed to write it back safely: its language id, and the mtime and content version to hand to editor::save.
pathstring*required
Jail-relative when `shell`'s `fs.host_roots` are set, else absolute — the same path vocabulary as `shell::fs::read`.
contentstring*required
File contents as text. Binary files are refused rather than mangled.
languagestring*required
Monaco language id for the path, e.g. `rust`, `typescript`, `plaintext`.
mtimeinteger· int64*required
Last-modified time, Unix seconds. Pass it back as `expected_mtime` on `editor::save` to get the conflict guard.
sizeinteger· uint64*requiredmin 0
truncatedboolean*required
True when the file exceeded `max_file_bytes` and `content` holds only its beginning. Saving a truncated buffer back would delete the rest of the file, so `editor::save` refuses one.
versionstring*required
Opaque version of the `content` above. Pass it back as `expected_version` on `editor::save` for a guard that does not depend on the filesystem's timestamp resolution: it catches a write that landed inside the same second, which `mtime` cannot. Compare it for equality only — the encoding is this worker's business and may change.
Write a file, refusing the write when it changed underneath since the editor::open it started from. On refusal the divergence comes back as a patch.
contentstring*required
Full new contents. This is a whole-file write, not a patch.
expected_mtimeinteger· int64
The `mtime` from the `editor::open` this edit started from. When it no longer matches the file on disk, the write is refused and the divergence comes back as a patch. Omit only when deliberately overwriting whatever is there.
Resolution is one second, which is all the filesystem reports. Two writes inside the same second are therefore indistinguishable to this field, and the second one wins silently — send `expected_version` instead to close that window.
expected_versionstring
The `version` from the `editor::open` — or from the previous `editor::save` — this edit started from. It is a version of the *content*, so it catches a write that landed inside the same filesystem second and it does not care whether a clock or a checkout moved the mtime.
When this is present it is the guard and `expected_mtime` is ignored. When it is absent the `expected_mtime` comparison applies exactly as before, so a caller that has never heard of a version is unaffected.
addedinteger· uint32*requiredmin 0
Lines this save added relative to what was on disk before it.
conflictboolean*required
True when the write was refused because the file changed underneath.
conflict_patchstring
On conflict: a unified diff from the current disk contents to the contents you tried to write, so the divergence is reviewable without a second round trip.
createdboolean*required
True when the file did not exist and was created.
disk_mtimeinteger· int64
What was on disk when a conflict was detected.
disk_versionstring
Version of the disk contents when a conflict was detected — the value to send as `expected_version` once you have reconciled with them.
mtimeinteger· int64*required
Last-modified time after the write. Feed it into the next save.
removedinteger· uint32*requiredmin 0
Lines this save removed.
savedboolean*required
True when the file was written.
versionstring*required
Version of the content this file now holds: what was written on success, what is on disk on a conflict. Feed it into the next save as `expected_version`.
Search file contents across the workspace, grouped by file — the shell worker's recursive grep, shaped into what a results panel renders.
ignore_caseboolean
Match case-insensitively.
include_globstring[]
Glob filters restricting which files are searched, e.g. `["**/*.rs"]`.
max_matchesinteger· uint64min 0
Stop after this many matching lines. Defaults to the worker's `search_max_matches`.
patternstring*required
Rust regex matched against each line.
filesobject[]*required
Matches grouped by file, in first-match order — the shape a result panel renders, rather than a flat list every caller has to group.
hitsobject[]*required
lineinteger· uint64*requiredmin 0
1-based line number.
textstring*required
The matching line, as shell returned it.
totalinteger· uint32*requiredmin 0
Total matching lines across every file.
truncatedboolean*required
True when the search stopped at `max_matches`.
List a folder in the workspace, with the expansion state the workspace remembers. The walk, the noise-folder excludes and the jail are the shell worker's.
collapsestring[]
Root-relative folders to collapse. Collapsing takes its descendants with it.
expandstring[]
Root-relative folders to mark expanded before listing. Expansion is part of the shared workspace, so it survives a reload and both surfaces agree on it.
max_depthinteger· uint32min 0
Levels to descend. Defaults to 4 — deep enough to navigate, shallow enough that one call does not walk a whole monorepo.
pathstring
Folder to list, relative to the workspace root. Defaults to the root.
expandedstring[]*required
Folders the workspace has expanded, root-relative.
pathstring*required
Canonical absolute path of the listed folder, as shell resolved it.
treeunknown*required
The listing exactly as the shell worker returned it (nested `{name, kind, size, mtime, children}` nodes). Passed through rather than re-modelled so this worker does not pin shell's response shape.
editor::ui-content
functionServe the editor 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.
editor::workspace::get
functionThe active workspace: its root, the files open against it, and which folders are expanded. Shared by every surface, so this is what the agent and the console both see.
buffersobject[]*required
Files currently open against this root, shared by every surface.
languagestring*required
Monaco language id for the path.
mtimeinteger· int64*required
Last-modified time this buffer was read at, Unix seconds.
pathstring*required
Path relative to the workspace root.
versionstring
Opaque version of the content this buffer was read at — the same fact `mtime` carries, in the form that survives two writes inside one second. A surface saves against it by sending it as `expected_version`.
Defaulted so a session persisted before this field existed still loads. Empty means "unknown": a surface holding an empty version has only the mtime to save against, which is the behaviour it had all along.
expandedstring[]*required
Folders expanded in the tree, root-relative.
rootstring*required
The active root every other path in this response is relative to.
editor::workspace::open
functionSet the directory the editor works in. Any folder will do — a git repository is an overlay, not a requirement. Returns the buffers and expanded folders remembered for it.
rootstring*required
Directory to work in. Jail-relative when shell's `fs.host_roots` are set, else absolute. A plain folder is enough — a git repository is an overlay, never a requirement.
buffersobject[]*required
Files currently open against this root, shared by every surface.
languagestring*required
Monaco language id for the path.
mtimeinteger· int64*required
Last-modified time this buffer was read at, Unix seconds.
pathstring*required
Path relative to the workspace root.
versionstring
Opaque version of the content this buffer was read at — the same fact `mtime` carries, in the form that survives two writes inside one second. A surface saves against it by sending it as `expected_version`.
Defaulted so a session persisted before this field existed still loads. Empty means "unknown": a surface holding an empty version has only the mtime to save against, which is the behaviour it had all along.
expandedstring[]*required
Folders expanded in the tree, root-relative.
rootstring*required
The active root every other path in this response is relative to.