@rebilder/agent-readability 0.1.1 → 0.2.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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/types.ts
2
- var ARS_SPEC_VERSION = "0.1.0";
2
+ var ARS_SPEC_VERSION = "0.2.0";
3
3
 
4
4
  // src/profiles.ts
5
5
  var PROFILE_BY_KIND = {
@@ -64,13 +64,13 @@ function deepFreeze(value) {
64
64
  return Object.freeze(value);
65
65
  }
66
66
  var WEIGHTS = {
67
- // D1 Retrievability — 20
68
- "retrievability.reachable": 8,
69
- "retrievability.robots-policy": 6,
70
- "retrievability.render-independence": 6,
71
- // D2 Machine representation — 20
72
- "machine-representation.negotiated-response": 10,
73
- "machine-representation.declared-alternates": 4,
67
+ // D1 Retrievability — 28
68
+ "retrievability.reachable": 11,
69
+ "retrievability.robots-policy": 10,
70
+ "retrievability.render-independence": 7,
71
+ // D2 Machine representation — 18
72
+ "machine-representation.negotiated-response": 9,
73
+ "machine-representation.declared-alternates": 3,
74
74
  "machine-representation.vary-accept": 3,
75
75
  "machine-representation.substance-parity": 3,
76
76
  // D3 Fact coverage — 20
@@ -79,16 +79,20 @@ var WEIGHTS = {
79
79
  // D4 Fact position — 10
80
80
  "fact-position.first-core-fact-offset": 5,
81
81
  "fact-position.front-window": 5,
82
- // D5 Structured data — 15
83
- "structured-data.present": 5,
84
- "structured-data.required-properties": 7,
85
- "structured-data.text-agreement": 3,
86
- // D6 Contract & discovery — 15
82
+ // D5 Structured data — 6
83
+ "structured-data.present": 2,
84
+ "structured-data.required-properties": 3,
85
+ "structured-data.text-agreement": 1,
86
+ // D6 Contract & discovery — 10
87
87
  "contract-discovery.canonical": 4,
88
- "contract-discovery.cache-validators": 3,
89
- "contract-discovery.llms-txt": 2,
90
- "contract-discovery.sitemap": 2,
91
- "contract-discovery.machine-endpoint": 4
88
+ "contract-discovery.cache-validators": 2,
89
+ "contract-discovery.llms-txt": 1,
90
+ "contract-discovery.sitemap": 1,
91
+ "contract-discovery.machine-endpoint": 2,
92
+ // D7 Evidence density — 8
93
+ "evidence-density.quantities": 4,
94
+ "evidence-density.definitions": 2,
95
+ "evidence-density.comparisons": 2
92
96
  };
93
97
  var CHECK_META = {
94
98
  "retrievability.reachable": {
@@ -185,18 +189,34 @@ var CHECK_META = {
185
189
  dimension: "contract-discovery",
186
190
  label: "Declared machine endpoint",
187
191
  basis: "measured"
192
+ },
193
+ "evidence-density.quantities": {
194
+ dimension: "evidence-density",
195
+ label: "Quantities an answer can quote",
196
+ basis: "measured"
197
+ },
198
+ "evidence-density.definitions": {
199
+ dimension: "evidence-density",
200
+ label: "Labelled term and value pairs",
201
+ basis: "heuristic"
202
+ },
203
+ "evidence-density.comparisons": {
204
+ dimension: "evidence-density",
205
+ label: "Comparable rows",
206
+ basis: "measured"
188
207
  }
189
208
  };
190
209
  var DIMENSION_META = {
191
- retrievability: { label: "Retrievability", weight: 20 },
192
- "machine-representation": { label: "Machine representation", weight: 20 },
210
+ retrievability: { label: "Retrievability", weight: 28 },
211
+ "machine-representation": { label: "Machine representation", weight: 18 },
193
212
  "fact-coverage": { label: "Fact coverage", weight: 20 },
194
213
  "fact-position": { label: "Fact position", weight: 10 },
195
- "structured-data": { label: "Structured data", weight: 15 },
196
- "contract-discovery": { label: "Contract & discovery", weight: 15 }
214
+ "structured-data": { label: "Structured data", weight: 6 },
215
+ "contract-discovery": { label: "Contract & discovery", weight: 10 },
216
+ "evidence-density": { label: "Evidence density", weight: 8 }
197
217
  };
198
- var ARS_MEASURED_WEIGHT = 64;
199
- var ARS_HEURISTIC_WEIGHT = 36;
218
+ var ARS_MEASURED_WEIGHT = 63;
219
+ var ARS_HEURISTIC_WEIGHT = 37;
200
220
  var ARS_HEURISTIC_WEIGHT_CEILING = 40;
201
221
  var THRESHOLDS = {
202
222
  /**
@@ -228,6 +248,31 @@ var THRESHOLDS = {
228
248
  * `ratio = 100 × bytes / byteReference[pageKind]`; above the last threshold, 0.
229
249
  */
230
250
  "fact-coverage.context-cost": [100, 6, 200, 5, 500, 3, 1500, 1],
251
+ /**
252
+ * D7.1 quantities, 4 pts. AT-LEAST over the count of DISTINCT quantity tokens
253
+ * in the agent's counted text: a currency amount, a percentage, a number
254
+ * carrying a unit, or an ISO date. Distinct, because a price repeated in a
255
+ * header, a buy box and a footer is one fact stated three times, and counting
256
+ * it three times would reward the repetition this score exists to discourage.
257
+ * Saturates at 12 so a specification table cannot outscore a page that simply
258
+ * states its facts.
259
+ */
260
+ "evidence-density.quantities": [12, 4, 6, 3, 3, 2, 1, 1],
261
+ /**
262
+ * D7.2 definitions, 2 pts. AT-LEAST over the count of `term: value` pairs the
263
+ * agent can read as a labelled fact, counting markdown bold-label lines,
264
+ * list items with a leading label, and HTML definition lists.
265
+ */
266
+ "evidence-density.definitions": [6, 2, 2, 1],
267
+ /**
268
+ * D7.3 comparisons, 2 pts. AT-LEAST over the number of comparable ROWS: a
269
+ * table with at least two data columns contributes its data-row count, minus
270
+ * the header. One row is not a comparison, so the band starts at two; three
271
+ * options laid side by side is a full comparison and pays out. Calibrated
272
+ * against fixture `060`, where a three-row size table is exactly the shape
273
+ * this check exists to reward, and `063`, where one row is not.
274
+ */
275
+ "evidence-density.comparisons": [3, 2, 2, 1],
231
276
  /** D4.1 first-core-fact byte offset, 5 pts. AT-MOST over the offset in bytes; else 0. */
232
277
  "fact-position.first-core-fact-offset": [512, 5, 2048, 4, 8192, 2, 32768, 1],
233
278
  /**
@@ -368,7 +413,7 @@ var BANDS = [
368
413
  }
369
414
  ];
370
415
  var DEFAULT_RULESET = deepFreeze({
371
- version: "0.1.0",
416
+ version: "0.2.0",
372
417
  weights: WEIGHTS,
373
418
  thresholds: THRESHOLDS,
374
419
  audienceTokens: AUDIENCE_TOKENS,
@@ -2834,7 +2879,7 @@ var TEMPLATES = [
2834
2879
  id: "publish-llms-txt",
2835
2880
  title: "Publish /llms.txt",
2836
2881
  effort: "config",
2837
- detail: "An H1 title, a short summary, and links to the pages that matter. It is worth 2 points of 100, deliberately: content negotiation is the mechanism that measurably improves retrieval, and we have observed no citation lift from llms.txt alone.",
2882
+ detail: "An H1 title, a short summary, and links to the pages that matter. It is worth 1 point of 100, deliberately: content negotiation is the mechanism that measurably improves retrieval, and we have observed no citation lift from llms.txt alone.",
2838
2883
  checks: ["contract-discovery.llms-txt"],
2839
2884
  unlocks: NO_UNLOCKS
2840
2885
  },
@@ -2853,6 +2898,30 @@ var TEMPLATES = [
2853
2898
  detail: "A feed, an OpenAPI document, /.well-known/ucp \u2014 anything an agent can call \u2014 declared with a `Link` header or a `<link>`. ARS probes /robots.txt, /llms.txt and /.well-known/ucp and guesses at no other path.",
2854
2899
  checks: ["contract-discovery.machine-endpoint"],
2855
2900
  unlocks: NO_UNLOCKS
2901
+ },
2902
+ {
2903
+ id: "state-quantities",
2904
+ title: "State the numbers in text",
2905
+ effort: "template",
2906
+ detail: "Price, sizes, weights, hours, fees, lead times, dates \u2014 written out where an agent reads them, not left in an image or implied by a paragraph. An assistant builds a cited answer out of quantities it can lift; distinct ones count, so saying the same price three times is one number.",
2907
+ checks: ["evidence-density.quantities"],
2908
+ unlocks: NO_UNLOCKS
2909
+ },
2910
+ {
2911
+ id: "label-facts",
2912
+ title: "Label each fact with its term",
2913
+ effort: "template",
2914
+ detail: 'A line that reads "Returns: 60 days" travels whole into an answer. The same fact inside a sentence has to be inferred, and an assistant that has to infer it usually leaves it out. Specification lists, definition lists and labelled bullets all count.',
2915
+ checks: ["evidence-density.definitions"],
2916
+ unlocks: NO_UNLOCKS
2917
+ },
2918
+ {
2919
+ id: "add-comparison-rows",
2920
+ title: "Put the options side by side",
2921
+ effort: "template",
2922
+ detail: "Sizes, tiers, models, plans \u2014 one row each, in a table with at least two columns. One row states a fact; two or more let an assistant contrast them, which is the question people actually ask it.",
2923
+ checks: ["evidence-density.comparisons"],
2924
+ unlocks: NO_UNLOCKS
2856
2925
  }
2857
2926
  ];
2858
2927
  var EFFORT_ORDER = ["config", "template", "engineering"];
@@ -2956,44 +3025,50 @@ function deepFreeze2(value) {
2956
3025
  return Object.freeze(value);
2957
3026
  }
2958
3027
  var SUBPOINTS = deepFreeze2({
2959
- /** D1.1, 8 = 4 + 2 + 2. */
2960
- reachable: { status2xx: 4, withinRedirectLimit: 2, noAcceptConditionalRedirect: 2 },
2961
- /** D1.2, 6 = 3 + 1 + 1 + 1. A disallowed assistant audience scores 0 for all four (§3.7). */
2962
- robotsPolicy: { assistantAllowed: 3, parsesClean: 1, noOrphanRules: 1, sitemapDeclared: 1 },
3028
+ /** D1.1, 11 = 5 + 3 + 3. */
3029
+ reachable: { status2xx: 5, withinRedirectLimit: 3, noAcceptConditionalRedirect: 3 },
3030
+ /** D1.2, 10 = 6 + 2 + 1 + 1. A disallowed assistant audience scores 0 for all four (§3.7). */
3031
+ robotsPolicy: { assistantAllowed: 6, parsesClean: 2, noOrphanRules: 1, sitemapDeclared: 1 },
2963
3032
  /**
2964
- * D1.3, 6. AT-LEAST band over `100 × coreFactsInHtml / coreProfileSize`, plus
3033
+ * D1.3, 7. AT-LEAST band over `100 × coreFactsInHtml / coreProfileSize`, plus
2965
3034
  * the `<noscript>` floor: a page whose facts are all client-rendered but which
2966
3035
  * ships a non-empty `<noscript>` has told a JS-less caller something, and §3.8
2967
3036
  * says that earns partial credit.
2968
3037
  */
2969
3038
  renderIndependence: {
2970
- band: [100, 6, 75, 5, 50, 3, 25, 1],
3039
+ band: [100, 7, 75, 5, 50, 3, 25, 1],
2971
3040
  noscriptFloor: 1
2972
3041
  },
2973
- /** D2.1, 10. All-or-nothing: a machine media type AND a body that is not HTML. */
2974
- negotiatedResponse: { full: 10 },
2975
- /** D2.2, 4. All-or-nothing. */
2976
- declaredAlternates: { full: 4 },
3042
+ /** D2.1, 9. All-or-nothing: a machine media type AND a body that is not HTML. */
3043
+ negotiatedResponse: { full: 9 },
3044
+ /** D2.2, 3. All-or-nothing. */
3045
+ declaredAlternates: { full: 3 },
2977
3046
  /** D2.3, 3. All-or-nothing, and 0 unless D2.1 > 0. */
2978
3047
  varyAccept: { full: 3 },
2979
3048
  /** D2.4, 3. All-or-nothing, and 0 unless D2.1 > 0 and a browser capture exists. */
2980
3049
  substanceParity: { full: 3 },
2981
- /** D5.1, 5. Structured data present AND parsing; a partly-broken graph scores 3. */
2982
- structuredDataPresent: { clean: 5, partial: 3 },
2983
- /** D5.2, 7 = 2 (a recognised type) + 5 (required-property completeness, scaled). */
2984
- requiredProperties: { recognisedType: 2, completeness: 5 },
2985
- /** D5.3, 3. All-or-nothing. */
2986
- textAgreement: { full: 3 },
3050
+ /** D5.1, 2. Structured data present AND parsing; a partly-broken graph scores 1. */
3051
+ structuredDataPresent: { clean: 2, partial: 1 },
3052
+ /** D5.2, 3 = 1 (a recognised type) + 2 (required-property completeness, scaled). */
3053
+ requiredProperties: { recognisedType: 1, completeness: 2 },
3054
+ /** D5.3, 1. All-or-nothing. */
3055
+ textAgreement: { full: 1 },
2987
3056
  /** D6.1, 4 = 2 + 1 + 1. */
2988
3057
  canonical: { present: 2, absolute: 1, consistentAcrossProbes: 1 },
2989
- /** D6.2, 3 = 2 + 1. */
2990
- cacheValidators: { saneCacheControl: 2, validator: 1 },
2991
- /** D6.3, 2. `present` alone for a file that exists; `specShaped` for one that parses as llms.txt. */
2992
- llmsTxt: { present: 1, specShaped: 2 },
2993
- /** D6.4, 2. All-or-nothing. */
2994
- sitemap: { full: 2 },
2995
- /** D6.5, 4. All-or-nothing over any ONE declared machine endpoint. */
2996
- machineEndpoint: { full: 4 }
3058
+ /** D6.2, 2 = 1 + 1. */
3059
+ cacheValidators: { saneCacheControl: 1, validator: 1 },
3060
+ /**
3061
+ * D6.3, 1. `specShaped` — an H1 and at least one Markdown link — is the whole
3062
+ * point. `present` is 0 in 0.2: at two points 0.1 could pay one for the file
3063
+ * existing and one for it being usable, but at one point that split would make
3064
+ * "exists" and "usable" score identically, which is a distinction the standard
3065
+ * would then be printing a remedy for and paying nothing to fix.
3066
+ */
3067
+ llmsTxt: { present: 0, specShaped: 1 },
3068
+ /** D6.4, 1. All-or-nothing. */
3069
+ sitemap: { full: 1 },
3070
+ /** D6.5, 2. All-or-nothing over any ONE declared machine endpoint. */
3071
+ machineEndpoint: { full: 2 }
2997
3072
  });
2998
3073
  var SHA256_K = [
2999
3074
  1116352408,
@@ -3179,7 +3254,7 @@ function evidenceHash(evidence) {
3179
3254
  })
3180
3255
  );
3181
3256
  }
