Problem or Use Case
The Hermes TUI (terminal UI) displays a dropdown for message autocompletion — slash commands (e.g., /help, /model) when typing /, and file paths when typing @. However, pressing Tab does nothing; the highlighted suggestion is never inserted. This is a regression from the original prompt_toolkit-based CLI, where Tab accepted completions automatically.
Impact:
- Users cannot use keyboard-driven completion — they must type full commands manually
- The dropdown is purely decorative, providing visual feedback without functional acceptance
- Breaks expected terminal UI conventions (Tab cycles/accepts, Shift+Tab goes backward)
Proposed Solution
Wire the completion state from useCompletion through to the TextInput component and implement Tab/Shift+Tab key handling:
- Pass completion props (
completions, compIdx, compReplace, setCompIdx) from AppLayout → TextInput
- Extend
TextInputProps interface to include these fields
- Intercept Tab and Shift+Tab in
TextInput's key handler:
- Tab: accepts the current completion, inserts text at the
compReplace range, positions cursor after inserted text
- Shift+Tab: cycles backward through the completions list via
setCompIdx
- Ensure proper typing in
interfaces.ts (setCompIdx as StateSetter<number>) and include compReplace in AppLayoutComposerProps and useMainApp state construction
This approach is minimal and localized — no changes to useCompletion, gateway RPCs, or overlay rendering. It restores the old CLI's acceptance behavior in the new TUI.
Alternatives Considered
- Handle acceptance in parent (
AppLayout): Would require lifting edit state upward and breaking the encapsulated TextInput edit model. Rejected — TextInput already owns the text state and cursor; acceptance belongs there.
- Global key capture at
app.tsx level: Adds indirection and complicates prop drilling. Rejected — TextInput already receives key events; keeping logic local is cleaner.
- Disable Tab for completions and use Enter: Misaligns with terminal UX norms (Tab is standard for completion acceptance in prompt_toolkit, readline, etc.). Rejected — would create inconsistency.
- Re-implement entire completion system: Unnecessary — the dropdown renders correctly and completion data is already flowing to
appOverlays. Only acceptance logic was missing.
Feature Type
Other
Scope
Small (single file, < 50 lines)
Contribution
Debug Report (optional)
Problem or Use Case
The Hermes TUI (terminal UI) displays a dropdown for message autocompletion — slash commands (e.g.,
/help,/model) when typing/, and file paths when typing@. However, pressing Tab does nothing; the highlighted suggestion is never inserted. This is a regression from the original prompt_toolkit-based CLI, where Tab accepted completions automatically.Impact:
Proposed Solution
Wire the completion state from
useCompletionthrough to theTextInputcomponent and implement Tab/Shift+Tab key handling:completions,compIdx,compReplace,setCompIdx) fromAppLayout→TextInputTextInputPropsinterface to include these fieldsTextInput's key handler:compReplacerange, positions cursor after inserted textsetCompIdxinterfaces.ts(setCompIdxasStateSetter<number>) and includecompReplaceinAppLayoutComposerPropsanduseMainAppstate constructionThis approach is minimal and localized — no changes to
useCompletion, gateway RPCs, or overlay rendering. It restores the old CLI's acceptance behavior in the new TUI.Alternatives Considered
AppLayout): Would require lifting edit state upward and breaking the encapsulatedTextInputedit model. Rejected —TextInputalready owns the text state and cursor; acceptance belongs there.app.tsxlevel: Adds indirection and complicates prop drilling. Rejected —TextInputalready receives key events; keeping logic local is cleaner.appOverlays. Only acceptance logic was missing.Feature Type
Other
Scope
Small (single file, < 50 lines)
Contribution
Debug Report (optional)