@simonyea/holysheep-cli 2.1.56 → 2.1.58

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.
@@ -114,6 +114,7 @@ var require_claude_process_proxy = __commonJS({
114
114
  var MAX_PROXY_RETRIES = 3;
115
115
  var ENABLE_TIMING_LOG = process.env.HS_CLAUDE_TIMING_LOG === "1";
116
116
  var SLOW_PATH_LOG_MS = Number(process.env.HS_CLAUDE_SLOW_PATH_LOG_MS) || 5e3;
117
+ var ENABLE_LEASE_LOG = process.env.HS_CLAUDE_LEASE_LOG === "1";
117
118
  function sanitizeUrl(value) {
118
119
  if (!value) return "";
119
120
  try {
@@ -545,7 +546,7 @@ var require_claude_process_proxy = __commonJS({
545
546
  });
546
547
  }
547
548
  __name(createConnectTunnel, "createConnectTunnel");
548
- var RESPONSE_TIMEOUT_MS = Number(process.env.HS_CLAUDE_RESPONSE_TIMEOUT_MS) || 3e4;
549
+ var RESPONSE_TIMEOUT_MS = Number(process.env.HS_CLAUDE_RESPONSE_TIMEOUT_MS) || 9e4;
549
550
  var STALL_TIMEOUT_MS = Number(process.env.HS_CLAUDE_STALL_TIMEOUT_MS) || 12e4;
550
551
  function pipeWithCleanup(a, b) {
551
552
  for (const sock of [a, b]) {
@@ -738,20 +739,22 @@ var require_claude_process_proxy = __commonJS({
738
739
  })();
739
740
  const forceReassign = shouldRefreshLeaseAfterError(lastError);
740
741
  const retryReason = String((lastError == null ? void 0 : lastError.body) || (lastError == null ? void 0 : lastError.message) || "").slice(0, 120);
741
- if (forceReassign) {
742
- console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
743
- sessionId,
744
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
745
- attempt,
746
- reason: retryReason
747
- })}`);
748
- } else {
749
- console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
750
- sessionId,
751
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
752
- attempt,
753
- retryReason
754
- })}`);
742
+ if (ENABLE_LEASE_LOG) {
743
+ if (forceReassign) {
744
+ console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
745
+ sessionId,
746
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
747
+ attempt,
748
+ reason: retryReason
749
+ })}`);
750
+ } else {
751
+ console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
752
+ sessionId,
753
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
754
+ attempt,
755
+ retryReason
756
+ })}`);
757
+ }
755
758
  }
756
759
  leaseCache.delete(sessionId);
757
760
  if (forceReassign) {
@@ -870,22 +873,24 @@ var require_claude_process_proxy = __commonJS({
870
873
  })();
871
874
  const forceReassign = shouldRefreshLeaseAfterError(lastError);
872
875
  const retryReason = String((lastError == null ? void 0 : lastError.body) || (lastError == null ? void 0 : lastError.message) || "").slice(0, 120);
873
- if (forceReassign) {
874
- console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
875
- sessionId,
876
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
877
- attempt,
878
- reason: retryReason,
879
- path: "CONNECT"
880
- })}`);
881
- } else {
882
- console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
883
- sessionId,
884
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
885
- attempt,
886
- retryReason,
887
- path: "CONNECT"
888
- })}`);
876
+ if (ENABLE_LEASE_LOG) {
877
+ if (forceReassign) {
878
+ console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
879
+ sessionId,
880
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
881
+ attempt,
882
+ reason: retryReason,
883
+ path: "CONNECT"
884
+ })}`);
885
+ } else {
886
+ console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
887
+ sessionId,
888
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
889
+ attempt,
890
+ retryReason,
891
+ path: "CONNECT"
892
+ })}`);
893
+ }
889
894
  }
890
895
  leaseCache.delete(sessionId);
