Interactive model selector screen for /model command.
Get the glyph set for the current charset mode.
Check whether the terminal is in ASCII charset mode.
Convenience wrapper so widgets can branch on charset without importing
both _detect_charset_mode and CharsetMode.
Remove the default model from the config file.
Deletes the [models].default key so that future launches fall back to
[models].recent or environment auto-detection.
Get available models dynamically from installed LangChain provider packages.
Imports model profiles from each provider package and extracts model names.
Results are cached after the first call; use clear_caches() to reset.
Return the env var name that holds credentials for a provider.
Checks the config file first (user override), then falls back to the
hardcoded PROVIDER_API_KEY_ENV map.
Load upstream profiles merged with config.toml overrides.
Keyed by provider:model spec string. Each entry contains the
merged profile dict and the set of keys overridden by config.toml.
Unlike get_available_models(), this includes all models from upstream
profiles regardless of capability filters (tool calling, text I/O).
Results are cached; use clear_caches() to reset. When cli_override is
provided the result is stored in a single-slot cache keyed by
id(cli_override). This relies on the caller retaining the same dict
object for the session (the app stores it once on the app instance);
passing a different dict with the same contents will bypass the cache
and overwrite the previous entry.
Return credential readiness details for a provider.
Combines config, well-known provider metadata, optional provider auth, and implicit-auth provider metadata before attempting model creation:
config.toml
[models.providers.<name>]):
api_key_env, that env var is checked
via resolve_env_var() (which honors DEEPAGENTS_CODE_ prefixes).class_path but no api_key_env, the provider is
assumed to manage its own auth (e.g., custom headers, JWT, mTLS).api_key_env nor class_path is set, falls through
to provider-specific defaults.PROVIDER_API_KEY_ENV): a module-level dict
mapping well-known provider names to their canonical env var
(e.g., "anthropic" → "ANTHROPIC_API_KEY"). The env var is checked
via resolve_env_var().OPTIONAL_AUTH_ENV): when present, mark
the provider as configured for hosted/cloud use.NO_AUTH_REQUIRED_PROVIDERS): default
local endpoints report NOT_REQUIRED; non-local endpoints fall back
to UNKNOWN so the SDK can decide.Use has_provider_credentials() when compatibility with the historic
True/False/None contract is required.
Update the default model in config file.
Reads existing config (if any), updates [models].default, and writes
back using proper TOML serialization.
Character glyphs for TUI display.
Parsed model configuration from config.toml.
Instances are immutable once constructed. The providers mapping is
wrapped in MappingProxyType to prevent accidental mutation of the
globally cached singleton returned by load().
Profile data for a model with override tracking.
Credential readiness state for a model provider.
Credential readiness information for a provider.
A clickable model option in the selector.
Full-screen modal for model selection.
Displays available models grouped by provider with keyboard navigation and search filtering. Current model is highlighted.
Returns (model_spec, provider) tuple on selection, or None on cancel.
LangChain brand colors and semantic constants for the app.
Single source of truth for color values used in Python code (Rich markup,
Content.styled, Content.from_markup). CSS-side styling should reference
Textual CSS variables: built-in variables
($primary, $background, $text-muted, $error-muted, etc.) are set via
register_theme() in DeepAgentsApp.__init__, while the few app-specific
variables ($mode-bash, $mode-command, $mode-incognito, $skill,
$skill-hover, $tool, $tool-hover) are backed by these constants via
App.get_theme_variable_defaults().
Code that needs custom CSS variable values should call
get_css_variable_defaults(dark=...). For the full semantic color palette, look
up the ThemeColors instance via get_registry().
Users can define custom themes in ~/.deepagents/config.toml under
[themes.<name>] sections. Each new theme section must include label (str);
dark (bool) defaults to False if omitted (set to True for dark themes).
Color fields are optional and fall back to the built-in dark/light palette based
on the dark flag. Sections whose name matches a built-in theme override its
colors without replacing it. See _load_user_themes() for details.