@aiyiran/myclaw 1.1.73 → 1.1.75
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 +29 -29
- package/index.js +13 -0
- package/package.json +1 -1
|
@@ -213,20 +213,18 @@
|
|
|
213
213
|
leftGroup.appendChild(titleSpan);
|
|
214
214
|
|
|
215
215
|
var eyeBtn = document.createElement('span');
|
|
216
|
+
eyeBtn.style.cssText = 'cursor:pointer;border-radius:3px;padding:2px 5px;transition:all 0.15s;font-size:11px;font-family:monospace;color:rgba(205,214,244,0.35);';
|
|
216
217
|
var updateEyeUI = function () {
|
|
217
218
|
if (showHiddenArtifacts) {
|
|
218
|
-
eyeBtn.textContent = '
|
|
219
|
-
eyeBtn.style.
|
|
220
|
-
eyeBtn.style.textDecoration = 'none';
|
|
219
|
+
eyeBtn.textContent = '显';
|
|
220
|
+
eyeBtn.style.color = '#ffffff';
|
|
221
221
|
eyeBtn.title = '隐藏内部模板文件';
|
|
222
222
|
} else {
|
|
223
|
-
eyeBtn.textContent = '
|
|
224
|
-
eyeBtn.style.
|
|
225
|
-
eyeBtn.style.textDecoration = 'line-through';
|
|
223
|
+
eyeBtn.textContent = '隐';
|
|
224
|
+
eyeBtn.style.color = 'rgba(205,214,244,0.35)';
|
|
226
225
|
eyeBtn.title = '显示内部模板文件';
|
|
227
226
|
}
|
|
228
227
|
};
|
|
229
|
-
eyeBtn.style.cssText = 'cursor:pointer;border-radius:3px;padding:2px 4px;transition:all 0.15s;font-size:13px;';
|
|
230
228
|
updateEyeUI();
|
|
231
229
|
eyeBtn.onmouseenter = function () { eyeBtn.style.background = 'rgba(255,255,255,0.1)'; };
|
|
232
230
|
eyeBtn.onmouseleave = function () { eyeBtn.style.background = 'none'; };
|
|
@@ -335,16 +333,8 @@
|
|
|
335
333
|
forkPanelBtn.onmouseleave = function () { forkPanelBtn.style.background = 'rgba(255,255,255,0.06)'; };
|
|
336
334
|
forkPanelBtn.onclick = function () { openForkModal(); };
|
|
337
335
|
|
|
338
|
-
var templateFooterBtn = document.createElement('div');
|
|
339
|
-
templateFooterBtn.textContent = '📋 模板';
|
|
340
|
-
templateFooterBtn.style.cssText = footerBtnStyle;
|
|
341
|
-
templateFooterBtn.onmouseenter = function () { templateFooterBtn.style.background = 'rgba(255,255,255,0.14)'; };
|
|
342
|
-
templateFooterBtn.onmouseleave = function () { templateFooterBtn.style.background = 'rgba(255,255,255,0.06)'; };
|
|
343
|
-
templateFooterBtn.onclick = function () { openTemplateModal(); };
|
|
344
|
-
|
|
345
336
|
panelFooter.appendChild(historyFooterBtn);
|
|
346
337
|
panelFooter.appendChild(forkPanelBtn);
|
|
347
|
-
panelFooter.appendChild(templateFooterBtn);
|
|
348
338
|
|
|
349
339
|
panel.appendChild(header);
|
|
350
340
|
panel.appendChild(content);
|
|
@@ -2350,7 +2340,7 @@
|
|
|
2350
2340
|
|
|
2351
2341
|
// 左栏:模板列表
|
|
2352
2342
|
var leftPane = document.createElement('div');
|
|
2353
|
-
leftPane.style.cssText = 'width:
|
|
2343
|
+
leftPane.style.cssText = 'width:190px;flex-shrink:0;overflow-y:auto;border-right:1px solid rgba(255,255,255,0.07);padding:4px;display:flex;flex-direction:column;gap:1px;';
|
|
2354
2344
|
|
|
2355
2345
|
// 右栏:iframe 预览
|
|
2356
2346
|
var rightPane = document.createElement('div');
|
|
@@ -2534,7 +2524,7 @@
|
|
|
2534
2524
|
|
|
2535
2525
|
templates.forEach(function (tpl) {
|
|
2536
2526
|
var row = document.createElement('div');
|
|
2537
|
-
row.style.cssText = 'padding:
|
|
2527
|
+
row.style.cssText = 'padding:3px;border-radius:4px;cursor:pointer;transition:background 0.12s;';
|
|
2538
2528
|
|
|
2539
2529
|
function setActive() {
|
|
2540
2530
|
if (activeRow) activeRow.style.background = 'transparent';
|
|
@@ -2543,9 +2533,14 @@
|
|
|
2543
2533
|
currentTpl = tpl;
|
|
2544
2534
|
setFooterStatus('');
|
|
2545
2535
|
rightHeader.innerHTML = '';
|
|
2536
|
+
rightHeader.style.alignItems = 'center';
|
|
2537
|
+
rightHeader.style.flexDirection = 'row';
|
|
2538
|
+
rightHeader.style.gap = '12px';
|
|
2539
|
+
|
|
2546
2540
|
var infoSpan = document.createElement('span');
|
|
2547
|
-
infoSpan.style.cssText = 'font-size:12px;color:#cdd6f4;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;';
|
|
2541
|
+
infoSpan.style.cssText = 'font-size:12px;color:#cdd6f4;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;';
|
|
2548
2542
|
infoSpan.textContent = tpl['系列'] + tpl['编号'] + ' ' + tpl['名称'];
|
|
2543
|
+
|
|
2549
2544
|
// 新窗口打开按钮
|
|
2550
2545
|
var openNewBtn = document.createElement('button');
|
|
2551
2546
|
openNewBtn.textContent = '↗';
|
|
@@ -2566,23 +2561,20 @@
|
|
|
2566
2561
|
row.onmouseenter = function () { if (row !== activeRow) row.style.background = 'rgba(255,255,255,0.06)'; };
|
|
2567
2562
|
row.onmouseleave = function () { if (row !== activeRow) row.style.background = 'transparent'; };
|
|
2568
2563
|
|
|
2569
|
-
var
|
|
2570
|
-
topRow.style.cssText = 'display:flex;align-items:center;gap:6px;margin-bottom:4px;';
|
|
2571
|
-
var badge = document.createElement('span');
|
|
2564
|
+
var badge = document.createElement('div');
|
|
2572
2565
|
badge.textContent = tpl['系列'] + tpl['编号'];
|
|
2573
|
-
|
|
2574
|
-
|
|
2566
|
+
var _seriesColor = tpl['系列'] === 'A' ? '#4ade80' : tpl['系列'] === 'B' ? '#fb923c' : tpl['系列'] === 'C' ? '#60a5fa' : '#ffffff';
|
|
2567
|
+
badge.style.cssText = 'font-size:13px;font-weight:bold;color:' + _seriesColor + ';letter-spacing:0.5px;margin-bottom:3px;';
|
|
2568
|
+
var nameEl = document.createElement('div');
|
|
2575
2569
|
nameEl.textContent = tpl['名称'];
|
|
2576
|
-
nameEl.style.cssText = 'font-size:
|
|
2577
|
-
topRow.appendChild(badge);
|
|
2578
|
-
topRow.appendChild(nameEl);
|
|
2570
|
+
nameEl.style.cssText = 'font-size:11px;color:rgba(205,214,244,0.8);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;';
|
|
2579
2571
|
|
|
2580
2572
|
var descEl = document.createElement('div');
|
|
2581
2573
|
descEl.textContent = tpl['一句话说明'];
|
|
2582
|
-
descEl.style.cssText = 'font-size:
|
|
2574
|
+
descEl.style.cssText = 'font-size:10px;color:rgba(205,214,244,0.45);line-height:1.3;margin-top:1px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;';
|
|
2583
2575
|
|
|
2584
2576
|
var tagsEl = document.createElement('div');
|
|
2585
|
-
tagsEl.style.cssText = 'display:flex;gap:
|
|
2577
|
+
tagsEl.style.cssText = 'display:flex;gap:3px;margin-top:3px;flex-wrap:wrap;';
|
|
2586
2578
|
[tpl['主能力标签'], tpl['任务类型标签']].filter(Boolean).forEach(function (tag) {
|
|
2587
2579
|
var tagEl = document.createElement('span');
|
|
2588
2580
|
tagEl.textContent = tag;
|
|
@@ -2590,7 +2582,8 @@
|
|
|
2590
2582
|
tagsEl.appendChild(tagEl);
|
|
2591
2583
|
});
|
|
2592
2584
|
|
|
2593
|
-
row.appendChild(
|
|
2585
|
+
row.appendChild(badge);
|
|
2586
|
+
row.appendChild(nameEl);
|
|
2594
2587
|
row.appendChild(descEl);
|
|
2595
2588
|
row.appendChild(tagsEl);
|
|
2596
2589
|
leftPane.appendChild(row);
|
|
@@ -2737,6 +2730,13 @@
|
|
|
2737
2730
|
function init() {
|
|
2738
2731
|
injectStyles();
|
|
2739
2732
|
createArtifactsButton();
|
|
2733
|
+
var templateFloatBtn = document.createElement('div');
|
|
2734
|
+
templateFloatBtn.textContent = '📋 模板';
|
|
2735
|
+
templateFloatBtn.style.cssText = 'position:fixed;right:0;bottom:100px;z-index:99999;cursor:pointer;padding:3px;border-radius:4px 0 0 4px;font-size:12px;font-family:monospace;color:#cdd6f4;background:rgba(37,37,54,0.92);border:1px solid #3d3d5c;border-right:none;text-align:center;transition:background 0.15s;';
|
|
2736
|
+
templateFloatBtn.onmouseenter = function () { templateFloatBtn.style.background = 'rgba(255,255,255,0.14)'; };
|
|
2737
|
+
templateFloatBtn.onmouseleave = function () { templateFloatBtn.style.background = 'rgba(37,37,54,0.92)'; };
|
|
2738
|
+
templateFloatBtn.onclick = function () { openTemplateModal(); };
|
|
2739
|
+
document.body.appendChild(templateFloatBtn);
|
|
2740
2740
|
// 本地环境:启动时获取一次 clawName 并缓存,轮询期间复用
|
|
2741
2741
|
resolveClawName();
|
|
2742
2742
|
startPolling();
|
package/index.js
CHANGED
|
@@ -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) { }
|