@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,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correction loop for Phase-3 fan-out branches that returned empty
|
|
3
|
+
* without an error.
|
|
4
|
+
*
|
|
5
|
+
* Contract:
|
|
6
|
+
* 1. If `coverage` is `available` (non-empty data), pass through.
|
|
7
|
+
* 2. If `coverage` is `queried_no_data` and we have a deterministic
|
|
8
|
+
* alt-name retry available, run ONE retry. If it succeeds, return
|
|
9
|
+
* the new payload tagged `available`.
|
|
10
|
+
* 3. If still empty after the alt-name retry, escalate ONCE to the
|
|
11
|
+
* responsible Phase-2 agent (via the supplied `escalate` callback)
|
|
12
|
+
* with the failure bundle. If the agent returns a usable payload,
|
|
13
|
+
* return it. Otherwise return `coverage: "queried_no_data"`.
|
|
14
|
+
*
|
|
15
|
+
* The escalation callback is optional — callers without an agent fall
|
|
16
|
+
* back to a final coverage tag without escalation.
|
|
17
|
+
*/
|
|
18
|
+
import type { Coverage, SerializedError } from "./coverage.js";
|
|
19
|
+
type CoverageEnvelope<T> = {
|
|
20
|
+
coverage: "available";
|
|
21
|
+
data: T;
|
|
22
|
+
} | {
|
|
23
|
+
coverage: "queried_no_data";
|
|
24
|
+
error?: SerializedError;
|
|
25
|
+
} | {
|
|
26
|
+
coverage: "not_loaded";
|
|
27
|
+
reason?: string;
|
|
28
|
+
};
|
|
29
|
+
export interface CorrectionInput<T> {
|
|
30
|
+
initial: CoverageEnvelope<T>;
|
|
31
|
+
altRetry?: () => Promise<CoverageEnvelope<T>>;
|
|
32
|
+
escalate?: () => Promise<CoverageEnvelope<T>>;
|
|
33
|
+
}
|
|
34
|
+
export interface CorrectionTrace {
|
|
35
|
+
altRetryAttempted: boolean;
|
|
36
|
+
altRetrySucceeded: boolean;
|
|
37
|
+
escalationAttempted: boolean;
|
|
38
|
+
escalationSucceeded: boolean;
|
|
39
|
+
finalCoverage: Coverage;
|
|
40
|
+
}
|
|
41
|
+
export declare function runCorrectionLoop<T>(input: CorrectionInput<T>): Promise<{
|
|
42
|
+
result: CoverageEnvelope<T>;
|
|
43
|
+
trace: CorrectionTrace;
|
|
44
|
+
}>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correction loop for Phase-3 fan-out branches that returned empty
|
|
3
|
+
* without an error.
|
|
4
|
+
*
|
|
5
|
+
* Contract:
|
|
6
|
+
* 1. If `coverage` is `available` (non-empty data), pass through.
|
|
7
|
+
* 2. If `coverage` is `queried_no_data` and we have a deterministic
|
|
8
|
+
* alt-name retry available, run ONE retry. If it succeeds, return
|
|
9
|
+
* the new payload tagged `available`.
|
|
10
|
+
* 3. If still empty after the alt-name retry, escalate ONCE to the
|
|
11
|
+
* responsible Phase-2 agent (via the supplied `escalate` callback)
|
|
12
|
+
* with the failure bundle. If the agent returns a usable payload,
|
|
13
|
+
* return it. Otherwise return `coverage: "queried_no_data"`.
|
|
14
|
+
*
|
|
15
|
+
* The escalation callback is optional — callers without an agent fall
|
|
16
|
+
* back to a final coverage tag without escalation.
|
|
17
|
+
*/
|
|
18
|
+
export async function runCorrectionLoop(input) {
|
|
19
|
+
const trace = {
|
|
20
|
+
altRetryAttempted: false,
|
|
21
|
+
altRetrySucceeded: false,
|
|
22
|
+
escalationAttempted: false,
|
|
23
|
+
escalationSucceeded: false,
|
|
24
|
+
finalCoverage: input.initial.coverage,
|
|
25
|
+
};
|
|
26
|
+
if (input.initial.coverage === "available") {
|
|
27
|
+
return { result: input.initial, trace };
|
|
28
|
+
}
|
|
29
|
+
if (input.initial.coverage === "not_loaded") {
|
|
30
|
+
return { result: input.initial, trace };
|
|
31
|
+
}
|
|
32
|
+
if (input.altRetry) {
|
|
33
|
+
trace.altRetryAttempted = true;
|
|
34
|
+
try {
|
|
35
|
+
const retried = await input.altRetry();
|
|
36
|
+
if (retried.coverage === "available") {
|
|
37
|
+
trace.altRetrySucceeded = true;
|
|
38
|
+
trace.finalCoverage = "available";
|
|
39
|
+
return { result: retried, trace };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// alt retry failed; proceed to escalation
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (input.escalate) {
|
|
47
|
+
trace.escalationAttempted = true;
|
|
48
|
+
try {
|
|
49
|
+
const esc = await input.escalate();
|
|
50
|
+
if (esc.coverage === "available") {
|
|
51
|
+
trace.escalationSucceeded = true;
|
|
52
|
+
trace.finalCoverage = "available";
|
|
53
|
+
return { result: esc, trace };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// escalation failed; fall through
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
trace.finalCoverage = "queried_no_data";
|
|
61
|
+
return { result: input.initial, trace };
|
|
62
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared coverage discriminator for target-assessment workflow steps.
|
|
3
|
+
*
|
|
4
|
+
* Per design §6, every collector / decision / fan-out / synthesis step
|
|
5
|
+
* MUST wrap its body in try/catch and return a `{ coverage, ... }` shape
|
|
6
|
+
* instead of throwing. Only Phase 0 (target resolution) is allowed to
|
|
7
|
+
* throw — that legitimately aborts the workflow.
|
|
8
|
+
*
|
|
9
|
+
* Coverage states:
|
|
10
|
+
* - "available" — the upstream returned data; payload is present.
|
|
11
|
+
* - "queried_no_data" — the upstream was queried but came back empty
|
|
12
|
+
* (no rows / 404 / etc.) OR threw an error which
|
|
13
|
+
* we serialized into `error` instead of bubbling.
|
|
14
|
+
* - "not_loaded" — the upstream was never queried (feature flag,
|
|
15
|
+
* config disable, or upstream skipped because a
|
|
16
|
+
* precondition was not met).
|
|
17
|
+
*/
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
export declare const CoverageSchema: z.ZodEnum<{
|
|
20
|
+
available: "available";
|
|
21
|
+
queried_no_data: "queried_no_data";
|
|
22
|
+
not_loaded: "not_loaded";
|
|
23
|
+
}>;
|
|
24
|
+
export type Coverage = z.infer<typeof CoverageSchema>;
|
|
25
|
+
export declare const SerializedErrorSchema: z.ZodObject<{
|
|
26
|
+
message: z.ZodString;
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type SerializedError = z.infer<typeof SerializedErrorSchema>;
|
|
31
|
+
export declare function serializeError(err: unknown): SerializedError;
|
|
32
|
+
/**
|
|
33
|
+
* Build the schema for a `{ coverage, data, error? }` step output.
|
|
34
|
+
*
|
|
35
|
+
* Use as: `outputSchema: withCoverage(MyDataSchema)` where `MyDataSchema`
|
|
36
|
+
* is the shape of the Phase-1 / Phase-2 / etc. payload for this step.
|
|
37
|
+
*/
|
|
38
|
+
export declare function withCoverage<TData extends z.ZodTypeAny>(dataSchema: TData): z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
39
|
+
coverage: z.ZodLiteral<"available">;
|
|
40
|
+
data: TData;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
coverage: z.ZodLiteral<"queried_no_data">;
|
|
43
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
message: z.ZodString;
|
|
45
|
+
name: z.ZodOptional<z.ZodString>;
|
|
46
|
+
stack: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
coverage: z.ZodLiteral<"not_loaded">;
|
|
50
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>], "coverage">;
|
|
52
|
+
/**
|
|
53
|
+
* Run a step body with the standard try/catch envelope. If the body
|
|
54
|
+
* resolves, returns `{ coverage: "available", data }`. If it throws,
|
|
55
|
+
* returns `{ coverage: "queried_no_data", error: serializeError(err) }`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function runWithCoverage<T>(body: () => Promise<T>): Promise<{
|
|
58
|
+
coverage: "available";
|
|
59
|
+
data: T;
|
|
60
|
+
} | {
|
|
61
|
+
coverage: "queried_no_data";
|
|
62
|
+
error: SerializedError;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Convenience wrapper for `{ rows: T[] }` payloads. Maps an empty rows
|
|
66
|
+
* array to `coverage: "queried_no_data"` so the dossier discriminator's
|
|
67
|
+
* "available ≡ we have data" invariant holds without per-callsite
|
|
68
|
+
* length checks. Use at any assembler callsite that emits a `rows`
|
|
69
|
+
* shape from a query that may legitimately return zero items.
|
|
70
|
+
*/
|
|
71
|
+
export declare function coverageFromRows<T>(rows: T[], opts?: {
|
|
72
|
+
reason?: string;
|
|
73
|
+
}): {
|
|
74
|
+
coverage: "available";
|
|
75
|
+
data: {
|
|
76
|
+
rows: T[];
|
|
77
|
+
};
|
|
78
|
+
} | {
|
|
79
|
+
coverage: "queried_no_data";
|
|
80
|
+
error: SerializedError;
|
|
81
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared coverage discriminator for target-assessment workflow steps.
|
|
3
|
+
*
|
|
4
|
+
* Per design §6, every collector / decision / fan-out / synthesis step
|
|
5
|
+
* MUST wrap its body in try/catch and return a `{ coverage, ... }` shape
|
|
6
|
+
* instead of throwing. Only Phase 0 (target resolution) is allowed to
|
|
7
|
+
* throw — that legitimately aborts the workflow.
|
|
8
|
+
*
|
|
9
|
+
* Coverage states:
|
|
10
|
+
* - "available" — the upstream returned data; payload is present.
|
|
11
|
+
* - "queried_no_data" — the upstream was queried but came back empty
|
|
12
|
+
* (no rows / 404 / etc.) OR threw an error which
|
|
13
|
+
* we serialized into `error` instead of bubbling.
|
|
14
|
+
* - "not_loaded" — the upstream was never queried (feature flag,
|
|
15
|
+
* config disable, or upstream skipped because a
|
|
16
|
+
* precondition was not met).
|
|
17
|
+
*/
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
export const CoverageSchema = z.enum(["available", "queried_no_data", "not_loaded"]);
|
|
20
|
+
export const SerializedErrorSchema = z.object({
|
|
21
|
+
message: z.string(),
|
|
22
|
+
name: z.string().optional(),
|
|
23
|
+
stack: z.string().optional(),
|
|
24
|
+
});
|
|
25
|
+
export function serializeError(err) {
|
|
26
|
+
if (err instanceof Error) {
|
|
27
|
+
return { message: err.message, name: err.name, stack: err.stack };
|
|
28
|
+
}
|
|
29
|
+
return { message: String(err) };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build the schema for a `{ coverage, data, error? }` step output.
|
|
33
|
+
*
|
|
34
|
+
* Use as: `outputSchema: withCoverage(MyDataSchema)` where `MyDataSchema`
|
|
35
|
+
* is the shape of the Phase-1 / Phase-2 / etc. payload for this step.
|
|
36
|
+
*/
|
|
37
|
+
export function withCoverage(dataSchema) {
|
|
38
|
+
return z.discriminatedUnion("coverage", [
|
|
39
|
+
z.object({
|
|
40
|
+
coverage: z.literal("available"),
|
|
41
|
+
data: dataSchema,
|
|
42
|
+
}),
|
|
43
|
+
z.object({
|
|
44
|
+
coverage: z.literal("queried_no_data"),
|
|
45
|
+
error: SerializedErrorSchema.optional(),
|
|
46
|
+
}),
|
|
47
|
+
z.object({
|
|
48
|
+
coverage: z.literal("not_loaded"),
|
|
49
|
+
reason: z.string().optional(),
|
|
50
|
+
}),
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Run a step body with the standard try/catch envelope. If the body
|
|
55
|
+
* resolves, returns `{ coverage: "available", data }`. If it throws,
|
|
56
|
+
* returns `{ coverage: "queried_no_data", error: serializeError(err) }`.
|
|
57
|
+
*/
|
|
58
|
+
export async function runWithCoverage(body) {
|
|
59
|
+
try {
|
|
60
|
+
const data = await body();
|
|
61
|
+
return { coverage: "available", data };
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return { coverage: "queried_no_data", error: serializeError(err) };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Convenience wrapper for `{ rows: T[] }` payloads. Maps an empty rows
|
|
69
|
+
* array to `coverage: "queried_no_data"` so the dossier discriminator's
|
|
70
|
+
* "available ≡ we have data" invariant holds without per-callsite
|
|
71
|
+
* length checks. Use at any assembler callsite that emits a `rows`
|
|
72
|
+
* shape from a query that may legitimately return zero items.
|
|
73
|
+
*/
|
|
74
|
+
export function coverageFromRows(rows, opts) {
|
|
75
|
+
if (rows.length === 0) {
|
|
76
|
+
return {
|
|
77
|
+
coverage: "queried_no_data",
|
|
78
|
+
error: { message: opts?.reason ?? "no rows returned" },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return { coverage: "available", data: { rows } };
|
|
82
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase-2 decision functions for the harness DBOS workflow.
|
|
3
|
+
*
|
|
4
|
+
* `modulatorTriage` selects up to 8 ChEMBL modulators for downstream
|
|
5
|
+
* fan-out; `drugsInClass` identifies clinically-advanced drugs in the
|
|
6
|
+
* class. Both are single-shot, structured-output LLM calls — no tools,
|
|
7
|
+
* no multi-step reasoning. Each function is `(input, deps) => Promise<CoverageEnvelope<...>>`.
|
|
8
|
+
*
|
|
9
|
+
* Coverage envelope is the failure mode: an LLM throw (non-402) → the
|
|
10
|
+
* function returns `coverage: "queried_no_data"`. A billing-gateway 402 reaches
|
|
11
|
+
* here as a `RunLlmStepResult` with `kind: "budget-exceeded"`; the caller
|
|
12
|
+
* stops scheduling because the workflow has self-cancelled.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import type { AgentSession } from "../../../auth/types.js";
|
|
16
|
+
import type { AgentChat } from "../../../providers/types.js";
|
|
17
|
+
import type { Phase1Bundle } from "../schemas.js";
|
|
18
|
+
import { BUDGET_EXCEEDED_SENTINEL } from "../lib/llm-step.js";
|
|
19
|
+
export declare const ModulatorTriageOutputSchema: z.ZodObject<{
|
|
20
|
+
shortlist: z.ZodArray<z.ZodObject<{
|
|
21
|
+
moleculeChemblId: z.ZodString;
|
|
22
|
+
preferredName: z.ZodString;
|
|
23
|
+
maxPhase: z.ZodNullable<z.ZodNumber>;
|
|
24
|
+
firstApproval: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
rationale: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
notes: z.ZodString;
|
|
28
|
+
dropped_synonyms: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
29
|
+
chemblId: z.ZodString;
|
|
30
|
+
reason: z.ZodEnum<{
|
|
31
|
+
same_active_substance: "same_active_substance";
|
|
32
|
+
ambiguous_name_synonym: "ambiguous_name_synonym";
|
|
33
|
+
}>;
|
|
34
|
+
keptId: z.ZodNullable<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type ModulatorTriageOutput = z.infer<typeof ModulatorTriageOutputSchema>;
|
|
38
|
+
export declare const DrugsInClassOutputSchema: z.ZodObject<{
|
|
39
|
+
drugs: z.ZodArray<z.ZodObject<{
|
|
40
|
+
moleculeChemblId: z.ZodString;
|
|
41
|
+
preferredName: z.ZodString;
|
|
42
|
+
maxPhase: z.ZodNullable<z.ZodNumber>;
|
|
43
|
+
firstApproval: z.ZodNullable<z.ZodNumber>;
|
|
44
|
+
moleculeType: z.ZodNullable<z.ZodString>;
|
|
45
|
+
sources: z.ZodArray<z.ZodEnum<{
|
|
46
|
+
chembl: "chembl";
|
|
47
|
+
dgidb: "dgidb";
|
|
48
|
+
drugbank: "drugbank";
|
|
49
|
+
}>>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
total: z.ZodNumber;
|
|
52
|
+
truncated: z.ZodBoolean;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type DrugsInClassOutput = z.infer<typeof DrugsInClassOutputSchema>;
|
|
55
|
+
interface CoverageAvailable<T> {
|
|
56
|
+
readonly coverage: "available";
|
|
57
|
+
readonly data: T;
|
|
58
|
+
}
|
|
59
|
+
interface CoverageQueriedNoData {
|
|
60
|
+
readonly coverage: "queried_no_data";
|
|
61
|
+
readonly error?: {
|
|
62
|
+
message: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
type CoverageEnvelope<T> = CoverageAvailable<T> | CoverageQueriedNoData;
|
|
66
|
+
export interface DecisionAgentDeps {
|
|
67
|
+
readonly chatProvider: AgentChat;
|
|
68
|
+
readonly session: AgentSession;
|
|
69
|
+
/** Billing-gateway model id — e.g. `env.TARGET_ASSESSMENT_DECISION_MODEL`. */
|
|
70
|
+
readonly model: string;
|
|
71
|
+
/** Attempt counter — bumped on resume so a 402-cancelled call lands a fresh DBOS step slot. */
|
|
72
|
+
readonly attempt: number;
|
|
73
|
+
}
|
|
74
|
+
export type ModulatorTriageResult = CoverageEnvelope<ModulatorTriageOutput & {
|
|
75
|
+
dropped_synonyms?: unknown;
|
|
76
|
+
}> | {
|
|
77
|
+
readonly kind: "budget-exceeded";
|
|
78
|
+
readonly sentinel: typeof BUDGET_EXCEEDED_SENTINEL;
|
|
79
|
+
};
|
|
80
|
+
export declare function modulatorTriage(input: Phase1Bundle, deps: DecisionAgentDeps): Promise<ModulatorTriageResult>;
|
|
81
|
+
export type DrugsInClassResult = CoverageEnvelope<DrugsInClassOutput> | {
|
|
82
|
+
readonly kind: "budget-exceeded";
|
|
83
|
+
readonly sentinel: typeof BUDGET_EXCEEDED_SENTINEL;
|
|
84
|
+
};
|
|
85
|
+
export declare function drugsInClass(input: Phase1Bundle, deps: DecisionAgentDeps): Promise<DrugsInClassResult>;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase-2 decision functions for the harness DBOS workflow.
|
|
3
|
+
*
|
|
4
|
+
* `modulatorTriage` selects up to 8 ChEMBL modulators for downstream
|
|
5
|
+
* fan-out; `drugsInClass` identifies clinically-advanced drugs in the
|
|
6
|
+
* class. Both are single-shot, structured-output LLM calls — no tools,
|
|
7
|
+
* no multi-step reasoning. Each function is `(input, deps) => Promise<CoverageEnvelope<...>>`.
|
|
8
|
+
*
|
|
9
|
+
* Coverage envelope is the failure mode: an LLM throw (non-402) → the
|
|
10
|
+
* function returns `coverage: "queried_no_data"`. A billing-gateway 402 reaches
|
|
11
|
+
* here as a `RunLlmStepResult` with `kind: "budget-exceeded"`; the caller
|
|
12
|
+
* stops scheduling because the workflow has self-cancelled.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { drugsInClassPrompt } from "../../../prompts/target-assessment/drugs-in-class.js";
|
|
16
|
+
import { modulatorTriagePrompt } from "../../../prompts/target-assessment/modulator-triage.js";
|
|
17
|
+
import { dedupModulatorsByParent } from "../lib/dedup-modulators.js";
|
|
18
|
+
import { structuredLlmCall } from "../lib/structured-llm.js";
|
|
19
|
+
// ── Output schemas ────────────────────────────────────────────────────
|
|
20
|
+
export const ModulatorTriageOutputSchema = z.object({
|
|
21
|
+
shortlist: z.array(z.object({
|
|
22
|
+
moleculeChemblId: z.string(),
|
|
23
|
+
preferredName: z.string(),
|
|
24
|
+
maxPhase: z.number().nullable(),
|
|
25
|
+
firstApproval: z.number().nullable(),
|
|
26
|
+
rationale: z.string(),
|
|
27
|
+
})),
|
|
28
|
+
notes: z.string(),
|
|
29
|
+
dropped_synonyms: z
|
|
30
|
+
.array(z.object({
|
|
31
|
+
chemblId: z.string(),
|
|
32
|
+
reason: z.enum(["same_active_substance", "ambiguous_name_synonym"]),
|
|
33
|
+
keptId: z.string().nullable(),
|
|
34
|
+
}))
|
|
35
|
+
.default([]),
|
|
36
|
+
});
|
|
37
|
+
export const DrugsInClassOutputSchema = z.object({
|
|
38
|
+
drugs: z.array(z.object({
|
|
39
|
+
moleculeChemblId: z.string(),
|
|
40
|
+
preferredName: z.string(),
|
|
41
|
+
maxPhase: z.number().nullable(),
|
|
42
|
+
firstApproval: z.number().nullable(),
|
|
43
|
+
moleculeType: z.string().nullable(),
|
|
44
|
+
sources: z.array(z.enum(["chembl", "dgidb", "drugbank"])),
|
|
45
|
+
})),
|
|
46
|
+
total: z.number(),
|
|
47
|
+
truncated: z.boolean(),
|
|
48
|
+
});
|
|
49
|
+
function fail(message) {
|
|
50
|
+
return { coverage: "queried_no_data", error: { message } };
|
|
51
|
+
}
|
|
52
|
+
function failFromErr(err) {
|
|
53
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
54
|
+
}
|
|
55
|
+
export async function modulatorTriage(input, deps) {
|
|
56
|
+
const modulators = input.collectors.chemblModulators;
|
|
57
|
+
if (modulators.coverage !== "available" || modulators.data.modulators.length === 0) {
|
|
58
|
+
return fail("no modulators to triage");
|
|
59
|
+
}
|
|
60
|
+
const { kept, dropped } = dedupModulatorsByParent(modulators.data.modulators);
|
|
61
|
+
if (kept.length === 0) {
|
|
62
|
+
return fail("no modulators after dedup");
|
|
63
|
+
}
|
|
64
|
+
const prompt = [
|
|
65
|
+
`Target: ${input.resolved.geneSymbol} (${input.resolved.canonicalId})`,
|
|
66
|
+
`ChEMBL target id: ${modulators.data.targetChemblId ?? "unknown"}`,
|
|
67
|
+
``,
|
|
68
|
+
`Modulators (${kept.length}, deduped from ${modulators.data.modulators.length}):`,
|
|
69
|
+
JSON.stringify(kept, null, 2),
|
|
70
|
+
].join("\n");
|
|
71
|
+
try {
|
|
72
|
+
const result = await structuredLlmCall({
|
|
73
|
+
stepName: `ta-decision:modulator-triage:${deps.attempt}`,
|
|
74
|
+
agentId: "modulator-triage",
|
|
75
|
+
provider: deps.chatProvider,
|
|
76
|
+
session: deps.session,
|
|
77
|
+
system: modulatorTriagePrompt,
|
|
78
|
+
prompt,
|
|
79
|
+
schema: ModulatorTriageOutputSchema,
|
|
80
|
+
model: deps.model,
|
|
81
|
+
});
|
|
82
|
+
if (result.kind === "budget-exceeded") {
|
|
83
|
+
return { kind: "budget-exceeded", sentinel: result.sentinel };
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
coverage: "available",
|
|
87
|
+
data: { ...result.value, dropped_synonyms: dropped },
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return failFromErr(err);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export async function drugsInClass(input, deps) {
|
|
95
|
+
const modulators = input.collectors.chemblModulators;
|
|
96
|
+
if (modulators.coverage !== "available" || modulators.data.modulators.length === 0) {
|
|
97
|
+
return fail("no modulators in class");
|
|
98
|
+
}
|
|
99
|
+
const { kept } = dedupModulatorsByParent(modulators.data.modulators);
|
|
100
|
+
if (kept.length === 0) {
|
|
101
|
+
return fail("no modulators after dedup");
|
|
102
|
+
}
|
|
103
|
+
const prompt = [
|
|
104
|
+
`Target: ${input.resolved.geneSymbol}`,
|
|
105
|
+
`ChEMBL modulators (max_phase ≥ 2, deduped by active substance):`,
|
|
106
|
+
JSON.stringify(kept, null, 2),
|
|
107
|
+
].join("\n");
|
|
108
|
+
try {
|
|
109
|
+
const result = await structuredLlmCall({
|
|
110
|
+
stepName: `ta-decision:drugs-in-class:${deps.attempt}`,
|
|
111
|
+
agentId: "drugs-in-class",
|
|
112
|
+
provider: deps.chatProvider,
|
|
113
|
+
session: deps.session,
|
|
114
|
+
system: drugsInClassPrompt,
|
|
115
|
+
prompt,
|
|
116
|
+
schema: DrugsInClassOutputSchema,
|
|
117
|
+
model: deps.model,
|
|
118
|
+
});
|
|
119
|
+
if (result.kind === "budget-exceeded") {
|
|
120
|
+
return { kind: "budget-exceeded", sentinel: result.sentinel };
|
|
121
|
+
}
|
|
122
|
+
return { coverage: "available", data: result.value };
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
return failFromErr(err);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase-3 fan-out item functions for the harness DBOS workflow.
|
|
3
|
+
*
|
|
4
|
+
* Each function operates on one item (one modulator, one trial, one class
|
|
5
|
+
* drug) and returns a coverage envelope. The DBOS workflow body iterates
|
|
6
|
+
* the item list and dispatches each via `DBOS.runStep` with a deterministic
|
|
7
|
+
* step name `"ta-fanout:{kind}:{itemKey}"`. The `withHost` semaphore inside
|
|
8
|
+
* each body caps openFDA / ChEMBL / ctgov in-flight at 4.
|
|
9
|
+
*
|
|
10
|
+
* No throws — coverage envelope is the failure mode. Recovery replays the
|
|
11
|
+
* cached envelope from the DBOS step cache.
|
|
12
|
+
*/
|
|
13
|
+
import type { SerializedError } from "../coverage.js";
|
|
14
|
+
import type { ClassDrugItem, PerClassDrugAEsItem } from "../steps/fanout/aes-for-one-class-drug-step.js";
|
|
15
|
+
import type { PerTrialAEsItem, TrialItem } from "../steps/fanout/aes-for-one-trial-step.js";
|
|
16
|
+
import type { ModulatorItem, PerModulatorFaersItem } from "../steps/fanout/faers-for-one-modulator-step.js";
|
|
17
|
+
import type { PerModulatorPolypharmItem, PolypharmInputItem } from "../steps/fanout/polypharm-for-one-modulator-step.js";
|
|
18
|
+
export type { ClassDrugItem, ModulatorItem, PerClassDrugAEsItem, PerModulatorFaersItem, PerModulatorPolypharmItem, PerTrialAEsItem, PolypharmInputItem, TrialItem, };
|
|
19
|
+
type CoverageAvailable<T> = {
|
|
20
|
+
coverage: "available";
|
|
21
|
+
data: T;
|
|
22
|
+
};
|
|
23
|
+
type CoverageQueriedNoData = {
|
|
24
|
+
coverage: "queried_no_data";
|
|
25
|
+
error?: SerializedError;
|
|
26
|
+
};
|
|
27
|
+
type CoverageEnvelope<T> = CoverageAvailable<T> | CoverageQueriedNoData;
|
|
28
|
+
export declare function faersForOneModulator(item: ModulatorItem): Promise<CoverageEnvelope<PerModulatorFaersItem>>;
|
|
29
|
+
export declare function polypharmForOneModulator(item: PolypharmInputItem): Promise<CoverageEnvelope<PerModulatorPolypharmItem>>;
|
|
30
|
+
export declare function aesForOneTrial(item: TrialItem): Promise<CoverageEnvelope<PerTrialAEsItem>>;
|
|
31
|
+
export declare function aesForOneClassDrug(item: ClassDrugItem): Promise<CoverageEnvelope<PerClassDrugAEsItem>>;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase-3 fan-out item functions for the harness DBOS workflow.
|
|
3
|
+
*
|
|
4
|
+
* Each function operates on one item (one modulator, one trial, one class
|
|
5
|
+
* drug) and returns a coverage envelope. The DBOS workflow body iterates
|
|
6
|
+
* the item list and dispatches each via `DBOS.runStep` with a deterministic
|
|
7
|
+
* step name `"ta-fanout:{kind}:{itemKey}"`. The `withHost` semaphore inside
|
|
8
|
+
* each body caps openFDA / ChEMBL / ctgov in-flight at 4.
|
|
9
|
+
*
|
|
10
|
+
* No throws — coverage envelope is the failure mode. Recovery replays the
|
|
11
|
+
* cached envelope from the DBOS step cache.
|
|
12
|
+
*/
|
|
13
|
+
import { withHost } from "../../../lib/host-concurrency.js";
|
|
14
|
+
import { getModulatorOnTargetPchembl, getModulatorPolypharmacology } from "../../../tools/lib/chembl-client.js";
|
|
15
|
+
import { getTrialDetails } from "../../../tools/lib/clinical-trials-client.js";
|
|
16
|
+
import { getFaersByDrug, getFaersSeriousness } from "../../../tools/lib/openfda-client.js";
|
|
17
|
+
function fail(message) {
|
|
18
|
+
return { coverage: "queried_no_data", error: { message } };
|
|
19
|
+
}
|
|
20
|
+
function failFromErr(err) {
|
|
21
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
22
|
+
}
|
|
23
|
+
// ── Per-modulator FAERS ──────────────────────────────────────────────
|
|
24
|
+
export async function faersForOneModulator(item) {
|
|
25
|
+
const probe = item.preferredName;
|
|
26
|
+
if (!probe) {
|
|
27
|
+
return fail(`no preferred name for ${item.moleculeChemblId}`);
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const [byDrug, seriousness] = await Promise.all([
|
|
31
|
+
withHost("openfda", () => getFaersByDrug(probe, { limit: 10 })),
|
|
32
|
+
withHost("openfda", () => getFaersSeriousness(probe)),
|
|
33
|
+
]);
|
|
34
|
+
const total = byDrug.totalReports ?? 0;
|
|
35
|
+
if (total === 0 && byDrug.adverseEvents.length === 0) {
|
|
36
|
+
return fail(`FAERS returned no reports for ${probe}`);
|
|
37
|
+
}
|
|
38
|
+
if (seriousness !== null &&
|
|
39
|
+
seriousness.totalReports >= 1000 &&
|
|
40
|
+
seriousness.fatalCount === 0 &&
|
|
41
|
+
seriousness.hospitalizationCount === 0 &&
|
|
42
|
+
seriousness.lifeThreateningCount === 0 &&
|
|
43
|
+
seriousness.disablingCount === 0 &&
|
|
44
|
+
seriousness.congenitalAnomalyCount === 0 &&
|
|
45
|
+
seriousness.otherSeriousCount === 0) {
|
|
46
|
+
return fail(`FAERS seriousness all-zero across ${seriousness.totalReports} reports for ${probe}; openFDA seriousness fields not reliably populated`);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
coverage: "available",
|
|
50
|
+
data: {
|
|
51
|
+
moleculeChemblId: item.moleculeChemblId,
|
|
52
|
+
preferredName: probe,
|
|
53
|
+
totalReports: byDrug.totalReports ?? null,
|
|
54
|
+
topReactions: byDrug.adverseEvents,
|
|
55
|
+
seriousness,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return failFromErr(err);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// ── Per-modulator polypharmacology ──────────────────────────────────
|
|
64
|
+
export async function polypharmForOneModulator(item) {
|
|
65
|
+
try {
|
|
66
|
+
const [hits, primaryPchembl] = await Promise.all([
|
|
67
|
+
withHost("chembl", () => getModulatorPolypharmacology(item.moleculeChemblId, {
|
|
68
|
+
minPchembl: 5,
|
|
69
|
+
excludeTargetChemblId: item.primaryTargetChemblId ?? undefined,
|
|
70
|
+
limit: 200,
|
|
71
|
+
})),
|
|
72
|
+
item.primaryTargetChemblId
|
|
73
|
+
? withHost("chembl", () => getModulatorOnTargetPchembl(item.moleculeChemblId, item.primaryTargetChemblId))
|
|
74
|
+
: Promise.resolve(null),
|
|
75
|
+
]);
|
|
76
|
+
if (hits.length === 0) {
|
|
77
|
+
return fail(`no polypharm hits for ${item.moleculeChemblId}`);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
coverage: "available",
|
|
81
|
+
data: {
|
|
82
|
+
moleculeChemblId: item.moleculeChemblId,
|
|
83
|
+
preferredName: item.preferredName,
|
|
84
|
+
primaryPchembl,
|
|
85
|
+
hits: hits.map((h) => ({
|
|
86
|
+
targetChemblId: h.targetChemblId,
|
|
87
|
+
targetName: h.targetName,
|
|
88
|
+
pchemblValue: h.pchemblValue,
|
|
89
|
+
standardType: h.standardType,
|
|
90
|
+
standardValue: h.standardValue,
|
|
91
|
+
standardUnits: h.standardUnits,
|
|
92
|
+
})),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
return failFromErr(err);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// ── Per-trial AEs ────────────────────────────────────────────────────
|
|
101
|
+
export async function aesForOneTrial(item) {
|
|
102
|
+
try {
|
|
103
|
+
const details = await withHost("ctgov", () => getTrialDetails(item.nctId));
|
|
104
|
+
if (!details) {
|
|
105
|
+
return fail(`no details for ${item.nctId}`);
|
|
106
|
+
}
|
|
107
|
+
if (details.adverseEvents.length === 0 && details.outcomes.length === 0) {
|
|
108
|
+
return fail(`no AE/outcome rows for ${item.nctId}`);
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
coverage: "available",
|
|
112
|
+
data: {
|
|
113
|
+
nctId: item.nctId,
|
|
114
|
+
title: item.title,
|
|
115
|
+
whyStopped: details.whyStopped,
|
|
116
|
+
outcomes: details.outcomes,
|
|
117
|
+
groups: details.adverseEventGroups,
|
|
118
|
+
events: details.adverseEvents,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return failFromErr(err);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ── Per-class-drug AEs ───────────────────────────────────────────────
|
|
127
|
+
export async function aesForOneClassDrug(item) {
|
|
128
|
+
const probe = item.preferredName;
|
|
129
|
+
if (!probe) {
|
|
130
|
+
return fail(`no preferred name for ${item.moleculeChemblId}`);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const [byDrug, seriousness] = await Promise.all([
|
|
134
|
+
withHost("openfda", () => getFaersByDrug(probe, { limit: 10 })),
|
|
135
|
+
withHost("openfda", () => getFaersSeriousness(probe)),
|
|
136
|
+
]);
|
|
137
|
+
const total = byDrug.totalReports ?? 0;
|
|
138
|
+
if (total === 0 && byDrug.adverseEvents.length === 0) {
|
|
139
|
+
return fail(`FAERS returned no reports for ${probe}`);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
coverage: "available",
|
|
143
|
+
data: {
|
|
144
|
+
moleculeChemblId: item.moleculeChemblId,
|
|
145
|
+
preferredName: probe,
|
|
146
|
+
totalReports: byDrug.totalReports ?? null,
|
|
147
|
+
topReactions: byDrug.adverseEvents,
|
|
148
|
+
seriousness,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
return failFromErr(err);
|
|
154
|
+
}
|
|
155
|
+
}
|