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.
Files changed (369) hide show
  1. package/README.md +71 -7
  2. package/dist/author-tools.js +512 -461
  3. package/dist/cli.mjs +3512 -2010
  4. package/dist/lib/access/schema.js +6 -6
  5. package/dist/lib/agents/author-schema.js +11 -12
  6. package/dist/lib/agents/author-validation.js +19 -20
  7. package/dist/lib/agents/copy-validation.js +22 -22
  8. package/dist/lib/agents/copywriter-input.js +22 -7
  9. package/dist/lib/agents/facts.js +21 -6
  10. package/dist/lib/agents/narrative-facts.js +20 -2
  11. package/dist/lib/agents/verifier.js +26 -25
  12. package/dist/lib/analysis/domain-classifier.js +21 -22
  13. package/dist/lib/analysis/domain-labels.js +11 -12
  14. package/dist/lib/analysis/progress-schema.js +2 -2
  15. package/dist/lib/analysis/progress.js +19 -21
  16. package/dist/lib/analysis/retrieval.js +20 -3
  17. package/dist/lib/analysis/scoring.js +20 -3
  18. package/dist/lib/analysis/search-analyzer.js +19 -5
  19. package/dist/lib/analysis/sentiment.js +18 -19
  20. package/dist/lib/author/examples.js +12 -13
  21. package/dist/lib/bundle/contracts.js +15 -14
  22. package/dist/lib/bundle/export.js +34 -31
  23. package/dist/lib/bundle/isolation.js +17 -0
  24. package/dist/lib/bundle/journal.js +14 -15
  25. package/dist/lib/bundle/project-journal.js +19 -18
  26. package/dist/lib/bundle/project.js +31 -28
  27. package/dist/lib/bundle/read.js +35 -32
  28. package/dist/lib/bundle/recorder.js +17 -16
  29. package/dist/lib/bundle/redact.js +14 -15
  30. package/dist/lib/bundle/trace-coverage.js +14 -15
  31. package/dist/lib/bundle/verify-integrity.js +16 -17
  32. package/dist/lib/bundle/verify-measurement.js +22 -23
  33. package/dist/lib/bundle/verify-report.js +29 -30
  34. package/dist/lib/bundle/verify.js +37 -38
  35. package/dist/lib/bundle/writer-lock.js +3 -1
  36. package/dist/lib/capture-manifest.js +13 -14
  37. package/dist/lib/checks/crawler-access.js +4 -1
  38. package/dist/lib/checks/renderability.js +5 -1
  39. package/dist/lib/checks/run-checks.js +23 -19
  40. package/dist/lib/chunks/chunk-2B5QF6UQ.js +159 -0
  41. package/dist/lib/chunks/chunk-2FOKEIIN.js +93 -0
  42. package/dist/lib/chunks/{chunk-KRFHQQS7.js → chunk-2KH7LNK7.js} +24 -24
  43. package/dist/lib/chunks/{chunk-NVBMIPXR.js → chunk-3GPUCXVA.js} +44 -26
  44. package/dist/lib/chunks/{chunk-3EBWDHPK.js → chunk-3OE4UQIB.js} +14 -16
  45. package/dist/lib/chunks/{chunk-FNDJUELJ.js → chunk-3OWJBGQE.js} +14 -14
  46. package/dist/lib/chunks/{chunk-Y4OGZ3Q5.js → chunk-46PVVQYR.js} +1 -1
  47. package/dist/lib/chunks/{chunk-EV4DRS5M.js → chunk-4XIAXX7K.js} +1 -1
  48. package/dist/lib/chunks/{chunk-IBOWGKN7.js → chunk-52F5XYOW.js} +1 -1
  49. package/dist/lib/chunks/{chunk-3DG7GHFA.js → chunk-66DVMLGR.js} +10 -10
  50. package/dist/lib/chunks/{chunk-FFOVLI3U.js → chunk-66T7JC57.js} +12 -10
  51. package/dist/lib/chunks/{chunk-KMRQSIZW.js → chunk-6GOBBNDU.js} +16 -1
  52. package/dist/lib/chunks/{chunk-WUELMJ22.js → chunk-6HMHXSCS.js} +2 -2
  53. package/dist/lib/chunks/{chunk-SWS3K62X.js → chunk-6JICXLDA.js} +3 -3
  54. package/dist/lib/chunks/{chunk-SBAZBOPI.js → chunk-6P7EZJI7.js} +4 -2
  55. package/dist/lib/chunks/chunk-75DMLOQ7.js +127 -0
  56. package/dist/lib/chunks/{chunk-RMFT4KKK.js → chunk-7CW6U5WJ.js} +1 -1
  57. package/dist/lib/chunks/{chunk-5VNYUCLL.js → chunk-7HM6IZ3L.js} +6 -9
  58. package/dist/lib/chunks/{chunk-X6E44EGV.js → chunk-7LBSNDRR.js} +10 -8
  59. package/dist/lib/chunks/{chunk-S2AM76LT.js → chunk-7WO3FFPS.js} +3 -3
  60. package/dist/lib/chunks/{chunk-ULRXHSJL.js → chunk-7YDXD4MD.js} +9 -6
  61. package/dist/lib/chunks/{chunk-HFOYASRQ.js → chunk-AAFHXNLU.js} +4 -4
  62. package/dist/lib/chunks/{chunk-OBXAHX3L.js → chunk-AASWJR7Q.js} +1 -5
  63. package/dist/lib/chunks/{chunk-MD4AVTK2.js → chunk-AJKV46SM.js} +3 -3
  64. package/dist/lib/chunks/{chunk-IEVAFDW7.js → chunk-AJO7XVXK.js} +12 -12
  65. package/dist/lib/chunks/{chunk-GMKF2FU4.js → chunk-AK6YNTCV.js} +1 -1
  66. package/dist/lib/chunks/{chunk-WKH6BJAZ.js → chunk-BFWK3TBN.js} +6 -6
  67. package/dist/lib/chunks/{chunk-FKLNEB2P.js → chunk-BGAHZIL3.js} +51 -17
  68. package/dist/lib/chunks/{chunk-ZCOI3HE2.js → chunk-BRENK356.js} +1 -1
  69. package/dist/lib/chunks/{chunk-S7KJZIUR.js → chunk-BXF4OC74.js} +18 -9
  70. package/dist/lib/chunks/{chunk-NCLFZOZU.js → chunk-CH7OCYDL.js} +1 -1
  71. package/dist/lib/chunks/{chunk-FPAN3VRW.js → chunk-DDS4G4DO.js} +27 -19
  72. package/dist/lib/chunks/{chunk-ZLOOC46D.js → chunk-DL6YQDTE.js} +34 -8
  73. package/dist/lib/chunks/chunk-DVFFYY5G.js +74 -0
  74. package/dist/lib/chunks/{chunk-PDS5KWO3.js → chunk-E2YTTB6Q.js} +56 -42
  75. package/dist/lib/chunks/{chunk-YR67JG2V.js → chunk-E3OGPTUY.js} +8 -3
  76. package/dist/lib/chunks/{chunk-SDWYZM64.js → chunk-EDQTINTL.js} +5 -1
  77. package/dist/lib/chunks/chunk-ESEMYWUH.js +257 -0
  78. package/dist/lib/chunks/{chunk-YHS5IEVZ.js → chunk-F2NSJ6PG.js} +12 -8
  79. package/dist/lib/chunks/{chunk-7GXRDAUY.js → chunk-F7DBTXKG.js} +6 -6
  80. package/dist/lib/chunks/chunk-FAUFE7MI.js +31 -0
  81. package/dist/lib/chunks/{chunk-4E4NDGOZ.js → chunk-FDM2YNQL.js} +1 -1
  82. package/dist/lib/chunks/{chunk-47IZBMP2.js → chunk-FIC7JSR4.js} +2 -2
  83. package/dist/lib/chunks/{chunk-CJ5YD3CU.js → chunk-FJL2V6P5.js} +6 -6
  84. package/dist/lib/chunks/{chunk-KHU5DRBE.js → chunk-FL6LN2K6.js} +9 -9
  85. package/dist/lib/chunks/{chunk-HSZ3DM74.js → chunk-GEFKDW7X.js} +15 -2
  86. package/dist/lib/chunks/{chunk-XNRSHATN.js → chunk-HI3PD3KR.js} +8 -8
  87. package/dist/lib/chunks/{chunk-AUB5THIS.js → chunk-I3UE52ZV.js} +2 -2
  88. package/dist/lib/chunks/{chunk-IAR6XGEW.js → chunk-J5NPHPXY.js} +5 -4
  89. package/dist/lib/chunks/{chunk-XJVXASDD.js → chunk-JBOOD6MU.js} +11 -10
  90. package/dist/lib/chunks/{chunk-5KKLUM7M.js → chunk-JKPBXPCW.js} +3 -3
  91. package/dist/lib/chunks/{chunk-5HT55QYX.js → chunk-JQDQVG3D.js} +1 -1
  92. package/dist/lib/chunks/{chunk-3KQFLOC7.js → chunk-JXBLGCXZ.js} +1 -1
  93. package/dist/lib/chunks/{chunk-D2INDP5W.js → chunk-JYFEXVWC.js} +7 -6
  94. package/dist/lib/chunks/{chunk-X2Y2ZNG3.js → chunk-K2FZFESR.js} +8 -8
  95. package/dist/lib/chunks/{chunk-DC6PN7QJ.js → chunk-K4Y5NT4M.js} +11 -7
  96. package/dist/lib/chunks/chunk-K7YFL5KB.js +182 -0
  97. package/dist/lib/chunks/{chunk-ZYSPTOKK.js → chunk-KQCRJIEG.js} +1 -1
  98. package/dist/lib/chunks/{chunk-LPND3VNQ.js → chunk-KSOHZKV5.js} +43 -35
  99. package/dist/lib/chunks/{chunk-FBFZBLTY.js → chunk-LR27H2HZ.js} +15 -16
  100. package/dist/lib/chunks/{chunk-KZR25REO.js → chunk-LTI2YYU3.js} +1 -1
  101. package/dist/lib/chunks/{chunk-EPQHVILQ.js → chunk-MA27TFEY.js} +5 -3
  102. package/dist/lib/chunks/{chunk-J46W3EMQ.js → chunk-MENTBQGB.js} +8 -7
  103. package/dist/lib/chunks/chunk-MPJCZN4G.js +155 -0
  104. package/dist/lib/chunks/{chunk-56VOFZ7T.js → chunk-MTDYBJXH.js} +92 -26
  105. package/dist/lib/chunks/{chunk-PCYNBDZ7.js → chunk-OD36HUXA.js} +17 -12
  106. package/dist/lib/chunks/{chunk-WDSCJEDG.js → chunk-OQFAMKLN.js} +11 -11
  107. package/dist/lib/chunks/{chunk-Z4LMDKBU.js → chunk-PWOYEIPF.js} +4 -4
  108. package/dist/lib/chunks/{chunk-XL4JIQ5X.js → chunk-PXB4PWJI.js} +7 -3
  109. package/dist/lib/chunks/{chunk-7ZOJE6BH.js → chunk-QGZ4QSUE.js} +8 -7
  110. package/dist/lib/chunks/chunk-QJZTDZMB.js +321 -0
  111. package/dist/lib/chunks/{chunk-MHAKYFDF.js → chunk-R2AJYV6A.js} +22 -22
  112. package/dist/lib/chunks/{chunk-5B3RNVZ6.js → chunk-RK57YZKM.js} +1 -1
  113. package/dist/lib/chunks/{chunk-ZXGATMMH.js → chunk-RPTADJXD.js} +1 -1
  114. package/dist/lib/chunks/{chunk-2NJEWPCV.js → chunk-RXSHKWZJ.js} +3 -3
  115. package/dist/lib/chunks/chunk-RYCRL3YA.js +106 -0
  116. package/dist/lib/chunks/{chunk-E3OEE5XN.js → chunk-SD7LR26G.js} +3 -3
  117. package/dist/lib/chunks/{chunk-GVC4LH2N.js → chunk-SIJOQRRK.js} +1 -1
  118. package/dist/lib/chunks/{chunk-ZBDUE3A5.js → chunk-SLAPBFRH.js} +12 -7
  119. package/dist/lib/chunks/{chunk-CKUTDJAB.js → chunk-SMPP7B7F.js} +45 -10
  120. package/dist/lib/chunks/{chunk-POUSX3T4.js → chunk-SQQ56UP2.js} +15 -6
  121. package/dist/lib/chunks/{chunk-I3TMFPK4.js → chunk-T5XQ6NXD.js} +6 -4
  122. package/dist/lib/chunks/{chunk-EYKINDNK.js → chunk-TAPVCSCR.js} +1 -1
  123. package/dist/lib/chunks/{chunk-ISN6MBNB.js → chunk-U5USH2HB.js} +7 -7
  124. package/dist/lib/chunks/chunk-U64NCRRR.js +97 -0
  125. package/dist/lib/chunks/{chunk-D2LPQO6Y.js → chunk-U6BW6LGX.js} +10 -3
  126. package/dist/lib/chunks/chunk-U772TN32.js +67 -0
  127. package/dist/lib/chunks/{chunk-XHWRSGX3.js → chunk-UYDQXXDQ.js} +4 -4
  128. package/dist/lib/chunks/{chunk-CPT2GKKW.js → chunk-V5JJEEBT.js} +1 -1
  129. package/dist/lib/chunks/{chunk-YWJPJI3W.js → chunk-VL253W5C.js} +3 -1
  130. package/dist/lib/chunks/{chunk-I7VNIW6Q.js → chunk-VPXYGN4I.js} +86 -15
  131. package/dist/lib/chunks/{chunk-Z7V63UZA.js → chunk-VXDMOB7O.js} +4 -4
  132. package/dist/lib/chunks/chunk-W5X7WJYL.js +91 -0
  133. package/dist/lib/chunks/{chunk-6AUEDSTU.js → chunk-WCLKIPJV.js} +1 -1
  134. package/dist/lib/chunks/{chunk-QFVRCSJ2.js → chunk-WDOA5JEH.js} +2 -0
  135. package/dist/lib/chunks/chunk-WDT2Y7D7.js +117 -0
  136. package/dist/lib/chunks/{chunk-OVUCZLH2.js → chunk-WIBMVNIH.js} +2 -2
  137. package/dist/lib/chunks/{chunk-5T3V6XJS.js → chunk-WNIXDMJL.js} +1 -1
  138. package/dist/lib/chunks/{chunk-OORO55OM.js → chunk-WZGI7UVM.js} +23 -8
  139. package/dist/lib/chunks/{chunk-2GY42RIJ.js → chunk-XAKME6NM.js} +1 -1
  140. package/dist/lib/chunks/{chunk-Q2PWES4B.js → chunk-XAN4CRFP.js} +33 -41
  141. package/dist/lib/chunks/{chunk-MIF5IYNR.js → chunk-XDG6NPJB.js} +26 -29
  142. package/dist/lib/chunks/{chunk-IPNK7FYT.js → chunk-XFUYEFQP.js} +1 -1
  143. package/dist/lib/chunks/{chunk-OQVIRYT5.js → chunk-XNTFOVCE.js} +2 -2
  144. package/dist/lib/chunks/chunk-Y2CZ6FZY.js +61 -0
  145. package/dist/lib/chunks/{chunk-D7GEQVLL.js → chunk-YKJHFD64.js} +1 -1
  146. package/dist/lib/chunks/chunk-YZEZRQIG.js +194 -0
  147. package/dist/lib/chunks/chunk-ZIGNJAPC.js +11 -0
  148. package/dist/lib/chunks/{chunk-5ZITQDVE.js → chunk-ZQ3ER7JD.js} +12 -13
  149. package/dist/lib/cli/bundle-commands.js +102 -94
  150. package/dist/lib/cli/guide-command.js +25 -0
  151. package/dist/lib/cli/io.js +1 -1
  152. package/dist/lib/cli/run-commands.js +310 -140
  153. package/dist/lib/cli/status-command.js +236 -0
  154. package/dist/lib/codex-workflow/aggregate.js +22 -24
  155. package/dist/lib/codex-workflow/author-search.js +4 -3
  156. package/dist/lib/codex-workflow/author-tools.js +18 -17
  157. package/dist/lib/codex-workflow/author.js +39 -36
  158. package/dist/lib/codex-workflow/capture.js +26 -25
  159. package/dist/lib/codex-workflow/checkpoint.js +14 -15
  160. package/dist/lib/codex-workflow/checks.js +16 -18
  161. package/dist/lib/codex-workflow/codex-binary.js +13 -0
  162. package/dist/lib/codex-workflow/codex-home.js +6 -3
  163. package/dist/lib/codex-workflow/copy-editor.js +33 -32
  164. package/dist/lib/codex-workflow/copy-recovery.js +12 -13
  165. package/dist/lib/codex-workflow/copy.js +30 -29
  166. package/dist/lib/codex-workflow/finish.js +37 -38
  167. package/dist/lib/codex-workflow/host-models.js +7 -7
  168. package/dist/lib/codex-workflow/loop.js +71 -65
  169. package/dist/lib/codex-workflow/quality.js +12 -13
  170. package/dist/lib/codex-workflow/run-inputs.js +13 -14
  171. package/dist/lib/codex-workflow/run-source.js +28 -24
  172. package/dist/lib/codex-workflow/schemas.js +12 -13
  173. package/dist/lib/codex-workflow/session.js +15 -16
  174. package/dist/lib/codex-workflow/stage.js +51 -45
  175. package/dist/lib/codex-workflow/workdir.js +14 -15
  176. package/dist/lib/engine/audit-file.js +18 -13
  177. package/dist/lib/engine/author.js +62 -53
  178. package/dist/lib/engine/budget.js +7 -1
  179. package/dist/lib/engine/cost-estimate.js +43 -0
  180. package/dist/lib/engine/local-run.js +79 -71
  181. package/dist/lib/engine/preflight.js +17 -13
  182. package/dist/lib/engine/rejudge.js +87 -79
  183. package/dist/lib/engine/resources.js +1 -1
  184. package/dist/lib/engine/run-configuration.js +2 -1
  185. package/dist/lib/engine/run-status.js +153 -0
  186. package/dist/lib/engine/templates.js +19 -14
  187. package/dist/lib/grounding/chromium-guard.js +13 -0
  188. package/dist/lib/grounding/controller.js +13 -12
  189. package/dist/lib/grounding/extract.js +12 -11
  190. package/dist/lib/grounding/fetch.js +4 -7
  191. package/dist/lib/grounding/file-store.js +5 -5
  192. package/dist/lib/grounding/grounding-runtime.js +34 -32
  193. package/dist/lib/grounding/guarded-request.js +18 -0
  194. package/dist/lib/grounding/model.js +11 -10
  195. package/dist/lib/grounding/profile.js +4 -4
  196. package/dist/lib/grounding/recorded-tools.js +18 -17
  197. package/dist/lib/grounding/session.js +3 -3
  198. package/dist/lib/grounding/tools.js +4 -3
  199. package/dist/lib/grounding/validation.js +2 -2
  200. package/dist/lib/harness/report/artifacts.js +12 -13
  201. package/dist/lib/harness/report/capture-coverage.js +4 -4
  202. package/dist/lib/lib/checkpoint.js +11 -12
  203. package/dist/lib/lib/progress-comparison.js +2 -2
  204. package/dist/lib/models/batching.js +5 -5
  205. package/dist/lib/models/cost-coefficients.js +20 -0
  206. package/dist/lib/models/local-profile.js +10 -0
  207. package/dist/lib/models/pricing.js +6 -0
  208. package/dist/lib/models/profiles.js +7 -14
  209. package/dist/lib/models/structured-images.js +1 -1
  210. package/dist/lib/models/structured.js +4 -4
  211. package/dist/lib/models/supported-models.js +20 -0
  212. package/dist/lib/pipeline.js +21 -21
  213. package/dist/lib/probes/agent-cli-parsers.js +1 -1
  214. package/dist/lib/probes/agent-clis.js +13 -12
  215. package/dist/lib/probes/charged-trace.js +10 -0
  216. package/dist/lib/probes/probes.js +12 -12
  217. package/dist/lib/probes/web-tool-guard.js +3 -3
  218. package/dist/lib/report/contracts.js +4 -4
  219. package/dist/lib/report/core/progress-comparison.js +2 -2
  220. package/dist/lib/report/core/progress-schema.js +2 -2
  221. package/dist/lib/report/core/schema.js +2 -4
  222. package/dist/lib/report/core/surfaces.js +1 -3
  223. package/dist/lib/runner.js +25 -26
  224. package/dist/lib/schema.js +20 -15
  225. package/dist/lib/section-result.js +15 -17
  226. package/dist/lib/stores/artifacts.js +18 -19
  227. package/dist/lib/stores/files.js +32 -32
  228. package/dist/lib/stores/local-versions.js +11 -12
  229. package/dist/lib/stores/memory.js +34 -35
  230. package/dist/lib/stores/publication.js +23 -23
  231. package/dist/lib/surfaces.js +1 -3
  232. package/dist/lib/viewer/server.js +38 -39
  233. package/dist/lib/workflow/schema.js +9 -10
  234. package/dist/types/agents/author-schema.d.ts +3 -3
  235. package/dist/types/agents/copy-validation.d.ts +4 -4
  236. package/dist/types/agents/verifier.d.ts +6 -6
  237. package/dist/types/analysis/scoring.d.ts +2 -2
  238. package/dist/types/bundle/contracts.d.ts +3 -2
  239. package/dist/types/bundle/isolation.d.ts +37 -0
  240. package/dist/types/bundle/project-journal.d.ts +2 -0
  241. package/dist/types/bundle/recorder.d.ts +4 -0
  242. package/dist/types/bundle/writer-lock.d.ts +9 -0
  243. package/dist/types/checks/crawler-access.d.ts +3 -2
  244. package/dist/types/checks/renderability.d.ts +8 -1
  245. package/dist/types/cli/guide-command.d.ts +4 -0
  246. package/dist/types/cli/status-command.d.ts +2 -0
  247. package/dist/types/codex-workflow/author-tools.d.ts +3 -3
  248. package/dist/types/codex-workflow/codex-binary.d.ts +26 -0
  249. package/dist/types/codex-workflow/codex-home.d.ts +24 -20
  250. package/dist/types/codex-workflow/copy-editor.d.ts +1 -1
  251. package/dist/types/codex-workflow/copy.d.ts +3 -4
  252. package/dist/types/codex-workflow/finish.d.ts +5 -3
  253. package/dist/types/codex-workflow/host-models.d.ts +7 -3
  254. package/dist/types/codex-workflow/loop.d.ts +10 -1
  255. package/dist/types/codex-workflow/run-inputs.d.ts +31 -113
  256. package/dist/types/codex-workflow/schemas.d.ts +6 -6
  257. package/dist/types/codex-workflow/stage.d.ts +16 -5
  258. package/dist/types/engine/audit-file.d.ts +9 -3
  259. package/dist/types/engine/author.d.ts +7 -1
  260. package/dist/types/engine/budget.d.ts +46 -15
  261. package/dist/types/engine/cost-estimate.d.ts +40 -0
  262. package/dist/types/engine/local-run.d.ts +6 -0
  263. package/dist/types/engine/preflight.d.ts +7 -0
  264. package/dist/types/engine/resources.d.ts +2 -0
  265. package/dist/types/engine/run-configuration.d.ts +4 -3
  266. package/dist/types/engine/run-status.d.ts +75 -0
  267. package/dist/types/engine/templates.d.ts +1 -2
  268. package/dist/types/grounding/chromium-guard.d.ts +41 -0
  269. package/dist/types/grounding/fetch.d.ts +0 -10
  270. package/dist/types/grounding/guarded-request.d.ts +76 -0
  271. package/dist/types/harness/report/artifacts.d.ts +1 -0
  272. package/dist/types/lib/checkpoint.d.ts +5 -6
  273. package/dist/types/models/cost-coefficients.d.ts +106 -0
  274. package/dist/types/models/local-profile.d.ts +12 -0
  275. package/dist/types/models/pricing.d.ts +8 -0
  276. package/dist/types/models/profiles.d.ts +55 -160
  277. package/dist/types/models/served-model.d.ts +2 -3
  278. package/dist/types/models/structured.d.ts +3 -3
  279. package/dist/types/models/supported-models.d.ts +48 -0
  280. package/dist/types/pipeline.d.ts +2 -1
  281. package/dist/types/probes/charged-trace.d.ts +8 -0
  282. package/dist/types/probes/probe-trace.d.ts +2 -0
  283. package/dist/types/probes/probes.d.ts +2 -1
  284. package/dist/types/report/contracts.d.ts +2 -0
  285. package/dist/types/report/core/schema.d.ts +3 -1
  286. package/dist/types/report/core/surfaces.d.ts +0 -1
  287. package/dist/types/schema.d.ts +50 -113
  288. package/dist/types/section-result.d.ts +1 -1
  289. package/dist/types/workflow/schema.d.ts +79 -152
  290. package/package.json +2 -1
  291. package/resources/guide/OPERATOR.md +189 -0
  292. package/src/agents/author-schema.ts +13 -1
  293. package/src/agents/author-validation.ts +2 -5
  294. package/src/agents/copy-validation.ts +8 -12
  295. package/src/agents/facts.ts +8 -8
  296. package/src/agents/narrative-facts.ts +9 -20
  297. package/src/agents/verifier.ts +12 -16
  298. package/src/analysis/progress.ts +1 -0
  299. package/src/analysis/scoring.ts +9 -13
  300. package/src/bundle/contracts.ts +9 -4
  301. package/src/bundle/isolation.ts +157 -0
  302. package/src/bundle/project-journal.ts +4 -0
  303. package/src/bundle/project.ts +20 -7
  304. package/src/bundle/recorder.ts +5 -0
  305. package/src/bundle/verify.ts +3 -3
  306. package/src/bundle/writer-lock.ts +27 -0
  307. package/src/capture-manifest.ts +4 -0
  308. package/src/checks/crawler-access.ts +70 -50
  309. package/src/checks/renderability.ts +113 -87
  310. package/src/checks/run-checks.ts +16 -3
  311. package/src/cli/guide-command.ts +28 -0
  312. package/src/cli/io.ts +2 -0
  313. package/src/cli/literally-aeo.ts +39 -19
  314. package/src/cli/run-commands.ts +238 -18
  315. package/src/cli/status-command.ts +113 -0
  316. package/src/codex-workflow/aggregate.ts +1 -0
  317. package/src/codex-workflow/author-tools.ts +39 -60
  318. package/src/codex-workflow/capture.ts +1 -0
  319. package/src/codex-workflow/codex-binary.ts +105 -0
  320. package/src/codex-workflow/codex-home.ts +50 -40
  321. package/src/codex-workflow/copy-editor.ts +3 -3
  322. package/src/codex-workflow/copy.ts +7 -10
  323. package/src/codex-workflow/finish.ts +13 -8
  324. package/src/codex-workflow/host-models.ts +33 -24
  325. package/src/codex-workflow/loop.ts +38 -11
  326. package/src/codex-workflow/stage.ts +126 -17
  327. package/src/engine/audit-file.ts +98 -9
  328. package/src/engine/author.ts +47 -2
  329. package/src/engine/budget.ts +138 -43
  330. package/src/engine/cost-estimate.ts +178 -0
  331. package/src/engine/guide/OPERATOR.md +189 -0
  332. package/src/engine/local-run.ts +38 -8
  333. package/src/engine/preflight.ts +140 -7
  334. package/src/engine/resources.ts +9 -4
  335. package/src/engine/run-configuration.ts +19 -1
  336. package/src/engine/run-status.ts +452 -0
  337. package/src/engine/templates.ts +5 -2
  338. package/src/grounding/chromium-guard.ts +273 -0
  339. package/src/grounding/controller.ts +1 -1
  340. package/src/grounding/fetch.ts +39 -276
  341. package/src/grounding/guarded-request.ts +428 -0
  342. package/src/grounding/tools.ts +2 -1
  343. package/src/grounding/validation.ts +1 -1
  344. package/src/lib/checkpoint.ts +15 -16
  345. package/src/models/cost-coefficients.ts +140 -0
  346. package/src/models/local-profile.ts +150 -0
  347. package/src/models/pricing.ts +31 -0
  348. package/src/models/profiles.ts +58 -419
  349. package/src/models/served-model.ts +2 -3
  350. package/src/models/structured-images.ts +5 -4
  351. package/src/models/structured.ts +20 -7
  352. package/src/models/supported-models.ts +112 -0
  353. package/src/pipeline.ts +13 -7
  354. package/src/probes/agent-clis.ts +26 -5
  355. package/src/probes/charged-trace.ts +87 -0
  356. package/src/probes/probe-trace.ts +2 -0
  357. package/src/probes/probes.ts +72 -12
  358. package/src/report/core/schema.ts +4 -1
  359. package/src/report/core/surfaces.ts +4 -8
  360. package/src/runner.ts +1 -0
  361. package/src/schema.ts +68 -4
  362. package/src/section-result.ts +6 -5
  363. package/dist/lib/chunks/chunk-6EH4N3EU.js +0 -113
  364. package/dist/lib/chunks/chunk-CFFPOTP4.js +0 -356
  365. package/dist/lib/chunks/chunk-LIZX4N3H.js +0 -110
  366. package/dist/lib/chunks/chunk-OYKV5NDM.js +0 -28
  367. package/dist/lib/chunks/chunk-SWJ7KQSL.js +0 -318
  368. package/dist/lib/chunks/chunk-WE2WPNG2.js +0 -104
  369. package/dist/lib/chunks/{chunk-XI5H46DF.js → chunk-SASE7U6E.js} +3 -3
