@prismatic-io/lux 0.0.2-preview.3 → 0.0.2-preview.32

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 (727) hide show
  1. package/lib/answerers/claude-code/index.d.ts +15 -3
  2. package/lib/answerers/claude-code/index.d.ts.map +1 -1
  3. package/lib/answerers/claude-code/index.js +6 -5
  4. package/lib/answerers/claude-code/index.js.map +1 -1
  5. package/lib/answerers/persona/index.d.ts +44 -5
  6. package/lib/answerers/persona/index.d.ts.map +1 -1
  7. package/lib/answerers/persona/index.js +60 -34
  8. package/lib/answerers/persona/index.js.map +1 -1
  9. package/lib/answerers/terminal/index.d.ts +9 -3
  10. package/lib/answerers/terminal/index.d.ts.map +1 -1
  11. package/lib/answerers/terminal/index.js +7 -5
  12. package/lib/answerers/terminal/index.js.map +1 -1
  13. package/lib/assertions/authoring.d.ts +2 -2
  14. package/lib/assertions/authoring.d.ts.map +1 -1
  15. package/lib/assertions/authoring.js.map +1 -1
  16. package/lib/assertions/core/command-exits-zero.d.ts +4 -1
  17. package/lib/assertions/core/command-exits-zero.d.ts.map +1 -1
  18. package/lib/assertions/core/command-exits-zero.js +50 -7
  19. package/lib/assertions/core/command-exits-zero.js.map +1 -1
  20. package/lib/assertions/core/event-checks.d.ts +3 -0
  21. package/lib/assertions/core/event-checks.d.ts.map +1 -1
  22. package/lib/assertions/core/event-checks.js +49 -3
  23. package/lib/assertions/core/event-checks.js.map +1 -1
  24. package/lib/assertions/core/file-checks.d.ts +6 -0
  25. package/lib/assertions/core/file-checks.d.ts.map +1 -1
  26. package/lib/assertions/core/helpers.d.ts +2 -7
  27. package/lib/assertions/core/helpers.d.ts.map +1 -1
  28. package/lib/assertions/core/helpers.js +2 -6
  29. package/lib/assertions/core/helpers.js.map +1 -1
  30. package/lib/assertions/core/index.d.ts.map +1 -1
  31. package/lib/assertions/core/index.js +2 -1
  32. package/lib/assertions/core/index.js.map +1 -1
  33. package/lib/assertions/core/json-pointer-equals.d.ts +1 -0
  34. package/lib/assertions/core/json-pointer-equals.d.ts.map +1 -1
  35. package/lib/assertions/core/output-checks.d.ts +3 -0
  36. package/lib/assertions/core/output-checks.d.ts.map +1 -1
  37. package/lib/assertions/core/predicate.d.ts +1 -0
  38. package/lib/assertions/core/predicate.d.ts.map +1 -1
  39. package/lib/assertions/core/resource-checks.d.ts +25 -0
  40. package/lib/assertions/core/resource-checks.d.ts.map +1 -1
  41. package/lib/assertions/core/resource-checks.js +35 -5
  42. package/lib/assertions/core/resource-checks.js.map +1 -1
  43. package/lib/assertions/rubric/index.d.ts +28 -3
  44. package/lib/assertions/rubric/index.d.ts.map +1 -1
  45. package/lib/assertions/rubric/index.js +59 -13
  46. package/lib/assertions/rubric/index.js.map +1 -1
  47. package/lib/assertions/rubric/internal.d.ts +30 -5
  48. package/lib/assertions/rubric/internal.d.ts.map +1 -1
  49. package/lib/assertions/rubric/internal.js +181 -28
  50. package/lib/assertions/rubric/internal.js.map +1 -1
  51. package/lib/authoring.d.ts +36 -2
  52. package/lib/authoring.d.ts.map +1 -1
  53. package/lib/authoring.js +36 -1
  54. package/lib/authoring.js.map +1 -1
  55. package/lib/cli/bin.js +2 -13
  56. package/lib/cli/bin.js.map +1 -1
  57. package/lib/cli/command-runtime.d.ts +3 -3
  58. package/lib/cli/command-runtime.d.ts.map +1 -1
  59. package/lib/cli/command-runtime.js +17 -6
  60. package/lib/cli/command-runtime.js.map +1 -1
  61. package/lib/cli/doctor.d.ts +55 -0
  62. package/lib/cli/doctor.d.ts.map +1 -0
  63. package/lib/cli/doctor.js +14 -0
  64. package/lib/cli/doctor.js.map +1 -0
  65. package/lib/cli/harness-plan.d.ts +26 -0
  66. package/lib/cli/harness-plan.d.ts.map +1 -0
  67. package/lib/cli/harness-plan.js +75 -0
  68. package/lib/cli/harness-plan.js.map +1 -0
  69. package/lib/cli/init-templates.d.ts +11 -0
  70. package/lib/cli/init-templates.d.ts.map +1 -0
  71. package/lib/cli/init-templates.js +215 -0
  72. package/lib/cli/init-templates.js.map +1 -0
  73. package/lib/cli/init.d.ts +10 -0
  74. package/lib/cli/init.d.ts.map +1 -1
  75. package/lib/cli/init.js +34 -173
  76. package/lib/cli/init.js.map +1 -1
  77. package/lib/cli/output-schemas.d.ts +1408 -0
  78. package/lib/cli/output-schemas.d.ts.map +1 -0
  79. package/lib/cli/output-schemas.js +91 -0
  80. package/lib/cli/output-schemas.js.map +1 -0
  81. package/lib/cli/program.d.ts +140 -12
  82. package/lib/cli/program.d.ts.map +1 -1
  83. package/lib/cli/program.js +779 -646
  84. package/lib/cli/program.js.map +1 -1
  85. package/lib/cli/render/reporter.d.ts.map +1 -1
  86. package/lib/cli/render/reporter.js +48 -8
  87. package/lib/cli/render/reporter.js.map +1 -1
  88. package/lib/cli/run-options.d.ts +20 -4
  89. package/lib/cli/run-options.d.ts.map +1 -1
  90. package/lib/cli/run-options.js +100 -19
  91. package/lib/cli/run-options.js.map +1 -1
  92. package/lib/cli/view.d.ts +15 -0
  93. package/lib/cli/view.d.ts.map +1 -0
  94. package/lib/cli/view.js +168 -0
  95. package/lib/cli/view.js.map +1 -0
  96. package/lib/container/driver.d.ts +27 -0
  97. package/lib/container/driver.d.ts.map +1 -0
  98. package/lib/container/driver.js +197 -0
  99. package/lib/container/driver.js.map +1 -0
  100. package/lib/container/protocol.d.ts +12 -0
  101. package/lib/container/protocol.d.ts.map +1 -0
  102. package/lib/container/protocol.js +38 -0
  103. package/lib/container/protocol.js.map +1 -0
  104. package/lib/container/resources.d.ts +12 -0
  105. package/lib/container/resources.d.ts.map +1 -0
  106. package/lib/container/resources.js +133 -0
  107. package/lib/container/resources.js.map +1 -0
  108. package/lib/container/worker.d.ts +2 -0
  109. package/lib/container/worker.d.ts.map +1 -0
  110. package/lib/container/worker.js +85 -0
  111. package/lib/container/worker.js.map +1 -0
  112. package/lib/core/action-events.d.ts +29 -0
  113. package/lib/core/action-events.d.ts.map +1 -0
  114. package/lib/core/action-events.js +51 -0
  115. package/lib/core/action-events.js.map +1 -0
  116. package/lib/core/agent-activity.d.ts +49 -0
  117. package/lib/core/agent-activity.d.ts.map +1 -0
  118. package/lib/core/agent-activity.js +206 -0
  119. package/lib/core/agent-activity.js.map +1 -0
  120. package/lib/core/agent-environment.d.ts +5 -0
  121. package/lib/core/agent-environment.d.ts.map +1 -0
  122. package/lib/core/agent-environment.js +47 -0
  123. package/lib/core/agent-environment.js.map +1 -0
  124. package/lib/core/agent-events.d.ts +26 -0
  125. package/lib/core/agent-events.d.ts.map +1 -0
  126. package/lib/core/agent-events.js +13 -0
  127. package/lib/core/agent-events.js.map +1 -0
  128. package/lib/core/annotation.d.ts +6 -2
  129. package/lib/core/annotation.d.ts.map +1 -1
  130. package/lib/core/annotation.js +2 -1
  131. package/lib/core/annotation.js.map +1 -1
  132. package/lib/core/answerer.d.ts +12 -0
  133. package/lib/core/answerer.d.ts.map +1 -1
  134. package/lib/core/answerer.js +2 -0
  135. package/lib/core/answerer.js.map +1 -1
  136. package/lib/core/artifact-evidence.d.ts +8 -0
  137. package/lib/core/artifact-evidence.d.ts.map +1 -1
  138. package/lib/core/artifact-evidence.js +36 -4
  139. package/lib/core/artifact-evidence.js.map +1 -1
  140. package/lib/core/assertion.d.ts +20 -2
  141. package/lib/core/assertion.d.ts.map +1 -1
  142. package/lib/core/assertion.js +19 -1
  143. package/lib/core/assertion.js.map +1 -1
  144. package/lib/core/case.d.ts +111 -3
  145. package/lib/core/case.d.ts.map +1 -1
  146. package/lib/core/case.js +17 -2
  147. package/lib/core/case.js.map +1 -1
  148. package/lib/core/command-verification.d.ts +10 -0
  149. package/lib/core/command-verification.d.ts.map +1 -0
  150. package/lib/core/command-verification.js +66 -0
  151. package/lib/core/command-verification.js.map +1 -0
  152. package/lib/core/driver-execution.d.ts +83 -0
  153. package/lib/core/driver-execution.d.ts.map +1 -0
  154. package/lib/core/driver-execution.js +72 -0
  155. package/lib/core/driver-execution.js.map +1 -0
  156. package/lib/core/driver-metrics.d.ts +98 -0
  157. package/lib/core/driver-metrics.d.ts.map +1 -0
  158. package/lib/core/driver-metrics.js +36 -0
  159. package/lib/core/driver-metrics.js.map +1 -0
  160. package/lib/core/driver.d.ts +64 -0
  161. package/lib/core/driver.d.ts.map +1 -1
  162. package/lib/core/driver.js +28 -0
  163. package/lib/core/driver.js.map +1 -1
  164. package/lib/core/duration.d.ts +5 -0
  165. package/lib/core/duration.d.ts.map +1 -0
  166. package/lib/core/duration.js +49 -0
  167. package/lib/core/duration.js.map +1 -0
  168. package/lib/core/environment.d.ts +18 -0
  169. package/lib/core/environment.d.ts.map +1 -0
  170. package/lib/core/environment.js +21 -0
  171. package/lib/core/environment.js.map +1 -0
  172. package/lib/core/evaluation-clusters.d.ts +17 -0
  173. package/lib/core/evaluation-clusters.d.ts.map +1 -0
  174. package/lib/core/evaluation-clusters.js +23 -0
  175. package/lib/core/evaluation-clusters.js.map +1 -0
  176. package/lib/core/events.d.ts +36 -0
  177. package/lib/core/events.d.ts.map +1 -1
  178. package/lib/core/events.js +12 -2
  179. package/lib/core/events.js.map +1 -1
  180. package/lib/core/experiment.d.ts +32 -2
  181. package/lib/core/experiment.d.ts.map +1 -1
  182. package/lib/core/experiment.js +35 -18
  183. package/lib/core/experiment.js.map +1 -1
  184. package/lib/core/file-tree.d.ts +7 -0
  185. package/lib/core/file-tree.d.ts.map +1 -0
  186. package/lib/core/file-tree.js +35 -0
  187. package/lib/core/file-tree.js.map +1 -0
  188. package/lib/core/global-id.d.ts +6 -0
  189. package/lib/core/global-id.d.ts.map +1 -0
  190. package/lib/core/global-id.js +17 -0
  191. package/lib/core/global-id.js.map +1 -0
  192. package/lib/core/harness-catalog.d.ts +35 -0
  193. package/lib/core/harness-catalog.d.ts.map +1 -0
  194. package/lib/core/harness-catalog.js +45 -0
  195. package/lib/core/harness-catalog.js.map +1 -0
  196. package/lib/core/harness-catalogs/antigravity.d.ts +11 -0
  197. package/lib/core/harness-catalogs/antigravity.d.ts.map +1 -0
  198. package/lib/core/harness-catalogs/antigravity.js +23 -0
  199. package/lib/core/harness-catalogs/antigravity.js.map +1 -0
  200. package/lib/core/harness-catalogs/claude-code.d.ts +12 -0
  201. package/lib/core/harness-catalogs/claude-code.d.ts.map +1 -0
  202. package/lib/core/harness-catalogs/claude-code.js +24 -0
  203. package/lib/core/harness-catalogs/claude-code.js.map +1 -0
  204. package/lib/core/harness-catalogs/codex.d.ts +11 -0
  205. package/lib/core/harness-catalogs/codex.d.ts.map +1 -0
  206. package/lib/core/harness-catalogs/codex.js +26 -0
  207. package/lib/core/harness-catalogs/codex.js.map +1 -0
  208. package/lib/core/harness-catalogs/copilot.d.ts +29 -0
  209. package/lib/core/harness-catalogs/copilot.d.ts.map +1 -0
  210. package/lib/core/harness-catalogs/copilot.js +45 -0
  211. package/lib/core/harness-catalogs/copilot.js.map +1 -0
  212. package/lib/core/harness-catalogs/cursor.d.ts +2 -0
  213. package/lib/core/harness-catalogs/cursor.d.ts.map +1 -0
  214. package/lib/core/harness-catalogs/cursor.js +13 -0
  215. package/lib/core/harness-catalogs/cursor.js.map +1 -0
  216. package/lib/core/harness-catalogs/grok-build.d.ts +7 -0
  217. package/lib/core/harness-catalogs/grok-build.d.ts.map +1 -0
  218. package/lib/core/harness-catalogs/grok-build.js +18 -0
  219. package/lib/core/harness-catalogs/grok-build.js.map +1 -0
  220. package/lib/core/harness-catalogs/index.d.ts +73 -0
  221. package/lib/core/harness-catalogs/index.d.ts.map +1 -0
  222. package/lib/core/harness-catalogs/index.js +17 -0
  223. package/lib/core/harness-catalogs/index.js.map +1 -0
  224. package/lib/core/harness-matrix.d.ts +154 -0
  225. package/lib/core/harness-matrix.d.ts.map +1 -0
  226. package/lib/core/harness-matrix.js +204 -0
  227. package/lib/core/harness-matrix.js.map +1 -0
  228. package/lib/core/index.d.ts +12 -0
  229. package/lib/core/index.d.ts.map +1 -1
  230. package/lib/core/index.js +12 -0
  231. package/lib/core/index.js.map +1 -1
  232. package/lib/core/lifecycle-fixtures.d.ts.map +1 -1
  233. package/lib/core/lifecycle-fixtures.js +4 -2
  234. package/lib/core/lifecycle-fixtures.js.map +1 -1
  235. package/lib/core/model-cli.d.ts +9 -11
  236. package/lib/core/model-cli.d.ts.map +1 -1
  237. package/lib/core/model-cli.js +31 -19
  238. package/lib/core/model-cli.js.map +1 -1
  239. package/lib/core/platform-process.d.ts +6 -1
  240. package/lib/core/platform-process.d.ts.map +1 -1
  241. package/lib/core/platform-process.js +49 -11
  242. package/lib/core/platform-process.js.map +1 -1
  243. package/lib/core/rubric.d.ts +1 -0
  244. package/lib/core/rubric.d.ts.map +1 -1
  245. package/lib/core/run.d.ts +293 -1
  246. package/lib/core/run.d.ts.map +1 -1
  247. package/lib/core/run.js +27 -0
  248. package/lib/core/run.js.map +1 -1
  249. package/lib/core/secure-copy.d.ts.map +1 -0
  250. package/lib/core/secure-copy.js.map +1 -0
  251. package/lib/core/usage.d.ts +5 -0
  252. package/lib/core/usage.d.ts.map +1 -1
  253. package/lib/core/usage.js +3 -0
  254. package/lib/core/usage.js.map +1 -1
  255. package/lib/core/wire.d.ts +12 -0
  256. package/lib/core/wire.d.ts.map +1 -1
  257. package/lib/core/wire.js +5 -1
  258. package/lib/core/wire.js.map +1 -1
  259. package/lib/drivers/antigravity/artifacts.d.ts +2 -0
  260. package/lib/drivers/antigravity/artifacts.d.ts.map +1 -0
  261. package/lib/drivers/antigravity/artifacts.js +33 -0
  262. package/lib/drivers/antigravity/artifacts.js.map +1 -0
  263. package/lib/drivers/antigravity/config.d.ts +88 -0
  264. package/lib/drivers/antigravity/config.d.ts.map +1 -0
  265. package/lib/drivers/antigravity/config.js +87 -0
  266. package/lib/drivers/antigravity/config.js.map +1 -0
  267. package/lib/drivers/antigravity/events.d.ts +4 -0
  268. package/lib/drivers/antigravity/events.d.ts.map +1 -0
  269. package/lib/drivers/antigravity/events.js +241 -0
  270. package/lib/drivers/antigravity/events.js.map +1 -0
  271. package/lib/drivers/antigravity/index.d.ts +114 -0
  272. package/lib/drivers/antigravity/index.d.ts.map +1 -0
  273. package/lib/drivers/antigravity/index.js +113 -0
  274. package/lib/drivers/antigravity/index.js.map +1 -0
  275. package/lib/drivers/antigravity/runtime.d.ts +7 -0
  276. package/lib/drivers/antigravity/runtime.d.ts.map +1 -0
  277. package/lib/drivers/antigravity/runtime.js +83 -0
  278. package/lib/drivers/antigravity/runtime.js.map +1 -0
  279. package/lib/drivers/claude-code/deferred-process.d.ts +17 -0
  280. package/lib/drivers/claude-code/deferred-process.d.ts.map +1 -0
  281. package/lib/drivers/claude-code/deferred-process.js +108 -0
  282. package/lib/drivers/claude-code/deferred-process.js.map +1 -0
  283. package/lib/drivers/claude-code/index.d.ts +180 -10
  284. package/lib/drivers/claude-code/index.d.ts.map +1 -1
  285. package/lib/drivers/claude-code/index.js +186 -252
  286. package/lib/drivers/claude-code/index.js.map +1 -1
  287. package/lib/drivers/claude-code/isolation.d.ts +8 -0
  288. package/lib/drivers/claude-code/isolation.d.ts.map +1 -0
  289. package/lib/drivers/claude-code/isolation.js +199 -0
  290. package/lib/drivers/claude-code/isolation.js.map +1 -0
  291. package/lib/drivers/claude-code/parse-events.d.ts.map +1 -1
  292. package/lib/drivers/claude-code/parse-events.js +73 -8
  293. package/lib/drivers/claude-code/parse-events.js.map +1 -1
  294. package/lib/drivers/codex/app-events.d.ts +9 -2
  295. package/lib/drivers/codex/app-events.d.ts.map +1 -1
  296. package/lib/drivers/codex/app-events.js +104 -12
  297. package/lib/drivers/codex/app-events.js.map +1 -1
  298. package/lib/drivers/codex/config.d.ts +66 -5
  299. package/lib/drivers/codex/config.d.ts.map +1 -1
  300. package/lib/drivers/codex/config.js +39 -8
  301. package/lib/drivers/codex/config.js.map +1 -1
  302. package/lib/drivers/codex/exec-events.d.ts +4 -0
  303. package/lib/drivers/codex/exec-events.d.ts.map +1 -0
  304. package/lib/drivers/codex/exec-events.js +230 -0
  305. package/lib/drivers/codex/exec-events.js.map +1 -0
  306. package/lib/drivers/codex/index.d.ts +138 -4
  307. package/lib/drivers/codex/index.d.ts.map +1 -1
  308. package/lib/drivers/codex/index.js +112 -276
  309. package/lib/drivers/codex/index.js.map +1 -1
  310. package/lib/drivers/copilot/config.d.ts +84 -0
  311. package/lib/drivers/copilot/config.d.ts.map +1 -0
  312. package/lib/drivers/copilot/config.js +57 -0
  313. package/lib/drivers/copilot/config.js.map +1 -0
  314. package/lib/drivers/copilot/index.d.ts +107 -0
  315. package/lib/drivers/copilot/index.d.ts.map +1 -0
  316. package/lib/drivers/copilot/index.js +268 -0
  317. package/lib/drivers/copilot/index.js.map +1 -0
  318. package/lib/drivers/cursor/config.d.ts +28 -0
  319. package/lib/drivers/cursor/config.d.ts.map +1 -0
  320. package/lib/drivers/cursor/config.js +28 -0
  321. package/lib/drivers/cursor/config.js.map +1 -0
  322. package/lib/drivers/cursor/index.d.ts +44 -0
  323. package/lib/drivers/cursor/index.d.ts.map +1 -0
  324. package/lib/drivers/cursor/index.js +286 -0
  325. package/lib/drivers/cursor/index.js.map +1 -0
  326. package/lib/drivers/cursor/interaction.d.ts +6 -0
  327. package/lib/drivers/cursor/interaction.d.ts.map +1 -0
  328. package/lib/drivers/cursor/interaction.js +55 -0
  329. package/lib/drivers/cursor/interaction.js.map +1 -0
  330. package/lib/drivers/grok-build/config.d.ts +68 -0
  331. package/lib/drivers/grok-build/config.d.ts.map +1 -0
  332. package/lib/drivers/grok-build/config.js +40 -0
  333. package/lib/drivers/grok-build/config.js.map +1 -0
  334. package/lib/drivers/grok-build/index.d.ts +87 -0
  335. package/lib/drivers/grok-build/index.d.ts.map +1 -0
  336. package/lib/drivers/grok-build/index.js +293 -0
  337. package/lib/drivers/grok-build/index.js.map +1 -0
  338. package/lib/drivers/mcp/index.d.ts +37 -4
  339. package/lib/drivers/mcp/index.d.ts.map +1 -1
  340. package/lib/drivers/mcp/index.js +25 -11
  341. package/lib/drivers/mcp/index.js.map +1 -1
  342. package/lib/drivers/shared/acp-events.d.ts +15 -0
  343. package/lib/drivers/shared/acp-events.d.ts.map +1 -0
  344. package/lib/drivers/shared/acp-events.js +83 -0
  345. package/lib/drivers/shared/acp-events.js.map +1 -0
  346. package/lib/drivers/shared/acp-interaction.d.ts +7 -0
  347. package/lib/drivers/shared/acp-interaction.d.ts.map +1 -0
  348. package/lib/drivers/shared/acp-interaction.js +20 -0
  349. package/lib/drivers/shared/acp-interaction.js.map +1 -0
  350. package/lib/drivers/shared/acp-session.d.ts +4 -0
  351. package/lib/drivers/shared/acp-session.d.ts.map +1 -0
  352. package/lib/drivers/shared/acp-session.js +23 -0
  353. package/lib/drivers/shared/acp-session.js.map +1 -0
  354. package/lib/drivers/shared/acp-transport.d.ts +40 -0
  355. package/lib/drivers/shared/acp-transport.d.ts.map +1 -0
  356. package/lib/drivers/shared/acp-transport.js +152 -0
  357. package/lib/drivers/shared/acp-transport.js.map +1 -0
  358. package/lib/drivers/shared/artifacts.d.ts.map +1 -1
  359. package/lib/drivers/shared/artifacts.js +3 -2
  360. package/lib/drivers/shared/artifacts.js.map +1 -1
  361. package/lib/drivers/shared/experiment-behavior.d.ts +13 -0
  362. package/lib/drivers/shared/experiment-behavior.d.ts.map +1 -0
  363. package/lib/drivers/shared/experiment-behavior.js +197 -0
  364. package/lib/drivers/shared/experiment-behavior.js.map +1 -0
  365. package/lib/drivers/shared/experiment-policy.d.ts +4 -0
  366. package/lib/drivers/shared/experiment-policy.d.ts.map +1 -0
  367. package/lib/drivers/shared/experiment-policy.js +143 -0
  368. package/lib/drivers/shared/experiment-policy.js.map +1 -0
  369. package/lib/drivers/subprocess/index.d.ts +39 -4
  370. package/lib/drivers/subprocess/index.d.ts.map +1 -1
  371. package/lib/drivers/subprocess/index.js +56 -12
  372. package/lib/drivers/subprocess/index.js.map +1 -1
  373. package/lib/index.d.ts +22 -8
  374. package/lib/index.d.ts.map +1 -1
  375. package/lib/index.js +20 -6
  376. package/lib/index.js.map +1 -1
  377. package/lib/optimization/reflective.d.ts +3 -1
  378. package/lib/optimization/reflective.d.ts.map +1 -1
  379. package/lib/optimization/reflective.js +3 -2
  380. package/lib/optimization/reflective.js.map +1 -1
  381. package/lib/orchestrator/annotation-loader.d.ts +6 -2
  382. package/lib/orchestrator/annotation-loader.d.ts.map +1 -1
  383. package/lib/orchestrator/annotation-loader.js +8 -0
  384. package/lib/orchestrator/annotation-loader.js.map +1 -1
  385. package/lib/orchestrator/annotation-store.d.ts.map +1 -1
  386. package/lib/orchestrator/annotation-store.js +16 -2
  387. package/lib/orchestrator/annotation-store.js.map +1 -1
  388. package/lib/orchestrator/artifact-origin.d.ts +3 -0
  389. package/lib/orchestrator/artifact-origin.d.ts.map +1 -0
  390. package/lib/orchestrator/artifact-origin.js +40 -0
  391. package/lib/orchestrator/artifact-origin.js.map +1 -0
  392. package/lib/orchestrator/campaign-lifecycle.d.ts +1 -0
  393. package/lib/orchestrator/campaign-lifecycle.d.ts.map +1 -1
  394. package/lib/orchestrator/campaign-lifecycle.js +4 -1
  395. package/lib/orchestrator/campaign-lifecycle.js.map +1 -1
  396. package/lib/orchestrator/candidates.d.ts.map +1 -1
  397. package/lib/orchestrator/candidates.js +3 -2
  398. package/lib/orchestrator/candidates.js.map +1 -1
  399. package/lib/orchestrator/compare.d.ts +19 -3
  400. package/lib/orchestrator/compare.d.ts.map +1 -1
  401. package/lib/orchestrator/compare.js +32 -6
  402. package/lib/orchestrator/compare.js.map +1 -1
  403. package/lib/orchestrator/comparison-identity.d.ts.map +1 -1
  404. package/lib/orchestrator/comparison-identity.js +2 -0
  405. package/lib/orchestrator/comparison-identity.js.map +1 -1
  406. package/lib/orchestrator/config.d.ts +179 -1
  407. package/lib/orchestrator/config.d.ts.map +1 -1
  408. package/lib/orchestrator/config.js +18 -4
  409. package/lib/orchestrator/config.js.map +1 -1
  410. package/lib/orchestrator/discover.d.ts +1 -0
  411. package/lib/orchestrator/discover.d.ts.map +1 -1
  412. package/lib/orchestrator/discover.js +7 -1
  413. package/lib/orchestrator/discover.js.map +1 -1
  414. package/lib/orchestrator/doctor.d.ts +1 -0
  415. package/lib/orchestrator/doctor.d.ts.map +1 -1
  416. package/lib/orchestrator/doctor.js +121 -33
  417. package/lib/orchestrator/doctor.js.map +1 -1
  418. package/lib/orchestrator/driver-capabilities.d.ts +4 -0
  419. package/lib/orchestrator/driver-capabilities.d.ts.map +1 -0
  420. package/lib/orchestrator/driver-capabilities.js +13 -0
  421. package/lib/orchestrator/driver-capabilities.js.map +1 -0
  422. package/lib/orchestrator/driver-identity.d.ts +5 -0
  423. package/lib/orchestrator/driver-identity.d.ts.map +1 -0
  424. package/lib/orchestrator/driver-identity.js +51 -0
  425. package/lib/orchestrator/driver-identity.js.map +1 -0
  426. package/lib/orchestrator/experiment-context.d.ts +51 -3
  427. package/lib/orchestrator/experiment-context.d.ts.map +1 -1
  428. package/lib/orchestrator/experiment-context.js.map +1 -1
  429. package/lib/orchestrator/experiment-contracts.d.ts +30 -1
  430. package/lib/orchestrator/experiment-contracts.d.ts.map +1 -1
  431. package/lib/orchestrator/experiment-corpus.d.ts +2 -1
  432. package/lib/orchestrator/experiment-corpus.d.ts.map +1 -1
  433. package/lib/orchestrator/experiment-corpus.js +28 -22
  434. package/lib/orchestrator/experiment-corpus.js.map +1 -1
  435. package/lib/orchestrator/experiment-effects.d.ts +33 -0
  436. package/lib/orchestrator/experiment-effects.d.ts.map +1 -0
  437. package/lib/orchestrator/experiment-effects.js +44 -0
  438. package/lib/orchestrator/experiment-effects.js.map +1 -0
  439. package/lib/orchestrator/experiment-evaluation.d.ts.map +1 -1
  440. package/lib/orchestrator/experiment-evaluation.js +56 -5
  441. package/lib/orchestrator/experiment-evaluation.js.map +1 -1
  442. package/lib/orchestrator/experiment-identity.d.ts +3 -0
  443. package/lib/orchestrator/experiment-identity.d.ts.map +1 -1
  444. package/lib/orchestrator/experiment-identity.js +22 -33
  445. package/lib/orchestrator/experiment-identity.js.map +1 -1
  446. package/lib/orchestrator/experiment-loader.d.ts +8 -3
  447. package/lib/orchestrator/experiment-loader.d.ts.map +1 -1
  448. package/lib/orchestrator/experiment-preflight.d.ts +3 -0
  449. package/lib/orchestrator/experiment-preflight.d.ts.map +1 -0
  450. package/lib/orchestrator/experiment-preflight.js +21 -0
  451. package/lib/orchestrator/experiment-preflight.js.map +1 -0
  452. package/lib/orchestrator/experiment-report.d.ts +90 -1
  453. package/lib/orchestrator/experiment-report.d.ts.map +1 -1
  454. package/lib/orchestrator/experiment-report.js +9 -1
  455. package/lib/orchestrator/experiment-report.js.map +1 -1
  456. package/lib/orchestrator/experiment-runs.d.ts +61 -2
  457. package/lib/orchestrator/experiment-runs.d.ts.map +1 -1
  458. package/lib/orchestrator/experiment-runs.js +13 -5
  459. package/lib/orchestrator/experiment-runs.js.map +1 -1
  460. package/lib/orchestrator/experiment-runtime-identity.d.ts +0 -16
  461. package/lib/orchestrator/experiment-runtime-identity.d.ts.map +1 -1
  462. package/lib/orchestrator/experiment-runtime-identity.js +5 -220
  463. package/lib/orchestrator/experiment-runtime-identity.js.map +1 -1
  464. package/lib/orchestrator/experiment-selection.d.ts.map +1 -1
  465. package/lib/orchestrator/experiment-selection.js +52 -0
  466. package/lib/orchestrator/experiment-selection.js.map +1 -1
  467. package/lib/orchestrator/experiment.d.ts +3 -3
  468. package/lib/orchestrator/experiment.d.ts.map +1 -1
  469. package/lib/orchestrator/experiment.js +26 -21
  470. package/lib/orchestrator/experiment.js.map +1 -1
  471. package/lib/orchestrator/fixture-identity.d.ts +1 -0
  472. package/lib/orchestrator/fixture-identity.d.ts.map +1 -1
  473. package/lib/orchestrator/fixture-identity.js +6 -1
  474. package/lib/orchestrator/fixture-identity.js.map +1 -1
  475. package/lib/orchestrator/fs-read.d.ts +1 -6
  476. package/lib/orchestrator/fs-read.d.ts.map +1 -1
  477. package/lib/orchestrator/fs-read.js +2 -32
  478. package/lib/orchestrator/fs-read.js.map +1 -1
  479. package/lib/orchestrator/grader-experiment.d.ts +33 -3
  480. package/lib/orchestrator/grader-experiment.d.ts.map +1 -1
  481. package/lib/orchestrator/grader-experiment.js +54 -9
  482. package/lib/orchestrator/grader-experiment.js.map +1 -1
  483. package/lib/orchestrator/grading.d.ts +2 -1
  484. package/lib/orchestrator/grading.d.ts.map +1 -1
  485. package/lib/orchestrator/grading.js +46 -31
  486. package/lib/orchestrator/grading.js.map +1 -1
  487. package/lib/orchestrator/harness-catalog-drift.d.ts +22 -0
  488. package/lib/orchestrator/harness-catalog-drift.d.ts.map +1 -0
  489. package/lib/orchestrator/harness-catalog-drift.js +90 -0
  490. package/lib/orchestrator/harness-catalog-drift.js.map +1 -0
  491. package/lib/orchestrator/harness-registry.d.ts +4 -0
  492. package/lib/orchestrator/harness-registry.d.ts.map +1 -0
  493. package/lib/orchestrator/harness-registry.js +5 -0
  494. package/lib/orchestrator/harness-registry.js.map +1 -0
  495. package/lib/orchestrator/index.d.ts +1 -1
  496. package/lib/orchestrator/index.d.ts.map +1 -1
  497. package/lib/orchestrator/index.js +1 -1
  498. package/lib/orchestrator/index.js.map +1 -1
  499. package/lib/orchestrator/list-runs.d.ts +8 -1
  500. package/lib/orchestrator/list-runs.d.ts.map +1 -1
  501. package/lib/orchestrator/list-runs.js +81 -14
  502. package/lib/orchestrator/list-runs.js.map +1 -1
  503. package/lib/orchestrator/optimization-lifecycle.d.ts.map +1 -1
  504. package/lib/orchestrator/optimization-lifecycle.js +3 -1
  505. package/lib/orchestrator/optimization-lifecycle.js.map +1 -1
  506. package/lib/orchestrator/orchestrator.d.ts +18 -2
  507. package/lib/orchestrator/orchestrator.d.ts.map +1 -1
  508. package/lib/orchestrator/orchestrator.js +50 -168
  509. package/lib/orchestrator/orchestrator.js.map +1 -1
  510. package/lib/orchestrator/paired-effects.d.ts +34 -0
  511. package/lib/orchestrator/paired-effects.d.ts.map +1 -0
  512. package/lib/orchestrator/paired-effects.js +158 -0
  513. package/lib/orchestrator/paired-effects.js.map +1 -0
  514. package/lib/orchestrator/provenance.d.ts +5 -1
  515. package/lib/orchestrator/provenance.d.ts.map +1 -1
  516. package/lib/orchestrator/provenance.js +16 -3
  517. package/lib/orchestrator/provenance.js.map +1 -1
  518. package/lib/orchestrator/regrade.d.ts +9 -1
  519. package/lib/orchestrator/regrade.d.ts.map +1 -1
  520. package/lib/orchestrator/rubric-loader.js +1 -1
  521. package/lib/orchestrator/rubric-loader.js.map +1 -1
  522. package/lib/orchestrator/run-dir.d.ts +2 -0
  523. package/lib/orchestrator/run-dir.d.ts.map +1 -1
  524. package/lib/orchestrator/run-dir.js +1 -1
  525. package/lib/orchestrator/run-dir.js.map +1 -1
  526. package/lib/orchestrator/run-execution.d.ts +3 -0
  527. package/lib/orchestrator/run-execution.d.ts.map +1 -1
  528. package/lib/orchestrator/run-execution.js +66 -12
  529. package/lib/orchestrator/run-execution.js.map +1 -1
  530. package/lib/orchestrator/run-lifecycle.d.ts +1 -0
  531. package/lib/orchestrator/run-lifecycle.d.ts.map +1 -1
  532. package/lib/orchestrator/run-lifecycle.js +3 -2
  533. package/lib/orchestrator/run-lifecycle.js.map +1 -1
  534. package/lib/orchestrator/run-workspace.d.ts +10 -0
  535. package/lib/orchestrator/run-workspace.d.ts.map +1 -0
  536. package/lib/orchestrator/run-workspace.js +58 -0
  537. package/lib/orchestrator/run-workspace.js.map +1 -0
  538. package/lib/orchestrator/suite-compare.d.ts +37 -0
  539. package/lib/orchestrator/suite-compare.d.ts.map +1 -1
  540. package/lib/orchestrator/suite-compare.js +27 -17
  541. package/lib/orchestrator/suite-compare.js.map +1 -1
  542. package/lib/orchestrator/suite-runs.d.ts +6 -1
  543. package/lib/orchestrator/suite-runs.d.ts.map +1 -1
  544. package/lib/orchestrator/suite-runs.js +14 -2
  545. package/lib/orchestrator/suite-runs.js.map +1 -1
  546. package/lib/orchestrator/suite-summary.d.ts +77 -0
  547. package/lib/orchestrator/suite-summary.d.ts.map +1 -1
  548. package/lib/orchestrator/suite-summary.js +61 -12
  549. package/lib/orchestrator/suite-summary.js.map +1 -1
  550. package/lib/previewer/artifacts.d.ts +25 -0
  551. package/lib/previewer/artifacts.d.ts.map +1 -0
  552. package/lib/previewer/artifacts.js +180 -0
  553. package/lib/previewer/artifacts.js.map +1 -0
  554. package/lib/previewer/server.d.ts +111 -0
  555. package/lib/previewer/server.d.ts.map +1 -0
  556. package/lib/previewer/server.js +558 -0
  557. package/lib/previewer/server.js.map +1 -0
  558. package/package.json +3 -3
  559. package/skills/lux-answerer/SKILL.md +2 -2
  560. package/src/answerers/claude-code/index.ts +6 -5
  561. package/src/answerers/persona/index.ts +75 -34
  562. package/src/answerers/terminal/index.ts +8 -12
  563. package/src/assertions/authoring.ts +2 -0
  564. package/src/assertions/core/command-exits-zero.ts +61 -7
  565. package/src/assertions/core/event-checks.ts +64 -3
  566. package/src/assertions/core/helpers.ts +3 -6
  567. package/src/assertions/core/index.ts +2 -0
  568. package/src/assertions/core/resource-checks.ts +38 -5
  569. package/src/assertions/rubric/index.ts +68 -13
  570. package/src/assertions/rubric/internal.ts +227 -27
  571. package/src/authoring.ts +345 -2
  572. package/src/cli/bin.ts +2 -12
  573. package/src/cli/command-runtime.ts +20 -9
  574. package/src/cli/doctor.ts +17 -0
  575. package/src/cli/harness-plan.ts +117 -0
  576. package/src/cli/init-templates.ts +238 -0
  577. package/src/cli/init.ts +53 -184
  578. package/src/cli/output-schemas.ts +106 -0
  579. package/src/cli/program.ts +691 -721
  580. package/src/cli/render/reporter.ts +50 -8
  581. package/src/cli/run-options.ts +132 -25
  582. package/src/cli/view.ts +129 -0
  583. package/src/container/driver.ts +211 -0
  584. package/src/container/protocol.ts +48 -0
  585. package/src/container/resources.ts +153 -0
  586. package/src/container/worker.ts +107 -0
  587. package/src/core/action-events.ts +59 -0
  588. package/src/core/agent-activity.ts +236 -0
  589. package/src/core/agent-environment.ts +64 -0
  590. package/src/core/agent-events.ts +17 -0
  591. package/src/core/annotation.ts +2 -1
  592. package/src/core/answerer.ts +9 -0
  593. package/src/core/artifact-evidence.ts +47 -4
  594. package/src/core/assertion.ts +21 -1
  595. package/src/core/case.ts +21 -3
  596. package/src/core/command-verification.ts +74 -0
  597. package/src/core/driver-execution.ts +84 -0
  598. package/src/core/driver-metrics.ts +51 -0
  599. package/src/core/driver.ts +76 -0
  600. package/src/core/duration.ts +52 -0
  601. package/src/core/environment.ts +22 -0
  602. package/src/core/evaluation-clusters.ts +35 -0
  603. package/src/core/events.ts +14 -2
  604. package/src/core/experiment.ts +64 -24
  605. package/src/core/file-tree.ts +35 -0
  606. package/src/core/global-id.ts +26 -0
  607. package/src/core/harness-catalog.ts +100 -0
  608. package/src/core/harness-catalogs/antigravity.ts +24 -0
  609. package/src/core/harness-catalogs/claude-code.ts +25 -0
  610. package/src/core/harness-catalogs/codex.ts +27 -0
  611. package/src/core/harness-catalogs/copilot.ts +46 -0
  612. package/src/core/harness-catalogs/cursor.ts +13 -0
  613. package/src/core/harness-catalogs/grok-build.ts +19 -0
  614. package/src/core/harness-catalogs/index.ts +31 -0
  615. package/src/core/harness-matrix.ts +316 -0
  616. package/src/core/index.ts +12 -0
  617. package/src/core/lifecycle-fixtures.ts +4 -2
  618. package/src/core/model-cli.ts +52 -23
  619. package/src/core/platform-process.ts +58 -10
  620. package/src/core/run.ts +31 -0
  621. package/src/core/usage.ts +8 -0
  622. package/src/core/wire.ts +5 -1
  623. package/src/drivers/antigravity/README.md +171 -0
  624. package/src/drivers/antigravity/artifacts.ts +37 -0
  625. package/src/drivers/antigravity/config.ts +92 -0
  626. package/src/drivers/antigravity/events.ts +290 -0
  627. package/src/drivers/antigravity/index.ts +132 -0
  628. package/src/drivers/antigravity/runtime.ts +94 -0
  629. package/src/drivers/claude-code/deferred-process.ts +118 -0
  630. package/src/drivers/claude-code/index.ts +216 -281
  631. package/src/drivers/claude-code/isolation.ts +228 -0
  632. package/src/drivers/claude-code/parse-events.ts +98 -12
  633. package/src/drivers/codex/app-events.ts +126 -16
  634. package/src/drivers/codex/config.ts +50 -8
  635. package/src/drivers/codex/exec-events.ts +258 -0
  636. package/src/drivers/codex/index.ts +144 -312
  637. package/src/drivers/copilot/README.md +60 -0
  638. package/src/drivers/copilot/config.ts +61 -0
  639. package/src/drivers/copilot/index.ts +310 -0
  640. package/src/drivers/cursor/README.md +66 -0
  641. package/src/drivers/cursor/config.ts +31 -0
  642. package/src/drivers/cursor/index.ts +326 -0
  643. package/src/drivers/cursor/interaction.ts +74 -0
  644. package/src/drivers/grok-build/README.md +112 -0
  645. package/src/drivers/grok-build/config.ts +43 -0
  646. package/src/drivers/grok-build/index.ts +331 -0
  647. package/src/drivers/mcp/index.ts +25 -11
  648. package/src/drivers/shared/acp-events.ts +94 -0
  649. package/src/drivers/shared/acp-interaction.ts +27 -0
  650. package/src/drivers/shared/acp-session.ts +40 -0
  651. package/src/drivers/shared/acp-transport.ts +187 -0
  652. package/src/drivers/shared/artifacts.ts +6 -2
  653. package/src/drivers/shared/experiment-behavior.ts +214 -0
  654. package/src/drivers/shared/experiment-policy.ts +195 -0
  655. package/src/drivers/subprocess/index.ts +55 -12
  656. package/src/index.ts +115 -10
  657. package/src/optimization/reflective.ts +3 -2
  658. package/src/orchestrator/annotation-loader.ts +10 -0
  659. package/src/orchestrator/annotation-store.ts +24 -3
  660. package/src/orchestrator/artifact-origin.ts +50 -0
  661. package/src/orchestrator/campaign-lifecycle.ts +5 -1
  662. package/src/orchestrator/candidates.ts +3 -2
  663. package/src/orchestrator/compare.ts +41 -6
  664. package/src/orchestrator/comparison-identity.ts +2 -0
  665. package/src/orchestrator/config.ts +20 -3
  666. package/src/orchestrator/discover.ts +8 -1
  667. package/src/orchestrator/doctor.ts +189 -28
  668. package/src/orchestrator/driver-capabilities.ts +21 -0
  669. package/src/orchestrator/driver-identity.ts +69 -0
  670. package/src/orchestrator/experiment-context.ts +3 -2
  671. package/src/orchestrator/experiment-corpus.ts +53 -37
  672. package/src/orchestrator/experiment-effects.ts +61 -0
  673. package/src/orchestrator/experiment-evaluation.ts +71 -10
  674. package/src/orchestrator/experiment-identity.ts +42 -48
  675. package/src/orchestrator/experiment-preflight.ts +27 -0
  676. package/src/orchestrator/experiment-report.ts +21 -1
  677. package/src/orchestrator/experiment-runs.ts +11 -4
  678. package/src/orchestrator/experiment-runtime-identity.ts +5 -243
  679. package/src/orchestrator/experiment-selection.ts +77 -0
  680. package/src/orchestrator/experiment.ts +29 -29
  681. package/src/orchestrator/fixture-identity.ts +9 -1
  682. package/src/orchestrator/fs-read.ts +2 -32
  683. package/src/orchestrator/grader-experiment.ts +74 -13
  684. package/src/orchestrator/grading.ts +67 -28
  685. package/src/orchestrator/harness-catalog-drift.ts +132 -0
  686. package/src/orchestrator/harness-registry.ts +12 -0
  687. package/src/orchestrator/index.ts +1 -0
  688. package/src/orchestrator/list-runs.ts +98 -13
  689. package/src/orchestrator/optimization-lifecycle.ts +4 -1
  690. package/src/orchestrator/orchestrator.ts +92 -216
  691. package/src/orchestrator/paired-effects.ts +209 -0
  692. package/src/orchestrator/provenance.ts +23 -3
  693. package/src/orchestrator/rubric-loader.ts +1 -1
  694. package/src/orchestrator/run-dir.ts +8 -1
  695. package/src/orchestrator/run-execution.ts +77 -11
  696. package/src/orchestrator/run-lifecycle.ts +4 -2
  697. package/src/orchestrator/run-workspace.ts +62 -0
  698. package/src/orchestrator/suite-compare.ts +29 -19
  699. package/src/orchestrator/suite-runs.ts +13 -2
  700. package/src/orchestrator/suite-summary.ts +122 -13
  701. package/src/previewer/artifacts.ts +221 -0
  702. package/src/previewer/server.ts +787 -0
  703. package/viewer/app.css +2079 -0
  704. package/viewer/app.js +627 -0
  705. package/viewer/artifact-view.js +48 -0
  706. package/viewer/charts.js +86 -0
  707. package/viewer/detail.js +1237 -0
  708. package/viewer/format.js +129 -0
  709. package/viewer/index.html +151 -0
  710. package/lib/answerers/scripted/index.d.ts +0 -8
  711. package/lib/answerers/scripted/index.d.ts.map +0 -1
  712. package/lib/answerers/scripted/index.js +0 -163
  713. package/lib/answerers/scripted/index.js.map +0 -1
  714. package/lib/cli/skills.d.ts +0 -38
  715. package/lib/cli/skills.d.ts.map +0 -1
  716. package/lib/cli/skills.js +0 -84
  717. package/lib/cli/skills.js.map +0 -1
  718. package/lib/drivers/shared/secure-copy.d.ts.map +0 -1
  719. package/lib/drivers/shared/secure-copy.js.map +0 -1
  720. package/skills/lux/SKILL.md +0 -85
  721. package/skills/lux/references/cli.md +0 -102
  722. package/skills/lux/references/eval-authoring.md +0 -105
  723. package/src/answerers/scripted/index.ts +0 -186
  724. package/src/cli/skills.ts +0 -129
  725. /package/lib/{drivers/shared → core}/secure-copy.d.ts +0 -0
  726. /package/lib/{drivers/shared → core}/secure-copy.js +0 -0
  727. /package/src/{drivers/shared → core}/secure-copy.ts +0 -0
