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.
- package/README.md +29 -1
- package/dist/author-tools.js +479 -397
- package/dist/cli.mjs +808 -386
- package/dist/lib/access/schema.js +6 -6
- package/dist/lib/agents/author-schema.js +10 -10
- package/dist/lib/agents/author-validation.js +20 -18
- package/dist/lib/agents/copy-validation.js +22 -21
- package/dist/lib/agents/copywriter-input.js +23 -8
- package/dist/lib/agents/facts.js +22 -7
- package/dist/lib/agents/narrative-facts.js +20 -2
- package/dist/lib/agents/verifier.js +25 -24
- package/dist/lib/analysis/domain-classifier.js +19 -20
- package/dist/lib/analysis/domain-labels.js +10 -10
- package/dist/lib/analysis/progress-schema.js +2 -2
- package/dist/lib/analysis/progress.js +18 -19
- package/dist/lib/analysis/retrieval.js +20 -3
- package/dist/lib/analysis/scoring.js +20 -3
- package/dist/lib/analysis/search-analyzer.js +19 -5
- package/dist/lib/analysis/sentiment.js +16 -17
- package/dist/lib/author/examples.js +11 -11
- package/dist/lib/bundle/contracts.js +14 -12
- package/dist/lib/bundle/export.js +27 -27
- package/dist/lib/bundle/isolation.js +2 -2
- package/dist/lib/bundle/journal.js +13 -13
- package/dist/lib/bundle/project-journal.js +17 -17
- package/dist/lib/bundle/project.js +25 -25
- package/dist/lib/bundle/read.js +28 -28
- package/dist/lib/bundle/recorder.js +15 -15
- package/dist/lib/bundle/redact.js +13 -13
- package/dist/lib/bundle/trace-coverage.js +13 -13
- package/dist/lib/bundle/verify-integrity.js +15 -15
- package/dist/lib/bundle/verify-measurement.js +21 -21
- package/dist/lib/bundle/verify-report.js +29 -29
- package/dist/lib/bundle/verify.js +37 -37
- package/dist/lib/capture-manifest.js +12 -12
- package/dist/lib/checks/crawler-access.js +4 -1
- package/dist/lib/checks/money-pages.js +13 -0
- package/dist/lib/checks/renderability.js +5 -1
- package/dist/lib/checks/run-checks.js +21 -18
- package/dist/lib/chunks/{chunk-BSRKN6FU.js → chunk-2FOKEIIN.js} +1 -1
- package/dist/lib/chunks/{chunk-JXMDOAKA.js → chunk-2KH7LNK7.js} +11 -11
- package/dist/lib/chunks/{chunk-D3GE3OCB.js → chunk-3CMPR6ZZ.js} +1 -1
- package/dist/lib/chunks/{chunk-TJQ5OPLQ.js → chunk-3OE4UQIB.js} +7 -7
- package/dist/lib/chunks/{chunk-Y4OGZ3Q5.js → chunk-46PVVQYR.js} +1 -1
- package/dist/lib/chunks/{chunk-OU73OUX4.js → chunk-4GLW3ZRO.js} +67 -7
- package/dist/lib/chunks/{chunk-EV4DRS5M.js → chunk-4XIAXX7K.js} +1 -1
- package/dist/lib/chunks/{chunk-IBOWGKN7.js → chunk-52F5XYOW.js} +1 -1
- package/dist/lib/chunks/{chunk-FFOVLI3U.js → chunk-66T7JC57.js} +12 -10
- package/dist/lib/chunks/{chunk-IE7NAL6B.js → chunk-6HMHXSCS.js} +2 -2
- package/dist/lib/chunks/chunk-75DMLOQ7.js +127 -0
- package/dist/lib/chunks/{chunk-6G25V4CF.js → chunk-7CW6U5WJ.js} +1 -1
- package/dist/lib/chunks/{chunk-CUYVHXHI.js → chunk-7DNLRXEY.js} +3 -3
- package/dist/lib/chunks/{chunk-622NMXN6.js → chunk-7HM6IZ3L.js} +2 -2
- package/dist/lib/chunks/{chunk-F4W5YHDZ.js → chunk-7WO3FFPS.js} +2 -2
- package/dist/lib/chunks/{chunk-ULRXHSJL.js → chunk-7YDXD4MD.js} +9 -6
- package/dist/lib/chunks/{chunk-UEMZYHYJ.js → chunk-7YZPEX3T.js} +2 -2
- package/dist/lib/chunks/{chunk-OBXAHX3L.js → chunk-AASWJR7Q.js} +1 -5
- package/dist/lib/chunks/{chunk-NCXSNHXX.js → chunk-AJO7XVXK.js} +12 -12
- package/dist/lib/chunks/{chunk-2GU6CNQI.js → chunk-AT3XMGES.js} +5 -5
- package/dist/lib/chunks/{chunk-MNWO7EHC.js → chunk-BFWK3TBN.js} +2 -2
- package/dist/lib/chunks/{chunk-BGOIPHJZ.js → chunk-BGAHZIL3.js} +18 -12
- package/dist/lib/chunks/{chunk-ZCOI3HE2.js → chunk-BRENK356.js} +1 -1
- package/dist/lib/chunks/{chunk-KJMU5KH4.js → chunk-BXF4OC74.js} +18 -9
- package/dist/lib/chunks/{chunk-5JPYM4MD.js → chunk-BYHXNFWN.js} +1 -1
- package/dist/lib/chunks/{chunk-NCLFZOZU.js → chunk-CH7OCYDL.js} +1 -1
- package/dist/lib/chunks/{chunk-OKL7GN2F.js → chunk-DL6YQDTE.js} +31 -5
- package/dist/lib/chunks/{chunk-PDS5KWO3.js → chunk-E2YTTB6Q.js} +56 -42
- package/dist/lib/chunks/{chunk-SDWYZM64.js → chunk-EDQTINTL.js} +5 -1
- package/dist/lib/chunks/{chunk-4PD65FRJ.js → chunk-EOO5RBUW.js} +3 -3
- package/dist/lib/chunks/chunk-ESEMYWUH.js +257 -0
- package/dist/lib/chunks/{chunk-YHS5IEVZ.js → chunk-F2NSJ6PG.js} +12 -8
- package/dist/lib/chunks/{chunk-BLKLPUYR.js → chunk-F7DBTXKG.js} +6 -6
- package/dist/lib/chunks/{chunk-EE26FNSY.js → chunk-FDM2YNQL.js} +1 -1
- package/dist/lib/chunks/{chunk-RJ5R6YYA.js → chunk-FJL2V6P5.js} +6 -6
- package/dist/lib/chunks/chunk-FK2JQHAX.js +30 -0
- package/dist/lib/chunks/{chunk-QHUDJVPJ.js → chunk-GLUGYZQO.js} +7 -7
- package/dist/lib/chunks/{chunk-GNMFJ2OK.js → chunk-HCUJ2J7P.js} +8 -8
- package/dist/lib/chunks/{chunk-2ROXN2EC.js → chunk-HGGOGCPX.js} +10 -10
- package/dist/lib/chunks/{chunk-VPZQGND4.js → chunk-HGGRPOSA.js} +3 -3
- package/dist/lib/chunks/{chunk-EJ655TVU.js → chunk-I3UE52ZV.js} +2 -2
- package/dist/lib/chunks/{chunk-ML4W6KC6.js → chunk-J5NPHPXY.js} +5 -4
- package/dist/lib/chunks/{chunk-HFRAHG5C.js → chunk-J7QKT5E7.js} +17 -17
- package/dist/lib/chunks/{chunk-V7OAPKNF.js → chunk-JBOOD6MU.js} +10 -9
- package/dist/lib/chunks/{chunk-YAAUWCJ4.js → chunk-JKPBXPCW.js} +3 -3
- package/dist/lib/chunks/{chunk-5HT55QYX.js → chunk-JQDQVG3D.js} +1 -1
- package/dist/lib/chunks/{chunk-GESHTTSA.js → chunk-JYCVBFH5.js} +2 -2
- package/dist/lib/chunks/{chunk-W2VGLWTS.js → chunk-K2FZFESR.js} +10 -10
- package/dist/lib/chunks/{chunk-DC6PN7QJ.js → chunk-K4Y5NT4M.js} +11 -7
- package/dist/lib/chunks/chunk-K7YFL5KB.js +182 -0
- package/dist/lib/chunks/{chunk-EBUQPCKB.js → chunk-KFAT65P7.js} +1 -1
- package/dist/lib/chunks/{chunk-ZYSPTOKK.js → chunk-KQCRJIEG.js} +1 -1
- package/dist/lib/chunks/{chunk-R6XDZWUL.js → chunk-LR27H2HZ.js} +11 -11
- package/dist/lib/chunks/{chunk-FUAUPNRO.js → chunk-LTCDLURT.js} +7 -7
- package/dist/lib/chunks/{chunk-KZR25REO.js → chunk-LTI2YYU3.js} +1 -1
- package/dist/lib/chunks/{chunk-EPQHVILQ.js → chunk-MA27TFEY.js} +5 -3
- package/dist/lib/chunks/{chunk-UZJSTJFP.js → chunk-MENTBQGB.js} +6 -5
- package/dist/lib/chunks/chunk-MPJCZN4G.js +155 -0
- package/dist/lib/chunks/{chunk-BE4ENGUY.js → chunk-OOLWU667.js} +6 -6
- package/dist/lib/chunks/{chunk-QSJ4IKUF.js → chunk-PIF3GL62.js} +5 -5
- package/dist/lib/chunks/{chunk-W5X7WJYL.js → chunk-PIFTG6YW.js} +3 -3
- package/dist/lib/chunks/{chunk-YRBIC5QH.js → chunk-PKNODC6Y.js} +1 -1
- package/dist/lib/chunks/{chunk-SHUMCKCS.js → chunk-PWOYEIPF.js} +4 -4
- package/dist/lib/chunks/{chunk-RR46EDDR.js → chunk-QD3JXA3Y.js} +25 -25
- package/dist/lib/chunks/{chunk-7ZOJE6BH.js → chunk-QGZ4QSUE.js} +8 -7
- package/dist/lib/chunks/{chunk-D2INDP5W.js → chunk-R5UPOEWE.js} +9 -8
- package/dist/lib/chunks/{chunk-VKM6MMA4.js → chunk-RIJERFGU.js} +34 -3
- package/dist/lib/chunks/{chunk-5B3RNVZ6.js → chunk-RK57YZKM.js} +1 -1
- package/dist/lib/chunks/{chunk-GDKGZQ3T.js → chunk-RXSHKWZJ.js} +3 -3
- package/dist/lib/chunks/{chunk-NGHAP2P5.js → chunk-S6QOXJAL.js} +4 -4
- package/dist/lib/chunks/{chunk-6GHHNPFJ.js → chunk-SIJOQRRK.js} +1 -1
- package/dist/lib/chunks/{chunk-663HABKP.js → chunk-T6XZQOXS.js} +8 -8
- package/dist/lib/chunks/{chunk-EYKINDNK.js → chunk-TAPVCSCR.js} +1 -1
- package/dist/lib/chunks/{chunk-ISN6MBNB.js → chunk-U5USH2HB.js} +7 -7
- package/dist/lib/chunks/{chunk-MRL5RUP7.js → chunk-U6BW6LGX.js} +10 -3
- package/dist/lib/chunks/{chunk-L7MEIRJB.js → chunk-UNCUG2YS.js} +15 -6
- package/dist/lib/chunks/{chunk-3JO5TXBA.js → chunk-UYDQXXDQ.js} +4 -4
- package/dist/lib/chunks/{chunk-LOBXOZ2R.js → chunk-V5JJEEBT.js} +1 -1
- package/dist/lib/chunks/{chunk-XR44YSHT.js → chunk-VHKHYAC5.js} +30 -9
- package/dist/lib/chunks/{chunk-Z7V63UZA.js → chunk-VXDMOB7O.js} +4 -4
- package/dist/lib/chunks/{chunk-G62E525I.js → chunk-VXYQWE45.js} +2 -2
- package/dist/lib/chunks/{chunk-W5DC23OP.js → chunk-WCLKIPJV.js} +1 -1
- package/dist/lib/chunks/{chunk-7XO3SQAX.js → chunk-WDT2Y7D7.js} +1 -1
- package/dist/lib/chunks/{chunk-OVUCZLH2.js → chunk-WIBMVNIH.js} +2 -2
- package/dist/lib/chunks/{chunk-5T3V6XJS.js → chunk-WNIXDMJL.js} +1 -1
- package/dist/lib/chunks/{chunk-HTOD4W4E.js → chunk-WZGI7UVM.js} +2 -2
- package/dist/lib/chunks/{chunk-HQG63ZKO.js → chunk-XA27KAUV.js} +17 -17
- package/dist/lib/chunks/{chunk-I3XGRGXE.js → chunk-XAN4CRFP.js} +33 -41
- package/dist/lib/chunks/{chunk-AYY4MYTW.js → chunk-XFUYEFQP.js} +1 -1
- package/dist/lib/chunks/{chunk-FOCJ7HPC.js → chunk-XSER7WEB.js} +11 -11
- package/dist/lib/chunks/{chunk-WVACVWBL.js → chunk-YEUCAPKP.js} +6 -4
- package/dist/lib/chunks/{chunk-7Z27HQWL.js → chunk-YGLWQFKL.js} +3 -3
- package/dist/lib/chunks/{chunk-D7GEQVLL.js → chunk-YKJHFD64.js} +1 -1
- package/dist/lib/chunks/{chunk-OQU5IXAJ.js → chunk-ZOGIJGU3.js} +10 -10
- package/dist/lib/chunks/{chunk-5ZITQDVE.js → chunk-ZQ3ER7JD.js} +12 -13
- package/dist/lib/cli/bundle-commands.js +91 -88
- package/dist/lib/cli/run-commands.js +110 -105
- package/dist/lib/cli/status-command.js +77 -74
- package/dist/lib/codex-workflow/aggregate.js +21 -22
- package/dist/lib/codex-workflow/author-search.js +4 -3
- package/dist/lib/codex-workflow/author-tools.js +17 -15
- package/dist/lib/codex-workflow/author.js +38 -34
- package/dist/lib/codex-workflow/capture.js +25 -25
- package/dist/lib/codex-workflow/checkpoint.js +13 -13
- package/dist/lib/codex-workflow/checks.js +15 -16
- package/dist/lib/codex-workflow/copy-editor.js +31 -30
- package/dist/lib/codex-workflow/copy-recovery.js +11 -11
- package/dist/lib/codex-workflow/copy.js +28 -27
- package/dist/lib/codex-workflow/finish.js +34 -34
- package/dist/lib/codex-workflow/loop.js +65 -62
- package/dist/lib/codex-workflow/quality.js +11 -11
- package/dist/lib/codex-workflow/run-inputs.js +12 -12
- package/dist/lib/codex-workflow/run-source.js +26 -23
- package/dist/lib/codex-workflow/schemas.js +11 -11
- package/dist/lib/codex-workflow/session.js +14 -14
- package/dist/lib/codex-workflow/stage.js +45 -41
- package/dist/lib/codex-workflow/workdir.js +13 -13
- package/dist/lib/engine/audit-file.js +16 -11
- package/dist/lib/engine/author.js +53 -49
- package/dist/lib/engine/cost-estimate.js +18 -16
- package/dist/lib/engine/local-run.js +76 -73
- package/dist/lib/engine/preflight.js +12 -12
- package/dist/lib/engine/rejudge.js +82 -79
- package/dist/lib/engine/run-status.js +77 -74
- package/dist/lib/engine/templates.js +17 -12
- package/dist/lib/grounding/chromium-guard.js +13 -0
- package/dist/lib/grounding/controller.js +11 -10
- package/dist/lib/grounding/extract.js +10 -9
- package/dist/lib/grounding/fetch.js +4 -7
- package/dist/lib/grounding/file-store.js +5 -5
- package/dist/lib/grounding/grounding-runtime.js +32 -31
- package/dist/lib/grounding/guarded-request.js +18 -0
- package/dist/lib/grounding/model.js +9 -8
- package/dist/lib/grounding/profile.js +4 -4
- package/dist/lib/grounding/recorded-tools.js +16 -16
- package/dist/lib/grounding/session.js +3 -3
- package/dist/lib/grounding/tools.js +4 -3
- package/dist/lib/grounding/validation.js +2 -2
- package/dist/lib/harness/report/artifacts.js +11 -11
- package/dist/lib/harness/report/capture-coverage.js +4 -4
- package/dist/lib/lib/checkpoint.js +10 -10
- package/dist/lib/lib/progress-comparison.js +2 -2
- package/dist/lib/models/batching.js +3 -3
- package/dist/lib/models/structured.js +2 -2
- package/dist/lib/models/supported-models.js +1 -1
- package/dist/lib/pipeline.js +20 -21
- package/dist/lib/probes/agent-clis.js +10 -10
- package/dist/lib/probes/probes.js +12 -12
- package/dist/lib/probes/web-tool-guard.js +3 -3
- package/dist/lib/report/contracts.js +4 -4
- package/dist/lib/report/core/progress-comparison.js +2 -2
- package/dist/lib/report/core/progress-schema.js +2 -2
- package/dist/lib/report/core/schema.js +2 -4
- package/dist/lib/report/core/surfaces.js +1 -3
- package/dist/lib/runner.js +23 -24
- package/dist/lib/schema.js +19 -13
- package/dist/lib/section-result.js +14 -15
- package/dist/lib/stores/artifacts.js +17 -17
- package/dist/lib/stores/files.js +31 -31
- package/dist/lib/stores/local-versions.js +10 -10
- package/dist/lib/stores/memory.js +33 -33
- package/dist/lib/stores/publication.js +23 -22
- package/dist/lib/surfaces.js +1 -3
- package/dist/lib/viewer/server.js +38 -38
- package/dist/lib/workflow/schema.js +8 -8
- package/dist/types/agents/author-schema.d.ts +3 -3
- package/dist/types/analysis/scoring.d.ts +2 -2
- package/dist/types/bundle/contracts.d.ts +3 -2
- package/dist/types/checks/crawler-access.d.ts +3 -2
- package/dist/types/checks/money-pages.d.ts +19 -0
- package/dist/types/checks/renderability.d.ts +8 -1
- package/dist/types/codex-workflow/author-tools.d.ts +3 -3
- package/dist/types/codex-workflow/run-inputs.d.ts +3 -0
- package/dist/types/codex-workflow/schemas.d.ts +6 -6
- package/dist/types/engine/audit-file.d.ts +6 -1
- package/dist/types/engine/preflight.d.ts +2 -0
- package/dist/types/grounding/chromium-guard.d.ts +41 -0
- package/dist/types/grounding/fetch.d.ts +0 -10
- package/dist/types/grounding/guarded-request.d.ts +76 -0
- package/dist/types/harness/report/artifacts.d.ts +1 -0
- package/dist/types/lib/checkpoint.d.ts +5 -6
- package/dist/types/pipeline.d.ts +2 -1
- package/dist/types/probes/probes.d.ts +2 -1
- package/dist/types/report/contracts.d.ts +2 -0
- package/dist/types/report/core/schema.d.ts +3 -1
- package/dist/types/report/core/surfaces.d.ts +0 -1
- package/dist/types/schema.d.ts +22 -0
- package/dist/types/section-result.d.ts +1 -1
- package/package.json +1 -1
- package/resources/guide/OPERATOR.md +12 -3
- package/src/agents/author-schema.ts +13 -1
- package/src/agents/author-validation.ts +24 -6
- package/src/agents/facts.ts +8 -8
- package/src/agents/narrative-facts.ts +9 -20
- package/src/agents/verifier.ts +2 -2
- package/src/analysis/progress.ts +1 -0
- package/src/analysis/scoring.ts +9 -13
- package/src/bundle/contracts.ts +7 -2
- package/src/bundle/verify.ts +3 -3
- package/src/capture-manifest.ts +4 -0
- package/src/checks/crawler-access.ts +70 -50
- package/src/checks/money-pages.ts +48 -0
- package/src/checks/renderability.ts +113 -87
- package/src/checks/run-checks.ts +16 -3
- package/src/cli/run-commands.ts +2 -0
- package/src/codex-workflow/aggregate.ts +1 -0
- package/src/codex-workflow/author-tools.ts +39 -60
- package/src/codex-workflow/capture.ts +1 -0
- package/src/codex-workflow/copy-editor.ts +3 -3
- package/src/codex-workflow/loop.ts +2 -2
- package/src/engine/audit-file.ts +79 -2
- package/src/engine/guide/OPERATOR.md +12 -3
- package/src/engine/preflight.ts +50 -0
- package/src/grounding/chromium-guard.ts +273 -0
- package/src/grounding/controller.ts +1 -1
- package/src/grounding/fetch.ts +39 -276
- package/src/grounding/guarded-request.ts +428 -0
- package/src/grounding/tools.ts +2 -1
- package/src/grounding/validation.ts +1 -1
- package/src/lib/checkpoint.ts +15 -16
- package/src/models/supported-models.ts +3 -3
- package/src/pipeline.ts +13 -7
- package/src/probes/agent-clis.ts +2 -3
- package/src/probes/probes.ts +24 -10
- package/src/report/core/schema.ts +4 -1
- package/src/report/core/surfaces.ts +4 -8
- package/src/runner.ts +1 -0
- package/src/schema.ts +68 -4
- package/src/section-result.ts +6 -5
- package/dist/lib/chunks/chunk-6EH4N3EU.js +0 -113
- package/dist/lib/chunks/chunk-SWJ7KQSL.js +0 -318
- package/dist/lib/chunks/{chunk-CO5T6WU5.js → chunk-OD36HUXA.js} +3 -3
- package/dist/lib/chunks/{chunk-XI5H46DF.js → chunk-SASE7U6E.js} +3 -3
package/src/analysis/scoring.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { normalizeDomain } from '../report/core/normalize-domain';
|
|
2
|
-
import type
|
|
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
|
-
//
|
|
66
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
|
93
|
-
const total = prompts.length * runsPerPrompt;
|
|
89
|
+
const total = prompts.length * runsPerPromptOn(surface, depth);
|
|
94
90
|
|
|
95
91
|
byModel[surface] = {
|
|
96
92
|
sov:
|
package/src/bundle/contracts.ts
CHANGED
|
@@ -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.
|
|
17
|
-
|
|
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
|
package/src/bundle/verify.ts
CHANGED
|
@@ -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]
|
|
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 ${
|
|
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
|
}
|
package/src/capture-manifest.ts
CHANGED
|
@@ -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
|
|
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
|
|
69
|
-
const
|
|
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
|
|
101
|
-
return
|
|
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 =
|
|
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
|
|
115
|
-
|
|
116
|
-
|
|
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.
|
|
120
|
-
robotsBody =
|
|
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 =
|
|
142
|
+
robotsFetchError = describeSiteError(error);
|
|
129
143
|
}
|
|
130
144
|
|
|
131
145
|
const groups = robotsBody !== null ? parseRobotsTxt(robotsBody) : null;
|
|
132
146
|
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
const
|
|
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
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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', {
|
|
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
|
-
|
|
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.
|
|
172
|
-
// called five bots blocked on that evidence
|
|
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
|
|
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 =
|
|
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
|
-
|
|
235
|
-
|
|
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
|
|
259
|
+
const isTextFileServed = async (
|
|
260
|
+
url: string,
|
|
261
|
+
request: SiteRequest,
|
|
262
|
+
): Promise<boolean> => {
|
|
244
263
|
try {
|
|
245
|
-
const response = await
|
|
246
|
-
|
|
247
|
-
|
|
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 (
|
|
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
|
-
|
|
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 {
|
|
3
|
-
import
|
|
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
|
|
13
|
-
//
|
|
14
|
-
//
|
|
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
|
|
18
|
-
const
|
|
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
|
|
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 {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
128
|
+
context: BrowserContext,
|
|
129
|
+
site: PagedSite,
|
|
75
130
|
): Promise<RenderabilityResult> => {
|
|
76
131
|
try {
|
|
77
|
-
const response = await
|
|
78
|
-
|
|
79
|
-
|
|
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 (
|
|
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(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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:
|
|
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
|
|