@inflexa-ai/harness 0.28.1 → 0.30.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 (168) hide show
  1. package/dist/agents/conversation-agent.js +7 -4
  2. package/dist/agents/report-session-agent.js +1 -1
  3. package/dist/agents/sandbox/data-profiler.js +0 -1
  4. package/dist/agents/sandbox/immune-profiling-agent.js +3 -1
  5. package/dist/agents/sandbox/network-agent.js +0 -1
  6. package/dist/agents/sandbox/types.d.ts +1 -1
  7. package/dist/agents/sandbox/types.js +1 -1
  8. package/dist/app/data-profile-orientation.d.ts +52 -27
  9. package/dist/app/data-profile-orientation.js +331 -92
  10. package/dist/app/data-profile-view.d.ts +70 -0
  11. package/dist/app/data-profile-view.js +123 -0
  12. package/dist/app/synthesize-run.js +1 -1
  13. package/dist/config/resource-limits.d.ts +1 -1
  14. package/dist/config/resource-limits.js +1 -1
  15. package/dist/contracts/data-profile.d.ts +276 -25
  16. package/dist/contracts/index.d.ts +3 -1
  17. package/dist/contracts/index.js +1 -0
  18. package/dist/contracts/profile-vocabulary.d.ts +103 -0
  19. package/dist/contracts/profile-vocabulary.js +449 -0
  20. package/dist/contracts/schemas/chat-parts.d.ts +12 -12
  21. package/dist/contracts/severity.d.ts +2 -2
  22. package/dist/contracts/target-dossier.d.ts +91 -91
  23. package/dist/data/safety-panel-schema.d.ts +4 -4
  24. package/dist/execution/input-signature.d.ts +16 -3
  25. package/dist/execution/input-signature.js +0 -0
  26. package/dist/execution/post-step-pipeline.js +1 -1
  27. package/dist/execution/staged-input.d.ts +4 -4
  28. package/dist/index.d.ts +7 -2
  29. package/dist/index.js +14 -0
  30. package/dist/input-scan/clustering.d.ts +63 -0
  31. package/dist/input-scan/clustering.js +208 -0
  32. package/dist/input-scan/companions.d.ts +30 -0
  33. package/dist/input-scan/companions.js +138 -0
  34. package/dist/input-scan/decoder/container_readout.py +171 -0
  35. package/dist/input-scan/detect-sets.d.ts +24 -0
  36. package/dist/input-scan/detect-sets.js +279 -0
  37. package/dist/input-scan/enrich.d.ts +62 -19
  38. package/dist/input-scan/enrich.js +132 -187
  39. package/dist/input-scan/formats.d.ts +13 -5
  40. package/dist/input-scan/formats.js +13 -5
  41. package/dist/input-scan/index.d.ts +10 -4
  42. package/dist/input-scan/index.js +7 -4
  43. package/dist/input-scan/markers.d.ts +21 -0
  44. package/dist/input-scan/markers.js +89 -0
  45. package/dist/input-scan/menu.d.ts +127 -0
  46. package/dist/input-scan/menu.js +0 -0
  47. package/dist/input-scan/quarantine.d.ts +17 -0
  48. package/dist/input-scan/quarantine.js +69 -0
  49. package/dist/input-scan/readout-budget.d.ts +32 -0
  50. package/dist/input-scan/readout-budget.js +61 -0
  51. package/dist/input-scan/readout.d.ts +33 -0
  52. package/dist/input-scan/readout.js +336 -0
  53. package/dist/input-scan/scan.d.ts +5 -4
  54. package/dist/input-scan/scan.js +5 -5
  55. package/dist/input-scan/set-types.d.ts +209 -0
  56. package/dist/input-scan/set-types.js +15 -0
  57. package/dist/input-scan/templates.d.ts +93 -0
  58. package/dist/input-scan/templates.js +369 -0
  59. package/dist/input-scan/tokens.d.ts +94 -0
  60. package/dist/input-scan/tokens.js +267 -0
  61. package/dist/input-scan/tuning.d.ts +55 -0
  62. package/dist/input-scan/tuning.js +55 -0
  63. package/dist/input-scan/types.d.ts +2 -2
  64. package/dist/loop/run-agent.d.ts +13 -1
  65. package/dist/loop/run-agent.js +2 -1
  66. package/dist/prompts/SOUL.d.ts +2 -2
  67. package/dist/prompts/SOUL.js +17 -1
  68. package/dist/prompts/conversation.d.ts +1 -1
  69. package/dist/prompts/conversation.js +45 -71
  70. package/dist/prompts/planner.js +57 -10
  71. package/dist/prompts/report-session.d.ts +1 -1
  72. package/dist/prompts/report-session.js +3 -2
  73. package/dist/prompts/sandbox/bulk-transcriptomics-agent.d.ts +1 -1
  74. package/dist/prompts/sandbox/bulk-transcriptomics-agent.js +3 -1
  75. package/dist/prompts/sandbox/data-profiler.d.ts +10 -1
  76. package/dist/prompts/sandbox/data-profiler.js +197 -53
  77. package/dist/prompts/sandbox/dna-methylation-agent.d.ts +1 -1
  78. package/dist/prompts/sandbox/dna-methylation-agent.js +18 -12
  79. package/dist/prompts/sandbox/immune-profiling-agent.d.ts +1 -1
  80. package/dist/prompts/sandbox/immune-profiling-agent.js +6 -2
  81. package/dist/prompts/sandbox/metabolomics-agent.d.ts +1 -1
  82. package/dist/prompts/sandbox/metabolomics-agent.js +8 -4
  83. package/dist/prompts/sandbox/microbiome-agent.d.ts +1 -1
  84. package/dist/prompts/sandbox/microbiome-agent.js +12 -6
  85. package/dist/prompts/sandbox/network-agent.d.ts +1 -1
  86. package/dist/prompts/sandbox/network-agent.js +9 -6
  87. package/dist/prompts/sandbox/spatial-omics-agent.d.ts +1 -1
  88. package/dist/prompts/sandbox/spatial-omics-agent.js +4 -2
  89. package/dist/prompts/sandbox-standards.d.ts +1 -1
  90. package/dist/prompts/sandbox-standards.js +10 -7
  91. package/dist/providers/ai-sdk.js +34 -1
  92. package/dist/providers/reasoning.d.ts +65 -0
  93. package/dist/providers/reasoning.js +81 -0
  94. package/dist/providers/types.d.ts +14 -0
  95. package/dist/schemas/data-profile-schemas.d.ts +947 -84
  96. package/dist/schemas/data-profile-schemas.js +300 -115
  97. package/dist/schemas/run-synthesis.d.ts +4 -4
  98. package/dist/state/data-profile.d.ts +1 -1
  99. package/dist/state/index.d.ts +1 -1
  100. package/dist/state/vector-store.d.ts +13 -0
  101. package/dist/state/vector-store.js +8 -0
  102. package/dist/tasks/data-profile-absorb.d.ts +78 -0
  103. package/dist/tasks/data-profile-absorb.js +285 -0
  104. package/dist/tasks/data-profile-index.d.ts +34 -25
  105. package/dist/tasks/data-profile-index.js +160 -59
  106. package/dist/tasks/data-profile-resolve.d.ts +72 -0
  107. package/dist/tasks/data-profile-resolve.js +639 -0
  108. package/dist/tasks/data-profile.d.ts +16 -5
  109. package/dist/tasks/data-profile.js +270 -131
  110. package/dist/tools/bio/chembl.d.ts +1 -1
  111. package/dist/tools/bio/chembl.js +15 -10
  112. package/dist/tools/bio/comptox.js +5 -1
  113. package/dist/tools/bio/drug-gene-interactions.js +5 -2
  114. package/dist/tools/bio/gene-disease-evidence.d.ts +19 -9
  115. package/dist/tools/bio/gene-disease-evidence.js +78 -22
  116. package/dist/tools/bio/gene-preclinical-profile.d.ts +33 -13
  117. package/dist/tools/bio/gene-preclinical-profile.js +63 -22
  118. package/dist/tools/bio/lookup-annotation.d.ts +1 -0
  119. package/dist/tools/bio/lookup-annotation.js +28 -10
  120. package/dist/tools/bio/opentargets.d.ts +10 -2
  121. package/dist/tools/bio/opentargets.js +42 -13
  122. package/dist/tools/bio/pubchem.js +5 -2
  123. package/dist/tools/bio/pubmed.js +9 -3
  124. package/dist/tools/bio/search-clinical-trials.d.ts +25 -25
  125. package/dist/tools/bio/search-clinical-trials.js +56 -18
  126. package/dist/tools/bio/search-faers.d.ts +26 -6
  127. package/dist/tools/bio/search-faers.js +70 -18
  128. package/dist/tools/bio/search-gene.d.ts +19 -3
  129. package/dist/tools/bio/search-gene.js +69 -12
  130. package/dist/tools/bio/search-geo-datasets.js +4 -1
  131. package/dist/tools/bio/search-interactions.js +6 -2
  132. package/dist/tools/bio/target-safety.d.ts +2 -2
  133. package/dist/tools/bio/target-safety.js +3 -2
  134. package/dist/tools/lib/cbioportal-client.js +25 -6
  135. package/dist/tools/lib/chembl-client.d.ts +3 -1
  136. package/dist/tools/lib/chembl-client.js +6 -1
  137. package/dist/tools/lib/gwas-catalog-client.d.ts +7 -6
  138. package/dist/tools/lib/gwas-catalog-client.js +18 -6
  139. package/dist/tools/lib/openfda-client.d.ts +7 -5
  140. package/dist/tools/lib/openfda-client.js +17 -9
  141. package/dist/tools/lib/opentargets-client.d.ts +20 -0
  142. package/dist/tools/lib/opentargets-client.js +45 -0
  143. package/dist/tools/lib/pathway-client.d.ts +7 -0
  144. package/dist/tools/lib/pathway-client.js +68 -1
  145. package/dist/tools/research/context7-docs.js +3 -3
  146. package/dist/tools/research/generate-analogy-report.js +2 -2
  147. package/dist/tools/research/generate-plan.d.ts +3 -0
  148. package/dist/tools/research/generate-plan.js +64 -5
  149. package/dist/tools/research/inspect-data-profile.d.ts +48 -22
  150. package/dist/tools/research/inspect-data-profile.js +73 -54
  151. package/dist/tools/research/resolve-citation.js +8 -3
  152. package/dist/tools/research/search-arxiv.js +8 -3
  153. package/dist/tools/research/search-semantic-scholar.js +10 -4
  154. package/dist/tools/workspace/scan-inputs.d.ts +4 -4
  155. package/dist/tools/workspace/scan-inputs.js +13 -14
  156. package/dist/tools/workspace/workspace-search.d.ts +11 -2
  157. package/dist/tools/workspace/workspace-search.js +44 -16
  158. package/dist/workflows/sandbox-step.d.ts +6 -0
  159. package/dist/workflows/sandbox-step.js +31 -14
  160. package/dist/workflows/target-assessment/assemblers/safety.d.ts +1 -1
  161. package/dist/workflows/target-assessment/phase4-assemble.d.ts +38 -38
  162. package/dist/workflows/target-assessment/schemas.d.ts +12 -12
  163. package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +6 -6
  164. package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +6 -6
  165. package/dist/workflows/target-assessment/synthesis/index.d.ts +12 -12
  166. package/package.json +5 -3
  167. package/dist/input-scan/coverage.d.ts +0 -22
  168. package/dist/input-scan/coverage.js +0 -85
