@wangxiaocuo/dsh-session-trash 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,102 @@
1
+ # Changelog
2
+
3
+ 本文件记录这个插件的所有重要变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.6.4] - 2026-11-11
8
+
9
+ ### Added
10
+
11
+ - e2e 支持 `DSH_E2E_DSH_BIN` 启动 npm 安装的 `@deepseek-ai/dsh` web Host,不再依赖桌面版;Linux/Windows 也能跑真实 Host 端到端测试。
12
+ - CI 新增真实 Host e2e job(Ubuntu + Windows),失败时输出 check annotations。
13
+ - 新增 `pnpm typecheck`(`tsc --checkJs`,先覆盖 `lib/` 和 `index.js`)并接入 CI;DSH 服务通过 `types/dsh-context.d.ts` 的 ambient 声明提供类型。
14
+ - 新增 jsdom + 真实 React 渲染测试(`test/client-dom.test.js`),覆盖行菜单的方向键/Escape/Tab/外点关闭,以及确认对话框的焦点陷阱和焦点恢复。
15
+
16
+ ### Fixed
17
+
18
+ - ActionMenu:Escape 不再冒泡到宿主设置弹层;Tab 会关闭菜单并让焦点自然移动;分隔符使用 `role="separator"`。
19
+ - ConfirmDialog:打开它的行或按钮被移除后,焦点回退到列表面板,不再丢到 `body`。
20
+
21
+ ## [0.6.3] - 2026-11-11
22
+
23
+ ### Added
24
+
25
+ - `/state` 的条目新增稳定的 `lastErrorCode`,页面据此把失败原因本地化;`lastError` 保留英文原始诊断,只用作 tooltip。
26
+ - 新增本 CHANGELOG,并把它包含在 npm 包里。
27
+
28
+ ### Changed
29
+
30
+ - 中文界面不再直接显示 Host 的英文诊断;「在 Finder 中显示」改为平台中性的「在文件管理器中显示」。
31
+ - 英文界面使用正确的单复数(会话数、子会话数、清理/删除数量)。
32
+ - 清理结果区分部分失败与全部失败,失败时使用失败 Toast 并给出数量。
33
+ - 到期倒计时每分钟刷新;条目的数据变少时页码自动收敛。
34
+ - 生成 `/state` 时,同一原始工作区只探测一次,而不是每个条目各探测一次。
35
+ - 未知大小显示为 `—`,不再显示 `0 B`。
36
+
37
+ ### Fixed
38
+
39
+ - 恢复、永久删除、从索引移除或显示工作区成功后,清除该行残留的旧错误提示。
40
+ - 跨设备复制后源目录删除失败时,HTTP 错误不再返回源路径/回收站绝对路径;错误 `details` 只暴露白名单字段(`code`、`phase`、`sessionId`、`metrics` 等)。
41
+ - 跨设备复制校验现在比较符号链接数量,能发现复制过程中被静默丢弃的符号链接。
42
+
43
+ ### Tests
44
+
45
+ - 新增 wire 错误脱敏、`lastErrorCode` 映射、工作区探测去重、清理部分失败、行错误清除、未知大小和符号链接校验的回归测试。
46
+
47
+ ## [0.6.2] - 2026-11-11
48
+
49
+ ### Fixed
50
+
51
+ - 客户端写操作串行化:同一时间只允许一个写请求,行级 pending 状态独立清理,程序化重复点击会被忽略。
52
+ - 写请求 30 秒、`/state` 15 秒硬超时;设置页卸载时取消在途请求,超时显示本地化文案。
53
+ - 后台刷新不再禁用行操作;`ActionMenu` 在变为禁用时自动关闭。
54
+
55
+ ### Tests / CI
56
+
57
+ - 测试入口改为跨平台的 `test/run-unit.mjs`(不依赖 shell glob)。
58
+ - CI 增加 Windows(Node 22)矩阵,并把单元测试失败输出转成 check annotations。
59
+ - e2e 支持跨平台发现桌面版,Windows 上跳过依赖 POSIX 权限位的清理失败场景。
60
+
61
+ ### Docs
62
+
63
+ - README 用可核对的验证矩阵替代原先无法验证的跨平台表述。
64
+
65
+ ## [0.6.1] - 2026-11-11
66
+
67
+ ### Fixed
68
+
69
+ - Host 冒烟测试改为普通 Node 可运行:索引版本断言改为读取 `INDEX_VERSION`,不再硬编码;Cordis 来自 `@deepseek-ai/cordis` devDependency;自己创建并清理临时 `DSH_HOME`。
70
+
71
+ ### Performance
72
+
73
+ - 批量删除/清理改为批量提交索引:200 条目的永久删除从 400 次索引提交、约 70 MB 写入降到 2 次提交、约 0.4 MB。
74
+ - 启动恢复复用 reconcile 的探测结果,并对成员目录并行探测;单个条目变化时只重写它自己的 `meta.json`。
75
+
76
+ ### Added
77
+
78
+ - GitHub Actions CI(单元测试、冒烟测试、覆盖率、打包内容检查)。
79
+
80
+ ## [0.6.0] - 2026-11-09
81
+
82
+ ### Added
83
+
84
+ - 隐藏的 subagent 子会话随父会话一起移入回收站、一起恢复;含子会话的条目显示数量徽章。
85
+ - 生成组合包并以 `@wangxiaocuo/dsh-session-trash` 发布。
86
+
87
+ ### Changed
88
+
89
+ - **BREAKING**:索引 schema 升级为 v2(条目携带 `members`);旧版本插件无法读取 v2 索引,会进入保护模式。降级前请先清空回收站。
90
+
91
+ ## [0.5.1] - 2026-11-09
92
+
93
+ ### Added
94
+
95
+ - 回收站工具栏的「永久删除全部」与二次确认;`missing` 记录只移出索引,不删除会话文件。
96
+
97
+ [0.6.4]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.3...v0.6.4
98
+ [0.6.3]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.2...v0.6.3
99
+ [0.6.2]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.1...v0.6.2
100
+ [0.6.1]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.0...v0.6.1
101
+ [0.6.0]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.5.1...v0.6.0
102
+ [0.5.1]: https://github.com/wangxiaocuo/dsh-session-trash/releases/tag/v0.5.1
package/README.en.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  [简体中文](./README.md) | English
4
4
 
