@aiyiran/myclaw 1.0.257 → 1.0.259
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/assets/myclaw-artifacts.js +35 -21
- package/assets/myclaw-inject.js +43 -0
- package/index.js +71 -3
- package/package.json +1 -1
- package/patches/patch-manifest.json +1 -1
|
@@ -375,6 +375,7 @@
|
|
|
375
375
|
'flex-shrink: 0',
|
|
376
376
|
].join(';');
|
|
377
377
|
tableHeader.innerHTML = [
|
|
378
|
+
'<span style="flex-shrink:0;width:44px;"></span>',
|
|
378
379
|
'<span style="flex-shrink:0;width:70px;">更新时间</span>',
|
|
379
380
|
'<span style="flex:1;">文件名</span>',
|
|
380
381
|
].join('');
|
|
@@ -439,6 +440,39 @@
|
|
|
439
440
|
}
|
|
440
441
|
}
|
|
441
442
|
|
|
443
|
+
// 复制相对路径按钮(最左侧)
|
|
444
|
+
var copyPathBtn = document.createElement('button');
|
|
445
|
+
copyPathBtn.textContent = '复制';
|
|
446
|
+
copyPathBtn.style.cssText = [
|
|
447
|
+
'flex-shrink: 0',
|
|
448
|
+
'width: 44px',
|
|
449
|
+
'height: 28px',
|
|
450
|
+
'background: #2d2d4a',
|
|
451
|
+
'color: #a78bfa',
|
|
452
|
+
'border: 1px solid #4a4a7a',
|
|
453
|
+
'border-radius: 4px',
|
|
454
|
+
'font-size: 11px',
|
|
455
|
+
'font-family: monospace',
|
|
456
|
+
'cursor: pointer',
|
|
457
|
+
'transition: background 0.15s, color 0.15s',
|
|
458
|
+
].join(';');
|
|
459
|
+
copyPathBtn.onmouseenter = function () { copyPathBtn.style.background = '#3d3d6a'; };
|
|
460
|
+
copyPathBtn.onmouseleave = function () { copyPathBtn.style.background = '#2d2d4a'; };
|
|
461
|
+
copyPathBtn.onclick = function (e) {
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
var relativePath = getWorkspaceId() + '/' + (asset.path || '');
|
|
464
|
+
navigator.clipboard.writeText(relativePath).then(function () {
|
|
465
|
+
copyPathBtn.textContent = '✓';
|
|
466
|
+
copyPathBtn.style.color = '#10b981';
|
|
467
|
+
copyPathBtn.style.borderColor = '#10b981';
|
|
468
|
+
setTimeout(function () {
|
|
469
|
+
copyPathBtn.textContent = '复制';
|
|
470
|
+
copyPathBtn.style.color = '#a78bfa';
|
|
471
|
+
copyPathBtn.style.borderColor = '#4a4a7a';
|
|
472
|
+
}, 1500);
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
|
|
442
476
|
// 文件名(从 path 提取)+ 标记
|
|
443
477
|
var fname = document.createElement('span');
|
|
444
478
|
fname.style.cssText = 'flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;gap:6px;';
|
|
@@ -457,29 +491,9 @@
|
|
|
457
491
|
badge.textContent = '[有更新]';
|
|
458
492
|
fname.appendChild(badge);
|
|
459
493
|
}
|
|
460
|
-
|
|
461
|
-
// 复制相对路径按钮
|
|
462
|
-
var copyPathBtn = document.createElement('span');
|
|
463
|
-
copyPathBtn.textContent = '[复制]';
|
|
464
|
-
copyPathBtn.style.cssText = 'color:#6c6caa;font-size:10px;font-weight:bold;flex-shrink:0;cursor:pointer;transition:color 0.15s;';
|
|
465
|
-
copyPathBtn.onmouseenter = function () { copyPathBtn.style.color = '#a78bfa'; };
|
|
466
|
-
copyPathBtn.onmouseleave = function () { copyPathBtn.style.color = '#6c6caa'; };
|
|
467
|
-
copyPathBtn.onclick = function (e) {
|
|
468
|
-
e.stopPropagation();
|
|
469
|
-
var relativePath = getWorkspaceId() + '/' + (asset.path || '');
|
|
470
|
-
navigator.clipboard.writeText(relativePath).then(function () {
|
|
471
|
-
copyPathBtn.textContent = '[已复制]';
|
|
472
|
-
copyPathBtn.style.color = '#10b981';
|
|
473
|
-
setTimeout(function () {
|
|
474
|
-
copyPathBtn.textContent = '[复制]';
|
|
475
|
-
copyPathBtn.style.color = '#6c6caa';
|
|
476
|
-
}, 1500);
|
|
477
|
-
});
|
|
478
|
-
};
|
|
479
|
-
fname.appendChild(copyPathBtn);
|
|
480
|
-
|
|
481
494
|
fname.appendChild(nameSpan);
|
|
482
495
|
|
|
496
|
+
row.appendChild(copyPathBtn);
|
|
483
497
|
row.appendChild(time);
|
|
484
498
|
row.appendChild(fname);
|
|
485
499
|
container.appendChild(row);
|
package/assets/myclaw-inject.js
CHANGED
|
@@ -1042,6 +1042,49 @@ btn.addEventListener("click", function () {
|
|
|
1042
1042
|
|
|
1043
1043
|
form.appendChild(delRow);
|
|
1044
1044
|
|
|
1045
|
+
// ── 锁定版本 4.2 按钮 ──
|
|
1046
|
+
var lockRow = document.createElement("div");
|
|
1047
|
+
lockRow.style.cssText = [
|
|
1048
|
+
"padding:10px 14px",
|
|
1049
|
+
"background:#252536",
|
|
1050
|
+
"border-radius:6px",
|
|
1051
|
+
"cursor:pointer",
|
|
1052
|
+
"transition:background 0.15s",
|
|
1053
|
+
"display:flex",
|
|
1054
|
+
"align-items:center",
|
|
1055
|
+
"gap:10px",
|
|
1056
|
+
].join(";");
|
|
1057
|
+
lockRow.onmouseenter = function () { lockRow.style.background = "#2f2f4a"; };
|
|
1058
|
+
lockRow.onmouseleave = function () { lockRow.style.background = "#252536"; };
|
|
1059
|
+
|
|
1060
|
+
var lockBar = document.createElement("div");
|
|
1061
|
+
lockBar.style.cssText = "width:3px;height:28px;border-radius:2px;background:#f59e0b;flex-shrink:0;";
|
|
1062
|
+
lockRow.appendChild(lockBar);
|
|
1063
|
+
|
|
1064
|
+
var lockInfo = document.createElement("div");
|
|
1065
|
+
lockInfo.style.cssText = "flex:1;display:flex;flex-direction:column;gap:2px;";
|
|
1066
|
+
|
|
1067
|
+
var lockName = document.createElement("div");
|
|
1068
|
+
lockName.textContent = "\uD83D\uDD12 \u9501\u5B9A\u7248\u672C 4.2";
|
|
1069
|
+
lockName.style.cssText = "font-size:13px;font-weight:bold;color:#f59e0b;";
|
|
1070
|
+
lockInfo.appendChild(lockName);
|
|
1071
|
+
|
|
1072
|
+
var lockDesc = document.createElement("div");
|
|
1073
|
+
lockDesc.textContent = "\u5207\u6362\u5230\u7A33\u5B9A\u7248\u672C openclaw@2026.4.2";
|
|
1074
|
+
lockDesc.style.cssText = "font-size:11px;color:#888;";
|
|
1075
|
+
lockInfo.appendChild(lockDesc);
|
|
1076
|
+
|
|
1077
|
+
lockRow.appendChild(lockInfo);
|
|
1078
|
+
|
|
1079
|
+
var lockArrow = document.createElement("div");
|
|
1080
|
+
lockArrow.textContent = "\u25B6";
|
|
1081
|
+
lockArrow.style.cssText = "color:#555;font-size:10px;";
|
|
1082
|
+
lockRow.appendChild(lockArrow);
|
|
1083
|
+
|
|
1084
|
+
lockRow.onclick = function () { runCommand("mc lock4.2"); };
|
|
1085
|
+
|
|
1086
|
+
form.appendChild(lockRow);
|
|
1087
|
+
|
|
1045
1088
|
// 删除伙伴 - 双重确认弹框
|
|
1046
1089
|
function showDeleteConfirm() {
|
|
1047
1090
|
var mask = document.createElement("div");
|
package/index.js
CHANGED
|
@@ -206,6 +206,65 @@ function runReinstall() {
|
|
|
206
206
|
console.log('');
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
// ============================================================================
|
|
210
|
+
// Lock 4.2 — 卸载 openclaw 并锁定安装 2026.4.2
|
|
211
|
+
// ============================================================================
|
|
212
|
+
|
|
213
|
+
function runLock42() {
|
|
214
|
+
const bar = '────────────────────────────────────────';
|
|
215
|
+
const TARGET = '2026.4.2';
|
|
216
|
+
|
|
217
|
+
console.log('');
|
|
218
|
+
console.log(bar);
|
|
219
|
+
console.log(' 🔒 OpenClaw 版本锁定工具 (目标版本: ' + colors.green + TARGET + colors.nc + ')');
|
|
220
|
+
console.log(bar);
|
|
221
|
+
console.log('');
|
|
222
|
+
|
|
223
|
+
// 1. 设置中国镜像
|
|
224
|
+
console.log('[1/3] 🌐 设置 npm 中国镜像...');
|
|
225
|
+
try {
|
|
226
|
+
execSync('npm config set registry https://registry.npmmirror.com', { stdio: 'inherit' });
|
|
227
|
+
const registry = execSync('npm config get registry', { encoding: 'utf8' }).trim();
|
|
228
|
+
console.log(' ' + colors.green + '✓ ' + registry + colors.nc);
|
|
229
|
+
} catch (err) {
|
|
230
|
+
console.log(' ' + colors.yellow + '⚠ 镜像设置跳过' + colors.nc);
|
|
231
|
+
}
|
|
232
|
+
console.log('');
|
|
233
|
+
|
|
234
|
+
// 2. 卸载
|
|
235
|
+
console.log('[2/3] 🗑️ 卸载当前 openclaw...');
|
|
236
|
+
try {
|
|
237
|
+
execSync('npm uninstall -g openclaw', { stdio: 'inherit' });
|
|
238
|
+
console.log(' ' + colors.green + '✓ 卸载完成' + colors.nc);
|
|
239
|
+
} catch (err) {
|
|
240
|
+
console.log(' ' + colors.yellow + '⚠ 卸载跳过(可能未安装)' + colors.nc);
|
|
241
|
+
}
|
|
242
|
+
console.log('');
|
|
243
|
+
|
|
244
|
+
// 3. 安装指定版本
|
|
245
|
+
console.log('[3/3] 📦 安装 openclaw@' + TARGET + '...');
|
|
246
|
+
try {
|
|
247
|
+
execSync('npm install -g openclaw@' + TARGET, { stdio: 'inherit' });
|
|
248
|
+
console.log(' ' + colors.green + '✓ 安装完成' + colors.nc);
|
|
249
|
+
} catch (err) {
|
|
250
|
+
console.error(' ' + colors.red + '✗ 安装失败: ' + err.message + colors.nc);
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
console.log('');
|
|
254
|
+
|
|
255
|
+
// 验证版本
|
|
256
|
+
try {
|
|
257
|
+
const ver = execSync('openclaw --version', { encoding: 'utf8' }).trim();
|
|
258
|
+
console.log('[验证] ' + colors.green + ver + colors.nc);
|
|
259
|
+
} catch {}
|
|
260
|
+
|
|
261
|
+
console.log('');
|
|
262
|
+
console.log(bar);
|
|
263
|
+
console.log(colors.green + ' ✅ 已锁定到 openclaw@' + TARGET + colors.nc);
|
|
264
|
+
console.log(bar);
|
|
265
|
+
console.log('');
|
|
266
|
+
}
|
|
267
|
+
|
|
209
268
|
// ============================================================================
|
|
210
269
|
// 状态命令
|
|
211
270
|
// ============================================================================
|
|
@@ -1261,10 +1320,17 @@ function showMachineMenu() {
|
|
|
1261
1320
|
const selected = MACHINE_CONFIG[choice - 1];
|
|
1262
1321
|
console.log('');
|
|
1263
1322
|
console.log(colors.green + ' → 已选择: ' + selected.name + ' (' + selected.claw + ')' + colors.nc);
|
|
1264
|
-
console.log(' ' + colors.dim + '→
|
|
1265
|
-
const {
|
|
1323
|
+
console.log(' ' + colors.dim + '→ 正在打开浏览器...' + colors.nc);
|
|
1324
|
+
const { exec } = require('child_process');
|
|
1266
1325
|
const machineUrl = 'https://' + selected.claw + '.kekouen.cn?token=aiyiran';
|
|
1267
|
-
|
|
1326
|
+
const platform = os.platform();
|
|
1327
|
+
if (platform === 'darwin') {
|
|
1328
|
+
exec('open -a "Google Chrome" "' + machineUrl + '"');
|
|
1329
|
+
} else if (platform === 'win32') {
|
|
1330
|
+
exec('start "" "' + machineUrl + '"', { shell: true });
|
|
1331
|
+
} else {
|
|
1332
|
+
exec('xdg-open "' + machineUrl + '"');
|
|
1333
|
+
}
|
|
1268
1334
|
createDesktopShortcut(machineUrl);
|
|
1269
1335
|
} else {
|
|
1270
1336
|
console.log('[' + colors.red + '错误' + colors.nc + '] 无效选择');
|
|
@@ -1858,6 +1924,8 @@ if (!command) {
|
|
|
1858
1924
|
console.log('🔄 正在重启 Gateway 使配置生效...');
|
|
1859
1925
|
console.log('');
|
|
1860
1926
|
runRestart();
|
|
1927
|
+
} else if (command === 'lock4.2') {
|
|
1928
|
+
runLock42();
|
|
1861
1929
|
} else if (command === 'server') {
|
|
1862
1930
|
runServer(args[1]); // args[1] 是可选的 name
|
|
1863
1931
|
} else if (command === 'sync') {
|
package/package.json
CHANGED