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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { promisify } from 'node:util';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { getEnvironment } from '../lib/env';
|
|
8
|
+
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// The Codex binary (specs/aeo-claude-operator-spec.md §4.3). The stage
|
|
11
|
+
// runtime is part of the method, so it is a pinned dependency of this
|
|
12
|
+
// package, never whatever `codex` happens to be on PATH. AEO_CODEX_BIN
|
|
13
|
+
// points elsewhere for a maintainer; every Codex session records which
|
|
14
|
+
// binary it ran, and its version when that is known without running it.
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
export type CodexBinarySource = 'dependency' | 'AEO_CODEX_BIN';
|
|
18
|
+
|
|
19
|
+
export type CodexBinary = {
|
|
20
|
+
/** What to spawn, and the arguments that come before Codex's own. */
|
|
21
|
+
command: string;
|
|
22
|
+
prefixArgs: readonly string[];
|
|
23
|
+
/** The file that was resolved, for doctor and the run record. */
|
|
24
|
+
path: string;
|
|
25
|
+
source: CodexBinarySource;
|
|
26
|
+
/** The installed dependency's version, from its manifest; null for a
|
|
27
|
+
* binary named from outside, whose version only running it can tell. */
|
|
28
|
+
version: string | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const codexManifestSchema = z.object({
|
|
32
|
+
version: z.string().min(1),
|
|
33
|
+
bin: z.object({ codex: z.string().min(1) }),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* resolveCodexBinary returns the Codex the stages run: AEO_CODEX_BIN when
|
|
38
|
+
* set, else this package's own dependency, started with the running Node so
|
|
39
|
+
* no file mode or PATH entry is involved.
|
|
40
|
+
*/
|
|
41
|
+
export const resolveCodexBinary = (
|
|
42
|
+
env: Record<string, string | undefined> = getEnvironment(),
|
|
43
|
+
): CodexBinary => {
|
|
44
|
+
const override = env.AEO_CODEX_BIN;
|
|
45
|
+
|
|
46
|
+
if (override !== undefined && override !== '') {
|
|
47
|
+
return codexBinaryAt(override);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const require = createRequire(import.meta.url);
|
|
51
|
+
const manifestFile = require.resolve('@openai/codex/package.json');
|
|
52
|
+
const manifest = codexManifestSchema.parse(
|
|
53
|
+
JSON.parse(readFileSync(manifestFile, 'utf8')),
|
|
54
|
+
);
|
|
55
|
+
const script = path.join(path.dirname(manifestFile), manifest.bin.codex);
|
|
56
|
+
|
|
57
|
+
const binary: CodexBinary = {
|
|
58
|
+
command: process.execPath,
|
|
59
|
+
prefixArgs: [script],
|
|
60
|
+
path: script,
|
|
61
|
+
source: 'dependency',
|
|
62
|
+
version: manifest.version,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return binary;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** codexBinaryAt names a Codex executable directly, for a host or a test
|
|
69
|
+
* that supplies its own, as AEO_CODEX_BIN does. */
|
|
70
|
+
export const codexBinaryAt = (command: string): CodexBinary => {
|
|
71
|
+
return {
|
|
72
|
+
command,
|
|
73
|
+
prefixArgs: [],
|
|
74
|
+
path: command,
|
|
75
|
+
source: 'AEO_CODEX_BIN',
|
|
76
|
+
version: null,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** codexArgs puts the binary's own prefix in front of Codex's arguments. */
|
|
81
|
+
export const codexArgs = (
|
|
82
|
+
binary: CodexBinary,
|
|
83
|
+
args: readonly string[],
|
|
84
|
+
): string[] => {
|
|
85
|
+
return [...binary.prefixArgs, ...args];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** The version the binary reports (`codex-cli 0.150.1`), or null when it
|
|
89
|
+
* cannot be started. */
|
|
90
|
+
export const codexBinaryVersion = async (
|
|
91
|
+
binary: CodexBinary = resolveCodexBinary(),
|
|
92
|
+
): Promise<string | null> => {
|
|
93
|
+
try {
|
|
94
|
+
const { stdout } = await promisify(execFile)(
|
|
95
|
+
binary.command,
|
|
96
|
+
codexArgs(binary, ['--version']),
|
|
97
|
+
{ timeout: 15_000 },
|
|
98
|
+
);
|
|
99
|
+
const [firstLine] = stdout.trim().split('\n');
|
|
100
|
+
|
|
101
|
+
return firstLine === undefined || firstLine === '' ? null : firstLine;
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { execFile } from 'node:child_process';
|
|
2
1
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
2
|
import path from 'node:path';
|
|
4
|
-
import { promisify } from 'node:util';
|
|
5
3
|
import { getEnvironment } from '../lib/env';
|
|
4
|
+
import type { CodexStageModel } from '../models/profiles';
|
|
5
|
+
import {
|
|
6
|
+
codexBinaryVersion,
|
|
7
|
+
resolveCodexBinary,
|
|
8
|
+
type CodexBinary,
|
|
9
|
+
} from './codex-binary';
|
|
6
10
|
|
|
7
11
|
// ============================================================================
|
|
8
12
|
// An isolated Codex home per work directory (specs/aeo-codex-workflow-spec.md
|
|
9
13
|
// §7). Codex reads its configuration, auth and state from CODEX_HOME; giving
|
|
10
14
|
// every run its own, written by the host, means a stage can never inherit the
|
|
11
|
-
// operator's global model, service tier, MCP servers or login.
|
|
12
|
-
// three local loops ran on the operator's default (GPT-6 Astra at xhigh on
|
|
13
|
-
// the priority tier) for exactly that reason.
|
|
15
|
+
// operator's global model, service tier, MCP servers or login.
|
|
14
16
|
// ============================================================================
|
|
15
17
|
|
|
16
|
-
/** The
|
|
17
|
-
|
|
18
|
-
* pin `src/models/profiles.ts` uses for the DeepSeek bulk roles). Part of
|
|
19
|
-
* every stage's inputs digest. */
|
|
20
|
-
export const codexModel = {
|
|
18
|
+
/** The gateway the Codex stages reach their model through. */
|
|
19
|
+
export const codexGateway = {
|
|
21
20
|
provider: 'vercel',
|
|
22
21
|
providerName: 'Vercel AI Gateway',
|
|
23
22
|
baseUrl: 'https://ai-gateway.vercel.sh/v1',
|
|
@@ -25,16 +24,27 @@ export const codexModel = {
|
|
|
25
24
|
* secret the child process sees. */
|
|
26
25
|
apiKeyEnv: 'AI_GATEWAY_API_KEY',
|
|
27
26
|
wireApi: 'responses',
|
|
28
|
-
model: 'deepseek/deepseek-v4.1-flash',
|
|
29
|
-
reasoningEffort: 'high',
|
|
30
|
-
/** The model's context window as the gateway reports it (`/v1/models`,
|
|
31
|
-
* 2026-09-13). Codex has no metadata for gateway models and otherwise
|
|
32
|
-
* falls back to a default window, which decides when it compacts the
|
|
33
|
-
* session history; a qualify or review batch that read ten answers and
|
|
34
|
-
* their rows would be compacted for no reason. */
|
|
35
|
-
contextWindow: 1_000_000,
|
|
36
27
|
} as const;
|
|
37
28
|
|
|
29
|
+
/** Everything a stage's Codex configuration says about its model, in a
|
|
30
|
+
* fixed key order: part of every stage's inputs digest and session
|
|
31
|
+
* contract, so a resume reruns a batch only when the model changed. */
|
|
32
|
+
export type CodexStageConfig = typeof codexGateway &
|
|
33
|
+
Pick<CodexStageModel, 'model' | 'reasoningEffort' | 'contextWindow'>;
|
|
34
|
+
|
|
35
|
+
export const codexStageConfig = (
|
|
36
|
+
stageModel: CodexStageModel,
|
|
37
|
+
): CodexStageConfig => {
|
|
38
|
+
const config: CodexStageConfig = {
|
|
39
|
+
...codexGateway,
|
|
40
|
+
model: stageModel.model,
|
|
41
|
+
reasoningEffort: stageModel.reasoningEffort,
|
|
42
|
+
contextWindow: stageModel.contextWindow,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return config;
|
|
46
|
+
};
|
|
47
|
+
|
|
38
48
|
export const codexHomeDir = (workdir: string): string => {
|
|
39
49
|
return path.join(workdir, '.codex-home');
|
|
40
50
|
};
|
|
@@ -57,10 +67,16 @@ const tomlString = (value: string): string => {
|
|
|
57
67
|
* directory is the only writable root: a session must not touch /tmp (an
|
|
58
68
|
* empty /tmp/.git appeared during a run, 2026-09-13), unless the work
|
|
59
69
|
* directory itself lives there, as it does in the container. */
|
|
70
|
+
type CodexConfigOptions = {
|
|
71
|
+
stageModel: CodexStageModel;
|
|
72
|
+
research?: ResearchServerConfig;
|
|
73
|
+
};
|
|
74
|
+
|
|
60
75
|
export const codexConfigToml = (
|
|
61
76
|
workdir: string,
|
|
62
|
-
research
|
|
77
|
+
{ stageModel, research }: CodexConfigOptions,
|
|
63
78
|
): string => {
|
|
79
|
+
const codexModel = codexStageConfig(stageModel);
|
|
64
80
|
const underTmp = workdir === '/tmp' || workdir.startsWith('/tmp/');
|
|
65
81
|
|
|
66
82
|
return [
|
|
@@ -126,16 +142,19 @@ export const codexConfigToml = (
|
|
|
126
142
|
|
|
127
143
|
/** Write the isolated home and return the environment a stage runs with:
|
|
128
144
|
* the path, the home, and the gateway key. Nothing else from the host. */
|
|
145
|
+
type PrepareCodexHomeOptions = CodexConfigOptions & {
|
|
146
|
+
env?: Record<string, string | undefined>;
|
|
147
|
+
};
|
|
148
|
+
|
|
129
149
|
export const prepareCodexHome = async (
|
|
130
150
|
workdir: string,
|
|
131
|
-
|
|
132
|
-
research?: ResearchServerConfig,
|
|
151
|
+
{ stageModel, research, env = getEnvironment() }: PrepareCodexHomeOptions,
|
|
133
152
|
): Promise<Record<string, string>> => {
|
|
134
|
-
const apiKey = env[
|
|
153
|
+
const apiKey = env[codexGateway.apiKeyEnv];
|
|
135
154
|
|
|
136
155
|
if (!apiKey) {
|
|
137
156
|
throw new Error(
|
|
138
|
-
`${
|
|
157
|
+
`${codexGateway.apiKeyEnv} is not set; the Codex stages run on ${stageModel.model} through the gateway and need it.`,
|
|
139
158
|
);
|
|
140
159
|
}
|
|
141
160
|
|
|
@@ -147,7 +166,7 @@ export const prepareCodexHome = async (
|
|
|
147
166
|
await writeFile(path.join(workdir, '.aeo-report-root'), '');
|
|
148
167
|
await writeFile(
|
|
149
168
|
path.join(home, 'config.toml'),
|
|
150
|
-
codexConfigToml(workdir, research),
|
|
169
|
+
codexConfigToml(workdir, { stageModel, research }),
|
|
151
170
|
);
|
|
152
171
|
|
|
153
172
|
return {
|
|
@@ -155,27 +174,18 @@ export const prepareCodexHome = async (
|
|
|
155
174
|
HOME: home,
|
|
156
175
|
CODEX_HOME: home,
|
|
157
176
|
TMPDIR: temporaryDirectory,
|
|
158
|
-
[
|
|
177
|
+
[codexGateway.apiKeyEnv]: apiKey,
|
|
159
178
|
};
|
|
160
179
|
};
|
|
161
180
|
|
|
162
|
-
/** The version of the Codex binary the stages spawn, or null when it
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
181
|
+
/** The version of the Codex binary the stages spawn, or null when it
|
|
182
|
+
cannot be started. The stages and the author run it from the host process
|
|
183
|
+
with an isolated home and the gateway key, so no agent credential is
|
|
184
|
+
involved. */
|
|
166
185
|
export const codexCliVersion = async (
|
|
167
|
-
|
|
186
|
+
binary: CodexBinary = resolveCodexBinary(),
|
|
168
187
|
): Promise<string | null> => {
|
|
169
|
-
|
|
170
|
-
const { stdout } = await promisify(execFile)(command, ['--version'], {
|
|
171
|
-
timeout: 15_000,
|
|
172
|
-
});
|
|
173
|
-
const [firstLine] = stdout.trim().split('\n');
|
|
174
|
-
|
|
175
|
-
return firstLine === undefined || firstLine === '' ? null : firstLine;
|
|
176
|
-
} catch {
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
188
|
+
return codexBinaryVersion(binary);
|
|
179
189
|
};
|
|
180
190
|
|
|
181
191
|
/** The values the work directory's journals must never carry: the store
|
|
@@ -79,9 +79,9 @@ export const copyEditCall = (args: {
|
|
|
79
79
|
// facts, in the order it is given up when the whole does not fit the
|
|
80
80
|
// role's input limit: every previous edit carries a full draft, the
|
|
81
81
|
// review history grows a review per block per round, and the rule
|
|
82
|
-
// documents are voice, not evidence.
|
|
83
|
-
//
|
|
84
|
-
//
|
|
82
|
+
// documents are voice, not evidence. One run's copy pass refused the
|
|
83
|
+
// edit before any model call because all of it together was over the
|
|
84
|
+
// limit, and the report shipped without a narrative.
|
|
85
85
|
const trims: { name: string; apply: () => void }[] = [
|
|
86
86
|
{
|
|
87
87
|
name: 'older_edits',
|
|
@@ -21,13 +21,13 @@ import type { ModelCallAccounting } from '../models/accounting';
|
|
|
21
21
|
import type { InternalModelRoleConfig } from '../models/profiles';
|
|
22
22
|
import { engineResources } from '../engine/resources';
|
|
23
23
|
import { getEnvironment } from '../lib/env';
|
|
24
|
-
import {
|
|
24
|
+
import { hostStepAccounting } from './host-models';
|
|
25
25
|
|
|
26
26
|
// ============================================================================
|
|
27
27
|
// The copy stage's host half (specs/aeo-codex-workflow-spec.md §4, §6):
|
|
28
28
|
// the writer's documents built from the finished snapshot by the existing
|
|
29
29
|
// copywriter input projection, and the draft held to the existing copy
|
|
30
|
-
// validation, premise verifier included, on the
|
|
30
|
+
// validation, premise verifier included, on the run's pinned role.
|
|
31
31
|
// ============================================================================
|
|
32
32
|
|
|
33
33
|
export const copyDir = 'COPY';
|
|
@@ -143,7 +143,7 @@ export const materializeCopyInputs = async (args: {
|
|
|
143
143
|
};
|
|
144
144
|
|
|
145
145
|
/** The host's verdict on a draft: schema, facts, banlist, premises, and
|
|
146
|
-
* the premise verifier on the
|
|
146
|
+
* the premise verifier on the run's pinned role. `invalid_copy` is the only
|
|
147
147
|
* outcome that requires a verifier edit; operational failures retain the draft. */
|
|
148
148
|
export const validateCopyDraft = async (args: {
|
|
149
149
|
draft: unknown;
|
|
@@ -155,9 +155,8 @@ export const validateCopyDraft = async (args: {
|
|
|
155
155
|
secrets: readonly string[];
|
|
156
156
|
/** The premise verifier role the run pinned: the publication gate
|
|
157
157
|
* re-checks the receipt against exactly that role, so the draft must be
|
|
158
|
-
* verified by it.
|
|
159
|
-
|
|
160
|
-
verifierRole?: InternalModelRoleConfig;
|
|
158
|
+
* verified by it. */
|
|
159
|
+
verifierRole: InternalModelRoleConfig;
|
|
161
160
|
/** A rewrite pass keeps what the reviewer did not question: the logo
|
|
162
161
|
* and eyebrow of the draft they saw. */
|
|
163
162
|
previous?: AeoReportCopy | null;
|
|
@@ -169,10 +168,8 @@ export const validateCopyDraft = async (args: {
|
|
|
169
168
|
verifierMemory?: VerifierMemory;
|
|
170
169
|
signal?: AbortSignal;
|
|
171
170
|
}): Promise<CopyValidationResult> => {
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
args.verifierRole ?? models.profile.roles.premiseVerifier;
|
|
175
|
-
const accounting = args.accounting ?? models.accounting;
|
|
171
|
+
const verifierProfile = args.verifierRole;
|
|
172
|
+
const accounting = args.accounting ?? hostStepAccounting();
|
|
176
173
|
|
|
177
174
|
return validateAgentCopy({
|
|
178
175
|
draft: args.draft,
|
|
@@ -40,18 +40,19 @@ import { StoreConflictError } from '../stores/versions';
|
|
|
40
40
|
import type { ModelCallAccounting } from '../models/accounting';
|
|
41
41
|
import type { InternalModelContext } from '../models/context';
|
|
42
42
|
import { parseAggregateOutput, type AggregateOutput } from './aggregate';
|
|
43
|
-
import { codexModel } from './codex-home';
|
|
44
43
|
import { stageVersions, workflowVersion } from './schemas';
|
|
45
|
-
import { hostModels } from './host-models';
|
|
44
|
+
import { hostModels, pinnedProfileOf } from './host-models';
|
|
46
45
|
import type { RunSource } from './run-source';
|
|
47
46
|
import type { ReportQuality } from './quality';
|
|
48
47
|
|
|
49
48
|
/** The snapshot's analyzer provenance: the Codex analyze stage under the
|
|
50
49
|
* workflow version, in a number space of its own (the retired in-process
|
|
51
|
-
* analyzer counted 1 to 8), and the
|
|
52
|
-
export const codexAnalyzer = {
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
* analyzer counted 1 to 8), and the run's stage model. */
|
|
51
|
+
export const codexAnalyzer = (model: string) => {
|
|
52
|
+
return {
|
|
53
|
+
version: workflowVersion * 100 + stageVersions.analyze,
|
|
54
|
+
model,
|
|
55
|
+
};
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
// ============================================================================
|
|
@@ -95,6 +96,8 @@ export const finishRun = async (args: {
|
|
|
95
96
|
/** Files excluded by degraded batches, recorded as partial failures. */
|
|
96
97
|
degraded: readonly string[];
|
|
97
98
|
write: boolean;
|
|
99
|
+
/** The model ID the Codex stages ran on, the analyzer's provenance. */
|
|
100
|
+
stageModelId: string;
|
|
98
101
|
/** Factual grounding over the run's manifest (the container job); a
|
|
99
102
|
* source that already carries a bundle needs none. */
|
|
100
103
|
ground?: GroundRun;
|
|
@@ -161,7 +164,9 @@ export const finishRun = async (args: {
|
|
|
161
164
|
})),
|
|
162
165
|
];
|
|
163
166
|
|
|
164
|
-
const internalModels =
|
|
167
|
+
const internalModels =
|
|
168
|
+
args.internalModels ??
|
|
169
|
+
hostModels(pinnedProfileOf(source.request.modelProfile));
|
|
165
170
|
const logContext = {
|
|
166
171
|
reportKey: config.reportKey,
|
|
167
172
|
runId: request.runId,
|
|
@@ -247,7 +252,7 @@ export const finishRun = async (args: {
|
|
|
247
252
|
),
|
|
248
253
|
partialFailures,
|
|
249
254
|
generatedAt: createdAt,
|
|
250
|
-
analyzer: codexAnalyzer,
|
|
255
|
+
analyzer: codexAnalyzer(args.stageModelId),
|
|
251
256
|
});
|
|
252
257
|
|
|
253
258
|
const snapshotFile = path.join(dir, 'OUT', 'snapshot.json');
|
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
import { createMemoryModelAccounting } from '../models/accounting';
|
|
2
|
-
import type { InternalModelContext } from '../models/context';
|
|
3
1
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '../models/profiles';
|
|
2
|
+
createMemoryModelAccounting,
|
|
3
|
+
type ModelCallAccounting,
|
|
4
|
+
} from '../models/accounting';
|
|
5
|
+
import type { InternalModelContext } from '../models/context';
|
|
6
|
+
import type { InternalModelProfile } from '../models/profiles';
|
|
9
7
|
|
|
10
8
|
// ============================================================================
|
|
11
9
|
// The host's own model calls in the Codex workflow (perception, source
|
|
12
|
-
// labels, the copy premise verifier)
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// the DeepSeek-only profile's verifier. Every admission pins
|
|
17
|
-
// `deepseek-harness-v1` (policy.ts) so no judgment role resolves to a
|
|
18
|
-
// premium model (Andrei, 2026-09-13).
|
|
10
|
+
// labels, the copy premise verifier) when the caller supplies no ledger: a
|
|
11
|
+
// small memory budget per step, on the profile the run pinned. A local run
|
|
12
|
+
// always supplies its ledger; this is the fallback for a host that does
|
|
13
|
+
// not.
|
|
19
14
|
// ============================================================================
|
|
20
15
|
|
|
21
16
|
export const hostStepMaxUsd = 5;
|
|
22
|
-
|
|
17
|
+
|
|
18
|
+
/** A fresh memory budget for one host step. */
|
|
19
|
+
export const hostStepAccounting = (): ModelCallAccounting => {
|
|
20
|
+
return createMemoryModelAccounting({
|
|
21
|
+
maxUsd: hostStepMaxUsd,
|
|
22
|
+
maxTokens: 5_000_000,
|
|
23
|
+
deadlineAt: new Date(Date.now() + 30 * 60_000).toISOString(),
|
|
24
|
+
});
|
|
25
|
+
};
|
|
23
26
|
|
|
24
27
|
export const hostModels = (
|
|
25
|
-
|
|
28
|
+
profile: InternalModelProfile,
|
|
26
29
|
): InternalModelContext => {
|
|
27
|
-
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
return { profile, accounting: hostStepAccounting() };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** The profile a run pinned; a run without one cannot call a model. */
|
|
34
|
+
export const pinnedProfileOf = (
|
|
35
|
+
profile: InternalModelProfile | undefined,
|
|
36
|
+
): InternalModelProfile => {
|
|
37
|
+
if (!profile) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
'The run request pins no model profile; the host model steps need one.',
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return profile;
|
|
35
44
|
};
|
|
@@ -18,14 +18,19 @@ import { capturePlan } from '../capture-manifest';
|
|
|
18
18
|
import type { GroundingBundle } from '../grounding/schema';
|
|
19
19
|
import { aeoReportCopySchema, type AeoReportCopy } from '../agents/copy-schema';
|
|
20
20
|
import { aeoSnapshotSchema, type AeoAuditConfig } from '../schema';
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
CodexStageModel,
|
|
23
|
+
InternalModelRoleConfig,
|
|
24
|
+
} from '../models/profiles';
|
|
22
25
|
import type { InternalModelContext } from '../models/context';
|
|
23
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
ModelBudgetError,
|
|
28
|
+
type ModelCallAccounting,
|
|
29
|
+
} from '../models/accounting';
|
|
24
30
|
import { GroundingIntegrityError } from '../grounding/validation';
|
|
25
31
|
import { structuredFailureDiagnostic } from '../models/failure-diagnostics';
|
|
26
32
|
import { isObject } from '../lib/type-guards';
|
|
27
33
|
import { aggregateWorkdir, type AggregateInputs } from './aggregate';
|
|
28
|
-
import { codexModel } from './codex-home';
|
|
29
34
|
import { CopyVerificationUnavailableError } from './copy-recovery';
|
|
30
35
|
import { copyEditHistory, editCopyDraft, readCopyEdits } from './copy-editor';
|
|
31
36
|
import { validateStage } from './checks';
|
|
@@ -41,7 +46,7 @@ import {
|
|
|
41
46
|
type FinishResult,
|
|
42
47
|
type GroundRun,
|
|
43
48
|
} from './finish';
|
|
44
|
-
import { hostModels } from './host-models';
|
|
49
|
+
import { hostModels, pinnedProfileOf } from './host-models';
|
|
45
50
|
import type { StageName } from './schemas';
|
|
46
51
|
import type { RunSource } from './run-source';
|
|
47
52
|
import {
|
|
@@ -93,13 +98,14 @@ export type WorkflowContext = StageContext & {
|
|
|
93
98
|
* or a fresh memory budget, recorded either way when the run records (the
|
|
94
99
|
* pinned one is wrapped once, by prepareWorkdir). */
|
|
95
100
|
const hostModelsOf = (
|
|
96
|
-
ctx: Pick<WorkflowContext, 'internalModels' | 'recorder'
|
|
101
|
+
ctx: Pick<WorkflowContext, 'internalModels' | 'recorder'> &
|
|
102
|
+
Partial<Pick<WorkflowContext, 'source'>>,
|
|
97
103
|
): InternalModelContext => {
|
|
98
104
|
if (ctx.internalModels) {
|
|
99
105
|
return ctx.internalModels;
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
const models = hostModels();
|
|
108
|
+
const models = hostModels(pinnedProfileOf(ctx.source?.request.modelProfile));
|
|
103
109
|
|
|
104
110
|
return ctx.recorder
|
|
105
111
|
? {
|
|
@@ -179,6 +185,14 @@ export const prepareWorkdir = async (
|
|
|
179
185
|
* it recorded the capture before the workflow (a local run). Its
|
|
180
186
|
* internalModels must already charge through that journal. */
|
|
181
187
|
held?: { writer: WriterLock; recorder: ExecutionRecorder };
|
|
188
|
+
/** The Codex stages' model for a run whose pinned profile carries none
|
|
189
|
+
* (one pinned before profiles did). A profile's own always wins. */
|
|
190
|
+
stageModel?: CodexStageModel;
|
|
191
|
+
/** The run's ledger, unwrapped: every Codex session is reserved and
|
|
192
|
+
* settled on it beside the host's model calls (specs/aeo-claude-
|
|
193
|
+
* operator-spec.md §4.2). A session is a codex_session operation of
|
|
194
|
+
* its own, so it never goes through the recording wrapper. */
|
|
195
|
+
ledger?: ModelCallAccounting;
|
|
182
196
|
} = {},
|
|
183
197
|
): Promise<WorkflowContext> => {
|
|
184
198
|
if (options.held) {
|
|
@@ -246,6 +260,14 @@ const prepareLockedWorkdir = async (
|
|
|
246
260
|
),
|
|
247
261
|
};
|
|
248
262
|
|
|
263
|
+
const stageModel = source.request.modelProfile?.stages ?? options.stageModel;
|
|
264
|
+
|
|
265
|
+
if (!stageModel) {
|
|
266
|
+
throw new Error(
|
|
267
|
+
'The run pins no Codex stage model: its profile has no `stages` and the caller supplied none.',
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
249
271
|
const log =
|
|
250
272
|
options.log ??
|
|
251
273
|
((line: string) => {
|
|
@@ -274,6 +296,8 @@ const prepareLockedWorkdir = async (
|
|
|
274
296
|
source,
|
|
275
297
|
secrets: options.secrets ?? [],
|
|
276
298
|
internalModels,
|
|
299
|
+
stageModel,
|
|
300
|
+
...(options.ledger && { accounting: options.ledger }),
|
|
277
301
|
recorder,
|
|
278
302
|
releaseWriter: writer.release,
|
|
279
303
|
signal: options.signal,
|
|
@@ -504,6 +528,7 @@ export const finish = async (
|
|
|
504
528
|
degraded,
|
|
505
529
|
write,
|
|
506
530
|
ground,
|
|
531
|
+
stageModelId: ctx.stageModel.model,
|
|
507
532
|
internalModels: hostModelsOf(ctx),
|
|
508
533
|
signal: ctx.signal,
|
|
509
534
|
quality,
|
|
@@ -605,7 +630,7 @@ export const runOne = async (
|
|
|
605
630
|
const previous = recordedRunSchema.parse(JSON.parse(raw));
|
|
606
631
|
const run: StageRun = {
|
|
607
632
|
stage,
|
|
608
|
-
model:
|
|
633
|
+
model: ctx.stageModel.model,
|
|
609
634
|
ok: true,
|
|
610
635
|
durationMs: 0,
|
|
611
636
|
usage: null,
|
|
@@ -657,6 +682,8 @@ export const deliverableCopy = async (
|
|
|
657
682
|
draft,
|
|
658
683
|
snapshot: await readSnapshot(ctx.dir),
|
|
659
684
|
secrets: ctx.secrets,
|
|
685
|
+
verifierRole:
|
|
686
|
+
inputs.verifierRole ?? hostModelsOf(ctx).profile.roles.premiseVerifier,
|
|
660
687
|
accounting: ctx.internalModels?.accounting,
|
|
661
688
|
});
|
|
662
689
|
|
|
@@ -748,15 +775,15 @@ export const writeReportCopy = async (
|
|
|
748
775
|
throw error;
|
|
749
776
|
}
|
|
750
777
|
|
|
751
|
-
// The verifier stayed unusable through its tries (
|
|
752
|
-
//
|
|
778
|
+
// The verifier stayed unusable through its tries (one run's six
|
|
779
|
+
// invalid reviews failed the pipeline). The report ships on its
|
|
753
780
|
// verified facts with the improvement note; the saved draft is kept.
|
|
754
781
|
ctx.log(
|
|
755
782
|
`copy verifier stayed ${error.outcome} after its tries; delivering the verified facts without the narrative`,
|
|
756
783
|
);
|
|
757
784
|
run = {
|
|
758
785
|
stage: 'write',
|
|
759
|
-
model:
|
|
786
|
+
model: ctx.stageModel.model,
|
|
760
787
|
ok: false,
|
|
761
788
|
durationMs: 0,
|
|
762
789
|
usage: null,
|
|
@@ -856,7 +883,7 @@ class Scorecard {
|
|
|
856
883
|
version: 1,
|
|
857
884
|
startedAt: this.#startedAt,
|
|
858
885
|
finishedAt: new Date().toISOString(),
|
|
859
|
-
model:
|
|
886
|
+
model: this.#ctx.stageModel.model,
|
|
860
887
|
answers: this.#ctx.answers.length,
|
|
861
888
|
verdict,
|
|
862
889
|
stages: this.#stages,
|