@simonyea/holysheep-cli 2.1.55 → 2.1.57
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/dist/configure-worker.js +104 -37
- package/dist/index.js +143 -46
- package/package.json +2 -2
package/dist/configure-worker.js
CHANGED
|
@@ -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) ||
|
|
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 (
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
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 (
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
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) {
|
|
@@ -1561,10 +1566,10 @@ var require_droid = __commonJS({
|
|
|
1561
1566
|
route: "anthropic"
|
|
1562
1567
|
},
|
|
1563
1568
|
{
|
|
1564
|
-
model: "claude-opus-4-
|
|
1565
|
-
id: "custom:claude-opus-4-
|
|
1569
|
+
model: "claude-opus-4-7",
|
|
1570
|
+
id: "custom:claude-opus-4-7-0",
|
|
1566
1571
|
baseUrlSuffix: "",
|
|
1567
|
-
displayName: "Opus 4.
|
|
1572
|
+
displayName: "Opus 4.7",
|
|
1568
1573
|
provider: "anthropic",
|
|
1569
1574
|
route: "anthropic"
|
|
1570
1575
|
},
|
|
@@ -3425,6 +3430,65 @@ var require_openclaw = __commonJS({
|
|
|
3425
3430
|
}
|
|
3426
3431
|
}
|
|
3427
3432
|
__name(_disableGatewayAuth, "_disableGatewayAuth");
|
|
3433
|
+
function disableGatewayAuthDirect() {
|
|
3434
|
+
var _a, _b;
|
|
3435
|
+
try {
|
|
3436
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
3437
|
+
return { changed: false, reason: "no-config" };
|
|
3438
|
+
}
|
|
3439
|
+
let cfg;
|
|
3440
|
+
try {
|
|
3441
|
+
cfg = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf8"));
|
|
3442
|
+
} catch (e) {
|
|
3443
|
+
return { changed: false, reason: "error", error: e.message };
|
|
3444
|
+
}
|
|
3445
|
+
const previousMode = (_b = (_a = cfg == null ? void 0 : cfg.gateway) == null ? void 0 : _a.auth) == null ? void 0 : _b.mode;
|
|
3446
|
+
if (previousMode === "none") {
|
|
3447
|
+
return { changed: false, reason: "already-none" };
|
|
3448
|
+
}
|
|
3449
|
+
if (!cfg.gateway) cfg.gateway = {};
|
|
3450
|
+
if (!cfg.gateway.auth) cfg.gateway.auth = {};
|
|
3451
|
+
cfg.gateway.auth.mode = "none";
|
|
3452
|
+
atomicWriteJson(CONFIG_FILE, cfg);
|
|
3453
|
+
return { changed: true, previousMode: previousMode || null };
|
|
3454
|
+
} catch (e) {
|
|
3455
|
+
return { changed: false, reason: "error", error: e.message };
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
__name(disableGatewayAuthDirect, "disableGatewayAuthDirect");
|
|
3459
|
+
function killGatewayOnPort(port) {
|
|
3460
|
+
if (!port || !Number.isInteger(port)) return false;
|
|
3461
|
+
try {
|
|
3462
|
+
if (isWin) {
|
|
3463
|
+
const out2 = execSync(
|
|
3464
|
+
`powershell -NonInteractive -Command "(Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue).OwningProcess"`,
|
|
3465
|
+
{ stdio: "pipe", encoding: "utf8", timeout: 3e3 }
|
|
3466
|
+
);
|
|
3467
|
+
const pids2 = String(out2 || "").match(/\d+/g);
|
|
3468
|
+
if (!pids2 || pids2.length === 0) return false;
|
|
3469
|
+
for (const pid of pids2) {
|
|
3470
|
+
try {
|
|
3471
|
+
execSync(`taskkill /F /PID ${pid}`, { stdio: "ignore", timeout: 3e3 });
|
|
3472
|
+
} catch {
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
return true;
|
|
3476
|
+
}
|
|
3477
|
+
const out = execSync(`lsof -ti tcp:${port} -sTCP:LISTEN 2>/dev/null || true`, { stdio: "pipe", encoding: "utf8", timeout: 3e3 });
|
|
3478
|
+
const pids = String(out || "").trim().split(/\s+/).filter(Boolean);
|
|
3479
|
+
if (pids.length === 0) return false;
|
|
3480
|
+
for (const pid of pids) {
|
|
3481
|
+
try {
|
|
3482
|
+
execSync(`kill -TERM ${pid}`, { stdio: "ignore", timeout: 3e3 });
|
|
3483
|
+
} catch {
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
return true;
|
|
3487
|
+
} catch {
|
|
3488
|
+
return false;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
__name(killGatewayOnPort, "killGatewayOnPort");
|
|
3428
3492
|
function _installGatewayService(port, preferNpx = false) {
|
|
3429
3493
|
if (preferNpx) return false;
|
|
3430
3494
|
const result = runOpenClaw(["gateway", "install", "--force", "--port", String(port)], {
|
|
@@ -3709,7 +3773,10 @@ var require_openclaw = __commonJS({
|
|
|
3709
3773
|
docsUrl: "https://docs.openclaw.ai",
|
|
3710
3774
|
// [HolySheep fork v2.1.38 / hs26] Test-only exports.
|
|
3711
3775
|
_atomicWriteJson: atomicWriteJson,
|
|
3712
|
-
_pruneClobberedBackups: pruneClobberedBackups
|
|
3776
|
+
_pruneClobberedBackups: pruneClobberedBackups,
|
|
3777
|
+
// [HolySheep v2.1.56] Direct JSON-level fixes for hs web auto-recovery.
|
|
3778
|
+
disableGatewayAuthDirect,
|
|
3779
|
+
killGatewayOnPort
|
|
3713
3780
|
};
|
|
3714
3781
|
}
|
|
3715
3782
|
});
|
|
@@ -4019,11 +4086,11 @@ var require_package = __commonJS({
|
|
|
4019
4086
|
"package.json"(exports2, module2) {
|
|
4020
4087
|
module2.exports = {
|
|
4021
4088
|
name: "@simonyea/holysheep-cli",
|
|
4022
|
-
version: "2.1.
|
|
4089
|
+
version: "2.1.57",
|
|
4023
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.",
|
|
4024
4091
|
scripts: {
|
|
4025
4092
|
build: "node scripts/build.mjs",
|
|
4026
|
-
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-runtime-resources.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/aionui-wrapper-csp-rewrite.test.js && node tests/aionui-wrapper-version-status.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
|
|
4093
|
+
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/openclaw-disable-auth-direct.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-runtime-resources.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/aionui-wrapper-csp-rewrite.test.js && node tests/aionui-wrapper-version-status.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
|
|
4027
4094
|
prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
4028
4095
|
},
|
|
4029
4096
|
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.
|
|
15
|
+
version: "2.1.57",
|
|
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-runtime-resources.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/aionui-wrapper-csp-rewrite.test.js && node tests/aionui-wrapper-version-status.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.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/openclaw-disable-auth-direct.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-runtime-resources.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/aionui-wrapper-csp-rewrite.test.js && node tests/aionui-wrapper-version-status.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
|
|
20
20
|
prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
21
21
|
},
|
|
22
22
|
keywords: [
|
|
@@ -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) ||
|
|
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 (
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
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 (
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
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) {
|
|
@@ -2107,10 +2112,10 @@ var require_droid = __commonJS({
|
|
|
2107
2112
|
route: "anthropic"
|
|
2108
2113
|
},
|
|
2109
2114
|
{
|
|
2110
|
-
model: "claude-opus-4-
|
|
2111
|
-
id: "custom:claude-opus-4-
|
|
2115
|
+
model: "claude-opus-4-7",
|
|
2116
|
+
id: "custom:claude-opus-4-7-0",
|
|
2112
2117
|
baseUrlSuffix: "",
|
|
2113
|
-
displayName: "Opus 4.
|
|
2118
|
+
displayName: "Opus 4.7",
|
|
2114
2119
|
provider: "anthropic",
|
|
2115
2120
|
route: "anthropic"
|
|
2116
2121
|
},
|
|
@@ -3971,6 +3976,65 @@ var require_openclaw = __commonJS({
|
|
|
3971
3976
|
}
|
|
3972
3977
|
}
|
|
3973
3978
|
__name(_disableGatewayAuth, "_disableGatewayAuth");
|
|
3979
|
+
function disableGatewayAuthDirect() {
|
|
3980
|
+
var _a, _b;
|
|
3981
|
+
try {
|
|
3982
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
3983
|
+
return { changed: false, reason: "no-config" };
|
|
3984
|
+
}
|
|
3985
|
+
let cfg;
|
|
3986
|
+
try {
|
|
3987
|
+
cfg = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf8"));
|
|
3988
|
+
} catch (e) {
|
|
3989
|
+
return { changed: false, reason: "error", error: e.message };
|
|
3990
|
+
}
|
|
3991
|
+
const previousMode = (_b = (_a = cfg == null ? void 0 : cfg.gateway) == null ? void 0 : _a.auth) == null ? void 0 : _b.mode;
|
|
3992
|
+
if (previousMode === "none") {
|
|
3993
|
+
return { changed: false, reason: "already-none" };
|
|
3994
|
+
}
|
|
3995
|
+
if (!cfg.gateway) cfg.gateway = {};
|
|
3996
|
+
if (!cfg.gateway.auth) cfg.gateway.auth = {};
|
|
3997
|
+
cfg.gateway.auth.mode = "none";
|
|
3998
|
+
atomicWriteJson(CONFIG_FILE, cfg);
|
|
3999
|
+
return { changed: true, previousMode: previousMode || null };
|
|
4000
|
+
} catch (e) {
|
|
4001
|
+
return { changed: false, reason: "error", error: e.message };
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
4004
|
+
__name(disableGatewayAuthDirect, "disableGatewayAuthDirect");
|
|
4005
|
+
function killGatewayOnPort(port) {
|
|
4006
|
+
if (!port || !Number.isInteger(port)) return false;
|
|
4007
|
+
try {
|
|
4008
|
+
if (isWin) {
|
|
4009
|
+
const out2 = execSync(
|
|
4010
|
+
`powershell -NonInteractive -Command "(Get-NetTCPConnection -LocalPort ${port} -State Listen -ErrorAction SilentlyContinue).OwningProcess"`,
|
|
4011
|
+
{ stdio: "pipe", encoding: "utf8", timeout: 3e3 }
|
|
4012
|
+
);
|
|
4013
|
+
const pids2 = String(out2 || "").match(/\d+/g);
|
|
4014
|
+
if (!pids2 || pids2.length === 0) return false;
|
|
4015
|
+
for (const pid of pids2) {
|
|
4016
|
+
try {
|
|
4017
|
+
execSync(`taskkill /F /PID ${pid}`, { stdio: "ignore", timeout: 3e3 });
|
|
4018
|
+
} catch {
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
return true;
|
|
4022
|
+
}
|
|
4023
|
+
const out = execSync(`lsof -ti tcp:${port} -sTCP:LISTEN 2>/dev/null || true`, { stdio: "pipe", encoding: "utf8", timeout: 3e3 });
|
|
4024
|
+
const pids = String(out || "").trim().split(/\s+/).filter(Boolean);
|
|
4025
|
+
if (pids.length === 0) return false;
|
|
4026
|
+
for (const pid of pids) {
|
|
4027
|
+
try {
|
|
4028
|
+
execSync(`kill -TERM ${pid}`, { stdio: "ignore", timeout: 3e3 });
|
|
4029
|
+
} catch {
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
return true;
|
|
4033
|
+
} catch {
|
|
4034
|
+
return false;
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
__name(killGatewayOnPort, "killGatewayOnPort");
|
|
3974
4038
|
function _installGatewayService(port, preferNpx = false) {
|
|
3975
4039
|
if (preferNpx) return false;
|
|
3976
4040
|
const result = runOpenClaw(["gateway", "install", "--force", "--port", String(port)], {
|
|
@@ -4255,7 +4319,10 @@ var require_openclaw = __commonJS({
|
|
|
4255
4319
|
docsUrl: "https://docs.openclaw.ai",
|
|
4256
4320
|
// [HolySheep fork v2.1.38 / hs26] Test-only exports.
|
|
4257
4321
|
_atomicWriteJson: atomicWriteJson,
|
|
4258
|
-
_pruneClobberedBackups: pruneClobberedBackups
|
|
4322
|
+
_pruneClobberedBackups: pruneClobberedBackups,
|
|
4323
|
+
// [HolySheep v2.1.56] Direct JSON-level fixes for hs web auto-recovery.
|
|
4324
|
+
disableGatewayAuthDirect,
|
|
4325
|
+
killGatewayOnPort
|
|
4259
4326
|
};
|
|
4260
4327
|
}
|
|
4261
4328
|
});
|
|
@@ -4968,7 +5035,7 @@ var require_setup = __commonJS({
|
|
|
4968
5035
|
{ name: "gpt-5.4 (GPT 5.4, \u901A\u7528\u7F16\u7801)", value: "gpt-5.4", checked: true },
|
|
4969
5036
|
{ name: "gpt-5.3-codex-spark (GPT 5.3 Codex Spark, \u7F16\u7801)", value: "gpt-5.3-codex-spark", checked: true },
|
|
4970
5037
|
{ name: "claude-sonnet-4-6 (Sonnet 4.6, \u5747\u8861\u63A8\u8350)", value: "claude-sonnet-4-6", checked: true },
|
|
4971
|
-
{ name: "claude-opus-4-
|
|
5038
|
+
{ name: "claude-opus-4-7 (Opus 4.7, \u5F3A\u529B\u65D7\u8230)", value: "claude-opus-4-7", checked: true },
|
|
4972
5039
|
{ name: "MiniMax-M2.7-highspeed (\u9AD8\u901F\u7ECF\u6D4E\u7248)", value: "MiniMax-M2.7-highspeed", checked: true },
|
|
4973
5040
|
{ name: "claude-haiku-4-5 (Haiku 4.5, \u8F7B\u5FEB\u4FBF\u5B9C)", value: "claude-haiku-4-5", checked: true }
|
|
4974
5041
|
];
|
|
@@ -8013,7 +8080,7 @@ ${AUTO_INSTALL[toolId].cmd}
|
|
|
8013
8080
|
"gpt-5.4",
|
|
8014
8081
|
"gpt-5.3-codex-spark",
|
|
8015
8082
|
"claude-sonnet-4-6",
|
|
8016
|
-
"claude-opus-4-
|
|
8083
|
+
"claude-opus-4-7",
|
|
8017
8084
|
"MiniMax-M2.7-highspeed",
|
|
8018
8085
|
"claude-haiku-4-5"
|
|
8019
8086
|
];
|
|
@@ -8437,8 +8504,8 @@ ${AUTO_INSTALL[toolId].cmd}
|
|
|
8437
8504
|
{ id: "gpt-5.3-codex-spark", label: "GPT 5.3 Codex Spark", desc: "\u7F16\u7801" },
|
|
8438
8505
|
{ id: "claude-sonnet-4-6", label: "Sonnet 4.6", desc: "\u5747\u8861\u63A8\u8350" },
|
|
8439
8506
|
{ id: "claude-sonnet-4-6[1m]", label: "Sonnet 4.6 (1M)", desc: "\u5747\u8861\u63A8\u8350\xB7100\u4E07\u4E0A\u4E0B\u6587" },
|
|
8440
|
-
{ id: "claude-opus-4-
|
|
8441
|
-
{ id: "claude-opus-4-
|
|
8507
|
+
{ id: "claude-opus-4-7", label: "Opus 4.7", desc: "\u5F3A\u529B\u65D7\u8230" },
|
|
8508
|
+
{ id: "claude-opus-4-7[1m]", label: "Opus 4.7 (1M)", desc: "\u5F3A\u529B\u65D7\u8230\xB7100\u4E07\u4E0A\u4E0B\u6587" },
|
|
8442
8509
|
{ id: "MiniMax-M2.7-highspeed", label: "MiniMax M2.7", desc: "\u9AD8\u901F\u7ECF\u6D4E\u7248" },
|
|
8443
8510
|
{ id: "claude-haiku-4-5", label: "Haiku 4.5", desc: "\u8F7B\u5FEB\u4FBF\u5B9C" }
|
|
8444
8511
|
]);
|
|
@@ -9725,6 +9792,35 @@ var require_aionui_wrapper = __commonJS({
|
|
|
9725
9792
|
}
|
|
9726
9793
|
}
|
|
9727
9794
|
__name(_checkOpenClawPairingNeeded, "_checkOpenClawPairingNeeded");
|
|
9795
|
+
function _autoFixOpenClawPairing() {
|
|
9796
|
+
if (typeof openclawTool.checkInstalled !== "function" || !openclawTool.checkInstalled()) return;
|
|
9797
|
+
if (typeof openclawTool.isConfigured !== "function" || !openclawTool.isConfigured()) return;
|
|
9798
|
+
const result = typeof openclawTool.disableGatewayAuthDirect === "function" ? openclawTool.disableGatewayAuthDirect() : { changed: false, reason: "helper-missing" };
|
|
9799
|
+
if (result.changed) {
|
|
9800
|
+
log(`OpenClaw gateway.auth.mode patched: ${result.previousMode || "?"} \u2192 none`);
|
|
9801
|
+
try {
|
|
9802
|
+
const port = typeof openclawTool.getGatewayPort === "function" ? openclawTool.getGatewayPort() : null;
|
|
9803
|
+
if (port && typeof openclawTool.killGatewayOnPort === "function") {
|
|
9804
|
+
const killed = openclawTool.killGatewayOnPort(port);
|
|
9805
|
+
if (killed) log(`OpenClaw gateway on :${port} stopped \u2014 will restart with new auth config on next AionUi connection`);
|
|
9806
|
+
}
|
|
9807
|
+
} catch (e) {
|
|
9808
|
+
log(`warn: could not stop running OpenClaw gateway: ${e && e.message ? e.message : e}`);
|
|
9809
|
+
}
|
|
9810
|
+
return;
|
|
9811
|
+
}
|
|
9812
|
+
if (result.reason === "already-none") {
|
|
9813
|
+
return;
|
|
9814
|
+
}
|
|
9815
|
+
if (result.reason === "no-config") {
|
|
9816
|
+
_startupWarnings.openclawNeedsPairing = true;
|
|
9817
|
+
log("warn: ~/.openclaw/openclaw.json missing \u2014 banner will prompt for `hs openclaw`");
|
|
9818
|
+
} else if (result.reason === "error") {
|
|
9819
|
+
_startupWarnings.openclawNeedsPairing = true;
|
|
9820
|
+
log(`warn: OpenClaw config patch failed (${result.error}) \u2014 banner will surface manual fix`);
|
|
9821
|
+
}
|
|
9822
|
+
}
|
|
9823
|
+
__name(_autoFixOpenClawPairing, "_autoFixOpenClawPairing");
|
|
9728
9824
|
var VERSION_CACHE_FILE = path.join(os.homedir(), ".holysheep", "last-version-check.json");
|
|
9729
9825
|
var UPGRADE_LOG_FILE = path.join(os.homedir(), ".holysheep", "auto-update.log");
|
|
9730
9826
|
var PACKAGE_NAME = "@simonyea/holysheep-cli";
|
|
@@ -9964,12 +10060,13 @@ var require_aionui_wrapper = __commonJS({
|
|
|
9964
10060
|
log("warn: CLI auto-config error (continuing): " + (e && e.message ? e.message : e));
|
|
9965
10061
|
}
|
|
9966
10062
|
try {
|
|
9967
|
-
|
|
9968
|
-
if (_startupWarnings.openclawNeedsPairing) {
|
|
9969
|
-
log('warn: OpenClaw gateway auth.mode is not "none" \u2014 users will see "pairing required" errors. Run `hs openclaw` to fix.');
|
|
9970
|
-
}
|
|
10063
|
+
_autoFixOpenClawPairing();
|
|
9971
10064
|
} catch (e) {
|
|
9972
|
-
log("warn: OpenClaw pairing
|
|
10065
|
+
log("warn: OpenClaw pairing auto-fix failed (continuing): " + (e && e.message ? e.message : e));
|
|
10066
|
+
try {
|
|
10067
|
+
_startupWarnings.openclawNeedsPairing = _checkOpenClawPairingNeeded();
|
|
10068
|
+
} catch {
|
|
10069
|
+
}
|
|
9973
10070
|
}
|
|
9974
10071
|
const claudeProxyHandle = await ensureClaudeProcessProxyRunning();
|
|
9975
10072
|
ensureOpenClawBridgeRunning();
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.57",
|
|
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-runtime-resources.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/aionui-wrapper-csp-rewrite.test.js && node tests/aionui-wrapper-version-status.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.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/openclaw-disable-auth-direct.test.js && node tests/opencode-default-model.test.js && node tests/paths-bundled.test.js && node tests/aionui-runtime-resources.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/aionui-wrapper-csp-rewrite.test.js && node tests/aionui-wrapper-version-status.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
|
|
8
8
|
"prepublishOnly": "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|