Skip to content

The agent that grows with you

fix(plugins): Desktop and the dashboard update git-installed plugins through the CLI's path

alt-glitch3ac037670a09
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index c09bab44355..36eb31e0646 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -4361,7 +4361,7 @@ export interface PluginToolsetRow {
label: string
description: string
}
-/** ``toggle``: ``key``/``name`` + ``enable``; ``install``: ``identifier``/``repo`` or ``catalog_name`` (+ ``force``, ``enable``, ``ref``); ``update``: ``name`` (+ ``accept_capabilities`` to apply a re-pin that widened the plugin after the user confirmed the ``delta``); ``remove``: ``name`` (user installs only); ``settings``: ``key`` + ``values`` (``{setting_key: value}``, non-secret schema keys only); ``presence``: ``names`` (catalog names, answered in that order). */
+/** ``toggle``: ``key``/``name`` + ``enable``; ``install``: ``identifier``/``repo`` or ``catalog_name`` (+ ``force``, ``enable``, ``ref``); ``update``: ``name`` (+ ``accept_capabilities`` to apply a re-pin that widened the plugin after the user confirmed the ``delta``, + ``force`` to apply an update whose security scan returned caution after the user saw the findings); ``remove``: ``name`` (user installs only); ``settings``: ``key`` + ``values`` (``{setting_key: value}``, non-secret schema keys only); ``presence``: ``names`` (catalog names, answered in that order). */
export interface PluginsManageParams {
profile?: string | null
action?: PluginsAction
@@ -4378,7 +4378,7 @@ export interface PluginsManageParams {
names?: string[] | null
}
export type PluginsAction = 'list' | 'toggle' | 'install' | 'update' | 'remove' | 'settings' | 'onboarding' | 'presence'
-/** ``list`` → ``plugins`` + counts; ``toggle`` → ``ok``/``unchanged``/``restart_required``/``name`` (the canonical key written)/``plugin``; ``install`` → ``hermes_cli.plugins_cmd.dashboard_install_plugin``'s ok payload; ``toggle``/``install``/``update`` that loaded a plugin also carry ``gateway_reloaded`` (the running gateway picked it up and re-wired its handlers) and ``activation`` — the honest split of what is live now vs deferred, so ``restart_required`` is True only when no gateway answered; ``update`` → ``ok``/``unchanged``/``sha``, or ``ok=false`` + ``consent_required`` with the ``delta`` (``{surface: [added...]}``) / ``delta_lines`` a widened pin adds — nothing changed until the client retries with ``accept_capabilities``; ``remove`` → ``ok``/``name`` plus ``cleared_memory_provider`` when the removed plugin was the live ``memory.provider``. */
+/** ``list`` → ``plugins`` + counts; ``toggle`` → ``ok``/``unchanged``/``restart_required``/``name`` (the canonical key written)/``plugin``; ``install`` → ``hermes_cli.plugins_cmd.dashboard_install_plugin``'s ok payload; ``toggle``/``install``/``update`` that loaded a plugin also carry ``gateway_reloaded`` (the running gateway picked it up and re-wired its handlers) and ``activation`` — the honest split of what is live now vs deferred, so ``restart_required`` is True only when no gateway answered; ``update`` → ``ok``/``unchanged``/``sha``, or ``ok=false`` + ``consent_required`` with the ``delta`` (``{surface: [added...]}``) / ``delta_lines`` a widened pin adds — nothing changed until the client retries with ``accept_capabilities`` — or ``ok=false`` + ``scan_blocked`` with ``scan_verdict`` / ``scan_findings`` (retry a caution verdict with ``force``); ``remove`` → ``ok``/``name`` plus ``cleared_memory_provider`` when the removed plugin was the live ``memory.provider``. */
export interface PluginsManageResult {
plugins?: AgentPluginRow[] | null
user_count?: number | null
@@ -4402,6 +4402,9 @@ export interface PluginsManageResult {
consent_required?: boolean | null
delta?: Record<string, string[]> | null
delta_lines?: string[] | null
+ scan_blocked?: boolean | null
+ scan_verdict?: string | null
+ scan_findings?: PluginScanFinding[] | null
error?: string | null
written?: string[] | null
onboarding?: OnboardingCatalogPlugin[] | null
@@ -4425,6 +4428,7 @@ export interface AgentPluginRow {
catalog_sha?: string | null
catalog_version?: string | null
update_available?: boolean | null
+ latest_sha?: string | null
pinned_sha?: string | null
settings_schema?: PluginSettingField[] | null
}
@@ -4472,6 +4476,15 @@ export interface PluginLiveSkill {
name: string
description?: string
}
+/** One security-scan finding (``tools.plugin_guard``) on a plugin tree the scan blocked. */
+export interface PluginScanFinding {
+ pattern_id: string
+ severity: string
+ category: string
+ file: string
+ line: number
+ description: string
+}
/** A catalog plugin curated for the onboarding card (``onboarding: true``) that this OS runs. ``app_state`` is the pinned ``plugin.json`` declaration judged on this host; ``sentence`` names what is missing (empty when present or unknown). */
export interface OnboardingCatalogPlugin {
name: string
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index 5c84266469e..f0ad9d2b77f 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -5092,6 +5092,18 @@
"default": null,
"title": "Update Available"
},
+ "latest_sha": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Latest Sha"
+ },
"pinned_sha": {
"anyOf": [
{
@@ -27319,6 +27331,46 @@
"title": "PluginLiveSkill",
"type": "object"
},
+ "PluginScanFinding": {
+ "additionalProperties": false,
+ "description": "One security-scan finding (``tools.plugin_guard``) on a plugin tree the scan blocked.",
+ "properties": {
+ "pattern_id": {
+ "title": "Pattern Id",
+ "type": "string"
+ },
+ "severity": {
+ "title": "Severity",
+ "type": "string"
+ },
+ "category": {
+ "title": "Category",
+ "type": "string"
+ },
+ "file": {
+ "title": "File",
+ "type": "string"
+ },
+ "line": {
+ "title": "Line",
+ "type": "integer"
+ },
+ "description": {
+ "title": "Description",
+ "type": "string"
+ }
+ },
+ "required": [
+ "pattern_id",
+ "severity",
+ "category",
+ "file",
+ "line",
+ "description"
+ ],
+ "title": "PluginScanFinding",
+ "type": "object"
+ },
"PluginServerRow": {
"additionalProperties": false,
"properties": {
@@ -27555,7 +27607,7 @@
},
"PluginsManageParams": {
"additionalProperties": false,
- "description": "``toggle``: ``key``/``name`` + ``enable``; ``install``: ``identifier``/``repo`` or ``catalog_name``\n(+ ``force``, ``enable``, ``ref``); ``update``: ``name`` (+ ``accept_capabilities`` to apply a re-pin\nthat widened the plugin after the user confirmed the ``delta``); ``remove``: ``name`` (user installs only);\n``settings``: ``key`` + ``values`` (``{setting_key: value}``, non-secret schema keys only);\n``presence``: ``names`` (catalog names, answered in that order).",
+ "description": "``toggle``: ``key``/``name`` + ``enable``; ``install``: ``identifier``/``repo`` or ``catalog_name``\n(+ ``force``, ``enable``, ``ref``); ``update``: ``name`` (+ ``accept_capabilities`` to apply a re-pin\nthat widened the plugin after the user confirmed the ``delta``, + ``force`` to apply an update whose\nsecurity scan returned caution after the user saw the findings); ``remove``: ``name`` (user installs only);\n``settings``: ``key`` + ``values`` (``{setting_key: value}``, non-secret schema keys only);\n``presence``: ``names`` (catalog names, answered in that order).",
"properties": {
"profile": {
"anyOf": [
@@ -27715,7 +27767,7 @@
},
"PluginsManageResult": {
"additionalProperties": false,
- "description": "``list`` \u2192 ``plugins`` + counts; ``toggle`` \u2192 ``ok``/``unchanged``/``restart_required``/``name``\n(the canonical key written)/``plugin``; ``install`` \u2192 ``hermes_cli.plugins_cmd.dashboard_install_plugin``'s\nok payload; ``toggle``/``install``/``update`` that loaded a plugin also carry ``gateway_reloaded`` (the\nrunning gateway picked it up and re-wired its handlers) and ``activation`` \u2014 the honest split of what is\nlive now vs deferred, so ``restart_required`` is True only when no gateway answered; ``update`` \u2192 ``ok``/``unchanged``/``sha``, or ``ok=false`` + ``consent_required`` with the\n``delta`` (``{surface: [added...]}``) / ``delta_lines`` a widened pin adds \u2014 nothing changed until the\nclient retries with ``accept_capabilities``; ``remove`` \u2192 ``ok``/``name`` plus\n``cleared_memory_provider`` when the removed plugin was the live ``memory.provider``.",
+ "description": "``list`` \u2192 ``plugins`` + counts; ``toggle`` \u2192 ``ok``/``unchanged``/``restart_required``/``name``\n(the canonical key written)/``plugin``; ``install`` \u2192 ``hermes_cli.plugins_cmd.dashboard_install_plugin``'s\nok payload; ``toggle``/``install``/``update`` that loaded a plugin also carry ``gateway_reloaded`` (the\nrunning gateway picked it up and re-wired its handlers) and ``activation`` \u2014 the honest split of what is\nlive now vs deferred, so ``restart_required`` is True only when no gateway answered; ``update`` \u2192 ``ok``/``unchanged``/``sha``, or ``ok=false`` + ``consent_required`` with the\n``delta`` (``{surface: [added...]}``) / ``delta_lines`` a widened pin adds \u2014 nothing changed until the\nclient retries with ``accept_capabilities`` \u2014 or ``ok=false`` + ``scan_blocked`` with ``scan_verdict`` /\n``scan_findings`` (retry a caution verdict with ``force``); ``remove`` \u2192 ``ok``/``name`` plus\n``cleared_memory_provider`` when the removed plugin was the live ``memory.provider``.",
"properties": {
"plugins": {
"anyOf": [
@@ -28003,6 +28055,45 @@
"default": null,
"title": "Delta Lines"
},
+ "scan_blocked": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Scan Blocked"
+ },
+ "scan_verdict": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Scan Verdict"
+ },
+ "scan_findings": {
+ "anyOf": [
+ {
+ "items": {
+ "$ref": "#/components/schemas/PluginScanFinding"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "title": "Scan Findings"
+ },
"error": {
"anyOf": [
{
diff --git a/hermes_cli/plugins_cadence.py b/hermes_cli/plugins_cadence.py
index f6c7259715a..466c2d82b22 100644
--- a/hermes_cli/plugins_cadence.py
+++ b/hermes_cli/plugins_cadence.py
@@ -30,6 +30,45 @@ def _marker_path() -> Path:
return get_hermes_home() / _MARKERS_DIR / "last-run"
+def _results_path() -> Path:
+ """The last check's per-plugin results, next to the marker (derivation only)."""
+ return _marker_path().parent / "results.json"
+
+
+def record_check_results(results: list) -> None:
+ """Persist a completed check so surfaces that list plugins (the Desktop Plugins tab) can show an
+ update without a network call per listing. Never raises."""
+ import json
+
+ from utils import atomic_write_text
+
+ try:
+ rows = [r.to_json() if hasattr(r, "to_json") else r for r in results]
+ atomic_write_text(_markers_dir() / "results.json", json.dumps(rows, indent=2) + "\n")
+ except (OSError, TypeError, ValueError):
+ pass
+
+
+def cached_git_updates(install_metadata: dict) -> dict[str, str]:
+ """``{plugin name: latest revision}`` for git installs the last check found behind. An entry is
+ dropped once the install record's revision no longer matches what the check compared against
+ (the plugin was updated since), so a stale result never offers an update that already landed."""
+ import json
+
+ try:
+ rows = json.loads(_results_path().read_text(encoding="utf-8-sig"))
+ except (OSError, ValueError):
+ return {}
+ out: dict[str, str] = {}
+ for row in rows if isinstance(rows, list) else ():
+ if not isinstance(row, dict) or row.get("class") != "git" or row.get("update_available") is not True:
+ continue
+ record = install_metadata.get(row.get("name"))
+ if isinstance(record, dict) and record.get("revision") == row.get("current") and row.get("latest"):
+ out[str(row["name"])] = str(row["latest"])
+ return out
+
+
def _markers_dir() -> Path:
"""The markers dir, created on demand — WRITE paths only."""
d = _marker_path().parent
@@ -148,6 +187,9 @@ def _run_check_locked(
results = []
check_ok = False
+ if check_ok:
+ record_check_results(results)
+
try:
from pm import receipt
token = receipt.begin("plugin-check")
diff --git a/hermes_cli/plugins_cmd_update.py b/hermes_cli/plugins_cmd_update.py
index 6ba4ca8ec56..996da00711a 100644
--- a/hermes_cli/plugins_cmd_update.py
+++ b/hermes_cli/plugins_cmd_update.py
@@ -272,6 +272,8 @@ def cmd_check_updates(args: Any | None = None) -> None:
from hermes_cli.plugins_updates import run_checks
results = run_checks(plugins_dir)
+ from hermes_cli.plugins_cadence import record_check_results
+ record_check_results(results)
if getattr(args, "json", False):
print(json.dumps([r.to_json() for r in results], indent=2))
@@ -302,11 +304,16 @@ def cmd_check_updates(args: Any | None = None) -> None:
"hermes plugins update to update them all[/dim]")
-def dashboard_update_user_plugin(name: str, *, accept_capabilities: bool = False) -> dict[str, Any]:
- """``git pull`` inside ``~/.hermes/plugins/<name>``; catalog installs re-pin instead. A re-pin that
- widens the plugin returns ``{"ok": False, "consent_required": True, "delta": {...}}`` with nothing
- changed — the surface shows the delta and retries with *accept_capabilities*."""
+def dashboard_update_user_plugin(name: str, *, accept_capabilities: bool = False, force: bool = False) -> dict[str, Any]:
+ """The one non-interactive update for the dashboard and Desktop: ``git pull`` inside
+ ``~/.hermes/plugins/<name>``; catalog installs re-pin instead. Nothing changes on a refusal:
+ a re-pin that widens the plugin returns ``{"ok": False, "consent_required": True, "delta": {...}}``
+ (retry with *accept_capabilities*), and a git update the security scan blocks returns
+ ``{"ok": False, "scan_blocked": True, "scan_verdict", "scan_findings"}`` (retry a caution verdict
+ with *force* after the user saw the findings; a dangerous verdict never updates)."""
from hermes_cli import plugins_cmd_catalog as catalog
+ from hermes_cli.plugins_activation import activate_plugin_now
+ from hermes_cli.plugins_cmd_install import scan_blocked_result
target = _pc()._user_installed_plugin_dir(name)
if target is None:
return {"ok": False, "error": f"Plugin '{name}' was not found under {_pc()._plugins_dir()}."}
@@ -318,7 +325,6 @@ def dashboard_update_user_plugin(name: str, *, accept_capabilities: bool = False
warnings = list(result.warnings)
new_target = target.parent / result.installed_name
deps = _pc()._python_dependency_summary(new_target, warnings) if result.changed else []
- from hermes_cli.plugins_activation import activate_plugin_now
activated = activate_plugin_now(result.installed_name) if result.changed else {}
return {"ok": True, "name": result.installed_name, "sha": result.sha, "unchanged": not result.changed,
"python_dependencies": deps, "warnings": warnings, **activated}
@@ -328,14 +334,19 @@ def dashboard_update_user_plugin(name: str, *, accept_capabilities: bool = False
f"Plugin '{name}' is pinned to {rec.get('revision')}; "
f"run `hermes plugins install {rec.get('source', '<source>')} --force "
"--ref <40-character commit SHA>` to move it."),
- lambda: f"Plugin '{name}' is not a git checkout; cannot pull updates.")
+ lambda: f"Plugin '{name}' is not a git checkout; cannot pull updates.",
+ force=force)
except catalog.RepinConsentRequired as exc:
return {"ok": False, "consent_required": True, "error": str(exc), "name": exc.name, "sha": exc.sha,
"delta": exc.delta, "delta_lines": catalog.surface_delta_lines(exc.delta)}
+ except _pc().PluginScanBlocked as exc:
+ return {**scan_blocked_result(exc), "name": name}
except _pc().PluginOperationError as exc:
return {"ok": False, "error": str(exc)}
_post_pull_housekeeping(target, _pc()._console())
- return {"ok": True, "name": name, "output": msg, "unchanged": "Already up to date" in msg}
+ unchanged = "Already up to date" in msg
+ activated = {} if unchanged else activate_plugin_now(target.name)
+ return {"ok": True, "name": name, "output": msg, "unchanged": unchanged, **activated}
def _clear_plugin_bytecode(target: Path) -> int:
diff --git a/hermes_cli/web_routers/dashboard_ui.py b/hermes_cli/web_routers/dashboard_ui.py
index f01c11eba53..665e06b6a0f 100644
--- a/hermes_cli/web_routers/dashboard_ui.py
+++ b/hermes_cli/web_routers/dashboard_ui.py
@@ -247,15 +247,17 @@ async def post_agent_plugin_disable(request: Request, name: str):
async def post_agent_plugin_update(request: Request, name: str):
from hermes_cli.plugins_cmd import dashboard_update_user_plugin
# Body is optional: ``{"accept_capabilities": true}`` applies a re-pin the user confirmed after a
- # ``consent_required`` answer.
+ # ``consent_required`` answer; ``{"force": true}`` applies an update whose scan returned caution
+ # after the user saw the ``scan_findings``.
try:
body = await request.json()
except Exception:
body = {}
- accept = isinstance(body, dict) and body.get("accept_capabilities") is True
+ body = body if isinstance(body, dict) else {}
+ accept, force = body.get("accept_capabilities") is True, body.get("force") is True
return await _named_plugin_action(
- request, name, lambda n: dashboard_update_user_plugin(n, accept_capabilities=accept), "Update failed.",
- rescan=True)
+ request, name, lambda n: dashboard_update_user_plugin(n, accept_capabilities=accept, force=force),
+ "Update failed.", rescan=True)
@router.delete("/api/dashboard/agent-plugins/{name:path}")
diff --git a/tests/hermes_cli/test_plugin_update_scan_override.py b/tests/hermes_cli/test_plugin_update_scan_override.py
new file mode 100644
index 00000000000..582daa6728c
--- /dev/null
+++ b/tests/hermes_cli/test_plugin_update_scan_override.py
@@ -0,0 +1,92 @@
+"""Updating a git-installed plugin scans the new code on every surface, and a caution verdict can be
+overridden: ``hermes plugins update NAME`` asks ``Update anyway? [y/N]`` (``--force`` skips the question),
+and Desktop/dashboard get the findings back and retry with ``force``. Before this, update blocked a caution
+verdict with no way past it and told the user to pass a ``--force`` flag the command did not have."""
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from tests.hermes_cli import test_plugin_update_transaction as _tx
+from tests.pm import test_plugin_survival_contract as _survival
+
+# Shared fixtures, bound by assignment so the test parameters that request them are not import shadows.
+installed, admission_env = _tx.installed, _survival.admission_env
+_commit, _head, _version = _tx._commit, _tx._head, _tx._version
+
+
+def _caution_release(repo) -> str:
+ """A new upstream commit the real scanner rates caution (not dangerous)."""
+ _version(repo, "2.0.0")
+ (repo / "helper.py").write_text("eval('1 + 1')\n", encoding="utf-8")
+ return _commit(repo, "caution release")
+
+
[email protected]("installed", ["custom"], indirect=True)
+def test_desktop_update_returns_findings_then_force_applies(installed, monkeypatch):
+ from hermes_cli import plugins_cmd as pc
+ from tui_gateway import server
+
+ _, _home, repo, target, _state = installed
+ old_head = _head(target)
+ new_head = _caution_release(repo)
+ monkeypatch.setattr(pc, "_scan_on_install_enabled", lambda: True)
+
+ def update(**params):
+ resp = server.handle_request({"id": "1", "method": "plugins.manage",
+ "params": {"action": "update", "name": "transactional", **params}})
+ assert "error" not in resp, resp
+ return resp["result"]
+
+ blocked = update()
+ assert blocked["ok"] is False and blocked["scan_blocked"] is True
+ assert blocked["scan_verdict"] == "caution"
+ assert any(f["file"] == "helper.py" for f in blocked["scan_findings"])
+ assert _head(target) == old_head, "a blocked update changed the installed tree"
+
+ applied = update(force=True)
+ assert applied["ok"] is True and applied["unchanged"] is False, applied
+ assert _head(target) == new_head
+
+
[email protected]("installed", ["custom"], indirect=True)
[email protected]("argv_force, answer, published", [
+ (False, "y", True), (False, "n", False), (True, None, True)])
+def test_cli_update_asks_on_caution_and_force_skips_the_question(installed, monkeypatch, argv_force, answer,
+ published):
+ from hermes_cli import plugins_cmd as pc
+
+ _, _home, repo, target, _state = installed
+ old_head = _head(target)
+ new_head = _caution_release(repo)
+ monkeypatch.setattr(pc, "_scan_on_install_enabled", lambda: True)
+ monkeypatch.setattr(pc, "_is_tty", lambda: True)
+ asked: list[str] = []
+ monkeypatch.setattr(pc, "_ask_yes", lambda prompt, reader=None: asked.append(prompt) or answer == "y")
+
+ args = SimpleNamespace(plugins_action="update", name="transactional", yes=False, force=argv_force)
+ if published:
+ pc.plugins_command(args)
+ else:
+ with pytest.raises(SystemExit):
+ pc.plugins_command(args)
+
+ scan_prompts = [p for p in asked if "Update anyway?" in p]
+ assert bool(scan_prompts) is (not argv_force), asked
+ assert _head(target) == (new_head if published else old_head)
+
+
+def test_desktop_rows_offer_a_git_update_only_while_the_check_still_matches_the_install():
+ """The Plugins tab shows a git plugin's Update button from the last update check, with no network call
+ per listing; once the plugin moved past the revision the check compared, the stale result is ignored."""
+ from hermes_cli.plugins_cadence import cached_git_updates, record_check_results
+ from hermes_cli.plugins_updates import CheckResult
+
+ record_check_results([
+ CheckResult(name="tern", klass="git", current="a" * 40, latest="b" * 40, update_available=True),
+ CheckResult(name="spotify", klass="catalog", current="c" * 40, latest="d" * 40, update_available=True),
+ ])
+
+ assert cached_git_updates({"tern": {"revision": "a" * 40}}) == {"tern": "b" * 40}
+ assert cached_git_updates({"tern": {"revision": "b" * 40}}) == {}
diff --git a/tui_gateway/contracts/tools_mcp_plugins.py b/tui_gateway/contracts/tools_mcp_plugins.py
index 75f61b11007..48d2b6769be 100644
--- a/tui_gateway/contracts/tools_mcp_plugins.py
+++ b/tui_gateway/contracts/tools_mcp_plugins.py
@@ -626,7 +626,8 @@ class PluginsAction(WireEnum):
class PluginsManageParams(ProfileParams):
"""``toggle``: ``key``/``name`` + ``enable``; ``install``: ``identifier``/``repo`` or ``catalog_name``
(+ ``force``, ``enable``, ``ref``); ``update``: ``name`` (+ ``accept_capabilities`` to apply a re-pin
- that widened the plugin after the user confirmed the ``delta``); ``remove``: ``name`` (user installs only);
+ that widened the plugin after the user confirmed the ``delta``, + ``force`` to apply an update whose
+ security scan returned caution after the user saw the findings); ``remove``: ``name`` (user installs only);
``settings``: ``key`` + ``values`` (``{setting_key: value}``, non-secret schema keys only);
``presence``: ``names`` (catalog names, answered in that order)."""
@@ -707,6 +708,8 @@ class AgentPluginRow(Result):
catalog_sha: str | None = None
catalog_version: str | None = None
update_available: bool | None = None
+ # git installs: the remote commit the last update check found (``update_available`` is then True).
+ latest_sha: str | None = None
pinned_sha: str | None = None
settings_schema: list[PluginSettingField] | None = None
@@ -775,6 +778,17 @@ class CatalogPluginPresence(Result):
disclosure: str
+class PluginScanFinding(Result):
+ """One security-scan finding (``tools.plugin_guard``) on a plugin tree the scan blocked."""
+
+ pattern_id: str
+ severity: str
+ category: str
+ file: str
+ line: int
+ description: str
+
+
class PluginsManageResult(Result):
"""``list`` → ``plugins`` + counts; ``toggle`` → ``ok``/``unchanged``/``restart_required``/``name``
(the canonical key written)/``plugin``; ``install`` → ``hermes_cli.plugins_cmd.dashboard_install_plugin``'s
@@ -782,7 +796,8 @@ class PluginsManageResult(Result):
running gateway picked it up and re-wired its handlers) and ``activation`` — the honest split of what is
live now vs deferred, so ``restart_required`` is True only when no gateway answered; ``update`` → ``ok``/``unchanged``/``sha``, or ``ok=false`` + ``consent_required`` with the
``delta`` (``{surface: [added...]}``) / ``delta_lines`` a widened pin adds — nothing changed until the
- client retries with ``accept_capabilities``; ``remove`` → ``ok``/``name`` plus
+ client retries with ``accept_capabilities`` — or ``ok=false`` + ``scan_blocked`` with ``scan_verdict`` /
+ ``scan_findings`` (retry a caution verdict with ``force``); ``remove`` → ``ok``/``name`` plus
``cleared_memory_provider`` when the removed plugin was the live ``memory.provider``."""
plugins: list[AgentPluginRow] | None = None
@@ -809,6 +824,11 @@ class PluginsManageResult(Result):
consent_required: bool | None = None
delta: dict[str, list[str]] | None = None
delta_lines: list[str] | None = None
+ # ``update`` of a git install whose new code the security scan blocked: nothing changed. A ``caution``
+ # verdict can be retried with ``force`` once the user saw ``scan_findings``; ``dangerous`` cannot.
+ scan_blocked: bool | None = None
+ scan_verdict: str | None = None
+ scan_findings: list[PluginScanFinding] | None = None
error: str | None = None
written: list[str] | None = None
# ``onboarding`` → the curated catalog plugins for the onboarding card.
diff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.py
index 6b37fc3e18c..41edbbf6e8f 100644
--- a/tui_gateway/methods_tools.py
+++ b/tui_gateway/methods_tools.py
@@ -1661,6 +1661,9 @@ def _plugin_rows() -> list[dict]:
# names. One live-catalog resolution for the whole listing (see ``catalog_rows_maps``).
pins, versions, titles = cat.catalog_rows_maps()
ref_pins = pc._read_install_metadata() # ``--ref`` installs: pinned_sha so the desktop can show the pin
+ # git installs the last update check found behind (the gateway's daily check or `check-updates`); no
+ # network here — the listing must stay fast.
+ git_updates = _tools_mod("hermes_cli.plugins_cadence").cached_git_updates(ref_pins)
out = []
active = pc._category_active_names()
for name, version, desc, source, _dir, key in sorted(pc._discover_all_plugins()):
@@ -1681,6 +1684,8 @@ def _plugin_rows() -> list[dict]:
"settings_schema": _tools_mod("hermes_cli.plugins_settings").plugin_settings_fields(key, _dir_path),
"servers": _plugin_server_rows(_dir_path, key, portable=portable, catalog_titles=titles),
**cat.catalog_row_fields(_dir, pins, versions),
+ **({"update_available": True, "latest_sha": latest}
+ if _dir_path and (latest := git_updates.get(_dir_path.name)) else {}),
**({"pinned_sha": sha} if (sha := pc.pinned_revision(name, ref_pins)) else {})})
return out
@@ -1760,33 +1765,30 @@ def _plugins_install(rid, params):
def _plugins_update(rid, params):
- """Catalog installs only: re-pin to the current catalog SHA (non-catalog installs update via the CLI).
- A pin that widens the plugin (new tools/hooks/deps/capabilities/Desktop half) answers
- ``{ok: false, consent_required: true, delta, delta_lines}`` with nothing changed; the client shows the
- delta and retries with ``accept_capabilities: true``."""
+ """The same update as the dashboard and ``hermes plugins update``: a catalog install re-pins to the
+ current catalog SHA, a git install pulls. Every update is scanned. A refusal changes nothing and
+ answers ``ok: false`` with what the client must show before retrying: ``consent_required`` +
+ ``delta``/``delta_lines`` for a re-pin that widens the plugin (retry with ``accept_capabilities``), or
+ ``scan_blocked`` + ``scan_verdict``/``scan_findings`` for a scan block (retry a caution verdict with
+ ``force``)."""
name = (params.get("name") or "").strip()
if not name:
return _err(rid, 4019, "plugins.update requires a 'name'")
- pc, cat = _tools_mod("hermes_cli.plugins_cmd"), _tools_mod("hermes_cli.plugins_cmd_catalog")
- target = pc._plugins_dir() / name
- sidecar = cat.catalog_install_record(target) if target.is_dir() else None
- if not sidecar:
- return _err(rid, 4020, f"'{name}' is not a catalog install — update it via the CLI")
- try:
- result = cat.repin_catalog_plugin(
- target, sidecar, consent_cb=(lambda _delta: True) if params.get("accept_capabilities") else None)
- except cat.RepinConsentRequired as e:
- return _ok(rid, {"ok": False, "consent_required": True, "name": e.name, "sha": e.sha, "delta": e.delta,
- "delta_lines": cat.surface_delta_lines(e.delta), "error": str(e)})
- except pc.PluginOperationError as e:
- return _err(rid, 4021, str(e))
- payload = {"ok": True, "unchanged": not result.changed, "sha": result.sha, "name": result.installed_name,
- "warnings": list(result.warnings)}
- if result.changed:
- _ensure_plugin_activation_listener()
- activate = _tools_mod("hermes_cli.plugins_activation").activate_plugin_now
- payload = _with_activation({**payload, **activate(result.installed_name)}, result.installed_name)
- return _ok(rid, payload)
+ _ensure_plugin_activation_listener()
+ result = _tools_mod("hermes_cli.plugins_cmd").dashboard_update_user_plugin(
+ name, accept_capabilities=bool(params.get("accept_capabilities")), force=bool(params.get("force")))
+ if result.get("consent_required") or result.get("scan_blocked"):
+ keys = ("ok", "name", "sha", "error", "consent_required", "delta", "delta_lines",
+ "scan_blocked", "scan_verdict", "scan_findings")
+ return _ok(rid, {k: result[k] for k in keys if k in result})
+ if not result.get("ok"):
+ return _err(rid, 4021, result.get("error") or "update failed")
+ payload = {"ok": True, "unchanged": bool(result.get("unchanged")), "name": result.get("name") or name,
+ "warnings": list(result.get("warnings") or []),
+ **{k: result[k] for k in ("sha", "gateway_reloaded", "activation", "restart_required") if k in result}}
+ if result.get("unchanged"):
+ return _ok(rid, payload)
+ return _ok(rid, _with_activation(payload, payload["name"]))
def _plugins_remove(rid, params):
@@ -1859,7 +1861,7 @@ def _(rid, params: dict) -> dict:
"""TUI Plugins Hub backend (shares primitives with ``hermes plugins`` / the dashboard):
``list`` → {plugins, user_count, bundled_count}; ``toggle`` flips ``key``/``name`` per ``enable``;
``install`` git-clones ``identifier``/``repo`` or a curated ``catalog_name`` (``force``, ``enable``
- default True); ``update`` re-pins a catalog install to the current catalog SHA; ``remove`` deletes
+ default True); ``update`` re-pins a catalog install or pulls a git install (``force`` accepts a caution scan); ``remove`` deletes
a user install by ``name``; ``settings`` writes manifest-declared ``values`` for ``key``."""
return _run_action(rid, params, _PLUGINS_ACTIONS, "plugins")
diff --git a/website/docs/user-guide/features/plugins.md b/website/docs/user-guide/features/plugins.md
index b60711f46ae..a9cb9b48098 100644
--- a/website/docs/user-guide/features/plugins.md
+++ b/website/docs/user-guide/features/plugins.md
@@ -424,6 +424,7 @@ hermes plugins install user/repo # install from Git, then prompt Ena
hermes plugins install user/repo --enable # request enable; dependency consent still applies
hermes plugins install user/repo --no-enable # install but leave disabled (no prompt)
hermes plugins update my-plugin # pull latest (local edits are autostashed and re-applied)
+hermes plugins update my-plugin --force # same, accepting a caution security-scan verdict without the question
hermes plugins update # list every plugin with an update, then "Update all N? [Y/n]"
hermes plugins update --yes # same, without the question (scripts, cron; required without a terminal)
hermes plugins remove my-plugin # uninstall; also drops it from plugins.enabled/disabled/entries
@@ -782,6 +783,20 @@ Three verdicts, matching Cowork's pass/warn/fail:
| **caution** | Findings are shown; you confirm `Install anyway? [y/N]` (or pass `--force`) |
| **dangerous** | Blocked. `--force` does **not** override |
+`hermes plugins update` scans the new code with the same rules before it
+replaces the installed copy, so a plugin that picks up risky code in an update
+is flagged before it runs. A caution verdict on a Git update asks
+`Update anyway? [y/N]`, and `hermes plugins update NAME --force` accepts it
+without the question. Hermes Desktop shows the same findings in a dialog with an
+**Update anyway** button. Catalog updates move to a reviewed pin, so a caution
+verdict there does not ask. In every case nothing changes until the update is
+accepted.
+
+Hermes Desktop shows an **Update** button on a Git-installed plugin when the
+last update check found a newer commit. The gateway runs that check every
+`plugins.auto_update_check_hours` (default 24), and `hermes plugins check-updates`
+runs it on demand.
+
On `hermes plugins update`, a dangerous verdict on the updated tree
disables the plugin until you review the findings and re-enable it. A
dangerous block names the critical findings that caused it (e.g.