literally-aeo 0.2.1 → 0.3.0

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 (310) hide show
  1. package/dist/cli.mjs +6075 -5175
  2. package/dist/lib/agents/author-schema.js +5 -5
  3. package/dist/lib/agents/author-validation.js +9 -7
  4. package/dist/lib/agents/copy-validation.js +10 -10
  5. package/dist/lib/agents/copywriter-input.js +9 -9
  6. package/dist/lib/agents/facts.js +8 -8
  7. package/dist/lib/agents/narrative-facts.js +6 -6
  8. package/dist/lib/agents/verifier.js +14 -13
  9. package/dist/lib/analysis/domain-classifier.js +12 -10
  10. package/dist/lib/analysis/domain-labels.js +4 -4
  11. package/dist/lib/analysis/outreach.js +2 -2
  12. package/dist/lib/analysis/progress.js +9 -9
  13. package/dist/lib/analysis/retrieval.js +5 -5
  14. package/dist/lib/analysis/scoring.js +5 -5
  15. package/dist/lib/analysis/search-analyzer.js +6 -6
  16. package/dist/lib/analysis/sentiment.js +12 -10
  17. package/dist/lib/analysis/source-mix.js +2 -2
  18. package/dist/lib/author/examples.js +6 -6
  19. package/dist/lib/bundle/contracts.js +6 -6
  20. package/dist/lib/bundle/export.js +18 -18
  21. package/dist/lib/bundle/journal.js +7 -7
  22. package/dist/lib/bundle/project-journal.js +10 -10
  23. package/dist/lib/bundle/project.js +16 -16
  24. package/dist/lib/bundle/read.js +19 -19
  25. package/dist/lib/bundle/recorder.js +8 -8
  26. package/dist/lib/bundle/redact.js +7 -7
  27. package/dist/lib/bundle/trace-coverage.js +7 -7
  28. package/dist/lib/bundle/verify-integrity.js +9 -9
  29. package/dist/lib/bundle/verify-measurement.js +22 -13
  30. package/dist/lib/bundle/verify-report.js +24 -16
  31. package/dist/lib/bundle/verify.js +32 -24
  32. package/dist/lib/capture-manifest.js +6 -6
  33. package/dist/lib/checks/crawler-access.js +2 -2
  34. package/dist/lib/checks/money-pages.js +13 -0
  35. package/dist/lib/checks/renderability.js +2 -2
  36. package/dist/lib/checks/run-checks.js +12 -12
  37. package/dist/lib/chunks/{chunk-XAKME6NM.js → chunk-2C723CW7.js} +1 -1
  38. package/dist/lib/chunks/chunk-2FDSOZ6Q.js +287 -0
  39. package/dist/lib/chunks/{chunk-PWOYEIPF.js → chunk-2U5QSA6Q.js} +7 -7
  40. package/dist/lib/chunks/{chunk-6EI4CVRW.js → chunk-3ESH5NDR.js} +5 -1
  41. package/dist/lib/chunks/{chunk-7LBSNDRR.js → chunk-3S2FAVRE.js} +22 -3
  42. package/dist/lib/chunks/{chunk-LR27H2HZ.js → chunk-44NSZBCP.js} +6 -6
  43. package/dist/lib/chunks/{chunk-JBOOD6MU.js → chunk-4AWFF53U.js} +12 -4
  44. package/dist/lib/chunks/{chunk-MENTBQGB.js → chunk-4HPMLJKC.js} +4 -4
  45. package/dist/lib/chunks/{chunk-AAFHXNLU.js → chunk-4Q2WFZ5J.js} +11 -4
  46. package/dist/lib/chunks/{chunk-SD7LR26G.js → chunk-5JU2Y2I6.js} +2 -2
  47. package/dist/lib/chunks/{chunk-RPTADJXD.js → chunk-64JFN2Q5.js} +1 -1
  48. package/dist/lib/chunks/chunk-66UE4TT2.js +245 -0
  49. package/dist/lib/chunks/chunk-6N3C6E3D.js +105 -0
  50. package/dist/lib/chunks/{chunk-F2NSJ6PG.js → chunk-6RED3G6K.js} +7 -3
  51. package/dist/lib/chunks/{chunk-QJZTDZMB.js → chunk-7KLTOVIY.js} +9 -9
  52. package/dist/lib/chunks/{chunk-PXB4PWJI.js → chunk-7ZR3WDF2.js} +38 -5
  53. package/dist/lib/chunks/chunk-A5PF7UE2.js +86 -0
  54. package/dist/lib/chunks/{chunk-JXBLGCXZ.js → chunk-AB7DUTX5.js} +1 -1
  55. package/dist/lib/chunks/{chunk-WDT2Y7D7.js → chunk-AQCWKHTE.js} +11 -7
  56. package/dist/lib/chunks/{chunk-SQQ56UP2.js → chunk-ASHFEFCU.js} +3 -3
  57. package/dist/lib/chunks/{chunk-AK6YNTCV.js → chunk-ASIFUJG2.js} +1 -1
  58. package/dist/lib/chunks/{chunk-ZSEY7AHQ.js → chunk-BBK54RVK.js} +14 -11
  59. package/dist/lib/chunks/chunk-BQMUZLHO.js +17 -0
  60. package/dist/lib/chunks/{chunk-KSOHZKV5.js → chunk-CQNIPZH3.js} +21 -21
  61. package/dist/lib/chunks/{chunk-7HM6IZ3L.js → chunk-CVEXMYPW.js} +2 -2
  62. package/dist/lib/chunks/chunk-CXZIHHLJ.js +95 -0
  63. package/dist/lib/chunks/{chunk-75DMLOQ7.js → chunk-CYJNBVQB.js} +1 -1
  64. package/dist/lib/chunks/{chunk-FAUFE7MI.js → chunk-D7N5OLYL.js} +1 -1
  65. package/dist/lib/chunks/{chunk-E2YTTB6Q.js → chunk-DSK3PM4Z.js} +1 -1
  66. package/dist/lib/chunks/{chunk-TNL2GWYR.js → chunk-EUXNCXCR.js} +22 -0
  67. package/dist/lib/chunks/{chunk-FJL2V6P5.js → chunk-F4EQULFR.js} +6 -6
  68. package/dist/lib/chunks/{chunk-QGZ4QSUE.js → chunk-FHV4PBYG.js} +1 -1
  69. package/dist/lib/chunks/chunk-FK2JQHAX.js +30 -0
  70. package/dist/lib/chunks/{chunk-K2FZFESR.js → chunk-FONFW67K.js} +4 -4
  71. package/dist/lib/chunks/{chunk-W5X7WJYL.js → chunk-FPPHYGIO.js} +3 -3
  72. package/dist/lib/chunks/{chunk-XNTFOVCE.js → chunk-FYE4R5TY.js} +2 -2
  73. package/dist/lib/chunks/{chunk-FIC7JSR4.js → chunk-H2DOBJZC.js} +2 -2
  74. package/dist/lib/chunks/{chunk-R2AJYV6A.js → chunk-HEWHNSDP.js} +68 -36
  75. package/dist/lib/chunks/{chunk-RXSHKWZJ.js → chunk-HLC6OHGO.js} +2 -2
  76. package/dist/lib/chunks/{chunk-6HMHXSCS.js → chunk-HXXFRZTJ.js} +2 -2
  77. package/dist/lib/chunks/{chunk-JYFEXVWC.js → chunk-HYMWNGOK.js} +13 -6
  78. package/dist/lib/chunks/chunk-IH67TEGY.js +73 -0
  79. package/dist/lib/chunks/{chunk-JKPBXPCW.js → chunk-IMADI2YP.js} +1 -1
  80. package/dist/lib/chunks/{chunk-SLAPBFRH.js → chunk-JBGQFPTY.js} +4 -4
  81. package/dist/lib/chunks/{chunk-JQDQVG3D.js → chunk-JDU3ZCKO.js} +1 -1
  82. package/dist/lib/chunks/{chunk-2KH7LNK7.js → chunk-JGIX427K.js} +7 -7
  83. package/dist/lib/chunks/{chunk-7CW6U5WJ.js → chunk-JIE2ANVD.js} +1 -1
  84. package/dist/lib/chunks/{chunk-T5XQ6NXD.js → chunk-JJFOILZK.js} +2 -2
  85. package/dist/lib/chunks/{chunk-F7DBTXKG.js → chunk-JMIK2QN3.js} +4 -3
  86. package/dist/lib/chunks/chunk-JW7DTYSI.js +116 -0
  87. package/dist/lib/chunks/{chunk-BFWK3TBN.js → chunk-JXLCKACO.js} +2 -2
  88. package/dist/lib/chunks/{chunk-7WO3FFPS.js → chunk-K5NQDJLE.js} +1 -1
  89. package/dist/lib/chunks/{chunk-BXF4OC74.js → chunk-KI2FB4Y3.js} +30 -16
  90. package/dist/lib/chunks/{chunk-Y2CZ6FZY.js → chunk-KRWDELRS.js} +30 -7
  91. package/dist/lib/chunks/{chunk-SIJOQRRK.js → chunk-KRXOJJR7.js} +1 -1
  92. package/dist/lib/chunks/chunk-KSUI4DAY.js +15 -0
  93. package/dist/lib/chunks/chunk-KXFZ3CH3.js +98 -0
  94. package/dist/lib/chunks/{chunk-3OWJBGQE.js → chunk-LJCWZ5SZ.js} +14 -14
  95. package/dist/lib/chunks/{chunk-AJKV46SM.js → chunk-LNYQMWJO.js} +3 -3
  96. package/dist/lib/chunks/{chunk-DL6YQDTE.js → chunk-LOIAGEKN.js} +2 -2
  97. package/dist/lib/chunks/{chunk-I3UE52ZV.js → chunk-LPOIMPJK.js} +2 -2
  98. package/dist/lib/chunks/{chunk-66T7JC57.js → chunk-LUKP64NX.js} +2 -2
  99. package/dist/lib/chunks/chunk-MNG5TZRW.js +208 -0
  100. package/dist/lib/chunks/{chunk-SMPP7B7F.js → chunk-MPQXB7HN.js} +7 -7
  101. package/dist/lib/chunks/{chunk-6JICXLDA.js → chunk-MZ2KN3IH.js} +3 -3
  102. package/dist/lib/chunks/chunk-N62G4EWT.js +91 -0
  103. package/dist/lib/chunks/{chunk-7YDXD4MD.js → chunk-ODIXZHHX.js} +1 -1
  104. package/dist/lib/chunks/{chunk-MTDYBJXH.js → chunk-OTVHGRCO.js} +8 -8
  105. package/dist/lib/chunks/{chunk-YZEZRQIG.js → chunk-OVF27NAO.js} +69 -17
  106. package/dist/lib/chunks/chunk-P6LHGBYU.js +90 -0
  107. package/dist/lib/chunks/{chunk-U5USH2HB.js → chunk-PAL5SXIP.js} +1 -1
  108. package/dist/lib/chunks/{chunk-W5XYW6ZM.js → chunk-PT6PK2MJ.js} +26 -19
  109. package/dist/lib/chunks/{chunk-OD36HUXA.js → chunk-Q22FCF4A.js} +6 -7
  110. package/dist/lib/chunks/chunk-QKTKQSPS.js +292 -0
  111. package/dist/lib/chunks/{chunk-K4Y5NT4M.js → chunk-QO5TPMWS.js} +2 -2
  112. package/dist/lib/chunks/{chunk-VPXYGN4I.js → chunk-QUZYFAGP.js} +17 -22
  113. package/dist/lib/chunks/{chunk-HI3PD3KR.js → chunk-QVMPTT7R.js} +5 -5
  114. package/dist/lib/chunks/{chunk-OQFAMKLN.js → chunk-RGZY6YUQ.js} +5 -5
  115. package/dist/lib/chunks/{chunk-U6BW6LGX.js → chunk-RM2VVR7Y.js} +1 -1
  116. package/dist/lib/chunks/{chunk-AJO7XVXK.js → chunk-RMSH7RUG.js} +6 -6
  117. package/dist/lib/chunks/{chunk-V5B6UZ3E.js → chunk-RQGEPR6V.js} +1 -0
  118. package/dist/lib/chunks/{chunk-V5JJEEBT.js → chunk-RYB77E7O.js} +6 -5
  119. package/dist/lib/chunks/chunk-S24JGY7B.js +97 -0
  120. package/dist/lib/chunks/{chunk-6GKKALCI.js → chunk-SF4UJ2AY.js} +1 -1
  121. package/dist/lib/chunks/chunk-SJCUR4QX.js +94 -0
  122. package/dist/lib/chunks/{chunk-XAN4CRFP.js → chunk-SQ55KGHO.js} +1 -1
  123. package/dist/lib/chunks/{chunk-66DVMLGR.js → chunk-TKOQMB6A.js} +7 -7
  124. package/dist/lib/chunks/{chunk-UYDQXXDQ.js → chunk-TWK6IA4P.js} +1 -1
  125. package/dist/lib/chunks/{chunk-DVFFYY5G.js → chunk-U42I3SBR.js} +13 -9
  126. package/dist/lib/chunks/{chunk-FL6LN2K6.js → chunk-UECQONVZ.js} +5 -5
  127. package/dist/lib/chunks/{chunk-FDM2YNQL.js → chunk-VTY53IFN.js} +1 -1
  128. package/dist/lib/chunks/chunk-VYUC772A.js +338 -0
  129. package/dist/lib/chunks/{chunk-WCLKIPJV.js → chunk-WPCBE2NZ.js} +1 -1
  130. package/dist/lib/chunks/{chunk-3OE4UQIB.js → chunk-WRHGLRUK.js} +5 -5
  131. package/dist/lib/chunks/{chunk-3GPUCXVA.js → chunk-WUIY7BXR.js} +36 -19
  132. package/dist/lib/chunks/{chunk-7YYDUHJG.js → chunk-WZA4H4TG.js} +39 -13
  133. package/dist/lib/chunks/{chunk-NH4QGBJV.js → chunk-XBSA7MNJ.js} +7 -2
  134. package/dist/lib/chunks/chunk-XTBCXEH7.js +243 -0
  135. package/dist/lib/chunks/{chunk-ZQ3ER7JD.js → chunk-YPVJAXPP.js} +1 -1
  136. package/dist/lib/chunks/{chunk-SASE7U6E.js → chunk-YQD5ITKI.js} +1 -1
  137. package/dist/lib/chunks/{chunk-DDS4G4DO.js → chunk-YY4BH5XM.js} +6 -6
  138. package/dist/lib/chunks/{chunk-J5NPHPXY.js → chunk-Z3BZRBQF.js} +36 -2
  139. package/dist/lib/chunks/{chunk-XFUYEFQP.js → chunk-ZBQU2VU3.js} +1 -1
  140. package/dist/lib/chunks/{chunk-E3OGPTUY.js → chunk-ZHGABG7L.js} +2 -2
  141. package/dist/lib/chunks/chunk-ZZCRYG36.js +31 -0
  142. package/dist/lib/cli/bundle-commands.js +91 -74
  143. package/dist/lib/cli/run-commands.js +141 -96
  144. package/dist/lib/cli/status-command.js +77 -60
  145. package/dist/lib/codex-workflow/aggregate.js +20 -12
  146. package/dist/lib/codex-workflow/author-tools.js +7 -7
  147. package/dist/lib/codex-workflow/author.js +25 -23
  148. package/dist/lib/codex-workflow/capture.js +39 -18
  149. package/dist/lib/codex-workflow/checkpoint.js +7 -7
  150. package/dist/lib/codex-workflow/checks.js +9 -9
  151. package/dist/lib/codex-workflow/copy-editor.js +20 -19
  152. package/dist/lib/codex-workflow/copy-recovery.js +4 -4
  153. package/dist/lib/codex-workflow/copy.js +17 -16
  154. package/dist/lib/codex-workflow/finish.js +29 -25
  155. package/dist/lib/codex-workflow/host-models.js +2 -2
  156. package/dist/lib/codex-workflow/loop.js +54 -48
  157. package/dist/lib/codex-workflow/quality.js +4 -4
  158. package/dist/lib/codex-workflow/run-inputs.js +6 -6
  159. package/dist/lib/codex-workflow/run-source.js +16 -16
  160. package/dist/lib/codex-workflow/schemas.js +6 -6
  161. package/dist/lib/codex-workflow/session.js +8 -8
  162. package/dist/lib/codex-workflow/stage.js +32 -29
  163. package/dist/lib/codex-workflow/workdir.js +18 -11
  164. package/dist/lib/engine/audit-file.js +9 -8
  165. package/dist/lib/engine/author.js +40 -37
  166. package/dist/lib/engine/cost-estimate.js +37 -9
  167. package/dist/lib/engine/local-run.js +76 -59
  168. package/dist/lib/engine/preflight.js +37 -9
  169. package/dist/lib/engine/rejudge.js +82 -65
  170. package/dist/lib/engine/run-bindings.js +62 -0
  171. package/dist/lib/engine/run-status.js +77 -60
  172. package/dist/lib/engine/templates.js +10 -9
  173. package/dist/lib/grounding/controller.js +8 -7
  174. package/dist/lib/grounding/extract.js +8 -6
  175. package/dist/lib/grounding/grounding-runtime.js +22 -21
  176. package/dist/lib/grounding/model-usage.js +2 -2
  177. package/dist/lib/grounding/model.js +7 -5
  178. package/dist/lib/grounding/recorded-tools.js +9 -9
  179. package/dist/lib/harness/report/artifacts.js +5 -5
  180. package/dist/lib/lib/checkpoint.js +5 -5
  181. package/dist/lib/lib/log.js +1 -1
  182. package/dist/lib/models/accounting.js +1 -1
  183. package/dist/lib/models/batching.js +6 -4
  184. package/dist/lib/models/budget-protection.js +1 -1
  185. package/dist/lib/models/cost-coefficients.js +2 -1
  186. package/dist/lib/models/gateway-cost.js +7 -0
  187. package/dist/lib/models/structured.js +5 -3
  188. package/dist/lib/models/supported-models.js +1 -1
  189. package/dist/lib/pipeline.js +36 -17
  190. package/dist/lib/probes/adapter.js +6 -0
  191. package/dist/lib/probes/adapters/cli-agents.js +44 -0
  192. package/dist/lib/probes/adapters/cli-claude-code.js +21 -0
  193. package/dist/lib/probes/adapters/cli-codex.js +23 -0
  194. package/dist/lib/probes/adapters/cli-cursor.js +21 -0
  195. package/dist/lib/probes/adapters/cli-process.js +34 -0
  196. package/dist/lib/probes/adapters/dataforseo-ai-overview.js +20 -0
  197. package/dist/lib/probes/adapters/gateway-chat.js +30 -0
  198. package/dist/lib/probes/adapters/gateway-perplexity.js +19 -0
  199. package/dist/lib/probes/agent-cli-parsers.js +2 -2
  200. package/dist/lib/probes/agent-clis.js +26 -11
  201. package/dist/lib/probes/answer-text.js +21 -0
  202. package/dist/lib/probes/attempt.js +28 -0
  203. package/dist/lib/probes/bindings.js +69 -0
  204. package/dist/lib/probes/charged-trace.js +47 -3
  205. package/dist/lib/probes/dataforseo-locale.js +1 -1
  206. package/dist/lib/probes/dataforseo.js +8 -5
  207. package/dist/lib/probes/grounding-urls.js +6 -4
  208. package/dist/lib/probes/legacy-bindings.js +7 -0
  209. package/dist/lib/probes/limits.js +1 -1
  210. package/dist/lib/probes/probes.js +33 -12
  211. package/dist/lib/runner.js +17 -14
  212. package/dist/lib/schema.js +4 -4
  213. package/dist/lib/section-result.js +6 -6
  214. package/dist/lib/stores/artifacts.js +7 -7
  215. package/dist/lib/stores/files.js +20 -18
  216. package/dist/lib/stores/local-versions.js +5 -5
  217. package/dist/lib/stores/memory.js +20 -15
  218. package/dist/lib/stores/publication.js +11 -11
  219. package/dist/lib/stores/unit-record.js +28 -0
  220. package/dist/lib/viewer/server.js +33 -25
  221. package/dist/lib/workflow/schema.js +3 -3
  222. package/dist/types/bundle/contracts.d.ts +1 -1
  223. package/dist/types/capture-manifest.d.ts +1 -0
  224. package/dist/types/checks/money-pages.d.ts +19 -0
  225. package/dist/types/codex-workflow/capture.d.ts +13 -0
  226. package/dist/types/codex-workflow/workdir.d.ts +0 -1
  227. package/dist/types/engine/cost-estimate.d.ts +5 -1
  228. package/dist/types/engine/preflight.d.ts +6 -1
  229. package/dist/types/engine/run-bindings.d.ts +25 -0
  230. package/dist/types/models/accounting.d.ts +7 -0
  231. package/dist/types/models/cost-coefficients.d.ts +5 -5
  232. package/dist/types/models/gateway-cost.d.ts +3 -0
  233. package/dist/types/pipeline.d.ts +2 -0
  234. package/dist/types/probes/adapter.d.ts +112 -0
  235. package/dist/types/probes/adapters/cli-agents.d.ts +19 -0
  236. package/dist/types/probes/adapters/cli-claude-code.d.ts +4 -0
  237. package/dist/types/probes/adapters/cli-codex.d.ts +10 -0
  238. package/dist/types/probes/adapters/cli-cursor.d.ts +4 -0
  239. package/dist/types/probes/adapters/cli-process.d.ts +86 -0
  240. package/dist/types/probes/adapters/dataforseo-ai-overview.d.ts +12 -0
  241. package/dist/types/probes/adapters/gateway-chat.d.ts +32 -0
  242. package/dist/types/probes/adapters/gateway-perplexity.d.ts +10 -0
  243. package/dist/types/probes/agent-clis.d.ts +7 -49
  244. package/dist/types/probes/answer-text.d.ts +20 -0
  245. package/dist/types/probes/attempt.d.ts +113 -0
  246. package/dist/types/probes/bindings.d.ts +79 -0
  247. package/dist/types/probes/charged-trace.d.ts +2 -1
  248. package/dist/types/probes/dataforseo.d.ts +24 -1
  249. package/dist/types/probes/grounding-urls.d.ts +18 -5
  250. package/dist/types/probes/legacy-bindings.d.ts +36 -0
  251. package/dist/types/probes/limits.d.ts +12 -6
  252. package/dist/types/probes/probe-trace.d.ts +10 -0
  253. package/dist/types/probes/probes.d.ts +5 -3
  254. package/dist/types/stores/ports.d.ts +1 -0
  255. package/dist/types/stores/unit-record.d.ts +11 -0
  256. package/package.json +6 -6
  257. package/src/agents/author-validation.ts +22 -1
  258. package/src/analysis/progress.ts +10 -1
  259. package/src/bundle/contracts.ts +1 -1
  260. package/src/bundle/recorder.ts +47 -1
  261. package/src/capture-manifest.ts +6 -0
  262. package/src/checks/money-pages.ts +48 -0
  263. package/src/cli/run-commands.ts +37 -1
  264. package/src/codex-workflow/capture.ts +60 -0
  265. package/src/codex-workflow/workdir.ts +3 -4
  266. package/src/engine/audit-file.ts +20 -30
  267. package/src/engine/cost-estimate.ts +10 -4
  268. package/src/engine/local-run.ts +21 -2
  269. package/src/engine/preflight.ts +113 -17
  270. package/src/engine/rejudge.ts +5 -0
  271. package/src/engine/run-bindings.ts +142 -0
  272. package/src/grounding/extract.ts +1 -0
  273. package/src/grounding/model-usage.ts +4 -0
  274. package/src/lib/log.ts +17 -15
  275. package/src/models/accounting.ts +34 -0
  276. package/src/models/budget-protection.ts +1 -0
  277. package/src/models/cost-coefficients.ts +17 -13
  278. package/src/models/gateway-cost.ts +32 -0
  279. package/src/models/structured.ts +2 -10
  280. package/src/models/supported-models.ts +3 -3
  281. package/src/pipeline.ts +36 -17
  282. package/src/probes/adapter.ts +122 -0
  283. package/src/probes/adapters/cli-agents.ts +123 -0
  284. package/src/probes/adapters/cli-claude-code.ts +119 -0
  285. package/src/probes/adapters/cli-codex.ts +145 -0
  286. package/src/probes/adapters/cli-cursor.ts +95 -0
  287. package/src/probes/adapters/cli-process.ts +522 -0
  288. package/src/probes/adapters/dataforseo-ai-overview.ts +106 -0
  289. package/src/probes/adapters/gateway-chat.ts +339 -0
  290. package/src/probes/adapters/gateway-perplexity.ts +104 -0
  291. package/src/probes/agent-clis.ts +151 -1088
  292. package/src/probes/answer-text.ts +153 -0
  293. package/src/probes/attempt.ts +462 -0
  294. package/src/probes/bindings.ts +344 -0
  295. package/src/probes/charged-trace.ts +54 -13
  296. package/src/probes/dataforseo-locale.ts +13 -2
  297. package/src/probes/dataforseo.ts +265 -188
  298. package/src/probes/grounding-urls.ts +68 -19
  299. package/src/probes/legacy-bindings.ts +40 -0
  300. package/src/probes/limits.ts +31 -18
  301. package/src/probes/probe-trace.ts +10 -0
  302. package/src/probes/probes.ts +64 -736
  303. package/src/runner.ts +13 -0
  304. package/src/stores/files.ts +78 -54
  305. package/src/stores/memory.ts +4 -1
  306. package/src/stores/ports.ts +3 -0
  307. package/src/stores/unit-record.ts +151 -0
  308. package/dist/lib/chunks/chunk-BGAHZIL3.js +0 -563
  309. package/dist/lib/chunks/chunk-IB6RROHE.js +0 -204
  310. package/dist/lib/chunks/chunk-WZGI7UVM.js +0 -937
