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
package/src/schema.ts CHANGED
@@ -4,7 +4,11 @@ import {
4
4
  brandSchema,
5
5
  aeoPromptSchema,
6
6
  aeoSurfaceSchema,
7
+ isAgentSurface,
7
8
  sourceCategorySchema,
9
+ surfaceRunCounts,
10
+ type AeoChatSurface,
11
+ type AeoSurface,
8
12
  } from './report/core/schema';
9
13
  import { coverageThresholdsSchema } from './coverage-schema';
10
14
  import { groundingBundleSchema } from './grounding/schema';
@@ -23,13 +27,21 @@ export const aeoSectionConfigSchema = z.object({
23
27
  competitors: z.array(brandSchema).optional(),
24
28
  });
25
29
 
30
+ // Measurement depth: how many times each prompt is asked on a surface. A
31
+ // report may measure fewer prompts more deeply. The ceiling keeps one
32
+ // typo from planning thousands of paid answers; maxPlannedUnits and the
33
+ // budget still bound the run as a whole.
34
+ const maxRunsPerPrompt = 25;
35
+
36
+ const runsPerPromptSchema = z.number().int().min(1).max(maxRunsPerPrompt);
37
+
26
38
  // Agent probe volume (spec §5, revised 2026-08-21): defaults are the
