MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / initializeAssistantTeam

Function initializeAssistantTeam

src/assistant/index.ts:52–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 * context object matching AppState.teamContext.
51 */
52export async function initializeAssistantTeam(): Promise<
53 AppState['teamContext']
54> {
55 const sessionId = getSessionId()
56 const teamName = sanitizeName(`assistant-${sessionId.slice(0, 8)}`)
57 const leadAgentId = formatAgentId(TEAM_LEAD_NAME, teamName)
58 const teamFilePath = getTeamFilePath(teamName)
59 const now = Date.now()
60 const cwd = getCwd()
61 const color = assignTeammateColor(leadAgentId)
62
63 const teamFile: TeamFile = {
64 name: teamName,
65 description: 'Assistant mode in-process team',
66 createdAt: now,
67 leadAgentId,
68 leadSessionId: sessionId,
69 members: [
70 {
71 agentId: leadAgentId,
72 name: TEAM_LEAD_NAME,
73 agentType: 'assistant',
74 color,
75 joinedAt: now,
76 tmuxPaneId: '',
77 cwd,
78 subscriptions: [],
79 backendType: 'in-process',
80 },
81 ],
82 }
83
84 await writeTeamFileAsync(teamName, teamFile)
85 registerTeamForSessionCleanup(teamName)
86 await resetTaskList(teamName)
87 await ensureTasksDir(teamName)
88 setLeaderTeamName(teamName)
89
90 return {
91 teamName,
92 teamFilePath,
93 leadAgentId,
94 selfAgentId: leadAgentId,
95 selfAgentName: TEAM_LEAD_NAME,
96 isLeader: true,
97 selfAgentColor: color,
98 teammates: {
99 [leadAgentId]: {
100 name: TEAM_LEAD_NAME,
101 agentType: 'assistant',
102 color,
103 tmuxSessionName: 'in-process',
104 tmuxPaneId: 'leader',
105 cwd,
106 spawnedAt: now,
107 },
108 },
109 }

Callers 1

index.test.tsFile · 0.90

Calls 12

getSessionIdFunction · 0.85
formatAgentIdFunction · 0.85
getTeamFilePathFunction · 0.85
getCwdFunction · 0.85
assignTeammateColorFunction · 0.85
writeTeamFileAsyncFunction · 0.85
resetTaskListFunction · 0.85
ensureTasksDirFunction · 0.85
setLeaderTeamNameFunction · 0.85
nowMethod · 0.80
sanitizeNameFunction · 0.50

Tested by

no test coverage detected