@kenkaiiii/gg-ai 5.83.3 → 5.83.5
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 +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1684,10 +1684,22 @@ function parseToolArguments(argsJson) {
|
|
|
1684
1684
|
}
|
|
1685
1685
|
|
|
1686
1686
|
// src/utils/provider-fetch.ts
|
|
1687
|
-
import { Agent, fetch as undiciFetch } from "undici";
|
|
1687
|
+
import { Agent, EnvHttpProxyAgent, fetch as undiciFetch } from "undici";
|
|
1688
1688
|
var PROVIDER_TRANSPORT_TIMEOUT_MS = 30 * 6e4;
|
|
1689
|
-
function
|
|
1690
|
-
|
|
1689
|
+
function nodeUsesEnvProxy({
|
|
1690
|
+
env = process.env,
|
|
1691
|
+
execArgv = process.execArgv,
|
|
1692
|
+
nodeVersion = process.versions.node
|
|
1693
|
+
} = {}) {
|
|
1694
|
+
const flags = [...execArgv, ...(env.NODE_OPTIONS ?? "").split(/\s+/)];
|
|
1695
|
+
if (flags.includes("--use-env-proxy")) return true;
|
|
1696
|
+
if (env.NODE_USE_ENV_PROXY !== "1") return false;
|
|
1697
|
+
const [major = 0, minor = 0] = nodeVersion.split(".").map(Number);
|
|
1698
|
+
return major >= 24 || major === 22 && minor >= 21;
|
|
1699
|
+
}
|
|
1700
|
+
function createProviderFetch(timeoutMs, { useEnvProxy = nodeUsesEnvProxy() } = {}) {
|
|
1701
|
+
const timeouts = { headersTimeout: timeoutMs, bodyTimeout: timeoutMs };
|
|
1702
|
+
const dispatcher = useEnvProxy ? new EnvHttpProxyAgent(timeouts) : new Agent(timeouts);
|
|
1691
1703
|
const builtinFetch = globalThis.fetch;
|
|
1692
1704
|
const providerFetch2 = async (input, init2) => {
|
|
1693
1705
|
if (globalThis.fetch !== builtinFetch || input instanceof Request || init2?.body instanceof FormData) {
|