literally-aeo 0.1.1 → 0.2.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 (262) hide show
  1. package/README.md +42 -6
  2. package/dist/author-tools.js +33 -64
  3. package/dist/cli.mjs +2723 -1616
  4. package/dist/lib/agents/author-schema.js +4 -5
  5. package/dist/lib/agents/author-validation.js +5 -6
  6. package/dist/lib/agents/copy-validation.js +4 -5
  7. package/dist/lib/agents/verifier.js +8 -8
  8. package/dist/lib/analysis/domain-classifier.js +8 -8
  9. package/dist/lib/analysis/domain-labels.js +3 -4
  10. package/dist/lib/analysis/progress.js +3 -4
  11. package/dist/lib/analysis/sentiment.js +8 -8
  12. package/dist/lib/author/examples.js +5 -6
  13. package/dist/lib/bundle/contracts.js +5 -6
  14. package/dist/lib/bundle/export.js +22 -19
  15. package/dist/lib/bundle/isolation.js +17 -0
  16. package/dist/lib/bundle/journal.js +6 -7
  17. package/dist/lib/bundle/project-journal.js +11 -10
  18. package/dist/lib/bundle/project.js +19 -16
  19. package/dist/lib/bundle/read.js +23 -20
  20. package/dist/lib/bundle/recorder.js +9 -8
  21. package/dist/lib/bundle/redact.js +6 -7
  22. package/dist/lib/bundle/trace-coverage.js +6 -7
  23. package/dist/lib/bundle/verify-integrity.js +8 -9
  24. package/dist/lib/bundle/verify-measurement.js +10 -11
  25. package/dist/lib/bundle/verify-report.js +11 -12
  26. package/dist/lib/bundle/verify.js +17 -18
  27. package/dist/lib/bundle/writer-lock.js +3 -1
  28. package/dist/lib/capture-manifest.js +3 -4
  29. package/dist/lib/checks/run-checks.js +10 -9
  30. package/dist/lib/chunks/chunk-2B5QF6UQ.js +159 -0
  31. package/dist/lib/chunks/{chunk-ZBDUE3A5.js → chunk-2GU6CNQI.js} +12 -7
  32. package/dist/lib/chunks/{chunk-CKUTDJAB.js → chunk-2ROXN2EC.js} +42 -7
  33. package/dist/lib/chunks/{chunk-XHWRSGX3.js → chunk-3JO5TXBA.js} +1 -1
  34. package/dist/lib/chunks/{chunk-XL4JIQ5X.js → chunk-4PD65FRJ.js} +7 -3
  35. package/dist/lib/chunks/{chunk-GMKF2FU4.js → chunk-5JPYM4MD.js} +1 -1
  36. package/dist/lib/chunks/{chunk-5VNYUCLL.js → chunk-622NMXN6.js} +6 -9
  37. package/dist/lib/chunks/{chunk-XNRSHATN.js → chunk-663HABKP.js} +5 -5
  38. package/dist/lib/chunks/{chunk-RMFT4KKK.js → chunk-6G25V4CF.js} +1 -1
  39. package/dist/lib/chunks/{chunk-GVC4LH2N.js → chunk-6GHHNPFJ.js} +1 -1
  40. package/dist/lib/chunks/{chunk-KMRQSIZW.js → chunk-6GOBBNDU.js} +16 -1
  41. package/dist/lib/chunks/{chunk-SBAZBOPI.js → chunk-6P7EZJI7.js} +4 -2
  42. package/dist/lib/chunks/chunk-7XO3SQAX.js +117 -0
  43. package/dist/lib/chunks/{chunk-SWS3K62X.js → chunk-7Z27HQWL.js} +3 -3
  44. package/dist/lib/chunks/{chunk-IPNK7FYT.js → chunk-AYY4MYTW.js} +1 -1
  45. package/dist/lib/chunks/{chunk-WDSCJEDG.js → chunk-BE4ENGUY.js} +10 -10
  46. package/dist/lib/chunks/{chunk-FKLNEB2P.js → chunk-BGOIPHJZ.js} +39 -11
  47. package/dist/lib/chunks/{chunk-7GXRDAUY.js → chunk-BLKLPUYR.js} +2 -2
  48. package/dist/lib/chunks/chunk-BSRKN6FU.js +93 -0
  49. package/dist/lib/chunks/{chunk-PCYNBDZ7.js → chunk-CO5T6WU5.js} +14 -9
  50. package/dist/lib/chunks/{chunk-E3OEE5XN.js → chunk-CUYVHXHI.js} +2 -2
  51. package/dist/lib/chunks/{chunk-2GY42RIJ.js → chunk-D3GE3OCB.js} +1 -1
  52. package/dist/lib/chunks/chunk-DVFFYY5G.js +74 -0
  53. package/dist/lib/chunks/{chunk-ZXGATMMH.js → chunk-EBUQPCKB.js} +1 -1
  54. package/dist/lib/chunks/{chunk-4E4NDGOZ.js → chunk-EE26FNSY.js} +1 -1
  55. package/dist/lib/chunks/{chunk-AUB5THIS.js → chunk-EJ655TVU.js} +1 -1
  56. package/dist/lib/chunks/{chunk-S2AM76LT.js → chunk-F4W5YHDZ.js} +2 -2
  57. package/dist/lib/chunks/chunk-FAUFE7MI.js +31 -0
  58. package/dist/lib/chunks/{chunk-FNDJUELJ.js → chunk-FOCJ7HPC.js} +7 -7
  59. package/dist/lib/chunks/{chunk-FPAN3VRW.js → chunk-FUAUPNRO.js} +26 -18
  60. package/dist/lib/chunks/{chunk-OQVIRYT5.js → chunk-G62E525I.js} +2 -2
  61. package/dist/lib/chunks/{chunk-2NJEWPCV.js → chunk-GDKGZQ3T.js} +2 -2
  62. package/dist/lib/chunks/{chunk-HSZ3DM74.js → chunk-GEFKDW7X.js} +15 -2
  63. package/dist/lib/chunks/{chunk-47IZBMP2.js → chunk-GESHTTSA.js} +2 -2
  64. package/dist/lib/chunks/chunk-GNMFJ2OK.js +321 -0
  65. package/dist/lib/chunks/{chunk-NVBMIPXR.js → chunk-HFRAHG5C.js} +44 -26
  66. package/dist/lib/chunks/{chunk-MHAKYFDF.js → chunk-HQG63ZKO.js} +11 -11
  67. package/dist/lib/chunks/{chunk-OORO55OM.js → chunk-HTOD4W4E.js} +21 -6
  68. package/dist/lib/chunks/{chunk-Q2PWES4B.js → chunk-I3XGRGXE.js} +1 -1
  69. package/dist/lib/chunks/{chunk-WUELMJ22.js → chunk-IE7NAL6B.js} +1 -1
  70. package/dist/lib/chunks/{chunk-KRFHQQS7.js → chunk-JXMDOAKA.js} +17 -17
  71. package/dist/lib/chunks/{chunk-S7KJZIUR.js → chunk-KJMU5KH4.js} +2 -2
  72. package/dist/lib/chunks/{chunk-POUSX3T4.js → chunk-L7MEIRJB.js} +1 -1
  73. package/dist/lib/chunks/{chunk-CPT2GKKW.js → chunk-LOBXOZ2R.js} +1 -1
  74. package/dist/lib/chunks/{chunk-IAR6XGEW.js → chunk-ML4W6KC6.js} +1 -1
  75. package/dist/lib/chunks/{chunk-WKH6BJAZ.js → chunk-MNWO7EHC.js} +4 -4
  76. package/dist/lib/chunks/{chunk-D2LPQO6Y.js → chunk-MRL5RUP7.js} +1 -1
  77. package/dist/lib/chunks/{chunk-IEVAFDW7.js → chunk-NCXSNHXX.js} +3 -3
  78. package/dist/lib/chunks/{chunk-HFOYASRQ.js → chunk-NGHAP2P5.js} +4 -4
  79. package/dist/lib/chunks/{chunk-ZLOOC46D.js → chunk-OKL7GN2F.js} +3 -3
  80. package/dist/lib/chunks/{chunk-3DG7GHFA.js → chunk-OQU5IXAJ.js} +5 -5
  81. package/dist/lib/chunks/{chunk-I7VNIW6Q.js → chunk-OU73OUX4.js} +16 -10
  82. package/dist/lib/chunks/{chunk-56VOFZ7T.js → chunk-QHUDJVPJ.js} +90 -24
  83. package/dist/lib/chunks/{chunk-KHU5DRBE.js → chunk-QSJ4IKUF.js} +9 -9
  84. package/dist/lib/chunks/{chunk-FBFZBLTY.js → chunk-R6XDZWUL.js} +7 -8
  85. package/dist/lib/chunks/{chunk-CJ5YD3CU.js → chunk-RJ5R6YYA.js} +5 -5
  86. package/dist/lib/chunks/{chunk-LPND3VNQ.js → chunk-RR46EDDR.js} +33 -25
  87. package/dist/lib/chunks/chunk-RYCRL3YA.js +106 -0
  88. package/dist/lib/chunks/{chunk-Z4LMDKBU.js → chunk-SHUMCKCS.js} +2 -2
  89. package/dist/lib/chunks/{chunk-3EBWDHPK.js → chunk-TJQ5OPLQ.js} +10 -12
  90. package/dist/lib/chunks/chunk-U64NCRRR.js +97 -0
  91. package/dist/lib/chunks/chunk-U772TN32.js +67 -0
  92. package/dist/lib/chunks/{chunk-YR67JG2V.js → chunk-UEMZYHYJ.js} +8 -3
  93. package/dist/lib/chunks/{chunk-J46W3EMQ.js → chunk-UZJSTJFP.js} +5 -5
  94. package/dist/lib/chunks/{chunk-XJVXASDD.js → chunk-V7OAPKNF.js} +3 -3
  95. package/dist/lib/chunks/{chunk-WE2WPNG2.js → chunk-VKM6MMA4.js} +66 -7
  96. package/dist/lib/chunks/{chunk-YWJPJI3W.js → chunk-VL253W5C.js} +3 -1
  97. package/dist/lib/chunks/{chunk-MD4AVTK2.js → chunk-VPZQGND4.js} +3 -3
  98. package/dist/lib/chunks/{chunk-X2Y2ZNG3.js → chunk-W2VGLWTS.js} +3 -3
  99. package/dist/lib/chunks/{chunk-6AUEDSTU.js → chunk-W5DC23OP.js} +1 -1
  100. package/dist/lib/chunks/chunk-W5X7WJYL.js +91 -0
  101. package/dist/lib/chunks/{chunk-QFVRCSJ2.js → chunk-WDOA5JEH.js} +2 -0
  102. package/dist/lib/chunks/{chunk-I3TMFPK4.js → chunk-WVACVWBL.js} +2 -2
  103. package/dist/lib/chunks/{chunk-MIF5IYNR.js → chunk-XDG6NPJB.js} +26 -29
  104. package/dist/lib/chunks/{chunk-X6E44EGV.js → chunk-XR44YSHT.js} +2 -2
  105. package/dist/lib/chunks/chunk-Y2CZ6FZY.js +61 -0
  106. package/dist/lib/chunks/{chunk-5KKLUM7M.js → chunk-YAAUWCJ4.js} +1 -1
  107. package/dist/lib/chunks/{chunk-3KQFLOC7.js → chunk-YRBIC5QH.js} +1 -1
  108. package/dist/lib/chunks/chunk-ZIGNJAPC.js +11 -0
  109. package/dist/lib/cli/bundle-commands.js +71 -65
  110. package/dist/lib/cli/guide-command.js +25 -0
  111. package/dist/lib/cli/io.js +1 -1
  112. package/dist/lib/cli/run-commands.js +270 -104
  113. package/dist/lib/cli/status-command.js +234 -0
  114. package/dist/lib/codex-workflow/aggregate.js +8 -9
  115. package/dist/lib/codex-workflow/author-tools.js +6 -7
  116. package/dist/lib/codex-workflow/author.js +17 -17
  117. package/dist/lib/codex-workflow/capture.js +10 -9
  118. package/dist/lib/codex-workflow/checkpoint.js +6 -7
  119. package/dist/lib/codex-workflow/checks.js +6 -7
  120. package/dist/lib/codex-workflow/codex-binary.js +13 -0
  121. package/dist/lib/codex-workflow/codex-home.js +6 -3
  122. package/dist/lib/codex-workflow/copy-editor.js +14 -14
  123. package/dist/lib/codex-workflow/copy-recovery.js +3 -4
  124. package/dist/lib/codex-workflow/copy.js +11 -11
  125. package/dist/lib/codex-workflow/finish.js +17 -18
  126. package/dist/lib/codex-workflow/host-models.js +7 -7
  127. package/dist/lib/codex-workflow/loop.js +42 -38
  128. package/dist/lib/codex-workflow/quality.js +3 -4
  129. package/dist/lib/codex-workflow/run-inputs.js +5 -6
  130. package/dist/lib/codex-workflow/run-source.js +14 -13
  131. package/dist/lib/codex-workflow/schemas.js +5 -6
  132. package/dist/lib/codex-workflow/session.js +7 -8
  133. package/dist/lib/codex-workflow/stage.js +26 -23
  134. package/dist/lib/codex-workflow/workdir.js +6 -7
  135. package/dist/lib/engine/audit-file.js +7 -6
  136. package/dist/lib/engine/author.js +37 -31
  137. package/dist/lib/engine/budget.js +7 -1
  138. package/dist/lib/engine/cost-estimate.js +41 -0
  139. package/dist/lib/engine/local-run.js +48 -42
  140. package/dist/lib/engine/preflight.js +10 -6
  141. package/dist/lib/engine/rejudge.js +56 -50
  142. package/dist/lib/engine/resources.js +1 -1
  143. package/dist/lib/engine/run-configuration.js +2 -1
  144. package/dist/lib/engine/run-status.js +151 -0
  145. package/dist/lib/engine/templates.js +8 -7
  146. package/dist/lib/grounding/controller.js +7 -7
  147. package/dist/lib/grounding/extract.js +6 -6
  148. package/dist/lib/grounding/grounding-runtime.js +18 -17
  149. package/dist/lib/grounding/model.js +5 -5
  150. package/dist/lib/grounding/recorded-tools.js +10 -9
  151. package/dist/lib/harness/report/artifacts.js +4 -5
  152. package/dist/lib/lib/checkpoint.js +3 -4
  153. package/dist/lib/models/batching.js +5 -5
  154. package/dist/lib/models/cost-coefficients.js +20 -0
  155. package/dist/lib/models/local-profile.js +10 -0
  156. package/dist/lib/models/pricing.js +6 -0
  157. package/dist/lib/models/profiles.js +7 -14
  158. package/dist/lib/models/structured-images.js +1 -1
  159. package/dist/lib/models/structured.js +4 -4
  160. package/dist/lib/models/supported-models.js +20 -0
  161. package/dist/lib/pipeline.js +9 -8
  162. package/dist/lib/probes/agent-cli-parsers.js +1 -1
  163. package/dist/lib/probes/agent-clis.js +6 -5
  164. package/dist/lib/probes/charged-trace.js +10 -0
  165. package/dist/lib/probes/probes.js +6 -6
  166. package/dist/lib/runner.js +10 -10
  167. package/dist/lib/schema.js +3 -4
  168. package/dist/lib/section-result.js +3 -4
  169. package/dist/lib/stores/artifacts.js +3 -4
  170. package/dist/lib/stores/files.js +9 -9
  171. package/dist/lib/stores/local-versions.js +4 -5
  172. package/dist/lib/stores/memory.js +6 -7
  173. package/dist/lib/stores/publication.js +5 -6
  174. package/dist/lib/viewer/server.js +18 -19
  175. package/dist/lib/workflow/schema.js +2 -3
  176. package/dist/types/agents/copy-validation.d.ts +4 -4
  177. package/dist/types/agents/verifier.d.ts +6 -6
  178. package/dist/types/bundle/contracts.d.ts +1 -1
  179. package/dist/types/bundle/isolation.d.ts +37 -0
  180. package/dist/types/bundle/project-journal.d.ts +2 -0
  181. package/dist/types/bundle/recorder.d.ts +4 -0
  182. package/dist/types/bundle/writer-lock.d.ts +9 -0
  183. package/dist/types/cli/guide-command.d.ts +4 -0
  184. package/dist/types/cli/status-command.d.ts +2 -0
  185. package/dist/types/codex-workflow/codex-binary.d.ts +26 -0
  186. package/dist/types/codex-workflow/codex-home.d.ts +24 -20
  187. package/dist/types/codex-workflow/copy-editor.d.ts +1 -1
  188. package/dist/types/codex-workflow/copy.d.ts +3 -4
  189. package/dist/types/codex-workflow/finish.d.ts +5 -3
  190. package/dist/types/codex-workflow/host-models.d.ts +7 -3
  191. package/dist/types/codex-workflow/loop.d.ts +10 -1
  192. package/dist/types/codex-workflow/run-inputs.d.ts +28 -113
  193. package/dist/types/codex-workflow/stage.d.ts +16 -5
  194. package/dist/types/engine/audit-file.d.ts +3 -2
  195. package/dist/types/engine/author.d.ts +7 -1
  196. package/dist/types/engine/budget.d.ts +46 -15
  197. package/dist/types/engine/cost-estimate.d.ts +40 -0
  198. package/dist/types/engine/local-run.d.ts +6 -0
  199. package/dist/types/engine/preflight.d.ts +5 -0
  200. package/dist/types/engine/resources.d.ts +2 -0
  201. package/dist/types/engine/run-configuration.d.ts +4 -3
  202. package/dist/types/engine/run-status.d.ts +75 -0
  203. package/dist/types/engine/templates.d.ts +1 -2
  204. package/dist/types/models/cost-coefficients.d.ts +106 -0
  205. package/dist/types/models/local-profile.d.ts +12 -0
  206. package/dist/types/models/pricing.d.ts +8 -0
  207. package/dist/types/models/profiles.d.ts +55 -160
  208. package/dist/types/models/served-model.d.ts +2 -3
  209. package/dist/types/models/structured.d.ts +3 -3
  210. package/dist/types/models/supported-models.d.ts +48 -0
  211. package/dist/types/probes/charged-trace.d.ts +8 -0
  212. package/dist/types/probes/probe-trace.d.ts +2 -0
  213. package/dist/types/schema.d.ts +28 -113
  214. package/dist/types/workflow/schema.d.ts +79 -152
  215. package/package.json +2 -1
  216. package/resources/guide/OPERATOR.md +180 -0
  217. package/src/agents/copy-validation.ts +8 -12
  218. package/src/agents/verifier.ts +10 -14
  219. package/src/bundle/contracts.ts +3 -3
  220. package/src/bundle/isolation.ts +157 -0
  221. package/src/bundle/project-journal.ts +4 -0
  222. package/src/bundle/project.ts +20 -7
  223. package/src/bundle/recorder.ts +5 -0
  224. package/src/bundle/writer-lock.ts +27 -0
  225. package/src/cli/guide-command.ts +28 -0
  226. package/src/cli/io.ts +2 -0
  227. package/src/cli/literally-aeo.ts +39 -19
  228. package/src/cli/run-commands.ts +236 -18
  229. package/src/cli/status-command.ts +113 -0
  230. package/src/codex-workflow/codex-binary.ts +105 -0
  231. package/src/codex-workflow/codex-home.ts +50 -40
  232. package/src/codex-workflow/copy.ts +7 -10
  233. package/src/codex-workflow/finish.ts +13 -8
  234. package/src/codex-workflow/host-models.ts +33 -24
  235. package/src/codex-workflow/loop.ts +36 -9
  236. package/src/codex-workflow/stage.ts +126 -17
  237. package/src/engine/audit-file.ts +10 -8
  238. package/src/engine/author.ts +47 -2
  239. package/src/engine/budget.ts +138 -43
  240. package/src/engine/cost-estimate.ts +178 -0
  241. package/src/engine/guide/OPERATOR.md +180 -0
  242. package/src/engine/local-run.ts +38 -8
  243. package/src/engine/preflight.ts +90 -7
  244. package/src/engine/resources.ts +9 -4
  245. package/src/engine/run-configuration.ts +19 -1
  246. package/src/engine/run-status.ts +452 -0
  247. package/src/engine/templates.ts +5 -2
  248. package/src/models/cost-coefficients.ts +140 -0
  249. package/src/models/local-profile.ts +150 -0
  250. package/src/models/pricing.ts +31 -0
  251. package/src/models/profiles.ts +58 -419
  252. package/src/models/served-model.ts +2 -3
  253. package/src/models/structured-images.ts +5 -4
  254. package/src/models/structured.ts +20 -7
  255. package/src/models/supported-models.ts +112 -0
  256. package/src/probes/agent-clis.ts +24 -2
  257. package/src/probes/charged-trace.ts +87 -0
  258. package/src/probes/probe-trace.ts +2 -0
  259. package/src/probes/probes.ts +48 -2
  260. package/dist/lib/chunks/chunk-CFFPOTP4.js +0 -356
  261. package/dist/lib/chunks/chunk-LIZX4N3H.js +0 -110
  262. package/dist/lib/chunks/chunk-OYKV5NDM.js +0 -28
