@a9i5k4/dsh-auto-memory 0.1.30 → 0.1.32

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
@@ -48,7 +48,7 @@
48
48
  </details>
49
49
 
50
50
  <p align="center">
51
- <a href="README.md">中文</a> · <b>English</b> · License BSD-3-Clause · <code>pnpm add @a9i5k4/dsh-auto-memory</code>
51
+ <a href="README.zh-CN.md">中文</a> · <b>English</b> · License BSD-3-Clause · <code>pnpm add @a9i5k4/dsh-auto-memory</code>
52
52
  </p>
53
53
 
54
54
  > **v0.1.30 MAJOR UPDATE** — A brand-new Welcome Tour: every feature introduced step by step with per-feature switches; an Office/Fluent-style liquid-glass app icon family; a changelog intro animation; and an unattended mode built for long batch jobs.
@@ -5,7 +5,7 @@
5
5
  * surface=systemPrompt.context(user-role 快照追加历史尾部);pre-step/user-message patch
6
6
  * 不存在 → capability='dynamic-context';连 context 都没有 → 'none'(降级 Shadow,不标 delivered)。
7
7
  * - pre-step 时序(§8):bumpStep→setCursor→claim(四重门);claimed packet 缓存于 runtime 态。
8
- * - 渲染即投递:专用 context 组件 'dsh:m6-reference-tail-pre' 的 text() 重渲染并校验 exactDigest,
8
+ * - 渲染即投递:专用 context 组件 'dsh:m6-reference-tail' 的 text() 重渲染并校验 exactDigest,
9
9
  * 一致则返回尾注文本(=已实际进入 messages)并 markDelivered + 异步创建 seen evidence;
10
10
  * systemPrompt.section 永不承载动态 tail。
11
11
  * 默认关闭(associativeMemoryEnabled ∧ activationInboxEnabled 双门);activationSource='fake' 为
@@ -314,7 +314,7 @@ export function createActivationHost(opts = {}) {
314
314
  }
315
315
 
316
316
  /**
317
- * 专用渲染面(dsh:m6-reference-tail-pre 的 text()):重渲染 claimed packet 并校验 exactDigest,
317
+ * 专用渲染面(dsh:m6-reference-tail 的 text()):重渲染 claimed packet 并校验 exactDigest,
318
318
  * 一致 → 返回尾注文本 + markDelivered + 异步 seen;不一致/未声明 → 返回空串(零注入)。
319
319
  */
