literally-aeo 0.1.0 → 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-4US3OBKJ.js → chunk-2GU6CNQI.js} +12 -7
  32. package/dist/lib/chunks/{chunk-AWOJWMPN.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-5GZVDGTX.js → chunk-4PD65FRJ.js} +7 -3
  35. package/dist/lib/chunks/{chunk-P4K6BP3L.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-4ZY6P5SO.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-M2OD74GP.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-BEQLSAVX.js → chunk-CUYVHXHI.js} +2 -2
  51. package/dist/lib/chunks/{chunk-RBOO4NDG.js → chunk-D3GE3OCB.js} +1 -1
  52. package/dist/lib/chunks/chunk-DVFFYY5G.js +74 -0
  53. package/dist/lib/chunks/{chunk-5H3SNUQT.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-2KJZ326K.js → chunk-FOCJ7HPC.js} +7 -7
  59. package/dist/lib/chunks/{chunk-OL746E4T.js → chunk-FUAUPNRO.js} +26 -18
  60. package/dist/lib/chunks/{chunk-J6IJGYP5.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-CS24IL3K.js → chunk-GESHTTSA.js} +2 -2
  64. package/dist/lib/chunks/chunk-GNMFJ2OK.js +321 -0
  65. package/dist/lib/chunks/{chunk-H3G3VTT7.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-2ROSV4HD.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-AKKFERA4.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-YOZNLFSB.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-WTQWU522.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-5EX5DKMA.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-XU6WQ5UL.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-6KO7HGCQ.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-N2ZZ6JRF.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
@@ -2,16 +2,16 @@ import {
2
2
  checkIntegrity,
3
3
  checkTraceChain,
4
4
  checkTraceCoverage
5
- } from "./chunk-XU6WQ5UL.js";
5
+ } from "./chunk-VPZQGND4.js";
6
6
  import {
7
7
  checkJudgments,
8
8
  checkPlan
9
- } from "./chunk-YOZNLFSB.js";
9
+ } from "./chunk-OQU5IXAJ.js";
10
10
  import {
11
11
  checkCopy,
12
12
  checkGrounding,
13
13
  checkMetrics
14
- } from "./chunk-BEQLSAVX.js";
14
+ } from "./chunk-CUYVHXHI.js";
15
15
  import {
16
16
  CheckOutcome,
17
17
  checkFrom,
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-6KHQ7DXP.js";
22
22
  import {
23
23
  capturedAnswerOf
24
- } from "./chunk-P4K6BP3L.js";
24
+ } from "./chunk-5JPYM4MD.js";
25
25
  import {
26
26
  bundleManifestSchema,
27
27
  bundlePaths,
@@ -29,7 +29,7 @@ import {
29
29
  canonicalization,
30
30
  predecessorPrefix,
31
31
  traceSchemaVersion
32
- } from "./chunk-6KO7HGCQ.js";
32
+ } from "./chunk-WVACVWBL.js";
33
33
  import {
34
34
  parseBundleJson
35
35
  } from "./chunk-E6NQQU6V.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-2QLAFBCG.js";
10
10
  import {
11
11
  aeoAuditConfigSchema
12
- } from "./chunk-ZLOOC46D.js";
12
+ } from "./chunk-OKL7GN2F.js";
13
13
  import {
14
14
  aeoReportCopySchema
15
15
  } from "./chunk-PKB6JRJM.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  authorNotesSchema,
3
3
  authorOutputSchema
4
- } from "./chunk-D2LPQO6Y.js";
4
+ } from "./chunk-MRL5RUP7.js";
5
5
  import {
6
6
  aeoFinalCopyDraftSchema
7
7
  } from "./chunk-2MGARWKY.js";
@@ -82,9 +82,24 @@ var acquireWriterLock = async (dir, purpose) => {
82
82
  };
83
83
  return { takenOver, release };
84
84
  };
