The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): a blank line between the user message and the first tool row
Teknium197c21195d9d
diff --git a/hermes_cli/cli_modern_layout.py b/hermes_cli/cli_modern_layout.pyindex 373588e8fb2..9df084747b0 100644--- a/hermes_cli/cli_modern_layout.py+++ b/hermes_cli/cli_modern_layout.py@@ -70,12 +70,31 @@ def prompt_glyph() -> str:_SEPARATOR_WIDTH = 40+_GAP_PENDING = False # a user message was just echoed and nothing has opened a block under it yet++def separator(accent: bool) -> str:- """The bar above each user message and answer (accent) or reasoning block (dim)."""+ """The bar above each user message and answer (accent) or reasoning block (dim). Every caller+ prints a blank line ahead of it, so it also settles the gap a fresh user message owes."""+ global _GAP_PENDING+ _GAP_PENDING = Falsecolor = _fg(_skin_hex("ui_accent", "#FFBF00")) if accent else _DIMreturn f"{color}{'─' * _SEPARATOR_WIDTH}{_RST}"+def owe_gap_after_user_message() -> None:+ """Called once the user's message is echoed: the next tool row opens with a blank line, as+ reasoning and answers already do, so the message never runs straight into the tool calls."""+ global _GAP_PENDING+ _GAP_PENDING = True+++def _take_gap() -> str:+ global _GAP_PENDING+ gap, _GAP_PENDING = ("\n" if _GAP_PENDING else ""), False+ return gap++def user_echo_markup(text: str, accent_hex: str, ts_suffix: str = "") -> str:"""Rich markup for a submitted single-line user message: ``❯ text``."""from rich.markup import escape@@ -129,7 +148,7 @@ def completed_tool_line(cli, function_name: str, args: dict | None, duration: flis_error: bool = False) -> str:"""The scrollback line for a finished tool call in the active layout."""if is_modern(cli):- return tool_row(function_name, args, duration, result, is_error)+ return _take_gap() + tool_row(function_name, args, duration, result, is_error)from agent.display import get_cute_tool_messagereturn f" {get_cute_tool_message(function_name, args, duration, result=result)}"diff --git a/hermes_cli/cli_stream_mixin.py b/hermes_cli/cli_stream_mixin.pyindex 9cc5eea3ca9..d8c3fa2a687 100644--- a/hermes_cli/cli_stream_mixin.py+++ b/hermes_cli/cli_stream_mixin.py@@ -252,6 +252,9 @@ class CLIStreamMixin:ChatConsole().print(user_echo_markup(text, _accent_hex()), soft_wrap=True)else:ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(text)}[/]")+ if modern:+ from hermes_cli.cli_modern_layout import owe_gap_after_user_message+ owe_gap_after_user_message()def _stream_reasoning_delta(self, text: str) -> None:"""Stream reasoning tokens into a dim box above the response.diff --git a/tests/hermes_cli/test_cli_modern_layout.py b/tests/hermes_cli/test_cli_modern_layout.pyindex fff8f9e1ad2..e544432fc70 100644--- a/tests/hermes_cli/test_cli_modern_layout.py+++ b/tests/hermes_cli/test_cli_modern_layout.py@@ -179,3 +179,26 @@ def test_tool_rows_keep_the_classic_tool_emoji():assert _plain(tool_row(name, args, 0.2)).startswith(classic_emoji + " "), (name, classic_emoji)failed = _plain(tool_row("terminal", {"command": "false"}, 0.2, result='{"exit_code": 1, "output": ""}'))assert failed.startswith("✗ ") and "[exit 1]" in failed, failed+++def test_a_blank_line_separates_the_user_message_from_the_first_tool_row(monkeypatch):+ """Reasoning and answers open under a blank line + bar; the first tool row of a turn gets the+ same blank line, so the user's message never runs straight into the tool calls. Later rows+ stay tight."""+ from cli import HermesCLI+ import cli as climod+ from hermes_cli import cli_modern_layout as layout++ emitted: list[str] = []+ monkeypatch.setattr(climod, "_cprint", lambda s: emitted.append(_plain(s)))+ cli = HermesCLI.__new__(HermesCLI)+ cli._modern_layout, cli.show_timestamps = True, False+ cli._print_user_message_preview("read the hostname")+ first = layout.completed_tool_line(cli, "read_file", {"path": "/etc/hostname"}, 0.2)+ second = layout.completed_tool_line(cli, "terminal", {"command": "echo hi"}, 0.1)+ assert first.startswith("\n") and _plain(first).lstrip("\n").startswith("📖 "), repr(first)+ assert not second.startswith("\n"), repr(second)+ # A reasoning block opened first already printed its own blank line + bar: no double gap.+ cli._print_user_message_preview("again")+ layout.separator(False)+ assert not layout.completed_tool_line(cli, "read_file", {"path": "/etc/hostname"}, 0.2).startswith("\n")