@simonyea/holysheep-cli 1.7.132 → 1.7.134
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/README.md +1 -0
- package/package.json +4 -1
- package/src/tools/claude-process-proxy.js +2 -0
- package/src/tools/droid.js +12 -2
- package/tests/droid.test.js +75 -0
package/README.md
CHANGED
|
@@ -225,6 +225,7 @@ A: OpenClaw 需要 Node.js 20+,运行 `node --version` 确认版本后重试
|
|
|
225
225
|
|
|
226
226
|
## Changelog
|
|
227
227
|
|
|
228
|
+
- **v1.7.134** — 修复并发配置/Worker 路径下 Droid CLI 的 GPT-5.4 BYOK 配置:GPT 走 `generic-chat-completion-api + https://api.holysheep.ai/v1`,避免误走 Anthropic `/v1/messages`
|
|
228
229
|
- **v1.7.53** — 修复 `hs claude` 在绝对 URL 代理路径下未透传 `x-hs-node-proxied` 的问题,避免同一会话里部分 Claude 请求被后端误判为非可信代理请求并随机触发 403
|
|
229
230
|
- **v1.7.52** — 将 `hs claude` 重构为本地 API 入口 + CONNECT 兜底代理:Claude Anthropic 请求默认先进入本地 process proxy,再补齐 HolySheep 会话头后转发,降低独立二进制 Claude Code 漏代理导致的 403
|
|
230
231
|
- **v1.7.51** — 修复 `hs claude` 在 Claude Code 独立二进制版本上的整进程代理:自动识别脚本入口 / 独立二进制并切换到 `NODE_OPTIONS` 注入或 `HTTP(S)_PROXY` 模式;同时增强 `hs doctor` 的 Claude 代理诊断
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.134",
|
|
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
|
+
"scripts": {
|
|
6
|
+
"test": "node tests/droid.test.js"
|
|
7
|
+
},
|
|
5
8
|
"keywords": [
|
|
6
9
|
"openai-china",
|
|
7
10
|
"claude-china",
|
|
@@ -47,6 +47,7 @@ function getControlPlaneUrl(config) {
|
|
|
47
47
|
|
|
48
48
|
const leaseCache = new Map()
|
|
49
49
|
const MAX_PROXY_RETRIES = 3
|
|
50
|
+
const ENABLE_TIMING_LOG = process.env.HS_CLAUDE_TIMING_LOG === '1'
|
|
50
51
|
const SLOW_PATH_LOG_MS = Number(process.env.HS_CLAUDE_SLOW_PATH_LOG_MS) || 5000
|
|
51
52
|
|
|
52
53
|
function sanitizeUrl(value) {
|
|
@@ -60,6 +61,7 @@ function sanitizeUrl(value) {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
function logProxyTiming(event, details = {}) {
|
|
64
|
+
if (!ENABLE_TIMING_LOG) return
|
|
63
65
|
const payload = Object.fromEntries(
|
|
64
66
|
Object.entries(details).filter(([, value]) => value !== undefined && value !== null && value !== '')
|
|
65
67
|
)
|
package/src/tools/droid.js
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
* - GPT 走 OpenAI 兼容入口: https://api.holysheep.ai/v1
|
|
7
7
|
* - Claude 走 Anthropic 入口: https://api.holysheep.ai
|
|
8
8
|
* - MiniMax 走 Anthropic 入口: https://api.holysheep.ai/minimax
|
|
9
|
+
*
|
|
10
|
+
* Droid 的 "openai" BYOK provider 使用 Responses API;HolySheep 的 GPT
|
|
11
|
+
* 入口当前要求 /v1/chat/completions,所以 GPT 模型必须使用
|
|
12
|
+
* generic-chat-completion-api,不能使用 anthropic,也不能使用 openai。
|
|
9
13
|
*/
|
|
10
14
|
const fs = require('fs')
|
|
11
15
|
const path = require('path')
|
|
@@ -21,7 +25,8 @@ const DEFAULT_MODELS = [
|
|
|
21
25
|
id: 'custom:gpt-5.4-0',
|
|
22
26
|
baseUrlSuffix: '',
|
|
23
27
|
displayName: 'GPT-5.4',
|
|
24
|
-
provider: '
|
|
28
|
+
provider: 'generic-chat-completion-api',
|
|
29
|
+
route: 'openai',
|
|
25
30
|
},
|
|
26
31
|
{
|
|
27
32
|
model: 'claude-sonnet-4-6',
|
|
@@ -29,6 +34,7 @@ const DEFAULT_MODELS = [
|
|
|
29
34
|
baseUrlSuffix: '',
|
|
30
35
|
displayName: 'Sonnet 4.6',
|
|
31
36
|
provider: 'anthropic',
|
|
37
|
+
route: 'anthropic',
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
model: 'claude-opus-4-6',
|
|
@@ -36,6 +42,7 @@ const DEFAULT_MODELS = [
|
|
|
36
42
|
baseUrlSuffix: '',
|
|
37
43
|
displayName: 'Opus 4.6',
|
|
38
44
|
provider: 'anthropic',
|
|
45
|
+
route: 'anthropic',
|
|
39
46
|
},
|
|
40
47
|
{
|
|
41
48
|
model: 'MiniMax-M2.7-highspeed',
|
|
@@ -43,6 +50,7 @@ const DEFAULT_MODELS = [
|
|
|
43
50
|
baseUrlSuffix: '/minimax',
|
|
44
51
|
displayName: 'MiniMax 2.7 Highspeed',
|
|
45
52
|
provider: 'anthropic',
|
|
53
|
+
route: 'anthropic',
|
|
46
54
|
},
|
|
47
55
|
{
|
|
48
56
|
model: 'claude-haiku-4-5',
|
|
@@ -50,6 +58,7 @@ const DEFAULT_MODELS = [
|
|
|
50
58
|
baseUrlSuffix: '',
|
|
51
59
|
displayName: 'Haiku 4.5',
|
|
52
60
|
provider: 'anthropic',
|
|
61
|
+
route: 'anthropic',
|
|
53
62
|
},
|
|
54
63
|
]
|
|
55
64
|
|
|
@@ -98,6 +107,7 @@ function normalizeSelectedModels(selectedModels) {
|
|
|
98
107
|
baseUrlSuffix: item.baseUrlSuffix,
|
|
99
108
|
displayName: item.displayName,
|
|
100
109
|
provider: item.provider,
|
|
110
|
+
route: item.route,
|
|
101
111
|
}))
|
|
102
112
|
|
|
103
113
|
return models.length > 0 ? models : DEFAULT_MODELS.map((item, index) => ({ ...item, index }))
|
|
@@ -111,7 +121,7 @@ function buildCustomModels(apiKey, baseUrlAnthropic, baseUrlOpenAI, selectedMode
|
|
|
111
121
|
id: item.id,
|
|
112
122
|
index: item.index,
|
|
113
123
|
baseUrl:
|
|
114
|
-
item.
|
|
124
|
+
item.route === 'openai'
|
|
115
125
|
? `${openaiRootUrl}${item.baseUrlSuffix}`
|
|
116
126
|
: `${anthropicRootUrl}${item.baseUrlSuffix}`,
|
|
117
127
|
apiKey,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const assert = require('assert')
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const os = require('os')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
const tempHome = fs.mkdtempSync(path.join(os.tmpdir(), 'hs-droid-test-'))
|
|
7
|
+
process.env.HOME = tempHome
|
|
8
|
+
|
|
9
|
+
const droid = require('../src/tools/droid')
|
|
10
|
+
|
|
11
|
+
const factoryDir = path.join(tempHome, '.factory')
|
|
12
|
+
const settingsFile = path.join(factoryDir, 'settings.json')
|
|
13
|
+
const configFile = path.join(factoryDir, 'config.json')
|
|
14
|
+
|
|
15
|
+
fs.mkdirSync(factoryDir, { recursive: true })
|
|
16
|
+
fs.writeFileSync(settingsFile, JSON.stringify({
|
|
17
|
+
customModels: [
|
|
18
|
+
{
|
|
19
|
+
model: 'gpt-5.4',
|
|
20
|
+
id: 'custom:gpt-5.4-0',
|
|
21
|
+
baseUrl: 'https://api.holysheep.ai',
|
|
22
|
+
provider: 'anthropic',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
model: 'local-test',
|
|
26
|
+
id: 'custom:local-test',
|
|
27
|
+
baseUrl: 'http://localhost:11434/v1',
|
|
28
|
+
provider: 'generic-chat-completion-api',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}, null, 2))
|
|
32
|
+
fs.writeFileSync(configFile, JSON.stringify({
|
|
33
|
+
customModels: [
|
|
34
|
+
{
|
|
35
|
+
model: 'gpt-5.4',
|
|
36
|
+
id: 'custom:gpt-5.4-0',
|
|
37
|
+
baseUrl: 'https://api.holysheep.ai',
|
|
38
|
+
provider: 'anthropic',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
}, null, 2))
|
|
42
|
+
|
|
43
|
+
droid.configure(
|
|
44
|
+
'cr_test',
|
|
45
|
+
'https://api.holysheep.ai',
|
|
46
|
+
'https://api.holysheep.ai/v1',
|
|
47
|
+
'gpt-5.4',
|
|
48
|
+
['gpt-5.4', 'claude-sonnet-4-6', 'MiniMax-M2.7-highspeed'],
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const settings = JSON.parse(fs.readFileSync(settingsFile, 'utf8'))
|
|
52
|
+
const legacy = JSON.parse(fs.readFileSync(configFile, 'utf8'))
|
|
53
|
+
|
|
54
|
+
for (const config of [settings, legacy]) {
|
|
55
|
+
const gpt = config.customModels.find((entry) => entry.id === 'custom:gpt-5.4-0')
|
|
56
|
+
assert.ok(gpt, 'GPT-5.4 custom model should be present')
|
|
57
|
+
assert.strictEqual(gpt.model, 'gpt-5.4')
|
|
58
|
+
assert.strictEqual(gpt.provider, 'generic-chat-completion-api')
|
|
59
|
+
assert.strictEqual(gpt.baseUrl, 'https://api.holysheep.ai/v1')
|
|
60
|
+
|
|
61
|
+
const sonnet = config.customModels.find((entry) => entry.id === 'custom:claude-sonnet-4-6-0')
|
|
62
|
+
assert.ok(sonnet, 'Sonnet custom model should be present')
|
|
63
|
+
assert.strictEqual(sonnet.provider, 'anthropic')
|
|
64
|
+
assert.strictEqual(sonnet.baseUrl, 'https://api.holysheep.ai')
|
|
65
|
+
|
|
66
|
+
const minimax = config.customModels.find((entry) => entry.id === 'custom:MiniMax-M2.7-highspeed-0')
|
|
67
|
+
assert.ok(minimax, 'MiniMax custom model should be present')
|
|
68
|
+
assert.strictEqual(minimax.provider, 'anthropic')
|
|
69
|
+
assert.strictEqual(minimax.baseUrl, 'https://api.holysheep.ai/minimax')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const preserved = settings.customModels.find((entry) => entry.id === 'custom:local-test')
|
|
73
|
+
assert.ok(preserved, 'non-HolySheep custom models should be preserved')
|
|
74
|
+
|
|
75
|
+
console.log('droid config test passed')
|