The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): honest capability surfaces for profile editors (#86227)
Tekniumcc1c125cf3a6
diff --git a/tui_gateway/methods_profiles.py b/tui_gateway/methods_profiles.pyindex f2048d77879..5cb37bb09bf 100644--- a/tui_gateway/methods_profiles.py+++ b/tui_gateway/methods_profiles.py@@ -446,7 +446,20 @@ def _(rid, params: dict) -> dict:{"name": skill_name, "enabled": skill_name.lower() not in disabled})- from toolsets import get_all_toolsets, get_toolset_info+ # Toolsets: the same filtered universe the `hermes tools`+ # checklist offers — configurable toolsets (built-in + plugin),+ # minus platform-restricted ones that don't apply here — with+ # enablement resolved the way the runtime actually resolves it.+ # The raw registry (get_all_toolsets) leaks internal platform+ # composites (hermes-discord, feishu_drive, ...) and reports+ # everything "enabled" whenever the profile has no pin, which a+ # capabilities UI then faithfully mis-renders (tester report).+ from hermes_cli.tools_config import (+ _get_effective_configurable_toolsets,+ _get_platform_tools,+ _toolset_allowed_for_platform,+ )+ from toolsets import resolve_toolsettools_cfg = cfg.get("tools") if isinstance(cfg.get("tools"), dict) else {}pinned = tools_cfg.get("enabled_toolsets")@@ -455,15 +468,32 @@ def _(rid, params: dict) -> dict:if isinstance(pinned, list)else None)+ try:+ platform_enabled = set(+ _get_platform_tools(cfg, "cli", include_default_mcp_servers=False)+ )+ except Exception:+ platform_enabled = set()toolsets_out = []- for ts_name in sorted(get_all_toolsets().keys()):- info = get_toolset_info(ts_name) or {}+ for ts_name, ts_label, ts_desc in _get_effective_configurable_toolsets():+ if not _toolset_allowed_for_platform(ts_name, "cli"):+ continue+ try:+ tool_count = len(set(resolve_toolset(ts_name)))+ except Exception:+ tool_count = 0+ enabled = (+ ts_name in pinned_set+ if pinned_set is not None+ else ts_name in platform_enabled+ )toolsets_out.append({"name": ts_name,- "description": info.get("description") or "",- "tool_count": len(info.get("tools") or []),- "enabled": True if pinned_set is None else ts_name in pinned_set,+ "label": ts_label,+ "description": ts_desc or "",+ "tool_count": tool_count,+ "enabled": enabled,})diff --git a/tui_gateway/methods_tools.py b/tui_gateway/methods_tools.pyindex 22d3d3f1de7..90764fd4f22 100644--- a/tui_gateway/methods_tools.py+++ b/tui_gateway/methods_tools.py@@ -1731,6 +1731,23 @@ def _(rid, params: dict) -> dict:@method("skills.manage")def _(rid, params: dict) -> dict:action, query = params.get("action", "list"), params.get("query", "")+ # Optional profile scoping: list/install operate on that profile's+ # skills dir (capabilities UIs manage a bot's skills from the main+ # window). Search/browse/inspect hit the shared hub catalog — the+ # override is harmless there and keeps the semantics uniform.+ profile = str(params.get("profile") or "").strip()+ token = None+ if profile:+ try:+ from hermes_cli.profiles import get_profile_dir+ from hermes_constants import set_hermes_home_override++ profile_dir = get_profile_dir(profile)+ if not profile_dir or not profile_dir.is_dir():+ return _err(rid, 4064, f"profile '{profile}' not found")+ token = set_hermes_home_override(str(profile_dir))+ except Exception as e:+ return _err(rid, 5024, str(e))try:if action == "list":from hermes_cli.banner import get_available_skills@@ -1785,6 +1802,72 @@ def _(rid, params: dict) -> dict:return _err(rid, 4017, f"unknown skills action: {action}")except Exception as e:return _err(rid, 5024, str(e))+ finally:+ if token is not None:+ try:+ from hermes_constants import reset_hermes_home_override++ reset_hermes_home_override(token)+ except Exception:+ pass+++@method("mcp.catalog")+def _(rid, params: dict) -> dict:+ """Bundled MCP catalog with per-profile install/enable state.++ Params: optional ``profile`` (defaults to the launch profile). Result:+ ``{servers: [{name, description, installed, enabled, requires: [env+ keys], transport}]}`` — the same catalog `hermes mcp` offers, so+ capability UIs can present the full menu and know which entries need+ setup (missing requires) before they'll work.+ """+ profile = str(params.get("profile") or "").strip()+ token = None+ try:+ if profile:+ from hermes_cli.profiles import get_profile_dir+ from hermes_constants import set_hermes_home_override++ profile_dir = get_profile_dir(profile)+ if not profile_dir or not profile_dir.is_dir():+ return _err(rid, 4064, f"profile '{profile}' not found")+ token = set_hermes_home_override(str(profile_dir))++ from hermes_cli import mcp_catalog++ out = []+ for entry in mcp_catalog.list_catalog():+ try:+ requires = [str(k) for k in (getattr(entry, "env_keys", None) or [])]+ except Exception:+ requires = []+ out.append(+ {+ "name": entry.name,+ "description": getattr(entry, "description", "") or "",+ "installed": bool(mcp_catalog.is_installed(entry.name)),+ "enabled": bool(mcp_catalog.is_enabled(entry.name)),+ "requires": requires,+ # TransportSpec object — reduce to its kind string.+ "transport": str(+ getattr(getattr(entry, "transport", None), "kind", "")+ or getattr(entry, "transport", "")+ or "stdio"+ ),+ }+ )+ return _ok(rid, {"servers": out})+ except Exception as e:+ return _err(rid, 5024, str(e))+ finally:+ if token is not None:+ try:+ from hermes_constants import reset_hermes_home_override++ reset_hermes_home_override(token)+ except Exception:+ pass@method("skills.reload")