Skip to main content

Module bash

Module bash 

Source
Expand description

bash — run a shell command inside the workspace.

Executes host-local (sh -c) by default, with the working directory pinned to the workspace root and a timeout. A CommandLauncher can build the process instead, for example to run the script under an OS sandbox. Streams stdout/stderr incrementally via ToolContext::emit_progress for UI implementations that display live terminal output.

The command runs with standard input at end of file, in a new session with no controlling terminal, and its process group is killed when the shell exits, on a timeout and when the call is cancelled. On Windows the command runs in a Job Object, and the job’s processes are killed at the same points (spec 3.2 §10 W1).

A result carries at most INLINE_OUTPUT_CHARS of output; an OutputStore keeps the whole of a longer one (spec 3.1 §7.33 fix 8). BashTool::spawn starts a command and returns a RunningCommand at once (spec 3.1 §10 D10).

Not strongly isolated with the default HostLauncher; production deployments should run behind a sandboxing launcher or a containerized CodeExecutor (see the coding-agent design, §9). Mutating use requires Workspace::bash_allowed.

Structs§

BashTool
Runs a shell command in the workspace root with a timeout.
RunningCommand
A command BashTool::spawn started (spec 3.1 §10 D10).