@aiyiran/myclaw 1.1.178 → 1.1.179

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.
@@ -1380,7 +1380,7 @@ btn.addEventListener("click", function () {
1380
1380
  }
1381
1381
 
1382
1382
  // 弹出命令输入小弹框
1383
- function promptAndRun(title, placeholder, hint, cmdTemplate, btnColor, defaultValue, allowAnyName) {
1383
+ function promptAndRun(title, placeholder, hint, cmdTemplate, btnColor, defaultValue, allowAnyName, reloadAfter) {
1384
1384
  var mask = document.createElement("div");
1385
1385
  mask.style.cssText = [
1386
1386
  "position:fixed",
@@ -1443,7 +1443,7 @@ btn.addEventListener("click", function () {
1443
1443
  input.focus();
1444
1444
  return;
1445
1445
  }
1446
- // allowAnyName=true(如「新伙伴」):允许中文,后端 mc new 会自动生成 ascii id 并把中文存为显示名。
1446
+ // allowAnyName=true(如「新项目」):允许中文,后端 mc new 会自动生成 ascii id 并把中文存为显示名。
1447
1447
  // 否则(如「添加对话」):仍要求 ascii,因为它需要的是真实 agent id。
1448
1448
  if (!allowAnyName && !/^[a-zA-Z0-9\-]+$/.test(val)) {
1449
1449
  input.style.borderColor = "#ff4444";
@@ -1456,6 +1456,9 @@ btn.addEventListener("click", function () {
1456
1456
  var cmd = cmdTemplate.replace("{name}", safeName);
1457
1457
  runCommand(cmd);
1458
1458
  setTimeout(function () { mask.remove(); }, 1000);
1459
+ if (reloadAfter) {
1460
+ setTimeout(function () { location.reload(); }, reloadAfter);
1461
+ }
1459
1462
  }
1460
1463
 
1461
1464
  submitBtn.onclick = doSubmit;
@@ -1472,13 +1475,14 @@ btn.addEventListener("click", function () {
1472
1475
 
1473
1476
  function openNewAgentPrompt() {
1474
1477
  promptAndRun(
1475
- "\u65B0\u5EFA\u4F19\u4F34",
1476
- "\u8F93\u5165\u65B0\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 my-cat",
1477
- "\u7ED9\u4F60\u7684\u65B0 AI \u4F19\u4F34\u8D77\u4E2A\u540D\u5B57\uFF08\u4E2D\u6587 / \u82F1\u6587\u5747\u53EF\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u81EA\u52A8\u521B\u5EFA",
1478
+ "\u65B0\u5EFA\u9879\u76EE",
1479
+ "\u8F93\u5165\u65B0\u9879\u76EE\u540D\u79F0\uFF0C\u5982 my-cat",
1480
+ "\u7ED9\u4F60\u7684\u65B0\u9879\u76EE\u8D77\u4E2A\u540D\u5B57\uFF08\u4E2D\u6587 / \u82F1\u6587\u5747\u53EF\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u81EA\u52A8\u521B\u5EFA",
1478
1481
  "mc new {name}",
1479
1482
  "#3b82f6",
1480
1483
  "",
1481
- true
1484
+ true,
1485
+ 3000
1482
1486
  );
1483
1487
  }
1484
1488
 
@@ -1587,7 +1591,7 @@ btn.addEventListener("click", function () {
1587
1591
  btn.style.cssText = [
1588
1592
  "position: fixed",
1589
1593
  "bottom: 8px",
1590
- "right: 335px",
1594
+ "right: 190px",
1591
1595
  "padding: 3px 10px",
1592
1596
  "background: rgba(139, 92, 246, 0.85)",
1593
1597
  "color: #fff",
@@ -1601,7 +1605,7 @@ btn.addEventListener("click", function () {
1601
1605
  "transition: all 0.2s",
1602
1606
  "letter-spacing: 0.5px",
1603
1607
  ].join(";");
1604
- btn.textContent = "🆕 新会话";
1608
+ btn.textContent = "💬 新会话";
1605
1609
  btn.title = "创建新会话(可中文命名)";
1606
1610
 
1607
1611
  btn.onmouseenter = function () { btn.style.background = "rgba(124, 58, 237, 1)"; btn.style.transform = "scale(1.05)"; };
@@ -1622,7 +1626,7 @@ btn.addEventListener("click", function () {
1622
1626
  btn.style.cssText = [
1623
1627
  "position: fixed",
1624
1628
  "bottom: 8px",
1625
- "right: 430px",
1629
+ "right: 285px",
1626
1630
  "padding: 3px 10px",
1627
1631
  "background: rgba(59, 130, 246, 0.85)",
1628
1632
  "color: #fff",
@@ -1636,8 +1640,8 @@ btn.addEventListener("click", function () {
1636
1640
  "transition: all 0.2s",
1637
1641
  "letter-spacing: 0.5px",
1638
1642
  ].join(";");
1639
- btn.textContent = "🤝 新伙伴";
1640
- btn.title = "创建一个新的 AI 伙伴";
1643
+ btn.textContent = "📁 新项目";
1644
+ btn.title = "创建一个新的项目";
1641
1645
 
1642
1646
  btn.onmouseenter = function () { btn.style.background = "rgba(37, 99, 235, 1)"; btn.style.transform = "scale(1.05)"; };
1643
1647
  btn.onmouseleave = function () { btn.style.background = "rgba(59, 130, 246, 0.85)"; btn.style.transform = "scale(1)"; };
@@ -1674,7 +1678,7 @@ btn.addEventListener("click", function () {
1674
1678
 
1675
1679
  var header = document.createElement("div");
1676
1680
  header.style.cssText = "display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:#2d2d3f;color:#cdd6f4;font-size:13px;font-family:monospace;user-select:none;";
1677
- header.innerHTML = "<span>🆕 新会话</span>";
1681
+ header.innerHTML = "<span>💬 新会话</span>";
1678
1682
  var closeBtn = document.createElement("span");
1679
1683
  closeBtn.textContent = "✕";
1680
1684
  closeBtn.style.cssText = "cursor:pointer;padding:2px 6px;border-radius:3px;font-size:14px;transition:background 0.15s;";
@@ -1801,7 +1805,7 @@ btn.addEventListener("click", function () {
1801
1805
 
1802
1806
  // ── 按钮列表 ──
1803
1807
  var btns = [
1804
- { 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\u4E2D\u6587 / \u82F1\u6587\u5747\u53EF\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u81EA\u52A8\u521B\u5EFA", cmd: "mc new {name}", color: "#3b82f6", allowAnyName: true },
1808
+ { label: "\uD83D\uDCC1 \u65B0\u9879\u76EE", desc: "\u521B\u5EFA\u4E00\u4E2A\u65B0\u9879\u76EE", hasInput: true, inputTitle: "\u65B0\u5EFA\u9879\u76EE", placeholder: "\u8F93\u5165\u65B0\u9879\u76EE\u540D\u79F0\uFF0C\u5982 my-cat", hint: "\u7ED9\u4F60\u7684\u65B0\u9879\u76EE\u8D77\u4E2A\u540D\u5B57\uFF08\u4E2D\u6587 / \u82F1\u6587\u5747\u53EF\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u81EA\u52A8\u521B\u5EFA", cmd: "mc new {name}", color: "#3b82f6", allowAnyName: true, reloadAfter: 3000 },
1805
1809
  { 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 },
1806
1810
  { label: "\uD83D\uDD04 \u91CD\u542F\u670D\u52A1", desc: "\u91CD\u542F\u6587\u4EF6\u670D\u52A1", hasInput: false, cmd: "mc server", color: "#ef4444" },
1807
1811
  { label: "\uD83E\uDD9E \u91CD\u542F\u9F99\u867E", desc: "\u91CD\u542F OpenClaw \u6838\u5FC3\u670D\u52A1", hasInput: false, cmd: "mc all", color: "#f59e0b" },
@@ -1850,7 +1854,7 @@ btn.addEventListener("click", function () {
1850
1854
 
1851
1855
  row.onclick = function () {
1852
1856
  if (item.hasInput) {
1853
- promptAndRun(item.inputTitle, item.placeholder, item.hint, item.cmd, item.color, item.getDefault ? item.getDefault() : '', item.allowAnyName);
1857
+ promptAndRun(item.inputTitle, item.placeholder, item.hint, item.cmd, item.color, item.getDefault ? item.getDefault() : '', item.allowAnyName, item.reloadAfter);
1854
1858
  } else {
1855
1859
  runCommand(item.cmd);
1856
1860
  }
package/create_agent.js CHANGED
@@ -92,7 +92,7 @@ function pad2(n) { return String(n).padStart(2, '0'); }
92
92
 
93
93
  function generateFallbackKey(existingIds) {
94
94
  const bj = new Date(Date.now() + 8 * 60 * 60 * 1000);
95
- const MD = String(bj.getUTCMonth() + 1) + String(bj.getUTCDate());
95
+ const MD = pad2(bj.getUTCMonth() + 1) + pad2(bj.getUTCDate());
96
96
 
97
97
  const pattern = /^z(\d{3})-/;
98
98
  let minCounter = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.178",
3
+ "version": "1.1.179",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {