dsh-plugin-memory 0.15.2 → 0.16.1
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/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +535 -253
- package/lib/graph-3d.js +159 -0
- package/lib/recall-nudge.js +33 -9
- package/lib/soul.js +2 -2
- package/lib/tone.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
|
|
4
4
|
|
|
5
|
+
## [0.16.1] - 2026-11-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **移除运行时硬编码姓名**(用户反馈:其他用户看到「小蓝/阿周」而不是自己 SOUL 里的称呼):`lib/recall-nudge.js` 的「主动追忆」「成长回顾」文案、`lib/tone.js` 的语气规则、设置页「人格基础」占位符(`例如:小蓝/阿周`)、`lib/soul.js` 注释示例全部清除。追忆与成长回顾现在从 `readSoulProfile(memoryDir)` 读取当前人格名(未铸魂时回退通用「助手 / 你」)。
|
|
10
|
+
- 新增 `test/no-hardcoded-names.test.mjs` 防回归:扫描 `lib/*.js`,出现「小蓝 / 阿周 / Small-Blue」即失败。
|
|
11
|
+
|
|
12
|
+
### Tests
|
|
13
|
+
|
|
14
|
+
- 全量 **312/312** + self-test PASS(新增 2 条:动态人格名、防硬编码回归)。
|
|
15
|
+
|
|
16
|
+
## [0.16.0] - 2026-11-04
|
|
17
|
+
|
|
18
|
+
### Changed(0.16.0:记忆图谱改为 3D 球面)
|
|
19
|
+
|
|
20
|
+
- **图谱视图从 2D SVG 换成 Canvas 3D**(方案 B):Fibonacci 球面布局(按 type 分色带、确定性)→ 透视投影;拖空白旋转、滚轮缩放、拖节点 3D 整理布局、双击空白重置、自动慢转(尊重 `prefers-reduced-motion`)。
|
|
21
|
+
- **选中/悬停即时高亮邻居**:悬停即点亮邻居(不等点击);点击判定改为「位移 ≤5px 且时长 ≤350ms」双阈值——修复 demo 里轻点一下被判成拖拽、关联点不立即显示的问题。选中节点最后绘制(不被遮挡)、邻居标签显示、卡片内详情行。
|
|
22
|
+
- 新增 `lib/graph-3d.js`(球面分布/旋转/投影/深度排序/命中,纯函数);`client.js` 内联同一套数学并有测试对齐(防止与模块漂移)。2D SVG 渲染撤下,旧的 2D 内联数学保留给测试与静态报告。
|
|
23
|
+
|
|
24
|
+
- **浅色主题配色修正**:设置面板浅色主题下,节点发光把颜色晕成灰白(用户反馈「颜色有点奇怪」);改为按实际渲染背景明暗自适应——浅色:实心节点 + 白描边、深色标签、加深的边色;深色:保留发光与亮标签。主题判断读真实背景色(不猜 CSS 变量名),`isLightColor` 有测试。
|
|
25
|
+
|
|
26
|
+
### Tests
|
|
27
|
+
|
|
28
|
+
- `graph-3d` 8 条(球面确定性/旋转可逆/投影/深度排序/命中);`graph-card` 新增内联 3D 数学一致性 + 主题判断;全量 **310/310** + self-test PASS。
|
|
29
|
+
|
|
5
30
|
## [0.15.2] - 2026-11-04
|
|
6
31
|
|
|
7
32
|
### Docs
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ After that the loop is simple: the agent writes memories back as you work, and y
|
|
|
49
49
|
- **Automatic index upkeep (declarative compilation)**: index lines are no longer hand-written. A page declares `summary:` in its frontmatter, and `dsh-memory index --write` rewrites the line as a projection of it (tag ≤32 / summary ≤48 / whole line ≤132 characters), **changing only line content while preserving sections and order byte for byte**, and idempotently. `index --check` gives a machine verdict (non-zero exit when there is drift), and `index --sync-frontmatter` backfills summaries already written in the index into the pages (a one-off migration for older stores). The digest reminder appends a note when the index has drifted, so the agent can fix it in passing.
|
|
50
50
|
- **Cross-linking as a default action**: `index.md` is the directory (who exists); page-to-page links are the **relationships** (who relates to whom). In a real store measured here, 29 pages had only 1 genuine cross-link, yet the graph and all cross-page synthesis rest on that layer. Three places now push it together: the remember flow in `skills/memory.md`, the workflow in the `MEMORY.md` template, and the closing instruction of the digest reminder all require "add 1–3 related-page links for every page you touched this time".
|
|
51
51
|
- **Link suggestions**: `dsh-memory graph --suggest` lists, for pages that have only their index entry and no content relationship, who they ought to reference — scored by shared topic tags, title words, and same type, with the reason stated (`shared #dsh` / `title word dsh` / `same type`). Report-only: whether and how to link stays the agent's call. Also available as `GET /api/memory/graph?suggest=1`.
|
|
52
|
-
- **Memory graph**: a read-only relationship graph in the settings page
|
|
52
|
+
- **Memory graph (3D, v0.16.0)**: a read-only relationship graph in the settings page, now an interactive **3D sphere** rendered on Canvas (zero dependency, no WebGL): Fibonacci-sphere placement (same type forms a contiguous colour band; deterministic, no randomness), perspective projection, depth fog and node glow. **Interactive**: drag empty space to rotate, wheel to zoom (0.5×–2.4×), drag a node to arrange it in 3D (positions survive the 25-second live refresh), double-click empty space to reset, auto-spin (disabled when `prefers-reduced-motion`). **Hover or click lights up the neighbourhood immediately**; click detection uses a displacement+duration double threshold (≤5px, ≤350ms), so a light tap is no longer mistaken for a drag — that was the demo bug where neighbours did not light up on click. The selected node is drawn last (never occluded), neighbours keep their labels, and the card shows the selected node's type/degree/neighbour count. The 3D maths lives in `lib/graph-3d.js` (pure functions with tests) and is mirrored inside `client.js` (the client can only require platform seeds) with a consistency test pinning both. Three edge kinds stay distinguishable: page links = solid blue, index routing = grey dashed, shared tags = thin violet. `GET /api/memory/graph` (read-only, live).
|
|
53
53
|
- **`dsh-memory checkup`**: folds the four readers (lint's integrity, status's counts, the dashboard's size and freshness, graph's relationships) into **one prioritised report** — size, freshness bars, connectivity, consistency checks, ending with "the N things most worth doing". The four numbers are diagnosis; "do these three things" is the product. Exits non-zero when there is work to do, so scripts can consume it. `--boot=N` computes the index share against your boot budget.
|
|
54
54
|
- **Memory health dashboard**: below the same section is a **read-only** dashboard — memory pages / index routes / word count, an access-freshness bar chart (today / ≤7 / ≤30 / ≤90 / >90 days), four health verdicts (index links, orphan pages, frontmatter, freshness) with a health score, stale-page candidates, and the 5 most recent log entries. Data comes from the new `GET /api/memory/insights` (computed live per request, never cached), and its criteria share a source with `dsh-memory lint`, so the dashboard and the CLI cannot contradict each other.
|
|
55
55
|
- **Zero build**: plain ESM JavaScript, no compilation step, usable straight after `pnpm add`.
|
package/README.zh.md
CHANGED
|
@@ -51,7 +51,7 @@ dsh plugin --profile <profile> add dsh-plugin-memory
|
|
|
51
51
|
- **index 自动整理(声明式编译)**:索引行不再手写。页面在 frontmatter 里声明 `summary:`,`dsh-memory index --write` 把行重写为它的投影(标签 ≤32 / 摘要 ≤48 / 整行 ≤132 字符),**只改行内容,分节与顺序逐字节保留**,且幂等。`index --check` 给机器判定(有漂移退出码非 0),`index --sync-frontmatter` 把已写在 index 里的摘要回填进页面(老库一次性迁移)。digest 提醒会在索引漂移时附一句提示,agent 顺手就能修。
|
|
52
52
|
- **互链成为默认动作**:`index.md` 是目录(谁存在),页间互链才是**关系**(谁和谁有关)——实测一个真实记忆库里 29 页只有 1 条真互链,而图谱与跨页综合全都建立在这层关系上。现在三处一起推:`skills/memory.md` 的 remember 流程、`MEMORY.md` 模板的工作流、以及 digest 提醒的收尾指令,都明确要求"给这次碰过的页面各补 1–3 条相关页链接"。
|
|
53
53
|
- **补链建议**:`dsh-memory graph --suggest` 列出「只有索引入口、没有任何内容关系」的页面该引用谁——按共享主题 tag、标题词、同类型打分,并说明理由(`共享 #dsh` / `标题词 dsh` / `同类型`)。只报告不写入:是否连、怎么连由 agent 决定。`GET /api/memory/graph?suggest=1` 同源。
|
|
54
|
-
-
|
|
54
|
+
- **记忆图谱(3D,v0.16.0)**:设置页里一张只读关系图,现在升级为可交互的 **3D 球面**,用 Canvas 手绘(零依赖、不用 WebGL):Fibonacci 球面均匀分布(同类型聚成一条色带、确定性无随机)、透视投影、景深雾化、节点发光。**可交互**:拖空白旋转、滚轮缩放(0.5×–2.4×)、**拖节点在 3D 里整理布局**(位置在 25 秒自动刷新后仍保留)、双击空白重置、自动慢转(`prefers-reduced-motion` 时默认关)。**悬停或点击立刻点亮邻居**;点击判定用「位移 + 时长」双阈值(≤5px、≤350ms),轻点一下不会再被误判成拖拽——这正是 demo 里「选中节点不立即显示关联点」的根因。选中节点最后绘制(永远不会被遮住),邻居保留标签,卡片里显示选中节点的类型/度数/邻居数。3D 数学在 `lib/graph-3d.js`(纯函数 + 测试),并在 `client.js` 里内联同一套(客户端只能 require 平台种子),有对齐测试防止漂移。三类边仍可区分:页间互链=实线蓝、索引路由=灰色虚线、共享 tag=细紫线。`GET /api/memory/graph`(只读、实时)。
|
|
55
55
|
- **`dsh-memory checkup`**:把四个读者(lint 的完整性、status 的计数、看板的体量与新鲜度、graph 的关系)合成**一份带优先级的报告** —— 体量、新鲜度条形图、连接度、一致性检查,最后给出"最该做的 N 件事"。四个数字是诊断,"做这三件事"才是产品。有活干时退出码非 0,可被脚本消费。`--boot=N` 用于按你的 boot 预算计算索引占比。
|
|
56
56
|
- **记忆健康看板**:同一区块下方是一张**只读**看板——记忆页数 / index 路由数 / 记忆字数、访问新鲜度条形图(今天 / ≤7 / ≤30 / ≤90 / >90 天)、四项体检结论(index 链接、孤儿页、frontmatter、新鲜度)与健康分、陈旧页候选、最近 5 条动态。数据来自新增的 `GET /api/memory/insights`(每次请求实时统计,不缓存),体检口径与 `dsh-memory lint` 同源,所以看板与 CLI 不会互相打脸。
|
|
57
57
|
- **零构建**:纯 ESM JavaScript,无编译步骤,`pnpm add` 即用。
|