dsh-molbio-tools 0.25.0 → 0.27.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/CHANGELOG.md CHANGED
@@ -10,6 +10,186 @@
10
10
  改为按**包名**引用后模块缓存问题随之消失——没有拷贝,也就没有需要保持同步的版本目录。
11
11
  下文历史条目里出现的 `vN` 目录保持原样,作为当时的记录。
12
12
 
13
+ ## [0.27.0] — 2026-11-22(molbio_duplex_thermo:双链热力学,survey #9)
14
+
15
+ **工具数 64 → 65,benchmark 65 → 66 题(65/65 覆盖)。** 候选池里排序第 9 的"双链热力学扩展":
16
+ 引物/探针工具一直只报 Tm,用户问"这条探针的 ΔG 是多少、有没有发夹/二聚体"时没有工具可答。
17
+
18
+ ### 1. 新工具 `molbio_duplex_thermo`
19
+
20
+ - 对一条 DNA 寡核苷酸给出 **ΔH(kcal/mol)、ΔS(cal/mol·K,原始与盐校正)、ΔG°37、Tm**,
21
+ 参数与 `molbio_primer_tm` / `molbio_primer_check` **同一套**(SantaLucia 1998 NN、
22
+ von Ahsen 2001 Mg 当量 + 盐校正)——`test/smoke.mjs` 断言同一序列在同一条件下两个工具的
23
+ Tm **逐位相等**。
24
+ - 附带 Primer3 同款结构检查:3' 端稳定性 ΔG、发夹(3–8 bp stem / 3–10 nt loop,按 Tm 排序)、
25
+ 自二聚体,以及给出 `partner` 时的异源二聚体 Tm(any / 3'-end)。
26
+ - **错配双链被拒绝,而不是估算**:`partner` 不是精确反向互补时报出错配位置并抛
27
+ `MolbioInputError`。Allawi/SantaLucia 的错配参数集不在这套实现里,用 Watson–Crick 参数硬算
28
+ 会得到一个"看起来合理、实际差几 kcal/mol"的数——这比不给答案更糟。IUPAC 简并码同理拒绝。
29
+ - 条件旋钮:`na_mm` / `mg_mm` / `dntp_mm` / `oligo_nm` / `hairpins`(0 关闭结构扫描),全部范围校验。
30
+
31
+ ### 2. 实现
32
+
33
+ - `lib.mjs`:把原来只服务于 `primerTm` 的 NN 计算提成导出的 `duplexThermodynamics()`;
34
+ `primerTm` 变成它的四舍五入包装,**已发布数值零变化**(既有 Tm 断言未改)。
35
+ - 新模块 `thermo.mjs`:输入校验、partner 精确性检查、发夹/二聚体汇总。
36
+ - `index.mjs`:注册 `molbio_duplex_thermo`(第 65 个工具),并在 system prompt 的引物段点名。
37
+
38
+ ### 3. 测试、benchmark 与文档
39
+
40
+ - `test/smoke.mjs`:Tm 一致性、ΔG/ΔH/ΔS 符号、盐校正、partner 通路、错配/简并码/参数越界拒绝、
41
+ 渲染文本。
42
+ - benchmark 新任务 `duplex-thermo`(full 档,6 条 tool 断言):66 题、覆盖 65/65。
43
+ - preset 与 README 的工具数同步 65;`benchmark-profile` 的 preset 工具数守卫随之为
44
+ 13 rows / 65 tools。
45
+ - 根包 `0.26.0 → 0.27.0`;面板包 `0.1.15 → 0.1.16`——`lib.mjs` 在浏览器半里,提取
46
+ `duplexThermodynamics()` 改变了打包产物,两份 `lib/client.js` 已重建。
47
+
48
+ ## [0.26.0] — 2026-11-22(PubMed key 常驻标志:Papers 徽标 + 检索结果标注)
49
+
50
+ **工具数不变(64),行为只在"告知"层面变化。** 配了 NCBI API key 却看不出它是否生效,是这一版要修的
51
+ 可用性问题:凭据只写在插件详情页的一行状态里,离开插件页就没有任何提示。
52
+
53
+ ### 1. Papers 标签页的常驻徽标
54
+
55
+ Papers tab 顶部新增常驻状态徽标,直接读宿主凭据库(永不回显值):
56
+
57
+ - 已配置 → 绿点 + `PubMed API key configured (source: …)`;
58
+ - 未配置 → 灰点 + `PubMed API key not configured in the credential store — environment keys still apply`;
59
+ - 读不到 → 红点 + `PubMed API key status unavailable`。
60
+
61
+ 徽标订阅宿主的 `credentials/reference-updated`:在插件页、Settings 或 `.credentials.yaml` 里改动,
62
+ 不需要重开标签页就刷新。实现上把状态放在模块级快照里(徽标是普通 DOM,因此不额外要求
63
+ `remote.credentials` 注入),由 `apply` 里唯一的 `ctx.inject(['remote.credentials'])` 喂养;
64
+ 详情页的 Save / Remove 也会同步发布。
65
+
66
+ ### 2. 检索结果写明凭据通道
67
+
68
+ `molbio_pubmed_search` 的渲染行把通道写出来:`via PubMed E-utilities (NCBI API key)` 或
69
+ `via web search (no NCBI API key)`。对话记录里也能看出这次调用是否用了 key,而不只是 "E-utilities"。
70
+
71
+ ### 3. 详情页状态改成同款徽标
72
+
73
+ 插件详情页的 `PubMed API key` 一节,状态行由纯文本改为带色点的徽标(文字不变),与 Papers tab 一致。
74
+
75
+ ### 4. 测试与产物
76
+
77
+ - `test/panel-render.mjs`:新增徽标用例(配置态 → 绿点 + 来源;永不出现 key 值)。
78
+ - `test/client.mjs`:新增 `molbio panel: NCBI key status` 效果的断言。
79
+ - `lib/client.js` 与 `packages/molbio-panel/lib/client.js` 重新构建(485.1 KB)。
80
+ - 根包 `0.25.3 → 0.26.0`;面板包 `0.1.14 → 0.1.15`。
81
+
82
+ ## [0.25.3] — 2026-11-22(DSH 0.2.2-rc.5 适配:上游 preset 未变,声明与版本跟进)
83
+
84
+ **工具数不变(64),benchmark 不变(65 题)。** 0.25.2 的验收基线是 **0.2.2-rc.3**;这一版把
85
+ 基线推到 **0.2.2-rc.5**,并在本机桌面版 `app.asar` 上重跑了整套守卫。
86
+
87
+ ### 1. rc.5 的上游 `standard` 与 rc.3 / rc.2 逐字节一致
88
+
89
+ 桌面端 `@deepseek-ai/dsh-desktop-runtime` 为 0.2.2-rc.5(Electron 44.7.0 / Node 24.21.0),
90
+ 内嵌 338 个 `@deepseek-ai/*` 包全部为 rc.5;`dsh-web-app/presets/standard.patch.yml` 仍是
91
+ **7286 B,sha256 `e40bb192…`**,因此 preset 行清单零改动:`preset-health` 30 行全绿,
92
+ `drift-probe` 的 17 个突变全部被抓到。`rc.4` 未在任何真实安装上运行过,故仍为 `unknown`。
93
+
94
+ ### 2. 守卫直接跑在 rc.5 的 `resources/app.asar` 上
95
+
96
+ `contract` 17 / `preset-health` 30 行 / `drift-probe` 18 项 / `client-mount` / `smoke` 64 工具 /
97
+ `bench:offline` 65 题全部通过:
98
+ `ELECTRON_RUN_AS_NODE=1 "<安装目录>/DeepSeek Harness.exe" test/<guard>.mjs --dsh "<安装目录>/resources/app.asar/dsh"`。
99
+ 宿主自身的 `evaluatePluginCompatibility()`(`includePrerelease: true`)对两份清单在 rc.5 上均返回接受,
100
+ `engines.dsh` 无需改动。
101
+
102
+ ### 3. 声明与版本
103
+
104
+ - 两个包 `dshReleases` 增加 `0.2.2-rc.4: unknown` 与 `0.2.2-rc.5: compatible`;`engines.dsh` 不变。
105
+ - 根包 `0.25.2 → 0.25.3`;面板包 `0.1.13 → 0.1.14`(只改清单声明,`lib/client.js` 未变)。
106
+ - CI(`test.yml` / `release.yml`)钉的 `@deepseek-ai/dsh` 由 `0.2.2-rc.3` 提到 `0.2.2-rc.5`
107
+ (registry 的 `latest` 与 `next` 均为 rc.5)。
108
+
109
+ ## [0.25.2] — 2026-11-13(DSH 0.2.2-rc.3 适配:上游未变,声明与守卫跟进)
110
+
111
+ **工具数不变(64),benchmark 不变(65 题)。** 0.25.1 的验收基线是 **0.2.2-rc.2**;这一版把
112
+ 基线推到 **0.2.2-rc.3**,并在本机桌面版 `app.asar` 上重跑了整套守卫。
113
+
114
+ ### 1. rc.3 的上游 `standard` 与 rc.2 逐字节一致
115
+
116
+ 桌面端 `@deepseek-ai/dsh-desktop` 与内嵌的 `dsh-desktop-runtime` 均为 0.2.2-rc.3(Electron
117
+ 44.7.0 / Node 24.21.0)。上游 `dsh-web-app/presets/standard.patch.yml` 仍是 **7286 B,
118
+ sha256 `e40bb192…`**,与 rc.2 完全相同,因此 preset 行清单零改动:`preset-health` 30 行全绿,
119
+ `drift-probe` 的 17 个突变全部被抓到。
120
+
121
+ ### 2. 守卫直接跑在 `resources/app.asar` 上
122
+
123
+ 桌面运行时把包封在 asar 里,普通 Node 读不到。用
124
+ `ELECTRON_RUN_AS_NODE=1 "<安装目录>/DeepSeek Harness.exe" test/<guard> --dsh
125
+ "<安装目录>/resources/app.asar/dsh"` 即可让守卫读到真实的运行时:`contract` 17 /
126
+ `preset-health` 30 行 / `drift-probe` 18 项 / `client-mount` 全部通过。
127
+
128
+ ### 3. 新增守卫:声明必须跟随实际安装的 harness
129
+
130
+ 0.25.1 之前,`dshReleases` 少一个版本是**静默**的——没有测试读它,于是"装到了新版本却仍标
131
+ unknown"只能靠人发现(0.2.2-rc.3 就是这样发现的)。`test/preset-health.mjs` 现在把两份清单
132
+ (根包与面板包)的 `dshReleases[<已安装版本>]` 一起校验,必须为 `compatible`;
133
+ `drift-probe` 用"删掉条目"与"改成 unknown"两个突变证明它会失败。
134
+
135
+ ### 4. 声明与版本
136
+
137
+ - 两个包 `dshReleases` 增加 `0.2.2-rc.3: compatible`;`engines.dsh` 不变。
138
+ - CI(`test.yml` / `release.yml`)钉 `@deepseek-ai/dsh@0.2.2-rc.3`。
139
+ - 根包 `0.25.1 → 0.25.2`;面板包 `0.1.12 → 0.1.13`(只改清单声明,`lib/client.js` 未变)。
140
+
141
+ ## [0.25.1] — 2026-11-12(DSH 0.2.2-rc.2 适配:preset 吸收三处上游变更;契约守卫兼容压缩产物)
142
+
143
+ **工具数不变(64),benchmark 不变(65 题)。** 0.25.0 的验收基线是 **0.2.2-rc.1**;这一版把
144
+ 基线推到 **0.2.2-rc.2**,并在实际安装的桌面运行时上重跑了整套守卫。
145
+
146
+ ### 1. 为什么"rc.2 在 `engines.dsh` 范围内"仍然不是适配
147
+
148
+ `engines.dsh` 的 `>=0.2.1-rc.2 <0.3.0-0` 覆盖 rc.2,但 rc.2 的上游 `standard` 预设变了三处。
149
+ 本仓库的 preset 是上游行清单的逐字副本,所以三处都必须照抄(否则 `preset-health` 报 drift,
150
+ molbio-lab 还会静默缺少这些能力):
151
+
152
+ - 新增 `tool-office` 行(`@deepseek-ai/dsh-tool-office`)——预设此前**没有 Office 工具**;
153
+ - `skill-filesystem` 增加 `config.customSkillDirs`,指向 `@deepseek-ai/dsh-agent-preset/skills`;
154
+ - `tool-subagent-control` 增加 `config.interrupt: false`。
155
+
156
+ 上游 `standard.patch.yml` 从 6858 B(sha256 `3006cc…`)变为 7286 B(sha256 `e40bb192…`);
157
+ 桌面 `app.asar` 与 npm tarball 两份**逐字节一致**。preset 行数因此 29 → 30。
158
+
159
+ ### 2. `preset-health` 要学会校验未求值的 `!!js`
160
+
161
+ `customSkillDirs` 的值是 `!!js` 表达式,按 Loader 的方言解析后是 `{ __jsExpr }`,而不是字符串;
162
+ `skill-filesystem` 的 `Config` 会拒绝它。真实 Loader 在挂载前求值,守卫手里只有节点本身
163
+ (`baseUrl` / `ctx` / `dshHomePath` 只在挂载时存在)。`test/preset-health.mjs` 现在分别用
164
+ 字符串 / 数字 / 布尔占位符各校验一次,只有**都**不通过才判 `config-invalid`——形状错误仍然会失败,
165
+ 而 `preset-health` 在 rc.2 上 30 行全绿。
166
+
167
+ ### 3. `contract`:桌面版压缩产物造成的假红
168
+
169
+ 桌面运行时把客户端 bundle 压成 `x=>y`、模板串、无空格的形式,npm 包不是。0.25.0 的 `contract`
170
+ 在桌面 0.2.2-rc.2 上有 5 条以字符串不匹配失败,逐条核对后**契约全部在位**——
171
+ `useSessions(sessions=>sessions.byId[sessionId]?.cwd)`、`workspaceFiles.list(sessionId,path,signal)`、
172
+ `installScope("session",…)`、`slots.inject("tool.call.toolview")`、`key: "present"`、
173
+ `inject(key,callback)`、`this._core.specDynamic(key)`。断言改为匹配**调用**而不是某一种拼写;
174
+ npm 与桌面两份现在都是 17/17。
175
+
176
+ ### 4. 在真实安装上跑过的证据
177
+
178
+ 桌面 0.2.2-rc.2(内嵌 Node 24.21.0):临时 profile → HTTP 200(41 393 B,boot 图含
179
+ `dsh-molbio-tools/client.js`)→ `agentPresets/list` 列出 molbio-lab、无 `broken` →
180
+ `pluginInventory/list` 的 `tool-molbio` 为 `fiberPhase: "active"`。
181
+ `contract` 17 / `preset-health` 30 行 / `drift-probe` 16 项(15 个突变)/ `smoke` 64 工具 /
182
+ `bench:offline` 65 题全绿。
183
+
184
+ ### 5. 声明与版本
185
+
186
+ - 两个包 `dshReleases` 增加 `0.2.2-rc.2: compatible`;`engines.dsh` 不变。
187
+ - CI(`test.yml` / `release.yml`)钉 `@deepseek-ai/dsh@0.2.2-rc.2`。
188
+ - 根包 `0.25.0 → 0.25.1`;面板包 `0.1.11 → 0.1.12`(只改清单声明,`lib/client.js` 未变)。
189
+ - **兼容性后果**:`tool-office` 是 rc.2 才有的包,preset 写入该行后 molbio-lab 在 **0.2.2-rc.1 上不再可挂载**
190
+ (实测 `tool-office [unresolvable]: specifier does not resolve: MODULE_NOT_FOUND`);rc.1 用户应留在 0.25.0。
191
+ - 基线文档(store-evidence / maintainer / roadmap / history / workflow)同步到 rc.2。
192
+
13
193
  ## [0.25.0] — 2026-11-10(浏览器内 3D 结构预览:真实原子模型)
14
194
 
15
195
  **工具数不变(64),benchmark 不变(65 题 / 64 覆盖)。** 这一版把结构文件接进已有的
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-molbio-tools
2
2
 
3
- **给 AI 助手装上分子生物学的"手"**:一个零依赖的 DeepSeek Harness 插件包,为它提供 **64 个
3
+ **给 AI 助手装上分子生物学的"手"**:一个零依赖的 DeepSeek Harness 插件包,为它提供 **65 个
4
4
  `molbio_*` 工具**——序列分析、引物/探针自动设计、克隆模拟、质粒图谱、测序验证、蛋白与 CRISPR
5
5
  分析、qPCR 统计、文献与实验记录。装上之后,你可以直接用自然语言让助手完成这些计算,并把结果
6
6
  画成图。
@@ -31,7 +31,7 @@
31
31
  ## 目录
32
32
 
33
33
  - [安装](#安装)(3 步)
34
- - [它会做什么](#它会做什么)(按任务分组的 64 个工具)
34
+ - [它会做什么](#它会做什么)(按任务分组的 65 个工具)
35
35
  - [典型用法示例](#典型用法示例)
36
36
  - [输出文件、自动打开与浏览器面板](#输出文件自动打开与浏览器面板)
37
37
  - [方法学与使用须知](#方法学与使用须知)(各工具的模型、估算范围与边界)
@@ -46,7 +46,7 @@
46
46
 
47
47
  ### 推荐:在 DSH 插件页安装(3 步)
48
48
 
49
- 装完后,预设选择器里会出现 **Molecular Biology Lab** 模式;**64 个工具只在这个模式里出现**,
49
+ 装完后,预设选择器里会出现 **Molecular Biology Lab** 模式;**65 个工具只在这个模式里出现**,
50
50
  不会污染你其它会话(这点很重要:工具多了会占提示预算)。**右栏的 Molbio / Papers 两个面板也随这个包
51
51
  一起装好**,不需要再装 `dsh-molbio-panel`。
52
52
 
@@ -57,7 +57,9 @@
57
57
 
58
58
  **(可选)PubMed API key**:重启后打开 **插件 → 已安装插件 → `dsh-molbio-tools` 详情页**,
59
59
  在 **PubMed API key** 一节粘贴 NCBI key 并点 **Save**。它写进 DSH 凭据库(`~/.dsh/.credentials.yaml`),
60
- 不需要编辑文件、也不进环境变量,下一次检索即生效。没有 key 时检索仍走原来的 web 检索。
60
+ 不需要编辑文件、也不进环境变量,下一次检索即生效。保存后 **Papers** 标签页顶部会常驻一枚状态徽标
61
+ (`PubMed API key configured (source: …)`),不用回插件页确认是否成功;没有 key 时徽标显示 `not configured`。
62
+ 没有 key 时检索仍走原来的 web 检索。
61
63
 
62
64
  ### 次选:命令行安装
63
65
 
@@ -104,9 +106,9 @@ dsh plugin --profile web update dsh-molbio-tools
104
106
  | 层(同一个 `cordis.patch.yml` 里的两段) | 作用 |
105
107
  | --- | --- |
106
108
  | `molbio-client` → `./host.mjs` | 只插一行**惰性宿主锚点**,不注册任何工具 |
107
- | `preset-molbio-lab` → `@deepseek-ai/dsh-agent-preset` | 声明 **Molecular Biology Lab** 模式,64 个工具在这一层里 |
109
+ | `preset-molbio-lab` → `@deepseek-ai/dsh-agent-preset` | 声明 **Molecular Biology Lab** 模式,65 个工具在这一层里 |
108
110
 
109
- 所以 64 个工具**只在选中该模式的会话里加载**,其它模式(standard / ptc / minimal / cordis)
111
+ 所以 65 个工具**只在选中该模式的会话里加载**,其它模式(standard / ptc / minimal / cordis)
110
112
  不带它们,不占提示预算。bundle 安装 ≠ 工具全局可见:bundle 只是把"模式"和"面板"一起装进来。
111
113
 
112
114
  > **那一行锚点不是多余的。** DSH 的客户端模块扫描只走**宿主 Loader 树**(官方原话:
@@ -122,7 +124,7 @@ dsh plugin --profile web update dsh-molbio-tools
122
124
 
123
125
  ### 只要浏览器面板
124
126
 
125
- 如果只想要图形面板、不想让该 profile 装 64 个工具(连模式都不装),装面板专用包即可
127
+ 如果只想要图形面板、不想让该 profile 装 65 个工具(连模式都不装),装面板专用包即可
126
128
  (见[浏览器面板](#浏览器面板可选))。**它和 `dsh-molbio-tools` 二选一**:两者注册同一组右栏 tab
127
129
  (`dsh-molbio-tools` / `dsh-molbio-tools/papers`),同时装会重复注册并报
128
130
  `tab type id ... is already registered`。同样在 **插件 → 添加插件** 里输入 `dsh-molbio-panel`,
@@ -138,7 +140,7 @@ dsh plugin --profile <profile> add dsh-molbio-panel
138
140
 
139
141
  ## 它会做什么
140
142
 
141
- 64 个工具按任务分为十组。下表是"你想做什么 → 用哪个工具"的索引,参数细节模型会在调用时自己
143
+ 65 个工具按任务分为十组。下表是"你想做什么 → 用哪个工具"的索引,参数细节模型会在调用时自己
142
144
  填;你只需要把意图说清楚。
143
145
 
144
146
  ### 1. 序列分析与酶切(9)
@@ -163,6 +165,7 @@ dsh plugin --profile <profile> add dsh-molbio-panel
163
165
  | `molbio_design_intron_primers` | **跨内含子 qPCR 引物**:给定基因组序列 + 外显子坐标,**反向引物**跨外显子-外显子连接点(正向引物在其上游、位于单个外显子内),基因组 DNA 不会扩增;F 在上游、R 是按 5'→3' 可直接订购的分子(可设最小基因组间距) |
164
166
  | `molbio_design_taqman` | **TaqMan(水解探针)测定设计**:引物对 + 探针一次给出(探针 5' 端非 G、Tm 比引物高 5 °C 起、无 run/重复、不与引物二聚化),每条候选附逐项罚分;支持 **MGB 化学**(更短、按未修饰 NN Tm 报告并明确标注修饰未建模)和**订购 CSV**(引物/探针、5'/3' 修饰、规模、纯化) |
165
167
  | `molbio_primer_tm` | 单条引物 Tm 估算(Na⁺/Mg²⁺/dNTP 盐校正) |
168
+ | `molbio_duplex_thermo` | **双链热力学**:ΔH、ΔS(原始/盐校正)、ΔG°37、Tm,外加 3' 端稳定性 ΔG、发夹、同源/异源二聚体;`partner` 不是精确反向互补时明确拒绝,而不是用 Watson–Crick 参数估算错配双链 |
166
169
  | `molbio_primer_check` | 引物结构筛查:重复序列、3' 端加权的自互补、发夹、引物对二聚体,以及 Primer3 同款热力学指标 |
167
170
  | `molbio_multiplex_check` | **多重 PCR 互扰检查**:面板内所有引物对的二聚体、3' 尾的脱靶与跨模板退火、扩增子是否能在胶上分辨,并给出重设计建议;另给出**退火温度建议**(最低引物 Tm − offset,含范围与 Tm 离散警告)和**引物浓度起始计划**(按扩增子大小比例配平) |
168
171
 
@@ -594,7 +597,8 @@ mutations remain deferred")。所以插件无法在工作区里合法地落一
594
597
  (esearch + esummary)。没有 key 时检索仍走原来的 web 检索通路,行为不变。
595
598
  - **优先把 key 放凭据库,而不是环境变量。** 凭据库是 `~/.dsh/.credentials.yaml`(`refs:` 下写
596
599
  `NCBI_API_KEY: …`;图形入口是**插件 → 已安装插件 → dsh-molbio-tools → PubMed API key**):
597
- 不进环境、仅属主可读、改完热重载、下一次调用即生效。环境变量会被**每个子进程继承**——包括 agent 自己的 shell 工具,`echo $env:NCBI_API_KEY`
600
+ 不进环境、仅属主可读、改完热重载、下一次调用即生效。配置状态在 **Papers** tab 顶部有常驻徽标,
601
+ 检索结果行也会标 `via PubMed E-utilities (NCBI API key)`。环境变量会被**每个子进程继承**——包括 agent 自己的 shell 工具,`echo $env:NCBI_API_KEY`
598
602
  就能读出来,而且明文存在用户环境里;内联 `api_key` 还会进入对话记录与工具卡片。
599
603
  > 凭据库不是对 agent 的硬隔离(agent 与你是同一个 OS 用户,刻意去读文件仍可能),但它消除了
600
604
  > 「所有 shell 子进程自动继承」这条泄漏路径——这正是环境变量的主要问题。
@@ -693,7 +697,9 @@ node <包目录>\preset\install.mjs --profile web --check # 只报告,不组
693
697
 
694
698
  **PubMed 的 API key 怎么配?**
695
699
  推荐用**插件详情页**:插件 → 已安装插件 → `dsh-molbio-tools` → **PubMed API key**,粘贴后点 Save
696
- (写入 DSH 凭据库的 `NCBI_API_KEY`,不进环境变量,下一次检索生效)。也可以手动在
700
+ (写入 DSH 凭据库的 `NCBI_API_KEY`,不进环境变量,下一次检索生效)。保存后 **Papers** tab 顶部会常驻
701
+ 显示 `PubMed API key configured (source: …)`;检索结果行会标 `via PubMed E-utilities (NCBI API key)`,
702
+ 两者都能确认 key 已生效。也可以手动在
697
703
  `~/.dsh/.credentials.yaml` 的 `refs:` 下加一行 `NCBI_API_KEY: 你的key`。
698
704
  也可以用环境变量 `NCBI_API_KEY`,或在单次调用里传 `api_key`,但两者都更容易泄漏:**环境变量会被
699
705
  agent 的 shell 子进程继承**,内联参数会出现在对话记录与工具卡片里。有 key 时走官方 E-utilities
@@ -726,13 +732,13 @@ agent 的 shell 子进程继承**,内联参数会出现在对话记录与工
726
732
 
727
733
  想评估"模型到底会不会用这些工具",看 **[benchmark/README.md](benchmark/README.md)**:
728
734
  `npm run bench:offline` 零成本校验期望值(在 `npm test` 里),`npm run bench` 用真实模型
729
- 跑 **core 档 14 题**,`npm run bench:full` 跑**全部 65 题(覆盖 64/64 个工具)**。
735
+ 跑 **core 档 14 题**,`npm run bench:full` 跑**全部 66 题(覆盖 65/65 个工具)**。
730
736
 
731
737
  > **改动与 benchmark 的关系(硬规则)**:新增或改动任何工具行为,**必须**新增/更新对应的
732
738
  > benchmark 任务并重跑;没有改动就不必重跑。日常只需要一条命令——
733
739
  > `node benchmark/run.mjs --model --changed`——它会从你的改动反推出该跑哪几题
734
740
  > (`lib.mjs` 这类共享库会自动放大到全量),改动只在文档/测试时则直接回答"无事可跑"。
735
- > `test/benchmark-coverage.mjs` 会拦住"新工具没有任务"(断言 64/64 覆盖),
741
+ > `test/benchmark-coverage.mjs` 会拦住"新工具没有任务"(断言 65/65 覆盖),
736
742
  > `bench --offline` 会拦住"期望值过期"。完整对照表见
737
743
  > [docs/workflow.md](docs/workflow.md) 第 2 节。
738
744
 
@@ -759,7 +765,7 @@ agent 的 shell 子进程继承**,内联参数会出现在对话记录与工
759
765
 
760
766
  ```
761
767
  dsh-molbio-tools/
762
- ├── index.mjs # 插件入口:export { name, inject, apply },注册 64 个工具
768
+ ├── index.mjs # 插件入口:export { name, inject, apply },注册 65 个工具
763
769
  ├── lib.mjs # 基础库:IUPAC、翻译、酶表、NN 热力学、qPCR、lab math、甲基化/buffer 参考表
764
770
  ├── design.mjs # 引物自动设计(含跨内含子 qPCR)
765
771
  ├── taqman.mjs # TaqMan 水解探针设计(复用 design.mjs 的引物引擎)
@@ -76,11 +76,11 @@ Measured, and printed so the answer can be audited:
76
76
 
77
77
  ```
78
78
  $ touch crispr.mjs && node benchmark/run.mjs --list --changed
79
- 1 of 65 task(s) selected — --tools molbio_grna_design --changed
79
+ 1 of 66 task(s) selected — --tools molbio_grna_design --changed
80
80
  (from --changed; 2 module(s) affected: crispr.mjs, index.mjs)
81
81
 
82
82
  $ touch lib.mjs && node benchmark/run.mjs --list --changed
83
- 55 of 65 task(s) selected — --changed (27 module(s) affected: align.mjs, cloning.mjs, …)
83
+ 56 of 66 task(s) selected — --changed (27 module(s) affected: align.mjs, cloning.mjs, …)
84
84
  ```
85
85
 
86
86
  `lib.mjs` selecting nearly everything is the **correct** answer, not a failure to
@@ -102,7 +102,7 @@ you changed, so its task runs even if it is full-only.
102
102
  | `--tools a,b,c` / `primer_*` | the union | you changed a few |
103
103
  | `--changed --tools X` | the INTERSECTION | "of what I changed, test X" |
104
104
  | (default) | **core** — 14 tasks | a broad smoke of the catalog |
105
- | `--tier full` | all 65, 64/64 tools | before a release |
105
+ | `--tier full` | all 66, 65/65 tools | before a release |
106
106
 
107
107
  The two `--tools` operators are stated because confusing them is the difference
108
108
  between testing what you changed and testing **less** than that: alone it unions,
@@ -134,7 +134,7 @@ and `test/benchmark-changed.mjs` asserts both directions.
134
134
  ### The part that still runs in full, on purpose
135
135
 
136
136
  A model run with `--changed` or `--tools` first executes the **whole** offline
137
- gate: all 65 tasks' `where: "tool"` expectations are recomputed against the shipped
137
+ gate: all 66 tasks' `where: "tool"` expectations are recomputed against the shipped
138
138
  tools (no model, a few hundred milliseconds). That is what makes partial runs safe
139
139
  — the expected values are re-proven for the tasks you skipped, so "skipped because
140
140
  unchanged" is a checked claim, not a remembered one.
@@ -169,7 +169,7 @@ asserting whatever the tool happened to emit.
169
169
 
170
170
  Two guards make "someone forgot" fail loudly instead of quietly:
171
171
 
172
- - `test/benchmark-coverage.mjs` asserts **64/64 registered tools are covered by
172
+ - `test/benchmark-coverage.mjs` asserts **65/65 registered tools are covered by
173
173
  at least one task**. Adding a tool without a task is a red build. It also
174
174
  asserts the fixtures' premises (the Golden Gate backbone is BsaI-free, the
175
175
  mutagenesis template still admits a primer pair), that a `covers` entry names a
@@ -210,7 +210,7 @@ recorded tool text, and it says so instead of silently scoring empty text).
210
210
 
211
211
  ## The headless profile (`benchmark/profile.mjs`)
212
212
 
213
- The model-facing way to get the 64 tools is the **Molecular Biology Lab** agent
213
+ The model-facing way to get the 65 tools is the **Molecular Biology Lab** agent
214
214
  preset. The benchmark cannot use it, and the reason is structural rather than
215
215
  configurational — `dsh-headless/lib/index.js` refuses an adoption whose session
216
216
  records a preset:
@@ -568,7 +568,7 @@ implementation happens to return for one set of arguments.**
568
568
  and `args_ok` both true is a *reporting* finding, not a tool bug.
569
569
  - **Multimodal hand-off.** `attach_image` is exercised as an argument at most; no
570
570
  assertion inspects a decoded PNG (that is `svgpng.mjs` and `contract.mjs`).
571
- - **Most of the toolset is now covered, but shallowly.** 65 tasks touch all 64
571
+ - **Most of the toolset is now covered, but shallowly.** 66 tasks touch all 65
572
572
  tools; most tools appear in exactly one task, and several appearances are a
573
573
  single argument check rather than a full workflow. Breadth is asserted by
574
574
  `test/benchmark-coverage.mjs`; depth is not, and cannot be.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * ── Why a hand-built profile exists at all ──────────────────────────────────
7
7
  *
8
- * The model-facing way to get the 64 tools is the "Molecular Biology Lab" agent
8
+ * The model-facing way to get the 65 tools is the "Molecular Biology Lab" agent
9
9
  * preset, and the benchmark would obviously rather run THAT than a
10
10
  * reconstruction of it. It cannot: `dsh-headless` refuses a preset for a
11
11
  * structural reason, not a configuration one —
@@ -209,6 +209,56 @@
209
209
  "note": "the model explains the MGB Tm caveat or the modifications"
210
210
  }
211
211
  ]
212
+ },
213
+ {
214
+ "id": "duplex-thermo",
215
+ "category": "primers",
216
+ "tier": "full",
217
+ "covers": [
218
+ "molbio_duplex_thermo"
219
+ ],
220
+ "instruction": "Before I order this oligo I want its full duplex thermodynamics, not just a Tm: the enthalpy and entropy behind the Tm, the ΔG at 37 °C, and whether it folds into a hairpin or dimerises with itself. Use the default qPCR-relevant conditions.\n\nOligo: GTAAAACGACGGCCAGTGCC",
221
+ "timeout_ms": 240000,
222
+ "expect_tools": [
223
+ "molbio_duplex_thermo"
224
+ ],
225
+ "assertions": [
226
+ {
227
+ "where": "tool",
228
+ "pattern": "20 bp, GC 60%",
229
+ "note": "the oligo's own metrics"
230
+ },
231
+ {
232
+ "where": "tool",
233
+ "pattern": "Tm 63\\.92 °C",
234
+ "note": "the nearest-neighbour Tm at the default conditions (50 mM Na+, 1.5 mM Mg2+, 0.8 mM dNTP, 250 nM strand)"
235
+ },
236
+ {
237
+ "where": "tool",
238
+ "pattern": "ΔG°37 -23\\.17 kcal/mol",
239
+ "note": "ΔG at 37 °C — the value a bare Tm does not show"
240
+ },
241
+ {
242
+ "where": "tool",
243
+ "pattern": "ΔH -162\\.1 kcal/mol",
244
+ "note": "the enthalpy term behind the Tm"
245
+ },
246
+ {
247
+ "where": "tool",
248
+ "pattern": "hairpin: stem 3 bp \\+ loop 4 nt from position 11",
249
+ "note": "the structure check found the stem rather than only reporting a Tm"
250
+ },
251
+ {
252
+ "where": "tool",
253
+ "pattern": "dimers: homodimer Tm any 0 °C / 3'-end 0 °C",
254
+ "note": "the dimer scan reports its own result"
255
+ },
256
+ {
257
+ "where": "answer",
258
+ "pattern": "ΔG|-23|63\\.9|hairpin|dimer",
259
+ "note": "the model reports the thermodynamics, not only a Tm"
260
+ }
261
+ ]
212
262
  }
213
263
  ]
214
264
  }
@@ -182,6 +182,7 @@ export function invocationsFor(task) {
182
182
  'enzyme-catalog': () => [{ tool: 'molbio_enzyme_lookup', args: { enzymes: ['BsaI', 'EcoRI'] } }],
183
183
 
184
184
  // primers
185
+ 'duplex-thermo': () => [{ tool: 'molbio_duplex_thermo', args: { sequence: 'GTAAAACGACGGCCAGTGCC' } }],
185
186
  'primer-qc': () => [
186
187
  { tool: 'molbio_primer_check', args: { primer1: 'ATTACTCCTGCTCTTCCCATAC', primer2: 'CACTACTCCTCTGTACGCAC' } },
187
188
  { tool: 'molbio_primer_tm', args: { sequence: 'ATTACTCCTGCTCTTCCCATAC' } },
@@ -588,6 +588,8 @@ function PapersPanel({ sessionId, remote, useSessions }) {
588
588
  const [query, setQuery] = useState('');
589
589
  const [tag, setTag] = useState('');
590
590
  const [selectedId, setSelectedId] = useState(null);
591
+ const keyState = useNcbiKeyState();
592
+ const keyView = ncbiKeyView(keyState);
591
593
 
592
594
  useEffect(() => {
593
595
  if (cwd === undefined) {
@@ -694,6 +696,14 @@ function PapersPanel({ sessionId, remote, useSessions }) {
694
696
 
695
697
  return h('div', { style: styles.root },
696
698
  h('div', { style: styles.side },
699
+ h('div', {
700
+ key: 'ncbi-key',
701
+ 'data-molbio-key-badge': keyView.tone,
702
+ title: keyState.message === '' ? keyView.label : keyState.message,
703
+ style: keyStyles.badge(keyView.tone),
704
+ },
705
+ h('span', { style: keyStyles.badgeDot(keyView.tone) }),
706
+ h('span', null, keyView.label)),
697
707
  search,
698
708
  tagRow,
699
709
  list),
@@ -716,6 +726,76 @@ async function readNcbiKey(remote) {
716
726
  return { phase: 'ready', ...credentialInfo(response, NCBI_KEY_REF), message: '' };
717
727
  }
718
728
 
729
+ /**
730
+ * The last known state of the PubMed key, shared by every surface that shows it.
731
+ *
732
+ * The detail section reads the credential store directly because `apply` gates
733
+ * it behind `ctx.inject(['remote.credentials'])`. The papers tab body is
734
+ * registered unconditionally — a deployment without the credentials namespace
735
+ * still gets the tab — so it cannot read that namespace itself. This
736
+ * module-level snapshot is written by the gated reader and by the detail
737
+ * section's own reads, and the host's `credentials/reference-updated` event
738
+ * refreshes it, so the badge appears (and disappears) the moment a key is saved
739
+ * or removed anywhere, without reopening the tab.
740
+ */
741
+ const ncbiKeyStore = {
742
+ // 'unavailable' until the gated reader publishes a real answer: a deployment
743
+ // with no credentials namespace never gets one, and the badge must not sit on
744
+ // "checking" forever there.
745
+ state: { phase: 'unavailable', configured: false, writable: false, message: '' },
746
+ listeners: new Set(),
747
+ reload: undefined,
748
+ };
749
+
750
+ /** Publish a key snapshot to every mounted surface. */
751
+ function publishNcbiKey(next) {
752
+ ncbiKeyStore.state = next;
753
+ for (const listener of [...ncbiKeyStore.listeners]) listener(next);
754
+ }
755
+
756
+ /** Subscribe a surface to snapshot changes; returns the unsubscribe function. */
757
+ function subscribeNcbiKey(listener) {
758
+ ncbiKeyStore.listeners.add(listener);
759
+ return () => { ncbiKeyStore.listeners.delete(listener); };
760
+ }
761
+
762
+ /** Tone and label for a PubMed-key snapshot (the badge is a plain div). */
763
+ function ncbiKeyView(state) {
764
+ const tone = state.phase === 'ready'
765
+ ? (state.configured ? 'on' : 'off')
766
+ : state.phase === 'pending' ? 'pending' : 'error';
767
+ const label = state.phase === 'ready'
768
+ ? (state.configured
769
+ ? `PubMed API key configured${state.source === undefined ? '' : ` (source: ${state.source})`}`
770
+ : 'PubMed API key not configured in the credential store — environment keys still apply')
771
+ : state.phase === 'pending'
772
+ ? 'Checking the PubMed API key…'
773
+ : 'PubMed API key status unavailable';
774
+ return { tone, label };
775
+ }
776
+
777
+ /**
778
+ * The live PubMed-key snapshot for a panel surface.
779
+ *
780
+ * The detail section's status line only exists while the Plugins page is open;
781
+ * the papers tab shows this instead, so a configured key is visible where the
782
+ * literature work actually happens. It never shows the value — only whether the
783
+ * store reports one configured, and where it came from.
784
+ */
785
+ function useNcbiKeyState() {
786
+ const [state, setState] = useState(ncbiKeyStore.state);
787
+ useEffect(() => {
788
+ const unsubscribe = subscribeNcbiKey(setState);
789
+ // Catch a publish that landed between render and subscribe, and re-read on
790
+ // mount: the tab can be opened long after the gate's first read, and a key
791
+ // may have been added through Settings in the meantime.
792
+ setState(ncbiKeyStore.state);
793
+ if (typeof ncbiKeyStore.reload === 'function') ncbiKeyStore.reload();
794
+ return unsubscribe;
795
+ }, []);
796
+ return state;
797
+ }
798
+
719
799
  const keyStyles = {
720
800
  section: { borderTop: '1px solid rgba(127, 127, 127, 0.28)', marginTop: 16, paddingTop: 12, display: 'grid', gap: 8 },
721
801
  title: { margin: 0, fontSize: 14 },
@@ -724,6 +804,26 @@ const keyStyles = {
724
804
  row: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap' },
725
805
  input: { flex: '1 1 240px', minWidth: 200, padding: '4px 8px' },
726
806
  message: { margin: 0, fontSize: 12 },
807
+ badge: (tone) => ({
808
+ display: 'inline-flex',
809
+ alignItems: 'center',
810
+ gap: '6px',
811
+ margin: '8px 10px 0',
812
+ padding: '3px 8px',
813
+ borderRadius: '10px',
814
+ fontSize: '11px',
815
+ lineHeight: 1.4,
816
+ border: `1px solid ${tone === 'on' ? 'rgba(46, 125, 50, 0.45)' : tone === 'error' ? 'rgba(192, 57, 43, 0.45)' : 'var(--dsh-border, #e3e6ea)'}`,
817
+ background: tone === 'on' ? 'rgba(46, 125, 50, 0.10)' : 'transparent',
818
+ color: 'inherit',
819
+ }),
820
+ badgeDot: (tone) => ({
821
+ width: '7px',
822
+ height: '7px',
823
+ flex: '0 0 7px',
824
+ borderRadius: '50%',
825
+ background: tone === 'on' ? '#2e7d32' : tone === 'error' ? '#c0392b' : tone === 'pending' ? '#b58900' : '#9aa4ad',
826
+ }),
727
827
  };
728
828
 
729
829
  /**
@@ -744,7 +844,14 @@ function NcbiKeySection({ subject, remote }) {
744
844
  useEffect(() => {
745
845
  if (subjectToken === '') return undefined;
746
846
  let live = true;
747
- const load = () => readNcbiKey(remote).then((next) => { if (live) setState(next); });
847
+ // Publishing the read into the shared snapshot is what keeps the papers
848
+ // tab's badge honest: this section can be unmounted and remounted, and the
849
+ // badge must not go stale in between.
850
+ const load = () => readNcbiKey(remote).then((next) => {
851
+ if (!live) return;
852
+ setState(next);
853
+ publishNcbiKey(next);
854
+ });
748
855
  load();
749
856
  // Another surface may rotate or clear the same reference (Settings, the
750
857
  // file watcher); follow the host event instead of showing a stale badge.
@@ -775,13 +882,15 @@ function NcbiKeySection({ subject, remote }) {
775
882
  const failure = remoteFailure(response);
776
883
  setDraft('');
777
884
  const next = await readNcbiKey(remote);
778
- setState(failure !== ''
885
+ const nextState = failure !== ''
779
886
  ? { ...next, phase: 'error', message: failure }
780
887
  : next.phase === 'error'
781
888
  ? next
782
889
  : next.configured === true
783
890
  ? { ...next, message: 'Saved. The next PubMed call uses this key.' }
784
- : { ...next, phase: 'error', message: 'The host accepted the write but still reports no key configured. Restart the profile and try again.' });
891
+ : { ...next, phase: 'error', message: 'The host accepted the write but still reports no key configured. Restart the profile and try again.' };
892
+ setState(nextState);
893
+ publishNcbiKey(nextState);
785
894
  };
786
895
  const remove = async () => {
787
896
  if (remote?.credentials === undefined || typeof remote.credentials.unset !== 'function') {
@@ -797,13 +906,15 @@ function NcbiKeySection({ subject, remote }) {
797
906
  }
798
907
  const failure = remoteFailure(response);
799
908
  const next = await readNcbiKey(remote);
800
- setState(failure !== ''
909
+ const nextState = failure !== ''
801
910
  ? { ...next, phase: 'error', message: failure }
802
911
  : next.phase === 'error'
803
912
  ? next
804
913
  : next.configured === false
805
914
  ? { ...next, message: 'Removed. PubMed search falls back to web search.' }
806
- : { ...next, phase: 'error', message: 'The host still reports a key configured after Remove.' });
915
+ : { ...next, phase: 'error', message: 'The host still reports a key configured after Remove.' };
916
+ setState(nextState);
917
+ publishNcbiKey(nextState);
807
918
  };
808
919
  const status = state.phase === 'loading'
809
920
  ? 'Checking the credential store…'
@@ -816,7 +927,9 @@ function NcbiKeySection({ subject, remote }) {
816
927
  h('h4', { style: keyStyles.title }, 'PubMed API key'),
817
928
  h('p', { style: keyStyles.note },
818
929
  'Stored in the harness credential store. molbio_pubmed_search and molbio_pubmed_abstract use it for the official PubMed E-utilities API; without it they fall back to web search.'),
819
- h('p', { 'data-molbio-key-status': state.phase, style: keyStyles.status }, status),
930
+ h('div', { 'data-molbio-key-status': state.phase, style: { ...keyStyles.badge(ncbiKeyView(state).tone), margin: 0 } },
931
+ h('span', { style: keyStyles.badgeDot(ncbiKeyView(state).tone) }),
932
+ h('span', null, status)),
820
933
  h('div', { style: keyStyles.row },
821
934
  h('input', {
822
935
  type: 'password',
@@ -939,6 +1052,20 @@ function apply(ctx) {
939
1052
  // namespace: the section simply never registers there.
940
1053
  ctx.effect(() => {
941
1054
  const gate = ctx.inject(['remote.credentials'], (keyCtx) => {
1055
+ // Keep the shared badge snapshot current: read once, then follow the host
1056
+ // event a Save/Remove (here or in Settings) emits for this reference.
1057
+ const load = () => readNcbiKey(keyCtx.remote).then(publishNcbiKey);
1058
+ keyCtx.effect(() => {
1059
+ ncbiKeyStore.reload = load;
1060
+ load();
1061
+ const off = typeof keyCtx.remote.$on === 'function'
1062
+ ? keyCtx.remote.$on('credentials/reference-updated', (ref) => { if (ref === NCBI_KEY_REF) load(); })
1063
+ : undefined;
1064
+ return () => {
1065
+ ncbiKeyStore.reload = undefined;
1066
+ if (typeof off === 'function') off();
1067
+ };
1068
+ }, 'molbio panel: NCBI key status');
942
1069
  keyCtx.effect(() => keyCtx.slots.inject('plugins.detail.section', () => keyCtx.slots.register({
943
1070
  name: 'plugins.detail.section',
944
1071
  id: 'molbio-ncbi-key',