@simonyea/holysheep-cli 2.1.45 → 2.1.46
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 +2 -2
- package/dist/index.js +154 -2
- package/package.json +2 -2
package/dist/configure-worker.js
CHANGED
|
@@ -3974,11 +3974,11 @@ var require_package = __commonJS({
|
|
|
3974
3974
|
"package.json"(exports2, module2) {
|
|
3975
3975
|
module2.exports = {
|
|
3976
3976
|
name: "@simonyea/holysheep-cli",
|
|
3977
|
-
version: "2.1.
|
|
3977
|
+
version: "2.1.46",
|
|
3978
3978
|
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
3979
|
scripts: {
|
|
3980
3980
|
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",
|
|
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",
|
|
3982
3982
|
prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
3983
3983
|
},
|
|
3984
3984
|
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.46",
|
|
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",
|
|
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",
|
|
20
20
|
prepublishOnly: "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
21
21
|
},
|
|
22
22
|
keywords: [
|
|
@@ -6162,6 +6162,71 @@ This runtime cannot launch the WebUI. Check HOLYSHEEP_AIONUI_RUNTIME_URL or repo
|
|
|
6162
6162
|
}
|
|
6163
6163
|
});
|
|
6164
6164
|
|
|
6165
|
+
// src/tools/gemini-cli.js
|
|
6166
|
+
var require_gemini_cli = __commonJS({
|
|
6167
|
+
"src/tools/gemini-cli.js"(exports2, module2) {
|
|
6168
|
+
var fs = require("fs");
|
|
6169
|
+
var path = require("path");
|
|
6170
|
+
var os = require("os");
|
|
6171
|
+
var GEMINI_DIR = path.join(os.homedir(), ".gemini");
|
|
6172
|
+
var SETTINGS_FILE = path.join(GEMINI_DIR, "settings.json");
|
|
6173
|
+
function readSettings() {
|
|
6174
|
+
try {
|
|
6175
|
+
if (fs.existsSync(SETTINGS_FILE)) {
|
|
6176
|
+
return JSON.parse(fs.readFileSync(SETTINGS_FILE, "utf8"));
|
|
6177
|
+
}
|
|
6178
|
+
} catch {
|
|
6179
|
+
}
|
|
6180
|
+
return {};
|
|
6181
|
+
}
|
|
6182
|
+
__name(readSettings, "readSettings");
|
|
6183
|
+
function writeSettings(data) {
|
|
6184
|
+
if (!fs.existsSync(GEMINI_DIR)) fs.mkdirSync(GEMINI_DIR, { recursive: true });
|
|
6185
|
+
fs.writeFileSync(SETTINGS_FILE, JSON.stringify(data, null, 2), "utf8");
|
|
6186
|
+
}
|
|
6187
|
+
__name(writeSettings, "writeSettings");
|
|
6188
|
+
module2.exports = {
|
|
6189
|
+
name: "Gemini CLI",
|
|
6190
|
+
id: "gemini-cli",
|
|
6191
|
+
checkInstalled() {
|
|
6192
|
+
return require_which().commandExists("gemini");
|
|
6193
|
+
},
|
|
6194
|
+
isConfigured() {
|
|
6195
|
+
if (process.env.GEMINI_API_KEY) return true;
|
|
6196
|
+
const s = readSettings();
|
|
6197
|
+
return s.selectedAuthType === "gemini-api-key";
|
|
6198
|
+
},
|
|
6199
|
+
configure(apiKey, _baseUrlAnthropicNoV1, _baseUrlOpenAI) {
|
|
6200
|
+
const settings = readSettings();
|
|
6201
|
+
settings.selectedAuthType = "gemini-api-key";
|
|
6202
|
+
writeSettings(settings);
|
|
6203
|
+
return {
|
|
6204
|
+
file: SETTINGS_FILE,
|
|
6205
|
+
hot: false,
|
|
6206
|
+
// 不注入 GEMINI_API_KEY,因为 HolySheep key 对 Gemini CLI 无效
|
|
6207
|
+
// 用户需要手动设置真正的 Gemini API Key
|
|
6208
|
+
envVars: {},
|
|
6209
|
+
warning: 'Gemini CLI \u9700\u8981 Google \u5B98\u65B9 Gemini API Key\uFF0C\u65E0\u6CD5\u4F7F\u7528 HolySheep \u4E2D\u7EE7\u3002\n\u8BF7\u4ECE https://aistudio.google.com/apikey \u83B7\u53D6 API Key \u540E\u8BBE\u7F6E\u73AF\u5883\u53D8\u91CF\uFF1A\n export GEMINI_API_KEY="your-google-api-key"'
|
|
6210
|
+
};
|
|
6211
|
+
},
|
|
6212
|
+
reset() {
|
|
6213
|
+
const settings = readSettings();
|
|
6214
|
+
delete settings.selectedAuthType;
|
|
6215
|
+
writeSettings(settings);
|
|
6216
|
+
},
|
|
6217
|
+
getConfigPath() {
|
|
6218
|
+
return SETTINGS_FILE;
|
|
6219
|
+
},
|
|
6220
|
+
hint: "Gemini CLI \u4E0D\u652F\u6301 HolySheep \u4E2D\u7EE7\uFF0C\u9700\u4F7F\u7528 Google \u5B98\u65B9 Gemini API Key",
|
|
6221
|
+
installCmd: "npm install -g @google/gemini-cli",
|
|
6222
|
+
docsUrl: "https://github.com/google-gemini/gemini-cli",
|
|
6223
|
+
envVarFormat: "gemini",
|
|
6224
|
+
unsupported: true
|
|
6225
|
+
// 标记为不支持中继
|
|
6226
|
+
};
|
|
6227
|
+
}
|
|
6228
|
+
});
|
|
6229
|
+
|
|
6165
6230
|
// src/webui/workspace-store.js
|
|
6166
6231
|
var require_workspace_store = __commonJS({
|
|
6167
6232
|
"src/webui/workspace-store.js"(exports2, module2) {
|
|
@@ -8579,6 +8644,10 @@ var require_aionui_wrapper = __commonJS({
|
|
|
8579
8644
|
} = require_config();
|
|
8580
8645
|
var claudeProcessProxy = require_claude_process_proxy();
|
|
8581
8646
|
var claudeCodeTool = require_claude_code();
|
|
8647
|
+
var geminiTool = require_gemini_cli();
|
|
8648
|
+
var codexTool = require_codex();
|
|
8649
|
+
var droidTool = require_droid();
|
|
8650
|
+
var hermesTool = require_hermes();
|
|
8582
8651
|
var BRIDGE_DIR = path.join(os.homedir(), ".holysheep");
|
|
8583
8652
|
var BRIDGE_CRED_FILE = path.join(BRIDGE_DIR, "aionui-bridge.json");
|
|
8584
8653
|
var TOKEN_TTL_MS = 3e4;
|
|
@@ -9097,6 +9166,75 @@ var require_aionui_wrapper = __commonJS({
|
|
|
9097
9166
|
});
|
|
9098
9167
|
}
|
|
9099
9168
|
__name(probeLocalPort, "probeLocalPort");
|
|
9169
|
+
function _ensureAllClisConfigured(apiKey) {
|
|
9170
|
+
if (!apiKey) {
|
|
9171
|
+
log("skipping auto-config for all CLI tools: no HolySheep apiKey available");
|
|
9172
|
+
return;
|
|
9173
|
+
}
|
|
9174
|
+
const summary = { configured: [], skipped: [], failed: [] };
|
|
9175
|
+
try {
|
|
9176
|
+
_ensureClaudeProxyConfig(apiKey);
|
|
9177
|
+
summary.configured.push("claude-code");
|
|
9178
|
+
} catch (e) {
|
|
9179
|
+
summary.failed.push({ tool: "claude-code", error: e && e.message ? e.message : String(e) });
|
|
9180
|
+
log("warn: auto-config claude-code failed: " + (e && e.message ? e.message : e));
|
|
9181
|
+
}
|
|
9182
|
+
const siblings = [
|
|
9183
|
+
{
|
|
9184
|
+
id: "codex",
|
|
9185
|
+
tool: codexTool,
|
|
9186
|
+
settingsHint: "~/.codex/config.toml + auth.json",
|
|
9187
|
+
configureArgs: [apiKey, BASE_URL_ANTHROPIC, BASE_URL_OPENAI]
|
|
9188
|
+
},
|
|
9189
|
+
{
|
|
9190
|
+
id: "droid",
|
|
9191
|
+
tool: droidTool,
|
|
9192
|
+
settingsHint: "~/.factory/settings.json",
|
|
9193
|
+
configureArgs: [apiKey, BASE_URL_ANTHROPIC, BASE_URL_OPENAI]
|
|
9194
|
+
},
|
|
9195
|
+
{
|
|
9196
|
+
id: "hermes",
|
|
9197
|
+
tool: hermesTool,
|
|
9198
|
+
settingsHint: "~/.hermes/config.{toml,yaml}",
|
|
9199
|
+
configureArgs: [apiKey, BASE_URL_ANTHROPIC, BASE_URL_OPENAI]
|
|
9200
|
+
},
|
|
9201
|
+
{
|
|
9202
|
+
id: "gemini-cli",
|
|
9203
|
+
tool: geminiTool,
|
|
9204
|
+
settingsHint: "~/.gemini/settings.json (selectedAuthType only \u2014 HolySheep key does not proxy Gemini)",
|
|
9205
|
+
configureArgs: [apiKey, BASE_URL_ANTHROPIC, BASE_URL_OPENAI]
|
|
9206
|
+
}
|
|
9207
|
+
];
|
|
9208
|
+
for (const s of siblings) {
|
|
9209
|
+
try {
|
|
9210
|
+
let already = false;
|
|
9211
|
+
try {
|
|
9212
|
+
already = typeof s.tool.isConfigured === "function" ? Boolean(s.tool.isConfigured()) : false;
|
|
9213
|
+
} catch {
|
|
9214
|
+
already = false;
|
|
9215
|
+
}
|
|
9216
|
+
if (already) {
|
|
9217
|
+
summary.skipped.push(s.id);
|
|
9218
|
+
log(`${s.id} already configured (${s.settingsHint}) \u2014 skipping auto-config`);
|
|
9219
|
+
continue;
|
|
9220
|
+
}
|
|
9221
|
+
if (typeof s.tool.configure !== "function") {
|
|
9222
|
+
summary.skipped.push(s.id);
|
|
9223
|
+
log(`${s.id} has no configure() entry (env-only) \u2014 skipped`);
|
|
9224
|
+
continue;
|
|
9225
|
+
}
|
|
9226
|
+
s.tool.configure.apply(s.tool, s.configureArgs);
|
|
9227
|
+
summary.configured.push(s.id);
|
|
9228
|
+
log(`auto-configured ${s.id} settings (${s.settingsHint}) \u2014 first-ever hs web for this user`);
|
|
9229
|
+
} catch (err) {
|
|
9230
|
+
summary.failed.push({ tool: s.id, error: err && err.message ? err.message : String(err) });
|
|
9231
|
+
log(`warn: auto-config ${s.id} failed: ${err && err.message ? err.message : err}`);
|
|
9232
|
+
}
|
|
9233
|
+
}
|
|
9234
|
+
log(`CLI auto-config summary: configured=[${summary.configured.join(",")}] skipped=[${summary.skipped.join(",")}] failed=[${summary.failed.map((f) => f.tool).join(",")}]`);
|
|
9235
|
+
return summary;
|
|
9236
|
+
}
|
|
9237
|
+
__name(_ensureAllClisConfigured, "_ensureAllClisConfigured");
|
|
9100
9238
|
function _ensureClaudeProxyConfig(apiKey) {
|
|
9101
9239
|
const config = claudeProcessProxy.readConfig();
|
|
9102
9240
|
const next = claudeCodeTool.buildBridgeConfig(apiKey, BASE_URL_ANTHROPIC, {
|
|
@@ -9170,6 +9308,19 @@ var require_aionui_wrapper = __commonJS({
|
|
|
9170
9308
|
}
|
|
9171
9309
|
const internalPort = await pickInternalPort();
|
|
9172
9310
|
log(`internal runtime port: ${internalPort}`);
|
|
9311
|
+
try {
|
|
9312
|
+
const __apiKeyForAutoConfig = (() => {
|
|
9313
|
+
try {
|
|
9314
|
+
return getApiKey();
|
|
9315
|
+
} catch {
|
|
9316
|
+
return null;
|
|
9317
|
+
}
|
|
9318
|
+
})();
|
|
9319
|
+
if (__apiKeyForAutoConfig) _ensureAllClisConfigured(__apiKeyForAutoConfig);
|
|
9320
|
+
else log("CLI auto-config skipped: no HolySheep apiKey (run `hs login`)");
|
|
9321
|
+
} catch (e) {
|
|
9322
|
+
log("warn: CLI auto-config error (continuing): " + (e && e.message ? e.message : e));
|
|
9323
|
+
}
|
|
9173
9324
|
const claudeProxyHandle = await ensureClaudeProcessProxyRunning();
|
|
9174
9325
|
const debug = process.env.HS_WEB_DEBUG === "1";
|
|
9175
9326
|
const { PACKAGE_ROOT, cliVersion, ptyHermesWrapperPath } = require_paths();
|
|
@@ -9286,6 +9437,7 @@ ${tail.split(/\r?\n/).map((ln) => ` ${ln}`).join("\n")}
|
|
|
9286
9437
|
__name(startWrapper, "startWrapper");
|
|
9287
9438
|
module2.exports = {
|
|
9288
9439
|
startWrapper,
|
|
9440
|
+
_ensureAllClisConfigured,
|
|
9289
9441
|
// Exported for tests / inspection
|
|
9290
9442
|
isLoopbackRequest,
|
|
9291
9443
|
pruneExpiredTokens,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.46",
|
|
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",
|
|
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",
|
|
8
8
|
"prepublishOnly": "npm run build && npm test && node scripts/check-tarball-size.js"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|