@inflexa-ai/harness 0.13.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 (162) hide show
  1. package/dist/agents/conversation-agent.js +23 -16
  2. package/dist/agents/sandbox/cheminformatics-agent.js +1 -1
  3. package/dist/agents/sandbox/chromatin-agent.js +1 -1
  4. package/dist/agents/sandbox/dna-methylation-agent.js +1 -1
  5. package/dist/agents/sandbox/drug-repurposing-agent.js +5 -10
  6. package/dist/agents/sandbox/enrichment-agent.js +1 -1
  7. package/dist/agents/sandbox/genomic-variant-agent.js +1 -11
  8. package/dist/agents/sandbox/immune-profiling-agent.js +1 -1
  9. package/dist/agents/sandbox/multi-omics-integration-agent.js +1 -1
  10. package/dist/agents/sandbox/network-agent.js +1 -1
  11. package/dist/agents/sandbox/pkpd-clinical-response-agent.js +3 -6
  12. package/dist/agents/sandbox/scientific-executor.js +1 -1
  13. package/dist/agents/sandbox/shared.js +7 -13
  14. package/dist/agents/sandbox/translational-safety-agent.js +4 -7
  15. package/dist/agents/sandbox/types.d.ts +5 -5
  16. package/dist/agents/sandbox/types.js +4 -4
  17. package/dist/app/chat-turn.js +4 -1
  18. package/dist/app/message-assembly.d.ts +5 -2
  19. package/dist/app/message-assembly.js +7 -2
  20. package/dist/app/run-activity.d.ts +13 -0
  21. package/dist/app/run-activity.js +51 -0
  22. package/dist/contracts/target-dossier.d.ts +10 -10
  23. package/dist/execution/report-runner.js +1 -1
  24. package/dist/execution/run-event-parts.d.ts +44 -0
  25. package/dist/execution/run-event-parts.js +0 -0
  26. package/dist/execution/run-event-stream.d.ts +91 -0
  27. package/dist/execution/run-event-stream.js +212 -0
  28. package/dist/execution/run-synthesis.js +1 -1
  29. package/dist/index.d.ts +5 -2
  30. package/dist/index.js +20 -1
  31. package/dist/input-sanitization.d.ts +14 -4
  32. package/dist/input-sanitization.js +27 -4
  33. package/dist/lib/storage.js +4 -1
  34. package/dist/loop/budget-exceeded.d.ts +18 -2
  35. package/dist/loop/budget-exceeded.js +49 -2
  36. package/dist/loop/run-agent.d.ts +22 -1
  37. package/dist/loop/run-agent.js +50 -5
  38. package/dist/loop/run-to-terminal.d.ts +0 -2
  39. package/dist/loop/run-to-terminal.js +8 -1
  40. package/dist/memory/ai-sdk-message-storage.d.ts +37 -4
  41. package/dist/memory/ai-sdk-message-storage.js +45 -4
  42. package/dist/memory/content-to-cortex.js +19 -3
  43. package/dist/memory/message-backfill.js +1 -1
  44. package/dist/memory/thread-history.js +34 -8
  45. package/dist/prompts/conversation.d.ts +1 -1
  46. package/dist/prompts/conversation.js +15 -6
  47. package/dist/prompts/literature-reviewer.d.ts +1 -1
  48. package/dist/prompts/literature-reviewer.js +16 -14
  49. package/dist/prompts/planner.js +15 -20
  50. package/dist/prompts/sandbox/drug-repurposing-agent.d.ts +1 -1
  51. package/dist/prompts/sandbox/drug-repurposing-agent.js +31 -22
  52. package/dist/prompts/sandbox/multi-omics-integration-agent.d.ts +1 -1
  53. package/dist/prompts/sandbox/multi-omics-integration-agent.js +9 -10
  54. package/dist/prompts/sandbox/pkpd-clinical-response-agent.d.ts +1 -1
  55. package/dist/prompts/sandbox/pkpd-clinical-response-agent.js +8 -7
  56. package/dist/prompts/sandbox/translational-safety-agent.d.ts +1 -1
  57. package/dist/prompts/sandbox/translational-safety-agent.js +20 -14
  58. package/dist/prompts/synthesis-agent.d.ts +1 -1
  59. package/dist/prompts/synthesis-agent.js +7 -7
  60. package/dist/providers/errors.d.ts +7 -0
  61. package/dist/providers/errors.js +88 -3
  62. package/dist/runtime/pools.d.ts +15 -1
  63. package/dist/runtime/pools.js +15 -1
  64. package/dist/sandbox/sandbox-step-translate.d.ts +15 -2
  65. package/dist/sandbox/sandbox-step-translate.js +17 -2
  66. package/dist/schemas/workflow-state.d.ts +2 -2
  67. package/dist/schemas/workflow-state.js +2 -2
  68. package/dist/state/data-profile.d.ts +53 -1
  69. package/dist/state/data-profile.js +66 -6
  70. package/dist/state/index.d.ts +3 -3
  71. package/dist/state/index.js +2 -2
  72. package/dist/state/init.js +37 -2
  73. package/dist/state/runs.d.ts +39 -0
  74. package/dist/state/runs.js +103 -0
  75. package/dist/tasks/data-profile-activity.d.ts +87 -0
  76. package/dist/tasks/data-profile-activity.js +56 -0
  77. package/dist/tasks/data-profile.js +66 -4
  78. package/dist/tools/bio/chembl.d.ts +1 -1
  79. package/dist/tools/bio/chembl.js +51 -54
  80. package/dist/tools/bio/comptox.js +35 -33
  81. package/dist/tools/bio/drug-gene-interactions.d.ts +76 -0
  82. package/dist/tools/bio/drug-gene-interactions.js +175 -0
  83. package/dist/tools/bio/gene-disease-evidence.d.ts +61 -0
  84. package/dist/tools/bio/gene-disease-evidence.js +187 -0
  85. package/dist/tools/bio/gene-preclinical-profile.d.ts +58 -0
  86. package/dist/tools/bio/gene-preclinical-profile.js +125 -0
  87. package/dist/tools/bio/index.d.ts +23 -16
  88. package/dist/tools/bio/index.js +29 -22
  89. package/dist/tools/bio/keys.d.ts +16 -9
  90. package/dist/tools/bio/keys.js +22 -13
  91. package/dist/tools/bio/lookup-annotation.d.ts +48 -0
  92. package/dist/tools/bio/lookup-annotation.js +173 -0
  93. package/dist/tools/bio/opentargets.d.ts +7 -11
  94. package/dist/tools/bio/opentargets.js +24 -35
  95. package/dist/tools/bio/pubchem.js +6 -4
  96. package/dist/tools/bio/pubmed.d.ts +15 -7
  97. package/dist/tools/bio/pubmed.js +79 -20
  98. package/dist/tools/bio/search-clinical-trials.d.ts +20 -1
  99. package/dist/tools/bio/search-clinical-trials.js +26 -5
  100. package/dist/tools/bio/search-faers.js +9 -3
  101. package/dist/tools/bio/search-gene.d.ts +0 -1
  102. package/dist/tools/bio/search-gene.js +4 -5
  103. package/dist/tools/bio/search-geo-datasets.js +10 -4
  104. package/dist/tools/bio/search-interactions.d.ts +8 -4
  105. package/dist/tools/bio/search-interactions.js +28 -12
  106. package/dist/tools/bio/target-safety.d.ts +59 -0
  107. package/dist/tools/bio/target-safety.js +191 -0
  108. package/dist/tools/execute-analysis.d.ts +1 -0
  109. package/dist/tools/execute-analysis.js +5 -5
  110. package/dist/tools/lib/dgidb-client.d.ts +49 -0
  111. package/dist/tools/lib/dgidb-client.js +168 -0
  112. package/dist/tools/lib/disgenet-client.d.ts +56 -0
  113. package/dist/tools/lib/disgenet-client.js +59 -0
  114. package/dist/tools/lib/drugbank-client.d.ts +83 -0
  115. package/dist/tools/lib/drugbank-client.js +95 -0
  116. package/dist/tools/lib/ensembl-client.d.ts +4 -1
  117. package/dist/tools/lib/ensembl-client.js +5 -3
  118. package/dist/tools/lib/gwas-catalog-client.d.ts +60 -0
  119. package/dist/tools/lib/gwas-catalog-client.js +136 -0
  120. package/dist/tools/lib/pharmgkb-client.d.ts +22 -0
  121. package/dist/tools/lib/pharmgkb-client.js +32 -0
  122. package/dist/tools/lib/pubmed-client.d.ts +57 -4
  123. package/dist/tools/lib/pubmed-client.js +57 -3
  124. package/dist/tools/lib/string-client.d.ts +25 -4
  125. package/dist/tools/lib/string-client.js +22 -5
  126. package/dist/tools/research/generate-plan.d.ts +16 -9
  127. package/dist/tools/research/generate-plan.js +115 -69
  128. package/dist/tools/research/inspect-data-profile.d.ts +31 -6
  129. package/dist/tools/research/inspect-data-profile.js +23 -7
  130. package/dist/tools/research/inspect-run.d.ts +33 -15
  131. package/dist/tools/research/inspect-run.js +155 -66
  132. package/dist/tools/research/literature-reviewer.js +7 -11
  133. package/dist/workflows/execute-analysis.d.ts +63 -0
  134. package/dist/workflows/execute-analysis.js +73 -2
  135. package/dist/workflows/sandbox-step.js +1 -11
  136. package/dist/workflows/target-assessment/decisions/index.d.ts +1 -1
  137. package/dist/workflows/target-assessment/phase4-assemble.d.ts +1 -1
  138. package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +2 -2
  139. package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +1 -1
  140. package/package.json +1 -1
  141. package/dist/tools/bio/check-safety-panel.d.ts +0 -35
  142. package/dist/tools/bio/check-safety-panel.js +0 -76
  143. package/dist/tools/bio/get-impc-ko-profile.d.ts +0 -9
  144. package/dist/tools/bio/get-impc-ko-profile.js +0 -23
  145. package/dist/tools/bio/lookup-go-term.d.ts +0 -31
  146. package/dist/tools/bio/lookup-go-term.js +0 -116
  147. package/dist/tools/bio/search-bgee-expression.d.ts +0 -10
  148. package/dist/tools/bio/search-bgee-expression.js +0 -30
  149. package/dist/tools/bio/search-clinvar.d.ts +0 -13
  150. package/dist/tools/bio/search-clinvar.js +0 -28
  151. package/dist/tools/bio/search-dgidb.d.ts +0 -53
  152. package/dist/tools/bio/search-dgidb.js +0 -213
  153. package/dist/tools/bio/search-disgenet.d.ts +0 -30
  154. package/dist/tools/bio/search-disgenet.js +0 -84
  155. package/dist/tools/bio/search-drugbank.d.ts +0 -38
  156. package/dist/tools/bio/search-drugbank.js +0 -109
  157. package/dist/tools/bio/search-gwas-catalog.d.ts +0 -33
  158. package/dist/tools/bio/search-gwas-catalog.js +0 -172
  159. package/dist/tools/bio/search-pathway.d.ts +0 -12
  160. package/dist/tools/bio/search-pathway.js +0 -32
  161. package/dist/tools/bio/search-pharmgkb.d.ts +0 -17
  162. package/dist/tools/bio/search-pharmgkb.js +0 -52
