@inflexa-ai/harness 0.46.2 → 0.48.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 (279) hide show
  1. package/README.md +2 -2
  2. package/dist/agents/conversation-agent.d.ts +7 -6
  3. package/dist/agents/conversation-agent.js +26 -4
  4. package/dist/agents/report-session-agent.d.ts +14 -14
  5. package/dist/agents/report-session-agent.js +40 -26
  6. package/dist/agents/sandbox/shared.d.ts +18 -13
  7. package/dist/agents/sandbox/shared.js +42 -27
  8. package/dist/agents/sandbox/types.d.ts +1 -1
  9. package/dist/agents/sandbox-catalog.d.ts +2 -0
  10. package/dist/agents/sandbox-catalog.js +30 -1
  11. package/dist/app/synthesize-run.d.ts +10 -6
  12. package/dist/app/synthesize-run.js +4 -2
  13. package/dist/contracts/analogy-report.d.ts +46 -2
  14. package/dist/contracts/analogy-report.js +31 -25
  15. package/dist/contracts/chat-parts.d.ts +3 -14
  16. package/dist/contracts/report-reference.d.ts +2 -1
  17. package/dist/contracts/report-reference.js +2 -1
  18. package/dist/contracts/schemas/chat-parts.d.ts +0 -27
  19. package/dist/contracts/schemas/chat-parts.js +1 -3
  20. package/dist/execution/run-canceler.d.ts +2 -0
  21. package/dist/execution/run-canceler.js +9 -0
  22. package/dist/execution/run-synthesis.d.ts +36 -8
  23. package/dist/execution/run-synthesis.js +114 -32
  24. package/dist/index.d.ts +5 -6
  25. package/dist/index.js +5 -7
  26. package/dist/input-scan/enrich.d.ts +5 -10
  27. package/dist/input-scan/enrich.js +12 -8
  28. package/dist/lib/hooks.d.ts +1 -1
  29. package/dist/lib/markdown-pdf.d.ts +27 -0
  30. package/dist/lib/markdown-pdf.js +236 -0
  31. package/dist/lib/metrics.d.ts +31 -0
  32. package/dist/lib/metrics.js +64 -0
  33. package/dist/lib/pdf-text.d.ts +23 -0
  34. package/dist/lib/pdf-text.js +34 -0
  35. package/dist/lib/regulatory-corpus/fetch-fda-guidance.js +3 -5
  36. package/dist/lib/regulatory-corpus/fetch-ich.js +3 -5
  37. package/dist/loop/chat-stream.js +2 -1
  38. package/dist/loop/run-loop.d.ts +5 -0
  39. package/dist/loop/run-loop.js +30 -2
  40. package/dist/loop/tool-name-repair.d.ts +11 -0
  41. package/dist/loop/tool-name-repair.js +23 -0
  42. package/dist/loop/types.d.ts +19 -0
  43. package/dist/memory/card-builders.d.ts +1 -1
  44. package/dist/prompts/SOUL.d.ts +6 -6
  45. package/dist/prompts/SOUL.js +22 -121
  46. package/dist/prompts/analogical-reasoner.d.ts +1 -1
  47. package/dist/prompts/analogical-reasoner.js +35 -101
  48. package/dist/prompts/briefing.d.ts +20 -11
  49. package/dist/prompts/briefing.js +36 -19
  50. package/dist/prompts/conversation.d.ts +1 -1
  51. package/dist/prompts/conversation.js +103 -383
  52. package/dist/prompts/planner.d.ts +1 -5
  53. package/dist/prompts/planner.js +45 -128
  54. package/dist/prompts/report-session.d.ts +1 -1
  55. package/dist/prompts/report-session.js +29 -58
  56. package/dist/prompts/sandbox/bulk-transcriptomics-agent.d.ts +1 -1
  57. package/dist/prompts/sandbox/bulk-transcriptomics-agent.js +3 -3
  58. package/dist/prompts/sandbox/cheminformatics-agent.d.ts +1 -1
  59. package/dist/prompts/sandbox/cheminformatics-agent.js +12 -47
  60. package/dist/prompts/sandbox/chromatin-agent.d.ts +1 -1
  61. package/dist/prompts/sandbox/chromatin-agent.js +4 -5
  62. package/dist/prompts/sandbox/data-profiler.js +11 -34
  63. package/dist/prompts/sandbox/dna-methylation-agent.d.ts +1 -1
  64. package/dist/prompts/sandbox/dna-methylation-agent.js +3 -1
  65. package/dist/prompts/sandbox/drug-repurposing-agent.d.ts +1 -1
  66. package/dist/prompts/sandbox/drug-repurposing-agent.js +23 -73
  67. package/dist/prompts/sandbox/enrichment-agent.d.ts +1 -1
  68. package/dist/prompts/sandbox/enrichment-agent.js +3 -1
  69. package/dist/prompts/sandbox/genomic-variant-agent.d.ts +1 -1
  70. package/dist/prompts/sandbox/genomic-variant-agent.js +3 -4
  71. package/dist/prompts/sandbox/immune-profiling-agent.d.ts +1 -1
  72. package/dist/prompts/sandbox/immune-profiling-agent.js +5 -4
  73. package/dist/prompts/sandbox/metabolomics-agent.d.ts +1 -1
  74. package/dist/prompts/sandbox/metabolomics-agent.js +3 -1
  75. package/dist/prompts/sandbox/microbiome-agent.d.ts +1 -1
  76. package/dist/prompts/sandbox/microbiome-agent.js +3 -1
  77. package/dist/prompts/sandbox/multi-omics-integration-agent.d.ts +1 -1
  78. package/dist/prompts/sandbox/multi-omics-integration-agent.js +3 -1
  79. package/dist/prompts/sandbox/multimodal-sc-agent.d.ts +1 -1
  80. package/dist/prompts/sandbox/multimodal-sc-agent.js +3 -1
  81. package/dist/prompts/sandbox/network-agent.d.ts +1 -1
  82. package/dist/prompts/sandbox/network-agent.js +3 -1
  83. package/dist/prompts/sandbox/pkpd-clinical-response-agent.d.ts +1 -1
  84. package/dist/prompts/sandbox/pkpd-clinical-response-agent.js +4 -7
  85. package/dist/prompts/sandbox/proteomics-agent.d.ts +1 -1
  86. package/dist/prompts/sandbox/proteomics-agent.js +3 -1
  87. package/dist/prompts/sandbox/scientific-executor.d.ts +1 -1
  88. package/dist/prompts/sandbox/scientific-executor.js +0 -12
  89. package/dist/prompts/sandbox/single-cell-agent.d.ts +1 -1
  90. package/dist/prompts/sandbox/single-cell-agent.js +3 -1
  91. package/dist/prompts/sandbox/spatial-omics-agent.d.ts +1 -1
  92. package/dist/prompts/sandbox/spatial-omics-agent.js +3 -1
  93. package/dist/prompts/sandbox/statistical-modeling-agent.d.ts +1 -1
  94. package/dist/prompts/sandbox/statistical-modeling-agent.js +4 -4
  95. package/dist/prompts/sandbox/translational-safety-agent.d.ts +1 -1
  96. package/dist/prompts/sandbox/translational-safety-agent.js +10 -29
  97. package/dist/prompts/sandbox-standards.d.ts +15 -18
  98. package/dist/prompts/sandbox-standards.js +96 -305
  99. package/dist/prompts/synthesis-agent.d.ts +1 -1
  100. package/dist/prompts/synthesis-agent.js +24 -90
  101. package/dist/provenance/collector.d.ts +2 -5
  102. package/dist/provenance/collector.js +2 -5
  103. package/dist/provenance/seam.d.ts +36 -1
  104. package/dist/provenance/workspace-reads.d.ts +36 -0
  105. package/dist/provenance/workspace-reads.js +33 -0
  106. package/dist/report-model/production-resolver.d.ts +22 -52
  107. package/dist/report-model/production-resolver.js +43 -112
  108. package/dist/report-render/chart-export.d.ts +9 -0
  109. package/dist/report-render/chart-export.js +1 -1
  110. package/dist/report-render/views/chart-view.d.ts +1 -0
  111. package/dist/report-render/views/chart-view.js +1 -0
  112. package/dist/report-render/views/lineage.d.ts +1 -0
  113. package/dist/report-render/views/page-view.d.ts +1 -0
  114. package/dist/report-render/views/page-view.js +1 -0
  115. package/dist/report-render/views/prose.d.ts +1 -0
  116. package/dist/report-render/views/prose.js +1 -0
  117. package/dist/report-render/views/references-view.d.ts +1 -0
  118. package/dist/report-render/views/values.d.ts +1 -0
  119. package/dist/report-render/views/values.js +1 -0
  120. package/dist/runtime/assemble.d.ts +32 -12
  121. package/dist/runtime/assemble.js +49 -38
  122. package/dist/sandbox/client.d.ts +5 -3
  123. package/dist/sandbox/create-sandbox.d.ts +7 -12
  124. package/dist/sandbox/create-sandbox.js +15 -37
  125. package/dist/sandbox/docker-client.d.ts +1 -3
  126. package/dist/sandbox/docker-client.js +3 -5
  127. package/dist/sandbox/exec-outcome.d.ts +11 -11
  128. package/dist/sandbox/exec-outcome.js +22 -22
  129. package/dist/sandbox/exec.d.ts +5 -0
  130. package/dist/sandbox/exec.js +9 -1
  131. package/dist/sandbox/identity.d.ts +4 -16
  132. package/dist/sandbox/identity.js +5 -21
  133. package/dist/sandbox/k8s-client.d.ts +0 -1
  134. package/dist/sandbox/k8s-client.js +8 -13
  135. package/dist/sandbox/lease-names.d.ts +6 -0
  136. package/dist/sandbox/lease-names.js +12 -0
  137. package/dist/sandbox/leases.d.ts +105 -0
  138. package/dist/sandbox/leases.js +519 -0
  139. package/dist/sandbox/liveness.d.ts +5 -2
  140. package/dist/sandbox/mount-plan.d.ts +10 -1
  141. package/dist/sandbox/mount-plan.js +7 -1
  142. package/dist/sandbox/reconciler.d.ts +58 -0
  143. package/dist/sandbox/reconciler.js +153 -0
  144. package/dist/sandbox/sandbox-step-translate.d.ts +1 -1
  145. package/dist/sandbox/types.d.ts +25 -18
  146. package/dist/sandbox/types.js +10 -4
  147. package/dist/schemas/plan-schemas.d.ts +0 -21
  148. package/dist/schemas/plan-schemas.js +2 -3
  149. package/dist/schemas/run-synthesis.d.ts +2 -2
  150. package/dist/schemas/run-synthesis.js +3 -3
  151. package/dist/schemas/validate-plan.d.ts +1 -14
  152. package/dist/schemas/validate-plan.js +5 -24
  153. package/dist/schemas/workflow-state.d.ts +3 -32
  154. package/dist/schemas/workflow-state.js +4 -13
  155. package/dist/state/index.d.ts +2 -3
  156. package/dist/state/index.js +1 -2
  157. package/dist/state/migrations/20261030120000_lease_the_sandboxes.d.ts +7 -0
  158. package/dist/state/migrations/20261030120000_lease_the_sandboxes.js +34 -0
  159. package/dist/state/migrations/20261030120100_drop_the_report_derivations.d.ts +5 -0
  160. package/dist/state/migrations/20261030120100_drop_the_report_derivations.js +9 -0
  161. package/dist/state/migrations/20261030120200_keep_the_report_derivations.d.ts +6 -0
  162. package/dist/state/migrations/20261030120200_keep_the_report_derivations.js +10 -0
  163. package/dist/state/migrations/index.js +6 -0
  164. package/dist/state/purge-analysis.d.ts +4 -2
  165. package/dist/state/purge-analysis.js +22 -11
  166. package/dist/state/sandbox-leases.d.ts +81 -0
  167. package/dist/state/sandbox-leases.js +247 -0
  168. package/dist/state/schema.d.ts +1 -13
  169. package/dist/state/schema.js +1 -6
  170. package/dist/state/step-executions.d.ts +13 -2
  171. package/dist/state/step-executions.js +23 -4
  172. package/dist/tasks/data-profile.d.ts +40 -2
  173. package/dist/tasks/data-profile.js +89 -87
  174. package/dist/tools/ad-hoc-router.d.ts +1 -6
  175. package/dist/tools/ad-hoc-router.js +5 -48
  176. package/dist/tools/bio/comptox.js +1 -1
  177. package/dist/tools/bio/drug-gene-interactions.js +1 -1
  178. package/dist/tools/bio/gene-disease-evidence.js +1 -1
  179. package/dist/tools/bio/keys.d.ts +1 -1
  180. package/dist/tools/bio/pubmed.js +31 -0
  181. package/dist/tools/bio/search-gene.js +17 -0
  182. package/dist/tools/bio/search-geo-datasets.js +13 -0
  183. package/dist/tools/bio/search-regulatory-approvals.js +1 -1
  184. package/dist/tools/define-tool.d.ts +25 -2
  185. package/dist/tools/define-tool.js +11 -1
  186. package/dist/tools/display/show-user.js +1 -1
  187. package/dist/tools/execute-analysis.d.ts +1 -3
  188. package/dist/tools/execute-analysis.js +5 -33
  189. package/dist/tools/report-authoring/authoring-tools.d.ts +2 -2
  190. package/dist/tools/report-authoring/authoring-tools.js +31 -6
  191. package/dist/tools/report-session/index.d.ts +0 -1
  192. package/dist/tools/report-session/index.js +0 -1
  193. package/dist/tools/report-session/script-tools.d.ts +33 -0
  194. package/dist/tools/report-session/script-tools.js +186 -0
  195. package/dist/tools/research/generate-analogy-report.d.ts +16 -9
  196. package/dist/tools/research/generate-analogy-report.js +111 -49
  197. package/dist/tools/research/generate-plan.d.ts +102 -7
  198. package/dist/tools/research/generate-plan.js +74 -43
  199. package/dist/tools/research/index.d.ts +4 -3
  200. package/dist/tools/research/index.js +4 -3
  201. package/dist/tools/research/inspect-run.d.ts +0 -1
  202. package/dist/tools/research/inspect-run.js +5 -10
  203. package/dist/tools/research/search-arxiv.js +15 -0
  204. package/dist/tools/research/search-github-repos.js +13 -0
  205. package/dist/tools/research/search-semantic-scholar.js +16 -0
  206. package/dist/tools/research/synthesis-lookups.d.ts +21 -0
  207. package/dist/tools/research/synthesis-lookups.js +29 -0
  208. package/dist/tools/research/web-fetch.d.ts +1 -1
  209. package/dist/tools/research/web-fetch.js +14 -12
  210. package/dist/tools/sandbox/lease-tools.d.ts +32 -0
  211. package/dist/tools/sandbox/lease-tools.js +60 -0
  212. package/dist/tools/script/archive.d.ts +34 -0
  213. package/dist/tools/script/archive.js +182 -0
  214. package/dist/tools/script/codemode-worker.d.ts +5 -0
  215. package/dist/tools/script/codemode-worker.js +5 -0
  216. package/dist/tools/script/file-tools.d.ts +106 -0
  217. package/dist/tools/script/file-tools.js +491 -0
  218. package/dist/tools/script/metrics.d.ts +30 -0
  219. package/dist/tools/script/metrics.js +53 -0
  220. package/dist/tools/script/quickjs.wasm +0 -0
  221. package/dist/tools/script/run-script.d.ts +76 -0
  222. package/dist/tools/script/run-script.js +413 -0
  223. package/dist/tools/script/scratch.d.ts +84 -0
  224. package/dist/tools/script/scratch.js +145 -0
  225. package/dist/tools/start-report-session.js +1 -1
  226. package/dist/tools/workspace/edit-file.js +2 -1
  227. package/dist/tools/workspace/execute-command.d.ts +9 -13
  228. package/dist/tools/workspace/execute-command.js +23 -19
  229. package/dist/tools/workspace/file-stat.js +1 -1
  230. package/dist/tools/workspace/grep.d.ts +5 -2
  231. package/dist/tools/workspace/grep.js +19 -10
  232. package/dist/tools/workspace/mutator.d.ts +51 -4
  233. package/dist/tools/workspace/mutator.js +54 -13
  234. package/dist/tools/workspace/read-file.d.ts +5 -2
  235. package/dist/tools/workspace/read-file.js +15 -11
  236. package/dist/tools/workspace/read-surface.d.ts +17 -0
  237. package/dist/tools/workspace/read-surface.js +17 -0
  238. package/dist/tools/workspace/result-bounds.d.ts +1 -0
  239. package/dist/tools/workspace/run-exec.d.ts +12 -13
  240. package/dist/tools/workspace/run-exec.js +13 -13
  241. package/dist/tools/workspace/scan-inputs.d.ts +2 -5
  242. package/dist/tools/workspace/scan-inputs.js +2 -3
  243. package/dist/tools/workspace/show-file.js +1 -1
  244. package/dist/tools/workspace/show-plan.js +4 -3
  245. package/dist/tools/workspace/write-file.js +2 -1
  246. package/dist/workflows/execute-analysis-scheduler.d.ts +0 -26
  247. package/dist/workflows/execute-analysis-scheduler.js +12 -32
  248. package/dist/workflows/execute-analysis.d.ts +17 -35
  249. package/dist/workflows/execute-analysis.js +13 -107
  250. package/dist/workflows/pause.js +29 -22
  251. package/dist/workflows/sandbox-step.d.ts +16 -31
  252. package/dist/workflows/sandbox-step.js +36 -71
  253. package/dist/workflows/test/sql-writes.d.ts +0 -1
  254. package/dist/workflows/test/sql-writes.js +0 -2
  255. package/dist/workspace/filesystem.d.ts +2 -2
  256. package/dist/workspace/filesystem.js +10 -5
  257. package/dist/workspace/paths.d.ts +19 -1
  258. package/dist/workspace/paths.js +22 -1
  259. package/dist/workspace/session-files.d.ts +35 -0
  260. package/dist/workspace/session-files.js +16 -0
  261. package/package.json +7 -3
  262. package/dist/prompts/literature-reviewer.d.ts +0 -1
  263. package/dist/prompts/literature-reviewer.js +0 -114
  264. package/dist/sandbox/reaper.d.ts +0 -81
  265. package/dist/sandbox/reaper.js +0 -161
  266. package/dist/sandbox/step-sandbox.d.ts +0 -47
  267. package/dist/sandbox/step-sandbox.js +0 -53
  268. package/dist/state/active-sandboxes.d.ts +0 -33
  269. package/dist/state/active-sandboxes.js +0 -65
  270. package/dist/tasks/extract-values-script.d.ts +0 -64
  271. package/dist/tasks/extract-values-script.js +0 -180
  272. package/dist/tasks/extract-values.d.ts +0 -77
  273. package/dist/tasks/extract-values.js +0 -146
  274. package/dist/tools/report-session/derive-table.d.ts +0 -164
  275. package/dist/tools/report-session/derive-table.js +0 -419
  276. package/dist/tools/research/literature-reviewer.d.ts +0 -42
  277. package/dist/tools/research/literature-reviewer.js +0 -107
  278. package/dist/workflows/metrics.d.ts +0 -23
  279. package/dist/workflows/metrics.js +0 -38
