mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(cli): sync _skill_commands after /reload-skills so Tab completion picks up new skills
The Tab-completion lambda captured _skill_commands at startup, so newly installed skills were missing from Tab completion even after /reload-skills reported them as added. Two changes: 1. Tab-completion lambda now calls get_skill_commands() instead of reading the module-level _skill_commands snapshot — ensures the lambda always gets fresh data without needing to touch global state. 2. _reload_skills() now syncs cli.py's module-level _skill_commands via get_skill_commands() after reload, so help display, command dispatch, and any other direct _skill_commands readers also see the updated map. Closes #26441
This commit is contained in:
parent
d9abbe7fa4
commit
3c51da1cb7
1 changed files with 9 additions and 2 deletions
11
cli.py
11
cli.py
|
|
@ -2412,6 +2412,7 @@ def _looks_like_slash_command(text: str) -> bool:
|
|||
|
||||
from agent.skill_commands import (
|
||||
scan_skill_commands,
|
||||
get_skill_commands,
|
||||
build_skill_invocation_message,
|
||||
build_preloaded_skills_prompt,
|
||||
)
|
||||
|
|
@ -9656,12 +9657,18 @@ class HermesCLI:
|
|||
prompt caching intact.
|
||||
"""
|
||||
try:
|
||||
from agent.skill_commands import reload_skills
|
||||
from agent.skill_commands import reload_skills, get_skill_commands
|
||||
|
||||
if not self._command_running:
|
||||
print("🔄 Reloading skills...")
|
||||
|
||||
result = reload_skills()
|
||||
|
||||
# Sync cli.py's module-level _skill_commands so all consumers
|
||||
# (help display, command dispatch, Tab-completion lambda) see the
|
||||
# updated dict without needing to restart the session.
|
||||
global _skill_commands
|
||||
_skill_commands = get_skill_commands()
|
||||
added = result.get("added", []) # [{"name", "description"}, ...]
|
||||
removed = result.get("removed", []) # [{"name", "description"}, ...]
|
||||
total = result.get("total", 0)
|
||||
|
|
@ -12667,7 +12674,7 @@ class HermesCLI:
|
|||
|
||||
|
||||
_completer = SlashCommandCompleter(
|
||||
skill_commands_provider=lambda: _skill_commands,
|
||||
skill_commands_provider=lambda: get_skill_commands(),
|
||||
command_filter=cli_ref._command_available,
|
||||
)
|
||||
input_area = TextArea(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue