@sanity/ailf 0.1.0 → 0.1.2

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 (125) hide show
  1. package/dist/_vendor/ailf-core/examples/index.d.ts +16 -12
  2. package/dist/_vendor/ailf-core/examples/index.js +19 -12
  3. package/dist/_vendor/ailf-core/ports/context.d.ts +4 -0
  4. package/dist/adapters/task-sources/repo-schemas.d.ts +12 -2
  5. package/dist/adapters/task-sources/repo-schemas.js +28 -2
  6. package/dist/cli.js +0 -0
  7. package/dist/commands/init.js +17 -5
  8. package/dist/commands/pipeline-action.js +44 -6
  9. package/dist/commands/publish.js +2 -1
  10. package/dist/commands/validate-tasks.js +4 -1
  11. package/dist/composition-root.js +9 -5
  12. package/dist/orchestration/build-app-context.js +2 -0
  13. package/package.json +1 -1
  14. package/dist/commands/update-quality-scores.d.ts +0 -5
  15. package/dist/commands/update-quality-scores.js +0 -20
  16. package/dist/lib/agent-behavior-report.d.ts +0 -8
  17. package/dist/lib/agent-behavior-report.js +0 -185
  18. package/dist/lib/baseline.d.ts +0 -19
  19. package/dist/lib/baseline.js +0 -153
  20. package/dist/lib/calculate-scores.d.ts +0 -23
  21. package/dist/lib/calculate-scores.js +0 -42
  22. package/dist/lib/compare.d.ts +0 -18
  23. package/dist/lib/compare.js +0 -170
  24. package/dist/lib/coverage-audit.d.ts +0 -4
  25. package/dist/lib/coverage-audit.js +0 -42
  26. package/dist/lib/discovery-report.d.ts +0 -13
  27. package/dist/lib/discovery-report.js +0 -57
  28. package/dist/lib/fetch-docs.d.ts +0 -30
  29. package/dist/lib/fetch-docs.js +0 -171
  30. package/dist/lib/generate-configs.d.ts +0 -25
  31. package/dist/lib/generate-configs.js +0 -42
  32. package/dist/lib/grader-api.d.ts +0 -21
  33. package/dist/lib/grader-api.js +0 -34
  34. package/dist/lib/grader-compare.d.ts +0 -19
  35. package/dist/lib/grader-compare.js +0 -91
  36. package/dist/lib/grader-consistency.d.ts +0 -27
  37. package/dist/lib/grader-consistency.js +0 -79
  38. package/dist/lib/grader-sensitivity.d.ts +0 -19
  39. package/dist/lib/grader-sensitivity.js +0 -75
  40. package/dist/lib/grader-validate.d.ts +0 -19
  41. package/dist/lib/grader-validate.js +0 -78
  42. package/dist/lib/measure-retrieval.d.ts +0 -14
  43. package/dist/lib/measure-retrieval.js +0 -71
  44. package/dist/lib/pr-comment.d.ts +0 -16
  45. package/dist/lib/pr-comment.js +0 -28
  46. package/dist/lib/readiness-report.d.ts +0 -13
  47. package/dist/lib/readiness-report.js +0 -108
  48. package/dist/lib/webhook-server.d.ts +0 -11
  49. package/dist/lib/webhook-server.js +0 -24
  50. package/dist/lib/weekly-digest.d.ts +0 -24
  51. package/dist/lib/weekly-digest.js +0 -148
  52. package/dist/orchestration/env-bridge.d.ts +0 -21
  53. package/dist/orchestration/env-bridge.js +0 -66
  54. package/dist/orchestration/steps/fetch-docs-shell.d.ts +0 -17
  55. package/dist/orchestration/steps/fetch-docs-shell.js +0 -30
  56. package/dist/pipeline/steps/calculate-scores-step.d.ts +0 -11
  57. package/dist/pipeline/steps/calculate-scores-step.js +0 -89
  58. package/dist/pipeline/steps/compare-step.d.ts +0 -18
  59. package/dist/pipeline/steps/compare-step.js +0 -90
  60. package/dist/pipeline/steps/eval-step.d.ts +0 -53
  61. package/dist/pipeline/steps/eval-step.js +0 -347
  62. package/dist/pipeline/steps/fetch-docs-step.d.ts +0 -11
  63. package/dist/pipeline/steps/fetch-docs-step.js +0 -84
  64. package/dist/pipeline/steps/generate-configs-step.d.ts +0 -11
  65. package/dist/pipeline/steps/generate-configs-step.js +0 -98
  66. package/dist/pipeline/steps/grader-consistency-step.d.ts +0 -21
  67. package/dist/pipeline/steps/grader-consistency-step.js +0 -74
  68. package/dist/pipeline/steps/publish-report-step.d.ts +0 -57
  69. package/dist/pipeline/steps/publish-report-step.js +0 -243
  70. package/dist/pipeline/steps/report-step.d.ts +0 -13
  71. package/dist/pipeline/steps/report-step.js +0 -56
  72. package/dist/pipeline/steps/update-scores-step.d.ts +0 -11
  73. package/dist/pipeline/steps/update-scores-step.js +0 -42
  74. package/dist/scripts/agent-behavior-report.d.ts +0 -19
  75. package/dist/scripts/agent-behavior-report.js +0 -315
  76. package/dist/scripts/baseline.d.ts +0 -43
  77. package/dist/scripts/baseline.js +0 -267
  78. package/dist/scripts/calculate-scores.d.ts +0 -166
  79. package/dist/scripts/calculate-scores.js +0 -1296
  80. package/dist/scripts/compare.d.ts +0 -22
  81. package/dist/scripts/compare.js +0 -334
  82. package/dist/scripts/coverage-audit.d.ts +0 -44
  83. package/dist/scripts/coverage-audit.js +0 -209
  84. package/dist/scripts/debug-eval.d.ts +0 -19
  85. package/dist/scripts/debug-eval.js +0 -73
  86. package/dist/scripts/discovery-report.d.ts +0 -58
  87. package/dist/scripts/discovery-report.js +0 -250
  88. package/dist/scripts/fetch-docs.d.ts +0 -35
  89. package/dist/scripts/fetch-docs.js +0 -472
  90. package/dist/scripts/generate-configs.d.ts +0 -66
  91. package/dist/scripts/generate-configs.js +0 -459
  92. package/dist/scripts/grader-api.d.ts +0 -27
  93. package/dist/scripts/grader-api.js +0 -206
  94. package/dist/scripts/grader-compare.d.ts +0 -22
  95. package/dist/scripts/grader-compare.js +0 -368
  96. package/dist/scripts/grader-consistency.d.ts +0 -20
  97. package/dist/scripts/grader-consistency.js +0 -313
  98. package/dist/scripts/grader-sensitivity.d.ts +0 -22
  99. package/dist/scripts/grader-sensitivity.js +0 -354
  100. package/dist/scripts/grader-validate.d.ts +0 -19
  101. package/dist/scripts/grader-validate.js +0 -267
  102. package/dist/scripts/measure-retrieval.d.ts +0 -10
  103. package/dist/scripts/measure-retrieval.js +0 -145
  104. package/dist/scripts/pipeline.d.ts +0 -76
  105. package/dist/scripts/pipeline.js +0 -1031
  106. package/dist/scripts/pr-comment.d.ts +0 -10
  107. package/dist/scripts/pr-comment.js +0 -510
  108. package/dist/scripts/readiness-report.d.ts +0 -88
  109. package/dist/scripts/readiness-report.js +0 -342
  110. package/dist/scripts/update-quality-scores.d.ts +0 -15
  111. package/dist/scripts/update-quality-scores.js +0 -184
  112. package/dist/scripts/validate.d.ts +0 -13
  113. package/dist/scripts/validate.js +0 -79
  114. package/dist/scripts/webhook-server.d.ts +0 -26
  115. package/dist/scripts/webhook-server.js +0 -147
  116. package/dist/scripts/weekly-digest.d.ts +0 -24
  117. package/dist/scripts/weekly-digest.js +0 -144
  118. package/dist/sinks/format-slack.d.ts +0 -64
  119. package/dist/sinks/format-slack.js +0 -306
  120. package/dist/sinks/slack-sink.d.ts +0 -27
  121. package/dist/sinks/slack-sink.js +0 -78
  122. package/dist/sinks/webhook-sink.d.ts +0 -19
  123. package/dist/sinks/webhook-sink.js +0 -50
  124. package/tasks/.expanded.agentic.yaml +0 -51
  125. package/tasks/.expanded.yaml +0 -66
@@ -1,166 +0,0 @@
1
- /**
2
- * Calculate-scores.ts
3
- *
4
- * Reads Promptfoo evaluation output and computes the AI Literacy Score
5
- * for each feature area. Each dimension is scored on a uniform 0–100 scale:
6
- *
7
- * Task Completion (0–100) — Can the LLM implement the feature?
8
- * Code Correctness (0–100) — Is the code idiomatic and correct?
9
- * Doc Coverage (0–100) — Did docs provide the needed info?
10
- *
11
- * Dimensions are combined into a weighted composite (0–100) using weights
12
- * from config/rubrics.yaml (default: Task×0.50 + Code×0.25 + Docs×0.25).
13
- *
14
- * Additionally compares with-docs vs without-docs scores to calculate
15
- * the "Doc Lift" — how much documentation helps vs parametric knowledge.
16
- *
17
- * When tests are run with the InstrumentedProvider (agent-observer),
18
- * this script also aggregates and reports agent behavior data: which
19
- * documentation pages were visited, what searches were performed, and
20
- * overall network activity patterns.
21
- */
22
- import "dotenv/config";
23
- import type { FeatureScore, GraderJudgment, PerModelEntry } from "../pipeline/types.js";
24
- export interface ComponentResult {
25
- assertion?: {
26
- type: string;
27
- value?: string;
28
- /** Structured metadata propagated from rubric templates (Approach 5). */
29
- metadata?: Record<string, unknown>;
30
- };
31
- pass: boolean;
32
- reason?: string;
33
- score?: number;
34
- }
35
- export interface PromptfooResultsWrapper {
36
- results: RawTestResult[];
37
- stats: {
38
- successes: number;
39
- failures: number;
40
- tokenUsage?: {
41
- assertions?: {
42
- completion: number;
43
- prompt: number;
44
- total: number;
45
- };
46
- completion: number;
47
- prompt: number;
48
- total: number;
49
- };
50
- };
51
- }
52
- export interface RawPromptfooFile {
53
- [key: string]: unknown;
54
- config?: {
55
- defaultTest?: {
56
- options?: {
57
- provider?: string;
58
- rubricProvider?: string;
59
- };
60
- };
61
- };
62
- results: PromptfooResultsWrapper;
63
- }
64
- export interface RawTestResult {
65
- cost?: number;
66
- error?: string;
67
- gradingResult: null | {
68
- componentResults: ComponentResult[];
69
- pass: boolean;
70
- };
71
- metadata?: Record<string, unknown>;
72
- provider?: {
73
- id?: string;
74
- label?: string;
75
- };
76
- response: {
77
- output: string;
78
- };
79
- testCase?: {
80
- description?: string;
81
- vars?: Record<string, string>;
82
- };
83
- vars: Record<string, string>;
84
- }
85
- export interface TestResult {
86
- cost: number;
87
- description: string;
88
- gradingResult: {
89
- componentResults: ComponentResult[];
90
- pass: boolean;
91
- };
92
- metadata?: Record<string, unknown>;
93
- /** Provider identifier (e.g., "openai:gpt-4o") */
94
- providerId?: string;
95
- /** Provider label (e.g., "GPT-4o") */
96
- providerLabel?: string;
97
- response: {
98
- output: string;
99
- };
100
- vars: Record<string, string>;
101
- }
102
- export interface UrlMetadata {
103
- otherUrls: string[];
104
- sanityUrlCount: number;
105
- sanityUrls: string[];
106
- totalUrlCount: number;
107
- }
108
- /**
109
- * Calculate scores grouped by model. Each model gets its own FeatureScore[]
110
- * and model-level aggregates.
111
- *
112
- * Uses the provider.id from Promptfoo results to identify models.
113
- * Falls back to provider.label, then "unknown" if neither is available.
114
- *
115
- * @returns Record keyed by model ID, or null if only one model was used
116
- * (per-model breakdown is redundant when there's only one model).
117
- */
118
- export declare function calculateScoresPerModel(resultsPath: string, weights: Record<string, number>): null | PerModelEntry[];
119
- export declare function classifyRubric(component: ComponentResult): "codeCorrectness" | "docCoverage" | "taskCompletion" | null;
120
- export declare function detectFeatureArea(description: string): string;
121
- /**
122
- * Extract grader judgments (reason text + scores) from evaluation results.
123
- *
124
- * This preserves the grader's natural language reasoning for downstream
125
- * analysis (failure mode classification, gap analysis). Each llm-rubric
126
- * assertion produces one GraderJudgment entry.
127
- *
128
- * Phase 3a prerequisite: structured judgment data for failure mode extraction.
129
- */
130
- export declare function extractGraderJudgments(resultsPath: string): GraderJudgment[];
131
- /**
132
- * Finds the URL-extraction assertion result in a test's componentResults
133
- * and parses the structured JSON from its `reason` field.
134
- */
135
- export declare function extractUrlMetadata(test: TestResult): null | UrlMetadata;
136
- export declare function parseRubricScore(component: ComponentResult): number;
137
- /**
138
- * Score agentic evaluation results. In agentic mode, all test entries are
139
- * gold-only (no baseline entries — the .expanded.agentic.yaml fix ensures this).
140
- * The model retrieves docs via tools, so all results map to "actual" scores.
141
- *
142
- * Returns a record keyed by feature area with the composite actual score.
143
- */
144
- interface ActualScoreEntry {
145
- actualScore: number;
146
- codeCorrectness: number;
147
- docCoverage: number;
148
- taskCompletion: number;
149
- testCount: number;
150
- totalCost: number;
151
- }
152
- export declare function scoreAgenticResults(resultsPath: string, weights: Record<string, number>): Record<string, ActualScoreEntry>;
153
- /**
154
- * Merge baseline FeatureScore[] with agentic actual scores to produce
155
- * the full three-layer decomposition.
156
- *
157
- * The merge is per feature area. For each area:
158
- * - If baseline data exists: floor, ceiling, docLift, docQualityGap are populated
159
- * - If agentic data exists: actualScore is populated
160
- * - If both exist: retrievalGap and infrastructureEfficiency are computed
161
- *
162
- * @param baselineScores Floor/ceiling scores from baseline evaluation (may be empty)
163
- * @param agenticScores Actual scores from agentic evaluation (may be empty)
164
- */
165
- export declare function mergeScores(baselineScores: FeatureScore[], agenticScores: Record<string, ActualScoreEntry>): FeatureScore[];
166
- export {};