MCPcopy
hub / github.com/codeaashu/claude-code / extractAgentIdsFromMessages

Function extractAgentIdsFromMessages

src/utils/sessionStorage.ts:4244–4263  ·  view source on GitHub ↗
(messages: Message[])

Source from the content-addressed store, hash-verified

4242 * This captures sync agents that emit progress messages during execution.
4243 */
4244export function extractAgentIdsFromMessages(messages: Message[]): string[] {
4245 const agentIds: string[] = []
4246
4247 for (const message of messages) {
4248 if (
4249 message.type === 'progress' &&
4250 message.data &&
4251 typeof message.data === 'object' &&
4252 'type' in message.data &&
4253 (message.data.type === 'agent_progress' ||
4254 message.data.type === 'skill_progress') &&
4255 'agentId' in message.data &&
4256 typeof message.data.agentId === 'string'
4257 ) {
4258 agentIds.push(message.data.agentId)
4259 }
4260 }
4261
4262 return uniq(agentIds)
4263}
4264
4265/**
4266 * Extract teammate transcripts directly from AppState tasks.

Callers 1

submitTranscriptShareFunction · 0.85

Calls 2

uniqFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected