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-steward

v0.5.2

Published

DSH Web 插件:会话管家(合并包)—— 会话历史文件(归档浏览与清理)与健康检查(体检 → 处方 → 出院),外加独立 FTS5 会话内容搜索索引(标题/内容双模式、增量同步、非破坏性整理与快照导入导出)。不碰会话日志、只做可逆处置。

Readme

dsh-session-steward(会话管家 / Session Steward)

DSH Web 插件:会话历史文件 + 会话健康检查。

  • 养老院(会话历史文件):浏览官方归档集合,两个独立操作 —— 取消归档状态(只改数组,可逆)与 清理归档文件(真删磁盘实体,不可逆)。

两个操作不可互换,也不能合并:

| | 取消归档状态 | 清理归档文件 | |---|---|---| | 路由 | session-history-prune | session-history-purge | | 改什么 | 只改 global.archivedSessionIds | 删磁盘实体 + 改归档数组 + 改工作区成员表 | | 会话去向 | 回到侧边栏原工作区 | 从世界上消失 | | 可逆 | ✅ | ❌ |

清理必然连带取消归档 —— 否则会留下「侧边栏看不见、一取消归档就变成空会话」的僵尸 id。 体积按行显示(实测单条可从 0 到 23 MB),按钮给所选小计。

两条硬约束(照做,否则操作会白做):

  1. 列表与写入同源 —— 都认存储文件 ~/.dsh/storages/workspace.json。宿主内存里的 workspaceRegistry 是启动快照,改文件写不到它,只作为「已出文件、仍生效」的诊断面 (pendingRestart)。
  2. 操作后立刻重启 DSH —— 存储层是全量重写、内存为准:宿主退出前任何归档或 工作区改动都会把旧状态整份写回,本次操作归零。
  • 体检(健康检查 / 会话医生):四门体检 → 处方(命令清单)→ 出院(可逆处置 + before/after 对照)。

命名边界:本插件不提供搜索与索引。搜索/独立索引属于另一片(dsh-search-index), 两侧互不出现对方的子域字眼,也不互相解释对方字段。

支持 DSH 0.1.0-rc.2、0.1.0-rc.3、0.1.0-rc.6、0.1.0-rc.7、0.1.0-rc.8、0.1.1-rc.1、0.1.1-rc.2、0.1.2-rc.1、0.1.5-rc.1、0.1.5-rc.2、0.1.5-rc.3、0.1.7-rc.1、0.1.7-rc.2、0.2.0-rc.1、0.2.0-rc.2(枚举 peer,逐 rc 实测白名单;alpha/beta 不在支持范围)。

界面预览

侧边栏底部新增 「会话管家」 入口,与搜索、设置并列:

侧边栏入口

养老院(会话历史文件)——官方归档集合一览,每条给出体积与磁盘实体状态;勾选后可取消归档或清理:

养老院(全部收口状态)

体检——四门体检的入口,扫完给出可逆处方:

体检

安装

dsh plugin --profile web add dsh-session-steward
# 或本地开发目录
dsh plugin --profile web add "link:E:/test/rewrite-agently/mine-dsh-plugins/dsh-session-steward"

安装后必须重启宿主进程(仅刷新页面无效)。

路由契约

前缀 /session-steward/api,方法名一律 session-*(不得与搜索索引的 index-* 混用); 未识别的方法返回显式错误,绝不静默。

| 方法 | 子域 | 作用 | |---|---|---| | session-history-list | history | 列出归档集合(存储文件优先;含来源、降级、按行体积与 pendingRestart 标注) | | session-history-prune | history | 取消归档状态:从归档数组批量移除 id(自动备份,需重启) | | session-history-purge | history | 清理归档文件:真删转录目录 + 投影缓存 + 两处 id(不可逆) | | session-health-status | health | 开关状态与方法表(面板轮询用) | | session-health-scan | health | 批量体检(默认只返回非 ok 的会话) | | session-health-session | health | 单会话四门报告 + 处方 | | session-health-repair | health | 可逆处置(隔离投影缓存记录)+ before/after |

设置命名空间:session-steward;侧边栏入口 id:dsh-session-steward。

两个开关(feature gate)

| 开关 | 字段 | 关闭效果 | |---|---|---| | 会话历史文件 | historyFiles(默认 true) | 不注册 session-history-*,不渲染「养老院」页签 | | 健康检查 | healthCheck(默认 true) | 不注册 session-health-*,不渲染「体检」页签 |

关闭时对应方法返回 { ok: false, error: '子域已关闭(…=false):<method> 未注册' },不留空壳。

四门体检

| gate | 判据 | level | |---|---|---| | log-integrity | zstd 多帧扫描 → provenance 展开 → 打包行解包;seq 连续、无撕裂尾帧 | 有读取问题 fail;仅撕裂尾帧 warn | | projection-cache | ~/.dsh/storages/session_projcache/sessions/<id>.json 的 minSeq 与日志末 seq 的 lag + 未结算字段(openStep / activeStep.active / pendingTurnStart / turnBoundary=start) | 滞后且未结算 fail;任一 warn | | lossless-json | 热态 sessionProjections.checkpoint(session) 逐行判定无损 JSON(undefined / 非有限数 / -0 / 稀疏洞 / 非普通原型 / 函数·Symbol·BigInt / 环) | 命中 fail,并给出投影 key → 归属包 | | cold-read | 最后 turn/end 的原因、是否存在未收尾 open step、最后 user 消息之后是否还有 assistant 输出 | open step fail;interrupted/无 turn/end warn |

处方只给三件可逆的事:① 隔离损坏的投影缓存记录(先备份)② 含未结算 step 时提示等待宿主结算 ③ 输出可执行命令清单。 禁止:改写会话日志、改历史数据、静默丢弃字段。

与 dsh-search-index 的唯一契约

归档文件格式(~/.dsh/storages/workspace.json 的 global.archivedSessionIds): 本插件写、搜索索引只读。格式说明见 dsh-docs-deliverables/dsh-归档文件格式契约-20260914.md。

开发

pnpm install
pnpm typecheck     # tsc -b --pretty false
pnpm test          # vitest run
pnpm build         # tsc -b && tsdown → lib/index.js + lib/client.js

许可

MIT