Inspect optional-dependency install status for the running distribution.
Reads Requires-Dist metadata to report which packages declared under
[project.optional-dependencies] are installed, and renders that status
in either plain text (for stdout) or markdown (for rich UI contexts).
Outcome of a distribution version lookup.
Used for any distribution (the deepagents SDK and the deepagents-code
CLI alike). "not_installed" means the package metadata is genuinely absent;
"error" means an unexpected failure occurred while reading it. Callers
that don't care which kind of failure happened can treat both the same.
Optional extras that add model-provider integrations.
Keep in sync with [project.optional-dependencies] in pyproject.toml.
Optional extras that add sandbox integrations.
Optional extras that don't fit the provider/sandbox taxonomy.
quickjs is a core dependency as of 0.1.24, but the empty extra remains
installable so older deepagents-code[quickjs] and /install quickjs workflows
stay harmless.
Union of all individually-installable extras.
Excludes the composite meta-extras (all-providers, all-sandboxes) since
those expand to other extras and don't add anything on their own.
Drift-protected by test_model_config.TestProviderApiKeyEnv and the
model-provider-drift checks; new extras must be added to the corresponding
category frozenset above.
Mapping from ready extra names to (package, installed_version) tuples.
Core LangChain-ecosystem packages surfaced for editable installs.
The deepagents SDK is reported separately by /version, so it is omitted
here. These are the packages a local checkout is most likely to pin or
override, so their resolved versions help diagnose editable environments.
langchain-quickjs powers the built-in interpreter and is a core dependency
(not an optional extra), so it belongs here rather than under the optional
dependencies section.
Collect version facts for the running deepagents-code distribution.
Collect version facts for the installed deepagents SDK distribution.
Editable SDK installs prefer the source tree's _version.py; everything
else reports the installed metadata version. Distinguishes a genuinely
missing package from an unexpected metadata error.
Return the base deepagents requirement declared by deepagents-code.
Reads the installed distribution's Requires-Dist metadata and parses each
entry with packaging.Requirement, returning the applicable base
deepagents dependency. Extras-gated or environment-conditional variants
whose marker does not apply to the current environment are skipped.
Collect the offline version report used by --version, /version, and doctor.
Return the source/metadata drift annotation for the CLI version line.
Editable status is surfaced separately by every caller (the dedicated
Editable install: line on --version//version, and the Install method
item in doctor), so it is intentionally not repeated inline here — that
kept the CLI reading "editable" twice on those surfaces.
Return the workspace/editable/drift/mismatch SDK version annotation.
Resolve the diagnostic deepagents SDK version.
Compatibility wrapper for callers that only need one SDK version string and
lookup status. Every editable install carries an +editable local segment,
matching how the SDK stamps lc_versions["deepagents"]. For sibling monorepo
packages whose stable source marker trails dcode's exact SDK pin, the pin
identifies the nearest published baseline the workspace HEAD represents.
Render the installable extras grouped by category as plain text.
Drives the no-argument /install slash-command help so users can
discover valid extras without consulting pyproject.toml. Sourced from
the category frozensets above, so it stays in sync with KNOWN_EXTRAS
automatically.
Return ready optional dependencies grouped by extra.
Reads Requires-Dist metadata from the named distribution, groups the
entries gated by extra == "..." markers under their extra name, and
resolves each package's installed version via importlib.metadata.
Partially installed extras are omitted so shared transitive dependencies
do not make unavailable integrations appear installed.
Composite meta-extras that only bundle other extras (see
_COMPOSITE_EXTRAS) and self-references to the distribution itself
are skipped — their components already appear under their own extras.
Return extras with at least one installed dependency.
Deliberately looser than get_extras_status, which requires every declared
package to be present. Callers here rebuild install commands, so a partially
installed extra must still be preserved across an upgrade; dropping it would
silently uninstall what the user asked for. Do not harmonize the two.
Return installed and missing optional dependencies grouped by extra.
Return the installable extra that declares a package.
Resolves recovery hints from the package that is actually missing
instead of guessing from a provider identifier. For example,
langchain-google-vertexai maps to the vertex extra even though the
provider id is google_vertexai.
Resolve how to recover from a missing provider package.
Centralizes the extra_for_package -> install_package_command fallback so
the TUI startup hint and the model-initialization error path render
consistent recovery data without each re-implementing the branching and
error handling. Prefers the installable extra; otherwise derives a raw
package install command, degrading to a manual hint (both fields None)
when that cannot be determined.
Callers own sentence wording and command framing (for example interactive
/install / /model copy). This helper only resolves the recovery action.
Check that langchain-quickjs is installed for the interpreter.
Uses importlib.util.find_spec for a lightweight check with no actual
imports. Call this in the app process before spawning the server
subprocess so users get a clear, actionable error instead of an opaque
server crash when the core dependency is missing or broken.
Returns silently when the package is importable.
Render an ExtrasStatus mapping as column-aligned plain text.
Suitable for stdout in non-interactive contexts (e.g. the --version
CLI flag) where a markdown renderer is unavailable.
Return (package, version) pairs for the core ecosystem dependencies.
Render core ecosystem dependency versions as column-aligned plain text.
Suitable for stdout in non-interactive contexts (e.g. the --version
CLI flag) where a markdown renderer is unavailable.
Render core ecosystem dependency versions as a markdown fragment.
Render an ExtrasStatus mapping as a markdown fragment.
Structured version facts for a single installed distribution.
Separates three facts that are easily conflated: the live version read from
the running source, whether imported or parsed (source_version), the
version recorded in the installed distribution metadata (metadata_version),
and whether the install is editable (with its source_path). status
records whether the metadata lookup succeeded so diagnostic callers can
distinguish a genuinely absent package from an unexpected lookup failure.
Network-free snapshot of the version facts diagnostics need.
Bundles the running CLI and installed SDK version facts with the result of
comparing the deepagents requirement that deepagents-code declares
against the effective SDK version for diagnostics.
Raised when installed extras cannot be determined safely.
Install status for one optional dependency extra.
Resolved recovery action for a missing provider package.
Exactly one of three outcomes:
extra set, command None — prefer installing the extra that declares
the package (callers format this for their UI surface).command set, extra None — no declared extra; use this raw install
command.None — neither could be derived; caller should fall back to
"install the package manually" phrasing.