Skip to content

refactor(cli): add protected TUI extension hooks for wrapper CLIs#1749

Closed
erosika wants to merge 0 commit into
NousResearch:mainfrom
erosika:eri/cli-extension-hooks
Closed

refactor(cli): add protected TUI extension hooks for wrapper CLIs#1749
erosika wants to merge 0 commit into
NousResearch:mainfrom
erosika:eri/cli-extension-hooks

Conversation

@erosika

@erosika erosika commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Summary

HermesCLI.run() constructs keybindings and the root layout inline. External packages that need to extend the TUI currently have to override run() entirely, which couples them to every internal change.

This extracts three protected methods from run():

  • _get_extra_tui_widgets() -- widgets to insert into the layout
  • _register_extra_tui_keybindings(kb, *, input_area) -- keybinding registration hook
  • _build_tui_layout_children(**widgets) -- ordered HSplit children assembly

Two extension seams already exist and are unchanged: process_command() for custom slash commands, _build_tui_style_dict() for custom styles.

Default implementations reproduce the existing layout and behavior exactly. No new dependencies, no new commands.

Related: these hooks also unblock the UI side of #1092 (inspectable tool timeline), since the inspection panel and keybinding navigation follow the same conditional container pattern.

Test plan

  • Base class _get_extra_tui_widgets returns []
  • Base class _register_extra_tui_keybindings is no-op
  • Subclass widgets appear in correct layout position
  • Subclass can register keybindings via hook

Related meta issue: #2210

@erosika erosika force-pushed the eri/cli-extension-hooks branch 4 times, most recently from e2d8dec to 53df074 Compare March 19, 2026 20:05
teknium1 added a commit that referenced this pull request Mar 21, 2026
Based on PR #1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
teknium1 added a commit that referenced this pull request Mar 21, 2026
Based on PR #1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
@erosika erosika closed this Mar 21, 2026
@erosika erosika force-pushed the eri/cli-extension-hooks branch from 53df074 to d3659c8 Compare March 21, 2026 23:06
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
Based on PR NousResearch#1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
Based on PR NousResearch#1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Based on PR NousResearch#1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
Based on PR NousResearch#1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Based on PR NousResearch#1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Based on PR NousResearch#1749 by @erosika (reimplemented on current main).

Extracts three protected methods from run() so wrapper CLIs can extend
the TUI without overriding the entire method:

- _get_extra_tui_widgets(): inject widgets between spacer and status bar
- _register_extra_tui_keybindings(kb, input_area): add keybindings
- _build_tui_layout_children(**widgets): full control over ordering

Default implementations reproduce existing layout exactly. The inline
HSplit in run() now delegates to _build_tui_layout_children().

5 tests covering defaults, widget insertion position, and keybinding
registration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant