@aiyiran/myclaw 1.0.33 → 1.0.36
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/index.js +28 -19
- package/package.json +1 -1
- package/wsl2.js +15 -12
package/index.js
CHANGED
|
@@ -265,7 +265,10 @@ function runWsl2() {
|
|
|
265
265
|
|
|
266
266
|
function runPrepare() {
|
|
267
267
|
const prepare = require('./prepare');
|
|
268
|
-
prepare.run()
|
|
268
|
+
prepare.run().catch((err) => {
|
|
269
|
+
console.error('[错误] ' + err.message);
|
|
270
|
+
process.exit(1);
|
|
271
|
+
});
|
|
269
272
|
}
|
|
270
273
|
|
|
271
274
|
// ============================================================================
|
|
@@ -300,8 +303,13 @@ echo OpenClaw 智能启动器
|
|
|
300
303
|
echo ============================================
|
|
301
304
|
echo.
|
|
302
305
|
|
|
303
|
-
REM ---- Step 1:
|
|
304
|
-
echo [1/
|
|
306
|
+
REM ---- Step 1: 自动更新 MyClaw ----
|
|
307
|
+
echo [1/5] 检查 MyClaw 更新...
|
|
308
|
+
call npm update -g @aiyiran/myclaw >nul 2>&1
|
|
309
|
+
echo [OK]
|
|
310
|
+
|
|
311
|
+
REM ---- Step 2: 检测 WSL 是否可用 ----
|
|
312
|
+
echo [2/5] 检测 WSL 状态...
|
|
305
313
|
wsl --version >nul 2>&1
|
|
306
314
|
if errorlevel 1 (
|
|
307
315
|
echo.
|
|
@@ -320,8 +328,8 @@ if errorlevel 1 (
|
|
|
320
328
|
)
|
|
321
329
|
echo [OK] WSL 已安装
|
|
322
330
|
|
|
323
|
-
REM ---- Step
|
|
324
|
-
echo [
|
|
331
|
+
REM ---- Step 3: 检测 OpenClaw 发行版 ----
|
|
332
|
+
echo [3/5] 检测 OpenClaw Linux 环境...
|
|
325
333
|
wsl -l -q 2>nul | findstr /i "OpenClaw" >nul 2>&1
|
|
326
334
|
if errorlevel 1 (
|
|
327
335
|
echo.
|
|
@@ -337,40 +345,41 @@ if errorlevel 1 (
|
|
|
337
345
|
)
|
|
338
346
|
echo [OK] OpenClaw Linux 环境已就绪
|
|
339
347
|
|
|
340
|
-
REM ---- Step
|
|
341
|
-
echo [
|
|
342
|
-
|
|
348
|
+
REM ---- Step 4: 用 myclaw open 打开浏览器(带 token) ----
|
|
349
|
+
echo [4/5] 打开浏览器(带 Token)...
|
|
350
|
+
call myclaw open
|
|
351
|
+
echo [OK]
|
|
352
|
+
|
|
353
|
+
REM ---- Step 5: 检测并启动 Gateway ----
|
|
354
|
+
echo [5/5] 检测 OpenClaw Gateway...
|
|
355
|
+
netstat -an | findstr "18789" | findstr "LISTENING" >nul 2>&1
|
|
343
356
|
if not errorlevel 1 (
|
|
344
357
|
echo [OK] Gateway 已在运行中
|
|
345
358
|
echo.
|
|
346
|
-
echo [4/4] 打开浏览器...
|
|
347
|
-
start http://127.0.0.1:18789
|
|
348
|
-
echo.
|
|
349
359
|
echo ============================================
|
|
350
360
|
echo OpenClaw 已在运行!浏览器已打开
|
|
351
|
-
echo
|
|
361
|
+
echo 输入 exit 可关闭此窗口
|
|
352
362
|
echo ============================================
|
|
353
363
|
echo.
|
|
354
|
-
|
|
364
|
+
wsl -d OpenClaw
|
|
365
|
+
pause
|
|
355
366
|
exit /b
|
|
356
367
|
)
|
|
357
|
-
echo Gateway 未运行,准备启动...
|
|
358
368
|
|
|
359
|
-
|
|
360
|
-
echo [4/4] 启动 OpenClaw Gateway...
|
|
369
|
+
echo Gateway 未运行,正在启动...
|
|
361
370
|
echo.
|
|
362
371
|
echo ============================================
|
|
363
372
|
echo 正在启动 OpenClaw 服务...
|
|
364
|
-
echo 启动后浏览器会自动打开
|
|
365
373
|
echo 关闭此窗口将停止服务
|
|
366
374
|
echo ============================================
|
|
367
375
|
echo.
|
|
368
|
-
|
|
369
|
-
start http://127.0.0.1:18789
|
|
370
376
|
wsl -d OpenClaw -- openclaw gateway
|
|
377
|
+
echo.
|
|
378
|
+
echo [!] Gateway 已退出
|
|
371
379
|
pause
|
|
372
380
|
`;
|
|
373
381
|
|
|
382
|
+
|
|
374
383
|
// 写入 bat 文件
|
|
375
384
|
fs.writeFileSync(batPath, batContent, 'utf8');
|
|
376
385
|
|
package/package.json
CHANGED
package/wsl2.js
CHANGED
|
@@ -402,9 +402,7 @@ function run() {
|
|
|
402
402
|
console.log('[' + C.b + 'MyClaw' + C.nc + '] WSL2 一键安装向导');
|
|
403
403
|
console.log(bar);
|
|
404
404
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (state === 'ready' && !forceReinstall) {
|
|
405
|
+
if (state === 'ready') {
|
|
408
406
|
console.log('');
|
|
409
407
|
console.log('[' + C.g + 'OK' + C.nc + '] WSL2 已完全安装就绪!');
|
|
410
408
|
console.log('');
|
|
@@ -417,16 +415,21 @@ function run() {
|
|
|
417
415
|
console.log('');
|
|
418
416
|
console.log('输入 ' + C.y + 'wsl' + C.nc + ' 即可进入 Linux 环境。');
|
|
419
417
|
console.log('');
|
|
420
|
-
console.log('如需重新安装 Linux 环境,运行:');
|
|
421
|
-
console.log(' ' + C.y + 'myclaw wsl2 --reinstall' + C.nc);
|
|
422
|
-
console.log('');
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
418
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
419
|
+
// 询问是否重装
|
|
420
|
+
const readline = require('readline');
|
|
421
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
422
|
+
rl.question('是否要重新安装 Linux 环境? (y/N): ', (answer) => {
|
|
423
|
+
rl.close();
|
|
424
|
+
if (answer.trim().toLowerCase() === 'y') {
|
|
425
|
+
console.log('');
|
|
426
|
+
console.log('[' + C.y + '重装模式' + C.nc + '] 将重新导入 Linux 环境...');
|
|
427
|
+
runPhase2();
|
|
428
|
+
} else {
|
|
429
|
+
console.log('');
|
|
430
|
+
console.log('已取消。');
|
|
431
|
+
}
|
|
432
|
+
});
|
|
430
433
|
return;
|
|
431
434
|
}
|
|
432
435
|
|