@inflexa-ai/harness 0.1.1 → 0.2.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 (268) hide show
  1. package/dist/agents/conversation-agent.d.ts +12 -11
  2. package/dist/agents/conversation-agent.js +30 -33
  3. package/dist/agents/report-builder.js +2 -1
  4. package/dist/agents/sandbox/bulk-transcriptomics-agent.js +1 -1
  5. package/dist/agents/sandbox/cheminformatics-agent.js +1 -19
  6. package/dist/agents/sandbox/chromatin-agent.js +1 -10
  7. package/dist/agents/sandbox/dna-methylation-agent.js +1 -10
  8. package/dist/agents/sandbox/drug-repurposing-agent.js +4 -14
  9. package/dist/agents/sandbox/enrichment-agent.js +1 -10
  10. package/dist/agents/sandbox/ephemeral-executor.js +1 -10
  11. package/dist/agents/sandbox/genomic-variant-agent.js +1 -3
  12. package/dist/agents/sandbox/immune-profiling-agent.js +1 -13
  13. package/dist/agents/sandbox/metabolomics-agent.js +1 -1
  14. package/dist/agents/sandbox/microbiome-agent.js +1 -1
  15. package/dist/agents/sandbox/multi-omics-integration-agent.js +1 -12
  16. package/dist/agents/sandbox/multimodal-sc-agent.js +1 -1
  17. package/dist/agents/sandbox/network-agent.js +1 -10
  18. package/dist/agents/sandbox/pkpd-clinical-response-agent.js +2 -8
  19. package/dist/agents/sandbox/proteomics-agent.js +1 -1
  20. package/dist/agents/sandbox/scientific-executor.js +1 -10
  21. package/dist/agents/sandbox/shared.d.ts +17 -6
  22. package/dist/agents/sandbox/shared.js +49 -38
  23. package/dist/agents/sandbox/single-cell-agent.js +1 -1
  24. package/dist/agents/sandbox/spatial-omics-agent.js +1 -1
  25. package/dist/agents/sandbox/statistical-modeling-agent.js +1 -1
  26. package/dist/agents/sandbox/translational-safety-agent.js +3 -9
  27. package/dist/agents/sandbox/types.d.ts +1 -1
  28. package/dist/agents/system-prompt.d.ts +37 -11
  29. package/dist/agents/system-prompt.js +35 -12
  30. package/dist/app/data-profile-orientation.d.ts +34 -0
  31. package/dist/app/data-profile-orientation.js +117 -0
  32. package/dist/contracts/schemas/chat-parts.d.ts +9 -9
  33. package/dist/execution/artifact-metadata.js +2 -1
  34. package/dist/execution/ephemeral-runner.d.ts +13 -0
  35. package/dist/execution/ephemeral-runner.js +23 -1
  36. package/dist/execution/run-synthesis.js +20 -19
  37. package/dist/execution/step-summary.js +2 -1
  38. package/dist/index.d.ts +6 -2
  39. package/dist/index.js +19 -5
  40. package/dist/loop/__fixtures__/scripted-provider.d.ts +2 -2
  41. package/dist/loop/__fixtures__/scripted-provider.js +2 -1
  42. package/dist/loop/metrics.d.ts +33 -1
  43. package/dist/loop/metrics.js +56 -2
  44. package/dist/loop/run-agent.d.ts +13 -1
  45. package/dist/loop/run-agent.js +19 -4
  46. package/dist/memory/card-builders.d.ts +8 -1
  47. package/dist/memory/card-builders.js +20 -3
  48. package/dist/memory/reconstruct-cards.js +4 -3
  49. package/dist/memory/thread-history.d.ts +27 -2
  50. package/dist/memory/thread-history.js +45 -5
  51. package/dist/memory/working-memory.d.ts +93 -10
  52. package/dist/memory/working-memory.js +220 -84
  53. package/dist/prompts/SOUL.d.ts +22 -9
  54. package/dist/prompts/SOUL.js +56 -37
  55. package/dist/prompts/analogical-reasoner.d.ts +1 -1
  56. package/dist/prompts/analogical-reasoner.js +2 -2
  57. package/dist/prompts/briefing.d.ts +100 -0
  58. package/dist/prompts/briefing.js +166 -0
  59. package/dist/prompts/conversation.d.ts +1 -1
  60. package/dist/prompts/conversation.js +94 -440
  61. package/dist/prompts/literature-reviewer.d.ts +1 -1
  62. package/dist/prompts/literature-reviewer.js +10 -10
  63. package/dist/prompts/planner.js +28 -59
  64. package/dist/prompts/report-builder.d.ts +1 -1
  65. package/dist/prompts/report-builder.js +71 -24
  66. package/dist/prompts/sandbox/bulk-transcriptomics-agent.d.ts +1 -1
  67. package/dist/prompts/sandbox/bulk-transcriptomics-agent.js +2 -7
  68. package/dist/prompts/sandbox/cheminformatics-agent.d.ts +1 -1
  69. package/dist/prompts/sandbox/cheminformatics-agent.js +11 -15
  70. package/dist/prompts/sandbox/chromatin-agent.d.ts +1 -1
  71. package/dist/prompts/sandbox/chromatin-agent.js +3 -7
  72. package/dist/prompts/sandbox/data-profiler.d.ts +1 -1
  73. package/dist/prompts/sandbox/data-profiler.js +13 -8
  74. package/dist/prompts/sandbox/dna-methylation-agent.d.ts +1 -1
  75. package/dist/prompts/sandbox/dna-methylation-agent.js +2 -7
  76. package/dist/prompts/sandbox/drug-repurposing-agent.d.ts +1 -1
  77. package/dist/prompts/sandbox/drug-repurposing-agent.js +15 -16
  78. package/dist/prompts/sandbox/enrichment-agent.d.ts +1 -1
  79. package/dist/prompts/sandbox/enrichment-agent.js +2 -9
  80. package/dist/prompts/sandbox/genomic-variant-agent.d.ts +1 -1
  81. package/dist/prompts/sandbox/genomic-variant-agent.js +2 -6
  82. package/dist/prompts/sandbox/immune-profiling-agent.d.ts +1 -1
  83. package/dist/prompts/sandbox/immune-profiling-agent.js +3 -8
  84. package/dist/prompts/sandbox/metabolomics-agent.d.ts +1 -1
  85. package/dist/prompts/sandbox/metabolomics-agent.js +1 -7
  86. package/dist/prompts/sandbox/microbiome-agent.d.ts +1 -1
  87. package/dist/prompts/sandbox/microbiome-agent.js +2 -7
  88. package/dist/prompts/sandbox/multi-omics-integration-agent.d.ts +1 -1
  89. package/dist/prompts/sandbox/multi-omics-integration-agent.js +2 -8
  90. package/dist/prompts/sandbox/multimodal-sc-agent.d.ts +1 -1
  91. package/dist/prompts/sandbox/multimodal-sc-agent.js +2 -7
  92. package/dist/prompts/sandbox/network-agent.d.ts +1 -1
  93. package/dist/prompts/sandbox/network-agent.js +2 -7
  94. package/dist/prompts/sandbox/proteomics-agent.d.ts +1 -1
  95. package/dist/prompts/sandbox/proteomics-agent.js +2 -9
  96. package/dist/prompts/sandbox/single-cell-agent.d.ts +1 -1
  97. package/dist/prompts/sandbox/single-cell-agent.js +2 -9
  98. package/dist/prompts/sandbox/spatial-omics-agent.d.ts +1 -1
  99. package/dist/prompts/sandbox/spatial-omics-agent.js +3 -6
  100. package/dist/prompts/sandbox/statistical-modeling-agent.d.ts +1 -1
  101. package/dist/prompts/sandbox/statistical-modeling-agent.js +2 -7
  102. package/dist/prompts/sandbox/translational-safety-agent.d.ts +1 -1
  103. package/dist/prompts/sandbox/translational-safety-agent.js +13 -14
  104. package/dist/prompts/sandbox-standards.d.ts +22 -14
  105. package/dist/prompts/sandbox-standards.js +91 -71
  106. package/dist/prompts/synthesis-agent.d.ts +1 -1
  107. package/dist/prompts/synthesis-agent.js +33 -131
  108. package/dist/provenance/collector.js +1 -1
  109. package/dist/providers/ai-sdk.js +31 -4
  110. package/dist/providers/prompt-cache.d.ts +74 -0
  111. package/dist/providers/prompt-cache.js +77 -0
  112. package/dist/providers/types.d.ts +33 -0
  113. package/dist/reference-data/catalog.d.ts +131 -0
  114. package/dist/reference-data/catalog.js +348 -0
  115. package/dist/reference-data/receipt.d.ts +41 -0
  116. package/dist/reference-data/receipt.js +40 -0
  117. package/dist/schemas/data-profile-schemas.js +5 -3
  118. package/dist/schemas/plan-schemas.d.ts +21 -21
  119. package/dist/schemas/plan-schemas.js +9 -3
  120. package/dist/schemas/run-synthesis.d.ts +8 -4
  121. package/dist/schemas/run-synthesis.js +92 -56
  122. package/dist/schemas/validate-plan.js +1 -1
  123. package/dist/schemas/workflow-state.d.ts +7 -1
  124. package/dist/schemas/workflow-state.js +33 -19
  125. package/dist/state/artifacts.d.ts +13 -0
  126. package/dist/state/artifacts.js +27 -0
  127. package/dist/state/data-profile.d.ts +64 -5
  128. package/dist/state/index.d.ts +3 -3
  129. package/dist/state/index.js +1 -1
  130. package/dist/tasks/data-profile.d.ts +20 -2
  131. package/dist/tasks/data-profile.js +71 -22
  132. package/dist/tools/bio/chembl.d.ts +38 -0
  133. package/dist/tools/bio/chembl.js +138 -0
  134. package/dist/tools/bio/comptox.d.ts +50 -0
  135. package/dist/tools/bio/comptox.js +149 -0
  136. package/dist/tools/bio/get-impc-ko-profile.js +9 -6
  137. package/dist/tools/bio/index.d.ts +5 -17
  138. package/dist/tools/bio/index.js +5 -17
  139. package/dist/tools/bio/keys.d.ts +14 -9
  140. package/dist/tools/bio/keys.js +16 -16
  141. package/dist/tools/bio/opentargets.d.ts +38 -0
  142. package/dist/tools/bio/opentargets.js +89 -0
  143. package/dist/tools/bio/pubchem.d.ts +29 -0
  144. package/dist/tools/bio/pubchem.js +92 -0
  145. package/dist/tools/bio/pubmed.d.ts +51 -0
  146. package/dist/tools/bio/pubmed.js +100 -0
  147. package/dist/tools/bio/search-bgee-expression.js +12 -6
  148. package/dist/tools/bio/search-clinical-trials.js +16 -5
  149. package/dist/tools/bio/search-faers.js +8 -4
  150. package/dist/tools/bio/search-geo-datasets.js +20 -6
  151. package/dist/tools/bio/search-gwas-catalog.d.ts +1 -1
  152. package/dist/tools/bio/search-pharmgkb.js +10 -4
  153. package/dist/tools/display/index.d.ts +1 -0
  154. package/dist/tools/display/index.js +1 -0
  155. package/dist/tools/display/normalize-echart-spec.d.ts +61 -0
  156. package/dist/tools/display/normalize-echart-spec.js +211 -0
  157. package/dist/tools/display/show-user.d.ts +6 -1
  158. package/dist/tools/display/show-user.js +25 -12
  159. package/dist/tools/execute-plan.js +5 -2
  160. package/dist/tools/iterate-report.d.ts +168 -118
  161. package/dist/tools/iterate-report.js +334 -96
  162. package/dist/tools/lib/chembl-client.d.ts +12 -0
  163. package/dist/tools/lib/chembl-client.js +127 -0
  164. package/dist/tools/lib/ctx-ops.d.ts +224 -0
  165. package/dist/tools/lib/ctx-ops.js +450 -0
  166. package/dist/tools/lib/iuphar-client.js +10 -1
  167. package/dist/tools/lib/openfda-client.js +11 -3
  168. package/dist/tools/lib/pathway-client.js +10 -4
  169. package/dist/tools/lib/pubchem-ops.d.ts +74 -0
  170. package/dist/tools/lib/pubchem-ops.js +224 -0
  171. package/dist/tools/memory/update-working-memory.d.ts +45 -7
  172. package/dist/tools/memory/update-working-memory.js +111 -41
  173. package/dist/tools/report/index.d.ts +3 -2
  174. package/dist/tools/report/index.js +3 -2
  175. package/dist/tools/research/generate-analogy-report.js +25 -12
  176. package/dist/tools/research/generate-plan.d.ts +12 -5
  177. package/dist/tools/research/generate-plan.js +168 -37
  178. package/dist/tools/research/index.d.ts +1 -0
  179. package/dist/tools/research/index.js +1 -0
  180. package/dist/tools/research/inspect-data-profile.d.ts +85 -0
  181. package/dist/tools/research/inspect-data-profile.js +161 -0
  182. package/dist/tools/research/literature-reviewer.js +3 -4
  183. package/dist/tools/sandbox/list-available-packages.d.ts +79 -5
  184. package/dist/tools/sandbox/list-available-packages.js +152 -10
  185. package/dist/tools/sandbox/list-available-refs.d.ts +141 -5
  186. package/dist/tools/sandbox/list-available-refs.js +647 -134
  187. package/dist/tools/sandbox/report-blocker.d.ts +39 -9
  188. package/dist/tools/sandbox/report-blocker.js +43 -20
  189. package/dist/tools/workspace/read-file.js +4 -5
  190. package/dist/tools/workspace/run-exec.d.ts +4 -4
  191. package/dist/tools/workspace/run-exec.js +4 -4
  192. package/dist/tools/workspace/show-file.js +10 -6
  193. package/dist/tools/workspace/show-plan.js +12 -6
  194. package/dist/tools/workspace/workspace-search.d.ts +1 -1
  195. package/dist/tools/workspace/workspace-search.js +11 -5
  196. package/dist/workflows/execute-analysis.d.ts +43 -4
  197. package/dist/workflows/execute-analysis.js +107 -6
  198. package/dist/workflows/target-assessment/lib/citation-validator.js +2 -2
  199. package/dist/workflows/target-assessment/lib/clinical-consequence-annotator.js +2 -1
  200. package/dist/workspace/paths.d.ts +2 -2
  201. package/dist/workspace/paths.js +2 -2
  202. package/package.json +33 -33
  203. package/dist/execution/filesystem-artifact-registry.d.ts +0 -57
  204. package/dist/execution/filesystem-artifact-registry.js +0 -92
  205. package/dist/lib/identifiers.d.ts +0 -8
  206. package/dist/lib/identifiers.js +0 -10
  207. package/dist/lib/mime-detect.d.ts +0 -17
  208. package/dist/lib/mime-detect.js +0 -29
  209. package/dist/lib/streamed-download.d.ts +0 -28
  210. package/dist/lib/streamed-download.js +0 -111
  211. package/dist/lib/trace-context.d.ts +0 -11
  212. package/dist/lib/trace-context.js +0 -49
  213. package/dist/providers/llm-capabilities.d.ts +0 -33
  214. package/dist/providers/llm-capabilities.js +0 -58
  215. package/dist/schemas/render-step-prompt.d.ts +0 -32
  216. package/dist/schemas/render-step-prompt.js +0 -76
  217. package/dist/tools/bio/find-approval-precedent.d.ts +0 -32
  218. package/dist/tools/bio/find-approval-precedent.js +0 -72
  219. package/dist/tools/bio/get-article-details.d.ts +0 -11
  220. package/dist/tools/bio/get-article-details.js +0 -20
  221. package/dist/tools/bio/get-article-full-text.d.ts +0 -19
  222. package/dist/tools/bio/get-article-full-text.js +0 -32
  223. package/dist/tools/bio/get-bioactivity.d.ts +0 -11
  224. package/dist/tools/bio/get-bioactivity.js +0 -23
  225. package/dist/tools/bio/get-drug-info.d.ts +0 -9
  226. package/dist/tools/bio/get-drug-info.js +0 -22
  227. package/dist/tools/bio/get-mechanism.d.ts +0 -8
  228. package/dist/tools/bio/get-mechanism.js +0 -18
  229. package/dist/tools/bio/get-pubchem-assays.d.ts +0 -22
  230. package/dist/tools/bio/get-pubchem-assays.js +0 -107
  231. package/dist/tools/bio/get-pubchem-cross-refs.d.ts +0 -15
  232. package/dist/tools/bio/get-pubchem-cross-refs.js +0 -68
  233. package/dist/tools/bio/get-target-safety.d.ts +0 -18
  234. package/dist/tools/bio/get-target-safety.js +0 -26
  235. package/dist/tools/bio/search-compounds.d.ts +0 -22
  236. package/dist/tools/bio/search-compounds.js +0 -160
  237. package/dist/tools/bio/search-ctx-chemical.d.ts +0 -50
  238. package/dist/tools/bio/search-ctx-chemical.js +0 -130
  239. package/dist/tools/bio/search-ctx-exposure.d.ts +0 -55
  240. package/dist/tools/bio/search-ctx-exposure.js +0 -176
  241. package/dist/tools/bio/search-ctx-hazard.d.ts +0 -111
  242. package/dist/tools/bio/search-ctx-hazard.js +0 -178
  243. package/dist/tools/bio/search-opentargets.d.ts +0 -11
  244. package/dist/tools/bio/search-opentargets.js +0 -25
  245. package/dist/tools/bio/search-pubchem-compound.d.ts +0 -26
  246. package/dist/tools/bio/search-pubchem-compound.js +0 -110
  247. package/dist/tools/bio/search-pubmed.d.ts +0 -17
  248. package/dist/tools/bio/search-pubmed.js +0 -31
  249. package/dist/tools/bio/search-targets.d.ts +0 -9
  250. package/dist/tools/bio/search-targets.js +0 -20
  251. package/dist/tools/bio/search-toxcast.d.ts +0 -36
  252. package/dist/tools/bio/search-toxcast.js +0 -141
  253. package/dist/workflows/register-workflows.d.ts +0 -51
  254. package/dist/workflows/register-workflows.js +0 -48
  255. package/dist/workflows/resume-execute-analysis.d.ts +0 -70
  256. package/dist/workflows/resume-execute-analysis.js +0 -80
  257. package/dist/workflows/target-assessment/correction-loop.d.ts +0 -45
  258. package/dist/workflows/target-assessment/correction-loop.js +0 -62
  259. package/dist/workflows/target-assessment/steps/phase0-resolve.d.ts +0 -71
  260. package/dist/workflows/target-assessment/steps/phase0-resolve.js +0 -21
  261. package/dist/workflows/target-assessment/steps/phase1-aggregate.d.ts +0 -1018
  262. package/dist/workflows/target-assessment/steps/phase1-aggregate.js +0 -25
  263. package/dist/workspace/mount-strategy.d.ts +0 -50
  264. package/dist/workspace/mount-strategy.js +0 -67
  265. package/dist/workspace/provenance-collector.d.ts +0 -34
  266. package/dist/workspace/provenance-collector.js +0 -16
  267. package/dist/workspace/workspace-paths.d.ts +0 -26
  268. package/dist/workspace/workspace-paths.js +0 -31
