@240xu/dsh-message-ops 0.10.1 → 0.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@240xu/dsh-message-ops",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "DSH web 插件:消息级回滚 / 删除 / 恢复(补 dsh 官方没有的部分)。分支与导出用官方内置能力。",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/client.js CHANGED
@@ -116,6 +116,7 @@ window.__ModuleLoader__.load({
116
116
  'dock.collapse': '折叠回撤列表',
117
117
  'dock.shadowedN': '{n} 条已遮蔽',
118
118
  'dock.restore': '恢复',
119
+ 'dock.restoreHint': '恢复为重放:消息将出现在会话末尾,不会回到原位',
119
120
  'dock.restoring': '恢复中…',
120
121
  'slot.quote': '引用到输入框',
121
122
  'quote.done': '已引用到输入框',
@@ -175,6 +176,7 @@ window.__ModuleLoader__.load({
175
176
  'dock.collapse': 'Collapse revert list',
176
177
  'dock.shadowedN': '{n} shadowed',
177
178
  'dock.restore': 'Restore',
179
+ 'dock.restoreHint': 'Restores by replay: messages appear at the end of the session, not in their original place',
178
180
  'dock.restoring': 'Restoring…',
179
181
  'slot.quote': 'Quote to composer',
180
182
  'quote.done': 'Quoted into composer',
@@ -958,6 +960,11 @@ window.__ModuleLoader__.load({
958
960
  React.createElement('span', { className: 'mopsRdRowText' }, '#' + row.seq + ' · ' + (row.snippet || '')),
959
961
  React.createElement('button', {
960
962
  type: 'button', className: 'mopsRdRestore', disabled: restoring != null || running,
963
+ // 0.10.2 专家组评估结论:唯一「严重度=高」的真实缺口是 restore 为**重放**语义 ——
964
+ // 消息带新 seq 落到会话末尾,**不会回到原位**(引擎 SurfaceOp 只有 append/replace,
965
+ // 不存在解除遮蔽的原语)。用户点下去看到消息"搬家到底部"会以为出 bug,
966
+ // 所以把语义写在按钮上,别让人靠猜。
967
+ title: t('dock.restoreHint'),
961
968
  onClick: () => restoreRow(row),
962
969
  }, restoring === rowKey(row) ? t('dock.restoring') : t('dock.restore')),
963
970
  )
package/src/index.js CHANGED
@@ -293,6 +293,13 @@ async function buildDerived(logPath) {
293
293
  for (const e of seqText ? events : []) {
294
294
  if (!e || typeof e.seq !== "number") continue;
295
295
  if (e.type !== "user/message" && e.type !== "assistant/message") continue;
296
+ // 0.10.2:**别把宿主注入行当恢复目标的预览文案**。
297
+ // 实测 dock 展开后 44 行预览里出现 `<system-reminder> Updated instructio…`、
298
+ // `Agent … sent a message`、`Background subagent … finished` —— 用户看到的
299
+ // 「将恢复到这条」根本不是他写的话,直接加剧「不知道恢复到哪去」的困惑
300
+ // (这条困惑正是 0.10.1 修 commit 生命周期的起因)。
301
+ // `sourceKind === 'user'` 是一等字段,只放真实用户输入;assistant 全放(模型输出非注入)。
302
+ if (e.type === "user/message" && ((e.data || {}).source || {}).kind !== "user") continue;
296
303
  const t = messageText(e);
297
304
  if (t && t.trim()) seqText.set(e.seq, t.trim().replace(/\s+/g, " ").slice(0, 80));
298
305
  }
@@ -313,7 +320,11 @@ async function buildDerived(logPath) {
313
320
  m.pendingTurns = pendingRestoreTurns(events, m.seq, prog).map((t) => ({
314
321
  upTo: t.seqs[t.seqs.length - 1],
315
322
  count: t.seqs.length,
316
- preview: seqText.get(t.turnSeq) || ('#' + t.turnSeq),
323
+ // 0.10.2:轮起点常落在注入行上(system-reminder / 后台任务 / 子代理通知),
324
+ // 直接拿它当预览会显示「恢复到 <system-reminder>…」。改为在**该轮的 seq 集合里**
325
+ // 找第一条真实内容;一个都没有才退回 #seq(诚实显示序号,不编造文案)。
326
+ preview: t.seqs.reduce((hit, seq) => (hit != null ? hit : (seqText.has(seq) ? seqText.get(seq) : null)), null)
327
+ || ('#' + t.turnSeq),
317
328
  }));
318
329
  }
319
330