@@ -12,7 +12,7 @@
12
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" | "scanInputs" | "resolveLibraryId" | "queryDocs" | "inspectRun" | "pubmed" | "resolve_citation" | "searchGene" | "lookupAnnotation" | "searchInteractions" | "chembl" | "pubchem" | "opentargets" | "geneDiseaseEvidence" | "drugGeneInteractions" | "genePreclinicalProfile" | "searchFaers" | "searchClinicalTrials" | "searchGeoDatasets" | "searchRegulatoryApprovals" | "targetSafety" | "comptox" | "knowledgeTemplate";
15
+ export type SandboxToolName = "listAvailablePackages" | "listAvailableRefs" | "scanInputs" | "resolveLibraryId" | "queryDocs" | "pubmed" | "resolve_citation" | "searchGene" | "lookupAnnotation" | "searchInteractions" | "chembl" | "pubchem" | "opentargets" | "geneDiseaseEvidence" | "drugGeneInteractions" | "genePreclinicalProfile" | "searchFaers" | "searchClinicalTrials" | "searchGeoDatasets" | "searchRegulatoryApprovals" | "targetSafety" | "comptox" | "knowledgeTemplate";
16
16
  /**
17
17
  * The reference datasets that one capability of one agent cannot run without.
18
18
  *
@@ -12,6 +12,8 @@ export type PlannerAgentMeta = {
12
12
  readonly id: string;
13
13
  readonly capabilities: readonly string[];
14
14
  readonly suitableFor: readonly string[];
15
+ /** The public databases that the agent queries at run time, thus a step of the agent needs no staged copy of them. */
16
+ readonly liveSources: readonly string[];
15
17
  };
