yymaxapi 1.0.19 → 1.0.20
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 +28 -0
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -490,6 +490,34 @@ function getConfigPath() {
|
|
|
490
490
|
);
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
+
// Windows + WSL: 尝试读取 WSL 内的配置文件
|
|
494
|
+
if (process.platform === 'win32' && isWslAvailable()) {
|
|
495
|
+
try {
|
|
496
|
+
const wslHome = getWslHome() || '/root';
|
|
497
|
+
const wslPaths = [
|
|
498
|
+
`${wslHome}/.openclaw/openclaw.json`,
|
|
499
|
+
`${wslHome}/.openclaw/moltbot.json`,
|
|
500
|
+
`${wslHome}/.clawdbot/openclaw.json`,
|
|
501
|
+
'/root/.openclaw/openclaw.json',
|
|
502
|
+
'/root/.openclaw/moltbot.json',
|
|
503
|
+
];
|
|
504
|
+
for (const wp of wslPaths) {
|
|
505
|
+
const check = safeExec(`wsl -- bash -c "test -f '${wp}' && echo yes"`, { timeout: 5000 });
|
|
506
|
+
if (check.ok && check.output.trim() === 'yes') {
|
|
507
|
+
// 将 WSL 配置复制到 Windows 侧,保持同步
|
|
508
|
+
const winDest = path.join(openclawStateDir, path.basename(wp));
|
|
509
|
+
try {
|
|
510
|
+
const content = execFileSync('wsl', ['bash', '-c', `cat '${wp}'`], { encoding: 'utf8', timeout: 10000 });
|
|
511
|
+
if (!fs.existsSync(openclawStateDir)) fs.mkdirSync(openclawStateDir, { recursive: true });
|
|
512
|
+
fs.writeFileSync(winDest, content, 'utf8');
|
|
513
|
+
if (!candidates.includes(winDest)) candidates.unshift(winDest);
|
|
514
|
+
} catch {}
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
} catch {}
|
|
519
|
+
}
|
|
520
|
+
|
|
493
521
|
const defaultConfig = preferMoltbot
|
|
494
522
|
? path.join(moltbotPrimaryDir, 'moltbot.json')
|
|
495
523
|
: path.join(openclawStateDir, 'openclaw.json');
|