diff --git a/cli.py b/cli.py index c15bd87b5b..9e82e03d3b 100644 --- a/cli.py +++ b/cli.py @@ -1509,10 +1509,14 @@ class HermesCLI: self._reasoning_buf = getattr(self, "_reasoning_buf", "") + text - # Emit complete lines + # Emit complete lines, and force-flush long partial lines so + # reasoning is visible in real-time even without newlines. while "\n" in self._reasoning_buf: line, self._reasoning_buf = self._reasoning_buf.split("\n", 1) _cprint(f"{_DIM}{line}{_RST}") + if len(self._reasoning_buf) > 80: + _cprint(f"{_DIM}{self._reasoning_buf}{_RST}") + self._reasoning_buf = "" def _close_reasoning_box(self) -> None: """Close the live reasoning box if it's open.""" diff --git a/run_agent.py b/run_agent.py index 25cfd36745..e7dec855a3 100644 --- a/run_agent.py +++ b/run_agent.py @@ -4816,9 +4816,9 @@ class AIAgent: is_error, _ = _detect_tool_failure(function_name, result) results[index] = (function_name, function_args, result, duration, is_error) - # Start spinner for CLI mode + # Start spinner for CLI mode (skip when TUI handles tool progress) spinner = None - if self.quiet_mode: + if self.quiet_mode and not self.tool_progress_callback: face = random.choice(KawaiiSpinner.KAWAII_WAITING) spinner = KawaiiSpinner(f"{face} ⚡ running {num_tools} tools concurrently", spinner_type='dots') spinner.start() @@ -5044,7 +5044,7 @@ class AIAgent: goal_preview = (function_args.get("goal") or "")[:30] spinner_label = f"🔀 {goal_preview}" if goal_preview else "🔀 delegating" spinner = None - if self.quiet_mode: + if self.quiet_mode and not self.tool_progress_callback: face = random.choice(KawaiiSpinner.KAWAII_WAITING) spinner = KawaiiSpinner(f"{face} {spinner_label}", spinner_type='dots') spinner.start() @@ -5069,13 +5069,15 @@ class AIAgent: elif self.quiet_mode: self._vprint(f" {cute_msg}") elif self.quiet_mode: - face = random.choice(KawaiiSpinner.KAWAII_WAITING) - emoji = _get_tool_emoji(function_name) - preview = _build_tool_preview(function_name, function_args) or function_name - if len(preview) > 30: - preview = preview[:27] + "..." - spinner = KawaiiSpinner(f"{face} {emoji} {preview}", spinner_type='dots') - spinner.start() + spinner = None + if not self.tool_progress_callback: + face = random.choice(KawaiiSpinner.KAWAII_WAITING) + emoji = _get_tool_emoji(function_name) + preview = _build_tool_preview(function_name, function_args) or function_name + if len(preview) > 30: + preview = preview[:27] + "..." + spinner = KawaiiSpinner(f"{face} {emoji} {preview}", spinner_type='dots') + spinner.start() _spinner_result = None try: function_result = handle_function_call( @@ -5091,7 +5093,10 @@ class AIAgent: finally: tool_duration = time.time() - tool_start_time cute_msg = _get_cute_tool_message_impl(function_name, function_args, tool_duration, result=_spinner_result) - spinner.stop(cute_msg) + if spinner: + spinner.stop(cute_msg) + else: + self._vprint(f" {cute_msg}") else: try: function_result = handle_function_call(