npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dsh-session-delete-plugin

v0.1.1

Published

Permanently delete a conversation's local records from the DeepSeek Harness web sidebar.

Readme

dsh-session-delete-plugin

在 DeepSeek Harness(dsh)Web 侧边栏每个对话的「…」菜单里增加**删除对话(本地记录)**选项:确认后彻底删除该对话在本机的全部记录。

  • npm 包:dsh-session-delete-plugin
  • 要求:dsh 0.2.1-rc.2+,Node.js 22+
  • 结构:lib/client.js 浏览器端(菜单项 + 确认对话框),lib/index.js 宿主端(删除路由 + 删除逻辑)

行为

  • 菜单项位于会话「…」菜单末尾(置顶 / 重命名 / 复刻 / 归档 / 复制 ID 之后)。
  • 点击后弹出确认对话框;确认后宿主端删除:
    1. 会话日志目录 ~/.dsh/sessions/<项目目录>/<会话id>/;
    2. 投影缓存 ~/.dsh/storages/session_projcache/sessions/<会话id>.json;
    3. 工作区注册表中的记账(从所属工作区的 sessionIds、全局置顶、全局归档集合中移除);
    4. 随后广播 api-session/removed,所有已打开的页面立即移除该行;全文搜索索引会在下次对账时自动遗忘该会话。
  • 正在使用的对话(当前打开/运行中)会被拒绝(HTTP 409),提示先切换到其他对话。
  • 只删除该对话的记录,不删除工作区目录,也不触碰 DSH home 之外任何文件。
  • 每次删除的明细(目录、缓存、记账清理)都追加写入 ~/.dsh/session-delete.log,可随时审计。

安装(web profile)

dsh plugin --profile web add dsh-session-delete-plugin

或手动安装:

  1. 在 ~/.dsh/profiles/web/package.json 的 dependencies 加入:
    "dsh-session-delete-plugin": "^0.1.0"
    然后在该目录执行 pnpm install。
  2. 在 ~/.dsh/profiles/web/cordis.patch.yml 顶部(与其他 insert 同级)加入:
    - insert:
        - id: session-delete
          name: 'dsh-session-delete-plugin'
  3. 配置 HMR 会自动重载(或重启 dsh web),刷新浏览器页面即可看到菜单项。

运行时激活 / 停用

开关就是 cordis.patch.yml 里上面那个 insert 条目,改动保存即触发配置 HMR 自动重载,无需重启 dsh web(浏览器需刷新一次页面):

  • 停用:删除或注释掉 - id: session-delete / name: 两行 → 宿主路由和菜单项一起消失。
  • 重新激活:恢复这两行即可(node_modules 里的拷贝还在,无需重新安装)。

从源码安装 / 修改

注意 pnpm 对 file: 依赖是拷贝不是链接:运行时读的是 ~/.dsh/profiles/web/node_modules/dsh-session-delete-plugin/ 里的副本。

  1. 在 profile 的 package.json 里用本地路径:
    "dsh-session-delete-plugin": "file:<本仓库>/session-delete"
  2. 每次修改源码后,在 ~/.dsh/profiles/web 下重新执行 pnpm install 刷新副本。
  3. 改动 cordis.patch.yml(如加个注释)触发 HMR 重载,刷新页面。

更新

# 更新到最新发布版
dsh plugin --profile web add dsh-session-delete-plugin   # 或在 profile 目录 pnpm update dsh-session-delete-plugin

刷新浏览器页面生效。

发布(维护者)

  1. 修改代码,必要时 bump package.json 的 version。
  2. 在本目录执行 npm publish(publishConfig 已固定发布到官方 registry https://registry.npmjs.org/,本地 npm 镜像不影响)。
  3. 提交推送本仓库;本地 profile 按上文「从源码安装 / 修改」刷新副本。

故障排查

  • 菜单项没出现:先硬刷新(Ctrl+Shift+R,页面 index 可能被浏览器缓存);仍没有则按 F12 看 Console 有无 [dsh-session-delete-plugin] 或 client-modules 报错。
  • 删除失败:看 ~/.dsh/session-delete.log 中 delete failed: 行;live 表示对话正在使用中,先切换到其他对话再删。
  • 路由不存在(404/405):说明 insert 条目未生效,检查 cordis.patch.yml 与 pnpm install 是否完成。
  • 搜索还能搜到已删除的会话:全文索引在下次对账时自动清理,重新搜索即可。

卸载

从 cordis.patch.yml 删除 insert 条目、从 package.json 删除依赖并 pnpm install;之后才可删除源码目录。

实现

  • lib/client.js:向 sidebar.workspaces.session.menu.item(order 475)注册菜单项,确认对话框挂在 shell.overlay(内置重命名/归档对话框同一模式)。
  • lib/index.js:ctx.inject(["webServer"], ...) 等服务就绪后注册 POST /.dsh-session-delete/delete 路由;删除流程见上文「行为」。
  • 无构建步骤,lib/*.js 为手写产物(区别于本仓库其他插件的 src → build 流程,仓库 .gitignore 已为它开例外)。

License

MIT