891
896
  if (forceReassign) {
@@ -4081,7 +4086,7 @@ var require_package = __commonJS({
4081
4086
  "package.json"(exports2, module2) {
4082
4087
  module2.exports = {
4083
4088
  name: "@simonyea/holysheep-cli",
4084
- version: "2.1.56",
4089
+ version: "2.1.58",
4085
4090
  description: "Claude Code/Cursor/Cline API relay for China \u2014 \xA51=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
4086
4091
  scripts: {
4087
4092
  build: "node scripts/build.mjs",
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ var require_package = __commonJS({
12
12
  "package.json"(exports2, module2) {
13
13
  module2.exports = {
14
14
  name: "@simonyea/holysheep-cli",
15
- version: "2.1.56",
15
+ version: "2.1.58",
16
16
  description: "Claude Code/Cursor/Cline API relay for China \u2014 \xA51=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
17
17
  scripts: {
18
18
  build: "node scripts/build.mjs",
@@ -791,6 +791,7 @@ var require_claude_process_proxy = __commonJS({
791
791
  var MAX_PROXY_RETRIES = 3;
792
792
  var ENABLE_TIMING_LOG = process.env.HS_CLAUDE_TIMING_LOG === "1";
793
793
  var SLOW_PATH_LOG_MS = Number(process.env.HS_CLAUDE_SLOW_PATH_LOG_MS) || 5e3;
794
+ var ENABLE_LEASE_LOG = process.env.HS_CLAUDE_LEASE_LOG === "1";
794
795
  function sanitizeUrl(value) {
795
796
  if (!value) return "";
796
797
  try {
@@ -1222,7 +1223,7 @@ var require_claude_process_proxy = __commonJS({
1222
1223
  });
1223
1224
  }
1224
1225
  __name(createConnectTunnel, "createConnectTunnel");
1225
- var RESPONSE_TIMEOUT_MS = Number(process.env.HS_CLAUDE_RESPONSE_TIMEOUT_MS) || 3e4;
1226
+ var RESPONSE_TIMEOUT_MS = Number(process.env.HS_CLAUDE_RESPONSE_TIMEOUT_MS) || 9e4;
1226
1227
  var STALL_TIMEOUT_MS = Number(process.env.HS_CLAUDE_STALL_TIMEOUT_MS) || 12e4;
1227
1228
  function pipeWithCleanup(a, b) {
1228
1229
  for (const sock of [a, b]) {
@@ -1415,20 +1416,22 @@ var require_claude_process_proxy = __commonJS({
1415
1416
  })();
1416
1417
  const forceReassign = shouldRefreshLeaseAfterError(lastError);
1417
1418
  const retryReason = String((lastError == null ? void 0 : lastError.body) || (lastError == null ? void 0 : lastError.message) || "").slice(0, 120);
1418
- if (forceReassign) {
1419
- console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
1420
- sessionId,
1421
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1422
- attempt,
1423
- reason: retryReason
1424
- })}`);
1425
- } else {
1426
- console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
1427
- sessionId,
1428
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1429
- attempt,
1430
- retryReason
1431
- })}`);
1419
+ if (ENABLE_LEASE_LOG) {
1420
+ if (forceReassign) {
1421
+ console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
1422
+ sessionId,
1423
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1424
+ attempt,
1425
+ reason: retryReason
1426
+ })}`);
1427
+ } else {
1428
+ console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
1429
+ sessionId,
1430
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1431
+ attempt,
1432
+ retryReason
1433
+ })}`);
1434
+ }
1432
1435
  }
1433
1436
  leaseCache.delete(sessionId);
1434
1437
  if (forceReassign) {
@@ -1547,22 +1550,24 @@ var require_claude_process_proxy = __commonJS({
1547
1550
  })();
1548
1551
  const forceReassign = shouldRefreshLeaseAfterError(lastError);
1549
1552
  const retryReason = String((lastError == null ? void 0 : lastError.body) || (lastError == null ? void 0 : lastError.message) || "").slice(0, 120);
1550
- if (forceReassign) {
1551
- console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
1552
- sessionId,
1553
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1554
- attempt,
1555
- reason: retryReason,
1556
- path: "CONNECT"
1557
- })}`);
1558
- } else {
1559
- console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
1560
- sessionId,
1561
- nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1562
- attempt,
1563
- retryReason,
1564
- path: "CONNECT"
1565
- })}`);
1553
+ if (ENABLE_LEASE_LOG) {
1554
+ if (forceReassign) {
1555
+ console.error(`[hs-claude-proxy] lease.force-reassign ${JSON.stringify({
1556
+ sessionId,
1557
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1558
+ attempt,
1559
+ reason: retryReason,
1560
+ path: "CONNECT"
1561
+ })}`);
1562
+ } else {
1563
+ console.error(`[hs-claude-proxy] lease.sticky-hit ${JSON.stringify({
1564
+ sessionId,
1565
+ nodeId: (prevLease == null ? void 0 : prevLease.nodeId) || "",
1566
+ attempt,
1567
+ retryReason,
1568
+ path: "CONNECT"
1569
+ })}`);
1570
+ }
1566
1571
  }
1567
1572
  leaseCache.delete(sessionId);
1568
1573
  if (forceReassign) {
@@ -7573,15 +7578,19 @@ var require_server = __commonJS({
7573
7578
  "claude-code": {
7574
7579
  cmd: process.platform === "win32" ? 'powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "irm https://claude.ai/install.ps1 | iex"' : "curl -fsSL https://claude.ai/install.sh | bash"
7575
7580
  },
7576
- "codex": { cmd: "npm install -g @openai/codex" },
7581
+ // [v2.1.58] @openai/codex v0.111+ ships a Rust binary via postinstall.
7582
+ // --foreground-scripts forces npm to stream postinstall stdout (otherwise
7583
+ // npm hides it in non-TTY → Windows users see "正在安装" forever while the
7584
+ // binary download silently blocks). --no-fund/audit cuts noise.
7585
+ "codex": { cmd: "npm install -g @openai/codex --foreground-scripts --no-fund --no-audit" },
7577
7586
  "droid": {
7578
7587
  // 2.1.14 fix: Windows/Linux now have official installers; previously
7579
7588
  // the WebUI piped the macOS-only brew command on every platform.
7580
7589
  cmd: process.platform === "win32" ? "winget install --id Factory.Droid -e --accept-source-agreements --accept-package-agreements" : process.platform === "darwin" ? "brew install --cask droid" : "curl -fsSL https://app.factory.ai/install.sh | bash"
7581
7590
  },
7582
- "gemini-cli": { cmd: "npm install -g @google/gemini-cli" },
7583
- "opencode": { cmd: "npm install -g opencode-ai" },
7584
- "openclaw": { cmd: "npm install -g openclaw@latest" },
7591
+ "gemini-cli": { cmd: "npm install -g @google/gemini-cli --foreground-scripts --no-fund --no-audit" },
7592
+ "opencode": { cmd: "npm install -g opencode-ai --foreground-scripts --no-fund --no-audit" },
7593
+ "openclaw": { cmd: "npm install -g openclaw@latest --foreground-scripts --no-fund --no-audit" },
7585
7594
  "aider": { cmd: "pip install aider-chat" },
7586
7595
  // Hermes Agent (Nous Research). Python-based, installed via uv. Windows
7587
7596
  // requires WSL2 (the installer explicitly rejects native Windows). On
@@ -7994,14 +8003,67 @@ var require_server = __commonJS({
7994
8003
  }
7995
8004
  sseStart(res);
7996
8005
  sseEmit(res, { type: "progress", message: `\u6B63\u5728\u5B89\u88C5 ${toolId}...` });
8006
+ const installCmd = AUTO_INSTALL[toolId].cmd;
8007
+ const isNpmInstall = /^\s*npm\s+install\b/.test(installCmd);
8008
+ if (isNpmInstall) {
8009
+ let npmOk = false;
8010
+ try {
8011
+ const { commandExists: commandExists2 } = require_which();
8012
+ npmOk = commandExists2("npm") && commandExists2("node");
8013
+ } catch {
8014
+ }
8015
+ if (!npmOk) {
8016
+ sseEmit(res, {
8017
+ type: "output",
8018
+ text: `\u274C \u68C0\u6D4B\u4E0D\u5230 npm / node \u2014 \u8BF7\u5148\u5B89\u88C5 Node.js (https://nodejs.org)\uFF0C\u518D\u91CD\u542F hs web\u3002
8019
+ \u4E0B\u8F7D\u5B89\u88C5\u540E\uFF0C\u65B0\u5F00\u7EC8\u7AEF\u8FD0\u884C \`node --version\` \u5E94\u770B\u5230\u7248\u672C\u53F7\u3002
8020
+ `
8021
+ });
8022
+ sseEmit(res, { type: "done", success: false, message: "node-not-found" });
8023
+ return res.end();
8024
+ }
8025
+ }
8026
+ sseEmit(res, { type: "output", text: `> ${installCmd}
8027
+ ` });
7997
8028
  const INSTALL_TIMEOUT_MS = 10 * 60 * 1e3;
8029
+ const isWin = process.platform === "win32";
7998
8030
  const ok = await new Promise((resolve) => {
7999
8031
  var _a, _b;
8000
- const child = spawn(AUTO_INSTALL[toolId].cmd, [], { shell: true });
8032
+ const env = {
8033
+ ...process.env,
8034
+ FORCE_COLOR: "0",
8035
+ NPM_CONFIG_FUND: "false",
8036
+ NPM_CONFIG_AUDIT: "false",
8037
+ NPM_CONFIG_PROGRESS: "false",
8038
+ NPM_CONFIG_LOGLEVEL: "http"
8039
+ // not too quiet, not too noisy
8040
+ };
8041
+ const spawnOpts = isWin ? { shell: process.env.ComSpec || "cmd.exe", windowsHide: true, env, stdio: ["ignore", "pipe", "pipe"] } : { shell: true, env, stdio: ["ignore", "pipe", "pipe"] };
8042
+ const cmdToRun = isWin && isNpmInstall ? `chcp 65001 >NUL & ${installCmd}` : installCmd;
8043
+ let child;
8044
+ try {
8045
+ child = spawn(cmdToRun, [], spawnOpts);
8046
+ } catch (e) {
8047
+ sseEmit(res, { type: "output", text: `
8048
+ \u274C spawn \u5931\u8D25: ${e.message}
8049
+ ` });
8050
+ return resolve(false);
8051
+ }
8052
+ sseEmit(res, { type: "output", text: `[hs] \u5B50\u8FDB\u7A0B\u5DF2\u542F\u52A8 pid=${child.pid || "?"}\uFF0C\u7B49\u5F85\u8F93\u51FA\u2026
8053
+ ` });
8054
+ let lastChunkAt = Date.now();
8055
+ const heartbeat = setInterval(() => {
8056
+ const idleSec = Math.round((Date.now() - lastChunkAt) / 1e3);
8057
+ if (idleSec >= 8) {
8058
+ sseEmit(res, { type: "output", text: `[hs] \u2026\u4ECD\u5728\u8FD0\u884C\uFF0C\u6700\u8FD1 ${idleSec}s \u65E0\u8F93\u51FA\uFF08postinstall \u4E0B\u8F7D\u4E8C\u8FDB\u5236\u4E2D\uFF1F\uFF09
8059
+ ` });
8060
+ }
8061
+ }, 1e4);
8001
8062
  const timer = setTimeout(() => {
8063
+ clearInterval(heartbeat);
8002
8064
  sseEmit(res, { type: "output", text: `
8003
8065
  \u26A0\uFE0F \u5B89\u88C5\u8D85\u65F6\uFF0810\u5206\u949F\uFF09\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C:
8004
- ${AUTO_INSTALL[toolId].cmd}
8066
+ ${installCmd}
8005
8067
  ` });
8006
8068
  try {
8007
8069
  child.kill("SIGKILL");
@@ -8009,14 +8071,41 @@ ${AUTO_INSTALL[toolId].cmd}
8009
8071
  }
8010
8072
  resolve(false);
8011
8073
  }, INSTALL_TIMEOUT_MS);
8012
- (_a = child.stdout) == null ? void 0 : _a.on("data", (chunk) => sseEmit(res, { type: "output", text: chunk.toString() }));
8013
- (_b = child.stderr) == null ? void 0 : _b.on("data", (chunk) => sseEmit(res, { type: "output", text: chunk.toString() }));
8014
- child.on("close", (code) => {
8074
+ (_a = child.stdout) == null ? void 0 : _a.on("data", (chunk) => {
8075
+ lastChunkAt = Date.now();
8076
+ sseEmit(res, { type: "output", text: chunk.toString("utf8") });
8077
+ });
8078
+ (_b = child.stderr) == null ? void 0 : _b.on("data", (chunk) => {
8079
+ lastChunkAt = Date.now();
8080
+ sseEmit(res, { type: "output", text: chunk.toString("utf8") });
8081
+ });
8082
+ child.on("close", (code, signal) => {
8015
8083
  clearTimeout(timer);
8084
+ clearInterval(heartbeat);
8085
+ if (code !== 0) {
8086
+ sseEmit(res, { type: "output", text: `
8087
+ \u274C \u8FDB\u7A0B\u9000\u51FA code=${code} signal=${signal || "none"}
8088
+ ` });
8089
+ if (isWin && isNpmInstall) {
8090
+ sseEmit(res, {
8091
+ type: "output",
8092
+ text: `\u5E38\u89C1\u539F\u56E0 (Windows):
8093
+ \u2022 postinstall \u4E0B\u8F7D\u4E8C\u8FDB\u5236\u88AB\u9632\u706B\u5899/\u6740\u6BD2\u62E6\u622A \u2192 \u5173\u95ED\u6740\u6BD2\u91CD\u8BD5\uFF0C\u6216\u5728\u7BA1\u7406\u5458 PowerShell \u8FD0\u884C\uFF1A
8094
+ ${installCmd}
8095
+ \u2022 \u672C\u5730 HTTP \u4EE3\u7406 (Clash/Surge) \u5E72\u6270 \u2192 \u4E34\u65F6\u5173\u95ED\u4EE3\u7406\u6216\u8BBE HTTP_PROXY="" \u91CD\u8BD5
8096
+ \u2022 \u56FD\u5185\u7F51\u7EDC\u62C9 npm \u6162 \u2192 \u5207\u6362\u955C\u50CF\uFF1Anpm config set registry https://registry.npmmirror.com
8097
+ `
8098
+ });
8099
+ }
8100
+ }
8016
8101
  resolve(code === 0);
8017
8102
  });
8018
- child.on("error", () => {
8103
+ child.on("error", (err) => {
8019
8104
  clearTimeout(timer);
8105
+ clearInterval(heartbeat);
8106
+ sseEmit(res, { type: "output", text: `
8107
+ \u274C \u5B50\u8FDB\u7A0B\u9519\u8BEF: ${err.message}
8108
+ ` });
8020
8109
  resolve(false);
8021
8110
  });
8022
8111
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "2.1.56",
3
+ "version": "2.1.58",
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
  "scripts": {
6
6
  "build": "node scripts/build.mjs",