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/src/models/profiles.ts
CHANGED
|
@@ -1,54 +1,24 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { canonicalJson } from '../lib/canonical-json';
|
|
4
|
-
import { getEnvironment } from '../lib/env';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// for logo discovery. The profile every admission pins (codexRunnerProfile).
|
|
21
|
-
'deepseek-harness-v1',
|
|
22
|
-
// The same bulk roles on DeepSeek, with the premise verifier on Opus:
|
|
23
|
-
// schema compliance and reasoning quality where a refused verdict costs a
|
|
24
|
-
// copy generation (2026-09-12).
|
|
25
|
-
'deepseek-harness-v2',
|
|
26
|
-
]);
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// A model profile: the pinned settings of every text role a run's host
|
|
7
|
+
// calls use, and of the Codex stages. The engine validates and digests
|
|
8
|
+
// profiles; it does not choose them. A local run builds its own from
|
|
9
|
+
// audit.json's `model` (src/models/local-profile.ts); a host that runs the
|
|
10
|
+
// engine as a library passes its own profile in.
|
|
11
|
+
//
|
|
12
|
+
// Profiles are persisted with every run, resolved once and frozen, so the
|
|
13
|
+
// schema only ever widens: a stored profile parses, and digests, exactly as
|
|
14
|
+
// it did when it was admitted.
|
|
15
|
+
// ============================================================================
|
|
16
|
+
|
|
17
|
+
/** A profile's ID: whatever its author named it. */
|
|
18
|
+
export const internalModelProfileIdSchema = z.string().min(1);
|
|
27
19
|
export type InternalModelProfileId = z.infer<
|
|
28
20
|
typeof internalModelProfileIdSchema
|
|
29
21
|
>;
|
|
30
|
-
export const defaultInternalModelProfile: InternalModelProfileId =
|
|
31
|
-
'astra-grounding-v1';
|
|
32
|
-
|
|
33
|
-
/** The profile every admission pins, whatever the request named: every
|
|
34
|
-
* role, the copy premise verifier included, resolves to DeepSeek, so no
|
|
35
|
-
* judgment lands on a premium model (Andrei, 2026-09-13) and the copy
|
|
36
|
-
* receipt matches the role the publication gate re-checks. */
|
|
37
|
-
export const codexRunnerProfile: InternalModelProfileId = 'deepseek-harness-v1';
|
|
38
|
-
|
|
39
|
-
/** The profile an operator configured for the host model steps of the local
|
|
40
|
-
* Codex workflow: `AEO_MODEL_PROFILE` (its older name
|
|
41
|
-
* `AEO_INTERNAL_MODEL_PROFILE` still reads), validated so a typo fails at
|
|
42
|
-
* startup. Pipeline admissions do not read it; they pin codexRunnerProfile. */
|
|
43
|
-
export const configuredModelProfileId = (
|
|
44
|
-
env: Record<string, string | undefined> = getEnvironment(),
|
|
45
|
-
): InternalModelProfileId => {
|
|
46
|
-
return internalModelProfileIdSchema.parse(
|
|
47
|
-
env.AEO_MODEL_PROFILE ??
|
|
48
|
-
env.AEO_INTERNAL_MODEL_PROFILE ??
|
|
49
|
-
defaultInternalModelProfile,
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
22
|
|
|
53
23
|
export const generationBackendSchema = z.enum([
|
|
54
24
|
'claude_code',
|
|
@@ -57,44 +27,40 @@ export const generationBackendSchema = z.enum([
|
|
|
57
27
|
]);
|
|
58
28
|
export type GenerationBackend = z.infer<typeof generationBackendSchema>;
|
|
59
29
|
|
|
30
|
+
export const modelPricingSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
input: z.number().positive(),
|
|
33
|
+
output: z.number().positive(),
|
|
34
|
+
cachedInput: z.number().nonnegative(),
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
|
|
38
|
+
/** List prices, USD per million tokens. */
|
|
39
|
+
export type ModelPricing = z.infer<typeof modelPricingSchema>;
|
|
40
|
+
|
|
60
41
|
export const internalModelRoleSchema = z
|
|
61
42
|
.object({
|
|
62
|
-
model
|
|
63
|
-
|
|
64
|
-
'openai/gpt-6-astra',
|
|
65
|
-
'zai/glm-5.3',
|
|
66
|
-
'moonshotai/kimi-k3',
|
|
67
|
-
'deepseek/deepseek-v4.1-flash',
|
|
68
|
-
'anthropic/claude-opus-5',
|
|
69
|
-
]),
|
|
43
|
+
/** The gateway model ID, such as `anthropic/claude-opus-5.5`. */
|
|
44
|
+
model: z.string().min(1),
|
|
70
45
|
providerOptions: z
|
|
71
46
|
.object({
|
|
72
47
|
openai: z
|
|
73
48
|
.object({ reasoningEffort: z.literal('high') })
|
|
74
49
|
.strict()
|
|
75
50
|
.optional(),
|
|
76
|
-
/** Ask
|
|
77
|
-
*
|
|
78
|
-
* keeps a long generation inside the gateway's limits. A token
|
|
79
|
-
* budget is deliberately NOT sent: GLM ignores it (measured). */
|
|
51
|
+
/** Ask a reasoning model to think hard. A token budget is not
|
|
52
|
+
* sent: not every provider honours one. */
|
|
80
53
|
gateway: z
|
|
81
54
|
.object({
|
|
82
55
|
reasoning: z.union([
|
|
83
56
|
z.object({ effort: z.literal('high') }).strict(),
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* a stored profile must keep parsing and dispatching exactly as
|
|
87
|
-
* admitted. */
|
|
57
|
+
/** Accepted so that a stored profile keeps parsing and
|
|
58
|
+
* dispatching exactly as admitted; never built any more. */
|
|
88
59
|
z.object({ max_tokens: z.number().int().positive() }).strict(),
|
|
89
60
|
]),
|
|
90
|
-
/** The gateway
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* for GLM 5.3 dropped the schema and every structured call
|
|
94
|
-
* failed as `StructuredOutputMissingError`, while `baseten`
|
|
95
|
-
* and `fireworks` answered in a second. The pinned routes are
|
|
96
|
-
* the ones probed to return objects; the gateway still balances
|
|
97
|
-
* among them. Absent on profiles pinned before the routing pin. */
|
|
61
|
+
/** The gateway upstream routes a role is restricted to, when
|
|
62
|
+
* not every route of an open-weight model returns structured
|
|
63
|
+
* output. Absent leaves routing to the gateway. */
|
|
98
64
|
only: z.array(z.string().min(1)).min(1).max(12).optional(),
|
|
99
65
|
})
|
|
100
66
|
.strict()
|
|
@@ -106,20 +72,29 @@ export const internalModelRoleSchema = z
|
|
|
106
72
|
deadlineMs: z.number().int().positive(),
|
|
107
73
|
maxInputTokens: z.number().int().positive().max(100_000),
|
|
108
74
|
maxOutputTokens: z.number().int().positive(),
|
|
109
|
-
/** How many items one batched call may carry, when the
|
|
110
|
-
*
|
|
111
|
-
*
|
|
75
|
+
/** How many items one batched call may carry, when the model wants a
|
|
76
|
+
* narrower batch than the call site's own default. Absent leaves that
|
|
77
|
+
* default. */
|
|
112
78
|
maxItemsPerCall: z.number().int().positive().optional(),
|
|
113
|
-
pricingUsdPerMillion:
|
|
114
|
-
.object({
|
|
115
|
-
input: z.number().positive(),
|
|
116
|
-
output: z.number().positive(),
|
|
117
|
-
cachedInput: z.number().nonnegative(),
|
|
118
|
-
})
|
|
119
|
-
.strict(),
|
|
79
|
+
pricingUsdPerMillion: modelPricingSchema,
|
|
120
80
|
})
|
|
121
81
|
.strict();
|
|
122
82
|
export type InternalModelRoleConfig = z.infer<typeof internalModelRoleSchema>;
|
|
83
|
+
|
|
84
|
+
/** The model the Codex stages run on, through the gateway: part of every
|
|
85
|
+
* stage's inputs digest and of the run's method. */
|
|
86
|
+
export const codexStageModelSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
model: z.string().min(1),
|
|
89
|
+
reasoningEffort: z.enum(['medium', 'high', 'xhigh']),
|
|
90
|
+
/** The context window Codex must be told: it has no metadata for
|
|
91
|
+
* gateway models and otherwise compacts a session at its own default. */
|
|
92
|
+
contextWindow: z.number().int().positive(),
|
|
93
|
+
pricingUsdPerMillion: modelPricingSchema,
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
export type CodexStageModel = z.infer<typeof codexStageModelSchema>;
|
|
97
|
+
|
|
123
98
|
export const researchSearchProviderSchema = z.enum([
|
|
124
99
|
'disabled',
|
|
125
100
|
'dataforseo-google-organic-v1',
|
|
@@ -143,357 +118,21 @@ export const internalModelProfileSchema = z
|
|
|
143
118
|
// Missing on stored profiles: optional enrichment never rewrites pins.
|
|
144
119
|
logoDiscovery: internalModelRoleSchema.optional(),
|
|
145
120
|
competitorClassifier: internalModelRoleSchema.optional(),
|
|
146
|
-
/** Retired roles, still accepted so profiles
|
|
147
|
-
*
|
|
148
|
-
* the model-backed visual review (11 September 2026), the scrutiny
|
|
149
|
-
* and repair-planner roles with the journaled harness loop
|
|
150
|
-
* (13 September 2026). No new profile resolves them. */
|
|
121
|
+
/** Retired roles, still accepted so stored profiles parse unchanged
|
|
122
|
+
* on resume. No new profile resolves them. */
|
|
151
123
|
scrutiny: internalModelRoleSchema.optional(),
|
|
152
124
|
repairPlanner: internalModelRoleSchema.optional(),
|
|
153
125
|
visualReviewer: internalModelRoleSchema.optional(),
|
|
154
126
|
})
|
|
155
127
|
.strict(),
|
|
128
|
+
/** The Codex stages' model. Absent on profiles pinned before the stage
|
|
129
|
+
* model became part of the profile; their host supplies it. */
|
|
130
|
+
stages: codexStageModelSchema.optional(),
|
|
156
131
|
})
|
|
157
132
|
.strict();
|
|
158
133
|
export type InternalModelProfile = z.infer<typeof internalModelProfileSchema>;
|
|
159
134
|
export type InternalModelRole = keyof InternalModelProfile['roles'];
|
|
160
135
|
|
|
161
|
-
/** The model family behind a role. A profile picks one family for its text
|
|
162
|
-
* roles, one for the vision role (logo discovery) and one for domain
|
|
163
|
-
* classification. Gateway list prices, USD per million tokens, checked on
|
|
164
|
-
* `pricingCheckedAt`. */
|
|
165
|
-
type ModelFamily = 'opus' | 'astra' | 'glm' | 'kimi' | 'deepseek' | 'opus5';
|
|
166
|
-
const familyModels: Record<ModelFamily, InternalModelRoleConfig['model']> = {
|
|
167
|
-
opus: 'anthropic/claude-opus-4.6',
|
|
168
|
-
astra: 'openai/gpt-6-astra',
|
|
169
|
-
glm: 'zai/glm-5.3',
|
|
170
|
-
kimi: 'moonshotai/kimi-k3',
|
|
171
|
-
deepseek: 'deepseek/deepseek-v4.1-flash',
|
|
172
|
-
/** The judgment family of `deepseek-harness-v2` (Andrei, 2026-09-12):
|
|
173
|
-
* Opus 5 at high adaptive effort. Opus 4.6 stays pinned for the older
|
|
174
|
-
* profiles' stored meaning. */
|
|
175
|
-
opus5: 'anthropic/claude-opus-5',
|
|
176
|
-
};
|
|
177
|
-
/** Gateway upstream routes that return structured output for the open-weight
|
|
178
|
-
* families, probed 2026-09-12 with a one-object request per route (see the
|
|
179
|
-
* `only` option above). Kimi is left to the gateway's own routing. */
|
|
180
|
-
const familyRoutes: Partial<Record<ModelFamily, readonly string[]>> = {
|
|
181
|
-
glm: ['baseten', 'fireworks', 'deepinfra', 'friendli'],
|
|
182
|
-
// DeepInfra answered the one-object probe but refused the evidence
|
|
183
|
-
// reviewer's request outright (finish reason "error", no output, three
|
|
184
|
-
// times in a row, 2026-09-12); Baseten reported capacity errors under
|
|
185
|
-
// restriction. The first-party route and Fireworks carried every stage.
|
|
186
|
-
deepseek: ['deepseek', 'fireworks'],
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const familyPricing: Record<
|
|
190
|
-
ModelFamily,
|
|
191
|
-
InternalModelRoleConfig['pricingUsdPerMillion']
|
|
192
|
-
> = {
|
|
193
|
-
opus: { input: 5, output: 25, cachedInput: 0.5 },
|
|
194
|
-
astra: { input: 10, output: 50, cachedInput: 1 },
|
|
195
|
-
glm: { input: 1.4, output: 4.4, cachedInput: 0.14 },
|
|
196
|
-
kimi: { input: 3, output: 15, cachedInput: 0.3 },
|
|
197
|
-
deepseek: { input: 0.3, output: 1.2, cachedInput: 0.03 },
|
|
198
|
-
opus5: { input: 5, output: 25, cachedInput: 0.5 },
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
/** A profile ID names the family behind its text roles and its pin
|
|
202
|
-
* generation: `<family>-<grounding|harness>-v<n>`. The middle word is
|
|
203
|
-
* history (see the ID list); reading the ID is the single place the family
|
|
204
|
-
* is decided, so an ID whose shape says nothing is refused rather than
|
|
205
|
-
* quietly resolved onto Opus. */
|
|
206
|
-
const profileIdPattern =
|
|
207
|
-
/^(opus|astra|glm|deepseek)-(grounding|harness)-v(\d+)$/;
|
|
208
|
-
|
|
209
|
-
const textFamilies = [
|
|
210
|
-
'opus',
|
|
211
|
-
'astra',
|
|
212
|
-
'glm',
|
|
213
|
-
'deepseek',
|
|
214
|
-
] as const satisfies readonly ModelFamily[];
|
|
215
|
-
|
|
216
|
-
const isTextFamily = (
|
|
217
|
-
value: unknown,
|
|
218
|
-
): value is (typeof textFamilies)[number] => {
|
|
219
|
-
return textFamilies.some((family) => family === value);
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export const parseInternalModelProfileId = (
|
|
223
|
-
id: string,
|
|
224
|
-
): {
|
|
225
|
-
family: ModelFamily;
|
|
226
|
-
version: number;
|
|
227
|
-
} => {
|
|
228
|
-
const match = profileIdPattern.exec(id);
|
|
229
|
-
// The first group admits only the text families.
|
|
230
|
-
const family = match?.[1];
|
|
231
|
-
|
|
232
|
-
if (!match || !isTextFamily(family)) {
|
|
233
|
-
throw new Error(`internal_model_profile_unrecognized: ${id}`);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return { family, version: Number(match[3]) };
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
/** Families whose hidden reasoning is billed inside the output allowance, so
|
|
240
|
-
* a cap sized for the answer alone leaves nothing to answer with. Measured on
|
|
241
|
-
* GLM through the gateway, 2026-09-11: thinking is 85-93% of what they
|
|
242
|
-
* generate, at 67-100 tokens per second.
|
|
243
|
-
*
|
|
244
|
-
* They are given the answer's pinned room plus a reasoning allowance. That
|
|
245
|
-
* allowance is a SIZING input, not a token budget sent to the provider: the
|
|
246
|
-
* gateway's `reasoning.max_tokens` is not honoured by GLM. Probed directly,
|
|
247
|
-
* a 512-token budget produced 12,946 reasoning tokens where no control at all
|
|
248
|
-
* produced 11,153. These roles ask for high effort instead, because depth is
|
|
249
|
-
* worth its tokens on a model this size, and wall-clock is bounded by
|
|
250
|
-
* streaming the request rather than by starving the thinking. */
|
|
251
|
-
const reasoningOutputFamilies: readonly ModelFamily[] = [
|
|
252
|
-
'glm',
|
|
253
|
-
'kimi',
|
|
254
|
-
'deepseek',
|
|
255
|
-
];
|
|
256
|
-
|
|
257
|
-
/** Families whose thinking is billed inside the output allowance. Opus 5
|
|
258
|
-
* thinks adaptively at the requested effort and Anthropic counts it as
|
|
259
|
-
* output, so the answer's room gets the same fixed allowance; it is not a
|
|
260
|
-
* slow open-weight family, so its deadlines stay at the spec ceilings. */
|
|
261
|
-
const thinkingInOutputFamilies: readonly ModelFamily[] = [
|
|
262
|
-
...reasoningOutputFamilies,
|
|
263
|
-
'opus5',
|
|
264
|
-
];
|
|
265
|
-
|
|
266
|
-
/** Room to think, on top of whatever the answer itself is allowed.
|
|
267
|
-
*
|
|
268
|
-
* This is one number for every reasoning role rather than a multiple of the
|
|
269
|
-
* answer's size, because how hard a task is to think through has little to do
|
|
270
|
-
* with how long its answer runs. Scaling it by answer size gave the premise
|
|
271
|
-
* verifier, which returns a short verdict after difficult reasoning, the
|
|
272
|
-
* smallest allowance of any role; on 2026-09-11 it exhausted 24,576 tokens
|
|
273
|
-
* and emitted nothing, while copy spent 34,425 thinking and finished.
|
|
274
|
-
*
|
|
275
|
-
* The binding limit is now how long one stream may last, roughly 785 seconds,
|
|
276
|
-
* which at the measured 84 tokens per second is about 66,000 tokens. */
|
|
277
|
-
const reasoningBudgetTokens = 32_768;
|
|
278
|
-
|
|
279
|
-
const getProviderOptions = (
|
|
280
|
-
family: ModelFamily,
|
|
281
|
-
isReasoning: boolean,
|
|
282
|
-
): InternalModelRoleConfig['providerOptions'] => {
|
|
283
|
-
if (family === 'astra') {
|
|
284
|
-
return { openai: { reasoningEffort: 'high' } };
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (!isReasoning && family !== 'opus5') {
|
|
288
|
-
return {};
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const routes = familyRoutes[family];
|
|
292
|
-
|
|
293
|
-
return {
|
|
294
|
-
gateway: {
|
|
295
|
-
reasoning: { effort: 'high' },
|
|
296
|
-
...(routes ? { only: [...routes] } : {}),
|
|
297
|
-
},
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
const promptVersions: Partial<Record<InternalModelRole, number>> = {
|
|
302
|
-
copy: 5,
|
|
303
|
-
premiseVerifier: 5,
|
|
304
|
-
analyzer: 3,
|
|
305
|
-
research: 2,
|
|
306
|
-
adjudication: 2,
|
|
307
|
-
competitorClassifier: 2,
|
|
308
|
-
domainClassifier: 2,
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const schemaVersions: Partial<Record<InternalModelRole, number>> = {
|
|
312
|
-
copy: 3,
|
|
313
|
-
adjudication: 2,
|
|
314
|
-
premiseVerifier: 2,
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
type CreateRoleConfigOptions = {
|
|
318
|
-
maxOutputTokens?: number;
|
|
319
|
-
deadlineMs?: number;
|
|
320
|
-
/** Items per batched call for the reasoning families only. They pay for a
|
|
321
|
-
* wide batch twice, in output tokens and in wall-clock, and a narrow batch
|
|
322
|
-
* also makes any retry cheap. The other families keep their call site's
|
|
323
|
-
* default, which leaves their pinned roles byte-identical. */
|
|
324
|
-
reasoningItemsPerCall?: number;
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
const createRoleConfig = (
|
|
328
|
-
name: InternalModelRole,
|
|
329
|
-
family: ModelFamily,
|
|
330
|
-
{
|
|
331
|
-
maxOutputTokens = 16_384,
|
|
332
|
-
deadlineMs = 180_000,
|
|
333
|
-
reasoningItemsPerCall,
|
|
334
|
-
}: CreateRoleConfigOptions = {},
|
|
335
|
-
): InternalModelRoleConfig => {
|
|
336
|
-
const reasoning = reasoningOutputFamilies.includes(family);
|
|
337
|
-
const reasoningBudget = thinkingInOutputFamilies.includes(family)
|
|
338
|
-
? reasoningBudgetTokens
|
|
339
|
-
: 0;
|
|
340
|
-
|
|
341
|
-
// The cap is the answer's pinned room plus that budget, so it describes a
|
|
342
|
-
// generation the provider can actually deliver.
|
|
343
|
-
const output = maxOutputTokens + reasoningBudget;
|
|
344
|
-
// Thinking takes wall-clock too: GLM overran the copy role's five-minute
|
|
345
|
-
// deadline on 2026-09-11 while still reasoning. The same families get
|
|
346
|
-
// proportionally longer to finish, capped so a stall still ends the call.
|
|
347
|
-
const deadline = reasoning ? Math.min(deadlineMs * 3, 900_000) : deadlineMs;
|
|
348
|
-
|
|
349
|
-
const roleConfig: InternalModelRoleConfig = {
|
|
350
|
-
model: familyModels[family],
|
|
351
|
-
providerOptions: getProviderOptions(family, reasoning),
|
|
352
|
-
// premiseVerifier v4/v2 (2026-09-12): the verdict carries an explicit
|
|
353
|
-
// `passed` flag and the prompt forbids placeholder text in `errors`.
|
|
354
|
-
// premiseVerifier v5 (2026-09-13): an irrelevant but supported premise
|
|
355
|
-
// no longer fails a block on its own.
|
|
356
|
-
// copy v4 (2026-09-12): COPY_RULES.md now states the verifier's own
|
|
357
|
-
// refusals (buyer behaviour, positioning, rankings, unmeasured
|
|
358
|
-
// qualities, scope words, publisher), which the previous rules invited.
|
|
359
|
-
// analyzer v2 (2026-09-12): the prompt states the attribution rule the
|
|
360
|
-
// reviewers enforce, so an alias behind another vendor's product is not
|
|
361
|
-
// a mention. Until then every "Deno-based" phrase was credited to Deno
|
|
362
|
-
// Deploy and every run blocked on false_product_attribution.
|
|
363
|
-
// copy v5 and analyzer v3 (2026-09-12): both prompts now carry the
|
|
364
|
-
// producer guidance of the criterion registry, the single source the
|
|
365
|
-
// reviewers judge by.
|
|
366
|
-
// competitorClassifier and domainClassifier v2 (2026-09-12): both
|
|
367
|
-
// prompts carry the registry's enrichment guidance (umbrella brands,
|
|
368
|
-
// duplicates, named recommendations, source categories).
|
|
369
|
-
// COPY_RULES.md change without a copy bump (2026-09-13): the hero title
|
|
370
|
-
// is asked for as one sentence in sentence case, after a container run
|
|
371
|
-
// produced a title-case fragment. The Codex write stage digests
|
|
372
|
-
// src/author/COPY_RULES.md itself, and a bump here would change the digest of every
|
|
373
|
-
// stored profile ID, which the pin test below forbids.
|
|
374
|
-
promptVersion: `${name}-grounding-v${promptVersions[name] ?? 1}`,
|
|
375
|
-
schemaVersion: `${name}-v${schemaVersions[name] ?? 1}`,
|
|
376
|
-
deadlineMs: deadline,
|
|
377
|
-
maxInputTokens: 80_000,
|
|
378
|
-
maxOutputTokens: output,
|
|
379
|
-
...(reasoning && reasoningItemsPerCall !== undefined
|
|
380
|
-
? { maxItemsPerCall: reasoningItemsPerCall }
|
|
381
|
-
: {}),
|
|
382
|
-
pricingUsdPerMillion: familyPricing[family],
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
return roleConfig;
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
const pricingCheckedDates: Partial<Record<ModelFamily, string>> = {
|
|
389
|
-
deepseek: '2026-09-12',
|
|
390
|
-
glm: '2026-09-11',
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* resolveInternalModelProfile runs once at admission; the complete snapshot is
|
|
395
|
-
* persisted for every retry.
|
|
396
|
-
*/
|
|
397
|
-
export const resolveInternalModelProfile = (
|
|
398
|
-
id: InternalModelProfileId = defaultInternalModelProfile,
|
|
399
|
-
env: Record<string, string | undefined> = getEnvironment(),
|
|
400
|
-
): InternalModelProfile => {
|
|
401
|
-
const parsedId = internalModelProfileIdSchema.parse(id);
|
|
402
|
-
const { family, version } = parseInternalModelProfileId(parsedId);
|
|
403
|
-
// deepseek-harness-v2: the premise verifier moves to Opus. A refused
|
|
404
|
-
// verdict costs a copy generation, so schema compliance and reasoning
|
|
405
|
-
// quality are worth the price there; the bulk roles stay on DeepSeek,
|
|
406
|
-
// where volume is the cost.
|
|
407
|
-
const judgment: ModelFamily =
|
|
408
|
-
family === 'deepseek' && version >= 2 ? 'opus5' : family;
|
|
409
|
-
// The Astra and Opus profiles keep logo discovery and domain classification
|
|
410
|
-
// on Opus exactly as pinned; the open-weight evaluation profiles move both
|
|
411
|
-
// off Opus.
|
|
412
|
-
const openWeight = family === 'glm' || family === 'deepseek';
|
|
413
|
-
const vision: ModelFamily = openWeight ? 'kimi' : 'opus';
|
|
414
|
-
const classification: ModelFamily = openWeight ? family : 'opus';
|
|
415
|
-
// Reasoning models take longer per call; the Opus deadlines stay as pinned.
|
|
416
|
-
const reasoning = family !== 'opus';
|
|
417
|
-
|
|
418
|
-
return internalModelProfileSchema.parse({
|
|
419
|
-
id,
|
|
420
|
-
version: 1,
|
|
421
|
-
pricingCheckedAt: pricingCheckedDates[family] ?? '2026-09-09',
|
|
422
|
-
searchProvider: researchSearchProviderSchema.parse(
|
|
423
|
-
env.AEO_RESEARCH_SEARCH_PROVIDER ??
|
|
424
|
-
(env.DATAFORSEO_LOGIN && env.DATAFORSEO_PASSWORD
|
|
425
|
-
? 'dataforseo-google-organic-v1'
|
|
426
|
-
: 'disabled'),
|
|
427
|
-
),
|
|
428
|
-
roles: {
|
|
429
|
-
// Batched roles carry a narrower ceiling for the reasoning families.
|
|
430
|
-
// Five answers in one analyzer call ran past the transport's five
|
|
431
|
-
// minutes on GLM (2026-09-11) after spending most of the allowance on
|
|
432
|
-
// thinking; each call now covers a fraction of the work instead.
|
|
433
|
-
analyzer: createRoleConfig('analyzer', family, {
|
|
434
|
-
maxOutputTokens: 16_384,
|
|
435
|
-
deadlineMs: reasoning ? 600_000 : 180_000,
|
|
436
|
-
reasoningItemsPerCall: 2,
|
|
437
|
-
}),
|
|
438
|
-
// Perception's pin also governs claim extraction, which shares the
|
|
439
|
-
// role and batches three answers of its own; streaming carries a call
|
|
440
|
-
// that size comfortably, so this only narrows perception itself.
|
|
441
|
-
perception: createRoleConfig('perception', family, {
|
|
442
|
-
maxOutputTokens: 16_384,
|
|
443
|
-
deadlineMs: 300_000,
|
|
444
|
-
reasoningItemsPerCall: 5,
|
|
445
|
-
}),
|
|
446
|
-
research: createRoleConfig('research', family, {
|
|
447
|
-
maxOutputTokens: 4096,
|
|
448
|
-
deadlineMs: 60_000,
|
|
449
|
-
}),
|
|
450
|
-
// Bounded by verdicts per call, so a wide claim set splits instead of
|
|
451
|
-
// pushing the retrieved evidence out of the prompt.
|
|
452
|
-
adjudication: createRoleConfig('adjudication', family, {
|
|
453
|
-
maxOutputTokens: 16_384,
|
|
454
|
-
deadlineMs: 300_000,
|
|
455
|
-
reasoningItemsPerCall: 8,
|
|
456
|
-
}),
|
|
457
|
-
// One judgement per call. This role carries the longest instructions in
|
|
458
|
-
// the system and is asked to enumerate every explicit and implied
|
|
459
|
-
// premise; measured 2026-09-11, three of four calls holding several
|
|
460
|
-
// blocks ran to their cap on reasoning alone and returned nothing,
|
|
461
|
-
// while the one that finished had spent 22,899 tokens thinking.
|
|
462
|
-
premiseVerifier: createRoleConfig('premiseVerifier', judgment, {
|
|
463
|
-
maxOutputTokens: 8192,
|
|
464
|
-
deadlineMs: 180_000,
|
|
465
|
-
reasoningItemsPerCall: 1,
|
|
466
|
-
}),
|
|
467
|
-
author: createRoleConfig('author', family, {
|
|
468
|
-
maxOutputTokens: 24_576,
|
|
469
|
-
deadlineMs: 300_000,
|
|
470
|
-
}),
|
|
471
|
-
copy: createRoleConfig('copy', family, {
|
|
472
|
-
maxOutputTokens: 24_576,
|
|
473
|
-
deadlineMs: 300_000,
|
|
474
|
-
}),
|
|
475
|
-
domainClassifier: createRoleConfig('domainClassifier', classification, {
|
|
476
|
-
maxOutputTokens: 16_384,
|
|
477
|
-
deadlineMs: 180_000,
|
|
478
|
-
reasoningItemsPerCall: 25,
|
|
479
|
-
}),
|
|
480
|
-
competitorClassifier: createRoleConfig('competitorClassifier', family, {
|
|
481
|
-
maxOutputTokens: 8192,
|
|
482
|
-
deadlineMs: 300_000,
|
|
483
|
-
}),
|
|
484
|
-
logoDiscovery: {
|
|
485
|
-
...createRoleConfig('logoDiscovery', vision, {
|
|
486
|
-
maxOutputTokens: 1024,
|
|
487
|
-
deadlineMs: 60_000,
|
|
488
|
-
}),
|
|
489
|
-
promptVersion: 'logoDiscovery-grounding-v2',
|
|
490
|
-
schemaVersion: 'logoDiscovery-v2',
|
|
491
|
-
maxInputTokens: 24_000,
|
|
492
|
-
},
|
|
493
|
-
},
|
|
494
|
-
});
|
|
495
|
-
};
|
|
496
|
-
|
|
497
136
|
export const internalModelProfileDigest = (
|
|
498
137
|
profile: InternalModelProfile,
|
|
499
138
|
): string => {
|
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
* the provider names none, so a value equal to the request proves nothing and
|
|
5
5
|
* is recorded as unknown (specs/aeo-open-source-cli-spec.md §7.1: observed
|
|
6
6
|
* identity is never filled from the requested model). The gateway names the
|
|
7
|
-
* upstream route when it has one
|
|
8
|
-
*
|
|
9
|
-
* `deepseek/deepseek-v4.1-flash`.
|
|
7
|
+
* upstream route when it has one: an upstream provider's own name for the
|
|
8
|
+
* model it served.
|
|
10
9
|
*/
|
|
11
10
|
export const servedModelOf = (
|
|
12
11
|
requestedModel: string,
|
|
@@ -8,12 +8,13 @@ export type StructuredImage = {
|
|
|
8
8
|
|
|
9
9
|
/** Models that accept image input, with the visual tokens reserved per
|
|
10
10
|
* image before dispatch; settlement uses the provider's reported usage.
|
|
11
|
-
*
|
|
12
|
-
* (https://platform.claude.com/docs/en/build-with-claude/vision);
|
|
13
|
-
*
|
|
14
|
-
* 2,048 covers either with framing. */
|
|
11
|
+
* Claude's standard vision tier uses at most 1,568 tokens per image
|
|
12
|
+
* (https://platform.claude.com/docs/en/build-with-claude/vision); 2,048
|
|
13
|
+
* covers that with framing, and the other entries measured below it. */
|
|
15
14
|
const imageTokenReserve: Readonly<Record<string, number>> = {
|
|
16
15
|
'anthropic/claude-opus-4.6': 2048,
|
|
16
|
+
'anthropic/claude-opus-5.5': 2048,
|
|
17
|
+
'anthropic/claude-sonnet-5.5': 2048,
|
|
17
18
|
'moonshotai/kimi-k3': 2048,
|
|
18
19
|
};
|
|
19
20
|
|
package/src/models/structured.ts
CHANGED
|
@@ -134,6 +134,19 @@ export type StructuredTransport = {
|
|
|
134
134
|
}>;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
+
/** The reasoning effort a role asks for, however its provider takes it. */
|
|
138
|
+
const reasoningEffortOf = (
|
|
139
|
+
role: InternalModelRoleConfig,
|
|
140
|
+
): string | undefined => {
|
|
141
|
+
const { openai, gateway } = role.providerOptions;
|
|
142
|
+
const gatewayEffort =
|
|
143
|
+
gateway && 'effort' in gateway.reasoning
|
|
144
|
+
? gateway.reasoning.effort
|
|
145
|
+
: undefined;
|
|
146
|
+
|
|
147
|
+
return openai?.reasoningEffort ?? gatewayEffort;
|
|
148
|
+
};
|
|
149
|
+
|
|
137
150
|
const reportedNumber = (value: unknown): number | undefined => {
|
|
138
151
|
const number =
|
|
139
152
|
typeof value === 'string' && value.trim() ? Number(value) : value;
|
|
@@ -190,9 +203,9 @@ const gateway = createGateway({
|
|
|
190
203
|
* A pinned profile names the gateway routes a family may use (`gateway.only`);
|
|
191
204
|
* `AEO_GATEWAY_ROUTE_DENYLIST` (comma-separated route names) removes routes from
|
|
192
205
|
* that list at call time without touching the pin, because route health is
|
|
193
|
-
* operational, not part of what was admitted
|
|
194
|
-
*
|
|
195
|
-
*
|
|
206
|
+
* operational, not part of what was admitted: a route can pass a one-object
|
|
207
|
+
* probe and then refuse a real request with no output, on an execution whose
|
|
208
|
+
* pin already names it. A
|
|
196
209
|
* denylist that would empty the allowlist is ignored rather than dispatching
|
|
197
210
|
* with none.
|
|
198
211
|
*/
|
|
@@ -478,7 +491,7 @@ export const generateStructured = async <T>(
|
|
|
478
491
|
callId,
|
|
479
492
|
role: input.roleName,
|
|
480
493
|
requestedModel: input.role.model,
|
|
481
|
-
reasoningEffort: input.role
|
|
494
|
+
reasoningEffort: reasoningEffortOf(input.role),
|
|
482
495
|
profileDigest: internalModelRoleDigest(input.role),
|
|
483
496
|
...reservation,
|
|
484
497
|
});
|
|
@@ -546,7 +559,7 @@ export const generateStructured = async <T>(
|
|
|
546
559
|
assertModelCallActive(signal, error);
|
|
547
560
|
await input.accounting.settle(callId, {
|
|
548
561
|
requestedModel: input.role.model,
|
|
549
|
-
reasoningEffort: input.role
|
|
562
|
+
reasoningEffort: reasoningEffortOf(input.role),
|
|
550
563
|
durationMs: Date.now() - start,
|
|
551
564
|
costUsd: 0,
|
|
552
565
|
inputTokens: 0,
|
|
@@ -563,7 +576,7 @@ export const generateStructured = async <T>(
|
|
|
563
576
|
...billed.usage,
|
|
564
577
|
callId,
|
|
565
578
|
requestedModel: input.role.model,
|
|
566
|
-
reasoningEffort: input.role
|
|
579
|
+
reasoningEffort: reasoningEffortOf(input.role),
|
|
567
580
|
durationMs: Date.now() - start,
|
|
568
581
|
valid: false,
|
|
569
582
|
};
|
|
@@ -606,7 +619,7 @@ export const generateStructured = async <T>(
|
|
|
606
619
|
...result.usage,
|
|
607
620
|
callId,
|
|
608
621
|
requestedModel: input.role.model,
|
|
609
|
-
reasoningEffort: input.role
|
|
622
|
+
reasoningEffort: reasoningEffortOf(input.role),
|
|
610
623
|
durationMs: Date.now() - start,
|
|
611
624
|
};
|
|
612
625
|
await journal(input.journal, {
|