Purpose
TUI sidebar component showing live token usage with color-coded progress bar. Subscribes to plugin bus for real-time updates.
Scope
TUI component (src/tui.tsx)
- @jsxImportSource @opentui/solid
- Sidebar slot:
sidebar_content
- Auto-refresh: subscribes to
tbg/+/status via BusTui
- Progress bar: width = percentage, color:
- Green (< 50%): tokens well within budget
- Yellow (50-80%): approaching soft limit
- Red (> 80%): near hard limit
- Display: token count, percentage, status text
- Truncated session ID
BusTui integration
- Import BusTui from
@four-bytes/opencode-plugin-lib/tui
- On mount: connect to bus, subscribe to
tbg/+/status
- On message: update SolidJS signals
- On unmount: unsubscribe, close connection
- Auto-reconnect handled by BusTui
Startup message
- If no bus running: show "plugin bus not available" for 3 seconds, then hide
- If bus running but no TBG session: show "waiting for session..."
Files
Depends on
Acceptance
- TUI sidebar renders with progress bar
- Updates in real-time as tokens accumulate
- Color changes at threshold crossings
- Shows "plugin bus not available" when bus is down
Purpose
TUI sidebar component showing live token usage with color-coded progress bar. Subscribes to plugin bus for real-time updates.
Scope
TUI component (src/tui.tsx)
sidebar_contenttbg/+/statusvia BusTuiBusTui integration
@four-bytes/opencode-plugin-lib/tuitbg/+/statusStartup message
Files
Depends on
Acceptance