@sanity/ailf 0.4.1 → 1.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/config/features.ts +23 -0
- package/config/models.ts +83 -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 +174 -0
- package/dist/_vendor/ailf-core/config-helpers.js +150 -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 +10 -10
- package/dist/_vendor/ailf-core/examples/index.js +10 -10
- 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 +15 -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 +7 -2
- package/dist/_vendor/ailf-core/schemas/eval-config.js +7 -2
- package/dist/_vendor/ailf-core/schemas/pipeline-request.d.ts +8 -3
- package/dist/_vendor/ailf-core/schemas/pipeline-request.js +6 -1
- package/dist/_vendor/ailf-core/schemas/pipeline.d.ts +32 -31
- package/dist/_vendor/ailf-core/schemas/pipeline.js +52 -12
- 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 +319 -0
- package/dist/_vendor/ailf-core/types/generalized-task.js +13 -0
- package/dist/_vendor/ailf-core/types/index.d.ts +45 -81
- package/dist/_vendor/ailf-core/types/index.js +8 -1
- package/dist/_vendor/ailf-core/types/plugin-registry.d.ts +202 -0
- package/dist/_vendor/ailf-core/types/plugin-registry.js +132 -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 +38 -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 +133 -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 +22 -23
- package/dist/adapters/task-sources/index.d.ts +1 -0
- package/dist/adapters/task-sources/index.js +1 -0
- package/dist/adapters/task-sources/repo-task-source.d.ts +4 -4
- package/dist/adapters/task-sources/repo-task-source.js +69 -16
- 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 +7 -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/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/composition-root.d.ts +1 -1
- package/dist/composition-root.js +67 -4
- package/dist/orchestration/build-app-context.js +1 -0
- package/dist/orchestration/build-step-sequence.js +24 -6
- package/dist/orchestration/steps/calculate-scores-step.js +24 -11
- package/dist/orchestration/steps/fetch-docs-step.js +6 -4
- 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 +245 -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 +5 -7
- package/dist/pipeline/calculate-scores.js +74 -153
- 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 +355 -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 +471 -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-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-handler.d.ts +70 -0
- package/dist/pipeline/compiler/mode-handlers/agent-harness-handler.js +485 -0
- package/dist/pipeline/compiler/mode-handlers/index.d.ts +16 -0
- package/dist/pipeline/compiler/mode-handlers/index.js +21 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe-handler.d.ts +76 -0
- package/dist/pipeline/compiler/mode-handlers/knowledge-probe-handler.js +245 -0
- package/dist/pipeline/compiler/mode-handlers/literacy-handler.d.ts +89 -0
- package/dist/pipeline/compiler/mode-handlers/literacy-handler.js +379 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-assertions.d.ts +50 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-assertions.js +277 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server-handler.d.ts +67 -0
- package/dist/pipeline/compiler/mode-handlers/mcp-server-handler.js +309 -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 +45 -0
- package/dist/pipeline/compiler/presets/sanity-literacy.js +354 -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 +23 -14
- package/dist/pipeline/expand-tasks.js +37 -31
- 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 +18 -21
- 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 +6 -1
- package/dist/pipeline/mirror-repo-tasks.d.ts +6 -6
- package/dist/pipeline/mirror-repo-tasks.js +16 -15
- 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 +47 -0
- package/dist/pipeline/profile-resolution.js +91 -0
- 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 +6 -3
- 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 -62
- 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/agent-observer/test-imports.d.ts +0 -7
- package/dist/agent-observer/test-imports.js +0 -185
|
@@ -4,9 +4,41 @@
|
|
|
4
4
|
* Shared between eval (pipeline orchestrator) and studio (GROQ filters, UI).
|
|
5
5
|
* A new mode added here is immediately visible to both packages.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The evaluation modes supported by the pipeline.
|
|
9
|
+
*
|
|
10
|
+
* Canonical mode names identify the KIND of evaluation:
|
|
11
|
+
* - `literacy` — documentation effectiveness (gold + baseline prompts)
|
|
12
|
+
* - `knowledge-probe` — raw model knowledge without docs
|
|
13
|
+
* - `mcp-server` — MCP server tool-call correctness
|
|
14
|
+
* - `agent-harness` — sandboxed agent coding evaluation
|
|
15
|
+
* - `custom` — user-provided handler
|
|
16
|
+
*
|
|
17
|
+
* Legacy variant names are accepted by the CLI for backward compatibility
|
|
18
|
+
* and normalized at the CLI boundary to `mode: "literacy"` + `variant`:
|
|
19
|
+
* - `baseline` → `mode: "literacy", variant: "baseline"`
|
|
20
|
+
* - `agentic` → `mode: "literacy", variant: "agentic"`
|
|
21
|
+
* - `observed` → `mode: "literacy", variant: "observed"`
|
|
22
|
+
* - `full` → `mode: "literacy", variant: "full"`
|
|
23
|
+
*/
|
|
24
|
+
export type EvalMode = "agent-harness" | "custom" | "knowledge-probe" | "literacy" | "mcp-server";
|
|
25
|
+
/**
|
|
26
|
+
* Raw eval mode — includes both canonical and legacy names.
|
|
27
|
+
*
|
|
28
|
+
* This is the type that Zod schemas parse from user input (CLI, config, API).
|
|
29
|
+
* Values must pass through `normalizeMode()` before entering typed pipeline
|
|
30
|
+
* code that expects `EvalMode`.
|
|
31
|
+
*/
|
|
32
|
+
export type RawEvalMode = EvalMode | "agentic" | "baseline" | "full" | "observed";
|
|
33
|
+
/**
|
|
34
|
+
* The 5 canonical evaluation modes.
|
|
35
|
+
* Single source of truth — normalizeMode() and Zod schemas derive from these.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CANONICAL_EVAL_MODES: readonly ["literacy", "mcp-server", "agent-harness", "knowledge-probe", "custom"];
|
|
38
|
+
/** Legacy CLI aliases that map to `mode: "literacy"` + variant. */
|
|
39
|
+
export declare const LEGACY_EVAL_MODE_ALIASES: readonly ["baseline", "agentic", "observed", "full"];
|
|
40
|
+
/**
|
|
41
|
+
* All accepted mode names for Zod enum construction.
|
|
42
|
+
* Canonical modes first, then legacy aliases.
|
|
43
|
+
*/
|
|
44
|
+
export declare const RAW_EVAL_MODES: readonly ["literacy", "mcp-server", "agent-harness", "knowledge-probe", "custom", "baseline", "agentic", "observed", "full"];
|
|
@@ -4,5 +4,29 @@
|
|
|
4
4
|
* Shared between eval (pipeline orchestrator) and studio (GROQ filters, UI).
|
|
5
5
|
* A new mode added here is immediately visible to both packages.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The 5 canonical evaluation modes.
|
|
9
|
+
* Single source of truth — normalizeMode() and Zod schemas derive from these.
|
|
10
|
+
*/
|
|
11
|
+
export const CANONICAL_EVAL_MODES = [
|
|
12
|
+
"literacy",
|
|
13
|
+
"mcp-server",
|
|
14
|
+
"agent-harness",
|
|
15
|
+
"knowledge-probe",
|
|
16
|
+
"custom",
|
|
17
|
+
];
|
|
18
|
+
/** Legacy CLI aliases that map to `mode: "literacy"` + variant. */
|
|
19
|
+
export const LEGACY_EVAL_MODE_ALIASES = [
|
|
20
|
+
"baseline",
|
|
21
|
+
"agentic",
|
|
22
|
+
"observed",
|
|
23
|
+
"full",
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* All accepted mode names for Zod enum construction.
|
|
27
|
+
* Canonical modes first, then legacy aliases.
|
|
28
|
+
*/
|
|
29
|
+
export const RAW_EVAL_MODES = [
|
|
30
|
+
...CANONICAL_EVAL_MODES,
|
|
31
|
+
...LEGACY_EVAL_MODE_ALIASES,
|
|
32
|
+
];
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { existsSync } from "fs";
|
|
16
16
|
import { resolve } from "path";
|
|
17
17
|
import { PipelineRequestSchema, } from "../../_vendor/ailf-core/index.js";
|
|
18
|
+
import { LiteracyVariant } from "../../pipeline/normalize-mode.js";
|
|
18
19
|
import { RepoTaskSource } from "../task-sources/repo-task-source.js";
|
|
19
20
|
// ---------------------------------------------------------------------------
|
|
20
21
|
// Public API
|
|
@@ -35,7 +36,7 @@ export async function buildRemoteRequest(options) {
|
|
|
35
36
|
// 1. Load and validate local tasks
|
|
36
37
|
const taskSource = new RepoTaskSource(tasksDir);
|
|
37
38
|
const filterOptions = buildFilterOptions(config);
|
|
38
|
-
const tasks = await taskSource.loadTasks(filterOptions);
|
|
39
|
+
const tasks = (await taskSource.loadTasks(filterOptions)).filter((t) => t.mode === "literacy");
|
|
39
40
|
if (tasks.length === 0) {
|
|
40
41
|
throw new Error("No tasks found after applying filters.\n" +
|
|
41
42
|
` Tasks directory: ${tasksDir}\n` +
|
|
@@ -51,7 +52,7 @@ export async function buildRemoteRequest(options) {
|
|
|
51
52
|
inlineTasks,
|
|
52
53
|
};
|
|
53
54
|
// Mode
|
|
54
|
-
if (config.mode && config.mode !==
|
|
55
|
+
if (config.mode && config.mode !== LiteracyVariant.FULL) {
|
|
55
56
|
raw.mode = config.mode;
|
|
56
57
|
}
|
|
57
58
|
// Debug
|
|
@@ -144,25 +145,25 @@ export function resolveTasksDir(rootDir, explicitPath) {
|
|
|
144
145
|
// Helpers
|
|
145
146
|
// ---------------------------------------------------------------------------
|
|
146
147
|
/**
|
|
147
|
-
* Convert a
|
|
148
|
-
* by the API.
|
|
149
|
-
* `mapToTaskDefinition()`.
|
|
148
|
+
* Convert a LiteracyTaskDefinition to the camelCase inline format expected
|
|
149
|
+
* by the API.
|
|
150
150
|
*/
|
|
151
151
|
function taskToInlineFormat(task) {
|
|
152
152
|
const inline = {
|
|
153
153
|
id: task.id,
|
|
154
|
-
description: task.
|
|
155
|
-
featureArea: task.
|
|
156
|
-
assert: task.assertions,
|
|
154
|
+
description: task.title,
|
|
155
|
+
featureArea: task.area ?? "",
|
|
156
|
+
assert: task.assertions ?? [],
|
|
157
157
|
};
|
|
158
|
-
if (task.
|
|
159
|
-
inline.canonicalDocs = task.
|
|
158
|
+
if (task.context?.docs?.length) {
|
|
159
|
+
inline.canonicalDocs = task.context.docs;
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
const taskPrompt = task.prompt?.text ?? "";
|
|
162
|
+
if (taskPrompt) {
|
|
162
163
|
inline.vars = {
|
|
163
|
-
task:
|
|
164
|
+
task: taskPrompt,
|
|
164
165
|
docs: "",
|
|
165
|
-
...(task.
|
|
166
|
+
...(task.prompt?.vars ?? {}),
|
|
166
167
|
};
|
|
167
168
|
}
|
|
168
169
|
if (task.docCoverage) {
|
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* FileConfigAdapter — resolves pipeline config from a local
|
|
2
|
+
* FileConfigAdapter — resolves pipeline config from a local config file.
|
|
3
3
|
*
|
|
4
|
-
* Enables `ailf pipeline --config
|
|
5
|
-
*
|
|
4
|
+
* Enables `ailf pipeline --config <path>` to load all pipeline options
|
|
5
|
+
* from a file instead of CLI flags. Supports multiple formats in
|
|
6
|
+
* priority order:
|
|
6
7
|
*
|
|
7
|
-
* 1.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 1. TypeScript (.ts) — loaded via jiti, validated through Zod
|
|
9
|
+
* 2. JavaScript (.js) — loaded via jiti, validated through Zod
|
|
10
|
+
* 3. YAML (.yaml/.yml) — parsed via js-yaml, validated through Zod
|
|
11
|
+
* 4. JSON (.json) — parsed via JSON.parse, tries PipelineRequestSchema
|
|
12
|
+
* first (API contract), then EvalConfigSchema (developer config)
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
+
* Schemas:
|
|
15
|
+
* - PipelineRequestSchema (JSON only) — the universal API contract.
|
|
16
|
+
* Used by: API gateway payloads, GitHub Actions dispatch.
|
|
17
|
+
* - EvalConfigSchema (all formats) — the developer-facing config.
|
|
18
|
+
* Used by: local config files, manual --config usage.
|
|
14
19
|
*
|
|
15
20
|
* @see packages/core/src/schemas/pipeline-request.ts — PipelineRequestSchema
|
|
16
21
|
* @see packages/core/src/schemas/eval-config.ts — EvalConfigSchema
|
|
22
|
+
* @see docs/design-docs/architecture-overhaul/typescript-configuration.md
|
|
17
23
|
*/
|
|
18
|
-
import { type ResolvedConfig } from "../../_vendor/ailf-core/index.d.ts";
|
|
19
|
-
import type { ConfigSource } from "../../_vendor/ailf-core/index.d.ts";
|
|
24
|
+
import { type ConfigSource, type ResolvedConfig } from "../../_vendor/ailf-core/index.d.ts";
|
|
20
25
|
export declare class FileConfigAdapter implements ConfigSource {
|
|
21
26
|
private readonly filePath;
|
|
22
27
|
private readonly rootDir;
|
|
23
28
|
readonly label: string;
|
|
24
29
|
constructor(filePath: string, rootDir: string);
|
|
25
30
|
resolve(): Promise<ResolvedConfig>;
|
|
31
|
+
/**
|
|
32
|
+
* Validate the raw config object through Zod and map to ResolvedConfig.
|
|
33
|
+
*/
|
|
34
|
+
private validateAndMap;
|
|
26
35
|
}
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* FileConfigAdapter — resolves pipeline config from a local
|
|
2
|
+
* FileConfigAdapter — resolves pipeline config from a local config file.
|
|
3
3
|
*
|
|
4
|
-
* Enables `ailf pipeline --config
|
|
5
|
-
*
|
|
4
|
+
* Enables `ailf pipeline --config <path>` to load all pipeline options
|
|
5
|
+
* from a file instead of CLI flags. Supports multiple formats in
|
|
6
|
+
* priority order:
|
|
6
7
|
*
|
|
7
|
-
* 1.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 1. TypeScript (.ts) — loaded via jiti, validated through Zod
|
|
9
|
+
* 2. JavaScript (.js) — loaded via jiti, validated through Zod
|
|
10
|
+
* 3. YAML (.yaml/.yml) — parsed via js-yaml, validated through Zod
|
|
11
|
+
* 4. JSON (.json) — parsed via JSON.parse, tries PipelineRequestSchema
|
|
12
|
+
* first (API contract), then EvalConfigSchema (developer config)
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
+
* Schemas:
|
|
15
|
+
* - PipelineRequestSchema (JSON only) — the universal API contract.
|
|
16
|
+
* Used by: API gateway payloads, GitHub Actions dispatch.
|
|
17
|
+
* - EvalConfigSchema (all formats) — the developer-facing config.
|
|
18
|
+
* Used by: local config files, manual --config usage.
|
|
14
19
|
*
|
|
15
20
|
* @see packages/core/src/schemas/pipeline-request.ts — PipelineRequestSchema
|
|
16
21
|
* @see packages/core/src/schemas/eval-config.ts — EvalConfigSchema
|
|
22
|
+
* @see docs/design-docs/architecture-overhaul/typescript-configuration.md
|
|
17
23
|
*/
|
|
18
24
|
import { readFileSync } from "fs";
|
|
19
25
|
import { extname } from "path";
|
|
20
26
|
import { EvalConfigSchema, PipelineRequestSchema, } from "../../_vendor/ailf-core/index.js";
|
|
21
27
|
import { mapRequestToConfig } from "../../pipeline/map-request-to-config.js";
|
|
28
|
+
import { normalizeMode } from "../../pipeline/normalize-mode.js";
|
|
29
|
+
import { loadTsConfig } from "./ts-config-loader.js";
|
|
22
30
|
export class FileConfigAdapter {
|
|
23
31
|
filePath;
|
|
24
32
|
rootDir;
|
|
@@ -29,8 +37,23 @@ export class FileConfigAdapter {
|
|
|
29
37
|
this.label = `config file: ${filePath}`;
|
|
30
38
|
}
|
|
31
39
|
async resolve() {
|
|
32
|
-
const raw = readConfigFile(this.filePath);
|
|
33
40
|
const ext = extname(this.filePath).toLowerCase();
|
|
41
|
+
// TypeScript / JavaScript files — load via jiti
|
|
42
|
+
if (ext === ".ts" || ext === ".js") {
|
|
43
|
+
const result = await loadTsConfig(this.filePath);
|
|
44
|
+
if (!result.ok) {
|
|
45
|
+
throw new Error(result.error);
|
|
46
|
+
}
|
|
47
|
+
return this.validateAndMap(result.value, ext);
|
|
48
|
+
}
|
|
49
|
+
// YAML / JSON files — load via fs
|
|
50
|
+
const raw = readConfigFile(this.filePath);
|
|
51
|
+
return this.validateAndMap(raw, ext);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validate the raw config object through Zod and map to ResolvedConfig.
|
|
55
|
+
*/
|
|
56
|
+
validateAndMap(raw, ext) {
|
|
34
57
|
// For JSON files, try PipelineRequestSchema first (API contract)
|
|
35
58
|
if (ext === ".json") {
|
|
36
59
|
const pipelineResult = PipelineRequestSchema.safeParse(raw);
|
|
@@ -38,7 +61,7 @@ export class FileConfigAdapter {
|
|
|
38
61
|
return mapRequestToConfig(pipelineResult.data, this.rootDir);
|
|
39
62
|
}
|
|
40
63
|
}
|
|
41
|
-
// Fall back to EvalConfigSchema (developer config)
|
|
64
|
+
// Fall back to EvalConfigSchema (developer config) — works for all formats
|
|
42
65
|
const validated = EvalConfigSchema.parse(raw);
|
|
43
66
|
return mapEvalConfigToResolvedConfig(validated, this.rootDir);
|
|
44
67
|
}
|
|
@@ -66,9 +89,12 @@ function mapEvalConfigToResolvedConfig(config, rootDir) {
|
|
|
66
89
|
else if (typeof config.debug === "object") {
|
|
67
90
|
debug = { enabled: config.debug.enabled ?? true, ...config.debug };
|
|
68
91
|
}
|
|
92
|
+
// Normalize legacy mode names (e.g., "full" → literacy + variant)
|
|
93
|
+
const normalized = normalizeMode(config.mode ?? "literacy");
|
|
69
94
|
return {
|
|
70
95
|
rootDir,
|
|
71
|
-
mode:
|
|
96
|
+
mode: normalized.mode,
|
|
97
|
+
variant: normalized.variant,
|
|
72
98
|
noAutoScope: config.noAutoScope ?? false,
|
|
73
99
|
debug,
|
|
74
100
|
areas: config.areas,
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { CliConfigAdapter } from "./cli-config-adapter.js";
|
|
2
2
|
export { FileConfigAdapter } from "./file-config-adapter.js";
|
|
3
|
+
export { checkFormatConflict, loadTsConfig, resolveConfigPath, } from "./ts-config-loader.js";
|
|
4
|
+
export type { TsLoadResult } from "./ts-config-loader.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TsConfigLoader — loads TypeScript/JavaScript configuration files via jiti.
|
|
3
|
+
*
|
|
4
|
+
* Provides the runtime loading layer for TypeScript configuration files
|
|
5
|
+
* (ailf.config.ts, config/models.ts, tasks/*.task.ts, etc.). Uses `jiti`
|
|
6
|
+
* for zero-config TypeScript import with ESM/CJS support.
|
|
7
|
+
*
|
|
8
|
+
* The loader:
|
|
9
|
+
* 1. Imports the file via jiti (strips types, handles ESM interop)
|
|
10
|
+
* 2. Extracts the default export
|
|
11
|
+
* 3. Returns the raw object — validation is the caller's responsibility
|
|
12
|
+
*
|
|
13
|
+
* @see docs/design-docs/architecture-overhaul/typescript-configuration.md
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Result of a TS config load attempt.
|
|
17
|
+
*
|
|
18
|
+
* - `ok: true` — file loaded successfully; `value` is the default export.
|
|
19
|
+
* - `ok: false` — file not found or load failed; `error` describes what
|
|
20
|
+
* happened.
|
|
21
|
+
*/
|
|
22
|
+
export type TsLoadResult<T = unknown> = {
|
|
23
|
+
ok: true;
|
|
24
|
+
value: T;
|
|
25
|
+
path: string;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
error: string;
|
|
29
|
+
path: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Load a TypeScript or JavaScript config file and return its default export.
|
|
33
|
+
*
|
|
34
|
+
* Does NOT validate the result — the caller is responsible for passing
|
|
35
|
+
* the returned value through the appropriate Zod schema.
|
|
36
|
+
*
|
|
37
|
+
* @param filePath - Absolute path to the .ts or .js file
|
|
38
|
+
* @returns The default export of the file, or an error
|
|
39
|
+
*/
|
|
40
|
+
export declare function loadTsConfig<T = unknown>(filePath: string): Promise<TsLoadResult<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a config file path with the TS > JS > YAML > JSON priority chain.
|
|
43
|
+
*
|
|
44
|
+
* Given a base path without extension (e.g., `"/path/to/config/models"`),
|
|
45
|
+
* returns the first existing file in priority order, or null if none exist.
|
|
46
|
+
*
|
|
47
|
+
* @param basePath - Path without extension
|
|
48
|
+
* @returns The resolved path with extension, or null
|
|
49
|
+
*/
|
|
50
|
+
export declare function resolveConfigPath(basePath: string): {
|
|
51
|
+
path: string;
|
|
52
|
+
format: "json" | "ts" | "yaml";
|
|
53
|
+
} | null;
|
|
54
|
+
/**
|
|
55
|
+
* Check if a higher-priority TS/JS file exists alongside a YAML/JSON file.
|
|
56
|
+
*
|
|
57
|
+
* Returns a warning message if both exist, or null if no conflict.
|
|
58
|
+
*/
|
|
59
|
+
export declare function checkFormatConflict(basePath: string, activeFormat: "json" | "ts" | "yaml"): string | null;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TsConfigLoader — loads TypeScript/JavaScript configuration files via jiti.
|
|
3
|
+
*
|
|
4
|
+
* Provides the runtime loading layer for TypeScript configuration files
|
|
5
|
+
* (ailf.config.ts, config/models.ts, tasks/*.task.ts, etc.). Uses `jiti`
|
|
6
|
+
* for zero-config TypeScript import with ESM/CJS support.
|
|
7
|
+
*
|
|
8
|
+
* The loader:
|
|
9
|
+
* 1. Imports the file via jiti (strips types, handles ESM interop)
|
|
10
|
+
* 2. Extracts the default export
|
|
11
|
+
* 3. Returns the raw object — validation is the caller's responsibility
|
|
12
|
+
*
|
|
13
|
+
* @see docs/design-docs/architecture-overhaul/typescript-configuration.md
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync } from "fs";
|
|
16
|
+
import { createJiti } from "jiti";
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Singleton jiti instance — reused across all loads for caching
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
let _jiti = null;
|
|
21
|
+
function getJiti() {
|
|
22
|
+
if (!_jiti) {
|
|
23
|
+
_jiti = createJiti(import.meta.url, {
|
|
24
|
+
// Interop: handle both `export default` and `module.exports`
|
|
25
|
+
interopDefault: true,
|
|
26
|
+
// Don't require file extensions in imports
|
|
27
|
+
requireCache: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return _jiti;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Load a TypeScript or JavaScript config file and return its default export.
|
|
34
|
+
*
|
|
35
|
+
* Does NOT validate the result — the caller is responsible for passing
|
|
36
|
+
* the returned value through the appropriate Zod schema.
|
|
37
|
+
*
|
|
38
|
+
* @param filePath - Absolute path to the .ts or .js file
|
|
39
|
+
* @returns The default export of the file, or an error
|
|
40
|
+
*/
|
|
41
|
+
export async function loadTsConfig(filePath) {
|
|
42
|
+
if (!existsSync(filePath)) {
|
|
43
|
+
return { ok: false, error: `File not found: ${filePath}`, path: filePath };
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const jiti = getJiti();
|
|
47
|
+
const mod = await jiti.import(filePath);
|
|
48
|
+
const value = extractDefault(mod);
|
|
49
|
+
if (value === undefined || value === null) {
|
|
50
|
+
return {
|
|
51
|
+
ok: false,
|
|
52
|
+
error: `No default export found in ${filePath}. Config files must use \`export default\`.`,
|
|
53
|
+
path: filePath,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return { ok: true, value: value, path: filePath };
|
|
57
|
+
}
|
|
58
|
+
catch (cause) {
|
|
59
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
60
|
+
return {
|
|
61
|
+
ok: false,
|
|
62
|
+
error: `Failed to load ${filePath}: ${message}`,
|
|
63
|
+
path: filePath,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolve a config file path with the TS > JS > YAML > JSON priority chain.
|
|
69
|
+
*
|
|
70
|
+
* Given a base path without extension (e.g., `"/path/to/config/models"`),
|
|
71
|
+
* returns the first existing file in priority order, or null if none exist.
|
|
72
|
+
*
|
|
73
|
+
* @param basePath - Path without extension
|
|
74
|
+
* @returns The resolved path with extension, or null
|
|
75
|
+
*/
|
|
76
|
+
export function resolveConfigPath(basePath) {
|
|
77
|
+
const candidates = [
|
|
78
|
+
{ ext: ".ts", format: "ts" },
|
|
79
|
+
{ ext: ".js", format: "ts" }, // JS files also go through jiti
|
|
80
|
+
{ ext: ".yaml", format: "yaml" },
|
|
81
|
+
{ ext: ".yml", format: "yaml" },
|
|
82
|
+
{ ext: ".json", format: "json" },
|
|
83
|
+
];
|
|
84
|
+
for (const { ext, format } of candidates) {
|
|
85
|
+
const candidate = basePath + ext;
|
|
86
|
+
if (existsSync(candidate)) {
|
|
87
|
+
return { path: candidate, format };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check if a higher-priority TS/JS file exists alongside a YAML/JSON file.
|
|
94
|
+
*
|
|
95
|
+
* Returns a warning message if both exist, or null if no conflict.
|
|
96
|
+
*/
|
|
97
|
+
export function checkFormatConflict(basePath, activeFormat) {
|
|
98
|
+
if (activeFormat !== "ts")
|
|
99
|
+
return null;
|
|
100
|
+
// Check if a YAML file also exists
|
|
101
|
+
for (const ext of [".yaml", ".yml"]) {
|
|
102
|
+
if (existsSync(basePath + ext)) {
|
|
103
|
+
return (`Both TypeScript and YAML config files exist for ${basePath}. ` +
|
|
104
|
+
`Using TypeScript file; YAML file (${basePath + ext}) is ignored.`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Helpers
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
/**
|
|
113
|
+
* Extract the default export from a module, handling ESM/CJS interop.
|
|
114
|
+
*
|
|
115
|
+
* Handles these shapes:
|
|
116
|
+
* - `{ default: value }` (ESM default export)
|
|
117
|
+
* - `value` (already the export)
|
|
118
|
+
* - `{ default: { default: value } }` (double-wrapped by interop)
|
|
119
|
+
*/
|
|
120
|
+
function extractDefault(mod) {
|
|
121
|
+
if (mod === null || mod === undefined)
|
|
122
|
+
return mod;
|
|
123
|
+
// If it's an object with a `default` property, unwrap it
|
|
124
|
+
if (typeof mod === "object" && "default" in mod) {
|
|
125
|
+
const inner = mod.default;
|
|
126
|
+
// Handle double-wrapping
|
|
127
|
+
if (inner !== null && typeof inner === "object" && "default" in inner) {
|
|
128
|
+
return inner.default;
|
|
129
|
+
}
|
|
130
|
+
return inner;
|
|
131
|
+
}
|
|
132
|
+
return mod;
|
|
133
|
+
}
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
* The pipeline step (FetchDocsStep) calls ctx.docFetcher.fetch() and
|
|
14
14
|
* writes the returned metadata to disk for downstream consumption.
|
|
15
15
|
*/
|
|
16
|
-
import { type DocFetcher, type DocSourceConfig, type FetchResult, type
|
|
16
|
+
import { type DocFetcher, type DocSourceConfig, type FetchResult, type GeneralizedTaskDefinition } from "../../_vendor/ailf-core/index.d.ts";
|
|
17
17
|
export declare class SanityDocFetcher implements DocFetcher {
|
|
18
18
|
private readonly rootDir;
|
|
19
19
|
constructor(rootDir: string);
|
|
20
|
-
fetch(tasks:
|
|
20
|
+
fetch(tasks: GeneralizedTaskDefinition[], source?: DocSourceConfig): Promise<FetchResult>;
|
|
21
|
+
private fetchInternal;
|
|
21
22
|
private fetchManifest;
|
|
22
23
|
/**
|
|
23
24
|
* Batch-resolve document ID refs to their article slugs.
|
|
@@ -65,6 +65,11 @@ export class SanityDocFetcher {
|
|
|
65
65
|
this.rootDir = rootDir;
|
|
66
66
|
}
|
|
67
67
|
async fetch(tasks, source) {
|
|
68
|
+
// Narrow to literacy tasks — only they have context.docs for doc resolution.
|
|
69
|
+
const literacyTasks = tasks.filter((t) => t.mode === "literacy");
|
|
70
|
+
return this.fetchInternal(literacyTasks, source);
|
|
71
|
+
}
|
|
72
|
+
async fetchInternal(tasks, source) {
|
|
68
73
|
// 1. Collect all unique slugs and IDs across every task.
|
|
69
74
|
// ID refs are resolved to slugs via a batch query so the rest of the
|
|
70
75
|
// slug-based pipeline works unchanged.
|
|
@@ -73,7 +78,7 @@ export class SanityDocFetcher {
|
|
|
73
78
|
const pathRefs = [];
|
|
74
79
|
const perspectiveRefs = [];
|
|
75
80
|
for (const task of tasks) {
|
|
76
|
-
for (const ref of task.
|
|
81
|
+
for (const ref of task.context?.docs ?? []) {
|
|
77
82
|
if (isSlugRef(ref)) {
|
|
78
83
|
allSlugs.add(ref.slug);
|
|
79
84
|
}
|
|
@@ -212,7 +217,7 @@ export class SanityDocFetcher {
|
|
|
212
217
|
const contexts = tasks.map((task) => {
|
|
213
218
|
const parts = [];
|
|
214
219
|
const slugs = [];
|
|
215
|
-
for (const ref of task.
|
|
220
|
+
for (const ref of task.context?.docs ?? []) {
|
|
216
221
|
// Perspective refs expand to multiple slugs
|
|
217
222
|
if (isPerspectiveRef(ref)) {
|
|
218
223
|
const expanded = perspectiveToSlugs.get(ref.perspective) ?? [];
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* logged on ID collision.
|
|
8
8
|
*
|
|
9
9
|
* This is how the pipeline sees both Content Lake tasks and repo-based
|
|
10
|
-
* tasks in a single
|
|
10
|
+
* tasks in a single GeneralizedTaskDefinition[].
|
|
11
11
|
*
|
|
12
12
|
* @see packages/core/src/ports/task-source.ts — TaskSource port
|
|
13
13
|
* @see docs/exec-plans/tasks-as-content/phase-4-repo-based-tasks.md
|
|
14
14
|
*/
|
|
15
|
-
import type { FilterOptions,
|
|
15
|
+
import type { FilterOptions, GeneralizedTaskDefinition, TaskSource } from "../../_vendor/ailf-core/index.d.ts";
|
|
16
16
|
export declare class CompositeTaskSource implements TaskSource {
|
|
17
17
|
private readonly sources;
|
|
18
18
|
constructor(sources: TaskSource[]);
|
|
19
|
-
loadTasks(filter?: FilterOptions): Promise<
|
|
19
|
+
loadTasks(filter?: FilterOptions): Promise<GeneralizedTaskDefinition[]>;
|
|
20
20
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* logged on ID collision.
|
|
8
8
|
*
|
|
9
9
|
* This is how the pipeline sees both Content Lake tasks and repo-based
|
|
10
|
-
* tasks in a single
|
|
10
|
+
* tasks in a single GeneralizedTaskDefinition[].
|
|
11
11
|
*
|
|
12
12
|
* @see packages/core/src/ports/task-source.ts — TaskSource port
|
|
13
13
|
* @see docs/exec-plans/tasks-as-content/phase-4-repo-based-tasks.md
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapter: Load task definitions from the Sanity Content Lake.
|
|
3
3
|
*
|
|
4
|
-
* Fetches ailf.task documents via GROQ and maps them to
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Fetches ailf.task documents via GROQ and maps them to
|
|
5
|
+
* GeneralizedTaskDefinition (LiteracyTaskDefinition variant). This
|
|
6
|
+
* adapter is the Content Lake counterpart of YamlTaskSource — both
|
|
7
|
+
* produce identical GeneralizedTaskDefinition[] for the same logical
|
|
8
|
+
* tasks. The pipeline never knows which adapter loaded the tasks.
|
|
8
9
|
*
|
|
9
10
|
* Wired in the composition root when --task-source content-lake is set.
|
|
10
11
|
*
|
|
@@ -12,9 +13,9 @@
|
|
|
12
13
|
* @see docs/exec-plans/tasks-as-content/phase-2-pipeline-integration.md
|
|
13
14
|
*/
|
|
14
15
|
import type { SanityClient } from "@sanity/client";
|
|
15
|
-
import type { FilterOptions,
|
|
16
|
+
import type { FilterOptions, GeneralizedTaskDefinition, TaskSource } from "../../_vendor/ailf-core/index.d.ts";
|
|
16
17
|
export declare class ContentLakeTaskSource implements TaskSource {
|
|
17
18
|
private readonly client;
|
|
18
19
|
constructor(client: SanityClient);
|
|
19
|
-
loadTasks(filter?: FilterOptions): Promise<
|
|
20
|
+
loadTasks(filter?: FilterOptions): Promise<GeneralizedTaskDefinition[]>;
|
|
20
21
|
}
|