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/dist/cli.mjs
CHANGED
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __esm = (fn, res, err) => function __init() {
|
|
6
|
-
if (err) throw err[0];
|
|
7
|
-
try {
|
|
8
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
-
} catch (e) {
|
|
10
|
-
throw err = [e], e;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// src/api/errors.ts
|
|
15
|
-
var init_errors = __esm({
|
|
16
|
-
"src/api/errors.ts"() {
|
|
17
|
-
"use strict";
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// src/workflow/callbacks.ts
|
|
22
|
-
import { isIP } from "node:net";
|
|
23
|
-
var isPublicAddress;
|
|
24
|
-
var init_callbacks = __esm({
|
|
25
|
-
"src/workflow/callbacks.ts"() {
|
|
26
|
-
"use strict";
|
|
27
|
-
init_errors();
|
|
28
|
-
isPublicAddress = (address) => {
|
|
29
|
-
if (isIP(address) === 4) {
|
|
30
|
-
const [a, b] = address.split(".").map(Number);
|
|
31
|
-
if (a === void 0 || b === void 0) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return !(a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && (b === 168 || b === 0) || a === 198 && (b === 18 || b === 19) || a >= 224);
|
|
35
|
-
}
|
|
36
|
-
return isIP(address) === 6 && /^[23][0-9a-f]{3}:/i.test(address) && !address.toLowerCase().startsWith("2001:db8:");
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
4
|
|
|
41
5
|
// src/cli/literally-aeo.ts
|
|
42
6
|
import { Console } from "node:console";
|
|
@@ -96,9 +60,6 @@ var surfaceRunCounts = {
|
|
|
96
60
|
codex: 2,
|
|
97
61
|
cursor: 2
|
|
98
62
|
};
|
|
99
|
-
var plannedRunsPerPrompt = (surfaces) => {
|
|
100
|
-
return surfaces.reduce((sum, surface) => sum + surfaceRunCounts[surface], 0);
|
|
101
|
-
};
|
|
102
63
|
|
|
103
64
|
// src/report/core/progress-schema.ts
|
|
104
65
|
var digest = z.string().regex(/^[a-f0-9]{64}$/);
|
|
@@ -424,6 +385,10 @@ var aeoTechnicalChecksSchema = z2.object({
|
|
|
424
385
|
robotsUrl: z2.string(),
|
|
425
386
|
fetchedAt: z2.string(),
|
|
426
387
|
robotsFetchError: z2.string().nullable(),
|
|
388
|
+
// True when robots.txt ran past the 500 KiB RFC 9309 asks a reader to
|
|
389
|
+
// parse: the verdicts rest on that prefix. Absent on snapshots written
|
|
390
|
+
// before the bound existed.
|
|
391
|
+
robotsTruncated: z2.boolean().optional(),
|
|
427
392
|
bots: z2.array(
|
|
428
393
|
z2.object({
|
|
429
394
|
bot: z2.string(),
|
|
@@ -1494,7 +1459,6 @@ var clientReportBundleSchema = z9.discriminatedUnion("state", [
|
|
|
1494
1459
|
|
|
1495
1460
|
// src/access/schema.ts
|
|
1496
1461
|
import { z as z10 } from "zod";
|
|
1497
|
-
init_errors();
|
|
1498
1462
|
var identity = z10.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/);
|
|
1499
1463
|
var reportAudienceSchema = z10.enum([
|
|
1500
1464
|
"client_private",
|
|
@@ -1656,14 +1620,29 @@ var aeoSectionConfigSchema = z12.object({
|
|
|
1656
1620
|
// markets. Omitted → the report-level set (the union shown on the page).
|
|
1657
1621
|
competitors: z12.array(brandSchema).optional()
|
|
1658
1622
|
});
|
|
1623
|
+
var maxRunsPerPrompt = 25;
|
|
1624
|
+
var runsPerPromptSchema = z12.number().int().min(1).max(maxRunsPerPrompt);
|
|
1659
1625
|
var agentProbeConfigSchema = z12.object({
|
|
1660
1626
|
// Runs per prompt per agent surface.
|
|
1661
|
-
runsPerPrompt:
|
|
1627
|
+
runsPerPrompt: runsPerPromptSchema.default(2),
|
|
1662
1628
|
// Cap on how many of each section's prompts get agent probes — the FIRST N
|
|
1663
1629
|
// prompts in config order, so the subset is stable across runs. Omitted =
|
|
1664
1630
|
// all prompts.
|
|
1665
1631
|
maxPromptsPerSection: z12.number().int().min(1).optional()
|
|
1666
1632
|
});
|
|
1633
|
+
var agentProbedPrompts = (prompts, agentProbes) => {
|
|
1634
|
+
return prompts.slice(0, agentProbes.maxPromptsPerSection ?? prompts.length);
|
|
1635
|
+
};
|
|
1636
|
+
var chatProbeConfigSchema = z12.object({ runsPerPrompt: runsPerPromptSchema }).strict();
|
|
1637
|
+
var chatRunsPerPrompt = (surface, chatProbes) => {
|
|
1638
|
+
return chatProbes?.runsPerPrompt ?? surfaceRunCounts[surface];
|
|
1639
|
+
};
|
|
1640
|
+
var runsPerPromptOn = (surface, depth) => {
|
|
1641
|
+
if (isAgentSurface(surface)) {
|
|
1642
|
+
return depth.agentProbes.runsPerPrompt;
|
|
1643
|
+
}
|
|
1644
|
+
return chatRunsPerPrompt(surface, depth.chatProbes);
|
|
1645
|
+
};
|
|
1667
1646
|
var ownedCompetitorDomainSchema = z12.string().trim().regex(
|
|
1668
1647
|
/^(?=.{1,253}$)(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.?$/,
|
|
1669
1648
|
"Expected a domain name without a URL, path or port"
|
|
@@ -1686,6 +1665,9 @@ var aeoAuditConfigSchema = z12.object({
|
|
|
1686
1665
|
// the schema — consumers read config.agentProbes directly, no fallbacks.
|
|
1687
1666
|
// prefault({}) runs {} through the inner schema so its own defaults fill.
|
|
1688
1667
|
agentProbes: agentProbeConfigSchema.prefault({}),
|
|
1668
|
+
// Read through runsPerPromptOn or chatRunsPerPrompt, which own the
|
|
1669
|
+
// fallback to the canonical counts.
|
|
1670
|
+
chatProbes: chatProbeConfigSchema.optional(),
|
|
1689
1671
|
// Renderability targets — docs, pricing, comparison pages (§7.4).
|
|
1690
1672
|
moneyPages: z12.array(z12.string().url()),
|
|
1691
1673
|
// Grounds accuracy flagging (§7.2): claims contradicting this brief are
|
|
@@ -2050,8 +2032,9 @@ var encodeBundleJson = (value) => {
|
|
|
2050
2032
|
|
|
2051
2033
|
// src/bundle/contracts.ts
|
|
2052
2034
|
var toolId = "literally-aeo";
|
|
2053
|
-
var toolVersion = "0.2.
|
|
2054
|
-
var bundleSchemaVersion =
|
|
2035
|
+
var toolVersion = "0.2.2";
|
|
2036
|
+
var bundleSchemaVersion = 2;
|
|
2037
|
+
var readableBundleSchemaVersions = [1, 2];
|
|
2055
2038
|
var traceSchemaVersion = 1;
|
|
2056
2039
|
var canonicalization = "literally-aeo-canonical-json-v1";
|
|
2057
2040
|
var calculationVersion = 1;
|
|
@@ -2504,11 +2487,11 @@ var unitRecordKey = (unit) => {
|
|
|
2504
2487
|
var plannedProbeUnitsForSection = (args) => {
|
|
2505
2488
|
const chatSurfaces2 = args.surfaces.filter((s) => !isAgentSurface(s));
|
|
2506
2489
|
const agentSurfaces2 = args.surfaces.filter(isAgentSurface);
|
|
2507
|
-
const agentPrompts = args.
|
|
2490
|
+
const agentPrompts = agentProbedPrompts(args.prompts, args.agentProbes);
|
|
2508
2491
|
const units = [];
|
|
2509
2492
|
for (const prompt of args.prompts) {
|
|
2510
2493
|
for (const surface of chatSurfaces2) {
|
|
2511
|
-
for (let run = 1; run <=
|
|
2494
|
+
for (let run = 1; run <= runsPerPromptOn(surface, args); run += 1) {
|
|
2512
2495
|
units.push(
|
|
2513
2496
|
createUnit({
|
|
2514
2497
|
sectionKey: args.sectionKey,
|
|
@@ -2522,7 +2505,7 @@ var plannedProbeUnitsForSection = (args) => {
|
|
|
2522
2505
|
}
|
|
2523
2506
|
for (const prompt of agentPrompts) {
|
|
2524
2507
|
for (const surface of agentSurfaces2) {
|
|
2525
|
-
for (let run = 1; run <= args
|
|
2508
|
+
for (let run = 1; run <= runsPerPromptOn(surface, args); run += 1) {
|
|
2526
2509
|
units.push(
|
|
2527
2510
|
createUnit({
|
|
2528
2511
|
sectionKey: args.sectionKey,
|
|
@@ -2705,6 +2688,9 @@ var capturePlan = (config, surfaces, sections) => {
|
|
|
2705
2688
|
geography: config.geography,
|
|
2706
2689
|
language: config.language,
|
|
2707
2690
|
agentProbes: config.agentProbes,
|
|
2691
|
+
// Undefined members are dropped, so a config without chat depth keeps
|
|
2692
|
+
// the digest earlier releases gave it.
|
|
2693
|
+
chatProbes: config.chatProbes,
|
|
2708
2694
|
surfaces
|
|
2709
2695
|
});
|
|
2710
2696
|
const plan = {
|
|
@@ -2714,7 +2700,8 @@ var capturePlan = (config, surfaces, sections) => {
|
|
|
2714
2700
|
sectionKey: section.key,
|
|
2715
2701
|
prompts: section.prompts,
|
|
2716
2702
|
surfaces,
|
|
2717
|
-
agentProbes: config.agentProbes
|
|
2703
|
+
agentProbes: config.agentProbes,
|
|
2704
|
+
chatProbes: config.chatProbes
|
|
2718
2705
|
})
|
|
2719
2706
|
)
|
|
2720
2707
|
};
|
|
@@ -3426,8 +3413,14 @@ var authorOutputSchema = aeoAuditConfigSchema.omit({
|
|
|
3426
3413
|
agentReadiness: true,
|
|
3427
3414
|
sourceOverrides: true,
|
|
3428
3415
|
productGrounding: true,
|
|
3429
|
-
competitorQualification: true
|
|
3416
|
+
competitorQualification: true,
|
|
3417
|
+
// Depth decides what a run costs, so the operator sets it in audit.json
|
|
3418
|
+
// with the estimate in front of them, never the author.
|
|
3419
|
+
chatProbes: true
|
|
3430
3420
|
}).extend({
|
|
3421
|
+
// The agent batch the author could always propose: 1 or 2 runs per
|
|
3422
|
+
// prompt. A deeper one is the operator's call, as chat depth is.
|
|
3423
|
+
agentProbes: agentProbeConfigSchema.extend({ runsPerPrompt: z19.number().int().min(1).max(2).default(2) }).prefault({}),
|
|
3431
3424
|
sections: z19.array(
|
|
3432
3425
|
aeoSectionConfigSchema.extend({
|
|
3433
3426
|
key: z19.string().regex(
|
|
@@ -6269,8 +6262,11 @@ var stripWww = (host) => {
|
|
|
6269
6262
|
|
|
6270
6263
|
// src/analysis/scoring.ts
|
|
6271
6264
|
var computeAISearchSummary = (args) => {
|
|
6272
|
-
const { competitorDomains, prompts, results, surfaces } = args;
|
|
6273
|
-
const totalRunsPerPrompt =
|
|
6265
|
+
const { competitorDomains, prompts, results, surfaces, depth } = args;
|
|
6266
|
+
const totalRunsPerPrompt = surfaces.reduce(
|
|
6267
|
+
(sum, surface) => sum + runsPerPromptOn(surface, depth),
|
|
6268
|
+
0
|
|
6269
|
+
);
|
|
6274
6270
|
const totalPrompts = prompts.length * totalRunsPerPrompt;
|
|
6275
6271
|
const mentioned = results.filter((r) => r.clientMentioned).length;
|
|
6276
6272
|
const cited = results.filter((r) => r.clientCited).length;
|
|
@@ -6279,8 +6275,7 @@ var computeAISearchSummary = (args) => {
|
|
|
6279
6275
|
const byModel = {};
|
|
6280
6276
|
for (const surface of surfaces) {
|
|
6281
6277
|
const modelResults = results.filter((r) => r.model === surface);
|
|
6282
|
-
const
|
|
6283
|
-
const total = prompts.length * runsPerPrompt;
|
|
6278
|
+
const total = prompts.length * runsPerPromptOn(surface, depth);
|
|
6284
6279
|
byModel[surface] = {
|
|
6285
6280
|
sov: total > 0 ? modelResults.filter((r) => r.clientMentioned).length / total * 100 : 0,
|
|
6286
6281
|
citation: total > 0 ? modelResults.filter((r) => r.clientCited).length / total * 100 : 0
|
|
@@ -6388,8 +6383,8 @@ var assembleSectionResult = (args, capture, analyses) => {
|
|
|
6388
6383
|
const selectedAgentSurfaces = args.surfaces.filter(
|
|
6389
6384
|
(s) => isAgentSurface(s)
|
|
6390
6385
|
);
|
|
6391
|
-
const
|
|
6392
|
-
const agentPrompts = args.
|
|
6386
|
+
const depth = { agentProbes: args.agentProbes, chatProbes: args.chatProbes };
|
|
6387
|
+
const agentPrompts = agentProbedPrompts(args.prompts, args.agentProbes);
|
|
6393
6388
|
const probeCount = capture.probeCount;
|
|
6394
6389
|
const analysisFailures = analyses.flatMap(
|
|
6395
6390
|
(analysis) => analysis.error === null ? [] : [{ promptId: analysis.promptId, error: analysis.error }]
|
|
@@ -6414,7 +6409,8 @@ var assembleSectionResult = (args, capture, analyses) => {
|
|
|
6414
6409
|
competitorDomains,
|
|
6415
6410
|
prompts: promptsForScoring,
|
|
6416
6411
|
results: allResults.filter((r) => !isAgentSurface(r.surface)).map(toScoringInput),
|
|
6417
|
-
surfaces: selectedChatSurfaces
|
|
6412
|
+
surfaces: selectedChatSurfaces,
|
|
6413
|
+
depth
|
|
6418
6414
|
}) : null;
|
|
6419
6415
|
const agentResults = allResults.filter((r) => isAgentSurface(r.surface));
|
|
6420
6416
|
const agentSummary = selectedAgentSurfaces.length > 0 && agentPromptsForScoring.length > 0 ? computeAISearchSummary({
|
|
@@ -6425,7 +6421,7 @@ var assembleSectionResult = (args, capture, analyses) => {
|
|
|
6425
6421
|
prompts: agentPromptsForScoring,
|
|
6426
6422
|
results: agentResults.map(toScoringInput),
|
|
6427
6423
|
surfaces: selectedAgentSurfaces,
|
|
6428
|
-
|
|
6424
|
+
depth
|
|
6429
6425
|
}) : null;
|
|
6430
6426
|
const byModel = {};
|
|
6431
6427
|
for (const summary of [chatSummary, agentSummary]) {
|
|
@@ -7051,7 +7047,8 @@ var aggregateJudgments = (inputs, judgments) => {
|
|
|
7051
7047
|
competitors,
|
|
7052
7048
|
prompts: section.prompts,
|
|
7053
7049
|
surfaces: inputs.surfaces,
|
|
7054
|
-
agentProbes: config.agentProbes
|
|
7050
|
+
agentProbes: config.agentProbes,
|
|
7051
|
+
chatProbes: config.chatProbes
|
|
7055
7052
|
},
|
|
7056
7053
|
{
|
|
7057
7054
|
probeCount: sectionCapture.units.length,
|
|
@@ -7130,18 +7127,26 @@ var countQualified = (matrix) => {
|
|
|
7130
7127
|
return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([name, answers]) => ({ name, answers }));
|
|
7131
7128
|
};
|
|
7132
7129
|
|
|
7133
|
-
// src/grounding/
|
|
7130
|
+
// src/grounding/guarded-request.ts
|
|
7134
7131
|
import { lookup } from "node:dns/promises";
|
|
7135
|
-
import { isIP as isIP2 } from "node:net";
|
|
7136
7132
|
import { request } from "node:https";
|
|
7137
|
-
import {
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7133
|
+
import { isIP as isIP2 } from "node:net";
|
|
7134
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
7135
|
+
|
|
7136
|
+
// src/workflow/callbacks.ts
|
|
7137
|
+
import { isIP } from "node:net";
|
|
7138
|
+
var isPublicAddress = (address) => {
|
|
7139
|
+
if (isIP(address) === 4) {
|
|
7140
|
+
const [a, b] = address.split(".").map(Number);
|
|
7141
|
+
if (a === void 0 || b === void 0) {
|
|
7142
|
+
return false;
|
|
7143
|
+
}
|
|
7144
|
+
return !(a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && (b === 168 || b === 0) || a === 198 && (b === 18 || b === 19) || a >= 224);
|
|
7145
|
+
}
|
|
7146
|
+
return isIP(address) === 6 && /^[23][0-9a-f]{3}:/i.test(address) && !address.toLowerCase().startsWith("2001:db8:");
|
|
7144
7147
|
};
|
|
7148
|
+
|
|
7149
|
+
// src/grounding/guarded-request.ts
|
|
7145
7150
|
var SourceRetrievalError = class extends Error {
|
|
7146
7151
|
reason;
|
|
7147
7152
|
status;
|
|
@@ -7178,15 +7183,6 @@ var validateResearchUrl = (value) => {
|
|
|
7178
7183
|
url.hash = "";
|
|
7179
7184
|
return url;
|
|
7180
7185
|
};
|
|
7181
|
-
var canonicalResearchUrl = (value) => {
|
|
7182
|
-
const url = new URL(value);
|
|
7183
|
-
url.hash = "";
|
|
7184
|
-
url.hostname = url.hostname.toLowerCase();
|
|
7185
|
-
if (url.pathname.length > 1 && url.pathname.endsWith("/")) {
|
|
7186
|
-
url.pathname = url.pathname.slice(0, -1);
|
|
7187
|
-
}
|
|
7188
|
-
return url.href;
|
|
7189
|
-
};
|
|
7190
7186
|
var withAbort = (promise, signal) => {
|
|
7191
7187
|
signal.throwIfAborted();
|
|
7192
7188
|
return new Promise((resolve, reject) => {
|
|
@@ -7199,9 +7195,12 @@ var withAbort = (promise, signal) => {
|
|
|
7199
7195
|
});
|
|
7200
7196
|
});
|
|
7201
7197
|
};
|
|
7202
|
-
var
|
|
7203
|
-
|
|
7204
|
-
|
|
7198
|
+
var lookupAll = (host) => {
|
|
7199
|
+
return lookup(host, { all: true });
|
|
7200
|
+
};
|
|
7201
|
+
var resolvePublicAddress = async (hostname2, signal, lookupHost = lookupAll) => {
|
|
7202
|
+
const host = hostname2.replace(/^\[|\]$/g, "");
|
|
7203
|
+
const addresses = await withAbort(lookupHost(host), signal);
|
|
7205
7204
|
if (addresses.length === 0 || addresses.some(({ address }) => !isPublicAddress(address))) {
|
|
7206
7205
|
throw new SourceRetrievalError(
|
|
7207
7206
|
"unsafe_destination",
|
|
@@ -7215,6 +7214,40 @@ var requestDocument = async (url, signal) => {
|
|
|
7215
7214
|
`Source DNS returned no address: ${host}.`
|
|
7216
7215
|
);
|
|
7217
7216
|
}
|
|
7217
|
+
return firstAddress;
|
|
7218
|
+
};
|
|
7219
|
+
var createHostPacer = (intervalInMs, wait = delay) => {
|
|
7220
|
+
const lastRequestByHost = /* @__PURE__ */ new Map();
|
|
7221
|
+
return (url, send2) => {
|
|
7222
|
+
const previous = lastRequestByHost.get(url.hostname);
|
|
7223
|
+
const current = (async () => {
|
|
7224
|
+
if (previous) {
|
|
7225
|
+
await previous;
|
|
7226
|
+
await wait(intervalInMs);
|
|
7227
|
+
}
|
|
7228
|
+
return send2();
|
|
7229
|
+
})();
|
|
7230
|
+
lastRequestByHost.set(
|
|
7231
|
+
url.hostname,
|
|
7232
|
+
current.catch(() => void 0)
|
|
7233
|
+
);
|
|
7234
|
+
return current;
|
|
7235
|
+
};
|
|
7236
|
+
};
|
|
7237
|
+
var describeSiteError = (error) => {
|
|
7238
|
+
if (error instanceof SourceRetrievalError) {
|
|
7239
|
+
return `${error.reason}: ${error.message}`;
|
|
7240
|
+
}
|
|
7241
|
+
return error instanceof Error ? error.message : String(error);
|
|
7242
|
+
};
|
|
7243
|
+
var isRedirect = (status) => {
|
|
7244
|
+
return status >= 300 && status < 400;
|
|
7245
|
+
};
|
|
7246
|
+
var isSuccess = (status) => {
|
|
7247
|
+
return status >= 200 && status < 300;
|
|
7248
|
+
};
|
|
7249
|
+
var requestHop = async (url, options, signal) => {
|
|
7250
|
+
const address = await resolvePublicAddress(url.hostname, signal);
|
|
7218
7251
|
signal.throwIfAborted();
|
|
7219
7252
|
return new Promise((resolve, reject) => {
|
|
7220
7253
|
const req = request(
|
|
@@ -7223,43 +7256,40 @@ var requestDocument = async (url, signal) => {
|
|
|
7223
7256
|
method: "GET",
|
|
7224
7257
|
signal,
|
|
7225
7258
|
headers: {
|
|
7226
|
-
"accept":
|
|
7259
|
+
"accept": options.accept,
|
|
7260
|
+
// Never a compressed body: nothing to decompress, so no bomb to
|
|
7261
|
+
// bound. An encoded body despite this is refused below.
|
|
7227
7262
|
"accept-encoding": "identity",
|
|
7228
|
-
"user-agent":
|
|
7263
|
+
"user-agent": options.userAgent
|
|
7229
7264
|
},
|
|
7230
|
-
lookup: (_host,
|
|
7231
|
-
if (
|
|
7232
|
-
callback(null, [
|
|
7265
|
+
lookup: (_host, lookupOptions, callback) => {
|
|
7266
|
+
if (lookupOptions.all) {
|
|
7267
|
+
callback(null, [address]);
|
|
7233
7268
|
} else {
|
|
7234
|
-
callback(null,
|
|
7269
|
+
callback(null, address.address, address.family);
|
|
7235
7270
|
}
|
|
7236
7271
|
}
|
|
7237
7272
|
},
|
|
7238
7273
|
(response) => {
|
|
7239
7274
|
const status = response.statusCode ?? 0;
|
|
7240
7275
|
const contentType = response.headers["content-type"] ?? "";
|
|
7241
|
-
|
|
7242
|
-
|
|
7276
|
+
const encoding = response.headers["content-encoding"];
|
|
7277
|
+
const policy = options.body;
|
|
7278
|
+
const settle = (body, isTruncated) => {
|
|
7243
7279
|
resolve({
|
|
7244
7280
|
status,
|
|
7245
7281
|
location: response.headers.location,
|
|
7246
7282
|
contentType,
|
|
7247
|
-
body
|
|
7283
|
+
body,
|
|
7284
|
+
isTruncated
|
|
7248
7285
|
});
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
if (status < 200 || status >= 300) {
|
|
7286
|
+
};
|
|
7287
|
+
if (!policy || !isSuccess(status)) {
|
|
7252
7288
|
response.destroy();
|
|
7253
|
-
|
|
7254
|
-
new SourceRetrievalError("http_error", `Source HTTP ${status}.`, {
|
|
7255
|
-
status
|
|
7256
|
-
})
|
|
7257
|
-
);
|
|
7289
|
+
settle(void 0, false);
|
|
7258
7290
|
return;
|
|
7259
7291
|
}
|
|
7260
|
-
if (
|
|
7261
|
-
contentType
|
|
7262
|
-
) || response.headers["content-encoding"] && response.headers["content-encoding"] !== "identity") {
|
|
7292
|
+
if (policy.contentTypes !== "any" && !policy.contentTypes.test(contentType) || encoding && encoding !== "identity") {
|
|
7263
7293
|
response.destroy();
|
|
7264
7294
|
reject(
|
|
7265
7295
|
new SourceRetrievalError(
|
|
@@ -7273,8 +7303,12 @@ var requestDocument = async (url, signal) => {
|
|
|
7273
7303
|
let bytes = 0;
|
|
7274
7304
|
response.on("data", (chunk) => {
|
|
7275
7305
|
bytes += chunk.length;
|
|
7276
|
-
if (bytes
|
|
7277
|
-
|
|
7306
|
+
if (bytes <= policy.maxBytes) {
|
|
7307
|
+
chunks.push(chunk);
|
|
7308
|
+
return;
|
|
7309
|
+
}
|
|
7310
|
+
response.destroy();
|
|
7311
|
+
if (policy.oversize === "refuse") {
|
|
7278
7312
|
reject(
|
|
7279
7313
|
new SourceRetrievalError(
|
|
7280
7314
|
"too_large",
|
|
@@ -7283,15 +7317,18 @@ var requestDocument = async (url, signal) => {
|
|
|
7283
7317
|
);
|
|
7284
7318
|
return;
|
|
7285
7319
|
}
|
|
7286
|
-
|
|
7320
|
+
const kept = Buffer.concat(chunks);
|
|
7321
|
+
settle(
|
|
7322
|
+
Buffer.concat([
|
|
7323
|
+
kept,
|
|
7324
|
+
chunk.subarray(0, policy.maxBytes - kept.length)
|
|
7325
|
+
]),
|
|
7326
|
+
true
|
|
7327
|
+
);
|
|
7287
7328
|
});
|
|
7288
7329
|
response.once("error", reject);
|
|
7289
7330
|
response.once("end", () => {
|
|
7290
|
-
|
|
7291
|
-
status,
|
|
7292
|
-
contentType,
|
|
7293
|
-
body: Buffer.concat(chunks).toString("utf8")
|
|
7294
|
-
});
|
|
7331
|
+
settle(Buffer.concat(chunks), false);
|
|
7295
7332
|
});
|
|
7296
7333
|
}
|
|
7297
7334
|
);
|
|
@@ -7299,131 +7336,51 @@ var requestDocument = async (url, signal) => {
|
|
|
7299
7336
|
req.end();
|
|
7300
7337
|
});
|
|
7301
7338
|
};
|
|
7302
|
-
var
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
validateResearchUrl(args.requestedUrl);
|
|
7308
|
-
if (Buffer.byteLength(args.body) > sourceLimits.receivedBytes) {
|
|
7309
|
-
throw new SourceRetrievalError(
|
|
7310
|
-
"too_large",
|
|
7311
|
-
`Source response exceeds byte limit: ${Buffer.byteLength(args.body)} bytes.`
|
|
7312
|
-
);
|
|
7313
|
-
}
|
|
7314
|
-
let text;
|
|
7315
|
-
let title = "";
|
|
7316
|
-
let sourceDate = null;
|
|
7317
|
-
const links = [];
|
|
7318
|
-
if (/html/i.test(args.contentType)) {
|
|
7319
|
-
const $ = load(args.body);
|
|
7320
|
-
title = $("title").first().text().trim().slice(0, 500);
|
|
7321
|
-
const declaredDate = $('meta[property="article:published_time"]').attr("content") ?? $('meta[name="date"]').attr("content");
|
|
7322
|
-
if (declaredDate && /^\d{4}-\d{2}-\d{2}(?:T|$)/.test(declaredDate) && Number.isFinite(Date.parse(declaredDate))) {
|
|
7323
|
-
sourceDate = new Date(declaredDate).toISOString();
|
|
7324
|
-
}
|
|
7325
|
-
$(
|
|
7326
|
-
"script,style,noscript,iframe,object,embed,svg,form,input,button,nav,footer,header"
|
|
7327
|
-
).remove();
|
|
7328
|
-
$("a[href]").each((_index, element) => {
|
|
7329
|
-
const href = $(element).attr("href");
|
|
7330
|
-
if (links.length >= 100 || href === void 0) {
|
|
7331
|
-
return;
|
|
7332
|
-
}
|
|
7333
|
-
try {
|
|
7334
|
-
const url = validateResearchUrl(new URL(href, final).href).href;
|
|
7335
|
-
if (!links.includes(url)) {
|
|
7336
|
-
links.push(url);
|
|
7337
|
-
}
|
|
7338
|
-
} catch {
|
|
7339
|
-
}
|
|
7340
|
-
});
|
|
7341
|
-
$("p,div,li,h1,h2,h3,h4,section,article,br,tr").append("\n");
|
|
7342
|
-
text = ($("main").length ? $("main").text() : $("body").text()).replace(/[\t\r ]+/g, " ").replace(/\n\s*\n+/g, "\n\n").trim();
|
|
7343
|
-
} else {
|
|
7344
|
-
text = args.body.replace(/\r\n/g, "\n").trim();
|
|
7345
|
-
}
|
|
7346
|
-
if (!text) {
|
|
7347
|
-
throw new SourceRetrievalError(
|
|
7348
|
-
"empty_content",
|
|
7349
|
-
`No readable source text: ${final.href}.`
|
|
7350
|
-
);
|
|
7351
|
-
}
|
|
7352
|
-
const documentDigest = contentHash(text);
|
|
7353
|
-
const retained = boundedUtf8(text, sourceLimits.retainedBytes);
|
|
7354
|
-
const id2 = `src_${contentHash({ url: final.href, documentDigest }).slice(0, 32)}`;
|
|
7355
|
-
const passages = [
|
|
7356
|
-
{ id: `${id2}_p0`, text: retained, digest: contentHash(retained) }
|
|
7357
|
-
];
|
|
7358
|
-
return {
|
|
7359
|
-
source: {
|
|
7360
|
-
id: id2,
|
|
7361
|
-
requestedUrl: args.requestedUrl,
|
|
7362
|
-
finalUrl: final.href,
|
|
7363
|
-
title,
|
|
7364
|
-
publisher: final.hostname,
|
|
7365
|
-
provenance: args.firstPartyHosts?.includes(final.hostname) ? "first_party" : "unknown",
|
|
7366
|
-
fetchedAt: args.fetchedAt,
|
|
7367
|
-
sourceDate,
|
|
7368
|
-
documentDigest,
|
|
7369
|
-
retainedDigest: contentHash(passages.map((passage) => passage.text)),
|
|
7370
|
-
passages,
|
|
7371
|
-
extractionVersion: sourceExtractionVersion,
|
|
7372
|
-
truncated: retained !== text
|
|
7373
|
-
},
|
|
7374
|
-
links,
|
|
7375
|
-
// The whole extracted text, for a reader that keeps more than the
|
|
7376
|
-
// grounding passage (the author's research tools keep 32 KB).
|
|
7377
|
-
text
|
|
7378
|
-
};
|
|
7379
|
-
};
|
|
7380
|
-
var fetchGroundingSource = async (args) => {
|
|
7381
|
-
const signal = AbortSignal.any([
|
|
7382
|
-
AbortSignal.timeout(sourceLimits.timeoutMs),
|
|
7383
|
-
...args.signal ? [args.signal] : []
|
|
7384
|
-
]);
|
|
7385
|
-
let url = validateResearchUrl(args.url);
|
|
7339
|
+
var guardedRequest = async (options) => {
|
|
7340
|
+
const pace = options.pace ?? ((_url, send2) => send2());
|
|
7341
|
+
const hops = [];
|
|
7342
|
+
let url = validateResearchUrl(options.url);
|
|
7343
|
+
let hopSignal;
|
|
7386
7344
|
try {
|
|
7387
|
-
for (let redirects = 0;
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7345
|
+
for (let redirects = 0; ; redirects += 1) {
|
|
7346
|
+
const target = url;
|
|
7347
|
+
const response = await pace(target, () => {
|
|
7348
|
+
options.signal?.throwIfAborted();
|
|
7349
|
+
const signal = AbortSignal.any([
|
|
7350
|
+
AbortSignal.timeout(options.timeoutInMs),
|
|
7351
|
+
...options.signal ? [options.signal] : []
|
|
7352
|
+
]);
|
|
7353
|
+
hopSignal = signal;
|
|
7354
|
+
return requestHop(target, options, signal);
|
|
7355
|
+
});
|
|
7356
|
+
hops.push({ url: target.href, status: response.status });
|
|
7357
|
+
if (!isRedirect(response.status)) {
|
|
7358
|
+
const { location: _location, ...final } = response;
|
|
7359
|
+
return { ...final, url: target.href, hops };
|
|
7360
|
+
}
|
|
7361
|
+
if (!response.location) {
|
|
7362
|
+
throw new SourceRetrievalError(
|
|
7363
|
+
"http_error",
|
|
7364
|
+
`Source redirect without a location: ${target.href}.`
|
|
7365
|
+
);
|
|
7400
7366
|
}
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
firstPartyHosts: args.firstPartyHosts
|
|
7409
|
-
}),
|
|
7410
|
-
requestCount: redirects + 1,
|
|
7411
|
-
bytes: Buffer.byteLength(response.body)
|
|
7412
|
-
};
|
|
7367
|
+
if (redirects === options.redirects) {
|
|
7368
|
+
throw new SourceRetrievalError(
|
|
7369
|
+
"http_error",
|
|
7370
|
+
`Source redirect limit exceeded: ${target.href}.`
|
|
7371
|
+
);
|
|
7372
|
+
}
|
|
7373
|
+
url = validateResearchUrl(new URL(response.location, target).href);
|
|
7413
7374
|
}
|
|
7414
|
-
throw new SourceRetrievalError(
|
|
7415
|
-
"http_error",
|
|
7416
|
-
`Source redirect limit exceeded: ${url.href}.`
|
|
7417
|
-
);
|
|
7418
7375
|
} catch (error) {
|
|
7419
|
-
if (
|
|
7420
|
-
throw
|
|
7376
|
+
if (options.signal?.aborted) {
|
|
7377
|
+
throw options.signal.reason;
|
|
7421
7378
|
}
|
|
7422
7379
|
if (error instanceof SourceRetrievalError) {
|
|
7423
7380
|
throw error;
|
|
7424
7381
|
}
|
|
7425
7382
|
throw new SourceRetrievalError(
|
|
7426
|
-
|
|
7383
|
+
hopSignal?.aborted ? "timeout" : "network_error",
|
|
7427
7384
|
`Source retrieval failed: ${url.href}.`,
|
|
7428
7385
|
{ cause: error }
|
|
7429
7386
|
);
|
|
@@ -7958,14 +7915,14 @@ var readManifest = (files) => {
|
|
|
7958
7915
|
versions.data.traceSchemaVersion,
|
|
7959
7916
|
versions.data.canonicalization
|
|
7960
7917
|
] : [];
|
|
7961
|
-
if (declared[0]
|
|
7918
|
+
if (!readableBundleSchemaVersions.some((version) => version === declared[0]) || declared[1] !== traceSchemaVersion || declared[2] !== canonicalization) {
|
|
7962
7919
|
return {
|
|
7963
7920
|
refusal: decidedCheck({
|
|
7964
7921
|
id: "bundle.integrity",
|
|
7965
7922
|
title: "Bundle integrity",
|
|
7966
7923
|
outcome: CheckOutcome.UNSUPPORTED,
|
|
7967
7924
|
code: "bundle_version_unsupported",
|
|
7968
|
-
explanation: `This verifier reads bundle schema ${
|
|
7925
|
+
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.`
|
|
7969
7926
|
})
|
|
7970
7927
|
};
|
|
7971
7928
|
}
|
|
@@ -9144,10 +9101,13 @@ var unexposedRetrieval = (surface) => {
|
|
|
9144
9101
|
return { exposure: surfaceRetrievalExposure[surface], calls: [] };
|
|
9145
9102
|
};
|
|
9146
9103
|
var buildProbeModels = (args) => {
|
|
9104
|
+
const runsOn = (surface) => {
|
|
9105
|
+
return chatRunsPerPrompt(surface, args.chatProbes);
|
|
9106
|
+
};
|
|
9147
9107
|
const all = [
|
|
9148
9108
|
{
|
|
9149
9109
|
name: "chatgpt",
|
|
9150
|
-
runs:
|
|
9110
|
+
runs: runsOn("chatgpt"),
|
|
9151
9111
|
provider: "gateway",
|
|
9152
9112
|
probe: async (promptText) => {
|
|
9153
9113
|
return runSearchRequiredProbe({
|
|
@@ -9161,7 +9121,7 @@ var buildProbeModels = (args) => {
|
|
|
9161
9121
|
},
|
|
9162
9122
|
{
|
|
9163
9123
|
name: "gemini",
|
|
9164
|
-
runs:
|
|
9124
|
+
runs: runsOn("gemini"),
|
|
9165
9125
|
provider: "gateway",
|
|
9166
9126
|
probe: async (promptText) => {
|
|
9167
9127
|
return runSearchRequiredProbe({
|
|
@@ -9175,7 +9135,7 @@ var buildProbeModels = (args) => {
|
|
|
9175
9135
|
},
|
|
9176
9136
|
{
|
|
9177
9137
|
name: "claude",
|
|
9178
|
-
runs:
|
|
9138
|
+
runs: runsOn("claude"),
|
|
9179
9139
|
provider: "gateway",
|
|
9180
9140
|
probe: async (promptText) => {
|
|
9181
9141
|
return runSearchRequiredProbe({
|
|
@@ -9191,7 +9151,7 @@ var buildProbeModels = (args) => {
|
|
|
9191
9151
|
},
|
|
9192
9152
|
{
|
|
9193
9153
|
name: "perplexity",
|
|
9194
|
-
runs:
|
|
9154
|
+
runs: runsOn("perplexity"),
|
|
9195
9155
|
provider: "gateway",
|
|
9196
9156
|
probe: async (promptText) => {
|
|
9197
9157
|
let streamFailure;
|
|
@@ -9238,7 +9198,7 @@ var buildProbeModels = (args) => {
|
|
|
9238
9198
|
},
|
|
9239
9199
|
{
|
|
9240
9200
|
name: "google_ai_overview",
|
|
9241
|
-
runs:
|
|
9201
|
+
runs: runsOn("google_ai_overview"),
|
|
9242
9202
|
provider: "dataforseo",
|
|
9243
9203
|
probe: async (promptText) => {
|
|
9244
9204
|
const retrieval = unexposedRetrieval("google_ai_overview");
|
|
@@ -9289,7 +9249,8 @@ var runProbesForPrompts = async (job, opts = {}) => {
|
|
|
9289
9249
|
const probeModels = buildProbeModels({
|
|
9290
9250
|
geography: job.geography,
|
|
9291
9251
|
language: job.language,
|
|
9292
|
-
surfaces: job.surfaces ?? chatSurfaces
|
|
9252
|
+
surfaces: job.surfaces ?? chatSurfaces,
|
|
9253
|
+
chatProbes: job.chatProbes
|
|
9293
9254
|
});
|
|
9294
9255
|
const limiter = job.limiter ?? unlimited();
|
|
9295
9256
|
const tasks = [];
|
|
@@ -10438,9 +10399,9 @@ var runCanaryProbe = async (surface, runtime, { signal, trace } = {}) => {
|
|
|
10438
10399
|
if (unrecorded !== null) {
|
|
10439
10400
|
return { kind: "persistence", message: unrecorded, surface };
|
|
10440
10401
|
}
|
|
10441
|
-
const
|
|
10442
|
-
if (
|
|
10443
|
-
await sleep(
|
|
10402
|
+
const delay4 = retryDelayMs(failure.kind, attempt);
|
|
10403
|
+
if (delay4 !== null) {
|
|
10404
|
+
await sleep(delay4, signal);
|
|
10444
10405
|
continue;
|
|
10445
10406
|
}
|
|
10446
10407
|
log5.error("Canary probe failed", error, {
|
|
@@ -11101,13 +11062,13 @@ var captureSectionProbes = async (args) => {
|
|
|
11101
11062
|
category: p.category
|
|
11102
11063
|
}));
|
|
11103
11064
|
const agentRunsPerPrompt = args.agentProbes.runsPerPrompt;
|
|
11104
|
-
const
|
|
11105
|
-
const agentPromptInputs = promptInputs.slice(0, agentPrompts.length);
|
|
11065
|
+
const agentPromptInputs = agentProbedPrompts(promptInputs, args.agentProbes);
|
|
11106
11066
|
const plannedUnits = plannedProbeUnitsForSection({
|
|
11107
11067
|
sectionKey: args.sectionKey,
|
|
11108
11068
|
prompts: args.prompts,
|
|
11109
11069
|
surfaces: args.surfaces,
|
|
11110
|
-
agentProbes: args.agentProbes
|
|
11070
|
+
agentProbes: args.agentProbes,
|
|
11071
|
+
chatProbes: args.chatProbes
|
|
11111
11072
|
});
|
|
11112
11073
|
const unitByKey = /* @__PURE__ */ new Map();
|
|
11113
11074
|
for (const unit of plannedUnits) {
|
|
@@ -11159,6 +11120,11 @@ var captureSectionProbes = async (args) => {
|
|
|
11159
11120
|
captureMetadata: {
|
|
11160
11121
|
requestedModel: requestedModelOf(probe),
|
|
11161
11122
|
reportedModel: probe.reportedModel ?? null,
|
|
11123
|
+
// Progress comparisons hash these into each answer's collection
|
|
11124
|
+
// method, so they stay as earlier releases recorded them. Chat
|
|
11125
|
+
// depth is left out: it does not change how one answer is
|
|
11126
|
+
// collected, and a depth difference already shows as a scope
|
|
11127
|
+
// change.
|
|
11162
11128
|
parameters: {
|
|
11163
11129
|
geography: args.geography,
|
|
11164
11130
|
language: args.language,
|
|
@@ -11187,6 +11153,7 @@ var captureSectionProbes = async (args) => {
|
|
|
11187
11153
|
language: args.language,
|
|
11188
11154
|
prompts: promptInputs,
|
|
11189
11155
|
surfaces: selectedChatSurfaces,
|
|
11156
|
+
chatProbes: args.chatProbes,
|
|
11190
11157
|
filter: shouldRun,
|
|
11191
11158
|
onResult: bank,
|
|
11192
11159
|
trace,
|
|
@@ -11313,6 +11280,7 @@ var sectionArgs = (deps, section) => {
|
|
|
11313
11280
|
language: deps.config.language,
|
|
11314
11281
|
surfaces: deps.plan.surfaces,
|
|
11315
11282
|
agentProbes: deps.config.agentProbes,
|
|
11283
|
+
chatProbes: deps.config.chatProbes,
|
|
11316
11284
|
agentCliVersions: deps.agentCliVersions,
|
|
11317
11285
|
runId: deps.request.runId,
|
|
11318
11286
|
probeStore: deps.stores.probeStore,
|
|
@@ -11496,14 +11464,12 @@ var aiBotRoster = [
|
|
|
11496
11464
|
{ bot: "Bytespider", kind: "training" },
|
|
11497
11465
|
{ bot: "CCBot", kind: "training" }
|
|
11498
11466
|
];
|
|
11499
|
-
var
|
|
11500
|
-
var
|
|
11467
|
+
var requestTimeoutInMs = 15e3;
|
|
11468
|
+
var auditUserAgent = "literally-aeo-audit/1.0";
|
|
11501
11469
|
var controlUserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36";
|
|
11502
|
-
var
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
});
|
|
11506
|
-
};
|
|
11470
|
+
var robotsRedirects = 5;
|
|
11471
|
+
var robotsMaxBytes = 500 * 1024;
|
|
11472
|
+
var pageRedirects = 5;
|
|
11507
11473
|
var isRefused = (code) => {
|
|
11508
11474
|
return code === 403 || code === 429;
|
|
11509
11475
|
};
|
|
@@ -11513,40 +11479,55 @@ var getLiveVerdict = (liveStatus, controlStatus) => {
|
|
|
11513
11479
|
}
|
|
11514
11480
|
return isRefused(liveStatus) ? "refused_as_bot" : "ok";
|
|
11515
11481
|
};
|
|
11516
|
-
var
|
|
11517
|
-
return
|
|
11482
|
+
var getOrigin = (brandDomain) => {
|
|
11483
|
+
return `https://${brandDomain.replace(/^https?:\/\//, "").replace(/\/.*$/, "")}`;
|
|
11518
11484
|
};
|
|
11519
|
-
var runCrawlerAccessCheck = async (brandDomain) => {
|
|
11520
|
-
const origin =
|
|
11485
|
+
var runCrawlerAccessCheck = async (brandDomain, request2) => {
|
|
11486
|
+
const origin = getOrigin(brandDomain);
|
|
11521
11487
|
const robotsUrl = `${origin}/robots.txt`;
|
|
11522
11488
|
let robotsBody = null;
|
|
11523
11489
|
let robotsFetchError = null;
|
|
11490
|
+
let robotsTruncated = false;
|
|
11524
11491
|
try {
|
|
11525
|
-
const response = await
|
|
11526
|
-
|
|
11527
|
-
|
|
11492
|
+
const response = await request2({
|
|
11493
|
+
url: robotsUrl,
|
|
11494
|
+
timeoutInMs: requestTimeoutInMs,
|
|
11495
|
+
userAgent: auditUserAgent,
|
|
11496
|
+
accept: "*/*",
|
|
11497
|
+
redirects: robotsRedirects,
|
|
11498
|
+
body: {
|
|
11499
|
+
contentTypes: "any",
|
|
11500
|
+
maxBytes: robotsMaxBytes,
|
|
11501
|
+
oversize: "truncate"
|
|
11502
|
+
}
|
|
11528
11503
|
});
|
|
11529
|
-
if (response.
|
|
11530
|
-
robotsBody =
|
|
11504
|
+
if (response.status >= 200 && response.status < 300) {
|
|
11505
|
+
robotsBody = response.body?.toString("utf8") ?? "";
|
|
11506
|
+
robotsTruncated = response.isTruncated;
|
|
11531
11507
|
} else if (response.status === 404) {
|
|
11532
11508
|
robotsBody = "";
|
|
11533
11509
|
} else {
|
|
11534
11510
|
robotsFetchError = `HTTP ${response.status}`;
|
|
11535
11511
|
}
|
|
11536
11512
|
} catch (error) {
|
|
11537
|
-
robotsFetchError =
|
|
11513
|
+
robotsFetchError = describeSiteError(error);
|
|
11538
11514
|
}
|
|
11539
11515
|
const groups = robotsBody !== null ? parseRobotsTxt(robotsBody) : null;
|
|
11540
|
-
const
|
|
11516
|
+
const getStatus = async (userAgent) => {
|
|
11541
11517
|
try {
|
|
11542
|
-
const response = await
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11518
|
+
const response = await request2({
|
|
11519
|
+
url: origin,
|
|
11520
|
+
timeoutInMs: requestTimeoutInMs,
|
|
11521
|
+
userAgent,
|
|
11522
|
+
accept: "*/*",
|
|
11523
|
+
redirects: pageRedirects
|
|
11546
11524
|
});
|
|
11547
11525
|
return response.status;
|
|
11548
11526
|
} catch (error) {
|
|
11549
|
-
log7.warn("Live UA probe failed", {
|
|
11527
|
+
log7.warn("Live UA probe failed", {
|
|
11528
|
+
userAgent,
|
|
11529
|
+
error: describeSiteError(error)
|
|
11530
|
+
});
|
|
11550
11531
|
return null;
|
|
11551
11532
|
}
|
|
11552
11533
|
};
|
|
@@ -11555,15 +11536,9 @@ var runCrawlerAccessCheck = async (brandDomain) => {
|
|
|
11555
11536
|
if (!bot.liveProbeUa) {
|
|
11556
11537
|
continue;
|
|
11557
11538
|
}
|
|
11558
|
-
|
|
11559
|
-
await sleep2(probeIntervalMs);
|
|
11560
|
-
}
|
|
11561
|
-
probed.push({ bot, liveStatus: await status(bot.liveProbeUa) });
|
|
11562
|
-
}
|
|
11563
|
-
if (probed.length > 0) {
|
|
11564
|
-
await sleep2(probeIntervalMs);
|
|
11539
|
+
probed.push({ bot, liveStatus: await getStatus(bot.liveProbeUa) });
|
|
11565
11540
|
}
|
|
11566
|
-
const controlStatus = probed.length > 0 ? await
|
|
11541
|
+
const controlStatus = probed.length > 0 ? await getStatus(controlUserAgent) : null;
|
|
11567
11542
|
const bots = aiBotRoster.map((bot) => {
|
|
11568
11543
|
const robotsAllowed = groups ? isRootAllowed(groups, bot.bot) : null;
|
|
11569
11544
|
const probe = probed.find((entry) => entry.bot === bot);
|
|
@@ -11593,6 +11568,7 @@ var runCrawlerAccessCheck = async (brandDomain) => {
|
|
|
11593
11568
|
log7.info("Crawler access check completed", {
|
|
11594
11569
|
robotsUrl,
|
|
11595
11570
|
robotsFetchError,
|
|
11571
|
+
robotsTruncated,
|
|
11596
11572
|
controlStatus,
|
|
11597
11573
|
bots: bots.length,
|
|
11598
11574
|
robotsBlocked: bots.filter((b) => b.robotsAllowed === false).length,
|
|
@@ -11603,30 +11579,33 @@ var runCrawlerAccessCheck = async (brandDomain) => {
|
|
|
11603
11579
|
robotsUrl,
|
|
11604
11580
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11605
11581
|
robotsFetchError,
|
|
11582
|
+
robotsTruncated,
|
|
11606
11583
|
controlStatus,
|
|
11607
11584
|
bots
|
|
11608
11585
|
};
|
|
11609
11586
|
};
|
|
11610
|
-
var checkLlmsTxt = async (brandDomain) => {
|
|
11611
|
-
const origin =
|
|
11587
|
+
var checkLlmsTxt = async (brandDomain, request2) => {
|
|
11588
|
+
const origin = getOrigin(brandDomain);
|
|
11612
11589
|
const [llmsTxt, llmsFullTxt] = await Promise.all([
|
|
11613
|
-
|
|
11614
|
-
|
|
11590
|
+
isTextFileServed(`${origin}/llms.txt`, request2),
|
|
11591
|
+
isTextFileServed(`${origin}/llms-full.txt`, request2)
|
|
11615
11592
|
]);
|
|
11616
11593
|
log7.debug("llms.txt check completed", { origin, llmsTxt, llmsFullTxt });
|
|
11617
11594
|
return { llmsTxt, llmsFullTxt };
|
|
11618
11595
|
};
|
|
11619
|
-
var
|
|
11596
|
+
var isTextFileServed = async (url, request2) => {
|
|
11620
11597
|
try {
|
|
11621
|
-
const response = await
|
|
11622
|
-
|
|
11623
|
-
|
|
11598
|
+
const response = await request2({
|
|
11599
|
+
url,
|
|
11600
|
+
timeoutInMs: requestTimeoutInMs,
|
|
11601
|
+
userAgent: auditUserAgent,
|
|
11602
|
+
accept: "text/plain,text/markdown,*/*",
|
|
11603
|
+
redirects: pageRedirects
|
|
11624
11604
|
});
|
|
11625
|
-
if (
|
|
11605
|
+
if (response.status < 200 || response.status >= 300) {
|
|
11626
11606
|
return false;
|
|
11627
11607
|
}
|
|
11628
|
-
|
|
11629
|
-
return !contentType.includes("text/html");
|
|
11608
|
+
return !response.contentType.includes("text/html");
|
|
11630
11609
|
} catch {
|
|
11631
11610
|
return false;
|
|
11632
11611
|
}
|
|
@@ -11702,74 +11681,262 @@ var isRootAllowed = (groups, bot) => {
|
|
|
11702
11681
|
};
|
|
11703
11682
|
|
|
11704
11683
|
// src/checks/renderability.ts
|
|
11705
|
-
import { load
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
var
|
|
11711
|
-
var
|
|
11712
|
-
|
|
11713
|
-
|
|
11714
|
-
|
|
11684
|
+
import { load } from "cheerio";
|
|
11685
|
+
|
|
11686
|
+
// src/grounding/chromium-guard.ts
|
|
11687
|
+
import { createServer } from "node:http";
|
|
11688
|
+
import { connect } from "node:net";
|
|
11689
|
+
var connectTimeoutInMs = 15e3;
|
|
11690
|
+
var dialPublicAddress = (address) => {
|
|
11691
|
+
return connect({ host: address.address, port: 443, family: address.family });
|
|
11692
|
+
};
|
|
11693
|
+
var toConnectTarget = (authority) => {
|
|
11694
|
+
const separator = authority.lastIndexOf(":");
|
|
11695
|
+
if (separator < 0 || authority.slice(separator + 1) !== "443") {
|
|
11696
|
+
return void 0;
|
|
11715
11697
|
}
|
|
11716
|
-
const { chromium } = await import("playwright");
|
|
11717
|
-
const browser = await chromium.launch();
|
|
11718
11698
|
try {
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11699
|
+
return validateResearchUrl(`https://${authority.slice(0, separator)}/`);
|
|
11700
|
+
} catch {
|
|
11701
|
+
return void 0;
|
|
11702
|
+
}
|
|
11703
|
+
};
|
|
11704
|
+
var startGuardingProxy = async (options = {}) => {
|
|
11705
|
+
const { lookupHost, dial = dialPublicAddress } = options;
|
|
11706
|
+
const counts = { allowed: 0, refused: 0 };
|
|
11707
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
11708
|
+
const refuse2 = (client) => {
|
|
11709
|
+
counts.refused += 1;
|
|
11710
|
+
client.end("HTTP/1.1 403 Forbidden\r\n\r\n");
|
|
11711
|
+
};
|
|
11712
|
+
const server = createServer((_request, response) => {
|
|
11713
|
+
counts.refused += 1;
|
|
11714
|
+
response.writeHead(403).end();
|
|
11715
|
+
});
|
|
11716
|
+
const tunnel = async (authority, client, head) => {
|
|
11717
|
+
const target = toConnectTarget(authority);
|
|
11718
|
+
if (!target) {
|
|
11719
|
+
refuse2(client);
|
|
11720
|
+
return;
|
|
11721
|
+
}
|
|
11722
|
+
let address2;
|
|
11723
|
+
try {
|
|
11724
|
+
address2 = await resolvePublicAddress(
|
|
11725
|
+
target.hostname,
|
|
11726
|
+
AbortSignal.timeout(connectTimeoutInMs),
|
|
11727
|
+
lookupHost
|
|
11728
|
+
);
|
|
11729
|
+
} catch {
|
|
11730
|
+
refuse2(client);
|
|
11731
|
+
return;
|
|
11732
11732
|
}
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
11733
|
+
counts.allowed += 1;
|
|
11734
|
+
const upstream = dial(address2);
|
|
11735
|
+
sockets.add(upstream);
|
|
11736
|
+
upstream.setTimeout(connectTimeoutInMs, () => {
|
|
11737
|
+
upstream.destroy();
|
|
11737
11738
|
});
|
|
11738
|
-
|
|
11739
|
+
upstream.once("connect", () => {
|
|
11740
|
+
upstream.setTimeout(0);
|
|
11741
|
+
client.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
|
11742
|
+
upstream.write(head);
|
|
11743
|
+
upstream.pipe(client);
|
|
11744
|
+
client.pipe(upstream);
|
|
11745
|
+
});
|
|
11746
|
+
upstream.once("error", () => {
|
|
11747
|
+
client.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
11748
|
+
});
|
|
11749
|
+
upstream.once("close", () => {
|
|
11750
|
+
sockets.delete(upstream);
|
|
11751
|
+
client.destroy();
|
|
11752
|
+
});
|
|
11753
|
+
client.once("close", () => {
|
|
11754
|
+
upstream.destroy();
|
|
11755
|
+
});
|
|
11756
|
+
};
|
|
11757
|
+
server.on("connection", (socket) => {
|
|
11758
|
+
sockets.add(socket);
|
|
11759
|
+
socket.once("close", () => {
|
|
11760
|
+
sockets.delete(socket);
|
|
11761
|
+
});
|
|
11762
|
+
});
|
|
11763
|
+
server.on("connect", (request2, client, head) => {
|
|
11764
|
+
client.on("error", () => {
|
|
11765
|
+
client.destroy();
|
|
11766
|
+
});
|
|
11767
|
+
void tunnel(request2.url ?? "", client, head);
|
|
11768
|
+
});
|
|
11769
|
+
server.on("upgrade", (_request, client) => {
|
|
11770
|
+
refuse2(client);
|
|
11771
|
+
});
|
|
11772
|
+
await new Promise((resolve, reject) => {
|
|
11773
|
+
server.once("error", reject);
|
|
11774
|
+
server.listen(0, "127.0.0.1", resolve);
|
|
11775
|
+
});
|
|
11776
|
+
const address = server.address();
|
|
11777
|
+
if (address === null || typeof address === "string") {
|
|
11778
|
+
throw new Error("The guarding proxy did not bind a TCP port.");
|
|
11779
|
+
}
|
|
11780
|
+
return {
|
|
11781
|
+
server: `http://127.0.0.1:${address.port}`,
|
|
11782
|
+
counts: () => ({ ...counts }),
|
|
11783
|
+
close: async () => {
|
|
11784
|
+
for (const socket of sockets) {
|
|
11785
|
+
socket.destroy();
|
|
11786
|
+
}
|
|
11787
|
+
await new Promise((resolve) => {
|
|
11788
|
+
server.close(() => {
|
|
11789
|
+
resolve();
|
|
11790
|
+
});
|
|
11791
|
+
});
|
|
11792
|
+
}
|
|
11793
|
+
};
|
|
11794
|
+
};
|
|
11795
|
+
var chromiumArgs = [
|
|
11796
|
+
// Playwright proxies loopback too unless an environment variable turns
|
|
11797
|
+
// that off; this flag comes last and keeps it on regardless.
|
|
11798
|
+
"--proxy-bypass-list=<-loopback>",
|
|
11799
|
+
// QUIC and WebRTC over UDP would leave beside an HTTP proxy.
|
|
11800
|
+
"--disable-quic",
|
|
11801
|
+
"--force-webrtc-ip-handling-policy=disable_non_proxied_udp"
|
|
11802
|
+
];
|
|
11803
|
+
var isAllowedRequest = (request2) => {
|
|
11804
|
+
const url = new URL(request2.url());
|
|
11805
|
+
return url.protocol === "https:" && url.port === "" && request2.resourceType() !== "media";
|
|
11806
|
+
};
|
|
11807
|
+
var withBoundedPage = async (context, deadlineInMs, use) => {
|
|
11808
|
+
const page = await context.newPage();
|
|
11809
|
+
const deadline = AbortSignal.timeout(deadlineInMs);
|
|
11810
|
+
const closePage = () => {
|
|
11811
|
+
void page.close().catch(() => void 0);
|
|
11812
|
+
};
|
|
11813
|
+
deadline.addEventListener("abort", closePage, { once: true });
|
|
11814
|
+
try {
|
|
11815
|
+
return await use(page);
|
|
11816
|
+
} catch (error) {
|
|
11817
|
+
if (deadline.aborted) {
|
|
11818
|
+
throw new Error(
|
|
11819
|
+
`The page did not finish rendering within ${deadlineInMs / 1e3} s.`,
|
|
11820
|
+
{ cause: error }
|
|
11821
|
+
);
|
|
11822
|
+
}
|
|
11823
|
+
throw error;
|
|
11739
11824
|
} finally {
|
|
11740
|
-
|
|
11825
|
+
deadline.removeEventListener("abort", closePage);
|
|
11826
|
+
await page.close();
|
|
11741
11827
|
}
|
|
11742
11828
|
};
|
|
11743
|
-
var
|
|
11829
|
+
var withGuardedChromium = async (use, options = {}) => {
|
|
11830
|
+
const proxy = await startGuardingProxy(options.proxy);
|
|
11744
11831
|
try {
|
|
11745
|
-
const
|
|
11746
|
-
|
|
11747
|
-
|
|
11832
|
+
const { chromium } = await import("playwright");
|
|
11833
|
+
const browser = await chromium.launch({
|
|
11834
|
+
proxy: { server: proxy.server },
|
|
11835
|
+
args: chromiumArgs
|
|
11748
11836
|
});
|
|
11749
|
-
if (!response.ok) {
|
|
11750
|
-
return {
|
|
11751
|
-
url,
|
|
11752
|
-
staticTextChars: 0,
|
|
11753
|
-
renderedTextChars: 0,
|
|
11754
|
-
missingRatio: 0,
|
|
11755
|
-
flagged: false,
|
|
11756
|
-
error: `Static fetch failed: HTTP ${response.status}`
|
|
11757
|
-
};
|
|
11758
|
-
}
|
|
11759
|
-
const staticText = extractText(await response.text());
|
|
11760
|
-
const page = await browser.newPage();
|
|
11761
|
-
let renderedText;
|
|
11762
11837
|
try {
|
|
11763
|
-
await
|
|
11764
|
-
|
|
11765
|
-
|
|
11766
|
-
|
|
11767
|
-
|
|
11768
|
-
|
|
11769
|
-
);
|
|
11838
|
+
const context = await browser.newContext({
|
|
11839
|
+
acceptDownloads: false,
|
|
11840
|
+
serviceWorkers: "block",
|
|
11841
|
+
...options.userAgent !== void 0 && {
|
|
11842
|
+
userAgent: options.userAgent
|
|
11843
|
+
}
|
|
11844
|
+
});
|
|
11845
|
+
await context.route("**/*", (route) => {
|
|
11846
|
+
return isAllowedRequest(route.request()) ? route.continue() : route.abort();
|
|
11847
|
+
});
|
|
11848
|
+
const result = await use(context);
|
|
11849
|
+
return { result, connections: proxy.counts() };
|
|
11770
11850
|
} finally {
|
|
11771
|
-
await
|
|
11851
|
+
await browser.close();
|
|
11852
|
+
}
|
|
11853
|
+
} finally {
|
|
11854
|
+
await proxy.close();
|
|
11855
|
+
}
|
|
11856
|
+
};
|
|
11857
|
+
|
|
11858
|
+
// src/checks/renderability.ts
|
|
11859
|
+
var log8 = createLog("Renderability");
|
|
11860
|
+
var fetchTimeoutInMs = 2e4;
|
|
11861
|
+
var renderTimeoutInMs = 45e3;
|
|
11862
|
+
var settleTimeoutInMs = 8e3;
|
|
11863
|
+
var renderDeadlineInMs = 6e4;
|
|
11864
|
+
var staticMaxBytes = 10 * 1024 * 1024;
|
|
11865
|
+
var pageRedirects2 = 5;
|
|
11866
|
+
var missingRatioThreshold = 0.4;
|
|
11867
|
+
var missingCharsThreshold = 500;
|
|
11868
|
+
var runRenderabilityCheck = async (moneyPages, site) => {
|
|
11869
|
+
if (moneyPages.length === 0) {
|
|
11870
|
+
return [];
|
|
11871
|
+
}
|
|
11872
|
+
const { result: results, connections } = await withGuardedChromium(
|
|
11873
|
+
async (context) => {
|
|
11874
|
+
const checked = [];
|
|
11875
|
+
for (const url of moneyPages) {
|
|
11876
|
+
const pageStartedAt = Date.now();
|
|
11877
|
+
const result = await checkPage(url, context, site);
|
|
11878
|
+
checked.push(result);
|
|
11879
|
+
log8.debug("Renderability page checked", {
|
|
11880
|
+
url,
|
|
11881
|
+
durationMs: Date.now() - pageStartedAt,
|
|
11882
|
+
staticTextChars: result.staticTextChars,
|
|
11883
|
+
renderedTextChars: result.renderedTextChars,
|
|
11884
|
+
flagged: result.flagged,
|
|
11885
|
+
error: result.error
|
|
11886
|
+
});
|
|
11887
|
+
}
|
|
11888
|
+
return checked;
|
|
11772
11889
|
}
|
|
11890
|
+
);
|
|
11891
|
+
log8.info("Renderability check completed", {
|
|
11892
|
+
pages: results.length,
|
|
11893
|
+
flagged: results.filter((r) => r.flagged).length,
|
|
11894
|
+
errors: results.filter((r) => r.error).length,
|
|
11895
|
+
connections
|
|
11896
|
+
});
|
|
11897
|
+
return results;
|
|
11898
|
+
};
|
|
11899
|
+
var failedPage = (url, error) => {
|
|
11900
|
+
return {
|
|
11901
|
+
url,
|
|
11902
|
+
staticTextChars: 0,
|
|
11903
|
+
renderedTextChars: 0,
|
|
11904
|
+
missingRatio: 0,
|
|
11905
|
+
flagged: false,
|
|
11906
|
+
error
|
|
11907
|
+
};
|
|
11908
|
+
};
|
|
11909
|
+
var renderText = (url, context) => {
|
|
11910
|
+
return withBoundedPage(context, renderDeadlineInMs, async (page) => {
|
|
11911
|
+
await page.goto(url, { waitUntil: "load", timeout: renderTimeoutInMs });
|
|
11912
|
+
await page.waitForLoadState("networkidle", { timeout: settleTimeoutInMs }).catch(() => void 0);
|
|
11913
|
+
const text = await page.evaluate(
|
|
11914
|
+
() => document.querySelector("body")?.innerText ?? ""
|
|
11915
|
+
);
|
|
11916
|
+
return normalizeWhitespace(text);
|
|
11917
|
+
});
|
|
11918
|
+
};
|
|
11919
|
+
var checkPage = async (url, context, site) => {
|
|
11920
|
+
try {
|
|
11921
|
+
const response = await site.request({
|
|
11922
|
+
url,
|
|
11923
|
+
timeoutInMs: fetchTimeoutInMs,
|
|
11924
|
+
userAgent: "literally-aeo-audit/1.0",
|
|
11925
|
+
accept: "text/html,application/xhtml+xml",
|
|
11926
|
+
redirects: pageRedirects2,
|
|
11927
|
+
body: {
|
|
11928
|
+
contentTypes: /^(text\/html|application\/xhtml\+xml|text\/plain)(;|$)/i,
|
|
11929
|
+
maxBytes: staticMaxBytes,
|
|
11930
|
+
oversize: "refuse"
|
|
11931
|
+
}
|
|
11932
|
+
});
|
|
11933
|
+
if (response.status < 200 || response.status >= 300) {
|
|
11934
|
+
return failedPage(url, `Static fetch failed: HTTP ${response.status}`);
|
|
11935
|
+
}
|
|
11936
|
+
const staticText = extractText(response.body?.toString("utf8") ?? "");
|
|
11937
|
+
const renderedText = await site.pace(new URL(url), () => {
|
|
11938
|
+
return renderText(url, context);
|
|
11939
|
+
});
|
|
11773
11940
|
const staticChars = staticText.length;
|
|
11774
11941
|
const renderedChars = renderedText.length;
|
|
11775
11942
|
const missingChars = Math.max(0, renderedChars - staticChars);
|
|
@@ -11786,20 +11953,13 @@ var checkPage = async (url, browser) => {
|
|
|
11786
11953
|
} catch (error) {
|
|
11787
11954
|
log8.warn("Renderability check failed for page", {
|
|
11788
11955
|
url,
|
|
11789
|
-
error:
|
|
11956
|
+
error: describeSiteError(error)
|
|
11790
11957
|
});
|
|
11791
|
-
return
|
|
11792
|
-
url,
|
|
11793
|
-
staticTextChars: 0,
|
|
11794
|
-
renderedTextChars: 0,
|
|
11795
|
-
missingRatio: 0,
|
|
11796
|
-
flagged: false,
|
|
11797
|
-
error: error instanceof Error ? error.message : String(error)
|
|
11798
|
-
};
|
|
11958
|
+
return failedPage(url, describeSiteError(error));
|
|
11799
11959
|
}
|
|
11800
11960
|
};
|
|
11801
11961
|
var extractText = (html) => {
|
|
11802
|
-
const $ =
|
|
11962
|
+
const $ = load(html);
|
|
11803
11963
|
$("script, style, noscript, template").remove();
|
|
11804
11964
|
return normalizeWhitespace($("body").text());
|
|
11805
11965
|
};
|
|
@@ -11808,8 +11968,13 @@ var normalizeWhitespace = (text) => {
|
|
|
11808
11968
|
};
|
|
11809
11969
|
|
|
11810
11970
|
// src/checks/run-checks.ts
|
|
11971
|
+
var hostIntervalInMs = 1e3;
|
|
11811
11972
|
var runTechnicalChecks = async (config, recorder) => {
|
|
11812
11973
|
const failures = [];
|
|
11974
|
+
const pace = createHostPacer(hostIntervalInMs);
|
|
11975
|
+
const request2 = (options) => {
|
|
11976
|
+
return guardedRequest({ ...options, pace });
|
|
11977
|
+
};
|
|
11813
11978
|
const check = (name, parameters, run) => {
|
|
11814
11979
|
return recorded({
|
|
11815
11980
|
recorder,
|
|
@@ -11833,17 +11998,17 @@ var runTechnicalChecks = async (config, recorder) => {
|
|
|
11833
11998
|
check(
|
|
11834
11999
|
"crawler_access",
|
|
11835
12000
|
{ domain: config.brand.domain },
|
|
11836
|
-
() => runCrawlerAccessCheck(config.brand.domain)
|
|
12001
|
+
() => runCrawlerAccessCheck(config.brand.domain, request2)
|
|
11837
12002
|
),
|
|
11838
12003
|
check(
|
|
11839
12004
|
"llms_txt",
|
|
11840
12005
|
{ domain: config.brand.domain },
|
|
11841
|
-
() => checkLlmsTxt(config.brand.domain)
|
|
12006
|
+
() => checkLlmsTxt(config.brand.domain, request2)
|
|
11842
12007
|
),
|
|
11843
12008
|
check(
|
|
11844
12009
|
"renderability",
|
|
11845
12010
|
{ moneyPages: config.moneyPages },
|
|
11846
|
-
() => runRenderabilityCheck(config.moneyPages)
|
|
12011
|
+
() => runRenderabilityCheck(config.moneyPages, { request: request2, pace })
|
|
11847
12012
|
)
|
|
11848
12013
|
]);
|
|
11849
12014
|
return {
|
|
@@ -12602,6 +12767,144 @@ var recordedGroundingTools = (tools, recorder) => {
|
|
|
12602
12767
|
|
|
12603
12768
|
// src/grounding/tools.ts
|
|
12604
12769
|
import { z as z39 } from "zod";
|
|
12770
|
+
|
|
12771
|
+
// src/grounding/fetch.ts
|
|
12772
|
+
import { load as load2 } from "cheerio";
|
|
12773
|
+
var sourceLimits = {
|
|
12774
|
+
timeoutMs: 15e3,
|
|
12775
|
+
receivedBytes: 2097152,
|
|
12776
|
+
retainedBytes: 16384,
|
|
12777
|
+
redirects: 3
|
|
12778
|
+
};
|
|
12779
|
+
var canonicalResearchUrl = (value) => {
|
|
12780
|
+
const url = new URL(value);
|
|
12781
|
+
url.hash = "";
|
|
12782
|
+
url.hostname = url.hostname.toLowerCase();
|
|
12783
|
+
if (url.pathname.length > 1 && url.pathname.endsWith("/")) {
|
|
12784
|
+
url.pathname = url.pathname.slice(0, -1);
|
|
12785
|
+
}
|
|
12786
|
+
return url.href;
|
|
12787
|
+
};
|
|
12788
|
+
var boundedUtf8 = (text, bytes) => {
|
|
12789
|
+
return Buffer.from(text).subarray(0, bytes).toString("utf8").replace(/\uFFFD$/, "");
|
|
12790
|
+
};
|
|
12791
|
+
var extractSourceDocument = (args) => {
|
|
12792
|
+
const final = validateResearchUrl(args.finalUrl);
|
|
12793
|
+
validateResearchUrl(args.requestedUrl);
|
|
12794
|
+
if (Buffer.byteLength(args.body) > sourceLimits.receivedBytes) {
|
|
12795
|
+
throw new SourceRetrievalError(
|
|
12796
|
+
"too_large",
|
|
12797
|
+
`Source response exceeds byte limit: ${Buffer.byteLength(args.body)} bytes.`
|
|
12798
|
+
);
|
|
12799
|
+
}
|
|
12800
|
+
let text;
|
|
12801
|
+
let title = "";
|
|
12802
|
+
let sourceDate = null;
|
|
12803
|
+
const links = [];
|
|
12804
|
+
if (/html/i.test(args.contentType)) {
|
|
12805
|
+
const $ = load2(args.body);
|
|
12806
|
+
title = $("title").first().text().trim().slice(0, 500);
|
|
12807
|
+
const declaredDate = $('meta[property="article:published_time"]').attr("content") ?? $('meta[name="date"]').attr("content");
|
|
12808
|
+
if (declaredDate && /^\d{4}-\d{2}-\d{2}(?:T|$)/.test(declaredDate) && Number.isFinite(Date.parse(declaredDate))) {
|
|
12809
|
+
sourceDate = new Date(declaredDate).toISOString();
|
|
12810
|
+
}
|
|
12811
|
+
$(
|
|
12812
|
+
"script,style,noscript,iframe,object,embed,svg,form,input,button,nav,footer,header"
|
|
12813
|
+
).remove();
|
|
12814
|
+
$("a[href]").each((_index, element) => {
|
|
12815
|
+
const href = $(element).attr("href");
|
|
12816
|
+
if (links.length >= 100 || href === void 0) {
|
|
12817
|
+
return;
|
|
12818
|
+
}
|
|
12819
|
+
try {
|
|
12820
|
+
const url = validateResearchUrl(new URL(href, final).href).href;
|
|
12821
|
+
if (!links.includes(url)) {
|
|
12822
|
+
links.push(url);
|
|
12823
|
+
}
|
|
12824
|
+
} catch {
|
|
12825
|
+
}
|
|
12826
|
+
});
|
|
12827
|
+
$("p,div,li,h1,h2,h3,h4,section,article,br,tr").append("\n");
|
|
12828
|
+
text = ($("main").length ? $("main").text() : $("body").text()).replace(/[\t\r ]+/g, " ").replace(/\n\s*\n+/g, "\n\n").trim();
|
|
12829
|
+
} else {
|
|
12830
|
+
text = args.body.replace(/\r\n/g, "\n").trim();
|
|
12831
|
+
}
|
|
12832
|
+
if (!text) {
|
|
12833
|
+
throw new SourceRetrievalError(
|
|
12834
|
+
"empty_content",
|
|
12835
|
+
`No readable source text: ${final.href}.`
|
|
12836
|
+
);
|
|
12837
|
+
}
|
|
12838
|
+
const documentDigest = contentHash(text);
|
|
12839
|
+
const retained = boundedUtf8(text, sourceLimits.retainedBytes);
|
|
12840
|
+
const id2 = `src_${contentHash({ url: final.href, documentDigest }).slice(0, 32)}`;
|
|
12841
|
+
const passages = [
|
|
12842
|
+
{ id: `${id2}_p0`, text: retained, digest: contentHash(retained) }
|
|
12843
|
+
];
|
|
12844
|
+
return {
|
|
12845
|
+
source: {
|
|
12846
|
+
id: id2,
|
|
12847
|
+
requestedUrl: args.requestedUrl,
|
|
12848
|
+
finalUrl: final.href,
|
|
12849
|
+
title,
|
|
12850
|
+
publisher: final.hostname,
|
|
12851
|
+
provenance: args.firstPartyHosts?.includes(final.hostname) ? "first_party" : "unknown",
|
|
12852
|
+
fetchedAt: args.fetchedAt,
|
|
12853
|
+
sourceDate,
|
|
12854
|
+
documentDigest,
|
|
12855
|
+
retainedDigest: contentHash(passages.map((passage) => passage.text)),
|
|
12856
|
+
passages,
|
|
12857
|
+
extractionVersion: sourceExtractionVersion,
|
|
12858
|
+
truncated: retained !== text
|
|
12859
|
+
},
|
|
12860
|
+
links,
|
|
12861
|
+
// The whole extracted text, for a reader that keeps more than the
|
|
12862
|
+
// grounding passage (the author's research tools keep 32 KB).
|
|
12863
|
+
text
|
|
12864
|
+
};
|
|
12865
|
+
};
|
|
12866
|
+
var fetchGroundingSource = async (args) => {
|
|
12867
|
+
const response = await guardedRequest({
|
|
12868
|
+
url: args.url,
|
|
12869
|
+
timeoutInMs: sourceLimits.timeoutMs,
|
|
12870
|
+
signal: args.signal,
|
|
12871
|
+
userAgent: "Literally-AEO-Research/1",
|
|
12872
|
+
accept: "text/html,text/plain",
|
|
12873
|
+
redirects: sourceLimits.redirects,
|
|
12874
|
+
body: {
|
|
12875
|
+
contentTypes: /^(text\/html|text\/plain|application\/xhtml\+xml)(;|$)/i,
|
|
12876
|
+
maxBytes: sourceLimits.receivedBytes,
|
|
12877
|
+
oversize: "refuse"
|
|
12878
|
+
},
|
|
12879
|
+
pace: async (_url, send2) => {
|
|
12880
|
+
await args.beforeRequest?.();
|
|
12881
|
+
return send2();
|
|
12882
|
+
}
|
|
12883
|
+
});
|
|
12884
|
+
if (response.status < 200 || response.status >= 300) {
|
|
12885
|
+
throw new SourceRetrievalError(
|
|
12886
|
+
"http_error",
|
|
12887
|
+
`Source HTTP ${response.status}.`,
|
|
12888
|
+
{ status: response.status }
|
|
12889
|
+
);
|
|
12890
|
+
}
|
|
12891
|
+
const body = response.body?.toString("utf8") ?? "";
|
|
12892
|
+
const document2 = extractSourceDocument({
|
|
12893
|
+
requestedUrl: args.url,
|
|
12894
|
+
finalUrl: response.url,
|
|
12895
|
+
body,
|
|
12896
|
+
contentType: response.contentType,
|
|
12897
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12898
|
+
firstPartyHosts: args.firstPartyHosts
|
|
12899
|
+
});
|
|
12900
|
+
return {
|
|
12901
|
+
...document2,
|
|
12902
|
+
requestCount: response.hops.length,
|
|
12903
|
+
bytes: Buffer.byteLength(body)
|
|
12904
|
+
};
|
|
12905
|
+
};
|
|
12906
|
+
|
|
12907
|
+
// src/grounding/tools.ts
|
|
12605
12908
|
var candidateIds = z39.array(z39.string().min(1).max(200)).min(1).max(40);
|
|
12606
12909
|
var relevance = z39.string().min(1).max(500);
|
|
12607
12910
|
var researchActionSchema = z39.discriminatedUnion("tool", [
|
|
@@ -15591,7 +15894,7 @@ var supportedModels = [
|
|
|
15591
15894
|
id: "anthropic/claude-opus-5.5",
|
|
15592
15895
|
label: "Claude Opus 5.5",
|
|
15593
15896
|
pricingUsdPerMillion: { input: 4, output: 20, cachedInput: 0.2 },
|
|
15594
|
-
pricingCheckedAt: "2026-11-
|
|
15897
|
+
pricingCheckedAt: "2026-11-08",
|
|
15595
15898
|
contextWindow: 1e6,
|
|
15596
15899
|
maxOutputTokens: 128e3,
|
|
15597
15900
|
thinkingInOutput: true,
|
|
@@ -15602,8 +15905,8 @@ var supportedModels = [
|
|
|
15602
15905
|
{
|
|
15603
15906
|
id: "anthropic/claude-sonnet-5.5",
|
|
15604
15907
|
label: "Claude Sonnet 5.5",
|
|
15605
|
-
pricingUsdPerMillion: { input: 2, output: 10, cachedInput: 0.
|
|
15606
|
-
pricingCheckedAt: "2026-11-
|
|
15908
|
+
pricingUsdPerMillion: { input: 2, output: 10, cachedInput: 0.1 },
|
|
15909
|
+
pricingCheckedAt: "2026-11-08",
|
|
15607
15910
|
contextWindow: 1e6,
|
|
15608
15911
|
maxOutputTokens: 128e3,
|
|
15609
15912
|
thinkingInOutput: true,
|
|
@@ -15997,7 +16300,7 @@ var extractPerceptionForSection = async (args) => {
|
|
|
15997
16300
|
}
|
|
15998
16301
|
return { section: { ...base, narratives, flaggedClaims }, failures };
|
|
15999
16302
|
};
|
|
16000
|
-
var
|
|
16303
|
+
var sleep2 = (ms) => {
|
|
16001
16304
|
return new Promise((resolve) => {
|
|
16002
16305
|
setTimeout(resolve, ms);
|
|
16003
16306
|
});
|
|
@@ -16038,17 +16341,17 @@ var extractBatch = async (args, batch, start) => {
|
|
|
16038
16341
|
args.signal?.throwIfAborted();
|
|
16039
16342
|
lastError = error;
|
|
16040
16343
|
const retryable = isRetryable(error);
|
|
16041
|
-
const
|
|
16344
|
+
const delay4 = perceptionRetryDelaysMs[attempt - 1];
|
|
16042
16345
|
log10.warn("Perception batch attempt failed", {
|
|
16043
16346
|
...context,
|
|
16044
16347
|
attempt,
|
|
16045
16348
|
retryable,
|
|
16046
16349
|
error: error instanceof Error ? error.message : String(error)
|
|
16047
16350
|
});
|
|
16048
|
-
if (!retryable || attempt >= perceptionTransientAttempts ||
|
|
16351
|
+
if (!retryable || attempt >= perceptionTransientAttempts || delay4 === void 0) {
|
|
16049
16352
|
break;
|
|
16050
16353
|
}
|
|
16051
|
-
await
|
|
16354
|
+
await sleep2(delay4);
|
|
16052
16355
|
}
|
|
16053
16356
|
}
|
|
16054
16357
|
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
@@ -16722,7 +17025,7 @@ var isRetryable2 = (error) => {
|
|
|
16722
17025
|
}
|
|
16723
17026
|
return true;
|
|
16724
17027
|
};
|
|
16725
|
-
var
|
|
17028
|
+
var sleep3 = (ms) => {
|
|
16726
17029
|
return new Promise((resolve) => {
|
|
16727
17030
|
setTimeout(resolve, ms);
|
|
16728
17031
|
});
|
|
@@ -16788,14 +17091,14 @@ var labelBatch = async (hosts, { system, logContext, internalModels, signal }) =
|
|
|
16788
17091
|
signal?.throwIfAborted();
|
|
16789
17092
|
lastError = error;
|
|
16790
17093
|
if (attempt < domainTransientAttempts && isRetryable2(error)) {
|
|
16791
|
-
const
|
|
17094
|
+
const delay4 = domainRetryDelaysMs[attempt - 1] ?? 8e3;
|
|
16792
17095
|
log11.warn("Domain label batch failed; retrying", {
|
|
16793
17096
|
...logContext,
|
|
16794
17097
|
attempt,
|
|
16795
|
-
delayMs:
|
|
17098
|
+
delayMs: delay4,
|
|
16796
17099
|
error: error instanceof Error ? error.message : String(error)
|
|
16797
17100
|
});
|
|
16798
|
-
await
|
|
17101
|
+
await sleep3(delay4);
|
|
16799
17102
|
continue;
|
|
16800
17103
|
}
|
|
16801
17104
|
break;
|
|
@@ -17004,7 +17307,8 @@ var planRun = (config, request2) => {
|
|
|
17004
17307
|
sectionKey: section.key,
|
|
17005
17308
|
prompts: section.prompts,
|
|
17006
17309
|
surfaces,
|
|
17007
|
-
agentProbes: config.agentProbes
|
|
17310
|
+
agentProbes: config.agentProbes,
|
|
17311
|
+
chatProbes: config.chatProbes
|
|
17008
17312
|
})
|
|
17009
17313
|
);
|
|
17010
17314
|
if (units.length > request2.maxPlannedUnits) {
|
|
@@ -17282,7 +17586,8 @@ var projectProgressMeasurement = (input) => {
|
|
|
17282
17586
|
sectionKey: section.key,
|
|
17283
17587
|
prompts: section.prompts,
|
|
17284
17588
|
surfaces,
|
|
17285
|
-
agentProbes: config.agentProbes
|
|
17589
|
+
agentProbes: config.agentProbes,
|
|
17590
|
+
chatProbes: config.chatProbes
|
|
17286
17591
|
})
|
|
17287
17592
|
);
|
|
17288
17593
|
const planned = /* @__PURE__ */ new Map();
|
|
@@ -17499,7 +17804,7 @@ var validateReportArtifacts = (value, reportKey, runId2) => {
|
|
|
17499
17804
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
17500
17805
|
import { mkdir as mkdir10, open as open5, readFile as readFile19, rename as rename7, unlink as unlink3 } from "node:fs/promises";
|
|
17501
17806
|
import { join as join2 } from "node:path";
|
|
17502
|
-
import { setTimeout as
|
|
17807
|
+
import { setTimeout as delay2 } from "node:timers/promises";
|
|
17503
17808
|
import { z as z52 } from "zod";
|
|
17504
17809
|
|
|
17505
17810
|
// src/stores/publication-history.ts
|
|
@@ -17595,7 +17900,7 @@ var withFilePublicationLock = async (directory, action) => {
|
|
|
17595
17900
|
throw error;
|
|
17596
17901
|
}
|
|
17597
17902
|
if (attempt < lockAttempts - 1) {
|
|
17598
|
-
await
|
|
17903
|
+
await delay2(lockRetryDelayMs);
|
|
17599
17904
|
}
|
|
17600
17905
|
}
|
|
17601
17906
|
}
|
|
@@ -18032,12 +18337,6 @@ var buildNarrativeFacts = (snapshot, config, runId2) => {
|
|
|
18032
18337
|
unit: "count",
|
|
18033
18338
|
sentence: `This audit tested ${config.brand.name} in the ${market} section using these questions: ${JSON.stringify(configured.prompts.map(({ text }) => text))}. These are the configured audit questions, not measured search demand or verified customer conversations. Locale: ${config.geography}, language: ${config.language}.`
|
|
18034
18339
|
});
|
|
18035
|
-
const planned = (surface) => {
|
|
18036
|
-
return isAgentSurface(surface) ? Math.min(
|
|
18037
|
-
configured.prompts.length,
|
|
18038
|
-
config.agentProbes.maxPromptsPerSection ?? configured.prompts.length
|
|
18039
|
-
) * config.agentProbes.runsPerPrompt : configured.prompts.length * surfaceRunCounts[surface];
|
|
18040
|
-
};
|
|
18041
18340
|
for (const group of ["chat", "agents"]) {
|
|
18042
18341
|
const surfaces = section.visibility.surfaces.filter(
|
|
18043
18342
|
(surface) => isAgentSurface(surface) === (group === "agents")
|
|
@@ -18048,10 +18347,13 @@ var buildNarrativeFacts = (snapshot, config, runId2) => {
|
|
|
18048
18347
|
const rows = section.visibility.matrix.filter(
|
|
18049
18348
|
(row) => surfaces.includes(row.surface)
|
|
18050
18349
|
);
|
|
18051
|
-
const denominator =
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18350
|
+
const denominator = plannedProbeUnitsForSection({
|
|
18351
|
+
sectionKey: section.key,
|
|
18352
|
+
prompts: configured.prompts,
|
|
18353
|
+
surfaces,
|
|
18354
|
+
agentProbes: config.agentProbes,
|
|
18355
|
+
chatProbes: config.chatProbes
|
|
18356
|
+
}).length;
|
|
18055
18357
|
const names = group === "agents" ? "coding agents" : "chat and search assistants";
|
|
18056
18358
|
const entities = [
|
|
18057
18359
|
{ ...config.brand, prospect: true },
|
|
@@ -18122,10 +18424,13 @@ var buildFactCatalog = ({
|
|
|
18122
18424
|
const rows = section.visibility.matrix.filter(
|
|
18123
18425
|
(row) => row.surface === surface
|
|
18124
18426
|
);
|
|
18125
|
-
const count =
|
|
18126
|
-
|
|
18127
|
-
|
|
18128
|
-
|
|
18427
|
+
const count = plannedProbeUnitsForSection({
|
|
18428
|
+
sectionKey: section.key,
|
|
18429
|
+
prompts: configured.prompts,
|
|
18430
|
+
surfaces: [surface],
|
|
18431
|
+
agentProbes: config.agentProbes,
|
|
18432
|
+
chatProbes: config.chatProbes
|
|
18433
|
+
}).length;
|
|
18129
18434
|
for (const metric of ["mentions", "citations"]) {
|
|
18130
18435
|
const numerator = rows.filter(
|
|
18131
18436
|
(row) => metric === "mentions" ? row.prospectMentioned : isDomainCited(row.citedUrls ?? [], config.brand.domain)
|
|
@@ -19553,6 +19858,24 @@ var openFileStores = async (reportKey, opts = {}) => {
|
|
|
19553
19858
|
import { readFile as readFile23 } from "node:fs/promises";
|
|
19554
19859
|
import { z as z55 } from "zod";
|
|
19555
19860
|
|
|
19861
|
+
// src/checks/money-pages.ts
|
|
19862
|
+
var maxMoneyPages = 20;
|
|
19863
|
+
var moneyPageProblem = (page, site) => {
|
|
19864
|
+
const hosts = [site.domain, ...site.checkHosts ?? []];
|
|
19865
|
+
if (!hosts.some((host) => urlIsOnDomain(page, host))) {
|
|
19866
|
+
return { kind: "off_site" };
|
|
19867
|
+
}
|
|
19868
|
+
try {
|
|
19869
|
+
validateResearchUrl(page);
|
|
19870
|
+
} catch (err) {
|
|
19871
|
+
if (err instanceof SourceRetrievalError) {
|
|
19872
|
+
return { kind: "unsafe_url", message: err.message };
|
|
19873
|
+
}
|
|
19874
|
+
throw err;
|
|
19875
|
+
}
|
|
19876
|
+
return void 0;
|
|
19877
|
+
};
|
|
19878
|
+
|
|
19556
19879
|
// src/models/local-profile.ts
|
|
19557
19880
|
var promptVersions = {
|
|
19558
19881
|
copy: 5,
|
|
@@ -19817,8 +20140,31 @@ var runPolicySchema2 = z55.object({
|
|
|
19817
20140
|
allowPartial: z55.boolean().default(false),
|
|
19818
20141
|
// Caps every paid call of the run: probes, Codex stage sessions, host
|
|
19819
20142
|
// model calls and searches (see BudgetPolicy).
|
|
19820
|
-
budget: budgetPolicySchema.prefault({})
|
|
20143
|
+
budget: budgetPolicySchema.prefault({}),
|
|
20144
|
+
// Hosts off the brand's site whose pages the site checks may fetch (a
|
|
20145
|
+
// docs site on another domain). A permission, not a measurement input:
|
|
20146
|
+
// granting one never moves a baseline.
|
|
20147
|
+
checkHosts: z55.array(z55.string().trim().min(1)).max(20).default([])
|
|
19821
20148
|
}).strict();
|
|
20149
|
+
var checkHostProblem = (host) => {
|
|
20150
|
+
try {
|
|
20151
|
+
const url = validateResearchUrl(`https://${host}/`);
|
|
20152
|
+
if (url.hostname === host.toLowerCase()) {
|
|
20153
|
+
return void 0;
|
|
20154
|
+
}
|
|
20155
|
+
} catch (err) {
|
|
20156
|
+
if (!(err instanceof SourceRetrievalError)) {
|
|
20157
|
+
throw err;
|
|
20158
|
+
}
|
|
20159
|
+
}
|
|
20160
|
+
return `Use a bare public host name such as docs.acme.example, not ${JSON.stringify(host)}.`;
|
|
20161
|
+
};
|
|
20162
|
+
var describeMoneyPageProblem = (page, domain, problem) => {
|
|
20163
|
+
if (problem.kind === "unsafe_url") {
|
|
20164
|
+
return `A money page must be a public https URL with no port or credentials: ${problem.message}`;
|
|
20165
|
+
}
|
|
20166
|
+
return `${page} is not on ${domain} or its subdomains. Name its host in runPolicy.checkHosts to let the site checks fetch it.`;
|
|
20167
|
+
};
|
|
19822
20168
|
var auditFileSchema = z55.object({
|
|
19823
20169
|
version: z55.literal(auditFileVersion),
|
|
19824
20170
|
// The gateway model every text role and Codex stage runs on; absent
|
|
@@ -19830,10 +20176,14 @@ var auditFileSchema = z55.object({
|
|
|
19830
20176
|
ownedDomains: z55.array(z55.string().min(1)).max(20).optional(),
|
|
19831
20177
|
sections: z55.array(sectionSchema).min(1).max(2),
|
|
19832
20178
|
surfaces: z55.array(aeoSurfaceSchema).min(1).default([...allSurfaces]),
|
|
19833
|
-
|
|
20179
|
+
// Strict here, unlike the internal config that bundles keep: a
|
|
20180
|
+
// misspelled key is refused, never dropped for the default depth.
|
|
20181
|
+
agentProbes: agentProbeConfigSchema.strict().prefault({}),
|
|
20182
|
+
// Absent = the standard depth (2 runs per prompt, 1 on AI Overview).
|
|
20183
|
+
chatProbes: chatProbeConfigSchema.optional(),
|
|
19834
20184
|
geography: z55.string().default("us"),
|
|
19835
20185
|
language: z55.string().default("en"),
|
|
19836
|
-
moneyPages: z55.array(z55.url()).default([]),
|
|
20186
|
+
moneyPages: z55.array(z55.url()).max(maxMoneyPages).default([]),
|
|
19837
20187
|
productBrief: z55.string().trim().min(1),
|
|
19838
20188
|
// `full` researches and adjudicates the claims answers make about the
|
|
19839
20189
|
// product; `extraction_only` keeps the claim inventory and skips both.
|
|
@@ -19849,6 +20199,29 @@ var auditFileSchema = z55.object({
|
|
|
19849
20199
|
path: ["geography"]
|
|
19850
20200
|
});
|
|
19851
20201
|
}
|
|
20202
|
+
for (const [index, host] of file.runPolicy.checkHosts.entries()) {
|
|
20203
|
+
const problem = checkHostProblem(host);
|
|
20204
|
+
if (problem !== void 0) {
|
|
20205
|
+
context.addIssue({
|
|
20206
|
+
code: "custom",
|
|
20207
|
+
message: problem,
|
|
20208
|
+
path: ["runPolicy", "checkHosts", index]
|
|
20209
|
+
});
|
|
20210
|
+
}
|
|
20211
|
+
}
|
|
20212
|
+
for (const [index, page] of file.moneyPages.entries()) {
|
|
20213
|
+
const problem = moneyPageProblem(page, {
|
|
20214
|
+
domain: file.brand.domain,
|
|
20215
|
+
checkHosts: file.runPolicy.checkHosts
|
|
20216
|
+
});
|
|
20217
|
+
if (problem !== void 0) {
|
|
20218
|
+
context.addIssue({
|
|
20219
|
+
code: "custom",
|
|
20220
|
+
message: describeMoneyPageProblem(page, file.brand.domain, problem),
|
|
20221
|
+
path: ["moneyPages", index]
|
|
20222
|
+
});
|
|
20223
|
+
}
|
|
20224
|
+
}
|
|
19852
20225
|
const keys = file.sections.map((section) => section.key);
|
|
19853
20226
|
if (new Set(keys).size !== keys.length) {
|
|
19854
20227
|
context.addIssue({
|
|
@@ -19908,6 +20281,7 @@ var toAuditConfig = (file) => {
|
|
|
19908
20281
|
},
|
|
19909
20282
|
sections: file.sections,
|
|
19910
20283
|
agentProbes: file.agentProbes,
|
|
20284
|
+
...file.chatProbes !== void 0 && { chatProbes: file.chatProbes },
|
|
19911
20285
|
moneyPages: file.moneyPages,
|
|
19912
20286
|
productBrief: file.productBrief,
|
|
19913
20287
|
surfaces: {
|
|
@@ -20139,6 +20513,7 @@ var openLockedLocalRun = async (file, dir, {
|
|
|
20139
20513
|
|
|
20140
20514
|
// src/engine/preflight.ts
|
|
20141
20515
|
import { mkdir as mkdir14, rm as rm6, writeFile as writeFile11 } from "node:fs/promises";
|
|
20516
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
20142
20517
|
import path25 from "node:path";
|
|
20143
20518
|
var minimumNodeMajor = 24;
|
|
20144
20519
|
var gatewaySetting = "AI_GATEWAY_API_KEY";
|
|
@@ -20187,6 +20562,33 @@ var directoryCheck = async (dir) => {
|
|
|
20187
20562
|
return { name: "run directory", ok: false, detail: `${dir}: ${message}` };
|
|
20188
20563
|
}
|
|
20189
20564
|
};
|
|
20565
|
+
var chromiumInstallCommand = () => {
|
|
20566
|
+
const manifest = createRequire2(import.meta.url)(
|
|
20567
|
+
"playwright/package.json"
|
|
20568
|
+
);
|
|
20569
|
+
const version = typeof manifest === "object" && manifest !== null && "version" in manifest && typeof manifest.version === "string" ? `@${manifest.version}` : "";
|
|
20570
|
+
return `npx playwright${version} install chromium`;
|
|
20571
|
+
};
|
|
20572
|
+
var chromiumCheck = async () => {
|
|
20573
|
+
try {
|
|
20574
|
+
const { chromium } = await import("playwright");
|
|
20575
|
+
const browser = await chromium.launch();
|
|
20576
|
+
const version = browser.version();
|
|
20577
|
+
await browser.close();
|
|
20578
|
+
return {
|
|
20579
|
+
name: "chromium (money pages)",
|
|
20580
|
+
ok: true,
|
|
20581
|
+
detail: `Chromium ${version} launches`
|
|
20582
|
+
};
|
|
20583
|
+
} catch (err) {
|
|
20584
|
+
const message = err instanceof Error ? err.message.split("\n")[0] : "";
|
|
20585
|
+
return {
|
|
20586
|
+
name: "chromium (money pages)",
|
|
20587
|
+
ok: false,
|
|
20588
|
+
detail: `does not launch (${message}); run \`${chromiumInstallCommand()}\`, or remove moneyPages from audit.json`
|
|
20589
|
+
};
|
|
20590
|
+
}
|
|
20591
|
+
};
|
|
20190
20592
|
var modelCheck = (model) => {
|
|
20191
20593
|
const id2 = model ?? recommendedModelId;
|
|
20192
20594
|
const supported = findSupportedModel(id2);
|
|
@@ -20268,6 +20670,9 @@ var runPreflight = async (args) => {
|
|
|
20268
20670
|
detail: version === null ? `\`${cliNameForSurface(surface)}\` not installed; needed only when the config measures coding agents` : `${cliNameForSurface(surface)} ${version} installed; this config does not measure it`
|
|
20269
20671
|
});
|
|
20270
20672
|
}
|
|
20673
|
+
if (args.rendersPages) {
|
|
20674
|
+
checks.push(await chromiumCheck());
|
|
20675
|
+
}
|
|
20271
20676
|
checks.push(await directoryCheck(args.dir));
|
|
20272
20677
|
return checks;
|
|
20273
20678
|
};
|
|
@@ -20275,7 +20680,7 @@ var runPreflight = async (args) => {
|
|
|
20275
20680
|
// src/viewer/server.ts
|
|
20276
20681
|
import { randomBytes as randomBytes2, timingSafeEqual } from "node:crypto";
|
|
20277
20682
|
import {
|
|
20278
|
-
createServer
|
|
20683
|
+
createServer as createServer2
|
|
20279
20684
|
} from "node:http";
|
|
20280
20685
|
import { z as z56 } from "zod";
|
|
20281
20686
|
|
|
@@ -20580,7 +20985,7 @@ var startViewer = async (bundle, { port = 0 } = {}) => {
|
|
|
20580
20985
|
contentType: "application/json"
|
|
20581
20986
|
});
|
|
20582
20987
|
};
|
|
20583
|
-
const server =
|
|
20988
|
+
const server = createServer2(handle);
|
|
20584
20989
|
await new Promise((resolve, reject) => {
|
|
20585
20990
|
server.once("error", reject);
|
|
20586
20991
|
server.listen(port, "127.0.0.1", () => {
|
|
@@ -22011,7 +22416,7 @@ import {
|
|
|
22011
22416
|
writeFile as writeFile17
|
|
22012
22417
|
} from "node:fs/promises";
|
|
22013
22418
|
import path37 from "node:path";
|
|
22014
|
-
import { setTimeout as
|
|
22419
|
+
import { setTimeout as delay3 } from "node:timers/promises";
|
|
22015
22420
|
import { z as z65 } from "zod";
|
|
22016
22421
|
|
|
22017
22422
|
// src/models/pricing.ts
|
|
@@ -22167,7 +22572,9 @@ var validateAuthorOutput = async (args) => {
|
|
|
22167
22572
|
...config.competitors,
|
|
22168
22573
|
...config.sections.flatMap((section) => section.competitors ?? [])
|
|
22169
22574
|
];
|
|
22170
|
-
if (!underHost(normalizeDomain(config.brand.domain), host) || config.moneyPages.some(
|
|
22575
|
+
if (!underHost(normalizeDomain(config.brand.domain), host) || config.moneyPages.some(
|
|
22576
|
+
(url) => moneyPageProblem(url, { domain: host })?.kind === "off_site"
|
|
22577
|
+
) || competitors.some(
|
|
22171
22578
|
(competitor) => args.protectedClientHosts.some(
|
|
22172
22579
|
(client) => underHost(normalizeDomain(competitor.domain), normalizeDomain(client))
|
|
22173
22580
|
)
|
|
@@ -22180,6 +22587,19 @@ var validateAuthorOutput = async (args) => {
|
|
|
22180
22587
|
fatal: "brief_mismatch"
|
|
22181
22588
|
};
|
|
22182
22589
|
}
|
|
22590
|
+
config.moneyPages.forEach((url, index) => {
|
|
22591
|
+
const problem = moneyPageProblem(url, { domain: host });
|
|
22592
|
+
if (problem?.kind === "unsafe_url") {
|
|
22593
|
+
errors.push(
|
|
22594
|
+
`moneyPages.${index}: Use a public https URL with no port or credentials (${problem.message})`
|
|
22595
|
+
);
|
|
22596
|
+
}
|
|
22597
|
+
});
|
|
22598
|
+
if (config.moneyPages.length > maxMoneyPages) {
|
|
22599
|
+
errors.push(
|
|
22600
|
+
`moneyPages: Keep the ${maxMoneyPages} pages that matter most; the site checks fetch at most ${maxMoneyPages}.`
|
|
22601
|
+
);
|
|
22602
|
+
}
|
|
22183
22603
|
notes.data.proposedFacts.forEach((fact, index) => {
|
|
22184
22604
|
if (briefClaimPrefix.test(fact.proposition.trim())) {
|
|
22185
22605
|
errors.push(
|
|
@@ -24004,7 +24424,7 @@ var copyVerdict = async (ctx, { label, ask }) => {
|
|
|
24004
24424
|
if (!retrying) {
|
|
24005
24425
|
throw new CopyVerificationUnavailableError(outcome, verdict.errors);
|
|
24006
24426
|
}
|
|
24007
|
-
await
|
|
24427
|
+
await delay3(attempt * 1e3, void 0, { signal: ctx.signal });
|
|
24008
24428
|
}
|
|
24009
24429
|
};
|
|
24010
24430
|
var runVerifiedCopy = async (ctx, {
|
|
@@ -25746,7 +26166,8 @@ var runDoctor = async (flags) => {
|
|
|
25746
26166
|
settings,
|
|
25747
26167
|
dir: runDirOf(flags),
|
|
25748
26168
|
model: file.model,
|
|
25749
|
-
groundingSearch: usesGroundingSearch(request2)
|
|
26169
|
+
groundingSearch: usesGroundingSearch(request2),
|
|
26170
|
+
rendersPages: file.moneyPages.length > 0
|
|
25750
26171
|
});
|
|
25751
26172
|
const ok = checks.every((check) => check.ok);
|
|
25752
26173
|
if (flags.switches.has("--json")) {
|
|
@@ -25861,7 +26282,8 @@ var runRun = async (flags) => {
|
|
|
25861
26282
|
settings,
|
|
25862
26283
|
dir,
|
|
25863
26284
|
model: file.model,
|
|
25864
|
-
groundingSearch: usesGroundingSearch(request2)
|
|
26285
|
+
groundingSearch: usesGroundingSearch(request2),
|
|
26286
|
+
rendersPages: file.moneyPages.length > 0
|
|
25865
26287
|
});
|
|
25866
26288
|
const failing = checks.filter((check) => !check.ok);
|
|
25867
26289
|
if (failing.length > 0) {
|