hyperframes 0.8.227 → 0.8.229
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.
- package/dist/{add-XX23UL2L.js → add-YJS4LRAZ.js} +11 -11
- package/dist/{agentPromptGenerator-IMNWTMHM.js → agentPromptGenerator-UZ3FX4D3.js} +5 -5
- package/dist/{animatedGifPrep-MPU6T26Y.js → animatedGifPrep-2XRRZPQO.js} +5 -5
- package/dist/api.js +23 -23
- package/dist/{asset-FZSKOSMO.js → asset-WSOL4NMK.js} +2 -2
- package/dist/{assetCataloger-SITUNOV5.js → assetCataloger-OZZ5MJBG.js} +6 -6
- package/dist/{audio-T5RHG57J.js → audio-LANYADHD.js} +14 -14
- package/dist/{auth-CMGIWJ6S.js → auth-YYGXDZF2.js} +4 -4
- package/dist/{autoUpdate-NNHBVLHN.js → autoUpdate-KSRU7EZH.js} +2 -2
- package/dist/{backgroundChecks-HQYOBCV2.js → backgroundChecks-TB7CC2D6.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-5URYGOLM.js → batchRender-XZYDF2FG.js} +3 -3
- package/dist/{beats-J7IBNLP4.js → beats-IDTXCXIG.js} +7 -7
- package/dist/{benchmark-Q2BILDRB.js → benchmark-IPKHN37F.js} +8 -8
- package/dist/{billing-WNOAP6KO.js → billing-FFWAEIQ6.js} +3 -3
- package/dist/{browser-EERGHDRV.js → browser-OVOXZLNV.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-FKU44QSO.js → bundleWithLocalizedFonts-I7PYCJHZ.js} +2 -2
- package/dist/{capture-IRJ7DO45.js → capture-CONXFELZ.js} +10 -10
- package/dist/{capture-5W7BR36Q.js → capture-VS5ZCDVK.js} +3 -3
- package/dist/{captureCompositionFrame-R4LFCHHV.js → captureCompositionFrame-CXMJFFT6.js} +10 -10
- package/dist/{catalog-IRFBKRFP.js → catalog-GRKDVE2L.js} +11 -11
- package/dist/{catch-up-RGQAFA3E.js → catch-up-EEQHBX7W.js} +4 -4
- package/dist/{check-EXLZVGDY.js → check-KN2TFSLV.js} +35 -35
- package/dist/{checkAudio-K3XKXNEN.js → checkAudio-TL5G6H6R.js} +8 -8
- package/dist/{checkBrowser-ZOU5XFMN.js → checkBrowser-VSOGYBDG.js} +29 -29
- package/dist/{chunk-6RSOEYIG.js → chunk-2KQE627O.js} +7 -7
- package/dist/{chunk-BKK57WEL.js → chunk-2TL6R2B5.js} +4 -4
- package/dist/{chunk-E2GNVQSH.js → chunk-2WZSWSVB.js} +1 -1
- package/dist/{chunk-UIDZKSF6.js → chunk-3MJIP7L3.js} +1 -1
- package/dist/{chunk-3TWAMQF6.js → chunk-3OGN5ESJ.js} +2 -2
- package/dist/{chunk-WISN2ACZ.js → chunk-3ZKTX4RA.js} +1 -1
- package/dist/{chunk-TJPZYMYX.js → chunk-44H3ZPQ2.js} +3 -3
- package/dist/{chunk-GIGZYW5Q.js → chunk-4QRJNEY2.js} +1 -1
- package/dist/{chunk-5ETFQB5F.js → chunk-5657GBGJ.js} +43 -19
- package/dist/{chunk-62LATJB6.js → chunk-5J6IHFXE.js} +1 -1
- package/dist/{chunk-TMTZ5M4R.js → chunk-65CJV3HG.js} +9 -9
- package/dist/{chunk-TJ6G325N.js → chunk-6IPIEPGY.js} +1 -1
- package/dist/{chunk-ZSZKNGSQ.js → chunk-6UOTC4U7.js} +3 -3
- package/dist/{chunk-27JEDDX5.js → chunk-7T2OIXVQ.js} +1 -1
- package/dist/{chunk-IQFLDX7I.js → chunk-AJAK6K6Z.js} +4 -4
- package/dist/{chunk-A3UIADPB.js → chunk-ALLYZDHR.js} +1 -1
- package/dist/{chunk-AI6Z7BVD.js → chunk-AUKCANZ5.js} +1 -1
- package/dist/{chunk-OG3S6SE6.js → chunk-AX34M43B.js} +1 -1
- package/dist/{chunk-ZAE5Q7D5.js → chunk-BS23JBCT.js} +2 -2
- package/dist/{chunk-IUQCPWHU.js → chunk-BYU5BWLS.js} +9 -9
- package/dist/{chunk-VO55NLTM.js → chunk-C4YBIKYO.js} +1 -1
- package/dist/{chunk-PXH3TD4X.js → chunk-C54QOVBO.js} +4 -4
- package/dist/{chunk-RVKHNBJI.js → chunk-DBCQ45W4.js} +17 -17
- package/dist/{chunk-6TXW6LHH.js → chunk-DCLGVVR7.js} +3 -2
- package/dist/{chunk-2M6LMJ32.js → chunk-E7CVWOG6.js} +1 -1
- package/dist/{chunk-Q7S4JN73.js → chunk-EDUWHB7E.js} +5 -5
- package/dist/{chunk-T53C5UTH.js → chunk-EWUQH2H2.js} +1 -1
- package/dist/{chunk-OWJTWCE6.js → chunk-FHBWBQMS.js} +2 -2
- package/dist/{chunk-OJW6TC57.js → chunk-FSTBQD2F.js} +1 -1
- package/dist/{chunk-53ZOVLGJ.js → chunk-FZM6E4S4.js} +1 -1
- package/dist/{chunk-YKOHWGUC.js → chunk-GB4ZE5GE.js} +1 -1
- package/dist/{chunk-HNB7DA2F.js → chunk-GGH5MQHG.js} +1 -1
- package/dist/{chunk-KLTD64CP.js → chunk-GHPR346W.js} +1 -1
- package/dist/{chunk-V4SD6HQ6.js → chunk-GOPJLAMZ.js} +21 -19
- package/dist/{chunk-CQKK7S4I.js → chunk-IXDFHVYK.js} +7 -7
- package/dist/{chunk-XZULISH5.js → chunk-J5D43JAY.js} +2 -2
- package/dist/{chunk-VHREBR3T.js → chunk-KANCJWEU.js} +1 -1
- package/dist/{chunk-AQ2C6AQH.js → chunk-KQO3UIAP.js} +1 -1
- package/dist/{chunk-FFCQR7AP.js → chunk-KZPMI6BZ.js} +2 -2
- package/dist/{chunk-PVLG6IY4.js → chunk-LCRVATH2.js} +4 -4
- package/dist/{chunk-6HPCEV3U.js → chunk-LDAKZ65G.js} +2 -2
- package/dist/{chunk-TFJSU4IV.js → chunk-M5NZ7GKA.js} +2 -2
- package/dist/{chunk-ISEHEDSN.js → chunk-MIJSNZCK.js} +2 -2
- package/dist/{chunk-MR7I3L6N.js → chunk-MKCTDPSJ.js} +1 -1
- package/dist/{chunk-TNPFF5TQ.js → chunk-MMHM3KKV.js} +2 -2
- package/dist/{chunk-M63U54H7.js → chunk-MOZ5DSCP.js} +2 -2
- package/dist/{chunk-V7BBBD5C.js → chunk-MS3HCZGU.js} +2 -2
- package/dist/chunk-NWU7H447.js +5030 -0
- package/dist/{chunk-OVLO32XC.js → chunk-O7M3IGR4.js} +2 -2
- package/dist/{chunk-VUDMPRZN.js → chunk-OHWVSTNO.js} +2 -2
- package/dist/{chunk-65LMGFJ5.js → chunk-OLUL6BOC.js} +12 -12
- package/dist/{chunk-RABQDJMA.js → chunk-OYR33QMF.js} +1 -1
- package/dist/{chunk-SPN4SJV7.js → chunk-PVZRUN64.js} +1 -1
- package/dist/{chunk-3ZWUNOTS.js → chunk-QEQEKBL7.js} +1 -1
- package/dist/{chunk-JP6C673M.js → chunk-QMHENMOT.js} +1 -1
- package/dist/{chunk-KU6VRNJF.js → chunk-QTV666C6.js} +1 -1
- package/dist/{chunk-IN2355UQ.js → chunk-RQD2CQDC.js} +1 -1
- package/dist/{chunk-FD7Z5BDR.js → chunk-RSE7JAWA.js} +2 -2
- package/dist/{chunk-L2XYH5SQ.js → chunk-RSFLI6E6.js} +1 -1
- package/dist/{chunk-RG7WG2BC.js → chunk-SCVDE65J.js} +1 -1
- package/dist/{chunk-IZRC24DI.js → chunk-SJAAY2FB.js} +1 -1
- package/dist/{chunk-AJREH4PX.js → chunk-SWBOZCM7.js} +2 -2
- package/dist/{chunk-SQJNSPL5.js → chunk-T4C5HPYH.js} +1 -1
- package/dist/{chunk-PSRFHITV.js → chunk-TYJQUMPE.js} +13 -13
- package/dist/{chunk-TG5RBLCM.js → chunk-TZOQFBBQ.js} +2 -2
- package/dist/{chunk-K7LS42XC.js → chunk-UOJSQZBR.js} +3 -3
- package/dist/{chunk-HGEFDPRP.js → chunk-URICPFYV.js} +1 -1
- package/dist/{chunk-NFUJ35XX.js → chunk-UWM22NR5.js} +1 -1
- package/dist/{chunk-K6YHKCVX.js → chunk-UWS3BKTB.js} +1 -1
- package/dist/{chunk-ZU5GYVRG.js → chunk-UZOIYEQT.js} +2 -2
- package/dist/{chunk-7XNMKKXI.js → chunk-V76CLMWJ.js} +2 -2
- package/dist/{chunk-SANQC4QD.js → chunk-VPCKLVUT.js} +1 -1
- package/dist/{chunk-SZVMN7L3.js → chunk-WIK27NBN.js} +7 -7
- package/dist/{chunk-BW3CQT3A.js → chunk-WMLUEEKU.js} +3 -3
- package/dist/{chunk-YTMWGLEQ.js → chunk-WP64W5LK.js} +1 -1
- package/dist/{chunk-QSWUM7WR.js → chunk-WTUIK6Y4.js} +1 -1
- package/dist/{chunk-6PQXDPKV.js → chunk-X6JPD24H.js} +2 -2
- package/dist/{chunk-PFGBFTNS.js → chunk-XVK7Z5LC.js} +1 -1
- package/dist/{chunk-MBS45ZKL.js → chunk-YKB7R3ED.js} +348 -292
- package/dist/{chunk-AXRFHQRS.js → chunk-YQVFMOMM.js} +1 -1
- package/dist/{chunk-NQ4MVBNC.js → chunk-YZTGIVCU.js} +8 -8
- package/dist/{chunk-XOFJZ3UG.js → chunk-ZDQEVQHB.js} +1 -1
- package/dist/{clean-IXG2MEQ6.js → clean-EBLROVPZ.js} +15 -15
- package/dist/cli.js +57 -57
- package/dist/{cloud-C2SUZ4ML.js → cloud-VHV4JR6S.js} +4 -4
- package/dist/{cloudrun-SWS7AI67.js → cloudrun-WH47ZBWZ.js} +4 -4
- package/dist/{compare-HKONJNY4.js → compare-ADKP4OZQ.js} +26 -26
- package/dist/{compiler-67X7VCNS.js → compiler-JT3NQV6V.js} +2 -2
- package/dist/{component-YBGAFPNS.js → component-4DZS7LRH.js} +3 -3
- package/dist/{compositions-B5T65NKW.js → compositions-U6AILJYT.js} +9 -9
- package/dist/{curve-QZCRRLBS.js → curve-UJYH6TCN.js} +9 -9
- package/dist/{cuts-5DIKHPDZ.js → cuts-4AMR7G23.js} +10 -10
- package/dist/{delete-GHNNYUXL.js → delete-2WACGCZO.js} +5 -5
- package/dist/{deploy-IARSTZY6.js → deploy-6D752FSZ.js} +1 -1
- package/dist/{describeProject-6DA3FMM2.js → describeProject-KRSRBDRI.js} +6 -6
- package/dist/{diff-JWNEN6CO.js → diff-NDK55Z7J.js} +22 -22
- package/dist/{dist-AY2X5DPM.js → dist-3LBVDOZK.js} +2 -2
- package/dist/{doctor-BMUGN4C2.js → doctor-6YKL5FHE.js} +9 -9
- package/dist/{energy-DSK2FPBK.js → energy-ZEGRDGJK.js} +10 -10
- package/dist/{events-6VLVSDSN.js → events-LFLG2NA4.js} +3 -3
- package/dist/{events-KKH2U7U5.js → events-LFUAHTKC.js} +12 -12
- package/dist/{events-HD5CYSPO.js → events-WCD2Z2HV.js} +2 -2
- package/dist/{extract-IFMYI2DA.js → extract-3MIHGXDX.js} +10 -10
- package/dist/{face-JD2ZVOH3.js → face-JWRUZSZT.js} +10 -10
- package/dist/{feedback-LI55MDGG.js → feedback-7GKEQSNR.js} +10 -10
- package/dist/{ffmpeg-A4M2I6R3.js → ffmpeg-3XMQNQFR.js} +5 -5
- package/dist/{figma-CNVJZ7BL.js → figma-QQPOSC6N.js} +3 -3
- package/dist/fontLocalizeCli.js +8 -8
- package/dist/{frames-MOAPFEBS.js → frames-JUGYOXXB.js} +11 -11
- package/dist/{generate-ZRQYOJ3I.js → generate-U5GGGI7G.js} +15 -15
- package/dist/{get-2RNNB5KC.js → get-KQRDF6LW.js} +5 -5
- package/dist/{gpuPolicy-MXPGQGRO.js → gpuPolicy-DYOKYL7P.js} +5 -5
- package/dist/{grade-compare-CQHZR7LX.js → grade-compare-EVFXFOYV.js} +27 -27
- package/dist/{heifImagePrep-PRXKTL2U.js → heifImagePrep-H677DLTO.js} +6 -6
- package/dist/{help-MDT2MEPS.js → help-XUSQUMOX.js} +1 -1
- package/dist/{history-N7H2FN6R.js → history-LLJEG3KB.js} +6 -6
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +61 -61
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-NXYRDRHE.js → info-TM2S6RVA.js} +7 -7
- package/dist/{init-DJ5EJAQI.js → init-ABJ7VDQV.js} +25 -25
- package/dist/{ink-WZSITVIW.js → ink-TFN2A4RE.js} +10 -10
- package/dist/{inspect-JAXBBYA3.js → inspect-OIXXKBEP.js} +27 -27
- package/dist/{installer-N5OHXI5C.js → installer-XCAV3J6A.js} +4 -4
- package/dist/{keyframes-TXNYBMOV.js → keyframes-GDYO4HII.js} +6 -6
- package/dist/{lambda-4LVII6VK.js → lambda-SGAG3ET2.js} +9 -9
- package/dist/{layout-AS4FJ53O.js → layout-IDN2INXZ.js} +27 -27
- package/dist/{lint-DCAYD4CN.js → lint-VXDG3OVR.js} +6 -6
- package/dist/{list-7Z6YRO6I.js → list-V5ZA6YH3.js} +5 -5
- package/dist/{localPage-FUOBAMSA.js → localPage-WTACQ4HH.js} +5 -5
- package/dist/{login-JZ4COLEB.js → login-ZHZBLYD6.js} +20 -8
- package/dist/{logout-6CEIH4HW.js → logout-B6H5F5YP.js} +2 -2
- package/dist/{look-QELVFTKU.js → look-43IS7IVT.js} +10 -10
- package/dist/{manager-ZJPSMHK6.js → manager-BT5X67BV.js} +6 -6
- package/dist/{measure-2I5VAVHN.js → measure-OYIH5M4K.js} +11 -11
- package/dist/{media-treatment-MDTQ6564.js → media-treatment-U6QA2YV2.js} +11 -11
- package/dist/{media-use-NFGRWEGA.js → media-use-Q25W5P26.js} +2 -2
- package/dist/{models-DKSUFPQ6.js → models-QSUPPDL2.js} +9 -9
- package/dist/{motionShot-BJARRLMN.js → motionShot-PDSNKYAY.js} +13 -13
- package/dist/{normalize-audio-EW5JUESE.js → normalize-audio-HIPTTGNT.js} +8 -8
- package/dist/{open-737GUSFD.js → open-7VKL24QP.js} +11 -11
- package/dist/{parakeetRunner-OIVHACYW.js → parakeetRunner-RHK7LU3T.js} +10 -10
- package/dist/{pipeline-UTNPWFMF.js → pipeline-AMQUBBUD.js} +8 -8
- package/dist/{play-ZCYUVL2Y.js → play-DLP7TMRY.js} +18 -18
- package/dist/{preflight-HWFWGTIG.js → preflight-R5WNJ5KC.js} +6 -6
- package/dist/{present-AO3XZKSL.js → present-PPIXSHJO.js} +14 -14
- package/dist/{preview-ORIRMNIU.js → preview-RS25TO6I.js} +16 -16
- package/dist/{probe-HYO2KC2E.js → probe-LSVMXNWS.js} +9 -9
- package/dist/{producer-B4VCP4D2.js → producer-CNJP7NWH.js} +1 -1
- package/dist/{projectConfig-HUR4LZME.js → projectConfig-AXBTPJSK.js} +6 -6
- package/dist/{publication-YH74GUD4.js → publication-CZY3OVDJ.js} +2 -2
- package/dist/{publish-WIEB5ON4.js → publish-DV3JALTW.js} +12 -12
- package/dist/{refresh-MQTO43RB.js → refresh-T6JLFCS4.js} +2 -2
- package/dist/{remove-background-NHLEPVOM.js → remove-background-XBBLE6ZN.js} +9 -9
- package/dist/{render-GBJSUM3R.js → render-4NTEIX6C.js} +5 -5
- package/dist/{render-DQSNIKEG.js → render-CH265MNE.js} +19 -19
- package/dist/{render-3WFVN7HO.js → render-GNBMXGA4.js} +45 -31
- package/dist/{render-batch-YZF2XMYL.js → render-batch-STMZ5ZGQ.js} +5 -5
- package/dist/{resolver-KGTY7RJU.js → resolver-YWKOIBSQ.js} +4 -4
- package/dist/{run-OJ2GBYKB.js → run-A46NUKCV.js} +3 -3
- package/dist/{sherpa-B3T3I2PX.js → sherpa-KFLH5Z7E.js} +9 -9
- package/dist/{skills-FATGE2YZ.js → skills-2OSBIIXY.js} +5 -5
- package/dist/{skillsUpdateCheck-AHDI2POI.js → skillsUpdateCheck-GBISX7YN.js} +3 -3
- package/dist/{snapshot-SELBWDZ7.js → snapshot-SSS7UVPI.js} +31 -31
- package/dist/{src-6H4ENHBH.js → src-27JZLSBO.js} +6 -4
- package/dist/{src-55VXHZM5.js → src-XCS2N6EG.js} +7 -7
- package/dist/{staticProjectServer-E4BZ4YZO.js → staticProjectServer-ASRDNNFG.js} +16 -16
- package/dist/{status-6WAZ5EBM.js → status-Z5BPMROD.js} +4 -4
- package/dist/studio/assets/{hyperframes-player-merzSkao.js → hyperframes-player-CtwXT8nW.js} +1 -1
- package/dist/studio/assets/{index-B4XEg_n-.js → index-CNO8BPjF.js} +1 -1
- package/dist/studio/assets/{index-DoXOJGW5.js → index-CrRO-B3w.js} +112 -112
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-IERYGFXT.js → studio-api-YKUVSV4J.js} +8 -8
- package/dist/{studioServer-3RCCQB3T.js → studioServer-QUBL75RC.js} +45 -45
- package/dist/{sync-VV7L5GRE.js → sync-ILC4CCNG.js} +10 -10
- package/dist/{telemetry-KZRSFUC6.js → telemetry-TJI5LGLQ.js} +3 -3
- package/dist/{timeline-ALU6E3WE.js → timeline-X2HQ6SWI.js} +16 -16
- package/dist/{tokens-XEZF2LGB.js → tokens-7MKCWG3Y.js} +2 -2
- package/dist/{transcribe-HJX65J5D.js → transcribe-ABCSYFPP.js} +8 -8
- package/dist/{transcribe-OVOOUYK7.js → transcribe-QCEDFMMB.js} +19 -19
- package/dist/{updateCheck-FEOJQNLJ.js → updateCheck-ZCRXVYWB.js} +2 -2
- package/dist/{upgrade-VM2DGLXZ.js → upgrade-HQ4XGPMT.js} +2 -2
- package/dist/{urlDownloader-YENOMQQF.js → urlDownloader-ONLQCQ7O.js} +4 -4
- package/dist/{validate-HXTL5C7J.js → validate-PTSOIX2X.js} +21 -21
- package/dist/{video-3BIRQK2N.js → video-O2LMQZWJ.js} +6 -6
- package/dist/warmCheck.js +35 -35
- package/package.json +1 -1
- package/dist/chunk-SBQV5FLG.js +0 -5030
|
@@ -8,12 +8,12 @@ import {
|
|
|
8
8
|
Semaphore,
|
|
9
9
|
prepareHeifImageInputs,
|
|
10
10
|
withMediaProbeSlot
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LDAKZ65G.js";
|
|
12
12
|
import {
|
|
13
13
|
EncoderInterruptedError,
|
|
14
14
|
encoderFailureError,
|
|
15
15
|
prepareAnimatedGifInputs
|
|
16
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
|
9732
|
-
import { join as
|
|
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 (!
|
|
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(
|
|
9847
|
+
total += sampleDirectoryBytes(join20(workDir, attempt));
|
|
9792
9848
|
continue;
|
|
9793
9849
|
}
|
|
9794
9850
|
if (!/^capture-attempt-\d+$/.test(attempt)) continue;
|
|
9795
|
-
const attemptDir =
|
|
9851
|
+
const attemptDir = join20(workDir, attempt);
|
|
9796
9852
|
for (const name of readdirSync3(attemptDir)) {
|
|
9797
|
-
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(
|
|
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
|
|
10092
|
-
import { join as
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
10368
|
+
import { dirname as dirname8, join as join22 } from "path";
|
|
10313
10369
|
import { createRequire } from "module";
|
|
10314
|
-
import { existsSync as
|
|
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 =
|
|
10326
|
-
const jsPath =
|
|
10327
|
-
if (
|
|
10328
|
-
const tsPath =
|
|
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
|
-
|
|
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 ?
|
|
10888
|
-
if (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
|
|
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
|
|
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 =
|
|
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 =
|
|
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 (!
|
|
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 =
|
|
11334
|
-
copyFileSync2(
|
|
11389
|
+
const dst = join25(outputPath, formatExportFrameName(i, "png"));
|
|
11390
|
+
copyFileSync2(join25(framesDir, name), dst);
|
|
11335
11391
|
});
|
|
11336
|
-
if (hasAudio && audioOutputPath &&
|
|
11337
|
-
copyFileSync2(audioOutputPath,
|
|
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:
|
|
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 =
|
|
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 =
|
|
11716
|
-
const missing = !
|
|
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) =>
|
|
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
|
|
11793
|
-
return
|
|
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 =
|
|
11841
|
-
if (
|
|
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 =
|
|
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(
|
|
12497
|
-
return
|
|
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 =
|
|
12504
|
-
if (!
|
|
12505
|
-
const workDir = job.config.debug ?
|
|
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 ?
|
|
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 =
|
|
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 (!
|
|
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 =
|
|
12675
|
-
if (!
|
|
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 =
|
|
12682
|
-
const projectIndexPath =
|
|
12683
|
-
if (!
|
|
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:
|
|
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 =
|
|
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:
|
|
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 =
|
|
13022
|
-
if (!
|
|
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 =
|
|
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(
|
|
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 =
|
|
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 &&
|
|
14426
|
-
const debugOutput =
|
|
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
|
|
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
|
|
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(
|
|
14958
|
+
mkdirSync9(dirname11(outputPath), { recursive: true });
|
|
14903
14959
|
const workDir = mkdtempSync4(`${outputPath}.stitch-`);
|
|
14904
|
-
const out = createWriteStream(
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
14986
|
+
import { join as join30 } from "path";
|
|
14931
14987
|
|
|
14932
14988
|
// ../producer/src/services/distributed/chunkFrames.ts
|
|
14933
|
-
import { existsSync as
|
|
14934
|
-
import { extname as extname4, join as
|
|
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
|
|
14939
|
-
import { existsSync as
|
|
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 =
|
|
14951
|
-
if (
|
|
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 =
|
|
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 =
|
|
15212
|
-
if (
|
|
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 =
|
|
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 =
|
|
15266
|
-
if (!
|
|
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,
|
|
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 =
|
|
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 ??
|
|
15382
|
-
if (remoteUrl === void 0 && !
|
|
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:
|
|
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 =
|
|
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
|
-
|
|
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
|
|
15544
|
-
import { join as
|
|
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 (!
|
|
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 =
|
|
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(
|
|
15859
|
+
writeFileSync6(join31(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
|
|
15804
15860
|
}
|
|
15805
15861
|
function readPlanRemoteFiles(planDir) {
|
|
15806
|
-
const path =
|
|
15807
|
-
return
|
|
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 =
|
|
15811
|
-
const encoderJsonPath =
|
|
15812
|
-
if (!
|
|
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 (!
|
|
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 (!
|
|
15901
|
+
if (!existsSync20(planDir)) {
|
|
15846
15902
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
15847
15903
|
}
|
|
15848
|
-
const metaDir =
|
|
15849
|
-
if (!
|
|
15904
|
+
const metaDir = join31(planDir, "meta");
|
|
15905
|
+
if (!existsSync20(metaDir)) mkdirSync10(metaDir, { recursive: true });
|
|
15850
15906
|
writeFileSync6(
|
|
15851
|
-
|
|
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(
|
|
15859
|
-
writeFileSync6(
|
|
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 =
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
16026
|
-
writeFileSync7(
|
|
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 =
|
|
16030
|
-
if (!
|
|
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(
|
|
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(
|
|
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
|
|
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 =
|
|
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
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
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(
|
|
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 :
|
|
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 && (
|
|
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 =
|
|
16598
|
-
mkdirSync12(
|
|
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 (!
|
|
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 =
|
|
16648
|
-
if (!
|
|
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 =
|
|
16707
|
+
const workDir = join34(planDir, ".plan-work");
|
|
16652
16708
|
rmSync10(workDir, { recursive: true, force: true });
|
|
16653
16709
|
mkdirSync12(workDir, { recursive: true });
|
|
16654
|
-
const compiledDir =
|
|
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 =
|
|
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) =>
|
|
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-
|
|
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 =
|
|
16858
|
-
const videoFramesDst =
|
|
16859
|
-
if (
|
|
16860
|
-
const videoSourcesDir =
|
|
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 (
|
|
16918
|
+
if (existsSync22(stagedVideoFrames)) {
|
|
16863
16919
|
renameWithRetry(stagedVideoFrames, videoFramesDst);
|
|
16864
16920
|
} else {
|
|
16865
16921
|
mkdirSync12(videoFramesDst, { recursive: true });
|
|
16866
16922
|
}
|
|
16867
|
-
if (
|
|
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(
|
|
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
|
-
|
|
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 =
|
|
16987
|
-
if (audioResult?.hasAudio &&
|
|
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 &&
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
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(
|
|
17202
|
-
this.temporaryDir = mkdtempSync5(
|
|
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 (
|
|
17214
|
-
mkdirSync13(
|
|
17215
|
-
const stagingDir = mkdtempSync5(
|
|
17216
|
-
const temporaryPath =
|
|
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 (!
|
|
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(
|
|
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 =
|
|
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 =
|
|
17310
|
-
if (!
|
|
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 =
|
|
17369
|
+
const videoDir = join37(videoRoot, videoEntry.name);
|
|
17314
17370
|
if (readdirSync9(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
|
|
17315
|
-
const sentinelPath =
|
|
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,
|
|
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(
|
|
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,
|
|
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 =
|
|
17411
|
-
if (!
|
|
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 =
|
|
17445
|
-
const hasExtractedFrames =
|
|
17446
|
-
const videosPath =
|
|
17447
|
-
if (!
|
|
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 =
|
|
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 (
|
|
17505
|
-
mkdirSync14(
|
|
17506
|
-
const temporaryDir = mkdtempSync6(
|
|
17507
|
-
const temporaryPath =
|
|
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 =
|
|
17544
|
-
if (!
|
|
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(
|
|
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 (
|
|
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(
|
|
17632
|
-
const tempDir = mkdtempSync6(
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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 (
|
|
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:
|
|
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:
|
|
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 =
|
|
17865
|
-
if (!
|
|
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 (!
|
|
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 (
|
|
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(
|
|
17910
|
-
const tempDir = mkdtempSync6(
|
|
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 =
|
|
17914
|
-
mkdirSync14(
|
|
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
|
-
|
|
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 ?
|
|
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 =
|
|
17962
|
-
if (!
|
|
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 =
|
|
17980
|
-
if (!
|
|
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(
|
|
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 =
|
|
18117
|
-
const encoderJsonPath =
|
|
18118
|
-
const chunksJsonPath =
|
|
18119
|
-
if (!
|
|
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 (!
|
|
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 =
|
|
18200
|
+
const videosJsonPath = join38(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
18145
18201
|
let planVideos = null;
|
|
18146
|
-
if (
|
|
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 =
|
|
18177
|
-
if (!
|
|
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 =
|
|
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(
|
|
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 (!
|
|
18483
|
+
if (!existsSync25(outputChunkPath)) mkdirSync15(outputChunkPath, { recursive: true });
|
|
18428
18484
|
} else {
|
|
18429
|
-
const outDir =
|
|
18430
|
-
if (!
|
|
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(
|
|
18759
|
+
const workDir = mkdtempSync7(join39(tmpdir4(), "hf-render-span-"));
|
|
18704
18760
|
try {
|
|
18705
|
-
const planDir =
|
|
18706
|
-
const partsDir =
|
|
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(
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 (!
|
|
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: ${
|
|
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
|
|
19424
|
-
import { existsSync as
|
|
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 =
|
|
19499
|
-
const candidates = [
|
|
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 (
|
|
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 =
|
|
19638
|
-
if (!
|
|
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 (!
|
|
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 (!
|
|
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(
|
|
19705
|
-
writeFileSync12(
|
|
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
|
|
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 (!
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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 (!
|
|
20206
|
-
mkdirSync18(
|
|
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 =
|
|
20229
|
-
const audio = 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 =
|
|
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 =
|
|
20257
|
-
const chunksJsonPath =
|
|
20258
|
-
if (!
|
|
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 (!
|
|
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 (!
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
|
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 =
|
|
20418
|
-
if (!
|
|
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 =
|
|
20428
|
-
if (!
|
|
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 (
|
|
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 =
|
|
20455
|
-
cpSync3(
|
|
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 &&
|
|
20465
|
-
const sidecar =
|
|
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(
|
|
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(
|
|
20486
|
-
const materializedPlanDir =
|
|
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(
|
|
20496
|
-
const materializedPlanDir =
|
|
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
|
|
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
|