yymaxapi 1.0.101 → 1.0.102
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 +45 -73
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -412,6 +412,7 @@ async function promptOpencodeDefaultModelSelection(args = {}, message = '选择
|
|
|
412
412
|
const BACKUP_FILENAME = 'openclaw-default.json.bak';
|
|
413
413
|
const BACKUP_DIR_NAME = 'backups';
|
|
414
414
|
const MAX_BACKUPS = 10;
|
|
415
|
+
const GATEWAY_CLI_NAMES = ['openclaw'];
|
|
415
416
|
const EXTRA_BIN_DIRS = [
|
|
416
417
|
path.join(os.homedir(), '.npm-global', 'bin'),
|
|
417
418
|
path.join(os.homedir(), '.local', 'bin'),
|
|
@@ -1151,7 +1152,7 @@ function dockerCmd(cmd) {
|
|
|
1151
1152
|
return _dockerNeedsSudo ? `sudo -n docker ${cmd}` : `docker ${cmd}`;
|
|
1152
1153
|
}
|
|
1153
1154
|
|
|
1154
|
-
// 查找包含 openclaw
|
|
1155
|
+
// 查找包含 openclaw 的运行中容器
|
|
1155
1156
|
function findOpenclawDockerContainers() {
|
|
1156
1157
|
if (_dockerContainerCache !== null) return _dockerContainerCache;
|
|
1157
1158
|
if (!isDockerAvailable()) { _dockerContainerCache = []; return []; }
|
|
@@ -1169,7 +1170,7 @@ function findOpenclawDockerContainers() {
|
|
|
1169
1170
|
const status = statusParts.join(' ');
|
|
1170
1171
|
if (!id) continue;
|
|
1171
1172
|
|
|
1172
|
-
// 检查容器内是否有 openclaw
|
|
1173
|
+
// 检查容器内是否有 openclaw(用 command -v 代替 which,兼容精简镜像)
|
|
1173
1174
|
for (const cli of ['openclaw', 'clawdbot', 'moltbot']) {
|
|
1174
1175
|
const check = safeExec(dockerCmd(`exec ${id} sh -c "command -v ${cli} 2>/dev/null || which ${cli} 2>/dev/null"`), { timeout: 8000 });
|
|
1175
1176
|
if (check.ok && check.output && check.output.trim()) {
|
|
@@ -1343,7 +1344,7 @@ let _wslCliBinaryCache = undefined;
|
|
|
1343
1344
|
|
|
1344
1345
|
function getWslCliBinary() {
|
|
1345
1346
|
if (_wslCliBinaryCache !== undefined) return _wslCliBinaryCache;
|
|
1346
|
-
for (const name of
|
|
1347
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
1347
1348
|
try {
|
|
1348
1349
|
const result = execFileSync('wsl', ['bash', '-lc', `which ${name} 2>/dev/null`], { encoding: 'utf8', timeout: 5000, stdio: 'pipe' }).trim();
|
|
1349
1350
|
if (result && result.startsWith('/')) {
|
|
@@ -1457,7 +1458,7 @@ function cleanupAgentProcesses() {
|
|
|
1457
1458
|
try {
|
|
1458
1459
|
const { execSync } = require('child_process');
|
|
1459
1460
|
if (process.platform === 'win32') {
|
|
1460
|
-
for (const name of
|
|
1461
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
1461
1462
|
try {
|
|
1462
1463
|
execSync(`wmic process where "commandline like '%${name}%agent%' and not commandline like '%gateway%'" call terminate 2>nul`, { stdio: 'ignore', timeout: 10000 });
|
|
1463
1464
|
} catch { /* ignore */ }
|
|
@@ -1468,18 +1469,18 @@ function cleanupAgentProcesses() {
|
|
|
1468
1469
|
// WSL 内的 agent 也要清理
|
|
1469
1470
|
if (detectGatewayEnv() === 'wsl') {
|
|
1470
1471
|
try {
|
|
1471
|
-
execSync('wsl -- bash -lc "pkill -f \'openclaw.*agent\' 2>/dev/null
|
|
1472
|
+
execSync('wsl -- bash -lc "pkill -f \'openclaw.*agent\' 2>/dev/null || true"', { stdio: 'ignore', timeout: 10000 });
|
|
1472
1473
|
} catch { /* ignore */ }
|
|
1473
1474
|
}
|
|
1474
1475
|
} else {
|
|
1475
|
-
for (const name of
|
|
1476
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
1476
1477
|
execSync(`pkill -f '${name}.*agent' 2>/dev/null || true`, { stdio: 'ignore' });
|
|
1477
1478
|
}
|
|
1478
1479
|
}
|
|
1479
1480
|
// Docker 容器内的 agent 也要清理
|
|
1480
1481
|
if (detectGatewayEnv() === 'docker' && _selectedDockerContainer) {
|
|
1481
1482
|
try {
|
|
1482
|
-
for (const name of
|
|
1483
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
1483
1484
|
safeExec(dockerCmd(`exec ${_selectedDockerContainer.id} sh -c "pkill -f '${name}.*agent' 2>/dev/null || true"`), { timeout: 10000 });
|
|
1484
1485
|
}
|
|
1485
1486
|
} catch { /* ignore */ }
|
|
@@ -3209,6 +3210,14 @@ function shellQuote(value) {
|
|
|
3209
3210
|
return `"${str.replace(/(["\\$`])/g, '\\$1')}"`;
|
|
3210
3211
|
}
|
|
3211
3212
|
|
|
3213
|
+
function escapeSingleQuotedShell(value) {
|
|
3214
|
+
return String(value || '').replace(/'/g, "'\\''");
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
function buildLoginShellCommand(shellPath, command) {
|
|
3218
|
+
return `${shellPath} -lc '${escapeSingleQuotedShell(command)}'`;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3212
3221
|
function escapeXml(value) {
|
|
3213
3222
|
return String(value)
|
|
3214
3223
|
.replace(/&/g, '&')
|
|
@@ -3252,7 +3261,7 @@ function resolveCliBinary() {
|
|
|
3252
3261
|
}
|
|
3253
3262
|
}
|
|
3254
3263
|
|
|
3255
|
-
const candidates =
|
|
3264
|
+
const candidates = GATEWAY_CLI_NAMES;
|
|
3256
3265
|
const isWin = process.platform === 'win32';
|
|
3257
3266
|
const searchDirs = (process.env.PATH || '').split(path.delimiter).concat(EXTRA_BIN_DIRS);
|
|
3258
3267
|
for (const name of candidates) {
|
|
@@ -3271,30 +3280,6 @@ function resolveCliBinary() {
|
|
|
3271
3280
|
}
|
|
3272
3281
|
}
|
|
3273
3282
|
|
|
3274
|
-
const moltbotRoots = [];
|
|
3275
|
-
if (process.env.MOLTBOT_ROOT) moltbotRoots.push(process.env.MOLTBOT_ROOT);
|
|
3276
|
-
moltbotRoots.push('/opt/moltbot');
|
|
3277
|
-
moltbotRoots.push('/opt/moltbot/app');
|
|
3278
|
-
|
|
3279
|
-
const scriptCandidates = [];
|
|
3280
|
-
for (const root of moltbotRoots) {
|
|
3281
|
-
scriptCandidates.push(
|
|
3282
|
-
path.join(root, 'moltbot.mjs'),
|
|
3283
|
-
path.join(root, 'bin', 'moltbot.mjs'),
|
|
3284
|
-
path.join(root, 'bin', 'moltbot.js'),
|
|
3285
|
-
path.join(root, 'src', 'moltbot.mjs'),
|
|
3286
|
-
path.join(root, 'src', 'moltbot.js')
|
|
3287
|
-
);
|
|
3288
|
-
}
|
|
3289
|
-
|
|
3290
|
-
for (const candidate of scriptCandidates) {
|
|
3291
|
-
try {
|
|
3292
|
-
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
|
|
3293
|
-
return candidate;
|
|
3294
|
-
}
|
|
3295
|
-
} catch { }
|
|
3296
|
-
}
|
|
3297
|
-
|
|
3298
3283
|
// Fallback: use login shell to find the binary (loads .zshrc/.bashrc PATH)
|
|
3299
3284
|
for (const name of candidates) {
|
|
3300
3285
|
if (process.platform === 'win32') {
|
|
@@ -3361,8 +3346,7 @@ function getCliMeta() {
|
|
|
3361
3346
|
const cliBinary = resolveCliBinary();
|
|
3362
3347
|
const cliName = cliBinary ? path.basename(cliBinary) : '';
|
|
3363
3348
|
const cliLower = cliName.toLowerCase();
|
|
3364
|
-
const
|
|
3365
|
-
const nodeMajor = isMoltbot ? 24 : 22;
|
|
3349
|
+
const nodeMajor = 22;
|
|
3366
3350
|
return { cliBinary, cliName, nodeMajor };
|
|
3367
3351
|
}
|
|
3368
3352
|
|
|
@@ -3875,7 +3859,7 @@ async function tryAutoStartGateway(port, allowAutoDaemon) {
|
|
|
3875
3859
|
if (container.cliPath) dockerCmds.push(`${container.cliPath} gateway`);
|
|
3876
3860
|
dockerCmds.push(`${container.cli} gateway`);
|
|
3877
3861
|
}
|
|
3878
|
-
for (const name of
|
|
3862
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
3879
3863
|
dockerCmds.push(`${name} gateway`);
|
|
3880
3864
|
}
|
|
3881
3865
|
|
|
@@ -3907,7 +3891,7 @@ async function tryAutoStartGateway(port, allowAutoDaemon) {
|
|
|
3907
3891
|
}
|
|
3908
3892
|
} else {
|
|
3909
3893
|
if (daemonResult.reason === 'cli-not-found') {
|
|
3910
|
-
console.log(chalk.red('❌ 未找到 openclaw
|
|
3894
|
+
console.log(chalk.red('❌ 未找到 openclaw 命令,无法自动启动 Gateway'));
|
|
3911
3895
|
} else {
|
|
3912
3896
|
console.log(chalk.red(`❌ 自动启动失败: ${daemonResult.reason}`));
|
|
3913
3897
|
}
|
|
@@ -3951,15 +3935,9 @@ async function tryAutoStartGateway(port, allowAutoDaemon) {
|
|
|
3951
3935
|
const nodeInfo = findCompatibleNode(nodeMajor);
|
|
3952
3936
|
const env = { ...process.env, PATH: extendPathEnv(nodeInfo ? nodeInfo.path : null) };
|
|
3953
3937
|
const useNode = cliBinary && nodeInfo && isNodeShebang(cliBinary);
|
|
3954
|
-
const
|
|
3955
|
-
? (useNode ? `"${nodeInfo.path}" "${cliBinary}" gateway` : `"${cliBinary}" gateway`)
|
|
3956
|
-
: null;
|
|
3957
|
-
|
|
3958
|
-
const candidates = [];
|
|
3959
|
-
if (cliCmd) candidates.push(cliCmd);
|
|
3960
|
-
candidates.push('openclaw gateway', 'clawdbot gateway', 'moltbot gateway');
|
|
3938
|
+
const candidates = buildGatewayCommands(cliBinary, nodeInfo, useNode, 'start');
|
|
3961
3939
|
|
|
3962
|
-
for (const cmd of
|
|
3940
|
+
for (const cmd of candidates) {
|
|
3963
3941
|
console.log(chalk.yellow(`⚠️ 尝试启动 Gateway: ${cmd}`));
|
|
3964
3942
|
if (spawnDetached(cmd, env)) {
|
|
3965
3943
|
if (await waitForGateway(port, '127.0.0.1', 10000)) {
|
|
@@ -3972,8 +3950,8 @@ async function tryAutoStartGateway(port, allowAutoDaemon) {
|
|
|
3972
3950
|
if (process.platform !== 'win32') {
|
|
3973
3951
|
for (const sh of ['/bin/zsh', '/bin/bash']) {
|
|
3974
3952
|
if (!fs.existsSync(sh)) continue;
|
|
3975
|
-
for (const
|
|
3976
|
-
const loginShellCmd =
|
|
3953
|
+
for (const cmd of candidates) {
|
|
3954
|
+
const loginShellCmd = buildLoginShellCommand(sh, cmd);
|
|
3977
3955
|
console.log(chalk.yellow(`⚠️ 尝试启动 Gateway: ${loginShellCmd}`));
|
|
3978
3956
|
if (spawnDetached(loginShellCmd, env)) {
|
|
3979
3957
|
if (await waitForGateway(port, '127.0.0.1', 15000)) {
|
|
@@ -5984,7 +5962,7 @@ async function testConnection(paths, args = {}) {
|
|
|
5984
5962
|
const container = await selectDockerContainer();
|
|
5985
5963
|
if (!container) {
|
|
5986
5964
|
console.log(chalk.red('❌ 未找到包含 OpenClaw/Clawdbot/Moltbot 的 Docker 容器'));
|
|
5987
|
-
console.log(chalk.gray(' 请确保容器正在运行且已安装 openclaw
|
|
5965
|
+
console.log(chalk.gray(' 请确保容器正在运行且已安装 openclaw'));
|
|
5988
5966
|
return;
|
|
5989
5967
|
}
|
|
5990
5968
|
}
|
|
@@ -6024,8 +6002,6 @@ async function testConnection(paths, args = {}) {
|
|
|
6024
6002
|
console.log(chalk.gray(` 然后执行: ${_selectedDockerContainer.cli === 'node' ? `node ${_selectedDockerContainer.cliPath}` : _selectedDockerContainer.cli} gateway`));
|
|
6025
6003
|
} else {
|
|
6026
6004
|
console.log(chalk.gray(' 请在新的终端执行: openclaw gateway'));
|
|
6027
|
-
console.log(chalk.gray(' 或: clawdbot gateway'));
|
|
6028
|
-
console.log(chalk.gray(' 或: moltbot gateway'));
|
|
6029
6005
|
}
|
|
6030
6006
|
return;
|
|
6031
6007
|
}
|
|
@@ -6035,7 +6011,7 @@ async function testConnection(paths, args = {}) {
|
|
|
6035
6011
|
if (!restartOk) {
|
|
6036
6012
|
console.log(chalk.yellow('⚠️ Gateway 未能通过常规方式重启,当前使用的可能是之前的 Gateway 进程'));
|
|
6037
6013
|
console.log(chalk.yellow(' 新配置可能未生效。如 bot 不回复,请手动重启 Gateway:'));
|
|
6038
|
-
console.log(chalk.gray(' openclaw gateway restart
|
|
6014
|
+
console.log(chalk.gray(' openclaw gateway restart'));
|
|
6039
6015
|
}
|
|
6040
6016
|
|
|
6041
6017
|
// 步骤2: 通过 Gateway 端点测试(优先使用 CLI agent)
|
|
@@ -6160,7 +6136,7 @@ async function testConnection(paths, args = {}) {
|
|
|
6160
6136
|
console.log(chalk.gray(`\n 建议操作:`));
|
|
6161
6137
|
console.log(chalk.gray(` 1) 复制最新地址并重新打开浏览器(不要用旧书签)`));
|
|
6162
6138
|
console.log(chalk.cyan(` http://127.0.0.1:${gatewayPort}/#token=${gatewayToken}`));
|
|
6163
|
-
console.log(chalk.gray(` 2) 执行 Gateway 重启:openclaw gateway restart
|
|
6139
|
+
console.log(chalk.gray(` 2) 执行 Gateway 重启:openclaw gateway restart`));
|
|
6164
6140
|
console.log(chalk.gray(` 3) 若仍 401,检查是否存在多个配置目录(.openclaw 与 .clawdbot)`));
|
|
6165
6141
|
}
|
|
6166
6142
|
|
|
@@ -6170,7 +6146,7 @@ async function testConnection(paths, args = {}) {
|
|
|
6170
6146
|
console.log(chalk.gray(` 如遇问题,尝试更新 Gateway: npm install -g openclaw@latest && openclaw gateway restart`));
|
|
6171
6147
|
}
|
|
6172
6148
|
|
|
6173
|
-
console.log(chalk.gray(`\n 提示: 如果 Gateway 未运行,请执行: openclaw gateway
|
|
6149
|
+
console.log(chalk.gray(`\n 提示: 如果 Gateway 未运行,请执行: openclaw gateway`));
|
|
6174
6150
|
}
|
|
6175
6151
|
} catch (error) {
|
|
6176
6152
|
console.log(chalk.red(`❌ 测试失败: ${error.message}`));
|
|
@@ -6214,7 +6190,7 @@ function buildDockerInnerCmds(container, verb) {
|
|
|
6214
6190
|
if (container.cliPath) cmds.push(`${container.cliPath} ${verb}`);
|
|
6215
6191
|
cmds.push(`${container.cli} ${verb}`);
|
|
6216
6192
|
}
|
|
6217
|
-
for (const name of
|
|
6193
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
6218
6194
|
cmds.push(`${name} ${verb}`);
|
|
6219
6195
|
}
|
|
6220
6196
|
return [...new Set(cmds)].filter(Boolean);
|
|
@@ -6247,7 +6223,7 @@ async function restartGatewayDocker(gatewayPort, silent = false) {
|
|
|
6247
6223
|
// 策略 B:杀容器内旧进程 → spawn 启动新 Gateway → 端口探测
|
|
6248
6224
|
if (!silent) console.log(chalk.gray(' Docker 内常规重启未生效,尝试杀进程后重新启动...'));
|
|
6249
6225
|
try {
|
|
6250
|
-
for (const name of
|
|
6226
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
6251
6227
|
safeExec(dockerCmd(`exec ${cid} sh -c "pkill -f '${name}.*gateway' 2>/dev/null || true"`), { timeout: 5000 });
|
|
6252
6228
|
}
|
|
6253
6229
|
safeExec(dockerCmd(`exec ${cid} sh -c "lsof -ti :${gatewayPort} 2>/dev/null | xargs -r kill -9 2>/dev/null || true"`), { timeout: 5000 });
|
|
@@ -6271,7 +6247,7 @@ async function restartGatewayDocker(gatewayPort, silent = false) {
|
|
|
6271
6247
|
async function restartGatewayWsl(gatewayPort, silent = false) {
|
|
6272
6248
|
if (!silent) console.log(chalk.gray(' [检测] Gateway 运行在 WSL 中'));
|
|
6273
6249
|
const wslCli = getWslCliBinary();
|
|
6274
|
-
const names =
|
|
6250
|
+
const names = GATEWAY_CLI_NAMES;
|
|
6275
6251
|
const portWasOpenBefore = await isPortOpen(gatewayPort, '127.0.0.1', 500);
|
|
6276
6252
|
const beforeSignature = portWasOpenBefore ? getGatewayProcessSignature(gatewayPort, 'wsl') : '';
|
|
6277
6253
|
|
|
@@ -6364,13 +6340,11 @@ async function restartGatewayNative(silent = false) {
|
|
|
6364
6340
|
// 策略 C:用 login shell 启动(加载 nvm/fnm 等 PATH)
|
|
6365
6341
|
if (process.platform !== 'win32') {
|
|
6366
6342
|
if (!silent) console.log(chalk.gray(' 尝试通过 login shell 启动...'));
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
if (
|
|
6372
|
-
if (spawnDetached(`${sh} -lc '${name} gateway'`, env)) {
|
|
6373
|
-
launched = true;
|
|
6343
|
+
for (const sh of ['/bin/zsh', '/bin/bash']) {
|
|
6344
|
+
if (!fs.existsSync(sh)) continue;
|
|
6345
|
+
for (const cmd of startCmds) {
|
|
6346
|
+
const loginShellCmd = buildLoginShellCommand(sh, cmd);
|
|
6347
|
+
if (spawnDetached(loginShellCmd, env)) {
|
|
6374
6348
|
if (await waitForGateway(gatewayPort, '127.0.0.1', 10000)) {
|
|
6375
6349
|
if (!silent) console.log(chalk.green('✅ Gateway 已重启 (login shell)'));
|
|
6376
6350
|
return true;
|
|
@@ -6383,10 +6357,8 @@ async function restartGatewayNative(silent = false) {
|
|
|
6383
6357
|
|
|
6384
6358
|
// 全部失败,输出诊断
|
|
6385
6359
|
if (!silent) {
|
|
6386
|
-
console.log(chalk.red(
|
|
6360
|
+
console.log(chalk.red('❌ 重启失败: 找不到 openclaw 命令'));
|
|
6387
6361
|
console.log(chalk.gray(` 请手动运行: openclaw gateway restart`));
|
|
6388
|
-
console.log(chalk.gray(` 或: clawdbot gateway restart`));
|
|
6389
|
-
console.log(chalk.gray(` 或: moltbot gateway restart`));
|
|
6390
6362
|
printGatewayDiagnostics(resolved);
|
|
6391
6363
|
}
|
|
6392
6364
|
return false;
|
|
@@ -6404,7 +6376,7 @@ function buildGatewayCommands(resolved, nodeInfo, useNode, action) {
|
|
|
6404
6376
|
}
|
|
6405
6377
|
}
|
|
6406
6378
|
|
|
6407
|
-
const names =
|
|
6379
|
+
const names = GATEWAY_CLI_NAMES;
|
|
6408
6380
|
for (const name of names) commands.push(`${name} ${verb}`);
|
|
6409
6381
|
|
|
6410
6382
|
return [...new Set(commands)].filter(Boolean);
|
|
@@ -6421,13 +6393,13 @@ async function killGatewayProcesses(gatewayPort = 18789) {
|
|
|
6421
6393
|
}
|
|
6422
6394
|
}
|
|
6423
6395
|
if (isWslAvailable()) {
|
|
6424
|
-
for (const name of
|
|
6396
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
6425
6397
|
safeExec(`wsl -- bash -c "pkill -f '${name}.*gateway' 2>/dev/null || true"`, { timeout: 5000 });
|
|
6426
6398
|
}
|
|
6427
6399
|
safeExec(`wsl -- bash -c "lsof -ti :${gatewayPort} 2>/dev/null | xargs -r kill -9 2>/dev/null || true"`, { timeout: 5000 });
|
|
6428
6400
|
}
|
|
6429
6401
|
} else {
|
|
6430
|
-
for (const name of
|
|
6402
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
6431
6403
|
safeExec(`pkill -f '${name}.*gateway' 2>/dev/null || true`);
|
|
6432
6404
|
}
|
|
6433
6405
|
const lsof = safeExec(`lsof -ti :${gatewayPort} 2>/dev/null`);
|
|
@@ -6444,14 +6416,14 @@ function printGatewayDiagnostics(resolved) {
|
|
|
6444
6416
|
console.log(chalk.gray(`\n [诊断] resolveCliBinary = ${resolved || 'null'}`));
|
|
6445
6417
|
const npmPrefix = safeExec('npm prefix -g');
|
|
6446
6418
|
if (npmPrefix.ok) console.log(chalk.gray(` [诊断] npm prefix -g = ${npmPrefix.output}`));
|
|
6447
|
-
for (const name of
|
|
6419
|
+
for (const name of GATEWAY_CLI_NAMES) {
|
|
6448
6420
|
const which = safeExec(process.platform === 'win32' ? `where ${name} 2>nul` : `/bin/zsh -lc "command -v ${name}" 2>/dev/null || /bin/bash -lc "command -v ${name}" 2>/dev/null`);
|
|
6449
6421
|
if (which.ok && which.output) console.log(chalk.gray(` [诊断] ${name} -> ${which.output.split('\n')[0].trim()}`));
|
|
6450
6422
|
}
|
|
6451
6423
|
if (isDockerAvailable()) {
|
|
6452
6424
|
const dContainers = findOpenclawDockerContainers();
|
|
6453
6425
|
if (dContainers.length > 0) {
|
|
6454
|
-
console.log(chalk.gray(
|
|
6426
|
+
console.log(chalk.gray(' [诊断] Docker 容器 (含 openclaw):'));
|
|
6455
6427
|
for (const c of dContainers) {
|
|
6456
6428
|
console.log(chalk.gray(` - ${c.name} (${c.image}) [${c.cli}: ${c.cliPath}]`));
|
|
6457
6429
|
}
|
|
@@ -6542,7 +6514,7 @@ function testGatewayApi(port, token, model, endpoint = '/v1/chat/completions') {
|
|
|
6542
6514
|
|
|
6543
6515
|
req.on('error', (e) => {
|
|
6544
6516
|
if (e.code === 'ECONNREFUSED') {
|
|
6545
|
-
resolve({ success: false, error: 'Gateway 未运行,请先启动: openclaw gateway
|
|
6517
|
+
resolve({ success: false, error: 'Gateway 未运行,请先启动: openclaw gateway' });
|
|
6546
6518
|
} else {
|
|
6547
6519
|
resolve({ success: false, error: e.message });
|
|
6548
6520
|
}
|
|
@@ -6569,14 +6541,14 @@ function testGatewayViaAgent(model, agentId = '') {
|
|
|
6569
6541
|
const agentCmd = `${wslCli} ${subcommand}`;
|
|
6570
6542
|
cmd = `wsl -- bash -c '${agentCmd.replace(/'/g, "'\\''")}'`;
|
|
6571
6543
|
} else {
|
|
6572
|
-
const agentCmd = `openclaw ${subcommand}
|
|
6544
|
+
const agentCmd = `openclaw ${subcommand}`;
|
|
6573
6545
|
cmd = `wsl -- bash -lc '${agentCmd.replace(/'/g, "'\\''")}'`;
|
|
6574
6546
|
}
|
|
6575
6547
|
execOpts = { timeout: 120000 };
|
|
6576
6548
|
} else {
|
|
6577
6549
|
const { cliBinary, nodeMajor } = getCliMeta();
|
|
6578
6550
|
if (!cliBinary) {
|
|
6579
|
-
resolve({ success: false, usedCli: false, error: '未找到 openclaw
|
|
6551
|
+
resolve({ success: false, usedCli: false, error: '未找到 openclaw 命令' });
|
|
6580
6552
|
return;
|
|
6581
6553
|
}
|
|
6582
6554
|
const nodeInfo = findCompatibleNode(nodeMajor);
|