@simonyea/holysheep-cli 1.7.61 → 1.7.63

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.63",
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
  }
@@ -237,6 +237,21 @@ async function init() {
237
237
  loadTools()
238
238
  loadEnv()
239
239
  renderFooter()
240
+ startUpdateChecker()
241
+ }
242
+
243
+ // ── 定时检查新版本(每 5 分钟)──────────────────────────────────────────────
244
+ let _updateTimer = null
245
+ function startUpdateChecker() {
246
+ if (_updateTimer) return
247
+ _updateTimer = setInterval(async () => {
248
+ try {
249
+ const s = await api('status')
250
+ if (s.updateAvailable) {
251
+ document.getElementById('version').innerHTML = `v${s.version} <span style="color:var(--primary);cursor:pointer;font-weight:600" onclick="doUpgradeTool('holysheep','HolySheep CLI')" title="${t('updateNow')}"> → v${s.updateAvailable} ${t('updateNow')}</span>`
252
+ }
253
+ } catch {}
254
+ }, 5 * 60 * 1000)
240
255
  }
241
256
 
242
257
  // ── API helper ───────────────────────────────────────────────────────────────