@@ -17,13 +17,14 @@
17
17
  * `inspectRun` on a later turn). `run_ephemeral`
18
18
  * is wired here too — it mints a run authorization, starts the turn-scoped DBOS
19
19
  * `ephemeral` workflow, and awaits the result inline; chat disconnect cancels
20
- * the workflow and it is never recovered. `iterateReport` is wired here too — in-process Nunjucks
21
- * rendering driven by the in-process `report-builder` agent (no sandbox);
22
- * the 4 custom report tools (`build_report`, `submit_report`,
23
- * `preview_snapshot`, `mint_preview_url`) plus the version-fs write tools
24
- * (`write_file`, `edit_file`, `read_file`, `mkdir` from `createVersionFsTools`)
25
- * are constructed inside the runner so they share closure-captured outcome
26
- * state + preview-dir paths.
20
+ * the workflow and it is never recovered. Report authoring is wired here as the
21
+ * pair `plan_report` (returns the report-brief schema + authoring rules
22
+ * just-in-time as its result) + `submit_report` (validates the composed brief
23
+ * and drives in-process Nunjucks rendering via the `report-builder` agent, no
24
+ * sandbox). The 4 custom tools the builder itself drives (`build_report`, its
25
+ * own terminal `submit_report`, `preview_snapshot`, `mint_preview_url`) are
26
+ * constructed inside the runner so they share closure-captured outcome state +
27
+ * preview-dir paths.
27
28
  * The workspace read surface (`read_file`, `grep`, `workspace_search`) is
