dsh-plugin-memory 0.18.0 → 0.18.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
4
4
 
5
+ ## [0.18.1] - 2026-11-10
6
+
7
+ ### Fixed
8
+
9
+ - **双击节点仍然回退 Finder**:客户端插件此前用 `ctx.get('sidebarRight')`/`ctx.sidebarRight` 读取侧栏服务,Cordis 下未在 `inject` 声明的服务访问会抛错、被 try/catch 吞掉 → 服务恒为 undefined。改用公开 API `ctx.reflect.get('sidebarRight', true)`(不要求 inject,旧宿主无该服务时同样安全返回 undefined)。
10
+ - **回退时给出具体原因**:侧栏打开失败会在面板提示具体阶段(`sidebar-unavailable` / `path-unresolved` / `no-session` / 打开异常信息),便于定位;Finder 回退行为不变。
11
+
5
12
  ## [0.18.0] - 2026-11-10
6
13
 
7
14
  ### Added
@@ -16,8 +16,8 @@
16
16
  "zh": "记忆"
17
17
  },
18
18
  "description": {
19
- "en": "Cross-session, mobile markdown memory with SOUL persona, session switch, quick soul setup, 3D memory graph (search / reveal), health dashboard and portable pack/unpack.",
20
- "zh": "跨会话 markdown 记忆:SOUL 人格、会话级开关、快速铸魂、3D 记忆图谱(搜索/打开文件)、健康看板与 pack/unpack 迁移。"
19
+ "en": "Cross-session markdown memory with SOUL persona, session switch, quick soul setup, 3D memory graph (search / reveal / double-click opens the file in the sidebar), boot snapshot, health dashboard and portable pack/unpack.",
20
+ "zh": "跨会话 markdown 记忆:SOUL 人格、会话级开关、快速铸魂、3D 记忆图谱(搜索/打开文件/双击在侧栏打开)、boot 快照、健康看板与 pack/unpack 迁移。"
21
21
  },
22
22
  "author": "LittleBlackTong",