@@ -47,6 +47,9 @@ export declare const runInputsSchema: z.ZodObject<{
47
47
  runsPerPrompt: z.ZodDefault<z.ZodNumber>;
48
48
  maxPromptsPerSection: z.ZodOptional<z.ZodNumber>;
49
49
  }, z.core.$strip>>;
50
+ chatProbes: z.ZodOptional<z.ZodObject<{
51
+ runsPerPrompt: z.ZodNumber;
52
+ }, z.core.$strict>>;
50
53
  moneyPages: z.ZodArray<z.ZodString>;
51
54
  productBrief: z.ZodString;
52
55
  surfaces: z.ZodPrefault<z.ZodObject<{
@@ -312,15 +315,7 @@ export declare const runInputsSchema: z.ZodObject<{
312
315
  }>>;
313
316
  configVersion: z.ZodOptional<z.ZodNumber>;
314
317
  modelProfile: z.ZodOptional<z.ZodObject<{
315
- id: z.ZodEnum<{
316
- "opus-grounding-v1": "opus-grounding-v1";
317
- "astra-grounding-v1": "astra-grounding-v1";
318
- "opus-harness-v1": "opus-harness-v1";
319
- "astra-harness-v1": "astra-harness-v1";
320
- "glm-harness-v1": "glm-harness-v1";
321
- "deepseek-harness-v1": "deepseek-harness-v1";
322
- "deepseek-harness-v2": "deepseek-harness-v2";
323
- }>;
318
+ id: z.ZodString;
324
319
  version: z.ZodLiteral<1>;
325
320
  pricingCheckedAt: z.ZodISODate;
326
321
  searchProvider: z.ZodEnum<{
@@ -329,14 +324,7 @@ export declare const runInputsSchema: z.ZodObject<{
329
324
  }>;
330
325
  roles: z.ZodObject<{
331
326
  analyzer: z.ZodObject<{
332
- model: z.ZodEnum<{
333
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
334
- "openai/gpt-6-astra": "openai/gpt-6-astra";
335
- "zai/glm-5.3": "zai/glm-5.3";
336
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
337
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
338
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
339
- }>;
327
+ model: z.ZodString;
340
328
  providerOptions: z.ZodObject<{
341
329
  openai: z.ZodOptional<z.ZodObject<{
342
330
  reasoningEffort: z.ZodLiteral<"high">;
@@ -363,14 +351,7 @@ export declare const runInputsSchema: z.ZodObject<{
363
351
  }, z.core.$strict>;
364
352
  }, z.core.$strict>;
365
353
  perception: z.ZodObject<{
366
- model: z.ZodEnum<{
367
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
368
- "openai/gpt-6-astra": "openai/gpt-6-astra";
369
- "zai/glm-5.3": "zai/glm-5.3";
370
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
371
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
372
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
373
- }>;
354
+ model: z.ZodString;
374
355
  providerOptions: z.ZodObject<{
375
356
  openai: z.ZodOptional<z.ZodObject<{
376
357
  reasoningEffort: z.ZodLiteral<"high">;
@@ -397,14 +378,7 @@ export declare const runInputsSchema: z.ZodObject<{
397
378
  }, z.core.$strict>;
398
379
  }, z.core.$strict>;
399
380
  research: z.ZodObject<{
400
- model: z.ZodEnum<{
401
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
402
- "openai/gpt-6-astra": "openai/gpt-6-astra";
403
- "zai/glm-5.3": "zai/glm-5.3";
404
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
405
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
406
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
407
- }>;
381
+ model: z.ZodString;
408
382
  providerOptions: z.ZodObject<{
409
383
  openai: z.ZodOptional<z.ZodObject<{
410
384
  reasoningEffort: z.ZodLiteral<"high">;
@@ -431,14 +405,7 @@ export declare const runInputsSchema: z.ZodObject<{
431
405
  }, z.core.$strict>;
432
406
  }, z.core.$strict>;
433
407
  adjudication: z.ZodObject<{
434
- model: z.ZodEnum<{
435
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
436
- "openai/gpt-6-astra": "openai/gpt-6-astra";
437
- "zai/glm-5.3": "zai/glm-5.3";
438
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
439
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
440
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
441
- }>;
408
+ model: z.ZodString;
442
409
  providerOptions: z.ZodObject<{
443
410
  openai: z.ZodOptional<z.ZodObject<{
444
411
  reasoningEffort: z.ZodLiteral<"high">;
@@ -465,14 +432,7 @@ export declare const runInputsSchema: z.ZodObject<{
465
432
  }, z.core.$strict>;
466
433
  }, z.core.$strict>;
467
434
  premiseVerifier: z.ZodObject<{
468
- model: z.ZodEnum<{
469
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
470
- "openai/gpt-6-astra": "openai/gpt-6-astra";
471
- "zai/glm-5.3": "zai/glm-5.3";
472
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
473
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
474
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
475
- }>;
435
+ model: z.ZodString;
476
436
  providerOptions: z.ZodObject<{
477
437
  openai: z.ZodOptional<z.ZodObject<{
478
438
  reasoningEffort: z.ZodLiteral<"high">;
@@ -499,14 +459,7 @@ export declare const runInputsSchema: z.ZodObject<{
499
459
  }, z.core.$strict>;
500
460
  }, z.core.$strict>;
501
461
  author: z.ZodObject<{
502
- model: z.ZodEnum<{
503
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
504
- "openai/gpt-6-astra": "openai/gpt-6-astra";
505
- "zai/glm-5.3": "zai/glm-5.3";
506
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
507
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
508
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
509
- }>;
462
+ model: z.ZodString;
510
463
  providerOptions: z.ZodObject<{
511
464
  openai: z.ZodOptional<z.ZodObject<{
512
465
  reasoningEffort: z.ZodLiteral<"high">;
@@ -533,14 +486,7 @@ export declare const runInputsSchema: z.ZodObject<{
533
486
  }, z.core.$strict>;
534
487
  }, z.core.$strict>;
535
488
  copy: z.ZodObject<{
536
- model: z.ZodEnum<{
537
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
538
- "openai/gpt-6-astra": "openai/gpt-6-astra";
539
- "zai/glm-5.3": "zai/glm-5.3";
540
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
541
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
542
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
543
- }>;
489
+ model: z.ZodString;
544
490
  providerOptions: z.ZodObject<{
545
491
  openai: z.ZodOptional<z.ZodObject<{
546
492
  reasoningEffort: z.ZodLiteral<"high">;
@@ -567,14 +513,7 @@ export declare const runInputsSchema: z.ZodObject<{
567
513
  }, z.core.$strict>;
568
514
  }, z.core.$strict>;
569
515
  domainClassifier: z.ZodObject<{
570
- model: z.ZodEnum<{
571
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
572
- "openai/gpt-6-astra": "openai/gpt-6-astra";
573
- "zai/glm-5.3": "zai/glm-5.3";
574
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
575
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
576
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
577
- }>;
516
+ model: z.ZodString;
578
517
  providerOptions: z.ZodObject<{
579
518
  openai: z.ZodOptional<z.ZodObject<{
580
519
  reasoningEffort: z.ZodLiteral<"high">;
@@ -601,14 +540,7 @@ export declare const runInputsSchema: z.ZodObject<{
601
540
  }, z.core.$strict>;
602
541
  }, z.core.$strict>;
603
542
  logoDiscovery: z.ZodOptional<z.ZodObject<{
604
- model: z.ZodEnum<{
605
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
606
- "openai/gpt-6-astra": "openai/gpt-6-astra";
607
- "zai/glm-5.3": "zai/glm-5.3";
608
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
609
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
610
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
611
- }>;
543
+ model: z.ZodString;
612
544
  providerOptions: z.ZodObject<{
613
545
  openai: z.ZodOptional<z.ZodObject<{
614
546
  reasoningEffort: z.ZodLiteral<"high">;
@@ -635,14 +567,7 @@ export declare const runInputsSchema: z.ZodObject<{
635
567
  }, z.core.$strict>;
636
568
  }, z.core.$strict>>;
637
569
  competitorClassifier: z.ZodOptional<z.ZodObject<{
638
- model: z.ZodEnum<{
639
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
640
- "openai/gpt-6-astra": "openai/gpt-6-astra";
641
- "zai/glm-5.3": "zai/glm-5.3";
642
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
643
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
644
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
645
- }>;
570
+ model: z.ZodString;
646
571
  providerOptions: z.ZodObject<{
647
572
  openai: z.ZodOptional<z.ZodObject<{
648
573
  reasoningEffort: z.ZodLiteral<"high">;
@@ -669,14 +594,7 @@ export declare const runInputsSchema: z.ZodObject<{
669
594
  }, z.core.$strict>;
670
595
  }, z.core.$strict>>;
671
596
  scrutiny: z.ZodOptional<z.ZodObject<{
672
- model: z.ZodEnum<{
673
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
674
- "openai/gpt-6-astra": "openai/gpt-6-astra";
675
- "zai/glm-5.3": "zai/glm-5.3";
676
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
677
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
678
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
679
- }>;
597
+ model: z.ZodString;
680
598
  providerOptions: z.ZodObject<{
681
599
  openai: z.ZodOptional<z.ZodObject<{
682
600
  reasoningEffort: z.ZodLiteral<"high">;
@@ -703,14 +621,7 @@ export declare const runInputsSchema: z.ZodObject<{
703
621
  }, z.core.$strict>;
704
622
  }, z.core.$strict>>;
705
623
  repairPlanner: z.ZodOptional<z.ZodObject<{
706
- model: z.ZodEnum<{
707
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
708
- "openai/gpt-6-astra": "openai/gpt-6-astra";
709
- "zai/glm-5.3": "zai/glm-5.3";
710
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
711
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
712
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
713
- }>;
624
+ model: z.ZodString;
714
625
  providerOptions: z.ZodObject<{
715
626
  openai: z.ZodOptional<z.ZodObject<{
716
627
  reasoningEffort: z.ZodLiteral<"high">;
@@ -737,14 +648,7 @@ export declare const runInputsSchema: z.ZodObject<{
737
648
  }, z.core.$strict>;
738
649
  }, z.core.$strict>>;
739
650
  visualReviewer: z.ZodOptional<z.ZodObject<{
740
- model: z.ZodEnum<{
741
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
742
- "openai/gpt-6-astra": "openai/gpt-6-astra";
743
- "zai/glm-5.3": "zai/glm-5.3";
744
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
745
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
746
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
747
- }>;
651
+ model: z.ZodString;
748
652
  providerOptions: z.ZodObject<{
749
653
  openai: z.ZodOptional<z.ZodObject<{
750
654
  reasoningEffort: z.ZodLiteral<"high">;
@@ -771,6 +675,20 @@ export declare const runInputsSchema: z.ZodObject<{
771
675
  }, z.core.$strict>;
772
676
  }, z.core.$strict>>;
773
677
  }, z.core.$strict>;
678
+ stages: z.ZodOptional<z.ZodObject<{
679
+ model: z.ZodString;
680
+ reasoningEffort: z.ZodEnum<{
681
+ high: "high";
682
+ medium: "medium";
683
+ xhigh: "xhigh";
684
+ }>;
685
+ contextWindow: z.ZodNumber;
686
+ pricingUsdPerMillion: z.ZodObject<{
687
+ input: z.ZodNumber;
688
+ output: z.ZodNumber;
689
+ cachedInput: z.ZodNumber;
690
+ }, z.core.$strict>;
691
+ }, z.core.$strict>>;
774
692
  }, z.core.$strict>>;
775
693
  modelBudget: z.ZodOptional<z.ZodObject<{
776
694
  maxUsd: z.ZodNumber;
@@ -222,12 +222,12 @@ export declare const authorStageOutputSchema: z.ZodObject<{
222
222
  domain: z.ZodString;
223
223
  aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
224
224
  }, z.core.$strip>;
225
+ moneyPages: z.ZodArray<z.ZodString>;
226
+ productBrief: z.ZodString;
225
227
  agentProbes: z.ZodPrefault<z.ZodObject<{
226
- runsPerPrompt: z.ZodDefault<z.ZodNumber>;
227
228
  maxPromptsPerSection: z.ZodOptional<z.ZodNumber>;
229
+ runsPerPrompt: z.ZodDefault<z.ZodNumber>;
228
230
  }, z.core.$strip>>;
229
- moneyPages: z.ZodArray<z.ZodString>;
230
- productBrief: z.ZodString;
231
231
  sections: z.ZodArray<z.ZodObject<{
232
232
  prompts: z.ZodArray<z.ZodObject<{
233
233
  id: z.ZodString;
@@ -424,12 +424,12 @@ export declare const stageSchemas: {
424
424
  domain: z.ZodString;
425
425
  aliases: z.ZodDefault<z.ZodArray<z.ZodString>>;
426
426
  }, z.core.$strip>;
427
+ moneyPages: z.ZodArray<z.ZodString>;
428
+ productBrief: z.ZodString;
427
429
  agentProbes: z.ZodPrefault<z.ZodObject<{
428
- runsPerPrompt: z.ZodDefault<z.ZodNumber>;
429
430
  maxPromptsPerSection: z.ZodOptional<z.ZodNumber>;
431
+ runsPerPrompt: z.ZodDefault<z.ZodNumber>;
430
432
  }, z.core.$strip>>;
431
- moneyPages: z.ZodArray<z.ZodString>;
432
- productBrief: z.ZodString;
433
433
  sections: z.ZodArray<z.ZodObject<{
434
434
  prompts: z.ZodArray<z.ZodObject<{
435
435
  id: z.ZodString;
@@ -1,11 +1,19 @@
1
1
  import type { CopyValidationOutcome } from '../agents/copy-validation';
2
2
  import type { AeoBrand } from '../schema';
3
3
  import type { ExecutionRecorder } from '../bundle/recorder';
4
+ import type { ModelCallAccounting } from '../models/accounting';
5
+ import type { CodexStageModel } from '../models/profiles';
4
6
  import { type StageValue } from './checks';
5
7
  import { type ResearchServerConfig } from './codex-home';
6
8
  import { type Correction, type StageName } from './schemas';
7
9
  import type { AnswerFile } from './workdir';
8
10
  import type { BatchLayout } from './batch-layout';
11
+ /** Tokens a Codex session reported: cached input is part of input. */
12
+ export type SessionUsage = {
13
+ inputTokens: number;
14
+ cachedInputTokens: number;
15
+ outputTokens: number;
16
+ };
9
17
  export type StageRun = {
10
18
  stage: StageName;
11
19
  model: string;
@@ -13,10 +21,7 @@ export type StageRun = {
13
21
  * `degraded` and their answers carry no judgment from this stage. */
14
22
  ok: boolean;
15
23
  durationMs: number;
16
- usage: {
17
- inputTokens: number;
18
- outputTokens: number;
19
- } | null;
24
+ usage: SessionUsage | null;
20
25
  errors: string[];
21
26
  /** Answer files whose batch never validated: excluded from this stage
22
27
  * and every later one, recorded, never a reason to stop the run. */
@@ -41,7 +46,13 @@ export type StageContext = {
41
46
  ownedDomains?: readonly string[];
42
47
  /** The host stopping the work: sessions are killed and no batch starts. */
43
48
  signal?: AbortSignal;
44
- /** Overrides for tests: the command to run instead of `codex`. */
49
+ /** The model every session runs on (the run's pinned stage model). */
50
+ stageModel: CodexStageModel;
51
+ /** The run's ledger: every session is reserved before it starts and
52
+ * settled from its reported tokens. Absent, sessions are not charged. */
53
+ accounting?: ModelCallAccounting;
54
+ /** Overrides for tests: the command to run instead of the engine's own
55
+ * Codex. */
45
56
  command?: string;
46
57
  timeoutMs?: number;
47
58
  /** Answers per Codex session; the default fits the pinned model. */
@@ -27,13 +27,15 @@ export declare const runPolicySchema: z.ZodObject<{
27
27
  }, z.core.$strip>>;
28
28
  allowPartial: z.ZodDefault<z.ZodBoolean>;
29
29
  budget: z.ZodPrefault<z.ZodObject<{
30
- maxUsd: z.ZodDefault<z.ZodNumber>;
30
+ maxUsd: z.ZodOptional<z.ZodNumber>;
31
31
  maxTokens: z.ZodDefault<z.ZodNumber>;
32
32
  maxHours: z.ZodDefault<z.ZodNumber>;
33
33
  }, z.core.$strict>>;
34
+ checkHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
34
35
  }, z.core.$strict>;
35
36
  export declare const auditFileSchema: z.ZodObject<{
36
37
  version: z.ZodLiteral<1>;
38
+ model: z.ZodOptional<z.ZodString>;
37
39
  brand: z.ZodObject<{
38
40
  name: z.ZodString;
39
41
  domain: z.ZodString;
@@ -77,7 +79,10 @@ export declare const auditFileSchema: z.ZodObject<{
77
79
  agentProbes: z.ZodPrefault<z.ZodObject<{
78
80
  runsPerPrompt: z.ZodDefault<z.ZodNumber>;
79
81
  maxPromptsPerSection: z.ZodOptional<z.ZodNumber>;
80
- }, z.core.$strip>>;
82
+ }, z.core.$strict>>;
83
+ chatProbes: z.ZodOptional<z.ZodObject<{
84
+ runsPerPrompt: z.ZodNumber;
85
+ }, z.core.$strict>>;
81
86
  geography: z.ZodDefault<z.ZodString>;
82
87
  language: z.ZodDefault<z.ZodString>;
83
88
  moneyPages: z.ZodDefault<z.ZodArray<z.ZodURL>>;
@@ -102,10 +107,11 @@ export declare const auditFileSchema: z.ZodObject<{
102
107
  }, z.core.$strip>>;
103
108
  allowPartial: z.ZodDefault<z.ZodBoolean>;
104
109
  budget: z.ZodPrefault<z.ZodObject<{
105
- maxUsd: z.ZodDefault<z.ZodNumber>;
110
+ maxUsd: z.ZodOptional<z.ZodNumber>;
106
111
  maxTokens: z.ZodDefault<z.ZodNumber>;
107
112
  maxHours: z.ZodDefault<z.ZodNumber>;
108
113
  }, z.core.$strict>>;
114
+ checkHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
109
115
  }, z.core.$strict>>;
110
116
  author: z.ZodOptional<z.ZodObject<{
111
117
  runId: z.ZodString;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { readAuthorResearch, type AuthorBrief } from '../codex-workflow/author';
3
+ import type { SupportedModel } from '../models/supported-models';
3
4
  import { type AuditFile, type AuthorReference } from './audit-file';
4
5
  declare const authorRecordSchema: z.ZodObject<{
5
6
  version: z.ZodLiteral<1>;
@@ -17,10 +18,15 @@ export type LocalAuthorResult = {
17
18
  auditFile: string | undefined;
18
19
  research: Awaited<ReturnType<typeof readAuthorResearch>>['summary'];
19
20
  };
20
- /** runLocalAuthor runs the author session over a brief into `dir`. */
21
+ /** runLocalAuthor runs the author session over a brief into `dir`, on
22
+ * `model`, under the approved cap: the draft directory's ledger reserves
23
+ * the research tools' whole search allowance before the session, and the
24
+ * session itself, so neither can take the run past the cap. */
21
25
  export declare const runLocalAuthor: (args: {
22
26
  brief: AuthorBrief;
23
27
  dir: string;
28
+ model: SupportedModel;
29
+ maxUsd: number;
24
30
  secrets: readonly string[];
25
31
  signal?: AbortSignal;
26
32
  }) => Promise<LocalAuthorResult>;
@@ -1,43 +1,53 @@
1
1
  import { z } from 'zod';
2
2
  import type { ModelBudgetLimits } from '../models/accounting';
3
3
  export declare const budgetFile = "BUDGET.json";
4
+ /** What audit.json says: the dollar cap is optional there, because the
5
+ * operator may approve it on the command line instead. */
4
6
  export declare const budgetPolicySchema: z.ZodObject<{
5
- maxUsd: z.ZodDefault<z.ZodNumber>;
7
+ maxUsd: z.ZodOptional<z.ZodNumber>;
6
8
  maxTokens: z.ZodDefault<z.ZodNumber>;
7
9
  maxHours: z.ZodDefault<z.ZodNumber>;
8
10
  }, z.core.$strict>;
9
11
  export type BudgetPolicy = z.infer<typeof budgetPolicySchema>;
12
+ /** The limits a run froze: the cap is always there. */
13
+ declare const frozenPolicySchema: z.ZodObject<{
14
+ maxTokens: z.ZodDefault<z.ZodNumber>;
15
+ maxHours: z.ZodDefault<z.ZodNumber>;
16
+ maxUsd: z.ZodNumber;
17
+ }, z.core.$strict>;
18
+ export type FrozenBudgetPolicy = z.infer<typeof frozenPolicySchema>;
10
19
  /** A --budget-file: the limits to raise; what it leaves out stays. */
11
20
  export declare const budgetAmendmentSchema: z.ZodObject<{
12
- maxUsd: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
13
21
  maxTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
14
22
  maxHours: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
23
+ maxUsd: z.ZodOptional<z.ZodNumber>;
15
24
  }, z.core.$strict>;
16
25
  export type BudgetAmendment = z.infer<typeof budgetAmendmentSchema>;
17
26
  declare const budgetStateSchema: z.ZodObject<{
18
27
  version: z.ZodLiteral<1>;
19
28
  original: z.ZodObject<{
20
- maxUsd: z.ZodDefault<z.ZodNumber>;
21
29
  maxTokens: z.ZodDefault<z.ZodNumber>;
22
30
  maxHours: z.ZodDefault<z.ZodNumber>;
31
+ maxUsd: z.ZodNumber;
23
32
  }, z.core.$strict>;
24
33
  current: z.ZodObject<{
25
- maxUsd: z.ZodDefault<z.ZodNumber>;
26
34
  maxTokens: z.ZodDefault<z.ZodNumber>;
27
35
  maxHours: z.ZodDefault<z.ZodNumber>;
36
+ maxUsd: z.ZodNumber;
28
37
  }, z.core.$strict>;
29
38
  deadlineAt: z.ZodISODateTime;
39
+ model: z.ZodOptional<z.ZodString>;
30
40
  amendments: z.ZodArray<z.ZodObject<{
31
41
  at: z.ZodISODateTime;
32
42
  from: z.ZodObject<{
33
- maxUsd: z.ZodDefault<z.ZodNumber>;
34
43
  maxTokens: z.ZodDefault<z.ZodNumber>;
35
44
  maxHours: z.ZodDefault<z.ZodNumber>;
45
+ maxUsd: z.ZodNumber;
36
46
  }, z.core.$strict>;
37
47
  to: z.ZodObject<{
38
- maxUsd: z.ZodDefault<z.ZodNumber>;
39
48
  maxTokens: z.ZodDefault<z.ZodNumber>;
40
49
  maxHours: z.ZodDefault<z.ZodNumber>;
50
+ maxUsd: z.ZodNumber;
41
51
  }, z.core.$strict>;
42
52
  deadlineFrom: z.ZodISODateTime;
43
53
  deadlineTo: z.ZodISODateTime;
@@ -46,7 +56,8 @@ declare const budgetStateSchema: z.ZodObject<{
46
56
  type BudgetState = z.infer<typeof budgetStateSchema>;
47
57
  export type RunBudget = {
48
58
  limits: ModelBudgetLimits;
49
- policy: BudgetPolicy;
59
+ policy: FrozenBudgetPolicy;
60
+ model: string;
50
61
  /** The amendment this invocation recorded, for the run journal. */
51
62
  amended: BudgetState['amendments'][number] | undefined;
52
63
  /** audit.json asks for other limits than the run froze: reported, never
@@ -55,14 +66,34 @@ export type RunBudget = {
55
66
  };
56
67
  /** readBudgetAmendment reads a --budget-file. */
57
68
  export declare const readBudgetAmendment: (file: string) => Promise<BudgetAmendment>;
58
- /**
59
- * resolveRunBudget returns the limits a run executes under: frozen from
60
- * audit.json on the first run, kept on every resume, raised only by an
61
- * amendment. An amendment that lowers a limit is refused: the ledger may
62
- * already hold more than the lower limit.
63
- */
64
- export declare const resolveRunBudget: (dir: string, policy: BudgetPolicy, { amendment, now, }?: {
69
+ /** Thrown before any paid work when a new run has no approved cap. */
70
+ export declare class BudgetCapMissingError extends Error {
71
+ constructor(message: string);
72
+ }
73
+ /** Thrown before any paid work when audit.json names another model than
74
+ * the run directory froze. */
75
+ export declare class RunModelChangedError extends Error {
76
+ constructor(message: string);
77
+ }
78
+ /** readFrozenBudget reads a run directory's BUDGET.json; undefined when
79
+ * the directory has not started. Read-only. */
80
+ export declare const readFrozenBudget: (dir: string) => Promise<BudgetState | undefined>;
81
+ type ResolveRunBudgetOptions = {
82
+ /** The gateway model audit.json resolves to. */
83
+ model: string;
84
+ /** The cap approved on the command line (`--max-usd`). On a new run it
85
+ * sets the cap; on a resume it raises it, recorded like a --budget-file. */
86
+ maxUsd?: number;
65
87
  amendment?: BudgetAmendment;
66
88
  now?: () => Date;
67
- }) => Promise<RunBudget>;
89
+ };
90
+ /**
91
+ * resolveRunBudget returns the limits and the model a run executes under:
92
+ * frozen from audit.json (and --max-usd) on the first run, kept on every
93
+ * resume, raised only by an amendment. A new run without a dollar cap is
94
+ * refused, as is a resume whose audit.json names another model. An
95
+ * amendment that lowers a limit is refused: the ledger may already hold
96
+ * more than the lower limit.
97
+ */
98
+ export declare const resolveRunBudget: (dir: string, policy: BudgetPolicy, { model, maxUsd, amendment, now }: ResolveRunBudgetOptions) => Promise<RunBudget>;
68
99
  export {};
@@ -0,0 +1,40 @@
1
+ import { type Range } from '../models/cost-coefficients';
2
+ import type { SupportedModel } from '../models/supported-models';
3
+ import type { RunPlan } from '../runner';
4
+ export type CostRange = Range<number>;
5
+ export type RunCostEstimate = {
6
+ currency: 'USD';
7
+ /** An estimate, labelled as such wherever it is shown. */
8
+ kind: 'estimate';
9
+ model: string;
10
+ coefficientsVersion: number;
11
+ low: number;
12
+ high: number;
13
+ categories: {
14
+ probes: CostRange;
15
+ stages: CostRange;
16
+ hostCalls: CostRange;
17
+ search: CostRange;
18
+ };
19
+ /** The cap to propose to the operator: the high end, rounded up. */
20
+ recommendedCapUsd: number;
21
+ };
22
+ export type AuthorCostEstimate = Omit<RunCostEstimate, 'categories'> & {
23
+ categories: {
24
+ stages: CostRange;
25
+ search: CostRange;
26
+ };
27
+ };
28
+ type EstimateRunOptions = {
29
+ plan: Pick<RunPlan, 'units' | 'probesBySurface'>;
30
+ model: SupportedModel;
31
+ grounding: 'full' | 'extraction_only';
32
+ };
33
+ /** estimateRunCost estimates a whole run as planned; a resume spends less,
34
+ * because banked answers are never probed again. */
35
+ export declare const estimateRunCost: ({ plan, model, grounding, }: EstimateRunOptions) => RunCostEstimate;
36
+ /** estimateAuthorCost estimates one author session and its research. */
37
+ export declare const estimateAuthorCost: (model: SupportedModel) => AuthorCostEstimate;
38
+ /** One line a person reads: "$12.40 to $38.10 (estimate)". */
39
+ export declare const describeCostRange: (range: CostRange) => string;
40
+ export {};
@@ -2,6 +2,7 @@ import { type ExecutionRecorder } from '../bundle/recorder';
2
2
  import { type WriterLock } from '../bundle/writer-lock';
3
3
  import type { GroundRun } from '../codex-workflow/finish';
4
4
  import { type RunSource } from '../codex-workflow/run-source';
5
+ import { type ModelCallAccounting } from '../models/accounting';
5
6
  import type { InternalModelContext } from '../models/context';
6
7
  import { type RunPlan } from '../runner';
7
8
  import type { AeoAuditConfig, RunRequest } from '../schema';
@@ -38,6 +39,9 @@ export type LocalRun = {
38
39
  /** The run's pinned model context: every host call charges its ledger
39
40
  * and is recorded in the run journal. */
40
41
  internalModels: InternalModelContext;
42
+ /** The same ledger unwrapped, for the Codex sessions, which the journal
43
+ * records as operations of their own. */
44
+ ledger: ModelCallAccounting;
41
45
  ground: GroundRun;
42
46
  /** The directory's writer lock and its run journal, held from before the
43
47
  * first canary: the workflow continues under both (prepareWorkdir held). */
@@ -57,6 +61,8 @@ export type LocalRun = {
57
61
  */
58
62
  export declare const openLocalRun: (file: AuditFile, dir: string, options?: {
59
63
  signal?: AbortSignal;
64
+ /** The cap approved on the command line (`run --max-usd`). */
65
+ maxUsd?: number;
60
66
  amendment?: BudgetAmendment;
61
67
  derivedFromRunId?: string;
62
68
  }) => Promise<LocalRun>;
@@ -17,11 +17,18 @@ export declare const agentAuthMode: (surface: AeoAgentSurface, settings: Setting
17
17
  } | {
18
18
  kind: "cli_session";
19
19
  };
20
+ /** The model audit.json names, or the recommended one: refused when it is
21
+ * not on the supported list, which the detail then prints. */
22
+ export declare const modelCheck: (model: string | undefined) => PreflightCheck;
20
23
  /** runPreflight checks what a run over these surfaces needs locally. */
21
24
  export declare const runPreflight: (args: {
22
25
  surfaces: readonly AeoSurface[];
23
26
  settings: Settings;
24
27
  dir: string;
28
+ /** audit.json's `model`; absent means the recommended model. */
29
+ model?: string;
25
30
  /** Full grounding researches through the pinned search provider. */
26
31
  groundingSearch?: boolean;
32
+ /** Money pages are rendered in Chromium by the renderability check. */
33
+ rendersPages?: boolean;
27
34
  }) => Promise<PreflightCheck[]>;
@@ -3,6 +3,8 @@ export type EngineResources = {
3
3
  root: string;
4
4
  author: string;
5
5
  editorial: string;
6
+ /** The operator guide `literally-aeo guide` prints. */
7
+ guide: string;
6
8
  };
7
9
  /** engineResources finds the resources of the running engine. */
8
10
  export declare const engineResources: () => Promise<EngineResources>;
@@ -27,10 +27,11 @@ export type RecordedAuthorEvidence = z.infer<typeof authorEvidenceSchema>;
27
27
  /** readRecordedAuthorEvidence reads what a run recorded about how its
28
28
  * configuration came to be; a run from before the record says manual. */
29
29
  export declare const readRecordedAuthorEvidence: (dir: string) => Promise<RecordedAuthorEvidence | undefined>;
30
- /** recordRunConfiguration writes the run's audit.json and author evidence
31
- * into its directory, replacing what an earlier invocation wrote. */
32
- export declare const recordRunConfiguration: ({ dir, configFile, evidence, }: {
30
+ export declare const recordRunConfiguration: ({ dir, configFile, evidence, model, }: {
33
31
  dir: string;
34
32
  configFile: string;
35
33
  evidence: RecordedAuthorEvidence;
34
+ /** A model named outside the file (`rejudge --model`): the recorded
35
+ * configuration is the one the run ran with, not the file's. */
36
+ model?: string;
36
37
  }) => Promise<void>;