@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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process workspace surface for the report-builder agent.
|
|
3
|
+
*
|
|
4
|
+
* Tight read/write/mkdir surface scoped to the version directory.
|
|
5
|
+
* Agent-supplied paths are resolved against `versionDir`; any path that
|
|
6
|
+
* escapes is rejected as `out_of_scope`. Constructed inside the
|
|
7
|
+
* iterate-report runner so it always shares the same `versionDir` as the
|
|
8
|
+
* rest of the report tools.
|
|
9
|
+
*/
|
|
10
|
+
import { type Tool } from "../define-tool.js";
|
|
11
|
+
export interface VersionFsToolsState {
|
|
12
|
+
/** Absolute path to the version directory. All paths resolve under this. */
|
|
13
|
+
readonly versionDir: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function createVersionFsTools(state: VersionFsToolsState): Tool[];
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-process workspace surface for the report-builder agent.
|
|
3
|
+
*
|
|
4
|
+
* Tight read/write/mkdir surface scoped to the version directory.
|
|
5
|
+
* Agent-supplied paths are resolved against `versionDir`; any path that
|
|
6
|
+
* escapes is rejected as `out_of_scope`. Constructed inside the
|
|
7
|
+
* iterate-report runner so it always shares the same `versionDir` as the
|
|
8
|
+
* rest of the report tools.
|
|
9
|
+
*/
|
|
10
|
+
import { mkdir as fsMkdir, readFile as fsReadFile, stat as fsStat, writeFile as fsWriteFile } from "node:fs/promises";
|
|
11
|
+
import { dirname, resolve as resolvePath, sep } from "node:path";
|
|
12
|
+
import { ok } from "neverthrow";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { defineTool } from "../define-tool.js";
|
|
15
|
+
const MAX_READ_BYTES = 256 * 1024;
|
|
16
|
+
const MAX_WRITE_BYTES = 1 * 1024 * 1024;
|
|
17
|
+
/** Resolve an agent-supplied path against `versionDir`, rejecting escapes. */
|
|
18
|
+
function resolveAgentPath(agentPath, versionDir) {
|
|
19
|
+
if (agentPath.length === 0 || agentPath.includes("\0")) {
|
|
20
|
+
return { kind: "out_of_scope", reason: "empty or null-byte path" };
|
|
21
|
+
}
|
|
22
|
+
// Strip a leading slash so an agent typing "/index.html" is treated as
|
|
23
|
+
// "index.html" relative to versionDir (the version dir is the root).
|
|
24
|
+
const stripped = agentPath.replace(/^\/+/, "");
|
|
25
|
+
if (!stripped) {
|
|
26
|
+
return { kind: "out_of_scope", reason: "path resolves to the version dir itself" };
|
|
27
|
+
}
|
|
28
|
+
const absolute = resolvePath(versionDir, stripped);
|
|
29
|
+
if (absolute !== versionDir && !absolute.startsWith(versionDir + sep)) {
|
|
30
|
+
return { kind: "out_of_scope", reason: `path escapes version dir: ${agentPath}` };
|
|
31
|
+
}
|
|
32
|
+
return { kind: "ok", absolute };
|
|
33
|
+
}
|
|
34
|
+
export function createVersionFsTools(state) {
|
|
35
|
+
const writeFile = defineTool({
|
|
36
|
+
id: "write_file",
|
|
37
|
+
description: "Write a UTF-8 text file under the report's version directory. Use " +
|
|
38
|
+
"relative paths (e.g. `report.html.j2`, `assets/foo.csv`). Returns " +
|
|
39
|
+
"`out_of_scope` for any path that escapes the version dir.",
|
|
40
|
+
inputSchema: z.object({
|
|
41
|
+
path: z.string().min(1),
|
|
42
|
+
content: z.string(),
|
|
43
|
+
}),
|
|
44
|
+
execute: async ({ path, content }) => {
|
|
45
|
+
const resolved = resolveAgentPath(path, state.versionDir);
|
|
46
|
+
if (resolved.kind === "out_of_scope") {
|
|
47
|
+
return ok({ status: "out_of_scope", reason: resolved.reason });
|
|
48
|
+
}
|
|
49
|
+
const bytes = Buffer.byteLength(content, "utf8");
|
|
50
|
+
if (bytes > MAX_WRITE_BYTES) {
|
|
51
|
+
return ok({
|
|
52
|
+
status: "too_large",
|
|
53
|
+
reason: `write rejected: ${bytes} bytes exceeds ${MAX_WRITE_BYTES} cap`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
await fsMkdir(dirname(resolved.absolute), { recursive: true });
|
|
57
|
+
await fsWriteFile(resolved.absolute, content, "utf8");
|
|
58
|
+
return ok({ status: "ok", bytesWritten: bytes });
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
const editFile = defineTool({
|
|
62
|
+
id: "edit_file",
|
|
63
|
+
description: "Surgical edit of an existing UTF-8 file inside the report's version " +
|
|
64
|
+
"directory: replace the first occurrence of `oldText` with `newText`. " +
|
|
65
|
+
"Returns `not_found` if the file doesn't exist, `no_match` if " +
|
|
66
|
+
"`oldText` isn't present.",
|
|
67
|
+
inputSchema: z.object({
|
|
68
|
+
path: z.string().min(1),
|
|
69
|
+
oldText: z.string().min(1),
|
|
70
|
+
newText: z.string(),
|
|
71
|
+
}),
|
|
72
|
+
execute: async ({ path, oldText, newText }) => {
|
|
73
|
+
const resolved = resolveAgentPath(path, state.versionDir);
|
|
74
|
+
if (resolved.kind === "out_of_scope") {
|
|
75
|
+
return ok({ status: "out_of_scope", reason: resolved.reason });
|
|
76
|
+
}
|
|
77
|
+
let content;
|
|
78
|
+
try {
|
|
79
|
+
content = await fsReadFile(resolved.absolute, "utf8");
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
if (err.code === "ENOENT") {
|
|
83
|
+
return ok({ status: "not_found" });
|
|
84
|
+
}
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
const idx = content.indexOf(oldText);
|
|
88
|
+
if (idx === -1) {
|
|
89
|
+
return ok({ status: "no_match" });
|
|
90
|
+
}
|
|
91
|
+
const next = content.slice(0, idx) + newText + content.slice(idx + oldText.length);
|
|
92
|
+
const bytes = Buffer.byteLength(next, "utf8");
|
|
93
|
+
if (bytes > MAX_WRITE_BYTES) {
|
|
94
|
+
return ok({
|
|
95
|
+
status: "too_large",
|
|
96
|
+
reason: `post-edit size ${bytes} bytes exceeds ${MAX_WRITE_BYTES} cap`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
await fsWriteFile(resolved.absolute, next, "utf8");
|
|
100
|
+
return ok({ status: "ok", bytesWritten: bytes });
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
const readFile = defineTool({
|
|
104
|
+
id: "read_file",
|
|
105
|
+
description: "Read a UTF-8 file inside the report's version directory. Returns " + "truncated content (capped at 256 KiB) for large files.",
|
|
106
|
+
inputSchema: z.object({
|
|
107
|
+
path: z.string().min(1),
|
|
108
|
+
}),
|
|
109
|
+
execute: async ({ path }) => {
|
|
110
|
+
const resolved = resolveAgentPath(path, state.versionDir);
|
|
111
|
+
if (resolved.kind === "out_of_scope") {
|
|
112
|
+
return ok({ status: "out_of_scope", reason: resolved.reason });
|
|
113
|
+
}
|
|
114
|
+
let st;
|
|
115
|
+
try {
|
|
116
|
+
st = await fsStat(resolved.absolute);
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
if (err.code === "ENOENT") {
|
|
120
|
+
return ok({ status: "not_found" });
|
|
121
|
+
}
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
if (!st.isFile()) {
|
|
125
|
+
return ok({ status: "not_found" });
|
|
126
|
+
}
|
|
127
|
+
const buf = await fsReadFile(resolved.absolute);
|
|
128
|
+
const truncated = buf.length > MAX_READ_BYTES;
|
|
129
|
+
const sliced = truncated ? buf.subarray(0, MAX_READ_BYTES) : buf;
|
|
130
|
+
return ok({
|
|
131
|
+
status: "ok",
|
|
132
|
+
content: sliced.toString("utf8"),
|
|
133
|
+
truncated,
|
|
134
|
+
totalBytes: st.size,
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
const mkdir = defineTool({
|
|
139
|
+
id: "mkdir",
|
|
140
|
+
description: "Create a directory (recursive) inside the report's version directory.",
|
|
141
|
+
inputSchema: z.object({
|
|
142
|
+
path: z.string().min(1),
|
|
143
|
+
}),
|
|
144
|
+
execute: async ({ path }) => {
|
|
145
|
+
const resolved = resolveAgentPath(path, state.versionDir);
|
|
146
|
+
if (resolved.kind === "out_of_scope") {
|
|
147
|
+
return ok({ status: "out_of_scope", reason: resolved.reason });
|
|
148
|
+
}
|
|
149
|
+
await fsMkdir(resolved.absolute, { recursive: true });
|
|
150
|
+
return ok({ status: "ok" });
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
return [writeFile, editFile, readFile, mkdir];
|
|
154
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context7 documentation lookup tools for sandbox agents.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the Context7 REST API to let agents look up current package
|
|
5
|
+
* documentation and code examples at runtime. Two-step flow:
|
|
6
|
+
* 1. resolveLibraryId — find the Context7 library ID for a package name
|
|
7
|
+
* 2. queryDocs — query documentation for a resolved library
|
|
8
|
+
*/
|
|
9
|
+
type ResolveLibraryIdOutput = {
|
|
10
|
+
found: false;
|
|
11
|
+
} | {
|
|
12
|
+
found: true;
|
|
13
|
+
libraryId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
type QueryDocsOutput = {
|
|
18
|
+
found: false;
|
|
19
|
+
} | {
|
|
20
|
+
found: true;
|
|
21
|
+
documentation: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const resolveLibraryIdTool: import("../define-tool.js").Tool<{
|
|
24
|
+
libraryName: string;
|
|
25
|
+
query: string;
|
|
26
|
+
}, ResolveLibraryIdOutput>;
|
|
27
|
+
export declare const queryDocsTool: import("../define-tool.js").Tool<{
|
|
28
|
+
libraryId: string;
|
|
29
|
+
query: string;
|
|
30
|
+
}, QueryDocsOutput>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context7 documentation lookup tools for sandbox agents.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the Context7 REST API to let agents look up current package
|
|
5
|
+
* documentation and code examples at runtime. Two-step flow:
|
|
6
|
+
* 1. resolveLibraryId — find the Context7 library ID for a package name
|
|
7
|
+
* 2. queryDocs — query documentation for a resolved library
|
|
8
|
+
*/
|
|
9
|
+
import { ok } from "neverthrow";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { defineTool } from "../define-tool.js";
|
|
12
|
+
import { apiFetchValidated, describeApiError } from "../lib/api-utils.js";
|
|
13
|
+
const CONTEXT7_BASE = "https://context7.com/api/v1";
|
|
14
|
+
// Raw Context7 wire shapes, validated at the fetch boundary. `id`/`name` stay
|
|
15
|
+
// required — they are read without a guard — while genuinely-optional fields
|
|
16
|
+
// carry `.optional()` so a partial-but-valid response still parses.
|
|
17
|
+
const Context7SearchResponseSchema = z.object({
|
|
18
|
+
results: z.array(z.object({ id: z.string(), name: z.string(), description: z.string().nullable().optional() })).optional(),
|
|
19
|
+
});
|
|
20
|
+
const Context7DocsResponseSchema = z.object({ content: z.string().optional() });
|
|
21
|
+
export const resolveLibraryIdTool = defineTool({
|
|
22
|
+
id: "resolve_library_id",
|
|
23
|
+
description: "Resolve a package name (e.g., 'scanpy', 'DESeq2', 'scikit-learn') to a Context7 library ID. Call this BEFORE queryDocs to get the library ID needed for documentation lookup. Returns matching libraries ranked by relevance.",
|
|
24
|
+
inputSchema: z.object({
|
|
25
|
+
libraryName: z.string().describe("Package or library name to search for (e.g., 'scanpy', 'pysam', 'lifelines')."),
|
|
26
|
+
query: z.string().describe("What you need help with — used to rank results by relevance (e.g., 'how to run differential expression')."),
|
|
27
|
+
}),
|
|
28
|
+
execute: async ({ libraryName, query }) => {
|
|
29
|
+
const result = await apiFetchValidated(`${CONTEXT7_BASE}/search?query=${encodeURIComponent(libraryName)}&topic=${encodeURIComponent(query)}`, Context7SearchResponseSchema, { maxRetries: 1 });
|
|
30
|
+
if (result.isErr())
|
|
31
|
+
throw new Error(`Context7 search failed: ${describeApiError(result.error)}`);
|
|
32
|
+
const best = (result.value.results ?? [])[0];
|
|
33
|
+
// No match is an expected outcome — a `found: false` data variant.
|
|
34
|
+
if (!best)
|
|
35
|
+
return ok({ found: false });
|
|
36
|
+
return ok({
|
|
37
|
+
found: true,
|
|
38
|
+
libraryId: best.id,
|
|
39
|
+
name: best.name,
|
|
40
|
+
description: best.description ?? "",
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
export const queryDocsTool = defineTool({
|
|
45
|
+
id: "query_docs",
|
|
46
|
+
description: "Query up-to-date documentation and code examples for a library. You must call resolve-library-id first to get the libraryId. Use this to verify function signatures, parameters, and usage patterns before writing code.",
|
|
47
|
+
inputSchema: z.object({
|
|
48
|
+
libraryId: z.string().describe("Context7 library ID from resolve-library-id (e.g., '/scverse/scanpy')."),
|
|
49
|
+
query: z.string().describe("Specific question about the library (e.g., 'rank_genes_groups function parameters and usage')."),
|
|
50
|
+
}),
|
|
51
|
+
execute: async ({ libraryId, query }) => {
|
|
52
|
+
const result = await apiFetchValidated(`${CONTEXT7_BASE}/docs?libraryId=${encodeURIComponent(libraryId)}&query=${encodeURIComponent(query)}`, Context7DocsResponseSchema, { maxRetries: 1 });
|
|
53
|
+
if (result.isErr())
|
|
54
|
+
throw new Error(`Context7 query failed: ${describeApiError(result.error)}`);
|
|
55
|
+
const documentation = result.value.content ?? "";
|
|
56
|
+
// No documentation for the query is an expected outcome.
|
|
57
|
+
if (!documentation)
|
|
58
|
+
return ok({ found: false });
|
|
59
|
+
return ok({ found: true, documentation });
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generateAnalogyReport — cross-domain analogy report as a sub-agent tool.
|
|
3
|
+
*
|
|
4
|
+
* An inline harness `AgentDefinition` (mirroring `createLiteratureReviewerTool`)
|
|
5
|
+
* driven by `runAgent`. The inner research agent runs Phase 1 extraction +
|
|
6
|
+
* Phase 2 cross-domain search; the wrapper parses + schema-validates the text
|
|
7
|
+
* output; on parse failure a single-shot conversion call (no tools) transforms
|
|
8
|
+
* raw markdown into a valid envelope; on hard failure an `extraction-failed`
|
|
9
|
+
* error envelope surfaces — the frontend never has to render raw prose.
|
|
10
|
+
*
|
|
11
|
+
* One provider serves both the research agent and the conversion retry; the
|
|
12
|
+
* wrapper's parse + validate + error-envelope cascade is the correctness
|
|
13
|
+
* boundary.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { type AnalogicalReasonerOutput } from "@inflexa-ai/harness/contracts/analogy-report.js";
|
|
17
|
+
import type { ChatProvider } from "../../providers/types.js";
|
|
18
|
+
import { type Tool } from "../define-tool.js";
|
|
19
|
+
import { type BioToolKeys } from "../bio/keys.js";
|
|
20
|
+
export declare const generateAnalogyReportInputSchema: z.ZodObject<{
|
|
21
|
+
problem: z.ZodString;
|
|
22
|
+
context: z.ZodOptional<z.ZodString>;
|
|
23
|
+
numDomains: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
solutionsPerDomain: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
preferredDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
excludeDomains: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type GenerateAnalogyReportInput = z.infer<typeof generateAnalogyReportInputSchema>;
|
|
29
|
+
/**
|
|
30
|
+
* Render the structured input as a brief that maps 1-to-1 to the
|
|
31
|
+
* `analogical-reasoner` prompt's "Inputs you may see in the brief" section.
|
|
32
|
+
* Exported for unit testing.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildResearchPrompt(input: GenerateAnalogyReportInput): string;
|
|
35
|
+
export interface GenerateAnalogyReportDeps {
|
|
36
|
+
/** The LLM seam the child loop runs on. */
|
|
37
|
+
readonly provider: ChatProvider;
|
|
38
|
+
/** Model id — provenance / metric label; the provider owns the wire model. */
|
|
39
|
+
readonly model: string;
|
|
40
|
+
/** API keys for the bio/chem + GitHub data sources the reasoner searches. */
|
|
41
|
+
readonly bioKeys: BioToolKeys;
|
|
42
|
+
}
|
|
43
|
+
/** Build the `generate_analogy_report` delegation tool bound to its provider. */
|
|
44
|
+
export declare function createGenerateAnalogyReportTool(deps: GenerateAnalogyReportDeps): Tool;
|
|
45
|
+
interface ParseSuccess {
|
|
46
|
+
ok: true;
|
|
47
|
+
value: AnalogicalReasonerOutput;
|
|
48
|
+
}
|
|
49
|
+
interface ParseFailure {
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: "not-json" | "schema-mismatch";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Trim leading whitespace and strip a single wrapping ```json fence before
|
|
55
|
+
* parsing — the inner agent's prompt forbids code fences but a relaxed
|
|
56
|
+
* parse here avoids burning a conversion retry on trivial slips. Beyond
|
|
57
|
+
* that, no salvaging. Exported for unit testing.
|
|
58
|
+
*/
|
|
59
|
+
export declare function tryParseEnvelope(raw: string): ParseSuccess | ParseFailure;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generateAnalogyReport — cross-domain analogy report as a sub-agent tool.
|
|
3
|
+
*
|
|
4
|
+
* An inline harness `AgentDefinition` (mirroring `createLiteratureReviewerTool`)
|
|
5
|
+
* driven by `runAgent`. The inner research agent runs Phase 1 extraction +
|
|
6
|
+
* Phase 2 cross-domain search; the wrapper parses + schema-validates the text
|
|
7
|
+
* output; on parse failure a single-shot conversion call (no tools) transforms
|
|
8
|
+
* raw markdown into a valid envelope; on hard failure an `extraction-failed`
|
|
9
|
+
* error envelope surfaces — the frontend never has to render raw prose.
|
|
10
|
+
*
|
|
11
|
+
* One provider serves both the research agent and the conversion retry; the
|
|
12
|
+
* wrapper's parse + validate + error-envelope cascade is the correctness
|
|
13
|
+
* boundary.
|
|
14
|
+
*/
|
|
15
|
+
import { ok } from "neverthrow";
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
import { AnalogicalReasonerOutputSchema } from "@inflexa-ai/harness/contracts/analogy-report.js";
|
|
18
|
+
import { analogicalReasonerPrompt } from "../../prompts/analogical-reasoner.js";
|
|
19
|
+
import { forSubAgent } from "../../auth/types.js";
|
|
20
|
+
import { unwrapOrThrow } from "../../lib/result.js";
|
|
21
|
+
import { finalText, runAgent } from "../../loop/run-agent.js";
|
|
22
|
+
import { passthroughStep } from "../../loop/run-step.js";
|
|
23
|
+
import { defineTool } from "../define-tool.js";
|
|
24
|
+
// Cross-domain search tools the analogical-reasoner uses.
|
|
25
|
+
import { searchSemanticScholarTool } from "./search-semantic-scholar.js";
|
|
26
|
+
import { searchArxivTool } from "./search-arxiv.js";
|
|
27
|
+
import { createSearchGithubReposTool } from "./search-github-repos.js";
|
|
28
|
+
// Biology literature — reused for analogies that land back in biology.
|
|
29
|
+
import { createNcbiTools } from "../bio/keys.js";
|
|
30
|
+
/** Sub-agent identity — appended to `callPath`, set as `agentId`. */
|
|
31
|
+
const AGENT_ID = "analogical-reasoner";
|
|
32
|
+
/** Tool-call budget for the inner research agent. */
|
|
33
|
+
const RESEARCH_MAX_ITERATIONS = 40;
|
|
34
|
+
export const generateAnalogyReportInputSchema = z.object({
|
|
35
|
+
problem: z
|
|
36
|
+
.string()
|
|
37
|
+
.min(1)
|
|
38
|
+
.describe("The scientific problem in natural language. The single most important " +
|
|
39
|
+
"field — describes what the user is trying to do and the system-level " +
|
|
40
|
+
"constraints. Keep it focused; the inner agent reads this verbatim."),
|
|
41
|
+
context: z
|
|
42
|
+
.string()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Optional supporting context: data profile excerpt, prior findings, " +
|
|
45
|
+
"experimental design notes, user constraints. Keep under ~500 tokens. " +
|
|
46
|
+
"Do NOT paste full files — the inner agent does not need them."),
|
|
47
|
+
numDomains: z.number().int().min(2).max(5).optional().describe("How many cross-domain analogies to extract. Defaults to 3."),
|
|
48
|
+
solutionsPerDomain: z.number().int().min(1).max(5).optional().describe("How many real, cited solutions to surface per analogy. Defaults to 3."),
|
|
49
|
+
preferredDomains: z
|
|
50
|
+
.array(z.string())
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Soft preferences for analogy domains (e.g., " + '`["control_theory", "ecology"]`). The agent treats these as hints, ' + "not constraints."),
|
|
53
|
+
excludeDomains: z
|
|
54
|
+
.array(z.string())
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("Hard exclusions — domains the agent must avoid. Use to force a " +
|
|
57
|
+
'cross-domain search (e.g., `["biology"]` when the source problem is ' +
|
|
58
|
+
"biological)."),
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Render the structured input as a brief that maps 1-to-1 to the
|
|
62
|
+
* `analogical-reasoner` prompt's "Inputs you may see in the brief" section.
|
|
63
|
+
* Exported for unit testing.
|
|
64
|
+
*/
|
|
65
|
+
export function buildResearchPrompt(input) {
|
|
66
|
+
const lines = ["## Problem", input.problem];
|
|
67
|
+
if (input.context) {
|
|
68
|
+
lines.push("", "## Context", input.context);
|
|
69
|
+
}
|
|
70
|
+
const knobs = [];
|
|
71
|
+
if (input.numDomains !== undefined) {
|
|
72
|
+
knobs.push(`- numDomains: ${input.numDomains}`);
|
|
73
|
+
}
|
|
74
|
+
if (input.solutionsPerDomain !== undefined) {
|
|
75
|
+
knobs.push(`- solutionsPerDomain: ${input.solutionsPerDomain}`);
|
|
76
|
+
}
|
|
77
|
+
if (input.preferredDomains && input.preferredDomains.length > 0) {
|
|
78
|
+
knobs.push(`- preferredDomains: ${input.preferredDomains.join(", ")}`);
|
|
79
|
+
}
|
|
80
|
+
if (input.excludeDomains && input.excludeDomains.length > 0) {
|
|
81
|
+
knobs.push(`- excludeDomains: ${input.excludeDomains.join(", ")}`);
|
|
82
|
+
}
|
|
83
|
+
if (knobs.length > 0) {
|
|
84
|
+
lines.push("", "## Knobs", ...knobs);
|
|
85
|
+
}
|
|
86
|
+
return lines.join("\n");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Conversion prompt the retry uses when the inner research agent's output
|
|
90
|
+
* is not valid JSON. Quotes the raw output verbatim and asks for a strict
|
|
91
|
+
* AnalogyReportSchema-shaped object back. No tools — single shot.
|
|
92
|
+
*/
|
|
93
|
+
function buildConversionPrompt(rawOutput) {
|
|
94
|
+
return [
|
|
95
|
+
"Convert the analogical-reasoner output below into a single JSON",
|
|
96
|
+
"object matching the AnalogyReport schema. Return ONLY raw JSON — no",
|
|
97
|
+
"prose, no markdown fences, no commentary, no apology. The first",
|
|
98
|
+
"character of your response must be `{`. The final character must be `}`.",
|
|
99
|
+
"",
|
|
100
|
+
"## Required shape (AnalogyReportSchema)",
|
|
101
|
+
"",
|
|
102
|
+
"```json",
|
|
103
|
+
"{",
|
|
104
|
+
' "schemaVersion": "1",',
|
|
105
|
+
' "problemSummary": "1-2 sentence summary of the source problem.",',
|
|
106
|
+
' "problemObjects": [{ "name": "...", "role": "..." }],',
|
|
107
|
+
' "problemRelations": ["short bullet phrase", "..."],',
|
|
108
|
+
' "keyTerms": ["term1", "term2"],',
|
|
109
|
+
' "analogies": [',
|
|
110
|
+
" {",
|
|
111
|
+
' "targetDomain": "control_theory",',
|
|
112
|
+
' "analogyTitle": "Adaptive control of an unseen plant",',
|
|
113
|
+
' "objectMappings": [{ "source": "...", "target": "...", "rationale": "..." }],',
|
|
114
|
+
' "sharedRelations": "...",',
|
|
115
|
+
' "coverage": "available",',
|
|
116
|
+
' "solutions": [',
|
|
117
|
+
" {",
|
|
118
|
+
' "title": "Method or paper title (verbatim from input)",',
|
|
119
|
+
' "sourceDomain": "control_theory",',
|
|
120
|
+
' "description": "2-3 sentences.",',
|
|
121
|
+
' "keyConcepts": ["..."],',
|
|
122
|
+
' "relevance": "How this transfers back to the source problem.",',
|
|
123
|
+
' "sources": [{ "url": "https://...", "title": "Exact paper title" }],',
|
|
124
|
+
' "githubRepos": []',
|
|
125
|
+
" }",
|
|
126
|
+
" ]",
|
|
127
|
+
" }",
|
|
128
|
+
" ]",
|
|
129
|
+
"}",
|
|
130
|
+
"```",
|
|
131
|
+
"",
|
|
132
|
+
"## Field rules",
|
|
133
|
+
"",
|
|
134
|
+
"- Preserve every analogy, object mapping, shared relation, solution, and",
|
|
135
|
+
" citation that appears in the input. Do not invent content.",
|
|
136
|
+
"- Each analogy needs `coverage`:",
|
|
137
|
+
" - `available` when the input lists concrete solutions for it,",
|
|
138
|
+
" - `queried_no_data` when the input says searches returned no usable results,",
|
|
139
|
+
" - `search_failed` when the input says the search tool errored out,",
|
|
140
|
+
" - `not_loaded` when the input says the analogy was skipped (budget).",
|
|
141
|
+
" When `coverage` is not `available`, `solutions` must be `[]`.",
|
|
142
|
+
"- Each `solutions[].sources[]` entry needs a valid `url` (http/https)",
|
|
143
|
+
" AND a `title`. If a paper is mentioned without a URL, omit that source.",
|
|
144
|
+
"- `githubRepos` must always be an array (use `[]` when not mentioned).",
|
|
145
|
+
"- If the input has no extractable analogy content at all (pure apology,",
|
|
146
|
+
" empty, off-topic), return the envelope with `analogies: []`. The",
|
|
147
|
+
" wrapper translates that into an error envelope.",
|
|
148
|
+
"",
|
|
149
|
+
"--- INPUT ---",
|
|
150
|
+
rawOutput,
|
|
151
|
+
"--- END INPUT ---",
|
|
152
|
+
].join("\n");
|
|
153
|
+
}
|
|
154
|
+
/** Build the `generate_analogy_report` delegation tool bound to its provider. */
|
|
155
|
+
export function createGenerateAnalogyReportTool(deps) {
|
|
156
|
+
const ncbi = createNcbiTools(deps.bioKeys);
|
|
157
|
+
const reasonerTools = [
|
|
158
|
+
searchSemanticScholarTool,
|
|
159
|
+
searchArxivTool,
|
|
160
|
+
createSearchGithubReposTool({ githubToken: deps.bioKeys.github }),
|
|
161
|
+
ncbi.searchPubMed,
|
|
162
|
+
ncbi.getArticleDetails,
|
|
163
|
+
ncbi.getArticleFullText,
|
|
164
|
+
];
|
|
165
|
+
const agent = {
|
|
166
|
+
id: AGENT_ID,
|
|
167
|
+
systemPrompt: analogicalReasonerPrompt,
|
|
168
|
+
model: deps.model,
|
|
169
|
+
tools: reasonerTools,
|
|
170
|
+
maxIterations: RESEARCH_MAX_ITERATIONS,
|
|
171
|
+
};
|
|
172
|
+
return defineTool({
|
|
173
|
+
id: "generate_analogy_report",
|
|
174
|
+
description: "Generate a cross-domain analogy report for an open-ended scientific " +
|
|
175
|
+
"problem. Pass the user's problem as a single field plus optional " +
|
|
176
|
+
"context (data profile excerpts, prior findings) and knobs (domain " +
|
|
177
|
+
"counts, preferred/excluded domains). Returns a structured " +
|
|
178
|
+
"AnalogyReport envelope — analogies with object mappings, shared " +
|
|
179
|
+
"relations, and cited solutions from other domains. The UI renders " +
|
|
180
|
+
"the envelope as an inline card; reach for this tool whenever the " +
|
|
181
|
+
"user is in exploratory or hypothesis-generation mode.",
|
|
182
|
+
inputSchema: generateAnalogyReportInputSchema,
|
|
183
|
+
execute: async (input, ctx) => {
|
|
184
|
+
const childSession = forSubAgent(ctx.session, AGENT_ID);
|
|
185
|
+
// Phase 1+2: drive the research agent over the cross-domain toolset.
|
|
186
|
+
let rawText;
|
|
187
|
+
try {
|
|
188
|
+
const { messages: transcript } = await runAgent(agent, [{ role: "user", content: buildResearchPrompt(input) }], childSession, {
|
|
189
|
+
provider: deps.provider,
|
|
190
|
+
signal: ctx.signal,
|
|
191
|
+
emit: ctx.emit,
|
|
192
|
+
runStep: passthroughStep,
|
|
193
|
+
});
|
|
194
|
+
rawText = finalText(transcript);
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
198
|
+
return ok({
|
|
199
|
+
schemaVersion: "1",
|
|
200
|
+
error: {
|
|
201
|
+
kind: "extraction-failed",
|
|
202
|
+
message: `Analogy research failed: ${message}`.slice(0, 240),
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
// Fast path: the agent emitted valid JSON matching the schema.
|
|
207
|
+
const directParse = tryParseEnvelope(rawText);
|
|
208
|
+
if (directParse.ok)
|
|
209
|
+
return ok(directParse.value);
|
|
210
|
+
// Slow path: a single-shot conversion call (no tools) transforms the
|
|
211
|
+
// raw output into a valid envelope. The harness anthropic provider
|
|
212
|
+
// silently drops `temperature` on 4.7+ models, so an explicit
|
|
213
|
+
// Sonnet-vs-Opus split is unnecessary — the parse+validate+envelope
|
|
214
|
+
// cascade below is the real safety net.
|
|
215
|
+
try {
|
|
216
|
+
const reply = unwrapOrThrow(await deps.provider.chat({
|
|
217
|
+
tools: {},
|
|
218
|
+
toolChoice: "none",
|
|
219
|
+
system: "You convert an analogical-reasoner's free-text output " +
|
|
220
|
+
"into a strict AnalogyReportSchema JSON envelope. You " +
|
|
221
|
+
"preserve information faithfully and never invent content. " +
|
|
222
|
+
"You return ONLY raw JSON — no prose, no markdown fences, " +
|
|
223
|
+
"no commentary.",
|
|
224
|
+
messages: [{ role: "user", content: buildConversionPrompt(rawText) }],
|
|
225
|
+
}, childSession, ctx.signal));
|
|
226
|
+
const content = reply.message.content;
|
|
227
|
+
const convertedText = typeof content === "string"
|
|
228
|
+
? content
|
|
229
|
+
: content
|
|
230
|
+
.filter((b) => b.type === "text")
|
|
231
|
+
.map((b) => b.text)
|
|
232
|
+
.join("");
|
|
233
|
+
const parse = tryParseEnvelope(convertedText);
|
|
234
|
+
if (!parse.ok)
|
|
235
|
+
return ok(buildExtractionFailedEnvelope());
|
|
236
|
+
// If the conversion model produced an error envelope verbatim,
|
|
237
|
+
// surface it (it knows something we don't about the input).
|
|
238
|
+
if ("error" in parse.value)
|
|
239
|
+
return ok(parse.value);
|
|
240
|
+
// Empty `analogies: []` means the input had no extractable content
|
|
241
|
+
// (apology, off-topic) — surface as extraction-failed.
|
|
242
|
+
if (parse.value.analogies.length === 0) {
|
|
243
|
+
return ok(buildExtractionFailedEnvelope());
|
|
244
|
+
}
|
|
245
|
+
return ok(parse.value);
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return ok(buildExtractionFailedEnvelope());
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/** Single source of truth for the wrapper's terminal "could not recover" envelope. */
|
|
254
|
+
function buildExtractionFailedEnvelope() {
|
|
255
|
+
return {
|
|
256
|
+
schemaVersion: "1",
|
|
257
|
+
error: {
|
|
258
|
+
kind: "extraction-failed",
|
|
259
|
+
message: "The analogical reasoner returned malformed output that could not " + "be recovered. Try narrowing the problem statement.",
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Trim leading whitespace and strip a single wrapping ```json fence before
|
|
265
|
+
* parsing — the inner agent's prompt forbids code fences but a relaxed
|
|
266
|
+
* parse here avoids burning a conversion retry on trivial slips. Beyond
|
|
267
|
+
* that, no salvaging. Exported for unit testing.
|
|
268
|
+
*/
|
|
269
|
+
export function tryParseEnvelope(raw) {
|
|
270
|
+
const stripped = stripFence(raw);
|
|
271
|
+
let candidate;
|
|
272
|
+
try {
|
|
273
|
+
candidate = JSON.parse(stripped);
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return { ok: false, reason: "not-json" };
|
|
277
|
+
}
|
|
278
|
+
const result = AnalogicalReasonerOutputSchema.safeParse(candidate);
|
|
279
|
+
if (!result.success)
|
|
280
|
+
return { ok: false, reason: "schema-mismatch" };
|
|
281
|
+
return { ok: true, value: result.data };
|
|
282
|
+
}
|
|
283
|
+
function stripFence(raw) {
|
|
284
|
+
const trimmed = raw.trim();
|
|
285
|
+
if (!trimmed.startsWith("```"))
|
|
286
|
+
return trimmed;
|
|
287
|
+
return trimmed.replace(/^```(?:json)?\s*\n/i, "").replace(/\n```\s*$/i, "");
|
|
288
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generatePlan — a loop-driving tool: a focused `runAgent` loop that builds
|
|
3
|
+
* an analysis plan (a DAG of steps).
|
|
4
|
+
*
|
|
5
|
+
* The outer tool receives structured context from the conversation agent
|
|
6
|
+
* (data profile, research question, prior runs, constraints) and drives an
|
|
7
|
+
* internal "planner" agent that communicates outcomes EXCLUSIVELY via four
|
|
8
|
+
* terminal tool calls:
|
|
9
|
+
*
|
|
10
|
+
* - validate_plan(plan) → non-terminal dry-run (Zod + semantic)
|
|
11
|
+
* - submit_plan(plan) → terminal success: re-validates + persists
|
|
12
|
+
* - request_clarification(…) → terminal: planner needs more context
|
|
13
|
+
* - report_blocker(reason) → terminal: no viable plan
|
|
14
|
+
*
|
|
15
|
+
* The planner is an `AgentDefinition` driven by `runAgent`; the pool and
|
|
16
|
+
* resource id are an explicit `Pool` dependency and the request-scoped
|
|
17
|
+
* `Session`. The planner prompt injects the agent catalog and exposes the
|
|
18
|
+
* terminal-tool surface above.
|
|
19
|
+
*/
|
|
20
|
+
import type { Pool } from "pg";
|
|
21
|
+
import { type ChatProvider } from "../../providers/types.js";
|
|
22
|
+
import { type Tool } from "../define-tool.js";
|
|
23
|
+
import { type ResourcePolicy } from "../../config/resource-limits.js";
|
|
24
|
+
export interface GeneratePlanDeps {
|
|
25
|
+
/** The LLM seam the planner loop runs on. */
|
|
26
|
+
readonly provider: ChatProvider;
|
|
27
|
+
/** Database pool — plan persistence and prior-plan loading. */
|
|
28
|
+
readonly pool: Pool;
|
|
29
|
+
/** Model id — provenance / metric label; the provider owns the wire model. */
|
|
30
|
+
readonly model: string;
|
|
31
|
+
/**
|
|
32
|
+
* Host resource policy — stated to the planner as concrete per-step
|
|
33
|
+
* ceilings and enforced by `validate_plan`. Absent, the prompt keeps its
|
|
34
|
+
* default guidance and validation skips the ceiling check.
|
|
35
|
+
*/
|
|
36
|
+
readonly resourcePolicy?: ResourcePolicy;
|
|
37
|
+
}
|
|
38
|
+
/** Build the `generate_plan` tool bound to its provider and pool. */
|
|
39
|
+
export declare function createGeneratePlanTool(deps: GeneratePlanDeps): Tool;
|