dsh-session-repair
开发工具 活跃维护

dsh-session-repair

snow-The/dsh-session-repair

自动扫描并修复会话日志,将损坏的单帧zstd文件重编码回多帧布局,同时把未知事件类型(如llm/failover)标记为可忽略,确保旧工具仍能正常读取。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
45 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:snow-The/dsh-session-repair
git clone https://github.com/snow-The/dsh-session-repair.git
git clone git@github.com:snow-The/dsh-session-repair.git
README.md master

dsh-session-repair

Scans and repairs DSH session logs (~/.dsh/sessions/**/session.jsonl.zstd).

Fixes

  • Single-frame corrupt logs — a session file re-compressed as one zstd frame breaks
    the harness at boot (first frame is not exactly one header line). The plugin rebuilds
    the log in the canonical multi-frame layout: one JSON line per zstd frame.
  • Unknown event types — events written by newer harness builds (e.g. llm/failover)
    make older harnesses refuse the whole log (SessionFormatUnsupportedError). The plugin
    marks such events "ignorable": true (the event is kept; the harness skips it).

Tools

  • session_repair_scan — read-only report of every session log: zstd frame count,
    line count, header validity, parse errors, unknown event types.
  • session_repair_fix — repairs problem logs (or one sessionId). Backs up each file as
    <file>.bak-repair-<timestamp> before replacing it, then verifies the rebuilt layout
    (frames == lines). Restart the harness afterwards.

Requirements

  • zstd CLI on PATH (Debian/Ubuntu: apt install zstd).
  • The known-type allowlist is conservative; pass extraKnownTypes to fix if a type is
    actually known to the running harness.

Safety

  • Never writes in place: backup → rebuild to temp → verify → atomic rename.
  • Scan is strictly read-only.