vibecode-anything 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/README.md +239 -67
  2. package/dist/cli.js +2140 -73
  3. package/dist/core/adapters.d.ts +26 -3
  4. package/dist/core/adapters.js +411 -25
  5. package/dist/core/agent-adapter.d.ts +67 -0
  6. package/dist/core/agent-adapter.js +312 -0
  7. package/dist/core/anti-cheat.d.ts +6 -0
  8. package/dist/core/anti-cheat.js +372 -0
  9. package/dist/core/badge.d.ts +18 -0
  10. package/dist/core/badge.js +360 -0
  11. package/dist/core/cache.d.ts +47 -0
  12. package/dist/core/cache.js +403 -0
  13. package/dist/core/ci-export.d.ts +35 -0
  14. package/dist/core/ci-export.js +796 -0
  15. package/dist/core/ci-formats.d.ts +21 -0
  16. package/dist/core/ci-formats.js +388 -0
  17. package/dist/core/client-codegen.d.ts +36 -0
  18. package/dist/core/client-codegen.js +2538 -0
  19. package/dist/core/compose.d.ts +71 -0
  20. package/dist/core/compose.js +1088 -0
  21. package/dist/core/docs-export.d.ts +37 -0
  22. package/dist/core/docs-export.js +2706 -0
  23. package/dist/core/doctor.d.ts +21 -1
  24. package/dist/core/doctor.js +234 -21
  25. package/dist/core/exec.d.ts +26 -2
  26. package/dist/core/exec.js +235 -8
  27. package/dist/core/fixtures.d.ts +153 -0
  28. package/dist/core/fixtures.js +2245 -0
  29. package/dist/core/format.d.ts +77 -0
  30. package/dist/core/format.js +632 -0
  31. package/dist/core/fs-snapshot.d.ts +37 -0
  32. package/dist/core/fs-snapshot.js +216 -0
  33. package/dist/core/graphql-export.d.ts +34 -0
  34. package/dist/core/graphql-export.js +2482 -0
  35. package/dist/core/har-export.d.ts +29 -0
  36. package/dist/core/har-export.js +988 -0
  37. package/dist/core/html-report.d.ts +27 -0
  38. package/dist/core/html-report.js +1535 -0
  39. package/dist/core/http-export.d.ts +31 -0
  40. package/dist/core/http-export.js +726 -0
  41. package/dist/core/impact.d.ts +80 -0
  42. package/dist/core/impact.js +1412 -0
  43. package/dist/core/lint.d.ts +38 -0
  44. package/dist/core/lint.js +1111 -0
  45. package/dist/core/load-export.d.ts +37 -0
  46. package/dist/core/load-export.js +1813 -0
  47. package/dist/core/mcp-export.d.ts +35 -0
  48. package/dist/core/mcp-export.js +1736 -0
  49. package/dist/core/mock-server.d.ts +47 -0
  50. package/dist/core/mock-server.js +1722 -0
  51. package/dist/core/openapi-export.d.ts +44 -0
  52. package/dist/core/openapi-export.js +1074 -0
  53. package/dist/core/parity.d.ts +6 -1
  54. package/dist/core/parity.js +36 -1
  55. package/dist/core/playwright-exporter.d.ts +23 -0
  56. package/dist/core/playwright-exporter.js +1343 -0
  57. package/dist/core/png.js +45 -9
  58. package/dist/core/regression.d.ts +54 -0
  59. package/dist/core/regression.js +529 -0
  60. package/dist/core/responsive.d.ts +86 -0
  61. package/dist/core/responsive.js +606 -0
  62. package/dist/core/run.d.ts +74 -0
  63. package/dist/core/run.js +696 -0
  64. package/dist/core/scheduler.d.ts +24 -0
  65. package/dist/core/scheduler.js +162 -0
  66. package/dist/core/schema-export.d.ts +29 -0
  67. package/dist/core/schema-export.js +2215 -0
  68. package/dist/core/schema.d.ts +3 -2
  69. package/dist/core/schema.js +460 -17
  70. package/dist/core/security.d.ts +233 -0
  71. package/dist/core/security.js +1839 -0
  72. package/dist/core/server-export.d.ts +38 -0
  73. package/dist/core/server-export.js +3198 -0
  74. package/dist/core/spec-writer.d.ts +9 -0
  75. package/dist/core/spec-writer.js +1202 -0
  76. package/dist/core/store.d.ts +11 -2
  77. package/dist/core/store.js +128 -8
  78. package/dist/core/target-map.d.ts +34 -0
  79. package/dist/core/target-map.js +262 -0
  80. package/dist/core/test-exporter.d.ts +25 -0
  81. package/dist/core/test-exporter.js +1918 -0
  82. package/dist/core/types.d.ts +182 -14
  83. package/dist/core/visual-semantic.d.ts +67 -0
  84. package/dist/core/visual-semantic.js +673 -0
  85. package/dist/core/visual.js +65 -16
  86. package/dist/core/watch.d.ts +28 -3
  87. package/dist/core/watch.js +222 -12
  88. package/dist/core/yaml.d.ts +5 -0
  89. package/dist/core/yaml.js +1009 -0
  90. package/dist/diagnostics/diagnose.d.ts +53 -0
  91. package/dist/diagnostics/diagnose.js +1083 -0
  92. package/dist/diagnostics/flake.d.ts +71 -0
  93. package/dist/diagnostics/flake.js +608 -0
  94. package/dist/diagnostics/mutation-audit.d.ts +69 -0
  95. package/dist/diagnostics/mutation-audit.js +769 -0
  96. package/dist/diagnostics/spatial.d.ts +42 -0
  97. package/dist/diagnostics/spatial.js +346 -0
  98. package/dist/diagnostics/trends.d.ts +122 -0
  99. package/dist/diagnostics/trends.js +1190 -0
  100. package/dist/discovery/discover.d.ts +111 -0
  101. package/dist/discovery/discover.js +2017 -0
  102. package/dist/discovery/lock.d.ts +116 -0
  103. package/dist/discovery/lock.js +1505 -0
  104. package/dist/discovery/routes.d.ts +36 -0
  105. package/dist/discovery/routes.js +1494 -0
  106. package/dist/discovery/test-importer.d.ts +92 -0
  107. package/dist/discovery/test-importer.js +4952 -0
  108. package/dist/index.d.ts +123 -0
  109. package/dist/index.js +99 -0
  110. package/dist/ingestors/api-collections.d.ts +28 -0
  111. package/dist/ingestors/api-collections.js +2335 -0
  112. package/dist/ingestors/api-repo.d.ts +2 -1
  113. package/dist/ingestors/api-repo.js +483 -85
  114. package/dist/ingestors/asyncapi.d.ts +26 -0
  115. package/dist/ingestors/asyncapi.js +2105 -0
  116. package/dist/ingestors/bridges.d.ts +2 -0
  117. package/dist/ingestors/bridges.js +702 -0
  118. package/dist/ingestors/cli.d.ts +2 -1
  119. package/dist/ingestors/cli.js +234 -46
  120. package/dist/ingestors/curl.d.ts +14 -0
  121. package/dist/ingestors/curl.js +1024 -0
  122. package/dist/ingestors/graphql.d.ts +56 -0
  123. package/dist/ingestors/graphql.js +1852 -0
  124. package/dist/ingestors/http-file.d.ts +20 -0
  125. package/dist/ingestors/http-file.js +923 -0
  126. package/dist/ingestors/index.js +486 -6
  127. package/dist/ingestors/openrpc.d.ts +29 -0
  128. package/dist/ingestors/openrpc.js +1807 -0
  129. package/dist/ingestors/proto.d.ts +47 -0
  130. package/dist/ingestors/proto.js +2690 -0
  131. package/dist/ingestors/trace.d.ts +10 -0
  132. package/dist/ingestors/trace.js +599 -0
  133. package/dist/ingestors/video.d.ts +4 -1
  134. package/dist/ingestors/video.js +86 -36
  135. package/dist/ingestors/web.d.ts +16 -1
  136. package/dist/ingestors/web.js +474 -32
  137. package/dist/mcp/server.js +3532 -67
  138. package/dist/oracles/api-repo.js +102 -30
  139. package/dist/oracles/cli.js +65 -17
  140. package/dist/oracles/http-workflow.d.ts +68 -0
  141. package/dist/oracles/http-workflow.js +828 -0
  142. package/dist/oracles/image.js +178 -28
  143. package/dist/oracles/index.d.ts +3 -1
  144. package/dist/oracles/index.js +243 -14
  145. package/dist/oracles/perf-budget.d.ts +90 -0
  146. package/dist/oracles/perf-budget.js +1329 -0
  147. package/dist/oracles/stream.d.ts +94 -0
  148. package/dist/oracles/stream.js +1268 -0
  149. package/dist/oracles/ui-states.d.ts +49 -0
  150. package/dist/oracles/ui-states.js +894 -0
  151. package/dist/oracles/video.d.ts +1 -1
  152. package/dist/oracles/video.js +232 -16
  153. package/dist/oracles/web.js +464 -73
  154. package/dist/plugins/builtins.d.ts +12 -0
  155. package/dist/plugins/builtins.js +1052 -0
  156. package/dist/plugins/registry.d.ts +86 -0
  157. package/dist/plugins/registry.js +554 -0
  158. package/dist/setup/index.js +145 -33
  159. package/package.json +56 -47
  160. package/skills/vibecode-anything/SKILL.md +75 -52
