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