dsh-memu-memory 1.4.4 → 1.4.5
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/AGENTS.md +3 -1
- package/CHANGELOG.md +11 -0
- package/README.md +33 -14
- package/README.zh.md +34 -12
- package/assets/screenshots/drawer.jpg +0 -0
- package/assets/screenshots/libraries.jpg +0 -0
- package/assets/screenshots/mobile.jpg +0 -0
- package/assets/screenshots/relations.jpg +0 -0
- package/assets/screenshots/settings.jpg +0 -0
- package/assets/screenshots/webui-dark.jpg +0 -0
- package/assets/screenshots/webui-memory.jpg +0 -0
- package/docs/client-conventions.md +19 -3
- package/docs/contributing.md +4 -2
- package/docs/env-and-commands.md +9 -1
- package/docs/graph-scale.md +214 -0
- package/docs/lexicon-recall.md +100 -0
- package/docs/mcp-porting.md +8 -6
- package/docs/memory-semantics.md +35 -3
- package/docs/pending-work.md +3 -1
- package/docs/retention.md +83 -0
- package/docs/rt-index.md +452 -0
- package/docs/scale-performance.md +101 -0
- package/docs/token-budget.md +92 -0
- package/docs/troubleshooting.md +50 -11
- package/lib/auto-link/apply.js +7 -2
- package/lib/auto-link/candidates.js +32 -10
- package/lib/backup.js +67 -32
- package/lib/binding-diagnostics.js +1 -1
- package/lib/bounded-cache.js +80 -0
- package/lib/client.js +2096 -409
- package/lib/consolidation-ledger.js +21 -4
- package/lib/consolidation-worker.js +14 -1
- package/lib/cycle.js +16 -11
- package/lib/diagnostic-context.js +372 -0
- package/lib/diagnostics.js +147 -61
- package/lib/embedding-download.js +7 -8
- package/lib/engine-sources.js +286 -0
- package/lib/engine.js +23 -10
- package/lib/entity-repair.js +43 -13
- package/lib/entity-review.js +64 -0
- package/lib/environment-check.js +348 -36
- package/lib/feedback.js +25 -0
- package/lib/global-graph.js +46 -2
- package/lib/graph-adjacency-index.js +525 -0
- package/lib/graph-overview.js +293 -0
- package/lib/graph.js +658 -105
- package/lib/inbound.js +44 -15
- package/lib/index-pages.js +57 -0
- package/lib/index.js +44 -6
- package/lib/inject.js +119 -50
- package/lib/lexicon-rt-source.js +25 -0
- package/lib/lexicon-rt-worker.js +26 -0
- package/lib/lexicon-rt.js +224 -0
- package/lib/lexicon-scope.js +56 -5
- package/lib/lexicon.js +143 -54
- package/lib/local-vector-service.js +3 -0
- package/lib/maintenance-ledger.js +542 -12
- package/lib/managed-runtime.js +260 -80
- package/lib/media.js +1 -1
- package/lib/memory.js +564 -131
- package/lib/port-surface.js +96 -11
- package/lib/private.js +47 -21
- package/lib/recall-cache.js +20 -34
- package/lib/retention.js +173 -0
- package/lib/rpc.js +135 -52
- package/lib/rt-index/builder.js +209 -0
- package/lib/rt-index/format.js +231 -0
- package/lib/rt-index/manifest.js +105 -0
- package/lib/rt-index/reader.js +673 -0
- package/lib/rt-index-retention.js +151 -0
- package/lib/rt-index-service.js +283 -0
- package/lib/rt-index-worker.js +21 -0
- package/lib/salient-wake.js +55 -4
- package/lib/state.js +195 -24
- package/lib/temporal.js +39 -13
- package/lib/token-measurement.js +126 -0
- package/lib/tools.js +101 -6
- package/lib/turn-log.js +108 -3
- package/lib/webui/graph-layout-worker.js +68 -0
- package/lib/webui/graph-local-physics.js +390 -0
- package/lib/webui/graph-spatial-grid.js +64 -0
- package/lib/webui/graph-view.bundle.js +6 -1
- package/lib/webui/graph-view.js +478 -135
- package/lib/webui/graph-webgl-renderer.js +74 -0
- package/lib/webui/standalone.js +1 -1
- package/lib/worker-pool.js +30 -4
- package/package.json +3 -2
- package/scripts/acceptance-local.mjs +4 -10
- package/scripts/bench-all-libraries.mjs +47 -0
- package/scripts/check-classic-graph-browser.mjs +189 -0
- package/scripts/check-client-browser.mjs +929 -0
- package/scripts/check-graph-browser.mjs +6 -0
- package/scripts/check-graph-elastic-browser.mjs +139 -0
- package/scripts/check-memory-review-browser.mjs +124 -0
- package/scripts/entity-dedupe.mjs +19 -3
- package/scripts/graph-artifact-provenance.mjs +30 -0
- package/scripts/graph-freeze-manifest.mjs +129 -0
- package/scripts/graph-geometry-fixture.mjs +40 -0
- package/scripts/graph-physics-bench.mjs +218 -0
- package/scripts/graph-scale-bench.mjs +213 -0
- package/scripts/graph-scale-memory.mjs +48 -0
- package/scripts/graph-service-bench.mjs +72 -0
- package/scripts/make-readme-shots.mjs +17 -5
- package/scripts/preview.mjs +1 -0
- package/scripts/rebuild-rt.mjs +18 -0
- package/scripts/scale-bench.mjs +183 -0
- package/scripts/simulate-injection.mjs +47 -8
- package/scripts/verify-host-fixtures.mjs +108 -0
- package/scripts/verify-host-recovery.mjs +565 -0
- package/scripts/verify-vector-recovery.mjs +740 -0
- package/tests/auto-link-candidates.test.mjs +20 -0
- package/tests/browser.test.mjs +16 -2
- package/tests/client-export.test.mjs +16 -1
- package/tests/client-pagination.test.mjs +1495 -0
- package/tests/client-render.test.mjs +223 -28
- package/tests/consolidation-fork.test.mjs +93 -10
- package/tests/consolidation-ledger.test.mjs +17 -1
- package/tests/diagnostic-entity-candidates.test.mjs +54 -0
- package/tests/diagnostic-report.test.mjs +429 -0
- package/tests/diagnostic-wiring.test.mjs +88 -0
- package/tests/diagnostics.test.mjs +27 -0
- package/tests/embedding-download.test.mjs +44 -0
- package/tests/engine-source-settings.test.mjs +69 -0
- package/tests/engine-sources.test.mjs +145 -0
- package/tests/entity-dedupe.test.mjs +143 -0
- package/tests/entity-merge-review.test.mjs +363 -0
- package/tests/entity-merge.test.mjs +12 -4
- package/tests/entity-review.test.mjs +87 -0
- package/tests/environment-check.test.mjs +51 -1
- package/tests/feedback.test.mjs +95 -0
- package/tests/graph-adjacency-index.test.mjs +536 -0
- package/tests/graph-cascade.test.mjs +229 -0
- package/tests/graph-import-diagnostic.test.mjs +25 -0
- package/tests/graph-overview.test.mjs +709 -0
- package/tests/graph-session-authorization.test.mjs +419 -0
- package/tests/graph-view-geometry.test.mjs +426 -0
- package/tests/graph-view-scale.test.mjs +88 -0
- package/tests/graph-view.test.mjs +444 -5
- package/tests/graph.test.mjs +43 -0
- package/tests/help-page.test.mjs +128 -54
- package/tests/inbound.test.mjs +19 -0
- package/tests/index-pagination.test.mjs +113 -0
- package/tests/index-read-view.test.mjs +212 -0
- package/tests/inject-guide.test.mjs +9 -0
- package/tests/injection-dedupe.test.mjs +213 -0
- package/tests/lexicon-recall.test.mjs +641 -0
- package/tests/lexicon-rt-lifecycle.test.mjs +196 -0
- package/tests/lexicon-rt.test.mjs +468 -0
- package/tests/local-embedding-worker.test.mjs +38 -0
- package/tests/local-vector-service.test.mjs +32 -3
- package/tests/maintenance-compat.test.mjs +128 -0
- package/tests/maintenance-settlement.test.mjs +1003 -0
- package/tests/managed-memory.test.mjs +39 -11
- package/tests/managed-runtime.test.mjs +109 -0
- package/tests/memory-fields.test.mjs +24 -12
- package/tests/observed-evidence.test.mjs +52 -0
- package/tests/port-surface.test.mjs +93 -1
- package/tests/recall-cache.test.mjs +56 -3
- package/tests/recall-dedup.test.mjs +63 -2
- package/tests/retention.test.mjs +260 -0
- package/tests/rt-index-cross-library.test.mjs +230 -0
- package/tests/rt-index-integration.test.mjs +194 -0
- package/tests/rt-index-retention.test.mjs +552 -0
- package/tests/rt-index-scale.test.mjs +204 -0
- package/tests/rt-index.test.mjs +705 -0
- package/tests/salient-date-boundaries.test.mjs +121 -0
- package/tests/salient-wake.test.mjs +29 -0
- package/tests/scale-bench.test.mjs +53 -0
- package/tests/settings-plumbing.test.mjs +25 -0
- package/tests/simulate-injection.test.mjs +15 -1
- package/tests/standalone-navigation.test.mjs +44 -0
- package/tests/state.test.mjs +51 -0
- package/tests/temporal-precision.test.mjs +102 -0
- package/tests/temporal.test.mjs +10 -6
- package/tests/token-measurement.test.mjs +98 -0
- package/tests/tool-schema.test.mjs +41 -5
- package/tests/tools.test.mjs +6 -3
- package/tests/turn-token-budget.test.mjs +149 -0
- package/tests/webui-auth.test.mjs +57 -1
- package/tests/webui.test.mjs +40 -15
package/AGENTS.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
1. **不改 DSH 源码**,只用插件、公开 service、RPC、slot;只用公开扩展点。宿主差异用能力探测(方法/字段存在性),不写版本号比较;宁可降级并留一行日志,也不 fail closed(→ `docs/host-adaptation.md`)。
|
|
16
16
|
2. **不让主 agent 写全局记忆**:全局只由 curator 写,主 agent 只读。
|
|
17
17
|
3. **记忆规则与动态记忆都走 plugin 消息**:当前版本不再注册 system prompt 段;静态 guide 在回合首步以 `<memory-guide rules="…">` 投放(`rulesKey` 处理切域/改稿/压缩丢失),动态记忆走独立 plugin 消息,保护 KV cache 并让注入可折叠。
|
|
18
|
-
4. **不每步注入**:普通回合首步注入,记忆块紧跟人类消息之后;长工具回合只在出现尚未处理的真实人类消息批次时追加一次,另有受控的「回合中途补充召回」(默认每回合 ≤2
|
|
18
|
+
4. **不每步注入**:普通回合首步注入,记忆块紧跟人类消息之后;长工具回合只在出现尚未处理的真实人类消息批次时追加一次,另有受控的「回合中途补充召回」(默认每回合 ≤2 次、独立子上限并服从同 turn 总额,见 `docs/memory-semantics.md` §8.4)。工具日志、心跳不算人类消息。
|
|
19
19
|
5. **不自动删除记忆**:永久记忆移出 = 边缘化;删库必须显式确认;删会话默认只解绑。
|
|
20
20
|
6. **Python 不装进系统解释器 / 用户 site-packages**,只装 `engine/<version>/venv`,且 venv 里不留 pip(`--without-pip` 建,再用基础 Python 的 `pip --python` 指进去装)。
|
|
21
21
|
7. **不自动追最新 MemU**:只装声明版本,升级走新 venv + smoke + 切换 + 保留旧版。
|
|
@@ -89,6 +89,8 @@ npm run check # node --check + i18n + package.json + 文
|
|
|
89
89
|
| `docs/host-adaptation.md` | 宿主版本适配手册:事实来源、memu 的宿主面清单、新版本检查流程、隔离宿主验证方法与兼容注意事项 |
|
|
90
90
|
| `docs/host-versions.md` | §13 跨版本事实台账:逐构建核对表(commit/证据等级/判定/结构指纹)、宿主面 × 版本矩阵、破坏性变更账本、装载与门禁、运行时指纹口径 |
|
|
91
91
|
| `docs/pending-work.md` | §14 推迟项台账:有效限制、未验证边界及其前置条件 |
|
|
92
|
+
| `docs/scale-performance.md` | P1 只读索引、派生缓存/回退、规模脚本与 1k–100k 测量证据及未达标边界 |
|
|
93
|
+
| `docs/token-budget.md` | 同 turn 共享注入预算、整请求 usage 与记忆块估算边界、worker 域内系数及验证 |
|
|
92
94
|
| `docs/client-conventions.md` | §7:两个壳一份实现、颜色 token、控件纪律、数据与刷新、文案与结构、图谱工作台(§7.6)、合成负载(§7.7) |
|
|
93
95
|
| `docs/memory-semantics.md` | §8:三层、写入规则、全局记忆、注入(含预设会话首步 `<memory-guide>` 一次性投放)、提示词管理 |
|
|
94
96
|
| `docs/env-and-commands.md` | §9:Windows 命令环境、CRLF 规范、本地 link、引擎安装与回滚、本地向量受管运行时的安装/状态命令(§9.5)、MemU CLI 事实 |
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# 更新日志 / Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.5] - 2026-12-01
|
|
4
|
+
|
|
5
|
+
- 维护日志升级兼容:读取端接受缺少 `baseIdentity` 的旧格式记录(新版本不再因升级把老库判成损坏、每 5 分钟刷一条 `DSH_MEMU_MAINTENANCE_JOURNAL_INVALID`);快照被外部替换时改为「恢复的图像胜过预写日志」——不重放旧日志,而是把 journal 隔离为 `*.superseded-*` 并按磁盘数据重新锚定,写入立即解锁(旧契约是永久拒绝,导致一次复制/重装/旧版写入就把库锁死)。锚点与数据对不上(无法验证内容)时仍 fail-closed,另提供显式修复动作「repair-maintenance-journal」,原件另存为 `*.repaired-*`,诊断页可直接点击。
|
|
6
|
+
- 侧边栏「整理提醒」恢复失败/成功两列(`repeat(2,minmax(0,1fr))`);此前 `auto-fit + minmax(240px)` 在窄侧栏里会退化成单列。
|
|
7
|
+
- 图谱拖拽两处修正:①按住节点不动时不再积分局部物理——此前边弹簧会把落后的枝拉过来,而松手(未移动=单击)走 `restoreGesture` → `cancelLocalDrag` 把整段 saved 位置还原,表现为「被拉过来又弹回」;②拖动改为「牵引 + 松弛」而不是把整簇按原形状刚性平移:每个节点按深度保留一段有界松弛(位移的 4%/层,上限 50%、最多 64px),松弛内由边弹簧与斥力自由排布,超出才被拽走,松手后停在松弛里不回弹到原形状。拖动中收敛加入传输超出量判据与 240 步空闲上限,避免指针停顿时深支冻结。
|
|
8
|
+
- 修复同一回合把同一条人类消息注入两次:原生首步路径与 inbound 批次路径各记各的账,前者摄入的消息在宿主确认前清不出 pending,而接纳分支又无条件删掉进程内兜底标记,下一步便把它当新批次重投(第二次往往带另一批正文)。现在只对真正出队的批次删标记,未出队的保留标记,「等宿主确认才清账」的语义不变。
|
|
9
|
+
- 引擎安装新增可选镜像源链路:`uv` 二进制与受管 CPython 按平台(Windows / macOS / Linux,Linux 区分 glibc 与 musl)自动选择资产,顺序为「自定义 → USTC 镜像 → GitHub」,设置页可切「引擎下载源」,也可用 `DSH_MEMU_ENGINE_SOURCE` 等环境变量覆盖。
|
|
10
|
+
- 新增「允许镜像提供最新版本」开关:滚动镜像(只保留最新 tag)可用其 `sha256.sum` 校验后提供最新 uv / CPython;默认仍只装声明的 `0.13.6` / `3.12.14`,可复现性优先。
|
|
11
|
+
- 安装失败不再只有一句 `fetch failed`:`lib/managed-runtime.js` 逐源记录结果并透出 `cause`(`ECONNRESET`、连接超时、HTTP 404),`engine.js` 的安装状态与日志同步带真实原因。
|
|
12
|
+
- 设置页新增「引擎下载源」「自定义 uv 镜像基地址」「自定义 CPython 镜像基地址」「允许镜像提供最新版本」,中文/英文文案与 `state.js` 校验同步。
|
|
13
|
+
|
|
3
14
|
## [1.4.4] - 2026-11-29
|
|
4
15
|
|
|
5
16
|
- 修复整理预设挂载的发布事务返回值:`AgentSetup` 不再向宿主返回诊断对象——宿主会把返回值当作可选的 publication commit 并调用 `commit()`,普通对象触发 `TypeError`;诊断改由 `onResolved` 回调交付,持久 worker 恢复路径同步改用回调取值。
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
`dsh-memu-memory` is built for long-form RP and companion chats. It gives a DSH conversation a memory that behaves like memory instead of a log: three retention layers that fade, a first-turn anchor
|
|
26
|
+
`dsh-memu-memory` is built for long-form RP and companion chats. It gives a DSH conversation a memory that behaves like memory instead of a log: three retention layers that fade, a first-turn anchor, ordinary first-step recall and controlled mid-turn supplements, provenance that cannot be quietly upgraded from "I inferred it" to "they said it", contradictions that either wait for a decision or — when explicitly versioned — stay side by side with a conflict card instead of being silently merged, near-identical facts collapse to one entry and one recall seat, and an optional relationship graph with evidence. Speakers, characters, worlds and story branches form hard boundaries, and what a character is allowed to know stays separate from what actually happened.
|
|
27
27
|
|
|
28
28
|
It is **local-first by default**. The default `agent` backend stores full text in JSON indexes and recalls lexically — no Python, no embedding service, no API key. The `api` backend switches recall to the optional, pinned MemU engine (vector search). MemU is a plugin for people who want it, not a requirement for the plugin to start.
|
|
29
29
|
|
|
@@ -47,24 +47,29 @@ All screenshots are the real WebUI on isolated example data, not anyone's memori
|
|
|
47
47
|
<td align="center"><img src="assets/screenshots/webui-dark.jpg" width="470" alt="Dark theme"><br/><em>Dark theme · the same surfaces and motion</em></td>
|
|
48
48
|
</tr>
|
|
49
49
|
<tr>
|
|
50
|
-
<td align="center"
|
|
50
|
+
<td align="center"><img src="assets/screenshots/libraries.jpg" width="470" alt="Conversation memory settings"><br/><em>Conversation binding and compact scope switches</em></td>
|
|
51
|
+
<td align="center"><img src="assets/screenshots/mobile.jpg" width="360" alt="Narrow layout"><br/><em>Narrow layout · the rail folds into a horizontal strip</em></td>
|
|
51
52
|
</tr>
|
|
52
53
|
</table>
|
|
53
54
|
|
|
54
55
|
## What it remembers
|
|
55
56
|
|
|
56
57
|
- **Three layers, one timeline.** `short_term` drafts expire after 72 hours by default; `long_term` is the body of ordinary memory; `must_remember` needs a reason and a source, decays over 365 days with a 0.35 strength floor, and can be *marginalized* but never auto-deleted to make room.
|
|
57
|
-
- **
|
|
58
|
+
- **Large libraries avoid whole-index copying on pure reads.** Frozen internal views and bounded caches reduce repeated recall work; callers still receive isolated results. Lists and the wall page against a revision-checked snapshot. The graph assembles authorized pages into its classic circular layout; graph management keeps bounded pages. A disposable postings/body index supports `off`, `shadow` (default) and `on`; missing or corrupt artifacts fall back to the JSON source with diagnostics and background rebuilding. Cold directory/graph construction and synchronous full-JSON writes still have linear costs. Cache limits and measured boundaries are documented in [scale performance](docs/scale-performance.md) and [the retrieval-index contract](docs/rt-index.md).
|
|
59
|
+
- **Recall is a moment, not a dump.** The first turn after a session starts (or after compaction) gets an anchor block with budgets for pinned, core and global memory. Ordinary turns get at most one first-step recall; real inbound human-message batches and controlled long-tool-turn supplements may add recall. Mid-turn supplements default to at most two per turn and share the host-turn total budget with guide, first-step and inbound messages. Reservations stay charged only after host admission and are released if not admitted. Deduplication and a token budget are enforced in code, not left to the prompt. Anchor and recall entries are **title cards**: title, id and semantic tags only. The body stays in the drawer and behind `memu_private_recall` / `memu_global_recall`, so the same budget exposes far more memories without pasting text the model never asked for.
|
|
58
60
|
- **Invisible memories cannot crowd out visible ones.** Private lexical recall builds its scoring corpus after applying conversation context, speaker and disclosure rules, including the lexical branch of mixed recall. Explicit reads retain their disclosure permissions.
|
|
59
|
-
- **A private lexicon writes itself.** The consolidation worker extracts stable, evidenced slang, memes and project terms with one term per entry. Ordinary entries become active immediately (no human review queue), while sensitive triggers and sensitive edits stay user-only.
|
|
61
|
+
- **A private lexicon writes itself.** The consolidation worker extracts stable, evidenced slang, memes and project terms with one term per entry. Ordinary entries become active immediately (no human review queue), while sensitive triggers and sensitive edits stay user-only. Concept recall can match definitions without the literal term, using at most two lexicon seats and the shared turn budget. Automatic output excludes secret entries and sensitive definitions. A **global lexicon** sits beside the per-library ones: every eligible conversation reads it, only you write it. Same-domain cross-library rules apply to anchors, recall and search; the management page exposes domain filtering and source-aware editing. See [lexicon recall](docs/lexicon-recall.md).
|
|
60
62
|
- **Private links come from assertions, not statistics.** `autoLinkMode` defaults to *candidates only*: a local zero-token pass ranks names into a review queue and writes nothing. Once you confirm an entity, its names and aliases are matched against memory text (`entity-mention`); `conflicts_with` / `supersedes` / the same `fact_key` add field-evidence edges. Lexical similarity, shared tokens and vectors never create an edge. Confirming, renaming, merging or deleting an entity maintains its edges immediately, and a removed auto edge is suppressed so it cannot come back. Links are metadata, shown with an “Auto” badge in the graph; they never rewrite a body, write a vector or delete anything. Existing libraries migrate with `node scripts/rebuild-auto-links.mjs` (dry-run first, `--apply` takes a backup). New names proposed by a model must appear as complete quoted, introduced or delimited names in the source memory; a substring or the link note alone is insufficient. Existing names and aliases remain reusable, and rejected links leave no new entity.
|
|
61
63
|
- **A date is either an anniversary or one day.** `MM-DD` recurs every year (a birthday); `YYYY-MM-DD` fires the day before and the day itself, then is spent. Relative wording (今天 / 明天 / 下周X / 月底) is resolved against the turn's scene time and stored as an absolute date; a memory that says "tomorrow" is stored as the dated form, so an appointment does not come back every year.
|
|
62
64
|
- **Memory fades unevenly.** Recency, access count, peak and end effects, primacy, habituation and flashbulb accuracy feed one strength score. Mood is described by four components (joy / anger / sorrow / fear, summing to 1) plus arousal (intensity) and dominance (sense of control); a compound mood such as jealousy is a named mix of the four, not a new axis. Mood only reorders recall: it never enters the injected text and never rewrites a memory body. Gating is the OR of three independent conditions — the dominant share is >= 0.35, |arousal - 0.35| >= 0.1, or |dominance| >= 0.25; when none holds, both multipliers are exactly 1. Older entries carry no emotion and keep the old valence path; the four axes are never inferred back from valence. A vivid memory can be more confident than it is accurate, and the UI says so.
|
|
63
65
|
- **Provenance is a fact, not a style.** Every entry carries `source` / `source_kind` (`user_said` / `assistant_said` / `told` / `imagined` / `inferred` / `tool`), `speaker_id`, `confidence`, `accuracy`, and disclosure rules. A vague recollection cannot impersonate a quote, and the assistant's own promises or plans cannot be filed as something the user said.
|
|
64
66
|
- **Contradictions do not get silently merged.** An ordinary contradiction still lands as `pending_review`: it is not injected, not recalled, and appears in a review queue until someone accepts or rejects it. When the writer explicitly marks two statements as versions of one fact (`conflicts_with`), both stay active, are recalled together and surface as a conflict card; an explicit `supersedes` retires the old row without deleting its text.
|
|
67
|
+
- **Restricted portable reads.** Session-less adapters using `dsh-memu-memory/port` only see eligible, shared entries without channel, character, world, branch or `knownBy` restrictions. Lists and recalls enforce the same boundary; raw engine records and inaccessible relationship placeholders are omitted. Raw indexes and destructive lifecycle operations remain on the internal management surface. The WebUI keeps its existing ability to manage secret, archived and review entries. See [the port contract](docs/mcp-porting.md).
|
|
65
68
|
- **Secrets stay excluded.** `secret` visibility, group-chat channels, characters, worlds, branches and `knownBy` all constrain reads and edits. Automatic recall never injects a `secret` memory, and a `secret` is still readable by an explicit recall from the same folder — it hides a memory from the prompt, it is not a lock. What actually separates two conversations in one folder is the `context` scope (`channelId` / `characterId` / `worldId` / `branchId`); a blank scope on both sides means one shared scope, which is the point of a folder. The old `visibility: 'session'` level is gone — reading turns it into `shared` with its `context` untouched, and `node scripts/migrate-visibility.mjs` rewrites libraries that still store it (`--apply`, backs up first).
|
|
66
69
|
- **People and stories are structured.** Group chat uses stable `speakerId` / `channelId`, not display names. RP uses `characterId` / `worldId` / `branchId`. Relationships are edges with a note and confidence, entities can be renamed without rewriting memory bodies, and the current relationship state (familiarity, trust, warmth, boundaries, promises) is a snapshot that keeps its history and evidence.
|
|
67
70
|
- **Images are pointers and captions, not pretend vision.** Attachments are deduplicated by SHA-256, quota-limited and tiered; an image without a description is remembered as "received an image", never as a scene the model did not see.
|
|
71
|
+
- **Missing attachments are reversible evidence.** When all referenced blobs are missing, recall strength and displayed accuracy receive the same modest discount. Restoring the blobs removes that derived discount; the fact record is never rewritten to pretend the attachment was observed.
|
|
72
|
+
- **Feedback keeps its scope.** `memu_private_feedback` records evidence-grounded confirmation, denial or irrelevance for the currently bound private library. Denial may marginalize an entry, but never deletes it or rewrites its fact. A duplicate update rejected by deduplication is retained as a reviewable draft. See [memory semantics](docs/memory-semantics.md).
|
|
68
73
|
- **Housekeeping happens in the background.** Consolidation runs in a seeded fork sub-session, never as an editable turn in your chat. Failed runs back off instead of reporting success. Unsupported reasoning-effort combinations are remembered across restarts and omitted on the next fork/new worker, including inherited settings; a new provider/model/effort combination may still fail once before it is learned.
|
|
69
74
|
|
|
70
75
|
### Lifecycle maintenance and media delivery
|
|
@@ -89,9 +94,15 @@ The sidebar has exactly **one** entry: **MemU WebUI**. The memory wall and all s
|
|
|
89
94
|
|
|
90
95
|
**In-place work.** Clicking a memory card opens a right-side drawer with the full text and the fields that decide how it behaves — title, content, tags, disclosure, confidence, open loop — plus save, archive, restore and "open in the browser" for heavier work. Archived memories can be deleted in the same drawer; the first click only arms it and the second confirms. Global memories keep their curator-written content read-only in the drawer, but archive, restore and two-step permanent delete work there just like private ones, and link to their own page. Filters and scroll position stay where they were. Cards that carry images use the first usable attachment as a cover, and the drawer opens the full gallery; `secret` and `never_say` entries never receive a pixel URL, so they show a label instead.
|
|
91
96
|
|
|
92
|
-
**One page for the graph.** **Relations** is its own full-screen page in the WebUI (`#/settings/graph`): the canvas on the left, the inspector on the right, and a **Manage** tab using the same domain and search filters. **All libraries** combines private libraries with separate identities for same-id nodes and
|
|
97
|
+
**One page for the graph.** **Relations** is its own full-screen page in the WebUI (`#/settings/graph`): the canvas on the left, the inspector on the right, and a **Manage** tab using the same domain and search filters. **All libraries** combines private libraries with separate identities for same-id nodes; edits use each node's owning library, and creating a node requires choosing a library. With no private libraries, it falls back to a read-only global index. The canvas uses the original flower-and-ring layout with round nodes. It assembles every authorized page, retaining links across page boundaries; zoom and pan keep the complete graph. Fit and minimum zoom adapt to the graph's extent. Loading and browser memory therefore grow with the selected graph; the aggregate API and bounded management pages remain available. Off-screen fixed positions use a bounded cache scoped to the authorized view. The editable **Domain** filter accepts built-in or custom domains (for example `coding` or `project:travel`), matches the full normalized name, and shows all domains when empty. Missing memory domains count as `general`; a filtered entity appears when linked to a matching memory. Source and rule filters narrow displayed edges. Settings → Relations opens this page; graph browsing retains the existing library and session authorization boundaries.
|
|
93
98
|
|
|
94
|
-
The graph runs on a **self-written continuous force engine**
|
|
99
|
+
The graph runs on a **self-written continuous force engine** with no bundled third-party runtime. Within the same view scope, background refreshes preserve node positions and the camera; after cooling it stops scheduling frames. Dragging a node leads its entire connected flower through damped elastic motion, with downstream lag and bounded link extension. Connected branches are no longer cut off at 384 nodes or 8192 edges; unrelated components wake only on actual collision. A settled held drag sleeps and resumes on the next pointer move; reduced-motion settings do not run a persistent physics loop. Releasing keeps the grabbed node at its drop while branches catch up. A later drag can pull earlier soft anchors; explicit right-click locks remain fixed. Dense graphs or conflicting pinned positions can leave unresolved overlap, and complete connected components can cost more to simulate. See [measured behavior and limits](docs/graph-scale.md). Repulsion, link distance and centering are adjustable, labels avoid collisions, and the minimap repaints only after the canvas does. At minimum zoom, nodes necessarily merge on screen; spread clusters with repulsion/link distance. The graph page supports adding, editing and deleting nodes, filtering recorded edges, and reviewing **entity merge candidates**. Similar spellings are only candidates: model decisions require visible evidence, and manual merge or exclusion requires two clicks. The layout itself never infers or writes relationships; merging redirects links and folds aliases without deleting memory.
|
|
100
|
+
|
|
101
|
+
**Automatic entity reviews.** Unreviewed candidates go to the owning conversation's model during idle maintenance, using the configured consolidation executor in batches of up to four. No manual submission is needed. Clear evidence permits merge or exclusion; uncertain or high-risk identity decisions become persistent `hold` items. The Memories page defaults to **All libraries** and labels each pair with its library; only held decisions appear in sidebar reminders. Unchanged held evidence is not repeatedly submitted, while new evidence reopens the review. Automatic review follows the idle consolidation switch, backs off on failure, and never advances the normal transcript checkpoint. Manual merge or exclusion still requires two clicks and a fresh review token. Exclusion is reversible; merging redirects links and folds aliases without deleting memory.
|
|
102
|
+
|
|
103
|
+
**Runtime alerts track recovery.** Historical `LOCAL_VECTOR_RUNTIME_ABSENT` alerts are settled automatically after a real local embedding health check succeeds. File presence alone is not treated as success, diagnostic history is preserved, and new failures can alert again. Mirror fallback explicitly replaces an inherited Python download mirror and continues after per-source command errors.
|
|
104
|
+
|
|
105
|
+
Node management has its own **All libraries** target and labels each row's owning library. It pages 60 rows at a time; adding a node still requires a concrete library. Memory rows show lifecycle state, including archived and suppressed, while entity rows show entity review state. Candidate scans return at most 20 pairs after at most 4096 comparisons, with a continuation for larger scans. A candidate `total` is exact only when `totalExact` is true; otherwise the discovered count is a lower bound. Classic canvas pages use up to 3000 nodes from the first request and reuse bounded derived models across libraries; a complete canvas still grows with the selected data. See the [cross-library measurements](docs/graph-scale.md).
|
|
95
106
|
|
|
96
107
|
| Page | What it is for |
|
|
97
108
|
|---|---|
|
|
@@ -99,7 +110,7 @@ The graph runs on a **self-written continuous force engine** — no third-party
|
|
|
99
110
|
| Engine & connection | Optional MemU engine install/switch, embedding endpoint, backups and restore; local runtime download shows MB/s, offers npmjs / npmmirror, and supports pause, stop and resume |
|
|
100
111
|
| Memory settings | Injection mode, token budgets, topK, same-domain cross-library recall, relevance threshold, retention, open-loop cadence, freshness hint, date wake-up, automation |
|
|
101
112
|
| Folders | Folder-level private/global ceiling, expandable conversations and their own switches |
|
|
102
|
-
| Libraries |
|
|
113
|
+
| Libraries | Conversation and library binding in grouped rows, compact scope switches, domain/context settings; create, rename, archive, restore and explicitly delete libraries |
|
|
103
114
|
| Memory browser | Full-text editing, attachments, review queue, graph and bounded canvas, JSON/ZIP import/export |
|
|
104
115
|
| Global memory | Domain-scoped global memories, evidence, review queue and the separate curator; every row can jump to the wall |
|
|
105
116
|
| Prompts | General / RP / Coding / Mixed variants, overrides and per-key reset; unanswered conversations use preset/folder detection; the first-run prompt lets you choose the domain |
|
|
@@ -109,7 +120,7 @@ Settings save as you change them (250 ms debounce), with about 2.5 s cross-windo
|
|
|
109
120
|
|
|
110
121
|
### Injection token budgets
|
|
111
122
|
|
|
112
|
-
`anchorTokens` and `turnTokens` bound anchor and recall content independently (default 800 each). `injectionTotalTokens` caps
|
|
123
|
+
`anchorTokens` and `turnTokens` bound anchor and recall content independently (default 800 each). `injectionTotalTokens` caps all new memory plugin messages in the same host turn (default 2000), including guide, first-step, inbound and mid-turn additions; recall and `midTurnTokens` remain independent sub-limits within that total. Title cards spend far fewer tokens per entry than full text, so the same budget exposes more memories; the budget itself was deliberately not increased in 1.2.2. Actual memory-block tokens remain unverified: whole-request usage is observed separately and never treated as memory-only calibration; see [token budget and measurement boundaries](docs/token-budget.md).
|
|
113
124
|
|
|
114
125
|
### Time-sensitive memory (1.2.3)
|
|
115
126
|
|
|
@@ -161,7 +172,7 @@ npx @deepseek-ai/dsh web
|
|
|
161
172
|
|
|
162
173
|
### Method 3 — from a local checkout (development)
|
|
163
174
|
|
|
164
|
-
The repository has **
|
|
175
|
+
Most JavaScript in `lib/` runs directly. The repository has **one build step: the graph-engine bundle**; after changing `lib/webui/graph-view.js` or its engine modules, run `npm run build:graph`. Clone it, link the checkout into your DSH profile, and add the bundle.
|
|
165
176
|
|
|
166
177
|
```sh
|
|
167
178
|
git clone <this repository> dsh-memu-memory
|
|
@@ -184,7 +195,7 @@ In the profile's `package.json`:
|
|
|
184
195
|
}
|
|
185
196
|
```
|
|
186
197
|
|
|
187
|
-
Then restart DSH
|
|
198
|
+
Then restart DSH to load the symlinked checkout. Rebuild graph source changes before restarting: a restart alone does not regenerate `graph-view.bundle.js`.
|
|
188
199
|
|
|
189
200
|
### Optional — vector engine (MemU)
|
|
190
201
|
|
|
@@ -206,7 +217,7 @@ The default `memoryBackend="agent"` uses lexical recall and does not call an emb
|
|
|
206
217
|
|
|
207
218
|
`memoryMode` (`local` / `cloud`) is a MemU storage-compatibility setting, not the embedding switch or source selector; its cloud option is not a claim that managed local inference is offline cloud storage. Summary generation is configured independently of the vector route: ordinary private consolidation uses an Agent fork; an explicit remote-summary action uses its chat endpoint and commits through the same memory write path. Recall uses neither LLM reranking nor an LLM fallback. Exact memory ids still use the direct path; the plugin does not maintain a parallel vector database.
|
|
208
219
|
|
|
209
|
-
Managed model download, progress reporting and profile-switch/migration flows are implemented
|
|
220
|
+
Managed model download, progress reporting and profile-switch/migration flows are implemented. An **R3 pre-freeze isolated run** on DSH rc.5 exercised native local embedding and MemU retrieval using an installed runtime/model and isolated database copies (49 checks); see the recorded evidence and boundaries. That run did not download new artifacts or verify every switching/migration path. **Final acceptance awaits central verification against the same frozen tree**; the R3 result is not a final pass. A candidate or `pending` artifact is not available for use; it must not be advertised as downloadable or ready until its artifact and validation gates pass.
|
|
210
221
|
|
|
211
222
|
## First run
|
|
212
223
|
|
|
@@ -220,16 +231,22 @@ Folder policy is a **ceiling, not an initial value**: turning a folder switch of
|
|
|
220
231
|
|
|
221
232
|
## Model tools
|
|
222
233
|
|
|
234
|
+
The current model surface contains 17 tools:
|
|
235
|
+
|
|
223
236
|
| Tool | Purpose |
|
|
224
237
|
|---|---|
|
|
225
238
|
| `memu_private_remember` | Write a private memory, with source, layer, disclosure, visibility, tags, open loop and attachment references |
|
|
226
|
-
| `
|
|
239
|
+
| `memu_private_remember_batch` | Write multiple private memories with shared `defaults` and per-item results |
|
|
240
|
+
| `memu_private_recall` | Keyword snippets with a separate lexicon section (up to 2 rows, `[lex:termId]` and `matchedBy`), or exact-id body pages (`view`, `offset`, `limitChars`, `revision`, optional allowed `libraryId`); search `topK` is a hard 1–20 row limit, conflicts use pointers |
|
|
227
241
|
| `memu_private_list` | List the memories usable in the current scope |
|
|
228
242
|
| `memu_private_update` | Edit, without bypassing pin admission, review or visibility rules |
|
|
243
|
+
| `memu_private_feedback` | Record explicit confirmation, denial or irrelevance with a reason in the bound private library; never infer feedback from silence or delete a memory |
|
|
229
244
|
| `memu_private_archive` | Archive; never delete |
|
|
230
245
|
| `memu_private_unpin` | Marginalize a permanent memory with a first-person reason, quota and cooldown |
|
|
231
246
|
| `memu_private_link` | Link memories/entities with evidence, or update a relationship snapshot; also adjudicates uncertain `memu_private_link_suggest` candidates; cannot delete edges |
|
|
232
247
|
| `memu_private_link_suggest` | Refresh deterministic edges (confirmed-entity mentions and field evidence) for ids written this consolidation and return only uncertain candidate pairs |
|
|
248
|
+
| `memu_private_entity_merge_suggest` | Read a bounded batch of similar-entity candidates with visible linked-memory summaries and relationship evidence; names are discovery signals only |
|
|
249
|
+
| `memu_private_entity_merge_decide` | Merge, reject or hold one exact candidate using its current review token and visible evidence; weak confidence becomes hold |
|
|
233
250
|
| `memu_lexicon_search` | Search active lexicon terms this conversation can see: bound library + global lexicon (+ same-domain libraries when cross-library recall is on); archived and tombstoned terms stay hidden |
|
|
234
251
|
| `memu_lexicon_propose` | Add or update a lexicon term in the bound library (never the global lexicon); ordinary entries become active immediately, sensitive triggers remain user-only |
|
|
235
252
|
| `memu_global_recall` / `memu_global_list` | Read the global layer by domain; recall supports snippets or versioned exact-id body pages without broadening eligibility |
|
|
@@ -265,6 +282,8 @@ The main agent has **no global write tool**. Global memories are produced only b
|
|
|
265
282
|
|
|
266
283
|
## External messages in a long tool turn
|
|
267
284
|
|
|
285
|
+
Native first-step input and inbound delivery share admission receipts. Once its memory message reaches history, delayed human-message notifications cannot trigger the same recall again, including across turns or restarts. Unproven native backlog stays queued until the exact human input returns or the host admits it; failed proposals remain retryable. Deferred image references retain their own pending ownership.
|
|
286
|
+
|
|
268
287
|
A host turn may remain open while a third-party tool waits for messages.
|
|
269
288
|
New human input can trigger one bounded recall at the next model step without
|
|
270
289
|
ending that turn or making another model call. Native user messages work directly.
|
|
@@ -316,7 +335,7 @@ the idle window starts from real message activity or the agent's return to idle.
|
|
|
316
335
|
|
|
317
336
|
## Compatibility & limits
|
|
318
337
|
|
|
319
|
-
- **Host:** DSH `>=0.2.0-rc.1`, using public extension points only (tools, injection, session query, subagents, slots, a prefixed HTTP route). No host source modifications. The
|
|
338
|
+
- **Host:** DSH `>=0.2.0-rc.1`, using public extension points only (tools, injection, session query, subagents, slots, a prefixed HTTP route). No host source modifications. The current memory tool surface contains 17 `memu_*` tools; the original `0.2.2-rc.1` verification on 2026-11-05 covered 13 tools, so that historical record is not the current tool count. The check table lives in [`docs/host-adaptation.md`](docs/host-adaptation.md). The optional dated-wake feature uses the host-wide `ctx.schedule` task API introduced in `0.2.2`; on `0.2.0`–`0.2.1` (session-scoped reminders) it detects the older shape and skips with one warning instead of retrying every sweep.
|
|
320
339
|
- **Recall quality:** the default backend is lexical. Semantic recall depends on the optional engine and the embedding model you choose; the plugin cannot improve a model it does not own. LongMemEval, long-running group-chat A/B and "human-likeness" scores have **not** been run — test counts are not a quality score. A clear lexical topic match can outweigh rank-flattened competitors; recognised QQ/response-style scaffolding is excluded from that dominance evidence, but arbitrary templates and languages are not semantically understood.
|
|
321
340
|
- **No cloud sync, no accounts, no cross-device sync.** This is a local plugin with no server-side identity.
|
|
322
341
|
- **Images without vision:** without an optional caption/vision endpoint, an image memory is a pointer plus what a person wrote about it. The plugin does not claim to see pixels.
|
|
@@ -334,9 +353,9 @@ the idle window starts from real message activity or the agent's return to idle.
|
|
|
334
353
|
|
|
335
354
|
```sh
|
|
336
355
|
npm ci --legacy-peer-deps
|
|
356
|
+
npm run build:graph # rebuild shipped offline assets after graph source changes
|
|
337
357
|
npm test # full suite; the isolated real-engine case skips unless configured
|
|
338
358
|
npm run check # syntax + i18n key alignment + package.json
|
|
339
|
-
npm run build:graph # rebuild shipped offline assets after graph source changes
|
|
340
359
|
node scripts/acceptance-local.mjs # 50 automated acceptance checks
|
|
341
360
|
node scripts/migrate-visibility.mjs # report (add --apply to rewrite) libraries that still store the removed session level
|
|
342
361
|
node --import ./tests/loader-register.mjs scripts/preview.mjs --port 7789
|
package/README.zh.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
`dsh-memu-memory` 面向长篇 RP 与陪伴对话,给 DSH
|
|
26
|
+
`dsh-memu-memory` 面向长篇 RP 与陪伴对话,给 DSH 一份「像记忆」的记忆,而不是一本日志:三种留存层会淡;首轮有锚点,普通回合首步召回,长工具回合可受控中途补充;来源不能被悄悄从「我推断」升级成「对方说过」;互相矛盾的记忆会挂起等待裁决,明确标成同一事实的两个版本则并排保留并给出冲突卡,而不是被悄悄合并;几乎相同的事实只入一条、召回时同簇只占一席;关系可以是一条带证据的边。说话人、角色、世界线与剧情分支构成硬边界,角色「知道什么」与实际发生过什么分开保存。
|
|
27
27
|
|
|
28
28
|
默认**本地优先**。`agent` 后端把完整正文放在 JSON 索引里、用词法检索——不需要 Python、embedding 服务或 API key。`api` 后端才把检索交给可选的、锁定版本的 MemU 引擎(向量)。MemU 是「想要就用」的后端,不是插件能否启动的前提。
|
|
29
29
|
|
|
@@ -47,23 +47,29 @@
|
|
|
47
47
|
<td align="center"><img src="assets/screenshots/webui-dark.jpg" width="470" alt="深色主题"><br/><em>深色主题 · 同一套层次与动效</em></td>
|
|
48
48
|
</tr>
|
|
49
49
|
<tr>
|
|
50
|
-
<td align="center"
|
|
50
|
+
<td align="center"><img src="assets/screenshots/libraries.jpg" width="470" alt="会话记忆设置"><br/><em>会话绑定 · 紧邻文字的范围开关</em></td>
|
|
51
|
+
<td align="center"><img src="assets/screenshots/mobile.jpg" width="360" alt="窄屏"><br/><em>窄屏 · 侧栏折成横向标签</em></td>
|
|
51
52
|
</tr>
|
|
52
53
|
</table>
|
|
53
54
|
|
|
54
55
|
## 它记住什么
|
|
55
56
|
|
|
56
57
|
- **三层,一条时间线。** `short_term` 草稿默认 72 小时到期;`long_term` 是记忆主体;`must_remember` 需要理由与来源,按 365 天半衰并带 0.35 强度地板,可以**边缘化**,但不会为腾名额被自动删除。
|
|
57
|
-
-
|
|
58
|
+
- **大库纯读减少整库复制。** 内部冻结视图与有界缓存减少重复召回开销,调用方仍拿独立结果。列表和记忆墙按带修订号的快照分页;图谱按授权分页拼回完整的经典圆环,管理列表保留有界分页。可重建的倒排/正文索引支持 `off`、`shadow`(默认)和 `on`;产物缺失或损坏时带诊断回退真库,并排队后台重建。冷排序目录、图谱派生与同步整库 JSON 写入仍有线性成本。容量、回退和实测边界见[规模性能说明](docs/scale-performance.md)与[派生索引契约](docs/rt-index.md)。
|
|
59
|
+
- **召回是一个瞬间,不是一次倾倒。** 新会话或压缩后的第一个回合得到锚点块(pin / core / global 分段预算);普通回合首步至多召回一次,真实 inbound 人类消息批次与长工具回合的受控中途补充可追加召回。中途补充默认每回合最多两次,与 guide、首步及 inbound 共用同一宿主回合总预算;宿主接纳后才保留扣额,未接纳则释放预留。去重与 token 预算由代码执行,不交给提示词自觉。
|
|
58
60
|
- **不可见的记忆挤不掉可见的。** 私库词法召回(含混合召回的词法分支)在构建评分语料之前就应用会话可见性、说话人与披露资格;隐藏条目不参与词频统计,也不能触发高频剪枝。显式读取保留原有读取资格。
|
|
61
|
+
- **词典可以按概念召回。** 没说出词面时,也能通过释义命中;独立词典腿每回合最多两槽,并服从同一份总注入预算。自动输出排除 secret 与敏感释义,同域跨库和全局规则与记忆一致;管理页支持域筛选,并按真实来源编辑。详见[词典召回契约](docs/lexicon-recall.md)。
|
|
59
62
|
- **日期要么是纪念日,要么是一天。** `MM-DD` 每年复发(生日);`YYYY-MM-DD` 在前一天和当天各响一次,之后就算用过了。说「今天 / 明天 / 下周X / 月底」的相对日期会按这一轮的场景时间换算成绝对日期再存;说「明天」的记忆存成带年份的日期,不会变成每年都冒出来的周年。
|
|
60
63
|
- **记忆会不均匀地淡。** 新近、访问次数、峰终、首因、习惯化、闪光灯记忆的准确度共同参与强度。情绪用四项构成(joy / anger / sorrow / fear,和为 1)加唤醒度 `arousal`(强度)与掌控感 `dominance` 描述;「嫉妒」这类复合情绪是四项的具名混合比例,不是新维度。情绪只影响召回排序:不进注入文本,也不改记忆正文。门控是三条独立条件的 OR——主导项占比 ≥ 0.35、`|arousal − 0.35| ≥ 0.1`、`|dominance| ≥ 0.25`;三条都不满足时两项乘数恒为 1。旧条目没有 emotion 时继续走原来的 valence 路径,不从旧 valence 反推四轴。一条生动但可能记错的记忆会显示「细节未必准」,而不是假装确定。
|
|
61
64
|
- **来源是事实,不是文风。** 每条记忆带 `source` / `source_kind`(`user_said` / `assistant_said` / `told` / `imagined` / `inferred` / `tool`)、`speaker_id`、`confidence`、`accuracy` 与说出口径。模糊的推断不能冒充原话,助手自己的承诺和计划也不能记成用户说的。
|
|
62
65
|
- **矛盾不会被悄悄合并。** 普通矛盾仍进入 `pending_review`:不注入、不召回,只出现在复核队列,等人或整理作业裁决。写入方明确把两种说法标成同一事实的版本(`conflicts_with`)时,两条都保持 active、一起召回并注入一张冲突卡;显式 `supersedes` 才退休旧条,正文不删。
|
|
66
|
+
- **移植读取有身份边界。** 无会话适配器通过 `dsh-memu-memory/port` 读取时,列表与召回只返回具备读取资格、非 secret、且不受频道/角色/世界/分支/knownBy 限制的条目;原始引擎结果和不可见关系占位不外泄。原始索引与删除生命周期能力保留在内部管理面,WebUI 仍可管理 secret、归档和待复核条目。契约见 [移植说明](docs/mcp-porting.md)。
|
|
63
67
|
- **秘密不进自动召回。** `secret`、群聊频道、角色、世界线、剧情分支与 `knownBy` 共同约束读写;`secret` 永远不会被自动注入,但同文件夹里**主动检索仍然读得到**——它挡的是「自己冒出来」,不是保险箱。真正把同一文件夹里的两段对话隔开的是 `context` 作用域(`channelId` / `characterId` / `worldId` / `branchId`);两边都没填就是同一个作用域,这正是「文件夹」的含义。旧的 `visibility: 'session'` 级别已删除:读到就按 `shared` 处理、`context` 原样保留,仍存着该级别的库用 `node scripts/migrate-visibility.mjs` 重写(`--apply` 才写,先备份)。
|
|
64
68
|
- **人与故事是有结构的。** 群聊用稳定的 `speakerId` / `channelId`,不拿显示名当身份;RP 用 `characterId` / `worldId` / `branchId` 隔离知识。关系边有理由和置信度,实体改名不动记忆正文,关系当前状态(熟悉、信任、温度、边界、承诺)是带证据和历史快照。
|
|
65
69
|
- **关联只来自已确认的实体与字段证据。** 设置里的「自动关联」默认只出候选、不写边;你确认过的实体名/别名才会把已有记忆的提及连起来(`entity-mention`),冲突/取代/同 `fact_key` 的相邻版本则建立字段证据边。词面相似、共享 token 与向量永远不建边;候选队列在节点图页审核。旧库的统计噪声边用 `node scripts/rebuild-auto-links.mjs` 先 dry-run、确认后 `--apply`(自动备份)清理;删掉的自动边会写进抑制表,不会复活。
|
|
66
70
|
- **图片是指针加描述,不是假装能看图。** 附件按 SHA-256 去重、有配额、分三级留存;没有描述时只记「收到一张图片」,绝不编造画面。
|
|
71
|
+
- **附件缺失是可逆的证据折扣。** 全部引用文件都缺失时,召回强度与展示准确度采用同一小幅折扣;文件恢复即撤回派生折扣,不改写真库事实。
|
|
72
|
+
- **反馈不越过绑定边界。** `memu_private_feedback` 只记录当前绑定私库的确认、否认或不相关反馈,并要求观察依据;否认可令条目边缘化,不删除或改写事实。被去重拒绝的更新保留为可复核草稿。详见[记忆语义](docs/memory-semantics.md)。
|
|
67
73
|
- **整理在后台。** 整理跑在种子 fork 子会话里,不会在你的待发区多出一轮;失败退避重试,不伪记成功。不支持的思考档位组合会跨重启记住,下次 fork/新 worker 会移除该档位,继承来的值也检查;新服务商/模型/档位组合仍可能首次失败后才学习。
|
|
68
74
|
|
|
69
75
|
### 生命周期维护与图片引用投放
|
|
@@ -88,9 +94,15 @@
|
|
|
88
94
|
|
|
89
95
|
**原地操作。** 点记忆卡片会从右侧滑出详情抽屉:完整正文,以及决定它行为的字段——标题、正文、标签、说出口径、置信度、未了之事——外加保存、归档、恢复,以及需要重编辑时的「在记忆浏览中打开」。已归档的记忆可以直接在抽屉里删除:第一次点击只是准备,第二次才真正删除。全局记忆的正文仍由整理器书写、在抽屉里只读,但归档、恢复与两段确认的永久删除与私有记忆同权,并给出跳转。筛选条件与滚动位置保持不动。带图片的卡片会把第一张可用附件作为封面,抽屉里展开完整图片组;`secret` 与 `never_say` 条目不会拿到像素 URL,只显示标签占位。
|
|
90
96
|
|
|
91
|
-
**图谱单独一页。** 「关系图谱」是 WebUI 里一个全屏页面(`#/settings/graph`):左边画布、右边检视面板,列表视图在同页的**管理**页签下,用的是同一套筛选。来源(全部 / 仅自动 /
|
|
97
|
+
**图谱单独一页。** 「关系图谱」是 WebUI 里一个全屏页面(`#/settings/graph`):左边画布、右边检视面板,列表视图在同页的**管理**页签下,用的是同一套筛选。来源(全部 / 仅自动 / 仅手动)、规则、记忆库与搜索都在收窄同一份数据,不是要记得切换的模式;设置里的「关系图谱」只有一个按钮,点了直达这一页。范围选择器的**全部记忆库**聚合私有库,同 id 节点按所属库区分,编辑按节点真实所属库写入,新增须选择目标库;没有私有库时才回退到只读全局索引。画布恢复旧版花瓣圆环与圆形节点,自动读完当前授权范围的分页,并保留跨页连线;缩放和平移只改变视角,适应全图与最小缩放按实际范围调整。完整图谱的加载时间与浏览器内存随所选数据规模增长,聚合接口与管理列表的有界分页仍保留;离屏固定坐标使用按授权视图区分的有界缓存。
|
|
92
98
|
|
|
93
|
-
图谱用的是**自研的连续力导向引擎**,bundle
|
|
99
|
+
图谱用的是**自研的连续力导向引擎**,bundle 里没有第三方运行时:同一视图作用域内,后台数据刷新保留节点位置与视角,冷却后停止自行申请帧。拖点带领整个连通簇弹性跟随,后续分支有滞后和阻尼,连线有延伸限制;不再用 384 节点或 8192 条边截断连通分支,只有实际碰撞才会唤醒无关簇。拖动稳定后会暂停申请帧,继续移动鼠标时沿用同一物理会话;减少动态效果设置不会启动持续动画。松手后拖点保持落位,后面的分支继续追上;下一次拖动可牵引以前的普通落点,右键锁定点仍保持固定。密集图或相互冲突的固定位置可能留下重叠,完整连通分量的模拟开销也会增加,详见[实测与限制](docs/graph-scale.md)。斥力、连线距离、向心力在面板里可调,标签自动避让,缩略图只在主画布重绘后才更新。缩到最小时节点在屏幕上必然会压在一起——间距是世界坐标里的,要拉开簇请用斥力/连线距离,而不是缩放。设置里的「关系图谱」只有一个按钮,点开就是 WebUI 的全屏图谱页,那里还能新增/编辑/删除节点,并按生成这条边的规则筛选。图谱布局只表达已记录的关联,不会推断或写入新的关系。实体可以直接在图谱里删除(仍被引用时会明确拒绝);永久删除一条记忆会连带清理指向它的边与孤立实体,孤立节点有启动扫描自动回收。节点图页会列出**实体合并候选**(同 kind、名称包含或写法相近),供整理 worker 与用户核对;整理时优先依据当前任务可见的记忆和关系证据自动裁决:明确同一才合并,明确不同才排除。名称相似或兄妹关系本身不足以证明同一身份;身份严重错配风险或证据不足时转为 `hold`,由用户复核。合并只改指向并合并别名,不删除记忆。
|
|
100
|
+
|
|
101
|
+
**待 AI 处理的候选自动交给对应会话的模型。** 空闲维护复用已有整理执行器,每批最多4对,无需手动提交;明确同一才合并,明确不同才排除,身份风险或证据不足才持久保存为 `hold`。该流程服从「空闲整理」开关,失败退避重试,不推进正常对话整理的检查点。MemU 记忆页默认可看「全部记忆库」,每对候选标明所属库;侧边栏只提醒需要人工复核的 `hold`,未变化的保留证据不会反复提交,有新证据才重新交给模型。人工合并或排除仍需二次确认和有效签名。裁决在本库保存;排除可恢复,合并不删除记忆。
|
|
102
|
+
|
|
103
|
+
**运行时恢复后自动消除旧提醒。** 历史 `LOCAL_VECTOR_RUNTIME_ABSENT` 只有在本地向量实际返回正确维度的健康检查结果后才自动确认,诊断记录保留,新故障仍会提示;安装镜像逐源回退时也显式覆盖继承的Python镜像,单源命令抛错不再阻断后续来源。
|
|
104
|
+
|
|
105
|
+
图谱管理的目标库也能独立选「全部记忆库」,每行标明所属库,按60条有界分页;新增节点仍须选定具体库。候选每批最多返回20对、最多比较4096对,大库可继续扫描;只有 `totalExact` 为真时 `total` 才是精确总数。经典画布从首批起按最多3000个节点读取,并跨库复用有容量限制的派生缓存;完整画布的加载与内存仍随数据量增长,实测见[跨库性能](docs/graph-scale.md)。
|
|
94
106
|
|
|
95
107
|
| 页面 | 用途 |
|
|
96
108
|
|---|---|
|
|
@@ -98,7 +110,7 @@
|
|
|
98
110
|
| 引擎与连接 | 可选 MemU 引擎的安装与切换、embedding 配置、备份恢复;本地运行时下载显示 MB/s,可选 npmjs / npmmirror,支持暂停、停止与续传 |
|
|
99
111
|
| 记忆设置 | 注入模式、token 预算、topK、同领域跨库召回、相关度下限、留存、未了之事复提节奏、时效提示、日期唤醒、自动化 |
|
|
100
112
|
| 文件夹 | 文件夹级私有/全局上限,展开对话修改各自选择 |
|
|
101
|
-
| 记忆库 |
|
|
113
|
+
| 记忆库 | 分行选择会话与绑定库,紧邻文字的范围开关、领域及上下文设置;新建、改名、归档、恢复、显式删除 |
|
|
102
114
|
| 记忆浏览 | 全文编辑、附件、复核池、有界图谱、JSON/ZIP 导入导出 |
|
|
103
115
|
| 全局记忆 | 分域全局记忆、证据、复核队列与独立 curator,每条可跳转到记忆墙查看 |
|
|
104
116
|
| 提示词 | 通用 / RP / Coding / Mixed 变体,覆盖与单项恢复;未作答会话按预设/目录识别领域,并可在首次弹窗里直接选择 |
|
|
@@ -108,7 +120,7 @@
|
|
|
108
120
|
|
|
109
121
|
### 注入 token 预算
|
|
110
122
|
|
|
111
|
-
`anchorTokens` 与 `turnTokens` 分别约束锚点与召回内容(均默认 800)。`injectionTotalTokens`
|
|
123
|
+
`anchorTokens` 与 `turnTokens` 分别约束锚点与召回内容(均默认 800)。`injectionTotalTokens` 限制同一宿主回合新增的全部记忆 plugin 消息(默认 2000),涵盖 guide、首步、inbound 与中途补充;召回预算与 `midTurnTokens` 是独立子上限,仍服从同 turn 总额。实际记忆块 token 尚未验证,整请求 usage 单独观察,不据此伪造记忆专属校准;详见[预算与测量边界](docs/token-budget.md)。
|
|
112
124
|
|
|
113
125
|
### 带时间的记忆(1.2.3)
|
|
114
126
|
|
|
@@ -160,7 +172,7 @@ npx @deepseek-ai/dsh web
|
|
|
160
172
|
|
|
161
173
|
### 方式三 — 本地源码(开发)
|
|
162
174
|
|
|
163
|
-
|
|
175
|
+
`lib/` 中的大部分 JS 直接运行,仓库**只有一个构建步骤:图谱引擎 bundle**;修改 `lib/webui/graph-view.js` 或其引擎模块后,先运行 `npm run build:graph`。克隆后把 checkout link 进 DSH profile,并加入 bundle:
|
|
164
176
|
|
|
165
177
|
```sh
|
|
166
178
|
git clone <本仓库地址> dsh-memu-memory
|
|
@@ -183,7 +195,7 @@ npm ci --legacy-peer-deps
|
|
|
183
195
|
}
|
|
184
196
|
```
|
|
185
197
|
|
|
186
|
-
然后重启 DSH
|
|
198
|
+
然后重启 DSH,装载符号链接的 checkout。图谱源码改动须先重建再重启;单独重启不会重新生成 `graph-view.bundle.js`。
|
|
187
199
|
|
|
188
200
|
### 可选 — 向量引擎(MemU)
|
|
189
201
|
|
|
@@ -205,7 +217,7 @@ npx --package dsh-memu-memory dsh-memu-memory-setup
|
|
|
205
217
|
|
|
206
218
|
`memoryMode`(`local` / `cloud`)是 MemU 存储兼容设置,不是 embedding 开关或来源选择;保留 cloud 选项不意味着受管本地推理可被称为离线云存储。总结生成与向量路由独立:常规私有整理使用 Agent fork,显式远程总结动作使用其聊天端点,再经统一记忆写入路径提交。召回不使用 LLM 重排,也不会以 LLM 作为失败回退。精确记忆 id 仍走直达路径,插件不维护平行的向量数据库。
|
|
207
219
|
|
|
208
|
-
模型下载、运行时加载和 profile
|
|
220
|
+
模型下载、运行时加载和 profile 切换须通过制品校验与迁移门槛。DSH rc.5 上的 **R3 pre-freeze 隔离实测**已使用既有本地运行时、模型与隔离数据库副本执行原生 embedding 和 MemU retrieve(49 项检查),见「实测证据与边界」;该轮未重新下载制品,也未覆盖全部切换/迁移路径。**最终验收仍待中央同一冻结树结果**,不能把 R3 写成最终通过。candidate 或 `pending` artifact 不代表可用。
|
|
209
221
|
|
|
210
222
|
## 第一次使用
|
|
211
223
|
|
|
@@ -219,16 +231,24 @@ npx --package dsh-memu-memory dsh-memu-memory-setup
|
|
|
219
231
|
|
|
220
232
|
## 模型工具
|
|
221
233
|
|
|
234
|
+
当前模型工具面共 17 个:
|
|
235
|
+
|
|
222
236
|
| 工具 | 作用 |
|
|
223
237
|
|---|---|
|
|
224
238
|
| `memu_private_remember` | 写私有记忆,支持来源、留存层、说出口径、可见性、标签、未了之事与附件引用 |
|
|
225
|
-
| `
|
|
239
|
+
| `memu_private_remember_batch` | 用共享 `defaults` 批量写入私有记忆,逐项返回结果 |
|
|
240
|
+
| `memu_private_recall` | 关键词片段及独立词典区(最多 2 条、`[lex:termId]` 引用与 `matchedBy`),或精确 id 正文页(`view`、`offset`、`limitChars`、`revision`、可选允许的 `libraryId`);搜索 `topK` 为 1–20 行硬上限,冲突只附关系指针 |
|
|
226
241
|
| `memu_private_list` | 列出当前作用域可用的记忆 |
|
|
227
242
|
| `memu_private_update` | 编辑,但不能绕过永久准入、复核或可见性规则 |
|
|
243
|
+
| `memu_private_feedback` | 凭明确反馈与理由记录确认、否认或无关,仅当前绑定私库;不从沉默推断、不删除记忆 |
|
|
228
244
|
| `memu_private_archive` | 归档,不删除 |
|
|
229
245
|
| `memu_private_unpin` | 用第一人称理由、配额和冷却边缘化一条永久记忆 |
|
|
230
246
|
| `memu_private_link` | 用证据连接记忆/实体,或更新关系快照;可裁决 `memu_private_link_suggest` 的不确定候选;不能删边 |
|
|
231
247
|
| `memu_private_link_suggest` | 为本轮整理写入的 id 刷新确定性边(已确认实体提及 / 字段证据),只返回不确定候选 |
|
|
248
|
+
| `memu_private_entity_merge_suggest` | 分批读取相似实体候选,并附带当前可见的关联记忆摘要和关系证据;名称只用于发现候选 |
|
|
249
|
+
| `memu_private_entity_merge_decide` | 使用当前 review token 和可见证据,对单个候选合并、排除或暂缓;置信度不足时转为暂缓 |
|
|
250
|
+
| `memu_lexicon_search` | 搜索当前会话可见的有效词条:绑定私库与全局词典,开启跨库时含同域库;归档与墓碑词条不返回 |
|
|
251
|
+
| `memu_lexicon_propose` | 在绑定私库新增或更新词条,不写全局词典;普通条目即时有效,敏感触发词仍仅由用户管理 |
|
|
232
252
|
| `memu_global_recall` / `memu_global_list` | 按 domain 读取全局记忆;recall 支持片段或带版本的精确 id 正文页,不扩大既有准入 |
|
|
233
253
|
| `memu_status` | 存储健康、同步心跳、召回状态与图片回合状态 |
|
|
234
254
|
|
|
@@ -262,6 +282,8 @@ npx --package dsh-memu-memory dsh-memu-memory-setup
|
|
|
262
282
|
|
|
263
283
|
## 长工具回合中的外部消息
|
|
264
284
|
|
|
285
|
+
原生首步与 inbound 共用接纳凭据:记忆消息已进入历史后,人类消息事件迟到也不会再次触发同一轮召回,跨回合和重启同样生效。未经宿主证明的原生旧队列保留待重试,只有原始人类输入再次出现或被宿主接纳时才可召回;未接纳的失败提案仍能重试。预算中省略的图片引用保持各自的待处理归属。
|
|
286
|
+
|
|
265
287
|
第三方工具可以持续 waiting,让一个宿主 turn 保持打开。收到一批新的真实人类消息后,
|
|
266
288
|
本插件在下一次模型步骤前做一次有预算的增量召回,不另起模型调用,也不强制结束大回合。
|
|
267
289
|
同回合中的原生用户消息直接支持;普通日志、sleep 完成文本、失败工具结果和空轮询不触发。
|
|
@@ -321,9 +343,9 @@ return { content: originalContent, meta: { ...originalMeta, memoryInbound: batch
|
|
|
321
343
|
|
|
322
344
|
```sh
|
|
323
345
|
npm ci --legacy-peer-deps
|
|
346
|
+
npm run build:graph # 修改图谱源码后重建随包分发的离线资源
|
|
324
347
|
npm test # 全量测试;真实引擎用例在未配置时按设计跳过
|
|
325
348
|
npm run check # 语法 + i18n 键对齐 + package.json
|
|
326
|
-
npm run build:graph # 修改图谱源码后重建随包分发的离线资源
|
|
327
349
|
node scripts/acceptance-local.mjs # 50 条自动验收
|
|
328
350
|
node scripts/migrate-visibility.mjs # 报告(--apply 才重写)仍存着旧 session 级别的库
|
|
329
351
|
node --import ./tests/loader-register.mjs scripts/preview.mjs --port 7789
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 7. 客户端约定(硬约束)
|
|
6
6
|
|
|
7
|
+
记忆库页顶部的会话设置按「选择会话、绑定记忆库、使用范围、领域与上下文、整理动作」分组。刷新/绑定按钮随对应控件自然宽度排布;私有/全局范围开关紧跟文字,间距10px,不用 `space-between` 拉到行尾。窄屏自动堆叠,仍使用同一份组件。
|
|
8
|
+
|
|
7
9
|
### 7.1 两个壳、一份实现
|
|
8
10
|
|
|
9
11
|
设置页 = 左侧导航(158px + 品牌块 + 品牌色滑动指示条)+ 卡片式页面;侧边栏 `MemoryTab` = 顶部分段壳。**同一个 `SettingsPage` 也嵌进侧边栏**(`embedded` → `data-dshm-surface="sidebar"`),所以总设置只有一份实现,**不要另写一套侧边栏设置面板**。
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
- 动作按钮 = `Button`(`.dshm-btn`,**必须透传 `title`**,漏掉整个界面的悬浮提示静默失效);开关 = `Toggle`;行内删除/关闭 = `.dshm-x`。
|
|
26
28
|
- `<button>` 里**不许**再嵌 `role="button"`(键盘够不到)。
|
|
27
29
|
- 破坏性操作 = **二次点击**(文案变「确认…?」,2.5s 复原),不用 `globalThis.confirm`、不用 modal。
|
|
28
|
-
-
|
|
30
|
+
- **实体合并先由整理 worker 按证据裁决**:只用当前任务可见的记忆与关系;明确同一才合并,明确不同才排除。名称相似或兄妹等亲属关系本身不足以裁决,身份严重错配风险或证据不足时 `hold`。未裁决候选在空闲时自动交给所属会话的模型,复用现有整理执行器,每批最多4对,不按单条候选新建 fork。人工 `hold` 队列放在 MemU 记忆页,DSH 侧边栏给显眼提醒,诊断页不承载候选队列;人工合并/排除仍须二次点击、校验 `reviewToken`,并用一行回执说明影响面(`S.muted` + `V.accent`,自清),数字取 RPC 返回值,**不估算**。关联建议仍是只读候选,由现有关系管理流程处理。语义见 `docs/memory-semantics.md` §8.14。
|
|
29
31
|
- **失败只在 WebUI「全部日志」标红**:活动日志三档 = 失败(`ok===false` 或 `level==='error'`)/ 降级(`level==='warn'` 且没失败)/ 常规,判据集中在 `logRowState`;总日志页用作用域 CSS `.dshm-logrow.is-failed` / `.is-degraded`,并且**同时给文字 Tag**(`logStateFailed`/`logDegraded` + hover 说明)——颜色不能是唯一通道。**侧栏「整理记录」不放失败行**(它只显示正常流水;失败由上方跨会话的「整理提醒」负责,别在两处重复标红),所以侧栏既不过 `logRowClass` 也不上色。判据别写成只看 `level==='error'`:整理超时记的是 `warn + ok=false`,那样失败会长得和正常行一样。
|
|
30
32
|
- 「整理提醒」按卡片可用宽度自动分列,窄侧栏必须堆叠。会话身份与时间/跳转操作分行;只截断标题和错误正文,不用行级 `overflow:hidden` 裁掉操作按钮。中英文 240–900px 下都需检查完整标签、非零标题宽度和可点击的跳转/清除按钮。
|
|
31
33
|
- 设置项 = 即时保存 + 250ms trailing debounce,一次重试 + `console.warn`,`pagehide` 时 flush。反馈用 toast(2.6s),不用常驻 error/notice 字符串。
|
|
@@ -35,13 +37,15 @@
|
|
|
35
37
|
- **保存/设置类改动必须通知**:`notifyMemoryWrite(kind, libraryId)` 先跑同窗口监听(毫秒),再向 `BroadcastChannel("dsh-memu-memory")` 广播 `{ type: "memory-write", kind, libraryId, at }`,让另一份文档(WebUI 新标签 / overlay iframe / 另一个宿主窗口)立刻重取;本地已刷新的写(设置保存、复位、后端切换、文件夹策略)用 `broadcastMemoryWrite` 只通知别人,避免刷两遍。接收端只跑本地监听 / 重渲染,**不广播回去**、**不从消息取数据**——消息只叫醒心跳,事实永远从 RPC 取。
|
|
36
38
|
- **一切轮询走心跳**:面板同步一律 `useMemoryBeat`,不各写 `setInterval`。心跳载荷**只许** `{ revisionOnly: true }`,返回**只许** `{ revision, stamp }`。
|
|
37
39
|
- 侧边栏首屏只允许 **1 个 RPC**(`getSidebarState`)且不读记忆全文;其余分页懒加载,列表项预览就地截断。
|
|
38
|
-
-
|
|
40
|
+
- **记忆墙/浏览库真实分页**:`browseWall`/`browseLibrary` 首屏只请求 60 条,`IntersectionObserver` 确认触底后才请求下一页(墙 300、浏览库 120);无 observer 时保留「显示更多」。不得后台循环全拉,也不设 40 批/12000 条假上限。续页透传首屏 `snapshotRevision`;`MEMORY_CHANGED` 或快照/总数/页内容异常必须丢弃旧页,从 offset 0 最多自动重启两次,仍冲突则显示错误并由用户刷新,不能去重后冒充完整快照。搜索 250ms trailing debounce 后交给 RPC;域、原始状态筛选也走 RPC,切换条件/离页/卸载使旧请求失效。追加页不重置滚动位置或已有卡片 key,卡片草稿仍下沉在 `BrowserMemoryCard` 内并 `React.memo`。`total` 是服务端当前查询总量,未读完的池/层/作用域局部计数必须标「已加载」,不得把局部计数伪装成整库结果。
|
|
39
41
|
- 列表排序口径 = **新到旧**(`updatedAt || createdAt` 降序,tie-break id),服务端 `privateListView` 统一排;引擎与索引都不保证顺序,界面不要自己另排一套。
|
|
40
42
|
- **正文按需补全**:列表返回的 `content` 只是截断预览,`truncated: true` 时卡片聚焦正文必须先用 `getMemory` 补拉全文(拉取期间输入框只读)。绝不能让截断版进编辑路径——那等于用户改一个字就丢掉尾部。
|
|
41
|
-
- 筛选是**两个独立维度,各自独占**:池(在用 / 已归档)× 层(全部 / 永久 / 长期 / 短期 /
|
|
43
|
+
- 筛选是**两个独立维度,各自独占**:池(在用 / 已归档)× 层(全部 / 永久 / 长期 / 短期 / 锚点)。**所有选项恒定列出**;归档不是叠加开关。归档/待复核池在服务端按原始状态分页;在用/失效的到期语义与层、作用域仍按已加载条目判断,局部数字明确标「已加载」。切换服务端条件重启首屏,归档/恢复后重新获取快照,不能沿用写前的 offset。
|
|
42
44
|
- 反面语义设置项(如 `newSessionPromptDismissed`)在 WebUI 必须 `settingRow(..., { invert: true })`,否则开关显示与宿主页面相反。
|
|
43
45
|
- **跨库聚合视图不带 sessionId**:记忆墙「全部记忆库」(`browseWall` 无 libraryId)与词典页「全部词典」(`lexiconList` 传 `libraryId:'all'`)都是管理面聚合读,会话凭据表达不了多库授权——省略 sessionId 走宿主 capability;宿主 403 时退回单库并禁用聚合选项(`multiBlocked` / `allBlocked`),不让整页空。聚合里的写操作按条目所属库路由(词典 `bookOf`),不能拿保留作用域名(`all`)去写。
|
|
44
46
|
|
|
47
|
+
实体待处理区默认聚合全部记忆库,显式带库的深链接仍定位该库;逐条显示所属库,合并/排除按条目所属库和当前 `reviewToken` 写回。模型待办默认折叠并自动执行,侧边栏只提醒人工 `hold`;跨库分页最多4个并发读取,部分失败须显示错误,不能冒充精确空队列。图谱管理的目标库可独立选全部,每页60条,先读有界元数据再读本页覆盖的库;新增时另选具体库,不以 `all` 写入。
|
|
48
|
+
|
|
45
49
|
### 7.5 文案与结构
|
|
46
50
|
|
|
47
51
|
- 文案同时进 `zh` / `en`;加 `t("key")` 后跑 `node scripts/check-i18n.mjs`。
|
|
@@ -52,8 +56,10 @@
|
|
|
52
56
|
|
|
53
57
|
### 7.6 关系图谱工作台(`lib/webui/graph-view.js` + `GraphStudioPanel`)
|
|
54
58
|
|
|
59
|
+
- **默认画布保留经典花瓣圆环与圆形节点。** `getGraph({overview:true,layout:'classic'})` 自动读完授权范围内的分页,保留跨页连线,再将完整快照交给旧版 `layoutFlower`。经典响应不带网格坐标,不走矩形 Worker 预布局;缩放和平移不能发视口请求替换完整图谱。最小缩放按全图范围自适应,实体与远景点也必须为圆形。管理列表仍使用原有有界 detail 分页,不能被画布全量加载逻辑接管;详情见 `docs/graph-scale.md`。浏览器回归使用隔离数据的 `scripts/check-classic-graph-browser.mjs`。
|
|
55
60
|
- **按域过滤走服务端,不走画布。** 图谱工作台的域输入框(`gsDomain`)把值原样交给 `getGraph`/`getGlobalGraph` 的 `domain` 参数,归一化口径与 `lib/graph.js:graphDomain` 一致(NFKC + trim + lowercase,缺失时私有读 `general`、全局读 `unknown`);返回的 `domains` 是**筛选前**的并集,所以下拉永远还能换回别的域。引擎 `graph-view.js` 对域一无所知,也不该知道——分色/分块布局需要重打 bundle 且没有验证收益。记忆墙的域筛选同理(`browseWall` 的 `domain` 参数 + item 上的 `domain` 字段),不要在前端筛完再报计数。
|
|
56
61
|
- **物理不许读相机。** 力导向里的斥力、弹簧原长、硬分离阈值一律用**世界坐标 + 节点半径**;物理阈值若随缩放反向扩大,会导致最小缩放下节点持续相互排斥、布局无法收敛。缩放只影响**绘制**与**命中半径**。`tests/graph-view.test.mjs` 钉死两件事:`setScale` 之类把相机交给物理的入口不许回来,`relayout()` 后位移必须逐窗衰减且不留重合。
|
|
62
|
+
- **拖点领先,分支弹性跟随。** 普通左拖使用同一套完整连通分量求解,不按节点/边数量截断;pointermove 只改变拖点,分支通过有阻尼的形状弹簧与连线约束跟上,不给整簇硬加同一位移。连线允许的形变按世界原长计算;松手固定拖点,继续释放分支动能。下一次拖动释放以前的软落点,但不解除右键锁定;取消恢复全部已触及节点。物理按固定 60Hz 步长运行,每次 rAF 至多补 3 步,不能随高刷新率加速。`Shift` 明确保留整簇平移。
|
|
57
63
|
- **改引擎必须重打包。** 浏览器加载的是 `lib/webui/graph-view.bundle.js`,不是源码;`npm run build:graph` 忘了跑,源码修复在真实页面上根本不存在,而单测照绿(它 import 的是源码)。`npm run check` 现在比对两者字节,漂移即红。
|
|
58
64
|
- **冷下来就要零帧。** 渲染循环只在 `layout.active`(alpha 高于地板)或交互期申请下一帧;呼吸微动也只在模拟活着时画。每帧无条件 `requestAnimationFrame` 会让 GPU 占用一路爬升且不回落。
|
|
59
65
|
- **命中判定带迟滞。** 最小缩放下相邻节点在屏幕上只差 1–2px,纯「最近距离」会在两者之间反复跳;`hit(p, prefer)` 必须优先保留上一个目标(`tests/graph-view.test.mjs` 用 1px 抖动断言)。
|
|
@@ -72,4 +78,14 @@
|
|
|
72
78
|
- **改完要量**:`node scripts/check-idle-compositing.mjs`(先起预览)用 CDP screencast 数帧 + `document.getAnimations()`,空闲 fps > 2 即 FAIL。静态守卫在 `tests/webui.test.mjs` 的 `the shell keeps no always-on compositor drivers`。
|
|
73
79
|
- **对照环境要先验**:若桌面本身被别的进程钉住时钟(不开浏览器也高频),真 GPU 前后对照在那台机器上无效;以帧计数为准,或到「关面板立刻回落」的宿主上复测。
|
|
74
80
|
|
|
81
|
+
### 7.8 教程与技术诊断
|
|
82
|
+
|
|
83
|
+
- 教程先给七步任务:建库、绑定、注入、写入/纠正、词典、真实向量、关系管理。每步必须同时回答“做什么、在哪里确认成功、失败先查什么”。切换教程只改本地步骤状态,不写记忆、设置或会话绑定;独立WebUI不虚构当前会话,绑定步骤明确回到会话侧。
|
|
84
|
+
- 当前步骤可直接选择,也可上一/下一步;主题索引页内滚动,不覆盖 `#/settings/help` 路由。桌面双列、窄屏两列步骤加单列正文;按钮和长错误可换行,不设固定正文高度。
|
|
85
|
+
- 七步教程的“真实向量”一步必须区分引擎包、Python/运行时、模型文件、active 向量代际、索引重建和实际命中;“安装完成”不能作为成功标志。关系管理一步必须说明候选证据、合并/排除/`hold` 的边界及记忆页/侧边栏的人工入口。每一步的失败入口都应能跳到诊断,绑定步骤除外,因为绑定发生在 DSH 会话侧。
|
|
86
|
+
- 诊断按需加载:只进入诊断页才请求诊断列表、环境自检与技术报告;其他页不启动这组磁盘检查。请求序号使旧筛选/离页响应失效。报告的采集时间与证据来源必须显示,`unknown`、`skipped`、`not-built`与明确故障分开,文件存在不等于端到端运行成功。
|
|
87
|
+
- `getDiagnosticReport` 是帮助页和诊断页共同的支持报告出口。前端仅复制/下载服务端 `redacted:true` 的 `text`,不拼接 settings、库名、路径、配置、正文或对话。过滤后的诊断列表不能冒充完整报告;报告有自己的有界条目数和采集时刻。
|
|
88
|
+
- 版本、宿主能力、引擎/向量/状态/RPC/worker证据分层展示;错误的code、操作、关联号、cause、调用位置、上下文、重试与修复建议应可查。技术细节默认折叠;服务端已经限长的错误不能再在浏览器无提示切掉尾部。清空诊断与逐项修复均须二次点击,修复结果保留回执并刷新证据。
|
|
89
|
+
- 诊断报告复制与下载必须使用同一份服务端 `text`,校验脱敏标记后直接输出,复制和下载内容字节一致;单条事件复制只能作为辅助,不能替代完整支持报告。引擎错误至少要能从页面找到稳定 code、原因、cause/stack、operation、关联号、重试建议和修复动作,不能只显示通用失败文案。
|
|
90
|
+
|
|
75
91
|
---
|
package/docs/contributing.md
CHANGED
|
@@ -78,9 +78,9 @@ npm run check # node --check + i18n 键对齐 + package.j
|
|
|
78
78
|
|
|
79
79
|
### 5.3 新增一个 RPC 方法
|
|
80
80
|
|
|
81
|
-
<!-- rpc-method-count:
|
|
81
|
+
<!-- rpc-method-count: 112 -->
|
|
82
82
|
|
|
83
|
-
1. `lib/rpc.js` 的 `switch` 加 case(共
|
|
83
|
+
1. `lib/rpc.js` 的 `switch` 加 case(共 112 个方法,按功能分组,别乱插)。
|
|
84
84
|
2. 返回**形状稳定**:客户端 `call()` 直接解构,列表类给 `{items, total}` 而不是裸数组。
|
|
85
85
|
3. `revisionOnly` 分支只回 `{revision, stamp}`、**不要求 sessionId**(三端轮询,设置页与独立页没会话)、**不塞业务数据**(每 2.5 秒一次);顺带 `noteMemoryBeat()`,`memu_status` 靠它分「没写」与「没人轮询」。
|
|
86
86
|
4. 写成功后 `bumpMemoryRevision()`/`notifyMemoryWrite()`(§7);能让 `state.json` 或索引落盘的写,`state.js` 自动记写事件供 `memu_status` 展示。
|
|
@@ -98,6 +98,8 @@ npm run check # node --check + i18n 键对齐 + package.j
|
|
|
98
98
|
|
|
99
99
|
诊断是**插件自己的体检**,与活动日志(`logs/activity.jsonl`,记"发生了什么")刻意分开:活动日志给用户看流程,诊断记"哪里坏了、能怎么修"。
|
|
100
100
|
|
|
101
|
+
统一复制/下载使用 `getDiagnosticReport` 的 `text`;版本来源、返回 shape、只读边界和错误信号接线见「诊断报告契约」。外部异常不能只凭技术关键词放行原句,cause/detail/旧记录也必须重新脱敏。
|
|
102
|
+
|
|
101
103
|
1. **记一条**:`recordDiagnostic({level, scope, code, message, detail, hint, repair})`(`lib/diagnostics.js`)。`code` 用大写下划线常量,同一个 `(scope, code, message)` 在 60 秒窗口内只累加 `count`,不会刷屏;`detail` 里的 secret 会被 `redactSecrets`(`lib/paths.js:redactSecrets`)脱敏——**宁可少记,不可记明文 key**。
|
|
102
104
|
2. **让报错自动进来**:抛错路径统一走 `recordErrorDiagnostic(error, {source, detail})`;`error.code` 命中 `KNOWN_CODES` 表就自动带上 scope / 修复动作 / hint。
|
|
103
105
|
3. **登记故障码**:`KNOWN_CODES`(`lib/diagnostics.js`)里给 `{scope, repair, manual, hint}`。`repair` 必须是 `lib/environment-check.js` 里 `REPAIRS` 的键,否则诊断页只显示"无可用修复"。
|
package/docs/env-and-commands.md
CHANGED
|
@@ -49,7 +49,15 @@ node scripts/rebuild-auto-links.mjs --include-archived # 连归档库一起
|
|
|
49
49
|
|
|
50
50
|
**Python 解析顺序**:① `engine/current.json` 指向的 venv ② `DSH_MEMU_PYTHON` ③ `py -3.13` / `-3.12` / `-3.11` ④ DSH 自带 Python⑤ `python3` / `python` ⑥ `py -3.14`(最后,wheel 可能滞后)。
|
|
51
51
|
|
|
52
|
-
**镜像顺序**:用户配置 → `https://pypi.tuna.tsinghua.edu.cn/simple` → `https://mirrors.aliyun.com/pypi/simple/` → `https://pypi.org/simple
|
|
52
|
+
**镜像顺序**:用户配置 → `https://pypi.tuna.tsinghua.edu.cn/simple` → `https://mirrors.aliyun.com/pypi/simple/` → `https://pypi.org/simple`。设置页的「引擎下载源」选 `official` 时,内置三项反转为 pypi.org 优先;用户配置仍在前。报错先看这三处:镜像顺序、venv 里是否残留 pip、`downloads/` 失败后是否被清。
|
|
53
|
+
|
|
54
|
+
**引擎下载源(2026-12)**:`uv` 二进制与受管 CPython 不只是 GitHub 一条路。源顺序由 `lib/engine-sources.js` 按 `engineSource`(设置页「引擎下载源」)/ `DSH_MEMU_ENGINE_SOURCE` 生成:`auto` / `mirror` / `custom` 是「自定义 → USTC `github-release/astral-sh/*` → GitHub」;`official` 是「自定义 → GitHub → USTC」。平台按 `process.platform/arch` 自动选资产:`win32-x64/arm64`(msvc zip)、`darwin-x64/arm64`、`linux-x64/arm64`(glibc),Linux musl 走 `-musl` 构建——探测顺序 `DSH_MEMU_LIBC` → glibc 运行时报告 → `/etc/alpine-release`。不支持的架构(linux-riscv64 等)在下载前直接报错,并提示 `DSH_MEMU_PYTHON`。
|
|
55
|
+
|
|
56
|
+
**两种校验策略**:默认 `pinned` 只装 `UV_VERSION=0.13.6` / `MANAGED_PYTHON=3.12.14`,用本文件钉死的 sha256 校验;镜像没有该版本就跳到下一个源。开启「允许镜像提供最新版本」(`engineAllowUnpinned` / `DSH_MEMU_ALLOW_UNPINNED=1`)后,滚动镜像可提供它自己的最新 tag(USTC 只保留最新一版),校验改用镜像同目录的 `sha256.sum`;受管 CPython 跟随镜像的 3.12.x 最新版(uv 版本不是 pin 时不让旧元数据去装新/旧错配的 Python)。GitHub 不可达时这是唯一能装上的路径。落盘:pinned uv 在 `engine/runtime/uv-<version>/`,unpinned 在 `engine/runtime/uv/`;CPython 在 `engine/runtime/python/`。
|
|
57
|
+
|
|
58
|
+
**相关环境变量**:`DSH_MEMU_UV_MIRROR`、`DSH_MEMU_CPYTHON_MIRROR` 是自定义基地址(请求 `<base>/<version>/<file>`,文件需与 GitHub release 同名同内容;CPython 那个会作为 uv 的 `UV_PYTHON_INSTALL_MIRROR`);`DSH_MEMU_ALLOW_UNPINNED`、`DSH_MEMU_LIBC`;`DSH_MEMU_PYTHON` 仍可直指 3.11+ 带 pip 的解释器,完全跳过 uv 下载。失败信息会逐源列出 `HTTP 404` / `fetch failed (ECONNRESET)` 这类真实 cause,不再只有一句 `fetch failed`。
|
|
59
|
+
|
|
60
|
+
每个CPython来源都显式覆盖 `UV_PYTHON_INSTALL_MIRROR`,包括官方回退,防止继承进程中失效的旧镜像;某个来源的安装或查找命令抛异常时也继续尝试其余来源。自定义基地址不能带账号密码、query或fragment,非法URL在保存/解析时拒绝且不回显其中内容。`DSH_MEMU_LIBC` 使用传入的环境对象探测。合成用例验证这些分支,不代表已完成所有平台的真实安装。
|
|
53
61
|
|
|
54
62
|
**Lean venv**:`python -m venv --without-pip <venv>` + 基础 Python 的 `pip --python <venv python> install -r requirements.lock`,带 `--no-cache-dir`、`--only-binary=:all:`、`--disable-pip-version-check`。成功删 `downloads/`;失败删失败版本目录与 downloads。
|
|
55
63
|
|