@qwen-code/qwen-code 0.16.2 → 0.17.0
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/bundled/qc-helper/docs/configuration/settings.md +5 -1
- package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/channels/feishu.md +170 -0
- package/chunks/{agent-RY5EB3XR.js → agent-KVXFGIOU.js} +17 -12
- package/chunks/{anthropicContentGenerator-LYI3OHBB.js → anthropicContentGenerator-L4HWAOIV.js} +5 -5
- package/chunks/{askUserQuestion-R3MKD2JT.js → askUserQuestion-DC6OWQIL.js} +5 -3
- package/chunks/chunk-24YKA2DA.js +233 -0
- package/chunks/{chunk-UFC57OYT.js → chunk-33RDTIU6.js} +5 -3
- package/chunks/{chunk-C6WMLUNB.js → chunk-3BJBCG2K.js} +1 -1
- package/chunks/chunk-3HX5LZ6R.js +1798 -0
- package/chunks/{chunk-GQXXO5HJ.js → chunk-4O2TWJK4.js} +25 -5
- package/chunks/{chunk-RDYWTWEM.js → chunk-5IFG2VC4.js} +299 -232
- package/chunks/chunk-6RQTH7UQ.js +115 -0
- package/chunks/{chunk-7HM6OB7M.js → chunk-7EHPK6TK.js} +1336 -5164
- package/chunks/{chunk-PJLEMR7N.js → chunk-7NNBQRV7.js} +6 -6
- package/chunks/{chunk-K5PGHDBN.js → chunk-AKBFRR6J.js} +112 -132
- package/chunks/{chunk-C27V5A2J.js → chunk-EMVEDSVZ.js} +1 -1
- package/chunks/{chunk-TXQI3VZ7.js → chunk-GJHMAWS7.js} +1 -1
- package/chunks/{chunk-K72FHBFO.js → chunk-HAQCNXSG.js} +1 -0
- package/chunks/{chunk-T4VD6OJ4.js → chunk-HCSJIOLR.js} +1 -1
- package/chunks/chunk-J37FGIOA.js +1623 -0
- package/chunks/chunk-J5VCSWPA.js +1467 -0
- package/chunks/{chunk-UE5LPQF7.js → chunk-JI7FDD65.js} +7 -7
- package/chunks/{chunk-4YNZFYJY.js → chunk-MEN6IEKX.js} +2533 -3943
- package/chunks/{chunk-USE2VQ5P.js → chunk-NP3ICQCN.js} +1 -1
- package/chunks/{chunk-66CJCYYZ.js → chunk-QEXSIXLX.js} +1 -1
- package/chunks/{chunk-YMDXEEOW.js → chunk-R2B65CAN.js} +1 -82
- package/chunks/chunk-SZOEIL6S.js +35 -0
- package/chunks/chunk-TI4GXJKO.js +4277 -0
- package/chunks/{chunk-E7E2MFYM.js → chunk-U2K6HDUJ.js} +434 -13
- package/chunks/{chunk-FO7BIVSR.js → chunk-UQRYJQBE.js} +5 -3
- package/chunks/{chunk-VMOWXTRC.js → chunk-V7LMZR76.js} +1 -1
- package/chunks/chunk-W57YDFU5.js +41 -0
- package/chunks/computer-use-2J5ZXEER.js +768 -0
- package/chunks/{contextCommand-DDGVLQSF.js → contextCommand-52NTEMCT.js} +19 -14
- package/chunks/{cron-create-BTEOGHPH.js → cron-create-FXRORK2U.js} +5 -3
- package/chunks/{cron-delete-56CEWELN.js → cron-delete-D24IN6CA.js} +5 -3
- package/chunks/{cron-list-SV6QRZW2.js → cron-list-SMOX26SL.js} +5 -3
- package/chunks/{devtools-WN62SQPV.js → devtools-IXE4UP72.js} +31 -3748
- package/chunks/{dist-MN2PDDPR.js → dist-6RUZ2JD6.js} +13 -1612
- package/chunks/{dist-R2SXPG74.js → dist-AHZNZWRI.js} +5 -4
- package/chunks/dist-GRQVFL3G.js +94147 -0
- package/chunks/{dist-BXDUQ2QY.js → dist-XTTPOFAH.js} +4 -3
- package/chunks/{edit-4LLGNYVZ.js → edit-RLFUTT5F.js} +20 -14
- package/chunks/{enter-worktree-E2R5XAFT.js → enter-worktree-CYRAPQKJ.js} +20 -14
- package/chunks/{exit-worktree-YVBYYYDD.js → exit-worktree-WQZM72QD.js} +20 -14
- package/chunks/{exitPlanMode-WD5IH7NS.js → exitPlanMode-STFEBQZE.js} +20 -14
- package/chunks/{geminiContentGenerator-LM65ADWM.js → geminiContentGenerator-DIV32SKO.js} +4 -3
- package/chunks/{glob-6X6OCEWE.js → glob-N3XO4RVI.js} +20 -14
- package/chunks/{grep-2UUPSSIQ.js → grep-AK5MP7P3.js} +20 -14
- package/chunks/{ls-MYXAM7LJ.js → ls-7FYQHPWF.js} +5 -3
- package/chunks/{lsp-PFGI35JL.js → lsp-DKG34USR.js} +5 -3
- package/chunks/{monitor-VUHPEGUW.js → monitor-IVBWJZEZ.js} +20 -14
- package/chunks/{notebook-edit-P4QVLW6I.js → notebook-edit-PM46AXFS.js} +21 -15
- package/chunks/{openaiContentGenerator-JH4YNZ3H.js → openaiContentGenerator-4QXCH7L2.js} +13 -10
- package/chunks/{qwenContentGenerator-5FE4UYUT.js → qwenContentGenerator-BLXQIIMX.js} +21 -16
- package/chunks/{read-file-J7DH4OKV.js → read-file-IEQAS3EZ.js} +10 -6
- package/chunks/{ripGrep-33DECY4F.js → ripGrep-HQO7IE4C.js} +17 -12
- package/chunks/{send-message-JUFP62VD.js → send-message-ZL7CDM7K.js} +5 -3
- package/chunks/{serve-7FX7MREA.js → serve-CYRAK4UM.js} +63 -1837
- package/chunks/{shell-ZNTQIRK6.js → shell-UZBGNO2Q.js} +17 -12
- package/chunks/{skill-CFCUIY23.js → skill-JVC34QYN.js} +24 -13
- package/chunks/{src-AHV2CWEQ.js → src-FOODLH7B.js} +49 -41
- package/chunks/{syntheticOutput-AKTXC6FR.js → syntheticOutput-U3YJ3GOO.js} +3 -2
- package/chunks/{task-stop-2NYFR2ES.js → task-stop-NPUI3YBA.js} +5 -3
- package/chunks/{todoWrite-WHZ2O2XP.js → todoWrite-Y6F7YEIM.js} +6 -4
- package/chunks/{tool-search-C2EMLFBJ.js → tool-search-P7PRPOW3.js} +13 -8
- package/chunks/{web-fetch-S6MZXPZ5.js → web-fetch-XWEK4TFX.js} +6 -4
- package/chunks/{write-file-EEPVRS4Q.js → write-file-SIIEUON5.js} +21 -15
- package/cli.js +412 -329
- package/package.json +2 -2
- package/chunks/chunk-JVD46YJV.js +0 -434
- package/chunks/undici-4ARNOH74.js +0 -8
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
createDebugLogger
|
|
5
|
+
} from "./chunk-ACBGEKB7.js";
|
|
3
6
|
import {
|
|
4
7
|
init_esbuild_shims
|
|
5
8
|
} from "./chunk-A4BMJM77.js";
|
|
6
9
|
import {
|
|
7
10
|
__commonJS,
|
|
8
11
|
__name,
|
|
9
|
-
__require
|
|
12
|
+
__require,
|
|
13
|
+
__toESM
|
|
10
14
|
} from "./chunk-J2S4EL5Y.js";
|
|
11
15
|
|
|
12
16
|
// packages/core/node_modules/undici/lib/core/symbols.js
|
|
@@ -8640,7 +8644,7 @@ var require_proxy_agent = __commonJS({
|
|
|
8640
8644
|
return this.#client.destroy(err);
|
|
8641
8645
|
}
|
|
8642
8646
|
};
|
|
8643
|
-
var
|
|
8647
|
+
var ProxyAgent2 = class extends DispatcherBase {
|
|
8644
8648
|
static {
|
|
8645
8649
|
__name(this, "ProxyAgent");
|
|
8646
8650
|
}
|
|
@@ -8786,7 +8790,7 @@ var require_proxy_agent = __commonJS({
|
|
|
8786
8790
|
}
|
|
8787
8791
|
}
|
|
8788
8792
|
__name(throwIfProxyAuthIsSent, "throwIfProxyAuthIsSent");
|
|
8789
|
-
module.exports =
|
|
8793
|
+
module.exports = ProxyAgent2;
|
|
8790
8794
|
}
|
|
8791
8795
|
});
|
|
8792
8796
|
|
|
@@ -8797,7 +8801,7 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
8797
8801
|
init_esbuild_shims();
|
|
8798
8802
|
var DispatcherBase = require_dispatcher_base();
|
|
8799
8803
|
var { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = require_symbols();
|
|
8800
|
-
var
|
|
8804
|
+
var ProxyAgent2 = require_proxy_agent();
|
|
8801
8805
|
var Agent = require_agent();
|
|
8802
8806
|
var DEFAULT_PORTS = {
|
|
8803
8807
|
"http:": 80,
|
|
@@ -8824,13 +8828,13 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
8824
8828
|
this[kNoProxyAgent] = new Agent(agentOpts);
|
|
8825
8829
|
const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY;
|
|
8826
8830
|
if (HTTP_PROXY) {
|
|
8827
|
-
this[kHttpProxyAgent] = new
|
|
8831
|
+
this[kHttpProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTP_PROXY });
|
|
8828
8832
|
} else {
|
|
8829
8833
|
this[kHttpProxyAgent] = this[kNoProxyAgent];
|
|
8830
8834
|
}
|
|
8831
8835
|
const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY;
|
|
8832
8836
|
if (HTTPS_PROXY) {
|
|
8833
|
-
this[kHttpsProxyAgent] = new
|
|
8837
|
+
this[kHttpsProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTPS_PROXY });
|
|
8834
8838
|
} else {
|
|
8835
8839
|
this[kHttpsProxyAgent] = this[kHttpProxyAgent];
|
|
8836
8840
|
}
|
|
@@ -13612,7 +13616,7 @@ var require_fetch = __commonJS({
|
|
|
13612
13616
|
finalizeAndReportTiming(response, "fetch");
|
|
13613
13617
|
}
|
|
13614
13618
|
__name(handleFetchDone, "handleFetchDone");
|
|
13615
|
-
function
|
|
13619
|
+
function fetch2(input, init = void 0) {
|
|
13616
13620
|
webidl.argumentLengthCheck(arguments, 1, "globalThis.fetch");
|
|
13617
13621
|
let p = createDeferredPromise();
|
|
13618
13622
|
let requestObject;
|
|
@@ -13669,7 +13673,7 @@ var require_fetch = __commonJS({
|
|
|
13669
13673
|
});
|
|
13670
13674
|
return p.promise;
|
|
13671
13675
|
}
|
|
13672
|
-
__name(
|
|
13676
|
+
__name(fetch2, "fetch");
|
|
13673
13677
|
function finalizeAndReportTiming(response, initiatorType = "other") {
|
|
13674
13678
|
if (response.type === "error" && response.aborted) {
|
|
13675
13679
|
return;
|
|
@@ -14581,7 +14585,7 @@ var require_fetch = __commonJS({
|
|
|
14581
14585
|
}
|
|
14582
14586
|
__name(httpNetworkFetch, "httpNetworkFetch");
|
|
14583
14587
|
module.exports = {
|
|
14584
|
-
fetch,
|
|
14588
|
+
fetch: fetch2,
|
|
14585
14589
|
Fetch,
|
|
14586
14590
|
fetching,
|
|
14587
14591
|
finalizeAndReportTiming
|
|
@@ -18823,13 +18827,14 @@ var require_eventsource = __commonJS({
|
|
|
18823
18827
|
// packages/core/node_modules/undici/index.js
|
|
18824
18828
|
var require_undici = __commonJS({
|
|
18825
18829
|
"packages/core/node_modules/undici/index.js"(exports, module) {
|
|
18830
|
+
"use strict";
|
|
18826
18831
|
init_esbuild_shims();
|
|
18827
18832
|
var Client = require_client();
|
|
18828
18833
|
var Dispatcher = require_dispatcher();
|
|
18829
18834
|
var Pool = require_pool();
|
|
18830
18835
|
var BalancedPool = require_balanced_pool();
|
|
18831
18836
|
var Agent = require_agent();
|
|
18832
|
-
var
|
|
18837
|
+
var ProxyAgent2 = require_proxy_agent();
|
|
18833
18838
|
var EnvHttpProxyAgent = require_env_http_proxy_agent();
|
|
18834
18839
|
var RetryAgent = require_retry_agent();
|
|
18835
18840
|
var errors = require_errors();
|
|
@@ -18852,7 +18857,7 @@ var require_undici = __commonJS({
|
|
|
18852
18857
|
module.exports.Pool = Pool;
|
|
18853
18858
|
module.exports.BalancedPool = BalancedPool;
|
|
18854
18859
|
module.exports.Agent = Agent;
|
|
18855
|
-
module.exports.ProxyAgent =
|
|
18860
|
+
module.exports.ProxyAgent = ProxyAgent2;
|
|
18856
18861
|
module.exports.EnvHttpProxyAgent = EnvHttpProxyAgent;
|
|
18857
18862
|
module.exports.RetryAgent = RetryAgent;
|
|
18858
18863
|
module.exports.RetryHandler = RetryHandler;
|
|
@@ -18914,7 +18919,7 @@ var require_undici = __commonJS({
|
|
|
18914
18919
|
module.exports.setGlobalDispatcher = setGlobalDispatcher;
|
|
18915
18920
|
module.exports.getGlobalDispatcher = getGlobalDispatcher;
|
|
18916
18921
|
var fetchImpl = require_fetch().fetch;
|
|
18917
|
-
module.exports.fetch = /* @__PURE__ */ __name(async function
|
|
18922
|
+
module.exports.fetch = /* @__PURE__ */ __name(async function fetch2(init, options = void 0) {
|
|
18918
18923
|
try {
|
|
18919
18924
|
return await fetchImpl(init, options);
|
|
18920
18925
|
} catch (err) {
|
|
@@ -18963,9 +18968,425 @@ var require_undici = __commonJS({
|
|
|
18963
18968
|
}
|
|
18964
18969
|
});
|
|
18965
18970
|
|
|
18971
|
+
// packages/core/src/utils/runtimeFetchOptions.ts
|
|
18972
|
+
init_esbuild_shims();
|
|
18973
|
+
var import_undici = __toESM(require_undici(), 1);
|
|
18974
|
+
var debugLogger = createDebugLogger("RUNTIME_FETCH");
|
|
18975
|
+
function detectRuntime() {
|
|
18976
|
+
if (typeof process !== "undefined" && process.versions?.["bun"]) {
|
|
18977
|
+
return "bun";
|
|
18978
|
+
}
|
|
18979
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
18980
|
+
return "node";
|
|
18981
|
+
}
|
|
18982
|
+
return "unknown";
|
|
18983
|
+
}
|
|
18984
|
+
__name(detectRuntime, "detectRuntime");
|
|
18985
|
+
function buildRuntimeFetchOptions(sdkType, proxyUrl) {
|
|
18986
|
+
const runtime = detectRuntime();
|
|
18987
|
+
switch (runtime) {
|
|
18988
|
+
case "bun": {
|
|
18989
|
+
if (sdkType === "openai") {
|
|
18990
|
+
return {
|
|
18991
|
+
fetchOptions: {
|
|
18992
|
+
timeout: false
|
|
18993
|
+
}
|
|
18994
|
+
};
|
|
18995
|
+
} else {
|
|
18996
|
+
const bunFetch = /* @__PURE__ */ __name(async (input, init) => {
|
|
18997
|
+
const bunFetchOptions = {
|
|
18998
|
+
...init,
|
|
18999
|
+
// @ts-expect-error - Bun-specific timeout option
|
|
19000
|
+
timeout: false
|
|
19001
|
+
};
|
|
19002
|
+
return fetch(input, bunFetchOptions);
|
|
19003
|
+
}, "bunFetch");
|
|
19004
|
+
return {
|
|
19005
|
+
fetch: bunFetch
|
|
19006
|
+
};
|
|
19007
|
+
}
|
|
19008
|
+
}
|
|
19009
|
+
case "node": {
|
|
19010
|
+
return buildFetchOptionsWithDispatcher(sdkType, proxyUrl);
|
|
19011
|
+
}
|
|
19012
|
+
default: {
|
|
19013
|
+
return buildFetchOptionsWithDispatcher(sdkType, proxyUrl);
|
|
19014
|
+
}
|
|
19015
|
+
}
|
|
19016
|
+
}
|
|
19017
|
+
__name(buildRuntimeFetchOptions, "buildRuntimeFetchOptions");
|
|
19018
|
+
var dispatcherCache = /* @__PURE__ */ new Map();
|
|
19019
|
+
var proxyFailureCounts = /* @__PURE__ */ new Map();
|
|
19020
|
+
var NO_DISPATCHER_FALLBACK = {
|
|
19021
|
+
openai: void 0,
|
|
19022
|
+
anthropic: {}
|
|
19023
|
+
};
|
|
19024
|
+
function getOrCreateSharedDispatcher(proxyUrl) {
|
|
19025
|
+
const cached = dispatcherCache.get(proxyUrl);
|
|
19026
|
+
if (cached) {
|
|
19027
|
+
return cached;
|
|
19028
|
+
}
|
|
19029
|
+
const dispatcher = new import_undici.ProxyAgent({
|
|
19030
|
+
uri: proxyUrl,
|
|
19031
|
+
headersTimeout: 0,
|
|
19032
|
+
bodyTimeout: 0,
|
|
19033
|
+
keepAliveTimeout: 6e4
|
|
19034
|
+
});
|
|
19035
|
+
dispatcherCache.set(proxyUrl, dispatcher);
|
|
19036
|
+
return dispatcher;
|
|
19037
|
+
}
|
|
19038
|
+
__name(getOrCreateSharedDispatcher, "getOrCreateSharedDispatcher");
|
|
19039
|
+
function extractHostnameFromProxyUrl(proxyUrl) {
|
|
19040
|
+
try {
|
|
19041
|
+
const url = new URL(proxyUrl);
|
|
19042
|
+
if (url.hostname) {
|
|
19043
|
+
return url.port ? `${url.hostname}:${url.port}` : url.hostname;
|
|
19044
|
+
}
|
|
19045
|
+
} catch {
|
|
19046
|
+
}
|
|
19047
|
+
const match = proxyUrl.match(/@([^:/\s]+)(:\d+)?/);
|
|
19048
|
+
return match ? match[1] + (match[2] ?? "") : redactProxyCredentials(proxyUrl);
|
|
19049
|
+
}
|
|
19050
|
+
__name(extractHostnameFromProxyUrl, "extractHostnameFromProxyUrl");
|
|
19051
|
+
function hasPlausibleProxyPort(host) {
|
|
19052
|
+
const portMatch = host.match(/:(\d{1,5})$/);
|
|
19053
|
+
if (!portMatch) {
|
|
19054
|
+
return false;
|
|
19055
|
+
}
|
|
19056
|
+
const port = Number(portMatch[1]);
|
|
19057
|
+
return port >= 80 && port <= 65535;
|
|
19058
|
+
}
|
|
19059
|
+
__name(hasPlausibleProxyPort, "hasPlausibleProxyPort");
|
|
19060
|
+
function hasLocalOrProxyLikeHost(host) {
|
|
19061
|
+
const hostWithoutPort = host.replace(/:\d{1,5}$/, "").toLowerCase();
|
|
19062
|
+
if (hostWithoutPort === "localhost") {
|
|
19063
|
+
return true;
|
|
19064
|
+
}
|
|
19065
|
+
if (/^\d{1,3}(\.\d{1,3}){3}$/.test(hostWithoutPort)) {
|
|
19066
|
+
return true;
|
|
19067
|
+
}
|
|
19068
|
+
return hostWithoutPort.split(/[.-]/).some((label) => /^(proxy|gateway|gw|squid)\d*$/.test(label));
|
|
19069
|
+
}
|
|
19070
|
+
__name(hasLocalOrProxyLikeHost, "hasLocalOrProxyLikeHost");
|
|
19071
|
+
function hasNetworkErrorContext(message, offset) {
|
|
19072
|
+
const context = message.slice(Math.max(0, offset - 80), offset).toLowerCase();
|
|
19073
|
+
return /\b(connect|dispatcher|econnrefused|econnreset|enotfound|etimedout|proxy|tunnel)\b/.test(
|
|
19074
|
+
context
|
|
19075
|
+
);
|
|
19076
|
+
}
|
|
19077
|
+
__name(hasNetworkErrorContext, "hasNetworkErrorContext");
|
|
19078
|
+
function shouldRedactTokenOnlyCredential(host, message, offset) {
|
|
19079
|
+
return hasPlausibleProxyPort(host) && (hasLocalOrProxyLikeHost(host) || hasNetworkErrorContext(message, offset));
|
|
19080
|
+
}
|
|
19081
|
+
__name(shouldRedactTokenOnlyCredential, "shouldRedactTokenOnlyCredential");
|
|
19082
|
+
function redactProxyCredentials(message) {
|
|
19083
|
+
let result = message.replace(/\/\/[^/\s]*@/g, "//<redacted>@");
|
|
19084
|
+
result = result.replace(
|
|
19085
|
+
/(^|[\s([=:])([^\s/@()[\]=]+@[^@\s/()[\]=]+)/g,
|
|
19086
|
+
(match, prefix, candidate, offset, message2) => {
|
|
19087
|
+
const atIndex = candidate.indexOf("@");
|
|
19088
|
+
const userInfo = candidate.slice(0, atIndex);
|
|
19089
|
+
const host = candidate.slice(atIndex + 1);
|
|
19090
|
+
if (!userInfo.includes(":") && !shouldRedactTokenOnlyCredential(host, message2, offset)) {
|
|
19091
|
+
return match;
|
|
19092
|
+
}
|
|
19093
|
+
return `${prefix}<redacted>@${host}`;
|
|
19094
|
+
}
|
|
19095
|
+
);
|
|
19096
|
+
return result;
|
|
19097
|
+
}
|
|
19098
|
+
__name(redactProxyCredentials, "redactProxyCredentials");
|
|
19099
|
+
function redactProxyError(error) {
|
|
19100
|
+
return redactProxyErrorValue(error, /* @__PURE__ */ new WeakMap());
|
|
19101
|
+
}
|
|
19102
|
+
__name(redactProxyError, "redactProxyError");
|
|
19103
|
+
function redactProxyErrorValue(error, seen) {
|
|
19104
|
+
if (typeof error === "string") {
|
|
19105
|
+
return redactProxyCredentials(error);
|
|
19106
|
+
}
|
|
19107
|
+
if (!error || typeof error !== "object") {
|
|
19108
|
+
return error;
|
|
19109
|
+
}
|
|
19110
|
+
if (seen.has(error)) {
|
|
19111
|
+
return seen.get(error);
|
|
19112
|
+
}
|
|
19113
|
+
const errorRecord = error;
|
|
19114
|
+
const needsClone = shouldCloneForRedaction(error, errorRecord);
|
|
19115
|
+
const redactedMessage = typeof errorRecord.message === "string" ? redactProxyCredentials(errorRecord.message) : void 0;
|
|
19116
|
+
const redactedStack = typeof errorRecord.stack === "string" ? redactProxyCredentials(errorRecord.stack) : void 0;
|
|
19117
|
+
let redactedCause = errorRecord.cause;
|
|
19118
|
+
let redactedErrors = errorRecord.errors;
|
|
19119
|
+
if (needsClone) {
|
|
19120
|
+
const clone = Object.create(Object.getPrototypeOf(error));
|
|
19121
|
+
seen.set(error, clone);
|
|
19122
|
+
if (errorRecord.cause !== void 0) {
|
|
19123
|
+
redactedCause = redactProxyErrorValue(errorRecord.cause, seen);
|
|
19124
|
+
}
|
|
19125
|
+
if (errorRecord.errors !== void 0) {
|
|
19126
|
+
redactedErrors = redactProxyErrorCollection(errorRecord.errors, seen);
|
|
19127
|
+
}
|
|
19128
|
+
cloneErrorWithRedactedFields(
|
|
19129
|
+
error,
|
|
19130
|
+
clone,
|
|
19131
|
+
redactedMessage,
|
|
19132
|
+
redactedStack,
|
|
19133
|
+
redactedCause,
|
|
19134
|
+
redactedErrors
|
|
19135
|
+
);
|
|
19136
|
+
return clone;
|
|
19137
|
+
}
|
|
19138
|
+
seen.set(error, error);
|
|
19139
|
+
try {
|
|
19140
|
+
if (redactedMessage !== void 0) {
|
|
19141
|
+
errorRecord.message = redactedMessage;
|
|
19142
|
+
}
|
|
19143
|
+
if (redactedStack !== void 0) {
|
|
19144
|
+
errorRecord.stack = redactedStack;
|
|
19145
|
+
}
|
|
19146
|
+
if (errorRecord.cause !== void 0) {
|
|
19147
|
+
redactedCause = redactProxyErrorValue(errorRecord.cause, seen);
|
|
19148
|
+
errorRecord.cause = redactedCause;
|
|
19149
|
+
}
|
|
19150
|
+
if (errorRecord.errors !== void 0) {
|
|
19151
|
+
redactedErrors = redactProxyErrorCollection(errorRecord.errors, seen);
|
|
19152
|
+
errorRecord.errors = redactedErrors;
|
|
19153
|
+
}
|
|
19154
|
+
return error;
|
|
19155
|
+
} catch {
|
|
19156
|
+
const clone = Object.create(Object.getPrototypeOf(error));
|
|
19157
|
+
seen.set(error, clone);
|
|
19158
|
+
if (errorRecord.cause !== void 0) {
|
|
19159
|
+
redactedCause = redactProxyErrorValue(errorRecord.cause, seen);
|
|
19160
|
+
}
|
|
19161
|
+
if (errorRecord.errors !== void 0) {
|
|
19162
|
+
redactedErrors = redactProxyErrorCollection(errorRecord.errors, seen);
|
|
19163
|
+
}
|
|
19164
|
+
cloneErrorWithRedactedFields(
|
|
19165
|
+
error,
|
|
19166
|
+
clone,
|
|
19167
|
+
redactedMessage,
|
|
19168
|
+
redactedStack,
|
|
19169
|
+
redactedCause,
|
|
19170
|
+
redactedErrors
|
|
19171
|
+
);
|
|
19172
|
+
return clone;
|
|
19173
|
+
}
|
|
19174
|
+
}
|
|
19175
|
+
__name(redactProxyErrorValue, "redactProxyErrorValue");
|
|
19176
|
+
function redactProxyErrorCollection(errors, seen) {
|
|
19177
|
+
if (!Array.isArray(errors)) {
|
|
19178
|
+
return redactProxyErrorValue(errors, seen);
|
|
19179
|
+
}
|
|
19180
|
+
if (seen.has(errors)) {
|
|
19181
|
+
return seen.get(errors);
|
|
19182
|
+
}
|
|
19183
|
+
const redactedErrors = [];
|
|
19184
|
+
seen.set(errors, redactedErrors);
|
|
19185
|
+
for (const error of errors) {
|
|
19186
|
+
redactedErrors.push(redactProxyErrorValue(error, seen));
|
|
19187
|
+
}
|
|
19188
|
+
return redactedErrors;
|
|
19189
|
+
}
|
|
19190
|
+
__name(redactProxyErrorCollection, "redactProxyErrorCollection");
|
|
19191
|
+
function shouldCloneForRedaction(error, errorRecord) {
|
|
19192
|
+
return typeof errorRecord.message === "string" && !canAssignProperty(error, "message") || typeof errorRecord.stack === "string" && !canAssignProperty(error, "stack") || errorRecord.cause !== void 0 && !canAssignProperty(error, "cause") || errorRecord.errors !== void 0 && !canAssignProperty(error, "errors");
|
|
19193
|
+
}
|
|
19194
|
+
__name(shouldCloneForRedaction, "shouldCloneForRedaction");
|
|
19195
|
+
function canAssignProperty(target, key) {
|
|
19196
|
+
let current = target;
|
|
19197
|
+
while (current) {
|
|
19198
|
+
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
19199
|
+
if (descriptor) {
|
|
19200
|
+
if ("writable" in descriptor) {
|
|
19201
|
+
return descriptor.writable === true;
|
|
19202
|
+
}
|
|
19203
|
+
return typeof descriptor.set === "function";
|
|
19204
|
+
}
|
|
19205
|
+
current = Object.getPrototypeOf(current);
|
|
19206
|
+
}
|
|
19207
|
+
return Object.isExtensible(target);
|
|
19208
|
+
}
|
|
19209
|
+
__name(canAssignProperty, "canAssignProperty");
|
|
19210
|
+
function cloneErrorWithRedactedFields(error, clone, redactedMessage, redactedStack, redactedCause, redactedErrors) {
|
|
19211
|
+
const copiedKeys = /* @__PURE__ */ new Set();
|
|
19212
|
+
for (const key of Reflect.ownKeys(error)) {
|
|
19213
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, key);
|
|
19214
|
+
if (!descriptor) {
|
|
19215
|
+
continue;
|
|
19216
|
+
}
|
|
19217
|
+
copiedKeys.add(key);
|
|
19218
|
+
const updatedDescriptor = getRedactedPropertyDescriptor(
|
|
19219
|
+
key,
|
|
19220
|
+
descriptor,
|
|
19221
|
+
redactedMessage,
|
|
19222
|
+
redactedStack,
|
|
19223
|
+
redactedCause,
|
|
19224
|
+
redactedErrors
|
|
19225
|
+
);
|
|
19226
|
+
try {
|
|
19227
|
+
Object.defineProperty(clone, key, updatedDescriptor);
|
|
19228
|
+
} catch {
|
|
19229
|
+
}
|
|
19230
|
+
}
|
|
19231
|
+
defineMissingRedactedValue(clone, copiedKeys, "message", redactedMessage);
|
|
19232
|
+
defineMissingRedactedValue(clone, copiedKeys, "stack", redactedStack);
|
|
19233
|
+
defineMissingRedactedValue(clone, copiedKeys, "cause", redactedCause);
|
|
19234
|
+
defineMissingRedactedValue(clone, copiedKeys, "errors", redactedErrors);
|
|
19235
|
+
}
|
|
19236
|
+
__name(cloneErrorWithRedactedFields, "cloneErrorWithRedactedFields");
|
|
19237
|
+
function getRedactedPropertyDescriptor(key, descriptor, redactedMessage, redactedStack, redactedCause, redactedErrors) {
|
|
19238
|
+
const redactedValue = key === "message" ? redactedMessage : key === "stack" ? redactedStack : key === "cause" ? redactedCause : key === "errors" ? redactedErrors : void 0;
|
|
19239
|
+
if (redactedValue === void 0) {
|
|
19240
|
+
return { ...descriptor };
|
|
19241
|
+
}
|
|
19242
|
+
if ("value" in descriptor) {
|
|
19243
|
+
return { ...descriptor, value: redactedValue };
|
|
19244
|
+
}
|
|
19245
|
+
return {
|
|
19246
|
+
configurable: descriptor.configurable,
|
|
19247
|
+
enumerable: descriptor.enumerable,
|
|
19248
|
+
value: redactedValue,
|
|
19249
|
+
writable: true
|
|
19250
|
+
};
|
|
19251
|
+
}
|
|
19252
|
+
__name(getRedactedPropertyDescriptor, "getRedactedPropertyDescriptor");
|
|
19253
|
+
function defineMissingRedactedValue(target, copiedKeys, key, value) {
|
|
19254
|
+
if (value === void 0 || copiedKeys.has(key)) {
|
|
19255
|
+
return;
|
|
19256
|
+
}
|
|
19257
|
+
try {
|
|
19258
|
+
Object.defineProperty(target, key, {
|
|
19259
|
+
configurable: true,
|
|
19260
|
+
enumerable: false,
|
|
19261
|
+
value,
|
|
19262
|
+
writable: true
|
|
19263
|
+
});
|
|
19264
|
+
} catch {
|
|
19265
|
+
}
|
|
19266
|
+
}
|
|
19267
|
+
__name(defineMissingRedactedValue, "defineMissingRedactedValue");
|
|
19268
|
+
function recordProxyFailure(hostname) {
|
|
19269
|
+
const failureCount = (proxyFailureCounts.get(hostname) ?? 0) + 1;
|
|
19270
|
+
proxyFailureCounts.set(hostname, failureCount);
|
|
19271
|
+
return failureCount;
|
|
19272
|
+
}
|
|
19273
|
+
__name(recordProxyFailure, "recordProxyFailure");
|
|
19274
|
+
function buildFetchOptionsWithDispatcher(sdkType, proxyUrl) {
|
|
19275
|
+
if (!proxyUrl) {
|
|
19276
|
+
return NO_DISPATCHER_FALLBACK[sdkType];
|
|
19277
|
+
}
|
|
19278
|
+
try {
|
|
19279
|
+
const dispatcher = getOrCreateSharedDispatcher(proxyUrl);
|
|
19280
|
+
return { fetchOptions: { dispatcher }, fetch: import_undici.fetch };
|
|
19281
|
+
} catch (error) {
|
|
19282
|
+
const hostname = extractHostnameFromProxyUrl(proxyUrl);
|
|
19283
|
+
const failureCount = recordProxyFailure(hostname);
|
|
19284
|
+
const failureLabel = failureCount === 1 ? "first failure" : `failure #${failureCount}`;
|
|
19285
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
19286
|
+
const redactedMessage = redactProxyCredentials(errorMessage);
|
|
19287
|
+
const logMessage = `Failed to create proxy dispatcher for ${hostname} (${failureLabel}), falling back to direct connection: ${redactedMessage}`;
|
|
19288
|
+
debugLogger.warn(logMessage);
|
|
19289
|
+
console.error(`[RUNTIME_FETCH] ${logMessage}`);
|
|
19290
|
+
return NO_DISPATCHER_FALLBACK[sdkType];
|
|
19291
|
+
}
|
|
19292
|
+
}
|
|
19293
|
+
__name(buildFetchOptionsWithDispatcher, "buildFetchOptionsWithDispatcher");
|
|
19294
|
+
|
|
19295
|
+
// packages/core/src/utils/request-tokenizer/textTokenizer.ts
|
|
19296
|
+
init_esbuild_shims();
|
|
19297
|
+
var TextTokenizer = class {
|
|
19298
|
+
static {
|
|
19299
|
+
__name(this, "TextTokenizer");
|
|
19300
|
+
}
|
|
19301
|
+
/**
|
|
19302
|
+
* Calculate tokens for text content
|
|
19303
|
+
*
|
|
19304
|
+
* @param text - The text to estimate tokens for
|
|
19305
|
+
* @returns The estimated token count
|
|
19306
|
+
*/
|
|
19307
|
+
async calculateTokens(text) {
|
|
19308
|
+
return this.calculateTokensSync(text);
|
|
19309
|
+
}
|
|
19310
|
+
/**
|
|
19311
|
+
* Calculate tokens for multiple text strings
|
|
19312
|
+
*
|
|
19313
|
+
* @param texts - Array of text strings to estimate tokens for
|
|
19314
|
+
* @returns Array of token counts corresponding to each input text
|
|
19315
|
+
*/
|
|
19316
|
+
async calculateTokensBatch(texts) {
|
|
19317
|
+
return texts.map((text) => this.calculateTokensSync(text));
|
|
19318
|
+
}
|
|
19319
|
+
calculateTokensSync(text) {
|
|
19320
|
+
if (!text || text.length === 0) {
|
|
19321
|
+
return 0;
|
|
19322
|
+
}
|
|
19323
|
+
let asciiChars = 0;
|
|
19324
|
+
let nonAsciiChars = 0;
|
|
19325
|
+
for (let i = 0; i < text.length; i++) {
|
|
19326
|
+
const charCode = text.charCodeAt(i);
|
|
19327
|
+
if (charCode < 128) {
|
|
19328
|
+
asciiChars++;
|
|
19329
|
+
} else {
|
|
19330
|
+
nonAsciiChars++;
|
|
19331
|
+
}
|
|
19332
|
+
}
|
|
19333
|
+
const tokens = asciiChars / 4 + nonAsciiChars * 1.1;
|
|
19334
|
+
return Math.ceil(tokens);
|
|
19335
|
+
}
|
|
19336
|
+
};
|
|
19337
|
+
|
|
19338
|
+
// packages/core/src/utils/request-tokenizer/supportedImageFormats.ts
|
|
19339
|
+
init_esbuild_shims();
|
|
19340
|
+
var SUPPORTED_IMAGE_MIME_TYPES = [
|
|
19341
|
+
"image/bmp",
|
|
19342
|
+
"image/jpeg",
|
|
19343
|
+
"image/jpg",
|
|
19344
|
+
// Alternative MIME type for JPEG
|
|
19345
|
+
"image/png",
|
|
19346
|
+
"image/tiff",
|
|
19347
|
+
"image/webp",
|
|
19348
|
+
"image/heic"
|
|
19349
|
+
];
|
|
19350
|
+
function isSupportedImageMimeType(mimeType) {
|
|
19351
|
+
return SUPPORTED_IMAGE_MIME_TYPES.includes(
|
|
19352
|
+
mimeType
|
|
19353
|
+
);
|
|
19354
|
+
}
|
|
19355
|
+
__name(isSupportedImageMimeType, "isSupportedImageMimeType");
|
|
19356
|
+
function getSupportedImageFormatsString() {
|
|
19357
|
+
return SUPPORTED_IMAGE_MIME_TYPES.map(
|
|
19358
|
+
(type) => type.replace("image/", "").toUpperCase()
|
|
19359
|
+
).join(", ");
|
|
19360
|
+
}
|
|
19361
|
+
__name(getSupportedImageFormatsString, "getSupportedImageFormatsString");
|
|
19362
|
+
function getUnsupportedImageFormatWarning() {
|
|
19363
|
+
return `Only the following image formats are supported: ${getSupportedImageFormatsString()}. Other formats may not work as expected.`;
|
|
19364
|
+
}
|
|
19365
|
+
__name(getUnsupportedImageFormatWarning, "getUnsupportedImageFormatWarning");
|
|
19366
|
+
|
|
18966
19367
|
export {
|
|
18967
|
-
require_undici
|
|
19368
|
+
require_undici,
|
|
19369
|
+
detectRuntime,
|
|
19370
|
+
buildRuntimeFetchOptions,
|
|
19371
|
+
getOrCreateSharedDispatcher,
|
|
19372
|
+
redactProxyCredentials,
|
|
19373
|
+
redactProxyError,
|
|
19374
|
+
TextTokenizer,
|
|
19375
|
+
SUPPORTED_IMAGE_MIME_TYPES,
|
|
19376
|
+
isSupportedImageMimeType,
|
|
19377
|
+
getSupportedImageFormatsString,
|
|
19378
|
+
getUnsupportedImageFormatWarning
|
|
18968
19379
|
};
|
|
19380
|
+
/**
|
|
19381
|
+
* @license
|
|
19382
|
+
* Copyright 2025 Qwen Team
|
|
19383
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
19384
|
+
*/
|
|
19385
|
+
/**
|
|
19386
|
+
* @license
|
|
19387
|
+
* Copyright 2025 Qwen
|
|
19388
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
19389
|
+
*/
|
|
18969
19390
|
/*! Bundled license information:
|
|
18970
19391
|
|
|
18971
19392
|
undici/lib/web/fetch/body.js:
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
3
|
import {
|
|
4
|
-
BaseDeclarativeTool,
|
|
5
|
-
BaseToolInvocation,
|
|
6
4
|
ToolDisplayNames,
|
|
7
5
|
ToolNames
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6RQTH7UQ.js";
|
|
7
|
+
import {
|
|
8
|
+
BaseDeclarativeTool,
|
|
9
|
+
BaseToolInvocation
|
|
10
|
+
} from "./chunk-R2B65CAN.js";
|
|
9
11
|
import {
|
|
10
12
|
init_esbuild_shims
|
|
11
13
|
} from "./chunk-A4BMJM77.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
init_esbuild_shims
|
|
5
|
+
} from "./chunk-A4BMJM77.js";
|
|
6
|
+
import {
|
|
7
|
+
__name
|
|
8
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
9
|
+
|
|
10
|
+
// packages/core/src/utils/safeJsonStringify.ts
|
|
11
|
+
init_esbuild_shims();
|
|
12
|
+
function safeJsonStringify(obj, space) {
|
|
13
|
+
const ancestors = [];
|
|
14
|
+
return JSON.stringify(
|
|
15
|
+
obj,
|
|
16
|
+
function(_key, value) {
|
|
17
|
+
if (typeof value !== "object" || value === null) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
|
|
21
|
+
ancestors.pop();
|
|
22
|
+
}
|
|
23
|
+
if (ancestors.includes(value)) {
|
|
24
|
+
return "[Circular]";
|
|
25
|
+
}
|
|
26
|
+
ancestors.push(value);
|
|
27
|
+
return value;
|
|
28
|
+
},
|
|
29
|
+
space
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
__name(safeJsonStringify, "safeJsonStringify");
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
safeJsonStringify
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
* Copyright 2025 Google LLC
|
|
40
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
41
|
+
*/
|