dsh-session-remover 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.en.md +65 -0
- package/README.md +64 -2
- package/cordis.patch.yml +4 -0
- package/lib/client.js +1017 -0
- package/lib/index.js +700 -0
- package/package.json +75 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sailoumili
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# dsh-session-remover
|
|
2
|
+
|
|
3
|
+
Adds "Delete conversation" and "Batch delete…" to the sidebar session row "…" menu, moving a conversation and its subagent sessions into the Windows recycle bin, from which they can be restored.
|
|
4
|
+
|
|
5
|
+
- Package: `dsh-session-remover`
|
|
6
|
+
- Repository: <https://github.com/sailoumili/dsh-session-remover>
|
|
7
|
+
- Compatible with DSH 0.1.7 and later; available for the web and desktop editions
|
|
8
|
+
- Interface text follows the DSH interface language; Chinese and English are both provided
|
|
9
|
+
- Windows only; no third-party runtime dependencies
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
### Web
|
|
14
|
+
|
|
15
|
+
1. Click **Plugins** in the left sidebar.
|
|
16
|
+
2. Click **Add plugin**.
|
|
17
|
+
3. Enter `dsh-session-remover` in the package field, click **Install**, and wait for the installation to complete.
|
|
18
|
+
4. Enable the plugin on its page.
|
|
19
|
+
5. Restart DSH.
|
|
20
|
+
|
|
21
|
+
Equivalent command line:
|
|
22
|
+
|
|
23
|
+
```cmd
|
|
24
|
+
dsh plugin --profile web add dsh-session-remover
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Desktop
|
|
28
|
+
|
|
29
|
+
The desktop edition uses a separate plugin manifest (`~/.dsh/profiles/desktop`) and is independent of the web edition, so it requires a separate installation. The steps are identical: sidebar **Plugins** → **Add plugin** → enter the package name → **Install** → enable → restart.
|
|
30
|
+
|
|
31
|
+
```cmd
|
|
32
|
+
dsh plugin --profile desktop add dsh-session-remover
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
1. Move the pointer over any sidebar session row and click the "…" at the end of the row.
|
|
38
|
+
2. The last two menu items are "Delete conversation" and "Batch delete…".
|
|
39
|
+
3. Single delete: click "Delete conversation", click **OK** in the confirmation dialog; the page reloads automatically and the row disappears.
|
|
40
|
+
4. Batch delete: click "Batch delete…", tick the target conversations in the panel (select all / select none are available), tick the acknowledgement, click the delete button, and confirm once more; deletion then proceeds row by row.
|
|
41
|
+
5. Leaving batch delete: "Cancel", "Close", clicking outside the panel, or pressing `Esc` all work. While a deletion is in progress, closing is not honoured until it finishes.
|
|
42
|
+
6. Restore: open the recycle bin in File Explorer, right-click the session folder, choose Restore, then restart DSH.
|
|
43
|
+
|
|
44
|
+
## Notes
|
|
45
|
+
|
|
46
|
+
- **Deletion moves the data to the recycle bin; it does not erase it.** The move stays on the same volume, so no data is copied and nothing is left behind in `.dsh`. Before deleting, the plugin checks two things on the volume that holds the session (Windows stores the recycle-bin setting per drive): whether the recycle bin has been disabled, and whether the volume has a usable recycle bin at all; if either check fails the plugin **refuses to delete** rather than falling back to permanent deletion. Afterwards each item is verified by original location and name; the verification reads the local recycle bin index directly (listing file names only, not reading each entry), so its cost is essentially independent of how many items the bin already holds.
|
|
47
|
+
- **Subagent sessions are removed together.** Subagent sessions are not shown in the sidebar or search, so they accumulate unless removed together. Forked conversations are independent and are **never** deleted along with their source.
|
|
48
|
+
- **Three records are cleaned:** the projection cache, the workspace registry, and the archived set. The projection cache is derived data that DSH rebuilds after a restore; the other two are cleared to avoid leaving traces locally, at the cost of a restored conversation being filed under "Ungrouped" in the sidebar.
|
|
49
|
+
- **Deleting the currently open conversation is supported.** Its running task is stopped and flushed to disk first, and no DSH restart is required.
|
|
50
|
+
|
|
51
|
+
## Known limitations
|
|
52
|
+
|
|
53
|
+
- **Windows only.** Moving to the recycle bin relies on the system script host `cscript.exe`, which ships with Windows; on other systems the plugin refuses to delete and reports an error rather than falling back to permanent deletion.
|
|
54
|
+
- **Deletion is refused when the volume has no recycle bin.** If the session directory sits on a network drive, a USB stick, or a volume with no usable recycle bin (such as FAT/exFAT), moving it to the recycle bin would degrade into permanent deletion, so the plugin always refuses. To proceed, move the session directory to a local disk, or delete any file on that volume once to initialise its recycle bin, and try again.
|
|
55
|
+
- **An emptied recycle bin cannot be restored.** The plugin only moves the files into the bin; whether to empty it is the user's decision. The bin also has a size cap, and Windows discards the oldest entries once the quota is exceeded.
|
|
56
|
+
- **A restored conversation may not be in its original workspace.** The plugin clears the workspace registry entry, so a restored conversation appears under "Ungrouped". To restore it to its original workspace, edit `~/.dsh/storages/workspace.json` by hand while DSH is stopped.
|
|
57
|
+
- **Attachments are not reclaimed.** DSH attachments are content-addressed, shared across conversations, and carry no reference counting, so the plugin cannot safely determine whether they can be reclaimed.
|
|
58
|
+
- **On a failed delete, the reason text returned by the server also follows the interface language**: the server returns only an error code and parameters, and the interface text is resolved by the front end in the active language.
|
|
59
|
+
- **The endpoint accepts loopback requests only.** `/api/session.delete` allows only `127.0.0.1` / `localhost` / `[::1]` and returns 403 for LAN origins. The plugin registers its route outside the official authentication fence, while the official browser-cookie check depends on a signing secret the plugin cannot obtain; deleting data is high-risk, so it fails closed. If DSH is bound to `0.0.0.0` and accessed from another machine, deletion returns 403.
|
|
60
|
+
- **Nothing is touched when the session directory cannot be read.** A failed session-tree scan aborts the deletion as a whole and never treats "read failure" as "absent from disk".
|
|
61
|
+
- The batch delete panel does not trap focus; `Tab` may move to page elements behind the panel.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-session-remover
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在侧栏会话行的「…」菜单中增加「删除对话」与「批量删除…」两项,将对话及其子代理会话移入 Windows 回收站,需要时可予以还原。
|
|
4
|
+
|
|
5
|
+
- 包名:`dsh-session-remover`
|
|
6
|
+
- 仓库:<https://github.com/sailoumili/dsh-session-remover>
|
|
7
|
+
- 兼容 DSH 0.1.7 及以上版本,适用于网页版与桌面版
|
|
8
|
+
- 界面文字随 DSH 界面语言切换,提供中文与英文两套
|
|
9
|
+
- 仅支持 Windows,无第三方运行时依赖
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
### 网页版
|
|
14
|
+
|
|
15
|
+
1. 在左侧栏单击「插件」。
|
|
16
|
+
2. 单击「添加插件」。
|
|
17
|
+
3. 在「包名或地址」输入框中填写 `dsh-session-remover`,单击「安装」,等待安装完成。
|
|
18
|
+
4. 在该插件页面中启用该插件。
|
|
19
|
+
5. 重启 DSH。
|
|
20
|
+
|
|
21
|
+
等效命令行:
|
|
22
|
+
|
|
23
|
+
```cmd
|
|
24
|
+
dsh plugin --profile web add dsh-session-remover
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 桌面版
|
|
28
|
+
|
|
29
|
+
桌面版使用独立的插件清单(`~/.dsh/profiles/desktop`),与网页版互不影响,须单独安装一次。操作步骤与网页版一致:左侧栏「插件」→「添加插件」→ 填写包名 →「安装」→ 启用 → 重启。
|
|
30
|
+
|
|
31
|
+
```cmd
|
|
32
|
+
dsh plugin --profile desktop add dsh-session-remover
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 用法
|
|
36
|
+
|
|
37
|
+
1. 将指针移至侧栏任一会话行,单击行尾的「…」。
|
|
38
|
+
2. 菜单中最后两项为「删除对话」与「批量删除…」。
|
|
39
|
+
3. 删除单条:单击「删除对话」,在确认框中单击「确定」,页面自动刷新,该行消失。
|
|
40
|
+
4. 批量删除:单击「批量删除…」,在浮层中勾选目标对话(可使用「全选 / 全不选」),勾选确认项,单击「删除选中的 N 个」,再次确认后逐条删除。
|
|
41
|
+
5. 退出批量删除:单击「取消」「关闭」、单击浮层外部区域或按 `Esc` 均可;删除进行期间不响应关闭,须待其结束。
|
|
42
|
+
6. 还原:在资源管理器中打开回收站,右键单击对应会话文件夹,选择「还原」,重启 DSH。
|
|
43
|
+
|
|
44
|
+
## 说明
|
|
45
|
+
|
|
46
|
+
- **删除为移入回收站,并非抹除**:同盘移动,不复制数据,`.dsh` 内不留副本。删除前先按会话所在磁盘核对两件事:该磁盘是否关闭了回收站(Windows 该开关按磁盘逐个设置)、该磁盘是否有可用的回收站;任一不满足即**拒绝删除**,不会退化为永久删除。移入后另按「原位置 + 名字」逐项核对,确认确实进入回收站;核对直接读取本机回收站索引(只列文件名,不逐项读取),耗时基本不受回收站已存项数影响。
|
|
47
|
+
- **一并删除子代理会话**:子代理会话不显示于侧栏与搜索,未一并清理将持续累积。由 fork 产生的分叉会话属独立对话,**不被连带删除**。
|
|
48
|
+
- **清理三处记录**:投影缓存、工作区记账、归档集合。投影缓存为派生数据,还原后由 DSH 自动重建;后两处予以清理以避免在本地留存痕迹,代价是还原后的对话归入侧栏的「未分组」。
|
|
49
|
+
- **支持删除当前打开的对话**:删除前先停止其运行中的任务并落盘,无需重启 DSH。
|
|
50
|
+
|
|
51
|
+
## 已知限制
|
|
52
|
+
|
|
53
|
+
- **仅支持 Windows**。移入回收站依赖系统脚本宿主 `cscript.exe`(Windows 自带);在其他系统上插件拒绝删除并报错,不会退化为永久删除。
|
|
54
|
+
- **所在磁盘没有回收站时拒绝删除**。会话目录若位于网络盘、U 盘或未启用回收站的磁盘(如 FAT/exFAT),移入回收站会退化为永久删除,插件一律拒绝。处理办法:先把会话目录搬到本地磁盘,或在该磁盘上删除任意一个文件以启用回收站,再重试。
|
|
55
|
+
- **回收站清空后不可还原**。插件仅负责将文件移入回收站,是否清空由用户决定;回收站存在容量上限,超出配额时 Windows 将丢弃最早的项。
|
|
56
|
+
- **还原后可能不在原工作区**。插件清除了工作区记账,还原的对话将出现在「未分组」中。如需恢复至原工作区,须在 DSH 停止运行时手工编辑 `~/.dsh/storages/workspace.json`。
|
|
57
|
+
- **附件不予回收**。DSH 附件按内容寻址、跨会话共享,且无引用计数,插件无法安全判断其可否回收。
|
|
58
|
+
- **删除失败时服务端返回的原因文本同样随界面语言切换**:服务端只回错误码与参数,界面文字统一由前端按当前语言取词。
|
|
59
|
+
- **端点仅接受本机请求**。`/api/session.delete` 仅放行回环地址(`127.0.0.1` / `localhost` / `[::1]`),局域网来源一律返回 403。本插件的路由位于官方鉴权栅栏之外,而官方基于浏览器 cookie 的鉴权依赖插件无法获取的签名密钥;删除数据属高风险操作,故从严处理。将 DSH 绑定至 `0.0.0.0` 并从其他机器访问时,删除将返回 403。
|
|
60
|
+
- **无法读取会话目录时不作任何改动**。会话树收集失败即整体放弃删除,不会将「读取失败」视为「磁盘上不存在」。
|
|
61
|
+
- 批量删除浮层不锁定焦点,按 `Tab` 键可能移至浮层后方的页面元素。
|
|
62
|
+
|
|
63
|
+
## 许可
|
|
64
|
+
|
|
65
|
+
MIT
|
package/cordis.patch.yml
ADDED