Skip to content

Conversation

@spoons-and-mirrors
Copy link
Contributor

Summary

This PR introduces a declarative UI system for plugins, allowing them to render rich, interactive components directly in the TUI.

Capabilities

Render custom UI in chat
Plugins can display styled text, layout containers, and interactive elements inline within the conversation — useful for status indicators, summaries, or custom workflows.

Interactive checklists
Users can navigate with ↑/↓/j/k and toggle items with Space, or use the mouse to select list items. Plugins receive events when items are toggled, enabling things like task selection, feature toggles, or multi-select confirmations.

Buttons with shortcuts and hover states
Clickable buttons with optional keyboard shortcuts and hover state. Buttons can emit events back to the plugin or trigger modals for additional context.

Collapsible sections
Expandable/collapsible regions for progressive disclosure — show a summary by default, expand for details.

Modals
foreground dialogs triggered by buttons, useful for settings panels, detailed views, or focused interactions that need more space.

Input replacement
Components can temporarily take over the input area for focused interactions like confirmations or selections, then restore normal input when dismissed.

Theme-aware styling
All components use semantic color tokens (text, textMuted, warning, success, etc.) that automatically adapt to the user's chosen theme.

Few examples

Replace input component with a checklist
image

Collapsible list (rendered inline for the example)
image

image

Inline component (not replaceInput)
image

Modal
image


Current shortcomings

  • Inline components don't get dismissed, they stay in chat - not sure if we should keep them or remove them upon dismissal.
  • Missing scrollbox renderable support, but collapsible may be enough for now ?

Future consideration

A fluent builder API (e.g., ui.box().row().gap(1).children(...)) could make authoring plugin UIs more ergonomic than the current JSON template format. Keeping that out of scope for this PR since it's already substantial, but worth exploring as a follow-up.

@Tarquinen
Copy link
Contributor

This looks fantastic! Can't wait for plugins to get better UI access, hopefully this is it!

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.

2 participants