()
| 63 | } |
| 64 | |
| 65 | async function formatTeamsSection(): Promise<string> { |
| 66 | const teamNames = await listTeamNames() |
| 67 | if (teamNames.length === 0) { |
| 68 | return ['Teams: 0', ' none'].join('\n') |
| 69 | } |
| 70 | |
| 71 | const lines = [`Teams: ${teamNames.length}`] |
| 72 | for (const teamName of teamNames) { |
| 73 | const teammates = getTeammateStatuses(teamName) |
| 74 | const tasks = await listTasks(teamName) |
| 75 | const openTasks = tasks.filter(t => t.status !== 'completed') |
| 76 | const running = teammates.filter(t => t.status === 'running').length |
| 77 | const idle = teammates.filter(t => t.status === 'idle').length |
| 78 | lines.push( |
| 79 | ` ${teamName}: teammates=${teammates.length} running=${running} idle=${idle} open_tasks=${openTasks.length}`, |
| 80 | ) |
| 81 | for (const teammate of teammates.slice(0, 5)) { |
| 82 | const ownerTasks = openTasks.filter( |
| 83 | t => t.owner === teammate.name || t.owner === teammate.agentId, |
| 84 | ) |
| 85 | lines.push( |
| 86 | ` @${teammate.name}: ${teammate.status} backend=${teammate.backendType ?? 'unknown'} mode=${teammate.mode ?? 'default'} tasks=${ownerTasks.length}`, |
| 87 | ) |
| 88 | } |
| 89 | if (teammates.length > 5) { |
| 90 | lines.push(` ... ${teammates.length - 5} more teammate(s)`) |
| 91 | } |
| 92 | } |
| 93 | return lines.join('\n') |
| 94 | } |
| 95 | |
| 96 | async function formatCronSection(nowMs: number): Promise<string> { |
| 97 | const jobs = await listAllCronTasks() |
no test coverage detected