dsh-engramory 1.0.4 → 1.0.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/README.en.md CHANGED
@@ -25,7 +25,8 @@ which is general-purpose agent memory: Claude Code, Codex and others can use the
25
25
  - **The rules come with it.** What to save, how, and when to clean up: the rules
26
26
  (a skill) are registered by the plugin, with no files to install.
27
27
  - **A Memory page in the sidebar.** Read-only; it lists the notes by name and opens
28
- one in your computer's default app.
28
+ one in your computer's default app, with a check-up that flags broken links in the
29
+ index and notes left out of it.
29
30
 
30
31
  ## Install
31
32
 
@@ -138,7 +139,13 @@ owner, so a program forwarding other people's messages must leave it out.
138
139
  - **Memory page:** *Memory* in the sidebar. It lists the global store and each
139
140
  workspace's project store (with an absolute `indexPath`, that store alone; with a
140
141
  relative one, none), with each index's size against the cap, its notes' names
141
- by type, and its archive. Read-only, never a note's text; a name, *Open the index* and
142
+ by type, and its archive. Each store comes with a check-up: the index's links to
143
+ files that are not there, the notes not in the index (recall starts from the index, so
144
+ the AI will not find them unless another note links to them), and notes with no type.
145
+ It goes by file names and the index's links alone, never through a symbolic link, and
146
+ is skipped when the index is over the cap, there is too much to check, or a file cannot
147
+ be read; `engramory_doctor.py` still does the full check.
148
+ Read-only, never a note's text; a name, *Open the index* and
142
149
  *Open the folder* open on the machine dsh runs on; a machine with no desktop (a
143
150
  headless server, a session over SSH) shows none of them. The switches at the top
