Skip to main content

dsh-plugin-session-delete

26Stars1Forks3Issues0Watchers

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.

Evidence4/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
JavaScript
Branch
main
deepseek-harnessdshdsh-plugin

Install

cmdweb profile
$ dsh plugin --profile web add github:lsz-asd/dsh-plugin-session-delete

Run 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.actions slot, 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) and POST /__chameleon/session/delete (deletes specified session)
  • Registers Agent tool workbench_session_delete, parameter is sessionId, 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 domain session_projcache sessions table, workspace domain workspaces.sessionIds and global archivedSessionIds; 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 for defineTool registering 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.yml fixes bundle line id chameleon-session-delete for easy reinstall/patch-targeted updates. src/index.js is the host half: registers tools via ctx.tools.register and exposes two routes via ctx.webServer.register (with ctx.inject(['webServer']) fallback branch); src/client.js registers factory via window.__ModuleLoader__.load, renders two slot components + one global delete dialog per client-modules protocol using React.createElement, and injects menu items into sidebar via MutationObserver
  • Entry Files: src/index.js (host entry apply) + src/client.js (client entry apply, exposed via package.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

DependencyMin VersionDescription
DSH^0.1.0-rc.6peer 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>= 20package.json#engines.node declaration
PlatformmacOS / Windows / LinuxCross-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 ModulesNonehost 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 locale service 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 customizes DSH_HOME but client still queries default home, may mismatch with server lookup (src/index.js:44-46)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](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.

← Back to plugin directory