@restregular/dsh-memory 0.10.1 → 0.11.1

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/icon.svg CHANGED
@@ -1,6 +1,6 @@
1
1
  <svg viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
2
  <!--
3
- 长期记忆图标:年轮。
3
+ 记忆系统图标:年轮。
4
4
 
5
5
  记忆是时间累积出来的东西 —— 一圈一圈长出来的年轮,比"内存条/芯片"更贴
6
6
  "长期";金色年轮压在深咖底上,像一枚封蜡印章。配色刻意避开插件列表里大量
package/lib/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * dsh-memory — 客户端半边(设置页「记忆」区块)。
2
+ * dsh-memory — 客户端半边(设置页「记忆系统」区块)。
3
3
  *
4
4
  * 合并后本 bundle 与 provider / 工具 / 注入同属一个 npm 包
5
5
  * `@restregular/dsh-memory`:一个包名、一条 Loader entry、两侧都在。
@@ -854,7 +854,7 @@ window.__ModuleLoader__.load({
854
854
  },
855
855
  h('span', { className: 'root-icon' }, h(NavLineIcon, { size: 19 })),
856
856
  h('span', null,
857
- h('b', null, '记忆'),
857
+ h('b', null, '记忆系统'),
858
858
  h('span', null, `${node.count} 条`),
859
859
  ),
860
860
  )
