@forkpoint/agent-lighthouse-core 1.0.0 → 2.0.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.
package/dist/index.d.ts CHANGED
@@ -6,11 +6,28 @@ interface FetchOptions {
6
6
  timeout?: number;
7
7
  followRedirects?: boolean;
8
8
  acceptHeader?: string;
9
- method?: 'GET' | 'POST' | 'OPTIONS' | 'HEAD';
9
+ method?: 'GET' | 'POST' | 'OPTIONS' | 'HEAD' | 'DELETE';
10
10
  body?: string;
11
11
  contentType?: string;
12
+ /** Override the User-Agent header (e.g. to probe a site as a specific AI bot). */
13
+ userAgent?: string;
14
+ /**
15
+ * Extra request headers (e.g. `MCP-Protocol-Version`). Applied before the
16
+ * fetcher's own headers, so a caller can add headers but cannot clobber the
17
+ * scanner User-Agent, the negotiated Accept, or credentials lifted out of the
18
+ * URL's userinfo.
19
+ */
20
+ headers?: Record<string, string>;
12
21
  /** External abort (e.g. the per-scan deadline). Combined with the per-request timeout. */
13
22
  signal?: AbortSignal;
23
+ /**
24
+ * Read the response as bytes instead of text.
25
+ *
26
+ * `body` is a UTF-8 decoded string, which replaces every invalid sequence
27
+ * with U+FFFD — fatal for an image, whose provenance metadata is binary. With
28
+ * this flag the response arrives in `bytes` and `body` stays empty.
29
+ */
30
+ binary?: boolean;
14
31
  }
15
32
  interface FetchResult {
16
33
  url: string;
@@ -22,6 +39,8 @@ interface FetchResult {
22
39
  totalMs: number;
23
40
  contentType: string;
24
41
  contentLength: number;
42
+ /** Raw response bytes. Present only when the request asked for `binary`. */
43
+ bytes?: Uint8Array;
25
44
  error?: string;
26
45
  }
27
46
  /**
@@ -35,10 +54,20 @@ declare function createFetcher(): {
35
54
 
36
55
  interface WafProtection {
37
56
  isBlocked: boolean;
38
- provider?: 'akamai' | 'cloudflare' | 'datadome' | 'perimeterx' | 'imperva' | 'kasada' | 'aws-waf' | 'generic-waf' | 'connection-drop';
57
+ provider?: 'akamai' | 'cloudflare' | 'datadome' | 'perimeterx' | 'imperva' | 'kasada' | 'aws-waf' | 'generic-waf' | 'connection-drop' | 'rate-limited';
39
58
  name: string;
40
59
  reason: string;
41
60
  statusCode?: number;
61
+ /**
62
+ * The scan was throttled, not refused.
63
+ *
64
+ * An HTTP 429 says "too many requests", which is a statement about this
65
+ * scan's request rate and not about who the site admits. An audit that
66
+ * cannot tell the two apart must not report a bot wall on the strength of
67
+ * one — a storefront that serves GPTBot perfectly well would be told its
68
+ * firewall is blocking AI crawlers.
69
+ */
70
+ isRateLimit?: boolean;
42
71
  }
43
72
  /**
44
73
  * Analyzes fetch results (homepage, root files, extra pages) to determine
@@ -89,13 +118,23 @@ interface AuditGuidance {
89
118
  tags?: string[];
90
119
  }
91
120
  type ScoreDisplayMode = 'binary' | 'ternary' | 'informative';
92
- /** Public sunset notice for a deprecated audit (see docs/evidence/sunset/NOT-A-FACTOR.md). */
121
+ /** Public sunset notice for a deprecated audit (see docs/evidence/sunset/not-a-factor.md). */
93
122
  interface DeprecationNotice {
94
123
  /** One sentence: why this signal is not a factor. */
95
124
  notice: string;
96
- /** Public rationale URL (NOT-A-FACTOR.md anchor). */
125
+ /** Public rationale URL (not-a-factor.md anchor). */
97
126
  link: string;
98
127
  }
