Auto-install pinned upstream binaries for optional tools.
Today this only manages ripgrep. The SDK shells out to rg via PATH,
so installing into ~/.deepagents/bin/ and prepending that directory to
os.environ["PATH"] is sufficient — no SDK change required.
The pinned RIPGREP_VERSION and RIPGREP_ASSETS table is the single
source of truth for what gets downloaded and verified. When bumping the
version, refresh both the version and the SHA-256 entries together.
Disable network downloads of managed binaries (e.g. ripgrep).
Parsed by is_env_truthy: accepts 1, true, yes, on as enabled. When
truthy, managed_tools.ensure_ripgrep will not attempt to download a binary
and falls back to the existing missing-tool notification + slow Python regex
path.
Pinned upstream ripgrep release. Bump alongside RIPGREP_ASSETS.
(sys.platform, normalized arch) -> (asset filename, sha256 hex).
Directory holding managed binaries. Prepended to PATH on startup.
Return whether env var name is set to a recognizably truthy value.
Unlike bool(os.environ.get(name)), this does not treat "0" or
"false" as enabled. Use this for on/off flags where the user would
reasonably expect VAR=0 to mean "disabled".
Return the managed ripgrep binary path (.exe on Windows).
Return whether managed-tool downloads are disabled via env var.
Idempotently prepend BIN_DIR to os.environ["PATH"].
Safe to call on every startup. Callers do not need to check whether
the directory exists — adding a non-existent directory to PATH is
harmless and matches behavior of common version managers.
Ensure a usable rg binary is available, installing if necessary.
Resolution order:
rg exists and matches RIPGREP_VERSION, return it.rg is on PATH and no managed binary
exists, return its resolved path. This is gated on the absence
of a managed binary: once a managed rg exists, the pinned
version always wins, so a stale managed binary is re-fetched
rather than deferring to a system rg and the resolved version
stays deterministic.None so callers fall back to the existing
notification + slow path.BIN_DIR to PATH → return the installed path. On a
checksum mismatch, raises ChecksumMismatchError so callers can
surface a loud notice; other failures log and return None.A stale managed binary is never proactively deleted. The atomic
replace in _install_ripgrep_sync overwrites it on success, and on
failure the user is strictly better off keeping the older copy than
being left with no rg at all.