Foundation-core's process implementation. Bound only when the user-owned bash
toggle is ON (default ON; flip it OFF in Settings or in vis.yml via
toggles: {bash: false} to drop the tools). The OS process jail is the
containment layer while active.
ONE model-facing entry point — the bash PYTHON verb, bound BARE in the flat
sandbox next to ls / grep. A process is started from Python, and every verb
after the spawn is a method on the handle the call returns. EVERY run is a
background run: the call spawns under a real pty and returns the HANDLE. Its only
wait is wait=seconds, a bounded wait for the exit before the answer; the limit
never stops the process. ONE call runs ONE command: an ordered batch was a second
budget, a second result shape and a second failure mode for what && already says.
sh = await bash("ls", wait=30) — bash -lc in the workspace root, spawned
under a REAL pty. It writes merged output to a bounded log file and
registers the process as a session resource. sh.snapshot() reads the
current state. The file and the result keep the start and end of large
output. A non-zero exit is data, not a tool error.
A server, watcher or long build is the SAME call — you simply do not wait for
it, or you wait for less than it takes. A wait that expires is never a lost
process: it keeps running under its id and its log keeps filling. A handle is
not awaitable, so no wait is without a limit: wait(sh, timeout=30).
The log OUTLIVES the run. Every process keeps its log file and its index row by id for as long as the session does, so "what did that build print" is answerable a turn later from the id alone. That retention is the feature, not a leak to reap.
The result IS the HANDLE: every answer is a dict-with-methods in the
sandbox, so the process is driven on the object the call already returned —
sh.logs(-50) reads the last 50 LINES (or a byte OFFSET, or lines=10 for a
ten-line window) and returns a page NOW; page[-4000:] slices that page's out
text directly, next(page) continues the read and page.pages() walks its ready
pages lazily, bounded to ten by default, while
lines=-10 walks back up. sh.type("y") types into the terminal. sh.cancel()
stops the process tree. There are no id-taking verbs to re-type an id into;
re-issuing a LIVE id gives the same handle back.
Task fields give the start result until settlement. The final result and log
pages are fixed maps. shell-dispatch handles internal lifecycle operations.
EVERY result of EVERY stage — including an argv run, which uses the same runner
— is the one [[shell-result-base]] key set: stage names the producer and is
the only thing that varies. A key a stage has nothing to say about is nil /
false / 0 instead of absent, so model Python indexes any of them without a
KeyError, and a run answers with its command and that command's own bytes at
the TOP level — there is no entry to unwrap and no second shape to learn.
The bash toggle is registered HERE and owned by Vis core. It closes the
MODEL's door only: an installed extension keeps its own trusted process boundary
(vis.shells.start, subprocess), which the toggle does not gate.
Foundation-core's process implementation. Bound only when the user-owned `bash`
toggle is ON (default ON; flip it OFF in Settings or in `vis.yml` via
`toggles: {bash: false}` to drop the tools). The OS process jail is the
containment layer while active.
ONE model-facing entry point — the `bash` PYTHON verb, bound BARE in the flat
sandbox next to `ls` / `grep`. A process is started from Python, and every verb
after the spawn is a method on the handle the call returns. EVERY run is a
background run: the call spawns under a real pty and returns the HANDLE. Its only
wait is `wait=seconds`, a bounded wait for the exit before the answer; the limit
never stops the process. ONE call runs ONE command: an ordered batch was a second
budget, a second result shape and a second failure mode for what `&&` already says.
1. `sh = await bash("ls", wait=30)` — `bash -lc` in the workspace root, spawned
under a REAL pty. It writes merged output to a bounded log file and
registers the process as a session resource. `sh.snapshot()` reads the
current state. The file and the result keep the start and end of large
output. A non-zero exit is data, not a tool error.
2. A server, watcher or long build is the SAME call — you simply do not wait for
it, or you wait for less than it takes. A wait that expires is never a lost
process: it keeps running under its id and its log keeps filling. A handle is
not awaitable, so no wait is without a limit: `wait(sh, timeout=30)`.
3. The log OUTLIVES the run. Every process keeps its log file and its index row by
id for as long as the session does, so "what did that build print" is
answerable a turn later from the id alone. That retention is the feature, not
a leak to reap.
The result IS the HANDLE: every answer is a dict-with-methods in the
sandbox, so the process is driven on the object the call already returned —
`sh.logs(-50)` reads the last 50 LINES (or a byte OFFSET, or `lines=10` for a
ten-line window) and returns a page NOW; `page[-4000:]` slices that page's `out`
text directly, `next(page)` continues the read and `page.pages()` walks its ready
pages lazily, bounded to ten by default, while
`lines=-10` walks back up. `sh.type("y")` types into the terminal. `sh.cancel()`
stops the process tree. There are no id-taking verbs to re-type an id into;
re-issuing a LIVE id gives the same handle back.
Task fields give the start result until settlement. The final result and log
pages are fixed maps. `shell-dispatch` handles internal lifecycle operations.
EVERY result of EVERY stage — including an argv run, which uses the same runner
— is the one [[shell-result-base]] key set: `stage` names the producer and is
the only thing that varies. A key a stage has nothing to say about is nil /
false / 0 instead of absent, so model Python indexes any of them without a
KeyError, and a run answers with its `command` and that command's own bytes at
the TOP level — there is no entry to unwrap and no second shape to learn.
The `bash` toggle is registered HERE and owned by Vis core. It closes the
MODEL's door only: an installed extension keeps its own trusted process boundary
(`vis.shells.start`, `subprocess`), which the toggle does not gate.(foreground-timeout-secs)The wait budget for a foreground bash command.
The wait budget for a foreground bash command.
(jailed-shell env opts)Run vis.shells.start_jailed through a strict policy read from the latest merged
on-disk configuration at every process spawn. Works with or without a session;
invalid current config refuses that spawn instead of using a snapshot.
The calling extension's declared vis.Grant paths come first: its toolchain
(a JDK, a package cache, a launcher) by mode, from the registry and never from
the call. allow_read_write and unix_connect are the CALLER's own per-call
grants, added by [[granted-paths]]: the extension hands its child the exact
rendezvous endpoint it created and nothing else. A disabled jail ignores all of
them.
Run `vis.shells.start_jailed` through a strict policy read from the latest merged on-disk configuration at every process spawn. Works with or without a session; invalid current config refuses that spawn instead of using a snapshot. The calling extension's declared `vis.Grant` paths come first: its toolchain (a JDK, a package cache, a launcher) by mode, from the registry and never from the call. `allow_read_write` and `unix_connect` are the CALLER's own per-call grants, added by [[granted-paths]]: the extension hands its child the exact rendezvous endpoint it created and nothing else. A disabled jail ignores all of them.
(kill-tree! p)Destroy an OWNED process and its reachable descendants: TERM, then KILL after a 2s grace, then wait up to 2s for exit and reap the owned Process. Used by shells and one-shot test runners; never use on an externally owned REPL. Accepts a java.lang.Process or a PTY handle map. Never throws; preserves interrupts without letting cancellation skip escalation. A child that has already detached/reparented before the snapshot is outside this tree.
Destroy an OWNED process and its reachable descendants: TERM, then KILL after a 2s grace, then wait up to 2s for exit and reap the owned Process. Used by shells and one-shot test runners; never use on an externally owned REPL. Accepts a java.lang.Process or a PTY handle map. Never throws; preserves interrupts without letting cancellation skip escalation. A child that has already detached/reparented before the snapshot is outside this tree.
(prompt env)Show the common bash call while the bash layer is on.
Show the common bash call while the bash layer is on.
(run-argv env argv)(run-argv env argv opts)Run ONE literal argv through the SAME bounded machinery bash runs its own
command with: cwd authorization, process-jail policy, disk-backed output,
head/tail bounded reads, timeout and kill-tree. Returns its own total entry — the
SAME [[shell-result-base]] map bash itself answers a foreground call with,
carrying the request's :dir/:timeout-secs as metadata, so an argv run and bash
have ONE result shape and there is no envelope to unwrap.
No shell is involved — each element reaches the process verbatim, so nothing needs quoting. An argv caller is a USER of this: every argv command is a bounded shell command, so both tools share one runner, one jail and one capture policy.
Run ONE literal argv through the SAME bounded machinery `bash` runs its own command with: cwd authorization, process-jail policy, disk-backed output, head/tail bounded reads, timeout and kill-tree. Returns its own total entry — the SAME [[shell-result-base]] map `bash` itself answers a foreground call with, carrying the request's `:dir`/`:timeout-secs` as metadata, so an argv run and `bash` have ONE result shape and there is no envelope to unwrap. No shell is involved — each element reaches the process verbatim, so nothing needs quoting. An argv caller is a USER of this: every argv command is a bounded shell command, so both tools share one runner, one jail and one capture policy.
(run-blocking env command opts)INTERNAL blocking runner — NOT the tool. Run ONE bounded foreground command and answer the tool's own total result: the
command's own run-stage map with the handle's identity merged on, so r["exit"],
r["out"] and r["command"] are read at the top level and there is no
entry to index into. One call is one command — an ordered batch is what &&
and a second call are for — so there is no shared budget to divide and no
"never started" entry to explain.
EVERY run IS a handle. It claims its id and its log file BEFORE it waits, so
the result carries that id whether the command finished or not, and a wait that
expires is no longer a lost process: it keeps running under its id,
sh.logs(offset=0) reads everything the timed-out call never saw, and
sh.cancel() ends it. A command that finished inside its wait drops the
registry entry — there is no live process to account for — while its log file
stays readable by id for as long as the session does.
INTERNAL blocking runner — NOT the tool. Run ONE bounded foreground command and answer the tool's own total result: the command's own `run`-stage map with the handle's identity merged on, so `r["exit"]`, `r["out"]` and `r["command"]` are read at the top level and there is no entry to index into. One call is one command — an ordered batch is what `&&` and a second call are for — so there is no shared budget to divide and no "never started" entry to explain. EVERY run IS a handle. It claims its `id` and its log file BEFORE it waits, so the result carries that id whether the command finished or not, and a wait that expires is no longer a lost process: it keeps running under its id, `sh.logs(offset=0)` reads everything the timed-out call never saw, and `sh.cancel()` ends it. A command that finished inside its wait drops the registry entry — there is no live process to account for — while its log file stays readable by id for as long as the session does.
(sdk-task-op {:keys [session task-id id origin token]} op opts)Drive the exact process that the SDK installation admitted.
Drive the exact process that the SDK installation admitted.
(shell)(shell command)(shell command opts)Start or attach to a managed process. See the bash symbol for the sandbox contract.
Start or attach to a managed process. See the `bash` symbol for the sandbox contract.
(shell-attach-command _parsed residual)vis-agent extension bash attach <id> — the human-side passthrough: join a live
bash process's PTY in your OWN terminal (finish a browser OAuth, answer a
prompt only a person can), then Ctrl-] to detach with the child untouched.
--socket PATH targets an explicit socket; otherwise the newest shell whose
id matches. Returns the attach exit code.
`vis-agent extension bash attach <id>` — the human-side passthrough: join a live bash process's PTY in your OWN terminal (finish a browser OAuth, answer a prompt only a person can), then Ctrl-] to detach with the child untouched. `--socket PATH` targets an explicit socket; otherwise the newest shell whose id matches. Returns the attach exit code.
CLI surface mounted under vis-agent extension shell. Only attach for now — the human
passthrough onto a background PTY the agent spawned.
CLI surface mounted under `vis-agent extension shell`. Only `attach` for now — the human passthrough onto a background PTY the agent spawned.
(shell-dispatch env opts)Dispatch internal bash lifecycle operations, including capability-bound logs and input.
Dispatch internal bash lifecycle operations, including capability-bound logs and input.
(shell-logs id)(shell-logs id opts)page = sh.logs() — read a background shell's log from a byte offset, or the
last n LINES with a negative one (sh.logs(-50)), and return NOW. lines=10
is the LINE window — the last ten, or the NEXT ten from an offset, and -10
the ten ABOVE it — so a long log is walked a screenful at a time, both ways.
Each page is still the shell result map, while a slice addresses its out text
directly (page[-4000:]). It remembers the whole read: next(page) gets the next
ready page and page.pages(max_pages=…) lazily includes this page plus those after
it, bounded to ten pages by default. Paging stops at the current snapshot's EOF
the process is live; call sh.logs() later to read output written later.
out is normalized text: terminal colours and controls are handled automatically.
log_path keeps raw terminal bytes. If the file reaches its limit, it keeps
the start and end and marks the removed bytes.
`page = sh.logs()` — read a background shell's log from a byte offset, or the last n LINES with a negative one (`sh.logs(-50)`), and return NOW. `lines=10` is the LINE window — the last ten, or the NEXT ten from an offset, and `-10` the ten ABOVE it — so a long log is walked a screenful at a time, both ways. Each page is still the shell result map, while a slice addresses its `out` text directly (`page[-4000:]`). It remembers the whole read: `next(page)` gets the next ready page and `page.pages(max_pages=…)` lazily includes this page plus those after it, bounded to ten pages by default. Paging stops at the current snapshot's EOF the process is live; call `sh.logs()` later to read output written later. `out` is normalized text: terminal colours and controls are handled automatically. `log_path` keeps raw terminal bytes. If the file reaches its limit, it keeps the start and end and marks the removed bytes.
(shell-snapshot env opts)Read the process or its final result without waiting.
Read the process or its final result without waiting.
(shell-type id text)(shell-type id text opts)sh.type("y") — type keystrokes at a background shell's stdin.
is_enter (default true) submits the line, which is what an interactive prompt
waits for; read the response with sh.logs().
`sh.type("y")` — type keystrokes at a background shell's stdin.
`is_enter` (default true) submits the line, which is what an interactive prompt
waits for; read the response with `sh.logs()`.(task-result {:keys [result] :as envelope})Return the bash process descriptor at a Python-facing start boundary.
Return the bash process descriptor at a Python-facing start boundary.
(trusted-extension-shell env opts)Run a trusted Python extension's ordinary vis.shells.start request without applying
a process jail. The extension context already has direct, unrestricted
subprocess access; this is the result-shaped convenience API for the same trust
boundary. Foreground calls therefore work outside a session too.
Run a trusted Python extension's ordinary `vis.shells.start` request without applying a process jail. The extension context already has direct, unrestricted subprocess access; this is the result-shaped convenience API for the same trust boundary. Foreground calls therefore work outside a session too.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |