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
@@ -5,7 +5,20 @@ import { workflowSecrets } from '../codex-workflow/codex-home';
5
5
  import { prepareWorkdir, runWorkflow } from '../codex-workflow/loop';
6
6
  import { readAuditFile, type AuditFile } from '../engine/audit-file';
7
7
  import { readSettings, type Settings } from '../engine/env-file';
8
- import { readBudgetAmendment, type BudgetAmendment } from '../engine/budget';
8
+ import {
9
+ BudgetCapMissingError,
10
+ readBudgetAmendment,
11
+ readFrozenBudget,
12
+ RunModelChangedError,
13
+ type BudgetAmendment,
14
+ } from '../engine/budget';
15
+ import {
16
+ describeCostRange,
17
+ estimateAuthorCost,
18
+ estimateRunCost,
19
+ type AuthorCostEstimate,
20
+ type RunCostEstimate,
21
+ } from '../engine/cost-estimate';
9
22
  import {
10
23
  openLocalRun,
11
24
  planLocalRun,
@@ -34,6 +47,11 @@ import { engineResources } from '../engine/resources';
34
47
  import { exampleAuditFile, exampleEnvFile } from '../engine/templates';
35
48
  import { getEnvironment, writeEnv } from '../lib/env';
36
49
  import { ModelBudgetError } from '../models/accounting';
50
+ import {
51
+ findSupportedModel,
52
+ recommendedModelId,
53
+ resolveSupportedModel,
54
+ } from '../models/supported-models';
37
55
  import { hasErrorCode } from '../stores/fs-errors';
38
56
  import { formatLine, writeErr, writeOut, type Flags } from './io';
39
57
 
@@ -51,6 +69,57 @@ const runDirOf = (flags: Flags) => {
51
69
  return path.resolve(flags.options.get('--output') ?? 'audit-run');
52
70
  };
53
71
 
72
+ /** The amount the operator approved with --max-usd, if any. */
73
+ const maxUsdOf = (flags: Flags): number | undefined => {
74
+ const value = flags.options.get('--max-usd');
75
+
76
+ if (value === undefined) {
77
+ return undefined;
78
+ }
79
+
80
+ const usd = Number(value.replace(/^\$/, ''));
81
+
82
+ if (!Number.isFinite(usd) || usd <= 0) {
83
+ throw new Error(
84
+ `Please give --max-usd a positive amount in dollars, such as 40; got ${value}.`,
85
+ );
86
+ }
87
+
88
+ return usd;
89
+ };
90
+
91
+ /** The cost lines a person reads, for plan and for a refused run. */
92
+ const estimateLines = (estimate: RunCostEstimate | AuthorCostEstimate) => {
93
+ const categories: [string, { low: number; high: number } | undefined][] = [
94
+ [
95
+ 'probes',
96
+ 'probes' in estimate.categories ? estimate.categories.probes : undefined,
97
+ ],
98
+ ['Codex stages', estimate.categories.stages],
99
+ [
100
+ 'host model calls',
101
+ 'hostCalls' in estimate.categories
102
+ ? estimate.categories.hostCalls
103
+ : undefined,
104
+ ],
105
+ ['search', estimate.categories.search],
106
+ ];
107
+
108
+ return [
109
+ formatLine(
110
+ 'Estimated cost',
111
+ `${describeCostRange(estimate)} (an estimate, not a quote; ${estimate.model})`,
112
+ ),
113
+ ...categories.flatMap(([label, range]) =>
114
+ range ? [formatLine(` ${label}`, describeCostRange(range))] : [],
115
+ ),
116
+ formatLine(
117
+ 'Recommended cap',
118
+ `$${estimate.recommendedCapUsd} (the high end)`,
119
+ ),
120
+ ];
121
+ };
122
+
54
123
  /** init writes the two templates beside each other, never over an
55
124
  * existing file. */
56
125
  export const runInit = async (flags: Flags) => {
@@ -91,13 +160,21 @@ export const runInit = async (flags: Flags) => {
91
160
 
92
161
  export const runDoctor = async (flags: Flags) => {
93
162
  const file = await readAuditFile(configPathOf(flags));
94
- const { plan, request } = planLocalRun(file);
163
+ // An unsupported model is doctor's finding, not its crash: the rest of
164
+ // the checks still run, against the plan the recommended model would make.
165
+ const isSupported =
166
+ findSupportedModel(file.model ?? recommendedModelId) !== undefined;
167
+ const { plan, request } = planLocalRun(
168
+ isSupported ? file : { ...file, model: undefined },
169
+ );
95
170
  const settings = await readSettings(flags.options.get('--env-file'));
96
171
  const checks = await runPreflight({
97
172
  surfaces: plan.surfaces,
98
173
  settings,
99
174
  dir: runDirOf(flags),
175
+ model: file.model,
100
176
  groundingSearch: usesGroundingSearch(request),
177
+ rendersPages: file.moneyPages.length > 0,
101
178
  });
102
179
  const ok = checks.every((check) => check.ok);
103
180
 
@@ -128,8 +205,15 @@ export const runPlan = async (flags: Flags) => {
128
205
  const dir = runDirOf(flags);
129
206
  const state = await runDirectoryState(dir);
130
207
  const bySurface = Object.fromEntries(plan.probesBySurface);
208
+ const model = resolveSupportedModel(file.model);
209
+ const estimate = estimateRunCost({
210
+ plan,
211
+ model,
212
+ grounding: request.grounding,
213
+ });
131
214
  const summary = {
132
215
  brand: config.brand.name,
216
+ model: model.id,
133
217
  sections: config.sections.map((section) => ({
134
218
  key: section.key,
135
219
  questions: section.prompts.length,
@@ -140,11 +224,10 @@ export const runPlan = async (flags: Flags) => {
140
224
  maxPlannedUnits: request.maxPlannedUnits,
141
225
  grounding: request.grounding,
142
226
  budget: file.runPolicy.budget,
143
- // What the budget can actually stop (spec §6): the host's model calls.
144
- budgetEnforcedFor: [
145
- 'host model calls (perception, labels, grounding, copy verifier)',
146
- ],
147
- budgetRecordedOnly: ['probe answers', 'Codex stage sessions'],
227
+ // The cap covers every paid call: probes, Codex stage sessions, host
228
+ // model calls and searches.
229
+ estimate,
230
+ recommendedCapUsd: estimate.recommendedCapUsd,
148
231
  runDirectory: { path: dir, state },
149
232
  digests,
150
233
  };
@@ -158,6 +241,7 @@ export const runPlan = async (flags: Flags) => {
158
241
  writeOut(
159
242
  [
160
243
  formatLine('Brand', summary.brand),
244
+ formatLine('Model', summary.model),
161
245
  ...summary.sections.map((section) =>
162
246
  formatLine(`Section ${section.key}`, `${section.questions} questions`),
163
247
  ),
@@ -175,14 +259,12 @@ export const runPlan = async (flags: Flags) => {
175
259
  ? 'full (claims researched and adjudicated)'
176
260
  : 'extraction_only (claims inventoried, not researched)',
177
261
  ),
262
+ ...estimateLines(estimate),
178
263
  formatLine(
179
- 'Budget',
180
- `${'$'}${summary.budget.maxUsd}, ${summary.budget.maxTokens} tokens, ${summary.budget.maxHours} h`,
181
- ),
182
- formatLine(' enforced for', summary.budgetEnforcedFor.join('; ')),
183
- formatLine(
184
- ' recorded, not capped',
185
- summary.budgetRecordedOnly.join('; '),
264
+ 'Cap',
265
+ summary.budget.maxUsd === undefined
266
+ ? 'none in audit.json; approve one with run --max-usd <amount>'
267
+ : `${'$'}${summary.budget.maxUsd} (audit.json), covering every paid call`,
186
268
  ),
187
269
  formatLine('Run directory', `${dir} (${state})`),
188
270
  formatLine('Measurement digest', digests.measurement),
@@ -204,11 +286,29 @@ export const runRun = async (flags: Flags) => {
204
286
  const amendment = budgetFile
205
287
  ? await readBudgetAmendment(path.resolve(budgetFile))
206
288
  : undefined;
289
+ const maxUsd = maxUsdOf(flags);
290
+ const refused = await refuseWithoutCap({
291
+ file,
292
+ dir,
293
+ maxUsd,
294
+ estimate: estimateRunCost({
295
+ plan,
296
+ model: resolveSupportedModel(file.model),
297
+ grounding: request.grounding,
298
+ }),
299
+ });
300
+
301
+ if (refused !== undefined) {
302
+ return refused;
303
+ }
304
+
207
305
  const checks = await runPreflight({
208
306
  surfaces: plan.surfaces,
209
307
  settings,
210
308
  dir,
309
+ model: file.model,
211
310
  groundingSearch: usesGroundingSearch(request),
311
+ rendersPages: file.moneyPages.length > 0,
212
312
  });
213
313
  const failing = checks.filter((check) => !check.ok);
214
314
 
@@ -228,10 +328,46 @@ export const runRun = async (flags: Flags) => {
228
328
  configFile: configPathOf(flags),
229
329
  dir,
230
330
  settings,
331
+ maxUsd,
231
332
  amendment,
232
333
  });
233
334
  };
234
335
 
336
+ /** A run starts only under an amount the operator approved: a new run
337
+ * directory without --max-usd or runPolicy.budget.maxUsd is refused with
338
+ * the estimate, before any paid work (exit 2, nothing spent). A resume
339
+ * keeps the cap it froze. */
340
+ const refuseWithoutCap = async ({
341
+ file,
342
+ dir,
343
+ maxUsd,
344
+ estimate,
345
+ }: {
346
+ file: AuditFile;
347
+ dir: string;
348
+ maxUsd: number | undefined;
349
+ estimate: RunCostEstimate;
350
+ }): Promise<number | undefined> => {
351
+ if (maxUsd !== undefined || file.runPolicy.budget.maxUsd !== undefined) {
352
+ return undefined;
353
+ }
354
+
355
+ if (await readFrozenBudget(dir)) {
356
+ return undefined;
357
+ }
358
+
359
+ writeErr(
360
+ [
361
+ 'Not started: a run needs an approved spending cap. Nothing was spent.',
362
+ ...estimateLines(estimate),
363
+ '',
364
+ `Approve an amount and run again with it, for example: --max-usd ${estimate.recommendedCapUsd}`,
365
+ ].join('\n'),
366
+ );
367
+
368
+ return 2;
369
+ };
370
+
235
371
  /** author researches a brief and proposes an audit.json (spec §4.1). */
236
372
  export const runAuthor = async (flags: Flags, usage: string) => {
237
373
  const briefFile = flags.options.get('--brief');
@@ -241,6 +377,36 @@ export const runAuthor = async (flags: Flags, usage: string) => {
241
377
  }
242
378
 
243
379
  const brief = await readBrief(path.resolve(briefFile));
380
+ const model = resolveSupportedModel(flags.options.get('--model'));
381
+ const estimate = estimateAuthorCost(model);
382
+ const maxUsd = maxUsdOf(flags);
383
+
384
+ // --estimate is free: it reads the brief and prints what researching it
385
+ // would cost, and spends nothing.
386
+ if (flags.switches.has('--estimate') || maxUsd === undefined) {
387
+ if (flags.switches.has('--json')) {
388
+ writeOut(
389
+ JSON.stringify({
390
+ resultVersion: 1,
391
+ command: 'author',
392
+ started: false,
393
+ estimate,
394
+ recommendedCapUsd: estimate.recommendedCapUsd,
395
+ }),
396
+ );
397
+ } else {
398
+ writeOut(
399
+ [
400
+ ...estimateLines(estimate),
401
+ '',
402
+ `Nothing was spent. To research the brief, approve an amount: --max-usd ${estimate.recommendedCapUsd}`,
403
+ ].join('\n'),
404
+ );
405
+ }
406
+
407
+ return flags.switches.has('--estimate') ? 0 : 2;
408
+ }
409
+
244
410
  const dir = path.resolve(flags.options.get('--output') ?? 'audit-draft');
245
411
  const settings = await readSettings(flags.options.get('--env-file'));
246
412
  // The author researches through the pinned search provider, so its key
@@ -275,6 +441,8 @@ export const runAuthor = async (flags: Flags, usage: string) => {
275
441
  const result = await runLocalAuthor({
276
442
  brief,
277
443
  dir,
444
+ model,
445
+ maxUsd,
278
446
  secrets: settings.values(credentialSettingNames),
279
447
  });
280
448
 
@@ -302,6 +470,14 @@ export const runAuthor = async (flags: Flags, usage: string) => {
302
470
  return 2;
303
471
  }
304
472
 
473
+ if (err instanceof ModelBudgetError) {
474
+ writeErr(
475
+ `Stopped at the approved cap of $${maxUsd}: ${err.message}. Nothing more was spent; run the same command with a higher --max-usd to continue.`,
476
+ );
477
+
478
+ return 2;
479
+ }
480
+
305
481
  throw err;
306
482
  }
307
483
  };
@@ -344,9 +520,33 @@ export const runRejudge = async (flags: Flags, usage: string) => {
344
520
  configOption === undefined
345
521
  ? await readRecordedAuthorEvidence(sourceDir)
346
522
  : undefined;
347
- const file = await readAuditFile(configFile);
523
+ // --model judges the same captures with another model: the method
524
+ // changes, the measurement does not, and the lineage records both.
525
+ const modelOption = flags.options.get('--model');
526
+ const configured = await readAuditFile(configFile);
527
+ const file =
528
+ modelOption === undefined
529
+ ? configured
530
+ : { ...configured, model: resolveSupportedModel(modelOption).id };
348
531
  const settings = await readSettings(flags.options.get('--env-file'));
349
532
  const { plan, request } = planLocalRun(file);
533
+ const maxUsd = maxUsdOf(flags);
534
+ const refused = await refuseWithoutCap({
535
+ file,
536
+ dir,
537
+ maxUsd,
538
+ // Nothing is probed again: only the judging and writing are paid.
539
+ estimate: estimateRunCost({
540
+ plan: { units: plan.units, probesBySurface: new Map() },
541
+ model: resolveSupportedModel(file.model),
542
+ grounding: request.grounding,
543
+ }),
544
+ });
545
+
546
+ if (refused !== undefined) {
547
+ return refused;
548
+ }
549
+
350
550
  const lineage = await prepareRejudgment({
351
551
  source: sourceDir,
352
552
  target: dir,
@@ -358,6 +558,7 @@ export const runRejudge = async (flags: Flags, usage: string) => {
358
558
  surfaces: plan.surfaces,
359
559
  settings,
360
560
  dir,
561
+ model: file.model,
361
562
  groundingSearch: usesGroundingSearch(request),
362
563
  });
363
564
  const failing = checks.filter((check) => !check.ok);
@@ -382,6 +583,8 @@ export const runRejudge = async (flags: Flags, usage: string) => {
382
583
  configFile,
383
584
  dir,
384
585
  settings,
586
+ maxUsd,
587
+ ...(modelOption !== undefined && { modelOverride: file.model }),
385
588
  evidence,
386
589
  derivedFromRunId: lineage.runId,
387
590
  });
@@ -393,6 +596,10 @@ type ExecuteRunOptions = {
393
596
  configFile: string;
394
597
  dir: string;
395
598
  settings: Settings;
599
+ /** The cap approved on the command line. */
600
+ maxUsd?: number;
601
+ /** The model a rejudgment names outside the configuration file. */
602
+ modelOverride?: string;
396
603
  amendment?: BudgetAmendment;
397
604
  /** Author evidence already recorded; read beside configFile otherwise. */
398
605
  evidence?: RecordedAuthorEvidence;
@@ -407,6 +614,8 @@ const executeRun = async ({
407
614
  configFile,
408
615
  dir,
409
616
  settings,
617
+ maxUsd,
618
+ modelOverride,
410
619
  amendment,
411
620
  evidence,
412
621
  derivedFromRunId,
@@ -417,6 +626,7 @@ const executeRun = async ({
417
626
  dir,
418
627
  configFile,
419
628
  evidence: evidence ?? (await readAuthorEvidence(configFile, file)),
629
+ ...(modelOverride !== undefined && { model: modelOverride }),
420
630
  });
421
631
 
422
632
  // The copy stage reads its rules and publisher context from the engine,
@@ -440,6 +650,7 @@ const executeRun = async ({
440
650
  try {
441
651
  const local = await openLocalRun(file, dir, {
442
652
  signal: controller.signal,
653
+ ...(maxUsd !== undefined && { maxUsd }),
443
654
  amendment,
444
655
  derivedFromRunId,
445
656
  });
@@ -456,6 +667,7 @@ const executeRun = async ({
456
667
  signal: controller.signal,
457
668
  origin: 'local',
458
669
  held: local.held,
670
+ ledger: local.ledger,
459
671
  }).catch(async (err: unknown) => {
460
672
  await local.held.writer.release();
461
673
  await local.source.close();
@@ -511,17 +723,25 @@ const executeRun = async ({
511
723
 
512
724
  if (
513
725
  err instanceof PreflightFailedError ||
514
- err instanceof WriterLockHeldError
726
+ err instanceof WriterLockHeldError ||
727
+ err instanceof BudgetCapMissingError
515
728
  ) {
516
729
  writeErr(err.message);
517
730
 
518
731
  return 2;
519
732
  }
520
733
 
521
- // Spending stops at the limit; the ledger survives for the resume.
734
+ if (err instanceof RunModelChangedError) {
735
+ writeErr(err.message);
736
+
737
+ return 1;
738
+ }
739
+
740
+ // Spending stops at the cap; the ledger and every banked answer survive
741
+ // for the resume, which never pays for them again.
522
742
  if (err instanceof ModelBudgetError) {
523
743
  writeErr(
524
- `Stopped at the run's budget: ${err.message}. Raise it with --budget-file <limits.json> and run the same command to resume.`,
744
+ `Stopped at the run's cap: ${err.message}. Nothing past the cap was dispatched. To continue, approve a higher amount and run the same command with --max-usd <amount> (or --budget-file <limits.json>); literally-aeo status ${dir} shows the spend so far.`,
525
745
  );
526
746
 
527
747
  return 2;
@@ -0,0 +1,113 @@
1
+ import path from 'node:path';
2
+ import { readRunStatus, type RunStatus } from '../engine/run-status';
3
+ import { formatLine, writeErr, writeOut, type Flags } from './io';
4
+
5
+ // ============================================================================
6
+ // literally-aeo status <run-dir> (specs/aeo-claude-operator-spec.md §4.5):
7
+ // where a run is, what it has captured and what it has spent against its
8
+ // cap. Read-only and offline; safe to poll beside a running writer.
9
+ // ============================================================================
10
+
11
+ const usd = (value: number | undefined) => {
12
+ return value === undefined ? 'unknown' : `$${value.toFixed(2)}`;
13
+ };
14
+
15
+ const toJson = (status: RunStatus) => {
16
+ // JSON carries null where a value is unknown, never a guess.
17
+ const result = {
18
+ resultVersion: 1,
19
+ command: 'status',
20
+ runDirectory: { path: status.dir, state: status.state },
21
+ writer: status.writer ?? null,
22
+ phase: status.phase ?? null,
23
+ lastActivity: status.lastActivity
24
+ ? {
25
+ ...status.lastActivity,
26
+ stage: status.lastActivity.stage ?? null,
27
+ role: status.lastActivity.role ?? null,
28
+ }
29
+ : null,
30
+ completedStages: status.completedStages,
31
+ answers: { ...status.answers, planned: status.answers.planned ?? null },
32
+ spend: {
33
+ ...status.spend,
34
+ capUsd: status.spend.capUsd ?? null,
35
+ deadlineAt: status.spend.deadlineAt ?? null,
36
+ remainingUsd: status.spend.remainingUsd ?? null,
37
+ },
38
+ lastError: status.lastError ?? null,
39
+ stoppedAtBudget: status.stoppedAtBudget,
40
+ };
41
+
42
+ return result;
43
+ };
44
+
45
+ const toText = (status: RunStatus) => {
46
+ const { answers, spend, writer, lastError } = status;
47
+ const lines = [
48
+ formatLine('Run directory', `${status.dir} (${status.state})`),
49
+ formatLine(
50
+ 'Writer',
51
+ writer
52
+ ? `${writer.purpose}, process ${writer.pid} on ${writer.host} since ${writer.since} (${writer.state})`
53
+ : 'none',
54
+ ),
55
+ formatLine('Phase', status.phase ?? 'not started'),
56
+ formatLine(
57
+ 'Stage outputs',
58
+ status.completedStages.length > 0
59
+ ? status.completedStages.join(', ')
60
+ : 'none yet',
61
+ ),
62
+ formatLine(
63
+ 'Answers',
64
+ `${answers.captured} captured of ${answers.planned ?? 'unknown'} planned${answers.failed > 0 ? `, ${answers.failed} failed` : ''}`,
65
+ ),
66
+ formatLine(
67
+ 'Spend',
68
+ `${usd(spend.chargedUsd)} of ${usd(spend.capUsd)} (${usd(spend.openUsd)} reserved, not settled)`,
69
+ ),
70
+ ...Object.entries(spend.byCategory).map(([category, spent]) =>
71
+ formatLine(` ${category}`, `${usd(spent.usd)} in ${spent.calls} calls`),
72
+ ),
73
+ formatLine(
74
+ 'Last error',
75
+ lastError
76
+ ? `${lastError.type} at ${lastError.at}: ${lastError.reason}`
77
+ : 'none',
78
+ ),
79
+ ...(status.stoppedAtBudget
80
+ ? [
81
+ '',
82
+ "Stopped at the run's cap. To continue, approve a higher amount and run the same command with --max-usd <new total> (or --budget-file <limits.json>); it resumes.",
83
+ ]
84
+ : []),
85
+ ];
86
+
87
+ return lines.join('\n');
88
+ };
89
+
90
+ export const runStatus = async (flags: Flags, usage: string) => {
91
+ const target = flags.positional[0];
92
+
93
+ if (target === undefined) {
94
+ throw new Error(usage);
95
+ }
96
+
97
+ const dir = path.resolve(target);
98
+ const status = await readRunStatus(dir);
99
+
100
+ if (!status) {
101
+ writeErr(`${dir} holds no run.`);
102
+
103
+ return 1;
104
+ }
105
+
106
+ writeOut(
107
+ flags.switches.has('--json')
108
+ ? JSON.stringify(toJson(status))
109
+ : toText(status),
110
+ );
111
+
112
+ return 0;
113
+ };
@@ -234,6 +234,7 @@ export const aggregateJudgments = (
234
234
  prompts: section.prompts,
235
235
  surfaces: inputs.surfaces,
236
236
  agentProbes: config.agentProbes,
237
+ chatProbes: config.chatProbes,
237
238
  },
238
239
  {
239
240
  probeCount: sectionCapture.units.length,
@@ -7,9 +7,16 @@ import {
7
7
  canonicalResearchUrl,
8
8
  extractSourceDocument,
9
9
  fetchGroundingSource,
10
+ } from '../grounding/fetch';
11
+ import {
12
+ resolvePublicAddress,
10
13
  SourceRetrievalError,
11
14
  validateResearchUrl,
12
- } from '../grounding/fetch';
15
+ } from '../grounding/guarded-request';
16
+ import {
17
+ withBoundedPage,
18
+ withGuardedChromium,
19
+ } from '../grounding/chromium-guard';
13
20
  import {
14
21
  groundingSourceSchema,
15
22
  type GroundingSource,
@@ -987,70 +994,42 @@ export const createAuthorTools = (options: AuthorToolsOptions): AuthorTools => {
987
994
  };
988
995
 
989
996
  /** Rendered HTML for a public page through the Chromium the image already
990
- * carries for the renderability check. The URL was validated and resolves
991
- * to public addresses; subresource requests are held to HTTPS and public
992
- * hosts as well. */
997
+ * carries for the renderability check. Every connection the browser makes
998
+ * passes the guarding proxy; the page's own host is checked first so a
999
+ * private destination fails with its own reason, not a tunnel error. */
993
1000
  export const renderWithChromium = async (
994
1001
  url: URL,
995
1002
  signal: AbortSignal,
996
1003
  ): Promise<string> => {
997
- const { lookup } = await import('node:dns/promises');
998
- const { isIP } = await import('node:net');
999
- const { isPublicAddress } = await import('../workflow/callbacks');
1000
- const addresses = await lookup(url.hostname, { all: true });
1001
-
1002
- if (
1003
- !addresses.length ||
1004
- addresses.some(({ address }) => !isPublicAddress(address))
1005
- ) {
1006
- throw new SourceRetrievalError(
1007
- 'unsafe_destination',
1008
- 'Source DNS must resolve exclusively to public addresses',
1009
- );
1010
- }
1011
-
1012
- const { chromium } = await import('playwright');
1013
- const browser = await chromium.launch();
1014
-
1015
- try {
1016
- const page = await browser.newPage({
1017
- userAgent: `${researchUserAgent}/1`,
1018
- });
1019
-
1020
- await page.route('**/*', (route) => {
1021
- const target = new URL(route.request().url());
1022
- const host = target.hostname.replace(/^\[|\]$/g, '');
1023
-
1024
- if (
1025
- target.protocol !== 'https:' ||
1026
- (isIP(host) && !isPublicAddress(host)) ||
1027
- host === 'localhost' ||
1028
- host.endsWith('.local') ||
1029
- host.endsWith('.internal')
1030
- ) {
1031
- return route.abort();
1032
- }
1033
-
1034
- return route.continue();
1035
- });
1036
-
1037
- // Closing the page ends the navigation; its own failure changes nothing.
1038
- const abort = () => {
1039
- void page.close().catch(() => undefined);
1040
- };
1041
-
1042
- signal.addEventListener('abort', abort, { once: true });
1043
-
1044
- try {
1045
- await page.goto(url.href, { waitUntil: 'networkidle', timeout: 45_000 });
1004
+ await resolvePublicAddress(url.hostname, signal);
1005
+
1006
+ const { result } = await withGuardedChromium(
1007
+ (context) => {
1008
+ return withBoundedPage(context, 60_000, async (page) => {
1009
+ // Closing the page ends the navigation; its own failure changes
1010
+ // nothing.
1011
+ const abort = () => {
1012
+ void page.close().catch(() => undefined);
1013
+ };
1014
+
1015
+ signal.addEventListener('abort', abort, { once: true });
1016
+
1017
+ try {
1018
+ await page.goto(url.href, {
1019
+ waitUntil: 'networkidle',
1020
+ timeout: 45_000,
1021
+ });
1022
+
1023
+ return await page.content();
1024
+ } finally {
1025
+ signal.removeEventListener('abort', abort);
1026
+ }
1027
+ });
1028
+ },
1029
+ { userAgent: `${researchUserAgent}/1` },
1030
+ );
1046
1031
 
1047
- return await page.content();
1048
- } finally {
1049
- signal.removeEventListener('abort', abort);
1050
- }
1051
- } finally {
1052
- await browser.close();
1053
- }
1032
+ return result;
1054
1033
  };
1055
1034
 
1056
1035
  /** Every research journal entry, in order; an absent journal is empty. */
@@ -83,6 +83,7 @@ const sectionArgs = (
83
83
  language: deps.config.language,
84
84
  surfaces: deps.plan.surfaces,
85
85
  agentProbes: deps.config.agentProbes,
86
+ chatProbes: deps.config.chatProbes,
86
87
  agentCliVersions: deps.agentCliVersions,
87
88
  runId: deps.request.runId,
88
89
  probeStore: deps.stores.probeStore,