hyperframes 0.8.207 → 0.8.208

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 (212) hide show
  1. package/dist/{add-LXFWHBE3.js → add-XMWRBMBR.js} +14 -13
  2. package/dist/{agentPromptGenerator-D2E62ZP5.js → agentPromptGenerator-4NJ252MR.js} +6 -2
  3. package/dist/{animatedGifPrep-VBPJZKFT.js → animatedGifPrep-6XURJIPV.js} +8 -7
  4. package/dist/api.js +19 -18
  5. package/dist/{asset-JX4RW3GO.js → asset-I5GGEOB2.js} +2 -2
  6. package/dist/{assetCataloger-JKKOPBCF.js → assetCataloger-YBPXUNUP.js} +10 -8
  7. package/dist/{audio-OXQ3L6DW.js → audio-GFJCHH5W.js} +410 -128
  8. package/dist/{auth-JAL7P7ZA.js → auth-QOA55RYR.js} +4 -4
  9. package/dist/{autoUpdate-MRI2AICE.js → autoUpdate-SPS4QPJU.js} +4 -4
  10. package/dist/{backgroundChecks-ORR46PBY.js → backgroundChecks-HRJO7YK7.js} +5 -5
  11. package/dist/backgroundChecksWorker.js +5 -5
  12. package/dist/{batchRender-IFZYPGIW.js → batchRender-FBP3RKUF.js} +5 -4
  13. package/dist/{beats-UDLOEW6U.js → beats-VNGJ7F6W.js} +21 -14
  14. package/dist/{benchmark-VTVDNKSO.js → benchmark-NZ3N3MIV.js} +10 -10
  15. package/dist/{browser-QJC4BL2Y.js → browser-BD5BKRJ5.js} +8 -8
  16. package/dist/{bundleWithLocalizedFonts-Z2JTBNDS.js → bundleWithLocalizedFonts-WXVNPAWD.js} +3 -3
  17. package/dist/{capture-GLM2ACPM.js → capture-CXWXKWS5.js} +62 -36
  18. package/dist/{capture-2P4JERSX.js → capture-LMJ4TQRL.js} +52 -17
  19. package/dist/{captureCompositionFrame-A2A5MGQB.js → captureCompositionFrame-ZKVCRYYU.js} +14 -13
  20. package/dist/{captureFile-RPUEOZO6.js → captureFile-VIVGKFY4.js} +2 -1
  21. package/dist/{catalog-5ZLVUQVJ.js → catalog-WRXQSCAU.js} +14 -13
  22. package/dist/{catch-up-FRMVYJHZ.js → catch-up-MDSPABFC.js} +6 -6
  23. package/dist/{check-WVY7SM7C.js → check-SIBBK5HA.js} +42 -41
  24. package/dist/{checkAudio-PLEQY3SZ.js → checkAudio-QQBR4HR7.js} +12 -11
  25. package/dist/{checkBrowser-XSZUA2DQ.js → checkBrowser-4EBJLLIH.js} +34 -33
  26. package/dist/{chunk-XDMZY3H7.js → chunk-3O2E4Q66.js} +15 -20
  27. package/dist/{chunk-HVOTYAS4.js → chunk-43MW4SY7.js} +2 -2
  28. package/dist/{chunk-TSTONNOD.js → chunk-4F5NRJ6M.js} +2 -2
  29. package/dist/{chunk-JQ32262N.js → chunk-4HT2L6W2.js} +1 -1
  30. package/dist/{chunk-63DP5CB2.js → chunk-4KG3ESVO.js} +4 -4
  31. package/dist/{chunk-LPI7HX4G.js → chunk-4LTBQEPD.js} +2 -2
  32. package/dist/{chunk-C6KE4AFW.js → chunk-56ANHX5U.js} +1 -1
  33. package/dist/{chunk-XULJBZ7K.js → chunk-5HB4JM7H.js} +2 -2
  34. package/dist/{chunk-PL36HK3U.js → chunk-6CWKORZO.js} +3 -3
  35. package/dist/{chunk-ZF3R2IPC.js → chunk-6DSYBW7Z.js} +1 -0
  36. package/dist/{chunk-T4JGFCXU.js → chunk-6JNSYFOH.js} +4 -4
  37. package/dist/{chunk-5PYRU5DT.js → chunk-6N7D2GUV.js} +15 -15
  38. package/dist/{chunk-WL263XM2.js → chunk-6PWQH77E.js} +1 -1
  39. package/dist/{chunk-UAT2UMTP.js → chunk-6WRN4WC6.js} +1 -1
  40. package/dist/{chunk-SXOD5J7T.js → chunk-7CPI2DWL.js} +1 -1
  41. package/dist/{chunk-UYPWH7PH.js → chunk-7PAK7LZ5.js} +11 -11
  42. package/dist/{chunk-YJK6HOL5.js → chunk-B5MPMIKQ.js} +2 -2
  43. package/dist/{chunk-KDHHPJOG.js → chunk-BKDQFOKK.js} +4 -4
  44. package/dist/{chunk-LCCYYTEK.js → chunk-BLCKQPBE.js} +1 -1
  45. package/dist/chunk-BQMAPNDA.js +4830 -0
  46. package/dist/{chunk-QE4WRS3N.js → chunk-CP225S5H.js} +3 -3
  47. package/dist/{chunk-I2TDHVFV.js → chunk-CSWCZA6V.js} +2 -2
  48. package/dist/{chunk-C53ZNJDZ.js → chunk-D2CE2J2A.js} +1 -1
  49. package/dist/{chunk-NSC5A4IR.js → chunk-DHQSDCWD.js} +6 -2
  50. package/dist/chunk-DROFHVQD.js +240 -0
  51. package/dist/{chunk-NHL5CMO2.js → chunk-DXACKQ3F.js} +3 -3
  52. package/dist/{chunk-IK4JY2LI.js → chunk-EGOXYG3M.js} +2 -2
  53. package/dist/{chunk-UKM3JYNB.js → chunk-ENRFKCI6.js} +3 -3
  54. package/dist/{chunk-NWGXTUYS.js → chunk-EQBDKYXR.js} +3 -30
  55. package/dist/{chunk-4UMPIPCQ.js → chunk-ERUQ3S6D.js} +2 -2
  56. package/dist/{chunk-T2EUWCJE.js → chunk-EU7MVORF.js} +13 -1
  57. package/dist/{chunk-CVZO6TFE.js → chunk-EYEEZXLI.js} +11 -11
  58. package/dist/{chunk-ZCJ5EGLU.js → chunk-FC4WT5FX.js} +79 -1
  59. package/dist/{chunk-GXUONASF.js → chunk-FFDYRJBE.js} +24 -1
  60. package/dist/{chunk-NJNC2DQV.js → chunk-G2A6RC5R.js} +52 -9
  61. package/dist/{chunk-HTIUNMTP.js → chunk-GDZA4ALG.js} +8 -2
  62. package/dist/{chunk-H3LQ5X6Q.js → chunk-GEO6THL3.js} +61 -30
  63. package/dist/{chunk-RPZNQV6D.js → chunk-GHSO62LK.js} +2 -2
  64. package/dist/{chunk-P2I4RLJE.js → chunk-HTZJNQYI.js} +1 -1
  65. package/dist/{chunk-XKW4Z7BU.js → chunk-HUKQW4YE.js} +1 -1
  66. package/dist/{chunk-QZ2JQ6O4.js → chunk-HZN7ICAF.js} +3 -3
  67. package/dist/{chunk-DJQZ7DEH.js → chunk-IIJVSCSH.js} +15 -15
  68. package/dist/{chunk-6KCFVLO6.js → chunk-IL2TMC6F.js} +1 -1
  69. package/dist/{chunk-ZYGIDXAK.js → chunk-J67FSI3Q.js} +104 -58
  70. package/dist/{chunk-5KBMYSF2.js → chunk-K4PHB3YQ.js} +7 -2
  71. package/dist/{chunk-HM7SUIQD.js → chunk-KTWGVEN6.js} +3 -3
  72. package/dist/{chunk-6IYIS2U7.js → chunk-LSMFOZ4F.js} +2 -2
  73. package/dist/{chunk-ELP5QZWL.js → chunk-M4QZFUMW.js} +1 -1
  74. package/dist/{chunk-EG3B2VWK.js → chunk-MBGM26P5.js} +16 -21
  75. package/dist/{chunk-LK6KPVX2.js → chunk-MPO25DQW.js} +291 -160
  76. package/dist/{chunk-DML6BD4K.js → chunk-MW2NQQ6Z.js} +2 -2
  77. package/dist/{chunk-MSHL6CF2.js → chunk-MYO77JWR.js} +1 -1
  78. package/dist/{chunk-PSX5SF2N.js → chunk-NEASABW6.js} +1 -1
  79. package/dist/{chunk-VH4PNYOS.js → chunk-NZ6G5YWZ.js} +2 -2
  80. package/dist/{chunk-LXP6XWJL.js → chunk-ORFRUZPB.js} +1 -1
  81. package/dist/{chunk-UUOIH4RW.js → chunk-OTXXDONS.js} +2 -2
  82. package/dist/{chunk-526VSRZ4.js → chunk-P7WGVXR7.js} +6 -6
  83. package/dist/{chunk-HA3V4XAF.js → chunk-PKVA6MPV.js} +1 -1
  84. package/dist/{chunk-QTWXVOZI.js → chunk-PSOAGSNO.js} +2 -2
  85. package/dist/{chunk-ID766OZB.js → chunk-PWEOSJ3E.js} +3 -3
  86. package/dist/{chunk-EHFZEKQM.js → chunk-Q43YUROE.js} +1 -1
  87. package/dist/{chunk-7PJ3AJB2.js → chunk-QP2MJYTJ.js} +1 -1
  88. package/dist/{chunk-7RWUY3BJ.js → chunk-QWBVPWUI.js} +1 -1
  89. package/dist/{chunk-IYZT62UR.js → chunk-S2OLTAEL.js} +2 -2
  90. package/dist/{chunk-U32PA6DI.js → chunk-S4KHJERB.js} +1 -1
  91. package/dist/{chunk-FEO7YW7V.js → chunk-SI7QCT2J.js} +6 -6
  92. package/dist/{chunk-6Z7XDUUJ.js → chunk-SKKQMW5X.js} +1 -1
  93. package/dist/{chunk-VAVDAOUA.js → chunk-TNTGGDSD.js} +1 -1
  94. package/dist/{chunk-EGRIVMCQ.js → chunk-U6KN6OIP.js} +2 -2
  95. package/dist/{chunk-IBZHSU2J.js → chunk-ULL3U6PV.js} +1 -1
  96. package/dist/{chunk-IW5P4KK7.js → chunk-VR3JLTZD.js} +3 -3
  97. package/dist/{chunk-6KOHY5EP.js → chunk-VS4SK7BN.js} +17 -11
  98. package/dist/{chunk-6N65ZMC5.js → chunk-VYRJAQGC.js} +1 -1
  99. package/dist/{chunk-JKE24AG7.js → chunk-WABB4LZS.js} +1 -1
  100. package/dist/{chunk-I3TYUQLB.js → chunk-WNMVC3IT.js} +1 -1
  101. package/dist/{chunk-MAUGXKSI.js → chunk-X6MCIK7L.js} +100 -13
  102. package/dist/chunk-XFMO3BEN.js +71 -0
  103. package/dist/{chunk-PUIG6DHT.js → chunk-XG3IZV62.js} +7 -7
  104. package/dist/{chunk-VBPNCOD7.js → chunk-XOFBXLMG.js} +2 -2
  105. package/dist/{chunk-FVAI7AHF.js → chunk-XUQYC5DD.js} +5 -5
  106. package/dist/chunk-Z5J67X44.js +40 -0
  107. package/dist/{chunk-XAGBSYIQ.js → chunk-Z5TGBEPJ.js} +1 -1
  108. package/dist/{chunk-7JAD4MEW.js → chunk-ZA5TNF4R.js} +1 -0
  109. package/dist/{clean-TL3IPJDN.js → clean-6GX7WAEC.js} +22 -21
  110. package/dist/cli.js +56 -56
  111. package/dist/{cloud-EYMRPJNY.js → cloud-6PFJKLNL.js} +4 -4
  112. package/dist/{cloudrun-TOJ36NLX.js → cloudrun-UGG3ZFH7.js} +6 -5
  113. package/dist/{compare-MP5EOW4D.js → compare-P4EBOP4B.js} +33 -32
  114. package/dist/{compiler-NOPVLJ2S.js → compiler-PG4RKX6K.js} +3 -3
  115. package/dist/{component-ASACDCZK.js → component-SQPMI3W7.js} +3 -3
  116. package/dist/{compositions-WKNZJY34.js → compositions-KRIHY3IY.js} +14 -13
  117. package/dist/{contactSheet-YOBPATEM.js → contactSheet-RYAE7Y5D.js} +3 -2
  118. package/dist/{delete-DQTFHP3G.js → delete-T5TO4SV6.js} +7 -7
  119. package/dist/{deploy-HHCFOUFM.js → deploy-AO6LQR5G.js} +6 -6
  120. package/dist/{dist-NQEYA4ZX.js → dist-23AAB5X2.js} +2 -2
  121. package/dist/{dist-L4Z4ZEYW.js → dist-6IMEDVMC.js} +1 -1
  122. package/dist/docker/Dockerfile.render +1 -1
  123. package/dist/{doctor-JDM65CP7.js → doctor-QBUJQ655.js} +16 -15
  124. package/dist/{events-RKRHRLJD.js → events-J7CESLKQ.js} +4 -4
  125. package/dist/{events-MBRNA3UF.js → events-SIZO7YHI.js} +5 -5
  126. package/dist/{feedback-LZWIWV5J.js → feedback-74WOJ5PN.js} +12 -12
  127. package/dist/{ffmpeg-4PZKSIGE.js → ffmpeg-AKUP6U2S.js} +10 -9
  128. package/dist/{figma-QFNYUT3F.js → figma-GGMYRR4Q.js} +3 -3
  129. package/dist/fontLocalizeCli.js +11 -10
  130. package/dist/{get-2B5ENJOH.js → get-PLKAI6JM.js} +7 -7
  131. package/dist/{gpuPolicy-E5FB2GFR.js → gpuPolicy-EYDAAPJF.js} +8 -7
  132. package/dist/{grade-compare-4GUAPJHE.js → grade-compare-UADJP4AV.js} +33 -32
  133. package/dist/{heifImagePrep-C2RYIEER.js → heifImagePrep-KDF3OPOK.js} +9 -8
  134. package/dist/{help-XGDAXV67.js → help-WSQQ555Q.js} +1 -1
  135. package/dist/{history-WNFF6HGU.js → history-VSQ2DQ3V.js} +9 -9
  136. package/dist/hyperframe.manifest.json +1 -1
  137. package/dist/hyperframe.runtime.iife.js +67 -67
  138. package/dist/hyperframes-player.global.js +3 -3
  139. package/dist/{info-BR2LKGJD.js → info-MOQ4LRC3.js} +9 -9
  140. package/dist/{init-P6UWPUY3.js → init-EONQSZJG.js} +32 -31
  141. package/dist/{inspect-MSRPF7ZO.js → inspect-OLCVLHOU.js} +32 -31
  142. package/dist/{installer-MPUQS3ZX.js → installer-GHISA75B.js} +4 -4
  143. package/dist/{keyframes-J6K66QTO.js → keyframes-DGQYCY24.js} +8 -8
  144. package/dist/{lambda-LJ2OSWFJ.js → lambda-AMMWF2YH.js} +14 -13
  145. package/dist/{layout-CDY65XGA.js → layout-R6CAPGRO.js} +32 -31
  146. package/dist/{lint-CAUNBGPX.js → lint-QZJEYPHD.js} +9 -9
  147. package/dist/{lintProject-ZTSX3AWT.js → lintProject-W3YVHAGP.js} +1 -1
  148. package/dist/{list-33BYQNRZ.js → list-KCJID4SP.js} +7 -7
  149. package/dist/localPage-V3HBGM3Z.js +27 -0
  150. package/dist/{login-5QMRKOHK.js → login-7HKBEPJS.js} +7 -7
  151. package/dist/{logout-JYFWWUGK.js → logout-3IID4KXD.js} +3 -3
  152. package/dist/{manager-3JOHHPVR.js → manager-6YSKJMVD.js} +11 -10
  153. package/dist/{manager-RMYSZ3KI.js → manager-Z7W4GQGF.js} +4 -4
  154. package/dist/{media-treatment-4WP22CFN.js → media-treatment-E3DL6LEZ.js} +25 -22
  155. package/dist/{models-HPWCHAZX.js → models-URWI7YEG.js} +15 -14
  156. package/dist/{motionShot-I7GDIROQ.js → motionShot-27IXMDJK.js} +18 -17
  157. package/dist/{normalize-audio-VTMXPSC7.js → normalize-audio-WGRLPR3P.js} +9 -9
  158. package/dist/{open-SAO7OQTT.js → open-LQ35PLEN.js} +13 -13
  159. package/dist/{parakeetRunner-ZYPBIA73.js → parakeetRunner-XASVIDTI.js} +16 -15
  160. package/dist/{pipeline-VNBMR6QU.js → pipeline-GA7QVCHS.js} +11 -10
  161. package/dist/{play-7VI6A7KN.js → play-RYZP77CI.js} +21 -21
  162. package/dist/{policies-GHVXA5PE.js → policies-PKLD4UW5.js} +1 -1
  163. package/dist/{preflight-VWV7L45J.js → preflight-HJFSJXXF.js} +12 -11
  164. package/dist/{present-CSJGYOFF.js → present-YBMLOWZV.js} +17 -17
  165. package/dist/{preview-B246ZTVO.js → preview-QIRKJCRV.js} +23 -22
  166. package/dist/{producer-WJLFDVQJ.js → producer-524FDOLX.js} +1 -1
  167. package/dist/{projectConfig-OMR46ZWQ.js → projectConfig-IDQN5ZRW.js} +6 -6
  168. package/dist/{publication-AA7NNYET.js → publication-3X3IGSDO.js} +2 -2
  169. package/dist/{publish-TJ4QVVSP.js → publish-2BF7K6HX.js} +13 -13
  170. package/dist/{refresh-USSFPJAU.js → refresh-3IRHJEQA.js} +3 -3
  171. package/dist/{remove-background-LQ2V7W7N.js → remove-background-EZBCEFT6.js} +12 -11
  172. package/dist/{render-E5QJG74D.js → render-EFUA2A6A.js} +6 -5
  173. package/dist/{render-JLTNZ36U.js → render-JFMTAXHD.js} +43 -41
  174. package/dist/{render-AWEEPG3F.js → render-TEEBI2UT.js} +30 -26
  175. package/dist/{render-batch-U4T4VSCM.js → render-batch-XTYNXVSW.js} +7 -6
  176. package/dist/renderSetupWorker.js +6 -6
  177. package/dist/{resolver-GXCTUKPV.js → resolver-FZS6TN6B.js} +4 -4
  178. package/dist/{screenshotCapture-X6OKIXCB.js → screenshotCapture-HOW4VSV6.js} +3 -2
  179. package/dist/{sherpa-4VZWVHWZ.js → sherpa-TQIAIKTH.js} +15 -14
  180. package/dist/skills/hyperframes/SKILL.md +1 -1
  181. package/dist/skills/hyperframes/references/format.md +1 -0
  182. package/dist/skills/hyperframes-cli/references/beats.md +2 -0
  183. package/dist/skills/media-use/references/grading.md +2 -0
  184. package/dist/skills/media-use/references/local.md +1 -0
  185. package/dist/{skills-WUKR7SUE.js → skills-S6ZG5KKH.js} +7 -7
  186. package/dist/{skillsUpdateCheck-YXRBY3JC.js → skillsUpdateCheck-XC7JQL3F.js} +5 -5
  187. package/dist/{snapshot-Q7S2FTNG.js → snapshot-ERYZIM32.js} +66 -47
  188. package/dist/{src-ZOXUSGAP.js → src-6XOMREMS.js} +7 -6
  189. package/dist/{src-CLAALR5W.js → src-OL6RHPE4.js} +10 -9
  190. package/dist/{staticProjectServer-DQ7PIDPA.js → staticProjectServer-JYDDGPAH.js} +16 -16
  191. package/dist/{status-LR7VXITS.js → status-DTP6ZYDU.js} +3 -3
  192. package/dist/studio/assets/{hyperframes-player-Cm5aBiKq.js → hyperframes-player-5dRdMVOq.js} +3 -3
  193. package/dist/studio/assets/{index-BF9YeBnC.js → index-Bu3mJUU2.js} +71 -71
  194. package/dist/studio/assets/{index-BrqAmMRt.js → index-ZqyQ91pm.js} +1 -1
  195. package/dist/studio/index.html +1 -1
  196. package/dist/{studio-api-NUE227JM.js → studio-api-GRU4SHKD.js} +9 -9
  197. package/dist/{studioServer-HVOKP4VI.js → studioServer-OYPBEI5B.js} +54 -53
  198. package/dist/{telemetry-IHU4HL3R.js → telemetry-6BPSGY5W.js} +2 -2
  199. package/dist/{telemetry-2Y5JXLDB.js → telemetry-CPYINR63.js} +5 -5
  200. package/dist/{timeline-WOQGXFRV.js → timeline-RGK5BMPD.js} +23 -22
  201. package/dist/{tokens-T3OHTWUC.js → tokens-EX4BOWRW.js} +2 -2
  202. package/dist/{transcribe-4U74P5TG.js → transcribe-MK367I6A.js} +14 -13
  203. package/dist/{transcribe-JZ3BO546.js → transcribe-RI52JMVW.js} +21 -20
  204. package/dist/{updateCheck-6EUAGAM4.js → updateCheck-BIEJKQI4.js} +4 -4
  205. package/dist/{upgrade-55K6F4MP.js → upgrade-ES3UUI7O.js} +4 -4
  206. package/dist/{urlDownloader-47JMOLNN.js → urlDownloader-XAGYSTAG.js} +7 -6
  207. package/dist/{validate-QBJ3SBS4.js → validate-A6GZHNEI.js} +26 -25
  208. package/dist/{video-3ZAUNAR3.js → video-OEMGR3MN.js} +10 -8
  209. package/dist/warmCheck.js +42 -41
  210. package/package.json +1 -1
  211. package/dist/chunk-BDJIQZN2.js +0 -4830
  212. package/dist/{destroy-SSPAKADI.js → destroy-CGAZIL2C.js} +4 -4
