@a9i5k4/dsh-auto-memory 0.1.21 → 0.1.22

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.
Files changed (2) hide show
  1. package/lib/client.js +52 -9
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -324,6 +324,13 @@ window.__ModuleLoader__.load({
324
324
 
325
325
  // ───────────────────────── 更新弹窗 / 首次指导 ─────────────────────────
326
326
  var CHANGELOG = {
327
+ '0.1.22': { zh: [
328
+ '修复:更新说明可能被公告、欢迎或自动总结弹窗覆盖,导致升级后没有看到 changelog。',
329
+ '优化:更新说明现在优先展示并排队其他弹窗,只有点击“知道了”后才标记为已读;未确认时重启仍会再次显示。',
330
+ ], en: [
331
+ 'Fix: the update changelog could be replaced by notice, welcome, or summary dialogs during startup.',
332
+ 'Polish: update notes now take priority and queue other dialogs; the version is marked seen only after acknowledgement, so it appears again after restart when unconfirmed.',
333
+ ] },
327
334
  '0.1.21': { zh: [
328
335
  '上下文与缓存:动态记忆改为运行时快照,静态规则保持稳定;切换模型、跨天和记忆刷新不再反复击穿前缀缓存。',
329
336
  '记忆系统:三层记忆、普通检索与多关键词 recall、自动沉淀已完成运行时验证,写入、读取和检索链路稳定。',
@@ -393,9 +400,35 @@ window.__ModuleLoader__.load({
393
400
  '0.1.10': { zh: ['自动检查更新 + 设置页一键更新', '日界:凌晨的活儿归前一天(默认 7:30)', '记忆根目录系统文件夹选择器,换位置自动迁移', '每日写入预算,超限自动压缩旧内容', '30 天 AI 蒸馏'], en: ['Auto update check + one-click update in settings', 'Day boundary: late-night work logs to yesterday (default 07:30)', 'Native OS folder picker for memory root, auto-migration', 'Daily write budget with auto-compaction', '30-day AI distillation'] },
394
401
  }
395
402
  var dialogListeners = new Set()
396
- var dialogState = null // {kind:'update', versions:[...]} | {kind:'first'}
397
- function openDialog(d) { dialogState = d; dialogListeners.forEach(function (fn) { try { fn() } catch (e) {} }) }
398
- function closeDialog() { dialogState = null; dialogListeners.forEach(function (fn) { try { fn() } catch (e) {} }) }
403
+ var dialogState = null // 当前展示的弹窗
404
+ var dialogQueue = [] // 启动期多个异步弹窗按优先级排队,不相互覆盖
405
+ function dialogPriority(d) {
406
+ if (!d) return 0
407
+ if (d.kind === 'update') return 100
408
+ if (d.kind === 'first') return 90
409
+ if (d.kind === 'notice') return d.notice && d.notice.level === 'urgent' ? 80 : 70
410
+ if (d.kind === 'summary') return 60
411
+ if (d.kind === 'welcomeBack') return 50
412
+ return 10
413
+ }
414
+ function dialogKey(d) {
415
+ if (!d) return ''
416
+ if (d.kind === 'update') return 'update:' + (d.currentVersion || '')
417
+ if (d.kind === 'notice') return 'notice:' + ((d.notice && d.notice.id) || '')
418
+ if (d.kind === 'summary') return 'summary:' + ((d.summary && d.summary.date) || '') + ':' + ((d.summary && d.summary.time) || '')
419
+ return d.kind
420
+ }
421
+ function notifyDialog() { dialogListeners.forEach(function (fn) { try { fn() } catch (e) {} }) }
422
+ function openDialog(d) {
423
+ if (!d) return
424
+ var key = dialogKey(d)
425
+ if ((dialogState && dialogKey(dialogState) === key) || dialogQueue.some(function (x) { return dialogKey(x) === key })) return
426
+ if (!dialogState) dialogState = d
427
+ else if (dialogPriority(d) > dialogPriority(dialogState)) { dialogQueue.unshift(dialogState); dialogState = d }
428
+ else dialogQueue.push(d)
429
+ notifyDialog()
430
+ }
431
+ function closeDialog() { dialogState = dialogQueue.shift() || null; notifyDialog() }
399
432
  function onDialog(fn) { dialogListeners.add(fn); return function () { dialogListeners.delete(fn) } }
400
433
  function cmpVersion(a, b) {
401
434
  var pa = String(a).split('.').map(Number), pb = String(b).split('.').map(Number)
@@ -1359,7 +1392,13 @@ window.__ModuleLoader__.load({
1359
1392
  h('div', { style: sub }, t('guideSub')),
1360
1393
  feats.map(function (f) { return h('div', { style: item }, h('span', { style: dot }), f) }),
1361
1394
  h('div', { style: { fontSize: 'calc(12px * var(--dam-scale))', opacity: .8, marginTop: '4px' } }, t('guideTip')),
1362
- h('button', { 'data-dam-btn': '', style: close, onClick: closeDialog }, t('gotIt'))))
1395
+ h('button', { 'data-dam-btn': '', style: close, onClick: function () {
1396
+ try {
1397
+ localStorage.setItem('dsh-auto-memory.firstRunDone', '1')
1398
+ if (dialogState && dialogState.currentVersion) localStorage.setItem('dsh-auto-memory.seenVersion', dialogState.currentVersion)
1399
+ } catch (e3) {}
1400
+ closeDialog()
1401
+ } }, t('gotIt'))))
1363
1402
  }
1364
1403
  if (dialogState.kind === 'notice') {
1365
1404
  var n = dialogState.notice || {}
@@ -1416,7 +1455,10 @@ window.__ModuleLoader__.load({
1416
1455
  h('div', { style: { fontSize: 'calc(13px * var(--dam-scale))', fontWeight: 700, margin: '6px 0 2px', opacity: .9 } }, 'v' + v.version),
1417
1456
  items.map(function (it) { return h('div', { style: item }, h('span', { style: dot }), it) }))
1418
1457
  }),
1419
- h('button', { 'data-dam-btn': '', style: close, onClick: closeDialog }, t('gotIt'))))
1458
+ h('button', { 'data-dam-btn': '', style: close, onClick: function () {
1459
+ try { if (lastV) localStorage.setItem('dsh-auto-memory.seenVersion', lastV) } catch (e3) {}
1460
+ closeDialog()
1461
+ } }, t('gotIt'))))
1420
1462
  }
