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-git-session-vault

v0.2.0

Published

DSH 会话 Git 同步 — 用你自己的 Git 仓库备份、恢复并在多台设备之间同步 DeepSeek Harness 会话记录。 / DSH Session Git Sync — back up, restore, and synchronize DeepSeek Harness session archives across devices with your own Git repository.

Readme

会话保险库 · DSH Session Vault

用你自己的 Git 仓库备份、恢复并在多台设备之间同步 DeepSeek Harness 的会话记录。

⚠️ 仓库必须是私有的。 会话文件里是完整的对话内容,包括你说过的每一句话、贴过的代码和文件路径。公开仓库等于公开你的全部聊天记录。

它解决什么问题

DSH 把每条会话存成 DSH_HOME/sessions/<工作区>/<会话 id>/session.v4.jsonl.zstd 这样的本地文件。换一台机器就看不到之前的对话;硬盘坏了就全没了。

这个插件把这些文件放进一个 Git 仓库,让多台设备通过同一个仓库收敛到相同状态:

  • 换设备:新机器同步一次,历史会话全部回来。
  • 备份:每次同步都是一个带信息的提交,可以回退。
  • 多端并存:两台机器都改过同一个会话时停下来问你,绝不悄悄覆盖。

安装

# 在 DSH 配置目录里安装(二选一)
dsh plugin add dsh-git-session-vault

或者装进某个 profile:

dsh plugin add dsh-git-session-vault --profile web

装好后打开 设置 → 会话保险库。

从源码安装

git clone https://github.com/XunWuJian/dsh-git-session-vault.git
cd dsh-git-session-vault
pnpm install
pnpm run build
dsh plugin add .

快速开始

  1. 在 GitHub / Gitee / 自建 Git 服务上新建一个空的私有仓库。
  2. 打开 设置 → 会话保险库,填入仓库地址,例如 [email protected]:you/private-sessions.git。
  3. 点 测试连接 确认能访问。
  4. 点 同步。第一次会创建分支、写入备份布局,并把它推上去。

之后:新设备装插件 → 填同一个仓库 → 点 同步,历史会话就下来了。

认证

| 方式 | 什么时候用 | 怎么配 | | --- | --- | --- | | 系统凭据助手(推荐) | 已经配好 SSH key 或 Git 凭据 | 什么都不用填 | | 环境变量令牌 | HTTPS + PAT,不想用凭据助手 | 填环境变量名,例如 DSH_SYNC_TOKEN |

令牌永远不会写进配置文件,插件只保存变量名。填 https://user:token@host/repo 这种带凭据的地址也会被自动剥掉凭据并拒绝保存。

三向同步规则

插件为每条会话记录一个基线(base,即上次双方达成一致的内容哈希),同步时比较 base / 本地 / 远端:

| 本地 | 远端 | 动作 | | --- | --- | --- | | 未变 | 未变 | 跳过 | | 已改 | 未变 | 上传 | | 未变 | 已改 | 下载(先备份本地旧文件) | | 都改过,内容相同 | | 跳过 | | 都改过,内容不同 | | 冲突:停止并等你决定 | | 本地没有 | 远端有 | 下载 | | 本地有 | 远端没有 | 上传 | | 首次同步,同 id 不同内容 | | 冲突 |

几条硬规则:

  • 从不删除本地文件。 仓库里消失的会话仍然留在本机。
  • 覆盖前一定先备份。 被替换的文件复制到插件数据目录的 backups/<时间戳>/ 下。
  • 不会静默覆盖本地改动。 本地已修改的会话需要显式开启「允许覆盖」或手动选择保留哪一边。
  • 推送失败不会被吞掉。 提交留在本地,错误照实报告,下一次重试即可。

仓库里的布局

manifest.json                                备份索引(工作区、会话清单、最后操作)
metadata/schema.json                         布局说明(自解释,方便人工查看)
profiles/<工作区>/sessions/<会话 id>/*.zstd   会话原始文件,原样保存

会话文件是 DSH 自己的格式,不做任何转换——所以任何一台装了 DSH 的机器都能直接读。

界面

设置 → 会话保险库 提供:

  • 仓库地址、分支、设备名、认证方式
  • 状态卡片:本地会话数、工作区数、基线数、上次同步时间、最近提交、最近操作、最近错误
  • 冲突面板:逐条选择「保留本地」或「保留远端」
  • 操作:同步 / 仅上传备份 / 仅下载恢复 / 查看历史
  • 选项:子代理会话、上传开关、下载开关、覆盖保护、单会话大小上限
  • 自动同步:启动后同步一次、会话变化后同步(带防抖和空闲判断)

给 Agent 用的工具

| 工具 | 作用 | | --- | --- | | dsh_session_sync_status | 读取状态、本地规模、上次结果 | | dsh_session_sync_list | 列出本地会话 | | dsh_session_sync_diff | 只读三向比较,告诉你每条会话会怎么处理 | | dsh_session_sync_sync | 执行双向同步(需要二次确认) | | dsh_session_sync_backup | 仅上传(需要二次确认) | | dsh_session_sync_restore | 仅下载(需要二次确认) | | dsh_session_sync_history | 查看提交历史 |

所有会写数据的工具都要求先不带 confirm 调用一次拿到计划,再带 confirm: true 真正执行。

需要注意

  • 仓库体积会一直增长。 Git 保留历史,会话日志是整文件快照。会话很多时建议定期重建仓库或使用浅克隆。
  • 不要提交到公开仓库。 插件无法阻止你这么做,请自己确认仓库是私有的。
  • 冲突是设计的一部分。 两台设备改了同一个会话时,插件不会猜你想要哪一边。
  • 首次同步会把本地会话全部上传。 请先确认仓库是空的,或你确实想合并进去。

开发

pnpm install
pnpm run build     # lib/index.js + lib/client.js
pnpm test          # 两个设备 + 一个裸仓库的集成测试

src/ 是主机端(纯 ESM,无 @deepseek-ai/* 运行时依赖),src/client.js 是浏览器端(esbuild 打包成 window.__ModuleLoader__ 模块)。lib/ 是构建产物,不要手改。

许可证

MIT