@sanity/ailf 4.2.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/config/package-surface.ts +37 -0
  2. package/config/preflight-scoring.ts +26 -0
  3. package/dist/_vendor/ailf-core/artifact-registry.d.ts +1 -1
  4. package/dist/_vendor/ailf-core/artifact-registry.js +47 -0
  5. package/dist/_vendor/ailf-core/config-helpers.d.ts +35 -0
  6. package/dist/_vendor/ailf-core/config-helpers.js +67 -0
  7. package/dist/_vendor/ailf-core/index.d.ts +1 -1
  8. package/dist/_vendor/ailf-core/index.js +1 -1
  9. package/dist/_vendor/ailf-core/ports/context.d.ts +18 -0
  10. package/dist/_vendor/ailf-core/ports/doc-fetcher.d.ts +30 -0
  11. package/dist/_vendor/ailf-core/ports/index.d.ts +3 -1
  12. package/dist/_vendor/ailf-core/ports/index.js +1 -0
  13. package/dist/_vendor/ailf-core/ports/mode-handler.d.ts +23 -0
  14. package/dist/_vendor/ailf-core/ports/package-surface-resolver.d.ts +71 -0
  15. package/dist/_vendor/ailf-core/ports/package-surface-resolver.js +36 -0
  16. package/dist/_vendor/ailf-core/schemas/eval-config.d.ts +6 -0
  17. package/dist/_vendor/ailf-core/schemas/eval-config.js +14 -0
  18. package/dist/_vendor/ailf-core/schemas/index.d.ts +1 -0
  19. package/dist/_vendor/ailf-core/schemas/index.js +1 -0
  20. package/dist/_vendor/ailf-core/schemas/pipeline-request.d.ts +4 -0
  21. package/dist/_vendor/ailf-core/schemas/pipeline-request.js +7 -0
  22. package/dist/_vendor/ailf-core/schemas/symbol-preflight-report.d.ts +51 -0
  23. package/dist/_vendor/ailf-core/schemas/symbol-preflight-report.js +57 -0
  24. package/dist/_vendor/ailf-core/types/index.d.ts +12 -0
  25. package/dist/_vendor/ailf-core/types/index.js +1 -0
  26. package/dist/_vendor/ailf-core/types/package-surface.d.ts +36 -0
  27. package/dist/_vendor/ailf-core/types/package-surface.js +13 -0
  28. package/dist/_vendor/ailf-core/types/pipeline-request.d.ts +1 -0
  29. package/dist/_vendor/ailf-core/types/preflight-scoring.d.ts +52 -0
  30. package/dist/_vendor/ailf-core/types/preflight-scoring.js +18 -0
  31. package/dist/_vendor/ailf-core/types/repo-config.d.ts +14 -0
  32. package/dist/_vendor/ailf-core/types/symbol-preflight-report.d.ts +66 -0
  33. package/dist/_vendor/ailf-core/types/symbol-preflight-report.js +25 -0
  34. package/dist/adapters/api-client/build-request.d.ts +1 -0
  35. package/dist/adapters/api-client/build-request.js +3 -0
  36. package/dist/adapters/config-sources/file-config-adapter.js +1 -0
  37. package/dist/adapters/doc-fetchers/sanity-doc-fetcher.d.ts +4 -0
  38. package/dist/adapters/doc-fetchers/sanity-doc-fetcher.js +159 -82
  39. package/dist/adapters/index.d.ts +1 -0
  40. package/dist/adapters/index.js +1 -0
  41. package/dist/adapters/package-surface/dts-package-surface.d.ts +46 -0
  42. package/dist/adapters/package-surface/dts-package-surface.js +173 -0
  43. package/dist/adapters/package-surface/in-memory-package-surface.d.ts +15 -0
  44. package/dist/adapters/package-surface/in-memory-package-surface.js +28 -0
  45. package/dist/adapters/package-surface/index.d.ts +9 -0
  46. package/dist/adapters/package-surface/index.js +8 -0
  47. package/dist/adapters/package-surface/parse-dts-exports.d.ts +31 -0
  48. package/dist/adapters/package-surface/parse-dts-exports.js +54 -0
  49. package/dist/adapters/task-sources/repo-schemas.d.ts +6 -0
  50. package/dist/adapters/task-sources/repo-schemas.js +15 -0
  51. package/dist/commands/pipeline-action.d.ts +2 -0
  52. package/dist/commands/pipeline-action.js +12 -0
  53. package/dist/commands/remote-pipeline.js +10 -2
  54. package/dist/commands/remote-results.d.ts +12 -1
  55. package/dist/commands/remote-results.js +25 -5
  56. package/dist/composition-root.js +9 -0
  57. package/dist/config/package-surface.ts +37 -0
  58. package/dist/config/preflight-scoring.ts +26 -0
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.js +1 -1
  61. package/dist/orchestration/build-app-context.js +1 -0
  62. package/dist/orchestration/pipeline-orchestrator.d.ts +19 -1
  63. package/dist/orchestration/pipeline-orchestrator.js +38 -0
  64. package/dist/orchestration/steps/calculate-scores-step.js +11 -0
  65. package/dist/orchestration/steps/generate-configs-step.js +16 -1
  66. package/dist/orchestration/steps/run-eval-step.js +27 -0
  67. package/dist/pipeline/calculate-scores.d.ts +66 -5
  68. package/dist/pipeline/calculate-scores.js +141 -27
  69. package/dist/pipeline/compiler/index.d.ts +1 -1
  70. package/dist/pipeline/compiler/index.js +1 -1
  71. package/dist/pipeline/compiler/literacy-bridge.d.ts +9 -0
  72. package/dist/pipeline/compiler/literacy-bridge.js +2 -0
  73. package/dist/pipeline/compiler/mode-handlers/literacy/assertions.d.ts +1 -1
  74. package/dist/pipeline/compiler/mode-handlers/literacy/assertions.js +31 -4
  75. package/dist/pipeline/compiler/mode-handlers/literacy/compiler.js +146 -1
  76. package/dist/pipeline/compiler/mode-handlers/literacy/index.js +2 -0
  77. package/dist/pipeline/compiler/mode-handlers/literacy/types.d.ts +17 -2
  78. package/dist/pipeline/compiler/rubric-resolution.d.ts +17 -1
  79. package/dist/pipeline/compiler/rubric-resolution.js +78 -2
  80. package/dist/pipeline/compiler/scoring-bridge.d.ts +49 -2
  81. package/dist/pipeline/compiler/scoring-bridge.js +104 -10
  82. package/dist/pipeline/eval-fingerprint.d.ts +9 -0
  83. package/dist/pipeline/eval-fingerprint.js +7 -1
  84. package/dist/pipeline/map-request-to-config.js +1 -0
  85. package/dist/pipeline/preflight/compute-preflight.d.ts +67 -0
  86. package/dist/pipeline/preflight/compute-preflight.js +118 -0
  87. package/dist/pipeline/preflight/emit-symbol-preflight.d.ts +51 -0
  88. package/dist/pipeline/preflight/emit-symbol-preflight.js +102 -0
  89. package/dist/pipeline/preflight/load-package-surface.d.ts +14 -0
  90. package/dist/pipeline/preflight/load-package-surface.js +19 -0
  91. package/dist/pipeline/preflight/load-preflight-context.d.ts +13 -0
  92. package/dist/pipeline/preflight/load-preflight-context.js +25 -0
  93. package/dist/pipeline/preflight/load-preflight-scoring.d.ts +12 -0
  94. package/dist/pipeline/preflight/load-preflight-scoring.js +17 -0
  95. package/dist/pipeline/preflight/parse-imports.d.ts +62 -0
  96. package/dist/pipeline/preflight/parse-imports.js +125 -0
  97. package/dist/report-store.d.ts +8 -0
  98. package/dist/report-store.js +55 -6
  99. package/dist/sanity/document-renderers.d.ts +45 -7
  100. package/dist/sanity/document-renderers.js +99 -13
  101. package/dist/sanity/queries.d.ts +11 -11
  102. package/dist/sanity/queries.js +7 -0
  103. package/dist/sanity/symbol-index.d.ts +98 -0
  104. package/dist/sanity/symbol-index.js +615 -0
  105. package/package.json +2 -1
