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-recall-restore-plugin

v1.0.0

Published

DSH 消息撤回插件(增强版):在 dsh-recall-plugin 基础上新增「撤回后把被撤回消息恢复到新会话输入框」,项目文件与对话历史一并回退,改完可直接重发。

Readme

dsh-recall-restore-plugin

撤回一条消息,项目文件、对话历史一起回去;被撤回的消息还会自动恢复到新会话输入框,改完直接重发。

简体中文 | English

License Platform DSH Build

这是什么

本仓库是 limbo947/dsh-recall-plugin v1.4.0 的 fork 增强版,包名改为 dsh-recall-restore-plugin。

在原版「文件 + 对话整段回退」的基础上,额外增加了一个能力:

撤回后,把被撤回消息的文本和图片自动恢复到新会话的输入框,方便你改完直接重发。

与上游的区别

| 能力 | 上游 dsh-recall-plugin | 本仓库 | | --- | --- | --- | | 文件快照回退 | ✅ | ✅ | | 会话 fork 回退 | ✅ | ✅ | | 撤回后文本恢复到输入框 | ❌ | ✅ | | 撤回后图片恢复到输入框 | ❌ | ✅ | | 切走原会话前预解码图片 | ❌ | ✅ |

新增逻辑集中在 lib/client.js:

  • collectImageFiles:在切走原会话前,把历史图片 blob URL 解码成浏览器 File,避免原会话卸载后 blob 失效。
  • restoreRecalledContent:拿到新会话的 composer shell,回填文本草稿,并注册图片草稿挂到输入框。
  • executeRecall:在 sessions.fork + open 成功后调用上述回填逻辑,回填失败不影响撤回主流程。

功能亮点

  • 文件 + 对话,整段回退:撤回的不只是聊天记录,agent 改过的文件也一并回到原样。
  • 撤回后可继续编辑重发:被撤回消息的文本、图片自动回填到新会话输入框。
  • 不碰你项目自己的 git:快照存在独立的影子 git 仓库里,你的分支、暂存区、未提交改动统统不受影响;.git、node_modules 自动排除。
  • 项目目录保持干净:快照存在 $DSH_HOME 下,不往项目里塞东西;仅当 home 不可写时才降级到项目内 .dsh-recall-snapshots(页面会提示)。
  • 可以反复后悔:快照全量保留、不修剪,撤回一次后还能再撤到更早。
  • 先看清单再动手:确认面板展示将变更的文件清单(修改 / 恢复 / 删除),确认后才执行。
  • 磁盘友好:快照走 git delta 压缩,超过 100MB 的大文件自动跳过,定期 git gc。

已知限制

  • 快照在消息发送时创建,插件启用前的历史消息没有快照,不显示撤回按钮。
  • 会话第一条用户消息无法回退对话(仅文件回退),因为 fork 需要更早的 turn 边界。
  • 需要 git CLI;Windows 需要 PowerShell 5.1 / 7,Linux/macOS 需要 bash + git。
  • 工作区内嵌套的其他 git 仓库(子目录自带 .git)不进快照。

安装

前置:git CLI、DSH 0.1.0-rc.x(依赖版本见 peerDependencies)。

# 推荐:从 GitHub 直接安装
dsh plugin --profile web add github:pepsi-ai/dsh-recall-restore-plugin

如果后续发布了 npm 包,也可以:

dsh plugin --profile web add dsh-recall-restore-plugin

安装后重启 DSH 进程,并硬刷新页面(Ctrl+Shift+R)。

验证:悬停任意一条插件启用后发送的用户消息,复制按钮旁出现「↶ 撤回」即生效。没有按钮通常是 DSH 进程未重启,或 git CLI 不在 PATH 里。

卸载:

dsh plugin --profile web remove dsh-recall-restore-plugin

快照数据保留在 home 下 dsh-recall-snapshots/,需要彻底清除可手动删除该目录。

使用

  1. 悬停任意插件启用后发送的用户消息,复制按钮旁出现「↶ 撤回」。
  2. 点击 → 确认面板展示将变更的文件清单。
  3. 点「确认回退」→ 文件恢复到该消息发送前;视图切到新会话,原会话归档、可找回。
  4. 新会话输入框会自动带上被撤回消息的文本和图片,改完即可直接重发。

快照维护与清理

  • 定期 gc:每 50 条快照或距上次 gc 24 小时(先到先触发),后台执行 git gc。可用 DSH_RECALL_GC_SNAPS、DSH_RECALL_GC_HOURS 覆盖阈值。
  • 会话删除联动清理:会话被彻底删除后,下一次维护会自动删除该会话的全部快照。归档不算删除,快照保留。
  • 用户自定义排除:打开「设置 → 插件 → 撤回设置」可视化编辑排除项;也可直接编辑 $DSH_HOME/dsh-recall-snapshots/exclude.txt(未设置时为 ~/.dsh/dsh-recall-snapshots/exclude.txt),一行一条 gitignore 风格 pattern。

工作原理

每条用户消息发送时(agent 动文件之前),工作区被快照进一个独立的影子 git 仓库;撤回时用 git 恢复文件、通过 DSH 官方 sessions.fork 把会话切到该消息之前。本 fork 在 fork 成功后额外把被撤回内容回填到新会话 composer。

本地开发

$pkg = '<你的仓库克隆路径>\dsh-recall-restore-plugin'
$profile = "$env:USERPROFILE\.dsh\profiles\web"
Copy-Item -Recurse -Force $pkg "$profile\node_modules\dsh-recall-restore-plugin"
# 然后编辑 $profile\package.json:
#   dependencies 加 "dsh-recall-restore-plugin": "1.0.0"
#   dsh.profile.bundles 加 "dsh-recall-restore-plugin"
# 重启 DSH 并硬刷新页面

License

MIT