diff --git a/hermes_cli/commands.py b/hermes_cli/commands.py index 87d73af58e..c606e88aec 100644 --- a/hermes_cli/commands.py +++ b/hermes_cli/commands.py @@ -862,6 +862,12 @@ class SlashCommandCompleter(Completer): except Exception: return {} + # Commands that open pickers when run without arguments. + # These should NOT receive a trailing space in completions because: + # - The TUI's submit handler applies completions on Enter if input differs + # - Adding space makes "/model" → "/model " which blocks picker execution + _PICKER_COMMANDS = frozenset({"model", "skin", "personality"}) + @staticmethod def _completion_text(cmd_name: str, word: str) -> str: """Return replacement text for a completion. @@ -870,8 +876,17 @@ class SlashCommandCompleter(Completer): returning ``help`` would be a no-op and prompt_toolkit suppresses the menu. Appending a trailing space keeps the dropdown visible and makes backspacing retrigger it naturally. + + However, commands that open pickers (model, skin, personality) should + NOT get a trailing space — the TUI would apply the completion on Enter + and block the picker from opening. """ - return f"{cmd_name} " if cmd_name == word else cmd_name + if cmd_name != word: + return cmd_name + # Don't add space for picker commands — allows Enter to execute them + if cmd_name in SlashCommandCompleter._PICKER_COMMANDS: + return cmd_name + return f"{cmd_name} " @staticmethod def _extract_path_word(text: str) -> str | None: