Review asked why this is a plugin and why it exports so much. The design note this branch shipped answered the second question itself — "a pure resolution function plus an installation function" — and the code drifted to seventeen exports and a Cordis plugin nobody approved or mounted. The plugin is gone. Transport policy has one answer per process: nothing to swap, and no scope narrower than the process to give one. Its `Config` was also the only supplier of a configuration branch, so resolution now reads the environment and nothing else — `mode`, the config-sourced fields, and the `config` policy source were unreachable the moment the plugin left. Four exports nothing outside the package used are internal again, and `currentProxyPolicy` answers with the direct policy instead of `undefined`, so `DIRECT_POLICY` no longer needs a public face. Nine functions remain, one per way a caller can need the policy; two is not reachable with six consumer seams. The package moves to `util/`. The note claimed a dependency on `undici` disqualified it from that group; the charter governs harness dependencies, not external ones, and the process note that says so predates this branch. The real blocker was the harness dependency: resolution needed one method of `LaunchEnvironmentSnapshot`, so it names a structural `EnvLookup` and the launcher passes its snapshot unchanged. `net/` is dissolved. Dropping the group's line from the repository layout also returns `AGENTS.md` to its original ceiling, so the raise the merge needed is reverted.
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
/**
|
|
* Outbound HTTP proxy support for DeepSeek Harness.
|
|
*
|
|
* Node's built-in `fetch` ignores `HTTP_PROXY` and friends, so every harness request would connect
|
|
* directly no matter what the user exported. This library resolves one policy from the launch
|
|
* environment and installs it as undici's global dispatcher, which is what `fetch` resolves — so
|
|
* LLM adapters, web search, MCP over HTTP, telemetry, and sandbox SDKs are all covered without
|
|
* touching their code.
|
|
*
|
|
* The launcher resolves and installs once, before the first plugin mounts. This is a library, not a
|
|
* plugin: transport policy has one answer per process, so there is nothing for a composition to
|
|
* mount, swap, or scope.
|
|
*
|
|
* Six exports, one per way a caller can need the policy: resolve it, install it, get a dispatcher
|
|
* for a request, get a `node:http` agent for an SDK that takes one, get a proxy URL for an SDK that
|
|
* takes that, and get the environment a spawned child needs.
|
|
* @module @deepseek-ai/dsh-http-proxy
|
|
*/
|
|
|
|
export {
|
|
proxyForUrl,
|
|
resolveProxyPolicy,
|
|
PROXY_ENV_NAMES,
|
|
type EnvLookup,
|
|
type ProxyDiagnostic,
|
|
type ProxyPolicy,
|
|
type ProxyResolution,
|
|
} from './policy.ts'
|
|
|
|
export {
|
|
childProxyEnv,
|
|
createDispatcher,
|
|
createNodeHttpAgent,
|
|
currentProxyPolicy,
|
|
installGlobalProxy,
|
|
proxyUrlFor,
|
|
} from './install.ts'
|