@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,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request identity — typed value objects and the two lifetime-typed bundles.
|
|
3
|
+
*
|
|
4
|
+
* Per-request identity is decomposed into small immutable value objects
|
|
5
|
+
* (`Identity`, `Scope`, `Credential`, `Provenance`, `RunFrame`) plus an opaque
|
|
6
|
+
* `auth` capability (`AuthContext`), instead of the old flat `Session`
|
|
7
|
+
* grab-bag. The `auth` capability is the sole carrier of credential/org behind
|
|
8
|
+
* a session — there is no top-level `orgId` or `credential` field. Optional
|
|
9
|
+
* concerns are whole present-or-absent sub-objects: a `RunFrame` exists or it
|
|
10
|
+
* doesn't; a `Credential` is an opaque bearer capability — never a nullable
|
|
11
|
+
* field. Its concrete shape is a managed refinement; the harness never inspects it.
|
|
12
|
+
*
|
|
13
|
+
* Two bundles compose those objects with honest lifetimes:
|
|
14
|
+
* - `RequestSession` — the live HTTP door. No RunFrame; never JSON-serialized
|
|
15
|
+
* into durable state.
|
|
16
|
+
* - `RunSession` — durable, JSON-serializable. Carries a `RunFrame`; minted
|
|
17
|
+
* only at the run-authorization seam.
|
|
18
|
+
*
|
|
19
|
+
* Neither bundle carries resolved billing headers — billing is resolved
|
|
20
|
+
* lazily at the LLM call site (see `harness/billing/resolver.ts`).
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Derive the `{ resourceType, resourceId }` a scope resolves through.
|
|
24
|
+
* Analysis → `{ "analysis", analysisId }`; target-assessment →
|
|
25
|
+
* `{ "billing_context", billingContextId }` (TA resolves billing via the
|
|
26
|
+
* billing-context discriminator until it is a first-class resource).
|
|
27
|
+
*/
|
|
28
|
+
export function scopeResource(scope) {
|
|
29
|
+
return scope.kind === "analysis"
|
|
30
|
+
? { resourceType: "analysis", resourceId: scope.analysisId }
|
|
31
|
+
: { resourceType: "billing_context", resourceId: scope.billingContextId };
|
|
32
|
+
}
|
|
33
|
+
/** The value stamped into the workload tag — the workload id for this scope. */
|
|
34
|
+
export function scopeWorkloadId(scope) {
|
|
35
|
+
return scope.kind === "analysis" ? scope.analysisId : scope.targetAssessmentId;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Derive a child session for a sub-agent call — provenance only. Sets the
|
|
39
|
+
* child `agentId` and appends it to `callPath`, leaving identity, scope, and
|
|
40
|
+
* auth untouched. Works on either bundle (the input type is preserved).
|
|
41
|
+
*/
|
|
42
|
+
export function forSubAgent(session, agentId) {
|
|
43
|
+
return {
|
|
44
|
+
...session,
|
|
45
|
+
provenance: {
|
|
46
|
+
agentId,
|
|
47
|
+
callPath: [...session.provenance.callPath, agentId],
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Derive a child `RunSession` for a sandbox step — pure value derivation.
|
|
53
|
+
* Sets `runFrame.stepId`; identity, scope, auth, and provenance are
|
|
54
|
+
* unchanged. Used by parents when computing child workflow input.
|
|
55
|
+
*/
|
|
56
|
+
export function forStep(parent, stepId) {
|
|
57
|
+
return {
|
|
58
|
+
...parent,
|
|
59
|
+
runFrame: { runId: parent.runFrame.runId, stepId },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic single-flight LRU+TTL resolver.
|
|
3
|
+
*
|
|
4
|
+
* Resolves an input to a value via `fetch`, caching success only behind a
|
|
5
|
+
* bounded LRU with per-entry TTL. Concurrent callers for the same key coalesce
|
|
6
|
+
* onto one in-flight fetch; a fetch that throws is not cached and clears its
|
|
7
|
+
* in-flight slot. Callers supply their own key formula, fetch+validate step,
|
|
8
|
+
* and (optionally) cache hit/miss metrics; this module owns eviction,
|
|
9
|
+
* coalescing, and expiry — the deep, drift-prone plumbing.
|
|
10
|
+
*/
|
|
11
|
+
export interface CachedResolverMetrics {
|
|
12
|
+
onHit(): void;
|
|
13
|
+
/** Recorded once per upstream fetch — coalesced callers do not count. */
|
|
14
|
+
onMiss(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface CachedResolverConfig<In, Out> {
|
|
17
|
+
readonly ttlMs: number;
|
|
18
|
+
readonly maxEntries: number;
|
|
19
|
+
readonly keyFn: (input: In) => string;
|
|
20
|
+
readonly fetch: (input: In) => Promise<Out>;
|
|
21
|
+
readonly metrics?: CachedResolverMetrics;
|
|
22
|
+
}
|
|
23
|
+
export declare function createCachedResolver<In, Out>(cfg: CachedResolverConfig<In, Out>): (input: In) => Promise<Out>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic single-flight LRU+TTL resolver.
|
|
3
|
+
*
|
|
4
|
+
* Resolves an input to a value via `fetch`, caching success only behind a
|
|
5
|
+
* bounded LRU with per-entry TTL. Concurrent callers for the same key coalesce
|
|
6
|
+
* onto one in-flight fetch; a fetch that throws is not cached and clears its
|
|
7
|
+
* in-flight slot. Callers supply their own key formula, fetch+validate step,
|
|
8
|
+
* and (optionally) cache hit/miss metrics; this module owns eviction,
|
|
9
|
+
* coalescing, and expiry — the deep, drift-prone plumbing.
|
|
10
|
+
*/
|
|
11
|
+
export function createCachedResolver(cfg) {
|
|
12
|
+
// Map insertion order doubles as LRU recency: a hit re-inserts the key at
|
|
13
|
+
// the tail; eviction drops the head (oldest).
|
|
14
|
+
const cache = new Map();
|
|
15
|
+
const inflight = new Map();
|
|
16
|
+
function readFresh(key) {
|
|
17
|
+
const entry = cache.get(key);
|
|
18
|
+
if (!entry)
|
|
19
|
+
return undefined;
|
|
20
|
+
if (entry.expiresAt <= Date.now()) {
|
|
21
|
+
cache.delete(key);
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
cache.delete(key);
|
|
25
|
+
cache.set(key, entry);
|
|
26
|
+
return entry.value;
|
|
27
|
+
}
|
|
28
|
+
function store(key, value) {
|
|
29
|
+
cache.set(key, { value, expiresAt: Date.now() + cfg.ttlMs });
|
|
30
|
+
while (cache.size > cfg.maxEntries) {
|
|
31
|
+
const oldest = cache.keys().next().value;
|
|
32
|
+
if (oldest === undefined)
|
|
33
|
+
break;
|
|
34
|
+
cache.delete(oldest);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return async function resolve(input) {
|
|
38
|
+
const key = cfg.keyFn(input);
|
|
39
|
+
const fresh = readFresh(key);
|
|
40
|
+
if (fresh !== undefined) {
|
|
41
|
+
cfg.metrics?.onHit();
|
|
42
|
+
return fresh;
|
|
43
|
+
}
|
|
44
|
+
const pending = inflight.get(key);
|
|
45
|
+
if (pending)
|
|
46
|
+
return pending;
|
|
47
|
+
cfg.metrics?.onMiss();
|
|
48
|
+
const promise = (async () => {
|
|
49
|
+
const value = await cfg.fetch(input);
|
|
50
|
+
store(key, value);
|
|
51
|
+
return value;
|
|
52
|
+
})();
|
|
53
|
+
inflight.set(key, promise);
|
|
54
|
+
try {
|
|
55
|
+
return await promise;
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
inflight.delete(key);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ResolveBilling } from "./resolver.js";
|
|
2
|
+
/**
|
|
3
|
+
* Local/OSS billing resolver: resolves to an empty header map. No upstream
|
|
4
|
+
* call, no credential reads. Wire calls carry no attribution headers.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createNoopBillingResolver(): ResolveBilling;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing attribution seam.
|
|
3
|
+
*
|
|
4
|
+
* Defines the `ResolveBilling` contract the provider calls at the
|
|
5
|
+
* LLM/embedding call site, plus the session view and fetcher types a
|
|
6
|
+
* concrete resolver implements. The provider calls `resolveBilling(session)`
|
|
7
|
+
* just before the wire call; read-only routes never call it, so they never
|
|
8
|
+
* incur a billing round-trip.
|
|
9
|
+
*
|
|
10
|
+
* This module is the vendor-neutral seam: it declares types only. A concrete
|
|
11
|
+
* resolver (managed/upstream-backed or noop) supplies the fetch + assembly
|
|
12
|
+
* behavior behind the `ResolveBilling` function type.
|
|
13
|
+
*/
|
|
14
|
+
import type { AuthContext, BillingSessionView, Credential, ResourceCoordinates } from "../auth/types.js";
|
|
15
|
+
export type BillingMap = Record<string, string>;
|
|
16
|
+
/** Final wire-format header map sent to the upstream gateway. */
|
|
17
|
+
export type BillingHeaders = Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Result of a single billing-attribution fetch. The seam's own type — a
|
|
20
|
+
* concrete resolver's richer result (e.g. a generic upstream envelope)
|
|
21
|
+
* structurally satisfies it. The failure branch carries what the resolver
|
|
22
|
+
* needs to raise a `BillingResolutionError`.
|
|
23
|
+
*/
|
|
24
|
+
export type BillingFetchResult = {
|
|
25
|
+
ok: true;
|
|
26
|
+
data: BillingMap;
|
|
27
|
+
} | {
|
|
28
|
+
ok: false;
|
|
29
|
+
status: number;
|
|
30
|
+
error: {
|
|
31
|
+
error: string;
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The minimal session view a resolver reads. The cached map is keyed by
|
|
37
|
+
* `(user, resourceType, resourceId)` (from `identity`/`scope` on
|
|
38
|
+
* `BillingSessionView`); header assembly additionally consumes
|
|
39
|
+
* `provenance`/`runFrame` (per-call). The fetch resolves the credential
|
|
40
|
+
* + org via `getAuth(session)`, so only the opaque `auth` is needed here —
|
|
41
|
+
* `AgentSession` structurally satisfies it.
|
|
42
|
+
*/
|
|
43
|
+
export interface ResolvableSession extends BillingSessionView {
|
|
44
|
+
readonly auth: AuthContext;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the FINAL wire headers at the call site. The raw attribution map is
|
|
48
|
+
* fetched once per `(user, resource)` and cached; the per-call identity tags
|
|
49
|
+
* (`agentId`/`runId`/`stepId`) vary within that key, so header assembly runs
|
|
50
|
+
* POST-CACHE on every call against the live `session` — assembled headers are
|
|
51
|
+
* never cached.
|
|
52
|
+
*/
|
|
53
|
+
export type ResolveBilling = (session: ResolvableSession) => Promise<BillingHeaders>;
|
|
54
|
+
/**
|
|
55
|
+
* The upstream call seam — overridable in tests with a fake. A concrete
|
|
56
|
+
* resolver resolves the attribution map for the given credential/org/coords.
|
|
57
|
+
*/
|
|
58
|
+
export type BillingFetcher = (credential: Credential, orgId: string, coords: ResourceCoordinates) => Promise<BillingFetchResult>;
|
|
59
|
+
/** A billing-resolution failure (e.g. 403/404). Fails the LLM call. */
|
|
60
|
+
export declare class BillingResolutionError extends Error {
|
|
61
|
+
readonly status: number;
|
|
62
|
+
readonly code: string;
|
|
63
|
+
constructor(status: number, code: string, message: string);
|
|
64
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing attribution seam.
|
|
3
|
+
*
|
|
4
|
+
* Defines the `ResolveBilling` contract the provider calls at the
|
|
5
|
+
* LLM/embedding call site, plus the session view and fetcher types a
|
|
6
|
+
* concrete resolver implements. The provider calls `resolveBilling(session)`
|
|
7
|
+
* just before the wire call; read-only routes never call it, so they never
|
|
8
|
+
* incur a billing round-trip.
|
|
9
|
+
*
|
|
10
|
+
* This module is the vendor-neutral seam: it declares types only. A concrete
|
|
11
|
+
* resolver (managed/upstream-backed or noop) supplies the fetch + assembly
|
|
12
|
+
* behavior behind the `ResolveBilling` function type.
|
|
13
|
+
*/
|
|
14
|
+
/** A billing-resolution failure (e.g. 403/404). Fails the LLM call. */
|
|
15
|
+
export class BillingResolutionError extends Error {
|
|
16
|
+
status;
|
|
17
|
+
code;
|
|
18
|
+
constructor(status, code, message) {
|
|
19
|
+
super(`Billing resolution failed (${status} ${code}): ${message}`);
|
|
20
|
+
this.status = status;
|
|
21
|
+
this.code = code;
|
|
22
|
+
this.name = "BillingResolutionError";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RunCharge` — the run-level billing-bracket seam.
|
|
3
|
+
*
|
|
4
|
+
* `executeAnalysis` opens a running charge at init and closes it on the
|
|
5
|
+
* terminal path with one of four reasons. A managed embedder wires an
|
|
6
|
+
* external running-charge bracket; OSS wires a no-op. The harness only ever sees this
|
|
7
|
+
* interface — the body brackets the run, the embedder owns the ledger.
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentSession } from "../auth/types.js";
|
|
10
|
+
export interface RunCharge {
|
|
11
|
+
/** Open the run's running charge at init. */
|
|
12
|
+
open(args: {
|
|
13
|
+
analysisId: string;
|
|
14
|
+
runId: string;
|
|
15
|
+
session: AgentSession;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
/** Close the run's running charge with one of four terminal reasons. */
|
|
18
|
+
close(args: {
|
|
19
|
+
analysisId: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
reason: "ok" | "error" | "canceled" | "budget_exceeded";
|
|
22
|
+
session: AgentSession;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RunCharge` — the run-level billing-bracket seam.
|
|
3
|
+
*
|
|
4
|
+
* `executeAnalysis` opens a running charge at init and closes it on the
|
|
5
|
+
* terminal path with one of four reasons. A managed embedder wires an
|
|
6
|
+
* external running-charge bracket; OSS wires a no-op. The harness only ever sees this
|
|
7
|
+
* interface — the body brackets the run, the embedder owns the ledger.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource limits — ported from orchestrator/src/config/resource-limits.ts.
|
|
3
|
+
*
|
|
4
|
+
* Validates sandbox resource requests against cluster maximums.
|
|
5
|
+
* Used by K8sSandbox.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
export declare const GpuSpecSchema: z.ZodObject<{
|
|
9
|
+
count: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const ResourceSpecSchema: z.ZodObject<{
|
|
12
|
+
cpu: z.ZodNumber;
|
|
13
|
+
memoryGb: z.ZodNumber;
|
|
14
|
+
gpu: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
count: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const ResourceLimitsSchema: z.ZodObject<{
|
|
19
|
+
maxCpu: z.ZodNumber;
|
|
20
|
+
maxMemoryGb: z.ZodNumber;
|
|
21
|
+
maxGpuCount: z.ZodNumber;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const MachineBudgetSchema: z.ZodObject<{
|
|
24
|
+
cpu: z.ZodNumber;
|
|
25
|
+
memoryGb: z.ZodNumber;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const ResourcePolicySchema: z.ZodObject<{
|
|
28
|
+
perStep: z.ZodObject<{
|
|
29
|
+
maxCpu: z.ZodNumber;
|
|
30
|
+
maxMemoryGb: z.ZodNumber;
|
|
31
|
+
maxGpuCount: z.ZodNumber;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
budget: z.ZodObject<{
|
|
34
|
+
cpu: z.ZodNumber;
|
|
35
|
+
memoryGb: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
ephemeral: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
cpu: z.ZodNumber;
|
|
39
|
+
memoryGb: z.ZodNumber;
|
|
40
|
+
gpu: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
count: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type GpuSpec = z.infer<typeof GpuSpecSchema>;
|
|
46
|
+
export type ResourceSpec = z.infer<typeof ResourceSpecSchema>;
|
|
47
|
+
export type ResourceLimits = z.infer<typeof ResourceLimitsSchema>;
|
|
48
|
+
export type MachineBudget = z.infer<typeof MachineBudgetSchema>;
|
|
49
|
+
export type ResourcePolicy = z.infer<typeof ResourcePolicySchema>;
|
|
50
|
+
/** Default LLM-turn budget for a sandbox agent step. Covers simple,
|
|
51
|
+
* standard, and complex analyses — extra headroom on simple steps is
|
|
52
|
+
* cheaper than truncating complex ones. */
|
|
53
|
+
export declare const DEFAULT_SANDBOX_MAX_STEPS = 75;
|
|
54
|
+
export declare class ResourceLimitsConfigError extends Error {
|
|
55
|
+
constructor(message: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Load resource limits from environment variables.
|
|
59
|
+
*
|
|
60
|
+
* Required: SANDBOX_MAX_CPU, SANDBOX_MAX_MEMORY_GB, SANDBOX_MAX_GPU_COUNT
|
|
61
|
+
* @throws ResourceLimitsConfigError if configuration is invalid
|
|
62
|
+
*/
|
|
63
|
+
export declare function loadResourceLimits(): ResourceLimits;
|
|
64
|
+
/**
|
|
65
|
+
* Validate an embedder-supplied resource policy.
|
|
66
|
+
*
|
|
67
|
+
* Invariant: a maximum-size step must be admissible against an empty budget,
|
|
68
|
+
* so the per-step ceilings may not exceed the machine budget.
|
|
69
|
+
* @throws ResourceLimitsConfigError if the policy is invalid
|
|
70
|
+
*/
|
|
71
|
+
export declare function parseResourcePolicy(input: unknown): ResourcePolicy;
|
|
72
|
+
/**
|
|
73
|
+
* Clamp a resource request to cluster limits (cap, don't throw).
|
|
74
|
+
* Returns a new spec with values capped to the configured maximums.
|
|
75
|
+
*/
|
|
76
|
+
export declare function clampResources(spec: ResourceSpec, limits: ResourceLimits): ResourceSpec;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource limits — ported from orchestrator/src/config/resource-limits.ts.
|
|
3
|
+
*
|
|
4
|
+
* Validates sandbox resource requests against cluster maximums.
|
|
5
|
+
* Used by K8sSandbox.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
// ── Schemas ─────────────────────────────────────────────────────────
|
|
9
|
+
export const GpuSpecSchema = z.object({
|
|
10
|
+
count: z.number().int().positive(),
|
|
11
|
+
});
|
|
12
|
+
export const ResourceSpecSchema = z.object({
|
|
13
|
+
cpu: z.number().positive(),
|
|
14
|
+
memoryGb: z.number().positive(),
|
|
15
|
+
gpu: GpuSpecSchema.optional(),
|
|
16
|
+
});
|
|
17
|
+
export const ResourceLimitsSchema = z.object({
|
|
18
|
+
maxCpu: z.number().positive(),
|
|
19
|
+
maxMemoryGb: z.number().positive(),
|
|
20
|
+
maxGpuCount: z.number().int().nonnegative(),
|
|
21
|
+
});
|
|
22
|
+
export const MachineBudgetSchema = z.object({
|
|
23
|
+
cpu: z.number().positive(),
|
|
24
|
+
memoryGb: z.number().positive(),
|
|
25
|
+
});
|
|
26
|
+
export const ResourcePolicySchema = z.object({
|
|
27
|
+
perStep: ResourceLimitsSchema,
|
|
28
|
+
budget: MachineBudgetSchema,
|
|
29
|
+
ephemeral: ResourceSpecSchema.optional(),
|
|
30
|
+
});
|
|
31
|
+
/** Default LLM-turn budget for a sandbox agent step. Covers simple,
|
|
32
|
+
* standard, and complex analyses — extra headroom on simple steps is
|
|
33
|
+
* cheaper than truncating complex ones. */
|
|
34
|
+
export const DEFAULT_SANDBOX_MAX_STEPS = 75;
|
|
35
|
+
// ── Error ───────────────────────────────────────────────────────────
|
|
36
|
+
export class ResourceLimitsConfigError extends Error {
|
|
37
|
+
constructor(message) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = "ResourceLimitsConfigError";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// ── Parsing ─────────────────────────────────────────────────────────
|
|
43
|
+
function parsePositiveNumber(name, value) {
|
|
44
|
+
if (!value) {
|
|
45
|
+
throw new ResourceLimitsConfigError(`${name} environment variable is required`);
|
|
46
|
+
}
|
|
47
|
+
const num = Number(value);
|
|
48
|
+
if (isNaN(num) || num <= 0) {
|
|
49
|
+
throw new ResourceLimitsConfigError(`${name} must be a positive number, got: ${value}`);
|
|
50
|
+
}
|
|
51
|
+
return num;
|
|
52
|
+
}
|
|
53
|
+
function parseNonNegativeInt(name, value) {
|
|
54
|
+
if (!value) {
|
|
55
|
+
throw new ResourceLimitsConfigError(`${name} environment variable is required`);
|
|
56
|
+
}
|
|
57
|
+
const num = Number(value);
|
|
58
|
+
if (isNaN(num) || num < 0) {
|
|
59
|
+
throw new ResourceLimitsConfigError(`${name} must be a non-negative number, got: ${value}`);
|
|
60
|
+
}
|
|
61
|
+
if (!Number.isInteger(num)) {
|
|
62
|
+
throw new ResourceLimitsConfigError(`${name} must be an integer, got: ${value}`);
|
|
63
|
+
}
|
|
64
|
+
return num;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Load resource limits from environment variables.
|
|
68
|
+
*
|
|
69
|
+
* Required: SANDBOX_MAX_CPU, SANDBOX_MAX_MEMORY_GB, SANDBOX_MAX_GPU_COUNT
|
|
70
|
+
* @throws ResourceLimitsConfigError if configuration is invalid
|
|
71
|
+
*/
|
|
72
|
+
export function loadResourceLimits() {
|
|
73
|
+
const maxCpu = parsePositiveNumber("SANDBOX_MAX_CPU", process.env.SANDBOX_MAX_CPU);
|
|
74
|
+
const maxMemoryGb = parsePositiveNumber("SANDBOX_MAX_MEMORY_GB", process.env.SANDBOX_MAX_MEMORY_GB);
|
|
75
|
+
const maxGpuCount = parseNonNegativeInt("SANDBOX_MAX_GPU_COUNT", process.env.SANDBOX_MAX_GPU_COUNT);
|
|
76
|
+
const limits = { maxCpu, maxMemoryGb, maxGpuCount };
|
|
77
|
+
const result = ResourceLimitsSchema.safeParse(limits);
|
|
78
|
+
if (!result.success) {
|
|
79
|
+
throw new ResourceLimitsConfigError(`Invalid resource limits configuration: ${result.error.message}`);
|
|
80
|
+
}
|
|
81
|
+
return result.data;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Validate an embedder-supplied resource policy.
|
|
85
|
+
*
|
|
86
|
+
* Invariant: a maximum-size step must be admissible against an empty budget,
|
|
87
|
+
* so the per-step ceilings may not exceed the machine budget.
|
|
88
|
+
* @throws ResourceLimitsConfigError if the policy is invalid
|
|
89
|
+
*/
|
|
90
|
+
export function parseResourcePolicy(input) {
|
|
91
|
+
const result = ResourcePolicySchema.safeParse(input);
|
|
92
|
+
if (!result.success) {
|
|
93
|
+
throw new ResourceLimitsConfigError(`Invalid resource policy: ${result.error.message}`);
|
|
94
|
+
}
|
|
95
|
+
const policy = result.data;
|
|
96
|
+
if (policy.perStep.maxCpu > policy.budget.cpu) {
|
|
97
|
+
throw new ResourceLimitsConfigError(`perStep.maxCpu (${policy.perStep.maxCpu}) exceeds budget.cpu (${policy.budget.cpu}) — a maximum-size step could never be scheduled`);
|
|
98
|
+
}
|
|
99
|
+
if (policy.perStep.maxMemoryGb > policy.budget.memoryGb) {
|
|
100
|
+
throw new ResourceLimitsConfigError(`perStep.maxMemoryGb (${policy.perStep.maxMemoryGb}) exceeds budget.memoryGb (${policy.budget.memoryGb}) — a maximum-size step could never be scheduled`);
|
|
101
|
+
}
|
|
102
|
+
return policy;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Clamp a resource request to cluster limits (cap, don't throw).
|
|
106
|
+
* Returns a new spec with values capped to the configured maximums.
|
|
107
|
+
*/
|
|
108
|
+
export function clampResources(spec, limits) {
|
|
109
|
+
return {
|
|
110
|
+
cpu: Math.min(spec.cpu, limits.maxCpu),
|
|
111
|
+
memoryGb: Math.min(spec.memoryGb, limits.maxMemoryGb),
|
|
112
|
+
...(spec.gpu && {
|
|
113
|
+
gpu: { count: Math.min(spec.gpu.count, limits.maxGpuCount) },
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analogy Report — produced by the `generateAnalogyReport` tool. Single
|
|
3
|
+
* source of truth for the JSON envelope returned to the conversation
|
|
4
|
+
* agent. Both Cortex and the frontend import from this module.
|
|
5
|
+
*
|
|
6
|
+
* Coverage discipline mirrors `target-dossier.ts`: every analogy carries a
|
|
7
|
+
* `coverage` discriminator. Only the extraction phase is allowed to throw;
|
|
8
|
+
* search-phase failures surface via `coverage: "search_failed" |
|
|
9
|
+
* "queried_no_data" | "not_loaded"`.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
export declare const AnalogyCoverageSchema: z.ZodEnum<{
|
|
13
|
+
available: "available";
|
|
14
|
+
queried_no_data: "queried_no_data";
|
|
15
|
+
search_failed: "search_failed";
|
|
16
|
+
not_loaded: "not_loaded";
|
|
17
|
+
}>;
|
|
18
|
+
export type AnalogyCoverage = z.infer<typeof AnalogyCoverageSchema>;
|
|
19
|
+
export declare const AnalogyReportSchema: z.ZodObject<{
|
|
20
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
21
|
+
problemSummary: z.ZodString;
|
|
22
|
+
problemObjects: z.ZodArray<z.ZodObject<{
|
|
23
|
+
name: z.ZodString;
|
|
24
|
+
role: z.ZodString;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
problemRelations: z.ZodArray<z.ZodString>;
|
|
27
|
+
keyTerms: z.ZodArray<z.ZodString>;
|
|
28
|
+
analogies: z.ZodArray<z.ZodObject<{
|
|
29
|
+
targetDomain: z.ZodString;
|
|
30
|
+
analogyTitle: z.ZodString;
|
|
31
|
+
objectMappings: z.ZodArray<z.ZodObject<{
|
|
32
|
+
source: z.ZodString;
|
|
33
|
+
target: z.ZodString;
|
|
34
|
+
rationale: z.ZodString;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
sharedRelations: z.ZodString;
|
|
37
|
+
coverage: z.ZodEnum<{
|
|
38
|
+
available: "available";
|
|
39
|
+
queried_no_data: "queried_no_data";
|
|
40
|
+
search_failed: "search_failed";
|
|
41
|
+
not_loaded: "not_loaded";
|
|
42
|
+
}>;
|
|
43
|
+
solutions: z.ZodArray<z.ZodObject<{
|
|
44
|
+
title: z.ZodString;
|
|
45
|
+
sourceDomain: z.ZodString;
|
|
46
|
+
description: z.ZodString;
|
|
47
|
+
keyConcepts: z.ZodArray<z.ZodString>;
|
|
48
|
+
relevance: z.ZodString;
|
|
49
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
50
|
+
url: z.ZodString;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
githubRepos: z.ZodArray<z.ZodObject<{
|
|
54
|
+
url: z.ZodString;
|
|
55
|
+
description: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const AnalogyReportErrorSchema: z.ZodObject<{
|
|
61
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
62
|
+
error: z.ZodObject<{
|
|
63
|
+
kind: z.ZodEnum<{
|
|
64
|
+
"extraction-failed": "extraction-failed";
|
|
65
|
+
}>;
|
|
66
|
+
message: z.ZodString;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export declare const AnalogicalReasonerOutputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
70
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
71
|
+
problemSummary: z.ZodString;
|
|
72
|
+
problemObjects: z.ZodArray<z.ZodObject<{
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
role: z.ZodString;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
problemRelations: z.ZodArray<z.ZodString>;
|
|
77
|
+
keyTerms: z.ZodArray<z.ZodString>;
|
|
78
|
+
analogies: z.ZodArray<z.ZodObject<{
|
|
79
|
+
targetDomain: z.ZodString;
|
|
80
|
+
analogyTitle: z.ZodString;
|
|
81
|
+
objectMappings: z.ZodArray<z.ZodObject<{
|
|
82
|
+
source: z.ZodString;
|
|
83
|
+
target: z.ZodString;
|
|
84
|
+
rationale: z.ZodString;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
sharedRelations: z.ZodString;
|
|
87
|
+
coverage: z.ZodEnum<{
|
|
88
|
+
available: "available";
|
|
89
|
+
queried_no_data: "queried_no_data";
|
|
90
|
+
search_failed: "search_failed";
|
|
91
|
+
not_loaded: "not_loaded";
|
|
92
|
+
}>;
|
|
93
|
+
solutions: z.ZodArray<z.ZodObject<{
|
|
94
|
+
title: z.ZodString;
|
|
95
|
+
sourceDomain: z.ZodString;
|
|
96
|
+
description: z.ZodString;
|
|
97
|
+
keyConcepts: z.ZodArray<z.ZodString>;
|
|
98
|
+
relevance: z.ZodString;
|
|
99
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
100
|
+
url: z.ZodString;
|
|
101
|
+
title: z.ZodString;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
githubRepos: z.ZodArray<z.ZodObject<{
|
|
104
|
+
url: z.ZodString;
|
|
105
|
+
description: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
111
|
+
error: z.ZodObject<{
|
|
112
|
+
kind: z.ZodEnum<{
|
|
113
|
+
"extraction-failed": "extraction-failed";
|
|
114
|
+
}>;
|
|
115
|
+
message: z.ZodString;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
}, z.core.$strip>]>;
|
|
118
|
+
export type AnalogyReport = z.infer<typeof AnalogyReportSchema>;
|
|
119
|
+
export type AnalogyReportError = z.infer<typeof AnalogyReportErrorSchema>;
|
|
120
|
+
export type AnalogicalReasonerOutput = z.infer<typeof AnalogicalReasonerOutputSchema>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analogy Report — produced by the `generateAnalogyReport` tool. Single
|
|
3
|
+
* source of truth for the JSON envelope returned to the conversation
|
|
4
|
+
* agent. Both Cortex and the frontend import from this module.
|
|
5
|
+
*
|
|
6
|
+
* Coverage discipline mirrors `target-dossier.ts`: every analogy carries a
|
|
7
|
+
* `coverage` discriminator. Only the extraction phase is allowed to throw;
|
|
8
|
+
* search-phase failures surface via `coverage: "search_failed" |
|
|
9
|
+
* "queried_no_data" | "not_loaded"`.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
export const AnalogyCoverageSchema = z.enum(["available", "queried_no_data", "search_failed", "not_loaded"]);
|
|
13
|
+
export const AnalogyReportSchema = z.object({
|
|
14
|
+
schemaVersion: z.literal("1"),
|
|
15
|
+
problemSummary: z.string(),
|
|
16
|
+
problemObjects: z.array(z.object({ name: z.string(), role: z.string() })),
|
|
17
|
+
problemRelations: z.array(z.string()),
|
|
18
|
+
keyTerms: z.array(z.string()),
|
|
19
|
+
analogies: z.array(z.object({
|
|
20
|
+
targetDomain: z.string(),
|
|
21
|
+
analogyTitle: z.string(),
|
|
22
|
+
objectMappings: z.array(z.object({
|
|
23
|
+
source: z.string(),
|
|
24
|
+
target: z.string(),
|
|
25
|
+
rationale: z.string(),
|
|
26
|
+
})),
|
|
27
|
+
sharedRelations: z.string(),
|
|
28
|
+
coverage: AnalogyCoverageSchema,
|
|
29
|
+
solutions: z.array(z.object({
|
|
30
|
+
title: z.string(),
|
|
31
|
+
sourceDomain: z.string(),
|
|
32
|
+
description: z.string(),
|
|
33
|
+
keyConcepts: z.array(z.string()),
|
|
34
|
+
relevance: z.string(),
|
|
35
|
+
sources: z.array(z.object({ url: z.string().url(), title: z.string() })),
|
|
36
|
+
githubRepos: z.array(z.object({
|
|
37
|
+
url: z.string().url(),
|
|
38
|
+
description: z.string().optional(),
|
|
39
|
+
})),
|
|
40
|
+
})),
|
|
41
|
+
})),
|
|
42
|
+
});
|
|
43
|
+
export const AnalogyReportErrorSchema = z.object({
|
|
44
|
+
schemaVersion: z.literal("1"),
|
|
45
|
+
error: z.object({
|
|
46
|
+
kind: z.enum(["extraction-failed"]),
|
|
47
|
+
message: z.string(),
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
export const AnalogicalReasonerOutputSchema = z.union([AnalogyReportSchema, AnalogyReportErrorSchema]);
|