@stardustlc/dsh-dream 0.3.5 → 0.4.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 ADDED
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ ## 0.4.1(2026-09-29)
4
+
5
+ - **修复 Desktop 启动失败**:前端 bundle 的模块注册 ID 与 scoped 包名不一致(注册成 `dsh-dream`,而包名是 `@stardustlc/dsh-dream`),宿主会重试加载并抛 `client-modules: duplicate factory registration for "dsh-dream"`,导致 `web boot: 1 entry did not activate`。现统一为完整包身份。
6
+ - **回归测试**:`test/client-internals.test.mjs` 新增断言——注册 ID 必须等于 `package.json` 的 `name`;并用官方 `ClientModuleSystem` 验证「冷加载 / 缓存命中 / invalidate 后重载」三条路径,改回旧 ID 能稳定复现该错误。
7
+ - 说明:0.4.0 的面板功能本身不受影响(Web 下可用),本版只是让 Desktop(`dsh-app://`)能正常激活该入口;日记数据与配置不变,无迁移。
8
+ ## 0.4.0(2026-09-29)
9
+
10
+ - **新增:只读梦境日记可视化面板**。Web profile 设置页新增「梦境日记」一节:梦境总数、心境方块序列、教训榜(按出现次数排序、同次数按最近出现时间排序,行尾 ×N 与最近一次出现时间,≥3 次标「桥接候选」并注明由 dream_bridge 决定是否写入 AGENTS.md)与卡片式时间线(时间 / 心境 / 反思 / 教训),支持关键词搜索。反思正文默认展开,超 4 行或 220 字折叠为 4 行可展开;顶部「隐私模式」可一键模糊正文与教训(仅浏览器显示层,不改变文件)。空日记与单条日记有专门呈现,不画失真图表、不显示假精度 KPI。
11
+ - 面板数据来自新增的只读同源路由 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。
12
+ - **存储格式不变**:dreams.jsonl 仍是每行一条 DreamEntry JSON(id / at / reflection / lessons / mood),无迁移;升级后直接沿用现有日记。
13
+ - 修复:searchDreams(dream_recall 与面板搜索共用)此前只检索最近 1000 条日记,现在覆盖全量日记,并补充回归测试。
14
+ - 新增手写 lib/client.js(不经 tsc,随包发布);package.json 声明 dsh.client(inject @deepseek-ai/dsh-client-ui-settings,platform: "web")并导出 ./client;未新增任何依赖。
15
+ - 面板另含:≥8 场时的「筛选 ▾」(按心境 / 只看有教训,作用于已加载窗口)与满 50 场后的「显示更早的梦」(一次拉满 500 场上限)。
16
+ - 测试:64 → 109 项(19 个测试文件)全过;新增网页只读路由、lastAt 统计、全量检索回归与面板纯逻辑 vm 测试。
17
+ - **后续计划**:用 sidecar 记录桥接状态(哪些教训、何时写进哪个 AGENTS.md)。v1 不读取 AGENTS.md、不新增状态文件。
18
+ ## 0.3.5(2026-09-28)
19
+
20
+ - 兼容验证更新到 Harness 0.2.0-rc.1:64 项测试与 18 插件共同加载检查通过(`dream_digest` 按 v4 会话格式读取,继续过滤推理块)。
21
+ - 运行时代码未变;同步中英文兼容性声明。
22
+
23
+ ## 0.3.4(2026-09-28)
24
+
25
+ - 修复 [#2](https://github.com/STARDUSTLC666/dsh-dream/issues/2):`dream_digest` 摘要现在实际输出用户原话、助手回应与工具足迹(此前只列出标题/轮数/目录);
26
+ - 支持官方 Harness 0.1.7-rc.2 的 v4 会话文件:按消息 `source.kind` 只保留真人输入,过滤推理块与自动注入的上下文,避免当成用户原话;
27
+ - 跳过真正空会话;标题、工作目录、预设与工具名一并脱敏(此前只脱敏消息正文);
28
+ - 测试扩至 64 项全过(新增 v4 明文/zstd 与摘要渲染回归)。
29
+
30
+ ## 0.3.3(2026-09-11)
31
+
32
+ - 适配并验证官方 Harness 0.1.5-rc.1:整套同载、工具/技能契约与 Web 鉴权检查通过。
33
+ - Node 要求与宿主统一为 `^22.19.0 || >=24.0.0`;更新中英文兼容性说明。
34
+ - 修复 v3 会话被跳过的问题,兼容 v2/v3 PTC 子调用工具足迹,避免重复计数与提取私密正文;新增 6 项回归测试,60 项测试通过。
35
+
36
+ ## 0.3.2(2026-09-05)
37
+
38
+ - 适配 Harness 0.1.3 的 `session.v2.jsonl` / `.zstd` 代际文件;迁移保留旧文件时每个会话只读取最新规范文件。
39
+ - 解析 v2 的内嵌 `assistant/message` / `assistant/attempt` 流,继续兼容 v0 打包行与 v1 片段。
40
+ - 默认会话与日记目录遵循 `DSH_HOME`;显式配置仍优先。
41
+
42
+ ## 0.3.1(2026-08-31)
43
+
44
+ - 支持 0.1.2 ContentBlock 数组载荷的文本提取;
45
+ - npm 包名改为 `@stardustlc/dsh-dream`(`dsh-dream` 已被他人占用)。
46
+
47
+ ## 0.3.0(2026-08-26)
48
+
49
+ - `dream_bridge` 渡梦:把高频教训幂等合并进 `AGENTS.md` 标记块,梦变成长期记忆;
50
+ - `dream_journal` 增加心境分布与最常梦到教训的统计;
51
+ - 48 个测试全过。
52
+
53
+ ## 0.2.0(2026-08-26)
54
+
55
+ - 官方打包行(text-chunks 协议)流式文本还原;
56
+ - 梦原料默认隐私脱敏(密钥/令牌/JWT/高熵串 → `[已脱敏·类型]`);
57
+ - 入梦 `brief` 模式(`mode: 'brief'`);
58
+ - 40 个测试全过。
59
+
60
+ ## 0.1.0(2026-08-26)
61
+
62
+ - 首版:会话回放(`dream_digest`)、梦境日记(`dream_save`/`dream_journal`/`dream_recall`)与做梦协议技能;
63
+ - 官方多帧 zstd 会话日志零依赖解析;
64
+ - 28 个测试全过。
package/README.en.md CHANGED
@@ -4,9 +4,13 @@
4
4
 
5
5
  # dsh-dream
6
6
 
7
- ## 0.3.4 update (2026-09-28)
7
+ ## 0.4.1 update (2026-09-29)
8
8
 
9
- Fixes [#2](https://github.com/STARDUSTLC666/dsh-dream/issues/2): digests now render human excerpts, assistant responses and tool names, skip truly empty sessions, and mask metadata as well as the body. Supports Harness v4 session files while excluding reasoning blocks and injected context from human excerpts.
9
+ - **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.
10
+
11
+ ## 0.4.0 update (2026-09-29)
12
+
13
+ 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.
10
14
 
11
15
  > **An agent that dreams**: session replay (dream material) → reflection (interpretation) → dream journal (memory consolidation).
12
16
 
@@ -14,7 +18,7 @@ Humans consolidate memories by replaying the day during sleep — dsh-dream give
14
18
 
15
19
  ## Compatibility
16
20
 
17
- Validation host: Harness `0.2.0-rc.1` built from official sources (commit `407e65c8`) with Node `24.16.0` on 2026-09-28. All 64 plugin tests pass in an isolated environment; all 18 plugins mount together in one host registering 1 skills and 6 tools, with tool schemas and health-check contracts passing. No live ports or external services were exercised in this round.
21
+ Validation host: Harness `0.2.0-rc.1` built from official sources (commit `407e65c8`) with Node `24.16.0` on 2026-09-29. All 112 plugin tests pass in an isolated environment; the plugin registers 6 tools and the `dream-protocol` skill inside a host where all 18 plugins mount together, with tool schemas and health-check contracts passing. No live ports or external services were exercised in this round; the panel is reachable on loopback only.
18
22
 
19
23
  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.
20
24
 
@@ -31,6 +35,20 @@ dsh plugin --profile web remove @stardustlc/dsh-dream
31
35
 
32
36
  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.
33
37
 
38
+ ## Dream journal panel (0.4.0+)
39
+
40
+ 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).
41
+
42
+ - **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.
43
+ - **Lessons board**: ranked by occurrences, ties broken by most recent occurrence, and each row shows when it was last seen (today / yesterday / N days ago; if the stats omit it, the panel falls back to the loaded page and says so); tied ranks get no medal colors, and counts do not imply importance. Lessons seen 3 or more times are marked as bridge candidates, with one line noting that whether they are written into AGENTS.md is decided by dream_bridge; lessons with count 1 carry no progress or KPI decoration. Lessons are trimmed and merged case-insensitively (the earliest spelling is kept); the same lesson written twice in one dream counts twice; near-duplicates with different wording, punctuation or full/half-width forms are not merged. The ledger shows the top 10 — the same default set dream_bridge writes into AGENTS.md.
44
+ - **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).
45
+ - **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.
46
+ - **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.
47
+ - **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.
48
+ - **Privacy**: the panel performs no second-pass masking — masking only happens when a dream is written (maskSecrets), and the panel shows exactly what is already in the file. It does not upload, export or make any network request. The privacy mode at the top blurs reflections and lessons in one click, but it is a display-layer effect only (the DOM still holds plaintext), not encryption. Review the journal before sharing your screen or the JSONL.
49
+ - **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.
50
+ - **Roadmap**: record bridge status via a sidecar (which lessons were written into which AGENTS.md, and when). Not in this release — v1 reads no AGENTS.md and adds no state file.
51
+
34
52
  ## Tools
