mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Replace the hardcoded _PROVIDER_MODELS["nous"] catalog (~29 entries that
had to be updated manually on every Portal model release) with a live
fetch from /api/nous/recommended-models, keyed off the user's free/paid
tier. The Portal is now the single source of truth — adding or removing
a Nous model no longer requires a Hermes release.
## What changes
hermes_cli/models.py
- Remove the hardcoded "nous": [...] list from _PROVIDER_MODELS.
- Add get_nous_recommended_catalog(): reuses the existing 10-minute
TTL cache in fetch_nous_recommended_models() (no extra HTTP per
call; shares the cache with the aux/vision model helper). Selects
freeRecommendedModels vs paidRecommendedModels based on
check_nous_free_tier(), preserves server-specified ordering
(the endpoint already orders each array by "position"), and does
case-insensitive dedup.
- Add _nous_catalog(): exception-safe wrapper returning [] on any
failure, so callers treat Portal unavailability as "no catalog"
rather than a crash.
- Rewire provider_model_ids("nous"): Portal recommended-models is
now primary; the inference /models endpoint stays as a secondary
live fallback for offline/misconfigured-portal resilience.
- get_default_model_for_provider("nous") and detect_provider_for_model()
now route through _nous_catalog() instead of the removed dict key.
hermes_cli/auth.py
- _login_nous() swapped _PROVIDER_MODELS.get("nous", []) → _nous_catalog().
hermes_cli/main.py
- /model command nous branch: same swap.
## Design notes
- Free-tier detection happens inside the helper, so single call sites
don't have to plumb the tier bool around.
- On tier-detection exception, defaults to paid — matches the existing
convention (never block paying users).
- The _AGGREGATORS gate in detect_provider_for_model()'s cross-provider
match loop already skipped "nous" when it was in _PROVIDER_MODELS,
so removing the key changes nothing in that loop.
- partition_nous_models_by_tier() is kept in the call sites; it becomes
mostly a no-op on the server-tier-filtered list but preserves the
"upgrade at {portal}" messaging for free-tier users with no free
models available.
## Tests
tests/hermes_cli/test_nous_recommended_models.py (new, 22 tests):
- Server-order preservation
- Free vs paid routing, auto-detection + exception-defaults-to-paid
- Empty / missing-field / malformed entries → []
- Case-insensitive dedup preserving first-seen casing
- provider_model_ids("nous") rewiring: Portal-first, inference fallback,
force_refresh propagation, exception-falls-through
- _PROVIDER_MODELS["nous"] is absent
- get_default_model_for_provider("nous") Portal-driven,
non-nous providers unaffected
- detect_provider_for_model() bare-name + current-provider paths
- _nous_catalog() swallows exceptions → []
- curated_models_for_provider("nous") routes through Portal
tests/hermes_cli/test_auth_nous_provider.py:
- Add get_nous_recommended_catalog stub to _patch_login_internals so
the login flow has models to present without a live network call.
## Verification
scripts/run_tests.sh tests/hermes_cli/ tests/test_empty_model_fallback.py
tests/acp/test_server.py tests/test_tui_gateway_server.py
tests/agent/test_bedrock_integration.py
→ 2752 passed. The 4 remaining failures + 1 collection race are
pre-existing on main (unrelated — skills filtering, tip length,
Linux stdlib ssl quirk, xdist race), confirmed via git-stash diff.
|
||
|---|---|---|
| .. | ||
| acp | ||
| agent | ||
| cli | ||
| cron | ||
| e2e | ||
| environments/benchmarks | ||
| fakes | ||
| gateway | ||
| hermes_cli | ||
| honcho_plugin | ||
| integration | ||
| plugins | ||
| run_agent | ||
| skills | ||
| tools | ||
| tui_gateway | ||
| __init__.py | ||
| conftest.py | ||
| run_interrupt_test.py | ||
| test_account_usage.py | ||
| test_base_url_hostname.py | ||
| test_batch_runner_checkpoint.py | ||
| test_cli_file_drop.py | ||
| test_cli_skin_integration.py | ||
| test_ctx_halving_fix.py | ||
| test_empty_model_fallback.py | ||
| test_evidence_store.py | ||
| test_hermes_constants.py | ||
| test_hermes_logging.py | ||
| test_hermes_state.py | ||
| test_honcho_client_config.py | ||
| test_ipv4_preference.py | ||
| test_mcp_serve.py | ||
| test_mini_swe_runner.py | ||
| test_minimax_model_validation.py | ||
| test_minisweagent_path.py | ||
| test_model_picker_scroll.py | ||
| test_model_tools.py | ||
| test_model_tools_async_bridge.py | ||
| test_ollama_num_ctx.py | ||
| test_packaging_metadata.py | ||
| test_plugin_skills.py | ||
| test_project_metadata.py | ||
| test_retry_utils.py | ||
| test_sql_injection.py | ||
| test_subprocess_home_isolation.py | ||
| test_timezone.py | ||
| test_toolset_distributions.py | ||
| test_toolsets.py | ||
| test_trajectory_compressor.py | ||
| test_trajectory_compressor_async.py | ||
| test_transform_tool_result_hook.py | ||
| test_tui_gateway_server.py | ||
| test_utils_truthy_values.py | ||