dsh-notify-yimit 0.1.5 → 0.1.6

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/lib/index.js CHANGED
@@ -1,7 +1,3 @@
1
- /**
2
- * dsh-notify-yimit-yimit 宿主插件。
3
- * 优化点:内存LRU控制、队列头指针优化、浏览器探测缓存、宿主崩溃退避、全面多语言支持。
4
- */
5
1
  import {
6
2
  z
7
3
  } from 'zod'
@@ -289,7 +285,11 @@ function clip(text) {
289
285
  }
290
286
 
291
287
  function titleOf(session) {
292
- const events = session?.events
288
+ // 宿主兼容:0.1.2-alpha.4 起 `Session.events` 被 `snapshotEvents()` 取代(旧版仍有 .events)。
289
+ // 优先用 snapshotEvents()(无参返回全量冻结事件数组),旧宿主回退 .events。
290
+ const events = typeof session?.snapshotEvents === 'function'
291
+ ? session.snapshotEvents()
292
+ : session?.events
293
293
  if (Array.isArray(events)) {
294
294
  // 全量扫描:标题事件通常在会话早期(seq 小)生成,长会话/恢复会话里它可能在
295
295
  // 最后 50 条之外——只扫尾部会漏掉,导致回退到占位/目录名(恢复会话不会重放
@@ -1169,4 +1169,4 @@ export function apply(ctx) {
1169
1169
 
1170
1170
  ctx.provide('notify', service)
1171
1171
  console.log('[dsh-notify-yimit] Loaded (disabled by default; please enable in Settings -> Notifications)')
1172
- }
1172
+ }