@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,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* update-working-memory — the agent's single interface for maintaining
|
|
3
|
+
* working memory.
|
|
4
|
+
*
|
|
5
|
+
* Dependency-bearing: the `WorkingMemoryStore` is captured by the factory
|
|
6
|
+
* (see the harness-durable-runtime spec). The analysis id is read from the request-scoped `Session`.
|
|
7
|
+
*
|
|
8
|
+
* The input is a flat object with a `section` discriminator — not a
|
|
9
|
+
* `z.discriminatedUnion`, which `defineTool` rejects (Anthropic needs a
|
|
10
|
+
* top-level `"type":"object"`). The variant fields are validated by
|
|
11
|
+
* `.refine` so a malformed call (e.g. a `finding` with no `runId`) fails
|
|
12
|
+
* at the loop boundary and surfaces as an `is_error` tool result.
|
|
13
|
+
*/
|
|
14
|
+
import { ok } from "neverthrow";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { scopeResource } from "../../auth/types.js";
|
|
17
|
+
import { unwrapOrThrow } from "../../lib/result.js";
|
|
18
|
+
import { defineTool } from "../define-tool.js";
|
|
19
|
+
const inputSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
section: z.enum(["goal", "constraint", "hypothesis", "finding"]).describe("Which working-memory section to update."),
|
|
22
|
+
operation: z
|
|
23
|
+
.enum(["add", "revise", "retire"])
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("For constraint/hypothesis: add a new entry (default), revise an " + "existing entry's text, or retire a stale one. Ignored for goal/finding."),
|
|
26
|
+
text: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Entry text. Required for goal, finding, and constraint/hypothesis " + "add/revise. Omit when retiring."),
|
|
30
|
+
id: z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("The entry id to revise or retire. Required when operation is " + "'revise' or 'retire' — copy it from the rendered working memory."),
|
|
34
|
+
origin: z
|
|
35
|
+
.enum(["user", "agent"])
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("For a new constraint: whether the user stated the rule or you " + "derived it. Defaults to 'agent'."),
|
|
38
|
+
runId: z.string().optional().describe("The run that produced the finding. Required when section is 'finding'."),
|
|
39
|
+
})
|
|
40
|
+
.refine((d) => d.section !== "goal" || d.text !== undefined, {
|
|
41
|
+
message: "text is required when section is 'goal'",
|
|
42
|
+
path: ["text"],
|
|
43
|
+
})
|
|
44
|
+
.refine((d) => d.section !== "finding" || (d.runId !== undefined && d.runId.length > 0), {
|
|
45
|
+
message: "runId is required when section is 'finding'",
|
|
46
|
+
path: ["runId"],
|
|
47
|
+
})
|
|
48
|
+
.refine((d) => d.section !== "finding" || (d.text !== undefined && d.text.length > 0), {
|
|
49
|
+
message: "text is required when section is 'finding'",
|
|
50
|
+
path: ["text"],
|
|
51
|
+
})
|
|
52
|
+
.refine((d) => !(d.operation === "revise" || d.operation === "retire") || (d.id !== undefined && d.id.length > 0), {
|
|
53
|
+
message: "id is required when operation is 'revise' or 'retire'",
|
|
54
|
+
path: ["id"],
|
|
55
|
+
})
|
|
56
|
+
.refine((d) => {
|
|
57
|
+
const isList = d.section === "constraint" || d.section === "hypothesis";
|
|
58
|
+
const op = d.operation ?? "add";
|
|
59
|
+
return !(isList && op !== "retire") || (d.text !== undefined && d.text.length > 0);
|
|
60
|
+
}, {
|
|
61
|
+
message: "text is required to add or revise a constraint/hypothesis",
|
|
62
|
+
path: ["text"],
|
|
63
|
+
});
|
|
64
|
+
/** Map a validated flat input to a constraint/hypothesis list amendment. */
|
|
65
|
+
function toListOp(input) {
|
|
66
|
+
switch (input.operation ?? "add") {
|
|
67
|
+
case "add":
|
|
68
|
+
return { op: "add", text: input.text };
|
|
69
|
+
case "revise":
|
|
70
|
+
return { op: "revise", id: input.id, text: input.text };
|
|
71
|
+
case "retire":
|
|
72
|
+
return { op: "retire", id: input.id };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function toConstraintOp(input) {
|
|
76
|
+
const base = toListOp(input);
|
|
77
|
+
return base.op === "add" ? { ...base, origin: input.origin ?? "agent" } : base;
|
|
78
|
+
}
|
|
79
|
+
export function createUpdateWorkingMemoryTool(workingMemory) {
|
|
80
|
+
return defineTool({
|
|
81
|
+
id: "update_working_memory",
|
|
82
|
+
description: "Maintain the analysis's working memory — its durable interpretive " +
|
|
83
|
+
"layer that survives token-window eviction. Section-addressable: set " +
|
|
84
|
+
"the 'goal', add/revise/retire a 'constraint' (a binding rule) or a " +
|
|
85
|
+
"'hypothesis', or record a 'finding' under a runId. Updates one " +
|
|
86
|
+
"section at a time; the others are untouched.",
|
|
87
|
+
inputSchema,
|
|
88
|
+
execute: async (input, ctx) => {
|
|
89
|
+
const analysisId = scopeResource(ctx.session.scope).resourceId;
|
|
90
|
+
switch (input.section) {
|
|
91
|
+
case "goal":
|
|
92
|
+
unwrapOrThrow(await workingMemory.updateSection(analysisId, "goal", {
|
|
93
|
+
text: input.text,
|
|
94
|
+
}));
|
|
95
|
+
break;
|
|
96
|
+
case "constraint":
|
|
97
|
+
unwrapOrThrow(await workingMemory.updateSection(analysisId, "constraint", toConstraintOp(input)));
|
|
98
|
+
break;
|
|
99
|
+
case "hypothesis":
|
|
100
|
+
unwrapOrThrow(await workingMemory.updateSection(analysisId, "hypothesis", toListOp(input)));
|
|
101
|
+
break;
|
|
102
|
+
case "finding":
|
|
103
|
+
unwrapOrThrow(await workingMemory.updateSection(analysisId, "finding", {
|
|
104
|
+
runId: input.runId,
|
|
105
|
+
text: input.text,
|
|
106
|
+
}));
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
return ok({ ok: true, section: input.section });
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool registry — a name→`Tool` map.
|
|
3
|
+
*
|
|
4
|
+
* `definitions()` emits AI SDK-compatible tool definitions; `get(name)`
|
|
5
|
+
* resolves a tool by name for the loop's dispatch boundary (change 3).
|
|
6
|
+
*/
|
|
7
|
+
import { type ToolSet } from "ai";
|
|
8
|
+
import type { Tool } from "./define-tool.js";
|
|
9
|
+
export interface Registry {
|
|
10
|
+
/** The AI SDK tool definitions to send with a chat request. */
|
|
11
|
+
definitions(): ToolSet;
|
|
12
|
+
/** Resolve a tool by name for dispatch; `undefined` if unknown. */
|
|
13
|
+
get(name: string): Tool | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare function createRegistry(tools: readonly Tool[]): Registry;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool registry — a name→`Tool` map.
|
|
3
|
+
*
|
|
4
|
+
* `definitions()` emits AI SDK-compatible tool definitions; `get(name)`
|
|
5
|
+
* resolves a tool by name for the loop's dispatch boundary (change 3).
|
|
6
|
+
*/
|
|
7
|
+
import { jsonSchema, tool as aiTool } from "ai";
|
|
8
|
+
export function createRegistry(tools) {
|
|
9
|
+
const byName = new Map();
|
|
10
|
+
for (const tool of tools) {
|
|
11
|
+
if (byName.has(tool.id)) {
|
|
12
|
+
throw new Error(`createRegistry: duplicate tool id "${tool.id}"`);
|
|
13
|
+
}
|
|
14
|
+
byName.set(tool.id, tool);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
definitions: () => Object.fromEntries(tools.map((t) => [
|
|
18
|
+
t.id,
|
|
19
|
+
aiTool({
|
|
20
|
+
description: t.description,
|
|
21
|
+
inputSchema: jsonSchema(t.jsonSchema),
|
|
22
|
+
}),
|
|
23
|
+
])),
|
|
24
|
+
get: (name) => byName.get(name),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* build_report tool — renders `report.html.j2` → `index.html` via the
|
|
3
|
+
* in-process Nunjucks renderer. Closes over the runner's preview-dir state.
|
|
4
|
+
*
|
|
5
|
+
* Returns structured success or a typed error so the agent can fix and retry.
|
|
6
|
+
* Version dir and templates dir are closure-state.
|
|
7
|
+
*/
|
|
8
|
+
import { type Tool } from "../define-tool.js";
|
|
9
|
+
export interface BuildReportToolState {
|
|
10
|
+
readonly versionDir: string;
|
|
11
|
+
readonly templatesDir: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function createBuildReportTool(state: BuildReportToolState): Tool;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* build_report tool — renders `report.html.j2` → `index.html` via the
|
|
3
|
+
* in-process Nunjucks renderer. Closes over the runner's preview-dir state.
|
|
4
|
+
*
|
|
5
|
+
* Returns structured success or a typed error so the agent can fix and retry.
|
|
6
|
+
* Version dir and templates dir are closure-state.
|
|
7
|
+
*/
|
|
8
|
+
import { ok } from "neverthrow";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { defineTool } from "../define-tool.js";
|
|
11
|
+
import { renderReport } from "../../execution/report-render.js";
|
|
12
|
+
export function createBuildReportTool(state) {
|
|
13
|
+
return defineTool({
|
|
14
|
+
id: "build_report",
|
|
15
|
+
description: "Render the report by compiling report.html.j2 into index.html. " +
|
|
16
|
+
"Always use this — never invoke a build script directly. Returns " +
|
|
17
|
+
"structured errors with line numbers when the template is broken.",
|
|
18
|
+
inputSchema: z.object({}),
|
|
19
|
+
execute: async () => {
|
|
20
|
+
return ok(await renderReport({
|
|
21
|
+
versionDir: state.versionDir,
|
|
22
|
+
templatesDir: state.templatesDir,
|
|
23
|
+
}));
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report-tool barrel. These tools are NOT registered on the conversation
|
|
3
|
+
* agent — they are constructed inside `harness/execution/report-runner.ts`
|
|
4
|
+
* so each tool factory shares the runner's closure-captured outcome state
|
|
5
|
+
* and preview-dir paths. The conversation agent reaches the report-builder
|
|
6
|
+
* through the `iterate_report` tool, which orchestrates the whole
|
|
7
|
+
* iteration.
|
|
8
|
+
*/
|
|
9
|
+
export { createBuildReportTool, type BuildReportToolState } from "./build-report.js";
|
|
10
|
+
export { createSubmitReportTool, type ReportOutcome, type SubmitReportToolState } from "./submit-report.js";
|
|
11
|
+
export { createMintPreviewUrlTool, type MintPreviewUrlToolState, type PreviewUrlCell } from "./mint-preview-url.js";
|
|
12
|
+
export { createPreviewSnapshotTool, type PreviewSnapshotToolState } from "./preview-snapshot.js";
|
|
13
|
+
export { createVersionFsTools, type VersionFsToolsState } from "./version-fs.js";
|
|
14
|
+
export { type PreviewPublisher, type PreviewMintResult, UnavailablePreviewPublisher } from "./preview-publisher.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report-tool barrel. These tools are NOT registered on the conversation
|
|
3
|
+
* agent — they are constructed inside `harness/execution/report-runner.ts`
|
|
4
|
+
* so each tool factory shares the runner's closure-captured outcome state
|
|
5
|
+
* and preview-dir paths. The conversation agent reaches the report-builder
|
|
6
|
+
* through the `iterate_report` tool, which orchestrates the whole
|
|
7
|
+
* iteration.
|
|
8
|
+
*/
|
|
9
|
+
export { createBuildReportTool } from "./build-report.js";
|
|
10
|
+
export { createSubmitReportTool } from "./submit-report.js";
|
|
11
|
+
export { createMintPreviewUrlTool } from "./mint-preview-url.js";
|
|
12
|
+
export { createPreviewSnapshotTool } from "./preview-snapshot.js";
|
|
13
|
+
export { createVersionFsTools } from "./version-fs.js";
|
|
14
|
+
export { UnavailablePreviewPublisher } from "./preview-publisher.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mint_preview_url tool — get a content-server URL for the report preview.
|
|
3
|
+
*
|
|
4
|
+
* Calls the preview-access seam and returns the full navigatable URL
|
|
5
|
+
* for the requested version.
|
|
6
|
+
*
|
|
7
|
+
* Most callers don't need this — `preview_snapshot` mints lazily on first
|
|
8
|
+
* use. Reach for this tool when:
|
|
9
|
+
* - the previously-minted URL has expired
|
|
10
|
+
* - inspecting an older version (pass `version`)
|
|
11
|
+
*/
|
|
12
|
+
import { type Tool } from "../define-tool.js";
|
|
13
|
+
import type { PreviewPublisher } from "./preview-publisher.js";
|
|
14
|
+
/** Shared, mutable URL cell so mint and preview-snapshot share a cached URL. */
|
|
15
|
+
export interface PreviewUrlCell {
|
|
16
|
+
url: string | undefined;
|
|
17
|
+
expiresAt: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface MintPreviewUrlToolState {
|
|
20
|
+
readonly resourceId: string;
|
|
21
|
+
readonly previewId: string;
|
|
22
|
+
readonly currentVersion: number;
|
|
23
|
+
readonly previews: PreviewPublisher;
|
|
24
|
+
readonly urlCell: PreviewUrlCell;
|
|
25
|
+
}
|
|
26
|
+
export declare function createMintPreviewUrlTool(state: MintPreviewUrlToolState): Tool;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mint_preview_url tool — get a content-server URL for the report preview.
|
|
3
|
+
*
|
|
4
|
+
* Calls the preview-access seam and returns the full navigatable URL
|
|
5
|
+
* for the requested version.
|
|
6
|
+
*
|
|
7
|
+
* Most callers don't need this — `preview_snapshot` mints lazily on first
|
|
8
|
+
* use. Reach for this tool when:
|
|
9
|
+
* - the previously-minted URL has expired
|
|
10
|
+
* - inspecting an older version (pass `version`)
|
|
11
|
+
*/
|
|
12
|
+
import { ok } from "neverthrow";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { defineTool } from "../define-tool.js";
|
|
15
|
+
export function createMintPreviewUrlTool(state) {
|
|
16
|
+
return defineTool({
|
|
17
|
+
id: "mint_preview_url",
|
|
18
|
+
description: "Mint a fresh preview URL for the report. Returns a content-server " +
|
|
19
|
+
"URL with embedded auth token (15-min TTL). Use this only when you " +
|
|
20
|
+
"need a URL for direct browser navigation — preview_snapshot handles " +
|
|
21
|
+
"the common case automatically.",
|
|
22
|
+
inputSchema: z.object({
|
|
23
|
+
version: z.number().optional().describe("Version to mint for. Defaults to the iteration's current version."),
|
|
24
|
+
}),
|
|
25
|
+
execute: async (input) => {
|
|
26
|
+
const version = input.version ?? state.currentVersion;
|
|
27
|
+
const result = await state.previews.mintPreviewAccess(state.resourceId, state.previewId);
|
|
28
|
+
if (!result.ok) {
|
|
29
|
+
return ok({
|
|
30
|
+
ok: false,
|
|
31
|
+
error: `preview-access mint failed: status=${result.status} ${result.error.message ?? ""}`.trim(),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const url = `${result.data.baseUrl.replace(/\/?$/, "/")}v${version}/index.html?t=${result.data.token}`;
|
|
35
|
+
state.urlCell.url = url;
|
|
36
|
+
state.urlCell.expiresAt = result.data.expiresAt;
|
|
37
|
+
return ok({
|
|
38
|
+
ok: true,
|
|
39
|
+
url,
|
|
40
|
+
expiresAt: result.data.expiresAt,
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PreviewPublisher — the seam between the harness report path and the hosted
|
|
3
|
+
* preview surface. The report build itself (FS + Nunjucks + LLM via
|
|
4
|
+
* `ChatProvider`) is pure in-process; the only thing that reaches outside
|
|
5
|
+
* the process is minting a content-server URL for the headless-Chrome
|
|
6
|
+
* preview. That mint is hidden behind this one method.
|
|
7
|
+
*
|
|
8
|
+
* The managed implementation (HostedPreviewPublisher) owns the access
|
|
9
|
+
* grant mint + managed client. The local default (UnavailablePreviewPublisher)
|
|
10
|
+
* returns not-ok, so `preview_snapshot` short-circuits before touching
|
|
11
|
+
* Chrome and the report still builds (submit_report is the only gate).
|
|
12
|
+
*/
|
|
13
|
+
export type PreviewMintResult = {
|
|
14
|
+
ok: true;
|
|
15
|
+
data: {
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
token: string;
|
|
18
|
+
expiresAt: string;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
status?: number;
|
|
23
|
+
error: {
|
|
24
|
+
message?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export interface PreviewPublisher {
|
|
28
|
+
mintPreviewAccess(resourceId: string, previewId: string): Promise<PreviewMintResult>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Local default — no hosted preview surface. Returns not-ok so the preview
|
|
32
|
+
* tools surface a clear "unavailable" message and short-circuit before any
|
|
33
|
+
* browser navigation.
|
|
34
|
+
*/
|
|
35
|
+
export declare class UnavailablePreviewPublisher implements PreviewPublisher {
|
|
36
|
+
mintPreviewAccess(_resourceId: string, _previewId: string): Promise<PreviewMintResult>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PreviewPublisher — the seam between the harness report path and the hosted
|
|
3
|
+
* preview surface. The report build itself (FS + Nunjucks + LLM via
|
|
4
|
+
* `ChatProvider`) is pure in-process; the only thing that reaches outside
|
|
5
|
+
* the process is minting a content-server URL for the headless-Chrome
|
|
6
|
+
* preview. That mint is hidden behind this one method.
|
|
7
|
+
*
|
|
8
|
+
* The managed implementation (HostedPreviewPublisher) owns the access
|
|
9
|
+
* grant mint + managed client. The local default (UnavailablePreviewPublisher)
|
|
10
|
+
* returns not-ok, so `preview_snapshot` short-circuits before touching
|
|
11
|
+
* Chrome and the report still builds (submit_report is the only gate).
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Local default — no hosted preview surface. Returns not-ok so the preview
|
|
15
|
+
* tools surface a clear "unavailable" message and short-circuit before any
|
|
16
|
+
* browser navigation.
|
|
17
|
+
*/
|
|
18
|
+
export class UnavailablePreviewPublisher {
|
|
19
|
+
async mintPreviewAccess(_resourceId, _previewId) {
|
|
20
|
+
return {
|
|
21
|
+
ok: false,
|
|
22
|
+
error: { message: "report preview is unavailable in this environment" },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* preview_snapshot tool — navigate headless Chrome to the rendered report,
|
|
3
|
+
* wait for the `inflexa-theme-ready` event, capture a screenshot + console
|
|
4
|
+
* messages + failed network requests in a single deterministic call.
|
|
5
|
+
*
|
|
6
|
+
* Lazily mints a preview URL via the `PreviewPublisher` seam on first use,
|
|
7
|
+
* sharing the cached URL with the `mint_preview_url` tool via a
|
|
8
|
+
* closure-captured `PreviewUrlCell`.
|
|
9
|
+
*
|
|
10
|
+
* Returned screenshot is base64-encoded PNG bytes; the agent can inspect
|
|
11
|
+
* console errors / failed requests to decide whether to fix the template
|
|
12
|
+
* or move on to submit_report.
|
|
13
|
+
*/
|
|
14
|
+
import { type Tool } from "../define-tool.js";
|
|
15
|
+
import { type ChromeConfig } from "../../lib/chrome.js";
|
|
16
|
+
import type { PreviewPublisher } from "./preview-publisher.js";
|
|
17
|
+
import type { PreviewUrlCell } from "./mint-preview-url.js";
|
|
18
|
+
export interface PreviewSnapshotToolState {
|
|
19
|
+
readonly resourceId: string;
|
|
20
|
+
readonly previewId: string;
|
|
21
|
+
readonly currentVersion: number;
|
|
22
|
+
readonly previews: PreviewPublisher;
|
|
23
|
+
readonly urlCell: PreviewUrlCell;
|
|
24
|
+
readonly chrome: ChromeConfig;
|
|
25
|
+
}
|
|
26
|
+
export declare function createPreviewSnapshotTool(state: PreviewSnapshotToolState): Tool;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* preview_snapshot tool — navigate headless Chrome to the rendered report,
|
|
3
|
+
* wait for the `inflexa-theme-ready` event, capture a screenshot + console
|
|
4
|
+
* messages + failed network requests in a single deterministic call.
|
|
5
|
+
*
|
|
6
|
+
* Lazily mints a preview URL via the `PreviewPublisher` seam on first use,
|
|
7
|
+
* sharing the cached URL with the `mint_preview_url` tool via a
|
|
8
|
+
* closure-captured `PreviewUrlCell`.
|
|
9
|
+
*
|
|
10
|
+
* Returned screenshot is base64-encoded PNG bytes; the agent can inspect
|
|
11
|
+
* console errors / failed requests to decide whether to fix the template
|
|
12
|
+
* or move on to submit_report.
|
|
13
|
+
*/
|
|
14
|
+
import { ok } from "neverthrow";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { defineTool } from "../define-tool.js";
|
|
17
|
+
import { withPage } from "../../lib/chrome.js";
|
|
18
|
+
const NAV_TIMEOUT_MS = 20_000;
|
|
19
|
+
const READY_TIMEOUT_MS = 8_000;
|
|
20
|
+
const WAIT_MS_CAP = 30_000;
|
|
21
|
+
export function createPreviewSnapshotTool(state) {
|
|
22
|
+
return defineTool({
|
|
23
|
+
id: "preview_snapshot",
|
|
24
|
+
description: "Render the report in a real headless browser and report what you " +
|
|
25
|
+
"see. Returns a screenshot, console errors, and failed network " +
|
|
26
|
+
"requests. Use this after build_report to verify the layout, charts, " +
|
|
27
|
+
"and data loads correctly.",
|
|
28
|
+
inputSchema: z.object({
|
|
29
|
+
waitForSelector: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Optional CSS selector to wait for after the page is loaded — useful " + "when a specific chart needs to be visible before the screenshot."),
|
|
33
|
+
waitMs: z
|
|
34
|
+
.number()
|
|
35
|
+
.finite()
|
|
36
|
+
.int()
|
|
37
|
+
.min(0)
|
|
38
|
+
.max(WAIT_MS_CAP)
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Optional extra wait in ms after the theme-ready event (e.g., for chart paint). Capped at 30s."),
|
|
41
|
+
}),
|
|
42
|
+
execute: async (input) => {
|
|
43
|
+
let url = state.urlCell.url;
|
|
44
|
+
const expiresAt = state.urlCell.expiresAt;
|
|
45
|
+
if (url && expiresAt && new Date(expiresAt).getTime() < Date.now() + 60_000) {
|
|
46
|
+
url = undefined; // refresh if within 60s of expiry
|
|
47
|
+
}
|
|
48
|
+
if (!url) {
|
|
49
|
+
const result = await state.previews.mintPreviewAccess(state.resourceId, state.previewId);
|
|
50
|
+
if (!result.ok) {
|
|
51
|
+
return ok({
|
|
52
|
+
ok: false,
|
|
53
|
+
consoleErrors: [],
|
|
54
|
+
failedRequests: [],
|
|
55
|
+
error: `preview-access mint failed: status=${result.status} ${result.error.message ?? ""}`.trim(),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
url = `${result.data.baseUrl.replace(/\/?$/, "/")}v${state.currentVersion}/index.html?t=${result.data.token}`;
|
|
59
|
+
state.urlCell.url = url;
|
|
60
|
+
state.urlCell.expiresAt = result.data.expiresAt;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return ok(await withPage(state.chrome, async (page) => {
|
|
64
|
+
const consoleErrors = [];
|
|
65
|
+
const failedRequests = [];
|
|
66
|
+
page.on("console", (msg) => {
|
|
67
|
+
if (msg.type() === "error")
|
|
68
|
+
consoleErrors.push(msg.text());
|
|
69
|
+
});
|
|
70
|
+
page.on("pageerror", (err) => consoleErrors.push(`pageerror: ${err.message}`));
|
|
71
|
+
page.on("requestfailed", (req) => {
|
|
72
|
+
failedRequests.push({
|
|
73
|
+
url: req.url(),
|
|
74
|
+
reason: req.failure()?.errorText ?? "unknown",
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
await page.goto(url, {
|
|
78
|
+
waitUntil: "networkidle2",
|
|
79
|
+
timeout: NAV_TIMEOUT_MS,
|
|
80
|
+
});
|
|
81
|
+
// Wait for the inflexa-theme-ready event (fired after echarts theme
|
|
82
|
+
// registers). Check the `__inflexaThemeReady` sentinel first because
|
|
83
|
+
// the page already deferred its dispatch — by the time we get here
|
|
84
|
+
// via networkidle2, the event has likely already fired and a plain
|
|
85
|
+
// addEventListener would block forever. The callback runs in the
|
|
86
|
+
// browser context.
|
|
87
|
+
await page
|
|
88
|
+
.evaluate(new Function("timeout", "return new Promise(function(resolve){if(window.__inflexaThemeReady){resolve();return;}var t=setTimeout(resolve,timeout);document.addEventListener('inflexa-theme-ready',function(){clearTimeout(t);resolve();},{once:true});});"), READY_TIMEOUT_MS)
|
|
89
|
+
.catch(() => {
|
|
90
|
+
/* fall through — capture state as-is */
|
|
91
|
+
});
|
|
92
|
+
if (input.waitForSelector) {
|
|
93
|
+
await page.waitForSelector(input.waitForSelector, { timeout: 5_000 }).catch(() => {
|
|
94
|
+
/* not fatal */
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (input.waitMs)
|
|
98
|
+
await new Promise((r) => setTimeout(r, input.waitMs));
|
|
99
|
+
const screenshot = await page.screenshot({
|
|
100
|
+
encoding: "base64",
|
|
101
|
+
fullPage: false,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
ok: true,
|
|
105
|
+
screenshotBase64: typeof screenshot === "string" ? screenshot : Buffer.from(screenshot).toString("base64"),
|
|
106
|
+
consoleErrors,
|
|
107
|
+
failedRequests,
|
|
108
|
+
};
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
return ok({
|
|
113
|
+
ok: false,
|
|
114
|
+
consoleErrors: [],
|
|
115
|
+
failedRequests: [],
|
|
116
|
+
error: err instanceof Error ? err.message : String(err),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* submit_report tool — postcondition gate. The runner refuses to emit
|
|
3
|
+
* `data-report-preview` until this tool writes the success outcome.
|
|
4
|
+
*
|
|
5
|
+
* Checks:
|
|
6
|
+
* - index.html exists at versionDir/ with size > 0
|
|
7
|
+
* - no unrendered `{{ … }}` or `{% … %}` left in the output
|
|
8
|
+
* - all referenced asset paths resolve to files on disk
|
|
9
|
+
*
|
|
10
|
+
* On success, writes `{ ok: true, notes }` into the runner's closure-captured
|
|
11
|
+
* outcome variable.
|
|
12
|
+
*/
|
|
13
|
+
import { type Tool } from "../define-tool.js";
|
|
14
|
+
/** Terminal outcome the submit-report tool writes into the runner closure. */
|
|
15
|
+
export type ReportOutcome = {
|
|
16
|
+
ok: true;
|
|
17
|
+
notes: readonly string[];
|
|
18
|
+
};
|
|
19
|
+
export interface SubmitReportToolState {
|
|
20
|
+
readonly versionDir: string;
|
|
21
|
+
readonly assetsDir: string;
|
|
22
|
+
/** Write-through for the runner's closure-captured outcome variable. */
|
|
23
|
+
setOutcome(outcome: ReportOutcome): void;
|
|
24
|
+
}
|
|
25
|
+
export declare function createSubmitReportTool(state: SubmitReportToolState): Tool;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* submit_report tool — postcondition gate. The runner refuses to emit
|
|
3
|
+
* `data-report-preview` until this tool writes the success outcome.
|
|
4
|
+
*
|
|
5
|
+
* Checks:
|
|
6
|
+
* - index.html exists at versionDir/ with size > 0
|
|
7
|
+
* - no unrendered `{{ … }}` or `{% … %}` left in the output
|
|
8
|
+
* - all referenced asset paths resolve to files on disk
|
|
9
|
+
*
|
|
10
|
+
* On success, writes `{ ok: true, notes }` into the runner's closure-captured
|
|
11
|
+
* outcome variable.
|
|
12
|
+
*/
|
|
13
|
+
import { readFile, stat } from "node:fs/promises";
|
|
14
|
+
import { join, resolve, sep } from "node:path";
|
|
15
|
+
import { ok } from "neverthrow";
|
|
16
|
+
import { z } from "zod";
|
|
17
|
+
import { defineTool } from "../define-tool.js";
|
|
18
|
+
// `[^{}]*` accepts any expression Nunjucks allows between delimiters
|
|
19
|
+
// (filters `{{ x | tojson }}`, inline conditionals `{{ a if b else c }}`,
|
|
20
|
+
// bracket access `{{ d['k'] }}`) but stops at nested braces — which aren't
|
|
21
|
+
// valid Nunjucks anyway. The `{%-?` arm covers whitespace-trimming tags.
|
|
22
|
+
const UNRENDERED_JINJA = /\{\{[^{}]*\}\}|\{%-?\s*\w/;
|
|
23
|
+
export function createSubmitReportTool(state) {
|
|
24
|
+
return defineTool({
|
|
25
|
+
id: "submit_report",
|
|
26
|
+
description: "Declare the report ready. Validates index.html exists, has no " +
|
|
27
|
+
"unrendered Jinja, and that all referenced asset paths resolve. " +
|
|
28
|
+
"You MUST call this to finish — the runner ignores any other claim " +
|
|
29
|
+
"of success. Returns problems[] when checks fail; fix and re-submit. " +
|
|
30
|
+
"Use `notes` to surface caveats to the caller (e.g. files skipped due " +
|
|
31
|
+
"to the 50MB asset size limit, sections rendered with partial data, " +
|
|
32
|
+
"missing inputs that forced a fallback) — these reach the conversation " +
|
|
33
|
+
"agent and the user in the iteration result.",
|
|
34
|
+
inputSchema: z.object({
|
|
35
|
+
notes: z
|
|
36
|
+
.array(z.string())
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Caveats / issues to surface to the caller. One short sentence " +
|
|
39
|
+
"per item. Examples: 'skipped raw_counts.h5ad (1.2GB > 50MB cap)', " +
|
|
40
|
+
"'pathway-enrichment section omitted — no GSEA output found'. " +
|
|
41
|
+
"Leave empty when the report shipped cleanly."),
|
|
42
|
+
}),
|
|
43
|
+
execute: async (input) => {
|
|
44
|
+
const problems = [];
|
|
45
|
+
// 1. index.html exists and is non-empty
|
|
46
|
+
const indexPath = join(state.versionDir, "index.html");
|
|
47
|
+
let html;
|
|
48
|
+
try {
|
|
49
|
+
const s = await stat(indexPath);
|
|
50
|
+
if (!s.isFile() || s.size === 0) {
|
|
51
|
+
problems.push("index.html is empty or not a regular file");
|
|
52
|
+
return ok({ ok: false, problems });
|
|
53
|
+
}
|
|
54
|
+
html = await readFile(indexPath, "utf8");
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
problems.push("index.html does not exist — call build_report first");
|
|
58
|
+
return ok({ ok: false, problems });
|
|
59
|
+
}
|
|
60
|
+
// 2. No unrendered Jinja markers
|
|
61
|
+
if (UNRENDERED_JINJA.test(html)) {
|
|
62
|
+
const match = html.match(UNRENDERED_JINJA);
|
|
63
|
+
problems.push(`unrendered Jinja in output (e.g. ${JSON.stringify(match?.[0] ?? "")}); ` +
|
|
64
|
+
"build_report likely failed silently or report.html.j2 was edited after build");
|
|
65
|
+
}
|
|
66
|
+
// 3. Asset reference resolution
|
|
67
|
+
const refs = extractLocalRefs(html);
|
|
68
|
+
for (const ref of refs) {
|
|
69
|
+
const resolved = resolveLocalRef(ref, state.versionDir, state.assetsDir);
|
|
70
|
+
if (!resolved) {
|
|
71
|
+
problems.push(`asset reference does not resolve: ${ref}`);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const s = await stat(resolved);
|
|
76
|
+
if (!s.isFile())
|
|
77
|
+
problems.push(`asset reference is not a regular file: ${ref}`);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
problems.push(`asset reference missing on disk: ${ref}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (problems.length === 0) {
|
|
84
|
+
const notes = (input.notes ?? []).map((n) => n.trim()).filter(Boolean);
|
|
85
|
+
state.setOutcome({ ok: true, notes });
|
|
86
|
+
return ok({ ok: true, problems: [] });
|
|
87
|
+
}
|
|
88
|
+
return ok({ ok: false, problems });
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const SRC_HREF_RE = /\b(?:src|href)\s*=\s*["']([^"']+)["']/gi;
|
|
93
|
+
const FETCH_RE = /\bfetch\s*\(\s*["'`]([^"'`]+)["'`]/gi;
|
|
94
|
+
function extractLocalRefs(html) {
|
|
95
|
+
const refs = new Set();
|
|
96
|
+
for (const m of html.matchAll(SRC_HREF_RE))
|
|
97
|
+
refs.add(m[1]);
|
|
98
|
+
for (const m of html.matchAll(FETCH_RE))
|
|
99
|
+
refs.add(m[1]);
|
|
100
|
+
// Filter to local refs only — drop absolute URLs and data: / blob: schemes.
|
|
101
|
+
const out = [];
|
|
102
|
+
for (const ref of refs) {
|
|
103
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(ref))
|
|
104
|
+
continue; // http:, https:, data:, blob:
|
|
105
|
+
if (ref.startsWith("//"))
|
|
106
|
+
continue; // protocol-relative
|
|
107
|
+
if (ref.startsWith("#"))
|
|
108
|
+
continue; // anchor
|
|
109
|
+
out.push(ref);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
function resolveLocalRef(ref, versionDir, assetsDir) {
|
|
114
|
+
// Strip leading slash, query string, and fragment.
|
|
115
|
+
const cleaned = ref.split("?")[0].split("#")[0].replace(/^\/+/, "");
|
|
116
|
+
if (!cleaned)
|
|
117
|
+
return undefined;
|
|
118
|
+
const candidate = resolve(versionDir, cleaned);
|
|
119
|
+
// The candidate must stay under either versionDir or assetsDir (the
|
|
120
|
+
// shared assets dir is the symlink target — both are valid roots).
|
|
121
|
+
const inVersion = candidate.startsWith(versionDir + sep) || candidate === versionDir;
|
|
122
|
+
const inAssets = candidate.startsWith(assetsDir + sep) || candidate === assetsDir;
|
|
123
|
+
if (!inVersion && !inAssets)
|
|
124
|
+
return undefined;
|
|
125
|
+
return candidate;
|
|
126
|
+
}
|