DeepSHPlugins
dsh-plugin-subagent-delete 專案預覽
GITHUB / COMMUNITY PROJECT

dsh-plugin-subagent-delete

會話與訊息JavaScriptMIT

帶歸屬校驗的工具與 HTTP 路由,用於列出、釋放和永久刪除子代理會話,刪除後自動重新整理 web UI。

2 Starsheiheiha798 更新時間 2026-08-21
訪問 GitHub 倉庫
dsh-plugin-subagent-delete 專案預覽

專案介紹

中文

帶歸屬校驗的工具與 HTTP 路由,用於列出、釋放和永久刪除子代理會話,刪除後自動重新整理 web UI。

English

Ownership-checked tools and HTTP routes to list, release and permanently delete subagent sessions, with automatic web UI refresh after deletion.

專案資訊與收錄訊號

快照 2026-09-11
作者 / 組織
heiheiha798
倉庫
heiheiha798/dsh-plugin-subagent-delete
GitHub Stars
2
Forks
0
開發語言
JavaScript
許可證
MIT
最近推送
2026-08-21
Manifest
資料中檢測到宣告

公開倉庫不自動等於可商用;許可證與當前相容性以原專案文件為準。Manifest 和資料評分不構成安裝安全認證。

資料評分

54/ 100
維護活躍
86
文件與實用資訊
85
生態關注度
14
安裝便捷訊號
75
專案宣告訊號
100

近 21 天仍在更新;README 含完整安裝與使用說明;關注度尚低(2)。

評分來自已有資料快照的五維模型,僅作瀏覽參考,不是實際使用評測或安全檢測結論。

安裝與使用

所有專案資料與許可均以對應 GitHub 倉庫為準。

dsh plugin --profile web add "https://github.com/heiheiha798/dsh-plugin-subagent-delete/releases/latest/download/dsh-plugin-subagent-delete-0.2.0.tgz"

複製命令不會自動執行。請先閱讀倉庫文件,確認環境要求與許可證。

專案截圖

倉庫 README

GitHub 原文

已儲存的倉庫文件快照;文件抓取時間未記錄,可能與上方目錄介紹處於不同版本。安裝前請核對當前倉庫說明。

儲存庫檔案保留原文,指令與授權文字不作自動改寫。

dsh-plugin-subagent-delete

DeepSeek Harness (DSH) plugin that adds the missing subagent lifecycle interface:

  • delete_subagent — permanently delete a subagent session and take it out of the web UI list
  • release_subagent — stop / release a subagent without deleting its transcript
  • list_subagents — list the calling session's descendant subagents (including finished one-shot subagents)

Compatible with DSH 0.1.0-rc.8.

Why

DSH's built-in subagent control surface only provides send_message, interrupt_agent and list_agents. There is no delete/release endpoint, so finished one-shot and stale continuable subagents keep accumulating in the web UI list. This plugin fills that gap with an ownership-checked, model-callable tool plus optional HTTP routes.

Install

dsh plugin --profile web add github:heiheiha798/dsh-plugin-subagent-delete
# or pin to the published release
dsh plugin --profile web add github:heiheiha798/dsh-plugin-subagent-delete#v0.2.0
# or from a local checkout
dsh plugin --profile web add /path/to/dsh-plugin-subagent-delete

Restart the profile, then start a new session. The session gains three tools.

Tools

list_subagents

list_subagents({})                      // all descendants
list_subagents({ activity: "running" }) // running only
list_subagents({ mode: "one-shot" })    // one-shot only

Returns the caller's descendant subagent tree: id, label, mode (one-shot | continuable), activity (running | inactive), depth, parentId and hasChildren.

delete_subagent

delete_subagent({ subagent_id: "0fcfbdd6-5d21-46a4-bd95-2ca6edac1261" })
delete_subagent({ subagent_id: "<id>", recursive: true })

Permanently removes the subagent:

  1. verifies the target is a descendant of the calling agent's session

(descendant discovery uses the official ctx.subagents.listDescendants);

  1. stops the live agent / drains a resident continuable Activation;
  2. flushes and detaches the live session from ctx.sessions;
  3. removes the on-disk session log directory (both uuid spellings);
  4. removes the session_projcache row;
  5. removes the id from workspace accounting and the archive set.

Without recursive: true a target that still has descendants is refused with has-descendants. Deletion is child-first and permanent.

release_subagent

release_subagent({ subagent_id: "<id>" })
release_subagent({ subagent_id: "<id>", recursive: true })

Stops the current turn and releases a resident continuable Activation via ctx.subagents.drainContinuableChildren, but keeps the durable transcript. The subagent remains resumable with send_message.

Web UI auto-refresh

DSH has an official refresh path for subagent creation (session/created → host/session-added) but no symmetric contract for deletion: for a durable subagent, host/session-removed is treated by the client as a status change (running: false) only, so the sidebar list and subagent catalog are not refreshed.

This plugin works around that gap without patching DSH: after every permanent delete the host publishes a short-lived marker session through the official prepare → enter → announce → detach lifecycle seam, and the bundled web client component (lib/client.js) watches the public sessions.list snapshot. When the marker child is removed it debounces (350ms) and calls sessions.refresh() plus sessions.refreshSubagents(parentId) for the affected parents. Open web clients therefore update the subagent count immediately — no manual page reload required. The marker's _no-cwd artifact is swept after detach, so the refresh glue leaves no residue.

HTTP routes (web profiles)

For client integration and local debugging the host plugin registers:

  • GET /dsh-plugin-subagent-delete/list?parentSessionId=<id>[&activity=…][&mode=…]
  • POST /dsh-plugin-subagent-delete/delete { "parentSessionId": "<id>", "subagentId": "<id>", "recursive": false }
  • POST /dsh-plugin-subagent-delete/release { "parentSessionId": "<id>", "subagentId": "<id>", "recursive": false }

HTTP callers must name the same parentSessionId the target descends from; the same ownership check runs on every mutation.

Safety

  • A subagent can only be deleted by its own session-tree ancestor. Foreign or

unknown ids return not-your-subagent / not-found.

  • Running subagents are cancelled and awaited (15s quiescence bound) before

their files are removed.

  • File removal is confirmed before workspace accounting is stripped, so a

failed delete cannot produce a half-removed row.

Development

npm test        # node --test
npm run check   # syntax check + tests
npm run pack:dry

The test suite includes unit tests and an integration fixture created from ten real one-shot test subagents (see test/fixtures/test-subagents.json).

License

MIT

使用前核對

安裝步驟、相容版本與授權範圍以原專案當前文件為準。Stars 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案