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