yymaxapi 1.0.13 → 1.0.14
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 +8 -8
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -614,11 +614,11 @@ function detectGatewayEnv(port = 18789) {
|
|
|
614
614
|
return 'native';
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
-
// 在 Gateway 环境中执行命令(WSL 自动包裹 wsl -- bash -
|
|
617
|
+
// 在 Gateway 环境中执行命令(WSL 自动包裹 wsl -- bash -lc)
|
|
618
618
|
function execInGatewayEnv(cmd, options = {}) {
|
|
619
619
|
if (detectGatewayEnv() === 'wsl') {
|
|
620
620
|
const escaped = cmd.replace(/'/g, "'\\''");
|
|
621
|
-
return safeExec(`wsl -- bash -
|
|
621
|
+
return safeExec(`wsl -- bash -lc '${escaped}'`, options);
|
|
622
622
|
}
|
|
623
623
|
return safeExec(cmd, options);
|
|
624
624
|
}
|
|
@@ -627,7 +627,7 @@ function execInGatewayEnv(cmd, options = {}) {
|
|
|
627
627
|
function execAsyncInGatewayEnv(cmd, options = {}) {
|
|
628
628
|
if (detectGatewayEnv() === 'wsl') {
|
|
629
629
|
const escaped = cmd.replace(/'/g, "'\\''");
|
|
630
|
-
return { cmd: `wsl -- bash -
|
|
630
|
+
return { cmd: `wsl -- bash -lc '${escaped}'`, options };
|
|
631
631
|
}
|
|
632
632
|
return { cmd, options };
|
|
633
633
|
}
|
|
@@ -662,7 +662,7 @@ function cleanupAgentProcesses() {
|
|
|
662
662
|
// WSL 内的 agent 也要清理
|
|
663
663
|
if (detectGatewayEnv() === 'wsl') {
|
|
664
664
|
try {
|
|
665
|
-
execSync('wsl -- bash -
|
|
665
|
+
execSync('wsl -- bash -lc "pkill -f \'openclaw.*agent\' 2>/dev/null; pkill -f \'clawdbot.*agent\' 2>/dev/null; pkill -f \'moltbot.*agent\' 2>/dev/null; true"', { stdio: 'ignore', timeout: 10000 });
|
|
666
666
|
} catch { /* ignore */ }
|
|
667
667
|
}
|
|
668
668
|
} else {
|
|
@@ -2481,9 +2481,9 @@ async function restartGateway() {
|
|
|
2481
2481
|
console.log(chalk.gray(' [检测] Gateway 运行在 WSL 中'));
|
|
2482
2482
|
return new Promise((resolve) => {
|
|
2483
2483
|
const wslCmds = [
|
|
2484
|
-
'wsl -- bash -
|
|
2485
|
-
'wsl -- bash -
|
|
2486
|
-
'wsl -- bash -
|
|
2484
|
+
'wsl -- bash -lc "openclaw gateway restart"',
|
|
2485
|
+
'wsl -- bash -lc "clawdbot gateway restart"',
|
|
2486
|
+
'wsl -- bash -lc "moltbot gateway restart"',
|
|
2487
2487
|
];
|
|
2488
2488
|
let tried = 0;
|
|
2489
2489
|
const tryNext = () => {
|
|
@@ -2661,7 +2661,7 @@ function testGatewayViaAgent(model) {
|
|
|
2661
2661
|
if (gwEnv === 'wsl') {
|
|
2662
2662
|
// Gateway 在 WSL 中,agent 也要在 WSL 中执行
|
|
2663
2663
|
const agentCmd = `openclaw agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120 2>/dev/null || clawdbot agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120 2>/dev/null || moltbot agent --session-id ${sessionId} --message "请回复你的模型名称" --json --timeout 120`;
|
|
2664
|
-
cmd = `wsl -- bash -
|
|
2664
|
+
cmd = `wsl -- bash -lc '${agentCmd.replace(/'/g, "'\\''")}'`;
|
|
2665
2665
|
execOpts = { timeout: 120000 };
|
|
2666
2666
|
} else {
|
|
2667
2667
|
const { cliBinary, nodeMajor } = getCliMeta();
|