(teamName?: string)
| 649 | * This is needed to send permission requests to the leader's mailbox |
| 650 | */ |
| 651 | export async function getLeaderName(teamName?: string): Promise<string | null> { |
| 652 | const team = teamName || getTeamName() |
| 653 | if (!team) { |
| 654 | return null |
| 655 | } |
| 656 | |
| 657 | const teamFile = await readTeamFileAsync(team) |
| 658 | if (!teamFile) { |
| 659 | logForDebugging(`[PermissionSync] Team file not found for team: ${team}`) |
| 660 | return null |
| 661 | } |
| 662 | |
| 663 | const leadMember = teamFile.members.find( |
| 664 | m => m.agentId === teamFile.leadAgentId, |
| 665 | ) |
| 666 | return leadMember?.name || 'team-lead' |
| 667 | } |
| 668 | |
| 669 | /** |
| 670 | * Send a permission request to the leader via mailbox. |
no test coverage detected