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
@@ -6,42 +6,59 @@ import type { ModelBudgetLimits } from '../models/accounting';
6
6
  import { hasErrorCode } from '../stores/fs-errors';
7
7
 
8
8
  // ============================================================================
9
- // A local run's budget (specs/aeo-open-source-cli-spec.md §6): finite dollar,
10
- // token and time allowances, frozen with the run and kept across restarts.
11
- // Editing audit.json never amends a run in progress; raising a limit is an
12
- // explicit, recorded `run --budget-file`. The ledger itself (reservations
13
- // and settlements) lives beside it in BANK/, so spending is never reset.
9
+ // A local run's budget (specs/aeo-open-source-cli-spec.md §6,
10
+ // specs/aeo-claude-operator-spec.md §4.2): finite dollar, token and time
11
+ // allowances, frozen with the run and its model and kept across restarts.
12
+ // The dollar cap is the amount the operator approved: there is no default,
13
+ // and a run without one does not start. Editing audit.json never amends a
14
+ // run in progress; raising a limit is an explicit, recorded amendment. The
15
+ // ledger itself (reservations and settlements of every paid call) lives
16
+ // beside it in BANK/, so spending is never reset.
14
17
  // ============================================================================
15
18
 
16
19
  export const budgetFile = 'BUDGET.json';
17
20
 
21
+ const maxUsdSchema = z.number().finite().positive();
22
+
23
+ /** What audit.json says: the dollar cap is optional there, because the
24
+ * operator may approve it on the command line instead. */
18
25
  export const budgetPolicySchema = z
19
26
  .object({
20
- maxUsd: z.number().finite().positive().default(10),
21
- maxTokens: z.number().int().positive().default(5_000_000),
22
- maxHours: z.number().finite().positive().max(72).default(6),
27
+ maxUsd: maxUsdSchema.optional(),
28
+ // A backstop against a runaway loop; the dollar cap is the approval.
29
+ maxTokens: z.number().int().positive().default(100_000_000),
30
+ maxHours: z.number().finite().positive().max(72).default(12),
23
31
  })
24
32
  .strict();
25
33
 
26
34
  export type BudgetPolicy = z.infer<typeof budgetPolicySchema>;
27
35
 
36
+ /** The limits a run froze: the cap is always there. */
37
+ const frozenPolicySchema = budgetPolicySchema.extend({ maxUsd: maxUsdSchema });
38
+
39
+ export type FrozenBudgetPolicy = z.infer<typeof frozenPolicySchema>;
40
+
28
41
  /** A --budget-file: the limits to raise; what it leaves out stays. */
29
- export const budgetAmendmentSchema = budgetPolicySchema.partial().strict();
42
+ export const budgetAmendmentSchema = frozenPolicySchema.partial().strict();
30
43
 
31
44
  export type BudgetAmendment = z.infer<typeof budgetAmendmentSchema>;
32
45
 
33
46
  const budgetStateSchema = z
