dsh-plugin-memory 0.18.1 → 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 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.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
+
5
11
  ## [0.18.1] - 2026-11-10
6
12
 
7
13
  ### Fixed
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "versions": [
28
28
  {
29
- "version": "0.18.0",
30
- "publishTimestamp": 1794273767,
29
+ "version": "0.18.1",
30
+ "publishTimestamp": 1794275944,
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
package/lib/client.js CHANGED
@@ -2042,7 +2042,7 @@ window.__ModuleLoader__.load({
2042
2042
 
2043
2043
  /** 双击节点:优先在 DSH 右侧栏打开该 md 文件;不可用时回退系统文件管理器。 */
2044
2044
  const openInSidebar = async (id) => {
2045
- const sidebar = sidebarRightService
2045
+ const sidebar = resolveSidebarRight()
2046
2046
  if (!sidebar || typeof sidebar.openResource !== 'function') return { ok: false, reason: 'sidebar-unavailable' }
2047
2047
  let pathInfo
2048
2048
  try {
@@ -2487,8 +2487,25 @@ window.__ModuleLoader__.load({
2487
2487
  // 挂载后按 label 认出自己那一行,藏掉齿轮、用 mask 画自己的标记。
2488
2488
  // 官方哪天给 settings.section 长出 icon 字段,这段即可删除。
2489
2489
  const NAV_ROW_SELECTOR = '[role="dialog"] nav button'
2490
- // Right-sidebar navigation service (0.18.0, DSH ≥ 0.2.2); undefined on older hosts.
2491
- let sidebarRightService
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
+ }
2492
2509
  const NAV_ICON_ATTR = 'data-dsh-memory-nav-icon'
2493
2510
  // The label is resolved from DICTS by `sectionLabel(language)`: it is both the
2494
2511
  // displayed text and the claim key, so both must come from that one function.
@@ -2557,13 +2574,7 @@ window.__ModuleLoader__.load({
2557
2574
  function apply(ctx) {
2558
2575
  // Right-sidebar navigation (double-click a graph node opens the file in
2559
2576
  // 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.
2562
- try {
2563
- sidebarRightService = ctx.reflect?.get?.('sidebarRight', true) ?? undefined
2564
- } catch {
2565
- sidebarRightService = undefined
2566
- }
2577
+ clientCtx = ctx
2567
2578
  // Language packs ride DSH's own locale layer: the panel follows
2568
2579
  // 设置 → 通用设置 → 语言 instead of guessing from navigator.language.
2569
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.1",
4
+ "version": "0.18.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",