* Reads team members from the team file
( teamName: string, )
| 723 | * Reads team members from the team file |
| 724 | */ |
| 725 | async function readTeamMembers( |
| 726 | teamName: string, |
| 727 | ): Promise<{ leadAgentId: string; members: TeamMember[] } | null> { |
| 728 | const teamsDir = getTeamsDir() |
| 729 | const teamFilePath = join(teamsDir, sanitizeName(teamName), 'config.json') |
| 730 | try { |
| 731 | const content = await readFile(teamFilePath, 'utf-8') |
| 732 | const teamFile = jsonParse(content) as { |
| 733 | leadAgentId: string |
| 734 | members: TeamMember[] |
| 735 | } |
| 736 | return { |
| 737 | leadAgentId: teamFile.leadAgentId, |
| 738 | members: teamFile.members.map(m => ({ |
| 739 | agentId: m.agentId, |
| 740 | name: m.name, |
| 741 | agentType: m.agentType, |
| 742 | })), |
| 743 | } |
| 744 | } catch (e) { |
| 745 | const code = getErrnoCode(e) |
| 746 | if (code === 'ENOENT') { |
| 747 | return null |
| 748 | } |
| 749 | logForDebugging( |
| 750 | `[Tasks] Failed to read team file for ${teamName}: ${errorMessage(e)}`, |
| 751 | ) |
| 752 | return null |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * Gets the status of all agents in a team based on task ownership. |
no test coverage detected