dsh-session-cleanup
其他 活跃维护

dsh-session-cleanup

hyein-cbio/dsh-session-cleanup

自动清理会话数据,退出时强制删除敏感痕迹与临时文件,支持自定义保留白名单,通过安全退出机制彻底消除残留,确保无信息泄露风险,操作简单流畅

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
459 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:hyein-cbio/dsh-session-cleanup
git clone https://github.com/hyein-cbio/dsh-session-cleanup.git
git clone git@github.com:hyein-cbio/dsh-session-cleanup.git
README.md main
# dsh-session-cleanup `/nix` for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), requiring [**dsh-TUI**](https://github.com/ccch1mneyyy/dsh-TUI) by ccch1mneyyy. [![npm](https://img.shields.io/npm/v/dsh-session-cleanup.svg)](https://www.npmjs.com/package/dsh-session-cleanup) [![GitHub release](https://img.shields.io/github/v/release/hyein-cbio/dsh-session-cleanup.svg)](https://github.com/hyein-cbio/dsh-session-cleanup/releases/latest) Inspired by [pi-session-cleanup](https://github.com/MasuRii/pi-session-cleanup).

Latest DSH release is 0.2.1 on npm and GitHub. See CHANGELOG.md.

What this is

A DSH plugin for ccch1mneyyy/dsh-TUI only, using its DSH backend. It does not list sessions and it does not replace /resume.

Runtime requirement: the third-party @deepseek-harness-tui/dsh-tui package must be installed in the dsh-tui profile. This plugin relies on its TUI services and live session switch; official DeepSeek Harness alone is not sufficient.

pi-tui, the web profile, and dsh-TUI's Claude/Codex backends are not supported.

On DSH it:

  • /nix — deletes the current session, starts a new one, and switches the live view to it
  • /nix quit — deletes the current session and exits DSH

Deletion is the whole session directory under ~/.dsh/sessions/<workspace>/ (session-<uuid> or <uuid>), including its session.vN.jsonl.zstd log and session.lock. There is no separate sidecar. After dsh-tui has switched away, the previous session is stopped/flushed/detached, the directory goes to Trash on macOS (rm -rf elsewhere), then projection cache and workspace accounting are cleared, including that session's entries in archivedSessionIds and pinnedSessionIds.

dsh-tui's /new and /resume delete keep the previous log. /nix is the destructive counterpart.

Installation

First install DeepSeek Harness and dsh-TUI following dsh-TUI's setup instructions. This package does not install dsh-TUI automatically.

Ensure the required TUI package is installed in the same profile, then add this plugin:

dsh plugin --profile dsh-tui add @deepseek-harness-tui/dsh-tui
dsh plugin --profile dsh-tui add dsh-session-cleanup

From this repo:

npm run build
dsh plugin --profile dsh-tui add file:$PWD

Restart the profile. Confirm it loaded:

dsh --profile dsh-tui --dump-config | grep session-cleanup
dsh --profile dsh-tui

Commands

Command Arguments Description
/nix — Delete the current session, start a new one, switch the live view
/nix quit — Delete the current session and exit DSH
/nix help — Usage

Both destructive commands ask for confirmation when userQuestions is mounted (dsh-tui does).

/nix needs dsh-tui's scene switch (channel.newSession()). On any other profile it refuses rather than leaving you on a deleted conversation. Use /nix quit to delete and exit.

Safety

  1. Confirm before delete
  2. Switch first — /nix starts and adopts the new session before the old directory is removed
  3. macOS Trash for session directories; other platforms permanently remove them
  4. Cleanup order — disk/log removal is confirmed before workspace accounting is stripped
  5. Both id spellings — <uuid> and session-<uuid>

Development

npm run build    # emit lib/dsh-entry.js for DSH
npm run test     # test suite
npm run check    # build + test

Upstream compatibility records live in TESTING.md. Harness 0.2.1-rc.3 with dsh-TUI v0.17.0 is verified on Linux only. Harness dsh-v0.2.2-alpha.2 with dsh-TUI v0.17.0 is not supported.

Native DSH entry: dsh-entry.ts → lib/dsh-entry.js.

Attribution

The /nix idea comes from pi-session-cleanup (MIT © MasuRii). The DSH port uses DeepSeek Harness persistence and workspace accounting, and depends on ccch1mneyyy/dsh-TUI for the TUI services and live session switch.

License

MIT