Skip to content

The agent that grows with you

fix(cli): the classic view submits a slash.exec `send` directive as its own turn

Teknium20767ddbd191
diff --git a/hermes_cli/gateway_chat_commands.py b/hermes_cli/gateway_chat_commands.py
index 7135407a264..142c0fe3b74 100644
--- a/hermes_cli/gateway_chat_commands.py
+++ b/hermes_cli/gateway_chat_commands.py
@@ -184,8 +184,11 @@ async def forward(view, name, rest):
from hermes_cli.commands import resolve_command
print(refusal(name) if resolve_command(name) else f"Unknown command: /{name} (use /help)")
return
- if reply.get("type") == "skill":
- # A skill directive is the client's durable submit (same contract as Ink and Desktop).
+ if reply.get("type") in ("skill", "send"):
+ # A prompt directive is the client's durable submit (same contract as Ink and Desktop):
+ # a skill body, or the turn a command built (/plan, /goal's kickoff...) after its notice.
+ if reply.get("notice"):
+ print(reply["notice"])
print(f"\n{'─' * 40}\n● {reply.get('display') or '/' + name}", flush=True)
await view.submit(reply["message"])
else:
diff --git a/tests/hermes_cli/test_gateway_chat_send_directive.py b/tests/hermes_cli/test_gateway_chat_send_directive.py
new file mode 100644
index 00000000000..5dc6724ea39
--- /dev/null
+++ b/tests/hermes_cli/test_gateway_chat_send_directive.py
@@ -0,0 +1,29 @@
+"""The classic CLI view submits a ``send`` directive from slash.exec as its own durable turn."""
+from types import SimpleNamespace
+from unittest.mock import AsyncMock
+
+import pytest
+
+
+async def test_send_directive_prints_notice_and_submits_through_the_view(capsys):
+ from hermes_cli.gateway_chat_commands import run_command
+ reply = {'type': 'send', 'message': 'PLAN PROMPT BODY', 'display': '/plan add a cache',
+ 'notice': 'Planning: add a cache'}
+ view = SimpleNamespace(client=SimpleNamespace(rpc=AsyncMock(return_value=reply)), session_id='s',
+ submit=AsyncMock())
+ await run_command(view, '/plan', 'add a cache')
+ assert view.client.rpc.await_args.kwargs == {'session_id': 's', 'command': 'plan add a cache'}
+ view.submit.assert_awaited_once_with('PLAN PROMPT BODY')
+ printed = capsys.readouterr().out
+ assert 'Planning: add a cache' in printed and '● /plan add a cache' in printed
+ assert 'PLAN PROMPT BODY' not in printed # model-facing body is never painted
+
+
+async def test_exec_output_still_prints(capsys):
+ from hermes_cli.gateway_chat_commands import run_command
+ view = SimpleNamespace(client=SimpleNamespace(rpc=AsyncMock(return_value={'type': 'exec', 'output': 'curator ok'})),
+ session_id='s', submit=AsyncMock())
+ await run_command(view, '/curator', '')
+ assert 'curator ok' in capsys.readouterr().out and not view.submit.called