@inflexa-ai/harness 0.1.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.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +58 -0
- package/dist/agents/conversation-agent.d.ts +105 -0
- package/dist/agents/conversation-agent.js +140 -0
- package/dist/agents/report-builder.d.ts +32 -0
- package/dist/agents/report-builder.js +31 -0
- package/dist/agents/sandbox/__fixtures__/deps.d.ts +23 -0
- package/dist/agents/sandbox/__fixtures__/deps.js +96 -0
- package/dist/agents/sandbox/bulk-transcriptomics-agent.d.ts +8 -0
- package/dist/agents/sandbox/bulk-transcriptomics-agent.js +22 -0
- package/dist/agents/sandbox/cheminformatics-agent.d.ts +9 -0
- package/dist/agents/sandbox/cheminformatics-agent.js +62 -0
- package/dist/agents/sandbox/chromatin-agent.d.ts +8 -0
- package/dist/agents/sandbox/chromatin-agent.js +24 -0
- package/dist/agents/sandbox/data-profiler.d.ts +10 -0
- package/dist/agents/sandbox/data-profiler.js +24 -0
- package/dist/agents/sandbox/dna-methylation-agent.d.ts +8 -0
- package/dist/agents/sandbox/dna-methylation-agent.js +24 -0
- package/dist/agents/sandbox/drug-repurposing-agent.d.ts +8 -0
- package/dist/agents/sandbox/drug-repurposing-agent.js +54 -0
- package/dist/agents/sandbox/enrichment-agent.d.ts +8 -0
- package/dist/agents/sandbox/enrichment-agent.js +24 -0
- package/dist/agents/sandbox/ephemeral-executor.d.ts +9 -0
- package/dist/agents/sandbox/ephemeral-executor.js +29 -0
- package/dist/agents/sandbox/genomic-variant-agent.d.ts +8 -0
- package/dist/agents/sandbox/genomic-variant-agent.js +27 -0
- package/dist/agents/sandbox/immune-profiling-agent.d.ts +8 -0
- package/dist/agents/sandbox/immune-profiling-agent.js +43 -0
- package/dist/agents/sandbox/index.d.ts +31 -0
- package/dist/agents/sandbox/index.js +96 -0
- package/dist/agents/sandbox/metabolomics-agent.d.ts +8 -0
- package/dist/agents/sandbox/metabolomics-agent.js +15 -0
- package/dist/agents/sandbox/microbiome-agent.d.ts +8 -0
- package/dist/agents/sandbox/microbiome-agent.js +15 -0
- package/dist/agents/sandbox/multi-omics-integration-agent.d.ts +8 -0
- package/dist/agents/sandbox/multi-omics-integration-agent.js +33 -0
- package/dist/agents/sandbox/multimodal-sc-agent.d.ts +8 -0
- package/dist/agents/sandbox/multimodal-sc-agent.js +15 -0
- package/dist/agents/sandbox/network-agent.d.ts +8 -0
- package/dist/agents/sandbox/network-agent.js +25 -0
- package/dist/agents/sandbox/pkpd-clinical-response-agent.d.ts +8 -0
- package/dist/agents/sandbox/pkpd-clinical-response-agent.js +59 -0
- package/dist/agents/sandbox/proteomics-agent.d.ts +8 -0
- package/dist/agents/sandbox/proteomics-agent.js +15 -0
- package/dist/agents/sandbox/scientific-executor.d.ts +9 -0
- package/dist/agents/sandbox/scientific-executor.js +56 -0
- package/dist/agents/sandbox/shared.d.ts +100 -0
- package/dist/agents/sandbox/shared.js +195 -0
- package/dist/agents/sandbox/single-cell-agent.d.ts +8 -0
- package/dist/agents/sandbox/single-cell-agent.js +25 -0
- package/dist/agents/sandbox/spatial-omics-agent.d.ts +8 -0
- package/dist/agents/sandbox/spatial-omics-agent.js +15 -0
- package/dist/agents/sandbox/statistical-modeling-agent.d.ts +8 -0
- package/dist/agents/sandbox/statistical-modeling-agent.js +37 -0
- package/dist/agents/sandbox/translational-safety-agent.d.ts +8 -0
- package/dist/agents/sandbox/translational-safety-agent.js +59 -0
- package/dist/agents/sandbox/types.d.ts +34 -0
- package/dist/agents/sandbox/types.js +15 -0
- package/dist/agents/sandbox/validate-skills.d.ts +18 -0
- package/dist/agents/sandbox/validate-skills.js +40 -0
- package/dist/agents/sandbox-catalog.d.ts +33 -0
- package/dist/agents/sandbox-catalog.js +44 -0
- package/dist/agents/system-prompt.d.ts +25 -0
- package/dist/agents/system-prompt.js +23 -0
- package/dist/app/chat-turn.d.ts +35 -0
- package/dist/app/chat-turn.js +64 -0
- package/dist/app/data-profile-policy.d.ts +36 -0
- package/dist/app/data-profile-policy.js +37 -0
- package/dist/app/message-assembly.d.ts +65 -0
- package/dist/app/message-assembly.js +61 -0
- package/dist/app/synthesize-run.d.ts +57 -0
- package/dist/app/synthesize-run.js +103 -0
- package/dist/auth/local-auth-context.d.ts +19 -0
- package/dist/auth/local-auth-context.js +20 -0
- package/dist/auth/local-run-authorizer.d.ts +10 -0
- package/dist/auth/local-run-authorizer.js +23 -0
- package/dist/auth/types.d.ts +166 -0
- package/dist/auth/types.js +61 -0
- package/dist/billing/cached-resolver.d.ts +23 -0
- package/dist/billing/cached-resolver.js +61 -0
- package/dist/billing/noop-resolver.d.ts +6 -0
- package/dist/billing/noop-resolver.js +7 -0
- package/dist/billing/noop-run-charge.d.ts +6 -0
- package/dist/billing/noop-run-charge.js +10 -0
- package/dist/billing/resolver.d.ts +64 -0
- package/dist/billing/resolver.js +24 -0
- package/dist/billing/run-charge.d.ts +24 -0
- package/dist/billing/run-charge.js +9 -0
- package/dist/config/resource-limits.d.ts +76 -0
- package/dist/config/resource-limits.js +116 -0
- package/dist/contracts/analogy-report.d.ts +120 -0
- package/dist/contracts/analogy-report.js +50 -0
- package/dist/contracts/chat-events.d.ts +61 -0
- package/dist/contracts/chat-events.js +13 -0
- package/dist/contracts/chat-parts.d.ts +308 -0
- package/dist/contracts/chat-parts.js +13 -0
- package/dist/contracts/content-url.d.ts +49 -0
- package/dist/contracts/content-url.js +56 -0
- package/dist/contracts/index.d.ts +12 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/message.d.ts +36 -0
- package/dist/contracts/message.js +9 -0
- package/dist/contracts/part-registry.d.ts +18 -0
- package/dist/contracts/part-registry.js +28 -0
- package/dist/contracts/schemas/chat-events.d.ts +90 -0
- package/dist/contracts/schemas/chat-events.js +43 -0
- package/dist/contracts/schemas/chat-parts.d.ts +683 -0
- package/dist/contracts/schemas/chat-parts.js +295 -0
- package/dist/contracts/schemas/index.d.ts +2 -0
- package/dist/contracts/schemas/index.js +2 -0
- package/dist/contracts/target-assessment-row.d.ts +85 -0
- package/dist/contracts/target-assessment-row.js +37 -0
- package/dist/contracts/target-dossier.d.ts +16720 -0
- package/dist/contracts/target-dossier.js +1339 -0
- package/dist/data/clinical-benchmarks.json +108 -0
- package/dist/data/protein-family-modality.json +101 -0
- package/dist/data/safety-panel-schema.d.ts +64 -0
- package/dist/data/safety-panel-schema.js +34 -0
- package/dist/data/safety-panel.json +436 -0
- package/dist/execution/artifact-metadata.d.ts +74 -0
- package/dist/execution/artifact-metadata.js +203 -0
- package/dist/execution/artifact-record.d.ts +19 -0
- package/dist/execution/artifact-record.js +7 -0
- package/dist/execution/artifact-registration.d.ts +36 -0
- package/dist/execution/artifact-registration.js +61 -0
- package/dist/execution/artifact-registry.d.ts +82 -0
- package/dist/execution/artifact-registry.js +17 -0
- package/dist/execution/dbos-run-launcher.d.ts +7 -0
- package/dist/execution/dbos-run-launcher.js +38 -0
- package/dist/execution/ephemeral-runner.d.ts +81 -0
- package/dist/execution/ephemeral-runner.js +161 -0
- package/dist/execution/filesystem-artifact-registry.d.ts +57 -0
- package/dist/execution/filesystem-artifact-registry.js +92 -0
- package/dist/execution/noop-artifact-registry.d.ts +11 -0
- package/dist/execution/noop-artifact-registry.js +17 -0
- package/dist/execution/post-step-pipeline.d.ts +70 -0
- package/dist/execution/post-step-pipeline.js +207 -0
- package/dist/execution/post-step.d.ts +20 -0
- package/dist/execution/post-step.js +65 -0
- package/dist/execution/reconcile-manifest.d.ts +25 -0
- package/dist/execution/reconcile-manifest.js +132 -0
- package/dist/execution/report-render.d.ts +39 -0
- package/dist/execution/report-render.js +98 -0
- package/dist/execution/report-runner.d.ts +87 -0
- package/dist/execution/report-runner.js +227 -0
- package/dist/execution/run-authorizer.d.ts +43 -0
- package/dist/execution/run-authorizer.js +17 -0
- package/dist/execution/run-launcher.d.ts +36 -0
- package/dist/execution/run-launcher.js +15 -0
- package/dist/execution/run-synthesis.d.ts +107 -0
- package/dist/execution/run-synthesis.js +329 -0
- package/dist/execution/staged-input.d.ts +41 -0
- package/dist/execution/staged-input.js +15 -0
- package/dist/execution/step-summary-metrics.d.ts +10 -0
- package/dist/execution/step-summary-metrics.js +22 -0
- package/dist/execution/step-summary.d.ts +55 -0
- package/dist/execution/step-summary.js +106 -0
- package/dist/execution/topo-sort.d.ts +33 -0
- package/dist/execution/topo-sort.js +99 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +157 -0
- package/dist/input-sanitization.d.ts +22 -0
- package/dist/input-sanitization.js +64 -0
- package/dist/lib/async-utils.d.ts +10 -0
- package/dist/lib/async-utils.js +24 -0
- package/dist/lib/chrome.d.ts +15 -0
- package/dist/lib/chrome.js +95 -0
- package/dist/lib/db-result.d.ts +93 -0
- package/dist/lib/db-result.js +197 -0
- package/dist/lib/fs-helpers.d.ts +74 -0
- package/dist/lib/fs-helpers.js +119 -0
- package/dist/lib/fs-result.d.ts +98 -0
- package/dist/lib/fs-result.js +137 -0
- package/dist/lib/host-concurrency.d.ts +16 -0
- package/dist/lib/host-concurrency.js +60 -0
- package/dist/lib/identifiers.d.ts +8 -0
- package/dist/lib/identifiers.js +10 -0
- package/dist/lib/metrics.d.ts +7 -0
- package/dist/lib/metrics.js +12 -0
- package/dist/lib/mime-detect.d.ts +17 -0
- package/dist/lib/mime-detect.js +29 -0
- package/dist/lib/otel.d.ts +30 -0
- package/dist/lib/otel.js +102 -0
- package/dist/lib/regulatory-corpus/fetch-fda-guidance.d.ts +35 -0
- package/dist/lib/regulatory-corpus/fetch-fda-guidance.js +107 -0
- package/dist/lib/regulatory-corpus/fetch-ich.d.ts +46 -0
- package/dist/lib/regulatory-corpus/fetch-ich.js +173 -0
- package/dist/lib/regulatory-corpus.d.ts +88 -0
- package/dist/lib/regulatory-corpus.js +141 -0
- package/dist/lib/result.d.ts +87 -0
- package/dist/lib/result.js +103 -0
- package/dist/lib/storage.d.ts +29 -0
- package/dist/lib/storage.js +37 -0
- package/dist/lib/streamed-download.d.ts +28 -0
- package/dist/lib/streamed-download.js +111 -0
- package/dist/lib/trace-context.d.ts +11 -0
- package/dist/lib/trace-context.js +49 -0
- package/dist/loop/__fixtures__/scripted-provider.d.ts +31 -0
- package/dist/loop/__fixtures__/scripted-provider.js +57 -0
- package/dist/loop/budget-exceeded.d.ts +22 -0
- package/dist/loop/budget-exceeded.js +41 -0
- package/dist/loop/metrics.d.ts +25 -0
- package/dist/loop/metrics.js +46 -0
- package/dist/loop/run-agent.d.ts +28 -0
- package/dist/loop/run-agent.js +204 -0
- package/dist/loop/run-step.d.ts +29 -0
- package/dist/loop/run-step.js +34 -0
- package/dist/loop/run-to-terminal.d.ts +46 -0
- package/dist/loop/run-to-terminal.js +51 -0
- package/dist/loop/types.d.ts +95 -0
- package/dist/loop/types.js +10 -0
- package/dist/memory/ai-sdk-message-storage.d.ts +20 -0
- package/dist/memory/ai-sdk-message-storage.js +114 -0
- package/dist/memory/card-builders.d.ts +114 -0
- package/dist/memory/card-builders.js +231 -0
- package/dist/memory/content-to-cortex.d.ts +42 -0
- package/dist/memory/content-to-cortex.js +85 -0
- package/dist/memory/count-tokens.d.ts +18 -0
- package/dist/memory/count-tokens.js +64 -0
- package/dist/memory/derive-thread-title.d.ts +14 -0
- package/dist/memory/derive-thread-title.js +26 -0
- package/dist/memory/message-backfill.d.ts +2 -0
- package/dist/memory/message-backfill.js +38 -0
- package/dist/memory/reconstruct-cards.d.ts +23 -0
- package/dist/memory/reconstruct-cards.js +64 -0
- package/dist/memory/thread-history.d.ts +80 -0
- package/dist/memory/thread-history.js +187 -0
- package/dist/memory/thread-store.d.ts +66 -0
- package/dist/memory/thread-store.js +88 -0
- package/dist/memory/working-memory.d.ts +135 -0
- package/dist/memory/working-memory.js +185 -0
- package/dist/prompts/SOUL.d.ts +17 -0
- package/dist/prompts/SOUL.js +173 -0
- package/dist/prompts/analogical-reasoner.d.ts +1 -0
- package/dist/prompts/analogical-reasoner.js +170 -0
- package/dist/prompts/conversation.d.ts +1 -0
- package/dist/prompts/conversation.js +697 -0
- package/dist/prompts/execute-analysis/step-summary.d.ts +1 -0
- package/dist/prompts/execute-analysis/step-summary.js +38 -0
- package/dist/prompts/literature-reviewer.d.ts +1 -0
- package/dist/prompts/literature-reviewer.js +107 -0
- package/dist/prompts/planner.d.ts +2 -0
- package/dist/prompts/planner.js +259 -0
- package/dist/prompts/report-builder.d.ts +1 -0
- package/dist/prompts/report-builder.js +127 -0
- package/dist/prompts/sandbox/bulk-transcriptomics-agent.d.ts +1 -0
- package/dist/prompts/sandbox/bulk-transcriptomics-agent.js +78 -0
- package/dist/prompts/sandbox/cheminformatics-agent.d.ts +1 -0
- package/dist/prompts/sandbox/cheminformatics-agent.js +224 -0
- package/dist/prompts/sandbox/chromatin-agent.d.ts +1 -0
- package/dist/prompts/sandbox/chromatin-agent.js +100 -0
- package/dist/prompts/sandbox/data-profiler.d.ts +1 -0
- package/dist/prompts/sandbox/data-profiler.js +291 -0
- package/dist/prompts/sandbox/dna-methylation-agent.d.ts +1 -0
- package/dist/prompts/sandbox/dna-methylation-agent.js +96 -0
- package/dist/prompts/sandbox/drug-repurposing-agent.d.ts +1 -0
- package/dist/prompts/sandbox/drug-repurposing-agent.js +144 -0
- package/dist/prompts/sandbox/enrichment-agent.d.ts +1 -0
- package/dist/prompts/sandbox/enrichment-agent.js +89 -0
- package/dist/prompts/sandbox/ephemeral-executor.d.ts +1 -0
- package/dist/prompts/sandbox/ephemeral-executor.js +66 -0
- package/dist/prompts/sandbox/genomic-variant-agent.d.ts +1 -0
- package/dist/prompts/sandbox/genomic-variant-agent.js +83 -0
- package/dist/prompts/sandbox/immune-profiling-agent.d.ts +1 -0
- package/dist/prompts/sandbox/immune-profiling-agent.js +101 -0
- package/dist/prompts/sandbox/metabolomics-agent.d.ts +1 -0
- package/dist/prompts/sandbox/metabolomics-agent.js +89 -0
- package/dist/prompts/sandbox/microbiome-agent.d.ts +1 -0
- package/dist/prompts/sandbox/microbiome-agent.js +109 -0
- package/dist/prompts/sandbox/multi-omics-integration-agent.d.ts +1 -0
- package/dist/prompts/sandbox/multi-omics-integration-agent.js +122 -0
- package/dist/prompts/sandbox/multimodal-sc-agent.d.ts +1 -0
- package/dist/prompts/sandbox/multimodal-sc-agent.js +90 -0
- package/dist/prompts/sandbox/network-agent.d.ts +1 -0
- package/dist/prompts/sandbox/network-agent.js +95 -0
- package/dist/prompts/sandbox/pkpd-clinical-response-agent.d.ts +1 -0
- package/dist/prompts/sandbox/pkpd-clinical-response-agent.js +71 -0
- package/dist/prompts/sandbox/proteomics-agent.d.ts +1 -0
- package/dist/prompts/sandbox/proteomics-agent.js +93 -0
- package/dist/prompts/sandbox/scientific-executor.d.ts +1 -0
- package/dist/prompts/sandbox/scientific-executor.js +68 -0
- package/dist/prompts/sandbox/single-cell-agent.d.ts +1 -0
- package/dist/prompts/sandbox/single-cell-agent.js +129 -0
- package/dist/prompts/sandbox/spatial-omics-agent.d.ts +1 -0
- package/dist/prompts/sandbox/spatial-omics-agent.js +94 -0
- package/dist/prompts/sandbox/statistical-modeling-agent.d.ts +1 -0
- package/dist/prompts/sandbox/statistical-modeling-agent.js +112 -0
- package/dist/prompts/sandbox/translational-safety-agent.d.ts +1 -0
- package/dist/prompts/sandbox/translational-safety-agent.js +105 -0
- package/dist/prompts/sandbox-standards.d.ts +18 -0
- package/dist/prompts/sandbox-standards.js +358 -0
- package/dist/prompts/synthesis-agent.d.ts +1 -0
- package/dist/prompts/synthesis-agent.js +289 -0
- package/dist/prompts/target-assessment/briefs/executive-recommendation.d.ts +1 -0
- package/dist/prompts/target-assessment/briefs/executive-recommendation.js +85 -0
- package/dist/prompts/target-assessment/briefs/index.d.ts +4 -0
- package/dist/prompts/target-assessment/briefs/index.js +4 -0
- package/dist/prompts/target-assessment/briefs/liability-bullets.d.ts +1 -0
- package/dist/prompts/target-assessment/briefs/liability-bullets.js +114 -0
- package/dist/prompts/target-assessment/briefs/target-organ-liabilities.d.ts +1 -0
- package/dist/prompts/target-assessment/briefs/target-organ-liabilities.js +29 -0
- package/dist/prompts/target-assessment/briefs/translational-commentary.d.ts +1 -0
- package/dist/prompts/target-assessment/briefs/translational-commentary.js +23 -0
- package/dist/prompts/target-assessment/drugs-in-class.d.ts +1 -0
- package/dist/prompts/target-assessment/drugs-in-class.js +29 -0
- package/dist/prompts/target-assessment/modulator-triage.d.ts +1 -0
- package/dist/prompts/target-assessment/modulator-triage.js +31 -0
- package/dist/prompts/target-assessment/off-target-annotator.d.ts +1 -0
- package/dist/prompts/target-assessment/off-target-annotator.js +28 -0
- package/dist/prompts/target-assessment/tox-voice/core.d.ts +1 -0
- package/dist/prompts/target-assessment/tox-voice/core.js +74 -0
- package/dist/prompts/target-assessment/tox-voice/critique.d.ts +7 -0
- package/dist/prompts/target-assessment/tox-voice/critique.js +109 -0
- package/dist/prompts/target-assessment/tox-voice/exemplars.d.ts +8 -0
- package/dist/prompts/target-assessment/tox-voice/exemplars.js +24 -0
- package/dist/prompts/target-assessment/tox-voice/index.d.ts +4 -0
- package/dist/prompts/target-assessment/tox-voice/index.js +4 -0
- package/dist/prompts/target-assessment/tox-voice/vocabulary.d.ts +15 -0
- package/dist/prompts/target-assessment/tox-voice/vocabulary.js +72 -0
- package/dist/provenance/collector.d.ts +148 -0
- package/dist/provenance/collector.js +296 -0
- package/dist/provenance/exec-frame.d.ts +36 -0
- package/dist/provenance/exec-frame.js +49 -0
- package/dist/provenance/types.d.ts +95 -0
- package/dist/provenance/types.js +64 -0
- package/dist/providers/__fixtures__/session.d.ts +16 -0
- package/dist/providers/__fixtures__/session.js +20 -0
- package/dist/providers/ai-sdk.d.ts +47 -0
- package/dist/providers/ai-sdk.js +142 -0
- package/dist/providers/anthropic.d.ts +22 -0
- package/dist/providers/anthropic.js +26 -0
- package/dist/providers/embedding.d.ts +32 -0
- package/dist/providers/embedding.js +42 -0
- package/dist/providers/errors.d.ts +80 -0
- package/dist/providers/errors.js +137 -0
- package/dist/providers/llm-capabilities.d.ts +33 -0
- package/dist/providers/llm-capabilities.js +58 -0
- package/dist/providers/streaming-chat.d.ts +23 -0
- package/dist/providers/streaming-chat.js +61 -0
- package/dist/providers/types.d.ts +59 -0
- package/dist/providers/types.js +8 -0
- package/dist/runtime/assemble.d.ts +68 -0
- package/dist/runtime/assemble.js +46 -0
- package/dist/runtime/boot.d.ts +73 -0
- package/dist/runtime/boot.js +65 -0
- package/dist/runtime/connection-budget.d.ts +48 -0
- package/dist/runtime/connection-budget.js +57 -0
- package/dist/runtime/dbos.d.ts +94 -0
- package/dist/runtime/dbos.js +160 -0
- package/dist/runtime/lifecycle.d.ts +12 -0
- package/dist/runtime/lifecycle.js +19 -0
- package/dist/runtime/pools.d.ts +25 -0
- package/dist/runtime/pools.js +30 -0
- package/dist/runtime/shutdown.d.ts +33 -0
- package/dist/runtime/shutdown.js +39 -0
- package/dist/sandbox/await-exec.d.ts +143 -0
- package/dist/sandbox/await-exec.js +406 -0
- package/dist/sandbox/client.d.ts +82 -0
- package/dist/sandbox/client.js +23 -0
- package/dist/sandbox/create-sandbox.d.ts +105 -0
- package/dist/sandbox/create-sandbox.js +132 -0
- package/dist/sandbox/deliver-exec-event.d.ts +25 -0
- package/dist/sandbox/deliver-exec-event.js +29 -0
- package/dist/sandbox/docker-client.d.ts +75 -0
- package/dist/sandbox/docker-client.js +315 -0
- package/dist/sandbox/estimate-data-profile-resources.d.ts +5 -0
- package/dist/sandbox/estimate-data-profile-resources.js +73 -0
- package/dist/sandbox/exec-id.d.ts +12 -0
- package/dist/sandbox/exec-id.js +20 -0
- package/dist/sandbox/execution-id.d.ts +30 -0
- package/dist/sandbox/execution-id.js +47 -0
- package/dist/sandbox/hmac.d.ts +54 -0
- package/dist/sandbox/hmac.js +67 -0
- package/dist/sandbox/identity.d.ts +15 -0
- package/dist/sandbox/identity.js +22 -0
- package/dist/sandbox/ignored-dirs.d.ts +7 -0
- package/dist/sandbox/ignored-dirs.js +7 -0
- package/dist/sandbox/k8s-client.d.ts +71 -0
- package/dist/sandbox/k8s-client.js +488 -0
- package/dist/sandbox/liveness.d.ts +60 -0
- package/dist/sandbox/liveness.js +82 -0
- package/dist/sandbox/mount-plan.d.ts +77 -0
- package/dist/sandbox/mount-plan.js +84 -0
- package/dist/sandbox/notification-sweep.d.ts +42 -0
- package/dist/sandbox/notification-sweep.js +74 -0
- package/dist/sandbox/reaper.d.ts +70 -0
- package/dist/sandbox/reaper.js +124 -0
- package/dist/sandbox/sandbox-error.d.ts +105 -0
- package/dist/sandbox/sandbox-error.js +92 -0
- package/dist/sandbox/sandbox-step-translate.d.ts +35 -0
- package/dist/sandbox/sandbox-step-translate.js +76 -0
- package/dist/sandbox/submit-exec.d.ts +33 -0
- package/dist/sandbox/submit-exec.js +68 -0
- package/dist/sandbox/types.d.ts +277 -0
- package/dist/sandbox/types.js +147 -0
- package/dist/sandbox/watchdog.d.ts +71 -0
- package/dist/sandbox/watchdog.js +150 -0
- package/dist/schemas/artifact-manifest.d.ts +34 -0
- package/dist/schemas/artifact-manifest.js +36 -0
- package/dist/schemas/data-profile-schemas.d.ts +92 -0
- package/dist/schemas/data-profile-schemas.js +89 -0
- package/dist/schemas/file-metadata.d.ts +51 -0
- package/dist/schemas/file-metadata.js +39 -0
- package/dist/schemas/plan-schemas.d.ts +110 -0
- package/dist/schemas/plan-schemas.js +50 -0
- package/dist/schemas/render-step-prompt.d.ts +32 -0
- package/dist/schemas/render-step-prompt.js +76 -0
- package/dist/schemas/run-synthesis.d.ts +148 -0
- package/dist/schemas/run-synthesis.js +87 -0
- package/dist/schemas/step-summary.d.ts +18 -0
- package/dist/schemas/step-summary.js +20 -0
- package/dist/schemas/validate-plan.d.ts +39 -0
- package/dist/schemas/validate-plan.js +120 -0
- package/dist/schemas/workflow-state.d.ts +314 -0
- package/dist/schemas/workflow-state.js +139 -0
- package/dist/state/active-sandboxes.d.ts +58 -0
- package/dist/state/active-sandboxes.js +100 -0
- package/dist/state/analyses-metrics.d.ts +21 -0
- package/dist/state/analyses-metrics.js +59 -0
- package/dist/state/analyses.d.ts +58 -0
- package/dist/state/analyses.js +132 -0
- package/dist/state/artifacts.d.ts +53 -0
- package/dist/state/artifacts.js +175 -0
- package/dist/state/data-profile.d.ts +176 -0
- package/dist/state/data-profile.js +284 -0
- package/dist/state/db.d.ts +10 -0
- package/dist/state/db.js +9 -0
- package/dist/state/index.d.ts +29 -0
- package/dist/state/index.js +20 -0
- package/dist/state/init.d.ts +14 -0
- package/dist/state/init.js +406 -0
- package/dist/state/plans.d.ts +56 -0
- package/dist/state/plans.js +117 -0
- package/dist/state/runs.d.ts +69 -0
- package/dist/state/runs.js +206 -0
- package/dist/state/schema.d.ts +150 -0
- package/dist/state/schema.js +100 -0
- package/dist/state/step-executions.d.ts +77 -0
- package/dist/state/step-executions.js +175 -0
- package/dist/state/target-assessments.d.ts +68 -0
- package/dist/state/target-assessments.js +222 -0
- package/dist/state/vector-store.d.ts +53 -0
- package/dist/state/vector-store.js +89 -0
- package/dist/tasks/data-profile.d.ts +171 -0
- package/dist/tasks/data-profile.js +461 -0
- package/dist/tasks/refresh-regulatory-corpus.d.ts +59 -0
- package/dist/tasks/refresh-regulatory-corpus.js +146 -0
- package/dist/tasks/regulatory-corpus-boot-refresh.d.ts +55 -0
- package/dist/tasks/regulatory-corpus-boot-refresh.js +149 -0
- package/dist/tools/__fixtures__/tool-context.d.ts +13 -0
- package/dist/tools/__fixtures__/tool-context.js +18 -0
- package/dist/tools/bio/check-safety-panel.d.ts +35 -0
- package/dist/tools/bio/check-safety-panel.js +76 -0
- package/dist/tools/bio/find-approval-precedent.d.ts +32 -0
- package/dist/tools/bio/find-approval-precedent.js +72 -0
- package/dist/tools/bio/get-article-details.d.ts +11 -0
- package/dist/tools/bio/get-article-details.js +20 -0
- package/dist/tools/bio/get-article-full-text.d.ts +19 -0
- package/dist/tools/bio/get-article-full-text.js +32 -0
- package/dist/tools/bio/get-bioactivity.d.ts +11 -0
- package/dist/tools/bio/get-bioactivity.js +23 -0
- package/dist/tools/bio/get-drug-info.d.ts +9 -0
- package/dist/tools/bio/get-drug-info.js +22 -0
- package/dist/tools/bio/get-impc-ko-profile.d.ts +9 -0
- package/dist/tools/bio/get-impc-ko-profile.js +20 -0
- package/dist/tools/bio/get-mechanism.d.ts +8 -0
- package/dist/tools/bio/get-mechanism.js +18 -0
- package/dist/tools/bio/get-pubchem-assays.d.ts +22 -0
- package/dist/tools/bio/get-pubchem-assays.js +107 -0
- package/dist/tools/bio/get-pubchem-cross-refs.d.ts +15 -0
- package/dist/tools/bio/get-pubchem-cross-refs.js +68 -0
- package/dist/tools/bio/get-target-safety.d.ts +18 -0
- package/dist/tools/bio/get-target-safety.js +26 -0
- package/dist/tools/bio/index.d.ts +41 -0
- package/dist/tools/bio/index.js +48 -0
- package/dist/tools/bio/keys.d.ts +31 -0
- package/dist/tools/bio/keys.js +30 -0
- package/dist/tools/bio/lookup-go-term.d.ts +31 -0
- package/dist/tools/bio/lookup-go-term.js +116 -0
- package/dist/tools/bio/search-bgee-expression.d.ts +10 -0
- package/dist/tools/bio/search-bgee-expression.js +24 -0
- package/dist/tools/bio/search-clinical-trials.d.ts +12 -0
- package/dist/tools/bio/search-clinical-trials.js +21 -0
- package/dist/tools/bio/search-clinvar.d.ts +13 -0
- package/dist/tools/bio/search-clinvar.js +28 -0
- package/dist/tools/bio/search-compounds.d.ts +22 -0
- package/dist/tools/bio/search-compounds.js +160 -0
- package/dist/tools/bio/search-ctx-chemical.d.ts +50 -0
- package/dist/tools/bio/search-ctx-chemical.js +130 -0
- package/dist/tools/bio/search-ctx-exposure.d.ts +55 -0
- package/dist/tools/bio/search-ctx-exposure.js +176 -0
- package/dist/tools/bio/search-ctx-hazard.d.ts +111 -0
- package/dist/tools/bio/search-ctx-hazard.js +178 -0
- package/dist/tools/bio/search-dgidb.d.ts +43 -0
- package/dist/tools/bio/search-dgidb.js +199 -0
- package/dist/tools/bio/search-disgenet.d.ts +30 -0
- package/dist/tools/bio/search-disgenet.js +84 -0
- package/dist/tools/bio/search-drugbank.d.ts +38 -0
- package/dist/tools/bio/search-drugbank.js +109 -0
- package/dist/tools/bio/search-faers.d.ts +11 -0
- package/dist/tools/bio/search-faers.js +23 -0
- package/dist/tools/bio/search-gene.d.ts +11 -0
- package/dist/tools/bio/search-gene.js +19 -0
- package/dist/tools/bio/search-geo-datasets.d.ts +20 -0
- package/dist/tools/bio/search-geo-datasets.js +86 -0
- package/dist/tools/bio/search-gwas-catalog.d.ts +33 -0
- package/dist/tools/bio/search-gwas-catalog.js +172 -0
- package/dist/tools/bio/search-interactions.d.ts +17 -0
- package/dist/tools/bio/search-interactions.js +31 -0
- package/dist/tools/bio/search-opentargets.d.ts +11 -0
- package/dist/tools/bio/search-opentargets.js +25 -0
- package/dist/tools/bio/search-pathway.d.ts +12 -0
- package/dist/tools/bio/search-pathway.js +32 -0
- package/dist/tools/bio/search-pharmgkb.d.ts +17 -0
- package/dist/tools/bio/search-pharmgkb.js +46 -0
- package/dist/tools/bio/search-pubchem-compound.d.ts +26 -0
- package/dist/tools/bio/search-pubchem-compound.js +110 -0
- package/dist/tools/bio/search-pubmed.d.ts +17 -0
- package/dist/tools/bio/search-pubmed.js +31 -0
- package/dist/tools/bio/search-targets.d.ts +9 -0
- package/dist/tools/bio/search-targets.js +20 -0
- package/dist/tools/bio/search-toxcast.d.ts +36 -0
- package/dist/tools/bio/search-toxcast.js +141 -0
- package/dist/tools/define-tool.d.ts +80 -0
- package/dist/tools/define-tool.js +48 -0
- package/dist/tools/display/index.d.ts +4 -0
- package/dist/tools/display/index.js +4 -0
- package/dist/tools/display/show-user.d.ts +33 -0
- package/dist/tools/display/show-user.js +67 -0
- package/dist/tools/execute-plan.d.ts +64 -0
- package/dist/tools/execute-plan.js +208 -0
- package/dist/tools/iterate-report.d.ts +172 -0
- package/dist/tools/iterate-report.js +521 -0
- package/dist/tools/lib/api-utils.d.ts +80 -0
- package/dist/tools/lib/api-utils.js +128 -0
- package/dist/tools/lib/bgee-client.d.ts +36 -0
- package/dist/tools/lib/bgee-client.js +150 -0
- package/dist/tools/lib/cbioportal-client.d.ts +34 -0
- package/dist/tools/lib/cbioportal-client.js +159 -0
- package/dist/tools/lib/chembl-client.d.ts +123 -0
- package/dist/tools/lib/chembl-client.js +458 -0
- package/dist/tools/lib/chembl-config.d.ts +5 -0
- package/dist/tools/lib/chembl-config.js +3 -0
- package/dist/tools/lib/clinical-benchmarks-client.d.ts +33 -0
- package/dist/tools/lib/clinical-benchmarks-client.js +54 -0
- package/dist/tools/lib/clinical-trials-client.d.ts +216 -0
- package/dist/tools/lib/clinical-trials-client.js +339 -0
- package/dist/tools/lib/clinicaltrials-config.d.ts +4 -0
- package/dist/tools/lib/clinicaltrials-config.js +2 -0
- package/dist/tools/lib/clinvar-client.d.ts +25 -0
- package/dist/tools/lib/clinvar-client.js +126 -0
- package/dist/tools/lib/disgenet-config.d.ts +2 -0
- package/dist/tools/lib/disgenet-config.js +11 -0
- package/dist/tools/lib/drugbank-config.d.ts +2 -0
- package/dist/tools/lib/drugbank-config.js +12 -0
- package/dist/tools/lib/ema-client.d.ts +45 -0
- package/dist/tools/lib/ema-client.js +127 -0
- package/dist/tools/lib/ema-config.d.ts +7 -0
- package/dist/tools/lib/ema-config.js +7 -0
- package/dist/tools/lib/ensembl-client.d.ts +27 -0
- package/dist/tools/lib/ensembl-client.js +82 -0
- package/dist/tools/lib/gwas-catalog-config.d.ts +4 -0
- package/dist/tools/lib/gwas-catalog-config.js +2 -0
- package/dist/tools/lib/identifier-resolver.d.ts +85 -0
- package/dist/tools/lib/identifier-resolver.js +333 -0
- package/dist/tools/lib/impc-client.d.ts +44 -0
- package/dist/tools/lib/impc-client.js +239 -0
- package/dist/tools/lib/iuphar-client.d.ts +75 -0
- package/dist/tools/lib/iuphar-client.js +230 -0
- package/dist/tools/lib/iuphar-config.d.ts +5 -0
- package/dist/tools/lib/iuphar-config.js +3 -0
- package/dist/tools/lib/ncbi-utils.d.ts +58 -0
- package/dist/tools/lib/ncbi-utils.js +286 -0
- package/dist/tools/lib/openfda-client.d.ts +53 -0
- package/dist/tools/lib/openfda-client.js +192 -0
- package/dist/tools/lib/openfda-config.d.ts +2 -0
- package/dist/tools/lib/openfda-config.js +2 -0
- package/dist/tools/lib/opentargets-client.d.ts +64 -0
- package/dist/tools/lib/opentargets-client.js +290 -0
- package/dist/tools/lib/opentargets-config.d.ts +5 -0
- package/dist/tools/lib/opentargets-config.js +5 -0
- package/dist/tools/lib/path-validation.d.ts +14 -0
- package/dist/tools/lib/path-validation.js +26 -0
- package/dist/tools/lib/pathway-client.d.ts +27 -0
- package/dist/tools/lib/pathway-client.js +149 -0
- package/dist/tools/lib/pharmgkb-config.d.ts +4 -0
- package/dist/tools/lib/pharmgkb-config.js +2 -0
- package/dist/tools/lib/preview-lock.d.ts +20 -0
- package/dist/tools/lib/preview-lock.js +35 -0
- package/dist/tools/lib/protein-family-modality.d.ts +16 -0
- package/dist/tools/lib/protein-family-modality.js +42 -0
- package/dist/tools/lib/protein-family-normalize.d.ts +12 -0
- package/dist/tools/lib/protein-family-normalize.js +46 -0
- package/dist/tools/lib/pubchem-client.d.ts +40 -0
- package/dist/tools/lib/pubchem-client.js +128 -0
- package/dist/tools/lib/pubchem-config.d.ts +5 -0
- package/dist/tools/lib/pubchem-config.js +3 -0
- package/dist/tools/lib/pubmed-client.d.ts +28 -0
- package/dist/tools/lib/pubmed-client.js +91 -0
- package/dist/tools/lib/report-preflight.d.ts +39 -0
- package/dist/tools/lib/report-preflight.js +283 -0
- package/dist/tools/lib/string-client.d.ts +33 -0
- package/dist/tools/lib/string-client.js +93 -0
- package/dist/tools/lib/toxcast-config.d.ts +2 -0
- package/dist/tools/lib/toxcast-config.js +11 -0
- package/dist/tools/lib/uniprot-client.d.ts +28 -0
- package/dist/tools/lib/uniprot-client.js +103 -0
- package/dist/tools/lib/uniprot-config.d.ts +5 -0
- package/dist/tools/lib/uniprot-config.js +3 -0
- package/dist/tools/memory/index.d.ts +4 -0
- package/dist/tools/memory/index.js +4 -0
- package/dist/tools/memory/update-working-memory.d.ts +25 -0
- package/dist/tools/memory/update-working-memory.js +112 -0
- package/dist/tools/registry.d.ts +15 -0
- package/dist/tools/registry.js +26 -0
- package/dist/tools/report/build-report.d.ts +13 -0
- package/dist/tools/report/build-report.js +26 -0
- package/dist/tools/report/index.d.ts +14 -0
- package/dist/tools/report/index.js +14 -0
- package/dist/tools/report/mint-preview-url.d.ts +26 -0
- package/dist/tools/report/mint-preview-url.js +44 -0
- package/dist/tools/report/preview-publisher.d.ts +37 -0
- package/dist/tools/report/preview-publisher.js +25 -0
- package/dist/tools/report/preview-snapshot.d.ts +26 -0
- package/dist/tools/report/preview-snapshot.js +121 -0
- package/dist/tools/report/submit-report.d.ts +25 -0
- package/dist/tools/report/submit-report.js +126 -0
- package/dist/tools/report/version-fs.d.ts +15 -0
- package/dist/tools/report/version-fs.js +154 -0
- package/dist/tools/research/context7-docs.d.ts +31 -0
- package/dist/tools/research/context7-docs.js +61 -0
- package/dist/tools/research/generate-analogy-report.d.ts +60 -0
- package/dist/tools/research/generate-analogy-report.js +288 -0
- package/dist/tools/research/generate-plan.d.ts +39 -0
- package/dist/tools/research/generate-plan.js +393 -0
- package/dist/tools/research/index.d.ts +15 -0
- package/dist/tools/research/index.js +15 -0
- package/dist/tools/research/inspect-run.d.ts +54 -0
- package/dist/tools/research/inspect-run.js +85 -0
- package/dist/tools/research/literature-reviewer.d.ts +29 -0
- package/dist/tools/research/literature-reviewer.js +84 -0
- package/dist/tools/research/search-arxiv.d.ts +32 -0
- package/dist/tools/research/search-arxiv.js +123 -0
- package/dist/tools/research/search-github-repos.d.ts +32 -0
- package/dist/tools/research/search-github-repos.js +86 -0
- package/dist/tools/research/search-semantic-scholar.d.ts +33 -0
- package/dist/tools/research/search-semantic-scholar.js +93 -0
- package/dist/tools/run-ephemeral.d.ts +33 -0
- package/dist/tools/run-ephemeral.js +65 -0
- package/dist/tools/sandbox/index.d.ts +7 -0
- package/dist/tools/sandbox/index.js +7 -0
- package/dist/tools/sandbox/list-available-packages.d.ts +7 -0
- package/dist/tools/sandbox/list-available-packages.js +27 -0
- package/dist/tools/sandbox/list-available-refs.d.ts +7 -0
- package/dist/tools/sandbox/list-available-refs.js +147 -0
- package/dist/tools/sandbox/report-blocker.d.ts +23 -0
- package/dist/tools/sandbox/report-blocker.js +39 -0
- package/dist/tools/sandbox/skills.d.ts +72 -0
- package/dist/tools/sandbox/skills.js +144 -0
- package/dist/tools/workspace/edit-file.d.ts +46 -0
- package/dist/tools/workspace/edit-file.js +100 -0
- package/dist/tools/workspace/execute-command.d.ts +80 -0
- package/dist/tools/workspace/execute-command.js +95 -0
- package/dist/tools/workspace/file-stat.d.ts +24 -0
- package/dist/tools/workspace/file-stat.js +37 -0
- package/dist/tools/workspace/grep.d.ts +57 -0
- package/dist/tools/workspace/grep.js +154 -0
- package/dist/tools/workspace/index.d.ts +26 -0
- package/dist/tools/workspace/index.js +27 -0
- package/dist/tools/workspace/list-files.d.ts +24 -0
- package/dist/tools/workspace/list-files.js +38 -0
- package/dist/tools/workspace/mutator.d.ts +83 -0
- package/dist/tools/workspace/mutator.js +81 -0
- package/dist/tools/workspace/read-file.d.ts +39 -0
- package/dist/tools/workspace/read-file.js +93 -0
- package/dist/tools/workspace/result-bounds.d.ts +42 -0
- package/dist/tools/workspace/result-bounds.js +50 -0
- package/dist/tools/workspace/run-exec.d.ts +32 -0
- package/dist/tools/workspace/run-exec.js +34 -0
- package/dist/tools/workspace/show-file.d.ts +37 -0
- package/dist/tools/workspace/show-file.js +54 -0
- package/dist/tools/workspace/show-plan.d.ts +23 -0
- package/dist/tools/workspace/show-plan.js +44 -0
- package/dist/tools/workspace/workspace-search.d.ts +25 -0
- package/dist/tools/workspace/workspace-search.js +78 -0
- package/dist/tools/workspace/write-file.d.ts +16 -0
- package/dist/tools/workspace/write-file.js +33 -0
- package/dist/workflows/execute-analysis-scheduler.d.ts +94 -0
- package/dist/workflows/execute-analysis-scheduler.js +186 -0
- package/dist/workflows/execute-analysis.d.ts +271 -0
- package/dist/workflows/execute-analysis.js +746 -0
- package/dist/workflows/execute-target-assessment.d.ts +101 -0
- package/dist/workflows/execute-target-assessment.js +528 -0
- package/dist/workflows/metrics.d.ts +37 -0
- package/dist/workflows/metrics.js +55 -0
- package/dist/workflows/plan/level.d.ts +12 -0
- package/dist/workflows/plan/level.js +12 -0
- package/dist/workflows/register-workflows.d.ts +51 -0
- package/dist/workflows/register-workflows.js +48 -0
- package/dist/workflows/resume-execute-analysis.d.ts +70 -0
- package/dist/workflows/resume-execute-analysis.js +80 -0
- package/dist/workflows/sandbox-step.d.ts +243 -0
- package/dist/workflows/sandbox-step.js +573 -0
- package/dist/workflows/target-assessment/assemblers/index.d.ts +5 -0
- package/dist/workflows/target-assessment/assemblers/index.js +4 -0
- package/dist/workflows/target-assessment/assemblers/literature.d.ts +299 -0
- package/dist/workflows/target-assessment/assemblers/literature.js +987 -0
- package/dist/workflows/target-assessment/assemblers/orchestrator.d.ts +109 -0
- package/dist/workflows/target-assessment/assemblers/orchestrator.js +835 -0
- package/dist/workflows/target-assessment/assemblers/safety.d.ts +352 -0
- package/dist/workflows/target-assessment/assemblers/safety.js +985 -0
- package/dist/workflows/target-assessment/assemblers/trials.d.ts +30 -0
- package/dist/workflows/target-assessment/assemblers/trials.js +75 -0
- package/dist/workflows/target-assessment/collectors/index.d.ts +105 -0
- package/dist/workflows/target-assessment/collectors/index.js +468 -0
- package/dist/workflows/target-assessment/correction-loop.d.ts +45 -0
- package/dist/workflows/target-assessment/correction-loop.js +62 -0
- package/dist/workflows/target-assessment/coverage.d.ts +81 -0
- package/dist/workflows/target-assessment/coverage.js +82 -0
- package/dist/workflows/target-assessment/decisions/index.d.ts +86 -0
- package/dist/workflows/target-assessment/decisions/index.js +127 -0
- package/dist/workflows/target-assessment/fanout/index.d.ts +31 -0
- package/dist/workflows/target-assessment/fanout/index.js +155 -0
- package/dist/workflows/target-assessment/lib/approval-precedents.d.ts +52 -0
- package/dist/workflows/target-assessment/lib/approval-precedents.js +119 -0
- package/dist/workflows/target-assessment/lib/citation-validator.d.ts +46 -0
- package/dist/workflows/target-assessment/lib/citation-validator.js +316 -0
- package/dist/workflows/target-assessment/lib/clinical-consequence-annotator.d.ts +62 -0
- package/dist/workflows/target-assessment/lib/clinical-consequence-annotator.js +172 -0
- package/dist/workflows/target-assessment/lib/clinical-evidence-attribution.d.ts +45 -0
- package/dist/workflows/target-assessment/lib/clinical-evidence-attribution.js +156 -0
- package/dist/workflows/target-assessment/lib/compute-derived.d.ts +19 -0
- package/dist/workflows/target-assessment/lib/compute-derived.js +252 -0
- package/dist/workflows/target-assessment/lib/compute-selectivity.d.ts +15 -0
- package/dist/workflows/target-assessment/lib/compute-selectivity.js +18 -0
- package/dist/workflows/target-assessment/lib/dedup-modulators.d.ts +37 -0
- package/dist/workflows/target-assessment/lib/dedup-modulators.js +157 -0
- package/dist/workflows/target-assessment/lib/evidence-conflict-detector.d.ts +17 -0
- package/dist/workflows/target-assessment/lib/evidence-conflict-detector.js +100 -0
- package/dist/workflows/target-assessment/lib/expression-constants.d.ts +21 -0
- package/dist/workflows/target-assessment/lib/expression-constants.js +21 -0
- package/dist/workflows/target-assessment/lib/family-complex-supplement.d.ts +21 -0
- package/dist/workflows/target-assessment/lib/family-complex-supplement.js +37 -0
- package/dist/workflows/target-assessment/lib/heterodimer-filter.d.ts +39 -0
- package/dist/workflows/target-assessment/lib/heterodimer-filter.js +54 -0
- package/dist/workflows/target-assessment/lib/intended-polypharm-filter.d.ts +4 -0
- package/dist/workflows/target-assessment/lib/intended-polypharm-filter.js +24 -0
- package/dist/workflows/target-assessment/lib/llm-step.d.ts +77 -0
- package/dist/workflows/target-assessment/lib/llm-step.js +99 -0
- package/dist/workflows/target-assessment/lib/meddra-organ-map.d.ts +30 -0
- package/dist/workflows/target-assessment/lib/meddra-organ-map.js +126 -0
- package/dist/workflows/target-assessment/lib/recommendation-quality-gates.d.ts +17 -0
- package/dist/workflows/target-assessment/lib/recommendation-quality-gates.js +99 -0
- package/dist/workflows/target-assessment/lib/recommendation-sanitizer.d.ts +2 -0
- package/dist/workflows/target-assessment/lib/recommendation-sanitizer.js +51 -0
- package/dist/workflows/target-assessment/lib/regulatory-actions.d.ts +26 -0
- package/dist/workflows/target-assessment/lib/regulatory-actions.js +147 -0
- package/dist/workflows/target-assessment/lib/structured-llm.d.ts +58 -0
- package/dist/workflows/target-assessment/lib/structured-llm.js +101 -0
- package/dist/workflows/target-assessment/lib/target-identity-filter.d.ts +60 -0
- package/dist/workflows/target-assessment/lib/target-identity-filter.js +86 -0
- package/dist/workflows/target-assessment/lib/therapeutic-programs.d.ts +20 -0
- package/dist/workflows/target-assessment/lib/therapeutic-programs.js +68 -0
- package/dist/workflows/target-assessment/metrics.d.ts +21 -0
- package/dist/workflows/target-assessment/metrics.js +42 -0
- package/dist/workflows/target-assessment/phase4-assemble.d.ts +1841 -0
- package/dist/workflows/target-assessment/phase4-assemble.js +39 -0
- package/dist/workflows/target-assessment/phase5-persist.d.ts +57 -0
- package/dist/workflows/target-assessment/phase5-persist.js +461 -0
- package/dist/workflows/target-assessment/progress.d.ts +38 -0
- package/dist/workflows/target-assessment/progress.js +76 -0
- package/dist/workflows/target-assessment/schemas.d.ts +931 -0
- package/dist/workflows/target-assessment/schemas.js +293 -0
- package/dist/workflows/target-assessment/steps/collectors/pathways.d.ts +15 -0
- package/dist/workflows/target-assessment/steps/collectors/pathways.js +58 -0
- package/dist/workflows/target-assessment/steps/fanout/aes-for-one-class-drug-step.d.ts +34 -0
- package/dist/workflows/target-assessment/steps/fanout/aes-for-one-class-drug-step.js +31 -0
- package/dist/workflows/target-assessment/steps/fanout/aes-for-one-trial-step.d.ts +57 -0
- package/dist/workflows/target-assessment/steps/fanout/aes-for-one-trial-step.js +54 -0
- package/dist/workflows/target-assessment/steps/fanout/faers-for-one-modulator-step.d.ts +35 -0
- package/dist/workflows/target-assessment/steps/fanout/faers-for-one-modulator-step.js +32 -0
- package/dist/workflows/target-assessment/steps/fanout/index.d.ts +14 -0
- package/dist/workflows/target-assessment/steps/fanout/index.js +10 -0
- package/dist/workflows/target-assessment/steps/fanout/polypharm-for-one-modulator-step.d.ts +28 -0
- package/dist/workflows/target-assessment/steps/fanout/polypharm-for-one-modulator-step.js +27 -0
- package/dist/workflows/target-assessment/steps/phase0-resolve.d.ts +71 -0
- package/dist/workflows/target-assessment/steps/phase0-resolve.js +21 -0
- package/dist/workflows/target-assessment/steps/phase1-aggregate.d.ts +1018 -0
- package/dist/workflows/target-assessment/steps/phase1-aggregate.js +25 -0
- package/dist/workflows/target-assessment/steps/phase2-aggregate.d.ts +696 -0
- package/dist/workflows/target-assessment/steps/phase2-aggregate.js +38 -0
- package/dist/workflows/target-assessment/steps/phase3-aggregate.d.ts +936 -0
- package/dist/workflows/target-assessment/steps/phase3-aggregate.js +22 -0
- package/dist/workflows/target-assessment/steps/synthesis/diagnostics.d.ts +34 -0
- package/dist/workflows/target-assessment/steps/synthesis/diagnostics.js +45 -0
- package/dist/workflows/target-assessment/sub-workflows/index.d.ts +15 -0
- package/dist/workflows/target-assessment/sub-workflows/index.js +11 -0
- package/dist/workflows/target-assessment/sub-workflows/per-class-drug-aes.d.ts +41 -0
- package/dist/workflows/target-assessment/sub-workflows/per-class-drug-aes.js +12 -0
- package/dist/workflows/target-assessment/sub-workflows/per-modulator-faers.d.ts +41 -0
- package/dist/workflows/target-assessment/sub-workflows/per-modulator-faers.js +12 -0
- package/dist/workflows/target-assessment/sub-workflows/per-modulator-polypharm.d.ts +36 -0
- package/dist/workflows/target-assessment/sub-workflows/per-modulator-polypharm.js +12 -0
- package/dist/workflows/target-assessment/sub-workflows/per-trial-aes.d.ts +66 -0
- package/dist/workflows/target-assessment/sub-workflows/per-trial-aes.js +12 -0
- package/dist/workflows/target-assessment/synthesis/index.d.ts +560 -0
- package/dist/workflows/target-assessment/synthesis/index.js +351 -0
- package/dist/workflows/target-assessment/synthesis-probes.d.ts +56 -0
- package/dist/workflows/target-assessment/synthesis-probes.js +320 -0
- package/dist/workspace/filesystem.d.ts +117 -0
- package/dist/workspace/filesystem.js +304 -0
- package/dist/workspace/mount-strategy.d.ts +50 -0
- package/dist/workspace/mount-strategy.js +67 -0
- package/dist/workspace/paths.d.ts +185 -0
- package/dist/workspace/paths.js +219 -0
- package/dist/workspace/provenance-collector.d.ts +34 -0
- package/dist/workspace/provenance-collector.js +16 -0
- package/dist/workspace/search-config.d.ts +23 -0
- package/dist/workspace/search-config.js +43 -0
- package/dist/workspace/workspace-paths.d.ts +26 -0
- package/dist/workspace/workspace-paths.js +31 -0
- package/package.json +101 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-row LLM clinical-consequence annotator with Postgres caching.
|
|
3
|
+
*
|
|
4
|
+
* Any off-target row missing a `clinical_consequence` gets annotated by a
|
|
5
|
+
* focused tool-less LLM specialist that returns ONE sentence + provenance.
|
|
6
|
+
* Results are cached in `cortex_off_target_annotations` keyed by
|
|
7
|
+
* (primary_target_gene, off_target_key) so repeat assessments reuse prior
|
|
8
|
+
* work.
|
|
9
|
+
*
|
|
10
|
+
* Cache miss path: when a `deps` bundle is supplied, build a compact JSON
|
|
11
|
+
* prompt, run a single-shot harness agent loop (no tools, max 2 iterations),
|
|
12
|
+
* parse JSON out of the final assistant text, INSERT on success, return the
|
|
13
|
+
* consequence. With no `deps`, the function returns null on cache miss
|
|
14
|
+
* (no LLM call). Cache hit path: a single primary-key lookup, no LLM call.
|
|
15
|
+
* Per-row failures (LLM, schema validation, DB) are swallowed — annotation
|
|
16
|
+
* is supplementary; the dossier renders fine with null.
|
|
17
|
+
*/
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import { withHost } from "../../../lib/host-concurrency.js";
|
|
20
|
+
import { tryQuery, tryMutation } from "../../../lib/db-result.js";
|
|
21
|
+
import { offTargetAnnotatorPrompt } from "../../../prompts/target-assessment/off-target-annotator.js";
|
|
22
|
+
import { forSubAgent } from "../../../auth/types.js";
|
|
23
|
+
import { finalText, runAgent } from "../../../loop/run-agent.js";
|
|
24
|
+
import { passthroughStep } from "../../../loop/run-step.js";
|
|
25
|
+
export const OffTargetAnnotationSchema = z.object({
|
|
26
|
+
clinical_consequence: z.string().min(10),
|
|
27
|
+
provenance: z.string().min(3),
|
|
28
|
+
});
|
|
29
|
+
function cacheKey(input) {
|
|
30
|
+
const id = input.offTargetId?.trim();
|
|
31
|
+
if (id)
|
|
32
|
+
return id;
|
|
33
|
+
const name = input.offTargetName.trim().toLowerCase();
|
|
34
|
+
return name ? `name:${name}` : null;
|
|
35
|
+
}
|
|
36
|
+
async function readCache(pool, primaryTargetGene, key) {
|
|
37
|
+
// Annotation is supplementary — a cache-read failure must NOT surface. The
|
|
38
|
+
// `DbError` is collapsed to `null` (treated as a cache miss) via `.unwrapOr`.
|
|
39
|
+
return tryQuery("offTargetAnnotations.readCache", async () => {
|
|
40
|
+
const res = await pool.query(`SELECT clinical_consequence, provenance
|
|
41
|
+
FROM cortex_off_target_annotations
|
|
42
|
+
WHERE primary_target_gene = $1 AND off_target_key = $2
|
|
43
|
+
LIMIT 1`, [primaryTargetGene, key]);
|
|
44
|
+
if (res.rows.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
const row = res.rows[0];
|
|
47
|
+
return {
|
|
48
|
+
clinical_consequence: row.clinical_consequence,
|
|
49
|
+
provenance: row.provenance ?? "",
|
|
50
|
+
};
|
|
51
|
+
}).unwrapOr(null);
|
|
52
|
+
}
|
|
53
|
+
async function writeCache(pool, primaryTargetGene, key, offTargetName, annotation, model) {
|
|
54
|
+
// Cache-write failures must not affect the assembly result — the `DbError`
|
|
55
|
+
// is swallowed (both branches no-op) so annotation never surfaces a DB fault.
|
|
56
|
+
await tryMutation("offTargetAnnotations.writeCache", async () => {
|
|
57
|
+
await pool.query(`INSERT INTO cortex_off_target_annotations
|
|
58
|
+
(primary_target_gene, off_target_key, off_target_name, clinical_consequence, provenance, model)
|
|
59
|
+
VALUES ($1, $2, $3, $4, $5, $6)
|
|
60
|
+
ON CONFLICT (primary_target_gene, off_target_key) DO NOTHING`, [primaryTargetGene, key, offTargetName, annotation.clinical_consequence, annotation.provenance, model]);
|
|
61
|
+
}).match(() => { }, () => { });
|
|
62
|
+
}
|
|
63
|
+
function buildPrompt(input) {
|
|
64
|
+
return JSON.stringify({
|
|
65
|
+
primary_target_gene: input.primaryTargetGene,
|
|
66
|
+
off_target_id: input.offTargetId,
|
|
67
|
+
off_target_name: input.offTargetName,
|
|
68
|
+
off_target_accession: input.offTargetAccession,
|
|
69
|
+
pchembl: input.pchembl,
|
|
70
|
+
context: input.context ?? null,
|
|
71
|
+
}, null, 2);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Best-effort JSON extraction from an LLM text response. Strips fenced
|
|
75
|
+
* code blocks and surrounding prose so a slightly-out-of-spec reply still
|
|
76
|
+
* parses.
|
|
77
|
+
*/
|
|
78
|
+
function extractJsonObject(text) {
|
|
79
|
+
const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
80
|
+
const candidate = fenced ? fenced[1] : text;
|
|
81
|
+
const start = candidate.indexOf("{");
|
|
82
|
+
const end = candidate.lastIndexOf("}");
|
|
83
|
+
if (start === -1 || end === -1 || end < start)
|
|
84
|
+
return null;
|
|
85
|
+
try {
|
|
86
|
+
return JSON.parse(candidate.slice(start, end + 1));
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const ANNOTATOR_AGENT_ID = "off-target-annotator";
|
|
93
|
+
function buildAnnotatorAgent(model) {
|
|
94
|
+
return {
|
|
95
|
+
id: ANNOTATOR_AGENT_ID,
|
|
96
|
+
systemPrompt: offTargetAnnotatorPrompt,
|
|
97
|
+
model,
|
|
98
|
+
tools: [],
|
|
99
|
+
maxIterations: 2,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Annotate a single off-target row. Returns null on any failure (cache
|
|
104
|
+
* miss + no deps, cache miss + LLM unavailable, schema validation failure,
|
|
105
|
+
* DB unreachable, etc.) — callers must treat null as "no annotation" and
|
|
106
|
+
* leave `clinical_consequence` as their original fallback.
|
|
107
|
+
*/
|
|
108
|
+
export async function annotateClinicalConsequence(pool, input, deps) {
|
|
109
|
+
if (!input.primaryTargetGene)
|
|
110
|
+
return null;
|
|
111
|
+
const key = cacheKey(input);
|
|
112
|
+
if (!key)
|
|
113
|
+
return null;
|
|
114
|
+
const cached = await readCache(pool, input.primaryTargetGene, key);
|
|
115
|
+
if (cached)
|
|
116
|
+
return cached;
|
|
117
|
+
if (!deps)
|
|
118
|
+
return null;
|
|
119
|
+
try {
|
|
120
|
+
const agent = buildAnnotatorAgent(deps.model);
|
|
121
|
+
const session = forSubAgent(deps.session, ANNOTATOR_AGENT_ID);
|
|
122
|
+
const controller = new AbortController();
|
|
123
|
+
const { messages } = await runAgent(agent, [{ role: "user", content: buildPrompt(input) }], session, {
|
|
124
|
+
provider: deps.provider,
|
|
125
|
+
signal: controller.signal,
|
|
126
|
+
emit: () => { },
|
|
127
|
+
runStep: passthroughStep,
|
|
128
|
+
});
|
|
129
|
+
const raw = extractJsonObject(finalText(messages));
|
|
130
|
+
if (raw === null)
|
|
131
|
+
return null;
|
|
132
|
+
const parsed = OffTargetAnnotationSchema.safeParse(raw);
|
|
133
|
+
if (!parsed.success)
|
|
134
|
+
return null;
|
|
135
|
+
await writeCache(pool, input.primaryTargetGene, key, input.offTargetName, parsed.data, deps.model);
|
|
136
|
+
return parsed.data;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Annotate every row in an off-target panel whose `clinical_consequence`
|
|
144
|
+
* is currently null. Mutates the supplied arrays in-place. Pure assembly-
|
|
145
|
+
* time helper — no return value.
|
|
146
|
+
*
|
|
147
|
+
* Per-row LLM calls are bounded by the "annotation-llm" host budget (4 in
|
|
148
|
+
* flight). Cache hits skip the LLM entirely and consume only a cheap
|
|
149
|
+
* Postgres lookup, so the budget gate is held briefly for those rows.
|
|
150
|
+
* Without `deps`, the panel is annotated cache-only — rows missing a
|
|
151
|
+
* cached entry remain with their original fallback.
|
|
152
|
+
*/
|
|
153
|
+
export async function annotateOffTargetPanel(pool, panel, primaryTargetGene, deps) {
|
|
154
|
+
if (!primaryTargetGene)
|
|
155
|
+
return;
|
|
156
|
+
const allRows = [...panel.rows, ...panel.excluded_rows];
|
|
157
|
+
const needsAnnotation = allRows.filter((r) => r && (r.clinical_consequence == null || r.clinical_consequence === ""));
|
|
158
|
+
if (needsAnnotation.length === 0)
|
|
159
|
+
return;
|
|
160
|
+
await Promise.all(needsAnnotation.map((r) => withHost("annotation-llm", async () => {
|
|
161
|
+
const annotation = await annotateClinicalConsequence(pool, {
|
|
162
|
+
primaryTargetGene,
|
|
163
|
+
offTargetId: typeof r.off_target_id === "string" ? r.off_target_id : null,
|
|
164
|
+
offTargetName: typeof r.off_target_name === "string" ? r.off_target_name : "",
|
|
165
|
+
offTargetAccession: typeof r.accession === "string" ? r.accession : null,
|
|
166
|
+
pchembl: typeof r.pchembl === "number" ? r.pchembl : 0,
|
|
167
|
+
context: r.relationship === "obligate_cofactor" ? "obligate cofactor with the primary protein" : undefined,
|
|
168
|
+
}, deps);
|
|
169
|
+
if (annotation)
|
|
170
|
+
r.clinical_consequence = annotation.clinical_consequence;
|
|
171
|
+
})));
|
|
172
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ClinicalTrialAttributionV5, ClinicalTrialRowV5 } from "@inflexa-ai/harness/contracts/target-dossier.js";
|
|
2
|
+
type TrialLike = {
|
|
3
|
+
nctId: string;
|
|
4
|
+
title: string;
|
|
5
|
+
officialTitle?: string | null;
|
|
6
|
+
conditions?: string[];
|
|
7
|
+
interventions?: string[];
|
|
8
|
+
interventionDetails?: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
type?: string | null;
|
|
11
|
+
description?: string | null;
|
|
12
|
+
otherNames?: string[];
|
|
13
|
+
}>;
|
|
14
|
+
studyType?: string | null;
|
|
15
|
+
primaryPurpose?: string | null;
|
|
16
|
+
briefSummary?: string | null;
|
|
17
|
+
detailedDescription?: string | null;
|
|
18
|
+
};
|
|
19
|
+
export type KnownClassDrug = {
|
|
20
|
+
name: string;
|
|
21
|
+
moleculeChemblId?: string | null;
|
|
22
|
+
targetUniprots?: string[];
|
|
23
|
+
};
|
|
24
|
+
export type TherapeuticProgram = {
|
|
25
|
+
programId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
targetSymbol: string;
|
|
28
|
+
targetUniprot?: string | null;
|
|
29
|
+
modality?: string | null;
|
|
30
|
+
nctIds?: string[];
|
|
31
|
+
};
|
|
32
|
+
export type ClinicalEvidenceAttributionContext = {
|
|
33
|
+
assessmentSymbol: string;
|
|
34
|
+
assessmentUniprot: string;
|
|
35
|
+
familyUniprots: string[];
|
|
36
|
+
knownClassDrugs: KnownClassDrug[];
|
|
37
|
+
therapeuticPrograms: TherapeuticProgram[];
|
|
38
|
+
};
|
|
39
|
+
export type ClinicalEvidenceAttributionResult = {
|
|
40
|
+
attribution: ClinicalTrialAttributionV5;
|
|
41
|
+
eligible_for_toxicology_aggregation: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare function classifyClinicalEvidenceTrial(trial: TrialLike, ctx: ClinicalEvidenceAttributionContext): ClinicalEvidenceAttributionResult;
|
|
44
|
+
export declare function attachClinicalEvidenceAttribution<T extends TrialLike>(trial: T, ctx: ClinicalEvidenceAttributionContext): T & Pick<ClinicalTrialRowV5, "attribution" | "eligible_for_toxicology_aggregation">;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
function normalize(text) {
|
|
2
|
+
return text
|
|
3
|
+
.toUpperCase()
|
|
4
|
+
.replace(/[^A-Z0-9]+/g, " ")
|
|
5
|
+
.trim();
|
|
6
|
+
}
|
|
7
|
+
function tokenMatch(haystack, needle) {
|
|
8
|
+
const h = ` ${normalize(haystack)} `;
|
|
9
|
+
const n = normalize(needle);
|
|
10
|
+
if (!n)
|
|
11
|
+
return false;
|
|
12
|
+
return h.includes(` ${n} `);
|
|
13
|
+
}
|
|
14
|
+
function trialText(trial) {
|
|
15
|
+
return [
|
|
16
|
+
trial.title,
|
|
17
|
+
trial.officialTitle,
|
|
18
|
+
...(trial.conditions ?? []),
|
|
19
|
+
...(trial.interventions ?? []),
|
|
20
|
+
...(trial.interventionDetails ?? []).flatMap((i) => [i.name, i.description, ...(i.otherNames ?? [])]),
|
|
21
|
+
trial.briefSummary,
|
|
22
|
+
trial.detailedDescription,
|
|
23
|
+
]
|
|
24
|
+
.filter((v) => typeof v === "string" && v.length > 0)
|
|
25
|
+
.join(" ");
|
|
26
|
+
}
|
|
27
|
+
function interventionDetails(trial) {
|
|
28
|
+
if (trial.interventionDetails && trial.interventionDetails.length > 0) {
|
|
29
|
+
return trial.interventionDetails;
|
|
30
|
+
}
|
|
31
|
+
return (trial.interventions ?? []).map((name) => ({
|
|
32
|
+
name,
|
|
33
|
+
type: null,
|
|
34
|
+
description: null,
|
|
35
|
+
otherNames: [],
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
function toResolvedIntervention(intervention, source, extras = {}) {
|
|
39
|
+
return {
|
|
40
|
+
name: intervention.name,
|
|
41
|
+
intervention_type: intervention.type ?? null,
|
|
42
|
+
target_uniprots: extras.target_uniprots ?? [],
|
|
43
|
+
resolver_source: source,
|
|
44
|
+
...extras,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function isDiagnosticOrBiomarkerOnly(trial) {
|
|
48
|
+
const details = interventionDetails(trial);
|
|
49
|
+
const hasOnlyDiagnostic = details.length > 0 && details.every((i) => ["DIAGNOSTIC_TEST", "OTHER", "PROCEDURE"].includes(String(i.type ?? "").toUpperCase()));
|
|
50
|
+
const design = `${trial.studyType ?? ""} ${trial.primaryPurpose ?? ""}`.toUpperCase();
|
|
51
|
+
return hasOnlyDiagnostic || /\bOBSERVATIONAL\b|\bBASIC_SCIENCE\b/.test(design);
|
|
52
|
+
}
|
|
53
|
+
function targetBiomarkerMention(trial, symbol) {
|
|
54
|
+
const text = normalize(trialText(trial));
|
|
55
|
+
const sym = normalize(symbol);
|
|
56
|
+
if (!sym)
|
|
57
|
+
return false;
|
|
58
|
+
const wrapped = ` ${text} `;
|
|
59
|
+
return wrapped.includes(` ${sym} `) || wrapped.includes(`S ${sym} `) || wrapped.includes(` ${sym} LEVEL`) || wrapped.includes(` ${sym} CONCENTRATION`);
|
|
60
|
+
}
|
|
61
|
+
function excluded(relationship, reason, basisKind, source, resolved_interventions) {
|
|
62
|
+
return {
|
|
63
|
+
eligible_for_toxicology_aggregation: false,
|
|
64
|
+
attribution: {
|
|
65
|
+
relationship,
|
|
66
|
+
evidence_role: relationship === "target_biomarker" || relationship === "pathway_biomarker" ? "contextual" : "excluded",
|
|
67
|
+
basis: [{ kind: basisKind, source }],
|
|
68
|
+
resolved_interventions,
|
|
69
|
+
exclusion_reason: reason,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function classifyClinicalEvidenceTrial(trial, ctx) {
|
|
74
|
+
const details = interventionDetails(trial);
|
|
75
|
+
for (const program of ctx.therapeuticPrograms) {
|
|
76
|
+
const matchesProgram = (program.nctIds ?? []).includes(trial.nctId) ||
|
|
77
|
+
details.some((i) => tokenMatch(i.name, program.name) || (i.otherNames ?? []).some((alias) => tokenMatch(alias, program.name))) ||
|
|
78
|
+
tokenMatch(trial.title, program.name);
|
|
79
|
+
const hitsTarget = normalize(program.targetSymbol) === normalize(ctx.assessmentSymbol) || program.targetUniprot === ctx.assessmentUniprot;
|
|
80
|
+
if (matchesProgram && hitsTarget) {
|
|
81
|
+
const matched = details.find((i) => tokenMatch(i.name, program.name)) ??
|
|
82
|
+
details[0] ?? {
|
|
83
|
+
name: program.name,
|
|
84
|
+
type: null,
|
|
85
|
+
description: null,
|
|
86
|
+
otherNames: [],
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
eligible_for_toxicology_aggregation: true,
|
|
90
|
+
attribution: {
|
|
91
|
+
relationship: "direct_modulator",
|
|
92
|
+
evidence_role: "supports_target",
|
|
93
|
+
basis: [
|
|
94
|
+
{
|
|
95
|
+
kind: "therapeutic_program_match",
|
|
96
|
+
source: "therapeutic_programs",
|
|
97
|
+
excerpt: `${program.name} targets ${program.targetSymbol}`,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
resolved_interventions: [
|
|
101
|
+
toResolvedIntervention(matched, "therapeutic_programs", {
|
|
102
|
+
therapeutic_program_id: program.programId,
|
|
103
|
+
target_uniprots: program.targetUniprot ? [program.targetUniprot] : [],
|
|
104
|
+
}),
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const intervention of details) {
|
|
111
|
+
const candidates = [intervention.name, ...(intervention.otherNames ?? [])];
|
|
112
|
+
const matchedDrug = ctx.knownClassDrugs.find((drug) => candidates.some((candidate) => tokenMatch(candidate, drug.name)));
|
|
113
|
+
if (!matchedDrug)
|
|
114
|
+
continue;
|
|
115
|
+
const targetUniprots = matchedDrug.targetUniprots ?? [];
|
|
116
|
+
if (targetUniprots.includes(ctx.assessmentUniprot)) {
|
|
117
|
+
return {
|
|
118
|
+
eligible_for_toxicology_aggregation: true,
|
|
119
|
+
attribution: {
|
|
120
|
+
relationship: "class_modulator",
|
|
121
|
+
evidence_role: "supports_target",
|
|
122
|
+
basis: [{ kind: "known_class_drug", source: "chembl" }],
|
|
123
|
+
resolved_interventions: [
|
|
124
|
+
toResolvedIntervention(intervention, "chembl", {
|
|
125
|
+
chembl_id: matchedDrug.moleculeChemblId ?? null,
|
|
126
|
+
target_uniprots: targetUniprots,
|
|
127
|
+
}),
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (targetUniprots.some((u) => ctx.familyUniprots.includes(u))) {
|
|
133
|
+
return excluded("related_family_target", "Intervention targets a related family receptor, not the assessed target.", "related_family_target", "chembl", [
|
|
134
|
+
toResolvedIntervention(intervention, "chembl", {
|
|
135
|
+
chembl_id: matchedDrug.moleculeChemblId ?? null,
|
|
136
|
+
target_uniprots: targetUniprots,
|
|
137
|
+
}),
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (targetBiomarkerMention(trial, ctx.assessmentSymbol)) {
|
|
142
|
+
const resolved = details.map((i) => toResolvedIntervention(i, "ctgov"));
|
|
143
|
+
return excluded("target_biomarker", isDiagnosticOrBiomarkerOnly(trial)
|
|
144
|
+
? "Target is used as a biomarker or diagnostic endpoint, not as a therapeutic intervention."
|
|
145
|
+
: "Target is mentioned in biomarker/outcome context without target-modulating intervention evidence.", "biomarker_endpoint", "ctgov", resolved);
|
|
146
|
+
}
|
|
147
|
+
const conditionOnly = (trial.conditions ?? []).some((c) => tokenMatch(c, ctx.assessmentSymbol));
|
|
148
|
+
if (conditionOnly) {
|
|
149
|
+
return excluded("condition_only", "Trial matched only by condition text and has no target-modulating intervention evidence.", "condition_only", "ctgov", details.map((i) => toResolvedIntervention(i, "ctgov")));
|
|
150
|
+
}
|
|
151
|
+
return excluded("unrelated", "No intervention or mechanism evidence links this trial to the assessed target.", "text_match", "ctgov", details.map((i) => toResolvedIntervention(i, "ctgov")));
|
|
152
|
+
}
|
|
153
|
+
export function attachClinicalEvidenceAttribution(trial, ctx) {
|
|
154
|
+
const result = classifyClinicalEvidenceTrial(trial, ctx);
|
|
155
|
+
return { ...trial, ...result };
|
|
156
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DerivedV4 } from "@inflexa-ai/harness/contracts/target-dossier.js";
|
|
2
|
+
/**
|
|
3
|
+
* Derive the set of organs that should appear in the organ rollup based on
|
|
4
|
+
* available safety signals (FAERS top signals, serious trial AEs, and
|
|
5
|
+
* off-target panel entries).
|
|
6
|
+
*
|
|
7
|
+
* Exported so the Phase-4 assembler can call the same logic when building
|
|
8
|
+
* organ_rollup rows — ensuring the set of "expected" organs is identical at
|
|
9
|
+
* assembly time and at derived-validation time.
|
|
10
|
+
*/
|
|
11
|
+
export declare function expectedOrgansFromBody(bodyInput: unknown): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Build the v4 derived sub-tree from a raw dossier body.
|
|
14
|
+
*
|
|
15
|
+
* Pure function: no I/O, no LLM calls, no side effects. Defensive against
|
|
16
|
+
* missing/partial bodies — always returns a best-effort result and never throws.
|
|
17
|
+
* Schema validation happens at the persist boundary (Task 11), not here.
|
|
18
|
+
*/
|
|
19
|
+
export declare function computeDerivedFields(bodyInput: unknown): DerivedV4;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { classifyOrgan, classifyTrialAe } from "./meddra-organ-map.js";
|
|
2
|
+
import { HIGH_EXPRESSION_TPM_THRESHOLD } from "./expression-constants.js";
|
|
3
|
+
const FAERS_TOP_SIGNAL_THRESHOLD = 1000;
|
|
4
|
+
/**
|
|
5
|
+
* Derive the set of organs that should appear in the organ rollup based on
|
|
6
|
+
* available safety signals (FAERS top signals, serious trial AEs, and
|
|
7
|
+
* off-target panel entries).
|
|
8
|
+
*
|
|
9
|
+
* Exported so the Phase-4 assembler can call the same logic when building
|
|
10
|
+
* organ_rollup rows — ensuring the set of "expected" organs is identical at
|
|
11
|
+
* assembly time and at derived-validation time.
|
|
12
|
+
*/
|
|
13
|
+
export function expectedOrgansFromBody(bodyInput) {
|
|
14
|
+
const body = bodyInput;
|
|
15
|
+
const expected = new Set();
|
|
16
|
+
const top = body?.safety_profile?.faers?.data?.top_signals ?? [];
|
|
17
|
+
for (const sig of top) {
|
|
18
|
+
if (sig.report_count >= FAERS_TOP_SIGNAL_THRESHOLD) {
|
|
19
|
+
const organ = classifyOrgan(sig.meddra_term);
|
|
20
|
+
if (organ)
|
|
21
|
+
expected.add(organ);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const serious = body?.safety_profile?.trial_aes?.data?.serious ?? [];
|
|
25
|
+
for (const ae of serious) {
|
|
26
|
+
const organ = classifyTrialAe(ae);
|
|
27
|
+
if (organ)
|
|
28
|
+
expected.add(organ);
|
|
29
|
+
}
|
|
30
|
+
const offTargets = body?.safety_profile?.off_target_panel?.data?.rows ?? [];
|
|
31
|
+
for (const r of offTargets) {
|
|
32
|
+
if (r.organ_system && typeof r.organ_system === "string")
|
|
33
|
+
expected.add(r.organ_system);
|
|
34
|
+
}
|
|
35
|
+
return [...expected].sort();
|
|
36
|
+
}
|
|
37
|
+
function presentOrgans(body) {
|
|
38
|
+
const rows = body?.safety_profile?.organ_rollup?.data?.rows ?? [];
|
|
39
|
+
return rows
|
|
40
|
+
.map((r) => r.organ)
|
|
41
|
+
.filter((o) => typeof o === "string")
|
|
42
|
+
.sort();
|
|
43
|
+
}
|
|
44
|
+
function countDistinctPapers(body) {
|
|
45
|
+
const set = new Set();
|
|
46
|
+
const keyPapers = body?.reference_biology?.key_papers?.data?.rows ?? [];
|
|
47
|
+
for (const p of keyPapers)
|
|
48
|
+
if (p.pmid)
|
|
49
|
+
set.add(String(p.pmid));
|
|
50
|
+
return set.size;
|
|
51
|
+
}
|
|
52
|
+
function countDistinctTrials(body) {
|
|
53
|
+
const set = new Set();
|
|
54
|
+
// V5 partitions ineligible trials into `excluded_rows`, so the distinct
|
|
55
|
+
// count must union both buckets for trials, failed_trials, and
|
|
56
|
+
// discovery_trials. Outcomes preserves every row in `rows` and has no
|
|
57
|
+
// `excluded_rows` bucket.
|
|
58
|
+
const partitioned = [body?.clinical_development?.trials?.data, body?.clinical_development?.failed_trials?.data, body?.analytics?.discovery_trials?.data];
|
|
59
|
+
for (const data of partitioned) {
|
|
60
|
+
for (const bucket of ["rows", "excluded_rows"]) {
|
|
61
|
+
for (const r of data?.[bucket] ?? []) {
|
|
62
|
+
if (r.nct_id)
|
|
63
|
+
set.add(String(r.nct_id));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (const r of body?.clinical_development?.outcomes?.data?.rows ?? []) {
|
|
68
|
+
if (r.nct_id)
|
|
69
|
+
set.add(String(r.nct_id));
|
|
70
|
+
}
|
|
71
|
+
return set.size;
|
|
72
|
+
}
|
|
73
|
+
// Walk the entire body tree counting all `evidence` array entries to produce
|
|
74
|
+
// a total evidence item count. This is intentionally recursive and treats every
|
|
75
|
+
// nested `evidence` array as contributing to the total.
|
|
76
|
+
function countTotalEvidenceItems(body) {
|
|
77
|
+
let total = 0;
|
|
78
|
+
const walk = (v) => {
|
|
79
|
+
if (Array.isArray(v)) {
|
|
80
|
+
for (const item of v)
|
|
81
|
+
walk(item);
|
|
82
|
+
}
|
|
83
|
+
else if (v && typeof v === "object") {
|
|
84
|
+
const node = v;
|
|
85
|
+
if (Array.isArray(node.evidence))
|
|
86
|
+
total += node.evidence.length;
|
|
87
|
+
for (const k of Object.keys(v))
|
|
88
|
+
walk(node[k]);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
walk(body);
|
|
92
|
+
return total;
|
|
93
|
+
}
|
|
94
|
+
function hasHumanEvidence(body) {
|
|
95
|
+
let found = false;
|
|
96
|
+
const walk = (v) => {
|
|
97
|
+
if (found)
|
|
98
|
+
return;
|
|
99
|
+
if (Array.isArray(v)) {
|
|
100
|
+
for (const item of v)
|
|
101
|
+
walk(item);
|
|
102
|
+
}
|
|
103
|
+
else if (v && typeof v === "object") {
|
|
104
|
+
const node = v;
|
|
105
|
+
if (node.has_human_evidence === true || node.is_human === true) {
|
|
106
|
+
found = true;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (const k of Object.keys(v))
|
|
110
|
+
walk(node[k]);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
walk(body);
|
|
114
|
+
return found;
|
|
115
|
+
}
|
|
116
|
+
function hasClinicalEvidence(body) {
|
|
117
|
+
let found = false;
|
|
118
|
+
const walk = (v) => {
|
|
119
|
+
if (found)
|
|
120
|
+
return;
|
|
121
|
+
if (Array.isArray(v)) {
|
|
122
|
+
for (const item of v)
|
|
123
|
+
walk(item);
|
|
124
|
+
}
|
|
125
|
+
else if (v && typeof v === "object") {
|
|
126
|
+
const node = v;
|
|
127
|
+
if (node.has_clinical_evidence === true || node.is_clinical === true) {
|
|
128
|
+
found = true;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
for (const k of Object.keys(v))
|
|
132
|
+
walk(node[k]);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
walk(body);
|
|
136
|
+
return found;
|
|
137
|
+
}
|
|
138
|
+
function highestRiskOrgan(body) {
|
|
139
|
+
const rows = body?.safety_profile?.organ_rollup?.data?.rows ?? [];
|
|
140
|
+
const high = rows.find((r) => r.risk_level === "high");
|
|
141
|
+
if (high)
|
|
142
|
+
return high.organ;
|
|
143
|
+
const med = rows.find((r) => r.risk_level === "medium");
|
|
144
|
+
if (med)
|
|
145
|
+
return med.organ;
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
function topIndicationSummary(body) {
|
|
149
|
+
const rows = body?.indications?.coverage === "available" ? (body.indications?.data?.rows ?? []) : [];
|
|
150
|
+
if (rows.length === 0) {
|
|
151
|
+
return { highest_score: null, strongest_strength_label: null, highest_score_is_conflicted: false };
|
|
152
|
+
}
|
|
153
|
+
let top = null;
|
|
154
|
+
for (const r of rows) {
|
|
155
|
+
if (typeof r.composite_score !== "number")
|
|
156
|
+
continue;
|
|
157
|
+
if (!top || r.composite_score > top.composite_score)
|
|
158
|
+
top = r;
|
|
159
|
+
}
|
|
160
|
+
if (!top) {
|
|
161
|
+
return { highest_score: null, strongest_strength_label: null, highest_score_is_conflicted: false };
|
|
162
|
+
}
|
|
163
|
+
const conflicted = Array.isArray(top.evidence) ? top.evidence.some((e) => e?.predicate === "direction_mismatch") : false;
|
|
164
|
+
return {
|
|
165
|
+
highest_score: top.composite_score ?? null,
|
|
166
|
+
strongest_strength_label: top.disease_name ?? null,
|
|
167
|
+
highest_score_is_conflicted: conflicted,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
// Count distinct high-expression tissues across the human protein atlas consensus
|
|
171
|
+
// (normal_tissue_expression, keyed as "human") and the cross-species expression
|
|
172
|
+
// heatmap. Deduplication uses `${tissue}::${species}` pairs so the same tissue
|
|
173
|
+
// in different species counts as separate entries.
|
|
174
|
+
function countHighExpressionTissues(body) {
|
|
175
|
+
const set = new Set();
|
|
176
|
+
const consensusRows = body?.reference_biology?.normal_tissue_expression?.data?.rows ?? [];
|
|
177
|
+
for (const r of consensusRows) {
|
|
178
|
+
if ((r.value ?? 0) >= HIGH_EXPRESSION_TPM_THRESHOLD && r.tissue) {
|
|
179
|
+
set.add(`${r.tissue}::human`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const heatmapCells = body?.reference_biology?.preclinical?.expression_heatmap?.data?.cells ?? [];
|
|
183
|
+
for (const c of heatmapCells) {
|
|
184
|
+
if (c.rank === "high" && c.tissue) {
|
|
185
|
+
const species = c.species ?? "unknown";
|
|
186
|
+
set.add(`${c.tissue}::${species}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return set.size;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Build the v4 derived sub-tree from a raw dossier body.
|
|
193
|
+
*
|
|
194
|
+
* Pure function: no I/O, no LLM calls, no side effects. Defensive against
|
|
195
|
+
* missing/partial bodies — always returns a best-effort result and never throws.
|
|
196
|
+
* Schema validation happens at the persist boundary (Task 11), not here.
|
|
197
|
+
*/
|
|
198
|
+
export function computeDerivedFields(bodyInput) {
|
|
199
|
+
const body = bodyInput;
|
|
200
|
+
const classLiabilityRows = body?.safety_profile?.class_precedent?.coverage === "available"
|
|
201
|
+
? (body.safety_profile?.class_precedent?.data?.per_organ ?? []).filter((o) => o.is_class_liability)
|
|
202
|
+
: [];
|
|
203
|
+
const classLiabilityCount = classLiabilityRows.length;
|
|
204
|
+
const sameClassDrugCount = body?.safety_profile?.class_precedent?.coverage === "available" ? (body.safety_profile?.class_precedent?.data?.drugs_in_class ?? []).length : 0;
|
|
205
|
+
const offTargetRows = body?.safety_profile?.off_target_panel?.data?.rows ?? [];
|
|
206
|
+
const safetyHits = offTargetRows.filter((r) => r.is_safety_panel_target === true).length;
|
|
207
|
+
const offTissueRows = body?.off_tissue_risk?.data?.rows ?? [];
|
|
208
|
+
const offTissueOrganCount = new Set(offTissueRows.map((r) => r.organ).filter(Boolean)).size;
|
|
209
|
+
const expected = expectedOrgansFromBody(body);
|
|
210
|
+
const present = presentOrgans(body);
|
|
211
|
+
const missing = expected.filter((o) => !present.includes(o));
|
|
212
|
+
const seriousness = body?.safety_profile?.faers?.data?.seriousness;
|
|
213
|
+
const fatalBullet = (body?.liability_summary?.liability_bullets ?? []).some((b) => b?.category === "fatal_post_market");
|
|
214
|
+
const anyFatal = seriousness?.coverage === "available" ? (seriousness.by_seriousness?.death ?? 0) > 0 || fatalBullet : fatalBullet ? true : "unknown";
|
|
215
|
+
const tissueRows = body?.reference_biology?.normal_tissue_expression?.data?.rows ?? [];
|
|
216
|
+
const highTissues = countHighExpressionTissues(body);
|
|
217
|
+
const safetySources = ["organ_rollup", "faers", "trial_aes", "off_target_panel", "failed_trials_safety_lens", "class_precedent"].filter((k) => body?.safety_profile?.[k]?.coverage === "available").length;
|
|
218
|
+
return {
|
|
219
|
+
summary: {
|
|
220
|
+
has_human_evidence: hasHumanEvidence(body),
|
|
221
|
+
has_clinical_evidence: hasClinicalEvidence(body),
|
|
222
|
+
total_evidence_items: countTotalEvidenceItems(body),
|
|
223
|
+
total_distinct_papers: countDistinctPapers(body),
|
|
224
|
+
total_distinct_clinical_trials: countDistinctTrials(body),
|
|
225
|
+
...topIndicationSummary(body),
|
|
226
|
+
},
|
|
227
|
+
risk_summary: {
|
|
228
|
+
any_fatal_signal: anyFatal,
|
|
229
|
+
highest_risk_organ: highestRiskOrgan(body),
|
|
230
|
+
off_target_safety_target_hits: safetyHits,
|
|
231
|
+
class_liability_count: classLiabilityCount,
|
|
232
|
+
},
|
|
233
|
+
liability_summary: {
|
|
234
|
+
counts: {
|
|
235
|
+
class_liability_count: classLiabilityCount,
|
|
236
|
+
safety_target_off_target_count: safetyHits,
|
|
237
|
+
off_tissue_risk_organ_count: offTissueOrganCount,
|
|
238
|
+
},
|
|
239
|
+
expression_breadth: {
|
|
240
|
+
total_assessed_tissues: tissueRows.length,
|
|
241
|
+
high_expression_tissue_count: highTissues,
|
|
242
|
+
},
|
|
243
|
+
same_class_drug_count: sameClassDrugCount,
|
|
244
|
+
safety_data_sources_checked: safetySources,
|
|
245
|
+
},
|
|
246
|
+
organ_rollup_completeness: {
|
|
247
|
+
expected_organs: expected,
|
|
248
|
+
present_organs: present,
|
|
249
|
+
missing_organs: missing,
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function computeSelectivity(input: {
|
|
2
|
+
primary_pchembl: number | null;
|
|
3
|
+
off_target_pchembl: number | null;
|
|
4
|
+
primary_source?: "chembl_target_drug_indication" | "literature_curated";
|
|
5
|
+
}): {
|
|
6
|
+
vs_primary_potency: {
|
|
7
|
+
primary_pchembl_used: number;
|
|
8
|
+
primary_source: "chembl_target_drug_indication" | "literature_curated";
|
|
9
|
+
fold: number;
|
|
10
|
+
log_units: number;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
selectivity_unknown: true;
|
|
14
|
+
reason: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function computeSelectivity(input) {
|
|
2
|
+
if (input.primary_pchembl == null) {
|
|
3
|
+
return { selectivity_unknown: true, reason: "no primary pChEMBL available for this modulator in ChEMBL target-drug-indication table" };
|
|
4
|
+
}
|
|
5
|
+
if (input.off_target_pchembl == null) {
|
|
6
|
+
return { selectivity_unknown: true, reason: "no off-target pChEMBL recorded" };
|
|
7
|
+
}
|
|
8
|
+
const logUnits = input.primary_pchembl - input.off_target_pchembl;
|
|
9
|
+
const fold = Math.pow(10, logUnits);
|
|
10
|
+
return {
|
|
11
|
+
vs_primary_potency: {
|
|
12
|
+
primary_pchembl_used: input.primary_pchembl,
|
|
13
|
+
primary_source: input.primary_source ?? "chembl_target_drug_indication",
|
|
14
|
+
fold,
|
|
15
|
+
log_units: logUnits,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|