dsh-edit-turn 0.5.5 → 0.5.6

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.
package/README.md CHANGED
@@ -277,6 +277,18 @@ ln -s /path/to/dsh-install/node_modules ./node_modules
277
277
 
278
278
  ### 更新日志
279
279
 
280
+ **0.5.6** —— 裁剪工具改为"先验后写":用宿主自己的校验器验,验不过就不落盘。
281
+
282
+ - **校验不能自己写一份**:日志格式的规则全在宿主里,而且分三层——格式层(`dsh-session-format-v3-to-v4`)、会话层(`dsh-session` 的逐条准入与表面折叠)、投影层(`dsh-agent-loop` 的 inbox 拼接)。这次做裁剪时自己按理解写校验,结果是**连续八次被宿主拒收**:`title messageSeqs must name an earlier event`、`delivery throughSeq must precede its marker`、`system/message does not match an open turn and step`、`request/header is outside an open turn`、`turn/start does not open the expected turn`、`compaction shadowedSeqs do not name an exact current surface span`、`format v4 event N is not dense`、`successful compaction/end requires one summary`。
283
+
284
+ - **`tools/verify-session-log.mjs`(新)**:把宿主的包**从 app.asar 里取出来直接跑**。六项检查:格式层、会话层(`adoptSessionEvent` + `foldSurface`)、交叉引用(所有 `*Seq` / `*Seqs` / `*Range` 字段必须存在且更早)、inbox 投影(按投影层的规则重放拼接)、结构(seq 从 0 连续、表面区间合法)、标题(`fallback` 来源必须指向更早的消息)。命令:`node tools/verify-session-log.mjs <日志文件> [--json]`,不通过时退出码为 1。
285
+
286
+ 取包这一步有个坑:asar 的数据段起点是 **`8 + headerSize`**,不是 `16 + headerSize`。写成后者会让每个文件错位 8 字节、解出来的 JS 全部不可解析——这就是最初"没法用宿主自己的校验器"的原因。取出的包缓存在 `~/.cache/dsh-edit-turn/host-libs/`,只在首次或 asar 变化时重解。
287
+
288
+ - **落盘改为先验后写**:`--apply` 现在先把裁剪结果写到暂存文件、**用它跑完六项校验**,通过才把原文件改名成备份、暂存文件上位;任何一项不过就删掉暂存文件、原文件一个字节都不动(报出是哪一项、哪个细节)。校验器本身跑不起来(比如找不到 app.asar)同样拒绝写入——要强行跳过用 `--no-verify`。
289
+
290
+ - 新增 `tools/lib/host-libs.mjs`(asar 读取与宿主库解包)与 `test/apply.test.js`(暂存/提交/跳过校验/拒绝写入/编码往返)。这些都在 `tools/` 下,**不随 npm 包发布**(`files` 只含 `lib/`),仓库里可用。
291
+
280
292
  **0.5.5** —— 不再向模型暴露任何工具;新增会话日志裁剪工具。
281
293
 
282
294
  - **模型工具移除**:本插件原先注册了一个模型可见的工具(`edit_turn_targets`,给模型列可编辑的轮次/步骤)。它其实用不上——编辑是靠 UI 面板做的,模型不需要知道这件事——而且它把 `dsh-tools` 平台拖成了硬依赖。现在整个工具拿掉,插件不再注册任何模型可见的工具,也不再依赖 `dsh-tools`。
package/lib/client.js CHANGED
@@ -45,7 +45,7 @@ window.__ModuleLoader__.load({
45
45
  const RERUN_PREFIX = '/dsh-rerun-turn'
46
46
 
47
47
  /** Keep in sync with package.json and lib/index.js. */
48
- const PLUGIN_VERSION = '0.5.5'
48
+ const PLUGIN_VERSION = '0.5.6'
49
49
 
50
50
  // --- copy -----------------------------------------------------------------
51
51
 
package/lib/index.js CHANGED
@@ -78,7 +78,7 @@ export const PLUGIN_ID = 'dsh-edit-turn'
78
78
  export const name = PLUGIN_ID
79
79
 
80
80
  /** Keep in sync with package.json and lib/client.js. */
81
- export const PLUGIN_VERSION = '0.5.5'
81
+ export const PLUGIN_VERSION = '0.5.6'
82
82
 
83
83
  // A ring of the last few requests, answering "did the browser half even ask, and
84
84
  // what did it get?" without needing its console. Read-only diagnostics: the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-edit-turn",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Edit any message in DeepSeek Harness in place: a prompt is replaced where it stands; a model reply block (answer text or reasoning) is patched through a plugin record and a message projection, so the turn stays where it is, later turns are untouched and the log grows by one small record. Falls back to the replay splice on hosts without the projection API. The append-only session log is never rewritten.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",