dsh-memory-metabolism 0.2.3 → 0.2.4

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
@@ -6,7 +6,7 @@ Local-first Markdown memory for DeepSeek Harness, with a full-page memory workbe
6
6
 
7
7
  *Screenshots use demo data.*
8
8
 
9
- Status: 0.2.3. The Markdown store, workbench, chat and organizer are usable; retention/write thresholds remain tunable.
9
+ Status: 0.2.4. The Markdown store, workbench, chat and organizer are usable; retention/write thresholds remain tunable.
10
10
 
11
11
  ## Why
12
12
 
package/README.zh.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  *截图为演示数据。*
8
8
 
9
- 状态:0.2.3。记忆存储、工作台、聊天和整理已可用;写入阈值和留存参数仍可调整。
9
+ 状态:0.2.4。记忆存储、工作台、聊天和整理已可用;写入阈值和留存参数仍可调整。
10
10
 
11
11
  ## 为什么
12
12
 
package/client.js CHANGED
@@ -71,6 +71,8 @@ window.__ModuleLoader__.load({
71
71
  wbMemory: '记忆条目', wbAssistantPanel: '记忆助手', wbSearchMemory: '搜索记忆…', wbAll: '全部', wbNoMemory: '没有匹配的条目。',
72
72
  wbAutoOrganize: '自动整理', wbAutoOrganizeHint: '每段请求安静后后台提炼日志和候选;不会自动改人格或归档。',
73
73
  wbDiagnostics: '诊断', wbInjectionPreview: '注入预览', wbLastInjections: '最近注入', wbOrganizerState: '自动整理器', wbErrors: '最近错误', wbNoDiagnostics: '暂无诊断数据。', wbPreviewTotal: '合计', wbTruncated: '已截断', wbDiagRefresh: '刷新诊断', wbNoErrors: '没有记录错误。', wbNoOrganizer: '还没有运行记录。',
74
+ wbAllProjectsChars: '全部项目合计',
75
+ wbOpened: '已打开:{path}', wbCopyPath: '复制数据路径', wbPathCopied: '路径已复制。', wbInjectedNote: '全局 + 当前项目',
74
76
  wbFileEntries: '文件入口', wbOpenData: '数据目录', wbOpenGlobal: '全局记忆', wbOpenProject: '项目记忆', wbOpenPersona: '插件人格', wbOpenConventions: '协作约定', wbOpenHostPersona: 'AGENTS.md', wbOpenReferences: '参考文档', wbOpenChats: '对话记录', wbMoved: '已重新分级。', wbMoveToGlobal: '移到用户级', wbMoveToProject: '移到项目级', wbNoForget: '免遗忘', wbOpenFailed: '打开失败:{error}', wbPathHint: '只打开已知文件/目录,不接受任意路径。',
75
77
  wbUseful: '有用', wbApprove: '批准', wbArchiveConfirm: '归档这条记忆?归档后不再注入,但不会物理删除。', wbMemoryHint: '主区域直接浏览和操作;助手只在需要时处理。', wbRetention: '留存', wbShowAssistant: '显示助手', wbHideAssistant: '收起助手', wbDirectAction: '直接操作',
76
78
  },
@@ -138,6 +140,8 @@ window.__ModuleLoader__.load({
138
140
  wbMemory: 'Memories', wbAssistantPanel: 'Memory assistant', wbSearchMemory: 'Search memories…', wbAll: 'All', wbNoMemory: 'No matching memories.',
139
141
  wbAutoOrganize: 'Auto-organize', wbAutoOrganizeHint: 'After a request settles, extract a daily log and memory candidates in the background; never edits persona or archives on its own.',
140
142
  wbDiagnostics: 'Diagnostics', wbInjectionPreview: 'Injection preview', wbLastInjections: 'Recent injections', wbOrganizerState: 'Auto organizer', wbErrors: 'Recent errors', wbNoDiagnostics: 'No diagnostics yet.', wbPreviewTotal: 'Total', wbTruncated: 'truncated', wbDiagRefresh: 'Refresh diagnostics', wbNoErrors: 'No recorded errors.', wbNoOrganizer: 'No organizer run yet.',
143
+ wbAllProjectsChars: 'all projects total',
144
+ wbOpened: 'Opened: {path}', wbCopyPath: 'Copy data path', wbPathCopied: 'Path copied.', wbInjectedNote: 'global + current project',
141
145
  wbFileEntries: 'File entries', wbOpenData: 'Data folder', wbOpenGlobal: 'Global memory', wbOpenProject: 'Project memory', wbOpenPersona: 'Plugin persona', wbOpenConventions: 'Conventions', wbOpenHostPersona: 'AGENTS.md', wbOpenReferences: 'References', wbOpenChats: 'Chat logs', wbMoved: 'Reclassified.', wbMoveToGlobal: 'Move to user', wbMoveToProject: 'Move to project', wbNoForget: 'No-forget', wbOpenFailed: 'Open failed: {error}', wbPathHint: 'Only known files/folders can be opened; arbitrary paths are rejected.',
142
146
  wbUseful: 'Useful', wbApprove: 'Approve', wbArchiveConfirm: 'Archive this memory? It will stop being injected, but is not deleted.', wbMemoryHint: 'Browse and act directly in the main area; use the assistant only when needed.', wbRetention: 'Retention', wbShowAssistant: 'Show assistant', wbHideAssistant: 'Hide assistant', wbDirectAction: 'Direct actions',
143
147
  },
@@ -673,7 +677,8 @@ window.__ModuleLoader__.load({
673
677
 
674
678
  const openEntry = async (kind) => {
675
679
  try {
676
- await call('/api/memory-metabolism/open', { kind, project: status?.lastProject })
680
+ const result = await call('/api/memory-metabolism/open', { kind, project: status?.lastProject })
681
+ setNotice({ kind: 'ok', text: tx('wbOpened', { path: result.path || '' }) })
677
682
  } catch (error) {
678
683
  setNotice({ kind: 'err', text: tx('wbOpenFailed', { error: error.message }) })
679
684
  }
@@ -691,6 +696,15 @@ window.__ModuleLoader__.load({
691
696
  } finally { setDiagBusy(false) }
692
697
  }
693
698
 
699
+ const copyPath = async (kind) => {
700
+ const path = status?.paths?.[kind]?.path
701
+ if (!path) return
702
+ try {
703
+ await navigator.clipboard.writeText(path)
704
+ setNotice({ kind: 'ok', text: t('wbPathCopied') })
705
+ } catch (error) { setNotice({ kind: 'err', text: tx('wbError', { error: error.message }) }) }
706
+ }
707
+
694
708
  const reclassifyMemory = async (entry) => {
695
709
  if (!entry || memBusy) return
696
710
  const target = entry.scope === 'global' ? 'project' : 'global'
@@ -995,7 +1009,7 @@ window.__ModuleLoader__.load({
995
1009
  h('div', { className: 'mmx-ring', style: { '--mmx-pct': pctValue + '%' } }, h('span', null, pctValue + '%')),
996
1010
  h('div', null,
997
1011
  h('div', { className: 'mmx-card-value', style: { fontSize: '18px' } }, chars, h('small', null, '/ ' + budget)),
998
- h('div', { className: 'mmx-card-note' }, t('wbTotalChars') + ' ' + totalChars)))),
1012
+ h('div', { className: 'mmx-card-note' }, t('wbInjectedNote') + ' · ' + t('wbAllProjectsChars') + ' ' + totalChars)))),
999
1013
  h('div', { className: 'mmx-card' },
1000
1014
  h('div', { className: 'mmx-card-label' }, t('wbPending')),
1001
1015
  h('div', { className: 'mmx-card-value' }, candidate + (orgReport?.duplicateGroups?.length || 0), h('small', null, t('wbCandidate') + ' + ' + t('wbDuplicates'))),
@@ -1172,14 +1186,16 @@ window.__ModuleLoader__.load({
1172
1186
  h('div', { className: 'mmx-section-title' }, t('wbFileEntries')),
1173
1187
  h('div', { className: 'mmx-hint' }, t('wbPathHint')),
1174
1188
  h('div', { className: 'mmx-file-grid' },
1175
- h('button', { className: 'mmx-btn', onClick: () => void openEntry('data') }, t('wbOpenData')),
1176
- h('button', { className: 'mmx-btn', onClick: () => void openEntry('global') }, t('wbOpenGlobal')),
1177
- h('button', { className: 'mmx-btn', onClick: () => void openEntry('project') }, t('wbOpenProject')),
1178
- h('button', { className: 'mmx-btn', onClick: () => void openEntry('hostPersona') }, t('wbOpenHostPersona')),
1189
+ h('button', { className: 'mmx-btn', title: status?.paths?.data?.path || '', onClick: () => void openEntry('data') }, t('wbOpenData')),
1190
+ h('button', { className: 'mmx-btn', onClick: () => void copyPath('data') }, t('wbCopyPath')),
1191
+ h('button', { className: 'mmx-btn', title: status?.paths?.global?.path || '', onClick: () => void openEntry('global') }, t('wbOpenGlobal')),
1192
+ h('button', { className: 'mmx-btn', title: status?.paths?.project?.path || '', onClick: () => void openEntry('project') }, t('wbOpenProject')),
1193
+ h('button', { className: 'mmx-btn', title: status?.paths?.hostPersona?.path || '', onClick: () => void openEntry('hostPersona') }, t('wbOpenHostPersona')),
1179
1194
  h('button', { className: 'mmx-btn', onClick: () => void openEntry('conventions') }, t('wbOpenConventions')),
1180
1195
  h('button', { className: 'mmx-btn', onClick: () => void openEntry('persona') }, t('wbOpenPersona')),
1181
1196
  h('button', { className: 'mmx-btn', onClick: () => void openEntry('references') }, t('wbOpenReferences')),
1182
- h('button', { className: 'mmx-btn', onClick: () => void openEntry('chats') }, t('wbOpenChats')))),
1197
+ h('button', { className: 'mmx-btn', onClick: () => void openEntry('chats') }, t('wbOpenChats'))),
1198
+ h('div', { className: 'mmx-hint', style: { wordBreak: 'break-all', marginTop: '6px' } }, status?.paths?.data?.path || '')),
1183
1199
  h('div', { className: 'mmx-row' },
1184
1200
  h('button', { className: 'mmx-btn mmx-btn-primary', onClick: () => void saveSettings() }, t('wbSaveSettings')),
1185
1201
  h('button', { className: 'mmx-btn', onClick: () => setDrawer('') }, t('wbClose'))),
package/lib/open.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { spawn } from 'node:child_process'
2
2
  import { existsSync, statSync } from 'node:fs'
3
- import { dirname } from 'node:path'
3
+ import { dirname, join } from 'node:path'
4
4
  import { platform } from 'node:os'
5
5
 
6
6
  function isDirectory(path) {
@@ -8,12 +8,12 @@ function isDirectory(path) {
8
8
  }
9
9
 
10
10
  export function revealPath(target, { reveal = false } = {}) {
11
- if (typeof target !== 'string' || target === '') return { ok: false, error: 'path is empty' }
11
+ if (typeof target !== 'string' || target === '') return Promise.resolve({ ok: false, error: 'path is empty' })
12
12
  const kind = platform()
13
13
  let launch
14
14
  let args
15
15
  if (kind === 'win32') {
16
- launch = 'explorer.exe'
16
+ launch = join(process.env.SystemRoot || 'C:\\Windows', 'explorer.exe')
17
17
  args = reveal && !isDirectory(target) ? ['/select,' + target] : [target]
18
18
  } else if (kind === 'darwin') {
19
19
  launch = 'open'
@@ -22,14 +22,25 @@ export function revealPath(target, { reveal = false } = {}) {
22
22
  launch = 'xdg-open'
23
23
  args = [reveal && !isDirectory(target) ? dirname(target) : target]
24
24
  }
25
- try {
26
- const child = spawn(launch, args, { detached: true, stdio: 'ignore', windowsHide: true })
27
- child.on('error', () => { /* the caller still gets the path */ })
28
- child.unref()
29
- return { ok: true, path: target, reveal }
30
- } catch (error) {
31
- return { ok: false, error: error?.message || String(error), path: target }
32
- }
25
+ return new Promise((resolve) => {
26
+ let settled = false
27
+ const done = (value) => {
28
+ if (settled) return
29
+ settled = true
30
+ resolve(value)
31
+ }
32
+ try {
33
+ const child = spawn(launch, args, { detached: true, stdio: 'ignore', windowsHide: true })
34
+ child.once('error', (error) => done({ ok: false, error: error?.message || String(error), path: target }))
35
+ child.once('spawn', () => {
36
+ try { child.unref() } catch { /* noop */ }
37
+ done({ ok: true, path: target, reveal })
38
+ })
39
+ setTimeout(() => done({ ok: true, path: target, reveal }), 3000).unref?.()
40
+ } catch (error) {
41
+ done({ ok: false, error: error?.message || String(error), path: target })
42
+ }
43
+ })
33
44
  }
34
45
 
35
46
  export function existingTarget(target) {
package/lib/service.js CHANGED
@@ -313,13 +313,13 @@ export function createService({ store, config }) {
313
313
  return Object.fromEntries(Object.entries(entries).filter(([, value]) => value))
314
314
  }
315
315
 
316
- function openPath(kind, project) {
316
+ async function openPath(kind, project) {
317
317
  const paths = pathEntries(project)
318
318
  const entry = paths[String(kind || '')]
319
319
  if (!entry) return { ok: false, error: 'unknown file entry: ' + kind }
320
320
  const target = existingTarget(entry.path)
321
321
  if (!target) return { ok: false, error: 'path does not exist: ' + entry.path }
322
- const opened = revealPath(target, { reveal: entry.type === 'file' && existsSync(entry.path) })
322
+ const opened = await revealPath(target, { reveal: entry.type === 'file' && existsSync(entry.path) })
323
323
  if (!opened.ok) return { ...opened, kind, requested: entry.path }
324
324
  return { ...opened, kind, requested: entry.path, missing: target !== entry.path }
325
325
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-memory-metabolism",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Local-first Markdown memory for DeepSeek Harness with a full-page memory workbench, independent chat threads, project scoping and a restricted memory assistant.",
5
5
  "type": "module",
6
6
  "exports": {