@sanity/ailf 4.6.0 → 6.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/canonical/grader-references/agent-harness-tools.yaml +42 -0
- package/canonical/grader-references/knowledge-probe-recall.yaml +36 -0
- package/canonical/grader-references/mcp-server-spec.yaml +51 -0
- package/canonical/grader-references/portable-text.yaml +48 -0
- package/config/diagnosis-cards.ts +318 -0
- package/config/models.ts +12 -0
- package/config/rubrics.ts +38 -2
- package/dist/_vendor/ailf-core/artifact-registry.d.ts +60 -2
- package/dist/_vendor/ailf-core/artifact-registry.js +288 -7
- package/dist/_vendor/ailf-core/examples/index.d.ts +125 -26
- package/dist/_vendor/ailf-core/examples/index.js +146 -47
- package/dist/_vendor/ailf-core/grader/failure-modes/agent-harness.d.ts +13 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/agent-harness.js +16 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/common.d.ts +14 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/common.js +18 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/index.d.ts +45 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/index.js +109 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/knowledge-probe.d.ts +13 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/knowledge-probe.js +17 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/literacy.d.ts +13 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/literacy.js +17 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/mcp.d.ts +13 -0
- package/dist/_vendor/ailf-core/grader/failure-modes/mcp.js +17 -0
- package/dist/_vendor/ailf-core/index.d.ts +1 -0
- package/dist/_vendor/ailf-core/index.js +4 -0
- package/dist/_vendor/ailf-core/ports/context.d.ts +8 -0
- package/dist/_vendor/ailf-core/ports/mode-handler.d.ts +15 -0
- package/dist/_vendor/ailf-core/schemas/branded-string.d.ts +40 -0
- package/dist/_vendor/ailf-core/schemas/branded-string.js +45 -0
- package/dist/_vendor/ailf-core/schemas/confidence-schema.d.ts +36 -0
- package/dist/_vendor/ailf-core/schemas/confidence-schema.js +32 -0
- package/dist/_vendor/ailf-core/schemas/eval-config.d.ts +1 -0
- package/dist/_vendor/ailf-core/schemas/eval-config.js +8 -4
- package/dist/_vendor/ailf-core/schemas/index.d.ts +2 -0
- package/dist/_vendor/ailf-core/schemas/index.js +9 -0
- package/dist/_vendor/ailf-core/schemas/pipeline-request.d.ts +1 -0
- package/dist/_vendor/ailf-core/schemas/pipeline-request.js +1 -0
- package/dist/_vendor/ailf-core/schemas/pipeline.d.ts +34 -8
- package/dist/_vendor/ailf-core/schemas/pipeline.js +23 -1
- package/dist/_vendor/ailf-core/services/diagnosis/card-validators.d.ts +41 -0
- package/dist/_vendor/ailf-core/services/diagnosis/card-validators.js +40 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/__tests__/area-summary.test.d.ts +7 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/__tests__/area-summary.test.js +131 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/__tests__/failure-mode-summary.test.d.ts +7 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/__tests__/failure-mode-summary.test.js +171 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/__tests__/no-issues.test.d.ts +7 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/__tests__/no-issues.test.js +155 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/area-summary.d.ts +17 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/area-summary.js +43 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/doc-attribution-spotlight.d.ts +46 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/doc-attribution-spotlight.js +104 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/failure-mode-summary.d.ts +28 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/failure-mode-summary.js +96 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/index.d.ts +39 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/index.js +52 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/low-confidence-attribution.d.ts +27 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/low-confidence-attribution.js +77 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/no-issues.d.ts +32 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/no-issues.js +71 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/regression-vs-baseline.d.ts +44 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/regression-vs-baseline.js +126 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/top-recommendations.d.ts +41 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/top-recommendations.js +107 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/weakest-area.d.ts +43 -0
- package/dist/_vendor/ailf-core/services/diagnosis/cards/weakest-area.js +114 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompt-builders.d.ts +72 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompt-builders.js +273 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/doc-attribution-spotlight.system.d.ts +17 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/doc-attribution-spotlight.system.js +58 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/index.d.ts +10 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/index.js +10 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/low-confidence-attribution.system.d.ts +15 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/low-confidence-attribution.system.js +53 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/regression-vs-baseline.system.d.ts +14 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/regression-vs-baseline.system.js +63 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/top-recommendations.system.d.ts +16 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/top-recommendations.system.js +78 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/weakest-area.system.d.ts +16 -0
- package/dist/_vendor/ailf-core/services/diagnosis/prompts/weakest-area.system.js +86 -0
- package/dist/_vendor/ailf-core/services/diagnosis/registry.d.ts +50 -0
- package/dist/_vendor/ailf-core/services/diagnosis/registry.js +35 -0
- package/dist/_vendor/ailf-core/services/diagnosis-runner.d.ts +136 -0
- package/dist/_vendor/ailf-core/services/diagnosis-runner.js +153 -0
- package/dist/_vendor/ailf-core/services/index.d.ts +6 -0
- package/dist/_vendor/ailf-core/services/index.js +18 -0
- package/dist/_vendor/ailf-core/services/llm-client-factory.d.ts +64 -0
- package/dist/_vendor/ailf-core/services/llm-client-factory.js +54 -0
- package/dist/_vendor/ailf-core/services/report-to-markdown.js +3 -2
- package/dist/_vendor/ailf-core/types/attribution.d.ts +82 -0
- package/dist/_vendor/ailf-core/types/attribution.js +18 -0
- package/dist/_vendor/ailf-core/types/branded-ids.d.ts +26 -1
- package/dist/_vendor/ailf-core/types/branded-ids.js +80 -4
- package/dist/_vendor/ailf-core/types/confidence.d.ts +1 -1
- package/dist/_vendor/ailf-core/types/confidence.js +7 -0
- package/dist/_vendor/ailf-core/types/diagnosis.d.ts +271 -0
- package/dist/_vendor/ailf-core/types/diagnosis.js +19 -0
- package/dist/_vendor/ailf-core/types/generalized-task.d.ts +16 -1
- package/dist/_vendor/ailf-core/types/grader-judgment.d.ts +125 -0
- package/dist/_vendor/ailf-core/types/grader-judgment.js +30 -0
- package/dist/_vendor/ailf-core/types/index.d.ts +80 -29
- package/dist/_vendor/ailf-core/types/index.js +15 -1
- package/dist/_vendor/ailf-core/types/legacy-grader-judgment.d.ts +55 -0
- package/dist/_vendor/ailf-core/types/legacy-grader-judgment.js +30 -0
- package/dist/_vendor/ailf-core/types/pipeline-request.d.ts +1 -0
- package/dist/_vendor/ailf-core/types/repo-config.d.ts +8 -0
- package/dist/_vendor/ailf-shared/document-ref.d.ts +1 -1
- package/dist/adapters/api-client/build-request.d.ts +1 -0
- package/dist/adapters/api-client/build-request.js +3 -0
- package/dist/adapters/attribution/attribution-meta-writer.d.ts +35 -0
- package/dist/adapters/attribution/attribution-meta-writer.js +34 -0
- package/dist/adapters/attribution/index.d.ts +9 -0
- package/dist/adapters/attribution/index.js +8 -0
- package/dist/adapters/attribution/per-entry-attribution-writer.d.ts +56 -0
- package/dist/adapters/attribution/per-entry-attribution-writer.js +49 -0
- package/dist/adapters/config-sources/file-config-adapter.js +1 -0
- package/dist/adapters/grader-outputs/index.d.ts +10 -0
- package/dist/adapters/grader-outputs/index.js +8 -0
- package/dist/adapters/grader-outputs/legacy/index.d.ts +11 -0
- package/dist/adapters/grader-outputs/legacy/index.js +10 -0
- package/dist/adapters/grader-outputs/legacy/promptfoo-grader-output-legacy.d.ts +49 -0
- package/dist/adapters/grader-outputs/legacy/promptfoo-grader-output-legacy.js +48 -0
- package/dist/adapters/grader-outputs/promptfoo-grader-output.d.ts +102 -0
- package/dist/adapters/grader-outputs/promptfoo-grader-output.js +93 -0
- package/dist/adapters/index.d.ts +3 -0
- package/dist/adapters/index.js +4 -0
- package/dist/adapters/llm/fake-llm-client.d.ts +20 -0
- package/dist/adapters/llm/fake-llm-client.js +38 -1
- package/dist/adapters/llm/openai-llm-client.js +52 -3
- package/dist/adapters/task-sources/content-lake-task-source.d.ts +5 -1
- package/dist/adapters/task-sources/content-lake-task-source.js +28 -2
- package/dist/adapters/task-sources/repo-schemas.d.ts +79 -11
- package/dist/adapters/task-sources/repo-schemas.js +19 -2
- package/dist/cli-program.js +3 -0
- package/dist/commands/calculate-scores.js +1 -1
- package/dist/commands/explain-handler.js +1 -1
- package/dist/commands/interpret.d.ts +50 -0
- package/dist/commands/interpret.js +212 -0
- package/dist/commands/lookup-doc.d.ts +1 -1
- package/dist/commands/lookup-doc.js +3 -3
- package/dist/commands/pipeline-action.d.ts +6 -0
- package/dist/commands/pipeline-action.js +2 -0
- package/dist/commands/remote-pipeline.js +1 -0
- package/dist/composition-root.d.ts +57 -23
- package/dist/composition-root.js +155 -41
- package/dist/config/diagnosis-cards.ts +318 -0
- package/dist/config/models.ts +12 -0
- package/dist/config/rubrics.ts +38 -2
- package/dist/grader/agent-harness.d.ts +9 -0
- package/dist/grader/agent-harness.js +9 -0
- package/dist/grader/common.d.ts +9 -0
- package/dist/grader/common.js +9 -0
- package/dist/grader/index.d.ts +24 -0
- package/dist/grader/index.js +24 -0
- package/dist/grader/knowledge-probe.d.ts +9 -0
- package/dist/grader/knowledge-probe.js +9 -0
- package/dist/grader/literacy.d.ts +9 -0
- package/dist/grader/literacy.js +9 -0
- package/dist/grader/mcp.d.ts +9 -0
- package/dist/grader/mcp.js +9 -0
- package/dist/orchestration/build-app-context.js +1 -0
- package/dist/orchestration/build-step-sequence.js +5 -0
- package/dist/orchestration/steps/calculate-scores-step.js +23 -1
- package/dist/orchestration/steps/compute-attribution-step.d.ts +44 -0
- package/dist/orchestration/steps/compute-attribution-step.js +279 -0
- package/dist/orchestration/steps/gap-analysis-step.js +35 -7
- package/dist/orchestration/steps/index.d.ts +1 -0
- package/dist/orchestration/steps/index.js +1 -0
- package/dist/pipeline/attribution.d.ts +15 -0
- package/dist/pipeline/attribution.js +18 -9
- package/dist/pipeline/borderline-consensus-runner.d.ts +63 -0
- package/dist/pipeline/borderline-consensus-runner.js +124 -0
- package/dist/pipeline/borderline-detector.d.ts +24 -0
- package/dist/pipeline/borderline-detector.js +26 -0
- package/dist/pipeline/calculate-scores.d.ts +114 -3
- package/dist/pipeline/calculate-scores.js +426 -24
- package/dist/pipeline/compiler/literacy-bridge.d.ts +1 -1
- package/dist/pipeline/compiler/literacy-bridge.js +35 -17
- package/dist/pipeline/compiler/rubric-resolution.d.ts +15 -0
- package/dist/pipeline/compiler/rubric-resolution.js +9 -1
- package/dist/pipeline/compute-attribution.d.ts +80 -0
- package/dist/pipeline/compute-attribution.js +196 -0
- package/dist/pipeline/failure-modes.d.ts +52 -17
- package/dist/pipeline/failure-modes.js +178 -117
- package/dist/pipeline/map-request-to-config.js +1 -0
- package/package.json +7 -5
|
@@ -234,17 +234,32 @@ export const exampleGroqBlogListingData = [
|
|
|
234
234
|
"type": "llm-rubric",
|
|
235
235
|
"template": "task-completion",
|
|
236
236
|
"criteria": [
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
{
|
|
238
|
+
"id": "uses-groq-template-literal",
|
|
239
|
+
"text": "Uses the groq tagged template literal"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "fetches-blog-fields",
|
|
243
|
+
"text": "Fetches blog posts with title, slug, and publishedAt fields"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"id": "orders-by-published-at",
|
|
247
|
+
"text": "Orders results by publishedAt in descending order"
|
|
248
|
+
}
|
|
240
249
|
]
|
|
241
250
|
},
|
|
242
251
|
{
|
|
243
252
|
"type": "llm-rubric",
|
|
244
253
|
"template": "code-correctness",
|
|
245
254
|
"criteria": [
|
|
246
|
-
|
|
247
|
-
|
|
255
|
+
{
|
|
256
|
+
"id": "uses-create-client",
|
|
257
|
+
"text": "Uses createClient from @sanity/client or next-sanity"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"id": "exports-nextjs-page",
|
|
261
|
+
"text": "Exports a valid Next.js page component"
|
|
262
|
+
}
|
|
248
263
|
]
|
|
249
264
|
}
|
|
250
265
|
],
|
|
@@ -256,9 +271,9 @@ export const exampleGroqBlogListingData = [
|
|
|
256
271
|
}
|
|
257
272
|
];
|
|
258
273
|
/** TypeScript task template for example-groq-blog-listing */
|
|
259
|
-
export const exampleGroqBlogListingTs = "/**\n * Example Task: Blog listing with GROQ queries.\n *\n * This is a starter template — edit it for your own documentation.\n * Each task evaluates whether an AI coding agent can implement a feature\n * using your docs as context. Delete this file or replace it entirely.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * Full field reference:\n * https://github.com/sanity-labs/ai-literacy-framework/blob/main/docs/contributing-tasks.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n // ── Mode ────────────────────────────────────────────────────────────\n // \"literacy\" tests whether AI coding tools can implement features\n // using your docs as context. Other modes: \"mcp-server\",\n // \"knowledge-probe\", \"agent-harness\", \"custom\".\n mode: \"literacy\",\n\n // ── Identity ────────────────────────────────────────────────────────\n // Unique identifier — lowercase alphanumeric with hyphens.\n // Must be unique across all task files in .ailf/tasks/.\n id: \"example-groq-blog-listing\",\n title: \"Blog listing with GROQ queries\",\n description: \"Example — tests GROQ blog listing implementation\",\n\n // Feature area this task belongs to. Tasks with the same area are\n // grouped together in score summaries.\n area: \"groq\",\n\n // ── Documentation context ───────────────────────────────────────────\n // Canonical doc references for this task. The pipeline fetches these\n // from Sanity and injects them into the prompt for baseline evaluation.\n //\n // This example uses slug-based references — the simplest form.\n // See the other example tasks for path, id, and perspective references.\n context: {\n docs: [\n {\n slug: \"groq-introduction\",\n reason: \"Core GROQ syntax and query language reference\",\n },\n {\n slug: \"how-queries-work\",\n reason: \"Query execution model and best practices\",\n },\n ],\n },\n\n // When true, the pipeline auto-generates an additional rubric that\n // checks whether the LLM's response actually used the provided docs.\n docCoverage: true,\n\n // Path to a gold-standard implementation, relative to canonical/.\n // The grader uses this as a reference when scoring code correctness.\n referenceSolution: \"canonical/example-groq-blog-listing.ts\",\n\n // ── Prompt ──────────────────────────────────────────────────────────\n // prompt.text — the implementation prompt given to the LLM.\n // Write this as if you're asking a developer to build the feature.\n // Be specific about requirements so the grader can evaluate clearly.\n prompt: {\n text: `Create a Next.js page component that lists blog posts from Sanity\nusing GROQ. The page should display the title, slug, and published\ndate for each post, sorted by most recent first. Use the Sanity\nclient to fetch data.`,\n },\n\n // ── Assertions ──────────────────────────────────────────────────────\n // Grading assertions — how the LLM's response is scored.\n //\n // \"llm-rubric\" assertions use a grader LLM to score against criteria.\n // The \"template\" references a rubric template (e.g. task-completion).\n //\n // Available templates:\n // task-completion — did the LLM implement the feature? (weight: 0.50)\n // code-correctness — is the code idiomatic and correct? (weight: 0.25)\n //\n // You can also use value-based assertions:\n // { type: \"contains\", value: \"client.fetch\" }\n // { type: \"contains-any\", value: [\"createClient\", \"sanityClient\"] }\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n \"Uses the groq tagged template literal\",\n \"Fetches blog posts with title, slug, and publishedAt fields\",\n \"Orders results by publishedAt in descending order\",\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n \"Uses createClient from @sanity/client or next-sanity\",\n \"Exports a valid Next.js page component\",\n ],\n },\n ],\n\n // ── Baseline variant ────────────────────────────────────────────────\n // enabled — set to false to skip this task entirely\n // rubric — \"full\" (default), \"abbreviated\" (faster), or \"none\"\n baseline: {\n enabled: true,\n rubric: \"full\",\n },\n\n // Example tasks ship as drafts so they don't run in production evals.\n // Change to \"active\" (or remove this field) to activate.\n status: \"draft\",\n})\n";
|
|
274
|
+
export const exampleGroqBlogListingTs = "/**\n * Example Task: Blog listing with GROQ queries.\n *\n * This is a starter template — edit it for your own documentation.\n * Each task evaluates whether an AI coding agent can implement a feature\n * using your docs as context. Delete this file or replace it entirely.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * Full field reference:\n * https://github.com/sanity-labs/ai-literacy-framework/blob/main/docs/contributing-tasks.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n // ── Mode ────────────────────────────────────────────────────────────\n // \"literacy\" tests whether AI coding tools can implement features\n // using your docs as context. Other modes: \"mcp-server\",\n // \"knowledge-probe\", \"agent-harness\", \"custom\".\n mode: \"literacy\",\n\n // ── Identity ────────────────────────────────────────────────────────\n // Unique identifier — lowercase alphanumeric with hyphens.\n // Must be unique across all task files in .ailf/tasks/.\n id: \"example-groq-blog-listing\",\n title: \"Blog listing with GROQ queries\",\n description: \"Example — tests GROQ blog listing implementation\",\n\n // Feature area this task belongs to. Tasks with the same area are\n // grouped together in score summaries.\n area: \"groq\",\n\n // ── Documentation context ───────────────────────────────────────────\n // Canonical doc references for this task. The pipeline fetches these\n // from Sanity and injects them into the prompt for baseline evaluation.\n //\n // This example uses slug-based references — the simplest form.\n // See the other example tasks for path, id, and perspective references.\n context: {\n docs: [\n {\n slug: \"groq-introduction\",\n reason: \"Core GROQ syntax and query language reference\",\n },\n {\n slug: \"how-queries-work\",\n reason: \"Query execution model and best practices\",\n },\n ],\n },\n\n // When true, the pipeline auto-generates an additional rubric that\n // checks whether the LLM's response actually used the provided docs.\n docCoverage: true,\n\n // Path to a gold-standard implementation, relative to canonical/.\n // The grader uses this as a reference when scoring code correctness.\n referenceSolution: \"canonical/example-groq-blog-listing.ts\",\n\n // ── Prompt ──────────────────────────────────────────────────────────\n // prompt.text — the implementation prompt given to the LLM.\n // Write this as if you're asking a developer to build the feature.\n // Be specific about requirements so the grader can evaluate clearly.\n prompt: {\n text: `Create a Next.js page component that lists blog posts from Sanity\nusing GROQ. The page should display the title, slug, and published\ndate for each post, sorted by most recent first. Use the Sanity\nclient to fetch data.`,\n },\n\n // ── Assertions ──────────────────────────────────────────────────────\n // Grading assertions — how the LLM's response is scored.\n //\n // \"llm-rubric\" assertions use a grader LLM to score against criteria.\n // The \"template\" references a rubric template (e.g. task-completion).\n //\n // Available templates:\n // task-completion — did the LLM implement the feature? (weight: 0.50)\n // code-correctness — is the code idiomatic and correct? (weight: 0.25)\n //\n // You can also use value-based assertions:\n // { type: \"contains\", value: \"client.fetch\" }\n // { type: \"contains-any\", value: [\"createClient\", \"sanityClient\"] }\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n {\n id: \"uses-groq-template-literal\",\n text: \"Uses the groq tagged template literal\",\n },\n {\n id: \"fetches-blog-fields\",\n text: \"Fetches blog posts with title, slug, and publishedAt fields\",\n },\n {\n id: \"orders-by-published-at\",\n text: \"Orders results by publishedAt in descending order\",\n },\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n {\n id: \"uses-create-client\",\n text: \"Uses createClient from @sanity/client or next-sanity\",\n },\n {\n id: \"exports-nextjs-page\",\n text: \"Exports a valid Next.js page component\",\n },\n ],\n },\n ],\n\n // ── Baseline variant ────────────────────────────────────────────────\n // enabled — set to false to skip this task entirely\n // rubric — \"full\" (default), \"abbreviated\" (faster), or \"none\"\n baseline: {\n enabled: true,\n rubric: \"full\",\n },\n\n // Example tasks ship as drafts so they don't run in production evals.\n // Change to \"active\" (or remove this field) to activate.\n status: \"draft\",\n})\n";
|
|
260
275
|
/** Generated YAML for example-groq-blog-listing (from parsed TS data) */
|
|
261
|
-
export const exampleGroqBlogListingYaml = "- mode: literacy\n id: example-groq-blog-listing\n title: Blog listing with GROQ queries\n description: Example — tests GROQ blog listing implementation\n area: groq\n context:\n docs:\n - slug: groq-introduction\n reason: Core GROQ syntax and query language reference\n - slug: how-queries-work\n reason: Query execution model and best practices\n docCoverage: true\n referenceSolution: canonical/example-groq-blog-listing.ts\n prompt:\n text: |-\n Create a Next.js page component that lists blog posts from Sanity\n using GROQ. The page should display the title, slug, and published\n date for each post, sorted by most recent first. Use the Sanity\n client to fetch data.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - Uses the groq tagged template literal\n - Fetches blog posts with title, slug, and publishedAt fields\n - Orders results by publishedAt in descending order\n - type: llm-rubric\n template: code-correctness\n criteria:\n - Uses createClient from @sanity/client or next-sanity\n - Exports a valid Next.js page component\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
276
|
+
export const exampleGroqBlogListingYaml = "- mode: literacy\n id: example-groq-blog-listing\n title: Blog listing with GROQ queries\n description: Example — tests GROQ blog listing implementation\n area: groq\n context:\n docs:\n - slug: groq-introduction\n reason: Core GROQ syntax and query language reference\n - slug: how-queries-work\n reason: Query execution model and best practices\n docCoverage: true\n referenceSolution: canonical/example-groq-blog-listing.ts\n prompt:\n text: |-\n Create a Next.js page component that lists blog posts from Sanity\n using GROQ. The page should display the title, slug, and published\n date for each post, sorted by most recent first. Use the Sanity\n client to fetch data.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - id: uses-groq-template-literal\n text: Uses the groq tagged template literal\n - id: fetches-blog-fields\n text: Fetches blog posts with title, slug, and publishedAt fields\n - id: orders-by-published-at\n text: Orders results by publishedAt in descending order\n - type: llm-rubric\n template: code-correctness\n criteria:\n - id: uses-create-client\n text: Uses createClient from @sanity/client or next-sanity\n - id: exports-nextjs-page\n text: Exports a valid Next.js page component\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
262
277
|
/** Parsed task data for example-id-based-ref (JSON-safe) */
|
|
263
278
|
export const exampleIdBasedRefData = [
|
|
264
279
|
{
|
|
@@ -290,17 +305,32 @@ export const exampleIdBasedRefData = [
|
|
|
290
305
|
"type": "llm-rubric",
|
|
291
306
|
"template": "task-completion",
|
|
292
307
|
"criteria": [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
308
|
+
{
|
|
309
|
+
"id": "groq-availability",
|
|
310
|
+
"text": "Explains GROQ availability across different Sanity contexts"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"id": "custom-groq-functions",
|
|
314
|
+
"text": "Describes custom GROQ function creation and usage"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"id": "groq-context-differences",
|
|
318
|
+
"text": "Notes differences in GROQ support between contexts"
|
|
319
|
+
}
|
|
296
320
|
]
|
|
297
321
|
},
|
|
298
322
|
{
|
|
299
323
|
"type": "llm-rubric",
|
|
300
324
|
"template": "code-correctness",
|
|
301
325
|
"criteria": [
|
|
302
|
-
|
|
303
|
-
|
|
326
|
+
{
|
|
327
|
+
"id": "valid-groq-syntax",
|
|
328
|
+
"text": "GROQ examples use valid syntax"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"id": "correct-function-api",
|
|
332
|
+
"text": "Custom function examples follow the correct API pattern"
|
|
333
|
+
}
|
|
304
334
|
]
|
|
305
335
|
}
|
|
306
336
|
],
|
|
@@ -312,9 +342,9 @@ export const exampleIdBasedRefData = [
|
|
|
312
342
|
}
|
|
313
343
|
];
|
|
314
344
|
/** TypeScript task template for example-id-based-ref */
|
|
315
|
-
export const exampleIdBasedRefTs = "/**\n * Example Task: Document ID-based canonical doc references.\n *\n * Demonstrates using `id` to reference canonical documentation by\n * Sanity document `_id`. This is useful for:\n * - Draft documents that don't have a stable slug yet\n * - Programmatic references from imports or migrations\n * - Documents where you know the _id but not the slug\n *\n * The `id` ref type can also carry optional `slug` and `path` fields\n * as human-readable annotations — these are NOT used for resolution,\n * only for display in logs and reports.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * @see docs/design-docs/canonical-doc-resolution.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-id-based-ref\",\n title: \"GROQ feature support (ID-based doc references)\",\n description: \"Example — demonstrates ID-based canonical doc references\",\n\n area: \"groq\",\n\n // ID-based canonical doc references.\n //\n // Use the Sanity document _id to reference articles directly.\n // Optional slug/path annotations help humans reading the file\n // but are NOT used for resolution — only the `id` field matters.\n //\n // These IDs reference real articles in the Sanity docs (next dataset):\n // 0ba88f1b... = \"GROQ feature support across Sanity\"\n // 5b9c2863... = \"Custom GROQ functions\"\n context: {\n docs: [\n {\n id: \"0ba88f1b-d1a7-418a-9267-2e343d01886a\",\n slug: \"groq-feature-support-by-context\", // annotation only\n reason: \"GROQ feature support across different Sanity contexts\",\n },\n {\n id: \"5b9c2863-ef01-4565-af8e-ee54e081ee74\",\n slug: \"custom-groq-functions\", // annotation only\n reason: \"Custom GROQ functions and pipelines\",\n },\n ],\n },\n\n docCoverage: true,\n\n prompt: {\n text: `Explain how GROQ is used across different Sanity contexts.\nCover the following:\n1. Which GROQ features are available in each context (API queries,\n webhooks, custom functions, access control)\n2. How to create and use custom GROQ functions\n3. Any differences in GROQ support between contexts\nProvide examples demonstrating context-specific GROQ patterns.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n \"Explains GROQ availability across different Sanity contexts\",\n \"Describes custom GROQ function creation and usage\",\n \"Notes differences in GROQ support between contexts\",\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n \"GROQ examples use valid syntax\",\n \"Custom function examples follow the correct API pattern\",\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
345
|
+
export const exampleIdBasedRefTs = "/**\n * Example Task: Document ID-based canonical doc references.\n *\n * Demonstrates using `id` to reference canonical documentation by\n * Sanity document `_id`. This is useful for:\n * - Draft documents that don't have a stable slug yet\n * - Programmatic references from imports or migrations\n * - Documents where you know the _id but not the slug\n *\n * The `id` ref type can also carry optional `slug` and `path` fields\n * as human-readable annotations — these are NOT used for resolution,\n * only for display in logs and reports.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * @see docs/design-docs/canonical-doc-resolution.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-id-based-ref\",\n title: \"GROQ feature support (ID-based doc references)\",\n description: \"Example — demonstrates ID-based canonical doc references\",\n\n area: \"groq\",\n\n // ID-based canonical doc references.\n //\n // Use the Sanity document _id to reference articles directly.\n // Optional slug/path annotations help humans reading the file\n // but are NOT used for resolution — only the `id` field matters.\n //\n // These IDs reference real articles in the Sanity docs (next dataset):\n // 0ba88f1b... = \"GROQ feature support across Sanity\"\n // 5b9c2863... = \"Custom GROQ functions\"\n context: {\n docs: [\n {\n id: \"0ba88f1b-d1a7-418a-9267-2e343d01886a\",\n slug: \"groq-feature-support-by-context\", // annotation only\n reason: \"GROQ feature support across different Sanity contexts\",\n },\n {\n id: \"5b9c2863-ef01-4565-af8e-ee54e081ee74\",\n slug: \"custom-groq-functions\", // annotation only\n reason: \"Custom GROQ functions and pipelines\",\n },\n ],\n },\n\n docCoverage: true,\n\n prompt: {\n text: `Explain how GROQ is used across different Sanity contexts.\nCover the following:\n1. Which GROQ features are available in each context (API queries,\n webhooks, custom functions, access control)\n2. How to create and use custom GROQ functions\n3. Any differences in GROQ support between contexts\nProvide examples demonstrating context-specific GROQ patterns.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n {\n id: \"groq-availability\",\n text: \"Explains GROQ availability across different Sanity contexts\",\n },\n {\n id: \"custom-groq-functions\",\n text: \"Describes custom GROQ function creation and usage\",\n },\n {\n id: \"groq-context-differences\",\n text: \"Notes differences in GROQ support between contexts\",\n },\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n { id: \"valid-groq-syntax\", text: \"GROQ examples use valid syntax\" },\n {\n id: \"correct-function-api\",\n text: \"Custom function examples follow the correct API pattern\",\n },\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
316
346
|
/** Generated YAML for example-id-based-ref (from parsed TS data) */
|
|
317
|
-
export const exampleIdBasedRefYaml = "- mode: literacy\n id: example-id-based-ref\n title: GROQ feature support (ID-based doc references)\n description: Example — demonstrates ID-based canonical doc references\n area: groq\n context:\n docs:\n - id: 0ba88f1b-d1a7-418a-9267-2e343d01886a\n slug: groq-feature-support-by-context\n reason: GROQ feature support across different Sanity contexts\n - id: 5b9c2863-ef01-4565-af8e-ee54e081ee74\n slug: custom-groq-functions\n reason: Custom GROQ functions and pipelines\n docCoverage: true\n prompt:\n text: |-\n Explain how GROQ is used across different Sanity contexts.\n Cover the following:\n 1. Which GROQ features are available in each context (API queries,\n webhooks, custom functions, access control)\n 2. How to create and use custom GROQ functions\n 3. Any differences in GROQ support between contexts\n Provide examples demonstrating context-specific GROQ patterns.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - Explains GROQ availability across different Sanity contexts\n - Describes custom GROQ function creation and usage\n - Notes differences in GROQ support between contexts\n - type: llm-rubric\n template: code-correctness\n criteria:\n - GROQ examples use valid syntax\n - Custom function examples follow the correct API pattern\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
347
|
+
export const exampleIdBasedRefYaml = "- mode: literacy\n id: example-id-based-ref\n title: GROQ feature support (ID-based doc references)\n description: Example — demonstrates ID-based canonical doc references\n area: groq\n context:\n docs:\n - id: 0ba88f1b-d1a7-418a-9267-2e343d01886a\n slug: groq-feature-support-by-context\n reason: GROQ feature support across different Sanity contexts\n - id: 5b9c2863-ef01-4565-af8e-ee54e081ee74\n slug: custom-groq-functions\n reason: Custom GROQ functions and pipelines\n docCoverage: true\n prompt:\n text: |-\n Explain how GROQ is used across different Sanity contexts.\n Cover the following:\n 1. Which GROQ features are available in each context (API queries,\n webhooks, custom functions, access control)\n 2. How to create and use custom GROQ functions\n 3. Any differences in GROQ support between contexts\n Provide examples demonstrating context-specific GROQ patterns.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - id: groq-availability\n text: Explains GROQ availability across different Sanity contexts\n - id: custom-groq-functions\n text: Describes custom GROQ function creation and usage\n - id: groq-context-differences\n text: Notes differences in GROQ support between contexts\n - type: llm-rubric\n template: code-correctness\n criteria:\n - id: valid-groq-syntax\n text: GROQ examples use valid syntax\n - id: correct-function-api\n text: Custom function examples follow the correct API pattern\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
318
348
|
/** Parsed task data for example-knowledge-probe (JSON-safe) */
|
|
319
349
|
export const exampleKnowledgeProbeData = [
|
|
320
350
|
{
|
|
@@ -331,9 +361,18 @@ export const exampleKnowledgeProbeData = [
|
|
|
331
361
|
"type": "llm-rubric",
|
|
332
362
|
"template": "task-completion",
|
|
333
363
|
"criteria": [
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
364
|
+
{
|
|
365
|
+
"id": "understands-groq-syntax",
|
|
366
|
+
"text": "Demonstrates understanding of GROQ query syntax"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"id": "filter-projection-patterns",
|
|
370
|
+
"text": "Shows filtering and projection patterns"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"id": "valid-groq-examples",
|
|
374
|
+
"text": "Code examples use valid GROQ syntax"
|
|
375
|
+
}
|
|
337
376
|
]
|
|
338
377
|
}
|
|
339
378
|
],
|
|
@@ -341,9 +380,9 @@ export const exampleKnowledgeProbeData = [
|
|
|
341
380
|
}
|
|
342
381
|
];
|
|
343
382
|
/** TypeScript task template for example-knowledge-probe */
|
|
344
|
-
export const exampleKnowledgeProbeTs = "/**\n * Example Task: Knowledge probe baseline (DRAFT).\n *\n * Tests what the model knows about a topic without providing documentation.\n * Used to establish a baseline for comparison with literacy evaluations.\n * This task is a DRAFT — it won't run unless activated or explicitly targeted.\n *\n * To activate: change status to \"active\" or remove the status field.\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"knowledge-probe\",\n id: \"example-knowledge-probe\",\n title: \"Model knowledge of GROQ syntax\",\n description: \"Example — probes baseline model knowledge (draft)\",\n area: \"groq\",\n\n prompt: {\n text: `Explain the GROQ query language used by Sanity. Cover:\n1. Basic query syntax and projections\n2. How to filter and sort results\n3. Common patterns for fetching related documents\nProvide working code examples.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n \"Demonstrates understanding of GROQ query syntax\",\n \"Shows filtering and projection patterns\",\n \"Code examples use valid GROQ syntax\",\n ],\n },\n ],\n\n status: \"draft\",\n})\n";
|
|
383
|
+
export const exampleKnowledgeProbeTs = "/**\n * Example Task: Knowledge probe baseline (DRAFT).\n *\n * Tests what the model knows about a topic without providing documentation.\n * Used to establish a baseline for comparison with literacy evaluations.\n * This task is a DRAFT — it won't run unless activated or explicitly targeted.\n *\n * To activate: change status to \"active\" or remove the status field.\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"knowledge-probe\",\n id: \"example-knowledge-probe\",\n title: \"Model knowledge of GROQ syntax\",\n description: \"Example — probes baseline model knowledge (draft)\",\n area: \"groq\",\n\n prompt: {\n text: `Explain the GROQ query language used by Sanity. Cover:\n1. Basic query syntax and projections\n2. How to filter and sort results\n3. Common patterns for fetching related documents\nProvide working code examples.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n {\n id: \"understands-groq-syntax\",\n text: \"Demonstrates understanding of GROQ query syntax\",\n },\n {\n id: \"filter-projection-patterns\",\n text: \"Shows filtering and projection patterns\",\n },\n {\n id: \"valid-groq-examples\",\n text: \"Code examples use valid GROQ syntax\",\n },\n ],\n },\n ],\n\n status: \"draft\",\n})\n";
|
|
345
384
|
/** Generated YAML for example-knowledge-probe (from parsed TS data) */
|
|
346
|
-
export const exampleKnowledgeProbeYaml = "- mode: knowledge-probe\n id: example-knowledge-probe\n title: Model knowledge of GROQ syntax\n description: Example — probes baseline model knowledge (draft)\n area: groq\n prompt:\n text: |-\n Explain the GROQ query language used by Sanity. Cover:\n 1. Basic query syntax and projections\n 2. How to filter and sort results\n 3. Common patterns for fetching related documents\n Provide working code examples.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - Demonstrates understanding of GROQ query syntax\n - Shows filtering and projection patterns\n - Code examples use valid GROQ syntax\n status: draft\n";
|
|
385
|
+
export const exampleKnowledgeProbeYaml = "- mode: knowledge-probe\n id: example-knowledge-probe\n title: Model knowledge of GROQ syntax\n description: Example — probes baseline model knowledge (draft)\n area: groq\n prompt:\n text: |-\n Explain the GROQ query language used by Sanity. Cover:\n 1. Basic query syntax and projections\n 2. How to filter and sort results\n 3. Common patterns for fetching related documents\n Provide working code examples.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - id: understands-groq-syntax\n text: Demonstrates understanding of GROQ query syntax\n - id: filter-projection-patterns\n text: Shows filtering and projection patterns\n - id: valid-groq-examples\n text: Code examples use valid GROQ syntax\n status: draft\n";
|
|
347
386
|
/** Parsed task data for example-mcp-tool-usage (JSON-safe) */
|
|
348
387
|
export const exampleMcpToolUsageData = [
|
|
349
388
|
{
|
|
@@ -367,9 +406,18 @@ export const exampleMcpToolUsageData = [
|
|
|
367
406
|
"type": "llm-rubric",
|
|
368
407
|
"template": "mcp-output-correctness",
|
|
369
408
|
"criteria": [
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
409
|
+
{
|
|
410
|
+
"id": "discovers-correct-tool",
|
|
411
|
+
"text": "Correctly discovers and selects the appropriate tool"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"id": "passes-valid-arguments",
|
|
415
|
+
"text": "Passes valid arguments to the tool"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
"id": "interprets-response",
|
|
419
|
+
"text": "Interprets the tool response coherently"
|
|
420
|
+
}
|
|
373
421
|
]
|
|
374
422
|
}
|
|
375
423
|
],
|
|
@@ -377,9 +425,9 @@ export const exampleMcpToolUsageData = [
|
|
|
377
425
|
}
|
|
378
426
|
];
|
|
379
427
|
/** TypeScript task template for example-mcp-tool-usage */
|
|
380
|
-
export const exampleMcpToolUsageTs = "/**\n * Example Task: MCP Server tool-use evaluation (DRAFT).\n *\n * Tests whether an LLM can correctly discover and invoke tools from\n * an MCP server. Replace the placeholder serverConfig with your own\n * MCP server's URL and authentication details.\n *\n * Transports:\n * - \"streamable-http\" / \"sse\" — remote servers (set url + optional headers)\n * - \"stdio\" — local process (set command instead of url)\n *\n * Authentication:\n * - `headers` — send arbitrary HTTP headers (e.g., Authorization)\n * - `auth` — structured auth config (bearer, basic, api_key, oauth)\n * Values support {{env.VAR}} syntax so secrets stay out of source control.\n *\n * This task is a DRAFT — it won't run unless activated or explicitly targeted.\n * To activate: change status to \"active\" or remove the status field.\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"mcp-server\",\n id: \"example-mcp-tool-usage\",\n title: \"MCP tool discovery and invocation\",\n description: \"Example — tests MCP server tool-use (draft)\",\n area: \"mcp\",\n\n // ── Server configuration ────────────────────────────────────\n // Replace the URL and headers below with your MCP server's details.\n //\n // For a local stdio server, use:\n // transport: \"stdio\",\n // command: \"node dist/my-mcp-server.js\",\n serverConfig: {\n transport: \"streamable-http\",\n url: \"https://your-mcp-server.example.com\",\n headers: {\n Authorization: \"Bearer {{env.MCP_AUTH_TOKEN}}\",\n },\n },\n\n // ── Capabilities ────────────────────────────────────────────\n // Restrict which MCP tools the model can call. If omitted, all\n // tools discovered from the server are available.\n // capabilities: [\"tool_a\", \"tool_b\"],\n\n prompt: {\n text: `Use the available MCP tools to complete the task.\nReplace this prompt with instructions specific to your MCP server.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"mcp-output-correctness\",\n criteria: [\n \"Correctly discovers and selects the appropriate tool\",\n \"Passes valid arguments to the tool\",\n \"Interprets the tool response coherently\",\n ],\n },\n ],\n\n status: \"draft\",\n})\n";
|
|
428
|
+
export const exampleMcpToolUsageTs = "/**\n * Example Task: MCP Server tool-use evaluation (DRAFT).\n *\n * Tests whether an LLM can correctly discover and invoke tools from\n * an MCP server. Replace the placeholder serverConfig with your own\n * MCP server's URL and authentication details.\n *\n * Transports:\n * - \"streamable-http\" / \"sse\" — remote servers (set url + optional headers)\n * - \"stdio\" — local process (set command instead of url)\n *\n * Authentication:\n * - `headers` — send arbitrary HTTP headers (e.g., Authorization)\n * - `auth` — structured auth config (bearer, basic, api_key, oauth)\n * Values support {{env.VAR}} syntax so secrets stay out of source control.\n *\n * This task is a DRAFT — it won't run unless activated or explicitly targeted.\n * To activate: change status to \"active\" or remove the status field.\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"mcp-server\",\n id: \"example-mcp-tool-usage\",\n title: \"MCP tool discovery and invocation\",\n description: \"Example — tests MCP server tool-use (draft)\",\n area: \"mcp\",\n\n // ── Server configuration ────────────────────────────────────\n // Replace the URL and headers below with your MCP server's details.\n //\n // For a local stdio server, use:\n // transport: \"stdio\",\n // command: \"node dist/my-mcp-server.js\",\n serverConfig: {\n transport: \"streamable-http\",\n url: \"https://your-mcp-server.example.com\",\n headers: {\n Authorization: \"Bearer {{env.MCP_AUTH_TOKEN}}\",\n },\n },\n\n // ── Capabilities ────────────────────────────────────────────\n // Restrict which MCP tools the model can call. If omitted, all\n // tools discovered from the server are available.\n // capabilities: [\"tool_a\", \"tool_b\"],\n\n prompt: {\n text: `Use the available MCP tools to complete the task.\nReplace this prompt with instructions specific to your MCP server.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"mcp-output-correctness\",\n criteria: [\n {\n id: \"discovers-correct-tool\",\n text: \"Correctly discovers and selects the appropriate tool\",\n },\n {\n id: \"passes-valid-arguments\",\n text: \"Passes valid arguments to the tool\",\n },\n {\n id: \"interprets-response\",\n text: \"Interprets the tool response coherently\",\n },\n ],\n },\n ],\n\n status: \"draft\",\n})\n";
|
|
381
429
|
/** Generated YAML for example-mcp-tool-usage (from parsed TS data) */
|
|
382
|
-
export const exampleMcpToolUsageYaml = "- mode: mcp-server\n id: example-mcp-tool-usage\n title: MCP tool discovery and invocation\n description: Example — tests MCP server tool-use (draft)\n area: mcp\n serverConfig:\n transport: streamable-http\n url: https://your-mcp-server.example.com\n headers:\n Authorization: Bearer {{env.MCP_AUTH_TOKEN}}\n prompt:\n text: |-\n Use the available MCP tools to complete the task.\n Replace this prompt with instructions specific to your MCP server.\n assertions:\n - type: llm-rubric\n template: mcp-output-correctness\n criteria:\n - Correctly discovers and selects the appropriate tool\n - Passes valid arguments to the tool\n - Interprets the tool response coherently\n status: draft\n";
|
|
430
|
+
export const exampleMcpToolUsageYaml = "- mode: mcp-server\n id: example-mcp-tool-usage\n title: MCP tool discovery and invocation\n description: Example — tests MCP server tool-use (draft)\n area: mcp\n serverConfig:\n transport: streamable-http\n url: https://your-mcp-server.example.com\n headers:\n Authorization: Bearer {{env.MCP_AUTH_TOKEN}}\n prompt:\n text: |-\n Use the available MCP tools to complete the task.\n Replace this prompt with instructions specific to your MCP server.\n assertions:\n - type: llm-rubric\n template: mcp-output-correctness\n criteria:\n - id: discovers-correct-tool\n text: Correctly discovers and selects the appropriate tool\n - id: passes-valid-arguments\n text: Passes valid arguments to the tool\n - id: interprets-response\n text: Interprets the tool response coherently\n status: draft\n";
|
|
383
431
|
/** Parsed task data for example-path-based-ref (JSON-safe) */
|
|
384
432
|
export const examplePathBasedRefData = [
|
|
385
433
|
{
|
|
@@ -409,18 +457,36 @@ export const examplePathBasedRefData = [
|
|
|
409
457
|
"type": "llm-rubric",
|
|
410
458
|
"template": "task-completion",
|
|
411
459
|
"criteria": [
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
460
|
+
{
|
|
461
|
+
"id": "explains-mutations",
|
|
462
|
+
"text": "Explains create, createOrReplace, patch, and delete mutations"
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"id": "required-document-fields",
|
|
466
|
+
"text": "Describes required document fields (_id, _type)"
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"id": "patch-operations",
|
|
470
|
+
"text": "Shows patch operations for field-level updates"
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"id": "practical-code-examples",
|
|
474
|
+
"text": "Includes practical code examples"
|
|
475
|
+
}
|
|
416
476
|
]
|
|
417
477
|
},
|
|
418
478
|
{
|
|
419
479
|
"type": "llm-rubric",
|
|
420
480
|
"template": "code-correctness",
|
|
421
481
|
"criteria": [
|
|
422
|
-
|
|
423
|
-
|
|
482
|
+
{
|
|
483
|
+
"id": "correct-mutation-api",
|
|
484
|
+
"text": "Uses correct @sanity/client mutation API"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"id": "valid-patch-syntax",
|
|
488
|
+
"text": "Patch operations use valid set/unset/inc syntax"
|
|
489
|
+
}
|
|
424
490
|
]
|
|
425
491
|
}
|
|
426
492
|
],
|
|
@@ -432,9 +498,9 @@ export const examplePathBasedRefData = [
|
|
|
432
498
|
}
|
|
433
499
|
];
|
|
434
500
|
/** TypeScript task template for example-path-based-ref */
|
|
435
|
-
export const examplePathBasedRefTs = "/**\n * Example Task: Path-based canonical doc references.\n *\n * Demonstrates using `path` to reference canonical documentation.\n * Paths are the preferred reference type because they uniquely identify\n * an article across sections (unlike slugs, which can collide).\n *\n * Path format:\n * - Simple: \"webhooks\" → resolves by slug lookup\n * - Sectioned: \"content-lake/webhooks\" → disambiguates by section + slug\n *\n * This example demonstrates why paths matter: the slug \"documents\"\n * exists in both the \"content-lake\" and \"cli-reference\" sections.\n * Using \"content-lake/documents\" ensures we get the right one.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * @see docs/design-docs/canonical-doc-resolution.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-path-based-ref\",\n title: \"GROQ mutations (path-based doc references)\",\n description: \"Example — demonstrates path-based canonical doc references\",\n\n area: \"groq\",\n\n // Path-based canonical doc references.\n //\n // Use \"section/slug\" format to uniquely identify articles:\n // - \"content-lake/mutations-introduction\" → the mutations article\n // - \"content-lake/documents\" → the documents article in Content Lake\n // (not the CLI \"documents\" article in cli-reference section)\n //\n // The \"documents\" slug exists in two sections — this is exactly why\n // path-based references are preferred over slug-based references.\n context: {\n docs: [\n {\n path: \"content-lake/mutations-introduction\",\n reason: \"Introduction to document mutations in the Content Lake\",\n },\n {\n path: \"content-lake/documents\",\n reason:\n \"Document structure and types (Content Lake, not CLI reference)\",\n },\n ],\n },\n\n docCoverage: true,\n\n prompt: {\n text: `Explain how to create, update, and delete documents in Sanity's\nContent Lake using mutations. Cover:\n1. The different mutation types (create, createOrReplace, patch, delete)\n2. Document structure and required fields (_id, _type)\n3. How to use patch operations to update specific fields\n4. Best practices for mutation patterns\nProvide working code examples using @sanity/client.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n \"Explains create, createOrReplace, patch, and delete mutations\",\n \"Describes required document fields (_id, _type)\",\n \"Shows patch operations for field-level updates\",\n \"Includes practical code examples\",\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n \"Uses correct @sanity/client mutation API\",\n \"Patch operations use valid set/unset/inc syntax\",\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
501
|
+
export const examplePathBasedRefTs = "/**\n * Example Task: Path-based canonical doc references.\n *\n * Demonstrates using `path` to reference canonical documentation.\n * Paths are the preferred reference type because they uniquely identify\n * an article across sections (unlike slugs, which can collide).\n *\n * Path format:\n * - Simple: \"webhooks\" → resolves by slug lookup\n * - Sectioned: \"content-lake/webhooks\" → disambiguates by section + slug\n *\n * This example demonstrates why paths matter: the slug \"documents\"\n * exists in both the \"content-lake\" and \"cli-reference\" sections.\n * Using \"content-lake/documents\" ensures we get the right one.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * @see docs/design-docs/canonical-doc-resolution.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-path-based-ref\",\n title: \"GROQ mutations (path-based doc references)\",\n description: \"Example — demonstrates path-based canonical doc references\",\n\n area: \"groq\",\n\n // Path-based canonical doc references.\n //\n // Use \"section/slug\" format to uniquely identify articles:\n // - \"content-lake/mutations-introduction\" → the mutations article\n // - \"content-lake/documents\" → the documents article in Content Lake\n // (not the CLI \"documents\" article in cli-reference section)\n //\n // The \"documents\" slug exists in two sections — this is exactly why\n // path-based references are preferred over slug-based references.\n context: {\n docs: [\n {\n path: \"content-lake/mutations-introduction\",\n reason: \"Introduction to document mutations in the Content Lake\",\n },\n {\n path: \"content-lake/documents\",\n reason:\n \"Document structure and types (Content Lake, not CLI reference)\",\n },\n ],\n },\n\n docCoverage: true,\n\n prompt: {\n text: `Explain how to create, update, and delete documents in Sanity's\nContent Lake using mutations. Cover:\n1. The different mutation types (create, createOrReplace, patch, delete)\n2. Document structure and required fields (_id, _type)\n3. How to use patch operations to update specific fields\n4. Best practices for mutation patterns\nProvide working code examples using @sanity/client.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n {\n id: \"explains-mutations\",\n text: \"Explains create, createOrReplace, patch, and delete mutations\",\n },\n {\n id: \"required-document-fields\",\n text: \"Describes required document fields (_id, _type)\",\n },\n {\n id: \"patch-operations\",\n text: \"Shows patch operations for field-level updates\",\n },\n {\n id: \"practical-code-examples\",\n text: \"Includes practical code examples\",\n },\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n {\n id: \"correct-mutation-api\",\n text: \"Uses correct @sanity/client mutation API\",\n },\n {\n id: \"valid-patch-syntax\",\n text: \"Patch operations use valid set/unset/inc syntax\",\n },\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
436
502
|
/** Generated YAML for example-path-based-ref (from parsed TS data) */
|
|
437
|
-
export const examplePathBasedRefYaml = "- mode: literacy\n id: example-path-based-ref\n title: GROQ mutations (path-based doc references)\n description: Example — demonstrates path-based canonical doc references\n area: groq\n context:\n docs:\n - path: content-lake/mutations-introduction\n reason: Introduction to document mutations in the Content Lake\n - path: content-lake/documents\n reason: Document structure and types (Content Lake, not CLI reference)\n docCoverage: true\n prompt:\n text: |-\n Explain how to create, update, and delete documents in Sanity's\n Content Lake using mutations. Cover:\n 1. The different mutation types (create, createOrReplace, patch, delete)\n 2. Document structure and required fields (_id, _type)\n 3. How to use patch operations to update specific fields\n 4. Best practices for mutation patterns\n Provide working code examples using @sanity/client.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - Explains create, createOrReplace, patch, and delete mutations\n - Describes required document fields (_id, _type)\n - Shows patch operations for field-level updates\n - Includes practical code examples\n - type: llm-rubric\n template: code-correctness\n criteria:\n - Uses correct @sanity/client mutation API\n - Patch operations use valid set/unset/inc syntax\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
503
|
+
export const examplePathBasedRefYaml = "- mode: literacy\n id: example-path-based-ref\n title: GROQ mutations (path-based doc references)\n description: Example — demonstrates path-based canonical doc references\n area: groq\n context:\n docs:\n - path: content-lake/mutations-introduction\n reason: Introduction to document mutations in the Content Lake\n - path: content-lake/documents\n reason: Document structure and types (Content Lake, not CLI reference)\n docCoverage: true\n prompt:\n text: |-\n Explain how to create, update, and delete documents in Sanity's\n Content Lake using mutations. Cover:\n 1. The different mutation types (create, createOrReplace, patch, delete)\n 2. Document structure and required fields (_id, _type)\n 3. How to use patch operations to update specific fields\n 4. Best practices for mutation patterns\n Provide working code examples using @sanity/client.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - id: explains-mutations\n text: Explains create, createOrReplace, patch, and delete mutations\n - id: required-document-fields\n text: Describes required document fields (_id, _type)\n - id: patch-operations\n text: Shows patch operations for field-level updates\n - id: practical-code-examples\n text: Includes practical code examples\n - type: llm-rubric\n template: code-correctness\n criteria:\n - id: correct-mutation-api\n text: Uses correct @sanity/client mutation API\n - id: valid-patch-syntax\n text: Patch operations use valid set/unset/inc syntax\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
438
504
|
/** Parsed task data for example-perspective-ref (JSON-safe) */
|
|
439
505
|
export const examplePerspectiveRefData = [
|
|
440
506
|
{
|
|
@@ -464,17 +530,32 @@ export const examplePerspectiveRefData = [
|
|
|
464
530
|
"type": "llm-rubric",
|
|
465
531
|
"template": "task-completion",
|
|
466
532
|
"criteria": [
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
533
|
+
{
|
|
534
|
+
"id": "groq-join-syntax",
|
|
535
|
+
"text": "Demonstrates GROQ join syntax for cross-document queries"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"id": "groq-filter-patterns",
|
|
539
|
+
"text": "Shows GROQ filter patterns for webhook configuration"
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"id": "practical-query-examples",
|
|
543
|
+
"text": "Includes practical query examples from cheat sheet patterns"
|
|
544
|
+
}
|
|
470
545
|
]
|
|
471
546
|
},
|
|
472
547
|
{
|
|
473
548
|
"type": "llm-rubric",
|
|
474
549
|
"template": "code-correctness",
|
|
475
550
|
"criteria": [
|
|
476
|
-
|
|
477
|
-
|
|
551
|
+
{
|
|
552
|
+
"id": "valid-groq-syntax",
|
|
553
|
+
"text": "All GROQ queries use valid syntax"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"id": "correct-dereference-operator",
|
|
557
|
+
"text": "Reference joins use correct dereference operator (->)"
|
|
558
|
+
}
|
|
478
559
|
]
|
|
479
560
|
}
|
|
480
561
|
],
|
|
@@ -486,9 +567,9 @@ export const examplePerspectiveRefData = [
|
|
|
486
567
|
}
|
|
487
568
|
];
|
|
488
569
|
/** TypeScript task template for example-perspective-ref */
|
|
489
|
-
export const examplePerspectiveRefTs = "/**\n * Example Task: Perspective / content release doc references.\n *\n * Demonstrates using `perspective` to reference all documentation\n * articles within a content release. This is the key capability for\n * evaluating NEW feature documentation before it's published.\n *\n * How it works:\n * - A perspective ref is one-to-many: the doc fetcher queries the\n * named release and expands it to ALL articles versioned within it.\n * - Downstream consumers see the same flat DocContext[] regardless\n * of how docs were resolved.\n * - When the release is published, the perspective entry becomes a\n * no-op (articles are now in published). Migrate to explicit path\n * or slug refs at your convenience.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * @see docs/design-docs/canonical-doc-resolution.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-perspective-ref\",\n title:\n \"GROQ features from content release (perspective-based doc references)\",\n description:\n \"Example — demonstrates perspective-based canonical doc references\",\n\n area: \"groq\",\n\n // Perspective-based canonical doc reference.\n //\n // The perspective ID references a content release in the Sanity\n // Content Lake. At evaluation time, the doc fetcher auto-discovers\n // all articles versioned in this release and includes them as\n // canonical documentation context.\n //\n // Release rE9TSJvR4 contains:\n // - \"GROQ-powered webhooks\" (webhooks)\n // - \"Query Cheat Sheet - GROQ\" (query-cheat-sheet)\n // - \"GROQ joins\" (groq-joins)\n //\n // You can combine perspective refs with explicit slug/path/id refs\n // to include foundational published docs alongside release content.\n // Here we add groq-data-types as a complementary published reference.\n context: {\n docs: [\n {\n perspective: \"rE9TSJvR4\",\n reason: \"All GROQ documentation updates in the test content release\",\n },\n {\n slug: \"groq-data-types\",\n reason: \"GROQ data type reference (published, stable)\",\n },\n ],\n },\n\n docCoverage: true,\n\n prompt: {\n text: `Using GROQ, demonstrate advanced query patterns including:\n1. Joining data across document types using references\n2. Filtering webhook payloads with GROQ projections\n3. Using the query cheat sheet patterns for common operations\n4. Working with different GROQ data types in filters\nProvide working GROQ query examples for each pattern.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n \"Demonstrates GROQ join syntax for cross-document queries\",\n \"Shows GROQ filter patterns for webhook configuration\",\n \"Includes practical query examples from cheat sheet patterns\",\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n \"All GROQ queries use valid syntax\",\n \"Reference joins use correct dereference operator (->)\",\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
570
|
+
export const examplePerspectiveRefTs = "/**\n * Example Task: Perspective / content release doc references.\n *\n * Demonstrates using `perspective` to reference all documentation\n * articles within a content release. This is the key capability for\n * evaluating NEW feature documentation before it's published.\n *\n * How it works:\n * - A perspective ref is one-to-many: the doc fetcher queries the\n * named release and expands it to ALL articles versioned within it.\n * - Downstream consumers see the same flat DocContext[] regardless\n * of how docs were resolved.\n * - When the release is published, the perspective entry becomes a\n * no-op (articles are now in published). Migrate to explicit path\n * or slug refs at your convenience.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n *\n * @see docs/design-docs/canonical-doc-resolution.md\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-perspective-ref\",\n title:\n \"GROQ features from content release (perspective-based doc references)\",\n description:\n \"Example — demonstrates perspective-based canonical doc references\",\n\n area: \"groq\",\n\n // Perspective-based canonical doc reference.\n //\n // The perspective ID references a content release in the Sanity\n // Content Lake. At evaluation time, the doc fetcher auto-discovers\n // all articles versioned in this release and includes them as\n // canonical documentation context.\n //\n // Release rE9TSJvR4 contains:\n // - \"GROQ-powered webhooks\" (webhooks)\n // - \"Query Cheat Sheet - GROQ\" (query-cheat-sheet)\n // - \"GROQ joins\" (groq-joins)\n //\n // You can combine perspective refs with explicit slug/path/id refs\n // to include foundational published docs alongside release content.\n // Here we add groq-data-types as a complementary published reference.\n context: {\n docs: [\n {\n perspective: \"rE9TSJvR4\",\n reason: \"All GROQ documentation updates in the test content release\",\n },\n {\n slug: \"groq-data-types\",\n reason: \"GROQ data type reference (published, stable)\",\n },\n ],\n },\n\n docCoverage: true,\n\n prompt: {\n text: `Using GROQ, demonstrate advanced query patterns including:\n1. Joining data across document types using references\n2. Filtering webhook payloads with GROQ projections\n3. Using the query cheat sheet patterns for common operations\n4. Working with different GROQ data types in filters\nProvide working GROQ query examples for each pattern.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n {\n id: \"groq-join-syntax\",\n text: \"Demonstrates GROQ join syntax for cross-document queries\",\n },\n {\n id: \"groq-filter-patterns\",\n text: \"Shows GROQ filter patterns for webhook configuration\",\n },\n {\n id: \"practical-query-examples\",\n text: \"Includes practical query examples from cheat sheet patterns\",\n },\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n { id: \"valid-groq-syntax\", text: \"All GROQ queries use valid syntax\" },\n {\n id: \"correct-dereference-operator\",\n text: \"Reference joins use correct dereference operator (->)\",\n },\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
490
571
|
/** Generated YAML for example-perspective-ref (from parsed TS data) */
|
|
491
|
-
export const examplePerspectiveRefYaml = "- mode: literacy\n id: example-perspective-ref\n title: GROQ features from content release (perspective-based doc references)\n description: Example — demonstrates perspective-based canonical doc references\n area: groq\n context:\n docs:\n - perspective: rE9TSJvR4\n reason: All GROQ documentation updates in the test content release\n - slug: groq-data-types\n reason: GROQ data type reference (published, stable)\n docCoverage: true\n prompt:\n text: |-\n Using GROQ, demonstrate advanced query patterns including:\n 1. Joining data across document types using references\n 2. Filtering webhook payloads with GROQ projections\n 3. Using the query cheat sheet patterns for common operations\n 4. Working with different GROQ data types in filters\n Provide working GROQ query examples for each pattern.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - Demonstrates GROQ join syntax for cross-document queries\n - Shows GROQ filter patterns for webhook configuration\n - Includes practical query examples from cheat sheet patterns\n - type: llm-rubric\n template: code-correctness\n criteria:\n - All GROQ queries use valid syntax\n - Reference joins use correct dereference operator (->)\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
572
|
+
export const examplePerspectiveRefYaml = "- mode: literacy\n id: example-perspective-ref\n title: GROQ features from content release (perspective-based doc references)\n description: Example — demonstrates perspective-based canonical doc references\n area: groq\n context:\n docs:\n - perspective: rE9TSJvR4\n reason: All GROQ documentation updates in the test content release\n - slug: groq-data-types\n reason: GROQ data type reference (published, stable)\n docCoverage: true\n prompt:\n text: |-\n Using GROQ, demonstrate advanced query patterns including:\n 1. Joining data across document types using references\n 2. Filtering webhook payloads with GROQ projections\n 3. Using the query cheat sheet patterns for common operations\n 4. Working with different GROQ data types in filters\n Provide working GROQ query examples for each pattern.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - id: groq-join-syntax\n text: Demonstrates GROQ join syntax for cross-document queries\n - id: groq-filter-patterns\n text: Shows GROQ filter patterns for webhook configuration\n - id: practical-query-examples\n text: Includes practical query examples from cheat sheet patterns\n - type: llm-rubric\n template: code-correctness\n criteria:\n - id: valid-groq-syntax\n text: All GROQ queries use valid syntax\n - id: correct-dereference-operator\n text: Reference joins use correct dereference operator (->)\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
492
573
|
/** Parsed task data for example-studio-custom-input (JSON-safe) */
|
|
493
574
|
export const exampleStudioCustomInputData = [
|
|
494
575
|
{
|
|
@@ -519,18 +600,36 @@ export const exampleStudioCustomInputData = [
|
|
|
519
600
|
"type": "llm-rubric",
|
|
520
601
|
"template": "task-completion",
|
|
521
602
|
"criteria": [
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
603
|
+
{
|
|
604
|
+
"id": "renders-text-input",
|
|
605
|
+
"text": "Implements a React component that renders a text input"
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"id": "displays-character-count",
|
|
609
|
+
"text": "Displays a live character count"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"id": "reads-max-length",
|
|
613
|
+
"text": "Reads maxLength from schema options"
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
"id": "shows-visual-warning",
|
|
617
|
+
"text": "Shows a visual warning when limit is exceeded"
|
|
618
|
+
}
|
|
526
619
|
]
|
|
527
620
|
},
|
|
528
621
|
{
|
|
529
622
|
"type": "llm-rubric",
|
|
530
623
|
"template": "code-correctness",
|
|
531
624
|
"criteria": [
|
|
532
|
-
|
|
533
|
-
|
|
625
|
+
{
|
|
626
|
+
"id": "uses-sanity-ui",
|
|
627
|
+
"text": "Uses the Sanity UI library for styling"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"id": "calls-onchange-patches",
|
|
631
|
+
"text": "Calls onChange with patch operations"
|
|
632
|
+
}
|
|
534
633
|
]
|
|
535
634
|
}
|
|
536
635
|
],
|
|
@@ -542,9 +641,9 @@ export const exampleStudioCustomInputData = [
|
|
|
542
641
|
}
|
|
543
642
|
];
|
|
544
643
|
/** TypeScript task template for example-studio-custom-input */
|
|
545
|
-
export const exampleStudioCustomInputTs = "/**\n * Example Task: Custom input component in Sanity Studio.\n *\n * This is a starter template — edit it for your own documentation.\n * Delete this file or replace it with your own tasks.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-studio-custom-input\",\n title: \"Custom input component in Sanity Studio\",\n description: \"Example — tests Studio custom input implementation\",\n\n area: \"studio\",\n\n context: {\n docs: [\n {\n slug: \"custom-input-widgets\",\n reason: \"Guide for building custom form inputs in Sanity Studio\",\n },\n {\n slug: \"form-components\",\n reason: \"Form component API and customization patterns\",\n },\n ],\n },\n\n docCoverage: true,\n referenceSolution: \"canonical/example-studio-custom-input.ts\",\n\n prompt: {\n text: `Build a custom string input component for Sanity Studio that shows\na character count below the input field. The component should accept\na maxLength option from the field schema and display a warning when\nthe text exceeds the limit.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n \"Implements a React component that renders a text input\",\n \"Displays a live character count\",\n \"Reads maxLength from schema options\",\n \"Shows a visual warning when limit is exceeded\",\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n \"Uses the Sanity UI library for styling\",\n \"Calls onChange with patch operations\",\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
644
|
+
export const exampleStudioCustomInputTs = "/**\n * Example Task: Custom input component in Sanity Studio.\n *\n * This is a starter template — edit it for your own documentation.\n * Delete this file or replace it with your own tasks.\n *\n * This example task ships as a DRAFT so it does not run in production\n * evaluations automatically. To activate it, change status to \"active\"\n * or remove the status field entirely (defaults to active).\n */\n\nimport { defineTask } from \"@sanity/ailf\"\n\nexport default defineTask({\n mode: \"literacy\",\n id: \"example-studio-custom-input\",\n title: \"Custom input component in Sanity Studio\",\n description: \"Example — tests Studio custom input implementation\",\n\n area: \"studio\",\n\n context: {\n docs: [\n {\n slug: \"custom-input-widgets\",\n reason: \"Guide for building custom form inputs in Sanity Studio\",\n },\n {\n slug: \"form-components\",\n reason: \"Form component API and customization patterns\",\n },\n ],\n },\n\n docCoverage: true,\n referenceSolution: \"canonical/example-studio-custom-input.ts\",\n\n prompt: {\n text: `Build a custom string input component for Sanity Studio that shows\na character count below the input field. The component should accept\na maxLength option from the field schema and display a warning when\nthe text exceeds the limit.`,\n },\n\n assertions: [\n {\n type: \"llm-rubric\",\n template: \"task-completion\",\n criteria: [\n {\n id: \"renders-text-input\",\n text: \"Implements a React component that renders a text input\",\n },\n {\n id: \"displays-character-count\",\n text: \"Displays a live character count\",\n },\n { id: \"reads-max-length\", text: \"Reads maxLength from schema options\" },\n {\n id: \"shows-visual-warning\",\n text: \"Shows a visual warning when limit is exceeded\",\n },\n ],\n },\n {\n type: \"llm-rubric\",\n template: \"code-correctness\",\n criteria: [\n {\n id: \"uses-sanity-ui\",\n text: \"Uses the Sanity UI library for styling\",\n },\n {\n id: \"calls-onchange-patches\",\n text: \"Calls onChange with patch operations\",\n },\n ],\n },\n ],\n\n baseline: { enabled: true, rubric: \"full\" },\n status: \"draft\",\n})\n";
|
|
546
645
|
/** Generated YAML for example-studio-custom-input (from parsed TS data) */
|
|
547
|
-
export const exampleStudioCustomInputYaml = "- mode: literacy\n id: example-studio-custom-input\n title: Custom input component in Sanity Studio\n description: Example — tests Studio custom input implementation\n area: studio\n context:\n docs:\n - slug: custom-input-widgets\n reason: Guide for building custom form inputs in Sanity Studio\n - slug: form-components\n reason: Form component API and customization patterns\n docCoverage: true\n referenceSolution: canonical/example-studio-custom-input.ts\n prompt:\n text: |-\n Build a custom string input component for Sanity Studio that shows\n a character count below the input field. The component should accept\n a maxLength option from the field schema and display a warning when\n the text exceeds the limit.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - Implements a React component that renders a text input\n - Displays a live character count\n - Reads maxLength from schema options\n - Shows a visual warning when limit is exceeded\n - type: llm-rubric\n template: code-correctness\n criteria:\n - Uses the Sanity UI library for styling\n - Calls onChange with patch operations\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
646
|
+
export const exampleStudioCustomInputYaml = "- mode: literacy\n id: example-studio-custom-input\n title: Custom input component in Sanity Studio\n description: Example — tests Studio custom input implementation\n area: studio\n context:\n docs:\n - slug: custom-input-widgets\n reason: Guide for building custom form inputs in Sanity Studio\n - slug: form-components\n reason: Form component API and customization patterns\n docCoverage: true\n referenceSolution: canonical/example-studio-custom-input.ts\n prompt:\n text: |-\n Build a custom string input component for Sanity Studio that shows\n a character count below the input field. The component should accept\n a maxLength option from the field schema and display a warning when\n the text exceeds the limit.\n assertions:\n - type: llm-rubric\n template: task-completion\n criteria:\n - id: renders-text-input\n text: Implements a React component that renders a text input\n - id: displays-character-count\n text: Displays a live character count\n - id: reads-max-length\n text: Reads maxLength from schema options\n - id: shows-visual-warning\n text: Shows a visual warning when limit is exceeded\n - type: llm-rubric\n template: code-correctness\n criteria:\n - id: uses-sanity-ui\n text: Uses the Sanity UI library for styling\n - id: calls-onchange-patches\n text: Calls onChange with patch operations\n baseline:\n enabled: true\n rubric: full\n status: draft\n";
|
|
548
647
|
// ---------------------------------------------------------------------------
|
|
549
648
|
// Aggregate task exports
|
|
550
649
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-harness failure modes — valid for the `agent-harness` dimension
|
|
3
|
+
* family (process-quality, agent-output, tool-usage).
|
|
4
|
+
*
|
|
5
|
+
* Relocated from packages/eval/src/grader/agent-harness.ts to @sanity/ailf-core
|
|
6
|
+
* so card files in packages/core/src/services/diagnosis/cards/ can import
|
|
7
|
+
* them without violating the core→eval import direction rule (D-05).
|
|
8
|
+
*
|
|
9
|
+
* @see docs/design-docs/actionability-ladder/03-structured-grader-judgments.md
|
|
10
|
+
* §"Per-dimension failure-mode taxonomies" (lines 239-283).
|
|
11
|
+
*/
|
|
12
|
+
export declare const AGENT_FAILURE_MODES: readonly ["tool-misuse", "chaotic-process", "missing-recovery"];
|
|
13
|
+
export type AgentFailureMode = (typeof AGENT_FAILURE_MODES)[number];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-harness failure modes — valid for the `agent-harness` dimension
|
|
3
|
+
* family (process-quality, agent-output, tool-usage).
|
|
4
|
+
*
|
|
5
|
+
* Relocated from packages/eval/src/grader/agent-harness.ts to @sanity/ailf-core
|
|
6
|
+
* so card files in packages/core/src/services/diagnosis/cards/ can import
|
|
7
|
+
* them without violating the core→eval import direction rule (D-05).
|
|
8
|
+
*
|
|
9
|
+
* @see docs/design-docs/actionability-ladder/03-structured-grader-judgments.md
|
|
10
|
+
* §"Per-dimension failure-mode taxonomies" (lines 239-283).
|
|
11
|
+
*/
|
|
12
|
+
export const AGENT_FAILURE_MODES = [
|
|
13
|
+
"tool-misuse", // assistant calls tools incorrectly or with wrong args
|
|
14
|
+
"chaotic-process", // assistant flails — undirected exploration, no plan
|
|
15
|
+
"missing-recovery", // assistant doesn't recover from a tool error
|
|
16
|
+
];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-cutting failure modes — valid for any dimension family.
|
|
3
|
+
*
|
|
4
|
+
* Relocated from packages/eval/src/grader/common.ts to @sanity/ailf-core
|
|
5
|
+
* so card files in packages/core/src/services/diagnosis/cards/ can import
|
|
6
|
+
* them without violating the core→eval import direction rule (D-05).
|
|
7
|
+
*
|
|
8
|
+
* @see docs/design-docs/actionability-ladder/03-structured-grader-judgments.md
|
|
9
|
+
* §"Per-dimension failure-mode taxonomies" (lines 239-283 — the v0 lists)
|
|
10
|
+
* @see docs/decisions/D0005-grader-model-separation.md — single grader model;
|
|
11
|
+
* taxonomies travel with the rubric prompt for reproducibility.
|
|
12
|
+
*/
|
|
13
|
+
export declare const COMMON_FAILURE_MODES: readonly ["api-error", "model-limitation", "false-floor", "unclassified"];
|
|
14
|
+
export type CommonFailureMode = (typeof COMMON_FAILURE_MODES)[number];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-cutting failure modes — valid for any dimension family.
|
|
3
|
+
*
|
|
4
|
+
* Relocated from packages/eval/src/grader/common.ts to @sanity/ailf-core
|
|
5
|
+
* so card files in packages/core/src/services/diagnosis/cards/ can import
|
|
6
|
+
* them without violating the core→eval import direction rule (D-05).
|
|
7
|
+
*
|
|
8
|
+
* @see docs/design-docs/actionability-ladder/03-structured-grader-judgments.md
|
|
9
|
+
* §"Per-dimension failure-mode taxonomies" (lines 239-283 — the v0 lists)
|
|
10
|
+
* @see docs/decisions/D0005-grader-model-separation.md — single grader model;
|
|
11
|
+
* taxonomies travel with the rubric prompt for reproducibility.
|
|
12
|
+
*/
|
|
13
|
+
export const COMMON_FAILURE_MODES = [
|
|
14
|
+
"api-error", // infrastructure failure, not a docs problem
|
|
15
|
+
"model-limitation", // high ceiling, model can't reach it
|
|
16
|
+
"false-floor", // model already knew the answer; docs added no value
|
|
17
|
+
"unclassified", // grader could not pick a mode (low-confidence fallback)
|
|
18
|
+
];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-dimension failure-mode taxonomy barrel — relocated to @sanity/ailf-core.
|
|
3
|
+
*
|
|
4
|
+
* Previously lived in packages/eval/src/grader/index.ts. Moved here (D-05)
|
|
5
|
+
* so card files in packages/core/src/services/diagnosis/cards/ can import
|
|
6
|
+
* `failureModesForDimension` without violating the core→eval import rule.
|
|
7
|
+
*
|
|
8
|
+
* Named re-exports only (W0124 — never `export *`).
|
|
9
|
+
*
|
|
10
|
+
* The eval-side packages/eval/src/grader/index.ts now re-exports from here,
|
|
11
|
+
* keeping all existing eval-side callers working without source changes.
|
|
12
|
+
*
|
|
13
|
+
* @see docs/design-docs/actionability-ladder/03-structured-grader-judgments.md
|
|
14
|
+
* §"Per-dimension failure-mode taxonomies" (lines 239-283).
|
|
15
|
+
* @see docs/decisions/D0005-grader-model-separation.md — single grader model;
|
|
16
|
+
* taxonomies travel with the rubric prompt for reproducibility.
|
|
17
|
+
*/
|
|
18
|
+
export { COMMON_FAILURE_MODES, type CommonFailureMode } from "./common.js";
|
|
19
|
+
export { LITERACY_FAILURE_MODES, type LiteracyFailureMode } from "./literacy.js";
|
|
20
|
+
export { MCP_FAILURE_MODES, type MCPFailureMode } from "./mcp.js";
|
|
21
|
+
export { KP_FAILURE_MODES, type KPFailureMode } from "./knowledge-probe.js";
|
|
22
|
+
export { AGENT_FAILURE_MODES, type AgentFailureMode } from "./agent-harness.js";
|
|
23
|
+
/**
|
|
24
|
+
* Return the legal failure-mode list for a given rubric dimension.
|
|
25
|
+
*
|
|
26
|
+
* Accepts both family-level keys (`mcp-behavior`, `knowledge-probe`,
|
|
27
|
+
* `agent-harness`) and the per-template `dimension` strings used in
|
|
28
|
+
* `config/rubrics.ts` (`task-completion`, `input-validation`,
|
|
29
|
+
* `factual-correctness`, `process-quality`, …). The cross-cutting
|
|
30
|
+
* `COMMON_FAILURE_MODES` is always included.
|
|
31
|
+
*
|
|
32
|
+
* Unknown dimensions fall through to `COMMON_FAILURE_MODES` only — safe
|
|
33
|
+
* default, the grader can still pick `unclassified`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function failureModesForDimension(dimension: string): readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* Flat list of all dimension names recognized by `failureModesForDimension`.
|
|
38
|
+
* Used by card-validators and test calibration.
|
|
39
|
+
*/
|
|
40
|
+
export declare const CANONICAL_DIMENSIONS: readonly string[];
|
|
41
|
+
/**
|
|
42
|
+
* Returns `true` when `mode` appears in the failure-mode list of any
|
|
43
|
+
* canonical dimension family.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isCanonicalFailureMode(mode: string): boolean;
|