@@ -1,16 +1,23 @@
1
1
  /**
2
2
  * Shared TypeScript types and interfaces for vibecode-anything.
3
3
  */
4
+ import type { HttpWorkflowStep, HttpWorkflowStepExpected } from "../oracles/http-workflow.js";
5
+ import type { StreamEventExpectation } from "../oracles/stream.js";
6
+ import type { PluginRegistry } from "../plugins/registry.js";
7
+ import type { ContractFixtures, FixtureRunSummary } from "./fixtures.js";
8
+ import type { TargetMap } from "./target-map.js";
9
+ import type { VerifyMode, WcagLevel } from "./visual-semantic.js";
10
+ export type { ContractFixtures, FixtureRunSummary, VerifyMode, WcagLevel };
4
11
  export type Domain = "cli" | "web" | "image" | "video" | "api" | "repo";
5
- export type IngestDomain = Domain | "script" | "url" | "rea" | "cli-anything";
12
+ export type IngestDomain = Domain | "script" | "url" | "rea" | "cli-anything" | "postman" | "curl" | "graphql" | "http-file" | "insomnia" | "bruno" | "asyncapi" | "proto" | "openrpc";
6
13
  export type InvariantSeverity = "hard" | "soft";
7
- export type InvariantType = "command" | "web_route" | "web_flow" | "web_network" | "image_layout" | "image_perceptual" | "video_timeline" | "http" | "repo_exports";
14
+ export type InvariantType = "command" | "web_route" | "web_flow" | "web_network" | "web_ui_states" | "image_layout" | "image_perceptual" | "video_timeline" | "http" | "http_workflow" | "http_stream" | "ws_protocol" | "perf_budget" | "repo_exports" | "plugin_svg_a11y" | "plugin_state_file" | `plugin_${string}`;
8
15
  export type SoftGateMode = "warn" | "fail";
