dsh-rewind-plugin 0.2.8 → 0.2.9

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
@@ -45,14 +45,7 @@ Restart `dsh web` (`--profile web`) after installing.
45
45
 
46
46
  > ⚠️ The npm name `dsh-rewind` belongs to another author's package — install with `dsh-rewind-plugin`.
47
47
 
48
- From a local checkout or a pinned GitHub commit:
49
-
50
- ```sh
51
- dsh plugin --profile web add /path/to/dsh-rewind # local checkout
52
- dsh plugin --profile web add github:SiriLee/dsh-rewind#<sha> # pinned commit
53
- ```
54
-
55
- A git install fails on first run: pnpm blocks git dependencies from running build scripts. Follow the CLI hint to add an `allowBuilds` key to the profile's `pnpm-workspace.yaml`, then retry — pnpm runs the plugin's `prepare` (full build) and installs it.
48
+ For contributors: install from a local checkout or a pinned commit — `dsh plugin --profile web add /path/to/dsh-rewind` or `dsh plugin --profile web add github:SiriLee/dsh-rewind#<sha>`. A git install fails on first run until you add an `allowBuilds` key to the profile's `pnpm-workspace.yaml` (pnpm blocks git dependencies from running build scripts); after that it runs the plugin's `prepare` and installs it.
56
49
 
57
50
  ## Usage
58
51
 
@@ -70,7 +63,7 @@ The plugin appends an **empty-content marker** `assistant/message` into the sess
70
63
 
71
64
  - The marker carries `sourceEventSeqs` covering every shadowed node, and `Session.append`'s surface rules validate the cut (a contiguous range on the current surface).
72
65
  - Because the marker is **empty**, the harness derives it to `null` — it never enters the model context and never renders as conversation content. Agent and user both see the conversation exactly as it was at the target.
73
- - The marker's **turn number reuses the last started turn** (`markerTurnOf`), never `lastTurn + 1`: the harness numbers its next real turn exactly `last turn/start + 1`, so a `maxTurn + 1` marker would sit *before* that `turn/start` — the client conversation builder rejects the ordering (`…turn-tail… received an update before its start Match`), history load fails, and the whole conversation disappears from the UI (the real defect in ≤ 0.2.4, fixed in 0.2.5). Reusing an already-consumed turn makes the marker a harmless trailing update on the previous completed turn's tail — it can never collide with a future turn.
66
+ - The marker's **turn number reuses the last started turn** (`markerTurnOf`), never `lastTurn + 1`: the harness numbers its next real turn exactly `last turn/start + 1`, so a `maxTurn + 1` marker would sit *before* that `turn/start` — the client conversation builder rejects the ordering (`…turn-tail… received an update before its start Match`) and history load fails. Reusing an already-consumed turn makes the marker a harmless trailing update on the previous completed turn's tail — it can never collide with a future turn.
74
67
  - The append-only log is **untouched** — every withdrawn event stays in the audit trail; only the model-visible surface is cut, so the next request derives its context from the target onward.
75
68
 
76
69
  A running turn (LLM thinking / streaming) is force-stopped first (`cancel({ kind: 'user' })`) and the rewind waits for quiescence; if it can't stop, the rewind is aborted with an error.
@@ -130,7 +123,7 @@ This plugin only appends rewind-marker events to the session log; it never delet
130
123
  ```sh
131
124
  npm install # devDeps from the npm registry
132
125
  npm run typecheck # tsc on both compilation surfaces (host + client)
133
- npm test # vitest: rewind / snapshot / hidden / session-cwd / integration (46 cases)
126
+ npm test # vitest: rewind / snapshot / hidden / session-cwd / integration
134
127
  npm run build # esbuild: lib/index.js (host ESM) + lib/client.js (loader closure) + .d.ts
135
128
  node scripts/verify-host.mjs # boot the BUILT host artifact end-to-end (18 checks)
136
129
  ```
package/README.zh.md CHANGED
@@ -45,14 +45,7 @@ dsh plugin --profile web add dsh-rewind-plugin
45
45
 
46
46
  > ⚠️ npm 上的 `dsh-rewind` 属于其他作者,请用 `dsh-rewind-plugin` 安装。
47
47
 
48
- 本地 checkout 或 pin 一个 GitHub commit:
49
-
50
- ```sh
51
- dsh plugin --profile web add /path/to/dsh-rewind # 本地 checkout
52
- dsh plugin --profile web add github:SiriLee/dsh-rewind#<sha> # pin commit
53
- ```
54
-
55
- git 安装首次会失败:pnpm 默认禁止 git 依赖执行构建脚本。按 CLI 提示在 profile 的 `pnpm-workspace.yaml` 中加 `allowBuilds` 后重试——pnpm 会执行插件的 `prepare`(完整构建)并装入 profile。
48
+ 给贡献者:可从本地 checkout 或 pin commit 安装——`dsh plugin --profile web add /path/to/dsh-rewind` 或 `dsh plugin --profile web add github:SiriLee/dsh-rewind#<sha>`。git 安装首次会失败:pnpm 默认禁止 git 依赖执行构建脚本,需先在 profile 的 `pnpm-workspace.yaml` 加 `allowBuilds`;之后 pnpm 会执行插件的 `prepare`(完整构建)并装入 profile。
56
49
 
