feat(CUB-19): Implement AgentStatus SignalR Hub for Real-time Updates #1

Merged
overseer merged 3 commits from feat/CUB-19-agentstatus-signalr-hub into dev 2026-04-26 08:02:58 -04:00
Owner

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-status with typed IAgentStatusClient interface

    • Fleet group + per-agent group subscription model
    • AgentStatusChanged and AgentTaskProgress push events
    • Extension methods for server-side push via IHubContext
  • 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
  • REST API controllers

    • GET /api/agents — fleet status snapshot
    • GET /api/agents/{agentId} — single agent status
    • GET /api/logs/{agentId} — agent session logs (stub for future)
    • POST /api/command/stop/{agentId} — stop agent
    • POST /api/command/restart/{agentId} — restart agent
    • POST /api/command/steer/{agentId} — inject message
  • Models matching TypeScript spec interfaces

    • AgentStatusUpdate, TaskProgressUpdate, AgentCardData
    • AgentStatus enum (active/idle/thinking/error)
  • Infrastructure

    • CORS with credentials for SignalR WebSocket
    • Swagger/OpenAPI with XML doc comments
    • Agent role map matching frontend AGENT_ROLES constant

API Contracts for Rex

Endpoint Method Description
/hubs/agent-status WebSocket SignalR hub for real-time updates
/api/agents GET Fleet snapshot (all agents)
/api/agents/{agentId} GET Single agent status
/api/logs/{agentId} GET Agent session logs
/api/command/stop/{agentId} POST Stop agent
/api/command/restart/{agentId} POST Restart agent
/api/command/steer/{agentId} POST Inject message

SignalR Client Methods

  • AgentStatusChanged(AgentStatusUpdate) — pushed on any agent state change
  • AgentTaskProgress(TaskProgressUpdate) — pushed on tool call / message events

Validation

dotnet build — 0 warnings, 0 errors

## 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-status` with typed `IAgentStatusClient` interface - Fleet group + per-agent group subscription model - `AgentStatusChanged` and `AgentTaskProgress` push events - Extension methods for server-side push via `IHubContext` - **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 - **REST API controllers** - `GET /api/agents` — fleet status snapshot - `GET /api/agents/{agentId}` — single agent status - `GET /api/logs/{agentId}` — agent session logs (stub for future) - `POST /api/command/stop/{agentId}` — stop agent - `POST /api/command/restart/{agentId}` — restart agent - `POST /api/command/steer/{agentId}` — inject message - **Models** matching TypeScript spec interfaces - `AgentStatusUpdate`, `TaskProgressUpdate`, `AgentCardData` - `AgentStatus` enum (active/idle/thinking/error) - **Infrastructure** - CORS with credentials for SignalR WebSocket - Swagger/OpenAPI with XML doc comments - Agent role map matching frontend `AGENT_ROLES` constant ### API Contracts for Rex | Endpoint | Method | Description | |---|---|---| | `/hubs/agent-status` | WebSocket | SignalR hub for real-time updates | | `/api/agents` | GET | Fleet snapshot (all agents) | | `/api/agents/{agentId}` | GET | Single agent status | | `/api/logs/{agentId}` | GET | Agent session logs | | `/api/command/stop/{agentId}` | POST | Stop agent | | `/api/command/restart/{agentId}` | POST | Restart agent | | `/api/command/steer/{agentId}` | POST | Inject message | ### SignalR Client Methods - `AgentStatusChanged(AgentStatusUpdate)` — pushed on any agent state change - `AgentTaskProgress(TaskProgressUpdate)` — pushed on tool call / message events ### Validation `dotnet build` — 0 warnings, 0 errors
Dex added 2 commits 2026-04-25 18:11:21 -04:00
- 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
overseer approved these changes 2026-04-26 08:02:44 -04:00
overseer added 1 commit 2026-04-26 08:02:51 -04:00
overseer merged commit 8d0adeb2e9 into dev 2026-04-26 08:02:58 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/Control-Center#1