fix(cli): ensure single closure of streaming boxes during tool generation

- Updated `_on_tool_gen_start` method in `HermesCLI` to close open streaming boxes exactly once, preventing potential multiple closures.
- Added a check for `_stream_box_opened` to manage the state of the streaming box more effectively, enhancing user experience during large payload streaming.
This commit is contained in:
Teknium
2026-03-24 06:33:21 -07:00
parent 87e2626cf6
commit 4313b8aff6

10
cli.py
View File

@@ -4641,11 +4641,13 @@ class HermesCLI:
def _on_tool_gen_start(self, tool_name: str) -> None:
"""Called when the model begins generating tool-call arguments.
Closes any open streaming boxes (reasoning / response) and prints a
short status line so the user sees activity instead of a frozen
screen while a large payload (e.g. a 45 KB write_file) streams in.
Closes any open streaming boxes (reasoning / response) exactly once,
then prints a short status line so the user sees activity instead of
a frozen screen while a large payload (e.g. 45 KB write_file) streams.
"""
self._flush_stream()
if getattr(self, "_stream_box_opened", False):
self._flush_stream()
self._stream_box_opened = False
self._close_reasoning_box()
from agent.display import get_tool_emoji