3182
- var ARS_CORPUS_HASH = sha256Hex("ars-0.1-corpus-unfrozen");
3257
+ var ARS_CORPUS_HASH = sha256Hex("ars-0.2-corpus-unfrozen");
3183
3258
  function parseLinkHeaders(values) {
3184
3259
  const out = [];
3185
3260
  for (const value of values) {
@@ -3646,6 +3721,105 @@ function checkContextCost(context) {
3646
3721
  remedy: earned === full ? void 0 : "Serve a representation sized to the facts. The reference is what a page of this kind reasonably costs, not an absolute budget."
3647
3722
  };
3648
3723
  }
3724
+ var QUANTITY = new RegExp(
3725
+ [
3726
+ String.raw`[$£€¥]\s?\d[\d,]*(?:\.\d+)?`,
3727
+ String.raw`\d[\d,]*(?:\.\d+)?\s?%`,
3728
+ String.raw`\d[\d,]*(?:\.\d+)?\s?(?:kg|g|lb|lbs|oz|mm|cm|m|km|mi|in|ft|ml|l|kb|mb|gb|tb|hz|w|kw|v|°c|°f|hours?|hrs?|minutes?|mins?|seconds?|secs?|days?|weeks?|months?|years?)\b`,
3729
+ String.raw`\d{4}-\d{2}-\d{2}`
3730
+ ].join("|"),
3731
+ "giu"
3732
+ );
3733
+ var DEFINITION_LINE = /^\s*(?:[-*+]\s+)?(?:\*\*)?[A-Za-z][A-Za-z0-9 /&'()-]{1,40}(?:\*\*)?\s*:\s*\S/;
3734
+ var LABELLED_BLOCK_TAGS = /* @__PURE__ */ new Set(["li", "dt", "dd", "p", "td", "th", "div"]);
3735
+ function checkQuantities(context) {
3736
+ const table = context.ruleset.thresholds["evidence-density.quantities"];
3737
+ const seen = /* @__PURE__ */ new Set();
3738
+ for (const match of context.agent.text.matchAll(QUANTITY)) {
3739
+ seen.add(match[0].toLowerCase().replace(/\s+/g, ""));
3740
+ }
3741
+ const count = seen.size;
3742
+ const earned = atLeast(table, count);
3743
+ const full = atLeast(table, Number.MAX_SAFE_INTEGER);
3744
+ return {
3745
+ earned,
3746
+ evidence: [measured("Distinct quantities an answer could quote", `${count}`)],
3747
+ remedy: earned === full ? void 0 : "State the numbers a reader would ask for, in text: price, sizes, hours, fees, dates. A quantity an agent can lift is what a cited answer is built from."
3748
+ };
3749
+ }
3750
+ function labelledSegments(context) {
3751
+ const doc = context.agent.doc;
3752
+ if (doc === null) return context.agent.text.split("\n");
3753
+ const byElement = /* @__PURE__ */ new Map();
3754
+ for (const node of doc.texts) {
3755
+ if (node.excludedBy !== null) continue;
3756
+ if (node.text.trim().length === 0) continue;
3757
+ let at = node.parent;
3758
+ for (let hops = 0; at >= 0 && hops <= MAX_ANCESTOR_HOPS; hops += 1) {
3759
+ const element = doc.elements[at];
3760
+ if (element === void 0) break;
3761
+ if (LABELLED_BLOCK_TAGS.has(element.tag)) {
3762
+ const parts = byElement.get(at);
3763
+ if (parts === void 0) byElement.set(at, [node.text]);
3764
+ else parts.push(node.text);
3765
+ break;
3766
+ }
3767
+ at = element.parent;
3768
+ }
3769
+ }
3770
+ const segments = [];
3771
+ for (const parts of byElement.values()) {
3772
+ segments.push(parts.join(" ").replace(/\s+/g, " ").trim());
3773
+ }
3774
+ return segments;
3775
+ }
3776
+ var MAX_ANCESTOR_HOPS = 256;
3777
+ function checkDefinitions(context) {
3778
+ const table = context.ruleset.thresholds["evidence-density.definitions"];
3779
+ let count = 0;
3780
+ for (const line of labelledSegments(context)) {
3781
+ if (DEFINITION_LINE.test(line)) count += 1;
3782
+ }
3783
+ const earned = atLeast(table, count);
3784
+ const full = atLeast(table, Number.MAX_SAFE_INTEGER);
3785
+ return {
3786
+ earned,
3787
+ evidence: [heuristic("Labelled term and value pairs", `${count}`)],
3788
+ remedy: earned === full ? void 0 : 'Label your facts. A line that reads "Returns: 60 days" is liftable whole; the same fact inside a paragraph has to be inferred.'
3789
+ };
3790
+ }
3791
+ function checkComparisons(context) {
3792
+ const table = context.ruleset.thresholds["evidence-density.comparisons"];
3793
+ let rows = 0;
3794
+ const doc = context.agent.doc;
3795
+ if (doc !== null) {
3796
+ const cellsByRow = /* @__PURE__ */ new Map();
3797
+ for (const element of doc.elements) {
3798
+ if (element.tag !== "td" && element.tag !== "th") continue;
3799
+ const row = doc.elements[element.parent];
3800
+ if (row === void 0 || row.tag !== "tr") continue;
3801
+ cellsByRow.set(element.parent, (cellsByRow.get(element.parent) ?? 0) + 1);
3802
+ }
3803
+ for (const cells of cellsByRow.values()) if (cells >= 2) rows += 1;
3804
+ rows = Math.max(0, rows - 1);
3805
+ } else {
3806
+ let pipeRows = 0;
3807
+ for (const line of context.agent.text.split("\n")) {
3808
+ const trimmed = line.trim();
3809
+ if (!trimmed.startsWith("|") || !trimmed.endsWith("|")) continue;
3810
+ if (/^\|[\s:|-]+\|$/.test(trimmed)) continue;
3811
+ if (trimmed.split("|").length - 2 >= 2) pipeRows += 1;
3812
+ }
3813
+ rows = Math.max(0, pipeRows - 1);
3814
+ }
3815
+ const earned = atLeast(table, rows);
3816
+ const full = atLeast(table, Number.MAX_SAFE_INTEGER);
3817
+ return {
3818
+ earned,
3819
+ evidence: [measured("Comparable rows", `${rows}`)],
3820
+ remedy: earned === full ? void 0 : "Put options side by side in a table with a row each. An assistant comparing two things reaches for rows it can line up."
3821
+ };
3822
+ }
3649
3823
  function coreOffsets(context) {
3650
3824
  const offsets = [];
3651
3825
  for (const fact of context.facts)
@@ -3891,7 +4065,7 @@ function checkLlmsTxt(context) {
3891
4065
  return {
3892
4066
  earned: 0,
3893
4067
  evidence: [measured("/llms.txt", body === null ? "absent or non-2xx" : "empty")],
3894
- remedy: "Publish /llms.txt: an H1 title, a short summary, and links to the pages that matter. It is worth 2 points of 100, deliberately."
4068
+ remedy: "Publish /llms.txt: an H1 title, a short summary, and links to the pages that matter. It is worth 1 point of 100, deliberately."
3895
4069
  };
3896
4070
  }
3897
4071
  const hasTitle = /^#\s+\S/m.test(body);
@@ -4021,7 +4195,8 @@ var DIMENSION_ORDER = [
4021
4195
  "fact-coverage",
4022
4196
  "fact-position",
4023
4197
  "structured-data",
4024
- "contract-discovery"
4198
+ "contract-discovery",
4199
+ "evidence-density"
4025
4200
  ];
4026
4201
  function buildDimensions(checks) {
4027
4202
  return DIMENSION_ORDER.map((id) => {
@@ -4437,7 +4612,10 @@ function score(evidence, ruleset = DEFAULT_RULESET) {
4437
4612
  buildCheck(ruleset, "contract-discovery.cache-validators", checkCacheValidators(context)),
4438
4613
  buildCheck(ruleset, "contract-discovery.llms-txt", checkLlmsTxt(context)),
4439
4614
  buildCheck(ruleset, "contract-discovery.sitemap", checkSitemap(context)),
4440
- buildCheck(ruleset, "contract-discovery.machine-endpoint", checkMachineEndpoint(context))
4615
+ buildCheck(ruleset, "contract-discovery.machine-endpoint", checkMachineEndpoint(context)),
4616
+ buildCheck(ruleset, "evidence-density.quantities", checkQuantities(context)),
4617
+ buildCheck(ruleset, "evidence-density.definitions", checkDefinitions(context)),
4618
+ buildCheck(ruleset, "evidence-density.comparisons", checkComparisons(context))
4441
4619
  ];
4442
4620
  const dimensions = buildDimensions(checks);
4443
4621
  const total = dimensions.reduce((sum, dimension) => sum + dimension.earned, 0);
@@ -4516,6 +4694,33 @@ function decideScannerToken(robots, path) {
4516
4694
  return null;
4517
4695
  }
4518
4696
 
4519
- export { ARS_CORPUS_HASH, ARS_HEURISTIC_WEIGHT, ARS_HEURISTIC_WEIGHT_CEILING, ARS_MEASURED_WEIGHT, ARS_SPEC_VERSION, CHECK_META, DEFAULT_RULESET, DIMENSION_META, PROFILES, SUBPOINTS, bandFor, canonicalJson, classify, evidenceHash, minorUnitDigits, parseMoneyText, profileFor, recommend, rulesetHash, score, sha256Hex };
4697
+ // src/probe/headers.ts
4698
+ var AGENT_ACCEPT = "text/markdown;q=1.0, text/html;q=0.8, text/plain;q=0.5, */*;q=0.1";
4699
+ var BROWSER_ACCEPT = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
4700
+ var ASSET_ACCEPT = "text/plain,*/*;q=0.5";
4701
+
4702
+ // src/robots-policy.ts
4703
+ var ARS_ROBOTS_TOKEN = "rebilder-ars";
4704
+ function robotsDisallowsScanner(robotsBody, path) {
4705
+ const robots = parseRobots(robotsBody);
4706
+ for (const group of robots.groups) {
4707
+ if (!group.agents.some((agent) => agent.toLowerCase() === ARS_ROBOTS_TOKEN)) continue;
4708
+ let best = null;
4709
+ for (const value of group.allow) {
4710
+ if (!pathMatches(value, path)) continue;
4711
+ if (best === null || value.length > best.value.length) best = { field: "allow", value };
4712
+ }
4713
+ for (const value of group.disallow) {
4714
+ if (!pathMatches(value, path)) continue;
4715
+ if (best === null || value.length > best.value.length) best = { field: "disallow", value };
4716
+ }
4717
+ if (best !== null && best.field === "disallow") {
4718
+ return `User-agent: ${ARS_ROBOTS_TOKEN} / Disallow: ${best.value}`;
4719
+ }
4720
+ }
4721
+ return null;
4722
+ }
4723
+
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 };
4520
4725
  //# sourceMappingURL=index.js.map
4521
4726
  //# sourceMappingURL=index.js.map