@simonyea/holysheep-cli 2.1.63 → 2.1.65
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 +3 -3
- package/dist/index.js +147 -35
- package/package.json +2 -2
package/dist/configure-worker.js
CHANGED
|
@@ -73,7 +73,7 @@ var require_claude_process_proxy = __commonJS({
|
|
|
73
73
|
var crypto = require("crypto");
|
|
74
74
|
var { URL: URL2 } = require("url");
|
|
75
75
|
var fetch = global.fetch || require("node-fetch");
|
|
76
|
-
var HOLYSHEEP_DIR = path.join(os.homedir(), ".holysheep");
|
|
76
|
+
var HOLYSHEEP_DIR = process.env.HOLYSHEEP_DIR || path.join(os.homedir(), ".holysheep");
|
|
77
77
|
var CONFIG_PATH = path.join(HOLYSHEEP_DIR, "claude-proxy.json");
|
|
78
78
|
var DEFAULT_PROXY_PORT = 14556;
|
|
79
79
|
var LOCAL_PING_PATH = "/__hs_local_ping__";
|
|
@@ -4099,11 +4099,11 @@ var require_package = __commonJS({
|
|
|
4099
4099
|
"package.json"(exports2, module2) {
|
|
4100
4100
|
module2.exports = {
|
|
4101
4101
|
name: "@simonyea/holysheep-cli",
|
|
4102
|
-
version: "2.1.
|
|
4102
|
+
version: "2.1.65",
|
|
4103
4103
|
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.",
|
|
4104
4104
|
scripts: {
|
|
4105
4105
|
build: "node scripts/build.mjs",
|
|
4106
|
-
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/acptypes-patch.test.js && node tests/codex-approval-policy.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
|
|
4106
|
+
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/claude-proxy-daemon.test.js && node tests/acptypes-patch.test.js && node tests/codex-approval-policy.test.js && node tests/version-check.test.js && node tests/runclaude-missing-binary.test.js",
|
|
4107
4107
|
prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
4108
4108
|
},
|
|
4109
4109
|
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.65",
|
|
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/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/acptypes-patch.test.js && node tests/codex-approval-policy.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/claude-proxy-daemon.test.js && node tests/acptypes-patch.test.js && node tests/codex-approval-policy.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: [
|
|
@@ -750,7 +750,7 @@ var require_claude_process_proxy = __commonJS({
|
|
|
750
750
|
var crypto = require("crypto");
|
|
751
751
|
var { URL: URL2 } = require("url");
|
|
752
752
|
var fetch = global.fetch || require("node-fetch");
|
|
753
|
-
var HOLYSHEEP_DIR = path.join(os.homedir(), ".holysheep");
|
|
753
|
+
var HOLYSHEEP_DIR = process.env.HOLYSHEEP_DIR || path.join(os.homedir(), ".holysheep");
|
|
754
754
|
var CONFIG_PATH = path.join(HOLYSHEEP_DIR, "claude-proxy.json");
|
|
755
755
|
var DEFAULT_PROXY_PORT = 14556;
|
|
756
756
|
var LOCAL_PING_PATH = "/__hs_local_ping__";
|
|
@@ -5045,7 +5045,7 @@ var require_setup = __commonJS({
|
|
|
5045
5045
|
}
|
|
5046
5046
|
}
|
|
5047
5047
|
const MODEL_CHOICES = [
|
|
5048
|
-
{ name: "gpt-5.
|
|
5048
|
+
{ name: "gpt-5.5 (GPT 5.5, \u901A\u7528\u7F16\u7801)", value: "gpt-5.5", checked: true },
|
|
5049
5049
|
{ name: "gpt-5.3-codex-spark (GPT 5.3 Codex Spark, \u7F16\u7801)", value: "gpt-5.3-codex-spark", checked: true },
|
|
5050
5050
|
{ name: "claude-sonnet-4-6 (Sonnet 4.6, \u5747\u8861\u63A8\u8350)", value: "claude-sonnet-4-6", checked: true },
|
|
5051
5051
|
{ name: "claude-opus-4-7 (Opus 4.7, \u5F3A\u529B\u65D7\u8230)", value: "claude-opus-4-7", checked: true },
|
|
@@ -7209,6 +7209,7 @@ var require_claude_proxy = __commonJS({
|
|
|
7209
7209
|
var fs = require("fs");
|
|
7210
7210
|
var path = require("path");
|
|
7211
7211
|
var os = require("os");
|
|
7212
|
+
var http2 = require("http");
|
|
7212
7213
|
var { spawn, execSync } = require("child_process");
|
|
7213
7214
|
var chalk2 = require("chalk");
|
|
7214
7215
|
var {
|
|
@@ -7216,12 +7217,20 @@ var require_claude_proxy = __commonJS({
|
|
|
7216
7217
|
closeSession,
|
|
7217
7218
|
getProcessProxyPort,
|
|
7218
7219
|
getLocalProxyUrl,
|
|
7219
|
-
readConfig
|
|
7220
|
+
readConfig,
|
|
7221
|
+
LOCAL_PING_PATH,
|
|
7222
|
+
LOCAL_PING_HEADER,
|
|
7223
|
+
LOCAL_PING_HEADER_VALUE
|
|
7220
7224
|
} = require_claude_process_proxy();
|
|
7221
7225
|
var claudeCodeTool = require_claude_code();
|
|
7222
7226
|
var { getApiKey } = require_config();
|
|
7223
|
-
var
|
|
7227
|
+
var HS_DIR = process.env.HOLYSHEEP_DIR || path.join(os.homedir(), ".holysheep");
|
|
7228
|
+
var PID_FILE = path.join(HS_DIR, "claude-proxy.pid");
|
|
7229
|
+
var LOG_FILE = path.join(HS_DIR, "claude-proxy.log");
|
|
7224
7230
|
var isWin = process.platform === "win32";
|
|
7231
|
+
var DAEMON_READY_TIMEOUT_MS = Number(process.env.HS_CLAUDE_PROXY_DAEMON_READY_TIMEOUT_MS) || 12e3;
|
|
7232
|
+
var DAEMON_READY_INTERVAL_MS = Number(process.env.HS_CLAUDE_PROXY_DAEMON_READY_INTERVAL_MS) || 400;
|
|
7233
|
+
var DAEMON_TEST_CHILD_EXIT = process.env.HS_CLAUDE_PROXY_DAEMON_TEST_CHILD_EXIT === "1";
|
|
7225
7234
|
function readPid() {
|
|
7226
7235
|
try {
|
|
7227
7236
|
const content = fs.readFileSync(PID_FILE, "utf8").trim();
|
|
@@ -7237,6 +7246,10 @@ var require_claude_proxy = __commonJS({
|
|
|
7237
7246
|
fs.writeFileSync(PID_FILE, JSON.stringify({ pid, port, sessionId, startedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf8");
|
|
7238
7247
|
}
|
|
7239
7248
|
__name(writePid, "writePid");
|
|
7249
|
+
function ensureStateDir() {
|
|
7250
|
+
if (!fs.existsSync(HS_DIR)) fs.mkdirSync(HS_DIR, { recursive: true });
|
|
7251
|
+
}
|
|
7252
|
+
__name(ensureStateDir, "ensureStateDir");
|
|
7240
7253
|
function clearPid() {
|
|
7241
7254
|
try {
|
|
7242
7255
|
fs.unlinkSync(PID_FILE);
|
|
@@ -7244,6 +7257,19 @@ var require_claude_proxy = __commonJS({
|
|
|
7244
7257
|
}
|
|
7245
7258
|
}
|
|
7246
7259
|
__name(clearPid, "clearPid");
|
|
7260
|
+
async function readHealthyPid({ pidFile = PID_FILE, timeoutMs = 1e3 } = {}) {
|
|
7261
|
+
let info = null;
|
|
7262
|
+
try {
|
|
7263
|
+
info = JSON.parse(fs.readFileSync(pidFile, "utf8"));
|
|
7264
|
+
} catch {
|
|
7265
|
+
return null;
|
|
7266
|
+
}
|
|
7267
|
+
if (!(info == null ? void 0 : info.pid) || !(info == null ? void 0 : info.port)) return null;
|
|
7268
|
+
if (!isProcessAlive(info.pid)) return null;
|
|
7269
|
+
if (!await isProxyHealthy(info.port, timeoutMs)) return null;
|
|
7270
|
+
return info;
|
|
7271
|
+
}
|
|
7272
|
+
__name(readHealthyPid, "readHealthyPid");
|
|
7247
7273
|
function isProcessAlive(pid) {
|
|
7248
7274
|
try {
|
|
7249
7275
|
process.kill(pid, 0);
|
|
@@ -7253,18 +7279,55 @@ var require_claude_proxy = __commonJS({
|
|
|
7253
7279
|
}
|
|
7254
7280
|
}
|
|
7255
7281
|
__name(isProcessAlive, "isProcessAlive");
|
|
7256
|
-
function isProxyHealthy(port) {
|
|
7282
|
+
function isProxyHealthy(port, timeoutMs = 1e3) {
|
|
7283
|
+
return probeLocalProxy(port, timeoutMs);
|
|
7284
|
+
}
|
|
7285
|
+
__name(isProxyHealthy, "isProxyHealthy");
|
|
7286
|
+
function probeLocalProxy(port, timeoutMs = 1e3) {
|
|
7287
|
+
return new Promise((resolve) => {
|
|
7288
|
+
const value = Number(port);
|
|
7289
|
+
if (!Number.isInteger(value) || value <= 0 || value >= 65536) return resolve(false);
|
|
7290
|
+
const req = http2.request({
|
|
7291
|
+
hostname: "127.0.0.1",
|
|
7292
|
+
port: value,
|
|
7293
|
+
path: LOCAL_PING_PATH,
|
|
7294
|
+
method: "GET",
|
|
7295
|
+
timeout: timeoutMs,
|
|
7296
|
+
headers: { "user-agent": "holysheep-claude-proxy-daemon-probe/1" }
|
|
7297
|
+
}, (res) => {
|
|
7298
|
+
const headerOk = String(res.headers[LOCAL_PING_HEADER] || "") === LOCAL_PING_HEADER_VALUE;
|
|
7299
|
+
res.resume();
|
|
7300
|
+
res.on("end", () => resolve(res.statusCode === 200 && headerOk));
|
|
7301
|
+
});
|
|
7302
|
+
req.on("timeout", () => {
|
|
7303
|
+
req.destroy();
|
|
7304
|
+
resolve(false);
|
|
7305
|
+
});
|
|
7306
|
+
req.on("error", () => resolve(false));
|
|
7307
|
+
req.end();
|
|
7308
|
+
});
|
|
7309
|
+
}
|
|
7310
|
+
__name(probeLocalProxy, "probeLocalProxy");
|
|
7311
|
+
function tailLog(lines = 40) {
|
|
7257
7312
|
try {
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
{ stdio: "ignore", timeout: 5e3, windowsHide: true }
|
|
7261
|
-
);
|
|
7262
|
-
return true;
|
|
7313
|
+
const raw = fs.readFileSync(LOG_FILE, "utf8");
|
|
7314
|
+
return raw.split(/\r?\n/).slice(-lines).join("\n").trim();
|
|
7263
7315
|
} catch {
|
|
7264
|
-
return
|
|
7316
|
+
return "";
|
|
7265
7317
|
}
|
|
7266
7318
|
}
|
|
7267
|
-
__name(
|
|
7319
|
+
__name(tailLog, "tailLog");
|
|
7320
|
+
function makeDaemonError(message, details = {}) {
|
|
7321
|
+
const logTail = details.logTail !== void 0 ? details.logTail : tailLog();
|
|
7322
|
+
const err = new Error(logTail ? `${message}
|
|
7323
|
+
--- ${LOG_FILE} tail ---
|
|
7324
|
+
${logTail}` : message);
|
|
7325
|
+
err.code = "CLAUDE_PROXY_DAEMON_FAILED";
|
|
7326
|
+
err.logFile = LOG_FILE;
|
|
7327
|
+
if (details.exitCode !== void 0) err.exitCode = details.exitCode;
|
|
7328
|
+
return err;
|
|
7329
|
+
}
|
|
7330
|
+
__name(makeDaemonError, "makeDaemonError");
|
|
7268
7331
|
function writeBaseUrlToSettings(port) {
|
|
7269
7332
|
const settings = claudeCodeTool.readSettings();
|
|
7270
7333
|
if (!settings.env) settings.env = {};
|
|
@@ -7307,16 +7370,16 @@ var require_claude_proxy = __commonJS({
|
|
|
7307
7370
|
clearPid();
|
|
7308
7371
|
}
|
|
7309
7372
|
__name(handleStop, "handleStop");
|
|
7310
|
-
function handleStatus() {
|
|
7373
|
+
async function handleStatus() {
|
|
7311
7374
|
const info = readPid();
|
|
7312
7375
|
if (!info) {
|
|
7313
7376
|
console.log(chalk2.yellow("\u4EE3\u7406\u672A\u542F\u52A8"));
|
|
7314
7377
|
return;
|
|
7315
7378
|
}
|
|
7316
7379
|
const alive = isProcessAlive(info.pid);
|
|
7317
|
-
const healthy = alive && isProxyHealthy(info.port);
|
|
7318
|
-
if (healthy) {
|
|
7319
|
-
console.log(chalk2.green(`\u4EE3\u7406\u8FD0\u884C
|
|
7380
|
+
const healthy = alive && await isProxyHealthy(info.port);
|
|
7381
|
+
if (alive && healthy) {
|
|
7382
|
+
console.log(chalk2.green(`\u4EE3\u7406\u5DF2\u8FD0\u884C`));
|
|
7320
7383
|
console.log(chalk2.gray(` PID: ${info.pid}`));
|
|
7321
7384
|
console.log(chalk2.gray(` \u7AEF\u53E3: ${info.port}`));
|
|
7322
7385
|
console.log(chalk2.gray(` \u5730\u5740: ${getLocalProxyUrl(info.port)}`));
|
|
@@ -7331,37 +7394,69 @@ var require_claude_proxy = __commonJS({
|
|
|
7331
7394
|
}
|
|
7332
7395
|
__name(handleStatus, "handleStatus");
|
|
7333
7396
|
async function handleDaemon() {
|
|
7397
|
+
if (process.env.HS_CLAUDE_PROXY_DAEMON_TEST_SPAWN_FAIL === "1") {
|
|
7398
|
+
throw makeDaemonError("\u4EE3\u7406\u5B50\u8FDB\u7A0B\u542F\u52A8\u5931\u8D25: \u6545\u969C\u6CE8\u5165 HS_CLAUDE_PROXY_DAEMON_TEST_SPAWN_FAIL");
|
|
7399
|
+
}
|
|
7334
7400
|
const info = readPid();
|
|
7335
|
-
if (info && isProcessAlive(info.pid) && isProxyHealthy(info.port)) {
|
|
7401
|
+
if (info && isProcessAlive(info.pid) && await isProxyHealthy(info.port)) {
|
|
7336
7402
|
console.log(chalk2.green(`\u4EE3\u7406\u5DF2\u5728\u8FD0\u884C (PID ${info.pid}, \u7AEF\u53E3 ${info.port})`));
|
|
7337
7403
|
return;
|
|
7338
7404
|
}
|
|
7339
7405
|
const { selfEntrypoint } = require_paths();
|
|
7340
7406
|
const scriptPath = selfEntrypoint();
|
|
7341
|
-
const spawnCmd =
|
|
7407
|
+
const spawnCmd = process.execPath;
|
|
7408
|
+
ensureStateDir();
|
|
7409
|
+
fs.appendFileSync(LOG_FILE, `
|
|
7410
|
+
[${(/* @__PURE__ */ new Date()).toISOString()}] starting daemon via ${spawnCmd} ${scriptPath} claude-proxy
|
|
7411
|
+
`, "utf8");
|
|
7412
|
+
const outFd = fs.openSync(LOG_FILE, "a");
|
|
7413
|
+
const errFd = fs.openSync(LOG_FILE, "a");
|
|
7342
7414
|
const child = spawn(spawnCmd, [scriptPath, "claude-proxy"], {
|
|
7343
7415
|
detached: true,
|
|
7344
|
-
stdio: "ignore",
|
|
7345
|
-
windowsHide: true
|
|
7416
|
+
stdio: ["ignore", outFd, errFd],
|
|
7417
|
+
windowsHide: true,
|
|
7418
|
+
env: { ...process.env, HS_CLAUDE_PROXY_DAEMON_CHILD: "1" }
|
|
7419
|
+
});
|
|
7420
|
+
child.on("error", (err) => {
|
|
7421
|
+
try {
|
|
7422
|
+
fs.appendFileSync(LOG_FILE, `[${(/* @__PURE__ */ new Date()).toISOString()}] spawn error: ${err.message}
|
|
7423
|
+
`, "utf8");
|
|
7424
|
+
} catch {
|
|
7425
|
+
}
|
|
7346
7426
|
});
|
|
7427
|
+
fs.closeSync(outFd);
|
|
7428
|
+
fs.closeSync(errFd);
|
|
7347
7429
|
child.unref();
|
|
7348
|
-
const
|
|
7349
|
-
|
|
7350
|
-
await new Promise((r) => setTimeout(r,
|
|
7351
|
-
|
|
7430
|
+
const deadline = Date.now() + DAEMON_READY_TIMEOUT_MS;
|
|
7431
|
+
while (Date.now() < deadline) {
|
|
7432
|
+
await new Promise((r) => setTimeout(r, DAEMON_READY_INTERVAL_MS));
|
|
7433
|
+
const rawLatest = readPid();
|
|
7434
|
+
if (rawLatest && rawLatest.pid && !isProcessAlive(rawLatest.pid)) {
|
|
7435
|
+
clearPid();
|
|
7436
|
+
throw makeDaemonError(`\u4EE3\u7406\u5B50\u8FDB\u7A0B\u5DF2\u9000\u51FA (PID ${rawLatest.pid})`);
|
|
7437
|
+
}
|
|
7438
|
+
const latest = await readHealthyPid({ timeoutMs: 1e3 });
|
|
7439
|
+
if (latest) {
|
|
7352
7440
|
console.log(chalk2.green(`\u4EE3\u7406\u5DF2\u5728\u540E\u53F0\u542F\u52A8`));
|
|
7353
|
-
console.log(chalk2.gray(` PID: ${
|
|
7354
|
-
console.log(chalk2.gray(` \u7AEF\u53E3: ${port}`));
|
|
7355
|
-
console.log(chalk2.gray(` \u5730\u5740: ${getLocalProxyUrl(port)}`));
|
|
7441
|
+
console.log(chalk2.gray(` PID: ${latest.pid}`));
|
|
7442
|
+
console.log(chalk2.gray(` \u7AEF\u53E3: ${latest.port}`));
|
|
7443
|
+
console.log(chalk2.gray(` \u5730\u5740: ${getLocalProxyUrl(latest.port)}`));
|
|
7444
|
+
console.log(chalk2.gray(` \u65E5\u5FD7: ${LOG_FILE}`));
|
|
7356
7445
|
console.log(chalk2.cyan("\n VS Code Claude \u6269\u5C55\u73B0\u5728\u53EF\u4EE5\u4F7F\u7528\u4E86"));
|
|
7357
7446
|
return;
|
|
7358
7447
|
}
|
|
7448
|
+
if (child.exitCode !== null) {
|
|
7449
|
+
throw makeDaemonError(`\u4EE3\u7406\u5B50\u8FDB\u7A0B\u542F\u52A8\u5931\u8D25 (exit=${child.exitCode})`, { exitCode: child.exitCode });
|
|
7450
|
+
}
|
|
7359
7451
|
}
|
|
7360
|
-
|
|
7361
|
-
console.log(chalk2.gray(` PID: ${child.pid}`));
|
|
7452
|
+
throw makeDaemonError(`\u4EE3\u7406\u542F\u52A8\u8D85\u65F6\uFF0C\u672A\u901A\u8FC7\u672C\u5730 HTTP \u6307\u7EB9\u5065\u5EB7\u68C0\u67E5 (log: ${LOG_FILE})`);
|
|
7362
7453
|
}
|
|
7363
7454
|
__name(handleDaemon, "handleDaemon");
|
|
7364
7455
|
async function handleForeground() {
|
|
7456
|
+
if (DAEMON_TEST_CHILD_EXIT) {
|
|
7457
|
+
console.error("[hs-claude-proxy] daemon test child forced exit");
|
|
7458
|
+
process.exit(42);
|
|
7459
|
+
}
|
|
7365
7460
|
const config = readConfig();
|
|
7366
7461
|
const apiKey = config.apiKey || getApiKey();
|
|
7367
7462
|
if (!apiKey) {
|
|
@@ -7369,7 +7464,7 @@ var require_claude_proxy = __commonJS({
|
|
|
7369
7464
|
process.exit(1);
|
|
7370
7465
|
}
|
|
7371
7466
|
const existing = readPid();
|
|
7372
|
-
if (existing && isProcessAlive(existing.pid) && isProxyHealthy(existing.port)) {
|
|
7467
|
+
if (existing && isProcessAlive(existing.pid) && await isProxyHealthy(existing.port)) {
|
|
7373
7468
|
console.log(chalk2.yellow(`\u4EE3\u7406\u5DF2\u5728\u8FD0\u884C (PID ${existing.pid}, \u7AEF\u53E3 ${existing.port})\uFF0C\u5148\u505C\u6B62: hs claude-proxy --stop`));
|
|
7374
7469
|
process.exit(1);
|
|
7375
7470
|
}
|
|
@@ -7424,6 +7519,12 @@ var require_claude_proxy = __commonJS({
|
|
|
7424
7519
|
proxy.writeConfig(bridgeConfig);
|
|
7425
7520
|
}
|
|
7426
7521
|
};
|
|
7522
|
+
claudeProxy._private = {
|
|
7523
|
+
probeLocalProxy,
|
|
7524
|
+
readHealthyPid,
|
|
7525
|
+
daemonLogFile: /* @__PURE__ */ __name(() => LOG_FILE, "daemonLogFile"),
|
|
7526
|
+
daemonPidFile: /* @__PURE__ */ __name(() => PID_FILE, "daemonPidFile")
|
|
7527
|
+
};
|
|
7427
7528
|
module2.exports = claudeProxy;
|
|
7428
7529
|
}
|
|
7429
7530
|
});
|
|
@@ -8175,7 +8276,7 @@ ${installCmd}
|
|
|
8175
8276
|
return res.end();
|
|
8176
8277
|
}
|
|
8177
8278
|
const allModelIds = [
|
|
8178
|
-
"gpt-5.
|
|
8279
|
+
"gpt-5.5",
|
|
8179
8280
|
"gpt-5.3-codex-spark",
|
|
8180
8281
|
"claude-sonnet-4-6",
|
|
8181
8282
|
"claude-opus-4-7",
|
|
@@ -8598,7 +8699,7 @@ ${installCmd}
|
|
|
8598
8699
|
__name(handleEnvClean, "handleEnvClean");
|
|
8599
8700
|
function handleModels(_req, res) {
|
|
8600
8701
|
json(res, [
|
|
8601
|
-
{ id: "gpt-5.
|
|
8702
|
+
{ id: "gpt-5.5", label: "GPT 5.5", desc: "\u901A\u7528\u7F16\u7801" },
|
|
8602
8703
|
{ id: "gpt-5.3-codex-spark", label: "GPT 5.3 Codex Spark", desc: "\u7F16\u7801" },
|
|
8603
8704
|
{ id: "claude-sonnet-4-6", label: "Sonnet 4.6", desc: "\u5747\u8861\u63A8\u8350" },
|
|
8604
8705
|
{ id: "claude-sonnet-4-6[1m]", label: "Sonnet 4.6 (1M)", desc: "\u5747\u8861\u63A8\u8350\xB7100\u4E07\u4E0A\u4E0B\u6587" },
|
|
@@ -11041,7 +11142,18 @@ ${err.message}
|
|
|
11041
11142
|
});
|
|
11042
11143
|
program.command("claude-proxy [args...]").allowUnknownOption(true).description("\u542F\u52A8 Claude \u4EE3\u7406\u670D\u52A1\uFF08\u8BA9 VS Code Claude \u6269\u5C55\u4E5F\u80FD\u7528 HolySheep\uFF09").action(async (args = []) => {
|
|
11043
11144
|
const claudeProxy = require_claude_proxy();
|
|
11044
|
-
|
|
11145
|
+
try {
|
|
11146
|
+
await claudeProxy(args);
|
|
11147
|
+
} catch (err) {
|
|
11148
|
+
if (err && err.code === "CLAUDE_PROXY_DAEMON_FAILED") {
|
|
11149
|
+
process.stderr.write(`
|
|
11150
|
+
${err.message}
|
|
11151
|
+
|
|
11152
|
+
`);
|
|
11153
|
+
process.exit(typeof err.exitCode === "number" ? err.exitCode : 1);
|
|
11154
|
+
}
|
|
11155
|
+
throw err;
|
|
11156
|
+
}
|
|
11045
11157
|
});
|
|
11046
11158
|
program.parse(process.argv);
|
|
11047
11159
|
if (process.argv.slice(2).length === 0) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.65",
|
|
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/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/acptypes-patch.test.js && node tests/codex-approval-policy.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/claude-proxy-daemon.test.js && node tests/acptypes-patch.test.js && node tests/codex-approval-policy.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": [
|