Skip to content

The agent that grows with you

refactor(hermes_cli): fold hanging import/call spans in cli_loops_mixin and cli_terminal_mixin

Tekniumbaa22490c567
diff --git a/hermes_cli/cli_loops_mixin.py b/hermes_cli/cli_loops_mixin.py
index 37a39d268da..c3f91761cb9 100644
--- a/hermes_cli/cli_loops_mixin.py
+++ b/hermes_cli/cli_loops_mixin.py
@@ -48,12 +48,8 @@ class CLILoopsMixin:
def _cmd_clear(self, cmd_original: str):
from cli import (
- ChatConsole,
- _build_compact_banner,
- _clear_output_history,
- _cprint,
- build_welcome_banner,
- get_tool_definitions,
+ ChatConsole, _build_compact_banner, _clear_output_history, _cprint,
+ build_welcome_banner, get_tool_definitions,
)
if self._confirm_destructive_slash(
"clear",
@@ -86,14 +82,9 @@ class CLILoopsMixin:
if hasattr(self, 'agent') and self.agent and hasattr(self.agent, 'context_compressor'):
ctx_len = self.agent.context_compressor.context_length
build_welcome_banner(
- console=cc,
- model=self.model,
- cwd=os.getenv("TERMINAL_CWD", os.getcwd()),
- tools=tools,
- enabled_toolsets=self.enabled_toolsets,
- session_id=self.session_id,
- context_length=ctx_len,
- provider=self.provider,
+ console=cc, model=self.model, cwd=os.getenv("TERMINAL_CWD", os.getcwd()),
+ tools=tools, enabled_toolsets=self.enabled_toolsets, session_id=self.session_id,
+ context_length=ctx_len, provider=self.provider,
)
_cprint(_FRESH_START)
self._print_random_tip()
@@ -236,10 +227,7 @@ class CLILoopsMixin:
# installed-but-not-enabled plugins show up; the plugin manager only knows
# *loaded* plugins and made fresh installs look like "nothing installed".
from hermes_cli.plugins_cmd import (
- _discover_all_plugins,
- _get_disabled_set,
- _get_enabled_set,
- _plugin_status,
+ _discover_all_plugins, _get_disabled_set, _get_enabled_set, _plugin_status
)
entries = _discover_all_plugins()
diff --git a/hermes_cli/cli_terminal_mixin.py b/hermes_cli/cli_terminal_mixin.py
index 300b278540a..7b1b87e8a59 100644
--- a/hermes_cli/cli_terminal_mixin.py
+++ b/hermes_cli/cli_terminal_mixin.py
@@ -394,14 +394,8 @@ class CLITerminalMixin:
def _recover_terminal_input_modes(self, *, reason: str) -> None:
"""Best-effort reset when leaked mouse reports indicate mode drift."""
from cli import (
- CLI_CONFIG,
- _DIM,
- _RST,
- _TERMINAL_INPUT_MODE_RESET_SEQ,
- _cli_multiline_shortcuts_enabled,
- _cprint,
- _enable_extended_enter_keys,
- logger,
+ CLI_CONFIG, _DIM, _RST, _TERMINAL_INPUT_MODE_RESET_SEQ,
+ _cli_multiline_shortcuts_enabled, _cprint, _enable_extended_enter_keys, logger,
)
now = time.monotonic()
# Rate-limit to avoid thrashing if a terminal floods reports.