MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / proxyEnvForChild

Function proxyEnvForChild

packages/agent-core/src/utils/proxy.ts:336–354  ·  view source on GitHub ↗
(env: Env = process.env)

Source from the content-addressed store, hash-verified

334 * so an `ALL_PROXY`-only parent still proxies the child.
335 */
336export function proxyEnvForChild(env: Env = process.env): Record<string, string> {
337 if (!hasHttpProxy(env)) return {};
338 const noProxy = resolveNoProxy(env);
339 const result: Record<string, string> = {
340 NODE_USE_ENV_PROXY: '1',
341 NO_PROXY: noProxy,
342 no_proxy: noProxy,
343 };
344 const { httpProxy, httpsProxy } = resolveHttpProxyUrls(env);
345 if (httpProxy !== undefined) {
346 result['HTTP_PROXY'] = httpProxy;
347 result['http_proxy'] = httpProxy;
348 }
349 if (httpsProxy !== undefined) {
350 result['HTTPS_PROXY'] = httpsProxy;
351 result['https_proxy'] = httpsProxy;
352 }
353 return result;
354}
355
356/**
357 * Mirror a server config's `NO_PROXY` override onto both casings of the child

Callers 2

proxy.test.tsFile · 0.90
mergeStdioEnvFunction · 0.90

Calls 3

hasHttpProxyFunction · 0.85
resolveNoProxyFunction · 0.85
resolveHttpProxyUrlsFunction · 0.85

Tested by

no test coverage detected