@wangxiaocuo/dsh-session-trash 0.6.1 → 0.6.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/CHANGELOG.md +85 -0
- package/README.en.md +14 -6
- package/README.md +14 -6
- package/client.js +398 -112
- package/lib/errors.js +61 -1
- package/lib/fsops.js +8 -1
- package/lib/state.js +47 -4
- package/package.json +5 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本文件记录这个插件的所有重要变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循[语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
|
+
|
|
5
|
+
## [0.6.3] - 2026-11-11
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `/state` 的条目新增稳定的 `lastErrorCode`,页面据此把失败原因本地化;`lastError` 保留英文原始诊断,只用作 tooltip。
|
|
10
|
+
- 新增本 CHANGELOG,并把它包含在 npm 包里。
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- 中文界面不再直接显示 Host 的英文诊断;「在 Finder 中显示」改为平台中性的「在文件管理器中显示」。
|
|
15
|
+
- 英文界面使用正确的单复数(会话数、子会话数、清理/删除数量)。
|
|
16
|
+
- 清理结果区分部分失败与全部失败,失败时使用失败 Toast 并给出数量。
|
|
17
|
+
- 到期倒计时每分钟刷新;条目的数据变少时页码自动收敛。
|
|
18
|
+
- 生成 `/state` 时,同一原始工作区只探测一次,而不是每个条目各探测一次。
|
|
19
|
+
- 未知大小显示为 `—`,不再显示 `0 B`。
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- 恢复、永久删除、从索引移除或显示工作区成功后,清除该行残留的旧错误提示。
|
|
24
|
+
- 跨设备复制后源目录删除失败时,HTTP 错误不再返回源路径/回收站绝对路径;错误 `details` 只暴露白名单字段(`code`、`phase`、`sessionId`、`metrics` 等)。
|
|
25
|
+
- 跨设备复制校验现在比较符号链接数量,能发现复制过程中被静默丢弃的符号链接。
|
|
26
|
+
|
|
27
|
+
### Tests
|
|
28
|
+
|
|
29
|
+
- 新增 wire 错误脱敏、`lastErrorCode` 映射、工作区探测去重、清理部分失败、行错误清除、未知大小和符号链接校验的回归测试。
|
|
30
|
+
|
|
31
|
+
## [0.6.2] - 2026-11-11
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- 客户端写操作串行化:同一时间只允许一个写请求,行级 pending 状态独立清理,程序化重复点击会被忽略。
|
|
36
|
+
- 写请求 30 秒、`/state` 15 秒硬超时;设置页卸载时取消在途请求,超时显示本地化文案。
|
|
37
|
+
- 后台刷新不再禁用行操作;`ActionMenu` 在变为禁用时自动关闭。
|
|
38
|
+
|
|
39
|
+
### Tests / CI
|
|
40
|
+
|
|
41
|
+
- 测试入口改为跨平台的 `test/run-unit.mjs`(不依赖 shell glob)。
|
|
42
|
+
- CI 增加 Windows(Node 22)矩阵,并把单元测试失败输出转成 check annotations。
|
|
43
|
+
- e2e 支持跨平台发现桌面版,Windows 上跳过依赖 POSIX 权限位的清理失败场景。
|
|
44
|
+
|
|
45
|
+
### Docs
|
|
46
|
+
|
|
47
|
+
- README 用可核对的验证矩阵替代原先无法验证的跨平台表述。
|
|
48
|
+
|
|
49
|
+
## [0.6.1] - 2026-11-11
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Host 冒烟测试改为普通 Node 可运行:索引版本断言改为读取 `INDEX_VERSION`,不再硬编码;Cordis 来自 `@deepseek-ai/cordis` devDependency;自己创建并清理临时 `DSH_HOME`。
|
|
54
|
+
|
|
55
|
+
### Performance
|
|
56
|
+
|
|
57
|
+
- 批量删除/清理改为批量提交索引:200 条目的永久删除从 400 次索引提交、约 70 MB 写入降到 2 次提交、约 0.4 MB。
|
|
58
|
+
- 启动恢复复用 reconcile 的探测结果,并对成员目录并行探测;单个条目变化时只重写它自己的 `meta.json`。
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
|
|
62
|
+
- GitHub Actions CI(单元测试、冒烟测试、覆盖率、打包内容检查)。
|
|
63
|
+
|
|
64
|
+
## [0.6.0] - 2026-11-09
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
|
|
68
|
+
- 隐藏的 subagent 子会话随父会话一起移入回收站、一起恢复;含子会话的条目显示数量徽章。
|
|
69
|
+
- 生成组合包并以 `@wangxiaocuo/dsh-session-trash` 发布。
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- **BREAKING**:索引 schema 升级为 v2(条目携带 `members`);旧版本插件无法读取 v2 索引,会进入保护模式。降级前请先清空回收站。
|
|
74
|
+
|
|
75
|
+
## [0.5.1] - 2026-11-09
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- 回收站工具栏的「永久删除全部」与二次确认;`missing` 记录只移出索引,不删除会话文件。
|
|
80
|
+
|
|
81
|
+
[0.6.3]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.2...v0.6.3
|
|
82
|
+
[0.6.2]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.1...v0.6.2
|
|
83
|
+
[0.6.1]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.6.0...v0.6.1
|
|
84
|
+
[0.6.0]: https://github.com/wangxiaocuo/dsh-session-trash/compare/v0.5.1...v0.6.0
|
|
85
|
+
[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
|
|
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.
|
|
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
|
-
- Windows and Linux have not been
|
|
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).
|
|
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
|
|
|
@@ -180,9 +180,17 @@ pnpm test:smoke # Host smoke test (real Cordis, plain Node)
|
|
|
180
180
|
npm run test:e2e # real dsh web end-to-end (needs the desktop app)
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
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.
|
|
183
|
+
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.
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
What CI verifies:
|
|
186
|
+
|
|
187
|
+
| Check | Verified environment |
|
|
188
|
+
|---|---|
|
|
189
|
+
| Unit tests, Host smoke test | CI: Ubuntu Node 20/22, Windows Node 22 |
|
|
190
|
+
| Package contents (`npm pack`) | CI: Ubuntu |
|
|
191
|
+
| Real `dsh web` end to end | macOS + DSH 0.2.2-rc.1 (run manually) |
|
|
192
|
+
|
|
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.
|
|
186
194
|
|
|
187
195
|
Project layout:
|
|
188
196
|
|
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
|
-
|
|
9
|
+
当前状态:功能已实现。CI(GitHub Actions)在 Ubuntu(Node 20/22)和 Windows(Node 22)上跑单元测试与 Host 冒烟测试;macOS 已在真实 DSH Host 上跑通端到端测试。Windows 和 Linux 的真实 DSH Host 尚未手动验证;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
|
|
169
|
+
- Windows 和 Linux 的真实 DSH Host 尚未手动验证;CI 只覆盖单元测试和 Host 冒烟测试。Windows 上依赖 POSIX 权限位的用例会跳过;超过 260 字符的长路径和符号链接复制受系统设置影响,对应用例在不支持时自动跳过。
|
|
170
170
|
- macOS 的路径比较按大小写不敏感处理。在大小写敏感的 APFS 卷上,仅大小写不同的两个路径会被视为同一位置。
|
|
171
171
|
- 多个 DSH 进程共享同一个 `DSH_HOME` 时,回收站操作通过 `.lock` 串行;进程暂停超过 10 分钟后,锁可能被另一个进程接管。
|
|
172
172
|
|
|
@@ -179,9 +179,17 @@ pnpm test:smoke # Host 冒烟测试(真实 Cordis,普通 Node 即可)
|
|
|
179
179
|
npm run test:e2e # 真实 dsh web 端到端(需要本机桌面版)
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
Host 冒烟测试通过 `@deepseek-ai/cordis` 这个 devDependency 装配真实插件上下文,自己创建并清理临时 `DSH_HOME`,不需要桌面版;设置 `DSH_SMOKE_KEEP=1`
|
|
182
|
+
Host 冒烟测试通过 `@deepseek-ai/cordis` 这个 devDependency 装配真实插件上下文,自己创建并清理临时 `DSH_HOME`,不需要桌面版;设置 `DSH_SMOKE_KEEP=1` 可以保留临时目录用于排查。`pnpm test` 通过 `test/run-unit.mjs` 枚举测试文件,不依赖 shell 展开 glob,Windows 和 POSIX shell 行为一致。
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
验证范围:
|
|
185
|
+
|
|
186
|
+
| 检查 | 已验证环境 |
|
|
187
|
+
|---|---|
|
|
188
|
+
| 单元测试、Host 冒烟测试 | CI:Ubuntu Node 20/22、Windows Node 22 |
|
|
189
|
+
| 打包内容(`npm pack`) | CI:Ubuntu |
|
|
190
|
+
| 真实 `dsh web` 端到端 | macOS + DSH 0.2.2-rc.1(手动执行) |
|
|
191
|
+
|
|
192
|
+
`npm run test:e2e` 会启动真实 `dsh web` Host,在临时 `DSH_HOME` 中跑完整流程。脚本会按平台在常见安装位置查找桌面版,也可以用 `DSH_ELECTRON` 指向其他 Electron 可执行文件;找不到桌面版时打印跳过信息并以 0 退出。依赖 POSIX 权限位的「清理失败」场景在 Windows 上会跳过。设置 `DSH_E2E_KEEP=1` 可以保留临时目录和日志。
|
|
185
193
|
|
|
186
194
|
项目结构:
|
|
187
195
|
|