28
29
  * wired here over the `WorkspaceFilesystem` seam.
29
30
  */
@@ -38,7 +39,7 @@ import type { ResolveWorkspaceRoot } from "../workspace/paths.js";
38
39
  import { type BioToolKeys } from "../tools/bio/keys.js";
39
40
  import type { RunAuthorizer } from "../execution/run-authorizer.js";
40
41
  import type { RunLauncher } from "../execution/run-launcher.js";
41
- import { type IterateReportDeps } from "../tools/iterate-report.js";
42
+ import { type SubmitReportDeps } from "../tools/iterate-report.js";
42
43
  import type { EphemeralWorkflowInput, EphemeralResult } from "../execution/ephemeral-runner.js";
43
44
  /** Canonical agent id — the single source of truth. */
44
45
  export declare const CONVERSATION_AGENT_ID: "conversation-agent";
@@ -80,14 +81,14 @@ export interface ConversationAgentDeps {
80
81
  */
81
82
  readonly runLauncher: RunLauncher;
82
83
  /**
83
- * Preview-publishing seam factory for `iterate_report` — injected, not
84
+ * Preview-publishing seam factory for `submit_report` — injected, not
84
85
  * constructed here. The managed root closes its platform deps over this; the
85
86
  * OSS root returns the "unavailable" publisher.
86
87
  */
87
- readonly createPreviewPublisher: IterateReportDeps["createPreviewPublisher"];
88
+ readonly createPreviewPublisher: SubmitReportDeps["createPreviewPublisher"];
88
89
  /** API keys for the external bio/chem data sources. */
89
90
  readonly bioKeys: BioToolKeys;
90
- /** Root templates dir for in-process report rendering (`iterateReport`). */
91
+ /** Root templates dir for in-process report rendering (`submit_report`). */
91
92
  readonly templatesDir: string;
92
93
  /** Skills root; the in-process report-builder gets `report-html` skill tools. */
93
94
  readonly skillsDir: string;
@@ -17,13 +17,14 @@
17
17
  * `inspectRun` on a later turn). `run_ephemeral`