@@ -312,15 +312,7 @@ export declare const runInputsSchema: z.ZodObject<{
312
312
  }>>;
313
313
  configVersion: z.ZodOptional<z.ZodNumber>;
314
314
  modelProfile: z.ZodOptional<z.ZodObject<{
315
- id: z.ZodEnum<{
316
- "opus-grounding-v1": "opus-grounding-v1";
317
- "astra-grounding-v1": "astra-grounding-v1";
318
- "opus-harness-v1": "opus-harness-v1";
319
- "astra-harness-v1": "astra-harness-v1";
320
- "glm-harness-v1": "glm-harness-v1";
321
- "deepseek-harness-v1": "deepseek-harness-v1";
322
- "deepseek-harness-v2": "deepseek-harness-v2";
323
- }>;
315
+ id: z.ZodString;
324
316
  version: z.ZodLiteral<1>;
325
317
  pricingCheckedAt: z.ZodISODate;
326
318
  searchProvider: z.ZodEnum<{
@@ -329,14 +321,7 @@ export declare const runInputsSchema: z.ZodObject<{
329
321
  }>;
330
322
  roles: z.ZodObject<{
331
323
  analyzer: z.ZodObject<{
332
- model: z.ZodEnum<{
333
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
334
- "openai/gpt-6-astra": "openai/gpt-6-astra";
335
- "zai/glm-5.3": "zai/glm-5.3";
336
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
337
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
338
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
339
- }>;
324
+ model: z.ZodString;
340
325
  providerOptions: z.ZodObject<{
341
326
  openai: z.ZodOptional<z.ZodObject<{
342
327
  reasoningEffort: z.ZodLiteral<"high">;
@@ -363,14 +348,7 @@ export declare const runInputsSchema: z.ZodObject<{
363
348
  }, z.core.$strict>;
364
349
  }, z.core.$strict>;
365
350
  perception: z.ZodObject<{
366
- model: z.ZodEnum<{
367
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
368
- "openai/gpt-6-astra": "openai/gpt-6-astra";
369
- "zai/glm-5.3": "zai/glm-5.3";
370
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
371
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
372
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
373
- }>;
351
+ model: z.ZodString;
374
352
  providerOptions: z.ZodObject<{
375
353
  openai: z.ZodOptional<z.ZodObject<{
376
354
  reasoningEffort: z.ZodLiteral<"high">;
@@ -397,14 +375,7 @@ export declare const runInputsSchema: z.ZodObject<{
397
375
  }, z.core.$strict>;
398
376
  }, z.core.$strict>;
399
377
  research: z.ZodObject<{
400
- model: z.ZodEnum<{
401
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
402
- "openai/gpt-6-astra": "openai/gpt-6-astra";
403
- "zai/glm-5.3": "zai/glm-5.3";
404
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
405
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
406
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
407
- }>;
378
+ model: z.ZodString;
408
379
  providerOptions: z.ZodObject<{
409
380
  openai: z.ZodOptional<z.ZodObject<{
410
381
  reasoningEffort: z.ZodLiteral<"high">;
@@ -431,14 +402,7 @@ export declare const runInputsSchema: z.ZodObject<{
431
402
  }, z.core.$strict>;
432
403
  }, z.core.$strict>;
433
404
  adjudication: z.ZodObject<{
434
- model: z.ZodEnum<{
435
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
436
- "openai/gpt-6-astra": "openai/gpt-6-astra";
437
- "zai/glm-5.3": "zai/glm-5.3";
438
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
439
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
440
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
441
- }>;
405
+ model: z.ZodString;
442
406
  providerOptions: z.ZodObject<{
443
407
  openai: z.ZodOptional<z.ZodObject<{
444
408
  reasoningEffort: z.ZodLiteral<"high">;
@@ -465,14 +429,7 @@ export declare const runInputsSchema: z.ZodObject<{
465
429
  }, z.core.$strict>;
466
430
  }, z.core.$strict>;
467
431
  premiseVerifier: z.ZodObject<{
468
- model: z.ZodEnum<{
469
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
470
- "openai/gpt-6-astra": "openai/gpt-6-astra";
471
- "zai/glm-5.3": "zai/glm-5.3";
472
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
473
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
474
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
475
- }>;
432
+ model: z.ZodString;
476
433
  providerOptions: z.ZodObject<{
477
434
  openai: z.ZodOptional<z.ZodObject<{
478
435
  reasoningEffort: z.ZodLiteral<"high">;
@@ -499,14 +456,7 @@ export declare const runInputsSchema: z.ZodObject<{
499
456
  }, z.core.$strict>;
500
457
  }, z.core.$strict>;
501
458
  author: z.ZodObject<{
502
- model: z.ZodEnum<{
503
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
504
- "openai/gpt-6-astra": "openai/gpt-6-astra";
505
- "zai/glm-5.3": "zai/glm-5.3";
506
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
507
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
508
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
509
- }>;
459
+ model: z.ZodString;
510
460
  providerOptions: z.ZodObject<{
511
461
  openai: z.ZodOptional<z.ZodObject<{
512
462
  reasoningEffort: z.ZodLiteral<"high">;
@@ -533,14 +483,7 @@ export declare const runInputsSchema: z.ZodObject<{
533
483
  }, z.core.$strict>;
534
484
  }, z.core.$strict>;
535
485
  copy: z.ZodObject<{
536
- model: z.ZodEnum<{
537
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
538
- "openai/gpt-6-astra": "openai/gpt-6-astra";
539
- "zai/glm-5.3": "zai/glm-5.3";
540
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
541
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
542
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
543
- }>;
486
+ model: z.ZodString;
544
487
  providerOptions: z.ZodObject<{
545
488
  openai: z.ZodOptional<z.ZodObject<{
546
489
  reasoningEffort: z.ZodLiteral<"high">;
@@ -567,14 +510,7 @@ export declare const runInputsSchema: z.ZodObject<{
567
510
  }, z.core.$strict>;
568
511
  }, z.core.$strict>;
569
512
  domainClassifier: z.ZodObject<{
570
- model: z.ZodEnum<{
571
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
572
- "openai/gpt-6-astra": "openai/gpt-6-astra";
573
- "zai/glm-5.3": "zai/glm-5.3";
574
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
575
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
576
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
577
- }>;
513
+ model: z.ZodString;
578
514
  providerOptions: z.ZodObject<{
579
515
  openai: z.ZodOptional<z.ZodObject<{
580
516
  reasoningEffort: z.ZodLiteral<"high">;
@@ -601,14 +537,7 @@ export declare const runInputsSchema: z.ZodObject<{
601
537
  }, z.core.$strict>;
602
538
  }, z.core.$strict>;
603
539
  logoDiscovery: z.ZodOptional<z.ZodObject<{
604
- model: z.ZodEnum<{
605
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
606
- "openai/gpt-6-astra": "openai/gpt-6-astra";
607
- "zai/glm-5.3": "zai/glm-5.3";
608
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
609
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
610
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
611
- }>;
540
+ model: z.ZodString;
612
541
  providerOptions: z.ZodObject<{
613
542
  openai: z.ZodOptional<z.ZodObject<{
614
543
  reasoningEffort: z.ZodLiteral<"high">;
@@ -635,14 +564,7 @@ export declare const runInputsSchema: z.ZodObject<{
635
564
  }, z.core.$strict>;
636
565
  }, z.core.$strict>>;
637
566
  competitorClassifier: z.ZodOptional<z.ZodObject<{
638
- model: z.ZodEnum<{
639
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
640
- "openai/gpt-6-astra": "openai/gpt-6-astra";
641
- "zai/glm-5.3": "zai/glm-5.3";
642
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
643
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
644
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
645
- }>;
567
+ model: z.ZodString;
646
568
  providerOptions: z.ZodObject<{
647
569
  openai: z.ZodOptional<z.ZodObject<{
648
570
  reasoningEffort: z.ZodLiteral<"high">;
@@ -669,14 +591,7 @@ export declare const runInputsSchema: z.ZodObject<{
669
591
  }, z.core.$strict>;
670
592
  }, z.core.$strict>>;
671
593
  scrutiny: z.ZodOptional<z.ZodObject<{
672
- model: z.ZodEnum<{
673
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
674
- "openai/gpt-6-astra": "openai/gpt-6-astra";
675
- "zai/glm-5.3": "zai/glm-5.3";
676
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
677
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
678
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
679
- }>;
594
+ model: z.ZodString;
680
595
  providerOptions: z.ZodObject<{
681
596
  openai: z.ZodOptional<z.ZodObject<{
682
597
  reasoningEffort: z.ZodLiteral<"high">;
@@ -703,14 +618,7 @@ export declare const runInputsSchema: z.ZodObject<{
703
618
  }, z.core.$strict>;
704
619
  }, z.core.$strict>>;
705
620
  repairPlanner: z.ZodOptional<z.ZodObject<{
706
- model: z.ZodEnum<{
707
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
708
- "openai/gpt-6-astra": "openai/gpt-6-astra";
709
- "zai/glm-5.3": "zai/glm-5.3";
710
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
711
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
712
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
713
- }>;
621
+ model: z.ZodString;
714
622
  providerOptions: z.ZodObject<{
715
623
  openai: z.ZodOptional<z.ZodObject<{
716
624
  reasoningEffort: z.ZodLiteral<"high">;
@@ -737,14 +645,7 @@ export declare const runInputsSchema: z.ZodObject<{
737
645
  }, z.core.$strict>;
738
646
  }, z.core.$strict>>;
739
647
  visualReviewer: z.ZodOptional<z.ZodObject<{
740
- model: z.ZodEnum<{
741
- "anthropic/claude-opus-4.6": "anthropic/claude-opus-4.6";
742
- "openai/gpt-6-astra": "openai/gpt-6-astra";
743
- "zai/glm-5.3": "zai/glm-5.3";
744
- "moonshotai/kimi-k3": "moonshotai/kimi-k3";
745
- "deepseek/deepseek-v4.1-flash": "deepseek/deepseek-v4.1-flash";
746
- "anthropic/claude-opus-5": "anthropic/claude-opus-5";
747
- }>;
648
+ model: z.ZodString;
748
649
  providerOptions: z.ZodObject<{
749
650
  openai: z.ZodOptional<z.ZodObject<{
750
651
  reasoningEffort: z.ZodLiteral<"high">;
@@ -771,6 +672,20 @@ export declare const runInputsSchema: z.ZodObject<{
771
672
  }, z.core.$strict>;
772
673
  }, z.core.$strict>>;
773
674
  }, z.core.$strict>;
675
+ stages: z.ZodOptional<z.ZodObject<{
676
+ model: z.ZodString;
677
+ reasoningEffort: z.ZodEnum<{
678
+ high: "high";
679
+ medium: "medium";
680
+ xhigh: "xhigh";
681
+ }>;
682
+ contextWindow: z.ZodNumber;
683
+ pricingUsdPerMillion: z.ZodObject<{
684
+ input: z.ZodNumber;
685
+ output: z.ZodNumber;
686
+ cachedInput: z.ZodNumber;
687
+ }, z.core.$strict>;
688
+ }, z.core.$strict>>;
774
689
  }, z.core.$strict>>;
775
690
  modelBudget: z.ZodOptional<z.ZodObject<{
776
691
  maxUsd: z.ZodNumber;
@@ -1,11 +1,19 @@
1
1
  import type { CopyValidationOutcome } from '../agents/copy-validation';
2
2
  import type { AeoBrand } from '../schema';
3
3
  import type { ExecutionRecorder } from '../bundle/recorder';
4
+ import type { ModelCallAccounting } from '../models/accounting';
5
+ import type { CodexStageModel } from '../models/profiles';
4
6
  import { type StageValue } from './checks';
5
7
  import { type ResearchServerConfig } from './codex-home';
6
8
  import { type Correction, type StageName } from './schemas';
7
9
  import type { AnswerFile } from './workdir';
8
10
  import type { BatchLayout } from './batch-layout';
11
+ /** Tokens a Codex session reported: cached input is part of input. */
12
+ export type SessionUsage = {
13
+ inputTokens: number;
14
+ cachedInputTokens: number;
15
+ outputTokens: number;
16
+ };
9
17
  export type StageRun = {
10
18
  stage: StageName;
11
19
  model: string;
@@ -13,10 +21,7 @@ export type StageRun = {
13
21
  * `degraded` and their answers carry no judgment from this stage. */
14
22
  ok: boolean;
15
23
  durationMs: number;
16
- usage: {
17
- inputTokens: number;
18
- outputTokens: number;
19
- } | null;
24
+ usage: SessionUsage | null;
20
25
  errors: string[];
21
26
  /** Answer files whose batch never validated: excluded from this stage
22
27
  * and every later one, recorded, never a reason to stop the run. */
@@ -41,7 +46,13 @@ export type StageContext = {
41
46
  ownedDomains?: readonly string[];
42
47
  /** The host stopping the work: sessions are killed and no batch starts. */
43
48
  signal?: AbortSignal;
44
- /** Overrides for tests: the command to run instead of `codex`. */
49
+ /** The model every session runs on (the run's pinned stage model). */
50
+ stageModel: CodexStageModel;
51
+ /** The run's ledger: every session is reserved before it starts and
52
+ * settled from its reported tokens. Absent, sessions are not charged. */
53
+ accounting?: ModelCallAccounting;
54
+ /** Overrides for tests: the command to run instead of the engine's own
55
+ * Codex. */
45
56
  command?: string;
46
57
  timeoutMs?: number;
47
58
  /** Answers per Codex session; the default fits the pinned model. */
@@ -27,13 +27,14 @@ export declare const runPolicySchema: z.ZodObject<{
27
27
  }, z.core.$strip>>;
28
28
  allowPartial: z.ZodDefault<z.ZodBoolean>;
29
29
  budget: z.ZodPrefault<z.ZodObject<{
30
- maxUsd: z.ZodDefault<z.ZodNumber>;
30
+ maxUsd: z.ZodOptional<z.ZodNumber>;
31
31
  maxTokens: z.ZodDefault<z.ZodNumber>;
32
32
  maxHours: z.ZodDefault<z.ZodNumber>;
33
33
  }, z.core.$strict>>;
34
34
  }, z.core.$strict>;
35
35
  export declare const auditFileSchema: z.ZodObject<{
36
36
  version: z.ZodLiteral<1>;
37
+ model: z.ZodOptional<z.ZodString>;
37
38
  brand: z.ZodObject<{
38
39
  name: z.ZodString;
39
40
  domain: z.ZodString;
@@ -102,7 +103,7 @@ export declare const auditFileSchema: z.ZodObject<{
102
103
  }, z.core.$strip>>;
103
104
  allowPartial: z.ZodDefault<z.ZodBoolean>;
104
105
  budget: z.ZodPrefault<z.ZodObject<{
105
- maxUsd: z.ZodDefault<z.ZodNumber>;
106
+ maxUsd: z.ZodOptional<z.ZodNumber>;
106
107
  maxTokens: z.ZodDefault<z.ZodNumber>;
107
108
  maxHours: z.ZodDefault<z.ZodNumber>;
108
109
  }, z.core.$strict>>;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { readAuthorResearch, type AuthorBrief } from '../codex-workflow/author';
3
+ import type { SupportedModel } from '../models/supported-models';
3
4
  import { type AuditFile, type AuthorReference } from './audit-file';
4
5
  declare const authorRecordSchema: z.ZodObject<{
5
6
  version: z.ZodLiteral<1>;
@@ -17,10 +18,15 @@ export type LocalAuthorResult = {
17
18
  auditFile: string | undefined;
18
19
  research: Awaited<ReturnType<typeof readAuthorResearch>>['summary'];
19
20
  };
20
- /** runLocalAuthor runs the author session over a brief into `dir`. */
21
+ /** runLocalAuthor runs the author session over a brief into `dir`, on
22
+ * `model`, under the approved cap: the draft directory's ledger reserves
23
+ * the research tools' whole search allowance before the session, and the
24
+ * session itself, so neither can take the run past the cap. */
21
25
  export declare const runLocalAuthor: (args: {
22
26
  brief: AuthorBrief;
23
27
  dir: string;
28
+ model: SupportedModel;
29
+ maxUsd: number;
24
30
  secrets: readonly string[];
25
31
  signal?: AbortSignal;
26
32
  }) => Promise<LocalAuthorResult>;
@@ -1,43 +1,53 @@
1
1
  import { z } from 'zod';
2
2
  import type { ModelBudgetLimits } from '../models/accounting';
3
3
  export declare const budgetFile = "BUDGET.json";
4
+ /** What audit.json says: the dollar cap is optional there, because the
5
+ * operator may approve it on the command line instead. */
4
6
  export declare const budgetPolicySchema: z.ZodObject<{
5
- maxUsd: z.ZodDefault<z.ZodNumber>;
7
+ maxUsd: z.ZodOptional<z.ZodNumber>;
6
8
  maxTokens: z.ZodDefault<z.ZodNumber>;
7
9
  maxHours: z.ZodDefault<z.ZodNumber>;
8
10
  }, z.core.$strict>;
9
11
  export type BudgetPolicy = z.infer<typeof budgetPolicySchema>;
12
+ /** The limits a run froze: the cap is always there. */
13
+ declare const frozenPolicySchema: z.ZodObject<{
14
+ maxTokens: z.ZodDefault<z.ZodNumber>;
15
+ maxHours: z.ZodDefault<z.ZodNumber>;
16
+ maxUsd: z.ZodNumber;
17
+ }, z.core.$strict>;
18
+ export type FrozenBudgetPolicy = z.infer<typeof frozenPolicySchema>;
10
19
  /** A --budget-file: the limits to raise; what it leaves out stays. */
11
20
  export declare const budgetAmendmentSchema: z.ZodObject<{
12
- maxUsd: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
13
21
  maxTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
14
22
  maxHours: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
23
+ maxUsd: z.ZodOptional<z.ZodNumber>;
15
24
  }, z.core.$strict>;
16
25
  export type BudgetAmendment = z.infer<typeof budgetAmendmentSchema>;
17
26
  declare const budgetStateSchema: z.ZodObject<{
18
27
  version: z.ZodLiteral<1>;
19
28
  original: z.ZodObject<{
20
- maxUsd: z.ZodDefault<z.ZodNumber>;
21
29
  maxTokens: z.ZodDefault<z.ZodNumber>;
22
30
  maxHours: z.ZodDefault<z.ZodNumber>;
31
+ maxUsd: z.ZodNumber;
23
32
  }, z.core.$strict>;
24
33
  current: z.ZodObject<{
25
- maxUsd: z.ZodDefault<z.ZodNumber>;
26
34
  maxTokens: z.ZodDefault<z.ZodNumber>;
27
35
  maxHours: z.ZodDefault<z.ZodNumber>;
36
+ maxUsd: z.ZodNumber;
28
37
  }, z.core.$strict>;
29
38
  deadlineAt: z.ZodISODateTime;
39
+ model: z.ZodOptional<z.ZodString>;
30
40
  amendments: z.ZodArray<z.ZodObject<{
31
41
  at: z.ZodISODateTime;
32
42
  from: z.ZodObject<{
33
- maxUsd: z.ZodDefault<z.ZodNumber>;
34
43
  maxTokens: z.ZodDefault<z.ZodNumber>;
35
44
  maxHours: z.ZodDefault<z.ZodNumber>;
45
+ maxUsd: z.ZodNumber;
36
46
  }, z.core.$strict>;
37
47
  to: z.ZodObject<{
38
- maxUsd: z.ZodDefault<z.ZodNumber>;
39
48
  maxTokens: z.ZodDefault<z.ZodNumber>;
40
49
  maxHours: z.ZodDefault<z.ZodNumber>;
50
+ maxUsd: z.ZodNumber;
41
51
  }, z.core.$strict>;
42
52
  deadlineFrom: z.ZodISODateTime;
43
53
  deadlineTo: z.ZodISODateTime;
@@ -46,7 +56,8 @@ declare const budgetStateSchema: z.ZodObject<{
46
56
  type BudgetState = z.infer<typeof budgetStateSchema>;
47
57
  export type RunBudget = {
48
58
  limits: ModelBudgetLimits;
49
- policy: BudgetPolicy;
59
+ policy: FrozenBudgetPolicy;
60
+ model: string;
50
61
  /** The amendment this invocation recorded, for the run journal. */
51
62
  amended: BudgetState['amendments'][number] | undefined;
52
63
  /** audit.json asks for other limits than the run froze: reported, never
@@ -55,14 +66,34 @@ export type RunBudget = {
55
66
  };
56
67
  /** readBudgetAmendment reads a --budget-file. */
57
68
  export declare const readBudgetAmendment: (file: string) => Promise<BudgetAmendment>;
58
- /**
59
- * resolveRunBudget returns the limits a run executes under: frozen from
60
- * audit.json on the first run, kept on every resume, raised only by an
61
- * amendment. An amendment that lowers a limit is refused: the ledger may
62
- * already hold more than the lower limit.
63
- */
64
- export declare const resolveRunBudget: (dir: string, policy: BudgetPolicy, { amendment, now, }?: {
69
+ /** Thrown before any paid work when a new run has no approved cap. */
70
+ export declare class BudgetCapMissingError extends Error {
71
+ constructor(message: string);
72
+ }
73
+ /** Thrown before any paid work when audit.json names another model than
74
+ * the run directory froze. */
75
+ export declare class RunModelChangedError extends Error {
76
+ constructor(message: string);
77
+ }
78
+ /** readFrozenBudget reads a run directory's BUDGET.json; undefined when
79
+ * the directory has not started. Read-only. */
80
+ export declare const readFrozenBudget: (dir: string) => Promise<BudgetState | undefined>;
81
+ type ResolveRunBudgetOptions = {
82
+ /** The gateway model audit.json resolves to. */
83
+ model: string;
84
+ /** The cap approved on the command line (`--max-usd`). On a new run it
85
+ * sets the cap; on a resume it raises it, recorded like a --budget-file. */
86
+ maxUsd?: number;
65
87
  amendment?: BudgetAmendment;
66
88
  now?: () => Date;
67
- }) => Promise<RunBudget>;
89
+ };
90
+ /**
91
+ * resolveRunBudget returns the limits and the model a run executes under:
92
+ * frozen from audit.json (and --max-usd) on the first run, kept on every
93
+ * resume, raised only by an amendment. A new run without a dollar cap is
94
+ * refused, as is a resume whose audit.json names another model. An
95
+ * amendment that lowers a limit is refused: the ledger may already hold
96
+ * more than the lower limit.
97
+ */
98
+ export declare const resolveRunBudget: (dir: string, policy: BudgetPolicy, { model, maxUsd, amendment, now }: ResolveRunBudgetOptions) => Promise<RunBudget>;
68
99
  export {};
@@ -0,0 +1,40 @@
1
+ import { type Range } from '../models/cost-coefficients';
2
+ import type { SupportedModel } from '../models/supported-models';
3
+ import type { RunPlan } from '../runner';
4
+ export type CostRange = Range<number>;
5
+ export type RunCostEstimate = {
6
+ currency: 'USD';
7
+ /** An estimate, labelled as such wherever it is shown. */
8
+ kind: 'estimate';
9
+ model: string;
10
+ coefficientsVersion: number;
11
+ low: number;
12
+ high: number;
13
+ categories: {
14
+ probes: CostRange;
15
+ stages: CostRange;
16
+ hostCalls: CostRange;
17
+ search: CostRange;
18
+ };
19
+ /** The cap to propose to the operator: the high end, rounded up. */
20
+ recommendedCapUsd: number;
21
+ };
22
+ export type AuthorCostEstimate = Omit<RunCostEstimate, 'categories'> & {
23
+ categories: {
24
+ stages: CostRange;
25
+ search: CostRange;
26
+ };
27
+ };
28
+ type EstimateRunOptions = {
29
+ plan: Pick<RunPlan, 'units' | 'probesBySurface'>;
30
+ model: SupportedModel;
31
+ grounding: 'full' | 'extraction_only';
32
+ };
33
+ /** estimateRunCost estimates a whole run as planned; a resume spends less,
34
+ * because banked answers are never probed again. */
35
+ export declare const estimateRunCost: ({ plan, model, grounding, }: EstimateRunOptions) => RunCostEstimate;
36
+ /** estimateAuthorCost estimates one author session and its research. */
37
+ export declare const estimateAuthorCost: (model: SupportedModel) => AuthorCostEstimate;
38
+ /** One line a person reads: "$12.40 to $38.10 (estimate)". */
39
+ export declare const describeCostRange: (range: CostRange) => string;
40
+ export {};
@@ -2,6 +2,7 @@ import { type ExecutionRecorder } from '../bundle/recorder';
2
2
  import { type WriterLock } from '../bundle/writer-lock';
3
3
  import type { GroundRun } from '../codex-workflow/finish';
4
4
  import { type RunSource } from '../codex-workflow/run-source';
5
+ import { type ModelCallAccounting } from '../models/accounting';
5
6
  import type { InternalModelContext } from '../models/context';
6
7
  import { type RunPlan } from '../runner';
7
8
  import type { AeoAuditConfig, RunRequest } from '../schema';
@@ -38,6 +39,9 @@ export type LocalRun = {
38
39
  /** The run's pinned model context: every host call charges its ledger
39
40
  * and is recorded in the run journal. */
40
41
  internalModels: InternalModelContext;
42
+ /** The same ledger unwrapped, for the Codex sessions, which the journal
43
+ * records as operations of their own. */
44
+ ledger: ModelCallAccounting;
41
45
  ground: GroundRun;
42
46
  /** The directory's writer lock and its run journal, held from before the
43
47
  * first canary: the workflow continues under both (prepareWorkdir held). */
@@ -57,6 +61,8 @@ export type LocalRun = {
57
61
  */
58
62
  export declare const openLocalRun: (file: AuditFile, dir: string, options?: {
59
63
  signal?: AbortSignal;
64
+ /** The cap approved on the command line (`run --max-usd`). */
65
+ maxUsd?: number;
60
66
  amendment?: BudgetAmendment;
61
67
  derivedFromRunId?: string;
62
68
  }) => Promise<LocalRun>;
@@ -17,11 +17,16 @@ export declare const agentAuthMode: (surface: AeoAgentSurface, settings: Setting
17
17
  } | {
18
18
  kind: "cli_session";
19
19
  };
20
+ /** The model audit.json names, or the recommended one: refused when it is
21
+ * not on the supported list, which the detail then prints. */
22
+ export declare const modelCheck: (model: string | undefined) => PreflightCheck;
20
23
  /** runPreflight checks what a run over these surfaces needs locally. */
21
24
  export declare const runPreflight: (args: {
22
25
  surfaces: readonly AeoSurface[];
23
26
  settings: Settings;
24
27
  dir: string;
28
+ /** audit.json's `model`; absent means the recommended model. */
29
+ model?: string;
25
30
  /** Full grounding researches through the pinned search provider. */
26
31
  groundingSearch?: boolean;
27
32
  }) => Promise<PreflightCheck[]>;
@@ -3,6 +3,8 @@ export type EngineResources = {
3
3
  root: string;
4
4
  author: string;
5
5
  editorial: string;
6
+ /** The operator guide `literally-aeo guide` prints. */
7
+ guide: string;
6
8
  };
7
9
  /** engineResources finds the resources of the running engine. */
8
10
  export declare const engineResources: () => Promise<EngineResources>;
@@ -27,10 +27,11 @@ export type RecordedAuthorEvidence = z.infer<typeof authorEvidenceSchema>;
27
27
  /** readRecordedAuthorEvidence reads what a run recorded about how its
28
28
  * configuration came to be; a run from before the record says manual. */
29
29
  export declare const readRecordedAuthorEvidence: (dir: string) => Promise<RecordedAuthorEvidence | undefined>;
30
- /** recordRunConfiguration writes the run's audit.json and author evidence
31
- * into its directory, replacing what an earlier invocation wrote. */
32
- export declare const recordRunConfiguration: ({ dir, configFile, evidence, }: {
30
+ export declare const recordRunConfiguration: ({ dir, configFile, evidence, model, }: {
33
31
  dir: string;
34
32
  configFile: string;
35
33
  evidence: RecordedAuthorEvidence;
34
+ /** A model named outside the file (`rejudge --model`): the recorded
35
+ * configuration is the one the run ran with, not the file's. */
36
+ model?: string;
36
37
  }) => Promise<void>;
@@ -0,0 +1,75 @@
1
+ import { type WriterLockState } from '../bundle/writer-lock';
2
+ export declare const SpendCategory: {
3
+ readonly PROBES: "probes";
4
+ readonly STAGES: "stages";
5
+ readonly HOST_CALLS: "hostCalls";
6
+ readonly SEARCH: "search";
7
+ };
8
+ export type SpendCategory = (typeof SpendCategory)[keyof typeof SpendCategory];
9
+ /** spendCategoryOf names the kind of paid work a ledger role charges:
10
+ * `stage:` Codex sessions, `probe:` assistant answers, `search:` and
11
+ * grounding's research searches, everything else the host's model calls. */
12
+ export declare const spendCategoryOf: (role: string) => SpendCategory;
13
+ export type CategorySpend = {
14
+ usd: number;
15
+ calls: number;
16
+ };
17
+ export type RunSpend = {
18
+ currency: 'USD';
19
+ /** The run's frozen cap; undefined before the first run froze one. */
20
+ capUsd: number | undefined;
21
+ /** The model the run froze with its cap. */
22
+ model: string | undefined;
23
+ deadlineAt: string | undefined;
24
+ /** What every call charges: settled cost, else its reservation. */
25
+ chargedUsd: number;
26
+ /** Settled calls: at their reported cost, or at their reservation when
27
+ * the provider reported none. */
28
+ settledUsd: number;
29
+ /** Calls reserved and not settled: dispatched, or lost with a process. */
30
+ openUsd: number;
31
+ remainingUsd: number | undefined;
32
+ byCategory: Record<SpendCategory, CategorySpend>;
33
+ };
34
+ export type RunActivity = {
35
+ kind: string;
36
+ /** The Codex stage, for a session. */
37
+ stage: string | undefined;
38
+ /** The model role or surface, for a host call or probe. */
39
+ role: string | undefined;
40
+ at: string;
41
+ /** Started and not yet finished. */
42
+ open: boolean;
43
+ };
44
+ export type RunStatus = {
45
+ dir: string;
46
+ state: 'new' | 'resumable' | 'completed';
47
+ writer: {
48
+ purpose: string;
49
+ pid: number;
50
+ host: string;
51
+ since: string;
52
+ state: WriterLockState;
53
+ } | undefined;
54
+ /** The run's phase as its journal shows it last. */
55
+ phase: string | undefined;
56
+ lastActivity: RunActivity | undefined;
57
+ /** The Codex stage outputs present in OUT/. */
58
+ completedStages: string[];
59
+ answers: {
60
+ planned: number | undefined;
61
+ captured: number;
62
+ failed: number;
63
+ };
64
+ spend: RunSpend;
65
+ lastError: {
66
+ type: string;
67
+ error: string;
68
+ reason: string;
69
+ at: string;
70
+ } | undefined;
71
+ stoppedAtBudget: boolean;
72
+ };
73
+ /** readRunStatus reads a run directory's state; undefined when it holds no
74
+ * run (no journal, no bank, no prepared inputs). */
75
+ export declare const readRunStatus: (dir: string) => Promise<RunStatus | undefined>;
@@ -1,5 +1,6 @@
1
1
  export declare const exampleAuditFile: {
2
2
  version: 1;
3
+ model: string;
3
4
  brand: {
4
5
  name: string;
5
6
  domain: string;
@@ -29,8 +30,6 @@ export declare const exampleAuditFile: {
29
30
  runPolicy: {
30
31
  maxPlannedUnits: number;
31
32
  budget: {
32
- maxUsd: number;
33
- maxTokens: number;
34
33
  maxHours: number;
35
34
  };
36
35
  };