@simonyea/holysheep-cli 1.7.19 → 1.7.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.7.19",
3
+ "version": "1.7.20",
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
  "keywords": [
6
6
  "openai-china",
@@ -526,6 +526,18 @@ async function relayOpenAIRequest(requestBody, config, res) {
526
526
  body: JSON.stringify(upstreamBody),
527
527
  })
528
528
 
529
+ // 流式请求:直接字节透传(已是 OpenAI SSE 格式,无需转换)
530
+ if (requestBody.stream === true && upstream.ok) {
531
+ res.writeHead(200, {
532
+ 'content-type': 'text/event-stream; charset=utf-8',
533
+ 'cache-control': 'no-cache, no-transform',
534
+ connection: 'keep-alive',
535
+ })
536
+ try { await pipeStream(upstream.body, (chunk) => res.write(chunk)) } catch {}
537
+ if (!res.writableEnded) res.end()
538
+ return
539
+ }
540
+
529
541
  const text = await upstream.text()
530
542
  const parsed = parseOpenAIStreamText(text, requestBody.model)
531
543
  if (upstream.ok && parsed) {
@@ -203,10 +203,13 @@ function startBridge(port) {
203
203
  if (waitForBridge(port)) return true
204
204
 
205
205
  const scriptPath = path.join(__dirname, '..', 'index.js')
206
- const child = spawn(process.execPath, [scriptPath, 'openclaw-bridge', '--port', String(port)], {
207
- detached: true,
208
- stdio: 'ignore',
209
- })
206
+ // Windows: use shell+node command to avoid ERROR_FILE_NOT_FOUND with process.execPath
207
+ // (Windows Store / nvm paths can be unresolvable when spawning detached)
208
+ const spawnCmd = isWin ? 'node' : process.execPath
209
+ const spawnOpts = isWin
210
+ ? { shell: true, detached: true, stdio: 'ignore', windowsHide: true }
211
+ : { detached: true, stdio: 'ignore' }
212
+ const child = spawn(spawnCmd, [scriptPath, 'openclaw-bridge', '--port', String(port)], spawnOpts)
210
213
  child.unref()
211
214
  return waitForBridge(port)
212
215
  }