literally-aeo 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/README.md +29 -1
  2. package/dist/author-tools.js +479 -397
  3. package/dist/cli.mjs +808 -386
  4. package/dist/lib/access/schema.js +6 -6
  5. package/dist/lib/agents/author-schema.js +10 -10
  6. package/dist/lib/agents/author-validation.js +20 -18
  7. package/dist/lib/agents/copy-validation.js +22 -21
  8. package/dist/lib/agents/copywriter-input.js +23 -8
  9. package/dist/lib/agents/facts.js +22 -7
  10. package/dist/lib/agents/narrative-facts.js +20 -2
  11. package/dist/lib/agents/verifier.js +25 -24
  12. package/dist/lib/analysis/domain-classifier.js +19 -20
  13. package/dist/lib/analysis/domain-labels.js +10 -10
  14. package/dist/lib/analysis/progress-schema.js +2 -2
  15. package/dist/lib/analysis/progress.js +18 -19
  16. package/dist/lib/analysis/retrieval.js +20 -3
  17. package/dist/lib/analysis/scoring.js +20 -3
  18. package/dist/lib/analysis/search-analyzer.js +19 -5
  19. package/dist/lib/analysis/sentiment.js +16 -17
  20. package/dist/lib/author/examples.js +11 -11
  21. package/dist/lib/bundle/contracts.js +14 -12
  22. package/dist/lib/bundle/export.js +27 -27
  23. package/dist/lib/bundle/isolation.js +2 -2
  24. package/dist/lib/bundle/journal.js +13 -13
  25. package/dist/lib/bundle/project-journal.js +17 -17
  26. package/dist/lib/bundle/project.js +25 -25
  27. package/dist/lib/bundle/read.js +28 -28
  28. package/dist/lib/bundle/recorder.js +15 -15
  29. package/dist/lib/bundle/redact.js +13 -13
  30. package/dist/lib/bundle/trace-coverage.js +13 -13
  31. package/dist/lib/bundle/verify-integrity.js +15 -15
  32. package/dist/lib/bundle/verify-measurement.js +21 -21
  33. package/dist/lib/bundle/verify-report.js +29 -29
  34. package/dist/lib/bundle/verify.js +37 -37
  35. package/dist/lib/capture-manifest.js +12 -12
  36. package/dist/lib/checks/crawler-access.js +4 -1
  37. package/dist/lib/checks/money-pages.js +13 -0
  38. package/dist/lib/checks/renderability.js +5 -1
  39. package/dist/lib/checks/run-checks.js +21 -18
  40. package/dist/lib/chunks/{chunk-BSRKN6FU.js → chunk-2FOKEIIN.js} +1 -1
  41. package/dist/lib/chunks/{chunk-JXMDOAKA.js → chunk-2KH7LNK7.js} +11 -11
  42. package/dist/lib/chunks/{chunk-D3GE3OCB.js → chunk-3CMPR6ZZ.js} +1 -1
  43. package/dist/lib/chunks/{chunk-TJQ5OPLQ.js → chunk-3OE4UQIB.js} +7 -7
  44. package/dist/lib/chunks/{chunk-Y4OGZ3Q5.js → chunk-46PVVQYR.js} +1 -1
  45. package/dist/lib/chunks/{chunk-OU73OUX4.js → chunk-4GLW3ZRO.js} +67 -7
  46. package/dist/lib/chunks/{chunk-EV4DRS5M.js → chunk-4XIAXX7K.js} +1 -1
  47. package/dist/lib/chunks/{chunk-IBOWGKN7.js → chunk-52F5XYOW.js} +1 -1
  48. package/dist/lib/chunks/{chunk-FFOVLI3U.js → chunk-66T7JC57.js} +12 -10
  49. package/dist/lib/chunks/{chunk-IE7NAL6B.js → chunk-6HMHXSCS.js} +2 -2
  50. package/dist/lib/chunks/chunk-75DMLOQ7.js +127 -0
  51. package/dist/lib/chunks/{chunk-6G25V4CF.js → chunk-7CW6U5WJ.js} +1 -1
  52. package/dist/lib/chunks/{chunk-CUYVHXHI.js → chunk-7DNLRXEY.js} +3 -3
  53. package/dist/lib/chunks/{chunk-622NMXN6.js → chunk-7HM6IZ3L.js} +2 -2
  54. package/dist/lib/chunks/{chunk-F4W5YHDZ.js → chunk-7WO3FFPS.js} +2 -2
  55. package/dist/lib/chunks/{chunk-ULRXHSJL.js → chunk-7YDXD4MD.js} +9 -6
  56. package/dist/lib/chunks/{chunk-UEMZYHYJ.js → chunk-7YZPEX3T.js} +2 -2
  57. package/dist/lib/chunks/{chunk-OBXAHX3L.js → chunk-AASWJR7Q.js} +1 -5
  58. package/dist/lib/chunks/{chunk-NCXSNHXX.js → chunk-AJO7XVXK.js} +12 -12
  59. package/dist/lib/chunks/{chunk-2GU6CNQI.js → chunk-AT3XMGES.js} +5 -5
  60. package/dist/lib/chunks/{chunk-MNWO7EHC.js → chunk-BFWK3TBN.js} +2 -2
  61. package/dist/lib/chunks/{chunk-BGOIPHJZ.js → chunk-BGAHZIL3.js} +18 -12
  62. package/dist/lib/chunks/{chunk-ZCOI3HE2.js → chunk-BRENK356.js} +1 -1
  63. package/dist/lib/chunks/{chunk-KJMU5KH4.js → chunk-BXF4OC74.js} +18 -9
  64. package/dist/lib/chunks/{chunk-5JPYM4MD.js → chunk-BYHXNFWN.js} +1 -1
  65. package/dist/lib/chunks/{chunk-NCLFZOZU.js → chunk-CH7OCYDL.js} +1 -1
  66. package/dist/lib/chunks/{chunk-OKL7GN2F.js → chunk-DL6YQDTE.js} +31 -5
  67. package/dist/lib/chunks/{chunk-PDS5KWO3.js → chunk-E2YTTB6Q.js} +56 -42
  68. package/dist/lib/chunks/{chunk-SDWYZM64.js → chunk-EDQTINTL.js} +5 -1
  69. package/dist/lib/chunks/{chunk-4PD65FRJ.js → chunk-EOO5RBUW.js} +3 -3
  70. package/dist/lib/chunks/chunk-ESEMYWUH.js +257 -0
  71. package/dist/lib/chunks/{chunk-YHS5IEVZ.js → chunk-F2NSJ6PG.js} +12 -8
  72. package/dist/lib/chunks/{chunk-BLKLPUYR.js → chunk-F7DBTXKG.js} +6 -6
  73. package/dist/lib/chunks/{chunk-EE26FNSY.js → chunk-FDM2YNQL.js} +1 -1
  74. package/dist/lib/chunks/{chunk-RJ5R6YYA.js → chunk-FJL2V6P5.js} +6 -6
  75. package/dist/lib/chunks/chunk-FK2JQHAX.js +30 -0
  76. package/dist/lib/chunks/{chunk-QHUDJVPJ.js → chunk-GLUGYZQO.js} +7 -7
  77. package/dist/lib/chunks/{chunk-GNMFJ2OK.js → chunk-HCUJ2J7P.js} +8 -8
  78. package/dist/lib/chunks/{chunk-2ROXN2EC.js → chunk-HGGOGCPX.js} +10 -10
  79. package/dist/lib/chunks/{chunk-VPZQGND4.js → chunk-HGGRPOSA.js} +3 -3
  80. package/dist/lib/chunks/{chunk-EJ655TVU.js → chunk-I3UE52ZV.js} +2 -2
  81. package/dist/lib/chunks/{chunk-ML4W6KC6.js → chunk-J5NPHPXY.js} +5 -4
  82. package/dist/lib/chunks/{chunk-HFRAHG5C.js → chunk-J7QKT5E7.js} +17 -17
  83. package/dist/lib/chunks/{chunk-V7OAPKNF.js → chunk-JBOOD6MU.js} +10 -9
  84. package/dist/lib/chunks/{chunk-YAAUWCJ4.js → chunk-JKPBXPCW.js} +3 -3
  85. package/dist/lib/chunks/{chunk-5HT55QYX.js → chunk-JQDQVG3D.js} +1 -1
  86. package/dist/lib/chunks/{chunk-GESHTTSA.js → chunk-JYCVBFH5.js} +2 -2
  87. package/dist/lib/chunks/{chunk-W2VGLWTS.js → chunk-K2FZFESR.js} +10 -10
  88. package/dist/lib/chunks/{chunk-DC6PN7QJ.js → chunk-K4Y5NT4M.js} +11 -7
  89. package/dist/lib/chunks/chunk-K7YFL5KB.js +182 -0
  90. package/dist/lib/chunks/{chunk-EBUQPCKB.js → chunk-KFAT65P7.js} +1 -1
  91. package/dist/lib/chunks/{chunk-ZYSPTOKK.js → chunk-KQCRJIEG.js} +1 -1
  92. package/dist/lib/chunks/{chunk-R6XDZWUL.js → chunk-LR27H2HZ.js} +11 -11
  93. package/dist/lib/chunks/{chunk-FUAUPNRO.js → chunk-LTCDLURT.js} +7 -7
  94. package/dist/lib/chunks/{chunk-KZR25REO.js → chunk-LTI2YYU3.js} +1 -1
  95. package/dist/lib/chunks/{chunk-EPQHVILQ.js → chunk-MA27TFEY.js} +5 -3
  96. package/dist/lib/chunks/{chunk-UZJSTJFP.js → chunk-MENTBQGB.js} +6 -5
  97. package/dist/lib/chunks/chunk-MPJCZN4G.js +155 -0
  98. package/dist/lib/chunks/{chunk-BE4ENGUY.js → chunk-OOLWU667.js} +6 -6
  99. package/dist/lib/chunks/{chunk-QSJ4IKUF.js → chunk-PIF3GL62.js} +5 -5
  100. package/dist/lib/chunks/{chunk-W5X7WJYL.js → chunk-PIFTG6YW.js} +3 -3
  101. package/dist/lib/chunks/{chunk-YRBIC5QH.js → chunk-PKNODC6Y.js} +1 -1
  102. package/dist/lib/chunks/{chunk-SHUMCKCS.js → chunk-PWOYEIPF.js} +4 -4
  103. package/dist/lib/chunks/{chunk-RR46EDDR.js → chunk-QD3JXA3Y.js} +25 -25
  104. package/dist/lib/chunks/{chunk-7ZOJE6BH.js → chunk-QGZ4QSUE.js} +8 -7
  105. package/dist/lib/chunks/{chunk-D2INDP5W.js → chunk-R5UPOEWE.js} +9 -8
  106. package/dist/lib/chunks/{chunk-VKM6MMA4.js → chunk-RIJERFGU.js} +34 -3
  107. package/dist/lib/chunks/{chunk-5B3RNVZ6.js → chunk-RK57YZKM.js} +1 -1
  108. package/dist/lib/chunks/{chunk-GDKGZQ3T.js → chunk-RXSHKWZJ.js} +3 -3
  109. package/dist/lib/chunks/{chunk-NGHAP2P5.js → chunk-S6QOXJAL.js} +4 -4
  110. package/dist/lib/chunks/{chunk-6GHHNPFJ.js → chunk-SIJOQRRK.js} +1 -1
  111. package/dist/lib/chunks/{chunk-663HABKP.js → chunk-T6XZQOXS.js} +8 -8
  112. package/dist/lib/chunks/{chunk-EYKINDNK.js → chunk-TAPVCSCR.js} +1 -1
  113. package/dist/lib/chunks/{chunk-ISN6MBNB.js → chunk-U5USH2HB.js} +7 -7
  114. package/dist/lib/chunks/{chunk-MRL5RUP7.js → chunk-U6BW6LGX.js} +10 -3
  115. package/dist/lib/chunks/{chunk-L7MEIRJB.js → chunk-UNCUG2YS.js} +15 -6
  116. package/dist/lib/chunks/{chunk-3JO5TXBA.js → chunk-UYDQXXDQ.js} +4 -4
  117. package/dist/lib/chunks/{chunk-LOBXOZ2R.js → chunk-V5JJEEBT.js} +1 -1
  118. package/dist/lib/chunks/{chunk-XR44YSHT.js → chunk-VHKHYAC5.js} +30 -9
  119. package/dist/lib/chunks/{chunk-Z7V63UZA.js → chunk-VXDMOB7O.js} +4 -4
  120. package/dist/lib/chunks/{chunk-G62E525I.js → chunk-VXYQWE45.js} +2 -2
  121. package/dist/lib/chunks/{chunk-W5DC23OP.js → chunk-WCLKIPJV.js} +1 -1
  122. package/dist/lib/chunks/{chunk-7XO3SQAX.js → chunk-WDT2Y7D7.js} +1 -1
  123. package/dist/lib/chunks/{chunk-OVUCZLH2.js → chunk-WIBMVNIH.js} +2 -2
  124. package/dist/lib/chunks/{chunk-5T3V6XJS.js → chunk-WNIXDMJL.js} +1 -1
  125. package/dist/lib/chunks/{chunk-HTOD4W4E.js → chunk-WZGI7UVM.js} +2 -2
  126. package/dist/lib/chunks/{chunk-HQG63ZKO.js → chunk-XA27KAUV.js} +17 -17
  127. package/dist/lib/chunks/{chunk-I3XGRGXE.js → chunk-XAN4CRFP.js} +33 -41
  128. package/dist/lib/chunks/{chunk-AYY4MYTW.js → chunk-XFUYEFQP.js} +1 -1
  129. package/dist/lib/chunks/{chunk-FOCJ7HPC.js → chunk-XSER7WEB.js} +11 -11
  130. package/dist/lib/chunks/{chunk-WVACVWBL.js → chunk-YEUCAPKP.js} +6 -4
  131. package/dist/lib/chunks/{chunk-7Z27HQWL.js → chunk-YGLWQFKL.js} +3 -3
  132. package/dist/lib/chunks/{chunk-D7GEQVLL.js → chunk-YKJHFD64.js} +1 -1
  133. package/dist/lib/chunks/{chunk-OQU5IXAJ.js → chunk-ZOGIJGU3.js} +10 -10
  134. package/dist/lib/chunks/{chunk-5ZITQDVE.js → chunk-ZQ3ER7JD.js} +12 -13
  135. package/dist/lib/cli/bundle-commands.js +91 -88
  136. package/dist/lib/cli/run-commands.js +110 -105
  137. package/dist/lib/cli/status-command.js +77 -74
  138. package/dist/lib/codex-workflow/aggregate.js +21 -22
  139. package/dist/lib/codex-workflow/author-search.js +4 -3
  140. package/dist/lib/codex-workflow/author-tools.js +17 -15
  141. package/dist/lib/codex-workflow/author.js +38 -34
  142. package/dist/lib/codex-workflow/capture.js +25 -25
  143. package/dist/lib/codex-workflow/checkpoint.js +13 -13
  144. package/dist/lib/codex-workflow/checks.js +15 -16
  145. package/dist/lib/codex-workflow/copy-editor.js +31 -30
  146. package/dist/lib/codex-workflow/copy-recovery.js +11 -11
  147. package/dist/lib/codex-workflow/copy.js +28 -27
  148. package/dist/lib/codex-workflow/finish.js +34 -34
  149. package/dist/lib/codex-workflow/loop.js +65 -62
  150. package/dist/lib/codex-workflow/quality.js +11 -11
  151. package/dist/lib/codex-workflow/run-inputs.js +12 -12
  152. package/dist/lib/codex-workflow/run-source.js +26 -23
  153. package/dist/lib/codex-workflow/schemas.js +11 -11
  154. package/dist/lib/codex-workflow/session.js +14 -14
  155. package/dist/lib/codex-workflow/stage.js +45 -41
  156. package/dist/lib/codex-workflow/workdir.js +13 -13
  157. package/dist/lib/engine/audit-file.js +16 -11
  158. package/dist/lib/engine/author.js +53 -49
  159. package/dist/lib/engine/cost-estimate.js +18 -16
  160. package/dist/lib/engine/local-run.js +76 -73
  161. package/dist/lib/engine/preflight.js +12 -12
  162. package/dist/lib/engine/rejudge.js +82 -79
  163. package/dist/lib/engine/run-status.js +77 -74
  164. package/dist/lib/engine/templates.js +17 -12
  165. package/dist/lib/grounding/chromium-guard.js +13 -0
  166. package/dist/lib/grounding/controller.js +11 -10
  167. package/dist/lib/grounding/extract.js +10 -9
  168. package/dist/lib/grounding/fetch.js +4 -7
  169. package/dist/lib/grounding/file-store.js +5 -5
  170. package/dist/lib/grounding/grounding-runtime.js +32 -31
  171. package/dist/lib/grounding/guarded-request.js +18 -0
  172. package/dist/lib/grounding/model.js +9 -8
  173. package/dist/lib/grounding/profile.js +4 -4
  174. package/dist/lib/grounding/recorded-tools.js +16 -16
  175. package/dist/lib/grounding/session.js +3 -3
  176. package/dist/lib/grounding/tools.js +4 -3
  177. package/dist/lib/grounding/validation.js +2 -2
  178. package/dist/lib/harness/report/artifacts.js +11 -11
  179. package/dist/lib/harness/report/capture-coverage.js +4 -4
  180. package/dist/lib/lib/checkpoint.js +10 -10
  181. package/dist/lib/lib/progress-comparison.js +2 -2
  182. package/dist/lib/models/batching.js +3 -3
  183. package/dist/lib/models/structured.js +2 -2
  184. package/dist/lib/models/supported-models.js +1 -1
  185. package/dist/lib/pipeline.js +20 -21
  186. package/dist/lib/probes/agent-clis.js +10 -10
  187. package/dist/lib/probes/probes.js +12 -12
  188. package/dist/lib/probes/web-tool-guard.js +3 -3
  189. package/dist/lib/report/contracts.js +4 -4
  190. package/dist/lib/report/core/progress-comparison.js +2 -2
  191. package/dist/lib/report/core/progress-schema.js +2 -2
  192. package/dist/lib/report/core/schema.js +2 -4
  193. package/dist/lib/report/core/surfaces.js +1 -3
  194. package/dist/lib/runner.js +23 -24
  195. package/dist/lib/schema.js +19 -13
  196. package/dist/lib/section-result.js +14 -15
  197. package/dist/lib/stores/artifacts.js +17 -17
  198. package/dist/lib/stores/files.js +31 -31
  199. package/dist/lib/stores/local-versions.js +10 -10
  200. package/dist/lib/stores/memory.js +33 -33
  201. package/dist/lib/stores/publication.js +23 -22
  202. package/dist/lib/surfaces.js +1 -3
  203. package/dist/lib/viewer/server.js +38 -38
  204. package/dist/lib/workflow/schema.js +8 -8
  205. package/dist/types/agents/author-schema.d.ts +3 -3
  206. package/dist/types/analysis/scoring.d.ts +2 -2
  207. package/dist/types/bundle/contracts.d.ts +3 -2
  208. package/dist/types/checks/crawler-access.d.ts +3 -2
  209. package/dist/types/checks/money-pages.d.ts +19 -0
  210. package/dist/types/checks/renderability.d.ts +8 -1
  211. package/dist/types/codex-workflow/author-tools.d.ts +3 -3
  212. package/dist/types/codex-workflow/run-inputs.d.ts +3 -0
  213. package/dist/types/codex-workflow/schemas.d.ts +6 -6
  214. package/dist/types/engine/audit-file.d.ts +6 -1
  215. package/dist/types/engine/preflight.d.ts +2 -0
  216. package/dist/types/grounding/chromium-guard.d.ts +41 -0
  217. package/dist/types/grounding/fetch.d.ts +0 -10
  218. package/dist/types/grounding/guarded-request.d.ts +76 -0
  219. package/dist/types/harness/report/artifacts.d.ts +1 -0
  220. package/dist/types/lib/checkpoint.d.ts +5 -6
  221. package/dist/types/pipeline.d.ts +2 -1
  222. package/dist/types/probes/probes.d.ts +2 -1
  223. package/dist/types/report/contracts.d.ts +2 -0
  224. package/dist/types/report/core/schema.d.ts +3 -1
  225. package/dist/types/report/core/surfaces.d.ts +0 -1
  226. package/dist/types/schema.d.ts +22 -0
  227. package/dist/types/section-result.d.ts +1 -1
  228. package/package.json +1 -1
  229. package/resources/guide/OPERATOR.md +12 -3
  230. package/src/agents/author-schema.ts +13 -1
  231. package/src/agents/author-validation.ts +24 -6
  232. package/src/agents/facts.ts +8 -8
  233. package/src/agents/narrative-facts.ts +9 -20
  234. package/src/agents/verifier.ts +2 -2
  235. package/src/analysis/progress.ts +1 -0
  236. package/src/analysis/scoring.ts +9 -13
  237. package/src/bundle/contracts.ts +7 -2
  238. package/src/bundle/verify.ts +3 -3
  239. package/src/capture-manifest.ts +4 -0
  240. package/src/checks/crawler-access.ts +70 -50
  241. package/src/checks/money-pages.ts +48 -0
  242. package/src/checks/renderability.ts +113 -87
  243. package/src/checks/run-checks.ts +16 -3
  244. package/src/cli/run-commands.ts +2 -0
  245. package/src/codex-workflow/aggregate.ts +1 -0
  246. package/src/codex-workflow/author-tools.ts +39 -60
  247. package/src/codex-workflow/capture.ts +1 -0
  248. package/src/codex-workflow/copy-editor.ts +3 -3
  249. package/src/codex-workflow/loop.ts +2 -2
  250. package/src/engine/audit-file.ts +79 -2
  251. package/src/engine/guide/OPERATOR.md +12 -3
  252. package/src/engine/preflight.ts +50 -0
  253. package/src/grounding/chromium-guard.ts +273 -0
  254. package/src/grounding/controller.ts +1 -1
  255. package/src/grounding/fetch.ts +39 -276
  256. package/src/grounding/guarded-request.ts +428 -0
  257. package/src/grounding/tools.ts +2 -1
  258. package/src/grounding/validation.ts +1 -1
  259. package/src/lib/checkpoint.ts +15 -16
  260. package/src/models/supported-models.ts +3 -3
  261. package/src/pipeline.ts +13 -7
  262. package/src/probes/agent-clis.ts +2 -3
  263. package/src/probes/probes.ts +24 -10
  264. package/src/report/core/schema.ts +4 -1
  265. package/src/report/core/surfaces.ts +4 -8
  266. package/src/runner.ts +1 -0
  267. package/src/schema.ts +68 -4
  268. package/src/section-result.ts +6 -5
  269. package/dist/lib/chunks/chunk-6EH4N3EU.js +0 -113
  270. package/dist/lib/chunks/chunk-SWJ7KQSL.js +0 -318
  271. package/dist/lib/chunks/{chunk-CO5T6WU5.js → chunk-OD36HUXA.js} +3 -3
  272. package/dist/lib/chunks/{chunk-XI5H46DF.js → chunk-SASE7U6E.js} +3 -3