35
53
 
36
54
  | Tool | Purpose | Key params |
package/README.md CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  # dsh-dream
4
4
 
5
- ## 0.3.4 更新(2026-09-28)
5
+ ## 0.4.1 更新(2026-09-29)
6
6
 
7
- 修复 [#2](https://github.com/STARDUSTLC666/dsh-dream/issues/2):摘要现在实际输出用户原话、助手回应和工具足迹;跳过真正空会话,标题与正文一并脱敏。支持新版 Harness 的 v4 会话文件,并过滤推理内容与自动注入的上下文,避免当作用户原话。
7
+ - **修复 Desktop 启动失败**:前端模块注册 ID 现与 scoped 包名一致(此前注册成 `dsh-dream`,宿主会重试加载并抛 `duplicate factory registration`,导致 `1 entry did not activate`)。日记数据与配置不变,无迁移。
8
+
9
+ ## 0.4.0 更新(2026-09-29)
10
+
11
+ 新增只读梦境日记可视化面板:打开「设置 → 梦境日记」即可查看梦境总数、心境分布、教训榜与卡片式时间线,并可按关键词搜索;正文超长自动折叠,可一键开启隐私模糊。面板只读,存储格式不变、无需迁移。
8
12
 
9
13
  > **会做梦的 agent**:会话回放(梦原料)→ 反思(解梦)→ 梦境日记(记忆巩固)。
10
14
 
@@ -14,7 +18,7 @@
14
18
 
15
19
  ## 兼容性
16
20
 
17
- 验证宿主:官方源码构建的 Harness `0.2.0-rc.1`(commit `407e65c8`)+ Node `24.16.0`(2026-09-28)。64 项插件测试在隔离环境全部通过;同一个宿主里 18 个插件共同加载,注册 1 个技能、6 个工具,工具 schema 与健康检查契约通过。本轮未启用真实端口与外部服务。
21
+ 验证宿主:官方源码构建的 Harness `0.2.0-rc.1`(commit `407e65c8`)+ Node `24.16.0`(2026-09-29)。112 项插件测试在隔离环境全部通过;同一个宿主里 18 个插件共同加载,本插件注册 6 个工具与 `dream-protocol` 技能,工具 schema 与健康检查契约通过。本轮未启用真实端口与外部服务;面板仅在本机回环地址下可达。
18
22
 
19
23
  支持 v0/v1/v2/v3/v4 的普通 JSONL 与多帧 zstd、旧 packed-chunk 行及内嵌 stream;升级留下多代文件时只读取每个会话的最新规范文件。PTC 子工具调用保留工具名且不重复计数,不提取系统提示、推理、工具参数或结果正文。
20
24
 
@@ -38,6 +42,20 @@ dsh plugin --profile web remove @stardustlc/dsh-dream
38
42
 
39
43
  卸载后重启 Web 服务。梦境日记默认保存在 `~/.dsh/.dsh-dream/dreams.jsonl`,卸载不会删除;如需彻底清理请手动删除该目录。
40
44
 
45
+ ## 梦境日记面板(0.4.0+)
46
+
47
+ 装好后,DSH 的「设置 → 梦境日记」里会多出一节**只读**面板(Web profile 专用;headless 宿主没有设置页,工具与技能照常可用)。
48
+
49
+ - **看什么**:顶部是梦境总数、心境方块序列(单条时不空,多条时自动换行)与教训榜;下面是卡片式时间线,按时间倒序,逐条显示时间、心境、反思正文与教训列表。反思正文默认展开,超过 4 行或 220 字时折叠为 4 行并给出「展开全文」。
50
+ - **教训榜**:按出现次数排序,同次数按最近出现时间排序,并在每条上显示最近一次出现(今天 / 昨天 / N 天前;统计缺失时按当前页现算并注明「本页内最近」);并列名次不加奖牌色;次数不代表重要度。出现 ≥3 次的教训标「桥接候选」,旁边一行说明「是否写入 AGENTS.md 由 dream_bridge 决定」;次数为 1 的教训不显示进度或 KPI。统计前会去掉每条教训的首尾空白并按全小写合并(原样保留最早出现的写法);同一场梦里把同一条教训写两遍会算两次;措辞不同(含标点、全角半角差异)的教训不会自动合并。账本最多显示前 10 条,这也是 dream_bridge 默认写入 AGENTS.md 的条数。
51
+ - **搜索**:按关键词过滤,命中反思与教训,不区分大小写。心境分布与教训榜基于**全量日记**,时间线按搜索与条数上限(默认最近 50 场)展示。
52
+ - **筛选与更早的梦**:≥8 场时出现「筛选 ▾」(按心境、只看有教训的梦,作用于已加载窗口并在弹层注明);加载满 50 场且总梦数更多时,页脚提供「显示更早的梦」,点击后一次拉满到 500 场(路由上限)。
53
+ - **只读**:面板只从插件自己的 GET /_dsh/dsh-dream/journal 读取数据(仅回环地址可达;非 GET → 405,非本机 Host → 403),没有任何写操作。记梦、翻梦、忆梦仍在对话里通过 dream_save / dream_journal / dream_recall 完成,面板不会修改你的日记文件。
54
+ - **数据文件**:面板读的就是梦境日记本身,默认 ~/.dsh/.dsh-dream/dreams.jsonl($DSH_HOME/.dsh-dream/dreams.jsonl;配置了 journalDir 时以配置为准)。存储格式不变,仍是每行一条 JSON 的 JSONL,可直接删除或用 dream_journal 读取。
55
+ - **隐私**:面板不做二次脱敏——脱敏只发生在入梦写盘时(maskSecrets),面板原样显示文件里已有的内容。它不上传、不导出、不发起任何网络请求;顶部「隐私模式」可一键模糊正文与教训,但它只是浏览器里的显示效果(DOM 中仍是明文),不是加密。共享屏幕或转发 dreams.jsonl 前请自行确认内容。
56
+ - **还没有梦时**:面板显示空态,提示对 agent 说「做个梦」——它会回放最近的会话、反思之后把第一条梦写进这里;只有一场梦时按单条卡片展示,心境方块与教训榜都不留空、不画失真图表。
57
+ - **后续计划**:用 sidecar 记录桥接状态(哪些教训、何时写进了哪个 AGENTS.md)。本轮不做——v1 不读取 AGENTS.md,也不新增任何状态文件。
58
+
41
59
  ## 工具一览
42
60
 
43
61
  | 工具 | 作用 | 关键参数 |