@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,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read_file tool — reads a workspace file via the workspace read seam.
|
|
3
|
+
*
|
|
4
|
+
* Dependency-bearing factory (see the harness-durable-runtime spec): captures the `WorkspaceFilesystem`
|
|
5
|
+
* at construction. Expected outcomes are data variants — a missing path is
|
|
6
|
+
* `not_found`, a path that escapes the analysis tree is `out_of_scope`, an
|
|
7
|
+
* oversize read is `truncated`. Only unexpected I/O errors throw; the loop
|
|
8
|
+
* wraps them as `is_error`.
|
|
9
|
+
*/
|
|
10
|
+
import type { WorkspaceFilesystem } from "../../workspace/filesystem.js";
|
|
11
|
+
type ReadFileOutput = {
|
|
12
|
+
status: "invalid_input";
|
|
13
|
+
path: string;
|
|
14
|
+
reason: string;
|
|
15
|
+
} | {
|
|
16
|
+
status: "ok";
|
|
17
|
+
path: string;
|
|
18
|
+
mode: "head" | "tail" | "full";
|
|
19
|
+
content: string;
|
|
20
|
+
} | {
|
|
21
|
+
status: "truncated";
|
|
22
|
+
path: string;
|
|
23
|
+
mode: "head" | "tail" | "full";
|
|
24
|
+
content: string;
|
|
25
|
+
totalSize: number;
|
|
26
|
+
returnedBytes: number;
|
|
27
|
+
} | {
|
|
28
|
+
status: "not_found";
|
|
29
|
+
path: string;
|
|
30
|
+
} | {
|
|
31
|
+
status: "out_of_scope";
|
|
32
|
+
path: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function createReadFileTool(fs: WorkspaceFilesystem, workingDir?: string): import("../define-tool.js").Tool<{
|
|
35
|
+
path: string;
|
|
36
|
+
headLines?: number | undefined;
|
|
37
|
+
tailLines?: number | undefined;
|
|
38
|
+
}, ReadFileOutput>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read_file tool — reads a workspace file via the workspace read seam.
|
|
3
|
+
*
|
|
4
|
+
* Dependency-bearing factory (see the harness-durable-runtime spec): captures the `WorkspaceFilesystem`
|
|
5
|
+
* at construction. Expected outcomes are data variants — a missing path is
|
|
6
|
+
* `not_found`, a path that escapes the analysis tree is `out_of_scope`, an
|
|
7
|
+
* oversize read is `truncated`. Only unexpected I/O errors throw; the loop
|
|
8
|
+
* wraps them as `is_error`.
|
|
9
|
+
*/
|
|
10
|
+
import { ok } from "neverthrow";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { defineTool } from "../define-tool.js";
|
|
13
|
+
import { unwrapOrThrow } from "../../lib/result.js";
|
|
14
|
+
/** Default cap — large enough for typical CSV/MD/JSON, small enough to keep tool results out of context-blowing territory. */
|
|
15
|
+
const DEFAULT_MAX_BYTES = 256 * 1024;
|
|
16
|
+
const ReadFileInputSchema = z.object({
|
|
17
|
+
path: z
|
|
18
|
+
.string()
|
|
19
|
+
.min(1)
|
|
20
|
+
.describe("Workspace path. Relative paths resolve against your working directory; " +
|
|
21
|
+
"an absolute '/<analysisId>/...' path is resolved against the analysis " +
|
|
22
|
+
"root (use absolute to read input data, the data profile, or other " +
|
|
23
|
+
"steps' outputs)."),
|
|
24
|
+
headLines: z
|
|
25
|
+
.number()
|
|
26
|
+
.int()
|
|
27
|
+
.min(1)
|
|
28
|
+
.max(10_000)
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Read only the first N lines (head). Use for inspecting CSV/TSV " +
|
|
31
|
+
"headers, profile summaries, or the top of any large file. Mutually " +
|
|
32
|
+
"exclusive with tailLines."),
|
|
33
|
+
tailLines: z
|
|
34
|
+
.number()
|
|
35
|
+
.int()
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(10_000)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Read only the last N complete lines (tail). Use for logs and any " + "file where the tail is what matters. Mutually exclusive with headLines."),
|
|
40
|
+
});
|
|
41
|
+
export function createReadFileTool(fs, workingDir) {
|
|
42
|
+
return defineTool({
|
|
43
|
+
id: "read_file",
|
|
44
|
+
description: "Read a workspace file: input data, prior-run outputs, current-run " +
|
|
45
|
+
"outputs, step summaries, run syntheses, or the data profile. Returns " +
|
|
46
|
+
"the file content as UTF-8 text. Output is capped at " +
|
|
47
|
+
`${DEFAULT_MAX_BYTES} bytes; pass headLines or tailLines to read a ` +
|
|
48
|
+
"specific window of a large file (typical for bio CSV/TSV/log files). " +
|
|
49
|
+
"Oversize reads come back truncated with a marker. Missing paths and " +
|
|
50
|
+
"paths outside the analysis tree return a data variant — not an error.",
|
|
51
|
+
inputSchema: ReadFileInputSchema,
|
|
52
|
+
execute: async ({ path, headLines, tailLines }, ctx) => {
|
|
53
|
+
if (headLines !== undefined && tailLines !== undefined) {
|
|
54
|
+
return ok({
|
|
55
|
+
status: "invalid_input",
|
|
56
|
+
path,
|
|
57
|
+
reason: "headLines and tailLines are mutually exclusive",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const result = unwrapOrThrow(await fs.readFile({
|
|
61
|
+
session: ctx.session,
|
|
62
|
+
path,
|
|
63
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
64
|
+
headLines,
|
|
65
|
+
tailLines,
|
|
66
|
+
workingDir,
|
|
67
|
+
}));
|
|
68
|
+
const mode = headLines !== undefined ? "head" : tailLines !== undefined ? "tail" : "full";
|
|
69
|
+
switch (result.kind) {
|
|
70
|
+
case "ok":
|
|
71
|
+
return ok({
|
|
72
|
+
status: "ok",
|
|
73
|
+
path,
|
|
74
|
+
mode,
|
|
75
|
+
content: result.content.toString("utf8"),
|
|
76
|
+
});
|
|
77
|
+
case "truncated":
|
|
78
|
+
return ok({
|
|
79
|
+
status: "truncated",
|
|
80
|
+
path,
|
|
81
|
+
mode,
|
|
82
|
+
content: result.content.toString("utf8"),
|
|
83
|
+
totalSize: result.totalSize,
|
|
84
|
+
returnedBytes: result.content.length,
|
|
85
|
+
});
|
|
86
|
+
case "not_found":
|
|
87
|
+
return ok({ status: "not_found", path });
|
|
88
|
+
case "out_of_scope":
|
|
89
|
+
return ok({ status: "out_of_scope", path });
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-stream byte caps for sandbox `ExecResult`s. The mutate-surface tools
|
|
3
|
+
* (`execute_command`, `write_file`, `edit_file`) all return a tool result
|
|
4
|
+
* derived from one `ExecResult`; they share one cap so the truncation
|
|
5
|
+
* shape is uniform across the surface and the cap can be tuned in one
|
|
6
|
+
* place.
|
|
7
|
+
*
|
|
8
|
+
* The cap is well below the loop's overall result budget so a chatty
|
|
9
|
+
* command cannot blow the context window even when stdout AND stderr both
|
|
10
|
+
* cap out at the limit.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExecResult } from "../../sandbox/types.js";
|
|
13
|
+
/** Per-stream cap. 8 KiB — multi-KB but well under the loop result budget. */
|
|
14
|
+
export declare const EXEC_STREAM_BYTE_CAP: number;
|
|
15
|
+
export interface BoundedStream {
|
|
16
|
+
readonly content: string;
|
|
17
|
+
readonly truncated: boolean;
|
|
18
|
+
readonly totalLength: number;
|
|
19
|
+
readonly returnedBytes: number;
|
|
20
|
+
}
|
|
21
|
+
export interface BoundedExecResult {
|
|
22
|
+
readonly execId: string;
|
|
23
|
+
readonly exitCode: number | null;
|
|
24
|
+
readonly stdout: string;
|
|
25
|
+
readonly stderr: string;
|
|
26
|
+
readonly stdoutTruncated: boolean;
|
|
27
|
+
readonly stderrTruncated: boolean;
|
|
28
|
+
readonly stdoutTotalLength: number;
|
|
29
|
+
readonly stderrTotalLength: number;
|
|
30
|
+
readonly durationMs: number | null;
|
|
31
|
+
readonly timedOut: boolean;
|
|
32
|
+
readonly syntheticFailure?: {
|
|
33
|
+
readonly reason: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Apply per-stream truncation to an `ExecResult`. `exitCode`, `durationMs`,
|
|
38
|
+
* `timedOut`, and `syntheticFailure` pass through unchanged regardless of
|
|
39
|
+
* stream truncation — the discriminants the loop and the model rely on are
|
|
40
|
+
* preserved.
|
|
41
|
+
*/
|
|
42
|
+
export declare function boundExecResult(result: ExecResult, cap?: number): BoundedExecResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-stream byte caps for sandbox `ExecResult`s. The mutate-surface tools
|
|
3
|
+
* (`execute_command`, `write_file`, `edit_file`) all return a tool result
|
|
4
|
+
* derived from one `ExecResult`; they share one cap so the truncation
|
|
5
|
+
* shape is uniform across the surface and the cap can be tuned in one
|
|
6
|
+
* place.
|
|
7
|
+
*
|
|
8
|
+
* The cap is well below the loop's overall result budget so a chatty
|
|
9
|
+
* command cannot blow the context window even when stdout AND stderr both
|
|
10
|
+
* cap out at the limit.
|
|
11
|
+
*/
|
|
12
|
+
/** Per-stream cap. 8 KiB — multi-KB but well under the loop result budget. */
|
|
13
|
+
export const EXEC_STREAM_BYTE_CAP = 8 * 1024;
|
|
14
|
+
function boundStream(stream, cap = EXEC_STREAM_BYTE_CAP) {
|
|
15
|
+
const totalLength = Buffer.byteLength(stream, "utf8");
|
|
16
|
+
if (totalLength <= cap) {
|
|
17
|
+
return { content: stream, truncated: false, totalLength, returnedBytes: totalLength };
|
|
18
|
+
}
|
|
19
|
+
const buf = Buffer.from(stream, "utf8").subarray(0, cap);
|
|
20
|
+
const content = buf.toString("utf8");
|
|
21
|
+
return {
|
|
22
|
+
content,
|
|
23
|
+
truncated: true,
|
|
24
|
+
totalLength,
|
|
25
|
+
returnedBytes: Buffer.byteLength(content, "utf8"),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Apply per-stream truncation to an `ExecResult`. `exitCode`, `durationMs`,
|
|
30
|
+
* `timedOut`, and `syntheticFailure` pass through unchanged regardless of
|
|
31
|
+
* stream truncation — the discriminants the loop and the model rely on are
|
|
32
|
+
* preserved.
|
|
33
|
+
*/
|
|
34
|
+
export function boundExecResult(result, cap = EXEC_STREAM_BYTE_CAP) {
|
|
35
|
+
const outStream = boundStream(result.stdout, cap);
|
|
36
|
+
const errStream = boundStream(result.stderr, cap);
|
|
37
|
+
return {
|
|
38
|
+
execId: result.execId,
|
|
39
|
+
exitCode: result.exitCode,
|
|
40
|
+
stdout: outStream.content,
|
|
41
|
+
stderr: errStream.content,
|
|
42
|
+
stdoutTruncated: outStream.truncated,
|
|
43
|
+
stderrTruncated: errStream.truncated,
|
|
44
|
+
stdoutTotalLength: outStream.totalLength,
|
|
45
|
+
stderrTotalLength: errStream.totalLength,
|
|
46
|
+
durationMs: result.durationMs,
|
|
47
|
+
timedOut: result.timedOut,
|
|
48
|
+
...(result.syntheticFailure ? { syntheticFailure: result.syntheticFailure } : {}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helper used by the three mutate tools to drive one sandbox exec
|
|
3
|
+
* through the `SandboxClient`. Centralises the submit/await pair, exec-id
|
|
4
|
+
* derivation, and intermediate-event forwarding so all three tools share
|
|
5
|
+
* one chokepoint — the contract `execute_command` makes structural is that
|
|
6
|
+
* `write_file` / `edit_file` are layered on top of it, not parallel side
|
|
7
|
+
* paths into sandbox-server.
|
|
8
|
+
*
|
|
9
|
+
* Not a registered tool — `defineTool` is called by the user-facing tools
|
|
10
|
+
* (`execute-command.ts`, `write-file.ts`, `edit-file.ts`) which wrap this.
|
|
11
|
+
*/
|
|
12
|
+
import type { SandboxClient } from "../../sandbox/client.js";
|
|
13
|
+
import type { ExecResult, SandboxRef } from "../../sandbox/types.js";
|
|
14
|
+
import type { EmitFn } from "../define-tool.js";
|
|
15
|
+
export interface RunExecArgs {
|
|
16
|
+
readonly sandboxClient: SandboxClient;
|
|
17
|
+
readonly sandbox: SandboxRef;
|
|
18
|
+
readonly execId: string;
|
|
19
|
+
readonly command: readonly string[];
|
|
20
|
+
readonly cwd?: string;
|
|
21
|
+
readonly env?: Record<string, string>;
|
|
22
|
+
readonly timeoutSeconds?: number;
|
|
23
|
+
readonly deadlineMs: number;
|
|
24
|
+
readonly emit: EmitFn;
|
|
25
|
+
/**
|
|
26
|
+
* Tag the active-sandbox registry row with this execId before awaiting, so
|
|
27
|
+
* the liveness watchdog can target the in-flight exec when the sandbox dies
|
|
28
|
+
* mid-command. Best-effort: a registry write failure must not fail the exec.
|
|
29
|
+
*/
|
|
30
|
+
readonly markExecActive?: (execId: string) => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare function runSandboxExec(args: RunExecArgs): Promise<ExecResult>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helper used by the three mutate tools to drive one sandbox exec
|
|
3
|
+
* through the `SandboxClient`. Centralises the submit/await pair, exec-id
|
|
4
|
+
* derivation, and intermediate-event forwarding so all three tools share
|
|
5
|
+
* one chokepoint — the contract `execute_command` makes structural is that
|
|
6
|
+
* `write_file` / `edit_file` are layered on top of it, not parallel side
|
|
7
|
+
* paths into sandbox-server.
|
|
8
|
+
*
|
|
9
|
+
* Not a registered tool — `defineTool` is called by the user-facing tools
|
|
10
|
+
* (`execute-command.ts`, `write-file.ts`, `edit-file.ts`) which wrap this.
|
|
11
|
+
*/
|
|
12
|
+
export async function runSandboxExec(args) {
|
|
13
|
+
const body = {
|
|
14
|
+
command: [...args.command],
|
|
15
|
+
execId: args.execId,
|
|
16
|
+
...(args.cwd === undefined ? {} : { cwd: args.cwd }),
|
|
17
|
+
...(args.env === undefined ? {} : { env: args.env }),
|
|
18
|
+
...(args.timeoutSeconds === undefined ? {} : { timeoutSeconds: args.timeoutSeconds }),
|
|
19
|
+
};
|
|
20
|
+
await args.sandboxClient.submitExec(args.sandbox, body);
|
|
21
|
+
if (args.markExecActive) {
|
|
22
|
+
try {
|
|
23
|
+
await args.markExecActive(args.execId);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Watchdog targeting is a backstop; the awaitExec deadline still bounds
|
|
27
|
+
// the exec if the registry tag never lands.
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return args.sandboxClient.awaitExec(args.sandbox, args.execId, (event) => args.emit({
|
|
31
|
+
type: "data-sandbox-event",
|
|
32
|
+
data: { execId: args.execId, event },
|
|
33
|
+
}), args.deadlineMs);
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* showFile tool — references existing analysis artifacts as a UI stream event.
|
|
3
|
+
*
|
|
4
|
+
* Emits a `data-file-reference` event carrying `{ title?, files: [{ path,
|
|
5
|
+
* runId?, caption? }] }`. Cortex does not resolve file metadata — the UI
|
|
6
|
+
* resolves `fileId`, `mimeType`, `size`, and presigned URLs against the
|
|
7
|
+
* artifact service at render time.
|
|
8
|
+
*
|
|
9
|
+
* The `id` is derived deterministically from the file group, so an identical
|
|
10
|
+
* re-emission carries the same id (downstream reconciliation handles dedup).
|
|
11
|
+
* The card payload is built by the shared `buildFileReferenceCardData`, so the
|
|
12
|
+
* live emit and the reconstruct-on-read path produce byte-identical cards.
|
|
13
|
+
*/
|
|
14
|
+
import { deriveRunId, fileGroupHash } from "../../memory/card-builders.js";
|
|
15
|
+
import { validatePath } from "../lib/path-validation.js";
|
|
16
|
+
type ShowFileOutput = {
|
|
17
|
+
shown: false;
|
|
18
|
+
reason: "invalid_path";
|
|
19
|
+
} | {
|
|
20
|
+
shown: true;
|
|
21
|
+
id: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const showFileTool: import("../define-tool.js").Tool<{
|
|
24
|
+
files: {
|
|
25
|
+
path: string;
|
|
26
|
+
caption?: string | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
title?: string | undefined;
|
|
29
|
+
}, ShowFileOutput>;
|
|
30
|
+
/** Exposed for tests. */
|
|
31
|
+
export declare const __testing: {
|
|
32
|
+
validatePath: typeof validatePath;
|
|
33
|
+
deriveRunId: typeof deriveRunId;
|
|
34
|
+
groupHash: typeof fileGroupHash;
|
|
35
|
+
MAX_FILES: number;
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* showFile tool — references existing analysis artifacts as a UI stream event.
|
|
3
|
+
*
|
|
4
|
+
* Emits a `data-file-reference` event carrying `{ title?, files: [{ path,
|
|
5
|
+
* runId?, caption? }] }`. Cortex does not resolve file metadata — the UI
|
|
6
|
+
* resolves `fileId`, `mimeType`, `size`, and presigned URLs against the
|
|
7
|
+
* artifact service at render time.
|
|
8
|
+
*
|
|
9
|
+
* The `id` is derived deterministically from the file group, so an identical
|
|
10
|
+
* re-emission carries the same id (downstream reconciliation handles dedup).
|
|
11
|
+
* The card payload is built by the shared `buildFileReferenceCardData`, so the
|
|
12
|
+
* live emit and the reconstruct-on-read path produce byte-identical cards.
|
|
13
|
+
*/
|
|
14
|
+
import { ok } from "neverthrow";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { buildFileReferenceCardData, deriveRunId, fileGroupHash, MAX_FILES } from "../../memory/card-builders.js";
|
|
17
|
+
import { defineTool } from "../define-tool.js";
|
|
18
|
+
import { validatePath } from "../lib/path-validation.js";
|
|
19
|
+
const ShowFileInputSchema = z.object({
|
|
20
|
+
title: z.string().optional().describe("Group heading shown above the card or gallery"),
|
|
21
|
+
files: z
|
|
22
|
+
.array(z.object({
|
|
23
|
+
path: z.string().describe("Analysis-rooted file path (e.g., 'runs/run-abc/step-1/figures/volcano.png')"),
|
|
24
|
+
caption: z.string().optional().describe("One-sentence context rendered beside this file"),
|
|
25
|
+
}))
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(MAX_FILES)
|
|
28
|
+
.describe(`1 to ${MAX_FILES} files; multiple files render as a gallery`),
|
|
29
|
+
});
|
|
30
|
+
export const showFileTool = defineTool({
|
|
31
|
+
id: "show_file",
|
|
32
|
+
description: "Display one or more existing analysis artifacts (images, CSVs, PDFs, notebooks, logs) in chat by path. " +
|
|
33
|
+
"Paths must be analysis-rooted (no leading slash, no `..`). Up to 10 files per call — multiple render as a gallery. " +
|
|
34
|
+
"Do NOT read a file and paste its bytes elsewhere; this tool references the file directly. " +
|
|
35
|
+
"File content is fetched when the user views the card — you do not need to provide it.",
|
|
36
|
+
inputSchema: ShowFileInputSchema,
|
|
37
|
+
execute: async (input, ctx) => {
|
|
38
|
+
const card = buildFileReferenceCardData(input);
|
|
39
|
+
// A malformed/traversal path yields no card — an expected outcome the model can self-correct
|
|
40
|
+
// (a data variant, not a thrown error). Zod already guarantees 1..MAX_FILES entries, so
|
|
41
|
+
// `invalid_path` is the only reason the builder returns null here.
|
|
42
|
+
if (card === null) {
|
|
43
|
+
return ok({ shown: false, reason: "invalid_path" });
|
|
44
|
+
}
|
|
45
|
+
await ctx.emit({
|
|
46
|
+
type: "data-file-reference",
|
|
47
|
+
source: ctx.session.provenance,
|
|
48
|
+
data: card,
|
|
49
|
+
});
|
|
50
|
+
return ok({ shown: true, id: card.id });
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
/** Exposed for tests. */
|
|
54
|
+
export const __testing = { validatePath, deriveRunId, groupHash: fileGroupHash, MAX_FILES };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* showPlan tool — references a stored plan by id.
|
|
3
|
+
*
|
|
4
|
+
* Validates that the plan exists and is scoped to the current analysis,
|
|
5
|
+
* then emits a `data-plan` event with the full plan content embedded so the
|
|
6
|
+
* UI can render it without a follow-up fetch.
|
|
7
|
+
*
|
|
8
|
+
* Dependency-bearing: the database `Pool` is captured by the factory
|
|
9
|
+
* (see the harness-durable-runtime spec). The analysis id is read from the request-scoped `Session`.
|
|
10
|
+
*/
|
|
11
|
+
import type { Pool } from "pg";
|
|
12
|
+
type ShowPlanOutput = {
|
|
13
|
+
shown: false;
|
|
14
|
+
reason: "plan_not_found";
|
|
15
|
+
} | {
|
|
16
|
+
shown: true;
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function createShowPlanTool(pool: Pool): import("../define-tool.js").Tool<{
|
|
20
|
+
planId: string;
|
|
21
|
+
title?: string | undefined;
|
|
22
|
+
}, ShowPlanOutput>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* showPlan tool — references a stored plan by id.
|
|
3
|
+
*
|
|
4
|
+
* Validates that the plan exists and is scoped to the current analysis,
|
|
5
|
+
* then emits a `data-plan` event with the full plan content embedded so the
|
|
6
|
+
* UI can render it without a follow-up fetch.
|
|
7
|
+
*
|
|
8
|
+
* Dependency-bearing: the database `Pool` is captured by the factory
|
|
9
|
+
* (see the harness-durable-runtime spec). The analysis id is read from the request-scoped `Session`.
|
|
10
|
+
*/
|
|
11
|
+
import { ok } from "neverthrow";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { buildPlanCardData } from "../../memory/card-builders.js";
|
|
14
|
+
import { scopeResource } from "../../auth/types.js";
|
|
15
|
+
import { unwrapOrThrow } from "../../lib/result.js";
|
|
16
|
+
import { defineTool } from "../define-tool.js";
|
|
17
|
+
const PLAN_ID_REGEX = /^pln-[a-f0-9]{8}$/;
|
|
18
|
+
export function createShowPlanTool(pool) {
|
|
19
|
+
return defineTool({
|
|
20
|
+
id: "show_plan",
|
|
21
|
+
description: "Display a previously generated plan in chat by its planId. " +
|
|
22
|
+
"Use when the user asks to see a plan again, or to reference a historical plan. " +
|
|
23
|
+
"Get planIds from `inspect-run` (each run carries its planId) or `generatePlan` (newly created). " +
|
|
24
|
+
"The plan content is embedded in the chat part so the UI renders it directly.",
|
|
25
|
+
inputSchema: z.object({
|
|
26
|
+
planId: z.string().regex(PLAN_ID_REGEX, "planId must match pln-<8hex>").describe("Plan ID from generatePlan or inspect-run"),
|
|
27
|
+
title: z.string().optional().describe("Optional display heading"),
|
|
28
|
+
}),
|
|
29
|
+
execute: async ({ planId, title }, ctx) => {
|
|
30
|
+
const resourceId = scopeResource(ctx.session.scope).resourceId;
|
|
31
|
+
// "Plan not found" / "plan no longer parses" are expected outcomes —
|
|
32
|
+
// discriminated data variants the model reasons about, not errors.
|
|
33
|
+
const card = unwrapOrThrow(await buildPlanCardData(pool, planId, resourceId, title));
|
|
34
|
+
if (!card)
|
|
35
|
+
return ok({ shown: false, reason: "plan_not_found" });
|
|
36
|
+
await ctx.emit({
|
|
37
|
+
type: "data-plan",
|
|
38
|
+
source: ctx.session.provenance,
|
|
39
|
+
data: card,
|
|
40
|
+
});
|
|
41
|
+
return ok({ shown: true, id: card.id });
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workspaceSearch tool — vector semantic search over the analysis workspace.
|
|
3
|
+
*
|
|
4
|
+
* Dependency-bearing factory (see the harness-durable-runtime spec): the pgvector `Pool` and the
|
|
5
|
+
* `EmbeddingProvider` are captured at construction; `execute` closes over
|
|
6
|
+
* them — no ambient lookups, no global pool accessor.
|
|
7
|
+
*
|
|
8
|
+
* The per-analysis index is the `search_{analysisId}` table written by the
|
|
9
|
+
* workflow's write-time indexing. A query embeds the search text and ranks
|
|
10
|
+
* rows by cosine similarity. "Nothing indexed yet" (the index table does not
|
|
11
|
+
* exist) is an expected outcome — an empty result list, not an error.
|
|
12
|
+
*/
|
|
13
|
+
import type { Pool } from "pg";
|
|
14
|
+
import type { EmbeddingProvider } from "../../providers/types.js";
|
|
15
|
+
export declare function createWorkspaceSearchTool(pool: Pool, embedding: EmbeddingProvider): import("../define-tool.js").Tool<{
|
|
16
|
+
query: string;
|
|
17
|
+
limit: number;
|
|
18
|
+
type?: "output" | "input" | "summary" | "synthesis" | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
results: {
|
|
21
|
+
id: string;
|
|
22
|
+
score: number;
|
|
23
|
+
metadata: unknown;
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workspaceSearch tool — vector semantic search over the analysis workspace.
|
|
3
|
+
*
|
|
4
|
+
* Dependency-bearing factory (see the harness-durable-runtime spec): the pgvector `Pool` and the
|
|
5
|
+
* `EmbeddingProvider` are captured at construction; `execute` closes over
|
|
6
|
+
* them — no ambient lookups, no global pool accessor.
|
|
7
|
+
*
|
|
8
|
+
* The per-analysis index is the `search_{analysisId}` table written by the
|
|
9
|
+
* workflow's write-time indexing. A query embeds the search text and ranks
|
|
10
|
+
* rows by cosine similarity. "Nothing indexed yet" (the index table does not
|
|
11
|
+
* exist) is an expected outcome — an empty result list, not an error.
|
|
12
|
+
*/
|
|
13
|
+
import { err, ok, okAsync } from "neverthrow";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { scopeResource } from "../../auth/types.js";
|
|
16
|
+
import { tryQuery } from "../../lib/db-result.js";
|
|
17
|
+
import { unwrapOrThrow } from "../../lib/result.js";
|
|
18
|
+
import { defineTool } from "../define-tool.js";
|
|
19
|
+
/** pgvector / Postgres "undefined_table" — the index has no rows indexed yet. */
|
|
20
|
+
const UNDEFINED_TABLE = "42P01";
|
|
21
|
+
/** True when a captured driver cause is the "undefined_table" SQLSTATE. */
|
|
22
|
+
function isUndefinedTable(cause) {
|
|
23
|
+
return !!cause && typeof cause === "object" && cause.code === UNDEFINED_TABLE;
|
|
24
|
+
}
|
|
25
|
+
function indexName(analysisId) {
|
|
26
|
+
const name = `search_${analysisId.replace(/-/g, "_")}`;
|
|
27
|
+
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) {
|
|
28
|
+
throw new Error(`workspaceSearch: unusable analysis id "${analysisId}"`);
|
|
29
|
+
}
|
|
30
|
+
return name;
|
|
31
|
+
}
|
|
32
|
+
export function createWorkspaceSearchTool(pool, embedding) {
|
|
33
|
+
return defineTool({
|
|
34
|
+
id: "workspace_search",
|
|
35
|
+
description: "Semantic search over the analysis workspace — input data, analysis " +
|
|
36
|
+
"outputs, step summaries, run syntheses, and the data profile. Returns " +
|
|
37
|
+
"ranked file paths with descriptions and metadata; read a file " +
|
|
38
|
+
"separately to see its contents. Optionally filter by entry type.",
|
|
39
|
+
inputSchema: z.object({
|
|
40
|
+
query: z.string().min(1).describe("What to search for, in natural language"),
|
|
41
|
+
type: z.enum(["input", "output", "summary", "synthesis"]).optional().describe("Restrict results to one workspace entry type"),
|
|
42
|
+
limit: z.number().int().min(1).max(50).default(8).describe("Maximum number of results to return"),
|
|
43
|
+
}),
|
|
44
|
+
execute: async ({ query, type, limit }, ctx) => {
|
|
45
|
+
const [vector] = unwrapOrThrow(await embedding.embed([query], ctx.session));
|
|
46
|
+
if (!vector)
|
|
47
|
+
return ok({ results: [] });
|
|
48
|
+
const table = indexName(scopeResource(ctx.session.scope).resourceId);
|
|
49
|
+
const literal = `[${vector.join(",")}]`;
|
|
50
|
+
const values = [literal, limit];
|
|
51
|
+
let filter = "";
|
|
52
|
+
if (type) {
|
|
53
|
+
values.push(type);
|
|
54
|
+
filter = `WHERE metadata->>'type' = $3`;
|
|
55
|
+
}
|
|
56
|
+
const rows = unwrapOrThrow(await tryQuery("workspaceSearch.query", async () => {
|
|
57
|
+
const result = await pool.query(`SELECT vector_id AS id,
|
|
58
|
+
1 - (embedding <=> $1::vector) AS score,
|
|
59
|
+
metadata
|
|
60
|
+
FROM "${table}"
|
|
61
|
+
${filter}
|
|
62
|
+
ORDER BY embedding <=> $1::vector
|
|
63
|
+
LIMIT $2`, values);
|
|
64
|
+
return result.rows;
|
|
65
|
+
}).orElse((e) =>
|
|
66
|
+
// "Nothing indexed yet" — the per-analysis index table does not
|
|
67
|
+
// exist. That is absence, not a failure: recover into ok([]).
|
|
68
|
+
isUndefinedTable(e.cause) ? okAsync([]) : err(e)));
|
|
69
|
+
return ok({
|
|
70
|
+
results: rows.map((r) => ({
|
|
71
|
+
id: r.id,
|
|
72
|
+
score: r.score,
|
|
73
|
+
metadata: r.metadata,
|
|
74
|
+
})),
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `write_file` — sandbox-gated workspace write, confined to the agent's
|
|
3
|
+
* writable working directory.
|
|
4
|
+
*
|
|
5
|
+
* A thin adapter over the `WorkspaceMutator` seam (see the harness-durable-runtime / harness-workspace-tools specs): the
|
|
6
|
+
* mutator owns resolve + confine + sandbox write + provenance. This tool only
|
|
7
|
+
* declares the input schema and forwards. `edit_file` rides the same seam.
|
|
8
|
+
*/
|
|
9
|
+
import type { WorkspaceMutator } from "./mutator.js";
|
|
10
|
+
export interface WriteFileDeps {
|
|
11
|
+
readonly mutator: WorkspaceMutator;
|
|
12
|
+
}
|
|
13
|
+
export declare function createWriteFileTool(deps: WriteFileDeps): import("../define-tool.js").Tool<{
|
|
14
|
+
path: string;
|
|
15
|
+
content: string;
|
|
16
|
+
}, import("./mutator.js").WriteFileResult>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `write_file` — sandbox-gated workspace write, confined to the agent's
|
|
3
|
+
* writable working directory.
|
|
4
|
+
*
|
|
5
|
+
* A thin adapter over the `WorkspaceMutator` seam (see the harness-durable-runtime / harness-workspace-tools specs): the
|
|
6
|
+
* mutator owns resolve + confine + sandbox write + provenance. This tool only
|
|
7
|
+
* declares the input schema and forwards. `edit_file` rides the same seam.
|
|
8
|
+
*/
|
|
9
|
+
import { ok } from "neverthrow";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { defineTool } from "../define-tool.js";
|
|
12
|
+
const WriteFileInputSchema = z.object({
|
|
13
|
+
path: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.describe("File path. Relative paths resolve against your working directory " +
|
|
17
|
+
"(e.g. 'output/result.csv', 'scripts/run.py'); an absolute " +
|
|
18
|
+
"'/<analysisId>/...' path is resolved against the analysis root."),
|
|
19
|
+
content: z.string().describe("UTF-8 file content."),
|
|
20
|
+
});
|
|
21
|
+
export function createWriteFileTool(deps) {
|
|
22
|
+
return defineTool({
|
|
23
|
+
id: "write_file",
|
|
24
|
+
// Body-only `awaitExec`-recv → runs unwrapped in the workflow body (see the harness-tools spec).
|
|
25
|
+
executionMode: "workflow",
|
|
26
|
+
description: "Write a UTF-8 text file in your working directory. Relative paths " +
|
|
27
|
+
"resolve against it; a path outside it returns an `out_of_prefix` data " +
|
|
28
|
+
"variant (no I/O), and one escaping the analysis tree returns " +
|
|
29
|
+
"`out_of_scope`.",
|
|
30
|
+
inputSchema: WriteFileInputSchema,
|
|
31
|
+
execute: async ({ path, content }, ctx) => ok(await deps.mutator.writeFile({ path, content, toolName: "write_file", emit: ctx.emit })),
|
|
32
|
+
});
|
|
33
|
+
}
|