Skip to main content

Crate harness_bash

Crate harness_bash 

Source
Expand description

Bash tool — Rust port of @agent-sh/harness-bash.

Conforms to agent-knowledge/design/bash.md. Same contract as the TS package: bash / bash_output / bash_kill with a session object, tokio-driven process runner, inactivity + wall-clock timeouts, HeadTailBuffer with spill-to-file, background job map.

Structs§

BackgroundReadResult
BashBackgroundStarted
BashError
BashKillParams
BashNonzeroExit
BashOk
BashOutputParams
BashParams
BashPermissionPolicy
Permission policy with the autonomous-mode escape hatch for tests.
BashRunInput
Everything the runtime needs to launch + wire up a subprocess. The on_stdout/on_stderr callbacks hand each chunk back to the orchestrator for head+tail buffering and inactivity-timer reset.
BashRunResult
BashSessionConfig
BashTimeout
CwdCarryOutcome
Expose applyCwdCarry equivalent for harnesses that want to mutate logical cwd after a successful cd command. Same contract as the TS applyCwdCarry — returns whether the cwd changed and whether the attempt escaped the workspace.
HeadTailBuffer
Per-stream output buffer. Keeps head in memory, spills the rest to a temp file when overflow triggers. Matches the TS HeadTailBuffer simplification (head-only inline; full file recoverable via Read).

Enums§

BashKillResult
BashOutputResult
BashParseError
BashResult
TimeoutReason

Constants§

BACKGROUND_MAX_JOBS
BASH_KILL_TOOL_DESCRIPTION
BASH_KILL_TOOL_NAME
BASH_OUTPUT_TOOL_DESCRIPTION
BASH_OUTPUT_TOOL_NAME
BASH_TOOL_DESCRIPTION
BASH_TOOL_NAME
DEFAULT_INACTIVITY_TIMEOUT_MS
DEFAULT_WALLCLOCK_BACKSTOP_MS
KILL_GRACE_MS
MAX_COMMAND_LENGTH
MAX_OUTPUT_BYTES_FILE
MAX_OUTPUT_BYTES_INLINE
SENSITIVE_ENV_PREFIXES
Env var prefixes the tool refuses to let the model set. Mirrors the TS SENSITIVE_ENV_PREFIXES list.

Traits§

BashExecutor

Functions§

apply_cwd_carry
Expose applyCwdCarry equivalent for harnesses that want to mutate logical cwd after a successful cd command. Same contract as the TS applyCwdCarry — returns whether the cwd changed and whether the attempt escaped the workspace. Mirror of the TS applyCwdCarry. Takes the executed command, its exit code, and mutates session.logical_cwd if a top-level cd landed inside the workspace. Returns a summary so the caller can annotate the tool result if an escape attempt was blocked.
bash
bash_kill
bash_output
default_executor
detect_top_level_cd
Expose applyCwdCarry equivalent for harnesses that want to mutate logical cwd after a successful cd command. Same contract as the TS applyCwdCarry — returns whether the cwd changed and whether the attempt escaped the workspace. Top-level grammar check for a cd <path> command. Returns the target only for a single, unambiguous cd with no shell operators.
format_background_started_text
format_bash_kill_text
format_bash_output_text
format_result_text
format_timeout_text
safe_parse_bash_kill_params
safe_parse_bash_output_params
safe_parse_bash_params