23
23
  "homepage": "https://github.com/LittleBlackTong/dsh-plugin-memory#readme",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "versions": [
28
28
  {
29
- "version": "0.17.9",
30
- "publishTimestamp": 1793958188,
29
+ "version": "0.18.0",
30
+ "publishTimestamp": 1794273767,
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
package/lib/client.js CHANGED
@@ -177,6 +177,7 @@ window.__ModuleLoader__.load({
177
177
  graphCopied: '路径已复制',
178
178
  graphCopyFailed: '复制路径失败',
179
179
  graphRevealFallback: '打开失败,已复制路径;在 Finder 里按 ⌘⇧G 粘贴路径即可跳转',
180
+ graphSidebarFailed: '侧栏打开失败:',
180
181
  graphStats: '{pages} 页 · {links} 条页间互链 · {tagEdges} 条共享 tag',
181
182
  graphIndexRoutes: '{count} 条索引路由(虚线)',
182
183
  graphIsolated: '{count} 页暂时孤立',
@@ -334,6 +335,7 @@ window.__ModuleLoader__.load({
334
335
  graphCopied: 'Path copied',
335
336
  graphCopyFailed: 'Could not copy the path',
336
337
  graphRevealFallback: 'Reveal failed; the path was copied — paste it in your file manager to jump there',
338
+ graphSidebarFailed: 'Sidebar open failed: ',
337
339
  graphStats: '{pages} pages · {links} page links · {tagEdges} shared tags',
338
340
  graphIndexRoutes: '{count} index routes (dashed)',
339
341
  graphIsolated: '{count} pages isolated',
@@ -2019,7 +2021,7 @@ window.__ModuleLoader__.load({
2019
2021
  }
2020
2022
 
2021
2023
  /** 「在 Finder 中显示」按钮 + 双击节点;失败时自动复制路径兜底。 */
2022
- const revealNode = (id) => {
2024
+ const revealNode = (id, noticeAfterSuccess) => {
2023
2025
  fetch(GRAPH_REVEAL_URL, {
2024
2026
  method: 'POST',
2025
2027
  headers: { 'content-type': 'application/json' },
@@ -2030,7 +2032,7 @@ window.__ModuleLoader__.load({
2030
2032
  if (!response.ok) throw new Error(body.error ?? `POST ${response.status}`)
2031
2033
  return body
2032
2034
  })
2033
- .then(() => setNotice(undefined))
2035
+ .then(() => setNotice(noticeAfterSuccess))
2034
2036
  .catch(async (error) => {
2035
2037
  const message = error instanceof Error ? error.message : String(error)
2036
2038
  const copied = await copyPathToClipboard(id)
@@ -2041,16 +2043,22 @@ window.__ModuleLoader__.load({
2041
2043
  /** 双击节点:优先在 DSH 右侧栏打开该 md 文件;不可用时回退系统文件管理器。 */
2042
2044
  const openInSidebar = async (id) => {
2043
2045
  const sidebar = sidebarRightService
2044
- if (!sidebar || typeof sidebar.openResource !== 'function') return false
2045
- const pathInfo = await fetch(`${GRAPH_PATH_URL}?id=${encodeURIComponent(id)}`)
2046
- .then((response) => response.json())
2047
- .catch(() => null)
2048
- if (!pathInfo || pathInfo.ok !== true || typeof pathInfo.path !== 'string') return false
2046
+ if (!sidebar || typeof sidebar.openResource !== 'function') return { ok: false, reason: 'sidebar-unavailable' }
2047
+ let pathInfo
2048
+ try {
2049
+ pathInfo = await fetch(`${GRAPH_PATH_URL}?id=${encodeURIComponent(id)}`).then((response) => response.json())
2050
+ } catch {
2051
+ return { ok: false, reason: 'path-fetch-failed' }
2052
+ }
2053
+ if (!pathInfo || pathInfo.ok !== true || typeof pathInfo.path !== 'string') return { ok: false, reason: 'path-unresolved' }
2049
2054
  const absolute = pathInfo.path.replace(/\\/g, '/')
2050
- const session = await fetch(SESSION_URL)
2051
- .then((response) => response.json())
2052
- .catch(() => null)
2053
- if (!session || session.ok !== true || typeof session.sessionId !== 'string') return false
2055
+ let session
2056
+ try {
2057
+ session = await fetch(SESSION_URL).then((response) => response.json())
2058
+ } catch {
2059
+ return { ok: false, reason: 'session-fetch-failed' }
2060
+ }
2061
+ if (!session || session.ok !== true || typeof session.sessionId !== 'string') return { ok: false, reason: 'no-session' }
2054
2062
  const root = typeof session.cwd === 'string' && session.cwd.length > 0
2055
2063
  ? session.cwd.replace(/\\/g, '/').replace(/\/+$/, '')
2056
2064
  : undefined
@@ -2064,13 +2072,25 @@ window.__ModuleLoader__.load({
2064
2072
  } else {
2065
2073
  address = `dsh-resource://file/absolute/${encodePath(absolute.replace(/^\/+/, ''))}`
2066
2074
  }
2067
- await sidebar.openResource(address)
2068
- return true
2075
+ try {
2076
+ await sidebar.openResource(address)
2077
+ } catch (error) {
2078
+ return { ok: false, reason: error instanceof Error ? error.message : String(error) }
2079
+ }
2080
+ return { ok: true }
2069
2081
  }
2070
2082
  const openNode = (id) => {
2071
2083
  openInSidebar(id)
2072
- .then((opened) => { if (!opened) revealNode(id) })
2073
- .catch(() => revealNode(id))
2084
+ .then((result) => {
2085
+ if (result.ok === true) return
2086
+ setNotice(`${t('graphSidebarFailed')}${result.reason}`)
2087
+ revealNode(id, `${t('graphSidebarFailed')}${result.reason}`)
2088
+ })
2089
+ .catch((error) => {
2090
+ const reason = error instanceof Error ? error.message : String(error)
2091
+ setNotice(`${t('graphSidebarFailed')}${reason}`)
2092
+ revealNode(id, `${t('graphSidebarFailed')}${reason}`)
2093
+ })
2074
2094
  }
2075
2095
 
2076
2096
  React.useEffect(() => { stateRef.current.selected = selected }, [selected])
@@ -2537,8 +2557,10 @@ window.__ModuleLoader__.load({
2537
2557
  function apply(ctx) {
2538
2558
  // Right-sidebar navigation (double-click a graph node opens the file in
2539
2559
  // the sidebar). Optional service: older hosts just fall back to reveal.
2560
+ // `ctx.reflect.get` reads a service without declaring it in `inject`, so
2561
+ // older hosts without the right sidebar simply fall back to reveal.
2540
2562
  try {
2541
- sidebarRightService = ctx.get?.('sidebarRight') ?? ctx.sidebarRight ?? undefined
2563
+ sidebarRightService = ctx.reflect?.get?.('sidebarRight', true) ?? undefined
2542
2564
  } catch {
2543
2565
  sidebarRightService = undefined
2544
2566
  }
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.0",
4
+ "version": "0.18.1",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",