MCPcopy Create free account
hub / github.com/Noumena-Network/code / readTeamMembers

Function readTeamMembers

src/utils/tasks.ts:725–754  ·  view source on GitHub ↗

* Reads team members from the team file

(
  teamName: string,
)

Source from the content-addressed store, hash-verified

723 * Reads team members from the team file
724 */
725async 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.

Callers 1

getAgentStatusesFunction · 0.85

Calls 7

getTeamsDirFunction · 0.85
readFileFunction · 0.85
jsonParseFunction · 0.85
getErrnoCodeFunction · 0.85
sanitizeNameFunction · 0.70
logForDebuggingFunction · 0.70
errorMessageFunction · 0.70

Tested by

no test coverage detected