feat(CUB-19): implement AgentStatus SignalR hub for real-time updates

- 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
This commit is contained in:
cubecraft-agents[bot]
2026-04-25 22:10:51 +00:00
parent f490098af6
commit 1c5d982cd9
55 changed files with 3355 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.text.json/8.0.5/buildTransitive/net6.0/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json/8.0.5/buildTransitive/net6.0/System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.apidescription.server/9.0.0/build/Microsoft.Extensions.ApiDescription.Server.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.apidescription.server/9.0.0/build/Microsoft.Extensions.ApiDescription.Server.targets')" />
</ImportGroup>
</Project>