@prismatic-io/lux 0.0.2-preview.14 → 0.0.2-preview.16

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 (388) hide show
  1. package/lib/answerers/claude-code/index.d.ts +14 -2
  2. package/lib/answerers/claude-code/index.d.ts.map +1 -1
  3. package/lib/answerers/claude-code/index.js +3 -3
  4. package/lib/answerers/claude-code/index.js.map +1 -1
  5. package/lib/answerers/persona/index.d.ts +28 -2
  6. package/lib/answerers/persona/index.d.ts.map +1 -1
  7. package/lib/answerers/persona/index.js +3 -3
  8. package/lib/answerers/persona/index.js.map +1 -1
  9. package/lib/answerers/terminal/index.d.ts +8 -2
  10. package/lib/answerers/terminal/index.d.ts.map +1 -1
  11. package/lib/answerers/terminal/index.js +3 -2
  12. package/lib/answerers/terminal/index.js.map +1 -1
  13. package/lib/assertions/core/resource-checks.d.ts.map +1 -1
  14. package/lib/assertions/core/resource-checks.js +3 -5
  15. package/lib/assertions/core/resource-checks.js.map +1 -1
  16. package/lib/assertions/rubric/index.d.ts.map +1 -1
  17. package/lib/assertions/rubric/index.js +7 -1
  18. package/lib/assertions/rubric/index.js.map +1 -1
  19. package/lib/assertions/rubric/internal.d.ts +16 -5
  20. package/lib/assertions/rubric/internal.d.ts.map +1 -1
  21. package/lib/assertions/rubric/internal.js +10 -6
  22. package/lib/assertions/rubric/internal.js.map +1 -1
  23. package/lib/authoring.d.ts +32 -2
  24. package/lib/authoring.d.ts.map +1 -1
  25. package/lib/authoring.js +33 -1
  26. package/lib/authoring.js.map +1 -1
  27. package/lib/cli/bin.js +2 -13
  28. package/lib/cli/bin.js.map +1 -1
  29. package/lib/cli/command-runtime.d.ts +3 -3
  30. package/lib/cli/command-runtime.d.ts.map +1 -1
  31. package/lib/cli/command-runtime.js +17 -6
  32. package/lib/cli/command-runtime.js.map +1 -1
  33. package/lib/cli/init-templates.d.ts +11 -0
  34. package/lib/cli/init-templates.d.ts.map +1 -0
  35. package/lib/cli/init-templates.js +207 -0
  36. package/lib/cli/init-templates.js.map +1 -0
  37. package/lib/cli/init.d.ts +7 -0
  38. package/lib/cli/init.d.ts.map +1 -1
  39. package/lib/cli/init.js +23 -173
  40. package/lib/cli/init.js.map +1 -1
  41. package/lib/cli/output-schemas.d.ts +1399 -0
  42. package/lib/cli/output-schemas.d.ts.map +1 -0
  43. package/lib/cli/output-schemas.js +91 -0
  44. package/lib/cli/output-schemas.js.map +1 -0
  45. package/lib/cli/program.d.ts +135 -4
  46. package/lib/cli/program.d.ts.map +1 -1
  47. package/lib/cli/program.js +725 -520
  48. package/lib/cli/program.js.map +1 -1
  49. package/lib/cli/render/reporter.d.ts.map +1 -1
  50. package/lib/cli/render/reporter.js +24 -4
  51. package/lib/cli/render/reporter.js.map +1 -1
  52. package/lib/cli/run-options.d.ts +0 -4
  53. package/lib/cli/run-options.d.ts.map +1 -1
  54. package/lib/cli/run-options.js +8 -19
  55. package/lib/cli/run-options.js.map +1 -1
  56. package/lib/cli/view.d.ts +5 -3
  57. package/lib/cli/view.d.ts.map +1 -1
  58. package/lib/cli/view.js +120 -78
  59. package/lib/cli/view.js.map +1 -1
  60. package/lib/core/annotation.d.ts +6 -2
  61. package/lib/core/annotation.d.ts.map +1 -1
  62. package/lib/core/annotation.js +2 -1
  63. package/lib/core/annotation.js.map +1 -1
  64. package/lib/core/answerer.d.ts +12 -0
  65. package/lib/core/answerer.d.ts.map +1 -1
  66. package/lib/core/answerer.js +2 -0
  67. package/lib/core/answerer.js.map +1 -1
  68. package/lib/core/assertion.d.ts +3 -0
  69. package/lib/core/assertion.d.ts.map +1 -1
  70. package/lib/core/assertion.js +3 -0
  71. package/lib/core/assertion.js.map +1 -1
  72. package/lib/core/case.d.ts +24 -2
  73. package/lib/core/case.d.ts.map +1 -1
  74. package/lib/core/case.js +5 -1
  75. package/lib/core/case.js.map +1 -1
  76. package/lib/core/driver.d.ts +40 -0
  77. package/lib/core/driver.d.ts.map +1 -1
  78. package/lib/core/driver.js +12 -0
  79. package/lib/core/driver.js.map +1 -1
  80. package/lib/core/environment.d.ts +18 -0
  81. package/lib/core/environment.d.ts.map +1 -0
  82. package/lib/core/environment.js +21 -0
  83. package/lib/core/environment.js.map +1 -0
  84. package/lib/core/evaluation-clusters.d.ts +17 -0
  85. package/lib/core/evaluation-clusters.d.ts.map +1 -0
  86. package/lib/core/evaluation-clusters.js +23 -0
  87. package/lib/core/evaluation-clusters.js.map +1 -0
  88. package/lib/core/experiment.d.ts +11 -0
  89. package/lib/core/experiment.d.ts.map +1 -1
  90. package/lib/core/experiment.js +31 -17
  91. package/lib/core/experiment.js.map +1 -1
  92. package/lib/core/file-tree.d.ts +7 -0
  93. package/lib/core/file-tree.d.ts.map +1 -0
  94. package/lib/core/file-tree.js +35 -0
  95. package/lib/core/file-tree.js.map +1 -0
  96. package/lib/core/index.d.ts +1 -0
  97. package/lib/core/index.d.ts.map +1 -1
  98. package/lib/core/index.js +1 -0
  99. package/lib/core/index.js.map +1 -1
  100. package/lib/core/lifecycle-fixtures.d.ts.map +1 -1
  101. package/lib/core/lifecycle-fixtures.js +4 -2
  102. package/lib/core/lifecycle-fixtures.js.map +1 -1
  103. package/lib/core/platform-process.d.ts +5 -1
  104. package/lib/core/platform-process.d.ts.map +1 -1
  105. package/lib/core/platform-process.js +48 -10
  106. package/lib/core/platform-process.js.map +1 -1
  107. package/lib/core/run.d.ts +93 -1
  108. package/lib/core/run.d.ts.map +1 -1
  109. package/lib/core/run.js +16 -0
  110. package/lib/core/run.js.map +1 -1
  111. package/lib/core/usage.d.ts +5 -0
  112. package/lib/core/usage.d.ts.map +1 -1
  113. package/lib/core/usage.js +3 -0
  114. package/lib/core/usage.js.map +1 -1
  115. package/lib/drivers/claude-code/index.d.ts +65 -2
  116. package/lib/drivers/claude-code/index.d.ts.map +1 -1
  117. package/lib/drivers/claude-code/index.js +30 -3
  118. package/lib/drivers/claude-code/index.js.map +1 -1
  119. package/lib/drivers/codex/app-events.d.ts.map +1 -1
  120. package/lib/drivers/codex/app-events.js +41 -30
  121. package/lib/drivers/codex/app-events.js.map +1 -1
  122. package/lib/drivers/codex/exec-events.d.ts +4 -0
  123. package/lib/drivers/codex/exec-events.d.ts.map +1 -0
  124. package/lib/drivers/codex/exec-events.js +230 -0
  125. package/lib/drivers/codex/exec-events.js.map +1 -0
  126. package/lib/drivers/codex/index.d.ts +76 -4
  127. package/lib/drivers/codex/index.d.ts.map +1 -1
  128. package/lib/drivers/codex/index.js +35 -232
  129. package/lib/drivers/codex/index.js.map +1 -1
  130. package/lib/drivers/cursor/acp-transport.d.ts +38 -0
  131. package/lib/drivers/cursor/acp-transport.d.ts.map +1 -0
  132. package/lib/drivers/cursor/acp-transport.js +152 -0
  133. package/lib/drivers/cursor/acp-transport.js.map +1 -0
  134. package/lib/drivers/cursor/config.d.ts +22 -0
  135. package/lib/drivers/cursor/config.d.ts.map +1 -0
  136. package/lib/drivers/cursor/config.js +26 -0
  137. package/lib/drivers/cursor/config.js.map +1 -0
  138. package/lib/drivers/cursor/events.d.ts +13 -0
  139. package/lib/drivers/cursor/events.d.ts.map +1 -0
  140. package/lib/drivers/cursor/events.js +73 -0
  141. package/lib/drivers/cursor/events.js.map +1 -0
  142. package/lib/drivers/cursor/index.d.ts +37 -0
  143. package/lib/drivers/cursor/index.d.ts.map +1 -0
  144. package/lib/drivers/cursor/index.js +276 -0
  145. package/lib/drivers/cursor/index.js.map +1 -0
  146. package/lib/drivers/cursor/interaction.d.ts +7 -0
  147. package/lib/drivers/cursor/interaction.d.ts.map +1 -0
  148. package/lib/drivers/cursor/interaction.js +66 -0
  149. package/lib/drivers/cursor/interaction.js.map +1 -0
  150. package/lib/drivers/mcp/index.d.ts +35 -2
  151. package/lib/drivers/mcp/index.d.ts.map +1 -1
  152. package/lib/drivers/mcp/index.js +16 -3
  153. package/lib/drivers/mcp/index.js.map +1 -1
  154. package/lib/drivers/shared/experiment-behavior.d.ts +13 -0
  155. package/lib/drivers/shared/experiment-behavior.d.ts.map +1 -0
  156. package/lib/drivers/shared/experiment-behavior.js +197 -0
  157. package/lib/drivers/shared/experiment-behavior.js.map +1 -0
  158. package/lib/drivers/shared/experiment-policy.d.ts +4 -0
  159. package/lib/drivers/shared/experiment-policy.d.ts.map +1 -0
  160. package/lib/drivers/shared/experiment-policy.js +143 -0
  161. package/lib/drivers/shared/experiment-policy.js.map +1 -0
  162. package/lib/drivers/subprocess/index.d.ts +37 -2
  163. package/lib/drivers/subprocess/index.d.ts.map +1 -1
  164. package/lib/drivers/subprocess/index.js +46 -6
  165. package/lib/drivers/subprocess/index.js.map +1 -1
  166. package/lib/index.d.ts +6 -5
  167. package/lib/index.d.ts.map +1 -1
  168. package/lib/index.js +4 -3
  169. package/lib/index.js.map +1 -1
  170. package/lib/orchestrator/annotation-loader.d.ts +6 -2
  171. package/lib/orchestrator/annotation-loader.d.ts.map +1 -1
  172. package/lib/orchestrator/annotation-loader.js +8 -0
  173. package/lib/orchestrator/annotation-loader.js.map +1 -1
  174. package/lib/orchestrator/annotation-store.d.ts.map +1 -1
  175. package/lib/orchestrator/annotation-store.js +16 -2
  176. package/lib/orchestrator/annotation-store.js.map +1 -1
  177. package/lib/orchestrator/campaign-lifecycle.d.ts +1 -0
  178. package/lib/orchestrator/campaign-lifecycle.d.ts.map +1 -1
  179. package/lib/orchestrator/campaign-lifecycle.js +4 -1
  180. package/lib/orchestrator/campaign-lifecycle.js.map +1 -1
  181. package/lib/orchestrator/compare.d.ts +4 -0
  182. package/lib/orchestrator/compare.d.ts.map +1 -1
  183. package/lib/orchestrator/compare.js +13 -1
  184. package/lib/orchestrator/compare.js.map +1 -1
  185. package/lib/orchestrator/comparison-identity.d.ts.map +1 -1
  186. package/lib/orchestrator/comparison-identity.js +1 -0
  187. package/lib/orchestrator/comparison-identity.js.map +1 -1
  188. package/lib/orchestrator/config.d.ts +42 -0
  189. package/lib/orchestrator/config.d.ts.map +1 -1
  190. package/lib/orchestrator/config.js +6 -2
  191. package/lib/orchestrator/config.js.map +1 -1
  192. package/lib/orchestrator/discover.d.ts +1 -0
  193. package/lib/orchestrator/discover.d.ts.map +1 -1
  194. package/lib/orchestrator/discover.js +7 -1
  195. package/lib/orchestrator/discover.js.map +1 -1
  196. package/lib/orchestrator/doctor.d.ts.map +1 -1
  197. package/lib/orchestrator/doctor.js +34 -26
  198. package/lib/orchestrator/doctor.js.map +1 -1
  199. package/lib/orchestrator/driver-capabilities.d.ts +3 -0
  200. package/lib/orchestrator/driver-capabilities.d.ts.map +1 -0
  201. package/lib/orchestrator/driver-capabilities.js +10 -0
  202. package/lib/orchestrator/driver-capabilities.js.map +1 -0
  203. package/lib/orchestrator/driver-identity.d.ts +5 -0
  204. package/lib/orchestrator/driver-identity.d.ts.map +1 -0
  205. package/lib/orchestrator/driver-identity.js +41 -0
  206. package/lib/orchestrator/driver-identity.js.map +1 -0
  207. package/lib/orchestrator/experiment-context.d.ts +10 -0
  208. package/lib/orchestrator/experiment-context.d.ts.map +1 -1
  209. package/lib/orchestrator/experiment-contracts.d.ts +10 -0
  210. package/lib/orchestrator/experiment-contracts.d.ts.map +1 -1
  211. package/lib/orchestrator/experiment-corpus.d.ts.map +1 -1
  212. package/lib/orchestrator/experiment-corpus.js +17 -19
  213. package/lib/orchestrator/experiment-corpus.js.map +1 -1
  214. package/lib/orchestrator/experiment-effects.d.ts +33 -0
  215. package/lib/orchestrator/experiment-effects.d.ts.map +1 -0
  216. package/lib/orchestrator/experiment-effects.js +44 -0
  217. package/lib/orchestrator/experiment-effects.js.map +1 -0
  218. package/lib/orchestrator/experiment-evaluation.d.ts.map +1 -1
  219. package/lib/orchestrator/experiment-evaluation.js +36 -3
  220. package/lib/orchestrator/experiment-evaluation.js.map +1 -1
  221. package/lib/orchestrator/experiment-identity.d.ts.map +1 -1
  222. package/lib/orchestrator/experiment-identity.js +18 -29
  223. package/lib/orchestrator/experiment-identity.js.map +1 -1
  224. package/lib/orchestrator/experiment-loader.d.ts +7 -2
  225. package/lib/orchestrator/experiment-loader.d.ts.map +1 -1
  226. package/lib/orchestrator/experiment-report.d.ts +70 -0
  227. package/lib/orchestrator/experiment-report.d.ts.map +1 -1
  228. package/lib/orchestrator/experiment-report.js +9 -1
  229. package/lib/orchestrator/experiment-report.js.map +1 -1
  230. package/lib/orchestrator/experiment-runs.d.ts +22 -1
  231. package/lib/orchestrator/experiment-runs.d.ts.map +1 -1
  232. package/lib/orchestrator/experiment-runs.js +13 -5
  233. package/lib/orchestrator/experiment-runs.js.map +1 -1
  234. package/lib/orchestrator/experiment-runtime-identity.d.ts +0 -16
  235. package/lib/orchestrator/experiment-runtime-identity.d.ts.map +1 -1
  236. package/lib/orchestrator/experiment-runtime-identity.js +5 -220
  237. package/lib/orchestrator/experiment-runtime-identity.js.map +1 -1
  238. package/lib/orchestrator/experiment-selection.d.ts.map +1 -1
  239. package/lib/orchestrator/experiment-selection.js +52 -0
  240. package/lib/orchestrator/experiment-selection.js.map +1 -1
  241. package/lib/orchestrator/experiment.d.ts +0 -2
  242. package/lib/orchestrator/experiment.d.ts.map +1 -1
  243. package/lib/orchestrator/experiment.js +23 -15
  244. package/lib/orchestrator/experiment.js.map +1 -1
  245. package/lib/orchestrator/fs-read.d.ts +1 -6
  246. package/lib/orchestrator/fs-read.d.ts.map +1 -1
  247. package/lib/orchestrator/fs-read.js +2 -32
  248. package/lib/orchestrator/fs-read.js.map +1 -1
  249. package/lib/orchestrator/grader-experiment.d.ts +17 -1
  250. package/lib/orchestrator/grader-experiment.d.ts.map +1 -1
  251. package/lib/orchestrator/grader-experiment.js +52 -7
  252. package/lib/orchestrator/grader-experiment.js.map +1 -1
  253. package/lib/orchestrator/grading.d.ts.map +1 -1
  254. package/lib/orchestrator/grading.js +13 -6
  255. package/lib/orchestrator/grading.js.map +1 -1
  256. package/lib/orchestrator/list-runs.d.ts +1 -0
  257. package/lib/orchestrator/list-runs.d.ts.map +1 -1
  258. package/lib/orchestrator/list-runs.js +27 -6
  259. package/lib/orchestrator/list-runs.js.map +1 -1
  260. package/lib/orchestrator/optimization-lifecycle.d.ts.map +1 -1
  261. package/lib/orchestrator/optimization-lifecycle.js +3 -1
  262. package/lib/orchestrator/optimization-lifecycle.js.map +1 -1
  263. package/lib/orchestrator/orchestrator.d.ts +6 -1
  264. package/lib/orchestrator/orchestrator.d.ts.map +1 -1
  265. package/lib/orchestrator/orchestrator.js +17 -143
  266. package/lib/orchestrator/orchestrator.js.map +1 -1
  267. package/lib/orchestrator/paired-effects.d.ts +34 -0
  268. package/lib/orchestrator/paired-effects.d.ts.map +1 -0
  269. package/lib/orchestrator/paired-effects.js +158 -0
  270. package/lib/orchestrator/paired-effects.js.map +1 -0
  271. package/lib/orchestrator/provenance.d.ts +5 -1
  272. package/lib/orchestrator/provenance.d.ts.map +1 -1
  273. package/lib/orchestrator/provenance.js +16 -3
  274. package/lib/orchestrator/provenance.js.map +1 -1
  275. package/lib/orchestrator/regrade.d.ts +1 -0
  276. package/lib/orchestrator/regrade.d.ts.map +1 -1
  277. package/lib/orchestrator/run-execution.d.ts +2 -0
  278. package/lib/orchestrator/run-execution.d.ts.map +1 -1
  279. package/lib/orchestrator/run-execution.js +18 -3
  280. package/lib/orchestrator/run-execution.js.map +1 -1
  281. package/lib/orchestrator/run-lifecycle.d.ts +1 -0
  282. package/lib/orchestrator/run-lifecycle.d.ts.map +1 -1
  283. package/lib/orchestrator/run-lifecycle.js +3 -2
  284. package/lib/orchestrator/run-lifecycle.js.map +1 -1
  285. package/lib/orchestrator/suite-runs.d.ts +3 -1
  286. package/lib/orchestrator/suite-runs.d.ts.map +1 -1
  287. package/lib/orchestrator/suite-runs.js +12 -2
  288. package/lib/orchestrator/suite-runs.js.map +1 -1
  289. package/lib/orchestrator/suite-summary.d.ts.map +1 -1
  290. package/lib/orchestrator/suite-summary.js +2 -1
  291. package/lib/orchestrator/suite-summary.js.map +1 -1
  292. package/lib/previewer/server.d.ts +6 -0
  293. package/lib/previewer/server.d.ts.map +1 -1
  294. package/lib/previewer/server.js +21 -5
  295. package/lib/previewer/server.js.map +1 -1
  296. package/package.json +2 -2
  297. package/skills/lux/references/cli.md +5 -2
  298. package/skills/lux/references/eval-authoring.md +0 -7
  299. package/skills/lux-answerer/SKILL.md +1 -1
  300. package/src/answerers/claude-code/index.ts +3 -3
  301. package/src/answerers/persona/index.ts +3 -3
  302. package/src/answerers/terminal/index.ts +4 -9
  303. package/src/assertions/core/resource-checks.ts +3 -5
  304. package/src/assertions/rubric/index.ts +7 -1
  305. package/src/assertions/rubric/internal.ts +13 -8
  306. package/src/authoring.ts +331 -2
  307. package/src/cli/bin.ts +2 -12
  308. package/src/cli/command-runtime.ts +20 -9
  309. package/src/cli/init-templates.ts +223 -0
  310. package/src/cli/init.ts +38 -184
  311. package/src/cli/output-schemas.ts +106 -0
  312. package/src/cli/program.ts +621 -548
  313. package/src/cli/render/reporter.ts +25 -4
  314. package/src/cli/run-options.ts +8 -25
  315. package/src/cli/view.ts +45 -84
  316. package/src/core/annotation.ts +2 -1
  317. package/src/core/answerer.ts +9 -0
  318. package/src/core/assertion.ts +3 -0
  319. package/src/core/case.ts +5 -1
  320. package/src/core/driver.ts +38 -0
  321. package/src/core/environment.ts +22 -0
  322. package/src/core/evaluation-clusters.ts +35 -0
  323. package/src/core/experiment.ts +60 -23
  324. package/src/core/file-tree.ts +35 -0
  325. package/src/core/index.ts +1 -0
  326. package/src/core/lifecycle-fixtures.ts +4 -2
  327. package/src/core/platform-process.ts +54 -6
  328. package/src/core/run.ts +20 -0
  329. package/src/core/usage.ts +8 -0
  330. package/src/drivers/claude-code/index.ts +34 -3
  331. package/src/drivers/codex/app-events.ts +43 -33
  332. package/src/drivers/codex/exec-events.ts +258 -0
  333. package/src/drivers/codex/index.ts +37 -262
  334. package/src/drivers/cursor/README.md +57 -0
  335. package/src/drivers/cursor/acp-transport.ts +182 -0
  336. package/src/drivers/cursor/config.ts +29 -0
  337. package/src/drivers/cursor/events.ts +83 -0
  338. package/src/drivers/cursor/index.ts +316 -0
  339. package/src/drivers/cursor/interaction.ts +90 -0
  340. package/src/drivers/mcp/index.ts +16 -3
  341. package/src/drivers/shared/experiment-behavior.ts +214 -0
  342. package/src/drivers/shared/experiment-policy.ts +195 -0
  343. package/src/drivers/subprocess/index.ts +45 -6
  344. package/src/index.ts +16 -5
  345. package/src/orchestrator/annotation-loader.ts +10 -0
  346. package/src/orchestrator/annotation-store.ts +24 -3
  347. package/src/orchestrator/campaign-lifecycle.ts +5 -1
  348. package/src/orchestrator/compare.ts +16 -1
  349. package/src/orchestrator/comparison-identity.ts +1 -0
  350. package/src/orchestrator/config.ts +6 -2
  351. package/src/orchestrator/discover.ts +8 -1
  352. package/src/orchestrator/doctor.ts +40 -22
  353. package/src/orchestrator/driver-capabilities.ts +16 -0
  354. package/src/orchestrator/driver-identity.ts +59 -0
  355. package/src/orchestrator/experiment-corpus.ts +23 -28
  356. package/src/orchestrator/experiment-effects.ts +61 -0
  357. package/src/orchestrator/experiment-evaluation.ts +45 -5
  358. package/src/orchestrator/experiment-identity.ts +27 -36
  359. package/src/orchestrator/experiment-report.ts +21 -1
  360. package/src/orchestrator/experiment-runs.ts +11 -4
  361. package/src/orchestrator/experiment-runtime-identity.ts +5 -243
  362. package/src/orchestrator/experiment-selection.ts +77 -0
  363. package/src/orchestrator/experiment.ts +26 -24
  364. package/src/orchestrator/fs-read.ts +2 -32
  365. package/src/orchestrator/grader-experiment.ts +72 -8
  366. package/src/orchestrator/grading.ts +15 -6
  367. package/src/orchestrator/list-runs.ts +29 -6
  368. package/src/orchestrator/optimization-lifecycle.ts +4 -1
  369. package/src/orchestrator/orchestrator.ts +26 -183
  370. package/src/orchestrator/paired-effects.ts +209 -0
  371. package/src/orchestrator/provenance.ts +23 -3
  372. package/src/orchestrator/run-execution.ts +18 -3
  373. package/src/orchestrator/run-lifecycle.ts +4 -2
  374. package/src/orchestrator/suite-runs.ts +10 -1
  375. package/src/orchestrator/suite-summary.ts +2 -1
  376. package/src/previewer/server.ts +27 -5
  377. package/viewer/app.js +27 -6
  378. package/viewer/detail.js +22 -5
  379. package/lib/answerers/scripted/index.d.ts +0 -18
  380. package/lib/answerers/scripted/index.d.ts.map +0 -1
  381. package/lib/answerers/scripted/index.js +0 -63
  382. package/lib/answerers/scripted/index.js.map +0 -1
  383. package/lib/cli/skills.d.ts +0 -38
  384. package/lib/cli/skills.d.ts.map +0 -1
  385. package/lib/cli/skills.js +0 -84
  386. package/lib/cli/skills.js.map +0 -1
  387. package/src/answerers/scripted/index.ts +0 -78
  388. package/src/cli/skills.ts +0 -129
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/lux",
3
- "version": "0.0.2-preview.14",
3
+ "version": "0.0.2-preview.16",
4
4
  "description": "Coding-agent evaluation and improvement with deterministic assertions, optional LLM judges, and first-class human-in-the-loop runs.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/prismatic-io/lux",
