@superblocksteam/vite-plugin-file-sync 2.0.18-next.25 → 2.0.18-next.26

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 (97) hide show
  1. package/dist/ai-service/evals/helpers/critical-scorers.d.ts +10 -0
  2. package/dist/ai-service/evals/helpers/critical-scorers.d.ts.map +1 -0
  3. package/dist/ai-service/evals/helpers/critical-scorers.js +331 -0
  4. package/dist/ai-service/evals/helpers/critical-scorers.js.map +1 -0
  5. package/dist/ai-service/evals/helpers/eval-scoring.d.ts +53 -8
  6. package/dist/ai-service/evals/helpers/eval-scoring.d.ts.map +1 -1
  7. package/dist/ai-service/evals/helpers/eval-scoring.js +151 -408
  8. package/dist/ai-service/evals/helpers/eval-scoring.js.map +1 -1
  9. package/dist/ai-service/evals/helpers/index.d.ts +14 -2
  10. package/dist/ai-service/evals/helpers/index.d.ts.map +1 -1
  11. package/dist/ai-service/evals/helpers/index.js +39 -20
  12. package/dist/ai-service/evals/helpers/index.js.map +1 -1
  13. package/dist/ai-service/evals/helpers/non-critical-scorers.d.ts +6 -0
  14. package/dist/ai-service/evals/helpers/non-critical-scorers.d.ts.map +1 -0
  15. package/dist/ai-service/evals/helpers/non-critical-scorers.js +187 -0
  16. package/dist/ai-service/evals/helpers/non-critical-scorers.js.map +1 -0
  17. package/dist/ai-service/evals/helpers/scorer-types.d.ts +39 -0
  18. package/dist/ai-service/evals/helpers/scorer-types.d.ts.map +1 -0
  19. package/dist/ai-service/evals/helpers/scorer-types.js +19 -0
  20. package/dist/ai-service/evals/helpers/scorer-types.js.map +1 -0
  21. package/dist/ai-service/index.d.ts.map +1 -1
  22. package/dist/ai-service/index.js +8 -3
  23. package/dist/ai-service/index.js.map +1 -1
  24. package/dist/ai-service/llm/impl/anthropic.js +3 -3
  25. package/dist/ai-service/llm/impl/anthropic.js.map +1 -1
  26. package/dist/ai-service/llm/provider.js +3 -3
  27. package/dist/ai-service/llm/provider.js.map +1 -1
  28. package/dist/ai-service/llm/types.d.ts +1 -1
  29. package/dist/ai-service/llm/types.d.ts.map +1 -1
  30. package/dist/ai-service/llm/utils.js +6 -6
  31. package/dist/ai-service/llm/utils.js.map +1 -1
  32. package/dist/ai-service/prompt-builder-service/builders/code-generation.d.ts.map +1 -1
  33. package/dist/ai-service/prompt-builder-service/builders/code-generation.js +62 -87
  34. package/dist/ai-service/prompt-builder-service/builders/code-generation.js.map +1 -1
  35. package/dist/ai-service/prompt-builder-service/builders/specific-edits.d.ts +13 -0
  36. package/dist/ai-service/prompt-builder-service/builders/specific-edits.d.ts.map +1 -0
  37. package/dist/ai-service/prompt-builder-service/builders/specific-edits.js +71 -0
  38. package/dist/ai-service/prompt-builder-service/builders/specific-edits.js.map +1 -0
  39. package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.d.ts +0 -1
  40. package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.d.ts.map +1 -1
  41. package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.js +4 -13
  42. package/dist/ai-service/prompt-builder-service/classifiers/prompt-interpret-task.js.map +1 -1
  43. package/dist/ai-service/prompt-builder-service/fragment-generators/base-fragment.d.ts +1 -1
  44. package/dist/ai-service/prompt-builder-service/fragment-generators/base-fragment.d.ts.map +1 -1
  45. package/dist/ai-service/prompt-builder-service/fragment-generators/base-fragment.js +2 -2
  46. package/dist/ai-service/prompt-builder-service/fragment-generators/base-fragment.js.map +1 -1
  47. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ButtonPropsDocs.js +1 -1
  48. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/CheckboxPropsDocs.js +1 -1
  49. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ColumnPropsDocs.js +1 -1
  50. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ContainerPropsDocs.js +1 -1
  51. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/DatePickerPropsDocs.js +1 -1
  52. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/DropdownPropsDocs.js +1 -1
  53. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/IconPropsDocs.js +1 -1
  54. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ImagePropsDocs.js +1 -1
  55. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/InputPropsDocs.js +1 -1
  56. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ModalPropsDocs.js +1 -1
  57. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/PagePropsDocs.js +1 -1
  58. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/SectionPropsDocs.js +1 -1
  59. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/SlideoutPropsDocs.js +1 -1
  60. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/SwitchPropsDocs.js +1 -1
  61. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/TablePropsDocs.js +1 -1
  62. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/TextPropsDocs.js +1 -1
  63. package/dist/ai-service/prompt-builder-service/static-fragments/library-typedefs/Dim.js +1 -1
  64. package/dist/ai-service/prompt-builder-service/static-fragments/library-typedefs/EventFlow.js +1 -1
  65. package/dist/ai-service/prompt-builder-service/static-fragments/library-typedefs/TextStyleWithVariant.js +1 -1
  66. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/full-examples.js +1 -1
  67. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/index.d.ts +1 -0
  68. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/index.d.ts.map +1 -1
  69. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/index.js +1 -0
  70. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/index.js.map +1 -1
  71. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-api.js +1 -1
  72. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-components-rules.js +1 -1
  73. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-custom-components.js +1 -1
  74. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-data-filtering.js +1 -1
  75. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-event-flow.js +1 -1
  76. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-forms.js +1 -1
  77. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-layouts.js +1 -1
  78. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-page.js +1 -1
  79. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-rbac.js +1 -1
  80. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-routes.js +1 -1
  81. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-state.js +1 -1
  82. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-theming.js +1 -1
  83. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-base.js +1 -1
  84. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-incremental.js +1 -1
  85. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-specific-edit.d.ts +2 -0
  86. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-specific-edit.d.ts.map +1 -0
  87. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-specific-edit.js +6 -0
  88. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-specific-edit.js.map +1 -0
  89. package/dist/ai-service/prompt-builder-service/types.d.ts +3 -3
  90. package/dist/ai-service/prompt-builder-service/types.js +3 -3
  91. package/dist/ai-service/prompt-builder-service/types.js.map +1 -1
  92. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  93. package/dist/ai-service/state-machine/handlers/agent-planning.js +8 -6
  94. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  95. package/dist/ai-service/state-machine/handlers/post-processing.js +5 -5
  96. package/dist/ai-service/state-machine/handlers/post-processing.js.map +1 -1
  97. package/package.json +6 -6
@@ -1,273 +1,139 @@
1
1
  import ddTrace from "dd-trace";
2
2
  import { expect } from "vitest";
3
- import { findComponentAtPath, findComponentsInPage, parseScopeEntityNames, } from "../content-matchers/index.js";
3
+ import { scoreExpectedPageCount, scoreExpectedScopeCount, scoreUniqueApiNames, scoreApisInCorrectLocation, scoreExpectedCustomComponentCount, scoreRequiredUiComponentsInPage, scoreRequiredUiComponentProperties, scoreExpectedComponentArtifacts, } from "./critical-scorers.js";
4
+ import { scoreApiCountTolerance, scoreExpectedUiComponentsInPage, scoreExpectedUiComponentProperties, scoreLintIssues, } from "./non-critical-scorers.js";
5
+ import { SCORING_CONFIG, PASSING_SCORE_THRESHOLD } from "./scorer-types.js";
4
6
  import { groupArtifacts, runLinterCLI } from "./index.js";
5
- const SOFT_CHECK_PENALTIES = {
6
- wrongApiCount: 0.3,
7
- wrongUiComponentCount: 0.3,
8
- lintErrors: 0.3,
9
- };
10
- function getComponentForPropertyCheck(foundComponents, config) {
11
- if (config.path) {
12
- return findComponentAtPath(foundComponents, config.path);
7
+ // Scorer registry and runner
8
+ // ------------------------
9
+ const CRITICAL_SCORERS = [
10
+ scoreExpectedPageCount,
11
+ scoreExpectedScopeCount,
12
+ scoreUniqueApiNames,
13
+ scoreApisInCorrectLocation,
14
+ scoreExpectedCustomComponentCount,
15
+ scoreRequiredUiComponentsInPage,
16
+ scoreRequiredUiComponentProperties,
17
+ scoreExpectedComponentArtifacts,
18
+ ];
19
+ const NON_CRITICAL_SCORERS = [
20
+ scoreApiCountTolerance,
21
+ scoreExpectedUiComponentsInPage,
22
+ scoreExpectedUiComponentProperties,
23
+ scoreLintIssues,
24
+ ];
25
+ async function runScorers(context) {
26
+ let currentScore = SCORING_CONFIG.STARTING_SCORE;
27
+ const results = [];
28
+ const criticalFailures = [];
29
+ const nonCriticalDeductions = {};
30
+ // Run all scorers
31
+ const allScorers = [...CRITICAL_SCORERS, ...NON_CRITICAL_SCORERS];
32
+ for (const scorer of allScorers) {
33
+ const result = await scorer(context);
34
+ results.push(result);
35
+ currentScore += result.scoreDelta;
36
+ if (result.isCritical && !result.passed) {
37
+ criticalFailures.push({
38
+ check: result.checkName,
39
+ deduction: result.scoreDelta,
40
+ });
41
+ }
42
+ else if (!result.isCritical && result.scoreDelta !== 0) {
43
+ // For non-critical scorers, extract count from metadata
44
+ const count = result.metadata?.totalIssues ||
45
+ result.metadata?.errorCount ||
46
+ result.metadata?.apiCountDiff ||
47
+ 0;
48
+ nonCriticalDeductions[result.checkName] = {
49
+ count,
50
+ deduction: result.scoreDelta,
51
+ };
52
+ }
13
53
  }
14
- const index = config.index ?? 0;
15
- return foundComponents[index];
54
+ return {
55
+ results,
56
+ finalScore: Math.max(SCORING_CONFIG.MINIMUM_SCORE, currentScore),
57
+ criticalFailures,
58
+ nonCriticalDeductions,
59
+ };
16
60
  }
17
61
  // Reusable eval scoring function
18
62
  // ------------------------
19
- export async function calculateEvalScore({ artifacts, getTempDir, config, traceData, }) {
63
+ export async function calculateEvalScore({ artifacts, getTempDir, config, classification, }) {
20
64
  const { scopes, pages, apis, customComponents, components } = groupArtifacts(artifacts);
21
- const evalChecks = {};
22
65
  const apiNames = apis.map((api) => api.params.apiName.replace(".ts", ""));
23
- // Calculate all evaluation results first (no assertions yet)
24
- // ------------------------
25
- let criticalChecksPassed = true;
26
- // Critical 1: Has expected number of pages
27
- const expectedPageCount = config.expectedPageCount ?? 1;
28
- evalChecks.hasExpectedPageCount =
29
- pages.length === expectedPageCount &&
30
- (expectedPageCount > 1
31
- ? pages.every((page, i) => page.params.pageName === `Page${i + 1}`)
32
- : pages[0]?.params.pageName === "Page1");
33
- if (!evalChecks.hasExpectedPageCount) {
34
- criticalChecksPassed = false;
35
- }
36
- // Critical 2: Has expected number of scopes
37
- const expectedScopeCount = config.expectedScopeCount ?? 1;
38
- evalChecks.hasExpectedScopeCount =
39
- scopes.length === expectedScopeCount &&
40
- (expectedScopeCount > 1
41
- ? scopes.every((scope, i) => scope.params.pageName === `Page${i + 1}`)
42
- : scopes[0]?.params.pageName === "Page1");
43
- if (!evalChecks.hasExpectedScopeCount) {
44
- criticalChecksPassed = false;
45
- }
46
- // Critical 3: APIs have unique names
47
- evalChecks.hasUniqueApiNames = new Set(apiNames).size === apiNames.length;
48
- if (!evalChecks.hasUniqueApiNames) {
49
- criticalChecksPassed = false;
50
- }
51
- // Critical 4: APIs are in correct page and scope
52
- let apisInCorrectLocation = true;
53
- for (const api of apis) {
54
- if (api.params.pageName !== "Page1") {
55
- apisInCorrectLocation = false;
56
- break;
57
- }
58
- }
59
- if (apisInCorrectLocation && scopes[0]) {
60
- const scopeEntityNames = parseScopeEntityNames(scopes[0]);
61
- for (const apiName of apiNames) {
62
- if (!scopeEntityNames.includes(apiName)) {
63
- apisInCorrectLocation = false;
64
- break;
65
- }
66
- }
67
- }
68
- evalChecks.hasApisInCorrectLocation = apisInCorrectLocation;
69
- if (!evalChecks.hasApisInCorrectLocation) {
70
- criticalChecksPassed = false;
71
- }
72
- // Critical 5: Component count check
73
- let hasExpectedCustomComponentCount = false;
74
- if (typeof config.expectedCustomComponentCount === "number") {
75
- hasExpectedCustomComponentCount =
76
- customComponents.length === config.expectedCustomComponentCount;
77
- }
78
- else {
79
- const [min, max] = config.expectedCustomComponentCount;
80
- hasExpectedCustomComponentCount =
81
- customComponents.length >= min && customComponents.length <= max;
82
- }
83
- evalChecks.hasExpectedCustomComponentCount = hasExpectedCustomComponentCount;
84
- if (!evalChecks.hasExpectedCustomComponentCount) {
85
- criticalChecksPassed = false;
86
- }
87
- // Get page content for UI component checks
88
- const pageContent = pages[0]?.content;
89
- // Critical 6: Required UI components
90
- let hasExpectedUiComponentsInPage = true;
91
- for (const uiComponent of config.expectedUiComponents ?? []) {
92
- if (uiComponent.required) {
93
- const foundComponents = findComponentsInPage(pageContent || "", uiComponent.type);
94
- let componentCheckPassed = false;
95
- if (typeof uiComponent.expectedCount === "number") {
96
- if (uiComponent.expectedCount === 0) {
97
- componentCheckPassed = foundComponents.length === 0;
98
- }
99
- else {
100
- componentCheckPassed = foundComponents.length > 0;
101
- }
102
- }
103
- else {
104
- const [min, max] = uiComponent.expectedCount;
105
- componentCheckPassed =
106
- foundComponents.length >= min && foundComponents.length <= max;
107
- }
108
- if (!componentCheckPassed) {
109
- hasExpectedUiComponentsInPage = false;
110
- break;
111
- }
112
- }
113
- }
114
- evalChecks.hasExpectedUiComponentsInPage = hasExpectedUiComponentsInPage;
115
- if (!evalChecks.hasExpectedUiComponentsInPage) {
116
- criticalChecksPassed = false;
117
- }
118
- // Critical check 7: Does it have the expected properties?
119
- let hasExpectedUiComponentProperties = true;
120
- if (config.expectedUiComponentProperties) {
121
- for (const uiComponent of config.expectedUiComponentProperties) {
122
- const foundComponents = findComponentsInPage(pageContent || "", uiComponent.type);
123
- const component = getComponentForPropertyCheck(foundComponents, uiComponent);
124
- if (!component) {
125
- const selector = uiComponent.path
126
- ? `at path [${uiComponent.path.join(", ")}]`
127
- : `at index ${uiComponent.index ?? 0}`;
128
- throw new Error(`Component of type ${uiComponent.type} ${selector} to check properties on not found`);
129
- }
130
- for (const [key, value] of Object.entries(uiComponent.expectedProperties ?? {})) {
131
- const propertyValueIsCorrect = component.props[key] === value;
132
- if (!propertyValueIsCorrect) {
133
- hasExpectedUiComponentProperties = false;
134
- break;
135
- }
136
- }
137
- // Check for expected undefined properties
138
- if (uiComponent.expectedUndefinedProperties) {
139
- for (const undefinedProp of uiComponent.expectedUndefinedProperties) {
140
- const propertyIsUndefined = !(undefinedProp in component.props) ||
141
- component.props[undefinedProp] === undefined;
142
- if (!propertyIsUndefined) {
143
- hasExpectedUiComponentProperties = false;
144
- break;
145
- }
146
- }
147
- }
148
- }
149
- evalChecks.hasExpectedUiComponentProperties =
150
- hasExpectedUiComponentProperties;
151
- if (!hasExpectedUiComponentProperties) {
152
- criticalChecksPassed = false;
153
- }
154
- }
155
- // Critical check 8: Component artifacts have expected properties
156
- let hasExpectedComponentArtifacts = true;
157
- if (config.expectedComponentArtifacts &&
158
- config.expectedComponentArtifacts.length > 0) {
159
- for (const expectedComponent of config.expectedComponentArtifacts) {
160
- // Find component artifact matching the criteria
161
- const componentArtifact = components.find((comp) => {
162
- // Parse the component content to check tagName and bindName
163
- if (comp.filePath !== expectedComponent.filePath) {
164
- return false;
165
- }
166
- // For component artifacts, we need to parse the content to extract properties
167
- // This is a simplified check - in practice you might need more sophisticated parsing
168
- const content = comp.content;
169
- const hasExpectedTag = content.includes(`<${expectedComponent.tagName}`);
170
- if (expectedComponent.bindName) {
171
- const hasExpectedBind = content.includes(`bind={${expectedComponent.bindName}}`);
172
- return hasExpectedTag && hasExpectedBind;
173
- }
174
- return hasExpectedTag;
175
- });
176
- if (!componentArtifact) {
177
- hasExpectedComponentArtifacts = false;
178
- break;
179
- }
180
- // Check if the component artifact contains the expected properties
181
- for (const [propKey, propValue] of Object.entries(expectedComponent.expectedProperties ?? {})) {
182
- // Simple string-based property check for component artifacts
183
- // This could be enhanced with proper AST parsing if needed
184
- const hasProperty = componentArtifact.content.includes(`${propKey}=${JSON.stringify(propValue)}`) ||
185
- componentArtifact.content.includes(`${propKey}={${JSON.stringify(propValue)}}`);
186
- if (!hasProperty) {
187
- hasExpectedComponentArtifacts = false;
188
- break;
189
- }
190
- }
191
- // Check for expected undefined properties in component artifacts
192
- if (expectedComponent.expectedUndefinedProperties) {
193
- for (const undefinedProp of expectedComponent.expectedUndefinedProperties) {
194
- // Check that the property is NOT present in the component artifact
195
- const propertyIsPresent = componentArtifact.content.includes(`${undefinedProp}=`) ||
196
- componentArtifact.content.includes(`${undefinedProp} =`);
197
- if (propertyIsPresent) {
198
- hasExpectedComponentArtifacts = false;
199
- break;
200
- }
201
- }
202
- }
203
- if (!hasExpectedComponentArtifacts) {
204
- break;
205
- }
206
- }
207
- }
208
- evalChecks.hasExpectedComponentArtifacts = hasExpectedComponentArtifacts;
209
- if (!hasExpectedComponentArtifacts) {
210
- criticalChecksPassed = false;
211
- }
212
- // Soft checks calculation
213
- // ------------------------
214
- let softScore = 1.0;
215
- // Soft 1: API count tolerance
216
- let hasReasonableApiCount = true;
217
- if (typeof config.expectedApiCountRange === "number") {
218
- if (config.expectedApiCountRange !== apis.length) {
219
- hasReasonableApiCount = false;
220
- softScore -= SOFT_CHECK_PENALTIES.wrongApiCount;
221
- }
222
- }
223
- else {
224
- const [min, max] = config.expectedApiCountRange;
225
- if (apis.length < min || apis.length > max) {
226
- hasReasonableApiCount = false;
227
- softScore -= SOFT_CHECK_PENALTIES.wrongApiCount;
228
- }
229
- }
230
- evalChecks.hasReasonableApiCount = hasReasonableApiCount;
231
- // Soft 2: UI component count tolerance
232
- let hasReasonableUiComponentInPageCounts = true;
233
- for (const uiComponent of config.expectedUiComponents ?? []) {
234
- if (!uiComponent.required) {
235
- const foundComponents = findComponentsInPage(pageContent || "", uiComponent.type);
236
- let withinTolerance = true;
237
- if (typeof uiComponent.expectedCount === "number") {
238
- const tolerance = 1;
239
- withinTolerance =
240
- Math.abs(foundComponents.length - uiComponent.expectedCount) <=
241
- tolerance;
242
- }
243
- else {
244
- const [min, max] = uiComponent.expectedCount;
245
- withinTolerance =
246
- foundComponents.length >= min && foundComponents.length <= max;
247
- }
248
- if (!withinTolerance) {
249
- softScore -= SOFT_CHECK_PENALTIES.wrongUiComponentCount;
250
- hasReasonableUiComponentInPageCounts = false;
251
- }
252
- }
253
- }
254
- evalChecks.hasReasonableUiComponentInPageCounts =
255
- hasReasonableUiComponentInPageCounts;
256
- // Soft 3: Lint errors
66
+ const pageContent = pages[0]?.content || "";
67
+ // Run lint analysis first as it's needed by scorers
257
68
  const lintResult = await runLinterCLI(artifacts, getTempDir());
258
- evalChecks.hasLintErrors = lintResult.hasErrors;
259
- if (evalChecks.hasLintErrors) {
69
+ if (lintResult.hasErrors) {
260
70
  console.log("Lint results:", JSON.stringify(lintResult, null, 2));
261
- softScore -= SOFT_CHECK_PENALTIES.lintErrors;
262
71
  }
263
- // Calculate final eval score
264
- // ------------------------
265
- const evalScore = criticalChecksPassed ? softScore : 0;
266
- const evalPassed = criticalChecksPassed && softScore >= 0.8;
267
- const results = {
268
- evalScore,
72
+ // Create scorer context
73
+ const context = {
74
+ scopes,
75
+ pages,
76
+ apis,
77
+ apiNames,
78
+ customComponents,
79
+ components,
80
+ config,
81
+ pageContent,
82
+ lintResult,
83
+ };
84
+ // Run all scorers
85
+ const { results, finalScore, criticalFailures, nonCriticalDeductions } = await runScorers(context);
86
+ // Build evalChecks from scorer results for backward compatibility
87
+ const evalChecks = {};
88
+ for (const result of results) {
89
+ evalChecks[result.checkName] = result.passed;
90
+ }
91
+ // Calculate additional derived values
92
+ const criticalChecksPassed = criticalFailures.length === 0;
93
+ const evalPassed = finalScore >= PASSING_SCORE_THRESHOLD;
94
+ // Calculate legacy softScore for backward compatibility (0-1 scale)
95
+ const totalNonCriticalDeductions = Object.values(nonCriticalDeductions).reduce((sum, deduction) => sum + Math.abs(deduction.deduction), 0);
96
+ const softScore = Math.max(0, 1 - totalNonCriticalDeductions / 100);
97
+ // Extract lint data from results for proper formatting
98
+ const lintResult_scorer = results.find((r) => r.checkName === "hasLintErrors");
99
+ const lintErrorsData = lintResult_scorer?.metadata
100
+ ? {
101
+ count: lintResult_scorer.metadata.errorCount || 0,
102
+ deduction: lintResult_scorer.metadata.lintErrorDeduction || 0,
103
+ }
104
+ : { count: 0, deduction: 0 };
105
+ const lintWarningsData = lintResult_scorer?.metadata
106
+ ? {
107
+ count: lintResult_scorer.metadata.warningCount || 0,
108
+ deduction: lintResult_scorer.metadata.lintWarningDeduction || 0,
109
+ }
110
+ : { count: 0, deduction: 0 };
111
+ // Convert nonCriticalDeductions to expected format for backward compatibility
112
+ const formattedNonCriticalDeductions = {
113
+ lintErrors: lintErrorsData,
114
+ lintWarnings: lintWarningsData,
115
+ typeErrors: { count: 0, deduction: 0 },
116
+ apiIssues: nonCriticalDeductions.hasReasonableApiCount || {
117
+ count: 0,
118
+ deduction: 0,
119
+ },
120
+ componentIssues: nonCriticalDeductions.hasReasonableUiComponentInPageCounts || {
121
+ count: 0,
122
+ deduction: 0,
123
+ },
124
+ propertyIssues: { count: 0, deduction: 0 },
125
+ bindEntityIssues: { count: 0, deduction: 0 },
126
+ frontendEntityIssues: { count: 0, deduction: 0 },
127
+ };
128
+ const evalResults = {
129
+ evalScore: finalScore,
269
130
  evalPassed,
270
131
  evalChecks,
132
+ deductionBreakdown: {
133
+ criticalFailures,
134
+ nonCriticalDeductions: formattedNonCriticalDeductions,
135
+ },
136
+ // Legacy fields for backward compatibility
271
137
  softScore,
272
138
  criticalChecksPassed,
273
139
  lintResult,
@@ -280,162 +146,39 @@ export async function calculateEvalScore({ artifacts, getTempDir, config, traceD
280
146
  components,
281
147
  },
282
148
  };
283
- // Send trace data to Datadog before running assertions
149
+ // Submit evaluation to Datadog before running assertions
284
150
  // ------------------------
285
151
  const { llmobs } = ddTrace;
286
- if (llmobs && traceData) {
287
- llmobs.annotate({
288
- inputData: traceData.inputData,
289
- outputData: traceData.outputData,
290
- metrics: {
291
- ...traceData.metrics,
292
- evalScore,
293
- },
294
- metadata: {
295
- ...traceData.metadata,
296
- evalPassed,
297
- criticalChecksPassed,
298
- softScore,
299
- pageCount: pages.length,
300
- apiCount: apis.length,
301
- customComponents: customComponents.length,
302
- uniqueApiCount: new Set(apiNames).size,
303
- lintErrorCount: lintResult.errorCount,
304
- lintWarningCount: lintResult.warningCount,
305
- // Count undefined properties checks
306
- undefinedPropertiesChecked: (config.expectedUiComponentProperties?.reduce((count, comp) => count + (comp.expectedUndefinedProperties?.length || 0), 0) || 0) +
307
- (config.expectedComponentArtifacts?.reduce((count, comp) => count + (comp.expectedUndefinedProperties?.length || 0), 0) || 0),
308
- // Add detailed error counts by rule (sanitize rule names for Datadog)
309
- ...Object.entries(lintResult.ruleBreakdown).reduce((acc, [ruleId, counts]) => {
310
- // Sanitize rule name: replace special characters with underscores
311
- const sanitizedRuleId = ruleId.replace(/[^a-zA-Z0-9_]/g, "_");
312
- if (counts.errors > 0) {
313
- acc[`lintErrors_${sanitizedRuleId}`] = counts.errors;
314
- }
315
- if (counts.warnings > 0) {
316
- acc[`lintWarnings_${sanitizedRuleId}`] = counts.warnings;
317
- }
318
- return acc;
319
- }, {}),
320
- ...evalChecks,
321
- },
322
- });
323
- }
324
- // Now run all the assertions (after trace data is sent)
325
- // ------------------------
326
- expect(pages).toHaveLength(expectedPageCount);
327
- for (let i = 0; i < expectedPageCount; i++) {
328
- expect(pages[i]?.params.pageName).toEqual(`Page${i + 1}`);
329
- }
330
- expect(scopes).toHaveLength(expectedScopeCount);
331
- for (let i = 0; i < expectedScopeCount; i++) {
332
- expect(scopes[i]?.params.pageName).toEqual(`Page${i + 1}`);
333
- }
334
- expect(new Set(apiNames).size).toBe(apiNames.length);
335
- for (const api of apis) {
336
- expect(api.params.pageName).toEqual("Page1");
337
- }
338
- if (expectedScopeCount > 0) {
339
- const scopeEntityNames = parseScopeEntityNames(scopes[0]);
340
- for (const apiName of apiNames) {
341
- expect(scopeEntityNames).toContain(apiName);
342
- }
343
- }
344
- if (typeof config.expectedCustomComponentCount === "number") {
345
- expect(customComponents).toHaveLength(config.expectedCustomComponentCount);
346
- }
347
- else {
348
- const [min, max] = config.expectedCustomComponentCount;
349
- expect(customComponents.length).toBeGreaterThanOrEqual(min);
350
- expect(customComponents.length).toBeLessThanOrEqual(max);
351
- }
352
- for (const uiComponent of config.expectedUiComponents ?? []) {
353
- if (uiComponent.required) {
354
- const foundComponents = findComponentsInPage(pageContent || "", uiComponent.type);
355
- if (typeof uiComponent.expectedCount === "number") {
356
- if (uiComponent.expectedCount === 0) {
357
- expect(foundComponents).toHaveLength(0);
358
- }
359
- else {
360
- expect(foundComponents).not.toHaveLength(0);
361
- }
362
- }
363
- else {
364
- const [min, max] = uiComponent.expectedCount;
365
- expect(foundComponents.length).toBeGreaterThanOrEqual(min);
366
- expect(foundComponents.length).toBeLessThanOrEqual(max);
367
- }
368
- }
369
- }
370
- if (typeof config.expectedApiCountRange === "number") {
371
- expect(apis.length).toBe(config.expectedApiCountRange);
372
- }
373
- else {
374
- const [min, max] = config.expectedApiCountRange;
375
- expect(apis.length).toBeGreaterThanOrEqual(min);
376
- expect(apis.length).toBeLessThanOrEqual(max);
377
- }
378
- if (config.expectedUiComponentProperties) {
379
- for (const expected of config.expectedUiComponentProperties) {
380
- const { type, expectedProperties } = expected;
381
- const foundComponents = findComponentsInPage(pageContent || "", type);
382
- const comp = getComponentForPropertyCheck(foundComponents, expected);
383
- if (!comp) {
384
- const selector = expected.path
385
- ? `at path [${expected.path.join(", ")}]`
386
- : `at index ${expected.index ?? 0}`;
387
- throw new Error(`Component of type ${type} ${selector} to check properties on not found`);
388
- }
389
- for (const [propKey, propValue] of Object.entries(expectedProperties ?? {})) {
390
- expect(comp.props && comp.props[propKey] === propValue, `Property "${propKey}" expected value: ${JSON.stringify(propValue)}, actual: ${JSON.stringify(comp.props ? comp.props[propKey] : undefined)}`).toBeTruthy();
391
- }
392
- // Check assertions for expected undefined properties
393
- if (expected.expectedUndefinedProperties) {
394
- for (const undefinedProp of expected.expectedUndefinedProperties) {
395
- expect(!(undefinedProp in comp.props) ||
396
- comp.props[undefinedProp] === undefined, `Property "${undefinedProp}" should be undefined but was: ${JSON.stringify(comp.props ? comp.props[undefinedProp] : undefined)}`).toBeTruthy();
397
- }
398
- }
399
- }
400
- }
401
- // Component artifacts assertions
402
- if (config.expectedComponentArtifacts) {
403
- for (const expectedComponent of config.expectedComponentArtifacts) {
404
- const componentArtifact = components.find((comp) => {
405
- if (comp.filePath !== expectedComponent.filePath) {
406
- return false;
407
- }
408
- const content = comp.content;
409
- const hasExpectedTag = content.includes(`<${expectedComponent.tagName}`);
410
- if (expectedComponent.bindName) {
411
- const hasExpectedBind = content.includes(`bind={${expectedComponent.bindName}}`);
412
- return hasExpectedTag && hasExpectedBind;
413
- }
414
- return hasExpectedTag;
152
+ if (llmobs) {
153
+ try {
154
+ const currentSpanContext = llmobs.exportSpan();
155
+ // Submit numerical score evaluation
156
+ llmobs.submitEvaluation(currentSpanContext, {
157
+ label: "eval_score",
158
+ metricType: "score",
159
+ value: finalScore,
160
+ });
161
+ // Submit pass/fail evaluation
162
+ llmobs.submitEvaluation(currentSpanContext, {
163
+ label: "eval_passed",
164
+ metricType: "categorical",
165
+ value: evalPassed ? "passed" : "failed",
166
+ });
167
+ llmobs.annotate({
168
+ metadata: {
169
+ sb_classification: classification,
170
+ eval_results: { ...evalResults, artifactGroups: undefined },
171
+ },
415
172
  });
416
- expect(componentArtifact, `Component artifact not found for ${expectedComponent.tagName} in ${expectedComponent.filePath}`).toBeDefined();
417
- if (componentArtifact) {
418
- for (const [propKey, propValue] of Object.entries(expectedComponent.expectedProperties ?? {})) {
419
- const hasProperty = componentArtifact.content.includes(`${propKey}=${JSON.stringify(propValue)}`) ||
420
- componentArtifact.content.includes(`${propKey}={${JSON.stringify(propValue)}}`);
421
- expect(hasProperty, `Component artifact missing expected property ${propKey}=${JSON.stringify(propValue)}`).toBeTruthy();
422
- }
423
- // Check assertions for expected undefined properties in component artifacts
424
- if (expectedComponent.expectedUndefinedProperties) {
425
- for (const undefinedProp of expectedComponent.expectedUndefinedProperties) {
426
- const propertyIsPresent = componentArtifact.content.includes(`${undefinedProp}=`) ||
427
- componentArtifact.content.includes(`${undefinedProp} =`);
428
- expect(!propertyIsPresent, `Component artifact should not have property "${undefinedProp}" but it was found`).toBeTruthy();
429
- }
430
- }
431
- }
173
+ console.log(`Successfully submitted evaluations: score=${finalScore}, passed=${evalPassed}`);
174
+ }
175
+ catch (error) {
176
+ console.warn("Failed to submit evaluation to LLM Observability:", error?.message);
432
177
  }
433
178
  }
434
- // Lint check assertion
435
- if (lintResult.hasErrors) {
436
- console.log("Lint results:", JSON.stringify(lintResult, null, 2));
437
- }
438
- expect(lintResult.errorCount).toBeLessThan(10);
439
- return results;
179
+ // Simple vitest assertion based on final score
180
+ expect(evalResults.evalScore >= PASSING_SCORE_THRESHOLD, `Evaluation failed with score ${evalResults.evalScore}/${SCORING_CONFIG.STARTING_SCORE}. ` +
181
+ `Expected >= ${PASSING_SCORE_THRESHOLD}. Full results: ${JSON.stringify(evalResults, null, 2)}`).toBe(true);
182
+ return evalResults;
440
183
  }
441
184
  //# sourceMappingURL=eval-scoring.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eval-scoring.js","sourceRoot":"","sources":["../../../../src/ai-service/evals/helpers/eval-scoring.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AAkD3E,MAAM,oBAAoB,GAItB;IACF,aAAa,EAAE,GAAG;IAClB,qBAAqB,EAAE,GAAG;IAC1B,UAAU,EAAE,GAAG;CAChB,CAAC;AAEF,SAAS,4BAA4B,CACnC,eAAwD,EACxD,MAGC;IAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,mBAAmB,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;IAChC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,iCAAiC;AACjC,2BAA2B;AAC3B,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,SAAS,EACT,UAAU,EACV,MAAM,EACN,SAAS,GAWV;IAgBC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,GACzD,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5B,MAAM,UAAU,GAAe,EAAgB,CAAC;IAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,C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,SAAS,CAAC,SAAS,CAAC,EAAE,CACvF,CAAC,UAAU,EAAE,CAAC;gBACjB,CAAC;gBAED,4EAA4E;gBAC5E,IAAI,iBAAiB,CAAC,2BAA2B,EAAE,CAAC;oBAClD,KAAK,MAAM,aAAa,IAAI,iBAAiB,CAAC,2BAA2B,EAAE,CAAC;wBAC1E,MAAM,iBAAiB,GACrB,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,aAAa,GAAG,CAAC;4BACvD,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC;wBAE3D,MAAM,CACJ,CAAC,iBAAiB,EAClB,gDAAgD,aAAa,oBAAoB,CAClF,CAAC,UAAU,EAAE,CAAC;oBACjB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,uBAAuB;IACvB,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAE/C,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"eval-scoring.js","sourceRoot":"","sources":["../../../../src/ai-service/evals/helpers/eval-scoring.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,0BAA0B,EAC1B,iCAAiC,EACjC,+BAA+B,EAC/B,kCAAkC,EAClC,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,kCAAkC,EAClC,eAAe,GAChB,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