@simonyea/holysheep-cli 1.7.93 → 1.7.95
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 +1 -1
- package/src/tools/openclaw.js +21 -0
- package/src/webui/server.js +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.95",
|
|
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",
|
package/src/tools/openclaw.js
CHANGED
|
@@ -773,6 +773,27 @@ module.exports = {
|
|
|
773
773
|
getConfigPath() { return CONFIG_FILE },
|
|
774
774
|
getBridgePort() { return getConfiguredBridgePort() },
|
|
775
775
|
getGatewayPort() { return getConfiguredGatewayPort() },
|
|
776
|
+
ensureBridgeRunning(port) {
|
|
777
|
+
port = port || getConfiguredBridgePort()
|
|
778
|
+
return startBridge(port)
|
|
779
|
+
},
|
|
780
|
+
ensureGatewayRunning(port) {
|
|
781
|
+
port = port || getConfiguredGatewayPort()
|
|
782
|
+
// 先检查是否已在运行
|
|
783
|
+
try {
|
|
784
|
+
execSync(
|
|
785
|
+
isWin
|
|
786
|
+
? `powershell -NonInteractive -Command "try{(Invoke-WebRequest -Uri http://127.0.0.1:${port}/ -TimeoutSec 1 -UseBasicParsing).StatusCode}catch{exit 1}"`
|
|
787
|
+
: `curl -sf http://127.0.0.1:${port}/ -o /dev/null --max-time 1`,
|
|
788
|
+
{ stdio: 'ignore', timeout: 3000 }
|
|
789
|
+
)
|
|
790
|
+
return true
|
|
791
|
+
} catch {}
|
|
792
|
+
// 未运行,启动它
|
|
793
|
+
const preferNpx = !hasOpenClawBinary()
|
|
794
|
+
const result = _startGateway(port, preferNpx, !preferNpx)
|
|
795
|
+
return result.ok
|
|
796
|
+
},
|
|
776
797
|
getPrimaryModel() { return getConfiguredPrimaryModel() },
|
|
777
798
|
getPrimaryModelRoute() { return getPrimaryModelRoute() },
|
|
778
799
|
getPortListeners(port = getConfiguredGatewayPort()) { return listPortListeners(port) },
|
package/src/webui/server.js
CHANGED
|
@@ -654,10 +654,20 @@ async function handleToolLaunch(req, res) {
|
|
|
654
654
|
const tool = TOOLS.find(t => t.id === toolId)
|
|
655
655
|
if (!tool) return json(res, { error: '未知工具' }, 400)
|
|
656
656
|
|
|
657
|
-
// OpenClaw:
|
|
657
|
+
// OpenClaw: 后台启动服务,立即打开浏览器
|
|
658
658
|
if (toolId === 'openclaw') {
|
|
659
|
-
const
|
|
660
|
-
const
|
|
659
|
+
const gatewayPort = tool.getGatewayPort?.() || 18789
|
|
660
|
+
const bridgePort = tool.getBridgePort?.() || 18788
|
|
661
|
+
|
|
662
|
+
// 后台启动 Bridge + Gateway,不阻塞响应
|
|
663
|
+
setImmediate(() => {
|
|
664
|
+
try {
|
|
665
|
+
tool.ensureBridgeRunning?.(bridgePort)
|
|
666
|
+
tool.ensureGatewayRunning?.(gatewayPort)
|
|
667
|
+
} catch {}
|
|
668
|
+
})
|
|
669
|
+
|
|
670
|
+
const url = `http://127.0.0.1:${gatewayPort}/`
|
|
661
671
|
if (process.platform === 'darwin') spawn('open', [url], { detached: true, stdio: 'ignore' }).unref()
|
|
662
672
|
else if (process.platform === 'win32') spawn('cmd.exe', ['/c', 'start', '', url], { detached: true, stdio: 'ignore', shell: true }).unref()
|
|
663
673
|
else spawn('xdg-open', [url], { detached: true, stdio: 'ignore' }).unref()
|