dsh-log-contract 0.3.20 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +27 -0
  2. package/README.zh.md +26 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -344,6 +344,33 @@ MIT © OfferKuai Team
344
344
 
345
345
  ---
346
346
 
347
+ ## 🆕 0.3.18 – 0.3.21 · DSH 0.2.x (session format v4) support
348
+
349
+ **Session format v4** (`@deepseek-ai/dsh-session` 0.2.x) is now validated by format-version dispatch
350
+ rather than by relaxing the format gate:
351
+
352
+ - `tool/result` is validated with the v4 shape (`role: 'tool'`, no `tool-result` wrapper block)
353
+ - `system/message` accepts v4's `source.kind: 'system-prompt'`
354
+ - validation for v3 and earlier is **unchanged** (identical verdicts on 408 real v3 sessions before/after)
355
+ - the format gate still rejects **unknown** future versions (`readOnly`); v5+ remains unassessable by design
356
+
357
+ **New rules (51 total):**
358
+
359
+ | Rule | Checks |
360
+ |---|---|
361
+ | `G4` | unknown historical events may be declaratively skipped (`ignorable: true`; allow-list injectable) |
362
+ | `S10` | `sourceEventSeqs` elements: non-negative integers after decoding (official interval pairs allowed in storage) |
363
+ | `I2` | `seedLength` means *number of inherited events* (not bytes); `parentSession` + missing/0 is legal |
364
+ | `P5` | two-segment carrier pairing: 2nd segment's first seq == 1st segment seq (read side accepts the legacy order) |
365
+ | `A1` | "in-place restorable" is judged from structured fields only (`archiveRef` / `archive` / `externalized.*`) — never from free text |
366
+
367
+ **Large sessions:** reading is line-wise (no whole-file stringification ⇒ no `ERR_STRING_TOO_LONG` above ~536 MB),
368
+ and repair rebuilds `.jsonl.zstd` with streaming frames (header frame + chunked body frames, per-frame checksum + round-trip).
369
+
370
+ **Windows:** the `header.cwd` absolute-path check in `H2` is platform-aware (`win32` and `posix` both accepted).
371
+
372
+ **Compatibility:** Node ≥ 22; `@deepseek-ai/dsh-session` `^0.1.0-rc.7 || ^0.1.5-rc.1 || ^0.2.0-rc.1`; session formats v0–v4.
373
+
347
374
  ## ⚠️ Upgrading to 0.3.17 — behaviour changes you must know (0.3.12 → 0.3.17)
348
375
 
349
376
  > **0.3.17 changes no behaviour.** It only adjusts the wording of comments, test titles, a few
package/README.zh.md CHANGED
@@ -295,6 +295,32 @@ MIT © OfferKuai Team
295
295
 
296
296
  ---
297
297
 
298
+ ## 🆕 0.3.18 – 0.3.21 · 支持 DSH 0.2.x(会话格式 v4)
299
+
300
+ **会话格式 v4**(`@deepseek-ai/dsh-session` 0.2.x)改为**按格式版本分派规则**,而不是放宽格式闸门:
301
+
302
+ - `tool/result` 按 v4 形状校验(`role: 'tool'`、无 `tool-result` 包裹块)
303
+ - `system/message` 接受 v4 的 `source.kind: 'system-prompt'`
304
+ - **v3 及更早的判据零改动**(408 份真实 v3 会话前后判定完全一致)
305
+ - 格式闸门仍**拒绝未知的未来版本**(`readOnly`);v5+ 按设计保持"不可评估"
306
+
307
+ **新增规则(共 51 条):**
308
+
309
+ | 规则 | 判据 |
310
+ |---|---|
311
+ | `G4` | 未知历史事件可**声明式跳过**(`ignorable: true`;白名单可注入) |
312
+ | `S10` | `sourceEventSeqs` 元素:**解码后**必须为非负整数(存储层允许官方区间对) |
313
+ | `I2` | `seedLength` = **继承事件条数**(非字节);`parentSession` 存在且缺失/0 属合法 |
314
+ | `P5` | 两段 carrier 配对:第 2 段首元素 = 第 1 段 seq(读侧兼容早期写法) |
315
+ | `A1` | 「在位可还原」**只认结构化字段**(`archiveRef`/`archive`/`externalized.*`),不从自由文本推断 |
316
+
317
+ **大会话**:读取改为**按行解码**(不再整文件字符串化 ⇒ 约 536MB 以上不再抛 `ERR_STRING_TOO_LONG`);
318
+ 修复采用**流式帧重建** `.jsonl.zstd`(header 帧 + 正文分块多帧,逐帧 checksum + roundtrip 校验)。
319
+
320
+ **Windows**:`H2` 的 `header.cwd` 绝对路径判断改为**平台感知**(`win32` 与 `posix` 都认)。
321
+
322
+ **兼容性**:Node ≥ 22;`@deepseek-ai/dsh-session` `^0.1.0-rc.7 || ^0.1.5-rc.1 || ^0.2.0-rc.1`;会话格式 v0–v4。
323
+
298
324
  ## ⚠️ 升级到 0.3.17 —— 必须知道的行为变更(0.3.12 → 0.3.17)
299
325
 
300
326
  > **0.3.17 不含行为变更。** 它只调整了注释、测试标题、少量诊断文案与 README 的措辞。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-log-contract",
3
3
  "description": "日志契约守护 — DSH session log contract guard: offline health check (CLI) + pre-write validation for DeepSeek Harness session logs",
4
- "version": "0.3.20",
4
+ "version": "0.3.21",
5
5
  "packageManager": "pnpm@11.7.0",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",