automovie 0.3.3 → 0.4.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 (331) hide show
  1. package/README.md +40 -139
  2. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +5 -2
  3. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +6 -2
  4. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -1
  5. package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +3 -1
  6. package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +3 -1
  7. package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -1
  8. package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +5 -2
  9. package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +5 -2
  10. package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -1
  11. package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -2
  12. package/lib/AUTOMOVIE_RENDER_OPTIONS.js +8 -2
  13. package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -1
  14. package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +3 -1
  15. package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +12 -1
  16. package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -1
  17. package/lib/AutoMovieCaptureBackend.d.ts +4 -6
  18. package/lib/AutoMovieCaptureHost.d.ts +73 -53
  19. package/lib/AutoMovieCaptureHost.js +89 -56
  20. package/lib/AutoMovieCaptureHost.js.map +1 -1
  21. package/lib/AutoMovieCommand.d.ts +69 -20
  22. package/lib/AutoMovieFfmpegStaticPath.d.ts +6 -0
  23. package/lib/AutoMovieFfmpegStaticPath.js +3 -0
  24. package/lib/AutoMovieFfmpegStaticPath.js.map +1 -0
  25. package/lib/AutoMovieMp4Boxes.d.ts +78 -0
  26. package/lib/AutoMovieMp4Boxes.js +227 -0
  27. package/lib/AutoMovieMp4Boxes.js.map +1 -0
  28. package/lib/AutoMovieRenderOutputReservation.d.ts +18 -0
  29. package/lib/AutoMovieRenderOutputReservation.js +118 -0
  30. package/lib/AutoMovieRenderOutputReservation.js.map +1 -0
  31. package/lib/IAutoMovieChromium.d.ts +13 -57
  32. package/lib/IAutoMovieDeliveryAudioTrack.d.ts +17 -0
  33. package/lib/IAutoMovieDeliveryAudioTrack.js +3 -0
  34. package/lib/IAutoMovieDeliveryAudioTrack.js.map +1 -0
  35. package/lib/IAutoMovieDeliveryProfileFinding.d.ts +21 -0
  36. package/lib/IAutoMovieDeliveryProfileFinding.js +3 -0
  37. package/lib/IAutoMovieDeliveryProfileFinding.js.map +1 -0
  38. package/lib/IAutoMovieFfmpegSources.d.ts +11 -0
  39. package/lib/IAutoMovieFfmpegSources.js +3 -0
  40. package/lib/IAutoMovieFfmpegSources.js.map +1 -0
  41. package/lib/IAutoMovieReviewObservation.d.ts +66 -0
  42. package/lib/IAutoMovieReviewObservation.js +3 -0
  43. package/lib/IAutoMovieReviewObservation.js.map +1 -0
  44. package/lib/IAutoMovieVerification.d.ts +163 -0
  45. package/lib/IAutoMovieVerification.js +3 -0
  46. package/lib/IAutoMovieVerification.js.map +1 -0
  47. package/lib/auditAutoMovieAlphaSamples.d.ts +23 -0
  48. package/lib/auditAutoMovieAlphaSamples.js +183 -0
  49. package/lib/auditAutoMovieAlphaSamples.js.map +1 -0
  50. package/lib/auditAutoMovieDeliveryProfile.d.ts +33 -0
  51. package/lib/auditAutoMovieDeliveryProfile.js +93 -0
  52. package/lib/auditAutoMovieDeliveryProfile.js.map +1 -0
  53. package/lib/captureAutoMovie.d.ts +23 -11
  54. package/lib/captureAutoMovie.js +102 -18
  55. package/lib/captureAutoMovie.js.map +1 -1
  56. package/lib/createAutoMovieDeliveryAudioLog.d.ts +31 -0
  57. package/lib/createAutoMovieDeliveryAudioLog.js +110 -0
  58. package/lib/createAutoMovieDeliveryAudioLog.js.map +1 -0
  59. package/lib/createAutoMovieDeliveryAudioScan.d.ts +39 -0
  60. package/lib/createAutoMovieDeliveryAudioScan.js +125 -0
  61. package/lib/createAutoMovieDeliveryAudioScan.js.map +1 -0
  62. package/lib/createAutoMovieVerificationInputScope.d.ts +19 -0
  63. package/lib/createAutoMovieVerificationInputScope.js +147 -0
  64. package/lib/createAutoMovieVerificationInputScope.js.map +1 -0
  65. package/lib/createAutoMovieVerificationMediaHash.d.ts +5 -0
  66. package/lib/createAutoMovieVerificationMediaHash.js +61 -0
  67. package/lib/createAutoMovieVerificationMediaHash.js.map +1 -0
  68. package/lib/decodeAutoMovieDeliveryAudio.d.ts +24 -0
  69. package/lib/decodeAutoMovieDeliveryAudio.js +77 -0
  70. package/lib/decodeAutoMovieDeliveryAudio.js.map +1 -0
  71. package/lib/deriveAutoMovieProjectName.d.ts +14 -11
  72. package/lib/deriveAutoMovieProjectName.js +14 -11
  73. package/lib/deriveAutoMovieProjectName.js.map +1 -1
  74. package/lib/findAutoMovieFreePort.d.ts +5 -10
  75. package/lib/findAutoMovieFreePort.js +5 -10
  76. package/lib/findAutoMovieFreePort.js.map +1 -1
  77. package/lib/formatAutoMovieInspectUrl.d.ts +6 -10
  78. package/lib/formatAutoMovieInspectUrl.js +6 -10
  79. package/lib/formatAutoMovieInspectUrl.js.map +1 -1
  80. package/lib/hashAutoMovieFile.d.ts +5 -0
  81. package/lib/hashAutoMovieFile.js +16 -0
  82. package/lib/hashAutoMovieFile.js.map +1 -0
  83. package/lib/importAutoMovieVerificationEntry.d.mts +2 -0
  84. package/lib/importAutoMovieVerificationEntry.mjs +6 -0
  85. package/lib/importAutoMovieVerificationEntry.mjs.map +1 -0
  86. package/lib/index.d.ts +9 -0
  87. package/lib/index.js +9 -0
  88. package/lib/index.js.map +1 -1
  89. package/lib/inspectAutoMovie.d.ts +15 -9
  90. package/lib/inspectAutoMovie.js +25 -9
  91. package/lib/inspectAutoMovie.js.map +1 -1
  92. package/lib/inspectAutoMovieVerificationCapture.d.ts +15 -0
  93. package/lib/inspectAutoMovieVerificationCapture.js +221 -0
  94. package/lib/inspectAutoMovieVerificationCapture.js.map +1 -0
  95. package/lib/inspectAutoMovieVerificationDelivery.d.ts +13 -0
  96. package/lib/inspectAutoMovieVerificationDelivery.js +247 -0
  97. package/lib/inspectAutoMovieVerificationDelivery.js.map +1 -0
  98. package/lib/inspectAutoMovieVerificationReview.d.ts +11 -0
  99. package/lib/inspectAutoMovieVerificationReview.js +141 -0
  100. package/lib/inspectAutoMovieVerificationReview.js.map +1 -0
  101. package/lib/launchAutoMovieChromium.d.ts +9 -11
  102. package/lib/launchAutoMovieChromium.js +10 -11
  103. package/lib/launchAutoMovieChromium.js.map +1 -1
  104. package/lib/listAutoMovieReleaseFindings.d.ts +9 -0
  105. package/lib/listAutoMovieReleaseFindings.js +58 -0
  106. package/lib/listAutoMovieReleaseFindings.js.map +1 -0
  107. package/lib/loadAutoMovieProductionModule.d.ts +11 -10
  108. package/lib/loadAutoMovieProductionModule.js +18 -10
  109. package/lib/loadAutoMovieProductionModule.js.map +1 -1
  110. package/lib/loadAutoMovieVerificationModule.d.ts +6 -0
  111. package/lib/loadAutoMovieVerificationModule.js +246 -0
  112. package/lib/loadAutoMovieVerificationModule.js.map +1 -0
  113. package/lib/planAutoMovieChromiumLaunch.d.ts +7 -13
  114. package/lib/planAutoMovieChromiumLaunch.js +7 -13
  115. package/lib/planAutoMovieChromiumLaunch.js.map +1 -1
  116. package/lib/planAutoMovieDeliveryAudioDecode.d.ts +10 -0
  117. package/lib/planAutoMovieDeliveryAudioDecode.js +29 -0
  118. package/lib/planAutoMovieDeliveryAudioDecode.js.map +1 -0
  119. package/lib/planAutoMovieDeliveryDecode.d.ts +19 -0
  120. package/lib/planAutoMovieDeliveryDecode.js +57 -0
  121. package/lib/planAutoMovieDeliveryDecode.js.map +1 -0
  122. package/lib/planAutoMovieDeliveryInput.d.ts +11 -0
  123. package/lib/planAutoMovieDeliveryInput.js +26 -0
  124. package/lib/planAutoMovieDeliveryInput.js.map +1 -0
  125. package/lib/planAutoMovieModulePageViteConfig.d.ts +13 -10
  126. package/lib/planAutoMovieModulePageViteConfig.js +13 -10
  127. package/lib/planAutoMovieModulePageViteConfig.js.map +1 -1
  128. package/lib/promptAutoMovieProjectName.d.ts +6 -10
  129. package/lib/promptAutoMovieProjectName.js +6 -10
  130. package/lib/promptAutoMovieProjectName.js.map +1 -1
  131. package/lib/publishAutoMovieRenderAttempt.d.ts +32 -0
  132. package/lib/publishAutoMovieRenderAttempt.js +91 -0
  133. package/lib/publishAutoMovieRenderAttempt.js.map +1 -0
  134. package/lib/readAutoMovieAddArguments.d.ts +10 -11
  135. package/lib/readAutoMovieAddArguments.js +10 -11
  136. package/lib/readAutoMovieAddArguments.js.map +1 -1
  137. package/lib/readAutoMovieCaptureHostOptions.d.ts +19 -17
  138. package/lib/readAutoMovieCaptureHostOptions.js +16 -17
  139. package/lib/readAutoMovieCaptureHostOptions.js.map +1 -1
  140. package/lib/readAutoMovieCommandArguments.d.ts +6 -9
  141. package/lib/readAutoMovieCommandArguments.js +9 -10
  142. package/lib/readAutoMovieCommandArguments.js.map +1 -1
  143. package/lib/readAutoMovieCreateArguments.d.ts +7 -11
  144. package/lib/readAutoMovieCreateArguments.js +7 -11
  145. package/lib/readAutoMovieCreateArguments.js.map +1 -1
  146. package/lib/readAutoMovieDeliveryAudioTrack.d.ts +21 -0
  147. package/lib/readAutoMovieDeliveryAudioTrack.js +104 -0
  148. package/lib/readAutoMovieDeliveryAudioTrack.js.map +1 -0
  149. package/lib/readAutoMovieDeliveryDecode.d.ts +19 -0
  150. package/lib/readAutoMovieDeliveryDecode.js +209 -0
  151. package/lib/readAutoMovieDeliveryDecode.js.map +1 -0
  152. package/lib/readAutoMovieDeliveryProbe.d.ts +35 -0
  153. package/lib/readAutoMovieDeliveryProbe.js +363 -0
  154. package/lib/readAutoMovieDeliveryProbe.js.map +1 -0
  155. package/lib/readAutoMovieErrorCode.d.ts +9 -0
  156. package/lib/readAutoMovieErrorCode.js +18 -0
  157. package/lib/readAutoMovieErrorCode.js.map +1 -0
  158. package/lib/readAutoMovieInspectHostOptions.d.ts +15 -16
  159. package/lib/readAutoMovieInspectHostOptions.js +11 -15
  160. package/lib/readAutoMovieInspectHostOptions.js.map +1 -1
  161. package/lib/readAutoMovieNameOption.d.ts +4 -10
  162. package/lib/readAutoMovieNameOption.js +4 -10
  163. package/lib/readAutoMovieNameOption.js.map +1 -1
  164. package/lib/readAutoMoviePageTimeout.d.ts +13 -0
  165. package/lib/readAutoMoviePageTimeout.js +21 -0
  166. package/lib/readAutoMoviePageTimeout.js.map +1 -0
  167. package/lib/readAutoMovieRenderOptions.d.ts +24 -16
  168. package/lib/readAutoMovieRenderOptions.js +23 -16
  169. package/lib/readAutoMovieRenderOptions.js.map +1 -1
  170. package/lib/readAutoMovieReviewObservation.d.ts +6 -0
  171. package/lib/readAutoMovieReviewObservation.js +108 -0
  172. package/lib/readAutoMovieReviewObservation.js.map +1 -0
  173. package/lib/readAutoMovieReviewOptions.d.ts +32 -24
  174. package/lib/readAutoMovieReviewOptions.js +82 -18
  175. package/lib/readAutoMovieReviewOptions.js.map +1 -1
  176. package/lib/readAutoMovieRevision.d.ts +3 -9
  177. package/lib/readAutoMovieRevision.js +3 -9
  178. package/lib/readAutoMovieRevision.js.map +1 -1
  179. package/lib/readAutoMovieVerifyOptions.d.ts +17 -0
  180. package/lib/readAutoMovieVerifyOptions.js +45 -0
  181. package/lib/readAutoMovieVerifyOptions.js.map +1 -0
  182. package/lib/readAutoMovieVideoProbe.d.ts +6 -10
  183. package/lib/readAutoMovieVideoProbe.js +20 -13
  184. package/lib/readAutoMovieVideoProbe.js.map +1 -1
  185. package/lib/recordAutoMoviePlayback.d.ts +18 -11
  186. package/lib/recordAutoMoviePlayback.js +26 -13
  187. package/lib/recordAutoMoviePlayback.js.map +1 -1
  188. package/lib/renderAutoMovie.d.ts +16 -10
  189. package/lib/renderAutoMovie.js +31 -14
  190. package/lib/renderAutoMovie.js.map +1 -1
  191. package/lib/renderAutoMovieScaffoldNextSteps.d.ts +10 -10
  192. package/lib/renderAutoMovieScaffoldNextSteps.js +10 -10
  193. package/lib/renderAutoMovieVideo.d.ts +53 -15
  194. package/lib/renderAutoMovieVideo.js +290 -45
  195. package/lib/renderAutoMovieVideo.js.map +1 -1
  196. package/lib/resolveAutoMovieFfmpeg.d.ts +12 -15
  197. package/lib/resolveAutoMovieFfmpeg.js +12 -17
  198. package/lib/resolveAutoMovieFfmpeg.js.map +1 -1
  199. package/lib/reviewAutoMovie.d.ts +10 -10
  200. package/lib/reviewAutoMovie.js +15 -10
  201. package/lib/reviewAutoMovie.js.map +1 -1
  202. package/lib/reviewAutoMovieFile.d.ts +21 -0
  203. package/lib/reviewAutoMovieFile.js +378 -0
  204. package/lib/reviewAutoMovieFile.js.map +1 -0
  205. package/lib/run.d.ts +32 -18
  206. package/lib/run.js +67 -23
  207. package/lib/run.js.map +1 -1
  208. package/lib/runAutoMovieDeliveryAudioDecode.d.ts +18 -0
  209. package/lib/runAutoMovieDeliveryAudioDecode.js +28 -0
  210. package/lib/runAutoMovieDeliveryAudioDecode.js.map +1 -0
  211. package/lib/runAutoMovieDeliveryDecode.d.ts +19 -0
  212. package/lib/runAutoMovieDeliveryDecode.js +42 -0
  213. package/lib/runAutoMovieDeliveryDecode.js.map +1 -0
  214. package/lib/runAutoMovieDeliveryReferenceDecode.d.ts +28 -0
  215. package/lib/runAutoMovieDeliveryReferenceDecode.js +77 -0
  216. package/lib/runAutoMovieDeliveryReferenceDecode.js.map +1 -0
  217. package/lib/runAutoMovieDeliverySourceAudioDecode.d.ts +20 -0
  218. package/lib/runAutoMovieDeliverySourceAudioDecode.js +56 -0
  219. package/lib/runAutoMovieDeliverySourceAudioDecode.js.map +1 -0
  220. package/lib/runAutoMovieFfmpeg.d.ts +15 -10
  221. package/lib/runAutoMovieFfmpeg.js +36 -13
  222. package/lib/runAutoMovieFfmpeg.js.map +1 -1
  223. package/lib/runAutoMovieVerification.d.ts +28 -0
  224. package/lib/runAutoMovieVerification.js +393 -0
  225. package/lib/runAutoMovieVerification.js.map +1 -0
  226. package/lib/sameAutoMovieReviewFile.d.ts +2 -0
  227. package/lib/sameAutoMovieReviewFile.js +57 -0
  228. package/lib/sameAutoMovieReviewFile.js.map +1 -0
  229. package/lib/selectAutoMovieProjectName.d.ts +8 -11
  230. package/lib/selectAutoMovieProjectName.js +8 -11
  231. package/lib/selectAutoMovieProjectName.js.map +1 -1
  232. package/lib/serveAutoMovieDrawPage.d.ts +14 -11
  233. package/lib/serveAutoMovieDrawPage.js +14 -11
  234. package/lib/serveAutoMovieDrawPage.js.map +1 -1
  235. package/lib/serveAutoMovieInspectorPage.d.ts +4 -8
  236. package/lib/serveAutoMovieInspectorPage.js +3 -9
  237. package/lib/serveAutoMovieInspectorPage.js.map +1 -1
  238. package/lib/verifyAutoMovie.d.ts +19 -0
  239. package/lib/verifyAutoMovie.js +44 -0
  240. package/lib/verifyAutoMovie.js.map +1 -0
  241. package/lib/writeAutoMovieModulePage.d.ts +17 -12
  242. package/lib/writeAutoMovieModulePage.js +13 -11
  243. package/lib/writeAutoMovieModulePage.js.map +1 -1
  244. package/lib/writeAutoMovieVerificationReceipt.d.ts +2 -0
  245. package/lib/writeAutoMovieVerificationReceipt.js +75 -0
  246. package/lib/writeAutoMovieVerificationReceipt.js.map +1 -0
  247. package/package.json +8 -8
  248. package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +6 -2
  249. package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +3 -1
  250. package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +5 -2
  251. package/src/AUTOMOVIE_RENDER_OPTIONS.ts +8 -2
  252. package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +12 -1
  253. package/src/AutoMovieCaptureBackend.ts +4 -6
  254. package/src/AutoMovieCaptureHost.ts +122 -68
  255. package/src/AutoMovieCommand.ts +71 -20
  256. package/src/AutoMovieFfmpegStaticPath.ts +7 -0
  257. package/src/AutoMovieMp4Boxes.ts +263 -0
  258. package/src/AutoMovieRenderOutputReservation.ts +97 -0
  259. package/src/IAutoMovieChromium.ts +13 -57
  260. package/src/IAutoMovieDeliveryAudioTrack.ts +19 -0
  261. package/src/IAutoMovieDeliveryProfileFinding.ts +24 -0
  262. package/src/IAutoMovieFfmpegSources.ts +13 -0
  263. package/src/IAutoMovieReviewObservation.ts +59 -0
  264. package/src/IAutoMovieVerification.ts +207 -0
  265. package/src/auditAutoMovieAlphaSamples.ts +201 -0
  266. package/src/auditAutoMovieDeliveryProfile.ts +125 -0
  267. package/src/captureAutoMovie.ts +137 -28
  268. package/src/createAutoMovieDeliveryAudioLog.ts +141 -0
  269. package/src/createAutoMovieDeliveryAudioScan.ts +150 -0
  270. package/src/createAutoMovieVerificationInputScope.ts +156 -0
  271. package/src/createAutoMovieVerificationMediaHash.ts +32 -0
  272. package/src/decodeAutoMovieDeliveryAudio.ts +95 -0
  273. package/src/deriveAutoMovieProjectName.ts +14 -11
  274. package/src/findAutoMovieFreePort.ts +5 -10
  275. package/src/formatAutoMovieInspectUrl.ts +6 -10
  276. package/src/hashAutoMovieFile.ts +12 -0
  277. package/src/importAutoMovieVerificationEntry.mts +6 -0
  278. package/src/index.ts +9 -0
  279. package/src/inspectAutoMovie.ts +28 -11
  280. package/src/inspectAutoMovieVerificationCapture.ts +292 -0
  281. package/src/inspectAutoMovieVerificationDelivery.ts +301 -0
  282. package/src/inspectAutoMovieVerificationReview.ts +130 -0
  283. package/src/launchAutoMovieChromium.ts +14 -12
  284. package/src/listAutoMovieReleaseFindings.ts +87 -0
  285. package/src/loadAutoMovieProductionModule.ts +22 -15
  286. package/src/loadAutoMovieVerificationModule.ts +278 -0
  287. package/src/planAutoMovieChromiumLaunch.ts +7 -13
  288. package/src/planAutoMovieDeliveryAudioDecode.ts +26 -0
  289. package/src/planAutoMovieDeliveryDecode.ts +66 -0
  290. package/src/planAutoMovieDeliveryInput.ts +25 -0
  291. package/src/planAutoMovieModulePageViteConfig.ts +13 -10
  292. package/src/promptAutoMovieProjectName.ts +6 -10
  293. package/src/publishAutoMovieRenderAttempt.ts +89 -0
  294. package/src/readAutoMovieAddArguments.ts +10 -11
  295. package/src/readAutoMovieCaptureHostOptions.ts +22 -17
  296. package/src/readAutoMovieCommandArguments.ts +8 -10
  297. package/src/readAutoMovieCreateArguments.ts +7 -11
  298. package/src/readAutoMovieDeliveryAudioTrack.ts +137 -0
  299. package/src/readAutoMovieDeliveryDecode.ts +269 -0
  300. package/src/readAutoMovieDeliveryProbe.ts +499 -0
  301. package/src/readAutoMovieErrorCode.ts +13 -0
  302. package/src/readAutoMovieInspectHostOptions.ts +15 -16
  303. package/src/readAutoMovieNameOption.ts +4 -10
  304. package/src/readAutoMoviePageTimeout.ts +19 -0
  305. package/src/readAutoMovieRenderOptions.ts +34 -16
  306. package/src/readAutoMovieReviewObservation.ts +146 -0
  307. package/src/readAutoMovieReviewOptions.ts +133 -28
  308. package/src/readAutoMovieRevision.ts +3 -9
  309. package/src/readAutoMovieVerifyOptions.ts +50 -0
  310. package/src/readAutoMovieVideoProbe.ts +24 -13
  311. package/src/recordAutoMoviePlayback.ts +26 -13
  312. package/src/renderAutoMovie.ts +38 -17
  313. package/src/renderAutoMovieScaffoldNextSteps.ts +10 -10
  314. package/src/renderAutoMovieVideo.ts +474 -85
  315. package/src/resolveAutoMovieFfmpeg.ts +17 -24
  316. package/src/reviewAutoMovie.ts +21 -16
  317. package/src/reviewAutoMovieFile.ts +479 -0
  318. package/src/run.ts +75 -25
  319. package/src/runAutoMovieDeliveryAudioDecode.ts +45 -0
  320. package/src/runAutoMovieDeliveryDecode.ts +63 -0
  321. package/src/runAutoMovieDeliveryReferenceDecode.ts +107 -0
  322. package/src/runAutoMovieDeliverySourceAudioDecode.ts +71 -0
  323. package/src/runAutoMovieFfmpeg.ts +48 -14
  324. package/src/runAutoMovieVerification.ts +487 -0
  325. package/src/sameAutoMovieReviewFile.ts +23 -0
  326. package/src/selectAutoMovieProjectName.ts +8 -11
  327. package/src/serveAutoMovieDrawPage.ts +16 -12
  328. package/src/serveAutoMovieInspectorPage.ts +6 -9
  329. package/src/verifyAutoMovie.ts +67 -0
  330. package/src/writeAutoMovieModulePage.ts +17 -12
  331. package/src/writeAutoMovieVerificationReceipt.ts +51 -0