320
320
  function renderTailFor(agent) {
package/lib/client.js CHANGED
@@ -491,6 +491,7 @@ window.__ModuleLoader__.load({
491
491
  '修复:记忆面板默认位置不再遮挡侧边栏「记忆」入口按钮——改为锚定按钮正上方,重叠时自动让出;支持点击面板外部或按 Esc 关闭。感谢 @ProperSAMA(PR #12)。',
492
492
  '修复:更新弹窗在小卡形态下内容被裁剪、底部按钮不可达导致无法关闭——新增右上 ✕ 关闭(同步已读版本),内容区自动滚动。',
493
493
  '改进:「唤起回顾」决策↔投递时间线——每条决策标注真实投递结果(✓投递×N/未投递/技能✓),判定队列汇总与政策提示;记忆固化(stale 门降版本容忍,语料升版不再整单压制召回)。',
494
+ '补丁 0.1.31:发布物运行时 section 名 dsh:m6-reference-tail → 裸名(发布身份统一,不再带预览标识)。',
494
495
  ], en: [
495
496
  '★ MAJOR: Brand-new Welcome Tour — after first launch or upgrade, every feature is introduced step by step with per-feature switches right in the tour (association / snapshot / greeting / night unattended / reflection / summaries / external memory / skill promotion…); engine detection, download, self-test and live external-source scanning are all inline.',
496
497
  '★ New brand visuals: an Office/Fluent-style liquid-glass app icon family — each step gets its own colored glass squircle icon (cyan inject / amber greeting / green calendar / violet engine / sky radar / coral finish) with dedicated looping motion (bell sway, page flip, linked rings, prism spin, radar sweep, rising spark); the signature three-slab frosted-glass logo stays on the Core step.',
@@ -500,6 +501,7 @@ window.__ModuleLoader__.load({
500
501
  'Fix: The panel no longer covers the sidebar "Memory" entry button — default position anchors above it, overlapping geometry auto-yields, and outside-click/Esc close is supported. Thanks @ProperSAMA (PR #12).',
501
502
  'Fix: The update dialog could become impossible to close when its content overflowed the compact card — added an ✕ in the top-right (marks version seen) and made the content area scrollable.',
502
503
  'Improved: Recall-review decision↔delivery timeline (delivered×N / not delivered / skill badges per decision), review-queue digest with policy hints, and consolidation stale-gate version tolerance so corpus version bumps no longer suppress recall.',
504
+ 'Patch 0.1.31: release runtime section name dsh:m6-reference-tail → bare name (unified release identity, no preview marker).',
503
505
  ] },
504
506
  '0.1.29': { zh: [
505
507
  '修复:工作区总览一直显示「未发现带记忆的工作区」——DSH 新版会话持久化改为 session.jsonl.zstd 压缩帧,旧逻辑只认 .jsonl 扫描不到任何会话;现已用 zstd 解压读取首行提取 cwd,并让空的 summary 缓存短时失效,避免空结果被永久固化。',
@@ -977,6 +979,11 @@ window.__ModuleLoader__.load({
977
979
  '@keyframes dam-tour-swap { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }',
978
980
  '[data-dam-tour-dl] { margin: 8px auto 0; max-width: 420px; text-align: left; font-size: 12px; }',
979
981
  '[data-dam-tour-dl-row] { display: flex; justify-content: space-between; gap: 10px; opacity: .75; font-size: 10.5px; margin-bottom: 3px; }',
982
+ '[data-dam-tour-dl-tier] { margin-top: 8px; border: 1px solid rgba(128,128,128,.22); border-radius: 9px; overflow: hidden; }',
983
+ '[data-dam-tour-dl-tier-row] { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 10px; font-size: 11px; }',
984
+ '[data-dam-tour-dl-tier-row:first-child] { border-bottom: 1px solid rgba(128,128,128,.14); background: rgba(47,164,106,.08); }',
985
+ '[data-dam-tour-dl-tier-row] b { font-weight: 700; white-space: nowrap; }',
986
+ '[data-dam-tour-dl-tier-row] span { opacity: .7; font-size: 10.5px; text-align: right; }',
980
987
  '[data-dam-tour-bar] { height: 7px; border-radius: 99px; background: rgba(128,128,128,.18); overflow: hidden; }',
981
988
  '[data-dam-tour-bar-i] { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--dam-accent, #2456c4), #7ea4ff); transition: width .4s ease; }',
982
989
  '[data-dam-tour-dots] { display: flex; gap: 7px; justify-content: center; margin: 18px 0 4px; z-index: 2; position: relative; }',
@@ -2518,10 +2525,20 @@ window.__ModuleLoader__.load({
2518
2525
  // 每次向导变为可见时回到第一步,并拉一份当前配置快照(开关步读写用)
2519
2526
  if (tourShowing) {
2520
2527
  setTourStep(0)
2528
+ wizSt.tourCfg = null
2529
+ wizSt.cfgLoaded = false
2521
2530
  fetch('/api/dsh-auto-memory/config').then(function (r) { return r.json() }).then(function (j) {
2522
2531
  wizSt.tourCfg = (j && (j.config || j)) || {}
2532
+ // mode 型开关(唤起注入模式)实际存储在 embedding-config.json(semantic-emit 接口维护),
2533
+ // 需从 semantic-status 合并进来,导览开关才能显示真实当前值并与设置页联动。
2534
+ try {
2535
+ fetch('/api/dsh-auto-memory/semantic-status').then(function (r2) { return r2.json() }).then(function (j2) {
2536
+ if (j2 && j2.activationEmitMode !== undefined) { wizSt.tourCfg.activationEmitMode = j2.activationEmitMode; try { dlgTick() } catch (e13) {} }
2537
+ }).catch(function () {})
2538
+ } catch (_) {}
2539
+ wizSt.cfgLoaded = true
2523
2540
  try { dlgTick() } catch (e11) {}
2524
- }).catch(function () { wizSt.tourCfg = wizSt.tourCfg || {} })
2541
+ }).catch(function () { wizSt.tourCfg = wizSt.tourCfg || {}; wizSt.cfgLoaded = true })
2525
2542
  fetch('/api/dsh-auto-memory/external').then(function (r) { return r.json() }).then(function (j) {
2526
2543
  wizSt.extScan = j
2527
2544
  try { dlgTick() } catch (e12) {}
@@ -2538,6 +2555,17 @@ window.__ModuleLoader__.load({
2538
2555
  }, 1500)
2539
2556
  return function () { clearInterval(iv) }
2540
2557
  }, [tourShowing, tourDlPhase])
2558
+ // 无语义引擎自动引导:进入引擎下载步且引擎未就绪/未下载/未出错时,自动开始下载内置 JS 档(C2 默认)。
2559
+ // 用户可稍后在设置页手动装 Python 进阶档;词法检索 0GB 永远兜底,不阻塞。
2560
+ useEffect(function () {
2561
+ if (!tourShowing) return undefined
2562
+ var curStep = TOUR_STEPS[tourStep]
2563
+ if (!curStep || !curStep.dl) return undefined
2564
+ if (wizSt.ready || wizSt.loaded === false) return undefined
2565
+ var ph = wizSt.download && wizSt.download.phase
2566
+ if (ph === 'downloading' || ph === 'verifying' || ph === 'done' || ph === 'error') return undefined
2567
+ apiPost('/api/dsh-auto-memory/semantic-download', { action: 'start', mirror: 'auto' }).catch(function () {})
2568
+ }, [tourShowing, tourStep, wizSt.ready])
2541
2569
  if (!dialogState) return null
2542
2570
  // 左下角小卡片(记忆按钮上方),高透明毛玻璃,不遮全屏
2543
2571
  var overlay = { position: 'fixed', left: '10px', bottom: '64px', zIndex: 2147483000, width: 'min(360px, calc(100vw - 20px))', maxHeight: 'min(46vh, 430px)', display: 'flex', flexDirection: 'column' }
@@ -2709,12 +2737,14 @@ window.__ModuleLoader__.load({
2709
2737
  var EXT_SOURCE_KEYS = ['workbuddy-user', 'workbuddy-profile', 'codebuddy-memory', 'claude-global', 'project-conventions', 'workbuddy-sessions', 'claude-sessions', 'codex-sessions']
2710
2738
  var tourToggleOn = function (tg) {
2711
2739
  var c = wizSt.tourCfg || {}
2740
+ if (!wizSt.cfgLoaded) return false // 配置未加载完,一律视为关且禁用,避免误触默认值
2712
2741
  if (tg.key === 'autoSummaryTimes') return (c[tg.key] || []).length > 0
2713
2742
  if (tg.groupAll) { var v = c[tg.key] || {}; return !!v['workbuddy-user'] }
2714
2743
  if (tg.mode) { var m = c[tg.key]; if (m === undefined) return tg.def === true; return m === 'canary-explicit' || m === 'active' }
2715
2744
  return c[tg.key] === undefined ? tg.def !== false : !!c[tg.key]
2716
2745
  }
2717
2746
  var tourToggleClick = function (tg) {
2747
+ if (!wizSt.cfgLoaded) return // 配置未加载完,禁止写入,防止覆盖用户设置
2718
2748
  var c = wizSt.tourCfg = wizSt.tourCfg || {}
2719
2749
  var on = tourToggleOn(tg)
2720
2750
  var patch = {}
@@ -2724,10 +2754,17 @@ window.__ModuleLoader__.load({
2724
2754
  else patch[tg.key] = !on
2725
2755
  Object.assign(c, patch)
2726
2756
  dlgTick()
2727
- apiPost('/api/dsh-auto-memory/config', patch).catch(function () {})
2757
+ // mode 型开关(唤起注入模式)走 semantic-emit 接口——与设置页同源(embedding-config.json),
2758
+ // 保证导览切换与设置页双向联动;其余开关写常规 config。
2759
+ if (tg.mode) {
2760
+ apiPost('/api/dsh-auto-memory/semantic-emit', { mode: patch[tg.key] }).catch(function () {})
2761
+ } else {
2762
+ apiPost('/api/dsh-auto-memory/config', patch).catch(function () {})
2763
+ }
2728
2764
  }
2729
2765
  // 外部来源单源勾选(扫描行;勾选即写 externalSources 对象)
2730
2766
  var tourExtToggle = function (id) {
2767
+ if (!wizSt.cfgLoaded) return // 配置未加载完,禁止写入
2731
2768
  var c = wizSt.tourCfg = wizSt.tourCfg || {}
2732
2769
  var cur = Object.assign({}, c.externalSources || {})
2733
2770
  cur[id] = (cur[id] !== false) ? false : true
@@ -2746,17 +2783,15 @@ window.__ModuleLoader__.load({
2746
2783
  var finishTour = function () {
2747
2784
  try { localStorage.setItem('dsh-auto-memory.semWizardDone', '1') } catch (e4) {}
2748
2785
  closeDialog()
2749
- // v0.1.30 大更新链:向导结束 → CHANGELOG。老用户(seen 落后)带出全部未读版本;
2750
- // 已追平(含新装)给大更新专卡。apiGet 异步拉当前版本,失败静默(向导本身已完成使命)。
2786
+ // v0.1.30 大更新链:向导结束 → 直接接 0.1.30 大更新卡(老用户历史版本不逐个弹,
2787
+ // 大更新内容才是要传达的)apiGet 异步拉当前版本,失败静默(向导本身已完成使命)。
2751
2788
  try {
2752
2789
  apiGet(API.updateCheck).then(function (d) {
2753
2790
  var cur = (d && d.current) || '0.1.30'
2754
- var seen = localStorage.getItem('dsh-auto-memory.seenVersion')
2755
- if (seen && seen !== cur) {
2756
- var versions = changelogBetween(seen, cur)
2757
- if (versions.length) { openDialog({ kind: 'update', versions: versions, currentVersion: cur }); return }
2758
- }
2759
- openDialog({ kind: 'update', versions: [{ version: cur, items: CHANGELOG[cur] || CHANGELOG['0.1.30'] }], currentVersion: cur })
2791
+ // 只弹大更新(0.1.30);若当前版本更新(补丁)也并入 0.1.30 (补丁内容已在 0.1.30 items 尾部)
2792
+ var latestKey = '0.1.30'
2793
+ openDialog({ kind: 'update', versions: [{ version: latestKey, items: CHANGELOG[latestKey] || CHANGELOG['0.1.30'] }], currentVersion: cur })
2794
+ try { localStorage.setItem('dsh-auto-memory.seenVersion', cur) } catch (e5) {}
2760
2795
  }).catch(function () {
2761
2796
  openDialog({ kind: 'update', versions: [{ version: '0.1.30', items: CHANGELOG['0.1.30'] }], currentVersion: '0.1.30' })
2762
2797
  })
@@ -2835,7 +2870,14 @@ window.__ModuleLoader__.load({
2835
2870
  wizReady ? null : h('div', { 'data-dam-tour-bar': '' },
2836
2871
  h('div', { 'data-dam-tour-bar-i': '', style: { width: prog + '%', background: dl.phase === 'error' ? 'linear-gradient(90deg,#c44a4a,#e08a8a)' : undefined } })),
2837
2872
  !wizReady && wizSt.loaded && !dlActive ? h('div', { 'data-dam-tour-dl-row': '', style: { marginTop: '4px' } },
2838
- h('span', null, (locale === 'zh' ? '下载源: ' : 'Source: ') + (dl.mirrorUsed === 'cn' ? t('mCn') : dl.mirrorUsed === 'intl' ? t('mIntl') : t('mAuto')) + (locale === 'zh' ? ' · 失败自动切备用源' : ' · auto-failover'))) : null) : null,
2873
+ h('span', null, (locale === 'zh' ? '下载源: ' : 'Source: ') + (dl.mirrorUsed === 'cn' ? t('mCn') : dl.mirrorUsed === 'intl' ? t('mIntl') : t('mAuto')) + (locale === 'zh' ? ' · 失败自动切备用源' : ' · auto-failover'))) : null,
2874
+ h('div', { 'data-dam-tour-dl-tier': '' },
2875
+ h('div', { 'data-dam-tour-dl-tier-row': '' },
2876
+ h('b', null, locale === 'zh' ? '内置 JS 档(自动)' : 'Built-in JS tier (auto)'),
2877
+ h('span', null, locale === 'zh' ? 'e5-small · ~129MB · 默认,正在为你安装' : 'e5-small · ~129MB · default, installing for you')),
2878
+ h('div', { 'data-dam-tour-dl-tier-row': '' },
2879
+ h('b', null, locale === 'zh' ? 'Python 进阶档(可选)' : 'Python tier (optional)'),
2880
+ h('span', null, locale === 'zh' ? 'BGE-M3 int8 · 563MB · 追求更高精度的发烧友可在设置页安装' : 'BGE-M3 int8 · 563MB · for enthusiasts chasing higher precision — installable in Settings')))) : null,
2839
2881
  step.final ? h('div', null,
2840
2882
  h('div', { 'data-dam-tour-chips': '' },
2841
2883
  allToggles.filter(function (tg) { return tourToggleOn(tg) }).map(function (tg) {
@@ -3498,11 +3540,20 @@ window.__ModuleLoader__.load({
3498
3540
  if (!seen && !localStorage.getItem('dsh-auto-memory.firstRunDone')) {
3499
3541
  openDialog({ kind: 'first', currentVersion: d.current })
3500
3542
  } else if (seen && seen !== d.current) {
3501
- var versions = changelogBetween(seen, d.current)
3502
- if (versions.length) openDialog({ kind: 'update', versions: versions, currentVersion: d.current })
3503
- else try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3) {}
3543
+ // 只弹 0.1.30 大更新卡(补丁并入其尾部),不逐个弹历史版本——大更新内容才是要传达的
3544
+ var bigKey = '0.1.30'
3545
+ if (CHANGELOG[bigKey]) {
3546
+ openDialog({ kind: 'update', versions: [{ version: bigKey, items: CHANGELOG[bigKey] }], currentVersion: d.current })
3547
+ try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3b) {}
3548
+ } else {
3549
+ var versions = changelogBetween(seen, d.current)
3550
+ if (versions.length) openDialog({ kind: 'update', versions: versions, currentVersion: d.current })
3551
+ else try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3) {}
3552
+ }
3504
3553
  } else if (!seen && localStorage.getItem('dsh-auto-memory.firstRunDone')) {
3554
+ // 老用户但 seen 缺失(旧版升级/缓存清理):只看当前版本一条,不补历史链,避免把旧 log 塞给用户
3505
3555
  try { localStorage.setItem('dsh-auto-memory.seenVersion', d.current) } catch (e3) {}
3556
+ if (CHANGELOG[d.current]) openDialog({ kind: 'update', versions: [{ version: d.current, items: CHANGELOG[d.current] }], currentVersion: d.current })
3506
3557
  }
3507
3558
  } catch (e) {}
3508
3559
  }
package/lib/index.js CHANGED
@@ -4582,7 +4582,7 @@ export function apply(ctx, config) {
4582
4582
  // 仅渲染已 claimed 的 packet;返回非空=实际进入下一请求 messages → 同步 markDelivered + seen。
4583
4583
  // systemPrompt.section 永不承载该动态内容。
4584
4584
  const disposeTailSurface = ctx.systemPrompt.context({
4585
- name: 'dsh:m6-reference-tail-pre',
4585
+ name: 'dsh:m6-reference-tail',
4586
4586
  order: SECTION_ORDER + 1,
4587
4587
  text: (context) => {
4588
4588
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@a9i5k4/dsh-auto-memory",
3
3
  "description": "主动联想记忆插件:记忆不靠模型调用,自己被唤回——Host 观察情境,NLP+向量化双轨检索,固定边界注入不破坏前缀缓存。三层记忆自动沉淀、欢迎向导、唤起回顾、无人值守、AI 问候与反思、日历、跨工具记忆继承。Proactive associative memory for DSH: zero-call recall, three-layer auto-consolidation, welcome tour, unattended mode.",
4
- "version": "0.1.30",
4
+ "version": "0.1.32",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "exports": {