MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isTeamLead

Function isTeamLead

src/utils/teammate.ts:171–198  ·  view source on GitHub ↗
(
  teamContext:
    | {
        leadAgentId: string
      }
    | undefined,
)

Source from the content-addressed store, hash-verified

169 * @returns true if this session is the team lead
170 */
171export function isTeamLead(
172 teamContext:
173 | {
174 leadAgentId: string
175 }
176 | undefined,
177): boolean {
178 if (!teamContext?.leadAgentId) {
179 return false
180 }
181
182 // Use getAgentId() for AsyncLocalStorage support (in-process teammates)
183 const myAgentId = getAgentId()
184 const leadAgentId = teamContext.leadAgentId
185
186 // If my agent ID matches the lead agent ID, I'm the lead
187 if (myAgentId === leadAgentId) {
188 return true
189 }
190
191 // Backwards compat: if no agent ID is set and we have a team context,
192 // this is the original session that created the team (the lead)
193 if (!myAgentId) {
194 return true
195 }
196
197 return false
198}
199
200/**
201 * Checks if there are any active in-process teammates running.

Callers 7

handlePlanApprovalFunction · 0.85
handlePlanRejectionFunction · 0.85
runFunction · 0.85
useTasksV2Function · 0.85
getAgentNameToPollFunction · 0.85
useInboxPollerFunction · 0.85

Calls 1

getAgentIdFunction · 0.85

Tested by

no test coverage detected