Gas Town Agent Status Visualization - Real-time detection and display of agent runtime status.
Detects agent status by querying the gt CLI:
- running (green) - Session active, work assigned on hook
- idle (blue) - Session active, no work assigned
- stopped (red) - Session not running
# Show current agent status
node src/index.js
# Watch for status changes in real-time
node src/index.js watch
# Output status as JSON
node src/index.js json
# Start HTTP API server (default port 3847)
node src/index.js serve [port]import { StatusDetector, getAllAgentStatus, AgentStatus } from 'gtviz';
// One-shot status check
const status = await getAllAgentStatus();
// Returns: { "rig-name": [{ rig, name, status, hasWork, currentBead, ... }] }
// Real-time polling
const detector = new StatusDetector({ pollInterval: 5000 });
detector.subscribe((status, changes) => {
for (const change of changes) {
console.log(`${change.rig}/${change.name}: ${change.oldStatus} → ${change.newStatus}`);
}
});
detector.start();
// ... later
detector.stop();Start the server with node src/index.js serve and access:
GET /status- Agent status grouped by rigGET /status/flat- All agents as flat arrayGET /health- Health check
- Queries
gt session listto find all active sessions - Queries
gt polecat list <rig>for each rig - Checks agent bead (
gt bd show gt-{rig}-polecat-{name}) forhook_beadfield - Determines status:
session_running: false→ stoppedhook_beadis set → running- Session running but no work → idle
node --test test/status-detector.test.js