literally-aeo 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +73 -2
- package/dist/author-tools.js +3031 -0
- package/dist/cli.mjs +25536 -0
- package/dist/lib/access/schema.js +24 -0
- package/dist/lib/agents/author-schema.js +28 -0
- package/dist/lib/agents/author-validation.js +46 -0
- package/dist/lib/agents/copy-schema.js +30 -0
- package/dist/lib/agents/copy-validation.js +62 -0
- package/dist/lib/agents/copywriter-input.js +31 -0
- package/dist/lib/agents/credentials.js +6 -0
- package/dist/lib/agents/facts.js +31 -0
- package/dist/lib/agents/narrative-facts.js +12 -0
- package/dist/lib/agents/verifier.js +62 -0
- package/dist/lib/analysis/answer-text.js +19 -0
- package/dist/lib/analysis/competitor-classifier.js +6 -0
- package/dist/lib/analysis/domain-classifier.js +73 -0
- package/dist/lib/analysis/domain-labels.js +32 -0
- package/dist/lib/analysis/domain-match.js +12 -0
- package/dist/lib/analysis/name-forms.js +12 -0
- package/dist/lib/analysis/outreach.js +17 -0
- package/dist/lib/analysis/progress-schema.js +13 -0
- package/dist/lib/analysis/progress.js +39 -0
- package/dist/lib/analysis/qualified-competitors.js +7 -0
- package/dist/lib/analysis/retrieval.js +16 -0
- package/dist/lib/analysis/scoring.js +12 -0
- package/dist/lib/analysis/search-analyzer.js +17 -0
- package/dist/lib/analysis/sentiment.js +61 -0
- package/dist/lib/analysis/source-classifier.js +22 -0
- package/dist/lib/analysis/source-mix.js +16 -0
- package/dist/lib/analysis/verbatim.js +6 -0
- package/dist/lib/api/errors.js +10 -0
- package/dist/lib/author/examples.js +34 -0
- package/dist/lib/bundle/checks.js +16 -0
- package/dist/lib/bundle/contracts.js +66 -0
- package/dist/lib/bundle/export.js +69 -0
- package/dist/lib/bundle/journal.js +41 -0
- package/dist/lib/bundle/json.js +13 -0
- package/dist/lib/bundle/lineage.js +13 -0
- package/dist/lib/bundle/paths.js +6 -0
- package/dist/lib/bundle/project-journal.js +36 -0
- package/dist/lib/bundle/project.js +55 -0
- package/dist/lib/bundle/read.js +60 -0
- package/dist/lib/bundle/recorder.js +46 -0
- package/dist/lib/bundle/redact.js +35 -0
- package/dist/lib/bundle/trace-coverage.js +33 -0
- package/dist/lib/bundle/verify-integrity.js +41 -0
- package/dist/lib/bundle/verify-measurement.js +49 -0
- package/dist/lib/bundle/verify-report.js +62 -0
- package/dist/lib/bundle/verify.js +71 -0
- package/dist/lib/bundle/writer-lock.js +11 -0
- package/dist/lib/bundle/zip.js +13 -0
- package/dist/lib/capture-manifest.js +42 -0
- package/dist/lib/checks/crawler-access.js +16 -0
- package/dist/lib/checks/renderability.js +8 -0
- package/dist/lib/checks/run-checks.js +38 -0
- package/dist/lib/chunks/chunk-2KJZ326K.js +253 -0
- package/dist/lib/chunks/chunk-2MGARWKY.js +138 -0
- package/dist/lib/chunks/chunk-2NJEWPCV.js +94 -0
- package/dist/lib/chunks/chunk-2PAO43CH.js +43 -0
- package/dist/lib/chunks/chunk-2QLAFBCG.js +8 -0
- package/dist/lib/chunks/chunk-2ROSV4HD.js +64 -0
- package/dist/lib/chunks/chunk-2URYGUMH.js +27 -0
- package/dist/lib/chunks/chunk-3BFCI7LI.js +34 -0
- package/dist/lib/chunks/chunk-3BJWRD4O.js +0 -0
- package/dist/lib/chunks/chunk-3EBWDHPK.js +133 -0
- package/dist/lib/chunks/chunk-3UFZ2XPE.js +73 -0
- package/dist/lib/chunks/chunk-4E4NDGOZ.js +47 -0
- package/dist/lib/chunks/chunk-4QQJXCD2.js +113 -0
- package/dist/lib/chunks/chunk-4US3OBKJ.js +136 -0
- package/dist/lib/chunks/chunk-4ZY6P5SO.js +303 -0
- package/dist/lib/chunks/chunk-55U7PRRM.js +26 -0
- package/dist/lib/chunks/chunk-565CYND6.js +93 -0
- package/dist/lib/chunks/chunk-56VOFZ7T.js +1486 -0
- package/dist/lib/chunks/chunk-5B3RNVZ6.js +193 -0
- package/dist/lib/chunks/chunk-5EX5DKMA.js +812 -0
- package/dist/lib/chunks/chunk-5GZVDGTX.js +316 -0
- package/dist/lib/chunks/chunk-5H3SNUQT.js +101 -0
- package/dist/lib/chunks/chunk-5HT55QYX.js +53 -0
- package/dist/lib/chunks/chunk-5KKLUM7M.js +105 -0
- package/dist/lib/chunks/chunk-5SOTF3XD.js +56 -0
- package/dist/lib/chunks/chunk-5T3V6XJS.js +41 -0
- package/dist/lib/chunks/chunk-5VNYUCLL.js +352 -0
- package/dist/lib/chunks/chunk-5ZITQDVE.js +149 -0
- package/dist/lib/chunks/chunk-6AUEDSTU.js +52 -0
- package/dist/lib/chunks/chunk-6EH4N3EU.js +113 -0
- package/dist/lib/chunks/chunk-6EI4CVRW.js +33 -0
- package/dist/lib/chunks/chunk-6GKKALCI.js +538 -0
- package/dist/lib/chunks/chunk-6GSQKCKF.js +48 -0
- package/dist/lib/chunks/chunk-6KHQ7DXP.js +100 -0
- package/dist/lib/chunks/chunk-6KO7HGCQ.js +229 -0
- package/dist/lib/chunks/chunk-6RAKXYSR.js +226 -0
- package/dist/lib/chunks/chunk-72P6NOKD.js +190 -0
- package/dist/lib/chunks/chunk-74UNVGWB.js +0 -0
- package/dist/lib/chunks/chunk-7GXRDAUY.js +554 -0
- package/dist/lib/chunks/chunk-7MR6IJ7I.js +0 -0
- package/dist/lib/chunks/chunk-7O3M6I2X.js +123 -0
- package/dist/lib/chunks/chunk-7PLK6VGC.js +12 -0
- package/dist/lib/chunks/chunk-7QYZSP7Q.js +190 -0
- package/dist/lib/chunks/chunk-7YYDUHJG.js +113 -0
- package/dist/lib/chunks/chunk-7ZOJE6BH.js +73 -0
- package/dist/lib/chunks/chunk-AKKFERA4.js +99 -0
- package/dist/lib/chunks/chunk-AP5DLF36.js +150 -0
- package/dist/lib/chunks/chunk-AUB5THIS.js +341 -0
- package/dist/lib/chunks/chunk-AWOJWMPN.js +213 -0
- package/dist/lib/chunks/chunk-B5L2KMTU.js +108 -0
- package/dist/lib/chunks/chunk-BEQLSAVX.js +202 -0
- package/dist/lib/chunks/chunk-C6CMSW5J.js +13 -0
- package/dist/lib/chunks/chunk-CFFPOTP4.js +356 -0
- package/dist/lib/chunks/chunk-CJ5YD3CU.js +237 -0
- package/dist/lib/chunks/chunk-CPT2GKKW.js +188 -0
- package/dist/lib/chunks/chunk-CQ62GN7P.js +30 -0
- package/dist/lib/chunks/chunk-CRVCWDH6.js +0 -0
- package/dist/lib/chunks/chunk-CS24IL3K.js +115 -0
- package/dist/lib/chunks/chunk-D2INDP5W.js +240 -0
- package/dist/lib/chunks/chunk-D2LPQO6Y.js +39 -0
- package/dist/lib/chunks/chunk-D5B4ZOW6.js +61 -0
- package/dist/lib/chunks/chunk-D7GEQVLL.js +115 -0
- package/dist/lib/chunks/chunk-DC6PN7QJ.js +193 -0
- package/dist/lib/chunks/chunk-DYJVVQHD.js +60 -0
- package/dist/lib/chunks/chunk-E3CDKC5B.js +45 -0
- package/dist/lib/chunks/chunk-E4HADK7C.js +18 -0
- package/dist/lib/chunks/chunk-E6NQQU6V.js +111 -0
- package/dist/lib/chunks/chunk-EBXOHAMQ.js +131 -0
- package/dist/lib/chunks/chunk-EPQHVILQ.js +348 -0
- package/dist/lib/chunks/chunk-EV4DRS5M.js +61 -0
- package/dist/lib/chunks/chunk-EYKINDNK.js +29 -0
- package/dist/lib/chunks/chunk-EZD2C7QS.js +10 -0
- package/dist/lib/chunks/chunk-FBFZBLTY.js +752 -0
- package/dist/lib/chunks/chunk-FFOVLI3U.js +235 -0
- package/dist/lib/chunks/chunk-FKLNEB2P.js +529 -0
- package/dist/lib/chunks/chunk-FT5NSQYX.js +0 -0
- package/dist/lib/chunks/chunk-FWBVTM7F.js +11 -0
- package/dist/lib/chunks/chunk-GLXY73MK.js +165 -0
- package/dist/lib/chunks/chunk-GMGKKE5N.js +11 -0
- package/dist/lib/chunks/chunk-GVC4LH2N.js +130 -0
- package/dist/lib/chunks/chunk-GVOF5ZUG.js +44 -0
- package/dist/lib/chunks/chunk-H2KDLDK6.js +13 -0
- package/dist/lib/chunks/chunk-H3G3VTT7.js +259 -0
- package/dist/lib/chunks/chunk-H56DDRKE.js +85 -0
- package/dist/lib/chunks/chunk-HOJXKHPX.js +34 -0
- package/dist/lib/chunks/chunk-HSZ3DM74.js +55 -0
- package/dist/lib/chunks/chunk-HXHFMFQU.js +29 -0
- package/dist/lib/chunks/chunk-I7VNIW6Q.js +196 -0
- package/dist/lib/chunks/chunk-IAR6XGEW.js +184 -0
- package/dist/lib/chunks/chunk-IB6RROHE.js +204 -0
- package/dist/lib/chunks/chunk-IBOWGKN7.js +98 -0
- package/dist/lib/chunks/chunk-IEVAFDW7.js +513 -0
- package/dist/lib/chunks/chunk-IPNK7FYT.js +70 -0
- package/dist/lib/chunks/chunk-IRPKBDB7.js +13 -0
- package/dist/lib/chunks/chunk-ISN6MBNB.js +70 -0
- package/dist/lib/chunks/chunk-J46W3EMQ.js +237 -0
- package/dist/lib/chunks/chunk-J6IJGYP5.js +147 -0
- package/dist/lib/chunks/chunk-JQ3P552S.js +0 -0
- package/dist/lib/chunks/chunk-JS3GBU3R.js +46 -0
- package/dist/lib/chunks/chunk-KMRQSIZW.js +90 -0
- package/dist/lib/chunks/chunk-KRFHQQS7.js +323 -0
- package/dist/lib/chunks/chunk-KZR25REO.js +95 -0
- package/dist/lib/chunks/chunk-LIZX4N3H.js +110 -0
- package/dist/lib/chunks/chunk-M2OD74GP.js +93 -0
- package/dist/lib/chunks/chunk-MHAKYFDF.js +741 -0
- package/dist/lib/chunks/chunk-MIF5IYNR.js +139 -0
- package/dist/lib/chunks/chunk-MRRWMAPA.js +0 -0
- package/dist/lib/chunks/chunk-MX6Y4RD2.js +22 -0
- package/dist/lib/chunks/chunk-N2XIGMJ6.js +0 -0
- package/dist/lib/chunks/chunk-N2ZZ6JRF.js +188 -0
- package/dist/lib/chunks/chunk-NANJGMEJ.js +108 -0
- package/dist/lib/chunks/chunk-NCLFZOZU.js +74 -0
- package/dist/lib/chunks/chunk-NH4QGBJV.js +61 -0
- package/dist/lib/chunks/chunk-NL2LDKXX.js +125 -0
- package/dist/lib/chunks/chunk-NZFMOQHU.js +32 -0
- package/dist/lib/chunks/chunk-O2DKE2RO.js +77 -0
- package/dist/lib/chunks/chunk-O7M2OY3H.js +35 -0
- package/dist/lib/chunks/chunk-OBXAHX3L.js +46 -0
- package/dist/lib/chunks/chunk-OL746E4T.js +350 -0
- package/dist/lib/chunks/chunk-OORO55OM.js +922 -0
- package/dist/lib/chunks/chunk-OVUCZLH2.js +114 -0
- package/dist/lib/chunks/chunk-OX656HYK.js +46 -0
- package/dist/lib/chunks/chunk-OYKV5NDM.js +28 -0
- package/dist/lib/chunks/chunk-P4K6BP3L.js +104 -0
- package/dist/lib/chunks/chunk-PCYNBDZ7.js +386 -0
- package/dist/lib/chunks/chunk-PDS5KWO3.js +256 -0
- package/dist/lib/chunks/chunk-PKB6JRJM.js +53 -0
- package/dist/lib/chunks/chunk-PO2J5OQ3.js +46 -0
- package/dist/lib/chunks/chunk-PYLJISDZ.js +206 -0
- package/dist/lib/chunks/chunk-Q2PWES4B.js +822 -0
- package/dist/lib/chunks/chunk-QBD24WTZ.js +37 -0
- package/dist/lib/chunks/chunk-QFVRCSJ2.js +54 -0
- package/dist/lib/chunks/chunk-QTXOW5XC.js +14 -0
- package/dist/lib/chunks/chunk-RBOO4NDG.js +33 -0
- package/dist/lib/chunks/chunk-RMFT4KKK.js +281 -0
- package/dist/lib/chunks/chunk-S2AM76LT.js +90 -0
- package/dist/lib/chunks/chunk-S2SFHTJD.js +152 -0
- package/dist/lib/chunks/chunk-S42BCLHP.js +0 -0
- package/dist/lib/chunks/chunk-S7KJZIUR.js +241 -0
- package/dist/lib/chunks/chunk-SBAZBOPI.js +33 -0
- package/dist/lib/chunks/chunk-SBQ4TWGJ.js +33 -0
- package/dist/lib/chunks/chunk-SDWYZM64.js +371 -0
- package/dist/lib/chunks/chunk-SREGO3PU.js +25 -0
- package/dist/lib/chunks/chunk-SWJ7KQSL.js +318 -0
- package/dist/lib/chunks/chunk-SZ2UBZKG.js +13 -0
- package/dist/lib/chunks/chunk-TCOH3FGE.js +66 -0
- package/dist/lib/chunks/chunk-TGTM5ZFR.js +82 -0
- package/dist/lib/chunks/chunk-TNL2GWYR.js +345 -0
- package/dist/lib/chunks/chunk-UGCT46PC.js +20 -0
- package/dist/lib/chunks/chunk-ULRXHSJL.js +85 -0
- package/dist/lib/chunks/chunk-URUODEVG.js +0 -0
- package/dist/lib/chunks/chunk-V5B6UZ3E.js +47 -0
- package/dist/lib/chunks/chunk-VHDVKEWO.js +102 -0
- package/dist/lib/chunks/chunk-W46Y7KBR.js +29 -0
- package/dist/lib/chunks/chunk-W5XYW6ZM.js +133 -0
- package/dist/lib/chunks/chunk-WDSCJEDG.js +371 -0
- package/dist/lib/chunks/chunk-WE2WPNG2.js +104 -0
- package/dist/lib/chunks/chunk-WJUHRJVW.js +55 -0
- package/dist/lib/chunks/chunk-WKH6BJAZ.js +167 -0
- package/dist/lib/chunks/chunk-WTQWU522.js +343 -0
- package/dist/lib/chunks/chunk-WUELMJ22.js +345 -0
- package/dist/lib/chunks/chunk-X2Y2ZNG3.js +776 -0
- package/dist/lib/chunks/chunk-X6E44EGV.js +261 -0
- package/dist/lib/chunks/chunk-XHWRSGX3.js +95 -0
- package/dist/lib/chunks/chunk-XI5H46DF.js +47 -0
- package/dist/lib/chunks/chunk-XJVXASDD.js +281 -0
- package/dist/lib/chunks/chunk-XU6WQ5UL.js +257 -0
- package/dist/lib/chunks/chunk-Y4OGZ3Q5.js +365 -0
- package/dist/lib/chunks/chunk-Y6D6IVOM.js +299 -0
- package/dist/lib/chunks/chunk-YHS5IEVZ.js +252 -0
- package/dist/lib/chunks/chunk-YIEAIIND.js +6 -0
- package/dist/lib/chunks/chunk-YOZNLFSB.js +297 -0
- package/dist/lib/chunks/chunk-YR67JG2V.js +65 -0
- package/dist/lib/chunks/chunk-YWJPJI3W.js +51 -0
- package/dist/lib/chunks/chunk-Z4LMDKBU.js +369 -0
- package/dist/lib/chunks/chunk-Z7V63UZA.js +108 -0
- package/dist/lib/chunks/chunk-ZCOI3HE2.js +45 -0
- package/dist/lib/chunks/chunk-ZLOOC46D.js +142 -0
- package/dist/lib/chunks/chunk-ZSEY7AHQ.js +123 -0
- package/dist/lib/chunks/chunk-ZVAKKRRD.js +11 -0
- package/dist/lib/chunks/chunk-ZXQPD4OC.js +202 -0
- package/dist/lib/chunks/chunk-ZYSPTOKK.js +302 -0
- package/dist/lib/cli/bundle-commands.js +371 -0
- package/dist/lib/cli/io.js +12 -0
- package/dist/lib/cli/run-commands.js +614 -0
- package/dist/lib/codex-workflow/aggregate.js +56 -0
- package/dist/lib/codex-workflow/author-search.js +48 -0
- package/dist/lib/codex-workflow/author-tools.js +63 -0
- package/dist/lib/codex-workflow/author.js +99 -0
- package/dist/lib/codex-workflow/batch-input.js +7 -0
- package/dist/lib/codex-workflow/batch-layout.js +8 -0
- package/dist/lib/codex-workflow/capture.js +62 -0
- package/dist/lib/codex-workflow/checkpoint.js +39 -0
- package/dist/lib/codex-workflow/checks.js +44 -0
- package/dist/lib/codex-workflow/codex-home.js +17 -0
- package/dist/lib/codex-workflow/copy-editor.js +66 -0
- package/dist/lib/codex-workflow/copy-recovery.js +32 -0
- package/dist/lib/codex-workflow/copy.js +66 -0
- package/dist/lib/codex-workflow/finish.js +84 -0
- package/dist/lib/codex-workflow/host-models.js +15 -0
- package/dist/lib/codex-workflow/loop.js +140 -0
- package/dist/lib/codex-workflow/pending.js +8 -0
- package/dist/lib/codex-workflow/prompts.js +8 -0
- package/dist/lib/codex-workflow/quality.js +31 -0
- package/dist/lib/codex-workflow/run-inputs.js +38 -0
- package/dist/lib/codex-workflow/run-source.js +55 -0
- package/dist/lib/codex-workflow/schemas.js +58 -0
- package/dist/lib/codex-workflow/session.js +40 -0
- package/dist/lib/codex-workflow/stage.js +98 -0
- package/dist/lib/codex-workflow/workdir.js +42 -0
- package/dist/lib/configs/literally-2026-q3.js +6 -0
- package/dist/lib/container/protocol.js +20 -0
- package/dist/lib/coverage-schema.js +6 -0
- package/dist/lib/engine/audit-file.js +46 -0
- package/dist/lib/engine/author.js +97 -0
- package/dist/lib/engine/budget.js +16 -0
- package/dist/lib/engine/env-file.js +8 -0
- package/dist/lib/engine/local-run.js +149 -0
- package/dist/lib/engine/package-root.js +8 -0
- package/dist/lib/engine/preflight.js +43 -0
- package/dist/lib/engine/rejudge.js +151 -0
- package/dist/lib/engine/resources.js +7 -0
- package/dist/lib/engine/run-configuration.js +15 -0
- package/dist/lib/engine/templates.js +33 -0
- package/dist/lib/grounding/controller.js +31 -0
- package/dist/lib/grounding/extract.js +38 -0
- package/dist/lib/grounding/fetch.js +23 -0
- package/dist/lib/grounding/file-store.js +17 -0
- package/dist/lib/grounding/grounding-runtime.js +62 -0
- package/dist/lib/grounding/model-usage.js +9 -0
- package/dist/lib/grounding/model.js +30 -0
- package/dist/lib/grounding/profile.js +15 -0
- package/dist/lib/grounding/recorded-tools.js +35 -0
- package/dist/lib/grounding/schema.js +42 -0
- package/dist/lib/grounding/session.js +30 -0
- package/dist/lib/grounding/tools.js +25 -0
- package/dist/lib/grounding/validation.js +28 -0
- package/dist/lib/grounding.js +13 -0
- package/dist/lib/harness/checkpoint.js +17 -0
- package/dist/lib/harness/contracts.js +30 -0
- package/dist/lib/harness/criteria.js +14 -0
- package/dist/lib/harness/policy.js +25 -0
- package/dist/lib/harness/report/artifacts.js +36 -0
- package/dist/lib/harness/report/capture-coverage.js +11 -0
- package/dist/lib/harness/store.js +46 -0
- package/dist/lib/lib/analysis-checkpoint.js +10 -0
- package/dist/lib/lib/canonical-json.js +8 -0
- package/dist/lib/lib/checkpoint.js +34 -0
- package/dist/lib/lib/env.js +14 -0
- package/dist/lib/lib/log.js +7 -0
- package/dist/lib/lib/paths.js +8 -0
- package/dist/lib/lib/progress-comparison.js +16 -0
- package/dist/lib/lib/report-presentation.js +13 -0
- package/dist/lib/lib/run-id.js +8 -0
- package/dist/lib/lib/type-guards.js +8 -0
- package/dist/lib/models/accounting.js +22 -0
- package/dist/lib/models/batching.js +18 -0
- package/dist/lib/models/budget-protection.js +6 -0
- package/dist/lib/models/context.js +0 -0
- package/dist/lib/models/coverage-rounds.js +6 -0
- package/dist/lib/models/errors.js +8 -0
- package/dist/lib/models/failure-diagnostics.js +6 -0
- package/dist/lib/models/profiles.js +30 -0
- package/dist/lib/models/served-model.js +6 -0
- package/dist/lib/models/structured-images.js +10 -0
- package/dist/lib/models/structured.js +25 -0
- package/dist/lib/models/wire-schema.js +6 -0
- package/dist/lib/pipeline.js +57 -0
- package/dist/lib/probes/agent-cli-parsers.js +23 -0
- package/dist/lib/probes/agent-clis.js +64 -0
- package/dist/lib/probes/chat-retrieval.js +17 -0
- package/dist/lib/probes/child-process.js +13 -0
- package/dist/lib/probes/dataforseo-locale.js +10 -0
- package/dist/lib/probes/dataforseo.js +10 -0
- package/dist/lib/probes/failure.js +26 -0
- package/dist/lib/probes/grounding-urls.js +19 -0
- package/dist/lib/probes/limits.js +12 -0
- package/dist/lib/probes/outcomes.js +13 -0
- package/dist/lib/probes/probe-trace.js +12 -0
- package/dist/lib/probes/probes.js +40 -0
- package/dist/lib/probes/web-tool-guard.js +18 -0
- package/dist/lib/report/contracts.js +34 -0
- package/dist/lib/report/core/answer-text.js +18 -0
- package/dist/lib/report/core/copy-schema.js +10 -0
- package/dist/lib/report/core/domain-match.js +11 -0
- package/dist/lib/report/core/grounding.js +12 -0
- package/dist/lib/report/core/normalize-domain.js +6 -0
- package/dist/lib/report/core/progress-comparison.js +15 -0
- package/dist/lib/report/core/progress-question-sets.js +16 -0
- package/dist/lib/report/core/progress-schema.js +12 -0
- package/dist/lib/report/core/progress-slot-key.js +6 -0
- package/dist/lib/report/core/qualified-competitors.js +6 -0
- package/dist/lib/report/core/report-presentation.js +12 -0
- package/dist/lib/report/core/retrieval.js +10 -0
- package/dist/lib/report/core/schema.js +70 -0
- package/dist/lib/report/core/source-classifier.js +21 -0
- package/dist/lib/report/core/surfaces.js +18 -0
- package/dist/lib/retrieval.js +11 -0
- package/dist/lib/runner.js +71 -0
- package/dist/lib/schema.js +110 -0
- package/dist/lib/section-result.js +34 -0
- package/dist/lib/stores/artifacts.js +35 -0
- package/dist/lib/stores/content-hash.js +10 -0
- package/dist/lib/stores/file-publication.js +20 -0
- package/dist/lib/stores/files.js +76 -0
- package/dist/lib/stores/fs-errors.js +6 -0
- package/dist/lib/stores/local-versions.js +40 -0
- package/dist/lib/stores/memory.js +312 -0
- package/dist/lib/stores/ports.js +6 -0
- package/dist/lib/stores/publication-history.js +10 -0
- package/dist/lib/stores/publication.js +50 -0
- package/dist/lib/stores/run-lifecycle.js +12 -0
- package/dist/lib/stores/versions.js +6 -0
- package/dist/lib/surfaces.js +19 -0
- package/dist/lib/viewer/page.js +6 -0
- package/dist/lib/viewer/server.js +71 -0
- package/dist/lib/workflow/callbacks.js +15 -0
- package/dist/lib/workflow/lineage.js +8 -0
- package/dist/lib/workflow/schema.js +52 -0
- package/dist/types/access/schema.d.ts +75 -0
- package/dist/types/agents/author-schema.d.ts +76 -0
- package/dist/types/agents/author-validation.d.ts +73 -0
- package/dist/types/agents/copy-schema.d.ts +345 -0
- package/dist/types/agents/copy-validation.d.ts +158 -0
- package/dist/types/agents/copywriter-input.d.ts +46 -0
- package/dist/types/agents/credentials.d.ts +10 -0
- package/dist/types/agents/facts.d.ts +69 -0
- package/dist/types/agents/narrative-facts.d.ts +8 -0
- package/dist/types/agents/verifier.d.ts +167 -0
- package/dist/types/analysis/answer-text.d.ts +1 -0
- package/dist/types/analysis/competitor-classifier.d.ts +1 -0
- package/dist/types/analysis/domain-classifier.d.ts +105 -0
- package/dist/types/analysis/domain-labels.d.ts +30 -0
- package/dist/types/analysis/domain-match.d.ts +1 -0
- package/dist/types/analysis/name-forms.d.ts +25 -0
- package/dist/types/analysis/outreach.d.ts +6 -0
- package/dist/types/analysis/progress-schema.d.ts +1 -0
- package/dist/types/analysis/progress.d.ts +15 -0
- package/dist/types/analysis/qualified-competitors.d.ts +1 -0
- package/dist/types/analysis/retrieval.d.ts +22 -0
- package/dist/types/analysis/scoring.d.ts +55 -0
- package/dist/types/analysis/search-analyzer.d.ts +23 -0
- package/dist/types/analysis/sentiment.d.ts +99 -0
- package/dist/types/analysis/source-classifier.d.ts +1 -0
- package/dist/types/analysis/source-mix.d.ts +6 -0
- package/dist/types/analysis/verbatim.d.ts +1 -0
- package/dist/types/api/errors.d.ts +30 -0
- package/dist/types/author/examples.d.ts +31 -0
- package/dist/types/bundle/checks.d.ts +45 -0
- package/dist/types/bundle/contracts.d.ts +354 -0
- package/dist/types/bundle/export.d.ts +46 -0
- package/dist/types/bundle/journal.d.ts +39 -0
- package/dist/types/bundle/json.d.ts +8 -0
- package/dist/types/bundle/lineage.d.ts +13 -0
- package/dist/types/bundle/paths.d.ts +2 -0
- package/dist/types/bundle/project-journal.d.ts +31 -0
- package/dist/types/bundle/project.d.ts +30 -0
- package/dist/types/bundle/read.d.ts +9 -0
- package/dist/types/bundle/recorder.d.ts +89 -0
- package/dist/types/bundle/redact.d.ts +17 -0
- package/dist/types/bundle/trace-coverage.d.ts +36 -0
- package/dist/types/bundle/verify-integrity.d.ts +11 -0
- package/dist/types/bundle/verify-measurement.d.ts +26 -0
- package/dist/types/bundle/verify-report.d.ts +16 -0
- package/dist/types/bundle/verify.d.ts +31 -0
- package/dist/types/bundle/writer-lock.d.ts +23 -0
- package/dist/types/bundle/zip.d.ts +24 -0
- package/dist/types/capture-manifest.d.ts +122 -0
- package/dist/types/checks/crawler-access.d.ts +25 -0
- package/dist/types/checks/renderability.d.ts +4 -0
- package/dist/types/checks/run-checks.d.ts +8 -0
- package/dist/types/cli/bundle-commands.d.ts +5 -0
- package/dist/types/cli/io.d.ts +10 -0
- package/dist/types/cli/literally-aeo.d.ts +1 -0
- package/dist/types/cli/run-commands.d.ts +14 -0
- package/dist/types/codex-workflow/aggregate.d.ts +76 -0
- package/dist/types/codex-workflow/author-search.d.ts +26 -0
- package/dist/types/codex-workflow/author-tools-server.d.ts +1 -0
- package/dist/types/codex-workflow/author-tools.d.ts +145 -0
- package/dist/types/codex-workflow/author.d.ts +101 -0
- package/dist/types/codex-workflow/batch-input.d.ts +12 -0
- package/dist/types/codex-workflow/batch-layout.d.ts +16 -0
- package/dist/types/codex-workflow/capture.d.ts +37 -0
- package/dist/types/codex-workflow/checkpoint.d.ts +18 -0
- package/dist/types/codex-workflow/checks.d.ts +53 -0
- package/dist/types/codex-workflow/codex-home.d.ts +47 -0
- package/dist/types/codex-workflow/copy-editor.d.ts +164 -0
- package/dist/types/codex-workflow/copy-recovery.d.ts +30 -0
- package/dist/types/codex-workflow/copy.d.ts +62 -0
- package/dist/types/codex-workflow/finish.d.ts +53 -0
- package/dist/types/codex-workflow/host-models.d.ts +5 -0
- package/dist/types/codex-workflow/loop.d.ts +177 -0
- package/dist/types/codex-workflow/pending.d.ts +6 -0
- package/dist/types/codex-workflow/prompts.d.ts +14 -0
- package/dist/types/codex-workflow/quality.d.ts +25 -0
- package/dist/types/codex-workflow/run-inputs.d.ts +951 -0
- package/dist/types/codex-workflow/run-source.d.ts +34 -0
- package/dist/types/codex-workflow/schemas.d.ts +493 -0
- package/dist/types/codex-workflow/session.d.ts +13 -0
- package/dist/types/codex-workflow/stage.d.ts +136 -0
- package/dist/types/codex-workflow/workdir.d.ts +40 -0
- package/dist/types/configs/literally-2026-q3.d.ts +2 -0
- package/dist/types/container/protocol.d.ts +72 -0
- package/dist/types/coverage-schema.d.ts +6 -0
- package/dist/types/engine/audit-file.d.ts +126 -0
- package/dist/types/engine/author.d.ts +52 -0
- package/dist/types/engine/budget.d.ts +68 -0
- package/dist/types/engine/env-file.d.ts +13 -0
- package/dist/types/engine/local-run.d.ts +62 -0
- package/dist/types/engine/package-root.d.ts +8 -0
- package/dist/types/engine/preflight.d.ts +27 -0
- package/dist/types/engine/rejudge.d.ts +14 -0
- package/dist/types/engine/resources.d.ts +8 -0
- package/dist/types/engine/run-configuration.d.ts +36 -0
- package/dist/types/engine/templates.d.ts +38 -0
- package/dist/types/grounding/controller.d.ts +110 -0
- package/dist/types/grounding/extract.d.ts +103 -0
- package/dist/types/grounding/fetch.d.ts +53 -0
- package/dist/types/grounding/file-store.d.ts +2 -0
- package/dist/types/grounding/grounding-runtime.d.ts +43 -0
- package/dist/types/grounding/model-usage.d.ts +13 -0
- package/dist/types/grounding/model.d.ts +51 -0
- package/dist/types/grounding/profile.d.ts +15 -0
- package/dist/types/grounding/recorded-tools.d.ts +12 -0
- package/dist/types/grounding/schema.d.ts +521 -0
- package/dist/types/grounding/session.d.ts +143 -0
- package/dist/types/grounding/tools.d.ts +135 -0
- package/dist/types/grounding/validation.d.ts +35 -0
- package/dist/types/grounding.d.ts +1 -0
- package/dist/types/harness/checkpoint.d.ts +29 -0
- package/dist/types/harness/contracts.d.ts +141 -0
- package/dist/types/harness/criteria.d.ts +34 -0
- package/dist/types/harness/policy.d.ts +9 -0
- package/dist/types/harness/report/artifacts.d.ts +287 -0
- package/dist/types/harness/report/capture-coverage.d.ts +11 -0
- package/dist/types/harness/store.d.ts +116 -0
- package/dist/types/lib/analysis-checkpoint.d.ts +20 -0
- package/dist/types/lib/canonical-json.d.ts +11 -0
- package/dist/types/lib/checkpoint.d.ts +33 -0
- package/dist/types/lib/env.d.ts +31 -0
- package/dist/types/lib/log.d.ts +11 -0
- package/dist/types/lib/paths.d.ts +2 -0
- package/dist/types/lib/progress-comparison.d.ts +1 -0
- package/dist/types/lib/report-presentation.d.ts +1 -0
- package/dist/types/lib/run-id.d.ts +2 -0
- package/dist/types/lib/type-guards.d.ts +9 -0
- package/dist/types/models/accounting.d.ts +147 -0
- package/dist/types/models/batching.d.ts +17 -0
- package/dist/types/models/budget-protection.d.ts +10 -0
- package/dist/types/models/context.d.ts +8 -0
- package/dist/types/models/coverage-rounds.d.ts +47 -0
- package/dist/types/models/errors.d.ts +12 -0
- package/dist/types/models/failure-diagnostics.d.ts +8 -0
- package/dist/types/models/profiles.d.ts +551 -0
- package/dist/types/models/served-model.d.ts +11 -0
- package/dist/types/models/structured-images.d.ts +9 -0
- package/dist/types/models/structured.d.ts +111 -0
- package/dist/types/models/wire-schema.d.ts +27 -0
- package/dist/types/pipeline.d.ts +117 -0
- package/dist/types/probes/agent-cli-parsers.d.ts +46 -0
- package/dist/types/probes/agent-clis.d.ts +132 -0
- package/dist/types/probes/chat-retrieval.d.ts +14 -0
- package/dist/types/probes/child-process.d.ts +28 -0
- package/dist/types/probes/dataforseo-locale.d.ts +8 -0
- package/dist/types/probes/dataforseo.d.ts +15 -0
- package/dist/types/probes/failure.d.ts +30 -0
- package/dist/types/probes/grounding-urls.d.ts +18 -0
- package/dist/types/probes/limits.d.ts +30 -0
- package/dist/types/probes/outcomes.d.ts +20 -0
- package/dist/types/probes/probe-trace.d.ts +51 -0
- package/dist/types/probes/probes.d.ts +47 -0
- package/dist/types/probes/web-tool-guard.d.ts +59 -0
- package/dist/types/report/contracts.d.ts +973 -0
- package/dist/types/report/core/answer-text.d.ts +24 -0
- package/dist/types/report/core/copy-schema.d.ts +47 -0
- package/dist/types/report/core/domain-match.d.ts +9 -0
- package/dist/types/report/core/grounding.d.ts +4 -0
- package/dist/types/report/core/normalize-domain.d.ts +2 -0
- package/dist/types/report/core/progress-comparison.d.ts +52 -0
- package/dist/types/report/core/progress-question-sets.d.ts +16 -0
- package/dist/types/report/core/progress-schema.d.ts +101 -0
- package/dist/types/report/core/progress-slot-key.d.ts +9 -0
- package/dist/types/report/core/qualified-competitors.d.ts +6 -0
- package/dist/types/report/core/report-presentation.d.ts +10 -0
- package/dist/types/report/core/retrieval.d.ts +6 -0
- package/dist/types/report/core/schema.d.ts +745 -0
- package/dist/types/report/core/source-classifier.d.ts +21 -0
- package/dist/types/report/core/surfaces.d.ts +11 -0
- package/dist/types/retrieval.d.ts +1 -0
- package/dist/types/runner.d.ts +96 -0
- package/dist/types/schema.d.ts +858 -0
- package/dist/types/section-result.d.ts +4 -0
- package/dist/types/stores/artifacts.d.ts +2 -0
- package/dist/types/stores/content-hash.d.ts +2 -0
- package/dist/types/stores/file-publication.d.ts +31 -0
- package/dist/types/stores/files.d.ts +87 -0
- package/dist/types/stores/fs-errors.d.ts +5 -0
- package/dist/types/stores/local-versions.d.ts +54 -0
- package/dist/types/stores/memory.d.ts +76 -0
- package/dist/types/stores/ports.d.ts +150 -0
- package/dist/types/stores/publication-history.d.ts +27 -0
- package/dist/types/stores/publication.d.ts +53 -0
- package/dist/types/stores/run-lifecycle.d.ts +7 -0
- package/dist/types/stores/versions.d.ts +71 -0
- package/dist/types/surfaces.d.ts +1 -0
- package/dist/types/viewer/page.d.ts +2 -0
- package/dist/types/viewer/server.d.ts +14 -0
- package/dist/types/workflow/callbacks.d.ts +22 -0
- package/dist/types/workflow/lineage.d.ts +20 -0
- package/dist/types/workflow/schema.d.ts +1572 -0
- package/package.json +95 -3
- package/resources/author/COPY_RULES.md +95 -0
- package/resources/author/RULES.md +104 -0
- package/resources/author/banlist.json +38 -0
- package/resources/editorial/COMPANY.md +11 -0
- package/resources/editorial/positioning.md +8 -0
- package/resources/editorial/services.md +4 -0
- package/src/access/schema.ts +96 -0
- package/src/agents/author-schema.ts +49 -0
- package/src/agents/author-validation.ts +409 -0
- package/src/agents/copy-schema.ts +214 -0
- package/src/agents/copy-validation.ts +1170 -0
- package/src/agents/copywriter-input.ts +90 -0
- package/src/agents/credentials.ts +60 -0
- package/src/agents/facts.ts +343 -0
- package/src/agents/narrative-facts.ts +174 -0
- package/src/agents/verifier.ts +603 -0
- package/src/analysis/answer-text.ts +1 -0
- package/src/analysis/competitor-classifier.ts +15 -0
- package/src/analysis/domain-classifier.ts +804 -0
- package/src/analysis/domain-labels.ts +67 -0
- package/src/analysis/domain-match.ts +1 -0
- package/src/analysis/name-forms.ts +59 -0
- package/src/analysis/outreach.ts +107 -0
- package/src/analysis/progress-schema.ts +1 -0
- package/src/analysis/progress.ts +346 -0
- package/src/analysis/qualified-competitors.ts +1 -0
- package/src/analysis/retrieval.ts +105 -0
- package/src/analysis/scoring.ts +167 -0
- package/src/analysis/search-analyzer.ts +83 -0
- package/src/analysis/sentiment.ts +558 -0
- package/src/analysis/source-classifier.ts +1 -0
- package/src/analysis/source-mix.ts +56 -0
- package/src/analysis/verbatim.ts +107 -0
- package/src/api/errors.ts +50 -0
- package/src/author/COPY_RULES.md +95 -0
- package/src/author/RULES.md +104 -0
- package/src/author/banlist.json +38 -0
- package/src/author/examples.ts +79 -0
- package/src/bundle/checks.ts +146 -0
- package/src/bundle/contracts.ts +289 -0
- package/src/bundle/export.ts +448 -0
- package/src/bundle/journal.ts +270 -0
- package/src/bundle/json.ts +157 -0
- package/src/bundle/lineage.ts +45 -0
- package/src/bundle/paths.ts +36 -0
- package/src/bundle/project-journal.ts +179 -0
- package/src/bundle/project.ts +434 -0
- package/src/bundle/read.ts +154 -0
- package/src/bundle/recorder.ts +497 -0
- package/src/bundle/redact.ts +134 -0
- package/src/bundle/trace-coverage.ts +168 -0
- package/src/bundle/verify-integrity.ts +322 -0
- package/src/bundle/verify-measurement.ts +384 -0
- package/src/bundle/verify-report.ts +260 -0
- package/src/bundle/verify.ts +400 -0
- package/src/bundle/writer-lock.ts +133 -0
- package/src/bundle/zip.ts +281 -0
- package/src/capture-manifest.ts +348 -0
- package/src/checks/crawler-access.ts +373 -0
- package/src/checks/renderability.ts +164 -0
- package/src/checks/run-checks.ts +74 -0
- package/src/cli/bundle-commands.ts +249 -0
- package/src/cli/io.ts +63 -0
- package/src/cli/literally-aeo.ts +121 -0
- package/src/cli/run-commands.ts +535 -0
- package/src/codex-workflow/aggregate.ts +336 -0
- package/src/codex-workflow/author-search.ts +76 -0
- package/src/codex-workflow/author-tools-server.ts +208 -0
- package/src/codex-workflow/author-tools.ts +1202 -0
- package/src/codex-workflow/author.ts +512 -0
- package/src/codex-workflow/batch-input.ts +145 -0
- package/src/codex-workflow/batch-layout.ts +47 -0
- package/src/codex-workflow/capture.ts +255 -0
- package/src/codex-workflow/checkpoint.ts +127 -0
- package/src/codex-workflow/checks.ts +510 -0
- package/src/codex-workflow/codex-home.ts +187 -0
- package/src/codex-workflow/copy-editor.ts +322 -0
- package/src/codex-workflow/copy-recovery.ts +134 -0
- package/src/codex-workflow/copy.ts +195 -0
- package/src/codex-workflow/finish.ts +433 -0
- package/src/codex-workflow/host-models.ts +35 -0
- package/src/codex-workflow/loop.ts +1159 -0
- package/src/codex-workflow/pending.ts +24 -0
- package/src/codex-workflow/prompts.ts +153 -0
- package/src/codex-workflow/quality.ts +97 -0
- package/src/codex-workflow/run-inputs.ts +117 -0
- package/src/codex-workflow/run-source.ts +149 -0
- package/src/codex-workflow/schemas.ts +222 -0
- package/src/codex-workflow/session.ts +70 -0
- package/src/codex-workflow/stage.ts +2344 -0
- package/src/codex-workflow/workdir.ts +242 -0
- package/src/configs/literally-2026-q3.ts +199 -0
- package/src/container/protocol.ts +152 -0
- package/src/coverage-schema.ts +7 -0
- package/src/engine/audit-file.ts +254 -0
- package/src/engine/author.ts +279 -0
- package/src/engine/budget.ts +164 -0
- package/src/engine/editorial/COMPANY.md +11 -0
- package/src/engine/editorial/positioning.md +8 -0
- package/src/engine/editorial/services.md +4 -0
- package/src/engine/env-file.ts +87 -0
- package/src/engine/local-run.ts +323 -0
- package/src/engine/package-root.ts +47 -0
- package/src/engine/preflight.ts +156 -0
- package/src/engine/rejudge.ts +118 -0
- package/src/engine/resources.ts +45 -0
- package/src/engine/run-configuration.ts +70 -0
- package/src/engine/templates.ts +66 -0
- package/src/grounding/controller.ts +1211 -0
- package/src/grounding/extract.ts +830 -0
- package/src/grounding/fetch.ts +448 -0
- package/src/grounding/file-store.ts +131 -0
- package/src/grounding/grounding-runtime.ts +318 -0
- package/src/grounding/model-usage.ts +48 -0
- package/src/grounding/model.ts +508 -0
- package/src/grounding/profile.ts +63 -0
- package/src/grounding/recorded-tools.ts +40 -0
- package/src/grounding/schema.ts +262 -0
- package/src/grounding/session.ts +681 -0
- package/src/grounding/tools.ts +500 -0
- package/src/grounding/validation.ts +435 -0
- package/src/grounding.ts +1 -0
- package/src/harness/checkpoint.ts +53 -0
- package/src/harness/contracts.ts +169 -0
- package/src/harness/criteria.ts +166 -0
- package/src/harness/policy.ts +28 -0
- package/src/harness/report/artifacts.ts +130 -0
- package/src/harness/report/capture-coverage.ts +40 -0
- package/src/harness/store.ts +167 -0
- package/src/lib/analysis-checkpoint.ts +94 -0
- package/src/lib/canonical-json.ts +90 -0
- package/src/lib/checkpoint.ts +140 -0
- package/src/lib/env.ts +80 -0
- package/src/lib/log.ts +192 -0
- package/src/lib/paths.ts +14 -0
- package/src/lib/progress-comparison.ts +1 -0
- package/src/lib/report-presentation.ts +1 -0
- package/src/lib/run-id.ts +39 -0
- package/src/lib/type-guards.ts +14 -0
- package/src/models/accounting.ts +656 -0
- package/src/models/batching.ts +68 -0
- package/src/models/budget-protection.ts +68 -0
- package/src/models/context.ts +9 -0
- package/src/models/coverage-rounds.ts +125 -0
- package/src/models/errors.ts +39 -0
- package/src/models/failure-diagnostics.ts +157 -0
- package/src/models/profiles.ts +511 -0
- package/src/models/served-model.ts +20 -0
- package/src/models/structured-images.ts +95 -0
- package/src/models/structured.ts +634 -0
- package/src/models/wire-schema.ts +453 -0
- package/src/pipeline.ts +496 -0
- package/src/probes/agent-cli-parsers.ts +835 -0
- package/src/probes/agent-clis.ts +1482 -0
- package/src/probes/chat-retrieval.ts +238 -0
- package/src/probes/child-process.ts +280 -0
- package/src/probes/dataforseo-locale.ts +71 -0
- package/src/probes/dataforseo.ts +286 -0
- package/src/probes/failure.ts +182 -0
- package/src/probes/grounding-urls.ts +182 -0
- package/src/probes/limits.ts +181 -0
- package/src/probes/outcomes.ts +40 -0
- package/src/probes/probe-trace.ts +109 -0
- package/src/probes/probes.ts +789 -0
- package/src/probes/web-tool-guard.ts +195 -0
- package/src/report/contracts.ts +161 -0
- package/src/report/core/answer-text.ts +144 -0
- package/src/report/core/copy-schema.ts +75 -0
- package/src/report/core/domain-match.ts +52 -0
- package/src/report/core/grounding.ts +32 -0
- package/src/report/core/normalize-domain.ts +16 -0
- package/src/report/core/progress-comparison.ts +362 -0
- package/src/report/core/progress-question-sets.ts +93 -0
- package/src/report/core/progress-schema.ts +150 -0
- package/src/report/core/progress-slot-key.ts +20 -0
- package/src/report/core/qualified-competitors.ts +15 -0
- package/src/report/core/report-presentation.ts +112 -0
- package/src/report/core/retrieval.ts +49 -0
- package/src/report/core/schema.ts +489 -0
- package/src/report/core/source-classifier.ts +239 -0
- package/src/report/core/surfaces.ts +64 -0
- package/src/retrieval.ts +1 -0
- package/src/runner.ts +461 -0
- package/src/schema.ts +181 -0
- package/src/section-result.ts +315 -0
- package/src/stores/artifacts.ts +74 -0
- package/src/stores/content-hash.ts +8 -0
- package/src/stores/file-publication.ts +194 -0
- package/src/stores/files.ts +1069 -0
- package/src/stores/fs-errors.ts +12 -0
- package/src/stores/local-versions.ts +412 -0
- package/src/stores/memory.ts +432 -0
- package/src/stores/ports.ts +231 -0
- package/src/stores/publication-history.ts +48 -0
- package/src/stores/publication.ts +221 -0
- package/src/stores/run-lifecycle.ts +72 -0
- package/src/stores/versions.ts +113 -0
- package/src/surfaces.ts +1 -0
- package/src/viewer/page.ts +208 -0
- package/src/viewer/server.ts +215 -0
- package/src/workflow/callbacks.ts +201 -0
- package/src/workflow/lineage.ts +36 -0
- package/src/workflow/schema.ts +256 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { sourceCategories, type SourceCategory } from '../schema';
|
|
3
|
+
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// The committed domain-labels file (spec §7.1 amendment, 2026-09-04): the
|
|
6
|
+
// learned source labels behind a report's citation mix, written next to its
|
|
7
|
+
// snapshot. Runner-free on purpose — the report page reads this file at
|
|
8
|
+
// build time so its opened-pages list labels hosts exactly like the source
|
|
9
|
+
// mix, and must not drag the AI SDK in to do so. The pass that produces the
|
|
10
|
+
// labels lives in domain-classifier.ts.
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
export const domainLabelsFile = 'domain-labels.json';
|
|
14
|
+
|
|
15
|
+
// Bump whenever the model prompt, categories, or model change: every cached
|
|
16
|
+
// model label is then re-derived on the next run (analyzer labels are
|
|
17
|
+
// recomputed every run anyway). Recorded in snapshot meta as
|
|
18
|
+
// domainClassifierVersion.
|
|
19
|
+
// 1 — first version.
|
|
20
|
+
// 2 — only qualified entities become competitors; labels respect section scope.
|
|
21
|
+
// v3 (2026-09-13): every host under a configured competitor's registrable
|
|
22
|
+
// domain is a competitor source by config.
|
|
23
|
+
// v4 (2026-09-13): re-derive after a run committed labels whose batches
|
|
24
|
+
// were abandoned for budget.
|
|
25
|
+
export const domainClassifierVersion = 4;
|
|
26
|
+
|
|
27
|
+
export const domainLabelsFileSchema = z.object({
|
|
28
|
+
version: z.number().int(),
|
|
29
|
+
model: z.string(),
|
|
30
|
+
// Hash of the market context the model labels were judged in (brand,
|
|
31
|
+
// brief, prompt texts — hardening spec §2.7). Optional: files written
|
|
32
|
+
// before it existed carry none. A mismatch on reuse is logged, not fatal:
|
|
33
|
+
// the labels are still the best available and a bump of
|
|
34
|
+
// domainClassifierVersion is the deliberate way to re-judge them.
|
|
35
|
+
contextHash: z.string().optional(),
|
|
36
|
+
modelProfileDigest: z.string().optional(),
|
|
37
|
+
// host (www. stripped) → label + where it came from. Sorted on write so
|
|
38
|
+
// the committed diff reads as "which hosts changed".
|
|
39
|
+
entries: z.record(
|
|
40
|
+
z.string(),
|
|
41
|
+
z.object({
|
|
42
|
+
category: z.enum(sourceCategories),
|
|
43
|
+
// config: the domain of a configured competitor, settled by the
|
|
44
|
+
// report's own competitor list; analyzer: a qualified competitor's
|
|
45
|
+
// domain; model: judged by the domain classifier.
|
|
46
|
+
source: z.enum(['analyzer', 'model', 'config']),
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export type DomainLabelsFile = z.infer<typeof domainLabelsFileSchema>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* learnedLabels returns the flat host → category map the source classifier
|
|
55
|
+
* consumes as `learned`.
|
|
56
|
+
*/
|
|
57
|
+
export const learnedLabels = (
|
|
58
|
+
file: DomainLabelsFile,
|
|
59
|
+
): Record<string, SourceCategory> => {
|
|
60
|
+
const labels: Record<string, SourceCategory> = {};
|
|
61
|
+
|
|
62
|
+
for (const [host, entry] of Object.entries(file.entries)) {
|
|
63
|
+
labels[host] = entry.category;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return labels;
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../report/core/domain-match';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// How two product names relate. The competitor classifier merges candidates
|
|
3
|
+
// with these, the analyzer reconciles the prospect's own names with them,
|
|
4
|
+
// and the Codex workflow canonicalises qualified names across batches with
|
|
5
|
+
// them: one definition, so the three never disagree on what "the same
|
|
6
|
+
// product" means.
|
|
7
|
+
// ============================================================================
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* normalizedBrandName returns one key per name: trimmed, lower-cased, inner
|
|
11
|
+
* whitespace collapsed.
|
|
12
|
+
*/
|
|
13
|
+
export const normalizedBrandName = (name: string): string => {
|
|
14
|
+
return name.trim().toLowerCase().replace(/\s+/g, ' ');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* isBrandOfProduct tells whether a name is the brand of a product. "Netlify" is
|
|
19
|
+
* the brand of "Netlify Functions": the product name starts with the brand name
|
|
20
|
+
* as whole words.
|
|
21
|
+
*/
|
|
22
|
+
export const isBrandOfProduct = (brand: string, product: string): boolean => {
|
|
23
|
+
const left = brand.trim().toLowerCase();
|
|
24
|
+
const right = product.trim().toLowerCase();
|
|
25
|
+
|
|
26
|
+
return right.length > left.length && right.startsWith(`${left} `);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* isShortFormOf tells whether a name is the short form of another. "Cloud Run"
|
|
31
|
+
* is the short form of "Google Cloud Run": the full name ends with the short
|
|
32
|
+
* one as whole words. The pair was qualified twice in one row (run C,
|
|
33
|
+
* 2026-09-13).
|
|
34
|
+
*/
|
|
35
|
+
export const isShortFormOf = (short: string, full: string): boolean => {
|
|
36
|
+
const left = short.trim().toLowerCase();
|
|
37
|
+
const right = full.trim().toLowerCase();
|
|
38
|
+
|
|
39
|
+
return right.length > left.length && right.endsWith(` ${left}`);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* isAcronymLabelOf tells whether a label abbreviates a full name. "GCF 2nd Gen"
|
|
44
|
+
* names "Google Cloud Functions": the label's first word is the initials of the
|
|
45
|
+
* full name, and the rest is a version or edition. The same product twice was
|
|
46
|
+
* refused as an inflated competitor count (run A, 2026-09-13).
|
|
47
|
+
*/
|
|
48
|
+
export const isAcronymLabelOf = (label: string, fullName: string): boolean => {
|
|
49
|
+
const words = fullName.trim().split(/\s+/);
|
|
50
|
+
|
|
51
|
+
if (words.length < 2) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const initials = words.map((word) => word.charAt(0).toLowerCase()).join('');
|
|
56
|
+
const [first, ...rest] = label.trim().toLowerCase().split(/\s+/);
|
|
57
|
+
|
|
58
|
+
return first === initials && rest.length > 0;
|
|
59
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { AeoOutreachTargets, AeoVisibility } from '../schema';
|
|
2
|
+
import { isGroundingRedirectUrl } from '../probes/grounding-urls';
|
|
3
|
+
import {
|
|
4
|
+
classifySource,
|
|
5
|
+
sectionSourceClassifierConfig,
|
|
6
|
+
type SourceClassifierConfig,
|
|
7
|
+
} from './source-classifier';
|
|
8
|
+
import { qualifiedCompetitorsForRow } from './qualified-competitors';
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Outreach target derivation (spec §7.3). Pure derivation over the matrix:
|
|
12
|
+
// domains cited in answers where the client is absent and a competitor is
|
|
13
|
+
// mentioned, ranked by frequency, excluding owned/competitor domains — the
|
|
14
|
+
// citation-gap → digital PR hit list. Human judgment decides what to pursue;
|
|
15
|
+
// this only surfaces the candidates.
|
|
16
|
+
// ============================================================================
|
|
17
|
+
|
|
18
|
+
const maxTargets = 20;
|
|
19
|
+
const maxSampleUrls = 5;
|
|
20
|
+
|
|
21
|
+
export const deriveOutreachTargets = (
|
|
22
|
+
sections: Array<{ key: string; visibility: AeoVisibility }>,
|
|
23
|
+
config: SourceClassifierConfig,
|
|
24
|
+
): AeoOutreachTargets => {
|
|
25
|
+
const targets = new Map<
|
|
26
|
+
string,
|
|
27
|
+
{
|
|
28
|
+
citations: number;
|
|
29
|
+
prompts: Set<string>;
|
|
30
|
+
sampleUrls: Set<string>;
|
|
31
|
+
}
|
|
32
|
+
>();
|
|
33
|
+
|
|
34
|
+
for (const section of sections) {
|
|
35
|
+
const sectionConfig = sectionSourceClassifierConfig(
|
|
36
|
+
config,
|
|
37
|
+
section.visibility,
|
|
38
|
+
sections,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
for (const row of section.visibility.matrix) {
|
|
42
|
+
if (row.prospectMentioned) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const competitorMentioned = qualifiedCompetitorsForRow(row).length > 0;
|
|
47
|
+
|
|
48
|
+
if (!competitorMentioned) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
for (const url of row.citedUrls ?? []) {
|
|
53
|
+
if (isGroundingRedirectUrl(url)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const category = classifySource(url, sectionConfig);
|
|
58
|
+
|
|
59
|
+
// Owned/competitor domains are not outreach targets; social threads
|
|
60
|
+
// and encyclopedias are separate plays — earned media only.
|
|
61
|
+
if (category !== 'earned') {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let host: string;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
host = new URL(url).hostname.toLowerCase().replace(/^www\./, '');
|
|
69
|
+
} catch {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const entry = targets.get(host) ?? {
|
|
74
|
+
citations: 0,
|
|
75
|
+
prompts: new Set<string>(),
|
|
76
|
+
sampleUrls: new Set<string>(),
|
|
77
|
+
};
|
|
78
|
+
targets.set(host, entry);
|
|
79
|
+
entry.citations += 1;
|
|
80
|
+
entry.prompts.add(`${section.key}:${row.promptIdx}`);
|
|
81
|
+
|
|
82
|
+
if (entry.sampleUrls.size < maxSampleUrls) {
|
|
83
|
+
entry.sampleUrls.add(url);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return [...targets.entries()]
|
|
90
|
+
.map(([domain, entry]) => ({
|
|
91
|
+
domain,
|
|
92
|
+
citations: entry.citations,
|
|
93
|
+
prompts: [...entry.prompts].map((key) => {
|
|
94
|
+
const idx = key.lastIndexOf(':');
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
sectionKey: key.slice(0, idx),
|
|
98
|
+
promptIdx: Number(key.slice(idx + 1)),
|
|
99
|
+
};
|
|
100
|
+
}),
|
|
101
|
+
sampleUrls: [...entry.sampleUrls],
|
|
102
|
+
}))
|
|
103
|
+
.sort(
|
|
104
|
+
(a, b) => b.citations - a.citations || a.domain.localeCompare(b.domain),
|
|
105
|
+
)
|
|
106
|
+
.slice(0, maxTargets);
|
|
107
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../report/core/progress-schema';
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import type { AeoAuditConfig, AeoSnapshot } from '../schema';
|
|
2
|
+
import {
|
|
3
|
+
capturePlan,
|
|
4
|
+
validateCaptureManifest,
|
|
5
|
+
type CaptureManifest,
|
|
6
|
+
} from '../capture-manifest';
|
|
7
|
+
import { plannedProbeUnitsForSection, type ProbeUnit } from '../lib/checkpoint';
|
|
8
|
+
import {
|
|
9
|
+
progressSlotKey,
|
|
10
|
+
type ProgressMeasurement,
|
|
11
|
+
type ProgressSlot,
|
|
12
|
+
} from '../lib/progress-comparison';
|
|
13
|
+
import { contentHash } from '../stores/content-hash';
|
|
14
|
+
import { normalizeDomain } from './scoring';
|
|
15
|
+
import { isDomainCited } from './domain-match';
|
|
16
|
+
|
|
17
|
+
export type ProgressMeasurementInput = {
|
|
18
|
+
runId: string;
|
|
19
|
+
config: AeoAuditConfig;
|
|
20
|
+
snapshot: AeoSnapshot;
|
|
21
|
+
captureManifest?: unknown;
|
|
22
|
+
publishedAt?: string | null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const date = (value: string | null | undefined): string | null => {
|
|
26
|
+
if (!value || !Number.isFinite(Date.parse(value))) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return new Date(value).toISOString();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const questionKey = (text: string): string => {
|
|
34
|
+
// Exact text, deliberately independent of changing IDs or array order.
|
|
35
|
+
return contentHash(text);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const key = (
|
|
39
|
+
unit: Pick<ProbeUnit, 'sectionKey' | 'promptText' | 'surface' | 'runIndex'>,
|
|
40
|
+
): string => {
|
|
41
|
+
return progressSlotKey({
|
|
42
|
+
...unit,
|
|
43
|
+
questionKey: questionKey(unit.promptText),
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* projectProgressMeasurement is called on the server before passing history
|
|
49
|
+
* into the report's client island. The manifest remains private; only
|
|
50
|
+
* counts/flags and opaque identities leave.
|
|
51
|
+
*/
|
|
52
|
+
export const projectProgressMeasurement = (
|
|
53
|
+
input: ProgressMeasurementInput,
|
|
54
|
+
): ProgressMeasurement => {
|
|
55
|
+
const { runId, config, snapshot } = input;
|
|
56
|
+
const warnings = new Set<ProgressMeasurement['warnings'][number]>();
|
|
57
|
+
let state: ProgressMeasurement['state'] = 'independent';
|
|
58
|
+
let manifest: CaptureManifest | undefined;
|
|
59
|
+
|
|
60
|
+
if (input.captureManifest !== undefined && input.captureManifest !== null) {
|
|
61
|
+
try {
|
|
62
|
+
manifest = validateCaptureManifest(input.captureManifest, {
|
|
63
|
+
reportKey: config.reportKey,
|
|
64
|
+
runId,
|
|
65
|
+
});
|
|
66
|
+
} catch {
|
|
67
|
+
state = 'invalid';
|
|
68
|
+
warnings.add('invalid_capture_manifest');
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
state = 'legacy';
|
|
72
|
+
warnings.add('historical_capture_metadata_unknown');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (
|
|
76
|
+
snapshot.reportKey !== config.reportKey ||
|
|
77
|
+
(snapshot.meta.runId && snapshot.meta.runId !== runId)
|
|
78
|
+
) {
|
|
79
|
+
state = 'invalid';
|
|
80
|
+
warnings.add('artifact_identity_mismatch');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (
|
|
84
|
+
snapshot.meta.derivedFromRunId ||
|
|
85
|
+
snapshot.meta.replayKind ||
|
|
86
|
+
manifest?.derivedFromRunId
|
|
87
|
+
) {
|
|
88
|
+
state = 'derived';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const configured = new Map(
|
|
92
|
+
config.sections.map((section) => [section.key, section]),
|
|
93
|
+
);
|
|
94
|
+
const surfaces = snapshot.meta.surfaces ?? [
|
|
95
|
+
...new Set(
|
|
96
|
+
snapshot.sections.flatMap((section) => section.visibility.surfaces),
|
|
97
|
+
),
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
manifest &&
|
|
102
|
+
capturePlan(config, surfaces, [
|
|
103
|
+
...new Set(manifest.plan.units.map((unit) => unit.sectionKey)),
|
|
104
|
+
]).configDigest !== manifest.plan.configDigest
|
|
105
|
+
) {
|
|
106
|
+
state = 'invalid';
|
|
107
|
+
warnings.add('plan_config_mismatch');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const units =
|
|
111
|
+
manifest?.plan.units ??
|
|
112
|
+
config.sections.flatMap((section) =>
|
|
113
|
+
plannedProbeUnitsForSection({
|
|
114
|
+
sectionKey: section.key,
|
|
115
|
+
prompts: section.prompts,
|
|
116
|
+
surfaces,
|
|
117
|
+
agentProbes: config.agentProbes,
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
const planned = new Map<string, ProbeUnit>();
|
|
121
|
+
|
|
122
|
+
for (const unit of units) {
|
|
123
|
+
const section = configured.get(unit.sectionKey);
|
|
124
|
+
|
|
125
|
+
if (!section?.prompts.some((prompt) => prompt.text === unit.promptText)) {
|
|
126
|
+
state = 'invalid';
|
|
127
|
+
warnings.add('plan_config_mismatch');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (planned.has(key(unit))) {
|
|
131
|
+
state = 'invalid';
|
|
132
|
+
warnings.add('duplicate_planned_slots');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
planned.set(key(unit), unit);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const captures = new Map(
|
|
139
|
+
manifest?.captures.map((capture) => [key(capture), capture]) ?? [],
|
|
140
|
+
);
|
|
141
|
+
const outcomes = new Map<
|
|
142
|
+
string,
|
|
143
|
+
AeoSnapshot['sections'][number]['visibility']['matrix'][number]
|
|
144
|
+
>();
|
|
145
|
+
|
|
146
|
+
for (const section of snapshot.sections) {
|
|
147
|
+
for (const row of section.visibility.matrix) {
|
|
148
|
+
const text = section.visibility.prompts[row.promptIdx]?.text;
|
|
149
|
+
|
|
150
|
+
if (text === undefined) {
|
|
151
|
+
state = 'invalid';
|
|
152
|
+
warnings.add('matrix_question_missing');
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Older rows may omit runIndex. Infer only when there is exactly one
|
|
157
|
+
// planned repetition for this exact question and surface.
|
|
158
|
+
const matching =
|
|
159
|
+
row.runIndex === undefined
|
|
160
|
+
? units.filter(
|
|
161
|
+
(unit) =>
|
|
162
|
+
unit.sectionKey === section.key &&
|
|
163
|
+
unit.promptText === text &&
|
|
164
|
+
unit.surface === row.surface,
|
|
165
|
+
)
|
|
166
|
+
: [];
|
|
167
|
+
const runIndex =
|
|
168
|
+
row.runIndex ??
|
|
169
|
+
(matching.length === 1 ? matching[0]?.runIndex : undefined);
|
|
170
|
+
|
|
171
|
+
if (runIndex === undefined) {
|
|
172
|
+
warnings.add('historical_run_index_unknown');
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const rowKey = key({
|
|
177
|
+
sectionKey: section.key,
|
|
178
|
+
promptText: text,
|
|
179
|
+
surface: row.surface,
|
|
180
|
+
runIndex,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
if (!planned.has(rowKey) || outcomes.has(rowKey)) {
|
|
184
|
+
state = 'invalid';
|
|
185
|
+
warnings.add('matrix_plan_mismatch');
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
outcomes.set(rowKey, row);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const slots: ProgressSlot[] = [...planned].map(([slotKey, unit]) => {
|
|
194
|
+
const capture = captures.get(slotKey);
|
|
195
|
+
const row = outcomes.get(slotKey);
|
|
196
|
+
const noOverview =
|
|
197
|
+
capture?.noOverview === true || (!manifest && row?.noOverview === true);
|
|
198
|
+
const captured = manifest
|
|
199
|
+
? !!capture && (capture.hasEvidence || noOverview)
|
|
200
|
+
: !!row;
|
|
201
|
+
const analyzed = captured && (noOverview || !!row);
|
|
202
|
+
const citationObserved = captured && (noOverview || !!row?.citedUrls);
|
|
203
|
+
const requestedModel = capture?.probeProfile.requestedModel ?? null;
|
|
204
|
+
const reportedModel = capture?.probeProfile.reportedModel ?? null;
|
|
205
|
+
const cliVersion =
|
|
206
|
+
capture?.probeProfile.cliVersion ?? row?.agentCliVersion ?? null;
|
|
207
|
+
const parameters = capture?.probeProfile.parameters ?? null;
|
|
208
|
+
const hasParameters =
|
|
209
|
+
parameters !== null && Object.keys(parameters).length > 0;
|
|
210
|
+
// Empty strings carry no metadata, so these checks are truthiness checks.
|
|
211
|
+
const collectionMetadataKnown =
|
|
212
|
+
Boolean(requestedModel) ||
|
|
213
|
+
Boolean(reportedModel) ||
|
|
214
|
+
Boolean(cliVersion) ||
|
|
215
|
+
hasParameters;
|
|
216
|
+
|
|
217
|
+
if (captured && !collectionMetadataKnown) {
|
|
218
|
+
warnings.add('collection_metadata_unknown');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
sectionKey: unit.sectionKey,
|
|
223
|
+
questionKey: questionKey(unit.promptText),
|
|
224
|
+
surface: unit.surface,
|
|
225
|
+
runIndex: unit.runIndex,
|
|
226
|
+
captured,
|
|
227
|
+
analyzed,
|
|
228
|
+
citationObserved,
|
|
229
|
+
captureId:
|
|
230
|
+
capture && captured
|
|
231
|
+
? contentHash({
|
|
232
|
+
slot: slotKey,
|
|
233
|
+
capturedAt: capture.capturedAt,
|
|
234
|
+
rawDigest: capture.rawDigest,
|
|
235
|
+
})
|
|
236
|
+
: null,
|
|
237
|
+
mentioned: analyzed && !noOverview && row?.prospectMentioned === true,
|
|
238
|
+
cited:
|
|
239
|
+
citationObserved &&
|
|
240
|
+
!noOverview &&
|
|
241
|
+
isDomainCited(row?.citedUrls ?? [], config.brand.domain),
|
|
242
|
+
requestedModel,
|
|
243
|
+
cliVersion,
|
|
244
|
+
collectionMetadataKnown,
|
|
245
|
+
collectionMethodDigest: collectionMetadataKnown
|
|
246
|
+
? contentHash({ requestedModel, reportedModel, cliVersion, parameters })
|
|
247
|
+
: null,
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
const dates =
|
|
251
|
+
manifest?.captures
|
|
252
|
+
.map((capture) => date(capture.capturedAt))
|
|
253
|
+
.filter((value): value is string => value !== null)
|
|
254
|
+
.sort() ?? [];
|
|
255
|
+
const knownFresh =
|
|
256
|
+
manifest?.captures.filter(
|
|
257
|
+
(capture) => capture.originRunId === runId && date(capture.capturedAt),
|
|
258
|
+
).length ?? 0;
|
|
259
|
+
const knownReused =
|
|
260
|
+
manifest?.captures.filter(
|
|
261
|
+
(capture) =>
|
|
262
|
+
capture.originRunId !== null && capture.originRunId !== runId,
|
|
263
|
+
).length ??
|
|
264
|
+
snapshot.meta.reusedProbes?.count ??
|
|
265
|
+
0;
|
|
266
|
+
const unknown =
|
|
267
|
+
manifest?.captures.filter(
|
|
268
|
+
(capture) =>
|
|
269
|
+
capture.originRunId === null || date(capture.capturedAt) === null,
|
|
270
|
+
).length ?? 0;
|
|
271
|
+
|
|
272
|
+
if (!['invalid', 'derived'].includes(state)) {
|
|
273
|
+
if (manifest?.captures.length && knownReused === manifest.captures.length) {
|
|
274
|
+
state = 'reused';
|
|
275
|
+
} else if (knownReused > 0 && knownFresh > 0) {
|
|
276
|
+
state = 'mixed';
|
|
277
|
+
} else if (unknown > 0 || !manifest?.captures.length) {
|
|
278
|
+
state = 'legacy';
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Old snapshots can establish complete reuse even without a manifest.
|
|
282
|
+
if (
|
|
283
|
+
!manifest &&
|
|
284
|
+
snapshot.meta.reusedProbes?.count &&
|
|
285
|
+
snapshot.meta.reusedProbes.count >= snapshot.meta.probeCount
|
|
286
|
+
) {
|
|
287
|
+
state = 'reused';
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (unknown > 0 || dates.length !== (manifest?.captures.length ?? 0)) {
|
|
292
|
+
warnings.add('historical_capture_metadata_unknown');
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (state === 'mixed') {
|
|
296
|
+
warnings.add('includes_reused_captures');
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (state === 'reused') {
|
|
300
|
+
warnings.add('reused_measurement');
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (state === 'derived') {
|
|
304
|
+
warnings.add('analysis_replay');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return {
|
|
308
|
+
version: 1,
|
|
309
|
+
runId,
|
|
310
|
+
...(config.questionSetName
|
|
311
|
+
? { questionSetName: config.questionSetName }
|
|
312
|
+
: {}),
|
|
313
|
+
publishedAt: date(input.publishedAt),
|
|
314
|
+
captureWindow: { start: dates[0] ?? null, end: dates.at(-1) ?? null },
|
|
315
|
+
measurementId: manifest
|
|
316
|
+
? contentHash(
|
|
317
|
+
manifest.captures
|
|
318
|
+
.map((capture) => ({
|
|
319
|
+
slot: key(capture),
|
|
320
|
+
capturedAt: capture.capturedAt,
|
|
321
|
+
rawDigest: capture.rawDigest,
|
|
322
|
+
}))
|
|
323
|
+
.sort((left, right) => left.slot.localeCompare(right.slot)),
|
|
324
|
+
)
|
|
325
|
+
: null,
|
|
326
|
+
state,
|
|
327
|
+
warnings: [...warnings],
|
|
328
|
+
reusedCaptures: knownReused,
|
|
329
|
+
brandIdentity: contentHash({
|
|
330
|
+
domain: normalizeDomain(config.brand.domain),
|
|
331
|
+
name: config.brand.name.trim().toLowerCase(),
|
|
332
|
+
aliases: [
|
|
333
|
+
...new Set(
|
|
334
|
+
config.brand.aliases.map((alias) => alias.trim().toLowerCase()),
|
|
335
|
+
),
|
|
336
|
+
].sort(),
|
|
337
|
+
}),
|
|
338
|
+
geography: config.geography.trim().toLowerCase(),
|
|
339
|
+
language: config.language.trim().toLowerCase(),
|
|
340
|
+
analyzer: {
|
|
341
|
+
version: snapshot.meta.analyzerVersion ?? null,
|
|
342
|
+
model: snapshot.meta.models?.analyzer ?? null,
|
|
343
|
+
},
|
|
344
|
+
slots,
|
|
345
|
+
};
|
|
346
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../report/core/qualified-competitors';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CitationAttribution,
|
|
3
|
+
RetrievalCallSummary,
|
|
4
|
+
RetrievalLog,
|
|
5
|
+
} from '../schema';
|
|
6
|
+
import { citedUrlKey } from './answer-text';
|
|
7
|
+
import { isDomainCited, urlIsOnDomain } from './domain-match';
|
|
8
|
+
import { normalizeDomain } from './scoring';
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Retrieval-log derivations computed at snapshot build (retrieval-log spec
|
|
12
|
+
// §6) — pure functions of stored probe data, never a model judgment, so a
|
|
13
|
+
// run on an unchanged checkpoint reproduces them byte for byte.
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* attributeCitations applies attribution (§1): a cited URL is attributed to
|
|
18
|
+
* every retrieval call whose result set contains it, matched on the normalized
|
|
19
|
+
* URL key the citation dedupe uses (trailing slash and utm_* dropped). A URL in
|
|
20
|
+
* no result set is unattributed (empty indices): model memory, an unexposed
|
|
21
|
+
* fetch, or a surface that exposes nothing.
|
|
22
|
+
*/
|
|
23
|
+
export const attributeCitations = (
|
|
24
|
+
citedUrls: readonly string[],
|
|
25
|
+
retrieval: RetrievalLog,
|
|
26
|
+
): CitationAttribution => {
|
|
27
|
+
const keysByCall = retrieval.calls.map(
|
|
28
|
+
(call) =>
|
|
29
|
+
new Set(
|
|
30
|
+
(call.resultUrls ?? []).flatMap((url) => {
|
|
31
|
+
const key = citedUrlKey(url);
|
|
32
|
+
|
|
33
|
+
return key ? [key] : [];
|
|
34
|
+
}),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return citedUrls.map((url) => {
|
|
39
|
+
const key = citedUrlKey(url);
|
|
40
|
+
const callIndices = key
|
|
41
|
+
? keysByCall.flatMap((keys, index) => (keys.has(key) ? [index] : []))
|
|
42
|
+
: [];
|
|
43
|
+
|
|
44
|
+
return { url, callIndices };
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* summarizeRetrievalCalls returns per-call presence for the matrix row (§6).
|
|
50
|
+
* Searches: brand / competitor domains in the result set via the deterministic
|
|
51
|
+
* citation matcher; an incomplete result set (ChatGPT) can prove presence but
|
|
52
|
+
* not absence, so its `false` is stored as `null`. URL-driven calls: whether
|
|
53
|
+
* the opened URL is on the domain. Calls with neither a query nor a URL are
|
|
54
|
+
* dropped here (they stay in the chunk).
|
|
55
|
+
*/
|
|
56
|
+
export const summarizeRetrievalCalls = (
|
|
57
|
+
retrieval: RetrievalLog,
|
|
58
|
+
brand: { domain: string },
|
|
59
|
+
competitors: ReadonlyArray<{ domain: string }>,
|
|
60
|
+
): RetrievalCallSummary[] => {
|
|
61
|
+
const summaries: RetrievalCallSummary[] = [];
|
|
62
|
+
|
|
63
|
+
for (const call of retrieval.calls) {
|
|
64
|
+
if (call.kind === 'search') {
|
|
65
|
+
if (!call.query) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const results = call.resultUrls;
|
|
70
|
+
const found = results ? isDomainCited(results, brand.domain) : null;
|
|
71
|
+
summaries.push({
|
|
72
|
+
kind: 'search',
|
|
73
|
+
query: call.query,
|
|
74
|
+
url: null,
|
|
75
|
+
brandFound:
|
|
76
|
+
results && !call.resultsComplete && found === false ? null : found,
|
|
77
|
+
competitorsFound: results
|
|
78
|
+
? competitors
|
|
79
|
+
.filter((c) => isDomainCited(results, c.domain))
|
|
80
|
+
.map((c) => normalizeDomain(c.domain))
|
|
81
|
+
: [],
|
|
82
|
+
resultCount: results ? results.length : null,
|
|
83
|
+
});
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!call.url) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const url = call.url;
|
|
92
|
+
summaries.push({
|
|
93
|
+
kind: call.kind,
|
|
94
|
+
query: null,
|
|
95
|
+
url,
|
|
96
|
+
brandFound: urlIsOnDomain(url, brand.domain),
|
|
97
|
+
competitorsFound: competitors
|
|
98
|
+
.filter((c) => urlIsOnDomain(url, c.domain))
|
|
99
|
+
.map((c) => normalizeDomain(c.domain)),
|
|
100
|
+
resultCount: null,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return summaries;
|
|
105
|
+
};
|