package/src/run.ts CHANGED
@@ -17,6 +17,7 @@ import { renderAutoMovie } from "./renderAutoMovie";
17
17
  import { renderAutoMovieScaffoldNextSteps } from "./renderAutoMovieScaffoldNextSteps";
18
18
  import { reviewAutoMovie } from "./reviewAutoMovie";
19
19
  import { selectAutoMovieProjectName } from "./selectAutoMovieProjectName";
20
+ import { verifyAutoMovie } from "./verifyAutoMovie";
20
21
 
21
22
  const USAGE: string = `automovie: scaffold an automovie project, and capture, render and review it
22
23
 
@@ -26,8 +27,11 @@ Usage:
26
27
  automovie capture --module <file> [--props <json>] [--backend software|gpu] [--out <dir>] [<request>]
27
28
  automovie capture --file <video> [--out <dir>] [<request>]
28
29
  automovie inspect --module <file> [--props <json>] [--port <n>] [<request>]
30
+ automovie verify [--module <file>] [--subject <id>] [--only <check>] [--run] [--require <stage>] [--json]
29
31
  automovie render --module <file> [--subject <name>] [--props <json>] [--out <dir>] [--backend software|gpu]
30
32
  automovie review --url <inspector address> --seconds <s> [--out <dir>]
33
+ automovie review --file <video> (--at <s> | --from <s> --to <s>) --note <text> [--out <dir>]
34
+ automovie review --mark <review.json> [--file <video>] [--out <dir>]
31
35
 
32
36
  Commands:
33
37
  create A single production, or with --workspace a pnpm workspace
@@ -42,6 +46,8 @@ Commands:
42
46
  subjects a module offers and print its address, whose query
43
47
  is the request. Needs @automovie/render, @automovie/viewer,
44
48
  react, react-dom and vite there; Ctrl+C stops it.
49
+ verify Read selected production observations or run their declared
50
+ checks. --require gates an adopted stage.
45
51
  render In a production, draw every frame of one subject through the
46
52
  draw page in headless Chromium and encode film.mp4 with
47
53
  render-report.json. Needs what capture needs, and FFmpeg.
@@ -61,11 +67,18 @@ Options:
61
67
  called with; default null.
62
68
  --file capture: an encoded video file instead of a subject.
63
69
  --backend capture, render: software (SwiftShader, the default) or gpu.
70
+ --timeout-ms capture, render: budget per browser navigation, subject
71
+ preparation or draw call (default 120000 ms).
64
72
  --out capture: the folder; default media/capture/<subject>.
65
73
  render: default media/automovie/<subject>/videos.
66
74
  review: default media/automovie/review.
67
75
  --url review: the running inspector page's address.
68
- --seconds review: wall-clock seconds of playback recorded.
76
+ --seconds review: wall-clock seconds of Inspector playback recorded.
77
+ --at review: point in film seconds, or select --from and --to.
78
+ --mark review: reopen exact source bytes or rebind with --file and a new time.
79
+ --reviewer review: with --decision accepted|needs-repair and --viewed still|playback|listening,
80
+ explicitly record the named reviewer's decision. Use --at for a still,
81
+ or --from and --to for playback or listening.
69
82
  <request> capture, inspect: --subject, --at, --from, --to, --rate, --events,
70
83
  --views, --passes, --marks, --label, --round, --compare and
71
84
  every other key of the capture request grammar; render takes
@@ -75,30 +88,44 @@ Options:
75
88
  `;
76
89
 
77
90
  /**
78
- * The `automovie` CLI entry. `argv` is the full process vector; its first two positions (executable and script) are skipped.
91
+ * The `automovie` CLI entry. `argv` is the full process vector; its first two
92
+ * positions (executable and script) are skipped.
79
93
  *
80
- * - `help` and `version` write to stdout; the version is read from this package's `package.json`.
81
- * - `create` writes a single production, or with `--workspace` a workspace root, into the directory resolved against the working directory. The name is the typed `--name`, else derived from the target's basename; for the working directory itself the terminal is asked, offering `automovie-examples`, which is used without asking when no terminal is attached.
82
- * - `add` fills missing scaffold catalog entries in the working directory's `pnpm-workspace.yaml` and writes a production into `movies/<family>/<directory>`. Its name is `--name` or the npm-safe name derived from the directory segment.
83
- * - `capture` runs `captureAutoMovie` in the working directory as the production, resolving to its status: 1 when a cell was not drawn.
84
- * - `inspect` runs `inspectAutoMovie` in the working directory, serving the inspector page until the process is interrupted.
85
- * - `render` runs `renderAutoMovie` in the working directory as the production, resolving to 0 once the video is written.
86
- * - `review` runs `reviewAutoMovie`, resolving to 1 when the recorded page reported a script error.
94
+ * - `help` and `version` write to stdout; the version is read from this package's
95
+ * `package.json`.
96
+ * - `create` writes a single production, or with `--workspace` a workspace root,
97
+ * into the directory resolved against the working directory. The name is the
98
+ * typed `--name`, else derived from the target's basename; for the working
99
+ * directory itself the terminal is asked, offering `automovie-examples`,
100
+ * which is used without asking when no terminal is attached.
101
+ * - `add` fills missing scaffold catalog entries in the working directory's
102
+ * `pnpm-workspace.yaml` and writes a production into
103
+ * `movies/<family>/<directory>`. Its name is `--name` or the npm-safe name
104
+ * derived from the directory segment.
105
+ * - `capture` runs `captureAutoMovie` in the working directory as the production,
106
+ * resolving to its status: 1 when a cell was not drawn.
107
+ * - `inspect` runs `inspectAutoMovie` in the working directory, serving the
108
+ * inspector page until the process is interrupted.
109
+ * - `render` runs `renderAutoMovie` in the working directory as the production,
110
+ * resolving to 0 once the video is written.
111
+ * - `review` runs `reviewAutoMovie`, resolving to 1 when the recorded page
112
+ * reported a script error.
87
113
  *
88
- * `create` and `add` take their files from `createAutoMovieScaffold` and refuse a non-empty target without `--force`, which writes over same-path files and keeps every other file. On success they list the written files relative to the target, then the next steps. A failed write stops there and leaves the files already written.
114
+ * `create` and `add` take their files from `createAutoMovieScaffold` and refuse
115
+ * a non-empty target without `--force`, which writes over same-path files and
116
+ * keeps every other file. On success they list the written files relative to
117
+ * the target, then the next steps. A failed write stops there and leaves the
118
+ * files already written.
89
119
  *
90
- * Resolves to the process exit code, 0 after queuing the requested stdout text or 1 after queuing a caught error's message and distinct `cause` objects' messages without stacks. A repeated cause ends the chain. Reading or stringifying an unusual thrown value, or writing stderr, can itself throw. The executable assigns the result to `process.exitCode` so queued output can drain.
120
+ * Resolves to the process exit code, 0 after queuing the requested stdout text
121
+ * or 1 after queuing a caught error's message and distinct `cause` objects'
122
+ * messages without stacks. A repeated cause ends the chain. Reading or
123
+ * stringifying an unusual thrown value, or writing stderr, can itself throw.
124
+ * The executable assigns the result to `process.exitCode` so queued output can
125
+ * drain.
91
126
  *
92
127
  * @param argv The full process vector.
93
128
  * @returns The exit code.
94
- *
95
- * @evidence contracts/development/implementation.md#principled-implementation Parsing finishes before the scaffold is created, the whole file map exists before the first write, and path.resolve binds every target to the current working directory. describeError follows distinct cause values with a set to terminate cycles, but assumes their message access and string conversion do not throw.
96
- * @evidence contracts/development/implementation.md#clear-and-simple-structure This dispatcher delegates admission, name choice, the prompt and closing text to CLI owners and the file map to the template package, keeping only the write. Only bin.ts invokes it at module load, so importing run does not execute a request.
97
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts `add` checks only the working directory for `pnpm-workspace.yaml` and never searches ancestors. The catch reports failures without stacks and never retries a write or rolls back files.
98
- * @evidence contracts/development/common.md#meaningful-documentation The comment gives argv ownership, every command's effect, name and target choice, retained file effects, and the returned status.
99
- * @evidence contracts/development/implementation.md#efficient-algorithms For n files, creation reads the scaffold once and each file is written once with its directory ensured; listing scans the written paths once. Failure formatting additionally walks the distinct cause chain.
100
- * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Every command takes fresh filesystem observations and reads the installed scaffold anew.
101
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The file map and listing text scale with scaffold size; the cause set scales with chain length without a fixed cap. The prompt closes its terminal interface before returning. This dispatcher owns no descriptor; queued stdout and stderr bytes belong to the process streams.
102
129
  */
103
130
  export async function run(argv: readonly string[]): Promise<number> {
104
131
  try {
@@ -124,6 +151,12 @@ export async function run(argv: readonly string[]): Promise<number> {
124
151
  args: command.args,
125
152
  root: process.cwd(),
126
153
  });
154
+ if (command.command === "verify")
155
+ return await verifyAutoMovie({
156
+ args: command.args,
157
+ root: process.cwd(),
158
+ env: process.env,
159
+ });
127
160
  if (command.command === "render")
128
161
  return await renderAutoMovie({
129
162
  args: command.args,
@@ -176,7 +209,9 @@ export async function run(argv: readonly string[]): Promise<number> {
176
209
  }
177
210
 
178
211
  /**
179
- * Write one created installation into `directory`, then list the written files and the next steps. A non-empty directory is refused unless `force` is set, which writes over same-path files and keeps every other file.
212
+ * Write one created installation into `directory`, then list the written files
213
+ * and the next steps. A non-empty directory is refused unless `force` is set,
214
+ * which writes over same-path files and keeps every other file.
180
215
  */
181
216
  function write(
182
217
  directory: string,
@@ -208,7 +243,10 @@ function write(
208
243
  );
209
244
  }
210
245
 
211
- /** Replace an incomplete catalog atomically. A concurrent updater or editor leaves this invocation free to retry. */
246
+ /**
247
+ * Replace an incomplete catalog atomically. A concurrent updater or editor
248
+ * leaves this invocation free to retry.
249
+ */
212
250
  function completeCatalogs(file: string): void {
213
251
  const target: string = fs.realpathSync(file);
214
252
  const source: string = fs.readFileSync(target, "utf8");
@@ -242,17 +280,29 @@ function completeCatalogs(file: string): void {
242
280
  }
243
281
 
244
282
  /**
245
- * This package's version, read at runtime from the sibling `package.json` (`require`, not an `import`, so it stays outside `rootDir`). `__dirname` resolves to `src` under ttsx and `lib` when published; the file sits one level up in both.
283
+ * This package's version, read at runtime from the sibling `package.json`
284
+ * (`require`, not an `import`, so it stays outside `rootDir`). `__dirname`
285
+ * resolves to `src` under ttsx and `lib` when published; the file sits one
286
+ * level up in both.
246
287
  */
247
288
  function packageVersion(): string {
248
- const manifest: { version: string } = require(
289
+ const manifest: IAutoMovieCliManifest = require(
249
290
  path.join(__dirname, "..", "package.json"),
250
- ) as { version: string };
291
+ );
251
292
  return manifest.version;
252
293
  }
253
294
 
295
+ /** The field of this package's `package.json` the command reads. */
296
+ interface IAutoMovieCliManifest {
297
+ /** The package's version, as `npm` publishes it. */
298
+ version: string;
299
+ }
300
+
254
301
  /**
255
- * One stderr block: the error's message, then each distinct cause value's message on its own `caused by:` line. Values outside `Error` are stringified and end the chain. Repeated object identity or primitive value stops traversal; getters and string conversion can throw.
302
+ * One stderr block: the error's message, then each distinct cause value's
303
+ * message on its own `caused by:` line. Values outside `Error` are stringified
304
+ * and end the chain. Repeated object identity or primitive value stops
305
+ * traversal; getters and string conversion can throw.
256
306
  */
257
307
  function describeError(error: unknown): string {
258
308
  const lines: string[] = [];
@@ -0,0 +1,45 @@
1
+ import type {
2
+ IAutoMovieDeliveryContentAudit,
3
+ IAutoMovieLoudnessMeter,
4
+ } from "@automovie/interface";
5
+
6
+ import { decodeAutoMovieDeliveryAudio } from "./decodeAutoMovieDeliveryAudio";
7
+ import { planAutoMovieDeliveryAudioDecode } from "./planAutoMovieDeliveryAudioDecode";
8
+ import { readAutoMovieDeliveryAudioTrack } from "./readAutoMovieDeliveryAudioTrack";
9
+ import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
10
+
11
+ /**
12
+ * Audits audio from the same encoded artifact as the video decode. Uses
13
+ * streamed PCM for content, the decoder's native sample clock for coverage and
14
+ * the container's presented duration to separate codec padding.
15
+ *
16
+ * @param binary The FFmpeg executable already resolved by the delivery host.
17
+ * @param path The encoded artifact to decode without modification.
18
+ * @param streamIndex The primary audio stream observed in the input listing.
19
+ * @param thresholds The audio silence threshold and minimum duration.
20
+ * @param run The established FFmpeg process owner with separate output
21
+ * consumers.
22
+ * @param meter Creates the render's loudness meter, when the decoded loudness
23
+ * and true peak are measured.
24
+ * @returns Audio evidence or a reason decoded content is uncovered.
25
+ */
26
+ export async function runAutoMovieDeliveryAudioDecode(
27
+ binary: string,
28
+ path: string,
29
+ streamIndex: number,
30
+ thresholds: IAutoMovieDeliveryContentAudit.IThresholds["silence"],
31
+ run: typeof runAutoMovieFfmpeg,
32
+ meter?: (channels: 1 | 2) => IAutoMovieLoudnessMeter,
33
+ ): Promise<IAutoMovieDeliveryContentAudit.Stream> {
34
+ const track = await readAutoMovieDeliveryAudioTrack(path, streamIndex);
35
+ if (track.status === "uncovered") return track;
36
+ return decodeAutoMovieDeliveryAudio(
37
+ binary,
38
+ planAutoMovieDeliveryAudioDecode(path),
39
+ streamIndex,
40
+ thresholds,
41
+ run,
42
+ track,
43
+ meter,
44
+ );
45
+ }
@@ -0,0 +1,63 @@
1
+ import type {
2
+ IAutoMovieDeliveryContentAudit,
3
+ IAutoMovieLoudnessMeter,
4
+ } from "@automovie/interface";
5
+
6
+ import { planAutoMovieDeliveryDecode } from "./planAutoMovieDeliveryDecode";
7
+ import { readAutoMovieDeliveryDecode } from "./readAutoMovieDeliveryDecode";
8
+ import { runAutoMovieDeliveryAudioDecode } from "./runAutoMovieDeliveryAudioDecode";
9
+ import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
10
+
11
+ type Audit = IAutoMovieDeliveryContentAudit.IProps;
12
+
13
+ /**
14
+ * Decodes one encoded delivery to obtain native timing and content evidence.
15
+ * The primary video decode also inventories the source. Audio is decoded only
16
+ * when the source lists a primary audio stream.
17
+ *
18
+ * @param binary The resolved FFmpeg executable.
19
+ * @param artifact The same delivery artifact whose bytes the host hashes.
20
+ * @param expected The commissioned frame count and rational frame rate.
21
+ * @param thresholds Effective video detector and silence thresholds.
22
+ * @param run Process owner with separate binary and text output channels.
23
+ * @param meter Creates the render's loudness meter, when the decoded audio's
24
+ * loudness and true peak are measured.
25
+ * @returns Native evidence, absence or reasoned uncovered status per stream.
26
+ */
27
+ export async function runAutoMovieDeliveryDecode(
28
+ binary: string,
29
+ artifact: string,
30
+ expected: Pick<Audit["expected"], "frameCount" | "frameRate">,
31
+ thresholds: Audit["thresholds"],
32
+ run: typeof runAutoMovieFfmpeg = runAutoMovieFfmpeg,
33
+ meter?: (channels: 1 | 2) => IAutoMovieLoudnessMeter,
34
+ ): Promise<Audit["streams"]> {
35
+ try {
36
+ const log = await run(
37
+ binary,
38
+ planAutoMovieDeliveryDecode(artifact, expected.frameRate, thresholds),
39
+ );
40
+ const decoded = readAutoMovieDeliveryDecode(log, expected);
41
+ const audio =
42
+ decoded.audioIndex === undefined
43
+ ? decoded.audio
44
+ : await runAutoMovieDeliveryAudioDecode(
45
+ binary,
46
+ artifact,
47
+ decoded.audioIndex,
48
+ thresholds.silence,
49
+ run,
50
+ meter,
51
+ );
52
+ return { video: decoded.video, audio };
53
+ } catch (error) {
54
+ const reason = error instanceof Error ? error.message : String(error);
55
+ return {
56
+ video: { status: "uncovered", reason },
57
+ audio: {
58
+ status: "uncovered",
59
+ reason: "The delivery input stream listing was incomplete",
60
+ },
61
+ };
62
+ }
63
+ }
@@ -0,0 +1,107 @@
1
+ import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
2
+
3
+ import { planAutoMovieDeliveryDecode } from "./planAutoMovieDeliveryDecode";
4
+ import { readAutoMovieDeliveryDecode } from "./readAutoMovieDeliveryDecode";
5
+ import { runAutoMovieDeliverySourceAudioDecode } from "./runAutoMovieDeliverySourceAudioDecode";
6
+ import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
7
+
8
+ type Audit = IAutoMovieDeliveryContentAudit.IProps;
9
+ type Stream = IAutoMovieDeliveryContentAudit.Stream;
10
+
11
+ /**
12
+ * Measures what the encoder was given, with the same detectors and thresholds
13
+ * as the delivered file: the drawn image sequence and the soundtrack as the
14
+ * encoder pads and cuts it. The audit attributes a delivered black, frozen or
15
+ * silent interval to the drawn source when this reference shows it too.
16
+ *
17
+ * Both inputs are read from the encoder's own argument vector, so the reference
18
+ * is exactly what produced the delivery: the first `-i` with the `-framerate`
19
+ * before it is the picture, a second `-i` is the soundtrack, and the last `-t`
20
+ * is the cut. Call it while the drawn frames still exist.
21
+ *
22
+ * @param binary The FFmpeg executable already resolved by the delivery host.
23
+ * @param encoder The argument vector the delivery encode ran with.
24
+ * @param expected The commissioned frame count and rational frame rate.
25
+ * @param thresholds The effective detector settings of the delivery audit.
26
+ * @param run The established FFmpeg process owner.
27
+ * @returns Reference evidence per medium: decoded, missing when the encoder had
28
+ * no soundtrack, or uncovered with its reason.
29
+ */
30
+ export async function runAutoMovieDeliveryReferenceDecode(
31
+ binary: string,
32
+ encoder: readonly string[],
33
+ expected: Pick<Audit["expected"], "frameCount" | "frameRate">,
34
+ thresholds: Audit["thresholds"],
35
+ run: typeof runAutoMovieFfmpeg = runAutoMovieFfmpeg,
36
+ ): Promise<{ video: Stream; audio: Stream }> {
37
+ const inputs = readEncoderInputs(encoder);
38
+ if (inputs === null) {
39
+ const reason = "The delivery encoder arguments name no picture input";
40
+ return {
41
+ video: { status: "uncovered", reason },
42
+ audio: { status: "uncovered", reason },
43
+ };
44
+ }
45
+
46
+ let video: Stream;
47
+ try {
48
+ const log = await run(
49
+ binary,
50
+ planAutoMovieDeliveryDecode(
51
+ inputs.picture,
52
+ expected.frameRate,
53
+ thresholds,
54
+ ["-framerate", inputs.frameRate],
55
+ ),
56
+ );
57
+ video = readAutoMovieDeliveryDecode(log, expected).video;
58
+ } catch (error) {
59
+ video = {
60
+ status: "uncovered",
61
+ reason: error instanceof Error ? error.message : String(error),
62
+ };
63
+ }
64
+
65
+ const audio: Stream =
66
+ inputs.soundtrack === null
67
+ ? { status: "missing" }
68
+ : inputs.seconds === null
69
+ ? {
70
+ status: "uncovered",
71
+ reason: "The delivery encoder arguments name no duration",
72
+ }
73
+ : await runAutoMovieDeliverySourceAudioDecode(
74
+ binary,
75
+ inputs.soundtrack,
76
+ inputs.seconds,
77
+ thresholds.silence,
78
+ run,
79
+ );
80
+ return { video, audio };
81
+ }
82
+
83
+ /**
84
+ * Reads the picture input, its frame rate, an optional soundtrack and the cut
85
+ * from an encoder vector.
86
+ */
87
+ function readEncoderInputs(encoder: readonly string[]): {
88
+ picture: string;
89
+ frameRate: string;
90
+ soundtrack: string | null;
91
+ seconds: string | null;
92
+ } | null {
93
+ const first = encoder.indexOf("-i");
94
+ const rate = encoder.lastIndexOf("-framerate", first);
95
+ const picture = encoder[first + 1];
96
+ const frameRate = encoder[rate + 1];
97
+ if (first < 0 || rate < 0 || picture === undefined || frameRate === undefined)
98
+ return null;
99
+ const second = encoder.indexOf("-i", first + 2);
100
+ const cut = encoder.lastIndexOf("-t");
101
+ return {
102
+ picture,
103
+ frameRate,
104
+ soundtrack: second < 0 ? null : (encoder[second + 1] ?? null),
105
+ seconds: cut < 0 ? null : (encoder[cut + 1] ?? null),
106
+ };
107
+ }
@@ -0,0 +1,71 @@
1
+ import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
2
+
3
+ import { decodeAutoMovieDeliveryAudio } from "./decodeAutoMovieDeliveryAudio";
4
+ import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
5
+
6
+ /** The delivery encoder's soundtrack rate, in Hz. */
7
+ const SOURCE_SAMPLE_RATE = 48_000;
8
+
9
+ /**
10
+ * Audits a soundtrack exactly as the delivery encoder feeds it: resampled to 48
11
+ * kHz stereo, padded with silence and cut at the encoder's own duration,
12
+ * rounded to the nearest sample. The cut is made inside the filter graph, ahead
13
+ * of the frame log, so the log and the PCM see the same samples; an output `-t`
14
+ * would shorten only the PCM. This is the source the encoded audio is compared
15
+ * with. Uncompressed PCM has no codec padding, so every decoded sample is
16
+ * presented.
17
+ *
18
+ * @param binary The FFmpeg executable already resolved by the delivery host.
19
+ * @param soundtrack The soundtrack file the encoder read.
20
+ * @param seconds The encoder's own `-t` argument, unchanged.
21
+ * @param thresholds The audio silence threshold and minimum duration.
22
+ * @param run The established FFmpeg process owner with separate output
23
+ * consumers.
24
+ * @returns Source audio evidence as stream zero, or a reason it is uncovered.
25
+ */
26
+ export async function runAutoMovieDeliverySourceAudioDecode(
27
+ binary: string,
28
+ soundtrack: string,
29
+ seconds: string,
30
+ thresholds: IAutoMovieDeliveryContentAudit.IThresholds["silence"],
31
+ run: typeof runAutoMovieFfmpeg,
32
+ ): Promise<IAutoMovieDeliveryContentAudit.Stream> {
33
+ const samples = Math.round(Number(seconds) * SOURCE_SAMPLE_RATE);
34
+ if (!Number.isSafeInteger(samples) || samples < 1)
35
+ return {
36
+ status: "uncovered",
37
+ reason:
38
+ "The encoder's soundtrack duration is not a positive sample count",
39
+ };
40
+ return decodeAutoMovieDeliveryAudio(
41
+ binary,
42
+ [
43
+ "-hide_banner",
44
+ "-nostdin",
45
+ "-nostats",
46
+ "-xerror",
47
+ "-i",
48
+ soundtrack,
49
+ "-map",
50
+ "0:a:0",
51
+ "-vn",
52
+ "-af",
53
+ [
54
+ "aresample=" + SOURCE_SAMPLE_RATE,
55
+ "aformat=sample_fmts=flt:channel_layouts=stereo",
56
+ "apad=whole_len=" + samples,
57
+ "atrim=end_sample=" + samples,
58
+ "ashowinfo",
59
+ ].join(","),
60
+ "-c:a",
61
+ "pcm_f32le",
62
+ "-f",
63
+ "f32le",
64
+ "pipe:1",
65
+ ],
66
+ 0,
67
+ thresholds,
68
+ run,
69
+ undefined,
70
+ );
71
+ }
@@ -1,43 +1,77 @@
1
1
  import { spawn } from "node:child_process";
2
2
 
3
+ /** Optional consumers for a decoder that produces binary and text evidence. */
4
+ interface IAutoMovieFfmpegOutput {
5
+ stdout?: (chunk: Buffer) => void;
6
+ stderr?: (chunk: string) => void;
7
+ }
8
+
3
9
  /** Lines of FFmpeg's error output kept for a failure message. */
4
10
  const TAIL: number = 12;
5
11
 
6
12
  /**
7
- * Run FFmpeg once with the given arguments, resolving with its error output when it exits as `accept` allows and rejecting otherwise.
13
+ * Run FFmpeg once with the given arguments, resolving with its error output
14
+ * when it exits as `accept` allows and rejecting otherwise.
8
15
  *
9
- * FFmpeg writes its log, including a probe of every input, to its error output, so that text is what callers read. By default only exit status 0 is accepted; a probe that names no output exits 1 by design and accepts it. A rejection names the binary, the exit status and the last lines of the log.
16
+ * FFmpeg writes its log, including a probe of every input, to its error output,
17
+ * so that text is what callers read. By default only exit status 0 is accepted;
18
+ * a probe that names no output exits 1 by design and accepts it. A rejection
19
+ * names the binary, the exit status and the last lines of the log.
10
20
  *
11
- * @evidence contracts/development/common.md#meaningful-documentation States what is resolved, the acceptance rule and its default, and what a rejection names.
12
- * @evidence contracts/development/implementation.md#principled-implementation `child_process.spawn` without a shell passes each argument as it is, so a path with spaces or quotes needs no escaping.
13
- * @evidence contracts/development/implementation.md#clear-and-simple-structure Spawn, collect the error output, settle on exit.
14
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A failed run is never retried, and a failure to start rejects with its cause.
15
- * @evidence contracts/development/implementation.md#efficient-algorithms Linear in the log FFmpeg writes.
16
- * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each run is its own process.
17
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The child process ends before the promise settles; its log is held until then.
21
+ * Output consumers, when provided, receive chunks as the child writes them. A
22
+ * consumer failure terminates the child and rejects after it has closed.
18
23
  */
19
24
  export function runAutoMovieFfmpeg(
20
25
  binary: string,
21
26
  args: readonly string[],
22
27
  accept: (code: number | null) => boolean = (code: number | null): boolean =>
23
28
  code === 0,
29
+ output?: IAutoMovieFfmpegOutput,
24
30
  ): Promise<string> {
25
31
  return new Promise<string>(
26
32
  (resolve: (log: string) => void, reject: (error: Error) => void): void => {
27
33
  const child: ReturnType<typeof spawn> = spawn(binary, [...args], {
28
- stdio: ["ignore", "ignore", "pipe"],
34
+ stdio: [
35
+ "ignore",
36
+ output?.stdout === undefined ? "ignore" : "pipe",
37
+ "pipe",
38
+ ],
29
39
  windowsHide: true,
30
40
  });
31
41
  let log: string = "";
42
+ let refusal: Error | undefined;
43
+ const consume = <Chunk>(
44
+ stream: "stdout" | "stderr",
45
+ reader: ((chunk: Chunk) => void) | undefined,
46
+ chunk: Chunk,
47
+ ): void => {
48
+ if (reader === undefined || refusal !== undefined) return;
49
+ try {
50
+ reader(chunk);
51
+ } catch (cause) {
52
+ const reason = cause instanceof Error ? cause.message : String(cause);
53
+ refusal = new Error(
54
+ `FFmpeg ${binary} ${stream} consumer failed: ${reason}`,
55
+ { cause },
56
+ );
57
+ child.kill();
58
+ }
59
+ };
60
+ child.stdout?.on("data", (chunk: Buffer): void =>
61
+ consume("stdout", output?.stdout, chunk),
62
+ );
32
63
  child.stderr!.setEncoding("utf8");
33
64
  child.stderr!.on("data", (chunk: string): void => {
34
65
  log += chunk;
66
+ consume("stderr", output?.stderr, chunk);
67
+ });
68
+ child.on("error", (error: Error): void => {
69
+ if (refusal === undefined)
70
+ reject(new Error(`FFmpeg ${binary} did not start`, { cause: error }));
35
71
  });
36
- child.on("error", (error: Error): void =>
37
- reject(new Error(`FFmpeg ${binary} did not start`, { cause: error })),
38
- );
39
72
  child.on("close", (code: number | null): void => {
40
- if (accept(code)) resolve(log);
73
+ if (refusal !== undefined) reject(refusal);
74
+ else if (accept(code)) resolve(log);
41
75
  else
42
76
  reject(
43
77
  new Error(