@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,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-selected `SandboxClient` factory.
|
|
3
|
+
*
|
|
4
|
+
* Docker for local dev, K8s for production — the single place the
|
|
5
|
+
* `SANDBOX_BACKEND` env decision lives. Injected at the composition root
|
|
6
|
+
* as a construction-time dependency (see the harness-durable-runtime spec); callers do NOT import a
|
|
7
|
+
* backend module directly.
|
|
8
|
+
*
|
|
9
|
+
* Registry write/clear callbacks are wired here so the per-backend
|
|
10
|
+
* `createSandbox` / `teardown` implementations stay free of state-layer
|
|
11
|
+
* coupling (they just call the closures we hand them). `submitExec` and
|
|
12
|
+
* `awaitExec` are backend-agnostic — they only need the SandboxRef.
|
|
13
|
+
*/
|
|
14
|
+
import { mkdir } from "node:fs/promises";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { clampResources } from "../config/resource-limits.js";
|
|
17
|
+
import { stepWritePrefix } from "../workspace/paths.js";
|
|
18
|
+
import { tryMutation } from "../lib/db-result.js";
|
|
19
|
+
import { unwrapOrThrow } from "../lib/result.js";
|
|
20
|
+
import { clearSandboxRef, setSandboxRef } from "../state/index.js";
|
|
21
|
+
import { awaitExec } from "./await-exec.js";
|
|
22
|
+
import { createDockerSandboxOps } from "./docker-client.js";
|
|
23
|
+
import { createK8sSandboxOps } from "./k8s-client.js";
|
|
24
|
+
import { STEP_SUBDIRS } from "./mount-plan.js";
|
|
25
|
+
import { submitExec } from "./submit-exec.js";
|
|
26
|
+
import { toPersistedRef } from "./types.js";
|
|
27
|
+
/**
|
|
28
|
+
* Assemble `awaitExec`'s options: the liveness probe self-wires from the
|
|
29
|
+
* backend ops (the poll loop's escalation always has its arbiter under the
|
|
30
|
+
* client), explicit seam injections in `base` win over the self-wired probe,
|
|
31
|
+
* and the transport is client-owned — never overridable through the seam bag.
|
|
32
|
+
* Exported for tests.
|
|
33
|
+
*/
|
|
34
|
+
export function composeAwaitOptions(base, transport, isAlive) {
|
|
35
|
+
return { isAlive, ...base, transport };
|
|
36
|
+
}
|
|
37
|
+
export function createSandboxClient(config) {
|
|
38
|
+
const backend = config.backend ?? config.env.backend;
|
|
39
|
+
const transport = config.transport ?? "poll";
|
|
40
|
+
const registerSandbox = async (meta, ref) => {
|
|
41
|
+
unwrapOrThrow(await setSandboxRef(config.pool, meta.runId, meta.stepId, toPersistedRef(ref), meta.execId ?? null));
|
|
42
|
+
};
|
|
43
|
+
const ops = backend === "k8s"
|
|
44
|
+
? createK8sSandboxOps({
|
|
45
|
+
image: config.image,
|
|
46
|
+
cortexBaseUrl: config.cortexBaseUrl,
|
|
47
|
+
transport,
|
|
48
|
+
namespace: config.namespace ?? config.env.namespace,
|
|
49
|
+
sessionPvc: config.sessionPvc,
|
|
50
|
+
sessionPvcRoot: config.sessionPvcRoot,
|
|
51
|
+
resolveWorkspaceRoot: config.resolveWorkspaceRoot,
|
|
52
|
+
libStorePvc: config.libStorePvc,
|
|
53
|
+
refStorePvc: config.refStorePvc,
|
|
54
|
+
nodeSelector: config.nodeSelector,
|
|
55
|
+
tolerations: config.tolerations,
|
|
56
|
+
runtimeClassName: config.runtimeClassName,
|
|
57
|
+
registerSandbox,
|
|
58
|
+
})
|
|
59
|
+
: createDockerSandboxOps({
|
|
60
|
+
image: config.image,
|
|
61
|
+
cortexBaseUrl: config.cortexBaseUrl,
|
|
62
|
+
transport,
|
|
63
|
+
resolveWorkspaceRoot: config.resolveWorkspaceRoot,
|
|
64
|
+
libStorePath: config.libStorePath,
|
|
65
|
+
refStorePath: config.refStorePath,
|
|
66
|
+
platform: config.platform,
|
|
67
|
+
logger: config.logger,
|
|
68
|
+
registerSandbox,
|
|
69
|
+
});
|
|
70
|
+
// Backend-agnostic pre-creation of the writable step tree under the
|
|
71
|
+
// analysis's resolved workspace root. On Docker that root is the host dir
|
|
72
|
+
// the container binds; on K8s it lives under the session PVC the sandbox
|
|
73
|
+
// pod mounts via subPath. mkdir(recursive) is idempotent, so an existing
|
|
74
|
+
// tree (replay, retry) is not an error.
|
|
75
|
+
const precreateStepTree = async (meta) => {
|
|
76
|
+
// A read-only sandbox has no writable step mount — nothing to pre-create.
|
|
77
|
+
if (meta.readOnly)
|
|
78
|
+
return;
|
|
79
|
+
const stepDir = stepWritePrefix({
|
|
80
|
+
workspaceRoot: config.resolveWorkspaceRoot(meta.analysisId),
|
|
81
|
+
runId: meta.runId,
|
|
82
|
+
stepId: meta.stepId,
|
|
83
|
+
});
|
|
84
|
+
await mkdir(stepDir, { recursive: true });
|
|
85
|
+
await Promise.all(STEP_SUBDIRS.map((sub) => mkdir(join(stepDir, sub), { recursive: true })));
|
|
86
|
+
};
|
|
87
|
+
// `teardown` needs the registry-clear closure but the SandboxRef alone
|
|
88
|
+
// doesn't carry runId/stepId. Wrap the backend impl so callers pass the
|
|
89
|
+
// ref + step coordinates and the wrapper does the clear after the
|
|
90
|
+
// backend-level removal.
|
|
91
|
+
const teardown = async (ref) => {
|
|
92
|
+
unwrapOrThrow(await ops.teardown(ref));
|
|
93
|
+
// Sandboxes are 1-per-step (see `sandbox-step.ts` body — each child
|
|
94
|
+
// workflow calls `createSandbox` once then `teardown` once), so the
|
|
95
|
+
// broad WHERE clause matches exactly one row. If that invariant ever
|
|
96
|
+
// changes (e.g. a step reuses a sibling's sandbox), this clear must
|
|
97
|
+
// be scoped to (run, step) to avoid wiping prior steps' provenance.
|
|
98
|
+
unwrapOrThrow(await tryMutation("createSandbox.teardownClearSandboxRef", async () => {
|
|
99
|
+
await config.pool.query({
|
|
100
|
+
text: `UPDATE cortex_step_executions
|
|
101
|
+
SET sandbox_ref = NULL, exec_id = NULL
|
|
102
|
+
WHERE sandbox_ref->>'sandboxId' = $1`,
|
|
103
|
+
values: [ref.sandboxId],
|
|
104
|
+
});
|
|
105
|
+
}));
|
|
106
|
+
};
|
|
107
|
+
// One arbiter for both surfaces: the client's `isAlive` method and the
|
|
108
|
+
// poll loop's escalation probe are the same backend inspect.
|
|
109
|
+
const isAlive = async (ref) => unwrapOrThrow(await ops.isAlive(ref));
|
|
110
|
+
return {
|
|
111
|
+
createSandbox: async (meta, identity) => {
|
|
112
|
+
await precreateStepTree(meta);
|
|
113
|
+
// Every caller must declare resources — a sandbox with no cpu/memory
|
|
114
|
+
// request is a semantic error, not something to paper over with a
|
|
115
|
+
// default (a DBOS replay of a pre-resources workflow input lands here).
|
|
116
|
+
if (!meta.resources) {
|
|
117
|
+
throw new Error(`createSandbox: ${meta.analysisId}/${meta.runId}/${meta.stepId} has no resources — every caller must declare cpu/memoryGb`);
|
|
118
|
+
}
|
|
119
|
+
// Clamp to cluster ceilings so the pod is always quota-admissible.
|
|
120
|
+
const resources = clampResources(meta.resources, config.resourceLimits);
|
|
121
|
+
return unwrapOrThrow(await ops.createSandbox({ ...meta, resources }, identity));
|
|
122
|
+
},
|
|
123
|
+
submitExec: async (ref, body) => submitExec(ref, body, config.submitDeps),
|
|
124
|
+
awaitExec: (ref, execId, emit, deadline) => awaitExec(ref, execId, emit, deadline, composeAwaitOptions(config.awaitOptions, transport, isAlive)),
|
|
125
|
+
isAlive,
|
|
126
|
+
teardown,
|
|
127
|
+
teardownById: async (sandboxId) => unwrapOrThrow(await ops.teardownById(sandboxId)),
|
|
128
|
+
listManagedSandboxes: async () => unwrapOrThrow(await ops.listManagedSandboxes()),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/** Re-exports so consumers import once from this module. */
|
|
132
|
+
export { clearSandboxRef };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ingress-side delivery of a sandbox-server callback onto the per-exec DBOS
|
|
3
|
+
* topic (`awaitExec`'s recv loop, `await-exec.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Exists so an embedder hosting the HTTP callback endpoint never touches the
|
|
6
|
+
* DBOS SDK itself: `DBOS` is module-singleton state, and an embedder with its
|
|
7
|
+
* own `node_modules` would import a SECOND, un-launched SDK instance whose
|
|
8
|
+
* `send` writes nowhere. Routing delivery through the harness pins the call to
|
|
9
|
+
* the same instance `launchDbos` initialized — and keeps the topic-name format
|
|
10
|
+
* beside its consumer instead of duplicated in every host.
|
|
11
|
+
*
|
|
12
|
+
* HMAC verification is deliberately NOT done here: `awaitExec` verifies inside
|
|
13
|
+
* the workflow body against the per-sandbox `callbackSecret`, so the ingress
|
|
14
|
+
* stays secret-free and a forged POST is rejected where the secret lives.
|
|
15
|
+
*/
|
|
16
|
+
import type { ExecEventMessage } from "./types.js";
|
|
17
|
+
/** Topic `awaitExec` listens on for one exec's events and done-marker. */
|
|
18
|
+
export declare function execEventTopic(execId: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Send one callback envelope (an event, or a `DoneMarker`-shaped completion
|
|
21
|
+
* payload) to the workflow awaiting `execId`. The caller derives
|
|
22
|
+
* `workflowId` via `workflowIdFromExec` and owns HTTP status mapping:
|
|
23
|
+
* a rejection here is retryable (5xx), a malformed execId is not (4xx).
|
|
24
|
+
*/
|
|
25
|
+
export declare function deliverExecEvent(workflowId: string, execId: string, message: ExecEventMessage): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ingress-side delivery of a sandbox-server callback onto the per-exec DBOS
|
|
3
|
+
* topic (`awaitExec`'s recv loop, `await-exec.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Exists so an embedder hosting the HTTP callback endpoint never touches the
|
|
6
|
+
* DBOS SDK itself: `DBOS` is module-singleton state, and an embedder with its
|
|
7
|
+
* own `node_modules` would import a SECOND, un-launched SDK instance whose
|
|
8
|
+
* `send` writes nowhere. Routing delivery through the harness pins the call to
|
|
9
|
+
* the same instance `launchDbos` initialized — and keeps the topic-name format
|
|
10
|
+
* beside its consumer instead of duplicated in every host.
|
|
11
|
+
*
|
|
12
|
+
* HMAC verification is deliberately NOT done here: `awaitExec` verifies inside
|
|
13
|
+
* the workflow body against the per-sandbox `callbackSecret`, so the ingress
|
|
14
|
+
* stays secret-free and a forged POST is rejected where the secret lives.
|
|
15
|
+
*/
|
|
16
|
+
import { DBOS } from "@dbos-inc/dbos-sdk";
|
|
17
|
+
/** Topic `awaitExec` listens on for one exec's events and done-marker. */
|
|
18
|
+
export function execEventTopic(execId) {
|
|
19
|
+
return `exec-event:${execId}`;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Send one callback envelope (an event, or a `DoneMarker`-shaped completion
|
|
23
|
+
* payload) to the workflow awaiting `execId`. The caller derives
|
|
24
|
+
* `workflowId` via `workflowIdFromExec` and owns HTTP status mapping:
|
|
25
|
+
* a rejection here is retryable (5xx), a malformed execId is not (4xx).
|
|
26
|
+
*/
|
|
27
|
+
export async function deliverExecEvent(workflowId, execId, message) {
|
|
28
|
+
await DBOS.send(workflowId, message, execEventTopic(execId));
|
|
29
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker-backed `createSandbox` / `teardown` / `isAlive`.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around `dockerode`. Storage is wired via `HostConfig.Binds`:
|
|
5
|
+
* a flat read-only mount of the analysis tree at `/{resourceId}`, a nested
|
|
6
|
+
* read-write mount of the step's artifact dir, and the lib/ref stores at
|
|
7
|
+
* `/mnt/libs` / `/mnt/refs` when their host paths are configured. Container
|
|
8
|
+
* paths and lib-store env come from the shared mount plan (`mount-plan.ts`).
|
|
9
|
+
*
|
|
10
|
+
* ## Transport and confinement
|
|
11
|
+
*
|
|
12
|
+
* The container joins the default bridge and publishes sandbox-server's port to
|
|
13
|
+
* `127.0.0.1` only, so the host can reach `/exec` but the LAN cannot. What the
|
|
14
|
+
* sandbox may do *outbound* depends on the transport:
|
|
15
|
+
*
|
|
16
|
+
* - **poll** (default): the sandbox initiates nothing, so it needs no egress.
|
|
17
|
+
* The container is created as root with `CAP_NET_ADMIN` and the
|
|
18
|
+
* `SANDBOX_EGRESS_FIREWALL` flag; the image's root entrypoint installs
|
|
19
|
+
* `iptables -P OUTPUT DROP` (allowing loopback and established return
|
|
20
|
+
* traffic) and then `setpriv`-drops to the uid-1000 workload, which can
|
|
21
|
+
* neither reach the network nor flush the rules. The host polls
|
|
22
|
+
* `GET /exec/{execId}?since={cursor}` over the published port; the reply
|
|
23
|
+
* rides the established connection, so polling works with egress hard-blocked.
|
|
24
|
+
* - **callback**: the sandbox is *allowed* egress and POSTs signed callbacks to
|
|
25
|
+
* `CORTEX_BASE_URL`. It runs as uid 1000 throughout with no `NET_ADMIN` and
|
|
26
|
+
* no firewall.
|
|
27
|
+
*
|
|
28
|
+
* Either way the workload ends as uid 1000 with `no-new-privileges` and no
|
|
29
|
+
* effective capabilities.
|
|
30
|
+
*/
|
|
31
|
+
import Docker from "dockerode";
|
|
32
|
+
import type pino from "pino";
|
|
33
|
+
import { ResultAsync } from "neverthrow";
|
|
34
|
+
import { type ResolveWorkspaceRoot } from "../workspace/paths.js";
|
|
35
|
+
import { type SandboxError } from "./sandbox-error.js";
|
|
36
|
+
import type { CreateSandboxMeta, ManagedSandbox, SandboxIdentity, SandboxLiveness, SandboxRef, SandboxTransport } from "./types.js";
|
|
37
|
+
export interface DockerClientConfig {
|
|
38
|
+
image: string;
|
|
39
|
+
/** Cortex base URL injected into the sandbox env in callback mode so callbacks land here. Unused in poll mode. */
|
|
40
|
+
cortexBaseUrl: string;
|
|
41
|
+
/** Result transport. `poll` (default) confines the sandbox with the egress firewall; `callback` permits egress. */
|
|
42
|
+
transport?: SandboxTransport;
|
|
43
|
+
/** Workspace-root resolution seam; each analysis's resolved root is the bind source for its tree mounts. */
|
|
44
|
+
resolveWorkspaceRoot: ResolveWorkspaceRoot;
|
|
45
|
+
/** Host lib store; bind-mounted read-only at `/mnt/libs` when set. */
|
|
46
|
+
libStorePath?: string;
|
|
47
|
+
/** Host ref store; bind-mounted read-only at `/mnt/refs` when set. */
|
|
48
|
+
refStorePath?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Force the container platform (e.g. `linux/amd64`). Set by hosts that mount
|
|
51
|
+
* a lib store so the container's arch always matches the store's native
|
|
52
|
+
* binaries; a local image built for a different arch then fails loudly at
|
|
53
|
+
* create rather than crashing inside the sandbox.
|
|
54
|
+
*/
|
|
55
|
+
platform?: string;
|
|
56
|
+
/** Injected for tests. */
|
|
57
|
+
docker?: Docker;
|
|
58
|
+
/** Injected for tests so `/health` polling can be stubbed. */
|
|
59
|
+
fetch?: typeof fetch;
|
|
60
|
+
/**
|
|
61
|
+
* Optional logger so a lib-store degradation (a configured store whose `current`
|
|
62
|
+
* vanished or went incomplete by sandbox-create time) is observable instead of a
|
|
63
|
+
* silent libs-mount drop. Matches the `reaper`/`watchdog` logger seam.
|
|
64
|
+
*/
|
|
65
|
+
logger?: Pick<pino.Logger, "info" | "warn" | "error">;
|
|
66
|
+
/** Hook called after the registry row is written. */
|
|
67
|
+
registerSandbox: (meta: CreateSandboxMeta, ref: SandboxRef) => Promise<void>;
|
|
68
|
+
}
|
|
69
|
+
export declare function createDockerSandboxOps(config: DockerClientConfig): {
|
|
70
|
+
createSandbox(meta: CreateSandboxMeta, identity: SandboxIdentity): ResultAsync<SandboxRef, SandboxError>;
|
|
71
|
+
teardown(ref: SandboxRef): ResultAsync<void, SandboxError>;
|
|
72
|
+
teardownById(sandboxId: string): ResultAsync<void, SandboxError>;
|
|
73
|
+
isAlive(ref: SandboxRef): ResultAsync<SandboxLiveness, SandboxError>;
|
|
74
|
+
listManagedSandboxes(): ResultAsync<ManagedSandbox[], SandboxError>;
|
|
75
|
+
};
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker-backed `createSandbox` / `teardown` / `isAlive`.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around `dockerode`. Storage is wired via `HostConfig.Binds`:
|
|
5
|
+
* a flat read-only mount of the analysis tree at `/{resourceId}`, a nested
|
|
6
|
+
* read-write mount of the step's artifact dir, and the lib/ref stores at
|
|
7
|
+
* `/mnt/libs` / `/mnt/refs` when their host paths are configured. Container
|
|
8
|
+
* paths and lib-store env come from the shared mount plan (`mount-plan.ts`).
|
|
9
|
+
*
|
|
10
|
+
* ## Transport and confinement
|
|
11
|
+
*
|
|
12
|
+
* The container joins the default bridge and publishes sandbox-server's port to
|
|
13
|
+
* `127.0.0.1` only, so the host can reach `/exec` but the LAN cannot. What the
|
|
14
|
+
* sandbox may do *outbound* depends on the transport:
|
|
15
|
+
*
|
|
16
|
+
* - **poll** (default): the sandbox initiates nothing, so it needs no egress.
|
|
17
|
+
* The container is created as root with `CAP_NET_ADMIN` and the
|
|
18
|
+
* `SANDBOX_EGRESS_FIREWALL` flag; the image's root entrypoint installs
|
|
19
|
+
* `iptables -P OUTPUT DROP` (allowing loopback and established return
|
|
20
|
+
* traffic) and then `setpriv`-drops to the uid-1000 workload, which can
|
|
21
|
+
* neither reach the network nor flush the rules. The host polls
|
|
22
|
+
* `GET /exec/{execId}?since={cursor}` over the published port; the reply
|
|
23
|
+
* rides the established connection, so polling works with egress hard-blocked.
|
|
24
|
+
* - **callback**: the sandbox is *allowed* egress and POSTs signed callbacks to
|
|
25
|
+
* `CORTEX_BASE_URL`. It runs as uid 1000 throughout with no `NET_ADMIN` and
|
|
26
|
+
* no firewall.
|
|
27
|
+
*
|
|
28
|
+
* Either way the workload ends as uid 1000 with `no-new-privileges` and no
|
|
29
|
+
* effective capabilities.
|
|
30
|
+
*/
|
|
31
|
+
import { existsSync, statSync } from "node:fs";
|
|
32
|
+
import { join } from "node:path";
|
|
33
|
+
import Docker from "dockerode";
|
|
34
|
+
import { ResultAsync, err, ok } from "neverthrow";
|
|
35
|
+
import { stepWritePrefix } from "../workspace/paths.js";
|
|
36
|
+
import { trySandbox } from "./sandbox-error.js";
|
|
37
|
+
import { buildMountPlan } from "./mount-plan.js";
|
|
38
|
+
/** Read the originating HTTP status off any `SandboxError` variant that carries one. */
|
|
39
|
+
function statusOf(e) {
|
|
40
|
+
return "status" in e ? e.status : undefined;
|
|
41
|
+
}
|
|
42
|
+
const SANDBOX_SERVER_PORT = 8765;
|
|
43
|
+
const HEALTH_TIMEOUT_MS = 30_000;
|
|
44
|
+
/** Only this process dials the published port; binding it on every host interface would expose `/exec` to the LAN. */
|
|
45
|
+
const SANDBOX_PORT_HOST_IP = "127.0.0.1";
|
|
46
|
+
/** Matches `USER sandbox` (uid/gid 1000) in the sandbox images — the callback-mode workload user. */
|
|
47
|
+
const SANDBOX_USER = "1000:1000";
|
|
48
|
+
/**
|
|
49
|
+
* Poll mode starts the container as root so the entrypoint can install the
|
|
50
|
+
* egress firewall; the entrypoint then `setpriv`-drops to uid 1000, so the
|
|
51
|
+
* workload still runs unprivileged. sandbox-server refuses to start as root
|
|
52
|
+
* when the firewall flag is set, so an image whose entrypoint skips the drop
|
|
53
|
+
* fails at create time rather than running privileged and unconfined.
|
|
54
|
+
*/
|
|
55
|
+
const SANDBOX_ROOT_USER = "0:0";
|
|
56
|
+
const HEALTH_POLL_MS = 250;
|
|
57
|
+
const MANAGED_BY_LABEL = "app.kubernetes.io/managed-by";
|
|
58
|
+
const MANAGED_BY_VALUE = "cortex";
|
|
59
|
+
const OWNER_WORKFLOW_LABEL = "cortex/owner-workflow-id";
|
|
60
|
+
const RUN_ID_LABEL = "cortex/run-id";
|
|
61
|
+
const STEP_ID_LABEL = "cortex/step-id";
|
|
62
|
+
/**
|
|
63
|
+
* Whether the lib store's `current` resolves to a COMPLETE, usable version, not merely a
|
|
64
|
+
* present symlink. By sandbox-create time `current` may be gone (concurrent prune/`rm`), a
|
|
65
|
+
* dangling symlink (its target pruned), or an incomplete tree. Binding a missing source
|
|
66
|
+
* makes Docker auto-create a root-owned dir (bricking a later store refresh); binding a broken
|
|
67
|
+
* one mounts broken content. Require a resolved directory carrying both completeness
|
|
68
|
+
* markers `activate` writes before it flips the pointer.
|
|
69
|
+
*/
|
|
70
|
+
function libStoreUsable(libStorePath) {
|
|
71
|
+
const current = join(libStorePath, "current");
|
|
72
|
+
try {
|
|
73
|
+
// statSync FOLLOWS the symlink, so a dangling `current` throws here and is rejected.
|
|
74
|
+
if (!statSync(current).isDirectory())
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return existsSync(join(current, "packages.txt")) && existsSync(join(current, "meta.json"));
|
|
81
|
+
}
|
|
82
|
+
async function pollHealth(fetchImpl, url, timeoutMs) {
|
|
83
|
+
const deadline = Date.now() + timeoutMs;
|
|
84
|
+
let lastErr;
|
|
85
|
+
while (Date.now() < deadline) {
|
|
86
|
+
try {
|
|
87
|
+
const res = await fetchImpl(url);
|
|
88
|
+
if (res.status === 200)
|
|
89
|
+
return;
|
|
90
|
+
lastErr = new Error(`/health returned ${res.status}`);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
lastErr = err;
|
|
94
|
+
}
|
|
95
|
+
await new Promise((r) => setTimeout(r, HEALTH_POLL_MS));
|
|
96
|
+
}
|
|
97
|
+
throw new Error(`sandbox /health did not return 200 within ${timeoutMs}ms: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create the container, or adopt the one already standing under this
|
|
101
|
+
* checkpointed name (a recovery re-run, see the harness-sandbox-exec spec). A
|
|
102
|
+
* running container is adopted as-is; a stopped prior attempt is removed and
|
|
103
|
+
* recreated. A 409 whose container belongs to a different workflow is a refused
|
|
104
|
+
* name collision — never adopt or remove someone else's container.
|
|
105
|
+
*/
|
|
106
|
+
async function createOrAdopt(docker, createOpts, name, ownerWorkflowId, createFailed) {
|
|
107
|
+
const created = await trySandbox(() => docker.createContainer(createOpts), createFailed);
|
|
108
|
+
if (created.isOk())
|
|
109
|
+
return ok({ container: created.value, alreadyRunning: false });
|
|
110
|
+
if (statusOf(created.error) !== 409)
|
|
111
|
+
return err(created.error);
|
|
112
|
+
const existing = docker.getContainer(name);
|
|
113
|
+
const inspected = await trySandbox(() => existing.inspect(), createFailed);
|
|
114
|
+
if (inspected.isErr())
|
|
115
|
+
return err(inspected.error);
|
|
116
|
+
const info = inspected.value;
|
|
117
|
+
const owner = info.Config?.Labels?.[OWNER_WORKFLOW_LABEL];
|
|
118
|
+
if (owner !== ownerWorkflowId) {
|
|
119
|
+
return err({ type: "name_conflict", op: "docker.createSandbox", sandboxId: name, owner: owner ?? null });
|
|
120
|
+
}
|
|
121
|
+
if (info.State.Running)
|
|
122
|
+
return ok({ container: existing, alreadyRunning: true });
|
|
123
|
+
const removed = await removeContainerIgnoreMissing(docker, name);
|
|
124
|
+
if (removed.isErr())
|
|
125
|
+
return err(removed.error);
|
|
126
|
+
const recreated = await trySandbox(() => docker.createContainer(createOpts), createFailed);
|
|
127
|
+
if (recreated.isErr())
|
|
128
|
+
return err(recreated.error);
|
|
129
|
+
return ok({ container: recreated.value, alreadyRunning: false });
|
|
130
|
+
}
|
|
131
|
+
function removeContainerIgnoreMissing(docker, sandboxId) {
|
|
132
|
+
return trySandbox(async () => {
|
|
133
|
+
const container = docker.getContainer(sandboxId);
|
|
134
|
+
await container.stop({ t: 5 }).catch(() => { });
|
|
135
|
+
await container.remove({ force: true, v: true }).catch(() => { });
|
|
136
|
+
}, (status, cause) => ({
|
|
137
|
+
type: "teardown_failed",
|
|
138
|
+
op: "docker.teardown",
|
|
139
|
+
sandboxId,
|
|
140
|
+
status,
|
|
141
|
+
cause,
|
|
142
|
+
})).orElse((e) =>
|
|
143
|
+
// A 404 means the container is already gone — an idempotent success.
|
|
144
|
+
statusOf(e) === 404 ? ok(undefined) : err(e));
|
|
145
|
+
}
|
|
146
|
+
export function createDockerSandboxOps(config) {
|
|
147
|
+
const docker = config.docker ?? new Docker();
|
|
148
|
+
const fetchImpl = config.fetch ?? fetch;
|
|
149
|
+
const transport = config.transport ?? "poll";
|
|
150
|
+
const pollMode = transport === "poll";
|
|
151
|
+
return {
|
|
152
|
+
createSandbox(meta, identity) {
|
|
153
|
+
return new ResultAsync((async () => {
|
|
154
|
+
const { sandboxId, callbackSecret } = identity;
|
|
155
|
+
// Re-check AT sandbox-creation time: `config.libStorePath` was fixed at CLI
|
|
156
|
+
// boot and the store may have gone away since (see libStoreUsable). Not
|
|
157
|
+
// usable → skip the mount (sandbox degrades to available:false) and log it,
|
|
158
|
+
// since an otherwise-silent libs-mount drop is invisible to operators.
|
|
159
|
+
const libsMounted = !!config.libStorePath && libStoreUsable(config.libStorePath);
|
|
160
|
+
if (config.libStorePath && !libsMounted) {
|
|
161
|
+
config.logger?.warn({ libStorePath: config.libStorePath, sandboxId }, "[docker-client] lib store configured but `current` is missing or incomplete at sandbox creation — mounting no library store (sandbox degrades to available:false)");
|
|
162
|
+
}
|
|
163
|
+
const plan = buildMountPlan(meta, {
|
|
164
|
+
libs: libsMounted,
|
|
165
|
+
refs: !!config.refStorePath,
|
|
166
|
+
});
|
|
167
|
+
const hostTreePath = config.resolveWorkspaceRoot(meta.analysisId);
|
|
168
|
+
// `stepWritePrefix` (not a raw `join`) so the RW bind source runs through
|
|
169
|
+
// the same id validation as the pre-created step tree — a crafted stepId
|
|
170
|
+
// cannot escape the resolved root into the container.
|
|
171
|
+
const hostStepPath = stepWritePrefix({ workspaceRoot: hostTreePath, runId: meta.runId, stepId: meta.stepId });
|
|
172
|
+
const binds = [
|
|
173
|
+
`${hostTreePath}:${plan.readonlyTreePath}:ro`,
|
|
174
|
+
...(plan.writableStepPath ? [`${hostStepPath}:${plan.writableStepPath}:rw`] : []),
|
|
175
|
+
...(libsMounted && config.libStorePath ? [`${config.libStorePath}:${plan.libsPath}:ro`] : []),
|
|
176
|
+
...(config.refStorePath ? [`${config.refStorePath}:${plan.refsPath}:ro`] : []),
|
|
177
|
+
];
|
|
178
|
+
const createFailed = (status, cause) => ({
|
|
179
|
+
type: "container_create_failed",
|
|
180
|
+
op: "docker.createSandbox",
|
|
181
|
+
sandboxId,
|
|
182
|
+
status,
|
|
183
|
+
cause,
|
|
184
|
+
});
|
|
185
|
+
const image = meta.image ?? config.image;
|
|
186
|
+
// Poll mode never dials out and carries no CORTEX_BASE_URL; it sets the
|
|
187
|
+
// firewall flag so the root entrypoint installs the egress block before
|
|
188
|
+
// dropping to uid 1000. Callback mode is the inverse.
|
|
189
|
+
const env = [
|
|
190
|
+
`SANDBOX_TRANSPORT=${transport}`,
|
|
191
|
+
`SANDBOX_CALLBACK_SECRET=${callbackSecret}`,
|
|
192
|
+
...(pollMode ? ["SANDBOX_EGRESS_FIREWALL=1"] : [`CORTEX_BASE_URL=${config.cortexBaseUrl}`]),
|
|
193
|
+
...Object.entries(plan.env).map(([k, v]) => `${k}=${v}`),
|
|
194
|
+
...Object.entries(meta.extraEnv ?? {}).map(([k, v]) => `${k}=${v}`),
|
|
195
|
+
];
|
|
196
|
+
const spec = meta.resources;
|
|
197
|
+
const createOpts = {
|
|
198
|
+
name: sandboxId,
|
|
199
|
+
...(config.platform !== undefined && { platform: config.platform }),
|
|
200
|
+
Image: image,
|
|
201
|
+
Env: env,
|
|
202
|
+
User: pollMode ? SANDBOX_ROOT_USER : SANDBOX_USER,
|
|
203
|
+
WorkingDir: plan.workingDir,
|
|
204
|
+
Labels: {
|
|
205
|
+
[MANAGED_BY_LABEL]: MANAGED_BY_VALUE,
|
|
206
|
+
[OWNER_WORKFLOW_LABEL]: meta.childWorkflowId,
|
|
207
|
+
[RUN_ID_LABEL]: meta.runId,
|
|
208
|
+
[STEP_ID_LABEL]: meta.stepId,
|
|
209
|
+
role: "sandbox",
|
|
210
|
+
"cortex/sandbox-id": sandboxId,
|
|
211
|
+
},
|
|
212
|
+
ExposedPorts: { [`${SANDBOX_SERVER_PORT}/tcp`]: {} },
|
|
213
|
+
HostConfig: {
|
|
214
|
+
Binds: binds,
|
|
215
|
+
// Published to loopback only: the host reaches `/exec`, the LAN cannot.
|
|
216
|
+
PortBindings: {
|
|
217
|
+
[`${SANDBOX_SERVER_PORT}/tcp`]: [{ HostIp: SANDBOX_PORT_HOST_IP, HostPort: "0" }],
|
|
218
|
+
},
|
|
219
|
+
CapDrop: ["ALL"],
|
|
220
|
+
// Poll mode grants the ROOT entrypoint exactly what its privileged
|
|
221
|
+
// setup needs: NET_ADMIN to install the egress iptables rules,
|
|
222
|
+
// SETUID/SETGID for the setpriv uid/gid drop to the workload user
|
|
223
|
+
// (setresuid/setresgid fail EPERM without them), and SETPCAP to apply
|
|
224
|
+
// setpriv's `--bounding-set=-all`. The entrypoint drops all of them
|
|
225
|
+
// before the workload runs — the workload's capability sets end empty
|
|
226
|
+
// — and `no-new-privileges` prevents regaining any.
|
|
227
|
+
...(pollMode ? { CapAdd: ["NET_ADMIN", "SETUID", "SETGID", "SETPCAP"] } : {}),
|
|
228
|
+
SecurityOpt: ["no-new-privileges"],
|
|
229
|
+
NanoCpus: Math.round(spec.cpu * 1e9),
|
|
230
|
+
Memory: spec.memoryGb * 1024 ** 3,
|
|
231
|
+
AutoRemove: false,
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
const sandbox = await createOrAdopt(docker, createOpts, sandboxId, meta.childWorkflowId, createFailed);
|
|
235
|
+
if (sandbox.isErr())
|
|
236
|
+
return err(sandbox.error);
|
|
237
|
+
if (!sandbox.value.alreadyRunning) {
|
|
238
|
+
const started = await trySandbox(() => sandbox.value.container.start(), createFailed);
|
|
239
|
+
if (started.isErr())
|
|
240
|
+
return err(started.error);
|
|
241
|
+
}
|
|
242
|
+
const inspected = await trySandbox(() => sandbox.value.container.inspect(), createFailed);
|
|
243
|
+
if (inspected.isErr())
|
|
244
|
+
return err(inspected.error);
|
|
245
|
+
const hostPort = inspected.value.NetworkSettings.Ports?.[`${SANDBOX_SERVER_PORT}/tcp`]?.[0]?.HostPort;
|
|
246
|
+
if (!hostPort) {
|
|
247
|
+
// A container we cannot reach is useless; stop and remove it so a retry
|
|
248
|
+
// starts clean rather than colliding with an unroutable name.
|
|
249
|
+
(await removeContainerIgnoreMissing(docker, sandboxId)).unwrapOr(undefined);
|
|
250
|
+
return err(createFailed(undefined, new Error(`DockerSandbox: no host port mapped for ${SANDBOX_SERVER_PORT}/tcp on ${sandboxId}`)));
|
|
251
|
+
}
|
|
252
|
+
const host = SANDBOX_PORT_HOST_IP;
|
|
253
|
+
const port = Number(hostPort);
|
|
254
|
+
const healthy = await trySandbox(() => pollHealth(fetchImpl, `http://${host}:${port}/health`, HEALTH_TIMEOUT_MS), createFailed);
|
|
255
|
+
if (healthy.isErr())
|
|
256
|
+
return err(healthy.error);
|
|
257
|
+
const ref = {
|
|
258
|
+
sandboxId,
|
|
259
|
+
host,
|
|
260
|
+
port,
|
|
261
|
+
backend: "docker",
|
|
262
|
+
callbackSecret,
|
|
263
|
+
};
|
|
264
|
+
const registered = await trySandbox(() => config.registerSandbox(meta, ref), createFailed);
|
|
265
|
+
if (registered.isErr())
|
|
266
|
+
return err(registered.error);
|
|
267
|
+
return ok(ref);
|
|
268
|
+
})());
|
|
269
|
+
},
|
|
270
|
+
teardown(ref) {
|
|
271
|
+
return removeContainerIgnoreMissing(docker, ref.sandboxId);
|
|
272
|
+
},
|
|
273
|
+
teardownById(sandboxId) {
|
|
274
|
+
return removeContainerIgnoreMissing(docker, sandboxId);
|
|
275
|
+
},
|
|
276
|
+
listManagedSandboxes() {
|
|
277
|
+
return trySandbox(() => docker.listContainers({
|
|
278
|
+
all: true,
|
|
279
|
+
filters: { label: [`${MANAGED_BY_LABEL}=${MANAGED_BY_VALUE}`] },
|
|
280
|
+
}), (status, cause) => ({
|
|
281
|
+
type: "liveness_failed",
|
|
282
|
+
op: "docker.listManagedSandboxes",
|
|
283
|
+
status,
|
|
284
|
+
cause,
|
|
285
|
+
})).map((containers) => containers
|
|
286
|
+
.map((c) => {
|
|
287
|
+
const labels = c.Labels ?? {};
|
|
288
|
+
return {
|
|
289
|
+
sandboxId: labels["cortex/sandbox-id"] ?? "",
|
|
290
|
+
ownerWorkflowId: labels[OWNER_WORKFLOW_LABEL] ?? null,
|
|
291
|
+
// Docker reports `Created` as unix seconds.
|
|
292
|
+
createdAtMs: typeof c.Created === "number" ? c.Created * 1000 : null,
|
|
293
|
+
};
|
|
294
|
+
})
|
|
295
|
+
.filter((s) => s.sandboxId.length > 0));
|
|
296
|
+
},
|
|
297
|
+
isAlive(ref) {
|
|
298
|
+
return trySandbox(async () => {
|
|
299
|
+
const info = await docker.getContainer(ref.sandboxId).inspect();
|
|
300
|
+
const oomKilled = info.State.OOMKilled === true;
|
|
301
|
+
// A running container is a reachable sandbox: the host dials its
|
|
302
|
+
// published loopback port directly.
|
|
303
|
+
return { alive: info.State.Running === true, oomKilled };
|
|
304
|
+
}, (status, cause) => ({
|
|
305
|
+
type: "liveness_failed",
|
|
306
|
+
op: "docker.isAlive",
|
|
307
|
+
sandboxId: ref.sandboxId,
|
|
308
|
+
status,
|
|
309
|
+
cause,
|
|
310
|
+
})).orElse((e) =>
|
|
311
|
+
// dockerode throws 404 for a missing container — observably dead.
|
|
312
|
+
statusOf(e) === 404 ? ok({ alive: false, oomKilled: false }) : err(e));
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const EXPANSION = {
|
|
2
|
+
csv: 8,
|
|
3
|
+
tsv: 8,
|
|
4
|
+
txt: 8,
|
|
5
|
+
json: 8,
|
|
6
|
+
jsonl: 8,
|
|
7
|
+
ndjson: 8,
|
|
8
|
+
xlsx: 15,
|
|
9
|
+
xls: 15,
|
|
10
|
+
gz: 12,
|
|
11
|
+
bz2: 12,
|
|
12
|
+
zip: 12,
|
|
13
|
+
xz: 12,
|
|
14
|
+
zst: 12,
|
|
15
|
+
parquet: 4,
|
|
16
|
+
feather: 4,
|
|
17
|
+
arrow: 4,
|
|
18
|
+
orc: 4,
|
|
19
|
+
h5: 4,
|
|
20
|
+
hdf5: 4,
|
|
21
|
+
nc: 4,
|
|
22
|
+
mat: 4,
|
|
23
|
+
npy: 4,
|
|
24
|
+
npz: 4,
|
|
25
|
+
bam: 2,
|
|
26
|
+
cram: 2,
|
|
27
|
+
sam: 2,
|
|
28
|
+
vcf: 2,
|
|
29
|
+
bcf: 2,
|
|
30
|
+
bed: 2,
|
|
31
|
+
gff: 2,
|
|
32
|
+
gtf: 2,
|
|
33
|
+
fastq: 2,
|
|
34
|
+
fasta: 2,
|
|
35
|
+
fa: 2,
|
|
36
|
+
fq: 2,
|
|
37
|
+
rds: 6,
|
|
38
|
+
rdata: 6,
|
|
39
|
+
rda: 6,
|
|
40
|
+
pdf: 1,
|
|
41
|
+
png: 1,
|
|
42
|
+
jpg: 1,
|
|
43
|
+
jpeg: 1,
|
|
44
|
+
svg: 1,
|
|
45
|
+
html: 1,
|
|
46
|
+
md: 1,
|
|
47
|
+
};
|
|
48
|
+
// Unknown / extensionless files default to 6× in-memory expansion.
|
|
49
|
+
const DEFAULT_FACTOR = 6;
|
|
50
|
+
function factorFor(relativePath) {
|
|
51
|
+
const base = relativePath.slice(relativePath.lastIndexOf("/") + 1);
|
|
52
|
+
const dot = base.lastIndexOf(".");
|
|
53
|
+
if (dot <= 0)
|
|
54
|
+
return DEFAULT_FACTOR;
|
|
55
|
+
return EXPANSION[base.slice(dot + 1).toLowerCase()] ?? DEFAULT_FACTOR;
|
|
56
|
+
}
|
|
57
|
+
export function estimateDataProfileResources(files) {
|
|
58
|
+
if (files.length === 0)
|
|
59
|
+
return { cpu: 1, memoryGb: 2 };
|
|
60
|
+
let largest = files[0];
|
|
61
|
+
let totalBytes = 0;
|
|
62
|
+
for (const f of files) {
|
|
63
|
+
totalBytes += f.size;
|
|
64
|
+
if (f.size > largest.size)
|
|
65
|
+
largest = f;
|
|
66
|
+
}
|
|
67
|
+
const memoryGb = Math.max(2, Math.ceil(2 + (largest.size * factorFor(largest.relativePath)) / 1e9));
|
|
68
|
+
let cpu = totalBytes < 100 * 1e6 ? 1 : totalBytes < 1e9 ? 2 : totalBytes < 10 * 1e9 ? 4 : 8;
|
|
69
|
+
if (files.length >= 8)
|
|
70
|
+
cpu += 1;
|
|
71
|
+
cpu = Math.max(1, cpu);
|
|
72
|
+
return { cpu, memoryGb };
|
|
73
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `execId` parsing — execId is `${workflowId}:${stepId}:${fnId}` where the
|
|
3
|
+
* workflowId portion itself contains exactly one colon (child workflow ids
|
|
4
|
+
* are `${analysisId}:${runId}-${stepIdx}`, parent ids are
|
|
5
|
+
* `${analysisId}:${runId}`). `indexOf(":")` / `split(":")[0]` over an
|
|
6
|
+
* execId would stop INSIDE the workflowId and return only the analysisId,
|
|
7
|
+
* which `DBOS.send` would treat as a wrong-workflow target. Strip the last
|
|
8
|
+
* two colon-delimited segments (`:${stepId}:${fnId}`) to recover the
|
|
9
|
+
* workflowId. `stepId` is a plan-defined slug and `fnId` is `fn-${n.toString(36)}`,
|
|
10
|
+
* neither of which can contain colons.
|
|
11
|
+
*/
|
|
12
|
+
export declare function workflowIdFromExec(execId: string): string | null;
|