Add real-time agent health monitoring and response utilities

Health Monitoring:
- Add /controller/agents/health endpoint for efficient bulk health checks
- Check all agents in one call with response time tracking
- Update agent status in real-time (30s interval)
- Show latency next to agent status in UI
- Add collapsible "All Agents Health" panel in sidebar
- Log console notifications when agents go online/offline

Response Utilities:
- Add unwrapAgentResponse() to consistently handle controller proxy format
- Add isAgentMode() and getCurrentAgentName() helpers
- Standardize error handling for agent responses

UI Improvements:
- Show response latency (ms) in agent selector dropdown
- Health panel shows status + running modes for each agent
- Better visual feedback for agent status changes
This commit is contained in:
cemaxecuter
2026-01-26 12:19:20 -05:00
parent 3372daca84
commit d775ba5b3e
3 changed files with 299 additions and 5 deletions

View File

@@ -375,7 +375,15 @@
</div>
<div id="agentInfo" class="info-text" style="font-size: 10px; color: #666; margin-top: 4px;">
<span id="agentStatusText">Local</span>
<span id="agentLatencyText" style="margin-left: 6px; color: var(--accent-cyan);"></span>
</div>
<!-- Agent health panel (shows all agents when expanded) -->
<details style="margin-top: 8px;">
<summary style="font-size: 10px; color: #888; cursor: pointer;">All Agents Health</summary>
<div id="agentHealthPanel" style="margin-top: 6px; padding: 6px; background: rgba(0,0,0,0.2); border-radius: 4px; max-height: 120px; overflow-y: auto;">
<div style="color: var(--text-muted); font-size: 11px;">Loading...</div>
</div>
</details>
<!-- Multi-agent mode toggle -->
<div class="form-group" style="margin-top: 10px;">
<label class="inline-checkbox" style="display: flex; align-items: center; gap: 8px;">