@sanity/ailf 0.5.0 → 2.0.0
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/README.md +0 -1
- package/config/features.ts +23 -0
- package/config/models.ts +95 -0
- package/config/prompts.ts +16 -0
- package/config/rubrics.ts +225 -0
- package/config/schedules.ts +47 -0
- package/config/sinks.ts +37 -0
- package/config/sources.ts +21 -0
- package/config/thresholds.ts +61 -0
- package/dist/_vendor/ailf-core/config-helpers.d.ts +171 -0
- package/dist/_vendor/ailf-core/config-helpers.js +170 -0
- package/dist/_vendor/ailf-core/env-helper.d.ts +35 -0
- package/dist/_vendor/ailf-core/env-helper.js +45 -0
- package/dist/_vendor/ailf-core/examples/index.d.ts +16 -0
- package/dist/_vendor/ailf-core/examples/index.js +25 -0
- package/dist/_vendor/ailf-core/index.d.ts +3 -0
- package/dist/_vendor/ailf-core/index.js +5 -0
- package/dist/_vendor/ailf-core/ports/context.d.ts +17 -2
- package/dist/_vendor/ailf-core/ports/doc-fetcher.d.ts +2 -2
- package/dist/_vendor/ailf-core/ports/index.d.ts +2 -1
- package/dist/_vendor/ailf-core/ports/mode-handler.d.ts +129 -0
- package/dist/_vendor/ailf-core/ports/mode-handler.js +19 -0
- package/dist/_vendor/ailf-core/ports/task-source.d.ts +16 -122
- package/dist/_vendor/ailf-core/ports/task-source.js +7 -7
- package/dist/_vendor/ailf-core/schemas/eval-config.d.ts +8 -2
- package/dist/_vendor/ailf-core/schemas/eval-config.js +17 -2
- package/dist/_vendor/ailf-core/schemas/pipeline-request.d.ts +9 -3
- package/dist/_vendor/ailf-core/schemas/pipeline-request.js +8 -1
- package/dist/_vendor/ailf-core/schemas/pipeline.d.ts +14 -31
- package/dist/_vendor/ailf-core/schemas/pipeline.js +17 -9
- package/dist/_vendor/ailf-core/schemas/schedules.d.ts +14 -4
- package/dist/_vendor/ailf-core/schemas/schedules.js +6 -2
- package/dist/_vendor/ailf-core/schemas/sinks.d.ts +1 -1
- package/dist/_vendor/ailf-core/services/comparison-formatters.js +57 -19
- package/dist/_vendor/ailf-core/services/index.d.ts +2 -1
- package/dist/_vendor/ailf-core/services/index.js +2 -1
- package/dist/_vendor/ailf-core/services/scoring-engine.d.ts +153 -0
- package/dist/_vendor/ailf-core/services/scoring-engine.js +237 -0
- package/dist/_vendor/ailf-core/services/scoring.d.ts +15 -2
- package/dist/_vendor/ailf-core/services/scoring.js +25 -15
- package/dist/_vendor/ailf-core/types/branded-ids.d.ts +137 -0
- package/dist/_vendor/ailf-core/types/branded-ids.js +136 -0
- package/dist/_vendor/ailf-core/types/eval-mode-config.d.ts +150 -0
- package/dist/_vendor/ailf-core/types/eval-mode-config.js +24 -0
- package/dist/_vendor/ailf-core/types/generalized-task.d.ts +332 -0
- package/dist/_vendor/ailf-core/types/generalized-task.js +13 -0
- package/dist/_vendor/ailf-core/types/index.d.ts +45 -83
- package/dist/_vendor/ailf-core/types/index.js +8 -1
- package/dist/_vendor/ailf-core/types/plugin-registry.d.ts +257 -0
- package/dist/_vendor/ailf-core/types/plugin-registry.js +185 -0
- package/dist/_vendor/ailf-core/types/storage-schema.d.ts +199 -0
- package/dist/_vendor/ailf-core/types/storage-schema.js +39 -0
- package/dist/_vendor/ailf-core/types/task-graph.d.ts +86 -0
- package/dist/_vendor/ailf-core/types/task-graph.js +20 -0
- package/dist/_vendor/ailf-core/types/trace.d.ts +118 -0
- package/dist/_vendor/ailf-core/types/trace.js +18 -0
- package/dist/_vendor/ailf-core/types/variable-envelope.d.ts +80 -0
- package/dist/_vendor/ailf-core/types/variable-envelope.js +16 -0
- package/dist/_vendor/ailf-shared/dimension-names.d.ts +5 -18
- package/dist/_vendor/ailf-shared/dimension-names.js +6 -24
- package/dist/_vendor/ailf-shared/eval-modes.d.ts +38 -6
- package/dist/_vendor/ailf-shared/eval-modes.js +26 -2
- package/dist/_vendor/ailf-shared/index.d.ts +0 -1
- package/dist/_vendor/ailf-shared/index.js +0 -1
- package/dist/adapters/api-client/build-request.js +14 -13
- package/dist/adapters/config-sources/file-config-adapter.d.ts +20 -11
- package/dist/adapters/config-sources/file-config-adapter.js +39 -12
- package/dist/adapters/config-sources/index.d.ts +2 -0
- package/dist/adapters/config-sources/index.js +1 -0
- package/dist/adapters/config-sources/ts-config-loader.d.ts +59 -0
- package/dist/adapters/config-sources/ts-config-loader.js +141 -0
- package/dist/adapters/doc-fetchers/sanity-doc-fetcher.d.ts +3 -2
- package/dist/adapters/doc-fetchers/sanity-doc-fetcher.js +7 -2
- package/dist/adapters/task-sources/composite-task-source.d.ts +3 -3
- package/dist/adapters/task-sources/composite-task-source.js +1 -1
- package/dist/adapters/task-sources/content-lake-task-source.d.ts +7 -6
- package/dist/adapters/task-sources/content-lake-task-source.js +35 -39
- package/dist/adapters/task-sources/index.d.ts +3 -2
- package/dist/adapters/task-sources/index.js +3 -2
- package/dist/adapters/task-sources/repo-schemas.d.ts +218 -16
- package/dist/adapters/task-sources/repo-schemas.js +227 -19
- package/dist/adapters/task-sources/repo-task-source.d.ts +16 -12
- package/dist/adapters/task-sources/repo-task-source.js +92 -80
- package/dist/adapters/task-sources/repo-validation.d.ts +36 -5
- package/dist/adapters/task-sources/repo-validation.js +126 -5
- package/dist/adapters/task-sources/task-file-loader.d.ts +64 -0
- package/dist/adapters/task-sources/task-file-loader.js +83 -0
- package/dist/adapters/task-sources/yaml-task-source.d.ts +6 -6
- package/dist/adapters/task-sources/yaml-task-source.js +19 -16
- package/dist/cli.js +0 -2
- package/dist/commands/baseline.js +4 -1
- package/dist/commands/calculate-scores.js +1 -1
- package/dist/commands/coverage-audit.js +9 -1
- package/dist/commands/explain-handler.js +25 -23
- package/dist/commands/fetch-docs.js +3 -2
- package/dist/commands/generate-configs.js +1 -1
- package/dist/commands/init.d.ts +6 -4
- package/dist/commands/init.js +302 -23
- package/dist/commands/interactive.js +11 -7
- package/dist/commands/pipeline-action.d.ts +2 -0
- package/dist/commands/pipeline-action.js +16 -6
- package/dist/commands/pipeline.d.ts +1 -0
- package/dist/commands/pipeline.js +4 -2
- package/dist/commands/pr-comment.js +1 -1
- package/dist/commands/publish.js +2 -2
- package/dist/commands/readiness-report.js +13 -6
- package/dist/commands/validate-tasks.d.ts +2 -2
- package/dist/commands/validate-tasks.js +26 -15
- package/dist/composition-root.d.ts +13 -1
- package/dist/composition-root.js +99 -4
- package/dist/index.d.ts +41 -0
- package/dist/index.js +48 -0
- package/dist/orchestration/build-app-context.js +1 -0
- package/dist/orchestration/build-step-sequence.js +28 -8
- package/dist/orchestration/steps/calculate-scores-step.js +24 -11
- package/dist/orchestration/steps/fetch-docs-step.js +8 -7
- package/dist/orchestration/steps/gap-analysis-step.js +8 -7
- package/dist/orchestration/steps/generate-configs-step.d.ts +16 -3
- package/dist/orchestration/steps/generate-configs-step.js +261 -51
- package/dist/orchestration/steps/grader-consistency-step.js +7 -4
- package/dist/orchestration/steps/mirror-repo-tasks-step.js +1 -1
- package/dist/orchestration/steps/readiness-step.js +5 -6
- package/dist/orchestration/steps/run-eval-step.d.ts +1 -2
- package/dist/orchestration/steps/run-eval-step.js +8 -7
- package/dist/pipeline/cache.d.ts +1 -1
- package/dist/pipeline/cache.js +36 -8
- package/dist/pipeline/calculate-scores.d.ts +2 -4
- package/dist/pipeline/calculate-scores.js +43 -113
- package/dist/pipeline/checks.js +2 -2
- package/dist/pipeline/compare.js +8 -8
- package/dist/pipeline/compiler/__tests__/agent-harness-handler.test.d.ts +10 -0
- package/dist/pipeline/compiler/__tests__/agent-harness-handler.test.js +288 -0
- package/dist/pipeline/compiler/__tests__/assertion-mapper.test.d.ts +9 -0
- package/dist/pipeline/compiler/__tests__/assertion-mapper.test.js +145 -0
- package/dist/pipeline/compiler/__tests__/knowledge-probe-handler.test.d.ts +10 -0
- package/dist/pipeline/compiler/__tests__/knowledge-probe-handler.test.js +314 -0
- package/dist/pipeline/compiler/__tests__/literacy-handler.test.d.ts +10 -0
- package/dist/pipeline/compiler/__tests__/literacy-handler.test.js +486 -0
- package/dist/pipeline/compiler/__tests__/mcp-server-handler.test.d.ts +10 -0
- package/dist/pipeline/compiler/__tests__/mcp-server-handler.test.js +392 -0
- package/dist/pipeline/compiler/__tests__/promptfoo-compiler.test.d.ts +9 -0
- package/dist/pipeline/compiler/__tests__/promptfoo-compiler.test.js +333 -0
- package/dist/pipeline/compiler/__tests__/sandbox-and-fixtures.test.d.ts +12 -0
- package/dist/pipeline/compiler/__tests__/sandbox-and-fixtures.test.js +210 -0
- package/dist/pipeline/compiler/__tests__/scoring-and-presets.test.d.ts +7 -0
- package/dist/pipeline/compiler/__tests__/scoring-and-presets.test.js +404 -0
- package/dist/pipeline/compiler/__tests__/scoring-bridge.test.d.ts +10 -0
- package/dist/pipeline/compiler/__tests__/scoring-bridge.test.js +184 -0
- package/dist/pipeline/compiler/__tests__/task-graph-builder.test.d.ts +8 -0
- package/dist/pipeline/compiler/__tests__/task-graph-builder.test.js +301 -0
- package/dist/pipeline/compiler/__tests__/telemetry.test.d.ts +9 -0
- package/dist/pipeline/compiler/__tests__/telemetry.test.js +503 -0
- package/dist/pipeline/compiler/assertion-mapper.d.ts +58 -0
- package/dist/pipeline/compiler/assertion-mapper.js +175 -0
- package/dist/pipeline/compiler/compiler-to-yaml.d.ts +51 -0
- package/dist/pipeline/compiler/compiler-to-yaml.js +222 -0
- package/dist/pipeline/compiler/config-loader.d.ts +56 -0
- package/dist/pipeline/compiler/config-loader.js +111 -0
- package/dist/pipeline/compiler/fixture-resolver.d.ts +41 -0
- package/dist/pipeline/compiler/fixture-resolver.js +113 -0
- package/dist/pipeline/compiler/hash.d.ts +11 -0
- package/dist/pipeline/compiler/hash.js +18 -0
- package/dist/pipeline/compiler/ignore-fields.d.ts +53 -0
- package/dist/pipeline/compiler/ignore-fields.js +113 -0
- package/dist/pipeline/compiler/index.d.ts +29 -0
- package/dist/pipeline/compiler/index.js +45 -0
- package/dist/pipeline/compiler/literacy-bridge.d.ts +102 -0
- package/dist/pipeline/compiler/literacy-bridge.js +172 -0
- package/dist/pipeline/compiler/mode-bases/agent-harness.d.ts +10 -0
- package/dist/pipeline/compiler/mode-bases/agent-harness.js +21 -0
- package/dist/pipeline/compiler/mode-bases/index.d.ts +4 -0
- package/dist/pipeline/compiler/mode-bases/index.js +4 -0
- package/dist/pipeline/compiler/mode-bases/knowledge-probe.d.ts +10 -0
- package/dist/pipeline/compiler/mode-bases/knowledge-probe.js +22 -0
- package/dist/pipeline/compiler/mode-bases/literacy.d.ts +12 -0
- package/dist/pipeline/compiler/mode-bases/literacy.js +78 -0
- package/dist/pipeline/compiler/mode-bases/mcp-server.d.ts +10 -0
- package/dist/pipeline/compiler/mode-bases/mcp-server.js +70 -0
- package/dist/pipeline/compiler/mode-handlers/__fixtures__/agent-harness-example-tasks.d.ts +14 -0
- package/dist/pipeline/compiler/mode-handlers/__fixtures__/agent-harness-example-tasks.js +152 -0
- package/dist/pipeline/compiler/mode-handlers/__fixtures__/knowledge-probe-example-tasks.d.ts +32 -0
- package/dist/pipeline/compiler/mode-handlers/__fixtures__/knowledge-probe-example-tasks.js +176 -0
- package/dist/pipeline/compiler/mode-handlers/__fixtures__/mcp-example-tasks.d.ts +49 -0
- package/dist/pipeline/compiler/mode-handlers/__fixtures__/mcp-example-tasks.js +259 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/assertions.d.ts +43 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/assertions.js +187 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/compiler.d.ts +19 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/compiler.js +138 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/index.d.ts +16 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/index.js +43 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/prompts.d.ts +9 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/prompts.js +29 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/sandbox.d.ts +12 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/sandbox.js +82 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/tool-presets.d.ts +4 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/tool-presets.js +19 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/types.d.ts +49 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/types.js +4 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/validation.d.ts +9 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness/validation.js +16 -0
- package/dist/pipeline/compiler/mode-handlers/index.d.ts +15 -0
- package/dist/pipeline/compiler/mode-handlers/index.js +19 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/assertions.d.ts +16 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/assertions.js +61 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/compiler.d.ts +18 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/compiler.js +112 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/index.d.ts +26 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/index.js +49 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/prompts.d.ts +9 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/prompts.js +28 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/types.d.ts +44 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/types.js +4 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/validation.d.ts +9 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe/validation.js +24 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/assertions.d.ts +18 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/assertions.js +118 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/compiler.d.ts +14 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/compiler.js +105 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/index.d.ts +11 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/index.js +38 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/prompts.d.ts +9 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/prompts.js +74 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/types.d.ts +41 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/types.js +4 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/validation.d.ts +12 -0
- package/dist/pipeline/compiler/mode-handlers/literacy/validation.js +28 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/assertions.d.ts +42 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/assertions.js +334 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/compiler.d.ts +19 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/compiler.js +100 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/index.d.ts +27 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/index.js +54 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/prompts.d.ts +8 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/prompts.js +28 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/provider-config.d.ts +28 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/provider-config.js +104 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/types.d.ts +37 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/types.js +4 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/validation.d.ts +9 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server/validation.js +43 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/index.d.ts +33 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/index.js +174 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/mcp-connection.d.ts +19 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/mcp-connection.js +95 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/tool-loop-anthropic.d.ts +19 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/tool-loop-anthropic.js +172 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/tool-loop-openai.d.ts +14 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/tool-loop-openai.js +16 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/types.d.ts +93 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-tool-provider/types.js +4 -0
- package/dist/pipeline/compiler/preset-loader.d.ts +22 -0
- package/dist/pipeline/compiler/preset-loader.js +99 -0
- package/dist/pipeline/compiler/presets/index.d.ts +9 -0
- package/dist/pipeline/compiler/presets/index.js +8 -0
- package/dist/pipeline/compiler/presets/sanity-literacy.d.ts +42 -0
- package/dist/pipeline/compiler/presets/sanity-literacy.js +208 -0
- package/dist/pipeline/compiler/promptfoo-compiler.d.ts +96 -0
- package/dist/pipeline/compiler/promptfoo-compiler.js +230 -0
- package/dist/pipeline/compiler/provider-assembler.d.ts +39 -0
- package/dist/pipeline/compiler/provider-assembler.js +137 -0
- package/dist/pipeline/compiler/sandbox/docker-sandbox.d.ts +21 -0
- package/dist/pipeline/compiler/sandbox/docker-sandbox.js +136 -0
- package/dist/pipeline/compiler/sandbox/fixture-provisioner.d.ts +69 -0
- package/dist/pipeline/compiler/sandbox/fixture-provisioner.js +189 -0
- package/dist/pipeline/compiler/sandbox/git-worktree-sandbox.d.ts +20 -0
- package/dist/pipeline/compiler/sandbox/git-worktree-sandbox.js +114 -0
- package/dist/pipeline/compiler/sandbox/index.d.ts +10 -0
- package/dist/pipeline/compiler/sandbox/index.js +11 -0
- package/dist/pipeline/compiler/sandbox/sandbox-selector.d.ts +35 -0
- package/dist/pipeline/compiler/sandbox/sandbox-selector.js +86 -0
- package/dist/pipeline/compiler/sandbox/sandbox-strategy.d.ts +81 -0
- package/dist/pipeline/compiler/sandbox/sandbox-strategy.js +15 -0
- package/dist/pipeline/compiler/sandbox/tempdir-sandbox.d.ts +20 -0
- package/dist/pipeline/compiler/sandbox/tempdir-sandbox.js +74 -0
- package/dist/pipeline/compiler/scoring-bridge.d.ts +49 -0
- package/dist/pipeline/compiler/scoring-bridge.js +114 -0
- package/dist/pipeline/compiler/task-graph-builder.d.ts +54 -0
- package/dist/pipeline/compiler/task-graph-builder.js +291 -0
- package/dist/pipeline/compiler/telemetry/cost-tracker.d.ts +90 -0
- package/dist/pipeline/compiler/telemetry/cost-tracker.js +146 -0
- package/dist/pipeline/compiler/telemetry/index.d.ts +14 -0
- package/dist/pipeline/compiler/telemetry/index.js +19 -0
- package/dist/pipeline/compiler/telemetry/redactor.d.ts +58 -0
- package/dist/pipeline/compiler/telemetry/redactor.js +222 -0
- package/dist/pipeline/compiler/telemetry/tool-classifier.d.ts +32 -0
- package/dist/pipeline/compiler/telemetry/tool-classifier.js +120 -0
- package/dist/pipeline/compiler/telemetry/trace-collector.d.ts +75 -0
- package/dist/pipeline/compiler/telemetry/trace-collector.js +297 -0
- package/dist/pipeline/compiler/telemetry/trace-store.d.ts +78 -0
- package/dist/pipeline/compiler/telemetry/trace-store.js +85 -0
- package/dist/pipeline/compiler/variable-resolver.d.ts +46 -0
- package/dist/pipeline/compiler/variable-resolver.js +115 -0
- package/dist/pipeline/coverage-audit.d.ts +15 -5
- package/dist/pipeline/coverage-audit.js +41 -22
- package/dist/pipeline/eval-constants.d.ts +16 -6
- package/dist/pipeline/eval-constants.js +25 -4
- package/dist/pipeline/eval-fingerprint.d.ts +2 -2
- package/dist/pipeline/eval-fingerprint.js +8 -9
- package/dist/pipeline/expand-tasks.d.ts +19 -10
- package/dist/pipeline/expand-tasks.js +34 -28
- package/dist/pipeline/gap-analysis.d.ts +1 -1
- package/dist/pipeline/gap-analysis.js +2 -2
- package/dist/pipeline/generate-configs.d.ts +22 -4
- package/dist/pipeline/generate-configs.js +53 -24
- package/dist/pipeline/grader-api.d.ts +3 -3
- package/dist/pipeline/grader-api.js +5 -12
- package/dist/pipeline/grader-compare-runner.js +20 -27
- package/dist/pipeline/grader-comparison.d.ts +4 -8
- package/dist/pipeline/grader-comparison.js +11 -17
- package/dist/pipeline/grader-consistency-runner.d.ts +2 -3
- package/dist/pipeline/grader-consistency-runner.js +16 -20
- package/dist/pipeline/grader-consistency.d.ts +6 -10
- package/dist/pipeline/grader-consistency.js +13 -32
- package/dist/pipeline/grader-sensitivity-runner.js +7 -5
- package/dist/pipeline/grader-sensitivity.d.ts +2 -6
- package/dist/pipeline/grader-sensitivity.js +10 -10
- package/dist/pipeline/grader-validate-runner.js +7 -5
- package/dist/pipeline/grader-validation.d.ts +2 -6
- package/dist/pipeline/grader-validation.js +14 -22
- package/dist/pipeline/map-request-to-config.js +7 -1
- package/dist/pipeline/mirror-repo-tasks.d.ts +13 -13
- package/dist/pipeline/mirror-repo-tasks.js +22 -21
- package/dist/pipeline/normalize-mode.d.ts +49 -0
- package/dist/pipeline/normalize-mode.js +64 -0
- package/dist/pipeline/plan.d.ts +5 -2
- package/dist/pipeline/plan.js +134 -78
- package/dist/pipeline/pr-comment.js +2 -0
- package/dist/pipeline/profile-resolution.d.ts +22 -14
- package/dist/pipeline/profile-resolution.js +41 -19
- package/dist/pipeline/provenance.d.ts +2 -2
- package/dist/pipeline/provenance.js +12 -17
- package/dist/pipeline/release-report.js +4 -4
- package/dist/pipeline/repo-threshold-evaluator.d.ts +1 -1
- package/dist/pipeline/repo-threshold-evaluator.js +1 -1
- package/dist/pipeline/rubric-loader.d.ts +20 -0
- package/dist/pipeline/rubric-loader.js +37 -0
- package/dist/pipeline/validate.d.ts +4 -4
- package/dist/pipeline/validate.js +64 -53
- package/dist/schedules/loader.js +18 -8
- package/dist/scripts/migrate-task-mode.d.ts +24 -0
- package/dist/scripts/migrate-task-mode.js +85 -0
- package/dist/scripts/migrate-tasks-to-content-lake.js +11 -10
- package/dist/scripts/validate-task-sources.d.ts +1 -1
- package/dist/scripts/validate-task-sources.js +15 -15
- package/dist/sinks/loader.js +5 -7
- package/dist/sources.d.ts +7 -7
- package/dist/sources.js +22 -24
- package/dist/webhook/dispatch.js +2 -1
- package/package.json +15 -4
- package/tasks/knowledge-probe/define-type-api.task.ts +55 -0
- package/tasks/knowledge-probe/groq-projections.task.ts +59 -0
- package/tasks/literacy/frameworks.task.ts +128 -0
- package/tasks/literacy/functions.task.ts +69 -0
- package/tasks/literacy/groq.task.ts +258 -0
- package/tasks/literacy/nextjs-live.task.ts +75 -0
- package/tasks/literacy/studio-setup.task.ts +131 -0
- package/tasks/literacy/visual-editing.task.ts +146 -0
- package/config/features.yaml +0 -116
- package/config/models.yaml +0 -116
- package/config/prompts.yaml +0 -75
- package/config/rubrics.yaml +0 -81
- package/config/schedules.yaml +0 -43
- package/config/sinks.yaml +0 -54
- package/config/sources.yaml +0 -51
- package/config/thresholds.yaml +0 -49
- package/dist/_vendor/ailf-tasks/cli.d.ts +0 -8
- package/dist/_vendor/ailf-tasks/cli.js +0 -61
- package/dist/_vendor/ailf-tasks/index.d.ts +0 -13
- package/dist/_vendor/ailf-tasks/index.js +0 -16
- package/dist/_vendor/ailf-tasks/parser.d.ts +0 -27
- package/dist/_vendor/ailf-tasks/parser.js +0 -73
- package/dist/_vendor/ailf-tasks/schemas.d.ts +0 -198
- package/dist/_vendor/ailf-tasks/schemas.js +0 -180
- package/dist/_vendor/ailf-tasks/validation.d.ts +0 -47
- package/dist/_vendor/ailf-tasks/validation.js +0 -162
- package/dist/agent-observer/test-imports.d.ts +0 -7
- package/dist/agent-observer/test-imports.js +0 -185
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Anthropic multi-turn tool execution loop.
|
|
3
|
+
*
|
|
4
|
+
* Sends a prompt to the Anthropic Messages API with MCP tools attached.
|
|
5
|
+
* When the model calls a tool, executes it via the MCP client, feeds
|
|
6
|
+
* the result back, and continues until the model produces a final text
|
|
7
|
+
* response or maxToolRounds is exhausted.
|
|
8
|
+
*/
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Tool loop implementation
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Run a multi-turn tool loop using the Anthropic Messages API.
|
|
14
|
+
*
|
|
15
|
+
* The loop:
|
|
16
|
+
* 1. Sends the prompt with available tools to Claude
|
|
17
|
+
* 2. If Claude calls tools → executes them via MCP, sends results back
|
|
18
|
+
* 3. Repeats until Claude produces a text-only response or maxToolRounds is hit
|
|
19
|
+
* 4. On the last round, omits tools to force a synthesis response
|
|
20
|
+
*/
|
|
21
|
+
export async function runAnthropicToolLoop(config) {
|
|
22
|
+
const { prompt, tools, callTool, maxToolRounds, model, temperature, maxTokens, apiKey, } = config;
|
|
23
|
+
const anthropicTools = tools.map((t) => ({
|
|
24
|
+
name: t.name,
|
|
25
|
+
description: t.description || `MCP tool: ${t.name}`,
|
|
26
|
+
input_schema: t.inputSchema || { type: "object", properties: {} },
|
|
27
|
+
}));
|
|
28
|
+
const systemPrompt = "You are an AI assistant with access to tools provided by an MCP server. " +
|
|
29
|
+
"Use the available tools to complete the task. Call tools with correct parameters, " +
|
|
30
|
+
"interpret responses, and provide a complete answer.";
|
|
31
|
+
const messages = [{ content: prompt, role: "user" }];
|
|
32
|
+
let inputTokens = 0;
|
|
33
|
+
let outputTokens = 0;
|
|
34
|
+
const startTime = Date.now();
|
|
35
|
+
const toolCallLog = [];
|
|
36
|
+
for (let round = 0; round <= maxToolRounds; round++) {
|
|
37
|
+
const isLastRound = round === maxToolRounds;
|
|
38
|
+
// On the last round, omit tools to force a text-only response.
|
|
39
|
+
// Anthropic doesn't support tool_choice: "none" — the way to disable
|
|
40
|
+
// tools is to simply not include them in the request.
|
|
41
|
+
if (isLastRound) {
|
|
42
|
+
const lastMsg = messages[messages.length - 1];
|
|
43
|
+
const synthesisText = "You've used the tools available. Based on the information gathered, " +
|
|
44
|
+
"provide your complete, final answer now.";
|
|
45
|
+
if (lastMsg?.role === "user" && Array.isArray(lastMsg.content)) {
|
|
46
|
+
;
|
|
47
|
+
lastMsg.content.push({
|
|
48
|
+
type: "text",
|
|
49
|
+
text: synthesisText,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
messages.push({ content: synthesisText, role: "user" });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const body = {
|
|
57
|
+
max_tokens: maxTokens,
|
|
58
|
+
messages,
|
|
59
|
+
model,
|
|
60
|
+
system: systemPrompt,
|
|
61
|
+
temperature,
|
|
62
|
+
};
|
|
63
|
+
if (!isLastRound) {
|
|
64
|
+
body.tools = anthropicTools;
|
|
65
|
+
}
|
|
66
|
+
const response = await fetch("https://api.anthropic.com/v1/messages", {
|
|
67
|
+
body: JSON.stringify(body),
|
|
68
|
+
headers: {
|
|
69
|
+
"anthropic-version": "2023-06-01",
|
|
70
|
+
"Content-Type": "application/json",
|
|
71
|
+
"x-api-key": apiKey,
|
|
72
|
+
},
|
|
73
|
+
method: "POST",
|
|
74
|
+
});
|
|
75
|
+
const data = (await response.json());
|
|
76
|
+
if (data.error) {
|
|
77
|
+
throw new Error(data.error.message ??
|
|
78
|
+
`Anthropic API error: ${JSON.stringify(data.error)}`);
|
|
79
|
+
}
|
|
80
|
+
inputTokens += data.usage?.input_tokens ?? 0;
|
|
81
|
+
outputTokens += data.usage?.output_tokens ?? 0;
|
|
82
|
+
if (!data.content?.length) {
|
|
83
|
+
return {
|
|
84
|
+
output: "",
|
|
85
|
+
toolCallLog,
|
|
86
|
+
tokenUsage: {
|
|
87
|
+
prompt: inputTokens,
|
|
88
|
+
completion: outputTokens,
|
|
89
|
+
total: inputTokens + outputTokens,
|
|
90
|
+
},
|
|
91
|
+
toolRounds: round,
|
|
92
|
+
latencyMs: Date.now() - startTime,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Add assistant response to history
|
|
96
|
+
messages.push({ content: data.content, role: "assistant" });
|
|
97
|
+
// Check if model wants to use tools
|
|
98
|
+
const toolUseBlocks = data.content.filter((b) => b.type === "tool_use");
|
|
99
|
+
if (data.stop_reason !== "tool_use" || toolUseBlocks.length === 0) {
|
|
100
|
+
// Model is done — extract text
|
|
101
|
+
const textBlocks = data.content.filter((b) => b.type === "text");
|
|
102
|
+
const output = textBlocks.map((b) => b.text || "").join("\n") || "";
|
|
103
|
+
return {
|
|
104
|
+
output,
|
|
105
|
+
toolCallLog,
|
|
106
|
+
tokenUsage: {
|
|
107
|
+
prompt: inputTokens,
|
|
108
|
+
completion: outputTokens,
|
|
109
|
+
total: inputTokens + outputTokens,
|
|
110
|
+
},
|
|
111
|
+
toolRounds: round,
|
|
112
|
+
latencyMs: Date.now() - startTime,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// Execute each tool call via MCP
|
|
116
|
+
const toolResults = [];
|
|
117
|
+
for (const toolUse of toolUseBlocks) {
|
|
118
|
+
const toolName = toolUse.name;
|
|
119
|
+
const toolInput = (toolUse.input || {});
|
|
120
|
+
try {
|
|
121
|
+
const result = await callTool(toolName, toolInput);
|
|
122
|
+
const content = result.error
|
|
123
|
+
? JSON.stringify({ error: result.error })
|
|
124
|
+
: result.content;
|
|
125
|
+
toolCallLog.push({ name: toolName, input: toolInput, output: content });
|
|
126
|
+
toolResults.push({
|
|
127
|
+
content,
|
|
128
|
+
tool_use_id: toolUse.id,
|
|
129
|
+
type: "tool_result",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
134
|
+
toolCallLog.push({
|
|
135
|
+
name: toolName,
|
|
136
|
+
input: toolInput,
|
|
137
|
+
output: `Error: ${errMsg}`,
|
|
138
|
+
});
|
|
139
|
+
toolResults.push({
|
|
140
|
+
content: JSON.stringify({ error: errMsg }),
|
|
141
|
+
tool_use_id: toolUse.id,
|
|
142
|
+
type: "tool_result",
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Add tool results to conversation
|
|
147
|
+
messages.push({ content: toolResults, role: "user" });
|
|
148
|
+
}
|
|
149
|
+
// Exhausted rounds — extract last text
|
|
150
|
+
const lastAssistant = [...messages]
|
|
151
|
+
.reverse()
|
|
152
|
+
.find((m) => m.role === "assistant");
|
|
153
|
+
let lastText = "";
|
|
154
|
+
if (lastAssistant && Array.isArray(lastAssistant.content)) {
|
|
155
|
+
lastText = lastAssistant.content
|
|
156
|
+
.filter((b) => b.type === "text")
|
|
157
|
+
.map((b) => b.text || "")
|
|
158
|
+
.join("\n");
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
output: lastText || "[Exhausted tool rounds without final answer]",
|
|
162
|
+
toolCallLog,
|
|
163
|
+
tokenUsage: {
|
|
164
|
+
prompt: inputTokens,
|
|
165
|
+
completion: outputTokens,
|
|
166
|
+
total: inputTokens + outputTokens,
|
|
167
|
+
},
|
|
168
|
+
toolRounds: maxToolRounds,
|
|
169
|
+
exhaustedRounds: true,
|
|
170
|
+
latencyMs: Date.now() - startTime,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI multi-turn tool execution loop.
|
|
3
|
+
*
|
|
4
|
+
* Placeholder for future implementation. Will use the OpenAI Chat
|
|
5
|
+
* Completions or Responses API with function calling to execute MCP
|
|
6
|
+
* tools in a multi-turn loop.
|
|
7
|
+
*/
|
|
8
|
+
import type { ToolLoopConfig, ToolLoopResult } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Run a multi-turn tool loop using the OpenAI API.
|
|
11
|
+
*
|
|
12
|
+
* @throws {Error} Not yet implemented
|
|
13
|
+
*/
|
|
14
|
+
export declare function runOpenAIToolLoop(_config: ToolLoopConfig): Promise<ToolLoopResult>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI multi-turn tool execution loop.
|
|
3
|
+
*
|
|
4
|
+
* Placeholder for future implementation. Will use the OpenAI Chat
|
|
5
|
+
* Completions or Responses API with function calling to execute MCP
|
|
6
|
+
* tools in a multi-turn loop.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Run a multi-turn tool loop using the OpenAI API.
|
|
10
|
+
*
|
|
11
|
+
* @throws {Error} Not yet implemented
|
|
12
|
+
*/
|
|
13
|
+
export async function runOpenAIToolLoop(_config) {
|
|
14
|
+
throw new Error("OpenAI tool loop is not yet implemented. " +
|
|
15
|
+
"Use an Anthropic model (anthropic:messages:*) for MCP evaluations.");
|
|
16
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the MCP tool provider.
|
|
3
|
+
*/
|
|
4
|
+
export interface CallApiContextParams {
|
|
5
|
+
prompt?: {
|
|
6
|
+
raw: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
vars?: Record<string, object | string>;
|
|
10
|
+
}
|
|
11
|
+
export interface ProviderOptions {
|
|
12
|
+
config?: Record<string, unknown>;
|
|
13
|
+
id?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProviderResponse {
|
|
16
|
+
cached?: boolean;
|
|
17
|
+
cost?: number;
|
|
18
|
+
error?: string;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
output?: object | string;
|
|
21
|
+
tokenUsage?: {
|
|
22
|
+
total?: number;
|
|
23
|
+
prompt?: number;
|
|
24
|
+
completion?: number;
|
|
25
|
+
cached?: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface MCPTool {
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
inputSchema?: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
export interface MCPClient {
|
|
34
|
+
getAllTools: () => MCPTool[];
|
|
35
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<{
|
|
36
|
+
content: string;
|
|
37
|
+
error?: string;
|
|
38
|
+
}>;
|
|
39
|
+
cleanup: () => Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface ToolCallEntry {
|
|
42
|
+
name: string;
|
|
43
|
+
input: unknown;
|
|
44
|
+
output: string;
|
|
45
|
+
}
|
|
46
|
+
/** Configuration passed from the provider to an LLM backend's tool loop */
|
|
47
|
+
export interface ToolLoopConfig {
|
|
48
|
+
/** The user's prompt */
|
|
49
|
+
prompt: string;
|
|
50
|
+
/** MCP tools available (already filtered by capabilities) */
|
|
51
|
+
tools: MCPTool[];
|
|
52
|
+
/** Function to call an MCP tool by name */
|
|
53
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<{
|
|
54
|
+
content: string;
|
|
55
|
+
error?: string;
|
|
56
|
+
}>;
|
|
57
|
+
/** Max rounds of tool calls before forcing a final answer */
|
|
58
|
+
maxToolRounds: number;
|
|
59
|
+
/** LLM model name (provider-specific, e.g., "claude-opus-4-6") */
|
|
60
|
+
model: string;
|
|
61
|
+
/** Sampling temperature */
|
|
62
|
+
temperature: number;
|
|
63
|
+
/** Max output tokens */
|
|
64
|
+
maxTokens: number;
|
|
65
|
+
/** API key for the LLM provider */
|
|
66
|
+
apiKey: string;
|
|
67
|
+
}
|
|
68
|
+
/** Result returned from an LLM backend's tool loop */
|
|
69
|
+
export interface ToolLoopResult {
|
|
70
|
+
/** The LLM's final text output */
|
|
71
|
+
output: string;
|
|
72
|
+
/** Log of all tool calls made during the loop */
|
|
73
|
+
toolCallLog: ToolCallEntry[];
|
|
74
|
+
/** Token usage stats */
|
|
75
|
+
tokenUsage: {
|
|
76
|
+
prompt: number;
|
|
77
|
+
completion: number;
|
|
78
|
+
total: number;
|
|
79
|
+
};
|
|
80
|
+
/** Number of tool rounds completed */
|
|
81
|
+
toolRounds: number;
|
|
82
|
+
/** Whether the loop exhausted maxToolRounds */
|
|
83
|
+
exhaustedRounds?: boolean;
|
|
84
|
+
/** Wall-clock duration in ms */
|
|
85
|
+
latencyMs: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* An LLM backend that can run a multi-turn tool loop.
|
|
89
|
+
*
|
|
90
|
+
* Each backend (Anthropic, OpenAI) implements this function signature.
|
|
91
|
+
* The provider selects the appropriate backend based on the model ID prefix.
|
|
92
|
+
*/
|
|
93
|
+
export type RunToolLoop = (config: ToolLoopConfig) => Promise<ToolLoopResult>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset loader — resolves and loads external PresetDefinition files.
|
|
3
|
+
*
|
|
4
|
+
* Supports two reference formats:
|
|
5
|
+
* - Relative path (./foo.ts, ../presets/bar.ts) → loaded from disk via jiti
|
|
6
|
+
* - npm package name (my-preset-package) → resolved via Node require
|
|
7
|
+
*
|
|
8
|
+
* Uses jiti for synchronous TypeScript/JavaScript loading, matching the
|
|
9
|
+
* sync constraint of createAppContext() and createRegistry().
|
|
10
|
+
*
|
|
11
|
+
* @see packages/eval/src/composition-root.ts — where this is called
|
|
12
|
+
*/
|
|
13
|
+
import type { PresetDefinition } from "../../_vendor/ailf-core/index.d.ts";
|
|
14
|
+
/**
|
|
15
|
+
* Load external presets from file paths or npm package names.
|
|
16
|
+
*
|
|
17
|
+
* @param refs - Preset references (relative paths or package names)
|
|
18
|
+
* @param rootDir - Base directory for resolving relative paths
|
|
19
|
+
* @returns Loaded PresetDefinition array (preserves input order)
|
|
20
|
+
* @throws If a preset file is not found or doesn't export a valid PresetDefinition
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadExternalPresets(refs: string[], rootDir: string): PresetDefinition[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset loader — resolves and loads external PresetDefinition files.
|
|
3
|
+
*
|
|
4
|
+
* Supports two reference formats:
|
|
5
|
+
* - Relative path (./foo.ts, ../presets/bar.ts) → loaded from disk via jiti
|
|
6
|
+
* - npm package name (my-preset-package) → resolved via Node require
|
|
7
|
+
*
|
|
8
|
+
* Uses jiti for synchronous TypeScript/JavaScript loading, matching the
|
|
9
|
+
* sync constraint of createAppContext() and createRegistry().
|
|
10
|
+
*
|
|
11
|
+
* @see packages/eval/src/composition-root.ts — where this is called
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync } from "fs";
|
|
14
|
+
import { resolve } from "path";
|
|
15
|
+
import { pathToFileURL } from "url";
|
|
16
|
+
import { createJiti } from "jiti";
|
|
17
|
+
/** Thrown for preset-specific load errors (distinguishes from third-party errors) */
|
|
18
|
+
class PresetLoadError extends Error {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = "PresetLoadError";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Load external presets from file paths or npm package names.
|
|
26
|
+
*
|
|
27
|
+
* @param refs - Preset references (relative paths or package names)
|
|
28
|
+
* @param rootDir - Base directory for resolving relative paths
|
|
29
|
+
* @returns Loaded PresetDefinition array (preserves input order)
|
|
30
|
+
* @throws If a preset file is not found or doesn't export a valid PresetDefinition
|
|
31
|
+
*/
|
|
32
|
+
export function loadExternalPresets(refs, rootDir) {
|
|
33
|
+
const presets = [];
|
|
34
|
+
for (const ref of refs) {
|
|
35
|
+
const preset = loadSinglePreset(ref, rootDir);
|
|
36
|
+
presets.push(preset);
|
|
37
|
+
}
|
|
38
|
+
return presets;
|
|
39
|
+
}
|
|
40
|
+
function loadSinglePreset(ref, rootDir) {
|
|
41
|
+
const isPath = ref.startsWith("./") || ref.startsWith("../") || ref.startsWith("/");
|
|
42
|
+
const filePath = isPath ? resolve(rootDir, ref) : ref;
|
|
43
|
+
// Containment check: resolved path must be within rootDir to prevent
|
|
44
|
+
// path traversal (e.g., "../../other-project/secret.ts")
|
|
45
|
+
if (isPath) {
|
|
46
|
+
const resolvedRoot = resolve(rootDir);
|
|
47
|
+
if (!resolve(filePath).startsWith(resolvedRoot)) {
|
|
48
|
+
throw new PresetLoadError(`Preset "${ref}" resolves outside the project root (${resolvedRoot}). ` +
|
|
49
|
+
`Preset paths must be within the project directory.`);
|
|
50
|
+
}
|
|
51
|
+
if (!existsSync(filePath)) {
|
|
52
|
+
throw new PresetLoadError(`Preset file not found: ${filePath} (resolved from "${ref}" relative to ${rootDir})`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const jiti = createJiti(pathToFileURL(rootDir).href, {
|
|
57
|
+
interopDefault: true,
|
|
58
|
+
requireCache: true,
|
|
59
|
+
});
|
|
60
|
+
// jiti() is the synchronous loader
|
|
61
|
+
const mod = jiti(filePath);
|
|
62
|
+
const preset = extractDefault(mod);
|
|
63
|
+
if (!preset || typeof preset !== "object") {
|
|
64
|
+
throw new PresetLoadError(`Preset "${ref}" does not export a default value. ` +
|
|
65
|
+
`Use \`export default definePreset({ ... })\`.`);
|
|
66
|
+
}
|
|
67
|
+
// Validate minimal shape
|
|
68
|
+
const p = preset;
|
|
69
|
+
if (!p.name || !p.mode || !p.manifest) {
|
|
70
|
+
throw new PresetLoadError(`Preset "${ref}" is missing required fields. ` +
|
|
71
|
+
`A preset must have at least \`name\`, \`mode\`, and \`manifest\`.`);
|
|
72
|
+
}
|
|
73
|
+
return p;
|
|
74
|
+
}
|
|
75
|
+
catch (cause) {
|
|
76
|
+
if (cause instanceof PresetLoadError) {
|
|
77
|
+
throw cause; // Re-throw our own errors
|
|
78
|
+
}
|
|
79
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
80
|
+
throw new Error(`Failed to load preset "${ref}": ${message}`, {
|
|
81
|
+
cause: cause,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Extract the default export from a module, handling both ESM and CJS patterns.
|
|
87
|
+
*/
|
|
88
|
+
function extractDefault(mod) {
|
|
89
|
+
if (mod === null || mod === undefined)
|
|
90
|
+
return undefined;
|
|
91
|
+
if (typeof mod !== "object")
|
|
92
|
+
return mod;
|
|
93
|
+
const obj = mod;
|
|
94
|
+
// ESM: { default: value }
|
|
95
|
+
if ("default" in obj)
|
|
96
|
+
return obj.default;
|
|
97
|
+
// CJS: the module itself is the value
|
|
98
|
+
return obj;
|
|
99
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presets — bundled evaluation capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Each preset packages modes, assertions, rubric templates, fixture
|
|
5
|
+
* resolvers, prompt templates, scoring profiles, doc fetcher, source
|
|
6
|
+
* definitions, and feature definitions into a single installable unit.
|
|
7
|
+
*/
|
|
8
|
+
export { createSanityLiteracyPreset, registerSanityLiteracyPreset, sanityLiteracyPreset, } from "./sanity-literacy.js";
|
|
9
|
+
export type { SanityLiteracyPresetOptions } from "./sanity-literacy.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presets — bundled evaluation capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Each preset packages modes, assertions, rubric templates, fixture
|
|
5
|
+
* resolvers, prompt templates, scoring profiles, doc fetcher, source
|
|
6
|
+
* definitions, and feature definitions into a single installable unit.
|
|
7
|
+
*/
|
|
8
|
+
export { createSanityLiteracyPreset, registerSanityLiteracyPreset, sanityLiteracyPreset, } from "./sanity-literacy.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sanity-literacy preset — Sanity-specific domain configuration for literacy evaluation.
|
|
3
|
+
*
|
|
4
|
+
* This is a domain preset that targets the `literacy` mode base. It provides
|
|
5
|
+
* Sanity-specific configuration:
|
|
6
|
+
* - Sanity doc source definitions (production, branch, local)
|
|
7
|
+
* - Product feature registry for coverage auditing
|
|
8
|
+
* - DocFetcher factory (SanityDocFetcher)
|
|
9
|
+
* - Sanity fixture resolver (sanity:// scheme)
|
|
10
|
+
*
|
|
11
|
+
* Evaluation methodology (rubrics, scoring, prompts) is inherited from the
|
|
12
|
+
* `literacy` mode base — see mode-bases/literacy.ts.
|
|
13
|
+
*
|
|
14
|
+
* @see docs/exec-plans/architecture-overhaul/phase-8-scoring-storage-presets.md
|
|
15
|
+
*/
|
|
16
|
+
import { type PresetDefinition } from "../../../_vendor/ailf-core/index.d.ts";
|
|
17
|
+
export interface SanityLiteracyPresetOptions {
|
|
18
|
+
/** Root directory for SanityDocFetcher file path resolution (defaults to cwd) */
|
|
19
|
+
rootDir?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create the sanity-literacy preset with all Sanity-specific configuration.
|
|
23
|
+
*
|
|
24
|
+
* The `rootDir` option controls where the SanityDocFetcher resolves file
|
|
25
|
+
* paths. When omitted it defaults to `process.cwd()`, which matches the
|
|
26
|
+
* composition root's existing behavior.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createSanityLiteracyPreset(options?: SanityLiteracyPresetOptions): PresetDefinition;
|
|
29
|
+
/**
|
|
30
|
+
* Pre-built preset instance using default options (cwd for rootDir).
|
|
31
|
+
*
|
|
32
|
+
* Prefer `createSanityLiteracyPreset()` when you need to control rootDir
|
|
33
|
+
* or other options. This constant exists for backward compatibility with
|
|
34
|
+
* code that imports `sanityLiteracyPreset` directly.
|
|
35
|
+
*/
|
|
36
|
+
export declare const sanityLiteracyPreset: PresetDefinition;
|
|
37
|
+
/**
|
|
38
|
+
* Register the sanity-literacy preset in a plugin registry.
|
|
39
|
+
*/
|
|
40
|
+
export declare function registerSanityLiteracyPreset(registry: {
|
|
41
|
+
registerPreset(preset: PresetDefinition): void;
|
|
42
|
+
}): void;
|