27
- // canonical 2 runs per prompt over every prompt; reports may shrink the
28
- // agent batch. Changing either value after the first committed run is an
29
- // agent-baseline reset — call it out in the methodology note.
39
+ // canonical 2 runs per prompt over every prompt. Changing either value after
40
+ // the first committed run is an agent-baseline reset — call it out in the
41
+ // methodology note.
30
42
  export const agentProbeConfigSchema = z.object({
31
43
  // Runs per prompt per agent surface.
32
- runsPerPrompt: z.number().int().min(1).max(2).default(2),
44
+ runsPerPrompt: runsPerPromptSchema.default(2),
33
45
  // Cap on how many of each section's prompts get agent probes — the FIRST N
34
46
  // prompts in config order, so the subset is stable across runs. Omitted =
35
47
  // all prompts.
@@ -38,6 +50,55 @@ export const agentProbeConfigSchema = z.object({
38
50
 
39
51
  export type AgentProbeConfig = z.infer<typeof agentProbeConfigSchema>;
40
52
 
53
+ /** agentProbedPrompts is the prompts the coding agents are asked: the first
54
+ * maxPromptsPerSection in config order, or every prompt. */
55
+ export const agentProbedPrompts = <Prompt>(
56
+ prompts: readonly Prompt[],
57
+ agentProbes: AgentProbeConfig,
58
+ ): Prompt[] => {
59
+ return prompts.slice(0, agentProbes.maxPromptsPerSection ?? prompts.length);
60
+ };
61
+
62
+ // Chat probe volume. Optional with no default, so a config without it parses,
63
+ // and digests, exactly as configs did before chat depth was configurable:
64
+ // bundles exported earlier still verify. Omitted = the canonical
65
+ // surfaceRunCounts (2 per surface, 1 for AI Overview); set = that many runs
66
+ // on every chat surface. AI Overview included: each of its runs is a live
67
+ // search, sampling whether an overview appears and what it says.
68
+ export const chatProbeConfigSchema = z
69
+ .object({ runsPerPrompt: runsPerPromptSchema })
70
+ .strict();
71
+
72
+ export type ChatProbeConfig = z.infer<typeof chatProbeConfigSchema>;
73
+
74
+ /** chatRunsPerPrompt is how many times each prompt is asked on a chat
75
+ * surface. */
76
+ export const chatRunsPerPrompt = (
77
+ surface: AeoChatSurface,
78
+ chatProbes: ChatProbeConfig | undefined,
79
+ ): number => {
80
+ return chatProbes?.runsPerPrompt ?? surfaceRunCounts[surface];
81
+ };
82
+
83
+ export type ProbeDepth = {
84
+ agentProbes: AgentProbeConfig;
85
+ chatProbes: ChatProbeConfig | undefined;
86
+ };
87
+
88
+ /** runsPerPromptOn is how many times each prompt is asked on a surface: the
89
+ * depth the plan is built at, which the probe batches and every
90
+ * planned-answer denominator must match. */
91
+ export const runsPerPromptOn = (
92
+ surface: AeoSurface,
93
+ depth: ProbeDepth,
94
+ ): number => {
95
+ if (isAgentSurface(surface)) {
96
+ return depth.agentProbes.runsPerPrompt;
97
+ }
98
+
99
+ return chatRunsPerPrompt(surface, depth.chatProbes);
100
+ };
101
+
41
102
  const ownedCompetitorDomainSchema = z
42
103
  .string()
43
104
  .trim()
@@ -67,6 +128,9 @@ export const aeoAuditConfigSchema = z.object({
67
128
  // the schema — consumers read config.agentProbes directly, no fallbacks.
68
129
  // prefault({}) runs {} through the inner schema so its own defaults fill.
69
130
  agentProbes: agentProbeConfigSchema.prefault({}),
131
+ // Read through runsPerPromptOn or chatRunsPerPrompt, which own the
132
+ // fallback to the canonical counts.
133
+ chatProbes: chatProbeConfigSchema.optional(),
70
134
  // Renderability targets — docs, pricing, comparison pages (§7.4).
71
135
  moneyPages: z.array(z.string().url()),
72
136
  // Grounds accuracy flagging (§7.2): claims contradicting this brief are
@@ -6,6 +6,7 @@ import type {
6
6
  AeoVisibility,
7
7
  } from './schema';
8
8
  import {
9
+ agentProbedPrompts,
9
10
  agentSurfaces,
10
11
  allSurfaces,
11
12
  chatSurfaces,
@@ -48,6 +49,7 @@ export const assembleSectionResult = (
48
49
  | 'prompts'
49
50
  | 'surfaces'
50
51
  | 'agentProbes'
52
+ | 'chatProbes'
51
53
  >,
52
54
  capture: SectionCaptureSummary,
53
55
  analyses: readonly PromptAnalysisResult[],
@@ -60,10 +62,8 @@ export const assembleSectionResult = (
60
62
  (s): s is AeoAgentSurface => isAgentSurface(s),
61
63
  );
62
64
 
63
- const agentRunsPerPrompt = args.agentProbes.runsPerPrompt;
64
- const agentPrompts = args.agentProbes.maxPromptsPerSection
65
- ? args.prompts.slice(0, args.agentProbes.maxPromptsPerSection)
66
- : args.prompts;
65
+ const depth = { agentProbes: args.agentProbes, chatProbes: args.chatProbes };
66
+ const agentPrompts = agentProbedPrompts(args.prompts, args.agentProbes);
67
67
 
68
68
  const probeCount = capture.probeCount;
69
69
  const analysisFailures: SectionRunResult['analysisFailures'] =
@@ -120,6 +120,7 @@ export const assembleSectionResult = (
120
120
  .filter((r) => !isAgentSurface(r.surface))
121
121
  .map(toScoringInput),
122
122
  surfaces: selectedChatSurfaces,
123
+ depth,
123
124
  })
124
125
  : null;
125
126
 
@@ -134,7 +135,7 @@ export const assembleSectionResult = (
134
135
  prompts: agentPromptsForScoring,
135
136
  results: agentResults.map(toScoringInput),
136
137
  surfaces: selectedAgentSurfaces,
137
- runsPerSurface: agentRunsPerPrompt,
138
+ depth,
138
139
  })
139
140
  : null;
140
141
 
@@ -1,113 +0,0 @@
1
- import {
2
- createLog
3
- } from "./chunk-ZSEY7AHQ.js";
4
-
5
- // src/checks/renderability.ts
6
- import { load } from "cheerio";
7
- var log = createLog("Renderability");
8
- var fetchTimeoutMs = 2e4;
9
- var renderTimeoutMs = 45e3;
10
- var settleTimeoutMs = 8e3;
11
- var missingRatioThreshold = 0.4;
12
- var missingCharsThreshold = 500;
13
- var runRenderabilityCheck = async (moneyPages) => {
14
- if (moneyPages.length === 0) {
15
- return [];
16
- }
17
- const { chromium } = await import("playwright");
18
- const browser = await chromium.launch();
19
- try {
20
- const results = [];
21
- for (const url of moneyPages) {
22
- const pageStartedAt = Date.now();
23
- const result = await checkPage(url, browser);
24
- results.push(result);
25
- log.debug("Renderability page checked", {
26
- url,
27
- durationMs: Date.now() - pageStartedAt,
28
- staticTextChars: result.staticTextChars,
29
- renderedTextChars: result.renderedTextChars,
30
- flagged: result.flagged,
31
- error: result.error
32
- });
33
- }
34
- log.info("Renderability check completed", {
35
- pages: results.length,
36
- flagged: results.filter((r) => r.flagged).length,
37
- errors: results.filter((r) => r.error).length
38
- });
39
- return results;
40
- } finally {
41
- await browser.close();
42
- }
43
- };
44
- var checkPage = async (url, browser) => {
45
- try {
46
- const response = await fetch(url, {
47
- signal: AbortSignal.timeout(fetchTimeoutMs),
48
- headers: { "user-agent": "literally-aeo-audit/1.0" }
49
- });
50
- if (!response.ok) {
51
- return {
52
- url,
53
- staticTextChars: 0,
54
- renderedTextChars: 0,
55
- missingRatio: 0,
56
- flagged: false,
57
- error: `Static fetch failed: HTTP ${response.status}`
58
- };
59
- }
60
- const staticText = extractText(await response.text());
61
- const page = await browser.newPage();
62
- let renderedText;
63
- try {
64
- await page.goto(url, { waitUntil: "load", timeout: renderTimeoutMs });
65
- await page.waitForLoadState("networkidle", { timeout: settleTimeoutMs }).catch(() => void 0);
66
- renderedText = normalizeWhitespace(
67
- await page.evaluate(
68
- () => document.querySelector("body")?.innerText ?? ""
69
- )
70
- );
71
- } finally {
72
- await page.close();
73
- }
74
- const staticChars = staticText.length;
75
- const renderedChars = renderedText.length;
76
- const missingChars = Math.max(0, renderedChars - staticChars);
77
- const missingRatio = renderedChars > 0 ? missingChars / renderedChars : 0;
78
- const flagged = missingRatio > missingRatioThreshold && missingChars > missingCharsThreshold;
79
- return {
80
- url,
81
- staticTextChars: staticChars,
82
- renderedTextChars: renderedChars,
83
- missingRatio: Math.round(missingRatio * 1e3) / 1e3,
84
- flagged,
85
- error: null
86
- };
87
- } catch (error) {
88
- log.warn("Renderability check failed for page", {
89
- url,
90
- error: String(error)
91
- });
92
- return {
93
- url,
94
- staticTextChars: 0,
95
- renderedTextChars: 0,
96
- missingRatio: 0,
97
- flagged: false,
98
- error: error instanceof Error ? error.message : String(error)
99
- };
100
- }
101
- };
102
- var extractText = (html) => {
103
- const $ = load(html);
104
- $("script, style, noscript, template").remove();
105
- return normalizeWhitespace($("body").text());
106
- };
107
- var normalizeWhitespace = (text) => {
108
- return text.replace(/\s+/g, " ").trim();
109
- };
110
-
111
- export {
112
- runRenderabilityCheck
113
- };
@@ -1,356 +0,0 @@
1
- import {
2
- getEnvironment
3
- } from "./chunk-PO2J5OQ3.js";
4
- import {
5
- canonicalJson
6
- } from "./chunk-D5B4ZOW6.js";
7
-
8
- // src/models/profiles.ts
9
- import { createHash } from "node:crypto";
10
- import { z } from "zod";
11
- var internalModelProfileIdSchema = z.enum([
12
- "opus-grounding-v1",
13
- "astra-grounding-v1",
14
- "opus-harness-v1",
15
- "astra-harness-v1",
16
- // GLM 5.3 through the gateway for every text role, domain classification
17
- // included, and Kimi K3 for logo discovery. An evaluation profile, not
18
- // the default.
19
- "glm-harness-v1",
20
- // DeepSeek V4.1 Flash through the gateway for every text role, Kimi K3
21
- // for logo discovery. The profile every admission pins (codexRunnerProfile).
22
- "deepseek-harness-v1",
23
- // The same bulk roles on DeepSeek, with the premise verifier on Opus:
24
- // schema compliance and reasoning quality where a refused verdict costs a
25
- // copy generation (2026-09-12).
26
- "deepseek-harness-v2"
27
- ]);
28
- var defaultInternalModelProfile = "astra-grounding-v1";
29
- var codexRunnerProfile = "deepseek-harness-v1";
30
- var configuredModelProfileId = (env = getEnvironment()) => {
31
- return internalModelProfileIdSchema.parse(
32
- env.AEO_MODEL_PROFILE ?? env.AEO_INTERNAL_MODEL_PROFILE ?? defaultInternalModelProfile
33
- );
34
- };
35
- var generationBackendSchema = z.enum([
36
- "claude_code",
37
- "codex",
38
- "gateway"
39
- ]);
40
- var internalModelRoleSchema = z.object({
41
- model: z.enum([
42
- "anthropic/claude-opus-4.6",
43
- "openai/gpt-6-astra",
44
- "zai/glm-5.3",
45
- "moonshotai/kimi-k3",
46
- "deepseek/deepseek-v4.1-flash",
47
- "anthropic/claude-opus-5"
48
- ]),
49
- providerOptions: z.object({
50
- openai: z.object({ reasoningEffort: z.literal("high") }).strict().optional(),
51
- /** Ask the reasoning families to think hard. These models are not
52
- * the strongest available, so depth is worth its tokens; streaming
53
- * keeps a long generation inside the gateway's limits. A token
54
- * budget is deliberately NOT sent: GLM ignores it (measured). */
55
- gateway: z.object({
56
- reasoning: z.union([
57
- z.object({ effort: z.literal("high") }).strict(),
58
- /** Pinned before 2026-09-11, while the budget was believed to
59
- * be honoured. GLM ignores it, so it is no longer emitted, but
60
- * a stored profile must keep parsing and dispatching exactly as
61
- * admitted. */
62
- z.object({ max_tokens: z.number().int().positive() }).strict()
63
- ]),
64
- /** The gateway load-balances an open-weight model across
65
- * upstream providers, and not every upstream honours a JSON
66
- * response schema: on 2026-09-12 the `zai` and `novita` routes
67
- * for GLM 5.3 dropped the schema and every structured call
68
- * failed as `StructuredOutputMissingError`, while `baseten`
69
- * and `fireworks` answered in a second. The pinned routes are
70
- * the ones probed to return objects; the gateway still balances
71
- * among them. Absent on profiles pinned before the routing pin. */
72
- only: z.array(z.string().min(1)).min(1).max(12).optional()
73
- }).strict().optional()
74
- }).strict(),
75
- promptVersion: z.string().min(1),
76
- schemaVersion: z.string().min(1),
77
- deadlineMs: z.number().int().positive(),
78
- maxInputTokens: z.number().int().positive().max(1e5),
79
- maxOutputTokens: z.number().int().positive(),
80
- /** How many items one batched call may carry, when the pinned model
81
- * wants a narrower batch than the call site's own default. Absent leaves
82
- * that default, so profiles pinned before this keep their exact digest. */
83
- maxItemsPerCall: z.number().int().positive().optional(),
84
- pricingUsdPerMillion: z.object({
85
- input: z.number().positive(),
86
- output: z.number().positive(),
87
- cachedInput: z.number().nonnegative()
88
- }).strict()
89
- }).strict();
90
- var researchSearchProviderSchema = z.enum([
91
- "disabled",
92
- "dataforseo-google-organic-v1"
93
- ]);
94
- var internalModelProfileSchema = z.object({
95
- id: internalModelProfileIdSchema,
96
- version: z.literal(1),
97
- pricingCheckedAt: z.iso.date(),
98
- searchProvider: researchSearchProviderSchema,
99
- roles: z.object({
100
- analyzer: internalModelRoleSchema,
101
- perception: internalModelRoleSchema,
102
- research: internalModelRoleSchema,
103
- adjudication: internalModelRoleSchema,
104
- premiseVerifier: internalModelRoleSchema,
105
- author: internalModelRoleSchema,
106
- copy: internalModelRoleSchema,
107
- domainClassifier: internalModelRoleSchema,
108
- // Missing on stored profiles: optional enrichment never rewrites pins.
109
- logoDiscovery: internalModelRoleSchema.optional(),
110
- competitorClassifier: internalModelRoleSchema.optional(),
111
- /** Retired roles, still accepted so profiles pinned before their
112
- * retirement parse unchanged on resume: the visual reviewer went with
113
- * the model-backed visual review (11 September 2026), the scrutiny
114
- * and repair-planner roles with the journaled harness loop
115
- * (13 September 2026). No new profile resolves them. */
116
- scrutiny: internalModelRoleSchema.optional(),
117
- repairPlanner: internalModelRoleSchema.optional(),
118
- visualReviewer: internalModelRoleSchema.optional()
119
- }).strict()
120
- }).strict();
121
- var familyModels = {
122
- opus: "anthropic/claude-opus-4.6",
123
- astra: "openai/gpt-6-astra",
124
- glm: "zai/glm-5.3",
125
- kimi: "moonshotai/kimi-k3",
126
- deepseek: "deepseek/deepseek-v4.1-flash",
127
- /** The judgment family of `deepseek-harness-v2` (Andrei, 2026-09-12):
128
- * Opus 5 at high adaptive effort. Opus 4.6 stays pinned for the older
129
- * profiles' stored meaning. */
130
- opus5: "anthropic/claude-opus-5"
131
- };
132
- var familyRoutes = {
133
- glm: ["baseten", "fireworks", "deepinfra", "friendli"],
134
- // DeepInfra answered the one-object probe but refused the evidence
135
- // reviewer's request outright (finish reason "error", no output, three
136
- // times in a row, 2026-09-12); Baseten reported capacity errors under
137
- // restriction. The first-party route and Fireworks carried every stage.
138
- deepseek: ["deepseek", "fireworks"]
139
- };
140
- var familyPricing = {
141
- opus: { input: 5, output: 25, cachedInput: 0.5 },
142
- astra: { input: 10, output: 50, cachedInput: 1 },
143
- glm: { input: 1.4, output: 4.4, cachedInput: 0.14 },
144
- kimi: { input: 3, output: 15, cachedInput: 0.3 },
145
- deepseek: { input: 0.3, output: 1.2, cachedInput: 0.03 },
146
- opus5: { input: 5, output: 25, cachedInput: 0.5 }
147
- };
148
- var profileIdPattern = /^(opus|astra|glm|deepseek)-(grounding|harness)-v(\d+)$/;
149
- var textFamilies = [
150
- "opus",
151
- "astra",
152
- "glm",
153
- "deepseek"
154
- ];
155
- var isTextFamily = (value) => {
156
- return textFamilies.some((family) => family === value);
157
- };
158
- var parseInternalModelProfileId = (id) => {
159
- const match = profileIdPattern.exec(id);
160
- const family = match?.[1];
161
- if (!match || !isTextFamily(family)) {
162
- throw new Error(`internal_model_profile_unrecognized: ${id}`);
163
- }
164
- return { family, version: Number(match[3]) };
165
- };
166
- var reasoningOutputFamilies = [
167
- "glm",
168
- "kimi",
169
- "deepseek"
170
- ];
171
- var thinkingInOutputFamilies = [
172
- ...reasoningOutputFamilies,
173
- "opus5"
174
- ];
175
- var reasoningBudgetTokens = 32768;
176
- var getProviderOptions = (family, isReasoning) => {
177
- if (family === "astra") {
178
- return { openai: { reasoningEffort: "high" } };
179
- }
180
- if (!isReasoning && family !== "opus5") {
181
- return {};
182
- }
183
- const routes = familyRoutes[family];
184
- return {
185
- gateway: {
186
- reasoning: { effort: "high" },
187
- ...routes ? { only: [...routes] } : {}
188
- }
189
- };
190
- };
191
- var promptVersions = {
192
- copy: 5,
193
- premiseVerifier: 5,
194
- analyzer: 3,
195
- research: 2,
196
- adjudication: 2,
197
- competitorClassifier: 2,
198
- domainClassifier: 2
199
- };
200
- var schemaVersions = {
201
- copy: 3,
202
- adjudication: 2,
203
- premiseVerifier: 2
204
- };
205
- var createRoleConfig = (name, family, {
206
- maxOutputTokens = 16384,
207
- deadlineMs = 18e4,
208
- reasoningItemsPerCall
209
- } = {}) => {
210
- const reasoning = reasoningOutputFamilies.includes(family);
211
- const reasoningBudget = thinkingInOutputFamilies.includes(family) ? reasoningBudgetTokens : 0;
212
- const output = maxOutputTokens + reasoningBudget;
213
- const deadline = reasoning ? Math.min(deadlineMs * 3, 9e5) : deadlineMs;
214
- const roleConfig = {
215
- model: familyModels[family],
216
- providerOptions: getProviderOptions(family, reasoning),
217
- // premiseVerifier v4/v2 (2026-09-12): the verdict carries an explicit
218
- // `passed` flag and the prompt forbids placeholder text in `errors`.
219
- // premiseVerifier v5 (2026-09-13): an irrelevant but supported premise
220
- // no longer fails a block on its own.
221
- // copy v4 (2026-09-12): COPY_RULES.md now states the verifier's own
222
- // refusals (buyer behaviour, positioning, rankings, unmeasured
223
- // qualities, scope words, publisher), which the previous rules invited.
224
- // analyzer v2 (2026-09-12): the prompt states the attribution rule the
225
- // reviewers enforce, so an alias behind another vendor's product is not
226
- // a mention. Until then every "Deno-based" phrase was credited to Deno
227
- // Deploy and every run blocked on false_product_attribution.
228
- // copy v5 and analyzer v3 (2026-09-12): both prompts now carry the
229
- // producer guidance of the criterion registry, the single source the
230
- // reviewers judge by.
231
- // competitorClassifier and domainClassifier v2 (2026-09-12): both
232
- // prompts carry the registry's enrichment guidance (umbrella brands,
233
- // duplicates, named recommendations, source categories).
234
- // COPY_RULES.md change without a copy bump (2026-09-13): the hero title
235
- // is asked for as one sentence in sentence case, after a container run
236
- // produced a title-case fragment. The Codex write stage digests
237
- // src/author/COPY_RULES.md itself, and a bump here would change the digest of every
238
- // stored profile ID, which the pin test below forbids.
239
- promptVersion: `${name}-grounding-v${promptVersions[name] ?? 1}`,
240
- schemaVersion: `${name}-v${schemaVersions[name] ?? 1}`,
241
- deadlineMs: deadline,
242
- maxInputTokens: 8e4,
243
- maxOutputTokens: output,
244
- ...reasoning && reasoningItemsPerCall !== void 0 ? { maxItemsPerCall: reasoningItemsPerCall } : {},
245
- pricingUsdPerMillion: familyPricing[family]
246
- };
247
- return roleConfig;
248
- };
249
- var pricingCheckedDates = {
250
- deepseek: "2026-09-12",
251
- glm: "2026-09-11"
252
- };
253
- var resolveInternalModelProfile = (id = defaultInternalModelProfile, env = getEnvironment()) => {
254
- const parsedId = internalModelProfileIdSchema.parse(id);
255
- const { family, version } = parseInternalModelProfileId(parsedId);
256
- const judgment = family === "deepseek" && version >= 2 ? "opus5" : family;
257
- const openWeight = family === "glm" || family === "deepseek";
258
- const vision = openWeight ? "kimi" : "opus";
259
- const classification = openWeight ? family : "opus";
260
- const reasoning = family !== "opus";
261
- return internalModelProfileSchema.parse({
262
- id,
263
- version: 1,
264
- pricingCheckedAt: pricingCheckedDates[family] ?? "2026-09-09",
265
- searchProvider: researchSearchProviderSchema.parse(
266
- env.AEO_RESEARCH_SEARCH_PROVIDER ?? (env.DATAFORSEO_LOGIN && env.DATAFORSEO_PASSWORD ? "dataforseo-google-organic-v1" : "disabled")
267
- ),
268
- roles: {
269
- // Batched roles carry a narrower ceiling for the reasoning families.
270
- // Five answers in one analyzer call ran past the transport's five
271
- // minutes on GLM (2026-09-11) after spending most of the allowance on
272
- // thinking; each call now covers a fraction of the work instead.
273
- analyzer: createRoleConfig("analyzer", family, {
274
- maxOutputTokens: 16384,
275
- deadlineMs: reasoning ? 6e5 : 18e4,
276
- reasoningItemsPerCall: 2
277
- }),
278
- // Perception's pin also governs claim extraction, which shares the
279
- // role and batches three answers of its own; streaming carries a call
280
- // that size comfortably, so this only narrows perception itself.
281
- perception: createRoleConfig("perception", family, {
282
- maxOutputTokens: 16384,
283
- deadlineMs: 3e5,
284
- reasoningItemsPerCall: 5
285
- }),
286
- research: createRoleConfig("research", family, {
287
- maxOutputTokens: 4096,
288
- deadlineMs: 6e4
289
- }),
290
- // Bounded by verdicts per call, so a wide claim set splits instead of
291
- // pushing the retrieved evidence out of the prompt.
292
- adjudication: createRoleConfig("adjudication", family, {
293
- maxOutputTokens: 16384,
294
- deadlineMs: 3e5,
295
- reasoningItemsPerCall: 8
296
- }),
297
- // One judgement per call. This role carries the longest instructions in
298
- // the system and is asked to enumerate every explicit and implied
299
- // premise; measured 2026-09-11, three of four calls holding several
300
- // blocks ran to their cap on reasoning alone and returned nothing,
301
- // while the one that finished had spent 22,899 tokens thinking.
302
- premiseVerifier: createRoleConfig("premiseVerifier", judgment, {
303
- maxOutputTokens: 8192,
304
- deadlineMs: 18e4,
305
- reasoningItemsPerCall: 1
306
- }),
307
- author: createRoleConfig("author", family, {
308
- maxOutputTokens: 24576,
309
- deadlineMs: 3e5
310
- }),
311
- copy: createRoleConfig("copy", family, {
312
- maxOutputTokens: 24576,
313
- deadlineMs: 3e5
314
- }),
315
- domainClassifier: createRoleConfig("domainClassifier", classification, {
316
- maxOutputTokens: 16384,
317
- deadlineMs: 18e4,
318
- reasoningItemsPerCall: 25
319
- }),
320
- competitorClassifier: createRoleConfig("competitorClassifier", family, {
321
- maxOutputTokens: 8192,
322
- deadlineMs: 3e5
323
- }),
324
- logoDiscovery: {
325
- ...createRoleConfig("logoDiscovery", vision, {
326
- maxOutputTokens: 1024,
327
- deadlineMs: 6e4
328
- }),
329
- promptVersion: "logoDiscovery-grounding-v2",
330
- schemaVersion: "logoDiscovery-v2",
331
- maxInputTokens: 24e3
332
- }
333
- }
334
- });
335
- };
336
- var internalModelProfileDigest = (profile) => {
337
- return createHash("sha256").update(canonicalJson(internalModelProfileSchema.parse(profile))).digest("hex");
338
- };
339
- var internalModelRoleDigest = (roleConfig) => {
340
- return createHash("sha256").update(canonicalJson(internalModelRoleSchema.parse(roleConfig))).digest("hex");
341
- };
342
-
343
- export {
344
- internalModelProfileIdSchema,
345
- defaultInternalModelProfile,
346
- codexRunnerProfile,
347
- configuredModelProfileId,
348
- generationBackendSchema,
349
- internalModelRoleSchema,
350
- researchSearchProviderSchema,
351
- internalModelProfileSchema,
352
- parseInternalModelProfileId,
353
- resolveInternalModelProfile,
354
- internalModelProfileDigest,
355
- internalModelRoleDigest
356
- };