@aiyiran/myclaw 1.0.162 → 1.0.163
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/package.json +1 -1
- package/wsl2.js +33 -6
package/package.json
CHANGED
package/wsl2.js
CHANGED
|
@@ -97,10 +97,31 @@ function launchElevatedPS(script) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
function makeAskLocalOrCDN(prompt, destVar, cdnUrl, desc, fileName) {
|
|
100
|
+
function makeAskLocalOrCDN(prompt, destVar, cdnUrl, desc, fileName, forceRemote) {
|
|
101
101
|
const config = getConfig();
|
|
102
102
|
const callerDir = (config.installerDir || process.env.MYCLAW_INSTALLER_DIR || process.cwd()).replace(/\\/g, '\\\\');
|
|
103
103
|
const cdnFilename = cdnUrl.split('/').pop();
|
|
104
|
+
|
|
105
|
+
// --remote 模式:跳过所有本地检测,直接从 CDN 下载
|
|
106
|
+
if (forceRemote) {
|
|
107
|
+
return `
|
|
108
|
+
Write-Host ""
|
|
109
|
+
Write-Host " [强制远程] 跳过本地文件检测,从网络下载..."
|
|
110
|
+
Write-Host ""
|
|
111
|
+
Write-Host ' -------------------------------------------------------------'
|
|
112
|
+
Write-Host ' [提示] 下载中请勿点击窗口内部(会导致卡死)。'
|
|
113
|
+
Write-Host ' [恢复] 若进度条长时间不动,请按一下 [回车键] 即可恢复。'
|
|
114
|
+
Write-Host ' -------------------------------------------------------------'
|
|
115
|
+
try {
|
|
116
|
+
Start-BitsTransfer -Source '${cdnUrl}' -Destination ${destVar} -Description '下载 ${desc}' -DisplayName 'OpenClaw'
|
|
117
|
+
Write-Host ' 下载完成!'
|
|
118
|
+
} catch {
|
|
119
|
+
Write-Host ' [失败] 下载失败,请检查网络后重试'
|
|
120
|
+
throw '下载失败'
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
|
|
104
125
|
return `
|
|
105
126
|
$callerDir = "${callerDir}"
|
|
106
127
|
|
|
@@ -190,7 +211,7 @@ if ($resolved) {
|
|
|
190
211
|
// Phase 1: 启用功能 + 安装 WSL + 下载 Linux 镜像(全部在重启前完成)
|
|
191
212
|
// ============================================================================
|
|
192
213
|
|
|
193
|
-
function runPhase1() {
|
|
214
|
+
function runPhase1(forceRemote) {
|
|
194
215
|
console.log('');
|
|
195
216
|
console.log('[当前进度] WSL 功能 ' + C.y + '[安装/覆盖]' + C.nc);
|
|
196
217
|
console.log(' WSL 组件 ' + C.y + '[安装/重置]' + C.nc);
|
|
@@ -208,7 +229,8 @@ function runPhase1() {
|
|
|
208
229
|
'$msi',
|
|
209
230
|
WSL_CDN.wsl,
|
|
210
231
|
'WSL 安装包 (wsl_full.msi)',
|
|
211
|
-
'wsl_full.msi'
|
|
232
|
+
'wsl_full.msi',
|
|
233
|
+
forceRemote
|
|
212
234
|
);
|
|
213
235
|
|
|
214
236
|
const askTar = makeAskLocalOrCDN(
|
|
@@ -216,7 +238,8 @@ function runPhase1() {
|
|
|
216
238
|
'$tarPath',
|
|
217
239
|
WSL_CDN.rootfs,
|
|
218
240
|
'Linux 环境包 (openclaw-rootfs.tar)',
|
|
219
|
-
'openclaw-rootfs.tar'
|
|
241
|
+
'openclaw-rootfs.tar',
|
|
242
|
+
forceRemote
|
|
220
243
|
);
|
|
221
244
|
|
|
222
245
|
const ps = `
|
|
@@ -327,7 +350,7 @@ Write-Host '========================================'
|
|
|
327
350
|
// Phase 2: 导入已下载的 Linux 环境(重启后,纯本地操作,极快)
|
|
328
351
|
// ============================================================================
|
|
329
352
|
|
|
330
|
-
function runPhase2() {
|
|
353
|
+
function runPhase2(forceRemote) {
|
|
331
354
|
console.log('');
|
|
332
355
|
console.log('[当前进度] WSL 功能 ' + C.g + '[已就绪]' + C.nc);
|
|
333
356
|
console.log(' WSL 组件 ' + C.g + '[已就绪]' + C.nc);
|
|
@@ -374,7 +397,8 @@ if (Test-Path $tarPath) {
|
|
|
374
397
|
'$tarPath',
|
|
375
398
|
WSL_CDN.rootfs,
|
|
376
399
|
'Linux 环境包 (openclaw-rootfs.tar)',
|
|
377
|
-
'openclaw-rootfs.tar'
|
|
400
|
+
'openclaw-rootfs.tar',
|
|
401
|
+
forceRemote
|
|
378
402
|
)}
|
|
379
403
|
}
|
|
380
404
|
Write-Host ''
|
|
@@ -560,6 +584,9 @@ function run() {
|
|
|
560
584
|
setState('phase1-done');
|
|
561
585
|
}
|
|
562
586
|
|
|
587
|
+
// --remote: 强制从 CDN 下载,不信任本地文件
|
|
588
|
+
const forceRemote = process.argv.includes('--remote');
|
|
589
|
+
|
|
563
590
|
const bar = '========================================';
|
|
564
591
|
const state = getState();
|
|
565
592
|
|