@kernel.chat/kbot 3.48.0 → 3.49.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.
@@ -0,0 +1,926 @@
1
+ // kbot Frontier Science Lab — Tools born from this week's breakthroughs
2
+ // March 2026: lab-grown organs, 130% solar, engineered bee yeast,
3
+ // CERN Ξcc⁺, Masripithecus fossil ape, Jupiter mega-lightning.
4
+ //
5
+ // Tools:
6
+ // tissue_engineer — scaffold design, cell growth, biocompatibility
7
+ // solar_cell_model — photovoltaic efficiency, singlet fission, tandem cells
8
+ // synbio_design — codon optimization, gene circuits, metabolic pathways
9
+ // phylo_tree — phylogenetics, divergence dating, ancestral reconstruction
10
+ // planetary_atmo — atmospheric modeling, storm energetics, composition
11
+ // frontier_news — latest frontier science discoveries + kbot tool mapping
12
+ import { registerTool } from './index.js';
13
+ const BIOMATERIALS = [
14
+ { name: 'Collagen Type I', type: 'natural', porosity: [70, 95], degradationMonths: [1, 6], tensileStrengthMPa: [1, 10], biocompatibility: 0.95, cellAdhesion: 0.92, applications: ['skin', 'bone', 'cartilage', 'vascular', 'oesophagus'] },
15
+ { name: 'Fibrin', type: 'natural', porosity: [80, 98], degradationMonths: [0.5, 2], tensileStrengthMPa: [0.1, 0.5], biocompatibility: 0.98, cellAdhesion: 0.90, applications: ['wound healing', 'nerve', 'cardiac'] },
16
+ { name: 'Decellularized ECM', type: 'natural', porosity: [60, 90], degradationMonths: [2, 12], tensileStrengthMPa: [2, 15], biocompatibility: 0.93, cellAdhesion: 0.95, applications: ['oesophagus', 'trachea', 'bladder', 'heart valve'] },
17
+ { name: 'Alginate', type: 'natural', porosity: [85, 99], degradationMonths: [1, 6], tensileStrengthMPa: [0.05, 0.3], biocompatibility: 0.90, cellAdhesion: 0.40, applications: ['cartilage', 'liver', 'pancreas', 'wound'] },
18
+ { name: 'Chitosan', type: 'natural', porosity: [70, 95], degradationMonths: [2, 8], tensileStrengthMPa: [1, 8], biocompatibility: 0.88, cellAdhesion: 0.75, applications: ['bone', 'cartilage', 'skin', 'nerve'] },
19
+ { name: 'Silk Fibroin', type: 'natural', porosity: [60, 95], degradationMonths: [3, 24], tensileStrengthMPa: [5, 20], biocompatibility: 0.92, cellAdhesion: 0.82, applications: ['bone', 'ligament', 'skin', 'vascular'] },
20
+ { name: 'PLA (Polylactic Acid)', type: 'synthetic', porosity: [50, 90], degradationMonths: [12, 36], tensileStrengthMPa: [30, 80], biocompatibility: 0.85, cellAdhesion: 0.55, applications: ['bone', 'sutures', 'drug delivery'] },
21
+ { name: 'PCL (Polycaprolactone)', type: 'synthetic', porosity: [40, 85], degradationMonths: [24, 48], tensileStrengthMPa: [10, 40], biocompatibility: 0.87, cellAdhesion: 0.60, applications: ['bone', 'cartilage', 'vascular', 'drug delivery'] },
22
+ { name: 'PLGA', type: 'synthetic', porosity: [50, 90], degradationMonths: [1, 12], tensileStrengthMPa: [20, 60], biocompatibility: 0.86, cellAdhesion: 0.58, applications: ['bone', 'cartilage', 'drug delivery', 'sutures'] },
23
+ { name: 'PEG Hydrogel', type: 'synthetic', porosity: [90, 99], degradationMonths: [0.5, 6], tensileStrengthMPa: [0.01, 1], biocompatibility: 0.92, cellAdhesion: 0.35, applications: ['cartilage', 'neural', 'drug delivery', 'cell encapsulation'] },
24
+ { name: 'Hydroxyapatite/Collagen', type: 'composite', porosity: [50, 80], degradationMonths: [6, 24], tensileStrengthMPa: [10, 50], biocompatibility: 0.94, cellAdhesion: 0.88, applications: ['bone', 'dental', 'craniofacial'] },
25
+ { name: 'Graphene-PCL', type: 'composite', porosity: [40, 80], degradationMonths: [18, 48], tensileStrengthMPa: [20, 100], biocompatibility: 0.80, cellAdhesion: 0.70, applications: ['bone', 'neural', 'cardiac', 'biosensor'] },
26
+ { name: 'Gelatin Methacrylate (GelMA)', type: 'composite', porosity: [70, 95], degradationMonths: [1, 4], tensileStrengthMPa: [0.05, 2], biocompatibility: 0.93, cellAdhesion: 0.88, applications: ['cartilage', 'vascular', 'skin', 'bioprinting'] },
27
+ ];
28
+ const ORGAN_TEMPLATES = {
29
+ skin: { name: 'Skin', cellDensity: 1e7, vascularization: true, immunosuppression: false, growthWeeks: [2, 6], mechanicalMPa: [1, 10], bestScaffolds: ['Collagen Type I', 'Fibrin', 'GelMA'], milestones: ['keratinocyte seeding', 'dermal layer formation', 'epidermal stratification', 'vascularization', 'barrier function test'], difficulty: 3 },
30
+ cartilage: { name: 'Cartilage', cellDensity: 1e7, vascularization: false, immunosuppression: false, growthWeeks: [4, 12], mechanicalMPa: [5, 30], bestScaffolds: ['Alginate', 'PCL', 'PEG Hydrogel', 'GelMA'], milestones: ['chondrocyte isolation', 'scaffold seeding', 'ECM deposition', 'mechanical maturation', 'integration test'], difficulty: 4 },
31
+ bone: { name: 'Bone', cellDensity: 2e7, vascularization: true, immunosuppression: false, growthWeeks: [8, 24], mechanicalMPa: [50, 200], bestScaffolds: ['Hydroxyapatite/Collagen', 'PLA', 'PCL'], milestones: ['osteoblast culture', 'mineralization', 'vascular network', 'load-bearing test', 'remodeling'], difficulty: 6 },
32
+ oesophagus: { name: 'Oesophagus', cellDensity: 5e7, vascularization: true, immunosuppression: false, growthWeeks: [6, 16], mechanicalMPa: [0.5, 5], bestScaffolds: ['Decellularized ECM', 'Collagen Type I'], milestones: ['decellularization', 'epithelial seeding', 'smooth muscle layer', 'peristalsis test', 'in vivo implantation', 'growth adaptation'], difficulty: 7 },
33
+ trachea: { name: 'Trachea', cellDensity: 3e7, vascularization: true, immunosuppression: false, growthWeeks: [6, 16], mechanicalMPa: [1, 10], bestScaffolds: ['Decellularized ECM', 'PCL'], milestones: ['scaffold preparation', 'epithelial lining', 'cartilage ring formation', 'mucociliary function', 'implantation'], difficulty: 7 },
34
+ bladder: { name: 'Bladder', cellDensity: 3e7, vascularization: true, immunosuppression: false, growthWeeks: [4, 12], mechanicalMPa: [0.2, 2], bestScaffolds: ['Decellularized ECM', 'Collagen Type I', 'PLGA'], milestones: ['urothelial seeding', 'smooth muscle layer', 'distension test', 'waterproof barrier', 'innervation'], difficulty: 5 },
35
+ heart_valve: { name: 'Heart Valve', cellDensity: 1e8, vascularization: false, immunosuppression: false, growthWeeks: [4, 8], mechanicalMPa: [1, 15], bestScaffolds: ['Decellularized ECM', 'Fibrin', 'PCL'], milestones: ['valve geometry', 'endothelialization', 'mechanical conditioning', 'hemodynamic test', 'durability cycling'], difficulty: 8 },
36
+ liver: { name: 'Liver (Lobule)', cellDensity: 2e8, vascularization: true, immunosuppression: true, growthWeeks: [8, 24], mechanicalMPa: [0.1, 1], bestScaffolds: ['Decellularized ECM', 'Alginate', 'GelMA'], milestones: ['hepatocyte isolation', 'lobular architecture', 'bile duct formation', 'metabolic function', 'vascularization', 'detox assay'], difficulty: 9 },
37
+ kidney: { name: 'Kidney (Nephron Unit)', cellDensity: 3e8, vascularization: true, immunosuppression: true, growthWeeks: [12, 36], mechanicalMPa: [0.1, 1], bestScaffolds: ['Decellularized ECM', 'GelMA'], milestones: ['nephron progenitor culture', 'tubule formation', 'glomerular filtration', 'vascular integration', 'urine production'], difficulty: 10 },
38
+ };
39
+ const SOLAR_MATERIALS = [
40
+ { name: 'Crystalline Silicon (c-Si)', bandgapEV: 1.12, theoreticalEfficiency: 29.4, recordEfficiency: 26.8, type: 'silicon', costPerWatt: 0.20, degradationPerYear: 0.5, singletFission: false, notes: '95% of market. Mature technology.' },
41
+ { name: 'Monocrystalline PERC', bandgapEV: 1.12, theoreticalEfficiency: 29.4, recordEfficiency: 24.5, type: 'silicon', costPerWatt: 0.22, degradationPerYear: 0.4, singletFission: false, notes: 'Most common commercial cell.' },
42
+ { name: 'CdTe (Cadmium Telluride)', bandgapEV: 1.45, theoreticalEfficiency: 32.1, recordEfficiency: 22.6, type: 'thin-film', costPerWatt: 0.18, degradationPerYear: 0.5, singletFission: false, notes: 'First Solar dominates. Toxicity concerns.' },
43
+ { name: 'CIGS', bandgapEV: 1.15, theoreticalEfficiency: 29.8, recordEfficiency: 23.6, type: 'thin-film', costPerWatt: 0.25, degradationPerYear: 0.6, singletFission: false, notes: 'Flexible substrates possible.' },
44
+ { name: 'Perovskite (MAPbI₃)', bandgapEV: 1.55, theoreticalEfficiency: 33.2, recordEfficiency: 26.1, type: 'perovskite', costPerWatt: 0.10, degradationPerYear: 3.0, singletFission: false, notes: 'Rapid improvement. Stability still a challenge.' },
45
+ { name: 'Perovskite/Silicon Tandem', bandgapEV: 1.68, theoreticalEfficiency: 43.0, recordEfficiency: 33.9, type: 'multijunction', costPerWatt: 0.30, degradationPerYear: 1.5, singletFission: false, notes: 'Best near-term path to >30%.' },
46
+ { name: 'GaAs (Gallium Arsenide)', bandgapEV: 1.42, theoreticalEfficiency: 33.2, recordEfficiency: 29.1, type: 'multijunction', costPerWatt: 5.00, degradationPerYear: 0.2, singletFission: false, notes: 'Space applications. Expensive.' },
47
+ { name: 'III-V Triple Junction', bandgapEV: 1.87, theoreticalEfficiency: 49.0, recordEfficiency: 47.6, type: 'multijunction', costPerWatt: 10.00, degradationPerYear: 0.1, singletFission: false, notes: 'Concentrator cells. Space/military.' },
48
+ { name: 'Organic (P3HT:PCBM)', bandgapEV: 1.90, theoreticalEfficiency: 23.0, recordEfficiency: 19.2, type: 'organic', costPerWatt: 0.08, degradationPerYear: 5.0, singletFission: false, notes: 'Printable, flexible, cheap. Short lifetime.' },
49
+ { name: 'Singlet Fission (Tetracene/Si)', bandgapEV: 1.12, theoreticalEfficiency: 45.0, recordEfficiency: 4.2, type: 'quantum', costPerWatt: 2.00, degradationPerYear: 2.0, singletFission: true, notes: 'March 2026: 130% quantum efficiency via spin-flip metal complex. Breaks single-photon limit.' },
50
+ { name: 'Quantum Dot', bandgapEV: 1.30, theoreticalEfficiency: 44.0, recordEfficiency: 18.1, type: 'quantum', costPerWatt: 1.00, degradationPerYear: 3.0, singletFission: false, notes: 'Tunable bandgap. Multi-exciton generation.' },
51
+ ];
52
+ // ═══════════════════════════════════════════════════════════════════════════
53
+ // DATA: Synthetic Biology
54
+ // ═══════════════════════════════════════════════════════════════════════════
55
+ const CODON_TABLE = {
56
+ A: ['GCU', 'GCC', 'GCA', 'GCG'],
57
+ R: ['CGU', 'CGC', 'CGA', 'CGG', 'AGA', 'AGG'],
58
+ N: ['AAU', 'AAC'],
59
+ D: ['GAU', 'GAC'],
60
+ C: ['UGU', 'UGC'],
61
+ E: ['GAA', 'GAG'],
62
+ Q: ['CAA', 'CAG'],
63
+ G: ['GGU', 'GGC', 'GGA', 'GGG'],
64
+ H: ['CAU', 'CAC'],
65
+ I: ['AUU', 'AUC', 'AUA'],
66
+ L: ['UUA', 'UUG', 'CUU', 'CUC', 'CUA', 'CUG'],
67
+ K: ['AAA', 'AAG'],
68
+ M: ['AUG'],
69
+ F: ['UUU', 'UUC'],
70
+ P: ['CCU', 'CCC', 'CCA', 'CCG'],
71
+ S: ['UCU', 'UCC', 'UCA', 'UCG', 'AGU', 'AGC'],
72
+ T: ['ACU', 'ACC', 'ACA', 'ACG'],
73
+ W: ['UGG'],
74
+ Y: ['UAU', 'UAC'],
75
+ V: ['GUU', 'GUC', 'GUA', 'GUG'],
76
+ '*': ['UAA', 'UAG', 'UGA'],
77
+ };
78
+ // E. coli codon usage bias (frequency weights)
79
+ const ECOLI_CODON_BIAS = {
80
+ GCU: 0.18, GCC: 0.26, GCA: 0.23, GCG: 0.33, // Ala
81
+ CGU: 0.36, CGC: 0.36, CGA: 0.07, CGG: 0.11, AGA: 0.07, AGG: 0.04, // Arg
82
+ AAU: 0.49, AAC: 0.51, // Asn
83
+ GAU: 0.63, GAC: 0.37, // Asp
84
+ UGU: 0.46, UGC: 0.54, // Cys
85
+ GAA: 0.68, GAG: 0.32, // Glu
86
+ CAA: 0.35, CAG: 0.65, // Gln
87
+ GGU: 0.35, GGC: 0.37, GGA: 0.13, GGG: 0.15, // Gly
88
+ CAU: 0.57, CAC: 0.43, // His
89
+ AUU: 0.49, AUC: 0.39, AUA: 0.11, // Ile
90
+ UUA: 0.14, UUG: 0.13, CUU: 0.12, CUC: 0.10, CUA: 0.04, CUG: 0.47, // Leu
91
+ AAA: 0.74, AAG: 0.26, // Lys
92
+ AUG: 1.00, // Met
93
+ UUU: 0.58, UUC: 0.42, // Phe
94
+ CCU: 0.18, CCC: 0.13, CCA: 0.20, CCG: 0.49, // Pro
95
+ UCU: 0.17, UCC: 0.15, UCA: 0.14, UCG: 0.14, AGU: 0.16, AGC: 0.25, // Ser
96
+ ACU: 0.19, ACC: 0.40, ACA: 0.17, ACG: 0.25, // Thr
97
+ UGG: 1.00, // Trp
98
+ UAU: 0.59, UAC: 0.41, // Tyr
99
+ GUU: 0.28, GUC: 0.20, GUA: 0.17, GUG: 0.35, // Val
100
+ };
101
+ // Human codon usage bias
102
+ const HUMAN_CODON_BIAS = {
103
+ GCU: 0.27, GCC: 0.40, GCA: 0.23, GCG: 0.11,
104
+ CGU: 0.08, CGC: 0.18, CGA: 0.11, CGG: 0.20, AGA: 0.21, AGG: 0.21,
105
+ AAU: 0.47, AAC: 0.53,
106
+ GAU: 0.46, GAC: 0.54,
107
+ UGU: 0.46, UGC: 0.54,
108
+ GAA: 0.42, GAG: 0.58,
109
+ CAA: 0.27, CAG: 0.73,
110
+ GGU: 0.16, GGC: 0.34, GGA: 0.25, GGG: 0.25,
111
+ CAU: 0.42, CAC: 0.58,
112
+ AUU: 0.36, AUC: 0.47, AUA: 0.17,
113
+ UUA: 0.08, UUG: 0.13, CUU: 0.13, CUC: 0.20, CUA: 0.07, CUG: 0.40,
114
+ AAA: 0.43, AAG: 0.57,
115
+ AUG: 1.00,
116
+ UUU: 0.46, UUC: 0.54,
117
+ CCU: 0.29, CCC: 0.32, CCA: 0.28, CCG: 0.11,
118
+ UCU: 0.19, UCC: 0.22, UCA: 0.15, UCG: 0.05, AGU: 0.15, AGC: 0.24,
119
+ ACU: 0.25, ACC: 0.36, ACA: 0.28, ACG: 0.12,
120
+ UGG: 1.00,
121
+ UAU: 0.44, UAC: 0.56,
122
+ GUU: 0.18, GUC: 0.24, GUA: 0.12, GUG: 0.46,
123
+ };
124
+ // Yeast (S. cerevisiae) codon bias
125
+ const YEAST_CODON_BIAS = {
126
+ GCU: 0.38, GCC: 0.22, GCA: 0.29, GCG: 0.11,
127
+ CGU: 0.14, CGC: 0.06, CGA: 0.07, CGG: 0.04, AGA: 0.48, AGG: 0.21,
128
+ AAU: 0.59, AAC: 0.41,
129
+ GAU: 0.65, GAC: 0.35,
130
+ UGU: 0.63, UGC: 0.37,
131
+ GAA: 0.70, GAG: 0.30,
132
+ CAA: 0.69, CAG: 0.31,
133
+ GGU: 0.47, GGC: 0.19, GGA: 0.22, GGG: 0.12,
134
+ CAU: 0.64, CAC: 0.36,
135
+ AUU: 0.46, AUC: 0.26, AUA: 0.27,
136
+ UUA: 0.28, UUG: 0.29, CUU: 0.13, CUC: 0.06, CUA: 0.14, CUG: 0.11,
137
+ AAA: 0.58, AAG: 0.42,
138
+ AUG: 1.00,
139
+ UUU: 0.59, UUC: 0.41,
140
+ CCU: 0.31, CCC: 0.15, CCA: 0.42, CCG: 0.12,
141
+ UCU: 0.26, UCC: 0.16, UCA: 0.21, UCG: 0.10, AGU: 0.16, AGC: 0.11,
142
+ ACU: 0.35, ACC: 0.22, ACA: 0.30, ACG: 0.14,
143
+ UGG: 1.00,
144
+ UAU: 0.56, UAC: 0.44,
145
+ GUU: 0.39, GUC: 0.21, GUA: 0.21, GUG: 0.19,
146
+ };
147
+ const BIOBRICK_PARTS = [
148
+ { name: 'pLac', type: 'promoter', registry: 'BBa_R0010', strength: 0.7, description: 'IPTG-inducible lac promoter' },
149
+ { name: 'pTet', type: 'promoter', registry: 'BBa_R0040', strength: 0.6, description: 'aTc-inducible tet promoter' },
150
+ { name: 'pBAD', type: 'promoter', registry: 'BBa_I0500', strength: 0.8, description: 'Arabinose-inducible promoter' },
151
+ { name: 'pT7', type: 'promoter', registry: 'BBa_I712074', strength: 1.0, description: 'T7 RNA polymerase promoter (very strong)' },
152
+ { name: 'pConst', type: 'promoter', registry: 'BBa_J23100', strength: 0.95, description: 'Strong constitutive promoter' },
153
+ { name: 'RBS-strong', type: 'rbs', registry: 'BBa_B0034', strength: 0.9, description: 'Strong ribosome binding site' },
154
+ { name: 'RBS-medium', type: 'rbs', registry: 'BBa_B0032', strength: 0.5, description: 'Medium ribosome binding site' },
155
+ { name: 'RBS-weak', type: 'rbs', registry: 'BBa_B0031', strength: 0.1, description: 'Weak ribosome binding site' },
156
+ { name: 'GFP', type: 'reporter', registry: 'BBa_E0040', strength: 0.8, description: 'Green fluorescent protein' },
157
+ { name: 'RFP', type: 'reporter', registry: 'BBa_E1010', strength: 0.7, description: 'Red fluorescent protein (mRFP1)' },
158
+ { name: 'LuxR', type: 'regulator', registry: 'BBa_C0062', strength: 0.6, description: 'AHL-responsive transcription factor' },
159
+ { name: 'LacI', type: 'regulator', registry: 'BBa_C0012', strength: 0.7, description: 'Lac repressor' },
160
+ { name: 'TetR', type: 'regulator', registry: 'BBa_C0040', strength: 0.7, description: 'Tet repressor' },
161
+ { name: 'dTerm', type: 'terminator', registry: 'BBa_B0015', strength: 0.98, description: 'Double terminator (strong)' },
162
+ { name: 'sTerm', type: 'terminator', registry: 'BBa_B0010', strength: 0.85, description: 'T1 terminator' },
163
+ ];
164
+ const PRIMATE_TREE = [
165
+ { name: 'Primates', commonName: 'Primates', divergenceMya: 85, parent: '', features: ['forward-facing eyes', 'grasping hands', 'large brain-to-body ratio'] },
166
+ { name: 'Strepsirrhini', commonName: 'Wet-nosed primates', divergenceMya: 75, parent: 'Primates', features: ['rhinarium', 'tapetum lucidum', 'grooming claw'] },
167
+ { name: 'Haplorhini', commonName: 'Dry-nosed primates', divergenceMya: 75, parent: 'Primates', features: ['postorbital closure', 'fovea', 'no rhinarium'] },
168
+ { name: 'Tarsiiformes', commonName: 'Tarsiers', divergenceMya: 58, parent: 'Haplorhini' },
169
+ { name: 'Simiiformes', commonName: 'Simians', divergenceMya: 58, parent: 'Haplorhini', features: ['larger brain', 'color vision', 'postorbital plate'] },
170
+ { name: 'Platyrrhini', commonName: 'New World monkeys', divergenceMya: 43, parent: 'Simiiformes', features: ['prehensile tails (some)', 'flat nose', '3 premolars'] },
171
+ { name: 'Catarrhini', commonName: 'Old World monkeys & apes', divergenceMya: 43, parent: 'Simiiformes', features: ['downward-facing nostrils', '2 premolars'] },
172
+ { name: 'Cercopithecoidea', commonName: 'Old World monkeys', divergenceMya: 30, parent: 'Catarrhini' },
173
+ { name: 'Hominoidea', commonName: 'Apes', divergenceMya: 30, parent: 'Catarrhini', features: ['no tail', 'broad chest', 'shoulder mobility'] },
174
+ { name: 'Masripithecus', commonName: 'Egyptian fossil ape (2026)', divergenceMya: 17.5, parent: 'Hominoidea', features: ['17-18 Mya', 'northern Egypt', 'near common ancestor of all modern apes', 'reshapes ape origin timeline'] },
175
+ { name: 'Hylobatidae', commonName: 'Gibbons', divergenceMya: 20, parent: 'Hominoidea', features: ['brachiation', 'pair bonding', 'smallest apes'] },
176
+ { name: 'Hominidae', commonName: 'Great apes', divergenceMya: 17, parent: 'Hominoidea', features: ['larger body', 'complex cognition', 'tool use'] },
177
+ { name: 'Ponginae', commonName: 'Orangutans', divergenceMya: 14, parent: 'Hominidae', features: ['solitary', 'arboreal', 'Southeast Asia'] },
178
+ { name: 'Homininae', commonName: 'African apes + humans', divergenceMya: 14, parent: 'Hominidae' },
179
+ { name: 'Gorillini', commonName: 'Gorillas', divergenceMya: 9, parent: 'Homininae', features: ['largest primates', 'knuckle walking', 'herbivorous'] },
180
+ { name: 'Hominini', commonName: 'Humans + chimpanzees', divergenceMya: 9, parent: 'Homininae' },
181
+ { name: 'Panina', commonName: 'Chimpanzees & Bonobos', divergenceMya: 6.5, parent: 'Hominini', features: ['tool use', 'complex social', 'closest to humans'] },
182
+ { name: 'Hominina', commonName: 'Human lineage', divergenceMya: 6.5, parent: 'Hominini', features: ['bipedalism', 'language', 'technology'] },
183
+ { name: 'Australopithecus', commonName: 'Southern ape', divergenceMya: 4.2, parent: 'Hominina', features: ['bipedal', 'small brain', 'Africa'] },
184
+ { name: 'Homo', commonName: 'Humans', divergenceMya: 2.8, parent: 'Hominina', features: ['large brain', 'stone tools', 'fire use'] },
185
+ { name: 'Homo_sapiens', commonName: 'Modern humans', divergenceMya: 0.3, parent: 'Homo', features: ['language', 'art', 'agriculture', 'spaceflight'] },
186
+ ];
187
+ const PLANETARY_ATMOSPHERES = {
188
+ mercury: { name: 'Mercury', surfaceTempK: 440, surfacePressureAtm: 1e-15, composition: { O2: 42, Na: 29, H2: 22, He: 6, K: 0.5 }, scaleHeightKm: 26, maxWindSpeedMs: 0, hasLightning: false, notes: 'Exosphere only. No weather.' },
189
+ venus: { name: 'Venus', surfaceTempK: 737, surfacePressureAtm: 92, composition: { CO2: 96.5, N2: 3.5, SO2: 0.015, Ar: 0.007 }, scaleHeightKm: 15.9, maxWindSpeedMs: 100, hasLightning: true, lightningEnergyJ: 1e9, notes: 'Runaway greenhouse. Sulfuric acid clouds.' },
190
+ earth: { name: 'Earth', surfaceTempK: 288, surfacePressureAtm: 1.0, composition: { N2: 78.08, O2: 20.95, Ar: 0.93, CO2: 0.042, H2O: 1.0 }, scaleHeightKm: 8.5, maxWindSpeedMs: 113, hasLightning: true, lightningEnergyJ: 1e9, notes: 'Only known atmosphere supporting life.' },
191
+ mars: { name: 'Mars', surfaceTempK: 210, surfacePressureAtm: 0.006, composition: { CO2: 95.3, N2: 2.7, Ar: 1.6, O2: 0.13, CO: 0.07 }, scaleHeightKm: 11.1, maxWindSpeedMs: 30, hasLightning: false, notes: 'Thin atmosphere. Global dust storms.' },
192
+ jupiter: { name: 'Jupiter', surfaceTempK: 165, surfacePressureAtm: 1000, composition: { H2: 89.8, He: 10.2, CH4: 0.3, NH3: 0.026, HD: 0.003 }, scaleHeightKm: 27, maxWindSpeedMs: 180, hasLightning: true, lightningEnergyJ: 1e15, notes: 'March 2026 Juno: lightning up to 1 MILLION times more powerful than Earth. Stealth superstorm 2021-22.' },
193
+ saturn: { name: 'Saturn', surfaceTempK: 134, surfacePressureAtm: 1000, composition: { H2: 96.3, He: 3.25, CH4: 0.45, NH3: 0.013 }, scaleHeightKm: 59.5, maxWindSpeedMs: 500, hasLightning: true, lightningEnergyJ: 1e12, notes: 'Fastest winds in solar system. Hexagonal polar vortex.' },
194
+ uranus: { name: 'Uranus', surfaceTempK: 76, surfacePressureAtm: 1000, composition: { H2: 82.5, He: 15.2, CH4: 2.3 }, scaleHeightKm: 27.7, maxWindSpeedMs: 250, hasLightning: false, notes: 'Tilted 98°. Ice giant.' },
195
+ neptune: { name: 'Neptune', surfaceTempK: 72, surfacePressureAtm: 1000, composition: { H2: 80, He: 19, CH4: 1.5 }, scaleHeightKm: 19.7, maxWindSpeedMs: 580, hasLightning: false, notes: 'Strongest sustained winds (~580 m/s). Great Dark Spot.' },
196
+ titan: { name: 'Titan', surfaceTempK: 94, surfacePressureAtm: 1.47, composition: { N2: 95, CH4: 5, H2: 0.1 }, scaleHeightKm: 21, maxWindSpeedMs: 0.3, hasLightning: false, notes: 'Only moon with a thick atmosphere. Methane cycle (rain, lakes, rivers).' },
197
+ exo_trappist1e: { name: 'TRAPPIST-1e', surfaceTempK: 251, surfacePressureAtm: 1.0, composition: { N2: 78, CO2: 10, O2: 5, H2O: 7 }, scaleHeightKm: 8.0, maxWindSpeedMs: 50, hasLightning: true, lightningEnergyJ: 1e9, notes: 'Hypothetical habitable zone. Tidally locked. Model estimate.' },
198
+ };
199
+ // ═══════════════════════════════════════════════════════════════════════════
200
+ // TOOL REGISTRATION
201
+ // ═══════════════════════════════════════════════════════════════════════════
202
+ export function registerFrontierTools() {
203
+ // ─── 1. Tissue Engineering Simulator ─────────────────────────────────
204
+ registerTool({
205
+ name: 'tissue_engineer',
206
+ description: 'Design tissue-engineered constructs — select organs, biomaterials, and scaffold parameters. Models cell growth kinetics, scaffold degradation, vascularization timelines, and biocompatibility. Includes data from the March 2026 lab-grown oesophagus breakthrough (Great Ormond Street Hospital).',
207
+ parameters: {
208
+ organ: { type: 'string', description: 'Target organ/tissue: skin, cartilage, bone, oesophagus, trachea, bladder, heart_valve, liver, kidney. Or "list" for all.' },
209
+ material: { type: 'string', description: 'Scaffold material name, or "recommend" for best match, or "list" for all materials' },
210
+ cells: { type: 'number', description: 'Initial cell seeding count (default: 1e6)' },
211
+ weeks: { type: 'number', description: 'Growth simulation duration in weeks (default: 12)' },
212
+ },
213
+ tier: 'free',
214
+ timeout: 15_000,
215
+ async execute(args) {
216
+ const lines = [];
217
+ // List materials
218
+ if (String(args.material) === 'list' || String(args.organ) === 'list') {
219
+ if (String(args.material) === 'list') {
220
+ lines.push('## Biomaterials Library', '');
221
+ lines.push('| Material | Type | Porosity | Degradation | Strength (MPa) | Biocompat | Applications |');
222
+ lines.push('|----------|------|----------|-------------|----------------|-----------|-------------|');
223
+ for (const m of BIOMATERIALS) {
224
+ lines.push(`| ${m.name} | ${m.type} | ${m.porosity[0]}-${m.porosity[1]}% | ${m.degradationMonths[0]}-${m.degradationMonths[1]} mo | ${m.tensileStrengthMPa[0]}-${m.tensileStrengthMPa[1]} | ${(m.biocompatibility * 100).toFixed(0)}% | ${m.applications.join(', ')} |`);
225
+ }
226
+ }
227
+ if (String(args.organ) === 'list') {
228
+ lines.push('', '## Organ Templates', '');
229
+ lines.push('| Organ | Cell Density | Growth Time | Difficulty | Vascularization | Immunosuppression |');
230
+ lines.push('|-------|-------------|-------------|------------|-----------------|-------------------|');
231
+ for (const [, o] of Object.entries(ORGAN_TEMPLATES)) {
232
+ lines.push(`| ${o.name} | ${o.cellDensity.toExponential(0)} | ${o.growthWeeks[0]}-${o.growthWeeks[1]} wk | ${o.difficulty}/10 | ${o.vascularization ? 'Yes' : 'No'} | ${o.immunosuppression ? 'Yes' : 'No'} |`);
233
+ }
234
+ }
235
+ return lines.join('\n');
236
+ }
237
+ const organKey = String(args.organ || 'oesophagus').toLowerCase().replace(/\s+/g, '_');
238
+ const organ = ORGAN_TEMPLATES[organKey];
239
+ if (!organ)
240
+ return `Unknown organ "${args.organ}". Use organ="list" to see options.`;
241
+ // Find or recommend material
242
+ let material;
243
+ if (!args.material || String(args.material) === 'recommend') {
244
+ material = BIOMATERIALS.find(m => organ.bestScaffolds.includes(m.name));
245
+ }
246
+ else {
247
+ material = BIOMATERIALS.find(m => m.name.toLowerCase().includes(String(args.material).toLowerCase()));
248
+ }
249
+ if (!material)
250
+ return `Material "${args.material}" not found. Use material="list" to see options.`;
251
+ const initialCells = Number(args.cells) || 1e6;
252
+ const weeks = Number(args.weeks) || 12;
253
+ lines.push(`# Tissue Engineering: ${organ.name}`, '');
254
+ lines.push(`**Scaffold**: ${material.name} (${material.type})`);
255
+ lines.push(`**Initial cells**: ${initialCells.toExponential(1)}`);
256
+ lines.push(`**Simulation**: ${weeks} weeks`);
257
+ lines.push('');
258
+ // Biocompatibility score
259
+ const compat = material.biocompatibility * (organ.bestScaffolds.includes(material.name) ? 1.0 : 0.75);
260
+ lines.push(`## Scaffold Properties`);
261
+ lines.push(`- Porosity: ${material.porosity[0]}-${material.porosity[1]}%`);
262
+ lines.push(`- Degradation: ${material.degradationMonths[0]}-${material.degradationMonths[1]} months`);
263
+ lines.push(`- Tensile strength: ${material.tensileStrengthMPa[0]}-${material.tensileStrengthMPa[1]} MPa (organ needs ${organ.mechanicalMPa[0]}-${organ.mechanicalMPa[1]} MPa)`);
264
+ lines.push(`- Biocompatibility: ${(compat * 100).toFixed(0)}%`);
265
+ lines.push(`- Cell adhesion: ${(material.cellAdhesion * 100).toFixed(0)}%`);
266
+ const strengthOk = material.tensileStrengthMPa[1] >= organ.mechanicalMPa[0];
267
+ lines.push(`- Mechanical match: ${strengthOk ? '✓ Adequate' : '✗ Insufficient — consider composite reinforcement'}`);
268
+ lines.push('');
269
+ // Growth simulation (logistic growth model)
270
+ lines.push(`## Cell Growth Simulation`);
271
+ lines.push('');
272
+ const targetCells = organ.cellDensity * 10; // ~10 cm³ construct
273
+ const doublingHours = 24 + (10 - organ.difficulty) * 4; // harder organs = slower
274
+ const growthRate = Math.log(2) / (doublingHours / 24 / 7); // per week
275
+ const K = targetCells * material.cellAdhesion; // carrying capacity adjusted by adhesion
276
+ lines.push('| Week | Cells | % of Target | Scaffold Remaining | Milestone |');
277
+ lines.push('|------|-------|-------------|-------------------|-----------|');
278
+ let cells = initialCells;
279
+ for (let w = 1; w <= weeks; w++) {
280
+ // Logistic growth: dN/dt = rN(1 - N/K)
281
+ cells = cells + growthRate * cells * (1 - cells / K);
282
+ cells = Math.min(cells, K);
283
+ // Scaffold degradation (linear approximation)
284
+ const avgDegMonths = (material.degradationMonths[0] + material.degradationMonths[1]) / 2;
285
+ const scaffoldRemaining = Math.max(0, 100 - (w / 4.33) / avgDegMonths * 100);
286
+ // Milestone check
287
+ const milestoneIdx = Math.floor((w / weeks) * organ.milestones.length);
288
+ const milestone = w === 1 || milestoneIdx !== Math.floor(((w - 1) / weeks) * organ.milestones.length)
289
+ ? organ.milestones[Math.min(milestoneIdx, organ.milestones.length - 1)] : '';
290
+ const pctTarget = Math.min(100, (cells / targetCells) * 100);
291
+ lines.push(`| ${w} | ${cells.toExponential(1)} | ${pctTarget.toFixed(1)}% | ${scaffoldRemaining.toFixed(0)}% | ${milestone} |`);
292
+ }
293
+ lines.push('');
294
+ // Viability assessment
295
+ const finalPct = Math.min(100, (cells / targetCells) * 100);
296
+ const viability = compat * material.cellAdhesion * (finalPct / 100) * (strengthOk ? 1 : 0.5);
297
+ lines.push(`## Viability Assessment`);
298
+ lines.push(`- Final cell count: ${cells.toExponential(2)} (${finalPct.toFixed(1)}% of target)`);
299
+ lines.push(`- Construct viability score: **${(viability * 100).toFixed(0)}%**`);
300
+ lines.push(`- Estimated time to implantation: ${organ.growthWeeks[0]}-${organ.growthWeeks[1]} weeks`);
301
+ lines.push(`- Vascularization required: ${organ.vascularization ? 'Yes — VEGF/FGF growth factor cocktail' : 'No'}`);
302
+ lines.push(`- Immunosuppression: ${organ.immunosuppression ? 'Required (autologous cells preferred)' : 'Not required (March 2026 oesophagus achieved this)'}`);
303
+ lines.push(`- Difficulty: ${organ.difficulty}/10`);
304
+ lines.push('');
305
+ lines.push(`## Recommended Scaffolds for ${organ.name}`);
306
+ for (const s of organ.bestScaffolds) {
307
+ const mat = BIOMATERIALS.find(m => m.name === s);
308
+ if (mat)
309
+ lines.push(`- **${s}**: biocompat ${(mat.biocompatibility * 100).toFixed(0)}%, adhesion ${(mat.cellAdhesion * 100).toFixed(0)}%`);
310
+ }
311
+ return lines.join('\n');
312
+ },
313
+ });
314
+ // ─── 2. Solar Cell Modeler ───────────────────────────────────────────
315
+ registerTool({
316
+ name: 'solar_cell_model',
317
+ description: 'Model photovoltaic cell efficiency — Shockley-Queisser limits, singlet fission, tandem cells, cost analysis. Includes March 2026 singlet fission breakthrough (130% quantum efficiency via spin-flip metal complex).',
318
+ parameters: {
319
+ material: { type: 'string', description: 'Solar material name, or "list" for all, or "compare" for comparison table' },
320
+ area_m2: { type: 'number', description: 'Panel area in square meters (default: 1.0)' },
321
+ irradiance: { type: 'number', description: 'Solar irradiance in W/m² (default: 1000 = standard test)' },
322
+ hours_per_day: { type: 'number', description: 'Peak sun hours per day (default: 5)' },
323
+ tandem: { type: 'string', description: 'Second material for tandem cell modeling (optional)' },
324
+ },
325
+ tier: 'free',
326
+ timeout: 10_000,
327
+ async execute(args) {
328
+ const lines = [];
329
+ if (String(args.material) === 'list' || String(args.material) === 'compare') {
330
+ lines.push('## Solar Cell Materials', '');
331
+ lines.push('| Material | Bandgap | SQ Limit | Record | $/W | Degrad/yr | Type |');
332
+ lines.push('|----------|---------|----------|--------|-----|-----------|------|');
333
+ for (const m of SOLAR_MATERIALS) {
334
+ lines.push(`| ${m.name} | ${m.bandgapEV} eV | ${m.theoreticalEfficiency}% | ${m.recordEfficiency}% | $${m.costPerWatt.toFixed(2)} | ${m.degradationPerYear}% | ${m.type} |`);
335
+ }
336
+ lines.push('');
337
+ lines.push('**Key**: SQ Limit = Shockley-Queisser theoretical max for single junction');
338
+ lines.push('**Note**: Singlet Fission breaks SQ limit by generating 2 excitons per photon (March 2026 breakthrough)');
339
+ return lines.join('\n');
340
+ }
341
+ const mat = SOLAR_MATERIALS.find(m => m.name.toLowerCase().includes(String(args.material || 'silicon').toLowerCase()));
342
+ if (!mat)
343
+ return `Material not found. Use material="list" to see options.`;
344
+ const area = Number(args.area_m2) || 1.0;
345
+ const irradiance = Number(args.irradiance) || 1000;
346
+ const sunHours = Number(args.hours_per_day) || 5;
347
+ lines.push(`# Solar Cell Model: ${mat.name}`, '');
348
+ lines.push(`**Type**: ${mat.type} | **Bandgap**: ${mat.bandgapEV} eV`);
349
+ lines.push('');
350
+ // Shockley-Queisser calculation
351
+ // Simplified: η = (bandgap × current_density × fill_factor) / irradiance
352
+ const h = 6.626e-34, c = 3e8, k = 1.381e-23, T = 300, q = 1.602e-19;
353
+ const Eg = mat.bandgapEV * q;
354
+ const Voc = mat.bandgapEV - 0.4; // simplified Voc
355
+ const fillFactor = 0.75 + mat.bandgapEV * 0.05;
356
+ lines.push(`## Physics`);
357
+ lines.push(`- Bandgap energy: ${mat.bandgapEV} eV (${(Eg * 1e9 / (h * c) * 1e-9).toFixed(0)} nm cutoff wavelength)`);
358
+ lines.push(`- Open-circuit voltage (Voc): ~${Voc.toFixed(2)} V`);
359
+ lines.push(`- Fill factor: ~${(fillFactor * 100).toFixed(1)}%`);
360
+ lines.push(`- Shockley-Queisser limit: ${mat.theoreticalEfficiency}%`);
361
+ lines.push(`- Current record efficiency: ${mat.recordEfficiency}%`);
362
+ if (mat.singletFission) {
363
+ lines.push('');
364
+ lines.push(`### Singlet Fission Enhancement`);
365
+ lines.push(`- Quantum efficiency: **>100%** (up to 130% demonstrated March 2026)`);
366
+ lines.push(`- Mechanism: One high-energy photon → two excitons via spin-flip metal complex`);
367
+ lines.push(`- Breaks Shockley-Queisser limit for single-junction cells`);
368
+ lines.push(`- Theoretical max with fission: ${mat.theoreticalEfficiency}% (vs 29.4% for standard Si)`);
369
+ }
370
+ lines.push('');
371
+ // Power output calculation
372
+ const efficiency = mat.recordEfficiency / 100;
373
+ const powerPeak = irradiance * area * efficiency; // Watts
374
+ const dailyKwh = powerPeak * sunHours / 1000;
375
+ const annualKwh = dailyKwh * 365;
376
+ const cost = mat.costPerWatt * powerPeak;
377
+ lines.push(`## Energy Output (${area} m² panel)`);
378
+ lines.push(`- Peak power: **${powerPeak.toFixed(1)} W** at ${irradiance} W/m²`);
379
+ lines.push(`- Daily energy: ${dailyKwh.toFixed(2)} kWh (${sunHours}h peak sun)`);
380
+ lines.push(`- Annual energy: ${annualKwh.toFixed(0)} kWh`);
381
+ lines.push(`- Panel cost: ~$${cost.toFixed(2)}`);
382
+ lines.push(`- LCOE estimate: ~$${(cost / (annualKwh * 25 * (1 - mat.degradationPerYear / 100 * 12.5))).toFixed(3)}/kWh (25yr lifetime)`);
383
+ lines.push('');
384
+ // Degradation over time
385
+ lines.push(`## 25-Year Degradation`);
386
+ lines.push('| Year | Efficiency | Annual kWh | Cumulative kWh |');
387
+ lines.push('|------|-----------|------------|----------------|');
388
+ let cumKwh = 0;
389
+ for (const year of [1, 5, 10, 15, 20, 25]) {
390
+ const degraded = efficiency * Math.pow(1 - mat.degradationPerYear / 100, year);
391
+ const yearKwh = irradiance * area * degraded * sunHours * 365 / 1000;
392
+ cumKwh += yearKwh * (year === 1 ? 1 : (year <= 5 ? 4 : 5));
393
+ lines.push(`| ${year} | ${(degraded * 100).toFixed(1)}% | ${yearKwh.toFixed(0)} | ${cumKwh.toFixed(0)} |`);
394
+ }
395
+ // Tandem cell
396
+ if (args.tandem) {
397
+ const mat2 = SOLAR_MATERIALS.find(m => m.name.toLowerCase().includes(String(args.tandem).toLowerCase()));
398
+ if (mat2) {
399
+ lines.push('');
400
+ lines.push(`## Tandem Cell: ${mat.name} + ${mat2.name}`);
401
+ // Detailed balance limit for tandem ≈ 1.1x + 0.9y for non-overlapping absorption
402
+ const tandemEff = Math.min(mat.theoreticalEfficiency * 0.85 + mat2.theoreticalEfficiency * 0.55, 49 // practical limit for 2-junction
403
+ );
404
+ const tandemPower = irradiance * area * tandemEff / 100;
405
+ lines.push(`- Combined theoretical limit: ~${tandemEff.toFixed(1)}%`);
406
+ lines.push(`- Top cell: ${mat.name} (${mat.bandgapEV} eV) — absorbs high-energy photons`);
407
+ lines.push(`- Bottom cell: ${mat2.name} (${mat2.bandgapEV} eV) — absorbs transmitted light`);
408
+ lines.push(`- Tandem peak power: ${tandemPower.toFixed(1)} W`);
409
+ lines.push(`- Optimal bandgap pairing: top ~1.7 eV, bottom ~1.1 eV`);
410
+ const gapDiff = Math.abs(mat.bandgapEV - mat2.bandgapEV);
411
+ lines.push(`- Your gap difference: ${gapDiff.toFixed(2)} eV ${gapDiff > 0.3 && gapDiff < 0.8 ? '(good range)' : '(suboptimal — aim for 0.4-0.7 eV difference)'}`);
412
+ }
413
+ }
414
+ return lines.join('\n');
415
+ },
416
+ });
417
+ // ─── 3. Synthetic Biology Toolkit ────────────────────────────────────
418
+ registerTool({
419
+ name: 'synbio_design',
420
+ description: 'Synthetic biology design toolkit — codon optimization (E.coli/human/yeast), gene circuit design with BioBrick parts, metabolic pathway analysis. Inspired by March 2026 Oxford engineered bee yeast breakthrough.',
421
+ parameters: {
422
+ mode: { type: 'string', description: '"codon" for codon optimization, "circuit" for gene circuit design, "parts" to list BioBrick parts, "pathway" for metabolic pathway analysis', required: true },
423
+ sequence: { type: 'string', description: 'For codon mode: amino acid sequence (1-letter codes). For pathway mode: target molecule name.' },
424
+ organism: { type: 'string', description: 'Target organism for codon optimization: "ecoli", "human", "yeast" (default: ecoli)' },
425
+ parts: { type: 'string', description: 'For circuit mode: comma-separated part names (e.g. "pLac,RBS-strong,GFP,dTerm")' },
426
+ },
427
+ tier: 'free',
428
+ timeout: 15_000,
429
+ async execute(args) {
430
+ const mode = String(args.mode).toLowerCase();
431
+ const lines = [];
432
+ if (mode === 'parts') {
433
+ lines.push('## BioBrick Standard Parts', '');
434
+ lines.push('| Part | Type | Registry | Strength | Description |');
435
+ lines.push('|------|------|----------|----------|-------------|');
436
+ for (const p of BIOBRICK_PARTS) {
437
+ lines.push(`| ${p.name} | ${p.type} | ${p.registry} | ${(p.strength * 100).toFixed(0)}% | ${p.description} |`);
438
+ }
439
+ lines.push('');
440
+ lines.push('Use mode="circuit" with parts="pLac,RBS-strong,GFP,dTerm" to design a circuit.');
441
+ return lines.join('\n');
442
+ }
443
+ if (mode === 'codon') {
444
+ const seq = String(args.sequence || '').toUpperCase().replace(/[^ARNDCEQGHILKMFPSTWYV*]/g, '');
445
+ if (!seq || seq.length < 3)
446
+ return 'Provide an amino acid sequence (1-letter codes, min 3 residues). Example: sequence="MKVLFFAIV"';
447
+ const org = String(args.organism || 'ecoli').toLowerCase();
448
+ const biasTable = org === 'human' ? HUMAN_CODON_BIAS : org === 'yeast' ? YEAST_CODON_BIAS : ECOLI_CODON_BIAS;
449
+ const orgName = org === 'human' ? 'Homo sapiens' : org === 'yeast' ? 'S. cerevisiae' : 'E. coli';
450
+ lines.push(`# Codon Optimization: ${orgName}`, '');
451
+ lines.push(`**Input**: ${seq.length} amino acids`);
452
+ lines.push(`**Organism**: ${orgName}`);
453
+ lines.push('');
454
+ // Optimize codons
455
+ let dnaSeq = '';
456
+ let rnaSeq = '';
457
+ let caiSum = 0;
458
+ const codonDetails = [];
459
+ for (const aa of seq) {
460
+ const codons = CODON_TABLE[aa];
461
+ if (!codons)
462
+ continue;
463
+ // Select codon with highest bias
464
+ let bestCodon = codons[0];
465
+ let bestWeight = 0;
466
+ for (const codon of codons) {
467
+ const weight = biasTable[codon] || 0;
468
+ if (weight > bestWeight) {
469
+ bestWeight = weight;
470
+ bestCodon = codon;
471
+ }
472
+ }
473
+ rnaSeq += bestCodon;
474
+ dnaSeq += bestCodon.replace(/U/g, 'T');
475
+ caiSum += Math.log(bestWeight || 0.01);
476
+ codonDetails.push(`${aa} → ${bestCodon} (${(bestWeight * 100).toFixed(0)}%)`);
477
+ }
478
+ // Add stop codon
479
+ const stopCodons = CODON_TABLE['*'];
480
+ let bestStop = stopCodons[0];
481
+ let bestStopW = 0;
482
+ for (const s of stopCodons) {
483
+ if ((biasTable[s] || 0) > bestStopW) {
484
+ bestStopW = biasTable[s] || 0;
485
+ bestStop = s;
486
+ }
487
+ }
488
+ rnaSeq += bestStop;
489
+ dnaSeq += bestStop.replace(/U/g, 'T');
490
+ const cai = Math.exp(caiSum / seq.length);
491
+ const gcContent = (dnaSeq.match(/[GC]/g) || []).length / dnaSeq.length * 100;
492
+ lines.push(`## Optimized Sequence`);
493
+ lines.push('```');
494
+ // Format DNA in 60-char lines
495
+ for (let i = 0; i < dnaSeq.length; i += 60) {
496
+ lines.push(dnaSeq.slice(i, i + 60));
497
+ }
498
+ lines.push('```');
499
+ lines.push('');
500
+ lines.push(`## Metrics`);
501
+ lines.push(`- Length: ${dnaSeq.length} bp (${seq.length} aa)`);
502
+ lines.push(`- GC content: ${gcContent.toFixed(1)}% ${gcContent > 40 && gcContent < 60 ? '(optimal)' : '(may need adjustment)'}`);
503
+ lines.push(`- Codon Adaptation Index (CAI): ${cai.toFixed(3)} ${cai > 0.8 ? '(excellent)' : cai > 0.6 ? '(good)' : '(consider manual review)'}`);
504
+ lines.push('');
505
+ lines.push(`## Codon Table`);
506
+ lines.push('| AA | Codon | Usage |');
507
+ lines.push('|----|-------|-------|');
508
+ for (const detail of codonDetails.slice(0, 30)) {
509
+ const [aa, rest] = detail.split(' → ');
510
+ lines.push(`| ${aa} | ${rest} |`);
511
+ }
512
+ if (codonDetails.length > 30)
513
+ lines.push(`| ... | ${codonDetails.length - 30} more |`);
514
+ if (org === 'yeast') {
515
+ lines.push('');
516
+ lines.push('> **March 2026 context**: Oxford researchers engineered yeast to produce sterols for bee nutrition using optimized codon tables like this. Colonies fed the supplement produced 15x more young.');
517
+ }
518
+ return lines.join('\n');
519
+ }
520
+ if (mode === 'circuit') {
521
+ const partNames = String(args.parts || 'pLac,RBS-strong,GFP,dTerm').split(',').map(s => s.trim());
522
+ const resolvedParts = [];
523
+ for (const name of partNames) {
524
+ const part = BIOBRICK_PARTS.find(p => p.name.toLowerCase() === name.toLowerCase() || p.registry.toLowerCase() === name.toLowerCase());
525
+ if (part)
526
+ resolvedParts.push(part);
527
+ else
528
+ lines.push(`⚠ Unknown part: "${name}"`);
529
+ }
530
+ if (resolvedParts.length === 0)
531
+ return 'No valid parts found. Use mode="parts" to see available BioBrick parts.';
532
+ lines.push(`# Gene Circuit Design`, '');
533
+ // Circuit diagram
534
+ lines.push('## Circuit Diagram');
535
+ lines.push('```');
536
+ const diagram = resolvedParts.map(p => {
537
+ const icons = { promoter: '→▶', rbs: '●', cds: '█', terminator: '▌▌', reporter: '★', regulator: '◆' };
538
+ return `[${icons[p.type] || '?'} ${p.name}]`;
539
+ }).join(' — ');
540
+ lines.push(diagram);
541
+ lines.push('```');
542
+ lines.push('');
543
+ // Part details
544
+ lines.push('## Parts', '');
545
+ lines.push('| # | Part | Type | Registry | Strength | Description |');
546
+ lines.push('|---|------|------|----------|----------|-------------|');
547
+ resolvedParts.forEach((p, i) => {
548
+ lines.push(`| ${i + 1} | ${p.name} | ${p.type} | ${p.registry} | ${(p.strength * 100).toFixed(0)}% | ${p.description} |`);
549
+ });
550
+ lines.push('');
551
+ // Expression prediction
552
+ const promoter = resolvedParts.find(p => p.type === 'promoter');
553
+ const rbs = resolvedParts.find(p => p.type === 'rbs');
554
+ const terminator = resolvedParts.find(p => p.type === 'terminator');
555
+ const expressionLevel = (promoter?.strength || 0.5) * (rbs?.strength || 0.5) * (terminator?.strength || 0.8);
556
+ lines.push('## Expression Prediction');
557
+ lines.push(`- Promoter strength: ${promoter ? (promoter.strength * 100).toFixed(0) + '%' : 'none (constitutive??)'}`);
558
+ lines.push(`- RBS strength: ${rbs ? (rbs.strength * 100).toFixed(0) + '%' : 'none (will not translate!)'}`);
559
+ lines.push(`- Termination efficiency: ${terminator ? (terminator.strength * 100).toFixed(0) + '%' : 'none (read-through risk!)'}`);
560
+ lines.push(`- **Predicted expression**: ${(expressionLevel * 100).toFixed(0)}% relative units`);
561
+ lines.push('');
562
+ // Validation
563
+ const issues = [];
564
+ if (!promoter)
565
+ issues.push('Missing promoter — no transcription initiation');
566
+ if (!rbs)
567
+ issues.push('Missing RBS — mRNA will not be translated');
568
+ if (!terminator)
569
+ issues.push('Missing terminator — read-through into downstream genes');
570
+ if (!resolvedParts.find(p => p.type === 'reporter' || p.type === 'cds' || p.type === 'regulator')) {
571
+ issues.push('No coding sequence / reporter — circuit produces nothing');
572
+ }
573
+ if (issues.length > 0) {
574
+ lines.push('## ⚠ Design Issues');
575
+ for (const issue of issues)
576
+ lines.push(`- ${issue}`);
577
+ }
578
+ else {
579
+ lines.push('## ✓ Circuit Validation Passed');
580
+ lines.push('All essential components present: promoter → RBS → CDS → terminator');
581
+ }
582
+ return lines.join('\n');
583
+ }
584
+ if (mode === 'pathway') {
585
+ const target = String(args.sequence || 'ergosterol').toLowerCase();
586
+ lines.push(`# Metabolic Pathway Analysis: ${target}`, '');
587
+ // Pre-built pathways for key molecules
588
+ const pathways = {
589
+ ergosterol: {
590
+ steps: ['Acetyl-CoA', 'Acetoacetyl-CoA', 'HMG-CoA', 'Mevalonate', 'IPP/DMAPP', 'GPP', 'FPP', 'Squalene', 'Lanosterol', 'Ergosterol'],
591
+ enzymes: ['AACT', 'HMGS', 'HMGR', 'MVK/PMK/MVD', 'IDI1', 'ERG20', 'ERG9', 'ERG1/ERG7', 'ERG11→ERG5→ERG4'],
592
+ organism: 'Saccharomyces cerevisiae',
593
+ notes: 'March 2026: Oxford engineered yeast to produce sterols (including ergosterol precursors) for honeybee nutrition. Bees fed supplemented colonies produced 15x more young. Key enzyme: HMGR (rate-limiting step).',
594
+ },
595
+ ethanol: {
596
+ steps: ['Glucose', 'Glucose-6-P', 'Fructose-6-P', 'Fructose-1,6-BP', 'G3P + DHAP', 'Pyruvate', 'Acetaldehyde', 'Ethanol'],
597
+ enzymes: ['HXK', 'PGI', 'PFK', 'FBA', 'Glycolysis enzymes', 'PDC1', 'ADH1'],
598
+ organism: 'S. cerevisiae',
599
+ notes: 'Classic fermentation pathway. Theoretical yield: 0.51 g ethanol / g glucose.',
600
+ },
601
+ lycopene: {
602
+ steps: ['Acetyl-CoA', 'IPP/DMAPP', 'GPP', 'FPP', 'GGPP', 'Phytoene', 'Lycopene'],
603
+ enzymes: ['MVA pathway', 'ispA', 'crtE', 'crtB', 'crtI'],
604
+ organism: 'E. coli (engineered)',
605
+ notes: 'Common synbio demonstration. Visible red color = easy screening.',
606
+ },
607
+ insulin: {
608
+ steps: ['Preproinsulin gene', 'Transcription', 'Translation', 'Signal peptide cleavage', 'Proinsulin folding', 'C-peptide removal', 'Active insulin (A+B chains)'],
609
+ enzymes: ['T7 RNA pol', 'Ribosomes', 'Signal peptidase', 'DsbA/DsbC (disulfide)', 'Trypsin + carboxypeptidase B'],
610
+ organism: 'E. coli (recombinant)',
611
+ notes: 'First commercial biotech product (1982, Genentech/Eli Lilly). Still produced this way.',
612
+ },
613
+ artemisinin: {
614
+ steps: ['Acetyl-CoA', 'IPP/DMAPP', 'FPP', 'Amorphadiene', 'Artemisinic acid', 'Dihydroartemisinic acid', 'Artemisinin'],
615
+ enzymes: ['MVA pathway', 'ADS (amorphadiene synthase)', 'CYP71AV1', 'DBR2', 'ALDH1', 'Photochemical conversion'],
616
+ organism: 'S. cerevisiae (engineered)',
617
+ notes: 'Sanofi/Amyris semi-synthetic route. Nobel Prize 2015 (Tu Youyou). Anti-malaria drug.',
618
+ },
619
+ };
620
+ const pathway = pathways[target];
621
+ if (!pathway) {
622
+ lines.push(`No pre-built pathway for "${target}". Available pathways:`);
623
+ for (const [name, pw] of Object.entries(pathways)) {
624
+ lines.push(`- **${name}** (${pw.organism}): ${pw.steps.length} steps`);
625
+ }
626
+ return lines.join('\n');
627
+ }
628
+ lines.push(`**Organism**: ${pathway.organism}`);
629
+ lines.push(`**Steps**: ${pathway.steps.length}`);
630
+ lines.push('');
631
+ // Pathway diagram
632
+ lines.push('## Pathway');
633
+ lines.push('```');
634
+ for (let i = 0; i < pathway.steps.length; i++) {
635
+ lines.push(` ${pathway.steps[i]}`);
636
+ if (i < pathway.steps.length - 1) {
637
+ lines.push(` ↓ [${pathway.enzymes[i] || '?'}]`);
638
+ }
639
+ }
640
+ lines.push('```');
641
+ lines.push('');
642
+ // Enzyme table
643
+ lines.push('## Enzymes');
644
+ lines.push('| Step | Substrate → Product | Enzyme |');
645
+ lines.push('|------|-------------------|--------|');
646
+ for (let i = 0; i < pathway.steps.length - 1; i++) {
647
+ lines.push(`| ${i + 1} | ${pathway.steps[i]} → ${pathway.steps[i + 1]} | ${pathway.enzymes[i] || 'unknown'} |`);
648
+ }
649
+ lines.push('');
650
+ lines.push('## Notes');
651
+ lines.push(pathway.notes);
652
+ return lines.join('\n');
653
+ }
654
+ return `Unknown mode "${mode}". Options: codon, circuit, parts, pathway`;
655
+ },
656
+ });
657
+ // ─── 4. Phylogenetics Tree Builder ───────────────────────────────────
658
+ registerTool({
659
+ name: 'phylo_tree',
660
+ description: 'Phylogenetic tree visualization and divergence dating. Includes primate evolution with the March 2026 Masripithecus discovery (17-18 Mya fossil ape from Egypt, near common ancestor of all modern apes).',
661
+ parameters: {
662
+ clade: { type: 'string', description: 'Clade to display: "primates" (default), or a specific taxon name to root from' },
663
+ format: { type: 'string', description: '"tree" for ASCII tree, "table" for data table, "newick" for Newick format' },
664
+ from_mya: { type: 'number', description: 'Filter: only show taxa diverging after this many million years ago' },
665
+ to_mya: { type: 'number', description: 'Filter: only show taxa diverging before this many million years ago' },
666
+ },
667
+ tier: 'free',
668
+ timeout: 10_000,
669
+ async execute(args) {
670
+ const format = String(args.format || 'tree').toLowerCase();
671
+ const fromMya = args.from_mya ? Number(args.from_mya) : undefined;
672
+ const toMya = args.to_mya ? Number(args.to_mya) : undefined;
673
+ const lines = [];
674
+ let nodes = PRIMATE_TREE;
675
+ if (fromMya !== undefined)
676
+ nodes = nodes.filter(n => n.divergenceMya <= fromMya || n.parent === '');
677
+ if (toMya !== undefined)
678
+ nodes = nodes.filter(n => n.divergenceMya >= toMya || n.parent === '');
679
+ const rootName = String(args.clade || 'Primates');
680
+ const root = nodes.find(n => n.name.toLowerCase() === rootName.toLowerCase());
681
+ if (!root)
682
+ return `Clade "${rootName}" not found. Available: ${nodes.map(n => n.name).join(', ')}`;
683
+ if (format === 'table') {
684
+ lines.push(`# Phylogenetic Data: ${root.name}`, '');
685
+ lines.push('| Taxon | Common Name | Divergence (Mya) | Parent | Key Features |');
686
+ lines.push('|-------|-------------|------------------|--------|-------------|');
687
+ for (const n of nodes) {
688
+ lines.push(`| ${n.name} | ${n.commonName || ''} | ${n.divergenceMya} | ${n.parent || '—'} | ${(n.features || []).join(', ')} |`);
689
+ }
690
+ return lines.join('\n');
691
+ }
692
+ if (format === 'newick') {
693
+ // Build Newick string recursively
694
+ function toNewick(name) {
695
+ const children = nodes.filter(n => n.parent === name);
696
+ const node = nodes.find(n => n.name === name);
697
+ const dist = node?.divergenceMya || 0;
698
+ if (children.length === 0)
699
+ return `${name}:${dist}`;
700
+ return `(${children.map(c => toNewick(c.name)).join(',')})${name}:${dist}`;
701
+ }
702
+ lines.push(`# Newick Format: ${root.name}`, '');
703
+ lines.push('```');
704
+ lines.push(toNewick(root.name) + ';');
705
+ lines.push('```');
706
+ return lines.join('\n');
707
+ }
708
+ // ASCII tree format
709
+ lines.push(`# Primate Phylogeny`, '');
710
+ lines.push('```');
711
+ function drawTree(name, prefix, isLast) {
712
+ const node = nodes.find(n => n.name === name);
713
+ if (!node)
714
+ return;
715
+ const connector = prefix === '' ? '' : isLast ? '└── ' : '├── ';
716
+ const mya = node.divergenceMya > 0 ? ` (${node.divergenceMya} Mya)` : '';
717
+ const common = node.commonName ? ` — ${node.commonName}` : '';
718
+ const marker = node.name === 'Masripithecus' ? ' ★ NEW 2026' : '';
719
+ lines.push(`${prefix}${connector}${node.name}${common}${mya}${marker}`);
720
+ const children = nodes.filter(n => n.parent === name);
721
+ const childPrefix = prefix + (prefix === '' ? '' : isLast ? ' ' : '│ ');
722
+ children.forEach((child, i) => {
723
+ drawTree(child.name, childPrefix, i === children.length - 1);
724
+ });
725
+ }
726
+ drawTree(root.name, '', true);
727
+ lines.push('```');
728
+ lines.push('');
729
+ // Timeline
730
+ lines.push('## Divergence Timeline');
731
+ const sorted = [...nodes].sort((a, b) => b.divergenceMya - a.divergenceMya);
732
+ for (const n of sorted) {
733
+ if (n.divergenceMya > 0 && n.parent) {
734
+ const bar = '█'.repeat(Math.max(1, Math.round(n.divergenceMya / 5)));
735
+ lines.push(`${String(n.divergenceMya).padStart(5)} Mya ${bar} ${n.name}${n.commonName ? ' (' + n.commonName + ')' : ''}`);
736
+ }
737
+ }
738
+ lines.push('');
739
+ // Masripithecus highlight
740
+ lines.push('## March 2026 Discovery: Masripithecus');
741
+ lines.push('- **Age**: 17-18 million years ago');
742
+ lines.push('- **Location**: Northern Egypt');
743
+ lines.push('- **Significance**: Sits very close to the common ancestor of ALL modern apes');
744
+ lines.push('- **Impact**: Reshapes the timeline of ape origins — suggests hominoids diversified in Africa earlier than previously thought');
745
+ lines.push('- **Previous view**: Great ape origins ~14 Mya in Africa');
746
+ lines.push('- **New view**: Ape diversification began ~17-18 Mya, with Masripithecus as a near-basal hominoid');
747
+ return lines.join('\n');
748
+ },
749
+ });
750
+ // ─── 5. Planetary Atmosphere Simulator ───────────────────────────────
751
+ registerTool({
752
+ name: 'planetary_atmo',
753
+ description: 'Planetary atmosphere modeling — composition, temperature profiles, pressure, storm energetics, and lightning. Includes March 2026 Juno discovery: Jupiter lightning up to 1 million times more powerful than Earth.',
754
+ parameters: {
755
+ planet: { type: 'string', description: 'Planet/body name, or "compare" for comparison table, or "list" for all' },
756
+ altitude_km: { type: 'number', description: 'Altitude for temperature/pressure profile (default: surface)' },
757
+ compare_to: { type: 'string', description: 'Second planet for side-by-side comparison' },
758
+ },
759
+ tier: 'free',
760
+ timeout: 10_000,
761
+ async execute(args) {
762
+ const lines = [];
763
+ if (String(args.planet) === 'list' || String(args.planet) === 'compare') {
764
+ lines.push('## Planetary Atmospheres', '');
765
+ lines.push('| Body | Temp (K) | Pressure (atm) | Max Wind (m/s) | Lightning | Scale Height |');
766
+ lines.push('|------|----------|----------------|----------------|-----------|-------------|');
767
+ for (const [, p] of Object.entries(PLANETARY_ATMOSPHERES)) {
768
+ lines.push(`| ${p.name} | ${p.surfaceTempK} | ${p.surfacePressureAtm} | ${p.maxWindSpeedMs} | ${p.hasLightning ? `Yes (${p.lightningEnergyJ?.toExponential(0) || '?'} J)` : 'No'} | ${p.scaleHeightKm} km |`);
769
+ }
770
+ return lines.join('\n');
771
+ }
772
+ const key = String(args.planet || 'jupiter').toLowerCase().replace(/[\s-]/g, '_');
773
+ const planet = PLANETARY_ATMOSPHERES[key];
774
+ if (!planet)
775
+ return `Planet "${args.planet}" not found. Use planet="list" to see options: ${Object.keys(PLANETARY_ATMOSPHERES).join(', ')}`;
776
+ const alt = Number(args.altitude_km) || 0;
777
+ lines.push(`# ${planet.name} Atmosphere`, '');
778
+ lines.push(`## Surface Conditions`);
779
+ lines.push(`- Temperature: ${planet.surfaceTempK} K (${(planet.surfaceTempK - 273.15).toFixed(0)}°C)`);
780
+ lines.push(`- Pressure: ${planet.surfacePressureAtm} atm`);
781
+ lines.push(`- Scale height: ${planet.scaleHeightKm} km`);
782
+ lines.push(`- Max wind speed: ${planet.maxWindSpeedMs} m/s (${(planet.maxWindSpeedMs * 3.6).toFixed(0)} km/h)`);
783
+ lines.push('');
784
+ // Composition
785
+ lines.push('## Atmospheric Composition');
786
+ lines.push('| Gas | % by Volume |');
787
+ lines.push('|-----|------------|');
788
+ const sorted = Object.entries(planet.composition).sort((a, b) => b[1] - a[1]);
789
+ for (const [gas, pct] of sorted) {
790
+ const bar = '█'.repeat(Math.max(1, Math.round(pct / 5)));
791
+ lines.push(`| ${gas} | ${pct}% ${bar} |`);
792
+ }
793
+ lines.push('');
794
+ // Altitude profile (barometric formula)
795
+ if (alt > 0) {
796
+ lines.push(`## Altitude Profile (${alt} km)`);
797
+ const g_earth = 9.81;
798
+ const gMap = { mercury: 3.7, venus: 8.87, earth: 9.81, mars: 3.72, jupiter: 24.79, saturn: 10.44, uranus: 8.69, neptune: 11.15, titan: 1.35, exo_trappist1e: 9.0 };
799
+ const g = gMap[key] || 9.81;
800
+ const T = planet.surfaceTempK * (1 - 0.0065 * Math.min(alt, planet.scaleHeightKm * 3) / planet.scaleHeightKm * 0.15); // simplified lapse rate
801
+ const P = planet.surfacePressureAtm * Math.exp(-alt / planet.scaleHeightKm);
802
+ lines.push(`- Temperature at ${alt} km: ~${T.toFixed(0)} K (${(T - 273.15).toFixed(0)}°C)`);
803
+ lines.push(`- Pressure at ${alt} km: ~${P.toExponential(2)} atm`);
804
+ lines.push(`- Surface gravity: ${g.toFixed(2)} m/s²`);
805
+ lines.push(`- Air density ratio: ~${Math.exp(-alt / planet.scaleHeightKm).toExponential(2)}`);
806
+ lines.push('');
807
+ }
808
+ // Lightning
809
+ if (planet.hasLightning) {
810
+ lines.push('## Lightning');
811
+ lines.push(`- Lightning detected: **Yes**`);
812
+ if (planet.lightningEnergyJ) {
813
+ const earthJ = 1e9;
814
+ const ratio = planet.lightningEnergyJ / earthJ;
815
+ lines.push(`- Energy per flash: ~${planet.lightningEnergyJ.toExponential(0)} J`);
816
+ lines.push(`- Compared to Earth: **${ratio >= 1000 ? ratio.toExponential(0) : ratio.toFixed(0)}x** ${ratio > 1 ? 'more powerful' : 'less powerful'}`);
817
+ if (key === 'jupiter') {
818
+ lines.push('');
819
+ lines.push('### March 2026 Juno Discovery');
820
+ lines.push('- Juno spacecraft detected lightning up to **1 million times** more powerful than terrestrial lightning');
821
+ lines.push('- Triggered by a previously undetected "stealth superstorm" in 2021-2022');
822
+ lines.push('- Storm was hidden beneath the upper cloud layers, only visible in radio/microwave');
823
+ lines.push('- Challenges models of jovian convection — storms can form and intensify without visible signatures');
824
+ }
825
+ }
826
+ lines.push('');
827
+ }
828
+ // Notes
829
+ lines.push(`## Notes`);
830
+ lines.push(planet.notes);
831
+ // Side-by-side comparison
832
+ if (args.compare_to) {
833
+ const key2 = String(args.compare_to).toLowerCase().replace(/[\s-]/g, '_');
834
+ const p2 = PLANETARY_ATMOSPHERES[key2];
835
+ if (p2) {
836
+ lines.push('');
837
+ lines.push(`## Comparison: ${planet.name} vs ${p2.name}`);
838
+ lines.push('| Property | ' + planet.name + ' | ' + p2.name + ' |');
839
+ lines.push('|----------|' + '-'.repeat(planet.name.length + 2) + '|' + '-'.repeat(p2.name.length + 2) + '|');
840
+ lines.push(`| Temperature | ${planet.surfaceTempK} K | ${p2.surfaceTempK} K |`);
841
+ lines.push(`| Pressure | ${planet.surfacePressureAtm} atm | ${p2.surfacePressureAtm} atm |`);
842
+ lines.push(`| Max wind | ${planet.maxWindSpeedMs} m/s | ${p2.maxWindSpeedMs} m/s |`);
843
+ lines.push(`| Lightning | ${planet.hasLightning ? 'Yes' : 'No'} | ${p2.hasLightning ? 'Yes' : 'No'} |`);
844
+ lines.push(`| Scale height | ${planet.scaleHeightKm} km | ${p2.scaleHeightKm} km |`);
845
+ }
846
+ }
847
+ return lines.join('\n');
848
+ },
849
+ });
850
+ // ─── 6. Frontier News Mapper ─────────────────────────────────────────
851
+ registerTool({
852
+ name: 'frontier_news',
853
+ description: 'Maps the latest frontier science discoveries to kbot tools you can use right now. Bridges breaking science news to computational exploration.',
854
+ parameters: {
855
+ topic: { type: 'string', description: '"all" for full map, or a topic: tissue, solar, synbio, phylo, atmo, particles' },
856
+ },
857
+ tier: 'free',
858
+ timeout: 5_000,
859
+ async execute(args) {
860
+ const topic = String(args.topic || 'all').toLowerCase();
861
+ const lines = [];
862
+ lines.push('# Frontier Science → kbot Tools', '');
863
+ lines.push('*How to explore this week\'s breakthroughs from your terminal*', '');
864
+ const sections = {
865
+ tissue: `## Lab-Grown Oesophagus (March 2026)
866
+ **Discovery**: Great Ormond Street Hospital + UCL created the first lab-grown oesophagus that works in a growing animal without immunosuppression.
867
+ **Explore with kbot**:
868
+ - \`tissue_engineer organ=oesophagus\` — simulate the scaffold + cell growth
869
+ - \`tissue_engineer organ=oesophagus material=recommend\` — see why decellularized ECM was chosen
870
+ - \`tissue_engineer organ=list\` — compare difficulty across all organ types
871
+ - \`tissue_engineer organ=kidney\` — see what's hardest to build next`,
872
+ solar: `## 130% Solar Efficiency via Singlet Fission (March 2026)
873
+ **Discovery**: Spin-flip metal complex achieved ~130% quantum efficiency by generating 2 excitons from 1 photon.
874
+ **Explore with kbot**:
875
+ - \`solar_cell_model material="singlet fission"\` — model the breakthrough material
876
+ - \`solar_cell_model material="perovskite" tandem="silicon"\` — design a tandem cell
877
+ - \`solar_cell_model material=compare\` — compare all 11 PV technologies
878
+ - \`solar_cell_model material="silicon" area_m2=100 hours_per_day=6\` — model a rooftop install`,
879
+ synbio: `## Engineered Bee Yeast (March 2026)
880
+ **Discovery**: Oxford engineered S. cerevisiae to produce essential sterols for honeybees. Colonies produced 15x more young.
881
+ **Explore with kbot**:
882
+ - \`synbio_design mode=pathway sequence=ergosterol\` — see the sterol synthesis pathway
883
+ - \`synbio_design mode=codon sequence="MKVLFFAIV" organism=yeast\` — optimize a gene for yeast
884
+ - \`synbio_design mode=circuit parts="pBAD,RBS-strong,GFP,dTerm"\` — design a gene circuit
885
+ - \`synbio_design mode=parts\` — browse BioBrick standard parts`,
886
+ phylo: `## Masripithecus Fossil Ape (March 2026)
887
+ **Discovery**: 17-18 Mya fossil ape from Egypt near the common ancestor of all modern apes.
888
+ **Explore with kbot**:
889
+ - \`phylo_tree clade=Primates\` — see the full primate tree with Masripithecus marked
890
+ - \`phylo_tree clade=Hominoidea\` — zoom into ape evolution
891
+ - \`phylo_tree format=newick\` — export for phylogenetics software
892
+ - \`phylo_tree from_mya=20 to_mya=10\` — focus on the 10-20 Mya window where apes diversified`,
893
+ atmo: `## Jupiter Mega-Lightning (March 2026)
894
+ **Discovery**: Juno found lightning up to 1 million times more powerful than Earth's, from a hidden superstorm.
895
+ **Explore with kbot**:
896
+ - \`planetary_atmo planet=jupiter\` — full atmospheric profile + lightning data
897
+ - \`planetary_atmo planet=jupiter compare_to=earth\` — side-by-side comparison
898
+ - \`planetary_atmo planet=list\` — compare all 10 planetary atmospheres
899
+ - \`planetary_atmo planet=titan\` — explore Titan's methane weather system`,
900
+ particles: `## CERN Ξcc⁺ Baryon (March 2026)
901
+ **Discovery**: LHCb confirmed the doubly charmed baryon with high statistical significance.
902
+ **Explore with kbot**:
903
+ - \`particle_physics_data query="Xi_cc+"\` — look up the new particle
904
+ - \`particle_physics_data query="charmed baryon"\` — compare with other charmed hadrons
905
+ - \`particle_physics_data\` — browse all 72+ particles in the database`,
906
+ };
907
+ if (topic === 'all') {
908
+ for (const s of Object.values(sections)) {
909
+ lines.push(s);
910
+ lines.push('');
911
+ }
912
+ }
913
+ else {
914
+ const section = sections[topic];
915
+ if (section) {
916
+ lines.push(section);
917
+ }
918
+ else {
919
+ lines.push(`Topic "${topic}" not found. Available: ${Object.keys(sections).join(', ')}`);
920
+ }
921
+ }
922
+ return lines.join('\n');
923
+ },
924
+ });
925
+ }
926
+ //# sourceMappingURL=lab-frontier.js.map