Update lifecycle for deepagents-cli.
Handles version checking against PyPI (with caching), install-method detection, auto-upgrade execution, config-driven opt-in/out, notification throttling, and "what's new" tracking.
Most public entry points absorb errors and return sentinel values.
set_auto_update raises on write failures so callers can surface
actionable feedback.
PyPI JSON API endpoint for version checks.
User-Agent header sent with PyPI requests.
Directory for user-level Deep Agents configuration (~/.deepagents).
Path to the user's model configuration file (~/.deepagents/config.toml).
Fetch the latest deepagents-cli version from PyPI, with caching.
Results are cached to CACHE_FILE to avoid repeated network calls.
The cache stores both the latest stable and pre-release versions so a
single PyPI request serves both code paths.
Return whether the user should be notified about version latest.
Throttles notifications to at most once per CACHE_TTL period for a
given version, preventing repeated banners every session.
Record that the user was notified about version latest.
Writes into the shared update state file so a subsequent
should_notify_update call can suppress duplicate banners.
Check whether a newer version of deepagents-cli is available.
When the installed version is a pre-release (e.g. 0.0.35a1),
pre-release versions on PyPI are included in the comparison so alpha
testers are notified of newer alphas and the eventual stable release.
Stable installs only compare against stable PyPI releases.
Detect how deepagents-cli was installed.
Checks sys.prefix against known paths for uv and Homebrew.
Return the shell command to upgrade deepagents-cli.
Falls back to the pip command for unrecognized install methods.
Attempt to upgrade deepagents-cli using the detected install method.
Only tries the detected method — does not fall back to other package managers to avoid cross-environment contamination.
Return whether update checks are enabled.
Checks DEEPAGENTS_CLI_NO_UPDATE_CHECK env var and the [update].check key
in config.toml.
Defaults to enabled.
Return whether auto-update is enabled.
Opt-in via DEEPAGENTS_CLI_AUTO_UPDATE=1 env var or
[update].auto_update = true in config.toml.
Defaults to False.
Always disabled for editable installs.
Persist the auto-update preference to config.toml.
Writes [update].auto_update so the setting survives across sessions.
Return the last version the user saw the "what's new" banner for.
Record that the user has seen the "what's new" banner for version.
Return True if this is the first launch on a newer version.