@aiyiran/myclaw 1.1.72 → 1.1.74
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 +39 -26
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -256,7 +256,7 @@ function runLock42() {
|
|
|
256
256
|
try {
|
|
257
257
|
const ver = execSync('openclaw --version', { encoding: 'utf8' }).trim();
|
|
258
258
|
console.log('[验证] ' + colors.green + ver + colors.nc);
|
|
259
|
-
} catch {}
|
|
259
|
+
} catch { }
|
|
260
260
|
|
|
261
261
|
console.log('');
|
|
262
262
|
console.log(bar);
|
|
@@ -920,7 +920,7 @@ function createDesktopShortcut(url) {
|
|
|
920
920
|
);
|
|
921
921
|
}
|
|
922
922
|
for (const d of candidates) {
|
|
923
|
-
try { if (fs.existsSync(d)) return d; } catch {}
|
|
923
|
+
try { if (fs.existsSync(d)) return d; } catch { }
|
|
924
924
|
}
|
|
925
925
|
return null;
|
|
926
926
|
}
|
|
@@ -954,7 +954,7 @@ URL=${url}
|
|
|
954
954
|
Icon=text-html
|
|
955
955
|
`;
|
|
956
956
|
fs.writeFileSync(desktop, content, 'utf8');
|
|
957
|
-
try { execSync('chmod +x "' + desktop + '"', { stdio: 'pipe' }); } catch {}
|
|
957
|
+
try { execSync('chmod +x "' + desktop + '"', { stdio: 'pipe' }); } catch { }
|
|
958
958
|
console.log('[shortcut] ✅ 桌面快捷方式已更新: OpenClaw.desktop');
|
|
959
959
|
} else if (platform === 'win32') {
|
|
960
960
|
// Windows: .url 文件(Internet Shortcut),Windows 原生支持,双击在默认浏览器打开
|
|
@@ -1505,11 +1505,11 @@ const MACHINE_CONFIG = [
|
|
|
1505
1505
|
{ name: 'Mo靖宇', claw: 'claw4', desc: 'Mo靖宇 的机器' },
|
|
1506
1506
|
{ name: '高兴', claw: 'claw5', desc: '高兴 的机器' },
|
|
1507
1507
|
{ name: '伊伊', claw: 'claw6', desc: '伊伊 的机器' },
|
|
1508
|
-
{ name: '
|
|
1509
|
-
{ name: '
|
|
1508
|
+
{ name: 'Thomas', claw: 'claw7', desc: 'Thomas 的机器' },
|
|
1509
|
+
{ name: 'Eric', claw: 'claw8', desc: 'Eric 的机器' },
|
|
1510
1510
|
{ name: 'Mia', claw: 'claw9', desc: 'Mia 的机器' },
|
|
1511
|
-
{ name: '
|
|
1512
|
-
{ name: '
|
|
1511
|
+
{ name: '雨熙', claw: 'claw10', desc: '雨熙 的机器' },
|
|
1512
|
+
{ name: '绍博', claw: 'claw11', desc: '绍博 的机器' },
|
|
1513
1513
|
];
|
|
1514
1514
|
|
|
1515
1515
|
function openMachine(selected) {
|
|
@@ -1846,7 +1846,7 @@ function runSyncTemplates() {
|
|
|
1846
1846
|
let data = '';
|
|
1847
1847
|
res.on('data', chunk => data += chunk);
|
|
1848
1848
|
res.on('end', () => {
|
|
1849
|
-
try { cb(null, JSON.parse(data)); } catch(e) { cb(e); }
|
|
1849
|
+
try { cb(null, JSON.parse(data)); } catch (e) { cb(e); }
|
|
1850
1850
|
});
|
|
1851
1851
|
}).on('error', cb);
|
|
1852
1852
|
}
|
|
@@ -1975,6 +1975,19 @@ async function runServer(name) {
|
|
|
1975
1975
|
if (oldPid && !isNaN(oldPid)) {
|
|
1976
1976
|
try { process.kill(oldPid, 'SIGTERM'); } catch (e) { /* 不存在则忽略 */ }
|
|
1977
1977
|
console.log('[Server] 已终止旧进程 PID=' + oldPid);
|
|
1978
|
+
// 等待旧进程退出并释放端口(最多 5 秒)
|
|
1979
|
+
await new Promise(resolve => {
|
|
1980
|
+
let waited = 0;
|
|
1981
|
+
const interval = setInterval(() => {
|
|
1982
|
+
try {
|
|
1983
|
+
process.kill(oldPid, 0); // 检查进程是否还存在
|
|
1984
|
+
waited += 200;
|
|
1985
|
+
if (waited >= 5000) { clearInterval(interval); resolve(); }
|
|
1986
|
+
} catch {
|
|
1987
|
+
clearInterval(interval); resolve(); // 进程已退出
|
|
1988
|
+
}
|
|
1989
|
+
}, 200);
|
|
1990
|
+
});
|
|
1978
1991
|
}
|
|
1979
1992
|
} catch (e) { /* 读取失败忽略 */ }
|
|
1980
1993
|
try { fs.unlinkSync(pidFile); } catch (e) { }
|
|
@@ -2085,20 +2098,20 @@ function runDelete() {
|
|
|
2085
2098
|
|
|
2086
2099
|
const isDeep = args.includes('--deep'); // 加 --deep 则自动执行阶段2,不询问
|
|
2087
2100
|
|
|
2088
|
-
const G
|
|
2089
|
-
const Y
|
|
2090
|
-
const R
|
|
2091
|
-
const B
|
|
2092
|
-
const D
|
|
2101
|
+
const G = colors.green;
|
|
2102
|
+
const Y = colors.yellow;
|
|
2103
|
+
const R = colors.red;
|
|
2104
|
+
const B = colors.blue;
|
|
2105
|
+
const D = colors.dim;
|
|
2093
2106
|
const NC = colors.nc;
|
|
2094
2107
|
|
|
2095
2108
|
const BAR = '─'.repeat(52);
|
|
2096
2109
|
|
|
2097
2110
|
function fmtDate(ms) {
|
|
2098
2111
|
if (!ms) return '未知';
|
|
2099
|
-
const d
|
|
2112
|
+
const d = new Date(ms);
|
|
2100
2113
|
const pad = n => String(n).padStart(2, '0');
|
|
2101
|
-
return `${d.getFullYear()}/${pad(d.getMonth()+1)}/${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
2114
|
+
return `${d.getFullYear()}/${pad(d.getMonth() + 1)}/${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
2102
2115
|
}
|
|
2103
2116
|
|
|
2104
2117
|
function fmtStatus(ag) {
|
|
@@ -2113,9 +2126,9 @@ function runDelete() {
|
|
|
2113
2126
|
console.log(D + ' 序号 状态 ID 会话 最后更新' + NC);
|
|
2114
2127
|
console.log(D + ' ─────────────────────────────────────────────────────' + NC);
|
|
2115
2128
|
agents.forEach((ag, i) => {
|
|
2116
|
-
const num
|
|
2117
|
-
const idPad
|
|
2118
|
-
const cnt
|
|
2129
|
+
const num = String(i + 1).padStart(3, ' ');
|
|
2130
|
+
const idPad = ag.id.padEnd(28, ' ').slice(0, 28);
|
|
2131
|
+
const cnt = String(ag.sessionCount).padStart(4, ' ');
|
|
2119
2132
|
const updated = fmtDate(ag.lastUpdated);
|
|
2120
2133
|
console.log(` ${num}. ${fmtStatus(ag)} ${idPad} ${cnt} ${D}${updated}${NC}`);
|
|
2121
2134
|
});
|
|
@@ -2317,20 +2330,20 @@ function runListAgents() {
|
|
|
2317
2330
|
return;
|
|
2318
2331
|
}
|
|
2319
2332
|
|
|
2320
|
-
const G
|
|
2321
|
-
const Y
|
|
2322
|
-
const D
|
|
2333
|
+
const G = colors.green;
|
|
2334
|
+
const Y = colors.yellow;
|
|
2335
|
+
const D = colors.dim;
|
|
2323
2336
|
const NC = colors.nc;
|
|
2324
2337
|
|
|
2325
2338
|
console.log('');
|
|
2326
2339
|
console.log('序号 状态 ID 会话 最后更新');
|
|
2327
2340
|
console.log('─'.repeat(62));
|
|
2328
2341
|
agents.forEach((ag, i) => {
|
|
2329
|
-
const num
|
|
2330
|
-
const idPad
|
|
2331
|
-
const cnt
|
|
2332
|
-
const date
|
|
2333
|
-
const status
|
|
2342
|
+
const num = String(i + 1).padStart(3);
|
|
2343
|
+
const idPad = ag.id.padEnd(28).slice(0, 28);
|
|
2344
|
+
const cnt = String(ag.sessionCount).padStart(4);
|
|
2345
|
+
const date = ag.lastUpdated ? new Date(ag.lastUpdated).toLocaleDateString('zh-CN') : '未知';
|
|
2346
|
+
const status = ag.inJson ? G + '● 已注册' + NC : Y + '○ 孤立 ' + NC;
|
|
2334
2347
|
console.log(`${num}. ${status} ${idPad} ${cnt} ${D}${date}${NC}`);
|
|
2335
2348
|
});
|
|
2336
2349
|
console.log('');
|