@aiyiran/myclaw 1.1.74 → 1.1.76

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.
@@ -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.opacity = '1';
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.opacity = '0.5';
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:240px;flex-shrink:0;overflow-y:auto;border-right:1px solid rgba(255,255,255,0.07);padding:8px;display:flex;flex-direction:column;gap:2px;';
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:10px;border-radius:5px;cursor:pointer;transition:background 0.12s;';
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 topRow = document.createElement('div');
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
- badge.style.cssText = 'font-size:10px;font-weight:bold;background:#4a4a7a;color:#cdd6f4;padding:1px 7px;border-radius:8px;flex-shrink:0;';
2574
- var nameEl = document.createElement('span');
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:12px;color:#cdd6f4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;';
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:11px;color:rgba(205,214,244,0.5);line-height:1.4;margin-top:2px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;';
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:4px;margin-top:5px;flex-wrap:wrap;';
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(topRow);
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();
@@ -1380,8 +1380,24 @@ btn.addEventListener("click", function () {
1380
1380
  var form = document.createElement("div");
1381
1381
  form.style.cssText = "padding: 16px 20px;display:flex;flex-direction:column;gap:10px;color:#cdd6f4;font-family:monospace;font-size:13px;";
1382
1382
 
1383
+ // 从 URL 解析当前页面的伙伴名
1384
+ function getCurrentAgentName() {
1385
+ var params = new URLSearchParams(window.location.search);
1386
+ var session = params.get('session');
1387
+ if (session) {
1388
+ var decoded = decodeURIComponent(session);
1389
+ if (decoded.indexOf('agent:') === 0) {
1390
+ var parts = decoded.split(':');
1391
+ if (parts.length >= 2) return parts[1];
1392
+ }
1393
+ }
1394
+ var agent = params.get('agent');
1395
+ if (agent) return agent;
1396
+ return '';
1397
+ }
1398
+
1383
1399
  // 弹出 input 小弹框
1384
- function promptAndRun(title, placeholder, hint, cmdTemplate, btnColor) {
1400
+ function promptAndRun(title, placeholder, hint, cmdTemplate, btnColor, defaultValue) {
1385
1401
  var mask = document.createElement("div");
1386
1402
  mask.style.cssText = [
1387
1403
  "position:fixed",
@@ -1427,6 +1443,7 @@ btn.addEventListener("click", function () {
1427
1443
  var input = document.createElement("input");
1428
1444
  input.type = "text";
1429
1445
  input.placeholder = placeholder;
1446
+ input.value = defaultValue || '';
1430
1447
  input.style.cssText = "padding:8px 10px;background:#252536;border:1px solid #3d3d5c;border-radius:4px;color:#cdd6f4;font-size:13px;font-family:monospace;outline:none;";
1431
1448
  input.onfocus = function () { input.style.borderColor = btnColor; };
1432
1449
  input.onblur = function () { input.style.borderColor = "#3d3d5c"; };
@@ -1472,7 +1489,7 @@ btn.addEventListener("click", function () {
1472
1489
  // ── 按钮列表 ──
1473
1490
  var btns = [
1474
1491
  { label: "\uD83E\uDD1D \u65B0\u4F19\u4F34", desc: "\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684 AI \u4F19\u4F34", hasInput: true, inputTitle: "\u65B0\u5EFA\u4F19\u4F34", placeholder: "\u8F93\u5165\u65B0\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 my-cat", hint: "\u7ED9\u4F60\u7684\u65B0 AI \u4F19\u4F34\u8D77\u4E2A\u540D\u5B57\uFF08\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u81EA\u52A8\u521B\u5EFA", cmd: "mc new {name}", color: "#3b82f6" },
1475
- { label: "\uD83D\uDCAC \u6DFB\u52A0\u5BF9\u8BDD", desc: "\u6253\u5F00\u5DF2\u6709\u4F19\u4F34\u7684\u5BF9\u8BDD\u7A97\u53E3", hasInput: true, inputTitle: "\u6DFB\u52A0\u5BF9\u8BDD", placeholder: "\u8F93\u5165\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 kakaxi", hint: "\u8F93\u5165\u4F60\u7684\u4F19\u4F34\u7684\u540D\u79F0\uFF08\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u6253\u5F00\u5BF9\u8BDD\u7A97\u53E3", cmd: "mc tui {name}", color: "#10b981" },
1492
+ { label: "\uD83D\uDCAC \u6DFB\u52A0\u5BF9\u8BDD", desc: "\u6253\u5F00\u5DF2\u6709\u4F19\u4F34\u7684\u5BF9\u8BDD\u7A97\u53E3", hasInput: true, inputTitle: "\u6DFB\u52A0\u5BF9\u8BDD", placeholder: "\u8F93\u5165\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 kakaxi", hint: "\u8F93\u5165\u4F60\u7684\u4F19\u4F34\u7684\u540D\u79F0\uFF08\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u6253\u5F00\u5BF9\u8BDD\u7A97\u53E3", cmd: "mc tui {name}", color: "#10b981", getDefault: getCurrentAgentName },
1476
1493
  { label: "\uD83D\uDD04 \u91CD\u542F\u670D\u52A1", desc: "\u91CD\u542F\u6587\u4EF6\u670D\u52A1", hasInput: false, cmd: "mc server", color: "#ef4444" },
1477
1494
  { label: "\uD83E\uDD9E \u91CD\u542F\u9F99\u867E", desc: "\u91CD\u542F OpenClaw \u6838\u5FC3\u670D\u52A1", hasInput: false, cmd: "mc all", color: "#f59e0b" },
1478
1495
  ];
@@ -1520,7 +1537,7 @@ btn.addEventListener("click", function () {
1520
1537
 
1521
1538
  row.onclick = function () {
1522
1539
  if (item.hasInput) {
1523
- promptAndRun(item.inputTitle, item.placeholder, item.hint, item.cmd, item.color);
1540
+ promptAndRun(item.inputTitle, item.placeholder, item.hint, item.cmd, item.color, item.getDefault ? item.getDefault() : '');
1524
1541
  } else {
1525
1542
  runCommand(item.cmd);
1526
1543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.74",
3
+ "version": "1.1.76",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -49,6 +49,13 @@ INDEX_TEMPLATE = """\
49
49
  </style>
50
50
  </head>
51
51
  <body>
52
+ <!--
53
+ [AI 编辑说明]
54
+ 这是学生作品的主文件。当你开始编辑时:
55
+ 1. 先删除 <body> 内所有现有内容(包括本注释)
56
+ 2. 根据参考材料(__demo__.html 等 __XXX__ 文件)重新制作学生作品
57
+ __XXX__ 文件只读,不要修改。
58
+ -->
52
59
  <div class="grid">
53
60
  <section>
54
61
  <h2>评价目标</h2>
@@ -69,7 +69,7 @@ python3 scripts/deploy_to_workspace.py <template_path> <workspace_path> --with-t
69
69
  - 实例名在 deploy 阶段生成
70
70
  - 命名规则默认是:`月日_原模板名_时分`
71
71
  - 如果同一分钟同名冲突,会自动加 `_2`、`_3`
72
- - 后续要修改的文件优先使用 `__demo__.html`
72
+ - 学生作品主文件是 `index.html`,`__XXX__` 文件(`__demo__.html` 等)为只读参考,不修改
73
73
 
74
74
  ## 内部脚本分层
75
75
 
@@ -1,11 +1,20 @@
1
- 下面是这次要继续处理的作品材料,请先按路径查看相关文件,并为后续继续引导学生完成作品做准备。
1
+ 下面是这次要开始制作的作品材料,请先按路径查看相关文件,然后直接开始修改 index.html。
2
2
 
3
3
  老师给到的作品文件夹路径:
4
4
  {{FOLDER_REL_PATH}}
5
5
 
6
- 后续我们要修改的文件路径:
6
+ 学生作品主文件路径:
7
7
  {{ENTRY_REL_PATH}}
8
8
 
9
- 请先查看这个作品文件夹中的所有现有文件,并重点查看后续要修改的网页文件。
10
- 后续我们会基于这些现有内容继续修改作品,并继续引导学生完成任务。
11
- 所以你现在先完成阅读和理解,暂时不要开始改动。
9
+ ## 文件职责说明
10
+
11
+ 文件夹里的 __XXX__ 文件(如 __demo__.html、__student-view__.html、__teacher-view__.html 等)是只读参考材料,不要修改它们。
12
+ - __demo__.html:老师做的示范作品,供参考
13
+ - __student-view__.html:学生任务说明页,供参考
14
+
15
+ index.html 是学生发布作品的主文件,所有修改只在这里进行。
16
+
17
+ ## 立即行动
18
+
19
+ 1. 先阅读 __XXX__ 文件,了解任务背景和示范内容
20
+ 2. 打开 index.html,按照里面的说明开始制作学生作品