@simonyea/holysheep-cli 1.7.128 → 1.7.130
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.130",
|
|
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",
|
|
@@ -103,7 +103,7 @@ async function readJsonResponse(response) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// 向 relay 申请新 lease(启动时 + CONNECT 失败时被动重试)
|
|
106
|
-
async function fetchFreshLease(config, sessionId) {
|
|
106
|
+
async function fetchFreshLease(config, sessionId, options = {}) {
|
|
107
107
|
const controlPlaneUrl = getControlPlaneUrl(config)
|
|
108
108
|
if (!controlPlaneUrl) throw new Error('Claude relay control plane is not configured')
|
|
109
109
|
|
|
@@ -116,6 +116,7 @@ async function fetchFreshLease(config, sessionId) {
|
|
|
116
116
|
deviceId: config.deviceId || '',
|
|
117
117
|
installSource: config.installSource || 'holysheep-cli',
|
|
118
118
|
proxyMode: 'claude-process',
|
|
119
|
+
forceReassign: options.forceReassign === true,
|
|
119
120
|
}),
|
|
120
121
|
})
|
|
121
122
|
|
|
@@ -221,9 +222,9 @@ function createConnectTunnel(proxyUrl, target, headers) {
|
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
// 等上游返回 first byte 的最大时间。Claude 长上下文(>200K tokens)的 prefill 时间
|
|
224
|
-
// 可以达到 30-90 秒,
|
|
225
|
-
// HS_CLAUDE_RESPONSE_TIMEOUT_MS
|
|
226
|
-
const RESPONSE_TIMEOUT_MS = Number(process.env.HS_CLAUDE_RESPONSE_TIMEOUT_MS) ||
|
|
225
|
+
// 可以达到 30-90 秒,120 秒留了充足裕量。默认 120 秒,可通过环境变量
|
|
226
|
+
// HS_CLAUDE_RESPONSE_TIMEOUT_MS 覆盖。旧值 300 秒导致异常时用户感知卡 5 分钟。
|
|
227
|
+
const RESPONSE_TIMEOUT_MS = Number(process.env.HS_CLAUDE_RESPONSE_TIMEOUT_MS) || 120000
|
|
227
228
|
// 上游 stream 已开始后,相邻两个 chunk 之间的最大间隔(覆盖 extended thinking 间歇)。
|
|
228
229
|
const STALL_TIMEOUT_MS = Number(process.env.HS_CLAUDE_STALL_TIMEOUT_MS) || 120000
|
|
229
230
|
|
|
@@ -260,7 +261,7 @@ function pipeWithCleanup(a, b) {
|
|
|
260
261
|
a.pipe(b)
|
|
261
262
|
b.pipe(a)
|
|
262
263
|
const close = () => {
|
|
263
|
-
if (
|
|
264
|
+
if (timer) clearTimeout(timer)
|
|
264
265
|
a.destroy()
|
|
265
266
|
b.destroy()
|
|
266
267
|
}
|
|
@@ -314,7 +315,9 @@ function createProcessProxyServer({ sessionId, configPath = CONFIG_PATH }) {
|
|
|
314
315
|
if (shouldRefreshLeaseAfterError(lastError)) {
|
|
315
316
|
await closeSession(configPath, sessionId)
|
|
316
317
|
}
|
|
317
|
-
const freshLease = await fetchFreshLease(config, sessionId
|
|
318
|
+
const freshLease = await fetchFreshLease(config, sessionId, {
|
|
319
|
+
forceReassign: shouldRefreshLeaseAfterError(lastError),
|
|
320
|
+
})
|
|
318
321
|
await doForward(freshLease)
|
|
319
322
|
}
|
|
320
323
|
lastError = null
|
|
@@ -378,7 +381,9 @@ function createProcessProxyServer({ sessionId, configPath = CONFIG_PATH }) {
|
|
|
378
381
|
if (shouldRefreshLeaseAfterError(lastError)) {
|
|
379
382
|
await closeSession(configPath, sessionId)
|
|
380
383
|
}
|
|
381
|
-
const freshLease = await fetchFreshLease(config, sessionId
|
|
384
|
+
const freshLease = await fetchFreshLease(config, sessionId, {
|
|
385
|
+
forceReassign: shouldRefreshLeaseAfterError(lastError),
|
|
386
|
+
})
|
|
382
387
|
await doConnect(freshLease)
|
|
383
388
|
}
|
|
384
389
|
lastError = null
|