85
+ var readWriterLock = async (dir) => {
86
+ const owner = await readOwner(path.join(dir, writerLockFile)).catch(
87
+ // A lock torn mid-write reads as an unknown owner, never as no writer.
88
+ () => ({ host: "", pid: -1, purpose: "unknown", acquiredAt: "" })
89
+ );
90
+ if (owner === void 0) {
91
+ return void 0;
92
+ }
93
+ let state = "unknown";
94
+ if (owner.host === hostname()) {
95
+ state = owner.pid > 0 && isProcessAlive(owner.pid) ? "live" : "abandoned";
96
+ }
97
+ return { owner, state };
98
+ };
85
99
 
86
100
  export {
87
101
  writerLockFile,
88
102
  WriterLockHeldError,
89
- acquireWriterLock
103
+ acquireWriterLock,
104
+ readWriterLock
90
105
  };
@@ -18,13 +18,15 @@ var engineResources = async () => {
18
18
  return {
19
19
  root,
20
20
  author: path.join(packed, "author"),
21
- editorial: path.join(packed, "editorial")
21
+ editorial: path.join(packed, "editorial"),
22
+ guide: path.join(packed, "guide", "OPERATOR.md")
22
23
  };
23
24
  }
24
25
  return {
25
26
  root,
26
27
  author: path.join(root, "src", "author"),
27
- editorial: path.join(root, "src", "engine", "editorial")
28
+ editorial: path.join(root, "src", "engine", "editorial"),
29
+ guide: path.join(root, "src", "engine", "guide", "OPERATOR.md")
28
30
  };
29
31
  };
30
32
 
