Phase 3: Health Check + Task Queue for Agent Tab

Backend: _get_agent_health() with CPU/Memory/Threads from ps, get_agent_tasks() reads tasks.json. API: GET /api/agents/{id}/health + /tasks. Frontend: Health metrics block in Overview tab (CPU, Memory bar, Threads), Tasks tab with status-colored task list.
This commit is contained in:
Rose
2026-04-20 13:45:20 +02:00
parent e5b55c6f3a
commit 8b8a507ace
4 changed files with 250 additions and 1 deletions

View File

@@ -867,6 +867,20 @@ def handle_get(handler, parsed) -> bool:
limit = int(parse_qs(parsed.query).get("limit", ["20"])[0])
return j(handler, _agents.get_agent_chat_history(agent_id, limit=limit))
# GET /api/agents/{id}/health
if parsed.path.startswith("/api/agents/") and "/health" in parsed.path:
parts = parsed.path.split("/")
if len(parts) == 5 and parts[4] == "health":
agent_id = parts[3]
return j(handler, _agents.get_agent_health(agent_id))
# GET /api/agents/{id}/tasks
if parsed.path.startswith("/api/agents/") and "/tasks" in parsed.path:
parts = parsed.path.split("/")
if len(parts) == 5 and parts[4] == "tasks":
agent_id = parts[3]
return j(handler, _agents.get_agent_tasks(agent_id))
# ── Profile API (GET) ──
if parsed.path == "/api/profiles":
from api.profiles import list_profiles_api, get_active_profile_name