1421
1463
 
1422
1464
  // ───────────────────────── 设置页 ─────────────────────────
@@ -1643,13 +1685,14 @@ window.__ModuleLoader__.load({
1643
1685
  try {
1644
1686
  var seen = localStorage.getItem('dsh-auto-memory.seenVersion')
1645
1687
  if (!seen && !localStorage.getItem('dsh-auto-memory.firstRunDone')) {
1646
- try { localStorage.setItem('dsh-auto-memory.firstRunDone', '1') } catch (e2) {}
1647
- openDialog({ kind: 'first' })
1688
+ openDialog({ kind: 'first', currentVersion: d.current })
1648
1689
  } else if (seen && seen !== d.current) {
1649
1690
  var versions = changelogBetween(seen, d.current)
1650
- if (versions.length) openDialog({ kind: 'update', versions: versions })
1691
+ if (versions.length) openDialog({ kind: 'update', versions: versions, currentVersion: d.current })
1692
+ else try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3) {}
1693
+ } else if (!seen && localStorage.getItem('dsh-auto-memory.firstRunDone')) {
1694
+ try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3) {}
1651
1695
  }
1652
- try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3) {}
1653
1696
  } catch (e) {}
1654
1697
  }
1655
1698
  }).catch(function () {})
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@a9i5k4/dsh-auto-memory",
3
3
  "description": "DSH 自动记忆插件:三层记忆(用户级/项目笔记/每日日志)自动注入与检索、每轮对话自动沉淀、每日反思、可视化面板与设置页,支持继承其他 AI 工具的记忆。",
4
- "version": "0.1.21",
4
+ "version": "0.1.22",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {