Add delete session capability to DSH Web interface: trash can button at top of session, delete item in sidebar "..." menu, Agent tool workbench_session_delete, deleting session logs, projection cache and workspace accounting.
- Language
- JavaScript
- Branch
- main
Install
$ dsh plugin --profile web add github:lsz-asd/dsh-plugin-session-deleteRun the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial
Install via your agent
Install the DeepSeek Harness plugin lsz-asd/dsh-plugin-session-delete for me: review the repository at https://github.com/lsz-asd/dsh-plugin-session-delete first, then run the install command and verify the plugin loads successfully.
Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.
One-Line Summary
Adds the missing "Delete Session" capability to the DSH Web interface: a trash can button is added to the session header, a "Delete Session" item is dynamically injected into the sidebar session row's "..." menu, and a workbench_session_delete tool is exposed for Agents; clicking triggers a risk confirmation dialog with a checkbox, and upon confirmation, the session is removed from disk logs, projection cache, and workspace accounting in sync.
Core Features
- Session header action area adds a trash can button (registered to
conversation.session.header.actionsslot, order 30), running sessions show a warning tooltip - Sidebar session row "..." menu injects "Delete Session" item (via MutationObserver monitoring DOM dynamic insertion, title exact / remove fork suffix / includes three-segment session id matching), clicking doesn't switch current session
- Shared delete dialog (root level
shell.overlay): displays session name and serial number, running warning, risk description; must check "I understand the consequences, confirm delete" to enable confirm button; Chinese/English copy follows interface language, falls back to browser language when locale service not loaded - Host exposes two HTTP routes:
GET /__chameleon/session/list(lists id / title / creation time / running status) andPOST /__chameleon/session/delete(deletes specified session) - Registers Agent tool
workbench_session_delete, parameter issessionId, returns whether log directory, projection cache row, and workspace accounting were cleared after deletion - Complete deletion chain covers three storage types: disk log directory
~/.dsh/sessions/<slug>/<id>/, projection cache domainsession_projcachesessionstable, workspace domainworkspaces.sessionIdsand globalarchivedSessionIds; flush active session before cleanup, confirm log directory disappearance before releasing workspace accounting to prevent half-deleted sessions falling into "Ungrouped"
Technical Implementation
- Language: JavaScript (ESM,
"type": "module") - Key Dependencies:
@deepseek-ai/dsh-tools(peer dependency fordefineToolregistering Agent tools),@deepseek-ai/dsh-client-runtime(client-side injection target),@deepseek-ai/dsh-client-ui-primitives(Modal,IconTrashOutline16),node:fs/node:path/node:os(host-side disk log cleanup) - Architecture: Standard DSH dual-end plugin + cordis bundle line injection.
cordis.patch.ymlfixes bundle line idchameleon-session-deletefor easy reinstall/patch-targeted updates.src/index.jsis the host half: registers tools viactx.tools.registerand exposes two routes viactx.webServer.register(withctx.inject(['webServer'])fallback branch);src/client.jsregisters factory viawindow.__ModuleLoader__.load, renders two slot components + one global delete dialog perclient-modulesprotocol usingReact.createElement, and injects menu items into sidebar viaMutationObserver - Entry Files:
src/index.js(host entryapply) +src/client.js(client entryapply, exposed viapackage.json#exports["."]and"./client")
Use Cases
When your session list in DSH Web grows too long over time and archiving isn't enough, or when editing harness causes session history to desync and you end up with "broken" sessions that can't be taken offline, this plugin gives you a clear delete entry point; if you have an Agent managing sessions in edit mode, it can also invoke workbench_session_delete tool on its own, saving you from manual cleanup.
Prerequisites & Compatibility
| Dependency | Min Version | Description |
|---|---|---|
| DSH | ^0.1.0-rc.6 | peer dependency @deepseek-ai/dsh-tools ^0.1.0-rc.6; depends on host services ctx.agents / ctx.sessions / ctx.storageDomain / ctx.webServer / ctx.tools, client services slots / sessions / locale (locale optional, falls back to browser language when missing) |
| Node | >= 20 | package.json#engines.node declaration |
| Platform | macOS / Windows / Linux | Cross-platform; client dsh.client.platform explicitly declares web, but client.js also loaded by desktop shell; host only uses fs/path/os and other built-in modules |
| Native Modules | None | host only depends on node built-ins node:fs node:path node:os, no native bindings |
Installation
dsh plugin --profile web add github:lsz-asd/dsh-plugin-session-delete
Configuration
This plugin requires no additional configuration. Delete button, dialog text, risk confirmation checkbox, HTTP route paths, and Agent tool name workbench_session_delete are all built-in plugin behaviors that take effect immediately after installation.
FAQ
Q: Do I need to restart the web profile after installation for it to take effect?
A: Yes. The host-side uses cordis bundle line injection, requiring a restart of dsh web to load new routes and tools; the client module follows the same principle—a profile restart is needed for changes to apply.
Q: Can I delete a session that's currently running?
A: Yes, but the server first calls agent.cancel({kind:'user'}) and await agent.whenIdle() (up to 15 seconds), confirming the session stops before deletion executes; the client dialog warns that this action will interrupt ongoing tasks.
Q: How was the incomplete deletion / "Ungrouped" issue resolved?
A: Since v0.3.1, both original uuid and session-<uuid> ID formats are cleaned up simultaneously; disk logs are deleted and confirmed successful before releasing workspace accounting; active sessions are flushed before deletion to prevent recreation of log directories during disposal.
Q: Why isn't the sidebar "..." menu item a native menu item?
A: In rc.6, the session-row "..." menu (rename/fork/archive) is hardcoded in ui-workspace with no extension slots available, so this plugin uses MutationObserver to monitor DOM and dynamically inject a "Delete Session" item into the menu, matching the official error color for the label.
Q: Will the "Delete Session" button work in the desktop client?
A: Yes. client.js is injected into both the web platform (dsh.client.platform: web) and loaded by the desktop shell; the session header button dispatches by sessionId, and the DOM-injected sidebar item matches by title—both share the same delete dialog.
Q: How do I uninstall?
A: Run dsh plugin --profile web remove github:lsz-asd/dsh-plugin-session-delete and restart the profile; since the cordis bundle line id is fixed as chameleon-session-delete, both reinstall and uninstall use the same line, requiring no manual cleanup.
Q: What data does deleting a session affect?
A: Deletes log directory under ~/.dsh/sessions/<slug>/<id>/, clears projection cache domain (storageDomain.session_projcache sessions table rows), removes from workspace domain workspaces.sessionIds array and global.archivedSessionIds array; client list refreshes immediately after, no manual page refresh needed.
Q: How strict is session ID validation?
A: Strict. Host only accepts IDs matching (session-)?<uuid> regex, returns 400 invalid session id otherwise; sidebar click matches via client list store exact / remove fork suffix / includes three-segment matching, falls back to /__chameleon/session/list for another lookup if missed, still not found shows "Session not found" prompt.
Difficulty
Beginner — One installation command with no configuration needed; UI appears directly in session header and sidebar menu, click to use.
Known Issues & Limitations
- Sidebar menu item uses DOM injection rather than official slot: rc.6's session-row "..." menu is hardcoded in ui-workspace, this plugin uses MutationObserver to monitor
[role=menu]element and append button to opened menu; if official future versions adjust menu structure or style, matching logic needs updating (src/client.js:447-451) - Session ID only accepts UUID format (with optional
session-prefix), custom session ID format returns 400 rejection (src/index.js:33) - Max wait time for deleting running session fixed at 15 seconds (
agent.whenIdle+setTimeout); if Agent task enters infinite loop, may timeout and fail, requiring second deletion (src/index.js:165-182) - Client defaults to
localeservice for Chinese/English copy; when profile hasn't loaded locale service, only browser language sniffing (navigator.languages), other language environments fall back to Chinese (src/client.js:170-178) - Cleanup path for deleting log directory is
process.env.DSH_HOME || ~/.dsh/sessions/; if user customizesDSH_HOMEbut client still queries default home, may mismatch with server lookup (src/index.js:44-46)
你是否困扰于 web 端无法删除对话?是否觉得归档对话键只是隐藏对话,删除得不够彻底?是否在尝试编辑 harness 时遇到对话话历史无法同步,而损坏的对话又无法删除?这个插件可以帮你!
在 DeepSeek Harness 界面里安全地彻底删除会话。 在会话顶部添加垃圾桶按钮,侧栏会话行 "..." 菜单内添加"删除会话"项,点击后出现风险确认弹窗(需勾选);确认后会删除会话日志、投影缓存与工作区记账;运行中的会话会有提示,若仍选择删除会停止运行并删除。可在web中使用,并且理论上兼容一切web套壳的客户端。
添加agent工具让agent可以删除会话。 工具名workbench_session_delete
安装
dsh plugin --profile <profile> add file:C:/path/to/dsh-plugin-session-delete
重启 profile 生效。
功能
- 会话头部垃圾桶按钮
- 侧栏会话行 "..." 菜单注入"删除会话"项
RiskConfirmation风险确认:勾选"我已了解后果"后确认可用- 删除链路:会话目录 + 投影缓存 + 工作区记账(经活动 storageDomain,内存/磁盘一致)
workbench_session_delete工具:agent 可直接删除会话
后续开发计划
- 添加更多针对会话的操作工具和选项
- 将已有的针对会话的选项做成工具提供给agent
更新日志
- v0.3.1(2026-08-14):修复删除会话后残留日志导致会话跑到「未分组」的问题。删除时同时清理原始 id 与
session-前缀两种 id 形式;先删除磁盘日志并确认成功后再解除工作区记账,避免半删除会话脱离原分组;删除前先 flush 活动会话,防止 dispose 阶段回写/重建日志目录。 - v0.3.0(2026-08-14):新增英文适配(i18n)。删除对话框、头部垃圾桶按钮与侧栏「删除会话」菜单项的全部文案接入客户端 zh/en 字典,跟随界面语言(设置中的语言或浏览器语言)自动切换并即时生效;未加载 locale 服务的环境会按浏览器语言回退到内置中英文字典。
dsh-plugin-session-delete
Frustrated that sessions can't be deleted from the web client? Bothered by abandoned or mistyped conversations cluttering your sidebar? Ever tried editing your harness only to find the session history out of sync — with a corrupted session that just won't go away? This plugin has your back!
Safely delete sessions from the DeepSeek Harness UI. Adds a trash button at the top of the conversation and a "Delete session" item to the sidebar session-row "..." menu; clicking either opens a risk-consent dialog (checkbox required). On confirm, the session log, projection cache and workspace accounting are removed. Running sessions show a warning — if you still choose to delete, the session is stopped and then deleted. Works in the web, and is theoretically compatible with any web-shell-based client.
Also adds an agent tool so agents can delete sessions. Tool name: workbench_session_delete
Installation
dsh plugin --profile <profile> add file:C:/path/to/dsh-plugin-session-delete
Restart the profile to apply.
Features
- Trash button at the top of the conversation
- "Delete session" item injected into the sidebar session-row "..." menu
RiskConfirmationrisk-consent dialog: confirm is only enabled after ticking "I understand the consequences"- Delete chain: session log + projection cache + workspace accounting (through the active storageDomain, so in-memory state and on-disk units stay consistent)
workbench_session_deletetool: agents can delete sessions directly
Roadmap
- Add more session-operation tools and options
- Expose the existing session options to agents as tools
Changelog
- v0.3.1 (2026-08-14): Fixed deleted sessions being left as "Ungrouped" rows after a partial delete. The host now cleans both raw UUID and
session--prefixed id forms, deletes the on-disk log and confirms it before removing workspace accounting (so a failed delete cannot detach a session from its group), and flushes a live session before detaching it to prevent dispose-time rewrites from recreating the log directory. - v0.3.0 (2026-08-14): Added English adaptation (i18n). All copy of the delete dialog, the header trash button and the sidebar "Delete session" menu item now lives in client zh/en dictionaries and follows the UI language (the language setting or the browser language), updating live on switch; environments without the locale service fall back to the built-in dictionaries by browser language.
Read the usage guide →
Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.
Listing badge
[](https://deepseek-plugin.org/plugins/lsz-asd/dsh-plugin-session-delete)Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.