@kenkaiiii/gg-ai 5.83.3 → 5.83.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1771,8 +1771,20 @@ function parseToolArguments(argsJson) {
1771
1771
  // src/utils/provider-fetch.ts
1772
1772
  var import_undici = require("undici");
1773
1773
  var PROVIDER_TRANSPORT_TIMEOUT_MS = 30 * 6e4;
1774
- function createProviderFetch(timeoutMs) {
1775
- const dispatcher = new import_undici.Agent({ headersTimeout: timeoutMs, bodyTimeout: timeoutMs });
1774
+ function nodeUsesEnvProxy({
1775
+ env = process.env,
1776
+ execArgv = process.execArgv,
1777
+ nodeVersion = process.versions.node
1778
+ } = {}) {
1779
+ const flags = [...execArgv, ...(env.NODE_OPTIONS ?? "").split(/\s+/)];
1780
+ if (flags.includes("--use-env-proxy")) return true;
1781
+ if (env.NODE_USE_ENV_PROXY !== "1") return false;
1782
+ const [major = 0, minor = 0] = nodeVersion.split(".").map(Number);
1783
+ return major >= 24 || major === 22 && minor >= 21;
1784
+ }
1785
+ function createProviderFetch(timeoutMs, { useEnvProxy = nodeUsesEnvProxy() } = {}) {
1786
+ const timeouts = { headersTimeout: timeoutMs, bodyTimeout: timeoutMs };
1787
+ const dispatcher = useEnvProxy ? new import_undici.EnvHttpProxyAgent(timeouts) : new import_undici.Agent(timeouts);
1776
1788
  const builtinFetch = globalThis.fetch;
1777
1789
  const providerFetch2 = async (input, init2) => {
1778
1790
  if (globalThis.fetch !== builtinFetch || input instanceof Request || init2?.body instanceof FormData) {