@inflexa-ai/harness 0.35.8 → 0.36.1

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 (198) hide show
  1. package/dist/auth/types.d.ts +5 -14
  2. package/dist/auth/types.js +3 -10
  3. package/dist/billing/usage-recorder.d.ts +1 -1
  4. package/dist/contracts/analogy-report.d.ts +1 -1
  5. package/dist/contracts/analogy-report.js +1 -1
  6. package/dist/contracts/chat-parts.d.ts +2 -3
  7. package/dist/contracts/index.d.ts +0 -4
  8. package/dist/contracts/index.js +0 -2
  9. package/dist/index.d.ts +0 -7
  10. package/dist/index.js +0 -21
  11. package/dist/lib/metrics.d.ts +1 -1
  12. package/dist/lib/otel-spans.d.ts +0 -2
  13. package/dist/lib/otel-spans.js +0 -2
  14. package/dist/loop/genai-spans.d.ts +14 -0
  15. package/dist/loop/genai-spans.js +35 -0
  16. package/dist/loop/run-agent.d.ts +1 -1
  17. package/dist/loop/run-agent.js +37 -4
  18. package/dist/runtime/assemble.d.ts +0 -3
  19. package/dist/runtime/assemble.js +0 -3
  20. package/dist/state/index.d.ts +0 -2
  21. package/dist/state/index.js +0 -1
  22. package/dist/state/init.js +1 -60
  23. package/dist/state/purge-analysis.d.ts +1 -2
  24. package/dist/state/purge-analysis.js +1 -2
  25. package/dist/tasks/regulatory-corpus-boot-refresh.js +1 -1
  26. package/dist/tools/bio/gene-preclinical-profile.d.ts +1 -3
  27. package/dist/tools/bio/gene-preclinical-profile.js +1 -3
  28. package/dist/tools/lib/chembl-client.d.ts +1 -4
  29. package/dist/tools/lib/chembl-client.js +1 -4
  30. package/dist/tools/lib/clinical-benchmarks-client.d.ts +1 -1
  31. package/dist/tools/lib/clinical-benchmarks-client.js +1 -1
  32. package/dist/tools/lib/clinical-trials-client.d.ts +0 -3
  33. package/dist/tools/lib/clinical-trials-client.js +0 -3
  34. package/dist/tools/lib/identifier-resolver.d.ts +5 -7
  35. package/dist/tools/lib/identifier-resolver.js +5 -7
  36. package/dist/tools/lib/iuphar-client.d.ts +1 -3
  37. package/dist/tools/lib/iuphar-client.js +1 -3
  38. package/dist/tools/lib/opentargets-client.d.ts +1 -1
  39. package/dist/tools/lib/opentargets-client.js +1 -1
  40. package/dist/tools/lib/protein-family-normalize.d.ts +5 -7
  41. package/dist/tools/lib/protein-family-normalize.js +5 -7
  42. package/dist/tools/lib/uniprot-client.d.ts +0 -7
  43. package/dist/tools/lib/uniprot-client.js +2 -9
  44. package/package.json +1 -1
  45. package/dist/contracts/target-assessment-row.d.ts +0 -85
  46. package/dist/contracts/target-assessment-row.js +0 -37
  47. package/dist/contracts/target-dossier.d.ts +0 -12423
  48. package/dist/contracts/target-dossier.js +0 -1282
  49. package/dist/prompts/target-assessment/briefs/executive-recommendation.d.ts +0 -1
  50. package/dist/prompts/target-assessment/briefs/executive-recommendation.js +0 -85
  51. package/dist/prompts/target-assessment/briefs/index.d.ts +0 -4
  52. package/dist/prompts/target-assessment/briefs/index.js +0 -4
  53. package/dist/prompts/target-assessment/briefs/liability-bullets.d.ts +0 -1
  54. package/dist/prompts/target-assessment/briefs/liability-bullets.js +0 -114
  55. package/dist/prompts/target-assessment/briefs/target-organ-liabilities.d.ts +0 -1
  56. package/dist/prompts/target-assessment/briefs/target-organ-liabilities.js +0 -37
  57. package/dist/prompts/target-assessment/briefs/translational-commentary.d.ts +0 -1
  58. package/dist/prompts/target-assessment/briefs/translational-commentary.js +0 -23
  59. package/dist/prompts/target-assessment/drugs-in-class.d.ts +0 -1
  60. package/dist/prompts/target-assessment/drugs-in-class.js +0 -29
  61. package/dist/prompts/target-assessment/investigation/adversarial-critique.d.ts +0 -1
  62. package/dist/prompts/target-assessment/investigation/adversarial-critique.js +0 -67
  63. package/dist/prompts/target-assessment/investigation/claim-reverification.d.ts +0 -1
  64. package/dist/prompts/target-assessment/investigation/claim-reverification.js +0 -49
  65. package/dist/prompts/target-assessment/investigation/index.d.ts +0 -3
  66. package/dist/prompts/target-assessment/investigation/index.js +0 -3
  67. package/dist/prompts/target-assessment/investigation/mechanism-proposal.d.ts +0 -1
  68. package/dist/prompts/target-assessment/investigation/mechanism-proposal.js +0 -49
  69. package/dist/prompts/target-assessment/modulator-triage.d.ts +0 -1
  70. package/dist/prompts/target-assessment/modulator-triage.js +0 -31
  71. package/dist/prompts/target-assessment/off-target-annotator.d.ts +0 -1
  72. package/dist/prompts/target-assessment/off-target-annotator.js +0 -28
  73. package/dist/prompts/target-assessment/tox-voice/core.d.ts +0 -1
  74. package/dist/prompts/target-assessment/tox-voice/core.js +0 -74
  75. package/dist/prompts/target-assessment/tox-voice/critique.d.ts +0 -7
  76. package/dist/prompts/target-assessment/tox-voice/critique.js +0 -109
  77. package/dist/prompts/target-assessment/tox-voice/exemplars.d.ts +0 -8
  78. package/dist/prompts/target-assessment/tox-voice/exemplars.js +0 -24
  79. package/dist/prompts/target-assessment/tox-voice/index.d.ts +0 -4
  80. package/dist/prompts/target-assessment/tox-voice/index.js +0 -4
  81. package/dist/prompts/target-assessment/tox-voice/vocabulary.d.ts +0 -18
  82. package/dist/prompts/target-assessment/tox-voice/vocabulary.js +0 -61
  83. package/dist/state/target-assessments.d.ts +0 -68
  84. package/dist/state/target-assessments.js +0 -222
  85. package/dist/workflows/execute-target-assessment.d.ts +0 -118
  86. package/dist/workflows/execute-target-assessment.js +0 -631
  87. package/dist/workflows/target-assessment/assemblers/index.d.ts +0 -5
  88. package/dist/workflows/target-assessment/assemblers/index.js +0 -4
  89. package/dist/workflows/target-assessment/assemblers/literature.d.ts +0 -281
  90. package/dist/workflows/target-assessment/assemblers/literature.js +0 -971
  91. package/dist/workflows/target-assessment/assemblers/orchestrator.d.ts +0 -118
  92. package/dist/workflows/target-assessment/assemblers/orchestrator.js +0 -945
  93. package/dist/workflows/target-assessment/assemblers/safety.d.ts +0 -374
  94. package/dist/workflows/target-assessment/assemblers/safety.js +0 -1068
  95. package/dist/workflows/target-assessment/assemblers/trials.d.ts +0 -30
  96. package/dist/workflows/target-assessment/assemblers/trials.js +0 -75
  97. package/dist/workflows/target-assessment/collectors/index.d.ts +0 -114
  98. package/dist/workflows/target-assessment/collectors/index.js +0 -538
  99. package/dist/workflows/target-assessment/coverage.d.ts +0 -97
  100. package/dist/workflows/target-assessment/coverage.js +0 -86
  101. package/dist/workflows/target-assessment/decisions/index.d.ts +0 -86
  102. package/dist/workflows/target-assessment/decisions/index.js +0 -127
  103. package/dist/workflows/target-assessment/fanout/index.d.ts +0 -32
  104. package/dist/workflows/target-assessment/fanout/index.js +0 -156
  105. package/dist/workflows/target-assessment/investigation/index.d.ts +0 -97
  106. package/dist/workflows/target-assessment/investigation/index.js +0 -419
  107. package/dist/workflows/target-assessment/lib/approval-precedents.d.ts +0 -73
  108. package/dist/workflows/target-assessment/lib/approval-precedents.js +0 -185
  109. package/dist/workflows/target-assessment/lib/citation-validator.d.ts +0 -46
  110. package/dist/workflows/target-assessment/lib/citation-validator.js +0 -316
  111. package/dist/workflows/target-assessment/lib/clinical-consequence-annotator.d.ts +0 -65
  112. package/dist/workflows/target-assessment/lib/clinical-consequence-annotator.js +0 -174
  113. package/dist/workflows/target-assessment/lib/clinical-evidence-attribution.d.ts +0 -44
  114. package/dist/workflows/target-assessment/lib/clinical-evidence-attribution.js +0 -152
  115. package/dist/workflows/target-assessment/lib/compute-derived.d.ts +0 -20
  116. package/dist/workflows/target-assessment/lib/compute-derived.js +0 -261
  117. package/dist/workflows/target-assessment/lib/compute-selectivity.d.ts +0 -15
  118. package/dist/workflows/target-assessment/lib/compute-selectivity.js +0 -18
  119. package/dist/workflows/target-assessment/lib/dedup-modulators.d.ts +0 -37
  120. package/dist/workflows/target-assessment/lib/dedup-modulators.js +0 -157
  121. package/dist/workflows/target-assessment/lib/evidence-conflict-detector.d.ts +0 -17
  122. package/dist/workflows/target-assessment/lib/evidence-conflict-detector.js +0 -100
  123. package/dist/workflows/target-assessment/lib/expression-constants.d.ts +0 -21
  124. package/dist/workflows/target-assessment/lib/expression-constants.js +0 -21
  125. package/dist/workflows/target-assessment/lib/family-complex-supplement.d.ts +0 -20
  126. package/dist/workflows/target-assessment/lib/family-complex-supplement.js +0 -36
  127. package/dist/workflows/target-assessment/lib/fda-label-safety.d.ts +0 -72
  128. package/dist/workflows/target-assessment/lib/fda-label-safety.js +0 -166
  129. package/dist/workflows/target-assessment/lib/heterodimer-filter.d.ts +0 -30
  130. package/dist/workflows/target-assessment/lib/heterodimer-filter.js +0 -44
  131. package/dist/workflows/target-assessment/lib/hpo-organ-map.d.ts +0 -34
  132. package/dist/workflows/target-assessment/lib/hpo-organ-map.js +0 -63
  133. package/dist/workflows/target-assessment/lib/impc-organ-map.d.ts +0 -19
  134. package/dist/workflows/target-assessment/lib/impc-organ-map.js +0 -39
  135. package/dist/workflows/target-assessment/lib/intended-polypharm-filter.d.ts +0 -4
  136. package/dist/workflows/target-assessment/lib/intended-polypharm-filter.js +0 -24
  137. package/dist/workflows/target-assessment/lib/llm-step.d.ts +0 -80
  138. package/dist/workflows/target-assessment/lib/llm-step.js +0 -101
  139. package/dist/workflows/target-assessment/lib/meddra-organ-map.d.ts +0 -40
  140. package/dist/workflows/target-assessment/lib/meddra-organ-map.js +0 -138
  141. package/dist/workflows/target-assessment/lib/recommendation-quality-gates.d.ts +0 -17
  142. package/dist/workflows/target-assessment/lib/recommendation-quality-gates.js +0 -99
  143. package/dist/workflows/target-assessment/lib/recommendation-sanitizer.d.ts +0 -2
  144. package/dist/workflows/target-assessment/lib/recommendation-sanitizer.js +0 -51
  145. package/dist/workflows/target-assessment/lib/regulatory-actions.d.ts +0 -25
  146. package/dist/workflows/target-assessment/lib/regulatory-actions.js +0 -176
  147. package/dist/workflows/target-assessment/lib/safety-corroboration.d.ts +0 -44
  148. package/dist/workflows/target-assessment/lib/safety-corroboration.js +0 -273
  149. package/dist/workflows/target-assessment/lib/structured-llm.d.ts +0 -61
  150. package/dist/workflows/target-assessment/lib/structured-llm.js +0 -102
  151. package/dist/workflows/target-assessment/lib/target-identity-filter.d.ts +0 -59
  152. package/dist/workflows/target-assessment/lib/target-identity-filter.js +0 -95
  153. package/dist/workflows/target-assessment/lib/therapeutic-programs.d.ts +0 -20
  154. package/dist/workflows/target-assessment/lib/therapeutic-programs.js +0 -68
  155. package/dist/workflows/target-assessment/metrics.d.ts +0 -16
  156. package/dist/workflows/target-assessment/metrics.js +0 -30
  157. package/dist/workflows/target-assessment/phase4-assemble.d.ts +0 -3182
  158. package/dist/workflows/target-assessment/phase4-assemble.js +0 -39
  159. package/dist/workflows/target-assessment/phase5-persist.d.ts +0 -59
  160. package/dist/workflows/target-assessment/phase5-persist.js +0 -349
  161. package/dist/workflows/target-assessment/progress-stream.d.ts +0 -75
  162. package/dist/workflows/target-assessment/progress-stream.js +0 -110
  163. package/dist/workflows/target-assessment/progress.d.ts +0 -39
  164. package/dist/workflows/target-assessment/progress.js +0 -77
  165. package/dist/workflows/target-assessment/schemas.d.ts +0 -970
  166. package/dist/workflows/target-assessment/schemas.js +0 -318
  167. package/dist/workflows/target-assessment/steps/collectors/pathways.d.ts +0 -15
  168. package/dist/workflows/target-assessment/steps/collectors/pathways.js +0 -58
  169. package/dist/workflows/target-assessment/steps/fanout/aes-for-one-class-drug-step.d.ts +0 -34
  170. package/dist/workflows/target-assessment/steps/fanout/aes-for-one-class-drug-step.js +0 -31
  171. package/dist/workflows/target-assessment/steps/fanout/aes-for-one-trial-step.d.ts +0 -57
  172. package/dist/workflows/target-assessment/steps/fanout/aes-for-one-trial-step.js +0 -54
  173. package/dist/workflows/target-assessment/steps/fanout/faers-for-one-modulator-step.d.ts +0 -35
  174. package/dist/workflows/target-assessment/steps/fanout/faers-for-one-modulator-step.js +0 -32
  175. package/dist/workflows/target-assessment/steps/fanout/index.d.ts +0 -14
  176. package/dist/workflows/target-assessment/steps/fanout/index.js +0 -10
  177. package/dist/workflows/target-assessment/steps/fanout/polypharm-for-one-modulator-step.d.ts +0 -29
  178. package/dist/workflows/target-assessment/steps/fanout/polypharm-for-one-modulator-step.js +0 -29
  179. package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +0 -657
  180. package/dist/workflows/target-assessment/steps/phase2-aggregate.js +0 -34
  181. package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +0 -806
  182. package/dist/workflows/target-assessment/steps/phase3-aggregate.js +0 -16
  183. package/dist/workflows/target-assessment/steps/synthesis/diagnostics.d.ts +0 -28
  184. package/dist/workflows/target-assessment/steps/synthesis/diagnostics.js +0 -27
  185. package/dist/workflows/target-assessment/sub-workflows/index.d.ts +0 -15
  186. package/dist/workflows/target-assessment/sub-workflows/index.js +0 -11
  187. package/dist/workflows/target-assessment/sub-workflows/per-class-drug-aes.d.ts +0 -41
  188. package/dist/workflows/target-assessment/sub-workflows/per-class-drug-aes.js +0 -12
  189. package/dist/workflows/target-assessment/sub-workflows/per-modulator-faers.d.ts +0 -41
  190. package/dist/workflows/target-assessment/sub-workflows/per-modulator-faers.js +0 -12
  191. package/dist/workflows/target-assessment/sub-workflows/per-modulator-polypharm.d.ts +0 -37
  192. package/dist/workflows/target-assessment/sub-workflows/per-modulator-polypharm.js +0 -12
  193. package/dist/workflows/target-assessment/sub-workflows/per-trial-aes.d.ts +0 -66
  194. package/dist/workflows/target-assessment/sub-workflows/per-trial-aes.js +0 -12
  195. package/dist/workflows/target-assessment/synthesis/index.d.ts +0 -607
  196. package/dist/workflows/target-assessment/synthesis/index.js +0 -354
  197. package/dist/workflows/target-assessment/synthesis-probes.d.ts +0 -56
  198. package/dist/workflows/target-assessment/synthesis-probes.js +0 -320