16
18
  /** The sandbox agents the planner may assign to analysis-plan steps. */
17
19
  export declare const PLANNABLE_AGENT_CATALOG: readonly PlannerAgentMeta[];
@@ -8,6 +8,28 @@
8
8
  * `{{AGENT_CATALOG}}` placeholder.
9
9
  */
10
10
  import { SANDBOX_AGENT_META } from "./sandbox/index.js";
11
+ /**
12
+ * The public database behind each lookup tool of a sandbox agent. A tool that reads the environment or the run, and
13
+ * not a public database, has no entry.
14
+ */
15
+ const LIVE_SOURCES = {
16
+ pubmed: "PubMed",
17
+ searchGene: "Ensembl and NCBI Gene",
18
+ lookupAnnotation: "GO, KEGG, and Reactome annotation",
19
+ searchInteractions: "STRING",
20
+ chembl: "ChEMBL",
21
+ pubchem: "PubChem",
22
+ opentargets: "Open Targets",
23
+ geneDiseaseEvidence: "GWAS Catalog, DisGeNET, and ClinVar",
24
+ drugGeneInteractions: "DGIdb, DrugBank, and PharmGKB",
25
+ genePreclinicalProfile: "Bgee expression and IMPC knockouts",
26
+ searchFaers: "FAERS",
27
+ searchClinicalTrials: "ClinicalTrials.gov",
28
+ searchGeoDatasets: "GEO",
29
+ searchRegulatoryApprovals: "FDA and EMA approvals",
30
+ targetSafety: "a curated target safety panel",
31
+ comptox: "EPA CompTox",
32
+ };
11
33
  /** The sandbox agents the planner may assign to analysis-plan steps. */
