Skip to content

The agent that grows with you

fix(cli): /toolsets reads the gateway session's report

kshitijk4poore3fbd32d265c
diff --git a/hermes_cli/gateway_setting_commands.py b/hermes_cli/gateway_setting_commands.py
index fc6f5466627..5ab9193ebdb 100644
--- a/hermes_cli/gateway_setting_commands.py
+++ b/hermes_cli/gateway_setting_commands.py
@@ -9,6 +9,8 @@ command, every surface) and the CLI prints its reply. Client-side state the CLI
session's agent in the gateway (as on messaging), where its result is delivered back to the session.
``/cron`` too: the profile's cron store belongs to the gateway that fires its jobs, so the gateway runs
main's handler (one writer); ``/cron run`` lasts as long as the job, so a write waits with no deadline.
+``/toolsets`` too: the gateway builds the report from its own registry (MCP and plugin toolsets
+included) with this session's toolsets marked (gateway/session_info_reads.py).
"""
from __future__ import annotations
@@ -31,8 +33,11 @@ def _watch_reviewer(cli, _arg):
view.watch_subagents()
+# Reports the owner already lays out (main's own line builders): printed as is.
+_VERBATIM = frozenset({"toolsets"})
GATEWAY_SETTINGS = {"personality": None, "busy": _mirror_busy, "approvals": None, "footer": None, "fast": None,
- "refine": None, "review": _watch_reviewer, "cron": None}
+ "refine": None, "review": _watch_reviewer, "cron": None,
+ "toolsets": None}
def _unbounded(canonical, arg):
@@ -78,7 +83,7 @@ def run(cli, canonical, cmd):
if reply is STOPPED:
return True
for line in str((reply or {}).get("output") or "").splitlines():
- _cprint(f" {line}" if line else "")
+ _cprint(f" {line}" if line and canonical not in _VERBATIM else line)
mirror = GATEWAY_SETTINGS[canonical]
if mirror is not None:
mirror(cli, arg)
diff --git a/tests/hermes_cli/test_gateway_setting_commands.py b/tests/hermes_cli/test_gateway_setting_commands.py
index 787122e83ae..8fbcc242da3 100644
--- a/tests/hermes_cli/test_gateway_setting_commands.py
+++ b/tests/hermes_cli/test_gateway_setting_commands.py
@@ -93,3 +93,19 @@ def test_cron_reads_keep_the_answer_deadline(monkeypatch, capsys):
assert gateway_setting_commands.run(cli, "cron", typed) is True
assert [params["command"] for _m, params in conn.calls] == [
"cron", "cron list", "cron LIST -a", 'cron add "every 2h']
+
+
+def test_toolsets_is_the_gateway_sessions_report_printed_as_is(monkeypatch, capsys):
+ """#134889 CLI-22: `/toolsets` is the owner's report (its MCP and plugin toolsets, this session's
+ marked), not this process's registry; its already laid-out lines are not re-indented."""
+ report = "+----+\n| (^_^)b Available Toolsets |\n\n (*) mcp-zeta [11 tools] - MCP server zeta"
+
+ class _Reply(_Conn):
+ def call(self, method, **params):
+ self.calls.append((method, params))
+ return {"type": "exec", "output": report}
+ conn = _Reply()
+ monkeypatch.setattr("hermes_cli.gateway_side.connection_for", lambda cli: conn)
+ assert gateway_setting_commands.run(SimpleNamespace(session_id="local-s"), "toolsets", "/toolsets") is True
+ assert conn.calls == [("slash.exec", {"session_id": "local-s", "command": "toolsets"})]
+ assert "\n (*) mcp-zeta [11 tools]" in capsys.readouterr().out