yymaxapi 1.0.1 → 1.0.3
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 +26 -2
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -436,6 +436,19 @@ function getConfigPath() {
|
|
|
436
436
|
candidates.push(...openclawCandidates, ...moltbotCandidates);
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
// Fallback: 当前用户非 root 时,也检查 /root 下的配置(OpenClaw 常以 root 安装)
|
|
440
|
+
if (process.platform !== 'win32' && homeDir !== '/root') {
|
|
441
|
+
const rootOpenclawDir = '/root/.openclaw';
|
|
442
|
+
const rootClawdbotDir = '/root/.clawdbot';
|
|
443
|
+
candidates.push(
|
|
444
|
+
path.join(rootOpenclawDir, 'openclaw.json'),
|
|
445
|
+
path.join(rootOpenclawDir, 'moltbot.json'),
|
|
446
|
+
path.join(rootClawdbotDir, 'openclaw.json'),
|
|
447
|
+
path.join(rootClawdbotDir, 'clawdbot.json'),
|
|
448
|
+
path.join(rootClawdbotDir, 'moltbot.json')
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
439
452
|
const defaultConfig = preferMoltbot
|
|
440
453
|
? path.join(moltbotPrimaryDir, 'moltbot.json')
|
|
441
454
|
: path.join(openclawStateDir, 'openclaw.json');
|
|
@@ -2160,9 +2173,9 @@ async function testConnection(paths, args = {}) {
|
|
|
2160
2173
|
|
|
2161
2174
|
// 等待 Gateway 启动
|
|
2162
2175
|
const gwSpinner = ora({ text: '等待 Gateway 启动...', spinner: 'dots' }).start();
|
|
2163
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
2176
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
2164
2177
|
|
|
2165
|
-
let gatewayRunning = await waitForGateway(gatewayPort);
|
|
2178
|
+
let gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 15000);
|
|
2166
2179
|
if (!gatewayRunning) {
|
|
2167
2180
|
gwSpinner.text = '尝试自动启动 Gateway...';
|
|
2168
2181
|
const autoResult = await tryAutoStartGateway(gatewayPort, allowAutoDaemon);
|
|
@@ -2223,6 +2236,17 @@ async function testConnection(paths, args = {}) {
|
|
|
2223
2236
|
}
|
|
2224
2237
|
}
|
|
2225
2238
|
|
|
2239
|
+
// 在 HTTP 测试前重新确认 Gateway 存活(CLI agent 测试可能耗时较长)
|
|
2240
|
+
if (!await isPortOpen(gatewayPort, '127.0.0.1')) {
|
|
2241
|
+
console.log(chalk.yellow('⚠️ Gateway 端口不可达,等待恢复...'));
|
|
2242
|
+
const recovered = await waitForGateway(gatewayPort, '127.0.0.1', 10000);
|
|
2243
|
+
if (!recovered) {
|
|
2244
|
+
console.log(chalk.red('❌ Gateway 在 CLI 测试后不可达,可能已崩溃'));
|
|
2245
|
+
console.log(chalk.gray(' 请检查 Gateway 日志或手动重启: openclaw gateway'));
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2226
2250
|
console.log(chalk.gray(` 端点: http://localhost:${gatewayPort}/v1/responses`));
|
|
2227
2251
|
const startTime = Date.now();
|
|
2228
2252
|
let result = await testGatewayApi(gatewayPort, gatewayToken, primary);
|