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
@@ -0,0 +1,112 @@
1
+ import { z } from 'zod';
2
+ import {
3
+ codexStageModelSchema,
4
+ internalModelRoleSchema,
5
+ modelPricingSchema,
6
+ } from './profiles';
7
+
8
+ // ============================================================================
9
+ // The models a local run may judge, research and write with
10
+ // (specs/aeo-claude-operator-spec.md §4.1): one gateway model runs every
11
+ // text role and the Codex stages. Each entry holds public facts only (list
12
+ // prices with the date they were checked, the context window, the output
13
+ // ceiling) and what the engine has verified about it. Adding or changing a
14
+ // model is a release of the package; a run records the profile built from
15
+ // the entry it resolved (src/models/local-profile.ts).
16
+ // ============================================================================
17
+
18
+ export const supportedModelSchema = z
19
+ .object({
20
+ /** The gateway model ID, as audit.json's `model` names it. */
21
+ id: z.string().min(1),
22
+ label: z.string().min(1),
23
+ pricingUsdPerMillion: modelPricingSchema,
24
+ pricingCheckedAt: z.iso.date(),
25
+ contextWindow: z.number().int().positive(),
26
+ maxOutputTokens: z.number().int().positive(),
27
+ /** The model's hidden reasoning is billed inside the output allowance,
28
+ * so every role is given room to think on top of its answer. */
29
+ thinkingInOutput: z.boolean(),
30
+ providerOptions: internalModelRoleSchema.shape.providerOptions,
31
+ stageReasoningEffort: codexStageModelSchema.shape.reasoningEffort,
32
+ /** The date a real batch ran through the gateway on Codex's Responses
33
+ * wire API with this model (the spike, spec §4.3); null until then. */
34
+ stageRuntimeVerifiedAt: z.iso.date().nullable(),
35
+ })
36
+ .strict();
37
+
38
+ export type SupportedModel = z.infer<typeof supportedModelSchema>;
39
+
40
+ export const supportedModels: readonly SupportedModel[] = [
41
+ {
42
+ id: 'anthropic/claude-opus-5.5',
43
+ label: 'Claude Opus 5.5',
44
+ pricingUsdPerMillion: { input: 4, output: 20, cachedInput: 0.2 },
45
+ pricingCheckedAt: '2026-11-04',
46
+ contextWindow: 1_000_000,
47
+ maxOutputTokens: 128_000,
48
+ thinkingInOutput: true,
49
+ providerOptions: { gateway: { reasoning: { effort: 'high' } } },
50
+ stageReasoningEffort: 'high',
51
+ stageRuntimeVerifiedAt: '2026-11-04',
52
+ },
53
+ {
54
+ id: 'anthropic/claude-sonnet-5.5',
55
+ label: 'Claude Sonnet 5.5',
56
+ pricingUsdPerMillion: { input: 2, output: 10, cachedInput: 0.2 },
57
+ pricingCheckedAt: '2026-11-04',
58
+ contextWindow: 1_000_000,
59
+ maxOutputTokens: 128_000,
60
+ thinkingInOutput: true,
61
+ providerOptions: { gateway: { reasoning: { effort: 'high' } } },
62
+ stageReasoningEffort: 'high',
63
+ stageRuntimeVerifiedAt: '2026-11-04',
64
+ },
65
+ ];
66
+
67
+ /** The model a run uses when audit.json names none: the strongest the
68
+ * engine supports, because judgment and copy quality are the report. */
69
+ export const recommendedModelId = 'anthropic/claude-opus-5.5';
70
+
71
+ /** The supported models as a list a person or an agent can read. */
72
+ export const describeSupportedModels = (): string[] => {
73
+ const lines = supportedModels.map((model) => {
74
+ const { input, cachedInput, output } = model.pricingUsdPerMillion;
75
+ const recommended = model.id === recommendedModelId ? ' (recommended)' : '';
76
+
77
+ return `${model.id}${recommended}: ${model.label}, $${input} in / $${cachedInput} cached / $${output} out per million tokens (checked ${model.pricingCheckedAt})`;
78
+ });
79
+
80
+ return lines;
81
+ };
82
+
83
+ /** findSupportedModel returns the list's entry for a gateway model ID. */
84
+ export const findSupportedModel = (id: string): SupportedModel | undefined => {
85
+ return supportedModels.find((model) => model.id === id);
86
+ };
87
+
88
+ export class UnsupportedModelError extends Error {
89
+ constructor(id: string) {
90
+ super(
91
+ [
92
+ `${id} is not a supported model. Set audit.json's "model" to one of:`,
93
+ ...describeSupportedModels().map((line) => ` ${line}`),
94
+ ].join('\n'),
95
+ );
96
+ this.name = 'UnsupportedModelError';
97
+ }
98
+ }
99
+
100
+ /** resolveSupportedModel returns the entry a run uses: the named model, or
101
+ * the recommended one when none is named. An unknown ID is refused. */
102
+ export const resolveSupportedModel = (
103
+ id: string = recommendedModelId,
104
+ ): SupportedModel => {
105
+ const model = findSupportedModel(id);
106
+
107
+ if (!model) {
108
+ throw new UnsupportedModelError(id);
109
+ }
110
+
111
+ return model;
112
+ };
package/src/pipeline.ts CHANGED
@@ -7,9 +7,10 @@ import type {
7
7
  AeoSurface,
8
8
  AeoVisibility,
9
9
  AgentProbeConfig,
10
+ ChatProbeConfig,
10
11
  RetrievalLog,
11
12
  } from './schema';
12
- import { isAgentSurface } from './schema';
13
+ import { agentProbedPrompts, isAgentSurface } from './schema';
13
14
  import { createLog } from './lib/log';
14
15
  import {
15
16
  aiSearchProbeModels,
@@ -129,6 +130,8 @@ export type SectionRunArgs = {
129
130
  // and how many of the section's prompts get agent probes. Always present —
130
131
  // the config schema fills the canonical default.
131
132
  agentProbes: AgentProbeConfig;
133
+ // Chat probe volume; undefined = the canonical surfaceRunCounts.
134
+ chatProbes: ChatProbeConfig | undefined;
132
135
  agentCliVersions: AgentCliVersions;
133
136
  // The run every fresh capture and analysis is stamped with (§4.2).
134
137
  runId: string;
@@ -243,13 +246,9 @@ export const captureSectionProbes = async (
243
246
 
244
247
  // Agent probes may cover a configured subset of prompts (the first N in
245
248
  // config order) at a configured run count; the chat batch always covers
246
- // every prompt at the canonical counts.
249
+ // every prompt, at the configured chat depth.
247
250
  const agentRunsPerPrompt = args.agentProbes.runsPerPrompt;
248
- const agentPrompts = args.agentProbes.maxPromptsPerSection
249
- ? args.prompts.slice(0, args.agentProbes.maxPromptsPerSection)
250
- : args.prompts;
251
-
252
- const agentPromptInputs = promptInputs.slice(0, agentPrompts.length);
251
+ const agentPromptInputs = agentProbedPrompts(promptInputs, args.agentProbes);
253
252
 
254
253
  // Store resume: split the section's planned units into cached hits
255
254
  // (reused as-is) and missing keys (the only units the probe batches run).
@@ -258,6 +257,7 @@ export const captureSectionProbes = async (
258
257
  prompts: args.prompts,
259
258
  surfaces: args.surfaces,
260
259
  agentProbes: args.agentProbes,
260
+ chatProbes: args.chatProbes,
261
261
  });
262
262
 
263
263
  const unitByKey = new Map<string, ProbeUnit>();
@@ -332,6 +332,11 @@ export const captureSectionProbes = async (
332
332
  captureMetadata: {
333
333
  requestedModel: requestedModelOf(probe),
334
334
  reportedModel: probe.reportedModel ?? null,
335
+ // Progress comparisons hash these into each answer's collection
336
+ // method, so they stay as earlier releases recorded them. Chat
337
+ // depth is left out: it does not change how one answer is
338
+ // collected, and a depth difference already shows as a scope
339
+ // change.
335
340
  parameters: {
336
341
  geography: args.geography,
337
342
  language: args.language,
@@ -367,6 +372,7 @@ export const captureSectionProbes = async (
367
372
  language: args.language,
368
373
  prompts: promptInputs,
369
374
  surfaces: selectedChatSurfaces,
375
+ chatProbes: args.chatProbes,
370
376
  filter: shouldRun,
371
377
  onResult: bank,
372
378
  trace,
@@ -14,6 +14,7 @@ import { agentSurfaces, surfaceRunCounts, retrievalLogSchema } from '../schema';
14
14
  import { createLog } from '../lib/log';
15
15
  import { isRecord } from '../lib/type-guards';
16
16
  import { getEnvironment, readEnv } from '../lib/env';
17
+ import { codexArgs, resolveCodexBinary } from '../codex-workflow/codex-binary';
17
18
  import type { ProbePromptInput, ProbeResult } from './probes';
18
19
  import {
19
20
  AgentStreamError,
@@ -321,6 +322,23 @@ const probeForSurface = (surface: AeoAgentSurface): AgentProbeFn => {
321
322
  }
322
323
  };
323
324
 
325
+ /** What to spawn for an agent CLI on this machine. Codex is this package's
326
+ * own pinned dependency (specs/aeo-claude-operator-spec.md §4.3), run with
327
+ * the operator's Codex login when it is measured; the others come from
328
+ * PATH. */
329
+ const localCommand = (
330
+ command: string,
331
+ args: readonly string[],
332
+ ): { command: string; args: string[] } => {
333
+ if (command !== 'codex') {
334
+ return { command, args: [...args] };
335
+ }
336
+
337
+ const binary = resolveCodexBinary();
338
+
339
+ return { command: binary.command, args: codexArgs(binary, args) };
340
+ };
341
+
324
342
  const cliVersion = async (
325
343
  command: string,
326
344
  args: string[],
@@ -340,7 +358,10 @@ const cliVersion = async (
340
358
  requireWorkerTransport();
341
359
  }
342
360
 
343
- const { stdout } = await execFileAsync(command, args, { timeout: 15_000 });
361
+ const local = localCommand(command, args);
362
+ const { stdout } = await execFileAsync(local.command, local.args, {
363
+ timeout: 15_000,
364
+ });
344
365
 
345
366
  return stdout.trim().split('\n')[0] ?? null;
346
367
  } catch {
@@ -502,9 +523,8 @@ export const runAgentProbesForPrompts = async (args: {
502
523
  prompts: ProbePromptInput[];
503
524
  surfaces?: readonly AeoAgentSurface[];
504
525
  versions: AgentCliVersions;
505
- // Runs per prompt per surface — defaults to the canonical surfaceRunCounts
506
- // value; report configs may lower it to shrink the agent batch (spec §5,
507
- // revised 2026-08-21).
526
+ // Runs per prompt per surface: the config's agentProbes depth (spec §5,
527
+ // revised 2026-08-21). Omitted = the canonical surfaceRunCounts value.
508
528
  runsPerPrompt?: number;
509
529
  // Unit-level gate for store resume: return false to skip a planned
510
530
  // (prompt × surface × run) execution. Omitted = run everything.
@@ -1218,7 +1238,8 @@ const execCli = async (
1218
1238
  command: string,
1219
1239
  { cliArgs, cwd, runtime, env, signal }: ExecCliOptions,
1220
1240
  ): Promise<CliOutput> => {
1221
- const result = await runChild(command, cliArgs, {
1241
+ const local = localCommand(command, cliArgs);
1242
+ const result = await runChild(local.command, local.args, {
1222
1243
  cwd,
1223
1244
  env,
1224
1245
  timeoutMs: runtime.timeoutMs ?? agentProbeTimeoutMs,
@@ -0,0 +1,87 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import {
3
+ ModelBudgetError,
4
+ type ModelCallAccounting,
5
+ } from '../models/accounting';
6
+ import { probeUsd } from '../models/cost-coefficients';
7
+ import type { ProbeTrace } from './probe-trace';
8
+
9
+ // ============================================================================
10
+ // Probes on the run's ledger (specs/aeo-claude-operator-spec.md §4.2): every
11
+ // probe attempt is reserved at its surface's high estimate before it is
12
+ // dispatched and settled with the cost the gateway reported; one that
13
+ // reported none keeps charging its estimate. An attempt the cap cannot afford is never
14
+ // dispatched; the run learns of it through `exhausted` and stops resumable,
15
+ // with every answer captured so far banked.
16
+ // ============================================================================
17
+
18
+ export type ChargedTrace = {
19
+ trace: ProbeTrace;
20
+ /** The first refusal of the cap, once an attempt was refused. */
21
+ exhausted: () => ModelBudgetError | undefined;
22
+ };
23
+
24
+ export const chargedProbeTrace = (
25
+ trace: ProbeTrace,
26
+ ledger: ModelCallAccounting,
27
+ ): ChargedTrace => {
28
+ let refused: ModelBudgetError | undefined;
29
+
30
+ const charged: ProbeTrace = {
31
+ start: async (attempt) => {
32
+ const estimateUsd = probeUsd[attempt.surface].high;
33
+ const callId = `probe:${attempt.surface}:${attempt.promptId}:${attempt.runIndex}:${attempt.attempt}:${randomUUID()}`;
34
+ // The coding-agent surfaces run on the operator's own login.
35
+ const isPaid = estimateUsd > 0;
36
+
37
+ if (isPaid) {
38
+ try {
39
+ await ledger.reserve({
40
+ callId,
41
+ role: `probe:${attempt.surface}`,
42
+ ...(attempt.requestedModel !== null && {
43
+ requestedModel: attempt.requestedModel,
44
+ }),
45
+ reservedUsd: estimateUsd,
46
+ inputTokens: 0,
47
+ maxOutputTokens: 0,
48
+ });
49
+ } catch (error) {
50
+ if (error instanceof ModelBudgetError) {
51
+ refused ??= error;
52
+ }
53
+
54
+ throw error;
55
+ }
56
+ }
57
+
58
+ const handle = await trace.start(attempt);
59
+
60
+ return {
61
+ id: handle.id,
62
+ end: async (result) => {
63
+ await handle.end(result);
64
+
65
+ if (!isPaid) {
66
+ return;
67
+ }
68
+
69
+ const reportedUsd =
70
+ result.outcome === 'succeeded' ? result.costUsd : undefined;
71
+
72
+ // Without a reported cost the call keeps charging its estimate,
73
+ // and the ledger records no cost the provider did not report.
74
+ await ledger.settle(callId, {
75
+ ...(attempt.requestedModel !== null && {
76
+ requestedModel: attempt.requestedModel,
77
+ }),
78
+ ...(reportedUsd !== undefined && { costUsd: reportedUsd }),
79
+ ...(result.outcome !== 'succeeded' && { valid: false }),
80
+ });
81
+ },
82
+ };
83
+ },
84
+ };
85
+
86
+ return { trace: charged, exhausted: () => refused };
87
+ };
@@ -29,6 +29,8 @@ export type ProbeAttemptEnd =
29
29
  requestedModel: string | null;
30
30
  reportedModel?: string;
31
31
  noOverview?: true;
32
+ /** What the provider reported the attempt cost, when it did. */
33
+ costUsd?: number;
32
34
  }
33
35
  | {
34
36
  outcome: 'failed' | 'cancelled';
@@ -3,11 +3,17 @@ import { gateway } from '@ai-sdk/gateway';
3
3
  import { openai } from '@ai-sdk/openai';
4
4
  import { google } from '@ai-sdk/google';
5
5
  import { anthropic } from '@ai-sdk/anthropic';
6
- import type { AeoChatSurface, AeoSurface, RetrievalLog } from '../schema';
7
- import { chatSurfaces, surfaceRunCounts } from '../schema';
6
+ import type {
7
+ AeoChatSurface,
8
+ AeoSurface,
9
+ ChatProbeConfig,
10
+ RetrievalLog,
11
+ } from '../schema';
12
+ import { chatRunsPerPrompt, chatSurfaces } from '../schema';
8
13
  import { surfaceRetrievalExposure } from '../retrieval';
9
14
  import { createLog } from '../lib/log';
10
15
  import { servedModelOf } from '../models/served-model';
16
+ import { isObject } from '../lib/type-guards';
11
17
  import {
12
18
  endAttempt,
13
19
  ProbeTraceError,
@@ -114,6 +120,9 @@ export type ProbeJob = {
114
120
  // Which chat surfaces to run — defaults to all five. Lets `--surfaces`
115
121
  // iterate cheaply without touching the canonical run counts.
116
122
  surfaces?: readonly AeoChatSurface[];
123
+ // Runs per prompt; undefined = the canonical surfaceRunCounts. Must be
124
+ // the depth the plan was built with, or resume and scoring disagree.
125
+ chatProbes: ChatProbeConfig | undefined;
117
126
  // Unit-level gate for store resume: return false to skip a planned
118
127
  // (prompt × surface × run) execution. Omitted = run everything.
119
128
  filter?: (unit: {
@@ -141,6 +150,36 @@ type ProbeAnswer = {
141
150
  retrieval: RetrievalLog | null;
142
151
  noOverview?: true;
143
152
  reportedModel?: string;
153
+ /** What the gateway reported the probe's calls cost; absent when it did
154
+ * not say. The ledger then settles the probe at its estimate. */
155
+ reportedCostUsd?: number;
156
+ };
157
+
158
+ /** The cost the gateway reports in a response's provider metadata. */
159
+ const gatewayCostOf = (metadata: unknown): number | undefined => {
160
+ const cost =
161
+ isObject(metadata) && isObject(metadata.gateway)
162
+ ? metadata.gateway.cost
163
+ : undefined;
164
+ const usd = typeof cost === 'string' && cost.trim() ? Number(cost) : cost;
165
+
166
+ return typeof usd === 'number' && Number.isFinite(usd) && usd >= 0
167
+ ? usd
168
+ : undefined;
169
+ };
170
+
171
+ /** The reported costs of a probe's calls, summed; absent unless every call
172
+ * reported one. */
173
+ const reportedCostOf = (
174
+ costs: readonly (number | undefined)[],
175
+ ): { reportedCostUsd?: number } => {
176
+ if (costs.some((cost) => cost === undefined)) {
177
+ return {};
178
+ }
179
+
180
+ return {
181
+ reportedCostUsd: costs.reduce<number>((sum, cost) => sum + (cost ?? 0), 0),
182
+ };
144
183
  };
145
184
 
146
185
  type ProbeModelConfig = {
@@ -289,11 +328,14 @@ const runSearchRequiredProbe = async (args: {
289
328
  retrieval = null;
290
329
  }
291
330
 
331
+ const firstCost = gatewayCostOf(first.providerMetadata);
332
+
292
333
  if (first.text.trim().length > 0) {
293
334
  return {
294
335
  text: withProbeSources(first.text, first.sources),
295
336
  retrieval,
296
337
  ...served,
338
+ ...reportedCostOf([firstCost]),
297
339
  };
298
340
  }
299
341
 
@@ -329,9 +371,10 @@ const runSearchRequiredProbe = async (args: {
329
371
  abortSignal: AbortSignal.timeout(chatProbeTimeoutMs),
330
372
  });
331
373
 
332
- const [followupText, followupSources] = await Promise.all([
374
+ const [followupText, followupSources, followupMetadata] = await Promise.all([
333
375
  followupStream.text,
334
376
  followupStream.sources,
377
+ followupStream.providerMetadata,
335
378
  ]).catch((error: unknown) => {
336
379
  throw followupFailure ?? error;
337
380
  });
@@ -346,6 +389,7 @@ const runSearchRequiredProbe = async (args: {
346
389
  ),
347
390
  retrieval,
348
391
  ...served,
392
+ ...reportedCostOf([firstCost, gatewayCostOf(followupMetadata)]),
349
393
  };
350
394
  }
351
395
 
@@ -365,18 +409,23 @@ const unexposedRetrieval = (surface: AeoChatSurface): RetrievalLog => {
365
409
  return { exposure: surfaceRetrievalExposure[surface], calls: [] };
366
410
  };
367
411
 
368
- // Builds the 5-surface probe configuration. The list and per-surface run
369
- // counts are the canonical console behavior — run counts live in
370
- // surfaceRunCounts (schema.ts) so scoring denominators stay in sync.
412
+ // Builds the 5-surface probe configuration. Run counts come from
413
+ // chatRunsPerPrompt (schema.ts), the rule the plan and the scoring
414
+ // denominators read too.
371
415
  const buildProbeModels = (args: {
372
416
  geography: string;
373
417
  language: string;
374
418
  surfaces: readonly AeoChatSurface[];
419
+ chatProbes: ChatProbeConfig | undefined;
375
420
  }): ProbeModelConfig[] => {
421
+ const runsOn = (surface: AeoChatSurface) => {
422
+ return chatRunsPerPrompt(surface, args.chatProbes);
423
+ };
424
+
376
425
  const all: ProbeModelConfig[] = [
377
426
  {
378
427
  name: 'chatgpt',
379
- runs: surfaceRunCounts.chatgpt,
428
+ runs: runsOn('chatgpt'),
380
429
  provider: 'gateway',
381
430
  probe: async (promptText) => {
382
431
  return runSearchRequiredProbe({
@@ -390,7 +439,7 @@ const buildProbeModels = (args: {
390
439
  },
391
440
  {
392
441
  name: 'gemini',
393
- runs: surfaceRunCounts.gemini,
442
+ runs: runsOn('gemini'),
394
443
  provider: 'gateway',
395
444
  probe: async (promptText) => {
396
445
  return runSearchRequiredProbe({
@@ -405,7 +454,7 @@ const buildProbeModels = (args: {
405
454
  },
406
455
  {
407
456
  name: 'claude',
408
- runs: surfaceRunCounts.claude,
457
+ runs: runsOn('claude'),
409
458
  provider: 'gateway',
410
459
  probe: async (promptText) => {
411
460
  return runSearchRequiredProbe({
@@ -421,7 +470,7 @@ const buildProbeModels = (args: {
421
470
  },
422
471
  {
423
472
  name: 'perplexity',
424
- runs: surfaceRunCounts.perplexity,
473
+ runs: runsOn('perplexity'),
425
474
  provider: 'gateway',
426
475
  probe: async (promptText) => {
427
476
  // Perplexity cites with bare numeric markers ([1], [2]) and returns
@@ -443,8 +492,14 @@ const buildProbeModels = (args: {
443
492
  stream.text,
444
493
  stream.sources,
445
494
  stream.response,
495
+ stream.providerMetadata,
446
496
  ])
447
- .then(([text, sources, response]) => ({ text, sources, response }))
497
+ .then(([text, sources, response, providerMetadata]) => ({
498
+ text,
499
+ sources,
500
+ response,
501
+ providerMetadata,
502
+ }))
448
503
  .catch((error: unknown) => {
449
504
  throw streamFailure ?? error;
450
505
  });
@@ -465,12 +520,13 @@ const buildProbeModels = (args: {
465
520
  text: withProbeSources(result.text, result.sources),
466
521
  retrieval: unexposedRetrieval('perplexity'),
467
522
  ...(reportedModel === undefined ? {} : { reportedModel }),
523
+ ...reportedCostOf([gatewayCostOf(result.providerMetadata)]),
468
524
  };
469
525
  },
470
526
  },
471
527
  {
472
528
  name: 'google_ai_overview',
473
- runs: surfaceRunCounts.google_ai_overview,
529
+ runs: runsOn('google_ai_overview'),
474
530
  provider: 'dataforseo',
475
531
  probe: async (promptText) => {
476
532
  const retrieval = unexposedRetrieval('google_ai_overview');
@@ -563,6 +619,7 @@ export const runProbesForPrompts = async (
563
619
  geography: job.geography,
564
620
  language: job.language,
565
621
  surfaces: job.surfaces ?? chatSurfaces,
622
+ chatProbes: job.chatProbes,
566
623
  });
567
624
 
568
625
  const limiter = job.limiter ?? unlimited();
@@ -744,6 +801,9 @@ const runChatUnit = async (
744
801
  requestedModel: chatProbeRequestedModel(model.name),
745
802
  ...(answer.reportedModel ? { reportedModel: answer.reportedModel } : {}),
746
803
  ...(answer.noOverview ? { noOverview: true as const } : {}),
804
+ ...(answer.reportedCostUsd === undefined
805
+ ? {}
806
+ : { costUsd: answer.reportedCostUsd }),
747
807
  });
748
808
 
749
809
  if (unrecorded !== null) {
@@ -21,7 +21,6 @@ export {
21
21
  chatSurfaces,
22
22
  surfaceRunCounts,
23
23
  isAgentSurface,
24
- plannedRunsPerPrompt,
25
24
  } from './surfaces';
26
25
  export type { AeoAgentSurface, AeoChatSurface, AeoSurface } from './surfaces';
27
26
 
@@ -298,6 +297,10 @@ export const aeoTechnicalChecksSchema = z.object({
298
297
  robotsUrl: z.string(),
299
298
  fetchedAt: z.string(),
300
299
  robotsFetchError: z.string().nullable(),
300
+ // True when robots.txt ran past the 500 KiB RFC 9309 asks a reader to
301
+ // parse: the verdicts rest on that prefix. Absent on snapshots written
302
+ // before the bound existed.
303
+ robotsTruncated: z.boolean().optional(),
301
304
  bots: z.array(
302
305
  z.object({
303
306
  bot: z.string(),
@@ -44,8 +44,10 @@ export const isAgentSurface = (surface: string): surface is AeoAgentSurface => {
44
44
 
45
45
  // Runs per prompt per surface — canonical (2/2/2/2/1 for the chat surfaces,
46
46
  // matching the console exactly; 2 each for the agent CLIs per spec §5).
47
- // Consumers compute planned-run denominators from this table, so a captured-
48
- // answer shortfall lowers share of voice instead of hiding.
47
+ // The default depth: a config's chatProbes and agentProbes override it, and
48
+ // runsPerPromptOn (schema.ts) is the rule every planned-run denominator
49
+ // reads, so a captured-answer shortfall lowers share of voice instead of
50
+ // hiding.
49
51
  export const surfaceRunCounts: Readonly<Record<AeoSurface, number>> = {
50
52
  chatgpt: 2,
51
53
  gemini: 2,
@@ -56,9 +58,3 @@ export const surfaceRunCounts: Readonly<Record<AeoSurface, number>> = {
56
58
  codex: 2,
57
59
  cursor: 2,
58
60
  };
59
-
60
- export const plannedRunsPerPrompt = (
61
- surfaces: readonly AeoSurface[],
62
- ): number => {
63
- return surfaces.reduce((sum, surface) => sum + surfaceRunCounts[surface], 0);
64
- };
package/src/runner.ts CHANGED
@@ -127,6 +127,7 @@ export const planRun = (
127
127
  prompts: section.prompts,
128
128
  surfaces,
129
129
  agentProbes: config.agentProbes,
130
+ chatProbes: config.chatProbes,
130
131
  }),
131
132
  );
132
133