Skip to content

The agent that grows with you

refactor(hermes_cli): tools_config group — AST-neutral closer hugging and item packing (data tables kept expanded)

Teknium316427f2150e
diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py
index 44f6c7b3bda..855e668945f 100644
--- a/hermes_cli/tools_config.py
+++ b/hermes_cli/tools_config.py
@@ -10,12 +10,10 @@ from hermes_cli.cli_output import print_info as _print_info
from hermes_cli.colors import Colors, color
from hermes_cli.config import cfg_get, load_config, save_config, get_env_value
from hermes_cli.nous_subscription import (
- NousSubscriptionFeatures, apply_nous_managed_defaults, get_nous_subscription_features,
-)
+ NousSubscriptionFeatures, apply_nous_managed_defaults, get_nous_subscription_features)
from hermes_cli.platforms import PLATFORMS as _PLATFORMS_REGISTRY
from hermes_cli.toolset_scope import (
- _TOOLSET_PLATFORM_RESTRICTIONS, toolset_allowed_for_platform as _toolset_allowed_for_platform,
-)
+ _TOOLSET_PLATFORM_RESTRICTIONS, toolset_allowed_for_platform as _toolset_allowed_for_platform)
# Re-exports: keep ``hermes_cli.tools_config.X`` callers and test patch targets resolving.
from hermes_cli.tools_config_cua import ( # noqa: F401
_post_setup_no_window_flags, _cua_driver_cmd, _cua_version_summary, _resolved_cua_driver_cmd,
@@ -26,8 +24,7 @@ from hermes_cli.tools_config_cua import ( # noqa: F401
_clear_stale_windows_cua_install_lock, _clear_stale_cua_install_lock, _cua_install_lock_held,
_cua_release_endpoint_reachable, _ps_single_quote, _cua_driver_autostart_registered_windows,
_repair_cua_driver_autostart_windows, _remove_quietly, _print_cua_platform_notes,
- _run_cua_driver_installer,
-)
+ _run_cua_driver_installer)
from hermes_cli.tools_config_post_setup import ( # noqa: F401
_ensure_browser_use_cli, _post_setup_lightpanda, _post_setup_agent_browser, _post_setup_camofox,
_KITTENTTS_WHEEL_URL, _PIP_POST_SETUP_HOOKS, _post_setup_pip, _post_setup_spotify, _post_setup_langfuse,
@@ -35,8 +32,7 @@ from hermes_cli.tools_config_post_setup import ( # noqa: F401
_POST_SETUP_INSTALLED, _post_setup_already_installed, _module_installed,
_RESTORABLE_PYTHON_TOOL_DEPENDENCIES, active_restorable_python_tool_dependencies,
restorable_python_tool_dependency, _agent_browser_installed, _camofox_installed, _lightpanda_installed,
- _cloud_agent_browser_installed, _POST_SETUP_READY,
-)
+ _cloud_agent_browser_installed, _POST_SETUP_READY)
from hermes_cli.tools_config_providers import ( # noqa: F401
_plugin_provider_rows, _plugin_image_gen_providers, _plugin_video_gen_providers,
_plugin_web_search_providers, _plugin_browser_providers, _plugin_tts_providers, web_provider_capabilities,
@@ -49,13 +45,11 @@ from hermes_cli.tools_config_providers import ( # noqa: F401
_select_plugin_video_gen_provider, STT_MODEL_CATALOG, _STT_MODEL_CONFIG_KEY, _configure_stt_model,
_PROVIDER_MARKER_SECTIONS, _write_provider_config, apply_provider_selection, _nous_provider_gate,
_finish_provider_selection, _print_provider_selection, _configure_provider, _reconfigure_provider,
- _configure_vision_backend, _configure_vision_provider_model, _configure_simple_requirements,
-)
+ _configure_vision_backend, _configure_vision_provider_model, _configure_simple_requirements)
from hermes_cli.tools_config_mcp import ( # noqa: F401
_mcp_match_filter, _mcp_preselected, _apply_mcp_checklist, _configure_mcp_tools_interactive,
_apply_toolset_change, _apply_mcp_change, _print_tools_list, _known_tool_platforms,
- tools_disable_enable_command,
-)
+ tools_disable_enable_command)
logger = logging.getLogger(__name__)
@@ -191,8 +185,7 @@ def _checklist_toolset_keys(platform: str) -> Set[str]:
composites, MCP names) are NOT here — the checklist never shows them."""
return {
ts_key for ts_key, _, _ in _get_effective_configurable_toolsets()
- if _toolset_allowed_for_platform(ts_key, platform) and ts_key not in _CONFIG_ONLY_TOOLSETS
- }
+ if _toolset_allowed_for_platform(ts_key, platform) and ts_key not in _CONFIG_ONLY_TOOLSETS}
def _platform_default_toolset(platform: str) -> str:
@@ -419,8 +412,7 @@ TOOLSET_ENV_REQUIREMENTS = {"vision": [("OPENROUTER_API_KEY", "https://openroute
# --- Platform / Toolset Helpers ---
_PLATFORM_ENABLE_ENV_VARS = (
("telegram", "TELEGRAM_BOT_TOKEN"), ("discord", "DISCORD_BOT_TOKEN"), ("slack", "SLACK_BOT_TOKEN"),
- ("whatsapp", "WHATSAPP_ENABLED"), ("qqbot", "QQ_APP_ID"),
-)
+ ("whatsapp", "WHATSAPP_ENABLED"), ("qqbot", "QQ_APP_ID"))
def _get_enabled_platforms() -> List[str]:
@@ -550,8 +542,7 @@ def _platform_default_keys() -> Set[str]:
def _explicit_toolsets(
toolset_names: List[str], explicit_known_keys: Set[str], config: dict, platform: str,
- explicitly_configured: bool,
-) -> Set[str]:
+ explicitly_configured: bool) -> Set[str]:
"""Enabled set when the saved list names configurable/plugin keys directly. Direct membership avoids the
subset-inference bug where composites like ``hermes-cli`` (all _HERMES_CORE_TOOLS) re-enabled disabled
toolsets. A mixed list (``[hermes-cli, spotify]``) still expands the composite, else sessions keep only the
@@ -561,8 +552,7 @@ def _explicit_toolsets(
enabled = {ts for ts in toolset_names if ts in explicit_known_keys and _toolset_allowed_for_platform(ts, platform)}
composite_tools = {
t for ts_name in toolset_names if ts_name not in explicit_known_keys and ts_name in TOOLSETS
- for t in resolve_toolset(ts_name)
- }
+ for t in resolve_toolset(ts_name)}
if composite_tools:
enabled |= _configurable_subset_of(composite_tools, platform) - _default_off_toolsets(platform, explicitly_configured)
_enable_recently_shipped_toolsets(enabled, config, platform)
@@ -708,8 +698,7 @@ def _warn_all_invalid_platform_toolsets(platform: str, explicit: list) -> None:
"platform '%s' has no valid toolsets configured (unknown "
"name(s): %s) - tools will be unavailable. Run `hermes tools` "
"to reconfigure. See issue #38798.",
- platform, ", ".join(named),
- )
+ platform, ", ".join(named))
def _save_platform_tools(config: dict, platform: str, enabled_toolset_keys: Set[str]):
@@ -817,8 +806,7 @@ def _estimate_tool_tokens() -> Dict[str, int]:
# Mirror the wire shape sent to the API.
counts = {
name: len(enc.encode(_json.dumps({"type": "function", "function": schema})))
- for name in registry.get_all_tool_names() if (schema := registry.get_schema(name))
- }
+ for name in registry.get_all_tool_names() if (schema := registry.get_schema(name))}
_tool_token_cache[cache_key] = counts
return counts
@@ -832,13 +820,11 @@ def _prompt_toolset_checklist(platform_label: str, enabled: Set[str], platform:
# Drop platform-scoped toolsets that don't apply here and config-only capabilities (stt).
effective = [
(k, l, d) for (k, l, d) in _get_effective_configurable_toolsets()
- if _toolset_allowed_for_platform(k, platform) and k not in _CONFIG_ONLY_TOOLSETS
- ]
+ if _toolset_allowed_for_platform(k, platform) and k not in _CONFIG_ONLY_TOOLSETS]
labels = [
f"{ts_label} ({ts_desc})"
+ (" [no API key]" if not _toolset_has_keys(ts_key, force_fresh=force_fresh) and _is_configurable(ts_key) else "")
- for ts_key, ts_label, ts_desc in effective
- ]
+ for ts_key, ts_label, ts_desc in effective]
pre_selected = {i for i, (ts_key, _, _) in enumerate(effective) if ts_key in enabled}
status_fn = None
@@ -876,9 +862,7 @@ def _reconfigure_tool(config: dict, *, force_fresh: bool = True):
for ts_key, ts_label, _ in _get_effective_configurable_toolsets()
if _is_configurable(ts_key) and (
_toolset_has_keys(ts_key, config, force_fresh=force_fresh)
- or _toolset_enabled_for_reconfigure(ts_key, config)
- )
- ]
+ or _toolset_enabled_for_reconfigure(ts_key, config))]
if not configurable:
_print_info("No configured tools to reconfigure.")
return
@@ -1014,8 +998,7 @@ def _first_install_flow(config: dict, enabled_platforms: List[str]) -> None:
# Browserbase), TTS (Edge vs OpenAI vs ElevenLabs), etc. are shown even when a free provider exists.
_configure_list(
[ts for ts in sorted(new_enabled) if _is_configurable(ts) and ts not in auto_configured],
- config, selected=False,
- )
+ config, selected=False)
_save_platform_tools(config, pkey, new_enabled)
save_config(config)
print(color(f" ✓ Saved {pinfo['label']} tool configuration", Colors.GREEN))
diff --git a/hermes_cli/tools_config_cua.py b/hermes_cli/tools_config_cua.py
index d25f9e2f280..95e9e694de9 100644
--- a/hermes_cli/tools_config_cua.py
+++ b/hermes_cli/tools_config_cua.py
@@ -11,8 +11,7 @@ from pathlib import Path
from typing import List, Optional
from hermes_cli.cli_output import (
- print_info as _print_info, print_success as _print_success, print_warning as _print_warning,
-)
+ print_info as _print_info, print_success as _print_success, print_warning as _print_warning)
logger = logging.getLogger("hermes_cli.tools_config")
@@ -224,16 +223,14 @@ def _confirmed_update_check(driver_cmd: str, require_confirmed_update: bool) ->
_print_info(
f" Could not confirm a newer {driver_cmd} release "
"(offline, rate-limited, or driver too old to check); "
- "keeping the installed version."
- )
+ "keeping the installed version.")
_print_info(f" Force a refresh with: {_UPGRADE_CMD}")
return False, None
return True, None
if not _state.get("update_available"):
_print_success(
f" {driver_cmd} is already on the latest release "
- f"({_state.get('current_version') or 'unknown'})."
- )
+ f"({_state.get('current_version') or 'unknown'}).")
return False, None
# Windows routine upgrades run unattended-safe (stdin closed, version pinned, ceiling
# _CUA_BACKGROUND_UPDATE_TIMEOUT, preflights skip in seconds); only contract repairs and fresh
@@ -353,15 +350,13 @@ def install_cua_driver(
ok = _run_cua_driver_installer(
label="Repairing" if repair_existing else "Refreshing", verbose=False, pin_version=confirmed_version,
show_progress=show_installer_progress,
- installer_timeout=_CUA_BACKGROUND_UPDATE_TIMEOUT if require_confirmed_update else None,
- )
+ installer_timeout=_CUA_BACKGROUND_UPDATE_TIMEOUT if require_confirmed_update else None)
if ok and repair_existing:
repaired = _cua_driver_contract_status()
if not repaired.get("ready"):
_print_warning(
" cua-driver was reinstalled, but its runtime contract is still "
- f"unusable: {repaired.get('reason') or 'unknown error'}."
- )
+ f"unusable: {repaired.get('reason') or 'unknown error'}.")
_print_info(" Run: hermes computer-use doctor")
return False
if ok and before:
@@ -411,8 +406,7 @@ def _clear_stale_windows_cua_install_lock() -> None:
create_file = kernel32.CreateFileW
create_file.argtypes = [
_wintypes.LPCWSTR, _wintypes.DWORD, _wintypes.DWORD, _wintypes.LPVOID,
- _wintypes.DWORD, _wintypes.DWORD, _wintypes.HANDLE,
- ]
+ _wintypes.DWORD, _wintypes.DWORD, _wintypes.HANDLE]
create_file.restype = _wintypes.HANDLE
close_handle = kernel32.CloseHandle
close_handle.argtypes = [_wintypes.HANDLE]
@@ -420,19 +414,16 @@ def _clear_stale_windows_cua_install_lock() -> None:
handle = create_file(
str(lock_file), generic_read | generic_write | delete_access, 0, # 0 = FileShare::None
- None, open_existing, file_attribute_normal | file_flag_delete_on_close, None,
- )
+ None, open_existing, file_attribute_normal | file_flag_delete_on_close, None)
if handle == _wintypes.HANDLE(-1).value:
logger.debug(
"Windows cua install lock at %s is still held or cannot be removed (winerror %s)",
- lock_file, _ctypes.get_last_error(),
- )
+ lock_file, _ctypes.get_last_error())
return
if not close_handle(handle):
logger.debug(
"could not close Windows cua install lock probe at %s (winerror %s)",
- lock_file, _ctypes.get_last_error(),
- )
+ lock_file, _ctypes.get_last_error())
return
if lock_file.exists():
logger.debug("Windows cua install lock probe succeeded but %s remains", lock_file)
@@ -549,8 +540,7 @@ def _cua_driver_autostart_registered_windows() -> bool:
try:
result = subprocess.run(
["schtasks.exe", "/Query", "/TN", "cua-driver-serve"],
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=10,
- )
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=10)
except Exception:
return False
return result.returncode == 0
@@ -576,8 +566,7 @@ def _repair_cua_driver_autostart_windows(driver_cmd: str, *, verbose: bool) -> b
"$proc = Start-Process -FilePath $exe "
"-ArgumentList @('autostart','enable') "
"-Verb RunAs -Wait -PassThru -ErrorAction Stop; "
- "exit $proc.ExitCode"
- )
+ "exit $proc.ExitCode")
_print_info(" Registering cua-driver auto-start..." if verbose else " Repairing cua-driver auto-start registration...")
try:
@@ -609,8 +598,7 @@ def _remove_quietly(path: str) -> None:
_MAC_PERMISSION_PATHS = (
" System Settings > Privacy & Security > Accessibility",
- " System Settings > Privacy & Security > Screen Recording",
-)
+ " System Settings > Privacy & Security > Screen Recording")
def _print_cua_platform_notes(is_windows: bool, is_linux: bool, *, fresh_install: bool) -> None:
@@ -682,8 +670,7 @@ def _reap_after_timeout(proc, *, is_windows: bool) -> None:
logger.debug(
"cua-driver installer pipes still open %ss after the kill — "
"abandoning the drain, a surviving descendant holds the inherited handle",
- _CUA_INSTALLER_DRAIN_GRACE,
- )
+ _CUA_INSTALLER_DRAIN_GRACE)
except (OSError, ValueError) as e:
logger.debug("cua-driver installer drain failed: %s", e)
@@ -745,8 +732,7 @@ def _unattended_installer_preflight(install_cmd: list, is_windows: bool):
def _run_cua_driver_installer(
label: str = "Installing", verbose: bool = True, pin_version: Optional[str] = None, show_progress: bool = True,
- installer_timeout: Optional[float] = None,
-) -> bool:
+ installer_timeout: Optional[float] = None) -> bool:
"""Run the upstream cua-driver installer for this platform.
The scripts are idempotent: they always download the latest release, so re-running on an
diff --git a/hermes_cli/tools_config_mcp.py b/hermes_cli/tools_config_mcp.py
index 7606393e51e..c37b31c9973 100644
--- a/hermes_cli/tools_config_mcp.py
+++ b/hermes_cli/tools_config_mcp.py
@@ -6,12 +6,10 @@ from typing import List, Set
from hermes_cli.cli_output import (
print_error as _print_error, print_info as _print_info, print_success as _print_success,
- print_warning as _print_warning,
-)
+ print_warning as _print_warning)
from hermes_cli.colors import Colors, color
from hermes_cli.toolset_scope import (
- _TOOLSET_PLATFORM_RESTRICTIONS, toolset_allowed_for_platform as _toolset_allowed_for_platform,
-)
+ _TOOLSET_PLATFORM_RESTRICTIONS, toolset_allowed_for_platform as _toolset_allowed_for_platform)
def _mcp_match_filter():
@@ -65,8 +63,7 @@ def _apply_mcp_checklist(server_name: str, tools_cfg: dict, tool_names: List[str
f"tool(s) still match glob exclude pattern(s) "
f"{glob_entries} and stay excluded — edit "
f"mcp_servers.{server_name}.tools.exclude in config.yaml "
- "to enable them."
- )
+ "to enable them.")
if new_exclude:
tools_cfg["exclude"] = new_exclude
else:
@@ -296,8 +293,7 @@ def tools_disable_enable_command(args):
successful = [
t for t in targets
if t not in unknown_toolsets and t not in restricted_targets
- and (":" not in t or t.split(":")[0] not in failed_servers)
- ]
+ and (":" not in t or t.split(":")[0] not in failed_servers)]
if successful:
verb = "Disabled" if action == "disable" else "Enabled"
_print_success(f"{verb}: {', '.join(successful)}")
diff --git a/hermes_cli/tools_config_post_setup.py b/hermes_cli/tools_config_post_setup.py
index 15e00d4193e..2559b24235b 100644
--- a/hermes_cli/tools_config_post_setup.py
+++ b/hermes_cli/tools_config_post_setup.py
@@ -12,8 +12,7 @@ from typing import Set
from hermes_cli.cli_output import (
print_error as _print_error, print_info as _print_info, print_success as _print_success,
- print_warning as _print_warning,
-)
+ print_warning as _print_warning)
from hermes_cli.config import get_env_value
from hermes_cli.tools_config_cua import (
_cua_driver_install_ready, _pip_install, _post_setup_no_window_flags, _run_text, install_cua_driver,
@@ -97,8 +96,7 @@ def _post_setup_agent_browser(post_setup_key: str) -> None:
# Lazy import so the tools_config UI doesn't pull in browser_tool at import time.
from tools.browser_tool import (
_chromium_installed, _running_in_docker, _find_agent_browser, _resolve_npx_bin,
- _is_npx_agent_browser_sentinel, AGENT_BROWSER_NPX_SPEC,
- )
+ _is_npx_agent_browser_sentinel, AGENT_BROWSER_NPX_SPEC)
except Exception as exc: # pragma: no cover — defensive
_print_warning(f" Could not check Chromium status: {exc}")
return
@@ -179,8 +177,7 @@ _PIP_POST_SETUP_HOOKS: dict = {
"args": ["-U", "faster-whisper", "--quiet"], "manual": "uv pip install -U faster-whisper",
"on_install": ("Model sizes: tiny, base (default), small, medium, large-v3",
"Change via stt.local.model in ~/.hermes/config.yaml"),
- "always": (),
- },
+ "always": ()},
"kittentts": {
"module": "kittentts", "label": "kittentts",
"installing": "Installing kittentts (~25-80MB model, CPU-only)...",
@@ -188,8 +185,7 @@ _PIP_POST_SETUP_HOOKS: dict = {
"manual": f"uv pip install -U '{_KITTENTTS_WHEEL_URL}' soundfile",
"on_install": ("Voices: Jasper, Bella, Luna, Bruno, Rosie, Hugo, Kiki, Leo",
"Models: KittenML/kitten-tts-nano-0.8-int8 (25MB), micro (41MB), mini (80MB)"),
- "always": (),
- },
+ "always": ()},
"piper": {
"module": "piper", "label": "piper-tts",
"installing": "Installing piper-tts (~14MB wheel, voices downloaded on first use)...",
@@ -197,17 +193,14 @@ _PIP_POST_SETUP_HOOKS: dict = {
"on_install": (),
"always": ("Default voice: en_US-lessac-medium (downloaded on first TTS call)",
"Full voice list: https://github.com/OHF-Voice/piper1-gpl/blob/main/docs/VOICES.md",
- "Switch voices by setting tts.piper.voice in ~/.hermes/config.yaml"),
- },
+ "Switch voices by setting tts.piper.voice in ~/.hermes/config.yaml")},
"ddgs": {
"module": "ddgs", "label": "ddgs",
"installing": "Installing ddgs (DuckDuckGo search package)...",
"args": ["-U", "ddgs", "--quiet"], "manual": "uv pip install -U ddgs",
"on_install": (),
"always": ("No API key required. DuckDuckGo enforces server-side rate limits.",
- "Pair with an extract provider if you also need web_extract."),
- },
-}
+ "Pair with an extract provider if you also need web_extract.")}}
def _post_setup_pip(spec: dict) -> None:
@@ -253,8 +246,7 @@ def _post_setup_spotify() -> None:
_print_info(" Starting Spotify login...")
try:
login_spotify_command(SimpleNamespace(
- client_id=None, redirect_uri=None, scope=None, no_browser=False, timeout=None,
- ))
+ client_id=None, redirect_uri=None, scope=None, no_browser=False, timeout=None))
_print_success(" Spotify authenticated")
except SystemExit as exc:
# User aborted the wizard or OAuth failed — don't fail the toolset enable.
@@ -326,10 +318,8 @@ def _post_setup_xai_grok() -> None:
choices=[
"Sign in with xAI Grok OAuth (SuperGrok / Premium+) — browser login",
"Paste an xAI API key (console.x.ai)",
- "Skip — configure later via `hermes auth add xai-oauth`",
- ],
- default=0,
- )
+ "Skip — configure later via `hermes auth add xai-oauth`"],
+ default=0)
if idx == 0:
if _run_xai_oauth_login_from_setup():
_print_success(" Logged in — xAI will use these OAuth credentials")
@@ -378,8 +368,7 @@ def valid_post_setup_keys() -> Set[str]:
_plugin_browser_providers,
_plugin_image_gen_providers,
_plugin_video_gen_providers,
- _plugin_web_search_providers,
- )
+ _plugin_web_search_providers)
keys: Set[str] = set()
for cat in TOOL_CATEGORIES.values():
@@ -453,16 +442,14 @@ _RESTORABLE_PYTHON_TOOL_DEPENDENCIES: dict[str, tuple[str, tuple[str, ...]]] = {
"kittentts": ("kittentts", ("-U", _KITTENTTS_WHEEL_URL, "soundfile")),
"piper": ("piper", ("-U", "piper-tts")),
"ddgs": ("ddgs", ("-U", "ddgs")),
- "langfuse": ("langfuse", ("langfuse",)),
-}
+ "langfuse": ("langfuse", ("langfuse",))}
def active_restorable_python_tool_dependencies() -> list[str]:
"""Return ``hermes tools`` Python dependencies present in this runtime."""
return [
name for name, (module_name, _install_args) in _RESTORABLE_PYTHON_TOOL_DEPENDENCIES.items()
- if _module_installed(module_name)
- ]
+ if _module_installed(module_name)]
def restorable_python_tool_dependency(name: str) -> tuple[str, tuple[str, ...]] | None:
@@ -516,5 +503,4 @@ _POST_SETUP_READY: dict = {
"browserbase": lambda: _cloud_agent_browser_installed(),
"camofox": lambda: _camofox_installed(),
"lightpanda": lambda: _lightpanda_installed(),
- "cua_driver": lambda: _cua_driver_install_ready(),
-}
+ "cua_driver": lambda: _cua_driver_install_ready()}
diff --git a/hermes_cli/tools_config_providers.py b/hermes_cli/tools_config_providers.py
index da98911aec5..319cdaf18bd 100644
--- a/hermes_cli/tools_config_providers.py
+++ b/hermes_cli/tools_config_providers.py
@@ -37,8 +37,7 @@ def _plugin_registry(module: str):
def _plugin_provider_rows(
registry_module: str, marker_keys: tuple[str, ...], *, require_name: bool = True, skip_builtin: bool = False,
- flatten_variants: bool = False,
-) -> list[dict]:
+ flatten_variants: bool = False) -> list[dict]:
"""Picker-row dicts (TOOL_CATEGORIES-shaped) for a plugin registry's providers.
``marker_keys`` are all set to the registry name so downstream config/model-picker code routes through
@@ -92,8 +91,7 @@ _PLUGIN_PROVIDER_ROW_SPECS = {
"video_gen": ("agent.video_gen_registry", ("video_gen_plugin_name",), {"require_name": False}),
"web": ("agent.web_search_registry", ("web_backend", "web_search_plugin_name"), {"flatten_variants": True}),
"browser": ("agent.browser_registry", ("browser_provider", "browser_plugin_name"), {}),
- "tts": ("agent.tts_registry", ("tts_provider", "tts_plugin_name"), {"skip_builtin": True}),
-}
+ "tts": ("agent.tts_registry", ("tts_provider", "tts_plugin_name"), {"skip_builtin": True})}
def _plugin_rows_for(category: str) -> list[dict]:
@@ -133,8 +131,7 @@ _PLUGIN_ROW_BUILDERS = {
"Video Generation": _plugin_video_gen_providers,
"Web Search & Extract": _plugin_web_search_providers,
"Browser Automation": _plugin_browser_providers,
- "Text-to-Speech": _plugin_tts_providers,
-}
+ "Text-to-Speech": _plugin_tts_providers}
def _visible_providers(
@@ -361,8 +358,7 @@ def _web_tier_matches(provider: dict, config: dict) -> bool:
# Managed-row marker -> (config section, key) the pick writes, in check order.
_MANAGED_SELECTION_KEYS: tuple[tuple[str, str, str], ...] = (
("tts_provider", "tts", "provider"), ("stt_provider", "stt", "provider"),
- ("browser_provider", "browser", "cloud_provider"), ("web_backend", "web", "backend"),
-)
+ ("browser_provider", "browser", "cloud_provider"), ("web_backend", "web", "backend"))
def _has_marker(provider: dict, marker: str) -> bool:
@@ -389,8 +385,7 @@ def _managed_provider_active(provider: dict, config: dict, managed_feature: str,
if (
configured_provider != NOUS_MANAGED_PROVIDER
and gen_cfg.get("use_gateway") is not None
- and not is_truthy_value(gen_cfg.get("use_gateway"), default=False)
- ):
+ and not is_truthy_value(gen_cfg.get("use_gateway"), default=False)):
return False
return feature.managed_by_nous
# Browser Use mode is a driver on top of the provider (attaches to its CDP endpoint), so the browser
@@ -457,8 +452,7 @@ def _imagegen_backend_active(provider: dict, config: dict) -> bool:
isinstance(image_cfg, dict)
and provider["imagegen_backend"] == "fal"
and image_cfg.get("provider") in {None, "", "fal"}
- and not is_truthy_value(image_cfg.get("use_gateway"), default=False)
- )
+ and not is_truthy_value(image_cfg.get("use_gateway"), default=False))
# Non-managed active checks, evaluated in order; the first marker the row carries decides (see ``_has_marker``).
@@ -470,8 +464,7 @@ _ACTIVE_CHECKS: tuple[tuple[str, Callable[[dict, dict], bool]], ...] = (
("browser_backend", _browser_backend_active),
("web_backend", lambda p, c: cfg_get(c, "web", "backend") == p["web_backend"] and _web_tier_matches(p, c)),
("computer_use_backend", lambda p, c: cfg_get(c, "computer_use", "backend") == p["computer_use_backend"]),
- ("imagegen_backend", _imagegen_backend_active),
-)
+ ("imagegen_backend", _imagegen_backend_active))
def _is_provider_active(provider: dict, config: dict, *, force_fresh: bool = False) -> bool:
@@ -522,8 +515,7 @@ def _fal_model_catalog():
# Per-backend model catalog (config_key = top-level config.yaml section, catalog_fn -> ({model_id: metadata},
# default_model)); a TOOL_CATEGORIES row tagged `imagegen_backend: "<name>"` selects the catalog at picker time.
IMAGEGEN_BACKENDS = {
- "fal": {"display": "FAL.ai", "config_key": "image_gen", "catalog_fn": _fal_model_catalog},
-}
+ "fal": {"display": "FAL.ai", "config_key": "image_gen", "catalog_fn": _fal_model_catalog}}
def _plugin_model_catalog(registry_module: str, plugin_name: str):
@@ -574,8 +566,7 @@ def _pick_model_from_catalog(
widths = {
"model": max(len(m) for m in model_ids),
"speed": max((len(catalog[m].get("speed", "")) for m in model_ids), default=6),
- "strengths": max((len(catalog[m].get("strengths", "")) for m in model_ids), default=0),
- }
+ "strengths": max((len(catalog[m].get("strengths", "")) for m in model_ids), default=0)}
print()
header = (f" {'Model':<{widths['model']}} {'Speed':<{widths['speed']}} "
@@ -625,8 +616,7 @@ def _configure_xai_imagine_storage(section_name: str, config: dict) -> None:
storage_cfg = _cfg_section(_cfg_section(_cfg_section(config, section_name), "xai"), "storage")
_print_warning(
" xAI Imagine can store generated media and create reusable public URLs. "
- "xAI may bill for stored files and public URL hosting."
- )
+ "xAI may bill for stored files and public URL hosting.")
choices = ["Enable public URLs without automatic expiry (recommended)", "Disable stored public URLs",
"Enable public URLs for 2 days"]
idx = _prompt_choice(" Stored public URLs:", choices, default=0)
@@ -671,8 +661,7 @@ STT_MODEL_CATALOG = {
"local": ["base", "tiny", "small", "medium", "large-v3"],
"groq": ["whisper-large-v3-turbo", "whisper-large-v3", "distil-whisper-large-v3-en"],
"openai": ["whisper-1", "gpt-4o-mini-transcribe", "gpt-4o-transcribe", "gpt-transcribe"],
- "elevenlabs": ["scribe_v2", "scribe_v1"],
-}
+ "elevenlabs": ["scribe_v2", "scribe_v1"]}
# ElevenLabs historically uses ``model_id`` instead of ``model``.
_STT_MODEL_CONFIG_KEY = {"elevenlabs": "model_id"}
@@ -798,8 +787,7 @@ def apply_provider_selection(ts_key: str, provider_name: str, config: dict) -> N
selections = [
("image_gen", provider.get("image_gen_plugin_name")),
("video_gen", provider.get("video_gen_plugin_name")),
- ("image_gen", "fal" if provider.get("imagegen_backend") and not managed_feature else None),
- ]
+ ("image_gen", "fal" if provider.get("imagegen_backend") and not managed_feature else None)]
for section_key, vendor in selections:
if vendor:
section = _cfg_section(config, section_key)
@@ -821,8 +809,7 @@ def _nous_provider_gate(provider: dict, config: dict, managed_feature, *, force_
if not ensure_nous_portal_access(
capability=f"{provider.get('name', 'the Nous Tool Gateway')}",
- coverage_category=MANAGED_FEATURE_COVERAGE_CATEGORY.get(managed_feature),
- ):
+ coverage_category=MANAGED_FEATURE_COVERAGE_CATEGORY.get(managed_feature)):
_print_warning(" Not enabled — Nous Portal access is required for this backend.")
return False
return True
@@ -832,8 +819,7 @@ def _nous_provider_gate(provider: dict, config: dict, managed_feature, *, force_
entitled = bool(features.account_info and features.account_info.paid_service_access is True)
if not features.nous_auth_present or not entitled:
message = format_nous_portal_entitlement_message(
- features.account_info, capability=f"{provider.get('name', 'Nous Subscription')}"
- )
+ features.account_info, capability=f"{provider.get('name', 'Nous Subscription')}")
_print_warning(f" {message or 'Nous Subscription is only available after logging into Nous Portal.'}")
return False
return True
@@ -1017,8 +1003,7 @@ def _configure_vision_backend() -> None:
"Auto — use your main model / aggregator fallback (recommended)",
"Pick a provider and model",
"Custom OpenAI-compatible endpoint — base URL, API key, model",
- "Skip",
- ]
+ "Skip"]
idx = _prompt_choice(" Configure vision backend", choices, 0)
config = load_config()
@@ -1087,8 +1072,7 @@ def _configure_vision_provider_model(config: dict, vision_cfg: dict) -> None:
if not providers:
_print_warning(
" No authenticated providers found. Configure a provider first "
- "with `hermes model`, then re-run this."
- )
+ "with `hermes model`, then re-run this.")
return
provider_labels = [label for _slug, label, _models in format_aux_picker_entries(
diff --git a/hermes_cli/toolset_validation.py b/hermes_cli/toolset_validation.py
index ed3c2ddcd8a..6b8a25905fe 100644
--- a/hermes_cli/toolset_validation.py
+++ b/hermes_cli/toolset_validation.py
@@ -15,8 +15,7 @@ def _platform_default_toolset(platform: object) -> str:
def _platform_default_is_valid(
platform: object, default_toolset: str, is_valid_toolset: Callable[[str], bool],
- is_allowed_for_platform: Callable[[str, str], bool],
-) -> bool:
+ is_allowed_for_platform: Callable[[str, str], bool]) -> bool:
if is_valid_toolset(default_toolset) and is_allowed_for_platform(default_toolset, str(platform)):
return True
# Dynamic plugin platforms are resolved by toolsets.resolve_toolset() even though their synthesized
@@ -64,8 +63,7 @@ def validate_platform_toolsets(
value_detail = f"invalid {type(raw).__name__} toolset value"
warnings.append(
f"platform '{platform}' has {value_detail} — "
- f"{fallback_detail}. Run `hermes tools` to configure explicitly."
- )
+ f"{fallback_detail}. Run `hermes tools` to configure explicitly.")
if platform_valid_count == 0:
warnings.append(f"platform '{platform}' has no valid toolsets configured — {_NO_TOOLS}")
continue
@@ -91,6 +89,5 @@ def validate_platform_toolsets(
if valid_count == 0:
warnings.append(
"platform_toolsets resolves to zero valid toolsets — the agent will "
- "have no tools. Run `hermes tools` to reconfigure."
- )
+ "have no tools. Run `hermes tools` to reconfigure.")
return warnings