@simonyea/holysheep-cli 1.7.61 → 1.7.62

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.61",
3
+ "version": "1.7.62",
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",
@@ -785,10 +785,16 @@ async function checkGatewayHealth(config) {
785
785
  const host = config.gatewayHost || '127.0.0.1'
786
786
  const timeout = Number(config.watchdog?.requestTimeoutMs) || DEFAULT_WATCHDOG_REQUEST_TIMEOUT_MS
787
787
 
788
+ // 用 http.get + family:4 强制 IPv4,避免 Windows 上 Node.js 优先尝试 IPv6 (::1)
789
+ // 而 Gateway 只监听 127.0.0.1 导致 Watchdog 误判自杀
788
790
  try {
789
- const response = await fetch(`http://${host}:${gatewayPort}/`, { method: 'GET', timeout })
790
- // 任何 HTTP 响应都说明 Gateway 进程存活(4xx 可能是正常的路由/auth 行为)
791
- return { ok: true, reason: `gateway_http_${response.status}` }
791
+ const http = require('http')
792
+ await new Promise((resolve, reject) => {
793
+ const req = http.get({ hostname: host, port: gatewayPort, path: '/', family: 4 }, resolve)
794
+ req.setTimeout(timeout, () => { req.destroy(); reject(new Error('timeout')) })
795
+ req.on('error', reject)
796
+ })
797
+ return { ok: true, reason: 'gateway_http_ok' }
792
798
  } catch {
793
799
  return { ok: false, reason: 'gateway_http_unreachable' }
794
800
  }