feat(CUB-19): Implement AgentStatus SignalR Hub for Real-time Updates #1
Reference in New Issue
Block a user
Delete Branch "feat/CUB-19-agentstatus-signalr-hub"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CUB-19 — AgentStatus SignalR Hub
Closes CUB-19
What
Implements the AgentStatus SignalR hub for real-time agent fleet status updates in the Control Center backend.
Changes
AgentStatusHub at
/hubs/agent-statuswith typedIAgentStatusClientinterfaceAgentStatusChangedandAgentTaskProgresspush eventsIHubContextGatewayEventBridgeService background service
sessions.changed,session.message,session.tooleventsAgentStatusenumREST API controllers
GET /api/agents— fleet status snapshotGET /api/agents/{agentId}— single agent statusGET /api/logs/{agentId}— agent session logs (stub for future)POST /api/command/stop/{agentId}— stop agentPOST /api/command/restart/{agentId}— restart agentPOST /api/command/steer/{agentId}— inject messageModels matching TypeScript spec interfaces
AgentStatusUpdate,TaskProgressUpdate,AgentCardDataAgentStatusenum (active/idle/thinking/error)Infrastructure
AGENT_ROLESconstantAPI Contracts for Rex
/hubs/agent-status/api/agents/api/agents/{agentId}/api/logs/{agentId}/api/command/stop/{agentId}/api/command/restart/{agentId}/api/command/steer/{agentId}SignalR Client Methods
AgentStatusChanged(AgentStatusUpdate)— pushed on any agent state changeAgentTaskProgress(TaskProgressUpdate)— pushed on tool call / message eventsValidation
dotnet build— 0 warnings, 0 errors- Add AgentStatusHub with typed IAgentStatusClient interface - Hub at /hubs/agent-status (matches design spec) - Fleet group + per-agent group subscription - AgentStatusChanged and AgentTaskProgress push events - Extension methods for server-side push via IHubContext - Add GatewayEventBridgeService background service - Connects to OpenClaw Gateway WebSocket (v3 protocol) - Handles challenge → connect → hello-ok handshake - Bridges sessions.changed, session.message, session.tool events - Translates Gateway session status to AgentStatus enum - Maintains in-memory fleet state for snapshot queries - Add REST API controllers - GET /api/agents — fleet status snapshot - GET /api/agents/{agentId} — single agent status - GET /api/logs/{agentId} — agent session logs (stub) - POST /api/command/stop/{agentId} — stop agent - POST /api/command/restart/{agentId} — restart agent - POST /api/command/steer/{agentId} — inject message - Add models matching TypeScript spec interfaces - AgentStatusUpdate, TaskProgressUpdate, AgentCardData - AgentStatus enum (active/idle/thinking/error) - Configure CORS with credentials for SignalR WebSocket - Configure Swagger/OpenAPI with XML doc comments - Agent role map matching frontend AGENT_ROLES constant