@@ -1,6 +1,5 @@
1
1
  import { normalizeDomain } from '../report/core/normalize-domain';
2
- import type { AeoSurface } from '../schema';
3
- import { surfaceRunCounts, plannedRunsPerPrompt } from '../surfaces';
2
+ import { runsPerPromptOn, type AeoSurface, type ProbeDepth } from '../schema';
4
3
 
5
4
  // ============================================================================
6
5
  // Scorecard aggregation (ported from the console's intelligence/scoring.ts).
@@ -62,19 +61,17 @@ export const computeAISearchSummary = (args: {
62
61
  prompts: PromptForScoring[];
63
62
  results: AnalyzedProbeForScoring[];
64
63
  surfaces: readonly AeoSurface[];
65
- // Overrides the canonical per-surface run count (agent batches configured
66
- // below the default, spec §5 revised). Applies uniformly to every scoped
67
- // surface; omit for the canonical surfaceRunCounts denominators.
68
- runsPerSurface?: number;
64
+ // The configured depth the plan asked each prompt at.
65
+ depth: ProbeDepth;
69
66
  }): ScoringSummary => {
70
- const { competitorDomains, prompts, results, surfaces } = args;
67
+ const { competitorDomains, prompts, results, surfaces, depth } = args;
71
68
 
72
69
  // Probe planning: total probes attempted = prompts × (sum of runs across
73
70
  // the scoped surfaces). Failures lower share of voice instead of hiding.
74
- const totalRunsPerPrompt =
75
- args.runsPerSurface !== undefined
76
- ? surfaces.length * args.runsPerSurface
77
- : plannedRunsPerPrompt(surfaces);
71
+ const totalRunsPerPrompt = surfaces.reduce(
72
+ (sum, surface) => sum + runsPerPromptOn(surface, depth),
73
+ 0,
74
+ );
78
75
  const totalPrompts = prompts.length * totalRunsPerPrompt;
79
76
 
80
77
  const mentioned = results.filter((r) => r.clientMentioned).length;
@@ -89,8 +86,7 @@ export const computeAISearchSummary = (args: {
89
86
 
90
87
  for (const surface of surfaces) {
91
88
  const modelResults = results.filter((r) => r.model === surface);
92
- const runsPerPrompt = args.runsPerSurface ?? surfaceRunCounts[surface];
93
- const total = prompts.length * runsPerPrompt;
89
+ const total = prompts.length * runsPerPromptOn(surface, depth);
94
90
 
95
91
  byModel[surface] = {
96
92
  sov:
@@ -13,8 +13,13 @@ import { canonicalDigest } from './json';
13
13
  export const toolId = 'literally-aeo';
14
14
  // The package version, recorded in every journal and bundle; the build and
15
15
  // version.spec.ts refuse a mismatch with package.json.
16
- export const toolVersion = '0.2.0';
17
- export const bundleSchemaVersion = 1;
16
+ export const toolVersion = '0.2.2';
17
+ // Version 2: config.json may set chatProbes, and agentProbes.runsPerPrompt
18
+ // above 2. A verifier that reads only version 1 then refuses the bundle as
19
+ // unsupported instead of dropping its depth and failing it.
20
+ export const bundleSchemaVersion = 2;
21
+ // A version 1 bundle reads as version 2 at the standard depth.
22
+ export const readableBundleSchemaVersions: readonly number[] = [1, 2];
18
23
  export const traceSchemaVersion = 1;
19
24
  export const canonicalization = 'literally-aeo-canonical-json-v1';
20
25
  // Bump when the arithmetic the verifier recomputes changes
@@ -11,9 +11,9 @@ import {
11
11
  import {
12
12
  bundleManifestSchema,
13
13
  bundlePaths,
14
- bundleSchemaVersion,
15
14
  canonicalization,
16
15
  predecessorPrefix,
16
+ readableBundleSchemaVersions,
17
17
  traceSchemaVersion,
18
18
  type BundleManifest,
19
19
  } from './contracts';
@@ -157,7 +157,7 @@ const readManifest = (
157
157
  : [];
158
158
 
159
159
  if (
160
- declared[0] !== bundleSchemaVersion ||
160
+ !readableBundleSchemaVersions.some((version) => version === declared[0]) ||
161
161
  declared[1] !== traceSchemaVersion ||
162
162
  declared[2] !== canonicalization
163
163
  ) {
@@ -167,7 +167,7 @@ const readManifest = (
167
167
  title: 'Bundle integrity',
168
168
  outcome: CheckOutcome.UNSUPPORTED,
169
169
  code: 'bundle_version_unsupported',
170
- explanation: `This verifier reads bundle schema ${bundleSchemaVersion}, trace schema ${traceSchemaVersion} and ${canonicalization}; the bundle declares ${JSON.stringify(declared)}. It does not download or upgrade code to read another.`,
170
+ explanation: `This verifier reads bundle schema ${readableBundleSchemaVersions.join(' or ')}, trace schema ${traceSchemaVersion} and ${canonicalization}; the bundle declares ${JSON.stringify(declared)}. It does not download or upgrade code to read another: verify the bundle with the literally-aeo release that produced it, or a newer one.`,
171
171
  }),
172
172
  };
173
173
  }
@@ -93,6 +93,9 @@ export const capturePlan = (
93
93
  geography: config.geography,
94
94
  language: config.language,
95
95
  agentProbes: config.agentProbes,
96
+ // Undefined members are dropped, so a config without chat depth keeps
97
+ // the digest earlier releases gave it.
98
+ chatProbes: config.chatProbes,
96
99
  surfaces,
97
100
  });
98
101
 
@@ -104,6 +107,7 @@ export const capturePlan = (
104
107
  prompts: section.prompts,
105
108
  surfaces,
106
109
  agentProbes: config.agentProbes,
110
+ chatProbes: config.chatProbes,
107
111
  }),
108
112
  ),
109
113
  };
@@ -1,5 +1,9 @@
1
- import type { AeoTechnicalChecks } from '../schema';
1
+ import {
2
+ describeSiteError,
3
+ type SiteRequest,
4
+ } from '../grounding/guarded-request';
2
5
  import { createLog } from '../lib/log';
6
+ import type { AeoTechnicalChecks } from '../schema';
3
7
 
4
8
  const log = createLog('CrawlerAccess');
5
9
 
@@ -65,19 +69,18 @@ export const aiBotRoster: readonly AiBot[] = [
65
69
  { bot: 'CCBot', kind: 'training' },
66
70
  ];
67
71
 
68
- const fetchTimeoutMs = 15_000;
69
- const probeIntervalMs = 1000;
72
+ const requestTimeoutInMs = 15_000;
73
+ const auditUserAgent = 'literally-aeo-audit/1.0';
70
74
  const controlUserAgent =
71
75
  'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36';
76
+ // RFC 9309 §2.3.1.2 and §2.5: follow at least five redirects for
77
+ // robots.txt, and parse at least its first 500 KiB.
78
+ const robotsRedirects = 5;
79
+ const robotsMaxBytes = 500 * 1024;
80
+ const pageRedirects = 5;
72
81
 
73
82
  type LiveVerdict = 'ok' | 'refused_as_bot' | 'inconclusive';
74
83
 
75
- const sleep = (ms: number) => {
76
- return new Promise<void>((resolve) => {
77
- setTimeout(resolve, ms);
78
- });
79
- };
80
-
81
84
  const isRefused = (code: number | null) => {
82
85
  return code === 403 || code === 429;
83
86
  };
@@ -97,27 +100,38 @@ const getLiveVerdict = (
97
100
  return isRefused(liveStatus) ? 'refused_as_bot' : 'ok';
98
101
  };
99
102
 
100
- const describeError = (error: unknown): string => {
101
- return error instanceof Error ? error.message : String(error);
103
+ const getOrigin = (brandDomain: string): string => {
104
+ return `https://${brandDomain.replace(/^https?:\/\//, '').replace(/\/.*$/, '')}`;
102
105
  };
103
106
 
104
107
  export const runCrawlerAccessCheck = async (
105
108
  brandDomain: string,
109
+ request: SiteRequest,
106
110
  ): Promise<NonNullable<AeoTechnicalChecks['crawlerAccess']>> => {
107
- const origin = `https://${brandDomain.replace(/^https?:\/\//, '').replace(/\/.*$/, '')}`;
111
+ const origin = getOrigin(brandDomain);
108
112
  const robotsUrl = `${origin}/robots.txt`;
109
113
 
110
114
  let robotsBody: string | null = null;
111
115
  let robotsFetchError: string | null = null;
116
+ let robotsTruncated = false;
112
117
 
113
118
  try {
114
- const response = await fetch(robotsUrl, {
115
- signal: AbortSignal.timeout(fetchTimeoutMs),
116
- headers: { 'user-agent': 'literally-aeo-audit/1.0' },
119
+ const response = await request({
120
+ url: robotsUrl,
121
+ timeoutInMs: requestTimeoutInMs,
122
+ userAgent: auditUserAgent,
123
+ accept: '*/*',
124
+ redirects: robotsRedirects,
125
+ body: {
126
+ contentTypes: 'any',
127
+ maxBytes: robotsMaxBytes,
128
+ oversize: 'truncate',
129
+ },
117
130
  });
118
131
 
119
- if (response.ok) {
120
- robotsBody = await response.text();
132
+ if (response.status >= 200 && response.status < 300) {
133
+ robotsBody = response.body?.toString('utf8') ?? '';
134
+ robotsTruncated = response.isTruncated;
121
135
  } else if (response.status === 404) {
122
136
  // No robots.txt = allow all; that is a real answer, not an error.
123
137
  robotsBody = '';
@@ -125,25 +139,30 @@ export const runCrawlerAccessCheck = async (
125
139
  robotsFetchError = `HTTP ${response.status}`;
126
140
  }
127
141
  } catch (error) {
128
- robotsFetchError = describeError(error);
142
+ robotsFetchError = describeSiteError(error);
129
143
  }
130
144
 
131
145
  const groups = robotsBody !== null ? parseRobotsTxt(robotsBody) : null;
132
146
 
133
- // One request at a time, spaced like a polite crawler: six bot agents
134
- // fired at once from one address looks like an attack to a rate rule and
135
- // colours every answer after the first.
136
- const status = async (userAgent: string): Promise<number | null> => {
147
+ // The request is paced per host by its caller: six bot agents fired at
148
+ // once from one address looks like an attack to a rate rule and colours
149
+ // every answer after the first.
150
+ const getStatus = async (userAgent: string): Promise<number | null> => {
137
151
  try {
138
- const response = await fetch(origin, {
139
- signal: AbortSignal.timeout(fetchTimeoutMs),
140
- headers: { 'user-agent': userAgent },
141
- redirect: 'follow',
152
+ const response = await request({
153
+ url: origin,
154
+ timeoutInMs: requestTimeoutInMs,
155
+ userAgent,
156
+ accept: '*/*',
157
+ redirects: pageRedirects,
142
158
  });
143
159
 
144
160
  return response.status;
145
161
  } catch (error) {
146
- log.warn('Live UA probe failed', { userAgent, error: String(error) });
162
+ log.warn('Live UA probe failed', {
163
+ userAgent,
164
+ error: describeSiteError(error),
165
+ });
147
166
 
148
167
  return null;
149
168
  }
@@ -156,11 +175,7 @@ export const runCrawlerAccessCheck = async (
156
175
  continue;
157
176
  }
158
177
 
159
- if (probed.length > 0) {
160
- await sleep(probeIntervalMs);
161
- }
162
-
163
- probed.push({ bot, liveStatus: await status(bot.liveProbeUa) });
178
+ probed.push({ bot, liveStatus: await getStatus(bot.liveProbeUa) });
164
179
  }
165
180
 
166
181
  // The control: the same page, from the same address, as an ordinary
@@ -168,14 +183,10 @@ export const runCrawlerAccessCheck = async (
168
183
  // that presented as that bot from an address the site cannot verify as
169
184
  // the bot's own (Cloudflare and others verify search bots by IP), so it
170
185
  // never proves the real bot is blocked. A browser refused too says the
171
- // address is blocked, which says nothing about bots. Botpress's report
172
- // called five bots blocked on that evidence (2026-09-15).
173
- if (probed.length > 0) {
174
- await sleep(probeIntervalMs);
175
- }
176
-
186
+ // address is blocked, which says nothing about bots. An earlier report
187
+ // called five bots blocked on that evidence.
177
188
  const controlStatus =
178
- probed.length > 0 ? await status(controlUserAgent) : null;
189
+ probed.length > 0 ? await getStatus(controlUserAgent) : null;
179
190
 
180
191
  const bots = aiBotRoster.map((bot) => {
181
192
  const robotsAllowed = groups ? isRootAllowed(groups, bot.bot) : null;
@@ -210,6 +221,7 @@ export const runCrawlerAccessCheck = async (
210
221
  log.info('Crawler access check completed', {
211
222
  robotsUrl,
212
223
  robotsFetchError,
224
+ robotsTruncated,
213
225
  controlStatus,
214
226
  bots: bots.length,
215
227
  robotsBlocked: bots.filter((b) => b.robotsAllowed === false).length,
@@ -221,6 +233,7 @@ export const runCrawlerAccessCheck = async (
221
233
  robotsUrl,
222
234
  fetchedAt: new Date().toISOString(),
223
235
  robotsFetchError,
236
+ robotsTruncated,
224
237
  controlStatus,
225
238
  bots,
226
239
  };
@@ -228,11 +241,14 @@ export const runCrawlerAccessCheck = async (
228
241
 
229
242
  export const checkLlmsTxt = async (
230
243
  brandDomain: string,
244
+ request: SiteRequest,
231
245
  ): Promise<NonNullable<AeoTechnicalChecks['llmsTxt']>> => {
232
- const origin = `https://${brandDomain.replace(/^https?:\/\//, '').replace(/\/.*$/, '')}`;
246
+ const origin = getOrigin(brandDomain);
247
+ // Started together, sent one after the other: the request is paced per
248
+ // host.
233
249
  const [llmsTxt, llmsFullTxt] = await Promise.all([
234
- urlExists(`${origin}/llms.txt`),
235
- urlExists(`${origin}/llms-full.txt`),
250
+ isTextFileServed(`${origin}/llms.txt`, request),
251
+ isTextFileServed(`${origin}/llms-full.txt`, request),
236
252
  ]);
237
253
 
238
254
  log.debug('llms.txt check completed', { origin, llmsTxt, llmsFullTxt });
@@ -240,21 +256,25 @@ export const checkLlmsTxt = async (
240
256
  return { llmsTxt, llmsFullTxt };
241
257
  };
242
258
 
243
- const urlExists = async (url: string): Promise<boolean> => {
259
+ const isTextFileServed = async (
260
+ url: string,
261
+ request: SiteRequest,
262
+ ): Promise<boolean> => {
244
263
  try {
245
- const response = await fetch(url, {
246
- signal: AbortSignal.timeout(fetchTimeoutMs),
247
- headers: { 'user-agent': 'literally-aeo-audit/1.0' },
264
+ const response = await request({
265
+ url,
266
+ timeoutInMs: requestTimeoutInMs,
267
+ userAgent: auditUserAgent,
268
+ accept: 'text/plain,text/markdown,*/*',
269
+ redirects: pageRedirects,
248
270
  });
249
271
 
250
- if (!response.ok) {
272
+ if (response.status < 200 || response.status >= 300) {
251
273
  return false;
252
274
  }
253
275
 
254
276
  // Some sites soft-404 to an HTML page; llms.txt is plain text.
255
- const contentType = response.headers.get('content-type') ?? '';
256
-
257
- return !contentType.includes('text/html');
277
+ return !response.contentType.includes('text/html');
258
278
  } catch {
259
279
  // An unreachable file is reported as missing, which is what the check asks.
260
280
  return false;
@@ -0,0 +1,48 @@
1
+ import {
2
+ SourceRetrievalError,
3
+ validateResearchUrl,
4
+ } from '../grounding/guarded-request';
5
+ import { urlIsOnDomain } from '../report/core/domain-match';
6
+
7
+ // ============================================================================
8
+ // Which money pages the site checks may fetch and render
9
+ // (specs/aeo-checks-and-reach-spec.md §3.3). One rule for every place a
10
+ // config is admitted: audit.json, the author's output and the hosted
11
+ // platform. The verifier never applies it: stored bundles keep verifying.
12
+ // ============================================================================
13
+
14
+ export const maxMoneyPages = 20;
15
+
16
+ /** Why a money page is refused: another site's page, or a URL the guard
17
+ * would never fetch. Each caller words the remedy its own input offers. */
18
+ export type MoneyPageProblem =
19
+ { kind: 'off_site' } | { kind: 'unsafe_url'; message: string };
20
+
21
+ /**
22
+ * moneyPageProblem says why the site checks may not fetch a page, or
23
+ * undefined when they may. The page must be on the brand's site or its
24
+ * subdomains (or on a host the operator allowed), and public https with no
25
+ * port or credentials.
26
+ */
27
+ export const moneyPageProblem = (
28
+ page: string,
29
+ site: { domain: string; checkHosts?: readonly string[] },
30
+ ): MoneyPageProblem | undefined => {
31
+ const hosts = [site.domain, ...(site.checkHosts ?? [])];
32
+
33
+ if (!hosts.some((host) => urlIsOnDomain(page, host))) {
34
+ return { kind: 'off_site' };
35
+ }
36
+
37
+ try {
38
+ validateResearchUrl(page);
39
+ } catch (err) {
40
+ if (err instanceof SourceRetrievalError) {
41
+ return { kind: 'unsafe_url', message: err.message };
42
+ }
43
+
44
+ throw err;
45
+ }
46
+
47
+ return undefined;
48
+ };
@@ -1,7 +1,16 @@
1
1
  import { load } from 'cheerio';
2
- import type { Browser } from 'playwright';
3
- import type { AeoTechnicalChecks } from '../schema';
2
+ import type { BrowserContext } from 'playwright';
3
+ import {
4
+ withBoundedPage,
5
+ withGuardedChromium,
6
+ } from '../grounding/chromium-guard';
7
+ import {
8
+ describeSiteError,
9
+ type HostPacer,
10
+ type SiteRequest,
11
+ } from '../grounding/guarded-request';
4
12
  import { createLog } from '../lib/log';
13
+ import type { AeoTechnicalChecks } from '../schema';
5
14
 
6
15
  const log = createLog('Renderability');
7
16
 
@@ -9,16 +18,21 @@ const log = createLog('Renderability');
9
18
  // Renderability check (spec §7.4): for each money page, compare the text a
10
19
  // no-JS fetch yields against a Playwright-rendered version. Most AI retrieval
11
20
  // bots don't execute JS — pages whose substance only exists after JS are
12
- // invisible to them. Playwright is already a devDependency via the migration
13
- // tooling; it is imported lazily so `--dry-run` and probe-only runs never
14
- // need a browser installed.
21
+ // invisible to them. Playwright is imported lazily, so a run without money
22
+ // pages never needs a browser installed. Both fetches pass the guard: the
23
+ // static one through guardedRequest, the browser through the guarding
24
+ // proxy (withGuardedChromium).
15
25
  // ============================================================================
16
26
 
17
- const fetchTimeoutMs = 20_000;
18
- const renderTimeoutMs = 45_000;
27
+ const fetchTimeoutInMs = 20_000;
28
+ const renderTimeoutInMs = 45_000;
19
29
  // How long a loaded page gets to go network-idle before its text is read as
20
30
  // it stands.
21
- const settleTimeoutMs = 8_000;
31
+ const settleTimeoutInMs = 8_000;
32
+ // The whole render, reading the text included: past it the page is closed.
33
+ const renderDeadlineInMs = 60_000;
34
+ const staticMaxBytes = 10 * 1024 * 1024;
35
+ const pageRedirects = 5;
22
36
  // Flag when more than 40% of the rendered text is missing statically AND the
23
37
  // absolute gap is large enough to be substance, not a cookie banner.
24
38
  const missingRatioThreshold = 0.4;
@@ -28,95 +42,114 @@ type RenderabilityResult = NonNullable<
28
42
  AeoTechnicalChecks['renderability']
29
43
  >[number];
30
44
 
45
+ /** The phase's guarded request and the pacer behind it: a page's static
46
+ * fetch and its render are spaced like any other request to its host. */
47
+ export type PagedSite = { request: SiteRequest; pace: HostPacer };
48
+
31
49
  export const runRenderabilityCheck = async (
32
50
  moneyPages: readonly string[],
51
+ site: PagedSite,
33
52
  ): Promise<RenderabilityResult[]> => {
34
53
  if (moneyPages.length === 0) {
35
54
  return [];
36
55
  }
37
56
 
38
- const { chromium } = await import('playwright');
39
- const browser = await chromium.launch();
40
-
41
- try {
42
- const results: RenderabilityResult[] = [];
43
-
44
- // Sequential on purpose: one browser page, no hammering the client's site.
45
- for (const url of moneyPages) {
46
- const pageStartedAt = Date.now();
47
- const result = await checkPage(url, browser);
48
-
49
- results.push(result);
50
- log.debug('Renderability page checked', {
51
- url,
52
- durationMs: Date.now() - pageStartedAt,
53
- staticTextChars: result.staticTextChars,
54
- renderedTextChars: result.renderedTextChars,
55
- flagged: result.flagged,
56
- error: result.error,
57
- });
58
- }
57
+ const { result: results, connections } = await withGuardedChromium(
58
+ async (context) => {
59
+ const checked: RenderabilityResult[] = [];
60
+
61
+ // Sequential on purpose: one browser page, no hammering the client's site.
62
+ for (const url of moneyPages) {
63
+ const pageStartedAt = Date.now();
64
+ const result = await checkPage(url, context, site);
65
+
66
+ checked.push(result);
67
+ log.debug('Renderability page checked', {
68
+ url,
69
+ durationMs: Date.now() - pageStartedAt,
70
+ staticTextChars: result.staticTextChars,
71
+ renderedTextChars: result.renderedTextChars,
72
+ flagged: result.flagged,
73
+ error: result.error,
74
+ });
75
+ }
76
+
77
+ return checked;
78
+ },
79
+ );
80
+
81
+ log.info('Renderability check completed', {
82
+ pages: results.length,
83
+ flagged: results.filter((r) => r.flagged).length,
84
+ errors: results.filter((r) => r.error).length,
85
+ connections,
86
+ });
87
+
88
+ return results;
89
+ };
59
90
 
60
- log.info('Renderability check completed', {
61
- pages: results.length,
62
- flagged: results.filter((r) => r.flagged).length,
63
- errors: results.filter((r) => r.error).length,
64
- });
91
+ const failedPage = (url: string, error: string): RenderabilityResult => {
92
+ return {
93
+ url,
94
+ staticTextChars: 0,
95
+ renderedTextChars: 0,
96
+ missingRatio: 0,
97
+ flagged: false,
98
+ error,
99
+ };
100
+ };
65
101
 
66
- return results;
67
- } finally {
68
- await browser.close();
69
- }
102
+ const renderText = (url: string, context: BrowserContext): Promise<string> => {
103
+ return withBoundedPage(context, renderDeadlineInMs, async (page) => {
104
+ // Load, then give the page a bounded moment to settle. Waiting for a
105
+ // fully idle network is a trap on documentation sites, which keep a
106
+ // connection open (live reload, search index, analytics) long after
107
+ // the text is drawn: one never went idle in 45 s, and the report said
108
+ // "could not check" for exactly the pages that matter most. The text
109
+ // is there long before.
110
+ await page.goto(url, { waitUntil: 'load', timeout: renderTimeoutInMs });
111
+ await page
112
+ .waitForLoadState('networkidle', { timeout: settleTimeoutInMs })
113
+ // A page that never settles is read as it stands, as explained above.
114
+ .catch(() => undefined);
115
+
116
+ // A document can lack a body at runtime although the DOM types say
117
+ // otherwise; querySelector keeps that case typed.
118
+ const text = await page.evaluate(
119
+ () => document.querySelector('body')?.innerText ?? '',
120
+ );
121
+
122
+ return normalizeWhitespace(text);
123
+ });
70
124
  };
71
125
 
72
126
  const checkPage = async (
73
127
  url: string,
74
- browser: Browser,
128
+ context: BrowserContext,
129
+ site: PagedSite,
75
130
  ): Promise<RenderabilityResult> => {
76
131
  try {
77
- const response = await fetch(url, {
78
- signal: AbortSignal.timeout(fetchTimeoutMs),
79
- headers: { 'user-agent': 'literally-aeo-audit/1.0' },
132
+ const response = await site.request({
133
+ url,
134
+ timeoutInMs: fetchTimeoutInMs,
135
+ userAgent: 'literally-aeo-audit/1.0',
136
+ accept: 'text/html,application/xhtml+xml',
137
+ redirects: pageRedirects,
138
+ body: {
139
+ contentTypes: /^(text\/html|application\/xhtml\+xml|text\/plain)(;|$)/i,
140
+ maxBytes: staticMaxBytes,
141
+ oversize: 'refuse',
142
+ },
80
143
  });
81
144
 
82
- if (!response.ok) {
83
- return {
84
- url,
85
- staticTextChars: 0,
86
- renderedTextChars: 0,
87
- missingRatio: 0,
88
- flagged: false,
89
- error: `Static fetch failed: HTTP ${response.status}`,
90
- };
145
+ if (response.status < 200 || response.status >= 300) {
146
+ return failedPage(url, `Static fetch failed: HTTP ${response.status}`);
91
147
  }
92
148
 
93
- const staticText = extractText(await response.text());
94
-
95
- const page = await browser.newPage();
96
- let renderedText: string;
97
-
98
- try {
99
- // Load, then give the page a bounded moment to settle. Waiting for a
100
- // fully idle network is a trap on documentation sites, which keep a
101
- // connection open (live reload, search index, analytics) long after
102
- // the text is drawn: botpress.com/docs never went idle in 45 s and
103
- // the report said "could not check" for exactly the pages that
104
- // matter most (2026-09-15). The text is there long before.
105
- await page.goto(url, { waitUntil: 'load', timeout: renderTimeoutMs });
106
- await page
107
- .waitForLoadState('networkidle', { timeout: settleTimeoutMs })
108
- // A page that never settles is read as it stands, as explained above.
109
- .catch(() => undefined);
110
- // A document can lack a body at runtime although the DOM types say
111
- // otherwise; querySelector keeps that case typed.
112
- renderedText = normalizeWhitespace(
113
- await page.evaluate(
114
- () => document.querySelector('body')?.innerText ?? '',
115
- ),
116
- );
117
- } finally {
118
- await page.close();
119
- }
149
+ const staticText = extractText(response.body?.toString('utf8') ?? '');
150
+ const renderedText = await site.pace(new URL(url), () => {
151
+ return renderText(url, context);
152
+ });
120
153
 
121
154
  const staticChars = staticText.length;
122
155
  const renderedChars = renderedText.length;
@@ -137,17 +170,10 @@ const checkPage = async (
137
170
  } catch (error) {
138
171
  log.warn('Renderability check failed for page', {
139
172
  url,
140
- error: String(error),
173
+ error: describeSiteError(error),
141
174
  });
142
175
 
143
- return {
144
- url,
145
- staticTextChars: 0,
146
- renderedTextChars: 0,
147
- missingRatio: 0,
148
- flagged: false,
149
- error: error instanceof Error ? error.message : String(error),
150
- };
176
+ return failedPage(url, describeSiteError(error));
151
177
  }
152
178
  };
153
179