dsh-molbio-tools 0.25.1 → 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/lib/client.js CHANGED
@@ -622,7 +622,21 @@ window.__ModuleLoader__.load({
622
622
  * correction on the duplex entropy. An ESTIMATE for primer design: it assumes
623
623
  * a non-self-complementary duplex and standard conditions.
624
624
  */
625
- function primerTm(seq, { naMm = 50, mgMm = 0, dntpMm = 0.8, primerNm = 500 } = {}) {
625
+ /**
626
+ * Full nearest-neighbour thermodynamics of one DNA duplex: enthalpy, entropy,
627
+ * the salt-corrected entropy, ΔG at 37 °C and the melting temperature.
628
+ *
629
+ * The salt/concentration model is the SAME one the primer tools use (von Ahsen
630
+ * et al. (2001) magnesium equivalence, SantaLucia (1998) entropy correction), so
631
+ * a Tm reported here is identical to molbio_primer_tm / molbio_primer_check for
632
+ * the same sequence and conditions. Returned values are unrounded except where
633
+ * noted; callers round for display.
634
+ *
635
+ * @param {string} seq canonical DNA (A/C/G/T), at least 4 bases.
636
+ * @param {{naMm?: number, mgMm?: number, dntpMm?: number, primerNm?: number}} [conditions]
637
+ * @returns {{dh_kcal: number, ds_cal: number, ds_salt_cal: number, delta_g37_kcal: number, tm_celsius: number, na_equivalent_mm: number}}
638
+ */
639
+ function duplexThermodynamics(seq, { naMm = 50, mgMm = 0, dntpMm = 0.8, primerNm = 500 } = {}) {
626
640
  const length = seq.length;
627
641
  if (length < 4) throw new MolbioInputError(`primer must be at least 4 bases for a NN Tm estimate (got ${length})`);
628
642
  const na = Math.max(0, naMm);
@@ -652,8 +666,26 @@ window.__ModuleLoader__.load({
652
666
  const tm = (dh * 1000) / denominator - 273.15;
653
667
  if (!Number.isFinite(tm) || tm <= 0 || tm > 200) throw new MolbioInputError('Tm computation did not converge for this input');
654
668
  return {
655
- tm_celsius: Math.round(tm * 100) / 100,
656
- na_equivalent_mm: Math.round(naEquivalent * 100) / 100,
669
+ dh_kcal: dh,
670
+ ds_cal: ds,
671
+ ds_salt_cal: saltCorrectedDs,
672
+ delta_g37_kcal: deltaG37(dh, saltCorrectedDs),
673
+ tm_celsius: tm,
674
+ na_equivalent_mm: naEquivalent,
675
+ };
676
+ }
677
+
678
+ /**
679
+ * Salt-adjusted nearest-neighbour melting temperature of one primer.
680
+ * Thin rounding wrapper over duplexThermodynamics — the primer tools keep their
681
+ * published output shape, and every value they report comes from the same model
682
+ * molbio_duplex_thermo exposes.
683
+ */
684
+ function primerTm(seq, opts = {}) {
685
+ const { tm_celsius, na_equivalent_mm } = duplexThermodynamics(seq, opts);
686
+ return {
687
+ tm_celsius: Math.round(tm_celsius * 100) / 100,
688
+ na_equivalent_mm: Math.round(na_equivalent_mm * 100) / 100,
657
689
  };
658
690
  }
659
691
 
@@ -1562,6 +1594,7 @@ window.__ModuleLoader__.load({
1562
1594
  exports.enzymeCuts = enzymeCuts;
1563
1595
  exports.enzymeCatalog = enzymeCatalog;
1564
1596
  exports.digest = digest;
1597
+ exports.duplexThermodynamics = duplexThermodynamics;
1565
1598
  exports.primerTm = primerTm;
1566
1599
  exports.findRuns = findRuns;
1567
1600
  exports.findRepeats = findRepeats;
@@ -10213,6 +10246,8 @@ window.__ModuleLoader__.load({
10213
10246
  const [query, setQuery] = useState('');
10214
10247
  const [tag, setTag] = useState('');
10215
10248
  const [selectedId, setSelectedId] = useState(null);
10249
+ const keyState = useNcbiKeyState();
10250
+ const keyView = ncbiKeyView(keyState);
10216
10251
 
10217
10252
  useEffect(() => {
10218
10253
  if (cwd === undefined) {
@@ -10319,6 +10354,14 @@ window.__ModuleLoader__.load({
10319
10354
 
10320
10355
  return h('div', { style: styles.root },
10321
10356
  h('div', { style: styles.side },
10357
+ h('div', {
10358
+ key: 'ncbi-key',
10359
+ 'data-molbio-key-badge': keyView.tone,
10360
+ title: keyState.message === '' ? keyView.label : keyState.message,
10361
+ style: keyStyles.badge(keyView.tone),
10362
+ },
10363
+ h('span', { style: keyStyles.badgeDot(keyView.tone) }),
10364
+ h('span', null, keyView.label)),
10322
10365
  search,
10323
10366
  tagRow,
10324
10367
  list),
@@ -10341,6 +10384,76 @@ window.__ModuleLoader__.load({
10341
10384
  return { phase: 'ready', ...credentialInfo(response, NCBI_KEY_REF), message: '' };
10342
10385
  }
10343
10386
 
10387
+ /**
10388
+ * The last known state of the PubMed key, shared by every surface that shows it.
10389
+ *
10390
+ * The detail section reads the credential store directly because `apply` gates
10391
+ * it behind `ctx.inject(['remote.credentials'])`. The papers tab body is
10392
+ * registered unconditionally — a deployment without the credentials namespace
10393
+ * still gets the tab — so it cannot read that namespace itself. This
10394
+ * module-level snapshot is written by the gated reader and by the detail
10395
+ * section's own reads, and the host's `credentials/reference-updated` event
10396
+ * refreshes it, so the badge appears (and disappears) the moment a key is saved
10397
+ * or removed anywhere, without reopening the tab.
10398
+ */
10399
+ const ncbiKeyStore = {
10400
+ // 'unavailable' until the gated reader publishes a real answer: a deployment
10401
+ // with no credentials namespace never gets one, and the badge must not sit on
10402
+ // "checking" forever there.
10403
+ state: { phase: 'unavailable', configured: false, writable: false, message: '' },
10404
+ listeners: new Set(),
10405
+ reload: undefined,
10406
+ };
10407
+
10408
+ /** Publish a key snapshot to every mounted surface. */
10409
+ function publishNcbiKey(next) {
10410
+ ncbiKeyStore.state = next;
10411
+ for (const listener of [...ncbiKeyStore.listeners]) listener(next);
10412
+ }
10413
+
10414
+ /** Subscribe a surface to snapshot changes; returns the unsubscribe function. */
10415
+ function subscribeNcbiKey(listener) {
10416
+ ncbiKeyStore.listeners.add(listener);
10417
+ return () => { ncbiKeyStore.listeners.delete(listener); };
10418
+ }
10419
+
10420
+ /** Tone and label for a PubMed-key snapshot (the badge is a plain div). */
10421
+ function ncbiKeyView(state) {
10422
+ const tone = state.phase === 'ready'
10423
+ ? (state.configured ? 'on' : 'off')
10424
+ : state.phase === 'pending' ? 'pending' : 'error';
10425
+ const label = state.phase === 'ready'
10426
+ ? (state.configured
10427
+ ? `PubMed API key configured${state.source === undefined ? '' : ` (source: ${state.source})`}`
10428
+ : 'PubMed API key not configured in the credential store — environment keys still apply')
10429
+ : state.phase === 'pending'
10430
+ ? 'Checking the PubMed API key…'
10431
+ : 'PubMed API key status unavailable';
10432
+ return { tone, label };
10433
+ }
10434
+
10435
+ /**
10436
+ * The live PubMed-key snapshot for a panel surface.
10437
+ *
10438
+ * The detail section's status line only exists while the Plugins page is open;
10439
+ * the papers tab shows this instead, so a configured key is visible where the
10440
+ * literature work actually happens. It never shows the value — only whether the
10441
+ * store reports one configured, and where it came from.
10442
+ */
10443
+ function useNcbiKeyState() {
10444
+ const [state, setState] = useState(ncbiKeyStore.state);
10445
+ useEffect(() => {
10446
+ const unsubscribe = subscribeNcbiKey(setState);
10447
+ // Catch a publish that landed between render and subscribe, and re-read on
10448
+ // mount: the tab can be opened long after the gate's first read, and a key
10449
+ // may have been added through Settings in the meantime.
10450
+ setState(ncbiKeyStore.state);
10451
+ if (typeof ncbiKeyStore.reload === 'function') ncbiKeyStore.reload();
10452
+ return unsubscribe;
10453
+ }, []);
10454
+ return state;
10455
+ }
10456
+
10344
10457
  const keyStyles = {
10345
10458
  section: { borderTop: '1px solid rgba(127, 127, 127, 0.28)', marginTop: 16, paddingTop: 12, display: 'grid', gap: 8 },
10346
10459
  title: { margin: 0, fontSize: 14 },
@@ -10349,6 +10462,26 @@ window.__ModuleLoader__.load({
10349
10462
  row: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap' },
10350
10463
  input: { flex: '1 1 240px', minWidth: 200, padding: '4px 8px' },
10351
10464
  message: { margin: 0, fontSize: 12 },
10465
+ badge: (tone) => ({
10466
+ display: 'inline-flex',
10467
+ alignItems: 'center',
10468
+ gap: '6px',
10469
+ margin: '8px 10px 0',
10470
+ padding: '3px 8px',
10471
+ borderRadius: '10px',
10472
+ fontSize: '11px',
10473
+ lineHeight: 1.4,
10474
+ border: `1px solid ${tone === 'on' ? 'rgba(46, 125, 50, 0.45)' : tone === 'error' ? 'rgba(192, 57, 43, 0.45)' : 'var(--dsh-border, #e3e6ea)'}`,
10475
+ background: tone === 'on' ? 'rgba(46, 125, 50, 0.10)' : 'transparent',
10476
+ color: 'inherit',
10477
+ }),
10478
+ badgeDot: (tone) => ({
10479
+ width: '7px',
10480
+ height: '7px',
10481
+ flex: '0 0 7px',
10482
+ borderRadius: '50%',
10483
+ background: tone === 'on' ? '#2e7d32' : tone === 'error' ? '#c0392b' : tone === 'pending' ? '#b58900' : '#9aa4ad',
10484
+ }),
10352
10485
  };
10353
10486
 
10354
10487
  /**
@@ -10369,7 +10502,14 @@ window.__ModuleLoader__.load({
10369
10502
  useEffect(() => {
10370
10503
  if (subjectToken === '') return undefined;
10371
10504
  let live = true;
10372
- const load = () => readNcbiKey(remote).then((next) => { if (live) setState(next); });
10505
+ // Publishing the read into the shared snapshot is what keeps the papers
10506
+ // tab's badge honest: this section can be unmounted and remounted, and the
10507
+ // badge must not go stale in between.
10508
+ const load = () => readNcbiKey(remote).then((next) => {
10509
+ if (!live) return;
10510
+ setState(next);
10511
+ publishNcbiKey(next);
10512
+ });
10373
10513
  load();
10374
10514
  // Another surface may rotate or clear the same reference (Settings, the
10375
10515
  // file watcher); follow the host event instead of showing a stale badge.
@@ -10400,13 +10540,15 @@ window.__ModuleLoader__.load({
10400
10540
  const failure = remoteFailure(response);
10401
10541
  setDraft('');
10402
10542
  const next = await readNcbiKey(remote);
10403
- setState(failure !== ''
10543
+ const nextState = failure !== ''
10404
10544
  ? { ...next, phase: 'error', message: failure }
10405
10545
  : next.phase === 'error'
10406
10546
  ? next
10407
10547
  : next.configured === true
10408
10548
  ? { ...next, message: 'Saved. The next PubMed call uses this key.' }
10409
- : { ...next, phase: 'error', message: 'The host accepted the write but still reports no key configured. Restart the profile and try again.' });
10549
+ : { ...next, phase: 'error', message: 'The host accepted the write but still reports no key configured. Restart the profile and try again.' };
10550
+ setState(nextState);
10551
+ publishNcbiKey(nextState);
10410
10552
  };
10411
10553
  const remove = async () => {
10412
10554
  if (remote?.credentials === undefined || typeof remote.credentials.unset !== 'function') {
@@ -10422,13 +10564,15 @@ window.__ModuleLoader__.load({
10422
10564
  }
10423
10565
  const failure = remoteFailure(response);
10424
10566
  const next = await readNcbiKey(remote);
10425
- setState(failure !== ''
10567
+ const nextState = failure !== ''
10426
10568
  ? { ...next, phase: 'error', message: failure }
10427
10569
  : next.phase === 'error'
10428
10570
  ? next
10429
10571
  : next.configured === false
10430
10572
  ? { ...next, message: 'Removed. PubMed search falls back to web search.' }
10431
- : { ...next, phase: 'error', message: 'The host still reports a key configured after Remove.' });
10573
+ : { ...next, phase: 'error', message: 'The host still reports a key configured after Remove.' };
10574
+ setState(nextState);
10575
+ publishNcbiKey(nextState);
10432
10576
  };
10433
10577
  const status = state.phase === 'loading'
10434
10578
  ? 'Checking the credential store…'
@@ -10441,7 +10585,9 @@ window.__ModuleLoader__.load({
10441
10585
  h('h4', { style: keyStyles.title }, 'PubMed API key'),
10442
10586
  h('p', { style: keyStyles.note },
10443
10587
  '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.'),
10444
- h('p', { 'data-molbio-key-status': state.phase, style: keyStyles.status }, status),
10588
+ h('div', { 'data-molbio-key-status': state.phase, style: { ...keyStyles.badge(ncbiKeyView(state).tone), margin: 0 } },
10589
+ h('span', { style: keyStyles.badgeDot(ncbiKeyView(state).tone) }),
10590
+ h('span', null, status)),
10445
10591
  h('div', { style: keyStyles.row },
10446
10592
  h('input', {
10447
10593
  type: 'password',
@@ -10564,6 +10710,20 @@ window.__ModuleLoader__.load({
10564
10710
  // namespace: the section simply never registers there.
10565
10711
  ctx.effect(() => {
10566
10712
  const gate = ctx.inject(['remote.credentials'], (keyCtx) => {
10713
+ // Keep the shared badge snapshot current: read once, then follow the host
10714
+ // event a Save/Remove (here or in Settings) emits for this reference.
10715
+ const load = () => readNcbiKey(keyCtx.remote).then(publishNcbiKey);
10716
+ keyCtx.effect(() => {
10717
+ ncbiKeyStore.reload = load;
10718
+ load();
10719
+ const off = typeof keyCtx.remote.$on === 'function'
10720
+ ? keyCtx.remote.$on('credentials/reference-updated', (ref) => { if (ref === NCBI_KEY_REF) load(); })
10721
+ : undefined;
10722
+ return () => {
10723
+ ncbiKeyStore.reload = undefined;
10724
+ if (typeof off === 'function') off();
10725
+ };
10726
+ }, 'molbio panel: NCBI key status');
10567
10727
  keyCtx.effect(() => keyCtx.slots.inject('plugins.detail.section', () => keyCtx.slots.register({
10568
10728
  name: 'plugins.detail.section',
10569
10729
  id: 'molbio-ncbi-key',
package/lib.mjs CHANGED
@@ -601,7 +601,21 @@ for (const pair of Object.keys(NN_DH)) {
601
601
  * correction on the duplex entropy. An ESTIMATE for primer design: it assumes
602
602
  * a non-self-complementary duplex and standard conditions.
603
603
  */
604
- export function primerTm(seq, { naMm = 50, mgMm = 0, dntpMm = 0.8, primerNm = 500 } = {}) {
604
+ /**
605
+ * Full nearest-neighbour thermodynamics of one DNA duplex: enthalpy, entropy,
606
+ * the salt-corrected entropy, ΔG at 37 °C and the melting temperature.
607
+ *
608
+ * The salt/concentration model is the SAME one the primer tools use (von Ahsen
609
+ * et al. (2001) magnesium equivalence, SantaLucia (1998) entropy correction), so
610
+ * a Tm reported here is identical to molbio_primer_tm / molbio_primer_check for
611
+ * the same sequence and conditions. Returned values are unrounded except where
612
+ * noted; callers round for display.
613
+ *
614
+ * @param {string} seq canonical DNA (A/C/G/T), at least 4 bases.
615
+ * @param {{naMm?: number, mgMm?: number, dntpMm?: number, primerNm?: number}} [conditions]
616
+ * @returns {{dh_kcal: number, ds_cal: number, ds_salt_cal: number, delta_g37_kcal: number, tm_celsius: number, na_equivalent_mm: number}}
617
+ */
618
+ export function duplexThermodynamics(seq, { naMm = 50, mgMm = 0, dntpMm = 0.8, primerNm = 500 } = {}) {
605
619
  const length = seq.length;
606
620
  if (length < 4) throw new MolbioInputError(`primer must be at least 4 bases for a NN Tm estimate (got ${length})`);
607
621
  const na = Math.max(0, naMm);
@@ -631,8 +645,26 @@ export function primerTm(seq, { naMm = 50, mgMm = 0, dntpMm = 0.8, primerNm = 50
631
645
  const tm = (dh * 1000) / denominator - 273.15;
632
646
  if (!Number.isFinite(tm) || tm <= 0 || tm > 200) throw new MolbioInputError('Tm computation did not converge for this input');
633
647
  return {
634
- tm_celsius: Math.round(tm * 100) / 100,
635
- na_equivalent_mm: Math.round(naEquivalent * 100) / 100,
648
+ dh_kcal: dh,
649
+ ds_cal: ds,
650
+ ds_salt_cal: saltCorrectedDs,
651
+ delta_g37_kcal: deltaG37(dh, saltCorrectedDs),
652
+ tm_celsius: tm,
653
+ na_equivalent_mm: naEquivalent,
654
+ };
655
+ }
656
+
657
+ /**
658
+ * Salt-adjusted nearest-neighbour melting temperature of one primer.
659
+ * Thin rounding wrapper over duplexThermodynamics — the primer tools keep their
660
+ * published output shape, and every value they report comes from the same model
661
+ * molbio_duplex_thermo exposes.
662
+ */
663
+ export function primerTm(seq, opts = {}) {
664
+ const { tm_celsius, na_equivalent_mm } = duplexThermodynamics(seq, opts);
665
+ return {
666
+ tm_celsius: Math.round(tm_celsius * 100) / 100,
667
+ na_equivalent_mm: Math.round(na_equivalent_mm * 100) / 100,
636
668
  };
637
669
  }
638
670
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-molbio-tools",
3
- "version": "0.25.1",
4
- "description": "Zero-dependency molecular-biology plugin bundle for the DeepSeek Harness: sequence analysis, primer design (incl. cross-intron qPCR primers, TaqMan hydrolysis/MGB probes with ordering CSV and multiplex compatibility), in-silico PCR, cloning simulation, SnapGene .dna parsing and plasmid maps, Sanger verification, protein tools (incl. helical wheel, hydropathy and charge-pH plots), methylation-aware restriction analysis with double-digest buffer checks, qPCR analysis and plotting, multiple sequence alignment that conserves every input residue, conservation analysis, sequence logos, codon-usage analysis, phylogenetic trees with bootstrap support, Newick I/O and long-name label wrapping, CpG-island/GC-skew composition analysis, k-mer dotplots, read-level FASTQ QC, vector/adapter contamination screening, FASTQ trimming/filtering, batch file analysis with CSV export, silent restriction-site mutagenesis, family-aware CRISPR gRNA design (SpCas9/SaCas9/Cas12a/Cas13) with off-target search, an opt-in hand-off that shows a generated plot to the model as an attached image, plus a browser-side right-sidebar panel (plasmid maps, sequence logos, and a rotatable realistic 3D ball-and-stick/space-filling preview of PDB/mmCIF/SDF structures drawn in the Web GUI) and a literature/protocol/experiment record system.",
3
+ "version": "0.27.0",
4
+ "description": "Zero-dependency molecular-biology plugin bundle for the DeepSeek Harness: sequence analysis, primer design (incl. cross-intron qPCR primers, TaqMan hydrolysis/MGB probes with ordering CSV and multiplex compatibility, duplex thermodynamics (ΔH/ΔS/ΔG37/Tm with hairpin and dimer checks)), in-silico PCR, cloning simulation, SnapGene .dna parsing and plasmid maps, Sanger verification, protein tools (incl. helical wheel, hydropathy and charge-pH plots), methylation-aware restriction analysis with double-digest buffer checks, qPCR analysis and plotting, multiple sequence alignment that conserves every input residue, conservation analysis, sequence logos, codon-usage analysis, phylogenetic trees with bootstrap support, Newick I/O and long-name label wrapping, CpG-island/GC-skew composition analysis, k-mer dotplots, read-level FASTQ QC, vector/adapter contamination screening, FASTQ trimming/filtering, batch file analysis with CSV export, silent restriction-site mutagenesis, family-aware CRISPR gRNA design (SpCas9/SaCas9/Cas12a/Cas13) with off-target search, an opt-in hand-off that shows a generated plot to the model as an attached image, plus a browser-side right-sidebar panel (plasmid maps, sequence logos, and a rotatable realistic 3D ball-and-stick/space-filling preview of PDB/mmCIF/SDF structures drawn in the Web GUI) and a literature/protocol/experiment record system.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
7
7
  "engines": {
@@ -45,6 +45,7 @@
45
45
  "files": [
46
46
  "index.mjs",
47
47
  "lib.mjs",
48
+ "thermo.mjs",
48
49
  "design.mjs",
49
50
  "genbank.mjs",
50
51
  "plasmid.mjs",
@@ -106,7 +107,10 @@
106
107
  "0.2.1-rc.4": "unknown",
107
108
  "0.2.1-rc.5": "compatible",
108
109
  "0.2.2-rc.1": "compatible",
109
- "0.2.2-rc.2": "compatible"
110
+ "0.2.2-rc.2": "compatible",
111
+ "0.2.2-rc.3": "compatible",
112
+ "0.2.2-rc.4": "unknown",
113
+ "0.2.2-rc.5": "compatible"
110
114
  }
111
115
  },
112
116
  "bundle": {
@@ -48,12 +48,13 @@
48
48
  # list carries no comments of its own, so none appear below; provenance and the
49
49
  # upgrade rules live in this header.
50
50
  #
51
- # Baseline: the `standard` preset of dsh 0.2.2-rc.2 (the installed desktop
51
+ # Baseline: the `standard` preset of dsh 0.2.2-rc.5 (the installed desktop
52
52
  # runtime, `resources/app.asar` →
53
53
  # `dsh/node_modules/@deepseek-ai/dsh-web-app/presets/standard.patch.yml`,
54
54
  # 7286 B, sha256 e40bb192…; rows live under the `preset-standard` row's
55
- # `config.plugins:`). 0.2.2-rc.2 changed the preset in exactly three places,
56
- # all absorbed verbatim below: a new `tool-office` row
55
+ # `config.plugins:`). rc.4 and rc.5 ship it byte-identical to rc.3 / rc.2, and
56
+ # rc.2 changed the preset in exactly three places, all absorbed verbatim below: a new
57
+ # `tool-office` row
57
58
  # (`@deepseek-ai/dsh-tool-office`), `customSkillDirs` on `skill-filesystem`
58
59
  # (the shipped `@deepseek-ai/dsh-agent-preset/skills` directory), and
59
60
  # `interrupt: false` on `tool-subagent-control`.
@@ -1,2 +1,2 @@
1
1
  name: Molecular Biology Lab
2
- description: 分子生物学专属模式:标准编码能力 + 64 个 molbio_* 工具(序列分析、引物设计(含跨内含子 qPCR、盐/浓度旋钮与目标位置偏好)、TaqMan 水解探针(含 MGB 与订购 CSV)与多重 PCR 互扰/退火温度/浓度建议、克隆模拟与选酶(含 Golden Gate)、酶目录查询、甲基化敏感位点与双酶切 buffer 兼容检查、多序列比对(每个输入残基都会进比对结果)、保守性分析与比对后处理(共识/缺口修剪/同一性矩阵/逐列覆盖度,含 sequence logo 图)、CRISPR gRNA 设计(SpCas9/SaCas9/Cas12a/Cas13,家族特定 PAM/PFS/种子)与脱靶搜索、SnapGene/GenBank 解析与质粒图谱、Sanger 测序验证、蛋白性质/电荷-pH 曲线/密码子优化/螺旋轮投影与疏水性图、qPCR 与绘图、虚拟凝胶、实验台分析(FASTQ 质控、密码子使用、系统发生树(长叶名自动折行)、in-silico PCR、CpG/GC 组成、序列 dotplot、载体/接头污染筛查、FASTQ 修剪/过滤、批量文件分析/CSV)、静默酶切位点突变设计——生成的 SVG 图片自动用系统默认应用打开,文献/协议/实验记录)。
2
+ description: 分子生物学专属模式:标准编码能力 + 65 个 molbio_* 工具(序列分析、引物设计(含跨内含子 qPCR、盐/浓度旋钮与目标位置偏好)、TaqMan 水解探针(含 MGB 与订购 CSV)与多重 PCR 互扰/退火温度/浓度建议、克隆模拟与选酶(含 Golden Gate)、酶目录查询、甲基化敏感位点与双酶切 buffer 兼容检查、多序列比对(每个输入残基都会进比对结果)、保守性分析与比对后处理(共识/缺口修剪/同一性矩阵/逐列覆盖度,含 sequence logo 图)、CRISPR gRNA 设计(SpCas9/SaCas9/Cas12a/Cas13,家族特定 PAM/PFS/种子)与脱靶搜索、SnapGene/GenBank 解析与质粒图谱、Sanger 测序验证、蛋白性质/电荷-pH 曲线/密码子优化/螺旋轮投影与疏水性图、qPCR 与绘图、虚拟凝胶、实验台分析(FASTQ 质控、密码子使用、系统发生树(长叶名自动折行)、in-silico PCR、CpG/GC 组成、序列 dotplot、载体/接头污染筛查、FASTQ 修剪/过滤、批量文件分析/CSV)、静默酶切位点突变设计——生成的 SVG 图片自动用系统默认应用打开,文献/协议/实验记录)。
package/test/client.mjs CHANGED
@@ -156,6 +156,7 @@ assert.deepEqual(effects, [
156
156
  'molbio panel: molbio_sequence_logo card',
157
157
  'molbio panel: molbio_grna_design card',
158
158
  'molbio panel: NCBI key section gate',
159
+ 'molbio panel: NCBI key status',
159
160
  'molbio panel: NCBI key section',
160
161
  ]);
161
162
  assert.deepEqual(injectedDeps, [['remote.credentials']], 'the key section waits for the credentials Remote namespace');
@@ -25,11 +25,11 @@
25
25
  * Usage: node test/drift-probe.mjs [--dsh <harness root>]
26
26
  */
27
27
  import assert from 'node:assert/strict';
28
- import { existsSync } from 'node:fs';
28
+ import { existsSync, readFileSync } from 'node:fs';
29
29
  import { dirname, join, resolve } from 'node:path';
30
30
  import { fileURLToPath } from 'node:url';
31
31
 
32
- import { compositionDrift, toolCountDrift, presetPlugins, asPresetPatch, relativeSpecifiers, presetOrderDeclared, orderCollisions, specifierProblem } from './preset-health.mjs';
32
+ import { compositionDrift, toolCountDrift, presetPlugins, asPresetPatch, relativeSpecifiers, presetOrderDeclared, orderCollisions, specifierProblem, compatibilityProblems } from './preset-health.mjs';
33
33
  // The three helpers this probe used to carry its own copies of. Duplicating
34
34
  // `findHarnessRoot` was the worst of them: the probe could resolve a DIFFERENT
35
35
  // harness than `preset-health` validated against, so a mutation experiment could
@@ -253,6 +253,28 @@ check('an order collision with a shipped preset is caught, a free number is not'
253
253
  assert.match(collision[0], /order 2 is already taken by the shipped preset "ptc" \(ptc\.patch\.yml\)/, collision[0]);
254
254
  });
255
255
 
256
+ check('a manifest that does not declare the installed harness is caught', () => {
257
+ const version = JSON.parse(readFileSync(join(harnessRoot, 'package.json'), 'utf8')).version;
258
+ const real = JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8'));
259
+ const panel = JSON.parse(readFileSync(join(repoRoot, 'packages', 'molbio-panel', 'package.json'), 'utf8'));
260
+ assert.deepEqual(compatibilityProblems([real, panel], version), [], 'the shipped manifests declare the harness under test');
261
+ const absent = JSON.parse(JSON.stringify(real));
262
+ delete absent.dsh.compatibility.dshReleases[version];
263
+ assert.match(compatibilityProblems([absent], version).join('\n'), /declares dsh \S+ as absent/);
264
+ });
265
+
266
+ check('a manifest that downgrades the installed harness to unknown is caught', () => {
267
+ const version = JSON.parse(readFileSync(join(harnessRoot, 'package.json'), 'utf8')).version;
268
+ const real = JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8'));
269
+ const downgraded = JSON.parse(JSON.stringify(real));
270
+ downgraded.dsh.compatibility.dshReleases[version] = 'unknown';
271
+ assert.match(compatibilityProblems([downgraded], version).join('\n'), /as "unknown"/);
272
+ // A manifest from another package (the panel) is checked independently.
273
+ const panel = JSON.parse(readFileSync(join(repoRoot, 'packages', 'molbio-panel', 'package.json'), 'utf8'));
274
+ panel.dsh.compatibility.dshReleases[version] = 'compatible';
275
+ assert.deepEqual(compatibilityProblems([panel], version), []);
276
+ });
277
+
256
278
  console.log('');
257
279
  if (failed > 0) {
258
280
  console.error(`drift-probe FAILED: ${failed} check(s) — the preset drift guard is not doing its job`);
@@ -739,6 +739,42 @@ const library = {
739
739
  harness.unmount();
740
740
  }
741
741
 
742
+ // ── the persistent PubMed-key badge in the papers tab ──────────────────────
743
+
744
+ {
745
+ // A key present in the store: read it once through the detail section (that
746
+ // read publishes the shared snapshot), then open the papers tab. The badge
747
+ // must be there without reopening Plugins, and must never show the value.
748
+ const claim = slots.registrations.find((entry) => entry.registration.name === 'plugins.detail.section');
749
+ const subject = { kind: 'bundle', pkg: { name: 'dsh-molbio-tools' } };
750
+ const configured = {
751
+ async describe() {
752
+ return { ok: true, value: { NCBI_API_KEY: { configured: true, writable: true, source: 'file' } } };
753
+ },
754
+ };
755
+ // The tab's own mount re-reads through the gate's reload, so the injected
756
+ // Remote has to answer the same way as the snapshot published below.
757
+ ctx.remote.credentials = configured;
758
+ const wrapper = claim.component({ subject, remote: configured });
759
+ const sectionHarness = mount(wrapper.type);
760
+ globalThis.__molbioTestHooks = sectionHarness;
761
+ sectionHarness.setProps({ subject, remote: configured });
762
+ await sectionHarness.render();
763
+ await flush();
764
+ sectionHarness.unmount();
765
+
766
+ const files = remote({ [`${CWD}/${DEFAULT_LIBRARY_FILE}`]: JSON.stringify(library) });
767
+ globalThis.__molbioTestHooks = mount(PapersPanel);
768
+ const harness = globalThis.__molbioTestHooks;
769
+ harness.setProps({ sessionId: SESSION, remote: files, useSessions });
770
+ await harness.render();
771
+ const badge = elements(harness.tree, 'div').find((node) => node.props?.['data-molbio-key-badge'] !== undefined);
772
+ assert.ok(badge !== undefined, 'the papers tab carries a persistent PubMed key badge');
773
+ assert.equal(badge.props['data-molbio-key-badge'], 'on', 'a configured key turns the badge on');
774
+ assert.match(texts(badge).join(''), /PubMed API key configured \(source: file\)/, 'the badge names the state and its source, never the value');
775
+ harness.unmount();
776
+ }
777
+
742
778
  // ── effects are disposed on unmount ─────────────────────────────────────────
743
779
 
744
780
  {
@@ -400,6 +400,17 @@ async function main() {
400
400
  const packages = packagesDir(harnessRoot);
401
401
  const version = JSON.parse(await readFile(join(harnessRoot, 'package.json'), 'utf8')).version;
402
402
  console.log(`harness : ${harnessRoot} (dsh ${version})`);
403
+ // The DECLARATION must follow the harness this run actually used. Nothing
404
+ // else in the suite reads `dshReleases`, so a harness bump the manifests
405
+ // never record is silent: every guard is green while the store still calls
406
+ // the build `unknown` (0.25.2).
407
+ const declaredProblems = compatibilityProblems(
408
+ [
409
+ JSON.parse(await readFile(join(repoRoot, 'package.json'), 'utf8')),
410
+ JSON.parse(await readFile(join(repoRoot, 'packages', 'molbio-panel', 'package.json'), 'utf8')),
411
+ ],
412
+ version,
413
+ );
403
414
  console.log(`composition: ${composition}`);
404
415
 
405
416
  const rows = flattenRows(presetPlugins(await readComposition(composition, harnessRoot)));
@@ -527,7 +538,7 @@ async function main() {
527
538
  }
528
539
  }
529
540
 
530
- if (failures.length > 0 || drift.length > 0 || relativeRows.length > 0 || countDrift.length > 0 || orderDrift.length > 0) {
541
+ if (failures.length > 0 || drift.length > 0 || relativeRows.length > 0 || countDrift.length > 0 || orderDrift.length > 0 || declaredProblems.length > 0) {
531
542
  if (failures.length > 0) {
532
543
  console.error(`preset-health FAILED: ${failures.length} row(s) cannot mount on dsh ${version}`);
533
544
  for (const failure of failures) console.error(` - ${failure.id} [${failure.status}]: ${failure.detail}`);
@@ -545,13 +556,46 @@ async function main() {
545
556
  console.error(`preset-health FAILED: ${orderDrift.length} preset order collision(s) with a shipped preset`);
546
557
  for (const line of orderDrift) console.error(` - ${line}`);
547
558
  }
559
+ if (declaredProblems.length > 0) {
560
+ console.error(`preset-health FAILED: ${declaredProblems.length} package manifest(s) do not declare dsh ${version} compatible`);
561
+ for (const problem of declaredProblems) console.error(` - ${problem}`);
562
+ }
548
563
  process.exit(1);
549
564
  }
550
- console.log(`preset-health OK: all ${rows.length} rows load on dsh ${version}, and the preset is the shipped standard plus the molbio rows`);
565
+ console.log(`preset-health OK: all ${rows.length} rows load on dsh ${version}, the preset is the shipped standard plus the molbio rows, and both manifests declare that version compatible`);
551
566
  console.log(`specifier OK: the preset names the package (${selfName}), so Node resolves it from the profile — no copied directory to keep in sync`);
552
567
  console.log(`order OK: ${ownOrder} collides with no shipped preset`);
553
568
  }
554
569
 
570
+ /**
571
+ * The declared compatibility of EVERY package manifest for the harness a run
572
+ * actually used.
573
+ *
574
+ * `engines.dsh` says "this range may work"; `dsh.compatibility.dshReleases`
575
+ * says "this exact build was run". The store reads the second one, and nothing
576
+ * else in this suite reads it — so a harness bump that the manifests never
577
+ * record is silent: the guards are green while the store still calls the
578
+ * build `unknown`, or omits it. 0.25.2 makes the declaration part of
579
+ * `preset-health`, which already knows which harness it validated.
580
+ *
581
+ * Exported so `test/drift-probe.mjs` can drive it with a mutated manifest —
582
+ * rules.md rule 9: a guard nobody has seen fail is not a guard.
583
+ *
584
+ * @param {object[]} manifests parsed `package.json` documents.
585
+ * @param {string} version the installed harness version.
586
+ * @returns {string[]} one line per manifest that does not say `compatible`.
587
+ */
588
+ export function compatibilityProblems(manifests, version) {
589
+ const problems = [];
590
+ for (const manifest of manifests) {
591
+ const state = manifest?.dsh?.compatibility?.dshReleases?.[version];
592
+ if (state !== 'compatible') {
593
+ problems.push(`${manifest?.name ?? '(unnamed manifest)'} declares dsh ${version} as ${state === undefined ? 'absent' : JSON.stringify(state)}`);
594
+ }
595
+ }
596
+ return problems;
597
+ }
598
+
555
599
  /**
556
600
  * Relative plugin specifiers in a composition.
557
601
  *
package/test/smoke.mjs CHANGED
@@ -4554,6 +4554,53 @@ if (savedNcbiEnv.MOLBIO_NCBI_API_KEY !== undefined) process.env.MOLBIO_NCBI_API_
4554
4554
  await assert.rejects(() => run('molbio_fastq_trim', { path: at('trim-in.fq'), output_path: at('x.fq'), adapter: 'ACGTX' }), /invalid/);
4555
4555
  }
4556
4556
 
4557
+ // ── duplex thermodynamics (survey #9) ──────────────────────────────────────
4558
+
4559
+ {
4560
+ const seq = 'GTAAAACGACGGCCAGTGCC';
4561
+ const thermo = await run('molbio_duplex_thermo', { sequence: seq });
4562
+ assert.equal(thermo.length, 20);
4563
+ assert.equal(thermo.gc_percent, 60);
4564
+ assert.equal(
4565
+ thermo.duplex.tm_celsius,
4566
+ lib.primerTm(seq, { naMm: 50, mgMm: 1.5, dntpMm: 0.8, primerNm: 250 }).tm_celsius,
4567
+ 'molbio_duplex_thermo and molbio_primer_tm agree on the same sequence and conditions',
4568
+ );
4569
+ assert.ok(thermo.duplex.delta_g37_kcal < 0, 'a stable duplex has a negative ΔG°37');
4570
+ assert.ok(thermo.duplex.delta_h_kcal < 0);
4571
+ assert.ok(thermo.duplex.delta_s_salt_cal < thermo.duplex.delta_s_cal, 'the salt correction lowers the entropy');
4572
+ assert.equal(thermo.model, 'santalucia-1998-nn');
4573
+ assert.deepEqual(
4574
+ Object.keys(thermo.conditions).sort(),
4575
+ ['dntp_mm', 'mg_mm', 'na_equivalent_mm', 'na_mm', 'oligo_nm'],
4576
+ );
4577
+ assert.ok(Array.isArray(thermo.hairpins));
4578
+ assert.equal(thermo.dimers.homodimer_any_tm, 0);
4579
+ assert.equal(thermo.dimers.heterodimer_any_tm, undefined, 'no heterodimer fields without a partner');
4580
+
4581
+ // An exact reverse complement enables the heterodimer check.
4582
+ const partner = reverseComplementOf(seq);
4583
+ const paired = await run('molbio_duplex_thermo', { sequence: seq, partner });
4584
+ assert.equal(paired.partner, partner);
4585
+ assert.ok(paired.dimers.heterodimer_any_tm > 0);
4586
+
4587
+ // A mismatched partner is REFUSED (no Watson–Crick estimate for it).
4588
+ await assert.rejects(
4589
+ () => run('molbio_duplex_thermo', { sequence: seq, partner: 'A'.repeat(20) }),
4590
+ /not the reverse complement/,
4591
+ );
4592
+ await assert.rejects(() => run('molbio_duplex_thermo', { sequence: 'ACGTNACGT' }), /A\/C\/G\/T/);
4593
+ await assert.rejects(() => run('molbio_duplex_thermo', { sequence: seq, hairpins: 11 }), /hairpins/);
4594
+ await assert.rejects(() => run('molbio_duplex_thermo', { sequence: seq, na_mm: -1 }), /na_mm/);
4595
+
4596
+ // The rendered projection carries the values a user asked for.
4597
+ const tool = registered.find((entry) => entry.name === 'molbio_duplex_thermo');
4598
+ const text = tool.output.render({}, thermo)[0].text;
4599
+ assert.match(text, /Tm 63\.92 °C/);
4600
+ assert.match(text, /ΔG°37 -23\.17 kcal\/mol/);
4601
+ assert.match(text, /dimers: homodimer Tm any/);
4602
+ }
4603
+
4557
4604
  // ── plugin surface ──────────────────────────────────────────────────────────
4558
4605
 
4559
4606
  assert.equal(plugin.name, 'dsh-molbio-tools');