Skip to main content

Module shell

Module shell 

Source
Expand description

Where commands actually run. A seam, not a hardcoded bash -lc.

§Why this is a trait

The model-facing bash tool must mean the same thing regardless of whether execution lands on the host, inside a container, or on another machine. Baking the target into the tool – or worse, into the prompt – is how the previous harness produced its most expensive class of bug: dependencies lived in a container, the worker was told in prose to reach them via ./run-in-container, and when that instruction went missing it edited the host while its verification ran in the sandbox. Nothing was wrong with the tool; the environment was a convention rather than a property.

With a seam there is nothing to instruct and nothing to forget. A deployment composes the executor; the model sees bash either way. This is the shape DeepSeek’s harness settled on (ctx.shell backed by bash-local or bash-sandbox, ctx.sandbox by sandbox-local or sandbox-ssh) and it is right for the same reason.

It also makes the environment probe honest: Shell::available_binaries runs through the executor, so a container deployment reports what is reachable inside the container rather than what happens to be installed on the host.

Structs§

CancelHandle
Cooperative cancellation handle that terminates an active command’s process group.
CancellableContainerShell
A ContainerShell whose running command can be stopped via a CancelHandle.
CancellableLocalShell
A [LocalShell] whose running command can be stopped via a CancelHandle.
ContainerShell
Commands run inside an already-running container via docker exec.
LocalShell
Commands run on this machine, in the workspace directory.
Output
PersistentShell
Commands through persistent sessions instead of a process each: one session for the harness’s own commands (each in a fresh subshell in the directory asked for, never affected by the model’s) and one for the model’s bash (its cd and export carry over). Falls back to a process per command, exactly as [LocalShell] / ContainerShell, when a session cannot start.
Session
One long-lived bash -l. A command arrives through a heredoc read by the read builtin; its stdout and stderr go to their own files and come back with one printf behind a header of byte lengths. Only the command itself runs as a process: the previous protocol spawned about six helpers per command (base64, tr, rm), about 25 ms on macOS.

Enums§

Launcher
How to start a session’s shell: a login shell, as bash -lc gives today.
RunResult
How a session command ended.

Constants§

HARNESS_ENV
Variables the harness itself uses, never passed to the commands it runs: provider credentials (the model could otherwise read them with env) and blyte’s own configuration (a BLYTE_MODEL in the environment broke the repository’s provider tests). Every variable named BLYTE_* is removed as well, except BLYTE_SESSION: an interactive session’s id, which the dispatches it starts must inherit so the usage log can attribute them. Container commands never inherit the host environment.
LocalShell
MODEL_SHELL_ENV
POLL_START
SHELL_RESTART_NOTICE

Traits§

Shell

Functions§

credential_like
True when the upper-cased name is one of CREDENTIAL_NAMES, or, split on _, has a credential segment, or the value contains a URL with inline credentials.
inherited_path_prefix
macOS path_helper in the login profile reorders PATH.
is_pass_env
Returns true when name is in the process-wide pass-through list set by set_pass_env.
model_shell_refusal_message
poll_backoff
How long to sleep before checking a child again, and the interval to use next time: 1 ms doubling to 50 ms, never longer than the time left before the deadline.
set_pass_env
Process-wide allow-list of environment variable names to keep even if they look like credentials.
withheld_env
The sorted names of current process environment variables withheld by the credential filter.

Type Aliases§

ProfileBuilder