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

Function withoutHostManagedProviderVars

src/utils/managedEnv.ts:50–64  ·  view source on GitHub ↗

* When the host owns inference routing (sets * CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST in spawn env), strip * provider-selection / model-default vars from settings-sourced env so a * user's user settings (~/.ncode/settings.json; legacy ~/.claude/settings.json) * can't redirect requests away from th

(
  env: Record<string, string> | undefined,
)

Source from the content-addressed store, hash-verified

48 * can't redirect requests away from the host-configured provider.
49 */
50function withoutHostManagedProviderVars(
51 env: Record<string, string> | undefined,
52): Record<string, string> {
53 if (!env) return {}
54 if (!isEnvTruthy(process.env.CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST)) {
55 return env
56 }
57 const out: Record<string, string> = {}
58 for (const [key, value] of Object.entries(env)) {
59 if (!isProviderManagedEnvVar(key)) {
60 out[key] = value
61 }
62 }
63 return out
64}
65
66/**
67 * Snapshot of env keys present before any settings.env is applied — for CCD,

Callers 1

filterSettingsEnvFunction · 0.85

Calls 3

isEnvTruthyFunction · 0.90
isProviderManagedEnvVarFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected