Skip to content
项目

PerryLink/dsh-session-sync has 34 GitHub stars and 8 forks. GitHot measured 0 stars in 24 hours and +6 in 7 days. Last checked 2026-11-15 19:38 UTC. Last push 2026-11-04.

这些数字如何统计

实测星标增长

24小时
0
7天
+6
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

关于

Cross-device DeepSeek Harness session sync: a dedicated git mirror with append-only keep-both conflict resolution (fork files, never silently overwritten), /sync command and sync_* tools

开发工具

README-zh.md

原文

🔄 dsh-session-sync

  • 1024 商店渠道:先 npm i -g dsh1024,再 dsh1024 plugin --profile web add dsh-session-sync(计入 deepseek1024.com 安装排行)。

DeepSeek Harness 的跨设备会话同步 —— 为你的会话存储建立专用 git 镜像。

在设备间同步会话,冲突时两边都保留,绝不丢失任何一轮。

官方仓库。 本仓库是 dsh-session-sync 的唯一官方仓库,由 PerryLink 维护。其他账号下的同名仓库与本项目无关。

License Gitee DSH plugin dsh-doctor DSH Market Node CI Version npm version npm downloads dshfind

English · 简体中文 · Español · Português · हिन्दी

dsh plugin --profile <name> add dsh-session-sync

📖 生态实测知识库(实测数据,不是营销):插件开发指南 · 选型实测数据 · 维护取舍判据。

⭐ 如果它帮到了你

这个插件是 DSH 插件家族的一员(95 个,全部 Apache-2.0)。如果你在用,给个 star —— 它不会解锁任何功能,但会让下一个人在搜索里更容易找到它。

English: part of a 95 plugin family for DeepSeek Harness. If it is useful, a star helps the next person find it — nothing is gated behind it.

What is dsh-session-sync?

DeepSeek Harness 的跨设备会话同步 —— 为你的会话存储建立专用 git 镜像。

在设备间同步会话,冲突时两边都保留,绝不丢失任何一轮。

dsh-session-sync 工作流图:请求 → 策略/复核 → 判定。

工作流概览:请求 → 策略/复核 → 判定。下面的示例使用实际命令面。

同一次运行,动图版。

兼容性

