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-knj-session-management

v2026.9.150

Published

Session management for DeepSeek Harness: archive/restore/delete persisted sessions, auto-policy per workspace, and a size governance panel. DSH 会话管理插件:归档/恢复/删除持久化会话,按工作区控制会话数量上限,提供体积治理面板。

Downloads

665

Readme

dsh-knj-session-management

DSH 会话管理插件:归档/恢复/删除持久化会话,按工作区控制会话数量上限,提供体积治理面板。解决会话只增不减导致的 session_projcache.json 膨胀与 web 界面卡顿。

为什么需要它

DSH 的会话只增不减:session.list 基于磁盘扫描、SQLite FTS 索引与 workspace header 索引都会随会话数线性变慢;更关键的是 session_projcache.json(JSON 存储后端,每次写入全量序列化+原子重写)会随会话数膨胀——本机 425 个会话时达到 270MB,任何 checkpoint 写都同步阻塞约 1.5 秒,表现为新建/切换会话卡顿。

DSH 宿主没有会话删除/归档 API,本插件补上这个能力,并且三处索引全部自动跟随(见设计文档)。

功能

  • 归档:把 sessions/<ws>/<id>/ 移到 archive-sessions/<ws>/<id>/(可逆,不释放磁盘,会话从列表消失,projcache 记录清除)
  • 恢复:把归档会话移回原位置(投影缓存冷读自动重建)
  • 永久删除:彻底移除归档目录(不可逆,释放磁盘,需二次确认)
  • 自动策略:每工作区保留最近 N 个会话,超限自动归档最旧的非运行会话
  • 未分组/失效工作区_no-cwd 会话与工作区路径已删除的会话都会被显式列出并支持管理
  • 体积面板:显示 projcache 体积、各工作区会话数与归档统计
  • 蒸馏衔接:归档/删除前可一键复制 wiki-distill 蒸馏指令,先把会话沉淀进知识库再清理,知识不丢(蒸馏本身由既有 wiki-distill skill 完成,本插件只做编排)
  • 跨卷支持:归档区配置到其他盘符时自动回退 copy+rm(Windows EXDEV 防护)
  • 侧栏即时同步:归档/恢复/删除/自动策略执行后,客户端立即让宿主重拉会话列表基线(sessions.refresh() / workspaces.refresh(),见 src/client-sync.ts),左边栏当场消失/重现,无需重启 dsh web。宿主只对"自己改的会话"推送列表帧,本插件直接移动文件宿主无感知,所以必须主动重拉;旧版本因此要重启才刷新

安装

# 一条命令同时安装插件与菜单宿主 dsh-knj-menu(已声明为 npm 依赖,版本自动配套)
dsh plugin --profile web add dsh-knj-session-management dsh-knj-menu

配置(cordis.patch.yml)

- insert:
    - id: dsh-knj-session-management
      name: 'dsh-knj-session-management'
      config:
        maxSessionsPerWorkspace: 60   # 每工作区保留上限,0 关闭自动归档
        enabled: true                 # 自动归档总开关
        # archiveRoot: ''             # 归档区,默认 $DSH_HOME/profiles/<profile>/dsh-session-archive(历史目录,改名后保持兼容)

开发

npm install
npm run check        # typecheck + build
npm pack             # 打 tgz

设计文档

  • 行为契约:openspec/changes/add-session-archive-management/specs/session-archive/spec.md
  • 技术决策:openspec/changes/add-session-archive-management/design.md
  • 交互设计:openspec/changes/add-session-archive-management/interactions.md