@rebilder/agent-readability 0.3.0 → 0.5.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 +17 -0
- package/README.md +5 -4
- package/dist/index.cjs +1275 -196
- package/dist/index.d.cts +317 -14
- package/dist/index.d.ts +317 -14
- package/dist/index.js +1259 -197
- package/dist/index.js.map +1 -1
- package/dist/probe/index.cjs +850 -12
- package/dist/probe/index.d.cts +15 -11
- package/dist/probe/index.d.ts +15 -11
- package/dist/probe/index.js +850 -12
- package/dist/probe/index.js.map +1 -1
- package/dist/probe/local.cjs +850 -12
- package/dist/probe/local.d.cts +2 -2
- package/dist/probe/local.d.ts +2 -2
- package/dist/probe/local.js +850 -12
- package/dist/probe/local.js.map +1 -1
- package/dist/{robots-policy-DE8jix-e.d.cts → robots-policy-C7cfPpu2.d.cts} +15 -6
- package/dist/{robots-policy-DE8jix-e.d.ts → robots-policy-C7cfPpu2.d.ts} +15 -6
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ArsDimensionId, a as ArsBasis, b as ArsFactProfile, c as ArsRuleset, d as ArsBand, e as
|
|
2
|
-
export {
|
|
1
|
+
import { A as ArsDimensionId, a as ArsBasis, b as ArsFactProfile, c as ArsRuleset, d as ArsBand, e as ArsHttpCapture, f as ArsEvidence, g as ArsResult, h as ArsRecommendation, i as ArsFactObservation, j as ArsAudienceDecision, k as ArsPageKind } from './robots-policy-C7cfPpu2.js';
|
|
2
|
+
export { l as AGENT_ACCEPT, m as ARS_ROBOTS_TOKEN, n as ARS_SPEC_VERSION, o as ASSET_ACCEPT, p as ArsAudience, q as ArsCheck, r as ArsCheckEvidence, s as ArsCheckId, t as ArsCostReport, u as ArsDimension, v as ArsFactKind, w as ArsFlag, x as ArsFlagId, y as ArsGrade, z as ArsOutcome, B as ArsPolicyReport, C as ArsProbeError, D as ArsProbeRecord, E as ArsUnscoredReason, F as ArsVantage, G as BROWSER_ACCEPT, H as robotsDisallowsScanner } from './robots-policy-C7cfPpu2.js';
|
|
3
3
|
|
|
4
4
|
/** Descriptive metadata per check: which dimension it belongs to, its published label, its basis. */
|
|
5
5
|
interface ArsCheckMeta {
|
|
@@ -177,7 +177,7 @@ declare const ARS_MEASURED_WEIGHT = 63;
|
|
|
177
177
|
declare const ARS_HEURISTIC_WEIGHT = 37;
|
|
178
178
|
declare const ARS_HEURISTIC_WEIGHT_CEILING = 40;
|
|
179
179
|
/**
|
|
180
|
-
* ARS 0.
|
|
180
|
+
* ARS 0.3's frozen ruleset. Weights and bands are 0.2's; the action lexicon grew.
|
|
181
181
|
*
|
|
182
182
|
* DESIGNED CEILINGS, printed in the spec (§8) as intentional rather than
|
|
183
183
|
* discovered, and stated here in 0.2's numbers: no content negotiation loses
|
|
@@ -189,7 +189,7 @@ declare const ARS_HEURISTIC_WEIGHT_CEILING = 40;
|
|
|
189
189
|
* rather than described.
|
|
190
190
|
*/
|
|
191
191
|
declare const DEFAULT_RULESET: {
|
|
192
|
-
readonly version: "0.
|
|
192
|
+
readonly version: "0.3.0";
|
|
193
193
|
readonly weights: {
|
|
194
194
|
readonly 'retrievability.reachable': 11;
|
|
195
195
|
readonly 'retrievability.robots-policy': 10;
|
|
@@ -308,7 +308,7 @@ declare const DEFAULT_RULESET: {
|
|
|
308
308
|
readonly document: readonly ["name", "dateModified", "publisher"];
|
|
309
309
|
readonly unknown: readonly ["name"];
|
|
310
310
|
};
|
|
311
|
-
readonly actionLexicon: readonly ["add to bag", "add to basket", "add to cart", "apply", "apply now", "book", "book now", "buy", "buy now", "call now", "checkout", "contact", "contact us", "donate", "download", "email us", "enroll", "get a quote", "get quote", "get started", "join", "make an appointment", "order", "order now", "purchase", "register", "request", "request a demo", "request a quote", "reserve", "schedule", "sign up", "signup", "start", "start free trial", "subscribe"];
|
|
311
|
+
readonly actionLexicon: readonly ["add to bag", "add to basket", "add to cart", "apply", "apply now", "book", "book now", "buy", "buy now", "call", "call now", "check availability", "check out", "checkout", "contact", "contact us", "create account", "create an account", "donate", "download", "email us", "enquire", "enrol", "enroll", "free trial", "get a demo", "get a quote", "get directions", "get in touch", "get quote", "get started", "get the app", "get tickets", "hire", "inquire", "install", "join", "make an appointment", "message us", "order", "order now", "order online", "pre-order", "preorder", "purchase", "register", "rent", "request", "request a demo", "request a quote", "reserve", "schedule", "shop", "shop now", "sign up", "signup", "start", "start free trial", "subscribe", "talk to sales", "talk to us", "text us", "try", "upgrade"];
|
|
312
312
|
/** 2 MiB decoded. Streamed and aborted at the cap; `await response.text()` is forbidden. */
|
|
313
313
|
readonly maxBodyBytes: number;
|
|
314
314
|
/** 3 hops. Every hop re-resolves DNS and re-validates (§5.2). */
|
|
@@ -350,7 +350,7 @@ declare const DEFAULT_RULESET: {
|
|
|
350
350
|
};
|
|
351
351
|
|
|
352
352
|
/**
|
|
353
|
-
* score.ts — the ARS 0.
|
|
353
|
+
* score.ts — the ARS 0.3 scoring engine. The whole pure half comes together here.
|
|
354
354
|
*
|
|
355
355
|
* THE CONTRACT. `score(evidence, ruleset)` is a pure function: same evidence,
|
|
356
356
|
* same ruleset, same `ArsResult`, byte for byte, in any conformant
|
|
@@ -375,14 +375,21 @@ declare const DEFAULT_RULESET: {
|
|
|
375
375
|
* TWO GATES EXIST, AND THEY POINT THE SAFE WAY. D2.3 (`Vary: Accept`) and D2.4
|
|
376
376
|
* (substance parity) are gated on D2.1 (a machine representation was served),
|
|
377
377
|
* which is a MEASURED check gating others. That direction is fine and is what
|
|
378
|
-
* makes the published ceiling provable: no content negotiation loses D2.1 (
|
|
379
|
-
* D2.3 (3) + D2.4 (3) → max
|
|
378
|
+
* makes the published ceiling provable: no content negotiation loses D2.1 (9) +
|
|
379
|
+
* D2.3 (3) + D2.4 (3) → max 85 → capped at B. The forbidden direction — a
|
|
380
380
|
* heuristic that can zero measured points — appears nowhere. In particular D2.4
|
|
381
381
|
* and D5.3 are SCORED CHECKS, NOT GATES: a parity failure loses its own 3 points
|
|
382
|
-
* and raises a `warn`, and leaves D2's other
|
|
383
|
-
* the whole reason "measured
|
|
382
|
+
* and raises a `warn`, and leaves D2's other 15 measured points alone. That is
|
|
383
|
+
* the whole reason "measured 63 / heuristic 37" is an honest split rather than a
|
|
384
384
|
* presentational one.
|
|
385
385
|
*
|
|
386
|
+
* EVIDENCE IS WRITTEN FOR THE SITE OWNER. Labels, values, remedies and flag
|
|
387
|
+
* messages are printed on the public scan page, so they use plain words and name
|
|
388
|
+
* a header or file only where a developer needs it to act. "Content
|
|
389
|
+
* negotiation" in particular is written as what it means to a merchant: the
|
|
390
|
+
* page sends AI assistants a Markdown copy when they ask for one. None of this
|
|
391
|
+
* text is in the conformance projection, so rewording it is a PATCH.
|
|
392
|
+
*
|
|
386
393
|
* WHICH REPRESENTATION SCORES WHAT (the decision `./extract` states in its own
|
|
387
394
|
* header, repeated here because it is the reason the golden pair means anything):
|
|
388
395
|
* D3 (coverage) and D4 (position) score the AGENT representation, because ARS
|
|
@@ -454,9 +461,16 @@ declare const SUBPOINTS: {
|
|
|
454
461
|
band: readonly number[];
|
|
455
462
|
noscriptFloor: number;
|
|
456
463
|
};
|
|
457
|
-
/**
|
|
464
|
+
/**
|
|
465
|
+
* D2.1, 9 for a machine copy served at the page's own address on `Accept`
|
|
466
|
+
* negotiation: a machine media type AND a body that is not HTML. ARS 0.3: 6
|
|
467
|
+
* when the page does not negotiate but the Markdown copy it declares as an
|
|
468
|
+
* alternate was fetched and is real. Less than full because only agents that
|
|
469
|
+
* look for the link reach it, and they pay a second request to do so.
|
|
470
|
+
*/
|
|
458
471
|
negotiatedResponse: {
|
|
459
472
|
full: number;
|
|
473
|
+
linkedCopy: number;
|
|
460
474
|
};
|
|
461
475
|
/** D2.2, 3. All-or-nothing. */
|
|
462
476
|
declaredAlternates: {
|
|
@@ -540,11 +554,27 @@ declare function rulesetHash(ruleset: ArsRuleset): string;
|
|
|
540
554
|
*/
|
|
541
555
|
declare function evidenceHash(evidence: ArsEvidence): string;
|
|
542
556
|
/**
|
|
543
|
-
* Version marker for the ARS 0.
|
|
557
|
+
* Version marker for the ARS 0.3 corpus (spec §2.4.3).
|
|
544
558
|
* This is the hash of the versioned marker string, not of fixture contents.
|
|
545
559
|
* A corpus-content digest replaces it at corpus freeze in a MINOR release.
|
|
546
560
|
*/
|
|
547
561
|
declare const ARS_CORPUS_HASH: string;
|
|
562
|
+
/** Whether a capture is a machine copy: a machine media type and a body that is not HTML. */
|
|
563
|
+
declare function isMachineCopy(capture: ArsHttpCapture): boolean;
|
|
564
|
+
/**
|
|
565
|
+
* The Markdown copies a page declares as alternates, as absolute URLs without a
|
|
566
|
+
* fragment, deduplicated, in a fixed order: `Link` headers on each capture, then
|
|
567
|
+
* `<link rel="alternate" type="text/markdown">` in each capture's HTML.
|
|
568
|
+
*/
|
|
569
|
+
declare function declaredMarkdownAlternates(captures: readonly (ArsHttpCapture | null)[]): string[];
|
|
570
|
+
/**
|
|
571
|
+
* THE ONE MARKDOWN ALTERNATE ARS FETCHES (§3.3, ARS 0.3), shared by the probe and
|
|
572
|
+
* the scorer so the two cannot disagree about which URL was meant. The first
|
|
573
|
+
* declared Markdown copy that is on the target's origin and is not the page's
|
|
574
|
+
* own address; null when the agent probe already received a machine copy, when
|
|
575
|
+
* it did not get a 2xx, or when nothing qualifies. One extra request at most.
|
|
576
|
+
*/
|
|
577
|
+
declare function markdownAlternateTarget(agent: ArsHttpCapture | null, browser: ArsHttpCapture | null, origin: string): string | null;
|
|
548
578
|
/** The band a score falls in. Bands headline; the integer is secondary (§3.6). */
|
|
549
579
|
declare function bandFor(score: number, ruleset?: ArsRuleset): ArsBand | null;
|
|
550
580
|
/**
|
|
@@ -668,6 +698,7 @@ declare function recommend(input: ArsRecommendationInput): ArsRecommendation[];
|
|
|
668
698
|
* is why offsets from the two files are in the same address space.
|
|
669
699
|
*/
|
|
670
700
|
declare function utf8Length(text: string): number;
|
|
701
|
+
type ArsFactSource = ArsFactObservation['source'];
|
|
671
702
|
interface RobotsGroup {
|
|
672
703
|
/** Lowercased user-agent tokens this group applies to. */
|
|
673
704
|
readonly agents: readonly string[];
|
|
@@ -689,6 +720,13 @@ interface RobotsFile {
|
|
|
689
720
|
* by the score — waiting longer is not worse markup.
|
|
690
721
|
*/
|
|
691
722
|
declare function parseRobots(text: string): RobotsFile;
|
|
723
|
+
/**
|
|
724
|
+
* RFC 9309 group selection: the most specific matching `User-agent` wins, `*` is
|
|
725
|
+
* the fallback, and matching is case-insensitive. Returns the decision plus the
|
|
726
|
+
* group and rule that produced it, because `ArsAudienceDecision` publishes both —
|
|
727
|
+
* a merchant who disagrees with an `opt-out` verdict gets to see the line.
|
|
728
|
+
*/
|
|
729
|
+
declare function decideRobots(robots: RobotsFile, tokens: readonly string[], path: string): ArsAudienceDecision;
|
|
692
730
|
/**
|
|
693
731
|
* Path matching with `*` and `$`, done as a bounded scan rather than a compiled
|
|
694
732
|
* regex: a robots.txt is attacker-controlled input and
|
|
@@ -865,7 +903,7 @@ declare function profileFor(pageKind: ArsPageKind): ArsFactProfile;
|
|
|
865
903
|
*
|
|
866
904
|
* WHY `Money` IS DECLARED HERE RATHER THAN IMPORTED. It is structurally
|
|
867
905
|
* identical to `@rebilder/render-md`'s `Money`, and duplicating it is
|
|
868
|
-
* deliberate:
|
|
906
|
+
* deliberate: the package-graph check forbids
|
|
869
907
|
* `agent-readability → render-md` (and the reverse) in the `ars-boundary` rule.
|
|
870
908
|
* The two packages point in opposite directions — gateway/render-md turn a
|
|
871
909
|
* source of truth into output; the scorer turns a response into a judgment — so
|
|
@@ -932,4 +970,269 @@ declare function minorUnitDigits(code: string): number;
|
|
|
932
970
|
*/
|
|
933
971
|
declare function parseMoneyText(text: string, hints?: MoneyHints): ParsedMoney | null;
|
|
934
972
|
|
|
935
|
-
|
|
973
|
+
/**
|
|
974
|
+
* site-signals.ts — observations about a page that are NOT part of ARS.
|
|
975
|
+
*
|
|
976
|
+
* Nothing in this file is read by `score()`, and nothing here changes a check,
|
|
977
|
+
* a weight, a flag in `ArsResult`, or the ruleset hash. These are the unscored
|
|
978
|
+
* site-report findings that ride alongside a score: a CDN bot challenge served
|
|
979
|
+
* instead of the page, `noindex` directives, the canonical address a page
|
|
980
|
+
* names. Pure, no clock, no network, so the probe, the API and a second
|
|
981
|
+
* implementation can all read a capture the same way.
|
|
982
|
+
*
|
|
983
|
+
* ── EDGE CHALLENGE FINGERPRINTS ─────────────────────────────────────────────
|
|
984
|
+
* A fingerprint ships only when the vendor's own documentation confirms it.
|
|
985
|
+
* Sources, checked November 2026:
|
|
986
|
+
*
|
|
987
|
+
* - Cloudflare, header. "cf-mitigated" present and set to "challenge" on every
|
|
988
|
+
* Challenge Page type, any status:
|
|
989
|
+
* https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/detect-response/
|
|
990
|
+
* - Cloudflare, markup. Challenge scripts load from paths starting
|
|
991
|
+
* "/cdn-cgi/challenge-platform/":
|
|
992
|
+
* https://developers.cloudflare.com/cloudflare-challenges/challenge-types/javascript-detections/
|
|
993
|
+
* Cloudflare also injects that path into ORDINARY pages (JavaScript
|
|
994
|
+
* Detections), so the markup alone never counts: it needs `server:
|
|
995
|
+
* cloudflare` AND a 403, 429 or 503. A 200 challenge is caught by the
|
|
996
|
+
* header, which Cloudflare sets on all challenge types.
|
|
997
|
+
* - Vercel. A challenged visitor sees the "Vercel Security Checkpoint" screen:
|
|
998
|
+
* https://vercel.com/docs/vercel-firewall/firewall-concepts#challenge
|
|
999
|
+
* The page is localised, so the English title is a supplementary signal and
|
|
1000
|
+
* needs a non-2xx status and `server: Vercel`. The `x-vercel-mitigated:
|
|
1001
|
+
* challenge` header is not in Vercel's reference docs; it is what Vercel's
|
|
1002
|
+
* own community forum shows on challenged responses
|
|
1003
|
+
* (https://community.vercel.com/t/all-non-browser-requests-challenged-on-hobby-account-ddos-mitigation-false-positive/1000000130).
|
|
1004
|
+
* - DataDome. A blocking response carries the status DataDome's API returned
|
|
1005
|
+
* plus the mapped `X-DataDome` header:
|
|
1006
|
+
* https://docs.datadome.co/reference/validate-request
|
|
1007
|
+
* The header alone also appears on allowed responses, so it counts only
|
|
1008
|
+
* with a 401 or 403.
|
|
1009
|
+
* - HUMAN (PerimeterX). The block page renders a `px-captcha` element and sets
|
|
1010
|
+
* `window._pxAppId`:
|
|
1011
|
+
* https://docs.humansecurity.com/applications/advanced-blocking-response
|
|
1012
|
+
* Both markers are required, with a 403 or 429.
|
|
1013
|
+
*
|
|
1014
|
+
* NOT SHIPPED, because no vendor documentation confirmed a fingerprint:
|
|
1015
|
+
* Akamai Bot Manager (the `sec-cpt`/428 behaviour is described only by third
|
|
1016
|
+
* parties) and Imperva (the "Incapsula incident ID" page and `x-iinfo` header
|
|
1017
|
+
* are described only by third parties and Imperva's community forum). Those
|
|
1018
|
+
* still surface as an HTTP 403 block, exactly as before.
|
|
1019
|
+
*/
|
|
1020
|
+
|
|
1021
|
+
type EdgeChallengeVendor = 'cloudflare' | 'vercel' | 'datadome' | 'human';
|
|
1022
|
+
declare const EDGE_CHALLENGE_VENDOR_LABEL: Readonly<Record<EdgeChallengeVendor, string>>;
|
|
1023
|
+
interface EdgeChallenge {
|
|
1024
|
+
vendor: EdgeChallengeVendor;
|
|
1025
|
+
/** The observation that matched, e.g. `cf-mitigated: challenge`. */
|
|
1026
|
+
signal: string;
|
|
1027
|
+
status: number;
|
|
1028
|
+
}
|
|
1029
|
+
/** The slice of a response the detector reads. `ArsHttpCapture` satisfies it. */
|
|
1030
|
+
interface ChallengeInput {
|
|
1031
|
+
status: number;
|
|
1032
|
+
headers: Readonly<Record<string, readonly string[]>>;
|
|
1033
|
+
body?: string | null;
|
|
1034
|
+
requestedUrl?: string;
|
|
1035
|
+
finalUrl?: string;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* The documented challenge fingerprints, most specific first. Returns null for
|
|
1039
|
+
* an ordinary response, including an ordinary 403: a block without a
|
|
1040
|
+
* recognised challenge stays a block. Also handles `/robots.txt` responses
|
|
1041
|
+
* cleanly (case-insensitive headers, never flagging plain-text `Disallow:`
|
|
1042
|
+
* lines, and recognising HTML challenge pages served at `/robots.txt`).
|
|
1043
|
+
*/
|
|
1044
|
+
declare function detectEdgeChallenge(input: ChallengeInput): EdgeChallenge | null;
|
|
1045
|
+
/**
|
|
1046
|
+
* The probe records a challenge as `{ ok: false, error: 'challenge', detail }`.
|
|
1047
|
+
* `detail` is this fixed, parseable line, so a consumer can name the vendor
|
|
1048
|
+
* without the bundle carrying the challenge page itself.
|
|
1049
|
+
*/
|
|
1050
|
+
declare function challengeDetail(challenge: EdgeChallenge): string;
|
|
1051
|
+
declare function parseChallengeDetail(detail: unknown): EdgeChallenge | null;
|
|
1052
|
+
/**
|
|
1053
|
+
* The challenge the AGENT probe met, if any. Accepts `unknown` so callers that
|
|
1054
|
+
* only hold a structural slice of the bundle (the API's seam types) can ask.
|
|
1055
|
+
*/
|
|
1056
|
+
declare function edgeChallengeOf(evidence: unknown): EdgeChallenge | null;
|
|
1057
|
+
/**
|
|
1058
|
+
* The challenge the `/robots.txt` probe met, if any — inspecting either a
|
|
1059
|
+
* recorded `challenge` probe error or the captured `/robots.txt` response.
|
|
1060
|
+
*/
|
|
1061
|
+
declare function robotsEdgeChallengeOf(evidence: unknown): EdgeChallenge | null;
|
|
1062
|
+
type ContentSignalValue = 'yes' | 'no' | (string & {});
|
|
1063
|
+
interface ContentSignalRule {
|
|
1064
|
+
/** User-agent tokens in the enclosing group (lowercased); empty if global. */
|
|
1065
|
+
readonly agents: readonly string[];
|
|
1066
|
+
/** Raw trimmed value after `Content-signal:`. */
|
|
1067
|
+
readonly raw: string;
|
|
1068
|
+
/** Parsed lowercased `key=value` pairs (e.g. `{ search: 'yes', 'ai-train': 'no' }`). */
|
|
1069
|
+
readonly signals: Readonly<Record<string, ContentSignalValue>>;
|
|
1070
|
+
}
|
|
1071
|
+
interface ContentSignalsReport {
|
|
1072
|
+
/** True when at least one `Content-signal:` directive was found. */
|
|
1073
|
+
readonly present: boolean;
|
|
1074
|
+
/** True when `# BEGIN Cloudflare Managed content` appears in robots.txt. */
|
|
1075
|
+
readonly cloudflareManaged: boolean;
|
|
1076
|
+
/** All parsed `Content-signal:` rules in source order. */
|
|
1077
|
+
readonly rules: readonly ContentSignalRule[];
|
|
1078
|
+
/** Effective wildcard (`*`) or global summary for the three standard signals. */
|
|
1079
|
+
readonly summary: {
|
|
1080
|
+
readonly search: ContentSignalValue | null;
|
|
1081
|
+
readonly aiInput: ContentSignalValue | null;
|
|
1082
|
+
readonly aiTrain: ContentSignalValue | null;
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Parses `Content-signal:` directives (e.g. Cloudflare Managed `robots.txt`
|
|
1087
|
+
* `Content-signal: search=yes, ai-train=no`) and detects the Cloudflare
|
|
1088
|
+
* Managed content block marker. Pure, unscored, never read by `score()`.
|
|
1089
|
+
*/
|
|
1090
|
+
declare function parseContentSignals(robotsTxt: string): ContentSignalsReport;
|
|
1091
|
+
interface NoindexDirective {
|
|
1092
|
+
/** `robots` for the generic directive, otherwise the crawler token named. */
|
|
1093
|
+
agent: string;
|
|
1094
|
+
source: 'meta' | 'header';
|
|
1095
|
+
value: string;
|
|
1096
|
+
}
|
|
1097
|
+
type RestrictedRobotsDirectiveKind = 'nosnippet' | 'max-snippet:0' | 'noai' | 'noimageai';
|
|
1098
|
+
interface RobotsRestrictionDirective {
|
|
1099
|
+
/** `robots` for the generic directive, otherwise the crawler token named. */
|
|
1100
|
+
agent: string;
|
|
1101
|
+
source: 'meta' | 'header';
|
|
1102
|
+
directive: RestrictedRobotsDirectiveKind;
|
|
1103
|
+
value: string;
|
|
1104
|
+
}
|
|
1105
|
+
interface CanonicalDeclaration {
|
|
1106
|
+
source: 'header' | 'html';
|
|
1107
|
+
url: string;
|
|
1108
|
+
}
|
|
1109
|
+
interface PageIndexSignals {
|
|
1110
|
+
status: number;
|
|
1111
|
+
finalUrl: string;
|
|
1112
|
+
redirected: boolean;
|
|
1113
|
+
/** Every `noindex`/`none` directive found, generic and agent-specific. */
|
|
1114
|
+
noindex: NoindexDirective[];
|
|
1115
|
+
/** Absolute canonical address the page declares, or null. */
|
|
1116
|
+
canonical: string | null;
|
|
1117
|
+
/** Every `nosnippet`, `max-snippet:0`, `noai`, or `noimageai` directive found. */
|
|
1118
|
+
restrictions: RobotsRestrictionDirective[];
|
|
1119
|
+
/** True when any `nosnippet` directive was found. */
|
|
1120
|
+
nosnippet: boolean;
|
|
1121
|
+
/** True when any `max-snippet:0` directive was found. */
|
|
1122
|
+
maxSnippetZero: boolean;
|
|
1123
|
+
/** True when any `noai` directive was found. */
|
|
1124
|
+
noai: boolean;
|
|
1125
|
+
/** True when any `noimageai` directive was found. */
|
|
1126
|
+
noimageai: boolean;
|
|
1127
|
+
/** Every resolved canonical declaration across HTTP `Link` headers and HTML `<link>` tags. */
|
|
1128
|
+
canonicals: CanonicalDeclaration[];
|
|
1129
|
+
/** True when more than one HTML `<link rel="canonical">` or HTTP `Link` canonical header was sent. */
|
|
1130
|
+
duplicateCanonical: boolean;
|
|
1131
|
+
/** True when canonical declarations disagree on their resolved URL (HTML vs HTML or HTTP vs HTML). */
|
|
1132
|
+
conflictingCanonical: boolean;
|
|
1133
|
+
/** True when HTTP 402 Payment Required (e.g. Pay-Per-Crawl) was observed. */
|
|
1134
|
+
payPerCrawl: boolean;
|
|
1135
|
+
}
|
|
1136
|
+
/** Index signals of one response. Pure; reads headers and, when present, the HTML. */
|
|
1137
|
+
declare function indexSignalsOf(capture: ArsHttpCapture): PageIndexSignals;
|
|
1138
|
+
/**
|
|
1139
|
+
* The page's index signals from a probe bundle: the browser control first (it
|
|
1140
|
+
* asked for HTML, which is where `<meta name="robots">` lives), the agent probe
|
|
1141
|
+
* otherwise. Null when neither probe returned a response.
|
|
1142
|
+
*/
|
|
1143
|
+
declare function pageIndexSignals(evidence: ArsEvidence): PageIndexSignals | null;
|
|
1144
|
+
type SpaJsDependencyReason = 'empty-mount-root' | 'noscript-js-required' | 'unrendered-next-payload' | 'low-text-vs-script';
|
|
1145
|
+
interface SpaJsDependencyReport {
|
|
1146
|
+
/** True when static HTML heuristics indicate a JS-dependent SPA shell. */
|
|
1147
|
+
readonly likelySpaShell: boolean;
|
|
1148
|
+
/** Specific heuristic signals that fired. */
|
|
1149
|
+
readonly reasons: readonly SpaJsDependencyReason[];
|
|
1150
|
+
/** Empty SPA mount roots found (e.g. `['#root']`, `['#__next']`). */
|
|
1151
|
+
readonly emptyMountRoots: readonly string[];
|
|
1152
|
+
/** True when `<noscript>` carries a boilerplate JavaScript-required message. */
|
|
1153
|
+
readonly jsRequiredNoscript: boolean;
|
|
1154
|
+
/** Matched `<noscript>` text snippet, or null. */
|
|
1155
|
+
readonly noscriptSnippet: string | null;
|
|
1156
|
+
/** True when `<script id="__NEXT_DATA__">` is present. */
|
|
1157
|
+
readonly hasNextData: boolean;
|
|
1158
|
+
/** True when Next.js RSC flight chunks (`__next_f`) appear in inline scripts. */
|
|
1159
|
+
readonly hasNextFlight: boolean;
|
|
1160
|
+
/** Combined UTF-8 bytes of Next.js hydration payloads (`__NEXT_DATA__` / `__next_f`). */
|
|
1161
|
+
readonly hydrationPayloadBytes: number;
|
|
1162
|
+
/** True when Next.js hydration payload appears to carry unrendered page content. */
|
|
1163
|
+
readonly unrenderedHydrationPayload: boolean;
|
|
1164
|
+
/** Visible body word count (excluding `<title>`, `<noscript>`, `<script>`, `<style>`, hidden). */
|
|
1165
|
+
readonly visibleWordCount: number;
|
|
1166
|
+
/** UTF-8 byte length of visible body text. */
|
|
1167
|
+
readonly visibleTextBytes: number;
|
|
1168
|
+
/** Total UTF-8 byte length of non-JSON-LD inline `<script>` contents. */
|
|
1169
|
+
readonly scriptBytes: number;
|
|
1170
|
+
/** Number of external `<script src="...">` tags. */
|
|
1171
|
+
readonly externalScriptCount: number;
|
|
1172
|
+
/** Ratio of inline script bytes to visible text bytes, or `null` when visible text is empty and scripts exist. */
|
|
1173
|
+
readonly scriptToTextRatio: number | null;
|
|
1174
|
+
/** True when visible word count is low relative to script payload. */
|
|
1175
|
+
readonly lowTextToScriptRatio: boolean;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Static HTML heuristics for client-side SPA shells and JS-only rendering:
|
|
1179
|
+
* empty `#root`/`#app`/`#__next` mount roots, boilerplate JS-required
|
|
1180
|
+
* `<noscript>` notices, Next.js `__NEXT_DATA__`/`__next_f` unrendered payload
|
|
1181
|
+
* clues, and low visible word count relative to script bytes. Pure, non-executing,
|
|
1182
|
+
* unscored.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function detectSpaJsDependency(html: string): SpaJsDependencyReport;
|
|
1185
|
+
declare const SAAS_QUOTA_UNITS: readonly ["seats", "users", "projects", "pages", "sites", "requests", "tokens", "credits", "calls", "events", "contacts", "workspaces", "domains", "rows"];
|
|
1186
|
+
type SaasQuotaUnit = (typeof SAAS_QUOTA_UNITS)[number];
|
|
1187
|
+
interface PricingAuditJsonLdNode {
|
|
1188
|
+
readonly types: readonly string[];
|
|
1189
|
+
readonly value: Readonly<Record<string, unknown>>;
|
|
1190
|
+
}
|
|
1191
|
+
interface PricingAndLimitsAudit {
|
|
1192
|
+
/** Number of schema.org `Offer` nodes found in JSON-LD. */
|
|
1193
|
+
readonly jsonLdOfferCount: number;
|
|
1194
|
+
/** Number of schema.org `Offer` nodes declaring a price or priceSpecification. */
|
|
1195
|
+
readonly jsonLdPricedOfferCount: number;
|
|
1196
|
+
/** Estimated number of visible pricing tiers in server HTML. */
|
|
1197
|
+
readonly visibleTierCount: number;
|
|
1198
|
+
/** Total visible currency price occurrences found in server HTML. */
|
|
1199
|
+
readonly visiblePriceCount: number;
|
|
1200
|
+
/** True when a feature comparison table contains icon-only SVG/empty-text cells. */
|
|
1201
|
+
readonly iconOnlyFeatureMatrix: boolean;
|
|
1202
|
+
/** Count of icon-only / empty-text cells inside comparison tables. */
|
|
1203
|
+
readonly iconOnlyCellCount: number;
|
|
1204
|
+
/** True when server HTML includes a monthly/annual billing toggle hint. */
|
|
1205
|
+
readonly hasBillingToggleHint: boolean;
|
|
1206
|
+
/** True when a billing toggle hint is present but only one billing period appears in server HTML. */
|
|
1207
|
+
readonly billingToggleSinglePeriodOnly: boolean;
|
|
1208
|
+
/** Distinct billing cadences extracted from visible text (e.g. '/mo', '/yr', 'per seat', 'billed annually'). */
|
|
1209
|
+
readonly billingCadences: readonly string[];
|
|
1210
|
+
/** Total quantified SaaS feature-limit mentions across the 14 canonical quota units. */
|
|
1211
|
+
readonly featureLimitCount: number;
|
|
1212
|
+
/** Per-unit counts for detected SaaS feature-limit quotas. */
|
|
1213
|
+
readonly featureLimitUnits: Readonly<Partial<Record<SaasQuotaUnit, number>>>;
|
|
1214
|
+
/** Distinct canonical quota units detected. */
|
|
1215
|
+
readonly detectedQuotaUnits: readonly SaasQuotaUnit[];
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Multi-tier SaaS pricing & feature-limit auditor over server HTML and JSON-LD.
|
|
1219
|
+
* Pure, non-executing, unscored: inspects Offer coverage, visible tiers,
|
|
1220
|
+
* icon-only comparison matrix cells, single-period billing toggle hints,
|
|
1221
|
+
* billing cadences, and quantified SaaS feature-limit quota units.
|
|
1222
|
+
*/
|
|
1223
|
+
declare function auditPricingAndLimits(html: string, jsonLdNodes?: readonly PricingAuditJsonLdNode[]): PricingAndLimitsAudit;
|
|
1224
|
+
interface DeclaredPageFacts {
|
|
1225
|
+
/** The modified date the page itself states (ISO 8601), or null. */
|
|
1226
|
+
updated: string | null;
|
|
1227
|
+
/** Where each price the page states was found; empty when no price was readable. */
|
|
1228
|
+
priceSources: ArsFactSource[];
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* The extractor's own `updated` and `price` facts, read with a profile that asks
|
|
1232
|
+
* for exactly those two, whatever kind the page was classified as. `score()`
|
|
1233
|
+
* extracts against the page kind's profile (an `unknown` page never yields a
|
|
1234
|
+
* price), so these values are taken separately and never feed a score.
|
|
1235
|
+
*/
|
|
1236
|
+
declare function declaredPageFacts(evidence: ArsEvidence): DeclaredPageFacts | null;
|
|
1237
|
+
|
|
1238
|
+
export { ARS_CORPUS_HASH, ARS_HEURISTIC_WEIGHT, ARS_HEURISTIC_WEIGHT_CEILING, ARS_MEASURED_WEIGHT, ArsAudienceDecision, ArsBand, ArsBasis, type ArsCheckMeta, type ArsClassification, ArsDimensionId, ArsEvidence, ArsFactObservation, ArsFactProfile, ArsHttpCapture, ArsPageKind, type ArsPass1Signals, ArsRecommendation, type ArsRecommendationInput, ArsResult, ArsRuleset, CHECK_META, type CanonicalDeclaration, type ChallengeInput, type ContentSignalRule, type ContentSignalValue, type ContentSignalsReport, DEFAULT_RULESET, DIMENSION_META, type DeclaredPageFacts, EDGE_CHALLENGE_VENDOR_LABEL, type EdgeChallenge, type EdgeChallengeVendor, type Money, type MoneyHints, type NoindexDirective, PROFILES, type PageIndexSignals, type ParsedMoney, type PricingAndLimitsAudit, type PricingAuditJsonLdNode, type RestrictedRobotsDirectiveKind, type RobotsRestrictionDirective, SAAS_QUOTA_UNITS, SUBPOINTS, type SaasQuotaUnit, type SpaJsDependencyReason, type SpaJsDependencyReport, auditPricingAndLimits, bandFor, canonicalJson, challengeDetail, classify, decideRobots, declaredMarkdownAlternates, declaredPageFacts, detectEdgeChallenge, detectSpaJsDependency, edgeChallengeOf, evidenceHash, indexSignalsOf, isMachineCopy, markdownAlternateTarget, minorUnitDigits, pageIndexSignals, parseChallengeDetail, parseContentSignals, parseMoneyText, parseRobots, pathMatches, profileFor, recommend, robotsEdgeChallengeOf, rulesetHash, score, sha256Hex, utf8Length };
|