Skip to content

feat(plugins): add on_status_bar_render hook for plugin-contributed status bar fragments#32299

Open
chpomob wants to merge 2 commits into
NousResearch:mainfrom
chpomob:feat/on-status-bar-render-hook
Open

feat(plugins): add on_status_bar_render hook for plugin-contributed status bar fragments#32299
chpomob wants to merge 2 commits into
NousResearch:mainfrom
chpomob:feat/on-status-bar-render-hook

Conversation

@chpomob

@chpomob chpomob commented May 25, 2026

Copy link
Copy Markdown

Summary

Adds an on_status_bar_render plugin hook that lets plugins contribute extra text fragments to the CLI status bar, without requiring patches to cli.py.

Closes #8642.

Changes

hermes_cli/plugins.py

  • Add "on_status_bar_render" to VALID_HOOKS

cli.py

  • Invoke on_status_bar_render hook in both code paths of _build_status_bar_text():
    • Medium width (if width < 76): separator " · ", parts.append()
    • Full width: separator " │ ", parts.insert(-1, extra) before duration

Each callback receives a snapshot dict and may return a string to append, or None to contribute nothing. The hook is wrapped in try/except so a misbehaving plugin cannot break the status bar.

Snapshot dict

Plugins receive:

{
    "model_short": str,
    "model_full": str,
    "context_percent": int,
    "context_tokens": int,
    "context_length": int,
    "duration": str,
    "session_id": str,
    "session_title": str,
    "active_background_tasks": int,
    "active_background_processes": int,
    "compressions": int,
    "prompt_elapsed": float or None,
}

Use cases

With this hook, plugins can cleanly add:

  • Quota/rate-limit status (Claude, Codex)
  • Session title
  • Active vision model indicator
  • Cron job count
  • Git dirty indicator
  • Custom cost/usage tracking

Backwards compatibility

No breaking changes. Plugins that don't register this hook see no difference. The hook is purely additive.

Tested

  • Plugin loads and hook is called on every status bar redraw
  • Both width paths correctly display plugin output
  • Hook failure does not break the status bar
  • Hook works in idempotent re-application (survives hermes update)

chpomob added 2 commits May 26, 2026 01:07
…tatus bar fragments

Plugins can now contribute extra text to the CLI status bar via the
on_status_bar_render hook. The hook is invoked in both code paths of
_build_status_bar_text() (medium and full width).

Each registered callback receives a snapshot dict with session state
(model, context usage, duration, background tasks, etc.) and may
return a string to append, or None to contribute nothing.

Closes NousResearch#8642
…ents() fragment paths

The hook was only invoked in _build_status_bar_text() (string fallback),
but the primary rendering path _get_status_bar_fragments() (which builds
styled fragments for prompt_toolkit) never called it. This meant plugin
contributions (quota status, etc.) were invisible in normal operation.

Added hook invocation in both fragment sub-paths:
- Medium width (< 76): ' · ' separator, appends styled fragment
- Full width (>= 76): ' │ ' separator, inserts before duration

Now 4/4 code paths invoke the hook: 2 string + 2 fragment.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(plugins): add on_status_bar_render hook for plugin-contributed TUI status bar fragments

2 participants