@@ -20,34 +20,34 @@ export declare const FEATURE_AREA_QUERIES: {
20
20
  /**
21
21
  * Other Frameworks — Nuxt, React Router/Remix, Astro
22
22
  */
23
- readonly frameworks: "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n && (\n primarySection._ref in [\n \"b2c937d0-34b3-435e-818b-d0c8520ea9b8\",\n \"e223241c-e207-41e0-8e12-f80e78203cf1\",\n \"73bebb61-e508-42b7-b44b-c4703ae42d01\"\n ]\n || (primarySection._ref == \"ea6b80fa-d0d2-4daa-8220-eb8abdcc9deb\"\n && (title match \"Remix*\" || title match \"Nuxt*\"\n || title match \"Astro*\" || title match \"SvelteKit*\"))\n )\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
23
+ readonly frameworks: "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n && (\n primarySection._ref in [\n \"b2c937d0-34b3-435e-818b-d0c8520ea9b8\",\n \"e223241c-e207-41e0-8e12-f80e78203cf1\",\n \"73bebb61-e508-42b7-b44b-c4703ae42d01\"\n ]\n || (primarySection._ref == \"ea6b80fa-d0d2-4daa-8220-eb8abdcc9deb\"\n && (title match \"Remix*\" || title match \"Nuxt*\"\n || title match \"Astro*\" || title match \"SvelteKit*\"))\n )\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
24
24
  /**
25
25
  * Functions / Compute / AI — serverless functions, webhooks
26
26
  * Section: "Compute and AI" (12 articles)
27
27
  */
28
- readonly functions: "\n *[_type == \"article\"\n && primarySection._ref == \"3024ce79-c196-49ee-a237-a327d6a6348f\"\n && !(_id in path(\"drafts.**\"))\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
28
+ readonly functions: "\n *[_type == \"article\"\n && primarySection._ref == \"3024ce79-c196-49ee-a237-a327d6a6348f\"\n && !(_id in path(\"drafts.**\"))\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
29
29
  /**
30
30
  * GROQ Query Language — introduction, syntax, joins, filtering, projections
31
31
  * Combines: Content Lake section GROQ articles + Developer Guides articles
32
32
  * about querying + title-matched GROQ articles across all sections.
33
33
  */
34
- readonly groq: "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n && (\n primarySection._ref == \"60a6bcb5-9706-4cab-9153-57725e28f4d0\"\n || primarySection._ref == \"ea6b80fa-d0d2-4daa-8220-eb8abdcc9deb\"\n )\n && (\n title match \"GROQ*\"\n || title match \"*GROQ*\"\n || title match \"Query*\"\n || title match \"How Queries*\"\n || slug.current match \"groq-*\"\n || slug.current match \"query-*\"\n || slug.current match \"how-queries-*\"\n || slug.current match \"paginating-with-groq\"\n || slug.current match \"high-performance-groq\"\n )\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
34
+ readonly groq: "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n && (\n primarySection._ref == \"60a6bcb5-9706-4cab-9153-57725e28f4d0\"\n || primarySection._ref == \"ea6b80fa-d0d2-4daa-8220-eb8abdcc9deb\"\n )\n && (\n title match \"GROQ*\"\n || title match \"*GROQ*\"\n || title match \"Query*\"\n || title match \"How Queries*\"\n || slug.current match \"groq-*\"\n || slug.current match \"query-*\"\n || slug.current match \"how-queries-*\"\n || slug.current match \"paginating-with-groq\"\n || slug.current match \"high-performance-groq\"\n )\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
35
35
  /**
36
36
  * Next.js integration + Live Content API
37
37
  * Combines: Next.js quickstart section + developer-guide articles
38
38
  * mentioning Next.js or Live Content.
39
39
  */
40
- readonly "nextjs-live": "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n && (\n primarySection._ref == \"6208dff1-bba7-487a-a6bb-a0ffccb5846c\"\n || (primarySection._ref == \"ea6b80fa-d0d2-4daa-8220-eb8abdcc9deb\"\n && (title match \"Next*\" || title match \"*Live*\"))\n )\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
40
+ readonly "nextjs-live": "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n && (\n primarySection._ref == \"6208dff1-bba7-487a-a6bb-a0ffccb5846c\"\n || (primarySection._ref == \"ea6b80fa-d0d2-4daa-8220-eb8abdcc9deb\"\n && (title match \"Next*\" || title match \"*Live*\"))\n )\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
41
41
  /**
42
42
  * Studio Setup & Customization
43
43
  * Section: "Studio" (116 articles)
44
44
  */
45
- readonly "studio-setup": "\n *[_type == \"article\"\n && primarySection._ref == \"d67e3879-0342-4a80-8a2d-e35908df35cc\"\n && !(_id in path(\"drafts.**\"))\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
45
+ readonly "studio-setup": "\n *[_type == \"article\"\n && primarySection._ref == \"d67e3879-0342-4a80-8a2d-e35908df35cc\"\n && !(_id in path(\"drafts.**\"))\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
46
46
  /**
47
47
  * Visual Editing — Presentation tool, overlays, live preview
48
48
  * Section: "Visual Editing" (24 articles)
49
49
  */
50
- readonly "visual-editing": "\n *[_type == \"article\"\n && primarySection._ref == \"4e0ef463-01e2-48db-9a31-38b3912ececd\"\n && !(_id in path(\"drafts.**\"))\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
50
+ readonly "visual-editing": "\n *[_type == \"article\"\n && primarySection._ref == \"4e0ef463-01e2-48db-9a31-38b3912ececd\"\n && !(_id in path(\"drafts.**\"))\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n ";
51
51
  };
