fix(agent): silence quiet_mode in python library use

This commit is contained in:
helix4u
2026-04-18 14:28:50 -06:00
committed by kshitij
parent 361675018f
commit cd59af17cc
2 changed files with 50 additions and 7 deletions

View File

@@ -1916,13 +1916,16 @@ class AIAgent:
def _should_emit_quiet_tool_messages(self) -> bool:
"""Return True when quiet-mode tool summaries should print directly.
When the caller provides ``tool_progress_callback`` (for example the CLI
TUI or a gateway progress renderer), that callback owns progress display.
Emitting quiet-mode summary lines here duplicates progress and leaks tool
previews into flows that are expected to stay silent, such as
``hermes chat -q``.
Quiet mode is used by both the interactive CLI and embedded/library
callers. The CLI may still want compact progress hints when no callback
owns rendering. Embedded/library callers, on the other hand, expect
quiet mode to be truly silent.
"""
return self.quiet_mode and not self.tool_progress_callback
return (
self.quiet_mode
and not self.tool_progress_callback
and getattr(self, "platform", "") == "cli"
)
def _emit_status(self, message: str) -> None:
"""Emit a lifecycle status message to both CLI and gateway channels.
@@ -11184,7 +11187,7 @@ class AIAgent:
self._last_content_tools_all_housekeeping = _all_housekeeping
if _all_housekeeping and self._has_stream_consumers():
self._mute_post_response = True
elif self.quiet_mode:
elif self.quiet_mode and getattr(self, "platform", "") == "cli":
clean = self._strip_think_blocks(turn_content).strip()
if clean:
relayed = False