The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
revert(plugins): Desktop, Webapp and dashboard installs take every source the CLI takes
Teknium43ee1b08720c
diff --git a/apps/desktop/electron/desktop-plugin-install.ts b/apps/desktop/electron/desktop-plugin-install.tsindex 940f39327fd..485f3970cb9 100644--- a/apps/desktop/electron/desktop-plugin-install.ts+++ b/apps/desktop/electron/desktop-plugin-install.ts@@ -435,25 +435,6 @@ async function resolvePluginRoot(cloneRoot: string, subdir: string | null): Promreturn resolved}-/** Why a click in the app may not install *identifier*, else null. The app clones over https:// only:- * `file://` copies any local folder, `ssh://`/`git@` signs in with the user's ssh-agent and `http://` is- * unauthenticated. `hermes plugins install` in a terminal keeps every scheme it documents. */-export function guiInstallSourceRefusal(identifier: string): null | string {- let gitUrl: string-- try {- gitUrl = resolvePluginGitUrl(identifier).gitUrl- } catch {- return null // not a source at all: the installer's own error names it- }-- if (gitUrl.startsWith('https://')) {- return null- }-- return 'Plugins are installed from Hermes Desktop over https:// only. Use `hermes plugins install` in a terminal for other sources.'-}-function insecureSchemeWarnings(gitUrl: string): { warnings: string[]; insecure: boolean } {if (gitUrl.startsWith('http://') || gitUrl.startsWith('file://')) {return {diff --git a/apps/desktop/electron/fs-ipc.test.ts b/apps/desktop/electron/fs-ipc.test.tsindex a9b9b8fc7a5..b7ce849154d 100644--- a/apps/desktop/electron/fs-ipc.test.ts+++ b/apps/desktop/electron/fs-ipc.test.ts@@ -10,8 +10,6 @@ import path from 'node:path'import { afterEach, describe, expect, it, vi } from 'vitest'-import type * as DesktopPluginInstall from './desktop-plugin-install'-const electron = vi.hoisted(() => ({handlers: new Map<string, (...args: unknown[]) => unknown>(),showItemInFolder: vi.fn()@@ -30,11 +28,7 @@ vi.mock('electron', () => ({}}))-vi.mock('./desktop-plugin-install', async importOriginal => ({- guiInstallSourceRefusal: (await importOriginal<typeof DesktopPluginInstall>()).guiInstallSourceRefusal,- installDesktopPluginFromGit: vi.fn(async () => ({ ok: true })),- probePluginRepo: vi.fn()-}))+vi.mock('./desktop-plugin-install', () => ({ installDesktopPluginFromGit: vi.fn(), probePluginRepo: vi.fn() }))vi.mock('./desktop-plugins-root', () => ({DESKTOP_PLUGINS_DIR: 'desktop-plugins',ensureDir: vi.fn(async (dir: string) => dir),@@ -42,7 +36,6 @@ vi.mock('./desktop-plugins-root', () => ({reconcileUnifiedDesktopHalves: vi.fn()}))-import { installDesktopPluginFromGit } from './desktop-plugin-install'import { registerFsIpc } from './fs-ipc'const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-fs-ipc-'))@@ -118,31 +111,3 @@ describe('hermes:fs:logsRoot', () => {}})})--// A click in the app clones over https:// only; `hermes plugins install` keeps the other schemes.-describe('hermes:plugin:installDesktop', () => {- const install = (identifier: string) =>- electron.handlers.get('hermes:plugin:installDesktop')!({}, { identifier }) as Promise<{ error?: string; ok: boolean }>-- it.each([- 'file:///srv/plugin',- 'ssh://[email protected]/acme/plugin.git',- '[email protected]:acme/plugin.git',- 'http://example.com/acme/plugin.git'- ])('refuses %s before any clone', async identifier => {- vi.mocked(installDesktopPluginFromGit).mockClear()-- const result = await install(identifier)-- expect(result.ok).toBe(false)- expect(result.error).toContain('https://')- expect(installDesktopPluginFromGit).not.toHaveBeenCalled()- })-- it.each(['https://example.com/acme/plugin.git', 'acme/plugin'])('installs %s', async identifier => {- vi.mocked(installDesktopPluginFromGit).mockClear()-- await expect(install(identifier)).resolves.toMatchObject({ ok: true })- expect(installDesktopPluginFromGit).toHaveBeenCalledOnce()- })-})diff --git a/apps/desktop/electron/fs-ipc.ts b/apps/desktop/electron/fs-ipc.tsindex 6dda7ad2852..87862b2b484 100644--- a/apps/desktop/electron/fs-ipc.ts+++ b/apps/desktop/electron/fs-ipc.ts@@ -9,7 +9,7 @@ import path from 'node:path'import { app, BrowserWindow, dialog, ipcMain, shell } from 'electron'import { platformDefaultHermesHome } from './data-paths'-import { guiInstallSourceRefusal, installDesktopPluginFromGit, probePluginRepo } from './desktop-plugin-install'+import { installDesktopPluginFromGit, probePluginRepo } from './desktop-plugin-install'import { removeDesktopPlugin } from './desktop-plugin-remove'import {DESKTOP_PLUGINS_DIR,@@ -189,12 +189,6 @@ export function registerFsIpc({return { ok: false, error: 'identifier is required' }}- const refusal = guiInstallSourceRefusal(identifier)-- if (refusal) {- return { ok: false, error: refusal }- }-return installDesktopPluginFromGit(resolveGitBinary(),identifier,diff --git a/hermes_cli/plugins_cmd_install.py b/hermes_cli/plugins_cmd_install.pyindex 22176f8f173..1ec9c0f203c 100644--- a/hermes_cli/plugins_cmd_install.py+++ b/hermes_cli/plugins_cmd_install.py@@ -849,25 +849,6 @@ def _resolve_source(identifier: str, catalog_name: Optional[str]) -> tuple:return entry, identifier, warnings, None-def gui_install_source_refusal(identifier: str, catalog_name: Optional[str] = None) -> Optional[str]:- """Why a Desktop/Webapp install of *identifier* is refused, else None.-- A GUI install clones over ``https://`` only: a click there names a source the user may not have- read, and ``file://`` copies any local folder, ``ssh``/``git@`` signs in with the host's ssh-agent,- ``http://`` is unauthenticated. ``hermes plugins install`` keeps accepting every documented scheme.- A *catalog_name* install clones the catalog's own source, so *identifier* is not used."""- if catalog_name:- return None- try:- git_url = _pc()._resolve_git_url(identifier.strip())[0]- except ValueError:- return None # not a source at all: the installer's own error names it- if git_url.startswith("https://"):- return None- return ("Plugins are installed from Hermes Desktop and the Webapp over https:// only. "- "Use `hermes plugins install` in a terminal for other sources.")--def _place_tree(entry, identifier: str, *, force: bool, ref: Optional[str], assume_deps_consent: bool,step: Callable[[InstallPhase], None], inspected_sha: Optional[str] = None) -> tuple | dict:"""``(target, manifest, installed_name)`` of the tree to enable, or the error result. A catalogdiff --git a/hermes_cli/web_routers/dashboard_ui.py b/hermes_cli/web_routers/dashboard_ui.pyindex 34654e2e876..dd774f8a1e6 100644--- a/hermes_cli/web_routers/dashboard_ui.py+++ b/hermes_cli/web_routers/dashboard_ui.py@@ -202,14 +202,11 @@ async def _plugin_mutation(fn: Callable[[], dict]) -> dict:async def post_agent_plugin_install(request: Request, body: _AgentPluginInstallBody):_require_token(request)from hermes_cli.plugins_cmd import dashboard_install_plugin- from hermes_cli.plugins_cmd_install import gui_install_source_refusalcatalog_name = (body.catalog_name or "").strip()identifier = body.identifier.strip()if not identifier and not catalog_name:raise HTTPException(status_code=400, detail="Provide an identifier or a catalog_name.")- if refusal := gui_install_source_refusal(identifier, catalog_name):- raise HTTPException(status_code=400, detail=refusal)result = await _plugin_mutation(lambda: _plugin_action(dashboard_install_plugin(identifier, force=body.force, enable=body.enable, catalog_name=catalog_name or None,diff --git a/tests/hermes_cli/test_web_plugin_install_source.py b/tests/hermes_cli/test_web_plugin_install_source.pydeleted file mode 100644index dac10cf095a..00000000000--- a/tests/hermes_cli/test_web_plugin_install_source.py+++ /dev/null@@ -1,35 +0,0 @@-"""POST /api/dashboard/agent-plugins/install clones over https:// only, like plugins.manage install."""--import pytest---def client(monkeypatch, _isolate_hermes_home):- try:- from starlette.testclient import TestClient- except ImportError:- pytest.skip("fastapi/starlette not installed")- import hermes_state- from hermes_constants import get_hermes_home- from hermes_cli.web_server import app, _SESSION_HEADER_NAME, _SESSION_TOKEN-- monkeypatch.setattr(hermes_state, "DEFAULT_DB_PATH", get_hermes_home() / "state.db")- c = TestClient(app)- c.headers[_SESSION_HEADER_NAME] = _SESSION_TOKEN- return c---def test_install_endpoint_refuses_non_https_sources_and_passes_https(client, monkeypatch):- from hermes_cli import plugins_cmd- seen = []- monkeypatch.setattr(plugins_cmd, "dashboard_install_plugin",- lambda ident, **k: seen.append(ident) or {"ok": False, "error": "stub"})-- for identifier in ("file:///srv/plugin", "ssh://[email protected]/a/p.git", "[email protected]:a/p.git",- "http://example.com/a/p.git"):- resp = client.post("/api/dashboard/agent-plugins/install", json={"identifier": identifier})- assert resp.status_code == 400 and "https://" in resp.json()["detail"], identifier- assert seen == []-- client.post("/api/dashboard/agent-plugins/install", json={"identifier": "https://example.com/a/p.git"})- assert seen == ["https://example.com/a/p.git"]diff --git a/tests/tui_gateway/test_plugins_manage_install_source.py b/tests/tui_gateway/test_plugins_manage_install_source.pydeleted file mode 100644index b9b34f328f6..00000000000--- a/tests/tui_gateway/test_plugins_manage_install_source.py+++ /dev/null@@ -1,38 +0,0 @@-"""plugins.manage install (Desktop and Webapp) clones over https:// only; the CLI keeps every scheme."""--import pytest--from tui_gateway import server--REFUSED = ["file:///srv/plugin", "ssh://[email protected]/acme/plugin.git", "[email protected]:acme/plugin.git",- "http://example.com/acme/plugin.git"]---def _install(**params):- return server.handle_request({"id": "1", "method": "plugins.manage", "params": {"action": "install", **params}})--[email protected]("identifier", REFUSED)-def test_non_https_source_is_refused_before_any_clone(identifier, monkeypatch):- from hermes_cli import plugins_cmd- monkeypatch.setattr(plugins_cmd, "dashboard_install_plugin", lambda *a, **k: pytest.fail("installer ran"))-- resp = _install(identifier=identifier)-- assert "https://" in resp["error"]["message"]--[email protected]("params", [- {"identifier": "https://example.com/acme/plugin.git"}, {"identifier": "acme/plugin"},- # A catalog install clones the catalog's own source, whatever identifier rides along.- {"identifier": "file:///srv/plugin", "catalog_name": "alpha"},-])-def test_https_shorthand_and_catalog_sources_reach_the_installer(params, monkeypatch):- from hermes_cli import plugins_cmd- seen = []- monkeypatch.setattr(plugins_cmd, "dashboard_install_plugin",- lambda ident, **k: seen.append(ident) or {"ok": False, "error": "stub"})-- _install(**params)-- assert len(seen) == 1diff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.pyindex 6a42ba986b4..2bd46cb1db7 100644--- a/tui_gateway/methods_tools.py+++ b/tui_gateway/methods_tools.py@@ -1767,8 +1767,6 @@ def _plugins_install(rid, params):catalog_name = str(params.get("catalog_name") or "").strip()if not ident and not catalog_name:return _err(rid, 4019, "plugins.install requires 'identifier', 'repo', or 'catalog_name'")- if refusal := _tools_mod("hermes_cli.plugins_cmd_install").gui_install_source_refusal(ident, catalog_name):- return _err(rid, 5026, refusal)_ensure_plugin_activation_listener()result = _tools_mod("hermes_cli.plugins_cmd").dashboard_install_plugin(ident, force=bool(params.get("force")), enable=params.get("enable", True), catalog_name=catalog_name or None,diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.mdindex d843f95f044..d60ee040a0e 100644--- a/website/docs/user-guide/desktop.md+++ b/website/docs/user-guide/desktop.md@@ -791,11 +791,11 @@ picker installs reviewed entries at their pinned commit into the selectedprofile, and **Install from Git** takes any other repository through the samereview-then-install dialog; its optional **Pin to commit** field installs oneexact 40-character commit SHA (private repos included), and pinned plugins-carry a `pinned @ <sha8>` badge in the list. Desktop and the Webapp install-from `https://` sources (or `owner/repo` shorthand) only, and refuse a desktop-plugin folder that contains a symbolic link; `hermes plugins install` in a-terminal still takes `git@`/`ssh://`, `http://` and `file://` sources. Old-`Settings → Plugins` links redirect here.+carry a `pinned @ <sha8>` badge in the list. **Install from Git** takes any+git source `hermes plugins install` accepts, including private repos over+`git@`/`ssh://` and local folders (`file://`). A desktop plugin folder that+contains a symbolic link is refused. Old `Settings → Plugins` links redirect+here.## Troubleshooting