Expand description
Sandboxed shell execution with heel.
This crate provides the general capabilities an embedder builds a terminal-style agent tool on:
Sandboxspawns a process under heel’s sandbox, in a container or on an SSH server, with liveGrantsand anEnvSourcethe embedder fills at each launch.Shellexecutes scripts for a model on aSandbox: a carried directory, jobs, waiting, output handling andScriptPolicychecks before a script runs.ShellTooland the job control tools are ordinaryTools the embedder names and describes.
The embedder owns the commands its scripts call back into, the programs its sandboxes run with and every sentence the model reads.
ⓘ
use aither_sandbox::{Backend, Sandbox, Shell};
let sandbox = Sandbox::new(Backend::Host { heel }, executor, working_dir);
let shell = Shell::builder_on_host(sandbox, host_shell)
.interpreters(interpreters)
.limits(limits)
.output(output)
.wording(wording)
.tools(tools)
.build()
.await?;
let tool = shell.tool();Re-exports§
pub use builtin::JobInputArgs;pub use builtin::JobInputTool;pub use builtin::JobKillArgs;pub use builtin::JobKillTool;pub use builtin::JobReadArgs;pub use builtin::JobReadTool;pub use builtin::ShellToolSettings;pub use builtin::ToolIdentity;pub use monitor::MonitorArgs;pub use monitor::MonitorEnd;pub use monitor::MonitorEnded;pub use monitor::MonitorIncrement;pub use monitor::MonitorRefusal;pub use monitor::MonitorSettings;pub use monitor::MonitorSource;pub use monitor::MonitorStalled;pub use monitor::MonitorTool;pub use network_policy::CompiledNetworkPolicy;pub use network_policy::NetworkPolicyConfig;pub use network_policy::NetworkPolicyError;pub use network_policy::NetworkPolicyMode;pub use network_policy::NetworkVerdict;
Modules§
- builtin
- The job control tools and the identities an embedder gives its shell tools. The control tools of a shell’s jobs.
- monitor
monitor— watch a command or a file and deliver its new output as it arrives.- network_
policy - Declarative host-based network policy. Declarative host-based network policy.
Structs§
- AnyContainer
Exec - Backend-agnostic container executor handle.
- AnyContainer
Memory - A type-erased
ContainerMemory, what the builders store. - AnyDomain
Approver - A cloneable handle on any
DomainApprover. - AnyFootprint
Reader - A type-erased
FootprintReader, what the builders store. - AnyFootprint
Registry - A type-erased
FootprintRegistry, what the builders store. - AnyIpc
Provider - A type-erased
IpcProvider. - AnyPrepare
Ssh - A type-erased
PrepareSsh. - AnyScript
Policy - A type-erased
ScriptPolicy. - AnyShell
Wording - A shared
ShellWording, cloned into every shell, store and tool that renders a text. - AnySubagent
Spaces - A
SubagentSpacesof any type, as a terminal holds it. - Approve
AllDomains - Approves every domain it is asked about.
- Bollard
Container Exec - Executes commands in a running container via Docker exec.
- Cgroup
Memory - What the container’s own memory cgroup (v2) reports.
- Command
Id - Identifies one command of a
ShellScript. - Commit
Ledger - Lists the commits a subagent holding a commit grant made, and brings them into the main repository.
- Commit
Mark - Where a ledger’s worktrees stood at one moment: the commits their branch namespaces and detached heads pointed at.
- Completed
Command - A command that ran to completion.
- Container
Image Spec - Image build specification.
- Container
Launch - The programs prepared inside a container, for
Backend::Container. - Container
Launch Spec - Container launch specification.
- Container
Path - An absolute POSIX path inside a container.
- Container
Probe - Runs short read-only scripts inside a container and returns what they print, through the same exec path commands use.
- Container
Shell Runtime - Container runtime session metadata.
- Container
Snapshot - The state of the container’s memory limit and of the agent’s jobs in it.
- Deny
AllDomains - Denies every domain it is asked about, which is what a sandbox without an approver does.
- Descendants
Killed - Processes a foreground command left running when its shell exited, killed with it.
- Domain
Request - One connection a sandboxed process makes to a domain the network lists leave open.
- File
Footprint Registry - A
FootprintRegistryin a directory every agent of the machine shares. - Folded
Lines - A block of source code folded into one marker line.
- Foreground
Wait - How long a
terminalcall waits in the foreground before a still-running command promotes to a background task. - Given
- A value the builder was given.
- Grant
Snapshot - The path grants one spawn launches with. Immutable once handed out: snapshots are replaced, never edited.
- Grants
- Shared, runtime-mutable grants of a
Sandbox. - Host
Launch - The shell prepared on the host, for
Shell::builder_on_host: the program a script runs under, as a path on this machine. - Host
Route - How a container reaches the host: the
nameit dials and the hostaddressa listener meant for the container binds. - Import
Budget - The most bytes a subagent’s sandbox may send the host while the commits it made are imported: the pack, and every answer to a question about its repository.
- Job
- One job of a shell.
- JobDelta
- Incremental read result for a background terminal buffer.
- JobEnded
- A job that ran to its end: one promoted past the foreground window or
started in the background. A script whose call returned its result, and
every
Shell::run, raises none. - JobFootprint
- One running job and the memory its process tree holds.
- JobInfo
- Information about a running or completed background job.
- JobInput
Sent - Bytes written to a job’s stdin.
- JobKill
Asked - A kill of a job.
- JobMemory
- A terminal’s view of the memory its jobs hold.
- JobOutput
Appender - Appends to the output of one running job, such as the progress an embedder’s command reports while the script that called it runs.
- JobProcess
- A process of a job other than its top-level shell.
- JobStarted
- A job the shell has just detached: started with
background, or promoted pastShellLimits::foreground_wait. - Jobs
- The jobs of one shell: every script that outlived its call, was started in the background or watched by a monitor.
- Json
AsTsv - A JSON payload shown as TSV, its original stored in a file.
- Launch
Info - What a launch is, as the shell that starts it knows it.
- LineId
- Identifies one simple command of a
ShellScriptas written: a program with its words, which may run further commands through wrappers. - Line
Range - A run of lines a view of an output leaves out or stands for.
- Live
Duration - A duration adjustable while the shell runs. Every clone shares it.
- Long
Running - A job that crossed the long-running threshold; raised once per job.
- Media
Bounds - The pixel bounding boxes of the
MediaResolutionlevels that resize. - Memory
Size - A number of bytes, shown the way a person reads memory:
36.2 GiB. - Memory
Snapshot - The memory state of one
MemoryDomainand of one agent’s jobs in it at one moment. - Missing
- A value the builder has not been given yet.
- Monitor
Started - A
monitorcall that started watching a task. - Mount
Root - Declarative host/container root pair used to create validated child mounts.
- Mount
Spec - A host path mounted into a container path.
- Network
Audit Log - Re-export of heel’s rolling network audit log for terminal-tool configuration. JSONL sink for network access decisions.
- Nice
Level - Re-export of heel’s scheduling priority types for terminal-tool configuration.
How many steps below its host a sandbox runs:
1..=19, larger being lower. - Omitted
Lines - The middle of a stored output a preview leaves out.
- Output
Limits - Every budget of the output a shell hands the model.
- Output
Policy - The live handle to a shell’s
OutputLimits. - Output
Saved - An output too large for the window, replaced by a preview and the file that holds all of it.
- Output
Store - Stores the outputs too large for a result, each in a file named by a word
leased from the store’s
AnyIdAllocator. - Owed
Completion - What [
JobRegistry::owe_completion] settled for a job. - Pending
Completion - A finished job’s completion on its way to the agent.
- Pipeline
Id - Identifies one pipeline of a
ShellScript. - Pipeline
Stage - Where a command line sits in a pipeline of two or more commands.
- Prepared
Space - What an embedder made in a run’s space.
- Prepared
Ssh - What the embedder prepared on a server: its
heeland the programs its scripts run with. - Probed
Container Memory - Reads a container’s memory by running scripts in it through its exec path.
- Process
Priority - Re-export of heel’s scheduling priority types for terminal-tool configuration. The scheduling priority of a sandboxed process and its descendants.
- Refused
- A call refused before it ran: the typed reason, and the text its wording rendered for the model.
- Relative
Container Path - A string that is not an absolute POSIX path.
- Remote
Launch - The programs prepared on a server, for
Backend::Ssh. Paths are on the server and text, because a script names them. - Repeated
Lines - A run of identical lines a preview shows once.
- Response
Window - How long the agent has to act on a final warning before its job is killed, adjustable while the agent runs. Every clone shares it.
- RunSpace
- The space a subagent run is about to start in.
- Runtime
Preference - Runtime selection order.
- Sandbox
- One home environment’s sandbox: grants, environment, network policy and
the
Backendprocesses run on. Cheap to clone; clones share the live grants. - Sandboxed
Child - A process spawned through
Sandbox::spawn. - Script
- A script
Shell::runruns to its end. - Script
Check - A script about to run, as a
ScriptPolicyand the shell’sTreatOutputsee it. - Script
End - The end of a script a
ScriptPolicywas asked about. - Script
Policies - A shell’s policies, each bound to the state of the agent the shell serves.
- Script
Refusal - A script a
ScriptPolicyrefused; the model readsSelf::textas the call’s result. - Script
Result - What a script printed and how it ended, as data: the embedder words it where it hands a result to its model.
- Shell
- The terminal tool for executing scripts in a sandbox.
- Shell
Args - Shell
Builder - Builds a
Shellon theSandboxits scripts run in. - Shell
Command - One command line a script would run, with its words unquoted.
- Shell
Events - The events of one or several shells, and where they are read.
- Shell
Limits - The budgets a shell runs its scripts under.
- Shell
Parse Error - A script that is not valid shell, or nests shell strings and substitutions too deeply to follow.
- Shell
Script - A shell script parsed into every command line it would run, in source order, a command’s substitutions ahead of the command.
- Shell
Session Registry - The SSH servers a shell’s commands may run on, as the embedder prepared them.
- Shell
Tool - The model-facing tool of a
Shell: the embedder’s name and description over the shell’s execution, with an argument schema that lists exactly the interpreters the shell was configured with. - Space
Preparation Error - An embedder’s failure to prepare a space, whatever its own error type.
- Spawn
Spec - A process to start under a
Sandbox. - SshPlatform
- The operating system and architecture a server reports, as
uname -sanduname -mprint them (for exampleLinuxandx86_64). - SshPrepare
Error - Why a server could not be prepared. The server stays in the set, and the next command naming it prepares it again.
- SshServer
- A named SSH destination commands may run on.
- Stdin
Blocked - A job whose stdin pipe has a reader waiting for input; raised once per blocking episode, so again only after the job was fed and blocks anew.
- Stdin
Watch Failed - A job whose stdin watch failed; raised once, after which the job can no longer report being blocked on stdin.
- Stdio
- The standard streams of a spawned process. The default pipes
stdoutandstderrand givesstdinnothing. - Stored
Binary Part - A binary part of a result, stored in a file.
- Subagent
Commit - A commit a subagent made.
- Subagent
Grant - What a launcher grants a subagent beyond its own space.
- System
Footprints - Reads the host this process runs on.
- Timeout
Kill - A command killed because its
timeoutbound passed, with the UTC times it started and was killed at. - Unchanged
Read - Why a tool refused a read of a job’s output: nothing changed since the
job’s last read. The refusal a tool returns as
Refused<UnchangedRead>.
Enums§
- Append
Outcome - Whether
JobOutputAppender::appendreached its job. - Backend
- Where a sandbox’s processes run.
- Call
Refusal - A call of the shell’s tools refused before it ran.
- Carry
- What a script did to the directory the shell carries to the next foreground script.
- Child
Exit - How a spawned process ended.
- Command
Killed - Why a foreground command the shell killed was killed.
- Commit
Ledger Error - Why the commits of a subagent could not be listed.
- Container
Exec Outcome - Outcome of a container execution request.
- Container
Probe Error - Why a probe of a container failed.
- Container
Runtime Kind - Supported Docker-compatible runtime kinds.
- CpuPriority
- Re-export of heel’s scheduling priority types for terminal-tool configuration. How much CPU time a sandboxed process competes for.
- Delivery
- Whether a finished job’s completion has reached its agent.
- Descendants
- The processes a child left running that the backend ended with it, which
only a
Foregroundchild has. - Directory
Reset Reason - Why the next foreground command does not start where the last one left the shell.
- Exec
Lifetime - How long the processes a container command leaves running when its top-level shell exits may live.
- Footprint
Error - Why a footprint or the physical memory could not be read.
- GitDir
Access - The access a sandbox has to the common git directory of a linked worktree it may write.
- Host
Route Error - Why an address and name cannot be a
HostRoute. - Interpreter
- IoPriority
- Re-export of heel’s scheduling priority types for terminal-tool configuration. How much disk bandwidth a sandboxed process competes for.
- JobInput
Error - Why bytes were not written to a job’s stdin.
- JobPlace
- Where a job runs, which decides what is watched of it.
- JobRead
- What a read of a job’s output returned.
- JobStatus
- Status of a background job.
- JobWait
Error - Why waiting for a job did not end in a result.
- Kill
Cause - Why a job was killed.
- Kill
Tree Error - Why a process tree could not be killed.
- Media
Resolution - Memory
Domain - Which memory a job competes for.
- Mount
Access - Filesystem mount access policy.
- Mount
Root Error - Mount-root composition error.
- Output
Format - Expected output format for terminal execution.
- Output
Treatment - What the shell does to a foreground script’s text output before the model reads it.
- Pipe
- Whether a standard stream of a spawned process is piped to its handle.
- Process
Table Error - Why a job’s descendants could not be found or killed.
- RunFailure
- A call or run that did not get to an end, other than one refused before it ran: the failure as data, for the embedder to word.
- RunOutcome
- How a script ended.
- Sandbox
Mode - Script
Decision - What a
ScriptPolicydecided about one script. - Script
Dir - A directory a script starts or ends in, as the backend that runs it names it.
- Script
Origin - How a script came to the terminal.
- Script
Outcome - How a script a
ScriptPolicywas asked about ended. - Shell
Event - A fact about a job of a shell.
- Shell
RunError - Why a
Shell::rundid not run to an end. - Spawn
Command - What a spawned process runs.
- Spawn
Error - Why a process could not be spawned.
- Spawn
Grant - An access a process is granted beyond the sandbox’s own grants, named where the backend that honours it sees the path.
- SshProbe
Error - Why
probe_ssh_oscould not tell a server’s platform. - SshServer
Error - Why a server cannot join a registry’s server set.
- Stdin
Watch Signal - What a container exec’s stdin watch reports over its
stdin_blockedchannel. - Subagent
Grant Error - Why a
SubagentGrantcannot be given. - Terminal
Error - Errors that can occur during terminal execution.
- Tree
Lifetime - How long a job’s descendants may outlive its top-level process, which decides how a Linux job is supervised.
Constants§
- JOB_
MARKER_ ENV - The environment variable marking every process of a container job.
- JOB_
MARKER_ VAR - The environment variable that marks every process of a job; its value is
the job’s [
JobMarker].
Traits§
- Container
Exec - Trait for executing commands inside a container.
- Container
Memory - Reads the memory of the container the agent works in, inside the container: its cgroup, and the footprint of the jobs it runs.
- Domain
Approver - Decides the connections the sandbox’s network lists leave open.
- EnvSource
- Supplies environment variables resolved at each launch.
- Footprint
Reader - Reads job footprints and the machine’s physical memory.
- Footprint
Registry - Shares the memory each agent’s jobs hold between the agents on a machine, so each sees the machine-wide total and who contributes the most. It is used to total and to rank, never as a cap.
- IpcProvider
- Supplies the
heel::IpcRoutera script of a shell can call back into the host’s commands through. - Prepare
Ssh - Prepares a server for the shell’s scripts: finds or installs its
heeland the programs scripts run with. - Script
Policy - Decides whether a script may run, before it does.
- Shell
Wording - The text the model reads for each refusal, notice and marker the shell raises, one method per family.
- Subagent
Spaces - Prepares the space each subagent run works in.
- Treat
Output - Chooses the
OutputTreatmentof every script of a shell, before it runs.
Functions§
- kill_
process_ tree - Kills the process
pidand every process in its process group. - open_
network_ audit_ log - Opens a daily-rotated network audit log under
dir, creating the directory if needed. - probe_
ssh_ os - The platform
serverruns: oneuname -s -mover one SSH connection, installing nothing and asking no one. An embedder calls it when the user adds a server, to record what the server is.