dsh-sixlayer-memory 2.0.3 → 2.0.4

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # 变更记录 · dsh-sixlayer-memory(六层记忆底座)
2
2
 
3
+ ## 2.0.4 — 2026-11-22
4
+
5
+ 主题:**按社区索引 PR #121 的 review 修三处**(维护者 zhu1090093659)。
6
+
7
+ ### 修复
8
+
9
+ - **patch 行 id 撞名**:`cordis.patch.yml` 里原来是 `id: workbench`,而社区索引里
10
+ `dsh-workbench`(另一位作者)也占着同一个 id。两个插件同时安装会出现两行同 id,
11
+ 宿主的 `applyPatches` 按 id 建 `entryMap`,后者覆盖前者 —— 插件管理按 id 读写的启用状态也会错位。
12
+ 改为 **`id: sixlayer-memory`**(带自己的命名空间)。
13
+ - **补 LICENSE 文件**:README 第 4 行的 license 徽章原本指向一个不存在的文件(死链),
14
+ 现在补上 MIT 正文,并加进 `files`,会随包发布。
15
+ - **诊断日志不再写插件安装目录**:`lib/index.js` 的 `DIAG_FILE` 原来是
16
+ `<包目录>/docs/_rpc-diag.log`,在只读挂载或升级替换时会写失败(静默 try/catch)。
17
+ 改为 `$DSH_HOME/memory-core/diag.log`(默认 `~/.dsh/memory-core/diag.log`),
18
+ 连 `$DSH_HOME` 都写不进去才退到系统临时目录;相关文档里的排查命令同步更新。
19
+
20
+ ### 说明
21
+
22
+ - 维护者提到「npm latest 是 2.0.2」,实测是 **2.0.3**(`dist-tags.latest=2.0.3`,
23
+ tarball 200,`npm install` 落到 2.0.3)。大概率是镜像/本地缓存滞后,非版本被撤。
24
+
25
+ ---
26
+
3
27
  ## 2.0.3 — 2026-11-21
4
28
 
5
29
  主题:**发布到 npm**。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 z9134
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  dsh plugin --profile desktop add dsh-sixlayer-memory
12
12
  ```
13
13
 
14
- **当前版本**:2.0.3 · **32 个工具** · schema v9 · 零外部依赖 · 回归 31 个套件全绿
14
+ **当前版本**:2.0.4 · **32 个工具** · schema v9 · 零外部依赖 · 回归 31 个套件全绿
15
15
 
16
16
  📦 [npm](https://www.npmjs.com/package/dsh-sixlayer-memory) · 🎬 [40 秒介绍视频](media/intro-40s.mp4) · 📝 [变更记录](CHANGELOG.md)
17
17
 
package/cordis.patch.yml CHANGED
@@ -1,8 +1,12 @@
1
1
  # dsh-sixlayer-memory bundle patch
2
2
  #
3
3
  # 一个安装入口,内部两条线:记忆(memory)+ 零件(parts)。
4
- # 装上以后 profile 里多一行 workbench;工具默认只常驻 mem_admin_catalog,
4
+ # 装上以后 profile 里多一行 sixlayer-memory;工具默认只常驻 mem_admin_catalog,
5
5
  # 其余按需经 mem_admin_open 注入。
6
+ #
7
+ # 注意 id:必须带自己的命名空间。早期用过 `workbench`,而社区索引里另一个插件
8
+ # (dsh-workbench)占着同一个 id —— 两个同时装会出现两行同 id,
9
+ # 宿主的 applyPatches 按 id 建 entryMap,后者会覆盖前者(PR #121 review 指出)。
6
10
  - insert:
7
- - id: workbench
8
- name: dsh-sixlayer-memory
11
+ - id: sixlayer-memory
12
+ name: dsh-sixlayer-memory
@@ -93,7 +93,7 @@ node tools/preflight.mjs # 10 项
93
93
  node tools/verify-all.mjs # 28 个套件
94
94
  ```
95
95
 
96
- 重启后在 `docs/_rpc-diag.log` 里应看到:
96
+ 重启后在 `~/.dsh/memory-core/diag.log` 里应看到:
97
97
 
