@mizchi/vlmkit-core 0.7.0 → 0.8.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.
- package/dist/a11y-semantic.d.mts +34 -0
- package/dist/a11y-semantic.mjs +261 -0
- package/dist/authored-style-capture.d.mts +42 -0
- package/dist/authored-style-capture.mjs +117 -0
- package/dist/authored-style-diff.d.mts +15 -0
- package/dist/authored-style-diff.mjs +16 -0
- package/dist/cli-args.d.mts +11 -0
- package/dist/cli-args.mjs +21 -0
- package/dist/cli-error.d.mts +4 -0
- package/dist/cli-error.mjs +59 -0
- package/dist/computed-style-capture.d.mts +41 -0
- package/dist/computed-style-capture.mjs +589 -0
- package/dist/computed-style-diff.d.mts +83 -0
- package/dist/computed-style-diff.mjs +123 -0
- package/dist/diff-regions.d.mts +8 -0
- package/dist/diff-regions.mjs +52 -0
- package/dist/dom-equivalence.d.mts +51 -0
- package/dist/dom-equivalence.mjs +91 -0
- package/dist/dom-position-styles.d.mts +166 -0
- package/dist/dom-position-styles.mjs +296 -0
- package/dist/element-compare.d.mts +71 -0
- package/dist/element-compare.mjs +269 -0
- package/dist/heatmap-regions.d.mts +57 -0
- package/dist/heatmap-regions.mjs +158 -0
- package/dist/heatmap.d.mts +86 -0
- package/dist/heatmap.mjs +510 -0
- package/dist/image-resize.d.mts +34 -0
- package/dist/image-resize.mjs +92 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.mjs +14 -0
- package/dist/mask.d.mts +18 -0
- package/dist/mask.mjs +27 -0
- package/dist/png-utils.d.mts +30 -0
- package/dist/png-utils.mjs +80 -0
- package/dist/region-shift.d.mts +20 -0
- package/dist/region-shift.mjs +128 -0
- package/dist/run-ledger.d.mts +14 -0
- package/dist/run-ledger.mjs +31 -0
- package/dist/terminal-colors.d.mts +12 -0
- package/dist/terminal-colors.mjs +14 -0
- package/dist/text-rows.d.mts +121 -0
- package/dist/text-rows.mjs +246 -0
- package/{src/types.ts → dist/types.d.mts} +88 -206
- package/dist/types.mjs +1 -0
- package/package.json +17 -5
- package/src/a11y-semantic.ts +0 -384
- package/src/authored-style-capture.ts +0 -185
- package/src/authored-style-diff.ts +0 -32
- package/src/cli-args.ts +0 -29
- package/src/cli-error.ts +0 -85
- package/src/computed-style-capture.ts +0 -717
- package/src/computed-style-diff.ts +0 -192
- package/src/diff-regions.ts +0 -70
- package/src/dom-equivalence.ts +0 -158
- package/src/dom-position-styles.ts +0 -457
- package/src/element-compare.ts +0 -354
- package/src/heatmap-regions.ts +0 -245
- package/src/heatmap.ts +0 -670
- package/src/image-resize.ts +0 -112
- package/src/index.ts +0 -105
- package/src/mask.ts +0 -41
- package/src/png-utils.ts +0 -86
- package/src/region-shift.ts +0 -173
- package/src/terminal-colors.ts +0 -13
- package/src/text-rows.ts +0 -412
|
@@ -1,57 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
interface PlaywrightReport {
|
|
3
|
+
config: {
|
|
4
|
+
rootDir: string;
|
|
5
|
+
projects: ProjectConfig[];
|
|
6
|
+
};
|
|
5
7
|
suites: TestSuite[];
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
export interface ProjectConfig {
|
|
9
|
+
interface ProjectConfig {
|
|
9
10
|
name: string;
|
|
10
11
|
use: Record<string, unknown>;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
export interface TestSuite {
|
|
13
|
+
interface TestSuite {
|
|
14
14
|
title: string;
|
|
15
15
|
file: string;
|
|
16
16
|
suites?: TestSuite[];
|
|
17
17
|
specs: TestSpec[];
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
export interface TestSpec {
|
|
19
|
+
interface TestSpec {
|
|
21
20
|
title: string;
|
|
22
21
|
ok: boolean;
|
|
23
22
|
tests: TestResult[];
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
export interface TestResult {
|
|
24
|
+
interface TestResult {
|
|
27
25
|
projectName: string;
|
|
28
26
|
status: "expected" | "unexpected" | "flaky" | "skipped";
|
|
29
27
|
duration: number;
|
|
30
28
|
results: TestAttempt[];
|
|
31
29
|
}
|
|
32
|
-
|
|
33
|
-
export interface TestAttempt {
|
|
30
|
+
interface TestAttempt {
|
|
34
31
|
status: "passed" | "failed" | "timedOut" | "skipped";
|
|
35
32
|
duration: number;
|
|
36
33
|
attachments: Attachment[];
|
|
37
34
|
errors: TestError[];
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
export interface Attachment {
|
|
36
|
+
interface Attachment {
|
|
41
37
|
name: string;
|
|
42
38
|
contentType: string;
|
|
43
39
|
path?: string;
|
|
44
40
|
body?: string;
|
|
45
41
|
}
|
|
46
|
-
|
|
47
|
-
export interface TestError {
|
|
42
|
+
interface TestError {
|
|
48
43
|
message: string;
|
|
49
44
|
stack?: string;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
// ---- Structured VRT Data ----
|
|
53
|
-
|
|
54
|
-
export interface VrtSnapshot {
|
|
46
|
+
interface VrtSnapshot {
|
|
55
47
|
testId: string;
|
|
56
48
|
testTitle: string;
|
|
57
49
|
projectName: string;
|
|
@@ -59,8 +51,7 @@ export interface VrtSnapshot {
|
|
|
59
51
|
baselinePath?: string;
|
|
60
52
|
status: "new" | "unchanged" | "changed" | "missing";
|
|
61
53
|
}
|
|
62
|
-
|
|
63
|
-
export interface VrtDiff {
|
|
54
|
+
interface VrtDiff {
|
|
64
55
|
snapshot: VrtSnapshot;
|
|
65
56
|
diffPixels: number;
|
|
66
57
|
totalPixels: number;
|
|
@@ -68,10 +59,8 @@ export interface VrtDiff {
|
|
|
68
59
|
heatmapPath?: string;
|
|
69
60
|
regions: DiffRegion[];
|
|
70
61
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export interface DiffRegion {
|
|
62
|
+
type DiffRegionType = "shift" | "content" | "edge";
|
|
63
|
+
interface DiffRegion {
|
|
75
64
|
x: number;
|
|
76
65
|
y: number;
|
|
77
66
|
width: number;
|
|
@@ -84,16 +73,14 @@ export interface DiffRegion {
|
|
|
84
73
|
/** Deterministic DOM hit-test result for this region's bbox (diff png --elements-*). */
|
|
85
74
|
selectorCandidate?: DiffRegionSelectorCandidate;
|
|
86
75
|
}
|
|
87
|
-
|
|
88
|
-
export interface DiffRegionShift {
|
|
76
|
+
interface DiffRegionShift {
|
|
89
77
|
/** Content moved by +dx px horizontally in current (vs baseline). */
|
|
90
78
|
dx: number;
|
|
91
79
|
/** Content moved by +dy px vertically in current (vs baseline). */
|
|
92
80
|
dy: number;
|
|
93
81
|
confidence: number;
|
|
94
82
|
}
|
|
95
|
-
|
|
96
|
-
export interface DiffRegionSelectorCandidate {
|
|
83
|
+
interface DiffRegionSelectorCandidate {
|
|
97
84
|
selector: string;
|
|
98
85
|
confidence: "high" | "medium" | "low";
|
|
99
86
|
path: string;
|
|
@@ -101,22 +88,19 @@ export interface DiffRegionSelectorCandidate {
|
|
|
101
88
|
regionCoverage: number;
|
|
102
89
|
elementCoverage: number;
|
|
103
90
|
}
|
|
104
|
-
|
|
105
|
-
export interface DiffRegionColor {
|
|
91
|
+
interface DiffRegionColor {
|
|
106
92
|
r: number;
|
|
107
93
|
g: number;
|
|
108
94
|
b: number;
|
|
109
95
|
hex: string;
|
|
110
96
|
}
|
|
111
|
-
|
|
112
|
-
export interface DiffRegionColorPair {
|
|
97
|
+
interface DiffRegionColorPair {
|
|
113
98
|
baseline: DiffRegionColor;
|
|
114
99
|
current: DiffRegionColor;
|
|
115
100
|
/** Euclidean RGB distance between baseline and current. */
|
|
116
101
|
distance: number;
|
|
117
102
|
}
|
|
118
|
-
|
|
119
|
-
export interface DiffRegionColorSample extends DiffRegionColorPair {
|
|
103
|
+
interface DiffRegionColorSample extends DiffRegionColorPair {
|
|
120
104
|
/**
|
|
121
105
|
* The single differing pixel with the largest baseline↔current channel
|
|
122
106
|
* delta, attached when the differing pixels are sparse (thin glyphs, a
|
|
@@ -126,16 +110,14 @@ export interface DiffRegionColorSample extends DiffRegionColorPair {
|
|
|
126
110
|
*/
|
|
127
111
|
peak?: DiffRegionColorPair;
|
|
128
112
|
}
|
|
129
|
-
|
|
130
|
-
export interface ShiftRegion {
|
|
113
|
+
interface ShiftRegion {
|
|
131
114
|
yStart: number;
|
|
132
115
|
yEnd: number;
|
|
133
116
|
shift: number;
|
|
134
117
|
/** Correlation strength of the chosen offset (0..1). Higher = more confident. */
|
|
135
118
|
confidence?: number;
|
|
136
119
|
}
|
|
137
|
-
|
|
138
|
-
export interface DiffReport {
|
|
120
|
+
interface DiffReport {
|
|
139
121
|
diffPixels: number;
|
|
140
122
|
totalPixels: number;
|
|
141
123
|
diffRatio: number;
|
|
@@ -147,58 +129,45 @@ export interface DiffReport {
|
|
|
147
129
|
compensatedDiffCount: number;
|
|
148
130
|
compact: string;
|
|
149
131
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
export type Language = "typescript" | "moonbit" | "rust";
|
|
154
|
-
|
|
155
|
-
export interface DepNode {
|
|
132
|
+
type Language = "typescript" | "moonbit" | "rust";
|
|
133
|
+
interface DepNode {
|
|
156
134
|
id: string;
|
|
157
135
|
filePath: string;
|
|
158
136
|
language: Language;
|
|
159
137
|
exports: string[];
|
|
160
138
|
isComponent: boolean;
|
|
161
139
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
to: string; // imported
|
|
140
|
+
interface DepEdge {
|
|
141
|
+
from: string;
|
|
142
|
+
to: string;
|
|
166
143
|
specifiers: string[];
|
|
167
144
|
}
|
|
168
|
-
|
|
169
|
-
export interface DepGraph {
|
|
145
|
+
interface DepGraph {
|
|
170
146
|
nodes: Map<string, DepNode>;
|
|
171
147
|
edges: DepEdge[];
|
|
172
148
|
}
|
|
173
|
-
|
|
174
|
-
export interface AffectedComponent {
|
|
149
|
+
interface AffectedComponent {
|
|
175
150
|
node: DepNode;
|
|
176
|
-
depth: number;
|
|
151
|
+
depth: number;
|
|
177
152
|
changedDependencies: string[];
|
|
178
153
|
}
|
|
179
|
-
|
|
180
|
-
// ---- Intent / Semantics ----
|
|
181
|
-
|
|
182
|
-
export interface ChangeIntent {
|
|
154
|
+
interface ChangeIntent {
|
|
183
155
|
summary: string;
|
|
184
156
|
expectedVisualChanges: VisualExpectation[];
|
|
185
157
|
expectedA11yChanges: A11yExpectation[];
|
|
186
158
|
affectedComponents: string[];
|
|
187
159
|
changeType: "feature" | "bugfix" | "refactor" | "style" | "deps" | "a11y" | "unknown";
|
|
188
160
|
}
|
|
189
|
-
|
|
190
|
-
export interface VisualExpectation {
|
|
161
|
+
interface VisualExpectation {
|
|
191
162
|
component: string;
|
|
192
163
|
description: string;
|
|
193
|
-
confidence: number;
|
|
164
|
+
confidence: number;
|
|
194
165
|
}
|
|
195
|
-
|
|
196
|
-
export interface A11yExpectation {
|
|
166
|
+
interface A11yExpectation {
|
|
197
167
|
testId: string;
|
|
198
168
|
expectedChanges: ExpectedA11yChange[];
|
|
199
169
|
}
|
|
200
|
-
|
|
201
|
-
export interface ExpectedA11yChange {
|
|
170
|
+
interface ExpectedA11yChange {
|
|
202
171
|
/** NL description (primary). Works standalone */
|
|
203
172
|
description: string;
|
|
204
173
|
/** Structured hint (optional). Used for heuristic matching */
|
|
@@ -207,22 +176,14 @@ export interface ExpectedA11yChange {
|
|
|
207
176
|
role?: string;
|
|
208
177
|
name?: string;
|
|
209
178
|
}
|
|
210
|
-
|
|
211
|
-
// ---- Expectation Manifest (test-first) ----
|
|
212
|
-
//
|
|
213
|
-
// Design: description is primary, structured fields are hints
|
|
214
|
-
// - Minimal form: { description, pages: [{ testId, expect }] }
|
|
215
|
-
// - Structured fields are optional for improved accuracy
|
|
216
|
-
|
|
217
|
-
export interface VrtExpectation {
|
|
179
|
+
interface VrtExpectation {
|
|
218
180
|
/** NL description of the change intent (primary) */
|
|
219
181
|
description: string;
|
|
220
182
|
/** Structured intent (optional). Inferred from description if omitted */
|
|
221
183
|
intent?: Partial<ChangeIntent>;
|
|
222
184
|
pages: PageExpectation[];
|
|
223
185
|
}
|
|
224
|
-
|
|
225
|
-
export interface PageExpectation {
|
|
186
|
+
interface PageExpectation {
|
|
226
187
|
testId: string;
|
|
227
188
|
/** Expected state in NL (alternative to structured fields) */
|
|
228
189
|
expect?: string;
|
|
@@ -232,16 +193,7 @@ export interface PageExpectation {
|
|
|
232
193
|
expectedA11yChanges?: ExpectedA11yChange[];
|
|
233
194
|
expectedVisualChanges?: VisualExpectation[];
|
|
234
195
|
}
|
|
235
|
-
|
|
236
|
-
// ---- Long-cycle Spec (invariants) ----
|
|
237
|
-
//
|
|
238
|
-
// short-cycle: expectation.json -- per-commit, what changes in this commit
|
|
239
|
-
// long-cycle: spec.json -- invariants across multiple commits
|
|
240
|
-
//
|
|
241
|
-
// spec declares "what must always hold".
|
|
242
|
-
// expectation can temporarily override it (regression-expected).
|
|
243
|
-
|
|
244
|
-
export interface UiSpec {
|
|
196
|
+
interface UiSpec {
|
|
245
197
|
/** Description of this spec */
|
|
246
198
|
description: string;
|
|
247
199
|
/** Per-page invariants */
|
|
@@ -249,16 +201,14 @@ export interface UiSpec {
|
|
|
249
201
|
/** Global invariants (applied to all pages) */
|
|
250
202
|
global?: SpecInvariant[];
|
|
251
203
|
}
|
|
252
|
-
|
|
253
|
-
export interface PageSpec {
|
|
204
|
+
interface PageSpec {
|
|
254
205
|
testId: string;
|
|
255
206
|
/** Purpose of this page */
|
|
256
207
|
purpose?: string;
|
|
257
208
|
/** Invariant list */
|
|
258
209
|
invariants: SpecInvariant[];
|
|
259
210
|
}
|
|
260
|
-
|
|
261
|
-
export interface SpecInvariant {
|
|
211
|
+
interface SpecInvariant {
|
|
262
212
|
/** NL description of the invariant (primary) */
|
|
263
213
|
description: string;
|
|
264
214
|
/** Structured hint (optional) */
|
|
@@ -270,35 +220,26 @@ export interface SpecInvariant {
|
|
|
270
220
|
/** Verification cost. "low" = heuristics, "high" = LLM/Vision */
|
|
271
221
|
cost?: "low" | "high";
|
|
272
222
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
| "landmark-exists"
|
|
276
|
-
| "label-present"
|
|
277
|
-
| "no-whiteout"
|
|
278
|
-
| "no-error-state"
|
|
279
|
-
| "text-visible"
|
|
280
|
-
| "element-count"
|
|
281
|
-
| "heading-hierarchy"
|
|
282
|
-
| "aria-relationships"
|
|
283
|
-
| "color-contrast"
|
|
284
|
-
| "responsive-layout"
|
|
285
|
-
| "nl-assertion";
|
|
286
|
-
|
|
287
|
-
// ---- Introspect Output ----
|
|
288
|
-
|
|
289
|
-
export interface IntrospectResult {
|
|
223
|
+
type SpecCheckType = "landmark-exists" | "label-present" | "no-whiteout" | "no-error-state" | "text-visible" | "element-count" | "heading-hierarchy" | "aria-relationships" | "color-contrast" | "responsive-layout" | "nl-assertion";
|
|
224
|
+
interface IntrospectResult {
|
|
290
225
|
generatedAt: string;
|
|
291
226
|
pages: PageIntrospection[];
|
|
292
227
|
}
|
|
293
|
-
|
|
294
|
-
export interface PageIntrospection {
|
|
228
|
+
interface PageIntrospection {
|
|
295
229
|
testId: string;
|
|
296
230
|
/** Auto-generated page description */
|
|
297
231
|
description: string;
|
|
298
232
|
/** Detected landmarks */
|
|
299
|
-
landmarks: {
|
|
233
|
+
landmarks: {
|
|
234
|
+
role: string;
|
|
235
|
+
name: string;
|
|
236
|
+
}[];
|
|
300
237
|
/** Interactive elements */
|
|
301
|
-
interactiveElements: {
|
|
238
|
+
interactiveElements: {
|
|
239
|
+
role: string;
|
|
240
|
+
name: string;
|
|
241
|
+
hasLabel: boolean;
|
|
242
|
+
}[];
|
|
302
243
|
/** Page statistics */
|
|
303
244
|
stats: {
|
|
304
245
|
totalNodes: number;
|
|
@@ -314,13 +255,7 @@ export interface PageIntrospection {
|
|
|
314
255
|
/** Auto-inferred invariants */
|
|
315
256
|
suggestedInvariants: SpecInvariant[];
|
|
316
257
|
}
|
|
317
|
-
|
|
318
|
-
// ---- NL Assertion (future) ----
|
|
319
|
-
//
|
|
320
|
-
// Assert UI state via natural language.
|
|
321
|
-
// Cost: high (Vision LLM call). Pages unaffected by dep graph are skipped.
|
|
322
|
-
|
|
323
|
-
export interface NlAssertion {
|
|
258
|
+
interface NlAssertion {
|
|
324
259
|
/** Assertion text */
|
|
325
260
|
assert: string;
|
|
326
261
|
/** Target page */
|
|
@@ -328,68 +263,58 @@ export interface NlAssertion {
|
|
|
328
263
|
/** Source files this assertion depends on (for dep graph skip decisions) */
|
|
329
264
|
dependsOn?: string[];
|
|
330
265
|
/** Cached result of last verification */
|
|
331
|
-
lastResult?: {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
266
|
+
lastResult?: {
|
|
267
|
+
passed: boolean;
|
|
268
|
+
reasoning: string;
|
|
269
|
+
checkedAt: string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
interface LoopScore {
|
|
273
|
+
usability: number;
|
|
274
|
+
practicality: number;
|
|
275
|
+
fixSteps: number;
|
|
276
|
+
finalQuality: number;
|
|
341
277
|
tokenUsage: number;
|
|
342
278
|
summary: string;
|
|
343
279
|
details: ScoreDetail[];
|
|
344
280
|
}
|
|
345
|
-
|
|
346
|
-
export interface ScoreDetail {
|
|
281
|
+
interface ScoreDetail {
|
|
347
282
|
category: string;
|
|
348
283
|
score: number;
|
|
349
284
|
maxScore: number;
|
|
350
285
|
reasoning: string;
|
|
351
286
|
}
|
|
352
|
-
|
|
353
|
-
export interface DiffSemantics {
|
|
287
|
+
interface DiffSemantics {
|
|
354
288
|
filesChanged: FileChange[];
|
|
355
289
|
commitMessage: string;
|
|
356
290
|
intent: ChangeIntent;
|
|
357
291
|
}
|
|
358
|
-
|
|
359
|
-
export interface FileChange {
|
|
292
|
+
interface FileChange {
|
|
360
293
|
path: string;
|
|
361
294
|
additions: number;
|
|
362
295
|
deletions: number;
|
|
363
296
|
hunks: DiffHunk[];
|
|
364
297
|
}
|
|
365
|
-
|
|
366
|
-
export interface DiffHunk {
|
|
298
|
+
interface DiffHunk {
|
|
367
299
|
header: string;
|
|
368
300
|
content: string;
|
|
369
301
|
startLine: number;
|
|
370
302
|
endLine: number;
|
|
371
303
|
}
|
|
372
|
-
|
|
373
|
-
// ---- Agent Reasoning ----
|
|
374
|
-
|
|
375
|
-
export interface VrtVerdict {
|
|
304
|
+
interface VrtVerdict {
|
|
376
305
|
snapshotId: string;
|
|
377
306
|
decision: "approve" | "reject" | "escalate";
|
|
378
307
|
reasoning: string;
|
|
379
308
|
matchedIntent?: VisualExpectation;
|
|
380
309
|
confidence: number;
|
|
381
310
|
}
|
|
382
|
-
|
|
383
|
-
export interface AgentContext {
|
|
311
|
+
interface AgentContext {
|
|
384
312
|
intent: ChangeIntent;
|
|
385
313
|
diffs: VrtDiff[];
|
|
386
314
|
verdicts: VrtVerdict[];
|
|
387
315
|
qualityChecks: QualityCheckResult[];
|
|
388
316
|
}
|
|
389
|
-
|
|
390
|
-
// ---- Accessibility Semantic Types ----
|
|
391
|
-
|
|
392
|
-
export interface A11yNode {
|
|
317
|
+
interface A11yNode {
|
|
393
318
|
role: string;
|
|
394
319
|
name: string;
|
|
395
320
|
id?: string;
|
|
@@ -411,32 +336,21 @@ export interface A11yNode {
|
|
|
411
336
|
ariaActiveDescendant?: string | string[];
|
|
412
337
|
children?: A11yNode[];
|
|
413
338
|
}
|
|
414
|
-
|
|
415
|
-
export interface A11ySnapshot {
|
|
339
|
+
interface A11ySnapshot {
|
|
416
340
|
testId: string;
|
|
417
341
|
testTitle: string;
|
|
418
342
|
tree: A11yNode;
|
|
419
343
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
| "node-added"
|
|
423
|
-
| "node-removed"
|
|
424
|
-
| "role-changed"
|
|
425
|
-
| "name-changed"
|
|
426
|
-
| "state-changed"
|
|
427
|
-
| "structure-changed"
|
|
428
|
-
| "landmark-changed";
|
|
429
|
-
|
|
430
|
-
export interface A11yChange {
|
|
344
|
+
type A11yChangeType = "node-added" | "node-removed" | "role-changed" | "name-changed" | "state-changed" | "structure-changed" | "landmark-changed";
|
|
345
|
+
interface A11yChange {
|
|
431
346
|
type: A11yChangeType;
|
|
432
|
-
path: string;
|
|
347
|
+
path: string;
|
|
433
348
|
before?: Partial<A11yNode>;
|
|
434
349
|
after?: Partial<A11yNode>;
|
|
435
350
|
severity: "error" | "warning" | "info";
|
|
436
351
|
description: string;
|
|
437
352
|
}
|
|
438
|
-
|
|
439
|
-
export interface A11yDiff {
|
|
353
|
+
interface A11yDiff {
|
|
440
354
|
testId: string;
|
|
441
355
|
changes: A11yChange[];
|
|
442
356
|
hasRegression: boolean;
|
|
@@ -447,34 +361,19 @@ export interface A11yDiff {
|
|
|
447
361
|
modified: number;
|
|
448
362
|
};
|
|
449
363
|
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
export type VisualChangeType =
|
|
454
|
-
| "text-change"
|
|
455
|
-
| "color-change"
|
|
456
|
-
| "layout-shift"
|
|
457
|
-
| "reflow"
|
|
458
|
-
| "element-added"
|
|
459
|
-
| "element-removed"
|
|
460
|
-
| "icon-change";
|
|
461
|
-
|
|
462
|
-
export interface VisualSemanticChange {
|
|
364
|
+
type VisualChangeType = "text-change" | "color-change" | "layout-shift" | "reflow" | "element-added" | "element-removed" | "icon-change";
|
|
365
|
+
interface VisualSemanticChange {
|
|
463
366
|
type: VisualChangeType;
|
|
464
367
|
region: DiffRegion;
|
|
465
368
|
confidence: number;
|
|
466
369
|
description: string;
|
|
467
370
|
}
|
|
468
|
-
|
|
469
|
-
export interface VisualSemanticDiff {
|
|
371
|
+
interface VisualSemanticDiff {
|
|
470
372
|
testId: string;
|
|
471
373
|
changes: VisualSemanticChange[];
|
|
472
374
|
summary: string;
|
|
473
375
|
}
|
|
474
|
-
|
|
475
|
-
// ---- Cross-Validation ----
|
|
476
|
-
|
|
477
|
-
export interface CrossValidationResult {
|
|
376
|
+
interface CrossValidationResult {
|
|
478
377
|
testId: string;
|
|
479
378
|
visualDiff?: VisualSemanticDiff;
|
|
480
379
|
a11yDiff?: A11yDiff;
|
|
@@ -483,10 +382,7 @@ export interface CrossValidationResult {
|
|
|
483
382
|
recommendation: "approve" | "reject" | "escalate";
|
|
484
383
|
reasoning: string;
|
|
485
384
|
}
|
|
486
|
-
|
|
487
|
-
// ---- Unified Agent Context ----
|
|
488
|
-
|
|
489
|
-
export interface UnifiedAgentContext {
|
|
385
|
+
interface UnifiedAgentContext {
|
|
490
386
|
intent: ChangeIntent;
|
|
491
387
|
vrtDiffs: VrtDiff[];
|
|
492
388
|
a11yDiffs: A11yDiff[];
|
|
@@ -495,35 +391,19 @@ export interface UnifiedAgentContext {
|
|
|
495
391
|
verdicts: VrtVerdict[];
|
|
496
392
|
qualityChecks: QualityCheckResult[];
|
|
497
393
|
}
|
|
498
|
-
|
|
499
|
-
// ---- Quality Checks ----
|
|
500
|
-
|
|
501
|
-
export interface QualityCheckResult {
|
|
394
|
+
interface QualityCheckResult {
|
|
502
395
|
check: QualityCheckType;
|
|
503
396
|
passed: boolean;
|
|
504
397
|
details: string;
|
|
505
398
|
severity: "error" | "warning" | "info";
|
|
506
399
|
}
|
|
507
|
-
|
|
508
|
-
export type QualityCheckType =
|
|
509
|
-
| "whiteout"
|
|
510
|
-
| "error-state"
|
|
511
|
-
| "coverage"
|
|
512
|
-
| "layout-shift"
|
|
513
|
-
| "empty-content"
|
|
514
|
-
| "a11y-regression"
|
|
515
|
-
| "a11y-coverage"
|
|
516
|
-
| "landmark-missing"
|
|
517
|
-
| "label-missing";
|
|
518
|
-
|
|
519
|
-
// ---- Capture inputs ----
|
|
520
|
-
|
|
400
|
+
type QualityCheckType = "whiteout" | "error-state" | "coverage" | "layout-shift" | "empty-content" | "a11y-regression" | "a11y-coverage" | "landmark-missing" | "label-missing";
|
|
521
401
|
/**
|
|
522
402
|
* A targetable HTML source: either an inline HTML string or a URL the
|
|
523
403
|
* server fetches on the client's behalf. Shared by both the HTTP API
|
|
524
404
|
* (`api-types`) and the smoke runner (`vrt-markup/inspect`).
|
|
525
405
|
*/
|
|
526
|
-
|
|
406
|
+
interface HtmlSource {
|
|
527
407
|
/** Inline HTML */
|
|
528
408
|
html?: string;
|
|
529
409
|
/** URL (fetched server-side) */
|
|
@@ -531,3 +411,5 @@ export interface HtmlSource {
|
|
|
531
411
|
/** Label (for reports) */
|
|
532
412
|
label?: string;
|
|
533
413
|
}
|
|
414
|
+
//#endregion
|
|
415
|
+
export { A11yChange, A11yChangeType, A11yDiff, A11yExpectation, A11yNode, A11ySnapshot, AffectedComponent, AgentContext, Attachment, ChangeIntent, CrossValidationResult, DepEdge, DepGraph, DepNode, DiffHunk, DiffRegion, DiffRegionColor, DiffRegionColorPair, DiffRegionColorSample, DiffRegionSelectorCandidate, DiffRegionShift, DiffRegionType, DiffReport, DiffSemantics, ExpectedA11yChange, FileChange, HtmlSource, IntrospectResult, Language, LoopScore, NlAssertion, PageExpectation, PageIntrospection, PageSpec, PlaywrightReport, ProjectConfig, QualityCheckResult, QualityCheckType, ScoreDetail, ShiftRegion, SpecCheckType, SpecInvariant, TestAttempt, TestError, TestResult, TestSpec, TestSuite, UiSpec, UnifiedAgentContext, VisualChangeType, VisualExpectation, VisualSemanticChange, VisualSemanticDiff, VrtDiff, VrtExpectation, VrtSnapshot, VrtVerdict };
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mizchi/vlmkit-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "VRT diff engine + shared types — pure image / DOM / a11y / visual comparison primitives.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "mizchi",
|
|
@@ -14,15 +14,26 @@
|
|
|
14
14
|
"url": "https://github.com/mizchi/vlmkit/issues"
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=24"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
17
23
|
"files": [
|
|
18
|
-
"
|
|
19
|
-
"!src/**/*.test.ts",
|
|
24
|
+
"dist/**",
|
|
20
25
|
"README.md",
|
|
21
26
|
"LICENSE"
|
|
22
27
|
],
|
|
23
28
|
"exports": {
|
|
24
|
-
".":
|
|
25
|
-
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"import": "./dist/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./*.ts": {
|
|
34
|
+
"types": "./dist/*.d.mts",
|
|
35
|
+
"import": "./dist/*.mjs"
|
|
36
|
+
}
|
|
26
37
|
},
|
|
27
38
|
"dependencies": {
|
|
28
39
|
"pixelmatch": "^7.1.0",
|
|
@@ -30,6 +41,7 @@
|
|
|
30
41
|
"pngjs": "^7.0.0"
|
|
31
42
|
},
|
|
32
43
|
"scripts": {
|
|
44
|
+
"build": "pnpm --dir ../.. exec tsdown --config tsdown.packages.config.ts --filter @mizchi/vlmkit-core",
|
|
33
45
|
"test": "node --test 'src/**/*.test.ts'"
|
|
34
46
|
}
|
|
35
47
|
}
|