@zhengxiantai/dsh-mindmap 0.7.0 → 0.8.0

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/PUBLISHING.md CHANGED
@@ -41,10 +41,11 @@ DSH 的插件市场(`dshmarket`)本身**不接收投稿**。它每次打开
41
41
  | npm 包名唯一 | ✅ `@zhengxiantai/dsh-mindmap` |
42
42
  | `repository` 指回 GitHub | ✅ |
43
43
  | GitHub 仓库已有第一个 commit | ✅ `f4a39e4` 起 |
44
- | GitHub 仓库加 `dsh-plugin` topic | ⏳ 需要网页添加 |
45
- | GitHub 仓库创建满 1 天 | ⏳ 2026-11-24 22:09 之后 |
44
+ | GitHub 仓库加 `dsh-plugin` topic | ✅ 已通过 API 设置 |
45
+ | GitHub 仓库创建满 1 天 | ✅(2026-11-23 创建) |
46
46
  | npm 登录 | ✅ `npm whoami` = `zhengxiantai` |
47
- | npm 发布 | ⏳ 尚未执行 |
47
+ | npm 发布 | ✅ `0.7.0` 已发布;`0.8.0` 待发布 |
48
+ | 市场目录 PR | ✅ [#18800](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin/pull/18800)(仅 1 个文件) |
48
49
 
49
50
  `peerDependencies` 使用显式预发布分支,例如:
50
51
 
@@ -97,6 +98,8 @@ npm publish --access public
97
98
  npm view @zhengxiantai/dsh-mindmap version repository
98
99
  ```
99
100
 
101
+ npm 11 对新包返回 `202 Accepted`,会提示 “being processed and may take a few minutes”;通常 1–3 分钟后 `npm view` 才能查到,未立即出现不是失败。
102
+
100
103
  如果 npm 提示 OTP,输入验证器里的 6 位码即可。**recovery code 只有在
101
104
  验证器丢失时才使用,用一次就作废,不要提交到仓库。**
102
105
 
package/README.md CHANGED
@@ -8,6 +8,7 @@
8
8
  - **会话清理**:浮窗标题栏 `🗑` 归档当前会话,确认后从侧栏和地图移除;会话日志保留,可在归档中恢复;
9
9
  - **轮次回退**:浮窗 `☰` 列出节点内的每一轮;选一轮「从此轮重开」,会创建一个只保留该轮之前历史的新节点,该轮及之后被切掉,旧节点归档;
10
10
  - **浮窗状态保持**:浮窗打开后会一直保持打开,回合完成、页面刷新或地图重新挂载都不会把它关掉;只有 `×` 或 `Ctrl+Shift+M` / 顶部「浮窗」按钮会切换状态;
11
+ - **轮次导航层级色**:浮窗右侧官方的「轮次导航」按层级固定着色——当前节点蓝、父节点绿、祖父节点琥珀、更高层紫/粉/灰;只给导航条着色,消息正文不变,也不加图例;
11
12
  - **标题同步重命名**:节点 `✎`、详情「重命名」、浮窗 `✎` 都能弹出重命名窗口;写回 DSH 的 session title 后,左侧栏、地图卡片和浮窗标题同步。反过来,在左侧栏重命名也会立即反映到地图;卡片主标题始终使用会话标题,摘要 topic 不再覆盖它;
12
13
  - **不污染父话题**:子话题从父会话的精确前缀 fork,回到父话题时父会话不会带上子话题的上下文。
13
14
 
@@ -61,6 +62,29 @@ DSH 的 `main` 是 keyed slot,一次只渲染一个面板。本插件把地图
61
62
 
62
63
  这个功能是 **A:轮次级回退**,效果是“删掉这一轮及之后”,不是从中间抽掉一轮后保留后面的轮次。后者需要重写 append-only 日志,未实现。
63
64
 
65
+ ### 轮次导航层级色
66
+
67
+ 浮窗右侧、贴着滚动条的官方「轮次导航」(`nav[aria-label="轮次导航"]`,每轮一根可点击短横条)会按**相对当前节点的层级**固定着色:
68
+
69
+ | 层级 | 含义 | 颜色 |
70
+ |---|---|---|
71
+ | 0 | 当前节点自己的轮次 | 蓝 `#3b82f6` |
72
+ | 1 | 从父节点继承的轮次 | 绿 `#10b981` |
73
+ | 2 | 从祖父节点继承的轮次 | 琥珀 `#f59e0b` |
74
+ | 3 | 曾祖父节点 | 紫 `#8b5cf6` |
75
+ | 4 | 更高层 | 粉 `#ec4899` |
76
+ | 5+ | 更深祖先 | 灰 `#64748b` |
77
+
78
+ ![轮次导航层级色](docs/turn-rail-colors.png)
79
+
80
+ 判定方法:
81
+
82
+ - Host 的 `/mindmap/api/turns` 在原始事件里找 `session/end-seed` 且 `data.inherited === true` 的事件,这些是 fork 时复制前缀的边界;
83
+ - 结合 `turnOutline` projection 的每个 `turn/start.seq`,一个轮次的 `level = 边界中 >= 该轮 startSeq 的个数`;
84
+ - 当前节点自己的轮次没有边界压在上面,level 0;父节点前缀跨过 1 个边界,level 1;祖父跨 2 个,以此类推;
85
+ - Client 只监听 `.mm-float` 内的 `nav button[data-index]`,把 `--dsw-alias-border-l4` 和 `--dsw-alias-label-primary` 改成对应层级色,因此只影响导航条的 `::before`,不改消息、不改全屏对话;
86
+ - 颜色是常量数组,不会随机生成;没有图例/徽标(按当前需求保持简洁)。
87
+
64
88
  ### 浮窗状态保持
65
89
 
66
90
  浮窗的 `open / sessionId / mode / parentId / brief` 会写进 localStorage(`dsh-mindmap.floatState.v1`)。回合完成只更新会话数据,不会改 `float.open`;同时:
@@ -197,13 +221,13 @@ powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
197
221
 
198
222
  脚本会:
199
223
 
200
- 1. 把包复制到 `%DSH_HOME%\profiles\desktop\node_modules\@zhengxiantai\dsh-mindmap`;
224
+ 1. 把包复制到 `%DSH_HOME%\profiles\desktop\node_modules\dsh-mindmap`(本地挂载名;npm 包名仍是 scoped);
201
225
  2. 在 `profiles\desktop\cordis.patch.yml` 末尾追加一行:
202
226
 
203
227
  ```yaml
204
228
  - insert:
205
229
  - id: mindmap
206
- name: '@zhengxiantai/dsh-mindmap'
230
+ name: 'dsh-mindmap'
207
231
  ```
208
232
 
209
233
  启用 HMR 的 profile 会自动重组插件树,无需重启;否则重启 DSH。卸载:
@@ -216,7 +240,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1 -Uninstall
216
240
 
217
241
  ### 方式 B:作为 npm 包安装
218
242
 
219
- 发布到 npm 后:
243
+ 发布到 npm 后(scoped 包名):
220
244
 
221
245
  ```sh
222
246
  dsh plugin --profile desktop add @zhengxiantai/dsh-mindmap
@@ -230,12 +254,12 @@ dsh plugin --profile desktop add D:\Projects\DSH-TREE\dsh-mindmap
230
254
 
231
255
  ### 方式 C:手动挂载
232
256
 
233
- 把整个目录复制到 `<profile>/node_modules/@zhengxiantai/dsh-mindmap`,再编辑 `<profile>/cordis.patch.yml`(若原文件是 `[]`,要先把它替换成列表):
257
+ 本机检查用未 scoped 的目录名,避免 client-modules 在部分 DSH 版本上解析 scoped 本地包失败。把整个目录复制到 `<profile>/node_modules/dsh-mindmap`,并把复制后的 `package.json` 的 `name` 改成 `dsh-mindmap`,再编辑 `<profile>/cordis.patch.yml`(若原文件是 `[]`,要先把它替换成列表):
234
258
 
235
259
  ```yaml
236
260
  - insert:
237
261
  - id: mindmap
238
- name: '@zhengxiantai/dsh-mindmap'
262
+ name: 'dsh-mindmap'
239
263
  config:
240
264
  autoSummarize: true
241
265
  ```
@@ -283,7 +307,7 @@ dsh plugin --profile desktop add D:\Projects\DSH-TREE\dsh-mindmap
283
307
  ```yaml
284
308
  - insert:
285
309
  - id: mindmap
286
- name: '@zhengxiantai/dsh-mindmap'
310
+ name: 'dsh-mindmap'
287
311
  config:
288
312
  provider: deepseek-account
289
313
  model: deepseek-flash
Binary file
package/install.ps1 CHANGED
@@ -4,9 +4,9 @@
4
4
  # pwsh -File install.ps1 -Profile web # mount into another profile
5
5
  # pwsh -File install.ps1 -Uninstall # remove the package and its mount row
6
6
  #
7
- # The package is copied to <profile>/node_modules/@zhengxiantai/dsh-mindmap and a single
8
- # loader row is appended to <profile>/cordis.patch.yml. A profile with HMR
9
- # enabled re-composes the tree automatically; otherwise restart DSH.
7
+ # This local-checkout installer uses the unscoped mount name `dsh-mindmap`
8
+ # (the npm package itself is `@zhengxiantai/dsh-mindmap`). The copy gets a
9
+ # package.json name matching the mount so the client module loader resolves it.
10
10
  param(
11
11
  [string]$Profile = 'desktop',
12
12
  [switch]$Uninstall
@@ -15,14 +15,14 @@ param(
15
15
  $ErrorActionPreference = 'Stop'
16
16
 
17
17
  $source = $PSScriptRoot
18
- $packageName = '@zhengxiantai/dsh-mindmap'
18
+ $packageName = 'dsh-mindmap'
19
19
  $dshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $HOME '.dsh' }
20
20
  $profileDir = Join-Path $dshHome "profiles\$Profile"
21
21
  if (-not (Test-Path -LiteralPath $profileDir)) {
22
22
  throw "Profile not found: $profileDir"
23
23
  }
24
24
  $patchFile = Join-Path $profileDir 'cordis.patch.yml'
25
- $target = Join-Path $profileDir 'node_modules\@zhengxiantai\dsh-mindmap'
25
+ $target = Join-Path $profileDir 'node_modules\dsh-mindmap'
26
26
  $mountBlock = @"
27
27
  - insert:
28
28
  - id: mindmap
@@ -50,12 +50,27 @@ if ($Uninstall) {
50
50
 
51
51
  New-Item -ItemType Directory -Path (Split-Path $target) -Force | Out-Null
52
52
  New-Item -ItemType Directory -Path $target -Force | Out-Null
53
- foreach ($item in @('lib', 'package.json', 'cordis.patch.yml', 'README.md')) {
53
+ foreach ($item in @('lib', 'package.json', 'cordis.patch.yml', 'README.md', 'docs')) {
54
54
  $from = Join-Path $source $item
55
55
  if (Test-Path -LiteralPath $from) {
56
56
  Copy-Item -LiteralPath $from -Destination $target -Recurse -Force
57
57
  }
58
58
  }
59
+ # The npm package is scoped; the local mount and node_modules directory are not.
60
+ $installedPackage = Join-Path $target 'package.json'
61
+ if (Test-Path -LiteralPath $installedPackage) {
62
+ $manifest = Get-Content -LiteralPath $installedPackage -Raw | ConvertFrom-Json
63
+ $manifest.name = $packageName
64
+ $utf8 = New-Object System.Text.UTF8Encoding($false)
65
+ [System.IO.File]::WriteAllText($installedPackage, ($manifest | ConvertTo-Json -Depth 20), $utf8)
66
+ }
67
+ $installedPatch = Join-Path $target 'cordis.patch.yml'
68
+ if (Test-Path -LiteralPath $installedPatch) {
69
+ $patchText = Get-Content -LiteralPath $installedPatch -Raw
70
+ $patchText = $patchText -replace "@zhengxiantai/dsh-mindmap", "dsh-mindmap"
71
+ $utf8 = New-Object System.Text.UTF8Encoding($false)
72
+ [System.IO.File]::WriteAllText($installedPatch, $patchText, $utf8)
73
+ }
59
74
  Write-Host "Installed package to $target"
60
75
 
61
76
  $lines = if (Test-Path -LiteralPath $patchFile) { @(Get-Content -LiteralPath $patchFile) } else { @() }
package/lib/client.js CHANGED
@@ -26,6 +26,8 @@ window.__ModuleLoader__.load({
26
26
  const NS = 'mindmap'
27
27
  const PANEL_ID = 'mindmap'
28
28
  const API = '/mindmap/api'
29
+ /* Fixed hierarchy palette: current node, parent, grandparent, ... */
30
+ const TURN_LEVEL_COLORS = ['#3b82f6', '#10b981', '#f59e0b', '#8b5cf6', '#ec4899', '#64748b']
29
31
 
30
32
  const NODE_W = 252
31
33
  const NODE_H = 112
@@ -1947,6 +1949,80 @@ window.__ModuleLoader__.load({
1947
1949
  }
1948
1950
  }, [float.open, float.mode, float.sessionId])
1949
1951
 
1952
+ /* Color the native turn rail inside the float by ancestry level.
1953
+ * A turn's level is how many inherited fork seeds precede it. */
1954
+ React.useEffect(() => {
1955
+ if (!float.open || float.sessionId === undefined) return undefined
1956
+ const host = rootRef.current
1957
+ if (host === null) return undefined
1958
+ let disposed = false
1959
+ let observer
1960
+ let frame
1961
+ let levels
1962
+ const raf = typeof requestAnimationFrame === 'function'
1963
+ ? requestAnimationFrame
1964
+ : (callback) => setTimeout(callback, 16)
1965
+ const cancel = typeof cancelAnimationFrame === 'function'
1966
+ ? cancelAnimationFrame
1967
+ : clearTimeout
1968
+ const apply = () => {
1969
+ if (disposed || !Array.isArray(levels)) return
1970
+ const floatEl = host.querySelector('.mm-float')
1971
+ if (floatEl === null) return
1972
+ const marks = floatEl.querySelectorAll('nav button[data-index]')
1973
+ for (const mark of marks) {
1974
+ const index = Number(mark.dataset.index)
1975
+ const level = Number.isInteger(index) && index >= 0 ? (levels[index] ?? 0) : 0
1976
+ const color = TURN_LEVEL_COLORS[Math.min(level, TURN_LEVEL_COLORS.length - 1)]
1977
+ mark.dataset.mmLevel = String(level)
1978
+ mark.style.setProperty('--dsw-alias-border-l4', color)
1979
+ mark.style.setProperty('--dsw-alias-label-primary', color)
1980
+ }
1981
+ }
1982
+ const schedule = () => {
1983
+ if (disposed || frame !== undefined) return
1984
+ frame = raf(() => {
1985
+ frame = undefined
1986
+ apply()
1987
+ })
1988
+ }
1989
+ const observe = () => {
1990
+ if (disposed) return
1991
+ const floatEl = host.querySelector('.mm-float')
1992
+ if (floatEl === null) return
1993
+ if (observer !== undefined) observer.disconnect()
1994
+ if (typeof MutationObserver !== 'function') {
1995
+ schedule()
1996
+ return
1997
+ }
1998
+ observer = new MutationObserver(schedule)
1999
+ observer.observe(floatEl, {
2000
+ childList: true,
2001
+ subtree: true,
2002
+ attributes: true,
2003
+ attributeFilter: ['data-index'],
2004
+ })
2005
+ schedule()
2006
+ }
2007
+ void api('turns', { sessionId: float.sessionId, railOnly: true })
2008
+ .then((payload) => {
2009
+ if (disposed) return
2010
+ levels = Array.isArray(payload.railLevels)
2011
+ ? payload.railLevels.map((level) => (Number.isInteger(level) ? level : 0))
2012
+ : (Array.isArray(payload.turns) ? payload.turns : [])
2013
+ .map((turn) => (Number.isInteger(turn?.level) ? turn.level : 0))
2014
+ observe()
2015
+ })
2016
+ .catch(() => {
2017
+ // Older Host halves have no level data; leave the rail at its native color.
2018
+ })
2019
+ return () => {
2020
+ disposed = true
2021
+ if (frame !== undefined) cancel(frame)
2022
+ observer?.disconnect()
2023
+ }
2024
+ }, [float.open, float.sessionId])
2025
+
1950
2026
  /* Turn a draft into a normal topic without touching the float's open
1951
2027
  * state. Workspace selection is best-effort; a settling turn must not
1952
2028
  * be allowed to close a window the user opened. */
package/lib/index.js CHANGED
@@ -146,8 +146,32 @@ function collectTranscript(surface, maxChars) {
146
146
  /**
147
147
  * Turn starts for the rewind UI. `atSeq` is an inclusive fork cut, so a turn
148
148
  * starting at seq S is removed by forking at S - 1.
149
+ * Fork seeds copy the inherited prefix and append a `session/end-seed` event;
150
+ * each such boundary in this log marks one ancestor level.
149
151
  */
150
- function collectTurns(surface) {
152
+ function collectForkBoundaries(events) {
153
+ const boundaries = []
154
+ for (const event of events ?? []) {
155
+ const type = event.type ?? event.ty
156
+ if (type !== 'session/end-seed') continue
157
+ if (event.data?.inherited !== true) continue
158
+ if (!Number.isSafeInteger(event.seq)) continue
159
+ if (!boundaries.includes(event.seq)) boundaries.push(event.seq)
160
+ }
161
+ return boundaries.sort((a, b) => a - b)
162
+ }
163
+
164
+ function collectRailLevels(events, forkBoundaries = [], outlineTurns) {
165
+ const starts = Array.isArray(outlineTurns) && outlineTurns.length > 0
166
+ ? outlineTurns.map((turn) => turn.seq).filter(Number.isSafeInteger)
167
+ : (events ?? [])
168
+ .filter((event) => (event.type ?? event.ty) === 'turn/start')
169
+ .map((event) => event.seq)
170
+ .filter(Number.isSafeInteger)
171
+ return starts.map((seq) => forkBoundaries.filter((boundary) => boundary >= seq).length)
172
+ }
173
+
174
+ function collectTurns(surface, forkBoundaries = []) {
151
175
  const turns = []
152
176
  let current
153
177
  for (const event of surface.events ?? []) {
@@ -177,10 +201,16 @@ function collectTurns(surface) {
177
201
  if (text !== '' && current.assistant === '') current.assistant = cleanLine(text, 220)
178
202
  }
179
203
  }
180
- return turns.map((turn) => ({
181
- ...turn,
182
- rewindAt: turn.startSeq === undefined || turn.startSeq <= 0 ? undefined : turn.startSeq - 1,
183
- }))
204
+ return turns.map((turn) => {
205
+ const level = turn.startSeq === undefined
206
+ ? 0
207
+ : forkBoundaries.filter((seq) => seq >= turn.startSeq).length
208
+ return {
209
+ ...turn,
210
+ level,
211
+ rewindAt: turn.startSeq === undefined || turn.startSeq <= 0 ? undefined : turn.startSeq - 1,
212
+ }
213
+ })
184
214
  }
185
215
 
186
216
  /** Accept both a bare title string and the folded title snapshot record. */
@@ -590,7 +620,7 @@ export function apply(ctx, rawConfig) {
590
620
  sendJson(res, 200, {
591
621
  ok: true,
592
622
  plugin: 'dsh-mindmap',
593
- version: '0.7.0',
623
+ version: '0.8.0',
594
624
  cached: Object.keys(store.summaries).length,
595
625
  autoSummarize: config.autoSummarize,
596
626
  active: store.inflight.size,
@@ -621,10 +651,15 @@ export function apply(ctx, rawConfig) {
621
651
  const lease = await ctx.sessionQuery.observeSession(sessionId)
622
652
  try {
623
653
  const events = lease.events
654
+ const forkBoundaries = collectForkBoundaries(events)
655
+ const outlineTurns = lease.projections?.turnOutline?.turns
656
+ const railOnly = payload.railOnly === true
624
657
  sendJson(res, 200, {
625
658
  ok: true,
626
659
  capturedThroughSeq: events.at(-1)?.seq ?? null,
627
- turns: collectTurns({ events }),
660
+ forkBoundaries,
661
+ railLevels: collectRailLevels(events, forkBoundaries, outlineTurns),
662
+ ...(railOnly ? {} : { turns: collectTurns({ events }, forkBoundaries) }),
628
663
  })
629
664
  } finally {
630
665
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zhengxiantai/dsh-mindmap",
3
- "version": "0.7.0",
4
- "description": "A map-first DeepSeek Harness (DSH) plugin: the session tree is the main mind map, and a frosted floating chat forks a child subtopic when you send its first message.",
3
+ "version": "0.8.0",
4
+ "description": "A map-first DeepSeek Harness (DSH) plugin: the session tree is the main mind map, and a frosted floating chat forks a child subtopic when you send its first message. The native turn navigator is colored by ancestry level.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
package/screenshots.json CHANGED
@@ -1,4 +1,5 @@
1
- [
2
- "docs/preview-float.png",
3
- "docs/preview.png"
4
- ]
1
+ [
2
+ "docs/preview-float.png",
3
+ "docs/preview.png",
4
+ "docs/turn-rail-colors.png"
5
+ ]