98
98
  ```
99
99
  lifecycle: attached (recall=true capture=true factory=...)
package/lib/index.js CHANGED
@@ -39,13 +39,28 @@ export const inject = ['tools', 'systemPrompt']
39
39
 
40
40
  const HERE = path.dirname(fileURLToPath(import.meta.url))
41
41
 
42
- // 诊断日志:插件加载/注册的每一步都落盘,出问题不靠猜。
43
- const DIAG_FILE = path.join(HERE, '..', 'docs', '_rpc-diag.log')
42
+ /**
43
+ * 诊断日志:插件加载/注册的每一步都落盘,出问题不靠猜。
44
+ *
45
+ * 不能写在插件自己的安装目录里 —— 市场装到只读挂载、或升级时旧目录被换掉,
46
+ * 都会写不进去(维护者 review 指出的问题)。改到 $DSH_HOME 下:
47
+ * ~/.dsh/memory-core/diag.log
48
+ * 连 $DSH_HOME 都写不了才退到系统临时目录。
49
+ */
50
+ const DSH_HOME = process.env.DSH_HOME || path.join(os.homedir(), '.dsh')
51
+ const DIAG_FILE = path.join(DSH_HOME, 'memory-core', 'diag.log')
52
+ const DIAG_FALLBACK = path.join(os.tmpdir(), 'dsh-memory-core-diag.log')
53
+
44
54
  function diag(message) {
45
- try {
46
- fs.appendFileSync(DIAG_FILE, `${new Date().toISOString()} ${message}\n`, 'utf8')
47
- } catch {
48
- /* 诊断写失败不影响主流程 */
55
+ const line = `${new Date().toISOString()} ${message}\n`
56
+ for (const file of [DIAG_FILE, DIAG_FALLBACK]) {
57
+ try {
58
+ fs.mkdirSync(path.dirname(file), { recursive: true })
59
+ fs.appendFileSync(file, line, 'utf8')
60
+ return
61
+ } catch {
62
+ /* 换下一个位置 */
63
+ }
49
64
  }
50
65
  }
51
66
 
@@ -429,11 +444,12 @@ export function apply(ctx, config = {}) {
429
444
 
430
445
  // P4:设置页「记忆底座」的 RPC 通道。UI 只读 + 审核,不直接读库。
431
446
  // 宿主里 connection 服务可能在 apply 时还没就绪;这里延迟重试,
432
- // 并把探测结果写进 docs/_rpc-diag.log,避免靠猜。
447
+ // 并把探测结果写进 $DSH_HOME/memory-core/diag.log,避免靠猜。
433
448
  ctx.effect(() => {
434
- const diagFile = path.join(HERE, '..', 'docs', '_rpc-diag.log')
449
+ const diagFile = DIAG_FILE
435
450
  const diag = (msg) => {
436
451
  try {
452
+ fs.mkdirSync(path.dirname(diagFile), { recursive: true })
437
453
  fs.appendFileSync(diagFile, `${new Date().toISOString()} ${msg}\n`, 'utf8')
438
454
  } catch {
439
455
  /* 诊断写失败不影响主流程 */
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import fs from 'node:fs'
8
8
 
9
- const LOG = 'D:/001/CH002/dsh-memory-core/docs/_rpc-diag.log'
9
+ const LOG = process.env.DSH_HOME ? process.env.DSH_HOME + '/memory-core/diag.log' : 'D:/001/CH002/dsh-memory-core/diag.log'
10
10
  function log(message) {
11
11
  try {
12
12
  fs.appendFileSync(LOG, `${new Date().toISOString()} ${message}\n`, 'utf8')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-sixlayer-memory",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "private": false,
5
5
  "description": "DSH 工作台:六层记忆底座(每轮自动召回 + 候选沉淀 + 闸门审计)+ 零件化,支持 QQ 随身使用。",
6
6
  "type": "module",
@@ -31,7 +31,8 @@
31
31
  "docs/DETAIL.md",
32
32
  "docs/DETAIL.zh.md",
33
33
  "docs/preview.svg",
34
- "docs/生命周期-自动召回与候选.md"
34
+ "docs/生命周期-自动召回与候选.md",
35
+ "LICENSE"
35
36
  ],
36
37
  "dsh": {
37
38
  "bundle": {
@@ -157,10 +157,20 @@ async function main() {
157
157
 
158
158
  const tree = await call('POST', `/repos/${OWNER}/${REPO}/git/trees`, { tree: entries })
159
159
  const message = execFileSync('git', ['-C', ROOT, 'log', '-1', '--pretty=%s'], { encoding: 'utf8' }).trim()
160
+
161
+ // 有上一次的提交就挂成父提交,让远端历史是线性的(不是每次一个孤儿快照)
162
+ let parents = []
163
+ try {
164
+ const head = await call('GET', `/repos/${OWNER}/${REPO}/git/ref/heads/main`)
165
+ if (head?.object?.sha) parents = [head.object.sha]
166
+ } catch {
167
+ /* 首次推送没有父提交 */
168
+ }
169
+
160
170
  const commit = await call('POST', `/repos/${OWNER}/${REPO}/git/commits`, {
161
171
  message: `${message}\n\n(经 GitHub API 推送)`,
162
172
  tree: tree.sha,
163
- parents: [],
173
+ parents,
164
174
  })
165
175
 
166
176
  let hasMain = true