feat(#233): Connect agent dashboard to real orchestrator API
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline failed

- Add GET /agents endpoint to orchestrator controller
- Update AgentStatusWidget to fetch from real API instead of mock data
- Add comprehensive tests for listAgents endpoint
- Auto-refresh agent list every 30 seconds
- Display agent status with proper icons and formatting
- Show error states when API is unavailable

Fixes #233

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-05 12:31:07 -06:00
parent 06fa8f7402
commit 27bbbe79df
24 changed files with 800 additions and 61 deletions

View File

@@ -70,6 +70,47 @@ export class AgentsController {
}
}
/**
* List all agents
* @returns Array of all agent sessions with their status
*/
@Get()
listAgents(): {
agentId: string;
taskId: string;
status: string;
agentType: string;
spawnedAt: string;
completedAt?: string;
error?: string;
}[] {
this.logger.log("Received request to list all agents");
try {
// Get all sessions from spawner service
const sessions = this.spawnerService.listAgentSessions();
// Map to response format
const agents = sessions.map((session) => ({
agentId: session.agentId,
taskId: session.taskId,
status: session.state,
agentType: session.agentType,
spawnedAt: session.spawnedAt.toISOString(),
completedAt: session.completedAt?.toISOString(),
error: session.error,
}));
this.logger.log(`Found ${agents.length.toString()} agents`);
return agents;
} catch (error: unknown) {
const errorMessage = error instanceof Error ? error.message : String(error);
this.logger.error(`Failed to list agents: ${errorMessage}`);
throw new Error(`Failed to list agents: ${errorMessage}`);
}
}
/**
* Get agent status
* @param agentId Agent ID to query