128
+ /**
129
+ * Strength of the published evidence backing an audit, assigned in the audit's
130
+ * dossier per docs/evidence/policy.md. Only A and B carry scoring weight.
131
+ */
132
+ type EvidenceGrade = 'A' | 'B' | 'C' | 'D';
133
+ /**
134
+ * How an audit participates in scoring. Derived from its evidence grade
135
+ * (spec §4): only `scored` audits move a category score.
136
+ */
137
+ type AuditTier = 'scored' | 'informative' | 'experimental';
99
138
  interface AuditMeta {
100
139
  id: string;
101
140
  category: string;
@@ -109,6 +148,12 @@ interface AuditMeta {
109
148
  guidance?: AuditGuidance;
110
149
  /** Present when the audit is sunset: shown as a notice, excluded from scores. */
111
150
  deprecated?: DeprecationNotice;
151
+ /** Evidence grade from the audit's dossier (docs/evidence/policy.md). */
152
+ evidenceGrade?: EvidenceGrade;
153
+ /** Scoring tier derived from the grade (spec §4). */
154
+ tier?: AuditTier;
155
+ /** Repo-relative path to the audit's evidence dossier. */
156
+ dossier?: string;
112
157
  }
113
158
  interface AuditResult {
114
159
  status: CheckStatus;
@@ -126,6 +171,13 @@ interface AuditResult {
126
171
  };
127
172
  pageUrl?: string;
128
173
  priority?: CheckPriority;
174
+ /**
175
+ * A fix written from what this scan actually found.
176
+ *
177
+ * Overrides `meta.guidance.fix` in the report, so an audit can name the
178
+ * offending section rather than repeat the generic advice.
179
+ */
180
+ remediation?: string;
129
181
  }
130
182
  type CheckStatus = 'pass' | 'warn' | 'fail' | 'na';
131
183
  type CheckPriority = 'critical' | 'high' | 'medium' | 'low';
@@ -142,6 +194,8 @@ interface CheckResult {
142
194
  description: string;
143
195
  status: CheckStatus;
144
196
  score: number;
197
+ /** Evidence-derived weight copied from AuditMeta.weight (A=1.0, B=0.6, informative=0). */
198
+ weight?: number;
145
199
  scoreDisplayMode: ScoreDisplayMode;
146
200
  displayValue?: string;
147
201
  explanation?: string;
@@ -154,11 +208,17 @@ interface CheckResult {
154
208
  found?: string;
155
209
  code?: string;
156
210
  docsUrl?: string;
211
+ /** The published evidence dossier for this check, derived from its id. */
212
+ evidenceUrl?: string;
157
213
  [key: string]: unknown;
158
214
  };
159
215
  tags?: string[];
160
216
  /** Present when the audit is sunset: shown as a notice, excluded from scores. */
161
217
  deprecated?: DeprecationNotice;
218
+ /** Evidence grade copied from AuditMeta.evidenceGrade. */
219
+ evidenceGrade?: EvidenceGrade;
220
+ /** Scoring tier copied from AuditMeta.tier. */
221
+ tier?: AuditTier;
162
222
  }
163
223
  interface CategoryResult {
164
224
  id: string;
@@ -209,90 +269,6 @@ interface ReadinessVitals {
209
269
  technical: number;
210
270
  }
211
271
 
212
- type PhaseId = 'fetch-root' | 'fetch-pages' | 'analyze' | 'audits' | 'report';
213
- type ScanEvent = {
214
- type: 'scan:start';
215
- url: string;
216
- fraction: number;
217
- elapsedMs: number;
218
- } | {
219
- type: 'phase:start';
220
- phase: PhaseId;
221
- totalUnits: number;
222
- fraction: number;
223
- elapsedMs: number;
224
- } | {
225
- type: 'unit:done';
226
- phase: PhaseId;
227
- completed: number;
228
- total: number;
229
- label?: string;
230
- fraction: number;
231
- elapsedMs: number;
232
- } | {
233
- type: 'unit:fail';
234
- phase: PhaseId;
235
- label: string;
236
- error: string;
237
- fraction: number;
238
- elapsedMs: number;
239
- } | {
240
- type: 'phase:done';
241
- phase: PhaseId;
242
- durationMs: number;
243
- fraction: number;
244
- elapsedMs: number;
245
- } | {
246
- type: 'scan:done';
247
- durationMs: number;
248
- score: number;
249
- fraction: number;
250
- elapsedMs: number;
251
- };
252
- /**
253
- * How much of the overall scan fraction each phase owns. Sums to 1 so the
254
- * fraction of a finished scan is exactly 1.
255
- */
256
- declare const PHASE_WEIGHTS: Record<PhaseId, number>;
257
- /**
258
- * Turns scan milestones into {@link ScanEvent}s. Owns the fraction math
259
- * (`Σ weights of done phases + current phase weight × completed/total`),
260
- * clamps it to be monotonic non-decreasing, and stamps `fraction`/`elapsedMs`
261
- * onto every event. Emission is synchronous — throttling is a consumer concern.
262
- */
263
- declare class ProgressTracker {
264
- private readonly onEvent;
265
- private readonly startMs;
266
- private doneWeight;
267
- private phase;
268
- private phaseStartMs;
269
- private totalUnits;
270
- private completedUnits;
271
- private lastFraction;
272
- constructor(onEvent: (event: ScanEvent) => void);
273
- /** Fraction of the whole scan that is complete, in [0, 1]. Never decreases. */
274
- get fraction(): number;
275
- /** Stamp an event with the current fraction/elapsed and advance the floor. */
276
- private stamp;
277
- private elapsedMs;
278
- scanStart(url: string): void;
279
- phaseStart(phase: PhaseId, totalUnits: number): void;
280
- /** Correct the current phase's unit total (e.g. discovery finds pages mid-phase). */
281
- setPhaseTotal(totalUnits: number): void;
282
- unitDone(label?: string): void;
283
- /** A failed unit still counts as settled work so the phase can complete. */
284
- unitFail(label: string, error: string): void;
285
- phaseDone(): void;
286
- scanDone(score: number): void;
287
- }
288
-
289
- interface ScanOptions {
290
- onEvent?: (event: ScanEvent) => void;
291
- pages?: PageOverride[] | null;
292
- signal?: AbortSignal;
293
- }
294
- declare function runScan(url: string, options?: ScanOptions): Promise<ScanReport>;
295
-
296
272
  interface A11yNodeFinding {
297
273
  target: string;
298
274
  summary: string;
@@ -343,6 +319,14 @@ interface CheckContext {
343
319
  }
344
320
  type CheckFn = (ctx: CheckContext) => CheckResult | Promise<CheckResult>;
345
321
 
322
+ /**
323
+ * Where an audit's evidence dossier is published. A pure function of the id.
324
+ *
325
+ * Every audit id is `<category>/<slug>`, and the documentation site publishes
326
+ * one page per dossier at that path with a trailing slash (`trailingSlash:
327
+ * 'always'`), so no per-audit field is needed to reach the evidence.
328
+ */
329
+ declare function evidenceUrl(id: string): string;
346
330
  /**
347
331
  * Base class for all audits. Follows the Lighthouse pattern:
348
332
  * each audit is a class with a static `meta` descriptor and
@@ -351,6 +335,16 @@ type CheckFn = (ctx: CheckContext) => CheckResult | Promise<CheckResult>;
351
335
  declare abstract class Audit {
352
336
  static meta: AuditMeta;
353
337
  private static readonly PRIORITY_MAP;
338
+ /**
339
+ * Split the fourth argument of `fail`/`warn` into a priority and a fix.
340
+ *
341
+ * The argument started as a priority token and grew a second use: audits
342
+ * pass a sentence describing the fix for what this scan found. A sentence is
343
+ * not a `CheckPriority`, and putting it there made `toCheckResult` throw on
344
+ * the schema — so a sentence is read as the remediation and the priority
345
+ * falls back to the audit's default.
346
+ */
347
+ private static splitRecommendation;
354
348
  /** Validate an audit result against the schema. */
355
349
  protected validate(result: AuditResult): AuditResult;
356
350
  /** Run the audit and return a result. */
@@ -381,7 +375,11 @@ declare abstract class Audit {
381
375
  interface CategoryConfig {
382
376
  id: string;
383
377
  name: string;
384
- /** Weight in the overall score (all weights should sum to 1.0). */
378
+ /**
379
+ * Evidence mass: the summed weight of the category's registered audits
380
+ * (spec §4). Relative, not a percentage — `calculateOverallScore` normalizes
381
+ * by the total mass, so a category with no scored audits weighs nothing.
382
+ */
385
383
  weight: number;
386
384
  }
387
385
  interface AuditRegistration {
@@ -395,7 +393,76 @@ interface ScanConfig {
395
393
  /** categoryId → list of audit registrations */
396
394
  audits: Record<string, AuditRegistration[]>;
397
395
  }
396
+ /**
397
+ * Evidence mass per category: Σ of the member audits' weights (spec §4).
398
+ *
399
+ * This replaces the old hand-tuned `CATEGORY_WEIGHTS` map. A category earns
400
+ * influence over the overall score by carrying proven audits, so moving an
401
+ * audit between categories moves its mass with it and nothing else changes.
402
+ * Categories made entirely of informative/experimental audits have mass 0 and
403
+ * cannot move the overall score.
404
+ */
405
+ declare const CATEGORY_MASS: Record<string, number>;
398
406
  declare const defaultConfig: ScanConfig;
407
+ /** Every registered category id, in canonical report order. */
408
+ declare const CATEGORY_IDS: readonly string[];
409
+ /**
410
+ * Narrow a scan to a subset of the registry.
411
+ *
412
+ * Two independent filters: `categories` restricts which categories run at all,
413
+ * and `includeExperimental` decides whether experimental-tier audits are part
414
+ * of the run. Experimental audits are excluded unless asked for — they carry
415
+ * weight 0 either way, but running an unvalidated check on every scan is a
416
+ * decision the operator makes, not a default.
417
+ *
418
+ * Returns the same object when there is nothing to filter, so the common path
419
+ * allocates nothing.
420
+ */
421
+ declare function filterConfig(config: ScanConfig, opts: {
422
+ categories?: string[];
423
+ includeExperimental?: boolean;
424
+ }): ScanConfig;
425
+
426
+ /**
427
+ * What one audit did, in a form that can be diffed.
428
+ *
429
+ * A report says what an audit concluded. Tracing bad logic needs more: which
430
+ * audits never ran and why, how long each took, and what evidence each verdict
431
+ * was drawn from. That is the difference between "this site failed
432
+ * `faqpage-schema`" and "`faqpage-schema` ran in 4ms against 0 sampled pages",
433
+ * and only the second one tells you where to look.
434
+ *
435
+ * One record per registered audit, every scan, no exceptions — an audit that
436
+ * crashed or was skipped is exactly the one worth seeing.
437
+ */
438
+ interface AuditTrace {
439
+ id: string;
440
+ category: string;
441
+ /**
442
+ * `ran` — the audit executed and returned.
443
+ * `skipped` — no scanned page matched its `applicablePageTypes`.
444
+ * `error` — it threw, or its result was rejected by the schema.
445
+ */
446
+ outcome: 'ran' | 'skipped' | 'error';
447
+ status: CheckStatus;
448
+ score: number;
449
+ weight: number;
450
+ tier?: string;
451
+ evidenceGrade?: string;
452
+ /** Wall time inside `audit()`. Zero for an audit that never ran. */
453
+ durationMs: number;
454
+ displayValue?: string;
455
+ explanation?: string;
456
+ pageUrl?: string;
457
+ /** The structured evidence behind the verdict, as the report carries it. */
458
+ details?: CheckResult['details'];
459
+ }
460
+ /** Which of the three outcomes a finished check represents. */
461
+ declare function outcomeOf(check: CheckResult): AuditTrace['outcome'];
462
+ /** Build a trace record from a finished check. */
463
+ declare function traceFromCheck(check: CheckResult, durationMs: number): AuditTrace;
464
+ /** One trace as a log line: the shape a human scans, not the full record. */
465
+ declare function formatTrace(trace: AuditTrace): string;
399
466
 
400
467
  interface AuditRunResult {
401
468
  checks: CheckResult[];
@@ -414,6 +481,14 @@ type AuditProgressEvent = {
414
481
  label: string;
415
482
  error: string;
416
483
  };
484
+ /**
485
+ * Called once per registered audit, with what it did.
486
+ *
487
+ * Separate from {@link AuditProgressEvent}, which exists to drive a progress
488
+ * bar and carries only a label. This carries the verdict and its evidence, and
489
+ * fires for skipped and errored audits too — those are the ones worth seeing.
490
+ */
491
+ type AuditTraceHandler = (trace: AuditTrace) => void;
417
492
  interface AuditPlan {
418
493
  runnable: Array<{
419
494
  reg: AuditRegistration;
@@ -432,12 +507,370 @@ declare function planAudits(ctx: CheckContext, config: ScanConfig): AuditPlan;
432
507
  * Returns check results grouped into categories with weighted scores.
433
508
  * Pass a precomputed `plan` (from {@link planAudits}) to avoid recomputing it.
434
509
  */
435
- declare function runAudits(ctx: CheckContext, config: ScanConfig, onEvent?: (event: AuditProgressEvent) => void, plan?: AuditPlan): Promise<AuditRunResult>;
510
+ declare function runAudits(ctx: CheckContext, config: ScanConfig, onEvent?: (event: AuditProgressEvent) => void, plan?: AuditPlan, onTrace?: AuditTraceHandler): Promise<AuditRunResult>;
511
+
512
+ type PhaseId = 'fetch-root' | 'fetch-pages' | 'analyze' | 'audits' | 'report';
513
+ type ScanEvent = {
514
+ type: 'scan:start';
515
+ url: string;
516
+ fraction: number;
517
+ elapsedMs: number;
518
+ } | {
519
+ type: 'phase:start';
520
+ phase: PhaseId;
521
+ totalUnits: number;
522
+ fraction: number;
523
+ elapsedMs: number;
524
+ } | {
525
+ type: 'unit:done';
526
+ phase: PhaseId;
527
+ completed: number;
528
+ total: number;
529
+ label?: string;
530
+ fraction: number;
531
+ elapsedMs: number;
532
+ } | {
533
+ type: 'unit:fail';
534
+ phase: PhaseId;
535
+ label: string;
536
+ error: string;
537
+ fraction: number;
538
+ elapsedMs: number;
539
+ } | {
540
+ type: 'phase:done';
541
+ phase: PhaseId;
542
+ durationMs: number;
543
+ fraction: number;
544
+ elapsedMs: number;
545
+ } | {
546
+ type: 'scan:done';
547
+ durationMs: number;
548
+ score: number;
549
+ fraction: number;
550
+ elapsedMs: number;
551
+ };
552
+ /**
553
+ * How much of the overall scan fraction each phase owns. Sums to 1 so the
554
+ * fraction of a finished scan is exactly 1.
555
+ */
556
+ declare const PHASE_WEIGHTS: Record<PhaseId, number>;
557
+ /**
558
+ * Turns scan milestones into {@link ScanEvent}s. Owns the fraction math
559
+ * (`Σ weights of done phases + current phase weight × completed/total`),
560
+ * clamps it to be monotonic non-decreasing, and stamps `fraction`/`elapsedMs`
561
+ * onto every event. Emission is synchronous — throttling is a consumer concern.
562
+ */
563
+ declare class ProgressTracker {
564
+ private readonly onEvent;
565
+ private readonly startMs;
566
+ private doneWeight;
567
+ private phase;
568
+ private phaseStartMs;
569
+ private totalUnits;
570
+ private completedUnits;
571
+ private lastFraction;
572
+ constructor(onEvent: (event: ScanEvent) => void);
573
+ /** Fraction of the whole scan that is complete, in [0, 1]. Never decreases. */
574
+ get fraction(): number;
575
+ /** Stamp an event with the current fraction/elapsed and advance the floor. */
576
+ private stamp;
577
+ private elapsedMs;
578
+ scanStart(url: string): void;
579
+ phaseStart(phase: PhaseId, totalUnits: number): void;
580
+ /** Correct the current phase's unit total (e.g. discovery finds pages mid-phase). */
581
+ setPhaseTotal(totalUnits: number): void;
582
+ unitDone(label?: string): void;
583
+ /** A failed unit still counts as settled work so the phase can complete. */
584
+ unitFail(label: string, error: string): void;
585
+ phaseDone(): void;
586
+ scanDone(score: number): void;
587
+ }
588
+
589
+ interface ScanOptions {
590
+ onEvent?: (event: ScanEvent) => void;
591
+ pages?: PageOverride[] | null;
592
+ signal?: AbortSignal;
593
+ /**
594
+ * Restrict the scan to these category ids. Unknown ids simply match nothing —
595
+ * validate them at the entry point so the operator hears about a typo.
596
+ */
597
+ categories?: string[];
598
+ /**
599
+ * Include audits whose tier is `experimental`. Off by default, per
600
+ * docs/evidence/policy.md: an experimental check is behind a flag and never
601
+ * scored.
602
+ */
603
+ includeExperimental?: boolean;
604
+ /**
605
+ * Called once per registered audit with what it did — including the ones
606
+ * that were skipped or failed. Use it to trace a verdict back to the
607
+ * evidence it was drawn from; see {@link AuditTrace}.
608
+ */
609
+ onAuditTrace?: AuditTraceHandler;
610
+ }
611
+ declare function runScan(url: string, options?: ScanOptions): Promise<ScanReport>;
612
+
613
+ type FetchClass = 'ok' | 'soft-404' | 'blocked' | 'missing' | 'error';
614
+ type ExpectedKind = 'text' | 'json' | 'xml' | 'html';
615
+ declare function stripBom(text: string): string;
616
+ declare function normalizeNewlines(text: string): string;
617
+ /**
618
+ * Classify a fetched root file honestly. `status === 200` alone is not
619
+ * "the file exists": SPAs and some CDNs return the HTML app shell (200)
620
+ * for any unknown path — a soft 404 that inflated v1 scores.
621
+ *
622
+ * The body is the primary evidence and outranks the Content-Type header. Plenty
623
+ * of real servers ship `/llms.txt` or `/sitemap.xml` as `text/html`; trusting
624
+ * the header there would condemn a genuine file as a soft 404.
625
+ */
626
+ declare function classifyFetch(result: FetchResult | undefined, expected: ExpectedKind): FetchClass;
627
+ declare function isRealFile(result: FetchResult | undefined, expected: ExpectedKind): boolean;
628
+
629
+ interface RobotsRule {
630
+ type: 'allow' | 'disallow';
631
+ path: string;
632
+ }
633
+ interface RobotsGroup {
634
+ userAgent: string;
635
+ rules: RobotsRule[];
636
+ crawlDelay?: number;
637
+ /**
638
+ * Directives inside the group that are neither rules nor crawl-delay, in file
639
+ * order — Content-Signal, Request-rate, vendor extensions. Retained rather
640
+ * than dropped: a directive we do not model today is still evidence about
641
+ * what the operator declared. Absent when the group carries none.
642
+ */
643
+ otherDirectives?: Array<{
644
+ name: string;
645
+ value: string;
646
+ }>;
647
+ }
648
+ /** A parsed robots.txt: its groups plus the file-level directives outside them. */
649
+ interface RobotsFile {
650
+ groups: RobotsGroup[];
651
+ /**
652
+ * Every `Sitemap:` value, in file order. RFC 9309 §2.2.3 makes this directive
653
+ * host-global and user-agent independent: it is not part of any group, which
654
+ * is exactly why a site can advertise a sitemap its own rules forbid.
655
+ */
656
+ sitemaps: string[];
657
+ }
658
+ /**
659
+ * Parse robots.txt into groups plus file-level directives.
660
+ *
661
+ * `parseRobots` returns this function's `groups` and nothing else, so the
662
+ * group-only view every existing audit uses and the whole-file view added for
663
+ * the Plan 5 discovery audits can never disagree about grouping.
664
+ */
665
+ declare function parseRobotsFile(body: string): RobotsFile;
666
+ declare function parseRobots(body: string): RobotsGroup[];
667
+ /** Group UA "GPTBot/1.1" matches bot token "gptbot": compare the product token. */
668
+ declare function matchesUserAgent(groupUserAgent: string, botToken: string): boolean;
669
+ /**
670
+ * Does this bot have a group of its own?
671
+ *
672
+ * Under RFC 9309 §2.2.1 a crawler obeys the most specific matching group and
673
+ * ignores `*` entirely once a named group exists. So "the wildcard allows it"
674
+ * is not an answer for a bot with its own group, and this predicate is what
675
+ * lets an audit report which set of rules actually applied.
676
+ */
677
+ declare function hasNamedGroup(groups: RobotsGroup[], botToken: string): boolean;
678
+ declare function groupsForBot(groups: RobotsGroup[], botToken: string): RobotsGroup[];
679
+ declare function isPathAllowed(groups: RobotsGroup[], botToken: string, path: string): boolean;
680
+ declare function isBlanketBlocked(groups: RobotsGroup[], botToken: string): boolean;
681
+
682
+ /**
683
+ * The AI crawlers whose published User-Agent strings can actually be sent.
684
+ *
685
+ * `Google-Extended` is deliberately absent: it is a robots.txt product token
686
+ * only, with no user agent of its own, so a UA probe for it would compare the
687
+ * site against a string that never appears in real traffic.
688
+ */
689
+ declare const AI_CRAWLER_UAS: ReadonlyArray<{
690
+ token: string;
691
+ ua: string;
692
+ label: string;
693
+ }>;
694
+ /** A mainstream browser UA. The control half of every pair. */
695
+ declare const BASELINE_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36";
696
+ /**
697
+ * How a site answered a crawler UA, relative to the same request as a browser.
698
+ *
699
+ * The classes are deliberately distinct rather than one "blocked" verdict:
700
+ * a Cloudflare interstitial, a pay-per-crawl price, a proof-of-work wall and a
701
+ * rate limit each need a different remedy from the operator, and an opaque 403
702
+ * may even be correct impersonation defence.
703
+ */
704
+ type BlockClass = 'ok' | 'cf-challenge' | 'pay-per-crawl' | 'anubis-pow' | 'rate-limited' | 'opaque-403' | 'soft-block' | 'transport-error';
705
+ interface UaProbe {
706
+ url: string;
707
+ token: string;
708
+ baselineStatus: number;
709
+ probeStatus: number;
710
+ blockClass: BlockClass;
711
+ /** Probe main-content length over baseline main-content length. */
712
+ textRatio: number;
713
+ /** The shortest decisive fact — a header line, a status, a body marker. */
714
+ evidence: string;
715
+ /** Main-content text of each side, kept so a caller can diff them word by word. */
716
+ baselineText: string;
717
+ probeText: string;
718
+ /** The raw baseline body, so a caller can resolve declared markup against the DOM a browser got. */
719
+ baselineBody: string;
720
+ /** The raw probe body, so a caller can look for challenge fingerprints the classifier does not model. */
721
+ probeBody: string;
722
+ /** Baseline response headers, so a caller can read a price or a payment challenge. */
723
+ baselineHeaders: Record<string, string>;
724
+ /** Probe response headers, for the same reason. */
725
+ probeHeaders: Record<string, string>;
726
+ }
727
+ /**
728
+ * Compare one crawler-UA response against the browser baseline for the same URL.
729
+ *
730
+ * A non-2xx baseline yields `ok` for every probe: the scanner could not read the
731
+ * page either, so nothing observed is bot-specific and reporting it would be a
732
+ * finding about our own fetch.
733
+ */
734
+ declare function classifyResponse(baseline: FetchResult, probe: FetchResult): {
735
+ blockClass: BlockClass;
736
+ textRatio: number;
737
+ evidence: string;
738
+ baselineText: string;
739
+ probeText: string;
740
+ baselineBody: string;
741
+ probeBody: string;
742
+ baselineHeaders: Record<string, string>;
743
+ probeHeaders: Record<string, string>;
744
+ };
745
+ /**
746
+ * Fetch each URL once as a browser, then once per crawler token, and classify
747
+ * the difference.
748
+ *
749
+ * The baseline is fetched once per URL and reused across tokens, so a six-token
750
+ * sweep costs seven requests per URL rather than twelve. URLs are `isSafeUrl`-
751
+ * gated because callers pass in addresses read out of site-controlled content.
752
+ */
753
+ declare function probeUaParity(fetch: (options: FetchOptions) => Promise<FetchResult>, urls: string[], tokens: string[], opts?: {
754
+ signal?: AbortSignal;
755
+ }): Promise<UaProbe[]>;
756
+
757
+ /** One `<url>` row of a sitemap. */
758
+ interface SitemapEntry {
759
+ loc: string;
760
+ lastmod?: string;
761
+ }
762
+ /** The result of walking a site's advertised sitemap roots. */
763
+ interface SitemapTree {
764
+ entries: SitemapEntry[];
765
+ /** Child sitemaps actually fetched, in order. Empty for a flat sitemap. */
766
+ childSitemaps: string[];
767
+ /** How many `<lastmod>` values failed the W3C Datetime shape. */
768
+ malformedLastmod: number;
769
+ /** True when a cap stopped the walk, so `entries` is not the whole tree. */
770
+ truncated: boolean;
771
+ }
772
+ /**
773
+ * Does this value parse as a W3C Datetime, the format the sitemap protocol
774
+ * requires of `<lastmod>`?
775
+ *
776
+ * Accepts the date-only `YYYY-MM-DD` form and the full RFC 3339 timestamp.
777
+ * Deliberately strict about the shape before handing anything to `Date`, which
778
+ * would happily accept `1755859200` (epoch seconds, a common CMS bug) and
779
+ * every prose string a locale parser recognises.
780
+ */
781
+ declare function isW3CDateTime(value: string): boolean;
782
+ /**
783
+ * Walk a site's sitemap roots and collect their `<url>` rows.
784
+ *
785
+ * Recursion stops after one level of `<sitemapindex>`: the depth of a nested
786
+ * index is chosen by the site being scanned, so following it arbitrarily is an
787
+ * unbounded walk driven by untrusted input. Every child URL is `isSafeUrl`- and
788
+ * same-host-gated before it is fetched, for the same reason.
789
+ */
790
+ declare function collectSitemapEntries(fetch: (options: FetchOptions) => Promise<FetchResult>, roots: string[], opts?: {
791
+ maxChildren?: number;
792
+ maxEntries?: number;
793
+ signal?: AbortSignal;
794
+ }): Promise<SitemapTree>;
795
+ /**
796
+ * Take an even-strided sample of `n` entries.
797
+ *
798
+ * Deterministic rather than random: two audits sampling the same tree must
799
+ * probe the same URLs, or a finding from one cannot be lined up against a
800
+ * finding from the other.
801
+ */
802
+ declare function sampleEntries(entries: SitemapEntry[], n: number): SitemapEntry[];
803
+
804
+ /** One `selector { declarations }` rule, with the at-rule it sits inside. */
805
+ interface CssRule {
806
+ /** The full selector list, verbatim, so a human can adjudicate a match. */
807
+ selector: string;
808
+ /** The declaration block, lowercased and whitespace-collapsed. */
809
+ declarations: string;
810
+ /** The enclosing at-rule prelude (`media print`, `supports (...)`), if any. */
811
+ atRule?: string;
812
+ /** Where the rule came from, for evidence. */
813
+ origin: 'inline' | string;
814
+ }
815
+ /**
816
+ * Scan a stylesheet into flat selector/declaration pairs.
817
+ *
818
+ * Deliberately a scanner, not a parser: it performs no cascade, no specificity
819
+ * ordering and no media-query evaluation. It exists so an audit can ask "does
820
+ * any rule that could apply to this element declare display:none", and it
821
+ * reports the matched selector text so a human can check the answer. A full CSS
822
+ * engine would need a dependency the core package does not carry.
823
+ */
824
+ declare function parseCssRules(source: string, origin?: string): CssRule[];
825
+ interface PageCss {
826
+ rules: CssRule[];
827
+ /** Stylesheet URLs on another origin, which are never fetched. */
828
+ skippedCrossOrigin: string[];
829
+ /** Stylesheet URLs fetched and scanned. */
830
+ fetched: string[];
831
+ }
832
+ /**
833
+ * Collect every CSS rule a page's own markup and same-origin stylesheets carry.
834
+ *
835
+ * Cross-origin sheets are not fetched: a scan must not pull bytes from a third
836
+ * party on the scanned site's behalf. They are reported instead, so a result
837
+ * built on partial CSS says so rather than reading as complete.
838
+ */
839
+ declare function collectPageCss(ctx: CheckContext, page: PageContext): Promise<PageCss>;
840
+
841
+ declare function pagesOfType(ctx: CheckContext, ...types: PageType[]): PageContext[];
842
+ interface PageJudgement {
843
+ page: PageContext;
844
+ ok: boolean;
845
+ detail?: string;
846
+ }
847
+ /**
848
+ * Run one judgement over a set of pages. v1 audits frequently judged only
849
+ * pages[0] and generalized to the whole site; this makes per-page judgement
850
+ * the path of least resistance. Callers MUST return notApplicable when
851
+ * `judged.length === 0` — an empty set proves nothing.
852
+ */
853
+ declare function judgePages(pages: PageContext[], judge: (page: PageContext) => {
854
+ ok: boolean;
855
+ detail?: string;
856
+ }): {
857
+ judged: PageJudgement[];
858
+ passRate: number;
859
+ failures: PageJudgement[];
860
+ };
436
861
 
437
862
  declare function parseHtml(html: string): CheerioAPI;
438
863
  declare function extractJsonLd($: CheerioAPI): object[];
439
864
  /**
440
- * Flatten parsed JSON-LD into a flat list of schema.org nodes.
865
+ * Top-level JSON-LD entities only: expands arrays and `@graph` members,
866
+ * propagating `@context` downward. Nested property objects (an Article's
867
+ * `publisher`, a Product's `offers`) are NOT hoisted — v1's deep flatten
868
+ * made audits "find" entities the page never declared at top level.
869
+ */
870
+ declare function topLevelJsonLd(blocks: object[]): object[];
871
+ /**
872
+ * Every JSON-LD node including nested ones — for audits that legitimately
873
+ * search deep (e.g. AggregateRating nested under Product).
441
874
  *
442
875
  * Real-world JSON-LD nests the interesting types arbitrarily: a top-level
443
876
  * `[{...}]` array (common on Shopify), an `@graph` container, and properties
@@ -447,7 +880,9 @@ declare function extractJsonLd($: CheerioAPI): object[];
447
880
  * invisible — producing false "schema not found" verdicts. This walks every
448
881
  * object and array value so type/property lookups see the whole graph.
449
882
  */
450
- declare function flattenJsonLd(blocks: object[]): object[];
883
+ declare function allJsonLdNodes(blocks: object[]): object[];
884
+ /** @deprecated v1 name for the deep walk. Use topLevelJsonLd (structure) or allJsonLdNodes (deep search). Removed in v2. */
885
+ declare const flattenJsonLd: typeof allJsonLdNodes;
451
886
  /**
452
887
  * Extract links from Markdown-ish text (llms.txt, READMEs).
453
888
  *
@@ -486,6 +921,9 @@ declare function extractImages($: CheerioAPI): Array<{
486
921
  loading?: string;
487
922
  role?: string;
488
923
  ariaHidden?: string;
924
+ ariaLabel?: string;
925
+ ariaLabelledby?: string;
926
+ title?: string;
489
927
  }>;
490
928
  declare function extractForms($: CheerioAPI): Array<{
491
929
  action: string;
@@ -525,7 +963,7 @@ declare const MAX_CONCURRENT_REQUESTS = 10;
525
963
  declare const SCANNER_USER_AGENT = "AgentLighthouse/1.0 (+https://github.com/ForkPoint/agent-lighthouse)";
526
964
  declare const TAG_SKIPPED_PAGE_TYPE = "skipped:page-type";
527
965
  declare const TAG_SCAN_ERROR = "scan-error";
528
- declare const CATEGORY_WEIGHTS: Record<string, number>;
966
+ /** Display names for the 8 v2 categories. */
529
967
  declare const CATEGORY_NAMES: Record<string, string>;
530
968
  declare const READINESS_WEIGHTS: {
531
969
  readonly commerce: 0.4;
@@ -538,6 +976,12 @@ declare const SCORE_TIER_LABELS: Record<ScoreTier, string>;
538
976
  declare function getTierLabel(tier: string | null): string;
539
977
  declare function getTierColor(tier: string | null): string;
540
978
 
979
+ /**
980
+ * Spec §4 weight law: an audit's scoring weight is a pure function of its
981
+ * evidence grade and tier. Only the `scored` tier carries weight, and only
982
+ * grades A and B are proven enough to move a score.
983
+ */
984
+ declare function weightForGrade(grade: EvidenceGrade, tier: AuditTier): number;
541
985
  /**
542
986
  * Single source of truth for "this check is advisory only".
543
987
  *
@@ -548,7 +992,15 @@ declare function getTierColor(tier: string | null): string;
548
992
  */
549
993
  declare function isInformative(check: Pick<CheckResult, 'scoreDisplayMode'>): boolean;
550
994
  declare function calculateCategoryScore(checks: CheckResult[]): number;
551
- declare function buildCategoryResult(id: string, checks: CheckResult[]): CategoryResult;
995
+ /**
996
+ * Assemble a category result.
997
+ *
998
+ * `mass` is the category's evidence mass — the summed weight of its registered
999
+ * audits (`CATEGORY_MASS` in audit-config). It is passed in rather than looked
1000
+ * up so this module stays free of a dependency on the registry, which the
1001
+ * audits themselves import (for `weightForGrade`).
1002
+ */
1003
+ declare function buildCategoryResult(id: string, checks: CheckResult[], mass?: number): CategoryResult;
552
1004
  declare function calculateOverallScore(categories: CategoryResult[]): number;
553
1005
 
554
1006
  /**
@@ -572,17 +1024,19 @@ declare const AuditResultSchema: z.ZodObject<{
572
1024
  expected: z.ZodOptional<z.ZodString>;
573
1025
  found: z.ZodOptional<z.ZodString>;
574
1026
  code: z.ZodOptional<z.ZodString>;
575
- }, "strip", z.ZodTypeAny, {
576
- code?: string | undefined;
577
- found?: string | undefined;
578
- expected?: string | undefined;
579
- }, {
580
- code?: string | undefined;
581
- found?: string | undefined;
582
- expected?: string | undefined;
583
- }>>;
1027
+ }, "strip", z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, z.objectOutputType<{
1028
+ expected: z.ZodOptional<z.ZodString>;
1029
+ found: z.ZodOptional<z.ZodString>;
1030
+ code: z.ZodOptional<z.ZodString>;
1031
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip">, z.objectInputType<{
1032
+ expected: z.ZodOptional<z.ZodString>;
1033
+ found: z.ZodOptional<z.ZodString>;
1034
+ code: z.ZodOptional<z.ZodString>;
1035
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip">>>;
584
1036
  pageUrl: z.ZodUnion<[z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>, z.ZodString]>;
585
1037
  priority: z.ZodOptional<z.ZodEnum<["critical", "high", "medium", "low"]>>;
1038
+ /** A fix written from what this scan found, which beats the generic one in meta.guidance. */
1039
+ remediation: z.ZodOptional<z.ZodString>;
586
1040
  code: z.ZodOptional<z.ZodString>;
587
1041
  }, "strip", z.ZodTypeAny, {
588
1042
  status: "warn" | "pass" | "fail" | "na";
@@ -590,32 +1044,34 @@ declare const AuditResultSchema: z.ZodObject<{
590
1044
  code?: string | undefined;
591
1045
  found?: string | undefined;
592
1046
  expected?: string | undefined;
593
- details?: {
594
- code?: string | undefined;
595
- found?: string | undefined;
596
- expected?: string | undefined;
597
- } | undefined;
1047
+ details?: z.objectOutputType<{
1048
+ expected: z.ZodOptional<z.ZodString>;
1049
+ found: z.ZodOptional<z.ZodString>;
1050
+ code: z.ZodOptional<z.ZodString>;
1051
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip"> | undefined;
598
1052
  message?: string | undefined;
599
1053
  displayValue?: string | undefined;
600
1054
  explanation?: string | undefined;
601
1055
  pageUrl?: string | undefined;
602
1056
  priority?: "critical" | "high" | "medium" | "low" | undefined;
1057
+ remediation?: string | undefined;
603
1058
  }, {
604
1059
  status: "warn" | "pass" | "fail" | "na";
605
1060
  score: number;
606
1061
  code?: string | undefined;
607
1062
  found?: string | undefined;
608
1063
  expected?: string | undefined;
609
- details?: {
610
- code?: string | undefined;
611
- found?: string | undefined;
612
- expected?: string | undefined;
613
- } | undefined;
1064
+ details?: z.objectInputType<{
1065
+ expected: z.ZodOptional<z.ZodString>;
1066
+ found: z.ZodOptional<z.ZodString>;
1067
+ code: z.ZodOptional<z.ZodString>;
1068
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip"> | undefined;
614
1069
  message?: string | undefined;
615
1070
  displayValue?: string | undefined;
616
1071
  explanation?: string | undefined;
617
1072
  pageUrl?: string | undefined;
618
1073
  priority?: "critical" | "high" | "medium" | "low" | undefined;
1074
+ remediation?: string | undefined;
619
1075
  }>;
620
1076
  declare const FixEffortSchema: z.ZodEnum<["trivial", "easy", "moderate", "complex"]>;
621
1077
  declare const AuditGuidanceSchema: z.ZodObject<{
@@ -651,6 +1107,12 @@ declare const DeprecationNoticeSchema: z.ZodObject<{
651
1107
  link: string;
652
1108
  notice: string;
653
1109
  }>;
1110
+ /** Evidence strength from the audit's dossier (docs/evidence/policy.md). */
1111
+ declare const EvidenceGradeSchema: z.ZodEnum<["A", "B", "C", "D"]>;
1112
+ /** Scoring participation tier (spec §4). */
1113
+ declare const AuditTierSchema: z.ZodEnum<["scored", "informative", "experimental"]>;
1114
+ /** v2 audit identity: `category/slug`, stable across releases (spec §6). */
1115
+ declare const AUDIT_ID_PATTERN: RegExp;
654
1116
  declare const AuditMetaSchema: z.ZodObject<{
655
1117
  id: z.ZodString;
656
1118
  category: z.ZodString;
@@ -693,6 +1155,9 @@ declare const AuditMetaSchema: z.ZodObject<{
693
1155
  link: string;
694
1156
  notice: string;
695
1157
  }>>;
1158
+ evidenceGrade: z.ZodEnum<["A", "B", "C", "D"]>;
1159
+ tier: z.ZodEnum<["scored", "informative", "experimental"]>;
1160
+ dossier: z.ZodString;
696
1161
  }, "strip", z.ZodTypeAny, {
697
1162
  category: string;
698
1163
  title: string;
@@ -702,6 +1167,9 @@ declare const AuditMetaSchema: z.ZodObject<{
702
1167
  scoreDisplayMode: "binary" | "ternary" | "informative";
703
1168
  weight: number;
704
1169
  defaultPriority: "critical" | "high" | "medium" | "low";
1170
+ evidenceGrade: "A" | "B" | "C" | "D";
1171
+ tier: "informative" | "scored" | "experimental";
1172
+ dossier: string;
705
1173
  applicablePageTypes?: string[] | undefined;
706
1174
  guidance?: {
707
1175
  impact: string;
@@ -724,6 +1192,9 @@ declare const AuditMetaSchema: z.ZodObject<{
724
1192
  scoreDisplayMode: "binary" | "ternary" | "informative";
725
1193
  weight: number;
726
1194
  defaultPriority: "critical" | "high" | "medium" | "low";
1195
+ evidenceGrade: "A" | "B" | "C" | "D";
1196
+ tier: "informative" | "scored" | "experimental";
1197
+ dossier: string;
727
1198
  applicablePageTypes?: string[] | undefined;
728
1199
  guidance?: {
729
1200
  impact: string;
@@ -757,17 +1228,20 @@ declare const CheckResultSchema: z.ZodObject<{
757
1228
  found: z.ZodOptional<z.ZodString>;
758
1229
  code: z.ZodOptional<z.ZodString>;
759
1230
  docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
760
- }, "strip", z.ZodTypeAny, {
761
- code?: string | undefined;
762
- found?: string | undefined;
763
- expected?: string | undefined;
764
- docsUrl?: string | undefined;
765
- }, {
766
- code?: string | undefined;
767
- found?: string | undefined;
768
- expected?: string | undefined;
769
- docsUrl?: string | undefined;
770
- }>>;
1231
+ evidenceUrl: z.ZodOptional<z.ZodString>;
1232
+ }, "strip", z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, z.objectOutputType<{
1233
+ expected: z.ZodOptional<z.ZodString>;
1234
+ found: z.ZodOptional<z.ZodString>;
1235
+ code: z.ZodOptional<z.ZodString>;
1236
+ docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
1237
+ evidenceUrl: z.ZodOptional<z.ZodString>;
1238
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip">, z.objectInputType<{
1239
+ expected: z.ZodOptional<z.ZodString>;
1240
+ found: z.ZodOptional<z.ZodString>;
1241
+ code: z.ZodOptional<z.ZodString>;
1242
+ docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
1243
+ evidenceUrl: z.ZodOptional<z.ZodString>;
1244
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip">>>;
771
1245
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
772
1246
  deprecated: z.ZodOptional<z.ZodObject<{
773
1247
  notice: z.ZodString;
@@ -779,6 +1253,8 @@ declare const CheckResultSchema: z.ZodObject<{
779
1253
  link: string;
780
1254
  notice: string;
781
1255
  }>>;
1256
+ evidenceGrade: z.ZodOptional<z.ZodEnum<["A", "B", "C", "D"]>>;
1257
+ tier: z.ZodOptional<z.ZodEnum<["scored", "informative", "experimental"]>>;
782
1258
  }, "strip", z.ZodTypeAny, {
783
1259
  status: "warn" | "pass" | "fail" | "na";
784
1260
  category: string;
@@ -790,12 +1266,13 @@ declare const CheckResultSchema: z.ZodObject<{
790
1266
  fix: string;
791
1267
  description: string;
792
1268
  scoreDisplayMode: "binary" | "ternary" | "informative";
793
- details?: {
794
- code?: string | undefined;
795
- found?: string | undefined;
796
- expected?: string | undefined;
797
- docsUrl?: string | undefined;
798
- } | undefined;
1269
+ details?: z.objectOutputType<{
1270
+ expected: z.ZodOptional<z.ZodString>;
1271
+ found: z.ZodOptional<z.ZodString>;
1272
+ code: z.ZodOptional<z.ZodString>;
1273
+ docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
1274
+ evidenceUrl: z.ZodOptional<z.ZodString>;
1275
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip"> | undefined;
799
1276
  displayValue?: string | undefined;
800
1277
  explanation?: string | undefined;
801
1278
  pageUrl?: string | undefined;
@@ -804,6 +1281,8 @@ declare const CheckResultSchema: z.ZodObject<{
804
1281
  link: string;
805
1282
  notice: string;
806
1283
  } | undefined;
1284
+ evidenceGrade?: "A" | "B" | "C" | "D" | undefined;
1285
+ tier?: "informative" | "scored" | "experimental" | undefined;
807
1286
  }, {
808
1287
  status: "warn" | "pass" | "fail" | "na";
809
1288
  category: string;
@@ -815,12 +1294,13 @@ declare const CheckResultSchema: z.ZodObject<{
815
1294
  fix: string;
816
1295
  description: string;
817
1296
  scoreDisplayMode: "binary" | "ternary" | "informative";
818
- details?: {
819
- code?: string | undefined;
820
- found?: string | undefined;
821
- expected?: string | undefined;
822
- docsUrl?: string | undefined;
823
- } | undefined;
1297
+ details?: z.objectInputType<{
1298
+ expected: z.ZodOptional<z.ZodString>;
1299
+ found: z.ZodOptional<z.ZodString>;
1300
+ code: z.ZodOptional<z.ZodString>;
1301
+ docsUrl: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodString]>;
1302
+ evidenceUrl: z.ZodOptional<z.ZodString>;
1303
+ }, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">]>, "strip"> | undefined;
824
1304
  displayValue?: string | undefined;
825
1305
  explanation?: string | undefined;
826
1306
  pageUrl?: string | undefined;
@@ -829,6 +1309,8 @@ declare const CheckResultSchema: z.ZodObject<{
829
1309
  link: string;
830
1310
  notice: string;
831
1311
  } | undefined;
1312
+ evidenceGrade?: "A" | "B" | "C" | "D" | undefined;
1313
+ tier?: "informative" | "scored" | "experimental" | undefined;
832
1314
  }>;
833
1315
 
834
1316
  declare function normalizeUrl(input: string): string;
@@ -883,4 +1365,15 @@ declare class Logger {
883
1365
  }
884
1366
  declare const logger: Logger;
885
1367
 
886
- export { type AgentLighthouseConfig, Audit, type AuditGuidance, AuditGuidanceSchema, type AuditMeta, AuditMetaSchema, type AuditPlan, type AuditProgressEvent, type AuditRegistration, type AuditResult, AuditResultSchema, type AuditRunResult, CATEGORY_NAMES, CATEGORY_WEIGHTS, type CategoryConfig, type CategoryResult, type CheckContext, type CheckFn, type CheckPriority, CheckPrioritySchema, type CheckRecommendation, type CheckResult, CheckResultSchema, type CheckStatus, CheckStatusSchema, DEFAULT_SCAN_LIMIT, type DeprecationNotice, DeprecationNoticeSchema, type FetchOptions, type FetchResult, type FieldStatus, type FixEffort, FixEffortSchema, MAX_CONCURRENT_REQUESTS, MAX_PAGES_PER_SCAN, MAX_RESPONSE_BODY_BYTES, PAGE_TYPE_LABELS, PHASE_WEIGHTS, PRESETS, type PageContext, type PageOverride, type PageType, type PhaseId, type PresetName, type PresetOptions, type ProductFieldVerification, ProgressTracker, READINESS_WEIGHTS, REQUEST_TIMEOUT_MS, type ReadinessVitals, SCANNER_USER_AGENT, SCAN_TIMEOUT_MS, SCORE_TIER_LABELS, type ScanConfig, type ScanEvent, type ScanOptions, type ScanReport, type ScoreDisplayMode, ScoreDisplayModeSchema, type ScoreTier, TAG_SCAN_ERROR, TAG_SKIPPED_PAGE_TYPE, type WafProtection, buildCategoryResult, calculateCategoryScore, calculateOverallScore, createFetcher, defaultConfig, defineConfig, detectPageType, detectWafProtection, extractDomain, extractForms, extractHeadLinks, extractHeadings, extractImages, extractInternalLinks, extractJsonLd, extractMarkdownLinks, extractMetaTags, extractNavLinks, extractProductFieldVerification, extractScripts, extractStylesheetUrls, flattenJsonLd, getMainContentText, getPreset, getScoreTier, getTierColor, getTierLabel, getWordCount, isInformative, isPrivateIp, isSafeUrl, joinUrl, loadConfigFile, logger, normalizeUrl, parseHtml, planAudits, runAudits, runScan };
1368
+ /** The ACP CheckoutSession `links` enum, in spec order. */
1369
+ declare const ACP_LINK_TYPES: readonly ["terms_of_use", "privacy_policy", "return_policy", "shipping_policy", "contact_us", "about_us", "faq", "support"];
1370
+ type AcpLinkType = (typeof ACP_LINK_TYPES)[number];
1371
+ /**
1372
+ * The first same-page candidate URL for each ACP link type, in document order.
1373
+ *
1374
+ * Classification is by URL path first, anchor text second, so a link whose path
1375
+ * is opaque (`/p/12345`) is still classified when its label is not.
1376
+ */
1377
+ declare function resolvePolicyLinks(ctx: CheckContext): Map<AcpLinkType, string>;
1378
+
1379
+ export { ACP_LINK_TYPES, AI_CRAWLER_UAS, AUDIT_ID_PATTERN, type AcpLinkType, type AgentLighthouseConfig, Audit, type AuditGuidance, AuditGuidanceSchema, type AuditMeta, AuditMetaSchema, type AuditPlan, type AuditProgressEvent, type AuditRegistration, type AuditResult, AuditResultSchema, type AuditRunResult, type AuditTier, AuditTierSchema, type AuditTrace, type AuditTraceHandler, BASELINE_UA, type BlockClass, CATEGORY_IDS, CATEGORY_MASS, CATEGORY_NAMES, type CategoryConfig, type CategoryResult, type CheckContext, type CheckFn, type CheckPriority, CheckPrioritySchema, type CheckRecommendation, type CheckResult, CheckResultSchema, type CheckStatus, CheckStatusSchema, type CssRule, DEFAULT_SCAN_LIMIT, type DeprecationNotice, DeprecationNoticeSchema, type EvidenceGrade, EvidenceGradeSchema, type ExpectedKind, type FetchClass, type FetchOptions, type FetchResult, type FieldStatus, type FixEffort, FixEffortSchema, MAX_CONCURRENT_REQUESTS, MAX_PAGES_PER_SCAN, MAX_RESPONSE_BODY_BYTES, PAGE_TYPE_LABELS, PHASE_WEIGHTS, PRESETS, type PageContext, type PageCss, type PageJudgement, type PageOverride, type PageType, type PhaseId, type PresetName, type PresetOptions, type ProductFieldVerification, ProgressTracker, READINESS_WEIGHTS, REQUEST_TIMEOUT_MS, type ReadinessVitals, type RobotsFile, type RobotsGroup, type RobotsRule, SCANNER_USER_AGENT, SCAN_TIMEOUT_MS, SCORE_TIER_LABELS, type ScanConfig, type ScanEvent, type ScanOptions, type ScanReport, type ScoreDisplayMode, ScoreDisplayModeSchema, type ScoreTier, type SitemapEntry, type SitemapTree, TAG_SCAN_ERROR, TAG_SKIPPED_PAGE_TYPE, type UaProbe, type WafProtection, allJsonLdNodes, buildCategoryResult, calculateCategoryScore, calculateOverallScore, classifyFetch, classifyResponse, collectPageCss, collectSitemapEntries, createFetcher, defaultConfig, defineConfig, detectPageType, detectWafProtection, evidenceUrl, extractDomain, extractForms, extractHeadLinks, extractHeadings, extractImages, extractInternalLinks, extractJsonLd, extractMarkdownLinks, extractMetaTags, extractNavLinks, extractProductFieldVerification, extractScripts, extractStylesheetUrls, filterConfig, flattenJsonLd, formatTrace, getMainContentText, getPreset, getScoreTier, getTierColor, getTierLabel, getWordCount, groupsForBot, hasNamedGroup, isBlanketBlocked, isInformative, isPathAllowed, isPrivateIp, isRealFile, isSafeUrl, isW3CDateTime, joinUrl, judgePages, loadConfigFile, logger, matchesUserAgent, normalizeNewlines, normalizeUrl, outcomeOf, pagesOfType, parseCssRules, parseHtml, parseRobots, parseRobotsFile, planAudits, probeUaParity, resolvePolicyLinks, runAudits, runScan, sampleEntries, stripBom, topLevelJsonLd, traceFromCheck, weightForGrade };