52
52
  export type FeatureArea = keyof typeof FEATURE_AREA_QUERIES;
53
53
  export declare const ALL_FEATURE_AREAS: FeatureArea[];
@@ -55,11 +55,11 @@ export declare const ALL_FEATURE_AREAS: FeatureArea[];
55
55
  * Fetch a single article by its slug.
56
56
  * Returns the same projection shape as the feature-area queries.
57
57
  */
58
- export declare const ARTICLE_BY_SLUG_QUERY = "\n *[_type == \"article\"\n && slug.current == $slug\n && !(_id in path(\"drafts.**\"))\n ][0] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
58
+ export declare const ARTICLE_BY_SLUG_QUERY = "\n *[_type == \"article\"\n && slug.current == $slug\n && !(_id in path(\"drafts.**\"))\n ][0] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
59
59
  /**
60
60
  * Fetch all published articles (for full-corpus generation).
61
61
  */
62
- export declare const ALL_ARTICLES_QUERY = "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n ] | order(primarySection->slug.current, title) {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
62
+ export declare const ALL_ARTICLES_QUERY = "\n *[_type == \"article\"\n && !(_id in path(\"drafts.**\"))\n ] | order(primarySection->slug.current, title) {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
63
63
  /**
64
64
  * Fetch article metadata for a list of slugs.
65
65
  *
@@ -76,7 +76,7 @@ export declare const ARTICLES_METADATA_BY_SLUGS_QUERY = "\n *[_type == \"articl
76
76
  *
77
77
  * Returns the full article projection for content comparison.
78
78
  */