@@ -1,118 +1,376 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
1
53
  import { randomUUID } from "node:crypto";
2
54
  import { existsSync } from "node:fs";
3
55
  import { lstat, mkdir, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
4
56
  import { createRequire } from "node:module";
5
- import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
6
- import { Command, InvalidArgumentError } from "commander";
7
- import { createRubricAssertion } from "../assertions/rubric/index.js";
8
- import { GraderAnnotationSchema, matchesAnyGlob, valueHash, } from "../core/index.js";
9
- import { applyCandidate, buildRegistryFromConfig, compareRuns, compareSuiteRuns, discoverCases, doctorProject, experimentCampaignMode, formatComparisonText, formatDoctorReport, formatExperimentDecisionMarkdown, formatExperimentRun, formatExperimentRunsTable, formatRunDetail, formatRunsTable, formatSuiteComparisonText, formatSuiteRunDetail, formatSuiteRunsTable, hasRegression, hasSuiteRegression, isExperimentRun, listExperimentRuns, listRuns, listSuiteRuns, loadEvalCase, loadExperimentCampaign, loadExperimentRun, loadFrozenRegradableRun, loadLuxConfig, loadRubricDefinition, loadRunDetail, loadSuiteRun, loadVerifiedExperimentDecisionSnapshot, Orchestrator, optimizeExperimentCampaign, planExperimentCampaign, regradeRun, releaseFrozenRegradableRun, resolveExperimentCampaignPath, runExperimentCampaign, selectCases, upsertGraderAnnotation, verifyExperimentDecisionIntegrity, verifyExperimentRunIntegrity, } from "../orchestrator/index.js";
57
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
58
+ import { fileURLToPath } from "node:url";
59
+ import { Cli, Errors, z } from "incur";
60
+ import { GraderAnnotationSchema, matchesAnyGlob, ReasoningEffortSchema, valueHash, } from "../core/index.js";
61
+ import { registryWithHarness } from "../orchestrator/harness-registry.js";
62
+ import { applyCandidate, buildRegistryFromConfig, compareRuns, compareSuiteRuns, DoctorReportSchema, discoverCases, ExperimentCampaignPlanSchema, ExperimentDecisionReportSchema, ExperimentRunSchema, experimentCampaignMode, formatComparisonText, formatExperimentDecisionMarkdown, formatSuiteComparisonText, GradingSnapshotSchema, hasRegression, hasSuiteRegression, loadEvalCase, loadExperimentCampaign, loadExperimentRun, loadFrozenRegradableRun, loadLuxConfig, loadRubricDefinition, loadSuiteRun, loadVerifiedExperimentDecisionSnapshot, Orchestrator, optimizeExperimentCampaign, planExperimentCampaign, regradeRun, releaseFrozenRegradableRun, resolveExperimentCampaignPath, runExperimentCampaign, upsertGraderAnnotation, verifyExperimentDecisionIntegrity, verifyExperimentRunIntegrity, } from "../orchestrator/index.js";
10
63
  import { abortOnInterrupt, ensureDirectory, failWith, relativePathWithin, } from "./command-runtime.js";
11
- import { formatInitReport, initProject } from "./init.js";
64
+ import { doctorCommand } from "./doctor.js";
65
+ import { initProject } from "./init.js";
66
+ import { CompareOutputSchema, ViewOutputSchema } from "./output-schemas.js";
12
67
  import { ConsoleReporter } from "./render/reporter.js";
13
- import { collectTags, collectValues, parseAnnotationAssertion, parsePositiveInt, parseUnitInterval, resolveAnswererOverride, resolveConcurrency, } from "./run-options.js";
14
- import { formatSkillsInstall, formatSkillsList, installSkills, } from "./skills.js";
68
+ import { expandLoop, parseAnnotationAssertion, partitionFilters, planSuiteItems, resolveAnswererOverride, resolveConcurrency, selectSuite, suiteTitle, } from "./run-options.js";
69
+ import { viewCommand, webViewCommand } from "./view.js";
15
70
  const requireFromHere = createRequire(import.meta.url);
16
71
  // From lib/cli/program.js (or src/cli/program.ts under test) to the package root.
17
72
  const PKG_VERSION = requireFromHere("../../package.json").version;
18
- const registerProjectCommands = (program) => {
19
- program
20
- .command("init")
21
- .description("scaffold a new evals project in the current directory")
22
- .option("--force", "overwrite existing files")
23
- .option("--experiment", "also scaffold a prompt optimization campaign and split cases")
24
- .action(async (options) => {
25
- const cwd = process.cwd();
26
- const result = await initProject({
27
- cwd,
28
- force: options.force ?? false,
29
- experiment: options.experiment ?? false,
73
+ const nonEmptyString = z.string().min(1);
74
+ const positiveInteger = z.coerce.number().int().positive();
75
+ const unitInterval = z.coerce.number().min(0).max(1);
76
+ const tagList = z
77
+ .array(nonEmptyString)
78
+ .default([])
79
+ .describe("Repeatable list; each value may be comma-separated");
80
+ const normalizeTags = (values) => values.flatMap((value) => value.split(",").map((tag) => tag.trim())).filter(Boolean);
81
+ const initOutput = z.object({
82
+ created: z.array(z.string()),
83
+ updated: z.array(z.string()),
84
+ skipped: z.array(z.object({ path: z.string(), reason: z.string() })),
85
+ experiment: z.boolean(),
86
+ });
87
+ const runOutput = z.union([
88
+ z.object({
89
+ caseCount: z.number().int(),
90
+ cases: z.array(z.object({
91
+ path: z.string(),
92
+ id: z.string(),
93
+ caseId: z.string().optional(),
94
+ permutationId: z.string().optional(),
95
+ })),
96
+ }),
97
+ z.object({
98
+ caseCount: z.number().int(),
99
+ tags: z.array(z.object({ tag: z.string(), count: z.number().int() })),
100
+ }),
101
+ z.object({
102
+ suiteDir: z.string(),
103
+ results: z.array(z.object({
104
+ caseId: z.string(),
105
+ runDir: z.string().nullable(),
106
+ exitReason: z.string(),
107
+ casePassed: z.boolean().nullable(),
108
+ caseScore: z.number().nullable(),
109
+ assertionsPassed: z.number().int(),
110
+ assertionsTotal: z.number().int(),
111
+ })),
112
+ }),
113
+ ]);
114
+ const experimentOutput = z.union([
115
+ ExperimentCampaignPlanSchema,
116
+ ExperimentRunSchema.extend({ experimentDir: z.string() }),
117
+ ]);
118
+ const gradingOutput = GradingSnapshotSchema.extend({ gradingPath: z.string() });
119
+ const reportOutput = z.union([
120
+ ExperimentDecisionReportSchema,
121
+ z.object({ path: z.string(), report: ExperimentDecisionReportSchema }),
122
+ ]);
123
+ const campaignArgs = z.object({ campaign: nonEmptyString.describe("Experiment campaign path") });
124
+ const campaignOptions = z.object({
125
+ runsRoot: nonEmptyString.optional().describe("Run directory root overriding lux.config.ts"),
126
+ resume: nonEmptyString.optional().describe("Interrupted experiment directory to resume"),
127
+ plan: z.boolean().optional().describe("Validate and estimate without calling models"),
128
+ });
129
+ export const buildCli = () => Cli.create("lux", {
130
+ description: "Coding-agent evaluation and improvement with deterministic assertions and human-in-the-loop runs",
131
+ version: PKG_VERSION,
132
+ sync: {
133
+ include: [fileURLToPath(new URL("../../skills/*", import.meta.url))],
134
+ depth: 2,
135
+ suggestions: [
136
+ "Use Lux to inspect the eval cases in this project",
137
+ "Use Lux to diagnose the latest failed eval run",
138
+ "Use Lux to plan an evidence-based improvement experiment",
139
+ ],
140
+ },
141
+ mcp: {
142
+ title: "Lux coding-agent evaluation",
143
+ instructions: "Inspect and plan before running model-spending commands. Apply only a verified promoted experiment champion.",
144
+ },
145
+ })
146
+ .command("init", {
147
+ description: "Scaffold a new eval project in the current directory",
148
+ options: z.object({
149
+ force: z.boolean().optional().describe("Overwrite existing files"),
150
+ experiment: z.boolean().optional().describe("Also scaffold an optimization campaign"),
151
+ driver: z
152
+ .enum([
153
+ "subprocess",
154
+ "claude-code",
155
+ "codex",
156
+ "cursor",
157
+ "copilot",
158
+ "antigravity",
159
+ "grok-build",
160
+ ])
161
+ .optional()
162
+ .describe("Starter driver (default: deterministic subprocess)"),
163
+ model: nonEmptyString.optional().describe("Explicit subject model; required for Cursor"),
164
+ }),
165
+ output: initOutput,
166
+ destructive: true,
167
+ mcp: { annotations: { destructiveHint: true, openWorldHint: false } },
168
+ examples: [
169
+ { description: "Scaffold a basic eval project" },
170
+ { options: { experiment: true }, description: "Scaffold an optimization project" },
171
+ ],
172
+ run: async (c) => c.ok(await initCommand(c.options), { cta: { commands: ["doctor", "run --list"] } }),
173
+ })
174
+ .command("doctor", {
175
+ description: "Preflight project configuration, CLIs, cases, campaigns, and budgets",
176
+ args: z.object({ campaigns: z.array(z.string()).default([]).describe("Campaign paths") }),
177
+ options: z.object({
178
+ static: z
179
+ .boolean()
180
+ .optional()
181
+ .describe("Validate project files without checking installed executables (for CI)"),
182
+ }),
183
+ output: DoctorReportSchema,
184
+ mcp: {
185
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
186
+ },
187
+ run: async (c) => c.ok(await doctorCommand(c.args.campaigns, c.options), {
188
+ cta: { commands: ["run --list"] },
189
+ }),
190
+ })
191
+ .command("run", {
192
+ description: "Discover and run cases, filtered by name, path, or tag",
193
+ args: z.object({ filters: z.array(z.string()).default([]).describe("Case names or paths") }),
194
+ options: z.object({
195
+ tag: tagList.describe("Required case tag; repeatable and comma-separated"),
196
+ loop: positiveInteger.optional().describe("Run each matched eval this many times"),
197
+ concurrency: positiveInteger.optional().describe("Maximum cases running concurrently"),
198
+ list: z.boolean().optional().describe("List matching cases without running"),
199
+ listTags: z.boolean().optional().describe("List tags across matching cases"),
200
+ interactive: z.boolean().optional().describe("Answer agent questions in this terminal"),
201
+ claudeAnswerer: z.boolean().optional().describe("Use Claude Code as the answerer"),
202
+ skipJudge: z.boolean().optional().describe("Skip rubric LLM judge assertions"),
203
+ runsRoot: nonEmptyString.optional().describe("Run directory root"),
204
+ profile: nonEmptyString.optional().describe("Named driver and answerer profile"),
205
+ driver: nonEmptyString
206
+ .optional()
207
+ .describe("Focus on one harness driver, replacing the matrix"),
208
+ model: nonEmptyString.optional().describe("Focus on one subject model"),
209
+ effort: ReasoningEffortSchema.optional().describe("Focus on one reasoning effort"),
210
+ subjectRoot: nonEmptyString.optional().describe("Root bound into subjectPath values"),
211
+ verbose: z.boolean().optional().describe("Include phase timings and run directories"),
212
+ }),
213
+ alias: { tag: "t", concurrency: "j", interactive: "i", verbose: "v" },
214
+ output: runOutput,
215
+ outputPolicy: "agent-only",
216
+ mcp: { annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true } },
217
+ examples: [
218
+ { options: { list: true, tag: [] }, description: "List all discovered cases" },
219
+ {
220
+ args: { filters: ["smoke"] },
221
+ options: { tag: [] },
222
+ description: "Run matching cases",
223
+ },
224
+ {
225
+ args: { filters: ["smoke"] },
226
+ options: { tag: [], driver: "codex", model: "gpt-5.6-luna", effort: "low" },
227
+ description: "Focus on one harness permutation",
228
+ },
229
+ ],
230
+ run: async (c) => {
231
+ const result = await runCommand(c.args.filters, c.options, !c.agent);
232
+ const suiteDir = "suiteDir" in result ? result.suiteDir : undefined;
233
+ return c.ok(result, {
234
+ cta: {
235
+ description: "Inspect saved results:",
236
+ commands: suiteDir ? [{ command: "view", args: { runDir: suiteDir } }] : [],
237
+ },
30
238
  });
31
- process.stdout.write(`${formatInitReport(result, cwd)}\n`);
32
- });
33
- const skills = program.command("skills").description("manage bundled agent skills");
34
- skills
35
- .command("list")
36
- .description("list bundled skills and supported platforms")
37
- .action(() => {
38
- process.stdout.write(`${formatSkillsList()}\n`);
39
- });
40
- skills
41
- .command("install")
42
- .description("install the Lux eval-authoring skill for Claude Code or Codex")
43
- .argument("<platform>", "claude, codex, or all")
44
- .option("--project", "install into the current project instead of the user profile")
45
- .option("--dir <path>", "install under an explicit skills directory")
46
- .option("--name <name>", "install one bundled skill")
47
- .action(async (platform, options) => {
48
- if (!["claude", "claude-code", "codex", "all"].includes(platform)) {
49
- throw new InvalidArgumentError("platform must be claude, codex, or all");
50
- }
51
- if (options.name && !["lux", "lux-answerer"].includes(options.name)) {
52
- throw new InvalidArgumentError("skill name must be lux or lux-answerer");
53
- }
54
- const cwd = process.cwd();
55
- const installed = await installSkills({
56
- cwd,
57
- platform: platform,
58
- project: options.project ?? false,
59
- ...(options.dir ? { dir: options.dir } : {}),
60
- ...(options.name ? { name: options.name } : {}),
61
- });
62
- process.stdout.write(`${formatSkillsInstall(installed, cwd)}\n`);
63
- });
64
- };
65
- const registerExperimentCommands = (program) => {
66
- program
67
- .command("doctor [campaigns...]")
68
- .description("preflight project configuration, CLIs, cases, campaigns, and budgets")
69
- .option("--json", "emit machine-readable JSON")
70
- .action(async (campaigns, options) => {
71
- const report = await doctorProject({ cwd: process.cwd(), campaigns });
72
- process.stdout.write(options.json ? `${JSON.stringify(report, null, 2)}\n` : `${formatDoctorReport(report)}\n`);
73
- if (!report.ok)
74
- failWith(1);
75
- });
76
- program
77
- .command("run [filters...]", { isDefault: true })
78
- .description("discover and run cases; filter by name/path substring or --tag")
79
- .option("-t, --tag <tag>", "only cases whose meta.tags include this tag (repeatable, comma-separated)", collectTags, [])
80
- .option("--loop <n>", "run each matched eval n times", parsePositiveInt)
81
- .option("-j, --concurrency <n>", "run up to n cases at once (overrides lux.config.ts)", parsePositiveInt)
82
- .option("--list", "print the matched cases and exit without running them")
83
- .option("--list-tags", "print the tags across the matched cases and exit")
84
- .option("-i, --interactive", "answer agent questions yourself in this terminal (HITL)")
85
- .option("--claude-answerer", "delegate questions through the Claude plugin's lux-answerer skill")
86
- .option("--runs-root <path>", "run-dir root (overrides lux.config.ts)")
87
- .option("--profile <id>", "named driver/answerer profile from lux.config.ts")
88
- .option("--subject-root <path>", "root bound into subjectPath() values")
89
- .option("-v, --verbose", "add phase timings and the run dir to every case")
90
- .action(async (filters, options) => {
91
- await runCommand(filters, options);
92
- });
93
- program
94
- .command("experiment <campaign>")
95
- .description("evaluate controlled source variants across cases and model profiles")
96
- .option("--runs-root <path>", "run-dir root (overrides lux.config.ts)")
97
- .option("--resume <experiment-dir>", "resume an interrupted experiment ledger")
98
- .option("--plan", "validate and estimate the campaign without calling models")
99
- .option("--json", "emit machine-readable JSON")
100
- .action(async (campaign, options) => {
101
- await experimentCommand("experiment", campaign, options);
102
- });
103
- };
104
- const registerCandidateCommands = (program) => {
105
- program
106
- .command("grade <runDir>")
107
- .description("re-run current graders against a persisted run without rerunning the agent")
108
- .option("--case <path>", "grade with a current case definition instead of frozen case.json")
109
- .option("--json", "emit machine-readable JSON")
110
- .action(async (runDir, options) => {
239
+ },
240
+ })
241
+ .command("experiment", {
242
+ description: "Evaluate controlled source variants across cases and model profiles",
243
+ args: campaignArgs,
244
+ options: campaignOptions,
245
+ output: experimentOutput,
246
+ mcp: { annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true } },
247
+ run: async (c) => experimentCommand("experiment", c.args.campaign, c.options),
248
+ })
249
+ .command("optimize", {
250
+ description: "Evolve candidates from grading feedback and promote on held-out cases",
251
+ args: campaignArgs,
252
+ options: campaignOptions,
253
+ output: experimentOutput,
254
+ destructive: true,
255
+ mcp: { annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: true } },
256
+ run: async (c) => experimentCommand("optimize", c.args.campaign, c.options),
257
+ })
258
+ .command("grade", {
259
+ description: "Re-run current graders against a persisted run",
260
+ args: z.object({ runDir: nonEmptyString.describe("Persisted run directory") }),
261
+ options: z.object({ case: nonEmptyString.optional().describe("Current case definition") }),
262
+ output: gradingOutput,
263
+ mcp: { annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true } },
264
+ run: async (c) => gradeCommand(c.args.runDir, c.options),
265
+ })
266
+ .command("annotate", {
267
+ description: "Add or update a human grader-alignment label",
268
+ args: z.object({ runDir: nonEmptyString.describe("Persisted run directory") }),
269
+ options: z.object({
270
+ out: nonEmptyString.describe("JSON annotation dataset to create or update"),
271
+ rubric: nonEmptyString.describe("Candidate-relative declarative rubric path"),
272
+ id: nonEmptyString.optional().describe("Stable annotation ID"),
273
+ label: z.enum(["pass", "fail"]).optional().describe("Expected overall verdict"),
274
+ score: unitInterval.optional().describe("Expected score from zero to one"),
275
+ assertion: z
276
+ .array(nonEmptyString)
277
+ .default([])
278
+ .describe("Assertion label id=pass|fail[:score]"),
279
+ split: z.enum(["train", "validation", "test"]).optional().describe("Dataset split"),
280
+ tag: tagList.describe("Selection tag; repeatable and comma-separated"),
281
+ feedback: nonEmptyString.optional().describe("Human rationale for mismatches"),
282
+ annotator: nonEmptyString.optional().describe("Label author"),
283
+ reviewer: nonEmptyString.optional().describe("Independent reviewer"),
284
+ source: z.enum(["human", "synthetic"]).default("human").describe("Label provenance"),
285
+ }),
286
+ output: z.object({ id: z.string(), path: z.string(), labels: z.number().int() }),
287
+ destructive: true,
288
+ mcp: {
289
+ annotations: {
290
+ readOnlyHint: false,
291
+ destructiveHint: false,
292
+ idempotentHint: true,
293
+ openWorldHint: false,
294
+ },
295
+ },
296
+ run: async (c) => annotateCommand(c.args.runDir, c.options),
297
+ })
298
+ .command("apply", {
299
+ description: "Apply the verified promoted experiment champion",
300
+ args: z.object({
301
+ experimentDir: nonEmptyString.describe("Experiment directory"),
302
+ candidateId: nonEmptyString.optional().describe("Expected promoted candidate ID"),
303
+ }),
304
+ output: z.object({
305
+ candidateId: z.string(),
306
+ subjectRoot: z.string(),
307
+ sourceBytes: z.number(),
308
+ }),
309
+ destructive: true,
310
+ mcp: {
311
+ annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
312
+ },
313
+ run: async (c) => applyCommand(c.args.experimentDir, c.args.candidateId),
314
+ })
315
+ .command("report", {
316
+ description: "Render a PR-ready report from a verified experiment record",
317
+ args: z.object({ experimentDir: nonEmptyString.describe("Experiment directory") }),
318
+ options: z.object({
319
+ out: nonEmptyString.optional().describe("Write Markdown to this path"),
320
+ force: z.boolean().optional().describe("Overwrite an existing output file"),
321
+ }),
322
+ output: reportOutput,
323
+ mcp: { annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false } },
324
+ run: async (c) => reportCommand(c.args.experimentDir, c.options),
325
+ })
326
+ .command("view", {
327
+ description: "List past runs or show one run in detail",
328
+ args: z.object({ runDir: nonEmptyString.optional().describe("Run or suite directory") }),
329
+ options: z.object({
330
+ runsRoot: nonEmptyString.optional().describe("Run directory root"),
331
+ case: nonEmptyString.optional().describe("Filter lists to one case slug"),
332
+ suites: z.boolean().optional().describe("List logical suite runs"),
333
+ experiments: z.boolean().optional().describe("List experiment runs"),
334
+ web: z.boolean().optional().describe("Open the Lux Review web app"),
335
+ port: z.coerce.number().int().min(0).max(65535).optional().describe("Review server port"),
336
+ open: z.boolean().default(true).describe("Open a browser in web mode"),
337
+ }),
338
+ output: ViewOutputSchema,
339
+ mcp: { annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false } },
340
+ run: (c) => {
341
+ if (c.options.web) {
342
+ if (c.formatExplicit && c.format !== "jsonl") {
343
+ throw new Errors.ParseError({
344
+ message: "--web requires streaming output; omit --format or use --format jsonl",
345
+ });
346
+ }
347
+ return webViewCommand(c.args.runDir, c.options);
348
+ }
349
+ return viewCommand(c.args.runDir, c.options).then((result) => ViewOutputSchema.parse(result));
350
+ },
351
+ })
352
+ .command("compare", {
353
+ description: "Diff two run or suite directories and fail on regression",
354
+ args: z.object({
355
+ runA: nonEmptyString.describe("Baseline run"),
356
+ runB: nonEmptyString.describe("Current run"),
357
+ }),
358
+ options: z.object({
359
+ passRateTolerance: unitInterval.optional().describe("Allowed per-case pass-rate decrease"),
360
+ }),
361
+ output: CompareOutputSchema,
362
+ mcp: { annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false } },
363
+ run: async (c) => CompareOutputSchema.parse(await compareCommand(c.args.runA, c.args.runB, c.options)),
364
+ });
365
+ const initCommand = async (options) => initProject({ cwd: process.cwd(), ...options });
366
+ const gradeCommand = async (runDir, options) => {
367
+ const env_1 = { stack: [], error: void 0, hasError: false };
368
+ try {
111
369
  const directory = resolve(runDir);
112
370
  if (!(await ensureDirectory("grade", directory)))
113
- return;
371
+ failWith(1);
114
372
  const config = await loadLuxConfig(process.cwd());
115
- const controller = abortOnInterrupt();
373
+ const controller = __addDisposableResource(env_1, abortOnInterrupt(), false);
116
374
  const result = await regradeRun({
117
375
  runDir: directory,
118
376
  registry: buildRegistryFromConfig(config),
@@ -120,333 +378,217 @@ const registerCandidateCommands = (program) => {
120
378
  ...(options.case ? { case: await loadEvalCase(resolve(options.case)) } : {}),
121
379
  abortSignal: controller.signal,
122
380
  });
123
- const report = result.snapshot.report;
124
- let gradingStatus = "ungraded";
125
- if (report.casePassed === true)
126
- gradingStatus = "PASS";
127
- if (report.casePassed === false)
128
- gradingStatus = "FAIL";
129
- let output;
130
- if (options.json) {
131
- output = `${JSON.stringify({ gradingPath: result.path, ...result.snapshot }, null, 2)}\n`;
132
- }
133
- else {
134
- const score = report.caseScore === null ? "—" : `${(report.caseScore * 100).toFixed(0)}%`;
135
- output = [
136
- `grading: ${gradingStatus}`,
137
- `score: ${score}`,
138
- `checks: ${report.assertions.filter((assertion) => assertion.passed).length}/${report.assertions.length}`,
139
- `saved: ${result.path}`,
140
- "",
141
- ].join("\n");
142
- }
143
- process.stdout.write(output);
144
381
  if (controller.signal.aborted)
145
382
  failWith(SIGINT_EXIT_CODE);
146
- else if (report.casePassed !== true)
147
- failWith(1);
148
- });
149
- program
150
- .command("annotate <runDir>")
151
- .description("add or update a human grader-alignment label for a persisted run")
152
- .requiredOption("--out <path>", "JSON annotation dataset to create or update")
153
- .requiredOption("--rubric <path>", "candidate-relative declarative .json rubric path")
154
- .option("--id <id>", "stable annotation id")
155
- .option("--label <pass|fail>", "expected overall case verdict")
156
- .option("--score <n>", "expected overall case score from 0 to 1", parseUnitInterval)
157
- .option("--assertion <id=pass|fail[:score]>", "expected stable assertion verdict and optional score (repeatable)", collectValues, [])
158
- .option("--split <train|validation|test>", "dataset split, stored as a tag")
159
- .option("--tag <tag>", "extra selection tag (repeatable, comma-separated)", collectTags, [])
160
- .option("--feedback <text>", "human rationale shown to the rubric optimizer on mismatch")
161
- .option("--annotator <id>", "person or system that authored the label")
162
- .option("--reviewer <id>", "independent reviewer of the label")
163
- .option("--source <human|synthetic>", "label provenance", "human")
164
- .action(async (runDir, options) => {
165
- const directory = resolve(runDir);
166
- if (!(await ensureDirectory("annotate", directory)))
167
- return;
168
- if (options.label && options.label !== "pass" && options.label !== "fail") {
169
- throw new InvalidArgumentError("--label must be pass or fail");
170
- }
171
- if (options.split && !["train", "validation", "test"].includes(options.split)) {
172
- throw new InvalidArgumentError("--split must be train, validation, or test");
173
- }
174
- if (options.source !== "human" && options.source !== "synthetic") {
175
- throw new InvalidArgumentError("--source must be human or synthetic");
176
- }
177
- const parsedAssertions = options.assertion.map(parseAnnotationAssertion);
178
- const assertionIds = parsedAssertions.map(([id]) => id);
179
- if (new Set(assertionIds).size !== assertionIds.length) {
180
- throw new InvalidArgumentError("--assertion ids must not be repeated");
181
- }
182
- const assertions = Object.fromEntries(parsedAssertions);
183
- if (options.label === undefined &&
184
- options.score === undefined &&
185
- Object.keys(assertions).length === 0) {
186
- throw new Error("lux annotate: provide --label, --score, or at least one --assertion");
187
- }
188
- const out = resolve(options.out);
189
- const run = await loadFrozenRegradableRun(directory);
190
- try {
191
- const rubric = await loadRubricDefinition(await resolveAuthoredFile(options.rubric, "rubric"));
192
- if (rubric.id !== run.case.id) {
193
- throw new Error(`lux annotate: rubric id '${rubric.id}' does not match persisted case '${run.case.id}'`);
194
- }
195
- const rubricIds = new Set(rubric.assertions.map((assertion) => assertion.id));
196
- const unknownIds = assertionIds.filter((assertionId) => !rubricIds.has(assertionId));
197
- if (unknownIds.length > 0) {
198
- throw new Error(`lux annotate: unknown rubric assertion ids: ${unknownIds.join(", ")}`);
199
- }
200
- const tags = [...(options.split ? [options.split] : []), ...options.tag].filter((tag, index, all) => all.indexOf(tag) === index);
201
- const caseId = run.case.id;
202
- const portableRunDir = (relative(dirname(out), directory) || ".").split(sep).join("/");
203
- const id = options.id ??
204
- `${caseId}-${basename(directory)}-${valueHash(portableRunDir).slice(0, 10)}`.replace(/[^a-zA-Z0-9_-]+/g, "-");
205
- const annotation = GraderAnnotationSchema.parse({
206
- id,
207
- runDir: portableRunDir,
208
- rubricPath: options.rubric,
209
- tags,
210
- source: options.source,
211
- ...(options.annotator ? { annotator: options.annotator } : {}),
212
- labeledAt: new Date().toISOString(),
213
- ...(options.reviewer ? { reviewer: options.reviewer } : {}),
214
- expected: {
215
- ...(options.label ? { casePassed: options.label === "pass" } : {}),
216
- ...(options.score !== undefined ? { caseScore: options.score } : {}),
217
- assertions,
218
- },
219
- ...(options.feedback ? { feedback: options.feedback } : {}),
383
+ if (result.snapshot.report.casePassed !== true) {
384
+ throw new Errors.IncurError({
385
+ code: "GRADING_FAILED",
386
+ message: `The persisted run did not pass regrading. Grading saved to ${result.path}.`,
387
+ exitCode: 1,
220
388
  });
221
- const dataset = await upsertGraderAnnotation(out, annotation);
222
- process.stdout.write(`annotated ${annotation.id} in ${out} (${dataset.annotations.length} labels)\n`);
223
- }
224
- finally {
225
- await releaseFrozenRegradableRun(run);
226
389
  }
227
- });
390
+ return { gradingPath: result.path, ...result.snapshot };
391
+ }
392
+ catch (e_1) {
393
+ env_1.error = e_1;
394
+ env_1.hasError = true;
395
+ }
396
+ finally {
397
+ __disposeResources(env_1);
398
+ }
228
399
  };
229
- const registerReportingCommands = (program) => {
230
- program
231
- .command("optimize <campaign>")
232
- .description("evolve source candidates from grading feedback and promote on held-out cases")
233
- .option("--runs-root <path>", "run-dir root (overrides lux.config.ts)")
234
- .option("--resume <experiment-dir>", "resume an interrupted optimization ledger")
235
- .option("--plan", "validate and estimate the campaign without calling models")
236
- .option("--json", "emit machine-readable JSON")
237
- .action(async (campaign, options) => {
238
- await experimentCommand("optimize", campaign, options);
239
- });
240
- program
241
- .command("apply <experimentDir> [candidateId]")
242
- .description("apply the promoted experiment champion after verifying the source base hash")
243
- .action(async (experimentDir, candidateId) => {
244
- const directory = resolve(experimentDir);
245
- const experiment = await loadExperimentRun(directory);
246
- if (!experiment) {
247
- process.stderr.write(`lux apply: experiment manifest not found at ${directory}\n`);
248
- failWith(1);
249
- return;
250
- }
251
- if (experiment.status !== "passed") {
252
- process.stderr.write(`lux apply: experiment status is '${experiment.status}', not 'passed'\n`);
253
- failWith(1);
254
- return;
255
- }
256
- const championId = experiment.championCandidateId;
257
- if (!championId) {
258
- process.stderr.write("lux apply: passed experiment has no promoted champion\n");
259
- failWith(1);
260
- return;
261
- }
262
- if (candidateId && candidateId !== championId) {
263
- process.stderr.write(`lux apply: candidate '${candidateId}' is not the promoted champion '${championId}'\n`);
264
- failWith(1);
265
- return;
266
- }
267
- let candidate;
268
- try {
269
- const candidates = await verifyExperimentRunIntegrity(directory, experiment);
270
- verifyExperimentDecisionIntegrity(experiment);
271
- candidate = candidates.find((entry) => entry.id === championId);
272
- if (!candidate) {
273
- throw new Error(`champion candidate '${championId}' not found`);
274
- }
275
- }
276
- catch (error) {
277
- const message = error instanceof Error ? error.message : String(error);
278
- process.stderr.write(`lux apply: experiment integrity check failed: ${message}\n`);
279
- failWith(1);
280
- return;
281
- }
282
- await applyCandidate(experiment.subjectRoot, experiment.campaignSnapshot.subject, candidate);
283
- process.stdout.write(`applied candidate ${candidate.id} to ${experiment.subjectRoot} (${candidate.sourceBytes} bytes)\n`);
284
- });
285
- program
286
- .command("report <experimentDir>")
287
- .description("render a PR-ready promotion report from a verified experiment record")
288
- .option("--json", "emit the structured decision report as JSON")
289
- .option("--out <path>", "write the report to a file instead of stdout")
290
- .option("--force", "overwrite an existing output file")
291
- .action(async (experimentDir, options) => {
292
- const directory = resolve(experimentDir);
293
- if (!(await ensureDirectory("report", directory)))
294
- return;
295
- const snapshot = await loadVerifiedExperimentDecisionSnapshot(directory);
296
- const { experiment, report } = snapshot;
297
- const rendered = options.json
298
- ? `${JSON.stringify(report, null, 2)}\n`
299
- : `${formatExperimentDecisionMarkdown(report)}\n`;
300
- if (!options.out) {
301
- process.stdout.write(rendered);
302
- return;
303
- }
304
- const out = resolve(options.out);
305
- const outputStats = await lstat(out).catch((error) => {
306
- if (error.code === "ENOENT")
307
- return null;
308
- throw error;
400
+ const annotateCommand = async (runDir, options) => {
401
+ const directory = resolve(runDir);
402
+ if (!(await ensureDirectory("annotate", directory)))
403
+ failWith(1);
404
+ const parsedAssertions = options.assertion.map(parseAnnotationAssertion);
405
+ const assertionIds = parsedAssertions.map(([id]) => id);
406
+ if (new Set(assertionIds).size !== assertionIds.length) {
407
+ throw new Errors.ParseError({ message: "--assertion IDs must not be repeated" });
408
+ }
409
+ const assertions = Object.fromEntries(parsedAssertions);
410
+ if (options.label === undefined &&
411
+ options.score === undefined &&
412
+ Object.keys(assertions).length === 0) {
413
+ throw new Errors.ParseError({
414
+ message: "Provide --label, --score, or at least one --assertion",
309
415
  });
310
- if (outputStats && (outputStats.isSymbolicLink() || !outputStats.isFile())) {
311
- throw new Error("lux report: an existing --out must be a regular, non-symlink file");
312
- }
313
- const [physicalDirectory, physicalSubjectRoot, physicalOut] = await Promise.all([
314
- realpath(directory),
315
- realpath(experiment.subjectRoot),
316
- physicalDestinationPath(out),
317
- ]);
318
- assertReportDestination(physicalOut, physicalDirectory, physicalSubjectRoot, experiment.campaignSnapshot.subject.exclude);
319
- if (outputStats && !options.force) {
320
- throw new Error(`lux report: output already exists (use --force): ${out}`);
321
- }
322
- await mkdir(dirname(out), { recursive: true });
323
- const physicalParent = await realpath(dirname(out));
324
- const finalPhysicalOut = resolve(physicalParent, basename(out));
325
- assertReportDestination(finalPhysicalOut, physicalDirectory, physicalSubjectRoot, experiment.campaignSnapshot.subject.exclude);
326
- await writeReportSafely(finalPhysicalOut, rendered, options.force ?? false);
327
- process.stdout.write(`wrote experiment report to ${out}\n`);
328
- });
329
- program
330
- .command("view [runDir]")
331
- .description("list past runs, or show one run's detail when given a runDir")
332
- .option("--runs-root <path>", "run-dir root (defaults to lux.config.ts)")
333
- .option("--case <id>", "filter the run list to one case slug (list mode only)")
334
- .option("--suites", "list logical suite runs instead of individual runs")
335
- .option("--experiments", "list experiment runs instead of individual runs")
336
- .option("--json", "emit machine-readable JSON")
337
- .action(async (runDirArg, options) => {
338
- if (runDirArg) {
339
- const path = resolve(runDirArg);
340
- if (!(await ensureDirectory("view", path)))
341
- return;
342
- if (isExperimentRun(path)) {
343
- const experiment = await loadExperimentRun(path);
344
- if (!experiment) {
345
- process.stderr.write(`lux view: invalid experiment at ${path}\n`);
346
- failWith(1);
347
- return;
348
- }
349
- process.stdout.write(options.json
350
- ? `${JSON.stringify({ experimentDir: path, ...experiment }, null, 2)}\n`
351
- : `${formatExperimentRun(path, experiment)}\n`);
352
- return;
353
- }
354
- const suite = await loadSuiteRun(path);
355
- if (suite) {
356
- process.stdout.write(options.json
357
- ? `${JSON.stringify({ suiteDir: path, ...suite }, null, 2)}\n`
358
- : `${formatSuiteRunDetail(path, suite)}\n`);
359
- return;
360
- }
361
- const detail = await loadRunDetail(path);
362
- if (options.json) {
363
- process.stdout.write(`${JSON.stringify(detail, null, 2)}\n`);
364
- }
365
- else {
366
- process.stdout.write(`${formatRunDetail(detail)}\n`);
367
- }
368
- return;
369
- }
370
- const cwd = process.cwd();
371
- const config = await loadLuxConfig(cwd);
372
- const runsRoot = options.runsRoot ? resolve(options.runsRoot) : config.runsRoot;
373
- if (options.experiments) {
374
- const experiments = await listExperimentRuns(runsRoot);
375
- process.stdout.write(options.json
376
- ? `${JSON.stringify(experiments, null, 2)}\n`
377
- : `experiments at ${runsRoot}:\n${formatExperimentRunsTable(experiments)}\n`);
378
- return;
379
- }
380
- if (options.suites) {
381
- const suites = await listSuiteRuns(runsRoot);
382
- process.stdout.write(options.json
383
- ? `${JSON.stringify(suites, null, 2)}\n`
384
- : `suite runs at ${runsRoot}:\n${formatSuiteRunsTable(suites)}\n`);
385
- return;
386
- }
387
- const all = await listRuns(runsRoot);
388
- const runs = options.case ? all.filter((r) => r.caseSlug === options.case) : all;
389
- if (options.json) {
390
- process.stdout.write(`${JSON.stringify(runs, null, 2)}\n`);
391
- }
392
- else {
393
- if (!options.case) {
394
- process.stdout.write(`suite runs at ${runsRoot}:\n`);
395
- process.stdout.write(`${formatSuiteRunsTable(await listSuiteRuns(runsRoot))}\n\n`);
396
- }
397
- process.stdout.write(`runs at ${runsRoot}:\n`);
398
- process.stdout.write(`${formatRunsTable(runs)}\n`);
399
- }
400
- });
401
- program
402
- .command("compare <runA> <runB>")
403
- .description("diff two run or suite directories")
404
- .option("--pass-rate-tolerance <fraction>", "allowed per-case pass-rate decrease for suite comparison", parseUnitInterval)
405
- .action(async (runA, runB, options) => {
406
- const pathA = resolve(runA);
407
- const pathB = resolve(runB);
408
- // Validate both up front so one typo'd path in CI cannot read as
409
- // "0 regressed"; report every bad path, not just the first.
410
- const okA = await ensureDirectory("compare", pathA);
411
- const okB = await ensureDirectory("compare", pathB);
412
- if (!okA || !okB)
413
- return;
414
- const [suiteA, suiteB] = await Promise.all([loadSuiteRun(pathA), loadSuiteRun(pathB)]);
415
- if (Boolean(suiteA) !== Boolean(suiteB)) {
416
- process.stderr.write("lux compare: both paths must be runs or both must be suites\n");
417
- failWith(1);
418
- return;
419
- }
420
- if (suiteA && suiteB) {
421
- const comparison = await compareSuiteRuns(pathA, pathB, {
422
- ...(options.passRateTolerance !== undefined
423
- ? { passRateTolerance: options.passRateTolerance }
424
- : {}),
416
+ }
417
+ const out = resolve(options.out);
418
+ const run = await loadFrozenRegradableRun(directory);
419
+ try {
420
+ const rubric = await loadRubricDefinition(await resolveAuthoredFile(options.rubric, "rubric"));
421
+ if (rubric.id !== run.case.id) {
422
+ throw new Error(`Rubric ID '${rubric.id}' does not match persisted case '${run.case.id}'.`);
423
+ }
424
+ const rubricIds = new Set(rubric.assertions.map((assertion) => assertion.id));
425
+ const unknownIds = assertionIds.filter((assertionId) => !rubricIds.has(assertionId));
426
+ if (unknownIds.length > 0) {
427
+ throw new Errors.ParseError({
428
+ message: `Unknown rubric assertion IDs: ${unknownIds.join(", ")}`,
425
429
  });
426
- process.stdout.write(`${formatSuiteComparisonText(comparison)}\n`);
427
- if (hasSuiteRegression(comparison))
428
- failWith(1);
429
- return;
430
430
  }
431
- const cmp = await compareRuns({ pathA, pathB });
432
- process.stdout.write(`${formatComparisonText(cmp)}\n`);
433
- if (hasRegression(cmp))
434
- failWith(1);
431
+ const annotationTags = [
432
+ ...(options.split ? [options.split] : []),
433
+ ...normalizeTags(options.tag),
434
+ ].filter((tag, index, all) => all.indexOf(tag) === index);
435
+ const portableRunDir = (relative(dirname(out), directory) || ".").split(sep).join("/");
436
+ const id = options.id ??
437
+ `${run.case.id}-${basename(directory)}-${valueHash(portableRunDir).slice(0, 10)}`.replace(/[^a-zA-Z0-9_-]+/g, "-");
438
+ const annotation = GraderAnnotationSchema.parse({
439
+ id,
440
+ runDir: portableRunDir,
441
+ rubricPath: options.rubric,
442
+ tags: annotationTags,
443
+ source: options.source,
444
+ ...(options.annotator ? { annotator: options.annotator } : {}),
445
+ labeledAt: new Date().toISOString(),
446
+ ...(options.reviewer ? { reviewer: options.reviewer } : {}),
447
+ expected: {
448
+ ...(options.label ? { casePassed: options.label === "pass" } : {}),
449
+ ...(options.score !== undefined ? { caseScore: options.score } : {}),
450
+ assertions,
451
+ },
452
+ ...(options.feedback ? { feedback: options.feedback } : {}),
453
+ });
454
+ const dataset = await upsertGraderAnnotation(out, annotation);
455
+ return { id: annotation.id, path: out, labels: dataset.annotations.length };
456
+ }
457
+ finally {
458
+ await releaseFrozenRegradableRun(run);
459
+ }
460
+ };
461
+ const applyCommand = async (experimentDir, candidateId) => {
462
+ const directory = resolve(experimentDir);
463
+ const experiment = await loadExperimentRun(directory);
464
+ if (!experiment) {
465
+ throw new Errors.IncurError({
466
+ code: "EXPERIMENT_NOT_FOUND",
467
+ message: `Experiment manifest not found at ${directory}.`,
468
+ exitCode: 1,
469
+ });
470
+ }
471
+ if (experiment.status !== "passed") {
472
+ throw new Errors.IncurError({
473
+ code: "EXPERIMENT_NOT_PROMOTED",
474
+ message: `Experiment status is '${experiment.status}', not 'passed'.`,
475
+ exitCode: 1,
476
+ });
477
+ }
478
+ const championId = experiment.championCandidateId;
479
+ if (!championId) {
480
+ throw new Errors.IncurError({
481
+ code: "CHAMPION_NOT_FOUND",
482
+ message: "The passed experiment has no promoted champion.",
483
+ exitCode: 1,
484
+ });
485
+ }
486
+ if (candidateId && candidateId !== championId) {
487
+ throw new Errors.IncurError({
488
+ code: "CANDIDATE_NOT_PROMOTED",
489
+ message: `Candidate '${candidateId}' is not the promoted champion '${championId}'.`,
490
+ exitCode: 1,
491
+ });
492
+ }
493
+ let candidate;
494
+ try {
495
+ const candidates = await verifyExperimentRunIntegrity(directory, experiment);
496
+ verifyExperimentDecisionIntegrity(experiment);
497
+ candidate = candidates.find((entry) => entry.id === championId);
498
+ if (!candidate)
499
+ throw new Error(`Champion candidate '${championId}' not found.`);
500
+ }
501
+ catch (error) {
502
+ throw new Errors.IncurError({
503
+ code: "EXPERIMENT_INTEGRITY_FAILED",
504
+ message: error instanceof Error ? error.message : String(error),
505
+ exitCode: 1,
506
+ });
507
+ }
508
+ await applyCandidate(experiment.subjectRoot, experiment.campaignSnapshot.subject, candidate);
509
+ return {
510
+ candidateId: candidate.id,
511
+ subjectRoot: experiment.subjectRoot,
512
+ sourceBytes: candidate.sourceBytes,
513
+ };
514
+ };
515
+ const reportCommand = async (experimentDir, options) => {
516
+ const directory = resolve(experimentDir);
517
+ if (!(await ensureDirectory("report", directory)))
518
+ failWith(1);
519
+ const snapshot = await loadVerifiedExperimentDecisionSnapshot(directory);
520
+ const { experiment, report } = snapshot;
521
+ if (!options.out)
522
+ return report;
523
+ const out = resolve(options.out);
524
+ const outputStats = await lstat(out).catch((error) => {
525
+ if (error.code === "ENOENT")
526
+ return null;
527
+ throw error;
435
528
  });
529
+ if (outputStats && (outputStats.isSymbolicLink() || !outputStats.isFile())) {
530
+ throw new Error("An existing --out must be a regular, non-symlink file.");
531
+ }
532
+ const [physicalDirectory, physicalSubjectRoot, physicalOut] = await Promise.all([
533
+ realpath(directory),
534
+ realpath(experiment.subjectRoot),
535
+ physicalDestinationPath(out),
536
+ ]);
537
+ assertReportDestination(physicalOut, physicalDirectory, physicalSubjectRoot, experiment.campaignSnapshot.subject.exclude);
538
+ if (outputStats && !options.force) {
539
+ throw new Error(`Output already exists (use --force): ${out}`);
540
+ }
541
+ await mkdir(dirname(out), { recursive: true });
542
+ const physicalParent = await realpath(dirname(out));
543
+ const finalPhysicalOut = resolve(physicalParent, basename(out));
544
+ assertReportDestination(finalPhysicalOut, physicalDirectory, physicalSubjectRoot, experiment.campaignSnapshot.subject.exclude);
545
+ await writeReportSafely(finalPhysicalOut, `${formatExperimentDecisionMarkdown(report)}\n`, options.force ?? false);
546
+ return { path: out, report };
436
547
  };
437
- export const buildProgram = () => {
438
- const program = new Command();
439
- program
440
- .name("lux")
441
- .description("Coding-agent evaluation and improvement with deterministic assertions and human-in-the-loop runs")
442
- .version(PKG_VERSION);
443
- registerProjectCommands(program);
444
- registerExperimentCommands(program);
445
- registerCandidateCommands(program);
446
- registerReportingCommands(program);
447
- return program;
548
+ const compareCommand = async (runA, runB, options) => {
549
+ const pathA = resolve(runA);
550
+ const pathB = resolve(runB);
551
+ const invalid = (await Promise.all([pathA, pathB].map(async (path) => existsSync(path) && (await stat(path)).isDirectory() ? undefined : path))).filter((path) => path !== undefined);
552
+ if (invalid.length > 0) {
553
+ throw new Errors.IncurError({
554
+ code: "RUN_DIRECTORY_NOT_FOUND",
555
+ message: invalid.map((path) => `${path} is not a directory`).join("; "),
556
+ exitCode: 1,
557
+ });
558
+ }
559
+ const [suiteA, suiteB] = await Promise.all([loadSuiteRun(pathA), loadSuiteRun(pathB)]);
560
+ if (Boolean(suiteA) !== Boolean(suiteB)) {
561
+ throw new Errors.IncurError({
562
+ code: "INCOMPATIBLE_RUN_TYPES",
563
+ message: "Both paths must be runs or both must be suites.",
564
+ exitCode: 1,
565
+ });
566
+ }
567
+ if (suiteA && suiteB) {
568
+ const comparison = await compareSuiteRuns(pathA, pathB, {
569
+ ...(options.passRateTolerance !== undefined
570
+ ? { passRateTolerance: options.passRateTolerance }
571
+ : {}),
572
+ });
573
+ if (hasSuiteRegression(comparison)) {
574
+ throw new Errors.IncurError({
575
+ code: "REGRESSION_DETECTED",
576
+ message: formatSuiteComparisonText(comparison),
577
+ exitCode: 1,
578
+ });
579
+ }
580
+ return comparison;
581
+ }
582
+ const comparison = await compareRuns({ pathA, pathB });
583
+ if (hasRegression(comparison)) {
584
+ throw new Errors.IncurError({
585
+ code: "REGRESSION_DETECTED",
586
+ message: formatComparisonText(comparison),
587
+ exitCode: 1,
588
+ });
589
+ }
590
+ return comparison;
448
591
  };
449
- const caseIdOf = (casePath) => basename(casePath, extname(casePath));
450
592
  const SIGINT_EXIT_CODE = 130;
451
593
  const physicalDestinationPath = async (path) => {
452
594
  const suffix = [];
@@ -509,249 +651,240 @@ const resolveAuthoredFile = async (value, label) => {
509
651
  */
510
652
  const isFailure = (outcome) => outcome.exitReason !== "done" || outcome.casePassed !== true;
511
653
  const firstLine = (message) => (message.split("\n")[0] ?? message).trim();
512
- const suiteTitle = (patterns, tags, explicit, loop) => {
513
- const parts = [...patterns, ...explicit.map((e) => e.id), ...tags.map((t) => `#${t}`)];
514
- const filter = parts.length > 0 ? ` ${parts.join(" ")}` : "";
515
- const repeat = loop > 1 ? ` ×${loop}` : "";
516
- return `run${filter}${repeat}`;
517
- };
518
- // A filter that names an existing `.ts` file runs that file directly — it may
519
- // sit outside the discovery root. Everything else is a substring pattern — but
520
- // a `.ts` filter that resolves to nothing is almost always a typo'd path, so
521
- // the silent downgrade to a pattern gets called out.
522
- const partitionFilters = (filters, cwd) => {
523
- const explicit = [];
524
- const patterns = [];
525
- for (const f of filters) {
526
- const abs = resolve(cwd, f);
527
- if (f.endsWith(".ts") && existsSync(abs)) {
528
- explicit.push({ path: abs, id: caseIdOf(f) });
529
- }
530
- else {
531
- if (f.endsWith(".ts")) {
532
- process.stderr.write(`lux: ${abs} does not exist; treating "${f}" as a pattern\n`);
654
+ const experimentCommand = async (mode, campaignPath, options) => {
655
+ const env_2 = { stack: [], error: void 0, hasError: false };
656
+ try {
657
+ const cwd = process.cwd();
658
+ const config = await loadLuxConfig(cwd);
659
+ const campaign = await resolveExperimentCampaignPath(config.rootDir, campaignPath);
660
+ const loaded = await loadExperimentCampaign(campaign);
661
+ experimentCampaignMode(campaign, loaded.campaign, mode);
662
+ const registry = buildRegistryFromConfig(config);
663
+ const controller = __addDisposableResource(env_2, abortOnInterrupt(), false);
664
+ const execution = {
665
+ config,
666
+ registry,
667
+ loaded,
668
+ ...(options.runsRoot ? { runsRoot: resolve(options.runsRoot) } : {}),
669
+ ...(options.resume ? { resumeFrom: resolve(options.resume) } : {}),
670
+ abortSignal: controller.signal,
671
+ };
672
+ if (options.plan) {
673
+ const plan = await planExperimentCampaign(execution, mode);
674
+ if (!plan.fitsProjectedCallBudgets) {
675
+ throw new Errors.IncurError({
676
+ code: "EXPERIMENT_BUDGET_EXCEEDED",
677
+ message: "The projected experiment work exceeds its configured call budgets.",
678
+ exitCode: 1,
679
+ });
533
680
  }
534
- patterns.push(f);
681
+ return plan;
682
+ }
683
+ const result = mode === "optimize"
684
+ ? await optimizeExperimentCampaign(execution)
685
+ : await runExperimentCampaign(execution);
686
+ if (controller.signal.aborted)
687
+ failWith(SIGINT_EXIT_CODE);
688
+ if (result.manifest.status !== "passed") {
689
+ throw new Errors.IncurError({
690
+ code: "EXPERIMENT_FAILED",
691
+ message: `Experiment ${result.manifest.experimentId} finished with status '${result.manifest.status}'.`,
692
+ exitCode: 1,
693
+ });
535
694
  }
695
+ return { experimentDir: result.experimentDir, ...result.manifest };
696
+ }
697
+ catch (e_2) {
698
+ env_2.error = e_2;
699
+ env_2.hasError = true;
700
+ }
701
+ finally {
702
+ __disposeResources(env_2);
536
703
  }
537
- return { explicit, patterns };
538
704
  };
539
- // The selected set — substring/tag matches plus explicitly named files — is
540
- // the same whether it is run, `--list`ed, or `--list-tags`ed. No filters at
541
- // all means "everything discovered"; any filter narrows.
542
- const selectSuite = (cases, { explicit, patterns }, tags) => {
543
- const hasFilter = explicit.length > 0 || patterns.length > 0 || tags.length > 0;
544
- const byPath = new Map();
545
- if (!hasFilter) {
546
- for (const c of cases)
547
- byPath.set(c.path, c);
548
- }
549
- else {
550
- if (patterns.length > 0 || tags.length > 0) {
551
- for (const c of selectCases(cases, { patterns, tags }))
552
- byPath.set(c.path, c);
705
+ /** A profile pins one driver, so callers pass the project matrix only without one. */
706
+ const runCommand = async (filters, options, human = false) => {
707
+ const env_3 = { stack: [], error: void 0, hasError: false };
708
+ try {
709
+ if (options.interactive && options.claudeAnswerer) {
710
+ throw new Errors.ParseError({
711
+ message: "--interactive and --claude-answerer are mutually exclusive",
712
+ });
553
713
  }
554
- for (const e of explicit) {
555
- const discovered = cases.find((c) => c.path === e.path);
556
- // Discovery knows the case's declared id; the filename-derived one is
557
- // only a fallback for files discovery never saw.
558
- byPath.set(e.path, {
559
- path: e.path,
560
- id: discovered?.id ?? e.id,
561
- relPath: discovered?.relPath ?? e.id,
562
- tags: discovered?.tags ?? [],
714
+ const cwd = process.cwd();
715
+ const config = await loadLuxConfig(cwd);
716
+ const profile = options.profile ? config.profiles?.[options.profile] : undefined;
717
+ if (options.profile && !profile) {
718
+ const available = Object.keys(config.profiles ?? {}).sort();
719
+ throw new Errors.IncurError({
720
+ code: "PROFILE_NOT_FOUND",
721
+ message: `Unknown profile '${options.profile}'${available.length > 0 ? `; available: ${available.join(", ")}` : ""}.`,
722
+ exitCode: 1,
563
723
  });
564
724
  }
565
- }
566
- return [...byPath.values()].sort((a, b) => a.id.localeCompare(b.id));
567
- };
568
- // `--loop` repeats each eval before moving to the next; each repeat gets a
569
- // `#n` display suffix so the reporter keeps them apart, while `caseId` keeps
570
- // every repeat filed under one run history.
571
- const expandLoop = (base, loop) => loop > 1
572
- ? base.flatMap((b) => Array.from({ length: loop }, (_, i) => ({
573
- path: b.path,
574
- id: `${b.id} #${i + 1}`,
575
- caseId: b.caseId ?? b.id,
576
- })))
577
- : base;
578
- const experimentCommand = async (mode, campaignPath, options) => {
579
- const cwd = process.cwd();
580
- const config = await loadLuxConfig(cwd);
581
- const campaign = await resolveExperimentCampaignPath(config.rootDir, campaignPath);
582
- const loaded = await loadExperimentCampaign(campaign);
583
- experimentCampaignMode(campaign, loaded.campaign, mode);
584
- const registry = buildRegistryFromConfig(config);
585
- const controller = abortOnInterrupt();
586
- const execution = {
587
- config,
588
- registry,
589
- loaded,
590
- ...(options.runsRoot ? { runsRoot: resolve(options.runsRoot) } : {}),
591
- ...(options.resume ? { resumeFrom: resolve(options.resume) } : {}),
592
- abortSignal: controller.signal,
593
- };
594
- if (options.plan) {
595
- const plan = await planExperimentCampaign(execution, mode);
596
- let output;
597
- if (options.json) {
598
- output = `${JSON.stringify(plan, null, 2)}\n`;
725
+ const harness = profile?.harness ?? config.harness;
726
+ const registry = registryWithHarness(buildRegistryFromConfig(config), config, harness);
727
+ const defaultDriver = profile?.driver ?? config.defaultDriver;
728
+ const orchestrator = new Orchestrator({
729
+ environment: profile?.environment ?? config.environment,
730
+ registry,
731
+ defaultAnswerer: profile?.answerer ?? config.defaultAnswerer,
732
+ ...(defaultDriver ? { defaultDriver } : {}),
733
+ ...(harness ? { harness } : {}),
734
+ lifecycleFixtures: config.lifecycleFixtures,
735
+ });
736
+ const runsRoot = options.runsRoot ? resolve(options.runsRoot) : config.runsRoot;
737
+ const subjectRoot = options.subjectRoot ? resolve(options.subjectRoot) : config.subjectRoot;
738
+ // A config file is the user's opt-in to tree-wide discovery. Without one,
739
+ // stay scoped to the `cases/` scaffold: discovery imports every .ts it
740
+ // visits, and running module-level side effects across an arbitrary cwd
741
+ // must never be the default.
742
+ const root = config.casesRoot ?? (config.configPath ? config.rootDir : join(cwd, "cases"));
743
+ // A configured casesRoot is a path the user declared; its absence is a
744
+ // broken config, not an empty suite — never mask it behind "no cases
745
+ // matched" or a lucky explicit-file run.
746
+ if (config.casesRoot && !existsSync(config.casesRoot)) {
747
+ throw new Errors.IncurError({
748
+ code: "CASES_ROOT_NOT_FOUND",
749
+ message: `casesRoot does not exist: ${config.casesRoot}`,
750
+ exitCode: 1,
751
+ });
599
752
  }
600
- else {
601
- const projectedStatus = plan.fitsProjectedCallBudgets ? "yes" : "no";
602
- output = [
603
- `campaign: ${plan.campaignId}`,
604
- `mode: ${plan.mode}`,
605
- `evaluation: ${plan.evaluationKind}`,
606
- `profiles: ${plan.profiles.join(", ")}`,
607
- `splits: ${plan.splits.map((split) => `${split.split}=${split.examples}`).join(", ")}`,
608
- `components: ${plan.mutableComponents.length}`,
609
- `candidates: ${plan.projected.candidates}`,
610
- `metric calls: ${plan.projected.metricCalls}/${plan.budget.maxMetricCalls}`,
611
- `judge calls: ${plan.projected.judgeCalls}/${plan.budget.maxJudgeCalls}`,
612
- `proposal calls:${plan.projected.proposalCalls}/${plan.budget.maxProposalCalls}`,
613
- `unpriced calls: observed at runtime (cap ${plan.budget.maxUnpricedModelCalls})`,
614
- `projected work within budget: ${projectedStatus}`,
615
- ...plan.warnings.map((warning) => `warning: ${warning}`),
616
- "",
617
- ].join("\n");
753
+ const { explicit, patterns } = partitionFilters(filters, cwd);
754
+ const tags = normalizeTags(options.tag ?? []);
755
+ const hasFilter = explicit.length > 0 || patterns.length > 0 || tags.length > 0;
756
+ // Explicitly named files need no discovery, so they run even without a
757
+ // project; anything else would need a tree walk with nowhere safe to walk.
758
+ if (config.configPath === null && !existsSync(root) && explicit.length === 0) {
759
+ throw new Errors.IncurError({
760
+ code: "PROJECT_NOT_INITIALIZED",
761
+ message: `No lux.config.ts or cases/ directory in ${cwd}.`,
762
+ hint: "Run `lux init` or name a case file directly.",
763
+ exitCode: 1,
764
+ });
618
765
  }
619
- process.stdout.write(output);
620
- if (!plan.fitsProjectedCallBudgets)
621
- failWith(1);
622
- return;
623
- }
624
- const result = mode === "optimize"
625
- ? await optimizeExperimentCampaign(execution)
626
- : await runExperimentCampaign(execution);
627
- process.stdout.write(options.json
628
- ? `${JSON.stringify({ experimentDir: result.experimentDir, ...result.manifest }, null, 2)}\n`
629
- : `${formatExperimentRun(result.experimentDir, result.manifest)}\n`);
630
- if (controller.signal.aborted)
631
- failWith(SIGINT_EXIT_CODE);
632
- else if (result.manifest.status !== "passed")
633
- failWith(1);
634
- };
635
- const runCommand = async (filters, options) => {
636
- if (options.interactive && options.claudeAnswerer) {
637
- throw new Error("lux run: --interactive and --claude-answerer are mutually exclusive");
638
- }
639
- const cwd = process.cwd();
640
- const config = await loadLuxConfig(cwd);
641
- const profile = options.profile ? config.profiles?.[options.profile] : undefined;
642
- if (options.profile && !profile) {
643
- const available = Object.keys(config.profiles ?? {}).sort();
644
- process.stderr.write(`lux: unknown profile '${options.profile}'${available.length > 0 ? `; available: ${available.join(", ")}` : ""}\n`);
645
- failWith(1);
646
- return;
647
- }
648
- const harness = profile?.harness ?? config.harness;
649
- const registry = buildRegistryFromConfig(config).withAssertion(createRubricAssertion(harness));
650
- const defaultDriver = profile?.driver ?? config.defaultDriver;
651
- const orchestrator = new Orchestrator({
652
- registry,
653
- defaultAnswerer: profile?.answerer ?? config.defaultAnswerer,
654
- ...(defaultDriver ? { defaultDriver } : {}),
655
- ...(harness ? { harness } : {}),
656
- lifecycleFixtures: config.lifecycleFixtures,
657
- });
658
- const runsRoot = options.runsRoot ? resolve(options.runsRoot) : config.runsRoot;
659
- const subjectRoot = options.subjectRoot ? resolve(options.subjectRoot) : config.subjectRoot;
660
- // A config file is the user's opt-in to tree-wide discovery. Without one,
661
- // stay scoped to the `cases/` scaffold: discovery imports every .ts it
662
- // visits, and running module-level side effects across an arbitrary cwd
663
- // must never be the default.
664
- const root = config.casesRoot ?? (config.configPath ? config.rootDir : join(cwd, "cases"));
665
- // A configured casesRoot is a path the user declared; its absence is a
666
- // broken config, not an empty suite — never mask it behind "no cases
667
- // matched" or a lucky explicit-file run.
668
- if (config.casesRoot && !existsSync(config.casesRoot)) {
669
- process.stderr.write(`lux: casesRoot does not exist: ${config.casesRoot}\n`);
670
- failWith(1);
671
- return;
672
- }
673
- const { explicit, patterns } = partitionFilters(filters, cwd);
674
- const tags = options.tag ?? [];
675
- const hasFilter = explicit.length > 0 || patterns.length > 0 || tags.length > 0;
676
- // Explicitly named files need no discovery, so they run even without a
677
- // project; anything else would need a tree walk with nowhere safe to walk.
678
- if (config.configPath === null && !existsSync(root) && explicit.length === 0) {
679
- process.stderr.write(`lux: no lux.config.ts or cases/ directory in ${cwd} — run \`lux init\` to scaffold a project, or name a case file directly\n`);
680
- failWith(1);
681
- return;
682
- }
683
- const { cases, problems } = existsSync(root)
684
- ? await discoverCases(root)
685
- : { cases: [], problems: [] };
686
- for (const problem of problems) {
687
- process.stderr.write(`lux: skipped ${problem.path}: ${firstLine(problem.reason)}\n`);
688
- }
689
- const selected = selectSuite(cases, { explicit, patterns }, tags);
690
- // An empty selection fails every mode the same way — running, `--list`, and
691
- // `--list-tags` all exit 1, so a typo'd filter can never read as a clean pass.
692
- if (selected.length === 0) {
693
- process.stderr.write(hasFilter
694
- ? "lux: no cases matched the given filters\n"
695
- : `lux: no cases discovered under ${root}\n`);
696
- failWith(1);
697
- return;
698
- }
699
- // List the tag vocabulary of the selected cases — "which --tag values exist?".
700
- if (options.listTags) {
701
- const counts = new Map();
702
- for (const c of selected)
703
- for (const t of c.tags)
704
- counts.set(t, (counts.get(t) ?? 0) + 1);
705
- for (const [tag, n] of [...counts].sort((a, b) => a[0].localeCompare(b[0]))) {
706
- process.stdout.write(`${tag}\t${n}\n`);
766
+ const { cases, problems } = existsSync(root)
767
+ ? await discoverCases(root)
768
+ : { cases: [], problems: [] };
769
+ for (const problem of problems) {
770
+ process.stderr.write(`lux: skipped ${problem.path}: ${firstLine(problem.reason)}\n`);
771
+ }
772
+ const selected = selectSuite(cases, { explicit, patterns }, tags);
773
+ // An empty selection fails every mode the same way — running, `--list`, and
774
+ // `--list-tags` all exit 1, so a typo'd filter can never read as a clean pass.
775
+ if (selected.length === 0) {
776
+ throw new Errors.IncurError({
777
+ code: "NO_CASES_MATCHED",
778
+ message: hasFilter
779
+ ? "No cases matched the given filters."
780
+ : `No cases were discovered under ${root}.`,
781
+ exitCode: 1,
782
+ });
707
783
  }
708
- process.stderr.write(`lux: ${counts.size} tag${counts.size === 1 ? "" : "s"} across ${selected.length} cases\n`);
709
- return;
710
- }
711
- const base = selected.map((c) => ({ path: c.path, id: c.id }));
712
- // Collect-only: answer "what would run?" without spawning a single agent.
713
- if (options.list) {
714
- for (const item of base)
715
- process.stdout.write(`${item.id}\n`);
716
- process.stderr.write(`lux: ${base.length} case${base.length === 1 ? "" : "s"} matched\n`);
717
- return;
718
- }
719
- const loop = options.loop ?? 1;
720
- const items = expandLoop(base, loop);
721
- const { concurrency, note } = resolveConcurrency(options, config.concurrency);
722
- if (note)
723
- process.stderr.write(note);
724
- const reporter = new ConsoleReporter({ verbose: options.verbose ?? false });
725
- const controller = abortOnInterrupt();
726
- reporter.begin({
727
- title: suiteTitle(patterns, tags, explicit, loop),
728
- caseIds: items.map((i) => i.id),
729
- runsRoot,
730
- loop,
731
- });
732
- let results = [];
733
- try {
734
- const suite = await orchestrator.runSuite(items, {
784
+ // List the tag vocabulary of the selected cases — "which --tag values exist?".
785
+ if (options.listTags) {
786
+ const counts = new Map();
787
+ for (const c of selected)
788
+ for (const t of c.tags)
789
+ counts.set(t, (counts.get(t) ?? 0) + 1);
790
+ const result = {
791
+ caseCount: selected.length,
792
+ tags: [...counts]
793
+ .sort((a, b) => a[0].localeCompare(b[0]))
794
+ .map(([tag, count]) => ({ tag, count })),
795
+ };
796
+ if (human)
797
+ process.stdout.write(`${result.caseCount} cases\n${result.tags.map(({ tag, count }) => ` ${tag}: ${count}`).join("\n")}\n`);
798
+ return result;
799
+ }
800
+ const focus = {
801
+ driver: options.driver,
802
+ model: options.model,
803
+ effort: options.effort,
804
+ };
805
+ const base = await planSuiteItems(selected, {
806
+ matrix: profile ? undefined : config.matrix,
807
+ defaultDriver,
808
+ registry,
809
+ focus,
810
+ });
811
+ // Collect-only: answer "what would run?" without spawning a single agent.
812
+ if (options.list) {
813
+ if (human)
814
+ process.stdout.write(`${base.length} cases\n${base.map(({ id, path }) => ` ${id} ${path}`).join("\n")}\n`);
815
+ return {
816
+ caseCount: base.length,
817
+ cases: base.map(({ path, id, caseId, permutationId }) => ({
818
+ path,
819
+ id,
820
+ ...(caseId !== undefined ? { caseId } : {}),
821
+ ...(permutationId !== undefined ? { permutationId } : {}),
822
+ })),
823
+ };
824
+ }
825
+ const loop = options.loop ?? 1;
826
+ const items = expandLoop(base, loop);
827
+ const { concurrency, note } = resolveConcurrency(options, config.concurrency);
828
+ if (note)
829
+ process.stderr.write(note);
830
+ const reporter = human ? new ConsoleReporter({ verbose: options.verbose ?? false }) : undefined;
831
+ const controller = __addDisposableResource(env_3, abortOnInterrupt(), false);
832
+ reporter?.begin({
833
+ title: suiteTitle(patterns, tags, explicit, loop, focus),
834
+ caseIds: items.map((i) => i.id),
735
835
  runsRoot,
736
- fixturesRoot: config.fixturesRoot,
737
- answererOverride: resolveAnswererOverride(options),
738
- observer: reporter,
739
- abortSignal: controller.signal,
740
- concurrency,
741
- subjectRoot,
742
- profileId: options.profile,
836
+ loop,
743
837
  });
744
- results = suite.results;
745
- reporter.setSuiteDir(suite.suiteDir);
838
+ let results = [];
839
+ try {
840
+ const suite = await orchestrator.runSuite(items, {
841
+ runsRoot,
842
+ fixturesRoot: config.fixturesRoot,
843
+ answererOverride: resolveAnswererOverride(options),
844
+ skipJudge: options.skipJudge,
845
+ ...(reporter ? { observer: reporter } : {}),
846
+ abortSignal: controller.signal,
847
+ concurrency,
848
+ subjectRoot,
849
+ profileId: options.profile,
850
+ });
851
+ results = suite.results;
852
+ reporter?.setSuiteDir(suite.suiteDir);
853
+ if (controller.signal.aborted)
854
+ failWith(SIGINT_EXIT_CODE);
855
+ if (results.some(isFailure)) {
856
+ throw new Errors.IncurError({
857
+ code: "SUITE_FAILED",
858
+ message: `${results.filter(isFailure).length} of ${results.length} case attempts failed. Suite: ${suite.suiteDir}`,
859
+ exitCode: 1,
860
+ });
861
+ }
862
+ return {
863
+ suiteDir: suite.suiteDir,
864
+ results: results.map((result) => ({
865
+ caseId: result.caseId,
866
+ runDir: result.runDir ?? null,
867
+ exitReason: result.exitReason,
868
+ casePassed: result.casePassed,
869
+ caseScore: result.result?.grading?.caseScore ?? null,
870
+ assertionsPassed: result.result?.grading?.assertions.filter((assertion) => assertion.passed).length ?? 0,
871
+ assertionsTotal: result.result?.grading?.assertions.filter((assertion) => assertion.passed !== null)
872
+ .length ?? 0,
873
+ })),
874
+ };
875
+ }
876
+ finally {
877
+ reporter?.finish();
878
+ }
879
+ }
880
+ catch (e_3) {
881
+ env_3.error = e_3;
882
+ env_3.hasError = true;
746
883
  }
747
884
  finally {
748
- reporter.finish();
885
+ __disposeResources(env_3);
749
886
  }
750
- if (controller.signal.aborted)
751
- failWith(SIGINT_EXIT_CODE);
752
- else if (results.some(isFailure))
753
- failWith(1);
754
887
  };
755
888
  // Internal exports for testing
756
- export { expandLoop, isFailure, parsePositiveInt, partitionFilters, resolveConcurrency, selectSuite, };
889
+ export { isFailure, resolveConcurrency };
757
890
  //# sourceMappingURL=program.js.map