@@ -1634,7 +1634,7 @@ window.__ModuleLoader__.load({
1634
1634
  },
1635
1635
  {
1636
1636
  key: 'sidebar', title: '侧栏入口',
1637
- desc: '在左侧栏「插件」下方显示「记忆」入口,点击在主界面打开面板。',
1637
+ desc: '在左侧栏「插件」下方显示「记忆系统」入口,点击在主界面打开面板。',
1638
1638
  fields: [
1639
1639
  { k: 'enabled', label: '启用', type: 'bool', hint: '关闭只隐藏侧栏入口,设置页仍然可用。' },
1640
1640
  ],
@@ -2331,7 +2331,7 @@ window.__ModuleLoader__.load({
2331
2331
  /** 侧栏入口打开的主界面页面(整块可滚动,内容就是面板本体)。 */
2332
2332
  function MemoryPage() {
2333
2333
  return h('div', { className: 'mem-page' },
2334
- h('div', { className: 'mem-page-head' }, h('h2', null, '记忆')),
2334
+ h('div', { className: 'mem-page-head' }, h('h2', null, '记忆系统')),
2335
2335
  h(MemoryPanel, {}),
2336
2336
  )
2337
2337
  }
@@ -2380,7 +2380,7 @@ window.__ModuleLoader__.load({
2380
2380
  () => React.createElement(MemoryPanel),
2381
2381
  ))
2382
2382
 
2383
- // 侧栏入口(可选):开启后在左侧栏「插件」下方多一个「记忆」,点击在主界面打开面板。
2383
+ // 侧栏入口(可选):开启后在左侧栏「插件」下方多一个「记忆系统」,点击在主界面打开面板。
2384
2384
  // 注册契约见 dsh-client-ui-schedule:sidebar.panellist 给 id/label/icon,main 用同一个 key。
2385
2385
  let sidebarDisposers = null
2386
2386
  const syncSidebar = () => {
@@ -2422,10 +2422,10 @@ window.__ModuleLoader__.load({
2422
2422
  * 侧栏这一行的显示名。导航图标覆盖靠"认出自己那一行"来定位,所以文案必须只有一处,
2423
2423
  * 注册与识别共用这个常量(改文案时不会漏改)。
2424
2424
  */
2425
- const NAV_LABEL = '记忆'
2425
+ const NAV_LABEL = '记忆系统'
2426
2426
 
2427
2427
  /**
2428
- * 设置侧栏「记忆」那一行的图标 —— 与侧栏入口、插件列表共用同一只年轮。
2428
+ * 设置侧栏「记忆系统」那一行的图标 —— 与侧栏入口、插件列表共用同一只年轮。
2429
2429
  *
2430
2430
  * 宿主把导航图标写死在 `dsh-client-ui-settings-general` 的 `navIcon(id)` 里:只有
2431
2431
  * account / models / agent-presets / plugins / archived-sessions 五个 id 有专属图标
@@ -2482,7 +2482,7 @@ window.__ModuleLoader__.load({
2482
2482
  }
2483
2483
 
2484
2484
  /**
2485
- * 在"含「记忆」那一行"上做记号并换图。
2485
+ * 在"含「记忆系统」那一行"上做记号并换图。
2486
2486
  *
2487
2487
  * 关键:记号打在**按钮自己**身上,绝不打在父级 navList 上 —— 整列是同一个容器,
2488
2488
  * 打到父级等于给所有区块都加图标。面板随时可能卸载/重挂(它是 body 上的 portal),
@@ -15,7 +15,7 @@ import { estimateTokens } from '../provider/rerank.js'
15
15
 
16
16
 
17
17
  const HEADER =
18
- '以下是本项目 / 全局已有的长期记忆摘要(按重要度挑出的前几条;' +
18
+ '以下是本项目 / 全局已有的记忆摘要(按重要度挑出的前几条;' +
19
19
  '需要原文用 memory_search,删除用 memory_forget):'
20
20
 
21
21
  const HINT_HEADER = '相关记忆索引(正文未注入):'
@@ -215,7 +215,7 @@ export function renderRecallBlock(
215
215
  const chars = impression ? (options.chars ?? 120) : 300
216
216
  const header = impression
217
217
  ? '以下是与你这次请求可能相关的记忆摘要:'
218
- : '以下是与此请求可能相关的长期记忆,供参考(可用 memory_search 核实,用 memory_forget 删除):'
218
+ : '以下是与此请求可能相关的记忆,供参考(可用 memory_search 核实,用 memory_forget 删除):'
219
219
  let tokens = estimateTokens(header) + 4
220
220
  const lines = []
221
221
  const ids = []
@@ -2,7 +2,7 @@
2
2
  * 「记忆使用策略」常驻段:告诉模型什么时候查、查到怎么用、查不到怎么办。
3
3
  * 只写操作口径,不写具体记忆内容 —— 内容由摘要 / 召回 / 规则段负责。
4
4
  */
5
- export const POLICY_TEXT = `## 长期记忆
5
+ export const POLICY_TEXT = `## 记忆系统
6
6
 
7
7
  本会话挂着一个本地记忆库,工具:memory_search / memory_list / memory_get / memory_save / memory_forget(可按会话、项目、全局等作用域读写)。
8
8
 
@@ -22,10 +22,10 @@ import { estimateTokens } from '../provider/rerank.js'
22
22
  import { supersededIds } from './digest.js'
23
23
 
24
24
  export const RULES_HEADER =
25
- '以下是必须遵守的硬性规则(来自 kind=rule 的长期记忆;除非用户明确要求破例,否则按它做):'
25
+ '以下是必须遵守的硬性规则(来自 kind=rule 的记忆;除非用户明确要求破例,否则按它做):'
26
26
 
27
27
  export const RULES_DELTA_HEADER =
28
- '以下是新增或变更的硬性规则(来自 kind=rule 的长期记忆;从现在起按它做):'
28
+ '以下是新增或变更的硬性规则(来自 kind=rule 的记忆;从现在起按它做):'
29
29
 
30
30
  /** mandatory/pinned 是显式的标签约定,不把全部 kind=rule 自动升级。 */
31
31
  const MANDATORY_TAGS = new Set(['mandatory', 'pinned', '必含', '强制'])
@@ -27,6 +27,13 @@ export class CordisMemoryService extends Service {
27
27
  constructor(ctx , config = {}) {
28
28
  super(ctx, 'memory')
29
29
  this.impl = new LocalMemoryService(config)
30
+ // 0.11.1:同一个目录因为 `D:/x` 与 `D:\x` 写法不同而分叉成两个 scope 的历史数据,
31
+ // 在装配期合并一次(每进程一次;失败只影响合并,不影响读写)。
32
+ try {
33
+ this.impl.reconcileScopes()
34
+ } catch {
35
+ // 合并失败:两个 scope 继续并存(读写仍然正常),不阻断插件加载
36
+ }
30
37
  ctx.effect(() => () => this.impl.flushSync())
31
38
  this.attachRerank(ctx, config)
32
39
  }
@@ -16,8 +16,10 @@
16
16
 
17
17
  import { MemoryStore, scopeFileName, } from './store.js'
18
18
  import {
19
+ canonicalWorkspacePath,
19
20
  isCustomScope,
20
21
  normalizeScopeInput,
22
+ projectScopeIdentity,
21
23
  resolveCurrentScopes,
22
24
  scopeKind,
23
25
  scopeTier,
@@ -490,6 +492,8 @@ export class LocalMemoryService {
490
492
  projectScope
491
493
  /** 上次发现磁盘 scope 的时间(限流用;0 = 还没发现过)。 */
492
494
  discoveredAt = 0
495
+ /** "同一目录不同写法"的项目作用域是否已经合并过(每个进程只做一次)。 */
496
+ scopesReconciled = false
493
497
  /** 作用域别名(project:<路径> → 显示名),落盘 <storeDir>/scopes.json。 */
494
498
  names
495
499
  /** 注入设置(面板「设置」标签页可改;落盘在 <storeDir>/settings.json)。 */
@@ -608,15 +612,16 @@ export class LocalMemoryService {
608
612
  * 默认排除已被 supersede 的旧记录;需要历史/审计时显式 includeSuperseded。
609
613
  */
610
614
  listSync(input = {}) {
615
+ const wanted = (input.scopes ?? []).map((scope) => this.canonicalScope(scope))
611
616
  const seen = new Set ()
612
617
  const stores = []
613
- for (const scope of input.scopes ?? []) {
618
+ for (const scope of wanted) {
614
619
  if (seen.has(scope)) continue
615
620
  seen.add(scope)
616
621
  const s = this.store.peek(scope)
617
622
  if (s) stores.push(s)
618
623
  }
619
- const retired = input.includeSuperseded ? new Set () : new Set(this.supersededIds(input.scopes))
624
+ const retired = input.includeSuperseded ? new Set () : new Set(this.supersededIds(wanted))
620
625
  const out = []
621
626
  for (const s of stores) {
622
627
  for (const rec of s.records.values()) {
@@ -1738,9 +1743,21 @@ export class LocalMemoryService {
1738
1743
  return this.names.scopeOf(name)
1739
1744
  }
1740
1745
 
1741
- /** 自定义名可能是别名:统一转回真实键,读写口径共用。 */
1746
+ /**
1747
+ * 作用域键归一:自定义名可能是别名 → 转回真实键;`project:<路径>` 统一路径写法。
1748
+ *
1749
+ * 项目键必须过 `canonicalWorkspacePath`:工具层的 `path`、模型显式给的
1750
+ * `project:D:/x`、面板 HTTP 写入都从这里落盘,同一个目录不能因为 `/` 与 `\` 的差别
1751
+ * 变成两个 scope(0.11.1;读路径的键来自 resolveCurrentScopes,也走同一套规范化)。
1752
+ */
1742
1753
  canonicalScope(scope ) {
1743
- if (scope === 'global' || scope.startsWith('project:') || scope.startsWith('session:')) return scope
1754
+ if (scope === 'global' || scope.startsWith('session:')) return scope
1755
+ if (scope.startsWith('project:')) {
1756
+ const path = scope.slice('project:'.length)
1757
+ if (path === '') return scope
1758
+ const canonical = canonicalWorkspacePath(path)
1759
+ return (canonical === path ? scope : `project:${canonical}`)
1760
+ }
1744
1761
  return (this.names.scopeOf(scope) ) ?? scope
1745
1762
  }
1746
1763
 
@@ -1790,10 +1807,105 @@ export class LocalMemoryService {
1790
1807
  } catch {
1791
1808
  // 发现失败不影响读写,清单里少几个而已
1792
1809
  }
1810
+ try {
1811
+ this.reconcileScopes()
1812
+ } catch {
1813
+ // 合并失败同样不影响读写:留着两个 scope 也比丢数据强
1814
+ }
1793
1815
  }
1794
1816
  return this.knownScopes()
1795
1817
  }
1796
1818
 
1819
+ /**
1820
+ * 把"同一个目录的不同写法"合并成一个项目作用域(0.11.1,每个进程只跑一次)。
1821
+ *
1822
+ * 0.7.0 引入 `memory_save({ path })` 之后, `D:/repositories/x` 与 `D:\repositories\x`
1823
+ * 会落成两个 scope 文件;工作区里的会话用宿主给的 `header.cwd`,于是另一份里的记忆
1824
+ * 永远读不到(面板里还会看到两个同名作用域)。写入侧已在 `canonicalScope` 统一写法,
1825
+ * 这里负责把**历史数据**并到规范键上:
1826
+ * - 同组的判定走 `projectScopeIdentity`(Windows 盘符路径再折叠大小写,POSIX 不动);
1827
+ * - 目标键优先选"写法已经规范"的那一个,其次记录多的(稳定时按键名);**只有变体存在时
1828
+ * 改名**到规范键(否则会话读规范键、永远看不到这份记忆);
1829
+ * - 记录按 id 并入目标(目标已有同 id 就跳过);向量长度与当前配置一致时一起搬;
1830
+ * - 别名跟着走(目标没有别名时才接管),迁空的 scope 由 flush 顺手删掉文件。
1831
+ * 多进程并发时,flush 的"锁内重新读盘 + 只合并本进程增量"兜底:这里只发 upsert/delete,
1832
+ * 不会把别的进程刚写的内容覆盖掉。
1833
+ */
1834
+ reconcileScopes() {
1835
+ if (this.scopesReconciled) return { merged: 0 }
1836
+ this.scopesReconciled = true
1837
+ // 直接调用(装配期)时还没有发现过磁盘 scope:先发现,否则只能看到已加载的那两个,
1838
+ // 合并会漏、而且这唯一一次机会被浪费掉。
1839
+ if (this.discoveredAt === 0) {
1840
+ this.discoveredAt = Date.now()
1841
+ try {
1842
+ this.store.loadDiscovered()
1843
+ } catch {
1844
+ // 发现失败:清单少几个,不影响读写
1845
+ }
1846
+ }
1847
+ const groups = new Map ()
1848
+ for (const store of this.store.allScopes()) {
1849
+ if (!store.scope.startsWith('project:')) continue
1850
+ const path = store.scope.slice('project:'.length)
1851
+ if (path === '') continue
1852
+ const identity = projectScopeIdentity(path)
1853
+ const list = groups.get(identity)
1854
+ const entry = { scope: store.scope, store, records: store.records.size }
1855
+ if (list === undefined) groups.set(identity, [entry])
1856
+ else list.push(entry)
1857
+ }
1858
+ let merged = 0
1859
+ for (const list of groups.values()) {
1860
+ const canonicalOf = (scope ) =>
1861
+ `project:${canonicalWorkspacePath(scope.slice('project:'.length))}`
1862
+ // 1) 写法已经规范的优先 2) 记录多的 3) 键名字典序(稳定,避免每次合并目标漂移)
1863
+ list.sort((a, b) =>
1864
+ Number(canonicalOf(b.scope) === b.scope) - Number(canonicalOf(a.scope) === a.scope)
1865
+ || b.records - a.records
1866
+ || a.scope.localeCompare(b.scope))
1867
+ const targetScope = list[0] .scope
1868
+ // 只有变体存在时(用 path 参数写进来的记忆,会话还没写过那个目录)也要**改名**:
1869
+ // 会话读的是规范键,不改名等于这份记忆永远看不见。改名后 records 一条不少。
1870
+ const canonicalTarget = canonicalOf(targetScope)
1871
+ const finalTarget = canonicalTarget === targetScope ? targetScope : canonicalTarget
1872
+ const sources = list.filter((entry) => entry.scope !== finalTarget)
1873
+ if (sources.length === 0) continue
1874
+ const targetStore = this.store.scope(finalTarget)
1875
+ for (const source of sources) {
1876
+ for (const record of [...source.store.records.values()]) {
1877
+ if (!targetStore.records.has(record.id)) {
1878
+ targetStore.insert({ ...record, scope: finalTarget })
1879
+ const vector = source.store.vectors.get(record.id)
1880
+ // 向量只有在维度与当前配置一致时才可信(换过模型/池化的边车已被 loadScope 校验过,
1881
+ // 这里再按维度兜一层);搬不动的留给回填/重启后重新嵌入。
1882
+ if (vector !== undefined && vector.length === this.cfg.vector.dims) {
1883
+ targetStore.setVector(record.id, vector)
1884
+ }
1885
+ }
1886
+ source.store.remove(record.id)
1887
+ }
1888
+ const alias = this.names.nameOf(source.scope)
1889
+ if (alias !== undefined) {
1890
+ this.names.release(source.scope)
1891
+ if (this.names.nameOf(finalTarget) === undefined) {
1892
+ try {
1893
+ this.names.claim(finalTarget, alias)
1894
+ } catch {
1895
+ // 名字已被别的 scope 占用 → 放弃别名(路径本身仍可引用)
1896
+ }
1897
+ }
1898
+ }
1899
+ merged += 1
1900
+ }
1901
+ }
1902
+ if (merged > 0) {
1903
+ this.store.flush()
1904
+ console.warn(`[dsh-memory-local] 已合并 ${merged} 个"同一目录不同写法"的项目作用域`)
1905
+ }
1906
+ return { merged }
1907
+ }
1908
+
1797
1909
  /** Force a synchronous flush (dispose/HMR path). */
1798
1910
  flushSync() {
1799
1911
  if (this.maintenanceTimer) {
@@ -19,6 +19,7 @@
19
19
  * `foo:bar` 会与保留前缀撞成同一个键空间,用户也能靠它伪造 `project:` 键。
20
20
  */
21
21
  import { createHash } from 'node:crypto'
22
+ import { posix, win32 } from 'node:path'
22
23
  import { isCustomScopeKey } from './store.js'
23
24
 
24
25
  /** 作用域键:除 'global' 外的形态由 resolveCurrentScopes / normalizeScopeInput 产生。 */
@@ -185,6 +186,62 @@ export function scopeTier(scope ) {
185
186
  /** 写路径遇到只读 scope 时的错误码('all' 不能写)。 */
186
187
  export const SCOPE_NOT_WRITABLE = 'SCOPE_NOT_WRITABLE'
187
188
 
189
+ // ------------------------------------------------------------------ 项目键的路径写法
190
+
191
+ /** `D:\x` / `D:/x` / `\\server\share` —— 只有这些才按 Windows 语义处理。 */
192
+ const WINDOWS_ABSOLUTE = /^(?:[A-Za-z]:[\\/]|\\\\)/u
193
+ /** Windows 盘符路径(`D:` 后跟分隔符);UNC 没有盘符,单独判。 */
194
+ const DRIVE_PATH = /^[A-Za-z]:[\\/]/u
195
+ const POSIX_ABSOLUTE = /^\//u
196
+
197
+ /**
198
+ * 项目作用域里的**路径规范形**:同一个目录只允许一种写法。
199
+ *
200
+ * 为什么需要:Windows 上 `D:/repositories/dsh-memory` 与 `D:\repositories\dsh-memory`
201
+ * 是同一个目录,但 `project:<路径>` 是字符串键、落盘文件名是它的 SHA-1 —— 两种写法会
202
+ * 变成两个 scope 文件。用 `memory_save({ path })` 写进去的记忆,同一个工作区里的会话
203
+ * (键来自宿主 `session.header.cwd`,反斜杠形式)再也读不到,而且注入 / 面板里会看到
204
+ * 两个"同名"作用域绝对路径。
205
+ *
206
+ * 只做**绝不可能指向另一个目录**的改写:
207
+ * - Windows 绝对路径走 `win32.resolve`:分隔符统一成 `\`、消掉 `.`/`..` 与末尾分隔符,
208
+ * 盘符统一大写(`d:\x` → `D:\x`);
209
+ * - POSIX 绝对路径走 `posix.resolve`(同样消掉 `.`/`..` 与末尾分隔符);
210
+ * - 非绝对路径**原样返回**(不能拿 process.cwd() 去猜:那是 DSH 的 profile 目录);
211
+ * - 大小写除盘符外**不动** —— 既有 scope 文件是按原始大小写做 SHA-1 的,擅自小写会让
212
+ * 旧数据"消失"。只是大小写不同的重复键由 `projectScopeIdentity` 识别、由 provider
213
+ * 在发现作用域时合并。
214
+ */
215
+ export function canonicalWorkspacePath(value ) {
216
+ const trimmed = value.trim()
217
+ if (WINDOWS_ABSOLUTE.test(trimmed)) {
218
+ const resolved = win32.resolve(trimmed)
219
+ const driveFixed = DRIVE_PATH.test(resolved)
220
+ ? resolved.replace(/^([a-z]):/u, (_, drive ) => `${drive.toUpperCase()}:`)
221
+ : resolved
222
+ return stripTrailingSeparators(driveFixed, win32)
223
+ }
224
+ if (POSIX_ABSOLUTE.test(trimmed)) return stripTrailingSeparators(posix.resolve(trimmed), posix)
225
+ return trimmed.replace(/[\\/]+$/u, '') || trimmed
226
+ }
227
+
228
+ function stripTrailingSeparators(path , impl ) {
229
+ // 根(`D:\` / `/`)本身就是一个合法的 scope 路径,不能剥成 `D:`。
230
+ if (path === impl.parse(path).root) return path
231
+ const stripped = path.replace(/[\\/]+$/u, '')
232
+ return stripped === '' ? path : stripped
233
+ }
234
+
235
+ /**
236
+ * 判断两个项目键是否指向"同一个目录":规范形之后,Windows 盘符路径再折叠大小写
237
+ * (Windows 文件系统不区分大小写)。POSIX 路径保留大小写 —— 在 Linux 上
238
+ * `/Users/a` 与 `/users/a` 是两个不同的目录。
239
+ */
240
+ export function projectScopeIdentity(path ) {
241
+ const canonical = canonicalWorkspacePath(path)
242
+ return WINDOWS_ABSOLUTE.test(canonical) ? canonical.toLowerCase() : canonical
243
+ }
244
+
188
245
  // ------------------------------------------------------------------ 当前会话 / 当前项目
189
246
 
190
247
  /** 宿主 agent 上我们真正会碰到的那几个字段(其余一律不碰)。 */
@@ -235,7 +292,10 @@ export function resolveCurrentScopes(agent , opts
235
292
  // 而 DSH 服务进程的 process.cwd() 是**profile 目录**(~/.dsh/profiles/<name>),
236
293
  // 与工作区无关 —— 0.5.5 及以前把 `project:${process.cwd()}` 当成"配置"先传进来,
237
294
  // 结果所有项目的项目级记忆都挤进同一个桶,`project:` 这个作用域等于失效。
238
- const project = `project:${cwd ?? stripProjectPrefix(opts.projectScope) ?? process.cwd()}`
295
+ // 路径再过一遍 canonicalWorkspacePath:宿主若给出 `D:/x` / 带尾部分隔符的写法,
296
+ // 与 path 参数、显式 project:<路径> 落到同一个 scope(0.11.1)。
297
+ const projectPath = cwd ?? stripProjectPrefix(opts.projectScope) ?? process.cwd()
298
+ const project = `project:${canonicalWorkspacePath(projectPath)}`
239
299
  return sessionId !== undefined ? { session: `session:${sessionId}`, project } : { project }
240
300
  }
241
301
 
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { isAbsolute, resolve } from 'node:path'
15
- import { normalizeScopeInput, resolveScopeRef } from '../provider/scope.js'
15
+ import { canonicalWorkspacePath, normalizeScopeInput, resolveScopeRef } from '../provider/scope.js'
16
16
 
17
17
  /** Shape each tool shares: JSON-schema parameters + canonical output value. */
18
18
 
@@ -163,15 +163,15 @@ function resolveScope(
163
163
 
164
164
  /**
165
165
  * `path` → 绝对工作区路径。相对路径按会话 cwd 解析(拿不到就按进程 cwd),
166
- * 去掉末尾分隔符 —— 同一个目录必须只有一种写法,否则 project:<路径> 会分叉。
166
+ * 再走 `canonicalWorkspacePath` 统一写法 —— 同一个目录必须只有一种 scope 键,
167
+ * 否则 `project:<路径>` 会分叉(`D:/x` 与 `D:\x` 曾是两个 scope,见 0.11.1)。
167
168
  */
168
169
  function resolveWorkspacePath(raw , agent ) {
169
170
  const value = raw.trim()
170
171
  if (value === '') throw new MemoryToolError('PATH_INVALID', 'path 不能为空')
171
172
  const cwd = (agent )?.session?.header?.cwd
172
173
  const base = typeof cwd === 'string' && cwd.length > 0 ? cwd : process.cwd()
173
- const full = isAbsolute(value) ? value : resolve(base, value)
174
- return full.replace(/[\\/]+$/u, '') || full
174
+ return canonicalWorkspacePath(isAbsolute(value) ? value : resolve(base, value))
175
175
  }
176
176
 
177
177
  export function memorySaveTool(opts ) {
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "title": "Long-term Memory",
4
- "description": "Local long-term memory: automatic recall, hard rules, five memory tools, JSONL storage and local vector search."
3
+ "title": "Memory System",
4
+ "description": "Local memory system: automatic recall, hard rules, five memory tools, JSONL storage and local vector search."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
- "title": "长期记忆",
4
- "description": "本地长期记忆:自动召回、硬性规则、五个记忆工具,JSONL 落盘 + 本地向量检索。"
3
+ "title": "记忆系统",
4
+ "description": "本地记忆系统:自动召回、硬性规则、五个记忆工具,JSONL 落盘 + 本地向量检索。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@restregular/dsh-memory",
3
- "version": "0.10.1",
4
- "description": "DeepSeek Harness 本地长期记忆(单包单入口):JSONL 存储 + 本地向量检索(BGE-M3)+ 五个模型工具 + 自动召回注入 + 管理面板。",
3
+ "version": "0.11.1",
4
+ "description": "DeepSeek Harness 记忆系统(单包单入口):JSONL 存储 + 本地向量检索(BGE-M3)+ 五个模型工具 + 自动召回注入 + 管理面板。",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
7
7
  "exports": {
@@ -17,6 +17,7 @@
17
17
  "cordis.patch.yml",
18
18
  "icon.svg",
19
19
  "README.md",
20
+ "CHANGELOG.md",
20
21
  "LICENSE"
21
22
  ],
22
23
  "dsh": {