hyperframes 0.8.226 → 0.8.228

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 (203) hide show
  1. package/dist/{add-3NBOSGKQ.js → add-5BRVXGZV.js} +11 -11
  2. package/dist/{agentPromptGenerator-GQSDTAV5.js → agentPromptGenerator-UZ3FX4D3.js} +5 -5
  3. package/dist/{animatedGifPrep-UXFFDGA7.js → animatedGifPrep-2XRRZPQO.js} +5 -5
  4. package/dist/api.d.ts +122 -1
  5. package/dist/api.js +25 -17
  6. package/dist/{asset-VQVAYC7E.js → asset-P7AMFWJH.js} +2 -2
  7. package/dist/{assetCataloger-C6KNE2IQ.js → assetCataloger-OZZ5MJBG.js} +6 -6
  8. package/dist/{audio-2KULGXHA.js → audio-SJ2FVL2U.js} +11 -11
  9. package/dist/{auth-QNMLPJOW.js → auth-HKMZPPR7.js} +1 -1
  10. package/dist/{autoUpdate-VFQQ47UD.js → autoUpdate-LL3OOBWP.js} +2 -2
  11. package/dist/{backgroundChecks-SSQ2U3ZY.js → backgroundChecks-XQO65DJE.js} +3 -3
  12. package/dist/backgroundChecksWorker.js +3 -3
  13. package/dist/{batchRender-Y45PZC3Q.js → batchRender-XZYDF2FG.js} +3 -3
  14. package/dist/{beats-YSJT4NUG.js → beats-3IGHLEBF.js} +7 -7
  15. package/dist/{benchmark-6UOMMUXF.js → benchmark-IW6RD4YW.js} +8 -8
  16. package/dist/{browser-GM4ZTCRQ.js → browser-H53R7G4S.js} +3 -3
  17. package/dist/{bundleWithLocalizedFonts-CUTSKVRK.js → bundleWithLocalizedFonts-I7PYCJHZ.js} +2 -2
  18. package/dist/{capture-J24XSJTZ.js → capture-CONXFELZ.js} +10 -10
  19. package/dist/{capture-SZ65WG5Z.js → capture-VS5ZCDVK.js} +3 -3
  20. package/dist/{captureCompositionFrame-5UUXIOF2.js → captureCompositionFrame-CXMJFFT6.js} +11 -11
  21. package/dist/{catalog-5EQFE3BC.js → catalog-T35EYURG.js} +11 -11
  22. package/dist/{catch-up-ASBRKHDL.js → catch-up-5ADD6TS2.js} +4 -4
  23. package/dist/{check-BA4SSXPY.js → check-I2O6NZY4.js} +36 -36
  24. package/dist/{checkAudio-TU4GPHIR.js → checkAudio-TL5G6H6R.js} +8 -8
  25. package/dist/{checkBrowser-27SFNNPD.js → checkBrowser-IBLU6INC.js} +30 -30
  26. package/dist/{chunk-5TXYCG4M.js → chunk-2TL6R2B5.js} +4 -4
  27. package/dist/{chunk-5X65O5WM.js → chunk-2WZSWSVB.js} +1 -1
  28. package/dist/{chunk-LVV5EUSO.js → chunk-3OGN5ESJ.js} +2 -2
  29. package/dist/{chunk-A23K6P7L.js → chunk-3ZKTX4RA.js} +1 -1
  30. package/dist/{chunk-PVBSCPZI.js → chunk-44H3ZPQ2.js} +3 -3
  31. package/dist/{chunk-6CU2ZQGW.js → chunk-4EZVX3S4.js} +28 -23
  32. package/dist/{chunk-HYB3WSJL.js → chunk-4QRJNEY2.js} +1 -1
  33. package/dist/{chunk-AMTAKSKJ.js → chunk-4RUY7VE4.js} +9 -9
  34. package/dist/{chunk-ZI64CTVC.js → chunk-5J6IHFXE.js} +1 -1
  35. package/dist/{chunk-RRT5S42U.js → chunk-7T2OIXVQ.js} +1 -1
  36. package/dist/{chunk-OMT75FQI.js → chunk-7THO7IAN.js} +2 -2
  37. package/dist/{chunk-37PS2IPO.js → chunk-AHCAIKBH.js} +1 -1
  38. package/dist/{chunk-XDTRM4OS.js → chunk-AJAK6K6Z.js} +4 -4
  39. package/dist/{chunk-3V3XMQEF.js → chunk-ALLYZDHR.js} +1 -1
  40. package/dist/{chunk-GUJ45PRX.js → chunk-AUKCANZ5.js} +1 -1
  41. package/dist/{chunk-KQARKGEJ.js → chunk-BYU5BWLS.js} +10 -9
  42. package/dist/{chunk-35LAWHTD.js → chunk-C4YBIKYO.js} +32 -9
  43. package/dist/{chunk-JIYNPDH6.js → chunk-CK4PLF77.js} +1 -1
  44. package/dist/chunk-CKS7JLWO.js +760 -0
  45. package/dist/{chunk-B7OI3WAR.js → chunk-CPFOW5I3.js} +1 -1
  46. package/dist/{chunk-CU3SVSKX.js → chunk-D3OWJKJC.js} +1 -1
  47. package/dist/{chunk-7UKRCWBO.js → chunk-DCLGVVR7.js} +76 -21
  48. package/dist/{chunk-6EQSJ7MT.js → chunk-DRIXZXHR.js} +1 -1
  49. package/dist/{chunk-6AEHVBMX.js → chunk-DUMEO6NK.js} +1 -1
  50. package/dist/{chunk-UIJLEBHQ.js → chunk-ELECXYY6.js} +1 -1
  51. package/dist/{chunk-EJEHDDVX.js → chunk-EWUQH2H2.js} +1 -1
  52. package/dist/{chunk-WGVREWKN.js → chunk-FHBWBQMS.js} +2 -2
  53. package/dist/{chunk-ABNPD4NF.js → chunk-FSTBQD2F.js} +1 -1
  54. package/dist/{chunk-BD2CQDXP.js → chunk-FZUHMD3I.js} +17 -17
  55. package/dist/{chunk-DGQOBTFQ.js → chunk-GB4ZE5GE.js} +1 -1
  56. package/dist/{chunk-ETH6WXKZ.js → chunk-GGH5MQHG.js} +1 -1
  57. package/dist/{chunk-3XYDZQJF.js → chunk-GHPR346W.js} +1 -1
  58. package/dist/{chunk-PCH3O6I6.js → chunk-HZ7QD54G.js} +5 -5
  59. package/dist/{chunk-APCGOECM.js → chunk-J5D43JAY.js} +2 -2
  60. package/dist/{chunk-RBYSMHB7.js → chunk-KANCJWEU.js} +1 -1
  61. package/dist/{chunk-PWHOMCFB.js → chunk-KP2YSOJ5.js} +2 -2
  62. package/dist/{chunk-ZJE2XWQC.js → chunk-KZPMI6BZ.js} +2 -2
  63. package/dist/{chunk-CRIVUWLA.js → chunk-LDAKZ65G.js} +2 -2
  64. package/dist/{chunk-OQYGHP3E.js → chunk-M2WUVR6S.js} +1 -1
  65. package/dist/{chunk-76N526VX.js → chunk-MD4ITN4F.js} +13 -13
  66. package/dist/{chunk-7WNPWUJP.js → chunk-MIJSNZCK.js} +40 -11
  67. package/dist/{chunk-UXHGYMX4.js → chunk-MKCTDPSJ.js} +1 -1
  68. package/dist/{chunk-4XYLQYUE.js → chunk-MMHM3KKV.js} +2 -2
  69. package/dist/{chunk-PXSCN6X5.js → chunk-MOZ5DSCP.js} +2 -2
  70. package/dist/{chunk-MWQNQA77.js → chunk-MSCU7EGT.js} +2 -2
  71. package/dist/{chunk-V2N747YM.js → chunk-MXZXPXHQ.js} +7 -7
  72. package/dist/chunk-NWU7H447.js +5030 -0
  73. package/dist/{chunk-XH7SSJSQ.js → chunk-OOM4KSV6.js} +1 -1
  74. package/dist/{chunk-JE5ZPFN2.js → chunk-OVMEEYHH.js} +3 -3
  75. package/dist/{chunk-OSCRZUEB.js → chunk-OYR33QMF.js} +1 -1
  76. package/dist/{chunk-YTQSLNIA.js → chunk-PTIDUVWP.js} +1 -1
  77. package/dist/{chunk-U6LQ4BTL.js → chunk-PVZRUN64.js} +1 -1
  78. package/dist/{chunk-EYDV3MHA.js → chunk-QFXT2ZJ4.js} +7 -7
  79. package/dist/{chunk-P7TDUSPH.js → chunk-QTV666C6.js} +1 -1
  80. package/dist/{chunk-PHUTMTHB.js → chunk-RQD2CQDC.js} +1 -1
  81. package/dist/{chunk-ZNXUM4D2.js → chunk-RSE7JAWA.js} +2 -2
  82. package/dist/{chunk-Z257R7TN.js → chunk-RUKYGXUW.js} +1 -1
  83. package/dist/{chunk-XCGPPU32.js → chunk-SJAAY2FB.js} +1 -1
  84. package/dist/{chunk-HSXV7QPC.js → chunk-T4C5HPYH.js} +1 -1
  85. package/dist/{chunk-7LUZ4RQX.js → chunk-TIRQAJTW.js} +12 -12
  86. package/dist/{chunk-GADKBSZ5.js → chunk-TZOQFBBQ.js} +2 -2
  87. package/dist/{chunk-B243Y7MM.js → chunk-UOJSQZBR.js} +3 -3
  88. package/dist/{chunk-PZ6VVOOE.js → chunk-UWM22NR5.js} +1 -1
  89. package/dist/{chunk-2JBCK6DX.js → chunk-UWS3BKTB.js} +1 -1
  90. package/dist/{chunk-MF6KVPWF.js → chunk-UZOIYEQT.js} +2 -2
  91. package/dist/{chunk-DW7W4J7D.js → chunk-V76CLMWJ.js} +2 -2
  92. package/dist/{chunk-S4UDVFAN.js → chunk-W6RA5HVS.js} +2 -2
  93. package/dist/{chunk-2IQONCMF.js → chunk-WIK27NBN.js} +7 -7
  94. package/dist/{chunk-WESIEW2M.js → chunk-WMLUEEKU.js} +3 -3
  95. package/dist/{chunk-B52P2FU2.js → chunk-WP64W5LK.js} +1 -1
  96. package/dist/{chunk-Y2NSHQVE.js → chunk-X6JPD24H.js} +2 -2
  97. package/dist/{chunk-VB77RRT7.js → chunk-XVK7Z5LC.js} +1 -1
  98. package/dist/{chunk-BJ3Q3XK7.js → chunk-YKB7R3ED.js} +348 -292
  99. package/dist/{chunk-RKDMYKGL.js → chunk-YQVFMOMM.js} +1 -1
  100. package/dist/{chunk-EQGBGOQQ.js → chunk-YZTGIVCU.js} +9 -9
  101. package/dist/{clean-X5VL4ILR.js → clean-XD6Y2WR3.js} +16 -16
  102. package/dist/cli.js +56 -56
  103. package/dist/{cloud-4GUUYRD3.js → cloud-XDAV4XVD.js} +4 -4
  104. package/dist/{cloudrun-KPL32MBI.js → cloudrun-WH47ZBWZ.js} +4 -4
  105. package/dist/{compare-CVEB5SQC.js → compare-C33OVRPA.js} +27 -27
  106. package/dist/{compiler-RRTQNBUH.js → compiler-JT3NQV6V.js} +2 -2
  107. package/dist/{component-TZ2SIYOX.js → component-JG435H3P.js} +3 -3
  108. package/dist/{compositions-KRTRDV72.js → compositions-URALETMD.js} +9 -9
  109. package/dist/{curve-ZXUAGU4T.js → curve-X3AVF7X7.js} +9 -9
  110. package/dist/{cuts-GY2K2CTK.js → cuts-6PSTVWG4.js} +10 -10
  111. package/dist/{delete-ZT4FCUX2.js → delete-CNAUU4A5.js} +2 -2
  112. package/dist/{deploy-DVKSQTC7.js → deploy-QHVNI6OC.js} +1 -1
  113. package/dist/{describeProject-L4ZW5CI7.js → describeProject-KRSRBDRI.js} +6 -6
  114. package/dist/{diff-AFOP2B3Y.js → diff-QOPUPZDJ.js} +19 -19
  115. package/dist/{dist-DPOLFG5U.js → dist-3LBVDOZK.js} +2 -2
  116. package/dist/{doctor-Y7YVL34W.js → doctor-ZYY3SUPX.js} +9 -9
  117. package/dist/{energy-YFLFELFX.js → energy-ANNB2G7X.js} +10 -10
  118. package/dist/{events-THASMGN6.js → events-2WUPYUDV.js} +11 -11
  119. package/dist/{events-VL7JKI2K.js → events-S6WZTCOM.js} +3 -3
  120. package/dist/{events-C5QV2MQG.js → events-XBOXT3LK.js} +2 -2
  121. package/dist/{extract-GTNBVQ63.js → extract-RQBPKZ3L.js} +10 -10
  122. package/dist/{face-BSRKCB5W.js → face-T2657W3M.js} +10 -10
  123. package/dist/{feedback-MCQ2FKCC.js → feedback-WTK3BR2G.js} +11 -11
  124. package/dist/{ffmpeg-3QNN3TQ5.js → ffmpeg-3XMQNQFR.js} +5 -5
  125. package/dist/{figma-IGXE3KWU.js → figma-PZNTF4W4.js} +3 -3
  126. package/dist/fontLocalizeCli.js +8 -8
  127. package/dist/{frames-XIFLB5KC.js → frames-2PY32Z4T.js} +11 -11
  128. package/dist/{generate-55FZPR3J.js → generate-53UW2CER.js} +12 -12
  129. package/dist/{get-2MHD7XFA.js → get-N4IILPTB.js} +2 -2
  130. package/dist/{gpuPolicy-REJFNHWD.js → gpuPolicy-DYOKYL7P.js} +5 -5
  131. package/dist/{grade-compare-CM45H7CR.js → grade-compare-AOWOOIO5.js} +28 -28
  132. package/dist/{heifImagePrep-O3UZHGWR.js → heifImagePrep-H677DLTO.js} +6 -6
  133. package/dist/{help-V2GGIKP2.js → help-ZHUXAQZV.js} +1 -1
  134. package/dist/{history-NUOQVUNY.js → history-54QWLPEE.js} +7 -7
  135. package/dist/hyperframe.manifest.json +1 -1
  136. package/dist/hyperframe.runtime.iife.js +64 -64
  137. package/dist/hyperframes-player.global.js +1 -1
  138. package/dist/{info-5CMRZEJA.js → info-6K5JUWRP.js} +7 -7
  139. package/dist/{init-JNL5R27I.js → init-5TCIBSKP.js} +25 -25
  140. package/dist/{ink-HGQUC6L3.js → ink-XX5RM2CD.js} +10 -10
  141. package/dist/{inspect-GGOCM324.js → inspect-3V2V3KL2.js} +28 -28
  142. package/dist/{installer-BBY3T5MJ.js → installer-XCAV3J6A.js} +4 -4
  143. package/dist/{keyframes-2D4ZS6HE.js → keyframes-GCS2X7TX.js} +6 -6
  144. package/dist/{lambda-TY2ZCPEN.js → lambda-6JUZYXME.js} +9 -9
  145. package/dist/{layout-X5GT4O2L.js → layout-2G4GEINC.js} +28 -28
  146. package/dist/{lint-NVOUXE2L.js → lint-JE2VSIGZ.js} +6 -6
  147. package/dist/{list-CB4UDTID.js → list-MV3PLJDW.js} +2 -2
  148. package/dist/{localPage-EYPZRIGY.js → localPage-WTACQ4HH.js} +5 -5
  149. package/dist/{login-L7JTVKV5.js → login-R4Q7Q64M.js} +4 -4
  150. package/dist/{look-VHQA2JSS.js → look-BGDLDBVW.js} +10 -10
  151. package/dist/{manager-FGQKQMI7.js → manager-BT5X67BV.js} +6 -6
  152. package/dist/{measure-5F7QZLO5.js → measure-ZTOIX5EH.js} +11 -11
  153. package/dist/{media-treatment-RRFIZKSA.js → media-treatment-BL5JCBJ6.js} +11 -11
  154. package/dist/{media-use-5YGFOFKI.js → media-use-AUAF4NW6.js} +1 -1
  155. package/dist/{models-5B2RGGBT.js → models-QSUPPDL2.js} +9 -9
  156. package/dist/{motionShot-JJBQLYCC.js → motionShot-PDSNKYAY.js} +14 -14
  157. package/dist/{normalize-audio-LWTNZWDJ.js → normalize-audio-RH556PEC.js} +8 -8
  158. package/dist/{open-PGRJXREV.js → open-JMC3AM42.js} +12 -12
  159. package/dist/{parakeetRunner-OV4NSPB3.js → parakeetRunner-RHK7LU3T.js} +10 -10
  160. package/dist/{pipeline-HXGPFQZC.js → pipeline-AMQUBBUD.js} +8 -8
  161. package/dist/{play-JONX6CIM.js → play-HRBMMSTB.js} +19 -19
  162. package/dist/{preflight-7OKMMUWG.js → preflight-R5WNJ5KC.js} +6 -6
  163. package/dist/{present-EHU52MSU.js → present-G4ASOHGK.js} +15 -15
  164. package/dist/{preview-DCEIITM6.js → preview-E76EMLHL.js} +17 -17
  165. package/dist/{probe-EA4N3WOT.js → probe-ZAHTMJ4K.js} +9 -9
  166. package/dist/{producer-FGAOUR7O.js → producer-CNJP7NWH.js} +1 -1
  167. package/dist/{projectConfig-N3ZRVJKB.js → projectConfig-AXBTPJSK.js} +6 -6
  168. package/dist/{publication-ZKY2LVN5.js → publication-CZY3OVDJ.js} +2 -2
  169. package/dist/{publish-RZVDFTBX.js → publish-NCKCQFU3.js} +18 -18
  170. package/dist/{remove-background-V5UXYPJS.js → remove-background-XBBLE6ZN.js} +9 -9
  171. package/dist/{render-UJCPQXGB.js → render-4NTEIX6C.js} +5 -5
  172. package/dist/{render-YZSDHP3U.js → render-K4SN2VZ2.js} +30 -763
  173. package/dist/{render-NEZLBRAY.js → render-MPERU2AI.js} +53 -39
  174. package/dist/{render-batch-KPGYARDI.js → render-batch-STMZ5ZGQ.js} +8 -8
  175. package/dist/{resolver-HWNPLSXK.js → resolver-YWKOIBSQ.js} +4 -4
  176. package/dist/{sherpa-HSBYKUQC.js → sherpa-KFLH5Z7E.js} +9 -9
  177. package/dist/skills/media-use/references/heygen.md +2 -1
  178. package/dist/{skills-CW23U675.js → skills-ZG2QPQYG.js} +5 -5
  179. package/dist/{skillsUpdateCheck-LGBNNYLI.js → skillsUpdateCheck-GVYAPPEI.js} +3 -3
  180. package/dist/{snapshot-RK7ED6DW.js → snapshot-YCHIYLWT.js} +52 -36
  181. package/dist/{src-KORQVG7O.js → src-27JZLSBO.js} +6 -4
  182. package/dist/{src-ZDLQFZ4B.js → src-XCS2N6EG.js} +7 -7
  183. package/dist/{staticProjectServer-TFWT5G2L.js → staticProjectServer-ASRDNNFG.js} +16 -16
  184. package/dist/studio/assets/{hyperframes-player-qeY0knUZ.js → hyperframes-player-Cf70g7g5.js} +1 -1
  185. package/dist/studio/assets/{index-B9O4nOYD.js → index-Ds4bLp7M.js} +1 -1
  186. package/dist/studio/assets/{index-BhZkOhf2.js → index-KTleZEQO.js} +4 -4
  187. package/dist/studio/index.html +1 -1
  188. package/dist/{studio-api-OIZEPWHS.js → studio-api-YKUVSV4J.js} +8 -8
  189. package/dist/{studioServer-62MG7LJR.js → studioServer-MZNEVHXX.js} +46 -46
  190. package/dist/{sync-Q3XYLXTX.js → sync-NLO3YATC.js} +10 -10
  191. package/dist/{telemetry-3YDPEGQK.js → telemetry-K5HV7W2M.js} +3 -3
  192. package/dist/{timeline-VDLKFZZ7.js → timeline-QRSILS6F.js} +17 -17
  193. package/dist/{tokens-ZZ4G2VKC.js → tokens-D6PLMRPT.js} +2 -2
  194. package/dist/{transcribe-OYRCZUZM.js → transcribe-A6ZABVDW.js} +16 -16
  195. package/dist/{transcribe-2D6UIVAE.js → transcribe-ABCSYFPP.js} +8 -8
  196. package/dist/{updateCheck-ZRG5DR74.js → updateCheck-V4G5IV43.js} +2 -2
  197. package/dist/{upgrade-ZU6BHCTC.js → upgrade-OS7M65CJ.js} +2 -2
  198. package/dist/{urlDownloader-5WPUC6C6.js → urlDownloader-ONLQCQ7O.js} +4 -4
  199. package/dist/{validate-OZRPF6YZ.js → validate-BYDGTD6L.js} +22 -22
  200. package/dist/{video-N2KXXYS3.js → video-O2LMQZWJ.js} +6 -6
  201. package/dist/warmCheck.js +36 -36
  202. package/package.json +1 -1
  203. package/dist/chunk-XINVBLXA.js +0 -5030