@@ -27,7 +27,7 @@ import { composeSystemPrompt } from "./system-prompt.js";
27
27
  import { searchGeneTool, lookupAnnotationTool, searchInteractionsTool, chemblTool, pubchemTool, openTargetsTool, searchFaersTool, searchClinicalTrialsTool, searchGeoDatasetsTool, genePreclinicalProfileTool, targetSafetyTool, } from "../tools/bio/index.js";
28
28
  import { createNcbiTools, createChemDbTools } from "../tools/bio/keys.js";
29
29
  // Dependency-bearing tool factories.
30
- import { createGeneratePlanTool, createLiteratureReviewerTool, createInspectRunTool, createInspectDataProfileTool, createGenerateAnalogyReportTool, } from "../tools/research/index.js";
30
+ import { createGeneratePlanTool, createInspectRunTool, createInspectDataProfileTool, createGenerateAnalogyReportTool, createSearchSemanticScholarTool, searchArxivTool, } from "../tools/research/index.js";
31
31
  import { createFileStatTool, createGrepTool, createListFilesTool, createReadFileTool, createShowPlanTool, createWorkspaceSearchTool, showFileTool, } from "../tools/workspace/index.js";
32
32
  import { showUserTool } from "../tools/display/index.js";
33
33
  import { createUpdateWorkingMemoryTool } from "../tools/memory/index.js";
