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
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeFileAtomically
|
|
3
|
-
} from "./chunk-MX6Y4RD2.js";
|
|
4
|
-
import {
|
|
5
|
-
hasErrorCode
|
|
6
|
-
} from "./chunk-2QLAFBCG.js";
|
|
7
|
-
|
|
8
|
-
// src/engine/budget.ts
|
|
9
|
-
import { readFile } from "node:fs/promises";
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
var budgetFile = "BUDGET.json";
|
|
13
|
-
var budgetPolicySchema = z.object({
|
|
14
|
-
maxUsd: z.number().finite().positive().default(10),
|
|
15
|
-
maxTokens: z.number().int().positive().default(5e6),
|
|
16
|
-
maxHours: z.number().finite().positive().max(72).default(6)
|
|
17
|
-
}).strict();
|
|
18
|
-
var budgetAmendmentSchema = budgetPolicySchema.partial().strict();
|
|
19
|
-
var budgetStateSchema = z.object({
|
|
20
|
-
version: z.literal(1),
|
|
21
|
-
original: budgetPolicySchema,
|
|
22
|
-
current: budgetPolicySchema,
|
|
23
|
-
deadlineAt: z.iso.datetime(),
|
|
24
|
-
amendments: z.array(
|
|
25
|
-
z.object({
|
|
26
|
-
at: z.iso.datetime(),
|
|
27
|
-
from: budgetPolicySchema,
|
|
28
|
-
to: budgetPolicySchema,
|
|
29
|
-
deadlineFrom: z.iso.datetime(),
|
|
30
|
-
deadlineTo: z.iso.datetime()
|
|
31
|
-
}).strict()
|
|
32
|
-
)
|
|
33
|
-
}).strict();
|
|
34
|
-
var hoursFrom = (now, hours) => {
|
|
35
|
-
return new Date(now.getTime() + hours * 36e5).toISOString();
|
|
36
|
-
};
|
|
37
|
-
var readBudgetAmendment = async (file) => {
|
|
38
|
-
const text = await readFile(file, "utf8").catch((err) => {
|
|
39
|
-
throw new Error(`Please check --budget-file: ${file} cannot be read.`, {
|
|
40
|
-
cause: err
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
return budgetAmendmentSchema.parse(JSON.parse(text));
|
|
44
|
-
};
|
|
45
|
-
var resolveRunBudget = async (dir, policy, {
|
|
46
|
-
amendment,
|
|
47
|
-
now = () => /* @__PURE__ */ new Date()
|
|
48
|
-
} = {}) => {
|
|
49
|
-
const file = path.join(dir, budgetFile);
|
|
50
|
-
const text = await readFile(file, "utf8").catch((err) => {
|
|
51
|
-
if (hasErrorCode(err, "ENOENT")) {
|
|
52
|
-
return void 0;
|
|
53
|
-
}
|
|
54
|
-
throw err;
|
|
55
|
-
});
|
|
56
|
-
const existing = text === void 0 ? void 0 : budgetStateSchema.parse(JSON.parse(text));
|
|
57
|
-
const at = now();
|
|
58
|
-
let state = existing ?? {
|
|
59
|
-
version: 1,
|
|
60
|
-
original: policy,
|
|
61
|
-
current: policy,
|
|
62
|
-
deadlineAt: hoursFrom(at, policy.maxHours),
|
|
63
|
-
amendments: []
|
|
64
|
-
};
|
|
65
|
-
let amended;
|
|
66
|
-
if (amendment && Object.keys(amendment).length > 0) {
|
|
67
|
-
const to = { ...state.current, ...amendment };
|
|
68
|
-
if (to.maxUsd < state.current.maxUsd || to.maxTokens < state.current.maxTokens) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
`A --budget-file can only raise limits; this run already allows $${state.current.maxUsd} and ${state.current.maxTokens} tokens.`
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
const deadlineTo = amendment.maxHours === void 0 ? state.deadlineAt : hoursFrom(at, amendment.maxHours);
|
|
74
|
-
amended = {
|
|
75
|
-
at: at.toISOString(),
|
|
76
|
-
from: state.current,
|
|
77
|
-
to,
|
|
78
|
-
deadlineFrom: state.deadlineAt,
|
|
79
|
-
deadlineTo
|
|
80
|
-
};
|
|
81
|
-
state = {
|
|
82
|
-
...state,
|
|
83
|
-
current: to,
|
|
84
|
-
deadlineAt: deadlineTo,
|
|
85
|
-
amendments: [...state.amendments, amended]
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (!existing || amended) {
|
|
89
|
-
await writeFileAtomically(file, JSON.stringify(state, null, 2));
|
|
90
|
-
}
|
|
91
|
-
const budget = {
|
|
92
|
-
limits: {
|
|
93
|
-
maxUsd: state.current.maxUsd,
|
|
94
|
-
maxTokens: state.current.maxTokens,
|
|
95
|
-
deadlineAt: state.deadlineAt
|
|
96
|
-
},
|
|
97
|
-
policy: state.current,
|
|
98
|
-
amended,
|
|
99
|
-
policyDiffers: JSON.stringify(policy) !== JSON.stringify(state.original)
|
|
100
|
-
};
|
|
101
|
-
return budget;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export {
|
|
105
|
-
budgetFile,
|
|
106
|
-
budgetPolicySchema,
|
|
107
|
-
budgetAmendmentSchema,
|
|
108
|
-
readBudgetAmendment,
|
|
109
|
-
resolveRunBudget
|
|
110
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
codexRunnerProfile,
|
|
3
|
-
configuredModelProfileId,
|
|
4
|
-
resolveInternalModelProfile
|
|
5
|
-
} from "./chunk-CFFPOTP4.js";
|
|
6
|
-
import {
|
|
7
|
-
createMemoryModelAccounting
|
|
8
|
-
} from "./chunk-TNL2GWYR.js";
|
|
9
|
-
|
|
10
|
-
// src/codex-workflow/host-models.ts
|
|
11
|
-
var hostStepMaxUsd = 5;
|
|
12
|
-
var copyVerifierProfile = codexRunnerProfile;
|
|
13
|
-
var hostModels = (profileId = configuredModelProfileId()) => {
|
|
14
|
-
return {
|
|
15
|
-
profile: resolveInternalModelProfile(profileId),
|
|
16
|
-
accounting: createMemoryModelAccounting({
|
|
17
|
-
maxUsd: hostStepMaxUsd,
|
|
18
|
-
maxTokens: 5e6,
|
|
19
|
-
deadlineAt: new Date(Date.now() + 30 * 6e4).toISOString()
|
|
20
|
-
})
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
hostStepMaxUsd,
|
|
26
|
-
copyVerifierProfile,
|
|
27
|
-
hostModels
|
|
28
|
-
};
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isPublicAddress
|
|
3
|
-
} from "./chunk-NL2LDKXX.js";
|
|
4
|
-
import {
|
|
5
|
-
contentHash
|
|
6
|
-
} from "./chunk-H2KDLDK6.js";
|
|
7
|
-
import {
|
|
8
|
-
sourceExtractionVersion
|
|
9
|
-
} from "./chunk-6RAKXYSR.js";
|
|
10
|
-
|
|
11
|
-
// src/grounding/fetch.ts
|
|
12
|
-
import { lookup } from "node:dns/promises";
|
|
13
|
-
import { isIP } from "node:net";
|
|
14
|
-
import { request } from "node:https";
|
|
15
|
-
import { load } from "cheerio";
|
|
16
|
-
var sourceLimits = {
|
|
17
|
-
timeoutMs: 15e3,
|
|
18
|
-
receivedBytes: 2097152,
|
|
19
|
-
retainedBytes: 16384,
|
|
20
|
-
redirects: 3
|
|
21
|
-
};
|
|
22
|
-
var SourceRetrievalError = class extends Error {
|
|
23
|
-
reason;
|
|
24
|
-
status;
|
|
25
|
-
constructor(reason, message, { status, cause } = {}) {
|
|
26
|
-
super(message, cause === void 0 ? void 0 : { cause });
|
|
27
|
-
this.name = "SourceRetrievalError";
|
|
28
|
-
this.reason = reason;
|
|
29
|
-
this.status = status;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
var validateResearchUrl = (value) => {
|
|
33
|
-
let url;
|
|
34
|
-
try {
|
|
35
|
-
url = new URL(value);
|
|
36
|
-
} catch {
|
|
37
|
-
throw new SourceRetrievalError(
|
|
38
|
-
"unsafe_destination",
|
|
39
|
-
`Invalid source URL: ${value}.`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
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") {
|
|
43
|
-
throw new SourceRetrievalError(
|
|
44
|
-
"unsafe_destination",
|
|
45
|
-
`Source must use public HTTPS with no credentials: ${url.hostname}.`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
49
|
-
if (isIP(host) && !isPublicAddress(host)) {
|
|
50
|
-
throw new SourceRetrievalError(
|
|
51
|
-
"unsafe_destination",
|
|
52
|
-
`Private source destination: ${host}.`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
url.hash = "";
|
|
56
|
-
return url;
|
|
57
|
-
};
|
|
58
|
-
var canonicalResearchUrl = (value) => {
|
|
59
|
-
const url = new URL(value);
|
|
60
|
-
url.hash = "";
|
|
61
|
-
url.hostname = url.hostname.toLowerCase();
|
|
62
|
-
if (url.pathname.length > 1 && url.pathname.endsWith("/")) {
|
|
63
|
-
url.pathname = url.pathname.slice(0, -1);
|
|
64
|
-
}
|
|
65
|
-
return url.href;
|
|
66
|
-
};
|
|
67
|
-
var withAbort = (promise, signal) => {
|
|
68
|
-
signal.throwIfAborted();
|
|
69
|
-
return new Promise((resolve, reject) => {
|
|
70
|
-
const aborted = () => {
|
|
71
|
-
reject(signal.reason);
|
|
72
|
-
};
|
|
73
|
-
signal.addEventListener("abort", aborted, { once: true });
|
|
74
|
-
promise.then(resolve, reject).finally(() => {
|
|
75
|
-
signal.removeEventListener("abort", aborted);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
var requestDocument = async (url, signal) => {
|
|
80
|
-
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
81
|
-
const addresses = await withAbort(lookup(host, { all: true }), signal);
|
|
82
|
-
if (addresses.length === 0 || addresses.some(({ address }) => !isPublicAddress(address))) {
|
|
83
|
-
throw new SourceRetrievalError(
|
|
84
|
-
"unsafe_destination",
|
|
85
|
-
`Source DNS must resolve exclusively to public addresses: ${host}.`
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
const [firstAddress] = addresses;
|
|
89
|
-
if (!firstAddress) {
|
|
90
|
-
throw new SourceRetrievalError(
|
|
91
|
-
"unsafe_destination",
|
|
92
|
-
`Source DNS returned no address: ${host}.`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
signal.throwIfAborted();
|
|
96
|
-
return new Promise((resolve, reject) => {
|
|
97
|
-
const req = request(
|
|
98
|
-
url,
|
|
99
|
-
{
|
|
100
|
-
method: "GET",
|
|
101
|
-
signal,
|
|
102
|
-
headers: {
|
|
103
|
-
"accept": "text/html,text/plain",
|
|
104
|
-
"accept-encoding": "identity",
|
|
105
|
-
"user-agent": "Literally-AEO-Research/1"
|
|
106
|
-
},
|
|
107
|
-
lookup: (_host, options, callback) => {
|
|
108
|
-
if (options.all) {
|
|
109
|
-
callback(null, [firstAddress]);
|
|
110
|
-
} else {
|
|
111
|
-
callback(null, firstAddress.address, firstAddress.family);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
(response) => {
|
|
116
|
-
const status = response.statusCode ?? 0;
|
|
117
|
-
const contentType = response.headers["content-type"] ?? "";
|
|
118
|
-
if (status >= 300 && status < 400) {
|
|
119
|
-
response.destroy();
|
|
120
|
-
resolve({
|
|
121
|
-
status,
|
|
122
|
-
location: response.headers.location,
|
|
123
|
-
contentType,
|
|
124
|
-
body: ""
|
|
125
|
-
});
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (status < 200 || status >= 300) {
|
|
129
|
-
response.destroy();
|
|
130
|
-
reject(
|
|
131
|
-
new SourceRetrievalError("http_error", `Source HTTP ${status}.`, {
|
|
132
|
-
status
|
|
133
|
-
})
|
|
134
|
-
);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (!/^(text\/html|text\/plain|application\/xhtml\+xml)(;|$)/i.test(
|
|
138
|
-
contentType
|
|
139
|
-
) || response.headers["content-encoding"] && response.headers["content-encoding"] !== "identity") {
|
|
140
|
-
response.destroy();
|
|
141
|
-
reject(
|
|
142
|
-
new SourceRetrievalError(
|
|
143
|
-
"unsupported_content",
|
|
144
|
-
`Unsupported source content: ${contentType}.`
|
|
145
|
-
)
|
|
146
|
-
);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const chunks = [];
|
|
150
|
-
let bytes = 0;
|
|
151
|
-
response.on("data", (chunk) => {
|
|
152
|
-
bytes += chunk.length;
|
|
153
|
-
if (bytes > sourceLimits.receivedBytes) {
|
|
154
|
-
response.destroy();
|
|
155
|
-
reject(
|
|
156
|
-
new SourceRetrievalError(
|
|
157
|
-
"too_large",
|
|
158
|
-
`Source response exceeds byte limit: ${bytes} bytes.`
|
|
159
|
-
)
|
|
160
|
-
);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
chunks.push(chunk);
|
|
164
|
-
});
|
|
165
|
-
response.once("error", reject);
|
|
166
|
-
response.once("end", () => {
|
|
167
|
-
resolve({
|
|
168
|
-
status,
|
|
169
|
-
contentType,
|
|
170
|
-
body: Buffer.concat(chunks).toString("utf8")
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
req.once("error", reject);
|
|
176
|
-
req.end();
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
var boundedUtf8 = (text, bytes) => {
|
|
180
|
-
return Buffer.from(text).subarray(0, bytes).toString("utf8").replace(/\uFFFD$/, "");
|
|
181
|
-
};
|
|
182
|
-
var extractSourceDocument = (args) => {
|
|
183
|
-
const final = validateResearchUrl(args.finalUrl);
|
|
184
|
-
validateResearchUrl(args.requestedUrl);
|
|
185
|
-
if (Buffer.byteLength(args.body) > sourceLimits.receivedBytes) {
|
|
186
|
-
throw new SourceRetrievalError(
|
|
187
|
-
"too_large",
|
|
188
|
-
`Source response exceeds byte limit: ${Buffer.byteLength(args.body)} bytes.`
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
let text;
|
|
192
|
-
let title = "";
|
|
193
|
-
let sourceDate = null;
|
|
194
|
-
const links = [];
|
|
195
|
-
if (/html/i.test(args.contentType)) {
|
|
196
|
-
const $ = load(args.body);
|
|
197
|
-
title = $("title").first().text().trim().slice(0, 500);
|
|
198
|
-
const declaredDate = $('meta[property="article:published_time"]').attr("content") ?? $('meta[name="date"]').attr("content");
|
|
199
|
-
if (declaredDate && /^\d{4}-\d{2}-\d{2}(?:T|$)/.test(declaredDate) && Number.isFinite(Date.parse(declaredDate))) {
|
|
200
|
-
sourceDate = new Date(declaredDate).toISOString();
|
|
201
|
-
}
|
|
202
|
-
$(
|
|
203
|
-
"script,style,noscript,iframe,object,embed,svg,form,input,button,nav,footer,header"
|
|
204
|
-
).remove();
|
|
205
|
-
$("a[href]").each((_index, element) => {
|
|
206
|
-
const href = $(element).attr("href");
|
|
207
|
-
if (links.length >= 100 || href === void 0) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
try {
|
|
211
|
-
const url = validateResearchUrl(new URL(href, final).href).href;
|
|
212
|
-
if (!links.includes(url)) {
|
|
213
|
-
links.push(url);
|
|
214
|
-
}
|
|
215
|
-
} catch {
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
$("p,div,li,h1,h2,h3,h4,section,article,br,tr").append("\n");
|
|
219
|
-
text = ($("main").length ? $("main").text() : $("body").text()).replace(/[\t\r ]+/g, " ").replace(/\n\s*\n+/g, "\n\n").trim();
|
|
220
|
-
} else {
|
|
221
|
-
text = args.body.replace(/\r\n/g, "\n").trim();
|
|
222
|
-
}
|
|
223
|
-
if (!text) {
|
|
224
|
-
throw new SourceRetrievalError(
|
|
225
|
-
"empty_content",
|
|
226
|
-
`No readable source text: ${final.href}.`
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
const documentDigest = contentHash(text);
|
|
230
|
-
const retained = boundedUtf8(text, sourceLimits.retainedBytes);
|
|
231
|
-
const id = `src_${contentHash({ url: final.href, documentDigest }).slice(0, 32)}`;
|
|
232
|
-
const passages = [
|
|
233
|
-
{ id: `${id}_p0`, text: retained, digest: contentHash(retained) }
|
|
234
|
-
];
|
|
235
|
-
return {
|
|
236
|
-
source: {
|
|
237
|
-
id,
|
|
238
|
-
requestedUrl: args.requestedUrl,
|
|
239
|
-
finalUrl: final.href,
|
|
240
|
-
title,
|
|
241
|
-
publisher: final.hostname,
|
|
242
|
-
provenance: args.firstPartyHosts?.includes(final.hostname) ? "first_party" : "unknown",
|
|
243
|
-
fetchedAt: args.fetchedAt,
|
|
244
|
-
sourceDate,
|
|
245
|
-
documentDigest,
|
|
246
|
-
retainedDigest: contentHash(passages.map((passage) => passage.text)),
|
|
247
|
-
passages,
|
|
248
|
-
extractionVersion: sourceExtractionVersion,
|
|
249
|
-
truncated: retained !== text
|
|
250
|
-
},
|
|
251
|
-
links,
|
|
252
|
-
// The whole extracted text, for a reader that keeps more than the
|
|
253
|
-
// grounding passage (the author's research tools keep 32 KB).
|
|
254
|
-
text
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
var fetchGroundingSource = async (args) => {
|
|
258
|
-
const signal = AbortSignal.any([
|
|
259
|
-
AbortSignal.timeout(sourceLimits.timeoutMs),
|
|
260
|
-
...args.signal ? [args.signal] : []
|
|
261
|
-
]);
|
|
262
|
-
let url = validateResearchUrl(args.url);
|
|
263
|
-
try {
|
|
264
|
-
for (let redirects = 0; redirects <= sourceLimits.redirects; redirects += 1) {
|
|
265
|
-
await args.beforeRequest?.();
|
|
266
|
-
signal.throwIfAborted();
|
|
267
|
-
const response = await requestDocument(url, signal);
|
|
268
|
-
if (response.status >= 300 && response.status < 400) {
|
|
269
|
-
if (!response.location || redirects === sourceLimits.redirects) {
|
|
270
|
-
throw new SourceRetrievalError(
|
|
271
|
-
"http_error",
|
|
272
|
-
`Source redirect limit exceeded: ${url.href}.`
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
url = validateResearchUrl(new URL(response.location, url).href);
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
return {
|
|
279
|
-
...extractSourceDocument({
|
|
280
|
-
requestedUrl: args.url,
|
|
281
|
-
finalUrl: url.href,
|
|
282
|
-
body: response.body,
|
|
283
|
-
contentType: response.contentType,
|
|
284
|
-
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
285
|
-
firstPartyHosts: args.firstPartyHosts
|
|
286
|
-
}),
|
|
287
|
-
requestCount: redirects + 1,
|
|
288
|
-
bytes: Buffer.byteLength(response.body)
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
throw new SourceRetrievalError(
|
|
292
|
-
"http_error",
|
|
293
|
-
`Source redirect limit exceeded: ${url.href}.`
|
|
294
|
-
);
|
|
295
|
-
} catch (error) {
|
|
296
|
-
if (args.signal?.aborted) {
|
|
297
|
-
throw args.signal.reason;
|
|
298
|
-
}
|
|
299
|
-
if (error instanceof SourceRetrievalError) {
|
|
300
|
-
throw error;
|
|
301
|
-
}
|
|
302
|
-
throw new SourceRetrievalError(
|
|
303
|
-
signal.aborted ? "timeout" : "network_error",
|
|
304
|
-
`Source retrieval failed: ${url.href}.`,
|
|
305
|
-
{ cause: error }
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
export {
|
|
311
|
-
sourceLimits,
|
|
312
|
-
SourceRetrievalError,
|
|
313
|
-
validateResearchUrl,
|
|
314
|
-
canonicalResearchUrl,
|
|
315
|
-
boundedUtf8,
|
|
316
|
-
extractSourceDocument,
|
|
317
|
-
fetchGroundingSource
|
|
318
|
-
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
agentAuthEnv,
|
|
3
|
-
cliNameForSurface,
|
|
4
|
-
detectAgentClis,
|
|
5
|
-
versionForSurface
|
|
6
|
-
} from "./chunk-OORO55OM.js";
|
|
7
|
-
import {
|
|
8
|
-
isAgentSurface
|
|
9
|
-
} from "./chunk-OBXAHX3L.js";
|
|
10
|
-
|
|
11
|
-
// src/engine/preflight.ts
|
|
12
|
-
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
13
|
-
import path from "node:path";
|
|
14
|
-
var minimumNodeMajor = 24;
|
|
15
|
-
var gatewaySetting = "AI_GATEWAY_API_KEY";
|
|
16
|
-
var overviewSettings = ["DATAFORSEO_LOGIN", "DATAFORSEO_PASSWORD"];
|
|
17
|
-
var credentialSettingNames = [
|
|
18
|
-
"AI_GATEWAY_API_KEY",
|
|
19
|
-
"DATAFORSEO_PASSWORD",
|
|
20
|
-
"AEO_DATABASE_URL",
|
|
21
|
-
"AEO_SITE_DATABASE_URL",
|
|
22
|
-
"AEO_API_TOKEN",
|
|
23
|
-
"OPENAI_API_KEY",
|
|
24
|
-
"ANTHROPIC_API_KEY",
|
|
25
|
-
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
26
|
-
"GOOGLE_GENERATIVE_AI_API_KEY",
|
|
27
|
-
"PERPLEXITY_API_KEY",
|
|
28
|
-
"CURSOR_API_KEY"
|
|
29
|
-
];
|
|
30
|
-
var runSettingNames = [
|
|
31
|
-
gatewaySetting,
|
|
32
|
-
...overviewSettings,
|
|
33
|
-
...Object.values(agentAuthEnv).flatMap((auth) => auth.anyOf)
|
|
34
|
-
];
|
|
35
|
-
var agentAuthMode = (surface, settings) => {
|
|
36
|
-
const name = agentAuthEnv[surface].anyOf.find(
|
|
37
|
-
(candidate) => settings.sourceOf(candidate) !== void 0
|
|
38
|
-
);
|
|
39
|
-
return name === void 0 ? { kind: "cli_session" } : { kind: "variable", name };
|
|
40
|
-
};
|
|
41
|
-
var settingCheck = (name, settings) => {
|
|
42
|
-
const source = settings.sourceOf(name);
|
|
43
|
-
return {
|
|
44
|
-
name,
|
|
45
|
-
ok: source !== void 0,
|
|
46
|
-
detail: source === void 0 ? `set it in the environment or in ${settings.file}` : `set (from the ${source === "environment" ? "process environment" : "env file"})`
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
var directoryCheck = async (dir) => {
|
|
50
|
-
const probe = path.join(dir, `.doctor-${process.pid}`);
|
|
51
|
-
try {
|
|
52
|
-
await mkdir(dir, { recursive: true });
|
|
53
|
-
await writeFile(probe, "");
|
|
54
|
-
await rm(probe, { force: true });
|
|
55
|
-
return { name: "run directory", ok: true, detail: `${dir} is writable` };
|
|
56
|
-
} catch (err) {
|
|
57
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
58
|
-
return { name: "run directory", ok: false, detail: `${dir}: ${message}` };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var runPreflight = async (args) => {
|
|
62
|
-
const { surfaces, settings } = args;
|
|
63
|
-
const nodeMajor = Number(process.versions.node.split(".")[0]);
|
|
64
|
-
const versions = await detectAgentClis();
|
|
65
|
-
const agents = surfaces.filter(isAgentSurface);
|
|
66
|
-
const checks = [
|
|
67
|
-
{
|
|
68
|
-
name: "node",
|
|
69
|
-
ok: nodeMajor >= minimumNodeMajor,
|
|
70
|
-
detail: `${process.version} (${minimumNodeMajor} or newer required)`
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
// Every stage session runs on the Codex CLI, whatever is measured.
|
|
74
|
-
name: "codex CLI",
|
|
75
|
-
ok: versions.codex !== null,
|
|
76
|
-
detail: versions.codex ?? "not found on PATH; the workflow stages need it"
|
|
77
|
-
},
|
|
78
|
-
settingCheck(gatewaySetting, settings)
|
|
79
|
-
];
|
|
80
|
-
if (surfaces.includes("google_ai_overview") || args.groundingSearch) {
|
|
81
|
-
checks.push(
|
|
82
|
-
...overviewSettings.map((name) => settingCheck(name, settings))
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
for (const surface of agents) {
|
|
86
|
-
const version = versionForSurface(surface, versions);
|
|
87
|
-
const auth = agentAuthMode(surface, settings);
|
|
88
|
-
checks.push({
|
|
89
|
-
name: `${surface} probes`,
|
|
90
|
-
ok: version !== null,
|
|
91
|
-
detail: version === null ? `\`${cliNameForSurface(surface)}\` not found on PATH` : `${cliNameForSurface(surface)} ${version}; ${auth.kind === "variable" ? `authenticates with ${auth.name}` : "uses the CLI login on this machine, checked by a canary before the run"}`
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
checks.push(await directoryCheck(args.dir));
|
|
95
|
-
return checks;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
minimumNodeMajor,
|
|
100
|
-
credentialSettingNames,
|
|
101
|
-
runSettingNames,
|
|
102
|
-
agentAuthMode,
|
|
103
|
-
runPreflight
|
|
104
|
-
};
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ModelCallAbortError
|
|
6
6
|
} from "./chunk-55U7PRRM.js";
|
|
7
|
-
import {
|
|
8
|
-
ModelBudgetError
|
|
9
|
-
} from "./chunk-TNL2GWYR.js";
|
|
10
7
|
import {
|
|
11
8
|
normalizeDomain
|
|
12
9
|
} from "./chunk-QTXOW5XC.js";
|
|
10
|
+
import {
|
|
11
|
+
ModelBudgetError
|
|
12
|
+
} from "./chunk-TNL2GWYR.js";
|
|
13
13
|
|
|
14
14
|
// src/analysis/search-analyzer.ts
|
|
15
15
|
import { APICallError } from "ai";
|