omdsh-dev/dsh-session-health 预览 preview

omdsh-dev/dsh-session-health

DSH 会话健康检查插件:多帧 zstd 会话文件的帧级扫描诊断(torn/损坏/空会话检测),零依赖只读,注册 session_health 工具

Project Overview项目介绍

This is a native diagnostic plugin built exclusively for DeepSeek Harness (DSH) that performs frame-level health checks on multi-frame zstd session files stored in the $DSH_HOME/sessions directory. It was developed after an investigation into DSH session loading failures that revealed DSH stores sessions as concatenated zstd frames, a structure that often causes misdiagnosis of empty sessions when using incorrect single-frame decoding. It detects a wide range of issues including missing sessions, empty files, corrupted zstd frames, interrupted writes, stray temporary files, and incorrectly structured session data, then outputs structured JSON reports with suggested fixes, and operates strictly in read-only mode, never modifying any user files.

When DSH users experience issues like failed session loading or missing conversation content, they can ask their DSH agent to run the session_health tool to scan the entire sessions directory or a specific single session. This produces a clear report that categorizes all detected issues and lists actionable suggestions to resolve them, which can then be passed to the complementary dsh-session-repair-skill tool for automated fixes if needed. The plugin follows official DSH plugin installation conventions, and can be installed directly via DSH’s built-in plugin management command from the public GitHub repository, a pre-built local npm pack tarball, or a local development directory for monorepo setups.

The plugin is released under the open-source MIT license, and has full test coverage for core functionality including zstd frame scanning, path security, and report generation. Deep analysis mode uses a dynamic import of the official DSH zstd decoder; if the decoder package cannot be loaded, the plugin will explicitly fall back to basic frame-level scanning and mark the result as deep: "unavailable" in the output report. Event batch count estimates are noted as approximate in the output, not an exact count, and users need to install the plugin separately for the web and headless DSH profiles, as the two profiles do not share installed plugins by default.

这是一款专为 DeepSeek Harness (DSH) 开发的原生会话健康检查插件,用于对 $DSH_HOME/sessions 目录下的多帧 zstd 会话文件做帧级扫描诊断,可识别损坏文件、空会话、不完整帧、残留文件等多种异常,输出结构化健康报告与清理修复建议。本工具严格保证只读,绝不修改或删除任何用户文件,和 dsh-session-repair-skill 修复工具互补,负责修复前的异常发现步骤,注册 session_health 工具供 DSH 代理直接调用。

当用户遇到 DSH 会话加载失败、会话内容无故丢失等异常问题时,可通过 DSH 代理调用本工具扫描整个会话目录,或是指定单个会话文件,获取明确的异常分类和针对性修复建议,帮助用户或后续修复工具定位问题根源。普通 DSH 用户、遇到会话异常问题的开发者都可以使用本工具,它遵循 DSH 官方插件规范,可直接通过 DSH 内置的插件管理命令完成安装和安装验证。

本插件采用 MIT 许可开源,深度分析模式依赖动态导入 DSH 官方的 zstd 解码器,如果无法加载对应包,会明确降级为仅做帧级基础扫描,并在报告中标注 deep: "unavailable"。当前已知事件批次估算为近似值而非精确计数,安装时需要注意 web 和 headless 是不同的 DSH 配置档,分别安装才能生效,全局安装不被推荐。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 8 stars - very few users, little community feedback星标只有 8,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:omdsh-dev/dsh-session-health

把 omdsh-dev/dsh-session-health 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-health

English

DSH 会话健康检查插件 —— 对 $DSH_HOME/sessions 下的多帧 zstd 会话文件做帧级扫描诊断(torn / 损坏 / 空会话 / stray 文件),输出健康报告与清理建议。只读:绝不修改或删除任何文件。

License

仓库:https://github.com/omdsh-dev/dsh-session-health(public)

动机

8/7 调查 issue #376 时对 39 个会话文件做了全量解码分析,过程中发现一个关键事实:DSH 会话文件是多个 zstd frame 的串联(一个 19MB 会话 = 119,952 个 frame),用单帧解码 API 读多帧文件只能看到 header——曾导致"会话全空"的误判。这套诊断逻辑值得产品化为工具:模型可以直接问"我的会话文件健康吗",而不是靠人手工写脚本。

与 dsh-session-repair-skill(修复损坏会话)互补:本工具只读诊断发现 → repair 技能修复。

安全模型

  • 只读保证:绝不修改/删除任何文件(测试覆盖"扫描后文件字节数不变",见 files.spec SH-06 用例)
  • 路径围栏:session id 严格目录名白名单(防 ../ 穿越);绝对路径与最终文件均做 fs.realpath 真实路径 containment(防符号链接/junction 逃逸);枚举用 lstat 拒绝 symlink
  • 零业务依赖:zstd 帧扫描器为独立实现(DataView 读字节,RFC 8878 结构,与官方 scanZstdFrames 差分一致)
  • 深度分析可选:deep: true 时动态 import 官方解码器;解析失败明确降级 deep: "unavailable",绝不静默
  • 输入范围固定(sessions 目录),无网络、无执行面

工具声明

注册 session_health 工具(@deepseek-ai/dsh-session-health,row id tool-session-health),统一输出 JSON 文本。

参数 类型 必填 说明
action string ✅ scan / file / stats
path string 文件绝对路径(须在 sessions 根内)或会话 id(file/stats 必需)
deep boolean 深度分析(解码事件统计),默认 false
detail boolean 列出异常文件(scan 默认 true);false 只出汇总

检测项

类别 判定
missing 会话 id 解析不到文件
empty 0 字节文件
not-zstd 前 4 字节非 28 b5 2f fd(明文 .jsonl 或损坏)
torn EOF 打断帧尾部(写入中断)
reserved-header / reserved-block 帧头/块头保留位非法(结构损坏)
bad-header deep 模式:首帧不是 session header
empty-session 只有 1 帧(header)且超过 1 分钟未更新
oversized-single-frame 单帧 > 1MB(正常多帧写入不会这样)
interrupted deep 模式:有 turn/start 无 turn/end(进程被杀/崩溃)
stray-file *.tmp / 非标准命名残留文件

报告含:root / scanned / errors / suspicious / totals(字节·帧数·事件批次估算) / detail / deep / suggestions(suggestions 按 issue 模板给出清理/修复建议,不自动执行)。

示例

session_health { action: "scan" }
  → {"root":"C:\\Users\\admin\\.dsh\\sessions","scanned":39,"errors":{...},"suspicious":{...},"suggestions":[...]}

session_health { action: "file", path: "session-abc123", deep: true }
  → 单文件报告(含事件分布与中断检测)

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-paste-input 下一个 Next dsh-mattpocock-skills →