@@ -29,7 +29,7 @@ import { createWorkingMemory } from "../memory/working-memory.js";
29
29
  import { conversationPrompt } from "../prompts/conversation.js";
30
30
  import { composeSystemPrompt } from "./system-prompt.js";
31
31
  // Bio-lookup leaf tools (pure — no dependencies).
32
- import { searchGeneTool, searchPathwayTool, lookupGoTermTool, searchInteractionsTool, chemblTool, pubchemTool, openTargetsTool, searchGwasCatalogTool, searchPharmgkbTool, searchFaersTool, searchClinicalTrialsTool, searchGeoDatasetsTool, createSearchDgidbTool, searchBgeeExpressionTool, getImpcKoProfileTool, checkSafetyPanelTool, } from "../tools/bio/index.js";
32
+ import { searchGeneTool, lookupAnnotationTool, searchInteractionsTool, chemblTool, pubchemTool, openTargetsTool, searchFaersTool, searchClinicalTrialsTool, searchGeoDatasetsTool, genePreclinicalProfileTool, targetSafetyTool, } from "../tools/bio/index.js";
33
33
  import { createNcbiTools, createChemDbTools } from "../tools/bio/keys.js";
34
34
  // Dependency-bearing tool factories.
35
35
  import { createGeneratePlanTool, createLiteratureReviewerTool, createInspectRunTool, createInspectDataProfileTool, createGenerateAnalogyReportTool, } from "../tools/research/index.js";
