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

@chaoset/session-archive

v0.2.0

Published

DSH plugin: browse archived sessions, inspect their content, batch-restore or permanently delete them with multi-select

Readme

@chaoset/session-archive

DSH 插件:归档会话管理 —— 补上 DSH 缺失的"归档后半程"。

web 侧边栏底部新增 归档 面板(🗂):

  • 查看归档:列出全部归档会话(标题、目录、创建/最后修改时间、体积、 运行状态),点击任意会话可展开只读浏览其完整聊天内容(用户/助手文本 消息)。
  • 一次多选批量操作
    • 恢复归档(unarchive):把勾选的会话移回会话树,恢复其在原工作区的 位置(归档时保留的 slot 会计不被破坏)。
    • 彻底删除(delete):删除勾选会话的持久化文件与会话目录。删除为 两段式确认(第一次点击进入确认态,4 秒内再次点击执行),避免误删。 删除后该会话在侧边栏对话列表与归档面板中都不会再出现。
  • 工具条提供全选、已选计数;运行中(live)的会话显示黄色徽标且 禁止勾选删除(请先停止会话);列表随会话树变化自动可刷新(⟳)。

安装

dsh plugin --profile web add @chaoset/session-archive

重启 web profile 后,侧边栏底部出现"归档"按钮。插件由两部分组成:host 插件(归档读写/删除逻辑)与 web 客户端(面板 UI),随 dsh.bundle.patch 自动激活。

工作原理

  • 列表workspaceRegistry.archivedSessionIdssessionPersistence.list(), 标题从会话事件流折叠(最后一个 session/title 事件,与 dsh-session-title 同规则);文件信息来自 sessionPersistence.locate() + stat
  • 查看sessionPersistence.readFrom(id, 0) 只读解析会话事件,提取 文本消息(user/message / assistant/message 的 text 块),不做任何 写入/修复。
  • 删除:live 会话拒绝;每个会话删除持久化文件与会话目录(locate() 定位)。删除后保留该会话在归档集合中的 ghost id:宿主的 archiveSession 不停止内存会话,若把 id 移出归档集合,仍挂在内存中的 会话会因"不再归档"而立刻重新出现在侧边栏对话列表(效果等同"恢复"); 保留 ghost id 后由 list() 的存在性过滤隐藏,面板与侧边栏都不再显示。 归档集合没有官方写入 API,插件复用 registry 自身的串行化写入通道 (enqueueOperation → requireState → setState,与 archiveSession 同一 路径);若内部形状变化会自动降级为"仅删文件",归档列表按文件存在性 过滤,功能不受影响。
  • 恢复:仅从归档集合移除仍存在持久化文件的会话 id,会话数据不动, 恢复后回到原工作区位置;文件已删的已删除会话拒绝恢复(防"复活")。

Remote API(ctx.remote.sessionArchive

| 方法 | 参数 | 返回 | | --- | --- | --- | | list() | — | { items: ArchiveRow[] } | | detail(sessionId) | 会话 id | { sessionId, header, title, messageCount, messages, live } | | delete(sessionIds[]) | id 数组 | { deleted, failed, removedFromArchive } | | unarchive(sessionIds[]) | id 数组 | { restored, removedFromArchive } |

deleteremovedFromArchive 恒为 0:删除保留归档 ghost id(见上), 侧边栏不会重新显示已删除的会话;unarchiveremovedFromArchive 为 实际从归档集合移除的 id 数。

ArchiveRow{ sessionId, title, cwd, createdAt, updatedAt, size, live }

配置

config 字段(cordis.patch.yml~/.dsh/plugins/session-archive/config.json):

  • detailMaxMessages(默认 200):查看时返回的最大消息条数。
  • messagePreviewChars(默认 2000):单条消息预览的最大字符数。
  • titleReadConcurrency(默认 4):列表加载时并发读取标题的并行度。

限制

  • 运行中(live)的会话无法删除 —— 先停止会话再删除。
  • 无官方 unarchive API,恢复归档通过 registry 写入通道实现;若未来 DSH 提供官方 API,插件会切换过去(行为不变)。