yymaxapi 1.0.23 → 1.0.24
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/bin/yymaxapi.js +30 -1
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -2561,7 +2561,7 @@ async function restartGateway() {
|
|
|
2561
2561
|
const wslCli = getWslCliBinary();
|
|
2562
2562
|
return new Promise((resolve) => {
|
|
2563
2563
|
const wslCmds = wslCli
|
|
2564
|
-
? [`wsl -- bash -
|
|
2564
|
+
? [`wsl -- bash -lc "${wslCli} gateway restart"`]
|
|
2565
2565
|
: [
|
|
2566
2566
|
'wsl -- bash -lc "openclaw gateway restart"',
|
|
2567
2567
|
'wsl -- bash -lc "clawdbot gateway restart"',
|
|
@@ -2612,6 +2612,13 @@ async function forceRestartGateway(resolved, nodeInfo, useNode, env, gatewayPort
|
|
|
2612
2612
|
}
|
|
2613
2613
|
}
|
|
2614
2614
|
}
|
|
2615
|
+
// Windows + WSL: 也清理 WSL 内的 gateway 进程
|
|
2616
|
+
if (isWslAvailable()) {
|
|
2617
|
+
for (const name of ['openclaw', 'clawdbot', 'moltbot']) {
|
|
2618
|
+
safeExec(`wsl -- bash -c "pkill -f '${name}.*gateway' 2>/dev/null || true"`, { timeout: 5000 });
|
|
2619
|
+
}
|
|
2620
|
+
safeExec(`wsl -- bash -c "lsof -ti :${gatewayPort} 2>/dev/null | xargs -r kill -9 2>/dev/null || true"`, { timeout: 5000 });
|
|
2621
|
+
}
|
|
2615
2622
|
} else {
|
|
2616
2623
|
// Linux/macOS: pkill gateway 相关进程
|
|
2617
2624
|
for (const name of ['openclaw', 'clawdbot', 'moltbot']) {
|
|
@@ -2651,7 +2658,18 @@ async function forceRestartGateway(resolved, nodeInfo, useNode, env, gatewayPort
|
|
|
2651
2658
|
startCmds.push(`bash -lc '${name} gateway'`);
|
|
2652
2659
|
}
|
|
2653
2660
|
} else {
|
|
2661
|
+
// Windows: 先尝试原生命令
|
|
2654
2662
|
startCmds.push('openclaw gateway', 'clawdbot gateway', 'moltbot gateway');
|
|
2663
|
+
// Windows + WSL: 也尝试通过 WSL 启动 gateway
|
|
2664
|
+
if (isWslAvailable()) {
|
|
2665
|
+
const wslCli = getWslCliBinary();
|
|
2666
|
+
if (wslCli) {
|
|
2667
|
+
startCmds.push(`wsl -- bash -lc "${wslCli} gateway"`);
|
|
2668
|
+
}
|
|
2669
|
+
for (const name of ['openclaw', 'clawdbot', 'moltbot']) {
|
|
2670
|
+
startCmds.push(`wsl -- bash -lc "${name} gateway"`);
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2655
2673
|
}
|
|
2656
2674
|
|
|
2657
2675
|
for (const cmd of [...new Set(startCmds)].filter(Boolean)) {
|
|
@@ -2693,6 +2711,17 @@ async function restartGatewayNative() {
|
|
|
2693
2711
|
'npx moltbot gateway restart'
|
|
2694
2712
|
];
|
|
2695
2713
|
|
|
2714
|
+
// Windows + WSL: 追加 WSL 命令作为额外回退
|
|
2715
|
+
if (process.platform === 'win32' && isWslAvailable()) {
|
|
2716
|
+
const wslCli = getWslCliBinary();
|
|
2717
|
+
if (wslCli) {
|
|
2718
|
+
commands.push(`wsl -- bash -lc "${wslCli} gateway restart"`);
|
|
2719
|
+
}
|
|
2720
|
+
for (const name of ['openclaw', 'clawdbot', 'moltbot']) {
|
|
2721
|
+
commands.push(`wsl -- bash -lc "${name} gateway restart"`);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2696
2725
|
return new Promise((resolve) => {
|
|
2697
2726
|
let tried = 0;
|
|
2698
2727
|
|