@@ -49,12 +49,13 @@ export function createConversationAgent(deps) {
49
49
  const { provider, pool, embedding, workspaceFs, model, utilityProvider, utilityModel, executeAnalysisWorkflow, resolveWorkspaceRoot, runAuthorizer, runLauncher, createPreviewPublisher, bioKeys, templatesDir, skillsDir, chrome, resourcePolicy, hostTools, refStorePath, packagesFile, } = deps;
50
50
  const workingMemory = createWorkingMemory(pool);
51
51
  const ncbi = createNcbiTools(bioKeys);
52
- const chemDb = createChemDbTools(bioKeys);
52
+ const chemDb = createChemDbTools(bioKeys, { ...(deps.logger ? { logger: deps.logger } : {}) });
53
53
  const tools = [
54
- // Bio-lookup.
54
+ // Identifier resolution — the ENSG most other bio tools key off.
55
55
  searchGeneTool,
56
- searchPathwayTool,
57
- lookupGoTermTool,
56
+ // Functional annotation (GO / KEGG / Reactome behind one vocabulary) and
57
+ // STRING networks + gene-set enrichment.
58
+ lookupAnnotationTool,
58
59
  searchInteractionsTool,
59
60
  // Literature (search / details / fulltext behind one action).
60
61
  ncbi.pubmed,
@@ -62,20 +63,19 @@ export function createConversationAgent(deps) {
62
63
  chemblTool,
63
64
  // PubChem (compound / crossrefs / assays behind one action).
64
65
  pubchemTool,
65
- // Translational medicine.
66
+ // Target assessment: the integrated scored view, then the underlying records.
66
67
  openTargetsTool,
67
- // Genetic evidence — SNP-trait associations for target validation / MR support.
68
- searchGwasCatalogTool,
69
- searchPharmgkbTool,
68
+ // Genetic evidence — GWAS Catalog + DisGeNET + ClinVar behind one `sources`.
69
+ chemDb.geneDiseaseEvidence,
70
+ // Drug↔gene interactions — DGIdb + DrugBank + PharmGKB behind one `sources`.
71
+ chemDb.drugGeneInteractions,
70
72
  searchFaersTool,
71
73
  searchClinicalTrialsTool,
72
74
  searchGeoDatasetsTool,
73
- createSearchDgidbTool({ ...(deps.logger ? { logger: deps.logger } : {}) }),
74
- // Preclinical.
75
- searchBgeeExpressionTool,
76
- getImpcKoProfileTool,
77
- // Off-target liability.
78
- checkSafetyPanelTool,
75
+ // Preclinical — baseline expression + mouse knockout in one call.
76
+ genePreclinicalProfileTool,
77
+ // Target-level safety — the curated panel + Open Targets liabilities.
78
+ targetSafetyTool,
79
79
  // EPA CompTox (toxcast / hazard / chemical / exposure behind one dataset).
80
80
  chemDb.comptox,
81
81
  // What reference data this install actually holds. The conversation agent is
@@ -92,7 +92,14 @@ export function createConversationAgent(deps) {
92
92
  createInspectRunTool(pool),
93
93
  // The dataset's own record. No file backs it — the DB row is the only copy.
94
94
  createInspectDataProfileTool(pool),
95
- createGeneratePlanTool({ provider, pool, model, resourcePolicy, ...(refStorePath ? { refStorePath } : {}), ...(packagesFile ? { packagesFile } : {}) }),
95
+ createGeneratePlanTool({
96
+ conversation: { provider, model },
97
+ pool,
98
+ resourcePolicy,
99
+ ...(refStorePath ? { refStorePath } : {}),
100
+ ...(packagesFile ? { packagesFile } : {}),
101
+ ...(deps.logger ? { logger: deps.logger } : {}),
102
+ }),
96
103
  createExecuteAnalysisTool({
97
104
  pool,
98
105
  executeAnalysisWorkflow,
@@ -37,7 +37,7 @@ export const meta = {
37
37
  "perturbation-signatures",
38
38
  ],
39
39
  skills: ["cheminformatics", "shared/omics-general"],
40
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions", "chembl", "searchDgidb", "pubchem"],
40
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions", "chembl", "drugGeneInteractions", "pubchem"],
41
41
  };
42
42
  export function createCheminformaticsAgent(deps) {
43
43
  return createSandboxAgent(deps, meta, cheminformaticsAgentPrompt);
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["peak calling", "differential binding", "differential accessibility", "motif analysis", "footprinting", "signal visualization"],
9
9
  suitableFor: ["atac-seq", "chip-seq", "cut-and-tag", "cut-and-run", "scatac-seq"],
10
10
  skills: ["chromatin-regulation", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions"],
12
12
  };
13
13
  export function createChromatinAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, chromatinAgentPrompt);
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["methylation array analysis", "bisulfite-seq analysis", "DMP detection", "DMR detection", "methylation clocks", "cell type deconvolution"],
9
9
  suitableFor: ["methylation-array", "wgbs", "rrbs", "epic", "450k"],
10
10
  skills: ["dna-methylation", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions"],
12
12
  };
13
13
  export function createDnaMethylationAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, dnaMethylationAgentPrompt);
@@ -19,23 +19,18 @@ export const meta = {
19
19
  skills: ["drug-repurposing", "cheminformatics", "shared/omics-general"],
20
20
  tools: [
21
21
  ...BASE_SANDBOX_TOOLS,
22
- "checkSafetyPanel",
22
+ "targetSafety",
23
23
  "pubmed",
24
24
  "searchGene",
25
- "searchPathway",
26
- "lookupGoTerm",
25
+ "lookupAnnotation",
27
26
  "searchInteractions",
28
27
  "chembl",
29
28
  "opentargets",
30
29
  "searchClinicalTrials",
31
30
  "searchFaers",
32
- "searchGwasCatalog",
33
- "searchClinvar",
34
- "searchDisgenet",
35
- "searchDrugbank",
36
- "searchDgidb",
37
- "searchBgeeExpression",
38
- "getImpcKoProfile",
31
+ "geneDiseaseEvidence",
32
+ "drugGeneInteractions",
33
+ "genePreclinicalProfile",
39
34
  "comptox",
40
35
  ],
41
36
  };
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["pathway enrichment", "gene set enrichment", "GO analysis", "functional annotation"],
9
9
  suitableFor: ["gene-lists", "ranked-lists", "score-matrices", "general-omics"],
10
10
  skills: ["enrichment", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions"],
12
12
  };
13
13
  export function createEnrichmentAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, enrichmentAgentPrompt);
@@ -8,17 +8,7 @@ export const meta = {
8
8
  capabilities: ["variant calling", "variant annotation", "GWAS", "CNV detection", "structural variant detection", "variant filtering"],
9
9
  suitableFor: ["wgs", "wes", "gwas", "cnv-sv", "targeted-panels"],
10
10
  skills: ["genomic-variants", "shared/omics-general"],
11
- tools: [
12
- ...BASE_SANDBOX_TOOLS,
13
- "pubmed",
14
- "searchGene",
15
- "searchPathway",
16
- "lookupGoTerm",
17
- "searchInteractions",
18
- "searchClinvar",
19
- "searchDgidb",
20
- "searchGwasCatalog",
21
- ],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions", "geneDiseaseEvidence", "drugGeneInteractions"],
22
12
  };
23
13
  export function createGenomicVariantAgent(deps) {
24
14
  return createSandboxAgent(deps, meta, genomicVariantAgentPrompt);
@@ -24,7 +24,7 @@ export const meta = {
24
24
  "immune-cell-composition",
25
25
  ],
26
26
  skills: ["immune-profiling", "shared/omics-general"],
27
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions", "searchGeoDatasets", "opentargets"],
27
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions", "searchGeoDatasets", "opentargets"],
28
28
  };
29
29
  export function createImmuneProfilingAgent(deps) {
30
30
  return createSandboxAgent(deps, meta, immuneProfilingAgentPrompt);
@@ -15,7 +15,7 @@ export const meta = {
15
15
  ],
16
16
  suitableFor: ["multi-omics", "cross-modality-integration"],
17
17
  skills: ["multi-omics-integration", "shared/omics-general"],
18
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions", "searchBgeeExpression", "getImpcKoProfile"],
18
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions", "genePreclinicalProfile"],
19
19
  };
20
20
  export function createMultiOmicsIntegrationAgent(deps) {
21
21
  return createSandboxAgent(deps, meta, multiOmicsIntegrationAgentPrompt);
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["network analysis", "co-expression networks", "regulatory analysis", "module detection", "TF activity inference"],
9
9
  suitableFor: ["expression-matrices", "correlation-matrices", "general-omics"],
10
10
  skills: ["network-regulatory", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions"],
12
12
  defaultMaxSteps: 35,
13
13
  };
14
14
  export function createNetworkAgent(deps) {
@@ -36,16 +36,13 @@ export const meta = {
36
36
  ...BASE_SANDBOX_TOOLS,
37
37
  "pubmed",
38
38
  "searchGene",
39
- "searchPathway",
40
- "lookupGoTerm",
39
+ "lookupAnnotation",
41
40
  "searchInteractions",
42
41
  "searchClinicalTrials",
43
42
  "searchFaers",
44
- "searchPharmgkb",
43
+ "drugGeneInteractions",
45
44
  "chembl",
46
- "searchDgidb",
47
- "searchBgeeExpression",
48
- "getImpcKoProfile",
45
+ "genePreclinicalProfile",
49
46
  ],
50
47
  };
51
48
  export function createPkpdClinicalResponseAgent(deps) {
@@ -39,7 +39,7 @@ export const meta = {
39
39
  "drug-repurposing",
40
40
  "shared/omics-general",
41
41
  ],
42
- tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
42
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions"],
43
43
  plannable: false,
44
44
  };
45
45
  export function createScientificExecutorAgent(deps) {
@@ -26,7 +26,7 @@ import { createInspectRunTool } from "../../tools/research/inspect-run.js";
26
26
  // Data-profile retrieval (dependency-bearing) — always-on, see `createSandboxAgent`.
27
27
  import { createInspectDataProfileTool } from "../../tools/research/inspect-data-profile.js";
28
28
  // Bio leaf tools.
29
- import { checkSafetyPanelTool, chemblTool, getImpcKoProfileTool, lookupGoTermTool, openTargetsTool, pubchemTool, searchBgeeExpressionTool, searchClinicalTrialsTool, createSearchDgidbTool, searchFaersTool, searchGeneTool, searchGeoDatasetsTool, searchGwasCatalogTool, searchInteractionsTool, searchPathwayTool, searchPharmgkbTool, } from "../../tools/bio/index.js";
29
+ import { chemblTool, genePreclinicalProfileTool, lookupAnnotationTool, openTargetsTool, pubchemTool, searchClinicalTrialsTool, searchFaersTool, searchGeneTool, searchGeoDatasetsTool, searchInteractionsTool, targetSafetyTool, } from "../../tools/bio/index.js";
30
30
  import { createNcbiTools, createChemDbTools } from "../../tools/bio/keys.js";
31
31
  // Workspace read surface.
32
32
  import { createFileStatTool, createGrepTool, createListFilesTool, createReadFileTool, createWorkspaceSearchTool } from "../../tools/workspace/index.js";
@@ -52,7 +52,7 @@ export const BASE_SANDBOX_TOOLS = ["listAvailablePackages", "listAvailableRefs",
52
52
  */
53
53
  function resolveSandboxTools(deps, tools) {
54
54
  const ncbi = createNcbiTools(deps.bioKeys);
55
- const chemDb = createChemDbTools(deps.bioKeys);
55
+ const chemDb = createChemDbTools(deps.bioKeys, { ...(deps.logger ? { logger: deps.logger } : {}) });
56
56
  const registry = {
57
57
  listAvailablePackages: createListAvailablePackagesTool({ ...(deps.packagesFile ? { packagesFile: deps.packagesFile } : {}) }),
58
58
  listAvailableRefs: createListAvailableRefsTool({ ...(deps.refStorePath ? { refStorePath: deps.refStorePath } : {}) }),
@@ -61,24 +61,18 @@ function resolveSandboxTools(deps, tools) {
61
61
  inspectRun: createInspectRunTool(deps.pool),
62
62
  pubmed: ncbi.pubmed,
63
63
  searchGene: searchGeneTool,
64
- searchPathway: searchPathwayTool,
65
- lookupGoTerm: lookupGoTermTool,
64
+ lookupAnnotation: lookupAnnotationTool,
66
65
  searchInteractions: searchInteractionsTool,
67
66
  chembl: chemblTool,
68
67
  pubchem: pubchemTool,
69
68
  opentargets: openTargetsTool,
70
- searchPharmgkb: searchPharmgkbTool,
69
+ geneDiseaseEvidence: chemDb.geneDiseaseEvidence,
70
+ drugGeneInteractions: chemDb.drugGeneInteractions,
71
+ genePreclinicalProfile: genePreclinicalProfileTool,
71
72
  searchFaers: searchFaersTool,
72
73
  searchClinicalTrials: searchClinicalTrialsTool,
73
74
  searchGeoDatasets: searchGeoDatasetsTool,
74
- searchClinvar: ncbi.searchClinvar,
75
- searchDgidb: createSearchDgidbTool({ ...(deps.logger ? { logger: deps.logger } : {}) }),
76
- searchGwasCatalog: searchGwasCatalogTool,
77
- searchDisgenet: chemDb.searchDisgenet,
78
- searchDrugbank: chemDb.searchDrugbank,
79
- searchBgeeExpression: searchBgeeExpressionTool,
80
- getImpcKoProfile: getImpcKoProfileTool,
81
- checkSafetyPanel: checkSafetyPanelTool,
75
+ targetSafety: targetSafetyTool,
82
76
  comptox: chemDb.comptox,
83
77
  };
84
78
  const seen = new Set();
@@ -33,19 +33,16 @@ export const meta = {
33
33
  skills: ["translational-safety", "cheminformatics", "shared/omics-general"],
34
34
  tools: [
35
35
  ...BASE_SANDBOX_TOOLS,
36
- "checkSafetyPanel",
36
+ "targetSafety",
37
37
  "pubmed",
38
38
  "searchGene",
39
- "searchPathway",
40
- "lookupGoTerm",
39
+ "lookupAnnotation",
41
40
  "searchInteractions",
42
41
  "opentargets",
43
42
  "searchFaers",
44
- "searchPharmgkb",
45
- "searchDgidb",
43
+ "drugGeneInteractions",
46
44
  "comptox",
47
- "searchBgeeExpression",
48
- "getImpcKoProfile",
45
+ "genePreclinicalProfile",
49
46
  ],
50
47
  };
51
48
  export function createTranslationalSafetyAgent(deps) {
@@ -6,13 +6,13 @@
6
6
  * each name to a concrete `Tool` (pure leaf or fully dep-bound factory
7
7
  * output) — unknown names throw at composition time, not at first LLM call.
8
8
  *
9
- * `searchDisgenet` and `searchDrugbank` require keys (`DISGENET_API_KEY`,
10
- * `DRUGBANK_API_KEY`); without the key the underlying header builder
11
- * throws on first call, which the harness surfaces as a tool `is_error`
12
- * envelope. `searchGwasCatalog` is fully public.
9
+ * `geneDiseaseEvidence`, `drugGeneInteractions` and `comptox` each span several
10
+ * corpora, some of which need a key (`DISGENET_API_KEY`, `DRUGBANK_API_KEY`,
11
+ * `EPA_CCTE_API_KEY`). A missing key degrades that ONE corpus to `unavailable`
12
+ * in the tool's `perSource` report; the rest of the call still answers.
13
13
  */
14
14
  /** Closed allowlist of tools any sandbox agent may declare. */
15
- export type SandboxToolName = "listAvailablePackages" | "listAvailableRefs" | "resolveLibraryId" | "queryDocs" | "inspectRun" | "pubmed" | "searchGene" | "searchPathway" | "lookupGoTerm" | "searchInteractions" | "chembl" | "pubchem" | "opentargets" | "searchPharmgkb" | "searchFaers" | "searchClinicalTrials" | "searchGeoDatasets" | "searchClinvar" | "searchDgidb" | "searchGwasCatalog" | "searchDisgenet" | "searchDrugbank" | "searchBgeeExpression" | "getImpcKoProfile" | "checkSafetyPanel" | "comptox";
15
+ export type SandboxToolName = "listAvailablePackages" | "listAvailableRefs" | "resolveLibraryId" | "queryDocs" | "inspectRun" | "pubmed" | "searchGene" | "lookupAnnotation" | "searchInteractions" | "chembl" | "pubchem" | "opentargets" | "geneDiseaseEvidence" | "drugGeneInteractions" | "genePreclinicalProfile" | "searchFaers" | "searchClinicalTrials" | "searchGeoDatasets" | "targetSafety" | "comptox";
16
16
  /** Planner-facing metadata + tool allowlist for one sandbox agent. */
17
17
  export interface AgentMeta {
18
18
  /** Stable agent id — also the key in the catalog and the `AgentDefinition.id`. */
@@ -6,10 +6,10 @@
6
6
  * each name to a concrete `Tool` (pure leaf or fully dep-bound factory
7
7
  * output) — unknown names throw at composition time, not at first LLM call.
8
8
  *
9
- * `searchDisgenet` and `searchDrugbank` require keys (`DISGENET_API_KEY`,
10
- * `DRUGBANK_API_KEY`); without the key the underlying header builder
11
- * throws on first call, which the harness surfaces as a tool `is_error`
12
- * envelope. `searchGwasCatalog` is fully public.
9
+ * `geneDiseaseEvidence`, `drugGeneInteractions` and `comptox` each span several
10
+ * corpora, some of which need a key (`DISGENET_API_KEY`, `DRUGBANK_API_KEY`,
11
+ * `EPA_CCTE_API_KEY`). A missing key degrades that ONE corpus to `unavailable`
12
+ * in the tool's `perSource` report; the rest of the call still answers.
13
13
  */
14
14
  /** Default runaway-guard for sandbox agents. */
15
15
  export const SANDBOX_AGENT_DEFAULT_MAX_ITERATIONS = 50;
@@ -17,8 +17,9 @@ import { deriveThreadTitle } from "../memory/derive-thread-title.js";
17
17
  import { createThreadHistory } from "../memory/thread-history.js";
18
18
  import { createThreadStore } from "../memory/thread-store.js";
19
19
  import { createWorkingMemory } from "../memory/working-memory.js";
20
- import { loadAnalysisStatus } from "../state/index.js";
20
+ import { loadAnalysisStatus, queryNonTerminalRunsByAnalysis } from "../state/index.js";
21
21
  import { assembleMessages } from "./message-assembly.js";
22
+ import { renderRunActivity, renderRunActivityUnavailable, RUN_ACTIVITY_DETAIL_LIMIT } from "./run-activity.js";
22
23
  import { createNoopLogger } from "../lib/console-logger.js";
23
24
  /**
24
25
  * Prepare one chat turn: resolve thread ownership, seed the title, load
@@ -53,12 +54,14 @@ export async function prepareChatTurn(deps, params) {
53
54
  logger.warn("title-seed failed (non-fatal)", logger.errorFields(err));
54
55
  }
55
56
  const analysisState = await loadAnalysisStatus(pool, analysisId).unwrapOr(null);
57
+ const runActivityContext = await queryNonTerminalRunsByAnalysis(pool, analysisId, RUN_ACTIVITY_DETAIL_LIMIT).match((activity) => renderRunActivity(activity), () => renderRunActivityUnavailable());
56
58
  const history = createThreadHistory(pool);
57
59
  const { messages, userMessage } = await assembleMessages({
58
60
  threadId,
59
61
  analysisId,
60
62
  userInput,
61
63
  analysisContext: analysisState?.context ?? null,
64
+ runActivityContext,
62
65
  history,
63
66
  workingMemory: createWorkingMemory(pool),
64
67
  });
@@ -5,12 +5,13 @@
5
5
  *
6
6
  * [ ...loadRecent(threadId, budget) ← stable, cacheable prefix
7
7
  * {user: cortex_analysis_state.context}, ← tail
8
+ * {user: runActivityContext}, ← tail
8
9
  * {user: render(workingMemory)}, ← tail
9
10
  * {user: normalizeUnicode(redactSecrets(input))} ] ← tail
10
11
  *
11
12
  * `system + tools + history` is the cacheable prefix — it only extends
12
- * turn-to-turn. Working memory and analysis context go in the **tail** as
13
- * `user` messages: working memory changes every turn, so a system-message
13
+ * turn-to-turn. Run activity, working memory, and analysis context go in the
14
+ * **tail** as `user` messages: they change every turn, so a system-message
14
15
  * placement would bust the Anthropic cache prefix.
15
16
  *
16
17
  * Sanitization (`redactSecrets`, `normalizeUnicode`) is applied **once**, to
@@ -41,6 +42,8 @@ export interface AssembleMessagesArgs {
41
42
  readonly userInput: string;
42
43
  /** `cortex_analysis_state.context`, already read by the route. `null` when absent. */
43
44
  readonly analysisContext: string | null;
45
+ /** Fresh, non-persisted analysis-wide run activity rendered by chat-turn preparation. */
46
+ readonly runActivityContext: string;
44
47
  /** The conversation message store — supplies the history window. */
45
48
  readonly history: ThreadHistory;
46
49
  /** The working-memory store — rendered into the tail. */
@@ -5,12 +5,13 @@
5
5
  *
6
6
  * [ ...loadRecent(threadId, budget) ← stable, cacheable prefix
7
7
  * {user: cortex_analysis_state.context}, ← tail
8
+ * {user: runActivityContext}, ← tail
8
9
  * {user: render(workingMemory)}, ← tail
9
10
  * {user: normalizeUnicode(redactSecrets(input))} ] ← tail
10
11
  *
11
12
  * `system + tools + history` is the cacheable prefix — it only extends
12
- * turn-to-turn. Working memory and analysis context go in the **tail** as
13
- * `user` messages: working memory changes every turn, so a system-message
13
+ * turn-to-turn. Run activity, working memory, and analysis context go in the
14
+ * **tail** as `user` messages: they change every turn, so a system-message
14
15
  * placement would bust the Anthropic cache prefix.
15
16
  *
16
17
  * Sanitization (`redactSecrets`, `normalizeUnicode`) is applied **once**, to
@@ -50,6 +51,10 @@ export async function assembleMessages(args) {
50
51
  content: `[Analysis Context]\n${args.analysisContext}`,
51
52
  });
52
53
  }
54
+ tail.push({
55
+ role: "user",
56
+ content: args.runActivityContext,
57
+ });
53
58
  // Working memory — agent-authored, trusted. Always injected (its rendered
54
59
  // form names the sections even when empty).
55
60
  tail.push({
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Ephemeral conversation-tail projection of non-terminal analysis runs.
3
+ *
4
+ * This is derived operational state, not memory: callers render it afresh for
5
+ * each turn and never persist it to the thread.
6
+ */
7
+ import type { RunPage } from "../state/runs.js";
8
+ /** Maximum detailed run rows paid into every conversation turn. */
9
+ export declare const RUN_ACTIVITY_DETAIL_LIMIT = 20;
10
+ /** Render the bounded run-activity snapshot injected into a conversation tail. */
11
+ export declare function renderRunActivity(activity: RunPage, nowMs?: number): string;
12
+ /** Render an honest degraded state when the activity projection cannot be read. */
13
+ export declare function renderRunActivityUnavailable(): string;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Ephemeral conversation-tail projection of non-terminal analysis runs.
3
+ *
4
+ * This is derived operational state, not memory: callers render it afresh for
5
+ * each turn and never persist it to the thread.
6
+ */
7
+ /** Maximum detailed run rows paid into every conversation turn. */
8
+ export const RUN_ACTIVITY_DETAIL_LIMIT = 20;
9
+ function compactAge(startedAt, nowMs) {
10
+ const startedMs = Date.parse(startedAt);
11
+ if (!Number.isFinite(startedMs))
12
+ return "unknown age";
13
+ const elapsedSeconds = Math.max(0, Math.floor((nowMs - startedMs) / 1_000));
14
+ if (elapsedSeconds < 60)
15
+ return `${elapsedSeconds}s ago`;
16
+ const elapsedMinutes = Math.floor(elapsedSeconds / 60);
17
+ if (elapsedMinutes < 60)
18
+ return `${elapsedMinutes}m ago`;
19
+ const elapsedHours = Math.floor(elapsedMinutes / 60);
20
+ if (elapsedHours < 24)
21
+ return `${elapsedHours}h ago`;
22
+ return `${Math.floor(elapsedHours / 24)}d ago`;
23
+ }
24
+ function renderRows(label, rows, nowMs) {
25
+ if (rows.length === 0)
26
+ return [];
27
+ return [
28
+ `${label}:`,
29
+ ...rows.map((run) => `- runId: ${run.runId} | planId: ${run.planId ?? "none"} | startedAt: ${run.startedAt} | started: ${compactAge(run.startedAt, nowMs)}`),
30
+ ];
31
+ }
32
+ /** Render the bounded run-activity snapshot injected into a conversation tail. */
33
+ export function renderRunActivity(activity, nowMs = Date.now()) {
34
+ const lines = ["[Run Activity]"];
35
+ if (activity.total === 0) {
36
+ lines.push("No runs are currently running or suspended.");
37
+ return lines.join("\n");
38
+ }
39
+ const running = activity.runs.filter((run) => run.status === "running");
40
+ const suspended = activity.runs.filter((run) => run.status === "suspended_insufficient_funds");
41
+ lines.push(...renderRows("Running", running, nowMs), ...renderRows("Suspended", suspended, nowMs));
42
+ const omitted = activity.total - activity.runs.length;
43
+ if (omitted > 0) {
44
+ lines.push(`Showing ${activity.runs.length} of ${activity.total} non-terminal runs; ${omitted} omitted. Use inspect_run to page the full list.`);
45
+ }
46
+ return lines.join("\n");
47
+ }
48
+ /** Render an honest degraded state when the activity projection cannot be read. */
49
+ export function renderRunActivityUnavailable() {
50
+ return "[Run Activity]\nRun status is temporarily unavailable. Do not infer that no active runs exist.";
51
+ }
@@ -1789,8 +1789,8 @@ export declare const ExpressionHeatmapCellSchema: z.ZodObject<{
1789
1789
  medium: "medium";
1790
1790
  low: "low";
1791
1791
  absent: "absent";
1792
- not_loaded: "not_loaded";
1793
1792
  no_data: "no_data";
1793
+ not_loaded: "not_loaded";
1794
1794
  }>;
1795
1795
  }, z.core.$strip>;
1796
1796
  export declare const ExpressionHeatmapSchema: z.ZodObject<{
@@ -1808,8 +1808,8 @@ export declare const ExpressionHeatmapSchema: z.ZodObject<{
1808
1808
  medium: "medium";
1809
1809
  low: "low";
1810
1810
  absent: "absent";
1811
- not_loaded: "not_loaded";
1812
1811
  no_data: "no_data";
1812
+ not_loaded: "not_loaded";
1813
1813
  }>;
1814
1814
  }, z.core.$strip>>;
1815
1815
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -1915,8 +1915,8 @@ export declare const PreclinicalProfileSchema: z.ZodObject<{
1915
1915
  medium: "medium";
1916
1916
  low: "low";
1917
1917
  absent: "absent";
1918
- not_loaded: "not_loaded";
1919
1918
  no_data: "no_data";
1919
+ not_loaded: "not_loaded";
1920
1920
  }>;
1921
1921
  }, z.core.$strip>>;
1922
1922
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -4233,8 +4233,8 @@ export declare const DossierSchema: z.ZodObject<{
4233
4233
  medium: "medium";
4234
4234
  low: "low";
4235
4235
  absent: "absent";
4236
- not_loaded: "not_loaded";
4237
4236
  no_data: "no_data";
4237
+ not_loaded: "not_loaded";
4238
4238
  }>;
4239
4239
  }, z.core.$strip>>;
4240
4240
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -5486,8 +5486,8 @@ export declare const ReferenceBiologyV4Shape: z.ZodObject<{
5486
5486
  medium: "medium";
5487
5487
  low: "low";
5488
5488
  absent: "absent";
5489
- not_loaded: "not_loaded";
5490
5489
  no_data: "no_data";
5490
+ not_loaded: "not_loaded";
5491
5491
  }>;
5492
5492
  }, z.core.$strip>>;
5493
5493
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -6918,8 +6918,8 @@ export declare const DossierV4Schema: z.ZodObject<{
6918
6918
  medium: "medium";
6919
6919
  low: "low";
6920
6920
  absent: "absent";
6921
- not_loaded: "not_loaded";
6922
6921
  no_data: "no_data";
6922
+ not_loaded: "not_loaded";
6923
6923
  }>;
6924
6924
  }, z.core.$strip>>;
6925
6925
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -9135,8 +9135,8 @@ export declare const DossierV4BodySchema: z.ZodObject<{
9135
9135
  medium: "medium";
9136
9136
  low: "low";
9137
9137
  absent: "absent";
9138
- not_loaded: "not_loaded";
9139
9138
  no_data: "no_data";
9139
+ not_loaded: "not_loaded";
9140
9140
  }>;
9141
9141
  }, z.core.$strip>>;
9142
9142
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -12210,8 +12210,8 @@ export declare const DossierV5Schema: z.ZodObject<{
12210
12210
  medium: "medium";
12211
12211
  low: "low";
12212
12212
  absent: "absent";
12213
- not_loaded: "not_loaded";
12214
12213
  no_data: "no_data";
12214
+ not_loaded: "not_loaded";
12215
12215
  }>;
12216
12216
  }, z.core.$strip>>;
12217
12217
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -14932,8 +14932,8 @@ export declare const DossierV5BodySchema: z.ZodObject<{
14932
14932
  medium: "medium";
14933
14933
  low: "low";
14934
14934
  absent: "absent";
14935
- not_loaded: "not_loaded";
14936
14935
  no_data: "no_data";
14936
+ not_loaded: "not_loaded";
14937
14937
  }>;
14938
14938
  }, z.core.$strip>>;
14939
14939
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -16561,8 +16561,8 @@ export declare const DossierSchemaV3Legacy: z.ZodObject<{
16561
16561
  medium: "medium";
16562
16562
  low: "low";
16563
16563
  absent: "absent";
16564
- not_loaded: "not_loaded";
16565
16564
  no_data: "no_data";
16565
+ not_loaded: "not_loaded";
16566
16566
  }>;
16567
16567
  }, z.core.$strip>>;
16568
16568
  per_species_coverage: z.ZodRecord<z.ZodString, z.ZodEnum<{
@@ -147,8 +147,8 @@ export async function runReportIteration(deps, opts) {
147
147
  signal: opts.signal,
148
148
  emit: opts.emit,
149
149
  runStep: passthroughStep,
150
- }, {
151
150
  resolved: () => outcome !== undefined,
151
+ }, {
152
152
  tools: [buildReportTool, submitReportTool],
153
153
  nudge: "You stopped without calling submit_report, so this report version " +
154
154
  "was not recorded. Build the report if needed, then call " +