The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(left-core): migration rows for a model provider that moved to a plugin
Teknium889d753725cd
diff --git a/hermes_cli/auth.py b/hermes_cli/auth.pyindex 1e09429db3a..81646b06bb5 100644--- a/hermes_cli/auth.py+++ b/hermes_cli/auth.py@@ -1380,28 +1380,6 @@ def deactivate_provider() -> None:# ── Provider Resolution — picks which provider to use ───────────────────────────────────────────────-def _get_config_hint_for_unknown_provider(provider_name: str) -> str:- """Return a helpful hint string when provider resolution fails."""- if str(provider_name or "").strip().lower() in {"opencode-free", "free", "opencode_free"}:- return ("OpenCode discontinued anonymous free-tier access outside its own client "- "(relay 403s FreeTierError), so the keyless 'opencode-free' provider was removed. "- "Switch to 'opencode-zen' (pay-as-you-go, OPENCODE_ZEN_API_KEY) or 'opencode-go' "- "($10/mo subscription, OPENCODE_GO_API_KEY) via 'hermes model'.")- try:- from hermes_cli.config import validate_config_structure- issues = validate_config_structure()- if not issues:- return ""- lines = ["Config issue detected — run 'hermes doctor' for full diagnostics:"]- for ci in issues:- lines.append(f" [{'ERROR' if ci.severity == 'error' else 'WARNING'}] {ci.message}")- if ci.hint and ci.hint.splitlines()[0]:- lines.append(f" → {ci.hint.splitlines()[0]}")- return "\n".join(lines)- except Exception:- return ""--def _refuse_env_adoption_if_config_corrupt() -> None:"""Refuse env-key/pool auto-adoption of openrouter while config.yaml is corrupt.@@ -1645,7 +1623,8 @@ def resolve_provider(if normalized in ("openrouter", "custom") or _registry_lookup(normalized) is not None:return normalizedif normalized != "auto":- hint = _get_config_hint_for_unknown_provider(normalized)+ from hermes_cli.auth_error_copy import unknown_provider_hint+ hint = unknown_provider_hint(normalized)tail = (f"\n\n{hint}" if hint else " Check 'hermes model' for available providers, ""or run 'hermes doctor' to diagnose config issues.")raise AuthError(f"Unknown provider '{normalized}'." + tail, code="invalid_provider")diff --git a/hermes_cli/auth_commands.py b/hermes_cli/auth_commands.pyindex bf840bb2908..ab78d719386 100644--- a/hermes_cli/auth_commands.py+++ b/hermes_cli/auth_commands.py@@ -143,6 +143,9 @@ def _unknown_provider_exit(provider: str) -> SystemExit:import difflibknown = sorted({pid for pid, _ in canonical_registry_rows()} | {"openrouter"}| {entry["name"] for entry in _get_custom_provider_entries()})+ from hermes_cli.left_core_migration import provider_install_hint+ if moved := provider_install_hint(provider):+ return SystemExit(f"Unknown provider '{provider}'. {moved}")close = difflib.get_close_matches(provider, known, n=3, cutoff=0.5)hint = f" Did you mean {', '.join(close)}?" if close else ""return SystemExit(diff --git a/hermes_cli/auth_error_copy.py b/hermes_cli/auth_error_copy.pyindex 7bf8d29e9a4..d447fb9d85e 100644--- a/hermes_cli/auth_error_copy.py+++ b/hermes_cli/auth_error_copy.py@@ -135,3 +135,29 @@ def provider_setup_failure_lines(exc: BaseException, *, retry_command: str = "heif not is_cancelled(exc):lines.append(_details_line(exc))return lines+++def unknown_provider_hint(provider_name: str) -> str:+ """Hint for an ``Unknown provider`` error from the resolver: the install line of a provider that left+ core for a plugin, the replacement for a removed provider, else the config issues that cause it."""+ from hermes_cli.left_core_migration import provider_install_hint+ if moved := provider_install_hint(provider_name):+ return moved+ if str(provider_name or "").strip().lower() in {"opencode-free", "free", "opencode_free"}:+ return ("OpenCode discontinued anonymous free-tier access outside its own client "+ "(relay 403s FreeTierError), so the keyless 'opencode-free' provider was removed. "+ "Switch to 'opencode-zen' (pay-as-you-go, OPENCODE_ZEN_API_KEY) or 'opencode-go' "+ "($10/mo subscription, OPENCODE_GO_API_KEY) via 'hermes model'.")+ try:+ from hermes_cli.config import validate_config_structure+ issues = validate_config_structure()+ if not issues:+ return ""+ lines = ["Config issue detected — run 'hermes doctor' for full diagnostics:"]+ for ci in issues:+ lines.append(f" [{'ERROR' if ci.severity == 'error' else 'WARNING'}] {ci.message}")+ if ci.hint and ci.hint.splitlines()[0]:+ lines.append(f" → {ci.hint.splitlines()[0]}")+ return "\n".join(lines)+ except Exception: # health: allow BLE001 -- moved verbatim from auth.py; a hint never masks the error it explains+ return ""diff --git a/hermes_cli/auth_external_process.py b/hermes_cli/auth_external_process.pyindex 144e604cc37..396806cfe95 100644--- a/hermes_cli/auth_external_process.py+++ b/hermes_cli/auth_external_process.py@@ -40,3 +40,12 @@ def external_process_launch_env_names() -> frozenset[str]:return frozenset(name for profile in list_providers() if profile.auth_type == "external_process"for name in (*profile.process_command_env_vars, profile.process_args_env_var) if name)+++def env_writer_launch_denylist() -> frozenset[str]:+ """:func:`external_process_launch_env_names` plus the ``profile_env`` a left-core row keeps for a provider+ plugin the active home lacks: that plugin's profile, which would declare them, is not registered."""+ from hermes_cli.left_core_migration import absent_plugin_profile_env+ from hermes_constants import get_hermes_home++ return external_process_launch_env_names() | absent_plugin_profile_env(get_hermes_home())diff --git a/hermes_cli/config.py b/hermes_cli/config.pyindex 6d19dfdbd14..93e8f7f4af7 100644--- a/hermes_cli/config.py+++ b/hermes_cli/config.py@@ -37,6 +37,7 @@ from hermes_cli.cli_output import line_inputfrom hermes_cli.colors import Colors, colorfrom hermes_cli import managed_scopefrom hermes_cli.default_soul import DEFAULT_SOUL_MD, is_legacy_template_soul+from hermes_cli.left_core_migration import profile_env_names as _left_core_profile_envfrom hermes_cli.secret_prompt import masked_secret_prompt# Managed-mode, container and HERMES_UID/GID policy live in hermes_constants (import-safe);# re-exported here so existing callers/patch targets keep working.@@ -143,7 +144,7 @@ def validate_env_var_name_for_write(key: str) -> None:if not _ENV_VAR_NAME_RE.match(key):raise ValueError(f"Invalid environment variable name: {key!r}")policy_name = _env_var_policy_name(key)- from hermes_cli.auth_external_process import external_process_launch_env_names as _launch_env # ACP argv authority+ from hermes_cli.auth_external_process import env_writer_launch_denylist as _launch_env # ACP argv authorityif (policy_name in _ENV_VAR_NAME_DENYLIST or policy_name in map(_env_var_policy_name, _launch_env())or policy_name.startswith(_ENV_VAR_NAME_DENY_PREFIXES)):raise ValueError(@@ -215,8 +216,7 @@ _EXTRA_ENV_KEYS = frozenset({"MATRIX_REQUIRE_MENTION", "MATRIX_FREE_RESPONSE_ROOMS", "MATRIX_AUTO_THREAD", "MATRIX_DM_AUTO_THREAD","MATRIX_RECOVERY_KEY",# ACP (Agent Client Protocol) keys — profile-isolable so profiles can use different backends.- "HERMES_ACP_AUTH_METHOD", "HERMES_ACP_AUTO_APPROVE", "HERMES_COPILOT_ACP_COMMAND",- "HERMES_COPILOT_ACP_ARGS", "COPILOT_CLI_PATH", "COPILOT_ACP_BASE_URL"})+ "HERMES_ACP_AUTH_METHOD", "HERMES_ACP_AUTO_APPROVE"}) | _left_core_profile_env() # moved providers' env# ---- Managed mode (NixOS declarative config) ----diff --git a/hermes_cli/env_loader.py b/hermes_cli/env_loader.pyindex d2055780a40..dbc2ba58325 100644--- a/hermes_cli/env_loader.py+++ b/hermes_cli/env_loader.py@@ -15,6 +15,7 @@ from pathlib import Path# wiped (#57828) so early recovery provably runs before third-party imports (test_early_recovery).# The parser internals are imported lazily below because gateway tests stub ``sys.modules["dotenv"]``.import dotenv+from hermes_cli.left_core_migration import profile_env_namesfrom utils import atomic_replace, load_yaml_file_readonly, mkstemp_besidelogger = logging.getLogger(__name__)@@ -87,10 +88,11 @@ _SPAWN_CREDENTIAL_KEYS: frozenset[str] = frozenset({"HERMES_DASHBOARD_SESSION_TO# onto the wrong provider path; these — and ONLY these — are scrubbed at startup when absent from the# profile's .env. Credentials are excluded: shell exports are a documented way to supply them, and# read-time secret-scope checks (agent/secret_scope.py) own cross-profile credential isolation.+# Providers that left core keep theirs listed on their ``LEFT_CORE`` row (``profile_env``), read statically:+# this runs before provider discovery, and with the plugin absent nothing else names them._PROFILE_MANAGED_ENV_KEYS: frozenset[str] = frozenset({- "HERMES_ACP_AUTH_METHOD", "HERMES_ACP_AUTO_APPROVE", "HERMES_COPILOT_ACP_COMMAND",- "HERMES_COPILOT_ACP_ARGS", "COPILOT_CLI_PATH", "COPILOT_ACP_BASE_URL",-})+ "HERMES_ACP_AUTH_METHOD", "HERMES_ACP_AUTO_APPROVE",+}) | profile_env_names()def _env_keys_defined_in_dotenv(path: Path) -> set[str]:diff --git a/hermes_cli/left_core_migration.py b/hermes_cli/left_core_migration.pyindex 9525fc7d749..9c2326a2b04 100644--- a/hermes_cli/left_core_migration.py+++ b/hermes_cli/left_core_migration.py@@ -114,16 +114,21 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:_read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")+def _auth_store(home: Path) -> dict:+ """*home*'s ``auth.json``; ``{}`` when missing, unreadable or invalid (no login we can see)."""+ import json+ try:+ store = json.loads((home / "auth.json").read_text(encoding="utf-8-sig"))+ except (OSError, ValueError):+ return {}+ return store if isinstance(store, dict) else {}++def spotify_in_use(home: Path, *, process_env: bool = False) -> bool:"""What made core's Spotify tools usable for *home*: a login stored in its ``auth.json``(``providers.spotify``, written by ``hermes auth spotify``) or the ``spotify`` toolset selectedfor a platform. The tools were opt-in and login-gated, so a client id alone is not use."""- import json- try:- store = json.loads((home / "auth.json").read_text(encoding="utf-8-sig"))- except (OSError, ValueError): # missing/unreadable/invalid JSON: no login we can see- store = {}- providers = store.get("providers") if isinstance(store, dict) else None+ providers = _auth_store(home).get("providers")state = providers.get("spotify") if isinstance(providers, dict) else Noneif isinstance(state, dict) and (state.get("access_token") or state.get("refresh_token")):return True@@ -225,6 +230,87 @@ def camofox_in_use(home: Path, *, process_env: bool = False) -> bool:return bool(_home_env(home, "CAMOFOX_URL", process_env=process_env))+def _provider_choices(home: Path) -> set[str]:+ """Every provider *home* routes inference through, read with core's own loaders: config.yaml with the+ managed overlay (``read_yaml_layers``): ``model``, the fallback chain (``get_fallback_chain``: legacy+ ``fallback_model`` merged), each ``auxiliary.<task>``, ``delegation`` and its fallback chain, every MoA+ preset's reference models and aggregator (``normalize_moa_config``); the ``auth.json``+ ``active_provider`` the resolver's auto rung follows; and the provider each cron job pinned."""+ from gateway import config_loader+ from hermes_cli.fallback_config import get_fallback_chain+ from hermes_cli.moa_config import normalize_moa_config+ try:+ cfg = config_loader.read_yaml_layers(home)+ except Exception: # malformed config.yaml: the agent reads nothing from it either+ logger.debug("left-core: unreadable config for %s", home, exc_info=True)+ cfg = {}+ cfg = cfg if isinstance(cfg, dict) else {}++ def block(value) -> dict:+ return value if isinstance(value, dict) else {}+ delegation = block(cfg.get("delegation"))+ slots = [block(cfg.get("model")), *get_fallback_chain(cfg), *map(block, block(cfg.get("auxiliary")).values()),+ delegation, *get_fallback_chain({"fallback_providers": delegation.get("fallback_providers")})]+ for preset in normalize_moa_config(cfg.get("moa"))["presets"].values():+ slots += [*map(block, preset.get("reference_models") or []), block(preset.get("aggregator"))]+ import json+ try:+ jobs = json.loads((home / "cron" / "jobs.json").read_text(encoding="utf-8-sig")).get("jobs")+ except (OSError, ValueError, AttributeError): # no (readable) job store: no pins+ jobs = None+ slots += [block(job) for job in jobs] if isinstance(jobs, list) else []+ chosen = {str(slot.get("provider") or "").strip().lower() for slot in slots}+ chosen.add(str(_auth_store(home).get("active_provider") or "").strip().lower())+ return chosen - {""}+++def providers_selected(home: Path, names: tuple[str, ...], *, process_env: bool = False) -> set[str]:+ """The provider *names* (ids or aliases) *home* routes inference through (:func:`_provider_choices`),+ or names in its ``HERMES_INFERENCE_PROVIDER`` (dotenv layers; the process env too for the launch home+ with *process_env*). A credential alone is not a choice: core never routed to a provider for a key."""+ chosen = _provider_choices(home) | {_home_env(home, "HERMES_INFERENCE_PROVIDER", process_env=process_env).lower()}+ return chosen & {name.lower() for name in names}+++# GitHub Copilot: the API provider and the Copilot CLI over ACP, ids and every alias their profiles declared.+_COPILOT_API = ("copilot", "github-copilot", "github-models", "github-model", "github")+_COPILOT_ACP = ("copilot-acp", "github-copilot-acp", "copilot-acp-agent")+++def copilot_in_use(home: Path, *, process_env: bool = False) -> bool:+ """Core routed inference through GitHub Copilot for *home*: ``copilot`` or ``copilot-acp`` (any alias)+ is a provider it chose (:func:`providers_selected`). A GH_TOKEN in ``.env`` alone is not use."""+ return bool(providers_selected(home, _COPILOT_API + _COPILOT_ACP, process_env=process_env))+++def copilot_relogin_notice(home: Path, *, process_env: bool = False) -> str:+ """The Copilot API provider is in use in *home* with no token the plugin reads: no+ COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN in its dotenv layers (process env too for the launch home+ with *process_env*) and no Hermes login in its ``auth.json`` (a ``manual`` credential-pool row from+ ``hermes auth add copilot``, or ``providers.copilot``). Core also took ``gh auth token`` and the+ GitHub/Copilot CLI's token files, which the plugin does not; read-only, never runs ``gh``."""+ if not providers_selected(home, _COPILOT_API, process_env=process_env):+ return ""+ if any(_home_env(home, name, process_env=process_env)+ for name in ("COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN")):+ return ""+ store = _auth_store(home)+ pool = store.get("credential_pool")+ rows = pool.get("copilot") if isinstance(pool, dict) else None+ if isinstance(rows, list) and any(+ isinstance(row, dict) and str(row.get("source") or "").split(":", 1)[0] == "manual" for row in rows):+ return ""+ providers = store.get("providers")+ if isinstance(providers, dict) and isinstance(providers.get("copilot"), dict) and providers["copilot"]:+ return ""+ return ("This profile's Copilot login came from `gh auth token` or the GitHub/Copilot CLI, which the plugin "+ "no longer reads: run `hermes auth add copilot` to sign in.")+++def _no_notice(home: Path, *, process_env: bool = False) -> str:+ return ""++@dataclass(frozen=True)class LeftCoreFeature:plugin: str # catalog entry name == installed plugin name@@ -280,6 +366,20 @@ class LeftCoreFeature:# only while the home's config is below it or when that version's config step found the feature in# use (:func:`record_core_use`). A newer home that sets the plugin up itself keeps core's toolsets.left_at: int = 0+ # Provider ids and aliases the plugin's model-provider profiles register. A name nothing resolves to+ # gets :func:`provider_install_hint` appended to its "unknown provider" error, runtime resolution+ # installs the plugin first for a home that uses it (:func:`recover_for_provider`), and those names+ # never resolve through another rung (the models.dev catalog) while the plugin is not loaded.+ providers: tuple[str, ...] = ()+ # Env names the plugin's providers read that core kept profile-managed: scrubbed when inherited but+ # absent from the profile's .env (env_loader._PROFILE_MANAGED_ENV_KEYS), routed to .env by `hermes+ # config set` (config._EXTRA_ENV_KEYS), and refused by the generic env writers while the plugin is+ # absent (executable/argv authority its profile otherwise declares). Read statically: env_loader runs+ # before provider discovery.+ profile_env: tuple[str, ...] = ()+ # (home, *, process_env=False) -> str: one more sentence for every migration outcome in *home* (a+ # credential source core read that the plugin does not, and the command that replaces it), "" = none.+ notice: Callable[..., str] = _no_noticeLEFT_CORE: tuple[LeftCoreFeature, ...] = (@@ -333,6 +433,18 @@ LEFT_CORE: tuple[LeftCoreFeature, ...] = (unchanged="`hermes import-agent`, its flags and your import-sync.json sync sources are unchanged",command="import-agent", old_cli=("claw",),),+ LeftCoreFeature(+ # Core kept COPILOT_GITHUB_TOKEN and the two base-URL overrides out of children as provider env+ # (Tier 2: credentialed CLIs still get them); GH_TOKEN/GITHUB_TOKEN stay on core's static lists.+ plugin="github-copilot", label="GitHub Copilot", in_use=copilot_in_use,+ unchanged="your COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN and `hermes auth add copilot` logins, model "+ "names and copilot-acp settings are unchanged",+ private_env=("COPILOT_GITHUB_TOKEN", "COPILOT_API_BASE_URL", "COPILOT_ACP_BASE_URL"),+ providers=_COPILOT_API + _COPILOT_ACP,+ profile_env=("HERMES_COPILOT_ACP_COMMAND", "HERMES_COPILOT_ACP_ARGS", "COPILOT_CLI_PATH",+ "COPILOT_ACP_BASE_URL"),+ notice=copilot_relogin_notice,+ ),)def _install_sentence(feature: LeftCoreFeature) -> str:@@ -355,6 +467,66 @@ def terminal_backend_install_hint(backend: str) -> str:return f". {_install_sentence(feature)}" if feature else ""+def _provider_feature(name: str) -> Optional[LeftCoreFeature]:+ key = str(name or "").strip().lower()+ return next((f for f in LEFT_CORE if key and key in f.providers), None)+++def provider_install_hint(name: str) -> str:+ """For a provider name nothing resolves to that a left-core plugin supplies: the sentence naming its+ install command for the active home (its enable command when installed but not loaded), else ``""``.+ Appended to every "unknown provider" error (runtime resolution, ``/model``, ``hermes model``, ``hermes+ auth add``)."""+ feature = _provider_feature(name)+ if feature is None:+ return ""+ from hermes_constants import get_hermes_home+ home = Path(get_hermes_home())+ if not plugin_present(feature.plugin, home):+ return f"{_install_sentence(feature)}."+ enable = _install_command(feature.plugin, home).replace(" install ", " enable ")+ return (f"{feature.label} moved out of core into the '{feature.plugin}' plugin, which is installed but not "+ f"loaded: run `{enable}`.")+++def provider_left_core(name: str) -> bool:+ """*name* is a provider a left-core plugin supplies and no registered profile serves it now: no other+ resolution rung (the models.dev catalog) may stand in for it (it would send the user's token to the+ vendor's endpoint through a generic client)."""+ if _provider_feature(name) is None:+ return False+ from providers import get_provider_profile+ return get_provider_profile(str(name).strip().lower()) is None+++def recover_for_provider(name: Optional[str]) -> None:+ """Runtime resolution of *name*, a provider a left-core plugin supplies, in a home that uses it and lacks+ the plugin: run :func:`recover_at_startup` now. The CLI and Desktop resolve the provider before the agent+ (whose start runs the migration) exists, so they would otherwise stop at "unknown provider" on a home no+ ``hermes update`` migrated. Outcomes are logged and wait for the home's first agent, as at gateway start."""+ feature = _provider_feature(name or "")+ if feature is None:+ return+ from hermes_constants import get_hermes_home+ from providers import get_provider_profile+ home = Path(get_hermes_home())+ if plugin_present(feature.plugin, home) or get_provider_profile(str(name).strip().lower()) is not None:+ return+ if feature.in_use(home, process_env=True):+ recover_at_startup()+++def profile_env_names() -> frozenset[str]:+ """Every row's :attr:`LeftCoreFeature.profile_env` (static: no discovery)."""+ return frozenset(name for feature in LEFT_CORE for name in feature.profile_env)+++def absent_plugin_profile_env(home: Path) -> frozenset[str]:+ """``profile_env`` of the rows whose plugin *home* does not have: the generic env writers refuse them."""+ return frozenset(name for feature in LEFT_CORE if feature.profile_env and not plugin_present(feature.plugin, home)+ for name in feature.profile_env)++def legacy_plugin_alias(name: str) -> str:"""The catalog plugin a bundled key that left core now names (``observability/langfuse`` ->``langfuse``), else ``""``."""@@ -581,7 +753,7 @@ def _pending(home: Path, *, say: Callable[[str], None], process_env: bool = Falsif not feature.in_use(home, process_env=process_env):continueif not _predates_split(home, feature):- _say_post_split(home, feature, say=say, backoff=backoff)+ _say_post_split(home, feature, say=say, backoff=backoff, process_env=process_env)continuepresent = plugin_present(feature.plugin, home)try:@@ -599,23 +771,31 @@ def _pending(home: Path, *, say: Callable[[str], None], process_env: bool = Falscontinueif catalog_source(feature.plugin) is None:_note_failure(home, feature.plugin)- say(f" ⚠ {feature.label} moved out of core into the '{feature.plugin}' plugin, which this "- f"Hermes cannot find in the plugin catalog yet. Run `{_install_command(feature.plugin, home)}` "- f"once it is listed.")+ say(_noticed(f" ⚠ {feature.label} moved out of core into the '{feature.plugin}' plugin, which this "+ f"Hermes cannot find in the plugin catalog yet. Run "+ f"`{_install_command(feature.plugin, home)}` once it is listed.", home, feature, process_env))continueout.append(feature)return out-def _say_post_split(home: Path, feature: LeftCoreFeature, *, say: Callable[[str], None], backoff: bool) -> None:+def _say_post_split(home: Path, feature: LeftCoreFeature, *, say: Callable[[str], None], backoff: bool,+ process_env: bool = False) -> None:"""*home* uses *feature* while its stamp says it never ran it in core (a newer home, or a Nix-managedconfig.yaml stamped at activation): nothing is converted or installed, but a home without the plugin istold where the feature went. Starts repeat it on the install backoff (``_note_failure``)."""if plugin_present(feature.plugin, home) or (backoff and _failed_recently(home, feature.plugin)):return_note_failure(home, feature.plugin)- say(f" ⚠ {feature.label} moved out of core into the '{feature.plugin}' plugin, which this profile does not "- f"have, so it is off. Run `{_install_command(feature.plugin, home)}`.")+ say(_noticed(f" ⚠ {feature.label} moved out of core into the '{feature.plugin}' plugin, which this profile "+ f"does not have, so it is off. Run `{_install_command(feature.plugin, home)}`.",+ home, feature, process_env))+++def _noticed(message: str, home: Path, feature: LeftCoreFeature, process_env: bool) -> str:+ """*message* with *feature*'s :attr:`~LeftCoreFeature.notice` for *home* appended."""+ extra = feature.notice(home, process_env=process_env)+ return f"{message} {extra}" if extra else messagedef _install_into(home: Path, *, consent: Optional[bool] = None) -> Callable[[str], dict]:@@ -641,7 +821,7 @@ def _first_cause(error: str) -> str:def _install_one(home: Path, feature: LeftCoreFeature, *, install: Callable[[str], dict],- say: Callable[[str], None]) -> bool:+ say: Callable[[str], None], process_env: bool = False) -> bool:try:result = install(feature.plugin)except Exception as exc: # network, uv, kill list — report, do not raise@@ -651,13 +831,13 @@ def _install_one(home: Path, feature: LeftCoreFeature, *, install: Callable[[str_record_migration(home, feature)except Exception as exc: # the next run sees the plugin dir and records it thenlogger.debug("left-core install marker not written for %s: %s", home, exc)- say(f" ✓ {feature.label} moved out of core — installed the '{feature.plugin}' plugin from the "- f"catalog ({feature.unchanged}).")+ say(_noticed(f" ✓ {feature.label} moved out of core — installed the '{feature.plugin}' plugin from the "+ f"catalog ({feature.unchanged}).", home, feature, process_env))return True_note_failure(home, feature.plugin)error = _first_cause(str(result.get("error") or ""))- say(f" ⚠ {feature.label} moved out of core and its '{feature.plugin}' plugin could not be installed "- f"automatically: {error}. Run `{_install_command(feature.plugin, home)}`.")+ say(_noticed(f" ⚠ {feature.label} moved out of core and its '{feature.plugin}' plugin could not be installed "+ f"automatically: {error}. Run `{_install_command(feature.plugin, home)}`.", home, feature, process_env))return False@@ -769,16 +949,16 @@ def recover_at_startup(*, say: Optional[Callable[[str], None]] = None) -> list[sfrom pm.install import lazy_installs_allowedif not lazy_installs_allowed():for feature in features:- report(f"⚠ {feature.label} moved out of core and its '{feature.plugin}' plugin is not "- f"installed, so it is off. security.allow_lazy_installs is off, so Hermes did not "- f"fetch it: run `{_install_command(feature.plugin, home)}`.")+ report(_noticed(f"⚠ {feature.label} moved out of core and its '{feature.plugin}' plugin is not "+ f"installed, so it is off. security.allow_lazy_installs is off, so Hermes did not "+ f"fetch it: run `{_install_command(feature.plugin, home)}`.", home, feature, True))return []installed = []# Agent init cannot answer a dependency prompt: under the CLI the chat input owns the terminal,# so the question hangs at "Initializing agent...". Every row shipped in core, so its users# already accepted its dependencies (as memory_provider_migration.recover_at_startup does).for feature in features:- if _install_one(home, feature, install=_install_into(home, consent=True), say=report):+ if _install_one(home, feature, install=_install_into(home, consent=True), say=report, process_env=True):installed.append(feature.plugin)if say is not None and feature.platform and _gateway_serves(home):report(f"Restart the gateway (`hermes gateway restart`) so it serves {feature.label}.")diff --git a/hermes_cli/main.py b/hermes_cli/main.pyindex be1381699fb..5ec510975af 100644--- a/hermes_cli/main.py+++ b/hermes_cli/main.py@@ -1932,11 +1932,10 @@ def _resolve_active_provider(config, model_cfg, effective_provider, custom_proviactive,)else:- print(- f"Warning: Unknown provider '{effective_provider}'. Check 'hermes model' for "- "available providers, or run 'hermes doctor' to diagnose config "- "issues. Falling back to auto provider detection."- )+ from hermes_cli.left_core_migration import provider_install_hint+ hint = provider_install_hint(effective_provider) or ("Check 'hermes model' for available providers, or run "+ "'hermes doctor' to diagnose config issues.")+ print(f"Warning: Unknown provider '{effective_provider}'. {hint} Falling back to auto provider detection.")if not active:try:active = resolve_provider("auto")diff --git a/hermes_cli/model_switch.py b/hermes_cli/model_switch.pyindex a11eccfc21e..835a3bad8b1 100644--- a/hermes_cli/model_switch.py+++ b/hermes_cli/model_switch.py@@ -1052,6 +1052,9 @@ def _ollama_configured_base() -> tuple[dict, str]:def _unknown_provider_message(explicit_provider: str) -> str:+ from hermes_cli.left_core_migration import provider_install_hint+ if moved := provider_install_hint(explicit_provider):+ return f"Unknown provider '{explicit_provider}'. {moved}"msg = (f"Unknown provider '{explicit_provider}'. Check 'hermes model' for available "f"providers, or define it in config.yaml under 'providers:'.")diff --git a/hermes_cli/providers.py b/hermes_cli/providers.pyindex c3789277ae5..b47a6bbb48c 100644--- a/hermes_cli/providers.py+++ b/hermes_cli/providers.py@@ -236,6 +236,9 @@ def get_provider(name: str, *, allow_network: bool = True) -> Optional[ProviderD"""Look up a built-in provider by id or alias: models.dev catalog merged with the Hermes overlay;Hermes-only overlay (nous, openai-codex, …); plugin provider profiles with a concrete endpoint."""canonical = normalize_provider(name)+ from hermes_cli.left_core_migration import provider_left_core+ if provider_left_core(canonical): # its plugin is not loaded: models.dev must not stand in for it+ return Nonemdev_info = _models_dev_info(canonical, allow_network)overlay, overlay_label = _get_overlay(canonical)if mdev_info is not None:diff --git a/hermes_cli/runtime_provider.py b/hermes_cli/runtime_provider.pyindex 78a9251767c..607a47aee69 100644--- a/hermes_cli/runtime_provider.py+++ b/hermes_cli/runtime_provider.py@@ -1059,6 +1059,8 @@ def resolve_runtime_provider(*, requested: Optional[str] = None, explicit_api_ketarget_model overrides model_cfg["default"] when computing provider-specific api_mode (e.g.OpenCode Zen/Go where different models route through different API surfaces)."""requested_provider = resolve_requested_provider(requested)+ from hermes_cli.left_core_migration import recover_for_provider+ recover_for_provider(requested_provider) # a provider whose plugin left core: install it before resolving_raise_if_provider_disabled(requested_provider)# Same alias expansion the auxiliary client applies, so ``provider: openai`` means one thing on# every path (background review, curator, MoA slots, delegation) instead of "Unknown provider".diff --git a/plugins/AGENTS.md b/plugins/AGENTS.mdindex 34bfd928e72..806d8ac0adf 100644--- a/plugins/AGENTS.md+++ b/plugins/AGENTS.md@@ -43,6 +43,10 @@ command. A hook with no concrete consumer is speculative infrastructure and is routside Hermes) gets an `in_use` that is always False: hint only, never an automatic install.A built-in terminal backend leaves its name off `BUILTIN_BACKEND_NAMES` so the plugin can register it(row field `terminal_backend`: unknown-backend errors name the install command).+ A model provider that leaves core (GitHub Copilot → `github-copilot`) lists its ids and aliases+ (`providers`: unknown-provider errors name the install, runtime resolution installs it first for a+ home that uses it, models.dev never stands in) and the env core kept profile-managed (`profile_env`);+ `notice` adds a per-home sentence to every outcome (a credential source the plugin no longer reads).- **No new third-party-product plugins (June 2026).** Observability/metrics backends, vendor SaaSconnectors, analytics dashboards, paid-service tie-ins ship as standalone plugin repos(`~/.hermes/plugins/` or pip entry point) promoted in Discord `#plugins-skills-and-skins`. Reason:diff --git a/tests/hermes_cli/test_left_core_provider_rows.py b/tests/hermes_cli/test_left_core_provider_rows.pynew file mode 100644index 00000000000..4ac1232b6cd--- /dev/null+++ b/tests/hermes_cli/test_left_core_provider_rows.py@@ -0,0 +1,213 @@+"""``LEFT_CORE`` rows for a model provider that moved into a catalog plugin.++Real config/.env/auth.json/jobs.json files under a temp home. The generic seams (``providers``,+``profile_env``, ``notice``) run through a fake row; the GitHub Copilot row's predicate runs through its+own function, since which config slots count as "this home uses it" is that row's contract.+"""++from __future__ import annotations++import json+from dataclasses import replace+from pathlib import Path++import pytest++import hermes_cli.left_core_migration as lcm++ACME = lcm.LeftCoreFeature(+ plugin="acme-llm", label="Acme LLM", unchanged="your ACME_KEY is unchanged",+ in_use=lambda home, **kw: "acme" in lcm.providers_selected(home, ("acme", "acme-acp"), **kw),+ providers=("acme", "acme-acp"), profile_env=("ACME_CLI_PATH",),+)++[email protected](autouse=True)+def _fresh(monkeypatch):+ monkeypatch.setattr(lcm, "_attempted", set())+ monkeypatch.setattr(lcm, "_undelivered", {})+ for name in ("HERMES_INFERENCE_PROVIDER", "COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN", "ACME_CLI_PATH"):+ monkeypatch.delenv(name, raising=False)+ import hermes_cli.memory_provider_migration as mpm+ monkeypatch.setattr(mpm, "catalog_source", lambda name: name) # never the network+++def _home(tmp_path: Path, *, env: str = "", config: str = "", auth: dict | None = None,+ jobs: list | None = None) -> Path:+ home = tmp_path / "home"+ home.mkdir(parents=True)+ if env:+ (home / ".env").write_text(env, encoding="utf-8")+ if config:+ (home / "config.yaml").write_text(config, encoding="utf-8")+ if auth is not None:+ (home / "auth.json").write_text(json.dumps(auth), encoding="utf-8")+ if jobs is not None:+ (home / "cron").mkdir()+ (home / "cron" / "jobs.json").write_text(json.dumps({"jobs": jobs}), encoding="utf-8")+ return home++[email protected](("config", "env", "auth", "jobs"), [+ ("model:\n provider: copilot\n default: gpt-5.4\n", "", None, None),+ ("model:\n provider: GitHub-Copilot\n", "", None, None),+ ("model:\n provider: copilot-acp\n", "", None, None),+ ("fallback_providers:\n - provider: copilot\n model: gpt-5.4\n", "", None, None),+ ("fallback_model:\n provider: github-models\n model: gpt-4.1\n", "", None, None),+ ("auxiliary:\n vision:\n provider: copilot\n", "", None, None),+ ("delegation:\n provider: copilot-acp\n", "", None, None),+ ("delegation:\n fallback_providers:\n - provider: copilot\n model: gpt-5.4\n", "", None, None),+ ("moa:\n presets:\n mine:\n reference_models:\n - provider: copilot\n model: gpt-5.4\n"+ " aggregator:\n provider: nous\n model: hermes-4\n", "", None, None),+ ("", "HERMES_INFERENCE_PROVIDER=copilot\n", None, None),+ ("", "", {"active_provider": "copilot"}, None),+ ("", "", None, [{"id": "j1", "provider": "copilot", "model": "gpt-5.4"}]),+])+def test_copilot_in_use_is_any_provider_slot_naming_it(tmp_path, config, env, auth, jobs):+ assert lcm.copilot_in_use(_home(tmp_path, config=config, env=env, auth=auth, jobs=jobs)) is True++[email protected](("config", "env", "auth"), [+ ("model:\n provider: nous\n", "GH_TOKEN=gho_x\nCOPILOT_GITHUB_TOKEN=gho_y\n", None),+ ("model:\n provider: openrouter\n default: github/copilot-like\n", "", None),+ ("", "", {"credential_pool": {"copilot": [{"source": "gh_cli", "access_token": "t"}]}}),+ ("model: copilot\n", "", None), # a bare model string names a model, not a provider+])+def test_copilot_credentials_alone_are_not_use(tmp_path, config, env, auth):+ assert lcm.copilot_in_use(_home(tmp_path, config=config, env=env, auth=auth)) is False+++def test_process_env_provider_counts_only_for_the_launch_home(tmp_path, monkeypatch):+ home = _home(tmp_path, config="model:\n provider: nous\n")+ monkeypatch.setenv("HERMES_HOME", str(home))+ monkeypatch.setenv("HERMES_INFERENCE_PROVIDER", "copilot")+ assert lcm.copilot_in_use(home) is False+ assert lcm.copilot_in_use(home, process_env=True) is True+++_GH_ONLY = {"credential_pool": {"copilot": [{"source": "gh_cli", "label": "gh auth token", "access_token": "t"}]}}++[email protected](("config", "env", "auth", "notice"), [+ ("model:\n provider: copilot\n", "", _GH_ONLY, True),+ ("model:\n provider: copilot\n", "", None, True),+ ("model:\n provider: copilot\n", "GITHUB_TOKEN=gho_x\n", _GH_ONLY, False),+ ("model:\n provider: copilot\n", "", {"credential_pool": {"copilot": [{"source": "manual"}]}}, False),+ ("model:\n provider: copilot\n", "", {"credential_pool": {"copilot": [{"source": "manual:device_code"}]}},+ False),+ ("model:\n provider: copilot-acp\n", "", None, False), # the Copilot CLI keeps its own login+ ("model:\n provider: nous\n", "", _GH_ONLY, False),+])+def test_relogin_notice_only_for_a_copilot_home_without_a_token_the_plugin_reads(tmp_path, config, env, auth,+ notice):+ text = lcm.copilot_relogin_notice(_home(tmp_path, config=config, env=env, auth=auth))+ assert ("hermes auth add copilot" in text) is notice+++def test_gh_only_home_is_told_to_log_in_on_every_migration_outcome(tmp_path):+ home = _home(tmp_path, config="model:\n provider: copilot\n", auth=_GH_ONLY)+ said = []++ def install(name):+ (home / "plugins" / name).mkdir(parents=True)+ return {"ok": True}++ assert lcm.migrate_home(home, install=install, say=said.append) == ["github-copilot"]+ assert "✓ GitHub Copilot moved out of core" in said[0] and "run `hermes auth add copilot`" in said[0]+ other = _home(tmp_path / "b", config="model:\n provider: copilot\n", auth=_GH_ONLY)+ said.clear()+ lcm.migrate_home(other, install=lambda name: {"ok": False, "error": "network down"}, say=said.append)+ assert "could not be installed automatically" in said[0] and "run `hermes auth add copilot`" in said[0]+++def test_token_home_gets_the_plain_success_line(tmp_path):+ home = _home(tmp_path, config="model:\n provider: copilot\n", env="COPILOT_GITHUB_TOKEN=gho_x\n")+ said = []+ lcm.migrate_home(home, install=lambda name: {"ok": True}, say=said.append)+ assert "COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN" in said[0] and "to sign in" not in said[0]+++# ── generic seams through a fake row ─────────────────────────────────────────────────────────────+++def acme_row(monkeypatch, tmp_path):+ monkeypatch.setattr(lcm, "LEFT_CORE", (ACME,))+ home = _home(tmp_path, config="model:\n provider: acme\n")+ monkeypatch.setenv("HERMES_HOME", str(home))+ import providers+ monkeypatch.setattr(providers, "get_provider_profile", lambda name: None)+ return home+++def test_unknown_left_core_provider_names_the_install_on_every_surface(acme_row):+ from hermes_cli.auth import AuthError, resolve_provider+ from hermes_cli.auth_commands import _unknown_provider_exit+ from hermes_cli.model_switch import _unknown_provider_message++ with pytest.raises(AuthError) as err:+ resolve_provider("acme-acp")+ for text in (str(err.value), str(_unknown_provider_exit("acme")), _unknown_provider_message("ACME")):+ assert "Acme LLM moved out of core into the 'acme-llm' plugin" in text+ assert "hermes plugins install acme-llm" in text+ (acme_row / "plugins" / "acme-llm").mkdir(parents=True) # installed but not loaded+ assert "hermes plugins enable acme-llm" in lcm.provider_install_hint("acme")+ assert lcm.provider_install_hint("other") == ""+++def test_runtime_resolution_installs_the_plugin_first_for_a_home_using_it(acme_row, monkeypatch):+ calls = []+ monkeypatch.setattr(lcm, "recover_at_startup", lambda **kw: calls.append(kw) or [])+ lcm.recover_for_provider("acme")+ assert calls == [{}]+ lcm.recover_for_provider("openrouter")+ (acme_row / "config.yaml").write_text("model:\n provider: nous\n", encoding="utf-8")+ lcm.recover_for_provider("acme") # requested, but this home never chose it: no install+ assert len(calls) == 1+ import providers+ monkeypatch.setattr(providers, "get_provider_profile", lambda name: object())+ (acme_row / "config.yaml").write_text("model:\n provider: acme\n", encoding="utf-8")+ lcm.recover_for_provider("acme") # another plugin already serves it+ assert len(calls) == 1+++def test_profile_env_is_refused_by_env_writers_only_while_the_plugin_is_absent(acme_row, monkeypatch):+ from hermes_cli.config import validate_env_var_name_for_write+ import providers+ monkeypatch.setattr(providers, "list_providers", list)+ with pytest.raises(ValueError, match="denylist"):+ validate_env_var_name_for_write("ACME_CLI_PATH")+ (acme_row / "plugins" / "acme-llm").mkdir(parents=True)+ validate_env_var_name_for_write("ACME_CLI_PATH")+++def test_copilot_row_keeps_the_env_core_kept(monkeypatch):+ """Static, before discovery: the profile-managed scrub and `hermes config set` keep knowing the names,+ and the token/base-URL overrides stay out of children (Tier 2) with no Copilot profile registered."""+ from hermes_cli.config import _EXTRA_ENV_KEYS+ from hermes_cli.env_loader import _PROFILE_MANAGED_ENV_KEYS+ from tools.environments.local_env_policy import _left_core_env+ names = {"HERMES_COPILOT_ACP_COMMAND", "HERMES_COPILOT_ACP_ARGS", "COPILOT_CLI_PATH", "COPILOT_ACP_BASE_URL"}+ assert names <= _PROFILE_MANAGED_ENV_KEYS and names <= _EXTRA_ENV_KEYS+ assert {"COPILOT_GITHUB_TOKEN", "COPILOT_API_BASE_URL"} <= _left_core_env(secrets_only=False)+ assert not {"GH_TOKEN", "GITHUB_TOKEN"} & set(next(f for f in lcm.LEFT_CORE if f.plugin == "github-copilot")+ .private_env)+++def test_models_dev_never_stands_in_for_a_provider_whose_plugin_left_core(acme_row, monkeypatch):+ """models.dev lists the vendor's endpoint under the same id: resolving it there would send the user's+ raw token to that endpoint through a generic client the plugin never was."""+ from types import SimpleNamespace+ import hermes_cli.providers as hp+ monkeypatch.setattr(hp, "_models_dev_info", lambda name, allow_network=True: SimpleNamespace(+ env=("ACME_TOKEN",), name="Acme", api="https://api.acme.test", doc="") if name == "acme" else None)+ assert hp.get_provider("acme") is None+ assert hp.get_provider("acme-acp") is None+ import providers+ monkeypatch.setattr(providers, "get_provider_profile", lambda name: object()) # the plugin is loaded+ assert hp.get_provider("acme").base_url == "https://api.acme.test"+++def test_a_row_without_notice_adds_nothing(tmp_path):+ feature = replace(ACME, notice=lcm._no_notice)+ assert lcm._noticed("x", tmp_path, feature, False) == "x"