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
@@ -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
- };
@@ -1,110 +0,0 @@
1
- import {
2
- writeFileAtomically
3
- } from "./chunk-MX6Y4RD2.js";
4
- import {
5
- hasErrorCode
6
- } from "./chunk-2QLAFBCG.js";
7
-
8
- // src/engine/budget.ts
9
- import { readFile } from "node:fs/promises";
10
- import path from "node:path";
11
- import { z } from "zod";
12
- var budgetFile = "BUDGET.json";
13
- var budgetPolicySchema = z.object({
14
- maxUsd: z.number().finite().positive().default(10),
15
- maxTokens: z.number().int().positive().default(5e6),
16
- maxHours: z.number().finite().positive().max(72).default(6)
17
- }).strict();
18
- var budgetAmendmentSchema = budgetPolicySchema.partial().strict();
19
- var budgetStateSchema = z.object({
20
- version: z.literal(1),
21
- original: budgetPolicySchema,
22
- current: budgetPolicySchema,
23
- deadlineAt: z.iso.datetime(),
24
- amendments: z.array(
25
- z.object({
26
- at: z.iso.datetime(),
27
- from: budgetPolicySchema,
28
- to: budgetPolicySchema,
29
- deadlineFrom: z.iso.datetime(),
30
- deadlineTo: z.iso.datetime()
31
- }).strict()
32
- )
33
- }).strict();
34
- var hoursFrom = (now, hours) => {
35
- return new Date(now.getTime() + hours * 36e5).toISOString();
36
- };
37
- var readBudgetAmendment = async (file) => {
38
- const text = await readFile(file, "utf8").catch((err) => {
39
- throw new Error(`Please check --budget-file: ${file} cannot be read.`, {
40
- cause: err
41
- });
42
- });
43
- return budgetAmendmentSchema.parse(JSON.parse(text));
44
- };
45
- var resolveRunBudget = async (dir, policy, {
46
- amendment,
47
- now = () => /* @__PURE__ */ new Date()
48
- } = {}) => {
49
- const file = path.join(dir, budgetFile);
50
- const text = await readFile(file, "utf8").catch((err) => {
51
- if (hasErrorCode(err, "ENOENT")) {
52
- return void 0;
53
- }
54
- throw err;
55
- });
56
- const existing = text === void 0 ? void 0 : budgetStateSchema.parse(JSON.parse(text));
57
- const at = now();
58
- let state = existing ?? {
59
- version: 1,
60
- original: policy,
61
- current: policy,
62
- deadlineAt: hoursFrom(at, policy.maxHours),
63
- amendments: []
64
- };
65
- let amended;
66
- if (amendment && Object.keys(amendment).length > 0) {
67
- const to = { ...state.current, ...amendment };
68
- if (to.maxUsd < state.current.maxUsd || to.maxTokens < state.current.maxTokens) {
69
- throw new Error(
70
- `A --budget-file can only raise limits; this run already allows $${state.current.maxUsd} and ${state.current.maxTokens} tokens.`
71
- );
72
- }
73
- const deadlineTo = amendment.maxHours === void 0 ? state.deadlineAt : hoursFrom(at, amendment.maxHours);
74
- amended = {
75
- at: at.toISOString(),
76
- from: state.current,
77
- to,
78
- deadlineFrom: state.deadlineAt,
79
- deadlineTo
80
- };
81
- state = {
82
- ...state,
83
- current: to,
84
- deadlineAt: deadlineTo,
85
- amendments: [...state.amendments, amended]
86
- };
87
- }
88
- if (!existing || amended) {
89
- await writeFileAtomically(file, JSON.stringify(state, null, 2));
90
- }
91
- const budget = {
92
- limits: {
93
- maxUsd: state.current.maxUsd,
94
- maxTokens: state.current.maxTokens,
95
- deadlineAt: state.deadlineAt
96
- },
97
- policy: state.current,
98
- amended,
99
- policyDiffers: JSON.stringify(policy) !== JSON.stringify(state.original)
100
- };
101
- return budget;
102
- };
103
-
104
- export {
105
- budgetFile,
106
- budgetPolicySchema,
107
- budgetAmendmentSchema,
108
- readBudgetAmendment,
109
- resolveRunBudget
110
- };
@@ -1,28 +0,0 @@
1
- import {
2
- codexRunnerProfile,
3
- configuredModelProfileId,
4
- resolveInternalModelProfile
5
- } from "./chunk-CFFPOTP4.js";
6
- import {
7
- createMemoryModelAccounting
8
- } from "./chunk-TNL2GWYR.js";
9
-
10
- // src/codex-workflow/host-models.ts
11
- var hostStepMaxUsd = 5;
12
- var copyVerifierProfile = codexRunnerProfile;
13
- var hostModels = (profileId = configuredModelProfileId()) => {
14
- return {
15
- profile: resolveInternalModelProfile(profileId),
16
- accounting: createMemoryModelAccounting({
17
- maxUsd: hostStepMaxUsd,
18
- maxTokens: 5e6,
19
- deadlineAt: new Date(Date.now() + 30 * 6e4).toISOString()
20
- })
21
- };
22
- };
23
-
24
- export {
25
- hostStepMaxUsd,
26
- copyVerifierProfile,
27
- hostModels
28
- };