@inflexa-ai/harness 0.17.0 → 0.19.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 (249) hide show
  1. package/dist/agents/report-builder.d.ts +2 -0
  2. package/dist/agents/report-builder.js +2 -0
  3. package/dist/agents/report-session-agent.d.ts +56 -0
  4. package/dist/agents/report-session-agent.js +72 -0
  5. package/dist/app/report-session-runtime.d.ts +72 -0
  6. package/dist/app/report-session-runtime.js +157 -0
  7. package/dist/app/spawn-report-session.d.ts +85 -0
  8. package/dist/app/spawn-report-session.js +83 -0
  9. package/dist/contracts/chat-events.d.ts +9 -0
  10. package/dist/contracts/index.d.ts +6 -2
  11. package/dist/contracts/index.js +3 -1
  12. package/dist/contracts/organ-system.d.ts +49 -0
  13. package/dist/contracts/organ-system.js +67 -0
  14. package/dist/contracts/report-blocks.d.ts +564 -0
  15. package/dist/contracts/report-blocks.js +117 -0
  16. package/dist/contracts/report-reference.d.ts +459 -0
  17. package/dist/contracts/report-reference.js +256 -0
  18. package/dist/contracts/schemas/chat-events.d.ts +2 -0
  19. package/dist/contracts/schemas/chat-events.js +2 -0
  20. package/dist/contracts/severity.d.ts +15 -0
  21. package/dist/contracts/severity.js +10 -0
  22. package/dist/contracts/target-dossier.d.ts +8675 -12972
  23. package/dist/contracts/target-dossier.js +534 -591
  24. package/dist/data/safety-panel-schema.d.ts +18 -5
  25. package/dist/data/safety-panel-schema.js +4 -4
  26. package/dist/execution/artifact-metadata.js +1 -0
  27. package/dist/execution/report-runner.js +1 -3
  28. package/dist/execution/run-synthesis.js +2 -0
  29. package/dist/index.d.ts +6 -0
  30. package/dist/index.js +19 -0
  31. package/dist/lib/async-utils.d.ts +16 -4
  32. package/dist/lib/async-utils.js +20 -15
  33. package/dist/lib/host-concurrency.js +1 -0
  34. package/dist/loop/__fixtures__/scripted-provider.js +23 -2
  35. package/dist/loop/run-agent.js +58 -10
  36. package/dist/loop/tool-detail.d.ts +40 -0
  37. package/dist/loop/tool-detail.js +35 -3
  38. package/dist/loop/types.d.ts +13 -0
  39. package/dist/memory/thread-history.d.ts +10 -0
  40. package/dist/memory/thread-history.js +12 -1
  41. package/dist/memory/thread-store.d.ts +4 -4
  42. package/dist/memory/thread-store.js +18 -9
  43. package/dist/prompts/report-session.d.ts +1 -0
  44. package/dist/prompts/report-session.js +89 -0
  45. package/dist/prompts/target-assessment/briefs/executive-recommendation.d.ts +1 -1
  46. package/dist/prompts/target-assessment/briefs/executive-recommendation.js +5 -5
  47. package/dist/prompts/target-assessment/briefs/liability-bullets.d.ts +1 -1
  48. package/dist/prompts/target-assessment/briefs/liability-bullets.js +1 -1
  49. package/dist/prompts/target-assessment/briefs/target-organ-liabilities.d.ts +1 -1
  50. package/dist/prompts/target-assessment/briefs/target-organ-liabilities.js +11 -3
  51. package/dist/prompts/target-assessment/investigation/adversarial-critique.d.ts +1 -0
  52. package/dist/prompts/target-assessment/investigation/adversarial-critique.js +67 -0
  53. package/dist/prompts/target-assessment/investigation/claim-reverification.d.ts +1 -0
  54. package/dist/prompts/target-assessment/investigation/claim-reverification.js +49 -0
  55. package/dist/prompts/target-assessment/investigation/index.d.ts +3 -0
  56. package/dist/prompts/target-assessment/investigation/index.js +3 -0
  57. package/dist/prompts/target-assessment/investigation/mechanism-proposal.d.ts +1 -0
  58. package/dist/prompts/target-assessment/investigation/mechanism-proposal.js +49 -0
  59. package/dist/prompts/target-assessment/tox-voice/index.d.ts +1 -1
  60. package/dist/prompts/target-assessment/tox-voice/vocabulary.d.ts +8 -5
  61. package/dist/prompts/target-assessment/tox-voice/vocabulary.js +9 -20
  62. package/dist/providers/__fixtures__/session.d.ts +5 -4
  63. package/dist/providers/__fixtures__/session.js +4 -4
  64. package/dist/providers/ai-sdk.d.ts +77 -0
  65. package/dist/providers/ai-sdk.js +149 -19
  66. package/dist/providers/errors.d.ts +14 -0
  67. package/dist/providers/errors.js +103 -18
  68. package/dist/providers/types.d.ts +16 -0
  69. package/dist/providers/types.js +10 -1
  70. package/dist/report-model/block-walk.d.ts +56 -0
  71. package/dist/report-model/block-walk.js +89 -0
  72. package/dist/report-model/draft-finish.d.ts +60 -0
  73. package/dist/report-model/draft-finish.js +56 -0
  74. package/dist/report-model/draft-operations.d.ts +125 -0
  75. package/dist/report-model/draft-operations.js +341 -0
  76. package/dist/report-model/draft-read.d.ts +59 -0
  77. package/dist/report-model/draft-read.js +109 -0
  78. package/dist/report-model/draft.d.ts +51 -0
  79. package/dist/report-model/draft.js +32 -0
  80. package/dist/report-model/fixture-resolver.d.ts +8 -0
  81. package/dist/report-model/fixture-resolver.js +252 -0
  82. package/dist/report-model/pin-snapshot.d.ts +30 -0
  83. package/dist/report-model/pin-snapshot.js +40 -0
  84. package/dist/report-model/reference-resolver.d.ts +113 -0
  85. package/dist/report-model/reference-resolver.js +60 -0
  86. package/dist/report-model/structural-validation.d.ts +22 -0
  87. package/dist/report-model/structural-validation.js +68 -0
  88. package/dist/report-model/validate.d.ts +72 -0
  89. package/dist/report-model/validate.js +95 -0
  90. package/dist/report-render/chart.d.ts +33 -0
  91. package/dist/report-render/chart.js +538 -0
  92. package/dist/report-render/page.d.ts +127 -0
  93. package/dist/report-render/page.js +307 -0
  94. package/dist/report-render/references.d.ts +32 -0
  95. package/dist/report-render/references.js +44 -0
  96. package/dist/report-render/render.d.ts +25 -0
  97. package/dist/report-render/render.js +125 -0
  98. package/dist/report-render/script-json.d.ts +13 -0
  99. package/dist/report-render/script-json.js +15 -0
  100. package/dist/report-render/types.d.ts +39 -0
  101. package/dist/report-render/types.js +10 -0
  102. package/dist/report-render/value-bridge.d.ts +62 -0
  103. package/dist/report-render/value-bridge.js +82 -0
  104. package/dist/report-render/views/chart-view.d.ts +11 -0
  105. package/dist/report-render/views/chart-view.js +23 -0
  106. package/dist/report-render/views/page-view.d.ts +20 -0
  107. package/dist/report-render/views/page-view.js +49 -0
  108. package/dist/report-render/views/prose.d.ts +28 -0
  109. package/dist/report-render/views/prose.js +75 -0
  110. package/dist/report-render/views/references-view.d.ts +20 -0
  111. package/dist/report-render/views/references-view.js +64 -0
  112. package/dist/report-render/views/values.d.ts +42 -0
  113. package/dist/report-render/views/values.js +43 -0
  114. package/dist/runtime/assemble.d.ts +15 -0
  115. package/dist/runtime/assemble.js +28 -6
  116. package/dist/runtime/boot.d.ts +3 -3
  117. package/dist/runtime/boot.js +15 -4
  118. package/dist/runtime/dbos.d.ts +4 -4
  119. package/dist/state/artifacts.d.ts +16 -0
  120. package/dist/state/artifacts.js +18 -0
  121. package/dist/state/init.js +54 -0
  122. package/dist/state/purge-analysis.js +2 -0
  123. package/dist/state/report-session-state.d.ts +112 -0
  124. package/dist/state/report-session-state.js +150 -0
  125. package/dist/state/report-versions.d.ts +129 -0
  126. package/dist/state/report-versions.js +167 -0
  127. package/dist/state/snapshot-parse.d.ts +34 -0
  128. package/dist/state/snapshot-parse.js +82 -0
  129. package/dist/tasks/data-profile.js +1 -0
  130. package/dist/tools/ad-hoc-router.d.ts +7 -2
  131. package/dist/tools/ad-hoc-router.js +2 -1
  132. package/dist/tools/bio/chembl.js +1 -0
  133. package/dist/tools/bio/comptox.js +1 -0
  134. package/dist/tools/bio/drug-gene-interactions.js +1 -0
  135. package/dist/tools/bio/gene-disease-evidence.js +1 -0
  136. package/dist/tools/bio/gene-preclinical-profile.js +1 -0
  137. package/dist/tools/bio/keys.d.ts +3 -2
  138. package/dist/tools/bio/keys.js +3 -2
  139. package/dist/tools/bio/lookup-annotation.js +1 -0
  140. package/dist/tools/bio/opentargets.d.ts +3 -3
  141. package/dist/tools/bio/opentargets.js +4 -3
  142. package/dist/tools/bio/pubchem.js +1 -0
  143. package/dist/tools/bio/search-clinical-trials.js +1 -0
  144. package/dist/tools/bio/search-faers.js +1 -0
  145. package/dist/tools/bio/search-geo-datasets.js +1 -0
  146. package/dist/tools/bio/search-interactions.js +1 -0
  147. package/dist/tools/bio/target-safety.d.ts +4 -6
  148. package/dist/tools/bio/target-safety.js +7 -6
  149. package/dist/tools/define-tool.d.ts +19 -12
  150. package/dist/tools/define-tool.js +4 -2
  151. package/dist/tools/display/show-user.js +1 -0
  152. package/dist/tools/iterate-report.js +2 -0
  153. package/dist/tools/lib/chembl-client.d.ts +2 -0
  154. package/dist/tools/lib/chembl-client.js +1 -0
  155. package/dist/tools/lib/monarch-client.d.ts +42 -0
  156. package/dist/tools/lib/monarch-client.js +100 -0
  157. package/dist/tools/report/build-report.js +1 -0
  158. package/dist/tools/report/mint-preview-url.js +1 -0
  159. package/dist/tools/report/preview-snapshot.js +1 -0
  160. package/dist/tools/report/submit-report.js +1 -0
  161. package/dist/tools/report/version-fs.js +4 -0
  162. package/dist/tools/report-authoring/authoring-tools.d.ts +241 -0
  163. package/dist/tools/report-authoring/authoring-tools.js +460 -0
  164. package/dist/tools/report-session/index.d.ts +8 -0
  165. package/dist/tools/report-session/index.js +8 -0
  166. package/dist/tools/report-session/preview-report.d.ts +90 -0
  167. package/dist/tools/report-session/preview-report.js +245 -0
  168. package/dist/tools/research/context7-docs.js +2 -0
  169. package/dist/tools/research/generate-analogy-report.js +1 -0
  170. package/dist/tools/research/generate-plan.js +7 -2
  171. package/dist/tools/research/inspect-data-profile.js +4 -0
  172. package/dist/tools/research/literature-reviewer.js +1 -0
  173. package/dist/tools/research/search-arxiv.js +1 -0
  174. package/dist/tools/research/search-github-repos.js +1 -0
  175. package/dist/tools/research/search-semantic-scholar.js +1 -0
  176. package/dist/tools/sandbox/list-available-packages.js +23 -0
  177. package/dist/tools/sandbox/list-available-refs.js +36 -0
  178. package/dist/tools/sandbox/report-blocker.js +1 -0
  179. package/dist/tools/sandbox/skills.js +2 -0
  180. package/dist/tools/workspace/file-stat.js +1 -0
  181. package/dist/tools/workspace/show-file.js +2 -0
  182. package/dist/tools/workspace/show-plan.js +1 -0
  183. package/dist/workflows/execute-analysis.d.ts +5 -1
  184. package/dist/workflows/execute-analysis.js +5 -5
  185. package/dist/workflows/execute-target-assessment.d.ts +13 -2
  186. package/dist/workflows/execute-target-assessment.js +78 -16
  187. package/dist/workflows/target-assessment/assemblers/index.d.ts +1 -1
  188. package/dist/workflows/target-assessment/assemblers/index.js +1 -1
  189. package/dist/workflows/target-assessment/assemblers/literature.d.ts +9 -27
  190. package/dist/workflows/target-assessment/assemblers/literature.js +32 -48
  191. package/dist/workflows/target-assessment/assemblers/orchestrator.d.ts +17 -9
  192. package/dist/workflows/target-assessment/assemblers/orchestrator.js +195 -85
  193. package/dist/workflows/target-assessment/assemblers/safety.d.ts +70 -48
  194. package/dist/workflows/target-assessment/assemblers/safety.js +125 -42
  195. package/dist/workflows/target-assessment/collectors/index.d.ts +5 -2
  196. package/dist/workflows/target-assessment/collectors/index.js +48 -5
  197. package/dist/workflows/target-assessment/coverage.d.ts +43 -27
  198. package/dist/workflows/target-assessment/coverage.js +33 -29
  199. package/dist/workflows/target-assessment/fanout/index.js +1 -0
  200. package/dist/workflows/target-assessment/investigation/index.d.ts +97 -0
  201. package/dist/workflows/target-assessment/investigation/index.js +419 -0
  202. package/dist/workflows/target-assessment/lib/approval-precedents.d.ts +26 -5
  203. package/dist/workflows/target-assessment/lib/approval-precedents.js +95 -29
  204. package/dist/workflows/target-assessment/lib/citation-validator.js +1 -1
  205. package/dist/workflows/target-assessment/lib/clinical-consequence-annotator.d.ts +2 -2
  206. package/dist/workflows/target-assessment/lib/clinical-evidence-attribution.d.ts +2 -3
  207. package/dist/workflows/target-assessment/lib/clinical-evidence-attribution.js +0 -4
  208. package/dist/workflows/target-assessment/lib/compute-derived.d.ts +6 -5
  209. package/dist/workflows/target-assessment/lib/compute-derived.js +14 -5
  210. package/dist/workflows/target-assessment/lib/family-complex-supplement.d.ts +5 -6
  211. package/dist/workflows/target-assessment/lib/family-complex-supplement.js +2 -3
  212. package/dist/workflows/target-assessment/lib/fda-label-safety.d.ts +72 -0
  213. package/dist/workflows/target-assessment/lib/fda-label-safety.js +166 -0
  214. package/dist/workflows/target-assessment/lib/heterodimer-filter.d.ts +0 -9
  215. package/dist/workflows/target-assessment/lib/heterodimer-filter.js +0 -10
  216. package/dist/workflows/target-assessment/lib/hpo-organ-map.d.ts +34 -0
  217. package/dist/workflows/target-assessment/lib/hpo-organ-map.js +63 -0
  218. package/dist/workflows/target-assessment/lib/impc-organ-map.d.ts +19 -0
  219. package/dist/workflows/target-assessment/lib/impc-organ-map.js +39 -0
  220. package/dist/workflows/target-assessment/lib/meddra-organ-map.d.ts +24 -14
  221. package/dist/workflows/target-assessment/lib/meddra-organ-map.js +59 -47
  222. package/dist/workflows/target-assessment/lib/recommendation-sanitizer.js +1 -1
  223. package/dist/workflows/target-assessment/lib/regulatory-actions.d.ts +2 -3
  224. package/dist/workflows/target-assessment/lib/regulatory-actions.js +33 -4
  225. package/dist/workflows/target-assessment/lib/safety-corroboration.d.ts +44 -0
  226. package/dist/workflows/target-assessment/lib/safety-corroboration.js +273 -0
  227. package/dist/workflows/target-assessment/lib/target-identity-filter.d.ts +5 -7
  228. package/dist/workflows/target-assessment/lib/target-identity-filter.js +5 -7
  229. package/dist/workflows/target-assessment/metrics.d.ts +1 -6
  230. package/dist/workflows/target-assessment/metrics.js +1 -13
  231. package/dist/workflows/target-assessment/phase4-assemble.d.ts +2147 -807
  232. package/dist/workflows/target-assessment/phase4-assemble.js +19 -19
  233. package/dist/workflows/target-assessment/phase5-persist.d.ts +20 -21
  234. package/dist/workflows/target-assessment/phase5-persist.js +56 -173
  235. package/dist/workflows/target-assessment/schemas.d.ts +46 -1
  236. package/dist/workflows/target-assessment/schemas.js +19 -0
  237. package/dist/workflows/target-assessment/steps/fanout/polypharm-for-one-modulator-step.d.ts +1 -0
  238. package/dist/workflows/target-assessment/steps/fanout/polypharm-for-one-modulator-step.js +2 -0
  239. package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +26 -62
  240. package/dist/workflows/target-assessment/steps/phase2-aggregate.js +0 -4
  241. package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +27 -154
  242. package/dist/workflows/target-assessment/steps/phase3-aggregate.js +0 -6
  243. package/dist/workflows/target-assessment/steps/synthesis/diagnostics.d.ts +0 -6
  244. package/dist/workflows/target-assessment/steps/synthesis/diagnostics.js +0 -18
  245. package/dist/workflows/target-assessment/sub-workflows/per-modulator-polypharm.d.ts +1 -0
  246. package/dist/workflows/target-assessment/synthesis/index.d.ts +52 -5
  247. package/dist/workflows/target-assessment/synthesis/index.js +4 -1
  248. package/dist/workflows/target-assessment/synthesis-probes.d.ts +3 -3
  249. package/package.json +4 -1
