Merge pull request #17190 from NousResearch/bb/tui-cold-start-profiling
perf(tui): cut visible cold start ~57% with lazy agent init
This commit is contained in:
@@ -1309,10 +1309,20 @@ def _kill_process_group(proc, escalate: bool = False):
|
||||
|
||||
|
||||
def _load_config() -> dict:
|
||||
"""Load code_execution config from CLI_CONFIG if available."""
|
||||
"""Load code_execution config without importing the interactive CLI.
|
||||
|
||||
This helper is called while building the module-level execute_code schema
|
||||
during tool discovery. Importing ``cli`` here pulls prompt_toolkit/Rich and
|
||||
a large chunk of the classic REPL onto every agent startup path, including
|
||||
``hermes --tui`` where it is never used. Read the lightweight raw config
|
||||
instead; the config layer already caches by (mtime, size), and an absent
|
||||
key cleanly falls back to DEFAULT_EXECUTION_MODE.
|
||||
"""
|
||||
try:
|
||||
from cli import CLI_CONFIG
|
||||
return CLI_CONFIG.get("code_execution", {})
|
||||
from hermes_cli.config import read_raw_config
|
||||
|
||||
cfg = read_raw_config().get("code_execution", {})
|
||||
return cfg if isinstance(cfg, dict) else {}
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user