@240xu/dsh-message-ops 0.47.1 → 0.47.3

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
@@ -2048,6 +2048,10 @@ applyScriptLive`),replace 语义由 `applySurfaceReplace` 唯一拥有。旧
2048
2048
 
2049
2049
  当前规模:**744 tests / 740 pass / 4 skip / 0 todo / 0 fail**(`npm test`)。
2050
2050
 
2051
+ 基准:`npm run bench:incremental`(离线合成事件,可复现增量派生成本);CI 每次在
2052
+ Node 22/24 上跑 20k 事件档并设 200ms 宽松上限(本地 revert 批 1.5ms / restore 批 1.9ms,
2053
+ 全量重算 49ms 是增量合并的 14.4×)。
2054
+
2051
2055
  真机验证记录见 [`docs/verification/`](docs/verification/README.md)(环境基线、复核手法、
2052
2056
  每轮逐项判定与证据)。最近一轮:0.46.1 在宿主 0.2.3-alpha.3 上的 P0 修复复验(9 项 PASS)
2053
2057
  与大日志增量派生实测。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@240xu/dsh-message-ops",
3
- "version": "0.47.1",
3
+ "version": "0.47.3",
4
4
  "description": "DSH web 插件:消息级回滚 / 删除 / 恢复 / 分叉 / 编辑重发(补 dsh 官方没有的部分)。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,7 +44,9 @@
44
44
  "scripts": {
45
45
  "build:client": "node scripts/build-client.mjs",
46
46
  "test": "node --check src/client.js && node --test \"test/*.test.js\"",
47
- "prepack": "npm run build:client"
47
+ "prepack": "npm run build:client",
48
+ "bench:incremental": "node bench/incremental.mjs",
49
+ "bench": "node bench/derive.mjs"
48
50
  },
49
51
  "peerDependencies": {
50
52
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.2-rc.5 || ^0.2.3-alpha.3",
@@ -125,6 +125,7 @@
125
125
  'panel.trashMoving': '删除中断,仅存副本留作人工恢复',
126
126
  'panel.trashCorrupt': '清单损坏,只能永久删除',
127
127
  'panel.trashManual': '需人工处理',
128
+ 'panel.trashManualExpiry': '不会自动清理',
128
129
  'panel.purgeConfirm': '再点一次永久删除',
129
130
  'panel.restored': '会话已恢复',
130
131
  'panel.purged': '回收站条目已永久删除',
@@ -251,6 +252,7 @@
251
252
  'panel.trashMoving': 'Delete was interrupted; the only copy is kept for manual recovery',
252
253
  'panel.trashCorrupt': 'Manifest is corrupt; only deleting forever is possible',
253
254
  'panel.trashManual': 'Needs manual handling',
255
+ 'panel.trashManualExpiry': 'never auto-purged',
254
256
  'panel.purgeConfirm': 'Click again to delete forever',
255
257
  'panel.restored': 'Session restored',
256
258
  'panel.purged': 'Trash entry permanently deleted',
@@ -726,8 +726,8 @@
726
726
  const r = await readOpsJson(res)
727
727
  if (!r.ok) throw opsError(r.status, r.data)
728
728
  setTrash(prev => prev.filter(x => x.trashId !== trashId))
729
+ // 0.47.3:面板内已有绿色横幅,不要再弹同文案 toast(真机复核 finding #1)。
729
730
  setDone(t('panel.restored'))
730
- notifyDone(t('panel.restored'))
731
731
  emitChanged()
732
732
  // 0.33.13:unarchive 后宿主 feed 会把行放回侧栏,无需整页 reload。
733
733
  } catch (reason) {
@@ -759,8 +759,8 @@
759
759
  if (!r.ok) throw opsError(r.status, r.data)
760
760
  setTrash(prev => prev.filter(x => x.trashId !== trashId))
761
761
  setPurgeId(null)
762
+ // 0.47.3:同上 —— 横幅已可见,去掉重复 toast。
762
763
  setDone(t('panel.purged'))
763
- notifyDone(t('panel.purged'))
764
764
  } catch (reason) {
765
765
  setError(timeoutText(reason, t('errorPrefix')))
766
766
  } finally {
@@ -1395,8 +1395,14 @@
1395
1395
  React.createElement(
1396
1396
  'div',
1397
1397
  { className: 'mopsTrashMeta' },
1398
+ // 0.47.3(真机 UI 复核 finding):`moving` 是删除中断留下的孤儿,
1399
+ // 服务端**永不自动清理**(只能人工 purge)→ 显示到期时间会误导。
1398
1400
  (item.sessionId || t('panel.trashManual')) +
1399
- (item.expiresAt ? ' · ' + t('panel.expires') + ' ' + new Date(item.expiresAt).toLocaleDateString() : ''),
1401
+ (item.state === 'moving'
1402
+ ? ' · ' + t('panel.trashManualExpiry')
1403
+ : item.expiresAt
1404
+ ? ' · ' + t('panel.expires') + ' ' + new Date(item.expiresAt).toLocaleDateString()
1405
+ : ''),
1400
1406
  ),
1401
1407
  ),
1402
1408
  // 0.42.0(srv-audit D9/D10):异常态条目不提供 Restore ——
package/src/client.js CHANGED
@@ -423,6 +423,7 @@ window.__ModuleLoader__.load({
423
423
  'panel.trashMoving': '删除中断,仅存副本留作人工恢复',
424
424
  'panel.trashCorrupt': '清单损坏,只能永久删除',
425
425
  'panel.trashManual': '需人工处理',
426
+ 'panel.trashManualExpiry': '不会自动清理',
426
427
  'panel.purgeConfirm': '再点一次永久删除',
427
428
  'panel.restored': '会话已恢复',
428
429
  'panel.purged': '回收站条目已永久删除',
@@ -549,6 +550,7 @@ window.__ModuleLoader__.load({
549
550
  'panel.trashMoving': 'Delete was interrupted; the only copy is kept for manual recovery',
550
551
  'panel.trashCorrupt': 'Manifest is corrupt; only deleting forever is possible',
551
552
  'panel.trashManual': 'Needs manual handling',
553
+ 'panel.trashManualExpiry': 'never auto-purged',
552
554
  'panel.purgeConfirm': 'Click again to delete forever',
553
555
  'panel.restored': 'Session restored',
554
556
  'panel.purged': 'Trash entry permanently deleted',
@@ -1597,8 +1599,8 @@ window.__ModuleLoader__.load({
1597
1599
  const r = await readOpsJson(res)
1598
1600
  if (!r.ok) throw opsError(r.status, r.data)
1599
1601
  setTrash(prev => prev.filter(x => x.trashId !== trashId))
1602
+ // 0.47.3:面板内已有绿色横幅,不要再弹同文案 toast(真机复核 finding #1)。
1600
1603
  setDone(t('panel.restored'))
1601
- notifyDone(t('panel.restored'))
1602
1604
  emitChanged()
1603
1605
  // 0.33.13:unarchive 后宿主 feed 会把行放回侧栏,无需整页 reload。
1604
1606
  } catch (reason) {
@@ -1630,8 +1632,8 @@ window.__ModuleLoader__.load({
1630
1632
  if (!r.ok) throw opsError(r.status, r.data)
1631
1633
  setTrash(prev => prev.filter(x => x.trashId !== trashId))
1632
1634
  setPurgeId(null)
1635
+ // 0.47.3:同上 —— 横幅已可见,去掉重复 toast。
1633
1636
  setDone(t('panel.purged'))
1634
- notifyDone(t('panel.purged'))
1635
1637
  } catch (reason) {
1636
1638
  setError(timeoutText(reason, t('errorPrefix')))
1637
1639
  } finally {
@@ -2266,8 +2268,14 @@ window.__ModuleLoader__.load({
2266
2268
  React.createElement(
2267
2269
  'div',
2268
2270
  { className: 'mopsTrashMeta' },
2271
+ // 0.47.3(真机 UI 复核 finding):`moving` 是删除中断留下的孤儿,
2272
+ // 服务端**永不自动清理**(只能人工 purge)→ 显示到期时间会误导。
2269
2273
  (item.sessionId || t('panel.trashManual')) +
2270
- (item.expiresAt ? ' · ' + t('panel.expires') + ' ' + new Date(item.expiresAt).toLocaleDateString() : ''),
2274
+ (item.state === 'moving'
2275
+ ? ' · ' + t('panel.trashManualExpiry')
2276
+ : item.expiresAt
2277
+ ? ' · ' + t('panel.expires') + ' ' + new Date(item.expiresAt).toLocaleDateString()
2278
+ : ''),
2271
2279
  ),
2272
2280
  ),
2273
2281
  // 0.42.0(srv-audit D9/D10):异常态条目不提供 Restore ——
package/src/index.js CHANGED
@@ -1530,6 +1530,7 @@ async function runDiskWrite({ logPath, diag, plannedOf, scriptOf, resultOf }) {
1530
1530
  /** 测试钩子(非公开 API):直接驱动 list / search / text 与文件派生缓存。 */
1531
1531
  export const _internals = {
1532
1532
  errorStatusOf,
1533
+ deriveFromEvents,
1533
1534
  validateConfig,
1534
1535
  isConfiguredTrustedHost,
1535
1536
  setTrustedHostsForTests: hosts => {