@@ -1,607 +0,0 @@
1
- /**
2
- * Phase-5 synthesis functions for the harness DBOS workflow.
3
- *
4
- * Four functions:
5
- * - `liabilityBullets` (per-section, parallel-safe)
6
- * - `safetyFlagsTrail` (per-section, parallel-safe)
7
- * - `translationalCommentary` (per-section, parallel-safe)
8
- * - `dossierRecommendation` (whole-dossier, sequential after the three above)
9
- *
10
- * Each function is a pure async `(input, deps) => Promise<EnvelopeWithDiagnostic>`.
11
- * Every call is single-shot structured-output through `structuredLlmCall`.
12
- *
13
- * The `runSynthesisWithProbe` helper preserves the bounded-retry-on-probe-
14
- * failure semantics: attempt 1 → probe → critique-driven retry → probe.
15
- * Each attempt is its own attempt-numbered DBOS step so a resumed
16
- * post-402 call lands a fresh cache slot.
17
- */
18
- import { z } from "zod";
19
- import { type DossierBody } from "@inflexa-ai/harness/contracts/target-dossier.js";
20
- import type { AgentSession } from "../../../auth/types.js";
21
- import type { AgentChat } from "../../../providers/types.js";
22
- import { BUDGET_EXCEEDED_SENTINEL } from "../lib/llm-step.js";
23
- export declare const LiabilityBulletsOutputSchema: z.ZodObject<{
24
- bullets: z.ZodArray<z.ZodObject<{
25
- organ_or_axis: z.ZodString;
26
- severity: z.ZodEnum<{
27
- low: "low";
28
- medium: "medium";
29
- high: "high";
30
- }>;
31
- text: z.ZodString;
32
- evidence_pointer: z.ZodString;
33
- rationale: z.ZodString;
34
- category: z.ZodEnum<{
35
- other: "other";
36
- fatal_post_market: "fatal_post_market";
37
- class_liability: "class_liability";
38
- off_target_safety: "off_target_safety";
39
- high_safety_organ_expression: "high_safety_organ_expression";
40
- broad_expression: "broad_expression";
41
- }>;
42
- }, z.core.$strip>>;
43
- notes: z.ZodString;
44
- }, z.core.$strip>;
45
- export type LiabilityBulletsOutput = z.infer<typeof LiabilityBulletsOutputSchema>;
46
- export declare const SafetyFlagsTrailOutputSchema: z.ZodObject<{
47
- flags: z.ZodArray<z.ZodObject<{
48
- organ: z.ZodEnum<{
49
- hematologic: "hematologic";
50
- metabolic: "metabolic";
51
- immune: "immune";
52
- hepatic: "hepatic";
53
- musculoskeletal: "musculoskeletal";
54
- cns: "cns";
55
- renal: "renal";
56
- reproductive: "reproductive";
57
- respiratory: "respiratory";
58
- cardiac: "cardiac";
59
- vascular: "vascular";
60
- pns: "pns";
61
- gi: "gi";
62
- pancreas: "pancreas";
63
- endocrine_thyroid: "endocrine_thyroid";
64
- dermatologic: "dermatologic";
65
- ocular: "ocular";
66
- oncology: "oncology";
67
- }>;
68
- severity: z.ZodEnum<{
69
- low: "low";
70
- medium: "medium";
71
- high: "high";
72
- }>;
73
- trail: z.ZodString;
74
- mechanism_hypothesis: z.ZodNullable<z.ZodString>;
75
- }, z.core.$strip>>;
76
- }, z.core.$strip>;
77
- export type SafetyFlagsTrailOutput = z.infer<typeof SafetyFlagsTrailOutputSchema>;
78
- export declare const TranslationalCommentaryOutputSchema: z.ZodObject<{
79
- rows: z.ZodArray<z.ZodObject<{
80
- topic: z.ZodEnum<{
81
- ko_phenotype: "ko_phenotype";
82
- expression_translation: "expression_translation";
83
- organ_system_match: "organ_system_match";
84
- family_context: "family_context";
85
- }>;
86
- predicate: z.ZodString;
87
- commentary: z.ZodString;
88
- }, z.core.$strip>>;
89
- }, z.core.$strip>;
90
- export type TranslationalCommentaryOutput = z.infer<typeof TranslationalCommentaryOutputSchema>;
91
- export declare const ExternalCitationSchema: z.ZodObject<{
92
- id: z.ZodString;
93
- kind: z.ZodEnum<{
94
- pubmed: "pubmed";
95
- fda_anda: "fda_anda";
96
- fda_nda: "fda_nda";
97
- clinicaltrials: "clinicaltrials";
98
- regulatory_guidance: "regulatory_guidance";
99
- }>;
100
- retrieved_via: z.ZodString;
101
- fetched_at: z.ZodOptional<z.ZodString>;
102
- excerpt: z.ZodString;
103
- }, z.core.$strip>;
104
- export declare const DossierRecommendationOutputSchema: z.ZodObject<{
105
- disposition: z.ZodEnum<{
106
- pursue: "pursue";
107
- conditional: "conditional";
108
- de_prioritize: "de_prioritize";
109
- insufficient_evidence: "insufficient_evidence";
110
- }>;
111
- confidence: z.ZodEnum<{
112
- low: "low";
113
- medium: "medium";
114
- high: "high";
115
- }>;
116
- rationale: z.ZodString;
117
- key_strengths: z.ZodArray<z.ZodString>;
118
- key_risks: z.ZodArray<z.ZodString>;
119
- modality_choice: z.ZodObject<{
120
- modality: z.ZodString;
121
- rationale: z.ZodString;
122
- }, z.core.$strip>;
123
- coverage_qualifier: z.ZodObject<{
124
- sections_consulted: z.ZodArray<z.ZodString>;
125
- sections_unavailable: z.ZodArray<z.ZodString>;
126
- note: z.ZodString;
127
- }, z.core.$strip>;
128
- external_citations: z.ZodDefault<z.ZodArray<z.ZodObject<{
129
- id: z.ZodString;
130
- kind: z.ZodEnum<{
131
- pubmed: "pubmed";
132
- fda_anda: "fda_anda";
133
- fda_nda: "fda_nda";
134
- clinicaltrials: "clinicaltrials";
135
- regulatory_guidance: "regulatory_guidance";
136
- }>;
137
- retrieved_via: z.ZodString;
138
- fetched_at: z.ZodOptional<z.ZodString>;
139
- excerpt: z.ZodString;
140
- }, z.core.$strip>>>;
141
- }, z.core.$strip>;
142
- export type DossierRecommendationOutput = z.infer<typeof DossierRecommendationOutputSchema>;
143
- export declare const LiabilityBulletsStepOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
- coverage: z.ZodLiteral<"available">;
145
- data: z.ZodObject<{
146
- bullets: z.ZodArray<z.ZodObject<{
147
- organ_or_axis: z.ZodString;
148
- severity: z.ZodEnum<{
149
- low: "low";
150
- medium: "medium";
151
- high: "high";
152
- }>;
153
- text: z.ZodString;
154
- evidence_pointer: z.ZodString;
155
- rationale: z.ZodString;
156
- category: z.ZodEnum<{
157
- other: "other";
158
- fatal_post_market: "fatal_post_market";
159
- class_liability: "class_liability";
160
- off_target_safety: "off_target_safety";
161
- high_safety_organ_expression: "high_safety_organ_expression";
162
- broad_expression: "broad_expression";
163
- }>;
164
- }, z.core.$strip>>;
165
- notes: z.ZodString;
166
- }, z.core.$strip>;
167
- diagnostic: z.ZodObject<{
168
- step_id: z.ZodEnum<{
169
- "liability-bullets": "liability-bullets";
170
- "safety-flags-trail": "safety-flags-trail";
171
- "translational-commentary": "translational-commentary";
172
- "dossier-recommendation": "dossier-recommendation";
173
- }>;
174
- model_id: z.ZodString;
175
- attempt_count: z.ZodNumber;
176
- retry_critique: z.ZodNullable<z.ZodString>;
177
- output_chars: z.ZodNumber;
178
- probe_verdict: z.ZodEnum<{
179
- skipped: "skipped";
180
- pass: "pass";
181
- "fail-length": "fail-length";
182
- "fail-section-references": "fail-section-references";
183
- "fail-key-strengths-risks": "fail-key-strengths-risks";
184
- "fail-source-references": "fail-source-references";
185
- "fail-numeric-claim": "fail-numeric-claim";
186
- "fail-voice": "fail-voice";
187
- relaxed: "relaxed";
188
- }>;
189
- final_coverage: z.ZodEnum<{
190
- available: "available";
191
- queried_no_data: "queried_no_data";
192
- }>;
193
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
194
- "synthesis-too-shallow": "synthesis-too-shallow";
195
- "synthesis-unavailable": "synthesis-unavailable";
196
- "voice-violation": "voice-violation";
197
- }>>>;
198
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
- }, z.core.$strip>;
200
- }, z.core.$strip>, z.ZodObject<{
201
- coverage: z.ZodLiteral<"queried_no_data">;
202
- error: z.ZodOptional<z.ZodObject<{
203
- message: z.ZodString;
204
- name: z.ZodOptional<z.ZodString>;
205
- stack: z.ZodOptional<z.ZodString>;
206
- kind: z.ZodOptional<z.ZodEnum<{
207
- "synthesis-too-shallow": "synthesis-too-shallow";
208
- "synthesis-unavailable": "synthesis-unavailable";
209
- "voice-violation": "voice-violation";
210
- }>>;
211
- }, z.core.$strip>>;
212
- diagnostic: z.ZodObject<{
213
- step_id: z.ZodEnum<{
214
- "liability-bullets": "liability-bullets";
215
- "safety-flags-trail": "safety-flags-trail";
216
- "translational-commentary": "translational-commentary";
217
- "dossier-recommendation": "dossier-recommendation";
218
- }>;
219
- model_id: z.ZodString;
220
- attempt_count: z.ZodNumber;
221
- retry_critique: z.ZodNullable<z.ZodString>;
222
- output_chars: z.ZodNumber;
223
- probe_verdict: z.ZodEnum<{
224
- skipped: "skipped";
225
- pass: "pass";
226
- "fail-length": "fail-length";
227
- "fail-section-references": "fail-section-references";
228
- "fail-key-strengths-risks": "fail-key-strengths-risks";
229
- "fail-source-references": "fail-source-references";
230
- "fail-numeric-claim": "fail-numeric-claim";
231
- "fail-voice": "fail-voice";
232
- relaxed: "relaxed";
233
- }>;
234
- final_coverage: z.ZodEnum<{
235
- available: "available";
236
- queried_no_data: "queried_no_data";
237
- }>;
238
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
239
- "synthesis-too-shallow": "synthesis-too-shallow";
240
- "synthesis-unavailable": "synthesis-unavailable";
241
- "voice-violation": "voice-violation";
242
- }>>>;
243
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
- }, z.core.$strip>;
245
- }, z.core.$strip>], "coverage">;
246
- export type LiabilityBulletsStepOutput = z.infer<typeof LiabilityBulletsStepOutputSchema>;
247
- export declare const SafetyFlagsTrailStepOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
248
- coverage: z.ZodLiteral<"available">;
249
- data: z.ZodObject<{
250
- flags: z.ZodArray<z.ZodObject<{
251
- organ: z.ZodEnum<{
252
- hematologic: "hematologic";
253
- metabolic: "metabolic";
254
- immune: "immune";
255
- hepatic: "hepatic";
256
- musculoskeletal: "musculoskeletal";
257
- cns: "cns";
258
- renal: "renal";
259
- reproductive: "reproductive";
260
- respiratory: "respiratory";
261
- cardiac: "cardiac";
262
- vascular: "vascular";
263
- pns: "pns";
264
- gi: "gi";
265
- pancreas: "pancreas";
266
- endocrine_thyroid: "endocrine_thyroid";
267
- dermatologic: "dermatologic";
268
- ocular: "ocular";
269
- oncology: "oncology";
270
- }>;
271
- severity: z.ZodEnum<{
272
- low: "low";
273
- medium: "medium";
274
- high: "high";
275
- }>;
276
- trail: z.ZodString;
277
- mechanism_hypothesis: z.ZodNullable<z.ZodString>;
278
- }, z.core.$strip>>;
279
- }, z.core.$strip>;
280
- diagnostic: z.ZodObject<{
281
- step_id: z.ZodEnum<{
282
- "liability-bullets": "liability-bullets";
283
- "safety-flags-trail": "safety-flags-trail";
284
- "translational-commentary": "translational-commentary";
285
- "dossier-recommendation": "dossier-recommendation";
286
- }>;
287
- model_id: z.ZodString;
288
- attempt_count: z.ZodNumber;
289
- retry_critique: z.ZodNullable<z.ZodString>;
290
- output_chars: z.ZodNumber;
291
- probe_verdict: z.ZodEnum<{
292
- skipped: "skipped";
293
- pass: "pass";
294
- "fail-length": "fail-length";
295
- "fail-section-references": "fail-section-references";
296
- "fail-key-strengths-risks": "fail-key-strengths-risks";
297
- "fail-source-references": "fail-source-references";
298
- "fail-numeric-claim": "fail-numeric-claim";
299
- "fail-voice": "fail-voice";
300
- relaxed: "relaxed";
301
- }>;
302
- final_coverage: z.ZodEnum<{
303
- available: "available";
304
- queried_no_data: "queried_no_data";
305
- }>;
306
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
307
- "synthesis-too-shallow": "synthesis-too-shallow";
308
- "synthesis-unavailable": "synthesis-unavailable";
309
- "voice-violation": "voice-violation";
310
- }>>>;
311
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
- }, z.core.$strip>;
313
- }, z.core.$strip>, z.ZodObject<{
314
- coverage: z.ZodLiteral<"queried_no_data">;
315
- error: z.ZodOptional<z.ZodObject<{
316
- message: z.ZodString;
317
- name: z.ZodOptional<z.ZodString>;
318
- stack: z.ZodOptional<z.ZodString>;
319
- kind: z.ZodOptional<z.ZodEnum<{
320
- "synthesis-too-shallow": "synthesis-too-shallow";
321
- "synthesis-unavailable": "synthesis-unavailable";
322
- "voice-violation": "voice-violation";
323
- }>>;
324
- }, z.core.$strip>>;
325
- diagnostic: z.ZodObject<{
326
- step_id: z.ZodEnum<{
327
- "liability-bullets": "liability-bullets";
328
- "safety-flags-trail": "safety-flags-trail";
329
- "translational-commentary": "translational-commentary";
330
- "dossier-recommendation": "dossier-recommendation";
331
- }>;
332
- model_id: z.ZodString;
333
- attempt_count: z.ZodNumber;
334
- retry_critique: z.ZodNullable<z.ZodString>;
335
- output_chars: z.ZodNumber;
336
- probe_verdict: z.ZodEnum<{
337
- skipped: "skipped";
338
- pass: "pass";
339
- "fail-length": "fail-length";
340
- "fail-section-references": "fail-section-references";
341
- "fail-key-strengths-risks": "fail-key-strengths-risks";
342
- "fail-source-references": "fail-source-references";
343
- "fail-numeric-claim": "fail-numeric-claim";
344
- "fail-voice": "fail-voice";
345
- relaxed: "relaxed";
346
- }>;
347
- final_coverage: z.ZodEnum<{
348
- available: "available";
349
- queried_no_data: "queried_no_data";
350
- }>;
351
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
352
- "synthesis-too-shallow": "synthesis-too-shallow";
353
- "synthesis-unavailable": "synthesis-unavailable";
354
- "voice-violation": "voice-violation";
355
- }>>>;
356
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
357
- }, z.core.$strip>;
358
- }, z.core.$strip>], "coverage">;
359
- export type SafetyFlagsTrailStepOutput = z.infer<typeof SafetyFlagsTrailStepOutputSchema>;
360
- export declare const TranslationalCommentaryStepOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
361
- coverage: z.ZodLiteral<"available">;
362
- data: z.ZodObject<{
363
- rows: z.ZodArray<z.ZodObject<{
364
- topic: z.ZodEnum<{
365
- ko_phenotype: "ko_phenotype";
366
- expression_translation: "expression_translation";
367
- organ_system_match: "organ_system_match";
368
- family_context: "family_context";
369
- }>;
370
- predicate: z.ZodString;
371
- commentary: z.ZodString;
372
- }, z.core.$strip>>;
373
- }, z.core.$strip>;
374
- diagnostic: z.ZodObject<{
375
- step_id: z.ZodEnum<{
376
- "liability-bullets": "liability-bullets";
377
- "safety-flags-trail": "safety-flags-trail";
378
- "translational-commentary": "translational-commentary";
379
- "dossier-recommendation": "dossier-recommendation";
380
- }>;
381
- model_id: z.ZodString;
382
- attempt_count: z.ZodNumber;
383
- retry_critique: z.ZodNullable<z.ZodString>;
384
- output_chars: z.ZodNumber;
385
- probe_verdict: z.ZodEnum<{
386
- skipped: "skipped";
387
- pass: "pass";
388
- "fail-length": "fail-length";
389
- "fail-section-references": "fail-section-references";
390
- "fail-key-strengths-risks": "fail-key-strengths-risks";
391
- "fail-source-references": "fail-source-references";
392
- "fail-numeric-claim": "fail-numeric-claim";
393
- "fail-voice": "fail-voice";
394
- relaxed: "relaxed";
395
- }>;
396
- final_coverage: z.ZodEnum<{
397
- available: "available";
398
- queried_no_data: "queried_no_data";
399
- }>;
400
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
401
- "synthesis-too-shallow": "synthesis-too-shallow";
402
- "synthesis-unavailable": "synthesis-unavailable";
403
- "voice-violation": "voice-violation";
404
- }>>>;
405
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
406
- }, z.core.$strip>;
407
- }, z.core.$strip>, z.ZodObject<{
408
- coverage: z.ZodLiteral<"queried_no_data">;
409
- error: z.ZodOptional<z.ZodObject<{
410
- message: z.ZodString;
411
- name: z.ZodOptional<z.ZodString>;
412
- stack: z.ZodOptional<z.ZodString>;
413
- kind: z.ZodOptional<z.ZodEnum<{
414
- "synthesis-too-shallow": "synthesis-too-shallow";
415
- "synthesis-unavailable": "synthesis-unavailable";
416
- "voice-violation": "voice-violation";
417
- }>>;
418
- }, z.core.$strip>>;
419
- diagnostic: z.ZodObject<{
420
- step_id: z.ZodEnum<{
421
- "liability-bullets": "liability-bullets";
422
- "safety-flags-trail": "safety-flags-trail";
423
- "translational-commentary": "translational-commentary";
424
- "dossier-recommendation": "dossier-recommendation";
425
- }>;
426
- model_id: z.ZodString;
427
- attempt_count: z.ZodNumber;
428
- retry_critique: z.ZodNullable<z.ZodString>;
429
- output_chars: z.ZodNumber;
430
- probe_verdict: z.ZodEnum<{
431
- skipped: "skipped";
432
- pass: "pass";
433
- "fail-length": "fail-length";
434
- "fail-section-references": "fail-section-references";
435
- "fail-key-strengths-risks": "fail-key-strengths-risks";
436
- "fail-source-references": "fail-source-references";
437
- "fail-numeric-claim": "fail-numeric-claim";
438
- "fail-voice": "fail-voice";
439
- relaxed: "relaxed";
440
- }>;
441
- final_coverage: z.ZodEnum<{
442
- available: "available";
443
- queried_no_data: "queried_no_data";
444
- }>;
445
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
446
- "synthesis-too-shallow": "synthesis-too-shallow";
447
- "synthesis-unavailable": "synthesis-unavailable";
448
- "voice-violation": "voice-violation";
449
- }>>>;
450
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
451
- }, z.core.$strip>;
452
- }, z.core.$strip>], "coverage">;
453
- export type TranslationalCommentaryStepOutput = z.infer<typeof TranslationalCommentaryStepOutputSchema>;
454
- export declare const DossierRecommendationStepOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
455
- coverage: z.ZodLiteral<"available">;
456
- data: z.ZodObject<{
457
- disposition: z.ZodEnum<{
458
- pursue: "pursue";
459
- conditional: "conditional";
460
- de_prioritize: "de_prioritize";
461
- insufficient_evidence: "insufficient_evidence";
462
- }>;
463
- confidence: z.ZodEnum<{
464
- low: "low";
465
- medium: "medium";
466
- high: "high";
467
- }>;
468
- rationale: z.ZodString;
469
- key_strengths: z.ZodArray<z.ZodString>;
470
- key_risks: z.ZodArray<z.ZodString>;
471
- modality_choice: z.ZodObject<{
472
- modality: z.ZodString;
473
- rationale: z.ZodString;
474
- }, z.core.$strip>;
475
- coverage_qualifier: z.ZodObject<{
476
- sections_consulted: z.ZodArray<z.ZodString>;
477
- sections_unavailable: z.ZodArray<z.ZodString>;
478
- note: z.ZodString;
479
- }, z.core.$strip>;
480
- external_citations: z.ZodDefault<z.ZodArray<z.ZodObject<{
481
- id: z.ZodString;
482
- kind: z.ZodEnum<{
483
- pubmed: "pubmed";
484
- fda_anda: "fda_anda";
485
- fda_nda: "fda_nda";
486
- clinicaltrials: "clinicaltrials";
487
- regulatory_guidance: "regulatory_guidance";
488
- }>;
489
- retrieved_via: z.ZodString;
490
- fetched_at: z.ZodOptional<z.ZodString>;
491
- excerpt: z.ZodString;
492
- }, z.core.$strip>>>;
493
- }, z.core.$strip>;
494
- diagnostic: z.ZodObject<{
495
- step_id: z.ZodEnum<{
496
- "liability-bullets": "liability-bullets";
497
- "safety-flags-trail": "safety-flags-trail";
498
- "translational-commentary": "translational-commentary";
499
- "dossier-recommendation": "dossier-recommendation";
500
- }>;
501
- model_id: z.ZodString;
502
- attempt_count: z.ZodNumber;
503
- retry_critique: z.ZodNullable<z.ZodString>;
504
- output_chars: z.ZodNumber;
505
- probe_verdict: z.ZodEnum<{
506
- skipped: "skipped";
507
- pass: "pass";
508
- "fail-length": "fail-length";
509
- "fail-section-references": "fail-section-references";
510
- "fail-key-strengths-risks": "fail-key-strengths-risks";
511
- "fail-source-references": "fail-source-references";
512
- "fail-numeric-claim": "fail-numeric-claim";
513
- "fail-voice": "fail-voice";
514
- relaxed: "relaxed";
515
- }>;
516
- final_coverage: z.ZodEnum<{
517
- available: "available";
518
- queried_no_data: "queried_no_data";
519
- }>;
520
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
521
- "synthesis-too-shallow": "synthesis-too-shallow";
522
- "synthesis-unavailable": "synthesis-unavailable";
523
- "voice-violation": "voice-violation";
524
- }>>>;
525
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
526
- }, z.core.$strip>;
527
- }, z.core.$strip>, z.ZodObject<{
528
- coverage: z.ZodLiteral<"queried_no_data">;
529
- error: z.ZodOptional<z.ZodObject<{
530
- message: z.ZodString;
531
- name: z.ZodOptional<z.ZodString>;
532
- stack: z.ZodOptional<z.ZodString>;
533
- kind: z.ZodOptional<z.ZodEnum<{
534
- "synthesis-too-shallow": "synthesis-too-shallow";
535
- "synthesis-unavailable": "synthesis-unavailable";
536
- "voice-violation": "voice-violation";
537
- }>>;
538
- }, z.core.$strip>>;
539
- diagnostic: z.ZodObject<{
540
- step_id: z.ZodEnum<{
541
- "liability-bullets": "liability-bullets";
542
- "safety-flags-trail": "safety-flags-trail";
543
- "translational-commentary": "translational-commentary";
544
- "dossier-recommendation": "dossier-recommendation";
545
- }>;
546
- model_id: z.ZodString;
547
- attempt_count: z.ZodNumber;
548
- retry_critique: z.ZodNullable<z.ZodString>;
549
- output_chars: z.ZodNumber;
550
- probe_verdict: z.ZodEnum<{
551
- skipped: "skipped";
552
- pass: "pass";
553
- "fail-length": "fail-length";
554
- "fail-section-references": "fail-section-references";
555
- "fail-key-strengths-risks": "fail-key-strengths-risks";
556
- "fail-source-references": "fail-source-references";
557
- "fail-numeric-claim": "fail-numeric-claim";
558
- "fail-voice": "fail-voice";
559
- relaxed: "relaxed";
560
- }>;
561
- final_coverage: z.ZodEnum<{
562
- available: "available";
563
- queried_no_data: "queried_no_data";
564
- }>;
565
- error_kind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
566
- "synthesis-too-shallow": "synthesis-too-shallow";
567
- "synthesis-unavailable": "synthesis-unavailable";
568
- "voice-violation": "voice-violation";
569
- }>>>;
570
- error_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
571
- }, z.core.$strip>;
572
- }, z.core.$strip>], "coverage">;
573
- export type DossierRecommendationStepOutput = z.infer<typeof DossierRecommendationStepOutputSchema>;
574
- export interface SynthesisAgentDeps {
575
- readonly chatProvider: AgentChat;
576
- readonly session: AgentSession;
577
- readonly model: string;
578
- /** Attempt counter — bumped on resume so a 402-cancelled call lands a fresh DBOS step slot. */
579
- readonly attempt: number;
580
- /** Pre-fetched FDA approval-precedent markdown block, appended to every synthesis prompt. */
581
- readonly approvalPrecedents: string;
582
- }
583
- export type SynthesisStepResult<TStepOutput> = TStepOutput | {
584
- readonly kind: "budget-exceeded";
585
- readonly sentinel: typeof BUDGET_EXCEEDED_SENTINEL;
586
- };
587
- declare function isBudgetExceeded<T>(v: SynthesisStepResult<T>): v is {
588
- kind: "budget-exceeded";
589
- sentinel: typeof BUDGET_EXCEEDED_SENTINEL;
590
- };
591
- interface Phase4Output {
592
- readonly assessmentId: string;
593
- readonly dossier: DossierBody;
594
- }
595
- export declare function liabilityBullets(phase4: Phase4Output, deps: SynthesisAgentDeps): Promise<SynthesisStepResult<LiabilityBulletsStepOutput>>;
596
- export declare function safetyFlagsTrail(phase4: Phase4Output, deps: SynthesisAgentDeps): Promise<SynthesisStepResult<SafetyFlagsTrailStepOutput>>;
597
- export declare function translationalCommentary(phase4: Phase4Output, deps: SynthesisAgentDeps): Promise<SynthesisStepResult<TranslationalCommentaryStepOutput>>;
598
- export interface DossierRecommendationInput {
599
- readonly phase4: Phase4Output;
600
- readonly perSection: {
601
- readonly liabilityBullets: LiabilityBulletsStepOutput;
602
- readonly safetyFlagsTrail: SafetyFlagsTrailStepOutput;
603
- readonly translationalCommentary: TranslationalCommentaryStepOutput;
604
- };
605
- }
606
- export declare function dossierRecommendation(input: DossierRecommendationInput, deps: SynthesisAgentDeps): Promise<SynthesisStepResult<DossierRecommendationStepOutput>>;
607
- export { isBudgetExceeded as isSynthesisBudgetExceeded };