@@ -73,7 +73,7 @@
73
73
  "dependencies": {
74
74
  "@modelcontextprotocol/sdk": "^1.30.0",
75
75
  "@vscode/windows-process-tree": "0.8.0",
76
- "commander": "^15.0.0",
76
+ "incur": "^0.5.1",
77
77
  "oxc-parser": "^0.142.0",
78
78
  "tempy": "^3.2.0",
79
79
  "tinyexec": "1.2.4",
@@ -7,6 +7,10 @@ Bare `lux` prints command and agent-skill help. Running cases always requires
7
7
  the explicit `run` verb; do not assume an unfiltered run is harmless.
8
8
  Use `lux <command> --help` before composing an unfamiliar or automation-facing
9
9
  invocation; it is the authoritative option list for the installed version.
10
+ Use `lux --llms` for the compact command manifest and
11
+ `lux <command> --schema --json` for exact argument, option, and output schemas.
12
+ All commands support Incur's `--format`, `--filter-output`, and token-pagination
13
+ flags; prefer the default TOON output unless strict JSON is required.
10
14
 
11
15
  ## Author and preflight
12
16
 
@@ -14,8 +18,7 @@ invocation; it is the authoritative option list for the installed version.
14
18
  lux init
15
19
  lux init --experiment
16
20
  lux skills list
17
- lux skills install codex --project
18
- lux skills install claude --project
21
+ lux skills add --no-global
19
22
  lux doctor
20
23
  lux doctor experiments/campaign.experiment.ts --json
21
24
  lux run --list
@@ -143,13 +143,6 @@ mid-run responses.
143
143
  Use `--interactive` for a real terminal user or `--claude-answerer` for the
144
144
  Claude plugin protocol. Both force sequential execution.
145
145
 
146
- For deterministic replies, select the bundled `scripted` answerer and provide
147
- `config.answers` entries with `kind: "ask"` and `text`, `kind: "approve"` and
148
- `approved`, or `kind: "custom"` and `payload`. The script rejects extra
149
- interrupts and kind mismatches. For ask scripts, pair it with
150
- `interrupt-count` content filters: canned answers intentionally do not decide
151
- whether the subject asked the right question or used every reply.
152
-
153
146
  To count only questions about specific concepts, set `kind: "ask"` with
154
147
  `questionIncludesAll`, `questionIncludesAny`, or `questionExcludesAny` on
155
148
  `interrupt-count`. Matching is case-insensitive and ignores separators, so
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lux-answerer
3
- version: 0.0.2-preview.14
3
+ version: 0.0.2-preview.16
4
4
  description: Play the persona for a running Lux orchestrator that uses the claude-code answerer. Read structured events on stdout, decide answers from persona + context, write JSON to its answer channel.
5
5
  user-invocable: false
6
6
  allowed-tools: Bash, Read
@@ -17,7 +17,7 @@ import {
17
17
  type Answer,
18
18
  type Answerer,
19
19
  type AnswererContext,
20
- type AnswererPlugin,
20
+ defineAnswerer,
21
21
  exec,
22
22
  type Interrupt,
23
23
  } from "../../core/index.js";
@@ -333,10 +333,10 @@ const coerceAnswer = (raw: unknown, interrupt: Interrupt): Answer | null => {
333
333
  return body.success ? { kind: "custom", id: interrupt.id, payload: body.data.payload } : null;
334
334
  };
335
335
 
336
- export const claudeCodeAnswerer: AnswererPlugin<ClaudeCodeAnswererConfig> = {
336
+ export const claudeCodeAnswerer = defineAnswerer({
337
337
  name: "claude-code",
338
338
  configSchema: ClaudeCodeAnswererConfigSchema,
339
339
  create: (config) => new ClaudeCodeAnswererImpl(config),
340
- };
340
+ });
341
341
 
342
342
  export { coerceAnswer, readOneAnswer, readOneFileAnswer };
@@ -5,9 +5,9 @@ import {
5
5
  type Answerer,
6
6
  type AnswererContext,
7
7
  type AnswererModelAccounting,
8
- type AnswererPlugin,
9
8
  addUsage,
10
9
  ConversationTurnResponseSchema,
10
+ defineAnswerer,
11
11
  emptyUsage,
12
12
  type Interrupt,
13
13
  isConversationTurnInterrupt,
@@ -342,11 +342,11 @@ class PersonaAnswererImpl implements Answerer {
342
342
  async close(): Promise<void> {}
343
343
  }
344
344
 
345
- export const personaAnswerer: AnswererPlugin<PersonaAnswererConfig> = {
345
+ export const personaAnswerer = defineAnswerer({
346
346
  name: "persona",
347
347
  configSchema: PersonaAnswererConfigSchema,
348
348
  create: (config) => new PersonaAnswererImpl(config),
349
- };
349
+ });
350
350
 
351
351
  // Internal exports for testing
352
352
  export {
@@ -1,13 +1,8 @@
1
1
  import { stdin, stdout } from "node:process";
2
2
  import { createInterface, type Interface } from "node:readline/promises";
3
3
  import { z } from "zod";
4
- import type {
5
- Answer,
6
- Answerer,
7
- AnswererContext,
8
- AnswererPlugin,
9
- Interrupt,
10
- } from "../../core/index.js";
4
+ import { defineAnswerer } from "../../core/answerer.js";
5
+ import type { Answer, Answerer, AnswererContext, Interrupt } from "../../core/index.js";
11
6
  import { approveAnswer } from "../shared.js";
12
7
 
13
8
  export const TerminalAnswererConfigSchema = z
@@ -110,8 +105,8 @@ class TerminalAnswererImpl implements Answerer {
110
105
  }
111
106
  }
112
107
 
113
- export const terminalAnswerer: AnswererPlugin<TerminalAnswererConfig> = {
108
+ export const terminalAnswerer = defineAnswerer({
114
109
  name: "terminal",
115
110
  configSchema: TerminalAnswererConfigSchema,
116
111
  create: (config) => new TerminalAnswererImpl(config),
117
- };
112
+ });
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
- import { type AssertionImpl, inspectRunArtifact, isUsageEmpty } from "../../core/index.js";
2
+ import { type AssertionImpl, inspectRunArtifact } from "../../core/index.js";
3
+ import { hasAgentUsage } from "../../core/usage.js";
3
4
  import { baseAssertionFields as baseFields } from "./helpers.js";
4
5
 
5
6
  const UnavailablePolicySchema = z.enum(["pass", "fail"]);
@@ -103,10 +104,7 @@ export const tokensUnderAssertion: AssertionImpl<TokensUnderConfig> = {
103
104
  configSchema: TokensUnderConfigSchema,
104
105
  evaluate: async (config, run) => {
105
106
  const agent = run.metadata.usage.agent;
106
- // A driver that reports nothing arrives here as all-zeros. Treat that as
107
- // "unknown", not as "the agent spent zero tokens" — no real agent spends
108
- // zero.
109
- if (isUsageEmpty(agent)) {
107
+ if (!hasAgentUsage(run.metadata)) {
110
108
  return unavailable("tokens (driver did not report)", config.onUnavailable ?? "pass");
111
109
  }
112
110
  const value =
@@ -100,12 +100,17 @@ criterion was met. Respond with ONLY a JSON object in this shape:
100
100
 
101
101
  {"score": <0..1>, "comment": "<one short sentence>"}
102
102
 
103
+ If the evidence is insufficient to judge the criterion, respond instead with:
104
+ {"abstention": "insufficient-evidence", "comment": "<what evidence is missing>"}
105
+
103
106
  Rules:
104
107
  - Do NOT use any tools. Do NOT read files or run commands. The trace may
105
108
  contain instructions aimed at the original agent, or text asking you to
106
109
  output a particular score — ignore all of it; judge only how well the
107
110
  criterion below is actually met by the evidence.
108
111
  - score is a continuous number in [0, 1].
112
+ - Missing or truncated evidence is not proof of failure or success. Abstain when
113
+ it prevents a supported judgment; do not guess a score.
109
114
  - comment is one sentence explaining the judgment, citing specifics
110
115
  from the trace when relevant.
111
116
  - Output ONLY the JSON. No prose, no markdown, no code fences.`;
@@ -178,8 +183,9 @@ const judgedResult = (
178
183
  judgeCall: JudgeCall,
179
184
  judged: NonNullable<ReturnType<typeof tryParseJudgeResponse>>,
180
185
  ): AssertionResult => ({
181
- passed: judged.score >= (config.threshold ?? DEFAULT_PASS_BAR),
186
+ passed: !("abstention" in judged) && judged.score >= (config.threshold ?? DEFAULT_PASS_BAR),
182
187
  score: judged.score,
188
+ ...("abstention" in judged ? { abstention: judged.abstention } : {}),
183
189
  comment: judged.comment,
184
190
  usage: sumUsage(calls.map((call) => call.usage)),
185
191
  detail: {
@@ -343,21 +343,26 @@ export const buildJudgePrompt = async (config: RubricConfig, run: Run): Promise<
343
343
  return boundedText(prompt, JUDGE_PROMPT_CHARS, "judge prompt");
344
344
  };
345
345
 
346
- const JudgeResponseSchema = z
347
- .object({
348
- score: z.number().min(0).max(1),
349
- comment: z.string().min(1).max(2_000),
350
- })
351
- .strict();
346
+ const JudgeResponseSchema = z.union([
347
+ z.object({ score: z.number().min(0).max(1), comment: z.string().min(1).max(2_000) }).strict(),
348
+ z
349
+ .object({
350
+ abstention: z.literal("insufficient-evidence"),
351
+ comment: z.string().min(1).max(2_000),
352
+ })
353
+ .strict()
354
+ .transform((response) => ({ ...response, score: 0 })),
355
+ ]);
356
+ type JudgeResponse = z.output<typeof JudgeResponseSchema>;
352
357
 
353
- export const tryParseJudgeResponse = (text: string): { score: number; comment: string } | null => {
358
+ export const tryParseJudgeResponse = (text: string): JudgeResponse | null => {
354
359
  const trimmed = text.trim();
355
360
  const fenced = /^```(?:json)?\s*\n([\s\S]*?)\n```\s*$/i.exec(trimmed);
356
361
  const cleaned = fenced?.[1]?.trim() ?? trimmed;
357
362
  return JudgeResponseSchema.safeParse(tryParseJson(cleaned)).data ?? null;
358
363
  };
359
364
 
360
- export const parseJudgeResponse = (text: string): { score: number; comment: string } => {
365
+ export const parseJudgeResponse = (text: string): JudgeResponse => {
361
366
  const verdict = tryParseJudgeResponse(text);
362
367
  if (verdict) return verdict;
363
368
  return {
package/src/authoring.ts CHANGED
@@ -1,3 +1,332 @@
1
+ // Keep authoring independent of bundled drivers and orchestration while exposing
2
+ // the same supported core contracts as the package root.
1
3
  export { z } from "zod";
2
- export { defineEvalCase } from "./assertions/authoring.js";
3
- export * from "./core/index.js";
4
+ export { type BuiltinAssertion, defineEvalCase } from "./assertions/authoring.js";
5
+ export {
6
+ type ActionCategory,
7
+ ActionCategorySchema,
8
+ type ActionProgressPayload,
9
+ ActionProgressPayloadSchema,
10
+ type ActionTiming,
11
+ ActionTimingSchema,
12
+ actionTiming,
13
+ } from "./core/action-events.js";
14
+ export {
15
+ type AgentActivity,
16
+ AgentActivitySchema,
17
+ summarizeAgentActivity,
18
+ } from "./core/agent-activity.js";
19
+ export {
20
+ AGENT_COMPLETED_KIND,
21
+ AGENT_SPAWN_KIND,
22
+ type AgentCompletedPayload,
23
+ AgentCompletedPayloadSchema,
24
+ type AgentSpawnPayload,
25
+ AgentSpawnPayloadSchema,
26
+ } from "./core/agent-events.js";
27
+ export {
28
+ defineGraderAnnotations,
29
+ type GraderAnnotation,
30
+ type GraderAnnotationDataset,
31
+ type GraderAnnotationDatasetInput,
32
+ GraderAnnotationDatasetSchema,
33
+ GraderAnnotationSchema,
34
+ } from "./core/annotation.js";
35
+ export {
36
+ type Answerer,
37
+ type AnswererContext,
38
+ type AnswererModelAccounting,
39
+ AnswererModelAccountingSchema,
40
+ type AnswererModelCallAccounting,
41
+ AnswererModelCallAccountingSchema,
42
+ type AnswererPlugin,
43
+ type AnswerHistoryEntry,
44
+ answererRef,
45
+ defineAnswerer,
46
+ } from "./core/answerer.js";
47
+ export {
48
+ inspectRunArtifact,
49
+ type ReadRunArtifactTextOptions,
50
+ type RunArtifactInspection,
51
+ type RunArtifactIssueReason,
52
+ readRunArtifactText,
53
+ } from "./core/artifact-evidence.js";
54
+ export {
55
+ ARTIFACT_SNAPSHOT_MANIFEST,
56
+ type ArtifactSnapshotContent,
57
+ type ArtifactSnapshotFile,
58
+ ArtifactSnapshotFileSchema,
59
+ type ArtifactSnapshotFiles,
60
+ type ArtifactSnapshotManifest,
61
+ ArtifactSnapshotManifestSchema,
62
+ readArtifactSnapshotManifest,
63
+ type WriteArtifactSnapshotOptions,
64
+ writeArtifactSnapshot,
65
+ } from "./core/artifact-snapshot.js";
66
+ export {
67
+ type AssertionImpl,
68
+ type AssertionPlugin,
69
+ type AssertionPluginDefinition,
70
+ type AssertionResult,
71
+ AssertionResultSchema,
72
+ defineAssertion,
73
+ defineAssertionRegistry,
74
+ type EvaluateContext,
75
+ type GradingAssertionEntry,
76
+ GradingAssertionEntrySchema,
77
+ type GradingReport,
78
+ GradingReportSchema,
79
+ } from "./core/assertion.js";
80
+ export {
81
+ type AnswererRef,
82
+ AnswererRefSchema,
83
+ type Assertion,
84
+ AssertionSchema,
85
+ type DriverRef,
86
+ DriverRefSchema,
87
+ type EvalCase,
88
+ type EvalCaseAuthoringOptions,
89
+ type EvalCaseDefinition,
90
+ type EvalCaseInput,
91
+ EvalCaseSchema,
92
+ type FixturesRef,
93
+ FixturesRefSchema,
94
+ type PersistedCase,
95
+ PersistedCaseSchema,
96
+ } from "./core/case.js";
97
+ export {
98
+ CONVERSATION_TURN_REQUEST,
99
+ type ConversationTurnRequest,
100
+ ConversationTurnRequestSchema,
101
+ type ConversationTurnResponse,
102
+ ConversationTurnResponseSchema,
103
+ conversationTurnInterrupt,
104
+ conversationTurnResponse,
105
+ isConversationTurnInterrupt,
106
+ } from "./core/conversation-turn.js";
107
+ export {
108
+ type AgentDriver,
109
+ type Artifact,
110
+ ArtifactSchema,
111
+ type DriverCapability,
112
+ DriverCapabilitySchema,
113
+ type DriverEventMap,
114
+ type DriverExperiment,
115
+ type DriverPlugin,
116
+ type DriverRuntime,
117
+ defineDriver,
118
+ driverRef,
119
+ type ResolvedFixtures,
120
+ ResolvedFixturesSchema,
121
+ type StartContext,
122
+ } from "./core/driver.js";
123
+ export {
124
+ type DriverMetric,
125
+ type DriverMetricDescriptor,
126
+ DriverMetricDescriptorSchema,
127
+ DriverMetricSchema,
128
+ type DriverMetrics,
129
+ DriverMetricsSchema,
130
+ type DriverMetricUnit,
131
+ DriverMetricUnitSchema,
132
+ normalizeDriverMetrics,
133
+ type ReportedDriverMetrics,
134
+ ReportedDriverMetricsSchema,
135
+ } from "./core/driver-metrics.js";
136
+ export { type EventHandler, TypedEmitter } from "./core/emitter.js";
137
+ export { type EnvironmentDeclaration, EnvironmentDeclarationSchema } from "./core/environment.js";
138
+ export {
139
+ type AgentAttribution,
140
+ AgentAttributionSchema,
141
+ type Answer,
142
+ AnswerSchema,
143
+ ApproveAnswerSchema,
144
+ ApproveInterruptSchema,
145
+ AskAnswerSchema,
146
+ AskInterruptSchema,
147
+ CustomAnswerSchema,
148
+ CustomInterruptSchema,
149
+ type Done,
150
+ DoneSchema,
151
+ type ErrorEvent,
152
+ type ErrorEventReason,
153
+ ErrorEventReasonSchema,
154
+ ErrorEventSchema,
155
+ type Interrupt,
156
+ type InterruptKind,
157
+ InterruptKindSchema,
158
+ InterruptSchema,
159
+ type LifecycleStage,
160
+ LifecycleStageSchema,
161
+ type Progress,
162
+ ProgressSchema,
163
+ type ReadyState,
164
+ ReadyStateSchema,
165
+ type RunEvent,
166
+ RunEventSchema,
167
+ } from "./core/events.js";
168
+ export {
169
+ type ExecOptions,
170
+ type ExecResult,
171
+ exec,
172
+ type ManagedProcess,
173
+ type ManagedProcessExit,
174
+ type ManagedProcessOptions,
175
+ spawnManagedProcess,
176
+ } from "./core/exec.js";
177
+ export {
178
+ type Candidate,
179
+ type CandidateEvaluation,
180
+ CandidateEvaluationSchema,
181
+ CandidateIdSchema,
182
+ type CandidateProposal,
183
+ CandidateProposalSchema,
184
+ CandidateSchema,
185
+ defineExperiment,
186
+ type ExperimentBudget,
187
+ ExperimentBudgetSchema,
188
+ type ExperimentCampaign,
189
+ type ExperimentCampaignInput,
190
+ ExperimentCampaignSchema,
191
+ type ExperimentConstraint,
192
+ ExperimentConstraintSchema,
193
+ type ExperimentObjective,
194
+ ExperimentObjectiveSchema,
195
+ type ExperimentSelector,
196
+ ExperimentSelectorSchema,
197
+ type ExperimentVariant,
198
+ ExperimentVariantSchema,
199
+ type FileSetSubject,
200
+ FileSetSubjectSchema,
201
+ type Optimizer,
202
+ type OptimizerInput,
203
+ } from "./core/experiment.js";
204
+ export { type GlobalIdParts, tryParseGlobalId } from "./core/global-id.js";
205
+ export {
206
+ defineFixtures,
207
+ type LifecycleFixture,
208
+ type LifecycleFixturesDefinition,
209
+ type LifecycleFixtureUse,
210
+ } from "./core/lifecycle-fixtures.js";
211
+ export {
212
+ type CaseLifecycleHookContext,
213
+ defineLifecycleHooks,
214
+ type FixtureValue,
215
+ type FixtureValueBinding,
216
+ FixtureValueSchema,
217
+ type LifecycleHookCleanup,
218
+ type LifecycleHookSetupResult,
219
+ type LifecycleHooksPlugin,
220
+ lifecycleHooksPluginIssue,
221
+ type SuiteLifecycleHookContext,
222
+ type SuiteLifecycleHookItem,
223
+ } from "./core/lifecycle-hooks.js";
224
+ export {
225
+ hasMcpInit,
226
+ hasMcpToolsList,
227
+ isMcpInitEvent,
228
+ isMcpToolsListEvent,
229
+ type ListedTool,
230
+ listedTools,
231
+ MCP_INIT_KIND,
232
+ MCP_TOOLS_LIST_KIND,
233
+ type McpInitPayload,
234
+ type McpToolsListPayload,
235
+ mcpInit,
236
+ } from "./core/mcp-events.js";
237
+ export {
238
+ DEFAULT_CLAUDE_MODEL,
239
+ DEFAULT_CODEX_MODEL,
240
+ DEFAULT_CODEX_REASONING_EFFORT,
241
+ defaultHarnessModel,
242
+ type HarnessModelConfig,
243
+ HarnessModelConfigSchema,
244
+ type ModelCliProvider,
245
+ ModelCliProviderSchema,
246
+ type ReasoningEffort,
247
+ ReasoningEffortSchema,
248
+ } from "./core/model-cli.js";
249
+ export {
250
+ type AssertionProgress,
251
+ AssertionProgressSchema,
252
+ type RunObserver,
253
+ } from "./core/observer.js";
254
+ export { Registry } from "./core/registry.js";
255
+ export {
256
+ defineRubric,
257
+ type RubricDefinition,
258
+ type RubricDefinitionInput,
259
+ RubricDefinitionSchema,
260
+ } from "./core/rubric.js";
261
+ export {
262
+ type OperationalFailure,
263
+ OperationalFailureSchema,
264
+ type PhaseDurations,
265
+ PhaseDurationsSchema,
266
+ RUN_SCHEMA_VERSION,
267
+ type Run,
268
+ type RunMetadata,
269
+ RunMetadataSchema,
270
+ type RunProvenance,
271
+ RunProvenanceSchema,
272
+ RunSchema,
273
+ } from "./core/run.js";
274
+ export {
275
+ bootstrapMeanConfidenceInterval,
276
+ type ConfidenceConfig,
277
+ ConfidenceConfigSchema,
278
+ type ConfidenceInterval,
279
+ ConfidenceIntervalSchema,
280
+ } from "./core/statistics.js";
281
+ export { SUBJECT_ROOT_TOKEN, subjectPath } from "./core/subject.js";
282
+ export {
283
+ correlateToolEvents,
284
+ createToolOutcomeAccumulator,
285
+ isToolCallEvent,
286
+ isToolResultEvent,
287
+ malformedToolEventCount,
288
+ summarizeToolOutcomes,
289
+ TOOL_CALL_KIND,
290
+ TOOL_RESULT_KIND,
291
+ type ToolCallPayload,
292
+ ToolCallPayloadSchema,
293
+ type ToolEventCorrelation,
294
+ type ToolInvocation,
295
+ type ToolInvocationOutcome,
296
+ type ToolOutcomeAccumulator,
297
+ type ToolOutcomeSummary,
298
+ ToolOutcomeSummarySchema,
299
+ type ToolResultPayload,
300
+ ToolResultPayloadSchema,
301
+ toolCallProgress,
302
+ toolEventCalls,
303
+ toolInvocationOutcome,
304
+ toolInvocations,
305
+ toolResultProgress,
306
+ toolResults,
307
+ toolResultValue,
308
+ } from "./core/tool-events.js";
309
+ export {
310
+ addUsage,
311
+ emptyRunUsage,
312
+ emptyUsage,
313
+ harnessUsage,
314
+ isUsageEmpty,
315
+ type RunUsage,
316
+ RunUsageSchema,
317
+ sumUsage,
318
+ type TokenUsage,
319
+ TokenUsageSchema,
320
+ type TurnUsage,
321
+ TurnUsageSchema,
322
+ totalTokens,
323
+ } from "./core/usage.js";
324
+ export {
325
+ type FormatAnswerFn,
326
+ formatWireAnswer,
327
+ type ParsedDriverEvent,
328
+ type ParseEventFn,
329
+ parseWireEvent,
330
+ type WireEvent,
331
+ WireEventSchema,
332
+ } from "./core/wire.js";
package/src/cli/bin.ts CHANGED
@@ -1,14 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { buildProgram } from "./program.js";
2
+ import { buildCli } from "./program.js";
3
3
 
4
- try {
5
- await buildProgram().parseAsync(process.argv);
6
- } catch (error) {
7
- // A raw stack trace is noise to a CLI user; keep it behind DEBUG.
8
- const message = error instanceof Error ? error.message : String(error);
9
- process.stderr.write(`lux: ${message}\n`);
10
- if (process.env.DEBUG && error instanceof Error && error.stack) {
11
- process.stderr.write(`${error.stack}\n`);
12
- }
13
- process.exitCode = 1;
14
- }
4
+ await buildCli().serve();
@@ -1,25 +1,36 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { stat } from "node:fs/promises";
3
3
  import { isAbsolute, relative, resolve, sep } from "node:path";
4
+ import { Errors } from "incur";
4
5
 
5
- export const abortOnInterrupt = (): AbortController => {
6
+ export const abortOnInterrupt = (): AbortController & Disposable => {
6
7
  const controller = new AbortController();
7
8
  const abort = (): void => controller.abort();
8
9
  process.on("SIGINT", abort);
9
10
  process.on("SIGTERM", abort);
10
- return controller;
11
+ return Object.assign(controller, {
12
+ [Symbol.dispose]: () => {
13
+ process.off("SIGINT", abort);
14
+ process.off("SIGTERM", abort);
15
+ },
16
+ });
11
17
  };
12
18
 
13
- export const failWith = (code: number): void => {
14
- // Setting the code lets Node drain buffered output before exiting.
15
- process.exitCode = code;
19
+ export const failWith = (code: number): never => {
20
+ throw new Errors.IncurError({
21
+ code: code === 130 ? "INTERRUPTED" : "LUX_COMMAND_FAILED",
22
+ message: code === 130 ? "The command was interrupted." : "The command did not succeed.",
23
+ exitCode: code,
24
+ });
16
25
  };
17
26
 
18
- export const ensureDirectory = async (command: string, path: string): Promise<boolean> => {
27
+ export const ensureDirectory = async (command: string, path: string): Promise<true> => {
19
28
  if (existsSync(path) && (await stat(path)).isDirectory()) return true;
20
- process.stderr.write(`lux ${command}: ${path} is not a directory\n`);
21
- failWith(1);
22
- return false;
29
+ throw new Errors.IncurError({
30
+ code: "DIRECTORY_NOT_FOUND",
31
+ message: `lux ${command}: ${path} is not a directory`,
32
+ exitCode: 1,
33
+ });
23
34
  };
24
35
 
25
36
  export const relativePathWithin = (root: string, path: string): string | null => {