79
- export declare const ARTICLE_BY_SLUG_WITH_PERSPECTIVE_QUERY = "\n *[_type == \"article\"\n && slug.current == $slug\n ][0] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
79
+ export declare const ARTICLE_BY_SLUG_WITH_PERSPECTIVE_QUERY = "\n *[_type == \"article\"\n && slug.current == $slug\n ][0] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
80
80
  /**
81
81
  * Fetch articles by their document IDs.
82
82
  *
@@ -86,7 +86,7 @@ export declare const ARTICLE_BY_SLUG_WITH_PERSPECTIVE_QUERY = "\n *[_type == \"
86
86
  *
87
87
  * @param $ids — array of document ID strings
88
88
  */
89
- export declare const ARTICLES_BY_IDS_QUERY = "\n *[_type == \"article\"\n && _id in $ids\n ] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
89
+ export declare const ARTICLES_BY_IDS_QUERY = "\n *[_type == \"article\"\n && _id in $ids\n ] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
90
90
  /**
91
91
  * Fetch arbitrary documents by their `_id` — no `_type` filter.
92
92
  *
@@ -117,7 +117,7 @@ export declare const DOCS_BY_IDS_QUERY = "\n *[_id in $ids] {\n _id,\n _t
117
117
  *
118
118
  * @param $id — document ID string
119
119
  */
