@inflexa-ai/harness 0.12.0 → 0.14.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.
Files changed (207) hide show
  1. package/dist/agents/conversation-agent.d.ts +9 -15
  2. package/dist/agents/conversation-agent.js +32 -31
  3. package/dist/agents/sandbox/cheminformatics-agent.js +1 -1
  4. package/dist/agents/sandbox/chromatin-agent.js +1 -1
  5. package/dist/agents/sandbox/dna-methylation-agent.js +1 -1
  6. package/dist/agents/sandbox/drug-repurposing-agent.js +5 -10
  7. package/dist/agents/sandbox/enrichment-agent.js +1 -1
  8. package/dist/agents/sandbox/genomic-variant-agent.js +1 -11
  9. package/dist/agents/sandbox/immune-profiling-agent.js +1 -1
  10. package/dist/agents/sandbox/index.js +0 -3
  11. package/dist/agents/sandbox/multi-omics-integration-agent.js +1 -1
  12. package/dist/agents/sandbox/network-agent.js +1 -1
  13. package/dist/agents/sandbox/pkpd-clinical-response-agent.js +3 -6
  14. package/dist/agents/sandbox/scientific-executor.js +1 -1
  15. package/dist/agents/sandbox/shared.d.ts +2 -2
  16. package/dist/agents/sandbox/shared.js +8 -14
  17. package/dist/agents/sandbox/translational-safety-agent.js +4 -7
  18. package/dist/agents/sandbox/types.d.ts +5 -5
  19. package/dist/agents/sandbox/types.js +4 -4
  20. package/dist/app/chat-turn.js +4 -1
  21. package/dist/app/message-assembly.d.ts +5 -2
  22. package/dist/app/message-assembly.js +7 -2
  23. package/dist/app/run-activity.d.ts +13 -0
  24. package/dist/app/run-activity.js +51 -0
  25. package/dist/config/resource-limits.d.ts +0 -7
  26. package/dist/config/resource-limits.js +0 -1
  27. package/dist/contracts/target-dossier.d.ts +10 -10
  28. package/dist/execution/dbos-run-launcher.js +1 -26
  29. package/dist/execution/report-runner.js +1 -1
  30. package/dist/execution/run-authorizer.d.ts +1 -1
  31. package/dist/execution/run-authorizer.js +1 -1
  32. package/dist/execution/run-event-parts.d.ts +44 -0
  33. package/dist/execution/run-event-parts.js +0 -0
  34. package/dist/execution/run-event-stream.d.ts +91 -0
  35. package/dist/execution/run-event-stream.js +212 -0
  36. package/dist/execution/run-launcher.d.ts +2 -18
  37. package/dist/execution/run-launcher.js +2 -4
  38. package/dist/execution/run-synthesis.js +1 -1
  39. package/dist/index.d.ts +7 -4
  40. package/dist/index.js +23 -6
  41. package/dist/input-sanitization.d.ts +14 -4
  42. package/dist/input-sanitization.js +27 -4
  43. package/dist/lib/storage.js +4 -1
  44. package/dist/loop/budget-exceeded.d.ts +18 -2
  45. package/dist/loop/budget-exceeded.js +49 -2
  46. package/dist/loop/run-agent.d.ts +22 -1
  47. package/dist/loop/run-agent.js +51 -5
  48. package/dist/loop/run-to-terminal.d.ts +0 -2
  49. package/dist/loop/run-to-terminal.js +8 -1
  50. package/dist/memory/ai-sdk-message-storage.d.ts +37 -4
  51. package/dist/memory/ai-sdk-message-storage.js +45 -4
  52. package/dist/memory/content-to-cortex.js +19 -3
  53. package/dist/memory/message-backfill.js +1 -1
  54. package/dist/memory/reconstruct-cards.d.ts +1 -1
  55. package/dist/memory/reconstruct-cards.js +7 -5
  56. package/dist/memory/thread-history.js +72 -8
  57. package/dist/prompts/conversation.d.ts +1 -1
  58. package/dist/prompts/conversation.js +41 -15
  59. package/dist/prompts/literature-reviewer.d.ts +1 -1
  60. package/dist/prompts/literature-reviewer.js +16 -14
  61. package/dist/prompts/planner.d.ts +3 -0
  62. package/dist/prompts/planner.js +16 -21
  63. package/dist/prompts/sandbox/drug-repurposing-agent.d.ts +1 -1
  64. package/dist/prompts/sandbox/drug-repurposing-agent.js +31 -22
  65. package/dist/prompts/sandbox/multi-omics-integration-agent.d.ts +1 -1
  66. package/dist/prompts/sandbox/multi-omics-integration-agent.js +9 -10
  67. package/dist/prompts/sandbox/pkpd-clinical-response-agent.d.ts +1 -1
  68. package/dist/prompts/sandbox/pkpd-clinical-response-agent.js +8 -7
  69. package/dist/prompts/sandbox/translational-safety-agent.d.ts +1 -1
  70. package/dist/prompts/sandbox/translational-safety-agent.js +20 -14
  71. package/dist/prompts/sandbox-standards.d.ts +4 -4
  72. package/dist/prompts/sandbox-standards.js +5 -5
  73. package/dist/prompts/synthesis-agent.d.ts +1 -1
  74. package/dist/prompts/synthesis-agent.js +7 -7
  75. package/dist/providers/errors.d.ts +7 -0
  76. package/dist/providers/errors.js +88 -3
  77. package/dist/runtime/assemble.d.ts +5 -10
  78. package/dist/runtime/assemble.js +0 -4
  79. package/dist/runtime/boot.d.ts +2 -2
  80. package/dist/runtime/boot.js +1 -1
  81. package/dist/runtime/dbos.d.ts +4 -5
  82. package/dist/runtime/dbos.js +6 -7
  83. package/dist/runtime/pools.d.ts +15 -1
  84. package/dist/runtime/pools.js +15 -1
  85. package/dist/sandbox/mount-plan.d.ts +1 -1
  86. package/dist/sandbox/sandbox-error.d.ts +1 -1
  87. package/dist/sandbox/sandbox-error.js +1 -1
  88. package/dist/sandbox/sandbox-step-translate.d.ts +15 -2
  89. package/dist/sandbox/sandbox-step-translate.js +17 -2
  90. package/dist/sandbox/types.d.ts +1 -1
  91. package/dist/schemas/validate-plan.d.ts +1 -1
  92. package/dist/schemas/workflow-state.d.ts +2 -2
  93. package/dist/schemas/workflow-state.js +2 -2
  94. package/dist/state/data-profile.d.ts +53 -1
  95. package/dist/state/data-profile.js +66 -6
  96. package/dist/state/index.d.ts +6 -6
  97. package/dist/state/index.js +4 -4
  98. package/dist/state/init.js +37 -2
  99. package/dist/state/plans.js +1 -1
  100. package/dist/state/runs.d.ts +49 -0
  101. package/dist/state/runs.js +150 -0
  102. package/dist/tasks/data-profile-activity.d.ts +87 -0
  103. package/dist/tasks/data-profile-activity.js +56 -0
  104. package/dist/tasks/data-profile.js +66 -4
  105. package/dist/tools/__fixtures__/tool-context.js +1 -0
  106. package/dist/tools/ad-hoc-router.d.ts +31 -0
  107. package/dist/tools/ad-hoc-router.js +132 -0
  108. package/dist/tools/analysis-invocation.d.ts +4 -0
  109. package/dist/tools/analysis-invocation.js +17 -0
  110. package/dist/tools/bio/chembl.d.ts +1 -1
  111. package/dist/tools/bio/chembl.js +51 -54
  112. package/dist/tools/bio/comptox.js +35 -33
  113. package/dist/tools/bio/drug-gene-interactions.d.ts +76 -0
  114. package/dist/tools/bio/drug-gene-interactions.js +175 -0
  115. package/dist/tools/bio/gene-disease-evidence.d.ts +61 -0
  116. package/dist/tools/bio/gene-disease-evidence.js +187 -0
  117. package/dist/tools/bio/gene-preclinical-profile.d.ts +58 -0
  118. package/dist/tools/bio/gene-preclinical-profile.js +125 -0
  119. package/dist/tools/bio/index.d.ts +23 -16
  120. package/dist/tools/bio/index.js +29 -22
  121. package/dist/tools/bio/keys.d.ts +16 -9
  122. package/dist/tools/bio/keys.js +22 -13
  123. package/dist/tools/bio/lookup-annotation.d.ts +48 -0
  124. package/dist/tools/bio/lookup-annotation.js +173 -0
  125. package/dist/tools/bio/opentargets.d.ts +7 -11
  126. package/dist/tools/bio/opentargets.js +24 -35
  127. package/dist/tools/bio/pubchem.js +6 -4
  128. package/dist/tools/bio/pubmed.d.ts +15 -7
  129. package/dist/tools/bio/pubmed.js +79 -20
  130. package/dist/tools/bio/search-clinical-trials.d.ts +20 -1
  131. package/dist/tools/bio/search-clinical-trials.js +26 -5
  132. package/dist/tools/bio/search-faers.js +9 -3
  133. package/dist/tools/bio/search-gene.d.ts +0 -1
  134. package/dist/tools/bio/search-gene.js +4 -5
  135. package/dist/tools/bio/search-geo-datasets.js +10 -4
  136. package/dist/tools/bio/search-interactions.d.ts +8 -4
  137. package/dist/tools/bio/search-interactions.js +28 -12
  138. package/dist/tools/bio/target-safety.d.ts +59 -0
  139. package/dist/tools/bio/target-safety.js +191 -0
  140. package/dist/tools/define-tool.d.ts +6 -2
  141. package/dist/tools/define-tool.js +1 -1
  142. package/dist/tools/execute-analysis.d.ts +44 -0
  143. package/dist/tools/execute-analysis.js +252 -0
  144. package/dist/tools/iterate-report.js +7 -6
  145. package/dist/tools/lib/dgidb-client.d.ts +49 -0
  146. package/dist/tools/lib/dgidb-client.js +168 -0
  147. package/dist/tools/lib/disgenet-client.d.ts +56 -0
  148. package/dist/tools/lib/disgenet-client.js +59 -0
  149. package/dist/tools/lib/drugbank-client.d.ts +83 -0
  150. package/dist/tools/lib/drugbank-client.js +95 -0
  151. package/dist/tools/lib/ensembl-client.d.ts +4 -1
  152. package/dist/tools/lib/ensembl-client.js +5 -3
  153. package/dist/tools/lib/gwas-catalog-client.d.ts +60 -0
  154. package/dist/tools/lib/gwas-catalog-client.js +136 -0
  155. package/dist/tools/lib/pharmgkb-client.d.ts +22 -0
  156. package/dist/tools/lib/pharmgkb-client.js +32 -0
  157. package/dist/tools/lib/pubmed-client.d.ts +57 -4
  158. package/dist/tools/lib/pubmed-client.js +57 -3
  159. package/dist/tools/lib/string-client.d.ts +25 -4
  160. package/dist/tools/lib/string-client.js +22 -5
  161. package/dist/tools/research/generate-plan.d.ts +16 -9
  162. package/dist/tools/research/generate-plan.js +116 -70
  163. package/dist/tools/research/inspect-data-profile.d.ts +31 -6
  164. package/dist/tools/research/inspect-data-profile.js +23 -7
  165. package/dist/tools/research/inspect-run.d.ts +33 -15
  166. package/dist/tools/research/inspect-run.js +155 -66
  167. package/dist/tools/research/literature-reviewer.js +7 -11
  168. package/dist/workflows/execute-analysis.d.ts +68 -5
  169. package/dist/workflows/execute-analysis.js +76 -7
  170. package/dist/workflows/sandbox-step.js +1 -11
  171. package/dist/workflows/target-assessment/decisions/index.d.ts +1 -1
  172. package/dist/workflows/target-assessment/phase4-assemble.d.ts +1 -1
  173. package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +2 -2
  174. package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +1 -1
  175. package/package.json +1 -1
  176. package/dist/agents/sandbox/ephemeral-executor.d.ts +0 -9
  177. package/dist/agents/sandbox/ephemeral-executor.js +0 -20
  178. package/dist/execution/ephemeral-runner.d.ts +0 -98
  179. package/dist/execution/ephemeral-runner.js +0 -189
  180. package/dist/prompts/sandbox/ephemeral-executor.d.ts +0 -1
  181. package/dist/prompts/sandbox/ephemeral-executor.js +0 -66
  182. package/dist/tools/bio/check-safety-panel.d.ts +0 -35
  183. package/dist/tools/bio/check-safety-panel.js +0 -76
  184. package/dist/tools/bio/get-impc-ko-profile.d.ts +0 -9
  185. package/dist/tools/bio/get-impc-ko-profile.js +0 -23
  186. package/dist/tools/bio/lookup-go-term.d.ts +0 -31
  187. package/dist/tools/bio/lookup-go-term.js +0 -116
  188. package/dist/tools/bio/search-bgee-expression.d.ts +0 -10
  189. package/dist/tools/bio/search-bgee-expression.js +0 -30
  190. package/dist/tools/bio/search-clinvar.d.ts +0 -13
  191. package/dist/tools/bio/search-clinvar.js +0 -28
  192. package/dist/tools/bio/search-dgidb.d.ts +0 -53
  193. package/dist/tools/bio/search-dgidb.js +0 -213
  194. package/dist/tools/bio/search-disgenet.d.ts +0 -30
  195. package/dist/tools/bio/search-disgenet.js +0 -84
  196. package/dist/tools/bio/search-drugbank.d.ts +0 -38
  197. package/dist/tools/bio/search-drugbank.js +0 -109
  198. package/dist/tools/bio/search-gwas-catalog.d.ts +0 -33
  199. package/dist/tools/bio/search-gwas-catalog.js +0 -172
  200. package/dist/tools/bio/search-pathway.d.ts +0 -12
  201. package/dist/tools/bio/search-pathway.js +0 -32
  202. package/dist/tools/bio/search-pharmgkb.d.ts +0 -17
  203. package/dist/tools/bio/search-pharmgkb.js +0 -52
  204. package/dist/tools/execute-plan.d.ts +0 -64
  205. package/dist/tools/execute-plan.js +0 -211
  206. package/dist/tools/run-ephemeral.d.ts +0 -33
  207. package/dist/tools/run-ephemeral.js +0 -65
@@ -1,6 +1,6 @@
1
1
  /** The Resource Estimation planning rules — concrete host limits when a
2
2
  * policy is supplied, the historical default guidance otherwise. */
