sage-mem 1.5.0 → 1.5.2
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/README.md +3 -0
- package/README.zh.md +3 -0
- package/lib/client.js +111 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -538,6 +538,9 @@ No. Serialized writes guarantee only **in-process** ordering; there is no file l
|
|
|
538
538
|
**Can I do without autodream?**
|
|
539
539
|
Yes, it is off by default. It and archiving are two different things: archiving is a deterministic rule (by idle days), calls no model and costs nothing.
|
|
540
540
|
|
|
541
|
+
**The plugin market says "the registry's latest is older than the installed version, updating would downgrade"?**
|
|
542
|
+
That is a **stale `/latest` cache on the download-region mirror**, not a mis-published package: the mirror's full metadata (the document pnpm reads) already has the new version, while the `/<pkg>/latest` shortcut still serves an old one. Retry after a minute or two; if it persists, temporarily switch the market's download region to "Global" (the origin registry, registry.npmjs.org), update, then switch back. To check what is actually published: `npm view sage-mem dist-tags`.
|
|
543
|
+
|
|
541
544
|
## Uninstall
|
|
542
545
|
|
|
543
546
|
```bash
|
package/README.zh.md
CHANGED
|
@@ -543,6 +543,9 @@ npm test # 全部断言(含三条守卫)
|
|
|
543
543
|
**能不用自动做梦吗?**
|
|
544
544
|
能,它默认就是关闭的。它和归档是两件事:归档是确定性规则(按闲置天数),不调模型、不花钱。
|
|
545
545
|
|
|
546
|
+
**插件市场报「registry 上的最新版比已装还旧,更新会降级」?**
|
|
547
|
+
那是**下载地区镜像的 `/latest` 缓存滞后**,不是包发错了:镜像的全量元数据(pnpm 读的那份)已经是新版,但 `/<包>/latest` 这个快捷入口还缓存着旧值。先等一两分钟重试;仍然不行就把插件市场的「下载地区」临时切到「全球」(直连 registry.npmjs.org)更新,完成后再切回。核对实际发布版本:`npm view sage-mem dist-tags`。
|
|
548
|
+
|
|
546
549
|
## 卸载
|
|
547
550
|
|
|
548
551
|
```bash
|
package/lib/client.js
CHANGED
|
@@ -2160,6 +2160,11 @@ const StarmapRuntime = (function (require, _react) {
|
|
|
2160
2160
|
".smem-update{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid var(--dsw-alias-brand-primary,#4d76e6);border-radius:8px;padding:6px 10px;font-size:12px;background:var(--dsw-alias-bg-layer-1);}",
|
|
2161
2161
|
".smem-update-link{color:var(--dsw-alias-brand-primary,#4d76e6);text-decoration:underline;}",
|
|
2162
2162
|
".smem-update-x{margin-left:auto;border:0;background:transparent;color:inherit;cursor:pointer;font-size:14px;line-height:1;padding:0 2px;}",
|
|
2163
|
+
// ── 1.5.1:筛选汇总行(有筛选才出现)──
|
|
2164
|
+
".smem-filter-summary{width:100%;display:flex;align-items:center;flex-wrap:wrap;gap:6px;font-size:12px;color:var(--dsw-alias-label-secondary);}",
|
|
2165
|
+
".smem-sum-item{display:inline-flex;align-items:center;gap:2px;border:1px solid var(--dsw-alias-border-l1);border-radius:999px;padding:1px 8px;}",
|
|
2166
|
+
".smem-sum-x{border:0;background:transparent;color:inherit;cursor:pointer;font-size:12px;line-height:1;padding:0 0 0 2px;}",
|
|
2167
|
+
".smem-sum-clear{border:0;background:transparent;color:var(--dsw-alias-brand-primary,#4d76e6);font-size:12px;font-family:inherit;cursor:pointer;padding:2px 4px;}",
|
|
2163
2168
|
// ── 1.5.0:动作分组 / 长文 clamp / 空态骨架 / 窄窗口 ──
|
|
2164
2169
|
".smem-actions-sep{width:1px;height:16px;background:var(--dsw-alias-border-l2);margin:0 2px;align-self:center;}",
|
|
2165
2170
|
".smem-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer;}",
|
|
@@ -3736,6 +3741,90 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
3736
3741
|
notice ? h("div", { className: "smem-ok", key: "ok" }, "✓ " + notice) : null,
|
|
3737
3742
|
]);
|
|
3738
3743
|
}
|
|
3744
|
+
// ── 筛选条(1.5.2 从 Section 里抽出)────────────────────────────────
|
|
3745
|
+
// 只接收 props、只渲染;筛选语义(哪些项互斥、怎么 AND/OR)仍在 Section 里算好再传进来。
|
|
3746
|
+
// 抽出来的收益是 Section 少了 60 行 UI 细节,而筛选条可以单独看、单独改(比如以后再加
|
|
3747
|
+
// 「只显示锁定」这类维度),不用在一千行的 Section 里翻。
|
|
3748
|
+
function FilterBar(props) {
|
|
3749
|
+
const { hasFilter, statusFilter, setStatusFilter, totalCount, items, archiveItems, statusItems, typeFilter, setTypeFilter, typeList, typeCounts, tagList, tagShown, tagHiddenCount, tagCounts, tagFilter, setTagFilter, tagOpen, setTagOpen, TAG_VISIBLE_MAX, query, setQuery, toggleIn, sumItem } = props;
|
|
3750
|
+
return h("div", { className: "smem-filters" }, [
|
|
3751
|
+
hasFilter
|
|
3752
|
+
? h("div", { className: "smem-filter-summary", key: "sum" }, [
|
|
3753
|
+
statusFilter !== "all"
|
|
3754
|
+
? sumItem("状态:" + (statusFilter === "active" ? "活动中" : "已归档"), function () { setStatusFilter("all"); })
|
|
3755
|
+
: null,
|
|
3756
|
+
typeFilter.map(function (t) {
|
|
3757
|
+
return sumItem("类型:" + (TYPE_LABEL[t] || t), function () { toggleIn(setTypeFilter, t); });
|
|
3758
|
+
}),
|
|
3759
|
+
tagFilter.map(function (g) {
|
|
3760
|
+
return sumItem("标签:#" + g, function () { toggleIn(setTagFilter, g); });
|
|
3761
|
+
}),
|
|
3762
|
+
query.trim() ? sumItem("搜索:" + query.trim(), function () { setQuery(""); }) : null,
|
|
3763
|
+
h("button", {
|
|
3764
|
+
type: "button", className: "smem-sum-clear", key: "all",
|
|
3765
|
+
onClick: function () { setStatusFilter("all"); setTypeFilter([]); setTagFilter([]); setQuery(""); },
|
|
3766
|
+
}, "清除全部"),
|
|
3767
|
+
])
|
|
3768
|
+
: null,
|
|
3769
|
+
h("span", { className: "smem-filters-label", key: "lst" }, "状态"),
|
|
3770
|
+
h("button", {
|
|
3771
|
+
type: "button", key: "st-all", className: "smem-chip",
|
|
3772
|
+
"data-on": statusFilter === "all" ? "1" : "0",
|
|
3773
|
+
title: "活动与已归档一起看(归档条走灰色)",
|
|
3774
|
+
onClick: function () { setStatusFilter("all"); },
|
|
3775
|
+
}, ["全部", h("span", { className: "smem-chip-n", key: "n" }, String(totalCount))]),
|
|
3776
|
+
h("button", {
|
|
3777
|
+
type: "button", key: "st-active", className: "smem-chip",
|
|
3778
|
+
"data-on": statusFilter === "active" ? "1" : "0",
|
|
3779
|
+
title: "正在参与检索与星图的记忆",
|
|
3780
|
+
onClick: function () { setStatusFilter("active"); },
|
|
3781
|
+
}, ["活动中", h("span", { className: "smem-chip-n", key: "n" }, String(items.length))]),
|
|
3782
|
+
h("button", {
|
|
3783
|
+
type: "button", key: "st-arch", className: "smem-chip",
|
|
3784
|
+
"data-on": statusFilter === "archived" ? "1" : "0",
|
|
3785
|
+
title: "已收进档案馆:不参与检索与星图,可编辑 / 恢复",
|
|
3786
|
+
onClick: function () { setStatusFilter("archived"); },
|
|
3787
|
+
}, ["已归档", h("span", { className: "smem-chip-n", key: "n" }, String(archiveItems.length))]),
|
|
3788
|
+
h("span", { className: "smem-sep", key: "sep0" }),
|
|
3789
|
+
h("span", { className: "smem-filters-label", key: "lt" }, "类型"),
|
|
3790
|
+
h("button", {
|
|
3791
|
+
type: "button", key: "all", className: "smem-chip",
|
|
3792
|
+
"data-on": typeFilter.length ? "0" : "1",
|
|
3793
|
+
onClick: function () { setTypeFilter([]); },
|
|
3794
|
+
}, ["全部", h("span", { className: "smem-chip-n", key: "n" }, String(statusItems.length))]),
|
|
3795
|
+
typeList.map(function (t) {
|
|
3796
|
+
return h("button", {
|
|
3797
|
+
type: "button", key: t, className: "smem-chip",
|
|
3798
|
+
"data-on": typeFilter.indexOf(t) >= 0 ? "1" : "0",
|
|
3799
|
+
onClick: function () { toggleIn(setTypeFilter, t); },
|
|
3800
|
+
}, [TYPE_LABEL[t] || t, h("span", { className: "smem-chip-n", key: "n" }, String(typeCounts[t]))]);
|
|
3801
|
+
}),
|
|
3802
|
+
tagList.length ? h("span", { className: "smem-sep", key: "sep" }) : null,
|
|
3803
|
+
tagList.length ? h("span", { className: "smem-filters-label", key: "lgt" }, "标签") : null,
|
|
3804
|
+
tagShown.map(function (g) {
|
|
3805
|
+
return h("button", {
|
|
3806
|
+
type: "button", key: "tag-" + g, className: "smem-chip",
|
|
3807
|
+
"data-on": tagFilter.indexOf(g) >= 0 ? "1" : "0",
|
|
3808
|
+
onClick: function () { toggleIn(setTagFilter, g); },
|
|
3809
|
+
}, ["#" + g, h("span", { className: "smem-chip-n", key: "n" }, String(tagCounts[g]))]);
|
|
3810
|
+
}),
|
|
3811
|
+
tagList.length > TAG_VISIBLE_MAX
|
|
3812
|
+
? h("button", {
|
|
3813
|
+
type: "button", key: "moretag", className: "smem-btn",
|
|
3814
|
+
title: tagOpen ? "收起标签" : "还有一些标签没显示",
|
|
3815
|
+
onClick: function () { setTagOpen(!tagOpen); },
|
|
3816
|
+
}, tagOpen ? "收起标签" : ("更多标签 (" + String(tagHiddenCount) + ")") )
|
|
3817
|
+
: null,
|
|
3818
|
+
hasFilter
|
|
3819
|
+
? h("button", {
|
|
3820
|
+
type: "button", key: "clear", className: "smem-btn",
|
|
3821
|
+
onClick: function () { setStatusFilter("all"); setTypeFilter([]); setTagFilter([]); setQuery(""); },
|
|
3822
|
+
}, "清除筛选")
|
|
3823
|
+
: null,
|
|
3824
|
+
|
|
3825
|
+
]);
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3739
3828
|
function Section(props) {
|
|
3740
3829
|
// 走 stableRemote:真实宿主里 `ctx.get()` 每次返回新对象(issue #3 的成因)。
|
|
3741
3830
|
// 这个面板的 effect 依赖是 `[]`、暂时不会爆,但引用稳定是**所有**面板的共同前提。
|
|
@@ -3749,6 +3838,8 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
3749
3838
|
const sNotice = react.useState("");
|
|
3750
3839
|
const notice = sNotice[0], setNotice = sNotice[1];
|
|
3751
3840
|
const sQuery = react.useState("");
|
|
3841
|
+
const sTagOpen = react.useState(false);
|
|
3842
|
+
const tagOpen = sTagOpen[0], setTagOpen = sTagOpen[1];
|
|
3752
3843
|
const query = sQuery[0], setQuery = sQuery[1];
|
|
3753
3844
|
const sExpanded = react.useState({});
|
|
3754
3845
|
const expanded = sExpanded[0], setExpanded = sExpanded[1];
|
|
@@ -4366,6 +4457,17 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
4366
4457
|
return hay.indexOf(q) >= 0;
|
|
4367
4458
|
});
|
|
4368
4459
|
const hasFilter = !!(statusFilter !== "all" || typeFilter.length || tagFilter.length || q);
|
|
4460
|
+
// 标签最多平铺 6 个:再多就把筛选条撑成三行,而真正常用的标签通常就那几个。
|
|
4461
|
+
const TAG_VISIBLE_MAX = 6;
|
|
4462
|
+
const tagShown = tagOpen ? tagList : tagList.slice(0, TAG_VISIBLE_MAX);
|
|
4463
|
+
const tagHiddenCount = tagList.length - tagShown.length;
|
|
4464
|
+
// 汇总行里每一项都是「现在正在筛什么 + 单独撤掉它」;只出现有筛选时。
|
|
4465
|
+
function sumItem(label, onRemove) {
|
|
4466
|
+
return h("span", { className: "smem-sum-item", key: "sum-" + label }, [
|
|
4467
|
+
label,
|
|
4468
|
+
h("button", { type: "button", className: "smem-sum-x", key: "x", title: "撤掉这项筛选", onClick: onRemove }, "×"),
|
|
4469
|
+
]);
|
|
4470
|
+
}
|
|
4369
4471
|
// 两个计数永远一起露脸:用户不必先筛状态才知道档案馆里有没有东西。
|
|
4370
4472
|
const headerCount = (hasFilter ? "筛出 " + String(filtered.length) + " / " + String(statusItems.length) + " · " : "") +
|
|
4371
4473
|
"活动中 " + String(items.length) + " · 已归档 " + String(archiveItems.length);
|
|
@@ -4602,56 +4704,15 @@ h("span", { key: "sep", className: "smem-actions-sep", "aria-hidden": "true" }),
|
|
|
4602
4704
|
: null,
|
|
4603
4705
|
// 三排筛选:状态 / 类型 / 标签。组内 OR、组间 AND,再与搜索框 AND。
|
|
4604
4706
|
tab === "files" && totalCount
|
|
4605
|
-
? h(
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
type: "button", key: "st-active", className: "smem-chip",
|
|
4615
|
-
"data-on": statusFilter === "active" ? "1" : "0",
|
|
4616
|
-
title: "正在参与检索与星图的记忆",
|
|
4617
|
-
onClick: function () { setStatusFilter("active"); },
|
|
4618
|
-
}, ["活动中", h("span", { className: "smem-chip-n", key: "n" }, String(items.length))]),
|
|
4619
|
-
h("button", {
|
|
4620
|
-
type: "button", key: "st-arch", className: "smem-chip",
|
|
4621
|
-
"data-on": statusFilter === "archived" ? "1" : "0",
|
|
4622
|
-
title: "已收进档案馆:不参与检索与星图,可编辑 / 恢复",
|
|
4623
|
-
onClick: function () { setStatusFilter("archived"); },
|
|
4624
|
-
}, ["已归档", h("span", { className: "smem-chip-n", key: "n" }, String(archiveItems.length))]),
|
|
4625
|
-
h("span", { className: "smem-sep", key: "sep0" }),
|
|
4626
|
-
h("span", { className: "smem-filters-label", key: "lt" }, "类型"),
|
|
4627
|
-
h("button", {
|
|
4628
|
-
type: "button", key: "all", className: "smem-chip",
|
|
4629
|
-
"data-on": typeFilter.length ? "0" : "1",
|
|
4630
|
-
onClick: function () { setTypeFilter([]); },
|
|
4631
|
-
}, ["全部", h("span", { className: "smem-chip-n", key: "n" }, String(statusItems.length))]),
|
|
4632
|
-
typeList.map(function (t) {
|
|
4633
|
-
return h("button", {
|
|
4634
|
-
type: "button", key: t, className: "smem-chip",
|
|
4635
|
-
"data-on": typeFilter.indexOf(t) >= 0 ? "1" : "0",
|
|
4636
|
-
onClick: function () { toggleIn(setTypeFilter, t); },
|
|
4637
|
-
}, [TYPE_LABEL[t] || t, h("span", { className: "smem-chip-n", key: "n" }, String(typeCounts[t]))]);
|
|
4638
|
-
}),
|
|
4639
|
-
tagList.length ? h("span", { className: "smem-sep", key: "sep" }) : null,
|
|
4640
|
-
tagList.length ? h("span", { className: "smem-filters-label", key: "lgt" }, "标签") : null,
|
|
4641
|
-
tagList.map(function (g) {
|
|
4642
|
-
return h("button", {
|
|
4643
|
-
type: "button", key: "tag-" + g, className: "smem-chip",
|
|
4644
|
-
"data-on": tagFilter.indexOf(g) >= 0 ? "1" : "0",
|
|
4645
|
-
onClick: function () { toggleIn(setTagFilter, g); },
|
|
4646
|
-
}, ["#" + g, h("span", { className: "smem-chip-n", key: "n" }, String(tagCounts[g]))]);
|
|
4647
|
-
}),
|
|
4648
|
-
hasFilter
|
|
4649
|
-
? h("button", {
|
|
4650
|
-
type: "button", key: "clear", className: "smem-btn",
|
|
4651
|
-
onClick: function () { setStatusFilter("all"); setTypeFilter([]); setTagFilter([]); setQuery(""); },
|
|
4652
|
-
}, "清除筛选")
|
|
4653
|
-
: null,
|
|
4654
|
-
])
|
|
4707
|
+
? h(FilterBar, {
|
|
4708
|
+
hasFilter: hasFilter, statusFilter: statusFilter, setStatusFilter: setStatusFilter,
|
|
4709
|
+
totalCount: totalCount, items: items, archiveItems: archiveItems, statusItems: statusItems,
|
|
4710
|
+
typeFilter: typeFilter, setTypeFilter: setTypeFilter, typeList: typeList, typeCounts: typeCounts,
|
|
4711
|
+
tagList: tagList, tagShown: tagShown, tagHiddenCount: tagHiddenCount, tagCounts: tagCounts,
|
|
4712
|
+
tagFilter: tagFilter, setTagFilter: setTagFilter, tagOpen: tagOpen, setTagOpen: setTagOpen,
|
|
4713
|
+
TAG_VISIBLE_MAX: TAG_VISIBLE_MAX, query: query, setQuery: setQuery,
|
|
4714
|
+
toggleIn: toggleIn, sumItem: sumItem,
|
|
4715
|
+
})
|
|
4655
4716
|
: null,
|
|
4656
4717
|
error ? h("div", { className: "smem-err", key: "err", role: "alert" }, "⚠ " + error) : null,
|
|
4657
4718
|
notice && !error ? h("div", { className: "smem-ok", key: "ok", role: "status" }, "✓ " + notice) : null,
|
package/package.json
CHANGED