literally-aeo 0.0.0-stage → 0.1.1
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-2GY42RIJ.js +33 -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-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-3DG7GHFA.js +297 -0
- package/dist/lib/chunks/chunk-3EBWDHPK.js +133 -0
- package/dist/lib/chunks/chunk-3KQFLOC7.js +188 -0
- package/dist/lib/chunks/chunk-3UFZ2XPE.js +73 -0
- package/dist/lib/chunks/chunk-47IZBMP2.js +115 -0
- package/dist/lib/chunks/chunk-4E4NDGOZ.js +47 -0
- package/dist/lib/chunks/chunk-4QQJXCD2.js +113 -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-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-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-AP5DLF36.js +150 -0
- package/dist/lib/chunks/chunk-AUB5THIS.js +341 -0
- package/dist/lib/chunks/chunk-B5L2KMTU.js +108 -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-CKUTDJAB.js +213 -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-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-E3OEE5XN.js +202 -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-FNDJUELJ.js +253 -0
- package/dist/lib/chunks/chunk-FPAN3VRW.js +350 -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-GMKF2FU4.js +104 -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-H56DDRKE.js +85 -0
- package/dist/lib/chunks/chunk-HFOYASRQ.js +99 -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-I3TMFPK4.js +229 -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-JQ3P552S.js +0 -0
- package/dist/lib/chunks/chunk-JS3GBU3R.js +46 -0
- package/dist/lib/chunks/chunk-KHU5DRBE.js +343 -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-LPND3VNQ.js +812 -0
- package/dist/lib/chunks/chunk-MD4AVTK2.js +257 -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-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-NVBMIPXR.js +259 -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-OORO55OM.js +922 -0
- package/dist/lib/chunks/chunk-OQVIRYT5.js +147 -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-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-POUSX3T4.js +64 -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-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-SWS3K62X.js +93 -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-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-XL4JIQ5X.js +316 -0
- package/dist/lib/chunks/chunk-XNRSHATN.js +303 -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-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-ZBDUE3A5.js +136 -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-ZXGATMMH.js +101 -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,27 @@
|
|
|
1
|
+
// src/stores/publication-history.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var publishedHistoryLimit = 50;
|
|
4
|
+
var publicationTripleSchema = z.object({
|
|
5
|
+
reportKey: z.string().regex(/^[a-zA-Z0-9_-]{1,180}$/),
|
|
6
|
+
runId: z.string().regex(/^[a-zA-Z0-9_-]{1,180}$/),
|
|
7
|
+
configVersion: z.number().int().positive(),
|
|
8
|
+
copyVersion: z.number().int().positive()
|
|
9
|
+
});
|
|
10
|
+
var publicationDate = ({
|
|
11
|
+
firstPublishedAt,
|
|
12
|
+
origin,
|
|
13
|
+
reportGeneratedAt
|
|
14
|
+
}) => {
|
|
15
|
+
const instant = firstPublishedAt ?? (origin === "publication" ? null : reportGeneratedAt);
|
|
16
|
+
if (instant === null) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const time = instant instanceof Date ? instant.getTime() : Date.parse(instant);
|
|
20
|
+
return Number.isFinite(time) ? new Date(time).toISOString() : null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
publishedHistoryLimit,
|
|
25
|
+
publicationTripleSchema,
|
|
26
|
+
publicationDate
|
|
27
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/engine/package-root.ts
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
var enginePackageName = "literally-aeo";
|
|
6
|
+
var isEngineManifest = (file) => {
|
|
7
|
+
try {
|
|
8
|
+
const manifest = JSON.parse(readFileSync(file, "utf8"));
|
|
9
|
+
return typeof manifest === "object" && manifest !== null && "name" in manifest && manifest.name === enginePackageName;
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var enginePackageRoot = () => {
|
|
15
|
+
const start = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
let dir = start;
|
|
17
|
+
for (; ; ) {
|
|
18
|
+
if (isEngineManifest(path.join(dir, "package.json"))) {
|
|
19
|
+
return dir;
|
|
20
|
+
}
|
|
21
|
+
const parent = path.dirname(dir);
|
|
22
|
+
if (parent === dir) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`No ${enginePackageName} package.json above ${start}; the engine runs from its own package.`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
dir = parent;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
enginePackageName,
|
|
33
|
+
enginePackageRoot
|
|
34
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import {
|
|
2
|
+
answerBody,
|
|
3
|
+
answerFilePath
|
|
4
|
+
} from "./chunk-CPT2GKKW.js";
|
|
5
|
+
import {
|
|
6
|
+
CheckOutcome,
|
|
7
|
+
checkFrom,
|
|
8
|
+
decidedCheck,
|
|
9
|
+
describeError
|
|
10
|
+
} from "./chunk-6KHQ7DXP.js";
|
|
11
|
+
import {
|
|
12
|
+
capturedRecordsSchema
|
|
13
|
+
} from "./chunk-2NJEWPCV.js";
|
|
14
|
+
import {
|
|
15
|
+
analyzeRowSchema,
|
|
16
|
+
qualifyOutputSchema
|
|
17
|
+
} from "./chunk-GVC4LH2N.js";
|
|
18
|
+
import {
|
|
19
|
+
bundlePaths,
|
|
20
|
+
measurementDigest,
|
|
21
|
+
planDocumentSchema
|
|
22
|
+
} from "./chunk-I3TMFPK4.js";
|
|
23
|
+
import {
|
|
24
|
+
canonicalDigest
|
|
25
|
+
} from "./chunk-E6NQQU6V.js";
|
|
26
|
+
import {
|
|
27
|
+
capturePlan,
|
|
28
|
+
validateCaptureManifest
|
|
29
|
+
} from "./chunk-YHS5IEVZ.js";
|
|
30
|
+
import {
|
|
31
|
+
unitRecordKey
|
|
32
|
+
} from "./chunk-ULRXHSJL.js";
|
|
33
|
+
import {
|
|
34
|
+
locateVerbatimPassage
|
|
35
|
+
} from "./chunk-3UFZ2XPE.js";
|
|
36
|
+
import {
|
|
37
|
+
aeoAuditConfigSchema
|
|
38
|
+
} from "./chunk-ZLOOC46D.js";
|
|
39
|
+
import {
|
|
40
|
+
contentHash
|
|
41
|
+
} from "./chunk-H2KDLDK6.js";
|
|
42
|
+
|
|
43
|
+
// src/bundle/verify-measurement.ts
|
|
44
|
+
import { z } from "zod";
|
|
45
|
+
var slotKey = (unit) => {
|
|
46
|
+
return `${unit.sectionKey}|${unit.promptId}|${unit.surface}|${unit.runIndex}`;
|
|
47
|
+
};
|
|
48
|
+
var slotName = (record) => {
|
|
49
|
+
return `${record.sectionKey}/${record.promptId}/${record.surface}-${record.runIndex}`;
|
|
50
|
+
};
|
|
51
|
+
var digestProblems = (manifest, inputs, method) => {
|
|
52
|
+
const { config, plan } = inputs;
|
|
53
|
+
const recomputed = capturePlan(
|
|
54
|
+
config,
|
|
55
|
+
plan.surfaces,
|
|
56
|
+
plan.sections ?? void 0
|
|
57
|
+
);
|
|
58
|
+
const problems = [];
|
|
59
|
+
if (recomputed.digest !== plan.plan.digest || recomputed.digest !== manifest.digests.plan) {
|
|
60
|
+
problems.push({
|
|
61
|
+
code: "plan_mismatch",
|
|
62
|
+
message: "The frozen plan is not the plan the frozen configuration produces.",
|
|
63
|
+
artifact: bundlePaths.plan
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const measurement = measurementDigest({
|
|
67
|
+
config,
|
|
68
|
+
surfaces: plan.surfaces,
|
|
69
|
+
sections: plan.sections
|
|
70
|
+
});
|
|
71
|
+
if (measurement !== manifest.digests.measurement) {
|
|
72
|
+
problems.push({
|
|
73
|
+
code: "measurement_digest_mismatch",
|
|
74
|
+
message: "The measurement inputs do not match the manifest digest.",
|
|
75
|
+
artifact: bundlePaths.config
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (canonicalDigest(plan.runPolicy) !== manifest.digests.runPolicy) {
|
|
79
|
+
problems.push({
|
|
80
|
+
code: "run_policy_digest_mismatch",
|
|
81
|
+
message: "The run policy does not match the manifest digest.",
|
|
82
|
+
artifact: bundlePaths.plan
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (canonicalDigest(method) !== manifest.digests.method) {
|
|
86
|
+
problems.push({
|
|
87
|
+
code: "method_digest_mismatch",
|
|
88
|
+
message: "The method does not match the manifest digest.",
|
|
89
|
+
artifact: bundlePaths.method
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return problems;
|
|
93
|
+
};
|
|
94
|
+
var captureProblems = (inputs, read) => {
|
|
95
|
+
const { captured, plan } = inputs;
|
|
96
|
+
const problems = [];
|
|
97
|
+
for (const [sectionKey, section] of Object.entries(plan.capture.sections)) {
|
|
98
|
+
const records = captured.filter(
|
|
99
|
+
(record) => record.sectionKey === sectionKey
|
|
100
|
+
);
|
|
101
|
+
for (const coverage of section.coverage) {
|
|
102
|
+
const count = records.filter(
|
|
103
|
+
(record) => record.surface === coverage.surface
|
|
104
|
+
).length;
|
|
105
|
+
if (count !== coverage.captured) {
|
|
106
|
+
problems.push({
|
|
107
|
+
code: "coverage_count_mismatch",
|
|
108
|
+
message: `Section ${sectionKey} records ${coverage.captured} ${coverage.surface} captures; the bundle holds ${count}.`,
|
|
109
|
+
artifact: bundlePaths.captures
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const held = records.map((record) => contentHash(record.probe.text)).sort();
|
|
114
|
+
const declared = section.units.map((unit) => unit.rawDigest).sort();
|
|
115
|
+
if (canonicalDigest(held) !== canonicalDigest(declared)) {
|
|
116
|
+
problems.push({
|
|
117
|
+
code: "capture_artifact_mismatch",
|
|
118
|
+
message: `Section ${sectionKey}'s captured answers do not match the digests the capture recorded.`,
|
|
119
|
+
artifact: bundlePaths.captures
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const document = read(bundlePaths.captureManifest, z.unknown());
|
|
124
|
+
if (!("value" in document)) {
|
|
125
|
+
return problems;
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
const captureManifest = validateCaptureManifest(document.value);
|
|
129
|
+
const digestByKey = new Map(
|
|
130
|
+
captured.map((record) => [
|
|
131
|
+
unitRecordKey(record),
|
|
132
|
+
contentHash(record.probe.text)
|
|
133
|
+
])
|
|
134
|
+
);
|
|
135
|
+
for (const entry of captureManifest.captures) {
|
|
136
|
+
if (digestByKey.get(entry.id) !== entry.rawDigest) {
|
|
137
|
+
problems.push({
|
|
138
|
+
code: "capture_manifest_mismatch",
|
|
139
|
+
message: `Capture manifest entry ${entry.id} does not match the captured answer.`,
|
|
140
|
+
artifact: bundlePaths.captureManifest
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} catch (err) {
|
|
145
|
+
problems.push({
|
|
146
|
+
code: "capture_manifest_invalid",
|
|
147
|
+
message: describeError(err),
|
|
148
|
+
artifact: bundlePaths.captureManifest
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return problems;
|
|
152
|
+
};
|
|
153
|
+
var checkPlan = (manifest, read) => {
|
|
154
|
+
const id = "plan.accounted";
|
|
155
|
+
const title = "Planned slots accounted";
|
|
156
|
+
const config = read(bundlePaths.config, aeoAuditConfigSchema);
|
|
157
|
+
const plan = read(bundlePaths.plan, planDocumentSchema);
|
|
158
|
+
const captured = read(bundlePaths.captures, capturedRecordsSchema);
|
|
159
|
+
const method = read(bundlePaths.method, z.unknown());
|
|
160
|
+
if (!("value" in config) || !("value" in plan) || !("value" in captured) || !("value" in method)) {
|
|
161
|
+
const problems2 = [config, plan, captured, method].flatMap(
|
|
162
|
+
(result) => "problem" in result ? [result.problem] : []
|
|
163
|
+
);
|
|
164
|
+
return {
|
|
165
|
+
check: checkFrom({ id, title, problems: problems2, pass: "" }),
|
|
166
|
+
unknownSlots: 0
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const inputs = {
|
|
170
|
+
config: config.value,
|
|
171
|
+
plan: plan.value,
|
|
172
|
+
captured: captured.value
|
|
173
|
+
};
|
|
174
|
+
const problems = digestProblems(manifest, inputs, method.value);
|
|
175
|
+
const units = capturePlan(
|
|
176
|
+
inputs.config,
|
|
177
|
+
inputs.plan.surfaces,
|
|
178
|
+
inputs.plan.sections ?? void 0
|
|
179
|
+
).units;
|
|
180
|
+
const planned = new Set(units.map(unitRecordKey));
|
|
181
|
+
const capturedKeys = /* @__PURE__ */ new Set();
|
|
182
|
+
for (const record of inputs.captured) {
|
|
183
|
+
const key = unitRecordKey(record);
|
|
184
|
+
if (!planned.has(key)) {
|
|
185
|
+
problems.push({
|
|
186
|
+
code: "capture_unplanned",
|
|
187
|
+
message: `A capture is outside the plan: ${slotName(record)}.`,
|
|
188
|
+
artifact: bundlePaths.captures
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (capturedKeys.has(key)) {
|
|
192
|
+
problems.push({
|
|
193
|
+
code: "capture_duplicate",
|
|
194
|
+
message: `A slot is captured twice: ${slotName(record)}.`,
|
|
195
|
+
artifact: bundlePaths.captures
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
capturedKeys.add(key);
|
|
199
|
+
}
|
|
200
|
+
problems.push(...captureProblems(inputs, read));
|
|
201
|
+
const failedSlots = new Set(
|
|
202
|
+
Object.entries(inputs.plan.capture.sections).flatMap(
|
|
203
|
+
([sectionKey, section]) => section.unitFailures.map(
|
|
204
|
+
(failure) => slotKey({ sectionKey, ...failure })
|
|
205
|
+
)
|
|
206
|
+
)
|
|
207
|
+
);
|
|
208
|
+
const unknownSlots = units.filter(
|
|
209
|
+
(unit) => !capturedKeys.has(unitRecordKey(unit)) && !failedSlots.has(slotKey(unit))
|
|
210
|
+
).length;
|
|
211
|
+
const accounting = `${units.length} planned slots: ${capturedKeys.size} captured, ${failedSlots.size} failed, ${unknownSlots} not attempted or unknown.`;
|
|
212
|
+
const check = problems.length === 0 && unknownSlots > 0 ? decidedCheck({
|
|
213
|
+
id,
|
|
214
|
+
title,
|
|
215
|
+
outcome: CheckOutcome.NOT_CHECKABLE,
|
|
216
|
+
code: "slots_unknown",
|
|
217
|
+
explanation: accounting
|
|
218
|
+
}) : checkFrom({ id, title, problems, pass: accounting });
|
|
219
|
+
return { check, inputs, unknownSlots };
|
|
220
|
+
};
|
|
221
|
+
var analyzeDocumentSchema = z.object({ rows: z.array(analyzeRowSchema) });
|
|
222
|
+
var checkJudgments = (inputs, read) => {
|
|
223
|
+
const id = "judgments.evidence";
|
|
224
|
+
const title = "Judgment coverage and evidence";
|
|
225
|
+
const analyze = read(bundlePaths.analyze, analyzeDocumentSchema);
|
|
226
|
+
const qualify = read(bundlePaths.qualify, qualifyOutputSchema);
|
|
227
|
+
if (!("value" in analyze) || !("value" in qualify)) {
|
|
228
|
+
const problems2 = [analyze, qualify].flatMap(
|
|
229
|
+
(result2) => "problem" in result2 ? [result2.problem] : []
|
|
230
|
+
);
|
|
231
|
+
return { check: checkFrom({ id, title, problems: problems2, pass: "" }) };
|
|
232
|
+
}
|
|
233
|
+
const problems = [];
|
|
234
|
+
const recordByFile = new Map(
|
|
235
|
+
inputs.captured.map((record) => [answerFilePath(record), record])
|
|
236
|
+
);
|
|
237
|
+
const judged = /* @__PURE__ */ new Set();
|
|
238
|
+
for (const row of analyze.value.rows) {
|
|
239
|
+
if (!recordByFile.has(row.file)) {
|
|
240
|
+
problems.push({
|
|
241
|
+
code: "judgment_unknown_answer",
|
|
242
|
+
message: `An analysis row judges ${row.file}, which is not a captured answer.`,
|
|
243
|
+
artifact: bundlePaths.analyze
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (judged.has(row.file)) {
|
|
247
|
+
problems.push({
|
|
248
|
+
code: "judgment_duplicate",
|
|
249
|
+
message: `${row.file} is judged twice.`,
|
|
250
|
+
artifact: bundlePaths.analyze
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
judged.add(row.file);
|
|
254
|
+
}
|
|
255
|
+
for (const row of qualify.value.rows) {
|
|
256
|
+
const record = recordByFile.get(row.file);
|
|
257
|
+
if (!record) {
|
|
258
|
+
problems.push({
|
|
259
|
+
code: "judgment_unknown_answer",
|
|
260
|
+
message: `A qualification row names ${row.file}, which is not a captured answer.`,
|
|
261
|
+
artifact: bundlePaths.qualify
|
|
262
|
+
});
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const body = answerBody(record.probe.text);
|
|
266
|
+
for (const entry of row.qualifiedCompetitors) {
|
|
267
|
+
if (locateVerbatimPassage(body, entry.quote.trim()) === null) {
|
|
268
|
+
problems.push({
|
|
269
|
+
code: "quote_not_verbatim",
|
|
270
|
+
message: `The evidence for ${entry.name} in ${row.file} is not verbatim in the answer body.`,
|
|
271
|
+
artifact: bundlePaths.qualify
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const unjudged = [...recordByFile.keys()].filter(
|
|
277
|
+
(file) => !judged.has(file)
|
|
278
|
+
).length;
|
|
279
|
+
const corrections = read(bundlePaths.corrections, z.array(z.unknown()));
|
|
280
|
+
const result = {
|
|
281
|
+
check: checkFrom({
|
|
282
|
+
id,
|
|
283
|
+
title,
|
|
284
|
+
problems,
|
|
285
|
+
pass: `${judged.size} answers judged, ${unjudged} unjudged; every qualification quote is verbatim in its answer body.`
|
|
286
|
+
}),
|
|
287
|
+
judgments: { analyze: analyze.value, qualify: qualify.value },
|
|
288
|
+
unjudged,
|
|
289
|
+
..."value" in corrections && { corrections: corrections.value.length }
|
|
290
|
+
};
|
|
291
|
+
return result;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export {
|
|
295
|
+
checkPlan,
|
|
296
|
+
checkJudgments
|
|
297
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
engineResources
|
|
3
|
+
} from "./chunk-SBAZBOPI.js";
|
|
4
|
+
import {
|
|
5
|
+
copyVerifierProfile,
|
|
6
|
+
hostModels
|
|
7
|
+
} from "./chunk-OYKV5NDM.js";
|
|
8
|
+
import {
|
|
9
|
+
createRecommendationVerifier
|
|
10
|
+
} from "./chunk-5VNYUCLL.js";
|
|
11
|
+
import {
|
|
12
|
+
validateAgentCopy
|
|
13
|
+
} from "./chunk-FBFZBLTY.js";
|
|
14
|
+
import {
|
|
15
|
+
getEnvironment
|
|
16
|
+
} from "./chunk-PO2J5OQ3.js";
|
|
17
|
+
import {
|
|
18
|
+
aeoSnapshotSchema
|
|
19
|
+
} from "./chunk-SDWYZM64.js";
|
|
20
|
+
import {
|
|
21
|
+
copywriterDocuments
|
|
22
|
+
} from "./chunk-5HT55QYX.js";
|
|
23
|
+
import {
|
|
24
|
+
buildFactCatalog
|
|
25
|
+
} from "./chunk-FFOVLI3U.js";
|
|
26
|
+
|
|
27
|
+
// src/codex-workflow/copy.ts
|
|
28
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
29
|
+
import path from "node:path";
|
|
30
|
+
var copyDir = "COPY";
|
|
31
|
+
var authorDir = async (env = getEnvironment()) => {
|
|
32
|
+
const resources = await engineResources();
|
|
33
|
+
return {
|
|
34
|
+
author: env.AEO_AUTHOR_DIR ?? resources.author,
|
|
35
|
+
company: env.AEO_EDITORIAL_DIR ?? resources.editorial
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
var copywriterFiles = async (env = getEnvironment()) => {
|
|
39
|
+
const { author, company } = await authorDir(env);
|
|
40
|
+
const files = {
|
|
41
|
+
"RULES.md": await readFile(path.join(author, "COPY_RULES.md"), "utf8"),
|
|
42
|
+
"banlist.json": await readFile(path.join(author, "banlist.json"), "utf8")
|
|
43
|
+
};
|
|
44
|
+
for (const file of ["COMPANY", "positioning", "services"]) {
|
|
45
|
+
files[`company/${file}.md`] = await readFile(
|
|
46
|
+
path.join(company, `${file}.md`),
|
|
47
|
+
"utf8"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return files;
|
|
51
|
+
};
|
|
52
|
+
var readSnapshot = async (dir) => {
|
|
53
|
+
const raw = await readFile(
|
|
54
|
+
path.join(dir, "OUT", "snapshot.json"),
|
|
55
|
+
"utf8"
|
|
56
|
+
).catch(() => null);
|
|
57
|
+
if (raw === null) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
"OUT/snapshot.json is missing: the finish step runs before the copy stage."
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return aeoSnapshotSchema.parse(JSON.parse(raw));
|
|
63
|
+
};
|
|
64
|
+
var materializeCopyInputs = async (args) => {
|
|
65
|
+
const { dir } = args;
|
|
66
|
+
const catalog = buildFactCatalog({
|
|
67
|
+
snapshot: args.snapshot,
|
|
68
|
+
config: args.config,
|
|
69
|
+
runId: args.runId,
|
|
70
|
+
grounding: args.grounding ?? void 0
|
|
71
|
+
});
|
|
72
|
+
const documents = {
|
|
73
|
+
...await copywriterFiles(),
|
|
74
|
+
...copywriterDocuments({
|
|
75
|
+
config: args.config,
|
|
76
|
+
snapshot: args.snapshot,
|
|
77
|
+
catalog
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
if (args.previous && args.notes?.length) {
|
|
81
|
+
documents["PREVIOUS.json"] = JSON.stringify(args.previous, null, 2);
|
|
82
|
+
documents["NOTES.md"] = [
|
|
83
|
+
"# Reviewer notes",
|
|
84
|
+
"",
|
|
85
|
+
"The reviewer read PREVIOUS.json and asked for these changes, in order; a later note overrides an earlier one where they disagree.",
|
|
86
|
+
"",
|
|
87
|
+
...args.notes.map(
|
|
88
|
+
(note, index) => `${index + 1}. ${note.trim() || "(no text)"}`
|
|
89
|
+
),
|
|
90
|
+
""
|
|
91
|
+
].join("\n");
|
|
92
|
+
}
|
|
93
|
+
const written = [];
|
|
94
|
+
for (const [name, content] of Object.entries(documents)) {
|
|
95
|
+
const file = path.join(dir, copyDir, name);
|
|
96
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
97
|
+
await writeFile(file, content);
|
|
98
|
+
written.push(path.posix.join(copyDir, name));
|
|
99
|
+
}
|
|
100
|
+
return written.sort();
|
|
101
|
+
};
|
|
102
|
+
var validateCopyDraft = async (args) => {
|
|
103
|
+
const models = hostModels(copyVerifierProfile);
|
|
104
|
+
const verifierProfile = args.verifierRole ?? models.profile.roles.premiseVerifier;
|
|
105
|
+
const accounting = args.accounting ?? models.accounting;
|
|
106
|
+
return validateAgentCopy({
|
|
107
|
+
draft: args.draft,
|
|
108
|
+
config: args.config,
|
|
109
|
+
snapshot: args.snapshot,
|
|
110
|
+
runId: args.runId,
|
|
111
|
+
configVersion: args.configVersion,
|
|
112
|
+
grounding: args.grounding ?? void 0,
|
|
113
|
+
verifierProfile,
|
|
114
|
+
verifier: createRecommendationVerifier({
|
|
115
|
+
accounting,
|
|
116
|
+
profile: verifierProfile,
|
|
117
|
+
memory: args.verifierMemory
|
|
118
|
+
}),
|
|
119
|
+
previous: args.previous,
|
|
120
|
+
brandLogo: args.brandLogo,
|
|
121
|
+
secrets: args.secrets,
|
|
122
|
+
signal: args.signal
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
copyDir,
|
|
128
|
+
authorDir,
|
|
129
|
+
copywriterFiles,
|
|
130
|
+
readSnapshot,
|
|
131
|
+
materializeCopyInputs,
|
|
132
|
+
validateCopyDraft
|
|
133
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mintRunId
|
|
3
|
+
} from "./chunk-W46Y7KBR.js";
|
|
4
|
+
import {
|
|
5
|
+
hasErrorCode
|
|
6
|
+
} from "./chunk-2QLAFBCG.js";
|
|
7
|
+
import {
|
|
8
|
+
bundleEventSchema,
|
|
9
|
+
objectPathPrefix
|
|
10
|
+
} from "./chunk-I3TMFPK4.js";
|
|
11
|
+
import {
|
|
12
|
+
canonicalDigest,
|
|
13
|
+
parseBundleJson,
|
|
14
|
+
sha256Hex
|
|
15
|
+
} from "./chunk-E6NQQU6V.js";
|
|
16
|
+
|
|
17
|
+
// src/bundle/journal.ts
|
|
18
|
+
import { access, mkdir, open, readFile, rename } from "node:fs/promises";
|
|
19
|
+
import path from "node:path";
|
|
20
|
+
var digestEvent = (event) => {
|
|
21
|
+
return canonicalDigest(event);
|
|
22
|
+
};
|
|
23
|
+
var buildEvent = (entry, head, at) => {
|
|
24
|
+
const unsigned = {
|
|
25
|
+
seq: head.count,
|
|
26
|
+
id: mintRunId(),
|
|
27
|
+
type: entry.type,
|
|
28
|
+
at,
|
|
29
|
+
operationId: entry.operationId ?? null,
|
|
30
|
+
payload: entry.payload ?? {},
|
|
31
|
+
objects: [...entry.objects ?? []],
|
|
32
|
+
previousDigest: head.digest
|
|
33
|
+
};
|
|
34
|
+
const event = { ...unsigned, digest: digestEvent(unsigned) };
|
|
35
|
+
return event;
|
|
36
|
+
};
|
|
37
|
+
var readJournal = (text) => {
|
|
38
|
+
const events = [];
|
|
39
|
+
const errors = [];
|
|
40
|
+
const lines = text.split("\n");
|
|
41
|
+
const last = lines.pop();
|
|
42
|
+
const tornTail = last === void 0 || last === "" ? void 0 : last;
|
|
43
|
+
let previous = null;
|
|
44
|
+
for (const [index, line] of lines.entries()) {
|
|
45
|
+
let parsed;
|
|
46
|
+
try {
|
|
47
|
+
parsed = parseBundleJson(line);
|
|
48
|
+
} catch (err) {
|
|
49
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
50
|
+
errors.push(`Line ${index + 1} is not valid JSON: ${message}`);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
const result = bundleEventSchema.safeParse(parsed);
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
errors.push(`Line ${index + 1} is not a valid event.`);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
const { digest, ...unsigned } = result.data;
|
|
59
|
+
if (result.data.seq !== index) {
|
|
60
|
+
errors.push(`Line ${index + 1} has sequence ${result.data.seq}.`);
|
|
61
|
+
}
|
|
62
|
+
if (result.data.previousDigest !== previous) {
|
|
63
|
+
errors.push(`Line ${index + 1} does not chain to the line before it.`);
|
|
64
|
+
}
|
|
65
|
+
if (digestEvent(unsigned) !== digest) {
|
|
66
|
+
errors.push(`Line ${index + 1} does not match its own digest.`);
|
|
67
|
+
}
|
|
68
|
+
events.push(result.data);
|
|
69
|
+
previous = digest;
|
|
70
|
+
}
|
|
71
|
+
return { events, errors, tornTail };
|
|
72
|
+
};
|
|
73
|
+
var syncDirectory = async (dir) => {
|
|
74
|
+
const handle = await open(dir, "r");
|
|
75
|
+
try {
|
|
76
|
+
await handle.sync();
|
|
77
|
+
} finally {
|
|
78
|
+
await handle.close();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var writeDurably = async (file, bytes) => {
|
|
82
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
83
|
+
const handle = await open(temporary, "w");
|
|
84
|
+
try {
|
|
85
|
+
await handle.writeFile(bytes);
|
|
86
|
+
await handle.sync();
|
|
87
|
+
} finally {
|
|
88
|
+
await handle.close();
|
|
89
|
+
}
|
|
90
|
+
await rename(temporary, file);
|
|
91
|
+
await syncDirectory(path.dirname(file));
|
|
92
|
+
};
|
|
93
|
+
var objectWrites = /* @__PURE__ */ new Map();
|
|
94
|
+
var writeObject = async (file, bytes) => {
|
|
95
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
96
|
+
const exists = await access(file).then(
|
|
97
|
+
() => true,
|
|
98
|
+
() => false
|
|
99
|
+
);
|
|
100
|
+
if (!exists) {
|
|
101
|
+
await writeDurably(file, bytes);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var putObject = async (root, bytes) => {
|
|
105
|
+
const digest = sha256Hex(bytes);
|
|
106
|
+
const file = path.join(root, objectPathPrefix, digest);
|
|
107
|
+
let write = objectWrites.get(file);
|
|
108
|
+
if (!write) {
|
|
109
|
+
write = writeObject(file, bytes).finally(() => objectWrites.delete(file));
|
|
110
|
+
objectWrites.set(file, write);
|
|
111
|
+
}
|
|
112
|
+
await write;
|
|
113
|
+
return digest;
|
|
114
|
+
};
|
|
115
|
+
var openJournal = async (root, { now = () => /* @__PURE__ */ new Date() } = {}) => {
|
|
116
|
+
const file = path.join(root, "events.jsonl");
|
|
117
|
+
await mkdir(root, { recursive: true });
|
|
118
|
+
const text = await readFile(file, "utf8").catch((err) => {
|
|
119
|
+
if (hasErrorCode(err, "ENOENT")) {
|
|
120
|
+
return "";
|
|
121
|
+
}
|
|
122
|
+
throw err;
|
|
123
|
+
});
|
|
124
|
+
const reading = readJournal(text);
|
|
125
|
+
if (reading.errors.length > 0) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`The run journal ${file} is damaged: ${reading.errors.join(" ")}`
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
const head = {
|
|
131
|
+
count: reading.events.length,
|
|
132
|
+
digest: reading.events.at(-1)?.digest ?? null
|
|
133
|
+
};
|
|
134
|
+
let queue = Promise.resolve();
|
|
135
|
+
const appendNow = async (entry) => {
|
|
136
|
+
const event = buildEvent(entry, head, now().toISOString());
|
|
137
|
+
const handle = await open(file, "a");
|
|
138
|
+
try {
|
|
139
|
+
await handle.write(`${JSON.stringify(event)}
|
|
140
|
+
`);
|
|
141
|
+
await handle.sync();
|
|
142
|
+
} finally {
|
|
143
|
+
await handle.close();
|
|
144
|
+
}
|
|
145
|
+
head.count = event.seq + 1;
|
|
146
|
+
head.digest = event.digest;
|
|
147
|
+
return event;
|
|
148
|
+
};
|
|
149
|
+
const append = (entry) => {
|
|
150
|
+
const appended = queue.then(() => appendNow(entry));
|
|
151
|
+
queue = appended.then(
|
|
152
|
+
() => void 0,
|
|
153
|
+
() => void 0
|
|
154
|
+
);
|
|
155
|
+
return appended;
|
|
156
|
+
};
|
|
157
|
+
if (reading.tornTail !== void 0) {
|
|
158
|
+
const quarantine = path.join(
|
|
159
|
+
root,
|
|
160
|
+
`events.torn.${now().toISOString().replace(/[:.]/g, "-")}.jsonl`
|
|
161
|
+
);
|
|
162
|
+
const intact = text.slice(0, text.length - reading.tornTail.length);
|
|
163
|
+
await writeDurably(quarantine, reading.tornTail);
|
|
164
|
+
await writeDurably(file, intact);
|
|
165
|
+
await append({
|
|
166
|
+
type: "run_interrupted",
|
|
167
|
+
payload: {
|
|
168
|
+
reason: "torn_append",
|
|
169
|
+
quarantined: path.basename(quarantine)
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
} else {
|
|
173
|
+
await syncDirectory(root);
|
|
174
|
+
}
|
|
175
|
+
const journal = {
|
|
176
|
+
append,
|
|
177
|
+
head: () => ({ ...head })
|
|
178
|
+
};
|
|
179
|
+
return journal;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
digestEvent,
|
|
184
|
+
buildEvent,
|
|
185
|
+
readJournal,
|
|
186
|
+
putObject,
|
|
187
|
+
openJournal
|
|
188
|
+
};
|