12
34
  export const PLANNABLE_AGENT_CATALOG = Object.values(SANDBOX_AGENT_META)
13
35
  .filter((meta) => meta.plannable !== false)
@@ -15,6 +37,10 @@ export const PLANNABLE_AGENT_CATALOG = Object.values(SANDBOX_AGENT_META)
15
37
  id: meta.id,
16
38
  capabilities: [...meta.capabilities],
17
39
  suitableFor: [...meta.suitableFor],
40
+ liveSources: meta.tools.flatMap((tool) => {
41
+ const source = LIVE_SOURCES[tool];
42
+ return source === undefined ? [] : [source];
43
+ }),
18
44
  }));
19
45
  /**
20
46
  * The reference datasets one capability of one agent cannot run without, by catalog id.
@@ -58,6 +84,9 @@ export const KNOWN_AGENT_IDS = Object.keys(SANDBOX_AGENT_META);
58
84
  */
59
85
  export function formatAgentCatalog(catalog = PLANNABLE_AGENT_CATALOG) {
60
86
  return catalog
61
- .map((meta) => `- **${meta.id}**: capabilities: [${meta.capabilities.join(", ")}], ` + `suitable for: [${meta.suitableFor.join(", ")}]`)
87
+ .map((meta) => {
88
+ const live = meta.liveSources.length === 0 ? "" : `, live lookups: [${meta.liveSources.join(", ")}]`;
89
+ return `- **${meta.id}**: capabilities: [${meta.capabilities.join(", ")}], suitable for: [${meta.suitableFor.join(", ")}]${live}`;
90
+ })
62
91
  .join("\n");
63
92
  }
@@ -14,6 +14,8 @@
14
14
  * honest non-fatal outcomes (no summaries, blocker) return empty findings after
15
15
  * a `skipped` phase.
16
16
  */
17
+ import type { WorkspaceFilesystem } from "../workspace/filesystem.js";
18
+ import type { ScriptRuntime } from "../tools/script/run-script.js";
17
19
  import type { Querier } from "../state/db.js";
18
20
  import type { SynthesisPhase } from "@inflexa-ai/harness/contracts/chat-parts.js";
19
21
  import type { RunSession } from "../auth/types.js";
@@ -36,18 +38,21 @@ export type SynthesizeRunDeps = {
36
38
  readonly embedding: EmbeddingProvider;
37
39
  /** Embedder-supplied workspace-root resolution seam (see workspace/paths.ts). */
38
40
  readonly resolveWorkspaceRoot: ResolveWorkspaceRoot;
41
+ /** The read path of the workspace. The synthesizer reads the files of the run through it. */
42
+ readonly workspaceFs: WorkspaceFilesystem;
39
43
  /** Model id for the synthesizer agent loop. */
40
44
  readonly synthesisModel: string;
41
- /** The `literature_reviewer` tool of the synthesizer. */
42
- readonly literatureReviewer: Tool;
45
+ /** The lookup tools of the synthesizer (`createSynthesisLookupTools`). */
46
+ readonly synthesisLookups: readonly Tool[];
47
+ /** Where the VM of `run_script` comes from, for the lookups of the synthesizer. */
48
+ readonly scriptRuntime?: ScriptRuntime;
43
49
  /** LLM usage-accounting seam for the synthesizer loop; omitted falls back to the no-op recorder. */
44
50
  readonly usageRecorder?: UsageRecorder;
45
- /** The store of the synthesizer and reviewer loops and of their read tools. */
51
+ /** The store of the synthesizer loop and of its read tool. */
46
52
  readonly toolOutputStore?: ToolOutputStore;
47
53
  };
48
54
  /** Optional fields for a progress update, mirroring the wire part. */
49
55
  export type SynthesisProgressExtra = {
50
- readonly delegationCount?: number;
51
56
  readonly reason?: string;
52
57
  readonly error?: string;
53
58
  };
