@simonyea/holysheep-cli 2.1.46 → 2.1.48

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.
@@ -292,6 +292,15 @@ var require_claude_process_proxy = __commonJS({
292
292
  host: target.host,
293
293
  connection: "close"
294
294
  };
295
+ if (process.env.HS_CLAUDE_DEBUG_HEADERS === "1") {
296
+ console.error(
297
+ `[DEBUG-HDRS forwardDirectHttps] ${JSON.stringify({
298
+ target: String(target),
299
+ ALL_outbound_headers: headers,
300
+ clientReqHeaders: clientReq.headers
301
+ })}`
302
+ );
303
+ }
295
304
  const upReq = https2.request({
296
305
  hostname: target.hostname,
297
306
  port: target.port || 443,
@@ -427,6 +436,16 @@ var require_claude_process_proxy = __commonJS({
427
436
  })}`
428
437
  );
429
438
  }
439
+ if (process.env.HS_CLAUDE_DEBUG_HEADERS === "1") {
440
+ console.error(
441
+ `[DEBUG-HDRS forwardViaNodeProxy] ${JSON.stringify({
442
+ target: String(targetUrl),
443
+ node: String(nodeProxyUrl),
444
+ ALL_outbound_headers: finalHeaders,
445
+ clientReqHeaders: clientReq.headers
446
+ })}`
447
+ );
448
+ }
430
449
  forwardReq = http.request({
431
450
  host: upstream.hostname,
432
451
  port: Number(upstream.port || 80),
@@ -3974,11 +3993,11 @@ var require_package = __commonJS({
3974
3993
  "package.json"(exports2, module2) {
3975
3994
  module2.exports = {
3976
3995
  name: "@simonyea/holysheep-cli",
3977
- version: "2.1.46",
3996
+ version: "2.1.48",
3978
3997
  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.",
3979
3998
  scripts: {
3980
3999
  build: "node scripts/build.mjs",
3981
- test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js",
4000
+ test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js && node tests/version-check.test.js",
3982
4001
  prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
3983
4002
  },
3984
4003
  keywords: [
package/dist/index.js CHANGED
@@ -12,11 +12,11 @@ var require_package = __commonJS({
12
12
  "package.json"(exports2, module2) {
13
13
  module2.exports = {
14
14
  name: "@simonyea/holysheep-cli",
15
- version: "2.1.46",
15
+ version: "2.1.48",
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",
19
- test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js",
19
+ test: "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js && node tests/version-check.test.js",
20
20
  prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
21
21
  },
22
22
  keywords: [
@@ -968,6 +968,15 @@ var require_claude_process_proxy = __commonJS({
968
968
  host: target.host,
969
969
  connection: "close"
970
970
  };
971
+ if (process.env.HS_CLAUDE_DEBUG_HEADERS === "1") {
972
+ console.error(
973
+ `[DEBUG-HDRS forwardDirectHttps] ${JSON.stringify({
974
+ target: String(target),
975
+ ALL_outbound_headers: headers,
976
+ clientReqHeaders: clientReq.headers
977
+ })}`
978
+ );
979
+ }
971
980
  const upReq = https2.request({
972
981
  hostname: target.hostname,
973
982
  port: target.port || 443,
@@ -1103,6 +1112,16 @@ var require_claude_process_proxy = __commonJS({
1103
1112
  })}`
1104
1113
  );
1105
1114
  }