18
18
  * is wired here too — it mints a run authorization, starts the turn-scoped DBOS
19
19
  * `ephemeral` workflow, and awaits the result inline; chat disconnect cancels
20
- * the workflow and it is never recovered. `iterateReport` is wired here too — in-process Nunjucks
21
- * rendering driven by the in-process `report-builder` agent (no sandbox);
22
- * the 4 custom report tools (`build_report`, `submit_report`,
23
- * `preview_snapshot`, `mint_preview_url`) plus the version-fs write tools
24
- * (`write_file`, `edit_file`, `read_file`, `mkdir` from `createVersionFsTools`)
25
- * are constructed inside the runner so they share closure-captured outcome
26
- * state + preview-dir paths.
20
+ * the workflow and it is never recovered. Report authoring is wired here as the
21
+ * pair `plan_report` (returns the report-brief schema + authoring rules
22
+ * just-in-time as its result) + `submit_report` (validates the composed brief
23
+ * and drives in-process Nunjucks rendering via the `report-builder` agent, no
24
+ * sandbox). The 4 custom tools the builder itself drives (`build_report`, its
25
+ * own terminal `submit_report`, `preview_snapshot`, `mint_preview_url`) are
26
+ * constructed inside the runner so they share closure-captured outcome state +
27
+ * preview-dir paths.
27
28
  * The workspace read surface (`read_file`, `grep`, `workspace_search`) is
