feat(cli): add /verbose slash command to toggle debug output at runtime
Closes #77. Users can now type /verbose in the CLI to toggle verbose mode on or off without restarting. When enabled, full tool call parameters, results, and debug logs are shown. The agent's verbose_logging and quiet_mode flags are updated live, and Python logging levels are reconfigured accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bf9dd83c10
commit
1a97e82000
2 changed files with 23 additions and 0 deletions
22
cli.py
22
cli.py
|
|
@ -1653,12 +1653,34 @@ class HermesCLI:
|
||||||
self._handle_skills_command(cmd_original)
|
self._handle_skills_command(cmd_original)
|
||||||
elif cmd_lower == "/platforms" or cmd_lower == "/gateway":
|
elif cmd_lower == "/platforms" or cmd_lower == "/gateway":
|
||||||
self._show_gateway_status()
|
self._show_gateway_status()
|
||||||
|
elif cmd_lower == "/verbose":
|
||||||
|
self._toggle_verbose()
|
||||||
else:
|
else:
|
||||||
self.console.print(f"[bold red]Unknown command: {cmd_lower}[/]")
|
self.console.print(f"[bold red]Unknown command: {cmd_lower}[/]")
|
||||||
self.console.print("[dim #B8860B]Type /help for available commands[/]")
|
self.console.print("[dim #B8860B]Type /help for available commands[/]")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _toggle_verbose(self):
|
||||||
|
"""Toggle verbose mode on/off at runtime."""
|
||||||
|
self.verbose = not self.verbose
|
||||||
|
|
||||||
|
if self.agent:
|
||||||
|
self.agent.verbose_logging = self.verbose
|
||||||
|
self.agent.quiet_mode = not self.verbose
|
||||||
|
|
||||||
|
# Reconfigure logging level to match new state
|
||||||
|
if self.verbose:
|
||||||
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
for noisy in ('openai', 'openai._base_client', 'httpx', 'httpcore', 'asyncio', 'hpack', 'grpc', 'modal'):
|
||||||
|
logging.getLogger(noisy).setLevel(logging.WARNING)
|
||||||
|
self.console.print("[bold green]Verbose mode ON[/] — tool calls, parameters, and results will be shown.")
|
||||||
|
else:
|
||||||
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
|
for quiet_logger in ('tools', 'minisweagent', 'run_agent', 'trajectory_compressor', 'cron', 'hermes_cli'):
|
||||||
|
logging.getLogger(quiet_logger).setLevel(logging.ERROR)
|
||||||
|
self.console.print("[dim]Verbose mode OFF[/] — returning to normal display.")
|
||||||
|
|
||||||
def _clarify_callback(self, question, choices):
|
def _clarify_callback(self, question, choices):
|
||||||
"""
|
"""
|
||||||
Platform callback for the clarify tool. Called from the agent thread.
|
Platform callback for the clarify tool. Called from the agent thread.
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ COMMANDS = {
|
||||||
"/cron": "Manage scheduled tasks (list, add, remove)",
|
"/cron": "Manage scheduled tasks (list, add, remove)",
|
||||||
"/skills": "Search, install, inspect, or manage skills from online registries",
|
"/skills": "Search, install, inspect, or manage skills from online registries",
|
||||||
"/platforms": "Show gateway/messaging platform status",
|
"/platforms": "Show gateway/messaging platform status",
|
||||||
|
"/verbose": "Toggle verbose mode (show tool calls, parameters, and results)",
|
||||||
"/quit": "Exit the CLI (also: /exit, /q)",
|
"/quit": "Exit the CLI (also: /exit, /q)",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue