@240xu/dsh-message-ops 0.20.0 → 0.21.0
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 +36 -0
- package/package.json +1 -1
- package/src/client.js +23 -4
package/README.md
CHANGED
|
@@ -1280,3 +1280,39 @@ textarea 预填真实全文 89 字(非 snippet)
|
|
|
1280
1280
|
中期需宿主提供 per-seq payload 重写。此项**未改代码**,仅出报告待决断。
|
|
1281
1281
|
|
|
1282
1282
|
测试 348(344 pass / 4 skip),`prettier --check` 全绿。
|
|
1283
|
+
|
|
1284
|
+
### 0.21.0 · 回撤隐私预期修正 + 宿主能力需求
|
|
1285
|
+
|
|
1286
|
+
用户问:「回撤的话 AI 还看得到吗?翻会话文件拿得到吗?我希望彻底删除,
|
|
1287
|
+
但因为要恢复,至少在后续几次里能恢复」+「按 opencode 的真删时机来,看看有没有方法」。
|
|
1288
|
+
|
|
1289
|
+
**Spike 结论**(只读查证 + 一次性破坏性试验,未碰真实会话):
|
|
1290
|
+
- AI **看不到**(模型只读 `surface.nodes`);但翻 `session.v4.jsonl.zstd` **拿得到**,
|
|
1291
|
+
实测 161 条被回撤消息原文逐字可读
|
|
1292
|
+
- **物理删中间行会 corrupt**:宿主 `surface.js:425` 的 seq 连续性校验会抛
|
|
1293
|
+
`session event seq 12 is not contiguous; expected 8`(已用宿主 `foldSurface` 实测)
|
|
1294
|
+
- **照抄 opencode 的尾部 DELETE 对不上几何**:opencode 删的是「边界之后的尾部」,
|
|
1295
|
+
而 DSH 真实数据里 49 个回撤 marker **全是中间型**(距末尾几千事件)
|
|
1296
|
+
- **脱敏重写在磁盘冷数据层可行**(保留事件数/seq/类型、把 content 改 `[redacted]`,
|
|
1297
|
+
实测 `foldSurface` 通过),但宿主**没有 reload 入口**、且需持写锁 → 必须宿主来做
|
|
1298
|
+
|
|
1299
|
+
**本次落地(方案 1 + 2)**:
|
|
1300
|
+
|
|
1301
|
+
1. **诚实告知(纯插件,止住隐私预期落差)**
|
|
1302
|
+
- 回撤确认框常显告知条 `panel.revertPrivacyNote`:明确「这不是删除,
|
|
1303
|
+
AI 看不到,但原文仍在本地会话文件、可被恢复、翻文件仍能读到」
|
|
1304
|
+
- 行内回滚按钮 title `slot.revertPrivacyHint`(`syncEnabled` 统一,
|
|
1305
|
+
修掉了它覆盖 ensureBtn 初始值的问题)
|
|
1306
|
+
- 成功 toast `done.revert` 补上「原文仍保留、可恢复」
|
|
1307
|
+
- 真实 Chromium 验证:行内 title 与面板确认框告知条均正确渲染
|
|
1308
|
+
|
|
1309
|
+
2. **给宿主的正式需求文档**
|
|
1310
|
+
`docs/superpowers/specs/2026-11-10-host-per-seq-redaction-request.md`(203 行):
|
|
1311
|
+
- 请求两个能力:**per-seq payload 重写**(改 data 不删行、不破坏 seq 连续性)
|
|
1312
|
+
+ **在 commit 时机自动触发 + 内存 surface 重建**
|
|
1313
|
+
- 对标 opencode 的三个 commit 触发点(prompt / compact / 手动)
|
|
1314
|
+
- 含试验数据、源码行号、接口建议、验收标准
|
|
1315
|
+
- 语义:stage 期间可恢复(现状不变),用户继续对话后宿主脱敏 commit,
|
|
1316
|
+
之后翻文件也拿不到原文 —— 正好对上用户「后续几次能恢复、之后彻底删」的诉求
|
|
1317
|
+
|
|
1318
|
+
测试 353(349 pass / 4 skip),`prettier --check` 全绿。
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -132,6 +132,7 @@ window.__ModuleLoader__.load({
|
|
|
132
132
|
'op.branch': '从此条分叉为新会话',
|
|
133
133
|
'op.branchDesc': '把此条之前的对话复制到新会话,并把此条原文放回新会话输入框(原会话不变,非破坏操作)。',
|
|
134
134
|
'slot.revert': '回滚到此条',
|
|
135
|
+
'slot.revertPrivacyHint': '回滚到此条(不是删除:AI 看不到,但原文仍在本地会话文件)',
|
|
135
136
|
'slot.revertUnmatched': '在日志里定位不到这条消息的 seq(通常是模型写的摘要与渲染文本偏差过大)——请改用「消息操作」对话框。',
|
|
136
137
|
'slot.fork': '从此条分叉',
|
|
137
138
|
'slot.forkHint': '复制此条之前的对话到新会话,并把此条原文放回新会话输入框',
|
|
@@ -170,7 +171,7 @@ window.__ModuleLoader__.load({
|
|
|
170
171
|
'busy.delete': '删除中…',
|
|
171
172
|
'busy.branch': '分支中…',
|
|
172
173
|
'done.restore': '恢复完成:重放 {n} 条,跳过不可重放 {s} 条',
|
|
173
|
-
'done.revert': '
|
|
174
|
+
'done.revert': '已回滚(原文仍保留在本地会话文件,可被恢复);刷新页面后生效',
|
|
174
175
|
'done.delete': '删除完成,刷新页面后生效',
|
|
175
176
|
'action.reload': '刷新页面',
|
|
176
177
|
errorPrefix: '操作失败:',
|
|
@@ -216,6 +217,11 @@ window.__ModuleLoader__.load({
|
|
|
216
217
|
'panel.revertHint': '包含此条及其后的可见消息',
|
|
217
218
|
'panel.revertConfirmTitle': '回滚到 #{seq}?',
|
|
218
219
|
'panel.revertConfirmBody': '将遮蔽 #{start}–#{end} 的 {n} 条消息,其中可见 {v} 条;日志仍保留,可恢复。',
|
|
220
|
+
// 0.21.0:隐私预期落差修正。回撤不是「删除」,别让用户以为内容消失了。
|
|
221
|
+
// 实测(design-demos/revert-data-semantics.md):AI 看不到(模型只读 surface.nodes),
|
|
222
|
+
// 但被回撤消息的原文仍逐字留在本地 session.v4.jsonl.zstd 里,翻文件拿得到。
|
|
223
|
+
'panel.revertPrivacyNote':
|
|
224
|
+
'注意:这不是删除。AI 将看不到这些消息,但原文仍完整保留在本地会话文件中,可被恢复;直接翻看会话文件仍能读到。',
|
|
219
225
|
'panel.deleteConfirmTitle': '仅删除 #{seq}?',
|
|
220
226
|
'panel.deleteConfirmBody': '将遮蔽这 1 条消息,其他内容不动;日志仍保留,可恢复。',
|
|
221
227
|
'panel.confirmRevert': '确认回滚',
|
|
@@ -279,6 +285,7 @@ window.__ModuleLoader__.load({
|
|
|
279
285
|
'op.branchDesc':
|
|
280
286
|
'Copies the conversation above the picked message into a new session and puts this message back in the new composer (original untouched, non-destructive).',
|
|
281
287
|
'slot.revert': 'Revert to here',
|
|
288
|
+
'slot.revertPrivacyHint': 'Revert to here (not deletion: hidden from the AI, but the original text stays in the local session file)',
|
|
282
289
|
'slot.revertUnmatched':
|
|
283
290
|
'Cannot locate this message seq in the log (usually the model-written summary drifted too far from the rendered text) — use the Message ops dialog instead.',
|
|
284
291
|
'slot.fork': 'Branch from here',
|
|
@@ -320,7 +327,7 @@ window.__ModuleLoader__.load({
|
|
|
320
327
|
'busy.delete': 'Deleting…',
|
|
321
328
|
'busy.branch': 'Branching…',
|
|
322
329
|
'done.restore': 'Restored: replayed {n}, skipped non-replayable {s}',
|
|
323
|
-
'done.revert': 'Reverted; reload to apply',
|
|
330
|
+
'done.revert': 'Reverted (original text stays in the local session file and can be restored); reload to apply',
|
|
324
331
|
'done.delete': 'Deleted; reload to apply',
|
|
325
332
|
'action.reload': 'Reload page',
|
|
326
333
|
errorPrefix: 'Operation failed: ',
|
|
@@ -367,6 +374,8 @@ window.__ModuleLoader__.load({
|
|
|
367
374
|
'panel.revertConfirmTitle': 'Revert to #{seq}?',
|
|
368
375
|
'panel.revertConfirmBody':
|
|
369
376
|
'This shadows {n} messages (#{start}–#{end}), including {v} visible. The log stays append-only and can be restored.',
|
|
377
|
+
'panel.revertPrivacyNote':
|
|
378
|
+
'Note: this is not deletion. The AI will no longer see these messages, but the original text stays in the local session file and can be recovered — reading the session file directly still reveals it.',
|
|
370
379
|
'panel.deleteConfirmTitle': 'Delete only #{seq}?',
|
|
371
380
|
'panel.deleteConfirmBody': 'This shadows this one message; everything else stays. The log stays append-only and can be restored.',
|
|
372
381
|
'panel.confirmRevert': 'Confirm revert',
|
|
@@ -1149,6 +1158,8 @@ window.__ModuleLoader__.load({
|
|
|
1149
1158
|
'.mopsActionConfirm{display:flex;flex-direction:column;gap:7px;margin-top:10px;padding:10px;border:1px solid var(--dsw-alias-border-l2,#e6e6e6);background:var(--dsw-alias-bg-layer-1,#fff)}',
|
|
1150
1159
|
'.mopsImpactTitle{font-size:12px;font-weight:600}',
|
|
1151
1160
|
'.mopsImpact{font-size:11px;line-height:1.5;color:var(--dsw-alias-label-secondary,#6b6b70)}',
|
|
1161
|
+
// 常显隐私告知条:左竖线 + 灰底,与红色错误条区分;不可关闭,避免"勾了就真删"的误解
|
|
1162
|
+
'.mopsPrivacyNote{margin-top:2px;padding:6px 9px;border-left:2px solid var(--dsw-alias-label-tertiary,#9a9aa0);background:var(--dsw-alias-bg-layer-2,#efefef);border-radius:0 4px 4px 0;font-size:11px;line-height:1.5;color:var(--dsw-alias-label-secondary,#6b6b70)}',
|
|
1152
1163
|
'.mopsAction{height:30px;padding:0 10px;border:1px solid var(--dsw-alias-border-l2,#cfcfcf);background:transparent;cursor:pointer;font-size:11px}',
|
|
1153
1164
|
'.mopsAction:hover:not(:disabled){border-color:var(--dsw-alias-label-primary,#0f1115)}',
|
|
1154
1165
|
'.mopsAction.primary{border-color:var(--dsw-alias-label-primary,#0f1115);background:var(--dsw-alias-label-primary,#0f1115);color:var(--dsw-alias-bg-layer-1,#fff)}',
|
|
@@ -2246,6 +2257,11 @@ window.__ModuleLoader__.load({
|
|
|
2246
2257
|
})
|
|
2247
2258
|
: t('panel.deleteConfirmBody'),
|
|
2248
2259
|
),
|
|
2260
|
+
// 0.21.0:revert 的常显隐私告知(零副作用、纯文案)。
|
|
2261
|
+
// 只在回滚确认态出现;删除确认不需要(删单条同样遮蔽,但语义不同)。
|
|
2262
|
+
confirmAction === 'revert'
|
|
2263
|
+
? React.createElement('div', { className: 'mopsPrivacyNote', role: 'note' }, t('panel.revertPrivacyNote'))
|
|
2264
|
+
: null,
|
|
2249
2265
|
React.createElement(
|
|
2250
2266
|
'div',
|
|
2251
2267
|
{ className: 'mopsConfirmRow' },
|
|
@@ -4131,11 +4147,13 @@ window.__ModuleLoader__.load({
|
|
|
4131
4147
|
var syncEnabled = (block, btn) => {
|
|
4132
4148
|
if (!btn) return
|
|
4133
4149
|
// 0.18.0/0.20.0:三种按钮各有自己的提示文案(编辑按钮不能写 revert 的 hint)
|
|
4150
|
+
// 0.21.0:回滚按钮统一用「带隐私提示」的 title —— syncEnabled 会在
|
|
4151
|
+
// 注入后重设 title,若这里仍用 slot.revert 会覆盖掉 ensureBtn 里的隐私提示。
|
|
4134
4152
|
const hintKey = btn.classList.contains('mopsUserFork')
|
|
4135
4153
|
? 'slot.forkHint'
|
|
4136
4154
|
: btn.classList.contains('mopsUserEdit')
|
|
4137
4155
|
? 'slot.editHint'
|
|
4138
|
-
: 'slot.
|
|
4156
|
+
: 'slot.revertPrivacyHint'
|
|
4139
4157
|
const ok = block.getAttribute('data-mops-seq')
|
|
4140
4158
|
if (ok) {
|
|
4141
4159
|
btn.disabled = false
|
|
@@ -4343,7 +4361,8 @@ window.__ModuleLoader__.load({
|
|
|
4343
4361
|
btn = document.createElement('button')
|
|
4344
4362
|
btn.type = 'button'
|
|
4345
4363
|
btn.className = 'mopsUserRevert'
|
|
4346
|
-
|
|
4364
|
+
// 0.21.0:行内回滚按钮不经过面板确认框,隐私告知必须挂在这里(hover 可见)
|
|
4365
|
+
btn.title = __t('slot.revertPrivacyHint')
|
|
4347
4366
|
btn.setAttribute('aria-label', __t('slot.revert'))
|
|
4348
4367
|
btn.innerHTML =
|
|
4349
4368
|
'<svg width="14" height="14" viewBox="0 0 16 16" fill="none"><path d="M2.5 8a5.5 5.5 0 1 0 1.6-3.9" stroke="currentColor" stroke-width="1.2"/><path d="M2.2 2.8v3h3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
|