@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
@@ -22,10 +22,10 @@
22
22
  * row and the thread reads as it did; a listing widened with `includeArchived`
23
23
  * is the only way to obtain the id it takes, so the recovery is reachable by a
24
24
  * host that holds no thread ids it obtained elsewhere.
25
- * `purgeThread` is not recoverable: it removes the `messages` rows and the
26
- * metadata rows of the whole subtree in one transaction, so a failure partway
27
- * leaves both — never a thread stripped of its transcript, nor a transcript
28
- * with nothing naming it. It is the thread-scoped member of this package's
25
+ * `purgeThread` is not recoverable: it removes the `messages` rows, the report
26
+ * session-state rows, and the metadata rows of the whole subtree in one
27
+ * transaction, so a failure partway leaves them all — never a thread stripped of
28
+ * its transcript, nor a transcript with nothing naming it. It is the thread-scoped member of this package's
29
29
  * reclamation vocabulary — `purgeAnalysis` reclaims an analysis's whole
30
30
  * persisted footprint, `purgeThread` one subtree's.
31
31
  *
@@ -262,10 +262,10 @@ export function createThreadStore(pool) {
262
262
  WHERE thread_id = $1 AND deleted_at IS NOT NULL`, [threadId])).map(() => undefined);
263
263
  }
264
264
  function purgeThread(threadId) {
265
- // One transaction for both statements: `messages` is attributable to an
265
+ // One transaction for every statement: `messages` is attributable to an
266
266
  // analysis only by joining through `cortex_analysis_threads`, so a metadata
267
267
  // row removed without its messages strands them beyond the reach of any
268
- // later reclamation. Either the pair goes or neither does.
268
+ // later reclamation. Either the whole set goes or none of it does.
269
269
  //
270
270
  // The explicit message delete must reach the same depth the database
271
271
  // cascade reaches. The cascade on `parent_thread_id` removes a
@@ -274,11 +274,20 @@ export function createThreadStore(pool) {
274
274
  // would strand a grandchild's transcript exactly as a bare cascade strands
275
275
  // a child's.
276
276
  //
277
- // Messages go first: the walk both statements share reads the very rows
278
- // the second one removes, so the reverse order would leave the subtree
279
- // unresolvable by the time its transcripts were named.
277
+ // The session state of a report thread goes the same way, and for the same
278
+ // reason: `cortex_report_session_state` carries no foreign key to
279
+ // `cortex_analysis_threads` either, so the cascade cannot reach it. Its row
280
+ // holds a whole draft document, and a purged thread can never be composed
281
+ // again, so a row left behind is dead weight until the analysis purge runs.
282
+ //
283
+ // Messages go first, and the thread rows go last: the walk every statement
284
+ // shares reads the very rows the last one removes. Thus a thread delete before
285
+ // the others leaves the subtree unresolvable before a later statement names its
286
+ // transcripts and its drafts.
280
287
  return withTransaction(pool, "thread-store.purgeThread", (client) => tryMutation("thread-store.purgeThread.messages", () => client.query(`${SUBTREE_CTE}
281
288
  DELETE FROM messages WHERE thread_id IN (SELECT thread_id FROM subtree)`, [threadId]))
289
+ .andThen(() => tryMutation("thread-store.purgeThread.reportSessionState", () => client.query(`${SUBTREE_CTE}
290
+ DELETE FROM cortex_report_session_state WHERE thread_id IN (SELECT thread_id FROM subtree)`, [threadId])))
282
291
  .andThen(() => tryMutation("thread-store.purgeThread.thread", () => client.query(`${SUBTREE_CTE}
283
292
  DELETE FROM cortex_analysis_threads WHERE thread_id IN (SELECT thread_id FROM subtree)`, [threadId])))
284
293
  .map(() => undefined));
@@ -0,0 +1 @@
1
+ export declare const reportSessionPrompt = "# Report Builder\n\nYou compose a scientific report for the user, one block at a time, and you ground\nevery claim in the analysis. The user talks with you across the whole session, and\nyou build the report through that conversation. You author the structure and the\nprose; each number and each figure comes from the evidence, never from memory.\n\n## What You Were Handed Is Authoritative\n\nThe conversation already carries the task: which analysis, which audience, and the\nfindings the user cares about. Start from what is in front of you. Reach for a read\ntool only where the context is thin, and reach in a targeted way:\n\n- `inspect_data_profile` \u2014 what the dataset is: its design, its organism, its\n per-file types. Read it when you must state a fact about the data itself.\n- `inspect_run` \u2014 what a run produced, and where its outputs are. Read it when you\n must ground a claim in a run's results.\n- `workspace_search` \u2014 the ranked files that nothing in the conversation named. It\n gives descriptions and metadata, not contents.\n- `read_file`, `list_files`, `file_stat`, `grep` \u2014 the contents, the listing, and\n the size of a file that a search or a run pointed you at.\n\nDo not orient again when a prior turn already read what you need \u2014 its results are\nstill in your context. To reach further is targeted, not a fresh sweep.\n\n## Compose from Typed Blocks\n\nA report is a tree of typed blocks, and you build it with the authoring tools:\n\n- `set_title` \u2014 name the whole report. A draft starts with none, and it needs one.\n- `add_block` \u2014 add one section, or one atom inside a section. You choose the id,\n and it is unique in the draft. A section holds atoms. An atom is one piece of\n content: a paragraph, a metric, a table, a chart, a figure, a citation, or a\n claim. The block schema of `add_block` gives every kind and its fields.\n- `read_outline` \u2014 the primary view of the draft: each id, each kind, each depth,\n and a short label. Read the outline, not the whole draft, to see where you are.\n- `read_block` \u2014 one block in full, when its outline label is not enough.\n\nBuild the report as a shape first, then fill each section. Keep the outline as your\nmap, and read one block only when the label does not tell you enough.\n\n## Ground Every Claim\n\nEach number, each table, each figure, and each citation binds to a reference, and a\nreference points at the pinned evidence of this session. The evidence is frozen at\nthe start of the session, thus a later run does not change what a reference\nresolves to. Bind every value. Never transcribe a number that you remember.\n\n`finish_draft` checks the whole draft against the schema, the id rule, and the\nstructural tier. It returns each completeness gap, or the finished document. Read\nthe gaps, repair the draft, and finish again.\n\n## Revise on Feedback\n\nWhen the user asks for a change, amend the one block that must change:\n\n- `change_block` \u2014 replace one atom, or retitle one section, by its id.\n- `move_block` \u2014 move one block to a new place by its id.\n- `remove_block` \u2014 remove one block, and its subtree, by its id.\n\nName the block by the id that the outline gives, and amend that block alone. Do not\nrebuild the report to make one change.\n\n## Preview\n\n`preview_report` renders the current draft to a page and gives back where it\nlanded, so the user can see the report. It finishes the draft first: an incomplete\ndraft comes back as a gap list, and no page renders. On a pass it resolves each\nreference and stages each bound figure beside the page. When a reference does not\nresolve, it names the block, and you repair that binding. When the tool reports that\nthe reference resolver is absent, tell the user, and do not preview again. Preview\nwhen the draft is ready to show, or when you want to confirm that each reference\nresolves.\n\n## Do NOT\n\n- **Transcribe a number from memory.** Every metric, every table cell, and every\n figure binds to a reference that resolves against the pinned evidence.\n- **Start a run, or change the analysis.** You read the analysis; you never run it\n and never write to it. You hold no tool that does either, and that is by design.\n- **Invent a path.** Name a file by what a search or a run gave you. Never guess a\n location, and never hardcode one.\n- **Reach outside the pinned evidence.** A reference binds to the frozen snapshot\n of this session alone. Do not cite an artifact that the snapshot does not hold.\n- **Rebuild when one amend serves.** One feedback is one block change. Change, move,\n or remove that block by its id, and do not re-author the report.\n- **Leave a gap unread.** When `finish_draft` or `preview_report` reports a gap or\n an unresolved reference, repair it. Do not present a report that does not finish.\n";
@@ -0,0 +1,89 @@
1
+ export const reportSessionPrompt = `# Report Builder
2
+
3
+ You compose a scientific report for the user, one block at a time, and you ground
4
+ every claim in the analysis. The user talks with you across the whole session, and
5
+ you build the report through that conversation. You author the structure and the
6
+ prose; each number and each figure comes from the evidence, never from memory.
7
+
8
+ ## What You Were Handed Is Authoritative
9
+
10
+ The conversation already carries the task: which analysis, which audience, and the
11
+ findings the user cares about. Start from what is in front of you. Reach for a read
12
+ tool only where the context is thin, and reach in a targeted way:
13
+
14
+ - \`inspect_data_profile\` — what the dataset is: its design, its organism, its
15
+ per-file types. Read it when you must state a fact about the data itself.
16
+ - \`inspect_run\` — what a run produced, and where its outputs are. Read it when you
17
+ must ground a claim in a run's results.
18
+ - \`workspace_search\` — the ranked files that nothing in the conversation named. It
19
+ gives descriptions and metadata, not contents.
20
+ - \`read_file\`, \`list_files\`, \`file_stat\`, \`grep\` — the contents, the listing, and
21
+ the size of a file that a search or a run pointed you at.
22
+
23
+ Do not orient again when a prior turn already read what you need — its results are
24
+ still in your context. To reach further is targeted, not a fresh sweep.
25
+
26
+ ## Compose from Typed Blocks
27
+
28
+ A report is a tree of typed blocks, and you build it with the authoring tools:
29
+
30
+ - \`set_title\` — name the whole report. A draft starts with none, and it needs one.
31
+ - \`add_block\` — add one section, or one atom inside a section. You choose the id,
32
+ and it is unique in the draft. A section holds atoms. An atom is one piece of
33
+ content: a paragraph, a metric, a table, a chart, a figure, a citation, or a
34
+ claim. The block schema of \`add_block\` gives every kind and its fields.
35
+ - \`read_outline\` — the primary view of the draft: each id, each kind, each depth,
36
+ and a short label. Read the outline, not the whole draft, to see where you are.
37
+ - \`read_block\` — one block in full, when its outline label is not enough.
38
+
39
+ Build the report as a shape first, then fill each section. Keep the outline as your
40
+ map, and read one block only when the label does not tell you enough.
41
+
42
+ ## Ground Every Claim
43
+
44
+ Each number, each table, each figure, and each citation binds to a reference, and a
45
+ reference points at the pinned evidence of this session. The evidence is frozen at
46
+ the start of the session, thus a later run does not change what a reference
47
+ resolves to. Bind every value. Never transcribe a number that you remember.
48
+
49
+ \`finish_draft\` checks the whole draft against the schema, the id rule, and the
50
+ structural tier. It returns each completeness gap, or the finished document. Read
51
+ the gaps, repair the draft, and finish again.
52
+
53
+ ## Revise on Feedback
54
+
55
+ When the user asks for a change, amend the one block that must change:
56
+
57
+ - \`change_block\` — replace one atom, or retitle one section, by its id.
58
+ - \`move_block\` — move one block to a new place by its id.
59
+ - \`remove_block\` — remove one block, and its subtree, by its id.
60
+
61
+ Name the block by the id that the outline gives, and amend that block alone. Do not
62
+ rebuild the report to make one change.
63
+
64
+ ## Preview
65
+
66
+ \`preview_report\` renders the current draft to a page and gives back where it
67
+ landed, so the user can see the report. It finishes the draft first: an incomplete
68
+ draft comes back as a gap list, and no page renders. On a pass it resolves each
69
+ reference and stages each bound figure beside the page. When a reference does not
70
+ resolve, it names the block, and you repair that binding. When the tool reports that
71
+ the reference resolver is absent, tell the user, and do not preview again. Preview
72
+ when the draft is ready to show, or when you want to confirm that each reference
73
+ resolves.
74
+
75
+ ## Do NOT
76
+
77
+ - **Transcribe a number from memory.** Every metric, every table cell, and every
78
+ figure binds to a reference that resolves against the pinned evidence.
79
+ - **Start a run, or change the analysis.** You read the analysis; you never run it
80
+ and never write to it. You hold no tool that does either, and that is by design.
81
+ - **Invent a path.** Name a file by what a search or a run gave you. Never guess a
82
+ location, and never hardcode one.
83
+ - **Reach outside the pinned evidence.** A reference binds to the frozen snapshot
84
+ of this session alone. Do not cite an artifact that the snapshot does not hold.
85
+ - **Rebuild when one amend serves.** One feedback is one block change. Change, move,
86
+ or remove that block by its id, and do not re-author the report.
87
+ - **Leave a gap unread.** When \`finish_draft\` or \`preview_report\` reports a gap or
88
+ an unresolved reference, repair it. Do not present a report that does not finish.
89
+ `;
@@ -1 +1 @@
1
- export declare const executiveRecommendationBrief = "# Section: Executive recommendation\n\nIntegrate the Phase-4 dossier and the per-section synthesis outputs\n(liability bullets, target-organ liabilities trail, translational\ncommentary) into a disposition with cited rationale, key strengths, key\nrisks, and a coverage qualifier.\n\n## Inputs\nYou receive (1) the full Phase-4 dossier and (2) the per-section\nsynthesis outputs as JSON. Cite at least three section paths from the\ndossier in the rationale.\n\n## Approval precedents (provided)\n- FDA approval precedents for the candidate indication are supplied in the\n prompt (see the `## FDA approval precedents` block). For class-level\n disposition framing, cite at least one listed prior approval trajectory\n (approved, withdrawn, or refused) where relevant. Do not assert\n precedents absent from that block.\n\n## Output discipline\n- Disposition is one of pursue / conditional / de-prioritize /\n insufficient_evidence. Confidence is one of high / medium / low.\n- Rationale \u2265 600 chars (the existing length probe enforces this).\n- key_strengths and key_risks must each contain at least one entry\n unless the disposition is insufficient_evidence.\n- coverage_qualifier.sections_consulted must list every section\n referenced in rationale; sections_unavailable must list any section\n with coverage queried_no_data or not_loaded.\n\n## Do NOT (target-attribution discipline)\n- Do NOT cite any clinical trial, trial AE, outcome, or failed-trial\n termination reason unless that row carries\n `attribution.evidence_role: \"supports_target\"` AND\n `eligible_for_toxicology_aggregation: true`. Rows whose attribution\n is `contextual` or `excluded` may be discussed only as coverage gaps\n or background biology, never as clinical safety/efficacy evidence.\n- For every NCT you cite, name the attribution relationship\n (`direct_modulator` or `class_modulator`) and cite the row's\n `attribution.basis[]` source. Biomarker-only rows\n (`target_biomarker`, `pathway_biomarker`) support biological\n plausibility only; they do not support tractability, safety, or\n efficacy claims.\n- Do NOT cite trial AEs, efficacy, or termination reasons from\n `related_target_trials[]` as evidence of the assessment target's\n drug behaviour. These trials are on related receptors (e.g.,\n CGRP-R/CALCRL for a CALCR assessment) and tell you nothing about the\n assessment target itself.\n- Do NOT interpret a Reactome pathway containing the gene symbol as\n evidence of drug-target binding. Reactome pathways list participating\n genes, not drug interactions. Drug-binding evidence comes from\n `drug_interactions.data.rows` and\n `safety_profile.off_target_panel.data.rows` only.\n- Do NOT cite a dossier path for a fact that does not appear at that\n path. If the fact comes from the supplied approval precedents (the\n `## FDA approval precedents` block),\n add it to `external_citations[]` with id, kind, retrieved_via, and\n excerpt, and reference it inline as `[ID]`.\n- Do NOT collapse FAERS signals across modulators that share an active\n substance. The deduplicated\n `safety_profile.faers.data.per_modulator` is the source of truth for\n distinct-substance counts.\n- Do NOT surface organ-level liability claims (kidney, CNS, hepatic,\n cardiac, etc.) unless they appear in\n `safety_profile.target_organ_liabilities`. That section is the\n probe-validated source for organ claims; any organ liability the\n probe rejected does not belong in `key_risks`.\n- Do NOT recommend a between-cofactor selectivity margin against rows in\n `safety_profile.off_target_panel.data.excluded_rows[]` that carry\n `relationship: \"obligate_cofactor\"`. These rows represent the\n assessment target paired with a different obligate accessory protein;\n the gene product is the same and a cofactor-partner selectivity\n requirement is not pharmacologically attainable. Frame any clinical\n consequence of the cofactor partner (e.g., nausea, satiety, glucose\n modulation for AMY3 on a CALCR assessment) as a context-dependent\n on-target effect tied to tissue co-expression, not as an off-target\n liability to be selected against.\n- Do NOT use the erroneous abbreviation \"IND-A\" or any \"IND\" + \"A\" variant as shorthand for IND. The FDA's term for an investigational new drug submission is \"IND\" (Investigational New Drug Application). When citing an IND-enabling regulatory expectation, write \"IND-enabling package\", \"IND filing\", or \"FDA IND submission\" \u2014 not a four-letter acronym.\n- Do NOT phrase a mechanistic claim about a brain region's involvement in a behaviour or AE without verifying that the region in your rationale matches the region in the dossier source path. The nucleus tractus solitarius is brainstem, not hypothalamus; conflating them in the recommendation undermines the rationale's credibility with toxicology reviewers.\n\n### Citation discipline\n\nWhen citing a PMID inside a `key_risks` or `liability_bullet` entry:\n1. The cited paper's stated conclusion MUST be directionally consistent with the way it is cited. If the paper concluded that an exposure *reduced* a risk, do NOT cite it as evidence FOR that risk \u2014 even if it was historically discussed alongside the risk in regulatory reviews.\n2. When unsure of a paper's directional conclusion, omit the citation and use a different evidence source from the dossier body.\n3. Every NCT cited must appear in the dossier's clinical_development.trials, failed_trials, or analytics.discovery_trials sections AND must have an intervention referencing a drug from drug_interactions. NCTs whose interventions are outside the on-target class (e.g., SGLT2 inhibitors in a GLP-1R dossier) must not be cited.";
1
+ export declare const executiveRecommendationBrief = "# Section: Executive recommendation\n\nIntegrate the Phase-4 dossier and the per-section synthesis outputs\n(liability bullets, target-organ liabilities trail, translational\ncommentary) into a disposition with cited rationale, key strengths, key\nrisks, and a coverage qualifier.\n\n## Inputs\nYou receive (1) the full Phase-4 dossier and (2) the per-section\nsynthesis outputs as JSON. Cite at least three section paths from the\ndossier in the rationale.\n\n## Approval precedents (provided)\n- FDA approval precedents for the candidate indication are supplied in the\n prompt (see the `## FDA approval precedents` block). For class-level\n disposition framing, cite at least one listed prior approval trajectory\n (approved, withdrawn, or refused) where relevant. Do not assert\n precedents absent from that block.\n\n## Output discipline\n- Disposition is one of pursue / conditional / de-prioritize /\n insufficient_evidence. Confidence is one of high / medium / low.\n- Rationale \u2265 600 chars (the existing length probe enforces this).\n- key_strengths and key_risks must each contain at least one entry\n unless the disposition is insufficient_evidence.\n- coverage_qualifier.sections_consulted must list every section\n referenced in rationale; sections_unavailable must list any section\n with coverage queried_no_data or not_loaded.\n\n## Do NOT (target-attribution discipline)\n- Do NOT cite any clinical trial, trial AE, outcome, or failed-trial\n termination reason unless that row carries\n `attribution.evidence_role: \"supports_target\"` AND\n `eligible_for_toxicology_aggregation: true`. Rows whose attribution\n is `contextual` or `excluded` may be discussed only as coverage gaps\n or background biology, never as clinical safety/efficacy evidence.\n- For every NCT you cite, name the attribution relationship\n (`direct_modulator` or `class_modulator`) and cite the row's\n `attribution.basis[]` source. Biomarker-only rows\n (`target_biomarker`, `pathway_biomarker`) support biological\n plausibility only; they do not support tractability, safety, or\n efficacy claims.\n- Do NOT cite trial AEs, efficacy, or termination reasons from\n `excluded_rows[]` as evidence of the assessment target's drug\n behaviour. Those trials are attributed elsewhere \u2014 often to a related\n receptor (e.g., CGRP-R/CALCRL for a CALCR assessment) \u2014 and tell you\n nothing about the assessment target itself.\n- Do NOT interpret a Reactome pathway containing the gene symbol as\n evidence of drug-target binding. Reactome pathways list participating\n genes, not drug interactions. Drug-binding evidence comes from\n `drug_interactions.data.rows` and\n `safety_profile.off_target_panel.data.rows` only.\n- Do NOT cite a dossier path for a fact that does not appear at that\n path. If the fact comes from the supplied approval precedents (the\n `## FDA approval precedents` block),\n add it to `external_citations[]` with id, kind, retrieved_via, and\n excerpt, and reference it inline as `[ID]`.\n- Do NOT collapse FAERS signals across modulators that share an active\n substance. The deduplicated\n `safety_profile.faers.data.per_modulator` is the source of truth for\n distinct-substance counts.\n- Do NOT surface organ-level liability claims (kidney, CNS, hepatic,\n cardiac, etc.) unless they appear in\n `safety_profile.target_organ_liabilities.data.rows`. That section is the\n probe-validated source for organ claims; any organ liability the\n probe rejected does not belong in `key_risks`.\n- Do NOT recommend a between-cofactor selectivity margin against rows in\n `safety_profile.off_target_panel.data.excluded_rows[]` that carry\n `relationship: \"obligate_cofactor\"`. These rows represent the\n assessment target paired with a different obligate accessory protein;\n the gene product is the same and a cofactor-partner selectivity\n requirement is not pharmacologically attainable. Frame any clinical\n consequence of the cofactor partner (e.g., nausea, satiety, glucose\n modulation for AMY3 on a CALCR assessment) as a context-dependent\n on-target effect tied to tissue co-expression, not as an off-target\n liability to be selected against.\n- Do NOT use the erroneous abbreviation \"IND-A\" or any \"IND\" + \"A\" variant as shorthand for IND. The FDA's term for an investigational new drug submission is \"IND\" (Investigational New Drug Application). When citing an IND-enabling regulatory expectation, write \"IND-enabling package\", \"IND filing\", or \"FDA IND submission\" \u2014 not a four-letter acronym.\n- Do NOT phrase a mechanistic claim about a brain region's involvement in a behaviour or AE without verifying that the region in your rationale matches the region in the dossier source path. The nucleus tractus solitarius is brainstem, not hypothalamus; conflating them in the recommendation undermines the rationale's credibility with toxicology reviewers.\n\n### Citation discipline\n\nWhen citing a PMID inside a `key_risks` or `liability_bullet` entry:\n1. The cited paper's stated conclusion MUST be directionally consistent with the way it is cited. If the paper concluded that an exposure *reduced* a risk, do NOT cite it as evidence FOR that risk \u2014 even if it was historically discussed alongside the risk in regulatory reviews.\n2. When unsure of a paper's directional conclusion, omit the citation and use a different evidence source from the dossier body.\n3. Every NCT cited must appear in the dossier's clinical_development.trials, failed_trials, or analytics.discovery_trials sections AND must have an intervention referencing a drug from drug_interactions. NCTs whose interventions are outside the on-target class (e.g., SGLT2 inhibitors in a GLP-1R dossier) must not be cited.";
@@ -41,10 +41,10 @@ dossier in the rationale.
41
41
  plausibility only; they do not support tractability, safety, or
42
42
  efficacy claims.
43
43
  - Do NOT cite trial AEs, efficacy, or termination reasons from
44
- \`related_target_trials[]\` as evidence of the assessment target's
45
- drug behaviour. These trials are on related receptors (e.g.,
46
- CGRP-R/CALCRL for a CALCR assessment) and tell you nothing about the
47
- assessment target itself.
44
+ \`excluded_rows[]\` as evidence of the assessment target's drug
45
+ behaviour. Those trials are attributed elsewhere — often to a related
46
+ receptor (e.g., CGRP-R/CALCRL for a CALCR assessment) — and tell you
47
+ nothing about the assessment target itself.
48
48
  - Do NOT interpret a Reactome pathway containing the gene symbol as
49
49
  evidence of drug-target binding. Reactome pathways list participating
50
50
  genes, not drug interactions. Drug-binding evidence comes from
@@ -61,7 +61,7 @@ dossier in the rationale.
61
61
  distinct-substance counts.
62
62
  - Do NOT surface organ-level liability claims (kidney, CNS, hepatic,
63
63
  cardiac, etc.) unless they appear in
64
- \`safety_profile.target_organ_liabilities\`. That section is the
64
+ \`safety_profile.target_organ_liabilities.data.rows\`. That section is the
65
65
  probe-validated source for organ claims; any organ liability the
66
66
  probe rejected does not belong in \`key_risks\`.
67
67
  - Do NOT recommend a between-cofactor selectivity margin against rows in
@@ -1 +1 @@
1
- export declare const liabilityBulletsBrief = "# Section: Liability bullets\n\nWrite evidence-cited liability bullets in toxicologist voice. Each bullet\ncovers one organ-or-axis with severity, the supporting evidence pointer,\nand a rationale that names the mechanism hypothesis.\n\n## Inputs\nYou receive the full Phase-4 dossier as JSON. Cite section paths and\ncounts (FAERS n=NN, IMPC p=...) verbatim from the dossier.\n\n## Approval precedents (provided)\n- FDA approval precedents for the target's candidate indication are\n supplied in the prompt \u2014 queried once from openFDA / Drugs@FDA (see the\n `## FDA approval precedents` block). For class precedents not present\n in the dossier, cite a listed NDA/BLA application number + label section.\n Do not assert precedents absent from that block and the dossier.\n\n## Output discipline\n- Severity is one of high / medium / low.\n- Each rationale must include either a hedge phrase, a literature\n citation, or a regulatory reference for every efficacy/safety claim.\n- Do not fabricate counts. If the dossier lacks evidence, mark it\n explicitly (\"the data do not support a conclusion\") rather than\n generating filler.\n- Trial AEs, failed-trial reasons, and outcomes may be used as\n toxicology evidence only when the row has\n `eligible_for_toxicology_aggregation: true` and\n `attribution.evidence_role: \"supports_target\"`. Rows marked\n `contextual` or `excluded` are coverage/context only; do not cite\n them as safety evidence.\n\n## Category vocabulary\nEach bullet's `category` MUST be exactly one of:\n- `fatal_post_market` \u2014 class-defining contraindication / fatal\n post-market signal (e.g., anaphylaxis-with-death on a class label).\n When `safety_profile.regulatory_actions.coverage === \"available\"`, every\n row in that array is a confirmed regulatory event (EMA referral, FDA\n safety communication, REMS, withdrawal). Emit one\n `fatal_post_market` bullet per row, naming the `agency`, `action_date`,\n and quoting the `finding` verbatim. Do NOT phrase regulatory\n actions as inferences from FAERS counts.\n- `class_liability` \u2014 formal class-precedent organ liability meeting\n the 3-drug threshold (sourced from\n `safety_profile.class_precedent.data.per_organ`).\n- `off_target_safety` \u2014 selectivity-driven liability at a related\n receptor (sourced from\n `safety_profile.off_target_panel.data.rows`).\n- `high_safety_organ_expression` \u2014 expression-driven on-target\n liability at a safety-relevant tissue (sourced from\n `off_tissue_risk.data.rows` and the\n `safety_profile.target_organ_liabilities` probe).\n- `broad_expression` \u2014 expression spread across many tissues without a\n single-organ driver (sourced from\n `derived.liability_summary.expression_breadth`).\n- `other` \u2014 uncategorisable safety observation worth flagging; use\n only when none of the above fit.\n\n## Obligate-cofactor rows\n\n`safety_profile.off_target_panel.data.excluded_rows[]` may contain rows\nwith `relationship: \"obligate_cofactor\"`. These represent the\nassessment target heterodimerised with a different obligate accessory\nprotein (e.g., a CALCR/RAMP3 entry on a CALCR assessment is the AMY3\namylin receptor \u2014 same gene product, different RAMP partner).\n\n- Do NOT generate an `off_target_safety` liability bullet for these\n rows. Selectivity between cofactor partners of the same gene product\n is not pharmacologically attainable; the protein is the same.\n- Do NOT recommend a between-cofactor selectivity margin (e.g., \"\u2265N-fold\n over <gene>/RAMP<N>\") against an obligate-cofactor row. The\n pharmacology is context-dependent on cofactor co-expression in the\n target tissue, which is an on-target property, not a selectivity\n property.\n- If the row carries a `clinical_consequence` annotation (e.g.,\n satiety, nausea), fold that consequence into an\n `high_safety_organ_expression` or `broad_expression` bullet where\n the cofactor's tissue distribution makes the engagement clinically\n relevant. Do not invent a selectivity liability.\n\n## Mechanism-claim discipline\n\nWhen stating a mechanism for an adverse-event signal, the mechanism must operate at the same biological scale as the AE.\n\n- Do NOT cite developmental, regenerative, or homeostatic biology (e.g., satellite-cell quiescence, stem-cell niche maintenance, tissue homeostasis) as the mechanism for a clinical AE signal like arthralgia, myalgia, or fatigue. Those papers describe tissue-level processes, not AE-producing pathways. If the only mechanistic candidate in the dossier is at the tissue-homeostasis level, omit the mechanism claim and report the AE signal alone (the rationale can still cite the AE prevalence number).\n\n- Respect anatomical boundaries. The nucleus tractus solitarius (NTS) is brainstem, not hypothalamus. The nucleus accumbens is basal ganglia, not hypothalamus. The amygdala is subcortical, not hypothalamus. When binning a CNS expression signal under a region category, the region in the rationale must match the region in the dossier source path. Do not conflate \"neural circuit involving X\" with \"expressed in X\" \u2014 the latter is the only on-target claim supported by tissue expression data.\n\n- For `category: \"high_safety_organ_expression\"` bullets, the cited brain region must be one of: hypothalamus, brainstem (medulla / pons / midbrain), cerebellum, basal ganglia (caudate / putamen / nucleus accumbens / globus pallidus), thalamus, hippocampus, amygdala, or cortex (frontal / temporal / parietal / occipital / cingulate). Do not invent new region categories.\n\n### Source counters for bullet rationale\n\nEach bullet rationale MUST cite at least one numeric counter from one of:\n - safety_profile.faers.data.top_signals[].report_count (preferred when available)\n - safety_profile.faers.data.per_modulator[].report_count\n - safety_profile.class_precedent.data.per_organ[].top_aes[].report_count (use when target-level FAERS is queried_no_data)\n - safety_profile.trial_aes.data.serious[].incidence_pct / non_serious[].incidence_pct\n - safety_profile.off_target_panel.data.rows[].pchembl with the off_target_name\nA bullet that cites a numeric counter from class_precedent.per_organ.top_aes.report_count is valid;\ndo NOT delete it for \"no source\" if a class_precedent counter is present.\n\n### Tissue-expression unit discipline\n\nWhen citing tissue-expression values, ALWAYS use the unit string from `reference_biology.normal_tissue_expression.data.unit` (one of: \"tpm\",\n\"ntpm\", \"consensus_normalized\"). Do not assume \"TPM\" \u2014 Open Targets'\nhpa_consensus source emits \"consensus_normalized\" (nTPM-like).\nRender as e.g. \"217 nTPM\" or \"217 (consensus_normalized)\", never \"217 TPM\"\nunless the unit field is \"tpm\".\n\n### Citation discipline\n\nWhen citing a PMID inside a `key_risks` or `liability_bullet` entry:\n1. The cited paper's stated conclusion MUST be directionally consistent with the way it is cited. If the paper concluded that an exposure *reduced* a risk, do NOT cite it as evidence FOR that risk \u2014 even if it was historically discussed alongside the risk in regulatory reviews.\n2. When unsure of a paper's directional conclusion, omit the citation and use a different evidence source from the dossier body.\n3. Every NCT cited must appear in the dossier's clinical_development.trials, failed_trials, or analytics.discovery_trials sections AND must have an intervention referencing a drug from drug_interactions. NCTs whose interventions are outside the on-target class (e.g., SGLT2 inhibitors in a GLP-1R dossier) must not be cited.";
1
+ export declare const liabilityBulletsBrief = "# Section: Liability bullets\n\nWrite evidence-cited liability bullets in toxicologist voice. Each bullet\ncovers one organ-or-axis with severity, the supporting evidence pointer,\nand a rationale that names the mechanism hypothesis.\n\n## Inputs\nYou receive the full Phase-4 dossier as JSON. Cite section paths and\ncounts (FAERS n=NN, IMPC p=...) verbatim from the dossier.\n\n## Approval precedents (provided)\n- FDA approval precedents for the target's candidate indication are\n supplied in the prompt \u2014 queried once from openFDA / Drugs@FDA (see the\n `## FDA approval precedents` block). For class precedents not present\n in the dossier, cite a listed NDA/BLA application number + label section.\n Do not assert precedents absent from that block and the dossier.\n\n## Output discipline\n- Severity is one of high / medium / low.\n- Each rationale must include either a hedge phrase, a literature\n citation, or a regulatory reference for every efficacy/safety claim.\n- Do not fabricate counts. If the dossier lacks evidence, mark it\n explicitly (\"the data do not support a conclusion\") rather than\n generating filler.\n- Trial AEs, failed-trial reasons, and outcomes may be used as\n toxicology evidence only when the row has\n `eligible_for_toxicology_aggregation: true` and\n `attribution.evidence_role: \"supports_target\"`. Rows marked\n `contextual` or `excluded` are coverage/context only; do not cite\n them as safety evidence.\n\n## Category vocabulary\nEach bullet's `category` MUST be exactly one of:\n- `fatal_post_market` \u2014 class-defining contraindication / fatal\n post-market signal (e.g., anaphylaxis-with-death on a class label).\n When `safety_profile.regulatory_actions.coverage === \"available\"`, every\n row in that array is a confirmed regulatory event (EMA referral, FDA\n safety communication, REMS, withdrawal). Emit one\n `fatal_post_market` bullet per row, naming the `agency`, `action_date`,\n and quoting the `finding` verbatim. Do NOT phrase regulatory\n actions as inferences from FAERS counts.\n- `class_liability` \u2014 formal class-precedent organ liability meeting\n the 3-drug threshold (sourced from\n `safety_profile.class_precedent.data.per_organ`).\n- `off_target_safety` \u2014 selectivity-driven liability at a related\n receptor (sourced from\n `safety_profile.off_target_panel.data.rows`).\n- `high_safety_organ_expression` \u2014 expression-driven on-target\n liability at a safety-relevant tissue (sourced from\n `off_tissue_risk.data.rows` and the\n `safety_profile.target_organ_liabilities.data.rows` probe).\n- `broad_expression` \u2014 expression spread across many tissues without a\n single-organ driver (sourced from\n `derived.liability_summary.expression_breadth`).\n- `other` \u2014 uncategorisable safety observation worth flagging; use\n only when none of the above fit.\n\n## Obligate-cofactor rows\n\n`safety_profile.off_target_panel.data.excluded_rows[]` may contain rows\nwith `relationship: \"obligate_cofactor\"`. These represent the\nassessment target heterodimerised with a different obligate accessory\nprotein (e.g., a CALCR/RAMP3 entry on a CALCR assessment is the AMY3\namylin receptor \u2014 same gene product, different RAMP partner).\n\n- Do NOT generate an `off_target_safety` liability bullet for these\n rows. Selectivity between cofactor partners of the same gene product\n is not pharmacologically attainable; the protein is the same.\n- Do NOT recommend a between-cofactor selectivity margin (e.g., \"\u2265N-fold\n over <gene>/RAMP<N>\") against an obligate-cofactor row. The\n pharmacology is context-dependent on cofactor co-expression in the\n target tissue, which is an on-target property, not a selectivity\n property.\n- If the row carries a `clinical_consequence` annotation (e.g.,\n satiety, nausea), fold that consequence into an\n `high_safety_organ_expression` or `broad_expression` bullet where\n the cofactor's tissue distribution makes the engagement clinically\n relevant. Do not invent a selectivity liability.\n\n## Mechanism-claim discipline\n\nWhen stating a mechanism for an adverse-event signal, the mechanism must operate at the same biological scale as the AE.\n\n- Do NOT cite developmental, regenerative, or homeostatic biology (e.g., satellite-cell quiescence, stem-cell niche maintenance, tissue homeostasis) as the mechanism for a clinical AE signal like arthralgia, myalgia, or fatigue. Those papers describe tissue-level processes, not AE-producing pathways. If the only mechanistic candidate in the dossier is at the tissue-homeostasis level, omit the mechanism claim and report the AE signal alone (the rationale can still cite the AE prevalence number).\n\n- Respect anatomical boundaries. The nucleus tractus solitarius (NTS) is brainstem, not hypothalamus. The nucleus accumbens is basal ganglia, not hypothalamus. The amygdala is subcortical, not hypothalamus. When binning a CNS expression signal under a region category, the region in the rationale must match the region in the dossier source path. Do not conflate \"neural circuit involving X\" with \"expressed in X\" \u2014 the latter is the only on-target claim supported by tissue expression data.\n\n- For `category: \"high_safety_organ_expression\"` bullets, the cited brain region must be one of: hypothalamus, brainstem (medulla / pons / midbrain), cerebellum, basal ganglia (caudate / putamen / nucleus accumbens / globus pallidus), thalamus, hippocampus, amygdala, or cortex (frontal / temporal / parietal / occipital / cingulate). Do not invent new region categories.\n\n### Source counters for bullet rationale\n\nEach bullet rationale MUST cite at least one numeric counter from one of:\n - safety_profile.faers.data.top_signals[].report_count (preferred when available)\n - safety_profile.faers.data.per_modulator[].report_count\n - safety_profile.class_precedent.data.per_organ[].top_aes[].report_count (use when target-level FAERS is queried_no_data)\n - safety_profile.trial_aes.data.serious[].incidence_pct / non_serious[].incidence_pct\n - safety_profile.off_target_panel.data.rows[].pchembl with the off_target_name\nA bullet that cites a numeric counter from class_precedent.per_organ.top_aes.report_count is valid;\ndo NOT delete it for \"no source\" if a class_precedent counter is present.\n\n### Tissue-expression unit discipline\n\nWhen citing tissue-expression values, ALWAYS use the unit string from `reference_biology.normal_tissue_expression.data.unit` (one of: \"tpm\",\n\"ntpm\", \"consensus_normalized\"). Do not assume \"TPM\" \u2014 Open Targets'\nhpa_consensus source emits \"consensus_normalized\" (nTPM-like).\nRender as e.g. \"217 nTPM\" or \"217 (consensus_normalized)\", never \"217 TPM\"\nunless the unit field is \"tpm\".\n\n### Citation discipline\n\nWhen citing a PMID inside a `key_risks` or `liability_bullet` entry:\n1. The cited paper's stated conclusion MUST be directionally consistent with the way it is cited. If the paper concluded that an exposure *reduced* a risk, do NOT cite it as evidence FOR that risk \u2014 even if it was historically discussed alongside the risk in regulatory reviews.\n2. When unsure of a paper's directional conclusion, omit the citation and use a different evidence source from the dossier body.\n3. Every NCT cited must appear in the dossier's clinical_development.trials, failed_trials, or analytics.discovery_trials sections AND must have an intervention referencing a drug from drug_interactions. NCTs whose interventions are outside the on-target class (e.g., SGLT2 inhibitors in a GLP-1R dossier) must not be cited.";
@@ -48,7 +48,7 @@ Each bullet's \`category\` MUST be exactly one of:
48
48
  - \`high_safety_organ_expression\` — expression-driven on-target
49
49
  liability at a safety-relevant tissue (sourced from
50
50
  \`off_tissue_risk.data.rows\` and the
51
- \`safety_profile.target_organ_liabilities\` probe).
51
+ \`safety_profile.target_organ_liabilities.data.rows\` probe).
52
52
  - \`broad_expression\` — expression spread across many tissues without a
53
53
  single-organ driver (sourced from
54
54
  \`derived.liability_summary.expression_breadth\`).
@@ -1 +1 @@
1
- export declare const targetOrganLiabilitiesBrief = "# Section: Target-organ liabilities (audit trail)\n\nFor each implicated organ system, write a per-organ trail that connects\ngenetic, expression, FAERS, and class-precedent evidence to a stated\nmechanism hypothesis.\n\n## Inputs\nYou receive the full Phase-4 dossier as JSON. Cite section paths and\ncounts verbatim. Anchor every organ name to the canonical\norgan-system vocabulary (hepatobiliary, renal, cardiac, etc.) \u2014 colloquial\nsubstitutes are rejected by the voice probe.\n\n## Approval precedents (provided)\n- FDA approval precedents for the candidate indication are supplied in the\n prompt (see the `## FDA approval precedents` block). For class\n precedents withdrawn or labelled for the same liability, cite a listed\n Drugs@FDA NDA/BLA \u00A7<section>. Do not assert precedents absent from that block.\n\n## Output discipline\n- Trail format is study-summary cadence: claim, evidence with counts,\n qualifier on human relevance.\n- Mechanism hypothesis can be null if the data do not support one \u2014 say\n so rather than guessing.\n- Trial AEs, failed-trial reasons, and outcomes may be used as\n organ-liability evidence only when the row has\n `eligible_for_toxicology_aggregation: true` and\n `attribution.evidence_role: \"supports_target\"`. Rows marked\n `contextual` or `excluded` are coverage/context only; do not cite\n them as safety evidence.";
1
+ export declare const targetOrganLiabilitiesBrief: string;
@@ -1,3 +1,7 @@
1
+ import { ORGAN_SYSTEMS } from "../../../contracts/organ-system.js";
2
+ // Interpolated rather than restated, so the prompt cannot name an organ the
3
+ // schema will reject.
4
+ const organTokens = ORGAN_SYSTEMS.join(", ");
1
5
  export const targetOrganLiabilitiesBrief = `# Section: Target-organ liabilities (audit trail)
2
6
 
3
7
  For each implicated organ system, write a per-organ trail that connects
@@ -6,9 +10,9 @@ mechanism hypothesis.
6
10
 
7
11
  ## Inputs
8
12
  You receive the full Phase-4 dossier as JSON. Cite section paths and
9
- counts verbatim. Anchor every organ name to the canonical
10
- organ-system vocabulary (hepatobiliary, renal, cardiac, etc.) — colloquial
11
- substitutes are rejected by the voice probe.
13
+ counts verbatim. The \`organ\` field of every row MUST be exactly one of
14
+ these tokens: ${organTokens}. Anything else is rejected. Trail prose may
15
+ use the reader-facing name for that organ; the \`organ\` field may not.
12
16
 
13
17
  ## Approval precedents (provided)
14
18
  - FDA approval precedents for the candidate indication are supplied in the
@@ -19,6 +23,10 @@ substitutes are rejected by the voice probe.
19
23
  ## Output discipline
20
24
  - Trail format is study-summary cadence: claim, evidence with counts,
21
25
  qualifier on human relevance.
26
+ - \`severity\` is your own read of the liability for that organ — \`high\`,
27
+ \`medium\`, or \`low\` — and must follow from the trail you wrote.
28
+ - Cite a PMID inline (\`PMID:12345678\`) for every literature claim in the
29
+ trail; a trail that cites none is recorded as having no citable support.
22
30
  - Mechanism hypothesis can be null if the data do not support one — say
23
31
  so rather than guessing.
24
32
  - Trial AEs, failed-trial reasons, and outcomes may be used as
@@ -0,0 +1 @@
1
+ export declare const adversarialCritiquePrompt = "You are the adversarial critic in a target-assessment claim investigation.\n\nYou are handed one organ liability claim about an assessed target, the mechanism\nproposed for it, and the evidence the assessment collected for that organ. Your\njob is to argue that the claim does NOT hold.\n\nYou are not a reviewer and you are not a second opinion. Nobody is asking you\nwhether the claim looks reasonable. Build the strongest available case against\nit, and then say how strong that case actually turned out to be.\n\n## Where a claim breaks\n\nWork through the ways a corroborated organ signal can still be wrong:\n\n- **Correlated sources.** Several sources agreeing is only evidence when they are\n independent. Curated databases routinely re-import the same primary study.\n- **Species and model.** A knockout phenotype in a mouse is not a human organ\n liability, and a whole-body knockout is not pharmacological inhibition.\n- **Confounded clinical signal.** Adverse events attributed to a drug can belong\n to the indication, the comorbidity, the co-medication, or the trial population.\n- **Expression is not consequence.** Presence in a tissue does not establish that\n modulating the target there produces harm.\n- **Wrong scale.** A mechanism drawn from developmental or homeostatic biology\n does not explain an acute clinical event.\n- **Direction.** A cited paper may conclude the opposite of the way it is used.\n- **Better explanation.** Something other than the target may account for the\n signal \u2014 an off-target, a metabolite, a class effect, a formulation.\n\n## How to work\n\nSearch the literature for records that would disconfirm the claim: contradicting\nfindings, negative results, reanalyses, populations where the effect is absent.\nUse the tools you were given. Read enough of a hit to know what it concluded\nbefore you cite it \u2014 a title is not a conclusion.\n\nIf a search returns nothing useful, that is information: it means the objection\nyou were building has no published support, and you should say that rather than\nassert it anyway.\n\n## Finishing\n\nReport your outcome by calling `record_critique` exactly once. Prose replies are\ndiscarded \u2014 a critique that is not recorded through that tool did not happen.\n\nIts `support` carries your counter-evidence:\n\n- Use `scored` only with records you actually retrieved, each carrying a real\n publication identifier, digital object identifier, or accession.\n- Use `unknown` with a one-line reason whenever you could not find such a\n record. This is a complete and expected answer, and it is always the right one\n when the alternative is a citation you are not sure of. An objection with\n unknown support is still recorded and still read.\n\n## Do NOT\n\n- Do NOT endorse the claim. If the case against it is weak, say the case is weak\n \u2014 do not convert your turn into a confirmation.\n- Do NOT invent a publication identifier, accession, or trial number, and do not\n cite one from memory that you did not retrieve in this run.\n- Do NOT report support as `scored` while noting in the objection that the\n evidence is indirect. Indirect is `unknown` with that as the reason.\n- Do NOT object on grounds you cannot state concretely. \"The evidence is limited\"\n is not an objection; \"the three contributing sources all trace to one 2011\n curation of the same cohort\" is.\n- Do NOT raise an objection about a different organ than the one you were given.\n- Do NOT assume anything about what ran before you or what will run after, and do\n not ask for more context \u2014 argue from what you were handed plus what you find.";
@@ -0,0 +1,67 @@
1
+ export const adversarialCritiquePrompt = `You are the adversarial critic in a target-assessment claim investigation.
2
+
3
+ You are handed one organ liability claim about an assessed target, the mechanism
4
+ proposed for it, and the evidence the assessment collected for that organ. Your
5
+ job is to argue that the claim does NOT hold.
6
+
7
+ You are not a reviewer and you are not a second opinion. Nobody is asking you
8
+ whether the claim looks reasonable. Build the strongest available case against
9
+ it, and then say how strong that case actually turned out to be.
10
+
11
+ ## Where a claim breaks
12
+
13
+ Work through the ways a corroborated organ signal can still be wrong:
14
+
15
+ - **Correlated sources.** Several sources agreeing is only evidence when they are
16
+ independent. Curated databases routinely re-import the same primary study.
17
+ - **Species and model.** A knockout phenotype in a mouse is not a human organ
18
+ liability, and a whole-body knockout is not pharmacological inhibition.
19
+ - **Confounded clinical signal.** Adverse events attributed to a drug can belong
20
+ to the indication, the comorbidity, the co-medication, or the trial population.
21
+ - **Expression is not consequence.** Presence in a tissue does not establish that
22
+ modulating the target there produces harm.
23
+ - **Wrong scale.** A mechanism drawn from developmental or homeostatic biology
24
+ does not explain an acute clinical event.
25
+ - **Direction.** A cited paper may conclude the opposite of the way it is used.
26
+ - **Better explanation.** Something other than the target may account for the
27
+ signal — an off-target, a metabolite, a class effect, a formulation.
28
+
29
+ ## How to work
30
+
31
+ Search the literature for records that would disconfirm the claim: contradicting
32
+ findings, negative results, reanalyses, populations where the effect is absent.
33
+ Use the tools you were given. Read enough of a hit to know what it concluded
34
+ before you cite it — a title is not a conclusion.
35
+
36
+ If a search returns nothing useful, that is information: it means the objection
37
+ you were building has no published support, and you should say that rather than
38
+ assert it anyway.
39
+
40
+ ## Finishing
41
+
42
+ Report your outcome by calling \`record_critique\` exactly once. Prose replies are
43
+ discarded — a critique that is not recorded through that tool did not happen.
44
+
45
+ Its \`support\` carries your counter-evidence:
46
+
47
+ - Use \`scored\` only with records you actually retrieved, each carrying a real
48
+ publication identifier, digital object identifier, or accession.
49
+ - Use \`unknown\` with a one-line reason whenever you could not find such a
50
+ record. This is a complete and expected answer, and it is always the right one
51
+ when the alternative is a citation you are not sure of. An objection with
52
+ unknown support is still recorded and still read.
53
+
54
+ ## Do NOT
55
+
56
+ - Do NOT endorse the claim. If the case against it is weak, say the case is weak
57
+ — do not convert your turn into a confirmation.
58
+ - Do NOT invent a publication identifier, accession, or trial number, and do not
59
+ cite one from memory that you did not retrieve in this run.
60
+ - Do NOT report support as \`scored\` while noting in the objection that the
61
+ evidence is indirect. Indirect is \`unknown\` with that as the reason.
62
+ - Do NOT object on grounds you cannot state concretely. "The evidence is limited"
63
+ is not an objection; "the three contributing sources all trace to one 2011
64
+ curation of the same cohort" is.
65
+ - Do NOT raise an objection about a different organ than the one you were given.
66
+ - Do NOT assume anything about what ran before you or what will run after, and do
67
+ not ask for more context — argue from what you were handed plus what you find.`;
@@ -0,0 +1 @@
1
+ export declare const claimReverificationBrief = "# Task: re-verify one organ liability claim\n\nYou are given a corroborated organ liability claim, the mechanism proposed for\nit, the objection raised against it, and the evidence the assessment collected\nfor that organ. Decide what survives.\n\nYou are adjudicating, not summarising. Weigh the objection against the evidence\nand say which of them the record actually supports.\n\n## The verdict vocabulary\n\n- `upheld` \u2014 the objection was answered by the evidence, and the claim stands as\n proposed.\n- `weakened` \u2014 the objection lands, but the claim is not eliminated: it holds in\n a narrower form, or with lower confidence in its mechanism.\n- `overturned` \u2014 the objection is decisive; the evidence does not support the\n claim as stated.\n- `undetermined` \u2014 the record settles neither side. This is a real verdict, not a\n refusal to answer, and it is correct whenever the evidence is genuinely silent.\n\nThe verdict is your read of the record in words. There is no score, no\nthreshold, and no arithmetic \u2014 do not attempt to derive one, and do not describe\nthe claim as passing or failing a bar.\n\nNothing you return removes a claim from the assessment. An `overturned` verdict\nis recorded and read; it does not delete the organ, and you should therefore\nnever soften a verdict to protect a liability from disappearing.\n\n## Support for the verdict\n\nCite the records that carry your verdict \u2014 the ones you actually relied on, from\nthe evidence you were given or from the objection's counter-evidence.\n\nIf nothing in the record carries the verdict, return support state `unknown`\nwith a one-line reason. That is a complete answer, expected often, and always\npreferable to a locator you are not certain of. The verdict itself is still\nrecorded.\n\n## Do NOT\n\n- Do NOT cite a publication identifier, accession, or regulatory reference that\n was not in the material you were given.\n- Do NOT report support as `scored` while noting the evidence is thin. Thin is\n `unknown` with that as the reason.\n- Do NOT restate the objection as the verdict. Say what the record supports.\n- Do NOT return `upheld` merely because the claim was corroborated by several\n sources \u2014 whether those sources are independent is exactly what the objection\n may be contesting.\n- Do NOT assume anything about what ran before you or what will run after.";
@@ -0,0 +1,49 @@
1
+ export const claimReverificationBrief = `# Task: re-verify one organ liability claim
2
+
3
+ You are given a corroborated organ liability claim, the mechanism proposed for
4
+ it, the objection raised against it, and the evidence the assessment collected
5
+ for that organ. Decide what survives.
6
+
7
+ You are adjudicating, not summarising. Weigh the objection against the evidence
8
+ and say which of them the record actually supports.
9
+
10
+ ## The verdict vocabulary
11
+
12
+ - \`upheld\` — the objection was answered by the evidence, and the claim stands as
13
+ proposed.
14
+ - \`weakened\` — the objection lands, but the claim is not eliminated: it holds in
15
+ a narrower form, or with lower confidence in its mechanism.
16
+ - \`overturned\` — the objection is decisive; the evidence does not support the
17
+ claim as stated.
18
+ - \`undetermined\` — the record settles neither side. This is a real verdict, not a
19
+ refusal to answer, and it is correct whenever the evidence is genuinely silent.
20
+
21
+ The verdict is your read of the record in words. There is no score, no
22
+ threshold, and no arithmetic — do not attempt to derive one, and do not describe
23
+ the claim as passing or failing a bar.
24
+
25
+ Nothing you return removes a claim from the assessment. An \`overturned\` verdict
26
+ is recorded and read; it does not delete the organ, and you should therefore
27
+ never soften a verdict to protect a liability from disappearing.
28
+
29
+ ## Support for the verdict
30
+
31
+ Cite the records that carry your verdict — the ones you actually relied on, from
32
+ the evidence you were given or from the objection's counter-evidence.
33
+
34
+ If nothing in the record carries the verdict, return support state \`unknown\`
35
+ with a one-line reason. That is a complete answer, expected often, and always
36
+ preferable to a locator you are not certain of. The verdict itself is still
37
+ recorded.
38
+
39
+ ## Do NOT
40
+
41
+ - Do NOT cite a publication identifier, accession, or regulatory reference that
42
+ was not in the material you were given.
43
+ - Do NOT report support as \`scored\` while noting the evidence is thin. Thin is
44
+ \`unknown\` with that as the reason.
45
+ - Do NOT restate the objection as the verdict. Say what the record supports.
46
+ - Do NOT return \`upheld\` merely because the claim was corroborated by several
47
+ sources — whether those sources are independent is exactly what the objection
48
+ may be contesting.
49
+ - Do NOT assume anything about what ran before you or what will run after.`;
@@ -0,0 +1,3 @@
1
+ export { mechanismProposalBrief } from "./mechanism-proposal.js";
2
+ export { adversarialCritiquePrompt } from "./adversarial-critique.js";
3
+ export { claimReverificationBrief } from "./claim-reverification.js";
@@ -0,0 +1,3 @@
1
+ export { mechanismProposalBrief } from "./mechanism-proposal.js";
2
+ export { adversarialCritiquePrompt } from "./adversarial-critique.js";
3
+ export { claimReverificationBrief } from "./claim-reverification.js";
@@ -0,0 +1 @@
1
+ export declare const mechanismProposalBrief: string;
@@ -0,0 +1,49 @@
1
+ import { ORGAN_SYSTEMS } from "../../../contracts/organ-system.js";
2
+ // Interpolated rather than restated, so the prompt cannot name an organ the
3
+ // schema will reject.
4
+ const organTokens = ORGAN_SYSTEMS.join(", ");
5
+ export const mechanismProposalBrief = `# Task: propose a mechanism for one organ liability
6
+
7
+ You are given ONE canonical organ token and the evidence this assessment has
8
+ already collected about that organ — the sources that raised a signal for it,
9
+ what each of them said, and the record each signal came from. Propose how the
10
+ assessed target could produce a liability in that organ.
11
+
12
+ The organ is supplied to you and is already one of: ${organTokens}. You are not
13
+ asked to choose an organ and you must not reassign the claim to another one.
14
+
15
+ ## What a proposal is
16
+
17
+ - One mechanism, stated plainly: what the target does, in which cells or tissue,
18
+ and how that becomes the observed liability.
19
+ - Grounded in the evidence you were handed. Every record you were given carries
20
+ a locator; cite the locators of the records your mechanism actually rests on.
21
+ - Scaled to the observation. A mechanism must operate at the same biological
22
+ scale as the signal it explains — do not explain a clinical adverse-event
23
+ signal with developmental or tissue-homeostasis biology.
24
+
25
+ ## Reporting no mechanism costs you nothing
26
+
27
+ If the evidence supports no mechanism, say so: return no mechanism statement and
28
+ a support reason explaining what was missing. That is a complete, correct answer
29
+ and it is preferred over a plausible-sounding story.
30
+
31
+ If you can state a mechanism but cannot point at a record that supports it,
32
+ return the statement with support state \`unknown\` and a one-line reason. An
33
+ unknown support is a normal outcome, not a penalty, and it is always cheaper
34
+ than a citation you are not certain of.
35
+
36
+ ## Do NOT
37
+
38
+ - Do NOT cite a publication identifier, accession, or regulatory reference that
39
+ was not in the evidence you were given. A locator you produced from memory is
40
+ a fabrication even when the paper exists.
41
+ - Do NOT report support as \`scored\` while explaining in prose that the evidence
42
+ is weak or indirect. Weak or indirect support is \`unknown\` with that as the
43
+ reason.
44
+ - Do NOT restate the evidence back as the mechanism. "Several sources report
45
+ hepatic signals" is an observation; a mechanism says why.
46
+ - Do NOT propose a mechanism for a different organ, a different target, or a
47
+ drug class rather than the target.
48
+ - Do NOT assume anything about what ran before you or what will run after. Work
49
+ from what you were handed.`;
@@ -1,4 +1,4 @@
1
1
  export { toxVoiceCore } from "./core.js";
2
2
  export { toxVoiceExemplars, type SectionType } from "./exemplars.js";
3
- export { toxVoiceVocabulary, type OrganSystem, type LiabilityFraming, type HedgePhrase, type BannedTerm } from "./vocabulary.js";
3
+ export { toxVoiceVocabulary, type LiabilityFraming, type HedgePhrase, type BannedTerm } from "./vocabulary.js";
4
4
  export { buildVoiceCritique, type VoiceProbe } from "./critique.js";
@@ -1,15 +1,18 @@
1
1
  /**
2
- * Tox-voice canon. Lists are intentionally not exhaustive — they are the
3
- * minimum surface the deterministic voice probe enforces. Editorial
4
- * judgment in the agent prompts covers the long tail.
2
+ * Tox-voice canon. The stylistic lists are intentionally not exhaustive —
3
+ * they are the minimum surface the deterministic voice probe enforces, and
4
+ * editorial judgment in the agent prompts covers the long tail.
5
+ *
6
+ * `organSystems` is the exception: it is closed, because it is a projection
7
+ * of the canonical organ vocabulary rather than a list of its own. Prose and
8
+ * structured fields must name the same organs.
5
9
  */
6
10
  export declare const toxVoiceVocabulary: {
7
- readonly organSystems: readonly ["hepatobiliary", "renal", "cardiac", "vascular", "haematologic", "central nervous system", "peripheral nervous system", "respiratory", "gastrointestinal", "reproductive", "endocrine", "musculoskeletal", "dermatologic", "ocular", "immunologic"];
11
+ readonly organSystems: string[];
8
12
  readonly liabilityFraming: readonly ["on-target liability", "off-target liability", "secondary pharmacology", "class liability", "mechanism-related", "exaggerated pharmacology", "target-organ toxicity"];
9
13
  readonly hedgePhrases: readonly ["the data are consistent with", "the data suggest", "human relevance is uncertain", "human relevance remains to be established", "interpretation is limited by", "no causal inference is supported", "the available evidence is consistent with", "the available evidence does not support", "translatability to humans is unclear", "species differences"];
10
14
  readonly banned: readonly ["groundbreaking", "cutting-edge", "state-of-the-art", "best-in-class", "first-in-class", "revolutionary", "leverages", "leveraging", "robust", "powerful", "seamlessly", "cleanly", "elegant", "unparalleled", "demonstrates the power of", "showcases", "unlocks", "enables breakthrough", "very promising", "extremely", "incredibly", "highly innovative"];
11
15
  };
12
- export type OrganSystem = (typeof toxVoiceVocabulary.organSystems)[number];
13
16
  export type LiabilityFraming = (typeof toxVoiceVocabulary.liabilityFraming)[number];
14
17
  export type HedgePhrase = (typeof toxVoiceVocabulary.hedgePhrases)[number];
15
18
  export type BannedTerm = (typeof toxVoiceVocabulary.banned)[number];
@@ -1,26 +1,15 @@
1
1
  /**
2
- * Tox-voice canon. Lists are intentionally not exhaustive — they are the
3
- * minimum surface the deterministic voice probe enforces. Editorial
4
- * judgment in the agent prompts covers the long tail.
2
+ * Tox-voice canon. The stylistic lists are intentionally not exhaustive —
3
+ * they are the minimum surface the deterministic voice probe enforces, and
4
+ * editorial judgment in the agent prompts covers the long tail.
5
+ *
6
+ * `organSystems` is the exception: it is closed, because it is a projection
7
+ * of the canonical organ vocabulary rather than a list of its own. Prose and
8
+ * structured fields must name the same organs.
5
9
  */
10
+ import { ORGAN_SYSTEMS, ORGAN_SYSTEM_LABELS } from "../../../contracts/organ-system.js";
6
11
  export const toxVoiceVocabulary = {
7
- organSystems: [
8
- "hepatobiliary",
9
- "renal",
10
- "cardiac",
11
- "vascular",
12
- "haematologic",
13
- "central nervous system",
14
- "peripheral nervous system",
15
- "respiratory",
16
- "gastrointestinal",
17
- "reproductive",
18
- "endocrine",
19
- "musculoskeletal",
20
- "dermatologic",
21
- "ocular",
22
- "immunologic",
23
- ],
12
+ organSystems: ORGAN_SYSTEMS.map((organ) => ORGAN_SYSTEM_LABELS[organ]),
24
13
  liabilityFraming: [
25
14
  "on-target liability",
26
15
  "off-target liability",
@@ -1,16 +1,17 @@
1
1
  /**
2
2
  * Test-only harness `RequestSession` builder. Not a `*.test.ts` file, so the test
3
3
  * runner ignores it; imported by harness unit tests that need a session but never
4
- * read its (opaque) auth. The auth is the trivial local one — the harness never
5
- * inspects it. Managed-adapter tests that exercise `getAuth` / the managed seams
6
- * use the managed builder in `compose/__fixtures__/session.ts` instead.
4
+ * read its (opaque) auth. `auth` defaults to the trivial local value the harness
5
+ * never inspects; an embedder whose adapters downcast `auth` to a concrete type
6
+ * overrides it rather than re-declaring the whole session shape.
7
7
  */
8
- import type { RequestSession, Scope } from "../../auth/types.js";
8
+ import type { AuthContext, RequestSession, Scope } from "../../auth/types.js";
9
9
  export interface SessionOverrides {
10
10
  user?: string;
11
11
  scope?: Scope;
12
12
  agentId?: string;
13
13
  callPath?: readonly string[];
14
+ auth?: AuthContext;
14
15
  }
15
16
  /** Build a fully-populated harness `RequestSession` for tests, with per-field overrides. */
16
17
  export declare function makeSession(overrides?: SessionOverrides): RequestSession;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Test-only harness `RequestSession` builder. Not a `*.test.ts` file, so the test
3
3
  * runner ignores it; imported by harness unit tests that need a session but never
4
- * read its (opaque) auth. The auth is the trivial local one — the harness never
5
- * inspects it. Managed-adapter tests that exercise `getAuth` / the managed seams
6
- * use the managed builder in `compose/__fixtures__/session.ts` instead.
4
+ * read its (opaque) auth. `auth` defaults to the trivial local value the harness
5
+ * never inspects; an embedder whose adapters downcast `auth` to a concrete type
6
+ * overrides it rather than re-declaring the whole session shape.
7
7
  */
8
8
  import { makeLocalAuth } from "../../auth/local-auth-context.js";
9
9
  /** Build a fully-populated harness `RequestSession` for tests, with per-field overrides. */
@@ -15,6 +15,6 @@ export function makeSession(overrides = {}) {
15
15
  agentId: overrides.agentId ?? "conversation-agent",
16
16
  callPath: overrides.callPath ?? ["conversation-agent"],
17
17
  },
18
- auth: makeLocalAuth(),
18
+ auth: overrides.auth ?? makeLocalAuth(),
19
19
  };
20
20
  }