28
29
  * wired here over the `WorkspaceFilesystem` seam.
29
30
  */
@@ -31,16 +32,16 @@ import { createWorkingMemory } from "../memory/working-memory.js";
31
32
  import { conversationPrompt } from "../prompts/conversation.js";
32
33
  import { composeSystemPrompt } from "./system-prompt.js";
33
34
  // Bio-lookup leaf tools (pure — no dependencies).
34
- import { searchGeneTool, searchPathwayTool, lookupGoTermTool, searchInteractionsTool, searchCompoundsTool, getBioactivityTool, searchTargetsTool, getMechanismTool, getDrugInfoTool, searchPubchemCompoundTool, getPubchemCrossRefsTool, getPubchemAssaysTool, searchOpenTargetsTool, getTargetSafetyTool, searchPharmgkbTool, searchFaersTool, searchClinicalTrialsTool, searchGeoDatasetsTool, searchDgidbTool, searchBgeeExpressionTool, getImpcKoProfileTool, checkSafetyPanelTool, } from "../tools/bio/index.js";
35
+ import { searchGeneTool, searchPathwayTool, lookupGoTermTool, searchInteractionsTool, chemblTool, pubchemTool, openTargetsTool, searchPharmgkbTool, searchFaersTool, searchClinicalTrialsTool, searchGeoDatasetsTool, searchDgidbTool, searchBgeeExpressionTool, getImpcKoProfileTool, checkSafetyPanelTool, } from "../tools/bio/index.js";
35
36
  import { createNcbiTools, createChemDbTools } from "../tools/bio/keys.js";
36
37
  // Dependency-bearing tool factories.
37
- import { createGeneratePlanTool, createLiteratureReviewerTool, createInspectRunTool, createGenerateAnalogyReportTool } from "../tools/research/index.js";
38
+ import { createGeneratePlanTool, createLiteratureReviewerTool, createInspectRunTool, createInspectDataProfileTool, createGenerateAnalogyReportTool, } from "../tools/research/index.js";
38
39
  import { createFileStatTool, createGrepTool, createListFilesTool, createReadFileTool, createShowPlanTool, createWorkspaceSearchTool, showFileTool, } from "../tools/workspace/index.js";
39
40
  import { showUserTool } from "../tools/display/index.js";
40
41
  import { createUpdateWorkingMemoryTool } from "../tools/memory/index.js";
41
42
  import { createExecutePlanTool } from "../tools/execute-plan.js";
42
43
  import { createRunEphemeralTool } from "../tools/run-ephemeral.js";
43
- import { createIterateReportTool } from "../tools/iterate-report.js";
44
+ import { planReportTool, createReportSubmitTool } from "../tools/iterate-report.js";
44
45
  /** Canonical agent id — the single source of truth. */
45
46
  export const CONVERSATION_AGENT_ID = "conversation-agent";
46
47
  /** Runaway guard — heavy tool-driving turns need generous headroom. */
