yymaxapi 1.0.29 → 1.0.32

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.
Files changed (2) hide show
  1. package/bin/yymaxapi.js +21 -3
  2. package/package.json +1 -1
package/bin/yymaxapi.js CHANGED
@@ -979,7 +979,7 @@ function detectGatewayEnv(port = 18789) {
979
979
  }
980
980
  }
981
981
  } catch { }
982
- // Fallback: Windows 没有原生 OpenClaw CLI,但 WSL 里有 判定为 WSL
982
+ // Fallback: Windows 没有原生 OpenClaw CLI 检查 WSL / Docker
983
983
  const nativeCli = resolveCliBinary();
984
984
  if (!nativeCli) {
985
985
  const wslCli = getWslCliBinary();
@@ -993,6 +993,12 @@ function detectGatewayEnv(port = 18789) {
993
993
  _gwEnvCache = 'docker';
994
994
  return 'docker';
995
995
  }
996
+ // Windows 没有原生 CLI,WSL 可用但未找到具体 CLI 路径
997
+ // 仍然判定为 WSL(Gateway 大概率在 WSL 里,CLI 可能不在 bash -l 的 PATH 中)
998
+ if (isWslAvailable()) {
999
+ _gwEnvCache = 'wsl';
1000
+ return 'wsl';
1001
+ }
996
1002
  }
997
1003
  _gwEnvCache = 'native';
998
1004
  return 'native';
@@ -2903,9 +2909,21 @@ async function testConnection(paths, args = {}) {
2903
2909
 
2904
2910
  // 等待 Gateway 启动
2905
2911
  const gwSpinner = ora({ text: '等待 Gateway 启动...', spinner: 'dots' }).start();
2906
- await new Promise(resolve => setTimeout(resolve, 3000));
2907
2912
 
2908
- let gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 15000);
2913
+ let gatewayRunning = false;
2914
+
2915
+ if (restartOk) {
2916
+ // restartGateway 内部已经验证过端口可达,只需短暂确认
2917
+ await new Promise(resolve => setTimeout(resolve, 1000));
2918
+ gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 5000);
2919
+ }
2920
+
2921
+ if (!gatewayRunning) {
2922
+ // restart 失败或未就绪,先等待更长时间(macOS LaunchAgent 启动较慢)
2923
+ await new Promise(resolve => setTimeout(resolve, 3000));
2924
+ gatewayRunning = await waitForGateway(gatewayPort, '127.0.0.1', 20000);
2925
+ }
2926
+
2909
2927
  if (!gatewayRunning) {
2910
2928
  gwSpinner.text = '尝试自动启动 Gateway...';
2911
2929
  const autoResult = await tryAutoStartGateway(gatewayPort, allowAutoDaemon);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yymaxapi",
3
- "version": "1.0.29",
3
+ "version": "1.0.32",
4
4
  "description": "跨平台 OpenClaw/Clawdbot 配置管理工具 - 管理中转地址、模型切换、API Keys、测速优化",
5
5
  "main": "bin/yymaxapi.js",
6
6
  "bin": {