@@ -8,12 +8,12 @@ import {
8
8
  Semaphore,
9
9
  prepareHeifImageInputs,
10
10
  withMediaProbeSlot
11
- } from "./chunk-CRIVUWLA.js";
11
+ } from "./chunk-LDAKZ65G.js";
12
12
  import {
13
13
  EncoderInterruptedError,
14
14
  encoderFailureError,
15
15
  prepareAnimatedGifInputs
16
- } from "./chunk-WGVREWKN.js";
16
+ } from "./chunk-FHBWBQMS.js";
17
17
  import {
18
18
  GENERIC_FAMILIES,
19
19
  collectFontFamilyCustomProperties,
@@ -49,6 +49,7 @@ import {
49
49
  appendRateCapArgs,
50
50
  appendRenderProvenanceArgs,
51
51
  appendSoftwareEncoderThreadsArg,
52
+ applyAudioFxChain,
52
53
  applyConcreteGpuScreenshotClamp,
53
54
  applyDomLayerMask,
54
55
  applyFaststart,
@@ -179,7 +180,7 @@ import {
179
180
  videoAudioId,
180
181
  videoStartOnMediaTimeline,
181
182
  writeCapturedFrame
182
- } from "./chunk-7UKRCWBO.js";
183
+ } from "./chunk-DCLGVVR7.js";
183
184
  import {
184
185
  assignBundledRuntimeCompositionIds,
185
186
  emitMountedModuleScripts,
@@ -191,7 +192,7 @@ import {
191
192
  parsesAsScript,
192
193
  prepareFlattenedInnerRoot,
193
194
  stripSdrPngColourTags
194
- } from "./chunk-3XYDZQJF.js";
195
+ } from "./chunk-GHPR346W.js";
195
196
  import {
196
197
  collectScratchLeftovers,
197
198
  removeScratch,
@@ -210,7 +211,7 @@ import {
210
211
  parseVfxChain,
211
212
  resolveAuthoredTimingWindow,
212
213
  toFps
213
- } from "./chunk-XCGPPU32.js";
214
+ } from "./chunk-SJAAY2FB.js";
214
215
  import {
215
216
  gsapCdnDist,
216
217
  normalizeGsapBaseUrl
@@ -249,7 +250,7 @@ import {
249
250
  sourceTimeAt,
250
251
  styleElementsFor,
251
252
  timeAtSourceTime
252
- } from "./chunk-XINVBLXA.js";
253
+ } from "./chunk-NWU7H447.js";
253
254
  import {
254
255
  TRANSITIONS,
255
256
  convertTransfer,
@@ -311,7 +312,7 @@ import {
311
312
 
312
313
  // ../producer/src/services/renderOrchestrator.ts
313
314
  import {
314
- existsSync as existsSync16,
315
+ existsSync as existsSync17,
315
316
  mkdirSync as mkdirSync8,
316
317
  readdirSync as readdirSync5,
317
318
  rmSync as rmSync8,
@@ -321,7 +322,7 @@ import {
321
322
  appendFileSync
322
323
  } from "fs";
323
324
  import { tmpdir as tmpdir2 } from "os";
324
- import { join as join25, dirname as dirname9, resolve as resolve6 } from "path";
325
+ import { join as join26, dirname as dirname10, resolve as resolve6 } from "path";
325
326
  import { totalmem as totalmem2 } from "os";
326
327
  import { randomUUID } from "crypto";
327
328
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -9145,7 +9146,11 @@ async function planVideoLayerPassthrough(input) {
9145
9146
  }
9146
9147
 
9147
9148
  // ../producer/src/services/render/stages/audioStage.ts
9148
- import { join as join18 } from "path";
9149
+ import { join as join19 } from "path";
9150
+
9151
+ // ../producer/src/services/render/audioDeliveryLimit.ts
9152
+ import { existsSync as existsSync12 } from "fs";
9153
+ import { dirname as dirname7, join as join18 } from "path";
9149
9154
 
9150
9155
  // ../producer/src/services/render/audioPadTrim.ts
9151
9156
  import { spawn } from "child_process";
@@ -9588,6 +9593,48 @@ async function runFfprobeJson(args, signal) {
9588
9593
  }
9589
9594
  }
9590
9595
 
9596
+ // ../producer/src/services/render/audioDeliveryLimit.ts
9597
+ var LIMIT_CEILING_DBTP = AAC_DELIVERY_TRUE_PEAK_DBFS - 2;
9598
+ var LIMIT_CHAIN = {
9599
+ version: 1,
9600
+ nodes: [{ type: "truepeak", id: "delivery", params: { ceiling: LIMIT_CEILING_DBTP } }]
9601
+ };
9602
+ async function limitDeliveryPeaks(input, deps = {
9603
+ measure: measureTruePeakDbfs,
9604
+ applyChain: applyAudioFxChain,
9605
+ encode: encodeAac,
9606
+ rename: renameWithRetry,
9607
+ sourceExists: existsSync12
9608
+ }) {
9609
+ const { audioPath, sourcePath, signal, timeoutMs } = input;
9610
+ if (!deps.sourceExists(sourcePath)) return { success: true };
9611
+ const peak = await deps.measure(audioPath, { timeoutMs, signal });
9612
+ if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
9613
+ const limitedPath = join18(dirname7(sourcePath), "audio-source-limited.wav");
9614
+ try {
9615
+ await deps.applyChain(sourcePath, LIMIT_CHAIN, limitedPath, { trackId: "delivery", signal });
9616
+ } catch (error) {
9617
+ if (signal?.aborted) throw error;
9618
+ input.warn?.("[audio] true-peak limit failed, the whole-mix cut applies", {
9619
+ error: error instanceof Error ? error.message : String(error)
9620
+ });
9621
+ return { success: true };
9622
+ }
9623
+ const encoded = await deps.encode(limitedPath, audioPath, input.targetDurationSeconds, {
9624
+ signal,
9625
+ timeout: timeoutMs
9626
+ });
9627
+ if (!encoded.success) {
9628
+ return {
9629
+ success: false,
9630
+ error: `[audioDeliveryLimit] ${describeFfmpegFailure(encoded, timeoutMs)}`,
9631
+ failureReason: encoded.failureReason
9632
+ };
9633
+ }
9634
+ deps.rename(limitedPath, sourcePath, { copyFallback: true });
9635
+ return { success: true };
9636
+ }
9637
+
9591
9638
  // ../producer/src/services/render/stages/audioStage.ts
9592
9639
  function assertAudioNotInterrupted(failures) {
9593
9640
  const interrupted = failures?.find((failure) => failure.reason === "external_interruption");
@@ -9611,13 +9658,22 @@ function runAudioStage(input) {
9611
9658
  }
9612
9659
  async function runAudioStageScoped(input) {
9613
9660
  const stageStart = Date.now();
9614
- const pcmSourcePath = join18(input.workDir, "audio-source.wav");
9661
+ const pcmSourcePath = join19(input.workDir, "audio-source.wav");
9615
9662
  const duration = input.totalFrames * input.fps.den / input.fps.num;
9616
9663
  try {
9617
9664
  const result = await mixAudioForDelivery(input, duration, pcmSourcePath);
9618
9665
  let audioLoweredDb;
9619
9666
  if (result.hasAudio) {
9620
9667
  const guardStart = Date.now();
9668
+ const limited = await limitDeliveryPeaks({
9669
+ audioPath: result.audioOutputPath,
9670
+ sourcePath: pcmSourcePath,
9671
+ targetDurationSeconds: duration,
9672
+ signal: input.abortSignal,
9673
+ timeoutMs: input.ffmpegProcessTimeout,
9674
+ warn: (message, details) => input.log?.warn?.(message, details)
9675
+ });
9676
+ if (!limited.success) throw encoderFailureError("Audio true-peak limit failed", limited);
9621
9677
  const peak = await constrainAacTruePeak({
9622
9678
  audioPath: result.audioOutputPath,
9623
9679
  sourcePath: pcmSourcePath,
@@ -9649,7 +9705,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
9649
9705
  assertNotAborted,
9650
9706
  log
9651
9707
  } = input;
9652
- const audioOutputPath = join18(workDir, MIXED_AUDIO_FILENAME);
9708
+ const audioOutputPath = join19(workDir, MIXED_AUDIO_FILENAME);
9653
9709
  let hasAudio = false;
9654
9710
  let audioError;
9655
9711
  let audioFailures;
@@ -9660,7 +9716,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
9660
9716
  audioResult = await processCompositionAudio(
9661
9717
  audios,
9662
9718
  projectDir,
9663
- join18(workDir, "audio-work"),
9719
+ join19(workDir, "audio-work"),
9664
9720
  audioOutputPath,
9665
9721
  duration,
9666
9722
  abortSignal,
@@ -9728,8 +9784,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
9728
9784
  }
9729
9785
 
9730
9786
  // ../producer/src/services/render/stages/captureStage.ts
9731
- import { existsSync as existsSync12, readdirSync as readdirSync3, statfsSync as statfsSync2 } from "fs";
9732
- import { join as join19 } from "path";
9787
+ import { existsSync as existsSync13, readdirSync as readdirSync3, statfsSync as statfsSync2 } from "fs";
9788
+ import { join as join20 } from "path";
9733
9789
  function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
9734
9790
  return workerCount > 1;
9735
9791
  }
@@ -9785,16 +9841,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
9785
9841
  }
9786
9842
  function measureCaptureFrameBytes(workDir, framesDir) {
9787
9843
  let total = sampleDirectoryBytes(framesDir);
9788
- if (!existsSync12(workDir)) return total;
9844
+ if (!existsSync13(workDir)) return total;
9789
9845
  for (const attempt of readdirSync3(workDir)) {
9790
9846
  if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
9791
- total += sampleDirectoryBytes(join19(workDir, attempt));
9847
+ total += sampleDirectoryBytes(join20(workDir, attempt));
9792
9848
  continue;
9793
9849
  }
9794
9850
  if (!/^capture-attempt-\d+$/.test(attempt)) continue;
9795
- const attemptDir = join19(workDir, attempt);
9851
+ const attemptDir = join20(workDir, attempt);
9796
9852
  for (const name of readdirSync3(attemptDir)) {
9797
- if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join19(attemptDir, name));
9853
+ if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join20(attemptDir, name));
9798
9854
  }
9799
9855
  }
9800
9856
  return total;
@@ -10088,8 +10144,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
10088
10144
  }
10089
10145
 
10090
10146
  // ../producer/src/services/render/stages/captureHdrStage.ts
10091
- import { existsSync as existsSync14, mkdirSync as mkdirSync6 } from "fs";
10092
- import { join as join23 } from "path";
10147
+ import { existsSync as existsSync15, mkdirSync as mkdirSync6 } from "fs";
10148
+ import { join as join24 } from "path";
10093
10149
 
10094
10150
  // ../producer/src/services/hdrImageTransferCache.ts
10095
10151
  var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
@@ -10151,7 +10207,7 @@ function createHdrImageTransferCache(options = {}) {
10151
10207
  }
10152
10208
 
10153
10209
  // ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
10154
- import { join as join20 } from "path";
10210
+ import { join as join21 } from "path";
10155
10211
  async function runSequentialLayeredFrameLoop(input) {
10156
10212
  const {
10157
10213
  job,
@@ -10272,7 +10328,7 @@ async function runSequentialLayeredFrameLoop(input) {
10272
10328
  );
10273
10329
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
10274
10330
  writeFileExclusiveSync(
10275
- join20(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10331
+ join21(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10276
10332
  normalCanvas
10277
10333
  );
10278
10334
  }
@@ -10304,14 +10360,14 @@ async function runSequentialLayeredFrameLoop(input) {
10304
10360
  }
10305
10361
 
10306
10362
  // ../producer/src/services/render/stages/captureHdrHybridLoop.ts
10307
- import { join as join22 } from "path";
10363
+ import { join as join23 } from "path";
10308
10364
 
10309
10365
  // ../producer/src/services/shaderTransitionWorkerPool.ts
10310
10366
  import { Worker } from "worker_threads";
10311
10367
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "url";
10312
- import { dirname as dirname7, join as join21 } from "path";
10368
+ import { dirname as dirname8, join as join22 } from "path";
10313
10369
  import { createRequire } from "module";
10314
- import { existsSync as existsSync13 } from "fs";
10370
+ import { existsSync as existsSync14 } from "fs";
10315
10371
  import { cpus as cpus2 } from "os";
10316
10372
  function resolveWorkerEntry(explicit) {
10317
10373
  if (explicit && explicit.length > 0) {
@@ -10322,10 +10378,10 @@ function resolveWorkerEntry(explicit) {
10322
10378
  const isTs = override.endsWith(".ts");
10323
10379
  return { path: override, isTs };
10324
10380
  }
10325
- const moduleDir = dirname7(fileURLToPath3(import.meta.url));
10326
- const jsPath = join21(moduleDir, "shaderTransitionWorker.js");
10327
- if (existsSync13(jsPath)) return { path: jsPath, isTs: false };
10328
- const tsPath = join21(moduleDir, "shaderTransitionWorker.ts");
10381
+ const moduleDir = dirname8(fileURLToPath3(import.meta.url));
10382
+ const jsPath = join22(moduleDir, "shaderTransitionWorker.js");
10383
+ if (existsSync14(jsPath)) return { path: jsPath, isTs: false };
10384
+ const tsPath = join22(moduleDir, "shaderTransitionWorker.ts");
10329
10385
  return { path: tsPath, isTs: true };
10330
10386
  }
10331
10387
  function buildExecArgv(entryIsTs) {
@@ -10693,7 +10749,7 @@ async function runHybridLayeredFrameLoop(input) {
10693
10749
  );
10694
10750
  if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
10695
10751
  writeFileExclusiveSync(
10696
- join22(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10752
+ join23(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
10697
10753
  canvas
10698
10754
  );
10699
10755
  }
@@ -10884,8 +10940,8 @@ async function runCaptureHdrStage(input) {
10884
10940
  if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
10885
10941
  }
10886
10942
  const debugDumpEnabled = process.env.KEEP_TEMP === "1";
10887
- const debugDumpDir = debugDumpEnabled ? join23(framesDir, "debug-composite") : null;
10888
- if (debugDumpDir && !existsSync14(debugDumpDir)) {
10943
+ const debugDumpDir = debugDumpEnabled ? join24(framesDir, "debug-composite") : null;
10944
+ if (debugDumpDir && !existsSync15(debugDumpDir)) {
10889
10945
  mkdirSync6(debugDumpDir, { recursive: true });
10890
10946
  }
10891
10947
  const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
@@ -11042,7 +11098,7 @@ async function runCaptureHdrStage(input) {
11042
11098
  // ../producer/src/services/render/stages/encodeStage.ts
11043
11099
  import {
11044
11100
  copyFileSync as copyFileSync2,
11045
- existsSync as existsSync15,
11101
+ existsSync as existsSync16,
11046
11102
  mkdirSync as mkdirSync7,
11047
11103
  readdirSync as readdirSync4,
11048
11104
  readFileSync as readFileSync5,
@@ -11051,7 +11107,7 @@ import {
11051
11107
  writeFileSync as writeFileSync4
11052
11108
  } from "fs";
11053
11109
  import { readFile as readFile2 } from "fs/promises";
11054
- import { dirname as dirname8, join as join24 } from "path";
11110
+ import { dirname as dirname9, join as join25 } from "path";
11055
11111
 
11056
11112
  // ../producer/src/services/render/stages/gifEncodeArgs.ts
11057
11113
  function fpsToFfmpegArg2(fps) {
@@ -11161,7 +11217,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
11161
11217
  const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
11162
11218
  if (failure) return failure;
11163
11219
  }
11164
- const fileSize = existsSync15(outputPath) ? statSync5(outputPath).size : 0;
11220
+ const fileSize = existsSync16(outputPath) ? statSync5(outputPath).size : 0;
11165
11221
  return {
11166
11222
  success: true,
11167
11223
  outputPath,
@@ -11247,7 +11303,7 @@ function encodeWhileCapturing(input, totalFrames) {
11247
11303
  await new Promise((resolve11) => wake = resolve11);
11248
11304
  }
11249
11305
  if (signal.aborted) return;
11250
- const mergedPath = join24(input.framesDir, formatCaptureFrameName(next, "jpg"));
11306
+ const mergedPath = join25(input.framesDir, formatCaptureFrameName(next, "jpg"));
11251
11307
  const frame = await readLandedFrame(landed.get(next), mergedPath);
11252
11308
  landed.delete(next);
11253
11309
  if (!await stream.writeFrame(frame)) {
@@ -11322,7 +11378,7 @@ async function runEncodeStage(input) {
11322
11378
  const stage5Start = Date.now();
11323
11379
  if (isPngSequence) {
11324
11380
  const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
11325
- if (!existsSync15(outputPath)) mkdirSync7(outputPath, { recursive: true });
11381
+ if (!existsSync16(outputPath)) mkdirSync7(outputPath, { recursive: true });
11326
11382
  const captured = readdirSync4(framesDir).filter((name) => name.endsWith(".png")).sort();
11327
11383
  if (captured.length === 0) {
11328
11384
  throw new Error(
@@ -11330,11 +11386,11 @@ async function runEncodeStage(input) {
11330
11386
  );
11331
11387
  }
11332
11388
  captured.forEach((name, i) => {
11333
- const dst = join24(outputPath, formatExportFrameName(i, "png"));
11334
- copyFileSync2(join24(framesDir, name), dst);
11389
+ const dst = join25(outputPath, formatExportFrameName(i, "png"));
11390
+ copyFileSync2(join25(framesDir, name), dst);
11335
11391
  });
11336
- if (hasAudio && audioOutputPath && existsSync15(audioOutputPath)) {
11337
- copyFileSync2(audioOutputPath, join24(outputPath, MIXED_AUDIO_FILENAME));
11392
+ if (hasAudio && audioOutputPath && existsSync16(audioOutputPath)) {
11393
+ copyFileSync2(audioOutputPath, join25(outputPath, MIXED_AUDIO_FILENAME));
11338
11394
  log.info(
11339
11395
  `[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
11340
11396
  );
@@ -11354,7 +11410,7 @@ async function runEncodeStage(input) {
11354
11410
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
11355
11411
  fps: job.config.fps,
11356
11412
  loop,
11357
- palettePath: join24(dirname8(videoOnlyPath), "gif-palette.png"),
11413
+ palettePath: join25(dirname9(videoOnlyPath), "gif-palette.png"),
11358
11414
  preserveAlpha: needsAlpha,
11359
11415
  signal: abortSignal,
11360
11416
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -11563,7 +11619,7 @@ function sampleDirectoryBytes(dir) {
11563
11619
  continue;
11564
11620
  }
11565
11621
  for (const name of entries) {
11566
- const full = join25(current, name);
11622
+ const full = join26(current, name);
11567
11623
  try {
11568
11624
  const st = statSync6(full);
11569
11625
  if (st.isDirectory()) {
@@ -11712,8 +11768,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
11712
11768
  const ranges = [];
11713
11769
  let rangeStart = null;
11714
11770
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
11715
- const framePath = join25(framesDir, formatCaptureFrameName(frameIndex, frameExt));
11716
- const missing = !existsSync16(framePath) || statSync6(framePath).size <= 8;
11771
+ const framePath = join26(framesDir, formatCaptureFrameName(frameIndex, frameExt));
11772
+ const missing = !existsSync17(framePath) || statSync6(framePath).size <= 8;
11717
11773
  if (missing && rangeStart === null) {
11718
11774
  rangeStart = frameIndex;
11719
11775
  } else if (!missing && rangeStart !== null) {
@@ -11729,7 +11785,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
11729
11785
  function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
11730
11786
  const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
11731
11787
  const batches = [];
11732
- const outputDirFor = (batchIndex, workerId) => join25(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
11788
+ const outputDirFor = (batchIndex, workerId) => join26(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
11733
11789
  if (stride > 1) {
11734
11790
  const spans = /* @__PURE__ */ new Map();
11735
11791
  for (const range of ranges) {
@@ -11789,8 +11845,8 @@ function getNextRetryWorkerCount(currentWorkers) {
11789
11845
  return Math.max(1, Math.floor(currentWorkers / 2));
11790
11846
  }
11791
11847
  function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
11792
- if (platform2 === "win32" || platform2 === "darwin") return join25(systemTempDir, "hf-render-");
11793
- return join25(dirname9(outputPath), `work-${jobId}-`);
11848
+ if (platform2 === "win32" || platform2 === "darwin") return join26(systemTempDir, "hf-render-");
11849
+ return join26(dirname10(outputPath), `work-${jobId}-`);
11794
11850
  }
11795
11851
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
11796
11852
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -11837,8 +11893,8 @@ The composition is too large for the available memory. To reduce memory pressure
11837
11893
  function countCapturedFrames(totalFrames, framesDir, frameExt) {
11838
11894
  let captured = 0;
11839
11895
  for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
11840
- const framePath = join25(framesDir, formatCaptureFrameName(frameIndex, frameExt));
11841
- if (existsSync16(framePath)) captured++;
11896
+ const framePath = join26(framesDir, formatCaptureFrameName(frameIndex, frameExt));
11897
+ if (existsSync17(framePath)) captured++;
11842
11898
  }
11843
11899
  return captured;
11844
11900
  }
@@ -11863,7 +11919,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
11863
11919
  reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
11864
11920
  });
11865
11921
  pendingTransientRetry = false;
11866
- const attemptWorkDir = join25(options.workDir, `capture-attempt-${attempt}`);
11922
+ const attemptWorkDir = join26(options.workDir, `capture-attempt-${attempt}`);
11867
11923
  const batches = missingRanges ? buildMissingFrameRetryBatches(
11868
11924
  missingRanges,
11869
11925
  currentWorkers,
@@ -12493,19 +12549,19 @@ function deVerifyFallbackTelemetry(err) {
12493
12549
  };
12494
12550
  }
12495
12551
  function resolveRenderDebugDir() {
12496
- const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname9(fileURLToPath4(import.meta.url)), "../..");
12497
- return join25(producerRoot, ".debug");
12552
+ const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve6(process.env.PRODUCER_RENDERS_DIR, "..") : resolve6(dirname10(fileURLToPath4(import.meta.url)), "../..");
12553
+ return join26(producerRoot, ".debug");
12498
12554
  }
12499
12555
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
12500
12556
  validateHlsRenderConfig(job.config);
12501
12557
  validateDeliveryEncoderConfig(job.config);
12502
12558
  const debugDir = resolveRenderDebugDir();
12503
- const outputDir = dirname9(outputPath);
12504
- if (!existsSync16(outputDir)) mkdirSync8(outputDir, { recursive: true });
12505
- const workDir = job.config.debug ? join25(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
12559
+ const outputDir = dirname10(outputPath);
12560
+ if (!existsSync17(outputDir)) mkdirSync8(outputDir, { recursive: true });
12561
+ const workDir = job.config.debug ? join26(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
12506
12562
  const pipelineStart = Date.now();
12507
12563
  const baseLog = job.config.logger ?? defaultLogger;
12508
- const logPath = job.config.debug ? join25(workDir, "render.log") : null;
12564
+ const logPath = job.config.debug ? join26(workDir, "render.log") : null;
12509
12565
  const execution = new RenderExecutionContext({
12510
12566
  request: { renderJobId: job.id, projectDir, outputPath },
12511
12567
  logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
@@ -12566,7 +12622,7 @@ async function executeRenderPipeline(input) {
12566
12622
  imageDecodeFailures: 0
12567
12623
  };
12568
12624
  let hdrPerf;
12569
- const perfOutputPath = join25(workDir, "perf-summary.json");
12625
+ const perfOutputPath = join26(workDir, "perf-summary.json");
12570
12626
  const cfg = { ...job.config.producerConfig ?? resolveConfig() };
12571
12627
  const observability = new RenderObservabilityRecorder({
12572
12628
  pipelineStartMs: pipelineStart,
@@ -12642,7 +12698,7 @@ async function executeRenderPipeline(input) {
12642
12698
  job.startedAt = /* @__PURE__ */ new Date();
12643
12699
  assertNotAborted();
12644
12700
  assertConfiguredFfmpegBinariesExist();
12645
- if (!existsSync16(workDir)) mkdirSync8(workDir, { recursive: true });
12701
+ if (!existsSync17(workDir)) mkdirSync8(workDir, { recursive: true });
12646
12702
  if (job.config.debug) {
12647
12703
  log.info("[Render] Debug artifacts enabled", { workDir, logPath });
12648
12704
  }
@@ -12671,16 +12727,16 @@ async function executeRenderPipeline(input) {
12671
12727
  requestedWorkers: job.config.workers ?? "auto"
12672
12728
  });
12673
12729
  const entryFile = job.config.entryFile || "index.html";
12674
- let htmlPath = join25(projectDir, entryFile);
12675
- if (!existsSync16(htmlPath)) {
12730
+ let htmlPath = join26(projectDir, entryFile);
12731
+ if (!existsSync17(htmlPath)) {
12676
12732
  throw new Error(`Entry file not found: ${htmlPath}`);
12677
12733
  }
12678
12734
  assertNotAborted();
12679
12735
  const rawEntry = readTextFile(htmlPath);
12680
12736
  if (entryFile !== "index.html" && isTemplateEntry(rawEntry)) {
12681
- const wrapperPath = join25(workDir, "standalone-entry.html");
12682
- const projectIndexPath = join25(projectDir, "index.html");
12683
- if (!existsSync16(projectIndexPath)) {
12737
+ const wrapperPath = join26(workDir, "standalone-entry.html");
12738
+ const projectIndexPath = join26(projectDir, "index.html");
12739
+ if (!existsSync17(projectIndexPath)) {
12684
12740
  throw new Error(
12685
12741
  `Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
12686
12742
  );
@@ -12870,7 +12926,7 @@ async function executeRenderPipeline(input) {
12870
12926
  canvas: { width, height },
12871
12927
  page: probeSession.page,
12872
12928
  projectDir,
12873
- compiledDir: join25(workDir, "compiled")
12929
+ compiledDir: join26(workDir, "compiled")
12874
12930
  });
12875
12931
  if (videoLayerPlan.videoId === void 0) {
12876
12932
  log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
@@ -12888,7 +12944,7 @@ async function executeRenderPipeline(input) {
12888
12944
  updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
12889
12945
  code: "extract_video"
12890
12946
  });
12891
- const compiledDir = join25(workDir, "compiled");
12947
+ const compiledDir = join26(workDir, "compiled");
12892
12948
  const extractResult = await observeRenderStage(
12893
12949
  observability,
12894
12950
  "video_extract",
@@ -13000,7 +13056,7 @@ async function executeRenderPipeline(input) {
13000
13056
  try {
13001
13057
  fileServer = await createFileServer({
13002
13058
  projectDir,
13003
- compiledDir: join25(workDir, "compiled"),
13059
+ compiledDir: join26(workDir, "compiled"),
13004
13060
  port: 0,
13005
13061
  preHeadScripts: [VIRTUAL_TIME_SHIM],
13006
13062
  fps: job.config.fps
@@ -13018,8 +13074,8 @@ async function executeRenderPipeline(input) {
13018
13074
  if (!activeFileServer) {
13019
13075
  throw new Error("File server failed to initialize before frame capture");
13020
13076
  }
13021
- const framesDir = join25(workDir, "captured-frames");
13022
- if (!existsSync16(framesDir)) mkdirSync8(framesDir, { recursive: true });
13077
+ const framesDir = join26(workDir, "captured-frames");
13078
+ if (!existsSync17(framesDir)) mkdirSync8(framesDir, { recursive: true });
13023
13079
  updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
13024
13080
  code: "start_browsers"
13025
13081
  });
@@ -13516,7 +13572,7 @@ async function executeRenderPipeline(input) {
13516
13572
  hls: ".mp4"
13517
13573
  };
13518
13574
  const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
13519
- const videoOnlyPath = join25(workDir, `video-only${videoExt}`);
13575
+ const videoOnlyPath = join26(workDir, `video-only${videoExt}`);
13520
13576
  const usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
13521
13577
  if (usePageSideCompositingForTransitions) {
13522
13578
  activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
@@ -13804,7 +13860,7 @@ async function executeRenderPipeline(input) {
13804
13860
  pageMotionBlur: job.config.pageMotionBlur,
13805
13861
  captureQuality: captureOptions.quality
13806
13862
  });
13807
- const segmentDir = segmentDirFor(join25(projectDir, "renders"), segmentPlanHash);
13863
+ const segmentDir = segmentDirFor(join26(projectDir, "renders"), segmentPlanHash);
13808
13864
  let completedSegments = /* @__PURE__ */ new Set();
13809
13865
  if (job.config.resumeSegments === true) {
13810
13866
  const existing = readSegmentManifest(segmentDir);
@@ -14341,7 +14397,7 @@ async function executeRenderPipeline(input) {
14341
14397
  })
14342
14398
  );
14343
14399
  const totalElapsed = Date.now() - pipelineStart;
14344
- const tmpPeakBytes = existsSync16(workDir) ? sampleDirectoryBytes(workDir) : 0;
14400
+ const tmpPeakBytes = existsSync17(workDir) ? sampleDirectoryBytes(workDir) : 0;
14345
14401
  recordTransientRetryObservability();
14346
14402
  observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
14347
14403
  const observabilitySummary = observability.summary({
@@ -14422,8 +14478,8 @@ async function executeRenderPipeline(input) {
14422
14478
  }
14423
14479
  }
14424
14480
  if (job.config.debug) {
14425
- if (!isPngSequence && !isHls && existsSync16(stagedOutputPath)) {
14426
- const debugOutput = join25(workDir, `output${videoExt}`);
14481
+ if (!isPngSequence && !isHls && existsSync17(stagedOutputPath)) {
14482
+ const debugOutput = join26(workDir, `output${videoExt}`);
14427
14483
  copyFileSync3(stagedOutputPath, debugOutput);
14428
14484
  }
14429
14485
  }
@@ -14529,13 +14585,13 @@ async function executeRenderPipeline(input) {
14529
14585
 
14530
14586
  // ../producer/src/services/distributed/renderSpan.ts
14531
14587
  import { mkdirSync as mkdirSync16, mkdtempSync as mkdtempSync7, readFileSync as readFileSync11, rmSync as rmSync14 } from "fs";
14532
- import { join as join38 } from "path";
14588
+ import { join as join39 } from "path";
14533
14589
  import { tmpdir as tmpdir4 } from "os";
14534
14590
 
14535
14591
  // ../producer/src/services/distributed/mp4Stitch.ts
14536
14592
  import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync9, mkdtempSync as mkdtempSync4, rmSync as rmSync9 } from "fs";
14537
14593
  import { open } from "fs/promises";
14538
- import { dirname as dirname10, join as join26 } from "path";
14594
+ import { dirname as dirname11, join as join27 } from "path";
14539
14595
  import { finished, pipeline } from "stream/promises";
14540
14596
  function boxAt(src, off, at, limit) {
14541
14597
  let size = src.readUInt32BE(off);
@@ -14899,15 +14955,15 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
14899
14955
  const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
14900
14956
  const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
14901
14957
  const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
14902
- mkdirSync9(dirname10(outputPath), { recursive: true });
14958
+ mkdirSync9(dirname11(outputPath), { recursive: true });
14903
14959
  const workDir = mkdtempSync4(`${outputPath}.stitch-`);
14904
- const out = createWriteStream(join26(workDir, "out.mp4"));
14960
+ const out = createWriteStream(join27(workDir, "out.mp4"));
14905
14961
  try {
14906
14962
  out.write(header);
14907
14963
  for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
14908
14964
  out.end();
14909
14965
  await finished(out);
14910
- renameWithRetry(join26(workDir, "out.mp4"), outputPath);
14966
+ renameWithRetry(join27(workDir, "out.mp4"), outputPath);
14911
14967
  } finally {
14912
14968
  out.destroy();
14913
14969
  rmSync9(workDir, { recursive: true, force: true });
@@ -14918,25 +14974,25 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
14918
14974
  import {
14919
14975
  copyFileSync as copyFileSync4,
14920
14976
  cpSync as cpSync2,
14921
- existsSync as existsSync21,
14977
+ existsSync as existsSync22,
14922
14978
  linkSync,
14923
14979
  mkdirSync as mkdirSync12,
14924
14980
  rmSync as rmSync10,
14925
14981
  writeFileSync as writeFileSync8
14926
14982
  } from "fs";
14927
- import { extname as extname6, isAbsolute as isAbsolute2, join as join33, relative as relative5, sep as sep2 } from "path";
14983
+ import { extname as extname6, isAbsolute as isAbsolute2, join as join34, relative as relative5, sep as sep2 } from "path";
14928
14984
 
14929
14985
  // ../producer/src/services/distributed/planFrameCost.ts
14930
- import { join as join29 } from "path";
14986
+ import { join as join30 } from "path";
14931
14987
 
14932
14988
  // ../producer/src/services/distributed/chunkFrames.ts
14933
- import { existsSync as existsSync18, readdirSync as readdirSync6 } from "fs";
14934
- import { extname as extname4, join as join28 } from "path";
14989
+ import { existsSync as existsSync19, readdirSync as readdirSync6 } from "fs";
14990
+ import { extname as extname4, join as join29 } from "path";
14935
14991
 
14936
14992
  // ../producer/src/services/distributed/shared.ts
14937
14993
  import { execFile as execFileCallback } from "child_process";
14938
- import { dirname as dirname11, join as join27 } from "path";
14939
- import { existsSync as existsSync17, readFileSync as readFileSync6 } from "fs";
14994
+ import { dirname as dirname12, join as join28 } from "path";
14995
+ import { existsSync as existsSync18, readFileSync as readFileSync6 } from "fs";
14940
14996
  import { fileURLToPath as fileURLToPath5 } from "url";
14941
14997
  import { promisify as promisify2 } from "util";
14942
14998
  var PLAN_VIDEOS_META_RELATIVE_PATH = "meta/videos.json";
@@ -14947,8 +15003,8 @@ function isPlanAudioArtifactPath(path) {
14947
15003
  }
14948
15004
  function resolvePlanAudioPath(planDir) {
14949
15005
  for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
14950
- const candidate = join27(planDir, name);
14951
- if (existsSync17(candidate)) return candidate;
15006
+ const candidate = join28(planDir, name);
15007
+ if (existsSync18(candidate)) return candidate;
14952
15008
  }
14953
15009
  return null;
14954
15010
  }
@@ -15205,11 +15261,11 @@ function buildSyntheticRenderJob(input) {
15205
15261
  var cachedProducerVersion = null;
15206
15262
  function readProducerVersion() {
15207
15263
  if (cachedProducerVersion !== null) return cachedProducerVersion;
15208
- const startDir = dirname11(fileURLToPath5(import.meta.url));
15264
+ const startDir = dirname12(fileURLToPath5(import.meta.url));
15209
15265
  let current = startDir;
15210
15266
  for (let i = 0; i < 10; i++) {
15211
- const candidate = join27(current, "package.json");
15212
- if (existsSync17(candidate)) {
15267
+ const candidate = join28(current, "package.json");
15268
+ if (existsSync18(candidate)) {
15213
15269
  try {
15214
15270
  const pkg = JSON.parse(readFileSync6(candidate, "utf-8"));
15215
15271
  if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
@@ -15219,7 +15275,7 @@ function readProducerVersion() {
15219
15275
  } catch {
15220
15276
  }
15221
15277
  }
15222
- const parent = dirname11(current);
15278
+ const parent = dirname12(current);
15223
15279
  if (parent === current) break;
15224
15280
  current = parent;
15225
15281
  }
@@ -15262,8 +15318,8 @@ function frameNumberFromFileName(name) {
15262
15318
  function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
15263
15319
  const result = [];
15264
15320
  for (const v of videos) {
15265
- const outputDir = join28(planDir, "video-frames", v.videoId);
15266
- if (!existsSync18(outputDir)) {
15321
+ const outputDir = join29(planDir, "video-frames", v.videoId);
15322
+ if (!existsSync19(outputDir)) {
15267
15323
  throw new Error(
15268
15324
  `[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
15269
15325
  );
@@ -15281,7 +15337,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
15281
15337
  if (!frameName) continue;
15282
15338
  const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
15283
15339
  const frameIndex = frameNumber === null ? i : frameNumber - 1;
15284
- framePaths.set(frameIndex, join28(outputDir, frameName));
15340
+ framePaths.set(frameIndex, join29(outputDir, frameName));
15285
15341
  }
15286
15342
  result.push({
15287
15343
  videoId: v.videoId,
@@ -15371,15 +15427,15 @@ async function extractDeferredVideoFramesForChunk(input) {
15371
15427
  const shown = shownDeferredFrameIndexes(input.planVideos, input.frames, input.fps);
15372
15428
  return Promise.all(
15373
15429
  deferred.map(async (video) => {
15374
- const outputDir = join28(input.outputRoot, video.videoId);
15430
+ const outputDir = join29(input.outputRoot, video.videoId);
15375
15431
  const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
15376
15432
  if (indexes.length === 0) {
15377
15433
  return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
15378
15434
  }
15379
15435
  const range = video.deferredRange;
15380
15436
  const remoteUrl = remoteSources[range.sourcePath];
15381
- const sourcePath = remoteUrl ?? join28(input.planDir, ...range.sourcePath.split("/"));
15382
- if (remoteUrl === void 0 && !existsSync18(sourcePath)) {
15437
+ const sourcePath = remoteUrl ?? join29(input.planDir, ...range.sourcePath.split("/"));
15438
+ if (remoteUrl === void 0 && !existsSync19(sourcePath)) {
15383
15439
  throw new RenderChunkValidationError(
15384
15440
  MISSING_PLAN_ARTIFACT,
15385
15441
  `[renderChunk] planDir is missing the source for video ${JSON.stringify(video.videoId)}: ${range.sourcePath}`
@@ -15427,12 +15483,12 @@ async function measurePlanSecondsPerFrame(input) {
15427
15483
  planVideos,
15428
15484
  frames: sampled,
15429
15485
  fps: fpsRatio,
15430
- outputRoot: join29(workDir, "frame-cost-video-frames"),
15486
+ outputRoot: join30(workDir, "frame-cost-video-frames"),
15431
15487
  cfg: input.cfg
15432
15488
  })
15433
15489
  ];
15434
15490
  const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
15435
- const compiledDir = join29(planDir, "compiled");
15491
+ const compiledDir = join30(planDir, "compiled");
15436
15492
  const fileServer = await createFileServer({
15437
15493
  projectDir: compiledDir,
15438
15494
  compiledDir,
@@ -15444,7 +15500,7 @@ async function measurePlanSecondsPerFrame(input) {
15444
15500
  try {
15445
15501
  session = await createCaptureSession(
15446
15502
  fileServer.url,
15447
- join29(workDir, "frame-cost"),
15503
+ join30(workDir, "frame-cost"),
15448
15504
  buildChunkCaptureOptions({
15449
15505
  dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
15450
15506
  encoder: input,
@@ -15540,8 +15596,8 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
15540
15596
  }
15541
15597
 
15542
15598
  // ../producer/src/services/render/stages/freezePlan.ts
15543
- import { existsSync as existsSync19, mkdirSync as mkdirSync10, readFileSync as readFileSync7, readdirSync as readdirSync7, writeFileSync as writeFileSync6 } from "fs";
15544
- import { join as join30, relative as relative3, resolve as resolve7 } from "path";
15599
+ import { existsSync as existsSync20, mkdirSync as mkdirSync10, readFileSync as readFileSync7, readdirSync as readdirSync7, writeFileSync as writeFileSync6 } from "fs";
15600
+ import { join as join31, relative as relative3, resolve as resolve7 } from "path";
15545
15601
 
15546
15602
  // ../producer/src/services/distributed/planProtocol.ts
15547
15603
  var PLAN_SCHEMA_VERSION = 1;
@@ -15734,7 +15790,7 @@ function planFileSha256(absolutePath, digests) {
15734
15790
  return sha256;
15735
15791
  }
15736
15792
  async function prehashPlanFiles(dir, digests) {
15737
- if (!existsSync19(dir)) return;
15793
+ if (!existsSync20(dir)) return;
15738
15794
  for (const { absolutePath } of listPlanFiles(dir)) {
15739
15795
  if (!digests.has(absolutePath)) digests.set(absolutePath, await sha256FileAsync(absolutePath));
15740
15796
  }
@@ -15759,7 +15815,7 @@ function listPlanFiles(planDir) {
15759
15815
  function walk(dir) {
15760
15816
  const entries = readdirSync7(dir, { withFileTypes: true });
15761
15817
  for (const entry of entries) {
15762
- const full = join30(dir, entry.name);
15818
+ const full = join31(dir, entry.name);
15763
15819
  if (entry.isDirectory()) {
15764
15820
  walk(full);
15765
15821
  } else if (entry.isFile()) {
@@ -15800,19 +15856,19 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
15800
15856
  function writePlanRemoteFiles(planDir, files) {
15801
15857
  if (files.length === 0) return;
15802
15858
  const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
15803
- writeFileSync6(join30(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
15859
+ writeFileSync6(join31(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
15804
15860
  }
15805
15861
  function readPlanRemoteFiles(planDir) {
15806
- const path = join30(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
15807
- return existsSync19(path) ? JSON.parse(readFileSync7(path, "utf-8")) : [];
15862
+ const path = join31(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
15863
+ return existsSync20(path) ? JSON.parse(readFileSync7(path, "utf-8")) : [];
15808
15864
  }
15809
15865
  function recomputePlanHashFromPlanDir(planDir, digests) {
15810
- const planJsonPath = join30(planDir, "plan.json");
15811
- const encoderJsonPath = join30(planDir, "meta", "encoder.json");
15812
- if (!existsSync19(planJsonPath)) {
15866
+ const planJsonPath = join31(planDir, "plan.json");
15867
+ const encoderJsonPath = join31(planDir, "meta", "encoder.json");
15868
+ if (!existsSync20(planJsonPath)) {
15813
15869
  throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
15814
15870
  }
15815
- if (!existsSync19(encoderJsonPath)) {
15871
+ if (!existsSync20(encoderJsonPath)) {
15816
15872
  throw new Error(`[freezePlan] meta/encoder.json missing: ${encoderJsonPath}`);
15817
15873
  }
15818
15874
  const planJson = JSON.parse(readFileSync7(planJsonPath, "utf-8"));
@@ -15842,21 +15898,21 @@ async function freezePlan(input) {
15842
15898
  hasAudio,
15843
15899
  digests
15844
15900
  } = input;
15845
- if (!existsSync19(planDir)) {
15901
+ if (!existsSync20(planDir)) {
15846
15902
  throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
15847
15903
  }
15848
- const metaDir = join30(planDir, "meta");
15849
- if (!existsSync19(metaDir)) mkdirSync10(metaDir, { recursive: true });
15904
+ const metaDir = join31(planDir, "meta");
15905
+ if (!existsSync20(metaDir)) mkdirSync10(metaDir, { recursive: true });
15850
15906
  writeFileSync6(
15851
- join30(metaDir, "composition.json"),
15907
+ join31(metaDir, "composition.json"),
15852
15908
  `${JSON.stringify(composition, null, 2)}
15853
15909
  `,
15854
15910
  "utf-8"
15855
15911
  );
15856
15912
  const encoderForCanonical = stripUndefined(encoder);
15857
15913
  const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
15858
- writeFileSync6(join30(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
15859
- writeFileSync6(join30(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
15914
+ writeFileSync6(join31(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
15915
+ writeFileSync6(join31(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
15860
15916
  `, "utf-8");
15861
15917
  const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
15862
15918
  const planHash = computePlanHash({
@@ -15880,7 +15936,7 @@ async function freezePlan(input) {
15880
15936
  duration: durationSeconds,
15881
15937
  hasAudio
15882
15938
  };
15883
- const planJsonPath = join30(planDir, "plan.json");
15939
+ const planJsonPath = join31(planDir, "plan.json");
15884
15940
  writeFileSync6(planJsonPath, `${JSON.stringify(planJson, null, 2)}
15885
15941
  `, "utf-8");
15886
15942
  return { planJsonPath, planHash };
@@ -15922,9 +15978,9 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
15922
15978
  }
15923
15979
 
15924
15980
  // ../producer/src/services/distributed/chunkAudio.ts
15925
- import { closeSync as closeSync5, existsSync as existsSync20, ftruncateSync, mkdirSync as mkdirSync11, openSync as openSync5, readFileSync as readFileSync8 } from "fs";
15981
+ import { closeSync as closeSync5, existsSync as existsSync21, ftruncateSync, mkdirSync as mkdirSync11, openSync as openSync5, readFileSync as readFileSync8 } from "fs";
15926
15982
  import { writeFileSync as writeFileSync7, writeSync } from "fs";
15927
- import { join as join31 } from "path";
15983
+ import { join as join32 } from "path";
15928
15984
  function audioCutForChunk(grid, chunks, index, fps) {
15929
15985
  const firstPacketAt = (frame) => Math.min(
15930
15986
  grid.packetCount,
@@ -16011,7 +16067,7 @@ async function writeChunkAudioSlices(input) {
16011
16067
  });
16012
16068
  const bytes = readFileSync8(input.audioPath);
16013
16069
  const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
16014
- mkdirSync11(join31(input.planDir, SLICE_DIR), { recursive: true });
16070
+ mkdirSync11(join32(input.planDir, SLICE_DIR), { recursive: true });
16015
16071
  input.chunks.forEach((_, index) => {
16016
16072
  const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
16017
16073
  if (!cut) return;
@@ -16019,17 +16075,17 @@ async function writeChunkAudioSlices(input) {
16019
16075
  const start = offsets[cut.firstPacket];
16020
16076
  layout.partStarts[index] = start;
16021
16077
  const end = offsets[last] + track.sizes[last];
16022
- writeFileSync7(join31(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
16078
+ writeFileSync7(join32(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
16023
16079
  });
16024
16080
  const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
16025
- writeFileSync7(join31(input.planDir, SLICE_FRAME), Buffer.concat(frame));
16026
- writeFileSync7(join31(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
16081
+ writeFileSync7(join32(input.planDir, SLICE_FRAME), Buffer.concat(frame));
16082
+ writeFileSync7(join32(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
16027
16083
  }
16028
16084
  function chunkAudioSource(planDir, chunkIndex, scratchPath) {
16029
- const layoutPath = join31(planDir, SLICE_LAYOUT);
16030
- if (!existsSync20(layoutPath)) return resolvePlanAudioPath(planDir);
16085
+ const layoutPath = join32(planDir, SLICE_LAYOUT);
16086
+ if (!existsSync21(layoutPath)) return resolvePlanAudioPath(planDir);
16031
16087
  const layout = JSON.parse(readFileSync8(layoutPath, "utf-8"));
16032
- const frame = readFileSync8(join31(planDir, SLICE_FRAME));
16088
+ const frame = readFileSync8(join32(planDir, SLICE_FRAME));
16033
16089
  const fd = openSync5(scratchPath, "w");
16034
16090
  try {
16035
16091
  writeSync(fd, frame, 0, layout.payloadStart, 0);
@@ -16042,7 +16098,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
16042
16098
  );
16043
16099
  const start = layout.partStarts[chunkIndex];
16044
16100
  if (start !== void 0) {
16045
- const part = readFileSync8(join31(planDir, chunkAudioSlicePath(chunkIndex)));
16101
+ const part = readFileSync8(join32(planDir, chunkAudioSlicePath(chunkIndex)));
16046
16102
  writeSync(fd, part, 0, part.length, start);
16047
16103
  }
16048
16104
  ftruncateSync(fd, layout.sizeBytes);
@@ -16098,7 +16154,7 @@ async function muxChunkWithAudio(input) {
16098
16154
  // ../producer/src/services/distributed/planSize.ts
16099
16155
  import { createHash as createHash7 } from "crypto";
16100
16156
  import { lstatSync as lstatSync2, readdirSync as readdirSync8 } from "fs";
16101
- import { extname as extname5, join as join32, relative as relative4 } from "path";
16157
+ import { extname as extname5, join as join33, relative as relative4 } from "path";
16102
16158
  var MAX_TOP_COMPONENTS = 10;
16103
16159
  var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
16104
16160
  ".aac",
@@ -16210,7 +16266,7 @@ function walkRegularFiles(dir, visit) {
16210
16266
  return;
16211
16267
  }
16212
16268
  for (const entry of entries) {
16213
- const full = join32(dir, entry.name);
16269
+ const full = join33(dir, entry.name);
16214
16270
  if (entry.isDirectory()) {
16215
16271
  walkRegularFiles(full, visit);
16216
16272
  } else if (entry.isFile()) {
@@ -16422,13 +16478,13 @@ function assertPositiveInteger2(name, value) {
16422
16478
  }
16423
16479
  var FREEZE_OWNED_PLAN_FILES = [
16424
16480
  "plan.json",
16425
- join33("meta", "composition.json"),
16426
- join33("meta", "encoder.json"),
16427
- join33("meta", "chunks.json")
16481
+ join34("meta", "composition.json"),
16482
+ join34("meta", "encoder.json"),
16483
+ join34("meta", "chunks.json")
16428
16484
  ];
16429
16485
  function removeFreezeOwnedPlanFiles(planDir) {
16430
16486
  for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
16431
- rmSync10(join33(planDir, relativePath), { force: true });
16487
+ rmSync10(join34(planDir, relativePath), { force: true });
16432
16488
  }
16433
16489
  }
16434
16490
  function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
@@ -16583,19 +16639,19 @@ function createVideoSourceShipper(input) {
16583
16639
  const known = shipped.get(srcPath);
16584
16640
  if (known) return known;
16585
16641
  const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
16586
- const current = stagedRel === null ? srcPath : join33(input.planDir, "video-frames", stagedRel);
16642
+ const current = stagedRel === null ? srcPath : join34(input.planDir, "video-frames", stagedRel);
16587
16643
  let result = null;
16588
16644
  for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
16589
16645
  const rel = pathInside(root, srcPath);
16590
- if (rel !== null && (existsSync21(join33(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
16646
+ if (rel !== null && (existsSync22(join34(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
16591
16647
  result = ["compiled", ...rel.split(sep2)].join("/");
16592
16648
  break;
16593
16649
  }
16594
16650
  }
16595
16651
  if (result === null) {
16596
16652
  result = `video-sources/${shipped.size}${extname6(current)}`;
16597
- const destination = join33(input.planDir, ...result.split("/"));
16598
- mkdirSync12(join33(input.planDir, "video-sources"), { recursive: true });
16653
+ const destination = join34(input.planDir, ...result.split("/"));
16654
+ mkdirSync12(join34(input.planDir, "video-sources"), { recursive: true });
16599
16655
  try {
16600
16656
  linkSync(current, destination);
16601
16657
  } catch {
@@ -16615,7 +16671,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16615
16671
  useGpu: false,
16616
16672
  browserGpuMode: "software"
16617
16673
  });
16618
- if (!existsSync21(planDir)) mkdirSync12(planDir, { recursive: true });
16674
+ if (!existsSync22(planDir)) mkdirSync12(planDir, { recursive: true });
16619
16675
  const log = config.logger ?? defaultLogger;
16620
16676
  const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
16621
16677
  const abortSignal = config.abortSignal;
@@ -16644,14 +16700,14 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16644
16700
  variables: config.variables
16645
16701
  });
16646
16702
  const entryFile = config.entryFile ?? "index.html";
16647
- const htmlPath = join33(projectDir, entryFile);
16648
- if (!existsSync21(htmlPath)) {
16703
+ const htmlPath = join34(projectDir, entryFile);
16704
+ if (!existsSync22(htmlPath)) {
16649
16705
  throw new Error(`[plan] entry file not found: ${htmlPath}`);
16650
16706
  }
16651
- const workDir = join33(planDir, ".plan-work");
16707
+ const workDir = join34(planDir, ".plan-work");
16652
16708
  rmSync10(workDir, { recursive: true, force: true });
16653
16709
  mkdirSync12(workDir, { recursive: true });
16654
- const compiledDir = join33(workDir, "compiled");
16710
+ const compiledDir = join34(workDir, "compiled");
16655
16711
  mkdirSync12(compiledDir, { recursive: true });
16656
16712
  let stageStarted = Date.now();
16657
16713
  cpSync2(projectDir, compiledDir, {
@@ -16665,10 +16721,10 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16665
16721
  }
16666
16722
  });
16667
16723
  logPlanStage(log, "copy", stageStarted);
16668
- const finalCompiledDir = join33(planDir, "compiled");
16724
+ const finalCompiledDir = join34(planDir, "compiled");
16669
16725
  const needsAlpha = outputNeedsAlpha(config.format);
16670
16726
  const remoteFiles = Object.entries(options.remoteFiles ?? {});
16671
- const remoteLocalPath = (rel) => join33(projectDir, ...rel.split("/"));
16727
+ const remoteLocalPath = (rel) => join34(projectDir, ...rel.split("/"));
16672
16728
  for (const [, file] of remoteFiles) {
16673
16729
  declareContentAddressedUrl(file.url, file.sha256);
16674
16730
  if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
@@ -16747,7 +16803,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
16747
16803
  if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
16748
16804
  if (probeResult.probeSession) {
16749
16805
  try {
16750
- const { closeCaptureSession: closeCaptureSession2 } = await import("./src-KORQVG7O.js");
16806
+ const { closeCaptureSession: closeCaptureSession2 } = await import("./src-27JZLSBO.js");
16751
16807
  await closeCaptureSession2(probeResult.probeSession);
16752
16808
  } catch (err) {
16753
16809
  log.warn("[plan] probe session close failed", {
@@ -16854,17 +16910,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
16854
16910
  let stageStarted = Date.now();
16855
16911
  const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
16856
16912
  logPlanStage(log, "extract", stageStarted);
16857
- const stagedVideoFrames = join33(compiledDir, "__hyperframes_video_frames");
16858
- const videoFramesDst = join33(planDir, "video-frames");
16859
- if (existsSync21(videoFramesDst)) rmSync10(videoFramesDst, { recursive: true, force: true });
16860
- const videoSourcesDir = join33(planDir, "video-sources");
16913
+ const stagedVideoFrames = join34(compiledDir, "__hyperframes_video_frames");
16914
+ const videoFramesDst = join34(planDir, "video-frames");
16915
+ if (existsSync22(videoFramesDst)) rmSync10(videoFramesDst, { recursive: true, force: true });
16916
+ const videoSourcesDir = join34(planDir, "video-sources");
16861
16917
  rmSync10(videoSourcesDir, { recursive: true, force: true });
16862
- if (existsSync21(stagedVideoFrames)) {
16918
+ if (existsSync22(stagedVideoFrames)) {
16863
16919
  renameWithRetry(stagedVideoFrames, videoFramesDst);
16864
16920
  } else {
16865
16921
  mkdirSync12(videoFramesDst, { recursive: true });
16866
16922
  }
16867
- if (existsSync21(finalCompiledDir)) rmSync10(finalCompiledDir, { recursive: true, force: true });
16923
+ if (existsSync22(finalCompiledDir)) rmSync10(finalCompiledDir, { recursive: true, force: true });
16868
16924
  renameWithRetry(compiledDir, finalCompiledDir);
16869
16925
  const shipVideoSource = createVideoSourceShipper({
16870
16926
  planDir,
@@ -16894,7 +16950,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
16894
16950
  };
16895
16951
  })
16896
16952
  });
16897
- mkdirSync12(join33(planDir, "meta"), { recursive: true });
16953
+ mkdirSync12(join34(planDir, "meta"), { recursive: true });
16898
16954
  writePlanRemoteFiles(
16899
16955
  planDir,
16900
16956
  remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
@@ -16904,7 +16960,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
16904
16960
  }))
16905
16961
  );
16906
16962
  writeFileSync8(
16907
- join33(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
16963
+ join34(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
16908
16964
  JSON.stringify(planVideosJson, null, 2),
16909
16965
  "utf-8"
16910
16966
  );
@@ -16983,11 +17039,11 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
16983
17039
  if (audioResult?.audioError) {
16984
17040
  applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
16985
17041
  }
16986
- const planAudioPath = join33(planDir, PLAN_AUDIO_RELATIVE_PATH);
16987
- if (audioResult?.hasAudio && existsSync21(audioResult.audioOutputPath)) {
17042
+ const planAudioPath = join34(planDir, PLAN_AUDIO_RELATIVE_PATH);
17043
+ if (audioResult?.hasAudio && existsSync22(audioResult.audioOutputPath)) {
16988
17044
  renameWithRetry(audioResult.audioOutputPath, planAudioPath);
16989
17045
  }
16990
- if (chunksCarryAudio && existsSync21(planAudioPath)) {
17046
+ if (chunksCarryAudio && existsSync22(planAudioPath)) {
16991
17047
  if (options.sliceChunkAudio) {
16992
17048
  stageStarted = Date.now();
16993
17049
  await writeChunkAudioSlices({
@@ -17102,14 +17158,14 @@ async function plan(projectDir, config, planDir, options = {}) {
17102
17158
 
17103
17159
  // ../producer/src/services/distributed/renderChunk.ts
17104
17160
  import { randomBytes } from "crypto";
17105
- import { existsSync as existsSync24, mkdirSync as mkdirSync15, readFileSync as readFileSync10, readdirSync as readdirSync10, rmSync as rmSync13, writeFileSync as writeFileSync11 } from "fs";
17161
+ import { existsSync as existsSync25, mkdirSync as mkdirSync15, readFileSync as readFileSync10, readdirSync as readdirSync10, rmSync as rmSync13, writeFileSync as writeFileSync11 } from "fs";
17106
17162
  import { cpus as cpus3 } from "os";
17107
- import { join as join37 } from "path";
17163
+ import { join as join38 } from "path";
17108
17164
 
17109
17165
  // ../producer/src/services/distributed/planV2.ts
17110
17166
  import {
17111
17167
  copyFileSync as copyFileSync6,
17112
- existsSync as existsSync23,
17168
+ existsSync as existsSync24,
17113
17169
  lstatSync as lstatSync3,
17114
17170
  mkdirSync as mkdirSync14,
17115
17171
  mkdtempSync as mkdtempSync6,
@@ -17120,12 +17176,12 @@ import {
17120
17176
  writeFileSync as writeFileSync10
17121
17177
  } from "fs";
17122
17178
  import { tmpdir as tmpdir3 } from "os";
17123
- import { dirname as dirname13, isAbsolute as isAbsolute3, join as join36, relative as relative6, resolve as resolve8, sep as sep3 } from "path";
17179
+ import { dirname as dirname14, isAbsolute as isAbsolute3, join as join37, relative as relative6, resolve as resolve8, sep as sep3 } from "path";
17124
17180
 
17125
17181
  // ../producer/src/services/distributed/planV2Publisher.ts
17126
17182
  import {
17127
17183
  copyFileSync as copyFileSync5,
17128
- existsSync as existsSync22,
17184
+ existsSync as existsSync23,
17129
17185
  linkSync as linkSync2,
17130
17186
  mkdirSync as mkdirSync13,
17131
17187
  mkdtempSync as mkdtempSync5,
@@ -17133,7 +17189,7 @@ import {
17133
17189
  statSync as statSync7,
17134
17190
  writeFileSync as writeFileSync9
17135
17191
  } from "fs";
17136
- import { dirname as dirname12, join as join35 } from "path";
17192
+ import { dirname as dirname13, join as join36 } from "path";
17137
17193
 
17138
17194
  // ../producer/src/services/distributed/planV2Errors.ts
17139
17195
  var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
@@ -17148,7 +17204,7 @@ var PlanV2IntegrityError = class extends Error {
17148
17204
  };
17149
17205
 
17150
17206
  // ../producer/src/services/distributed/planV2Layout.ts
17151
- import { join as join34 } from "path";
17207
+ import { join as join35 } from "path";
17152
17208
  var SHA256_PATTERN = /^[0-9a-f]{64}$/;
17153
17209
  function assertPlanV2Sha256(value, field) {
17154
17210
  if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
@@ -17158,7 +17214,7 @@ function assertPlanV2Sha256(value, field) {
17158
17214
  }
17159
17215
  function planV2BlobPath(root, sha256) {
17160
17216
  const digest = assertPlanV2Sha256(sha256, "artifact sha256");
17161
- return join34(root, "artifacts", "sha256", digest.slice(0, 2), digest);
17217
+ return join35(root, "artifacts", "sha256", digest.slice(0, 2), digest);
17162
17218
  }
17163
17219
 
17164
17220
  // ../producer/src/services/distributed/planV2Publisher.ts
@@ -17193,13 +17249,13 @@ var LocalPlanV2ArtifactPublisher = class {
17193
17249
  #linkFile;
17194
17250
  #committed = false;
17195
17251
  constructor(destinationDir, options = {}) {
17196
- if (existsSync22(destinationDir)) {
17252
+ if (existsSync23(destinationDir)) {
17197
17253
  throw new PlanV2IntegrityError(`output directory already exists: ${destinationDir}`);
17198
17254
  }
17199
17255
  this.destinationDir = destinationDir;
17200
17256
  this.#linkFile = options.linkFile ?? linkSync2;
17201
- mkdirSync13(dirname12(destinationDir), { recursive: true });
17202
- this.temporaryDir = mkdtempSync5(join35(dirname12(destinationDir), ".plan-v2-publish-"));
17257
+ mkdirSync13(dirname13(destinationDir), { recursive: true });
17258
+ this.temporaryDir = mkdtempSync5(join36(dirname13(destinationDir), ".plan-v2-publish-"));
17203
17259
  }
17204
17260
  async putBlob(blob) {
17205
17261
  const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
@@ -17210,10 +17266,10 @@ var LocalPlanV2ArtifactPublisher = class {
17210
17266
  );
17211
17267
  }
17212
17268
  const destinationPath = planV2BlobPath(this.temporaryDir, digest);
17213
- if (existsSync22(destinationPath)) return;
17214
- mkdirSync13(dirname12(destinationPath), { recursive: true });
17215
- const stagingDir = mkdtempSync5(join35(dirname12(destinationPath), ".plan-v2-blob-"));
17216
- const temporaryPath = join35(stagingDir, "blob");
17269
+ if (existsSync23(destinationPath)) return;
17270
+ mkdirSync13(dirname13(destinationPath), { recursive: true });
17271
+ const stagingDir = mkdtempSync5(join36(dirname13(destinationPath), ".plan-v2-blob-"));
17272
+ const temporaryPath = join36(stagingDir, "blob");
17217
17273
  try {
17218
17274
  try {
17219
17275
  this.#linkFile(blob.sourcePath, temporaryPath);
@@ -17228,13 +17284,13 @@ var LocalPlanV2ArtifactPublisher = class {
17228
17284
  }
17229
17285
  async commitManifest(manifestBytes) {
17230
17286
  for (const digest of new Set(manifestDigests(manifestBytes))) {
17231
- if (!existsSync22(planV2BlobPath(this.temporaryDir, digest))) {
17287
+ if (!existsSync23(planV2BlobPath(this.temporaryDir, digest))) {
17232
17288
  throw new PlanV2IntegrityError(
17233
17289
  `cannot commit manifest before referenced blob is durable: ${digest}`
17234
17290
  );
17235
17291
  }
17236
17292
  }
17237
- writeFileSync9(join35(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
17293
+ writeFileSync9(join36(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
17238
17294
  renameWithRetry(this.temporaryDir, this.destinationDir);
17239
17295
  this.#committed = true;
17240
17296
  }
@@ -17279,7 +17335,7 @@ function listFiles(root) {
17279
17335
  const rootResolved = resolve8(root);
17280
17336
  function walk(dir) {
17281
17337
  for (const entry of readdirSync9(dir, { withFileTypes: true })) {
17282
- const absolutePath = join36(dir, entry.name);
17338
+ const absolutePath = join37(dir, entry.name);
17283
17339
  if (entry.isDirectory()) {
17284
17340
  walk(absolutePath);
17285
17341
  } else if (entry.isFile()) {
@@ -17306,13 +17362,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
17306
17362
  }
17307
17363
  }
17308
17364
  function validateExtractionCacheCompleteSentinels(executionPlanDir) {
17309
- const videoRoot = join36(executionPlanDir, "video-frames");
17310
- if (!existsSync23(videoRoot)) return;
17365
+ const videoRoot = join37(executionPlanDir, "video-frames");
17366
+ if (!existsSync24(videoRoot)) return;
17311
17367
  for (const videoEntry of readdirSync9(videoRoot, { withFileTypes: true })) {
17312
17368
  if (!videoEntry.isDirectory()) continue;
17313
- const videoDir = join36(videoRoot, videoEntry.name);
17369
+ const videoDir = join37(videoRoot, videoEntry.name);
17314
17370
  if (readdirSync9(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
17315
- const sentinelPath = join36(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
17371
+ const sentinelPath = join37(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
17316
17372
  assertValidExtractionCacheCompleteSentinel(sentinelPath);
17317
17373
  }
17318
17374
  }
@@ -17359,7 +17415,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
17359
17415
  if (video.deferredRange) {
17360
17416
  const framePaths2 = /* @__PURE__ */ new Map();
17361
17417
  for (let index = 0; index < video.totalFrames; index++) {
17362
- framePaths2.set(index, join36(outputDir, String(index)));
17418
+ framePaths2.set(index, join37(outputDir, String(index)));
17363
17419
  }
17364
17420
  return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
17365
17421
  }
@@ -17367,7 +17423,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
17367
17423
  const framePaths = /* @__PURE__ */ new Map();
17368
17424
  for (const frameName of frameNames) {
17369
17425
  if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
17370
- assertValidExtractionCacheCompleteSentinel(join36(outputDir, frameName));
17426
+ assertValidExtractionCacheCompleteSentinel(join37(outputDir, frameName));
17371
17427
  continue;
17372
17428
  }
17373
17429
  const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
@@ -17386,7 +17442,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
17386
17442
  `duplicate extracted frame index ${frameIndex} in ${outputDir}`
17387
17443
  );
17388
17444
  }
17389
- framePaths.set(frameIndex, join36(outputDir, frameName));
17445
+ framePaths.set(frameIndex, join37(outputDir, frameName));
17390
17446
  }
17391
17447
  return {
17392
17448
  ...video,
@@ -17407,8 +17463,8 @@ function parsePlanVideosJson2(value) {
17407
17463
  }
17408
17464
  }
17409
17465
  function materializeExtractedVideoDirectories(planDir) {
17410
- const videosPath = join36(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
17411
- if (!existsSync23(videosPath)) return;
17466
+ const videosPath = join37(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
17467
+ if (!existsSync24(videosPath)) return;
17412
17468
  const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
17413
17469
  for (const video of videos.extracted) {
17414
17470
  mkdirSync14(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
@@ -17441,13 +17497,13 @@ function parseChunkSlices(value) {
17441
17497
  });
17442
17498
  }
17443
17499
  function buildVideoChunkDependencies(executionPlanDir, dimensions) {
17444
- const videoRoot = join36(executionPlanDir, "video-frames");
17445
- const hasExtractedFrames = existsSync23(videoRoot) && listFiles(videoRoot).length > 0;
17446
- const videosPath = join36(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
17447
- if (!existsSync23(videosPath)) {
17500
+ const videoRoot = join37(executionPlanDir, "video-frames");
17501
+ const hasExtractedFrames = existsSync24(videoRoot) && listFiles(videoRoot).length > 0;
17502
+ const videosPath = join37(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
17503
+ if (!existsSync24(videosPath)) {
17448
17504
  return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
17449
17505
  }
17450
- const chunksPath = join36(executionPlanDir, "meta", "chunks.json");
17506
+ const chunksPath = join37(executionPlanDir, "meta", "chunks.json");
17451
17507
  const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
17452
17508
  const chunks = readJsonFile(chunksPath, "meta/chunks.json");
17453
17509
  const parsedVideos = parsePlanVideosJson2(videos);
@@ -17501,10 +17557,10 @@ function computeManifestHash(manifest) {
17501
17557
  return sha256Hex(`${PLAN_V2_HASH_PREFIX}${canonicalJsonStringify(manifestPayload(manifest))}`);
17502
17558
  }
17503
17559
  function writeBlob(sourcePath, destinationPath) {
17504
- if (existsSync23(destinationPath)) return;
17505
- mkdirSync14(dirname13(destinationPath), { recursive: true });
17506
- const temporaryDir = mkdtempSync6(join36(dirname13(destinationPath), ".plan-v2-blob-"));
17507
- const temporaryPath = join36(temporaryDir, "blob");
17560
+ if (existsSync24(destinationPath)) return;
17561
+ mkdirSync14(dirname14(destinationPath), { recursive: true });
17562
+ const temporaryDir = mkdtempSync6(join37(dirname14(destinationPath), ".plan-v2-blob-"));
17563
+ const temporaryPath = join37(temporaryDir, "blob");
17508
17564
  try {
17509
17565
  copyFileSync6(sourcePath, temporaryPath);
17510
17566
  renameWithRetry(temporaryPath, destinationPath);
@@ -17540,8 +17596,8 @@ async function putTasks(tasks) {
17540
17596
  if (failure) throw failure.reason;
17541
17597
  }
17542
17598
  function buildPlanV2Publication(executionPlanDir, digests) {
17543
- const executionPlanPath = join36(executionPlanDir, "plan.json");
17544
- if (!existsSync23(executionPlanPath)) {
17599
+ const executionPlanPath = join37(executionPlanDir, "plan.json");
17600
+ if (!existsSync24(executionPlanPath)) {
17545
17601
  throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
17546
17602
  }
17547
17603
  const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
@@ -17568,7 +17624,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
17568
17624
  }
17569
17625
  validateExtractionCacheCompleteSentinels(executionPlanDir);
17570
17626
  const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
17571
- const encoder = readJsonFile(join36(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
17627
+ const encoder = readJsonFile(join37(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
17572
17628
  const files = listFiles(executionPlanDir);
17573
17629
  const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
17574
17630
  for (const file of files) {
@@ -17621,21 +17677,21 @@ function buildPlanV2Publication(executionPlanDir, digests) {
17621
17677
  };
17622
17678
  }
17623
17679
  function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
17624
- if (existsSync23(planV2Dir)) {
17680
+ if (existsSync24(planV2Dir)) {
17625
17681
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
17626
17682
  }
17627
17683
  const publication = buildPlanV2Publication(executionPlanDir);
17628
17684
  if (publication.storedBlobs.length > 0) {
17629
17685
  throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
17630
17686
  }
17631
- mkdirSync14(dirname13(planV2Dir), { recursive: true });
17632
- const tempDir = mkdtempSync6(join36(dirname13(planV2Dir), ".plan-v2-build-"));
17687
+ mkdirSync14(dirname14(planV2Dir), { recursive: true });
17688
+ const tempDir = mkdtempSync6(join37(dirname14(planV2Dir), ".plan-v2-build-"));
17633
17689
  try {
17634
17690
  for (const blob of publication.blobs) {
17635
17691
  writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
17636
17692
  }
17637
17693
  writeFileSync10(
17638
- join36(tempDir, "plan.json"),
17694
+ join37(tempDir, "plan.json"),
17639
17695
  canonicalJsonStringify(publication.manifest),
17640
17696
  "utf-8"
17641
17697
  );
@@ -17682,7 +17738,7 @@ async function publishPlanV2FromV1(executionPlanDir, publisher) {
17682
17738
  return publishPlanV2FromExecutionPlan(executionPlanDir, publisher);
17683
17739
  }
17684
17740
  async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
17685
- const stagingRoot = mkdtempSync6(join36(options.stagingParentDir ?? tmpdir3(), ".execution-plan-"));
17741
+ const stagingRoot = mkdtempSync6(join37(options.stagingParentDir ?? tmpdir3(), ".execution-plan-"));
17686
17742
  const digests = /* @__PURE__ */ new Map();
17687
17743
  try {
17688
17744
  await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
@@ -17693,7 +17749,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
17693
17749
  // artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
17694
17750
  whileAudioMixes: () => putBlobs(
17695
17751
  publisher,
17696
- listFiles(join36(stagingRoot, "compiled")).map(
17752
+ listFiles(join37(stagingRoot, "compiled")).map(
17697
17753
  (file) => publishBlobFor(file.absolutePath, digests)
17698
17754
  )
17699
17755
  ),
@@ -17713,19 +17769,19 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
17713
17769
  }
17714
17770
  }
17715
17771
  async function planV2(projectDir, config, planV2Dir) {
17716
- if (existsSync23(planV2Dir)) {
17772
+ if (existsSync24(planV2Dir)) {
17717
17773
  throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
17718
17774
  }
17719
17775
  const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
17720
17776
  const manifest = await planV2WithPublisher(projectDir, config, publisher, {
17721
- stagingParentDir: dirname13(planV2Dir)
17777
+ stagingParentDir: dirname14(planV2Dir)
17722
17778
  });
17723
17779
  return resultFromManifest(planV2Dir, manifest);
17724
17780
  }
17725
17781
  function resultFromManifest(planV2Dir, manifest) {
17726
17782
  return {
17727
17783
  planDir: planV2Dir,
17728
- manifestPath: join36(planV2Dir, "plan.json"),
17784
+ manifestPath: join37(planV2Dir, "plan.json"),
17729
17785
  planProtocol: PLAN_PROTOCOL_V2,
17730
17786
  planHash: manifest.planHash,
17731
17787
  sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
@@ -17861,8 +17917,8 @@ function parsePlanV2Manifest(value) {
17861
17917
  return parsed;
17862
17918
  }
17863
17919
  function readPlanV2Manifest(planV2Dir) {
17864
- const manifestPath = join36(planV2Dir, "plan.json");
17865
- if (!existsSync23(manifestPath)) {
17920
+ const manifestPath = join37(planV2Dir, "plan.json");
17921
+ if (!existsSync24(manifestPath)) {
17866
17922
  throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
17867
17923
  }
17868
17924
  const value = readJsonFile(manifestPath, "v2 manifest");
@@ -17881,7 +17937,7 @@ function listPlanV2ArtifactsForTarget(manifest, target) {
17881
17937
  }
17882
17938
  function verifyBlob(planV2Dir, artifact) {
17883
17939
  const sourcePath = planV2BlobPath(planV2Dir, artifact.sha256);
17884
- if (!existsSync23(sourcePath)) {
17940
+ if (!existsSync24(sourcePath)) {
17885
17941
  throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
17886
17942
  }
17887
17943
  const stats = statSync8(sourcePath);
@@ -17894,7 +17950,7 @@ function verifyBlob(planV2Dir, artifact) {
17894
17950
  return sourcePath;
17895
17951
  }
17896
17952
  function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}) {
17897
- if (existsSync23(destinationDir)) {
17953
+ if (existsSync24(destinationDir)) {
17898
17954
  throw new PlanV2IntegrityError(`materialization destination already exists: ${destinationDir}`);
17899
17955
  }
17900
17956
  const manifest = readPlanV2Manifest(planV2Dir);
@@ -17906,17 +17962,17 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
17906
17962
  artifact,
17907
17963
  sourcePath: verifyBlob(planV2Dir, artifact)
17908
17964
  }));
17909
- mkdirSync14(dirname13(destinationDir), { recursive: true });
17910
- const tempDir = mkdtempSync6(join36(dirname13(destinationDir), ".plan-v2-materialize-"));
17965
+ mkdirSync14(dirname14(destinationDir), { recursive: true });
17966
+ const tempDir = mkdtempSync6(join37(dirname14(destinationDir), ".plan-v2-materialize-"));
17911
17967
  try {
17912
17968
  for (const { artifact, sourcePath } of verified) {
17913
- const destinationPath = join36(tempDir, ...artifact.path.split("/"));
17914
- mkdirSync14(dirname13(destinationPath), { recursive: true });
17969
+ const destinationPath = join37(tempDir, ...artifact.path.split("/"));
17970
+ mkdirSync14(dirname14(destinationPath), { recursive: true });
17915
17971
  copyFileSync6(sourcePath, destinationPath);
17916
17972
  }
17917
17973
  if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
17918
17974
  writeFileSync10(
17919
- join36(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
17975
+ join37(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
17920
17976
  canonicalJsonStringify({
17921
17977
  manifest,
17922
17978
  target,
@@ -17939,7 +17995,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
17939
17995
  // Join the artifact's OWN name, not the current constant: a plan written
17940
17996
  // before the container change carries the legacy name, and materializing it
17941
17997
  // under the new one would point at a file that was never written.
17942
- audioPath: target.role === "assembler" ? audioArtifact ? join36(destinationDir, audioArtifact.path) : null : null
17998
+ audioPath: target.role === "assembler" ? audioArtifact ? join37(destinationDir, audioArtifact.path) : null : null
17943
17999
  };
17944
18000
  }
17945
18001
  function assertRemoteSources(remoteSources, artifacts) {
@@ -17958,8 +18014,8 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
17958
18014
  return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
17959
18015
  }
17960
18016
  function readValidatedPlanV2Materialization(planDir, expectedTarget) {
17961
- const markerPath = join36(planDir, PLAN_V2_MATERIALIZATION_MARKER);
17962
- if (!existsSync23(markerPath)) return null;
18017
+ const markerPath = join37(planDir, PLAN_V2_MATERIALIZATION_MARKER);
18018
+ if (!existsSync24(markerPath)) return null;
17963
18019
  const marker = readJsonFile(markerPath, "materialization marker");
17964
18020
  if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
17965
18021
  throw new PlanV2IntegrityError("malformed materialization marker");
@@ -17976,8 +18032,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
17976
18032
  assertRemoteSources(remoteSources, required);
17977
18033
  for (const artifact of required) {
17978
18034
  if (Object.hasOwn(remoteSources, artifact.path)) continue;
17979
- const path = join36(planDir, ...artifact.path.split("/"));
17980
- if (!existsSync23(path) || statSync8(path).size !== artifact.sizeBytes) {
18035
+ const path = join37(planDir, ...artifact.path.split("/"));
18036
+ if (!existsSync24(path) || statSync8(path).size !== artifact.sizeBytes) {
17981
18037
  throw new PlanV2IntegrityError(
17982
18038
  `materialized artifact missing or truncated: ${artifact.path}`
17983
18039
  );
@@ -18096,7 +18152,7 @@ function hashChunkOutput(outputPath, kind) {
18096
18152
  if (kind === "file") return sha256Hex(readFileSync10(outputPath));
18097
18153
  const entries = readdirSync10(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
18098
18154
  const lines = entries.map(
18099
- (name) => `${name}\0${sha256Hex(readFileSync10(join37(outputPath, name)))}`
18155
+ (name) => `${name}\0${sha256Hex(readFileSync10(join38(outputPath, name)))}`
18100
18156
  );
18101
18157
  return sha256Hex(lines.join("\0"));
18102
18158
  }
@@ -18113,10 +18169,10 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
18113
18169
  async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18114
18170
  const start = Date.now();
18115
18171
  const log = defaultLogger;
18116
- const planJsonPath = join37(planDir, "plan.json");
18117
- const encoderJsonPath = join37(planDir, "meta", "encoder.json");
18118
- const chunksJsonPath = join37(planDir, "meta", "chunks.json");
18119
- if (!existsSync24(planJsonPath)) {
18172
+ const planJsonPath = join38(planDir, "plan.json");
18173
+ const encoderJsonPath = join38(planDir, "meta", "encoder.json");
18174
+ const chunksJsonPath = join38(planDir, "meta", "chunks.json");
18175
+ if (!existsSync25(planJsonPath)) {
18120
18176
  throw new RenderChunkValidationError(
18121
18177
  MISSING_PLAN_ARTIFACT,
18122
18178
  `[renderChunk] planDir is missing required artifact: ${planJsonPath}`
@@ -18132,7 +18188,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18132
18188
  const v2Manifest = v2Materialization?.manifest ?? null;
18133
18189
  const remoteSources = v2Materialization?.remoteSources ?? {};
18134
18190
  for (const required of [encoderJsonPath, chunksJsonPath]) {
18135
- if (!existsSync24(required)) {
18191
+ if (!existsSync25(required)) {
18136
18192
  throw new RenderChunkValidationError(
18137
18193
  MISSING_PLAN_ARTIFACT,
18138
18194
  `[renderChunk] planDir is missing required artifact: ${required}`
@@ -18141,9 +18197,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18141
18197
  }
18142
18198
  const encoder = JSON.parse(readFileSync10(encoderJsonPath, "utf-8"));
18143
18199
  const chunks = JSON.parse(readFileSync10(chunksJsonPath, "utf-8"));
18144
- const videosJsonPath = join37(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18200
+ const videosJsonPath = join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
18145
18201
  let planVideos = null;
18146
- if (existsSync24(videosJsonPath)) {
18202
+ if (existsSync25(videosJsonPath)) {
18147
18203
  try {
18148
18204
  planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync10(videosJsonPath, "utf-8")));
18149
18205
  } catch (err) {
@@ -18173,8 +18229,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18173
18229
  }
18174
18230
  const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
18175
18231
  const framesInChunk = range.endFrame - range.startFrame;
18176
- const compiledDir = join37(planDir, "compiled");
18177
- if (!existsSync24(compiledDir)) {
18232
+ const compiledDir = join38(planDir, "compiled");
18233
+ if (!existsSync25(compiledDir)) {
18178
18234
  throw new RenderChunkValidationError(
18179
18235
  MISSING_PLAN_ARTIFACT,
18180
18236
  `[renderChunk] planDir missing compiled/ directory: ${compiledDir}`
@@ -18231,7 +18287,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18231
18287
  };
18232
18288
  const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
18233
18289
  mkdirSync15(workDir, { recursive: true });
18234
- const framesDir = join37(workDir, "captured-frames");
18290
+ const framesDir = join38(workDir, "captured-frames");
18235
18291
  mkdirSync15(framesDir, { recursive: true });
18236
18292
  const videoFramesDir = `${workDir}.video-frames`;
18237
18293
  const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
@@ -18256,7 +18312,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18256
18312
  dimensions: plan2.dimensions,
18257
18313
  encoder,
18258
18314
  videoCount: planVideos?.videos.length ?? 0,
18259
- html: readFileSync10(join37(compiledDir, "index.html"), "utf-8"),
18315
+ html: readFileSync10(join38(compiledDir, "index.html"), "utf-8"),
18260
18316
  // The plan ships a deferred source only to chunks that show it; don't wait on the rest.
18261
18317
  skipReadinessVideoIds: deferredVideos.filter(
18262
18318
  (video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
@@ -18424,10 +18480,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
18424
18480
  const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
18425
18481
  const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
18426
18482
  if (isPngSequence) {
18427
- if (!existsSync24(outputChunkPath)) mkdirSync15(outputChunkPath, { recursive: true });
18483
+ if (!existsSync25(outputChunkPath)) mkdirSync15(outputChunkPath, { recursive: true });
18428
18484
  } else {
18429
- const outDir = join37(outputChunkPath, "..");
18430
- if (!existsSync24(outDir)) mkdirSync15(outDir, { recursive: true });
18485
+ const outDir = join38(outputChunkPath, "..");
18486
+ if (!existsSync25(outDir)) mkdirSync15(outDir, { recursive: true });
18431
18487
  }
18432
18488
  const encodeInput = {
18433
18489
  job,
@@ -18700,10 +18756,10 @@ async function renderSpan(projectDir, config, span, outputPath) {
18700
18756
  if (config.cfr === true) {
18701
18757
  throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
18702
18758
  }
18703
- const workDir = mkdtempSync7(join38(tmpdir4(), "hf-render-span-"));
18759
+ const workDir = mkdtempSync7(join39(tmpdir4(), "hf-render-span-"));
18704
18760
  try {
18705
- const planDir = join38(workDir, "plan");
18706
- const partsDir = join38(workDir, "parts");
18761
+ const planDir = join39(workDir, "plan");
18762
+ const partsDir = join39(workDir, "parts");
18707
18763
  mkdirSync16(partsDir, { recursive: true });
18708
18764
  const planned = await plan(
18709
18765
  projectDir,
@@ -18718,7 +18774,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
18718
18774
  planned.totalFrames
18719
18775
  );
18720
18776
  const slices = JSON.parse(
18721
- readFileSync11(join38(planDir, "meta", "chunks.json"), "utf-8")
18777
+ readFileSync11(join39(planDir, "meta", "chunks.json"), "utf-8")
18722
18778
  );
18723
18779
  const parts = [];
18724
18780
  for (const slice of slices) {
@@ -18728,7 +18784,7 @@ async function renderSpan(projectDir, config, span, outputPath) {
18728
18784
  };
18729
18785
  if (range.endFrame <= range.startFrame) continue;
18730
18786
  throwIfAborted(config.abortSignal);
18731
- const part = join38(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
18787
+ const part = join39(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
18732
18788
  await renderChunk(planDir, slice.index, part, { frameRange: range });
18733
18789
  parts.push(part);
18734
18790
  }
@@ -19281,7 +19337,7 @@ function renderRequestFromDistributedConfig(input) {
19281
19337
 
19282
19338
  // ../producer/src/server.ts
19283
19339
  import {
19284
- existsSync as existsSync27,
19340
+ existsSync as existsSync28,
19285
19341
  mkdirSync as mkdirSync17,
19286
19342
  statSync as statSync10,
19287
19343
  mkdtempSync as mkdtempSync8,
@@ -19289,7 +19345,7 @@ import {
19289
19345
  rmSync as rmSync15,
19290
19346
  createReadStream as createReadStream5
19291
19347
  } from "fs";
19292
- import { resolve as resolve10, dirname as dirname15, join as join41 } from "path";
19348
+ import { resolve as resolve10, dirname as dirname16, join as join42 } from "path";
19293
19349
  import { tmpdir as tmpdir5 } from "os";
19294
19350
  import { parseArgs } from "util";
19295
19351
  import crypto from "crypto";
@@ -19299,7 +19355,7 @@ import { serve as serve2 } from "@hono/node-server";
19299
19355
 
19300
19356
  // ../producer/src/services/hyperframeLint.ts
19301
19357
  import {
19302
- existsSync as existsSync25,
19358
+ existsSync as existsSync26,
19303
19359
  readFileSync as readFileSync12,
19304
19360
  statSync as statSync9,
19305
19361
  openSync as openSync6,
@@ -19307,7 +19363,7 @@ import {
19307
19363
  closeSync as closeSync6,
19308
19364
  constants as constants3
19309
19365
  } from "fs";
19310
- import { resolve as resolve9, join as join39, relative as relative7, isAbsolute as isAbsolute4, sep as sep4 } from "path";
19366
+ import { resolve as resolve9, join as join40, relative as relative7, isAbsolute as isAbsolute4, sep as sep4 } from "path";
19311
19367
  function isStringRecord(value) {
19312
19368
  if (!value || typeof value !== "object" || Array.isArray(value)) {
19313
19369
  return false;
@@ -19352,7 +19408,7 @@ function readEntryHtml(filePath) {
19352
19408
  }
19353
19409
  function readProjectEntryFile(projectDir, preferredEntryFile) {
19354
19410
  const absProjectDir = resolve9(projectDir);
19355
- if (!existsSync25(absProjectDir) || !statSync9(absProjectDir).isDirectory()) {
19411
+ if (!existsSync26(absProjectDir) || !statSync9(absProjectDir).isDirectory()) {
19356
19412
  return { error: `Project directory not found: ${absProjectDir}` };
19357
19413
  }
19358
19414
  const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
@@ -19374,7 +19430,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
19374
19430
  }
19375
19431
  }
19376
19432
  return {
19377
- error: `No HTML entry file found in project directory: ${join39(absProjectDir, preferredEntryFile || "index.html")}`
19433
+ error: `No HTML entry file found in project directory: ${join40(absProjectDir, preferredEntryFile || "index.html")}`
19378
19434
  };
19379
19435
  }
19380
19436
  function prepareHyperframeLintBody(body) {
@@ -19420,8 +19476,8 @@ async function runHyperframeLint(prepared) {
19420
19476
  // ../producer/src/services/healthWorker.ts
19421
19477
  import { Worker as Worker2 } from "worker_threads";
19422
19478
  import { fileURLToPath as fileURLToPath6 } from "url";
19423
- import { dirname as dirname14, join as join40 } from "path";
19424
- import { existsSync as existsSync26 } from "fs";
19479
+ import { dirname as dirname15, join as join41 } from "path";
19480
+ import { existsSync as existsSync27 } from "fs";
19425
19481
  var DEFAULT_HEALTH_PORT = 9848;
19426
19482
  async function startHealthWorker(options = {}) {
19427
19483
  const log = options.logger ?? defaultLogger2();
@@ -19495,10 +19551,10 @@ function defaultLogger2() {
19495
19551
  };
19496
19552
  }
19497
19553
  function resolveWorkerEntry2() {
19498
- const here = dirname14(fileURLToPath6(import.meta.url));
19499
- const candidates = [join40(here, "healthWorkerThread.js"), join40(here, "healthWorkerThread.ts")];
19554
+ const here = dirname15(fileURLToPath6(import.meta.url));
19555
+ const candidates = [join41(here, "healthWorkerThread.js"), join41(here, "healthWorkerThread.ts")];
19500
19556
  for (const candidate of candidates) {
19501
- if (existsSync26(candidate)) return candidate;
19557
+ if (existsSync27(candidate)) return candidate;
19502
19558
  }
19503
19559
  return void 0;
19504
19560
  }
@@ -19634,8 +19690,8 @@ function buildRenderJobConfig(input, outputPath, log) {
19634
19690
  function resolvePreparedRenderOutput(prepared, rendersDir, log) {
19635
19691
  const { input, cleanupProjectDir } = prepared;
19636
19692
  const absoluteOutputPath = resolveOutputPath(input.projectDir, input.outputPath, rendersDir, log);
19637
- const outputDir = dirname15(absoluteOutputPath);
19638
- if (!existsSync27(outputDir)) mkdirSync17(outputDir, { recursive: true });
19693
+ const outputDir = dirname16(absoluteOutputPath);
19694
+ if (!existsSync28(outputDir)) mkdirSync17(outputDir, { recursive: true });
19639
19695
  return { input, cleanupProjectDir, absoluteOutputPath };
19640
19696
  }
19641
19697
  function validateRenderOverrides(body) {
@@ -19676,11 +19732,11 @@ function prepareProjectDirectory(projectDir, options) {
19676
19732
  const candidate = nonEmptyString(projectDir);
19677
19733
  if (!candidate) return null;
19678
19734
  const absProjectDir = resolve10(candidate);
19679
- if (!existsSync27(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
19735
+ if (!existsSync28(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
19680
19736
  return { error: `Project directory not found: ${absProjectDir}` };
19681
19737
  }
19682
19738
  const entry = options.entryFile || "index.html";
19683
- if (!existsSync27(resolve10(absProjectDir, entry))) {
19739
+ if (!existsSync28(resolve10(absProjectDir, entry))) {
19684
19740
  return { error: `Entry file "${entry}" not found in project directory: ${absProjectDir}` };
19685
19741
  }
19686
19742
  return { prepared: { input: { projectDir: absProjectDir, ...options } } };
@@ -19701,8 +19757,8 @@ async function resolveInlineRenderHtml(body) {
19701
19757
  }
19702
19758
  function materializeInlineProject(html, options) {
19703
19759
  const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir5();
19704
- const tempProjectDir = mkdtempSync8(join41(tempRoot, "producer-project-"));
19705
- writeFileSync12(join41(tempProjectDir, "index.html"), html, "utf-8");
19760
+ const tempProjectDir = mkdtempSync8(join42(tempRoot, "producer-project-"));
19761
+ writeFileSync12(join42(tempProjectDir, "index.html"), html, "utf-8");
19706
19762
  return {
19707
19763
  prepared: {
19708
19764
  input: { projectDir: tempProjectDir, ...options },
@@ -19772,7 +19828,7 @@ function cleanupTempDir(dir, log) {
19772
19828
  }
19773
19829
  }
19774
19830
  function outputFileSize(path) {
19775
- return existsSync27(path) ? statSync10(path).size : 0;
19831
+ return existsSync28(path) ? statSync10(path).size : 0;
19776
19832
  }
19777
19833
  function createBlockingProgressReporter(log, requestId) {
19778
19834
  let lastLoggedPct = -10;
@@ -20074,7 +20130,7 @@ function createRenderHandlers(options = {}) {
20074
20130
  if (!artifact) {
20075
20131
  return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
20076
20132
  }
20077
- if (!existsSync27(artifact.path)) {
20133
+ if (!existsSync28(artifact.path)) {
20078
20134
  store.delete(token);
20079
20135
  return c.json({ success: false, error: "Output artifact file missing" }, 404);
20080
20136
  }
@@ -20121,7 +20177,7 @@ function startServer(options = {}) {
20121
20177
  });
20122
20178
  async function shutdown(signal) {
20123
20179
  log.info(`Received ${signal}, shutting down`);
20124
- const { drainBrowserPool } = await import("./src-KORQVG7O.js");
20180
+ const { drainBrowserPool } = await import("./src-27JZLSBO.js");
20125
20181
  await drainBrowserPool().catch(() => {
20126
20182
  });
20127
20183
  const handle = await Promise.race([
@@ -20159,12 +20215,12 @@ if (isPublicServerEntry) {
20159
20215
  // ../producer/src/services/distributed/planV2Execution.ts
20160
20216
  import { mkdtempSync as mkdtempSync10, rmSync as rmSync17 } from "fs";
20161
20217
  import { tmpdir as tmpdir6 } from "os";
20162
- import { join as join43 } from "path";
20218
+ import { join as join44 } from "path";
20163
20219
 
20164
20220
  // ../producer/src/services/distributed/assemble.ts
20165
20221
  import {
20166
20222
  cpSync as cpSync3,
20167
- existsSync as existsSync28,
20223
+ existsSync as existsSync29,
20168
20224
  mkdirSync as mkdirSync18,
20169
20225
  mkdtempSync as mkdtempSync9,
20170
20226
  readFileSync as readFileSync13,
@@ -20173,7 +20229,7 @@ import {
20173
20229
  statSync as statSync11,
20174
20230
  writeFileSync as writeFileSync13
20175
20231
  } from "fs";
20176
- import { dirname as dirname16, join as join42 } from "path";
20232
+ import { dirname as dirname17, join as join43 } from "path";
20177
20233
  function cfrRateControlArgs(locked) {
20178
20234
  const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
20179
20235
  if (locked.crf == null && locked.bitrate) {
@@ -20202,8 +20258,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20202
20258
  }
20203
20259
  const format = plan2.dimensions.format;
20204
20260
  const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
20205
- if (!existsSync28(dirname16(outputPath))) {
20206
- mkdirSync18(dirname16(outputPath), { recursive: true });
20261
+ if (!existsSync29(dirname17(outputPath))) {
20262
+ mkdirSync18(dirname17(outputPath), { recursive: true });
20207
20263
  }
20208
20264
  const workDir = mkdtempSync9(`${outputPath}.assemble-work-`);
20209
20265
  const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
@@ -20225,8 +20281,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20225
20281
  };
20226
20282
  try {
20227
20283
  const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
20228
- const finalPath = join42(workDir, `output.${format}`);
20229
- const audio = audioPath !== null && existsSync28(audioPath) ? audioPath : null;
20284
+ const finalPath = join43(workDir, `output.${format}`);
20285
+ const audio = audioPath !== null && existsSync29(audioPath) ? audioPath : null;
20230
20286
  await writeJoined(ctx, videoSources, audio, finalPath);
20231
20287
  renameWithRetry(finalPath, outputPath);
20232
20288
  log.info("[assemble] stage timings", {
@@ -20244,7 +20300,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20244
20300
  });
20245
20301
  }
20246
20302
  }
20247
- const fileSize = existsSync28(outputPath) ? statSync11(outputPath).size : 0;
20303
+ const fileSize = existsSync29(outputPath) ? statSync11(outputPath).size : 0;
20248
20304
  return {
20249
20305
  outputPath,
20250
20306
  durationMs: Date.now() - start,
@@ -20253,15 +20309,15 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
20253
20309
  };
20254
20310
  }
20255
20311
  function readAssemblePlan(planDir, chunkPaths) {
20256
- const planJsonPath = join42(planDir, "plan.json");
20257
- const chunksJsonPath = join42(planDir, "meta", "chunks.json");
20258
- if (!existsSync28(planJsonPath)) {
20312
+ const planJsonPath = join43(planDir, "plan.json");
20313
+ const chunksJsonPath = join43(planDir, "meta", "chunks.json");
20314
+ if (!existsSync29(planJsonPath)) {
20259
20315
  throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
20260
20316
  }
20261
20317
  const plan2 = JSON.parse(readFileSync13(planJsonPath, "utf-8"));
20262
20318
  readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.assembler);
20263
20319
  validatePlanV2MaterializedTarget(planDir, { role: "assembler" });
20264
- if (!existsSync28(chunksJsonPath)) {
20320
+ if (!existsSync29(chunksJsonPath)) {
20265
20321
  throw new Error(`[assemble] planDir missing meta/chunks.json: ${chunksJsonPath}`);
20266
20322
  }
20267
20323
  const chunks = JSON.parse(readFileSync13(chunksJsonPath, "utf-8"));
@@ -20276,7 +20332,7 @@ function readAssemblePlan(planDir, chunkPaths) {
20276
20332
  }
20277
20333
  }
20278
20334
  for (const path of chunkPaths.flat()) {
20279
- if (!existsSync28(path)) {
20335
+ if (!existsSync29(path)) {
20280
20336
  throw new Error(`[assemble] chunk path does not exist: ${path}`);
20281
20337
  }
20282
20338
  }
@@ -20305,7 +20361,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
20305
20361
  return args;
20306
20362
  }
20307
20363
  async function reencodeCfr(ctx, chunkPaths, encoder) {
20308
- const cfrOutputPath = join42(ctx.workDir, `cfr.${ctx.format}`);
20364
+ const cfrOutputPath = join43(ctx.workDir, `cfr.${ctx.format}`);
20309
20365
  const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
20310
20366
  appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
20311
20367
  cfrArgs.push("-y", cfrOutputPath);
@@ -20332,7 +20388,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
20332
20388
  );
20333
20389
  return;
20334
20390
  }
20335
- const paddedAudioPath = join42(ctx.workDir, "audio-padded.m4a");
20391
+ const paddedAudioPath = join43(ctx.workDir, "audio-padded.m4a");
20336
20392
  const padTrimResult = await ctx.timed(
20337
20393
  "audioMs",
20338
20394
  () => padOrTrimAudioToVideoFrameCount({
@@ -20372,7 +20428,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
20372
20428
  }
20373
20429
  }
20374
20430
  function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
20375
- const listPath = join42(workDir, "concat-list.txt");
20431
+ const listPath = join43(workDir, "concat-list.txt");
20376
20432
  const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
20377
20433
  writeFileSync13(listPath, `${body}
20378
20434
  `, "utf-8");
@@ -20410,12 +20466,12 @@ function stitchesSeparateAudio(planDir) {
20410
20466
  return lockedAudio(planDir).separateAudio === true;
20411
20467
  }
20412
20468
  function planFormat(planDir) {
20413
- const plan2 = JSON.parse(readFileSync13(join42(planDir, "plan.json"), "utf-8"));
20469
+ const plan2 = JSON.parse(readFileSync13(join43(planDir, "plan.json"), "utf-8"));
20414
20470
  return plan2.dimensions.format;
20415
20471
  }
20416
20472
  function lockedAudio(planDir) {
20417
- const encoderJsonPath = join42(planDir, "meta", "encoder.json");
20418
- if (!existsSync28(encoderJsonPath)) return {};
20473
+ const encoderJsonPath = join43(planDir, "meta", "encoder.json");
20474
+ if (!existsSync29(encoderJsonPath)) return {};
20419
20475
  return JSON.parse(readFileSync13(encoderJsonPath, "utf-8"));
20420
20476
  }
20421
20477
  function readCfrEncoder(planDir, format) {
@@ -20424,8 +20480,8 @@ function readCfrEncoder(planDir, format) {
20424
20480
  `[assemble] cfr=true is only supported for format="mp4" (got "${format}"). Stream-copy paths for webm and mov already produce exact avg_frame_rate; cfr re-encode is not needed.`
20425
20481
  );
20426
20482
  }
20427
- const encoderJsonPath = join42(planDir, "meta", "encoder.json");
20428
- if (!existsSync28(encoderJsonPath)) {
20483
+ const encoderJsonPath = join43(planDir, "meta", "encoder.json");
20484
+ if (!existsSync29(encoderJsonPath)) {
20429
20485
  throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
20430
20486
  }
20431
20487
  const encoderJson = JSON.parse(readFileSync13(encoderJsonPath, "utf-8"));
@@ -20437,7 +20493,7 @@ function readCfrEncoder(planDir, format) {
20437
20493
  return encoderJson;
20438
20494
  }
20439
20495
  function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
20440
- if (existsSync28(outputPath)) rmSync16(outputPath, { recursive: true, force: true });
20496
+ if (existsSync29(outputPath)) rmSync16(outputPath, { recursive: true, force: true });
20441
20497
  mkdirSync18(outputPath, { recursive: true });
20442
20498
  let globalIdx = 0;
20443
20499
  for (const chunkDir of chunkPaths) {
@@ -20451,8 +20507,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
20451
20507
  throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
20452
20508
  }
20453
20509
  for (const frame of frames) {
20454
- const dst = join42(outputPath, formatExportFrameName(globalIdx, "png"));
20455
- cpSync3(join42(chunkDir, frame), dst);
20510
+ const dst = join43(outputPath, formatExportFrameName(globalIdx, "png"));
20511
+ cpSync3(join43(chunkDir, frame), dst);
20456
20512
  globalIdx += 1;
20457
20513
  }
20458
20514
  }
@@ -20461,14 +20517,14 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
20461
20517
  `[assemble] png-sequence frame count mismatch: merged ${globalIdx} frames vs plan.totalFrames=${totalFrames}. Using on-disk count.`
20462
20518
  );
20463
20519
  }
20464
- if (audioPath !== null && existsSync28(audioPath)) {
20465
- const sidecar = join42(outputPath, MIXED_AUDIO_FILENAME);
20520
+ if (audioPath !== null && existsSync29(audioPath)) {
20521
+ const sidecar = join43(outputPath, MIXED_AUDIO_FILENAME);
20466
20522
  cpSync3(audioPath, sidecar);
20467
20523
  }
20468
20524
  let fileSize = 0;
20469
20525
  for (const name of readdirSync11(outputPath)) {
20470
20526
  try {
20471
- fileSize += statSync11(join42(outputPath, name)).size;
20527
+ fileSize += statSync11(join43(outputPath, name)).size;
20472
20528
  } catch {
20473
20529
  }
20474
20530
  }
@@ -20482,8 +20538,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
20482
20538
 
20483
20539
  // ../producer/src/services/distributed/planV2Execution.ts
20484
20540
  async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
20485
- const workRoot = mkdtempSync10(join43(tmpdir6(), "hf-plan-v2-chunk-"));
20486
- const materializedPlanDir = join43(workRoot, "plan");
20541
+ const workRoot = mkdtempSync10(join44(tmpdir6(), "hf-plan-v2-chunk-"));
20542
+ const materializedPlanDir = join44(workRoot, "plan");
20487
20543
  try {
20488
20544
  materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
20489
20545
  return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
@@ -20492,8 +20548,8 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
20492
20548
  }
20493
20549
  }
20494
20550
  async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
20495
- const workRoot = mkdtempSync10(join43(tmpdir6(), "hf-plan-v2-assembler-"));
20496
- const materializedPlanDir = join43(workRoot, "plan");
20551
+ const workRoot = mkdtempSync10(join44(tmpdir6(), "hf-plan-v2-assembler-"));
20552
+ const materializedPlanDir = join44(workRoot, "plan");
20497
20553
  try {
20498
20554
  const materialized = materializePlanV2Target(
20499
20555
  planV2Dir,
@@ -20515,7 +20571,7 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
20515
20571
  // ../producer/src/services/distributed/projectHash.ts
20516
20572
  import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync12, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync12 } from "fs";
20517
20573
  import { createHash as createHash8 } from "crypto";
20518
- import { join as join44 } from "path";
20574
+ import { join as join45 } from "path";
20519
20575
  var READ_CHUNK_BYTES = 256 * 1024;
20520
20576
 
20521
20577
  // ../producer/src/services/distributed/audioSidecar.ts