@@ -0,0 +1,117 @@
1
+ import {
2
+ tokenCostUsd
3
+ } from "./chunk-ZIGNJAPC.js";
4
+ import {
5
+ authorToolCaps
6
+ } from "./chunk-I3XGRGXE.js";
7
+ import {
8
+ authorSearchLowUsd,
9
+ authorTokens,
10
+ costCoefficientsVersion,
11
+ hostTokensPerAnswer,
12
+ probeUsd,
13
+ searchUsdPerAnswer,
14
+ stageTokens
15
+ } from "./chunk-DVFFYY5G.js";
16
+
17
+ // src/engine/cost-estimate.ts
18
+ var cents = (usd) => {
19
+ return Math.round(usd * 100) / 100;
20
+ };
21
+ var rangeOf = (low, high) => {
22
+ return { low: cents(low), high: cents(high) };
23
+ };
24
+ var recommendedCapOf = (high) => {
25
+ return Math.max(1, Math.ceil(high));
26
+ };
27
+ var tokensCost = (model, tokens, cachedShare) => {
28
+ return tokenCostUsd(model.pricingUsdPerMillion, {
29
+ inputTokens: tokens.input,
30
+ cachedInputTokens: Math.round(tokens.input * cachedShare),
31
+ outputTokens: tokens.output
32
+ });
33
+ };
34
+ var scaled = (tokens, factor) => {
35
+ return { input: tokens.input * factor, output: tokens.output * factor };
36
+ };
37
+ var sumOf = (ranges) => {
38
+ return rangeOf(
39
+ ranges.reduce((total, range) => total + range.low, 0),
40
+ ranges.reduce((total, range) => total + range.high, 0)
41
+ );
42
+ };
43
+ var estimateRunCost = ({
44
+ plan,
45
+ model,
46
+ grounding
47
+ }) => {
48
+ const answers = plan.units.length;
49
+ const { cachedShare } = stageTokens;
50
+ const probes = sumOf(
51
+ [...plan.probesBySurface].map(
52
+ ([surface, count]) => rangeOf(probeUsd[surface].low * count, probeUsd[surface].high * count)
53
+ )
54
+ );
55
+ const stages = rangeOf(
56
+ tokensCost(
57
+ model,
58
+ scaled(stageTokens.perAnswer.low, answers),
59
+ cachedShare.high
60
+ ) + tokensCost(model, stageTokens.perRun.low, cachedShare.high),
61
+ tokensCost(
62
+ model,
63
+ scaled(stageTokens.perAnswer.high, answers),
64
+ cachedShare.low
65
+ ) + tokensCost(model, stageTokens.perRun.high, cachedShare.low)
66
+ );
67
+ const hostTokens = hostTokensPerAnswer[grounding];
68
+ const hostCalls = rangeOf(
69
+ tokensCost(model, scaled(hostTokens.low, answers), 0),
70
+ tokensCost(model, scaled(hostTokens.high, answers), 0)
71
+ );
72
+ const search = grounding === "full" ? rangeOf(
73
+ searchUsdPerAnswer.low * answers,
74
+ searchUsdPerAnswer.high * answers
75
+ ) : rangeOf(0, 0);
76
+ const total = sumOf([probes, stages, hostCalls, search]);
77
+ const estimate = {
78
+ currency: "USD",
79
+ kind: "estimate",
80
+ model: model.id,
81
+ coefficientsVersion: costCoefficientsVersion,
82
+ low: total.low,
83
+ high: total.high,
84
+ categories: { probes, stages, hostCalls, search },
85
+ recommendedCapUsd: recommendedCapOf(total.high)
86
+ };
87
+ return estimate;
88
+ };
89
+ var estimateAuthorCost = (model) => {
90
+ const { cachedShare } = stageTokens;
91
+ const stages = rangeOf(
92
+ tokensCost(model, authorTokens.session.low, cachedShare.high),
93
+ tokensCost(model, authorTokens.session.high, cachedShare.low)
94
+ );
95
+ const search = rangeOf(authorSearchLowUsd, authorToolCaps.searchSpendUsd);
96
+ const total = sumOf([stages, search]);
97
+ const estimate = {
98
+ currency: "USD",
99
+ kind: "estimate",
100
+ model: model.id,
101
+ coefficientsVersion: costCoefficientsVersion,
102
+ low: total.low,
103
+ high: total.high,
104
+ categories: { stages, search },
105
+ recommendedCapUsd: recommendedCapOf(total.high)
106
+ };
107
+ return estimate;
108
+ };
109
+ var describeCostRange = (range) => {
110
+ return `$${range.low.toFixed(2)} to $${range.high.toFixed(2)}`;
111
+ };
112
+
113
+ export {
114
+ estimateRunCost,
115
+ estimateAuthorCost,
116
+ describeCostRange
117
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  checkpointScope
3
- } from "./chunk-XHWRSGX3.js";
3
+ } from "./chunk-3JO5TXBA.js";
4
4
  import {
5
5
  runTechnicalChecks
6
- } from "./chunk-2ROSV4HD.js";
6
+ } from "./chunk-L7MEIRJB.js";
7
7
  import {
8
8
  writeFileAtomically
9
9
  } from "./chunk-MX6Y4RD2.js";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-2QLAFBCG.js";
16
16
  import {
17
17
  technicalChecksArtifactSchema
18
- } from "./chunk-5KKLUM7M.js";
18
+ } from "./chunk-YAAUWCJ4.js";
19
19
 
20
20
  // src/codex-workflow/run-source.ts
21
21
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-72P6NOKD.js";
4
4
  import {
5
5
  authorOutputSchema
6
- } from "./chunk-D2LPQO6Y.js";
6
+ } from "./chunk-MRL5RUP7.js";
7
7
 
8
8
  // src/author/examples.ts
9
9
  var syntheticExample = {
@@ -1,31 +1,31 @@
1
1
  import {
2
2
  authorDir
3
- } from "./chunk-3EBWDHPK.js";
4
- import {
5
- enginePackageRoot
6
- } from "./chunk-3BFCI7LI.js";
3
+ } from "./chunk-TJQ5OPLQ.js";
7
4
  import {
8
5
  readResearchDocuments,
9
6
  readResearchJournal,
10
7
  researchDir,
11
8
  summarizeResearch
12
- } from "./chunk-Q2PWES4B.js";
9
+ } from "./chunk-I3XGRGXE.js";
10
+ import {
11
+ enginePackageRoot
12
+ } from "./chunk-3BFCI7LI.js";
13
13
  import {
14
14
  authorExamples
15
- } from "./chunk-IPNK7FYT.js";
15
+ } from "./chunk-AYY4MYTW.js";
16
16
  import {
17
17
  writeFileAtomically
18
18
  } from "./chunk-MX6Y4RD2.js";
