The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(hermes_cli): compact setup-flow docstrings/comments; fold env-ref identity indexing
Teknium31bc234a6668
diff --git a/hermes_cli/main_platform_setup.py b/hermes_cli/main_platform_setup.pyindex 66312227f0b..1c521d7583b 100644--- a/hermes_cli/main_platform_setup.py+++ b/hermes_cli/main_platform_setup.py@@ -1,10 +1,8 @@"""Interactive messaging-platform setup wizards: WhatsApp (bridge + Cloud API), Slack manifest,Skill Sync.-Split out of ``hermes_cli/main.py``; every moved name is re-imported there, so-``hermes_cli.main.<name>`` keeps resolving (and monkeypatching). Names that stay in main are-imported lazily inside the functions that use them (call-time resolution keeps-``hermes_cli.main.<name>`` patches effective and avoids an import cycle).+Split out of ``hermes_cli/main.py``, which re-imports every name (``hermes_cli.main.<name>`` keeps+resolving and monkeypatching). Names that stay in main are imported lazily at call time."""import contextlib@@ -137,11 +135,10 @@ def cmd_whatsapp(args):if wa_mode is None:return- # WHATSAPP_ENABLED=true is deliberately NOT written here. An aborted wizard (Ctrl+C,- # failed npm install, missed QR scan) would otherwise leave .env claiming WhatsApp is- # ready with no creds.json, and every `hermes gateway` would pay a 30s bridge-bootstrap- # timeout and queue WhatsApp for indefinite retries. It is set only after pairing- # succeeds; prior successful pairings stay enabled.+ # WHATSAPP_ENABLED=true is deliberately NOT written here: an aborted wizard (Ctrl+C, failed npm+ # install, missed QR scan) would leave .env claiming WhatsApp is ready with no creds.json, and+ # every `hermes gateway` would pay a 30s bridge timeout + indefinite retries. Set only after+ # pairing succeeds; prior successful pairings stay enabled.print()if (get_env_value("WHATSAPP_ENABLED") or "").lower() == "true":print("✓ WhatsApp is already enabled")@@ -207,11 +204,8 @@ def cmd_whatsapp(args):def cmd_whatsapp_cloud(args):- """Set up WhatsApp Business Cloud API (official Meta integration).-- Distinct from ``hermes whatsapp`` (the Baileys bridge wizard) — the two adapters are- complementary. See ``hermes_cli/setup_whatsapp_cloud.py``.- """+ """Set up WhatsApp Business Cloud API (official Meta integration) — complementary to the+ ``hermes whatsapp`` Baileys bridge wizard. See ``hermes_cli/setup_whatsapp_cloud.py``."""from hermes_cli.main import _require_tty_require_tty("whatsapp-cloud")from hermes_cli.setup_whatsapp_cloud import run_whatsapp_cloud_setupdiff --git a/hermes_cli/main_provider_setup.py b/hermes_cli/main_provider_setup.pyindex 909e8a9e5d2..632377dde83 100644--- a/hermes_cli/main_provider_setup.py+++ b/hermes_cli/main_provider_setup.py@@ -1,10 +1,8 @@"""Provider setup wizard helpers: provider picker, custom-provider save/remove, auxiliary-modelrouting menu, API-key/reasoning prompts, Anthropic OAuth.-Split out of ``hermes_cli/main.py``; every moved name is re-imported there, so-``hermes_cli.main.<name>`` keeps resolving (and monkeypatching). Names that stay in main are-imported lazily inside the functions that use them (call-time resolution keeps-``hermes_cli.main.<name>`` patches effective and avoids an import cycle).+Split out of ``hermes_cli/main.py``, which re-imports every name (``hermes_cli.main.<name>`` keeps+resolving and monkeypatching). Names that stay in main are imported lazily at call time."""import contextlib@@ -37,11 +35,8 @@ def _short_url(url: str) -> str:def _clear_stale_openai_base_url():- """Remove OPENAI_BASE_URL from ~/.hermes/.env unless the active provider is 'custom'.-- A leftover OPENAI_BASE_URL after a provider switch routes provider:auto auxiliary- clients (compression, vision, delegation) to the old custom endpoint.- """+ """Remove OPENAI_BASE_URL from ~/.hermes/.env unless the active provider is 'custom' — a+ leftover value routes provider:auto auxiliary clients to the old custom endpoint."""from hermes_cli.config import get_env_value, save_env_value, load_configmodel_cfg = load_config().get("model", {})provider = (model_cfg.get("provider") or "").strip().lower() if isinstance(model_cfg, dict) else ""@@ -136,9 +131,8 @@ def _aux_task_display_name(task: str) -> str:def _save_aux_choice(task: str, *, provider: str, model: str = "", base_url: str = "",api_key: str = "") -> None:- """Persist an aux task's four routing fields to config.yaml (timeout etc. untouched; the main- model config never modified). ``delegation`` writes the top-level section, with "auto"- stored as an empty provider."""+ """Persist an aux task's four routing fields (timeout etc. untouched; main model config never+ modified). ``delegation`` writes the top-level section, with "auto" stored as an empty provider."""from hermes_cli.config import load_config, save_configcfg = load_config()if task == _DELEGATION_TASK_KEY:@@ -224,11 +218,8 @@ def _aux_config_menu() -> None:def _aux_select_for_task(task: str) -> None:- """Pick a provider + model for one aux task and persist it.-- Rows come from ``build_aux_picker_rows()`` (the shared aux-picker substrate), so only- already-configured providers appear; new ones are set up via ``hermes model`` first.- """+ """Pick a provider + model for one aux task and persist it. Rows come from+ ``build_aux_picker_rows()`` (shared substrate): only already-configured providers appear."""from hermes_cli.main import _prompt_provider_choicefrom hermes_cli.config import load_configfrom hermes_cli.inventory import build_aux_picker_rows, format_aux_picker_entries@@ -445,13 +436,9 @@ def _custom_provider_base_url_config_value(provider_info, resolved_base_url=""):def _save_custom_provider(base_url, api_key="", model="", context_length=None, name=None, api_mode=None,key_env=""):- """Save a custom endpoint to ``custom_providers`` in config.yaml.-- Deduplicates by base_url: an existing entry gets its model / context_length / api_mode- updated instead of a duplicate. *name* defaults to ``_auto_provider_name``. When *key_env*- is set the caller already wrote the key to ``.env``, so the entry references it instead- of inlining the secret.- """+ """Save a custom endpoint to ``custom_providers`` in config.yaml, deduplicated by base_url (an+ existing entry gets model / context_length / api_mode updated). *key_env* set means the caller+ already wrote the key to ``.env``; the entry references it instead of inlining the secret."""from hermes_cli.config import load_config, save_configcfg = load_config()providers = cfg.get("custom_providers") or []@@ -459,33 +446,34 @@ def _save_custom_provider(base_url, api_key="", model="", context_length=None, nproviders = []for entry in providers:- if isinstance(entry, dict) and entry.get("base_url", "").rstrip("/") == base_url.rstrip("/"):- changed = False- if model and entry.get("model") != model:- entry["model"] = model- changed = True- if model and context_length:- models_cfg = entry.get("models", {})- if not isinstance(models_cfg, dict):- models_cfg = {}- models_cfg[model] = {"context_length": context_length}- entry["models"] = models_cfg- changed = True- if api_mode:- if entry.get("api_mode") != api_mode:- entry["api_mode"] = api_mode- changed = True- elif "api_mode" in entry:- entry.pop("api_mode", None)- changed = True- if key_env and (entry.get("key_env") != key_env or entry.get("api_key")):- entry["key_env"] = key_env- entry.pop("api_key", None)+ if not (isinstance(entry, dict) and entry.get("base_url", "").rstrip("/") == base_url.rstrip("/")):+ continue+ changed = False+ if model and entry.get("model") != model:+ entry["model"] = model+ changed = True+ if model and context_length:+ models_cfg = entry.get("models", {})+ if not isinstance(models_cfg, dict):+ models_cfg = {}+ models_cfg[model] = {"context_length": context_length}+ entry["models"] = models_cfg+ changed = True+ if api_mode:+ if entry.get("api_mode") != api_mode:+ entry["api_mode"] = api_modechanged = True- if changed:- cfg["custom_providers"] = providers- save_config(cfg)- return # already saved, updated if needed+ elif "api_mode" in entry:+ entry.pop("api_mode", None)+ changed = True+ if key_env and (entry.get("key_env") != key_env or entry.get("api_key")):+ entry["key_env"] = key_env+ entry.pop("api_key", None)+ changed = True+ if changed:+ cfg["custom_providers"] = providers+ save_config(cfg)+ return # already saved, updated if neededif not name:name = _auto_provider_name(base_url)@@ -592,12 +580,9 @@ def _prompt_reasoning_effort_selection(efforts, current_effort=""):def _prompt_api_key(pconfig, existing_key: str, provider_id: str = "", existing_source: str = "") -> tuple:- """Shared API-key entry point for ``hermes setup`` / ``hermes model``.-- First-time entry, or [K]eep / [R]eplace / [C]lear when a key is already present (so a- malformed paste is recoverable without editing ``~/.hermes/.env``). Returns- ``(resolved_key, abort)``; ``abort=True`` means the caller should ``return`` immediately.- """+ """API-key entry for ``hermes setup`` / ``hermes model``: first-time entry, or [K]eep / [R]eplace /+ [C]lear when a key exists (a malformed paste is recoverable without editing ``.env``).+ Returns ``(resolved_key, abort)``; ``abort=True`` means the caller must ``return`` at once."""from hermes_cli.auth import LMSTUDIO_NOAUTH_PLACEHOLDERfrom hermes_cli.config import save_env_valuekey_env = pconfig.api_key_env_vars[0] if pconfig.api_key_env_vars else ""@@ -758,17 +743,12 @@ def _named_custom_provider_map(cfg) -> dict[str, dict[str, str]]:model = str(raw_entry.get("model", "") or raw_entry.get("default_model", "") or "").strip()# Index by every identity the loaded (expanded) config might present: (name),# (name, model), (provider_key), (provider_key, model); case-insensitive names.- identities = []- if name:- identities.extend(((name.lower(),), (name.lower(), model)))- if provider_key:- identities.extend(((provider_key.lower(),), (provider_key.lower(), model)))- if "${" in template:- for identity in identities:- raw_api_key_refs.setdefault(identity, template)- if "${" in base_template:- for identity in identities:- raw_base_url_refs.setdefault(identity, base_template)+ keys = [k.lower() for k in (name, provider_key) if k]+ identities = [(k,) for k in keys] + [(k, model) for k in keys]+ for refs, tmpl in ((raw_api_key_refs, template), (raw_base_url_refs, base_template)):+ if "${" in tmpl:+ for identity in identities:+ refs.setdefault(identity, tmpl)def _lookup_ref(refs: dict[tuple, str], name: str, provider_key: str, model: str) -> str:name_lc = str(name or "").strip().lower()@@ -808,14 +788,10 @@ def _named_custom_provider_map(cfg) -> dict[str, dict[str, str]]:def _build_provider_picker_rows(config: dict, active: str, provider_labels: dict[str, str],custom_provider_map: dict[str, dict[str, str]]) -> tuple[list[tuple[str, str, list[str]]], int]:- """Rows for the ``hermes model`` provider picker plus the pre-selected index.-- Canonical providers fold into display groups (PROVIDER_GROUPS in hermes_cli/models.py):- a multi-member group is one row whose ``members`` drive a sub-picker; leaf rows have- ``members == []``. Saved custom providers and the trailing actions stay flat. Honors- ``model_catalog.excluded_providers`` (slug or alias, case-insensitive) like the- gateway/TUI pickers.- """+ """Rows for the ``hermes model`` provider picker plus the pre-selected index. Canonical providers+ fold into display groups (PROVIDER_GROUPS): a group row's ``members`` drive a sub-picker, leaf+ rows have ``members == []``; saved custom providers and trailing actions stay flat. Honors+ ``model_catalog.excluded_providers`` (slug or alias, case-insensitive) like the gateway/TUI."""from hermes_cli.models import CANONICAL_PROVIDERS, _PROVIDER_ALIASES, group_providers, provider_group_for_slugcanonical_descs = {p.slug: p.tui_desc for p in CANONICAL_PROVIDERS}_cli_excluded = {diff --git a/hermes_cli/model_setup_flows.py b/hermes_cli/model_setup_flows.pyindex d63831e3351..8282e499632 100644--- a/hermes_cli/model_setup_flows.py+++ b/hermes_cli/model_setup_flows.py@@ -1,11 +1,9 @@"""Per-provider model-selection wizard flows for ``hermes setup`` / ``hermes model``.-Contract: ``select_provider_and_model`` in main.py re-imports every ``_model_flow_*`` here, so-tests patching ``hermes_cli.main._model_flow_*`` keep working. main.py-internal helpers-(``_prompt_api_key``, ``_save_custom_provider``, ...) and config/auth/models functions are-imported lazily inside function bodies: that avoids the main.py import cycle and lets tests-patch ``hermes_cli.config.load_config`` etc. at call time. The shared skeleton lives in-:mod:`hermes_cli.model_setup_flows_common` and is re-exported here.+main.py re-imports every ``_model_flow_*`` (tests patch ``hermes_cli.main._model_flow_*``). main /+config / auth / models helpers are imported lazily inside bodies: avoids the main.py import cycle+and lets tests patch ``hermes_cli.config.load_config`` etc. at call time. The shared skeleton is+:mod:`hermes_cli.model_setup_flows_common`, re-exported here."""from __future__ import annotations@@ -102,11 +100,8 @@ def _model_flow_ai_gateway(config, current_model=""):def _model_flow_moa(config, current_model=""):- """Mixture of Agents virtual provider: pick a preset, then persist it.-- No credential step — presets reference already-configured providers. The preset list is- always shown (even with one entry), then the full breakdown on selection.- """+ """Mixture of Agents virtual provider: pick a preset (list always shown, even with one entry),+ persist it, print the breakdown. No credential step — presets reference configured providers."""from hermes_cli.auth import _save_model_choicefrom hermes_cli.moa_config import normalize_moa_configmoa = normalize_moa_config(config.get("moa") if isinstance(config, dict) else {})@@ -171,22 +166,18 @@ def _nous_login_args(args) -> argparse.Namespace:def _nous_model_catalog(free_tier: bool, portal_url: str, model_ids: list, pricing: dict):- """Free/paid-tier catalog for the Nous picker.-- Returns ``(model_ids, pricing, unavailable_models, unavailable_message, policy_narrowed)``- or None (message already printed) when nothing is selectable.- """+ """Free/paid-tier catalog for the Nous picker: ``(model_ids, pricing, unavailable_models,+ unavailable_message, policy_narrowed)`` or None (message already printed) when nothing is selectable."""from hermes_cli.models import (nous_policy_allowed_ids, partition_nous_models_by_tier, restrict_to_nous_policy,union_with_portal_free_recommendations, union_with_portal_paid_recommendations)- # Free users: augment with the Portal's freeRecommendedModels (so newly launched free- # models appear before this build's curated list catches up), then partition into- # selectable/unavailable by Portal pricing. Paid users: paidRecommendedModels, no partition.+ # Free users: union with the Portal's freeRecommendedModels (newly launched free models appear+ # before the curated list catches up), then partition selectable/unavailable by Portal pricing.+ # Paid users: paidRecommendedModels, no partition. Org policy narrows BEFORE the tier split so a+ # rescued id still has to pass the free/paid predicate.unavailable_models: list[str] = []unavailable_message = ""- # Org policy narrows BEFORE the tier split, so a rescued id still has to pass the- # free/paid predicate instead of going around it._policy_allowed = nous_policy_allowed_ids()if free_tier:try:@@ -406,8 +397,7 @@ def _model_flow_qwen_oauth(_config, current_model=""):"""Qwen OAuth provider: reuse local Qwen CLI login, then pick model."""from hermes_cli.main import _DEFAULT_QWEN_PORTAL_MODELSfrom hermes_cli.auth import (- get_qwen_auth_status, resolve_qwen_runtime_credentials, _prompt_model_selection, DEFAULT_QWEN_BASE_URL,- )+ get_qwen_auth_status, resolve_qwen_runtime_credentials, _prompt_model_selection, DEFAULT_QWEN_BASE_URL)from hermes_cli.models import fetch_api_modelsstatus = get_qwen_auth_status()if not status.get("logged_in"):@@ -719,12 +709,9 @@ def _model_flow_stepfun(config, current_model=""):def _model_flow_vertex(config, current_model=""):- """Google Vertex AI provider: Gemini via the OpenAI-compatible endpoint.-- Auth is OAuth2 (service-account JSON or ADC), no static key. The credential *path* lives- in .env (VERTEX_CREDENTIALS_PATH / GOOGLE_APPLICATION_CREDENTIALS); project ID and region- are non-secret and saved to config.yaml under ``vertex:``.- """+ """Google Vertex AI (Gemini via the OpenAI-compatible endpoint). Auth is OAuth2 (service-account+ JSON or ADC): the credential *path* lives in .env (VERTEX_CREDENTIALS_PATH /+ GOOGLE_APPLICATION_CREDENTIALS); project ID and region are non-secret, saved under ``vertex:``."""from hermes_cli.auth import _prompt_model_selectionfrom hermes_cli.config import load_config, get_env_valuefrom hermes_cli.models import _PROVIDER_MODELS@@ -886,12 +873,9 @@ _SPECIAL_MODEL_LISTS = {def _api_key_provider_model_list(provider_id: str, pconfig, existing_key: str, key_env: str, effective_base: str) -> list:- """Model list for an API-key provider. Resolution order:- 1. models.dev registry (cached, filtered for agentic/tool-capable models)- 2. Curated static fallback list (offline insurance)- 3. Live /models endpoint probe (small providers without models.dev data)- Providers in ``_SPECIAL_MODEL_LISTS`` have their own resolution.- """+ """Model list for an API-key provider: models.dev registry (cached, agentic/tool-capable filter)+ → curated static list (offline insurance) → live /models probe (small providers without+ models.dev data). Providers in ``_SPECIAL_MODEL_LISTS`` have their own resolution."""from hermes_cli.config import get_env_valuefrom hermes_cli.models import _PROVIDER_MODELS, fetch_api_modelscurated = _PROVIDER_MODELS.get(provider_id, [])diff --git a/hermes_cli/model_setup_flows_azure.py b/hermes_cli/model_setup_flows_azure.pyindex 44d2b3ce6eb..84df04787c2 100644--- a/hermes_cli/model_setup_flows_azure.py+++ b/hermes_cli/model_setup_flows_azure.py@@ -146,15 +146,11 @@ def _azure_detect_transport(effective_url: str, effective_key: str, token_providdef _model_flow_azure_foundry(config, current_model=""):- """Azure Foundry provider: configure endpoint, auth mode, API mode, and model.-- Two transports (OpenAI-style ``/v1/chat/completions``, Anthropic-style ``/v1/messages``)- and two auth modes: **API key** (``AZURE_FOUNDRY_API_KEY``) or **Microsoft Entra ID**- (keyless RBAC via ``azure-identity``; the same ``Azure AI User`` role covers both- transports). Detection order: ``/anthropic`` URL suffix → Anthropic; ``GET <base>/models``- success → OpenAI-style + model picker; Anthropic Messages probe; manual entry. Context- length resolves via :func:`agent.model_metadata.get_model_context_length`.- """+ """Azure Foundry: endpoint, auth mode, API mode, model. Two transports (OpenAI-style+ ``/v1/chat/completions``, Anthropic-style ``/v1/messages``) and two auth modes: API key+ (``AZURE_FOUNDRY_API_KEY``) or Microsoft Entra ID (keyless RBAC via ``azure-identity``; the+ ``Azure AI User`` role covers both transports). Detection: ``/anthropic`` URL suffix → Anthropic;+ ``GET <base>/models`` → OpenAI-style + picker; Anthropic Messages probe; manual entry."""from hermes_cli.config import get_env_value, save_env_valuefrom hermes_cli import azure_detect@@ -176,8 +172,7 @@ def _model_flow_azure_foundry(config, current_model=""):# Step 1: endpoint URL_placeholder = cur.base_url or (- "e.g. https://<resource>.openai.azure.com/openai/v1 or https://<resource>.services.ai.azure.com/anthropic"- )+ "e.g. https://<resource>.openai.azure.com/openai/v1 or https://<resource>.services.ai.azure.com/anthropic")base_url = _ask(f"API endpoint URL [{_placeholder}]: ")if base_url is None:returndiff --git a/hermes_cli/model_setup_flows_bedrock.py b/hermes_cli/model_setup_flows_bedrock.pyindex 24f851e6106..4f5bd311240 100644--- a/hermes_cli/model_setup_flows_bedrock.py+++ b/hermes_cli/model_setup_flows_bedrock.py@@ -28,11 +28,9 @@ def bedrock_region_geo_prefix(region_name: str) -> str:def bedrock_model_routable_from_region(model_id: str, region_name: str) -> bool:- """True when *model_id* can be invoked from *region_name*'s endpoint.-- Bare foundation-model ids and ``global.*`` profiles route from anywhere;- geo-prefixed profiles only from their own geography. Unknown regions hide nothing.- """+ """True when *model_id* can be invoked from *region_name*'s endpoint: bare foundation-model ids+ and ``global.*`` profiles route from anywhere, geo-prefixed profiles only from their own+ geography. Unknown regions hide nothing."""mid = (model_id or "").lower()matched_geo = next((p for p in BEDROCK_GEO_PREFIXES if mid.startswith(p)), None)if matched_geo is None or mid.startswith("global."):@@ -47,11 +45,8 @@ def bedrock_model_routable_from_region(model_id: str, region_name: str) -> bool:def _model_flow_bedrock_api_key(config, region, current_model=""):- """Bedrock API Key mode — uses the OpenAI-compatible bedrock-mantle endpoint.-- For developers without an AWS account who received a Bedrock API Key from- their AWS admin. Works like any OpenAI-compatible endpoint.- """+ """Bedrock API Key mode on the OpenAI-compatible bedrock-mantle endpoint — for developers+ without an AWS account who received a Bedrock API Key from their AWS admin."""from hermes_cli.auth import _resolve_api_key_provider_secret, ProviderConfigfrom hermes_cli.config import save_env_valuefrom hermes_cli.models import _PROVIDER_MODELS@@ -151,12 +146,8 @@ def _bedrock_text_model_ids(live_models: list, region: str) -> list[str]:def _model_flow_bedrock(config, current_model=""):- """AWS Bedrock provider: verify credentials, pick region, discover models.-- Uses the native Converse API via boto3 — not the OpenAI-compatible endpoint.- Auth is the AWS SDK default credential chain (env vars, profile, instance- role), so no API key prompt is needed.- """+ """AWS Bedrock (native Converse API via boto3): verify credentials, pick region, discover models.+ Auth is the AWS SDK default credential chain, so no API key prompt is needed."""from hermes_cli.models import _PROVIDER_MODELS# 1. Check for AWS credentialsdiff --git a/hermes_cli/model_setup_flows_common.py b/hermes_cli/model_setup_flows_common.pyindex 98deeac2010..02bccb26eaa 100644--- a/hermes_cli/model_setup_flows_common.py+++ b/hermes_cli/model_setup_flows_common.py@@ -1,12 +1,9 @@-"""Shared skeleton for the ``_model_flow_*`` wizards in :mod:`hermes_cli.model_setup_flows`.+"""Shared skeleton for the ``_model_flow_*`` wizards: banner, credentials, model list, picker,+persist, confirmation — one copy of each step. Prompt strings and the config keys written (and+their insertion order = config.yaml key order) are behavior; keep them byte-identical.-Every wizard is the same shape — banner, credentials, model list, picker, persist,-confirmation — and these helpers hold the one copy of each step. Prompt strings and the-config keys written (and their insertion order, which is the config.yaml key order) are-behavior; keep them byte-identical when editing.--All hermes_cli.main / auth / config imports are lazy on purpose: main.py re-imports the-flows (import cycle) and tests patch ``hermes_cli.config.load_config`` etc. at call time.+hermes_cli.main / auth / config imports are lazy on purpose: main.py re-imports the flows (import+cycle) and tests patch ``hermes_cli.config.load_config`` etc. at call time."""from __future__ import annotations@@ -218,12 +215,9 @@ def _show_curated(model_list) -> None:def _prune_replaced_custom_model_config_credentials(base_url: str, *, provider_name: str = "") -> None:- """Drop stale ``model_config`` credentials from inactive custom pools.-- ``model_config`` means "the credential currently stored under ``model.api_key``".- After an explicit custom-endpoint switch, any old custom pool still carrying that- source points at the previous endpoint and could be selected before the fresh config.- """+ """Drop stale ``model_config`` ("the credential under ``model.api_key``") entries from inactive+ custom pools: after an explicit custom-endpoint switch an old pool still carrying that source+ points at the previous endpoint and could be selected before the fresh config."""try:from agent.credential_pool import CUSTOM_POOL_PREFIX, custom_provider_pool_key_candidatesfrom hermes_cli.auth import read_credential_pool, write_credential_pooldiff --git a/hermes_cli/model_setup_flows_custom.py b/hermes_cli/model_setup_flows_custom.pyindex 00a60868d77..49599d342b9 100644--- a/hermes_cli/model_setup_flows_custom.py+++ b/hermes_cli/model_setup_flows_custom.py@@ -72,11 +72,8 @@ def _pick_detected_model(detected_models: list) -> str:def _model_flow_custom(config):- """Custom endpoint: collect URL, API key, and model name.-- Also saves the endpoint to ``custom_providers`` in config.yaml so it appears- in the provider menu on subsequent runs.- """+ """Custom endpoint: collect URL, API key, and model name; also saved to ``custom_providers`` so+ it appears in the provider menu on subsequent runs."""from hermes_cli.main import _auto_provider_name, _prompt_custom_api_mode_selection, _save_custom_providerfrom hermes_cli.auth import _save_model_choice, deactivate_providerfrom hermes_cli.config import custom_endpoint_key_env, get_env_value, save_env_value@@ -286,12 +283,9 @@ def _pick_named_custom_model(name: str, models: list, saved_model: str):def _model_flow_named_custom(config, provider_info):- """Handle a named custom provider from config.yaml custom_providers list.-- Probes the endpoint's model catalog (native ``/api/tags`` for endpoints- conservatively identified as Ollama); a previously saved model is pre-selected- and used as the fallback when probing fails.- """+ """Named custom provider from ``custom_providers`` / ``providers.<key>``: probes the model+ catalog (native ``/api/tags`` for endpoints conservatively identified as Ollama); a previously+ saved model is pre-selected and is the fallback when probing fails."""from hermes_cli.main import _custom_provider_api_key_config_value, _custom_provider_base_url_config_value, _save_custom_providerfrom hermes_cli.auth import _save_model_choicefrom hermes_cli.config import load_config, save_config