5
- [GitHub](https://github.com/wangxiaocuo/dsh-session-trash) · [npm](https://www.npmjs.com/package/@wangxiaocuo/dsh-session-trash)
5
+ [GitHub](https://github.com/wangxiaocuo/dsh-session-trash) · [npm](https://www.npmjs.com/package/@wangxiaocuo/dsh-session-trash) · [Changelog](./CHANGELOG.md)
6
6
 
7
7
  A session trash for DeepSeek Harness. Move cold sessions out of the sidebar without deleting their logs, restore them within the retention window, or delete the logs permanently. Built for DSH 0.2.2-rc.1 on Desktop and Web. Host and Client ship in one package, with no build step.
8
8
 
9
- Status: feature complete. CI (GitHub Actions) runs the unit and Host smoke tests on Ubuntu (Node 20/22) and Windows (Node 22); macOS has run the end-to-end suite against a real DSH Host. The Windows and Linux DSH Hosts have not been verified manually yet, and Windows skips the cases that rely on POSIX permission bits.
9
+ Status: feature complete. CI (GitHub Actions) runs the unit tests, the Host smoke test, and the real `dsh web` end-to-end suite on Ubuntu (Node 20/22) and Windows (Node 22), booting the Host from an npm-installed DSH runtime; macOS also ran the suite against the real desktop Host manually. Windows skips the cases that rely on POSIX permission bits.
10
10
 
11
11
  ## Features
12
12
 
@@ -132,7 +132,7 @@ Restore and maintenance refusals include `TRASH_ENTRY_NOT_FOUND`, `TRASH_STATE_I
132
132
 
133
133
  `/state.stats.cleanup` reports the last cleanup attempt, the next sweep, a pending retry, consecutive failures, and the last run summary.
134
134
 
135
- `/state` entries gain `subagentCount` (hidden children moved along) and `members` (parent first, each with `sessionId`, `origin`, and `sizeBytes`); `sizeBytes`/`fileCount` cover the whole tree. The `entry` returned by `/trash` uses the same shape.
135
+ `/state` entries gain `subagentCount` (hidden children moved along) and `members` (parent first, each with `sessionId`, `origin`, and `sizeBytes`); `sizeBytes`/`fileCount` cover the whole tree. The `entry` returned by `/trash` uses the same shape. Entries also carry `lastErrorCode` (a stable category the page localizes) and `lastError` (the raw English diagnostic, used only as a tooltip).
136
136
 
137
137
  ## Storage and recovery
138
138
 
@@ -167,7 +167,7 @@ The index schema is v2; a v1 index is upgraded automatically on startup and pres
167
167
  - Permanent deletion removes the session log only. Attachments, images, projection-cache rows, and search-index rows are not deleted.
168
168
  - `/state` returns all entry summaries in one response. Search, filtering, and paging happen in the Client.
169
169
  - There is no cross-window live push. Another window's change appears after a refresh or when the window regains focus.
170
- - The Windows and Linux DSH Hosts have not been verified manually; CI covers unit and Host smoke tests only. On Windows, cases that rely on POSIX permission bits are skipped, and long paths over 260 characters / symlink copying depend on system configuration (the related tests skip themselves when unsupported).
170
+ - The desktop apps on Windows and Linux have not been verified manually; CI boots an npm-installed `dsh web` Host, so desktop-shell UI and desktop-only features (such as reveal in the file manager) are still verified on macOS only. On Windows, cases that rely on POSIX permission bits are skipped, and long paths over 260 characters / symlink copying depend on system configuration (the related tests skip themselves when unsupported).
171
171
  - macOS path comparison is case-insensitive. On a case-sensitive APFS volume, paths that differ only by case are treated as the same location.
172
172
  - Multiple DSH processes sharing one `DSH_HOME` serialize trash operations through `.lock`. A process paused for more than 10 minutes can lose the lock to another process.
173
173
 
@@ -175,9 +175,10 @@ The index schema is v2; a v1 index is upgraded automatically on startup and pres
175
175
 
176
176
  ```bash
177
177
  pnpm install
178
- pnpm test # unit tests
178
+ pnpm test # unit tests + real-DOM component tests (jsdom)
179
+ pnpm typecheck # tsc --checkJs (currently lib/ and index.js)
179
180
  pnpm test:smoke # Host smoke test (real Cordis, plain Node)
180
- npm run test:e2e # real dsh web end-to-end (needs the desktop app)
181
+ npm run test:e2e # real dsh web end-to-end (desktop app or npm-installed DSH)
181
182
  ```
182
183
 
183
184
  The Host smoke test wires the plugin into a real Cordis context through the `@deepseek-ai/cordis` devDependency, creates its own temporary `DSH_HOME`, and removes it afterwards; it does not need the desktop app. Set `DSH_SMOKE_KEEP=1` to keep the temporary home for debugging. `pnpm test` enumerates the test files through `test/run-unit.mjs`, so it does not depend on shell glob expansion and behaves the same on Windows and POSIX shells.
@@ -188,9 +189,10 @@ What CI verifies:
188
189
  |---|---|
189
190
  | Unit tests, Host smoke test | CI: Ubuntu Node 20/22, Windows Node 22 |
190
191
  | Package contents (`npm pack`) | CI: Ubuntu |
191
- | Real `dsh web` end to end | macOS + DSH 0.2.2-rc.1 (run manually) |
192
+ | Real `dsh web` end to end (npm-installed DSH) | CI: Ubuntu, Windows (Node 22) |
193
+ | Real `dsh web` end to end (desktop app) | macOS + DSH 0.2.2-rc.1 (run manually) |
192
194
 
193
- `npm run test:e2e` boots a real `dsh web` Host in a temporary `DSH_HOME` and runs the full flow. It discovers the desktop app in the platform's usual install locations, or uses `DSH_ELECTRON`; when no desktop app is found it prints a skip message and exits 0. The cleanup-failure scenario that relies on POSIX permission bits is skipped on Windows. Set `DSH_E2E_KEEP=1` to keep the temporary home and logs.
195
+ `npm run test:e2e` boots a real `dsh web` Host in a temporary `DSH_HOME` and runs the full flow. By default it discovers the desktop app in the platform's usual install locations (or uses `DSH_ELECTRON`); set `DSH_E2E_DSH_BIN` to the `lib/bin.js` of an npm-installed `@deepseek-ai/dsh` to boot the Host with plain Node instead - CI and Linux/Windows use that mode, with no desktop app required. When no Host is found it prints a skip message and exits 0. The cleanup-failure scenario that relies on POSIX permission bits is skipped on Windows. Set `DSH_E2E_KEEP=1` to keep the temporary home and logs.
194
196
 
195
197
  Project layout:
196
198
 
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  简体中文 | [English](./README.en.md)
4
4
 
5
- [GitHub](https://github.com/wangxiaocuo/dsh-session-trash) · [npm](https://www.npmjs.com/package/@wangxiaocuo/dsh-session-trash)
5
+ [GitHub](https://github.com/wangxiaocuo/dsh-session-trash) · [npm](https://www.npmjs.com/package/@wangxiaocuo/dsh-session-trash) · [更新记录](./CHANGELOG.md)
6
6
 
7
7
  DeepSeek Harness 的会话回收站插件。冷会话可以从侧边栏移出,日志保留在本地;保留期内可以恢复,到期后自动删除日志。面向 DSH 0.2.2-rc.1 的 Desktop 和 Web,Host 和 Client 在同一个包里,不需要构建步骤。
8
8
 
9
- 当前状态:功能已实现。CI(GitHub Actions)在 Ubuntu(Node 20/22)和 Windows(Node 22)上跑单元测试与 Host 冒烟测试;macOS 已在真实 DSH Host 上跑通端到端测试。Windows 和 Linux 的真实 DSH Host 尚未手动验证;Windows 上依赖 POSIX 权限位的用例会显式跳过。
9
+ 当前状态:功能已实现。CI(GitHub Actions)在 Ubuntu(Node 20/22)和 Windows(Node 22)上跑单元测试、Host 冒烟测试和真实 `dsh web` 端到端测试(Host 由 npm 安装的 DSH runtime 启动);macOS 另外在真实桌面版 Host 上手动跑通过 e2e。Windows 上依赖 POSIX 权限位的用例会显式跳过。
10
10
 
11
11
  ## 功能
12
12
 
@@ -131,7 +131,7 @@ npm 安装的插件在「插件」页打开「会话回收站」的详情,展
131
131
 
132
132
  `/state` 的 `stats.cleanup` 记录上次清理时间、下次清理时间、重试时间、连续失败次数和上次运行摘要。
133
133
 
134
- `/state` 的条目新增 `subagentCount`(一并移入的隐藏子会话数)和 `members`(父会话在前,含 `sessionId`、`origin`、`sizeBytes`);`sizeBytes`/`fileCount` 是整棵树的总量。`/trash` 返回的 `entry` 使用同一形状。
134
+ `/state` 的条目新增 `subagentCount`(一并移入的隐藏子会话数)和 `members`(父会话在前,含 `sessionId`、`origin`、`sizeBytes`);`sizeBytes`/`fileCount` 是整棵树的总量。`/trash` 返回的 `entry` 使用同一形状。条目还带 `lastErrorCode`(稳定的失败分类,供页面本地化)和 `lastError`(英文原始诊断,只作 tooltip)。
135
135
 
136
136
  ## 数据与恢复
137
137
 
@@ -166,7 +166,7 @@ npm 安装的插件在「插件」页打开「会话回收站」的详情,展
166
166
  - 永久删除只删除会话日志。附件、图片、投影缓存和搜索索引不会被删除。
167
167
  - `/state` 一次返回全部条目摘要,页面在客户端搜索、筛选和分页。
168
168
  - 没有跨窗口实时推送。另一个窗口的变更要等刷新或窗口重新获得焦点后出现。
169
- - Windows 和 Linux 的真实 DSH Host 尚未手动验证;CI 只覆盖单元测试和 Host 冒烟测试。Windows 上依赖 POSIX 权限位的用例会跳过;超过 260 字符的长路径和符号链接复制受系统设置影响,对应用例在不支持时自动跳过。
169
+ - Windows/Linux 的桌面版尚未手动验证;CI 用 npm 安装的 `dsh web` 覆盖真实 Host 行为,但桌面壳 UI 与桌面专属能力(例如「在文件管理器中显示」)仍只在 macOS 上验证。Windows 上依赖 POSIX 权限位的用例会跳过;超过 260 字符的长路径和符号链接复制受系统设置影响,对应用例在不支持时自动跳过。
170
170
  - macOS 的路径比较按大小写不敏感处理。在大小写敏感的 APFS 卷上,仅大小写不同的两个路径会被视为同一位置。
171
171
  - 多个 DSH 进程共享同一个 `DSH_HOME` 时,回收站操作通过 `.lock` 串行;进程暂停超过 10 分钟后,锁可能被另一个进程接管。
172
172
 
@@ -174,9 +174,10 @@ npm 安装的插件在「插件」页打开「会话回收站」的详情,展
174
174
 
175
175
  ```bash
176
176
  pnpm install
177
- pnpm test # 单元测试
177
+ pnpm test # 单元测试 + 真实 DOM 组件测试(jsdom)
178
+ pnpm typecheck # tsc --checkJs(当前覆盖 lib/ 和 index.js)
178
179
  pnpm test:smoke # Host 冒烟测试(真实 Cordis,普通 Node 即可)
179
- npm run test:e2e # 真实 dsh web 端到端(需要本机桌面版)
180
+ npm run test:e2e # 真实 dsh web 端到端(桌面版或 npm 安装的 DSH)
180
181
  ```
181
182
 
182
183
  Host 冒烟测试通过 `@deepseek-ai/cordis` 这个 devDependency 装配真实插件上下文,自己创建并清理临时 `DSH_HOME`,不需要桌面版;设置 `DSH_SMOKE_KEEP=1` 可以保留临时目录用于排查。`pnpm test` 通过 `test/run-unit.mjs` 枚举测试文件,不依赖 shell 展开 glob,Windows 和 POSIX shell 行为一致。
@@ -187,9 +188,10 @@ Host 冒烟测试通过 `@deepseek-ai/cordis` 这个 devDependency 装配真实
187
188
  |---|---|
188
189
  | 单元测试、Host 冒烟测试 | CI:Ubuntu Node 20/22、Windows Node 22 |
189
190
  | 打包内容(`npm pack`) | CI:Ubuntu |
190
- | 真实 `dsh web` 端到端 | macOS + DSH 0.2.2-rc.1(手动执行) |
191
+ | 真实 `dsh web` 端到端(npm 安装的 DSH) | CI:Ubuntu、Windows(Node 22) |
192
+ | 真实 `dsh web` 端到端(桌面版) | macOS + DSH 0.2.2-rc.1(手动执行) |
191
193
 
192
- `npm run test:e2e` 会启动真实 `dsh web` Host,在临时 `DSH_HOME` 中跑完整流程。脚本会按平台在常见安装位置查找桌面版,也可以用 `DSH_ELECTRON` 指向其他 Electron 可执行文件;找不到桌面版时打印跳过信息并以 0 退出。依赖 POSIX 权限位的「清理失败」场景在 Windows 上会跳过。设置 `DSH_E2E_KEEP=1` 可以保留临时目录和日志。
194
+ `npm run test:e2e` 会启动真实 `dsh web` Host,在临时 `DSH_HOME` 中跑完整流程。默认按平台在常见安装位置查找桌面版(也可以用 `DSH_ELECTRON` 指定);设置 `DSH_E2E_DSH_BIN` 指向 npm 安装的 `@deepseek-ai/dsh` 的 `lib/bin.js` 时,改用普通 Node 启动 Host——CI 和 Linux/Windows 都走这条路径,不依赖桌面版。找不到 Host 时打印跳过信息并以 0 退出。依赖 POSIX 权限位的「清理失败」场景在 Windows 上会跳过。设置 `DSH_E2E_KEEP=1` 可以保留临时目录和日志。
193
195
 
194
196
  项目结构:
195
197