144
151
  (companion mode, and memory access once it is on) save as you flip them.
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  - **每轮自动带上记忆索引。** 索引 `MEMORY.md` 只列笔记名字,插件每一步都把它放进上下文,AI 不用先读文件就知道自己记过什么,要细节再打开那条笔记。写入后下一轮就能看到;超出上限的部分不带上,并提醒 AI 压缩。
14
14
  - **索引有硬上限。** 默认 200 行 / 25 KB。AI 用 dsh 的文件工具写索引时,只要插件算得出写完的样子,会超上限就在写入前拒绝,让它先压缩;压缩照样放行。细节见[上限怎么判](#上限怎么判)。
15
15
  - **自带记忆规则。** 记什么、怎么记、什么时候清理,这套规则(skill)随插件注册,不用另外装文件。
16
- - **侧栏多一个「记忆」页。** 只读,列出笔记名字,点名字用电脑上的默认程序打开。
16
+ - **侧栏多一个「记忆」页。** 只读,列出笔记名字,点名字用电脑上的默认程序打开;顺带体检,标出索引里的坏链接和没进索引的笔记。
17
17
 
18
18
  ## 安装
19
19
 
@@ -76,7 +76,7 @@ agent.followup(createUserMessage({
76
76
  ![设置页](https://raw.githubusercontent.com/tinqiao-oss/engramory/master/adapters/dsh/plugin/screenshots/settings-page.png)
77
77
 
78
78
  - **设置页**:dsh 的「插件」页里点开「Engramory 记忆」,能改大肥鱼模式、记忆权限和索引上限。保存走 dsh 自己的配置服务,写进你 profile 的 `cordis.patch.yml` 并重新加载插件。这个接口只有登录了的你能调,AI 没法调用它关掉社交模式。
79
- - **记忆页**:左侧栏「记忆」。列出全局库和各工作区的项目库(设了绝对路径的 `indexPath` 时只列那一个,相对路径则列不出),显示索引离上限还有多远、按类型分组的笔记名字和归档。只读,不显示正文;点名字、「打开索引」「打开文件夹」都在运行 dsh 的那台机器上打开;没有桌面的机器(无界面服务器、SSH 连过去的)不显示这些按钮。顶部的开关(大肥鱼模式,打开后还有记忆权限)拨了就保存。
79
+ - **记忆页**:左侧栏「记忆」。列出全局库和各工作区的项目库(设了绝对路径的 `indexPath` 时只列那一个,相对路径则列不出),显示索引离上限还有多远、按类型分组的笔记名字和归档。每个库附一段体检:索引里指向不存在的文件、不在索引里的笔记(AI 回忆从索引开始,除非别的笔记链到它们,否则通常找不到)、没写类型的笔记。体检只按文件名和索引里的链接判断,不顺着符号链接走;索引超上限、要核对的太多或有文件读不了时不做,完整检查仍用 `engramory_doctor.py`。只读,不显示正文;点名字、「打开索引」「打开文件夹」都在运行 dsh 的那台机器上打开;没有桌面的机器(无界面服务器、SSH 连过去的)不显示这些按钮。顶部的开关(大肥鱼模式,打开后还有记忆权限)拨了就保存。
80
80
 
81
81
  ## 配置
82
82
 
package/client.js CHANGED
@@ -60,6 +60,7 @@ window.__ModuleLoader__.load({
60
60
  invalid: '有一项填得不对:',
61
61
  failed: '保存失败:',
62
62
  panel: '记忆',
63
+ panelTitle: 'Engramory 记忆',
63
64
  memoryIntro: 'AI 自己记下的东西,这里只看不改。点名字用电脑上的默认程序打开。',
64
65
  memoryIntroNoOpen: 'AI 自己记下的东西,这里只看不改。',
65
66
  refresh: '刷新',
@@ -97,6 +98,17 @@ window.__ModuleLoader__.load({
97
98
  group: '{type} · {count}',
98
99
  archive: '归档({count})',
99
100
  more: '文件太多,这里只列出了一部分。',
101
+ healthTitle: '体检',
102
+ healthOk: '体检:没发现问题。',
103
+ healthBroken: '索引里指向不存在的文件({count})',
104
+ healthBrokenMore: '索引里指向不存在的文件({count} 个以上)',
105
+ healthBrokenUnlisted: '索引里有指向不存在的文件,太多了,这里没列出。',
106
+ healthUnindexed: '不在索引里({count}):AI 回忆从索引开始,这些它通常找不到,除非别的笔记链到它们。',
107
+ healthUntyped: '没写类型或类型不认识({count}),列在「其他」里。',
108
+ healthFix: '可以让 AI 整理:把漏掉的补进索引,删掉或改正坏链接。完整检查用 engramory_doctor.py。',
109
+ healthLarge: '要核对的太多,没做体检。',
110
+ healthUnreadable: '有文件读不了,没做体检。',
111
+ healthPartial: '文件太多没列全,没做体检。',
100
112
  }
101
113
  const en = {
102
114
  summary: 'Companion mode and memory access, and the index cap.',
@@ -127,6 +139,7 @@ window.__ModuleLoader__.load({
127
139
  invalid: 'One field is not acceptable: ',
128
140
  failed: 'Saving failed: ',
129
141
  panel: 'Memory',
142
+ panelTitle: 'Engramory memory',
130
143
  memoryIntro: 'What the AI has noted down for itself — to look at, not to edit. Click a name to open it in your computer\'s default app.',
131
144
  memoryIntroNoOpen: 'What the AI has noted down for itself — to look at, not to edit.',
132
145
  refresh: 'Refresh',
@@ -164,6 +177,17 @@ window.__ModuleLoader__.load({
164
177
  group: '{type} · {count}',
165
178
  archive: 'Archive ({count})',
166
179
  more: 'Too many files: only some are listed here.',
180
+ healthTitle: 'Check-up',
181
+ healthOk: 'Check-up: nothing to fix.',
182
+ healthBroken: 'The index points to files that are not there ({count})',
183
+ healthBrokenMore: 'The index points to files that are not there (over {count})',
184
+ healthBrokenUnlisted: 'The index points to files that are not there: too many to list here.',
185
+ healthUnindexed: 'Not in the index ({count}): recall starts from the index, so the AI will not find these unless another note links to them.',
186
+ healthUntyped: 'No type, or one it does not know ({count}), listed under Other.',
187
+ healthFix: 'The AI can tidy this up: add what is missing to the index, and remove or fix the broken links. For a full check, run engramory_doctor.py.',
188
+ healthLarge: 'Too much to check here, so no check-up.',
189
+ healthUnreadable: 'Some files could not be read, so no check-up.',
190
+ healthPartial: 'Too many files to list them all, so no check-up here.',
167
191
  }
168
192
 
169
193
  const CSS = `
@@ -223,6 +247,8 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
223
247
  .eng-name:focus-visible,.eng-btn:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary));outline-offset:1px;}
224
248
  .eng-archive>summary{cursor:pointer;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
225
249
  .eng-archive[open]>summary{margin-bottom:2px;}
250
+ .eng-health{display:flex;flex-direction:column;gap:8px;padding:10px 14px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-layer-1);}
251
+ .eng-health-item{margin:0;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary);}
226
252
  `
227
253
 
228
254
  /** The settings the page edits, in the order the host computes its revision from. */
@@ -515,7 +541,40 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
515
541
  const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
516
542
  const byName = (a, b) => collator.compare(a, b)
517
543
 
518
- /** One store: where it is, how full its index is, and its notes' names by type. */
544
+ /**
545
+ * A store's check-up (index.js checkUp): that nothing was found, what was, or why it
546
+ * did not run. An index over the cap is not checked, and the page already says so.
547
+ */
548
+ function Health({ store, names, t }) {
549
+ const check = store.health
550
+ if (check === undefined || check === null) return null
551
+ if (!check.checked) {
552
+ const reason = { large: 'healthLarge', partial: 'healthPartial', unreadable: 'healthUnreadable' }[check.reason]
553
+ return reason === undefined ? null : h('p', { className: 'eng-note' }, t(reason))
554
+ }
555
+ const untyped = store.notes.filter((note) => note.type === 'other').length
556
+ // pointers to nothing past what the page is told of are still pointers to nothing
557
+ const broken = check.broken.length > 0 || check.brokenMore
558
+ if (!broken && check.unindexed.length === 0 && untyped === 0) {
559
+ return h('p', { className: 'eng-note' }, t('healthOk'))
560
+ }
561
+ return h('section', { className: 'eng-health', 'aria-label': t('healthTitle') },
562
+ h('h3', { className: 'eng-group-title' }, t('healthTitle')),
563
+ broken ? h('div', { className: 'eng-group' },
564
+ h('p', { className: 'eng-health-item' },
565
+ check.broken.length === 0 ? t('healthBrokenUnlisted')
566
+ : t(check.brokenMore ? 'healthBrokenMore' : 'healthBroken', { count: check.broken.length })),
567
+ // what the index says, as it says it: there is no file to open
568
+ check.broken.length > 0 ? h('ul', { className: 'eng-names' }, check.broken.map((target) => h('li', { key: target },
569
+ h('span', { className: 'eng-name', title: target }, target)))) : null) : null,
570
+ check.unindexed.length > 0 ? h('div', { className: 'eng-group' },
571
+ h('p', { className: 'eng-health-item' }, t('healthUnindexed', { count: check.unindexed.length })),
572
+ names(check.unindexed, false)) : null,
573
+ untyped > 0 ? h('p', { className: 'eng-health-item' }, t('healthUntyped', { count: untyped })) : null,
574
+ h('p', { className: 'eng-note' }, t('healthFix')))
575
+ }
576
+
577
+ /** One store: where it is, how full its index is, its check-up, and its notes' names by type. */
519
578
  function StoreSection({ store, cap, canOpen, open, t }) {
520
579
  const title = store.kind === 'user' ? [t('storeUser'), ...store.titles].join(' · ')
521
580
  : store.kind === 'pinned' ? [t('storePinned'), ...store.titles].join(' · ')
@@ -546,6 +605,7 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
546
605
  t('openFolder'))) : null),
547
606
  h('p', { className: 'eng-path' }, store.dir),
548
607
  index?.over ? h('p', { className: 'eng-note' }, t('overHint')) : null,
608
+ h(Health, { store, names, t }),
549
609
  ...groups.map(([type, list]) => h('div', { className: 'eng-group', key: type },
550
610
  h('h3', { className: 'eng-group-title' }, t('group', { type: t(typeKey(type)), count: list.length })),
551
611
  names(list, false))),
@@ -597,7 +657,7 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
597
657
  return h('div', { className: 'eng-memory' },
598
658
  h('header', { className: 'eng-memory-head' },
599
659
  h('div', null,
600
- h('h1', { className: 'eng-memory-title' }, t('panel')),
660
+ h('h1', { className: 'eng-memory-title' }, t('panelTitle')),
601
661
  h('p', { className: 'eng-memory-intro' }, t(data !== undefined && !canOpen ? 'memoryIntroNoOpen' : 'memoryIntro'))),
602
662
  h('button', { type: 'button', className: 'eng-btn', onClick: () => { setStatus(undefined); load() } }, t('refresh'))),
603
663
  h(SettingsStrip, { t }),
@@ -606,13 +666,14 @@ button.eng-name:disabled{cursor:default;opacity:.6;}
606
666
  body)
607
667
  }
608
668
 
609
- /** The sidebar entry's icon: a book, drawn in the row's own colour at the size it asks for. */
669
+ /** The sidebar entry's icon: the logo, [[ ]] around a cursor, drawn in the row's own colour
670
+ * (so it follows dsh's light and dark themes) at the size it asks for. */
610
671
  function MemoryIcon({ size }) {
611
672
  return h('svg', { width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor',
612
- strokeWidth: 1.6, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true },
613
- h('path', { d: 'M6 3.5h11.5v14H7.25A1.75 1.75 0 0 0 5.5 19.25V5A1.5 1.5 0 0 1 6 3.5z' }),
614
- h('path', { d: 'M5.5 19.25A1.75 1.75 0 0 0 7.25 21h10.25v-3.5' }),
615
- h('path', { d: 'M9 8h5.5M9 11h3.5' }))
673
+ strokeWidth: 1.8, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true },
674
+ h('path', { d: 'M5.1 3.5H2.5v17h2.6M9.2 3.5H6.6v17h2.6' }),
675
+ h('path', { d: 'M18.9 3.5h2.6v17h-2.6M14.8 3.5h2.6v17h-2.6' }),
676
+ h('rect', { x: 10.4, y: 7, width: 3.2, height: 10, rx: 1, fill: 'currentColor', stroke: 'none' }))
616
677
  }
617
678
 
618
679
  return {