Skip to content

The agent that grows with you

refactor(hermes_cli): compact data tables, docstrings and body blanks in status/setup slice

Tekniumf547fb64e5cf
diff --git a/hermes_cli/setup_summary.py b/hermes_cli/setup_summary.py
index 14e7d082fc2..8ad2fa90c91 100644
--- a/hermes_cli/setup_summary.py
+++ b/hermes_cli/setup_summary.py
@@ -1,8 +1,5 @@
-"""Setup-completion summary (tool availability + "Setup Complete!" banner).
-
-Names originating in setup.py are imported lazily inside function bodies so test patches on
-``hermes_cli.setup.<name>`` take effect.
-"""
+"""Setup-completion summary (tool availability + "Setup Complete!" banner). setup.py names are
+resolved through the module object so test patches on ``hermes_cli.setup.<name>`` take effect."""
import logging
@@ -13,17 +10,14 @@ logger = logging.getLogger("hermes_cli.setup")
_TTS_SUMMARY_ROWS = {
"elevenlabs": ("ElevenLabs", ("ELEVENLABS_API_KEY",)),
"openai": ("OpenAI", ("VOICE_TOOLS_OPENAI_KEY", "OPENAI_API_KEY")),
- "minimax": ("MiniMax", ("MINIMAX_API_KEY",)),
- "mistral": ("Mistral Voxtral", ("MISTRAL_API_KEY",)),
+ "minimax": ("MiniMax", ("MINIMAX_API_KEY",)), "mistral": ("Mistral Voxtral", ("MISTRAL_API_KEY",)),
"gemini": ("Google Gemini", ("GEMINI_API_KEY", "GOOGLE_API_KEY")),
"neutts": ("NeuTTS", "neutts", "run 'hermes setup tts'"),
"kittentts": ("KittenTTS", "kittentts", "run 'hermes setup tts'")}
_TTS_SUMMARY_DEFAULT = ("Edge TTS", ())
_STT_SUMMARY_ROWS = {
- "openai": ("OpenAI", ("VOICE_TOOLS_OPENAI_KEY", "OPENAI_API_KEY")),
- "groq": ("Groq Whisper", ("GROQ_API_KEY",)),
- "elevenlabs": ("ElevenLabs Scribe", ("ELEVENLABS_API_KEY",)),
- "xai": ("xAI", ()),
+ "openai": ("OpenAI", ("VOICE_TOOLS_OPENAI_KEY", "OPENAI_API_KEY")), "groq": ("Groq Whisper", ("GROQ_API_KEY",)),
+ "elevenlabs": ("ElevenLabs Scribe", ("ELEVENLABS_API_KEY",)), "xai": ("xAI", ()),
"deepinfra": ("DeepInfra", ("DEEPINFRA_API_KEY",))}
_STT_SUMMARY_DEFAULT = ("Local Whisper", "faster_whisper", "run 'hermes tools' → Speech-to-Text")
@@ -43,14 +37,11 @@ _DONE_BANNER = (
"└─────────────────────────────────────────────────────────┘")
# (command, description) rows; the description carries its own alignment padding.
_EDIT_WIZARD_ROWS = (
- ("hermes setup", " Re-run the full wizard"),
- ("hermes setup model", " Change model/provider"),
- ("hermes setup terminal", " Change terminal backend"),
- ("hermes setup gateway", " Configure messaging"),
+ ("hermes setup", " Re-run the full wizard"), ("hermes setup model", " Change model/provider"),
+ ("hermes setup terminal", " Change terminal backend"), ("hermes setup gateway", " Configure messaging"),
("hermes setup tools", " Configure tool providers"))
_EDIT_CONFIG_ROWS = (
- ("hermes config", " View current settings"),
- ("hermes config edit", " Open config in your editor"),
+ ("hermes config", " View current settings"), ("hermes config edit", " Open config in your editor"),
("hermes config set <key> <value>", ""))
_READY_ROWS = (
("hermes", " Start chatting"), ("hermes gateway", " Start messaging gateway"),
@@ -246,11 +237,9 @@ def _print_setup_summary(config: dict, hermes_home):
available_count = sum(1 for _, avail, _ in tool_status if avail)
_setup._info(f"{available_count}/{len(tool_status)} tool categories available:", None)
for name, available, missing_var in tool_status:
- if available:
- print(f" {_setup.color('✓', _setup.Colors.GREEN)} {name}")
- else:
- print(f" {_setup.color('✗', _setup.Colors.RED)} {name} "
- f"{_setup.color(f'(missing {missing_var})', _setup.Colors.DIM)}")
+ print(f" {_setup.color('✓', _setup.Colors.GREEN)} {name}" if available else
+ f" {_setup.color('✗', _setup.Colors.RED)} {name} "
+ f"{_setup.color(f'(missing {missing_var})', _setup.Colors.DIM)}")
print()
if available_count < len(tool_status):
diff --git a/hermes_cli/setup_terminal.py b/hermes_cli/setup_terminal.py
index 8b136a4273f..7ec7b268f8e 100644
--- a/hermes_cli/setup_terminal.py
+++ b/hermes_cli/setup_terminal.py
@@ -1,8 +1,6 @@
"""Terminal-backend setup wizard (local/docker/singularity/modal/daytona/vercel/ssh/plugin).
-
-Names from setup.py are imported lazily inside bodies so test patches on
-``hermes_cli.setup.<name>`` take effect; setup.py re-exports the public entry points.
-"""
+setup.py names are resolved through the module object so test patches on ``hermes_cli.setup.<name>``
+take effect; setup.py re-exports the public entry points."""
import json
import logging
@@ -21,8 +19,7 @@ def _prompt_vercel_sandbox_settings(config: dict):
"""Prompt for Vercel Sandbox settings without exposing unsupported disk sizing."""
terminal = config.setdefault("terminal", {})
_setup._info(None, "Vercel Sandbox settings:", " Filesystem persistence uses Vercel snapshots.",
- " Snapshots restore files only; live processes do not continue after sandbox recreation.")
-
+ " Snapshots restore files only; live processes do not continue after sandbox recreation.")
from tools.terminal_tool import _SUPPORTED_VERCEL_RUNTIMES
current_runtime = terminal.get("vercel_runtime") or "node24"
supported_label = ", ".join(_SUPPORTED_VERCEL_RUNTIMES)
@@ -32,7 +29,6 @@ def _prompt_vercel_sandbox_settings(config: dict):
runtime = current_runtime if current_runtime in _SUPPORTED_VERCEL_RUNTIMES else "node24"
terminal["vercel_runtime"] = runtime
_setup.save_env_value("TERMINAL_VERCEL_RUNTIME", runtime)
-
persist_label = "yes" if terminal.get("container_persistent", True) else "no"
persist = _setup.prompt(" Persist filesystem with snapshots? (yes/no)", persist_label).lower()
terminal["container_persistent"] = persist in {"yes", "true", "y", "1"}
@@ -48,7 +44,6 @@ def _prompt_vercel_sandbox_settings(config: dict):
_setup.print_warning(
"Vercel Sandbox does not support custom disk sizing; resetting container_disk to 51200.")
terminal["container_disk"] = 51200
-
_setup._info(None, "Vercel authentication:", " Use a long-lived Vercel access token plus project/team IDs.")
linked = _read_nearest_vercel_project()
if linked:
@@ -153,9 +148,9 @@ def _setup_backend_docker(config: dict) -> None:
# Image and resource limits use defaults; tune via `hermes setup terminal`.
config["terminal"].setdefault("docker_image", _SANDBOX_IMAGE)
_setup._info(None, "Docker sandboxes can be protected with the egress credential firewall.",
- "It routes sandbox traffic through iron-proxy so containers receive "
- "proxy tokens instead of real API keys.",
- " Docker only for now; Modal, SSH, Daytona, and Singularity are not wired yet.")
+ "It routes sandbox traffic through iron-proxy so containers receive "
+ "proxy tokens instead of real API keys.",
+ " Docker only for now; Modal, SSH, Daytona, and Singularity are not wired yet.")
if _setup.prompt_yes_no(" Enable egress firewall for Docker sandboxes?", False):
proxy_cfg = config.setdefault("proxy", {})
proxy_cfg["enabled"] = True
@@ -192,7 +187,6 @@ def _setup_backend_modal(config: dict) -> None:
use_managed_modal = _setup.prompt_choice(
"Select how Modal execution should be billed:",
["Use my Nous subscription", "Use my own Modal account"], default_idx) == 0
-
if use_managed_modal:
config["terminal"]["modal_mode"] = "managed"
_setup.print_info("Modal execution will use the managed Nous gateway and bill to your subscription.")
@@ -200,7 +194,6 @@ def _setup_backend_modal(config: dict) -> None:
_setup.print_info(
"Direct Modal credentials are still configured, but this backend is pinned to managed mode.")
return
-
config["terminal"]["modal_mode"] = "direct"
_setup.print_info("Requires a Modal account: https://modal.com")
_ensure_sdk("modal", "uv pip install modal")
@@ -214,20 +207,21 @@ def _setup_backend_modal(config: dict) -> None:
def _setup_backend_daytona(config: dict) -> None:
_setup.print_success("Terminal backend: Daytona")
_setup._info("Persistent cloud development environments.",
- "Each session gets a dedicated sandbox with filesystem persistence.",
- "Sign up at: https://daytona.io")
+ "Each session gets a dedicated sandbox with filesystem persistence.",
+ "Sign up at: https://daytona.io")
_ensure_sdk("daytona", "uv pip install daytona", show_stderr=True)
print()
had_key = bool(_setup.get_env_value("DAYTONA_API_KEY"))
if not _existing_secret_keeps("DAYTONA_API_KEY", "Daytona API key", " Update API key?"):
- _prompt_secret_env(" Daytona API key", "DAYTONA_API_KEY", confirm_msg=" Updated" if had_key else " Configured")
+ _prompt_secret_env(" Daytona API key", "DAYTONA_API_KEY",
+ confirm_msg=" Updated" if had_key else " Configured")
config["terminal"].setdefault("daytona_image", _SANDBOX_IMAGE)
def _setup_backend_vercel(config: dict) -> None:
_setup.print_success("Terminal backend: Vercel Sandbox")
_setup._info("Cloud microVM sandboxes with snapshot-backed filesystem persistence.",
- "Requires the optional SDK: pip install 'hermes-agent[vercel]'")
+ "Requires the optional SDK: pip install 'hermes-agent[vercel]'")
_ensure_sdk("vercel", "pip install 'hermes-agent[vercel]'", show_stderr=True, install=_pip_install_vercel)
_prompt_vercel_sandbox_settings(config)
@@ -235,7 +229,6 @@ def _setup_backend_vercel(config: dict) -> None:
def _setup_backend_ssh(config: dict) -> None:
_setup.print_success("Terminal backend: SSH")
_setup.print_info("Run commands on a remote machine via SSH.")
-
# (label, env var, fallback default when .env is empty); the port is only saved when not 22.
fields = (
(" SSH host (hostname or IP)", "TERMINAL_SSH_HOST", ""),
@@ -249,7 +242,6 @@ def _setup_backend_ssh(config: dict) -> None:
if value and (env_var != "TERMINAL_SSH_PORT" or value != "22"):
_setup.save_env_value(env_var, value)
host, user, port, ssh_key = values
-
if host and _setup.prompt_yes_no(" Test SSH connection?", True):
_setup.print_info(" Testing connection...")
import subprocess
@@ -297,14 +289,12 @@ def setup_terminal_backend(config: dict):
import platform as _platform
_setup.print_header("Terminal Backend")
_setup._info("Choose where Hermes runs shell commands and code.",
- "This affects tool execution, file access, and isolation.",
- f" Guide: {_setup._DOCS_BASE}/user-guide/configuration#terminal-backend-configuration", None)
-
+ "This affects tool execution, file access, and isolation.",
+ f" Guide: {_setup._DOCS_BASE}/user-guide/configuration#terminal-backend-configuration", None)
current_backend = _setup.cfg_get(config, "terminal", "backend", default="local")
backends = list(_BUILTIN_TERMINAL_BACKENDS)
if _platform.system() == "Linux":
backends.append(("singularity", "Singularity/Apptainer - HPC-friendly container"))
-
# Plugin-registered backends (~/.hermes/plugins/). Fail-soft: a broken plugin must not take
# the wizard down.
plugin_backend_names = []
@@ -318,14 +308,12 @@ def setup_terminal_backend(config: dict):
plugin_backend_names.append(pname)
except Exception:
pass
-
terminal_choices = [label for _, label in backends] + [f"Keep current ({current_backend})"]
terminal_idx = _setup.prompt_choice("Select terminal backend:", terminal_choices, len(backends))
if terminal_idx == len(backends):
_setup.print_info(f"Keeping current backend: {current_backend}")
return
selected_backend = backends[terminal_idx][0] if 0 <= terminal_idx < len(backends) else None
-
config.setdefault("terminal", {})["backend"] = selected_backend
# Plugin names shadow only the ssh built-in (dispatch order of the original chain).
handler = _TERMINAL_BACKEND_SETUP.get(selected_backend)
@@ -333,7 +321,6 @@ def setup_terminal_backend(config: dict):
handler(config)
elif selected_backend in plugin_backend_names:
_setup_backend_plugin(config, selected_backend)
-
_setup.save_env_value("TERMINAL_ENV", selected_backend)
if selected_backend in _BACKEND_ENV_MIRROR:
env_var, key, default = _BACKEND_ENV_MIRROR[selected_backend]
diff --git a/hermes_cli/setup_tts.py b/hermes_cli/setup_tts.py
index 598ab78de48..d914323f3f3 100644
--- a/hermes_cli/setup_tts.py
+++ b/hermes_cli/setup_tts.py
@@ -1,8 +1,6 @@
"""Text-to-speech provider setup (provider picker, API-key prompts, local engine installs, xAI OAuth).
-
-Names from setup.py are imported lazily inside bodies so test patches on
-``hermes_cli.setup.<name>`` take effect; setup.py re-exports the public entry points.
-"""
+setup.py names are resolved through the module object so test patches on ``hermes_cli.setup.<name>``
+take effect; setup.py re-exports the public entry points."""
import logging
import shutil
@@ -81,11 +79,9 @@ def _xai_oauth_logged_in_for_setup() -> bool:
def _run_xai_oauth_login_from_setup() -> bool:
- """Run the xAI Grok OAuth device-code login from inside the setup wizard.
-
- Saves OAuth tokens only — does **not** switch the active provider or rewrite ``model.provider``
- (callers only need credentials for side tools). False on any failure (caller falls back).
- """
+ """Run the xAI Grok OAuth device-code login from inside the setup wizard. Saves OAuth tokens
+ only — does **not** switch the active provider or rewrite ``model.provider`` (callers only need
+ credentials for side tools). False on any failure (caller falls back)."""
try:
from hermes_cli.auth import (
_is_remote_session, _save_xai_oauth_tokens, _xai_oauth_device_code_login,
@@ -93,11 +89,9 @@ def _run_xai_oauth_login_from_setup() -> bool:
except Exception as exc:
_setup.print_warning(f"xAI Grok OAuth helpers unavailable: {exc}")
return False
-
- open_browser = not _is_remote_session()
_setup._info(None, "Signing in to xAI Grok OAuth (SuperGrok / Premium+)...")
try:
- creds = _xai_oauth_device_code_login(open_browser=open_browser)
+ creds = _xai_oauth_device_code_login(open_browser=not _is_remote_session())
_save_xai_oauth_tokens(
creds["tokens"], discovery=creds.get("discovery"), redirect_uri=creds.get("redirect_uri", ""),
last_refresh=creds.get("last_refresh"), auth_mode="oauth_device_code", set_active=False)
@@ -213,15 +207,13 @@ def _tts_xai_step(config: dict) -> str:
choice_idx = _setup.prompt_choice(
"How do you want xAI TTS to authenticate?",
choices=["Sign in with xAI Grok OAuth (SuperGrok / Premium+) — browser login",
- "Paste an xAI API key (console.x.ai)", "Skip → fallback to Edge TTS"],
- default=0)
+ "Paste an xAI API key (console.x.ai)", "Skip → fallback to Edge TTS"], default=0)
# Each path returns the fallback warning (result is then "edge") or None on success.
fallback = (_xai_oauth_path, _xai_api_key_path, lambda: "xAI TTS skipped. Falling back to Edge TTS.")[
choice_idx if choice_idx in (0, 1) else 2]()
if fallback:
_setup.print_warning(fallback)
return "edge"
-
print()
voice_id = (_setup.prompt("xAI voice_id (Enter for 'eve', or paste a custom voice ID)") or "").strip()
if voice_id:
@@ -234,11 +226,9 @@ def _setup_tts_provider(config: dict):
"""Interactive TTS provider selection with install flow for local engines."""
current_provider = config.get("tts", {}).get("provider", "edge")
current_label = _TTS_PROVIDER_LABELS.get(current_provider, current_provider)
-
print()
_setup.print_header("Text-to-Speech Provider (optional)")
_setup._info(f"Current: {current_label}", None)
-
options = list(_TTS_PROVIDER_CHOICES)
if _setup.managed_nous_tools_enabled() and _setup.get_nous_subscription_features(config).nous_auth_present:
options.insert(0, ("nous-openai",
@@ -248,7 +238,6 @@ def _setup_tts_provider(config: dict):
idx = _setup.prompt_choice("Select TTS provider:", choices, keep_current_idx)
if idx == keep_current_idx:
return
-
selected = options[idx][0]
if selected == "nous-openai":
selected = "openai"
@@ -262,7 +251,6 @@ def _setup_tts_provider(config: dict):
selected = _tts_api_key_step(selected)
elif selected == "xai":
selected = _tts_xai_step(config)
-
config.setdefault("tts", {})["provider"] = selected
_setup.save_config(config)
_setup.print_success(f"TTS provider set to: {_TTS_PROVIDER_LABELS.get(selected, selected)}")
diff --git a/hermes_cli/setup_whatsapp_cloud.py b/hermes_cli/setup_whatsapp_cloud.py
index 21d48f5204a..d3c8da3e7dc 100644
--- a/hermes_cli/setup_whatsapp_cloud.py
+++ b/hermes_cli/setup_whatsapp_cloud.py
@@ -1,12 +1,9 @@
-"""Interactive setup wizard for the WhatsApp Cloud API adapter.
+"""Interactive setup wizard for the WhatsApp Cloud API adapter: the 6 Meta credentials + recipient
+allowlist, an auto-generated verify token, and exact follow-up instructions for what can't happen
+inside the wizard process (cloudflared, gateway, Meta's webhook dashboard, recipient list).
-Walks the user through the 6 credentials Meta requires + recipient allowlist, auto-generates the
-verify token, and prints exact follow-up instructions for the parts that can't happen inside the
-wizard process (cloudflared, gateway, Meta's webhook dashboard, recipient list).
-
-The wizard intentionally does NOT smoke-test the webhook: the gateway and the tunnel both run in
-separate processes the user starts AFTER this wizard exits, so any in-wizard probe would fail.
-"""
+Intentionally does NOT smoke-test the webhook: the gateway and the tunnel both run in separate
+processes the user starts AFTER this wizard exits, so any in-wizard probe would fail."""
from __future__ import annotations
from hermes_cli.cli_output import line_input
@@ -99,7 +96,6 @@ def _prompt(message: str, default: Optional[str] = None, secret: bool = False) -
suffix = f" [{default}]" if default else ""
if secret and sys.stdin.isatty():
import getpass
-
return getpass.getpass(f"{message}{suffix} (input hidden): ").strip()
return line_input(f"{message}{suffix}: ").strip()
except (EOFError, KeyboardInterrupt):
@@ -127,11 +123,10 @@ def _prompt_validated(
print(f" ✗ {reason}")
if attempts >= 3:
try:
- cont = input(" Try again, or press Enter to skip: ").strip()
+ if not input(" Try again, or press Enter to skip: ").strip():
+ return None
except (EOFError, KeyboardInterrupt):
return None
- if not cont:
- return None
attempts = 0
diff --git a/hermes_cli/status.py b/hermes_cli/status.py
index 6d304981551..fd0eeea74a2 100644
--- a/hermes_cli/status.py
+++ b/hermes_cli/status.py
@@ -83,9 +83,9 @@ def _effective_provider_label() -> str:
# the legacy OPENAI_BASE_URL env var; either way labeling it "OpenRouter" is misleading.
try:
model_cfg = load_config().get("model")
- config_base_url = (model_cfg.get("base_url") or "").strip() if isinstance(model_cfg, dict) else ""
except Exception:
- config_base_url = ""
+ model_cfg = None
+ config_base_url = (model_cfg.get("base_url") or "").strip() if isinstance(model_cfg, dict) else ""
if config_base_url or get_env_value("OPENAI_BASE_URL"):
effective = "custom"
return provider_label(effective)
@@ -115,19 +115,13 @@ _TERMINAL_ENV_ROWS = {
_PLATFORMS = { # name -> (token env var, home-channel env var or None)
"Telegram": ("TELEGRAM_BOT_TOKEN", "TELEGRAM_HOME_CHANNEL"),
- "Discord": ("DISCORD_BOT_TOKEN", "DISCORD_HOME_CHANNEL"),
- "WhatsApp": ("WHATSAPP_ENABLED", None),
+ "Discord": ("DISCORD_BOT_TOKEN", "DISCORD_HOME_CHANNEL"), "WhatsApp": ("WHATSAPP_ENABLED", None),
"Signal": ("SIGNAL_HTTP_URL", "SIGNAL_HOME_CHANNEL"),
- "Slack": ("SLACK_BOT_TOKEN", None),
- "Email": ("EMAIL_ADDRESS", "EMAIL_HOME_ADDRESS"),
- "SMS": ("TWILIO_ACCOUNT_SID", "SMS_HOME_CHANNEL"),
- "DingTalk": ("DINGTALK_CLIENT_ID", None),
- "Feishu": ("FEISHU_APP_ID", "FEISHU_HOME_CHANNEL"),
- "WeCom": ("WECOM_BOT_ID", "WECOM_HOME_CHANNEL"),
- "WeCom Callback": ("WECOM_CALLBACK_CORP_ID", None),
- "Weixin": ("WEIXIN_ACCOUNT_ID", "WEIXIN_HOME_CHANNEL"),
- "BlueBubbles": ("BLUEBUBBLES_SERVER_URL", "BLUEBUBBLES_HOME_CHANNEL"),
- "QQBot": ("QQ_APP_ID", "QQ_HOME_CHANNEL"),
+ "Slack": ("SLACK_BOT_TOKEN", None), "Email": ("EMAIL_ADDRESS", "EMAIL_HOME_ADDRESS"),
+ "SMS": ("TWILIO_ACCOUNT_SID", "SMS_HOME_CHANNEL"), "DingTalk": ("DINGTALK_CLIENT_ID", None),
+ "Feishu": ("FEISHU_APP_ID", "FEISHU_HOME_CHANNEL"), "WeCom": ("WECOM_BOT_ID", "WECOM_HOME_CHANNEL"),
+ "WeCom Callback": ("WECOM_CALLBACK_CORP_ID", None), "Weixin": ("WEIXIN_ACCOUNT_ID", "WEIXIN_HOME_CHANNEL"),
+ "BlueBubbles": ("BLUEBUBBLES_SERVER_URL", "BLUEBUBBLES_HOME_CHANNEL"), "QQBot": ("QQ_APP_ID", "QQ_HOME_CHANNEL"),
"Yuanbao": ("YUANBAO_APP_ID", "YUANBAO_HOME_CHANNEL")}
# Gateway manager label when the runtime snapshot is unavailable, keyed by platform.
@@ -169,7 +163,6 @@ def _render_terminal(ctx):
terminal_cfg = ctx.config.get("terminal", {}) if isinstance(ctx.config.get("terminal"), dict) else {}
terminal_env = os.getenv("TERMINAL_ENV", "") or terminal_cfg.get("backend", "local")
_kv("Backend:", terminal_env)
-
if terminal_env in _TERMINAL_ENV_ROWS:
for label, var, default, empty_is_unset in _TERMINAL_ENV_ROWS[terminal_env]:
value = (os.getenv(var, "") or default) if empty_is_unset else os.getenv(var, default)
@@ -200,7 +193,6 @@ def _render_terminal(ctx):
print(f" {label}: {check_mark(bool(ok))} {text}")
except Exception:
pass
-
_kv_flag("Sudo:", os.getenv("SUDO_PASSWORD", ""), "enabled", "disabled")
@@ -229,7 +221,6 @@ def _render_gateway(ctx):
_section("Gateway Service")
try:
from hermes_cli.gateway import get_gateway_runtime_snapshot, _format_gateway_pids
-
snapshot = get_gateway_runtime_snapshot()
_kv_flag("Status:", snapshot.running, "running", "stopped")
_kv("Manager:", snapshot.manager)
diff --git a/hermes_cli/status_auth.py b/hermes_cli/status_auth.py
index 31abc97f417..44e875eca16 100644
--- a/hermes_cli/status_auth.py
+++ b/hermes_cli/status_auth.py
@@ -1,7 +1,6 @@
-"""Credential sections of `hermes status` (API keys, OAuth providers, Nous Tool Gateway, API-key
-providers), run through ``status._SECTIONS`` with the shared ``_StatusContext``. Origin helpers
-(``_row``, ``_first_env_value``, ...) are imported lazily from ``hermes_cli.status`` so tests that
-monkeypatch that module keep working."""
+"""Credential sections of `hermes status`, run through ``status._SECTIONS`` with its shared context.
+Origin helpers (``_row``, ``_first_env_value``, ...) are resolved through the ``hermes_cli.status``
+module object so tests that monkeypatch that module keep working."""
from hermes_cli.auth import AuthError
from hermes_cli.nous_account import (
@@ -46,26 +45,15 @@ def _oauth_block(name: str, status: dict, hint: str, rows) -> None:
# Values may be a single env var name (str) or a tuple of alternates (first found wins).
_API_KEYS: dict[str, str | tuple[str, ...]] = {
- "OpenRouter": "OPENROUTER_API_KEY",
- "OpenAI": "OPENAI_API_KEY",
- "Google / Gemini": ("GOOGLE_API_KEY", "GEMINI_API_KEY"),
- "DeepSeek": "DEEPSEEK_API_KEY",
- "xAI / Grok": "XAI_API_KEY",
- "NVIDIA NIM": "NVIDIA_API_KEY",
- "Z.AI / GLM": "GLM_API_KEY",
- "Kimi": "KIMI_API_KEY",
- "StepFun Step Plan": "STEPFUN_API_KEY",
- "MiniMax": "MINIMAX_API_KEY",
- "MiniMax-CN": "MINIMAX_CN_API_KEY",
- "DeepInfra": "DEEPINFRA_API_KEY",
- "Firecrawl": "FIRECRAWL_API_KEY",
- "Tavily": "TAVILY_API_KEY",
- "Keenable": "KEENABLE_API_KEY",
+ "OpenRouter": "OPENROUTER_API_KEY", "OpenAI": "OPENAI_API_KEY",
+ "Google / Gemini": ("GOOGLE_API_KEY", "GEMINI_API_KEY"), "DeepSeek": "DEEPSEEK_API_KEY",
+ "xAI / Grok": "XAI_API_KEY", "NVIDIA NIM": "NVIDIA_API_KEY", "Z.AI / GLM": "GLM_API_KEY",
+ "Kimi": "KIMI_API_KEY", "StepFun Step Plan": "STEPFUN_API_KEY", "MiniMax": "MINIMAX_API_KEY",
+ "MiniMax-CN": "MINIMAX_CN_API_KEY", "DeepInfra": "DEEPINFRA_API_KEY", "Firecrawl": "FIRECRAWL_API_KEY",
+ "Tavily": "TAVILY_API_KEY", "Keenable": "KEENABLE_API_KEY",
"Browser Use": "BROWSER_USE_API_KEY", # Optional — local browser works without this
"Browserbase": "BROWSERBASE_API_KEY", # Optional — direct credentials only
- "FAL": "FAL_KEY",
- "ElevenLabs": "ELEVENLABS_API_KEY",
- "GitHub": "GITHUB_TOKEN"}
+ "FAL": "FAL_KEY", "ElevenLabs": "ELEVENLABS_API_KEY", "GitHub": "GITHUB_TOKEN"}
# OAuth detail rows: (label, status key, formatter, gate) — see _oauth_block.
_FILE_REFRESH_ROWS = (
@@ -86,12 +74,9 @@ _OAUTH_BLOCKS = (
("xAI OAuth", "get_xai_oauth_auth_status", "hermes auth add xai-oauth", _FILE_REFRESH_ROWS))
_APIKEY_PROVIDERS = {
- "Z.AI / GLM": ("GLM_API_KEY", "ZAI_API_KEY", "Z_AI_API_KEY"),
- "Kimi / Moonshot": ("KIMI_API_KEY",),
- "StepFun Step Plan": ("STEPFUN_API_KEY",),
- "MiniMax": ("MINIMAX_API_KEY",),
- "MiniMax (China)": ("MINIMAX_CN_API_KEY",),
- "DeepInfra": ("DEEPINFRA_API_KEY",)}
+ "Z.AI / GLM": ("GLM_API_KEY", "ZAI_API_KEY", "Z_AI_API_KEY"), "Kimi / Moonshot": ("KIMI_API_KEY",),
+ "StepFun Step Plan": ("STEPFUN_API_KEY",), "MiniMax": ("MINIMAX_API_KEY",),
+ "MiniMax (China)": ("MINIMAX_CN_API_KEY",), "DeepInfra": ("DEEPINFRA_API_KEY",)}
# Nous Tool Gateway per-feature state: first matching (predicate(feature, nous_auth), text(feature)).
diff --git a/hermes_cli/telegram_managed_bot.py b/hermes_cli/telegram_managed_bot.py
index e1e248f925c..3d8099748e0 100644
--- a/hermes_cli/telegram_managed_bot.py
+++ b/hermes_cli/telegram_managed_bot.py
@@ -135,9 +135,8 @@ def poll_pairing_result_once(
return None
bot_username = data.get("bot_username")
return TelegramBotSetupResult(
- token=token,
- bot_username=bot_username if isinstance(bot_username, str) and bot_username else None,
- owner_user_id=_parse_owner_user_id(data.get("owner_user_id")))
+ token, bot_username if isinstance(bot_username, str) and bot_username else None,
+ _parse_owner_user_id(data.get("owner_user_id")))
def _try_poll(api_url: str | None, pairing: TelegramPairing) -> TelegramBotSetupResult | None:
@@ -169,10 +168,9 @@ def auto_setup_telegram_bot_result(
profile_name: Optional[str] = None, poll_timeout: float = DEFAULT_POLL_TIMEOUT,
) -> Optional[TelegramBotSetupResult]:
"""Run the full automatic Telegram bot creation flow."""
- _ = manager_bot, profile_name
+ _ = manager_bot, profile_name # accepted for callers; the service decides both
resolved_api_url = _api_url(api_url)
- print()
- print(f" Contacting Hermes Telegram onboarding service: {resolved_api_url}")
+ print(f"\n Contacting Hermes Telegram onboarding service: {resolved_api_url}")
sys.stdout.flush()
pairing = create_pairing(resolved_api_url)
if not pairing:
@@ -180,8 +178,7 @@ def auto_setup_telegram_bot_result(
" Try the manual setup instead, or check your network.")
return None
- print(" ✓ Pairing created")
- print(" Rendering QR code...")
+ print(" ✓ Pairing created\n Rendering QR code...")
sys.stdout.flush()
print("\n Scan this QR code with your phone, or open the link below:\n")
print_qr_code(pairing.qr_payload, include_link=False)