Skip to content

The agent that grows with you

fix(desktop): a manifest-only plugin is a package, not a desktop-only repo

m0nty8155c8ec01f071
diff --git a/apps/desktop/electron/desktop-plugin-install.test.ts b/apps/desktop/electron/desktop-plugin-install.test.ts
index 1149522f94a..9253d45a6b5 100644
--- a/apps/desktop/electron/desktop-plugin-install.test.ts
+++ b/apps/desktop/electron/desktop-plugin-install.test.ts
@@ -94,6 +94,24 @@ describe('detectPluginComponents', () => {
}
})
+ it('detects a manifest-only package — dashboard backend, no __init__.py', async () => {
+ const root = mkdtemp('hermes-plugin-manifest-only-')
+ roots.push(root)
+ fs.writeFileSync(path.join(root, 'plugin.yaml'), 'name: bulletin\n')
+ fs.mkdirSync(path.join(root, 'dashboard'), { recursive: true })
+ fs.writeFileSync(path.join(root, 'dashboard', 'manifest.json'), '{"name":"bulletin","api":"plugin_api.py"}\n')
+ fs.mkdirSync(path.join(root, 'desktop'), { recursive: true })
+ fs.writeFileSync(path.join(root, 'desktop', 'plugin.js'), 'export default { id: "bulletin" }')
+
+ // Catalog plugins that ship a dashboard API but no register(ctx) are still packages: the
+ // install plan must run the agent half, or the desktop half lands alone and ctx.rest 404s.
+ await expect(detectPluginComponents(root)).resolves.toMatchObject({
+ agent: true,
+ desktop: true,
+ agentName: 'bulletin'
+ })
+ })
+
it('detects agent-only layout', async () => {
const root = mkdtemp('hermes-plugin-agent-')
roots.push(root)
diff --git a/apps/desktop/electron/desktop-plugin-install.ts b/apps/desktop/electron/desktop-plugin-install.ts
index e4adc58dfc8..0e7a7474eab 100644
--- a/apps/desktop/electron/desktop-plugin-install.ts
+++ b/apps/desktop/electron/desktop-plugin-install.ts
@@ -203,9 +203,14 @@ export async function detectPluginComponents(pluginRoot: string): Promise<Plugin
const hasYaml =
pathExistsSync(path.join(pluginRoot, 'plugin.yaml')) || pathExistsSync(path.join(pluginRoot, 'plugin.yml'))
- const hasInit = pathExistsSync(path.join(pluginRoot, '__init__.py'))
const hasPortable = pathExistsSync(path.join(pluginRoot, 'plugin.json'))
- const agent = (hasYaml && hasInit) || hasPortable
+ // A package IS an agent half as soon as it carries a manifest. `__init__.py` is optional:
+ // manifest-only plugins are legitimate (`hermes plugins validate` admits them — they ship a
+ // `dashboard/plugin_api.py` backend and no `register(ctx)`). Requiring the Python entry point
+ // hid those packages from the install plan entirely: `installAgentHalf` never ran, the app
+ // landed the desktop half alone, and every `ctx.rest` call 404'd — on a local backend and on a
+ // remote gateway alike.
+ const agent = hasYaml || hasPortable
const desktopEntry = findDesktopEntry(pluginRoot)
const desktop = desktopEntry !== null
diff --git a/hermes_cli/plugins_cmd_inspect.py b/hermes_cli/plugins_cmd_inspect.py
index bb7dcb16d7a..7c44e2ce88d 100644
--- a/hermes_cli/plugins_cmd_inspect.py
+++ b/hermes_cli/plugins_cmd_inspect.py
@@ -49,12 +49,17 @@ def _manifest_name(path: Path, loads) -> Optional[str]:
def detect_components(root: Path, fallback_name: str) -> dict[str, Any]:
- """Electron's ``detectPluginComponents``: an agent half is ``plugin.yaml``/``plugin.yml`` with
- ``__init__.py``, or a portable ``plugin.json``; a desktop half is ``plugin.js`` at the root or in
- ``desktop/``."""
+ """Electron's ``detectPluginComponents``: an agent half is a ``plugin.yaml``/``plugin.yml`` manifest
+ or a portable ``plugin.json``; a desktop half is ``plugin.js`` at the root or in ``desktop/``.
+
+ ``__init__.py`` is not part of the rule: manifest-only plugins are real packages (a
+ ``dashboard/plugin_api.py`` backend and no ``register(ctx)``), which ``hermes plugins validate``
+ admits and the installer puts down. Requiring the Python entry point made both inspectors report
+ such a repository as desktop-only, so a Desktop install skipped the agent half and every
+ ``ctx.rest`` call answered 404."""
yaml_path = next((root / n for n in ("plugin.yaml", "plugin.yml") if (root / n).is_file()), None)
portable = root / "plugin.json"
- agent = (yaml_path is not None and (root / "__init__.py").is_file()) or portable.is_file()
+ agent = yaml_path is not None or portable.is_file()
desktop = (root / "plugin.js").is_file() or (root / "desktop" / "plugin.js").is_file()
agent_name = None
if agent:
diff --git a/tests/fixtures/plugin_component_detection.json b/tests/fixtures/plugin_component_detection.json
index 90aa05a5f7e..c18c6e8935a 100644
--- a/tests/fixtures/plugin_component_detection.json
+++ b/tests/fixtures/plugin_component_detection.json
@@ -27,10 +27,10 @@
"expect": { "agent": true, "desktop": false, "agent_name": "unnamed-plugin" }
},
{
- "name": "a yaml manifest without __init__.py is not an agent half",
+ "name": "a yaml manifest without __init__.py is still an agent package",
"root": "manifest-only",
"files": { "plugin.yaml": "name: manifest-only\n" },
- "expect": { "agent": false, "desktop": false, "agent_name": null }
+ "expect": { "agent": true, "desktop": false, "agent_name": "manifest-only" }
},
{
"name": "a portable plugin.json is an agent half named by it",