literally-aeo 0.1.1 → 0.2.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/README.md +71 -7
- package/dist/author-tools.js +512 -461
- package/dist/cli.mjs +3512 -2010
- package/dist/lib/access/schema.js +6 -6
- package/dist/lib/agents/author-schema.js +11 -12
- package/dist/lib/agents/author-validation.js +19 -20
- package/dist/lib/agents/copy-validation.js +22 -22
- package/dist/lib/agents/copywriter-input.js +22 -7
- package/dist/lib/agents/facts.js +21 -6
- package/dist/lib/agents/narrative-facts.js +20 -2
- package/dist/lib/agents/verifier.js +26 -25
- package/dist/lib/analysis/domain-classifier.js +21 -22
- package/dist/lib/analysis/domain-labels.js +11 -12
- package/dist/lib/analysis/progress-schema.js +2 -2
- package/dist/lib/analysis/progress.js +19 -21
- package/dist/lib/analysis/retrieval.js +20 -3
- package/dist/lib/analysis/scoring.js +20 -3
- package/dist/lib/analysis/search-analyzer.js +19 -5
- package/dist/lib/analysis/sentiment.js +18 -19
- package/dist/lib/author/examples.js +12 -13
- package/dist/lib/bundle/contracts.js +15 -14
- package/dist/lib/bundle/export.js +34 -31
- package/dist/lib/bundle/isolation.js +17 -0
- package/dist/lib/bundle/journal.js +14 -15
- package/dist/lib/bundle/project-journal.js +19 -18
- package/dist/lib/bundle/project.js +31 -28
- package/dist/lib/bundle/read.js +35 -32
- package/dist/lib/bundle/recorder.js +17 -16
- package/dist/lib/bundle/redact.js +14 -15
- package/dist/lib/bundle/trace-coverage.js +14 -15
- package/dist/lib/bundle/verify-integrity.js +16 -17
- package/dist/lib/bundle/verify-measurement.js +22 -23
- package/dist/lib/bundle/verify-report.js +29 -30
- package/dist/lib/bundle/verify.js +37 -38
- package/dist/lib/bundle/writer-lock.js +3 -1
- package/dist/lib/capture-manifest.js +13 -14
- package/dist/lib/checks/crawler-access.js +4 -1
- package/dist/lib/checks/renderability.js +5 -1
- package/dist/lib/checks/run-checks.js +23 -19
- package/dist/lib/chunks/chunk-2B5QF6UQ.js +159 -0
- package/dist/lib/chunks/chunk-2FOKEIIN.js +93 -0
- package/dist/lib/chunks/{chunk-KRFHQQS7.js → chunk-2KH7LNK7.js} +24 -24
- package/dist/lib/chunks/{chunk-NVBMIPXR.js → chunk-3GPUCXVA.js} +44 -26
- package/dist/lib/chunks/{chunk-3EBWDHPK.js → chunk-3OE4UQIB.js} +14 -16
- package/dist/lib/chunks/{chunk-FNDJUELJ.js → chunk-3OWJBGQE.js} +14 -14
- package/dist/lib/chunks/{chunk-Y4OGZ3Q5.js → chunk-46PVVQYR.js} +1 -1
- package/dist/lib/chunks/{chunk-EV4DRS5M.js → chunk-4XIAXX7K.js} +1 -1
- package/dist/lib/chunks/{chunk-IBOWGKN7.js → chunk-52F5XYOW.js} +1 -1
- package/dist/lib/chunks/{chunk-3DG7GHFA.js → chunk-66DVMLGR.js} +10 -10
- package/dist/lib/chunks/{chunk-FFOVLI3U.js → chunk-66T7JC57.js} +12 -10
- package/dist/lib/chunks/{chunk-KMRQSIZW.js → chunk-6GOBBNDU.js} +16 -1
- package/dist/lib/chunks/{chunk-WUELMJ22.js → chunk-6HMHXSCS.js} +2 -2
- package/dist/lib/chunks/{chunk-SWS3K62X.js → chunk-6JICXLDA.js} +3 -3
- package/dist/lib/chunks/{chunk-SBAZBOPI.js → chunk-6P7EZJI7.js} +4 -2
- package/dist/lib/chunks/chunk-75DMLOQ7.js +127 -0
- package/dist/lib/chunks/{chunk-RMFT4KKK.js → chunk-7CW6U5WJ.js} +1 -1
- package/dist/lib/chunks/{chunk-5VNYUCLL.js → chunk-7HM6IZ3L.js} +6 -9
- package/dist/lib/chunks/{chunk-X6E44EGV.js → chunk-7LBSNDRR.js} +10 -8
- package/dist/lib/chunks/{chunk-S2AM76LT.js → chunk-7WO3FFPS.js} +3 -3
- package/dist/lib/chunks/{chunk-ULRXHSJL.js → chunk-7YDXD4MD.js} +9 -6
- package/dist/lib/chunks/{chunk-HFOYASRQ.js → chunk-AAFHXNLU.js} +4 -4
- package/dist/lib/chunks/{chunk-OBXAHX3L.js → chunk-AASWJR7Q.js} +1 -5
- package/dist/lib/chunks/{chunk-MD4AVTK2.js → chunk-AJKV46SM.js} +3 -3
- package/dist/lib/chunks/{chunk-IEVAFDW7.js → chunk-AJO7XVXK.js} +12 -12
- package/dist/lib/chunks/{chunk-GMKF2FU4.js → chunk-AK6YNTCV.js} +1 -1
- package/dist/lib/chunks/{chunk-WKH6BJAZ.js → chunk-BFWK3TBN.js} +6 -6
- package/dist/lib/chunks/{chunk-FKLNEB2P.js → chunk-BGAHZIL3.js} +51 -17
- package/dist/lib/chunks/{chunk-ZCOI3HE2.js → chunk-BRENK356.js} +1 -1
- package/dist/lib/chunks/{chunk-S7KJZIUR.js → chunk-BXF4OC74.js} +18 -9
- package/dist/lib/chunks/{chunk-NCLFZOZU.js → chunk-CH7OCYDL.js} +1 -1
- package/dist/lib/chunks/{chunk-FPAN3VRW.js → chunk-DDS4G4DO.js} +27 -19
- package/dist/lib/chunks/{chunk-ZLOOC46D.js → chunk-DL6YQDTE.js} +34 -8
- package/dist/lib/chunks/chunk-DVFFYY5G.js +74 -0
- package/dist/lib/chunks/{chunk-PDS5KWO3.js → chunk-E2YTTB6Q.js} +56 -42
- package/dist/lib/chunks/{chunk-YR67JG2V.js → chunk-E3OGPTUY.js} +8 -3
- package/dist/lib/chunks/{chunk-SDWYZM64.js → chunk-EDQTINTL.js} +5 -1
- package/dist/lib/chunks/chunk-ESEMYWUH.js +257 -0
- package/dist/lib/chunks/{chunk-YHS5IEVZ.js → chunk-F2NSJ6PG.js} +12 -8
- package/dist/lib/chunks/{chunk-7GXRDAUY.js → chunk-F7DBTXKG.js} +6 -6
- package/dist/lib/chunks/chunk-FAUFE7MI.js +31 -0
- package/dist/lib/chunks/{chunk-4E4NDGOZ.js → chunk-FDM2YNQL.js} +1 -1
- package/dist/lib/chunks/{chunk-47IZBMP2.js → chunk-FIC7JSR4.js} +2 -2
- package/dist/lib/chunks/{chunk-CJ5YD3CU.js → chunk-FJL2V6P5.js} +6 -6
- package/dist/lib/chunks/{chunk-KHU5DRBE.js → chunk-FL6LN2K6.js} +9 -9
- package/dist/lib/chunks/{chunk-HSZ3DM74.js → chunk-GEFKDW7X.js} +15 -2
- package/dist/lib/chunks/{chunk-XNRSHATN.js → chunk-HI3PD3KR.js} +8 -8
- package/dist/lib/chunks/{chunk-AUB5THIS.js → chunk-I3UE52ZV.js} +2 -2
- package/dist/lib/chunks/{chunk-IAR6XGEW.js → chunk-J5NPHPXY.js} +5 -4
- package/dist/lib/chunks/{chunk-XJVXASDD.js → chunk-JBOOD6MU.js} +11 -10
- package/dist/lib/chunks/{chunk-5KKLUM7M.js → chunk-JKPBXPCW.js} +3 -3
- package/dist/lib/chunks/{chunk-5HT55QYX.js → chunk-JQDQVG3D.js} +1 -1
- package/dist/lib/chunks/{chunk-3KQFLOC7.js → chunk-JXBLGCXZ.js} +1 -1
- package/dist/lib/chunks/{chunk-D2INDP5W.js → chunk-JYFEXVWC.js} +7 -6
- package/dist/lib/chunks/{chunk-X2Y2ZNG3.js → chunk-K2FZFESR.js} +8 -8
- package/dist/lib/chunks/{chunk-DC6PN7QJ.js → chunk-K4Y5NT4M.js} +11 -7
- package/dist/lib/chunks/chunk-K7YFL5KB.js +182 -0
- package/dist/lib/chunks/{chunk-ZYSPTOKK.js → chunk-KQCRJIEG.js} +1 -1
- package/dist/lib/chunks/{chunk-LPND3VNQ.js → chunk-KSOHZKV5.js} +43 -35
- package/dist/lib/chunks/{chunk-FBFZBLTY.js → chunk-LR27H2HZ.js} +15 -16
- package/dist/lib/chunks/{chunk-KZR25REO.js → chunk-LTI2YYU3.js} +1 -1
- package/dist/lib/chunks/{chunk-EPQHVILQ.js → chunk-MA27TFEY.js} +5 -3
- package/dist/lib/chunks/{chunk-J46W3EMQ.js → chunk-MENTBQGB.js} +8 -7
- package/dist/lib/chunks/chunk-MPJCZN4G.js +155 -0
- package/dist/lib/chunks/{chunk-56VOFZ7T.js → chunk-MTDYBJXH.js} +92 -26
- package/dist/lib/chunks/{chunk-PCYNBDZ7.js → chunk-OD36HUXA.js} +17 -12
- package/dist/lib/chunks/{chunk-WDSCJEDG.js → chunk-OQFAMKLN.js} +11 -11
- package/dist/lib/chunks/{chunk-Z4LMDKBU.js → chunk-PWOYEIPF.js} +4 -4
- package/dist/lib/chunks/{chunk-XL4JIQ5X.js → chunk-PXB4PWJI.js} +7 -3
- package/dist/lib/chunks/{chunk-7ZOJE6BH.js → chunk-QGZ4QSUE.js} +8 -7
- package/dist/lib/chunks/chunk-QJZTDZMB.js +321 -0
- package/dist/lib/chunks/{chunk-MHAKYFDF.js → chunk-R2AJYV6A.js} +22 -22
- package/dist/lib/chunks/{chunk-5B3RNVZ6.js → chunk-RK57YZKM.js} +1 -1
- package/dist/lib/chunks/{chunk-ZXGATMMH.js → chunk-RPTADJXD.js} +1 -1
- package/dist/lib/chunks/{chunk-2NJEWPCV.js → chunk-RXSHKWZJ.js} +3 -3
- package/dist/lib/chunks/chunk-RYCRL3YA.js +106 -0
- package/dist/lib/chunks/{chunk-E3OEE5XN.js → chunk-SD7LR26G.js} +3 -3
- package/dist/lib/chunks/{chunk-GVC4LH2N.js → chunk-SIJOQRRK.js} +1 -1
- package/dist/lib/chunks/{chunk-ZBDUE3A5.js → chunk-SLAPBFRH.js} +12 -7
- package/dist/lib/chunks/{chunk-CKUTDJAB.js → chunk-SMPP7B7F.js} +45 -10
- package/dist/lib/chunks/{chunk-POUSX3T4.js → chunk-SQQ56UP2.js} +15 -6
- package/dist/lib/chunks/{chunk-I3TMFPK4.js → chunk-T5XQ6NXD.js} +6 -4
- package/dist/lib/chunks/{chunk-EYKINDNK.js → chunk-TAPVCSCR.js} +1 -1
- package/dist/lib/chunks/{chunk-ISN6MBNB.js → chunk-U5USH2HB.js} +7 -7
- package/dist/lib/chunks/chunk-U64NCRRR.js +97 -0
- package/dist/lib/chunks/{chunk-D2LPQO6Y.js → chunk-U6BW6LGX.js} +10 -3
- package/dist/lib/chunks/chunk-U772TN32.js +67 -0
- package/dist/lib/chunks/{chunk-XHWRSGX3.js → chunk-UYDQXXDQ.js} +4 -4
- package/dist/lib/chunks/{chunk-CPT2GKKW.js → chunk-V5JJEEBT.js} +1 -1
- package/dist/lib/chunks/{chunk-YWJPJI3W.js → chunk-VL253W5C.js} +3 -1
- package/dist/lib/chunks/{chunk-I7VNIW6Q.js → chunk-VPXYGN4I.js} +86 -15
- package/dist/lib/chunks/{chunk-Z7V63UZA.js → chunk-VXDMOB7O.js} +4 -4
- package/dist/lib/chunks/chunk-W5X7WJYL.js +91 -0
- package/dist/lib/chunks/{chunk-6AUEDSTU.js → chunk-WCLKIPJV.js} +1 -1
- package/dist/lib/chunks/{chunk-QFVRCSJ2.js → chunk-WDOA5JEH.js} +2 -0
- package/dist/lib/chunks/chunk-WDT2Y7D7.js +117 -0
- package/dist/lib/chunks/{chunk-OVUCZLH2.js → chunk-WIBMVNIH.js} +2 -2
- package/dist/lib/chunks/{chunk-5T3V6XJS.js → chunk-WNIXDMJL.js} +1 -1
- package/dist/lib/chunks/{chunk-OORO55OM.js → chunk-WZGI7UVM.js} +23 -8
- package/dist/lib/chunks/{chunk-2GY42RIJ.js → chunk-XAKME6NM.js} +1 -1
- package/dist/lib/chunks/{chunk-Q2PWES4B.js → chunk-XAN4CRFP.js} +33 -41
- package/dist/lib/chunks/{chunk-MIF5IYNR.js → chunk-XDG6NPJB.js} +26 -29
- package/dist/lib/chunks/{chunk-IPNK7FYT.js → chunk-XFUYEFQP.js} +1 -1
- package/dist/lib/chunks/{chunk-OQVIRYT5.js → chunk-XNTFOVCE.js} +2 -2
- package/dist/lib/chunks/chunk-Y2CZ6FZY.js +61 -0
- package/dist/lib/chunks/{chunk-D7GEQVLL.js → chunk-YKJHFD64.js} +1 -1
- package/dist/lib/chunks/chunk-YZEZRQIG.js +194 -0
- package/dist/lib/chunks/chunk-ZIGNJAPC.js +11 -0
- package/dist/lib/chunks/{chunk-5ZITQDVE.js → chunk-ZQ3ER7JD.js} +12 -13
- package/dist/lib/cli/bundle-commands.js +102 -94
- package/dist/lib/cli/guide-command.js +25 -0
- package/dist/lib/cli/io.js +1 -1
- package/dist/lib/cli/run-commands.js +310 -140
- package/dist/lib/cli/status-command.js +236 -0
- package/dist/lib/codex-workflow/aggregate.js +22 -24
- package/dist/lib/codex-workflow/author-search.js +4 -3
- package/dist/lib/codex-workflow/author-tools.js +18 -17
- package/dist/lib/codex-workflow/author.js +39 -36
- package/dist/lib/codex-workflow/capture.js +26 -25
- package/dist/lib/codex-workflow/checkpoint.js +14 -15
- package/dist/lib/codex-workflow/checks.js +16 -18
- package/dist/lib/codex-workflow/codex-binary.js +13 -0
- package/dist/lib/codex-workflow/codex-home.js +6 -3
- package/dist/lib/codex-workflow/copy-editor.js +33 -32
- package/dist/lib/codex-workflow/copy-recovery.js +12 -13
- package/dist/lib/codex-workflow/copy.js +30 -29
- package/dist/lib/codex-workflow/finish.js +37 -38
- package/dist/lib/codex-workflow/host-models.js +7 -7
- package/dist/lib/codex-workflow/loop.js +71 -65
- package/dist/lib/codex-workflow/quality.js +12 -13
- package/dist/lib/codex-workflow/run-inputs.js +13 -14
- package/dist/lib/codex-workflow/run-source.js +28 -24
- package/dist/lib/codex-workflow/schemas.js +12 -13
- package/dist/lib/codex-workflow/session.js +15 -16
- package/dist/lib/codex-workflow/stage.js +51 -45
- package/dist/lib/codex-workflow/workdir.js +14 -15
- package/dist/lib/engine/audit-file.js +18 -13
- package/dist/lib/engine/author.js +62 -53
- package/dist/lib/engine/budget.js +7 -1
- package/dist/lib/engine/cost-estimate.js +43 -0
- package/dist/lib/engine/local-run.js +79 -71
- package/dist/lib/engine/preflight.js +17 -13
- package/dist/lib/engine/rejudge.js +87 -79
- package/dist/lib/engine/resources.js +1 -1
- package/dist/lib/engine/run-configuration.js +2 -1
- package/dist/lib/engine/run-status.js +153 -0
- package/dist/lib/engine/templates.js +19 -14
- package/dist/lib/grounding/chromium-guard.js +13 -0
- package/dist/lib/grounding/controller.js +13 -12
- package/dist/lib/grounding/extract.js +12 -11
- package/dist/lib/grounding/fetch.js +4 -7
- package/dist/lib/grounding/file-store.js +5 -5
- package/dist/lib/grounding/grounding-runtime.js +34 -32
- package/dist/lib/grounding/guarded-request.js +18 -0
- package/dist/lib/grounding/model.js +11 -10
- package/dist/lib/grounding/profile.js +4 -4
- package/dist/lib/grounding/recorded-tools.js +18 -17
- package/dist/lib/grounding/session.js +3 -3
- package/dist/lib/grounding/tools.js +4 -3
- package/dist/lib/grounding/validation.js +2 -2
- package/dist/lib/harness/report/artifacts.js +12 -13
- package/dist/lib/harness/report/capture-coverage.js +4 -4
- package/dist/lib/lib/checkpoint.js +11 -12
- package/dist/lib/lib/progress-comparison.js +2 -2
- package/dist/lib/models/batching.js +5 -5
- package/dist/lib/models/cost-coefficients.js +20 -0
- package/dist/lib/models/local-profile.js +10 -0
- package/dist/lib/models/pricing.js +6 -0
- package/dist/lib/models/profiles.js +7 -14
- package/dist/lib/models/structured-images.js +1 -1
- package/dist/lib/models/structured.js +4 -4
- package/dist/lib/models/supported-models.js +20 -0
- package/dist/lib/pipeline.js +21 -21
- package/dist/lib/probes/agent-cli-parsers.js +1 -1
- package/dist/lib/probes/agent-clis.js +13 -12
- package/dist/lib/probes/charged-trace.js +10 -0
- package/dist/lib/probes/probes.js +12 -12
- package/dist/lib/probes/web-tool-guard.js +3 -3
- package/dist/lib/report/contracts.js +4 -4
- package/dist/lib/report/core/progress-comparison.js +2 -2
- package/dist/lib/report/core/progress-schema.js +2 -2
- package/dist/lib/report/core/schema.js +2 -4
- package/dist/lib/report/core/surfaces.js +1 -3
- package/dist/lib/runner.js +25 -26
- package/dist/lib/schema.js +20 -15
- package/dist/lib/section-result.js +15 -17
- package/dist/lib/stores/artifacts.js +18 -19
- package/dist/lib/stores/files.js +32 -32
- package/dist/lib/stores/local-versions.js +11 -12
- package/dist/lib/stores/memory.js +34 -35
- package/dist/lib/stores/publication.js +23 -23
- package/dist/lib/surfaces.js +1 -3
- package/dist/lib/viewer/server.js +38 -39
- package/dist/lib/workflow/schema.js +9 -10
- package/dist/types/agents/author-schema.d.ts +3 -3
- package/dist/types/agents/copy-validation.d.ts +4 -4
- package/dist/types/agents/verifier.d.ts +6 -6
- package/dist/types/analysis/scoring.d.ts +2 -2
- package/dist/types/bundle/contracts.d.ts +3 -2
- package/dist/types/bundle/isolation.d.ts +37 -0
- package/dist/types/bundle/project-journal.d.ts +2 -0
- package/dist/types/bundle/recorder.d.ts +4 -0
- package/dist/types/bundle/writer-lock.d.ts +9 -0
- package/dist/types/checks/crawler-access.d.ts +3 -2
- package/dist/types/checks/renderability.d.ts +8 -1
- package/dist/types/cli/guide-command.d.ts +4 -0
- package/dist/types/cli/status-command.d.ts +2 -0
- package/dist/types/codex-workflow/author-tools.d.ts +3 -3
- package/dist/types/codex-workflow/codex-binary.d.ts +26 -0
- package/dist/types/codex-workflow/codex-home.d.ts +24 -20
- package/dist/types/codex-workflow/copy-editor.d.ts +1 -1
- package/dist/types/codex-workflow/copy.d.ts +3 -4
- package/dist/types/codex-workflow/finish.d.ts +5 -3
- package/dist/types/codex-workflow/host-models.d.ts +7 -3
- package/dist/types/codex-workflow/loop.d.ts +10 -1
- package/dist/types/codex-workflow/run-inputs.d.ts +31 -113
- package/dist/types/codex-workflow/schemas.d.ts +6 -6
- package/dist/types/codex-workflow/stage.d.ts +16 -5
- package/dist/types/engine/audit-file.d.ts +9 -3
- package/dist/types/engine/author.d.ts +7 -1
- package/dist/types/engine/budget.d.ts +46 -15
- package/dist/types/engine/cost-estimate.d.ts +40 -0
- package/dist/types/engine/local-run.d.ts +6 -0
- package/dist/types/engine/preflight.d.ts +7 -0
- package/dist/types/engine/resources.d.ts +2 -0
- package/dist/types/engine/run-configuration.d.ts +4 -3
- package/dist/types/engine/run-status.d.ts +75 -0
- package/dist/types/engine/templates.d.ts +1 -2
- package/dist/types/grounding/chromium-guard.d.ts +41 -0
- package/dist/types/grounding/fetch.d.ts +0 -10
- package/dist/types/grounding/guarded-request.d.ts +76 -0
- package/dist/types/harness/report/artifacts.d.ts +1 -0
- package/dist/types/lib/checkpoint.d.ts +5 -6
- package/dist/types/models/cost-coefficients.d.ts +106 -0
- package/dist/types/models/local-profile.d.ts +12 -0
- package/dist/types/models/pricing.d.ts +8 -0
- package/dist/types/models/profiles.d.ts +55 -160
- package/dist/types/models/served-model.d.ts +2 -3
- package/dist/types/models/structured.d.ts +3 -3
- package/dist/types/models/supported-models.d.ts +48 -0
- package/dist/types/pipeline.d.ts +2 -1
- package/dist/types/probes/charged-trace.d.ts +8 -0
- package/dist/types/probes/probe-trace.d.ts +2 -0
- package/dist/types/probes/probes.d.ts +2 -1
- package/dist/types/report/contracts.d.ts +2 -0
- package/dist/types/report/core/schema.d.ts +3 -1
- package/dist/types/report/core/surfaces.d.ts +0 -1
- package/dist/types/schema.d.ts +50 -113
- package/dist/types/section-result.d.ts +1 -1
- package/dist/types/workflow/schema.d.ts +79 -152
- package/package.json +2 -1
- package/resources/guide/OPERATOR.md +189 -0
- package/src/agents/author-schema.ts +13 -1
- package/src/agents/author-validation.ts +2 -5
- package/src/agents/copy-validation.ts +8 -12
- package/src/agents/facts.ts +8 -8
- package/src/agents/narrative-facts.ts +9 -20
- package/src/agents/verifier.ts +12 -16
- package/src/analysis/progress.ts +1 -0
- package/src/analysis/scoring.ts +9 -13
- package/src/bundle/contracts.ts +9 -4
- package/src/bundle/isolation.ts +157 -0
- package/src/bundle/project-journal.ts +4 -0
- package/src/bundle/project.ts +20 -7
- package/src/bundle/recorder.ts +5 -0
- package/src/bundle/verify.ts +3 -3
- package/src/bundle/writer-lock.ts +27 -0
- package/src/capture-manifest.ts +4 -0
- package/src/checks/crawler-access.ts +70 -50
- package/src/checks/renderability.ts +113 -87
- package/src/checks/run-checks.ts +16 -3
- package/src/cli/guide-command.ts +28 -0
- package/src/cli/io.ts +2 -0
- package/src/cli/literally-aeo.ts +39 -19
- package/src/cli/run-commands.ts +238 -18
- package/src/cli/status-command.ts +113 -0
- package/src/codex-workflow/aggregate.ts +1 -0
- package/src/codex-workflow/author-tools.ts +39 -60
- package/src/codex-workflow/capture.ts +1 -0
- package/src/codex-workflow/codex-binary.ts +105 -0
- package/src/codex-workflow/codex-home.ts +50 -40
- package/src/codex-workflow/copy-editor.ts +3 -3
- package/src/codex-workflow/copy.ts +7 -10
- package/src/codex-workflow/finish.ts +13 -8
- package/src/codex-workflow/host-models.ts +33 -24
- package/src/codex-workflow/loop.ts +38 -11
- package/src/codex-workflow/stage.ts +126 -17
- package/src/engine/audit-file.ts +98 -9
- package/src/engine/author.ts +47 -2
- package/src/engine/budget.ts +138 -43
- package/src/engine/cost-estimate.ts +178 -0
- package/src/engine/guide/OPERATOR.md +189 -0
- package/src/engine/local-run.ts +38 -8
- package/src/engine/preflight.ts +140 -7
- package/src/engine/resources.ts +9 -4
- package/src/engine/run-configuration.ts +19 -1
- package/src/engine/run-status.ts +452 -0
- package/src/engine/templates.ts +5 -2
- package/src/grounding/chromium-guard.ts +273 -0
- package/src/grounding/controller.ts +1 -1
- package/src/grounding/fetch.ts +39 -276
- package/src/grounding/guarded-request.ts +428 -0
- package/src/grounding/tools.ts +2 -1
- package/src/grounding/validation.ts +1 -1
- package/src/lib/checkpoint.ts +15 -16
- package/src/models/cost-coefficients.ts +140 -0
- package/src/models/local-profile.ts +150 -0
- package/src/models/pricing.ts +31 -0
- package/src/models/profiles.ts +58 -419
- package/src/models/served-model.ts +2 -3
- package/src/models/structured-images.ts +5 -4
- package/src/models/structured.ts +20 -7
- package/src/models/supported-models.ts +112 -0
- package/src/pipeline.ts +13 -7
- package/src/probes/agent-clis.ts +26 -5
- package/src/probes/charged-trace.ts +87 -0
- package/src/probes/probe-trace.ts +2 -0
- package/src/probes/probes.ts +72 -12
- package/src/report/core/schema.ts +4 -1
- package/src/report/core/surfaces.ts +4 -8
- package/src/runner.ts +1 -0
- package/src/schema.ts +68 -4
- package/src/section-result.ts +6 -5
- package/dist/lib/chunks/chunk-6EH4N3EU.js +0 -113
- package/dist/lib/chunks/chunk-CFFPOTP4.js +0 -356
- package/dist/lib/chunks/chunk-LIZX4N3H.js +0 -110
- package/dist/lib/chunks/chunk-OYKV5NDM.js +0 -28
- package/dist/lib/chunks/chunk-SWJ7KQSL.js +0 -318
- package/dist/lib/chunks/chunk-WE2WPNG2.js +0 -104
- package/dist/lib/chunks/{chunk-XI5H46DF.js → chunk-SASE7U6E.js} +3 -3
package/dist/author-tools.js
CHANGED
|
@@ -1,166 +1,5 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module";
|
|
2
2
|
const require = __createRequire(import.meta.url);
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __esm = (fn, res, err) => function __init() {
|
|
6
|
-
if (err) throw err[0];
|
|
7
|
-
try {
|
|
8
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
-
} catch (e) {
|
|
10
|
-
throw err = [e], e;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
var __export = (target, all) => {
|
|
14
|
-
for (var name in all)
|
|
15
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// src/api/errors.ts
|
|
19
|
-
var ApiError;
|
|
20
|
-
var init_errors = __esm({
|
|
21
|
-
"src/api/errors.ts"() {
|
|
22
|
-
"use strict";
|
|
23
|
-
ApiError = class extends Error {
|
|
24
|
-
code;
|
|
25
|
-
details;
|
|
26
|
-
constructor(code, message, { details } = {}) {
|
|
27
|
-
super(message);
|
|
28
|
-
this.code = code;
|
|
29
|
-
this.details = details;
|
|
30
|
-
this.name = "ApiError";
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// src/workflow/callbacks.ts
|
|
37
|
-
var callbacks_exports = {};
|
|
38
|
-
__export(callbacks_exports, {
|
|
39
|
-
deliverCallback: () => deliverCallback,
|
|
40
|
-
isPublicAddress: () => isPublicAddress,
|
|
41
|
-
signCallback: () => signCallback,
|
|
42
|
-
validateCallbackUrl: () => validateCallbackUrl,
|
|
43
|
-
verifyCallback: () => verifyCallback
|
|
44
|
-
});
|
|
45
|
-
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
46
|
-
import { lookup } from "node:dns/promises";
|
|
47
|
-
import { isIP } from "node:net";
|
|
48
|
-
import { request as httpsRequest } from "node:https";
|
|
49
|
-
var signatureToleranceSeconds, deliveryTimeoutMs, signCallback, verifyCallback, isPublicAddress, validateCallbackUrl, deliverCallback;
|
|
50
|
-
var init_callbacks = __esm({
|
|
51
|
-
"src/workflow/callbacks.ts"() {
|
|
52
|
-
"use strict";
|
|
53
|
-
init_errors();
|
|
54
|
-
signatureToleranceSeconds = 300;
|
|
55
|
-
deliveryTimeoutMs = 5e3;
|
|
56
|
-
signCallback = (rawBody, secret, {
|
|
57
|
-
timestampInSeconds = Math.floor(Date.now() / 1e3)
|
|
58
|
-
} = {}) => {
|
|
59
|
-
const digest2 = createHmac("sha256", secret).update(`${timestampInSeconds}.${rawBody}`).digest("hex");
|
|
60
|
-
return `t=${timestampInSeconds},v1=${digest2}`;
|
|
61
|
-
};
|
|
62
|
-
verifyCallback = (rawBody, { signature, secret, nowMs = Date.now() }) => {
|
|
63
|
-
const match = /^t=(\d{1,12}),v1=([a-f0-9]{64})$/.exec(signature ?? "");
|
|
64
|
-
if (!match || !secret) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
const [, timestampText, digestHex] = match;
|
|
68
|
-
if (timestampText === void 0 || digestHex === void 0) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
const ageInSeconds = Math.abs(nowMs / 1e3 - Number(timestampText));
|
|
72
|
-
if (ageInSeconds > signatureToleranceSeconds) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
const expected = createHmac("sha256", secret).update(`${timestampText}.${rawBody}`).digest();
|
|
76
|
-
return timingSafeEqual(expected, Buffer.from(digestHex, "hex"));
|
|
77
|
-
};
|
|
78
|
-
isPublicAddress = (address) => {
|
|
79
|
-
if (isIP(address) === 4) {
|
|
80
|
-
const [a, b] = address.split(".").map(Number);
|
|
81
|
-
if (a === void 0 || b === void 0) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
return !(a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && (b === 168 || b === 0) || a === 198 && (b === 18 || b === 19) || a >= 224);
|
|
85
|
-
}
|
|
86
|
-
return isIP(address) === 6 && /^[23][0-9a-f]{3}:/i.test(address) && !address.toLowerCase().startsWith("2001:db8:");
|
|
87
|
-
};
|
|
88
|
-
validateCallbackUrl = (value, hosts) => {
|
|
89
|
-
const url = new URL(value);
|
|
90
|
-
if (url.protocol !== "https:" || url.username || url.password || url.port || url.hash || !hosts.includes(url.hostname) || isIP(url.hostname)) {
|
|
91
|
-
throw new ApiError(
|
|
92
|
-
"invalid_request",
|
|
93
|
-
"Callback URL must use an approved HTTPS host and default port"
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
return url;
|
|
97
|
-
};
|
|
98
|
-
deliverCallback = async (url, { rawBody, signature }) => {
|
|
99
|
-
const controller = new AbortController();
|
|
100
|
-
const deadline = new Promise((_resolve, reject) => {
|
|
101
|
-
controller.signal.addEventListener(
|
|
102
|
-
"abort",
|
|
103
|
-
() => {
|
|
104
|
-
reject(new Error(`Callback delivery timed out for ${url.hostname}.`));
|
|
105
|
-
},
|
|
106
|
-
{ once: true }
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
const timeout = setTimeout(() => {
|
|
110
|
-
controller.abort();
|
|
111
|
-
}, deliveryTimeoutMs);
|
|
112
|
-
try {
|
|
113
|
-
const addresses = await Promise.race([
|
|
114
|
-
lookup(url.hostname, { all: true }),
|
|
115
|
-
deadline
|
|
116
|
-
]);
|
|
117
|
-
const [pinned] = addresses;
|
|
118
|
-
if (!pinned || addresses.some(({ address }) => !isPublicAddress(address))) {
|
|
119
|
-
throw new Error(
|
|
120
|
-
`Callback DNS must resolve only to public addresses: ${url.hostname}.`
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
await new Promise((resolve, reject) => {
|
|
124
|
-
const req = httpsRequest(
|
|
125
|
-
url,
|
|
126
|
-
{
|
|
127
|
-
method: "POST",
|
|
128
|
-
headers: {
|
|
129
|
-
"content-type": "application/json",
|
|
130
|
-
"content-length": Buffer.byteLength(rawBody),
|
|
131
|
-
"x-aeo-signature": signature
|
|
132
|
-
},
|
|
133
|
-
lookup: (_host, options, callback) => {
|
|
134
|
-
if (options.all) {
|
|
135
|
-
callback(null, [pinned]);
|
|
136
|
-
} else {
|
|
137
|
-
callback(null, pinned.address, pinned.family);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
signal: controller.signal
|
|
141
|
-
},
|
|
142
|
-
(res) => {
|
|
143
|
-
res.resume();
|
|
144
|
-
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
|
|
145
|
-
resolve();
|
|
146
|
-
} else {
|
|
147
|
-
reject(
|
|
148
|
-
new Error(
|
|
149
|
-
`Callback delivery returned HTTP ${res.statusCode ?? "without a status"}.`
|
|
150
|
-
)
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
req.once("error", reject);
|
|
156
|
-
req.end(rawBody);
|
|
157
|
-
});
|
|
158
|
-
} finally {
|
|
159
|
-
clearTimeout(timeout);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
3
|
|
|
165
4
|
// src/codex-workflow/author-tools-server.ts
|
|
166
5
|
import { appendFile as appendFile2, mkdir as mkdir3 } from "node:fs/promises";
|
|
@@ -205,11 +44,242 @@ var contentHash = (value) => {
|
|
|
205
44
|
};
|
|
206
45
|
|
|
207
46
|
// src/grounding/fetch.ts
|
|
208
|
-
import { lookup as lookup2 } from "node:dns/promises";
|
|
209
|
-
import { isIP as isIP2 } from "node:net";
|
|
210
|
-
import { request } from "node:https";
|
|
211
47
|
import { load } from "cheerio";
|
|
212
|
-
|
|
48
|
+
|
|
49
|
+
// src/grounding/guarded-request.ts
|
|
50
|
+
import { lookup } from "node:dns/promises";
|
|
51
|
+
import { request } from "node:https";
|
|
52
|
+
import { isIP as isIP2 } from "node:net";
|
|
53
|
+
|
|
54
|
+
// src/workflow/callbacks.ts
|
|
55
|
+
import { isIP } from "node:net";
|
|
56
|
+
var isPublicAddress = (address) => {
|
|
57
|
+
if (isIP(address) === 4) {
|
|
58
|
+
const [a, b] = address.split(".").map(Number);
|
|
59
|
+
if (a === void 0 || b === void 0) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return !(a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && (b === 168 || b === 0) || a === 198 && (b === 18 || b === 19) || a >= 224);
|
|
63
|
+
}
|
|
64
|
+
return isIP(address) === 6 && /^[23][0-9a-f]{3}:/i.test(address) && !address.toLowerCase().startsWith("2001:db8:");
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/grounding/guarded-request.ts
|
|
68
|
+
var SourceRetrievalError = class extends Error {
|
|
69
|
+
reason;
|
|
70
|
+
status;
|
|
71
|
+
constructor(reason, message, { status, cause } = {}) {
|
|
72
|
+
super(message, cause === void 0 ? void 0 : { cause });
|
|
73
|
+
this.name = "SourceRetrievalError";
|
|
74
|
+
this.reason = reason;
|
|
75
|
+
this.status = status;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var validateResearchUrl = (value) => {
|
|
79
|
+
let url;
|
|
80
|
+
try {
|
|
81
|
+
url = new URL(value);
|
|
82
|
+
} catch {
|
|
83
|
+
throw new SourceRetrievalError(
|
|
84
|
+
"unsafe_destination",
|
|
85
|
+
`Invalid source URL: ${value}.`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (url.protocol !== "https:" || url.username || url.password || url.port || url.hostname === "localhost" || url.hostname.endsWith(".localhost") || url.hostname.endsWith(".local") || url.hostname.endsWith(".internal") || url.hostname === "metadata.google.internal") {
|
|
89
|
+
throw new SourceRetrievalError(
|
|
90
|
+
"unsafe_destination",
|
|
91
|
+
`Source must use public HTTPS with no credentials: ${url.hostname}.`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
95
|
+
if (isIP2(host) && !isPublicAddress(host)) {
|
|
96
|
+
throw new SourceRetrievalError(
|
|
97
|
+
"unsafe_destination",
|
|
98
|
+
`Private source destination: ${host}.`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
url.hash = "";
|
|
102
|
+
return url;
|
|
103
|
+
};
|
|
104
|
+
var withAbort = (promise, signal) => {
|
|
105
|
+
signal.throwIfAborted();
|
|
106
|
+
return new Promise((resolve, reject) => {
|
|
107
|
+
const aborted = () => {
|
|
108
|
+
reject(signal.reason);
|
|
109
|
+
};
|
|
110
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
111
|
+
promise.then(resolve, reject).finally(() => {
|
|
112
|
+
signal.removeEventListener("abort", aborted);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
var lookupAll = (host) => {
|
|
117
|
+
return lookup(host, { all: true });
|
|
118
|
+
};
|
|
119
|
+
var resolvePublicAddress = async (hostname, signal, lookupHost = lookupAll) => {
|
|
120
|
+
const host = hostname.replace(/^\[|\]$/g, "");
|
|
121
|
+
const addresses = await withAbort(lookupHost(host), signal);
|
|
122
|
+
if (addresses.length === 0 || addresses.some(({ address }) => !isPublicAddress(address))) {
|
|
123
|
+
throw new SourceRetrievalError(
|
|
124
|
+
"unsafe_destination",
|
|
125
|
+
`Source DNS must resolve exclusively to public addresses: ${host}.`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
const [firstAddress] = addresses;
|
|
129
|
+
if (!firstAddress) {
|
|
130
|
+
throw new SourceRetrievalError(
|
|
131
|
+
"unsafe_destination",
|
|
132
|
+
`Source DNS returned no address: ${host}.`
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return firstAddress;
|
|
136
|
+
};
|
|
137
|
+
var isRedirect = (status) => {
|
|
138
|
+
return status >= 300 && status < 400;
|
|
139
|
+
};
|
|
140
|
+
var isSuccess = (status) => {
|
|
141
|
+
return status >= 200 && status < 300;
|
|
142
|
+
};
|
|
143
|
+
var requestHop = async (url, options, signal) => {
|
|
144
|
+
const address = await resolvePublicAddress(url.hostname, signal);
|
|
145
|
+
signal.throwIfAborted();
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
const req = request(
|
|
148
|
+
url,
|
|
149
|
+
{
|
|
150
|
+
method: "GET",
|
|
151
|
+
signal,
|
|
152
|
+
headers: {
|
|
153
|
+
"accept": options.accept,
|
|
154
|
+
// Never a compressed body: nothing to decompress, so no bomb to
|
|
155
|
+
// bound. An encoded body despite this is refused below.
|
|
156
|
+
"accept-encoding": "identity",
|
|
157
|
+
"user-agent": options.userAgent
|
|
158
|
+
},
|
|
159
|
+
lookup: (_host, lookupOptions, callback) => {
|
|
160
|
+
if (lookupOptions.all) {
|
|
161
|
+
callback(null, [address]);
|
|
162
|
+
} else {
|
|
163
|
+
callback(null, address.address, address.family);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
(response) => {
|
|
168
|
+
const status = response.statusCode ?? 0;
|
|
169
|
+
const contentType = response.headers["content-type"] ?? "";
|
|
170
|
+
const encoding = response.headers["content-encoding"];
|
|
171
|
+
const policy = options.body;
|
|
172
|
+
const settle = (body, isTruncated) => {
|
|
173
|
+
resolve({
|
|
174
|
+
status,
|
|
175
|
+
location: response.headers.location,
|
|
176
|
+
contentType,
|
|
177
|
+
body,
|
|
178
|
+
isTruncated
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
if (!policy || !isSuccess(status)) {
|
|
182
|
+
response.destroy();
|
|
183
|
+
settle(void 0, false);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (policy.contentTypes !== "any" && !policy.contentTypes.test(contentType) || encoding && encoding !== "identity") {
|
|
187
|
+
response.destroy();
|
|
188
|
+
reject(
|
|
189
|
+
new SourceRetrievalError(
|
|
190
|
+
"unsupported_content",
|
|
191
|
+
`Unsupported source content: ${contentType}.`
|
|
192
|
+
)
|
|
193
|
+
);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const chunks = [];
|
|
197
|
+
let bytes = 0;
|
|
198
|
+
response.on("data", (chunk) => {
|
|
199
|
+
bytes += chunk.length;
|
|
200
|
+
if (bytes <= policy.maxBytes) {
|
|
201
|
+
chunks.push(chunk);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
response.destroy();
|
|
205
|
+
if (policy.oversize === "refuse") {
|
|
206
|
+
reject(
|
|
207
|
+
new SourceRetrievalError(
|
|
208
|
+
"too_large",
|
|
209
|
+
`Source response exceeds byte limit: ${bytes} bytes.`
|
|
210
|
+
)
|
|
211
|
+
);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const kept = Buffer.concat(chunks);
|
|
215
|
+
settle(
|
|
216
|
+
Buffer.concat([
|
|
217
|
+
kept,
|
|
218
|
+
chunk.subarray(0, policy.maxBytes - kept.length)
|
|
219
|
+
]),
|
|
220
|
+
true
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
response.once("error", reject);
|
|
224
|
+
response.once("end", () => {
|
|
225
|
+
settle(Buffer.concat(chunks), false);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
req.once("error", reject);
|
|
230
|
+
req.end();
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
var guardedRequest = async (options) => {
|
|
234
|
+
const pace = options.pace ?? ((_url, send2) => send2());
|
|
235
|
+
const hops = [];
|
|
236
|
+
let url = validateResearchUrl(options.url);
|
|
237
|
+
let hopSignal;
|
|
238
|
+
try {
|
|
239
|
+
for (let redirects = 0; ; redirects += 1) {
|
|
240
|
+
const target = url;
|
|
241
|
+
const response = await pace(target, () => {
|
|
242
|
+
options.signal?.throwIfAborted();
|
|
243
|
+
const signal = AbortSignal.any([
|
|
244
|
+
AbortSignal.timeout(options.timeoutInMs),
|
|
245
|
+
...options.signal ? [options.signal] : []
|
|
246
|
+
]);
|
|
247
|
+
hopSignal = signal;
|
|
248
|
+
return requestHop(target, options, signal);
|
|
249
|
+
});
|
|
250
|
+
hops.push({ url: target.href, status: response.status });
|
|
251
|
+
if (!isRedirect(response.status)) {
|
|
252
|
+
const { location: _location, ...final } = response;
|
|
253
|
+
return { ...final, url: target.href, hops };
|
|
254
|
+
}
|
|
255
|
+
if (!response.location) {
|
|
256
|
+
throw new SourceRetrievalError(
|
|
257
|
+
"http_error",
|
|
258
|
+
`Source redirect without a location: ${target.href}.`
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
if (redirects === options.redirects) {
|
|
262
|
+
throw new SourceRetrievalError(
|
|
263
|
+
"http_error",
|
|
264
|
+
`Source redirect limit exceeded: ${target.href}.`
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
url = validateResearchUrl(new URL(response.location, target).href);
|
|
268
|
+
}
|
|
269
|
+
} catch (error) {
|
|
270
|
+
if (options.signal?.aborted) {
|
|
271
|
+
throw options.signal.reason;
|
|
272
|
+
}
|
|
273
|
+
if (error instanceof SourceRetrievalError) {
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
throw new SourceRetrievalError(
|
|
277
|
+
hopSignal?.aborted ? "timeout" : "network_error",
|
|
278
|
+
`Source retrieval failed: ${url.href}.`,
|
|
279
|
+
{ cause: error }
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
213
283
|
|
|
214
284
|
// src/grounding/schema.ts
|
|
215
285
|
import { z } from "zod";
|
|
@@ -423,42 +493,6 @@ var sourceLimits = {
|
|
|
423
493
|
retainedBytes: 16384,
|
|
424
494
|
redirects: 3
|
|
425
495
|
};
|
|
426
|
-
var SourceRetrievalError = class extends Error {
|
|
427
|
-
reason;
|
|
428
|
-
status;
|
|
429
|
-
constructor(reason, message, { status, cause } = {}) {
|
|
430
|
-
super(message, cause === void 0 ? void 0 : { cause });
|
|
431
|
-
this.name = "SourceRetrievalError";
|
|
432
|
-
this.reason = reason;
|
|
433
|
-
this.status = status;
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
var validateResearchUrl = (value) => {
|
|
437
|
-
let url;
|
|
438
|
-
try {
|
|
439
|
-
url = new URL(value);
|
|
440
|
-
} catch {
|
|
441
|
-
throw new SourceRetrievalError(
|
|
442
|
-
"unsafe_destination",
|
|
443
|
-
`Invalid source URL: ${value}.`
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
if (url.protocol !== "https:" || url.username || url.password || url.port || url.hostname === "localhost" || url.hostname.endsWith(".localhost") || url.hostname.endsWith(".local") || url.hostname.endsWith(".internal") || url.hostname === "metadata.google.internal") {
|
|
447
|
-
throw new SourceRetrievalError(
|
|
448
|
-
"unsafe_destination",
|
|
449
|
-
`Source must use public HTTPS with no credentials: ${url.hostname}.`
|
|
450
|
-
);
|
|
451
|
-
}
|
|
452
|
-
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
453
|
-
if (isIP2(host) && !isPublicAddress(host)) {
|
|
454
|
-
throw new SourceRetrievalError(
|
|
455
|
-
"unsafe_destination",
|
|
456
|
-
`Private source destination: ${host}.`
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
url.hash = "";
|
|
460
|
-
return url;
|
|
461
|
-
};
|
|
462
496
|
var canonicalResearchUrl = (value) => {
|
|
463
497
|
const url = new URL(value);
|
|
464
498
|
url.hash = "";
|
|
@@ -468,118 +502,6 @@ var canonicalResearchUrl = (value) => {
|
|
|
468
502
|
}
|
|
469
503
|
return url.href;
|
|
470
504
|
};
|
|
471
|
-
var withAbort = (promise, signal) => {
|
|
472
|
-
signal.throwIfAborted();
|
|
473
|
-
return new Promise((resolve, reject) => {
|
|
474
|
-
const aborted = () => {
|
|
475
|
-
reject(signal.reason);
|
|
476
|
-
};
|
|
477
|
-
signal.addEventListener("abort", aborted, { once: true });
|
|
478
|
-
promise.then(resolve, reject).finally(() => {
|
|
479
|
-
signal.removeEventListener("abort", aborted);
|
|
480
|
-
});
|
|
481
|
-
});
|
|
482
|
-
};
|
|
483
|
-
var requestDocument = async (url, signal) => {
|
|
484
|
-
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
485
|
-
const addresses = await withAbort(lookup2(host, { all: true }), signal);
|
|
486
|
-
if (addresses.length === 0 || addresses.some(({ address }) => !isPublicAddress(address))) {
|
|
487
|
-
throw new SourceRetrievalError(
|
|
488
|
-
"unsafe_destination",
|
|
489
|
-
`Source DNS must resolve exclusively to public addresses: ${host}.`
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
const [firstAddress] = addresses;
|
|
493
|
-
if (!firstAddress) {
|
|
494
|
-
throw new SourceRetrievalError(
|
|
495
|
-
"unsafe_destination",
|
|
496
|
-
`Source DNS returned no address: ${host}.`
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
signal.throwIfAborted();
|
|
500
|
-
return new Promise((resolve, reject) => {
|
|
501
|
-
const req = request(
|
|
502
|
-
url,
|
|
503
|
-
{
|
|
504
|
-
method: "GET",
|
|
505
|
-
signal,
|
|
506
|
-
headers: {
|
|
507
|
-
"accept": "text/html,text/plain",
|
|
508
|
-
"accept-encoding": "identity",
|
|
509
|
-
"user-agent": "Literally-AEO-Research/1"
|
|
510
|
-
},
|
|
511
|
-
lookup: (_host, options, callback) => {
|
|
512
|
-
if (options.all) {
|
|
513
|
-
callback(null, [firstAddress]);
|
|
514
|
-
} else {
|
|
515
|
-
callback(null, firstAddress.address, firstAddress.family);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
},
|
|
519
|
-
(response) => {
|
|
520
|
-
const status = response.statusCode ?? 0;
|
|
521
|
-
const contentType = response.headers["content-type"] ?? "";
|
|
522
|
-
if (status >= 300 && status < 400) {
|
|
523
|
-
response.destroy();
|
|
524
|
-
resolve({
|
|
525
|
-
status,
|
|
526
|
-
location: response.headers.location,
|
|
527
|
-
contentType,
|
|
528
|
-
body: ""
|
|
529
|
-
});
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
if (status < 200 || status >= 300) {
|
|
533
|
-
response.destroy();
|
|
534
|
-
reject(
|
|
535
|
-
new SourceRetrievalError("http_error", `Source HTTP ${status}.`, {
|
|
536
|
-
status
|
|
537
|
-
})
|
|
538
|
-
);
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
if (!/^(text\/html|text\/plain|application\/xhtml\+xml)(;|$)/i.test(
|
|
542
|
-
contentType
|
|
543
|
-
) || response.headers["content-encoding"] && response.headers["content-encoding"] !== "identity") {
|
|
544
|
-
response.destroy();
|
|
545
|
-
reject(
|
|
546
|
-
new SourceRetrievalError(
|
|
547
|
-
"unsupported_content",
|
|
548
|
-
`Unsupported source content: ${contentType}.`
|
|
549
|
-
)
|
|
550
|
-
);
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
const chunks = [];
|
|
554
|
-
let bytes = 0;
|
|
555
|
-
response.on("data", (chunk) => {
|
|
556
|
-
bytes += chunk.length;
|
|
557
|
-
if (bytes > sourceLimits.receivedBytes) {
|
|
558
|
-
response.destroy();
|
|
559
|
-
reject(
|
|
560
|
-
new SourceRetrievalError(
|
|
561
|
-
"too_large",
|
|
562
|
-
`Source response exceeds byte limit: ${bytes} bytes.`
|
|
563
|
-
)
|
|
564
|
-
);
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
chunks.push(chunk);
|
|
568
|
-
});
|
|
569
|
-
response.once("error", reject);
|
|
570
|
-
response.once("end", () => {
|
|
571
|
-
resolve({
|
|
572
|
-
status,
|
|
573
|
-
contentType,
|
|
574
|
-
body: Buffer.concat(chunks).toString("utf8")
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
);
|
|
579
|
-
req.once("error", reject);
|
|
580
|
-
req.end();
|
|
581
|
-
});
|
|
582
|
-
};
|
|
583
505
|
var boundedUtf8 = (text, bytes) => {
|
|
584
506
|
return Buffer.from(text).subarray(0, bytes).toString("utf8").replace(/\uFFFD$/, "");
|
|
585
507
|
};
|
|
@@ -659,56 +581,44 @@ var extractSourceDocument = (args) => {
|
|
|
659
581
|
};
|
|
660
582
|
};
|
|
661
583
|
var fetchGroundingSource = async (args) => {
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
584
|
+
const response = await guardedRequest({
|
|
585
|
+
url: args.url,
|
|
586
|
+
timeoutInMs: sourceLimits.timeoutMs,
|
|
587
|
+
signal: args.signal,
|
|
588
|
+
userAgent: "Literally-AEO-Research/1",
|
|
589
|
+
accept: "text/html,text/plain",
|
|
590
|
+
redirects: sourceLimits.redirects,
|
|
591
|
+
body: {
|
|
592
|
+
contentTypes: /^(text\/html|text\/plain|application\/xhtml\+xml)(;|$)/i,
|
|
593
|
+
maxBytes: sourceLimits.receivedBytes,
|
|
594
|
+
oversize: "refuse"
|
|
595
|
+
},
|
|
596
|
+
pace: async (_url, send2) => {
|
|
669
597
|
await args.beforeRequest?.();
|
|
670
|
-
|
|
671
|
-
const response = await requestDocument(url, signal);
|
|
672
|
-
if (response.status >= 300 && response.status < 400) {
|
|
673
|
-
if (!response.location || redirects === sourceLimits.redirects) {
|
|
674
|
-
throw new SourceRetrievalError(
|
|
675
|
-
"http_error",
|
|
676
|
-
`Source redirect limit exceeded: ${url.href}.`
|
|
677
|
-
);
|
|
678
|
-
}
|
|
679
|
-
url = validateResearchUrl(new URL(response.location, url).href);
|
|
680
|
-
continue;
|
|
681
|
-
}
|
|
682
|
-
return {
|
|
683
|
-
...extractSourceDocument({
|
|
684
|
-
requestedUrl: args.url,
|
|
685
|
-
finalUrl: url.href,
|
|
686
|
-
body: response.body,
|
|
687
|
-
contentType: response.contentType,
|
|
688
|
-
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
689
|
-
firstPartyHosts: args.firstPartyHosts
|
|
690
|
-
}),
|
|
691
|
-
requestCount: redirects + 1,
|
|
692
|
-
bytes: Buffer.byteLength(response.body)
|
|
693
|
-
};
|
|
598
|
+
return send2();
|
|
694
599
|
}
|
|
600
|
+
});
|
|
601
|
+
if (response.status < 200 || response.status >= 300) {
|
|
695
602
|
throw new SourceRetrievalError(
|
|
696
603
|
"http_error",
|
|
697
|
-
`Source
|
|
698
|
-
|
|
699
|
-
} catch (error) {
|
|
700
|
-
if (args.signal?.aborted) {
|
|
701
|
-
throw args.signal.reason;
|
|
702
|
-
}
|
|
703
|
-
if (error instanceof SourceRetrievalError) {
|
|
704
|
-
throw error;
|
|
705
|
-
}
|
|
706
|
-
throw new SourceRetrievalError(
|
|
707
|
-
signal.aborted ? "timeout" : "network_error",
|
|
708
|
-
`Source retrieval failed: ${url.href}.`,
|
|
709
|
-
{ cause: error }
|
|
604
|
+
`Source HTTP ${response.status}.`,
|
|
605
|
+
{ status: response.status }
|
|
710
606
|
);
|
|
711
607
|
}
|
|
608
|
+
const body = response.body?.toString("utf8") ?? "";
|
|
609
|
+
const document = extractSourceDocument({
|
|
610
|
+
requestedUrl: args.url,
|
|
611
|
+
finalUrl: response.url,
|
|
612
|
+
body,
|
|
613
|
+
contentType: response.contentType,
|
|
614
|
+
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
615
|
+
firstPartyHosts: args.firstPartyHosts
|
|
616
|
+
});
|
|
617
|
+
return {
|
|
618
|
+
...document,
|
|
619
|
+
requestCount: response.hops.length,
|
|
620
|
+
bytes: Buffer.byteLength(body)
|
|
621
|
+
};
|
|
712
622
|
};
|
|
713
623
|
|
|
714
624
|
// src/grounding/tools.ts
|
|
@@ -947,6 +857,178 @@ import path2 from "node:path";
|
|
|
947
857
|
import { setTimeout as delay } from "node:timers/promises";
|
|
948
858
|
import { z as z17 } from "zod";
|
|
949
859
|
|
|
860
|
+
// src/grounding/chromium-guard.ts
|
|
861
|
+
import { createServer } from "node:http";
|
|
862
|
+
import { connect } from "node:net";
|
|
863
|
+
var connectTimeoutInMs = 15e3;
|
|
864
|
+
var dialPublicAddress = (address) => {
|
|
865
|
+
return connect({ host: address.address, port: 443, family: address.family });
|
|
866
|
+
};
|
|
867
|
+
var toConnectTarget = (authority) => {
|
|
868
|
+
const separator = authority.lastIndexOf(":");
|
|
869
|
+
if (separator < 0 || authority.slice(separator + 1) !== "443") {
|
|
870
|
+
return void 0;
|
|
871
|
+
}
|
|
872
|
+
try {
|
|
873
|
+
return validateResearchUrl(`https://${authority.slice(0, separator)}/`);
|
|
874
|
+
} catch {
|
|
875
|
+
return void 0;
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
var startGuardingProxy = async (options = {}) => {
|
|
879
|
+
const { lookupHost, dial = dialPublicAddress } = options;
|
|
880
|
+
const counts = { allowed: 0, refused: 0 };
|
|
881
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
882
|
+
const refuse = (client) => {
|
|
883
|
+
counts.refused += 1;
|
|
884
|
+
client.end("HTTP/1.1 403 Forbidden\r\n\r\n");
|
|
885
|
+
};
|
|
886
|
+
const server = createServer((_request, response) => {
|
|
887
|
+
counts.refused += 1;
|
|
888
|
+
response.writeHead(403).end();
|
|
889
|
+
});
|
|
890
|
+
const tunnel = async (authority, client, head) => {
|
|
891
|
+
const target = toConnectTarget(authority);
|
|
892
|
+
if (!target) {
|
|
893
|
+
refuse(client);
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
let address2;
|
|
897
|
+
try {
|
|
898
|
+
address2 = await resolvePublicAddress(
|
|
899
|
+
target.hostname,
|
|
900
|
+
AbortSignal.timeout(connectTimeoutInMs),
|
|
901
|
+
lookupHost
|
|
902
|
+
);
|
|
903
|
+
} catch {
|
|
904
|
+
refuse(client);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
counts.allowed += 1;
|
|
908
|
+
const upstream = dial(address2);
|
|
909
|
+
sockets.add(upstream);
|
|
910
|
+
upstream.setTimeout(connectTimeoutInMs, () => {
|
|
911
|
+
upstream.destroy();
|
|
912
|
+
});
|
|
913
|
+
upstream.once("connect", () => {
|
|
914
|
+
upstream.setTimeout(0);
|
|
915
|
+
client.write("HTTP/1.1 200 Connection Established\r\n\r\n");
|
|
916
|
+
upstream.write(head);
|
|
917
|
+
upstream.pipe(client);
|
|
918
|
+
client.pipe(upstream);
|
|
919
|
+
});
|
|
920
|
+
upstream.once("error", () => {
|
|
921
|
+
client.end("HTTP/1.1 502 Bad Gateway\r\n\r\n");
|
|
922
|
+
});
|
|
923
|
+
upstream.once("close", () => {
|
|
924
|
+
sockets.delete(upstream);
|
|
925
|
+
client.destroy();
|
|
926
|
+
});
|
|
927
|
+
client.once("close", () => {
|
|
928
|
+
upstream.destroy();
|
|
929
|
+
});
|
|
930
|
+
};
|
|
931
|
+
server.on("connection", (socket) => {
|
|
932
|
+
sockets.add(socket);
|
|
933
|
+
socket.once("close", () => {
|
|
934
|
+
sockets.delete(socket);
|
|
935
|
+
});
|
|
936
|
+
});
|
|
937
|
+
server.on("connect", (request2, client, head) => {
|
|
938
|
+
client.on("error", () => {
|
|
939
|
+
client.destroy();
|
|
940
|
+
});
|
|
941
|
+
void tunnel(request2.url ?? "", client, head);
|
|
942
|
+
});
|
|
943
|
+
server.on("upgrade", (_request, client) => {
|
|
944
|
+
refuse(client);
|
|
945
|
+
});
|
|
946
|
+
await new Promise((resolve, reject) => {
|
|
947
|
+
server.once("error", reject);
|
|
948
|
+
server.listen(0, "127.0.0.1", resolve);
|
|
949
|
+
});
|
|
950
|
+
const address = server.address();
|
|
951
|
+
if (address === null || typeof address === "string") {
|
|
952
|
+
throw new Error("The guarding proxy did not bind a TCP port.");
|
|
953
|
+
}
|
|
954
|
+
return {
|
|
955
|
+
server: `http://127.0.0.1:${address.port}`,
|
|
956
|
+
counts: () => ({ ...counts }),
|
|
957
|
+
close: async () => {
|
|
958
|
+
for (const socket of sockets) {
|
|
959
|
+
socket.destroy();
|
|
960
|
+
}
|
|
961
|
+
await new Promise((resolve) => {
|
|
962
|
+
server.close(() => {
|
|
963
|
+
resolve();
|
|
964
|
+
});
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
var chromiumArgs = [
|
|
970
|
+
// Playwright proxies loopback too unless an environment variable turns
|
|
971
|
+
// that off; this flag comes last and keeps it on regardless.
|
|
972
|
+
"--proxy-bypass-list=<-loopback>",
|
|
973
|
+
// QUIC and WebRTC over UDP would leave beside an HTTP proxy.
|
|
974
|
+
"--disable-quic",
|
|
975
|
+
"--force-webrtc-ip-handling-policy=disable_non_proxied_udp"
|
|
976
|
+
];
|
|
977
|
+
var isAllowedRequest = (request2) => {
|
|
978
|
+
const url = new URL(request2.url());
|
|
979
|
+
return url.protocol === "https:" && url.port === "" && request2.resourceType() !== "media";
|
|
980
|
+
};
|
|
981
|
+
var withBoundedPage = async (context, deadlineInMs, use) => {
|
|
982
|
+
const page = await context.newPage();
|
|
983
|
+
const deadline = AbortSignal.timeout(deadlineInMs);
|
|
984
|
+
const closePage = () => {
|
|
985
|
+
void page.close().catch(() => void 0);
|
|
986
|
+
};
|
|
987
|
+
deadline.addEventListener("abort", closePage, { once: true });
|
|
988
|
+
try {
|
|
989
|
+
return await use(page);
|
|
990
|
+
} catch (error) {
|
|
991
|
+
if (deadline.aborted) {
|
|
992
|
+
throw new Error(
|
|
993
|
+
`The page did not finish rendering within ${deadlineInMs / 1e3} s.`,
|
|
994
|
+
{ cause: error }
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
throw error;
|
|
998
|
+
} finally {
|
|
999
|
+
deadline.removeEventListener("abort", closePage);
|
|
1000
|
+
await page.close();
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
var withGuardedChromium = async (use, options = {}) => {
|
|
1004
|
+
const proxy = await startGuardingProxy(options.proxy);
|
|
1005
|
+
try {
|
|
1006
|
+
const { chromium } = await import("playwright");
|
|
1007
|
+
const browser = await chromium.launch({
|
|
1008
|
+
proxy: { server: proxy.server },
|
|
1009
|
+
args: chromiumArgs
|
|
1010
|
+
});
|
|
1011
|
+
try {
|
|
1012
|
+
const context = await browser.newContext({
|
|
1013
|
+
acceptDownloads: false,
|
|
1014
|
+
serviceWorkers: "block",
|
|
1015
|
+
...options.userAgent !== void 0 && {
|
|
1016
|
+
userAgent: options.userAgent
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
await context.route("**/*", (route) => {
|
|
1020
|
+
return isAllowedRequest(route.request()) ? route.continue() : route.abort();
|
|
1021
|
+
});
|
|
1022
|
+
const result = await use(context);
|
|
1023
|
+
return { result, connections: proxy.counts() };
|
|
1024
|
+
} finally {
|
|
1025
|
+
await browser.close();
|
|
1026
|
+
}
|
|
1027
|
+
} finally {
|
|
1028
|
+
await proxy.close();
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
|
|
950
1032
|
// src/codex-workflow/pending.ts
|
|
951
1033
|
import { randomUUID } from "node:crypto";
|
|
952
1034
|
import { mkdir, rename, rm, writeFile } from "node:fs/promises";
|
|
@@ -1435,6 +1517,10 @@ var aeoTechnicalChecksSchema = z6.object({
|
|
|
1435
1517
|
robotsUrl: z6.string(),
|
|
1436
1518
|
fetchedAt: z6.string(),
|
|
1437
1519
|
robotsFetchError: z6.string().nullable(),
|
|
1520
|
+
// True when robots.txt ran past the 500 KiB RFC 9309 asks a reader to
|
|
1521
|
+
// parse: the verdicts rest on that prefix. Absent on snapshots written
|
|
1522
|
+
// before the bound existed.
|
|
1523
|
+
robotsTruncated: z6.boolean().optional(),
|
|
1438
1524
|
bots: z6.array(
|
|
1439
1525
|
z6.object({
|
|
1440
1526
|
bot: z6.string(),
|
|
@@ -1584,60 +1670,34 @@ var coverageThresholdsSchema = z7.object({
|
|
|
1584
1670
|
|
|
1585
1671
|
// src/models/profiles.ts
|
|
1586
1672
|
import { z as z8 } from "zod";
|
|
1587
|
-
var internalModelProfileIdSchema = z8.
|
|
1588
|
-
"opus-grounding-v1",
|
|
1589
|
-
"astra-grounding-v1",
|
|
1590
|
-
"opus-harness-v1",
|
|
1591
|
-
"astra-harness-v1",
|
|
1592
|
-
// GLM 5.3 through the gateway for every text role, domain classification
|
|
1593
|
-
// included, and Kimi K3 for logo discovery. An evaluation profile, not
|
|
1594
|
-
// the default.
|
|
1595
|
-
"glm-harness-v1",
|
|
1596
|
-
// DeepSeek V4.1 Flash through the gateway for every text role, Kimi K3
|
|
1597
|
-
// for logo discovery. The profile every admission pins (codexRunnerProfile).
|
|
1598
|
-
"deepseek-harness-v1",
|
|
1599
|
-
// The same bulk roles on DeepSeek, with the premise verifier on Opus:
|
|
1600
|
-
// schema compliance and reasoning quality where a refused verdict costs a
|
|
1601
|
-
// copy generation (2026-09-12).
|
|
1602
|
-
"deepseek-harness-v2"
|
|
1603
|
-
]);
|
|
1673
|
+
var internalModelProfileIdSchema = z8.string().min(1);
|
|
1604
1674
|
var generationBackendSchema = z8.enum([
|
|
1605
1675
|
"claude_code",
|
|
1606
1676
|
"codex",
|
|
1607
1677
|
"gateway"
|
|
1608
1678
|
]);
|
|
1679
|
+
var modelPricingSchema = z8.object({
|
|
1680
|
+
input: z8.number().positive(),
|
|
1681
|
+
output: z8.number().positive(),
|
|
1682
|
+
cachedInput: z8.number().nonnegative()
|
|
1683
|
+
}).strict();
|
|
1609
1684
|
var internalModelRoleSchema = z8.object({
|
|
1610
|
-
model
|
|
1611
|
-
|
|
1612
|
-
"openai/gpt-6-astra",
|
|
1613
|
-
"zai/glm-5.3",
|
|
1614
|
-
"moonshotai/kimi-k3",
|
|
1615
|
-
"deepseek/deepseek-v4.1-flash",
|
|
1616
|
-
"anthropic/claude-opus-5"
|
|
1617
|
-
]),
|
|
1685
|
+
/** The gateway model ID, such as `anthropic/claude-opus-5.5`. */
|
|
1686
|
+
model: z8.string().min(1),
|
|
1618
1687
|
providerOptions: z8.object({
|
|
1619
1688
|
openai: z8.object({ reasoningEffort: z8.literal("high") }).strict().optional(),
|
|
1620
|
-
/** Ask
|
|
1621
|
-
*
|
|
1622
|
-
* keeps a long generation inside the gateway's limits. A token
|
|
1623
|
-
* budget is deliberately NOT sent: GLM ignores it (measured). */
|
|
1689
|
+
/** Ask a reasoning model to think hard. A token budget is not
|
|
1690
|
+
* sent: not every provider honours one. */
|
|
1624
1691
|
gateway: z8.object({
|
|
1625
1692
|
reasoning: z8.union([
|
|
1626
1693
|
z8.object({ effort: z8.literal("high") }).strict(),
|
|
1627
|
-
/**
|
|
1628
|
-
*
|
|
1629
|
-
* a stored profile must keep parsing and dispatching exactly as
|
|
1630
|
-
* admitted. */
|
|
1694
|
+
/** Accepted so that a stored profile keeps parsing and
|
|
1695
|
+
* dispatching exactly as admitted; never built any more. */
|
|
1631
1696
|
z8.object({ max_tokens: z8.number().int().positive() }).strict()
|
|
1632
1697
|
]),
|
|
1633
|
-
/** The gateway
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
1636
|
-
* for GLM 5.3 dropped the schema and every structured call
|
|
1637
|
-
* failed as `StructuredOutputMissingError`, while `baseten`
|
|
1638
|
-
* and `fireworks` answered in a second. The pinned routes are
|
|
1639
|
-
* the ones probed to return objects; the gateway still balances
|
|
1640
|
-
* among them. Absent on profiles pinned before the routing pin. */
|
|
1698
|
+
/** The gateway upstream routes a role is restricted to, when
|
|
1699
|
+
* not every route of an open-weight model returns structured
|
|
1700
|
+
* output. Absent leaves routing to the gateway. */
|
|
1641
1701
|
only: z8.array(z8.string().min(1)).min(1).max(12).optional()
|
|
1642
1702
|
}).strict().optional()
|
|
1643
1703
|
}).strict(),
|
|
@@ -1646,15 +1706,19 @@ var internalModelRoleSchema = z8.object({
|
|
|
1646
1706
|
deadlineMs: z8.number().int().positive(),
|
|
1647
1707
|
maxInputTokens: z8.number().int().positive().max(1e5),
|
|
1648
1708
|
maxOutputTokens: z8.number().int().positive(),
|
|
1649
|
-
/** How many items one batched call may carry, when the
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1709
|
+
/** How many items one batched call may carry, when the model wants a
|
|
1710
|
+
* narrower batch than the call site's own default. Absent leaves that
|
|
1711
|
+
* default. */
|
|
1652
1712
|
maxItemsPerCall: z8.number().int().positive().optional(),
|
|
1653
|
-
pricingUsdPerMillion:
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1713
|
+
pricingUsdPerMillion: modelPricingSchema
|
|
1714
|
+
}).strict();
|
|
1715
|
+
var codexStageModelSchema = z8.object({
|
|
1716
|
+
model: z8.string().min(1),
|
|
1717
|
+
reasoningEffort: z8.enum(["medium", "high", "xhigh"]),
|
|
1718
|
+
/** The context window Codex must be told: it has no metadata for
|
|
1719
|
+
* gateway models and otherwise compacts a session at its own default. */
|
|
1720
|
+
contextWindow: z8.number().int().positive(),
|
|
1721
|
+
pricingUsdPerMillion: modelPricingSchema
|
|
1658
1722
|
}).strict();
|
|
1659
1723
|
var researchSearchProviderSchema = z8.enum([
|
|
1660
1724
|
"disabled",
|
|
@@ -1677,25 +1741,16 @@ var internalModelProfileSchema = z8.object({
|
|
|
1677
1741
|
// Missing on stored profiles: optional enrichment never rewrites pins.
|
|
1678
1742
|
logoDiscovery: internalModelRoleSchema.optional(),
|
|
1679
1743
|
competitorClassifier: internalModelRoleSchema.optional(),
|
|
1680
|
-
/** Retired roles, still accepted so profiles
|
|
1681
|
-
*
|
|
1682
|
-
* the model-backed visual review (11 September 2026), the scrutiny
|
|
1683
|
-
* and repair-planner roles with the journaled harness loop
|
|
1684
|
-
* (13 September 2026). No new profile resolves them. */
|
|
1744
|
+
/** Retired roles, still accepted so stored profiles parse unchanged
|
|
1745
|
+
* on resume. No new profile resolves them. */
|
|
1685
1746
|
scrutiny: internalModelRoleSchema.optional(),
|
|
1686
1747
|
repairPlanner: internalModelRoleSchema.optional(),
|
|
1687
1748
|
visualReviewer: internalModelRoleSchema.optional()
|
|
1688
|
-
}).strict()
|
|
1749
|
+
}).strict(),
|
|
1750
|
+
/** The Codex stages' model. Absent on profiles pinned before the stage
|
|
1751
|
+
* model became part of the profile; their host supplies it. */
|
|
1752
|
+
stages: codexStageModelSchema.optional()
|
|
1689
1753
|
}).strict();
|
|
1690
|
-
var reasoningOutputFamilies = [
|
|
1691
|
-
"glm",
|
|
1692
|
-
"kimi",
|
|
1693
|
-
"deepseek"
|
|
1694
|
-
];
|
|
1695
|
-
var thinkingInOutputFamilies = [
|
|
1696
|
-
...reasoningOutputFamilies,
|
|
1697
|
-
"opus5"
|
|
1698
|
-
];
|
|
1699
1754
|
|
|
1700
1755
|
// src/models/accounting.ts
|
|
1701
1756
|
import { z as z9 } from "zod";
|
|
@@ -1830,7 +1885,6 @@ var clientReportBundleSchema = z11.discriminatedUnion("state", [
|
|
|
1830
1885
|
|
|
1831
1886
|
// src/access/schema.ts
|
|
1832
1887
|
import { z as z12 } from "zod";
|
|
1833
|
-
init_errors();
|
|
1834
1888
|
var identity = z12.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/);
|
|
1835
1889
|
var reportAudienceSchema = z12.enum([
|
|
1836
1890
|
"client_private",
|
|
@@ -1992,14 +2046,17 @@ var aeoSectionConfigSchema = z14.object({
|
|
|
1992
2046
|
// markets. Omitted → the report-level set (the union shown on the page).
|
|
1993
2047
|
competitors: z14.array(brandSchema).optional()
|
|
1994
2048
|
});
|
|
2049
|
+
var maxRunsPerPrompt = 25;
|
|
2050
|
+
var runsPerPromptSchema = z14.number().int().min(1).max(maxRunsPerPrompt);
|
|
1995
2051
|
var agentProbeConfigSchema = z14.object({
|
|
1996
2052
|
// Runs per prompt per agent surface.
|
|
1997
|
-
runsPerPrompt:
|
|
2053
|
+
runsPerPrompt: runsPerPromptSchema.default(2),
|
|
1998
2054
|
// Cap on how many of each section's prompts get agent probes — the FIRST N
|
|
1999
2055
|
// prompts in config order, so the subset is stable across runs. Omitted =
|
|
2000
2056
|
// all prompts.
|
|
2001
2057
|
maxPromptsPerSection: z14.number().int().min(1).optional()
|
|
2002
2058
|
});
|
|
2059
|
+
var chatProbeConfigSchema = z14.object({ runsPerPrompt: runsPerPromptSchema }).strict();
|
|
2003
2060
|
var ownedCompetitorDomainSchema = z14.string().trim().regex(
|
|
2004
2061
|
/^(?=.{1,253}$)(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.?$/,
|
|
2005
2062
|
"Expected a domain name without a URL, path or port"
|
|
@@ -2022,6 +2079,9 @@ var aeoAuditConfigSchema = z14.object({
|
|
|
2022
2079
|
// the schema — consumers read config.agentProbes directly, no fallbacks.
|
|
2023
2080
|
// prefault({}) runs {} through the inner schema so its own defaults fill.
|
|
2024
2081
|
agentProbes: agentProbeConfigSchema.prefault({}),
|
|
2082
|
+
// Read through runsPerPromptOn or chatRunsPerPrompt, which own the
|
|
2083
|
+
// fallback to the canonical counts.
|
|
2084
|
+
chatProbes: chatProbeConfigSchema.optional(),
|
|
2025
2085
|
// Renderability targets — docs, pricing, comparison pages (§7.4).
|
|
2026
2086
|
moneyPages: z14.array(z14.string().url()),
|
|
2027
2087
|
// Grounds accuracy flagging (§7.2): claims contradicting this brief are
|
|
@@ -2097,8 +2157,14 @@ var authorOutputSchema = aeoAuditConfigSchema.omit({
|
|
|
2097
2157
|
agentReadiness: true,
|
|
2098
2158
|
sourceOverrides: true,
|
|
2099
2159
|
productGrounding: true,
|
|
2100
|
-
competitorQualification: true
|
|
2160
|
+
competitorQualification: true,
|
|
2161
|
+
// Depth decides what a run costs, so the operator sets it in audit.json
|
|
2162
|
+
// with the estimate in front of them, never the author.
|
|
2163
|
+
chatProbes: true
|
|
2101
2164
|
}).extend({
|
|
2165
|
+
// The agent batch the author could always propose: 1 or 2 runs per
|
|
2166
|
+
// prompt. A deeper one is the operator's call, as chat depth is.
|
|
2167
|
+
agentProbes: agentProbeConfigSchema.extend({ runsPerPrompt: z15.number().int().min(1).max(2).default(2) }).prefault({}),
|
|
2102
2168
|
sections: z15.array(
|
|
2103
2169
|
aeoSectionConfigSchema.extend({
|
|
2104
2170
|
key: z15.string().regex(
|
|
@@ -2856,43 +2922,28 @@ var createAuthorTools = (options) => {
|
|
|
2856
2922
|
};
|
|
2857
2923
|
};
|
|
2858
2924
|
var renderWithChromium = async (url, signal) => {
|
|
2859
|
-
|
|
2860
|
-
const {
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
return route.continue();
|
|
2882
|
-
});
|
|
2883
|
-
const abort = () => {
|
|
2884
|
-
void page.close().catch(() => void 0);
|
|
2885
|
-
};
|
|
2886
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
2887
|
-
try {
|
|
2888
|
-
await page.goto(url.href, { waitUntil: "networkidle", timeout: 45e3 });
|
|
2889
|
-
return await page.content();
|
|
2890
|
-
} finally {
|
|
2891
|
-
signal.removeEventListener("abort", abort);
|
|
2892
|
-
}
|
|
2893
|
-
} finally {
|
|
2894
|
-
await browser.close();
|
|
2895
|
-
}
|
|
2925
|
+
await resolvePublicAddress(url.hostname, signal);
|
|
2926
|
+
const { result } = await withGuardedChromium(
|
|
2927
|
+
(context) => {
|
|
2928
|
+
return withBoundedPage(context, 6e4, async (page) => {
|
|
2929
|
+
const abort = () => {
|
|
2930
|
+
void page.close().catch(() => void 0);
|
|
2931
|
+
};
|
|
2932
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
2933
|
+
try {
|
|
2934
|
+
await page.goto(url.href, {
|
|
2935
|
+
waitUntil: "networkidle",
|
|
2936
|
+
timeout: 45e3
|
|
2937
|
+
});
|
|
2938
|
+
return await page.content();
|
|
2939
|
+
} finally {
|
|
2940
|
+
signal.removeEventListener("abort", abort);
|
|
2941
|
+
}
|
|
2942
|
+
});
|
|
2943
|
+
},
|
|
2944
|
+
{ userAgent: `${researchUserAgent}/1` }
|
|
2945
|
+
);
|
|
2946
|
+
return result;
|
|
2896
2947
|
};
|
|
2897
2948
|
|
|
2898
2949
|
// src/codex-workflow/author-tools-server.ts
|