@rebilder/agent-readability 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.
- package/CHANGELOG.md +11 -0
- package/README.md +5 -4
- package/dist/index.cjs +415 -191
- package/dist/index.d.cts +44 -14
- package/dist/index.d.ts +44 -14
- package/dist/index.js +413 -192
- package/dist/index.js.map +1 -1
- package/dist/probe/index.cjs +743 -7
- package/dist/probe/index.d.cts +15 -11
- package/dist/probe/index.d.ts +15 -11
- package/dist/probe/index.js +743 -7
- package/dist/probe/index.js.map +1 -1
- package/dist/probe/local.cjs +743 -7
- package/dist/probe/local.d.cts +2 -2
- package/dist/probe/local.d.ts +2 -2
- package/dist/probe/local.js +743 -7
- package/dist/probe/local.js.map +1 -1
- package/dist/{robots-policy-DE8jix-e.d.cts → robots-policy-BeffrTf0.d.cts} +15 -6
- package/dist/{robots-policy-DE8jix-e.d.ts → robots-policy-BeffrTf0.d.ts} +15 -6
- package/package.json +7 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/types.ts
|
|
2
|
-
var ARS_SPEC_VERSION = "0.
|
|
2
|
+
var ARS_SPEC_VERSION = "0.3.0";
|
|
3
3
|
|
|
4
4
|
// src/profiles.ts
|
|
5
5
|
var PROFILE_BY_KIND = {
|
|
@@ -347,33 +347,61 @@ var ACTION_LEXICON = [
|
|
|
347
347
|
"book now",
|
|
348
348
|
"buy",
|
|
349
349
|
"buy now",
|
|
350
|
+
"call",
|
|
350
351
|
"call now",
|
|
352
|
+
"check availability",
|
|
353
|
+
"check out",
|
|
351
354
|
"checkout",
|
|
352
355
|
"contact",
|
|
353
356
|
"contact us",
|
|
357
|
+
"create account",
|
|
358
|
+
"create an account",
|
|
354
359
|
"donate",
|
|
355
360
|
"download",
|
|
356
361
|
"email us",
|
|
362
|
+
"enquire",
|
|
363
|
+
"enrol",
|
|
357
364
|
"enroll",
|
|
365
|
+
"free trial",
|
|
366
|
+
"get a demo",
|
|
358
367
|
"get a quote",
|
|
368
|
+
"get directions",
|
|
369
|
+
"get in touch",
|
|
359
370
|
"get quote",
|
|
360
371
|
"get started",
|
|
372
|
+
"get the app",
|
|
373
|
+
"get tickets",
|
|
374
|
+
"hire",
|
|
375
|
+
"inquire",
|
|
376
|
+
"install",
|
|
361
377
|
"join",
|
|
362
378
|
"make an appointment",
|
|
379
|
+
"message us",
|
|
363
380
|
"order",
|
|
364
381
|
"order now",
|
|
382
|
+
"order online",
|
|
383
|
+
"pre-order",
|
|
384
|
+
"preorder",
|
|
365
385
|
"purchase",
|
|
366
386
|
"register",
|
|
387
|
+
"rent",
|
|
367
388
|
"request",
|
|
368
389
|
"request a demo",
|
|
369
390
|
"request a quote",
|
|
370
391
|
"reserve",
|
|
371
392
|
"schedule",
|
|
393
|
+
"shop",
|
|
394
|
+
"shop now",
|
|
372
395
|
"sign up",
|
|
373
396
|
"signup",
|
|
374
397
|
"start",
|
|
375
398
|
"start free trial",
|
|
376
|
-
"subscribe"
|
|
399
|
+
"subscribe",
|
|
400
|
+
"talk to sales",
|
|
401
|
+
"talk to us",
|
|
402
|
+
"text us",
|
|
403
|
+
"try",
|
|
404
|
+
"upgrade"
|
|
377
405
|
];
|
|
378
406
|
var BANDS = [
|
|
379
407
|
{
|
|
@@ -413,7 +441,7 @@ var BANDS = [
|
|
|
413
441
|
}
|
|
414
442
|
];
|
|
415
443
|
var DEFAULT_RULESET = deepFreeze({
|
|
416
|
-
version: "0.
|
|
444
|
+
version: "0.3.0",
|
|
417
445
|
weights: WEIGHTS,
|
|
418
446
|
thresholds: THRESHOLDS,
|
|
419
447
|
audienceTokens: AUDIENCE_TOKENS,
|
|
@@ -2780,7 +2808,15 @@ var TEMPLATES = [
|
|
|
2780
2808
|
effort: "config",
|
|
2781
2809
|
detail: "Return Markdown, plain text or JSON with a matching Content-Type when the request asks for one, and keep the same URL. This is the single largest recoverable block in ARS, and it is also what makes Vary: Accept and the substance-parity check scoreable at all.",
|
|
2782
2810
|
checks: ["machine-representation.negotiated-response"],
|
|
2783
|
-
|
|
2811
|
+
// Vary is gated on negotiation itself, so it stays locked while D2.1 is
|
|
2812
|
+
// short of full, including the ARS 0.3 partial credit for a linked copy.
|
|
2813
|
+
// Parity also opens on a linked copy, so it is unlocked only from zero.
|
|
2814
|
+
unlocks: (state) => {
|
|
2815
|
+
const earned = earnedOf(state, "machine-representation.negotiated-response");
|
|
2816
|
+
const full = state.get("machine-representation.negotiated-response")?.weight ?? 0;
|
|
2817
|
+
if (earned >= full) return [];
|
|
2818
|
+
return earned === 0 ? ["machine-representation.vary-accept", "machine-representation.substance-parity"] : ["machine-representation.vary-accept"];
|
|
2819
|
+
}
|
|
2784
2820
|
},
|
|
2785
2821
|
{
|
|
2786
2822
|
id: "declare-alternates",
|
|
@@ -3039,8 +3075,14 @@ var SUBPOINTS = deepFreeze2({
|
|
|
3039
3075
|
band: [100, 7, 75, 5, 50, 3, 25, 1],
|
|
3040
3076
|
noscriptFloor: 1
|
|
3041
3077
|
},
|
|
3042
|
-
/**
|
|
3043
|
-
|
|
3078
|
+
/**
|
|
3079
|
+
* D2.1, 9 for a machine copy served at the page's own address on `Accept`
|
|
3080
|
+
* negotiation: a machine media type AND a body that is not HTML. ARS 0.3: 6
|
|
3081
|
+
* when the page does not negotiate but the Markdown copy it declares as an
|
|
3082
|
+
* alternate was fetched and is real. Less than full because only agents that
|
|
3083
|
+
* look for the link reach it, and they pay a second request to do so.
|
|
3084
|
+
*/
|
|
3085
|
+
negotiatedResponse: { full: 9, linkedCopy: 6 },
|
|
3044
3086
|
/** D2.2, 3. All-or-nothing. */
|
|
3045
3087
|
declaredAlternates: { full: 3 },
|
|
3046
3088
|
/** D2.3, 3. All-or-nothing, and 0 unless D2.1 > 0. */
|
|
@@ -3249,12 +3291,14 @@ function evidenceHash(evidence) {
|
|
|
3249
3291
|
parityConfirm: redactProbe(evidence.probes.parityConfirm),
|
|
3250
3292
|
robotsTxt: redactProbe(evidence.probes.robotsTxt),
|
|
3251
3293
|
llmsTxt: redactProbe(evidence.probes.llmsTxt),
|
|
3252
|
-
wellKnownUcp: redactProbe(evidence.probes.wellKnownUcp)
|
|
3294
|
+
wellKnownUcp: redactProbe(evidence.probes.wellKnownUcp),
|
|
3295
|
+
// ARS 0.3, and only when present, so a 0.2 bundle hashes as it did.
|
|
3296
|
+
...evidence.probes.markdownAlternate === void 0 ? {} : { markdownAlternate: redactProbe(evidence.probes.markdownAlternate) }
|
|
3253
3297
|
}
|
|
3254
3298
|
})
|
|
3255
3299
|
);
|
|
3256
3300
|
}
|
|
3257
|
-
var ARS_CORPUS_HASH = sha256Hex("ars-0.
|
|
3301
|
+
var ARS_CORPUS_HASH = sha256Hex("ars-0.3-corpus-unfrozen");
|
|
3258
3302
|
function parseLinkHeaders(values) {
|
|
3259
3303
|
const out = [];
|
|
3260
3304
|
for (const value of values) {
|
|
@@ -3316,6 +3360,51 @@ function measured(label, value) {
|
|
|
3316
3360
|
function heuristic(label, value) {
|
|
3317
3361
|
return { label, value, basis: "heuristic" };
|
|
3318
3362
|
}
|
|
3363
|
+
var FACT_NAMES = {
|
|
3364
|
+
title: "name or title",
|
|
3365
|
+
description: "description",
|
|
3366
|
+
updated: "last-updated date",
|
|
3367
|
+
published: "publish date",
|
|
3368
|
+
price: "price",
|
|
3369
|
+
currency: "currency",
|
|
3370
|
+
availability: "availability",
|
|
3371
|
+
brand: "brand",
|
|
3372
|
+
sku: "SKU",
|
|
3373
|
+
shipping: "shipping details",
|
|
3374
|
+
returns: "returns policy",
|
|
3375
|
+
"org-name": "business name",
|
|
3376
|
+
address: "address",
|
|
3377
|
+
hours: "opening hours",
|
|
3378
|
+
phone: "phone number",
|
|
3379
|
+
email: "email address",
|
|
3380
|
+
"service-area": "service area",
|
|
3381
|
+
author: "author",
|
|
3382
|
+
section: "section",
|
|
3383
|
+
authority: "publisher",
|
|
3384
|
+
"primary-action-url": "main action link (such as Buy, Book, Contact or Install)",
|
|
3385
|
+
eligibility: "eligibility",
|
|
3386
|
+
duration: "duration",
|
|
3387
|
+
"question-answer": "questions and answers",
|
|
3388
|
+
"item-count": "number of items",
|
|
3389
|
+
"item-link": "links to the items"
|
|
3390
|
+
};
|
|
3391
|
+
function factName(kind) {
|
|
3392
|
+
return FACT_NAMES[kind] ?? kind;
|
|
3393
|
+
}
|
|
3394
|
+
function factList(kinds) {
|
|
3395
|
+
return kinds.map(factName).join(", ");
|
|
3396
|
+
}
|
|
3397
|
+
function plainBytes(bytes) {
|
|
3398
|
+
if (bytes < 1024) return `${bytes} bytes`;
|
|
3399
|
+
return `${divRoundHalfUp(bytes, 1024)} KB`;
|
|
3400
|
+
}
|
|
3401
|
+
var ROBOTS_STATUS = {
|
|
3402
|
+
ok: "found",
|
|
3403
|
+
missing: "not found (nothing is blocked)",
|
|
3404
|
+
error: "the server returned an error",
|
|
3405
|
+
unparseable: "found, but it could not be read"
|
|
3406
|
+
};
|
|
3407
|
+
var COUNTS_ONCE_COPY = "only once the page sends AI assistants a Markdown copy, so 0 for now";
|
|
3319
3408
|
function checkReachable(context) {
|
|
3320
3409
|
const { agentCapture, browserCapture, ruleset } = context;
|
|
3321
3410
|
const split = SUBPOINTS.reachable;
|
|
@@ -3325,17 +3414,17 @@ function checkReachable(context) {
|
|
|
3325
3414
|
const sameFinalUrl = browserCapture !== null && browserCapture.finalUrl === agentCapture.finalUrl;
|
|
3326
3415
|
const earned = (status2xx ? split.status2xx : 0) + (withinLimit ? split.withinRedirectLimit : 0) + (sameFinalUrl ? split.noAcceptConditionalRedirect : 0);
|
|
3327
3416
|
const evidence = [
|
|
3328
|
-
measured("
|
|
3329
|
-
measured("
|
|
3417
|
+
measured("Status code AI assistants got", String(agentCapture.status)),
|
|
3418
|
+
measured("Redirects on the way", `${hops} (up to ${ruleset.maxRedirects} allowed)`),
|
|
3330
3419
|
measured(
|
|
3331
|
-
"
|
|
3332
|
-
browserCapture === null ? "not
|
|
3420
|
+
"Same address for AI assistants and browsers",
|
|
3421
|
+
browserCapture === null ? "not checked, because this scan has no browser request to compare" : yesNo(sameFinalUrl)
|
|
3333
3422
|
)
|
|
3334
3423
|
];
|
|
3335
3424
|
return sameFinalUrl ? { earned, evidence } : {
|
|
3336
3425
|
earned,
|
|
3337
3426
|
evidence,
|
|
3338
|
-
remedy: "
|
|
3427
|
+
remedy: "Send AI assistants and browsers to the same address. A redirect that depends on the Accept header sends assistants to a page browsers never see."
|
|
3339
3428
|
};
|
|
3340
3429
|
}
|
|
3341
3430
|
function checkRobotsPolicy(context) {
|
|
@@ -3344,21 +3433,22 @@ function checkRobotsPolicy(context) {
|
|
|
3344
3433
|
const decision = policy.audiences.assistant;
|
|
3345
3434
|
const parsesClean = robots === null || robots.malformedLines === 0;
|
|
3346
3435
|
const noOrphanRules = robots === null || robots.orphanRules === 0;
|
|
3436
|
+
const rule = decision.matchedGroup === null ? "" : ` (User-agent: ${decision.matchedGroup}${decision.matchedRule === null ? "" : `, ${decision.matchedRule}`})`;
|
|
3347
3437
|
const evidence = [
|
|
3348
|
-
measured("robots.txt", policy.robotsTxtStatus),
|
|
3438
|
+
measured("robots.txt", ROBOTS_STATUS[policy.robotsTxtStatus]),
|
|
3349
3439
|
measured(
|
|
3350
|
-
"
|
|
3351
|
-
decision.
|
|
3440
|
+
"AI assistants allowed",
|
|
3441
|
+
decision.decision === "disallow" ? `no${rule}` : decision.matchedGroup === null ? "yes, no rule mentions them" : `yes${rule}`
|
|
3352
3442
|
),
|
|
3353
|
-
measured("
|
|
3443
|
+
measured("Lines that could not be read", robots === null ? "none" : String(robots.malformedLines)),
|
|
3354
3444
|
measured(
|
|
3355
|
-
"Rules
|
|
3356
|
-
robots === null ? "
|
|
3445
|
+
"Rules outside a User-agent group",
|
|
3446
|
+
robots === null ? "none" : String(robots.orphanRules)
|
|
3357
3447
|
),
|
|
3358
|
-
measured("Sitemap
|
|
3448
|
+
measured("Sitemap listed", yesNo(policy.sitemapDeclared)),
|
|
3359
3449
|
measured(
|
|
3360
|
-
"
|
|
3361
|
-
policy.trainingOptOut ? "blocked
|
|
3450
|
+
"AI training crawlers",
|
|
3451
|
+
policy.trainingOptOut ? "blocked, which does not affect this score" : "allowed"
|
|
3362
3452
|
)
|
|
3363
3453
|
];
|
|
3364
3454
|
if (decision.decision === "disallow") {
|
|
@@ -3366,20 +3456,20 @@ function checkRobotsPolicy(context) {
|
|
|
3366
3456
|
id: "robots-contradiction",
|
|
3367
3457
|
severity: "warn",
|
|
3368
3458
|
basis: "measured",
|
|
3369
|
-
message: "robots.txt
|
|
3370
|
-
evidence: [evidence[1] ?? measured("
|
|
3459
|
+
message: "Your robots.txt blocks AI assistants with a rule written for all crawlers. That looks accidental, and it keeps assistants out.",
|
|
3460
|
+
evidence: [evidence[1] ?? measured("AI assistants allowed", "no")]
|
|
3371
3461
|
});
|
|
3372
3462
|
return {
|
|
3373
3463
|
earned: 0,
|
|
3374
3464
|
evidence,
|
|
3375
|
-
remedy: "
|
|
3465
|
+
remedy: "Your robots.txt blocks AI assistants with a rule meant for all crawlers. If you want assistants to read your pages, give them their own group that allows them, such as ChatGPT-User and Claude-User."
|
|
3376
3466
|
};
|
|
3377
3467
|
}
|
|
3378
3468
|
const earned = split.assistantAllowed + (parsesClean ? split.parsesClean : 0) + (noOrphanRules ? split.noOrphanRules : 0) + (policy.sitemapDeclared ? split.sitemapDeclared : 0);
|
|
3379
3469
|
return {
|
|
3380
3470
|
earned,
|
|
3381
3471
|
evidence,
|
|
3382
|
-
remedy: policy.sitemapDeclared ? void 0 : "Add a `Sitemap:` line to robots.txt
|
|
3472
|
+
remedy: policy.sitemapDeclared ? void 0 : "Add a `Sitemap:` line to robots.txt so assistants can find the rest of your pages."
|
|
3383
3473
|
};
|
|
3384
3474
|
}
|
|
3385
3475
|
function checkRenderIndependence(context) {
|
|
@@ -3389,7 +3479,7 @@ function checkRenderIndependence(context) {
|
|
|
3389
3479
|
if (structural === null || structural.doc === null) {
|
|
3390
3480
|
return {
|
|
3391
3481
|
earned: 0,
|
|
3392
|
-
evidence: [heuristic("HTML
|
|
3482
|
+
evidence: [heuristic("HTML page", "not checked, because no HTML was returned")]
|
|
3393
3483
|
};
|
|
3394
3484
|
}
|
|
3395
3485
|
const found = /* @__PURE__ */ new Set();
|
|
@@ -3410,42 +3500,143 @@ function checkRenderIndependence(context) {
|
|
|
3410
3500
|
id: "render-dependent",
|
|
3411
3501
|
severity: "info",
|
|
3412
3502
|
basis: "heuristic",
|
|
3413
|
-
message: `${found.size} of ${coreSize}
|
|
3414
|
-
evidence: [heuristic("
|
|
3503
|
+
message: `${found.size} of ${coreSize} key facts for this kind of page were in the HTML before any JavaScript ran. An assistant that does not run scripts sees the rest as missing.`,
|
|
3504
|
+
evidence: [heuristic("Key facts in the HTML", `${found.size} of ${coreSize}`)]
|
|
3415
3505
|
});
|
|
3416
3506
|
}
|
|
3417
3507
|
return {
|
|
3418
3508
|
earned,
|
|
3419
3509
|
evidence: [
|
|
3420
|
-
heuristic("
|
|
3421
|
-
heuristic("
|
|
3510
|
+
heuristic("Key facts in the HTML before JavaScript runs", `${found.size} of ${coreSize}`),
|
|
3511
|
+
heuristic("Fallback text for visitors without JavaScript", yesNo(hasNoscript)),
|
|
3422
3512
|
heuristic(
|
|
3423
|
-
"
|
|
3424
|
-
"
|
|
3513
|
+
"How we checked",
|
|
3514
|
+
"we read the HTML your server sends and do not run JavaScript, so facts added by scripts count as missing"
|
|
3425
3515
|
)
|
|
3426
3516
|
],
|
|
3427
|
-
remedy: earned === full ? void 0 : "
|
|
3517
|
+
remedy: earned === full ? void 0 : "Put the key facts in the HTML your server sends. Most AI assistants do not run JavaScript, so facts added by scripts are invisible to them."
|
|
3428
3518
|
};
|
|
3429
3519
|
}
|
|
3430
3520
|
var MACHINE_KINDS = /* @__PURE__ */ new Set(["markdown", "text", "json"]);
|
|
3521
|
+
function isMachineCopy(capture) {
|
|
3522
|
+
const representation = buildRepresentation(capture);
|
|
3523
|
+
return representation !== null && MACHINE_KINDS.has(representation.kind) && !representation.looksLikeHtml;
|
|
3524
|
+
}
|
|
3525
|
+
var MARKDOWN_MEDIA = /* @__PURE__ */ new Set(["text/markdown", "text/x-markdown"]);
|
|
3526
|
+
function isMarkdownType(type) {
|
|
3527
|
+
return type !== null && MARKDOWN_MEDIA.has((type.split(";")[0] ?? "").trim().toLowerCase());
|
|
3528
|
+
}
|
|
3529
|
+
function declaredMarkdownAlternates(captures) {
|
|
3530
|
+
const out = [];
|
|
3531
|
+
const add = (raw, base) => {
|
|
3532
|
+
try {
|
|
3533
|
+
const url = new URL(raw, base);
|
|
3534
|
+
url.hash = "";
|
|
3535
|
+
const href = url.toString();
|
|
3536
|
+
if (!out.includes(href)) out.push(href);
|
|
3537
|
+
} catch {
|
|
3538
|
+
}
|
|
3539
|
+
};
|
|
3540
|
+
for (const capture of captures) {
|
|
3541
|
+
if (capture === null) continue;
|
|
3542
|
+
for (const link of parseLinkHeaders(headerAll(capture.headers, "link"))) {
|
|
3543
|
+
if (link.rel.includes("alternate") && isMarkdownType(link.type)) add(link.url, capture.finalUrl);
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
for (const capture of captures) {
|
|
3547
|
+
if (capture === null) continue;
|
|
3548
|
+
const representation = buildRepresentation(capture);
|
|
3549
|
+
if (representation === null || representation.doc === null) continue;
|
|
3550
|
+
for (const link of representation.doc.links) {
|
|
3551
|
+
if (!link.rel.includes("alternate") || link.href === null) continue;
|
|
3552
|
+
if (isMarkdownType(link.type)) add(link.href, capture.finalUrl);
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
return out;
|
|
3556
|
+
}
|
|
3557
|
+
function markdownAlternateTarget(agent, browser, origin) {
|
|
3558
|
+
if (agent === null || agent.status < 200 || agent.status >= 300) return null;
|
|
3559
|
+
if (isMachineCopy(agent)) return null;
|
|
3560
|
+
const own = /* @__PURE__ */ new Set([agent.finalUrl, agent.requestedUrl]);
|
|
3561
|
+
for (const href of declaredMarkdownAlternates([browser, agent])) {
|
|
3562
|
+
let sameOrigin = false;
|
|
3563
|
+
try {
|
|
3564
|
+
sameOrigin = new URL(href).origin === origin;
|
|
3565
|
+
} catch {
|
|
3566
|
+
sameOrigin = false;
|
|
3567
|
+
}
|
|
3568
|
+
if (sameOrigin && !own.has(href)) return href;
|
|
3569
|
+
}
|
|
3570
|
+
return null;
|
|
3571
|
+
}
|
|
3572
|
+
function linkedCopyOf(evidence, agent, browser) {
|
|
3573
|
+
const url = markdownAlternateTarget(agent, browser, evidence.target.origin);
|
|
3574
|
+
if (url === null) return null;
|
|
3575
|
+
const record = evidence.probes.markdownAlternate ?? null;
|
|
3576
|
+
if (record === null) return { url, status: "unchecked", representation: null, reason: null };
|
|
3577
|
+
if (!record.result.ok) {
|
|
3578
|
+
if (record.result.error === "policy-rejected") {
|
|
3579
|
+
return { url, status: "unchecked", representation: null, reason: null };
|
|
3580
|
+
}
|
|
3581
|
+
return { url, status: "broken", representation: null, reason: record.result.error };
|
|
3582
|
+
}
|
|
3583
|
+
const capture = record.result.capture;
|
|
3584
|
+
if (capture.requestedUrl !== url) {
|
|
3585
|
+
return { url, status: "unchecked", representation: null, reason: null };
|
|
3586
|
+
}
|
|
3587
|
+
if (capture.status < 200 || capture.status >= 300) {
|
|
3588
|
+
return { url, status: "broken", representation: null, reason: `HTTP ${capture.status}` };
|
|
3589
|
+
}
|
|
3590
|
+
if (!isMachineCopy(capture)) {
|
|
3591
|
+
return { url, status: "broken", representation: null, reason: "it returned HTML, not Markdown" };
|
|
3592
|
+
}
|
|
3593
|
+
return { url, status: "checked", representation: buildRepresentation(capture), reason: null };
|
|
3594
|
+
}
|
|
3595
|
+
var MEDIA_NAMES = {
|
|
3596
|
+
"text/markdown": "Markdown",
|
|
3597
|
+
"text/x-markdown": "Markdown",
|
|
3598
|
+
"text/html": "HTML",
|
|
3599
|
+
"text/plain": "plain text",
|
|
3600
|
+
"application/json": "JSON",
|
|
3601
|
+
"*/*": "anything else"
|
|
3602
|
+
};
|
|
3603
|
+
function acceptSummary(accept) {
|
|
3604
|
+
const names = [];
|
|
3605
|
+
for (const entry of accept.split(",")) {
|
|
3606
|
+
const type = (entry.split(";")[0] ?? "").trim().toLowerCase();
|
|
3607
|
+
if (type === "") continue;
|
|
3608
|
+
const name = MEDIA_NAMES[type] ?? type;
|
|
3609
|
+
if (!names.includes(name)) names.push(name);
|
|
3610
|
+
}
|
|
3611
|
+
const [first, ...rest] = names;
|
|
3612
|
+
if (first === void 0) return accept;
|
|
3613
|
+
return rest.length === 0 ? first : `${first} first, then ${rest.join(", ")}`;
|
|
3614
|
+
}
|
|
3431
3615
|
function checkNegotiatedResponse(context) {
|
|
3432
|
-
const { agent } = context;
|
|
3616
|
+
const { agent, linkedCopy } = context;
|
|
3433
3617
|
const typeIsMachine = MACHINE_KINDS.has(agent.kind);
|
|
3434
3618
|
const bodyIsHtml = agent.looksLikeHtml;
|
|
3435
|
-
const
|
|
3619
|
+
const linkedWorks = linkedCopy !== null && linkedCopy.status === "checked";
|
|
3620
|
+
const earned = context.negotiated ? SUBPOINTS.negotiatedResponse.full : linkedWorks ? SUBPOINTS.negotiatedResponse.linkedCopy : 0;
|
|
3621
|
+
const asked = context.evidence.probes.agent.requestHeaders["accept"] ?? context.evidence.probes.agent.requestHeaders["Accept"] ?? null;
|
|
3436
3622
|
return {
|
|
3437
3623
|
earned,
|
|
3438
3624
|
evidence: [
|
|
3439
|
-
measured("
|
|
3440
|
-
measured("
|
|
3441
|
-
measured(
|
|
3442
|
-
|
|
3443
|
-
context.evidence.probes.agent.requestHeaders["accept"] ?? context.evidence.probes.agent.requestHeaders["Accept"] ?? "not recorded"
|
|
3444
|
-
)
|
|
3625
|
+
measured("We asked for", asked === null ? "not recorded" : acceptSummary(asked)),
|
|
3626
|
+
measured("Format we got", agent.contentType ?? "not stated"),
|
|
3627
|
+
measured("Content was HTML", yesNo(bodyIsHtml)),
|
|
3628
|
+
...linkedCopy === null ? [] : [measured("Linked Markdown copy", linkedCopyLine(linkedCopy))]
|
|
3445
3629
|
],
|
|
3446
|
-
remedy:
|
|
3630
|
+
remedy: context.negotiated ? void 0 : linkedWorks ? "Your linked Markdown copy works. For full credit, also send it from the page address when an AI assistant asks for Markdown, so assistants get it without a second request." : typeIsMachine ? "Your server labels this response as Markdown, text or JSON but sends HTML. Send the format the Content-Type header names." : "When an AI assistant asks for Markdown, answer from the same address with a Markdown copy of the page and `Content-Type: text/markdown`. Assistants get your facts without the menus, scripts and styling, which are usually most of the page."
|
|
3447
3631
|
};
|
|
3448
3632
|
}
|
|
3633
|
+
function linkedCopyLine(copy) {
|
|
3634
|
+
if (copy.status === "checked") {
|
|
3635
|
+
return `loaded as Markdown from ${copy.url} (${plainBytes(copy.representation?.bytes ?? 0)})`;
|
|
3636
|
+
}
|
|
3637
|
+
if (copy.status === "broken") return `did not load as Markdown from ${copy.url} (${copy.reason ?? "error"})`;
|
|
3638
|
+
return `linked at ${copy.url}, not checked in this scan`;
|
|
3639
|
+
}
|
|
3449
3640
|
function checkDeclaredAlternates(context) {
|
|
3450
3641
|
const { agentCapture, browserCapture, structural } = context;
|
|
3451
3642
|
const links = parseLinkHeaders([
|
|
@@ -3460,45 +3651,54 @@ function checkDeclaredAlternates(context) {
|
|
|
3460
3651
|
for (const link of structural.doc.links) {
|
|
3461
3652
|
if (!link.rel.includes("alternate")) continue;
|
|
3462
3653
|
if (link.type === null || link.href === null) continue;
|
|
3463
|
-
documentAlternates.push(`${link.type}
|
|
3654
|
+
documentAlternates.push(`${link.type} at ${link.href}`);
|
|
3464
3655
|
}
|
|
3465
3656
|
}
|
|
3466
3657
|
const total = headerAlternates.length + documentAlternates.length;
|
|
3658
|
+
const broken = context.linkedCopy !== null && context.linkedCopy.status === "broken";
|
|
3659
|
+
if (broken && context.linkedCopy !== null) {
|
|
3660
|
+
return {
|
|
3661
|
+
earned: 0,
|
|
3662
|
+
evidence: [measured("Linked Markdown copy", linkedCopyLine(context.linkedCopy))],
|
|
3663
|
+
remedy: `The Markdown copy this page links to did not load (${context.linkedCopy.reason ?? "error"}). Fix the file or the link.`
|
|
3664
|
+
};
|
|
3665
|
+
}
|
|
3467
3666
|
return {
|
|
3468
3667
|
earned: total > 0 ? SUBPOINTS.declaredAlternates.full : 0,
|
|
3469
3668
|
evidence: [
|
|
3470
3669
|
measured(
|
|
3471
|
-
|
|
3472
|
-
headerAlternates.length === 0 ? "none" : headerAlternates.map((link) => `${link.type ?? "?"}
|
|
3670
|
+
"Link header pointing to the Markdown copy",
|
|
3671
|
+
headerAlternates.length === 0 ? "none" : headerAlternates.map((link) => `${link.type ?? "?"} at ${link.url}`).join(", ")
|
|
3473
3672
|
),
|
|
3474
3673
|
measured(
|
|
3475
|
-
|
|
3674
|
+
"Link tag in the page pointing to the Markdown copy",
|
|
3476
3675
|
documentAlternates.length === 0 ? "none" : documentAlternates.join(", ")
|
|
3477
3676
|
)
|
|
3478
3677
|
],
|
|
3479
|
-
remedy: total > 0 ? void 0 : '
|
|
3678
|
+
remedy: total > 0 ? void 0 : 'Tell assistants where the Markdown copy is. Add `<link rel="alternate" type="text/markdown" href="\u2026">` to the page, or send the same thing as a `Link` header.'
|
|
3480
3679
|
};
|
|
3481
3680
|
}
|
|
3482
|
-
function checkVaryAccept(context
|
|
3681
|
+
function checkVaryAccept(context) {
|
|
3682
|
+
const negotiated = context.negotiated;
|
|
3483
3683
|
const { agentCapture, browserCapture } = context;
|
|
3484
3684
|
const agentVary = headerTokens(header(agentCapture.headers, "vary"));
|
|
3485
3685
|
const browserVary = browserCapture === null ? [] : headerTokens(header(browserCapture.headers, "vary"));
|
|
3486
3686
|
const declared = agentVary.includes("accept") || browserVary.includes("accept");
|
|
3487
3687
|
const evidence = [
|
|
3488
|
-
measured("Vary
|
|
3688
|
+
measured("Vary header sent to AI assistants", header(agentCapture.headers, "vary") ?? "not sent"),
|
|
3489
3689
|
measured(
|
|
3490
|
-
"Vary
|
|
3491
|
-
browserCapture === null ? "
|
|
3690
|
+
"Vary header sent to browsers",
|
|
3691
|
+
browserCapture === null ? "not checked" : header(browserCapture.headers, "vary") ?? "not sent"
|
|
3492
3692
|
)
|
|
3493
3693
|
];
|
|
3494
|
-
if (negotiated
|
|
3694
|
+
if (!negotiated) {
|
|
3495
3695
|
return {
|
|
3496
3696
|
earned: 0,
|
|
3497
3697
|
evidence: [
|
|
3498
3698
|
...evidence,
|
|
3499
3699
|
measured(
|
|
3500
|
-
"
|
|
3501
|
-
"
|
|
3700
|
+
"Counts",
|
|
3701
|
+
context.linkedCopy?.status === "checked" ? "only when the page address itself sends the Markdown copy, so 0 for now" : COUNTS_ONCE_COPY
|
|
3502
3702
|
)
|
|
3503
3703
|
]
|
|
3504
3704
|
};
|
|
@@ -3508,17 +3708,27 @@ function checkVaryAccept(context, negotiated) {
|
|
|
3508
3708
|
id: "vary-missing",
|
|
3509
3709
|
severity: "warn",
|
|
3510
3710
|
basis: "measured",
|
|
3511
|
-
message: "
|
|
3711
|
+
message: "This address sends the Markdown copy or the HTML depending on what is asked for, but does not send `Vary: Accept`. A shared cache can hand the Markdown to a shopper, or the HTML to an assistant.",
|
|
3512
3712
|
evidence
|
|
3513
3713
|
});
|
|
3514
3714
|
}
|
|
3515
3715
|
return {
|
|
3516
3716
|
earned: declared ? SUBPOINTS.varyAccept.full : 0,
|
|
3517
3717
|
evidence,
|
|
3518
|
-
remedy: declared ? void 0 : "Send `Vary: Accept` on every response from
|
|
3718
|
+
remedy: declared ? void 0 : "Send `Vary: Accept` on every response from an address that serves a Markdown copy, so caches keep the two versions apart."
|
|
3519
3719
|
};
|
|
3520
3720
|
}
|
|
3521
3721
|
var PARITY_KINDS = ["price", "currency", "availability", "title"];
|
|
3722
|
+
function linkedCopyFacts(context, copy) {
|
|
3723
|
+
if (copy.representation === null) return [];
|
|
3724
|
+
return extractFacts(copy.representation, {
|
|
3725
|
+
profile: context.profile,
|
|
3726
|
+
ruleset: context.ruleset,
|
|
3727
|
+
baseUrl: copy.representation.finalUrl,
|
|
3728
|
+
origin: context.evidence.target.origin,
|
|
3729
|
+
currencyHint: currencyHintOf(context.structural, context.agent)
|
|
3730
|
+
});
|
|
3731
|
+
}
|
|
3522
3732
|
function factView(facts) {
|
|
3523
3733
|
const best = /* @__PURE__ */ new Map();
|
|
3524
3734
|
const observed = /* @__PURE__ */ new Map();
|
|
@@ -3554,48 +3764,48 @@ function divergentKinds(left, right, kinds) {
|
|
|
3554
3764
|
}
|
|
3555
3765
|
return { compared, divergent };
|
|
3556
3766
|
}
|
|
3557
|
-
function checkSubstanceParity(context
|
|
3767
|
+
function checkSubstanceParity(context) {
|
|
3558
3768
|
const { agentFacts, browserFacts, browser, evidence: bundle } = context;
|
|
3559
|
-
|
|
3769
|
+
const linked = !context.negotiated && context.linkedCopy?.status === "checked" ? context.linkedCopy : null;
|
|
3770
|
+
const htmlFacts = browser !== null ? browserFacts : agentFacts;
|
|
3771
|
+
if (!context.negotiated && linked === null || linked === null && browser === null) {
|
|
3560
3772
|
return {
|
|
3561
3773
|
earned: 0,
|
|
3562
3774
|
evidence: [
|
|
3563
3775
|
heuristic(
|
|
3564
|
-
"
|
|
3565
|
-
negotiated
|
|
3776
|
+
"Counts",
|
|
3777
|
+
!context.negotiated ? COUNTS_ONCE_COPY : "not checked, because this scan has no browser request to compare"
|
|
3566
3778
|
)
|
|
3567
3779
|
]
|
|
3568
3780
|
};
|
|
3569
3781
|
}
|
|
3570
|
-
const agentValues = factView(agentFacts);
|
|
3571
|
-
const browserValues = factView(browserFacts);
|
|
3782
|
+
const agentValues = factView(linked === null ? agentFacts : linkedCopyFacts(context, linked));
|
|
3783
|
+
const browserValues = factView(linked === null ? browserFacts : htmlFacts);
|
|
3572
3784
|
const { compared, divergent } = divergentKinds(agentValues, browserValues, PARITY_KINDS);
|
|
3573
3785
|
const evidenceLines = [
|
|
3574
3786
|
heuristic(
|
|
3575
|
-
"
|
|
3576
|
-
compared.length === 0 ? "none
|
|
3787
|
+
"Facts compared",
|
|
3788
|
+
compared.length === 0 ? "none appear in both the Markdown copy and the page" : factList(compared)
|
|
3577
3789
|
),
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3790
|
+
...compared.length === 0 ? [] : [
|
|
3791
|
+
heuristic(
|
|
3792
|
+
"Values",
|
|
3793
|
+
divergent.length === 0 ? "match" : divergent.map(
|
|
3794
|
+
(entry) => `${factName(entry.kind)}: Markdown copy ${entry.left}, page ${entry.right}`
|
|
3795
|
+
).join("; ")
|
|
3796
|
+
)
|
|
3797
|
+
]
|
|
3582
3798
|
];
|
|
3583
3799
|
if (compared.length === 0) {
|
|
3584
3800
|
return {
|
|
3585
3801
|
earned: 0,
|
|
3586
|
-
evidence:
|
|
3587
|
-
|
|
3588
|
-
heuristic(
|
|
3589
|
-
"Scored",
|
|
3590
|
-
"no \u2014 a comparison needs at least one comparable fact in both representations"
|
|
3591
|
-
)
|
|
3592
|
-
],
|
|
3593
|
-
remedy: "State the same core facts in both representations. ARS could not compare them, so it could not award the parity points."
|
|
3802
|
+
evidence: evidenceLines,
|
|
3803
|
+
remedy: "State the same key facts, such as name and price, in the Markdown copy and in the page, so the two can be checked against each other."
|
|
3594
3804
|
};
|
|
3595
3805
|
}
|
|
3596
3806
|
if (divergent.length === 0)
|
|
3597
3807
|
return { earned: SUBPOINTS.substanceParity.full, evidence: evidenceLines };
|
|
3598
|
-
const confirm = bundle.probes.parityConfirm;
|
|
3808
|
+
const confirm = linked === null ? bundle.probes.parityConfirm : null;
|
|
3599
3809
|
const confirmCapture = confirm !== null && confirm.result.ok ? confirm.result.capture : null;
|
|
3600
3810
|
const confirmRep = confirmCapture === null ? null : buildRepresentation(confirmCapture);
|
|
3601
3811
|
if (confirmRep === null) {
|
|
@@ -3603,9 +3813,9 @@ function checkSubstanceParity(context, negotiated) {
|
|
|
3603
3813
|
earned: 0,
|
|
3604
3814
|
evidence: [
|
|
3605
3815
|
...evidenceLines,
|
|
3606
|
-
heuristic("
|
|
3816
|
+
heuristic("Second look", "not taken, so this difference was seen once and is not flagged")
|
|
3607
3817
|
],
|
|
3608
|
-
remedy: "The
|
|
3818
|
+
remedy: "The Markdown copy and the page showed different values for a key fact. That can happen when a price or stock level changes between requests. If it repeats, build both from the same source."
|
|
3609
3819
|
};
|
|
3610
3820
|
}
|
|
3611
3821
|
const confirmFacts = extractFacts(confirmRep, {
|
|
@@ -3627,8 +3837,8 @@ function checkSubstanceParity(context, negotiated) {
|
|
|
3627
3837
|
evidence: [
|
|
3628
3838
|
...evidenceLines,
|
|
3629
3839
|
heuristic(
|
|
3630
|
-
"
|
|
3631
|
-
"the difference
|
|
3840
|
+
"Second look",
|
|
3841
|
+
"the difference was gone, so we treat it as a value that changed between requests"
|
|
3632
3842
|
)
|
|
3633
3843
|
]
|
|
3634
3844
|
};
|
|
@@ -3638,14 +3848,14 @@ function checkSubstanceParity(context, negotiated) {
|
|
|
3638
3848
|
severity: "warn",
|
|
3639
3849
|
basis: "heuristic",
|
|
3640
3850
|
message: reproduced.divergent.map(
|
|
3641
|
-
(entry) => `The
|
|
3851
|
+
(entry) => `The Markdown copy showed ${factName(entry.kind)} ${entry.left}; the HTML page showed ${entry.right}. We saw the same difference on two requests taken apart.`
|
|
3642
3852
|
).join(" "),
|
|
3643
3853
|
evidence: evidenceLines
|
|
3644
3854
|
});
|
|
3645
3855
|
return {
|
|
3646
3856
|
earned: 0,
|
|
3647
|
-
evidence: [...evidenceLines, heuristic("
|
|
3648
|
-
remedy: "
|
|
3857
|
+
evidence: [...evidenceLines, heuristic("Second look", "the difference was still there")],
|
|
3858
|
+
remedy: "Show the same values in the Markdown copy and the page, ideally by building both from one source. We report what each version said and do not judge which is right."
|
|
3649
3859
|
};
|
|
3650
3860
|
}
|
|
3651
3861
|
function coverageMath(context) {
|
|
@@ -3687,19 +3897,23 @@ function checkCoreFacts(context, math) {
|
|
|
3687
3897
|
return {
|
|
3688
3898
|
earned,
|
|
3689
3899
|
evidence: [
|
|
3900
|
+
heuristic("Key facts for this kind of page", factList(context.profile.core)),
|
|
3901
|
+
heuristic("Found", `${math.coreFound} of ${context.profile.core.length}`),
|
|
3902
|
+
heuristic("Missing", missing.length === 0 ? "none" : factList(missing)),
|
|
3690
3903
|
heuristic(
|
|
3691
|
-
"
|
|
3692
|
-
`${math.
|
|
3904
|
+
"Extra facts found",
|
|
3905
|
+
`${math.extendedFound} of ${context.profile.extended.length}`
|
|
3693
3906
|
),
|
|
3694
|
-
heuristic("Extended facts found", `${math.extendedFound}/${context.profile.extended.length}`),
|
|
3695
|
-
heuristic("Coverage", `${math.coveragePct}%`),
|
|
3696
3907
|
heuristic(
|
|
3697
|
-
"
|
|
3698
|
-
`${math.
|
|
3908
|
+
"Credit for the facts",
|
|
3909
|
+
`${math.coveragePct}% (a fact stated in both the text and structured data counts in full)`
|
|
3699
3910
|
),
|
|
3700
|
-
|
|
3911
|
+
heuristic(
|
|
3912
|
+
"Credit kept for length",
|
|
3913
|
+
`${math.densityPct}% (${math.coreFound + math.extendedFound} facts in ${plainBytes(context.agent.bytes)}; the more text around each fact, the less is kept)`
|
|
3914
|
+
)
|
|
3701
3915
|
],
|
|
3702
|
-
remedy: missing.length
|
|
3916
|
+
remedy: missing.length > 0 ? `Add the ${factList(missing)} to what AI assistants receive. An assistant can only repeat what the page states.${missing.includes("primary-action-url") ? " For the main action link, use a label that starts with a common action word, such as Buy, Book, Order, Contact, Sign up, Get started or Request a quote." : ""}` : earned === weight ? void 0 : math.coveragePct < 100 ? "Repeat the key facts in both the visible text and the structured data. A fact stated once gets half credit." : "Your key facts are all there, but there is a lot of page around them, so this keeps only part of its credit. A Markdown copy for AI assistants that leads with the facts is the simplest fix; trimming the page also helps."
|
|
3703
3917
|
};
|
|
3704
3918
|
}
|
|
3705
3919
|
function checkContextCost(context) {
|
|
@@ -3712,13 +3926,19 @@ function checkContextCost(context) {
|
|
|
3712
3926
|
earned,
|
|
3713
3927
|
evidence: [
|
|
3714
3928
|
measured(
|
|
3715
|
-
"
|
|
3716
|
-
`${context.agent.bytes}${context.agent.truncated ? " (
|
|
3929
|
+
"Size AI assistants had to read",
|
|
3930
|
+
`${plainBytes(context.agent.bytes)}${context.agent.truncated ? " or more (cut off at the limit)" : ""}`
|
|
3931
|
+
),
|
|
3932
|
+
measured(
|
|
3933
|
+
`Typical size for a ${context.profile.pageKind === "unknown" ? "general" : context.profile.pageKind} page`,
|
|
3934
|
+
plainBytes(reference)
|
|
3717
3935
|
),
|
|
3718
|
-
measured(
|
|
3719
|
-
|
|
3936
|
+
measured(
|
|
3937
|
+
"Compared with typical",
|
|
3938
|
+
ratio <= 100 ? "at or under typical" : `about ${divRoundHalfUp(ratio, 100)} times typical`
|
|
3939
|
+
)
|
|
3720
3940
|
],
|
|
3721
|
-
remedy: earned === full ? void 0 : "
|
|
3941
|
+
remedy: earned === full ? void 0 : "Send AI assistants a Markdown copy, which carries the facts without the page code, or make the page lighter. Scripts, inline styles and repeated menus are usually most of the size."
|
|
3722
3942
|
};
|
|
3723
3943
|
}
|
|
3724
3944
|
var QUANTITY = new RegExp(
|
|
@@ -3743,8 +3963,10 @@ function checkQuantities(context) {
|
|
|
3743
3963
|
const full = atLeast(table, Number.MAX_SAFE_INTEGER);
|
|
3744
3964
|
return {
|
|
3745
3965
|
earned,
|
|
3746
|
-
evidence: [
|
|
3747
|
-
|
|
3966
|
+
evidence: [
|
|
3967
|
+
measured("Different numbers an answer could quote", `${count} (prices, sizes, percentages, dates)`)
|
|
3968
|
+
],
|
|
3969
|
+
remedy: earned === full ? void 0 : "Write the numbers people ask about in the page text: prices, sizes, hours, fees and dates. Assistants quote numbers they can read."
|
|
3748
3970
|
};
|
|
3749
3971
|
}
|
|
3750
3972
|
function labelledSegments(context) {
|
|
@@ -3784,8 +4006,8 @@ function checkDefinitions(context) {
|
|
|
3784
4006
|
const full = atLeast(table, Number.MAX_SAFE_INTEGER);
|
|
3785
4007
|
return {
|
|
3786
4008
|
earned,
|
|
3787
|
-
evidence: [heuristic(
|
|
3788
|
-
remedy: earned === full ? void 0 : 'Label your facts. A line
|
|
4009
|
+
evidence: [heuristic('Labelled facts, like "Returns: 60 days"', `${count}`)],
|
|
4010
|
+
remedy: earned === full ? void 0 : 'Label your facts. A line like "Returns: 60 days" can be quoted as it is. The same fact inside a paragraph has to be worked out.'
|
|
3789
4011
|
};
|
|
3790
4012
|
}
|
|
3791
4013
|
function checkComparisons(context) {
|
|
@@ -3816,8 +4038,8 @@ function checkComparisons(context) {
|
|
|
3816
4038
|
const full = atLeast(table, Number.MAX_SAFE_INTEGER);
|
|
3817
4039
|
return {
|
|
3818
4040
|
earned,
|
|
3819
|
-
evidence: [measured("
|
|
3820
|
-
remedy: earned === full ? void 0 :
|
|
4041
|
+
evidence: [measured("Table rows that compare options", `${rows}`)],
|
|
4042
|
+
remedy: earned === full ? void 0 : 'Put options side by side in a table, one row each. Assistants answering "which one?" use rows they can line up.'
|
|
3821
4043
|
};
|
|
3822
4044
|
}
|
|
3823
4045
|
function coreOffsets(context) {
|
|
@@ -3831,19 +4053,17 @@ function checkFirstCoreFactOffset(context, offsets) {
|
|
|
3831
4053
|
if (first === void 0) {
|
|
3832
4054
|
return {
|
|
3833
4055
|
earned: 0,
|
|
3834
|
-
evidence: [heuristic("First
|
|
4056
|
+
evidence: [heuristic("First key fact", "none found, so there is nothing to place")]
|
|
3835
4057
|
};
|
|
3836
4058
|
}
|
|
4059
|
+
const firstKind = context.facts.find((fact) => fact.offset === first)?.kind;
|
|
3837
4060
|
return {
|
|
3838
4061
|
earned: atMost(context.ruleset.thresholds["fact-position.first-core-fact-offset"], first),
|
|
3839
4062
|
evidence: [
|
|
3840
|
-
measured("
|
|
3841
|
-
heuristic(
|
|
3842
|
-
"Which fact",
|
|
3843
|
-
context.facts.find((fact) => fact.offset === first)?.kind ?? "unknown"
|
|
3844
|
-
)
|
|
4063
|
+
measured("First key fact appears", first === 0 ? "at the very start" : `after ${plainBytes(first)}`),
|
|
4064
|
+
heuristic("Which fact", firstKind === void 0 ? "unknown" : factName(firstKind))
|
|
3845
4065
|
],
|
|
3846
|
-
remedy: first <= 512 ? void 0 : "
|
|
4066
|
+
remedy: first <= 512 ? void 0 : "Put the key facts near the top of what AI assistants receive. Assistants often read only the start."
|
|
3847
4067
|
};
|
|
3848
4068
|
}
|
|
3849
4069
|
function checkFrontWindow(context, offsets) {
|
|
@@ -3855,8 +4075,8 @@ function checkFrontWindow(context, offsets) {
|
|
|
3855
4075
|
return {
|
|
3856
4076
|
earned: 0,
|
|
3857
4077
|
evidence: [
|
|
3858
|
-
measured("
|
|
3859
|
-
heuristic("
|
|
4078
|
+
measured("Opening section", `the first ${plainBytes(size)}`),
|
|
4079
|
+
heuristic("Key facts in it", "none found, so there is nothing to place")
|
|
3860
4080
|
]
|
|
3861
4081
|
};
|
|
3862
4082
|
}
|
|
@@ -3865,11 +4085,13 @@ function checkFrontWindow(context, offsets) {
|
|
|
3865
4085
|
return {
|
|
3866
4086
|
earned: atLeast(context.ruleset.thresholds["fact-position.front-window"], pct),
|
|
3867
4087
|
evidence: [
|
|
3868
|
-
measured(
|
|
3869
|
-
|
|
3870
|
-
|
|
4088
|
+
measured(
|
|
4089
|
+
"Opening section",
|
|
4090
|
+
`the first ${plainBytes(size)} (a ${divisor === 5 ? "fifth" : `1/${divisor}`} of the page, at least ${plainBytes(floor)})`
|
|
4091
|
+
),
|
|
4092
|
+
heuristic("Key facts in it", `${inside} of the ${offsets.length} found (${pct}%)`)
|
|
3871
4093
|
],
|
|
3872
|
-
remedy: pct >= 90 ? void 0 : "
|
|
4094
|
+
remedy: pct >= 90 ? void 0 : "Move the key facts into the first part of the page. Facts further down cost an assistant a full read."
|
|
3873
4095
|
};
|
|
3874
4096
|
}
|
|
3875
4097
|
function checkStructuredDataPresent(context) {
|
|
@@ -3878,7 +4100,7 @@ function checkStructuredDataPresent(context) {
|
|
|
3878
4100
|
if (structural === null) {
|
|
3879
4101
|
return {
|
|
3880
4102
|
earned: 0,
|
|
3881
|
-
evidence: [measured("HTML
|
|
4103
|
+
evidence: [measured("HTML page", "not checked, because no HTML was returned")]
|
|
3882
4104
|
};
|
|
3883
4105
|
}
|
|
3884
4106
|
const { blocks, parsed } = structural.jsonLd;
|
|
@@ -3896,11 +4118,11 @@ function checkStructuredDataPresent(context) {
|
|
|
3896
4118
|
return {
|
|
3897
4119
|
earned,
|
|
3898
4120
|
evidence: [
|
|
3899
|
-
measured("JSON-LD blocks", `${parsed} of ${blocks}
|
|
3900
|
-
measured("Microdata
|
|
3901
|
-
measured("RDFa
|
|
4121
|
+
measured("JSON-LD blocks that could be read", `${parsed} of ${blocks}`),
|
|
4122
|
+
measured("Microdata items", String(microdata)),
|
|
4123
|
+
measured("RDFa items", String(rdfa))
|
|
3902
4124
|
],
|
|
3903
|
-
remedy: earned === split.clean ? void 0 : blocks > parsed ? "
|
|
4125
|
+
remedy: earned === split.clean ? void 0 : blocks > parsed ? "At least one JSON-LD block has a syntax error, so it cannot be read. Check it with a JSON validator." : "Add a JSON-LD block describing this page, such as a schema.org Product with its price. Search engines and some AI assistants read it."
|
|
3904
4126
|
};
|
|
3905
4127
|
}
|
|
3906
4128
|
function scoredNode(context) {
|
|
@@ -3918,14 +4140,11 @@ function checkRequiredProperties(context) {
|
|
|
3918
4140
|
return {
|
|
3919
4141
|
earned: 0,
|
|
3920
4142
|
evidence: [
|
|
3921
|
-
measured("
|
|
3922
|
-
measured("
|
|
3923
|
-
measured(
|
|
3924
|
-
"Scope",
|
|
3925
|
-
"JSON-LD only in 0.1 \u2014 microdata satisfies D5.1 but is not walked for required properties"
|
|
3926
|
-
)
|
|
4143
|
+
measured("Schema.org type", "none found"),
|
|
4144
|
+
measured("Properties we look for", required.join(", ") || "none"),
|
|
4145
|
+
measured("Where we look", "JSON-LD. Microdata counts toward the check above, not this one.")
|
|
3927
4146
|
],
|
|
3928
|
-
remedy:
|
|
4147
|
+
remedy: "Give the JSON-LD a schema.org type that matches the page, such as Product, LocalBusiness or Article, with the properties listed."
|
|
3929
4148
|
};
|
|
3930
4149
|
}
|
|
3931
4150
|
const satisfied = required.filter((path) => hasPath(node, path));
|
|
@@ -3934,14 +4153,11 @@ function checkRequiredProperties(context) {
|
|
|
3934
4153
|
return {
|
|
3935
4154
|
earned: split.recognisedType + completeness,
|
|
3936
4155
|
evidence: [
|
|
3937
|
-
measured("
|
|
3938
|
-
measured(
|
|
3939
|
-
|
|
3940
|
-
`${satisfied.length}/${required.length}${missing.length === 0 ? "" : ` \u2014 missing ${missing.join(", ")}`}`
|
|
3941
|
-
),
|
|
3942
|
-
measured("Table", `ruleset.requiredProperties.${context.profile.pageKind}`)
|
|
4156
|
+
measured("Schema.org type", node.types.join(", ")),
|
|
4157
|
+
measured("Properties present", `${satisfied.length} of ${required.length}`),
|
|
4158
|
+
measured("Missing", missing.length === 0 ? "none" : missing.join(", "))
|
|
3943
4159
|
],
|
|
3944
|
-
remedy: missing.length === 0 ? void 0 : `Add ${missing.join(", ")} to the ${node.types[0] ?? "
|
|
4160
|
+
remedy: missing.length === 0 ? void 0 : `Add ${missing.join(", ")} to the ${node.types[0] ?? "main"} item in your JSON-LD.`
|
|
3945
4161
|
};
|
|
3946
4162
|
}
|
|
3947
4163
|
function checkTextAgreement(context) {
|
|
@@ -3951,19 +4167,23 @@ function checkTextAgreement(context) {
|
|
|
3951
4167
|
const { compared, divergent } = divergentKinds(fromJsonLd, fromPage, PARITY_KINDS);
|
|
3952
4168
|
const evidenceLines = [
|
|
3953
4169
|
heuristic(
|
|
3954
|
-
"
|
|
3955
|
-
compared.length === 0 ? "none
|
|
4170
|
+
"Facts compared",
|
|
4171
|
+
compared.length === 0 ? "none appear in both the structured data and the page text" : factList(compared)
|
|
3956
4172
|
),
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
4173
|
+
...compared.length === 0 ? [] : [
|
|
4174
|
+
heuristic(
|
|
4175
|
+
"Values",
|
|
4176
|
+
divergent.length === 0 ? "match" : divergent.map(
|
|
4177
|
+
(entry) => `${factName(entry.kind)}: structured data ${entry.left}, page ${entry.right}`
|
|
4178
|
+
).join("; ")
|
|
4179
|
+
)
|
|
4180
|
+
]
|
|
3961
4181
|
];
|
|
3962
4182
|
if (compared.length === 0) {
|
|
3963
4183
|
return {
|
|
3964
4184
|
earned: 0,
|
|
3965
|
-
evidence:
|
|
3966
|
-
remedy: "State the
|
|
4185
|
+
evidence: evidenceLines,
|
|
4186
|
+
remedy: "State the key facts, such as name and price, in both the structured data and the visible page, so the two can be checked against each other."
|
|
3967
4187
|
};
|
|
3968
4188
|
}
|
|
3969
4189
|
if (divergent.length > 0) {
|
|
@@ -3972,14 +4192,14 @@ function checkTextAgreement(context) {
|
|
|
3972
4192
|
severity: "warn",
|
|
3973
4193
|
basis: "heuristic",
|
|
3974
4194
|
message: divergent.map(
|
|
3975
|
-
(entry) => `The structured data
|
|
4195
|
+
(entry) => `The structured data says ${factName(entry.kind)} ${entry.left}; the visible page says ${entry.right}.`
|
|
3976
4196
|
).join(" "),
|
|
3977
4197
|
evidence: evidenceLines
|
|
3978
4198
|
});
|
|
3979
4199
|
return {
|
|
3980
4200
|
earned: 0,
|
|
3981
4201
|
evidence: evidenceLines,
|
|
3982
|
-
remedy: "
|
|
4202
|
+
remedy: "Build the structured data from the same source as the visible page, so the two cannot disagree."
|
|
3983
4203
|
};
|
|
3984
4204
|
}
|
|
3985
4205
|
return { earned: SUBPOINTS.textAgreement.full, evidence: evidenceLines };
|
|
@@ -4009,22 +4229,22 @@ function checkCanonical(context) {
|
|
|
4009
4229
|
id: "canonical-mismatch",
|
|
4010
4230
|
severity: "warn",
|
|
4011
4231
|
basis: "measured",
|
|
4012
|
-
message: `The
|
|
4232
|
+
message: `The Markdown copy and the HTML page name different main addresses: ${agentCanonical} and ${htmlCanonical}.`,
|
|
4013
4233
|
evidence: [
|
|
4014
|
-
measured("
|
|
4015
|
-
measured("HTML
|
|
4234
|
+
measured("Main address given to AI assistants", agentCanonical),
|
|
4235
|
+
measured("Main address in the HTML", htmlCanonical)
|
|
4016
4236
|
]
|
|
4017
4237
|
});
|
|
4018
4238
|
}
|
|
4019
4239
|
return {
|
|
4020
4240
|
earned: (present ? split.present : 0) + (absolute ? split.absolute : 0) + (consistent ? split.consistentAcrossProbes : 0),
|
|
4021
4241
|
evidence: [
|
|
4022
|
-
measured("Canonical
|
|
4023
|
-
measured("Canonical
|
|
4024
|
-
measured("
|
|
4025
|
-
measured("Same
|
|
4242
|
+
measured("Canonical address in the HTML", htmlCanonical ?? "none"),
|
|
4243
|
+
measured("Canonical address AI assistants got", agentCanonical ?? "none"),
|
|
4244
|
+
measured("Full address with https://", yesNo(absolute)),
|
|
4245
|
+
measured("Same for AI assistants and browsers", yesNo(consistent))
|
|
4026
4246
|
],
|
|
4027
|
-
remedy: consistent ? void 0 :
|
|
4247
|
+
remedy: consistent && absolute ? void 0 : htmlCanonical === null ? 'Add `<link rel="canonical" href="https://\u2026">` with the full address of the page, so assistants know which address to cite.' : agentCanonical === null ? 'Your Markdown copy has no canonical address. Send `Link: <https://\u2026>; rel="canonical"` with it, pointing at the page.' : !consistent ? "Use one canonical address, written in full, for the page and its Markdown copy." : "Write the canonical address in full, starting with https://."
|
|
4028
4248
|
};
|
|
4029
4249
|
}
|
|
4030
4250
|
function checkCacheValidators(context) {
|
|
@@ -4044,11 +4264,11 @@ function checkCacheValidators(context) {
|
|
|
4044
4264
|
return {
|
|
4045
4265
|
earned: (sane ? split.saneCacheControl : 0) + (validator ? split.validator : 0),
|
|
4046
4266
|
evidence: [
|
|
4047
|
-
measured("Cache-Control", cacheControl ?? "
|
|
4048
|
-
measured("ETag", etag ?? "
|
|
4049
|
-
measured("Last-Modified", lastModified ?? "
|
|
4267
|
+
measured("Cache-Control header", cacheControl ?? "not sent"),
|
|
4268
|
+
measured("ETag header", etag ?? "not sent"),
|
|
4269
|
+
measured("Last-Modified header", lastModified ?? "not sent")
|
|
4050
4270
|
],
|
|
4051
|
-
remedy: sane && validator ? void 0 : "Send a `Cache-Control`
|
|
4271
|
+
remedy: sane && validator ? void 0 : "Send a `Cache-Control` header with a lifetime, plus an `ETag` or `Last-Modified` header, so repeat visits can skip unchanged pages."
|
|
4052
4272
|
};
|
|
4053
4273
|
}
|
|
4054
4274
|
function bodyOf(probe) {
|
|
@@ -4064,8 +4284,8 @@ function checkLlmsTxt(context) {
|
|
|
4064
4284
|
if (body === null || body.trim().length === 0) {
|
|
4065
4285
|
return {
|
|
4066
4286
|
earned: 0,
|
|
4067
|
-
evidence: [measured("/llms.txt", body === null ? "
|
|
4068
|
-
remedy: "Publish /llms.txt
|
|
4287
|
+
evidence: [measured("/llms.txt", body === null ? "not found" : "empty")],
|
|
4288
|
+
remedy: "Publish /llms.txt with a `#` title, a short summary and links to your main pages."
|
|
4069
4289
|
};
|
|
4070
4290
|
}
|
|
4071
4291
|
const hasTitle = /^#\s+\S/m.test(body);
|
|
@@ -4075,24 +4295,24 @@ function checkLlmsTxt(context) {
|
|
|
4075
4295
|
return {
|
|
4076
4296
|
earned: specShaped ? split.specShaped : split.present,
|
|
4077
4297
|
evidence: [
|
|
4078
|
-
measured("/llms.txt",
|
|
4079
|
-
measured("
|
|
4080
|
-
measured("
|
|
4298
|
+
measured("/llms.txt", `found, ${body.length} characters`),
|
|
4299
|
+
measured("Has a # title", yesNo(hasTitle)),
|
|
4300
|
+
measured("Has links", yesNo(hasLinks))
|
|
4081
4301
|
],
|
|
4082
|
-
remedy: specShaped ? void 0 : "
|
|
4302
|
+
remedy: specShaped ? void 0 : "Start /llms.txt with a `#` title and add at least one link written as `[name](url)`."
|
|
4083
4303
|
};
|
|
4084
4304
|
}
|
|
4085
4305
|
function checkSitemap(context) {
|
|
4086
4306
|
return {
|
|
4087
4307
|
earned: context.policy.sitemapDeclared ? SUBPOINTS.sitemap.full : 0,
|
|
4088
4308
|
evidence: [
|
|
4089
|
-
measured("Sitemap
|
|
4309
|
+
measured("Sitemap listed in robots.txt", yesNo(context.policy.sitemapDeclared)),
|
|
4090
4310
|
measured(
|
|
4091
|
-
"Sitemaps
|
|
4092
|
-
context.robots === null ? "
|
|
4311
|
+
"Sitemaps",
|
|
4312
|
+
context.robots === null ? "none" : context.robots.sitemaps.join(", ") || "none"
|
|
4093
4313
|
)
|
|
4094
4314
|
],
|
|
4095
|
-
remedy: context.policy.sitemapDeclared ? void 0 : "
|
|
4315
|
+
remedy: context.policy.sitemapDeclared ? void 0 : "Add a line like `Sitemap: https://example.com/sitemap.xml` to robots.txt."
|
|
4096
4316
|
};
|
|
4097
4317
|
}
|
|
4098
4318
|
var ENDPOINT_TYPES = [
|
|
@@ -4135,17 +4355,17 @@ function checkMachineEndpoint(context) {
|
|
|
4135
4355
|
]);
|
|
4136
4356
|
for (const link of links) {
|
|
4137
4357
|
if (link.rel.some((rel) => ENDPOINT_RELS.includes(rel)))
|
|
4138
|
-
declarations.push(`Link
|
|
4358
|
+
declarations.push(`Link header (${link.rel.join(" ")}) at ${link.url}`);
|
|
4139
4359
|
else if (link.type !== null && ENDPOINT_TYPES.includes(link.type))
|
|
4140
|
-
declarations.push(`Link
|
|
4360
|
+
declarations.push(`Link header (${link.type}) at ${link.url}`);
|
|
4141
4361
|
}
|
|
4142
4362
|
if (context.structural !== null && context.structural.doc !== null) {
|
|
4143
4363
|
for (const link of context.structural.doc.links) {
|
|
4144
4364
|
if (link.href === null) continue;
|
|
4145
4365
|
if (link.rel.some((rel) => ENDPOINT_RELS.includes(rel)))
|
|
4146
|
-
declarations.push(
|
|
4366
|
+
declarations.push(`link tag (${link.rel.join(" ")}) at ${link.href}`);
|
|
4147
4367
|
else if (link.type !== null && ENDPOINT_TYPES.includes(link.type))
|
|
4148
|
-
declarations.push(
|
|
4368
|
+
declarations.push(`link tag (${link.type}) at ${link.href}`);
|
|
4149
4369
|
}
|
|
4150
4370
|
}
|
|
4151
4371
|
const llms = bodyOf(context.evidence.probes.llmsTxt);
|
|
@@ -4155,21 +4375,19 @@ function checkMachineEndpoint(context) {
|
|
|
4155
4375
|
while ((match = MARKDOWN_LINK.exec(llms)) !== null) {
|
|
4156
4376
|
const url = (match[1] ?? "").toLowerCase();
|
|
4157
4377
|
if (ENDPOINT_PATH_MARKERS.some((marker) => url.includes(marker)))
|
|
4158
|
-
declarations.push(`llms.txt
|
|
4378
|
+
declarations.push(`llms.txt link to ${match?.[1] ?? url}`);
|
|
4159
4379
|
}
|
|
4160
4380
|
}
|
|
4161
4381
|
const ucp = bodyOf(context.evidence.probes.wellKnownUcp);
|
|
4162
4382
|
if (ucp !== null && ucp.trim().length > 0) declarations.push("/.well-known/ucp");
|
|
4383
|
+
const unique = [...new Set(declarations)];
|
|
4163
4384
|
return {
|
|
4164
4385
|
earned: declarations.length > 0 ? SUBPOINTS.machineEndpoint.full : 0,
|
|
4165
4386
|
evidence: [
|
|
4166
|
-
measured(
|
|
4167
|
-
|
|
4168
|
-
declarations.length === 0 ? "none" : declarations.join("; ")
|
|
4169
|
-
),
|
|
4170
|
-
measured("Probed paths", "/robots.txt, /llms.txt, /.well-known/ucp \u2014 ARS probes no others")
|
|
4387
|
+
measured("Feeds or APIs we found", unique.length === 0 ? "none" : unique.join("; ")),
|
|
4388
|
+
measured("Where we looked", "link tags, Link headers, /llms.txt and /.well-known/ucp")
|
|
4171
4389
|
],
|
|
4172
|
-
remedy: declarations.length > 0 ? void 0 : "
|
|
4390
|
+
remedy: declarations.length > 0 ? void 0 : "Point to a product feed, API or calendar from the page with a `<link>` tag or a `Link` header. We only count ones the page names."
|
|
4173
4391
|
};
|
|
4174
4392
|
}
|
|
4175
4393
|
function weightOf(ruleset, id) {
|
|
@@ -4374,7 +4592,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4374
4592
|
id: "training-opt-out",
|
|
4375
4593
|
severity: "info",
|
|
4376
4594
|
basis: "measured",
|
|
4377
|
-
message: "This site blocks
|
|
4595
|
+
message: "This site blocks AI training crawlers but lets AI assistants in. That does not affect the score.",
|
|
4378
4596
|
evidence: [
|
|
4379
4597
|
measured("Training audience", policy.audiences.training.matchedRule ?? "disallowed"),
|
|
4380
4598
|
measured("Effect on this score", "none")
|
|
@@ -4388,7 +4606,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4388
4606
|
id: "scanner-blocked",
|
|
4389
4607
|
severity: "info",
|
|
4390
4608
|
basis: "measured",
|
|
4391
|
-
message: "robots.txt
|
|
4609
|
+
message: "robots.txt asks Rebilder\u2019s scanner not to read this site, so we did not score the page.",
|
|
4392
4610
|
evidence: [measured("Matched rule", scannerDecision)]
|
|
4393
4611
|
});
|
|
4394
4612
|
return nonGrade(
|
|
@@ -4416,7 +4634,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4416
4634
|
id: "assistant-opt-out",
|
|
4417
4635
|
severity: "info",
|
|
4418
4636
|
basis: "measured",
|
|
4419
|
-
message: "This site
|
|
4637
|
+
message: "This site\u2019s robots.txt blocks AI assistants by name. We respect that choice and do not grade the page.",
|
|
4420
4638
|
evidence: [
|
|
4421
4639
|
measured("Matched group", policy.audiences.assistant.matchedGroup ?? "(named group)"),
|
|
4422
4640
|
measured("Matched rule", policy.audiences.assistant.matchedRule ?? "Disallow")
|
|
@@ -4439,7 +4657,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4439
4657
|
id: "scanner-blocked",
|
|
4440
4658
|
severity: "warn",
|
|
4441
4659
|
basis: "measured",
|
|
4442
|
-
message: "The
|
|
4660
|
+
message: "The site answered our scanner with a bot check or a block, so we did not grade the page. AI assistants may be blocked the same way.",
|
|
4443
4661
|
evidence: [measured("Probe error", agentProbe.result.error)]
|
|
4444
4662
|
});
|
|
4445
4663
|
}
|
|
@@ -4459,7 +4677,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4459
4677
|
id: "scanner-blocked",
|
|
4460
4678
|
severity: "warn",
|
|
4461
4679
|
basis: "measured",
|
|
4462
|
-
message: `The
|
|
4680
|
+
message: `The site answered our scanner with HTTP ${agentCapture.status}, so we did not grade the page. AI assistants may be blocked the same way.`,
|
|
4463
4681
|
evidence: [measured("HTTP status", String(agentCapture.status))]
|
|
4464
4682
|
});
|
|
4465
4683
|
return nonGrade(
|
|
@@ -4501,7 +4719,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4501
4719
|
id: "body-truncated",
|
|
4502
4720
|
severity: "warn",
|
|
4503
4721
|
basis: "measured",
|
|
4504
|
-
message: `
|
|
4722
|
+
message: `The page is larger than our ${plainBytes(ruleset.maxBodyBytes)} reading limit, so we did not score it. The facts and sizes would both be incomplete.`,
|
|
4505
4723
|
evidence: [
|
|
4506
4724
|
measured("Body cap", `${ruleset.maxBodyBytes} bytes`),
|
|
4507
4725
|
measured("Bytes read", `\u2265 ${agentCapture.bytes}`)
|
|
@@ -4547,7 +4765,10 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4547
4765
|
const browserFacts = browser === null || browser === agent ? [] : extractFacts(browser, { ...extractContext, baseUrl: browser.finalUrl });
|
|
4548
4766
|
const structuralFacts = structural === agent ? agentFacts : structural === browser ? browserFacts : [];
|
|
4549
4767
|
const facts = mergeFacts(agentFacts, structuralFacts);
|
|
4768
|
+
const negotiated = isMachineCopy(agentCapture);
|
|
4550
4769
|
const context = {
|
|
4770
|
+
negotiated,
|
|
4771
|
+
linkedCopy: negotiated ? null : linkedCopyOf(evidence, agentCapture, browserCapture),
|
|
4551
4772
|
evidence,
|
|
4552
4773
|
ruleset,
|
|
4553
4774
|
agentCapture,
|
|
@@ -4570,18 +4791,18 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4570
4791
|
id: "paywalled",
|
|
4571
4792
|
severity: "info",
|
|
4572
4793
|
basis: "measured",
|
|
4573
|
-
message: `This page
|
|
4794
|
+
message: `This page says it is behind a paywall (${paywall}). We scored the part we were shown.`,
|
|
4574
4795
|
evidence: [measured("Paywall signal", paywall)]
|
|
4575
4796
|
});
|
|
4576
4797
|
}
|
|
4577
4798
|
const math = coverageMath(context);
|
|
4578
4799
|
const offsets = coreOffsets(context);
|
|
4579
|
-
const
|
|
4800
|
+
const negotiatedResponse = checkNegotiatedResponse(context);
|
|
4580
4801
|
const checks = [
|
|
4581
4802
|
buildCheck(ruleset, "retrievability.reachable", checkReachable(context)),
|
|
4582
4803
|
buildCheck(ruleset, "retrievability.robots-policy", checkRobotsPolicy(context)),
|
|
4583
4804
|
buildCheck(ruleset, "retrievability.render-independence", checkRenderIndependence(context)),
|
|
4584
|
-
buildCheck(ruleset, "machine-representation.negotiated-response",
|
|
4805
|
+
buildCheck(ruleset, "machine-representation.negotiated-response", negotiatedResponse),
|
|
4585
4806
|
buildCheck(
|
|
4586
4807
|
ruleset,
|
|
4587
4808
|
"machine-representation.declared-alternates",
|
|
@@ -4590,12 +4811,12 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4590
4811
|
buildCheck(
|
|
4591
4812
|
ruleset,
|
|
4592
4813
|
"machine-representation.vary-accept",
|
|
4593
|
-
checkVaryAccept(context
|
|
4814
|
+
checkVaryAccept(context)
|
|
4594
4815
|
),
|
|
4595
4816
|
buildCheck(
|
|
4596
4817
|
ruleset,
|
|
4597
4818
|
"machine-representation.substance-parity",
|
|
4598
|
-
checkSubstanceParity(context
|
|
4819
|
+
checkSubstanceParity(context)
|
|
4599
4820
|
),
|
|
4600
4821
|
buildCheck(ruleset, "fact-coverage.core-facts", checkCoreFacts(context, math)),
|
|
4601
4822
|
buildCheck(ruleset, "fact-coverage.context-cost", checkContextCost(context)),
|
|
@@ -4623,7 +4844,7 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
|
|
|
4623
4844
|
const grade = band?.grade ?? "F";
|
|
4624
4845
|
const perToken = ruleset.thresholds["cost.approx-bytes-per-token"]?.[0] ?? 4;
|
|
4625
4846
|
const htmlBytes = structural?.bytes ?? agent.bytes;
|
|
4626
|
-
const negotiatedBytes = negotiated
|
|
4847
|
+
const negotiatedBytes = negotiated ? agent.bytes : null;
|
|
4627
4848
|
const cost = {
|
|
4628
4849
|
htmlBytes,
|
|
4629
4850
|
negotiatedBytes,
|
|
@@ -4721,6 +4942,6 @@ function robotsDisallowsScanner(robotsBody, path) {
|
|
|
4721
4942
|
return null;
|
|
4722
4943
|
}
|
|
4723
4944
|
|
|
4724
|
-
export { AGENT_ACCEPT, ARS_CORPUS_HASH, ARS_HEURISTIC_WEIGHT, ARS_HEURISTIC_WEIGHT_CEILING, ARS_MEASURED_WEIGHT, ARS_ROBOTS_TOKEN, ARS_SPEC_VERSION, ASSET_ACCEPT, BROWSER_ACCEPT, CHECK_META, DEFAULT_RULESET, DIMENSION_META, PROFILES, SUBPOINTS, bandFor, canonicalJson, classify, evidenceHash, minorUnitDigits, parseMoneyText, parseRobots, pathMatches, profileFor, recommend, robotsDisallowsScanner, rulesetHash, score, sha256Hex, utf8Length };
|
|
4945
|
+
export { AGENT_ACCEPT, ARS_CORPUS_HASH, ARS_HEURISTIC_WEIGHT, ARS_HEURISTIC_WEIGHT_CEILING, ARS_MEASURED_WEIGHT, ARS_ROBOTS_TOKEN, ARS_SPEC_VERSION, ASSET_ACCEPT, BROWSER_ACCEPT, CHECK_META, DEFAULT_RULESET, DIMENSION_META, PROFILES, SUBPOINTS, bandFor, canonicalJson, classify, declaredMarkdownAlternates, evidenceHash, isMachineCopy, markdownAlternateTarget, minorUnitDigits, parseMoneyText, parseRobots, pathMatches, profileFor, recommend, robotsDisallowsScanner, rulesetHash, score, sha256Hex, utf8Length };
|
|
4725
4946
|
//# sourceMappingURL=index.js.map
|
|
4726
4947
|
//# sourceMappingURL=index.js.map
|