9
16
  export type NormalizeMode = "crlf" | "ansi" | "timestamps" | "paths" | "trim";
10
17
  export type InvariantStatus = "pass" | "fail" | "skipped" | "warn" | "error";
11
18
  export type GateStatus = "pass" | "pass_with_warnings" | "fail" | "incomplete";
12
19
  export type NextAction = "none" | "fix_hard_invariants_first" | "add_or_enable_invariants_or_adapters" | "review_soft_warnings";
13
- export type ErrorCode = "CONTRACT_INVALID" | "CONTRACT_NOT_FOUND" | "ADAPTER_MISSING" | "ADAPTER_DEGRADED" | "TARGET_MISSING" | "EXEC_TIMEOUT" | "UNSUPPORTED_FORMAT" | "BRIDGE_FORMAT_ERROR" | "CONFIG_INVALID" | "NOT_FOUND" | "EXEC_ERROR" | "INTERNAL_ERROR" | "PARSE_WARNING" | "READ_WARNING" | "BRIDGE_FORMAT_WARNING" | "UNKNOWN_CLIENT";
20
+ export type ErrorCode = "CONTRACT_INVALID" | "CONTRACT_NOT_FOUND" | "ADAPTER_MISSING" | "ADAPTER_DEGRADED" | "TARGET_MISSING" | "EXEC_TIMEOUT" | "UNSUPPORTED_FORMAT" | "BRIDGE_FORMAT_ERROR" | "CONFIG_INVALID" | "NOT_FOUND" | "EXEC_ERROR" | "CONTRACT_TAMPERED" | "INTERNAL_ERROR" | "PARSE_WARNING" | "READ_WARNING" | "BRIDGE_FORMAT_WARNING" | "UNKNOWN_CLIENT";
14
21
  export interface VibecodeErrorOptions {
15
22
  adapter?: string;
16
23
  installHint?: string;
@@ -36,6 +43,8 @@ export interface ValidationResult {
36
43
  }
37
44
  export interface JsonSchema {
38
45
  type?: string | string[];
46
+ nullable?: boolean;
47
+ format?: string;
39
48
  const?: unknown;
40
49
  enum?: unknown[];
41
50
  minLength?: number;
@@ -43,14 +52,22 @@ export interface JsonSchema {
43
52
  pattern?: string;
44
53
  minimum?: number;
45
54
  maximum?: number;
55
+ exclusiveMinimum?: number;
56
+ exclusiveMaximum?: number;
57
+ multipleOf?: number;
46
58
  minItems?: number;
59
+ maxItems?: number;
60
+ uniqueItems?: boolean;
47
61
  items?: JsonSchema | JsonSchema[];
62
+ minProperties?: number;
63
+ maxProperties?: number;
48
64
  required?: string[];
49
65
  properties?: Record<string, JsonSchema>;
50
66
  additionalProperties?: boolean | JsonSchema;
51
67
  allOf?: JsonSchema[];
52
68
  anyOf?: JsonSchema[];
53
69
  oneOf?: JsonSchema[];
70
+ not?: JsonSchema;
54
71
  $ref?: string;
55
72
  example?: unknown;
56
73
  default?: unknown;
@@ -92,6 +109,7 @@ export interface BBox {
92
109
  export interface LayoutRegion {
93
110
  id: string;
94
111
  bbox: BBox;
112
+ kind?: "text_band" | "media_block" | "ui_chrome";
95
113
  }
96
114
  export interface MatchedRegion {
97
115
  refId: string;
@@ -145,12 +163,21 @@ export interface WorkspacePaths {
145
163
  reportPath: string;
146
164
  artifactsDir: string;
147
165
  cacheDir: string;
166
+ specPath: string;
167
+ holdoutsPath: string;
168
+ legacyHoldoutsPath?: string;
169
+ reportHtmlPath?: string;
170
+ historyPath?: string;
148
171
  }
149
172
  export interface AdapterProbeEntry {
150
173
  available: boolean;
151
174
  installHint: string;
152
175
  version?: string;
153
176
  path?: string;
177
+ source?: "playwright" | "playwright-core";
178
+ packagePath?: string;
179
+ browserPath?: string;
180
+ browserName?: string;
154
181
  }
155
182
  export interface AdapterProbeResults {
156
183
  playwright: AdapterProbeEntry;
@@ -171,8 +198,12 @@ export interface FfmpegAdapter {
171
198
  ffmpeg?: string;
172
199
  ffprobe?: string;
173
200
  probeDuration(src: string): number | null;
174
- probeScenes(src: string, sceneThreshold: number, maxFrames: number): number[] | null;
175
- extractFrames(src: string, timestampsMs: number[], outDir: string): FfmpegFrame[];
201
+ probeScenes(src: string, sceneThreshold: number, maxFrames: number, options?: {
202
+ crop?: string;
203
+ }): number[] | null;
204
+ extractFrames(src: string, timestampsMs: number[], outDir: string, options?: {
205
+ crop?: string;
206
+ }): FfmpegFrame[];
176
207
  }
177
208
  export interface ExtractedVideoState {
178
209
  id: string;
@@ -233,6 +264,22 @@ export interface WebLandmark {
233
264
  required?: boolean;
234
265
  textContains?: string;
235
266
  }
267
+ export interface WebInteractiveLandmark {
268
+ role: string;
269
+ tag: string;
270
+ name?: string;
271
+ }
272
+ export interface FsEffectEntry {
273
+ path: string;
274
+ status: "created" | "modified" | "deleted";
275
+ sha256?: string;
276
+ size?: number;
277
+ preview?: string;
278
+ }
279
+ export interface AntiCheatReport {
280
+ status: "clean" | "suspected";
281
+ reasons: string[];
282
+ }
236
283
  export interface WebBoundingBox {
237
284
  selector?: string;
238
285
  id?: string;
@@ -250,6 +297,31 @@ export interface WebFlowStep {
250
297
  text?: string;
251
298
  [key: string]: unknown;
252
299
  }
300
+ export interface InvariantStep {
301
+ action?: string;
302
+ selector?: string;
303
+ value?: unknown;
304
+ key?: string;
305
+ url?: string;
306
+ path?: string;
307
+ waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
308
+ timeoutMs?: number;
309
+ text?: string;
310
+ id?: string;
311
+ method?: string;
312
+ query?: Record<string, string | number | boolean>;
313
+ headers?: Record<string, string>;
314
+ body?: unknown;
315
+ extract?: Record<string, string>;
316
+ expected?: HttpWorkflowStepExpected;
317
+ json?: unknown;
318
+ code?: number;
319
+ textExact?: string;
320
+ textContains?: string;
321
+ jsonSchema?: JsonSchema;
322
+ jsonSubset?: unknown;
323
+ jsonPaths?: JsonPathAssertion[];
324
+ }
253
325
  export interface WebDomAssertion {
254
326
  selector: string;
255
327
  count?: number;
@@ -293,6 +365,9 @@ export interface ImageDimensionsExpected {
293
365
  aspectRatioTolerance?: number;
294
366
  }
295
367
  export interface InvariantInput {
368
+ kind?: "http" | "command";
369
+ runs?: number;
370
+ warmupRuns?: number;
296
371
  args?: string[];
297
372
  stdin?: string | null;
298
373
  env?: Record<string, string | undefined>;
@@ -300,11 +375,19 @@ export interface InvariantInput {
300
375
  timeoutMs?: number;
301
376
  shell?: boolean;
302
377
  path?: string;
378
+ urlPath?: string;
303
379
  startPath?: string;
304
380
  triggerPath?: string;
305
381
  viewport?: Viewport;
306
382
  waitUntil?: string;
307
- steps?: WebFlowStep[];
383
+ steps?: Array<WebFlowStep | InvariantStep>;
384
+ finallySteps?: HttpWorkflowStep[];
385
+ vars?: Record<string, string>;
386
+ cookieJar?: boolean;
387
+ format?: "sse" | "ndjson" | "auto";
388
+ maxBytes?: number;
389
+ maxEvents?: number;
390
+ maxMessageBytes?: number;
308
391
  method?: string;
309
392
  headers?: Record<string, string>;
310
393
  query?: Record<string, string | number | boolean>;
@@ -315,6 +398,9 @@ export interface InvariantInput {
315
398
  orderMode?: string;
316
399
  perceptualOnly?: boolean;
317
400
  dimensions?: ImageDimensionsExpected;
401
+ fsDiff?: boolean;
402
+ storageState?: string;
403
+ ignorePaths?: string[];
318
404
  [key: string]: unknown;
319
405
  }
320
406
  export interface InvariantExpected {
@@ -332,6 +418,20 @@ export interface InvariantExpected {
332
418
  jsonPaths?: JsonPathAssertion[];
333
419
  status?: number | number[];
334
420
  maxLatencyMs?: number;
421
+ maxP50Ms?: number;
422
+ maxP95Ms?: number;
423
+ maxP99Ms?: number;
424
+ maxMeanMs?: number;
425
+ maxDurationMs?: number;
426
+ maxBytes?: number;
427
+ minBytes?: number;
428
+ maxErrorRate?: number;
429
+ minEvents?: number;
430
+ maxEvents?: number;
431
+ forbidMalformedEvents?: boolean;
432
+ terminalEvent?: StreamEventExpectation;
433
+ orderedEvents?: StreamEventExpectation[];
434
+ closeCode?: number;
335
435
  bodyExact?: string;
336
436
  bodyContains?: string | string[];
337
437
  headers?: Record<string, string>;
@@ -357,6 +457,20 @@ export interface InvariantExpected {
357
457
  filesPresent?: string[];
358
458
  exports?: RepoExportEntry[];
359
459
  assertions?: unknown[];
460
+ fsEffects?: FsEffectEntry[];
461
+ interactiveLandmarks?: WebInteractiveLandmark[];
462
+ noPageErrors?: boolean;
463
+ noServerErrors?: boolean;
464
+ wcagLevel?: WcagLevel;
465
+ responsiveViewports?: Array<{
466
+ name: string;
467
+ width: number;
468
+ height: number;
469
+ }>;
470
+ requireViewBox?: boolean;
471
+ requireAccessibleName?: boolean;
472
+ minElements?: number;
473
+ requiredIds?: string[];
360
474
  [key: string]: unknown;
361
475
  }
362
476
  export interface InvariantTolerance {
@@ -379,6 +493,8 @@ export interface Invariant {
379
493
  description: string;
380
494
  tags: string[];
381
495
  sourceId?: string;
496
+ holdout?: boolean;
497
+ holdoutHint?: string;
382
498
  input: InvariantInput;
383
499
  expected: InvariantExpected;
384
500
  tolerance: InvariantTolerance;
@@ -424,6 +540,7 @@ export interface ContractV02 {
424
540
  thresholds: ParityThresholds;
425
541
  invariants: Invariant[];
426
542
  slices?: ContractSlice[];
543
+ fixtures?: ContractFixtures;
427
544
  }
428
545
  export interface InvariantResult {
429
546
  id: string;
@@ -437,6 +554,7 @@ export interface InvariantResult {
437
554
  metrics?: Record<string, unknown>;
438
555
  diagnostic?: Diagnostic;
439
556
  durationMs?: number;
557
+ repro?: string;
440
558
  }
441
559
  export interface OracleInvariantOutcome {
442
560
  status: InvariantStatus;
@@ -479,6 +597,8 @@ export interface ParityReport {
479
597
  reasons: string[];
480
598
  };
481
599
  nextAction: NextAction;
600
+ antiCheat?: AntiCheatReport;
601
+ fixtureSummary?: FixtureRunSummary;
482
602
  results: InvariantResult[];
483
603
  }
484
604
  export interface CliProbeSpec {
@@ -533,6 +653,17 @@ export interface IngestOptions {
533
653
  maxFrames?: number;
534
654
  defaults?: Record<string, unknown>;
535
655
  forceManifest?: boolean;
656
+ noSpec?: boolean;
657
+ crawlDepth?: number;
658
+ holdoutRoutes?: string[];
659
+ crop?: string;
660
+ env?: Record<string, string>;
661
+ fsDiff?: boolean;
662
+ headers?: Record<string, string>;
663
+ storageState?: string;
664
+ fromCommands?: string;
665
+ fromHar?: string;
666
+ fromTests?: string;
536
667
  }
537
668
  export interface IngestResult {
538
669
  domain: Domain;
@@ -540,6 +671,7 @@ export interface IngestResult {
540
671
  artifacts: ContractArtifacts;
541
672
  invariants: Invariant[];
542
673
  warnings: Diagnostic[];
674
+ specPath?: string;
543
675
  }
544
676
  export interface HttpResponseObservation {
545
677
  status: number;
@@ -590,6 +722,12 @@ export interface PlaywrightPageLike {
590
722
  waitForSelector(selector: string, options?: {
591
723
  timeout?: number;
592
724
  }): Promise<unknown>;
725
+ waitForLoadState?(state?: "load" | "domcontentloaded" | "networkidle", options?: {
726
+ timeout?: number;
727
+ }): Promise<void>;
728
+ setExtraHTTPHeaders?(headers: Record<string, string>): Promise<void>;
729
+ setViewportSize?(viewport: Viewport): Promise<void>;
730
+ content?(): Promise<string>;
593
731
  url?(): string;
594
732
  evaluate<R>(pageFunction: () => R): Promise<R>;
595
733
  on?(event: "response", listener: (res: PlaywrightResponseLike) => void): void;
@@ -604,18 +742,29 @@ export interface PlaywrightPageLike {
604
742
  __consoleErrors?: string[];
605
743
  __pageErrors?: string[];
606
744
  }
745
+ export interface PlaywrightLaunchOptions {
746
+ headless?: boolean;
747
+ executablePath?: string;
748
+ args?: string[];
749
+ }
750
+ export interface PlaywrightContextOptions {
751
+ viewport?: Viewport;
752
+ extraHTTPHeaders?: Record<string, string>;
753
+ storageState?: string;
754
+ }
755
+ export interface PlaywrightContextLike {
756
+ newPage(): Promise<PlaywrightPageLike>;
757
+ close(): Promise<void>;
758
+ }
607
759
  export interface PlaywrightBrowserLike {
608
- newPage(options?: {
609
- viewport?: Viewport;
610
- }): Promise<PlaywrightPageLike>;
760
+ newPage(options?: PlaywrightContextOptions): Promise<PlaywrightPageLike>;
761
+ newContext?(options?: PlaywrightContextOptions): Promise<PlaywrightContextLike>;
611
762
  close(): Promise<void>;
612
763
  }
613
764
  export interface PlaywrightLike {
614
765
  version?: string;
615
766
  chromium: {
616
- launch(options?: {
617
- headless?: boolean;
618
- }): Promise<PlaywrightBrowserLike>;
767
+ launch(options?: PlaywrightLaunchOptions): Promise<PlaywrightBrowserLike>;
619
768
  };
620
769
  }
621
770
  export interface SharpPipelineLike {
@@ -638,7 +787,7 @@ export interface IngestDeps {
638
787
  sharp?: SharpLike | null;
639
788
  playwright?: PlaywrightLike | null;
640
789
  ffmpegAdapter?: FfmpegAdapter | null;
641
- fetchRoute?: (url: string, viewport?: Viewport, timeoutMs?: number) => Promise<FetchRouteObservation>;
790
+ fetchRoute?: (url: string, viewport?: Viewport, timeoutMs?: number, headers?: Record<string, string>) => Promise<FetchRouteObservation>;
642
791
  fetchJson?: (url: string, options?: {
643
792
  method?: string;
644
793
  headers?: Record<string, string>;
@@ -650,27 +799,46 @@ export type IngestorFn = (options?: IngestOptions, deps?: IngestDeps) => Promise
650
799
  export interface VerifyOptions {
651
800
  target: string;
652
801
  strict?: boolean;
802
+ mode?: VerifyMode;
803
+ concurrency?: number;
804
+ pluginRegistry?: PluginRegistry;
653
805
  invariantIds?: string[];
654
806
  sliceIds?: string[];
655
807
  cwd?: string;
808
+ revealHoldouts?: boolean;
809
+ useCache?: boolean;
656
810
  }
657
811
  export interface OracleContext {
658
812
  target: string;
813
+ /** Optional per-domain target overrides (e.g. { web: "http://localhost:3000", cli: "./bin/app" }). */
814
+ targets?: TargetMap;
815
+ /** Runtime workflow variables (secrets); never cached, always redacted from outputs. */
816
+ vars?: Record<string, string>;
659
817
  cwd?: string;
660
818
  contract?: ContractV02;
661
819
  artifactsDir?: string;
662
820
  cacheDir?: string;
663
821
  strict?: boolean;
822
+ mode?: VerifyMode;
823
+ concurrency?: number;
824
+ pluginRegistry?: PluginRegistry;
664
825
  invariantIds?: string[];
665
826
  viewport?: Viewport;
666
827
  currentInvariantId?: string;
667
828
  runtimeCache?: Record<string, unknown>;
829
+ revealHoldouts?: boolean;
830
+ useCache?: boolean;
831
+ headers?: Record<string, string>;
832
+ storageState?: string;
833
+ skipFixtures?: boolean;
834
+ allowFixtureCommands?: boolean;
668
835
  }
669
836
  export interface VerifyDeps {
670
837
  sharp?: SharpLike | null;
671
838
  playwright?: PlaywrightLike | null;
672
839
  ffmpegAdapter?: FfmpegAdapter | null;
673
- fetchRoute?: (url: string, timeoutMs?: number) => Promise<FetchRouteObservation>;
840
+ fetchImpl?: typeof fetch;
841
+ fetchRoute?: (url: string, timeoutMs?: number, headers?: Record<string, string>) => Promise<FetchRouteObservation>;
674
842
  fetchWithTimeout?: (url: string, options?: {
675
843
  method?: string;
676
844
  headers?: Record<string, string>;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Pure-Node WCAG 2.1 AA/AAA contrast audit, design-token extractor,
3
+ * and semantic verification modes (`exact`, `structural`, `functional`, `reskin`).
4
+ *
5
+ * Zero runtime dependencies; reuses `extractLayoutRegions` from `./visual.js`.
6
+ */
7
+ import type { BBox, Invariant, PaletteEntry, RgbaImage } from "./types.js";
8
+ export type VerifyMode = "exact" | "structural" | "functional" | "reskin";
9
+ export declare const VALID_VERIFY_MODES: ReadonlySet<string>;
10
+ export type WcagLevel = "AA" | "AAA";
11
+ export interface RgbColor {
12
+ r: number;
13
+ g: number;
14
+ b: number;
15
+ }
16
+ export interface DesignTokenReport {
17
+ background: string;
18
+ surface: string;
19
+ foreground: string;
20
+ accent: string | null;
21
+ muted: string | null;
22
+ theme: "light" | "dark";
23
+ foregroundContrast: number;
24
+ accentContrast: number | null;
25
+ palette: PaletteEntry[];
26
+ }
27
+ export interface WcagContrastViolation {
28
+ regionId: string;
29
+ bbox: BBox;
30
+ foregroundHex: string;
31
+ backgroundHex: string;
32
+ contrastRatio: number;
33
+ requiredRatio: number;
34
+ level: WcagLevel;
35
+ isLargeText: boolean;
36
+ }
37
+ export interface WcagContrastAuditReport {
38
+ passed: boolean;
39
+ level: WcagLevel;
40
+ minRequiredRatio: number;
41
+ checkedRegions: number;
42
+ worstContrastRatio: number;
43
+ designTokens: DesignTokenReport;
44
+ violations: WcagContrastViolation[];
45
+ }
46
+ export interface SemanticModeDecision {
47
+ mode: VerifyMode;
48
+ shouldRun: boolean;
49
+ skipReason?: string;
50
+ enforceWcagAudit: boolean;
51
+ relaxColorChecks: boolean;
52
+ adjustedInvariant: Invariant;
53
+ }
54
+ export declare function parseHexColor(hex: string): RgbColor | null;
55
+ export declare function rgbToHex(rgb: RgbColor): string;
56
+ export declare function computeRelativeLuminance(rgb: RgbColor): number;
57
+ export declare function computeContrastRatio(fg: RgbColor | string, bg: RgbColor | string): number;
58
+ export declare function extractDesignTokens(img: RgbaImage): DesignTokenReport;
59
+ export declare function auditWcagContrast(img: RgbaImage, options?: {
60
+ level?: WcagLevel;
61
+ largeText?: boolean;
62
+ maxRegions?: number;
63
+ }): WcagContrastAuditReport;
64
+ export declare function applyVerifyModeToInvariant(invariant: Invariant, mode: VerifyMode): SemanticModeDecision;
65
+ export declare function formatPrettyWcagAudit(report: WcagContrastAuditReport, options?: {
66
+ color?: boolean;
67
+ }): string;