dsh-plugin-memory 0.18.3 → 0.18.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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
4
4
 
5
+ ## [0.18.4] - 2026-11-10
6
+
7
+ ### Fixed
8
+
9
+ - **双击打开报 `no registered tab type claims "dsh-resource://file/absolute/..."`**:host 在无 session id 时兜底选中的会话可能属于另一个项目(cwd 不含记忆库),客户端因此退回 `absolute` 地址;而侧栏只认 `session/<id>/<相对路径>` 地址。现在 host 兜底优先选「cwd 包含记忆库目录」的会话;文件确实在工作区外时客户端直接给出「不在当前工作区、已用系统文件管理器打开」的说明,不再尝试注定失败的 absolute 地址。
10
+
5
11
  ## [0.18.3] - 2026-11-10
6
12
 
7
13
  ### Fixed
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "versions": [
28
28
  {
29
- "version": "0.18.2",
30
- "publishTimestamp": 1794276764,
29
+ "version": "0.18.3",
30
+ "publishTimestamp": 1794277109,
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
package/lib/client.js CHANGED
@@ -178,6 +178,7 @@ window.__ModuleLoader__.load({
178
178
  graphCopyFailed: '复制路径失败',
179
179
  graphRevealFallback: '打开失败,已复制路径;在 Finder 里按 ⌘⇧G 粘贴路径即可跳转',
180
180
  graphSidebarFailed: '侧栏打开失败:',
181
+ graphSidebarOutside: '该文件不在当前会话的工作区内,侧栏无法预览;已用系统文件管理器打开',
181
182
  graphStats: '{pages} 页 · {links} 条页间互链 · {tagEdges} 条共享 tag',
182
183
  graphIndexRoutes: '{count} 条索引路由(虚线)',
183
184
  graphIsolated: '{count} 页暂时孤立',
@@ -336,6 +337,7 @@ window.__ModuleLoader__.load({
336
337
  graphCopyFailed: 'Could not copy the path',
337
338
  graphRevealFallback: 'Reveal failed; the path was copied — paste it in your file manager to jump there',
338
339
  graphSidebarFailed: 'Sidebar open failed: ',
340
+ graphSidebarOutside: 'This file is outside the current session workspace, so the sidebar cannot preview it; opened it in the OS file manager instead',
339
341
  graphStats: '{pages} pages · {links} page links · {tagEdges} shared tags',
340
342
  graphIndexRoutes: '{count} index routes (dashed)',
341
343
  graphIsolated: '{count} pages isolated',
@@ -2065,13 +2067,13 @@ window.__ModuleLoader__.load({
2065
2067
  const encodePath = (path) => path.split('/')
2066
2068
  .map((segment, index) => (index === 0 && /^[A-Za-z]:$/.test(segment) ? segment : encodeURIComponent(segment)))
2067
2069
  .join('/')
2068
- let address
2069
- if (root !== undefined && (absolute === root || absolute.startsWith(`${root}/`))) {
2070
- const relative = absolute.slice(root.length).replace(/^\/+/, '')
2071
- address = `dsh-resource://file/session/${encodeURIComponent(session.sessionId)}/${encodePath(relative)}`
2072
- } else {
2073
- address = `dsh-resource://file/absolute/${encodePath(absolute.replace(/^\/+/, ''))}`
2070
+ // The sidebar only opens `session/<id>/<relative>` addresses; an
2071
+ // absolute address has no authorized session and cannot be claimed.
2072
+ if (root === undefined || (absolute !== root && !absolute.startsWith(`${root}/`))) {
2073
+ return { ok: false, reason: 'outside-workspace' }
2074
2074
  }
2075
+ const relative = absolute.slice(root.length).replace(/^\/+/, '')
2076
+ const address = `dsh-resource://file/session/${encodeURIComponent(session.sessionId)}/${encodePath(relative)}`
2075
2077
  try {
2076
2078
  await sidebar.openResource(address)
2077
2079
  } catch (error) {
@@ -2080,11 +2082,14 @@ window.__ModuleLoader__.load({
2080
2082
  return { ok: true }
2081
2083
  }
2082
2084
  const openNode = (id) => {
2085
+ const message = (result) => result.reason === 'outside-workspace'
2086
+ ? t('graphSidebarOutside')
2087
+ : `${t('graphSidebarFailed')}${result.reason}`
2083
2088
  openInSidebar(id)
2084
2089
  .then((result) => {
2085
2090
  if (result.ok === true) return
2086
- setNotice(`${t('graphSidebarFailed')}${result.reason}`)
2087
- revealNode(id, `${t('graphSidebarFailed')}${result.reason}`)
2091
+ setNotice(message(result))
2092
+ revealNode(id, message(result))
2088
2093
  })
2089
2094
  .catch((error) => {
2090
2095
  const reason = error instanceof Error ? error.message : String(error)
package/lib/index.js CHANGED
@@ -785,11 +785,22 @@ export function apply(ctx, config = {}) {
785
785
  || agent.session?.header?.id === id
786
786
  || agent.session?.id === id)
787
787
  }
788
- // 0.18.3: the Settings panel has no session id, and the tracker only
789
- // knows sessions that have spoken. Fall back to a mounted session
790
- // (preferring one with a workspace) so graph/sidebar actions can
791
- // still resolve a workspace while the user is in Settings.
792
- return roots.find((agent) => typeof agent.session?.header?.cwd === 'string' && agent.session.header.cwd.length > 0)
788
+ // 0.18.3/0.18.4: the Settings panel has no session id, and the
789
+ // tracker only knows sessions that have spoken. Fall back to a
790
+ // mounted session, preferring one whose workspace contains the
791
+ // memory store: the sidebar only opens `session/<id>/<relative>`
792
+ // addresses, so a session from another project cannot preview it.
793
+ const normalize = (value) => typeof value === 'string'
794
+ ? value.replace(/\\/g, '/').replace(/\/+$/, '')
795
+ : ''
796
+ const memoryRoot = normalize(currentMemoryDir)
797
+ const cwdOf = (agent) => normalize(agent.session?.header?.cwd)
798
+ const insideStore = (agent) => {
799
+ const dir = cwdOf(agent)
800
+ return dir.length > 0 && (memoryRoot === dir || memoryRoot.startsWith(`${dir}/`))
801
+ }
802
+ return roots.find(insideStore)
803
+ ?? roots.find((agent) => cwdOf(agent).length > 0)
793
804
  ?? roots[0]
794
805
  }
795
806
  const sendJson = (status, payload) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-plugin-memory",
3
3
  "description": "Long-term memory plugin for DeepSeek Harness: persistent cross-session markdown memory with a soul/persona file, auto-injected at every session start, plus remember/recall/consolidate/forget workflows and portable migration tooling.",
4
- "version": "0.18.3",
4
+ "version": "0.18.4",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",