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

@megen-lebar/dsh-archive-panel

v0.3.5

Published

DSH Web GUI 归档会话管理面板:查看和恢复归档对话,并通过 tombstone + 安全启动清理实现不可逆删除。

Downloads

122

Readme

@megen-lebar/dsh-archive-panel

DSH Web GUI 的归档会话管理面板。DSH 原生只有单向「归档」操作(会话从侧边栏隐藏),没有「查看归档 / 恢复 / 删除」入口。本插件在侧边栏新增「归档」入口,提供:

  • 查看:列出已归档的对话,优先显示真实标题与所属项目。
  • 恢复:取消归档,会话重新回到侧边栏,可继续对话。
  • 删除:立即从归档管理面板隐藏,同时保持原生归档状态以防回到工作区;在下一次安全 backend 启动时永久清理工作区引用、日志与投影缓存。

删除的两阶段安全机制

DSH 没有公开的“删除持久化会话” API。session.jsonl.zstd 日志由 sessionPersistence 管理,运行中的服务会保留内存缓存与写队列。直接 rmSync 删除日志,会令磁盘与内存状态撕裂,导致前端输入框锁死。

因此插件采用两阶段删除:

  1. 点击删除时:客户端先通过只读 /version 确认 host 同为 0.3.5 / tombstone-v2;若 host 尚未重启或版本不匹配,会拒绝发送删除请求并提示完整重启。版本匹配后只写入 ~/.dsh/dsh-archive-panel.pending-delete.json tombstone,并从本插件的归档列表过滤该会话。删除后归档面板保持打开,不会导航回聊天窗口或强制改写 Composer 焦点。此时不修改 workspace.sessionIds,不移除 archivedSessionIds,不 dispose live session,也不清空客户端当前会话。因此原生侧边栏继续把它当作归档会话隐藏,输入框生命周期不受影响。
  2. 下一次 backend 启动前置阶段:无服务依赖的 archive-preflight 先处理上一次运行留下的 tombstone;session-persistence-jsonl 与 storage-json 都显式依赖它,因此日志、workspace 和 projection cache 会在任何 DSH 服务读取它们之前完成一致清理。清理失败时 tombstone 保留供下次启动重试。

这样删除时不会出现“先取消归档回到工作区”的中间态,物理删除也不会发生在 session/workspace 服务已经建立内存基线之后,从而避免输入框锁定,同时仍实现最终物理删除。

工作原理

  • 归档状态:~/.dsh/storages/workspace.json 的 global.archivedSessionIds。
  • 工作区会话清单:同文件各 workspace 的 sessionIds。
  • 会话标题:逐帧解压 session.jsonl.zstd,读取最后一个 session/title 事件。
  • 待删队列:~/.dsh/dsh-archive-panel.pending-delete.json。
  • 侧边栏入口:通过 DOM 注入与 MutationObserver 自愈。
  • 宿主端路由:POST /api/dsh-archive/{version,list,unarchive,delete},仅接受 loopback 请求;version 无副作用地报告 host 版本与删除模式。

安装

dsh plugin --profile web add link:<本目录的绝对路径>

安装或升级后需要重启 DSH Web GUI,才能让 host 端加载新的删除生命周期逻辑。

注意

  • 删除会话后,界面立即消失;物理文件清理发生在下一次 backend 启动,这不是延迟 bug,而是避免锁死的安全保证。
  • 主面板仅依赖 webServer 与 workspaceRegistry;物理清理由无服务依赖的 preflight 直接处理磁盘 JSON/日志,并通过 Cordis 注入屏障保证早于 persistence/storage 初始化。若清理失败,tombstone 会保留而不会伪报完成。