MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getUserAgent

Function getUserAgent

source code/utils/http.ts:20–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18// WARNING: We rely on `claude-cli` in the user agent for log filtering.
19// Please do NOT change this without making sure that logging also gets updated!
20export function getUserAgent(): string {
21 const agentSdkVersion = process.env.CLAUDE_AGENT_SDK_VERSION
22 ? `, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`
23 : ''
24 // SDK consumers can identify their app/library via CLAUDE_AGENT_SDK_CLIENT_APP
25 // e.g., "my-app/1.0.0" or "my-library/2.1"
26 const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP
27 ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`
28 : ''
29 // Turn-/process-scoped workload tag for cron-initiated requests. 1P-only
30 // observability — proxies strip HTTP headers; QoS routing uses cc_workload
31 // in the billing-header attribution block instead (see constants/system.ts).
32 // getAnthropicClient (client.ts:98) calls this per-request inside withRetry,
33 // so the read picks up the same setWorkload() value as getAttributionHeader.
34 const workload = getWorkload()
35 const workloadSuffix = workload ? `, workload/${workload}` : ''
36 return `claude-cli/${MACRO.VERSION} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? 'cli'}${agentSdkVersion}${clientApp}${workloadSuffix})`
37}
38
39export function getMCPUserAgent(): string {
40 const parts: string[] = []

Callers 6

submitFeedbackFunction · 0.85
submitTranscriptShareFunction · 0.85
checkEndpointFunction · 0.85
connectVoiceStreamFunction · 0.85
grove.tsFile · 0.85
getAnthropicClientFunction · 0.85

Calls 1

getWorkloadFunction · 0.85

Tested by

no test coverage detected