@@ -0,0 +1,95 @@
1
+ import { mkdir, writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { probeUsd } from '../../models/cost-coefficients';
4
+ import { ProbeAdapterId, type ProbeAdapterProfile } from '../adapter';
5
+ import { parseCursorStream } from '../agent-cli-parsers';
6
+ import { childEnv } from '../child-process';
7
+ import {
8
+ attachCliOutput,
9
+ authSettingNames,
10
+ execCli,
11
+ withScratchDir,
12
+ type AgentProbeFn,
13
+ } from './cli-process';
14
+
15
+ export const cursorProfile: ProbeAdapterProfile = {
16
+ id: ProbeAdapterId.CLI_CURSOR,
17
+ observes: { retrieval: 'full', servedModel: 'raw' },
18
+ settings: [{ name: 'CURSOR_API_KEY', secret: true, group: 'auth' }],
19
+ pool: 'cursor',
20
+ retry: 'agent',
21
+ estimateUsd: probeUsd[ProbeAdapterId.CLI_CURSOR],
22
+ billing: 'subscription',
23
+ resolvesRedirects: false,
24
+ };
25
+
26
+ // Cursor's auth variable, nothing else from the parent (§4.5).
27
+ const cursorEnvKeys = authSettingNames(cursorProfile);
28
+
29
+ // ---------------------------------------------------------------------------
30
+ // Cursor
31
+ // ---------------------------------------------------------------------------
32
+ // `cursor-agent -p --output-format stream-json --trust --force` with a
33
+ // project config in the scratch dir that denies command execution and file
34
+ // mutation. Headless `--trust` alone cannot approve anything, so every web
35
+ // search and fetch came back `result.rejected: "User Rejected"` — and the
36
+ // old regex detection matched the REQUEST event, flagging 150 of 192
37
+ // committed Cursor rows as searched (correctness spec §1.1). `--force` is
38
+ // what makes the surface exist; the deny list is what keeps the shell off.
39
+ // Verified 2026-09-03 on 2026.09.02: web search returns `result.success`,
40
+ // every shell attempt returns `result.permissionDenied` ("Command blocked by
41
+ // permissions configuration"). The `allow` array is required by the config
42
+ // schema even when empty.
43
+ //
44
+ // Isolation (residual exposure, documented per §3.1): cursor-agent has no
45
+ // equivalent of Claude Code's --setting-sources. The scratch dir carries no
46
+ // project rules or project MCP config, and --approve-mcps is deliberately
47
+ // NOT passed, so servers needing approval stay off; but user-level
48
+ // ~/.cursor/mcp.json servers already approved on the operator machine and
49
+ // account-level user rules can still load into the probe. Review Cursor
50
+ // answers for operator-tooling leakage the way that vendor plugin leak was
51
+ // caught (a line like "I notice you have X set up"). Whether cursor-agent
52
+ // leaves a transcript under $HOME is unverified (hardening spec §2.8).
53
+
54
+ const cursorProjectConfig = {
55
+ permissions: {
56
+ allow: [],
57
+ deny: ['Shell(*)', 'Write(*)', 'Edit(*)', 'Delete(*)'],
58
+ },
59
+ };
60
+
61
+ export const runCursorProbe: AgentProbeFn = async (
62
+ promptText,
63
+ runtime,
64
+ signal,
65
+ ) => {
66
+ return withScratchDir(runtime, 'cursor', async (dir) => {
67
+ await mkdir(path.join(dir, '.cursor'), { recursive: true });
68
+ await writeFile(
69
+ path.join(dir, '.cursor', 'cli.json'),
70
+ JSON.stringify(cursorProjectConfig),
71
+ 'utf8',
72
+ );
73
+
74
+ const output = await execCli('cursor-agent', {
75
+ cliArgs: [
76
+ '-p',
77
+ promptText,
78
+ '--output-format',
79
+ 'stream-json',
80
+ '--trust',
81
+ '--force',
82
+ ],
83
+ cwd: dir,
84
+ runtime,
85
+ env: childEnv(runtime.env, cursorEnvKeys),
86
+ signal,
87
+ });
88
+
89
+ try {
90
+ return parseCursorStream(output.stdout);
91
+ } catch (error) {
92
+ throw attachCliOutput(error, output);
93
+ }
94
+ });
95
+ };
@@ -0,0 +1,522 @@
1
+ import { mkdtemp, rm } from 'node:fs/promises';
2
+ import { homedir, tmpdir } from 'node:os';
3
+ import path from 'node:path';
4
+ import {
5
+ isWorkerInvocationError,
6
+ type WorkerTransport,
7
+ } from '../../container/protocol';
8
+ import type { AeoAgentSurface, RetrievalLog } from '../../schema';
9
+ import type { ProbeAdapterProfile } from '../adapter';
10
+ import { isRecord } from '../../lib/type-guards';
11
+ import {
12
+ codexArgs,
13
+ resolveCodexBinary,
14
+ } from '../../codex-workflow/codex-binary';
15
+ import {
16
+ AgentStreamError,
17
+ RejectedWebToolError,
18
+ RetrievalConsistencyError,
19
+ } from '../agent-cli-parsers';
20
+ import { ChildProcessError, runChild } from '../child-process';
21
+ import {
22
+ errorMessage,
23
+ isAuthError,
24
+ isCapacityError,
25
+ ProbeFailure,
26
+ type ProbeFailureKind,
27
+ } from '../failure';
28
+
29
+ // ============================================================================
30
+ // What every coding-agent CLI adapter shares (specs/aeo-probe-adapters-spec.md
31
+ // §4.10): how a CLI is started on this machine (a scratch directory, an
32
+ // allowlisted environment, a deadline and an output cap) and how its
33
+ // failure is read and classified. The per-CLI invocations live in
34
+ // cli-claude-code.ts, cli-codex.ts and cli-cursor.ts.
35
+ // ============================================================================
36
+
37
+ /** authSettingNames is the variables a CLI may authenticate with, any one
38
+ * of which is enough: what preflight accepts and what the CLI's child
39
+ * environment is allowed to carry. */
40
+ export const authSettingNames = (profile: ProbeAdapterProfile): string[] => {
41
+ return profile.settings
42
+ .filter((setting) => setting.group === 'auth')
43
+ .map((setting) => setting.name);
44
+ };
45
+
46
+ export const agentProbeTimeoutMs = 5 * 60 * 1000;
47
+ const agentKillGraceMs = 10_000;
48
+ // Verbose streams (stream-json) are several times the size of the old
49
+ // single-JSON output.
50
+ const agentMaxBufferBytes = 64 * 1024 * 1024;
51
+
52
+ // How the CLIs are launched (hardening spec §4.5): the environment the
53
+ // allowlist is built from and, for Claude Code, where its config lives.
54
+ export type AgentRuntime = {
55
+ env: NodeJS.ProcessEnv;
56
+ // A per-run directory for CLAUDE_CONFIG_DIR when auth is provisioned by
57
+ // variable (a token or API key): transcripts then die with the run. Null
58
+ // keeps the operator's logged-in config and deletes the probe's
59
+ // transcript directory after each probe instead (§2.8).
60
+ claudeConfigDir: string | null;
61
+ timeoutMs?: number;
62
+ // The isolated worker the CLIs run in, in the hosted platform. Absent, a
63
+ // CLI runs on this machine. Passed in, never read from a global slot.
64
+ transport?: WorkerTransport;
65
+ };
66
+
67
+ /** What one CLI run answered, as the parsers or a worker report it. */
68
+ export type AgentAnswer = {
69
+ text: string;
70
+ usedWebSearch: boolean | null;
71
+ retrieval: RetrievalLog;
72
+ requestedModel?: string | null;
73
+ reportedModel?: string;
74
+ };
75
+
76
+ export type AgentProbeFn = (
77
+ promptText: string,
78
+ runtime: AgentRuntime,
79
+ signal?: AbortSignal,
80
+ ) => Promise<AgentAnswer>;
81
+
82
+ /** What to spawn for an agent CLI on this machine. Codex is this package's
83
+ * own pinned dependency (specs/aeo-claude-operator-spec.md §4.3), run with
84
+ * the operator's Codex login when it is measured, unless the runtime's
85
+ * AEO_CODEX_BIN names another; the others come from PATH. */
86
+ export const localCommand = (
87
+ command: string,
88
+ args: readonly string[],
89
+ env: NodeJS.ProcessEnv,
90
+ ): { command: string; args: string[] } => {
91
+ if (command !== 'codex') {
92
+ return { command, args: [...args] };
93
+ }
94
+
95
+ const binary = resolveCodexBinary(env);
96
+
97
+ return { command: binary.command, args: codexArgs(binary, args) };
98
+ };
99
+
100
+ // ---------------------------------------------------------------------------
101
+ // Failure classification and reporting
102
+ // ---------------------------------------------------------------------------
103
+
104
+ export type AgentFailure = {
105
+ kind: ProbeFailureKind;
106
+ // Never contains the prompt: the child runner's messages name the command
107
+ // and the exit state, and the detail comes from the CLI's own output.
108
+ message: string;
109
+ };
110
+
111
+ type CliOutput = { stdout: string; stderr: string };
112
+
113
+ // Parser errors carry the CLI output they were raised over, so the failure
114
+ // line can quote the CLI's own account (a stream that ended in an API error
115
+ // message, say) without the classifier ever reading answer text. The output
116
+ // is kept beside the error rather than written onto it.
117
+ const cliOutputByError = new WeakMap<object, CliOutput>();
118
+
119
+ export const attachCliOutput = (error: unknown, output: CliOutput): unknown => {
120
+ if (typeof error === 'object' && error !== null) {
121
+ cliOutputByError.set(error, output);
122
+ }
123
+
124
+ return error;
125
+ };
126
+
127
+ const workerFailureKinds = new Map<string, ProbeFailureKind>([
128
+ ['capacity', 'capacity'],
129
+ ['auth', 'auth'],
130
+ ['timeout', 'timeout'],
131
+ ['parser', 'parser'],
132
+ ['rejected_web_tool', 'rejected_web_tool'],
133
+ ]);
134
+
135
+ export const classifyAgentError = (error: unknown): AgentFailure => {
136
+ if (error instanceof ProbeFailure) {
137
+ return { kind: error.kind, message: error.message };
138
+ }
139
+
140
+ if (isWorkerInvocationError(error)) {
141
+ const kind = workerFailureKinds.get(error.kind) ?? 'cli_error';
142
+
143
+ return { kind, message: error.detail ?? error.message };
144
+ }
145
+
146
+ if (error instanceof RejectedWebToolError) {
147
+ return { kind: 'rejected_web_tool', message: error.message };
148
+ }
149
+
150
+ if (error instanceof RetrievalConsistencyError) {
151
+ return { kind: 'parser', message: error.message };
152
+ }
153
+
154
+ if (error instanceof ChildProcessError) {
155
+ const { result } = error;
156
+
157
+ if (result.timedOut || result.aborted) {
158
+ return { kind: 'timeout', message: error.message };
159
+ }
160
+
161
+ const signals = cliFailureSignals(result);
162
+
163
+ return {
164
+ kind: kindFromSignals(signals.errorTexts, 'cli_error'),
165
+ message: signals.detail
166
+ ? `${error.message} — ${signals.detail}`
167
+ : error.message,
168
+ };
169
+ }
170
+
171
+ if (error instanceof AgentStreamError) {
172
+ const output = cliOutputByError.get(error);
173
+ const signals = output
174
+ ? cliFailureSignals({ code: 0, signal: null, ...output })
175
+ : { detail: '', errorTexts: [] };
176
+
177
+ return {
178
+ kind:
179
+ error.kind === 'cli_error'
180
+ ? kindFromSignals(signals.errorTexts, 'cli_error')
181
+ : 'parser',
182
+ message: signals.detail
183
+ ? `${error.message} — ${signals.detail}`
184
+ : error.message,
185
+ };
186
+ }
187
+
188
+ const message = errorMessage(error);
189
+
190
+ if (error instanceof Error && error.name === 'AbortError') {
191
+ return { kind: 'timeout', message };
192
+ }
193
+
194
+ return { kind: 'cli_error', message };
195
+ };
196
+
197
+ const kindFromSignals = (
198
+ errorTexts: readonly string[],
199
+ fallback: ProbeFailureKind,
200
+ ): ProbeFailureKind => {
201
+ const joined = errorTexts.join('\n');
202
+
203
+ if (isCapacityError(joined)) {
204
+ return 'capacity';
205
+ }
206
+
207
+ if (isAuthError(joined)) {
208
+ return 'auth';
209
+ }
210
+
211
+ return fallback;
212
+ };
213
+
214
+ const cliFailureDetailChars = 300;
215
+
216
+ export type CliFailureSignals = {
217
+ // The most useful line about the failure, for the log.
218
+ detail: string;
219
+ // Texts the classifier may read: stderr and the messages of events that
220
+ // the CLI itself marked as errors. Never a plain assistant text block.
221
+ errorTexts: string[];
222
+ };
223
+
224
+ const describeExit = ({
225
+ code,
226
+ signal,
227
+ }: {
228
+ code: number | null;
229
+ signal?: NodeJS.Signals | null;
230
+ }): string => {
231
+ if (typeof code === 'number') {
232
+ return `exit ${code}`;
233
+ }
234
+
235
+ if (signal) {
236
+ return `killed by ${signal}`;
237
+ }
238
+
239
+ return '';
240
+ };
241
+
242
+ /**
243
+ * What the CLI said about its own failure: the last event it marked as an
244
+ * error, otherwise stderr when it wrote anything, otherwise the last message
245
+ * in its NDJSON stdout (the `result`, an error string, or the last text
246
+ * block), otherwise the raw stdout tail. Error events come before stderr
247
+ * because Codex always writes a stdin notice there, even when the real error
248
+ * is a structured event.
249
+ */
250
+ export const cliFailureSignals = (output: {
251
+ code: number | null;
252
+ signal?: NodeJS.Signals | null;
253
+ stdout: string;
254
+ stderr: string;
255
+ }): CliFailureSignals => {
256
+ const exit = describeExit(output);
257
+ const stderrText = output.stderr.trim();
258
+ const errorTexts: string[] = [];
259
+ let lastErrorEventText: string | null = null;
260
+
261
+ if (stderrText) {
262
+ errorTexts.push(stderrText);
263
+ }
264
+
265
+ const events = parseEventLines(output.stdout);
266
+
267
+ for (const event of events) {
268
+ if (!isErrorEvent(event)) {
269
+ continue;
270
+ }
271
+
272
+ const text = eventMessage(event);
273
+
274
+ if (text) {
275
+ errorTexts.push(text);
276
+ lastErrorEventText = text;
277
+ }
278
+
279
+ if (typeof event.error === 'string') {
280
+ errorTexts.push(event.error);
281
+ }
282
+ }
283
+
284
+ let detail: string;
285
+
286
+ if (lastErrorEventText) {
287
+ detail = `error event: ${lastErrorEventText.slice(0, cliFailureDetailChars)}`;
288
+ } else if (stderrText) {
289
+ detail = `stderr: ${stderrText.slice(0, cliFailureDetailChars)}`;
290
+ } else {
291
+ const last = lastCliMessage(events, output.stdout);
292
+ detail = last ? `last stdout message: ${last}` : '';
293
+ }
294
+
295
+ return {
296
+ detail: [exit, detail].filter(Boolean).join(', '),
297
+ errorTexts,
298
+ };
299
+ };
300
+
301
+ /** Log line for a failed CLI run; empty when there is nothing to say. */
302
+ export const describeCliFailure = (output: {
303
+ code: number | null;
304
+ signal?: NodeJS.Signals | null;
305
+ stdout: string;
306
+ stderr: string;
307
+ }): string => {
308
+ return cliFailureSignals(output).detail;
309
+ };
310
+
311
+ const parseEventLines = (stdout: string): Record<string, unknown>[] => {
312
+ const events: Record<string, unknown>[] = [];
313
+
314
+ for (const line of stdout.split('\n')) {
315
+ const trimmed = line.trim();
316
+
317
+ if (!trimmed.startsWith('{')) {
318
+ continue;
319
+ }
320
+
321
+ try {
322
+ const event: unknown = JSON.parse(trimmed);
323
+
324
+ if (isRecord(event)) {
325
+ events.push(event);
326
+ }
327
+ } catch {
328
+ continue;
329
+ }
330
+ }
331
+
332
+ return events;
333
+ };
334
+
335
+ // An event the CLI marked as an error: Claude Code's `error` field on an
336
+ // assistant turn, an `is_error` result, an error subtype, Codex's top-level
337
+ // `error` event, `turn.failed` or item with `error`, a Cursor
338
+ // `subtype: 'error'`.
339
+ const isErrorEvent = (event: Record<string, unknown>): boolean => {
340
+ if (event.type === 'error') {
341
+ return true;
342
+ }
343
+
344
+ if (typeof event.error === 'string' || isRecord(event.error)) {
345
+ return true;
346
+ }
347
+
348
+ if (event.is_error === true) {
349
+ return true;
350
+ }
351
+
352
+ if (typeof event.subtype === 'string' && /error/i.test(event.subtype)) {
353
+ return true;
354
+ }
355
+
356
+ const item = isRecord(event.item) ? event.item : null;
357
+
358
+ if (item && (item.error !== undefined || item.status === 'failed')) {
359
+ return true;
360
+ }
361
+
362
+ return false;
363
+ };
364
+
365
+ // Newest-first scan of the NDJSON events for the first one carrying a
366
+ // human-readable message; falls back to the raw tail of the output.
367
+ const lastCliMessage = (
368
+ events: readonly Record<string, unknown>[],
369
+ stdout: string,
370
+ ): string => {
371
+ for (let i = events.length - 1; i >= 0; i -= 1) {
372
+ const event = events[i];
373
+
374
+ if (!event) {
375
+ continue;
376
+ }
377
+
378
+ const text = eventMessage(event);
379
+
380
+ if (text) {
381
+ return text.slice(0, cliFailureDetailChars);
382
+ }
383
+ }
384
+
385
+ return stdout.trim().slice(-cliFailureDetailChars);
386
+ };
387
+
388
+ // Readable text first (the final `result`, a text block, an agent message);
389
+ // a bare error code like Claude Code's `error: "server_error"` is the last
390
+ // resort, since the same event carries the full message as a text block.
391
+ const eventMessage = (event: Record<string, unknown>): string | null => {
392
+ const candidates: unknown[] = [event.result];
393
+ const message = isRecord(event.message) ? event.message : null;
394
+
395
+ if (Array.isArray(message?.content)) {
396
+ for (const block of message.content) {
397
+ if (isRecord(block) && typeof block.text === 'string') {
398
+ candidates.push(block.text);
399
+ }
400
+ }
401
+ }
402
+
403
+ if (isRecord(event.item)) {
404
+ candidates.push(event.item.text);
405
+ }
406
+
407
+ if (isRecord(event.msg)) {
408
+ candidates.push(event.msg.message);
409
+ }
410
+
411
+ // Codex: `{type: 'error', message}` and `{type: 'turn.failed', error: {message}}`.
412
+ candidates.push(event.message);
413
+
414
+ if (isRecord(event.error)) {
415
+ candidates.push(event.error.message);
416
+ }
417
+
418
+ candidates.push(event.error);
419
+
420
+ for (const candidate of candidates) {
421
+ if (typeof candidate === 'string' && candidate.trim()) {
422
+ return unwrapApiErrorBody(candidate.trim());
423
+ }
424
+ }
425
+
426
+ return null;
427
+ };
428
+
429
+ // Codex relays the API's error body as JSON text inside its own message. The
430
+ // readable part is the body's `error.message`; the HTTP status stays with it
431
+ // so the auth and capacity patterns still match.
432
+ const unwrapApiErrorBody = (text: string): string => {
433
+ if (!text.startsWith('{')) {
434
+ return text;
435
+ }
436
+
437
+ try {
438
+ const body: unknown = JSON.parse(text);
439
+
440
+ if (
441
+ isRecord(body) &&
442
+ isRecord(body.error) &&
443
+ typeof body.error.message === 'string'
444
+ ) {
445
+ return typeof body.status === 'number'
446
+ ? `HTTP ${body.status}: ${body.error.message}`
447
+ : body.error.message;
448
+ }
449
+ } catch {
450
+ // Text that only looks like JSON stands as written.
451
+ }
452
+
453
+ return text;
454
+ };
455
+
456
+ // ---------------------------------------------------------------------------
457
+ // Process plumbing
458
+ // ---------------------------------------------------------------------------
459
+
460
+ /**
461
+ * Creates an empty scratch directory so the agent sees no repo context, and
462
+ * removes it afterwards. Claude Code also writes its session transcript
463
+ * under `<config dir>/projects/<cwd slug>/` regardless of the scratch dir
464
+ * (hardening spec §2.8): with the operator's own config dir in use, that
465
+ * transcript — client prompt and answer — is deleted in the same finally.
466
+ */
467
+ export const withScratchDir = async <T>(
468
+ runtime: AgentRuntime,
469
+ surface: AeoAgentSurface,
470
+ fn: (dir: string) => Promise<T>,
471
+ ): Promise<T> => {
472
+ const dir = await mkdtemp(path.join(tmpdir(), 'aeo-agent-probe-'));
473
+
474
+ try {
475
+ return await fn(dir);
476
+ } finally {
477
+ await rm(dir, { recursive: true, force: true });
478
+
479
+ if (surface === 'claude_code' && !runtime.claudeConfigDir) {
480
+ await rm(claudeTranscriptDir(runtime.env, dir), {
481
+ recursive: true,
482
+ force: true,
483
+ });
484
+ }
485
+ }
486
+ };
487
+
488
+ /** Where Claude Code keeps the transcript of a session run in `cwd`. */
489
+ export const claudeTranscriptDir = (
490
+ env: NodeJS.ProcessEnv,
491
+ cwd: string,
492
+ ): string => {
493
+ const configDir =
494
+ env.CLAUDE_CONFIG_DIR ?? path.join(env.HOME ?? homedir(), '.claude');
495
+
496
+ return path.join(configDir, 'projects', cwd.replaceAll('/', '-'));
497
+ };
498
+
499
+ type ExecCliOptions = {
500
+ cliArgs: string[];
501
+ cwd: string;
502
+ runtime: AgentRuntime;
503
+ env: NodeJS.ProcessEnv;
504
+ signal?: AbortSignal;
505
+ };
506
+
507
+ export const execCli = async (
508
+ command: string,
509
+ { cliArgs, cwd, runtime, env, signal }: ExecCliOptions,
510
+ ): Promise<CliOutput> => {
511
+ const local = localCommand(command, cliArgs, runtime.env);
512
+ const result = await runChild(local.command, local.args, {
513
+ cwd,
514
+ env,
515
+ timeoutMs: runtime.timeoutMs ?? agentProbeTimeoutMs,
516
+ maxBuffer: agentMaxBufferBytes,
517
+ killGraceMs: agentKillGraceMs,
518
+ signal,
519
+ });
520
+
521
+ return { stdout: result.stdout, stderr: result.stderr };
522
+ };