dsh-plugin-memory 0.18.0 → 0.18.2
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 +13 -0
- package/docs/market/index.json +4 -4
- package/lib/client.js +56 -23
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
所有记录跟随 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 风格;版本号与 `package.json` 保持一致。
|
|
4
4
|
|
|
5
|
+
## [0.18.2] - 2026-11-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **0.18.1 仍报 `sidebar-unavailable`**:客户端插件 apply 时 `ctx.reflect.get('sidebarRight')` 返回 undefined——插件加载顺序里右侧栏服务尚未 provide,缓存后永不更新。改为**双击时懒解析**:每次调用按候选服务名(`sidebarRight` / `rightSidebar` / `sidebar`)用 `ctx.reflect.get(name, false)`(不要求提供者已激活)取第一个带 `openResource` 的服务;仍取不到才回退 Finder。
|
|
10
|
+
|
|
11
|
+
## [0.18.1] - 2026-11-10
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **双击节点仍然回退 Finder**:客户端插件此前用 `ctx.get('sidebarRight')`/`ctx.sidebarRight` 读取侧栏服务,Cordis 下未在 `inject` 声明的服务访问会抛错、被 try/catch 吞掉 → 服务恒为 undefined。改用公开 API `ctx.reflect.get('sidebarRight', true)`(不要求 inject,旧宿主无该服务时同样安全返回 undefined)。
|
|
16
|
+
- **回退时给出具体原因**:侧栏打开失败会在面板提示具体阶段(`sidebar-unavailable` / `path-unresolved` / `no-session` / 打开异常信息),便于定位;Finder 回退行为不变。
|
|
17
|
+
|
|
5
18
|
## [0.18.0] - 2026-11-10
|
|
6
19
|
|
|
7
20
|
### Added
|
package/docs/market/index.json
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"zh": "记忆"
|
|
17
17
|
},
|
|
18
18
|
"description": {
|
|
19
|
-
"en": "Cross-session
|
|
20
|
-
"zh": "跨会话 markdown 记忆:SOUL 人格、会话级开关、快速铸魂、3D
|
|
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.
|
|
30
|
-
"publishTimestamp":
|
|
29
|
+
"version": "0.18.1",
|
|
30
|
+
"publishTimestamp": 1794275944,
|
|
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(
|
|
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)
|
|
@@ -2040,17 +2042,23 @@ window.__ModuleLoader__.load({
|
|
|
2040
2042
|
|
|
2041
2043
|
/** 双击节点:优先在 DSH 右侧栏打开该 md 文件;不可用时回退系统文件管理器。 */
|
|
2042
2044
|
const openInSidebar = async (id) => {
|
|
2043
|
-
const sidebar =
|
|
2044
|
-
if (!sidebar || typeof sidebar.openResource !== 'function') return false
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
.
|
|
2048
|
-
|
|
2045
|
+
const sidebar = resolveSidebarRight()
|
|
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
|
-
|
|
2051
|
-
|
|
2052
|
-
.
|
|
2053
|
-
|
|
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
|
-
|
|
2068
|
-
|
|
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((
|
|
2073
|
-
|
|
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])
|
|
@@ -2467,8 +2487,25 @@ window.__ModuleLoader__.load({
|
|
|
2467
2487
|
// 挂载后按 label 认出自己那一行,藏掉齿轮、用 mask 画自己的标记。
|
|
2468
2488
|
// 官方哪天给 settings.section 长出 icon 字段,这段即可删除。
|
|
2469
2489
|
const NAV_ROW_SELECTOR = '[role="dialog"] nav button'
|
|
2470
|
-
//
|
|
2471
|
-
|
|
2490
|
+
// Client root ctx, kept so the right-sidebar service can be resolved lazily:
|
|
2491
|
+
// at plugin-apply time the sidebar bundle may not have provided it yet.
|
|
2492
|
+
let clientCtx
|
|
2493
|
+
/**
|
|
2494
|
+
* Resolve the right-sidebar navigation service (DSH ≥ 0.2.2) on demand.
|
|
2495
|
+
* `ctx.reflect.get` bypasses the inject requirement, and `strict = false`
|
|
2496
|
+
* accepts a provider that is still activating; older hosts yield undefined.
|
|
2497
|
+
*/
|
|
2498
|
+
const resolveSidebarRight = () => {
|
|
2499
|
+
for (const name of ['sidebarRight', 'rightSidebar', 'sidebar']) {
|
|
2500
|
+
try {
|
|
2501
|
+
const service = clientCtx?.reflect?.get?.(name, false)
|
|
2502
|
+
if (service && typeof service.openResource === 'function') return service
|
|
2503
|
+
} catch {
|
|
2504
|
+
// try the next candidate name
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
return undefined
|
|
2508
|
+
}
|
|
2472
2509
|
const NAV_ICON_ATTR = 'data-dsh-memory-nav-icon'
|
|
2473
2510
|
// The label is resolved from DICTS by `sectionLabel(language)`: it is both the
|
|
2474
2511
|
// displayed text and the claim key, so both must come from that one function.
|
|
@@ -2537,11 +2574,7 @@ window.__ModuleLoader__.load({
|
|
|
2537
2574
|
function apply(ctx) {
|
|
2538
2575
|
// Right-sidebar navigation (double-click a graph node opens the file in
|
|
2539
2576
|
// the sidebar). Optional service: older hosts just fall back to reveal.
|
|
2540
|
-
|
|
2541
|
-
sidebarRightService = ctx.get?.('sidebarRight') ?? ctx.sidebarRight ?? undefined
|
|
2542
|
-
} catch {
|
|
2543
|
-
sidebarRightService = undefined
|
|
2544
|
-
}
|
|
2577
|
+
clientCtx = ctx
|
|
2545
2578
|
// Language packs ride DSH's own locale layer: the panel follows
|
|
2546
2579
|
// 设置 → 通用设置 → 语言 instead of guessing from navigator.language.
|
|
2547
2580
|
ctx.effect(() => ctx.locale.register(LOCALE_NS, DICTS), 'memory: dictionaries')
|
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.
|
|
4
|
+
"version": "0.18.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|