120
- export declare const ARTICLE_BY_ID_QUERY = "\n *[_type == \"article\"\n && _id == $id\n ][0] {\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
120
+ export declare const ARTICLE_BY_ID_QUERY = "\n *[_type == \"article\"\n && _id == $id\n ][0] {\n _id,\n _type,\n _rev,\n title,\n description,\n \"slug\": slug.current,\n \"section\": primarySection->{ \"slug\": slug.current, title },\n \"content\": content[] {\n // Pass through all standard blocks unchanged\n _type != \"docsCardCollection\" => { ... },\n // Resolve references inside card collections so we get titles/slugs\n _type == \"docsCardCollection\" => {\n ...,\n cards[] {\n ...,\n \"resolvedTitle\": reference->title,\n \"resolvedSlug\": reference->slug.current\n }\n }\n }\n}\n";
121
121
  /**
122
122
  * Resolve an article slug from a URL path segment.
123
123
  *
@@ -43,8 +43,15 @@ const SECTION_IDS = {
43
43
  * Returns the raw Portable Text `content` array so that the Node-side
44
44
  * converter (@portabletext/markdown) can produce well-structured Markdown
45
45
  * with headings, code fences, tables, callouts, etc.
46
+ *
47
+ * `_id`, `_type`, and `_rev` are projected so a result satisfies the
48
+ * `DocumentForRender` shape and can dispatch through the renderer
49
+ * registry uniformly with id-ref-resolved docs (W0197).
46
50
  */
