MCPcopy Create free account
hub / github.com/Noumena-Network/code / getUserAgent

Function getUserAgent

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

Source from the content-addressed store, hash-verified

10import { getWorkload } from './workloadContext.js'
11
12export function getUserAgent(): string {
13 const agentSdkVersion = process.env.NCODE_AGENT_SDK_VERSION
14 ? `, agent-sdk/${process.env.NCODE_AGENT_SDK_VERSION}`
15 : ''
16 // SDK consumers can identify their app/library via NCODE_AGENT_SDK_CLIENT_APP
17 // e.g., "my-app/1.0.0" or "my-library/2.1"
18 const clientApp = process.env.NCODE_AGENT_SDK_CLIENT_APP
19 ? `, client-app/${process.env.NCODE_AGENT_SDK_CLIENT_APP}`
20 : ''
21 // Turn-/process-scoped workload tag for cron-initiated requests. 1P-only
22 // observability — proxies strip HTTP headers; QoS routing uses cc_workload
23 // in the billing-header attribution block instead (see constants/system.ts).
24 // getAnthropicClient (client.ts:98) calls this per-request inside withRetry,
25 // so the read picks up the same setWorkload() value as getAttributionHeader.
26 const workload = getWorkload()
27 const workloadSuffix = workload ? `, workload/${workload}` : ''
28 return `ncode/${MACRO.VERSION} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? 'cli'}${agentSdkVersion}${clientApp}${workloadSuffix})`
29}
30
31export function getMCPUserAgent(): string {
32 const parts: string[] = []

Callers 9

submitFeedbackFunction · 0.85
submitTranscriptShareFunction · 0.85
fetchCcsharePayloadFunction · 0.85
checkEndpointFunction · 0.85
postBuddyReactionFunction · 0.85
connectVoiceStreamFunction · 0.85
grove.tsFile · 0.85

Calls 1

getWorkloadFunction · 0.85

Tested by

no test coverage detected