dsh-edit-turn 0.2.9 → 0.2.10

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
@@ -219,6 +219,12 @@ ln -s /path/to/dsh-install/node_modules ./node_modules
219
219
 
220
220
  ### 更新日志
221
221
 
222
+ **0.2.10** —— 修「编辑器浮层留在设置页上」。
223
+
224
+ - **修复:会话视图卸载后编辑器没有跟着走**。编辑器挂在 `body` 的独立浮层上(这是为了躲开宿主重绘),而没有任何框架会替它收尾:切到设置页时对话视图(连同注册在输入框卡上的条目)卸载了,编辑器却留在浮层里**飘在设置页上**。现在条目卸载时清掉自己的编辑器与参考,空浮层也一并移除。
225
+ - 卸载判定不能"一有 cleanup 就清":这个 effect 在每次视图变化时都会先 cleanup 再重跑,硬清会把编辑器反复拆掉(焦点/草稿语义都会乱)。现在是**延迟清理**——下一次 effect 重跑会取消它,只有真正的卸载(不再重跑)才让它落地。
226
+ - 新增用例「会话视图卸载后编辑器跟着消失(浮层也不留)」+ 2 条静态检查;110 单测 / 80 契约 / 静态 / verify:live / verify:ui 全绿。
227
+
222
228
  **0.2.9** —— 修「同一条消息出现两个一样的气泡」。
223
229
 
224
230
  - **修复:一行两个替代气泡,两个来源都堵掉**。①气泡此前只认「行的直系子节点 / 紧邻前一个兄弟」,一旦被宿主挪开就认不出,下一趟又种一个;现在气泡带**行的 key 标记**(`data-dshet-revision-for`),挪到哪都找得回来,且每行只允许一个(多余的按标记清除)。②更隐蔽的一个:MutationObserver 的回调可能**晚于它所属的那次渲染**,带着**过期视图**(`hidden` 为空)跑一遍,把已折叠的行重新展开——原气泡就回到了替代气泡旁边;现在这趟 pass 从 `controller.getSnapshot()` 现取当前视图,过期视图再也不可能把行展开。
package/lib/client.js CHANGED
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
30
30
  const ROUTE_PREFIX = '/dsh-edit-turn'
31
31
 
32
32
  /** Keep in sync with package.json and lib/index.js. */
33
- const PLUGIN_VERSION = '0.2.9'
33
+ const PLUGIN_VERSION = '0.2.10'
34
34
 
35
35
  // --- copy -----------------------------------------------------------------
36
36
 
@@ -264,6 +264,7 @@ window.__ModuleLoader__.load({
264
264
  this.editorRow = null
265
265
  this.editorFocus = false
266
266
  this.editorDraft = ''
267
+ this.clearTimer = null
267
268
  this.confirming = false
268
269
  this.noticeTimer = null
269
270
  this.view = Object.freeze({
@@ -548,6 +549,9 @@ window.__ModuleLoader__.load({
548
549
  }
549
550
 
550
551
  dispose() {
552
+ if (this.clearTimer !== null) window.clearTimeout(this.clearTimer)
553
+ this.clearTimer = null
554
+ clearEditor()
551
555
  this.listeners.clear()
552
556
  if (this.noticeTimer !== null) window.clearTimeout(this.noticeTimer)
553
557
  this.noticeTimer = null
@@ -1003,6 +1007,12 @@ window.__ModuleLoader__.load({
1003
1007
  function clearEditor() {
1004
1008
  const elements = document.querySelectorAll('.dshet-editor')
1005
1009
  for (const element of elements) element.remove()
1010
+ // An empty layer has no business staying on the page: the editor is
1011
+ // hosted on the body, where nothing else clears up after it.
1012
+ if (editorLayer !== null && editorLayer.isConnected === true && editorLayer.children.length === 0) {
1013
+ editorLayer.remove()
1014
+ editorLayer = null
1015
+ }
1006
1016
  }
1007
1017
 
1008
1018
  // The layer the editor is hosted on. It is created once, hangs off the
@@ -1466,8 +1476,25 @@ window.__ModuleLoader__.load({
1466
1476
  else window.setTimeout(run, 16)
1467
1477
  })
1468
1478
  observer.observe(document.body, { childList: true, subtree: true })
1479
+ // This effect re-runs whenever the view changes, and its cleanup runs
1480
+ // first every time; only a REAL unmount means the conversation view
1481
+ // went away (switching to Settings, say) and the editor has to go with
1482
+ // it - left behind, it floated over whatever came next. So the clear is
1483
+ // deferred, and the next run of this effect cancels it.
1484
+ if (controller.clearTimer !== null) {
1485
+ window.clearTimeout(controller.clearTimer)
1486
+ controller.clearTimer = null
1487
+ }
1469
1488
  return () => {
1470
1489
  observer.disconnect()
1490
+ if (controller.clearTimer !== null) window.clearTimeout(controller.clearTimer)
1491
+ controller.clearTimer = window.setTimeout(() => {
1492
+ controller.clearTimer = null
1493
+ clearEditor()
1494
+ controller.editorBox = null
1495
+ controller.editorRow = null
1496
+ controller.editorElement = null
1497
+ }, 250)
1471
1498
  }
1472
1499
  }, [snapshot, view, controller, t])
1473
1500
 
package/lib/index.js CHANGED
@@ -22,7 +22,7 @@
22
22
  // admission path. It resumes the Session when cold and starts exactly one
23
23
  // new turn from the revised text.
24
24
  //
25
- // The silent replacement carrier is an EMPTY `developer/message` (0.2.9;
25
+ // The silent replacement carrier is an EMPTY `developer/message` (0.2.10;
26
26
  // before that an empty `system/message`, which no reader accepts - see the
27
27
  // README). Empty content projects to no model message, so the rollback adds
28
28
  // nothing the model can see and the derived context after an edit is exactly
@@ -60,7 +60,7 @@ export const PLUGIN_ID = 'dsh-edit-turn'
60
60
  export const name = PLUGIN_ID
61
61
 
62
62
  /** Keep in sync with package.json and lib/client.js. */
63
- export const PLUGIN_VERSION = '0.2.9'
63
+ export const PLUGIN_VERSION = '0.2.10'
64
64
 
65
65
  // A ring of the last few requests, answering "did the browser half even ask, and
66
66
  // 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.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Edit any user turn in DeepSeek Harness and re-run it: an inline editor on the message row rolls the conversation back to just before that turn through the official surface-replace contract, then re-prompts the agent with the revised text. The append-only session log is never rewritten.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",