MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / getUserAgent

Function getUserAgent

src/utils/http.ts:30–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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