@240xu/dsh-message-ops 0.11.0 → 0.11.2

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
@@ -5,6 +5,18 @@ DSH web 插件:**消息回滚 + 删除 + 恢复**。只补 dsh 官方**没有*
5
5
  > **0.9.0 是破坏性变更**:移除了本插件的**分支**与 **Markdown 导出**。
6
6
  > 两者 dsh 官方都已有(`session/fork` 与 `/api/session.export`),详见下方「为什么不重复造轮子」。
7
7
 
8
+
9
+ ## 10 秒速查
10
+
11
+ ```sh
12
+ dsh plugin --profile web add @240xu/dsh-message-ops
13
+ # 重启 dsh web 后,会话头部点 Message ops
14
+ ```
15
+
16
+ - 能做什么:回滚到任意消息、只删一条、恢复;分支调用官方 session/fork
17
+ - 不能做什么:Markdown 导出(请用官方 `/api/session.export`)
18
+ - 卸载:`dsh plugin --profile web remove @240xu/dsh-message-ops`
19
+
8
20
  ## 官方没有、本插件提供的
9
21
 
10
22
  | 能力 | 官方 dsh 0.2.0-rc.2 | 本插件 |
@@ -25,13 +37,15 @@ DSH web 插件:**消息回滚 + 删除 + 恢复**。只补 dsh 官方**没有*
25
37
 
26
38
  ## 用法
27
39
 
28
- - **会话头部**的 `Message ops (revert / delete / branch)` 按钮 → 统一对话框
40
+ - **会话头部**的 `Message ops` 按钮 → 右侧 `OpsPanel` 抽屉(消息 / 回收站双 tab);
41
+ 旧 `OpsDialog` 仅 `window.__MOPS_LEGACY_DIALOG === true` 时回退
29
42
  - **助手消息** hover 行的 `Revert to here` / `Quote to composer`
30
43
  - **用户消息** hover 行的 `Revert to here`
31
- - **输入框上方的回撤贴条**:展开后可逐条 `Restore`(这是恢复的唯一入口)
44
+ - **输入框上方的回撤贴条**:展开后可逐条 `Restore`(消息级恢复入口)
32
45
  - **侧栏会话行**的 `...` 菜单
33
46
 
34
- 对话框流程:**先在列表里选一条消息 → 上方出现三个操作 → 破坏性操作需勾选确认**。
47
+ 面板流程:**选一条消息 → 回滚 / 仅删除 / 分支 → 破坏性操作二次确认**;
48
+ 整会话删除在回收站 tab,需输入会话标题确认。
35
49
 
36
50
  ## 安装
37
51
 
@@ -54,8 +68,11 @@ dsh plugin --profile web add file:C:/path/to/dsh-message-ops
54
68
 
55
69
  - 回滚/删除不重写日志:通过一条承载 `surfaceOp: replace` 的 system 事件实现,
56
70
  约束由 DSH 引擎 `assertProvenance` 校验,违规如实上报(HTTP 409)。
57
- - 回滚/删除前必须勾选风险确认;运行中的会话一律拒绝(提示先停止)。
58
- - 分支先写临时文件再原子 rename,半写日志不会被会话扫描读到。
71
+ - 回滚/删除前必须二次确认;运行中的会话一律拒绝(提示先停止)。
72
+ - 分支走官方 `sessions.fork`(要求先停止运行中的会话),插件不再写磁盘分支。
73
+ - 插件 GET 与宿主 `/api` 同条件校验 BrowserAuth cookie;有 `credentials` 服务但
74
+ `client-connection/browser-session` 记录不可读时 401 fail-closed,无该服务的老宿主
75
+ 保留旧围栏。
59
76
 
60
77
  ## 端点
61
78
 
@@ -63,16 +80,27 @@ dsh plugin --profile web add file:C:/path/to/dsh-message-ops
63
80
  |---|---|---|
64
81
  | GET | `/api/message-ops/messages?sessionId=<id>` | 消息级列表(磁盘真相 + 可见性标注 + running 状态);`&view=compact` 只回 `seq/role/snippet/time/visible/shadowed`(体积约 −54%) |
65
82
  | GET | `/api/message-ops/search?sessionId=<id>&q=&role=&limit=` | 服务端全文检索(含已回滚消息之外的全部文本),返回 query 对齐片段 |
83
+ | GET | `/api/message-ops/text?sessionId=<id>&seq=` | 单条消息全文(引用按钮按需取) |
66
84
  | GET | `/api/message-ops/session/trash` | 回收站列表(自动清理过期条目) |
67
85
  | POST | `/api/message-ops/revert` | `{sessionId, seq}` 回滚到该条(含) |
68
86
  | POST | `/api/message-ops/delete` | `{sessionId, seq}` 仅遮蔽该条 |
69
- | POST | `/api/message-ops/branch` | `{sessionId, upToSeq}` 分支新会话,返回 `{newId, dir, keptEvents}` |
70
- | GET | `/api/message-ops/export?sessionId=<id>&seq=<可选>` | 导出 Markdown(seq ≤ 上界,缺省全部),附件下载 |
71
87
  | POST | `/api/message-ops/restore` | `{sessionId, seq}` 回滚恢复:seq 为某次 revert/delete 标记事件的 seq |
72
88
  | POST | `/api/message-ops/session/delete` | `{sessionId, confirmTitle}` 整会话移入回收站(7 天保留;运行中 409) |
73
89
  | POST | `/api/message-ops/session/restore` | `{trashId}` 从回收站恢复目录与投影/工作区元数据 |
74
90
  | POST | `/api/message-ops/session/purge` | `{trashId}` 永久删除(唯一 destructive 操作) |
75
91
 
92
+ ### 0.11.2 · 合成 turn 竞态与历史日志兼容修复
93
+
94
+ - 修复回滚在 live 会话中可能产生**重复 turn**:`opsCommit` / `opsRestore` 在取得
95
+ live session 后改用 `session.log` 重算 turn 窗口,不再信任可能已过期的磁盘快照。
96
+ - 合成 turn 成功闭合后对齐宿主 idle agent 的 `lastTurn`,防止下一条真实消息复用同一 turn。
97
+ - `planNoticeWindow` 遇到「turn 已开但 step 未开」直接 409,不再嵌套非法合成 turn。
98
+ - `applySurfaceReplace` / `buildMarkerEvent` 对 `sourceEventSeqs` 做扁平化、去重和整数校验,
99
+ 杜绝 `[[start,end]]` 旧伤继续写入。
100
+ - 旧日志中已存在的嵌套 `sourceEventSeqs` 与 tool/result replacement 非 content 字段
101
+ 需用维护脚本修复;本版本保证不再产生该类记录。
102
+ - 契约测试在无本地 `sessionfix` 夹具时自动跳过,不再硬依赖个人绝对路径。
103
+
76
104
  ### 0.11.0 · 方向 A 面板 + 会话回收站
77
105
 
78
106
  - `src/client.js` 新增右侧功能主义抽屉 `OpsPanel`(560px,≤760px 全屏):
@@ -83,6 +111,10 @@ dsh plugin --profile web add file:C:/path/to/dsh-message-ops
83
111
  上限的服务端全文检索(LRU 8 corpus 缓存,按 logPath mtime+size 失效)。
84
112
  - `src/session-trash.js`:删除 = 目录 `rename` + 投影行/工作区/归档/置顶元数据
85
113
  快照写 `manifest.json`;恢复拒绝覆盖已存在目录(409);purge 才真正删除。
114
+ 恢复校验 `manifest.sessionId` 与 `rel`(必须是 sessions 根下两层、且与 id 匹配),
115
+ delete 回滚失败时保留回收站唯一副本,不再无条件删除。
116
+ - 无标题会话取标题只解压首个 zstd header frame(`readSessionHeader`),损坏的正文
117
+ 不会阻塞列表;marker 恢复进度改为单次索引扫描。
86
118
 
87
119
  ## 0.2.4 UI GAP(ux-scout dsh-ui-spec G-M1)
88
120
 
@@ -759,4 +791,3 @@ min fence=10 → seq>=10 全藏 → 4792/4793 全被隐藏 → 正文几乎空
759
791
  | `src/index.js:1-23` 模块头里的 0.9.0 分支/导出移除段 | 「为什么不重复造轮子(0.9.0 的取舍)」 |
760
792
  | `src/index.js:336-340` `revertFences` 塌缩复盘 | 「0.9.4 · 修「正文几乎空白」」 |
761
793
  | `src/ops-core.js:551-557` 0.5.7 磁盘路径复盘 | 「0.5.7 · 第四层根因:store-miss 会话的磁盘追加路径」 |
762
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@240xu/dsh-message-ops",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "DSH web 插件:消息级回滚 / 删除 / 恢复(补 dsh 官方没有的部分)。分支与导出用官方内置能力。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -14,7 +14,6 @@
14
14
  },
15
15
  "files": [
16
16
  "src/",
17
- "test/",
18
17
  "cordis.patch.yml",
19
18
  "README.md",
20
19
  "LICENSE"