@dedenlabs/claude-code-router-cli 2.0.8-beta.1 → 2.0.8-beta.3
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/cli.js +35 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -44,19 +44,23 @@ function __shouldBypassProxy(url) {
|
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
var __OriginalProxyAgent;
|
|
47
|
+
var __localAddresses, __OriginalProxyAgent, __OriginalFetch;
|
|
48
48
|
var init_proxy_bypass = __esm({
|
|
49
49
|
"src/inject/proxy-bypass.ts"() {
|
|
50
50
|
"use strict";
|
|
51
|
+
__localAddresses = ["localhost", "127.0.0.1", "0.0.0.0", "::1"];
|
|
52
|
+
for (let i = 16; i <= 31; i++) {
|
|
53
|
+
__localAddresses.push(`172.${i}.0.0/16`);
|
|
54
|
+
}
|
|
55
|
+
__localAddresses.push("192.168.0.0/16");
|
|
56
|
+
__localAddresses.push("10.0.0.0/8");
|
|
51
57
|
if (!process.env.NO_PROXY) {
|
|
52
|
-
process.env.NO_PROXY = "
|
|
58
|
+
process.env.NO_PROXY = __localAddresses.join(",");
|
|
53
59
|
} else {
|
|
54
60
|
const noProxy = process.env.NO_PROXY;
|
|
55
|
-
const additions =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!noProxy.includes("0.0.0.0")) additions.push("0.0.0.0");
|
|
59
|
-
if (!noProxy.includes("::1")) additions.push("::1");
|
|
61
|
+
const additions = __localAddresses.filter(
|
|
62
|
+
(addr) => !noProxy.includes(addr) && !noProxy.includes(addr.split("/")[0])
|
|
63
|
+
);
|
|
60
64
|
if (additions.length > 0) {
|
|
61
65
|
process.env.NO_PROXY = noProxy + "," + additions.join(",");
|
|
62
66
|
}
|
|
@@ -70,13 +74,32 @@ var init_proxy_bypass = __esm({
|
|
|
70
74
|
targetUrl = input.href;
|
|
71
75
|
}
|
|
72
76
|
if (__shouldBypassProxy(targetUrl)) {
|
|
73
|
-
super(input, {
|
|
77
|
+
super(input, {
|
|
78
|
+
...options,
|
|
79
|
+
factory: (origin, dispatcher) => dispatcher
|
|
80
|
+
});
|
|
74
81
|
} else {
|
|
75
82
|
super(input, options);
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
85
|
};
|
|
79
86
|
}
|
|
87
|
+
__OriginalFetch = globalThis.fetch;
|
|
88
|
+
if (__OriginalFetch) {
|
|
89
|
+
globalThis.fetch = function(...args) {
|
|
90
|
+
let url = args[0];
|
|
91
|
+
if (url && __shouldBypassProxy(url)) {
|
|
92
|
+
const options = args[1];
|
|
93
|
+
if (options && options.headers) {
|
|
94
|
+
const headers = new Headers(options.headers);
|
|
95
|
+
headers.delete("Proxy-Authorization");
|
|
96
|
+
headers.delete("Proxy-Authenticate");
|
|
97
|
+
args[1] = { ...options, headers };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return __OriginalFetch.apply(this, args);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
80
103
|
}
|
|
81
104
|
});
|
|
82
105
|
|
|
@@ -68193,7 +68216,7 @@ var require_package3 = __commonJS({
|
|
|
68193
68216
|
"package.json"(exports2, module2) {
|
|
68194
68217
|
module2.exports = {
|
|
68195
68218
|
name: "@dedenlabs/claude-code-router-cli",
|
|
68196
|
-
version: "2.0.8-beta.
|
|
68219
|
+
version: "2.0.8-beta.2",
|
|
68197
68220
|
description: "\u57FA\u4E8E@musistudio/claude-code-router\u7684\u589E\u5F3A\u7248CLI\u8DEF\u7531\u5DE5\u5177 - \u652F\u6301\u7EDF\u4E00\u8DEF\u7531\u5F15\u64CE\u3001\u5916\u90E8\u89C4\u5219\u52A0\u8F7D\u3001\u667A\u80FD\u65E5\u5FD7\u7CFB\u7EDF\u3001\u81EA\u52A8\u914D\u7F6E\u8FC1\u79FB\u548CGLM\u601D\u8003\u6A21\u5F0F",
|
|
68198
68221
|
bin: {
|
|
68199
68222
|
ccr: "dist/cli.js"
|
|
@@ -99963,9 +99986,9 @@ function patchLlmsPackage() {
|
|
|
99963
99986
|
const WfOriginal = llmsModule?.Wf;
|
|
99964
99987
|
if (typeof WfOriginal === "function") {
|
|
99965
99988
|
llmsModule.Wf = function(url, request, config, logger, context) {
|
|
99966
|
-
const
|
|
99967
|
-
const
|
|
99968
|
-
if (
|
|
99989
|
+
const urlStr = typeof url === "string" ? url : url.toString();
|
|
99990
|
+
const isLocalHost2 = urlStr.includes("localhost") || urlStr.includes("127.0.0.1");
|
|
99991
|
+
if (isLocalHost2 && config.httpsProxy) {
|
|
99969
99992
|
const { httpsProxy, ...restConfig } = config;
|
|
99970
99993
|
return WfOriginal(url, request, restConfig, logger, context);
|
|
99971
99994
|
}
|
package/package.json
CHANGED