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

Function getCurrentAgentInfo

src/utils/telemetry/perfettoTracing.ts:147–167  ·  view source on GitHub ↗

* Get current agent info

()

Source from the content-addressed store, hash-verified

145 * Get current agent info
146 */
147function getCurrentAgentInfo(): AgentInfo {
148 const agentId = getAgentId() ?? getSessionId()
149 const agentName = getAgentName() ?? 'main'
150 const parentSessionId = getParentSessionId()
151
152 // Check if we've already registered this agent
153 const existing = agentRegistry.get(agentId)
154 if (existing) return existing
155
156 const info: AgentInfo = {
157 agentId,
158 agentName,
159 parentAgentId: parentSessionId,
160 processId: agentId === getSessionId() ? 1 : getProcessIdForAgent(agentId),
161 threadId: stringToNumericHash(agentName),
162 }
163
164 agentRegistry.set(agentId, info)
165 totalAgentCount++
166 return info
167}
168
169/**
170 * Get timestamp in microseconds relative to trace start

Callers 7

startToolPerfettoSpanFunction · 0.85
emitPerfettoInstantFunction · 0.85
emitPerfettoCounterFunction · 0.85

Calls 8

getAgentIdFunction · 0.85
getSessionIdFunction · 0.85
getAgentNameFunction · 0.85
getProcessIdForAgentFunction · 0.85
stringToNumericHashFunction · 0.85
getMethod · 0.65
getParentSessionIdFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected