@jevitate/cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/README.md +23 -0
  2. package/dist/ai-cli.js +40 -30
  3. package/dist/ai-cli.js.map +1 -1
  4. package/dist/author-journey-cli.d.ts +4 -0
  5. package/dist/author-journey-cli.js +109 -0
  6. package/dist/author-journey-cli.js.map +1 -0
  7. package/dist/bin.js +58077 -22454
  8. package/dist/bin.js.map +1 -1
  9. package/dist/browser-run-options.d.ts +58 -0
  10. package/dist/browser-run-options.js +106 -0
  11. package/dist/browser-run-options.js.map +1 -0
  12. package/dist/build-info.generated.d.ts +2 -0
  13. package/dist/build-info.generated.js +10 -0
  14. package/dist/build-info.generated.js.map +1 -0
  15. package/dist/check-api.d.ts +5 -0
  16. package/dist/check-api.js +233 -0
  17. package/dist/check-api.js.map +1 -0
  18. package/dist/check-budget.d.ts +26 -0
  19. package/dist/check-budget.js +89 -0
  20. package/dist/check-budget.js.map +1 -0
  21. package/dist/check-cli.d.ts +31 -0
  22. package/dist/check-cli.js +109 -0
  23. package/dist/check-cli.js.map +1 -0
  24. package/dist/check-execute.d.ts +25 -0
  25. package/dist/check-execute.js +385 -0
  26. package/dist/check-execute.js.map +1 -0
  27. package/dist/check-plan.d.ts +113 -0
  28. package/dist/check-plan.js +448 -0
  29. package/dist/check-plan.js.map +1 -0
  30. package/dist/check-suite.d.ts +171 -0
  31. package/dist/check-suite.js +515 -0
  32. package/dist/check-suite.js.map +1 -0
  33. package/dist/check-types.d.ts +181 -0
  34. package/dist/check-types.js +35 -0
  35. package/dist/check-types.js.map +1 -0
  36. package/dist/cli-args.d.ts +26 -0
  37. package/dist/cli-args.js +50 -0
  38. package/dist/cli-args.js.map +1 -0
  39. package/dist/cli-output.d.ts +102 -0
  40. package/dist/cli-output.js +516 -0
  41. package/dist/cli-output.js.map +1 -0
  42. package/dist/cli-reference.d.ts +3 -0
  43. package/dist/cli-reference.js +81 -0
  44. package/dist/cli-reference.js.map +1 -0
  45. package/dist/cli-refusal.d.ts +12 -0
  46. package/dist/cli-refusal.js +52 -0
  47. package/dist/cli-refusal.js.map +1 -0
  48. package/dist/cli-shared.d.ts +330 -0
  49. package/dist/cli-shared.js +492 -0
  50. package/dist/cli-shared.js.map +1 -0
  51. package/dist/cli-surface.d.ts +33 -0
  52. package/dist/cli-surface.js +48 -0
  53. package/dist/cli-surface.js.map +1 -0
  54. package/dist/conversation-options.d.ts +15 -0
  55. package/dist/conversation-options.js +10 -0
  56. package/dist/conversation-options.js.map +1 -0
  57. package/dist/credentials-file.d.ts +15 -0
  58. package/dist/credentials-file.js +56 -0
  59. package/dist/credentials-file.js.map +1 -0
  60. package/dist/data-dir.d.ts +1 -1
  61. package/dist/data-dir.js +1 -1
  62. package/dist/defect-evidence.d.ts +141 -0
  63. package/dist/defect-evidence.js +502 -0
  64. package/dist/defect-evidence.js.map +1 -0
  65. package/dist/demo-aspect-api.d.ts +209 -0
  66. package/dist/demo-aspect-api.js +397 -0
  67. package/dist/demo-aspect-api.js.map +1 -0
  68. package/dist/demo-aspect-cli.d.ts +3 -0
  69. package/dist/demo-aspect-cli.js +241 -0
  70. package/dist/demo-aspect-cli.js.map +1 -0
  71. package/dist/demo-capture.d.ts +108 -0
  72. package/dist/demo-capture.js +438 -0
  73. package/dist/demo-capture.js.map +1 -0
  74. package/dist/engine.d.ts +35 -0
  75. package/dist/engine.js +25 -0
  76. package/dist/engine.js.map +1 -0
  77. package/dist/environments.d.ts +155 -0
  78. package/dist/environments.js +364 -0
  79. package/dist/environments.js.map +1 -0
  80. package/dist/exit-codes.d.ts +46 -0
  81. package/dist/exit-codes.js +91 -0
  82. package/dist/exit-codes.js.map +1 -0
  83. package/dist/explore-adversarial.d.ts +137 -0
  84. package/dist/explore-adversarial.js +218 -0
  85. package/dist/explore-adversarial.js.map +1 -0
  86. package/dist/explore-api.d.ts +7 -187
  87. package/dist/explore-api.js +7 -301
  88. package/dist/explore-api.js.map +1 -1
  89. package/dist/explore-author.d.ts +79 -0
  90. package/dist/explore-author.js +86 -0
  91. package/dist/explore-author.js.map +1 -0
  92. package/dist/explore-cli.d.ts +7 -0
  93. package/dist/explore-cli.js +963 -0
  94. package/dist/explore-cli.js.map +1 -0
  95. package/dist/explore-coverage.d.ts +158 -0
  96. package/dist/explore-coverage.js +240 -0
  97. package/dist/explore-coverage.js.map +1 -0
  98. package/dist/explore-feature.d.ts +127 -0
  99. package/dist/explore-feature.js +220 -0
  100. package/dist/explore-feature.js.map +1 -0
  101. package/dist/explore-goal.d.ts +253 -0
  102. package/dist/explore-goal.js +374 -0
  103. package/dist/explore-goal.js.map +1 -0
  104. package/dist/explore-shared.d.ts +152 -0
  105. package/dist/explore-shared.js +129 -0
  106. package/dist/explore-shared.js.map +1 -0
  107. package/dist/explore-specs.d.ts +53 -0
  108. package/dist/explore-specs.js +333 -0
  109. package/dist/explore-specs.js.map +1 -0
  110. package/dist/findings-filing.d.ts +64 -0
  111. package/dist/findings-filing.js +108 -0
  112. package/dist/findings-filing.js.map +1 -0
  113. package/dist/fixture-auth.d.ts +52 -0
  114. package/dist/fixture-auth.js +82 -0
  115. package/dist/fixture-auth.js.map +1 -0
  116. package/dist/fixture-cli.d.ts +70 -0
  117. package/dist/fixture-cli.js +178 -0
  118. package/dist/fixture-cli.js.map +1 -0
  119. package/dist/github-issue-filer.d.ts +62 -0
  120. package/dist/github-issue-filer.js +188 -0
  121. package/dist/github-issue-filer.js.map +1 -0
  122. package/dist/host-health-run.d.ts +24 -0
  123. package/dist/host-health-run.js +27 -0
  124. package/dist/host-health-run.js.map +1 -0
  125. package/dist/http-5xx-outcome.d.ts +6 -0
  126. package/dist/http-5xx-outcome.js +39 -0
  127. package/dist/http-5xx-outcome.js.map +1 -0
  128. package/dist/inbox-cli.d.ts +7 -0
  129. package/dist/inbox-cli.js +197 -0
  130. package/dist/inbox-cli.js.map +1 -0
  131. package/dist/index.d.ts +1 -0
  132. package/dist/index.js +1 -0
  133. package/dist/index.js.map +1 -1
  134. package/dist/init-cli.d.ts +4 -0
  135. package/dist/init-cli.js +127 -0
  136. package/dist/init-cli.js.map +1 -0
  137. package/dist/init-keys.d.ts +19 -2
  138. package/dist/init-keys.js +15 -4
  139. package/dist/init-keys.js.map +1 -1
  140. package/dist/init-next-steps.d.ts +35 -0
  141. package/dist/init-next-steps.js +79 -0
  142. package/dist/init-next-steps.js.map +1 -0
  143. package/dist/invariants-file.d.ts +34 -0
  144. package/dist/invariants-file.js +68 -0
  145. package/dist/invariants-file.js.map +1 -0
  146. package/dist/invariants-validate.d.ts +30 -0
  147. package/dist/invariants-validate.js +105 -0
  148. package/dist/invariants-validate.js.map +1 -0
  149. package/dist/journey-annotate-api.d.ts +76 -0
  150. package/dist/journey-annotate-api.js +256 -0
  151. package/dist/journey-annotate-api.js.map +1 -0
  152. package/dist/journey-annotate-cli.d.ts +9 -0
  153. package/dist/journey-annotate-cli.js +179 -0
  154. package/dist/journey-annotate-cli.js.map +1 -0
  155. package/dist/journey-api.d.ts +79 -2
  156. package/dist/journey-api.js +136 -19
  157. package/dist/journey-api.js.map +1 -1
  158. package/dist/journey-cli.d.ts +4 -0
  159. package/dist/journey-cli.js +370 -0
  160. package/dist/journey-cli.js.map +1 -0
  161. package/dist/journey-demo-api.d.ts +112 -0
  162. package/dist/journey-demo-api.js +392 -0
  163. package/dist/journey-demo-api.js.map +1 -0
  164. package/dist/journey-demo-cli.d.ts +10 -0
  165. package/dist/journey-demo-cli.js +155 -0
  166. package/dist/journey-demo-cli.js.map +1 -0
  167. package/dist/kill-signal.d.ts +193 -0
  168. package/dist/kill-signal.js +284 -0
  169. package/dist/kill-signal.js.map +1 -0
  170. package/dist/launch-armed.d.ts +37 -0
  171. package/dist/launch-armed.js +31 -0
  172. package/dist/launch-armed.js.map +1 -0
  173. package/dist/ledger-api.d.ts +106 -0
  174. package/dist/ledger-api.js +237 -0
  175. package/dist/ledger-api.js.map +1 -0
  176. package/dist/ledger-cli.d.ts +18 -0
  177. package/dist/ledger-cli.js +107 -0
  178. package/dist/ledger-cli.js.map +1 -0
  179. package/dist/load-api.d.ts +29 -11
  180. package/dist/load-api.js +23 -15
  181. package/dist/load-api.js.map +1 -1
  182. package/dist/load-cli.d.ts +4 -0
  183. package/dist/load-cli.js +97 -0
  184. package/dist/load-cli.js.map +1 -0
  185. package/dist/log-correlation.d.ts +147 -0
  186. package/dist/log-correlation.js +325 -0
  187. package/dist/log-correlation.js.map +1 -0
  188. package/dist/log-lines.d.ts +131 -0
  189. package/dist/log-lines.js +389 -0
  190. package/dist/log-lines.js.map +1 -0
  191. package/dist/log-sources.d.ts +71 -0
  192. package/dist/log-sources.js +235 -0
  193. package/dist/log-sources.js.map +1 -0
  194. package/dist/logs-cli.d.ts +3 -0
  195. package/dist/logs-cli.js +51 -0
  196. package/dist/logs-cli.js.map +1 -0
  197. package/dist/logs-retention.d.ts +28 -0
  198. package/dist/logs-retention.js +84 -0
  199. package/dist/logs-retention.js.map +1 -0
  200. package/dist/mcp-api.d.ts +89 -1
  201. package/dist/mcp-api.js +472 -18
  202. package/dist/mcp-api.js.map +1 -1
  203. package/dist/mcp-args.d.ts +38 -0
  204. package/dist/mcp-args.js +131 -0
  205. package/dist/mcp-args.js.map +1 -0
  206. package/dist/mcp-cli-bridge.d.ts +34 -0
  207. package/dist/mcp-cli-bridge.js +62 -0
  208. package/dist/mcp-cli-bridge.js.map +1 -0
  209. package/dist/mcp-cli-runner.d.ts +29 -0
  210. package/dist/mcp-cli-runner.js +44 -0
  211. package/dist/mcp-cli-runner.js.map +1 -0
  212. package/dist/mcp-cli-tools.d.ts +125 -0
  213. package/dist/mcp-cli-tools.js +680 -0
  214. package/dist/mcp-cli-tools.js.map +1 -0
  215. package/dist/mcp-paths.d.ts +28 -0
  216. package/dist/mcp-paths.js +76 -0
  217. package/dist/mcp-paths.js.map +1 -0
  218. package/dist/mission-actors.d.ts +40 -0
  219. package/dist/mission-actors.js +72 -0
  220. package/dist/mission-actors.js.map +1 -0
  221. package/dist/mission-api.d.ts +35 -0
  222. package/dist/mission-api.js +58 -2
  223. package/dist/mission-api.js.map +1 -1
  224. package/dist/mission-cli.d.ts +4 -0
  225. package/dist/mission-cli.js +247 -0
  226. package/dist/mission-cli.js.map +1 -0
  227. package/dist/mission-exit.d.ts +22 -0
  228. package/dist/mission-exit.js +26 -0
  229. package/dist/mission-exit.js.map +1 -0
  230. package/dist/mission-fixtures.d.ts +225 -0
  231. package/dist/mission-fixtures.js +828 -0
  232. package/dist/mission-fixtures.js.map +1 -0
  233. package/dist/mission-journal.d.ts +60 -0
  234. package/dist/mission-journal.js +115 -0
  235. package/dist/mission-journal.js.map +1 -0
  236. package/dist/mission-queue-cli.d.ts +10 -0
  237. package/dist/mission-queue-cli.js +198 -0
  238. package/dist/mission-queue-cli.js.map +1 -0
  239. package/dist/mission-queue-runner.d.ts +126 -0
  240. package/dist/mission-queue-runner.js +397 -0
  241. package/dist/mission-queue-runner.js.map +1 -0
  242. package/dist/multi-run-cli.d.ts +37 -0
  243. package/dist/multi-run-cli.js +110 -0
  244. package/dist/multi-run-cli.js.map +1 -0
  245. package/dist/multi-run.d.ts +339 -0
  246. package/dist/multi-run.js +619 -0
  247. package/dist/multi-run.js.map +1 -0
  248. package/dist/openrouter-call.d.ts +22 -0
  249. package/dist/openrouter-call.js +63 -0
  250. package/dist/openrouter-call.js.map +1 -0
  251. package/dist/profile-cli.d.ts +4 -0
  252. package/dist/profile-cli.js +57 -0
  253. package/dist/profile-cli.js.map +1 -0
  254. package/dist/program.d.ts +3 -75
  255. package/dist/program.js +119 -1921
  256. package/dist/program.js.map +1 -1
  257. package/dist/project-dir.d.ts +96 -0
  258. package/dist/project-dir.js +220 -0
  259. package/dist/project-dir.js.map +1 -0
  260. package/dist/record-api.d.ts +10 -6
  261. package/dist/record-api.js +39 -28
  262. package/dist/record-api.js.map +1 -1
  263. package/dist/record-cli.d.ts +4 -0
  264. package/dist/record-cli.js +64 -0
  265. package/dist/record-cli.js.map +1 -0
  266. package/dist/recording-cli.d.ts +4 -0
  267. package/dist/recording-cli.js +248 -0
  268. package/dist/recording-cli.js.map +1 -0
  269. package/dist/regression-api.d.ts +101 -0
  270. package/dist/regression-api.js +384 -5
  271. package/dist/regression-api.js.map +1 -1
  272. package/dist/regression-cli.d.ts +4 -0
  273. package/dist/regression-cli.js +232 -0
  274. package/dist/regression-cli.js.map +1 -0
  275. package/dist/report-api.d.ts +146 -0
  276. package/dist/report-api.js +430 -0
  277. package/dist/report-api.js.map +1 -0
  278. package/dist/report-cli.d.ts +12 -0
  279. package/dist/report-cli.js +147 -0
  280. package/dist/report-cli.js.map +1 -0
  281. package/dist/result-schema.d.ts +22 -0
  282. package/dist/result-schema.js +28 -0
  283. package/dist/result-schema.js.map +1 -0
  284. package/dist/run-index.d.ts +29 -0
  285. package/dist/run-index.js +70 -0
  286. package/dist/run-index.js.map +1 -0
  287. package/dist/run-screenshots.d.ts +123 -0
  288. package/dist/run-screenshots.js +229 -0
  289. package/dist/run-screenshots.js.map +1 -0
  290. package/dist/runtime-env.d.ts +8 -0
  291. package/dist/runtime-env.js +22 -0
  292. package/dist/runtime-env.js.map +1 -0
  293. package/dist/secret-args.d.ts +23 -0
  294. package/dist/secret-args.js +45 -0
  295. package/dist/secret-args.js.map +1 -0
  296. package/dist/serve-cli.d.ts +4 -0
  297. package/dist/serve-cli.js +95 -0
  298. package/dist/serve-cli.js.map +1 -0
  299. package/dist/server-log-verify.d.ts +34 -0
  300. package/dist/server-log-verify.js +115 -0
  301. package/dist/server-log-verify.js.map +1 -0
  302. package/dist/session-check.d.ts +14 -0
  303. package/dist/session-check.js +44 -0
  304. package/dist/session-check.js.map +1 -0
  305. package/dist/site-cli.d.ts +4 -0
  306. package/dist/site-cli.js +127 -0
  307. package/dist/site-cli.js.map +1 -0
  308. package/dist/site-gate-cli.d.ts +28 -0
  309. package/dist/site-gate-cli.js +58 -0
  310. package/dist/site-gate-cli.js.map +1 -0
  311. package/dist/source-api.js +18 -3
  312. package/dist/source-api.js.map +1 -1
  313. package/dist/source-cli.d.ts +4 -0
  314. package/dist/source-cli.js +284 -0
  315. package/dist/source-cli.js.map +1 -0
  316. package/dist/source-run-api.d.ts +27 -1
  317. package/dist/source-run-api.js +22 -11
  318. package/dist/source-run-api.js.map +1 -1
  319. package/dist/storage-state-snapshot.d.ts +50 -0
  320. package/dist/storage-state-snapshot.js +87 -0
  321. package/dist/storage-state-snapshot.js.map +1 -0
  322. package/dist/suite-explore-options.d.ts +289 -0
  323. package/dist/suite-explore-options.js +140 -0
  324. package/dist/suite-explore-options.js.map +1 -0
  325. package/dist/target-config.d.ts +109 -0
  326. package/dist/target-config.js +216 -0
  327. package/dist/target-config.js.map +1 -0
  328. package/dist/transcript-file.d.ts +12 -0
  329. package/dist/transcript-file.js +23 -0
  330. package/dist/transcript-file.js.map +1 -0
  331. package/dist/ui-api.d.ts +3 -0
  332. package/dist/ui-api.js +7 -1
  333. package/dist/ui-api.js.map +1 -1
  334. package/dist/usability-capture.d.ts +43 -0
  335. package/dist/usability-capture.js +326 -0
  336. package/dist/usability-capture.js.map +1 -0
  337. package/dist/usage-config.d.ts +36 -0
  338. package/dist/usage-config.js +114 -0
  339. package/dist/usage-config.js.map +1 -0
  340. package/dist/ux-api.d.ts +3 -75
  341. package/dist/ux-api.js +3 -220
  342. package/dist/ux-api.js.map +1 -1
  343. package/dist/ux-cli.d.ts +4 -0
  344. package/dist/ux-cli.js +102 -0
  345. package/dist/ux-cli.js.map +1 -0
  346. package/dist/ux-config.d.ts +29 -0
  347. package/dist/ux-config.js +103 -0
  348. package/dist/ux-config.js.map +1 -0
  349. package/dist/ux-evidence.d.ts +54 -0
  350. package/dist/ux-evidence.js +197 -0
  351. package/dist/ux-evidence.js.map +1 -0
  352. package/dist/ux-review.d.ts +112 -0
  353. package/dist/ux-review.js +151 -0
  354. package/dist/ux-review.js.map +1 -0
  355. package/dist/ux-usability.d.ts +238 -0
  356. package/dist/ux-usability.js +494 -0
  357. package/dist/ux-usability.js.map +1 -0
  358. package/dist/verify-fix-api.d.ts +173 -0
  359. package/dist/verify-fix-api.js +454 -0
  360. package/dist/verify-fix-api.js.map +1 -0
  361. package/dist/verify-fix-cli.d.ts +4 -0
  362. package/dist/verify-fix-cli.js +110 -0
  363. package/dist/verify-fix-cli.js.map +1 -0
  364. package/package.json +19 -14
  365. package/skills/jevitate-ci-check/SKILL.md +77 -0
  366. package/skills/jevitate-demo/SKILL.md +61 -0
  367. package/skills/jevitate-explore/SKILL.md +88 -87
  368. package/skills/jevitate-getting-started/SKILL.md +88 -0
  369. package/skills/jevitate-load-test/SKILL.md +11 -2
  370. package/skills/jevitate-mission-scope/SKILL.md +19 -11
  371. package/skills/jevitate-record/SKILL.md +23 -5
  372. package/skills/jevitate-run-journey/SKILL.md +61 -17
  373. package/skills/jevitate-sources/SKILL.md +57 -14
  374. package/skills/jevitate-ux-review/SKILL.md +106 -16
  375. package/skills/jevitate-verify-fix/SKILL.md +76 -0
@@ -0,0 +1,209 @@
1
+ import { type AnnotationChange, type AnnotationDraft, type Journey } from "@jevitate/journey";
2
+ import type { Assertion } from "@jevitate/recording";
3
+ import type { GenerationPort, JudgmentPort } from "@jevitate/ai-core";
4
+ import type { Bounds, SafetyConfig } from "@jevitate/explore";
5
+ import type { BrowserPort, EmulationSpec } from "@jevitate/playwright";
6
+ import type { SiteGateDeps } from "@jevitate/runtime";
7
+ import { type AuthorViaBrowserArgs } from "./explore-author.js";
8
+ import type { AuthorJourneyResult } from "@jevitate/explore";
9
+ import type { CaptureLayer } from "./demo-capture.js";
10
+ import type { BrowserRunOptions } from "./browser-run-options.js";
11
+ import type { ResolvedJourneyEnvironment } from "./environments.js";
12
+ import type { MissionFixtures } from "./mission-fixtures.js";
13
+ /**
14
+ * #249 — `jevitate demo "<aspect>"`: one request → a reviewed, narrated demo of one aspect of an app.
15
+ *
16
+ * 1. Explore and author: goal-directed exploration (`runAuthorJourney`, the `explore-author-journey`
17
+ * path) writes a Journey for the aspect, gated by an INDEPENDENT success check (`--success`) —
18
+ * Jev drives, code adjudicates. Paid/destructive controls are refused unless the target's
19
+ * targets.json `safety` allows them; writes are allowed (there is a success check).
20
+ * 2. Clean path: the explored path is minimized to its essential steps with the regression-capture
21
+ * ddmin (`minimizeRecording`): a step (a detour, a dead end, a repeated attempt) is dropped only
22
+ * when the Journey still REPLAYS to its success check without it. The success check is always
23
+ * the Journey's last step, so a candidate can never "succeed" by dropping the proof. The
24
+ * explored path must replay before minimizing, and the minimized one is replayed once more.
25
+ * 3. Annotate (#246): a replay drafts each step's objective and expected result (sidecar draft).
26
+ * 4. Draft demo (#248): video + .vtt + guide narrated with the DRAFT annotations, every output
27
+ * marked DRAFT (a watermark on the overlay, in the subtitles and in the guide).
28
+ *
29
+ * Everything runs in a scratch store first: the Journey, its annotation draft and the demo record
30
+ * land in the journeys dir only when every stage succeeded, and the Journey is NEVER promoted here.
31
+ * `approveDemo` is the one human gate: it re-renders the final (non-DRAFT) demo with the reviewed
32
+ * annotations and only then applies them and promotes the Journey — an ordinary Journey thereafter.
33
+ *
34
+ * Safety: only a named environment, never one flagged `production: true` (refused before anything
35
+ * runs); every replay has `journey run`'s fail-closed policy; every output is redacted and proven
36
+ * secret-free by the stages it reuses.
37
+ */
38
+ /** The demo's inputs were unusable: nothing ran. */
39
+ export declare class DemoAspectArgsError extends Error {
40
+ readonly code = "E_DEMO_ARGS";
41
+ }
42
+ /** `demo` against an environment flagged `production: true`: refused before anything runs. */
43
+ export declare class DemoProductionEnvironmentError extends Error {
44
+ readonly code = "E_DEMO_PRODUCTION_ENV";
45
+ }
46
+ /** The Journey id (or its demo draft) already exists: refused, nothing overwritten. */
47
+ export declare class DemoExistsError extends Error {
48
+ readonly code = "E_DEMO_EXISTS";
49
+ }
50
+ /** `demo approve <id>` for an id with no demo draft. */
51
+ export declare class DemoDraftNotFoundError extends Error {
52
+ readonly code = "E_DEMO_NOT_FOUND";
53
+ }
54
+ /** The demo draft record is unreadable or not a demo draft. */
55
+ export declare class InvalidDemoDraftError extends Error {
56
+ readonly code = "E_INVALID_DEMO_DRAFT";
57
+ }
58
+ /** How many minimization replays (beyond the two verification replays) a demo may spend. */
59
+ export declare const DEMO_MINIMIZE_MAX_REPLAYS = 40;
60
+ /** Refuses a missing environment, and one flagged `production: true` (#249). */
61
+ export declare function assertDemoEnvironment(environment: ResolvedJourneyEnvironment | undefined): asserts environment is ResolvedJourneyEnvironment;
62
+ /** `demo-<slug of the aspect>`: a safe Journey id. */
63
+ export declare function demoJourneyId(aspect: string): string;
64
+ /** `<journeys>/.drafts/<id>.demo.json` — beside the Journey's annotation draft (a dot-folder: never listed as a Journey). */
65
+ export declare function demoDraftPath(journeysDir: string, id: string): string;
66
+ /** The demo draft record: what `demo approve` needs besides the Journey and its annotation draft. Never a secret. */
67
+ export interface DemoDraft {
68
+ readonly kind: "jevitate.demo.draft";
69
+ readonly version: 1;
70
+ readonly id: string;
71
+ readonly aspect: string;
72
+ /** The environment the demo was made on (approve re-renders there, re-checking it is not production). */
73
+ readonly env: string;
74
+ readonly persona?: string;
75
+ /** The Journey's content hash when drafted (its annotation draft is bound to the same). */
76
+ readonly journeyHash: string;
77
+ readonly createdAtIso: string;
78
+ /** The DRAFT outputs. */
79
+ readonly draft: {
80
+ readonly video?: string;
81
+ readonly subtitles?: string;
82
+ readonly guide?: string;
83
+ };
84
+ }
85
+ /** Reads and validates a demo draft record (missing / invalid are typed refusals). */
86
+ export declare function readDemoDraft(journeysDir: string, id: string): Promise<{
87
+ record: DemoDraft;
88
+ path: string;
89
+ }>;
90
+ /** The replay-side options every stage shares (as `journey run` takes them). */
91
+ export interface DemoReplayOptions {
92
+ readonly environment: ResolvedJourneyEnvironment;
93
+ readonly storageState?: string;
94
+ readonly browserPortFactory?: () => BrowserPort;
95
+ /** How Chromium is launched and shown (`--headed` presents the demo; exploration and replays stay headless). */
96
+ readonly browser?: BrowserRunOptions;
97
+ readonly emulation?: EmulationSpec;
98
+ readonly siteGate?: SiteGateDeps;
99
+ readonly fixtures?: (site: string) => MissionFixtures | undefined;
100
+ /** Caption time per step (ms). */
101
+ readonly paceMs?: number;
102
+ /** Extra screenshot layers (pixel masking, #250/#251). */
103
+ readonly captureLayers?: readonly CaptureLayer[];
104
+ }
105
+ export interface DemoAspectOptions extends DemoReplayOptions {
106
+ /** The aspect to demo, in words: the exploration's goal and the Journey's name. */
107
+ readonly aspect: string;
108
+ /** The independent success check that proves the aspect was shown (`--success`). */
109
+ readonly successAssertion: Assertion;
110
+ /** Its spec as given, for the Journey's success criterion text. */
111
+ readonly successSpec: string;
112
+ readonly journeysDir: string;
113
+ /** Default {@link demoJourneyId}. */
114
+ readonly id?: string;
115
+ /** The path exploration starts from on the environment (default `/`). */
116
+ readonly start?: string;
117
+ readonly persona?: string;
118
+ readonly judge: JudgmentPort;
119
+ readonly gen: GenerationPort;
120
+ readonly bounds?: Partial<Bounds>;
121
+ /** The target's targets.json `safety` (paid/destructive allowed only when configured there). */
122
+ readonly safety?: SafetyConfig;
123
+ /** Where the draft video/subtitles/guide go (a folder). */
124
+ readonly outDir: string;
125
+ /** Default {@link DEMO_MINIMIZE_MAX_REPLAYS}. */
126
+ readonly maxReplays?: number;
127
+ readonly now?: () => string;
128
+ /** Test seam: the authoring step (default: a real browser). */
129
+ readonly authorImpl?: (args: AuthorViaBrowserArgs) => Promise<AuthorJourneyResult>;
130
+ }
131
+ export interface DemoMinimizeReport {
132
+ readonly exploredSteps: number;
133
+ readonly keptSteps: number;
134
+ /** What was dropped (value-free step descriptions), in explored order. */
135
+ readonly dropped: string[];
136
+ /** Replays spent minimizing (the two verification replays not counted). */
137
+ readonly replays: number;
138
+ /** The replay budget ran out: the path is verified but may not be minimal. */
139
+ readonly budgetExhausted: boolean;
140
+ }
141
+ export interface DemoAspectResult {
142
+ readonly id: string;
143
+ readonly aspect: string;
144
+ readonly environment: string;
145
+ /**
146
+ * `drafted`: the Journey (unpromoted), its annotation draft and the DRAFT demo are written.
147
+ * `not-reached`: exploration did not meet the success check. `not-replayable`: the explored or
148
+ * minimized path did not replay to it. `stale`: the draft demo's replay stopped. Only `drafted` writes.
149
+ */
150
+ readonly outcome: "drafted" | "not-reached" | "not-replayable" | "stale";
151
+ readonly reason?: string;
152
+ readonly minimize?: DemoMinimizeReport;
153
+ /** The Journey's steps as the demo narrates them (with the drafted annotations). */
154
+ readonly steps?: Array<{
155
+ number: number;
156
+ step: string;
157
+ objective?: string;
158
+ expectedResult?: string;
159
+ }>;
160
+ readonly annotations?: {
161
+ readonly draftPath: string;
162
+ readonly proposed: AnnotationChange[];
163
+ };
164
+ readonly draft?: {
165
+ readonly video?: string;
166
+ readonly subtitles?: string;
167
+ readonly guide?: string;
168
+ };
169
+ readonly demoDraftPath?: string;
170
+ /** The approval command (only for `drafted`). */
171
+ readonly next?: string;
172
+ }
173
+ /** Runs the #249 pipeline (see the module comment). Refusals throw before anything runs. */
174
+ export declare function demoAspect(opts: DemoAspectOptions): Promise<DemoAspectResult>;
175
+ export interface ApproveDemoOptions extends DemoReplayOptions {
176
+ readonly journeysDir: string;
177
+ readonly id: string;
178
+ /** Where the final video/subtitles/guide go (a folder). */
179
+ readonly outDir: string;
180
+ }
181
+ export interface ApproveDemoResult {
182
+ readonly id: string;
183
+ /** `approved`: promoted, annotated, final demo rendered. `stale`: the final render's replay stopped — nothing promoted. */
184
+ readonly outcome: "approved" | "stale";
185
+ readonly reason?: string;
186
+ readonly environment: string;
187
+ /** The Journey as approved (steps with their annotations). */
188
+ readonly steps: NonNullable<DemoAspectResult["steps"]>;
189
+ /** What approving wrote into the Journey. */
190
+ readonly changes: AnnotationChange[];
191
+ readonly promoted: boolean;
192
+ readonly final?: {
193
+ readonly video?: string;
194
+ readonly subtitles?: string;
195
+ readonly guide?: string;
196
+ };
197
+ }
198
+ /** Reads what `demo approve <id>` would approve (the Journey, its draft annotations, the record) — refusals are typed. */
199
+ export declare function loadDemoForApproval(journeysDir: string, id: string): Promise<{
200
+ record: DemoDraft;
201
+ journey: Journey;
202
+ annotations: AnnotationDraft;
203
+ }>;
204
+ /**
205
+ * The one human approval (#249): renders the FINAL demo (no DRAFT marks) with the reviewed
206
+ * annotations; only when it replays does it apply the annotations, promote the Journey and remove
207
+ * the demo record. A stale replay promotes nothing (outcome `stale`).
208
+ */
209
+ export declare function approveDemo(opts: ApproveDemoOptions): Promise<ApproveDemoResult>;
@@ -0,0 +1,397 @@
1
+ import { existsSync } from "node:fs";
2
+ import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { dirname, join } from "node:path";
5
+ import { FsJourneyStore, applyAnnotationDraft, deriveParamSchema, describeStep, flatJourneySteps, } from "@jevitate/journey";
6
+ import { assertNoSecretInPayload } from "@jevitate/ai-core";
7
+ import { minimizeRecording } from "@jevitate/regression";
8
+ import { runAuthorJourney } from "./explore-author.js";
9
+ import { promoteJourney, runJourneyProgrammatically, UnknownJourneyError } from "./journey-api.js";
10
+ import { annotateJourney, annotationDraftPath, approveJourneyAnnotations, journeyContentHash, readAnnotationDraft, StaleAnnotationDraftError, } from "./journey-annotate-api.js";
11
+ import { demoJourney } from "./journey-demo-api.js";
12
+ /**
13
+ * #249 — `jevitate demo "<aspect>"`: one request → a reviewed, narrated demo of one aspect of an app.
14
+ *
15
+ * 1. Explore and author: goal-directed exploration (`runAuthorJourney`, the `explore-author-journey`
16
+ * path) writes a Journey for the aspect, gated by an INDEPENDENT success check (`--success`) —
17
+ * Jev drives, code adjudicates. Paid/destructive controls are refused unless the target's
18
+ * targets.json `safety` allows them; writes are allowed (there is a success check).
19
+ * 2. Clean path: the explored path is minimized to its essential steps with the regression-capture
20
+ * ddmin (`minimizeRecording`): a step (a detour, a dead end, a repeated attempt) is dropped only
21
+ * when the Journey still REPLAYS to its success check without it. The success check is always
22
+ * the Journey's last step, so a candidate can never "succeed" by dropping the proof. The
23
+ * explored path must replay before minimizing, and the minimized one is replayed once more.
24
+ * 3. Annotate (#246): a replay drafts each step's objective and expected result (sidecar draft).
25
+ * 4. Draft demo (#248): video + .vtt + guide narrated with the DRAFT annotations, every output
26
+ * marked DRAFT (a watermark on the overlay, in the subtitles and in the guide).
27
+ *
28
+ * Everything runs in a scratch store first: the Journey, its annotation draft and the demo record
29
+ * land in the journeys dir only when every stage succeeded, and the Journey is NEVER promoted here.
30
+ * `approveDemo` is the one human gate: it re-renders the final (non-DRAFT) demo with the reviewed
31
+ * annotations and only then applies them and promotes the Journey — an ordinary Journey thereafter.
32
+ *
33
+ * Safety: only a named environment, never one flagged `production: true` (refused before anything
34
+ * runs); every replay has `journey run`'s fail-closed policy; every output is redacted and proven
35
+ * secret-free by the stages it reuses.
36
+ */
37
+ /** The demo's inputs were unusable: nothing ran. */
38
+ export class DemoAspectArgsError extends Error {
39
+ code = "E_DEMO_ARGS";
40
+ }
41
+ /** `demo` against an environment flagged `production: true`: refused before anything runs. */
42
+ export class DemoProductionEnvironmentError extends Error {
43
+ code = "E_DEMO_PRODUCTION_ENV";
44
+ }
45
+ /** The Journey id (or its demo draft) already exists: refused, nothing overwritten. */
46
+ export class DemoExistsError extends Error {
47
+ code = "E_DEMO_EXISTS";
48
+ }
49
+ /** `demo approve <id>` for an id with no demo draft. */
50
+ export class DemoDraftNotFoundError extends Error {
51
+ code = "E_DEMO_NOT_FOUND";
52
+ }
53
+ /** The demo draft record is unreadable or not a demo draft. */
54
+ export class InvalidDemoDraftError extends Error {
55
+ code = "E_INVALID_DEMO_DRAFT";
56
+ }
57
+ /** How many minimization replays (beyond the two verification replays) a demo may spend. */
58
+ export const DEMO_MINIMIZE_MAX_REPLAYS = 40;
59
+ /** Refuses a missing environment, and one flagged `production: true` (#249). */
60
+ export function assertDemoEnvironment(environment) {
61
+ if (environment === undefined || environment.name === undefined) {
62
+ throw new DemoAspectArgsError("demo runs only against a named environment: pass --env <name> (from .jevitate/environments.json)");
63
+ }
64
+ if (environment.production === true) {
65
+ throw new DemoProductionEnvironmentError(`environment '${environment.name}' is flagged production: true — demo explores and writes, so it runs only against a non-production environment`);
66
+ }
67
+ }
68
+ /** `demo-<slug of the aspect>`: a safe Journey id. */
69
+ export function demoJourneyId(aspect) {
70
+ const slug = aspect
71
+ .toLowerCase()
72
+ .replace(/[^a-z0-9]+/g, "-")
73
+ .replace(/^-+|-+$/g, "")
74
+ .slice(0, 48)
75
+ .replace(/-+$/g, "");
76
+ return `demo-${slug === "" ? "aspect" : slug}`;
77
+ }
78
+ const DEMO_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,99}$/;
79
+ /** `<journeys>/.drafts/<id>.demo.json` — beside the Journey's annotation draft (a dot-folder: never listed as a Journey). */
80
+ export function demoDraftPath(journeysDir, id) {
81
+ return join(journeysDir, ".drafts", `${id}.demo.json`);
82
+ }
83
+ /** Why `v` is not a {@link DemoDraft}, or null when it is. */
84
+ function demoDraftProblem(v) {
85
+ if (v === null || typeof v !== "object" || Array.isArray(v))
86
+ return "not an object";
87
+ const o = v;
88
+ if (o.kind !== "jevitate.demo.draft")
89
+ return "kind: expected jevitate.demo.draft";
90
+ if (o.version !== 1)
91
+ return "version: expected 1";
92
+ for (const k of ["id", "aspect", "env", "journeyHash", "createdAtIso"])
93
+ if (typeof o[k] !== "string" || o[k] === "")
94
+ return `${k}: expected a string`;
95
+ if (o.persona !== undefined && typeof o.persona !== "string")
96
+ return "persona: expected a string";
97
+ const d = o.draft;
98
+ if (d === null || typeof d !== "object" || Array.isArray(d))
99
+ return "draft: expected an object";
100
+ for (const [k, x] of Object.entries(d)) {
101
+ if (!["video", "subtitles", "guide"].includes(k))
102
+ return `draft.${k}: unknown key`;
103
+ if (typeof x !== "string")
104
+ return `draft.${k}: expected a path`;
105
+ }
106
+ return null;
107
+ }
108
+ /** Reads and validates a demo draft record (missing / invalid are typed refusals). */
109
+ export async function readDemoDraft(journeysDir, id) {
110
+ const path = demoDraftPath(journeysDir, id);
111
+ let raw;
112
+ try {
113
+ raw = await readFile(path, "utf8");
114
+ }
115
+ catch (err) {
116
+ if (err.code === "ENOENT")
117
+ throw new DemoDraftNotFoundError(`no demo draft '${id}' (${path}) — make one with \`jevitate demo "<aspect>" --env <name>\``);
118
+ throw err;
119
+ }
120
+ let parsed;
121
+ try {
122
+ parsed = JSON.parse(raw);
123
+ }
124
+ catch {
125
+ throw new InvalidDemoDraftError(`${path} is not JSON`);
126
+ }
127
+ const problem = demoDraftProblem(parsed);
128
+ if (problem !== null)
129
+ throw new InvalidDemoDraftError(`${path} is not a demo draft: ${problem}`);
130
+ const record = parsed;
131
+ if (record.id !== id)
132
+ throw new InvalidDemoDraftError(`${path} is the demo draft for '${record.id}', not '${id}'`);
133
+ return { record, path };
134
+ }
135
+ /** The replay-only browser: never headed, never recorded (minimizing opens many sessions). */
136
+ function quietBrowser(browser) {
137
+ if (browser === undefined)
138
+ return undefined;
139
+ const { headed: _h, recordVideo: _v, overlay: _o, slowMo: _s, ...launch } = browser;
140
+ return launch;
141
+ }
142
+ function sameAssertion(a, b) {
143
+ return JSON.stringify(a) === JSON.stringify(b);
144
+ }
145
+ /** The explored Recording without its final success `assert` (authorJourney always appends it). */
146
+ function withoutSuccessAssert(recording, check) {
147
+ const pages = recording.pages.map((p) => ({ ...p, steps: [...p.steps] }));
148
+ const last = pages[pages.length - 1];
149
+ const tail = last?.steps[last.steps.length - 1]?.step;
150
+ if (last !== undefined && tail?.kind === "assert" && sameAssertion(tail.check, check)) {
151
+ last.steps.pop();
152
+ if (last.steps.length === 0)
153
+ pages.pop();
154
+ }
155
+ return { ...recording, pages };
156
+ }
157
+ /** `recording` + the success check as its last step — the proof every candidate must replay to. */
158
+ function withSuccessAssert(recording, check) {
159
+ const pages = recording.pages.map((p) => ({ ...p, steps: [...p.steps] }));
160
+ const last = pages[pages.length - 1];
161
+ if (last === undefined)
162
+ return { ...recording, pages: [{ url: "/", steps: [{ step: { kind: "assert", check } }] }] };
163
+ last.steps.push({ step: { kind: "assert", check } });
164
+ return { ...recording, pages };
165
+ }
166
+ function stepsOf(journey) {
167
+ return flatJourneySteps(journey).map((s) => ({
168
+ number: s.index + 1,
169
+ step: describeStep(s.recorded.step),
170
+ ...(s.recorded.objective === undefined ? {} : { objective: s.recorded.objective }),
171
+ ...(s.recorded.expectedResult === undefined ? {} : { expectedResult: s.recorded.expectedResult }),
172
+ }));
173
+ }
174
+ function replayOpts(opts) {
175
+ const b = quietBrowser(opts.browser);
176
+ return {
177
+ environment: opts.environment,
178
+ ...(opts.storageState === undefined ? {} : { storageState: opts.storageState }),
179
+ ...(opts.browserPortFactory === undefined ? {} : { browserPortFactory: opts.browserPortFactory }),
180
+ ...(b === undefined ? {} : { browser: b }),
181
+ ...(opts.emulation === undefined ? {} : { emulation: opts.emulation }),
182
+ ...(opts.siteGate === undefined ? {} : { siteGate: opts.siteGate }),
183
+ ...(opts.fixtures === undefined ? {} : { fixtures: opts.fixtures }),
184
+ };
185
+ }
186
+ /** Runs the #249 pipeline (see the module comment). Refusals throw before anything runs. */
187
+ export async function demoAspect(opts) {
188
+ assertDemoEnvironment(opts.environment);
189
+ const env = opts.environment;
190
+ const aspect = opts.aspect.replace(/\s+/g, " ").trim();
191
+ if (aspect === "")
192
+ throw new DemoAspectArgsError("the aspect to demo is empty");
193
+ const id = opts.id ?? demoJourneyId(aspect);
194
+ if (!DEMO_ID.test(id))
195
+ throw new DemoAspectArgsError(`--id must be letters, digits, '.', '_' or '-' (starting with a letter or digit): ${JSON.stringify(id)}`);
196
+ const start = opts.start ?? "/";
197
+ if (!start.startsWith("/"))
198
+ throw new DemoAspectArgsError(`--start must be an app path starting with '/': ${JSON.stringify(start)}`);
199
+ const store = new FsJourneyStore(opts.journeysDir);
200
+ if ((await store.get(id)) !== null)
201
+ throw new DemoExistsError(`journey '${id}' already exists — pick another --id (nothing was changed)`);
202
+ const recordPath = demoDraftPath(opts.journeysDir, id);
203
+ if (existsSync(recordPath)) {
204
+ throw new DemoExistsError(`a demo draft '${id}' is waiting for approval (${recordPath}) — approve it with \`jevitate demo approve ${id}\`, or pick another --id`);
205
+ }
206
+ const maxReplays = opts.maxReplays ?? DEMO_MINIMIZE_MAX_REPLAYS;
207
+ const now = opts.now ?? (() => new Date().toISOString());
208
+ const base = { id, aspect, environment: env.name ?? env.baseUrl };
209
+ const work = await mkdtemp(join(tmpdir(), "jevitate-demo-aspect-"));
210
+ try {
211
+ // 1. Explore and author (never promoted), into a scratch store.
212
+ const authored = await runAuthorJourney({
213
+ url: new URL(start, env.baseUrl).toString(),
214
+ goal: aspect,
215
+ successAssertion: opts.successAssertion,
216
+ allowlist: env.allowedOrigins,
217
+ journeysDir: join(work, "explored"),
218
+ journeyId: id,
219
+ journeyName: aspect,
220
+ takes: 1,
221
+ judge: opts.judge,
222
+ gen: opts.gen,
223
+ ...(opts.bounds === undefined ? {} : { bounds: opts.bounds }),
224
+ ...(opts.safety === undefined ? {} : { safety: opts.safety }),
225
+ ...(opts.browserPortFactory === undefined ? {} : { browserPortFactory: opts.browserPortFactory }),
226
+ ...(quietBrowser(opts.browser) === undefined ? {} : { browser: quietBrowser(opts.browser) }),
227
+ ...(opts.storageState === undefined ? {} : { storageState: opts.storageState }),
228
+ ...(opts.authorImpl === undefined ? {} : { authorImpl: opts.authorImpl }),
229
+ });
230
+ if (authored.outcome !== "authored")
231
+ return { ...base, outcome: "not-reached", reason: authored.reason };
232
+ const metadata = {
233
+ ...authored.journey.metadata,
234
+ promoted: false,
235
+ goal: aspect,
236
+ ...(opts.persona === undefined ? {} : { persona: opts.persona }),
237
+ successCriteria: [{ description: `The success check holds: ${opts.successSpec}`, check: opts.successAssertion }],
238
+ };
239
+ // 2. Clean path: every candidate replays in its own scratch store, ending on the success check.
240
+ const scratch = new FsJourneyStore(join(work, "candidates"));
241
+ const replayOk = async (recording) => {
242
+ await scratch.put({ metadata, recording: withSuccessAssert(recording, opts.successAssertion) });
243
+ const run = await runJourneyProgrammatically({ dir: join(work, "candidates"), id, params: {}, ...replayOpts(opts) });
244
+ return run.outcome === "ok";
245
+ };
246
+ const explored = withoutSuccessAssert(authored.journey.recording, opts.successAssertion);
247
+ if (!(await replayOk(explored))) {
248
+ return { ...base, outcome: "not-replayable", reason: "the explored path did not replay to its success check — nothing was written" };
249
+ }
250
+ let replays = 0;
251
+ let budgetExhausted = false;
252
+ const minimized = await minimizeRecording(explored, async (candidate) => {
253
+ if (replays >= maxReplays) {
254
+ budgetExhausted = true;
255
+ return false;
256
+ }
257
+ replays += 1;
258
+ return replayOk(candidate);
259
+ });
260
+ if (!(await replayOk(minimized))) {
261
+ return { ...base, outcome: "not-replayable", reason: "the minimized path did not replay to its success check — nothing was written" };
262
+ }
263
+ const kept = new Set(minimized.pages.flatMap((p) => p.steps));
264
+ const exploredFlat = explored.pages.flatMap((p) => p.steps);
265
+ const minimize = {
266
+ exploredSteps: exploredFlat.length + 1,
267
+ keptSteps: kept.size + 1,
268
+ dropped: exploredFlat.filter((s) => !kept.has(s)).map((s) => describeStep(s.step)),
269
+ replays,
270
+ budgetExhausted,
271
+ };
272
+ const recording = withSuccessAssert(minimized, opts.successAssertion);
273
+ const journey = { metadata: { ...metadata, params: deriveParamSchema(recording).required, createdAtIso: now() }, recording };
274
+ // 3. Annotate (#246) and 4. draft the demo (#248) — both against a scratch store holding only this Journey.
275
+ const stageDir = join(work, "stage");
276
+ await new FsJourneyStore(stageDir).put(journey);
277
+ const annotated = await annotateJourney({ dir: stageDir, id, params: {}, gen: opts.gen, now, ...replayOpts(opts) });
278
+ if (annotated.replay.outcome !== "completed") {
279
+ return { ...base, outcome: "stale", minimize, reason: `the annotation replay stopped: ${annotated.replay.reason ?? "unknown"} — nothing was written` };
280
+ }
281
+ const { draft: annotations } = await readAnnotationDraft(stageDir, id);
282
+ const demo = await renderDemo(stageDir, id, opts, annotations, true, opts.outDir);
283
+ if (demo.outcome !== "ok") {
284
+ return { ...base, outcome: "stale", minimize, reason: `the draft demo's replay stopped${demo.stoppedAtStep === undefined ? "" : ` at step ${demo.stoppedAtStep}`}: ${demo.reason ?? "unknown"} — nothing was written` };
285
+ }
286
+ // Every stage succeeded: the Journey (unpromoted), its annotation draft and the demo record land.
287
+ await store.put(journey);
288
+ const draftPath = annotationDraftPath(opts.journeysDir, id);
289
+ await mkdir(dirname(draftPath), { recursive: true, mode: 0o700 });
290
+ await writeFile(draftPath, `${JSON.stringify(annotations, null, 2)}\n`, { mode: 0o600 });
291
+ const record = {
292
+ kind: "jevitate.demo.draft",
293
+ version: 1,
294
+ id,
295
+ aspect,
296
+ env: base.environment,
297
+ ...(opts.persona === undefined ? {} : { persona: opts.persona }),
298
+ journeyHash: annotations.journeyHash,
299
+ createdAtIso: now(),
300
+ draft: outputsOf(demo),
301
+ };
302
+ assertNoSecretInPayload(record, [], "demo draft record");
303
+ await writeFile(recordPath, `${JSON.stringify(record, null, 2)}\n`, { mode: 0o600 });
304
+ return {
305
+ ...base,
306
+ outcome: "drafted",
307
+ minimize,
308
+ steps: stepsOf(applyAnnotationDraft(journey, annotations).journey),
309
+ annotations: { draftPath, proposed: annotated.proposed },
310
+ draft: record.draft,
311
+ demoDraftPath: recordPath,
312
+ next: `jevitate demo approve ${id}`,
313
+ };
314
+ }
315
+ finally {
316
+ await rm(work, { recursive: true, force: true });
317
+ }
318
+ }
319
+ function outputsOf(demo) {
320
+ return {
321
+ ...(demo.video === undefined ? {} : { video: demo.video }),
322
+ ...(demo.subtitles === undefined ? {} : { subtitles: demo.subtitles }),
323
+ ...(demo.guide === undefined ? {} : { guide: demo.guide }),
324
+ };
325
+ }
326
+ /** One demo render (#248) of `id` in `dir`, narrated with `annotations`, into `outDir`. */
327
+ function renderDemo(dir, id, opts, annotations, draft, outDir) {
328
+ return demoJourney({
329
+ dir,
330
+ id,
331
+ params: {},
332
+ video: join(outDir, "demo.webm"),
333
+ guide: join(outDir, "guide.md"),
334
+ annotations,
335
+ draft,
336
+ environment: opts.environment,
337
+ ...(opts.storageState === undefined ? {} : { storageState: opts.storageState }),
338
+ ...(opts.browserPortFactory === undefined ? {} : { browserPortFactory: opts.browserPortFactory }),
339
+ ...(opts.browser === undefined ? {} : { browser: opts.browser }),
340
+ ...(opts.emulation === undefined ? {} : { emulation: opts.emulation }),
341
+ ...(opts.siteGate === undefined ? {} : { siteGate: opts.siteGate }),
342
+ ...(opts.fixtures === undefined ? {} : { fixtures: opts.fixtures }),
343
+ ...(opts.paceMs === undefined ? {} : { paceMs: opts.paceMs }),
344
+ ...(opts.captureLayers === undefined ? {} : { captureLayers: opts.captureLayers }),
345
+ });
346
+ }
347
+ /** Reads what `demo approve <id>` would approve (the Journey, its draft annotations, the record) — refusals are typed. */
348
+ export async function loadDemoForApproval(journeysDir, id) {
349
+ if (!DEMO_ID.test(id))
350
+ throw new DemoAspectArgsError(`not a demo id: ${JSON.stringify(id)}`);
351
+ const { record } = await readDemoDraft(journeysDir, id);
352
+ const journey = await new FsJourneyStore(journeysDir).get(id);
353
+ if (journey === null)
354
+ throw new UnknownJourneyError(`unknown journey '${id}' (its demo draft is at ${demoDraftPath(journeysDir, id)})`);
355
+ const { draft: annotations, draftPath } = await readAnnotationDraft(journeysDir, id);
356
+ if (journeyContentHash(journey) !== annotations.journeyHash) {
357
+ throw new StaleAnnotationDraftError(`journey '${id}' changed after its demo was drafted (${draftPath}) — make the demo again`);
358
+ }
359
+ return { record, journey, annotations };
360
+ }
361
+ /**
362
+ * The one human approval (#249): renders the FINAL demo (no DRAFT marks) with the reviewed
363
+ * annotations; only when it replays does it apply the annotations, promote the Journey and remove
364
+ * the demo record. A stale replay promotes nothing (outcome `stale`).
365
+ */
366
+ export async function approveDemo(opts) {
367
+ assertDemoEnvironment(opts.environment);
368
+ const { journey, annotations } = await loadDemoForApproval(opts.journeysDir, opts.id);
369
+ const environment = opts.environment.name ?? opts.environment.baseUrl;
370
+ const annotated = applyAnnotationDraft(journey, annotations);
371
+ const steps = stepsOf(annotated.journey);
372
+ const demo = await renderDemo(opts.journeysDir, opts.id, opts, annotations, false, opts.outDir);
373
+ if (demo.outcome !== "ok") {
374
+ return {
375
+ id: opts.id,
376
+ outcome: "stale",
377
+ reason: `the final demo's replay stopped${demo.stoppedAtStep === undefined ? "" : ` at step ${demo.stoppedAtStep}`}: ${demo.reason ?? "unknown"} — nothing was promoted`,
378
+ environment,
379
+ steps,
380
+ changes: [],
381
+ promoted: false,
382
+ };
383
+ }
384
+ const applied = await approveJourneyAnnotations(opts.journeysDir, opts.id);
385
+ await promoteJourney(opts.journeysDir, opts.id);
386
+ await rm(demoDraftPath(opts.journeysDir, opts.id), { force: true });
387
+ return {
388
+ id: opts.id,
389
+ outcome: "approved",
390
+ environment,
391
+ steps,
392
+ changes: applied.changes,
393
+ promoted: true,
394
+ final: outputsOf(demo),
395
+ };
396
+ }
397
+ //# sourceMappingURL=demo-aspect-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-aspect-api.js","sourceRoot":"","sources":["../src/demo-aspect-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,GAIjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAA6B,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,GAC1B,M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C,aAAa,EAAE,KAAK,IAAI,CAAC,MAAM,IAAI,SAAS,yBAAyB;YACxK,WAAW;YACX,KAAK;YACL,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3E,MAAM,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,OAAO,EAAE,UAAU;QACnB,WAAW;QACX,KAAK;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ import { type CliDeps } from "./cli-shared.js";
3
+ export declare function registerDemoCommands(program: Command, deps: CliDeps): void;