dsh-plugin-mind-tree 0.0.0-stage → 0.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ShOpenMind
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,313 @@
1
- # Temporary Holding Version
1
+ # dsh-plugin-mind-tree · 思维树
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 遍历 DeepSeek Harness 的对话上下文,列出对话中的分支节点,并把它们渲染成思维树。
4
+
5
+ > 作者:**ShOpenMind** · 仓库:<https://github.com/ShOpenMind/dsh-plugin-mind-tree> · MIT License
6
+
7
+ ## 功能
8
+
9
+ - **思维树**:遍历当前会话的完整事件日志,把「轮次 → 消息 → 工具调用 → 结果」组织成**紧凑纵向大纲树**
10
+ (适配窄侧栏、纵向滚动、不横向裁切);默认只展开最新一轮,可「展开全部/折叠全部」,点三角逐级展开;
11
+ **点轮次前的三角展开时自动定位到对话中对应位置**,每个有对话位置的行右侧还有 ↗ 跳转图标;
12
+ - **轮次统计**:每轮显示**消息条数与 token 消耗**(输入/输出/缓存读/缓存写/思考/合计/耗时在详情面板中细分);
13
+ - **搜索过滤**:工具栏搜索框按文本过滤节点(保留祖先结构、命中行高亮),清空即恢复;
14
+ - **配色可自定义**:工具栏「配色 ▾」提供三套预设(**柔和**(默认)/ 鲜明 / 灰蓝)+ **「自定义颜色」分区**:
15
+ 24 类元素可逐项调色(19 类节点气泡 + 主干/子会话/被替换/派生 4 类连接线 + 分支徽章),
16
+ 选择保存在本机(`localStorage`),随时可「恢复默认」;
17
+ 默认色调经**对比度优化**(白字对比不足 4.5:1 时自动改用深色字),比原版更耐看而不刺眼;
18
+ - **气泡字号适中偏大**(主文字 13px / 摘要 12px,行高 34px),贴合 DSH 设计语言,窄侧栏里也清晰可读;
19
+ - **过程信息四档削减**(默认「精简」,工具栏可切换;导出跟随当前档位):
20
+
21
+ | 档位 | 保留内容 | 真实会话实测(2491 节点 / 15 轮) |
22
+ |---|---|---|
23
+ | **输入** | 轮次 + 你的真实发言 + 分支点(= 把整场对话压成需求清单) | 41 节点 |
24
+ | **精简**(默认) | 轮次 + 你的真实发言 + 全部分支点 + 每轮「工具活动 ×N」聚合行 + 每轮答复 | **119 节点**,大纲 8 KB |
25
+ | **标准** | 精简 + 实质性过程文本(≥60 字)与每条工具调用(不含工具输出) | 1259 节点,136 KB |
26
+ | **完整** | 全部节点,与事件日志一一对应 | 2491 节点,286 KB |
27
+
28
+ 工具聚合行自带被折叠调用的清单(点它即展开)、可搜索、可定位到对应轮次;
29
+ 削减只作用于展示与导出,**宿主始终返回完整数据**,随时可切回「完整」。
30
+ - **成本估算**:按**该轮实际模型**(`message.source.model`)与**高峰/空闲时段**把 token 折算成人民币:
31
+ 每轮行尾显示 `¥`、详情面板给出模型与成本、搜索框下方显示整场合计;未知模型按兜底价并标 `≈`。
32
+ 单价来源 DeepSeek 官方「模型 & 价格」页(`lib/pricing.js` 里带版本号,改价只改一处);
33
+ 缓存命中/未命中、输出分别计价,缓存写入按未命中输入计费。
34
+ - **缩放 / 平移 / 图片导出**:`Ctrl/⌘ + 滚轮` 以光标为中心缩放、拖动平移、双击或「适配」回到整体;
35
+ 「导出 ▾」新增 **SVG 矢量图** 与 **PNG 图片**(2 倍像素,超大画布自动降倍率),可直接贴进文档/聊天。
36
+ - **实时跟随**:会话产生新事件时**静默刷新**(不闪 loading、900ms 节流),工具栏显示「● 运行中」,
37
+ 最新一轮自动加虚线环与脉动圆点;流中断自动重连。
38
+ - **导出 Markdown / Canvas**:把思维树导出为可归档文档(含分支标记、token 统计;大纲与 JSON 跟随当前档位);
39
+ - **分支节点识别**:
40
+ - 替换分支(消息被编辑/重试后旧内容脱离上下文,橙色虚线连接)
41
+ - 生成重试(`llm/retry`)
42
+ - 用户选择(`ask_user_question` 的选项)
43
+ - 批准决策(`approval/asked` / `approval/decided`)
44
+ - 派生子代理 / 工作流 / 团队(`subagent`、`subagent_fork`、`workflow`、`spawn_teammate`)
45
+ - 目标变化(`goal/change`)、任务分解(`todo_write`)、计划模式(`plan/mode`)
46
+ - 上下文压缩(`compaction/*`)、会话分叉(`turn/end` 的 `forked`)
47
+ - **会话血缘 / 会话森林**:跨会话展示派生(子代理)与分叉关系,点击子会话可直接打开或查看它的思维树;
48
+ - **节点详情**:查看事件 JSON、在对话中定位(滚动到对应轮次)、打开子会话;
49
+ - **实时刷新**:会话产生新事件时自动更新;
50
+ - **会话行菜单**:左侧会话列表任意一行的「…」菜单里选择「查看思维树」,直接切换到该会话并打开右侧栏;
51
+ - **首次加载自动展开**右侧栏并定位到思维树页签;
52
+ - **导出(三种格式,均支持「另存为」直接存进 Obsidian 库)**:
53
+ 1. **思维导图 Markdown**(默认):文件内嵌 Mermaid `mindmap` 代码块,**用 Obsidian 打开即显示思维导图**(零插件);
54
+ 只保留轮次、分支点、用户真实发言与子会话(自动去噪:注入提示、后台任务通知、重复的 todo/goal 只留最后一次);
55
+ 2. **大纲 Markdown**:全量节点(YAML 属性 + 轮次标题 + 嵌套列表),适合 Markmap / Markmind 等能把大纲渲染成交互导图的插件;
56
+ 3. **Obsidian 画布 `.canvas`**:Obsidian 原生画布格式,导入后是**可拖拽、可编辑的真思维导图**(零插件)。
57
+
58
+ ## 终端 / 无 GUI 用法(`mind_tree` 工具)
59
+
60
+ 插件在宿主半区注册 **`mind_tree` 工具**,因此在**没有网页客户端的终端会话里也能用**(由 agent 调用):
61
+
62
+ | 参数 | 说明 |
63
+ |---|---|
64
+ | `sessionId` | 目标会话;省略则使用当前会话 |
65
+ | `format` | `mindmap`(Mermaid 导图 Markdown,默认)/ `outline`(全量大纲)/ `canvas`(Obsidian 画布 JSON)/ `json` |
66
+ | `view` | `tree`(默认)/ `lineage` / `forest`;后两者仅支持 `outline`、`json` |
67
+ | `level` | 过程信息档位:`compact`(默认)/ `standard` / `full`;作用于 `outline` 与 `json` |
68
+ | `writeTo` | 绝对路径;提供后**写文件并只返回摘要**(推荐,避免大内容进入上下文) |
69
+
70
+ 行为要点:
71
+
72
+ - 不写文件时返回内容,**超过 4 万字符自动截断**并提示改用 `writeTo`;
73
+ - 输出与 GUI 的「导出」菜单**共用同一套生成器**(`lib/format.js`),格式完全一致;
74
+ - 本插件**不提供 CLI 子命令**:DSH 的 `dsh` 启动器没有插件级子命令扩展点,终端入口即此工具
75
+ (例如:`dsh -p "把当前会话的思维导图导出到 D:/vault/x.md"`)。
76
+
77
+ ## 兼容性
78
+
79
+ - `peerDependencies`:`@deepseek-ai/dsh: ">=0.2.0-rc.2 <0.3.0"`(声明为 optional peer,不会阻塞安装);
80
+ 运行时不匹配时安装/激活会被 DSH 拦截(可用版本豁免强制放行,风险自负)。
81
+ - **能力探测**:启动时探测 `sessionQuery` 依赖的方法、`tools`、`fs`;缺失或工具注册失败时
82
+ **不再静默** —— 写入宿主日志,并在 GUI 顶部显示兼容性横幅,同时出现在客户端探针的
83
+ `hostWarnings` 字段里。
84
+ - 插件使用 DSH 的**官方但内部**接口(会话查询服务、Typert 远程协议、右侧栏 keyed slot、
85
+ ToolRuntime 注册);跨版本升级请先跑仓库内的 `tools/integration-test.mjs`(真实 cordis +
86
+ 真实 ToolRuntime)与 `tools/host-test.mjs`。
87
+ - **宿主半区代码变更需要完整重启应用**才会生效(重新安装插件只更新磁盘文件;F5 只刷新网页客户端)。
88
+
89
+ ## 安装
90
+
91
+ > ⚠️ **填 release 的 `.tgz` 地址,不要填仓库地址。**
92
+ > 仓库地址会被解析成 default 分支的 `main.tar.gz` 快照——内容随每次提交变化,而锁文件记的是旧内容的哈希,pnpm 会以 `ERR_PNPM_TARBALL_INTEGRITY` 中止安装,而且报错里根本看不出根因。
93
+ > 正确写法:`https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases/latest/download/dsh-plugin-mind-tree.tgz`
94
+ > 已经被卡住的话:`cd ~/.dsh/profiles/<profile> && npx pnpm install --update-checksums`。
95
+
96
+ ### 方式零(最省事):从 npm 装
97
+
98
+ ```sh
99
+ dsh plugin install dsh-plugin-mind-tree
100
+ ```
101
+
102
+ 或在 Harness 的「插件」面板里搜索 `dsh-plugin-mind-tree`。
103
+ npm 上的版本号不可变,不存在「同一地址内容变了、哈希对不上」的问题。
104
+
105
+ ### 方式一(推荐):粘贴一行地址,30 秒装好,**不需要 git**
106
+
107
+ 在 DeepSeek Harness 的**插件页 → 添加插件**里粘贴下面的地址(**固定链接,始终指向最新版**):
108
+
109
+ ```
110
+ https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases/latest/download/dsh-plugin-mind-tree.tgz
111
+ ```
112
+
113
+ 1. 插件页 → 点「**添加插件**」→ 粘贴上面的地址;
114
+ 2. 点「**安装**」(约半分钟);
115
+ 3. 在插件列表里把「**思维树 / dsh-plugin-mind-tree**」**启用**;
116
+ 4. **完整重启 DSH**:
117
+ - **桌面版 App**:按 `Command + Q`(或 Ctrl+Q)完全退出,再重新打开;
118
+ - **`npx @deepseek-ai/dsh web`**:终端按 `Control + C`,再执行一次 `npx @deepseek-ai/dsh web`;
119
+ - ⚠️ 只刷新网页不够 —— 插件宿主半区只有重启才加载。
120
+
121
+ > **为什么必须是这个 `.tgz` 地址**(两种常见填法都会失败):
122
+ > - 以 `.git` 结尾的 GitHub 地址 → 被当作 git 仓库拉取,而**全新 macOS 没有 git**,
123
+ > 报 `xcode-select: note: No developer tools were found`;
124
+ > - `…/archive/refs/heads/main.tar.gz` 这类 **archive 压缩包** → 文件名是 `main.tar.gz`,
125
+ > 与包名无关,插件管理器无法判断"装了哪个包",
126
+ > 报 **「无法从依赖变更中确定安装了哪一个包」**;
127
+ > - `.tgz` 是**标准 npm 包**(文件名即包名,内含 `package.json`),能被插件管理器正确识别,
128
+ > 也**完全不需要 git**;配合 `releases/latest/…` 永久指向最新版。
129
+ >
130
+ > **升级**:重新粘贴同一地址安装一次(拿到最新 release)再重启即可。
131
+
132
+ **网络不通时**:在 [Releases](https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases) 页下载 `.tgz` 到本地,填**本地文件路径**安装。
133
+
134
+ ### 方式二:离线安装(zip / 本地目录,不依赖任何网络)
135
+
136
+ 1. 下载 [zip 源码包](https://github.com/ShOpenMind/dsh-plugin-mind-tree/archive/refs/heads/main.zip)
137
+ (或 [Release 页](https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases)的 `…-mac.zip`)并解压,
138
+ 得到 `dsh-plugin-mind-tree` 文件夹,放到一个固定位置(装好后**不要移动/删除**);
139
+ 2. 插件页 → 添加插件 → 填**该文件夹的绝对路径**(macOS 例:`/Users/你的用户名/Documents/dsh-plugin-mind-tree`;在「访达」里把文件夹拖进输入框即可自动填全);
140
+ 3. 安装 → 启用 → 完整重启 DSH(同方式一第 4 步)。
141
+
142
+ ### 方式三:命令行
143
+
144
+ `dsh plugin` 子命令把参数转发给档案目录下的 pnpm,因此用 `add`:
145
+
146
+ ```sh
147
+ # Release 里的标准 npm 包(推荐,不需要 git)
148
+ dsh plugin --profile <档案名> add https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases/latest/download/dsh-plugin-mind-tree.tgz
149
+ # 或本地目录
150
+ dsh plugin --profile <档案名> add /absolute/path/to/dsh-plugin-mind-tree
151
+ ```
152
+
153
+ 装好后仍需在插件页**启用**(`plugin add` 只装包,启用由插件页或档案的 `dsh.profile.bundles` 负责)。
154
+
155
+ ### 方式四(跨平台运行 DSH):任意系统(Windows / macOS / Linux)只需 Node 22+
156
+
157
+ ```sh
158
+ npx @deepseek-ai/dsh web # 浏览器打开 http://127.0.0.1:3080
159
+ ```
160
+
161
+ ### 安装常见问题
162
+
163
+ | 现象 | 原因与处理 |
164
+ |---|---|
165
+ | 填仓库地址报 `xcode-select` / `No developer tools` | 地址是 `.git` 结尾,系统没有 git。改用方式一的 `.tgz` 地址(不需要 git)。 |
166
+ | **「无法从依赖变更中确定安装了哪一个包」** | 你填的是 GitHub **archive 压缩包**(如 `…/main.tar.gz`),文件名与包名无关。改用方式一的 `.tgz` 地址。 |
167
+ | 填 `dsh-plugin-mind-tree` 提示「未找到相关插件」 | 本插件**尚未发布到 npm**,裸包名查不到。请填方式一的 `.tgz` 地址(方式二也可)。 |
168
+ | **「下载的安装包校验失败」** | pnpm 下载到的字节数与预期不符 —— 通常是**下载被截断/中断**(大陆网络访问 GitHub 常见),或本机 pnpm 缓存里有半截文件。处理顺序:① 点「**重试**」(多数情况一下就过);② 仍失败则**先移除**插件列表里的旧「思维树」条目再装;③ 改用**带版本号**的地址(见下);④ 走方式二本地安装(不依赖网络)。 |
169
+ | `.tgz` 地址报网络错误 / 超时 | 在 Releases 页下载 `.tgz` 后用本地文件路径安装(方式二同理)。 |
170
+ | 装完没有「思维树」页签 | 插件没**启用**,或没**完整重启**(桌面 ⌘Q;npx Ctrl+C)。 |
171
+ | 页签打开空白 / 一直连接中 | 宿主半区没重启;重启后仍失败可查看页内兼容性提示。 |
172
+
173
+ > **升级时的小陷阱**:`…/releases/latest/download/…` 是**可变地址**(新版本发布后同一地址内容会变),
174
+ > 而 pnpm 会把首次下载的**完整性哈希**记在本机锁文件里 —— 直接对同一可变地址重装,可能正好触发上面的
175
+ > 「下载的安装包校验失败」。所以**升级请用带版本号的不可变地址**:
176
+ >
177
+ > ```
178
+ > https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases/download/vX.Y.Z/dsh-plugin-mind-tree-X.Y.Z.tgz
179
+ > ```
180
+ >
181
+ > (或先在插件页移除旧条目,再用固定地址安装。)
182
+
183
+ 安装后右侧栏会出现「思维树」标签页(默认会自动打开;也可从右侧栏的开始页进入,或用会话行菜单打开)。
184
+ **前置条件**:GUI 视图需要档案包含 `@deepseek-ai/dsh-web-app`(桌面版/`dsh web` 默认包含);
185
+ 纯终端档案下只有 `mind_tree` 工具可用。macOS 的完整图文步骤另见 [INSTALL-Mac.md](INSTALL-Mac.md)。
186
+
187
+ ### Install (English)
188
+
189
+ Easiest way — **no git required** (paste the npm tarball URL, *not* the `.git` repo URL):
190
+
191
+ ```
192
+ https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases/latest/download/dsh-plugin-mind-tree.tgz
193
+ ```
194
+
195
+ 1. In DeepSeek Harness: **Plugins → Add plugin**, paste the URL above;
196
+ 2. Click **Install**, then **enable**「思维树 / dsh-plugin-mind-tree」in the plugin list;
197
+ 3. **Fully restart DSH** — Desktop app: `Command + Q` then reopen; `npx @deepseek-ai/dsh web`: `Control + C` and run it again. Refreshing the page is not enough.
198
+
199
+ Troubleshooting:
200
+
201
+ | Symptom | Fix |
202
+ |---|---|
203
+ | `xcode-select: No developer tools were found` | You pasted a `.git` URL (needs git). Use the `.tgz` URL above. |
204
+ | **"无法从依赖变更中确定安装了哪一个包"** (cannot tell which package was installed) | You pasted a GitHub **archive** URL (`…/main.tar.gz`) whose filename carries no package name. Use the `.tgz` URL above. |
205
+ | Network error on the URL | Download the `.tgz` from the [Releases](https://github.com/ShOpenMind/dsh-plugin-mind-tree/releases) page and install from the local file path. |
206
+ | "Plugin not found" for `dsh-plugin-mind-tree` | It is not published to npm yet; use the `.tgz` URL instead. |
207
+ | No「思维树」tab after install | Not enabled, or DSH wasn't fully restarted. |
208
+
209
+ Prerequisite for the GUI tab: your profile must include `@deepseek-ai/dsh-web-app` (default in Desktop / `dsh web`); terminal-only profiles can still use the `mind_tree` tool.
210
+
211
+ ## 开发
212
+
213
+ ```sh
214
+ pnpm install # 安装依赖(含测试用的 react / happy-dom / mermaid)
215
+ pnpm run build # 构建 lib/client.js(esbuild)
216
+ pnpm test # 运行全部测试套件
217
+ pnpm run test:host # 只跑某套:host / reduce / client / mount / render / mermaid / integration
218
+ ```
219
+
220
+ 宿主半区(`lib/index.js`、`lib/format.js`、`lib/reduce.js`、`lib/remote.js`、`lib/typert.host.js`)无需构建;
221
+ 客户端半区源码在 `src/client.js`,构建产物为 `lib/client.js`(**改动客户端必须重新 build 并提交产物**)。
222
+
223
+ ### 目录
224
+
225
+ | 路径 | 说明 |
226
+ |---|---|
227
+ | `lib/index.js` | 宿主分析引擎 + `mind_tree` 工具注册 + 能力探测 |
228
+ | `lib/format.js` | 共享导出格式化层(Mermaid 导图 / 大纲 / Obsidian 画布 / JSON) |
229
+ | `lib/reduce.js` | 过程信息削减层(精简 / 标准 / 完整三档,纯函数) |
230
+ | `lib/remote.js` / `lib/typert.host.js` | Typert 远程契约与清单 |
231
+ | `src/client.js` | 网页客户端源码(右侧栏标签页、SVG 渲染、导出菜单) |
232
+ | `tools/*.mjs` | 构建、测试与本地诊断脚本 |
233
+ | `.github/workflows/test.yml` | CI:安装 → 构建 → 产物一致性 → 全部测试 → 打包自检 |
234
+
235
+ ### 测试说明
236
+
237
+ - `host-test`:合成 + 畸形事件下的宿主鲁棒性、token 聚合、替换语义(含"整段重写"保护)、工具契约;
238
+ - `reduce-test`:三档削减策略、骨架保留、边重建、边界情形;
239
+ - `client-test`:完整挂载后的交互(渲染/跳转/搜索/导出/错误路径/三档切换、真实 Mermaid 解析校验);
240
+ - `integration-test`:**真实 cordis + 真实 ToolRuntime**(验证工具注册契约,跨版本升级的第一道防线)。
241
+ 需要 DSH 解包目录,默认取 `../asar-src/dsh/node_modules`,可用 `DSH_DSH_NODE_MODULES` 覆盖;缺失时自动跳过。
242
+ - `verify` / `export-real` / `level-report`:针对**真实会话日志**的本地诊断,会话目录默认
243
+ `~/.dsh/sessions`,可用 `DSH_SESSIONS_DIR` 覆盖,输出目录用 `DSH_MIND_TREE_OUT` 覆盖。
244
+
245
+ ## 架构
246
+
247
+ - 宿主半区通过 `ctx.sessionQuery` 只读访问会话日志与血统(`readSession`、`traceSession`、
248
+ `readEvent`、`filterSessions`、`readTitle*`),并把分析结果以 Typert 远程服务
249
+ `mindTree` 暴露给客户端(`forest` / `lineage` / `tree` / `detail` / `follow`);
250
+ - 客户端半区在右侧栏注册「思维树」标签页,用 SVG 渲染树(折叠/搜索/导出/三档信息量)。
251
+
252
+ 本插件只读会话数据:不写入会话、不发起模型调用、不上传任何数据。
253
+
254
+ ## 发布新版本(维护者)
255
+
256
+ > 安装文档用的是**固定链接** `…/releases/latest/download/dsh-plugin-mind-tree.tgz`,
257
+ > 因此每次发版**必须同时上传一个不带版本号的 `dsh-plugin-mind-tree.tgz`**,否则该链接会 404。
258
+
259
+ ```sh
260
+ # 1. 改版本号 + 构建 + 测试
261
+ # (package.json version;Client 改动必须先 pnpm run build 并提交 lib/client.js)
262
+ pnpm run build && pnpm test
263
+ git add -A && git commit -m "release: vX.Y.Z" && git push
264
+
265
+ # 2. 打包标准 npm 包,并复制一份不带版本号的副本
266
+ pnpm pack # → dsh-plugin-mind-tree-X.Y.Z.tgz
267
+ cp dsh-plugin-mind-tree-X.Y.Z.tgz dsh-plugin-mind-tree.tgz
268
+
269
+ # 3. 打标签 + 建 Release,同时上传两个资源
270
+ git tag vX.Y.Z && git push origin vX.Y.Z
271
+ gh release create vX.Y.Z dsh-plugin-mind-tree-X.Y.Z.tgz dsh-plugin-mind-tree.tgz \
272
+ --title "vX.Y.Z" --notes "…更新说明…"
273
+ ```
274
+
275
+ macOS 离线包(可选,供不便联网的场景):`git archive` 导出源码目录后打包为
276
+ `dsh-plugin-mind-tree-vX.Y.Z-mac.zip` 一并上传。
277
+
278
+ ### 发布到 npm(让安装变成"填一个包名")
279
+
280
+ 发布后安装只需填 `dsh-plugin-mind-tree`,不再依赖 GitHub 直连(可走 npm 镜像,快且稳)。
281
+ 本仓库的运行环境自带 pnpm(含 `login` / `publish`),无需额外安装 npm:
282
+
283
+ ```sh
284
+ # 0) 一次性:在**网页端**注册 https://www.npmjs.com/signup 并完成邮箱验证,然后登录
285
+ # ⚠️ npm 已禁用「命令行建号」:用 CLI 建号会返回 403
286
+ # "Account creation via legacy auth is unavailable" —— 网页注册是唯一途径。
287
+ # ⚠️ 若网页被 Cloudflare 拦(「访问暂时受限」),换代理节点 / 用手机流量打开,
288
+ # 注册与邮件验证链接都用手机流量完成。
289
+ node <runtime>/dependencies/pnpm/bin/pnpm.mjs login
290
+
291
+ # 1) 预演:确认打进去的内容(lib + cordis.patch.yml + README + LICENSE)
292
+ node <runtime>/dependencies/pnpm/bin/pnpm.mjs publish --dry-run --no-git-checks
293
+
294
+ # 2) 正式发布(未加 scope 的包默认 public)
295
+ node <runtime>/dependencies/pnpm/bin/pnpm.mjs publish --no-git-checks --access public
296
+
297
+ # 3) 验证
298
+ node <runtime>/dependencies/pnpm/bin/pnpm.mjs view dsh-plugin-mind-tree version
299
+ ```
300
+
301
+ 注意:
302
+
303
+ - **版本号不可复用**(同版本重复发布会报 `EPUBLISHCONFLICT`),发新版先改 `package.json` 的 `version`;
304
+ - 若提示需要 2FA,可在 npm 账号设置里开启 2FA 后带 `--otp <6 位验证码>`,
305
+ 或改用 **Granular Access Token**(权限 Read and write + 允许绕过 2FA)写入 `~/.npmrc`:
306
+ `//registry.npmjs.org/:_authToken=<token>`;
307
+ - `repository` / `files` / `peerDependencies` 已配置妥当,npm 页面会自动展示仓库与依赖信息。
308
+
309
+ ## 第三方依赖与许可
310
+
311
+ - **运行时依赖**:[zod](https://github.com/colinhacks/zod)(MIT)。为避免宿主要求加载,其代码随客户端构建产物 `lib/client.js` 内联分发(约 900 KB),其许可证随附于 zod 项目;
312
+ - `@deepseek-ai/*` 系列包作为外部依赖由 DeepSeek Harness 宿主提供,不在本仓库内分发;
313
+ - **开发依赖**(仅构建/测试使用):esbuild(MIT)、react / react-dom(MIT)、happy-dom(MIT)、mermaid(MIT)。
@@ -0,0 +1,4 @@
1
+ # 仅添加本插件行,不替换任何官方 DSH 组件。
2
+ - insert:
3
+ - id: mind-tree
4
+ name: dsh-plugin-mind-tree