dsh-edit-turn 0.5.12 → 0.5.14

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,12 @@ ln -s /path/to/dsh-install/node_modules ./node_modules
277
277
 
278
278
  ### 更新日志
279
279
 
280
+ **0.5.13** —— 打开着的会话直接从内存读事件,不再把整份日志从磁盘重新解码。
281
+
282
+ - **量出来的瓶颈**:把 `/state` 的每一段单独计时,插件自己的全部计算加起来只有几十毫秒(`foldSurface` 3 ms、`turnIndex` 6 ms、`rollbackLedger` 1 ms、回复列表 29 ms),而**读日志 + 解压**要 **1,408 ms**(15 MB 的会话)。不幸的是这条读路径优先走查询服务 —— 对**宿主已经打开**的会话,那等于把内存里现成的东西从磁盘再解一遍。
283
+
284
+ - **修法**:活着的会话直接用它自己的内存快照(`snapshotEvents()`),没有活的会话才走查询服务。打开着的会话(用户正在看的那个)因此从"秒级"降到"几十毫秒级"。
285
+
280
286
  **0.5.12** —— `/state` 只折一次表面;临时诊断撤掉。
281
287
 
282
288
  - **复制已确认修好**(根因是 `/state` 太大太慢:25 MB / 13 秒,那段时间里浏览器半部没有任何编辑条目,按下复制不会被接管)。所以 0.5.10 的自报诊断按计划撤掉。
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.12'
48
+ const PLUGIN_VERSION = '0.5.14'
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.12'
81
+ export const PLUGIN_VERSION = '0.5.14'
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
@@ -1484,6 +1484,13 @@ function eventsFromLive(session) {
1484
1484
  // Live-preferred read through the public query service; the live session's own
1485
1485
  // snapshot is the fallback when the service is absent.
1486
1486
  async function readEvents(ctx, sessionId) {
1487
+ // A session the host has open answers from memory. Going through the query
1488
+ // service instead makes the route re-decode the whole log from disk first:
1489
+ // measured 1.4 s for a 15 MB log, while every computation this route does on
1490
+ // top of it adds up to a few tens of milliseconds. That read was the entire
1491
+ // reason the edit entry took seconds to appear.
1492
+ const live = eventsFromLive(findLiveSession(ctx, sessionId))
1493
+ if (live !== undefined && live.length > 0) return live
1487
1494
  const query = ctx.get('sessionQuery')
1488
1495
  if (query && typeof query.readSession === 'function') {
1489
1496
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-edit-turn",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
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",