@@ -62,8 +67,7 @@ export type SynthesizeRunParams = {
62
67
  readonly onProgress: (phase: SynthesisPhase, activity: string, extra?: SynthesisProgressExtra) => void | Promise<void>;
63
68
  /**
64
69
  * Run a read or a write of the synthesis once: a step in the body of a workflow, a plain call in a process. The
65
- * loop of the synthesizer runs outside it, thus each of its model calls is a step of its own, and each reviewer
66
- * call starts a child workflow.
70
+ * loop of the synthesizer runs outside it, thus each of its model calls and each of its lookups is a step of its own.
67
71
  */
68
72
  readonly durably: <T>(name: string, run: () => Promise<T>) => Promise<T>;
69
73
  /** The pause of the run, for the loop of the synthesizer. Absent: a failed request fails the synthesis. */
@@ -25,7 +25,7 @@ import { loadPlan, queryRun } from "../state/index.js";
25
25
  import { unwrapOrThrow } from "../lib/result.js";
26
26
  import { createNoopLogger } from "../lib/console-logger.js";
27
27
  export async function synthesizeRun(deps, params) {
28
- const { pool, provider, embedding, resolveWorkspaceRoot, synthesisModel, literatureReviewer, usageRecorder } = deps;
28
+ const { pool, provider, embedding, resolveWorkspaceRoot, synthesisModel, synthesisLookups, usageRecorder } = deps;
29
29
  const { analysisId, runId, completedSteps, session, emit, onProgress, durably, pause } = params;
30
30
  await onProgress("starting", "Beginning literature-grounded synthesis");
31
31
  try {
@@ -47,9 +47,11 @@ export async function synthesizeRun(deps, params) {
47
47
  provider,
48
48
  session: synthesizerSession,
49
49
  model: synthesisModel,
50
- literatureReviewer,
50
+ synthesisLookups,
51
+ scriptRuntime: deps.scriptRuntime,
51
52
  usageRecorder,
52
53
  toolOutputStore: deps.toolOutputStore,
54
+ workspace: { workspaceFs: deps.workspaceFs, pool, embedding, resolveWorkspaceRoot },
53
55
  summaries,
54
56
  planNarrative,
55
57
  runId,
@@ -16,8 +16,49 @@ export declare const AnalogyCoverageSchema: z.ZodEnum<{
16
16
  search_failed: "search_failed";
17
17
  }>;
18
18
  export type AnalogyCoverage = z.infer<typeof AnalogyCoverageSchema>;
19
+ /** One analogy of a report, with the cited solutions of its target domain. */
20
+ export declare const AnalogySchema: z.ZodObject<{
21
+ targetDomain: z.ZodString;
22
+ analogyTitle: z.ZodString;
23
+ objectMappings: z.ZodArray<z.ZodObject<{
24
+ source: z.ZodString;
25
+ target: z.ZodString;
26
+ rationale: z.ZodString;
27
+ }, z.core.$strip>>;
28
+ sharedRelations: z.ZodString;
29
+ coverage: z.ZodEnum<{
30
+ available: "available";
31
+ not_loaded: "not_loaded";
32
+ queried_no_data: "queried_no_data";
33
+ search_failed: "search_failed";
34
+ }>;
35
+ solutions: z.ZodArray<z.ZodObject<{
36
+ title: z.ZodString;
37
+ sourceDomain: z.ZodString;
38
+ description: z.ZodString;
39
+ keyConcepts: z.ZodArray<z.ZodString>;
40
+ relevance: z.ZodString;
41
+ sources: z.ZodArray<z.ZodObject<{
42
+ url: z.ZodURL;
43
+ title: z.ZodString;
44
+ }, z.core.$strip>>;
45
+ githubRepos: z.ZodArray<z.ZodObject<{
46
+ url: z.ZodURL;
47
+ description: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>>;
49
+ }, z.core.$strip>>;
50
+ }, z.core.$strip>;
51
+ /** The extraction of the problem: what the analogies map from. */
52
+ export declare const AnalogyProblemSchema: z.ZodObject<{
53
+ problemSummary: z.ZodString;
54
+ problemObjects: z.ZodArray<z.ZodObject<{
55
+ name: z.ZodString;
56
+ role: z.ZodString;
57
+ }, z.core.$strip>>;
58
+ problemRelations: z.ZodArray<z.ZodString>;
59
+ keyTerms: z.ZodArray<z.ZodString>;
60
+ }, z.core.$strip>;
19
61
  export declare const AnalogyReportSchema: z.ZodObject<{
20
- schemaVersion: z.ZodLiteral<"1">;
21
62
  problemSummary: z.ZodString;
22
63
  problemObjects: z.ZodArray<z.ZodObject<{
23
64
  name: z.ZodString;
@@ -25,6 +66,7 @@ export declare const AnalogyReportSchema: z.ZodObject<{
25
66
  }, z.core.$strip>>;
26
67
  problemRelations: z.ZodArray<z.ZodString>;
27
68
  keyTerms: z.ZodArray<z.ZodString>;
69
+ schemaVersion: z.ZodLiteral<"1">;
28
70
  analogies: z.ZodArray<z.ZodObject<{
29
71
  targetDomain: z.ZodString;
30
72
  analogyTitle: z.ZodString;
@@ -67,7 +109,6 @@ export declare const AnalogyReportErrorSchema: z.ZodObject<{
67
109
  }, z.core.$strip>;
68
110
  }, z.core.$strip>;
69
111
  export declare const AnalogicalReasonerOutputSchema: z.ZodUnion<readonly [z.ZodObject<{
70
- schemaVersion: z.ZodLiteral<"1">;
71
112
  problemSummary: z.ZodString;
72
113
  problemObjects: z.ZodArray<z.ZodObject<{
73
114
  name: z.ZodString;
@@ -75,6 +116,7 @@ export declare const AnalogicalReasonerOutputSchema: z.ZodUnion<readonly [z.ZodO
75
116
  }, z.core.$strip>>;
76
117
  problemRelations: z.ZodArray<z.ZodString>;
77
118
  keyTerms: z.ZodArray<z.ZodString>;
119
+ schemaVersion: z.ZodLiteral<"1">;
78
120
  analogies: z.ZodArray<z.ZodObject<{
79
121
  targetDomain: z.ZodString;
80
122
  analogyTitle: z.ZodString;
@@ -115,6 +157,8 @@ export declare const AnalogicalReasonerOutputSchema: z.ZodUnion<readonly [z.ZodO
115
157
  message: z.ZodString;
116
158
  }, z.core.$strip>;
117
159
  }, z.core.$strip>]>;
160
+ export type Analogy = z.infer<typeof AnalogySchema>;
161
+ export type AnalogyProblem = z.infer<typeof AnalogyProblemSchema>;
118
162
  export type AnalogyReport = z.infer<typeof AnalogyReportSchema>;
119
163
  export type AnalogyReportError = z.infer<typeof AnalogyReportErrorSchema>;
120
164
  export type AnalogicalReasonerOutput = z.infer<typeof AnalogicalReasonerOutputSchema>;
@@ -10,35 +10,41 @@
10
10
  */
11
11
  import { z } from "zod";
12
12
  export const AnalogyCoverageSchema = z.enum(["available", "queried_no_data", "search_failed", "not_loaded"]);
13
- export const AnalogyReportSchema = z.object({
14
- schemaVersion: z.literal("1"),
13
+ /** One analogy of a report, with the cited solutions of its target domain. */
14
+ export const AnalogySchema = z.object({
15
+ targetDomain: z.string(),
16
+ analogyTitle: z.string(),
17
+ objectMappings: z.array(z.object({
18
+ source: z.string(),
19
+ target: z.string(),
20
+ rationale: z.string(),
21
+ })),
22
+ sharedRelations: z.string(),
23
+ coverage: AnalogyCoverageSchema,
24
+ solutions: z.array(z.object({
25
+ title: z.string(),
26
+ sourceDomain: z.string(),
27
+ description: z.string().describe("Two or three sentences: the technical essentials of the method."),
28
+ keyConcepts: z.array(z.string()),
29
+ relevance: z.string().describe("How the method transfers back to the source problem."),
30
+ sources: z.array(z.object({ url: z.url(), title: z.string().describe("The exact title as the search result gives it.") })),
31
+ githubRepos: z.array(z.object({
32
+ url: z.url(),
33
+ description: z.string().optional(),
34
+ })),
35
+ })),
36
+ });
37
+ /** The extraction of the problem: what the analogies map from. */
38
+ export const AnalogyProblemSchema = z.object({
15
39
  problemSummary: z.string(),
16
40
  problemObjects: z.array(z.object({ name: z.string(), role: z.string() })),
17
41
  problemRelations: z.array(z.string()),
18
42
  keyTerms: z.array(z.string()),
19
- analogies: z.array(z.object({
20
- targetDomain: z.string(),
21
- analogyTitle: z.string(),
22
- objectMappings: z.array(z.object({
23
- source: z.string(),
24
- target: z.string(),
25
- rationale: z.string(),
26
- })),
27
- sharedRelations: z.string(),
28
- coverage: AnalogyCoverageSchema,
29
- solutions: z.array(z.object({
30
- title: z.string(),
31
- sourceDomain: z.string(),
32
- description: z.string(),
33
- keyConcepts: z.array(z.string()),
34
- relevance: z.string(),
35
- sources: z.array(z.object({ url: z.url(), title: z.string() })),
36
- githubRepos: z.array(z.object({
37
- url: z.url(),
38
- description: z.string().optional(),
39
- })),
40
- })),
41
- })),
43
+ });
44
+ export const AnalogyReportSchema = z.object({
45
+ schemaVersion: z.literal("1"),
46
+ ...AnalogyProblemSchema.shape,
47
+ analogies: z.array(AnalogySchema),
42
48
  });
43
49
  export const AnalogyReportErrorSchema = z.object({
44
50
  schemaVersion: z.literal("1"),
@@ -23,13 +23,6 @@ export type PlanStep = {
23
23
  agent: string;
24
24
  question: string;
25
25
  depends_on: string[];
26
- resources?: {
27
- cpu: number;
28
- memoryGb: number;
29
- gpu?: {
30
- count: number;
31
- };
32
- };
33
26
  maxSteps: number;
34
27
  track?: string;
35
28
  step_type?: string;
@@ -142,11 +135,9 @@ export type RunStartedPart = {
142
135
  planSummary: string;
143
136
  stepCount: number;
144
137
  };
145
- /** `"pending"` = waiting on dependencies; `"queued"` = dependencies satisfied,
146
- * held until in-flight steps free machine-budget capacity; `"skipped"` =
147
- * unreachable — an upstream dependency failed or blocked, so the step can
148
- * never be dispatched. */
149
- export type StepStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
138
+ /** `"pending"` = waiting on dependencies; `"skipped"` = unreachable — an
139
+ * upstream dependency failed or blocked, so the step can never be dispatched. */
140
+ export type StepStatus = "pending" | "running" | "completed" | "failed" | "skipped";
150
141
  export type DagStepState = {
151
142
  id: string;
152
143
  name: string;
@@ -381,8 +372,6 @@ export type SynthesisProgressPart = {
381
372
  activity: string;
382
373
  /** ISO 8601 time of the emission. Absent in a stream that an older harness wrote. */
383
374
  at?: string;
384
- /** Number of literature-reviewer delegations started so far. */
385
- delegationCount?: number;
386
375
  /** Agent-provided reason — set when phase === "skipped". */
387
376
  reason?: string;
388
377
  /** Error message — set when phase === "failed". */
@@ -376,7 +376,8 @@ export declare const ScalarReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject
376
376
  * artifact as a table. Two conditions give the second reason. The file type refuses a read of a cell, or
377
377
  * the bytes are unrecoverable.
378
378
  *
379
- * `extraction-unavailable` means that the value tier must use an extraction arm that is not wired.
379
+ * `extraction-unavailable` means that the host read cannot give the cells: the file is over the cap of the
380
+ * host read, a parse fault stopped it, or its extension names no tabular format. No other reader exists.
380
381
  */
381
382
  export declare const UnresolvedReasonSchema: z.ZodEnum<{
382
383
  "ambiguous-match": "ambiguous-match";
@@ -212,7 +212,8 @@ export const ScalarReferenceSchema = z.discriminatedUnion("kind", [ArtifactValue
212
212
  * artifact as a table. Two conditions give the second reason. The file type refuses a read of a cell, or
213
213
  * the bytes are unrecoverable.
214
214
  *
215
- * `extraction-unavailable` means that the value tier must use an extraction arm that is not wired.
215
+ * `extraction-unavailable` means that the host read cannot give the cells: the file is over the cap of the
216
+ * host read, a parse fault stopped it, or its extension names no tabular format. No other reader exists.
216
217
  */
217
218
  export const UnresolvedReasonSchema = z.enum([
218
219
  "artifact-missing",
@@ -8,13 +8,6 @@ export declare const PlanStepSchema: z.ZodObject<{
8
8
  agent: z.ZodString;
9
9
  question: z.ZodString;
10
10
  depends_on: z.ZodArray<z.ZodString>;
11
- resources: z.ZodOptional<z.ZodObject<{
12
- cpu: z.ZodNumber;
13
- memoryGb: z.ZodNumber;
14
- gpu: z.ZodOptional<z.ZodObject<{
15
- count: z.ZodNumber;
16
- }, z.core.$strip>>;
17
- }, z.core.$strip>>;
18
11
  grounding: z.ZodOptional<z.ZodObject<{
19
12
  status: z.ZodString;
20
13
  snapshot: z.ZodString;
@@ -113,13 +106,6 @@ export declare const PlanPartSchema: z.ZodObject<{
113
106
  agent: z.ZodString;
114
107
  question: z.ZodString;
115
108
  depends_on: z.ZodArray<z.ZodString>;
116
- resources: z.ZodOptional<z.ZodObject<{
117
- cpu: z.ZodNumber;
118
- memoryGb: z.ZodNumber;
119
- gpu: z.ZodOptional<z.ZodObject<{
120
- count: z.ZodNumber;
121
- }, z.core.$strip>>;
122
- }, z.core.$strip>>;
123
109
  grounding: z.ZodOptional<z.ZodObject<{
124
110
  status: z.ZodString;
125
111
  snapshot: z.ZodString;
@@ -209,7 +195,6 @@ export declare const StepStatusSchema: z.ZodEnum<{
209
195
  completed: "completed";
210
196
  failed: "failed";
211
197
  pending: "pending";
212
- queued: "queued";
213
198
  running: "running";
214
199
  skipped: "skipped";
215
200
  }>;
@@ -221,7 +206,6 @@ export declare const DagStepStateSchema: z.ZodObject<{
221
206
  completed: "completed";
222
207
  failed: "failed";
223
208
  pending: "pending";
224
- queued: "queued";
225
209
  running: "running";
226
210
  skipped: "skipped";
227
211
  }>;
@@ -244,7 +228,6 @@ export declare const DagStatePartSchema: z.ZodObject<{
244
228
  completed: "completed";
245
229
  failed: "failed";
246
230
  pending: "pending";
247
- queued: "queued";
248
231
  running: "running";
249
232
  skipped: "skipped";
250
233
  }>;
@@ -572,7 +555,6 @@ export declare const SynthesisProgressPartSchema: z.ZodObject<{
572
555
  }>;
573
556
  activity: z.ZodString;
574
557
  at: z.ZodOptional<z.ZodString>;
575
- delegationCount: z.ZodOptional<z.ZodNumber>;
576
558
  reason: z.ZodOptional<z.ZodString>;
577
559
  error: z.ZodOptional<z.ZodString>;
578
560
  }, z.core.$strip>;
@@ -731,13 +713,6 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
731
713
  agent: z.ZodString;
732
714
  question: z.ZodString;
733
715
  depends_on: z.ZodArray<z.ZodString>;
734
- resources: z.ZodOptional<z.ZodObject<{
735
- cpu: z.ZodNumber;
736
- memoryGb: z.ZodNumber;
737
- gpu: z.ZodOptional<z.ZodObject<{
738
- count: z.ZodNumber;
739
- }, z.core.$strip>>;
740
- }, z.core.$strip>>;
741
716
  grounding: z.ZodOptional<z.ZodObject<{
742
717
  status: z.ZodString;
743
718
  snapshot: z.ZodString;
@@ -817,7 +792,6 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
817
792
  completed: "completed";
818
793
  failed: "failed";
819
794
  pending: "pending";
820
- queued: "queued";
821
795
  running: "running";
822
796
  skipped: "skipped";
823
797
  }>;
@@ -1027,7 +1001,6 @@ export declare const ChatPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1027
1001
  }>;
1028
1002
  activity: z.ZodString;
1029
1003
  at: z.ZodOptional<z.ZodString>;
1030
- delegationCount: z.ZodOptional<z.ZodNumber>;
1031
1004
  reason: z.ZodOptional<z.ZodString>;
1032
1005
  error: z.ZodOptional<z.ZodString>;
1033
1006
  }, z.core.$strip>, z.ZodObject<{
@@ -11,7 +11,6 @@ export const PlanStepSchema = z.object({
11
11
  agent: z.string(),
12
12
  question: z.string(),
13
13
  depends_on: z.array(z.string()),
14
- resources: z.object({ cpu: z.number(), memoryGb: z.number(), gpu: z.object({ count: z.number() }).optional() }).optional(),
15
14
  grounding: z
16
15
  .object({
17
16
  status: z.string(),
@@ -139,7 +138,7 @@ export const RunStartedPartSchema = z.object({
139
138
  stepCount: z.number(),
140
139
  });
141
140
  // ── DAG State ───────────────────────────────────────────────────────
142
- export const StepStatusSchema = z.enum(["pending", "queued", "running", "completed", "failed", "skipped"]);
141
+ export const StepStatusSchema = z.enum(["pending", "running", "completed", "failed", "skipped"]);
143
142
  export const DagStepStateSchema = z
144
143
  .object({
145
144
  id: z.string(),
@@ -324,7 +323,6 @@ export const SynthesisProgressPartSchema = z.object({
324
323
  phase: SynthesisPhaseSchema,
325
324
  activity: z.string(),
326
325
  at: z.string().optional(),
327
- delegationCount: z.number().int().nonnegative().optional(),
328
326
  reason: z.string().optional(),
329
327
  error: z.string().optional(),
330
328
  });
@@ -78,6 +78,8 @@ export type RunCancelerDeps = {
78
78
  /** The run end that the body recorded: `null` when it recorded none, a rejection when the read fails.
79
79
  * The value is unchecked engine data. Production default: `DBOSClient.getEvent` with a zero timeout. */
80
80
  readonly readRecordedRunEnd?: (runId: string) => Promise<unknown>;
81
+ /** End the sandbox leases of the canceled workflows now, thus their machines and commands stop at once. */
82
+ readonly releaseLeasesOf?: (workflowIds: readonly string[]) => Promise<void>;
81
83
  };
82
84
  export type RunCanceler = {
83
85
  /**
@@ -118,6 +118,15 @@ export function createRunCanceler(deps) {
118
118
  catch (err) {
119
119
  logger.error("late-child cancel sweep failed", { runId, ...logger.errorFields(err) });
120
120
  }
121
+ // Before the pauses clear: a lease workflow that waits in a pause is ended through its pause row.
122
+ if (deps.releaseLeasesOf !== undefined) {
123
+ try {
124
+ await deps.releaseLeasesOf([...new Set([workflowId, ...knownChildren, ...childIds(cutSteps ?? [])])]);
125
+ }
126
+ catch (err) {
127
+ logger.error("the sandbox leases of the run did not end; each ends at its next owner check", { runId, ...logger.errorFields(err) });
128
+ }
129
+ }
121
130
  // The cancel ended each wait of a paused step, and no workflow of the run deletes its row again.
122
131
  const cleared = await clearPausesOfWork(pool, runId);
123
132
  if (cleared.isErr())
@@ -7,10 +7,12 @@
7
7
  * submission is the synthesis.
8
8
  * - `report_blocker` — the run produced nothing synthesizable. An
9
9
  * accepted synthesis wins over a blocker.
10
- * - `literature_reviewer` — research sub-agent exposed as a tool. The
11
- * runtime registers it one time and gives it here;
12
- * the sub-agent loop's brief is the only context
13
- * handed across the boundary (forSubAgent semantics).
10
+ * - the lookups — the gene, protein, annotation, interaction,
11
+ * PubMed, citation, drug-gene, and preclinical
12
+ * tools (`createSynthesisLookupTools`). Each lookup
13
+ * records the PMIDs of its result, and
14
+ * `submit_synthesis` refuses a PMID that no lookup
15
+ * of the run returned.
14
16
  *
15
17
  * Two deliverables on a happy path: `synthesis.json` written to the run dir
16
18
  * and a `data-run-synthesis` chat data part emitted via the `emit` callback
@@ -21,16 +23,19 @@
21
23
  * resolves with `{ kind: "failed" }`, the wrapper emits a synthesis-progress
22
24
  * `failed` part. We do not throw here for routine submitter rejections.
23
25
  */
26
+ import type { ScriptRuntime } from "../tools/script/run-script.js";
24
27
  import { type RunSynthesis, type SynthesisDraft } from "../schemas/run-synthesis.js";
25
28
  import type { RunSynthesisPart } from "../contracts/chat-parts.js";
26
29
  import type { StepSummary } from "../schemas/step-summary.js";
27
30
  import { type LoopOptions, type LoopStep } from "../loop/run-loop.js";
28
31
  import type { ToolOutputStore } from "../loop/tool-output.js";
29
- import type { ChatDataPart, EmitFn } from "../loop/types.js";
32
+ import type { AgentDefinition, ChatDataPart, EmitFn } from "../loop/types.js";
30
33
  import type { ChatProvider } from "../providers/types.js";
31
34
  import type { UsageRecorder } from "../billing/usage-recorder.js";
32
35
  import type { RunSession } from "../auth/types.js";
33
36
  import { type Tool } from "../tools/define-tool.js";
37
+ import type { ResolveWorkspaceRoot } from "../workspace/paths.js";
38
+ import { type ReadSurfaceDeps } from "../tools/workspace/read-surface.js";
34
39
  /**
35
40
  * The synthesizer's agent identity — the `source.agentId` on its loop events
36
41
  * and the `agent_id` of the run-phase `synthesis` row `executeAnalysis` writes
@@ -50,6 +55,14 @@ export type SubmitSynthesisOutput = {
50
55
  accepted: false;
51
56
  issues: ValidationIssue[];
52
57
  };
58
+ /** Each PMID that a lookup result holds under a `pmid` or `pmids` key, outside the echo of the request. */
59
+ export declare function pmidsIn(value: unknown, found?: Set<string>): Set<string>;
60
+ /**
61
+ * A lookup whose ok result records the PMIDs that it holds. The loop folds the
62
+ * record into `seen` after each round, on the first run and on each replay, thus
63
+ * the check of `submit_synthesis` reads the same set in both.
64
+ */
65
+ export declare function recordingPmids(tool: Tool, seen: Set<string>): Tool;
53
66
  /** The last accepted synthesis of a run, from the inputs of the calls of `submit_synthesis` that it accepted. */
54
67
  export declare function acceptedSynthesisOf(steps: readonly LoopStep[]): SynthesisDraft | undefined;
55
68
  /**
@@ -58,6 +71,7 @@ export declare function acceptedSynthesisOf(steps: readonly LoopStep[]): Synthes
58
71
  */
59
72
  export declare function __buildInnerToolsForTest(args: {
60
73
  knownStepIds: ReadonlySet<string>;
74
+ lookedUpPmids?: ReadonlySet<string>;
61
75
  }): {
62
76
  submit: Tool<{
63
77
  synthesis: SynthesisDraft;
@@ -70,12 +84,16 @@ export type GenerateRunSynthesisInput = {
70
84
  readonly provider: ChatProvider;
71
85
  readonly session: RunSession;
72
86
  readonly model: string;
73
- /** The `literature_reviewer` tool of the synthesizer (`createLiteratureReviewerTool`). */
74
- readonly literatureReviewer: Tool;
87
+ /** The lookup tools of the synthesizer (`createSynthesisLookupTools`). They run in `run_script`. */
88
+ readonly synthesisLookups: readonly Tool[];
89
+ /** Where the VM of `run_script` comes from. See {@link ScriptRuntime}. */
90
+ readonly scriptRuntime?: ScriptRuntime;
75
91
  /** LLM usage-accounting seam for the synthesizer loop; omitted falls back to the no-op recorder. */
76
92
  readonly usageRecorder?: UsageRecorder;
77
- /** The store of the synthesizer and reviewer loops and of their read tools. */
93
+ /** The store of the synthesizer loop and of its read tool. */
78
94
  readonly toolOutputStore?: ToolOutputStore;
95
+ /** The read-only surface of the workspace. The synthesizer reads a file of the run where a summary is thin. */
96
+ readonly workspace: SynthesizerWorkspace;
79
97
  /** Step summaries from the completed run. Non-empty. */
80
98
  readonly summaries: readonly StepSummary[];
81
99
  /** Plan analytical narrative for context. */
@@ -89,6 +107,14 @@ export type GenerateRunSynthesisInput = {
89
107
  /** The pause of the run. The body of the run gives it, thus a failed request waits in place. */
90
108
  readonly pause?: LoopOptions["pause"];
91
109
  };
110
+ /** The read-only workspace of the synthesizer: the file tools, the search, the data profile, and the script reads. */
111
+ export type SynthesizerWorkspace = ReadSurfaceDeps & {
112
+ readonly resolveWorkspaceRoot: ResolveWorkspaceRoot;
113
+ };
114
+ /** What the synthesizer agent is built from, for a consumer that runs the agent outside `generateRunSynthesis`. */
115
+ export type SynthesizerAgentInput = Pick<GenerateRunSynthesisInput, "model" | "synthesisLookups" | "scriptRuntime" | "toolOutputStore" | "summaries" | "workspace">;
116
+ /** The synthesizer agent of one run. Its submit tool checks the step ids of the summaries and the PMIDs of its lookups. */
117
+ export declare function synthesizerAgentOf(input: SynthesizerAgentInput): AgentDefinition;
92
118
  export type GenerateRunSynthesisResult = {
93
119
  kind: "synthesis";
94
120
  synthesis: RunSynthesis;
@@ -143,6 +169,8 @@ export declare function readSynthesisText(args: ReadSynthesisInput): Promise<str
143
169
  */
144
170
  export declare function readRunSynthesis(args: ReadSynthesisInput): Promise<RunSynthesisPart | null>;
145
171
  export declare function formatSynthesisEmbeddingText(synthesis: RunSynthesis): string;
172
+ /** The first message of the synthesizer: the narrative of the plan and the summary of each step. */
173
+ export declare function synthesizerSeedOf(planNarrative: string, summaries: readonly StepSummary[]): string;
146
174
  /**
147
175
  * Build the `data-run-synthesis` chat part the parent stream emits when the
148
176
  * synthesizer completes successfully. The schema mirrors the harness's contracts