mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: quiet mode (-Q) outputs only raw response text (#11024)
Two issues when running hermes chat -Q -q: 1. The streaming 'Hermes' response box was rendering to stdout because stream_delta_callback was wired during _init_agent() before quiet_mode was set. This caused the response to appear twice — once in the styled box and once as plain text. 2. session_id was printed to stdout, making piped output unusable. Fix: null out stream_delta_callback and tool_gen_callback after agent init in the quiet-mode path, and redirect session_id to stderr. Now 'hermes chat -Q -q "prompt" | cat' produces only the answer text. session_id is still available on stderr for scripts that need it. Reported by @nixpiper on X.
This commit is contained in:
parent
4b1cf77770
commit
9f231dae56
1 changed files with 7 additions and 1 deletions
8
cli.py
8
cli.py
|
|
@ -10039,6 +10039,11 @@ def main(
|
|||
):
|
||||
cli.agent.quiet_mode = True
|
||||
cli.agent.suppress_status_output = True
|
||||
# Suppress streaming display callbacks so stdout stays
|
||||
# machine-readable (no styled "Hermes" box, no tool-gen
|
||||
# status lines). The response is printed once below.
|
||||
cli.agent.stream_delta_callback = None
|
||||
cli.agent.tool_gen_callback = None
|
||||
result = cli.agent.run_conversation(
|
||||
user_message=effective_query,
|
||||
conversation_history=cli.conversation_history,
|
||||
|
|
@ -10046,7 +10051,8 @@ def main(
|
|||
response = result.get("final_response", "") if isinstance(result, dict) else str(result)
|
||||
if response:
|
||||
print(response)
|
||||
print(f"\nsession_id: {cli.session_id}")
|
||||
# Session ID goes to stderr so piped stdout is clean.
|
||||
print(f"\nsession_id: {cli.session_id}", file=sys.stderr)
|
||||
|
||||
# Ensure proper exit code for automation wrappers
|
||||
sys.exit(1 if isinstance(result, dict) and result.get("failed") else 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue