@stardustlc/dsh-dream 0.6.0 → 0.7.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 CHANGED
@@ -1,6 +1,24 @@
1
- # Changelog
1
+ # 更新记录
2
2
 
3
- ## 0.6.0(2026-09-30)
3
+ [返回简介](README.md) · [使用说明](docs/USAGE.md) · [验证记录](docs/VALIDATION.md)
4
+
5
+ [历史英文记录](docs/CHANGELOG.en.md)
6
+
7
+ ## 0.7.1 (2026-10-03)
8
+
9
+ - 完整本地化日记、经验审阅、反馈、来源与规则变更面板;切换语言保留正文。澄清技能通过工具记录经验,修正旧的只读面板说明。
10
+ - 验收范围见 [中英文界面检查](docs/validation-language-2026-10-03.md)。
11
+
12
+ ## 0.7.0 (2026-10-02)
13
+
14
+ - 设置页可直接采纳、驳回、重新送审、标记待复核和处理冲突;页面操作记录为 human,模型工具继续记录为 model。保留 revision 校验,失败时保留填写内容。
15
+ - 展开关联来源可查看核验状态、摘要、记录时间、会话序号和来源校验值;读到来源不等同于证明结论正确。
16
+ - 项目经验可在面板查看 AGENTS.md 差异后应用,预览绑定经验版本与文件哈希,10 分钟失效。写入记录提供确认回滚,管理块外的人工内容保留。
17
+ - 新增独立使用反馈(有用 / 不适用及场景备注),不自动采纳、变更状态或提高证据数量;并发校验、重复请求幂等,明细保留最近 20 次,历史在事件流中。
18
+ - 写操作使用 DSH 0.2.0-rc.2 的认证 Connection 通道,并检查 JSON、来源和请求大小;旧宿主保留对话命令入口。修复真实宿主内部请求地址引起的正常操作拒绝。
19
+ - 窄窗口打开 Dream 时把宿主设置导航改为顶部横向导航,避免面板被压成单字列。详见 [验收范围](docs/validation/0.7.0.md)。
20
+
21
+ ## 0.6.0 (2026-09-30)
4
22
 
5
23
  - **经验来源核验**:工具读取实际会话记录或工作目录内的本地产物,核对项目、角色、记录序号、引用和哈希;伪造 read 或无法定位的来源降为 claimed,并给出原因。新经验先进入候选;读到用户纠正不再自动冒充用户采纳。
6
24
  - **完整审阅**:补充证据保持状态并检查 revision;双向冲突与 prefer/drop/merge 在同一事件中原子保存,校验失败零写入;支持已驳回经验重新送审。平台条件参与检索,Windows 任务不会取到 Linux 专用经验。
@@ -8,12 +26,13 @@
8
26
  - **面板操作**:日记 / 经验 / 写入记录分开,行动建议直接可见、证据与例外按需展开;冲突选择显示经验标题并要求处理依据。公开编号经过脱敏仍可唯一定位;回滚编号、完整命令和复制按钮能使用。保留正常 Unix 目标路径,路径中的密钥继续脱敏。修复筛选 Escape 误关宿主设置;窄窗单列显示,日记频次标为“常见教训”。
9
27
  - **验证范围**:全量回归、8 进程并发、官方前端加载器和 18 插件同载契约检查;实际 Web 宿主使用隔离的合成资料进行操作验收。详细结果与限制见 [0.6.0 验收记录](docs/validation/0.6.0.md)。零新增运行时依赖,旧日志不重写。
10
28
 
11
- ## 0.5.2(2026-09-29)
29
+ ## 0.5.2 (2026-09-29)
12
30
 
13
31
  - **修复窄窗不折叠**:经验区块的两栏布局在容器 ≤620px 时本应折叠为单列,但折叠规则排在基础规则之前、同特异性被覆盖,导致 620px 窄窗下仍挤成两列(长条件文字被压成多行)。现把该断点块移到样式表末尾。
14
32
  - 断点按**容器宽度**(≤620px)触发,不是视口宽度:因此 125% 缩放在 1024px 视口下仍是两列,150% 缩放(容器折算 617px)折叠为单列——这是预期行为,与窄窗一致。
15
33
  - 实测(离线夹具渲染,620 / 125% / 150% / 1280px 四档):单列 554px / 两列无溢出 / 单列 617px / 两列无溢出,均无横向滚动;`node --check`、官方加载器回归与全量 204 项(203 通过 + 1 默认跳过)通过。
16
- ## 0.5.1(2026-09-29)
34
+
35
+ ## 0.5.1 (2026-09-29)
17
36
 
18
37
  - **修复两个已发布缺陷**(0.5.0 起):① 日记文件开头有 UTF-8 BOM 时整份日记被读空;② 心境聚合用普通对象做映射,`__proto__` 键被吞、`constructor` 等键会把计数变成字符串(`"function Object()…1"`)。现在 BOM 会被剥离,聚合用无原型对象后返回普通副本,并新增 `skippedLines` 让坏行可诊断。
19
38
  - **检索策略修正(R1/R3/R4/R5)**:`dream_context` 默认不注入候选(`candidate-hold`)与无证据条目(`no-evidence`);`applicability.versions` 只在包名被识别时参与判定,版本不满足记 `version-mismatch`;预算改为按排名整条装入、遇第一条放不下即停(`budget-stop`,`rankInversionCount` 恒 0),条件与例外永不截断;`RetrievedLesson` 增加 `revision`(`dream_review` 的 `expectedRevision` 因此可达),`dream_learn.evidence` 改为可选。
@@ -22,7 +41,8 @@
22
41
  - **面板**:经验卡显示适用条件与例外;`truncated` 或存在坏行时显示提示行并注明 `events.jsonl` 未被改动。
23
42
  - **验收**:L1 七场景断言(S1/S5 命中、S2/S3/S4/S6/S7 零注入、`rankInversionCount=0`)**9/9**;证据纪律 5/5;旧行为基线 4/4(旧日记与既有六工具输出只增不减、只读零写入);全量 **204 项 / 203 通过 / 1 默认跳过**(并发压测需 `DSH_DREAM_STRESS=1`,8 进程 × 8 次实测不丢);`tsc`、`node --check lib/client.js`、官方加载器回归通过。
24
43
  - **已知限制(未达标,下一批修)**:读/写路径在知识库增长时仍是 O(历史)——50k 条证据时单次读操作数百毫秒、逐条追加呈二次增长。checkpoint 已能避免"截断丢实体",但尚未把读路径变成增量。本版**不承诺大知识库下的性能**;下一批计划 `evidenceKeys` 常数时间去重与索引增量更新。
25
- ## 0.5.0(2026-09-29)
44
+
45
+ ## 0.5.0 (2026-09-29)
26
46
 
27
47
  - **从「反思」升级为「有来源的经验」**:新增 `dream_learn`(提交候选经验 + 证据,校验 / 脱敏 / 去重 / 按项目或全局范围保存)、`dream_context`(任务前取回少量适用经验,只读,默认 5 条 / 3000 字符,硬上限 20 条 / 20000 字符)、`dream_review`(采纳 / 驳回 / 标记过期 / 标记冲突 / 补充证据,强制 `expectedRevision`)。六个既有工具行为不变,输出字段只增不减。
28
48
  - **新数据目录 `<journalDir>/knowledge/`**:`events.jsonl` 权威追加日志、`evidence.jsonl` 追加证据、`index.json` 可丢弃重建的派生索引;写入使用短期文件锁与幂等键。`dreams.jsonl` 永不重写,旧日记继续按原格式读取。