57
50
  ## 使用
58
51
 
@@ -70,7 +63,7 @@ git 安装首次会失败:pnpm 默认禁止 git 依赖执行构建脚本。按
70
63
 
71
64
  - 标记携带 `sourceEventSeqs` 覆盖所有被遮蔽节点,`Session.append` 的 surface 规则校验切割合法性(仅限当前 surface 上的连续区间)。
72
65
  - 因为标记**内容为空**,harness 会将其派生为 `null`——永不进入模型上下文、也永不渲染成对话内容。agent 与用户看到的对话都回到目标消息当时的样子。
73
- - 标记的 **turn 号复用最后一个已开始的回合**(`markerTurnOf`),而不是「最后回合 + 1」:harness 恰好用 `最后 turn/start + 1` 编号下一条真实回合。若标记也取这个数,日志里就会出现同一 turn 的 `assistant/message` 先于 `turn/start` 的乱序,客户端 conversation 构建器会以 `conversation Context …:turn-tail… received an update before its start Match` 拒绝重放——历史加载失败、整个对话从界面消失(0.2.4 及之前的真实缺陷,已在 0.2.5 修复)。复用已消费的 turn 号则标记只是上一个已完成回合尾部的一次无害追加,永不与新回合冲突。
66
+ - 标记的 **turn 号复用最后一个已开始的回合**(`markerTurnOf`),而不是「最后回合 + 1」:harness 恰好用 `最后 turn/start + 1` 编号下一条真实回合。若标记也取这个数,日志里就会出现同一 turn 的 `assistant/message` 先于 `turn/start` 的乱序,客户端 conversation 构建器会以 `conversation Context …:turn-tail… received an update before its start Match` 拒绝重放——历史加载失败、整个对话从界面消失。复用已消费的 turn 号则标记只是上一个已完成回合尾部的一次无害追加,永不与新回合冲突。
74
67
  - append-only 日志**不被改写**——审计轨迹完整保留每条被撤回的事件,只有模型可见的 surface 被剪掉,下一条请求从目标消息起派生上下文。
75
68
 
76
69
  若 agent 正在运行(LLM 思考/流式输出),会先强制停止(`cancel({ kind: 'user' })`)并等待 quiescence 再回退;停不下来则中止并报错。
@@ -130,7 +123,7 @@ git 安装首次会失败:pnpm 默认禁止 git 依赖执行构建脚本。按
130
123
  ```sh
131
124
  npm install # devDeps 来自 npm registry
132
125
  npm run typecheck # tsc 双面编译(host + client)
133
- npm test # vitest:rewind / snapshot / hidden / session-cwd / 集成(46 例)
126
+ npm test # vitest:rewind / snapshot / hidden / session-cwd / 集成
134
127
  npm run build # esbuild:lib/index.js(host ESM)+ lib/client.js(loader 闭包)+ .d.ts
135
128
  node scripts/verify-host.mjs # 端到端验证构建产物(18 项检查)
136
129
  ```
@@ -48,7 +48,7 @@ src/client/styles.ts injected styles (dsh design tokens)
48
48
  scripts/build.mjs esbuild: lib/index.js (host ESM) + lib/client.js (loader closure) + .d.ts
49
49
  scripts/verify-host.mjs end-to-end host verification (18 checks)
50
50
  scripts/repair-markers.mjs offline marker-turn repair tool (ships as `dsh-rewind-repair`)
51
- tests/ vitest suites (rewind / snapshot / hidden / session-cwd / integration, 46 cases)
51
+ tests/ vitest suites (rewind / snapshot / hidden / session-cwd / integration)
52
52
  docs/ maintainer docs: harness reference, troubleshooting, release steps
53
53
  assets/screenshots/ UI screenshots
54
54
  cordis.patch.yml bundle patch (mounts the dual-face plugin row)
package/lib/client.js CHANGED
@@ -558,10 +558,12 @@ function RewindPortals({ sessionId, sessionOf, currentSessionId, t, subscribeLoc
558
558
  const anchor = key !== void 0 ? chat.nodes.get(key)?.anchorSeq : void 0;
559
559
  if (anchor !== void 0 && hiddenSeqs.has(anchor)) {
560
560
  seat.style.display = "none";
561
+ seat.dataset.dshRewindHidden = "true";
561
562
  hidden.current.add(seat);
562
563
  hiddenCount += 1;
563
564
  } else if (hidden.current.has(seat)) {
564
565
  seat.style.display = "";
566
+ delete seat.dataset.dshRewindHidden;
565
567
  hidden.current.delete(seat);
566
568
  }
567
569
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-rewind-plugin",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "DeepSeek Harness plugin: in-place conversation rewind in the same session window (Claude Code /rewind semantics) with optional workspace file restore",
5
5
  "keywords": [
6
6
  "deepseek-harness",