The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): say which app is missing when an install is refused
Teknium8d327d9d929f
diff --git a/hermes_cli/plugins_cmd_catalog.py b/hermes_cli/plugins_cmd_catalog.pyindex 7c3553207a5..efe12e1e5f0 100644--- a/hermes_cli/plugins_cmd_catalog.py+++ b/hermes_cli/plugins_cmd_catalog.py@@ -286,7 +286,7 @@ def install_catalog_entry(entry: PluginCatalogEntry, *, force: bool, ref: Optiontarget, manifest, installed_name = _install_plugin_core(entry.install_identifier, force=force, ref=ref or entry.sha, scan_decision_cb=scan_decision_cb,reviewed_pin=entry.sha, python_deps=python_deps, assume_deps_consent=assume_deps_consent,- allow_removed=allow_removed, before_swap=before_swap,+ allow_removed=allow_removed, before_swap=before_swap, app_title=entry.title or None,catalog={"name": entry.name, "repo": entry.repo, "tier": entry.tier, "pin": entry.sha})return target, manifest, installed_namediff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.pyindex ded3fef3d44..19c260e8e4f 100644--- a/hermes_cli/plugins_cmd_install.py+++ b/hermes_cli/plugins_cmd_install.py@@ -297,29 +297,30 @@ def _ensure_tree_readable(root: Path, plugins_dir: Path) -> None:) from exc-def _refuse_unavailable_portable_plugin(plugin_name: str, tree: Path) -> None:+def _refuse_unavailable_portable_plugin(plugin_name: str, tree: Path, app_title: Optional[str] = None) -> None:+ """Refuse a portable plugin whose app is missing here, in the same sentence the runtime surfaces use.++ *app_title* is the catalog's human name for the app ("Blender"); without it the server name stands in."""if not (tree / "plugin.json").is_file():returnfrom hermes_cli.agent_plugins import load_agent_plugin- from hermes_platform.declaration import gpu_labelfrom hermes_platform.resolver.availability import availability+ from tools.mcp_liveness import availability_problem, describetry:package = load_agent_plugin(tree, tree.parent / ".hermes-install-data")except ValueError as exc:raise _pc().PluginOperationError(f"Plugin '{plugin_name}' is unavailable: {exc}.",failure_class="manifest_invalid") from exc- for server_name, server_decl in package.server_declarations.items():+ for server_decl in package.server_declarations.values():result = availability(server_decl.declaration)if result.offerable:continue- found = f", found version {result.version}" if result.version else ""- if result.state == "unsupported_gpu":- found = f", needs {gpu_label(server_decl.declaration.required_gpu)}"- raise _pc().PluginOperationError(- f"Plugin '{plugin_name}' server '{server_name}' is unavailable: {result.state}{found}.",- failure_class="incompatible",- )+ problem = availability_problem(result)+ reason = (describe(server_decl.declaration, result, problem, display_name=app_title)+ if problem else f"its app is unavailable ({result.state}).")+ raise _pc().PluginOperationError(f"Can't install plugin '{plugin_name}': {reason}",+ failure_class="incompatible")def _known_issue_warnings(entry) -> list[str]:@@ -368,6 +369,7 @@ def _install_plugin_core(catalog: Optional[dict] = None,allow_removed: bool = False,before_swap=None,+ app_title: Optional[str] = None,) -> tuple[Path, dict, str]:"""Clone a Git plugin and atomically record its source and exact revision.@@ -454,7 +456,7 @@ def _install_plugin_core(raise _pc().PluginOperationError("--no-deps cannot replace an active plugin. Retry without --no-deps; ""PM must prepare its dependencies before publication.", failure_class="already_installed")- _refuse_unavailable_portable_plugin(plugin_name, tmp_target)+ _refuse_unavailable_portable_plugin(plugin_name, tmp_target, app_title)if target.exists() and not force:from pm.environments import cli_command_namediff --git a/tests/hermes_cli/test_plugins_cmd.py b/tests/hermes_cli/test_plugins_cmd.pyindex 320e308b01e..c6190137470 100644--- a/tests/hermes_cli/test_plugins_cmd.py+++ b/tests/hermes_cli/test_plugins_cmd.py@@ -50,7 +50,7 @@ def test_portable_install_gate_accepts_present_app_and_refuses_missing(tmp_path:_refuse_unavailable_portable_plugin("example-plugin", tmp_path)app.unlink()- with pytest.raises(PluginOperationError, match="example-plugin.*worker.*missing_app"):+ with pytest.raises(PluginOperationError, match="example-plugin.*worker is not installed. Install worker"):_refuse_unavailable_portable_plugin("example-plugin", tmp_path)diff --git a/tools/mcp_liveness.py b/tools/mcp_liveness.pyindex d8e4891f358..5bd86f11755 100644--- a/tools/mcp_liveness.py+++ b/tools/mcp_liveness.py@@ -121,6 +121,19 @@ def _action(state: LivenessState, app_name: str, gpu_label: str) -> tuple[str, Rreturn actions[state]+_AVAILABILITY_PROBLEMS: dict[str, LivenessState] = {+ "missing_app": "missing_app",+ "unsupported_os": "missing_app",+ "unsupported_gpu": "unsupported_gpu",+ "version_too_old": "version_too_old",+}+++def availability_problem(available: Availability) -> LivenessState | None:+ """The unavailable state an install-time availability verdict maps to; None when it is not a problem."""+ return _AVAILABILITY_PROBLEMS.get(available.state)++def status(server_name: str) -> Status | None:"""Return the current unavailable state for a registered declaration."""decl = declaration.lookup(server_name)@@ -128,12 +141,9 @@ def status(server_name: str) -> Status | None:return Noneavailable = availability(decl)live = liveness_for(server_name)- if available.state in {"missing_app", "unsupported_os"}:- state: LivenessState = "missing_app"- elif available.state == "unsupported_gpu":- state = "unsupported_gpu"- elif available.state == "version_too_old":- state = "version_too_old"+ problem = availability_problem(available)+ if problem is not None:+ state: LivenessState = problemelif live.kind == "interactive_session" and not facts.interactive_session():state = "no_interactive_session"elif live.kind == "server_json":@@ -172,6 +182,8 @@ def describe(decl: declaration.Declaration, available: Availability, liveness_staction, _retry = _action(liveness_state, app_name, gpu)if liveness_state == "missing_app":reason = f"{app_name} is not installed."+ if available.min_version:+ action = f"Install {app_name} {available.min_version} or newer, then try again."elif liveness_state == "unsupported_gpu":reason = f"{app_name} needs {gpu}; none was found on this machine."elif liveness_state == "version_too_old":