34
47
  .object({
35
48
  version: z.literal(1),
36
- original: budgetPolicySchema,
37
- current: budgetPolicySchema,
49
+ original: frozenPolicySchema,
50
+ current: frozenPolicySchema,
38
51
  deadlineAt: z.iso.datetime(),
52
+ /** The gateway model the run judges and writes with, frozen with the
53
+ * budget. Absent on a directory from before model selection: the first
54
+ * resume records the model it continues with. */
55
+ model: z.string().min(1).optional(),
39
56
  amendments: z.array(
40
57
  z
41
58
  .object({
42
59
  at: z.iso.datetime(),
43
- from: budgetPolicySchema,
44
- to: budgetPolicySchema,
60
+ from: frozenPolicySchema,
61
+ to: frozenPolicySchema,
45
62
  deadlineFrom: z.iso.datetime(),
46
63
  deadlineTo: z.iso.datetime(),
47
64
  })
@@ -54,7 +71,8 @@ type BudgetState = z.infer<typeof budgetStateSchema>;
54
71
 
55
72
  export type RunBudget = {
56
73
  limits: ModelBudgetLimits;
57
- policy: BudgetPolicy;
74
+ policy: FrozenBudgetPolicy;
75
+ model: string;
58
76
  /** The amendment this invocation recorded, for the run journal. */
59
77
  amended: BudgetState['amendments'][number] | undefined;
60
78
  /** audit.json asks for other limits than the run froze: reported, never
@@ -79,56 +97,127 @@ export const readBudgetAmendment = async (
79
97
  return budgetAmendmentSchema.parse(JSON.parse(text));
80
98
  };
81
99
 
100
+ /** Thrown before any paid work when a new run has no approved cap. */
101
+ export class BudgetCapMissingError extends Error {
102
+ constructor(message: string) {
103
+ super(message);
104
+ this.name = 'BudgetCapMissingError';
105
+ }
106
+ }
107
+
108
+ /** Thrown before any paid work when audit.json names another model than
109
+ * the run directory froze. */
110
+ export class RunModelChangedError extends Error {
111
+ constructor(message: string) {
112
+ super(message);
113
+ this.name = 'RunModelChangedError';
114
+ }
115
+ }
116
+
117
+ /** readFrozenBudget reads a run directory's BUDGET.json; undefined when
118
+ * the directory has not started. Read-only. */
119
+ export const readFrozenBudget = async (
120
+ dir: string,
121
+ ): Promise<BudgetState | undefined> => {
122
+ const text = await readFile(path.join(dir, budgetFile), 'utf8').catch(
123
+ (err: unknown) => {
124
+ if (hasErrorCode(err, 'ENOENT')) {
125
+ return undefined;
126
+ }
127
+
128
+ throw err;
129
+ },
130
+ );
131
+
132
+ return text === undefined
133
+ ? undefined
134
+ : budgetStateSchema.parse(JSON.parse(text));
135
+ };
136
+
137
+ type ResolveRunBudgetOptions = {
138
+ /** The gateway model audit.json resolves to. */
139
+ model: string;
140
+ /** The cap approved on the command line (`--max-usd`). On a new run it
141
+ * sets the cap; on a resume it raises it, recorded like a --budget-file. */
142
+ maxUsd?: number;
143
+ amendment?: BudgetAmendment;
144
+ now?: () => Date;
145
+ };
146
+
82
147
  /**
83
- * resolveRunBudget returns the limits a run executes under: frozen from
84
- * audit.json on the first run, kept on every resume, raised only by an
85
- * amendment. An amendment that lowers a limit is refused: the ledger may
86
- * already hold more than the lower limit.
148
+ * resolveRunBudget returns the limits and the model a run executes under:
149
+ * frozen from audit.json (and --max-usd) on the first run, kept on every
150
+ * resume, raised only by an amendment. A new run without a dollar cap is
151
+ * refused, as is a resume whose audit.json names another model. An
152
+ * amendment that lowers a limit is refused: the ledger may already hold
153
+ * more than the lower limit.
87
154
  */
88
155
  export const resolveRunBudget = async (
89
156
  dir: string,
90
157
  policy: BudgetPolicy,
91
- {
92
- amendment,
93
- now = () => new Date(),
94
- }: { amendment?: BudgetAmendment; now?: () => Date } = {},
158
+ { model, maxUsd, amendment, now = () => new Date() }: ResolveRunBudgetOptions,
95
159
  ): Promise<RunBudget> => {
96
160
  const file = path.join(dir, budgetFile);
97
- const text = await readFile(file, 'utf8').catch((err: unknown) => {
98
- if (hasErrorCode(err, 'ENOENT')) {
99
- return undefined;
161
+ const existing = await readFrozenBudget(dir);
162
+ const at = now();
163
+
164
+ if (existing?.model !== undefined && existing.model !== model) {
165
+ throw new RunModelChangedError(
166
+ `This run directory judges with ${existing.model}; audit.json now names ${model}. A run never changes its model. To judge the same answers with ${model}, use: literally-aeo rejudge ${dir} --output <new-dir> --model ${model}`,
167
+ );
168
+ }
169
+
170
+ const cap = maxUsd ?? policy.maxUsd;
171
+
172
+ const startState = (): BudgetState => {
173
+ if (cap === undefined) {
174
+ throw new BudgetCapMissingError(
175
+ 'No spending cap: approve one with --max-usd <amount> or runPolicy.budget.maxUsd in audit.json.',
176
+ );
100
177
  }
101
178
 
102
- throw err;
103
- });
104
- const existing =
105
- text === undefined ? undefined : budgetStateSchema.parse(JSON.parse(text));
106
- const at = now();
107
- let state: BudgetState = existing ?? {
108
- version: 1,
109
- original: policy,
110
- current: policy,
111
- deadlineAt: hoursFrom(at, policy.maxHours),
112
- amendments: [],
179
+ const frozen = { ...policy, maxUsd: cap };
180
+
181
+ return {
182
+ version: 1,
183
+ original: frozen,
184
+ current: frozen,
185
+ deadlineAt: hoursFrom(at, policy.maxHours),
186
+ model,
187
+ amendments: [],
188
+ };
113
189
  };
190
+
191
+ let state: BudgetState = existing ?? startState();
114
192
  let amended: RunBudget['amended'];
193
+ const modelAdopted = state.model === undefined;
194
+
195
+ state = { ...state, model };
196
+
197
+ // On a resume --max-usd raises the cap like a --budget-file does.
198
+ const change: BudgetAmendment = {
199
+ ...amendment,
200
+ ...(existing && maxUsd !== undefined && maxUsd !== existing.current.maxUsd
201
+ ? { maxUsd }
202
+ : {}),
203
+ };
115
204
 
116
- if (amendment && Object.keys(amendment).length > 0) {
117
- const to = { ...state.current, ...amendment };
205
+ if (Object.keys(change).length > 0) {
206
+ const to = { ...state.current, ...change };
118
207
 
119
208
  if (
120
209
  to.maxUsd < state.current.maxUsd ||
121
210
  to.maxTokens < state.current.maxTokens
122
211
  ) {
123
212
  throw new Error(
124
- `A --budget-file can only raise limits; this run already allows $${state.current.maxUsd} and ${state.current.maxTokens} tokens.`,
213
+ `A cap can only be raised; this run already allows $${state.current.maxUsd} and ${state.current.maxTokens} tokens.`,
125
214
  );
126
215
  }
127
216
 
128
217
  const deadlineTo =
129
- amendment.maxHours === undefined
218
+ change.maxHours === undefined
130
219
  ? state.deadlineAt
131
- : hoursFrom(at, amendment.maxHours);
220
+ : hoursFrom(at, change.maxHours);
132
221
 
133
222
  amended = {
134
223
  at: at.toISOString(),
@@ -145,7 +234,7 @@ export const resolveRunBudget = async (
145
234
  };
146
235
  }
147
236
 
148
- if (!existing || amended) {
237
+ if (!existing || amended || modelAdopted) {
149
238
  await writeFileAtomically(file, JSON.stringify(state, null, 2));
150
239
  }
151
240
 
@@ -156,8 +245,14 @@ export const resolveRunBudget = async (
156
245
  deadlineAt: state.deadlineAt,
157
246
  },
158
247
  policy: state.current,
248
+ model,
159
249
  amended,
160
- policyDiffers: JSON.stringify(policy) !== JSON.stringify(state.original),
250
+ // Only what audit.json itself asks for: a cap approved on the command
251
+ // line is not audit.json's, and a recorded raise is not a difference.
252
+ policyDiffers:
253
+ policy.maxTokens !== state.original.maxTokens ||
254
+ policy.maxHours !== state.original.maxHours ||
255
+ (policy.maxUsd !== undefined && policy.maxUsd !== state.original.maxUsd),
161
256
  };
162
257
 
163
258
  return budget;
@@ -0,0 +1,178 @@
1
+ import { authorToolCaps } from '../codex-workflow/author-tools';
2
+ import {
3
+ authorSearchLowUsd,
4
+ authorTokens,
5
+ costCoefficientsVersion,
6
+ hostTokensPerAnswer,
7
+ probeUsd,
8
+ searchUsdPerAnswer,
9
+ stageTokens,
10
+ type Range,
11
+ type TokenRange,
12
+ } from '../models/cost-coefficients';
13
+ import { tokenCostUsd } from '../models/pricing';
14
+ import type { SupportedModel } from '../models/supported-models';
15
+ import type { RunPlan } from '../runner';
16
+
17
+ // ============================================================================
18
+ // What a run or an author session is expected to cost
19
+ // (specs/aeo-claude-operator-spec.md §4.2): a low-to-high range per kind of
20
+ // paid work, from the plan, the model's list prices and the calibrated
21
+ // coefficients. An estimate, never a quote; the cap the operator approves
22
+ // is what bounds the spend.
23
+ // ============================================================================
24
+
25
+ export type CostRange = Range<number>;
26
+
27
+ export type RunCostEstimate = {
28
+ currency: 'USD';
29
+ /** An estimate, labelled as such wherever it is shown. */
30
+ kind: 'estimate';
31
+ model: string;
32
+ coefficientsVersion: number;
33
+ low: number;
34
+ high: number;
35
+ categories: {
36
+ probes: CostRange;
37
+ stages: CostRange;
38
+ hostCalls: CostRange;
39
+ search: CostRange;
40
+ };
41
+ /** The cap to propose to the operator: the high end, rounded up. */
42
+ recommendedCapUsd: number;
43
+ };
44
+
45
+ export type AuthorCostEstimate = Omit<RunCostEstimate, 'categories'> & {
46
+ categories: { stages: CostRange; search: CostRange };
47
+ };
48
+
49
+ const cents = (usd: number): number => {
50
+ return Math.round(usd * 100) / 100;
51
+ };
52
+
53
+ const rangeOf = (low: number, high: number): CostRange => {
54
+ return { low: cents(low), high: cents(high) };
55
+ };
56
+
57
+ /** The high end rounded up to a whole dollar, so the approved amount reads
58
+ * as an amount and never falls just short of the estimate. */
59
+ const recommendedCapOf = (high: number): number => {
60
+ return Math.max(1, Math.ceil(high));
61
+ };
62
+
63
+ const tokensCost = (
64
+ model: SupportedModel,
65
+ tokens: TokenRange,
66
+ cachedShare: number,
67
+ ): number => {
68
+ return tokenCostUsd(model.pricingUsdPerMillion, {
69
+ inputTokens: tokens.input,
70
+ cachedInputTokens: Math.round(tokens.input * cachedShare),
71
+ outputTokens: tokens.output,
72
+ });
73
+ };
74
+
75
+ const scaled = (tokens: TokenRange, factor: number): TokenRange => {
76
+ return { input: tokens.input * factor, output: tokens.output * factor };
77
+ };
78
+
79
+ const sumOf = (ranges: readonly CostRange[]): CostRange => {
80
+ return rangeOf(
81
+ ranges.reduce((total, range) => total + range.low, 0),
82
+ ranges.reduce((total, range) => total + range.high, 0),
83
+ );
84
+ };
85
+
86
+ type EstimateRunOptions = {
87
+ plan: Pick<RunPlan, 'units' | 'probesBySurface'>;
88
+ model: SupportedModel;
89
+ grounding: 'full' | 'extraction_only';
90
+ };
91
+
92
+ /** estimateRunCost estimates a whole run as planned; a resume spends less,
93
+ * because banked answers are never probed again. */
94
+ export const estimateRunCost = ({
95
+ plan,
96
+ model,
97
+ grounding,
98
+ }: EstimateRunOptions): RunCostEstimate => {
99
+ const answers = plan.units.length;
100
+ const { cachedShare } = stageTokens;
101
+
102
+ const probes = sumOf(
103
+ [...plan.probesBySurface].map(([surface, count]) =>
104
+ rangeOf(probeUsd[surface].low * count, probeUsd[surface].high * count),
105
+ ),
106
+ );
107
+ // The cheap end assumes the cache serves most input; the dear end less.
108
+ const stages = rangeOf(
109
+ tokensCost(
110
+ model,
111
+ scaled(stageTokens.perAnswer.low, answers),
112
+ cachedShare.high,
113
+ ) + tokensCost(model, stageTokens.perRun.low, cachedShare.high),
114
+ tokensCost(
115
+ model,
116
+ scaled(stageTokens.perAnswer.high, answers),
117
+ cachedShare.low,
118
+ ) + tokensCost(model, stageTokens.perRun.high, cachedShare.low),
119
+ );
120
+ const hostTokens = hostTokensPerAnswer[grounding];
121
+ const hostCalls = rangeOf(
122
+ tokensCost(model, scaled(hostTokens.low, answers), 0),
123
+ tokensCost(model, scaled(hostTokens.high, answers), 0),
124
+ );
125
+ const search =
126
+ grounding === 'full'
127
+ ? rangeOf(
128
+ searchUsdPerAnswer.low * answers,
129
+ searchUsdPerAnswer.high * answers,
130
+ )
131
+ : rangeOf(0, 0);
132
+ const total = sumOf([probes, stages, hostCalls, search]);
133
+
134
+ const estimate: RunCostEstimate = {
135
+ currency: 'USD',
136
+ kind: 'estimate',
137
+ model: model.id,
138
+ coefficientsVersion: costCoefficientsVersion,
139
+ low: total.low,
140
+ high: total.high,
141
+ categories: { probes, stages, hostCalls, search },
142
+ recommendedCapUsd: recommendedCapOf(total.high),
143
+ };
144
+
145
+ return estimate;
146
+ };
147
+
148
+ /** estimateAuthorCost estimates one author session and its research. */
149
+ export const estimateAuthorCost = (
150
+ model: SupportedModel,
151
+ ): AuthorCostEstimate => {
152
+ const { cachedShare } = stageTokens;
153
+ const stages = rangeOf(
154
+ tokensCost(model, authorTokens.session.low, cachedShare.high),
155
+ tokensCost(model, authorTokens.session.high, cachedShare.low),
156
+ );
157
+ // The research tools refuse to search past their own spend cap.
158
+ const search = rangeOf(authorSearchLowUsd, authorToolCaps.searchSpendUsd);
159
+ const total = sumOf([stages, search]);
160
+
161
+ const estimate: AuthorCostEstimate = {
162
+ currency: 'USD',
163
+ kind: 'estimate',
164
+ model: model.id,
165
+ coefficientsVersion: costCoefficientsVersion,
166
+ low: total.low,
167
+ high: total.high,
168
+ categories: { stages, search },
169
+ recommendedCapUsd: recommendedCapOf(total.high),
170
+ };
171
+
172
+ return estimate;
173
+ };
174
+
175
+ /** One line a person reads: "$12.40 to $38.10 (estimate)". */
176
+ export const describeCostRange = (range: CostRange): string => {
177
+ return `$${range.low.toFixed(2)} to $${range.high.toFixed(2)}`;
178
+ };
@@ -0,0 +1,189 @@
1
+ # Operating literally-aeo for a user
2
+
3
+ You are an AI agent running an AEO audit on the user's own machine, for a
4
+ user who is usually not a developer. This guide is the protocol. Phrase
5
+ things your own way; never skip a checkpoint, never reorder the paid steps,
6
+ and never spend money the user has not approved as an amount.
7
+
8
+ The engine enforces the cap, not you: every paid run needs `--max-usd`, and
9
+ a run stops (exit 2) before it would cross it. Your job is to get the user's
10
+ informed yes for an amount, then pass exactly that amount.
11
+
12
+ ## Rules that hold throughout
13
+
14
+ - **Keys never pass through the chat.** Never ask for a key, password or
15
+ token in the conversation, never print one, never `cat` the `.env` file.
16
+ The user pastes keys into `.env` in their own editor. `literally-aeo
17
+ doctor` reports settings by name and source only; that is all you need.
18
+ - **Consent per system change.** Installing Node or another tool, or
19
+ changing shell configuration, needs the user's yes for that change.
20
+ - **One folder per brand.** Keep everything for a brand under
21
+ `~/literally-aeo/<brand>/` (the `.env`, the brief, `draft/`, `run/`),
22
+ never in Documents or the user's working folders.
23
+ - **Never delete a run directory to start fresh.** Running the same command
24
+ again resumes and reuses every answer already paid for. Deleting it pays
25
+ for them again.
26
+ - **Exit codes:** 0 done; 1 failed (invalid input or an error: read the
27
+ message); 2 stopped and resumable (a missing setting, a failed canary,
28
+ another writer, or the cap); 3 done with disclosed limits.
29
+ - **Machine-readable output:** add `--json` to any command and read stdout.
30
+ Progress goes to stderr.
31
+ - **Disclose untrusted reads.** Tell the user once, plainly: the analysis
32
+ stages run Codex in a sandbox that restricts writes and network access,
33
+ not reads, and the answers and pages it reads are untrusted text. The
34
+ stage prompts treat them as material, never as instructions. On a machine
35
+ holding confidential files, a container is the safer place to run.
36
+
37
+ ## Checkpoint 1: install and check
38
+
39
+ 1. Check `node --version` (24 or newer). If Node is missing or older, say
40
+ what you would install and how, and do it only on a yes.
41
+ 2. `npm install -g literally-aeo`. Codex ships with the package; there is
42
+ nothing else to install for the analysis stages.
43
+ 3. `mkdir -p ~/literally-aeo/<brand> && cd ~/literally-aeo/<brand>`, then
44
+ `literally-aeo init`. It writes an example `audit.json` (a fictional
45
+ company: a placeholder for `doctor`, replaced in checkpoint 5) and
46
+ `.env.example`, never over an existing file.
47
+ 4. `literally-aeo doctor --json`. Read `checks`: what is missing, the Codex
48
+ binary the engine will run, and which coding-agent CLIs (`claude`,
49
+ `codex`, `cursor-agent`) are installed. `doctor` cannot tell whether a
50
+ CLI is logged in: a run checks that with a canary before any paid work,
51
+ so never tell the user a login works until a run has passed it.
52
+
53
+ ## Checkpoint 2: accounts and keys
54
+
55
+ Explain each account in one sentence, what it pays for, and the cheapest
56
+ way to start:
57
+
58
+ - **Vercel AI Gateway** (`AI_GATEWAY_API_KEY`): pays for the assistant
59
+ answers the audit measures and every model call that judges them.
60
+ - **DataForSEO** (`DATAFORSEO_LOGIN`, `DATAFORSEO_PASSWORD`): pays for
61
+ Google AI Overviews, the searches that check the product claims answers
62
+ make, and the research behind the proposed config.
63
+
64
+ Copy `.env.example` to `.env` (`cp .env.example .env`) and ask the user to
65
+ open `.env` in their editor and paste the values. Then run
66
+ `literally-aeo doctor --env-file .env --json` again until every setting the
67
+ run needs reports present.
68
+
69
+ Coding-agent surfaces (Claude Code, Codex, Cursor) are measured with the
70
+ CLI's own login on this machine. They matter most when the buyers are
71
+ developers. If the user cannot or will not set one up, remove it from
72
+ `surfaces` in `audit.json` in checkpoint 5 and tell them it is now out of
73
+ scope for this audit.
74
+
75
+ ## Checkpoint 3: the brief
76
+
77
+ Ask, in plain words:
78
+
79
+ - the company name and website;
80
+ - what they want AI assistants to recommend them for;
81
+ - competitors they know (optional);
82
+ - pages that matter most, such as pricing or a product page (optional);
83
+ - anything else worth knowing (optional).
84
+
85
+ Write their answers to `brief.json`:
86
+
87
+ ```json
88
+ {
89
+ "companyName": "Acme Files",
90
+ "website": "https://acme.example",
91
+ "desiredRecommendation": "Secure file sharing for regulated teams",
92
+ "competitors": "Rival Drive (rival.example)",
93
+ "moneyPages": "https://acme.example/pricing",
94
+ "notes": ""
95
+ }
96
+ ```
97
+
98
+ ## Checkpoint 4: approve the research cost
99
+
100
+ Run `literally-aeo author --brief brief.json --estimate --json` and show the
101
+ estimate. It spends nothing. Only on a yes, run
102
+
103
+ ```sh
104
+ literally-aeo author --brief brief.json --output draft --env-file .env --max-usd <approved amount>
105
+ ```
106
+
107
+ It researches the company and proposes `draft/audit.json`, with
108
+ `draft/author-record.json` beside it. Keep both files together.
109
+
110
+ ## Checkpoint 5: approve the questions
111
+
112
+ Read `draft/audit.json` and present it as a short list, never as JSON: the
113
+ sections, the buyer questions in each, the competitors, and the surfaces
114
+ (the assistants that will be asked). Apply the user's edits to
115
+ `draft/audit.json` yourself. The optional `model` field names the model
116
+ that judges and writes the report; leave it out to use the recommended
117
+ one, which `literally-aeo doctor` lists with every supported model. If the
118
+ user would rather measure fewer questions more deeply, set
119
+ `chatProbes.runsPerPrompt` and `agentProbes.runsPerPrompt` (1 to 25 runs
120
+ of each question per assistant); left out, each question is asked twice
121
+ (once on AI Overviews). Run
122
+ `literally-aeo doctor --config draft/audit.json --env-file .env --json`
123
+ after editing. Money pages must be on the company's site or its
124
+ subdomains; for a page on another host the user owns (a docs site, say),
125
+ add that host to `runPolicy.checkHosts`. With money pages, doctor also
126
+ checks that Chromium launches and, if not, names the command that
127
+ installs it.
128
+
129
+ ## Checkpoint 6: approve the audit cost
130
+
131
+ Run `literally-aeo plan --config draft/audit.json --output run --json`.
132
+ Show the estimate's low to high range, what drives it (answers per surface,
133
+ the model), and the categories (`estimate.categories`). Recommend
134
+ `recommendedCapUsd`, the high end, as the cap. Say it is an estimate, not a
135
+ quote. The user's approved amount is the cap.
136
+
137
+ ## Checkpoint 7: run and watch
138
+
139
+ Start the run in the background:
140
+
141
+ ```sh
142
+ literally-aeo run --config draft/audit.json --env-file .env --output run --max-usd <approved amount>
143
+ ```
144
+
145
+ It takes from minutes to hours. Follow it with
146
+ `literally-aeo status run --json`: `phase`, `answers` (captured of planned),
147
+ `spend` (charged against `capUsd`, by category), `lastError`. Poll every few
148
+ minutes, not continuously. Tell the user what changed, briefly.
149
+
150
+ When the process exits:
151
+
152
+ - **0**: done. Go to checkpoint 8.
153
+ - **3**: done with disclosed limits (unjudged answers, a narrative marked
154
+ as needing improvement). Explain the limits in plain words, then go to
155
+ checkpoint 8.
156
+ - **2**: stopped and resumable. Read `literally-aeo status run --json` and
157
+ the stderr message and explain why. If `stoppedAtBudget` is true, the cap
158
+ was reached: show what was spent (`spend`) and what is left to do, and
159
+ ask whether to raise it, to what total. Only on a new yes, run the same
160
+ command with `--max-usd <new total cap>`; the raise is recorded, and the
161
+ answers already paid for are reused. Otherwise fix the cause (a setting,
162
+ a login) and run the same command again; it resumes.
163
+ - **1**: read the error, fix the input if you can, and explain it if you
164
+ cannot. Never delete `run/`.
165
+
166
+ To judge the same answers again with another model, use
167
+ `literally-aeo rejudge run --output run-<model> --model <id> --env-file .env`:
168
+ nothing is asked again, and only the judging is paid for. Without
169
+ `--max-usd` it prints its estimate and spends nothing; show that, get an
170
+ amount approved, and run it again with `--max-usd <approved amount>`. A run
171
+ never changes its own model: editing `model` in `audit.json` over an
172
+ existing run directory is refused.
173
+
174
+ ## Checkpoint 8: explain the result
175
+
176
+ Open the report with `literally-aeo view run` (a one-time link on this
177
+ machine only). Summarize: where the brand is mentioned and cited, on which
178
+ assistants, who is recommended instead, and what the report recommends.
179
+ Quote the report; do not add claims it does not make.
180
+
181
+ ## Checkpoint 9: keep and share
182
+
183
+ Offer `literally-aeo export run`: a `.aeo.zip` bundle with the captured
184
+ answers, every judgment, the metrics, the report and the journal of every
185
+ operation, which anyone can check offline with `literally-aeo verify` from
186
+ this release or a newer one.
187
+ Credentials found in it block the export. Tell the user the bundle shows
188
+ the questions and the answers, so they should share it only where those can
189
+ be read.