@simonyea/holysheep-cli 1.7.52 → 1.7.53

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 CHANGED
@@ -225,6 +225,7 @@ A: OpenClaw 需要 Node.js 20+,运行 `node --version` 确认版本后重试
225
225
 
226
226
  ## Changelog
227
227
 
228
+ - **v1.7.53** — 修复 `hs claude` 在绝对 URL 代理路径下未透传 `x-hs-node-proxied` 的问题,避免同一会话里部分 Claude 请求被后端误判为非可信代理请求并随机触发 403
228
229
  - **v1.7.52** — 将 `hs claude` 重构为本地 API 入口 + CONNECT 兜底代理:Claude Anthropic 请求默认先进入本地 process proxy,再补齐 HolySheep 会话头后转发,降低独立二进制 Claude Code 漏代理导致的 403
229
230
  - **v1.7.51** — 修复 `hs claude` 在 Claude Code 独立二进制版本上的整进程代理:自动识别脚本入口 / 独立二进制并切换到 `NODE_OPTIONS` 注入或 `HTTP(S)_PROXY` 模式;同时增强 `hs doctor` 的 Claude 代理诊断
230
231
  - **v1.6.14** — OpenClaw 新增 `gpt-5.3-codex-spark` 模型,通过本地 bridge 路由到 HolySheep `/v1`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.7.52",
3
+ "version": "1.7.53",
4
4
  "description": "Claude Code/Cursor/Cline API relay for China \u2014 \u00a51=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
5
5
  "keywords": [
6
6
  "openai-china",
@@ -88,6 +88,15 @@ async function runClaude(args = []) {
88
88
  NO_PROXY: mergeNoProxy(process.env.NO_PROXY, ['127.0.0.1', 'localhost']),
89
89
  }
90
90
 
91
+ const restoreSettings = typeof claudeCodeTool.applyRuntimeSettingsOverride === 'function'
92
+ ? claudeCodeTool.applyRuntimeSettingsOverride({
93
+ ANTHROPIC_AUTH_TOKEN: apiKey,
94
+ ANTHROPIC_BASE_URL: proxyUrl,
95
+ CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: '1',
96
+ HOLYSHEEP_CLAUDE_LAUNCHER: 'hs',
97
+ })
98
+ : () => {}
99
+
91
100
  if (runtime.launchMode === 'node-inject') {
92
101
  env.NODE_OPTIONS = appendNodeRequire(process.env.NODE_OPTIONS, INJECT_PATH)
93
102
  }
@@ -99,6 +108,7 @@ async function runClaude(args = []) {
99
108
  })
100
109
 
101
110
  const cleanup = async () => {
111
+ restoreSettings()
102
112
  try {
103
113
  server.close()
104
114
  } catch {}
@@ -56,6 +56,30 @@ function writeSettings(data) {
56
56
  fs.writeFileSync(SETTINGS_FILE, JSON.stringify(data, null, 2), 'utf8')
57
57
  }
58
58
 
59
+ function cloneSettings(data) {
60
+ return JSON.parse(JSON.stringify(data || {}))
61
+ }
62
+
63
+ function applyRuntimeSettingsOverride(overrides = {}) {
64
+ const previous = readSettings()
65
+ const next = cloneSettings(previous)
66
+ next.env = { ...(next.env || {}) }
67
+
68
+ for (const [key, value] of Object.entries(overrides)) {
69
+ if (value === undefined || value === null) {
70
+ delete next.env[key]
71
+ continue
72
+ }
73
+ next.env[key] = value
74
+ }
75
+
76
+ writeSettings(next)
77
+
78
+ return () => {
79
+ writeSettings(previous)
80
+ }
81
+ }
82
+
59
83
  function resolveCommandPath(cmd) {
60
84
  try {
61
85
  if (process.platform === 'win32') {
@@ -198,4 +222,7 @@ module.exports = {
198
222
  },
199
223
  buildBridgeConfig,
200
224
  detectClaudeRuntime,
225
+ readSettings,
226
+ writeSettings,
227
+ applyRuntimeSettingsOverride,
201
228
  }
@@ -191,6 +191,7 @@ function createProcessProxyServer({ sessionId, configPath = CONFIG_PATH }) {
191
191
  const nodeProxyUrl = deriveNodeProxyUrl(lease)
192
192
  const headers = {
193
193
  ...buildAuthHeaders(config, lease),
194
+ 'x-hs-node-proxied': '1',
194
195
  host: new URL(clientReq.url).host,
195
196
  }
196
197
  const upstream = new URL(nodeProxyUrl)