Add HUD widget for tracking active projects and running agent sessions. Backend: - Add getActiveProjectsData() and getAgentChainsData() to WidgetDataService - Create POST /api/widgets/data/active-projects endpoint - Create POST /api/widgets/data/agent-chains endpoint - Add WidgetProjectItem and WidgetAgentSessionItem response types Frontend: - Create ActiveProjectsWidget component with dual panels - Active Projects panel: name, color, task/event counts, last activity - Agent Chains panel: status, runtime, message count, expandable details - Real-time updates (projects: 30s, agents: 10s) - PDA-friendly status indicators (Running vs URGENT) Testing: - 7 comprehensive tests covering loading, rendering, empty states, expandability - All tests passing (7/7) Refs #52 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3.4 KiB
3.4 KiB
Issue #52: Active Projects & Agent Chains Widget
Objective
Implement a HUD widget that displays all active projects and their agent chains for easy visual tracking.
Approach
Backend (API)
-
Added new widget data response types in
widget-data.service.ts:WidgetProjectItem- for active project dataWidgetAgentSessionItem- for agent session data
-
Created two new service methods in
WidgetDataService:getActiveProjectsData()- fetches projects wherestatus = 'ACTIVE'getAgentChainsData()- fetches agent sessions whereisActive = true
-
Added two new controller endpoints in
widgets.controller.ts:POST /api/widgets/data/active-projectsPOST /api/widgets/data/agent-chains
Frontend (Web)
-
Created
ActiveProjectsWidget.tsxcomponent with:- Active Projects panel showing:
- Project name with color indicator
- Last activity timestamp
- Task and event counts
- Status indicator
- Agent Chains panel showing:
- Agent label/name
- Status indicator with icon animation
- Runtime duration (formatted)
- Message count and channel
- Expandable context summary
- Real-time updates (projects: 30s, agents: 10s)
- PDA-friendly language ("Running" vs "URGENT")
- Active Projects panel showing:
-
Registered widget in
WidgetRegistry.tsx:- Name:
ActiveProjectsWidget - Display name: "Active Projects & Agent Chains"
- Default size: 2x3 grid units
- Configurable size: 2x2 to 4x4
- Name:
Testing
Created comprehensive test suite in ActiveProjectsWidget.test.tsx:
- ✅ Loading state rendering
- ✅ Active projects list rendering
- ✅ Agent sessions list rendering
- ✅ Empty state handling
- ✅ Expandable session details
- ✅ Runtime formatting
- ✅ Count badge display
Test Results: 7/7 tests passing
Progress
- Backend API endpoints
- Frontend widget component
- Widget registration
- Tests written and passing
- Lint clean
- Type-check clean
Implementation Details
Status Indicators Used
Following PDA-friendly design principles:
- 🟢 Active (green) - not "CRITICAL" or demanding
- 🔵 Running (blue) - for active agents
- ⚪ Ended (gray) - for completed sessions
Real-time Updates
- Projects: Refresh every 30 seconds
- Agent Chains: Refresh every 10 seconds (more frequent due to dynamic nature)
- Future enhancement: WebSocket support for live updates
Expandable Details
Agent sessions can be clicked to reveal:
- Context summary (if available)
- Provides quick insight without cluttering the view
Notes
- Pre-existing build error in
federation/guards/capability.guard.ts(not related to this issue) - Pre-existing test failures in federation module (not related to this issue)
- All widget-specific tests pass
- No lint errors in changed files
- Type-checking clean for widget files
Files Modified
apps/api/src/widgets/widget-data.service.ts- Added new data fetching methodsapps/api/src/widgets/widgets.controller.ts- Added new endpointsapps/web/src/components/widgets/ActiveProjectsWidget.tsx- New widget componentapps/web/src/components/widgets/WidgetRegistry.tsx- Registered widgetapps/web/src/components/widgets/__tests__/ActiveProjectsWidget.test.tsx- New tests
Next Steps
- Create PR for review
- Manual QA testing in browser
- Verify real-time updates work correctly
- Test with various data scenarios (empty, many projects, many agents)