3
- function resourceEstimationSection(policy) {
3
+ export function resourceEstimationSection(policy) {
4
4
  const base = `Use the data context to estimate cpu and memoryGb for each step. Consider
5
5
  total file size, per-file sizes, feature x sample dimensions, and what the
6
6
  step actually does in memory. Be conservative — a 14 MB dataset does not
@@ -49,29 +49,24 @@ your work is discarded and the user sees nothing. Every session MUST end
49
49
  with exactly one call to \`submit_plan\`, \`request_clarification\`, or
50
50
  \`report_blocker\`.
51
51
 
52
- Your very first action must be either \`validate_plan\` (to test a draft)
52
+ Your very first action must be either \`submit_plan\`
53
53
  or \`request_clarification\` / \`report_blocker\` (if you cannot draft one).
54
54
  Do NOT respond with text before any tool call.
55
55
 
56
56
  ## Canonical Flow
57
57
 
58
- The plan's shape is the \`validate_plan\` / \`submit_plan\` arg schema —
59
- read it, and fill every field it declares.
58
+ The plan's shape is the \`submit_plan\` arg schema — read it, and fill
59
+ every field it declares.
60
60
 
61
- \`validate_plan(draft)\` → inspect issues → \`validate_plan(fixed)\` →
62
- \`valid: true\` → \`submit_plan(fixed)\` → \`accepted: true\`. STOP.
63
-
64
- \`validate_plan\` is cheap, deterministic, and non-terminal — call it as
65
- many times as needed. You MUST get \`valid: true\` from it before calling
66
- \`submit_plan\`. If issues come back, fix the specific field at the given
67
- path and validate again.
61
+ \`submit_plan(candidate)\` → if rejected, inspect its structured \`issues\`,
62
+ fix the specific fields, and call \`submit_plan\` again →
63
+ \`accepted: true\`. STOP.
68
64
 
69
65
  Typical run: 2–4 tool calls total. Every run ends with ONE terminal
70
66
  tool call. No exceptions.
71
67
 
72
68
  ## Do NOT
73
69
  - Respond with plain text (even to explain the plan — the user never sees it).
74
- - Call \`submit_plan\` without first getting \`valid: true\` from \`validate_plan\`.
75
70
  - Call any terminal tool twice.
76
71
  - Continue generating after \`submit_plan\` returned \`accepted: true\`.
77
72
  - End the session without a terminal tool call. That is a failure mode.
@@ -242,15 +237,16 @@ safety, toxicity, or treatment outcomes:
242
237
  route these to the cheminformatics-agent (which focuses on
243
238
  compound characterization, not repurposing).
244
239
 
245
- 8. **Anchor off-target safety with the curated panel.** When the
246
- research question involves a drug candidate, target selectivity,
247
- or off-target liability assessment, include an early
248
- \`check_safety_panel\` step (executed by the
249
- translational-safety-agent or drug-repurposing-agent) against
250
- the candidate's known targets. This gives downstream
240
+ 8. **Anchor off-target safety early.** When the research question
241
+ involves a drug candidate, target selectivity, or off-target
242
+ liability assessment, include an early \`target_safety\` step
243
+ (executed by the translational-safety-agent or
244
+ drug-repurposing-agent) against the candidate's known targets. It
245
+ screens the curated secondary-pharmacology panel and the curated
246
+ Open Targets liabilities in one call, giving downstream
251
247
  interpretation a deterministic anchor before the deeper analyses
252
- those sandbox agents run — \`opentargets({action:"safety"})\`,
253
- \`comptox({dataset:"toxcast"})\`, or PRISM signatures.
248
+ those sandbox agents run — \`comptox({dataset:"toxcast"})\` or
249
+ PRISM signatures.
254
250
 
255
251
  Do NOT add translational steps speculatively — only when the research
256
252
  question or data context explicitly supports them.
@@ -261,7 +257,6 @@ question or data context explicitly supports them.
261
257
  - Produce vague step descriptions
262
258
  - Ignore prior run results mentioned in context
263
259
  - Generate a plan without referencing specific data characteristics
264
- - Call \`submit_plan\` without first calling \`validate_plan\`
265
260
  - Respond with prose instead of a tool call
266
261
  `;
267
262
  }
@@ -1 +1 @@
1
- export declare const drugRepurposingAgentPrompt = "# Drug Repurposing Agent\n\nYou are a computational drug repurposing specialist. You identify\nexisting drugs for new therapeutic indications using signature-based,\ntarget-based, network-based, and genetics-based approaches. You\nintegrate evidence from multiple sources to rank and prioritize\nrepurposing candidates.\n\n## Skills\n\nYour skills: `drug-repurposing`, `cheminformatics`,\n`shared/omics-general`.\n\n`drug-repurposing` carries connectivity scoring, network proximity, genetic\nevidence scoring, and multi-evidence integration patterns. `cheminformatics`\nhas the RDKit/datamol API references for assessing candidate compound\nproperties.\n\n## Conditional Tools\n\nIf a tool mentioned below is not in your tool list, do not attempt to call it or fabricate\nits output. Work with the tools you have.\n\n- `search_drugbank` \u2014 requires DRUGBANK_API_KEY\n- `search_disgenet` \u2014 requires DISGENET_API_KEY\n- EPA CTX tool (`comptox`, datasets toxcast / hazard / chemical /\n exposure) \u2014 requires EPA_CCTE_API_KEY\n\n## Core Capabilities\n\n1. **Signature-based repurposing** \u2014 query disease DE signatures\n against drug perturbation profiles using CMap-style connectivity\n scoring (gseapy.prerank). Drugs that REVERSE the disease\n signature are therapeutic candidates.\n\n2. **Target-based repurposing** \u2014 map disease-relevant targets to\n existing drugs via ChEMBL (`chembl`, actions compounds / drug /\n mechanism) and DrugBank (`search_drugbank`, conditional).\n Prioritize approved and clinical-stage drugs.\n\n3. **Genetics-based repurposing** \u2014 use genetic evidence (GWAS,\n DisGeNET conditional) to identify targets with causal disease links, then map\n to existing drugs. Genetic support increases clinical success\n probability ~2x.\n\n4. **Network proximity analysis** \u2014 compute PPI network proximity\n between drug target sets and disease gene modules. Closer\n proximity = more likely to modulate disease biology.\n\n5. **Clinical evidence mining** \u2014 use `search_clinical_trials` to\n check if candidates are already in trials for the target\n indication. Use `pubmed` for published evidence.\n\n6. **Safety assessment** \u2014 use `search_faers` to assess real-world\n safety for the proposed patient population. Flag drugs with\n contraindications for the target indication.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 understand what data is available. Disease DE\n results? Target gene list? GWAS associations? PPI network?\n2. **Select strategy** \u2014 choose repurposing approach(es) based on\n available data (signature, target, genetics, network).\n3. **Discover candidates** \u2014 apply chosen method(s) to identify\n candidate drugs.\n4. **Validate** \u2014 mine clinical trials, literature, and safety data\n for each candidate.\n5. **Integrate** \u2014 combine evidence from multiple sources. Rank\n candidates by composite score.\n6. **Report** \u2014 candidate table with evidence breakdown, evidence\n heatmap, limitations.\n\n## Tool Usage for Candidate Discovery\n\n### From Targets (ChEMBL workflow)\n1. `chembl({action:\"targets\"})` \u2014 resolve gene symbols to target ChEMBL IDs.\n2. `chembl({action:\"compounds\", searchType:\"target\"})` \u2014 find active compounds.\n3. `chembl({action:\"drug\"})` \u2014 check approval status and existing indications.\n4. `chembl({action:\"mechanism\"})` \u2014 verify mechanism relevance.\n\n### From Targets (DrugBank workflow, conditional)\n1. `search_drugbank(searchType: \"target\")` \u2014 find drugs for a gene.\n2. Review indications, interactions, and toxicity.\n\n### From Genetic Evidence\n1. `search_gwas_catalog` \u2014 find GWAS associations for the disease.\n2. `search_disgenet` (conditional) \u2014 get gene-disease scores.\n3. `opentargets({action:\"target\"})` \u2014 check target tractability and drug scores.\n\n### Validation Layer\n1. `search_clinical_trials` \u2014 existing trials for drug + indication.\n2. `search_faers` \u2014 adverse event profile.\n3. `pubmed` \u2014 published evidence.\n\n### Preclinical Target Intelligence\n1. `search_bgee_expression` (geneSymbol) \u2014 cross-species baseline\n expression for the proposed target. Confirms the target is expressed\n in tissues relevant to the new indication and that model-organism\n surrogates are sensible.\n2. `get_impc_ko_profile` (geneSymbol) \u2014 mouse-KO phenotype + viability\n (per-zygosity breakdown plus a derived top-line lethal / subviable /\n viable). A complete-penetrance lethal KO is a hard tractability flag;\n a clean viable KO with no organ-system phenotypes is a positive\n tractability signal.\n3. Treat empty/null outputs as valid \"no data\" (not all genes have\n IMPC mouse lines; Bgee can be sparse for dog/macaque). Do NOT retry.\n\n## Required Figures\n\n- **Candidate ranking bar chart** \u2014 top candidates by composite\n score, colored by number of evidence lines.\n- **Evidence heatmap** \u2014 candidates x evidence types, showing which\n evidence supports each candidate.\n- **Connectivity score plot** \u2014 NES distribution for signature-based\n hits (if applicable).\n\n## Domain Anti-Patterns\n\n- Presenting computational repurposing candidates as validated\n therapeutics. They are hypotheses.\n- Connectivity scoring without permutation significance testing.\n- Ranking candidates by a single evidence type.\n- Ignoring existing indications \u2014 a drug already approved for the\n target disease is not a repurposing candidate.\n- Skipping safety assessment for proposed new patient populations.\n- Using outdated perturbation databases without noting the version.\n- Ignoring drug-drug interactions when proposing repurposed drugs for\n patients likely on existing therapies.\n- Calling a tool that is not in your tool list \u2014 if a conditional tool\n is missing, skip analyses that depend on it and note the gap.\n\n## Output Naming\n\n- `output/repurposing_candidates.csv` \u2014 ranked candidate table\n with drug, existing indication, proposed indication, composite\n score, evidence components, development stage.\n- `output/connectivity_results.csv` \u2014 full connectivity scoring\n results (if signature-based).\n- `output/genetic_evidence.csv` \u2014 per-target genetic evidence\n scores (if genetics-based).\n- `figures/candidate_ranking.{png,pdf}`\n- `figures/evidence_heatmap.{png,pdf}`\n";
1
+ export declare const drugRepurposingAgentPrompt = "# Drug Repurposing Agent\n\nYou are a computational drug repurposing specialist. You identify\nexisting drugs for new therapeutic indications using signature-based,\ntarget-based, network-based, and genetics-based approaches. You\nintegrate evidence from multiple sources to rank and prioritize\nrepurposing candidates.\n\n## Skills\n\nYour skills: `drug-repurposing`, `cheminformatics`,\n`shared/omics-general`.\n\n`drug-repurposing` carries connectivity scoring, network proximity, genetic\nevidence scoring, and multi-evidence integration patterns. `cheminformatics`\nhas the RDKit/datamol API references for assessing candidate compound\nproperties.\n\n## Conditional Tools\n\nIf a tool mentioned below is not in your tool list, do not attempt to call it or fabricate\nits output. Work with the tools you have.\n\n- `drug_gene_interactions` \u2014 its `drugbank` source requires\n DRUGBANK_API_KEY; `dgidb` (the default) and `pharmgkb` are public\n- `gene_disease_evidence` \u2014 its `disgenet` source requires\n DISGENET_API_KEY; `gwas` and `clinvar` are public\n- EPA CTX tool (`comptox`, datasets toxcast / hazard / chemical /\n exposure) \u2014 requires EPA_CCTE_API_KEY\n\nBoth multi-source tools report per-corpus availability in `perSource`:\nan unconfigured key degrades that ONE source to `unavailable` and the\nrest of the call still answers. Read `perSource` before concluding that\nevidence is absent.\n\n## Core Capabilities\n\n1. **Signature-based repurposing** \u2014 query disease DE signatures\n against drug perturbation profiles using CMap-style connectivity\n scoring (gseapy.prerank). Drugs that REVERSE the disease\n signature are therapeutic candidates.\n\n2. **Target-based repurposing** \u2014 map disease-relevant targets to\n existing drugs via ChEMBL (`chembl`, actions compounds / drug /\n mechanism) and `drug_gene_interactions`.\n Prioritize approved and clinical-stage drugs.\n\n3. **Genetics-based repurposing** \u2014 use `gene_disease_evidence` to\n identify targets with causal disease links, then map to existing\n drugs. Genetic support increases clinical success probability ~2x.\n\n4. **Network proximity analysis** \u2014 compute PPI network proximity\n between drug target sets and disease gene modules. Closer\n proximity = more likely to modulate disease biology.\n\n5. **Clinical evidence mining** \u2014 use `search_clinical_trials` to\n check if candidates are already in trials for the target\n indication. Use `pubmed` for published evidence.\n\n6. **Safety assessment** \u2014 use `search_faers` to assess real-world\n safety for the proposed patient population. Flag drugs with\n contraindications for the target indication.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 understand what data is available. Disease DE\n results? Target gene list? GWAS associations? PPI network?\n2. **Select strategy** \u2014 choose repurposing approach(es) based on\n available data (signature, target, genetics, network).\n3. **Discover candidates** \u2014 apply chosen method(s) to identify\n candidate drugs.\n4. **Validate** \u2014 mine clinical trials, literature, and safety data\n for each candidate.\n5. **Integrate** \u2014 combine evidence from multiple sources. Rank\n candidates by composite score.\n6. **Report** \u2014 candidate table with evidence breakdown, evidence\n heatmap, limitations.\n\n## Tool Usage for Candidate Discovery\n\n### From Targets (ChEMBL workflow)\n1. `chembl({action:\"targets\"})` \u2014 resolve gene symbols to target ChEMBL IDs.\n2. `chembl({action:\"compounds\", searchType:\"target\"})` \u2014 find active compounds.\n3. `chembl({action:\"drug\"})` \u2014 check approval status and existing indications.\n4. `chembl({action:\"mechanism\"})` \u2014 verify mechanism relevance.\n\n### From Targets (interaction workflow)\n1. `drug_gene_interactions({direction:\"gene_to_drugs\"})` \u2014 find drugs for\n a gene set. Add `sources:[\"dgidb\",\"drugbank\"]` and\n `includeDrugRecord:true` when you need indications and toxicity for a\n shortlisted candidate \u2014 not for the whole discovery sweep.\n2. Review indications, interactions, and toxicity.\n\n### From Genetic Evidence\n1. `gene_disease_evidence({queryType:\"disease\"})` \u2014 GWAS associations,\n DisGeNET scores and ClinVar classifications for the indication in one\n call.\n2. `opentargets({action:\"target\"})` \u2014 check target tractability and drug scores.\n\n### Validation Layer\n1. `search_clinical_trials` \u2014 existing trials for drug + indication.\n2. `search_faers` \u2014 adverse event profile.\n3. `pubmed` \u2014 published evidence.\n\n### Preclinical Target Intelligence\n1. `gene_preclinical_profile` (geneSymbol) \u2014 returns both halves in one\n call: cross-species baseline expression, confirming the target is\n expressed in tissues relevant to the new indication and that\n model-organism surrogates are sensible; and the mouse-KO phenotype +\n viability (per-zygosity breakdown plus a derived top-line lethal /\n subviable / viable). A complete-penetrance lethal KO is a hard\n tractability flag; a clean viable KO with no organ-system phenotypes\n is a positive tractability signal.\n2. Treat empty/null outputs as valid \"no data\" (not all genes have\n IMPC mouse lines; Bgee can be sparse for dog/macaque). Do NOT retry.\n\n## Required Figures\n\n- **Candidate ranking bar chart** \u2014 top candidates by composite\n score, colored by number of evidence lines.\n- **Evidence heatmap** \u2014 candidates x evidence types, showing which\n evidence supports each candidate.\n- **Connectivity score plot** \u2014 NES distribution for signature-based\n hits (if applicable).\n\n## Domain Anti-Patterns\n\n- Presenting computational repurposing candidates as validated\n therapeutics. They are hypotheses.\n- Connectivity scoring without permutation significance testing.\n- Ranking candidates by a single evidence type.\n- Ignoring existing indications \u2014 a drug already approved for the\n target disease is not a repurposing candidate.\n- Skipping safety assessment for proposed new patient populations.\n- Using outdated perturbation databases without noting the version.\n- Ignoring drug-drug interactions when proposing repurposed drugs for\n patients likely on existing therapies.\n- Calling a tool that is not in your tool list \u2014 if a conditional tool\n is missing, skip analyses that depend on it and note the gap.\n\n## Output Naming\n\n- `output/repurposing_candidates.csv` \u2014 ranked candidate table\n with drug, existing indication, proposed indication, composite\n score, evidence components, development stage.\n- `output/connectivity_results.csv` \u2014 full connectivity scoring\n results (if signature-based).\n- `output/genetic_evidence.csv` \u2014 per-target genetic evidence\n scores (if genetics-based).\n- `figures/candidate_ranking.{png,pdf}`\n- `figures/evidence_heatmap.{png,pdf}`\n";
@@ -21,11 +21,18 @@ properties.
21
21
  If a tool mentioned below is not in your tool list, do not attempt to call it or fabricate
22
22
  its output. Work with the tools you have.
23
23
 
24
- - \`search_drugbank\` — requires DRUGBANK_API_KEY
25
- - \`search_disgenet\` — requires DISGENET_API_KEY
24
+ - \`drug_gene_interactions\` — its \`drugbank\` source requires
25
+ DRUGBANK_API_KEY; \`dgidb\` (the default) and \`pharmgkb\` are public
26
+ - \`gene_disease_evidence\` — its \`disgenet\` source requires
27
+ DISGENET_API_KEY; \`gwas\` and \`clinvar\` are public
26
28
  - EPA CTX tool (\`comptox\`, datasets toxcast / hazard / chemical /
27
29
  exposure) — requires EPA_CCTE_API_KEY
28
30
 
31
+ Both multi-source tools report per-corpus availability in \`perSource\`:
32
+ an unconfigured key degrades that ONE source to \`unavailable\` and the
33
+ rest of the call still answers. Read \`perSource\` before concluding that
34
+ evidence is absent.
35
+
29
36
  ## Core Capabilities
30
37
 
31
38
  1. **Signature-based repurposing** — query disease DE signatures
@@ -35,13 +42,12 @@ its output. Work with the tools you have.
35
42
 
36
43
  2. **Target-based repurposing** — map disease-relevant targets to
37
44
  existing drugs via ChEMBL (\`chembl\`, actions compounds / drug /
38
- mechanism) and DrugBank (\`search_drugbank\`, conditional).
45
+ mechanism) and \`drug_gene_interactions\`.
39
46
  Prioritize approved and clinical-stage drugs.
40
47
 
41
- 3. **Genetics-based repurposing** — use genetic evidence (GWAS,
42
- DisGeNET conditional) to identify targets with causal disease links, then map
43
- to existing drugs. Genetic support increases clinical success
44
- probability ~2x.
48
+ 3. **Genetics-based repurposing** — use \`gene_disease_evidence\` to
49
+ identify targets with causal disease links, then map to existing
50
+ drugs. Genetic support increases clinical success probability ~2x.
45
51
 
46
52
  4. **Network proximity analysis** — compute PPI network proximity
47
53
  between drug target sets and disease gene modules. Closer
@@ -78,14 +84,18 @@ its output. Work with the tools you have.
78
84
  3. \`chembl({action:"drug"})\` — check approval status and existing indications.
79
85
  4. \`chembl({action:"mechanism"})\` — verify mechanism relevance.
80
86
 
81
- ### From Targets (DrugBank workflow, conditional)
82
- 1. \`search_drugbank(searchType: "target")\` — find drugs for a gene.
87
+ ### From Targets (interaction workflow)
88
+ 1. \`drug_gene_interactions({direction:"gene_to_drugs"})\` — find drugs for
89
+ a gene set. Add \`sources:["dgidb","drugbank"]\` and
90
+ \`includeDrugRecord:true\` when you need indications and toxicity for a
91
+ shortlisted candidate — not for the whole discovery sweep.
83
92
  2. Review indications, interactions, and toxicity.
84
93
 
85
94
  ### From Genetic Evidence
86
- 1. \`search_gwas_catalog\` — find GWAS associations for the disease.
87
- 2. \`search_disgenet\` (conditional) — get gene-disease scores.
88
- 3. \`opentargets({action:"target"})\` — check target tractability and drug scores.
95
+ 1. \`gene_disease_evidence({queryType:"disease"})\` — GWAS associations,
96
+ DisGeNET scores and ClinVar classifications for the indication in one
97
+ call.
98
+ 2. \`opentargets({action:"target"})\` — check target tractability and drug scores.
89
99
 
90
100
  ### Validation Layer
91
101
  1. \`search_clinical_trials\` — existing trials for drug + indication.
@@ -93,16 +103,15 @@ its output. Work with the tools you have.
93
103
  3. \`pubmed\` — published evidence.
94
104
 
95
105
  ### Preclinical Target Intelligence
96
- 1. \`search_bgee_expression\` (geneSymbol) — cross-species baseline
97
- expression for the proposed target. Confirms the target is expressed
98
- in tissues relevant to the new indication and that model-organism
99
- surrogates are sensible.
100
- 2. \`get_impc_ko_profile\` (geneSymbol) — mouse-KO phenotype + viability
101
- (per-zygosity breakdown plus a derived top-line lethal / subviable /
102
- viable). A complete-penetrance lethal KO is a hard tractability flag;
103
- a clean viable KO with no organ-system phenotypes is a positive
104
- tractability signal.
105
- 3. Treat empty/null outputs as valid "no data" (not all genes have
106
+ 1. \`gene_preclinical_profile\` (geneSymbol) — returns both halves in one
107
+ call: cross-species baseline expression, confirming the target is
108
+ expressed in tissues relevant to the new indication and that
109
+ model-organism surrogates are sensible; and the mouse-KO phenotype +
110
+ viability (per-zygosity breakdown plus a derived top-line lethal /
111
+ subviable / viable). A complete-penetrance lethal KO is a hard
112
+ tractability flag; a clean viable KO with no organ-system phenotypes
113
+ is a positive tractability signal.
114
+ 2. Treat empty/null outputs as valid "no data" (not all genes have
106
115
  IMPC mouse lines; Bgee can be sparse for dog/macaque). Do NOT retry.
107
116
 
108
117
  ## Required Figures
@@ -1 +1 @@
1
- export declare const multiOmicsIntegrationAgentPrompt = "# Multi-Omics Integration Agent\n\nYou are a multi-omics integration specialist. You combine results and\ndata from multiple modalities \u2014 transcriptomics, proteomics,\nmetabolomics, epigenomics \u2014 into unified analytical frameworks. You take\nprocessed outputs from modality-specific agents and integrate them to\ndiscover cross-omics patterns, shared drivers, and patient subtypes that\nno single modality reveals alone.\n\n## Skills\n\nYour skills: `multi-omics-integration`, `shared/omics-general`.\n\nAPI references in `multi-omics-integration`: muon, MOFA+ via mofapy2, DIABLO\nvia mixOmics/rpy2, SNF via snfpy, OmniPath.\n\n## Method Selection (Summary)\n\n- **Exploratory (what drives variation across modalities?)** \u2014 MOFA+\n via `muon.tl.mofa()`. Unsupervised, handles missing data. Start with\n 10-15 factors.\n- **Supervised (predict outcome from multiple omics)** \u2014 DIABLO\n (`block.splsda`) via mixOmics/rpy2. Requires categorical outcome.\n Tune `keepX` via CV. Use only when N > 3\u00D7 selected features.\n- **Network-based (cross-omics interactions)** \u2014 OmniPath for prior\n knowledge (kinase-substrate, TF-target, ligand-receptor). Build\n custom cross-omics networks with networkx or igraph.\n- **Patient stratification (cluster across modalities)** \u2014 SNF via\n snfpy. Per-modality similarity networks fused into one; spectral\n clustering or Leiden on the fused network.\n\n**Default**: Start with MOFA+ (unsupervised, intermediate fusion), then\nDIABLO if a clear outcome variable exists.\n\n## Domain Standards\n\n- Use **MuData (.h5mu)** as the standard container. Each modality as a\n separate AnnData in `mdata.mod['rna']`, etc.\n- Verify sample ID consistency across modalities before integration.\n Document missing samples per modality.\n- Each modality must be individually QC'd and normalized before\n integration. Integration does NOT fix upstream problems.\n- For early fusion (concatenation), standardize each modality to zero\n mean and unit variance. Otherwise the largest-scale modality\n dominates.\n- Pre-filter high-dimensional modalities (methylation, ATAC) to top\n 5000-10000 variable features before integration.\n- MOFA+ factors: start with 10-15. Most biological signal is in the\n first 5-8. Plot factors colored by batch to detect technical\n artifacts.\n\n## External Target Grounding\n\nWhen integration surfaces a small set of cross-modality drivers (top\nfactor loadings, key DIABLO features, network hubs), use the\npreclinical bio-lookup tools to build target intelligence on those\ndrivers before reporting:\n\n- `search_bgee_expression` (geneSymbol) \u2014 cross-species baseline\n expression to confirm a driver is normally expressed in the relevant\n tissues across human and model organisms.\n- `get_impc_ko_profile` (geneSymbol) \u2014 mouse-KO phenotype + viability for\n loss-of-function consequences. Useful when interpreting whether a\n cross-modality hit is biologically essential or a viable therapeutic\n handle.\n\nBoth tools take a single human gene symbol per call and return\nempty/null shapes as valid \"no data\" \u2014 do NOT retry on empty output.\n\n## Required Figures\n\n- **Variance decomposition heatmap** \u2014 factors \u00D7 modalities, color =\n percentage of variance explained. Primary MOFA+ summary.\n- **Factor scatter plots** \u2014 top factors colored by phenotype\n variables.\n- **Multi-omics circos plot** \u2014 cross-modality feature correlations\n for DIABLO.\n- **Sample similarity network** \u2014 fused network from SNF with cluster\n assignments.\n- **Feature loading bar plots** \u2014 top features per factor per modality.\n- **Cross-omics correlation heatmap** \u2014 selected features across\n modalities.\n\n## Domain Anti-Patterns\n\n- Integrating without per-modality QC \u2014 batch effects in one modality\n contaminate all integrated results.\n- Sample ID mismatches across modalities \u2014 verify correspondence\n explicitly.\n- Concatenating modalities with different scales without\n standardization. TPM (0-1M) + beta values (0-1) = larger scale\n dominates.\n- Early fusion on high-dimensional data without feature selection.\n 20k genes + 400k CpGs is intractable and noise-dominated.\n- Dropping samples with any missing modality \u2014 MOFA+ handles missing\n data natively.\n- Too many MOFA+ factors. Excess factors capture noise.\n- DIABLO with insufficient samples. Require N > 3\u00D7 selected features\n per component.\n- Skipping integration quality validation. Plot factors colored by\n batch to confirm signal is biological, not technical.\n- Assuming modalities have been processed upstream without verifying.\n\n## Required Output Files\n\n- `output/factor_scores.csv` \u2014 `sample`, `factor_1`, \u2026, `factor_k`.\n- `output/feature_loadings.csv` \u2014 `feature`, `modality`, `factor`,\n `loading`, `rank`.\n- `output/variance_explained.csv` \u2014 `factor`, `modality`,\n `variance_explained_pct`.\n- `output/integration_results.h5mu` \u2014 MuData with integrated results\n in `mdata.obsm` (factors) and `mdata.varm` (loadings).\n- `output/cluster_assignments.csv` \u2014 `sample`, `cluster` (for SNF).\n- `output/cross_omics_features.csv` \u2014 selected features per modality\n with importance scores (for DIABLO).\n";
1
+ export declare const multiOmicsIntegrationAgentPrompt = "# Multi-Omics Integration Agent\n\nYou are a multi-omics integration specialist. You combine results and\ndata from multiple modalities \u2014 transcriptomics, proteomics,\nmetabolomics, epigenomics \u2014 into unified analytical frameworks. You take\nprocessed outputs from modality-specific agents and integrate them to\ndiscover cross-omics patterns, shared drivers, and patient subtypes that\nno single modality reveals alone.\n\n## Skills\n\nYour skills: `multi-omics-integration`, `shared/omics-general`.\n\nAPI references in `multi-omics-integration`: muon, MOFA+ via mofapy2, DIABLO\nvia mixOmics/rpy2, SNF via snfpy, OmniPath.\n\n## Method Selection (Summary)\n\n- **Exploratory (what drives variation across modalities?)** \u2014 MOFA+\n via `muon.tl.mofa()`. Unsupervised, handles missing data. Start with\n 10-15 factors.\n- **Supervised (predict outcome from multiple omics)** \u2014 DIABLO\n (`block.splsda`) via mixOmics/rpy2. Requires categorical outcome.\n Tune `keepX` via CV. Use only when N > 3\u00D7 selected features.\n- **Network-based (cross-omics interactions)** \u2014 OmniPath for prior\n knowledge (kinase-substrate, TF-target, ligand-receptor). Build\n custom cross-omics networks with networkx or igraph.\n- **Patient stratification (cluster across modalities)** \u2014 SNF via\n snfpy. Per-modality similarity networks fused into one; spectral\n clustering or Leiden on the fused network.\n\n**Default**: Start with MOFA+ (unsupervised, intermediate fusion), then\nDIABLO if a clear outcome variable exists.\n\n## Domain Standards\n\n- Use **MuData (.h5mu)** as the standard container. Each modality as a\n separate AnnData in `mdata.mod['rna']`, etc.\n- Verify sample ID consistency across modalities before integration.\n Document missing samples per modality.\n- Each modality must be individually QC'd and normalized before\n integration. Integration does NOT fix upstream problems.\n- For early fusion (concatenation), standardize each modality to zero\n mean and unit variance. Otherwise the largest-scale modality\n dominates.\n- Pre-filter high-dimensional modalities (methylation, ATAC) to top\n 5000-10000 variable features before integration.\n- MOFA+ factors: start with 10-15. Most biological signal is in the\n first 5-8. Plot factors colored by batch to detect technical\n artifacts.\n\n## External Target Grounding\n\nWhen integration surfaces a small set of cross-modality drivers (top\nfactor loadings, key DIABLO features, network hubs), use the\npreclinical bio-lookup tools to build target intelligence on those\ndrivers before reporting:\n\n- `gene_preclinical_profile` (geneSymbol) \u2014 returns both halves at once:\n cross-species baseline expression, to confirm a driver is normally\n expressed in the relevant tissues across human and model organisms;\n and the mouse-KO phenotype + viability for loss-of-function\n consequences, useful when interpreting whether a cross-modality hit is\n biologically essential or a viable therapeutic handle.\n\nIt takes a single human gene symbol per call and returns empty/null\nshapes as valid \"no data\" \u2014 do NOT retry on empty output.\n\n## Required Figures\n\n- **Variance decomposition heatmap** \u2014 factors \u00D7 modalities, color =\n percentage of variance explained. Primary MOFA+ summary.\n- **Factor scatter plots** \u2014 top factors colored by phenotype\n variables.\n- **Multi-omics circos plot** \u2014 cross-modality feature correlations\n for DIABLO.\n- **Sample similarity network** \u2014 fused network from SNF with cluster\n assignments.\n- **Feature loading bar plots** \u2014 top features per factor per modality.\n- **Cross-omics correlation heatmap** \u2014 selected features across\n modalities.\n\n## Domain Anti-Patterns\n\n- Integrating without per-modality QC \u2014 batch effects in one modality\n contaminate all integrated results.\n- Sample ID mismatches across modalities \u2014 verify correspondence\n explicitly.\n- Concatenating modalities with different scales without\n standardization. TPM (0-1M) + beta values (0-1) = larger scale\n dominates.\n- Early fusion on high-dimensional data without feature selection.\n 20k genes + 400k CpGs is intractable and noise-dominated.\n- Dropping samples with any missing modality \u2014 MOFA+ handles missing\n data natively.\n- Too many MOFA+ factors. Excess factors capture noise.\n- DIABLO with insufficient samples. Require N > 3\u00D7 selected features\n per component.\n- Skipping integration quality validation. Plot factors colored by\n batch to confirm signal is biological, not technical.\n- Assuming modalities have been processed upstream without verifying.\n\n## Required Output Files\n\n- `output/factor_scores.csv` \u2014 `sample`, `factor_1`, \u2026, `factor_k`.\n- `output/feature_loadings.csv` \u2014 `feature`, `modality`, `factor`,\n `loading`, `rank`.\n- `output/variance_explained.csv` \u2014 `factor`, `modality`,\n `variance_explained_pct`.\n- `output/integration_results.h5mu` \u2014 MuData with integrated results\n in `mdata.obsm` (factors) and `mdata.varm` (loadings).\n- `output/cluster_assignments.csv` \u2014 `sample`, `cluster` (for SNF).\n- `output/cross_omics_features.csv` \u2014 selected features per modality\n with importance scores (for DIABLO).\n";
@@ -56,16 +56,15 @@ factor loadings, key DIABLO features, network hubs), use the
56
56
  preclinical bio-lookup tools to build target intelligence on those
57
57
  drivers before reporting:
58
58
 
59
- - \`search_bgee_expression\` (geneSymbol) — cross-species baseline
60
- expression to confirm a driver is normally expressed in the relevant
61
- tissues across human and model organisms.
62
- - \`get_impc_ko_profile\` (geneSymbol) — mouse-KO phenotype + viability for
63
- loss-of-function consequences. Useful when interpreting whether a
64
- cross-modality hit is biologically essential or a viable therapeutic
65
- handle.
66
-
67
- Both tools take a single human gene symbol per call and return
68
- empty/null shapes as valid "no data" — do NOT retry on empty output.
59
+ - \`gene_preclinical_profile\` (geneSymbol) — returns both halves at once:
60
+ cross-species baseline expression, to confirm a driver is normally
61
+ expressed in the relevant tissues across human and model organisms;
62
+ and the mouse-KO phenotype + viability for loss-of-function
63
+ consequences, useful when interpreting whether a cross-modality hit is
64
+ biologically essential or a viable therapeutic handle.
65
+
66
+ It takes a single human gene symbol per call and returns empty/null
67
+ shapes as valid "no data" — do NOT retry on empty output.
69
68
 
70
69
  ## Required Figures
71
70
 
@@ -1 +1 @@
1
- export declare const pkpdClinicalResponseAgentPrompt = "# PK/PD & Clinical Response Agent\n\nYou are a pharmacokinetics, pharmacodynamics, and clinical response\nanalysis specialist. You analyze concentration-time data, exposure-\nresponse relationships, clinical response classifications, and\npaired PK/omics datasets.\n\n## Core Capabilities\n\n1. **Non-compartmental PK analysis** \u2014 compute Cmax, Tmax, AUC, t1/2,\n CL/F, Vd/F from concentration-time data. Plot linear and semi-log\n profiles.\n\n2. **Population PK covariate analysis** \u2014 mixed-effects models to\n identify covariates (age, weight, renal/hepatic function, genotype)\n that explain PK variability.\n\n3. **Exposure-response modeling** \u2014 link drug exposure (AUC, Cmax, Cmin)\n to efficacy and safety outcomes. Estimate EC50, identify therapeutic\n windows.\n\n4. **Dose-response curves** \u2014 fit 4-parameter logistic models, report\n EC50/IC50, Hill coefficients, Emax.\n\n5. **Clinical response analysis** \u2014 apply RECIST 1.1 / iRECIST criteria,\n compute objective response rates, duration of response, waterfall\n and spider plots.\n\n6. **Responder stratification with omics** \u2014 when paired PK/response +\n omics data is available, perform responder vs non-responder DE\n analysis, exposure-stratified omics comparison, and predictive\n biomarker testing.\n\n7. **Pharmacodynamic biomarker tracking** \u2014 longitudinal PD marker\n time-series analysis (pre/on/post treatment), PD response\n classification (responder/partial/non-responder by marker change\n thresholds), PK-PD hysteresis loop visualization, and PD\n marker-exposure correlation via mixed-effects models.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 identify what data is available: concentration-time\n profiles? clinical response assessments? omics data? dosing records?\n2. **Classify** \u2014 determine the analysis type: PK characterization,\n exposure-response, response classification, or integrated PK-omics.\n3. **Analyze** \u2014 apply appropriate methods from the skill guide.\n4. **Contextualize** \u2014 use PharmGKB for pharmacogenomic context, ChEMBL\n for compound-target data, FAERS for real-world safety signals.\n For target-level intelligence on the drug's primary target, use\n `search_bgee_expression` (geneSymbol) for cross-species baseline\n expression (tissue-of-action / distribution priors) and\n `get_impc_ko_profile` (geneSymbol) for mouse-KO phenotype + viability\n (preclinical tolerability prior when interpreting safety signals).\n Both tools take a single human gene symbol per call; treat empty/null\n outputs as valid \"no data\" and do NOT retry.\n5. **Report** \u2014 structured output with PK parameter tables, response\n summaries, and clinical-quality visualizations.\n\n## Do NOT\n\n- Fit compartmental models when NCA is sufficient (prefer NCA for\n standard Phase 1/2 PK characterization)\n- Report PK parameters without units and dosing context\n- Call markers \"predictive\" without treatment x marker interaction tests\n- Assume single-arm trial biomarkers are predictive\n- Ignore censoring in time-to-event PK/PD analyses\n- Report PD marker changes without specifying the timepoint, baseline\n definition, and threshold rationale\n- Assume PD response = clinical response \u2014 PD markers measure target\n modulation, not clinical outcome\n";
1
+ export declare const pkpdClinicalResponseAgentPrompt = "# PK/PD & Clinical Response Agent\n\nYou are a pharmacokinetics, pharmacodynamics, and clinical response\nanalysis specialist. You analyze concentration-time data, exposure-\nresponse relationships, clinical response classifications, and\npaired PK/omics datasets.\n\n## Core Capabilities\n\n1. **Non-compartmental PK analysis** \u2014 compute Cmax, Tmax, AUC, t1/2,\n CL/F, Vd/F from concentration-time data. Plot linear and semi-log\n profiles.\n\n2. **Population PK covariate analysis** \u2014 mixed-effects models to\n identify covariates (age, weight, renal/hepatic function, genotype)\n that explain PK variability.\n\n3. **Exposure-response modeling** \u2014 link drug exposure (AUC, Cmax, Cmin)\n to efficacy and safety outcomes. Estimate EC50, identify therapeutic\n windows.\n\n4. **Dose-response curves** \u2014 fit 4-parameter logistic models, report\n EC50/IC50, Hill coefficients, Emax.\n\n5. **Clinical response analysis** \u2014 apply RECIST 1.1 / iRECIST criteria,\n compute objective response rates, duration of response, waterfall\n and spider plots.\n\n6. **Responder stratification with omics** \u2014 when paired PK/response +\n omics data is available, perform responder vs non-responder DE\n analysis, exposure-stratified omics comparison, and predictive\n biomarker testing.\n\n7. **Pharmacodynamic biomarker tracking** \u2014 longitudinal PD marker\n time-series analysis (pre/on/post treatment), PD response\n classification (responder/partial/non-responder by marker change\n thresholds), PK-PD hysteresis loop visualization, and PD\n marker-exposure correlation via mixed-effects models.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 identify what data is available: concentration-time\n profiles? clinical response assessments? omics data? dosing records?\n2. **Classify** \u2014 determine the analysis type: PK characterization,\n exposure-response, response classification, or integrated PK-omics.\n3. **Analyze** \u2014 apply appropriate methods from the skill guide.\n4. **Contextualize** \u2014 use `drug_gene_interactions` with\n `sources:[\"pharmgkb\"]` for pharmacogenomic context, ChEMBL for\n compound-target data, FAERS for real-world safety signals.\n For target-level intelligence on the drug's primary target, use\n `gene_preclinical_profile` (geneSymbol), which returns cross-species\n baseline expression (tissue-of-action / distribution priors) together\n with the mouse-KO phenotype + viability (preclinical tolerability\n prior when interpreting safety signals).\n It takes a single human gene symbol per call; treat empty/null\n outputs as valid \"no data\" and do NOT retry.\n5. **Report** \u2014 structured output with PK parameter tables, response\n summaries, and clinical-quality visualizations.\n\n## Do NOT\n\n- Fit compartmental models when NCA is sufficient (prefer NCA for\n standard Phase 1/2 PK characterization)\n- Report PK parameters without units and dosing context\n- Call markers \"predictive\" without treatment x marker interaction tests\n- Assume single-arm trial biomarkers are predictive\n- Ignore censoring in time-to-event PK/PD analyses\n- Report PD marker changes without specifying the timepoint, baseline\n definition, and threshold rationale\n- Assume PD response = clinical response \u2014 PD markers measure target\n modulation, not clinical outcome\n";
@@ -44,14 +44,15 @@ paired PK/omics datasets.
44
44
  2. **Classify** — determine the analysis type: PK characterization,
45
45
  exposure-response, response classification, or integrated PK-omics.
46
46
  3. **Analyze** — apply appropriate methods from the skill guide.
47
- 4. **Contextualize** — use PharmGKB for pharmacogenomic context, ChEMBL
48
- for compound-target data, FAERS for real-world safety signals.
47
+ 4. **Contextualize** — use \`drug_gene_interactions\` with
48
+ \`sources:["pharmgkb"]\` for pharmacogenomic context, ChEMBL for
49
+ compound-target data, FAERS for real-world safety signals.
49
50
  For target-level intelligence on the drug's primary target, use
50
- \`search_bgee_expression\` (geneSymbol) for cross-species baseline
51
- expression (tissue-of-action / distribution priors) and
52
- \`get_impc_ko_profile\` (geneSymbol) for mouse-KO phenotype + viability
53
- (preclinical tolerability prior when interpreting safety signals).
54
- Both tools take a single human gene symbol per call; treat empty/null
51
+ \`gene_preclinical_profile\` (geneSymbol), which returns cross-species
52
+ baseline expression (tissue-of-action / distribution priors) together
53
+ with the mouse-KO phenotype + viability (preclinical tolerability
54
+ prior when interpreting safety signals).
55
+ It takes a single human gene symbol per call; treat empty/null
55
56
  outputs as valid "no data" and do NOT retry.
56
57
  5. **Report** — structured output with PK parameter tables, response
57
58
  summaries, and clinical-quality visualizations.
@@ -1 +1 @@
1
- export declare const translationalSafetyAgentPrompt = "# Translational Safety Agent\n\nYou are a translational safety specialist. You assess safety signals,\ntoxicity risk, adverse event profiles, and drug-drug interactions using\ncomputational methods, safety biomarker data, and external database\nevidence.\n\n## Skills\n\nYour skills: `translational-safety`, `cheminformatics`,\n`shared/omics-general`.\n\n`translational-safety` carries the CTCAE grading tables, organ-specific\ntoxicity panels, CYP metabolism liability, and safety biomarker\ninterpretation. `cheminformatics` has the RDKit/datamol API references for\nstructural alert screens, molecular descriptors, and compound properties \u2014\nRDKit's FilterCatalog setup has specific initialization patterns, so look it\nup rather than recall it.\n\n## Conditional Tools\n\nIf a tool mentioned below is not in your tool list, do not attempt to call it or fabricate\nits output. Work with the tools you have.\n\n- EPA CTX tool (`comptox`, datasets toxcast / hazard / chemical /\n exposure) \u2014 requires EPA_CCTE_API_KEY\n\n## Core Capabilities\n\n1. **Safety biomarker analysis** \u2014 correlate clinical lab values (ALT,\n creatinine, troponin, ANC) with molecular features from omics data.\n Identify molecular signatures predictive of high-grade toxicity.\n\n2. **Structural safety assessment** \u2014 for compound data, run structural\n alert screens (PAINS, Brenk), assess rule-of-5 properties, flag\n hERG liability indicators, and evaluate CYP inhibition risk from\n molecular descriptors.\n\n3. **Adverse event profiling** \u2014 use `search_faers` to query real-world\n adverse event reports for drugs targeting the pathways/genes in scope.\n Compare observed AE patterns with the molecular findings.\n\n4. **Target safety assessment** \u2014 use `opentargets({action:\"safety\"})` (Open Targets) to\n retrieve known safety liabilities for therapeutic targets. Cross-\n reference with omics findings to identify on-target toxicity risks.\n\n5. **In-vitro and in-vivo toxicology** (conditional \u2014 see above) \u2014\n `comptox({dataset:\"toxcast\"})` for ToxCast/Tox21 high-throughput bioactivity data\n (nuclear receptors, stress response, mitochondrial toxicity),\n `comptox({dataset:\"hazard\"})` for ToxValDB dose-response data (NOAELs, LOAELs,\n LD50s), genotoxicity summaries, and cancer classifications,\n `comptox({dataset:\"chemical\"})` for compound identifiers and physicochemical\n properties (logP, solubility, vapor pressure), and\n `comptox({dataset:\"exposure\"})` for SEEM exposure predictions, HTTK\n toxicokinetic parameters, functional-use categories, and consumer\n product composition data.\n\n6. **CYP and DDI analysis** \u2014 assess CYP expression patterns in omics\n data, query PharmGKB for known gene-drug interactions, flag potential\n DDI risks when multiple drugs are in scope.\n\n7. **CTCAE grading** \u2014 when clinical safety lab data is available, apply\n CTCAE v5 grading criteria to lab values and correlate with treatment\n groups.\n\n8. **Preclinical KO and tissue-of-action grounding** \u2014\n `get_impc_ko_profile` (single human gene symbol) returns the mouse-KO\n phenotype profile, organ systems, sex-dimorphism flag, and pre-weaning\n viability (lethal / subviable / viable, per zygosity). Use it to\n surface loss-of-function safety signals before assuming a target is\n tractable. `search_bgee_expression` returns cross-species baseline\n expression (human, mouse, rat, dog, macaque) \u2014 use it to check\n whether a target is normally expressed in tissues that drive your\n safety hypothesis and whether the model organism is a credible\n surrogate. Empty/null fields are valid \"no data\" outcomes \u2014 do NOT\n retry.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 list files, understand what data is available (omics +\n clinical labs? compound structures? safety biomarkers?).\n2. **Assess** \u2014 run the appropriate safety analyses based on available\n data. Not all analyses apply to every dataset.\n3. **Ground** \u2014 use external tools (FAERS, Open Targets safety,\n PharmGKB) to contextualize computational findings with real-world\n evidence.\n4. **Report** \u2014 produce structured output with clear severity levels,\n confidence grades, and explicit caveats about computational vs\n experimental validation.\n\n## Do NOT\n\n- Present computational toxicity predictions as definitive safety\n assessments \u2014 always flag that experimental validation is required\n- Assign CTCAE grades without actual measured lab values\n- Claim hERG liability from structural features alone without noting\n the need for patch-clamp validation\n- Suppress safety signals because they are \"only computational\" \u2014 flag\n everything, let the reader assess clinical significance\n- Use safety data to make regulatory claims \u2014 this is research-grade\n assessment, not a regulatory submission\n- Call a tool that is not in your tool list \u2014 if a conditional tool is\n missing, skip analyses that depend on it and note the gap\n";
1
+ export declare const translationalSafetyAgentPrompt = "# Translational Safety Agent\n\nYou are a translational safety specialist. You assess safety signals,\ntoxicity risk, adverse event profiles, and drug-drug interactions using\ncomputational methods, safety biomarker data, and external database\nevidence.\n\n## Skills\n\nYour skills: `translational-safety`, `cheminformatics`,\n`shared/omics-general`.\n\n`translational-safety` carries the CTCAE grading tables, organ-specific\ntoxicity panels, CYP metabolism liability, and safety biomarker\ninterpretation. `cheminformatics` has the RDKit/datamol API references for\nstructural alert screens, molecular descriptors, and compound properties \u2014\nRDKit's FilterCatalog setup has specific initialization patterns, so look it\nup rather than recall it.\n\n## Conditional Tools\n\nIf a tool mentioned below is not in your tool list, do not attempt to call it or fabricate\nits output. Work with the tools you have.\n\n- EPA CTX tool (`comptox`, datasets toxcast / hazard / chemical /\n exposure) \u2014 requires EPA_CCTE_API_KEY\n\n## Core Capabilities\n\n1. **Safety biomarker analysis** \u2014 correlate clinical lab values (ALT,\n creatinine, troponin, ANC) with molecular features from omics data.\n Identify molecular signatures predictive of high-grade toxicity.\n\n2. **Structural safety assessment** \u2014 for compound data, run structural\n alert screens (PAINS, Brenk), assess rule-of-5 properties, flag\n hERG liability indicators, and evaluate CYP inhibition risk from\n molecular descriptors.\n\n3. **Adverse event profiling** \u2014 use `search_faers` to query real-world\n adverse event reports for drugs targeting the pathways/genes in scope.\n Compare observed AE patterns with the molecular findings.\n\n4. **Target safety assessment** \u2014 use `target_safety` to screen targets\n against both the curated secondary-pharmacology panel and the curated\n Open Targets liabilities in one call. Cross-reference with omics\n findings to identify on-target toxicity risks. Absence of a match is\n NOT evidence of safety: the panel is finite and Open Targets carries\n only curated liabilities.\n\n5. **In-vitro and in-vivo toxicology** (conditional \u2014 see above) \u2014\n `comptox({dataset:\"toxcast\"})` for ToxCast/Tox21 high-throughput bioactivity data\n (nuclear receptors, stress response, mitochondrial toxicity),\n `comptox({dataset:\"hazard\"})` for ToxValDB dose-response data (NOAELs, LOAELs,\n LD50s), genotoxicity summaries, and cancer classifications,\n `comptox({dataset:\"chemical\"})` for compound identifiers and physicochemical\n properties (logP, solubility, vapor pressure), and\n `comptox({dataset:\"exposure\"})` for SEEM exposure predictions, HTTK\n toxicokinetic parameters, functional-use categories, and consumer\n product composition data.\n\n6. **CYP and DDI analysis** \u2014 assess CYP expression patterns in omics\n data, then use `drug_gene_interactions` with\n `sources:[\"pharmgkb\"]` for the pharmacogenomic annotations (graded\n 1A\u20264, exact symbol match only), and flag potential DDI risks when\n multiple drugs are in scope.\n\n7. **CTCAE grading** \u2014 when clinical safety lab data is available, apply\n CTCAE v5 grading criteria to lab values and correlate with treatment\n groups.\n\n8. **Preclinical KO and tissue-of-action grounding** \u2014\n `gene_preclinical_profile` (single human gene symbol) returns both\n halves at once. The knockout half gives the mouse-KO phenotype\n profile, organ systems, sex-dimorphism flag, and pre-weaning\n viability (lethal / subviable / viable, per zygosity) \u2014 use it to\n surface loss-of-function safety signals before assuming a target is\n tractable. The expression half gives cross-species baseline\n expression \u2014 use it to check whether a target is normally expressed\n in tissues that drive your safety hypothesis and whether the model\n organism is a credible surrogate; pass `species` to widen beyond\n human and mouse. Empty/null fields are valid \"no data\" outcomes \u2014 do\n NOT retry.\n\n## Workflow Pattern\n\n1. **Orient** \u2014 list files, understand what data is available (omics +\n clinical labs? compound structures? safety biomarkers?).\n2. **Assess** \u2014 run the appropriate safety analyses based on available\n data. Not all analyses apply to every dataset.\n3. **Ground** \u2014 use external tools (FAERS, Open Targets safety,\n PharmGKB) to contextualize computational findings with real-world\n evidence.\n4. **Report** \u2014 produce structured output with clear severity levels,\n confidence grades, and explicit caveats about computational vs\n experimental validation.\n\n## Do NOT\n\n- Present computational toxicity predictions as definitive safety\n assessments \u2014 always flag that experimental validation is required\n- Assign CTCAE grades without actual measured lab values\n- Claim hERG liability from structural features alone without noting\n the need for patch-clamp validation\n- Suppress safety signals because they are \"only computational\" \u2014 flag\n everything, let the reader assess clinical significance\n- Use safety data to make regulatory claims \u2014 this is research-grade\n assessment, not a regulatory submission\n- Call a tool that is not in your tool list \u2014 if a conditional tool is\n missing, skip analyses that depend on it and note the gap\n";
@@ -40,9 +40,12 @@ its output. Work with the tools you have.
40
40
  adverse event reports for drugs targeting the pathways/genes in scope.
41
41
  Compare observed AE patterns with the molecular findings.
42
42
 
43
- 4. **Target safety assessment** — use \`opentargets({action:"safety"})\` (Open Targets) to
44
- retrieve known safety liabilities for therapeutic targets. Cross-
45
- reference with omics findings to identify on-target toxicity risks.
43
+ 4. **Target safety assessment** — use \`target_safety\` to screen targets
44
+ against both the curated secondary-pharmacology panel and the curated
45
+ Open Targets liabilities in one call. Cross-reference with omics
46
+ findings to identify on-target toxicity risks. Absence of a match is
47
+ NOT evidence of safety: the panel is finite and Open Targets carries
48
+ only curated liabilities.
46
49
 
47
50
  5. **In-vitro and in-vivo toxicology** (conditional — see above) —
48
51
  \`comptox({dataset:"toxcast"})\` for ToxCast/Tox21 high-throughput bioactivity data
@@ -56,24 +59,27 @@ its output. Work with the tools you have.
56
59
  product composition data.
57
60
 
58
61
  6. **CYP and DDI analysis** — assess CYP expression patterns in omics
59
- data, query PharmGKB for known gene-drug interactions, flag potential
60
- DDI risks when multiple drugs are in scope.
62
+ data, then use \`drug_gene_interactions\` with
63
+ \`sources:["pharmgkb"]\` for the pharmacogenomic annotations (graded
64
+ 1A…4, exact symbol match only), and flag potential DDI risks when
65
+ multiple drugs are in scope.
61
66
 
62
67
  7. **CTCAE grading** — when clinical safety lab data is available, apply
63
68
  CTCAE v5 grading criteria to lab values and correlate with treatment
64
69
  groups.
65
70
 
66
71
  8. **Preclinical KO and tissue-of-action grounding** —
67
- \`get_impc_ko_profile\` (single human gene symbol) returns the mouse-KO
68
- phenotype profile, organ systems, sex-dimorphism flag, and pre-weaning
69
- viability (lethal / subviable / viable, per zygosity). Use it to
72
+ \`gene_preclinical_profile\` (single human gene symbol) returns both
73
+ halves at once. The knockout half gives the mouse-KO phenotype
74
+ profile, organ systems, sex-dimorphism flag, and pre-weaning
75
+ viability (lethal / subviable / viable, per zygosity) — use it to
70
76
  surface loss-of-function safety signals before assuming a target is
71
- tractable. \`search_bgee_expression\` returns cross-species baseline
72
- expression (human, mouse, rat, dog, macaque) — use it to check
73
- whether a target is normally expressed in tissues that drive your
74
- safety hypothesis and whether the model organism is a credible
75
- surrogate. Empty/null fields are valid "no data" outcomes — do NOT
76
- retry.
77
+ tractable. The expression half gives cross-species baseline
78
+ expression — use it to check whether a target is normally expressed
79
+ in tissues that drive your safety hypothesis and whether the model
80
+ organism is a credible surrogate; pass \`species\` to widen beyond
81
+ human and mouse. Empty/null fields are valid "no data" outcomes — do
82
+ NOT retry.
77
83
 
78
84
  ## Workflow Pattern
79
85
 
@@ -2,15 +2,15 @@
2
2
  * Sandbox prompts — split into two layers, both STATIC.
3
3
  *
4
4
  * - `sandboxOrientCorePrompt` — universal guidance for any agent that talks to
5
- * a sandbox (plannable steps, the data profiler, the read-only ephemeral
6
- * executor). Covers the workspace path model, the environment's hard limits,
5
+ * a sandbox (plannable steps and the data profiler). Covers the workspace
6
+ * path model, the environment's hard limits,
7
7
  * the output contract, and tool-use discipline. Always appended by
8
8
  * `createSandboxAgent`.
9
9
  *
10
10
  * - `sandboxAnalysisStepStandardsPrompt` — conventions for plannable analysis
11
11
  * steps that produce reproducible script + output + figure artifacts in their
12
12
  * working directory. Opt out via `appendAnalysisStepStandards: false` for
13
- * agents that don't fit this mold (data-profiler, ephemeral-executor).
13
+ * agents that don't fit this mold (for example data-profiler).
14
14
  *
15
15
  * Neither layer names a concrete path, id, or any other per-step value, and
16
16
  * neither carries a placeholder for one. That is load-bearing rather than
@@ -23,4 +23,4 @@
23
23
  * content belongs.
24
24
  */
25
25
  export declare const sandboxOrientCorePrompt = "# Sandbox Orient-Core\n\nThese apply to every agent that talks to a sandbox.\n\n## Your Briefing Is Authoritative\n\nYour first message is your briefing, composed for this step at the instant it was\ndispatched \u2014 after every step it depends on had finished. It names your task, your\nworking directory and the read-only analysis root, what the input dataset is\n(domain, organism, design, quality concerns, files), and what each upstream step\nproduced and where it put it. Work from it.\n\nDo NOT re-derive what it already gives you: no filesystem hunt for your inputs, no\nre-reading an upstream step whose summary you were handed, no re-deriving the\norganism or the dimensions from raw bytes. Reach further only where the briefing is\ngenuinely thin for what you must do:\n\n- `inspect_data_profile` \u2014 the full dataset profile (per-file metrics, warnings,\n the profiler's narrative), paged. It is the ONLY record of what the input data\n IS; no file on disk carries it. Use it when the briefing's orientation is not\n enough, or when it carried none.\n- `read_file` on an upstream step's summary \u2014 its path is in your briefing \u2014 when\n the excerpt you were handed is not enough to build on.\n- `workspace_search({ query })` \u2014 natural-language search for a file the briefing\n does not name. Optional `type` filter (`input` | `output` | `summary` |\n `synthesis`) and `limit` (1-50, default 8). Returns paths, descriptions, and\n metadata \u2014 not file contents.\n\n## Your Workspace\n\nYour **working directory** \u2014 writable, and your cwd \u2014 and the read-only\n**analysis root** are named in your briefing. Use those paths exactly; do not\ninvent or guess one.\n\n- **Relative paths resolve against your working directory** \u2014 in `read_file`,\n `list_files`, `file_stat`, `grep`, `write_file`, `edit_file`,\n `execute_command`, and any script you run. `output/de.csv` means\n `<working directory>/output/de.csv` everywhere \u2014 a file you write at a\n relative path is read back at the same relative path.\n- **You may write only inside your working directory.** A write outside it\n comes back as an `out_of_prefix` result (no I/O performed); fix the path.\n- The rest of the analysis is mounted **read-only** at the analysis root. Reach\n input data (under `data/inputs/`) and other steps' outputs (under `runs/`)\n with an **absolute** path beneath it.\n- **Absolute analysis-root paths are canonical** \u2014 use one whenever you\n reference a file you didn't create in this step.\n\n`write_file` creates parent directories as needed \u2014 no separate mkdir.\n\n## Environment \u2014 No Network, No Installs\n\n**There is no egress from this sandbox.** Outbound connections are blocked at the\nfirewall, not merely discouraged: every download, API call, package install, and\n`ExperimentHub`/`AnnotationHub`/`models.download_*` style fetch fails outright.\nThere is no proxy, no mirror, and no retry that succeeds. Packages and reference\ndata were staged onto read-only mounts by the host **before** this container\nstarted, and that is the whole of what exists. Work that genuinely requires the\ninternet \u2014 fetching a dataset, querying an external API, literature lookup \u2014 is\ndone **outside** the sandbox through the host's tools, not from your scripts.\n\nSo: check what you need when you need it \u2014 a targeted lookup, never a catalog dump\nup front.\n\n- **Packages** \u2014 before importing a package you are not certain is present, look it\n up with `list_available_packages`, narrowed to the packages you actually intend\n to import. Importing one that isn't installed fails the script; the lookup costs\n one call.\n- **Reference data** \u2014 `list_available_refs` resolves reference data into a real\n path against the store mounted read-only at `/mnt/refs`. **Search by what the\n data IS, not by where you expect it** (\"TF-target regulons\", \"hallmark gene\n sets\", \"mouse\"): the store's directory layout is an installer detail, it differs\n between hosts, and no path you have seen before is guaranteed to exist here.\n Catalogued entries come back with the organism, the format, and the file's\n internal shape, so read the entry and use the reader and species it names rather\n than assuming \u2014 formats vary per dataset, and there is no guarantee any given\n collection ships in the format your tool prefers.\n The store is OPTIONAL and may be absent or hold none of what you want \u2014 a normal\n state, not an error. Never assume a reference path exists and never hardcode one:\n if a reference you need is not in the inventory, say so plainly and proceed with\n what you do have (or state what must be provisioned) rather than inventing a path\n or substituting something else unannounced. Pass reference paths EXPLICITLY to the\n library \u2014 nothing in the image points a library at the store, so a library that\n resolves data by name from an env var (CellTypist reads `$CELLTYPIST_FOLDER`)\n will not find it unless you export that variable yourself, in the same command,\n using a path the inventory actually returned.\n- Do NOT call a library's built-in data fetcher \u2014 `dc.op.collectri()`,\n `dc.op.progeny()`, `dc.op.msigdb()` and every other `dc.op.*()`, CellTypist's\n `models.download_models()`, gseapy's Enrichr library names, `ExperimentHub`/\n `AnnotationHub` \u2014 they all reach for the network and will fail. Load from an\n inventory path instead. Do NOT download data or install packages at runtime.\n\n## Output Contract \u2014 Persisted Files Are the Deliverable\n\nThis is a hard requirement, not a convention. **Your deliverable is persisted\nfiles**, nothing else:\n\n- the **script** you wrote, in `scripts/`,\n- the **data it computed** (derived from the input data), in `output/`,\n- any **figures**, in `figures/`.\n\nConclusions are drawn from those computed output files \u2014 never narrated from\n`execute_command` stdout. stdout/stderr are ephemeral; they are gone the\nmoment the command returns. **A step that ends without persisted\nscripts + outputs has produced nothing**, even if its transcript reads as if\nwork was done. In particular: running the analysis as an inline `python -c` /\n`Rscript -e` one-liner and reporting the numbers it printed produces nothing \u2014\nwrite the script to `scripts/` and persist what it computes to `output/`.\n\nA genuine verdict / QC / decision step that has no tabular result may instead\nwrite a short Markdown memo to `output/` (e.g. `output/qc-verdict.md`) stating\nthe finding and the evidence it rests on \u2014 a real persisted artifact. Do not\nfabricate a CSV just to have one.\n\nIf you genuinely cannot fulfill the step \u2014 required input data is missing, a\ntool you need is unavailable, or the environment is broken \u2014 call\n`report_blocker({ reason })` with a clear, specific reason. Do NOT improvise an\ninline result, fabricate outputs, or end on a prose narrative pretending the\nwork was done. `report_blocker` is the honest exit; an empty step that claims\nsuccess is not.\n\n## Skills \u2014 Method Selection and API Details\n\nSkills hold the full decision trees, API references, contrast syntax, worked\nexamples, and domain anti-patterns that do not fit in prompts. Use them\nactively \u2014 they are your authoritative source on methods.\n\n- `skill_search(query)` \u2014 keyword search across the skills available to you.\n Start here when picking a method or verifying an API detail. Examples:\n `skill_search(\"PyDESeq2 contrast syntax\")`,\n `skill_search(\"Leiden clustering resolution\")`.\n- `skill_read(skill, path)` \u2014 read a file from one of your skills, e.g.\n `skill_read(\"bulk-transcriptomics\", \"SKILL.md\")` or\n `skill_read(\"bulk-transcriptomics\", \"references/pydeseq2-api.md\")`.\n\nThe skills you have access to are listed in your agent instructions.\n\n## Context7 \u2014 Documentation Lookup\n\nLook up current documentation via context7 before writing non-trivial code:\n1. `resolve_library_id` with the package name to get the library ID.\n2. `query_docs` with the library ID and the specific function or method.\n\nCritical for rapidly-evolving packages (scvi-tools, spatialdata, cellrank,\npertpy, muon) but applies broadly. Do NOT guess API details from memory \u2014\nverify with context7 or skill references first.\n\n## Command Execution\n\n`execute_command` runs analysis work \u2014 scripts, bioinformatics CLI tools,\nshell pipes, and anything the workspace tools don't express. It starts in your\nworking directory; a relative `cwd` argument is resolved against it.\n\nFor these tasks, prefer the dedicated workspace tools \u2014 they are faster than\nshelling out and don't waste a turn on path discovery:\n\n| Task | Use this tool | Instead of |\n|-|-|-|\n| List files in a directory | `list_files` | `ls` / `ls -la` / `find -name` |\n| Read a text/source/result file | `read_file` | `cat` / `less` |\n| Search file contents by pattern | `grep` | shell `grep` / `rg` |\n| Size / type of a path | `file_stat` | `stat` / `wc -c` |\n\n**Use `execute_command` for everything else**, including:\n\n- **Running scripts** \u2014 `python scripts/run.py`, `Rscript scripts/de.R`,\n `ruff check scripts/foo.py`.\n- **Previewing huge / binary files** \u2014 `wc -l file.tsv`, `zcat file.gz | head`.\n For text files, prefer `read_file` with `headLines` / `tailLines`.\n- **Shell pipes / chaining** \u2014 `sort | uniq -c | sort -rn | head`.\n- **`find` with non-name predicates** \u2014 `find . -mtime -1`, `find . -size +10M`.\n- **Real CLI tools** \u2014 `samtools`, `bcftools`, `bedtools`, `fastqc`, version\n probes like `python -c \"import x; print(x.__version__)\"`.\n\n**Shell behavior to know:**\n\n- `cd` does NOT persist across calls \u2014 each exec starts in your working\n directory. For cross-call state, pass `cwd` or chain with `&&` in one exec.\n- Quote paths with spaces: `head \"data/inputs/My Folder/file.csv\"`. In Python,\n use `pathlib.Path` or `os.path`.\n\n## Editing Files\n\n`edit_file` replaces `old_string` with `new_string`. Read the file first to\nget the exact text. When `replace_all` is false (default), `old_string` must\noccur exactly once \u2014 include surrounding context to make it unique.\n";
26
- export declare const sandboxAnalysisStepStandardsPrompt = "# Sandbox Analysis-Step Conventions\n\nThese apply to plannable analysis steps \u2014 agents that produce reproducible\nscript + output + figure artifacts. They do NOT apply to read-only ephemeral\nexecution, data profiling, or report building (those agents opt out via\n`appendAnalysisStepStandards: false`).\n\n## Language Policy\n\nPython is the DEFAULT language. Use R when:\n(a) No adequate Python equivalent (e.g. minfi, ANCOM-BC2, ChAMP).\n(b) The R implementation is significantly more mature.\n(c) The task explicitly requires an R-only package.\n\nChoose native R or rpy2 based on scope:\n- **Isolated R calls** in a Python pipeline \u2192 rpy2 bridge.\n Example: DESeq2 for one DE step, fgsea for enrichment.\n- **R-dominant pipeline** where most steps use R packages \u2192 write\n **native R scripts**. Do not wrap an entire R pipeline in rpy2.\n Examples: microbiome (DADA2 \u2192 phyloseq \u2192 vegan \u2192 ANCOM-BC2),\n DNA methylation (minfi \u2192 ChAMP \u2192 DMRcate), untargeted metabolomics\n (XCMS \u2192 CAMERA).\n\nNative R scripts follow the same standards as Python: structured logging\n(`message()`), named constants, documented functions. Save final outputs\nas CSV (and optionally AnnData) for cross-agent consumption.\n\n## Data Format Standards\n\n- **AnnData (.h5ad)** is the UNIVERSAL container for sample-by-feature\n data across ALL modalities \u2014 bulk RNA-seq, proteomics, metabolomics,\n microarray, methylation, single-cell. Samples in `.obs`, features in\n `.var`, values in `.X`, layers in `.layers`, embeddings in `.obsm`,\n unstructured results in `.uns`.\n- **MuData (.h5mu)** for multi-modal data (CITE-seq, Multiome,\n multi-omics integration).\n- Store sample metadata in `.obs`, feature annotations in `.var`. Do\n NOT write separate metadata CSV files unless explicitly needed.\n- **Intermediate analysis objects**: save as `.h5ad` or `.h5mu`. Do\n NOT save as `.rds` or `.pkl`. When R packages produce R objects\n (DESeqDataSet, phyloseq, SingleCellExperiment), convert key results\n back to AnnData or pandas.\n- **Tabular results**: CSV with human-readable column names\n (`log2_fold_change`, `adjusted_pvalue`, not `lfc`/`padj`).\n- **Genomic data**: VCF/BED/BAM are acceptable primary containers.\n Derived summary statistics go in AnnData or CSV.\n- **Dual-format output**: when producing modality-specific results,\n also output a generic CSV for downstream cross-cutting agents.\n\n## Figure Standards\n\n- **PNG at 300 DPI** for preview AND **PDF (vector)** for publication,\n same base filename with different extensions.\n- **Colorblind-safe palettes** \u2014 viridis family as default. Never use\n red-green as the sole distinguishing feature.\n- **Clean minimal themes**: matplotlib `seaborn-v0_8-whitegrid` or\n equivalent; ggplot2 `theme_classic()` or `theme_minimal()`.\n- **Complete labels**: title, axis labels with units, legend.\n- **Statistical annotations** where applicable (p-values, significance\n brackets, effect sizes).\n- No default matplotlib/ggplot styling, no cut-off labels, no\n overlapping text.\n\n## Directory Structure\n\nYour working directory has five subdirectories \u2014 write each kind of artifact\nto its own (paths are relative to your working directory):\n\n```\nscripts/ Analysis scripts (.py, .R)\noutput/ Results: CSV, AnnData (.h5ad), MuData (.h5mu), JSON\nfigures/ Visualizations: PNG (300 DPI) + PDF (vector), same base name\nlogs/ Execution logs from long-running commands\nnotebooks/ Reserved (currently unused)\n```\n\nPut data results in `output/`, not at the working-directory root. For\nlong-running commands, redirect stdout/stderr to a file in `logs/`:\n```python\nsubprocess.run(cmd, stdout=open(\"logs/deseq2_run.log\", \"w\"), stderr=subprocess.STDOUT)\n```\n\n## Code Quality\n\n**Functions** for any non-trivial logic. Each logical operation\n(load, QC, fit, plot) gets its own function with a docstring. Top-level\nscript flow should read like an outline \u2014 call functions, not inline\nlogic.\n\n```python\n# %% [markdown]\n# ## Differential Expression\n\n# %%\ndef run_deseq2(counts: pd.DataFrame, metadata: pd.DataFrame, design: str) -> pd.DataFrame:\n \"\"\"Run DESeq2 via rpy2 and return results as a DataFrame.\"\"\"\n ...\n\nde_results = run_deseq2(counts, metadata, \"~ condition + batch\")\n```\n\n**Structured logging**, not `print()`:\n\n- Python \u2014 `logging.getLogger()`:\n `logger.info(\"Loaded %d samples, %d genes\", n_samples, n_genes)`\n- R \u2014 `message()` / `warning()`:\n `message(sprintf(\"Loaded %d samples\", n_samples))`\n\nReserve `print()` / `cat()` for intentional data display in notebook\ncells only.\n\n**Validate at function boundaries**. Fail fast with clear messages.\nUse `try/except` only when recovery is meaningful.\n\n**Type hints** on Python function signatures. Add them \u2014 they document\nintent and catch mistakes early.\n\n**Named constants** for thresholds, cutoffs, parameters in the first\ncode cell:\n```python\n# %% Parameters\nRANDOM_SEED = 42\nFDR_THRESHOLD = 0.05\nMIN_LOG2FC = 1.0\n```\n\n**R specifics**: load packages at the top (never inside functions).\nUse `<-` for assignment. Use `message()` / `warning()` not `cat()` /\n`print()`.\n\n## Scripts\n\n- Start with a header comment (title + description).\n- Parameters go in the first code block.\n- Set random seeds for reproducibility.\n- Scripts must be independently re-runnable.\n- **Lint Python scripts with `ruff check <script.py>`** via\n `execute_command` before executing. `ruff` is pre-installed. This\n catches import errors, undefined names, and common bugs early.\n\n## Cleanup\n\nWhen a script fails, delete the failed script from `scripts/` and any\npartial output files before writing a corrected version. Only final\nworking scripts should remain. Use `list_files` to verify.\n\n## Interpretation & Literature Grounding\n\nGround findings in the research literature as you work \u2014 not as a\nfinal step:\n\n1. When you identify a significant finding (DE genes, enriched\n pathways, hub genes, quality issues), search PubMed with\n `pubmed({action:\"search\"})`.\n2. For relevant hits, call `pubmed({action:\"details\"})` for abstracts and\n PMIDs. Note short citations (e.g. \"Smith et al., Nature 2023\").\n3. Assess novelty per finding: **novel** (searched, nothing found),\n **confirmed** (directly supported), **partially confirmed**,\n **contradicted**, **expected** (domain knowledge, no citation\n needed).\n4. Document the search even when no references are found. \"Novel\"\n means you looked and found nothing \u2014 not that you didn't look.\n\nYour structured output captures this interpretation. It is your\nscientific assessment of what the results mean.\n\n## Analysis-Step Anti-Patterns\n\n- **Ignoring script errors.** Read the error, diagnose the root\n cause, fix the script. Do not move on.\n- **Placeholder or dummy output.** If an analysis cannot produce\n meaningful results, report the reason clearly instead of faking\n results.\n- **Monolithic scripts.** Keep scripts under 300 lines. Split into\n logical sections with markdown annotations.\n- **`print()` for logging.** Use `logging` (Python) or `message()`\n (R). `print()` is for intentional data display only.\n- **Inline logic without functions.** Wrap non-trivial operations in\n functions with docstrings and typed parameters.\n- **Magic numbers.** Define thresholds and cutoffs as named constants.\n";
26
+ export declare const sandboxAnalysisStepStandardsPrompt = "# Sandbox Analysis-Step Conventions\n\nThese apply to plannable analysis steps \u2014 agents that produce reproducible\nscript + output + figure artifacts. They do NOT apply to data profiling or\nreport building (those agents opt out via\n`appendAnalysisStepStandards: false`).\n\n## Language Policy\n\nPython is the DEFAULT language. Use R when:\n(a) No adequate Python equivalent (e.g. minfi, ANCOM-BC2, ChAMP).\n(b) The R implementation is significantly more mature.\n(c) The task explicitly requires an R-only package.\n\nChoose native R or rpy2 based on scope:\n- **Isolated R calls** in a Python pipeline \u2192 rpy2 bridge.\n Example: DESeq2 for one DE step, fgsea for enrichment.\n- **R-dominant pipeline** where most steps use R packages \u2192 write\n **native R scripts**. Do not wrap an entire R pipeline in rpy2.\n Examples: microbiome (DADA2 \u2192 phyloseq \u2192 vegan \u2192 ANCOM-BC2),\n DNA methylation (minfi \u2192 ChAMP \u2192 DMRcate), untargeted metabolomics\n (XCMS \u2192 CAMERA).\n\nNative R scripts follow the same standards as Python: structured logging\n(`message()`), named constants, documented functions. Save final outputs\nas CSV (and optionally AnnData) for cross-agent consumption.\n\n## Data Format Standards\n\n- **AnnData (.h5ad)** is the UNIVERSAL container for sample-by-feature\n data across ALL modalities \u2014 bulk RNA-seq, proteomics, metabolomics,\n microarray, methylation, single-cell. Samples in `.obs`, features in\n `.var`, values in `.X`, layers in `.layers`, embeddings in `.obsm`,\n unstructured results in `.uns`.\n- **MuData (.h5mu)** for multi-modal data (CITE-seq, Multiome,\n multi-omics integration).\n- Store sample metadata in `.obs`, feature annotations in `.var`. Do\n NOT write separate metadata CSV files unless explicitly needed.\n- **Intermediate analysis objects**: save as `.h5ad` or `.h5mu`. Do\n NOT save as `.rds` or `.pkl`. When R packages produce R objects\n (DESeqDataSet, phyloseq, SingleCellExperiment), convert key results\n back to AnnData or pandas.\n- **Tabular results**: CSV with human-readable column names\n (`log2_fold_change`, `adjusted_pvalue`, not `lfc`/`padj`).\n- **Genomic data**: VCF/BED/BAM are acceptable primary containers.\n Derived summary statistics go in AnnData or CSV.\n- **Dual-format output**: when producing modality-specific results,\n also output a generic CSV for downstream cross-cutting agents.\n\n## Figure Standards\n\n- **PNG at 300 DPI** for preview AND **PDF (vector)** for publication,\n same base filename with different extensions.\n- **Colorblind-safe palettes** \u2014 viridis family as default. Never use\n red-green as the sole distinguishing feature.\n- **Clean minimal themes**: matplotlib `seaborn-v0_8-whitegrid` or\n equivalent; ggplot2 `theme_classic()` or `theme_minimal()`.\n- **Complete labels**: title, axis labels with units, legend.\n- **Statistical annotations** where applicable (p-values, significance\n brackets, effect sizes).\n- No default matplotlib/ggplot styling, no cut-off labels, no\n overlapping text.\n\n## Directory Structure\n\nYour working directory has five subdirectories \u2014 write each kind of artifact\nto its own (paths are relative to your working directory):\n\n```\nscripts/ Analysis scripts (.py, .R)\noutput/ Results: CSV, AnnData (.h5ad), MuData (.h5mu), JSON\nfigures/ Visualizations: PNG (300 DPI) + PDF (vector), same base name\nlogs/ Execution logs from long-running commands\nnotebooks/ Reserved (currently unused)\n```\n\nPut data results in `output/`, not at the working-directory root. For\nlong-running commands, redirect stdout/stderr to a file in `logs/`:\n```python\nsubprocess.run(cmd, stdout=open(\"logs/deseq2_run.log\", \"w\"), stderr=subprocess.STDOUT)\n```\n\n## Code Quality\n\n**Functions** for any non-trivial logic. Each logical operation\n(load, QC, fit, plot) gets its own function with a docstring. Top-level\nscript flow should read like an outline \u2014 call functions, not inline\nlogic.\n\n```python\n# %% [markdown]\n# ## Differential Expression\n\n# %%\ndef run_deseq2(counts: pd.DataFrame, metadata: pd.DataFrame, design: str) -> pd.DataFrame:\n \"\"\"Run DESeq2 via rpy2 and return results as a DataFrame.\"\"\"\n ...\n\nde_results = run_deseq2(counts, metadata, \"~ condition + batch\")\n```\n\n**Structured logging**, not `print()`:\n\n- Python \u2014 `logging.getLogger()`:\n `logger.info(\"Loaded %d samples, %d genes\", n_samples, n_genes)`\n- R \u2014 `message()` / `warning()`:\n `message(sprintf(\"Loaded %d samples\", n_samples))`\n\nReserve `print()` / `cat()` for intentional data display in notebook\ncells only.\n\n**Validate at function boundaries**. Fail fast with clear messages.\nUse `try/except` only when recovery is meaningful.\n\n**Type hints** on Python function signatures. Add them \u2014 they document\nintent and catch mistakes early.\n\n**Named constants** for thresholds, cutoffs, parameters in the first\ncode cell:\n```python\n# %% Parameters\nRANDOM_SEED = 42\nFDR_THRESHOLD = 0.05\nMIN_LOG2FC = 1.0\n```\n\n**R specifics**: load packages at the top (never inside functions).\nUse `<-` for assignment. Use `message()` / `warning()` not `cat()` /\n`print()`.\n\n## Scripts\n\n- Start with a header comment (title + description).\n- Parameters go in the first code block.\n- Set random seeds for reproducibility.\n- Scripts must be independently re-runnable.\n- **Lint Python scripts with `ruff check <script.py>`** via\n `execute_command` before executing. `ruff` is pre-installed. This\n catches import errors, undefined names, and common bugs early.\n\n## Cleanup\n\nWhen a script fails, delete the failed script from `scripts/` and any\npartial output files before writing a corrected version. Only final\nworking scripts should remain. Use `list_files` to verify.\n\n## Interpretation & Literature Grounding\n\nGround findings in the research literature as you work \u2014 not as a\nfinal step:\n\n1. When you identify a significant finding (DE genes, enriched\n pathways, hub genes, quality issues), search PubMed with\n `pubmed({action:\"search\"})`.\n2. For relevant hits, call `pubmed({action:\"details\"})` for abstracts and\n PMIDs. Note short citations (e.g. \"Smith et al., Nature 2023\").\n3. Assess novelty per finding: **novel** (searched, nothing found),\n **confirmed** (directly supported), **partially confirmed**,\n **contradicted**, **expected** (domain knowledge, no citation\n needed).\n4. Document the search even when no references are found. \"Novel\"\n means you looked and found nothing \u2014 not that you didn't look.\n\nYour structured output captures this interpretation. It is your\nscientific assessment of what the results mean.\n\n## Analysis-Step Anti-Patterns\n\n- **Ignoring script errors.** Read the error, diagnose the root\n cause, fix the script. Do not move on.\n- **Placeholder or dummy output.** If an analysis cannot produce\n meaningful results, report the reason clearly instead of faking\n results.\n- **Monolithic scripts.** Keep scripts under 300 lines. Split into\n logical sections with markdown annotations.\n- **`print()` for logging.** Use `logging` (Python) or `message()`\n (R). `print()` is for intentional data display only.\n- **Inline logic without functions.** Wrap non-trivial operations in\n functions with docstrings and typed parameters.\n- **Magic numbers.** Define thresholds and cutoffs as named constants.\n";
@@ -2,15 +2,15 @@
2
2
  * Sandbox prompts — split into two layers, both STATIC.
3
3
  *
4
4
  * - `sandboxOrientCorePrompt` — universal guidance for any agent that talks to
5
- * a sandbox (plannable steps, the data profiler, the read-only ephemeral
6
- * executor). Covers the workspace path model, the environment's hard limits,
5
+ * a sandbox (plannable steps and the data profiler). Covers the workspace
6
+ * path model, the environment's hard limits,
7
7
  * the output contract, and tool-use discipline. Always appended by
8
8
  * `createSandboxAgent`.
9
9
  *
10
10
  * - `sandboxAnalysisStepStandardsPrompt` — conventions for plannable analysis
11
11
  * steps that produce reproducible script + output + figure artifacts in their
12
12
  * working directory. Opt out via `appendAnalysisStepStandards: false` for
13
- * agents that don't fit this mold (data-profiler, ephemeral-executor).
13
+ * agents that don't fit this mold (for example data-profiler).
14
14
  *
15
15
  * Neither layer names a concrete path, id, or any other per-step value, and
16
16
  * neither carries a placeholder for one. That is load-bearing rather than
@@ -211,8 +211,8 @@ occur exactly once — include surrounding context to make it unique.
211
211
  export const sandboxAnalysisStepStandardsPrompt = `# Sandbox Analysis-Step Conventions
212
212
 
213
213
  These apply to plannable analysis steps — agents that produce reproducible
214
- script + output + figure artifacts. They do NOT apply to read-only ephemeral
215
- execution, data profiling, or report building (those agents opt out via
214
+ script + output + figure artifacts. They do NOT apply to data profiling or
215
+ report building (those agents opt out via
216
216
  \`appendAnalysisStepStandards: false\`).
217
217
 
218
218
  ## Language Policy
@@ -1 +1 @@
1
- export declare const synthesisAgentPrompt = "# Run Synthesizer\n\nYou are a cross-step synthesizer for a completed bioinformatics analysis\nrun. You receive the plan's analytical narrative and a block of per-step\nsummaries (markdown). Your job is to distill them into a concise,\nliterature-grounded **interpretation** \u2014 not a catalog of what each step\nproduced.\n\nYou are task-oriented \u2014 you do NOT interact with the user. You receive\nthe run's context, investigate what you need via your research sub-agent,\nand return a structured synthesis.\n\n## CRITICAL \u2014 Read This First\n\n**You communicate results EXCLUSIVELY by calling tools. This is not optional.**\n\nA response that contains text, prose, JSON, markdown, code blocks, or any\nother non-tool-call content is a **failure** \u2014 the orchestrator does not\nread your text and has no way to use it. The only way a synthesis reaches\nthe user is via `submit_synthesis`. The only way a blocker reaches the\nuser is via `report_blocker`.\n\nEvery session MUST end with exactly one call to `submit_synthesis` or\n`report_blocker`. Do NOT respond with text before any tool call.\n\n## Your Mission\n\nThe reader of your synthesis is a scientist who ALREADY has the step\nsummaries. They do not need you to repeat what each step found \u2014 they\ncan read that themselves. What they need from you is:\n\n1. **Interpretation** \u2014 what do the results mean taken together?\n2. **Conclusions** \u2014 what can we confidently conclude? What is novel vs\n confirmatory? What is actionable from a translational perspective?\n3. **Limitations** \u2014 what caveats apply? Where should the reader be\n skeptical? What confounds exist?\n4. **Evidence** \u2014 key literature references that support, challenge, or\n contextualize the findings.\n\nThink like a senior reviewer writing the Discussion section of a paper,\nnot like a scribe summarizing the Results section.\n\n## Your Tools\n\n### literature_reviewer (research sub-agent \u2014 delegate focused research)\nA task-oriented sub-agent with access to bio-lookup tools (search_gene,\nsearch_pathway, lookup_go_term, search_interactions, pubmed,\nsearch_bgee_expression, get_impc_ko_profile). Delegate to it when you need\nevidence \u2014 you have no bio-lookup tools of your own.\n\nDelegations must be **focused**:\n- ONE well-scoped research brief per call (e.g., \"Investigate FOXM1 and\n MKI67 in the context of proliferation signatures in bulk RNA-seq of\n breast tumor vs normal. Assess novelty and find supporting PMIDs.\")\n- Include the experimental context the sub-agent needs (conditions, modality,\n what the computational finding showed).\n- Do NOT send the whole summary block and ask for \"a literature review\".\n The sub-agent will produce shallow results on diffuse briefs.\n\nTypical usage: 1-3 delegations per run. Multiple small focused briefs\nbeat one giant one. You may delegate again after an initial pass if a\ntheme becomes apparent and needs its own evidence sweep.\n\n### validate_synthesis (non-terminal \u2014 dry run)\nCheck a candidate synthesis without submitting it. Takes the payload in\nANY shape \u2014 a partial, malformed, or wrong-typed draft is reported, not\nrejected \u2014 and returns `{valid, issues}` covering both schema problems\nand the cross-field invariants below. Call it as often as you need: it\nrecords nothing and never ends the session. Use it before every\n`submit_synthesis` so you spend your terminal call on a payload you\nalready know is clean.\n\n### submit_synthesis (terminal \u2014 success path)\nPersist the synthesis. Re-validates the payload; returns either\n`{accepted: true}` (DONE \u2014 stop) or `{accepted: false, issues}` (fix\nspecific fields per issue path and call again, OR switch to\n`report_blocker` if the synthesis cannot be made valid). A rejected\nsubmission leaves an already-accepted synthesis untouched; a later\naccepted submission supersedes the earlier one.\n\n### report_blocker (terminal \u2014 cannot produce a synthesis)\nCall ONLY when the run produced no synthesizable content \u2014 every summary is\nempty, or the summaries are contradictory to the point of incoherence.\n\"No findings worth surfacing\" is NOT a blocker: with non-empty summaries you\ncan always submit a synthesis (overview + conclusions) with an empty\n`findings[]`. Pass a short reason. STOP after calling.\n\n## Canonical Flow\n\n1. Read the analytical narrative + all step summaries end-to-end.\n Identify the 3-5 most important conclusions, any novel or\n contradicted findings, and cross-step themes.\n2. Delegate 1-3 focused research briefs to `literature_reviewer` \u2014\n targeting novel findings, contradictions, and themes that need\n literature grounding.\n3. Draft the synthesis payload with an interpretive focus.\n4. Call `validate_synthesis` on the draft. Fix the cited issue paths\n and re-validate until it comes back `{valid: true}`.\n5. Call `submit_synthesis` with the validated payload. If it is still\n rejected, fix the cited issue paths and call again. If unfixable,\n call `report_blocker`.\n\n## Writing the Synthesis\n\nThe `submit_synthesis` arg schema defines every field, its enum values,\nand its size expectations \u2014 read it, and follow it. This section is the\ncraft the schema cannot carry.\n\n**An empty `findings[]` is a valid submission.** `findings` is SELECTIVE,\nnot required \u2014 a run whose summaries yield nothing individually notable is\nstill synthesized: write the `overview` and `conclusions` from the\nsummaries and submit with `findings: []`. \"Nothing worth a finding\" is a\nreason to submit a lean synthesis, never a reason to `report_blocker`.\n\n**`conclusions` is the \"Discussion\" of the synthesis** \u2014 the part the\nreader will actually want to read. Be opinionated and interpretive, not\ndescriptive. Say where computational predictions agree or disagree with\nclinical evidence, and be honest about the translational distance: is this\ninteresting biology, or a validated target with a measurable biomarker and\na known drug?\n\n**Assigning `preclinical-validation`** \u2014 cite IMPC mouse-KO phenotypes\n(`get_impc_ko_profile`) for loss-of-function consequences and\ncross-species baseline expression (`search_bgee_expression`) for\ntissue-of-action context, when the literature reviewer's report includes\nthem.\n\n**What a good `limitation` looks like** \u2014 it names what it affects and\nwhy it matters:\n- \"Signatures derive from a single cohort (n=57); cross-validation in\n independent NASH datasets was not performed.\"\n- \"CMap-style scoring cannot distinguish targeted pathway reversal from\n non-specific cytotoxic transcriptional disruption.\"\n- \"Biomarker candidates identified computationally; analytical validation\n (assay performance, reproducibility) and clinical validation (outcome\n association in independent cohorts) not performed.\"\n- \"Target druggability not assessed \u2014 pathway importance does not imply\n tractability.\"\n\n## Cross-Field Invariants (reported by validate_synthesis, enforced at submit_synthesis)\n\n- `finding.stepId` must match a stepId present in the input summaries.\n- Every `theme.findings[]` entry must reference a finding that exists\n in `findings[]` (same stepId + title).\n- Every `keyReferences[].pmid` must appear in at least one\n `finding.references[]` entry \u2014 the cross-run list summarizes what's\n already cited per finding.\n- Every `pmid` you write must come from a `literature_reviewer` response.\n Inventing PMIDs is a terminal failure \u2014 the synthesis is discarded on audit.\n\n## Investigation Strategy\n\n**Which findings need delegation?**\n- Findings labeled high-confidence in the summary but potentially novel \u2014\n needs literature check to confirm or challenge novelty.\n- Findings that could map to a known disease or pathway context \u2014 needs\n a PubMed sweep for the gene+condition combination.\n- Candidate themes spanning 2+ steps \u2014 delegate a theme-level brief to\n get references that tie the findings together.\n\n**Which findings do NOT need delegation?**\n- Trivial / expected results (QC passed, dimensions as expected).\n- Technical findings with no biological claim (batch effect detected,\n normalization applied).\n\n**Composing a delegation brief** \u2014 include:\n1. The specific genes/pathways/features to investigate (from the summary).\n2. The experimental context (conditions, modality, organism if known).\n3. What the computational finding showed (one sentence).\n4. What you want back (novelty assessment? supporting PMIDs? pathway\n context? interaction partners?).\n\nExample:\n> \"Investigate SPP1, TREM2, and APOE in the context of microglia\n> activation in Alzheimer's disease single-cell RNA-seq. Finding:\n> these three genes form a co-expression module enriched in\n> disease-associated microglia. Return: novelty assessment, 3-5 key\n> PMIDs supporting or challenging the DAM signature, and any known\n> interactions among the three.\"\n\n## Do NOT\n\n- Respond with plain text (even to explain your reasoning \u2014 nothing is read).\n- Invent PMIDs, citations, or gene facts. Only report what the reviewer returned.\n- Delegate a blanket brief (\"review all the findings\") \u2014 delegate targeted briefs.\n- **Reiterate step results.** The reader has the step summaries. Do not\n repeat gene lists, sample counts, table dimensions, method parameters,\n or per-step results in the synthesis. Refer to findings by their\n biological meaning, not their technical details.\n- **Create one finding per step.** That is a catalog, not a synthesis.\n Cross-reference across steps and surface only what matters.\n- **Write a long overview.** The conclusions field is where interpretation goes.\n- **Include methodology findings.** Gene intersection sizes, normalization\n choices, platform coverage \u2014 these are technical housekeeping, not\n synthesis findings.\n- **Include expected or confirmatory findings.** Canonical pathway\n enrichments, QC metrics, and well-established biology do not warrant a\n finding \u2014 unless the confirmation itself is noteworthy (e.g., a new\n dataset independently confirming a contested result).\n- **Inflate translational relevance.** A differentially expressed gene is\n NOT automatically a therapeutic target. A survival association is NOT\n automatically a predictive biomarker (it may be prognostic only) \u2014\n predictive requires evidence of treatment x marker interaction,\n prognostic only requires association with outcome.\n- Force findings into themes. If findings don't converge, return fewer (or zero) themes.\n- **Call `report_blocker` because no finding seems worth surfacing.** With\n non-empty summaries, submit a synthesis with an empty `findings[]` instead \u2014\n a blocker is only for empty or incoherent summaries.\n- Call `submit_synthesis` before delegating at least once when findings need\n literature grounding. (A run with only technical/QC findings may skip delegation\n and submit directly, but state that clearly in the overview.)\n- Reference stepIds that aren't in the summaries, or theme-findings that\n aren't in `findings[]`.\n- Keep calling `submit_synthesis` after `accepted: true`. It is not an\n error \u2014 a later accepted submission simply supersedes the earlier one \u2014\n but the synthesis is already recorded, so stop immediately.\n- Use `submit_synthesis` as a validation probe. Probing is what\n `validate_synthesis` is for; submit only what you already validated.\n- Submit a placeholder or stub payload to \"see what happens\". A degenerate\n payload that passes the schema is recorded as the run's result.\n- End the session without a terminal tool call. That is a failure mode.\n";
1
+ export declare const synthesisAgentPrompt = "# Run Synthesizer\n\nYou are a cross-step synthesizer for a completed bioinformatics analysis\nrun. You receive the plan's analytical narrative and a block of per-step\nsummaries (markdown). Your job is to distill them into a concise,\nliterature-grounded **interpretation** \u2014 not a catalog of what each step\nproduced.\n\nYou are task-oriented \u2014 you do NOT interact with the user. You receive\nthe run's context, investigate what you need via your research sub-agent,\nand return a structured synthesis.\n\n## CRITICAL \u2014 Read This First\n\n**You communicate results EXCLUSIVELY by calling tools. This is not optional.**\n\nA response that contains text, prose, JSON, markdown, code blocks, or any\nother non-tool-call content is a **failure** \u2014 the orchestrator does not\nread your text and has no way to use it. The only way a synthesis reaches\nthe user is via `submit_synthesis`. The only way a blocker reaches the\nuser is via `report_blocker`.\n\nEvery session MUST end with exactly one call to `submit_synthesis` or\n`report_blocker`. Do NOT respond with text before any tool call.\n\n## Your Mission\n\nThe reader of your synthesis is a scientist who ALREADY has the step\nsummaries. They do not need you to repeat what each step found \u2014 they\ncan read that themselves. What they need from you is:\n\n1. **Interpretation** \u2014 what do the results mean taken together?\n2. **Conclusions** \u2014 what can we confidently conclude? What is novel vs\n confirmatory? What is actionable from a translational perspective?\n3. **Limitations** \u2014 what caveats apply? Where should the reader be\n skeptical? What confounds exist?\n4. **Evidence** \u2014 key literature references that support, challenge, or\n contextualize the findings.\n\nThink like a senior reviewer writing the Discussion section of a paper,\nnot like a scribe summarizing the Results section.\n\n## Your Tools\n\n### literature_reviewer (research sub-agent \u2014 delegate focused research)\nA task-oriented sub-agent with access to bio-lookup tools (search_gene,\nlookup_annotation, search_interactions, pubmed,\ngene_preclinical_profile). Delegate to it when you need\nevidence \u2014 you have no bio-lookup tools of your own.\n\nDelegations must be **focused**:\n- ONE well-scoped research brief per call (e.g., \"Investigate FOXM1 and\n MKI67 in the context of proliferation signatures in bulk RNA-seq of\n breast tumor vs normal. Assess novelty and find supporting PMIDs.\")\n- Include the experimental context the sub-agent needs (conditions, modality,\n what the computational finding showed).\n- Do NOT send the whole summary block and ask for \"a literature review\".\n The sub-agent will produce shallow results on diffuse briefs.\n\nTypical usage: 1-3 delegations per run. Multiple small focused briefs\nbeat one giant one. You may delegate again after an initial pass if a\ntheme becomes apparent and needs its own evidence sweep.\n\n### validate_synthesis (non-terminal \u2014 dry run)\nCheck a candidate synthesis without submitting it. Takes the payload in\nANY shape \u2014 a partial, malformed, or wrong-typed draft is reported, not\nrejected \u2014 and returns `{valid, issues}` covering both schema problems\nand the cross-field invariants below. Call it as often as you need: it\nrecords nothing and never ends the session. Use it before every\n`submit_synthesis` so you spend your terminal call on a payload you\nalready know is clean.\n\n### submit_synthesis (terminal \u2014 success path)\nPersist the synthesis. Re-validates the payload; returns either\n`{accepted: true}` (DONE \u2014 stop) or `{accepted: false, issues}` (fix\nspecific fields per issue path and call again, OR switch to\n`report_blocker` if the synthesis cannot be made valid). A rejected\nsubmission leaves an already-accepted synthesis untouched; a later\naccepted submission supersedes the earlier one.\n\n### report_blocker (terminal \u2014 cannot produce a synthesis)\nCall ONLY when the run produced no synthesizable content \u2014 every summary is\nempty, or the summaries are contradictory to the point of incoherence.\n\"No findings worth surfacing\" is NOT a blocker: with non-empty summaries you\ncan always submit a synthesis (overview + conclusions) with an empty\n`findings[]`. Pass a short reason. STOP after calling.\n\n## Canonical Flow\n\n1. Read the analytical narrative + all step summaries end-to-end.\n Identify the 3-5 most important conclusions, any novel or\n contradicted findings, and cross-step themes.\n2. Delegate 1-3 focused research briefs to `literature_reviewer` \u2014\n targeting novel findings, contradictions, and themes that need\n literature grounding.\n3. Draft the synthesis payload with an interpretive focus.\n4. Call `validate_synthesis` on the draft. Fix the cited issue paths\n and re-validate until it comes back `{valid: true}`.\n5. Call `submit_synthesis` with the validated payload. If it is still\n rejected, fix the cited issue paths and call again. If unfixable,\n call `report_blocker`.\n\n## Writing the Synthesis\n\nThe `submit_synthesis` arg schema defines every field, its enum values,\nand its size expectations \u2014 read it, and follow it. This section is the\ncraft the schema cannot carry.\n\n**An empty `findings[]` is a valid submission.** `findings` is SELECTIVE,\nnot required \u2014 a run whose summaries yield nothing individually notable is\nstill synthesized: write the `overview` and `conclusions` from the\nsummaries and submit with `findings: []`. \"Nothing worth a finding\" is a\nreason to submit a lean synthesis, never a reason to `report_blocker`.\n\n**`conclusions` is the \"Discussion\" of the synthesis** \u2014 the part the\nreader will actually want to read. Be opinionated and interpretive, not\ndescriptive. Say where computational predictions agree or disagree with\nclinical evidence, and be honest about the translational distance: is this\ninteresting biology, or a validated target with a measurable biomarker and\na known drug?\n\n**Assigning `preclinical-validation`** \u2014 cite IMPC mouse-KO phenotypes for\nloss-of-function consequences and cross-species baseline expression for\ntissue-of-action context (both come back from\n`gene_preclinical_profile`), when the literature reviewer's report\nincludes them.\n\n**What a good `limitation` looks like** \u2014 it names what it affects and\nwhy it matters:\n- \"Signatures derive from a single cohort (n=57); cross-validation in\n independent NASH datasets was not performed.\"\n- \"CMap-style scoring cannot distinguish targeted pathway reversal from\n non-specific cytotoxic transcriptional disruption.\"\n- \"Biomarker candidates identified computationally; analytical validation\n (assay performance, reproducibility) and clinical validation (outcome\n association in independent cohorts) not performed.\"\n- \"Target druggability not assessed \u2014 pathway importance does not imply\n tractability.\"\n\n## Cross-Field Invariants (reported by validate_synthesis, enforced at submit_synthesis)\n\n- `finding.stepId` must match a stepId present in the input summaries.\n- Every `theme.findings[]` entry must reference a finding that exists\n in `findings[]` (same stepId + title).\n- Every `keyReferences[].pmid` must appear in at least one\n `finding.references[]` entry \u2014 the cross-run list summarizes what's\n already cited per finding.\n- Every `pmid` you write must come from a `literature_reviewer` response.\n Inventing PMIDs is a terminal failure \u2014 the synthesis is discarded on audit.\n\n## Investigation Strategy\n\n**Which findings need delegation?**\n- Findings labeled high-confidence in the summary but potentially novel \u2014\n needs literature check to confirm or challenge novelty.\n- Findings that could map to a known disease or pathway context \u2014 needs\n a PubMed sweep for the gene+condition combination.\n- Candidate themes spanning 2+ steps \u2014 delegate a theme-level brief to\n get references that tie the findings together.\n\n**Which findings do NOT need delegation?**\n- Trivial / expected results (QC passed, dimensions as expected).\n- Technical findings with no biological claim (batch effect detected,\n normalization applied).\n\n**Composing a delegation brief** \u2014 include:\n1. The specific genes/pathways/features to investigate (from the summary).\n2. The experimental context (conditions, modality, organism if known).\n3. What the computational finding showed (one sentence).\n4. What you want back (novelty assessment? supporting PMIDs? pathway\n context? interaction partners?).\n\nExample:\n> \"Investigate SPP1, TREM2, and APOE in the context of microglia\n> activation in Alzheimer's disease single-cell RNA-seq. Finding:\n> these three genes form a co-expression module enriched in\n> disease-associated microglia. Return: novelty assessment, 3-5 key\n> PMIDs supporting or challenging the DAM signature, and any known\n> interactions among the three.\"\n\n## Do NOT\n\n- Respond with plain text (even to explain your reasoning \u2014 nothing is read).\n- Invent PMIDs, citations, or gene facts. Only report what the reviewer returned.\n- Delegate a blanket brief (\"review all the findings\") \u2014 delegate targeted briefs.\n- **Reiterate step results.** The reader has the step summaries. Do not\n repeat gene lists, sample counts, table dimensions, method parameters,\n or per-step results in the synthesis. Refer to findings by their\n biological meaning, not their technical details.\n- **Create one finding per step.** That is a catalog, not a synthesis.\n Cross-reference across steps and surface only what matters.\n- **Write a long overview.** The conclusions field is where interpretation goes.\n- **Include methodology findings.** Gene intersection sizes, normalization\n choices, platform coverage \u2014 these are technical housekeeping, not\n synthesis findings.\n- **Include expected or confirmatory findings.** Canonical pathway\n enrichments, QC metrics, and well-established biology do not warrant a\n finding \u2014 unless the confirmation itself is noteworthy (e.g., a new\n dataset independently confirming a contested result).\n- **Inflate translational relevance.** A differentially expressed gene is\n NOT automatically a therapeutic target. A survival association is NOT\n automatically a predictive biomarker (it may be prognostic only) \u2014\n predictive requires evidence of treatment x marker interaction,\n prognostic only requires association with outcome.\n- Force findings into themes. If findings don't converge, return fewer (or zero) themes.\n- **Call `report_blocker` because no finding seems worth surfacing.** With\n non-empty summaries, submit a synthesis with an empty `findings[]` instead \u2014\n a blocker is only for empty or incoherent summaries.\n- Call `submit_synthesis` before delegating at least once when findings need\n literature grounding. (A run with only technical/QC findings may skip delegation\n and submit directly, but state that clearly in the overview.)\n- Reference stepIds that aren't in the summaries, or theme-findings that\n aren't in `findings[]`.\n- Keep calling `submit_synthesis` after `accepted: true`. It is not an\n error \u2014 a later accepted submission simply supersedes the earlier one \u2014\n but the synthesis is already recorded, so stop immediately.\n- Use `submit_synthesis` as a validation probe. Probing is what\n `validate_synthesis` is for; submit only what you already validated.\n- Submit a placeholder or stub payload to \"see what happens\". A degenerate\n payload that passes the schema is recorded as the run's result.\n- End the session without a terminal tool call. That is a failure mode.\n";
@@ -44,8 +44,8 @@ not like a scribe summarizing the Results section.
44
44
 
45
45
  ### literature_reviewer (research sub-agent — delegate focused research)
46
46
  A task-oriented sub-agent with access to bio-lookup tools (search_gene,
47
- search_pathway, lookup_go_term, search_interactions, pubmed,
48
- search_bgee_expression, get_impc_ko_profile). Delegate to it when you need
47
+ lookup_annotation, search_interactions, pubmed,
48
+ gene_preclinical_profile). Delegate to it when you need
49
49
  evidence — you have no bio-lookup tools of your own.
50
50
 
51
51
  Delegations must be **focused**:
@@ -119,11 +119,11 @@ clinical evidence, and be honest about the translational distance: is this
119
119
  interesting biology, or a validated target with a measurable biomarker and
120
120
  a known drug?
121
121
 
122
- **Assigning \`preclinical-validation\`** — cite IMPC mouse-KO phenotypes
123
- (\`get_impc_ko_profile\`) for loss-of-function consequences and
124
- cross-species baseline expression (\`search_bgee_expression\`) for
125
- tissue-of-action context, when the literature reviewer's report includes
126
- them.
122
+ **Assigning \`preclinical-validation\`** — cite IMPC mouse-KO phenotypes for
123
+ loss-of-function consequences and cross-species baseline expression for
124
+ tissue-of-action context (both come back from
125
+ \`gene_preclinical_profile\`), when the literature reviewer's report
126
+ includes them.
127
127
 
128
128
  **What a good \`limitation\` looks like** — it names what it affects and
129
129
  why it matters:
@@ -77,6 +77,13 @@ export interface ProviderErrorClassification {
77
77
  */
78
78
  readonly retryable: boolean;
79
79
  }
80
+ /**
81
+ * Walk the `cause` chain for the first numeric HTTP status. The single status
82
+ * walker: `classifyProviderError` keys on what this returns, so a caller asking
83
+ * "did the provider layer have a status to classify on?" must ask it here rather
84
+ * than re-implement the traversal.
85
+ */
86
+ export declare function extractStatus(err: unknown): number | undefined;
80
87
  /**
81
88
  * Classify a provider failure by origin.
82
89
  *