ClawsJoy/dsh-plugins--packages-session-retention ↗★ 0

@clawsjoy/dsh-session-retention

Never front-truncate a DSH session log: keeps logs whole by default and treats the size cap as opt-in, because a rotated log cannot be loaded (seq gap in committed region). 适合需要避免 DSH 默认 50MB 日志轮转导致会话因 seq 缺失而无法打开的用户。

패키지
@clawsjoy/dsh-session-retention
호환성
미검증
Harness peer 범위
>=0.1.0-rc.5 <0.2.0
Cordis peer 범위
^4.0.0
버전
0.1.1
라이선스
MIT
최근 업데이트
2026. 9. 21.

설치

검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗

@clawsjoy/dsh-session-retention

The DSH jsonl session backend with the size-cap rotation neutralised by default.

Why

DSH's jsonl backend rotates a log that crosses maxLogBytes (50 MiB default) by renaming it aside and re-materialising a header-only live file. The live log therefore continues from a non-zero seq, and the session loader refuses such a log:

corrupt session log: seq gap in committed region at line 1
(expected 0, got 5528588)

Measured on a real session (2026-09-22): the session stayed listable but unopenable — the worst kind of failure, because nothing in the UI or the logs explains it. Repair required splicing the archived half back in by hand.

What this plugin does

It extends JsonlSessionPersistence and changes exactly one thing: the maxLogBytes handed to the backend.

upstream jsonlthis plugin
size cap50 MiB, rotationeffectively unlimited (1 TiB) unless you opt in
whole-session count cap (maxSessionsPerProject)inheritedinherited (safe: prunes whole sessions, never truncates a log)
everything else (service key, config schema, create/append/load/repair)—inherited

Opting back into rotation is a deliberate, documented choice: set maxLogBytes explicitly and it is honoured (the log line in retention.reason records that it was an opt-in).

Install

dsh plugin --profile web add @clawsjoy/dsh-session-retention
- id: session-persistence-jsonl
  disabled: true
- insert:
    - id: session-retention
      name: '@clawsjoy/dsh-session-retention'
      config:
        root: !!js dshHomePath('sessions')
        # maxSessionsPerProject: 50    # whole-session pruning (safe)
        # maxLogBytes: 209715200       # opt in to rotation — see "Why" first

Verification

pnpm test

The suite's negative control asserts the upstream default would rotate a 65 MiB log — the size that actually broke a session — while this plugin's resolved cap does not.

License

MIT