Zum Hauptinhalt springen
S

dsh-conversation-purge

seastar101/dsh-conversation-purge

Permanently delete one conversation (archived or not) from its sidebar row menu, including its log, projection cache, archive state, and reminders.

Installation

dsh plugin --profile web add github:seastar101/dsh-conversation-purge

README

dsh-conversation-purge

Permanently delete one conversation at a time — archived or not — straight from its sidebar row menu in DeepSeek Harness.

DeepSeek Harness (DSH) can archive a session but never delete one: the JSONL backend keeps every log on disk forever. This plugin adds the missing operation to the row's ⋯ menu, behind a confirmation dialog that names the conversation, shows whether it is archived, its log size, and how many subagent sessions it spawned.

在 DSH 侧栏会话行的 ⋯ 菜单里增加「彻底删除对话」:带二次确认,删除该对话的会话日志、投影缓存、归档/置顶状态、所属工作区记录和绑定提醒;运行中的对话会被拒绝。

Install

DSH 0.2.1 or newer (verified on 0.2.1-rc.2), Node ^22.19.0 || >=24.

# npm
dsh plugin --profile <profile> add dsh-conversation-purge

# GitHub
dsh plugin --profile <profile> add github:Seastar101/dsh-conversation-purge

Or in the Web UI: Settings → Plugins → Install and enter the package name. Restart dsh web (or the desktop app), then reload the page. The Host half and the browser half activate together.

Use

  1. Hover a conversation row in the sidebar and open its ⋯ menu.
  2. Choose 彻底删除对话 / Delete permanently (last row, separated).
  3. In the dialog, review the target and tick I understand this cannot be undone.
  4. Press 彻底删除 / Delete permanently.

The row disappears immediately (the Host emits DSH's own api-session/removed notification); if the deleted conversation is the one open in the main panel, its composer becomes read-only.

What gets deleted

  • The append-only session log directory under the configured session root — every retained format generation and the write-lock file.
  • The persisted projection checkpoint (<storage-root>/session_projcache/sessions/<id>.json and its .bak.* files).
  • The session's archive entry, pin, and its membership/order slot in every Workspace.
  • Every reminder bound to it.
  • Every subagent session descended from it (origin: subagent lineage). A fork is an independent conversation and is deliberately kept.

What is deliberately left alone

  • Shared attachment bytes. Image/file attachments are content-addressed and deduplicated across conversations; deleting them could break another conversation.
  • Backups and telemetry outside $DSH_HOME.
  • A durable full-text search index. The shipped profile opens the SQLite session query store as :memory: / openAt: never, so there is nothing persistent to clean; if a profile enables durable content search, stale hits fail to resolve and are dropped on rebuild.

Behavior and limits

  • Running conversations are refused (error.running). Stop the turn first.
  • Idle but loaded conversations are safe. The JSONL backend keeps no open log descriptor between batches, so the directory removes normally; later appends fail with ENOENT instead of recreating a header-less log.
  • Filesystem fallback. If the directory cannot be removed, the log files are truncated to zero bytes and the directory is recorded in <session-root>/.session-purge-pending.json; the Host retries the removal once at the next start, before anything can resume the session.
  • User-only. Deletion is irreversible and authority-adjacent, so this package registers no agent tool. There is no bulk delete either: the operation always names one conversation.
  • Root discovery. The session and storage roots come from the mounted backend (sessionPersistence.root), then the profile's configEditor values, then $DSH_HOME (~/.dsh) defaults. No configuration is required.

Composability

Requires connection and sessionPersistence. Workspace accounting, reminders, the running-work check, and the projection cache degrade gracefully when their owning plugins are not composed.

The UI goes through two shipped slots — sidebar.workspaces.session.menu.item and shell.overlay — and uses only theme tokens, so it follows the host's light/dark themes and locale. Dictionaries ship for English and Simplified Chinese.

Development

npm test
  • index.js — plugin entry: the two authenticated exact-fetch routes (/api/session-purge/inspect, /api/session-purge/delete) on the connection.fetch channel.
  • lib/purge.js — root discovery, path encoding (~XXXX, mirroring the JSONL backend), lineage collection, workspace/reminder cleanup, directory removal with truncation fallback, pending queue.
  • client.js — the ⋯ menu row, the confirmation dialog, the stylesheet, and the locale dictionaries.

License

MIT.

Ähnliche Plugins