47
51
  const ARTICLE_PROJECTION = `{
52
+ _id,
53
+ _type,
54
+ _rev,
48
55
  title,
49
56
  description,
50
57
  "slug": slug.current,
@@ -0,0 +1,98 @@
1
+ /**
2
+ * symbol-index — Programmatic extractor that produces a flat list of
3
+ * identifiers the canonical reference legitimizes, each with a one-line
4
+ * provenance snippet.
5
+ *
6
+ * Used by the grader-context pathway (W0196 / W0197) so the LLM judge sees
7
+ * a compact, deterministic recognition reference instead of the full
8
+ * narrative doc — addresses the DOC-2117 prior-collision failure mode
9
+ * where a grader claimed `useEditDocument` did not exist.
10
+ *
11
+ * Two upstream sources, both fully programmatic (no LLM in the extractor):
12
+ *
13
+ * - `extractSymbolIndex(blocks)` — walks Sanity Portable Text content
14
+ * (article docs).
15
+ * - `extractSymbolsFromTypedoc(json, packageName)` — parses typedoc
16
+ * JSON (typesReference docs).
17
+ *
18
+ * `mergeSymbolIndexes(indexes)` combines indexes from multiple references
19
+ * into a single deduped index for a task.
20
+ *
21
+ * Source precedence (higher wins on dedup):
22
+ * 1. type-def — typedoc declarations: literal authoritative type
23
+ * surface, no editorial layer between extracted
24
+ * symbol and the package's actual exports.
25
+ * 2. heading — Section headings (`block` style h1..h4), including
26
+ * inline `code` marks within heading spans.
27
+ * 3. inline-code — Inline `code` marks within non-heading `block` spans.
28
+ * 4. code-block — Identifiers from `import` statements in `codeBlock`
29
+ * bodies. Body identifiers (`const foo = ...`) are
30
+ * intentionally not extracted — those are usage demos.
31
+ */
32
+ export type SymbolProvenanceKind = "type-def" | "heading" | "inline-code" | "code-block";
33
+ /** Declaration kinds we surface from typedoc JSON for `type-def` provenance. */
34
+ export type TypeDefDeclarationKind = "function" | "class" | "interface" | "type" | "enum" | "variable" | "namespace";
35
+ export interface SymbolProvenance {
36
+ kind: SymbolProvenanceKind;
37
+ /** Human-readable line that locates the symbol in the source doc. */
38
+ snippet: string;
39
+ /** Heading style when kind === "heading". */
40
+ style?: "h1" | "h2" | "h3" | "h4";
41
+ /** Source filename when kind === "code-block" and one is set on the block. */
42
+ filename?: string;
43
+ /** Code block language tag when kind === "code-block". */
44
+ language?: string;
45
+ /** Declaration kind when kind === "type-def". */
46
+ declarationKind?: TypeDefDeclarationKind;
47
+ /** Source package (e.g. `@sanity/sdk-react`) when kind === "type-def". */
48
+ package?: string;
49
+ }
50
+ export interface SymbolEntry {
51
+ symbol: string;
52
+ provenance: SymbolProvenance;
53
+ }
54
+ export interface SymbolIndex {
55
+ symbols: SymbolEntry[];
56
+ }
57
+ export declare function extractSymbolIndex(blocks: unknown): SymbolIndex;
58
+ /**
59
+ * Extract a symbol index from a typedoc JSON document (schema 2.x — the
60
+ * shape produced by `typedoc --json`). Each top-level export becomes a
61
+ * `type-def` provenance entry with the symbol name, declaration kind
62
+ * (function / interface / type / etc.), and the JSDoc summary as snippet.
63
+ *
64
+ * Type-def is the highest-precedence source: typedoc declarations are
65
+ * literal authoritative type surface, no editorial layer between them
66
+ * and the package's actual exports. If a symbol also appears in narrative
67
+ * docs (heading, inline code, code-block import) the type-def entry wins
68
+ * on dedup.
69
+ *
70
+ * `body` is the raw JSON string fetched from the typesReference's
71
+ * attachment URL. Returns an empty index for any unparseable input — this
72
+ * is best-effort recognition material; callers fall back to full-doc
73
+ * injection when extraction yields nothing.
74
+ */
75
+ export declare function extractSymbolsFromTypedoc(body: string, packageName?: string): SymbolIndex;
76
+ /**
77
+ * Compute per-tier counts for a SymbolIndex. Used by the fetcher to
78
+ * populate the per-task manifest entry's `tierBreakdown` field.
79
+ */
80
+ export declare function symbolIndexTierBreakdown(index: SymbolIndex): {
81
+ typeDef: number;
82
+ heading: number;
83
+ inlineCode: number;
84
+ codeBlock: number;
85
+ };
86
+ /**
87
+ * Combine multiple `SymbolIndex` instances (typically from different
88
+ * canonical references for the same task) into a single deduped index
89
+ * preserving precedence.
90
+ */
91
+ export declare function mergeSymbolIndexes(indexes: readonly SymbolIndex[]): SymbolIndex;
92
+ /**
93
+ * Render a SymbolIndex as a compact markdown reference suitable for
94
+ * injection into a grader's `rubricPrompt` as ground-truth recognition
95
+ * material. Layout intentionally puts headings first so the most
96
+ * authoritative symbols anchor the top of the list.
97
+ */
98
+ export declare function renderSymbolIndex(index: SymbolIndex, title?: string): string;