The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(plugins): re-pin consent sees a root-layout desktop half too
Teknium990bfbdf6cef
diff --git a/hermes_cli/plugins_cmd_catalog.py b/hermes_cli/plugins_cmd_catalog.pyindex 758a11db4ef..cd01edfb499 100644--- a/hermes_cli/plugins_cmd_catalog.py+++ b/hermes_cli/plugins_cmd_catalog.py@@ -573,10 +573,17 @@ def plugin_surface(manifest: dict, tree: Path) -> dict[str, set]:"tools": _list("provides_tools"), "hooks": _list("provides_hooks", "hooks"),"python_dependencies": _list("python_dependencies"), "requires_auth": _list("requires_auth"),"oauth": oauth_surface(manifest),- "desktop": {"desktop/plugin.js"} if (tree / "desktop" / "plugin.js").is_file() else set(),+ "desktop": _desktop_surface(tree),}+def _desktop_surface(tree: Path) -> set:+ """The desktop entry the tree ships, by the installers' own layout rule (root or ``desktop/``)."""+ from hermes_cli.desktop_plugin_halves import desktop_source+ source = desktop_source(tree)+ return {(source / "plugin.js").relative_to(tree).as_posix()} if source else set()++def surface_delta(old: dict[str, set], new: dict[str, set]) -> dict[str, list[str]]:"""``{surface: [added...]}`` for every surface the new tree widens; empty when nothing widened."""return {k: sorted(new.get(k, set()) - old.get(k, set())) for k in _SURFACE_LABELSdiff --git a/tests/hermes_cli/test_plugin_surface_desktop.py b/tests/hermes_cli/test_plugin_surface_desktop.pynew file mode 100644index 00000000000..eb860608661--- /dev/null+++ b/tests/hermes_cli/test_plugin_surface_desktop.py@@ -0,0 +1,25 @@+"""A re-pin that adds a desktop half is a widened surface whichever layout the half uses.++The installers accept ``plugin.js`` at the package root as well as under ``desktop/``; the re-pin+consent check reads the same rule, so a root-layout half added by a new commit is not waved through.+"""++from pathlib import Path++import pytest++from hermes_cli.plugins_cmd_catalog import plugin_surface, surface_delta++[email protected]("entry", ["plugin.js", "desktop/plugin.js"])+def test_new_desktop_half_widens_the_surface_in_either_layout(tmp_path: Path, entry: str):+ old, new = tmp_path / "old", tmp_path / "new"+ for tree in (old, new):+ tree.mkdir()+ (tree / "plugin.yaml").write_text("name: demo\n")+ (new / entry).parent.mkdir(parents=True, exist_ok=True)+ (new / entry).write_text("export default {}\n")++ delta = surface_delta(plugin_surface({"name": "demo"}, old), plugin_surface({"name": "demo"}, new))++ assert delta.get("desktop") == [entry]