19
19
  import {
20
20
  authorStageOutputSchema,
21
21
  stageJsonSchema
22
- } from "./chunk-GVC4LH2N.js";
23
- import {
24
- validateAuthorOutput
25
- } from "./chunk-X6E44EGV.js";
22
+ } from "./chunk-6GHHNPFJ.js";
26
23
  import {
27
24
  getEnvironment
28
25
  } from "./chunk-PO2J5OQ3.js";
26
+ import {
27
+ validateAuthorOutput
28
+ } from "./chunk-XR44YSHT.js";
29
29
  import {
30
30
  canonicalResearchUrl
31
31
  } from "./chunk-SWJ7KQSL.js";
@@ -1,3 +1,6 @@
1
+ import {
2
+ getGoogleAIOverview
3
+ } from "./chunk-IB6RROHE.js";
1
4
  import {
2
5
  extractAnthropicRetrieval,
3
6
  extractGeminiRetrieval,
@@ -5,9 +8,6 @@ import {
5
8
  retrievalResultUrls,
6
9
  rewriteRetrievalUrls
7
10
  } from "./chunk-S2SFHTJD.js";
8
- import {
9
- getGoogleAIOverview
10
- } from "./chunk-IB6RROHE.js";
11
11
  import {
12
12
  ProbeTraceError,
13
13
  endAttempt,
@@ -33,6 +33,9 @@ import {
33
33
  import {
34
34
  createLog
35
35
  } from "./chunk-ZSEY7AHQ.js";
36
+ import {
37
+ isObject
38
+ } from "./chunk-7PLK6VGC.js";
36
39
  import {
37
40
  sleep,
38
41
  unlimited
@@ -63,6 +66,19 @@ var aiSearchProbeModels = {
63
66
  var chatProbeRequestedModel = (surface) => {
64
67
  return surface === "google_ai_overview" ? null : aiSearchProbeModels[surface];
65
68
  };
69
+ var gatewayCostOf = (metadata) => {
70
+ const cost = isObject(metadata) && isObject(metadata.gateway) ? metadata.gateway.cost : void 0;
71
+ const usd = typeof cost === "string" && cost.trim() ? Number(cost) : cost;
72
+ return typeof usd === "number" && Number.isFinite(usd) && usd >= 0 ? usd : void 0;
73
+ };
74
+ var reportedCostOf = (costs) => {
75
+ if (costs.some((cost) => cost === void 0)) {
76
+ return {};
77
+ }
78
+ return {
79
+ reportedCostUsd: costs.reduce((sum, cost) => sum + (cost ?? 0), 0)
80
+ };
81
+ };
66
82
  var searchPromptPrefix = "Search the web for current information to answer the following question. Return a complete answer, not just search results.\n\n";
67
83
  var formatProbeSources = (sources) => {
68
84
  const rows = [];
@@ -146,11 +162,13 @@ var runSearchRequiredProbe = async (args) => {
146
162
  });
147
163
  retrieval = null;
148
164
  }
165
+ const firstCost = gatewayCostOf(first.providerMetadata);
149
166
  if (first.text.trim().length > 0) {
150
167
  return {
151
168
  text: withProbeSources(first.text, first.sources),
152
169
  retrieval,
153
- ...served
170
+ ...served,
171
+ ...reportedCostOf([firstCost])
154
172
  };
155
173
  }
156
174
  log.warn("Search probe returned no answer text; synthesizing from search", {
@@ -179,9 +197,10 @@ var runSearchRequiredProbe = async (args) => {
179
197
  maxRetries: 0,
180
198
  abortSignal: AbortSignal.timeout(chatProbeTimeoutMs)
181
199
  });
182
- const [followupText, followupSources] = await Promise.all([
200
+ const [followupText, followupSources, followupMetadata] = await Promise.all([
183
201
  followupStream.text,
184
- followupStream.sources
202
+ followupStream.sources,
203
+ followupStream.providerMetadata
185
204
  ]).catch((error) => {
186
205
  throw followupFailure ?? error;
187
206
  });
@@ -193,7 +212,8 @@ var runSearchRequiredProbe = async (args) => {
193
212
  first.sources.length > 0 ? first.sources : followup.sources
194
213
  ),
195
214
  retrieval,
196
- ...served
215
+ ...served,
216
+ ...reportedCostOf([firstCost, gatewayCostOf(followupMetadata)])
197
217
  };
198
218
  }
199
219
  throw new ProbeFailure(
@@ -269,8 +289,14 @@ var buildProbeModels = (args) => {
269
289
  const result = await Promise.all([
270
290
  stream.text,
271
291
  stream.sources,
272
- stream.response
273
- ]).then(([text, sources, response]) => ({ text, sources, response })).catch((error) => {
292
+ stream.response,
293
+ stream.providerMetadata
294
+ ]).then(([text, sources, response, providerMetadata]) => ({
295
+ text,
296
+ sources,
297
+ response,
298
+ providerMetadata
299
+ })).catch((error) => {
274
300
  throw streamFailure ?? error;
275
301
  });
276
302
  if (result.text.trim().length === 0) {
@@ -286,7 +312,8 @@ var buildProbeModels = (args) => {
286
312
  return {
287
313
  text: withProbeSources(result.text, result.sources),
288
314
  retrieval: unexposedRetrieval("perplexity"),
289
- ...reportedModel === void 0 ? {} : { reportedModel }
315
+ ...reportedModel === void 0 ? {} : { reportedModel },
316
+ ...reportedCostOf([gatewayCostOf(result.providerMetadata)])
290
317
  };
291
318
  }
292
319
  },
@@ -485,7 +512,8 @@ var runChatUnit = async (unit, { prompt, model, limiter, job, logContext }) => {
485
512
  retrieval: answer.retrieval,
486
513
  requestedModel: chatProbeRequestedModel(model.name),
487
514
  ...answer.reportedModel ? { reportedModel: answer.reportedModel } : {},
488
- ...answer.noOverview ? { noOverview: true } : {}
515
+ ...answer.noOverview ? { noOverview: true } : {},
516
+ ...answer.reportedCostUsd === void 0 ? {} : { costUsd: answer.reportedCostUsd }
489
517
  });
490
518
  if (unrecorded !== null) {
491
519
  return {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  groundingRules
3
- } from "./chunk-WUELMJ22.js";
3
+ } from "./chunk-IE7NAL6B.js";
4
4
  import {
5
5
  locateVerbatimPassage
6
6
  } from "./chunk-3UFZ2XPE.js";
7
7
  import {
8
8
  generateStructured
9
- } from "./chunk-PCYNBDZ7.js";
9
+ } from "./chunk-CO5T6WU5.js";
10
10
  import {
11
11
  ModelBudgetError
12
12
  } from "./chunk-TNL2GWYR.js";
@@ -0,0 +1,93 @@
1
+ import {
2
+ readEnv
3
+ } from "./chunk-PO2J5OQ3.js";
4
+ import {
5
+ isAgentSurface
6
+ } from "./chunk-OBXAHX3L.js";
7
+
8
+ // src/bundle/isolation.ts
9
+ import { z } from "zod";
10
+ var IsolationBoundary = {
11
+ NATIVE: "native",
12
+ CONTAINER: "container"
13
+ };
14
+ var writerIsolationSchema = z.looseObject({
15
+ boundary: z.enum([IsolationBoundary.NATIVE, IsolationBoundary.CONTAINER]),
16
+ /** The sandbox the Codex probe surface runs in, should it run. */
17
+ codexProbeSandbox: z.string()
18
+ });
19
+ var observedIsolation = () => {
20
+ const isolation = {
21
+ boundary: readEnv("AEO_ISOLATED_ADAPTER") === "1" ? IsolationBoundary.CONTAINER : IsolationBoundary.NATIVE,
22
+ codexProbeSandbox: readEnv("AEO_CODEX_SANDBOX") === "danger-full-access" ? "danger-full-access" : "read-only"
23
+ };
24
+ return isolation;
25
+ };
26
+ var runtimeIsolationOf = (event) => {
27
+ const runtime = z.looseObject({ isolation: writerIsolationSchema }).safeParse(event.payload.runtime);
28
+ return runtime.success ? runtime.data.isolation.boundary : "unknown";
29
+ };
30
+ var stringOf = (value) => {
31
+ return typeof value === "string" ? value : void 0;
32
+ };
33
+ var sandboxOf = (event) => {
34
+ const details = z.looseObject({ sandbox: z.string() }).safeParse(event.payload.details);
35
+ return details.success ? details.data.sandbox : void 0;
36
+ };
37
+ var summarizeIsolation = (events) => {
38
+ const writers = [];
39
+ const stageSandboxes = /* @__PURE__ */ new Set();
40
+ const agentCliAccounts = /* @__PURE__ */ new Set();
41
+ for (const event of events) {
42
+ if (event.type === "run_started" || event.type === "run_resumed") {
43
+ writers.push(runtimeIsolationOf(event));
44
+ continue;
45
+ }
46
+ if (event.type !== "operation_started") {
47
+ continue;
48
+ }
49
+ const kind = stringOf(event.payload.kind);
50
+ const role = stringOf(event.payload.role);
51
+ const sandbox = sandboxOf(event);
52
+ if (kind === "codex_session" && sandbox !== void 0) {
53
+ stageSandboxes.add(sandbox);
54
+ }
55
+ const writer = writers.at(-1);
56
+ if ((kind === "probe" || kind === "canary") && role !== void 0 && isAgentSurface(role) && writer !== IsolationBoundary.CONTAINER) {
57
+ agentCliAccounts.add(role);
58
+ }
59
+ }
60
+ const isolation = {
61
+ writers,
62
+ stageSandboxes: [...stageSandboxes].sort(),
63
+ agentCliAccounts: [...agentCliAccounts].sort()
64
+ };
65
+ return isolation;
66
+ };
67
+ var isolationLimitations = (isolation) => {
68
+ const limitations = [];
69
+ if (isolation.writers.includes("unknown")) {
70
+ limitations.push(
71
+ "A writer of this run predates isolation recording; its boundary is unknown."
72
+ );
73
+ }
74
+ if (isolation.writers.includes(IsolationBoundary.NATIVE)) {
75
+ limitations.push(
76
+ "Part or all of this run executed natively, without a container boundary. Codex sandboxes restrict writes and network access, not reads: a Codex session could read any file the operator's account can, while it processed untrusted answers and pages."
77
+ );
78
+ }
79
+ if (isolation.agentCliAccounts.length > 0) {
80
+ limitations.push(
81
+ `The coding-agent CLIs ${isolation.agentCliAccounts.join(", ")} ran as the operator's own account. Account-level settings outside the tool's control (user rules, approved MCP servers) applied and are not recorded.`
82
+ );
83
+ }
84
+ return limitations;
85
+ };
86
+
87
+ export {
88
+ IsolationBoundary,
89
+ writerIsolationSchema,
90
+ observedIsolation,
91
+ summarizeIsolation,
92
+ isolationLimitations
93
+ };
@@ -4,13 +4,16 @@ import {
4
4
  import {
5
5
  structuredImageMessages,
6
6
  structuredImageTokens
7
- } from "./chunk-QFVRCSJ2.js";
7
+ } from "./chunk-WDOA5JEH.js";
8
8
  import {
9
9
  servedModelOf
10
10
  } from "./chunk-ZVAKKRRD.js";
11
11
  import {
12
12
  createLog
13
13
  } from "./chunk-ZSEY7AHQ.js";
14
+ import {
15
+ readEnv
16
+ } from "./chunk-PO2J5OQ3.js";
14
17
  import {
15
18
  structuredFailureDiagnostic
16
19
  } from "./chunk-NANJGMEJ.js";
@@ -20,10 +23,7 @@ import {
20
23
  import {
21
24
  internalModelRoleDigest,
22
25
  internalModelRoleSchema
23
- } from "./chunk-CFFPOTP4.js";
24
- import {
25
- readEnv
26
- } from "./chunk-PO2J5OQ3.js";
26
+ } from "./chunk-RYCRL3YA.js";
27
27
  import {
28
28
  ModelBudgetError
29
29
  } from "./chunk-TNL2GWYR.js";
@@ -54,6 +54,11 @@ var StructuredJournalError = class extends Error {
54
54
  this.name = "StructuredJournalError";
55
55
  }
56
56
  };
57
+ var reasoningEffortOf = (role) => {
58
+ const { openai, gateway: gateway2 } = role.providerOptions;
59
+ const gatewayEffort = gateway2 && "effort" in gateway2.reasoning ? gateway2.reasoning.effort : void 0;
60
+ return openai?.reasoningEffort ?? gatewayEffort;
61
+ };
57
62
  var reportedNumber = (value) => {
58
63
  const number = typeof value === "string" && value.trim() ? Number(value) : value;
59
64
  return typeof number === "number" && Number.isFinite(number) && number >= 0 ? number : void 0;
@@ -247,7 +252,7 @@ var generateStructured = async (input, transport = gatewayTransport) => {
247
252
  callId,
248
253
  role: input.roleName,
249
254
  requestedModel: input.role.model,
250
- reasoningEffort: input.role.providerOptions.openai?.reasoningEffort,
255
+ reasoningEffort: reasoningEffortOf(input.role),
251
256
  profileDigest: internalModelRoleDigest(input.role),
252
257
  ...reservation
253
258
  });
@@ -302,7 +307,7 @@ var generateStructured = async (input, transport = gatewayTransport) => {
302
307
  assertModelCallActive(signal, error);
303
308
  await input.accounting.settle(callId, {
304
309
  requestedModel: input.role.model,
305
- reasoningEffort: input.role.providerOptions.openai?.reasoningEffort,
310
+ reasoningEffort: reasoningEffortOf(input.role),
306
311
  durationMs: Date.now() - start,
307
312
  costUsd: 0,
308
313
  inputTokens: 0,
@@ -318,7 +323,7 @@ var generateStructured = async (input, transport = gatewayTransport) => {
318
323
  ...billed.usage,
319
324
  callId,
320
325
  requestedModel: input.role.model,
321
- reasoningEffort: input.role.providerOptions.openai?.reasoningEffort,
326
+ reasoningEffort: reasoningEffortOf(input.role),
322
327
  durationMs: Date.now() - start,
323
328
  valid: false
324
329
  };
@@ -353,7 +358,7 @@ var generateStructured = async (input, transport = gatewayTransport) => {
353
358
  ...result.usage,
354
359
  callId,
355
360
  requestedModel: input.role.model,
356
- reasoningEffort: input.role.providerOptions.openai?.reasoningEffort,
361
+ reasoningEffort: reasoningEffortOf(input.role),
357
362
  durationMs: Date.now() - start
358
363
  };
359
364
  await journal(input.journal, {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  aggregateJudgments,
3
3
  metricsView
4
- } from "./chunk-J46W3EMQ.js";
4
+ } from "./chunk-UZJSTJFP.js";
5
5
  import {
6
6
  CheckOutcome,
7
7
  checkFrom,
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  bundlePaths,
13
13
  calculationVersion
14
- } from "./chunk-6KO7HGCQ.js";
14
+ } from "./chunk-WVACVWBL.js";
15
15
  import {
16
16
  canonicalDigest
17
17
  } from "./chunk-E6NQQU6V.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recorded
3
- } from "./chunk-5GZVDGTX.js";
3
+ } from "./chunk-4PD65FRJ.js";
4
4
 
5
5
  // src/grounding/recorded-tools.ts
6
6
  var recordedGroundingTools = (tools, recorder) => {