dsh-memoir 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-memoir
2
2
 
3
- > **0.9.2** supports official npm DSH `0.2.1-alpha.1` while retaining `0.2.0-rc.1 / rc.2`. Fixes #15's cross-project recall truncation message and English issue-template recognition. Alpha compatibility is explicit; `0.2.1-alpha.2` will be assessed separately after this release and is not yet claimed as verified.
3
+ > **0.9.3** targets official npm DSH `0.2.1-rc.2`, retaining `0.2.0-rc.1 / rc.2` and `0.2.1-alpha.1 / alpha.2` support. It fixes #16's store protection and Hot Memory budget boundaries, plus #17's memory template literals breaking prompt assembly. Upgrade and reload the plugin to protect old snapshots without deleting them or rewriting original memories; #14's affected historical logs still need separate recovery.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/dsh-memoir.svg)](https://www.npmjs.com/package/dsh-memoir)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/dsh-memoir.svg)](https://www.npmjs.com/package/dsh-memoir)
@@ -14,20 +14,27 @@
14
14
  No embeddings, vector database, or cloud memory service. The npm package has zero bundled runtime dependencies; DSH and Zod 4 peers are supplied by the host environment; Zod validates session projections and is not bundled.
15
15
 
16
16
  > [!WARNING]
17
- > **0.9.2 fixes session recovery issue #14 affecting receipts written by 0.8.1–0.9.0.** Upgrading prevents new invalid receipts but does not rewrite old logs. The npm package includes `dsh-memoir-repair`. If an old session still fails, follow the [recovery guide](./SESSION_RECOVERY.md#english): audit first, stop every host and back up, then explicitly apply repair. Preserve the logs; do not downgrade their format. Stop old plugin writes before recovery; disabling auto-distillation alone does not stop manual write tools.
18
- > The fix covers official DSH `0.2.0-rc.1` / `0.2.0-rc.2`; upgrading DSH alone does not fix the old plugin or repair affected logs.
17
+ > **Historical recovery boundary (#14): receipts written by 0.8.1–0.9.0 can prevent sessions from reopening.** 0.9.3 retains the prevention introduced in 0.9.1, but upgrading does not rewrite old logs. The npm package includes `dsh-memoir-repair`. If an old session still fails, follow the [recovery guide](./SESSION_RECOVERY.md#english): audit first, stop every host and back up, then explicitly apply repair. Preserve the logs; do not downgrade their format. Stop old plugin writes before recovery; disabling auto-distillation alone does not stop manual write tools.
18
+ > #17's prompt output protection does not repair arbitrary old logs. Recovery CLI support is limited to the reviewed backends and formats listed in the recovery guide; upgrading DSH alone does not repair affected logs either.
19
19
 
20
20
  > [!IMPORTANT]
21
- > **0.9.2 requires DSH `>=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-alpha.1 <0.2.1`**, verified with official `0.2.0-rc.1` / `rc.2` / `0.2.1-alpha.1` (not an unqualified final 0.2.0). Retains the visible guide, native settings, four agent languages, separate distillation turns and frozen snapshots. **The DSH 0.1.7 line is Memoir `0.8.2`, but it remains affected by #14; upgrade the host before installing this 0.9.2 fix.**
21
+ > **0.9.3 requires DSH `>=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-alpha.1 <0.2.1`**, with development SDKs pinned to `0.2.1-rc.2`; it retains the official `0.2.0-rc.1 / rc.2` and `0.2.1-alpha.1 / alpha.2` compatibility lines. The version range does not mean every included version has been verified. Retains the visible guide, native settings, four agent languages, separate distillation turns and frozen snapshots. **The DSH 0.1.7 line is Memoir `0.8.2`, but it remains affected by #14; upgrade the host before installing the fixes in 0.9.3.**
22
22
  >
23
23
  > `dsh-memoir@0.7.1` fixes lost session snapshots after restart or RAM eviction (#10), supporting DSH **0.1.5-rc.1 / rc.2**. It requires `>=0.1.5-rc.1 <0.1.6-0`; check your host first. Keep `0.6.2` on DSH 0.1.2, or `0.5.6` on DSH 0.1.1-rc.2; those older lines do not include this fix.
24
24
 
25
25
  ```bash
26
- npm install --global @deepseek-ai/dsh@0.2.0-rc.2
27
- dsh plugin --profile web add dsh-memoir@0.9.2
26
+ npm install --global @deepseek-ai/dsh@0.2.1-rc.2
27
+ dsh plugin --profile web add dsh-memoir@0.9.3
28
28
  ```
29
29
 
30
- Restart `dsh web`. Memory remains local and is not automatically deleted when the plugin is updated or removed.
30
+ After upgrading, reload the plugin or restart `dsh web`. #17's protection takes effect on subsequent prompt assembly; no manual deletion of old snapshots is needed. Updating or removing the plugin does not automatically delete memories.
31
+
32
+ ## 0.9.3 highlights
33
+
34
+ - **Store protection ([#16](https://github.com/Qinling-Melon-Farmers/dsh-memoir/issues/16)):** future store formats, read errors and failed backups of corrupt files fail closed, refusing further loading or overwriting. A fresh store is allowed only after the damaged original has been preserved. Windows rename failures caused by temporary file contention receive bounded retries and still surface as errors when retries are exhausted.
35
+ - **Hot Memory budgets (#16):** skip candidates that exceed the remaining hard budget and continue looking for smaller entries. If the first entry is oversized, shorten its content and, if necessary, its title against the complete rendered block. Skip it if even the minimum block cannot fit; long titles cannot bypass `hotMemoryMaxTokens`.
36
+ - **Template literals ([#17](https://github.com/Qinling-Melon-Farmers/dsh-memoir/issues/17)):** set the official `PromptSection` option `interpolate: false` to disable variable interpolation for the memory section. Literals such as `{{...}}` enter the system prompt verbatim, preventing evaluation or assembly failures. New memories, cached old snapshots and restored disk snapshots all retain their original output; braces, original memory JSON, `PROJECT_MEMORY.md` and disk snapshots stay unchanged. Thanks to [mikemikimike](https://github.com/mikemikimike) for the report, output-boundary analysis and old-snapshot approach in [PR #18](https://github.com/Qinling-Melon-Farmers/dsh-memoir/pull/18), which helped locate the problem.
37
+ - **DSH rc.2 compatibility:** update the SDK baseline to `0.2.1-rc.2`, adapting to the JSONL backend's named `apply` export and log-generation recovery protocol. Project memory remains anchored to the original session project when the execution directory changes. See the [recovery guide](./SESSION_RECOVERY.md#english) for the five supported official SDK versions and safety boundaries. Runtime compatibility does not imply recovery of arbitrary historical logs.
31
38
 
32
39
  ## Why dsh-memoir
33
40
 
@@ -69,10 +76,12 @@ Complete history and Hot Memory are separate layers:
69
76
 
70
77
  - **Full Memory** retains every record for the GUI, human review, Markdown projection, and ranked retrieval.
71
78
  - **Hot Memory** selects only budgeted actions, lessons, and recent state; the full `PROJECT_MEMORY.md` is never injected.
72
- - **Session Snapshot** durably freezes injected text per session and restores it after restart or RAM eviction. New writes remain immediately readable by tools and the GUI; automatic injection refreshes in the next new session. Recovery failures explicitly report degraded persistence.
79
+ - **Session Snapshot** durably freezes each session's injection baseline and reuses the original text after restart or RAM eviction. 0.9.3 protects old baselines by disabling variable interpolation for the memory section; injected text and stored snapshots remain unchanged. New writes remain immediately readable by tools and the GUI; automatic injection refreshes in the next new session. Recovery failures explicitly report degraded persistence.
73
80
 
74
81
  ### Snapshot recovery and cleanup (0.7.1)
75
82
 
83
+ **Upgrading to 0.9.3:** #17's protection covers both cached and restored disk snapshots. Upgrade and reload the plugin; the disk cleanup steps below are not required for this fix. With variable interpolation disabled for the memory section, old baselines containing template literals are still emitted verbatim, preserving braces and the frozen prefix. This does not repair #14's invalid receipts or other historical log failures.
84
+
76
85
  - Default directory: `$DSH_HOME/dsh-memoir.json.snapshots/`, or `<storePath>.snapshots/` with a custom store. Records are partitioned by data-source/settings hash, language, and session hash. They load on demand without scanning the whole directory at startup.
77
86
  - `sessionSnapshotMax` bounds RAM only. Disk records have no automatic TTL and survive shrinking, uninstalling, or clearing RAM. Include them in backups. To reclaim disk, stop the relevant DSH processes, back up first, and manually remove records you no longer need to resume. Access after removal establishes a new baseline.
78
87
  - Languages use separate namespaces; switching back restores the original baseline for that language. Budget changes affect new baselines only. Forks/new session IDs do not inherit the parent's frozen record.
@@ -185,26 +194,28 @@ Choose German agent-facing copy independently of the English GUI; settings and m
185
194
 
186
195
  | Channel | DSH baseline | Installation | Status |
187
196
  | --- | --- | --- | --- |
188
- | npm `latest` (`0.9.2`) | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | `dsh plugin --profile web add dsh-memoir@0.9.2` | Tested on 0.2.0-rc.1 / rc.2 / 0.2.1-alpha.1; fixes #14 |
197
+ | pinned npm `0.9.3` | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | `dsh plugin --profile web add dsh-memoir@0.9.3` | SDK 0.2.1-rc.2; compatible with 0.2.0-rc.1 / rc.2 and 0.2.1-alpha.1 / alpha.2 |
189
198
  | pinned npm `0.8.2` | `>=0.1.7-rc.1 <0.1.8-0` | `dsh plugin --profile web add dsh-memoir@0.8.2` | Legacy 0.1.7 line; still affected by #14 |
190
199
  | pinned npm `0.7.1` | `>=0.1.5-rc.1 <0.1.6-0` | `dsh plugin --profile web add dsh-memoir@0.7.1` | Legacy 0.1.5 line |
191
200
  | pinned npm `0.6.2` | `>=0.1.2-alpha.2 <0.1.3` | `dsh plugin --profile web add dsh-memoir@0.6.2` | Legacy 0.1.2 line |
192
201
  | pinned npm `0.5.6` | `0.1.1-rc.2` | `dsh plugin --profile web add dsh-memoir@0.5.6` | rc2 compatibility line |
193
- | Source `v0.9.2` | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | local build + `link:` | Development; not compatible with legacy 0.1.x |
202
+ | Source `v0.9.3` | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | local build + `link:` | SDK 0.2.1-rc.2; development, not compatible with legacy 0.1.x |
203
+
204
+ Development SDKs are uniformly pinned to `0.2.1-rc.2`. Host compatibility in this table is separate from #14 recovery CLI restrictions on backends, file formats and log generations; see [SESSION_RECOVERY.md](./SESSION_RECOVERY.md#english) for recovery scope.
194
205
 
195
206
  Node.js `^22.19.0 || >=24.0.0` is required. 0.7.1 keeps the native `conversation.view` / `settings.section` slots and `snapshotEvents()`. DSH 0.1.5 uses Session log V3, independent of Memoir store v4 / settings v3. Back up DSH_HOME before upgrading DSH; migrated sessions are not guaranteed readable by older hosts. This Memoir release neither migrates nor resets memory and retains frozen session snapshots without enabling new dynamic-prompt behavior.
196
207
 
197
208
  <details>
198
209
  <summary>Install from source</summary>
199
210
 
200
- 0.9.2 source (DSH 0.2.0-rc.1 / rc.2):
211
+ 0.9.3 source (development SDKs / example host: DSH 0.2.1-rc.2):
201
212
 
202
213
  ```bash
203
- git clone --branch v0.9.2 https://github.com/Qinling-Melon-Farmers/dsh-memoir.git
214
+ git clone --branch v0.9.3 https://github.com/Qinling-Melon-Farmers/dsh-memoir.git
204
215
  cd dsh-memoir
205
216
  pnpm install --frozen-lockfile
206
217
  pnpm run build
207
- npm install --global @deepseek-ai/dsh@0.2.0-rc.2
218
+ npm install --global @deepseek-ai/dsh@0.2.1-rc.2
208
219
  dsh plugin --profile web add "link:/absolute/path/dsh-memoir"
209
220
  ```
210
221
 
@@ -229,7 +240,7 @@ dsh plugin --profile web add "link:/absolute/path/dsh-memoir"
229
240
 
230
241
  ## Offline release highlights
231
242
 
232
- The first Memory Conversation opening shows the 0.9.2 alpha.1 compatibility, recall-count fix and old-log recovery boundary without blocking chat. Choose “Got it” to stop automatic display for this version in the same browser origin. Reopen anytime from “About & help → View release highlights”. Settings and sidebar panels never open the notice automatically. The image below is explicitly retained as a historical 0.9.0 preview.
243
+ The first Memory Conversation opening shows the 0.9.3 highlights without blocking chat: DSH 0.2.1-rc.2 compatibility, #16's store and budget protection, and #17's template-literal protection. It explains that old snapshots need no deletion while #14's affected logs still need separate recovery. Choose “Got it” to stop automatic display for this version in the same browser origin. Reopen anytime from “About & help → View release highlights”. Settings and sidebar panels never open the notice automatically. The image below is explicitly retained as a historical 0.9.0 preview.
233
244
 
234
245
  The Chinese/English notice is offline: no network requests, uploads, memory changes or conversation edits. Only the acknowledged version is stored locally by the UI. If storage is unavailable, acknowledgment lasts for the current page; Web/Desktop and different origins are not guaranteed to share it.
235
246
 
@@ -315,6 +326,6 @@ pnpm test
315
326
  npm run bench
316
327
  ```
317
328
 
318
- Read [CONTRIBUTING.md](./CONTRIBUTING.md) before submitting changes. See [CHANGELOG.md](./CHANGELOG.md) for version history. Formal packages are published by the tag workflow through npm OIDC. The current version is [v0.9.2](https://github.com/Qinling-Melon-Farmers/dsh-memoir/releases/tag/v0.9.2), targeting DSH 0.2.0-rc.1 / rc.2. See the compatibility table above for legacy lines and their risks.
329
+ Read [CONTRIBUTING.md](./CONTRIBUTING.md) before submitting changes. See [CHANGELOG.md](./CHANGELOG.md) for 0.9.3 changes; the development SDK baseline is DSH 0.2.1-rc.2. See the compatibility table above for older lines and risks. Formal packages are published by the tag workflow through npm OIDC; consult [Releases](https://github.com/Qinling-Melon-Farmers/dsh-memoir/releases) and npm for publication status.
319
330
 
320
331
  Apache-2.0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-memoir
2
2
 
3
- > **0.9.2**:支持官方 npm DSH `0.2.1-alpha.1`,保留 `0.2.0-rc.1 / rc.2` 支持,修复 #15 的跨项目召回截断提示及英文 Issue 模板误判。alpha 兼容范围单独声明;`0.2.1-alpha.2` 将在发布后另行适配,目前不宣称已验证。
3
+ > **0.9.3**:适配官方 npm DSH `0.2.1-rc.2`,保留 `0.2.0-rc.1 / rc.2` 与 `0.2.1-alpha.1 / alpha.2` 支持。修复 #16 的存储保护与 Hot Memory 预算边界,以及 #17 的记忆模板字面量阻断 prompt 组装问题。升级并重新加载插件即可保护旧快照,无需删除快照或改写原始记忆;#14 的旧日志故障仍须单独恢复。
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/dsh-memoir.svg)](https://www.npmjs.com/package/dsh-memoir)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/dsh-memoir.svg)](https://www.npmjs.com/package/dsh-memoir)
@@ -13,20 +13,27 @@
13
13
  无需 embedding、向量数据库或云端记忆服务;npm 包零捆绑运行时依赖,DSH 与 Zod 4 peer 由宿主环境提供;Zod 用于验证宿主会话投影,不捆绑进插件。
14
14
 
15
15
  > [!WARNING]
16
- > **0.9.2 修复会话恢复问题 #14:0.8.1–0.9.0 写入的旧回执可能导致会话重新打开失败。** 升级阻止新增异常,但不自动重写旧日志;npm 包已内置 `dsh-memoir-repair` 命令。旧会话仍打不开时,按[恢复说明](./SESSION_RECOVERY.md)先只读检查、停机备份后再显式恢复;不要删除日志或降级数据格式。恢复前停止旧插件写入,仅关闭自动蒸馏不能阻止手动工具写入。
17
- > 修复已覆盖官方 DSH `0.2.0-rc.1` / `0.2.0-rc.2`;仅升级 DSH 不会修复旧插件或已有异常日志。
16
+ > **#14 旧日志恢复边界:0.8.1–0.9.0 写入的旧回执可能导致会话重新打开失败。** 0.9.3 保留 0.9.1 起阻止新增异常回执的修复,但升级不自动重写旧日志;npm 包内置 `dsh-memoir-repair` 命令。旧会话仍打不开时,按[恢复说明](./SESSION_RECOVERY.md)先只读检查、停机备份后再显式恢复;不要删除日志或降级数据格式。恢复前停止旧插件写入,仅关闭自动蒸馏不能阻止手动工具写入。
17
+ > #17 的 prompt 输出防护不修复任意旧日志。恢复 CLI 的后端与格式支持须以恢复说明列出的已审计范围为准;仅升级 DSH 也不会修复已有异常日志。
18
18
 
19
19
  > [!IMPORTANT]
20
- > **0.9.2 要求 DSH `>=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-alpha.1 <0.2.1`**,已验证官方 `0.2.0-rc.1` / `rc.2` / `0.2.1-alpha.1`(不是无后缀正式 0.2.0)。保留首屏导引、原生设置、四种 Agent 语言、独立蒸馏回合与冻结快照。**DSH 0.1.7 兼容线为 `0.8.2`,但仍受 #14 影响;使用本修复须先升级宿主,再安装 0.9.2。**
20
+ > **0.9.3 要求 DSH `>=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-alpha.1 <0.2.1`**,开发 SDK 基线为 `0.2.1-rc.2`;保留官方 `0.2.0-rc.1 / rc.2` 与 `0.2.1-alpha.1 / alpha.2` 兼容线。版本范围不代表其中所有版本均已验证。保留首屏导引、原生设置、四种 Agent 语言、独立蒸馏回合与冻结快照。**DSH 0.1.7 兼容线为 `0.8.2`,但仍受 #14 影响;使用本版修复须先升级宿主,再安装 0.9.3。**
21
21
  >
22
22
  > `dsh-memoir@0.7.1` 修复重启和内存淘汰后旧会话快照丢失(#10),支持 DSH **0.1.5-rc.1 / rc.2**。要求 `>=0.1.5-rc.1 <0.1.6-0`;请先核对宿主版本。旧 DSH 0.1.2 用户固定使用 `0.6.2`,0.1.1-rc.2 用户固定使用 `0.5.6`;这些旧版未包含本次修复。
23
23
 
24
24
  ```bash
25
- npm install --global @deepseek-ai/dsh@0.2.0-rc.2
26
- dsh plugin --profile web add dsh-memoir@0.9.2
25
+ npm install --global @deepseek-ai/dsh@0.2.1-rc.2
26
+ dsh plugin --profile web add dsh-memoir@0.9.3
27
27
  ```
28
28
 
29
- 重启 `dsh web` 即可。记忆保存在本机,不会随插件升级或卸载自动删除。
29
+ 升级后重新加载插件,或重启 `dsh web`。#17 防护会在后续 prompt 组装时生效;无需手工删除旧快照。记忆不会随插件升级或卸载自动删除。
30
+
31
+ ## 0.9.3 更新摘要
32
+
33
+ - **存储保护([#16](https://github.com/Qinling-Melon-Farmers/dsh-memoir/issues/16))**:遇到未来 store 格式、读取错误或损坏文件备份失败时,报错并拒绝继续加载或覆盖(fail closed)。只有成功保留损坏原文件后才允许建立空库;Windows 临时占用导致的 rename 失败采用有界重试,耗尽后仍报错。
34
+ - **Hot Memory 预算(#16)**:候选超出剩余硬预算时跳过并继续寻找较小条目;首条过大时按渲染后的完整块缩短正文,必要时缩短标题。连最小块也放不下则跳过,长标题不能突破 `hotMemoryMaxTokens`。
35
+ - **模板字面量([#17](https://github.com/Qinling-Melon-Farmers/dsh-memoir/issues/17))**:通过官方 `PromptSection` 的 `interpolate: false` 关闭记忆 section 的变量插值,使 `{{...}}` 等字面量按原文进入 system prompt,避免被求值或导致组装失败。新记忆、进程内旧快照与磁盘恢复的旧快照均按原文输出;花括号、原始记忆 JSON、`PROJECT_MEMORY.md` 与磁盘快照保持原样。感谢 [mikemikimike](https://github.com/mikemikimike) 在 [PR #18](https://github.com/Qinling-Melon-Farmers/dsh-memoir/pull/18) 中的报告、输出边界分析及旧快照方案对问题定位的帮助。
36
+ - **DSH rc.2 适配**:SDK 基线更新至 `0.2.1-rc.2`,适配 JSONL 后端的具名 `apply` 导出及 generation(日志代际)恢复协议。项目记忆仍绑定会话原始项目,切换执行目录不转移归属。恢复 CLI 支持的五个官方 SDK 版本和安全边界见[恢复说明](./SESSION_RECOVERY.md);运行时兼容不等于任意历史日志均可恢复。
30
37
 
31
38
  ## 为什么选择 dsh-memoir
32
39
 
@@ -68,10 +75,12 @@ memoir_record / memoir_update
68
75
 
69
76
  - **Full Memory** 保留全部记录,用于 GUI、人工审阅、Markdown 投影和排序检索。
70
77
  - **Hot Memory** 只选择预算内的 actions、lessons 与 recent state;不会把整个 `PROJECT_MEMORY.md` 塞进 prompt。
71
- - **Session Snapshot** 按会话持久化冻结注入文本,重启恢复与内存淘汰后仍复用原文。新写入立即可被工具和 GUI 读取,但自动注入从下一个新会话开始更新;恢复失败会显式报告降级。
78
+ - **Session Snapshot** 按会话持久化冻结注入基线,重启恢复与内存淘汰后继续复用原文。0.9.3 通过关闭记忆 section 的变量插值保护旧基线,注入文本与已存快照均保持原样。新写入立即可被工具和 GUI 读取,但自动注入从下一个新会话开始更新;恢复失败会显式报告降级。
72
79
 
73
80
  ### 快照恢复与清理(0.7.1)
74
81
 
82
+ **0.9.3 升级提示:** #17 防护同时覆盖进程内缓存和磁盘恢复的旧快照,升级并重新加载插件即可,无需按下面的磁盘清理步骤删除它们。记忆 section 关闭变量插值后,含模板字面量的旧基线仍按原文输出,花括号与冻结前缀保持不变;这不等于修复 #14 的异常回执或其它旧日志故障。
83
+
75
84
  - 默认目录:`$DSH_HOME/dsh-memoir.json.snapshots/`;自定义 storePath 时为 `<storePath>.snapshots/`。记录按数据源/设置文件的哈希、语言和会话哈希分开保存;按需读取,不在启动时加载全部文件。
76
85
  - `sessionSnapshotMax` 只限制内存 LRU。磁盘记录无自动 TTL,不随缩容、卸载或清理内存删除;备份记忆时请一起备份该目录。需要回收磁盘时先停止相关 DSH 进程并备份,再人工删除确定不再恢复的记录。删除后再次访问会建立新基线。
77
86
  - 语言切换使用独立快照空间;切回原语言会复用其旧基线。预算修改仅影响新基线;fork/新 session id 不借用父会话快照。
@@ -184,26 +193,28 @@ memoir_record / memoir_update
184
193
 
185
194
  | 渠道 | DSH 基线 | 安装方式 | 状态 |
186
195
  | --- | --- | --- | --- |
187
- | npm `latest`(`0.9.2`) | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | `dsh plugin --profile web add dsh-memoir@0.9.2` | 实测 0.2.0-rc.1 / rc.2 / 0.2.1-alpha.1;修复 #14 |
196
+ | npm 固定版 `0.9.3` | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | `dsh plugin --profile web add dsh-memoir@0.9.3` | SDK 0.2.1-rc.2;兼容 0.2.0-rc.1 / rc.2、0.2.1-alpha.1 / alpha.2 |
188
197
  | npm 固定版 `0.8.2` | `>=0.1.7-rc.1 <0.1.8-0` | `dsh plugin --profile web add dsh-memoir@0.8.2` | 旧 0.1.7 兼容线,仍受 #14 影响 |
189
198
  | npm 固定版 `0.7.1` | `>=0.1.5-rc.1 <0.1.6-0` | `dsh plugin --profile web add dsh-memoir@0.7.1` | 旧 0.1.5 维护线 |
190
199
  | npm 固定版 `0.6.2` | `>=0.1.2-alpha.2 <0.1.3` | `dsh plugin --profile web add dsh-memoir@0.6.2` | 旧 0.1.2 兼容线 |
191
200
  | npm 固定版 `0.5.6` | `0.1.1-rc.2` | `dsh plugin --profile web add dsh-memoir@0.5.6` | rc2 兼容线 |
192
- | 源码 `v0.9.2` | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | 本地构建 + `link:` | 开发调试,不兼容旧 0.1.x |
201
+ | 源码 `v0.9.3` | `>=0.2.0-rc.1 <0.3.0-0 \|\| >=0.2.1-alpha.1 <0.2.1` | 本地构建 + `link:` | SDK 0.2.1-rc.2;开发调试,不兼容旧 0.1.x |
202
+
203
+ 本版开发 SDK 统一固定为 `0.2.1-rc.2`。兼容矩阵中的宿主支持与 #14 恢复 CLI 的后端、文件格式及 generation 限制是不同边界;恢复范围见 [SESSION_RECOVERY.md](./SESSION_RECOVERY.md)。
193
204
 
194
205
  需要 Node.js `^22.19.0 || >=24.0.0`。0.7.1 继续使用原生 `conversation.view` / `settings.section` 与 `snapshotEvents()`。DSH 0.1.5 的会话日志升级至 V3;其迁移与 Memoir 的 store v4 / settings v3 是独立格式。升级 DSH 前备份 DSH_HOME,迁移后的 DSH 会话不能承诺被旧宿主读取。Memoir 本次不迁移或清空记忆,也不启用新动态提示词行为;既有会话快照语义保持不变。
195
206
 
196
207
  <details>
197
208
  <summary>从源码安装</summary>
198
209
 
199
- 0.9.2 源码(DSH 0.2.0-rc.1 / rc.2):
210
+ 0.9.3 源码(开发 SDK / 示例宿主 DSH 0.2.1-rc.2):
200
211
 
201
212
  ```bash
202
- git clone --branch v0.9.2 https://github.com/Qinling-Melon-Farmers/dsh-memoir.git
213
+ git clone --branch v0.9.3 https://github.com/Qinling-Melon-Farmers/dsh-memoir.git
203
214
  cd dsh-memoir
204
215
  pnpm install --frozen-lockfile
205
216
  pnpm run build
206
- npm install --global @deepseek-ai/dsh@0.2.0-rc.2
217
+ npm install --global @deepseek-ai/dsh@0.2.1-rc.2
207
218
  dsh plugin --profile web add "link:/absolute/path/dsh-memoir"
208
219
  ```
209
220
 
@@ -228,7 +239,7 @@ dsh plugin --profile web add "link:/absolute/path/dsh-memoir"
228
239
 
229
240
  ## 离线更新公告
230
241
 
231
- 首次打开记忆会话页时展示 0.9.2 更新摘要,提示 alpha.1 兼容、召回计数修复与旧日志恢复边界,不阻塞对话;点击“知道了”后,同一浏览器 origin 的本版本不再自动展示。“关于与帮助 → 查看本版更新”可随时重看。设置页和右侧栏不会自动弹出公告。下图保留为已标注版本的 0.9.0 历史预览。
242
+ 首次打开记忆会话页时展示 0.9.3 更新摘要,提示 DSH 0.2.1-rc.2 适配、#16 存储与预算保护、#17 模板字面量防护,以及旧快照无需删除、#14 旧日志仍须单独恢复的边界,不阻塞对话;点击“知道了”后,同一浏览器 origin 的本版本不再自动展示。“关于与帮助 → 查看本版更新”可随时重看。设置页和右侧栏不会自动弹出公告。下图保留为已标注版本的 0.9.0 历史预览。
232
243
 
233
244
  公告随包内置、中英双语,不联网、不上传信息、不改变记忆或对话。仅在 UI 本地存储记录已确认版本;存储不可用时退化为当前页面去重,Web/桌面端或不同 origin 的确认状态不承诺同步。
234
245
 
@@ -314,6 +325,6 @@ pnpm test
314
325
  npm run bench
315
326
  ```
316
327
 
317
- 提交前请阅读 [CONTRIBUTING.md](./CONTRIBUTING.md)。版本变化见 [CHANGELOG.md](./CHANGELOG.md),正式包由 tag 工作流通过 npm OIDC 发布。当前版本是 [v0.9.2](https://github.com/Qinling-Melon-Farmers/dsh-memoir/releases/tag/v0.9.2),面向 DSH 0.2.0-rc.1 / rc.2;旧兼容线与风险见上方兼容性表。
328
+ 提交前请阅读 [CONTRIBUTING.md](./CONTRIBUTING.md)。0.9.3 版本变化见 [CHANGELOG.md](./CHANGELOG.md),开发 SDK 基线为 DSH 0.2.1-rc.2;旧兼容线与风险见上方兼容性表。正式包由 tag 工作流通过 npm OIDC 发布,发布状态以 [Releases](https://github.com/Qinling-Melon-Farmers/dsh-memoir/releases) 与 npm 为准。
318
329
 
319
330
  Apache-2.0
@@ -6,18 +6,19 @@
6
6
 
7
7
  Memoir 0.8.1–0.9.0 的实际写入回执使用了没有 `ignorable` 标记的 `dsh-memoir/written` 自定义事件。DSH 能追加它,但重新读取持久化日志时会拒绝整份历史。这不等于会话正文或 `dsh-memoir.json` 记忆数据已被删除。
8
8
 
9
- **0.9.1 同时包含预防修复和独立恢复工具**。新版不再生成该事件,直接工具调用使用官方 `tool/result.meta`;升级插件不会自动重写旧日志。**恢复前先停止受影响插件的写入并升级至 0.9.1**,否则旧版仍会生成坏回执;只关闭自动蒸馏不够,手动 `memoir_record` / `memoir_update` 也会触发。
9
+ **从 0.9.1 起同时包含预防修复和独立恢复工具**。新版不再生成该事件,直接工具调用使用官方 `tool/result.meta`;升级插件不会自动重写旧日志。**恢复前先停止受影响插件的写入并升级至支持当前宿主的修复版本(本版为 0.9.3)**,否则旧版仍会生成坏回执;只关闭自动蒸馏不够,手动 `memoir_record` / `memoir_update` 也会触发。
10
10
 
11
11
  ### 只读检查
12
12
 
13
13
  无需 Git 或源码安装:npm 包已包含 `dsh-memoir-repair` 命令、原始脚本和本文。用 Node 24,传入官方 DSH 安装目录和**一个具体会话文件**,不要传记忆 JSON、目录或通配符:
14
14
 
15
15
  ```sh
16
- npm exec --yes --package=dsh-memoir@0.9.2 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" "/path/to/session.v4.jsonl.zstd"
16
+ npm exec --yes --package=dsh-memoir@0.9.3 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" "/storage-root/<project>/<session-id>/session.v4.jsonl.zstd"
17
17
  ```
18
18
 
19
19
  - Windows 全局路径可用 `npm root -g` 查出,再附加 `@deepseek-ai/dsh`;WSL 使用自己的 Linux 安装。桌面内置依赖不可直接供 Node 加载时,使用单独安装的官方 npm DSH 作为校验器,不修改桌面文件。
20
- - 0.9.2 支持已审计的官方 JSONL backend `0.2.0-rc.1` / `0.2.0-rc.2` / `0.2.1-alpha.1`,其它版本(包括尚未审计的 alpha.2)拒绝执行。只检查符合校验器的原生 v4 旧日志,不运行宿主、不迁移历史格式。
20
+ - npm 0.9.3 支持已审计的官方 JSONL backend `0.2.0-rc.1` / `0.2.0-rc.2` / `0.2.1-alpha.1` / `0.2.1-alpha.2` / `0.2.1-rc.2`。其它版本及混合 SDK 依赖树拒绝执行。只检查符合校验器的原生 v4 旧日志,不运行宿主、不迁移历史格式。
21
+ - 文件必须位于与日志头部匹配的官方项目/会话目录内;请传实际路径,而不是照抄示例占位符或把单个文件复制到任意目录。只读取该会话目录的同级日志代次名称/元数据,拒绝已被更新格式取代的 v4、混合压缩编码、非规范文件名及路径别名;不会扫描其它项目,也不保证整个存储根目录没有其它问题。应用前、取得写锁后及替换前均复核代次状态。
21
22
  - 支持 `session.v4.jsonl` / `session.v4.jsonl.zstd`,存储和解压后均最多 128 MiB;Zstandard 每帧必须带校验和。日志截断、损坏、其它未知且不可忽略事件、符号链接/目录联接、硬链接等均拒绝修改。
22
23
  - 默认不改文件,不递归扫描用户目录;输出只有路径、计数和固定错误码,不输出正文或密钥。`candidates` 是待修复回执数量。
23
24
  - 上述 `npm exec` 可能联网下载 npm 包;恢复脚本本身只在本地运行,不上传日志。若插件已通过 npm 安装,也可完全离线执行 `node "/path/to/profile/node_modules/dsh-memoir/scripts/repair-session-receipts.mjs"`,后接相同参数。
@@ -28,7 +29,7 @@ npm exec --yes --package=dsh-memoir@0.9.2 -- dsh-memoir-repair --dsh-package "/p
28
29
  完全退出使用这份日志的 Web、CLI、桌面和后台宿主,独立备份会话目录。确认只读检查成功,再执行:
29
30
 
30
31
  ```sh
31
- npm exec --yes --package=dsh-memoir@0.9.2 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" --apply --host-stopped "/path/to/session.v4.jsonl.zstd"
32
+ npm exec --yes --package=dsh-memoir@0.9.3 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" --apply --host-stopped "/storage-root/<project>/<session-id>/session.v4.jsonl.zstd"
32
33
  ```
33
34
 
34
35
  脚本取得官方会话写锁,逐项校验原始日志,仅在旧回执最外层补 `ignorable: true`;不删事件、不重排 seq、不改正文/时间/工具数据。受影响压缩帧会重压缩,其它帧原样保留。原始字节写入同目录唯一 `.memoir-repair-<id>.bak`,验证后才以同目录原子替换安装结果。再次执行是无操作;备份不会自动删除。
@@ -43,13 +44,15 @@ npm exec --yes --package=dsh-memoir@0.9.2 -- dsh-memoir-repair --dsh-package "/p
43
44
 
44
45
  Memoir 0.8.1–0.9.0 appends a custom `dsh-memoir/written` receipt without `ignorable`. DSH can write it but refuses the whole persisted history on reopen. This does not itself delete the raw conversation or the memory store. **0.9.1 includes both prevention and a standalone recovery tool**. It uses official `tool/result.meta`; upgrading never rewrites old sessions automatically.
45
46
 
46
- Stop memory writes from affected builds and upgrade to 0.9.1 first: disabling auto-distillation alone does not prevent manual write tools from producing another invalid receipt. The npm package includes the `dsh-memoir-repair` command, its script and this guide; no Git checkout is needed. Use Node 24 and audit one explicitly named file:
47
+ Stop memory writes from affected builds and upgrade to a fixed version supporting your host (0.9.3 in this release) first: disabling auto-distillation alone does not prevent manual write tools from producing another invalid receipt. The npm package includes the `dsh-memoir-repair` command, its script and this guide; no Git checkout is needed. Use Node 24 and audit one explicitly named file:
47
48
 
48
49
  ```sh
49
- npm exec --yes --package=dsh-memoir@0.9.2 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" "/path/to/session.v4.jsonl.zstd"
50
+ npm exec --yes --package=dsh-memoir@0.9.3 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" "/storage-root/<project>/<session-id>/session.v4.jsonl.zstd"
50
51
  ```
51
52
 
52
- The official DSH directory supplies the reviewed v4 validators and native lease dependencies. **0.9.2 supports 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-alpha.1**. Other backends, including unaudited alpha.2, are rejected. `npm root -g` locates global packages; Windows and WSL have separate installations. An independently installed official npm DSH can validate desktop logs without editing the desktop installation.
53
+ The official DSH directory supplies the reviewed v4 validators and native lease dependencies. **npm 0.9.3 supports 0.2.0-rc.1 / 0.2.0-rc.2 / 0.2.1-alpha.1 / 0.2.1-alpha.2 / 0.2.1-rc.2**. Other versions and mixed SDK dependency trees are rejected. `npm root -g` locates global packages; Windows and WSL have separate installations. An independently installed official npm DSH can validate desktop logs without editing the desktop installation.
54
+
55
+ The file must remain in the official project/session directory matching its header. Use the actual path, not the example placeholders or an arbitrarily relocated single file. The tool checks sibling generation names/metadata only within that session: newer superseding formats, mixed encodings, noncanonical filenames and path aliases are rejected. It does not scan other projects or certify the whole storage root. Generation state is rechecked after taking the lease and immediately before replacement.
53
56
 
54
57
  `npm exec` may download the package from npm, but the recovery script runs locally and never uploads logs. For an entirely offline invocation of an already installed npm copy, use `node "/path/to/profile/node_modules/dsh-memoir/scripts/repair-session-receipts.mjs"` with the same arguments. In a source checkout with the pinned official SDK devDependencies installed, `--dsh-package` may be omitted. The script never downloads dependencies itself.
55
58
 
@@ -58,7 +61,7 @@ Default operation is read-only: no home scan, no host startup, no migration, and
58
61
  Exit **every** Web/CLI/desktop/background host using the file and independently back up the session directory. After a successful audit, apply explicitly:
59
62
 
60
63
  ```sh
61
- npm exec --yes --package=dsh-memoir@0.9.2 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" --apply --host-stopped "/path/to/session.v4.jsonl.zstd"
64
+ npm exec --yes --package=dsh-memoir@0.9.3 -- dsh-memoir-repair --dsh-package "/path/to/node_modules/@deepseek-ai/dsh" --apply --host-stopped "/storage-root/<project>/<session-id>/session.v4.jsonl.zstd"
62
65
  ```
63
66
 
64
67
  The script takes the official session lease and adds only `ignorable: true` to exact legacy receipt envelopes, preserving event order, seq, timestamps, payloads and untouched compressed frames. A unique adjacent `.memoir-repair-<id>.bak` stores the verified original bytes before atomic replacement. Backups are retained; a second run makes no change.
package/lib/client.js CHANGED
@@ -30,7 +30,7 @@ __export(index_exports, {
30
30
  module.exports = __toCommonJS(index_exports);
31
31
 
32
32
  // <define:__MEMOIR_PACKAGE_INFO__>
33
- var define_MEMOIR_PACKAGE_INFO_default = { version: "0.9.2", hostRange: ">=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-alpha.1 <0.2.1", sdkBaseline: "0.2.0-rc.1" };
33
+ var define_MEMOIR_PACKAGE_INFO_default = { version: "0.9.3", hostRange: ">=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-alpha.1 <0.2.1", sdkBaseline: "0.2.1-rc.2" };
34
34
 
35
35
  // src/client/index.tsx
36
36
  var import_react5 = require("react");
@@ -170,8 +170,8 @@ var dictionaries = {
170
170
  "notice.title": "\u672C\u7248\u66F4\u65B0",
171
171
  "notice.dismiss": "\u77E5\u9053\u4E86",
172
172
  "notice.reopen": "\u67E5\u770B\u672C\u7248\u66F4\u65B0",
173
- "notice.compat": "0.9.2 \u9884\u9002\u914D DSH 0.2.1-alpha.1\uFF0C\u4FDD\u7559 0.2.0-rc.1 / rc.2 \u652F\u6301\uFF1B\u4FEE\u590D\u8DE8\u9879\u76EE\u53EC\u56DE\u4E2D\u5DF2\u5C55\u793A\u8BB0\u5FC6\u88AB\u8BEF\u62A5\u4E3A\u622A\u65AD\u7684\u95EE\u9898\u3002",
174
- "notice.features": "\u5347\u7EA7\u963B\u6B62\u65B0\u589E\u5F02\u5E38\uFF0C\u4F46\u4E0D\u4F1A\u81EA\u52A8\u6539\u5199\u65E7\u65E5\u5FD7\u3002\u65E7\u4F1A\u8BDD\u4ECD\u6253\u4E0D\u5F00\u65F6\uFF0C\u8BF7\u6309 README \u7684\u5386\u53F2\u6062\u590D\u8BF4\u660E\uFF1A\u5148\u53EA\u8BFB\u68C0\u67E5\uFF0C\u5168\u90E8\u5BBF\u4E3B\u9000\u51FA\u5E76\u5907\u4EFD\u540E\uFF0C\u518D\u663E\u5F0F\u6267\u884C\u6062\u590D\u3002",
173
+ "notice.compat": "0.9.3 \u9002\u914D DSH 0.2.1-rc.2\uFF1B\u4FEE\u590D\u8BB0\u5FC6\u4E2D\u7684\u6A21\u677F\u5B57\u9762\u91CF\u963B\u65AD\u5BF9\u8BDD\u3001Hot Memory \u9884\u7B97\u63D0\u524D\u7EC8\u6B62\uFF0C\u4EE5\u53CA\u5F02\u5E38\u5B58\u50A8\u6587\u4EF6\u7684\u4FDD\u62A4\u7F3A\u53E3\u3002",
174
+ "notice.features": "\u5347\u7EA7\u5E76\u91CD\u65B0\u52A0\u8F7D\u63D2\u4EF6\u540E\uFF0C\u542B\u6A21\u677F\u5B57\u9762\u91CF\u7684\u65E7\u5FEB\u7167\u65E0\u9700\u624B\u5DE5\u5220\u9664\uFF1B\u539F\u59CB\u8BB0\u5FC6\u4E0D\u6539\u5199\u3002\u65E7\u7248\u5F02\u5E38\u56DE\u6267\u5BFC\u81F4\u7684\u5386\u53F2\u65E5\u5FD7\u6545\u969C\u4ECD\u9700\u5355\u72EC\u6062\u590D\uFF1A\u5148\u53EA\u8BFB\u68C0\u67E5\uFF0C\u5168\u90E8\u5BBF\u4E3B\u9000\u51FA\u5E76\u5907\u4EFD\u540E\uFF0C\u518D\u6309\u6062\u590D\u6307\u5357\u6267\u884C\u3002",
175
175
  "notice.privacy": "\u516C\u544A\u968F\u5305\u5185\u7F6E\uFF0C\u4E0D\u8054\u7F51\u3001\u4E0D\u6539\u8BB0\u5FC6\u3002\u786E\u8BA4\u540E\u672C\u7248\u672C\u4E0D\u518D\u81EA\u52A8\u663E\u793A\uFF1B\u53EF\u5728\u201C\u5173\u4E8E\u4E0E\u5E2E\u52A9\u201D\u91CD\u770B\u3002",
176
176
  "about.host": "\u652F\u6301\u7684 DSH \u8303\u56F4",
177
177
  "about.baseline": "\u5F00\u53D1 SDK \u57FA\u7EBF",
@@ -393,8 +393,8 @@ var dictionaries = {
393
393
  "notice.title": "What\u2019s new",
394
394
  "notice.dismiss": "Got it",
395
395
  "notice.reopen": "View release highlights",
396
- "notice.compat": "0.9.2 prepares support for DSH 0.2.1-alpha.1 while retaining 0.2.0-rc.1 / rc.2. Fixes misleading truncation counts for memories already displayed during cross-project recall.",
397
- "notice.features": "Upgrading prevents new invalid receipts; it does not rewrite old logs. If an old session still fails to open, follow the recovery guide linked in README: audit first, stop every host and back up, then explicitly apply the repair.",
396
+ "notice.compat": "0.9.3 supports DSH 0.2.1-rc.2 and fixes template literals blocking chat, premature Hot Memory budget termination, and unsafe handling of unsupported or damaged stores.",
397
+ "notice.features": "After upgrading and reloading the plugin, old snapshots with template literals need no manual deletion; original memories are unchanged. Legacy invalid-receipt logs still need separate repair: audit first, stop every host and back up, then follow the recovery guide.",
398
398
  "notice.privacy": "Bundled offline; no memory changes. Acknowledge once per version, or reopen from About & help.",
399
399
  "about.host": "Supported DSH range",
400
400
  "about.baseline": "Development SDK baseline",
@@ -628,7 +628,7 @@ var import_react2 = require("react");
628
628
  var import_react = require("react");
629
629
 
630
630
  // src/client/announcement.ts
631
- var ANNOUNCEMENT_VERSION = "0.9.2";
631
+ var ANNOUNCEMENT_VERSION = "0.9.3";
632
632
  var ANNOUNCEMENT_KEY = "dsh-memoir:announcement:last-acknowledged";
633
633
  var EVENT = "dsh-memoir:announcement-acknowledged";
634
634
  var acknowledged = /* @__PURE__ */ new WeakMap();