Multi-instance terminal UI dashboard for monitoring all ServeConversation
processes simultaneously. Uses MQTT heartbeats for live instance tracking and
a slow DB poll for static configuration data.
ConversationTUI subscribes to MQTT topic axion/+/heartbeat/conversation/+
to receive retained heartbeats from every running ServeConversation instance.
An instance is shown as stale after TuiConstants.HEARTBEAT_STALE_SECS (45 s).
The def_conversation channel distribution is polled separately every
TuiConstants.CONFIG_POLL_SECS (60 s).
__init__(self)Initialises theme, console, layout, and internal state. No port parameter —
all instance data arrives via MQTT.
start(self) / stop(self)start() calls _start_mqtt(), renders the initial layout, and launches the
background update thread. stop() disconnects the MQTT client and tears down
the Live context.
_start_mqtt(self) (internal)Connects a paho MQTT client, subscribes to the heartbeat wildcard, and updates
self.instances[instance_id] on each message.
_poll_config(self) (internal)Runs every CONFIG_POLL_SECS. Queries def_conversation WHERE Package = ?
for total count and a GROUP BY ChannelCode distribution (up to
CONVERSATION_CHANNELS_LIMIT channels).
| Panel | Content |
|---|---|
| Header | Heartbeat, package, Instances: N/M, clock, uptime |
| Sidebar | Active/total counts, DB status, conversation count, TUI uptime |
| Instances | Table of all known instances — instance ID, package, uptime, PID, status |
| Channels | Channel distribution table (channel code → count) |
| Log | Scrolling log |
| Footer | Last config poll timestamp |
python ServeConversation.py tui
Press Ctrl+C to exit.