项目 状态
Harness DeepSeek Harness dsh-v0.2.1-alpha.1(GitHub tag,2026-09-24 已核验:完整门控链,针对钉住的 0.1.7-rc.2 peers)。npm 依赖线 0.1.7-rc.2,peers `>=0.1.2-rc.1 <0.2.0
Node ^22.19.0 || >=24.0.0
平台 任何能运行 git 和 DSH 的环境(基于 git 镜像;无平台特定代码)
模型 纯文本模型即可完整支持;无需视觉或额外模型能力

你能得到什么

dsh-session-sync 把你的 DSH 会话存储镜像到一个专用 git 工作树,并同步到你自己控制的远端 —— 无云服务、无第三方存储:

  • /sync 命令 —— status(分支、脱敏后的远端、领先/落后、未提交文件、fork 文件)、diff、log、pull、push、help。
  • sync_status / sync_pull / sync_push 工具 —— 在轮次内为模型提供同样的能力。
  • append-only 冲突裁决 —— 会话日志是 append-only;任何分歧都会两边都保留(本地版本保留、远端版本留存为 fork 文件),绝不静默覆盖。分歧的会话还可在会话层面 fork。
  • 自动模式 —— 启动时拉取、每个关闭轮次后推送、周期拉取,全部可配置且可逆。
  • 写操作走确认门 —— pull/push 会先询问(经 userQuestions 或 approval);只读界面从不询问;没有回答者时操作失败关闭。
设备 A                              远端(你的 git 仓库)                  设备 B
$DSH_HOME/sessions ──镜像──▶ 提交 ──推送──▶ [sessions] ──拉取──▶ 合并(两边保留 + fork)

快速开始

dsh plugin --profile web add github:PerryLink/dsh-session-sync
# 1. 把 bundle 安装进你的 profile
dsh plugin --profile web add github:PerryLink/dsh-session-sync

# 或从 npm(已发布版本)
dsh plugin --profile web add dsh-session-sync

# 2. 指向一个私有 git 远端并核对挂载行
dsh --profile web --dump-config | grep -A2 'id: session-sync'

然后在你的 profile patch 里设置远端(基线应是私有仓库)并同步:

- insert:
    - id: session-sync
      name: dsh-session-sync
      config:
        remote: [email protected]:you/your-dsh-sessions.git
> /sync status
> /sync pull
> /sync push

安装与卸载

  • git 通道(最新 main):dsh plugin --profile web add github:PerryLink/dsh-session-sync(等价于从 git+https://github.com/PerryLink/dsh-session-sync.git 安装)。无构建步骤 —— index.mjs 与 lib/ 即发布产物。
  • npm 通道(已发布版本):dsh plugin --profile web add dsh-session-sync。
  • tarball 通道:在本仓库执行 pnpm pack,然后 dsh plugin --profile web add ./dsh-session-sync-<version>.tgz。
  • 卸载:dsh plugin --profile web remove dsh-session-sync(或从 profile patch 删除该行)。

示例

以下为插件真实入口;安装后调用一个即可。

详细示例

命令

/sync help

输出

sync: usage — /sync [status | pull | push | diff | log | help]
  status  show mirror state (default): branch, remote, ahead/behind, dirty, forks
  pull    fetch + merge remote changes (keep-both; confirms first)
  push    mirror + commit + push local changes (confirms first)
  diff    uncommitted changes + HEAD..remote stat (read-only)
  log     last commits in the sync repository

来源 index.mjs:754-765 (registered /sync handler)

失败分支

输入

/sync push

输出

sync: cancelled: approval requires an open turn; /sync commands run between turns — mount userQuestions or set confirmVia: userQuestions

来源 plugins/dsh-session-sync/lib/gate.mjs:134-137; plugins/dsh-session-sync/index.mjs:792-794; plugins/dsh-session-sync/test/gate.test.mjs:80-88; plugins/dsh-session-sync/README.md:246

简短示例

  • /sync diff
  • /sync pull

配置

所有可调项都是 Schemastery Config 字段(可从 cordis.yml 覆盖)。按 id 的覆盖会替换整行 —— 重述你需要的每个键。cordis.patch.yml 对每个键都有行内注释。

键 默认值 含义
enabled true 总开关;false 卸载命令、工具、监听器与自动模式
backend git 同步后端:git(明文镜像)或 encrypted(age 加密镜像内容)
sessionRoot '' 会话存储根;空 = $DSH_HOME/sessions(两者皆缺加载失败)
repoDir '' 同步工作树根;空 = $DSH_HOME/dsh-session-sync/repo
remote '' 远端地址(pull/push 前必须非空;status/diff 无需)
branch main 远端分支名
gitBin git git 可执行路径
ageBin age age 可执行路径(backend: encrypted 时探测;缺失降级明文)
ageRecipient '' age 收件人(公钥/身份串);空 = 无法加密、降级明文
ageIdentity '' 无口令 age 私钥文件路径(用于解密);空 = 无法解密、降级明文
autoPullOnStart false 插件挂载时拉取一次(配置即授权,不再确认)
autoPushOnTurnEnd false 每个关闭轮次后推送
pullIntervalMinutes 0 每 N 分钟周期拉取(0 = 关闭,最大 10080)
confirmVia auto 确认通道:auto(优先 userQuestions,其次 approval)、userQuestions、approval
graceMs 10000 git 终止宽限(毫秒)
commandTimeoutMs 120000 单条命令超时(毫秒)
maxOutputBytes 262144 单流收集输出上限(字节)
commitName dsh-session-sync 提交者名
commitEmail dsh-session-sync@localhost 提交者邮箱
registerCommand true 注册 /sync 命令
registerTools true tools 服务存在时注册 sync_* 工具

在你的 profile patch 中的覆盖示例:

- insert:
    - id: session-sync
      name: dsh-session-sync
      config:
        remote: [email protected]:you/your-dsh-sessions.git
        branch: main
        autoPushOnTurnEnd: true
        pullIntervalMinutes: 30
        confirmVia: userQuestions

工具与界面

界面 只读 需要确认 说明
/sync status ✅ — 分支、脱敏远端、领先/落后、未提交文件、fork 文件、最近推/拉
/sync diff ✅ — 未提交变更 + HEAD..remote 统计(只读)
/sync log ✅ — 同步仓库最近提交
/sync pull ✅ fetch + 合并(两边保留语义;本地保留、远端留存为 fork)
/sync push ✅ 镜像 + 提交 + 推送;绝不强推,被拒时拉取调和后重试一次
sync_status ✅ — 为模型提供 /sync status 同样的信息
sync_pull ✅ 模型可调用的拉取
sync_push ✅ 模型可调用的推送

权限与数据

  • 权限:写操作走确认门(confirmVia);插件从不重新实现或绕过 harness 的 userQuestions/approval 服务。自动模式由配置授权覆盖,不再确认。
  • 数据:同步元数据(设备 id、最近推/拉、最近推送头、最近错误)存于 session-sync 存储领域。会话文件按不透明字节复制 —— 插件从不解析它们。设备 id 也写入同步仓库的 device.txt,用于跨设备 fork 归属。
  • 会话日志:sync/push、sync/pull、sync/conflict 在 types.d.ts 中声明;仅当宿主收录这些类型时才追加(见已知限制)。所有写入与展示的内容都经过脱敏。插件写入的唯一持久消息——冲突 fork 通知——携带插件自有的 producer-owned source kind(dsh-session-sync);宿主已退役共享的 plugin kind,读回会话时一律拒收。

安全边界

  • 绝不静默覆盖。 append-only 三分支合并在任何分歧时都保留两边;fork 文件永不被删除,git 绝不强推、reset、rebase 或切换分支。
  • 路径收容。 文件按不透明字节镜像、拒绝符号链接,每次路径拼接都做收容校验(PATH_UNSAFE 响亮失败)。
  • 脱敏输出。 远端 URL 凭据、令牌与 key=value 密钥在进入模型或日志前被打码;路径展示拒绝根外路径。
  • 不存凭据。 插件自身不存凭据;git 凭据由你常规的 git credential helper 管理。age 身份/接收方文件由你管理,密钥绝不进入同步仓库。
  • git 加固。 git 以 GIT_TERMINAL_PROMPT=0、GIT_OPTIONAL_LOCKS=0 运行,带截止时间与信号边界,输出按流封顶。
  • 失败关闭。 缺少确认回答者、缺少远端或不安全路径都会响亮拒绝操作。

加密与威胁模型

backend: encrypted 在镜像之上增加一层可选的 age 加密:会话字节在提交与推送前加密为 encrypted/**/*.age 文件,合并前再解密回本地明文镜像。三方合并始终在本地明文上进行,因此追加式保留双方语义不变。

加密保护什么:

  • 远端中的镜像内容。 你推送的会话文件是 age 密文;远端主机、其运维者以及任何克隆该仓库的人,没有私钥都看不到明文的会话字节。

加密不保护什么(边界):

  • 密钥与 age 身份由你管理。 接收方/身份文件从不由插件随包分发、存储或轮换。密钥泄露会使它保护的镜像内容暴露。请使用无口令身份并把它放在仓库之外。
  • 远端实际仍是私有仓库。 git 元数据——提交信息、.gitignore、encrypted/ 路径结构、分支名与推拉活动——对远端主机依然可见。加密隐藏的是内容,不是你在同步这个事实,也不是会话树的形态。
  • 明文仍存在于本地。 <repoDir>/sessions/ 的镜像在磁盘上是明文;加密保护的是传输中/远端的那份,而非本地磁盘加密或正在使用的会话存储。
  • 优雅降级意味着明文。 使用 backend: encrypted 时,若 age 缺失,或 ageRecipient/ageIdentity 为空,插件会回退到明文 git 路径并在状态/日志中显式告警——它绝不假装已经加密。在把远端当作已加密之前,先检查 /sync status 中的告警。

基线:backend: git(默认)下,会话字节以未加密形式存放在你的 git 远端——请使用私有仓库。

已知限制

  • 加密可选。 backend: encrypted 增加一层 age 加密(见上文「加密与威胁模型」);age 或密钥缺失时它会显式告警并降级为明文。backend: git(默认)下,会话字节以未加密形式存放在你的 git 远端 —— 请使用私有仓库。
  • 依赖 git。 插件需要 git 可执行文件与 subprocess 服务;没有它们时同步操作会给出明确原因失败(profile 仍可启动)。
  • 0.1.0-rc.6/0.1.0-rc.8/0.1.1-rc.2/0.1.2-alpha.2/0.1.2-alpha.3/0.1.2-rc.1/0.1.7-alpha.2 上的会话事件。 harness 尚未收录 sync/* 事件类型,因此会话日志追加被跳过(会话仍可加载);宿主收录类型或 Session.append 暴露 ignorable 信封后插件会自动开启。
  • 轮次间的 approval。 /sync 在轮次之间运行,approval 通道没有开放轮次可挂靠;请对命令式同步使用 confirmVia: userQuestions,或在轮次内经工具驱动同步。开放轮次判定读宿主 turnBoundary 会话投影:未组合 @deepseek-ai/dsh-session-projection 时无法核实轮次状态,按失败关闭并给出该原因。
  • 宿主私有产物不进同步。 session.lock(宿主会话租约)与 session.migration.*.tmp(迁移暂存)永不镜像、永不删除——它们是运行时状态而非可同步内容;会话日志(session.jsonl、session.v[1-9]*.jsonl[.zstd])仍是镜像载荷。

开发

pnpm install                                       # node ^22.19 || >=24
pnpm run typecheck && pnpm run typecheck:ci        # tsc --checkJs,针对已发布的 0.1.7-alpha.2 peers
pnpm test                                          # node --test(13 个测试文件;git 引擎套件在无 git 时跳过)
pnpm run verify:self-contained                     # 依赖 spec 可从 registry 解析
pnpm run verify:artifacts                          # 发布文件齐全 + index.mjs 可 import
pnpm run check:readmes                             # 五语 README 一致性
pnpm pack                                          # 发布 tarball

无构建步骤:纯 ESM,index.mjs 与 lib/ 即发布产物。

Topics

dsh, dsh-plugin, deepseek-harness, deepseek, cordis, session-sync, session, git, sync, cross-device

贡献者

  • @PerryLink —— 创建者与维护者:git 镜像引擎、append-only 两边保留合并、/sync 命令与 sync_* 工具、自动模式、脱敏器与五语文档。

PerryLink DSH Plugin Family

本项目是 PerryLink 维护的 DeepSeek Harness 插件家族成员。完整名单默认折叠,避免每个 README 的首屏被长表淹没;点击展开可查看每一行及其状态。

展开全部插件
插件 状态
dsh-aqua-input-check
dsh-archive-check
dsh-auto-review
dsh-autotier
dsh-bid-ca-precheck
dsh-bid-qual-check
dsh-cert-mcp
dsh-checkpoint-rewind
dsh-click
dsh-composer-history
dsh-contract-stance
dsh-customs-doc-check
dsh-data-quality
dsh-demurrage-ledger
dsh-doublecheck
dsh-drill-script-check
dsh-eia-guide-check
dsh-emergency-plan
dsh-essay-rubric-check
dsh-evidence-check
dsh-export-ctl-check
dsh-fast
dsh-fmea-table-check
dsh-forecast-penalty
dsh-fund-research
dsh-github
dsh-gongwen-flow-check
dsh-gongwen-word-check
dsh-guard-plan-qc
dsh-hazchem-check
dsh-hazplan-check
dsh-hidden-risk-map
dsh-hs-classify
dsh-icd-rule-check
dsh-industry-research
dsh-lawcite-adapter
dsh-laya
dsh-lc-doc-check
dsh-learning-gap-check
dsh-library
dsh-local-ai
dsh-lsp-actions
dsh-mask
dsh-mcp-panel
dsh-medrec-qc
dsh-memento
dsh-nsfc-form-check
dsh-nurse-record-check
dsh-observe
dsh-origin-rvc-check
dsh-ota-review-check
dsh-output-styles
dsh-paper-doc-adapter
dsh-permission-rules
dsh-permit-report-check
dsh-pipeline-check
dsh-pleading-draft
dsh-plugin-doctor
dsh-plugin-guide
dsh-plugin-kit
dsh-plugin-upgrade
dsh-policy-brief-draft
dsh-power-loss-split
dsh-power-ticket-check
dsh-ppap-check
dsh-protest-deadline
dsh-railway-window
dsh-repair-order-qc
dsh-research-report
dsh-review-reply-check
dsh-rulefile-check
dsh-safety-brief-check
dsh-score
dsh-session-sync
dsh-site-log-check
dsh-skill-pack-security
dsh-soe-decision-check
dsh-soilwater-check
dsh-sop-sync-check
dsh-spc-gbt-adapter
dsh-talk
dsh-tender-extract
dsh-tender-matrix
dsh-test-drive
dsh-ticktick
dsh-translate
dsh-warranty-calc
dsh-budget 🧊 已冻结 — 见仓库 README
dsh-claude-move 🧊 已冻结 — 见仓库 README
dsh-defend 🧊 已冻结 — 见仓库 README
dsh-draw 🧊 已冻结 — 见仓库 README
dsh-reach 🧊 已冻结 — 见仓库 README
dsh-background-agents 🚫 已退役 — 见仓库 README
dsh-session-pin 🚫 已退役 — 见仓库 README
dsh-team-rooms 🚫 已退役 — 见仓库 README

许可证

LICENSE (Apache License 2.0) © 2026 dsh-session-sync contributors