1115
+ if (process.env.HS_CLAUDE_DEBUG_HEADERS === "1") {
1116
+ console.error(
1117
+ `[DEBUG-HDRS forwardViaNodeProxy] ${JSON.stringify({
1118
+ target: String(targetUrl),
1119
+ node: String(nodeProxyUrl),
1120
+ ALL_outbound_headers: finalHeaders,
1121
+ clientReqHeaders: clientReq.headers
1122
+ })}`
1123
+ );
1124
+ }
1106
1125
  forwardReq = http.request({
1107
1126
  host: upstream.hostname,
1108
1127
  port: Number(upstream.port || 80),
@@ -5859,6 +5878,123 @@ var require_openclaw2 = __commonJS({
5859
5878
  }
5860
5879
  });
5861
5880
 
5881
+ // src/utils/version-check.js
5882
+ var require_version_check = __commonJS({
5883
+ "src/utils/version-check.js"(exports2, module2) {
5884
+ "use strict";
5885
+ var fs = require("fs");
5886
+ var os = require("os");
5887
+ var path = require("path");
5888
+ var { exec } = require("child_process");
5889
+ var chalk2 = require("chalk");
5890
+ var PACKAGE_NAME = "@simonyea/holysheep-cli";
5891
+ var CACHE_PATH = path.join(os.homedir(), ".holysheep", "last-version-check.json");
5892
+ var CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
5893
+ var NPM_VIEW_TIMEOUT_MS = 3e3;
5894
+ function parseSemver(v) {
5895
+ if (!v || typeof v !== "string") return null;
5896
+ const m = v.trim().replace(/^v/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
5897
+ if (!m) return null;
5898
+ return [Number(m[1]), Number(m[2]), Number(m[3])];
5899
+ }
5900
+ __name(parseSemver, "parseSemver");
5901
+ function compareSemver(a, b) {
5902
+ const pa = parseSemver(a);
5903
+ const pb = parseSemver(b);
5904
+ if (!pa || !pb) return 0;
5905
+ for (let i = 0; i < 3; i++) {
5906
+ if (pa[i] !== pb[i]) return pa[i] - pb[i];
5907
+ }
5908
+ return 0;
5909
+ }
5910
+ __name(compareSemver, "compareSemver");
5911
+ function readCache() {
5912
+ try {
5913
+ const raw = fs.readFileSync(CACHE_PATH, "utf8");
5914
+ const j = JSON.parse(raw);
5915
+ if (j && typeof j.ts === "number" && typeof j.remote === "string") return j;
5916
+ } catch {
5917
+ }
5918
+ return null;
5919
+ }
5920
+ __name(readCache, "readCache");
5921
+ function writeCache(remote) {
5922
+ try {
5923
+ const dir = path.dirname(CACHE_PATH);
5924
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
5925
+ fs.writeFileSync(CACHE_PATH, JSON.stringify({ ts: Date.now(), remote }) + "\n", { mode: 384 });
5926
+ } catch {
5927
+ }
5928
+ }
5929
+ __name(writeCache, "writeCache");
5930
+ function fetchLatestFromNpm() {
5931
+ return new Promise((resolve) => {
5932
+ const p = exec(
5933
+ `npm view ${PACKAGE_NAME} version --silent`,
5934
+ { timeout: NPM_VIEW_TIMEOUT_MS, windowsHide: true },
5935
+ (err, stdout) => {
5936
+ if (err) return resolve(null);
5937
+ const ver = String(stdout || "").trim();
5938
+ if (parseSemver(ver)) resolve(ver);
5939
+ else resolve(null);
5940
+ }
5941
+ );
5942
+ setTimeout(() => {
5943
+ try {
5944
+ p.kill("SIGKILL");
5945
+ } catch {
5946
+ }
5947
+ resolve(null);
5948
+ }, NPM_VIEW_TIMEOUT_MS + 500);
5949
+ });
5950
+ }
5951
+ __name(fetchLatestFromNpm, "fetchLatestFromNpm");
5952
+ function printBanner2(localVersion, remoteVersion) {
5953
+ const line = "\u2501".repeat(54);
5954
+ console.log();
5955
+ console.log(chalk2.yellow(line));
5956
+ console.log(chalk2.yellow.bold(`\u26A0 HolySheep CLI \u6709\u65B0\u7248\u672C: ${localVersion} \u2192 ${remoteVersion}`));
5957
+ console.log(chalk2.yellow(" \u542B\u5173\u952E\u4FEE\u590D\uFF08\u542B Windows aionui Claude 403 \u8BA4\u8BC1\u4FEE\u590D\uFF09"));
5958
+ console.log(chalk2.yellow.bold(" \u5347\u7EA7\u547D\u4EE4: ") + chalk2.cyan.bold(`npm i -g ${PACKAGE_NAME}@latest`));
5959
+ console.log(chalk2.gray(" \u8DF3\u8FC7\u6B64\u68C0\u67E5: HOLYSHEEP_SKIP_VERSION_CHECK=1"));
5960
+ console.log(chalk2.yellow(line));
5961
+ console.log();
5962
+ }
5963
+ __name(printBanner2, "printBanner");
5964
+ function scheduleUpgradeBannerCheck({ localVersion }) {
5965
+ if (process.env.HOLYSHEEP_SKIP_VERSION_CHECK === "1") return;
5966
+ if (!parseSemver(localVersion)) return;
5967
+ (async () => {
5968
+ try {
5969
+ const cached = readCache();
5970
+ const now = Date.now();
5971
+ let remote = null;
5972
+ if (cached && now - cached.ts < CACHE_TTL_MS && parseSemver(cached.remote)) {
5973
+ remote = cached.remote;
5974
+ } else {
5975
+ remote = await fetchLatestFromNpm();
5976
+ if (remote) writeCache(remote);
5977
+ }
5978
+ if (!remote) return;
5979
+ if (compareSemver(remote, localVersion) > 0) {
5980
+ printBanner2(localVersion, remote);
5981
+ }
5982
+ } catch {
5983
+ }
5984
+ })();
5985
+ }
5986
+ __name(scheduleUpgradeBannerCheck, "scheduleUpgradeBannerCheck");
5987
+ module2.exports = {
5988
+ scheduleUpgradeBannerCheck,
5989
+ // exported for tests
5990
+ _parseSemver: parseSemver,
5991
+ _compareSemver: compareSemver,
5992
+ CACHE_PATH,
5993
+ CACHE_TTL_MS
5994
+ };
5995
+ }
5996
+ });
5997
+
5862
5998
  // src/webui/aionui-runtime-fetcher.js
5863
5999
  var require_aionui_runtime_fetcher = __commonJS({
5864
6000
  "src/webui/aionui-runtime-fetcher.js"(exports2, module2) {
@@ -5871,9 +6007,9 @@ var require_aionui_runtime_fetcher = __commonJS({
5871
6007
  var http = require("http");
5872
6008
  var USER_CACHE_DIR = path.join(os.homedir(), ".holysheep", "aionui-runtime");
5873
6009
  var VENDOR_DIR = path.join(__dirname, "vendor", "aionui");
5874
- var DEFAULT_RUNTIME_URL = "https://mail.holysheep.ai/app/cli/aionui-runtime-v1.9.18-holysheep-hs32.tar.gz";
5875
- var DEFAULT_RUNTIME_SHA256 = "7efafb298109f75a7e804fa1425a52cabe0d46ee39760fc54be14e80938f27c2";
5876
- var DEFAULT_RUNTIME_VERSION = "1.9.18-holysheep-hs32";
6010
+ var DEFAULT_RUNTIME_URL = "https://mail.holysheep.ai/app/cli/aionui-runtime-v1.9.18-holysheep-hs35.tar.gz";
6011
+ var DEFAULT_RUNTIME_SHA256 = "8f0378f8e15d7668429b02e196877e93d8b773055ce6953d83f9b2567b493a99";
6012
+ var DEFAULT_RUNTIME_VERSION = "1.9.18-holysheep-hs35";
5877
6013
  function isValidRuntimeDir(dir) {
5878
6014
  if (!dir) return false;
5879
6015
  try {
@@ -6878,6 +7014,12 @@ var require_claude = __commonJS({
6878
7014
  if (!apiKey) {
6879
7015
  throw new Error("Missing API Key. Run hs setup first.");
6880
7016
  }
7017
+ try {
7018
+ const { scheduleUpgradeBannerCheck } = require_version_check();
7019
+ const pkg2 = require_package();
7020
+ scheduleUpgradeBannerCheck({ localVersion: pkg2.version });
7021
+ } catch {
7022
+ }
6881
7023
  ensureClaudeProxyConfig(apiKey);
6882
7024
  const settings = claudeCodeTool.readSettings();
6883
7025
  if ((_a = settings.env) == null ? void 0 : _a.ANTHROPIC_BASE_URL) {
@@ -9336,6 +9478,28 @@ var require_aionui_wrapper = __commonJS({
9336
9478
  }
9337
9479
  const sanitizedParentEnv = { ...process.env };
9338
9480
  delete sanitizedParentEnv.HOLYSHEEP_API_KEY;
9481
+ delete sanitizedParentEnv.HOLYSHEEP_CLAUDE_PROXY_PORT;
9482
+ let signalledProxyPort = "";
9483
+ try {
9484
+ if (claudeProxyHandle && !claudeProxyHandle.skipped) {
9485
+ if (claudeProxyHandle.reused && claudeProxyHandle.port) {
9486
+ signalledProxyPort = String(claudeProxyHandle.port);
9487
+ } else if (!claudeProxyHandle.reused && claudeProxyHandle.server) {
9488
+ const addr = claudeProxyHandle.server.address && claudeProxyHandle.server.address();
9489
+ if (addr && typeof addr === "object" && addr.port) {
9490
+ signalledProxyPort = String(addr.port);
9491
+ }
9492
+ }
9493
+ }
9494
+ if (!signalledProxyPort) {
9495
+ const cfg = claudeProcessProxy.readConfig();
9496
+ if (cfg && cfg.processProxyPort) signalledProxyPort = String(cfg.processProxyPort);
9497
+ }
9498
+ } catch {
9499
+ }
9500
+ if (signalledProxyPort) {
9501
+ log(`exporting HOLYSHEEP_CLAUDE_PROXY_PORT=${signalledProxyPort} to aionui (authoritative proxy port \u2014 fork will skip HTTP probe)`);
9502
+ }
9339
9503
  const aionui = spawn(bunPath, ["dist-server/server.mjs"], {
9340
9504
  cwd: runtimeDir,
9341
9505
  env: {
@@ -9347,7 +9511,8 @@ var require_aionui_wrapper = __commonJS({
9347
9511
  HOLYSHEEP_CLI_ROOT: cliRoot,
9348
9512
  HOLYSHEEP_CLI_VERSION: wrapperVersion,
9349
9513
  HOLYSHEEP_CONFIG_PATH: credPath,
9350
- HOLYSHEEP_PTY_HERMES_WRAPPER: ptyWrapperAbs
9514
+ HOLYSHEEP_PTY_HERMES_WRAPPER: ptyWrapperAbs,
9515
+ ...signalledProxyPort ? { HOLYSHEEP_CLAUDE_PROXY_PORT: signalledProxyPort } : {}
9351
9516
  },
9352
9517
  stdio: ["ignore", "pipe", "pipe"]
9353
9518
  });
@@ -9460,6 +9625,7 @@ var require_webui = __commonJS({
9460
9625
  var fs = require("fs");
9461
9626
  var path = require("path");
9462
9627
  var http = require("http");
9628
+ var { scheduleUpgradeBannerCheck } = require_version_check();
9463
9629
  function isLegacy(opts) {
9464
9630
  return process.env.HOLYSHEEP_WEBUI_LEGACY === "1";
9465
9631
  }
@@ -9813,6 +9979,11 @@ var require_webui = __commonJS({
9813
9979
  console.log(chalk2.bold("\u{1F310} HolySheep WebUI"));
9814
9980
  console.log(chalk2.gray("\u2501".repeat(50)));
9815
9981
  console.log();
9982
+ try {
9983
+ const pkg2 = require_package();
9984
+ scheduleUpgradeBannerCheck({ localVersion: pkg2.version });
9985
+ } catch {
9986
+ }
9816
9987
  try {
9817
9988
  if (isLegacy(opts) && !opts.aionui) {
9818
9989
  console.log(chalk2.gray(`[mode=legacy platform=${process.platform}]`));
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "2.1.46",
3
+ "version": "2.1.48",
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",
7
- "test": "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js",
7
+ "test": "node tests/droid.test.js && node tests/workspace-store.test.js && node tests/runtime-stale-upgrade.test.js && node tests/hermes.test.js && node tests/preflight.test.js && node tests/opencode-auth-purge.test.js && node tests/shell-winpath.test.js && node tests/openclaw-atomic-write.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-wrapper-claude-proxy.test.js && node tests/aionui-wrapper-probe.test.js && node tests/aionui-wrapper-proxy-integration.test.js && node tests/aionui-wrapper-all-clis-autoconf.test.js && node tests/aionui-wrapper-env-signal.test.js && node tests/version-check.test.js",
8
8
  "prepublishOnly": "npm run build && npm test && node scripts/check-tarball-size.js"
9
9
  },
10
10
  "keywords": [