Qintsg/dsh-safe-delete ↗★ 1

dsh-safe-delete

将文件移至回收站而非永久删除的安全删除插件 适合需要防止Agent误删文件,提供可恢复的暂存区与安全审计机制的用户。

包名
dsh-safe-delete
兼容性
待验证
Harness 依赖范围
>=0.1.0-rc.6 <0.2.0
Cordis 依赖范围
^4.0.1
版本
0.2.1
许可证
Apache-2.0
最近更新
2026年8月18日

同名包的其他仓库

安装

此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗

Usage

The plugin registers four agent tools:

ToolDescription
safe_deleteMove paths into the trash (restorable). recursive: true for directories; permanent: true to delete irreversibly (requires approval).
trash_listList trash entries, optionally filtered by pattern (*.tmp).
restoreRestore entries by ids or pattern back to their original paths. onConflict: rename (default) / skip / overwrite.
purgePermanently delete trash entries (ids or all: true) — always requires approval.

A system-prompt section guides the model to prefer safe_delete over rm / Remove-Item.

Escape hatch

When deleteHijack: block intercepts a delete command, the model can still delete permanently on purpose:


## Configuration

All options are editable live in **DSH Web → Settings → Plugins → Safe Delete** (card is localized to the DSH language).

| Option | Type | Default | Description |
|---|---|---|---|
| `trashDir` | string | `''` (workspace `.dsh-trash`, or `$DSH_HOME/.dsh-safe-delete-trash` without a workspace) | Trash root; must be an absolute path when set. |
| `retentionDays` | number | `30` | Auto-expire entries older than this; `0` disables. |
| `maxSizeBytes` | number | `5368709120` (5 GiB) | Trash size cap; deletions whose target exceeds it trigger the capacity guard (approval/block by permission); `0` disables. |
| `confirmThreshold` | number | `10` | Batch deletions at/above this count require approval; `0` always confirms. |
| `restoreConflict` | enum | `rename` | Default restore conflict strategy: `rename` / `skip` / `overwrite`. |
| `deleteHijack` | enum | `block` | Hijack delete commands in bash/pwsh: `block` / `ask` / `off` (`ssh`/`scp` remote commands always allowed). |
| `interceptFsDelete` | boolean | `false` | Reserved: intercept future `ctx.fs` delete methods. |