misakanet 3.14.0 → 3.15.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "misakanet",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "description": "Failure-memory network for AI coding agents: search evidence-rated failure lessons, submit new failures, and turn crashes into reusable knowledge.",
5
5
  "author": {
6
6
  "name": "Ikalus1988",
package/lib/client.js CHANGED
@@ -149,6 +149,12 @@ window.__ModuleLoader__.load({
149
149
  "panel.flash.contrib": "contribution +0.5",
150
150
  "panel.ladder": "Contribution ladder",
151
151
  "panel.ladder.window": "this week · top 5",
152
+ "panel.ladder.you": "you",
153
+ "panel.ladder.claim": "Claim your node",
154
+ "panel.ladder.claimHint": "Misaka12345",
155
+ "panel.ladder.save": "Save",
156
+ "panel.ladder.clear": "clear",
157
+ "panel.ladder.yours": "your node: ",
152
158
  "panel.network": "Network & corpus",
153
159
  "panel.sources": "Where these numbers come from",
154
160
  "panel.ladder.loading": "reading this week\u2019s ladder\u2026",
@@ -335,6 +341,12 @@ window.__ModuleLoader__.load({
335
341
  "panel.flash.contrib": "贡献 +0.5",
336
342
  "panel.ladder": "贡献天梯",
337
343
  "panel.ladder.window": "本周 · 前五",
344
+ "panel.ladder.you": "你",
345
+ "panel.ladder.claim": "认领你的节点",
346
+ "panel.ladder.claimHint": "Misaka12345",
347
+ "panel.ladder.save": "保存",
348
+ "panel.ladder.clear": "清除",
349
+ "panel.ladder.yours": "你的节点:",
338
350
  "panel.network": "网络与语料",
339
351
  "panel.sources": "这些数字从哪来",
340
352
  "panel.ladder.loading": "正在读本周天梯…",
@@ -647,6 +659,18 @@ window.__ModuleLoader__.load({
647
659
  * person typed and whether it found a lesson — no lesson body, no tool arguments — capped at 20,
648
660
  * local only, same rule as every counter here.
649
661
  */
662
+ /** The node a reader says is theirs. Public pseudonym, local only — never a token. */
663
+ var NODE_KEY = "misakanet.panel.node.v1";
664
+ function readClaim() {
665
+ try { return String(window.localStorage.getItem(NODE_KEY) || "").trim(); } catch (error) { return ""; }
666
+ }
667
+ function saveClaim(value) {
668
+ try {
669
+ if (value) window.localStorage.setItem(NODE_KEY, value);
670
+ else window.localStorage.removeItem(NODE_KEY);
671
+ } catch (error) { /* private mode: the claim just does not persist */ }
672
+ }
673
+
650
674
  var HISTORY_KEY = "misakanet.panel.history.v1";
651
675
  var HISTORY_MAX = 20;
652
676
 
@@ -1477,17 +1501,54 @@ var DEFAULT_MCP_URL = "https://misakanet.org/mcp";
1477
1501
  * is "the endpoint did not answer" — the two say different things and neither is an empty board.
1478
1502
  */
1479
1503
  function LadderSection() {
1504
+ var claimState = react.useState(readClaim());
1505
+ var claim = claimState[0];
1506
+ var setClaim = claimState[1];
1507
+ var draftState = react.useState("");
1508
+ var draft = draftState[0];
1509
+ var setDraft = draftState[1];
1510
+ var editingState = react.useState(false);
1511
+ var editing = editingState[0];
1512
+ var setEditing = editingState[1];
1480
1513
  var state = react.useState(undefined);
1481
1514
  var ladder = state[0];
1482
1515
  var setLadder = state[1];
1483
1516
  react.useEffect(function () {
1484
1517
  var alive = true;
1485
- fetch(LADDER_URL + "?window=week", { headers: { Accept: "application/json" } })
1518
+ var url = LADDER_URL + "?window=week" + (claim ? "&node=" + encodeURIComponent(claim) : "");
1519
+ fetch(url, { headers: { Accept: "application/json" } })
1486
1520
  .then(function (response) { return response.ok ? response.json() : null; })
1487
1521
  .then(function (data) { if (alive) setLadder(data && data.top ? data : null); })
1488
1522
  .catch(function () { if (alive) setLadder(null); });
1489
1523
  return function () { alive = false; };
1490
- }, []);
1524
+ }, [claim]);
1525
+
1526
+ /**
1527
+ * One ranked row: badge, optional GH chip, name, score, and the share bar.
1528
+ * `highlight` marks the reader's own row when it sits outside the top five.
1529
+ */
1530
+ function ladderRow(entry, key, max, highlight) {
1531
+ var share = Math.max(4, Math.round((entry.score / max) * 100));
1532
+ return h("div", { key: key, style: { padding: "5px 0", opacity: highlight ? 1 : undefined } },
1533
+ h("div", { style: { display: "flex", alignItems: "center", gap: "8px" } },
1534
+ h("span", { style: { flex: "none", width: "18px", height: "18px", borderRadius: "50%",
1535
+ display: "inline-flex", alignItems: "center", justifyContent: "center",
1536
+ fontSize: "10px", fontVariantNumeric: "tabular-nums",
1537
+ background: "rgba(127,127,127,.16)", opacity: 0.85 } }, String(entry.rank)),
1538
+ entry.login ? h("span", { style: { flex: "none", fontSize: "9px", lineHeight: "1",
1539
+ padding: "2px 4px", borderRadius: "3px", border: "1px solid " + MUTED,
1540
+ opacity: 0.65, letterSpacing: "0.04em" } }, "GH") : null,
1541
+ h("span", { style: { flex: "1 1 auto", minWidth: 0, overflow: "hidden",
1542
+ textOverflow: "ellipsis", whiteSpace: "nowrap" } }, String(entry.name || entry.node || "")),
1543
+ highlight ? h("span", { style: Object.assign({}, DIM, { flex: "none", fontSize: "10px" }) }, T("panel.ladder.you")) : null,
1544
+ h("span", { style: { flex: "none", fontWeight: 600, fontSize: "13px",
1545
+ fontVariantNumeric: "tabular-nums" } }, String(entry.score))),
1546
+ h("div", { style: { height: "3px", margin: "4px 0 0 26px", borderRadius: "2px",
1547
+ background: "rgba(127,127,127,.16)" } },
1548
+ h("i", { style: { display: "block", height: "100%", width: share + "%",
1549
+ borderRadius: "2px", background: "currentColor", opacity: 0.5 } })));
1550
+ }
1551
+
1491
1552
  var rows = [h("div", { key: "t", style: Object.assign({}, SECTION_TITLE, { display: "flex",
1492
1553
  alignItems: "baseline", gap: "6px" }) },
1493
1554
  T("panel.ladder"),
@@ -1500,30 +1561,41 @@ var DEFAULT_MCP_URL = "https://misakanet.org/mcp";
1500
1561
  } else {
1501
1562
  var top = ladder.top.slice(0, 5);
1502
1563
  var max = top[0].score || 1;
1503
- rows.push(h("div", { key: "r", style: Object.assign({}, BOX, { marginTop: "6px" }) }, top.map(function (entry) {
1504
- var share = Math.max(4, Math.round((entry.score / max) * 100));
1505
- return h("div", { key: "l" + entry.rank, style: { padding: "5px 0" } },
1506
- h("div", { style: { display: "flex", alignItems: "center", gap: "8px" } },
1507
- h("span", { style: { flex: "none", width: "18px", height: "18px", borderRadius: "50%",
1508
- display: "inline-flex", alignItems: "center", justifyContent: "center",
1509
- fontSize: "10px", fontVariantNumeric: "tabular-nums",
1510
- background: "rgba(127,127,127,.16)", opacity: 0.85 } }, String(entry.rank)),
1511
- entry.login ? h("span", { style: { flex: "none", fontSize: "9px", lineHeight: "1",
1512
- padding: "2px 4px", borderRadius: "3px", border: "1px solid " + MUTED,
1513
- opacity: 0.65, letterSpacing: "0.04em" } }, "GH") : null,
1514
- h("span", { style: { flex: "1 1 auto", minWidth: 0, overflow: "hidden",
1515
- textOverflow: "ellipsis", whiteSpace: "nowrap" } }, String(entry.name || entry.node || "")),
1516
- h("span", { style: { flex: "none", fontWeight: 600, fontSize: "13px",
1517
- fontVariantNumeric: "tabular-nums" } }, String(entry.score))),
1518
- h("div", { style: { height: "3px", margin: "4px 0 0 26px", borderRadius: "2px",
1519
- background: "rgba(127,127,127,.16)" } },
1520
- h("i", { style: { display: "block", height: "100%", width: share + "%",
1521
- borderRadius: "2px", background: "currentColor", opacity: 0.5 } })));
1522
- })));
1564
+ var own = ladder.me;
1565
+ var ownInsideTop = own && top.some(function (entry) { return entry.rank === own.rank; });
1566
+ rows.push(h("div", { key: "r", style: Object.assign({}, BOX, { marginTop: "6px" }) },
1567
+ top.map(function (entry) { return ladderRow(entry, "l" + entry.rank, max, own && entry.rank === own.rank); }),
1568
+ own && !ownInsideTop ? h("div", { key: "me", style: { borderTop: "1px solid " + MUTED, marginTop: "4px", paddingTop: "2px" } },
1569
+ ladderRow(own, "me-row", max, true)) : null));
1523
1570
  if (ladder.coverage && ladder.coverage.note) {
1524
1571
  rows.push(h("div", { key: "c", style: Object.assign({}, DIM, { marginTop: "4px" }) }, T("panel.ladder.coverage")));
1525
1572
  }
1526
1573
  }
1574
+ // Claim a pseudonym: the only identity the browser can hold without a token. Public by
1575
+ // construction, so a local copy of it is not a secret.
1576
+ if (editing) {
1577
+ rows.push(h("div", { key: "claim-edit", style: { display: "flex", gap: "6px", marginTop: "6px", alignItems: "center" } },
1578
+ h("input", {
1579
+ key: "input", type: "text", value: draft, placeholder: T("panel.ladder.claimHint"),
1580
+ style: Object.assign({}, BUTTON, { flex: "1 1 auto", fontWeight: 400, cursor: "text" }),
1581
+ onChange: function (event) { setDraft(event.target.value); },
1582
+ }),
1583
+ h("button", { key: "save", type: "button", style: BUTTON, onClick: function () {
1584
+ var value = String(draft || "").trim();
1585
+ if (!/^[A-Za-z0-9_-]{3,32}$/.test(value)) return;
1586
+ saveClaim(value);
1587
+ setClaim(value);
1588
+ setEditing(false);
1589
+ } }, T("panel.ladder.save"))));
1590
+ } else {
1591
+ rows.push(h("div", { key: "claim", style: Object.assign({}, DIM, { marginTop: "4px" }) },
1592
+ claim ? h("span", null, T("panel.ladder.yours") + claim + " ",
1593
+ h("button", { type: "button", style: BUTTON, onClick: function () {
1594
+ saveClaim(""); setClaim("");
1595
+ } }, T("panel.ladder.clear")))
1596
+ : h("button", { type: "button", style: BUTTON, onClick: function () { setDraft(""); setEditing(true); } },
1597
+ T("panel.ladder.claim"))));
1598
+ }
1527
1599
  return h("div", null, rows);
1528
1600
  }
1529
1601
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "misakanet",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "MisakaNet failure-memory skill — evidence-rated failure lessons for AI agents. DSH bundle: registers the MCP tools as mcp__misakanet__* (misakanet_search/get_lesson/…), served by the public Streamable HTTP endpoint https://misakanet.org/mcp — live tools from an npm install, in any profile, with no local python. A profile that prefers the repo's own stdio server can override the bundle row.",
6
6
  "icon": "icon.svg",