@@ -19,6 +19,8 @@
19
19
  import type { AgentDefinition } from "../loop/types.js";
20
20
  import type { Tool } from "../tools/define-tool.js";
21
21
  export declare const REPORT_BUILDER_AGENT_ID = "report-builder";
22
+ /** Skill pack the report-builder prompt directs the model to read (design-system reference). */
23
+ export declare const REPORT_BUILDER_SKILLS: readonly ["report-html"];
22
24
  export interface CreateReportBuilderAgentDeps {
23
25
  /** Model id — provenance / metric label; the provider owns the wire model. */
24
26
  readonly model: string;
@@ -19,6 +19,8 @@
19
19
  import { reportBuilderPrompt } from "../prompts/report-builder.js";
20
20
  import { composeSystemPrompt } from "./system-prompt.js";
21
21
  export const REPORT_BUILDER_AGENT_ID = "report-builder";
22
+ /** Skill pack the report-builder prompt directs the model to read (design-system reference). */
23
+ export const REPORT_BUILDER_SKILLS = ["report-html"];
22
24
  /** Runaway guard — Jinja recovery may take several build/edit cycles. */
23
25
  const REPORT_BUILDER_MAX_ITERATIONS = 75;
24
26
  export function createReportBuilderAgent(deps) {
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The Report Builder agent -- the agent that talks to the user on a report thread.
3
+ *
4
+ * `createReportSessionAgent` is the composition root of the report path. It gets
5
+ * the shared deps one time, and it hands each tool exactly what it needs. The
6
+ * authoring tools and the preview tool bind to the session-state gateway, thus one
7
+ * assembled definition serves every thread, and the per-session state stays behind
8
+ * the tool boundary.
9
+ *
10
+ * The roster is read-only toward the analysis. It holds the workspace read tools,
11
+ * the workspace search, the run inspection, and the data-profile inspection. It
12
+ * holds no planner, no run launcher, no working-memory write, and no sandbox
13
+ * mutate surface. Thus no tool starts a run, and no tool changes an analysis. The
14
+ * roster omits those tools, and no runtime guard blocks them.
15
+ *
16
+ * The definition carries no per-session value. The system prompt composes through
17
+ * `composeSystemPrompt` with the identity part and the conversational part, the
18
+ * same composition as the conversation agent. Thus the prompt prefix stays constant
19
+ * across threads, and the provider cache reuses it.
20
+ */
21
+ import type { Pool } from "pg";
22
+ import type { AgentDefinition } from "../loop/types.js";
23
+ import type { EmbeddingProvider } from "../providers/types.js";
24
+ import type { WorkspaceFilesystem } from "../workspace/filesystem.js";
25
+ import type { ResolveWorkspaceRoot } from "../workspace/paths.js";
26
+ import type { Logger } from "../lib/logger.js";
27
+ import type { ReferenceResolver } from "../report-model/reference-resolver.js";
28
+ import type { ReportSessionStateGateway } from "../tools/report-authoring/authoring-tools.js";
29
+ /** Canonical agent id -- distinct from the id of the old templating agent. */
30
+ export declare const REPORT_SESSION_AGENT_ID: "report-session";
31
+ /**
32
+ * The shared dependencies of the report agent. The gateway binds the per-session
33
+ * state to the thread, thus every tool that touches the state gets the same
34
+ * gateway. The resolver is optional, because a resolver realization can be absent,
35
+ * and the preview tool degrades as data when it is.
36
+ */
37
+ export interface ReportSessionAgentDeps {
38
+ /** Model id -- the provenance and metric label. The provider owns the wire model. */
39
+ readonly model: string;
40
+ /** Postgres pool -- workspace index, run inspection, and data-profile inspection. */
41
+ readonly pool: Pool;
42
+ /** Embedding seam -- workspace semantic search. */
43
+ readonly embedding: EmbeddingProvider;
44
+ /** Workspace filesystem read seam -- the four read tools. */
45
+ readonly workspaceFs: WorkspaceFilesystem;
46
+ /** Session-state gateway -- the authoring tools and the preview tool bind to it. */
47
+ readonly gateway: ReportSessionStateGateway;
48
+ /** Workspace-root resolution seam -- the preview tool resolves the page root per call. */
49
+ readonly resolveWorkspaceRoot: ResolveWorkspaceRoot;
50
+ /** Reference-resolution seam -- absent until a realization lands; the preview tool degrades as data. */
51
+ readonly resolver?: ReferenceResolver;
52
+ /** Operational logging seam; omitted falls back to no-op. */
53
+ readonly logger?: Logger;
54
+ }
55
+ /** Build the report `AgentDefinition` with every tool bound to its deps. */
56
+ export declare function createReportSessionAgent(deps: ReportSessionAgentDeps): AgentDefinition;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The Report Builder agent -- the agent that talks to the user on a report thread.
3
+ *
4
+ * `createReportSessionAgent` is the composition root of the report path. It gets
5
+ * the shared deps one time, and it hands each tool exactly what it needs. The
6
+ * authoring tools and the preview tool bind to the session-state gateway, thus one
7
+ * assembled definition serves every thread, and the per-session state stays behind
8
+ * the tool boundary.
9
+ *
10
+ * The roster is read-only toward the analysis. It holds the workspace read tools,
11
+ * the workspace search, the run inspection, and the data-profile inspection. It
12
+ * holds no planner, no run launcher, no working-memory write, and no sandbox
13
+ * mutate surface. Thus no tool starts a run, and no tool changes an analysis. The
14
+ * roster omits those tools, and no runtime guard blocks them.
15
+ *
16
+ * The definition carries no per-session value. The system prompt composes through
17
+ * `composeSystemPrompt` with the identity part and the conversational part, the
18
+ * same composition as the conversation agent. Thus the prompt prefix stays constant
19
+ * across threads, and the provider cache reuses it.
20
+ */
21
+ import { createReportAuthoringTools } from "../tools/report-authoring/authoring-tools.js";
22
+ import { createPreviewReportTool } from "../tools/report-session/preview-report.js";
23
+ import { createFileStatTool, createGrepTool, createListFilesTool, createReadFileTool, createWorkspaceSearchTool } from "../tools/workspace/index.js";
24
+ import { createInspectDataProfileTool, createInspectRunTool } from "../tools/research/index.js";
25
+ import { reportSessionPrompt } from "../prompts/report-session.js";
26
+ import { composeSystemPrompt } from "./system-prompt.js";
27
+ /** Canonical agent id -- distinct from the id of the old templating agent. */
28
+ export const REPORT_SESSION_AGENT_ID = "report-session";
29
+ /**
30
+ * Runaway guard. A report turn drives many small tool calls, thus it needs the
31
+ * same headroom as the conversation agent.
32
+ */
33
+ const REPORT_SESSION_MAX_ITERATIONS = 50;
34
+ /** Build the report `AgentDefinition` with every tool bound to its deps. */
35
+ export function createReportSessionAgent(deps) {
36
+ const { model, pool, embedding, workspaceFs, gateway, resolveWorkspaceRoot, resolver, logger } = deps;
37
+ const authoring = createReportAuthoringTools(gateway);
38
+ const tools = [
39
+ // The read surface toward the analysis. It roams the tree read-only.
40
+ createReadFileTool(workspaceFs),
41
+ createListFilesTool(workspaceFs),
42
+ createFileStatTool(workspaceFs),
43
+ createGrepTool(workspaceFs),
44
+ createWorkspaceSearchTool(pool, embedding),
45
+ createInspectRunTool(pool),
46
+ createInspectDataProfileTool(pool),
47
+ // The composition surface. Each authoring tool binds to the gateway, thus
48
+ // two threads never share one draft.
49
+ authoring.add_block,
50
+ authoring.change_block,
51
+ authoring.remove_block,
52
+ authoring.move_block,
53
+ authoring.set_title,
54
+ authoring.read_outline,
55
+ authoring.read_block,
56
+ authoring.finish_draft,
57
+ // The render-and-preview tool. It resolves the page root per call.
58
+ createPreviewReportTool({
59
+ gateway,
60
+ resolveWorkspaceRoot,
61
+ ...(resolver ? { resolver } : {}),
62
+ ...(logger ? { logger } : {}),
63
+ }),
64
+ ];
65
+ return {
66
+ id: REPORT_SESSION_AGENT_ID,
67
+ systemPrompt: composeSystemPrompt(reportSessionPrompt, { identity: true, conversational: true }),
68
+ model,
69
+ tools,
70
+ maxIterations: REPORT_SESSION_MAX_ITERATIONS,
71
+ };
72
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The report session-state runtime -- the durable realization of the session-state
3
+ * gateway, and the idempotent operation that anchors one report session.
4
+ *
5
+ * The runtime binds three parts: the session-state store, the thread store, and
6
+ * the pin. The tool layer speaks the gateway, and the gateway speaks a plain
7
+ * discriminated value. Thus the neverthrow of the store stays inside this module,
8
+ * and it never crosses the tool boundary.
9
+ *
10
+ * `ensureSessionState` makes sure that the row of a thread exists. The first run
11
+ * resolves the analysis of the thread, pins the snapshot, and writes the row. A
12
+ * later run reads the row and pins nothing. The store insert-if-absent keeps two
13
+ * concurrent first runs to one row. A pin failure writes no row and returns as
14
+ * typed data, thus a later run pins again.
15
+ *
16
+ * The gateway `load` runs the same operation, thus a tool call never arrives
17
+ * before the state exists. A fresh row holds the snapshot and no document yet.
18
+ * Thus `load` gives the empty draft with the stored snapshot, because the pin
19
+ * writes the snapshot first and the document lands later.
20
+ *
21
+ * A store fault, an absent thread, and a pin failure each ride the failed arm
22
+ * with a short detail. The diagnostic goes to the injected `Logger`, never to the
23
+ * detail alone.
24
+ *
25
+ * The gateway load separates a permanent condition from a transient one. An absent
26
+ * thread and a wrong thread type are permanent, and a store or pin fault is
27
+ * transient. The persist is a compare-and-swap against the prior document that the
28
+ * load read, thus two concurrent turns cannot both land.
29
+ */
30
+ import type { Pool } from "pg";
31
+ import type { Logger } from "../lib/logger.js";
32
+ import { type ReportSessionState as StoredSessionState } from "../state/report-session-state.js";
33
+ import type { ReportSessionStateGateway } from "../tools/report-authoring/authoring-tools.js";
34
+ /**
35
+ * How a failed anchor ends. `absent-thread` and `wrong-thread-type` are permanent
36
+ * conditions, and `unavailable` is a transient store or pin fault. The gateway load
37
+ * carries the distinction, thus the tool tells a permanent refusal from a transient one.
38
+ */
39
+ export type EnsureFailureKind = "absent-thread" | "wrong-thread-type" | "unavailable";
40
+ /**
41
+ * The outcome of the anchor operation. `ready` carries the durable row, whose
42
+ * document is `null` until the first document lands. `failed` names the cause as a
43
+ * short detail and a kind, and the runtime logs the diagnostic beside it.
44
+ */
45
+ export type EnsureSessionStateResult = {
46
+ outcome: "ready";
47
+ state: StoredSessionState;
48
+ } | {
49
+ outcome: "failed";
50
+ kind: EnsureFailureKind;
51
+ detail: string;
52
+ };
53
+ export interface ReportSessionRuntimeDeps {
54
+ readonly pool: Pool;
55
+ readonly logger?: Logger;
56
+ }
57
+ /**
58
+ * The report session-state runtime. The gateway serves the authoring tools, and
59
+ * `ensureSessionState` anchors the session. The serving path of a report turn runs
60
+ * `ensureSessionState` at the turn start, and the gateway `load` runs it too, thus
61
+ * a tool call cannot arrive before the state exists.
62
+ */
63
+ export interface ReportSessionRuntime {
64
+ readonly gateway: ReportSessionStateGateway;
65
+ ensureSessionState(threadId: string): Promise<EnsureSessionStateResult>;
66
+ }
67
+ /**
68
+ * Build the report session-state runtime bound to a Postgres pool. The factory
69
+ * closure captures the pool and constructs the session-state store and the thread
70
+ * store from it, the same way the chat-turn preparation does.
71
+ */
72
+ export declare function createReportSessionRuntime(deps: ReportSessionRuntimeDeps): ReportSessionRuntime;
@@ -0,0 +1,157 @@
1
+ /**
2
+ * The report session-state runtime -- the durable realization of the session-state
3
+ * gateway, and the idempotent operation that anchors one report session.
4
+ *
5
+ * The runtime binds three parts: the session-state store, the thread store, and
6
+ * the pin. The tool layer speaks the gateway, and the gateway speaks a plain
7
+ * discriminated value. Thus the neverthrow of the store stays inside this module,
8
+ * and it never crosses the tool boundary.
9
+ *
10
+ * `ensureSessionState` makes sure that the row of a thread exists. The first run
11
+ * resolves the analysis of the thread, pins the snapshot, and writes the row. A
12
+ * later run reads the row and pins nothing. The store insert-if-absent keeps two
13
+ * concurrent first runs to one row. A pin failure writes no row and returns as
14
+ * typed data, thus a later run pins again.
15
+ *
16
+ * The gateway `load` runs the same operation, thus a tool call never arrives
17
+ * before the state exists. A fresh row holds the snapshot and no document yet.
18
+ * Thus `load` gives the empty draft with the stored snapshot, because the pin
19
+ * writes the snapshot first and the document lands later.
20
+ *
21
+ * A store fault, an absent thread, and a pin failure each ride the failed arm
22
+ * with a short detail. The diagnostic goes to the injected `Logger`, never to the
23
+ * detail alone.
24
+ *
25
+ * The gateway load separates a permanent condition from a transient one. An absent
26
+ * thread and a wrong thread type are permanent, and a store or pin fault is
27
+ * transient. The persist is a compare-and-swap against the prior document that the
28
+ * load read, thus two concurrent turns cannot both land.
29
+ */
30
+ import { createNoopLogger } from "../lib/console-logger.js";
31
+ import { describeDbError } from "../lib/db-result.js";
32
+ import { createThreadStore } from "../memory/thread-store.js";
33
+ import { pinReportSnapshot } from "../report-model/pin-snapshot.js";
34
+ import { createReportSessionStateStore } from "../state/report-session-state.js";
35
+ /** The empty draft of a fresh session. The pin writes the snapshot first, thus the document is empty here. */
36
+ const EMPTY_DRAFT = { title: "", sections: [] };
37
+ /**
38
+ * Build the report session-state runtime bound to a Postgres pool. The factory
39
+ * closure captures the pool and constructs the session-state store and the thread
40
+ * store from it, the same way the chat-turn preparation does.
41
+ */
42
+ export function createReportSessionRuntime(deps) {
43
+ const { pool } = deps;
44
+ const log = (deps.logger ?? createNoopLogger()).named("report-session-runtime");
45
+ const store = createReportSessionStateStore({ pool, logger: deps.logger });
46
+ const threads = createThreadStore(pool);
47
+ /**
48
+ * A store read or write fault, as a failed outcome. `corrupt_session_state`
49
+ * names the part that cannot parse. A `DbError` carries its cause to the log.
50
+ * The identifiers ride as structured fields, never in the message.
51
+ */
52
+ function storeFault(threadId, error) {
53
+ if (error.type === "corrupt_session_state") {
54
+ log.error("the stored session state cannot parse", { threadId, part: error.part });
55
+ return { outcome: "failed", kind: "unavailable", detail: `the stored ${error.part} of the session state cannot parse` };
56
+ }
57
+ log.error("the session-state store failed", { threadId, ...log.errorFields(error.cause) });
58
+ return { outcome: "failed", kind: "unavailable", detail: describeDbError(error) };
59
+ }
60
+ /**
61
+ * Pin the snapshot and write the row. A pin failure writes no row, thus a
62
+ * later run pins again. The write is insert-if-absent, thus two concurrent
63
+ * first runs make one row and both read the winner back.
64
+ */
65
+ async function pinAndWrite(threadId, analysisId) {
66
+ const pinned = await pinReportSnapshot(pool, analysisId);
67
+ if (pinned.isErr()) {
68
+ log.error("the snapshot pin failed", { threadId, analysisId, ...log.errorFields(pinned.error.cause) });
69
+ return { outcome: "failed", kind: "unavailable", detail: "the artifact ledger read failed" };
70
+ }
71
+ const written = await store.writeSnapshot({ threadId, analysisId, snapshot: pinned.value });
72
+ return written.match((row) => ({ outcome: "ready", state: row }), (error) => storeFault(threadId, error));
73
+ }
74
+ async function ensureSessionState(threadId) {
75
+ const read = await store.readState(threadId);
76
+ if (read.isErr()) {
77
+ return storeFault(threadId, read.error);
78
+ }
79
+ if (read.value !== null) {
80
+ // The row exists, thus the anchor holds and the pin stays single.
81
+ return { outcome: "ready", state: read.value };
82
+ }
83
+ const thread = await threads.getThread(threadId);
84
+ if (thread.isErr()) {
85
+ log.error("the thread read failed", { threadId, ...log.errorFields(thread.error.cause) });
86
+ return { outcome: "failed", kind: "unavailable", detail: describeDbError(thread.error) };
87
+ }
88
+ if (thread.value === null) {
89
+ // The pin needs the analysis of the thread. An absent thread names none, and
90
+ // the absence is a permanent condition.
91
+ log.error("the thread resolves to no analysis", { threadId });
92
+ return { outcome: "failed", kind: "absent-thread", detail: "the thread names no analysis" };
93
+ }
94
+ if (thread.value.threadType !== "report") {
95
+ // The session anchors a report thread only. A conversation thread carries no report session,
96
+ // thus a wrong type writes no row and the detail names the type. The wrong type is permanent.
97
+ log.error("the thread is not a report thread", { threadId, threadType: thread.value.threadType });
98
+ return { outcome: "failed", kind: "wrong-thread-type", detail: `the thread is a ${thread.value.threadType} thread, not a report thread` };
99
+ }
100
+ return pinAndWrite(threadId, thread.value.analysisId);
101
+ }
102
+ /**
103
+ * Map the durable row onto the gateway load. A fresh row holds the snapshot and
104
+ * no document, thus the load gives the empty draft. The found load carries the
105
+ * stored analysis and the prior document as the concurrency token. A row with no
106
+ * snapshot cannot serve a tool, because the pin writes the snapshot first.
107
+ */
108
+ function toLoad(state) {
109
+ if (state.snapshot === null) {
110
+ log.error("the session-state row holds no snapshot", { threadId: state.threadId });
111
+ return { outcome: "failed", detail: "the session state holds no snapshot" };
112
+ }
113
+ return {
114
+ outcome: "found",
115
+ state: { document: state.document ?? EMPTY_DRAFT, snapshot: state.snapshot },
116
+ analysisId: state.analysisId,
117
+ token: state.document,
118
+ };
119
+ }
120
+ const gateway = {
121
+ async load(threadId) {
122
+ const ensured = await ensureSessionState(threadId);
123
+ if (ensured.outcome === "failed") {
124
+ switch (ensured.kind) {
125
+ case "absent-thread":
126
+ return { outcome: "absent" };
127
+ case "wrong-thread-type":
128
+ return { outcome: "wrong-type", detail: ensured.detail };
129
+ case "unavailable":
130
+ return { outcome: "failed", detail: ensured.detail };
131
+ }
132
+ }
133
+ return toLoad(ensured.state);
134
+ },
135
+ async persist(threadId, document, expected) {
136
+ const result = await store.persistDocument({ threadId, document, expected });
137
+ return result.match((outcome) => {
138
+ switch (outcome) {
139
+ case "persisted":
140
+ return { outcome: "persisted" };
141
+ case "conflict":
142
+ // A concurrent turn landed first. The turn refuses and reads the state again.
143
+ return { outcome: "conflict" };
144
+ case "absent":
145
+ // The pin writes the row first. A persist that finds no row means the
146
+ // pin-first invariant broke.
147
+ log.error("the session-state persist matched no row", { threadId });
148
+ return { outcome: "failed", detail: "no report session state row exists to persist the document" };
149
+ }
150
+ }, (error) => {
151
+ log.error("the session-state persist failed", { threadId, ...log.errorFields(error.cause) });
152
+ return { outcome: "failed", detail: describeDbError(error) };
153
+ });
154
+ },
155
+ };
156
+ return { gateway, ensureSessionState };
157
+ }
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Report-session spawn — the host-agnostic operation that makes a `report`
3
+ * child thread from a conversation.
4
+ *
5
+ * The operation owns no table. It composes four reads and writes the store and
6
+ * the thread history already give: `getThread` for the parent, `latestSeq` for
7
+ * the anchor, `listThreads` for the count of report children, and
8
+ * `createThread` for the insert. The one storage read this capability adds,
9
+ * `latestSeq`, lives on the thread history, because that module owns the
10
+ * `messages` table.
11
+ *
12
+ * The reads and the insert take no lock and no transaction. A concurrent turn
13
+ * can append between the anchor read and the insert, and a retract can cut the
14
+ * parent's tail. A transaction cannot keep the parent still one turn later, so
15
+ * a lock buys no real guarantee. The anchor records the spawn point, and skew
16
+ * past the parent's current end is a normal state a reader expects.
17
+ *
18
+ * A conversation thread id comes from the host UI. But the spawn is a harness
19
+ * operation with no UI in front of it. Thus it mints a `randomUUID` and returns
20
+ * the full row. A managed deployment gets the same behavior with no host code.
21
+ */
22
+ import { type ResultAsync } from "neverthrow";
23
+ import type { Pool } from "pg";
24
+ import type { DbError } from "../lib/db-result.js";
25
+ import { type Thread, type ThreadInputError, type ThreadPage, type ThreadType } from "../memory/thread-store.js";
26
+ /**
27
+ * A spawn the operation refuses before it writes a row. Distinct from
28
+ * `DbError`: nothing failed at the driver — the parent names a session the
29
+ * spawn refuses, and each variant carries the identifiers that say which values
30
+ * disagreed.
31
+ *
32
+ * The set is closed. `parent_not_found` covers an absent parent and an archived
33
+ * one alike, because `getThread` filters the tombstone and a spawn into hidden
34
+ * state is not permitted. `parent_not_a_conversation` keeps the tree flat: a
35
+ * report session cannot spawn another. `empty_parent_transcript` refuses a
36
+ * report on a parent that holds no messages, because such a report reports
37
+ * nothing.
38
+ */
39
+ export type SpawnRefusal = {
40
+ readonly type: "parent_not_found";
41
+ readonly op: string;
42
+ readonly parentThreadId: string;
43
+ } | {
44
+ readonly type: "parent_not_a_conversation";
45
+ readonly op: string;
46
+ readonly parentThreadId: string;
47
+ readonly threadType: ThreadType;
48
+ } | {
49
+ readonly type: "empty_parent_transcript";
50
+ readonly op: string;
51
+ readonly parentThreadId: string;
52
+ };
53
+ /** The paging inputs `listReportSessions` forwards to the thread listing. */
54
+ export interface ReportSessionPaging {
55
+ readonly page?: number;
56
+ readonly perPage?: number;
57
+ }
58
+ export interface ReportSessionSpawnDeps {
59
+ readonly pool: Pool;
60
+ }
61
+ export interface ReportSessionSpawn {
62
+ /**
63
+ * Make a `report` child of the parent conversation and return the full row.
64
+ * The child takes the analysis of the parent, the parent thread id, and the
65
+ * anchor — the parent's latest `messages.seq` at this moment.
66
+ *
67
+ * Refused with a `SpawnRefusal`, no row written: an absent or archived
68
+ * parent, a parent that is not a conversation, and a parent with no
69
+ * messages. A store refusal (`DbError`, `ThreadInputError`) passes through
70
+ * unchanged.
71
+ */
72
+ spawnReportSession(parentThreadId: string): ResultAsync<Thread, SpawnRefusal | DbError | ThreadInputError>;
73
+ /**
74
+ * The report sessions of one analysis, through the thread listing narrowed
75
+ * to the type `report`. It adds no predicate of its own, so its answer and
76
+ * the thread listing cannot disagree.
77
+ */
78
+ listReportSessions(analysisId: string, paging?: ReportSessionPaging): ResultAsync<ThreadPage, DbError>;
79
+ }
80
+ /**
81
+ * Build the report-session operations bound to a Postgres pool. The factory
82
+ * closure captures `pool` and constructs the store and the thread history from
83
+ * it, the same way the chat-turn preparation does.
84
+ */
85
+ export declare function createReportSessionSpawn(deps: ReportSessionSpawnDeps): ReportSessionSpawn;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Report-session spawn — the host-agnostic operation that makes a `report`
3
+ * child thread from a conversation.
4
+ *
5
+ * The operation owns no table. It composes four reads and writes the store and
6
+ * the thread history already give: `getThread` for the parent, `latestSeq` for
7
+ * the anchor, `listThreads` for the count of report children, and
8
+ * `createThread` for the insert. The one storage read this capability adds,
9
+ * `latestSeq`, lives on the thread history, because that module owns the
10
+ * `messages` table.
11
+ *
12
+ * The reads and the insert take no lock and no transaction. A concurrent turn
13
+ * can append between the anchor read and the insert, and a retract can cut the
14
+ * parent's tail. A transaction cannot keep the parent still one turn later, so
15
+ * a lock buys no real guarantee. The anchor records the spawn point, and skew
16
+ * past the parent's current end is a normal state a reader expects.
17
+ *
18
+ * A conversation thread id comes from the host UI. But the spawn is a harness
19
+ * operation with no UI in front of it. Thus it mints a `randomUUID` and returns
20
+ * the full row. A managed deployment gets the same behavior with no host code.
21
+ */
22
+ import { randomUUID } from "node:crypto";
23
+ import { errAsync } from "neverthrow";
24
+ import { createThreadHistory } from "../memory/thread-history.js";
25
+ import { createThreadStore } from "../memory/thread-store.js";
26
+ const _assertDomainError = true;
27
+ const OP = "spawn-report-session";
28
+ /**
29
+ * Compose the child title. N counts the existing report children of the parent
30
+ * plus one. A parent with no title yields `Report N` alone, because the seed of
31
+ * the parent title is best-effort and can be absent.
32
+ */
33
+ function composeTitle(parentTitle, n) {
34
+ const suffix = `Report ${n}`;
35
+ return parentTitle && parentTitle.length > 0 ? `${parentTitle} — ${suffix}` : suffix;
36
+ }
37
+ /**
38
+ * Build the report-session operations bound to a Postgres pool. The factory
39
+ * closure captures `pool` and constructs the store and the thread history from
40
+ * it, the same way the chat-turn preparation does.
41
+ */
42
+ export function createReportSessionSpawn(deps) {
43
+ const { pool } = deps;
44
+ const store = createThreadStore(pool);
45
+ const history = createThreadHistory(pool);
46
+ function spawnReportSession(parentThreadId) {
47
+ return store.getThread(parentThreadId).andThen((parent) => {
48
+ // An absent parent and an archived one arrive the same way — `getThread`
49
+ // filters the tombstone — and both refuse as `parent_not_found`.
50
+ if (parent === null) {
51
+ return errAsync({ type: "parent_not_found", op: OP, parentThreadId });
52
+ }
53
+ // The tree stays flat: only a conversation spawns a report.
54
+ if (parent.threadType !== "conversation") {
55
+ return errAsync({ type: "parent_not_a_conversation", op: OP, parentThreadId, threadType: parent.threadType });
56
+ }
57
+ return history.latestSeq(parentThreadId).andThen((anchor) => {
58
+ // `null` is a parent with no messages. A report on an empty transcript
59
+ // reports nothing, so the refusal is the correct answer.
60
+ if (anchor === null) {
61
+ return errAsync({ type: "empty_parent_transcript", op: OP, parentThreadId });
62
+ }
63
+ // `total`, not the page length: N counts every existing report child,
64
+ // not the count on one page. Two concurrent spawns can compose one N.
65
+ // The result is two titles a user renames, and no identifier collides.
66
+ return store
67
+ .listThreads({ analysisId: parent.analysisId, type: "report", parentThreadId })
68
+ .andThen((children) => store.createThread({
69
+ threadId: randomUUID(),
70
+ analysisId: parent.analysisId,
71
+ title: composeTitle(parent.title, children.total + 1),
72
+ type: "report",
73
+ parentThreadId,
74
+ parentSeq: anchor,
75
+ }));
76
+ });
77
+ });
78
+ }
79
+ function listReportSessions(analysisId, paging = {}) {
80
+ return store.listThreads({ analysisId, type: "report", ...paging });
81
+ }
82
+ return { spawnReportSession, listReportSessions };
83
+ }
@@ -84,6 +84,15 @@ export interface ToolFinishedEvent {
84
84
  outcome: ToolOutcome;
85
85
  /** The same detail the matching `tool-started` carried. */
86
86
  detail?: ToolCallDetail;
87
+ /**
88
+ * The time in milliseconds around this call's own dispatch. Absent — never
89
+ * zero — when the harness took no measurement.
90
+ *
91
+ * A host must read it as `event.durationMs ?? (its own bracket)`. The bracket
92
+ * of a host spans the whole round, because the loop emits every start before
93
+ * it dispatches anything. Thus the fallback is correct only for one call.
94
+ */
95
+ durationMs?: number;
87
96
  source: EventSource;
88
97
  }
89
98
  /**
@@ -1,3 +1,7 @@
1
+ export { ORGAN_SYSTEMS, OrganSystemSchema, ORGAN_SYSTEM_LABELS, organSystemLabel } from "./organ-system.js";
2
+ export type { OrganSystem } from "./organ-system.js";
3
+ export { SEVERITIES, SeveritySchema } from "./severity.js";
4
+ export type { Severity } from "./severity.js";
1
5
  export type { PlanStep, PresentationContent, PresentationPart, PlanPart, RunCardPart, FileReferenceEntry, FileReferencePart, AskPart, RunStartedPart, StepStatus, DagStepState, DagStatePart, StepPhase, StepActivityPart, FileTreeEntry, StepFileTreePart, StepOutputFile, StepOutputPart, StepSummaryPart, StepUsagePart, StepBlockedPart, SynthesizedFinding, BiologicalTheme, RunSynthesisPart, SynthesisPhase, SynthesisProgressPart, RunCompletedFinding, RunCompletedPart, RunFailedPart, PreviewPart, DataPreviewFailedPart, CortexChatPart, } from "./chat-parts.js";
2
6
  export type { EventSource, TextDeltaEvent, ToolStartedEvent, ToolFinishedEvent, FinishEvent, ChatErrorEvent, CortexChatEvent } from "./chat-events.js";
3
7
  export type { TokenUsageRollup } from "./usage.js";
@@ -7,8 +11,8 @@ export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./part
7
11
  export type { CortexChatPartType, PartDescriptor, PartEmitter, PartConsumer } from "./part-registry.js";
8
12
  export { AnalogyCoverageSchema, AnalogyReportSchema, AnalogyReportErrorSchema, AnalogicalReasonerOutputSchema } from "./analogy-report.js";
9
13
  export type { AnalogyCoverage, AnalogyReport, AnalogyReportError, AnalogicalReasonerOutput } from "./analogy-report.js";
10
- export { CoverageSchema, EntitySchema, SummarySchema, LiabilitySummarySchema, TractabilitySchema, IndicationsSchema, DrugInteractionsSchema, ClinicalDevelopmentSchema, SafetyProfileSchema, OffTissueRiskSchema, EvidenceConflictsSchema, EvidenceTimelineSchema, TranslationalChainSchema, AdditionalEvidenceSchema, DiscoveryTrialsSchema, DossierSchema, DossierSchemaV3Legacy, DossierV4Schema, DossierV5Schema, DossierV5BodySchema, ClinicalTrialAttributionV5Schema, ClinicalDevelopmentV5Schema, RegulatoryActionRowV5Schema, QualityGateStatusSchema, QualityGatesSchema, LiabilitySummaryV4Schema, ClinicalDevelopmentV4Schema, SafetyProfileV4Schema, OrganRiskRowV4Schema, ReferenceBiologyV4Shape, isDossier, dossierJsonSchema, SECTION_BLURBS, TargetAssessmentPhaseSchema, TargetAssessmentProgressEventSchema, } from "./target-dossier.js";
11
- export type { Coverage, Entity, Summary, LiabilitySummary, TractabilitySection, EvidenceItem, Dossier, DossierV4, DossierV5, DossierV5Body, ClinicalTrialAttributionV5, ClinicalTrialRowV5, FailedTrialRowV5, TrialOutcomeRowV5, RegulatoryActionRowV5, QualityGateStatus, QualityGates, SectionBlurbKey, TargetAssessmentPhase, TargetAssessmentProgressEvent, } from "./target-dossier.js";
14
+ export { CoverageSchema, RowCoverageSchema, EntitySchema, ClaimSupportSchema, ClaimEvidenceSchema, LiabilityBulletSchema, LiabilitySummarySchema, TractabilitySchema, IndicationsSchema, DrugInteractionsSchema, ClinicalTrialAttributionSchema, ClinicalDevelopmentSchema, OrganRiskRowSchema, OffTargetRowSchema, OffTargetPanelSchema, RegulatoryActionRowSchema, SafetyFlagSchema, SafetyProfileSchema, OffTissueRowSchema, OffTissueRiskSchema, ReferenceBiologyShape, EvidenceConflictsSchema, EvidenceTimelineSchema, TranslationalChainSchema, AdditionalEvidenceSchema, DiscoveryTrialsSchema, QualityGateStatusSchema, QualityGatesSchema, DerivedSchema, DossierSchema, DossierBodySchema, isDossier, dossierJsonSchema, SECTION_BLURBS, TargetAssessmentPhaseSchema, TargetAssessmentProgressEventSchema, } from "./target-dossier.js";
15
+ export type { Coverage, RowCoverage, Entity, EvidenceItem, ClaimSupport, ClaimEvidence, LiabilityBullet, LiabilitySummary, TractabilitySection, ClinicalTrialAttribution, ClinicalTrialRow, ClinicalDevelopment, FailedTrialRow, TrialOutcomeRow, OrganRiskRow, OffTargetRow, RegulatoryActionRow, SafetyFlag, SafetyProfile, OffTissueRow, QualityGateStatus, QualityGates, Derived, Dossier, DossierBody, SectionBlurbKey, TargetAssessmentPhase, TargetAssessmentProgressEvent, } from "./target-dossier.js";
12
16
  export { TargetAssessmentStatusSchema, TargetAssessmentErrorSchema, TargetAssessmentListRowSchema, TargetAssessmentRowSchema, } from "./target-assessment-row.js";
13
17
  export type { TargetAssessmentStatus, TargetAssessmentError, TargetAssessmentListRow, TargetAssessmentRow } from "./target-assessment-row.js";
14
18
  export { buildPreviewUrl, previewResourceId } from "./content-url.js";
@@ -1,6 +1,8 @@
1
+ export { ORGAN_SYSTEMS, OrganSystemSchema, ORGAN_SYSTEM_LABELS, organSystemLabel } from "./organ-system.js";
2
+ export { SEVERITIES, SeveritySchema } from "./severity.js";
1
3
  export { DATA_PROFILE_RUN_LITERAL } from "./data-profile.js";
2
4
  export { PART_REGISTRY, isTransient, isReconciling, isSidebarPart } from "./part-registry.js";
3
5
  export { AnalogyCoverageSchema, AnalogyReportSchema, AnalogyReportErrorSchema, AnalogicalReasonerOutputSchema } from "./analogy-report.js";
4
- export { CoverageSchema, EntitySchema, SummarySchema, LiabilitySummarySchema, TractabilitySchema, IndicationsSchema, DrugInteractionsSchema, ClinicalDevelopmentSchema, SafetyProfileSchema, OffTissueRiskSchema, EvidenceConflictsSchema, EvidenceTimelineSchema, TranslationalChainSchema, AdditionalEvidenceSchema, DiscoveryTrialsSchema, DossierSchema, DossierSchemaV3Legacy, DossierV4Schema, DossierV5Schema, DossierV5BodySchema, ClinicalTrialAttributionV5Schema, ClinicalDevelopmentV5Schema, RegulatoryActionRowV5Schema, QualityGateStatusSchema, QualityGatesSchema, LiabilitySummaryV4Schema, ClinicalDevelopmentV4Schema, SafetyProfileV4Schema, OrganRiskRowV4Schema, ReferenceBiologyV4Shape, isDossier, dossierJsonSchema, SECTION_BLURBS, TargetAssessmentPhaseSchema, TargetAssessmentProgressEventSchema, } from "./target-dossier.js";
6
+ export { CoverageSchema, RowCoverageSchema, EntitySchema, ClaimSupportSchema, ClaimEvidenceSchema, LiabilityBulletSchema, LiabilitySummarySchema, TractabilitySchema, IndicationsSchema, DrugInteractionsSchema, ClinicalTrialAttributionSchema, ClinicalDevelopmentSchema, OrganRiskRowSchema, OffTargetRowSchema, OffTargetPanelSchema, RegulatoryActionRowSchema, SafetyFlagSchema, SafetyProfileSchema, OffTissueRowSchema, OffTissueRiskSchema, ReferenceBiologyShape, EvidenceConflictsSchema, EvidenceTimelineSchema, TranslationalChainSchema, AdditionalEvidenceSchema, DiscoveryTrialsSchema, QualityGateStatusSchema, QualityGatesSchema, DerivedSchema, DossierSchema, DossierBodySchema, isDossier, dossierJsonSchema, SECTION_BLURBS, TargetAssessmentPhaseSchema, TargetAssessmentProgressEventSchema, } from "./target-dossier.js";
5
7
  export { TargetAssessmentStatusSchema, TargetAssessmentErrorSchema, TargetAssessmentListRowSchema, TargetAssessmentRowSchema, } from "./target-assessment-row.js";
6
8
  export { buildPreviewUrl, previewResourceId } from "./content-url.js";