The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Desktop plugin card shows each declared server's state and the sentence that explains it (NS-941) (#119051)
Siddharth Balyan571ceec00607
diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsxindex 0682891ec52..445659dbf56 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.test.tsx@@ -47,12 +47,20 @@ describe('PluginsTab', () => {$connection.set(null)})- it('lists the scoped profile agent plugins with toggles', () => {+ it('renders declared server pills and the unavailable sentence under the description', () => {$agentPlugins.set([{description: 'A test plugin',key: 'demo-plugin',name: 'demo-plugin',+ servers: [+ { name: 'ready-server', sentence: '', state: 'connected' },+ {+ name: 'setup-server',+ sentence: 'Example App is not installed. Install Example App, then try again.',+ state: 'missing_app'+ }+ ],source: 'git',status: 'enabled',version: '1.0.0'@@ -61,7 +69,9 @@ describe('PluginsTab', () => {render(<PluginsTab profile="workbot" />)- expect(screen.getByText('demo-plugin')).toBeTruthy()+ expect(screen.getByTestId('server-pill-ready-server').className).toContain('bg-emerald-500/10')+ expect(screen.getByTestId('server-pill-setup-server').className).toContain('bg-destructive/10')+ expect(screen.getByText('Example App is not installed. Install Example App, then try again.')).toBeTruthy()expect(screen.getByRole('switch', { name: 'Agent: demo-plugin' }).getAttribute('aria-checked')).toBe('true')})diff --git a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsxindex e5d34c15153..cdce8d85e51 100644--- a/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx+++ b/apps/desktop/src/app/capabilities/plugins/plugins-tab.tsx@@ -29,6 +29,7 @@ import {$agentPluginsError,$agentPluginsStatus,type AgentPluginRow,+ type AgentPluginServerState,type AgentPluginUpdateOutcome,type GatewayRequest,isDesktopRelevantPlugin,@@ -149,6 +150,16 @@ function installAgentHalfHere(record: PluginRecord, profile: null | string) {})}+const SERVER_TONE = {+ connected: 'success',+ app_not_running: 'warn',+ endpoint_unavailable: 'warn',+ no_interactive_session: 'warn',+ unknown: 'warn',+ version_too_old: 'destructive',+ missing_app: 'destructive'+} as const satisfies Record<AgentPluginServerState, 'destructive' | 'success' | 'warn'>+function KindBadge({ kind }: { kind: PackageKind }) {const { t } = useI18n()const p = t.skills.plugins@@ -261,6 +272,7 @@ function PackageRow({// was cloned there) can be uninstalled here: bundled plugins are refused by// the backend and entrypoint (pip-installed) ones go with their package.const agentRemovable = agent?.source === 'user' || agent?.source === 'git'+ const unavailableServers = agent?.servers?.filter(server => server.state !== 'connected') ?? []// A STANDALONE desktop plugin (a folder in <HERMES_HOME>/desktop-plugins with// no agent package behind it) is deleted by Electron. A unified package's// desktop half is not offered here: uninstalling the agent half prunes it.@@ -288,6 +300,11 @@ function PackageRow({<KindBadge kind={pkg.kind} /><ProvenancePill pkg={pkg} />{agent?.portable && <Pill>{p.portableBadge}</Pill>}+ {agent?.servers?.map(server => (+ <Pill data-testid={`server-pill-${server.name}`} key={server.name} tone={SERVER_TONE[server.state]}>+ {server.name}: {p.serverStates[server.state]}+ </Pill>+ ))}{desktop?.status === 'error' && <Pill tone="primary">{d.failed}</Pill>}</div>{(desktop?.status === 'error' ? desktop.error : pkg.description) && (@@ -300,6 +317,16 @@ function PackageRow({{desktop?.status === 'error' ? desktop.error : pkg.description}</div>)}+ {unavailableServers.map(server =>+ server.sentence ? (+ <div+ className="mt-0.5 text-[length:var(--conversation-caption-font-size)] break-words text-(--ui-text-secondary)"+ key={server.name}+ >+ {server.sentence}+ </div>+ ) : null+ )}</div>{/* Fixed slot so the switch column stays straight whether or notthis row has a folder to reveal (bundled plugins have none). */}diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 0e181fe918d..746b627da08 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -2059,6 +2059,15 @@ export const en: Translations = {toggleFailed: (name: string) => `Could not toggle ${name}`,legacyBackend: 'This backend predates key-addressed plugin toggles — update Hermes to manage it here.',portableBadge: 'portable',+ serverStates: {+ connected: 'connected',+ app_not_running: 'app not running',+ endpoint_unavailable: 'endpoint unavailable',+ no_interactive_session: 'no interactive session',+ version_too_old: 'version too old',+ missing_app: 'app missing',+ unknown: 'status unknown'+ },catalogTitle: 'Plugin catalog',catalogBrowse: 'Browse',catalogHide: 'Hide the catalog browser',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 26c43d69144..6f43ee6a0ce 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -1764,6 +1764,15 @@ export interface Translations {toggleFailed: (name: string) => stringlegacyBackend: stringportableBadge: string+ serverStates: {+ connected: string+ app_not_running: string+ endpoint_unavailable: string+ no_interactive_session: string+ version_too_old: string+ missing_app: string+ unknown: string+ }catalogTitle: stringcatalogBrowse: stringcatalogHide: stringdiff --git a/apps/desktop/src/store/agent-plugins.test.ts b/apps/desktop/src/store/agent-plugins.test.tsindex 71c2691d8b3..8bf0ccf0e12 100644--- a/apps/desktop/src/store/agent-plugins.test.ts+++ b/apps/desktop/src/store/agent-plugins.test.ts@@ -1,10 +1,26 @@import { describe, expect, it, vi } from 'vitest'-import { $agentPlugins, type AgentPluginRow, isDesktopRelevantPlugin, saveAgentPluginSettings } from './agent-plugins'+import { $agentPlugins, type AgentPluginRow, isDesktopRelevantPlugin, normalizeAgentPluginRow, saveAgentPluginSettings } from './agent-plugins'const row = (partial: Partial<AgentPluginRow>): AgentPluginRow =>({ name: partial.key ?? 'x', status: 'enabled', ...partial }) as AgentPluginRow+describe('normalizeAgentPluginRow', () => {+ it('treats an absent servers field as an empty full snapshot', () => {+ const previous = normalizeAgentPluginRow(+ row({+ key: 'example-plugin',+ servers: [{ name: 'example-server', sentence: '', state: 'connected' }],+ source: 'user'+ })+ )+ const next = normalizeAgentPluginRow(row({ key: 'example-plugin', source: 'user' }))++ expect(previous.servers).toHaveLength(1)+ expect(next.servers).toEqual([])+ })+})+describe('isDesktopRelevantPlugin (#98861)', () => {it('lists the manageable bundled lifecycle plugins and keeps every other built-in hidden', () => {expect(isDesktopRelevantPlugin(row({ key: 'disk-cleanup', source: 'bundled' }))).toBe(true)diff --git a/apps/desktop/src/store/agent-plugins.ts b/apps/desktop/src/store/agent-plugins.tsindex 9454b9d49cf..31526e8b359 100644--- a/apps/desktop/src/store/agent-plugins.ts+++ b/apps/desktop/src/store/agent-plugins.ts@@ -15,6 +15,21 @@ import { notifyError } from '@/store/notifications'* (local spawn, SSH, URL+token) because it rides the session's own transport.*/+export type AgentPluginServerState =+ | 'connected'+ | 'app_not_running'+ | 'endpoint_unavailable'+ | 'no_interactive_session'+ | 'version_too_old'+ | 'missing_app'+ | 'unknown'++export interface AgentPluginServer {+ name: string+ state: AgentPluginServerState+ sentence: string+}+export interface AgentPluginRow {name: string/** Canonical registry key (e.g. `image_gen/fal`) — absent on legacy backends. */@@ -44,6 +59,8 @@ export interface AgentPluginRow {install_dir?: string/** Manifest `config_schema` rendered as a settings form (with current values). */settings_schema?: PluginSettingField[]+ /** Full snapshot of declared application-backed MCP servers. */+ servers?: AgentPluginServer[]}export type PluginSettingFieldType = 'boolean' | 'enum' | 'json' | 'number' | 'secret' | 'string'@@ -63,6 +80,11 @@ export interface PluginSettingField {has_value?: boolean}+export const normalizeAgentPluginRow = (row: AgentPluginRow): AgentPluginRow => ({+ ...row,+ servers: row.servers ?? []+})+/** A `--ref` pin is a full 40-hex commit SHA; branches and tags are refused server-side. */export const COMMIT_SHA_RE = /^[0-9a-f]{40}$/i@@ -139,7 +161,7 @@ export function loadAgentPlugins(request: GatewayRequest, profile?: string | nulreturn}- $agentPlugins.set(result?.plugins ?? [])+ $agentPlugins.set((result?.plugins ?? []).map(normalizeAgentPluginRow))$agentPluginsStatus.set('ready')$agentPluginsError.set(null)} catch (e) {@@ -196,7 +218,9 @@ export async function toggleAgentPlugin(const refreshed = result.pluginif (refreshed) {- $agentPlugins.set($agentPlugins.get().map(row => (row.key === key ? { ...row, ...refreshed } : row)))+ const snapshot = normalizeAgentPluginRow(refreshed)++ $agentPlugins.set($agentPlugins.get().map(row => (row.key === key ? { ...row, ...snapshot } : row)))} else {await loadAgentPlugins(request, profile)}diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex 445fd50a202..c4035818f1b 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -3893,6 +3893,7 @@ export interface AgentPluginRow {portable: booleaninstall_dir: stringhas_desktop_half: boolean+ servers: PluginServerRow[]catalog_name?: string | nullcatalog_tier?: string | nullinstalled_sha?: string | null@@ -3902,6 +3903,12 @@ export interface AgentPluginRow {pinned_sha?: string | nullsettings_schema?: PluginSettingField[] | null}+export interface PluginServerRow {+ name: string+ state: PluginServerState+ sentence: string+}+export type PluginServerState = 'connected' | 'app_not_running' | 'endpoint_unavailable' | 'no_interactive_session' | 'version_too_old' | 'missing_app' | 'unknown'/** One ``config_schema`` key of a plugin manifest, rendered by the Plugins hub (``hermes_cli.plugins_settings.plugin_settings_fields``). ``secret`` fields carry no value: ``env`` names the ``.env`` variable and ``has_value`` whether it is set. */export interface PluginSettingField {key: stringdiff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex bbf0f51f18c..60c30ea202f 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -4256,6 +4256,13 @@"title": "Has Desktop Half","type": "boolean"},+ "servers": {+ "items": {+ "$ref": "#/components/schemas/PluginServerRow"+ },+ "title": "Servers",+ "type": "array"+ },"catalog_name": {"anyOf": [{@@ -4365,7 +4372,8 @@"status","portable","install_dir",- "has_desktop_half"+ "has_desktop_half",+ "servers"],"title": "AgentPluginRow","type": "object"@@ -19368,6 +19376,42 @@"title": "PingResult","type": "object"},+ "PluginServerRow": {+ "additionalProperties": false,+ "properties": {+ "name": {+ "title": "Name",+ "type": "string"+ },+ "state": {+ "$ref": "#/components/schemas/PluginServerState"+ },+ "sentence": {+ "title": "Sentence",+ "type": "string"+ }+ },+ "required": [+ "name",+ "state",+ "sentence"+ ],+ "title": "PluginServerRow",+ "type": "object"+ },+ "PluginServerState": {+ "enum": [+ "connected",+ "app_not_running",+ "endpoint_unavailable",+ "no_interactive_session",+ "version_too_old",+ "missing_app",+ "unknown"+ ],+ "title": "PluginServerState",+ "type": "string"+ },"PluginSettingField": {"additionalProperties": false,"description": "One ``config_schema`` key of a plugin manifest, rendered by the Plugins hub\n(``hermes_cli.plugins_settings.plugin_settings_fields``). ``secret`` fields carry no value: ``env``\nnames the ``.env`` variable and ``has_value`` whether it is set.",diff --git a/tests/tui_gateway/test_plugins_manage_install.py b/tests/tui_gateway/test_plugins_manage_install.pyindex 57c0fb30299..22b503ecae4 100644--- a/tests/tui_gateway/test_plugins_manage_install.py+++ b/tests/tui_gateway/test_plugins_manage_install.py@@ -1,5 +1,6 @@"""Gateway plugins.manage install action."""+from types import SimpleNamespacefrom unittest.mock import patchfrom tui_gateway import server@@ -145,3 +146,43 @@ def test_plugins_manage_list_reports_desktop_half(tmp_path):by_name = {r["name"]: r for r in resp["result"]["plugins"]}assert by_name["media"]["has_desktop_half"] is Trueassert by_name["snap"]["has_desktop_half"] is False+ assert by_name["snap"]["servers"] == []+++def test_plugins_manage_list_reports_declared_server_snapshot(tmp_path):+ plugin_dir = tmp_path / "example-plugin"+ plugin_dir.mkdir()+ package = SimpleNamespace(+ manifest={+ "extensions": {+ "com.nousresearch.hermes": {+ "servers": {"example-server": {}}+ }+ }+ }+ )+ current = SimpleNamespace(state="missing_app", availability=object())+ liveness = SimpleNamespace(+ status=lambda _name: current,+ describe=lambda _decl, _availability, _state: "Example App is not installed. Install Example App, then try again.",+ )+ rows = [("example-plugin", "1.0", "Example", "user", plugin_dir, "example-plugin")]+ import_module = server._tools_mod++ with patch("hermes_cli.plugins_cmd._discover_all_plugins", return_value=rows), \+ patch("hermes_cli.plugins_cmd._get_enabled_set", return_value=set()), \+ patch("hermes_cli.plugins_cmd._get_disabled_set", return_value=set()), \+ patch("hermes_cli.plugins_cmd._is_portable_plugin_dir", return_value=True), \+ patch("hermes_cli.agent_plugins.load_agent_plugin", return_value=package), \+ patch("hermes_platform.declaration.lookup", return_value=object()), \+ patch("tools.mcp_tool_scope._resolve_server_key", return_value="example-plugin__example-server"), \+ patch("hermes_cli.plugins_cmd_catalog.catalog_pins", return_value={}), \+ patch("tui_gateway.server._tools_mod", wraps=import_module) as modules:+ modules.side_effect = lambda name: liveness if name == "tools.mcp_liveness" else import_module(name)+ resp = server.handle_request({"id": "1", "method": "plugins.manage", "params": {"action": "list"}})++ assert resp["result"]["plugins"][0]["servers"] == [{+ "name": "example-server",+ "state": "missing_app",+ "sentence": "Example App is not installed. Install Example App, then try again.",+ }]diff --git a/tui_gateway/contracts/tools_mcp_plugins.py b/tui_gateway/contracts/tools_mcp_plugins.pyindex 4ec4a16f3e3..c46603830fc 100644--- a/tui_gateway/contracts/tools_mcp_plugins.py+++ b/tui_gateway/contracts/tools_mcp_plugins.py@@ -632,6 +632,22 @@ class PluginSettingField(Result):has_value: bool | None = None+class PluginServerState(WireEnum):+ connected = "connected"+ app_not_running = "app_not_running"+ endpoint_unavailable = "endpoint_unavailable"+ no_interactive_session = "no_interactive_session"+ version_too_old = "version_too_old"+ missing_app = "missing_app"+ unknown = "unknown"+++class PluginServerRow(Result):+ name: str+ state: PluginServerState+ sentence: str++class AgentPluginRow(Result):"""``methods_tools._plugin_rows`` + ``plugins_cmd_catalog.catalog_row_fields`` provenance."""@@ -644,6 +660,7 @@ class AgentPluginRow(Result):portable: boolinstall_dir: strhas_desktop_half: bool+ servers: list[PluginServerRow]catalog_name: str | None = Nonecatalog_tier: str | None = Noneinstalled_sha: str | None = Nonediff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.pyindex b88988aca65..e29953f10d6 100644--- a/tui_gateway/methods_tools.py+++ b/tui_gateway/methods_tools.py@@ -1472,6 +1472,40 @@ def _(rid, params: dict) -> dict:# ─── Plugins ─────────────────────────────────────────────────────────────────+def _plugin_server_rows(plugin_dir: Path | None, key: str, *, portable: bool) -> list[dict]:+ if not portable or plugin_dir is None:+ return []+ package = _tools_mod("hermes_cli.agent_plugins").load_agent_plugin(plugin_dir, plugin_dir)+ namespace = package.manifest.get("extensions", {}).get("com.nousresearch.hermes", {})+ declared = namespace.get("servers", {})+ if not isinstance(declared, dict):+ return []+ server_namespace = _tools_mod("hermes_cli.plugins_manifest")._portable_skill_namespace(key)+ liveness = _tools_mod("tools.mcp_liveness")+ core = _tools_mod("tools.mcp_tool_common")._core+ resolve_key = _tools_mod("tools.mcp_tool_scope")._resolve_server_key+ rows = []+ for name in sorted(declared):+ internal_name = f"{server_namespace}__{name}"+ connection_key = resolve_key(internal_name)+ server = core._servers.get(connection_key)+ connected = server is not None and (server.session is not None or server._is_recycled_stdio())+ if connected:+ rows.append({"name": name, "state": "connected", "sentence": ""})+ continue+ decl = _tools_mod("hermes_platform.declaration").lookup(internal_name)+ status = liveness.status(internal_name)+ if decl is None or status is None:+ rows.append({"name": name, "state": "unknown", "sentence": ""})+ continue+ rows.append({+ "name": name,+ "state": status.state,+ "sentence": liveness.describe(decl, status.availability, status.state),+ })+ return rows++def _plugin_rows() -> list[dict]:pc = _tools_mod("hermes_cli.plugins_cmd")cat = _tools_mod("hermes_cli.plugins_cmd_catalog")@@ -1489,13 +1523,15 @@ def _plugin_rows() -> list[dict]:# ``has_desktop_half``: the package also ships a Desktop UI half (``desktop/plugin.js``). The# desktop app pairs its app-level copy of that half with this row so one package is ONE row._dir_path = Path(str(_dir)) if _dir else None+ portable = pc._is_portable_plugin_dir(_dir)out.append({"name": name, "key": key, "version": str(version or ""), "description": desc or "",- "source": source, "status": status, "portable": pc._is_portable_plugin_dir(_dir),+ "source": source, "status": status, "portable": portable,"install_dir": str(_dir_path) if _dir_path else "","has_desktop_half": bool(_dir_path and (_dir_path / "desktop" / "plugin.js").is_file()),# Manifest ``config_schema`` + current values: the Plugins hub renders these as a form."settings_schema": _tools_mod("hermes_cli.plugins_settings").plugin_settings_fields(key, _dir_path),+ "servers": _plugin_server_rows(_dir_path, key, portable=portable),**cat.catalog_row_fields(_dir, pins, versions),**({"pinned_sha": sha} if (sha := pc.pinned_revision(name, ref_pins)) else {})})return out