@simonyea/holysheep-cli 1.7.95 → 1.7.97
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.97",
|
|
4
4
|
"description": "Claude Code/Cursor/Cline API relay for China — ¥1=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openai-china",
|
|
@@ -47,6 +47,26 @@ function getControlPlaneUrl(config) {
|
|
|
47
47
|
|
|
48
48
|
const leaseCache = new Map()
|
|
49
49
|
|
|
50
|
+
function isRetryableNodeLeaseError(err) {
|
|
51
|
+
const message = String(err?.message || '')
|
|
52
|
+
return [
|
|
53
|
+
'No session lease',
|
|
54
|
+
'ECONNREFUSED',
|
|
55
|
+
'ECONNRESET',
|
|
56
|
+
'socket hang up',
|
|
57
|
+
'ETIMEDOUT',
|
|
58
|
+
'EHOSTUNREACH',
|
|
59
|
+
'ENETUNREACH',
|
|
60
|
+
'Upstream proxy CONNECT failed',
|
|
61
|
+
'No available Claude accounts support the requested model',
|
|
62
|
+
'No available Claude accounts',
|
|
63
|
+
'Bad Gateway',
|
|
64
|
+
'HTTP 502',
|
|
65
|
+
'HTTP 503',
|
|
66
|
+
'HTTP 504'
|
|
67
|
+
].some((token) => message.includes(token))
|
|
68
|
+
}
|
|
69
|
+
|
|
50
70
|
async function readJsonResponse(response) {
|
|
51
71
|
const chunks = []
|
|
52
72
|
for await (const chunk of response) chunks.push(Buffer.from(chunk))
|
|
@@ -211,10 +231,9 @@ function createProcessProxyServer({ sessionId, configPath = CONFIG_PATH }) {
|
|
|
211
231
|
await doForward(getCachedLease(sessionId))
|
|
212
232
|
} catch (err) {
|
|
213
233
|
if (clientRes.headersSent) return
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
if (noLease) {
|
|
234
|
+
const shouldRefreshLease =
|
|
235
|
+
!leaseCache.has(sessionId) || (err && isRetryableNodeLeaseError(err))
|
|
236
|
+
if (shouldRefreshLease) {
|
|
218
237
|
try {
|
|
219
238
|
const config = readConfig(configPath)
|
|
220
239
|
leaseCache.delete(sessionId)
|
|
@@ -267,8 +286,9 @@ function createProcessProxyServer({ sessionId, configPath = CONFIG_PATH }) {
|
|
|
267
286
|
try {
|
|
268
287
|
await doConnect(getCachedLease(sessionId))
|
|
269
288
|
} catch (err) {
|
|
270
|
-
const
|
|
271
|
-
|
|
289
|
+
const shouldRefreshLease =
|
|
290
|
+
!leaseCache.has(sessionId) || (err && isRetryableNodeLeaseError(err))
|
|
291
|
+
if (shouldRefreshLease) {
|
|
272
292
|
try {
|
|
273
293
|
const config = readConfig(configPath)
|
|
274
294
|
leaseCache.delete(sessionId)
|
package/src/tools/openclaw.js
CHANGED
|
@@ -64,6 +64,7 @@ function runWithRunner(runner, args, opts = {}) {
|
|
|
64
64
|
timeout: opts.timeout || 30000,
|
|
65
65
|
stdio: opts.stdio || 'pipe',
|
|
66
66
|
encoding: 'utf8',
|
|
67
|
+
windowsHide: true,
|
|
67
68
|
})
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -96,6 +97,7 @@ function spawnOpenClaw(args, opts = {}) {
|
|
|
96
97
|
const { preferNpx: _preferNpx, ...spawnOpts } = opts
|
|
97
98
|
return spawn(runner.cmd, [...runner.argsPrefix, ...args], {
|
|
98
99
|
shell: runner.shell,
|
|
100
|
+
windowsHide: true,
|
|
99
101
|
...spawnOpts,
|
|
100
102
|
})
|
|
101
103
|
}
|