@@ -57,22 +58,14 @@ export function createConversationAgent(deps) {
57
58
  searchPathwayTool,
58
59
  lookupGoTermTool,
59
60
  searchInteractionsTool,
60
- ncbi.searchPubMed,
61
- ncbi.getArticleDetails,
62
- ncbi.getArticleFullText,
63
- // ChEMBL.
64
- searchCompoundsTool,
65
- getBioactivityTool,
66
- searchTargetsTool,
67
- getMechanismTool,
68
- getDrugInfoTool,
69
- // PubChem.
70
- searchPubchemCompoundTool,
71
- getPubchemCrossRefsTool,
72
- getPubchemAssaysTool,
61
+ // Literature (search / details / fulltext behind one action).
62
+ ncbi.pubmed,
63
+ // ChEMBL (compounds / drug / mechanism / bioactivity / targets behind one action).
64
+ chemblTool,
65
+ // PubChem (compound / crossrefs / assays behind one action).
66
+ pubchemTool,
73
67
  // Translational medicine.
74
- searchOpenTargetsTool,
75
- getTargetSafetyTool,
68
+ openTargetsTool,
76
69
  searchPharmgkbTool,
77
70
  searchFaersTool,
78
71
  searchClinicalTrialsTool,
@@ -83,13 +76,12 @@ export function createConversationAgent(deps) {
83
76
  getImpcKoProfileTool,
84
77
  // Off-target liability.
85
78
  checkSafetyPanelTool,
86
- // EPA CompTox.
87
- chemDb.searchToxcast,
88
- chemDb.searchCtxHazard,
89
- chemDb.searchCtxChemical,
90
- chemDb.searchCtxExposure,
79
+ // EPA CompTox (toxcast / hazard / chemical / exposure behind one dataset).
80
+ chemDb.comptox,
91
81
  // Execution.
92
82
  createInspectRunTool(pool),
83
+ // The dataset's own record. No file backs it — the DB row is the only copy.
84
+ createInspectDataProfileTool(pool),
93
85
  createGeneratePlanTool({ provider, pool, model, resourcePolicy }),
94
86
  createExecutePlanTool({
95
87
  pool,
@@ -103,7 +95,12 @@ export function createConversationAgent(deps) {
103
95
  runAuthorizer,
104
96
  runLauncher,
105
97
  }),
106
- createIterateReportTool({
98
+ // Report authoring: the always-on `plan_report` trigger delivers the
99
+ // heavy brief schema + rules just-in-time as its result; `submit_report`
100
+ // takes the composed brief as `unknown` and validates it in-execute, so
101
+ // the ~12k schema never rides the always-on tool surface.
102
+ planReportTool,
103
+ createReportSubmitTool({
107
104
  provider,
108
105
  pool,
109
106
  resolveWorkspaceRoot,
@@ -128,11 +125,11 @@ export function createConversationAgent(deps) {
128
125
  createFileStatTool(workspaceFs),
129
126
  createGrepTool(workspaceFs),
130
127
  // Working memory.
131
- createUpdateWorkingMemoryTool(workingMemory),
128
+ createUpdateWorkingMemoryTool(workingMemory, pool),
132
129
  ];
133
130
  return {
134
131
  id: CONVERSATION_AGENT_ID,
135
- systemPrompt: composeSystemPrompt(conversationPrompt),
132
+ systemPrompt: composeSystemPrompt(conversationPrompt, { identity: true, conversational: true }),
136
133
  model,
137
134
  tools,
138
135
  maxIterations: CONVERSATION_MAX_ITERATIONS,
@@ -17,13 +17,14 @@
17
17
  * `AgentDefinition`.
18
18
  */
19
19
  import { reportBuilderPrompt } from "../prompts/report-builder.js";
20
+ import { composeSystemPrompt } from "./system-prompt.js";
20
21
  export const REPORT_BUILDER_AGENT_ID = "report-builder";
21
22
  /** Runaway guard — Jinja recovery may take several build/edit cycles. */
22
23
  const REPORT_BUILDER_MAX_ITERATIONS = 75;
23
24
  export function createReportBuilderAgent(deps) {
24
25
  return {
25
26
  id: REPORT_BUILDER_AGENT_ID,
26
- systemPrompt: reportBuilderPrompt,
27
+ systemPrompt: composeSystemPrompt(reportBuilderPrompt),
27
28
  model: deps.model,
28
29
  tools: deps.tools,
29
30
  maxIterations: REPORT_BUILDER_MAX_ITERATIONS,
@@ -15,7 +15,7 @@ export const meta = {
15
15
  ],
16
16
  suitableFor: ["bulk-rna-seq", "microarray"],
17
17
  skills: ["bulk-transcriptomics", "shared/omics-general"],
18
- tools: [...BASE_SANDBOX_TOOLS, "searchPubMed", "getArticleDetails", "getArticleFullText", "searchGeoDatasets"],
18
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGeoDatasets"],
19
19
  };
20
20
  export function createBulkTranscriptomicsAgent(deps) {
21
21
  return createSandboxAgent(deps, meta, bulkTranscriptomicsAgentPrompt);
@@ -37,25 +37,7 @@ export const meta = {
37
37
  "perturbation-signatures",
38
38
  ],
39
39
  skills: ["cheminformatics", "shared/omics-general"],
40
- tools: [
41
- ...BASE_SANDBOX_TOOLS,
42
- "searchPubMed",
43
- "getArticleDetails",
44
- "getArticleFullText",
45
- "searchGene",
46
- "searchPathway",
47
- "lookupGoTerm",
48
- "searchInteractions",
49
- "searchCompounds",
50
- "getBioactivity",
51
- "searchTargets",
52
- "getMechanism",
53
- "getDrugInfo",
54
- "searchDgidb",
55
- "searchPubchemCompound",
56
- "getPubchemCrossRefs",
57
- "getPubchemAssays",
58
- ],
40
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions", "chembl", "searchDgidb", "pubchem"],
59
41
  };
60
42
  export function createCheminformaticsAgent(deps) {
61
43
  return createSandboxAgent(deps, meta, cheminformaticsAgentPrompt);
@@ -8,16 +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: [
12
- ...BASE_SANDBOX_TOOLS,
13
- "searchPubMed",
14
- "getArticleDetails",
15
- "getArticleFullText",
16
- "searchGene",
17
- "searchPathway",
18
- "lookupGoTerm",
19
- "searchInteractions",
20
- ],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
21
12
  };
22
13
  export function createChromatinAgent(deps) {
23
14
  return createSandboxAgent(deps, meta, chromatinAgentPrompt);
@@ -8,16 +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: [
12
- ...BASE_SANDBOX_TOOLS,
13
- "searchPubMed",
14
- "getArticleDetails",
15
- "getArticleFullText",
16
- "searchGene",
17
- "searchPathway",
18
- "lookupGoTerm",
19
- "searchInteractions",
20
- ],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
21
12
  };
22
13
  export function createDnaMethylationAgent(deps) {
23
14
  return createSandboxAgent(deps, meta, dnaMethylationAgentPrompt);
@@ -20,20 +20,13 @@ export const meta = {
20
20
  tools: [
21
21
  ...BASE_SANDBOX_TOOLS,
22
22
  "checkSafetyPanel",
23
- "searchPubMed",
24
- "getArticleDetails",
25
- "getArticleFullText",
23
+ "pubmed",
26
24
  "searchGene",
27
25
  "searchPathway",
28
26
  "lookupGoTerm",
29
27
  "searchInteractions",
30
- "searchCompounds",
31
- "getBioactivity",
32
- "searchTargets",
33
- "getMechanism",
34
- "getDrugInfo",
35
- "searchOpenTargets",
36
- "getTargetSafety",
28
+ "chembl",
29
+ "opentargets",
37
30
  "searchClinicalTrials",
38
31
  "searchFaers",
39
32
  "searchGwasCatalog",
@@ -43,10 +36,7 @@ export const meta = {
43
36
  "searchDgidb",
44
37
  "searchBgeeExpression",
45
38
  "getImpcKoProfile",
46
- "searchToxcast",
47
- "searchCtxHazard",
48
- "searchCtxChemical",
49
- "searchCtxExposure",
39
+ "comptox",
50
40
  ],
51
41
  };
52
42
  export function createDrugRepurposingAgent(deps) {
@@ -8,16 +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: [
12
- ...BASE_SANDBOX_TOOLS,
13
- "searchPubMed",
14
- "getArticleDetails",
15
- "getArticleFullText",
16
- "searchGene",
17
- "searchPathway",
18
- "lookupGoTerm",
19
- "searchInteractions",
20
- ],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
21
12
  };
22
13
  export function createEnrichmentAgent(deps) {
23
14
  return createSandboxAgent(deps, meta, enrichmentAgentPrompt);
@@ -9,16 +9,7 @@ export const meta = {
9
9
  capabilities: ["data inspection", "quick statistics", "data transformation", "table preview"],
10
10
  suitableFor: ["bulk-rna-seq", "single-cell", "proteomics", "metabolomics", "genomics", "transcriptomics", "general-omics"],
11
11
  skills: ["shared/omics-general"],
12
- tools: [
13
- ...BASE_SANDBOX_TOOLS,
14
- "searchPubMed",
15
- "getArticleDetails",
16
- "getArticleFullText",
17
- "searchGene",
18
- "searchPathway",
19
- "lookupGoTerm",
20
- "searchInteractions",
21
- ],
12
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
22
13
  plannable: false,
23
14
  };
24
15
  export function createEphemeralExecutorAgent(deps) {
@@ -10,9 +10,7 @@ export const meta = {
10
10
  skills: ["genomic-variants", "shared/omics-general"],
11
11
  tools: [
12
12
  ...BASE_SANDBOX_TOOLS,
13
- "searchPubMed",
14
- "getArticleDetails",
15
- "getArticleFullText",
13
+ "pubmed",
16
14
  "searchGene",
17
15
  "searchPathway",
18
16
  "lookupGoTerm",
@@ -24,19 +24,7 @@ export const meta = {
24
24
  "immune-cell-composition",
25
25
  ],
26
26
  skills: ["immune-profiling", "shared/omics-general"],
27
- tools: [
28
- ...BASE_SANDBOX_TOOLS,
29
- "searchPubMed",
30
- "getArticleDetails",
31
- "getArticleFullText",
32
- "searchGene",
33
- "searchPathway",
34
- "lookupGoTerm",
35
- "searchInteractions",
36
- "searchGeoDatasets",
37
- "searchOpenTargets",
38
- "getTargetSafety",
39
- ],
27
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions", "searchGeoDatasets", "opentargets"],
40
28
  };
41
29
  export function createImmuneProfilingAgent(deps) {
42
30
  return createSandboxAgent(deps, meta, immuneProfilingAgentPrompt);
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["peak detection", "feature alignment", "metabolite annotation", "normalization", "statistical analysis", "pathway mapping"],
9
9
  suitableFor: ["untargeted-metabolomics", "targeted-metabolomics", "lipidomics"],
10
10
  skills: ["metabolomics", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "searchPubMed", "getArticleDetails", "getArticleFullText"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed"],
12
12
  };
13
13
  export function createMetabolomicsAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, metabolomicsAgentPrompt);
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["diversity analysis", "differential abundance", "taxonomic profiling", "functional profiling", "compositional analysis"],
9
9
  suitableFor: ["16s-amplicon", "its-amplicon", "shotgun-metagenomics", "functional-profiling"],
10
10
  skills: ["microbiome", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "searchPubMed", "getArticleDetails", "getArticleFullText"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed"],
12
12
  };
13
13
  export function createMicrobiomeAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, microbiomeAgentPrompt);
@@ -15,18 +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: [
19
- ...BASE_SANDBOX_TOOLS,
20
- "searchPubMed",
21
- "getArticleDetails",
22
- "getArticleFullText",
23
- "searchGene",
24
- "searchPathway",
25
- "lookupGoTerm",
26
- "searchInteractions",
27
- "searchBgeeExpression",
28
- "getImpcKoProfile",
29
- ],
18
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions", "searchBgeeExpression", "getImpcKoProfile"],
30
19
  };
31
20
  export function createMultiOmicsIntegrationAgent(deps) {
32
21
  return createSandboxAgent(deps, meta, multiOmicsIntegrationAgentPrompt);
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["multimodal integration", "joint embedding", "cross-modality analysis", "protein quantification", "chromatin accessibility"],
9
9
  suitableFor: ["cite-seq", "multiome", "tea-seq", "dogma-seq"],
10
10
  skills: ["multimodal-single-cell", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "searchPubMed", "getArticleDetails", "getArticleFullText"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed"],
12
12
  };
13
13
  export function createMultimodalScAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, multimodalScAgentPrompt);
@@ -8,16 +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: [
12
- ...BASE_SANDBOX_TOOLS,
13
- "searchPubMed",
14
- "getArticleDetails",
15
- "getArticleFullText",
16
- "searchGene",
17
- "searchPathway",
18
- "lookupGoTerm",
19
- "searchInteractions",
20
- ],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
21
12
  defaultMaxSteps: 35,
22
13
  };
23
14
  export function createNetworkAgent(deps) {
@@ -34,9 +34,7 @@ export const meta = {
34
34
  skills: ["pkpd-clinical-response", "statistical-modeling", "shared/omics-general"],
35
35
  tools: [
36
36
  ...BASE_SANDBOX_TOOLS,
37
- "searchPubMed",
38
- "getArticleDetails",
39
- "getArticleFullText",
37
+ "pubmed",
40
38
  "searchGene",
41
39
  "searchPathway",
42
40
  "lookupGoTerm",
@@ -44,11 +42,7 @@ export const meta = {
44
42
  "searchClinicalTrials",
45
43
  "searchFaers",
46
44
  "searchPharmgkb",
47
- "searchCompounds",
48
- "getBioactivity",
49
- "searchTargets",
50
- "getMechanism",
51
- "getDrugInfo",
45
+ "chembl",
52
46
  "searchDgidb",
53
47
  "searchBgeeExpression",
54
48
  "getImpcKoProfile",
@@ -8,7 +8,7 @@ export const meta = {
8
8
  capabilities: ["protein quantification", "differential abundance", "imputation", "normalization", "PTM analysis", "phosphoproteomics"],
9
9
  suitableFor: ["dda-proteomics", "dia-proteomics", "tmt-proteomics", "olink", "somascan"],
10
10
  skills: ["proteomics", "shared/omics-general"],
11
- tools: [...BASE_SANDBOX_TOOLS, "searchPubMed", "getArticleDetails", "getArticleFullText"],
11
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed"],
12
12
  };
13
13
  export function createProteomicsAgent(deps) {
14
14
  return createSandboxAgent(deps, meta, proteomicsAgentPrompt);
@@ -39,16 +39,7 @@ export const meta = {
39
39
  "drug-repurposing",
40
40
  "shared/omics-general",
41
41
  ],
42
- tools: [
43
- ...BASE_SANDBOX_TOOLS,
44
- "searchPubMed",
45
- "getArticleDetails",
46
- "getArticleFullText",
47
- "searchGene",
48
- "searchPathway",
49
- "lookupGoTerm",
50
- "searchInteractions",
51
- ],
42
+ tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "searchPathway", "lookupGoTerm", "searchInteractions"],
52
43
  plannable: false,
53
44
  };
54
45
  export function createScientificExecutorAgent(deps) {
@@ -8,8 +8,8 @@
8
8
  * the workspace mutate trio (`execute_command`, `write_file`, `edit_file`)
9
9
  * bound to the shared `SandboxClient` and the step's `allowedWritePrefix`,
10
10
  * the workspace read tools (`read_file`, `grep`) over the shared
11
- * `WorkspaceFilesystem`, and the bio/literature/context7/run-inspection
12
- * tools its `meta.tools` allowlist names.
11
+ * `WorkspaceFilesystem`, `inspect_data_profile` over the shared `Pool`, and the
12
+ * bio/literature/context7/run-inspection tools its `meta.tools` allowlist names.
13
13
  *
14
14
  * Tool resolution is a single registry lookup — every name in `meta.tools`
15
15
  * must map to a concrete `Tool`; unknown names throw at composition time
@@ -92,9 +92,20 @@ export interface SandboxAgentPromptOptions {
92
92
  }
93
93
  /**
94
94
  * Build one sandbox `AgentDefinition`. The system prompt is composed once
95
- * (SOUL kernel + agent body + sandbox standards) — no processors, no
96
- * conversational layer (sandbox agents are not user-facing). Tools are
97
- * resolved against the closed allowlist; the workspace surface is always
98
- * wired regardless of meta.
95
+ * (SOUL execution core + agent body + sandbox standards) — no processors, and
96
+ * neither human-facing SOUL layer: a sandbox agent is headless, so the identity
97
+ * and conversational layers are dead weight in its context while every hard
98
+ * guardrail it does need rides in the execution core. Tools are resolved
99
+ * against the closed allowlist; the workspace surface is always wired
100
+ * regardless of meta.
101
+ *
102
+ * The composed `systemPrompt` is a **pure function of the agent type** — nothing
103
+ * from `deps.step` reaches it, so two steps of one run, and two runs of one
104
+ * analysis, send a byte-identical ~20k-char prefix that the provider's prompt
105
+ * cache can actually reuse. Keep it that way: a single interpolated id or path
106
+ * makes every step's prefix unique again, and each step pays a full cache write
107
+ * and reads nothing back. Per-step values belong in the step's briefing (its
108
+ * first user message — see `prompts/briefing.ts`), which names the working
109
+ * directory, the analysis root, the dataset, and what each dependency produced.
99
110
  */
100
111
  export declare function createSandboxAgent(deps: SandboxAgentDeps, meta: AgentMeta, body: string, opts?: SandboxAgentPromptOptions): AgentDefinition;