@@ -39,7 +39,7 @@ import { createResolveCitationTool } from "../tools/research/resolve-citation.js
39
39
  /** Canonical agent id — the single source of truth. */
40
40
  export const CONVERSATION_AGENT_ID = "conversation-agent";
41
41
  /** Runaway guard — heavy tool-driving turns need generous headroom. */
42
- const CONVERSATION_MAX_ITERATIONS = 50;
42
+ const CONVERSATION_MAX_ITERATIONS = 200;
43
43
  /** Build the conversation `AgentDefinition` with every tool fully dep-bound. */
44
44
  export function createConversationAgent(deps) {
45
45
  const { provider, pool, embedding, workspaceFs, model, utilityProvider, utilityModel, executeAnalysisWorkflow, runAuthorizer, runLauncher, bioKeys, chrome, resourcePolicy, hostTools, refStorePath, packagesFile, usageRecorder, citationResolver, } = deps;
@@ -57,6 +57,10 @@ export function createConversationAgent(deps) {
57
57
  ncbi.pubmed,
58
58
  // Verification of one caller-supplied citation (distinct from discovery).
59
59
  createResolveCitationTool(citationResolver),
60
+ // Literature outside PubMed. A question about a method, a model or a
61
+ // preprint has no MEDLINE record, thus PubMed alone cannot answer it.
62
+ createSearchSemanticScholarTool({ ...(bioKeys.semanticScholar === undefined ? {} : { apiKey: bioKeys.semanticScholar }) }),
63
+ searchArxivTool,
60
64
  // ChEMBL (compounds / drug / mechanism / bioactivity / targets behind one action).
61
65
  chemblTool,
62
66
  // PubChem (compound / crossrefs / assays behind one action).
@@ -95,6 +99,7 @@ export function createConversationAgent(deps) {
95
99
  pool,
96
100
  resourcePolicy,
97
101
  usageRecorder,
102
+ bioKeys,
98
103
  ...(refStorePath ? { refStorePath } : {}),
99
104
  ...(packagesFile ? { packagesFile } : {}),
100
105
  ...(deps.logger ? { logger: deps.logger } : {}),
@@ -123,8 +128,6 @@ export function createConversationAgent(deps) {
123
128
  showUserTool,
124
129
  createShowPlanTool(pool),
125
130
  showFileTool,
126
- // Batch literature/biology research (sub-agent as a loop-driving tool).
127
- createLiteratureReviewerTool({ provider, model, bioKeys, citationResolver, usageRecorder }),
128
131
  // Cross-domain analogy generation (sub-agent as a loop-driving tool).
129
132
  createGenerateAnalogyReportTool({ provider, model, bioKeys, usageRecorder }),
130
133
  // Workspace semantic search + raw read/grep over the read seam.
@@ -35,7 +35,7 @@ export const REPORT_SESSION_AGENT_ID = "report-session";
35
35
  * look, record — drives more small tool calls than a conversation turn, thus it
36
36
  * gets the headroom of the report runner (REPORT_AGENT_MAX_STEPS).
37
37
  */
38
- const REPORT_SESSION_MAX_ITERATIONS = 75;
38
+ const REPORT_SESSION_MAX_ITERATIONS = 200;
39
39
  /** Build the report `AgentDefinition` with every tool bound to its deps. */
40
40
  export function createReportSessionAgent(deps) {
41
41
  const { model, pool, embedding, workspaceFs, gateway, resolveWorkspaceRoot, store, threads, chrome, eyes, makeResolver, resolvePageAsset, logger } = deps;
@@ -15,7 +15,6 @@ export const meta = {
15
15
  // differently. Declared rather than bolted on, so the resolved roster stays
16
16
  // `meta.tools` plus the always-on set.
17
17
  tools: [...BASE_SANDBOX_TOOLS, "scanInputs"],
18
- defaultMaxSteps: 85,
19
18
  plannable: false,
20
19
  };
21
20
  export function createDataProfilerAgent(deps) {
@@ -26,7 +26,9 @@ export const meta = {
26
26
  // `single-cell` carries the scirpy reference, which is the route from 10x
27
27
  // VDJ / AIRR files to called clonotypes — the input every repertoire metric
28
28
  // in `immune-profiling` assumes it already has.
29
- skills: ["immune-profiling", "single-cell", "shared/omics-general"],
29
+ // `statistical-modeling` carries the survival-cutpoint correction and the
30
+ // multiplicity rules that the immune-clinical correlation work demands.
31
+ skills: ["immune-profiling", "single-cell", "statistical-modeling", "shared/omics-general"],
30
32
  tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions", "searchGeoDatasets", "opentargets"],
31
33
  };
32
34
  export function createImmuneProfilingAgent(deps) {
@@ -9,7 +9,6 @@ export const meta = {
9
9
  suitableFor: ["expression-matrices", "correlation-matrices", "general-omics"],
10
10
  skills: ["network-regulatory", "shared/omics-general"],
11
11
  tools: [...BASE_SANDBOX_TOOLS, "pubmed", "searchGene", "lookupAnnotation", "searchInteractions"],
12
- defaultMaxSteps: 35,
13
12
  };
14
13
  export function createNetworkAgent(deps) {
15
14
  return createSandboxAgent(deps, meta, networkAgentPrompt);
@@ -31,4 +31,4 @@ export interface AgentMeta {
31
31
  readonly plannable?: boolean;
32
32
  }
33
33
  /** Default runaway-guard for sandbox agents. */
34
- export declare const SANDBOX_AGENT_DEFAULT_MAX_ITERATIONS = 50;
34
+ export declare const SANDBOX_AGENT_DEFAULT_MAX_ITERATIONS = 200;
@@ -12,4 +12,4 @@
12
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
- export const SANDBOX_AGENT_DEFAULT_MAX_ITERATIONS = 50;
15
+ export const SANDBOX_AGENT_DEFAULT_MAX_ITERATIONS = 200;
@@ -1,42 +1,67 @@
1
1
  /**
2
2
  * Data-profile orientation — the bounded projection of a persisted
3
- * `DataProfileResult` into the few hundred characters an agent needs to know
4
- * WHAT DATASET IT IS HOLDING before it does anything else.
3
+ * `DataProfileResult` into what an agent needs to know WHAT DATASET IT IS HOLDING
4
+ * before it does anything else.
5
5
  *
6
- * The persisted profile is deliberately rich (per-file metrics, warnings, tags,
7
- * the full narrative summary) because the DB row is its only durable home — the
8
- * profiler's scratch tree is deleted on completion. That richness is right for a
9
- * pull-on-demand tool (`inspect_data_profile`) and wrong for anything injected
10
- * unconditionally into a context window, which is what a step seed does. This is
11
- * the lossy half of that pair: a hard character budget, a fixed field order, and
12
- * visible truncation counts, so an agent that needs more knows to go pull it.
6
+ * The persisted profile is deliberately rich because the DB row is its only durable
7
+ * home — the profiler's scratch tree is deleted on completion. That richness is right
8
+ * for a pull-on-demand tool (`inspect_data_profile`) and wrong for anything injected
9
+ * unconditionally into a context window, which is what a step seed does. This is the
10
+ * lossy half of that pair: a hard character budget, a fixed section order, and visible
11
+ * truncation counts, so an agent that needs more knows to go pull it.
12
+ *
13
+ * What is lossy is the PROSE, not the structure. The submission schema bounds every array
14
+ * an agent authors — operations, dimensions, annotations — so the resolved record is small
15
+ * by construction, and a rendering that dropped half the groups to make room for a design
16
+ * note would be discarding the addressable facts to keep the summary of them. Groups
17
+ * therefore render one line each, all of them, each followed by the slots that vary across
18
+ * its members; dimensions and notable files follow; and the design note and the caveats
19
+ * take whatever budget is left. Groups are elided only when one line apiece already
20
+ * overruns the whole budget, and then the count that did not fit is stated outright.
21
+ *
22
+ * The census — kept files, groups, unclassified, quarantined, and whether the scan reached
23
+ * the whole tree — rides in the header on a reserved budget, so no clamp can remove the one
24
+ * line that says how much of the dataset the profile speaks for.
25
+ *
26
+ * Every elision is marked. A section fitted short, a list tail dropped, a prose value
27
+ * clamped: each ends the rendering with {@link ELISION_MARKER}, whose room is reserved
28
+ * before anything else is fitted. A rendering that silently lost a section reads as a
29
+ * profile that never had one.
13
30
  *
14
31
  * A pure function over the record — no I/O, no LLM, no pipeline. It is the whole
15
32
  * mechanism.
16
33
  *
17
- * Every path it renders is projected into the frame-independent
18
- * `/{analysisId}/…` form. The record stores a path relative to the analysis
19
- * root, which is the correct form to store; but a step agent resolves a relative
20
- * path against its own working directory, thus the stored form names a file that
21
- * does not exist there. The absolute form resolves to the same file in every
22
- * frame, including the conversation agent's, so the projection is unconditional.
34
+ * Every path it renders is projected into the frame-independent `/{analysisId}/…`
35
+ * form. The record stores a path relative to the analysis root, which is the correct
36
+ * form to store; but a step agent resolves a relative path against its own working
37
+ * directory, thus the stored form names a file that does not exist there. The absolute
38
+ * form resolves to the same file in every frame, including the conversation agent's, so
39
+ * the projection is unconditional.
23
40
  */
24
41
  import type { DataProfileResult } from "../state/data-profile.js";
25
- /** The character budget the projection guarantees it will not exceed. */
26
- export declare const DATA_PROFILE_ORIENTATION_MAX_CHARS = 1200;
27
42
  /**
28
- * Project a persisted profile into an orientation blurb of at most `maxChars`
29
- * characters. The bound is a guarantee, not a target: the assembled text is
30
- * hard-clamped, so no profile — however verbose — can blow a caller's budget.
43
+ * The character budget the projection guarantees it will not exceed.
31
44
  *
32
- * Field order is fixed and reflects what an agent must know first: what the
33
- * dataset IS, how it was designed, what is wrong with it, then what files carry
34
- * it. Both list sections state their true total, so an elided tail is visible
35
- * rather than silent.
45
+ * Sized from the record's own bounds rather than from a feel for how long a blurb should
46
+ * be: the census header, a group line plus a slots line for each of a submission's worth of
47
+ * groups, the dimension list, the notable files, and a prose tail. A profile past that
48
+ * elides its group tail with a stated count — which is the honest outcome, and a far
49
+ * cheaper one than a briefing that omits the groups an execution agent must address files
50
+ * by.
51
+ */
52
+ export declare const DATA_PROFILE_ORIENTATION_MAX_CHARS = 6000;
53
+ /**
54
+ * Project a persisted profile into an orientation blurb of at most `maxChars`
55
+ * characters. The bound is a guarantee, not a target: every section is fitted against the
56
+ * remaining budget before it is rendered, so no profile — however verbose — can blow a
57
+ * caller's budget, and nothing the budget removed leaves a half-line behind.
36
58
  *
37
- * A snapshot written before the record was widened carries none of the structured
38
- * fields. Rather than emit a bare file list, that case falls back to the narrative
39
- * summary — the one orientation a legacy row does have.
59
+ * Section order is fixed: identity, census, groups with their slots, dimensions, the
60
+ * members the agent wrote about individually, the experimental design, then the caveats.
61
+ * The header holds its own reserved budget, so the census survives whatever the body cannot
62
+ * hold, and the prose sits last so that it — and not the structure — is what a clamp
63
+ * reaches first. Each list section states its true total, and the trailing marker states
64
+ * that the budget, rather than a per-section cap, is why something is missing.
40
65
  *
41
66
  * `analysisId` roots each rendered file path (see the module header). It is the
42
67
  * id of the analysis the profile belongs to, and it is what the sandbox mounts