@@ -4,6 +4,9 @@ import { dirname as __hf_dirname } from "node:path";
4
4
  var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ removeTreeBestEffort
9
+ } from "./chunk-Z5J67X44.js";
7
10
  import {
8
11
  alphaDecoderFor,
9
12
  pixelFormatHasAlpha,
@@ -29,7 +32,7 @@ import {
29
32
  renderFrameIdForRenderId,
30
33
  resolveAuthoredTimingWindow,
31
34
  toFps
32
- } from "./chunk-7RWUY3BJ.js";
35
+ } from "./chunk-QWBVPWUI.js";
33
36
  import {
34
37
  AUDIO_GROUP_RENDER_ID_ATTR,
35
38
  AUTHORED_SOURCE_BEGIN,
@@ -72,7 +75,7 @@ import {
72
75
  sourceTimeAt,
73
76
  timeAtSourceTime,
74
77
  volumeSegmentSampleCount
75
- } from "./chunk-BDJIQZN2.js";
78
+ } from "./chunk-BQMAPNDA.js";
76
79
  import {
77
80
  redactTelemetryString,
78
81
  redactUrlQueryStrings
@@ -87,10 +90,10 @@ import {
87
90
  exceedsChromeCeiling,
88
91
  isManagedChromeDir,
89
92
  pickSharedShell
90
- } from "./chunk-4UMPIPCQ.js";
93
+ } from "./chunk-ERUQ3S6D.js";
91
94
  import {
92
95
  resolveReferencedStart
93
- } from "./chunk-ZCJ5EGLU.js";
96
+ } from "./chunk-FC4WT5FX.js";
94
97
  import {
95
98
  FFMPEG_PATH_ENV,
96
99
  FFPROBE_PATH_ENV,
@@ -590,6 +593,86 @@ var SDR_RGB_TO_BT709_FILTER = "scale=out_color_matrix=bt709:out_range=tv:flags=n
590
593
  var SDR_RGB_TO_TAGGED_BT709_FILTER = `${SDR_RGB_TO_BT709_FILTER},setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709:range=tv`;
591
594
  var SDR_CAPTURE_TO_BT709_FILTER = `scale=in_color_matrix=bt601:in_range=pc:flags=neighbor+accurate_rnd,format=gbrp,${SDR_RGB_TO_TAGGED_BT709_FILTER}`;
592
595
 
596
+ // ../engine/src/services/chromeStartup.ts
597
+ import { spawn } from "child_process";
598
+ import { mkdtempSync } from "fs";
599
+ import { tmpdir as tmpdir2 } from "os";
600
+ import { join as join2 } from "path";
601
+ var STDERR_TAIL_LINES = 8;
602
+ var PROBE_TIMEOUT_MS = 8e3;
603
+ var WINDOWS_EXITS = [
604
+ [3221225781, "0xC0000135: a required runtime or DLL is missing (Visual C++ runtime)."],
605
+ [3221225495, "0xC0000017: Windows had no memory to start it (out of memory)."],
606
+ [3221225794, "0xC0000142: a DLL failed to initialise, often security software blocking it."],
607
+ [3221225506, "0xC0000022: access denied, often antivirus or a policy blocking the executable."],
608
+ [3221225595, "0xC000007B: the executable and a DLL do not match (32-bit and 64-bit)."]
609
+ ];
610
+ function nameChromeExit(code, platform = process.platform) {
611
+ if (platform !== "win32" || code === null) return void 0;
612
+ const unsigned = code >>> 0;
613
+ return WINDOWS_EXITS.find(([known]) => known === unsigned)?.[1];
614
+ }
615
+ function startupArgs(args, profile) {
616
+ const kept = args.filter(
617
+ (arg) => arg.startsWith("--") && !arg.startsWith("--remote-debugging") && !arg.startsWith("--user-data-dir")
618
+ );
619
+ return [...kept, `--user-data-dir=${profile}`, "--remote-debugging-port=0", "about:blank"];
620
+ }
621
+ function tail(stderr) {
622
+ return stderr.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(-STDERR_TAIL_LINES).join("\n");
623
+ }
624
+ async function diagnoseChromeStartup(executablePath, args, options = {}) {
625
+ const profile = mkdtempSync(join2(tmpdir2(), "hf-chrome-probe-"));
626
+ const timeoutMs = options.timeoutMs ?? PROBE_TIMEOUT_MS;
627
+ try {
628
+ return await new Promise((resolve2) => {
629
+ let stderr = "";
630
+ const child = spawn(executablePath, startupArgs(args, profile), {
631
+ stdio: ["ignore", "ignore", "pipe"],
632
+ windowsHide: true
633
+ });
634
+ const timer = setTimeout(() => {
635
+ child.kill();
636
+ resolve2(`Chrome started and kept running for ${timeoutMs} ms when launched on its own.`);
637
+ }, timeoutMs);
638
+ options.signal?.addEventListener(
639
+ "abort",
640
+ () => {
641
+ clearTimeout(timer);
642
+ child.kill();
643
+ resolve2("The startup check was cancelled.");
644
+ },
645
+ { once: true }
646
+ );
647
+ child.stderr.on("data", (chunk) => {
648
+ stderr = (stderr + chunk.toString()).slice(-4e3);
649
+ });
650
+ child.once("error", (error) => {
651
+ clearTimeout(timer);
652
+ resolve2(`Chrome could not be started: ${error.message}`);
653
+ });
654
+ child.once("exit", (code, signal) => {
655
+ clearTimeout(timer);
656
+ const how = signal ? `was stopped by ${signal}` : `exited with code ${code}`;
657
+ const named = nameChromeExit(code, options.platform);
658
+ const lines = tail(stderr);
659
+ resolve2(
660
+ [`Chrome ${how} when launched on its own.`, named, lines && `stderr:
661
+ ${lines}`].filter(Boolean).join("\n")
662
+ );
663
+ });
664
+ });
665
+ } finally {
666
+ removeTreeBestEffort(profile);
667
+ }
668
+ }
669
+ async function explainChromeLaunchFailure(error, executablePath, args, signal) {
670
+ if (!executablePath || !(error instanceof Error)) return error;
671
+ const diagnosis = await diagnoseChromeStartup(executablePath, args ?? [], { signal });
672
+ return new Error(`${error.message}
673
+ ${diagnosis}`, { cause: error });
674
+ }
675
+
593
676
  // ../parsers/dist/htmlAttributeSpans.js
594
677
  function readAttributeValue(html, at) {
595
678
  while (/[\t\n\f\r ]/.test(html.charAt(at))) at++;
@@ -677,7 +760,7 @@ function scanHtmlOpeningTags(html) {
677
760
  // ../engine/src/services/browserManager.ts
678
761
  import { execSync } from "child_process";
679
762
  import { existsSync, readdirSync, statSync } from "fs";
680
- import { join as join2 } from "path";
763
+ import { join as join3 } from "path";
681
764
  import { homedir } from "os";
682
765
 
683
766
  // ../engine/src/services/browserLeasePool.ts
@@ -999,7 +1082,7 @@ function findCachedHeadlessShell(baseDir) {
999
1082
  const versions = readdirSync(baseDir).sort(compareBrowserVersionsDescending);
1000
1083
  for (const version of versions) {
1001
1084
  if (exceedsChromeCeiling(version, ceiling)) continue;
1002
- const binary = join2(baseDir, version, ...executable);
1085
+ const binary = join3(baseDir, version, ...executable);
1003
1086
  if (isNonEmptyFile(binary)) return binary;
1004
1087
  }
1005
1088
  } catch {
@@ -1011,7 +1094,7 @@ function findSharedHeadlessShell(baseDir) {
1011
1094
  if (!executable || !existsSync(baseDir)) return void 0;
1012
1095
  try {
1013
1096
  return pickSharedShell(readdirSync(baseDir), (version) => {
1014
- const binary = join2(baseDir, version, ...executable);
1097
+ const binary = join3(baseDir, version, ...executable);
1015
1098
  return isNonEmptyFile(binary) ? binary : void 0;
1016
1099
  });
1017
1100
  } catch {
@@ -1023,7 +1106,7 @@ function findManagedHeadlessShell(baseDir) {
1023
1106
  if (!executable || !existsSync(baseDir)) return void 0;
1024
1107
  try {
1025
1108
  const version = readdirSync(baseDir).find(isManagedChromeDir);
1026
- const binary = version && join2(baseDir, version, ...executable);
1109
+ const binary = version && join3(baseDir, version, ...executable);
1027
1110
  return binary && isNonEmptyFile(binary) ? binary : void 0;
1028
1111
  } catch {
1029
1112
  return void 0;
@@ -1042,12 +1125,12 @@ function resolveHeadlessShellPath(config) {
1042
1125
  }
1043
1126
  return fromEnv.path;
1044
1127
  }
1045
- const ours = join2(homedir(), ".cache", "hyperframes", "chrome", "chrome-headless-shell");
1046
- const shared = join2(homedir(), ".cache", "puppeteer", "chrome-headless-shell");
1128
+ const ours = join3(homedir(), ".cache", "hyperframes", "chrome", "chrome-headless-shell");
1129
+ const shared = join3(homedir(), ".cache", "puppeteer", "chrome-headless-shell");
1047
1130
  return findManagedHeadlessShell(ours) ?? findSharedHeadlessShell(shared) ?? findCachedHeadlessShell(ours);
1048
1131
  }
1049
1132
  function resolveFullChromePath() {
1050
- const baseDir = join2(homedir(), ".cache", "puppeteer", "chrome");
1133
+ const baseDir = join3(homedir(), ".cache", "puppeteer", "chrome");
1051
1134
  let versions;
1052
1135
  try {
1053
1136
  versions = readdirSync(baseDir).sort(compareBrowserVersionsDescending);
@@ -1056,7 +1139,7 @@ function resolveFullChromePath() {
1056
1139
  }
1057
1140
  for (const version of versions) {
1058
1141
  const candidates = [
1059
- join2(
1142
+ join3(
1060
1143
  baseDir,
1061
1144
  version,
1062
1145
  "chrome-mac-arm64",
@@ -1065,7 +1148,7 @@ function resolveFullChromePath() {
1065
1148
  "MacOS",
1066
1149
  "Google Chrome for Testing"
1067
1150
  ),
1068
- join2(
1151
+ join3(
1069
1152
  baseDir,
1070
1153
  version,
1071
1154
  "chrome-mac-x64",
@@ -1074,8 +1157,8 @@ function resolveFullChromePath() {
1074
1157
  "MacOS",
1075
1158
  "Google Chrome for Testing"
1076
1159
  ),
1077
- join2(baseDir, version, "chrome-linux64", "chrome"),
1078
- join2(baseDir, version, "chrome-win64", "chrome.exe")
1160
+ join3(baseDir, version, "chrome-linux64", "chrome"),
1161
+ join3(baseDir, version, "chrome-win64", "chrome.exe")
1079
1162
  ];
1080
1163
  for (const binary of candidates) {
1081
1164
  if (existsSync(binary)) return binary;
@@ -1297,7 +1380,8 @@ async function probeWebGlMode(ppt, options, env, label = "") {
1297
1380
  return resolved === "hardware" ? { mode: "hardware" } : { mode: "software", cause: "no-gpu" };
1298
1381
  } catch (err) {
1299
1382
  logResolvedBrowserGpuMode("software", label + formatProbeFailure(err));
1300
- return { mode: "software", cause: "probe-error" };
1383
+ const aborted = err instanceof Error && err.name === "AbortError";
1384
+ return { mode: "software", cause: "probe-error", ...aborted && { aborted } };
1301
1385
  }
1302
1386
  }
1303
1387
  function envWithoutWaylandDisplay() {
@@ -1328,11 +1412,20 @@ function wslAccess(options) {
1328
1412
  const lines = describeWslGpuAccess(options.wslHost);
1329
1413
  return lines ? { wslAccess: lines } : {};
1330
1414
  }
1415
+ async function sharedGpuProbe(options) {
1416
+ const shared = _autoBrowserGpuModeCache ??= probeAutoBrowserGpuMode(options);
1417
+ const outcome = await shared;
1418
+ if (!outcome.aborted) return outcome;
1419
+ if (_autoBrowserGpuModeCache === shared) _autoBrowserGpuModeCache = void 0;
1420
+ const own = await probeAutoBrowserGpuMode(options);
1421
+ if (!own.aborted) _autoBrowserGpuModeCache ??= Promise.resolve(own);
1422
+ return own;
1423
+ }
1331
1424
  function resolveBrowserGpuMode(mode, options = {}) {
1332
1425
  if (mode === "software") return Promise.resolve(mode);
1333
- _autoBrowserGpuModeCache ??= probeAutoBrowserGpuMode(options);
1426
+ const probe = sharedGpuProbe(options);
1334
1427
  if (mode === "auto") {
1335
- return _autoBrowserGpuModeCache.then((probed) => {
1428
+ return probe.then((probed) => {
1336
1429
  if (probed.mode === "software" && probed.wslAccess && !_wslSoftwareNoteLogged) {
1337
1430
  _wslSoftwareNoteLogged = true;
1338
1431
  console.error(buildWslSoftwareNote(probed));
@@ -1340,7 +1433,7 @@ function resolveBrowserGpuMode(mode, options = {}) {
1340
1433
  return probed.mode;
1341
1434
  });
1342
1435
  }
1343
- return _autoBrowserGpuModeCache.then((probed) => {
1436
+ return probe.then((probed) => {
1344
1437
  if (probed.mode === "software" && !_unverifiedHardwareGpuWarned) {
1345
1438
  _unverifiedHardwareGpuWarned = true;
1346
1439
  console.warn(buildUnverifiedHardwareGpuWarning(options.platform ?? process.platform, probed));
@@ -1407,6 +1500,12 @@ async function launchBrowser(fingerprint) {
1407
1500
  env,
1408
1501
  timeout: fingerprint.browserTimeoutMs,
1409
1502
  protocolTimeout: fingerprint.protocolTimeoutMs
1503
+ }).catch(async (error) => {
1504
+ const defaults = await ppt.defaultArgs({
1505
+ headless: true,
1506
+ args: withHyperframesBrowserMarker(args)
1507
+ });
1508
+ throw await explainChromeLaunchFailure(error, fingerprint.executablePath, defaults);
1410
1509
  });
1411
1510
  const probe = (target, timeoutMs) => probeBeginFrameSupport(target, timeoutMs).catch((error) => ({
1412
1511
  supported: true,
@@ -1752,7 +1851,7 @@ identically under Docker. Consider:
1752
1851
 
1753
1852
  // ../engine/src/services/frameCapture.ts
1754
1853
  import { existsSync as existsSync3, mkdirSync, writeFileSync } from "fs";
1755
- import { join as join3 } from "path";
1854
+ import { join as join4 } from "path";
1756
1855
 
1757
1856
  // ../engine/src/services/renderFrameVideoHold.ts
1758
1857
  function holdRenderFrameVideos(ids, renderIdAttr) {
@@ -6816,9 +6915,9 @@ async function initializeSession(session) {
6816
6915
  }
6817
6916
  async function captureFrameErrorDiagnostics(session, frameIndex, time, error) {
6818
6917
  try {
6819
- const diagnosticsDir = join3(session.outputDir, "diagnostics");
6918
+ const diagnosticsDir = join4(session.outputDir, "diagnostics");
6820
6919
  if (!existsSync3(diagnosticsDir)) mkdirSync(diagnosticsDir, { recursive: true });
6821
- const base = join3(diagnosticsDir, `frame-error-${frameIndex}`);
6920
+ const base = join4(diagnosticsDir, `frame-error-${frameIndex}`);
6822
6921
  const pageScreenshotCanResolve = session.launchCaptureMode !== "beginframe";
6823
6922
  if (pageScreenshotCanResolve) {
6824
6923
  await session.page.screenshot({ path: `${base}.png`, type: "png", fullPage: true });
@@ -7814,7 +7913,7 @@ function frameFileExtension(format) {
7814
7913
  }
7815
7914
  function writeCapturedFrame(session, fileIndex, buffer) {
7816
7915
  const ext = frameFileExtension(session.options.format);
7817
- const framePath = join3(session.outputDir, `frame_${String(fileIndex).padStart(6, "0")}.${ext}`);
7916
+ const framePath = join4(session.outputDir, `frame_${String(fileIndex).padStart(6, "0")}.${ext}`);
7818
7917
  writeFileSync(framePath, buffer);
7819
7918
  return framePath;
7820
7919
  }
@@ -8209,10 +8308,10 @@ function getCapturePerfSummary(session) {
8209
8308
 
8210
8309
  // ../engine/src/services/extractedFrameIndex.ts
8211
8310
  import { readdirSync as readdirSync2 } from "fs";
8212
- import { join as join4 } from "path";
8311
+ import { join as join5 } from "path";
8213
8312
  var FRAME_FILENAME_PREFIX = "frame_";
8214
8313
  function frameSequencePath(dir, framePattern) {
8215
- return join4(dir.replaceAll("%", "%%"), framePattern);
8314
+ return join5(dir.replaceAll("%", "%%"), framePattern);
8216
8315
  }
8217
8316
  var ExtractedFrameSequenceError = class extends Error {
8218
8317
  constructor(message) {
@@ -8242,7 +8341,7 @@ function framePathsFromDirectory(outputDir, format, allowGaps = false) {
8242
8341
  `Duplicate extracted frame index ${index}: ${indexed.get(index)} and ${file}`
8243
8342
  );
8244
8343
  }
8245
- indexed.set(index, join4(outputDir, file));
8344
+ indexed.set(index, join5(outputDir, file));
8246
8345
  }
8247
8346
  if (allowGaps) return new Map([...indexed].sort(([a], [b]) => a - b));
8248
8347
  const ordered = /* @__PURE__ */ new Map();
@@ -8265,7 +8364,7 @@ import {
8265
8364
  existsSync as existsSync5,
8266
8365
  ftruncateSync,
8267
8366
  mkdirSync as mkdirSync2,
8268
- mkdtempSync as mkdtempSync2,
8367
+ mkdtempSync as mkdtempSync3,
8269
8368
  openSync,
8270
8369
  readFileSync as readFileSync3,
8271
8370
  readdirSync as readdirSync3,
@@ -8273,10 +8372,10 @@ import {
8273
8372
  writeFileSync as writeFileSync2,
8274
8373
  writeSync
8275
8374
  } from "fs";
8276
- import { join as join7, dirname as dirname2, extname, resolve } from "path";
8375
+ import { join as join8, dirname as dirname2, extname, resolve } from "path";
8277
8376
 
8278
8377
  // ../engine/src/utils/gpuEncoder.ts
8279
- import { spawn } from "child_process";
8378
+ import { spawn as spawn2 } from "child_process";
8280
8379
 
8281
8380
  // ../engine/src/utils/managedChildProcess.ts
8282
8381
  import { StringDecoder } from "string_decoder";
@@ -8504,7 +8603,7 @@ async function selectUsableGpuEncoder(candidates, isUsable) {
8504
8603
  return null;
8505
8604
  }
8506
8605
  async function detectGpuEncoder() {
8507
- const ffmpeg = spawn(getFfmpegBinary(), ["-encoders"], {
8606
+ const ffmpeg = spawn2(getFfmpegBinary(), ["-encoders"], {
8508
8607
  stdio: ["pipe", "pipe", "pipe"],
8509
8608
  // See runFfmpeg.ts: keeps a console window off the user's desktop on Windows.
8510
8609
  windowsHide: true
@@ -8590,7 +8689,7 @@ function getProbeArgs(encoder) {
8590
8689
  return args;
8591
8690
  }
8592
8691
  async function canUseGpuEncoder(encoder) {
8593
- const ffmpeg = spawn(getFfmpegBinary(), getProbeArgs(encoder), {
8692
+ const ffmpeg = spawn2(getFfmpegBinary(), getProbeArgs(encoder), {
8594
8693
  stdio: ["ignore", "ignore", "pipe"],
8595
8694
  windowsHide: true
8596
8695
  });
@@ -8724,7 +8823,7 @@ function withEvenDimensionPad(vfChain, pixelFormat, width, height) {
8724
8823
  }
8725
8824
 
8726
8825
  // ../engine/src/utils/runFfmpeg.ts
8727
- import { spawn as spawn2 } from "child_process";
8826
+ import { spawn as spawn3 } from "child_process";
8728
8827
  var FFMPEG_SIGTERM_EXIT_LINE = /^Exiting normally, received signal 15\.?\r?$/m;
8729
8828
  function isExternalFfmpegInterruption(result) {
8730
8829
  if (result.terminationReason !== "exit" || result.exitCode === 0) return false;
@@ -8764,19 +8863,19 @@ function formatWindowsFfmpegExit(exitCode) {
8764
8863
  return void 0;
8765
8864
  }
8766
8865
  function formatFfmpegError(exitCode, stderr, tailLines = DEFAULT_STDERR_TAIL_LINES) {
8767
- const tail = (stderr ?? "").split(/\r?\n/).filter((line) => line.length > 0).slice(-tailLines).join("\n");
8866
+ const tail2 = (stderr ?? "").split(/\r?\n/).filter((line) => line.length > 0).slice(-tailLines).join("\n");
8768
8867
  if (exitCode === null) {
8769
- return tail ? `[FFmpeg] ${tail}` : "[FFmpeg] process error";
8868
+ return tail2 ? `[FFmpeg] ${tail2}` : "[FFmpeg] process error";
8770
8869
  }
8771
8870
  const windowsMessage = formatWindowsFfmpegExit(exitCode);
8772
8871
  if (windowsMessage) {
8773
- return tail ? `${windowsMessage}
8872
+ return tail2 ? `${windowsMessage}
8774
8873
  ffmpeg stderr (tail):
8775
- ${tail}` : windowsMessage;
8874
+ ${tail2}` : windowsMessage;
8776
8875
  }
8777
- return tail ? `FFmpeg exited with code ${exitCode}
8876
+ return tail2 ? `FFmpeg exited with code ${exitCode}
8778
8877
  ffmpeg stderr (tail):
8779
- ${tail}` : `FFmpeg exited with code ${exitCode}`;
8878
+ ${tail2}` : `FFmpeg exited with code ${exitCode}`;
8780
8879
  }
8781
8880
  function describeFfmpegFailure(result, timeoutMs) {
8782
8881
  const error = formatFfmpegError(result.exitCode, result.stderr);
@@ -8788,7 +8887,7 @@ function describeFfmpegFailure(result, timeoutMs) {
8788
8887
  return signalOrRequestedStop ? `FFmpeg ended without an exit code (${signalOrRequestedStop}). ${error}` : error;
8789
8888
  }
8790
8889
  function spawnFfmpeg(args) {
8791
- const ffmpeg = spawn2(getFfmpegBinary(), args, { windowsHide: true });
8890
+ const ffmpeg = spawn3(getFfmpegBinary(), args, { windowsHide: true });
8792
8891
  trackChildProcess(ffmpeg);
8793
8892
  return ffmpeg;
8794
8893
  }
@@ -8840,11 +8939,11 @@ async function runFfmpeg(args, opts) {
8840
8939
  }
8841
8940
 
8842
8941
  // ../engine/src/utils/ffprobe.ts
8843
- import { spawn as spawn3 } from "child_process";
8844
- import { createReadStream, mkdtempSync, readFileSync, rmSync, statSync as statSync2 } from "fs";
8942
+ import { spawn as spawn4 } from "child_process";
8943
+ import { createReadStream, mkdtempSync as mkdtempSync2, readFileSync, rmSync, statSync as statSync2 } from "fs";
8845
8944
  import { StringDecoder as StringDecoder2 } from "string_decoder";
8846
- import { tmpdir as tmpdir2 } from "os";
8847
- import { basename, join as join5 } from "path";
8945
+ import { tmpdir as tmpdir3 } from "os";
8946
+ import { basename, join as join6 } from "path";
8848
8947
 
8849
8948
  // ../engine/src/utils/urlInput.ts
8850
8949
  import { existsSync as existsSync4 } from "fs";
@@ -8918,7 +9017,7 @@ async function runFfprobe(filePath, argsWithoutInput, signal, stdoutOptions) {
8918
9017
  "--",
8919
9018
  filePath
8920
9019
  ];
8921
- const proc = spawn3(command, args, {
9020
+ const proc = spawn4(command, args, {
8922
9021
  // Nothing is ever written to the child's stdin; leaving it as a pipe is
8923
9022
  // what lets a stdin-reading invocation block indefinitely.
8924
9023
  stdio: ["ignore", "pipe", "pipe"],
@@ -9112,7 +9211,7 @@ function ffprobeMajor() {
9112
9211
  runtimeFfprobeMajor ??= new Promise((resolve2) => {
9113
9212
  let out = "";
9114
9213
  const binary = getFfprobeBinary();
9115
- const proc = spawn3(binary, ["-version"], { stdio: ["ignore", "pipe", "ignore"] });
9214
+ const proc = spawn4(binary, ["-version"], { stdio: ["ignore", "pipe", "ignore"] });
9116
9215
  proc.stdout.on("data", (chunk) => out += String(chunk));
9117
9216
  proc.on("error", () => resolve2(void 0));
9118
9217
  proc.on("close", () => resolve2(Number(/version n?(\d+)/.exec(out)?.[1]) || void 0));
@@ -9323,8 +9422,8 @@ function parseFrameRate(frameRateStr) {
9323
9422
  async function probeDecodedAlphaPlane(filePath, decoder) {
9324
9423
  let probeDir;
9325
9424
  try {
9326
- probeDir = mkdtempSync(join5(tmpdir2(), "hf-decoded-alpha-"));
9327
- const framePath = join5(probeDir, "frame.nut");
9425
+ probeDir = mkdtempSync2(join6(tmpdir3(), "hf-decoded-alpha-"));
9426
+ const framePath = join6(probeDir, "frame.nut");
9328
9427
  const decoded = await runFfmpeg(
9329
9428
  [
9330
9429
  "-v",
@@ -9744,7 +9843,7 @@ function appendSoftwareEncoderThreadsArg(args, encoder, parallelism = availableP
9744
9843
 
9745
9844
  // ../engine/src/utils/renderProvenance.ts
9746
9845
  import { readFileSync as readFileSync2 } from "fs";
9747
- import { dirname, join as join6 } from "path";
9846
+ import { dirname, join as join7 } from "path";
9748
9847
  import { fileURLToPath } from "url";
9749
9848
  var PROVENANCE_RENDERER_TAG = "hyperframes_renderer";
9750
9849
  var PROVENANCE_VERSION_TAG = "hyperframes_version";
@@ -9755,7 +9854,7 @@ var MAX_WALK_DEPTH = 12;
9755
9854
  function resolveOwnVersionFrom(startDir) {
9756
9855
  let dir = startDir;
9757
9856
  for (let depth = 0; depth < MAX_WALK_DEPTH; depth++) {
9758
- const candidate = join6(dir, "package.json");
9857
+ const candidate = join7(dir, "package.json");
9759
9858
  let pkg;
9760
9859
  try {
9761
9860
  pkg = JSON.parse(readFileSync2(candidate, "utf8"));
@@ -10190,7 +10289,7 @@ function buildConcatArgs(concatListPath, outputPath) {
10190
10289
  var concatListSeq = 0;
10191
10290
  function writeConcatList(dir, inputPaths) {
10192
10291
  concatListSeq += 1;
10193
- const listPath = join7(dir, `concat-list-${process.pid}-${concatListSeq}.txt`);
10292
+ const listPath = join8(dir, `concat-list-${process.pid}-${concatListSeq}.txt`);
10194
10293
  const body = inputPaths.map((p) => `file '${resolve(p).replace(/'/g, "'\\''")}'`).join("\n");
10195
10294
  writeFileSync2(listPath, body, "utf-8");
10196
10295
  return listPath;
@@ -10234,7 +10333,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
10234
10333
  const chunkSize = Math.max(30, Math.floor(chunkSizeFrames));
10235
10334
  const chunkCount = Math.ceil(files.length / chunkSize);
10236
10335
  mkdirSync2(dirname2(outputPath), { recursive: true });
10237
- const chunkDir = mkdtempSync2(join7(dirname2(outputPath), "chunk-encode-"));
10336
+ const chunkDir = mkdtempSync3(join8(dirname2(outputPath), "chunk-encode-"));
10238
10337
  const chunkPaths = [];
10239
10338
  for (let i = 0; i < chunkCount; i++) {
10240
10339
  if (signal?.aborted) {
@@ -10250,7 +10349,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
10250
10349
  const startNumber = i * chunkSize;
10251
10350
  const framesInChunk = Math.min(chunkSize, files.length - startNumber);
10252
10351
  const ext = outputPath.endsWith(".webm") ? ".webm" : outputPath.endsWith(".mov") ? ".mov" : ".mp4";
10253
- const chunkPath = join7(chunkDir, `chunk_${String(i).padStart(4, "0")}${ext}`);
10352
+ const chunkPath = join8(chunkDir, `chunk_${String(i).padStart(4, "0")}${ext}`);
10254
10353
  const inputPath = frameSequencePath(framesDir, framePattern);
10255
10354
  const inputArgs = [
10256
10355
  "-framerate",
@@ -10420,14 +10519,14 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
10420
10519
  "-master_pl_name",
10421
10520
  HLS_MASTER_PLAYLIST,
10422
10521
  "-hls_segment_filename",
10423
- join7(outputDir, "%v_%05d.ts"),
10522
+ join8(outputDir, "%v_%05d.ts"),
10424
10523
  // Without these the mpegts muxer starts the stream at PTS 1.4 s.
10425
10524
  "-muxdelay",
10426
10525
  "0",
10427
10526
  "-muxpreload",
10428
10527
  "0"
10429
10528
  );
10430
- args.push("-y", join7(outputDir, "%v.m3u8"));
10529
+ args.push("-y", join8(outputDir, "%v.m3u8"));
10431
10530
  const processTimeout = options.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;
10432
10531
  const result = await runFfmpeg(args, { signal, timeout: processTimeout });
10433
10532
  if (signal?.aborted) {
@@ -10439,7 +10538,7 @@ async function packageHls(videoPath, audioPath, outputDir, options) {
10439
10538
  };
10440
10539
  }
10441
10540
  if (result.success && hasAudio) {
10442
- const masterPath = join7(outputDir, HLS_MASTER_PLAYLIST);
10541
+ const masterPath = join8(outputDir, HLS_MASTER_PLAYLIST);
10443
10542
  let master;
10444
10543
  try {
10445
10544
  master = openSync(masterPath, "r+", 384);
@@ -10544,7 +10643,7 @@ function quantizationTableError(buffer, start, end) {
10544
10643
  }
10545
10644
 
10546
10645
  // ../engine/src/services/streamingEncoder.ts
10547
- import { spawn as spawn4 } from "child_process";
10646
+ import { spawn as spawn5 } from "child_process";
10548
10647
  import { once } from "events";
10549
10648
  import { existsSync as existsSync6, mkdirSync as mkdirSync3, statSync as statSync4 } from "fs";
10550
10649
  import { dirname as dirname3 } from "path";
@@ -10791,7 +10890,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
10791
10890
  gpuEncoder = await getCachedGpuEncoder();
10792
10891
  }
10793
10892
  const args = buildStreamingArgs(options, outputPath, gpuEncoder);
10794
- const ffmpeg = spawn4(getFfmpegBinary(), args, {
10893
+ const ffmpeg = spawn5(getFfmpegBinary(), args, {
10795
10894
  stdio: ["pipe", "pipe", "pipe"],
10796
10895
  // See runFfmpeg.ts: keeps a console window off the user's desktop on Windows.
10797
10896
  windowsHide: true
@@ -11018,7 +11117,7 @@ function isMemberGroupHidden(groupsById, el) {
11018
11117
 
11019
11118
  // ../engine/src/services/videoFrameExtractor.ts
11020
11119
  import { copyFileSync as copyFileSync3, existsSync as existsSync9, linkSync as linkSync2, mkdirSync as mkdirSync6, rmSync as rmSync6 } from "fs";
11021
- import { join as join11 } from "path";
11120
+ import { basename as basename2, join as join12 } from "path";
11022
11121
  import { cpus } from "os";
11023
11122
 
11024
11123
  // ../engine/src/utils/concurrencyLimit.ts
@@ -11060,9 +11159,9 @@ function isKnownInactiveTimelineWindow(element, resolvedStart) {
11060
11159
  }
11061
11160
 
11062
11161
  // ../engine/src/utils/alphaPlaneProbe.ts
11063
- import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync4, rmSync as rmSync2 } from "fs";
11064
- import { tmpdir as tmpdir3 } from "os";
11065
- import { join as join8 } from "path";
11162
+ import { mkdtempSync as mkdtempSync4, readFileSync as readFileSync4, rmSync as rmSync2 } from "fs";
11163
+ import { tmpdir as tmpdir4 } from "os";
11164
+ import { join as join9 } from "path";
11066
11165
  var BYTES_PER_SAMPLE_FRAME = 8 * 8 * 4;
11067
11166
  var MAX_SAMPLE_BYTES = BYTES_PER_SAMPLE_FRAME * 3;
11068
11167
  function sampledRgbaAlphaIsFullyOpaque(buf) {
@@ -11077,8 +11176,8 @@ function sampledRgbaAlphaIsFullyOpaque(buf) {
11077
11176
  async function probeInputAlphaPlane(videoPath, decoder, signal) {
11078
11177
  let probeDir;
11079
11178
  try {
11080
- probeDir = mkdtempSync3(join8(tmpdir3(), "hf-alpha-probe-"));
11081
- const samplePath = join8(probeDir, "alpha.raw");
11179
+ probeDir = mkdtempSync4(join9(tmpdir4(), "hf-alpha-probe-"));
11180
+ const samplePath = join9(probeDir, "alpha.raw");
11082
11181
  const result = await runFfmpeg(
11083
11182
  [
11084
11183
  "-v",
@@ -11120,7 +11219,7 @@ import {
11120
11219
  existsSync as existsSync7,
11121
11220
  fsyncSync,
11122
11221
  linkSync,
11123
- mkdtempSync as mkdtempSync4,
11222
+ mkdtempSync as mkdtempSync5,
11124
11223
  mkdirSync as mkdirSync4,
11125
11224
  lstatSync,
11126
11225
  openSync as openSync2,
@@ -11132,7 +11231,7 @@ import {
11132
11231
  } from "fs";
11133
11232
  import { createHash, randomUUID as randomUUID2 } from "crypto";
11134
11233
  import { BlockList, isIP } from "net";
11135
- import { dirname as dirname4, extname as extname2, join as join9 } from "path";
11234
+ import { dirname as dirname4, extname as extname2, join as join10 } from "path";
11136
11235
  import { Readable, Transform } from "stream";
11137
11236
  import { pipeline } from "stream/promises";
11138
11237
  var inFlightDownloads = /* @__PURE__ */ new Map();
@@ -11324,7 +11423,7 @@ function removeCacheLockDirectoryIfEmpty(lockPath) {
11324
11423
  }
11325
11424
  function releaseOwnedCachePathLock(lockPath, owner) {
11326
11425
  try {
11327
- rmdirSync(join9(lockPath, owner));
11426
+ rmdirSync(join10(lockPath, owner));
11328
11427
  } catch (error) {
11329
11428
  if (error.code === "ENOENT") return;
11330
11429
  throw error;
@@ -11365,12 +11464,12 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
11365
11464
  if (createdLock) {
11366
11465
  const owner = `${CACHE_LOCK_OWNER_PREFIX}${randomUUID2()}`;
11367
11466
  try {
11368
- mkdirSync4(join9(lockPath, owner));
11467
+ mkdirSync4(join10(lockPath, owner));
11369
11468
  const entries = readdirSync4(lockPath);
11370
11469
  if (entries.length === 1 && entries[0] === owner) {
11371
11470
  return () => releaseOwnedCachePathLock(lockPath, owner);
11372
11471
  }
11373
- rmdirSync(join9(lockPath, owner));
11472
+ rmdirSync(join10(lockPath, owner));
11374
11473
  removeCacheLockDirectoryIfEmpty(lockPath);
11375
11474
  continue;
11376
11475
  } catch (error) {
@@ -11388,7 +11487,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
11388
11487
  if (Date.now() - observedLock.stats.mtimeMs > CACHE_LOCK_STALE_MS) {
11389
11488
  if (observedLock.owner) {
11390
11489
  try {
11391
- rmdirSync(join9(lockPath, observedLock.owner));
11490
+ rmdirSync(join10(lockPath, observedLock.owner));
11392
11491
  } catch (error) {
11393
11492
  if (error.code === "ENOENT") continue;
11394
11493
  throw error;
@@ -11396,7 +11495,7 @@ async function acquireCachePathLock(localPath, timeoutMs, signal) {
11396
11495
  removeCacheLockDirectoryIfEmpty(lockPath);
11397
11496
  continue;
11398
11497
  }
11399
- const reclaimPath = join9(lockPath, CACHE_LOCK_RECLAIM_NAME);
11498
+ const reclaimPath = join10(lockPath, CACHE_LOCK_RECLAIM_NAME);
11400
11499
  try {
11401
11500
  mkdirSync4(reclaimPath);
11402
11501
  } catch (error) {
@@ -11837,8 +11936,8 @@ function emitDownloadTelemetry(options, event) {
11837
11936
  }
11838
11937
  }
11839
11938
  async function runDownloadAttempt(url, localPath, timeoutMs, attempt, options, signal) {
11840
- const attemptDir = mkdtempSync4(join9(dirname4(localPath), ".hf-download-"));
11841
- const partialPath = join9(attemptDir, "payload");
11939
+ const attemptDir = mkdtempSync5(join10(dirname4(localPath), ".hf-download-"));
11940
+ const partialPath = join10(attemptDir, "payload");
11842
11941
  const controller = new AbortController();
11843
11942
  let timedOut = false;
11844
11943
  let callerAborted = signal?.aborted ?? false;
@@ -12084,7 +12183,7 @@ async function downloadToTemp(url, destDir, timeoutMs = 3e5, signal, onTransient
12084
12183
  mkdirSync4(destDir, { recursive: true });
12085
12184
  }
12086
12185
  const filename = getFilenameFromUrl(url, validationScope);
12087
- const localPath = join9(destDir, filename);
12186
+ const localPath = join10(destDir, filename);
12088
12187
  const downloadPromise = (async () => {
12089
12188
  const cacheStartedAt = Date.now();
12090
12189
  const reused = await reuseOrInvalidateCachedFile(
@@ -12258,7 +12357,7 @@ async function renameWithRetryAsync(from, to, options = {}) {
12258
12357
  }
12259
12358
 
12260
12359
  // ../engine/src/services/extractionCache.ts
12261
- import { join as join10 } from "path";
12360
+ import { join as join11 } from "path";
12262
12361
  var COMPLETE_SENTINEL = ".hf-complete";
12263
12362
  var GC_MARKER = ".hf-last-gc";
12264
12363
  var SCHEMA_PREFIX = "hfcache-v8-";
@@ -12309,8 +12408,8 @@ function hasFrameFiles(dir) {
12309
12408
  }
12310
12409
  function lookupCacheEntry(rootDir, input) {
12311
12410
  const keyHash = computeCacheKey(input);
12312
- const dir = join10(rootDir, cacheEntryDirName(keyHash));
12313
- const complete = existsSync8(join10(dir, COMPLETE_SENTINEL)) && hasFrameFiles(dir);
12411
+ const dir = join11(rootDir, cacheEntryDirName(keyHash));
12412
+ const complete = existsSync8(join11(dir, COMPLETE_SENTINEL)) && hasFrameFiles(dir);
12314
12413
  return { entry: { dir, keyHash }, hit: complete };
12315
12414
  }
12316
12415
  function partialCacheEntryDir(entry) {
@@ -12321,13 +12420,13 @@ function isTargetExistsRenameError(err) {
12321
12420
  return code === "EEXIST" || code === "ENOTEMPTY" || code === "EPERM";
12322
12421
  }
12323
12422
  function adoptPublishedWinner(entry, partialDir) {
12324
- if (!existsSync8(join10(entry.dir, COMPLETE_SENTINEL)) || !hasFrameFiles(entry.dir)) return null;
12423
+ if (!existsSync8(join11(entry.dir, COMPLETE_SENTINEL)) || !hasFrameFiles(entry.dir)) return null;
12325
12424
  removeDir(partialDir);
12326
12425
  return { dir: entry.dir, published: true };
12327
12426
  }
12328
12427
  function publishCacheEntry(entry, partialDir) {
12329
12428
  try {
12330
- writeFileSync3(join10(partialDir, COMPLETE_SENTINEL), "", "utf-8");
12429
+ writeFileSync3(join11(partialDir, COMPLETE_SENTINEL), "", "utf-8");
12331
12430
  } catch {
12332
12431
  return { dir: partialDir, published: false };
12333
12432
  }
@@ -12358,7 +12457,7 @@ function touchCacheDir(dir) {
12358
12457
  } catch {
12359
12458
  }
12360
12459
  try {
12361
- utimesSync(join10(dir, COMPLETE_SENTINEL), now, now);
12460
+ utimesSync(join11(dir, COMPLETE_SENTINEL), now, now);
12362
12461
  } catch {
12363
12462
  }
12364
12463
  }
@@ -12387,7 +12486,7 @@ function directorySizeBytes(path) {
12387
12486
  return 0;
12388
12487
  }
12389
12488
  for (const child of children) {
12390
- const childPath = join10(path, child);
12489
+ const childPath = join11(path, child);
12391
12490
  try {
12392
12491
  const stat = lstatSync2(childPath);
12393
12492
  if (stat.isDirectory()) {
@@ -12416,7 +12515,7 @@ function collectGcEntry(dir, name, now, minAgeMs, stats, remove) {
12416
12515
  }
12417
12516
  let lastUseMs = dirStat.mtimeMs;
12418
12517
  try {
12419
- lastUseMs = statSync6(join10(dir, COMPLETE_SENTINEL)).mtimeMs;
12518
+ lastUseMs = statSync6(join11(dir, COMPLETE_SENTINEL)).mtimeMs;
12420
12519
  } catch {
12421
12520
  }
12422
12521
  return { dir, size: directorySizeBytes(dir), lastUseMs, ageMs: now - lastUseMs };
@@ -12426,14 +12525,14 @@ function collectGcEntry(dir, name, now, minAgeMs, stats, remove) {
12426
12525
  }
12427
12526
  function gcSweepDue(rootDir, maxAgeMs) {
12428
12527
  try {
12429
- return Date.now() - statSync6(join10(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
12528
+ return Date.now() - statSync6(join11(rootDir, GC_MARKER)).mtimeMs > maxAgeMs;
12430
12529
  } catch {
12431
12530
  return true;
12432
12531
  }
12433
12532
  }
12434
12533
  function markGcSweep(rootDir) {
12435
12534
  try {
12436
- writeFileSync3(join10(rootDir, GC_MARKER), "", "utf-8");
12535
+ writeFileSync3(join11(rootDir, GC_MARKER), "", "utf-8");
12437
12536
  } catch {
12438
12537
  }
12439
12538
  }
@@ -12448,7 +12547,7 @@ function gcExtractionCache(rootDir, opts) {
12448
12547
  for (const child of readdirSync5(rootDir, { withFileTypes: true })) {
12449
12548
  if (!child.isDirectory() || !isCacheLikeChild(child.name)) continue;
12450
12549
  const entry = collectGcEntry(
12451
- join10(rootDir, child.name),
12550
+ join11(rootDir, child.name),
12452
12551
  child.name,
12453
12552
  now,
12454
12553
  opts.minAgeMs,
@@ -12611,18 +12710,28 @@ function downloadFailureGroup(source, error) {
12611
12710
  };
12612
12711
  }
12613
12712
  var VideoSourceExtractionError = class extends Error {
12614
- constructor(kind, retryable, message, diagnostic = message) {
12713
+ constructor(kind, retryable, message, diagnostic = message, ffmpegReason) {
12615
12714
  super(message);
12616
12715
  this.kind = kind;
12617
12716
  this.retryable = retryable;
12618
12717
  this.diagnostic = diagnostic;
12718
+ this.ffmpegReason = ffmpegReason;
12619
12719
  this.name = "VideoSourceExtractionError";
12620
12720
  }
12621
12721
  kind;
12622
12722
  retryable;
12623
12723
  diagnostic;
12724
+ ffmpegReason;
12624
12725
  hyperframesVideoSourceExtractionError = true;
12625
12726
  };
12727
+ var FFMPEG_REASON_LINES = 3;
12728
+ var FFMPEG_REASON_CHARS = 300;
12729
+ function ffmpegReasonFrom(stderr, paths) {
12730
+ let text = stderr;
12731
+ for (const known of paths.filter(Boolean).sort((a, b) => b.length - a.length))
12732
+ text = text.split(known).join("<path>");
12733
+ return text.replace(/[a-z][a-z\d+.-]*:\/\/[^\s'"]+/gi, "<url>").replace(/(?:[a-z]:)?(?:[\\/][^\s\\/:'"]+){2,}/gi, "<path>").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).slice(-FFMPEG_REASON_LINES).join(" | ").slice(-FFMPEG_REASON_CHARS);
12734
+ }
12626
12735
  function isVideoSourceExtractionError(error) {
12627
12736
  return typeof error === "object" && error !== null && "hyperframesVideoSourceExtractionError" in error && error.hyperframesVideoSourceExtractionError === true;
12628
12737
  }
@@ -13009,7 +13118,7 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
13009
13118
  const normalizedFps = toFps(options.fps);
13010
13119
  const fps = fpsToNumber(normalizedFps);
13011
13120
  const ffmpegFps = fpsToFfmpegArg(normalizedFps);
13012
- const videoOutputDir = outputDirOverride ?? join11(outputDir, videoId);
13121
+ const videoOutputDir = outputDirOverride ?? join12(outputDir, videoId);
13013
13122
  if (!existsSync9(videoOutputDir)) mkdirSync6(videoOutputDir, { recursive: true });
13014
13123
  let metadata;
13015
13124
  try {
@@ -13136,12 +13245,18 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
13136
13245
  const timedOut = processResult.terminationReason === "inactivity";
13137
13246
  const timeoutSuffix = timedOut ? ` (no new frame for ${ffmpegProcessTimeout} ms)` : "";
13138
13247
  const diagnostic = `${hdrPrefix}FFmpeg exited with code ${processResult.exitCode}${timeoutSuffix}: ` + processResult.stderr.slice(-500);
13248
+ const ffmpegReason = ffmpegReasonFrom(processResult.stderr, [
13249
+ videoPath,
13250
+ basename2(videoPath),
13251
+ videoOutputDir
13252
+ ]);
13139
13253
  if (timedOut) {
13140
13254
  throw new VideoSourceExtractionError(
13141
13255
  "ffmpeg_timeout",
13142
13256
  true,
13143
13257
  "Video frame extraction timed out",
13144
- diagnostic
13258
+ diagnostic,
13259
+ ffmpegReason
13145
13260
  );
13146
13261
  }
13147
13262
  const transientIo = /resource temporarily unavailable|device or resource busy|input\/output error/i.test(
@@ -13151,7 +13266,8 @@ async function extractVideoFramesRangeUnredacted(videoPath, videoId, startTime,
13151
13266
  transientIo ? "ffmpeg_transient" : "ffmpeg_failed",
13152
13267
  transientIo,
13153
13268
  transientIo ? "Video frame extraction hit a transient I/O failure" : "Video source could not be decoded",
13154
- diagnostic
13269
+ diagnostic,
13270
+ ffmpegReason
13155
13271
  );
13156
13272
  }
13157
13273
  const framePaths = framePathsFromDirectory(videoOutputDir, format, !!options.frameRanges);
@@ -13517,7 +13633,7 @@ function sliceSupersetMember(member, superset, outputDir, fps, configuredFps) {
13517
13633
  for (let i = 0; i < frameCount; i += 1) {
13518
13634
  const sourceFrame = superset.framePaths.get(member.offsetFrames + i);
13519
13635
  if (!sourceFrame) throw new Error(`superset frame ${member.offsetFrames + i} missing`);
13520
- linkOrCopyFrame(sourceFrame, join11(outputDir, frameFileName(i + 1, work.format)));
13636
+ linkOrCopyFrame(sourceFrame, join12(outputDir, frameFileName(i + 1, work.format)));
13521
13637
  }
13522
13638
  return extractedFramesFromDirectory(work, outputDir, work.videoPath, fps);
13523
13639
  }
@@ -13573,7 +13689,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13573
13689
  continue;
13574
13690
  }
13575
13691
  if (isHttpUrl(videoPath)) {
13576
- const downloadDir = join11(options.outputDir, DOWNLOAD_SUBDIR);
13692
+ const downloadDir = join12(options.outputDir, DOWNLOAD_SUBDIR);
13577
13693
  mkdirSync6(downloadDir, { recursive: true });
13578
13694
  videoPath = await downloadToTemp(
13579
13695
  videoPath,
@@ -13602,19 +13718,15 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13602
13718
  }
13603
13719
  resolvedVideos.push({ video, videoPath });
13604
13720
  } catch (err) {
13605
- const classified = classifyVideoExtractionError(err);
13606
13721
  errors.push({
13607
- videoId: video.id,
13608
- kind: classified.kind,
13609
- retryable: classified.retryable,
13610
- ...err instanceof UrlDownloadError ? { group: downloadFailureGroup(video.src, err) } : {},
13611
- error: classified.diagnostic
13722
+ ...extractionError(video.id, err),
13723
+ ...err instanceof UrlDownloadError ? { group: downloadFailureGroup(video.src, err) } : {}
13612
13724
  });
13613
13725
  }
13614
13726
  }
13615
13727
  breakdown.resolveMs = Date.now() - phase1Start;
13616
13728
  const contentKeyedDirs = [
13617
- join11(options.outputDir, DOWNLOAD_SUBDIR),
13729
+ join12(options.outputDir, DOWNLOAD_SUBDIR),
13618
13730
  ...options.contentKeyedDirs ?? []
13619
13731
  ];
13620
13732
  const cacheKeyInputs = resolvedVideos.map(({ video, videoPath }) => {
@@ -13749,7 +13861,8 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13749
13861
  videoId,
13750
13862
  kind: classified.kind,
13751
13863
  retryable: classified.retryable,
13752
- error: classified.diagnostic
13864
+ error: classified.diagnostic,
13865
+ ...classified.ffmpegReason ? { ffmpegReason: classified.ffmpegReason } : {}
13753
13866
  };
13754
13867
  }
13755
13868
  function scopedExtractionOptions(work) {
@@ -13821,7 +13934,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13821
13934
  async function extractDirectMiss(miss, maxTransientRetries = options.maxTransientRetries ?? 0) {
13822
13935
  const { work, cacheTarget } = miss;
13823
13936
  if (!cacheTarget) {
13824
- const outputDir = join11(options.outputDir, work.video.id);
13937
+ const outputDir = join12(options.outputDir, work.video.id);
13825
13938
  const attempted2 = await runVideoExtractionWithRetry(
13826
13939
  () => extractVideoFramesRange(
13827
13940
  work.videoPath,
@@ -13887,7 +14000,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13887
14000
  const tailFrames = Math.min(expectedFrames, Math.ceil(fps));
13888
14001
  if (expectedFrames <= tailFrames) return null;
13889
14002
  const deferred = (totalFrames) => {
13890
- const outputDir = join11(options.outputDir, work.video.id);
14003
+ const outputDir = join12(options.outputDir, work.video.id);
13891
14004
  mkdirSync6(outputDir, { recursive: true });
13892
14005
  return {
13893
14006
  videoId: work.video.id,
@@ -13924,9 +14037,9 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13924
14037
  const totalFrames = firstTailFrame + storedTailFrames;
13925
14038
  return totalFrames <= expectedFrames * 0.6 ? null : deferred(totalFrames);
13926
14039
  }
13927
- const probeDir = join11(options.outputDir, `${work.video.id}.tail-probe`);
14040
+ const probeDir = join12(options.outputDir, `${work.video.id}.tail-probe`);
13928
14041
  try {
13929
- const tail = await extractVideoFramesRange(
14042
+ const tail2 = await extractVideoFramesRange(
13930
14043
  work.videoPath,
13931
14044
  work.video.id,
13932
14045
  work.extractionMediaStart,
@@ -13940,7 +14053,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13940
14053
  config,
13941
14054
  probeDir
13942
14055
  );
13943
- const totalFrames = firstTailFrame + tail.totalFrames;
14056
+ const totalFrames = firstTailFrame + tail2.totalFrames;
13944
14057
  if (totalFrames <= expectedFrames * 0.6) return null;
13945
14058
  return deferred(totalFrames);
13946
14059
  } catch {
@@ -13963,7 +14076,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13963
14076
  return sliceSupersetMember(
13964
14077
  member,
13965
14078
  superset,
13966
- join11(options.outputDir, work.video.id),
14079
+ join12(options.outputDir, work.video.id),
13967
14080
  fps,
13968
14081
  configuredFps
13969
14082
  );
@@ -13980,7 +14093,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
13980
14093
  async function executeSupersetGroup(group) {
13981
14094
  const first = group.members[0]?.miss.work;
13982
14095
  if (!first) return [];
13983
- const tempDir = cacheRootDir ? join11(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join11(options.outputDir, group.groupId);
14096
+ const tempDir = cacheRootDir ? join12(cacheRootDir, `${group.groupId}.partial-${process.pid}`) : join12(options.outputDir, group.groupId);
13984
14097
  try {
13985
14098
  rmSync6(tempDir, { recursive: true, force: true });
13986
14099
  const superset = await extractVideoFramesRange(
@@ -14125,12 +14238,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
14125
14238
  const isFollower = outcome.error.videoId !== prepared.work.video.id;
14126
14239
  const message = isFollower ? `[shared extraction, leader ${outcome.error.videoId}] ${outcome.error.error}` : outcome.error.error;
14127
14240
  results.push({
14128
- error: {
14129
- videoId: prepared.work.video.id,
14130
- kind: outcome.error.kind,
14131
- retryable: outcome.error.retryable,
14132
- error: message
14133
- }
14241
+ error: { ...outcome.error, videoId: prepared.work.video.id, error: message }
14134
14242
  });
14135
14243
  continue;
14136
14244
  }
@@ -14829,8 +14937,8 @@ async function queryElementStacking(page, nativeHdrIds) {
14829
14937
  }
14830
14938
 
14831
14939
  // ../engine/src/services/audioMixer.ts
14832
- import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync8, openSync as openSync4, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "fs";
14833
- import { join as join15, dirname as dirname7, isAbsolute, relative } from "path";
14940
+ import { closeSync as closeSync4, existsSync as existsSync11, mkdirSync as mkdirSync7, mkdtempSync as mkdtempSync9, openSync as openSync4, rmSync as rmSync8, writeFileSync as writeFileSync7 } from "fs";
14941
+ import { join as join16, dirname as dirname7, isAbsolute, relative } from "path";
14834
14942
 
14835
14943
  // ../engine/src/utils/notMediaPayload.ts
14836
14944
  import { createHash as createHash3 } from "crypto";
@@ -14949,8 +15057,8 @@ import { cpus as cpus2 } from "os";
14949
15057
 
14950
15058
  // ../engine/src/services/aacEncode.ts
14951
15059
  import { execFile as execFile3 } from "child_process";
14952
- import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
14953
- import { dirname as dirname5, join as join12 } from "path";
15060
+ import { mkdtempSync as mkdtempSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
15061
+ import { dirname as dirname5, join as join13 } from "path";
14954
15062
  var SAMPLE_RATE = 48e3;
14955
15063
  var FRAME_SAMPLES = 1024;
14956
15064
  var MIN_SEGMENT_SECONDS = 60;
@@ -15013,11 +15121,11 @@ async function encodeAac(input, outputPath, totalDuration, {
15013
15121
  if (!await supportsSettsDuration()) {
15014
15122
  return encodeInOnePass(input, outputPath, { signal, timeout, filter });
15015
15123
  }
15016
- const dir = mkdtempSync5(join12(dirname5(outputPath), ".aac-segments-"));
15124
+ const dir = mkdtempSync6(join13(dirname5(outputPath), ".aac-segments-"));
15017
15125
  try {
15018
15126
  const segments = planSegments(totalDuration, count).map((segment, k) => ({
15019
15127
  ...segment,
15020
- path: join12(dir, `${k}.aac`)
15128
+ path: join13(dir, `${k}.aac`)
15021
15129
  }));
15022
15130
  const results = await Promise.all(
15023
15131
  segments.map(
@@ -15044,7 +15152,7 @@ async function encodeAac(input, outputPath, totalDuration, {
15044
15152
  );
15045
15153
  const failed = results.find((result) => !result.success);
15046
15154
  if (failed) return failed;
15047
- const joined = join12(dir, "joined.aac");
15155
+ const joined = join13(dir, "joined.aac");
15048
15156
  const frames = segments.flatMap(({ path, keepFrom, keepTo }) => {
15049
15157
  const segmentFrames = splitAdtsFrames(readFileSync5(path));
15050
15158
  if (segmentFrames.length < keepTo) {
@@ -15178,8 +15286,8 @@ function audioFailureDiagnostics(values) {
15178
15286
  }
15179
15287
 
15180
15288
  // ../engine/src/services/audioVolumeEnvelope.ts
15181
- import { mkdtempSync as mkdtempSync6, readFileSync as readFileSync6, rmSync as rmSync7, writeFileSync as writeFileSync5 } from "fs";
15182
- import { dirname as dirname6, join as join13 } from "path";
15289
+ import { mkdtempSync as mkdtempSync7, readFileSync as readFileSync6, rmSync as rmSync7, writeFileSync as writeFileSync5 } from "fs";
15290
+ import { dirname as dirname6, join as join14 } from "path";
15183
15291
 
15184
15292
  // ../core/dist/runtime/mediaVolumeEnvelope.js
15185
15293
  function normaliseEnvelope(keyframes, trackStart, baseVolume) {
@@ -15305,8 +15413,8 @@ function applyVolumeEnvelopeToWav(wavPath, keyframes, trackStart, baseVolume) {
15305
15413
  const layout = parseWavLayout(buffer);
15306
15414
  if (!layout) return false;
15307
15415
  scaleSamples(buffer, layout, gainAt);
15308
- stagingDir = mkdtempSync6(join13(dirname6(wavPath), ".hf-volume-"));
15309
- const tempPath = join13(stagingDir, "audio.wav");
15416
+ stagingDir = mkdtempSync7(join14(dirname6(wavPath), ".hf-volume-"));
15417
+ const tempPath = join14(stagingDir, "audio.wav");
15310
15418
  writeFileSync5(tempPath, buffer, { flag: "wx" });
15311
15419
  renameWithRetry(tempPath, wavPath);
15312
15420
  return true;
@@ -15536,7 +15644,7 @@ function chainTailSeconds(chain, automation) {
15536
15644
  import {
15537
15645
  closeSync as closeSync3,
15538
15646
  existsSync as existsSync10,
15539
- mkdtempSync as mkdtempSync7,
15647
+ mkdtempSync as mkdtempSync8,
15540
15648
  openSync as openSync3,
15541
15649
  readFileSync as readFileSync7,
15542
15650
  readSync,
@@ -15544,8 +15652,8 @@ import {
15544
15652
  writeFileSync as writeFileSync6,
15545
15653
  writeSync as writeSync2
15546
15654
  } from "fs";
15547
- import { tmpdir as tmpdir4 } from "os";
15548
- import { join as join14 } from "path";
15655
+ import { tmpdir as tmpdir5 } from "os";
15656
+ import { join as join15 } from "path";
15549
15657
  import { pathToFileURL } from "url";
15550
15658
 
15551
15659
  // ../core/dist/generated/audio-fx-runtime-inline.js
@@ -15897,7 +16005,7 @@ async function applyAudioFxChain(inputWav, chain, outputWav, options) {
15897
16005
  });
15898
16006
  }
15899
16007
  async function withFxBrowser(options, body) {
15900
- const hostDir = mkdtempSync7(join14(tmpdir4(), "hf-fx-host-"));
16008
+ const hostDir = mkdtempSync8(join15(tmpdir5(), "hf-fx-host-"));
15901
16009
  let lease = null;
15902
16010
  try {
15903
16011
  if (options.signal?.aborted) {
@@ -15919,7 +16027,7 @@ async function withFxBrowser(options, body) {
15919
16027
  async function openFxPage(browser, hostDir) {
15920
16028
  const page = await browser.newPage();
15921
16029
  try {
15922
- const hostPage = join14(hostDir, "audio-fx.html");
16030
+ const hostPage = join15(hostDir, "audio-fx.html");
15923
16031
  writeFileSync6(hostPage, "<!doctype html><meta charset=utf-8><title>audio fx</title>");
15924
16032
  await page.goto(pathToFileURL(hostPage).href, {
15925
16033
  waitUntil: "domcontentloaded"
@@ -16384,8 +16492,8 @@ async function extractAudioSegment(srcPath, outputPath, stage, mediaStart, durat
16384
16492
  });
16385
16493
  const loopDuration = (metadata?.durationSeconds ?? 0) - mediaStart;
16386
16494
  if (options?.loop && loopDuration > 0 && sourceDuration > loopDuration) {
16387
- const cycleDir = mkdtempSync8(join15(outputDir, ".audio-loop-"));
16388
- const cyclePath = join15(cycleDir, "cycle.wav");
16495
+ const cycleDir = mkdtempSync9(join16(outputDir, ".audio-loop-"));
16496
+ const cyclePath = join16(cycleDir, "cycle.wav");
16389
16497
  try {
16390
16498
  const cycle = await extractAudioSegment(
16391
16499
  srcPath,
@@ -16573,8 +16681,8 @@ async function mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, con
16573
16681
  const runMix = async (ignoreAutomation, useNormalize2) => {
16574
16682
  const inputs = [];
16575
16683
  tracks.forEach((track) => inputs.push("-i", track.srcPath));
16576
- const scriptDir = mkdtempSync8(join15(outputDir, ".filter-complex-"));
16577
- const scriptPath = join15(scriptDir, "graph.txt");
16684
+ const scriptDir = mkdtempSync9(join16(outputDir, ".filter-complex-"));
16685
+ const scriptPath = join16(scriptDir, "graph.txt");
16578
16686
  const fd = openSync4(scriptPath, "wx", 384);
16579
16687
  try {
16580
16688
  writeFileSync7(fd, buildFilterComplex(ignoreAutomation, useNormalize2));
@@ -16684,8 +16792,8 @@ async function mixGroupMembersFlat(memberTracks, outputPath, totalDuration, sign
16684
16792
  `${mixInputs}amix=inputs=${memberTracks.length}:duration=longest:dropout_transition=0[mixed];[mixed]volume=${formatFilterNumber(memberTracks.length)}[out]`
16685
16793
  );
16686
16794
  const filterComplex = [...inputFilters, mixFilter].join(";");
16687
- const scriptDir = mkdtempSync8(join15(outputDir, ".group-filter-complex-"));
16688
- const scriptPath = join15(scriptDir, "graph.txt");
16795
+ const scriptDir = mkdtempSync9(join16(outputDir, ".group-filter-complex-"));
16796
+ const scriptPath = join16(scriptDir, "graph.txt");
16689
16797
  const fd = openSync4(scriptPath, "wx", 384);
16690
16798
  try {
16691
16799
  writeFileSync7(fd, filterComplex);
@@ -16764,7 +16872,7 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
16764
16872
  let degradedAutomation = false;
16765
16873
  for (let at = 0; at < tracks.length; at += MAX_MIX_INPUTS) {
16766
16874
  const id = `sum-${at / MAX_MIX_INPUTS}`;
16767
- const slicePath = join15(scratchDir, `${id}-slice.wav`);
16875
+ const slicePath = join16(scratchDir, `${id}-slice.wav`);
16768
16876
  const slice = await mixGroupMembersFlat(
16769
16877
  tracks.slice(at, at + MAX_MIX_INPUTS),
16770
16878
  slicePath,
@@ -16778,7 +16886,7 @@ async function sumInSlices(tracks, scratchDir, totalDuration, signal, config) {
16778
16886
  running = wavTrack(id, slicePath);
16779
16887
  continue;
16780
16888
  }
16781
- const foldedPath = join15(scratchDir, `${id}.wav`);
16889
+ const foldedPath = join16(scratchDir, `${id}.wav`);
16782
16890
  const folded = await mixGroupMembersFlat(
16783
16891
  [running, wavTrack(`${id}-slice`, slicePath)],
16784
16892
  foldedPath,
@@ -16799,7 +16907,7 @@ async function mixGroupMembers(memberTracks, outputPath, totalDuration, signal,
16799
16907
  return mixGroupMembersFlat(memberTracks, outputPath, totalDuration, signal, config);
16800
16908
  }
16801
16909
  mkdirSync7(dirname7(outputPath), { recursive: true });
16802
- const scratchDir = mkdtempSync8(join15(dirname7(outputPath), ".mix-batches-"));
16910
+ const scratchDir = mkdtempSync9(join16(dirname7(outputPath), ".mix-batches-"));
16803
16911
  try {
16804
16912
  const summed = await sumInSlices(memberTracks, scratchDir, totalDuration, signal, config);
16805
16913
  if (!summed.success) return summed;
@@ -16814,7 +16922,7 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
16814
16922
  return mixAudioTracksFlat(tracks, outputPath, totalDuration, signal, config);
16815
16923
  }
16816
16924
  mkdirSync7(dirname7(outputPath), { recursive: true });
16817
- const scratchDir = mkdtempSync8(join15(dirname7(outputPath), ".mix-batches-"));
16925
+ const scratchDir = mkdtempSync9(join16(dirname7(outputPath), ".mix-batches-"));
16818
16926
  try {
16819
16927
  const summed = await sumInSlices(tracks, scratchDir, totalDuration, signal, config);
16820
16928
  if (!summed.success) {
@@ -16844,12 +16952,12 @@ async function mixAudioTracks(tracks, outputPath, totalDuration, signal, config)
16844
16952
  }
16845
16953
  }
16846
16954
  async function mixThroughFloatSum(tracks, masterChain, outputPath, workDir, totalDuration, signal, config) {
16847
- const sumPath = join15(workDir, "master-sum.wav");
16955
+ const sumPath = join16(workDir, "master-sum.wav");
16848
16956
  const mixStart = Date.now();
16849
16957
  const sum = await mixAudioTracks(tracks, sumPath, totalDuration, signal, config);
16850
16958
  if (!sum.success) return { ...sum, outputPath };
16851
16959
  const masterStart = Date.now();
16852
- const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain, join15(workDir, "master-fx.wav"), {
16960
+ const encoderInput = masterChain ? (await applyAudioFxChain(sumPath, masterChain, join16(workDir, "master-fx.wav"), {
16853
16961
  trackId: "master",
16854
16962
  signal
16855
16963
  })).path : sumPath;
@@ -16994,7 +17102,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
16994
17102
  }
16995
17103
  let audioSrcPath = srcPath;
16996
17104
  if (element.type === "video") {
16997
- const extractedPath = join15(workDir, `${element.id}-extracted.wav`);
17105
+ const extractedPath = join16(workDir, `${element.id}-extracted.wav`);
16998
17106
  const extractResult = await extractAudioSegment(
16999
17107
  srcPath,
17000
17108
  extractedPath,
@@ -17022,7 +17130,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
17022
17130
  }
17023
17131
  audioSrcPath = extractedPath;
17024
17132
  } else {
17025
- const trimmedPath = join15(workDir, `${element.id}-trimmed.wav`);
17133
+ const trimmedPath = join16(workDir, `${element.id}-trimmed.wav`);
17026
17134
  const prepResult = await extractAudioSegment(
17027
17135
  srcPath,
17028
17136
  trimmedPath,
@@ -17074,7 +17182,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
17074
17182
  const fxResult = await applyAudioFxChain(
17075
17183
  audioSrcPath,
17076
17184
  chain,
17077
- join15(workDir, `${element.id}-fx.wav`),
17185
+ join16(workDir, `${element.id}-fx.wav`),
17078
17186
  {
17079
17187
  trackId: element.id,
17080
17188
  signal: effectiveSignal,
@@ -17197,7 +17305,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
17197
17305
  const meta = groupMeta.get(groupId);
17198
17306
  if (!meta) continue;
17199
17307
  const pathId = safePathSegment(groupId, groupIndex);
17200
- const groupWavPath = join15(workDir, `group-${pathId}.wav`);
17308
+ const groupWavPath = join16(workDir, `group-${pathId}.wav`);
17201
17309
  try {
17202
17310
  const subMix = await mixGroupMembers(
17203
17311
  memberTracks,
@@ -17230,7 +17338,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
17230
17338
  const fxResult = await applyAudioFxChain(
17231
17339
  groupSrcPath,
17232
17340
  chain,
17233
- join15(workDir, `group-${pathId}-fx.wav`),
17341
+ join16(workDir, `group-${pathId}-fx.wav`),
17234
17342
  {
17235
17343
  trackId: groupId,
17236
17344
  signal: effectiveSignal,
@@ -17312,21 +17420,21 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
17312
17420
  import { cpus as cpus3, freemem } from "os";
17313
17421
  import { existsSync as existsSync12, mkdirSync as mkdirSync8, readdirSync as readdirSync6 } from "fs";
17314
17422
  import { copyFile as copyFile2, readFile as readFile2 } from "fs/promises";
17315
- import { join as join17 } from "path";
17423
+ import { join as join18 } from "path";
17316
17424
  import { getHeapStatistics } from "v8";
17317
17425
 
17318
17426
  // ../engine/src/utils/psnr.ts
17319
17427
  import { execFile as execFile4 } from "child_process";
17320
17428
  import { mkdtemp, rm, writeFile } from "fs/promises";
17321
- import { tmpdir as tmpdir5 } from "os";
17322
- import { join as join16 } from "path";
17429
+ import { tmpdir as tmpdir6 } from "os";
17430
+ import { join as join17 } from "path";
17323
17431
  import { promisify as promisify3 } from "util";
17324
17432
  async function psnrDb(a, b) {
17325
17433
  const execFileP = promisify3(execFile4);
17326
- const dir = await mkdtemp(join16(tmpdir5(), "hf-de-verify-"));
17434
+ const dir = await mkdtemp(join17(tmpdir6(), "hf-de-verify-"));
17327
17435
  try {
17328
- const pa = join16(dir, "a.jpg");
17329
- const pb = join16(dir, "b.jpg");
17436
+ const pa = join17(dir, "a.jpg");
17437
+ const pb = join17(dir, "b.jpg");
17330
17438
  await Promise.all([writeFile(pa, a), writeFile(pb, b)]);
17331
17439
  const { stderr } = await execFileP(
17332
17440
  getFfmpegBinary(),
@@ -17550,7 +17658,7 @@ function distributeFrames(totalFrames, workerCount, workDir, rangeStart = 0) {
17550
17658
  workerId: i,
17551
17659
  startFrame,
17552
17660
  endFrame,
17553
- outputDir: join17(workDir, `worker-${i}`),
17661
+ outputDir: join18(workDir, `worker-${i}`),
17554
17662
  outputFrameOffset: rangeStart
17555
17663
  });
17556
17664
  }
@@ -17564,7 +17672,7 @@ function distributeFramesInterleaved(totalFrames, workerCount, workDir, rangeSta
17564
17672
  startFrame: rangeStart + i,
17565
17673
  endFrame: rangeStart + totalFrames,
17566
17674
  frameStride: workerCount,
17567
- outputDir: join17(workDir, `worker-${i}`),
17675
+ outputDir: join18(workDir, `worker-${i}`),
17568
17676
  outputFrameOffset: rangeStart
17569
17677
  });
17570
17678
  }
@@ -17770,13 +17878,13 @@ async function verifyDiskDrawElementSamples(session, task, streaming) {
17770
17878
  for (const idx of selectVerifySampleIndicesForTask(truths.keys(), task)) {
17771
17879
  const truth = truths.get(idx);
17772
17880
  if (!truth) continue;
17773
- const framePath = join17(task.outputDir, `frame_${String(idx - offset).padStart(6, "0")}.${ext}`);
17881
+ const framePath = join18(task.outputDir, `frame_${String(idx - offset).padStart(6, "0")}.${ext}`);
17774
17882
  const db = await psnrForDiskSample(framePath, truth, task.workerId, idx);
17775
17883
  if (db === null) continue;
17776
17884
  assertDiskSampleAboveFloor(db, verifyMinDb, idx, task.workerId);
17777
17885
  }
17778
17886
  }
17779
- async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCaptureHook, signal, onFrameCaptured, onFrameBuffer, config, parallel, onFailure, onWorkerPhase, onWorkerOperation) {
17887
+ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCaptureHook, signal, onFrameCaptured, onFrameBuffer, config, parallel, onFailure, onWorkerPhase, onWorkerOperation, gate) {
17780
17888
  const startTime = Date.now();
17781
17889
  let framesCaptured = 0;
17782
17890
  if (!existsSync12(task.outputDir)) mkdirSync8(task.outputDir, { recursive: true });
@@ -17834,6 +17942,7 @@ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCa
17834
17942
  await assertSwiftShader(activeSession.page, readWebGlVendorInfoFromCanvas);
17835
17943
  }
17836
17944
  await initializeSession(activeSession);
17945
+ if (gate) await (task.workerId === 0 ? gate.verify(activeSession) : gate.wait());
17837
17946
  });
17838
17947
  canvasDrawElement = activeSession.captureMode === "drawelement";
17839
17948
  gpuBackend = activeSession.gpuRenderer ?? "unknown";
@@ -17865,6 +17974,7 @@ async function executeWorkerTask(task, serverUrl, captureOptions, createBeforeCa
17865
17974
  pageErrorLines: pageErrorLinesOf(activeSession)
17866
17975
  };
17867
17976
  } catch (error) {
17977
+ if (task.workerId === 0) gate?.fail(error);
17868
17978
  const diagnostics = session ? selectWorkerDiagnostics(session.browserConsoleBuffer) : [];
17869
17979
  const workerDiagnostic = {
17870
17980
  workerId: task.workerId,
@@ -17906,6 +18016,24 @@ function isPoolFatalWorkerFailure(failure, streaming) {
17906
18016
  if (streaming) return failure.kind !== "cancelled";
17907
18017
  return isFatalCaptureFailure(failure);
17908
18018
  }
18019
+ function createFirstSessionGate(verify) {
18020
+ let fail;
18021
+ let pass;
18022
+ const settled = new Promise((resolve2, reject) => {
18023
+ pass = resolve2;
18024
+ fail = reject;
18025
+ });
18026
+ settled.catch(() => {
18027
+ });
18028
+ return {
18029
+ verify: (session) => verify(session).then(pass, (error) => {
18030
+ fail(error);
18031
+ throw error;
18032
+ }),
18033
+ wait: () => settled,
18034
+ fail
18035
+ };
18036
+ }
17909
18037
  function pageErrorLinesOf(session) {
17910
18038
  return session.browserConsoleBuffer.filter((line) => line.includes("PAGEERROR"));
17911
18039
  }
@@ -17977,6 +18105,7 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
17977
18105
  hooks
17978
18106
  });
17979
18107
  const onFailure = failureHandler.onFailure;
18108
+ const gate = hooks?.verifyFirstSession && createFirstSessionGate(hooks.verifyFirstSession);
17980
18109
  const results = await Promise.all(
17981
18110
  tasks.map(
17982
18111
  (task) => executeWorkerTask(
@@ -17991,7 +18120,8 @@ async function executeParallelCapture(serverUrl, workDir, tasks, captureOptions,
17991
18120
  parallel,
17992
18121
  onFailure,
17993
18122
  onWorkerPhase,
17994
- hooks?.onWorkerOperation
18123
+ hooks?.onWorkerOperation,
18124
+ gate
17995
18125
  )
17996
18126
  )
17997
18127
  );
@@ -18021,8 +18151,8 @@ async function mergeWorkerFrames(workDir, tasks, outputDir) {
18021
18151
  }
18022
18152
  const files = readdirSync6(task.outputDir).filter((f) => f.startsWith("frame_") && (f.endsWith(".jpg") || f.endsWith(".png"))).sort();
18023
18153
  const copyTasks = files.map(async (file) => {
18024
- const sourcePath = join17(task.outputDir, file);
18025
- const targetPath = join17(outputDir, file);
18154
+ const sourcePath = join18(task.outputDir, file);
18155
+ const targetPath = join18(outputDir, file);
18026
18156
  try {
18027
18157
  await renameWithRetryAsync(sourcePath, targetPath);
18028
18158
  } catch {
@@ -18047,7 +18177,7 @@ function getSystemResources() {
18047
18177
  import { Hono } from "hono";
18048
18178
  import { serve } from "@hono/node-server";
18049
18179
  import { readFileSync as readFileSync8, openSync as openSync5, fstatSync, closeSync as closeSync5, statSync as statSync8, constants } from "fs";
18050
- import { join as join18, extname as extname3 } from "path";
18180
+ import { join as join19, extname as extname3 } from "path";
18051
18181
  var MIME_TYPES = {
18052
18182
  ".html": "text/html; charset=utf-8",
18053
18183
  ".css": "text/css; charset=utf-8",
@@ -18094,10 +18224,10 @@ function readRegularFile(filePath) {
18094
18224
  }
18095
18225
  }
18096
18226
  function resolveContainedPaths(projectDir, compiledDir, relativePath) {
18097
- const projectPath = join18(projectDir, relativePath);
18227
+ const projectPath = join19(projectDir, relativePath);
18098
18228
  if (!isWithinProjectRoot(projectDir, projectPath)) return null;
18099
18229
  if (!compiledDir) return { projectPath, compiledPath: null };
18100
- const compiledPath = join18(compiledDir, relativePath);
18230
+ const compiledPath = join19(compiledDir, relativePath);
18101
18231
  if (!isWithinProjectRoot(compiledDir, compiledPath)) return null;
18102
18232
  return { projectPath, compiledPath };
18103
18233
  }
@@ -18478,6 +18608,7 @@ export {
18478
18608
  applyConcreteGpuScreenshotClamp,
18479
18609
  SDR_RGB_TO_BT709_FILTER,
18480
18610
  SDR_RGB_TO_TAGGED_BT709_FILTER,
18611
+ explainChromeLaunchFailure,
18481
18612
  BrowserLeasePool,
18482
18613
  setHostHandlesSigint,
18483
18614
  resolveHeadlessShellPath,