dsh-archive-manager:從 DSH Web 側邊欄刪除已歸檔會話目錄

前言

在 DSH 的 web profile 裏,如果你需要把某個已歸檔會話在 $DSH_HOME/sessions 下的磁盤目錄清理掉,而不是隻在界面上保留它的記錄,dsh-archive-manager 提供了一個側邊欄入口。它列出已歸檔會話,要求二次確認,然後刪除對應會話目錄。

下面介紹它是什麼、能做什麼、如何安裝,以及使用前需要注意的限制。

這是什麼

dsh-archive-manager 由 zimixvx 維護,採用 MIT 許可證。它是一個 out-of-tree 的 DeepSeek Harness Web Cordis plugin,面向 web profile。

它不改 DSH 核心安裝,也不改 profile 配置;唯一對 $DSH_HOME 的持久影響,是刪除用戶確認後的 $DSH_HOME/sessions 下所選會話目錄。

插件分成兩半:

  • host half 註冊 POST /archive-manager/delete;
  • client half 註冊 sidebar.footer.action,其中 id: archive-manager,order: 80。

核心功能

1、在側邊欄 footer 增加歸檔管理動作。寬模式下顯示 已歸檔 N,窄邊欄只顯示歸檔圖標。

2、打開彈窗後,只列出 archivedSessionIds 中仍有 session summary 的會話 id,並顯示 displayTitle(或 id)、cwd 和 updatedAt。

3、每一行提供 trash 按鈕。刪除前要求第二次確認,明確提示會永久刪除會話目錄且不可恢復。

4、刪除成功後,插件刷新 sessions 和 workspaces。本地 deleted-id set 也會立即隱藏該行。

安裝與啓用

從 GitHub 安裝

把插件加入 web profile:

dsh plugin --profile web add "github:zimixvx/dsh-archive-manager"

從本地路徑安裝

如果插件目錄在:

D:\Code\DeepseekHarness\plugins\dsh-archive-manager

可以執行:

dsh plugin --profile web add "D:\Code\DeepseekHarness\plugins\dsh-archive-manager"

這條命令會寫入 dependencies。隨後需要在 $DSH_HOME/profiles/web/package.json 的 dsh.profile.bundles 中加入 dsh-archive-manager:

{
  "name": "dsh-profile-web",
  "private": true,
  "dependencies": {
    "dsh-archive-manager": "file:D:/Code/DeepseekHarness/plugins/dsh-archive-manager"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "@deepseek-ai/dsh-base",
        "@deepseek-ai/dsh-web-app",
        "dsh-archive-manager"
      ]
    }
  }
}

這裏的重點是 bundles 列表;dependencies 的具體條目由 dsh plugin --profile web add 寫入。

重啓 web profile

運行中的進程不會讀取新的 bundle 行,因此安裝或卸載後都需要重啓 web profile:

dsh web

刷新頁面後,側邊欄 footer 會出現歸檔管理動作。

典型用法

1、在已重啓的 web profile 頁面中,點擊側邊欄 footer 的歸檔管理動作。

2、在彈窗中選擇一個已歸檔會話。列表只包含 archivedSessionIds 中仍帶有 session summary 的會話 id。

3、點擊該行 trash 按鈕,並在第二次確認中確認永久刪除。

4、插件會發起同源 POST /archive-manager/delete。成功後,刷新 sessions 和 workspaces;即使後續刷新失敗,本地 deleted-id set 也會立即隱藏該行。

適用場景與注意

適合需要在 DSH web profile 中手動清理已歸檔會話磁盤目錄的開發者。它只處理已歸檔會話,不替代 workspace registry 管理,也不處理共享附件。

使用前務必檢查源碼和許可證。該插件會以當前 dsh 進程的權限運行;安裝前請確認你信任代碼,並瞭解它刪除的目錄位於 $DSH_HOME/sessions。

限制如下:

  • 僅允許刪除 workspaceRegistry.archivedSessionIds 中存在的會話;live session 會被拒絕,返回 HTTP 409。
  • 需要 raw-artifact backend:supportsRawArtifacts === true,且 locate() 返回 { kind: 'jsonl', path };否則路由返回 501。
  • 刪除只是對會話目錄執行遞歸 rm,force: false,不可恢復,沒有 trash 或 restore 路徑。
  • 不修改 workspace registry、archived markers、projection cache,或 content-addressed attachments / shared attachments。
  • 刪除成功後,archivedSessionIds 中的標記按設計保留。因爲彈窗只列出仍有 session summary 的已歸檔 id,物理刪除會移除 summary,所以重載後不會再次出現。
  • 插件沒有自有 durable state。卸載時從 dsh.profile.bundles 和 dependencies 中移除 dsh-archive-manager,然後重啓即可。

鏈接

  • GitHub:https://github.com/zimixvx/dsh-archive-manager
  • 社區目錄頁:https://www.skillhub.cn/plugins/zimixvx/dsh-archive-manager
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