@@ -33,12 +53,13 @@
33
53
  - **测试**:112 → 169 项全部通过(新增知识存储 / 检索 / 三个新工具的宿主 schema 契约 / 只读知识路由零写盘与脱敏 / 面板经验区块纯函数用例);`tsc`、`node --check lib/client.js` 与官方加载器回归(冷加载 / 缓存 / invalidate 重载)均通过。真实桌面 / Web 目视验收仍待 M1 发布前完成。
34
54
  - 本版为 M1 首个发布版本。真实桌面 / Web 目视验收(经验区块配色与空态、窄窗、125%/150% 缩放、深浅色)与 18 插件同载冷启动复验**尚未完成**,完成后单独记录结论。
35
55
 
36
- ## 0.4.1(2026-09-29)
56
+ ## 0.4.1 (2026-09-29)
37
57
 
38
58
  - **修复 Desktop 启动失败**:前端 bundle 的模块注册 ID 与 scoped 包名不一致(注册成 `dsh-dream`,而包名是 `@stardustlc/dsh-dream`),宿主会重试加载并抛 `client-modules: duplicate factory registration for "dsh-dream"`,导致 `web boot: 1 entry did not activate`。现统一为完整包身份。
39
59
  - **回归测试**:`test/client-internals.test.mjs` 新增断言——注册 ID 必须等于 `package.json` 的 `name`;并用官方 `ClientModuleSystem` 验证「冷加载 / 缓存命中 / invalidate 后重载」三条路径,改回旧 ID 能稳定复现该错误。
40
60
  - 说明:0.4.0 的面板功能本身不受影响(Web 下可用),本版只是让 Desktop(`dsh-app://`)能正常激活该入口;日记数据与配置不变,无迁移。
41
- ## 0.4.0(2026-09-29)
61
+
62
+ ## 0.4.0 (2026-09-29)
42
63
 
43
64
  - **新增:只读梦境日记可视化面板**。Web profile 设置页新增「梦境日记」一节:梦境总数、心境方块序列、教训榜(按出现次数排序、同次数按最近出现时间排序,行尾 ×N 与最近一次出现时间,≥3 次标「桥接候选」并注明由 dream_bridge 决定是否写入 AGENTS.md)与卡片式时间线(时间 / 心境 / 反思 / 教训),支持关键词搜索。反思正文默认展开,超 4 行或 220 字折叠为 4 行可展开;顶部「隐私模式」可一键模糊正文与教训(仅浏览器显示层,不改变文件)。空日记与单条日记有专门呈现,不画失真图表、不显示假精度 KPI。
44
65
  - 面板数据来自新增的只读同源路由 GET /_dsh/dsh-dream/journal:仅回环地址可达,非 GET 返回 405、非本机 Host 返回 403;?limit=(1–500,默认 50)与 ?q=(走 searchDreams)可选;响应契约仍为 { dreams, stats, query, limit },其中 stats.topLessons 新增 lastAt(最近一次出现时间,纯增量),不含桥接字段。面板不提供任何写操作,记梦/翻梦/忆梦仍走 dream_save / dream_journal / dream_recall。
@@ -48,50 +69,55 @@
48
69
  - 面板另含:≥8 场时的「筛选 ▾」(按心境 / 只看有教训,作用于已加载窗口)与满 50 场后的「显示更早的梦」(一次拉满 500 场上限)。
49
70
  - 测试:64 → 109 项(19 个测试文件)全过;新增网页只读路由、lastAt 统计、全量检索回归与面板纯逻辑 vm 测试。
50
71
  - **后续计划**:用 sidecar 记录桥接状态(哪些教训、何时写进哪个 AGENTS.md)。v1 不读取 AGENTS.md、不新增状态文件。
51
- ## 0.3.5(2026-09-28)
72
+
73
+ ## 0.3.5 (2026-09-28)
52
74
 
53
75
  - 兼容验证更新到 Harness 0.2.0-rc.1:64 项测试与 18 插件共同加载检查通过(`dream_digest` 按 v4 会话格式读取,继续过滤推理块)。
54
76
  - 运行时代码未变;同步中英文兼容性声明。
55
77
 
56
- ## 0.3.4(2026-09-28)
78
+ ## 0.3.4 (2026-09-28)
57
79
 
58
80
  - 修复 [#2](https://github.com/STARDUSTLC666/dsh-dream/issues/2):`dream_digest` 摘要现在实际输出用户原话、助手回应与工具足迹(此前只列出标题/轮数/目录);
59
81
  - 支持官方 Harness 0.1.7-rc.2 的 v4 会话文件:按消息 `source.kind` 只保留真人输入,过滤推理块与自动注入的上下文,避免当成用户原话;
60
82
  - 跳过真正空会话;标题、工作目录、预设与工具名一并脱敏(此前只脱敏消息正文);
61
83
  - 测试扩至 64 项全过(新增 v4 明文/zstd 与摘要渲染回归)。
62
84
 
63
- ## 0.3.3(2026-09-11)
85
+ ## 0.3.3 (2026-09-12)
64
86
 
65
87
  - 适配并验证官方 Harness 0.1.5-rc.1:整套同载、工具/技能契约与 Web 鉴权检查通过。
66
88
  - Node 要求与宿主统一为 `^22.19.0 || >=24.0.0`;更新中英文兼容性说明。
67
89
  - 修复 v3 会话被跳过的问题,兼容 v2/v3 PTC 子调用工具足迹,避免重复计数与提取私密正文;新增 6 项回归测试,60 项测试通过。
68
90
 
69
- ## 0.3.2(2026-09-05)
91
+ ## 0.3.2 (2026-09-02)
70
92
 
71
93
  - 适配 Harness 0.1.3 的 `session.v2.jsonl` / `.zstd` 代际文件;迁移保留旧文件时每个会话只读取最新规范文件。
72
94
  - 解析 v2 的内嵌 `assistant/message` / `assistant/attempt` 流,继续兼容 v0 打包行与 v1 片段。
73
95
  - 默认会话与日记目录遵循 `DSH_HOME`;显式配置仍优先。
74
96
 
75
- ## 0.3.1(2026-08-31)
97
+ ## 0.3.1 (2026-08-31)
76
98
 
77
99
  - 支持 0.1.2 ContentBlock 数组载荷的文本提取;
78
100
  - npm 包名改为 `@stardustlc/dsh-dream`(`dsh-dream` 已被他人占用)。
79
101
 
80
- ## 0.3.0(2026-08-26)
102
+ ## 0.3.0 (2026-08-26)
81
103
 
82
104
  - `dream_bridge` 渡梦:把高频教训幂等合并进 `AGENTS.md` 标记块,梦变成长期记忆;
83
105
  - `dream_journal` 增加心境分布与最常梦到教训的统计;
84
106
  - 48 个测试全过。
85
107
 
86
- ## 0.2.0(2026-08-26)
108
+ ## 0.2.0 (2026-08-26)
87
109
 
88
110
  - 官方打包行(text-chunks 协议)流式文本还原;
89
111
  - 梦原料默认隐私脱敏(密钥/令牌/JWT/高熵串 → `[已脱敏·类型]`);
90
112
  - 入梦 `brief` 模式(`mode: 'brief'`);
91
113
  - 40 个测试全过。
92
114
 
93
- ## 0.1.0(2026-08-26)
115
+ ## 0.1.0 (2026-08-26)
94
116
 
95
117
  - 首版:会话回放(`dream_digest`)、梦境日记(`dream_save`/`dream_journal`/`dream_recall`)与做梦协议技能;
96
118
  - 官方多帧 zstd 会话日志零依赖解析;
97
119
  - 28 个测试全过。
120
+
121
+ ## 更早的改动
122
+
123
+ 完整历史可查阅 [GitHub 提交记录](https://github.com/STARDUSTLC666/dsh-dream/commits/master)。
package/README.en.md CHANGED
@@ -1,128 +1,46 @@
1
- [简体中文](README.md)
2
-
3
- ![npm](https://img.shields.io/npm/v/@stardustlc/dsh-dream) ![downloads](https://img.shields.io/npm/dm/@stardustlc/dsh-dream) ![license](https://img.shields.io/github/license/STARDUSTLC666/dsh-dream) ![stars](https://img.shields.io/github/stars/STARDUSTLC666/dsh-dream?style=social)
4
-
5
1
  # dsh-dream
6
2
 
7
- ## 0.6.0 update (2026-09-30)
8
-
9
- - **Source verification and review**: reads actual session records or bounded project artifacts. Unverifiable claims stay claimed with a reason. New lessons start as candidates, including user corrections.
10
- - **Recoverable bridging**: preview / apply / rollback with durable recovery records written before the target. Handles missing-file null hashes, linked paths, CRLF rollback and concurrent edits.
11
- - **Complete review**: verified evidence attachment, atomic conflict resolution (prefer/drop/merge), reopening rejected lessons, and stable public references.
12
- - **Usable panel**: separate Journal / Lessons / Write log views, prominent action text, a conflict form with named lessons and a required reason, and copyable rollback commands.
13
- - See [0.6.0 validation](docs/validation/0.6.0.md) and [CHANGELOG](CHANGELOG.md).
14
-
15
- ## 0.4.1 update (2026-09-29)
16
-
17
- - **Fixes a Desktop boot failure**: the front-end module id now matches the scoped package name (it used to register as `dsh-dream`, so the host retried the bundle and threw `duplicate factory registration`, ending in `1 entry did not activate`). No journal or config migration.
18
-
19
- ## 0.5.1 update (2026-09-29)
20
-
21
- - **Fixes**: a leading UTF-8 BOM used to hide the whole journal; mood keys such as `__proto__`/`constructor` corrupted counts. **Retrieval discipline**: candidates and evidence-free lessons are not injected by default, version checks need package context, and the budget packs by rank. **Historical evidence policy**: read evidence used to promote lessons directly; 0.6.0 replaces this with independent source verification and review.
22
- - 204 tests (203 passing, 1 opt-in concurrency stress test skipped); L1 acceptance 9/9. Known limit: reads/writes still grow with history on very large libraries.
3
+ [中文](README.md)
23
4
 
24
- ## 0.5.0 update (2026-09-29)
5
+ Review past sessions, keep reflections and reuse verified, reviewed lessons.
25
6
 
26
- - **Three new tools**: `dream_learn` (submit an evidence-backed candidate lesson), `dream_context` (retrieve a few applicable lessons before a task; read-only; 5 items / 3000 characters by default) and `dream_review` (accept / reject / mark stale or disputed / attach evidence; every mutation requires a revision).
27
- - **New data directory `<journalDir>/knowledge/`**: `events.jsonl` is the authoritative append-only log, `evidence.jsonl` appends evidence, and `index.json` is a disposable derived index. The old `dreams.jsonl` stays read-compatible and is never rewritten.
28
- - **Masking and scope guarantees**: every new write path runs through `mask.ts` when `maskSecrets` is on; evidence stores only masked one-line summaries plus locators — never hidden reasoning, system prompts, tool arguments or result bodies. Lessons are scoped to a project or global; with an unknown project `dream_context` returns global lessons only and never scans across projects.
29
- - **Compatibility**: the old journal and the six existing tools (dream_digest / dream_save / dream_journal / dream_recall / dream_bridge / dream_health) keep their behaviour and output fields only grow. No migration is required and no old data is rewritten.
30
- - **New read-only "Lessons" block** in the panel: state (candidate / usable / disputed / stale / rejected), applicability, scope, applicability details (package / versions / platform) and exceptions (only when non-empty), evidence summary and last-validated time. Candidates and disputed lessons are visually distinct, and an empty knowledge store has its own empty state. When the event log is truncated or has bad lines the block shows a notice and says events.jsonl was left untouched. The panel still has no write actions.
31
- - **Two more read-only blocks (M2)**: "To review" (candidate / disputed / stale lessons plus why each is held back, using the retrieval layer's Chinese skipped-reason labels) and "Write log" (bridge application records from <journalDir>/bridge/: target, time, lessonId@revision, before/after hashes, rollbackable and why). Every lesson gets a "copy review command"; bridgeable (usable) lessons get a "copy preview command"; if the clipboard fails it falls back to selectable text. The panel still has no write methods.
7
+ [![npm](https://img.shields.io/npm/v/@stardustlc/dsh-dream)](https://www.npmjs.com/package/@stardustlc/dsh-dream) [![downloads](https://img.shields.io/npm/dm/@stardustlc/dsh-dream)](https://www.npmjs.com/package/@stardustlc/dsh-dream)
32
8
 
33
- ## 0.4.0 update (2026-09-29)
9
+ ## What it does
34
10
 
35
- Adds a read-only dream-journal panel: open **Settings →「梦境日记」(Dream journal)** to see totals, mood distribution, the lessons board and a card timeline, with keyword search. Long reflections fold automatically and a one-click privacy blur is available. The panel is read-only and the storage format is unchanged — no migration needed.
11
+ - Browse journals, retrieve lessons and inspect their sources.
12
+ - Review lessons, resolve conflicts and record separate usage feedback.
13
+ - Preview AGENTS.md changes before applying them, with rollback support.
36
14
 
37
- > **An agent that dreams**: session replay (dream material) → reflection (interpretation) → dream journal (memory consolidation).
15
+ ## Install
38
16
 
39
- Humans consolidate memories by replaying the day during sleep — dsh-dream gives DeepSeek Harness agents the same ability. It reads your historical sessions (the official multi-frame zstd session logs, parsed with zero dependencies), distills dream material, lets the agent reflect, and writes permanent dream journal entries that can be recalled later.
40
-
41
- ## Compatibility
42
-
43
- Validation host: Harness 0.2.0-rc.1 built from official sources (commit 407e65c8, with local host fixes), Node 24.16.0. Version 0.6.0 is exercised in a real Web host with an isolated profile. Web validation does not certify the native Desktop installer; see the validation record for exact scope. The full scoped client identity remains compatible with the Desktop module loader. Registers 9 tools and dream-protocol with zero runtime dependencies.
44
-
45
- Reads v0/v1/v2/v3/v4 plaintext JSONL and multi-frame zstd, legacy packed chunks and embedded streams. Only the newest canonical file is selected per session. PTC child calls retain tool names without double counting; system prompts, reasoning, tool arguments and result bodies are excluded.
46
-
47
- Default data directories follow `DSH_HOME`: `sessions` for session logs and `.dsh-dream` for the journal. Without `DSH_HOME`, the base is `~/.dsh`. Explicit `sessionsRoot` and `journalDir` settings take precedence.
48
-
49
- ## Install / Uninstall
17
+ In DSH Desktop, install `@stardustlc/dsh-dream` from the Plugins panel. If the bundled dsh command is available:
50
18
 
51
19
  ```bash
52
- dsh plugin --profile web add @stardustlc/dsh-dream
53
- # or from source:
54
- dsh plugin --profile web add github:STARDUSTLC666/dsh-dream
55
- dsh plugin --profile web remove @stardustlc/dsh-dream
20
+ dsh plugin --profile desktop add @stardustlc/dsh-dream
56
21
  ```
57
22
 
58
- Restart the web service afterwards. The dream journal lives at `~/.dsh/.dsh-dream/dreams.jsonl` and survives uninstallation; remove that directory manually for a full cleanup. Part of [dsh-suite](https://github.com/STARDUSTLC666/dsh-suite) — one command installs all 18 STARDUSTLC plugins.
59
-
60
- ## Dream journal panel (0.4.0+)
23
+ For the web version, replace `desktop` with `web`. Restart DSH after installation.
61
24
 
62
- Once installed, DSH's **Settings →「梦境日记」(Dream journal)** grows a read-only panel (Web profile only; headless hosts keep the tools and the skill without a settings page).
25
+ ## Start using it
63
26
 
64
- - **What it shows**: totals, a mood-square strip (never empty for a single dream, wraps when there are many) and the lessons board at the top; below that, a card timeline, newest first, with timestamp, mood, reflection body and lessons. Reflections are expanded by default and collapse to 4 lines with a show-more control beyond 4 lines or 220 characters.
65
- - **Lessons board**: ranked by journal occurrences and recency; 3 or more occurrences are labelled common lessons. Frequency does not establish correctness, importance or bridge eligibility. Technical lessons need their own sources, review and a write preview.
66
- - **Search**: filters by keyword across reflections and lessons, case-insensitively. Mood distribution and the lessons board are computed over the full journal; the timeline is paged by search and limit (latest 50 by default).
67
- - **Filtering and older dreams**: from 8 dreams on, a Filter menu appears (by mood, or only dreams with lessons; it applies to the loaded window and says so). When 50 dreams are loaded and more exist, the footer offers "show older dreams", which fetches up to the 500-dream route cap in one go.
68
- - **Read-only**: the panel only reads from the plugin's own GET /_dsh/dsh-dream/journal (loopback-only; non-GET → 405, non-local Host → 403). There is no write action; saving, listing and recalling dreams still happen in chat via dream_save / dream_journal / dream_recall, and the panel never modifies the journal file.
69
- - **Data file**: the panel renders the journal itself — ~/.dsh/.dsh-dream/dreams.jsonl by default ($DSH_HOME/.dsh-dream/dreams.jsonl; an explicit journalDir wins). The storage format is unchanged: one JSON object per line, safe to remove or read with dream_journal.
70
- - **Privacy**: read-only routes mask text again while preserving validated lesson, evidence and backup references for commands. The UI reads local same-origin routes and does not upload to third-party services. Privacy blur is a display effect; DOM text and local logs remain plaintext.
71
- - **Before the first dream**: the panel shows an empty state pointing you to ask the agent to「做个梦」; a single dream renders as one card, with neither the mood strip nor the lessons board left empty and no misleading charts.
72
- - **Lessons view**: usable lessons and the review queue appear separately; rejected history is optional. Cards show when/action directly, with expandable scope, versions, exceptions and evidence. Review forms generate complete commands to paste into DSH chat; refresh afterwards. The panel itself never writes files.
73
- - **Write log and rollback (M2)**: `dream_bridge apply` appends an application record to `<journalDir>/bridge/records.jsonl` (target, time, lessonId@revision, before/after hashes, original managed block); the panel's "Write log" shows it read-only, and only reports "rollbackable" while the current managed block still matches that apply.
27
+ Ask to review recent tasks and keep useful lessons. Open Settings → Dream Journal to inspect sources and review lessons; preview rule changes before applying them.
74
28
 
75
- ## Tools
29
+ The assistant records lessons through tools; manual data entry is unnecessary. The skill guides retrieval at task start and candidate submission at wrap-up, rather than continuous background learning. New lessons await review; project rules require a separate preview and apply action. UI language follows DSH; journal and lesson content stays original.
76
30
 
77
- | Tool | Purpose | Key params |
78
- | :-- | :-- | :-- |
79
- | `dream_digest` | Replay recent sessions (title/turns/user quotes/assistant conclusions/tool footprint); subagent sessions skipped; official packed-chunk rows decoded | `maxSessions`; `mode`: full/brief |
80
- | `dream_save` | Write a reflection + 1-5 lessons + mood to the permanent journal | `reflection` required |
81
- | `dream_journal` | List dreams, newest first | `limit` |
82
- | `dream_recall` | Keyword search across the journal | `query` required |
83
- | `dream_bridge` | Bridge accepted, scope-matched lessons into AGENTS.md (`preview` / `apply` / `rollback`; omitting `mode` keeps the legacy direct write with a deprecation notice) | `mode` optional; `path` / `lessonIds` / `maxLessons` / `expectedSha256` / `previewId` / `projectId` |
84
- | `dream_health` | Self-check: sessions dir / dream count / config summary | — |
85
- | `dream_learn` | Submit a candidate technical lesson with evidence (validate / mask / dedupe / scope; evidence-free input stays a candidate) | `kind`, `title`, `action`, `when` required; `evidence` optional (defaults to `[]`) |
86
- | `dream_context` | Retrieve a few applicable lessons before a task (read-only; candidates are held out by default) | `query` required; `projectId` / `workspaceRoot` / `limit` / `maxChars` / `packageName` / `packageVersion` / `platform` / `includeCandidates` optional |
87
- | `dream_review` | Review and transition state: accept / reject / mark stale / mark disputed / resolve conflicts / attach evidence / reopen | `action`, `lessonId`, `expectedRevision` required |
31
+ ## Requirements and configuration
88
32
 
89
- Conflict review requires resolution (prefer / drop / merge), affectedIds and note. All parties are validated and updated in one event; invalid groups write nothing. attach-evidence verifies sources without promoting the lesson, and reopen returns a rejected lesson to candidate.
33
+ Uses local DSH sessions and journals with secret masking. Interactive actions use the DSH 0.2.0-rc.2 authenticated channel; tools and skills also work in headless mode.
90
34
 
91
- `dream_bridge` now has three explicit modes:
35
+ Detailed configuration, tool arguments and troubleshooting are in the [usage guide](docs/USAGE.en.md). For standalone development, follow the Node requirement in [package.json](package.json).
92
36
 
93
- - `preview` (read-only): returns the real diff, selected lessons and skipped reasons — zero writes;
94
- - `apply`: requires the preview’s `expectedSha256` (null for a missing file); also pass `previewId` to bind the preview; a concurrent edit returns `conflict` with zero writes. It only replaces the Dream managed block (`<!-- dsh-dream:start/end -->`), preserving text outside the block, BOM and line endings, first fsyncs a pending recovery record, then atomically replaces the target and records applied;
95
- - `rollback`: locates the record by backupId and rolls back only while the current managed block still equals that apply result, preserving later manual additions outside it.
37
+ ## Documentation
96
38
 
97
- Omitting `mode` keeps the 0.5.x direct write and returns a deprecation notice; new flows should use `preview → apply`. Only `usable`, scope-matched (or explicit global with review.decision accepted) lessons can be bridged — frequency is no longer an admission criterion — and everything written is masked via `mask.ts`. The panel's "Write log" shows these records and whether they are rollbackable.
98
-
99
- The bundled `dream-protocol` skill teaches the agent when and how to dream (and the journaling discipline: patterns only, never secrets).
100
-
101
- ## Lesson memory (M1)
102
-
103
- The dream journal holds subjective reflections; technical lessons that should be reused go to `<journalDir>/knowledge/`:
104
-
105
- - **Candidate → verified source → review**: dream_learn creates candidates. Session evidence needs sessionId, recordSeq and a matching quote (summary is used if omitted); the plugin checks project, role, record and text, then computes sourceHash. User corrections must come from actual user messages. Local artifacts require artifactPath with a real path inside the execution working directory. Failed verification becomes claimed with verificationReason and contributes no independent support. Reading a source is not user acceptance; tool reviews record actor:model. attach-evidence preserves state, and every review checks expectedRevision.
106
- - **Budgeted retrieval**: `dream_context` returns at most 5 items / 3000 characters by default (hard caps 20 items / 20000 characters). Items are packed whole by rank and packing stops at the first item that does not fit (`skipped: budget-stop`); `title / when / action / exceptions` are never truncated, and no half item is ever returned. Candidates and evidence-free non-usable items are held out of task advice by default (`includeCandidates: false`, reported as `candidate-hold` / `no-evidence`); pass `includeCandidates: true` only when explicitly reviewing candidates, and note that candidates rank after usable lessons and must not be treated as verified. Rejected, stale and unresolved disputed lessons are not injected. An explicit platform wins, otherwise unambiguous task text or the host platform is used; mismatches report platform-mismatch; `applicability.versions` only counts when the package is identified (explicit `packageName` or a package name in the query).
107
- - **Frequency is not reliability**: resubmitting the same evidence is idempotent; never grind counts by calling `dream_save` / `dream_learn` repeatedly. Repeated occurrences within one session count as a single independent source.
108
- - **Recoverable storage**: `events.jsonl` is the authoritative append-only event log, `evidence.jsonl` appends evidence and `index.json` is a disposable derived index. Rebuilding the index deletes no source files. When the directory does not exist, the read route returns an empty result and never creates anything.
109
- - **Removing it**: delete `<journalDir>/knowledge/` to clear lesson memory. The old `dreams.jsonl` journal is unaffected, and older plugin versions can still read it.
110
-
111
- ## Privacy (on by default)
112
-
113
- Dream material is masked before journaling: sk keys, GitHub/Groq/Slack tokens, AWS keys, JWTs, `password/token/api_key` assignments and long high-entropy strings become `[masked·type]`. In M1 the lesson / evidence / error / bridge write paths also run through `mask.ts` when `maskSecrets` is on, and text returned by the read-only panel route is masked again. Disable with `maskSecrets: false`.
114
-
115
- ## Permissions & data
116
-
117
- Read-only access to the sessions directory; appends JSONL to the journal directory plus lessons/evidence under `journalDir/knowledge/`; no network calls. Session content may be sensitive — the protocol forbids secrets in dreams, but the journal is plaintext: review before sharing.
118
-
119
- ## Development
120
-
121
- ```bash
122
- pnpm install
123
- pnpm test # build + offline tests (session generations, zstd, streams, masking, journal, bridge, registration)
124
- ```
39
+ - [Usage and troubleshooting](docs/USAGE.en.md)
40
+ - [Changelog](CHANGELOG.md)
41
+ - [Validation scope and history](docs/VALIDATION.md)
42
+ - [Report a problem or suggest a feature](https://github.com/STARDUSTLC666/dsh-dream/issues)
125
43
 
126
44
  ## License
127
45
 
128
- MIT (see [LICENSE](LICENSE))
46
+ [MIT](LICENSE)
package/README.md CHANGED
@@ -1,176 +1,46 @@
1
- [English](README.en.md)
2
-
3
1
  # dsh-dream
4
2
 
5
- ## 0.6.0 更新(2026-09-30)
6
-
7
- - **来源核验与独立审阅**:插件实际读取会话记录或项目内产物核对来源;无法核对时降为 claimed 并说明原因。新经验先进入候选,用户纠正原文也需要单独审阅。
8
- - **可靠写入**:AGENTS.md 支持预览、应用、回滚;先持久化恢复记录再写目标文件,中断后仍能恢复。修复新文件 null 哈希、路径链接、CRLF 回滚和并发修改保护。
9
- - **完整审阅**:补充证据、双向冲突、prefer/drop/merge 原子处理、驳回后重新送审;公开编号在面板与命令间保持一致,敏感正文仍脱敏。
10
- - **更易操作**:日记 / 经验 / 写入记录分开;卡片直接显示“怎么做”,冲突表单要求选择经验和处理依据,写入记录可复制回滚命令;支持窄窗与筛选 Escape。
11
- - 验证记录见 [0.6.0 验收](docs/validation/0.6.0.md),历史变更见 [CHANGELOG](CHANGELOG.md)。
12
-
13
- ## 0.4.1 更新(2026-09-29)
14
-
15
- - **修复 Desktop 启动失败**:前端模块注册 ID 现与 scoped 包名一致(此前注册成 `dsh-dream`,宿主会重试加载并抛 `duplicate factory registration`,导致 `1 entry did not activate`)。日记数据与配置不变,无迁移。
16
-
17
- ## 0.5.1 更新(2026-09-29)
18
-
19
- - **修复**:日记 BOM 导致读空、心境键(`__proto__`/`constructor`)污染计数;**检索纪律**:候选与无证据经验默认不注入、版本判定需要包名上下文、预算按排名整条装入;**历史证据策略**:当时 read 可直接成为 usable;0.6.0 已改为实际核验来源并独立审阅。
20
- - 全量 **204 项 / 203 通过 / 1 默认跳过**;L1 七场景断言 9/9。已知限制:知识库很大时读/写仍随历史线性增长,本版不承诺大库性能。
21
-
22
- ## 0.5.0 更新(2026-09-29)
23
-
24
- - **新增三个工具**:`dream_learn`(提交带证据的候选经验)、`dream_context`(任务前按项目 / 版本取回少量适用经验,只读,默认最多 5 条、3000 字符)、`dream_review`(采纳 / 驳回 / 标记过期或冲突 / 补充证据,强制携带 revision)。
25
- - **新数据目录 `<journalDir>/knowledge/`**:`events.jsonl` 是权威追加日志,`evidence.jsonl` 追加证据,`index.json` 是可丢弃重建的派生索引。旧日记 `dreams.jsonl` 仍只读兼容、永不重写。
26
- - **脱敏与范围承诺**:所有新写盘路径在 `maskSecrets` 开启时先过 `mask.ts`;证据只保存已脱敏摘要和定位信息,不保存隐藏推理、系统提示、工具参数 / 结果正文。经验按项目或全局范围保存,未知当前项目时 `dream_context` 只返回全局经验,绝不跨项目扫描。
27
- - **兼容性**:旧日记与六个既有工具(dream_digest / dream_save / dream_journal / dream_recall / dream_bridge / dream_health)行为不变、输出字段只增不减;升级不需要迁移,也不会改写旧数据。
28
- - **只读面板新增「经验」区块**:展示状态(候选 / 可用 / 有冲突 / 待复核 / 已驳回)、适用条件、范围、适用(package / versions / platform)与例外、证据摘要与最近核验时间;候选与有冲突有明确视觉区分,没有经验时是独立空态;知识日志被截断或有坏行时显示「events.jsonl 未改动」提示。面板仍然没有任何写操作。
29
- - **面板新增两个只读区块(M2)**:「待核实」(candidate / disputed / stale + 被扣下的原因,来自检索层 skipped reason 的中文映射)与「写入记录」(<journalDir>/bridge/ 的应用记录:目标、时间、lessonId@revision、前后哈希、可否回滚及原因);每条经验给「复制审阅命令」,可桥接(usable)经验给「复制预览命令」,剪贴板不可用时回退为可选中文本。面板仍无写方法。
30
-
31
- ## 0.4.0 更新(2026-09-29)
32
-
33
- 新增只读梦境日记可视化面板:打开「设置 → 梦境日记」即可查看梦境总数、心境分布、教训榜与卡片式时间线,并可按关键词搜索;正文超长自动折叠,可一键开启隐私模糊。面板只读,存储格式不变、无需迁移。
34
-
35
- > **会做梦的 agent**:会话回放(梦原料)→ 反思(解梦)→ 梦境日记(记忆巩固)。
36
-
37
- ![npm](https://img.shields.io/npm/v/@stardustlc/dsh-dream) ![downloads](https://img.shields.io/npm/dm/@stardustlc/dsh-dream) ![license](https://img.shields.io/github/license/STARDUSTLC666/dsh-dream) ![stars](https://img.shields.io/github/stars/STARDUSTLC666/dsh-dream?style=social)
38
-
39
- 人睡觉时大脑回放白天的经历、巩固记忆——dsh-dream 让 DeepSeek Harness 的 agent 也拥有这个能力:读取你的历史会话(官方多帧 zstd 会话日志,零依赖解析),提炼梦原料,反思后写入永久梦境日记,下次醒来可以忆梦。
3
+ [English](README.en.md)
40
4
 
41
- ## 兼容性
5
+ 回顾会话、保存反思,并把经过核验和审阅的经验用于后续任务。
42
6
 
43
- 验证宿主:官方源码构建的 Harness 0.2.0-rc.1(commit 407e65c8,含本地宿主修补)+ Node 24.16.0。0.6.0 在隔离 profile 的实际 Web 宿主中验收;Web 验收不等同于原生 Desktop 安装器验收,具体范围见验收记录。保持完整 scoped 前端模块身份,兼容 Desktop 的模块加载契约。本插件注册 9 个工具与 dream-protocol 技能;零运行时依赖。
7
+ [![npm](https://img.shields.io/npm/v/@stardustlc/dsh-dream)](https://www.npmjs.com/package/@stardustlc/dsh-dream) [![downloads](https://img.shields.io/npm/dm/@stardustlc/dsh-dream)](https://www.npmjs.com/package/@stardustlc/dsh-dream)
44
8
 
45
- 支持 v0/v1/v2/v3/v4 的普通 JSONL 与多帧 zstd、旧 packed-chunk 行及内嵌 stream;升级留下多代文件时只读取每个会话的最新规范文件。PTC 子工具调用保留工具名且不重复计数,不提取系统提示、推理、工具参数或结果正文。
9
+ ## 功能
46
10
 
47
- 默认从 `DSH_HOME/sessions` 读取会话、在 `DSH_HOME/.dsh-dream` 保存日记;未设置 `DSH_HOME` 时使用 `~/.dsh`。配置中的 `sessionsRoot`、`journalDir` 始终优先。
11
+ - 浏览梦境日记、检索经验并查看关联来源。
12
+ - 直接审阅、处理冲突,记录独立的使用反馈。
13
+ - 预览规则差异后写入 AGENTS.md,并支持回滚。
48
14
 
49
15
  ## 安装
50
16
 
51
- ```bash
52
- dsh plugin --profile web add @stardustlc/dsh-dream
53
- # 或从源码:
54
- dsh plugin --profile web add github:STARDUSTLC666/dsh-dream
55
- ```
56
-
57
- 安装后重启 Web 服务即可。本插件收录于 [dsh-suite](https://github.com/STARDUSTLC666/dsh-suite) 全家桶——一条命令可装入 STARDUSTLC 全部 18 个插件。
58
-
59
- ## 卸载
17
+ 桌面版可在「插件」面板按包名 `@stardustlc/dsh-dream` 安装。已配置 dsh 命令时也可使用:
60
18
 
61
19
  ```bash
62
- dsh plugin --profile web remove @stardustlc/dsh-dream
63
- ```
64
-
65
- 卸载后重启 Web 服务。梦境日记默认保存在 `~/.dsh/.dsh-dream/dreams.jsonl`,卸载不会删除;如需彻底清理请手动删除该目录。
66
-
67
- ## 梦境日记面板(0.4.0+)
68
-
69
- 装好后,DSH 的「设置 → 梦境日记」里会多出一节**只读**面板(Web profile 专用;headless 宿主没有设置页,工具与技能照常可用)。
70
-
71
- - **看什么**:顶部是梦境总数、心境方块序列(单条时不空,多条时自动换行)与教训榜;下面是卡片式时间线,按时间倒序,逐条显示时间、心境、反思正文与教训列表。反思正文默认展开,超过 4 行或 220 字时折叠为 4 行并给出「展开全文」。
72
- - **教训榜**:按日记出现次数与最近时间排序,≥3 次标为“常见教训”;频率不代表正确性、重要度或桥接资格。技术经验必须另行提交来源、审阅,再预览写入规则。
73
- - **搜索**:按关键词过滤,命中反思与教训,不区分大小写。心境分布与教训榜基于**全量日记**,时间线按搜索与条数上限(默认最近 50 场)展示。
74
- - **筛选与更早的梦**:≥8 场时出现「筛选 ▾」(按心境、只看有教训的梦,作用于已加载窗口并在弹层注明);加载满 50 场且总梦数更多时,页脚提供「显示更早的梦」,点击后一次拉满到 500 场(路由上限)。
75
- - **只读**:面板只从插件自己的 GET /_dsh/dsh-dream/journal 读取数据(仅回环地址可达;非 GET → 405,非本机 Host → 403),没有任何写操作。记梦、翻梦、忆梦仍在对话里通过 dream_save / dream_journal / dream_recall 完成,面板不会修改你的日记文件。
76
- - **数据文件**:面板读的就是梦境日记本身,默认 ~/.dsh/.dsh-dream/dreams.jsonl($DSH_HOME/.dsh-dream/dreams.jsonl;配置了 journalDir 时以配置为准)。存储格式不变,仍是每行一条 JSON 的 JSONL,可直接删除或用 dream_journal 读取。
77
- - **隐私**:只读路由会再次脱敏正文;已校验的内部经验、证据与备份编号保留以供操作。界面只访问本机同源路由,不上传第三方服务。“隐私模式”仅模糊显示,DOM 仍有文本;日志本身是明文。
78
- - **还没有梦时**:面板显示空态,提示对 agent 说「做个梦」——它会回放最近的会话、反思之后把第一条梦写进这里;只有一场梦时按单条卡片展示,心境方块与教训榜都不留空、不画失真图表。
79
- - **经验视图**:可用经验与待核实队列分开,已驳回历史按需查看;直接显示“何时用 / 怎么做”,适用范围、版本、例外与证据可以展开。审阅表单生成完整命令,复制后粘贴到 DSH 对话执行,再刷新查看结果;不会直接写文件。
80
- - **写入记录与回滚(M2)**:`dream_bridge apply` 在 `<journalDir>/bridge/records.jsonl` 追加应用记录(目标、时间、lessonId@revision、前后哈希、原管理块),面板「写入记录」只读展示;当前管理块仍匹配该次 apply 时才显示「可回滚」。
81
-
82
- ## 工具一览
83
-
84
- | 工具 | 作用 | 关键参数 |
85
- | :-- | :-- | :-- |
86
- | `dream_digest` | 入梦:回放最近会话(标题/轮数/用户原话/助手结论/工具足迹),自动跳过子代理,还原官方打包行流式文本 | `maxSessions` 可选;`mode`: full/brief |
87
- | `dream_save` | 记梦:反思 + 1-5 条教训 + 心境,永久保存 | `reflection` 必填;`lessons`/`mood` 可选 |
88
- | `dream_journal` | 翻梦:倒序列出历史梦境 | `limit` 可选 |
89
- | `dream_recall` | 忆梦:关键词检索梦境 | `query` 必填 |
90
- | `dream_bridge` | 渡梦:把已采纳、范围匹配的经验写入 AGENTS.md(`preview` 预览 / `apply` 应用 / `rollback` 回滚;缺省保留旧直写并给弃用提示) | `mode` 可选;`path` / `lessonIds` / `maxLessons` / `expectedSha256` / `previewId` / `projectId` |
91
- | `dream_health` | 自检:会话目录/梦境计数/配置汇总 | 无 |
92
- | `dream_learn` | 提交候选技术经验及证据(校验 / 脱敏 / 去重 / 按范围保存;无证据只能留在候选) | `kind`、`title`、`action`、`when` 必填;`evidence` 可选(缺省 `[]`) |
93
- | `dream_context` | 任务前取回少量适用经验(只读;候选默认不注入) | `query` 必填;`projectId` / `workspaceRoot` / `limit` / `maxChars` / `packageName` / `packageVersion` / `platform` / `includeCandidates` 可选 |
94
- | `dream_review` | 审阅与状态流转:采纳 / 驳回 / 标记过期 / 标记冲突 / 处理冲突 / 补充证据 / 重新送审 | `action`、`lessonId`、`expectedRevision` 必填 |
95
-
96
- 处理冲突时必须填写 resolution(prefer / drop / merge)、affectedIds 与 note;所有当事方一并校验并在同一事件中保存,校验失败不改任何经验。attach-evidence 核验并附加来源,reopen 把驳回经验重新置为候选。
97
-
98
- ### 示例
99
-
100
- ```text
101
- dream_digest { maxSessions: 5, mode: 'brief' }
102
- dream_save { reflection: "用户反复遇到输入法问题,偏好先自查再重启", lessons: ["先问是否重启过应用"], mood: "平静" }
103
- dream_recall { query: "输入法" }
104
- dream_bridge { mode: "preview", path: "AGENTS.md", maxLessons: 10 }
105
- dream_context { query: "SMTP 取消投递", projectId: "mailer", packageName: "nodemailer", packageVersion: "9.0.5", platform: "windows" }
106
- dream_learn { kind: "pitfall", title: "池化发送中 close() 不保证终止投递", action: "取消后验证当前连接确实关闭", when: "使用 Nodemailer 9.0.5 池化发送并处理 AbortSignal 时", evidence: [{ kind: "local-artifact", artifactPath: "test-results/smtp.txt", summary: "本机 SMTP 复现:取消后服务器仍收到正文", verification: "read" }] }
107
- dream_review { action: "accept", lessonId: "lesson-…", expectedRevision: 1 }
20
+ dsh plugin --profile desktop add @stardustlc/dsh-dream
108
21
  ```
109
22
 
110
- ## 渡梦:让梦变成长期记忆(M2)
111
-
112
- `dream_bridge` 现在有显式三模式:
113
-
114
- - `preview`(只读):返回真实 diff、参与经验与 skipped 原因,零写入;
115
- - `apply`:必须带预览的 `expectedSha256`(新文件为 null),建议同时带 `previewId`,文件被并发修改时返回 `conflict` 且零写入;只替换 Dream 管理块(`<!-- dsh-dream:start/end -->`),保留块外文字、BOM 与换行风格,先持久化 pending 恢复记录再原子替换文件,最后记录 applied;
116
- - `rollback`:用 backupId 定位记录,只在当前管理块仍等于该次 apply 结果时回滚,保留块外后来追加的人工内容。
23
+ 网页版把命令中的 `desktop` 改为 `web`。安装后重启 DSH。
117
24
 
118
- 缺省不传 `mode` 保持 0.5.x 直写并返回弃用提示;建议新流程一律显式 `preview → apply`。只有 `usable`、scope 匹配当前项目(或显式 global 且 review.decision 为 accepted)的经验可桥接,频次不再准入;写入内容统一过 `mask.ts`。面板的「写入记录」只读展示这些记录与可否回滚。
25
+ ## 开始使用
119
26
 
120
- ## 做梦协议(随包技能)
27
+ 可说:“回顾最近的任务,记录值得保留的经验。”在「设置 → 梦境日记」查看来源、审阅经验;规则写入先预览再应用。
121
28
 
122
- 插件附带 `dream-protocol` 技能,教 agent 何时做梦(开场/收尾/距上次做梦超一天)、做梦三步(入梦→解梦→记梦)与记梦纪律(只沉淀规律不复述流水账、密钥隐私不入梦、存疑要标注)。
29
+ 记录由助手调用工具完成,无需手工填表;技能引导任务开始取回经验、收尾提交候选,但不是后台持续学习。新经验先待审阅,写入项目规则另需预览和应用。中英文界面跟随 DSH 语言,日记与经验正文保留原文。
123
30
 
124
- ## 经验记忆(M1)
31
+ ## 依赖与配置
125
32
 
126
- 梦境日记是主观感悟;真正要复用的技术经验走 `<journalDir>/knowledge/`:
33
+ 默认使用本机 DSH 会话与日记目录,支持隐私脱敏。操作面板使用 DSH 0.2.0-rc.2 的认证通道;工具与技能也可用于 headless。
127
34
 
128
- - **候选 → 来源核验 → 审阅**:dream_learn 创建 candidate。会话来源需要 sessionId、recordSeq 与可匹配的 quote(省略时用 summary 匹配);插件核对项目、角色、记录和文本并计算 sourceHash。user-correction 必须来自真实用户消息;local-artifact 需要 artifactPath,真实路径必须位于调用工作目录内。核验失败记 claimed 与 verificationReason,不计独立支持数。读到来源不等于用户采纳,工具审阅记录 actor:model。补充证据不会自动改变状态;所有审阅携带 expectedRevision,旧版本会拒绝。
129
- - **取回有预算**:`dream_context` 默认最多返回 5 条、3000 字符(硬上限 20 条 / 20000 字符);按排名整条装入,遇到第一条放不下就停止(`skipped: budget-stop`),`title / when / action / exceptions` 永不截断,绝不返回半条。候选与无独立证据的非 usable 条目默认不注入(`includeCandidates: false`,记 `candidate-hold` / `no-evidence`);显式 `includeCandidates: true` 可在审阅候选时看到,且候选排在可用经验之后——未经审阅不得当作已证实结论。已驳回、已过期和冲突未解决的不注入;platform 可显式指定,未指定时从明确任务文字识别,否则采用宿主平台,平台不符记 platform-mismatch;`applicability.versions` 只在包名被识别(显式 `packageName` 或 query 中出现包名)时参与判定。
130
- - **频率不是可靠性**:同一条证据重复提交是幂等的;不要在同一个会话里反复 `dream_save` / `dream_learn` 刷次数。同一个会话中重复出现的教训只算一次独立来源。
131
- - **存储可恢复**:`events.jsonl` 是权威事件日志(追加写),`evidence.jsonl` 追加证据,`index.json` 是可丢弃重建的派生索引;重建索引不删除任何原文件。目录不存在时读取接口返回空结果,不会为了读而创建目录。
132
- - **删除新数据**:直接删除 `<journalDir>/knowledge/` 即清空经验记忆;这不会影响 `dreams.jsonl` 里的旧日记,旧版本插件也仍能读取旧日记。
133
-
134
- ## 配置
135
-
136
- 在你自己的 profile 的 `cordis.patch.yml` 里覆盖本插件行(缺省时用默认值也能加载):
137
-
138
- ```yaml
139
- - id: dream
140
- name: '@stardustlc/dsh-dream'
141
- config:
142
- # sessionsRoot: '' # 会话根目录(默认 ~/.dsh/sessions)
143
- # journalDir: '' # 梦境日记目录(默认 ~/.dsh/.dsh-dream)
144
- maxSessions: 10 # dream_digest 最多回放会话数(1-50)
145
- maxCharsPerSession: 6000 # 每会话摘要字符上限(500-50000)
146
- # maxUserMessages: 5 # 每会话保留用户消息条数(1-20)
147
- # maskSecrets: true # 梦原料隐私脱敏开关(默认开)
148
- ```
35
+ 详细配置、工具参数与排错见[使用说明](docs/USAGE.md)。从源码独立开发时,Node 要求以 [package.json](package.json) 为准。
149
36
 
150
- ## 隐私保护(默认开启)
37
+ ## 文档
151
38
 
152
- 梦原料入梦前自动脱敏:sk 密钥、GitHub/Groq/Slack 令牌、AWS 密钥、JWT、`password/token/api_key` 赋值、超长高熵串都会被打成 `[已脱敏·类型]`。M1 的经验 / 证据 / 错误 / 桥接写盘路径在 `maskSecrets` 开启时同样先过 `mask.ts`,面板只读路由返回的文本也会再做一次脱敏。不需要时可在配置里设 `maskSecrets: false`。
153
-
154
- ## 权限与数据
155
-
156
- - 只读访问会话目录(`~/.dsh/sessions`),不修改任何会话文件;
157
- - 梦境日记以 JSONL 追加写入 `journalDir`;经验与证据追加写入 `journalDir/knowledge/`(events.jsonl / evidence.jsonl,index.json 可重建);
158
- - 不发起任何网络请求;
159
- - 会话内容可能包含敏感信息——做梦协议明确禁止把密钥/隐私写入梦境,但梦境日记本身是明文存储,请自行评估。
160
-
161
- ## 排错
162
-
163
- - `dream_digest` 返回 0 个会话:先运行 `dream_health` 检查会话目录是否存在;确认 DSH 已产生过会话;
164
- - 梦境写不进去:检查 `journalDir` 可写权限;
165
- - 加载失败:查看 DSH 启动日志中带 `[dsh-dream]` 前缀的告警。
166
-
167
- ## 开发
168
-
169
- ```bash
170
- pnpm install
171
- pnpm test # 构建 + 离线测试(会话代际、多帧 zstd、流式记录、隐私脱敏、日记、桥接与注册生命周期)
172
- ```
39
+ - [使用与排错](docs/USAGE.md)
40
+ - [更新记录](CHANGELOG.md)
41
+ - [验证范围与历史记录](docs/VALIDATION.md)
42
+ - [问题反馈与功能建议](https://github.com/STARDUSTLC666/dsh-dream/issues)
173
43
 
174
44
  ## License
175
45
 
176
- MIT(见 [LICENSE](LICENSE))
46
+ [MIT](LICENSE)
@@ -0,0 +1,43 @@
1
+ # Historical release notes
2
+
3
+ [Current changelog](../CHANGELOG.md) · [Overview](../README.en.md)
4
+
5
+ These English notes preserve the earlier translations. The main changelog contains the consolidated version history.
6
+
7
+ ## 0.7.0 (2026-10-02)
8
+
9
+ - Direct review buttons, conflict resolution with a required reason, and expandable source records. UI decisions record `human`; model tools still record `model`. Revision conflicts preserve entered text.
10
+ - Project lessons can preview the exact AGENTS.md changes, apply the approved preview, and roll back the managed block while preserving manual content outside it. Previews expire after ten minutes and check both lesson revision and file hash. Lessons without a project directory keep the project-chat preview command.
11
+ - Separate useful / not-applicable feedback with optional context, idempotent retries, and the latest twenty details. Feedback does not automatically accept, reject, validate, or add evidence to a lesson.
12
+ - Mutations use Harness 0.2.0-rc.2's authenticated Connection Fetch carrier. Read-only endpoints and command fallbacks remain. A Dream-scoped narrow-window layout prevents the settings navigation from squeezing the content into single-character columns.
13
+ - See [0.7.0 validation](validation/0.7.0.md) for browser, automatic-test and native Desktop boundaries.
14
+
15
+ ## 0.6.0 (2026-09-30)
16
+
17
+ - **Source verification and review**: reads actual session records or bounded project artifacts. Unverifiable claims stay claimed with a reason. New lessons start as candidates, including user corrections.
18
+ - **Recoverable bridging**: preview / apply / rollback with durable recovery records written before the target. Handles missing-file null hashes, linked paths, CRLF rollback and concurrent edits.
19
+ - **Complete review**: verified evidence attachment, atomic conflict resolution (prefer/drop/merge), reopening rejected lessons, and stable public references.
20
+ - **Usable panel**: separate Journal / Lessons / Write log views, prominent action text, a conflict form with named lessons and a required reason, and copyable rollback commands.
21
+ - See [0.6.0 validation](validation/0.6.0.md) and [CHANGELOG](../CHANGELOG.md).
22
+
23
+ ## 0.5.1 (2026-09-29)
24
+
25
+ - **Fixes**: a leading UTF-8 BOM used to hide the whole journal; mood keys such as `__proto__`/`constructor` corrupted counts. **Retrieval discipline**: candidates and evidence-free lessons are not injected by default, version checks need package context, and the budget packs by rank. **Historical evidence policy**: read evidence used to promote lessons directly; 0.6.0 replaces this with independent source verification and review.
26
+ - 204 tests (203 passing, 1 opt-in concurrency stress test skipped); L1 acceptance 9/9. Known limit: reads/writes still grow with history on very large libraries.
27
+
28
+ ## 0.5.0 (2026-09-29)
29
+
30
+ - **Three new tools**: `dream_learn` (submit an evidence-backed candidate lesson), `dream_context` (retrieve a few applicable lessons before a task; read-only; 5 items / 3000 characters by default) and `dream_review` (accept / reject / mark stale or disputed / attach evidence; every mutation requires a revision).
31
+ - **New data directory `<journalDir>/knowledge/`**: `events.jsonl` is the authoritative append-only log, `evidence.jsonl` appends evidence, and `index.json` is a disposable derived index. The old `dreams.jsonl` stays read-compatible and is never rewritten.
32
+ - **Masking and scope guarantees**: every new write path runs through `mask.ts` when `maskSecrets` is on; evidence stores only masked one-line summaries plus locators — never hidden reasoning, system prompts, tool arguments or result bodies. Lessons are scoped to a project or global; with an unknown project `dream_context` returns global lessons only and never scans across projects.
33
+ - **Compatibility**: the old journal and the six existing tools (dream_digest / dream_save / dream_journal / dream_recall / dream_bridge / dream_health) keep their behaviour and output fields only grow. No migration is required and no old data is rewritten.
34
+ - **New read-only "Lessons" block** in the panel: state (candidate / usable / disputed / stale / rejected), applicability, scope, applicability details (package / versions / platform) and exceptions (only when non-empty), evidence summary and last-validated time. Candidates and disputed lessons are visually distinct, and an empty knowledge store has its own empty state. When the event log is truncated or has bad lines the block shows a notice and says events.jsonl was left untouched. The panel still has no write actions.
35
+ - **Two more read-only blocks (M2)**: "To review" (candidate / disputed / stale lessons plus why each is held back, using the retrieval layer's Chinese skipped-reason labels) and "Write log" (bridge application records from <journalDir>/bridge/: target, time, lessonId@revision, before/after hashes, rollbackable and why). Every lesson gets a "copy review command"; bridgeable (usable) lessons get a "copy preview command"; if the clipboard fails it falls back to selectable text. The panel still has no write methods.
36
+
37
+ ## 0.4.1 (2026-09-29)
38
+
39
+ - **Fixes a Desktop boot failure**: the front-end module id now matches the scoped package name (it used to register as `dsh-dream`, so the host retried the bundle and threw `duplicate factory registration`, ending in `1 entry did not activate`). No journal or config migration.
40
+
41
+ ## 0.4.0 (2026-09-29)
42
+
43
+ Adds a read-only dream-journal panel: open **Settings →「梦境日记」(Dream journal)** to see totals, mood distribution, the lessons board and a card timeline, with keyword search. Long reflections fold automatically and a one-click privacy blur is available. The panel is read-only and the storage format is unchanged — no migration needed.