dsh-recall-plugin 1.5.1 → 1.6.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 +37 -0
- package/README.en.md +15 -4
- package/README.md +10 -5
- package/cordis.patch.yml +1 -0
- package/lib/client.js +367 -52
- package/lib/config.js +29 -10
- package/lib/index.js +215 -12
- package/lib/maintenance.js +33 -8
- package/lib/scripts.posix.js +6 -1
- package/lib/scripts.pwsh.js +6 -1
- package/lib/snapshots.js +216 -214
- package/lib/store.js +47 -5
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
本文件格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循语义化版本。
|
|
4
4
|
|
|
5
|
+
## [1.6.1] - 2026-08-23
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- 快照管理新增带二次确认的「全部删除」按钮:一次清理所有工作区的快照([PR #5](https://github.com/limbo947/dsh-recall-plugin/pull/5),@CangWeiohh 贡献)。
|
|
10
|
+
|
|
11
|
+
### 修复
|
|
12
|
+
|
|
13
|
+
- 默认基础排除表补上 `dsh-recall-snapshots/`(home 存储目录名,无前导点):工作区 root 恰为 HOME 时(如容器内 root=/root),home 存储落入工作区且不被旧默认 `.dsh-recall-snapshots/` 匹配,`git add -A` 把影子仓库自己吞进去导致快照全部失败、撤回按钮永不出现([#6](https://github.com/limbo947/dsh-recall-plugin/issues/6))。排除表在下一次快照/回退时重同步并清理已误跟踪条目,存量坏索引自愈;曾在设置卡片改过基础排除表的用户需手动补一行 `dsh-recall-snapshots/`。
|
|
14
|
+
- 全部删除直接枚举每个影子仓库的真实 `snap-*` git tag,而非仅依赖可能丢失或过期的 `index.json`;tag 每 100 个分批删除并回读校验,确认成功后才清空索引。即使 `index.json` 为空、`root.txt` 缺失或列表未显示残留快照,仍可清理。
|
|
15
|
+
- 仅创建但未初始化 git 的空 store 视为无快照,不会阻断其他 store 的全部删除;任一 store 删除失败会保留其索引并在页面显示可重试错误。
|
|
16
|
+
|
|
17
|
+
## [1.6.0] - 2026-08-22
|
|
18
|
+
|
|
19
|
+
### 新增
|
|
20
|
+
|
|
21
|
+
- 撤回后自动把被撤回的消息文本回填到输入框(方案取自 [#4](https://github.com/limbo947/dsh-recall-plugin/pull/4),按主干结构重写):走官方 `conversation` 服务的 `input.shell(id).actions.setDraft`(与输入框自身同一写入通道,draft 镜像同步),对话回退成功时填入新会话、回退失败时填入当前会话;8 次 × 150ms 有界重试覆盖 fork+open 后 shell 就绪竞态,拿不到服务时静默跳过。新增配置开关 `refillDraft`(默认开)。
|
|
22
|
+
- 设置入口迁入官方「插件配置」分区([#2](https://github.com/limbo947/dsh-recall-plugin/issues/2)):改用 `settings.plugin.item` keyed slot(按 namespace `dsh-recall` 分发),Host 端经官方 `installSettingsSection` 注册真 schema 的 settings namespace——`settings.describe` 命中后卡片出现。卡片内含插件配置表单(保存经 `dsh-settings` 持久化进用户层、watch 链路热生效无需重启)+ 排除配置编辑(折叠)+ 快照管理(折叠)。原「撤回设置」独立标签页移除。
|
|
23
|
+
- 导出 Schemastery `Config` schema(官方「插件配置」文档要求):cordis 加载时校验入口配置并填充默认值,非法配置在插件加载时响亮失败;同时作为 settings namespace 的注册 schema,一式两用。
|
|
24
|
+
- 设置卡片「插件配置」表单:gc 触发条数/小时、文件大小上限、基础排除表、回填开关五个字段;显示「已覆盖」(用户层覆盖)与「环境变量锁定」(`DSH_RECALL_GC_SNAPS/GC_HOURS` 仍最高优先)标记;只提交修改过的字段,避免全量覆盖污染用户层。
|
|
25
|
+
|
|
26
|
+
### 变更
|
|
27
|
+
|
|
28
|
+
- 设置卡片默认收起、点卡片头展开,视觉规格对齐官方 PluginCard(bg-layer 底色、展开态边框/背景变化、标题 15px/600、内容区上边框分隔、箭头 14px 居右)。
|
|
29
|
+
- 快照管理的磁盘占用与「立即 gc」全局化:设置卡片无会话上下文,`usage` 汇总全部已知 store、`gc` 逐 store 执行(新增 `maintenance.runGcAll`);带 sessionId 的旧调用语义保持不变。
|
|
30
|
+
- 配置热更新贯通:`gcSnaps/gcHours/maxFileBytes/baseExcludes` 改为调用时读取(原工厂创建时快照),settings 卡片保存后下一次快照/gc 即按新值执行,无需重启。
|
|
31
|
+
- `package.json` 新增 peerDependencies:`@deepseek-ai/dsh-settings`、`@deepseek-ai/schemastery`。
|
|
32
|
+
|
|
33
|
+
## [1.5.2] - 2026-08-22
|
|
34
|
+
|
|
35
|
+
### 修复
|
|
36
|
+
|
|
37
|
+
- 撤回按钮不自动出现、需手动刷新([#3](https://github.com/limbo947/dsh-recall-plugin/issues/3),修复方案取自 [#4](https://github.com/limbo947/dsh-recall-plugin/pull/4) 并按主干结构重写):两处根因分别修复——
|
|
38
|
+
- 快照捕获是异步的,客户端在消息节点挂载时只查一次 `snapshot-info`,先于捕获完成返回 `has:false` 则永不重试。改为有界轮询:近 5 分钟内的新消息最多 20 次 × 1s,`has:true` 即渲染按钮,捕获完成后自动出现;老消息不再空转请求。
|
|
39
|
+
- 冷会话(未 live)根目录解析错误:`resolveRoot` 只认 live 注册表,冷启动时回退 `sandboxPolicy.workspaceRoot`(常为 harness 启动目录)导致查错 store,且错误根被永久缓存。改为先经 `sessionQuery.listSessions` 从持久化 header 解析真实 cwd;只有 live/持久化来源的权威结果才进缓存,回退的临时根不缓存。
|
|
40
|
+
- 启动预热读冷会话元数据时会话 id 误取 `record.id`(`listSessions` 记录的 id 在 `header.id`,顶层恒 undefined):预热重建的孤儿快照 sessionId 记为空,树形管理里落入「已删除会话」节点。改读 `record.header.id`。
|
|
41
|
+
|
|
5
42
|
## [1.5.1] - 2026-08-18
|
|
6
43
|
|
|
7
44
|
### 修复
|
package/README.en.md
CHANGED
|
@@ -23,12 +23,17 @@
|
|
|
23
23
|
| --- | --- |
|
|
24
24
|
|  |  |
|
|
25
25
|
|
|
26
|
-
-
|
|
26
|
+
- After a recall, the message text is auto-refilled into the input box for quick editing and resending (can be disabled in the settings card)
|
|
27
|
+
- Settings · plugin config card (thresholds / exclusions / snapshot manager, saved changes apply live)
|
|
27
28
|
|
|
28
29
|
| Settings | Settings |
|
|
29
30
|
| --- | --- |
|
|
30
31
|
|  |  |
|
|
31
32
|
|
|
33
|
+
- Settings page · Snapshot Manager (tree: workspace → session → snapshot, leaves show message content)
|
|
34
|
+
|
|
35
|
+
> Tree-view snapshot manager screenshot to be added later (the feature is already implemented in the current version).
|
|
36
|
+
|
|
32
37
|
## Highlights
|
|
33
38
|
|
|
34
39
|
- **Files + conversation, rolled back together**: recalling isn't just about chat history — files the agent modified go back to their original state too.
|
|
@@ -37,7 +42,8 @@
|
|
|
37
42
|
- **Change your mind as many times as you like**: as long as the session still exists (including archived ones), snapshots are fully retained and never pruned. After one recall you can recall again to an even earlier point; files overwritten during a recall always remain recoverable. Once a session is permanently deleted, its snapshots are cleaned up accordingly (see below).
|
|
38
43
|
- **See the list before you act**: clicking recall first shows the list of files that will change (modified / restored / deleted); nothing is overwritten until you confirm.
|
|
39
44
|
- **Disk-friendly**: snapshots use git delta compression — incremental, not full-directory copies. Files larger than 100MB are skipped automatically.
|
|
40
|
-
- **Automatic housekeeping**: periodic `git gc` packs loose objects (lossless — not a single snapshot is lost); snapshots of deleted sessions are cleaned up automatically; build artifacts can be excluded globally via `exclude.txt` (see below).
|
|
45
|
+
- **Automatic housekeeping**: periodic `git gc` packs loose objects (lossless — not a single snapshot is lost); snapshots of deleted sessions are cleaned up automatically; build artifacts can be excluded globally via `exclude.txt` (see below).
|
|
46
|
+
- **Tree-view snapshot manager**: the "Snapshot Manager" on the settings page shows a **workspace → session → snapshot** three-level tree with expand/collapse support; each level has a delete button on its right, so you can clear all snapshots of a workspace or a session at once. Leaves show a summary of the message content the snapshot corresponds to, making it easy to locate "what this message changed back then".
|
|
41
47
|
|
|
42
48
|
## Known Limitations
|
|
43
49
|
|
|
@@ -81,7 +87,7 @@ Snapshots are fully retained as long as "the session might still be recoverable"
|
|
|
81
87
|
|
|
82
88
|
- **Periodic gc**: every 50 snapshots or 24 hours since the last gc (whichever comes first), `git gc` runs in the background to pack loose objects. This is lossless — every snapshot remains recallable. The throttle token lives in `gc.stamp` inside the shadow repository, so restarting DSH does not reset the cycle. Both thresholds can be overridden via environment variables (rarely needed): `DSH_RECALL_GC_SNAPS`, `DSH_RECALL_GC_HOURS`.
|
|
83
89
|
- **Session-deletion cleanup**: once a session is permanently deleted (its log gone from disk), the next maintenance pass automatically removes all of its snapshots and frees the space. **Archiving is not deletion** — logs of sessions archived by the recall feature itself still exist, so their snapshots are kept and recoverable from the archive. The check is conservative: a session that is merely cold (not in memory) is never cleaned, and when the log's state cannot be verified, it is left alone.
|
|
84
|
-
- **User-defined exclusions**: open "**Settings → Plugins → Recall
|
|
90
|
+
- **User-defined exclusions**: open "**Settings → Plugins → Recall Plugin** card (collapsed by default; click the header to expand)" to edit snapshot exclusions visually — type a path or pattern and press Enter to add it, one-click append for common patterns (`dist/`, `*.log`, `.env`, …), and saved changes take effect on the very next snapshot/recall, no restart needed. Alternatively, edit `dsh-recall-snapshots/exclude.txt` under home directly (i.e. `$DSH_HOME/dsh-recall-snapshots/exclude.txt`, or `~/.dsh/dsh-recall-snapshots/exclude.txt` when unset; UTF-8; one gitignore-style pattern per line; lines starting with `#` are comments) — both paths edit the same configuration, for example:
|
|
85
91
|
|
|
86
92
|
```gitignore
|
|
87
93
|
# keep build artifacts out of snapshots
|
|
@@ -90,7 +96,8 @@ Snapshots are fully retained as long as "the session might still be recoverable"
|
|
|
90
96
|
*.log
|
|
91
97
|
```
|
|
92
98
|
|
|
93
|
-
This applies to all projects (when home is unwritable and a workspace falls back to in-project storage, it gets its own independent exclusion config, listed as a separate card in the settings tab). New exclusions only affect future snapshots; **when recalling to an earlier snapshot, files that weren't excluded at that time are still restored** (returning to the state as it was — that's exactly what recall means). To fully purge a directory that already made it into snapshots, manually delete the corresponding hash directory under `dsh-recall-snapshots/` in home. The settings
|
|
99
|
+
This applies to all projects (when home is unwritable and a workspace falls back to in-project storage, it gets its own independent exclusion config, listed as a separate card in the settings tab). New exclusions only affect future snapshots; **when recalling to an earlier snapshot, files that weren't excluded at that time are still restored** (returning to the state as it was — that's exactly what recall means). To fully purge a directory that already made it into snapshots, manually delete the corresponding hash directory under `dsh-recall-snapshots/` in home. The settings card requires DSH's built-in settings page (all 0.1.0-rc.x releases have it); on very old versions without the tab, editing the file directly is equivalent.
|
|
100
|
+
- **Tree-view snapshot manager**: open "**Settings → Plugins → Recall Plugin → Snapshot Manager**" to see the tree list — first level workspace (folder name), second level session (session title), third level snapshot (time + message content summary, hover to see the full content). Workspace and session nodes support expand/collapse; every level has a delete button on its right, with an inline confirmation before deletion. Deleting a workspace = clearing all snapshots of that workspace; deleting a session = clearing all snapshots of that session within that workspace; deleting a leaf = removing just that single snapshot.
|
|
94
101
|
|
|
95
102
|
## How It Works
|
|
96
103
|
|
|
@@ -122,3 +129,7 @@ Copy-Item -Recurse -Force $pkg "$profile\node_modules\dsh-recall-plugin"
|
|
|
122
129
|
## License
|
|
123
130
|
|
|
124
131
|
MIT
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
[Changelog](CHANGELOG.md)
|
package/README.md
CHANGED
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
| --- | --- |
|
|
24
24
|
|  |  |
|
|
25
25
|
|
|
26
|
-
-
|
|
26
|
+
- 撤回后自动把消息文本回填到输入框,方便修改后重发(可在设置卡片关闭)
|
|
27
|
+
- 设置页 · 插件配置卡片(阈值 / 排除表 / 快照管理,保存即热生效)
|
|
27
28
|
|
|
28
29
|

|
|
29
30
|
|
|
@@ -80,9 +81,9 @@ pm2 restart <你的dsh进程名> # 若用 pm2 托管
|
|
|
80
81
|
|
|
81
82
|
快照全量保留的前提是「会话还有找回的可能」,在此之上插件自动控制磁盘占用,无需手动管理:
|
|
82
83
|
|
|
83
|
-
- **定期 gc**:每 50 条快照或距上次 gc 24 小时(先到先触发),后台执行 `git gc` 把 loose 对象压成 pack。无损操作——所有快照照常可回退。节流凭据写在影子仓库内的 `gc.stamp`,重启 DSH
|
|
84
|
+
- **定期 gc**:每 50 条快照或距上次 gc 24 小时(先到先触发),后台执行 `git gc` 把 loose 对象压成 pack。无损操作——所有快照照常可回退。节流凭据写在影子仓库内的 `gc.stamp`,重启 DSH 不会重置周期。两个阈值可在「插件配置」的撤回插件卡片里直接改(保存即热生效,无需重启),也可用环境变量强制覆盖:`DSH_RECALL_GC_SNAPS`、`DSH_RECALL_GC_HOURS`。
|
|
84
85
|
- **会话删除联动清理**:会话被彻底删除(会话日志从磁盘消失)后,下一次维护会自动删除该会话的全部快照并释放空间。**归档不算删除**——撤回功能自己归档的原会话日志仍在,快照保留、随时可从归档找回。判断很保守:会话只是冷着(不内存里)不会误清;无法核实日志状态时宁可不清。
|
|
85
|
-
- **用户自定义排除**:打开「**设置 →
|
|
86
|
+
- **用户自定义排除**:打开「**设置 → 插件配置 → 撤回插件**」卡片(默认收起,点卡片头展开)即可可视化编辑快照排除项——输入路径或模式回车即加、常用模式(`dist/`、`*.log`、`.env` 等)一键追加、保存后下一次快照/回退立即生效,无需重启。也可以直接编辑 home 下 `dsh-recall-snapshots/exclude.txt`(即 `$DSH_HOME/dsh-recall-snapshots/exclude.txt`,未设置时为 `~/.dsh/dsh-recall-snapshots/exclude.txt`;UTF-8),一行一条 gitignore 风格 pattern(`#` 开头为注释),两种方式编辑的是同一份配置,例如:
|
|
86
87
|
|
|
87
88
|
```gitignore
|
|
88
89
|
# 构建产物不进快照
|
|
@@ -91,8 +92,8 @@ pm2 restart <你的dsh进程名> # 若用 pm2 托管
|
|
|
91
92
|
*.log
|
|
92
93
|
```
|
|
93
94
|
|
|
94
|
-
对所有项目生效(home 不可写而降级到项目内存储时,该工作区有独立的排除配置,设置页会分卡片列出)。新增排除只影响之后的快照;**回退到更早的快照时,当时尚未排除的文件仍会被恢复**(回到当时的状态,这正是回退语义)。想彻底清掉已进快照的目录,可手动删除 home 下 `dsh-recall-snapshots/`
|
|
95
|
-
- **树形快照管理**:打开「**设置 →
|
|
95
|
+
对所有项目生效(home 不可写而降级到项目内存储时,该工作区有独立的排除配置,设置页会分卡片列出)。新增排除只影响之后的快照;**回退到更早的快照时,当时尚未排除的文件仍会被恢复**(回到当时的状态,这正是回退语义)。想彻底清掉已进快照的目录,可手动删除 home 下 `dsh-recall-snapshots/` 里对应项目的哈希目录。设置卡片依赖 DSH 自带设置页(0.1.0-rc.x 均含);极旧版本看不到卡片时,直接编辑文件等效。
|
|
96
|
+
- **树形快照管理**:打开「**设置 → 插件配置 → 撤回插件 → 快照管理**」可看到树形列表——第一级工作区(文件夹名)、第二级会话(会话标题)、第三级快照(时间 + 消息内容摘要,悬停看完整内容)。工作区和会话节点可展开/折叠;每一级右侧都有删除按钮,删除前会二次确认。删除工作区 = 清掉该工作区全部快照;删除会话 = 清掉该工作区内该会话的全部快照;删除叶子 = 只删那一条快照。
|
|
96
97
|
|
|
97
98
|
## 工作原理
|
|
98
99
|
|
|
@@ -124,3 +125,7 @@ Copy-Item -Recurse -Force $pkg "$profile\node_modules\dsh-recall-plugin"
|
|
|
124
125
|
## License
|
|
125
126
|
|
|
126
127
|
MIT
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
[更新日志](CHANGELOG.md)
|
package/cordis.patch.yml
CHANGED