@@ -313,6 +313,9 @@ window.__ModuleLoader__.load({
313313 "memory.settings.group.search": "搜索",
314314 "memory.settings.group.connect": "连接与安全",
315315 "memory.settings.group.help": "帮助",
316+ "memory.settings.toc.label": "目录",
317+ "memory.settings.toc.aria": "设置分组目录",
318+ "memory.settings.toc.jump": "跳到「{name}」",
316319 "memory.settings.profile": "用户画像",
317320 "memory.settings.profileHint": "写一段自我介绍(角色、背景、偏好),Agent 每轮对话都会自动带上。",
318321 "memory.settings.profileSave": "保存画像",
@@ -490,6 +493,11 @@ window.__ModuleLoader__.load({
490493 "memory.settings.mode.standard": "标准",
491494 "memory.settings.mode.savedHint": "已保存,重启 DSH 后生效",
492495 "memory.settings.mode.offList": "已关闭:巩固(autoDream)· 实体抽取 · 语义搜索",
496+ // #514:用户把宿主「极简(minimal)」与插件「轻量」混为一谈,以为关掉人格是
497+ // 轻量模式干的。这个词条把两件事分开说清楚,不再让用户自己猜。
498+ "memory.settings.mode.hostPresetHint": "注意区分:这里的「轻量 / 标准」是插件的记忆引擎档位,与 DSH 宿主的「极简模式(minimal 预设)」是两回事——轻量档不会关闭人格定义。",
499+ "memory.status.minimalPresetTitle": "当前会话用的是宿主的「极简模式」",
500+ "memory.status.minimalPresetBody": "极简预设(minimal)把 system prompt 整体接管了,记忆、用户画像、人格定义都不会送达模型。这是宿主的设计边界,插件改不了。想要它们生效:把 DSH 切到标准模式(或在 ~/.dsh/settings.yaml 设 agent-presets.default: standard);过渡方案是把画像与规则写进 AGENTS.md——那条走指令路径,不受这个压制。",
493501 "memory.settings.extapi.title": "外部访问 API",
494502 "memory.settings.extapi.desc": "开放一个本机接口,让其他工具(插件、命令行、桌面应用)也能读写这份记忆库,默认只允许本机连接。改动保存后重启 DSH 生效。",
495503 "memory.settings.extapi.enabled": "启用",
@@ -1090,6 +1098,9 @@ window.__ModuleLoader__.load({
10901098 "memory.settings.group.search": "Search",
10911099 "memory.settings.group.connect": "Connections & safety",
10921100 "memory.settings.group.help": "Help",
1101+ "memory.settings.toc.label": "Contents",
1102+ "memory.settings.toc.aria": "Settings section index",
1103+ "memory.settings.toc.jump": "Jump to {name}",
10931104 "memory.settings.profile": "User Profile",
10941105 "memory.settings.profileHint": "Describe yourself once — the agent reads it every turn.",
10951106 "memory.settings.profileSave": "Save Profile",
@@ -1263,6 +1274,9 @@ window.__ModuleLoader__.load({
12631274 "memory.settings.mode.standard": "Standard",
12641275 "memory.settings.mode.savedHint": "Saved. Takes effect after restarting DSH",
12651276 "memory.settings.mode.offList": "Off: consolidation (autoDream) · entity extraction · semantic search",
1277+ "memory.settings.mode.hostPresetHint": "Two different things: Light/Standard here is this plugin's memory engine tier; the host's minimal preset is separate — Light never disables persona.",
1278+ "memory.status.minimalPresetTitle": "This session runs the host's minimal preset",
1279+ "memory.status.minimalPresetBody": "The minimal preset takes over the whole system prompt, so memory, profile and persona never reach the model. That is a host design boundary the plugin cannot change. To get them back: switch DSH to standard mode (or set agent-presets.default: standard in ~/.dsh/settings.yaml); as an interim workaround put profile and rules in AGENTS.md — that path is not suppressed.",
12661280 "memory.settings.extapi.title": "External API",
12671281 "memory.settings.extapi.desc": "Opens a local API so other tools (plugins, CLIs, desktop apps) can also read and write this memory store; binds to localhost only by default. Changes take effect after restarting DSH.",
12681282 "memory.settings.extapi.enabled": "Enable",
@@ -2408,9 +2422,20 @@ window.__ModuleLoader__.load({
24082422 // self-contained unit inside the stacked settings view ---
24092423 ".mneme-set-card{border:1px solid var(--dsw-alias-border-l2);border-radius:12px;padding:16px;margin-bottom:10px}",
24102424 // 设置页分组标题(个性化 / 记忆引擎 / 搜索 / 连接与安全 / 帮助):
2411- // 先给「这一段在管什么」,卡片才是具体选项
2412- ".mneme-set-grouphead{font-size:12px;font-weight:600;letter-spacing:.02em;color:var(--mneme-fg-dim);margin:24px 0 10px}",
2413- ".mneme-set-grouphead:first-child{margin-top:8px}",
2425+ // 先给「这一段在管什么」,卡片才是具体选项;scroll-margin-top 是给 #518 的粘顶目录(实测约 74px 高)留的跳转余量
2426+ // ——没有它,点 chip 滚过去的标题就停在目录背面
2427+ ".mneme-set-grouphead{font-size:12px;font-weight:600;letter-spacing:.02em;color:var(--mneme-fg-dim);margin:24px 0 10px;scroll-margin-top:84px}",
2428+ ".mneme-set-toc+.mneme-set-grouphead{margin-top:8px}", // nav 才是第一个孩子::first-child 自 #518 起永不命中
2429+ // 设置页目录(#518):分组标题 + 一栏跳转 chip。粘顶是因为设置页是整块
2430+ // 滚动的(.mneme-set 自己 overflow-y),长页里目录滚走了就等于没有——用户
2431+ // 提的诉求正是「方便直接跳转」,跳不回去的目录不算数。
2432+ // 窄屏收成横向滚动:换行会让粘顶条吃掉半屏高度,而设置页本身已经很挤。
2433+ ".mneme-set-toc{position:sticky;top:0;z-index:2;background:var(--dsw-alias-bg-base,var(--dsw-alias-bg-layer-1));padding:8px 0 10px;margin-bottom:4px;border-bottom:1px solid var(--dsw-alias-border-l2)}",
2434+ ".mneme-set-toclabel{font-size:11px;font-weight:600;letter-spacing:.02em;color:var(--mneme-fg-dim);margin-bottom:6px}",
2435+ ".mneme-set-toclist{display:flex;gap:6px;overflow-x:auto;padding:3px}", // 不 wrap:chip flex:none,窄屏横向滚;3px 给 focus ring 留位(滚动容器会裁掉描边)
2436+ ".mneme-set-tocchip{flex:none;height:26px;padding:0 10px;border-radius:13px;border:1px solid var(--dsw-alias-border-l2);background:none;color:var(--dsw-alias-label-secondary);cursor:pointer;font-family:inherit;font-size:12px;line-height:24px;transition:border-color .12s,color .12s}",
2437+ ".mneme-set-tocchip:hover{border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary)}",
2438+ ".mneme-set-tocchip:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}",
24142439 ".mneme-set-token{font-family:monospace;font-size:12px;padding:7px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-base,transparent);color:var(--dsw-alias-label-primary);word-break:break-all;user-select:all}",
24152440 ".mneme-set-hint{font-size:12px;color:var(--mneme-fg-dim)}",
24162441 // --- 重要性编辑行:与查看态同一份 Lucide 星形(此前是文本星号下拉,角更尖锐且与其他星不统一) ---
@@ -3716,6 +3741,31 @@ window.__ModuleLoader__.load({
37163741 return "Unknown";
37173742 };
37183743
3744+ // #182 / #514 注入状态探测:一处取数,两处消费(状态页告示卡、设置页提示)。
3745+ // 分成两份读同一接口会让两处的「已知/未知」判断各自漂移——#514 里用户就是在
3746+ // 设置页开关人格,却只在状态页才看得到原因。普通函数声明(会提升),这里紧
3747+ // 挨着设置页放,是为了让源码顺序和「先谁用」对得上。
3748+ function useInjectStatus() {
3749+ const [state, setState] = useState({ loading: true, suppressed: false, agentPreset: null });
3750+ useEffect(() => {
3751+ let cancelled = false;
3752+ apiFetch("/api/dsh-mneme/inject-status")
3753+ .then((res) => { if (!res.ok) throw new Error("http"); return res.json(); })
3754+ .then((j) => {
3755+ if (!cancelled) {
3756+ setState({
3757+ loading: false,
3758+ suppressed: !!(j && j.suppressed),
3759+ agentPreset: (j && j.agentPreset) || null
3760+ });
3761+ }
3762+ })
3763+ .catch(() => { if (!cancelled) setState({ loading: false, suppressed: false, agentPreset: null }); });
3764+ return () => { cancelled = true; };
3765+ }, []);
3766+ return state;
3767+ }
3768+
37193769 function SettingsContent({ t }) {
37203770 const [profile, setProfile] = react.useState("");
37213771 const [rules, setRules] = react.useState([]);
@@ -3738,6 +3788,10 @@ window.__ModuleLoader__.load({
37383788 const [personaNewName, setPersonaNewName] = react.useState("");
37393789 const [personaSaved, setPersonaSaved] = react.useState(false);
37403790 const [personaError, setPersonaError] = react.useState("");
3791+ // #514:人是在这一页开关人格的,所以「为什么关了没反应」的答案必须在
3792+ // 这一页。与状态页告示卡共用 useInjectStatus,两边口径不会各自漂。
3793+ const injectStatus = useInjectStatus();
3794+ const minimalWarn = !injectStatus.loading && injectStatus.suppressed;
37413795 // 注入预览:文本由后端渲染(GET /persona 的 preview 字段),前端只显示、不自己拼。
37423796 // 原先这里是一段前端手拼的 profile + rules 列表,注释却写着「注入生效文本」——
37433797 // 它既没有表头、没有「- 用户画像:」前缀,也完全没有人格三行,两份渲染代码必然漂。
@@ -4229,9 +4283,43 @@ window.__ModuleLoader__.load({
42294283 );
42304284 }
42314285
4286+ // 目录(#518):五项分组标题是设置页唯一的骨架,所以索引直接由这张表
4287+ // 生成,而不是再手写一遍标题——两份清单迟早会漂,而漂了的目录会把人
4288+ // 领到空处。tocRefs 是滚动目标,与渲染顺序一一对应(同一个 map 里产出)。
4289+ const tocGroups = [
4290+ { key: "personal", label: t("memory.settings.group.personal") },
4291+ { key: "engine", label: t("memory.settings.group.engine") },
4292+ { key: "search", label: t("memory.settings.group.search") },
4293+ { key: "connect", label: t("memory.settings.group.connect") },
4294+ { key: "help", label: t("memory.settings.group.help") }
4295+ ];
4296+ const tocRefs = useRef({});
4297+ function jumpToGroup(key) {
4298+ const node = tocRefs.current?.[key];
4299+ // 偏移不在这里算:标题自己带 scroll-margin-top(见 .mneme-set-grouphead)。
4300+ // 两处各量一次粘顶条高度必然对不上,跳转会把目标停在目录背后。
4301+ if (node && node.scrollIntoView) node.scrollIntoView({ block: "start", behavior: "smooth" });
4302+ }
4303+ const groupHead = (key) => h("div", {
4304+ className: "mneme-set-grouphead",
4305+ ref: (node) => { if (node) tocRefs.current[key] = node; }
4306+ }, t("memory.settings.group." + key));
4307+
42324308 return h("div", null,
4309+ h("nav", { className: "mneme-set-toc", "aria-label": t("memory.settings.toc.aria") },
4310+ h("div", { className: "mneme-set-toclabel" }, t("memory.settings.toc.label")),
4311+ h("div", { className: "mneme-set-toclist" },
4312+ ...tocGroups.map((group) => h("button", {
4313+ key: group.key,
4314+ type: "button",
4315+ className: "mneme-set-tocchip",
4316+ title: t("memory.settings.toc.jump").replace("{name}", group.label),
4317+ onClick: () => jumpToGroup(group.key)
4318+ }, group.label))
4319+ )
4320+ ),
42334321 // —— 个性化:画像 / 人格 / 规则 / 自定义指令(Agent 怎么对你) ——
4234- h("div", { className: "mneme-set-grouphead" }, t("memory.settings.group. personal") ),
4322+ groupHead(" personal"),
42354323 // 用户画像 — who the agent is talking to
42364324 h("section", { className: "mneme-set-card" },
42374325 h("div", { className: "mneme-set-title" }, t("memory.settings.profile")),
@@ -4282,6 +4370,14 @@ window.__ModuleLoader__.load({
42824370 h("section", { className: "mneme-set-card" },
42834371 h("div", { className: "mneme-set-title" }, t("memory.settings.persona")),
42844372 h("div", { className: "mneme-set-desc" }, t("memory.settings.personaHint")),
4373+ // #514:人格卡是最容易撞上宿主极简压制的地方——这里的提示比运行模式卡
4374+ // 那句更要紧,因为用户就是在这里点开关的。
4375+ minimalWarn && h("div", {
4376+ style: { marginBottom: 10, padding: "8px 10px", borderLeft: "3px solid var(--mneme-warn)", fontSize: 12, lineHeight: "18px" }
4377+ },
4378+ h("div", { style: { fontWeight: 600, color: "var(--dsw-alias-label-primary)" } }, t("memory.status.minimalPresetTitle")),
4379+ h("div", { style: { marginTop: 4, color: "var(--mneme-fg-dim)" } }, t("memory.status.minimalPresetBody"))
4380+ ),
42854381 // 卡列表:default + 各 byAgent 卡,点选切换编辑位;default 标注兜底位
42864382 h("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 } },
42874383 h("button", {
@@ -4462,7 +4558,7 @@ window.__ModuleLoader__.load({
44624558 )
44634559 ),
44644560 // —— 记忆引擎:运行模式(粗粒度)在前,功能开关(细粒度)紧随 ——
4465- h("div", { className: "mneme-set-grouphead" }, t("memory.settings.group. engine") ),
4561+ groupHead(" engine"),
44664562 // 运行模式 — light vs standard chip radios; each click PUTs and the
44674563 // change only lands after a DSH restart (green saved hint says so).
44684564 h("section", { className: "mneme-set-card" },
@@ -4472,6 +4568,10 @@ window.__ModuleLoader__.load({
44724568 mode === null && !modeError
44734569 ? h("div", { className: "mneme-set-hint" }, "…")
44744570 : h(react.Fragment, null,
4571+ // #514:用户以为「轻量」关掉了人格。两个词都会在界面上出现,不先
4572+ // 分开说,用户永远会把宿主的 minimal 记成插件的 light。
4573+ h("div", { className: "mneme-set-hint", style: { marginBottom: 8 } },
4574+ t("memory.settings.mode.hostPresetHint")),
44754575 h("div", { style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" } },
44764576 h("button", {
44774577 className: mode === "light" ? "mneme-chip mneme-active" : "mneme-chip",
@@ -4487,12 +4587,20 @@ window.__ModuleLoader__.load({
44874587 ),
44884588 mode === "light" && h("div", { className: "mneme-set-hint", style: { marginTop: 8 } },
44894589 t("memory.settings.mode.offList"))
4490- )
4590+ ),
4591+ // #514:suppressed 只在「autoInject 开着 + 宿主确实报了 minimal」时为真,
4592+ // 所以这里不是吓唬人——关掉注入的用户、preset 未知的宿主都不会看到它。
4593+ minimalWarn && h("div", {
4594+ style: { marginTop: 10, padding: "8px 10px", borderLeft: "3px solid var(--mneme-warn)", fontSize: 12, lineHeight: "18px" }
4595+ },
4596+ h("div", { style: { fontWeight: 600, color: "var(--dsw-alias-label-primary)" } }, t("memory.status.minimalPresetTitle")),
4597+ h("div", { style: { marginTop: 4, color: "var(--mneme-fg-dim)" } }, t("memory.status.minimalPresetBody"))
4598+ )
44914599 ),
44924600 // 功能开关 — 后端能力的细粒度闸门;改动即时保存,重启 DSH 后生效。
44934601 h(FeaturesCard, { t }),
44944602 // —— 搜索:语义召回 ——
4495- h("div", { className: "mneme-set-grouphead" }, t("memory.settings.group. search") ),
4603+ groupHead(" search"),
44964604 // 向量搜索 — semantic recall over an embeddings API
44974605 h("section", { className: "mneme-set-card" },
44984606 h("div", { className: "mneme-set-title" }, t("memory.settings.vectorTitle")),
@@ -4512,7 +4620,7 @@ window.__ModuleLoader__.load({
45124620 )
45134621 ),
45144622 // —— 连接与安全:外部访问 API / 面板令牌 ——
4515- h("div", { className: "mneme-set-grouphead" }, t("memory.settings.group. connect") ),
4623+ groupHead(" connect"),
45164624 // 外部访问 API — standalone HTTP service for plugins/CLI/desktop tools;
45174625 // the token is generated and kept by the backend, so it is read-only
45184626 // here with a copy affordance. Changes need a DSH restart.
@@ -4629,7 +4737,7 @@ window.__ModuleLoader__.load({
46294737 apiTokenSaved && h("div", { style: { marginTop: 8 } }, h("span", { className: "mneme-saved" }, t("memory.settings.apiTokenSaved")))
46304738 ),
46314739 // —— 帮助:支持与鼓励(图标行 + 检测更新 + star,兼当「关于」收尾) ——
4632- h("div", { className: "mneme-set-grouphead" }, t("memory.settings.group. help") ),
4740+ groupHead(" help"),
46334741 // 反馈三入口:新建 issue 预填(版本+平台)/ 邮件 / 浏览已知问题。
46344742 // 纯前端链接零后端成本;插件版本来自 /info,平台取 userAgent。GitHub
46354743 // 仓库当前没有 issue 模板,故用 issues/new?title=&body= 直接预填。
@@ -5701,15 +5809,7 @@ window.__ModuleLoader__.load({
57015809 // 主动提示,把「为什么没注入」从逐帧解压日志降为看一眼状态页。只在
57025810 // suppressed=true 时渲染——standard 会话与 preset 未知的宿主零打扰。
57035811 function InjectStatusCard({ t }) {
5704- const [state, setState] = useState({ loading: true, suppressed: false });
5705- useEffect(() => {
5706- let cancelled = false;
5707- apiFetch("/api/dsh-mneme/inject-status")
5708- .then((res) => { if (!res.ok) throw new Error("http"); return res.json(); })
5709- .then((j) => { if (!cancelled) setState({ loading: false, suppressed: !!(j && j.suppressed) }); })
5710- .catch(() => { if (!cancelled) setState({ loading: false, suppressed: false }); });
5711- return () => { cancelled = true; };
5712- }, []);
5812+ const state = useInjectStatus();
57135813 if (state.loading || !state.suppressed) return null;
57145814 return h("div", { className: "mneme-statuscard", style: { borderColor: "var(--mneme-warn)" } },
57155815 h("div", { className: "mneme-statusnum", style: { fontSize: "16px", lineHeight: "24px" } }, t("memory.status.injectSuppressed")),
0 commit comments