monitor command is designed to launch an interactive Terminal User Interface (TUI) that displays real-time information about rooms, participants, and activity on a Gambiarra hub.
Alternative: Launch TUI without command
Until themonitor command is registered, you can access the TUI by running:
Planned Usage
Once registered, the command will work as follows:Options
Hub URL to connect to. Also accepts
-h shorthand.Examples
Monitor local hub
Launch the TUI for the default local hub:- List of active rooms
- Participants in each room
- Real-time events and activity
- Connection status
Monitor remote hub
Connect to a hub on a different machine:Monitor with shorthand
TUI features
The TUI provides a rich interface for monitoring hub activity:Real-time updates
The interface automatically updates to show:- New rooms being created
- Participants joining and leaving
- Chat completions and model requests
- Health check status
- Connection events
Room overview
For each room, you can see:- Room code and name
- Number of active participants
- Creation timestamp
- Current activity
Participant details
View information about each participant:- Nickname
- Model being shared
- Endpoint URL
- System specifications (if shared)
- Connection status
- Last health check
Event stream
Monitor events in real-time:- Room creation
- Participant joins
- Participant leaves
- Chat completions
- Health checks
- Errors and warnings
The TUI connects to the hub’s Server-Sent Events (SSE) endpoint at
/rooms/{code}/events to receive real-time updates.Navigation
Use keyboard controls to navigate the TUI:- Arrow keys: Navigate between rooms and participants
- Tab: Switch between panels
- Enter: View details
- q or Ctrl+C: Exit the TUI
Exact keyboard shortcuts may vary based on the TUI implementation. Check the on-screen help for available commands.
Use cases
Monitor room activity
Keep an eye on what’s happening in your rooms:Debug connectivity issues
Watch health checks to identify participants with connection problems:- Failed health checks
- Participant timeouts
- Disconnection events
Track model usage
See which models are being used and how often:Manage hub resources
Monitor the hub to understand:- How many rooms are active
- Total participant count
- Resource usage patterns
- Peak activity times
How it works
- The monitor connects to the hub at the specified URL
- Subscribes to the SSE event stream for real-time updates
- Queries the hub API for initial room and participant data
- Continuously updates the display as events arrive
- Maintains connection until you exit
Error handling
Hub not reachable
If the hub is not running:Make sure the hub is running with
gambiarra serve before monitoring.Connection lost
If connection to the hub is lost during monitoring:- The TUI will attempt to reconnect
- A connection status indicator will show the error
- You may need to restart the monitor if reconnection fails
Performance considerations
Resource usage
The TUI is lightweight but:- Uses a persistent SSE connection to the hub
- Updates the display in real-time
- May consume more CPU with many active rooms
Refresh rate
The display updates:- Immediately when events arrive via SSE
- Continuously for status indicators
- Efficiently without polling
Advanced usage
Monitor multiple hubs
Open multiple terminals to monitor different hubs:Combine with other commands
Run monitor in one terminal while operating in another:TUI technology
The monitor is built with:- OpenTUI: Terminal UI framework
- React: Component-based UI
- SSE: Server-Sent Events for real-time updates
The TUI runs in your terminal and requires a terminal that supports advanced features like colors and cursor positioning.
Related commands
serve- Start the hub server to monitorlist- List rooms in a simpler formatjoin- Join a room as a participantcreate- Create a new room
Next steps
Using the monitor:- Start a hub if one isn’t running
- Launch the monitor to watch activity
- Create rooms and see them appear
- Watch as participants join
- Monitor events and health checks in real-time