yymaxapi 1.0.1 → 1.0.2
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 +13 -2
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -2160,9 +2160,9 @@ async function testConnection(paths, args = {}) {
|
|
|
2160
2160
|
|
|
2161
2161
|
// 等待 Gateway 启动
|
|
2162
2162
|
const gwSpinner = ora({ text: '等待 Gateway 启动...', spinner: 'dots' }).start();
|
|
2163
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
2163
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
2164
2164
|
|
|
2165
|
-
let gatewayRunning = await waitForGateway(gatewayPort);
|
|
2165
|
+
let gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 15000);
|
|
2166
2166
|
if (!gatewayRunning) {
|
|
2167
2167
|
gwSpinner.text = '尝试自动启动 Gateway...';
|
|
2168
2168
|
const autoResult = await tryAutoStartGateway(gatewayPort, allowAutoDaemon);
|
|
@@ -2223,6 +2223,17 @@ async function testConnection(paths, args = {}) {
|
|
|
2223
2223
|
}
|
|
2224
2224
|
}
|
|
2225
2225
|
|
|
2226
|
+
// 在 HTTP 测试前重新确认 Gateway 存活(CLI agent 测试可能耗时较长)
|
|
2227
|
+
if (!await isPortOpen(gatewayPort, '127.0.0.1')) {
|
|
2228
|
+
console.log(chalk.yellow('⚠️ Gateway 端口不可达,等待恢复...'));
|
|
2229
|
+
const recovered = await waitForGateway(gatewayPort, '127.0.0.1', 10000);
|
|
2230
|
+
if (!recovered) {
|
|
2231
|
+
console.log(chalk.red('❌ Gateway 在 CLI 测试后不可达,可能已崩溃'));
|
|
2232
|
+
console.log(chalk.gray(' 请检查 Gateway 日志或手动重启: openclaw gateway'));
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2226
2237
|
console.log(chalk.gray(` 端点: http://localhost:${gatewayPort}/v1/responses`));
|
|
2227
2238
|
const startTime = Date.now();
|
|
2228
2239
|
let result = await testGatewayApi(gatewayPort, gatewayToken, primary);
|