hyperframes 0.8.147 → 0.8.149
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-5CNUY3EW.js → add-MG53577L.js} +18 -18
- package/dist/{animatedGifPrep-ZID2XJRQ.js → animatedGifPrep-HV4ZFVPV.js} +5 -5
- package/dist/api.d.ts +209 -0
- package/dist/api.js +75 -0
- package/dist/{asset-TFEENZ7K.js → asset-3GIBXLLL.js} +3 -3
- package/dist/{assetCataloger-GX4B55VB.js → assetCataloger-JJQ4JW2P.js} +2 -2
- package/dist/{auth-EJVZW6C3.js → auth-XQMT727H.js} +4 -4
- package/dist/{autoUpdate-MBNEZ2U4.js → autoUpdate-CREZJGMU.js} +2 -2
- package/dist/{backgroundChecks-DNW5NPTY.js → backgroundChecks-K3S5QKR3.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-T7S2CGJE.js → batchRender-42AKNX73.js} +6 -6
- package/dist/{beats-STXBGN6Z.js → beats-Y7IKETUS.js} +21 -21
- package/dist/{benchmark-AC6IGEQP.js → benchmark-22SAXSO5.js} +18 -18
- package/dist/{browser-FB5AK32T.js → browser-ABNISCC3.js} +14 -13
- package/dist/{bundleWithLocalizedFonts-HSCWGCFO.js → bundleWithLocalizedFonts-OE5ZI4JE.js} +5 -5
- package/dist/{capture-VEIVUHWB.js → capture-DBNHO4WJ.js} +2 -2
- package/dist/{capture-I24MXH3Y.js → capture-HQG5W42I.js} +19 -19
- package/dist/{catalog-JRC4VTTI.js → catalog-KICZFIDX.js} +34 -34
- package/dist/{catch-up-NTCK7Z3G.js → catch-up-ZCQUCI45.js} +13 -13
- package/dist/{check-7M7W4LPN.js → check-TGXIICEF.js} +48 -48
- package/dist/{checkBrowser-2YRVCAYB.js → checkBrowser-3N23I56J.js} +36 -36
- package/dist/{chunk-A72OAGNB.js → chunk-2HWB4TCI.js} +1 -1
- package/dist/chunk-3WD4JNMU.js +3795 -0
- package/dist/{chunk-XOJDBRNF.js → chunk-4S4VUXW3.js} +1 -1
- package/dist/{chunk-JBQJKC23.js → chunk-62RUQJ5J.js} +1 -1
- package/dist/{chunk-A6S35NYA.js → chunk-7IEGPJ4P.js} +1 -1
- package/dist/{chunk-BAKPN2D2.js → chunk-AHBYQRGI.js} +1 -1
- package/dist/{chunk-H7B6JSHI.js → chunk-AY2BONTF.js} +1 -1
- package/dist/{chunk-A4Q7W4LV.js → chunk-B3XLIBFL.js} +4 -2
- package/dist/{chunk-ZVZSFDW3.js → chunk-BNYRD7PQ.js} +2 -2
- package/dist/{chunk-DYWSCPCR.js → chunk-CNPJHUOX.js} +17 -17
- package/dist/{chunk-B45OFFOQ.js → chunk-CT6ZQRLD.js} +6 -8
- package/dist/chunk-CYFFYK2F.js +56 -0
- package/dist/{chunk-KVGDFUVO.js → chunk-CZQLCBWY.js} +26 -13
- package/dist/{chunk-6IIGT7BX.js → chunk-DNZMBQTH.js} +1 -1
- package/dist/{chunk-SYUGVPYH.js → chunk-DUUFDLC4.js} +1 -1
- package/dist/{chunk-3YUFN37G.js → chunk-GESJSXFH.js} +1 -1
- package/dist/chunk-HU2SPFNG.js +103 -0
- package/dist/{chunk-4OA4LDTU.js → chunk-IYLHJV34.js} +1 -1
- package/dist/{chunk-KBB4RG6F.js → chunk-JZIEZCQM.js} +9 -2
- package/dist/{chunk-XVIYZU3D.js → chunk-K35E45SI.js} +1 -1
- package/dist/{chunk-EGO6Z24R.js → chunk-K44HCHZN.js} +3 -3
- package/dist/{chunk-4YVMMRHR.js → chunk-K4RIT6PX.js} +2 -2
- package/dist/chunk-KGPLIH7B.js +127 -0
- package/dist/{chunk-B4P5VDFQ.js → chunk-KMAAOHLO.js} +1 -1
- package/dist/{chunk-MOL32UKR.js → chunk-KMJLHHBF.js} +1 -1
- package/dist/{chunk-3HSWLZ6S.js → chunk-KQHJKJ3V.js} +1 -1
- package/dist/{chunk-2IDHEEAN.js → chunk-KUTT3JXL.js} +88 -28
- package/dist/{chunk-3BETQ4XI.js → chunk-L274XRWA.js} +81 -8
- package/dist/{chunk-3PPO64IB.js → chunk-LACFOFWX.js} +10 -10
- package/dist/chunk-LCILS4AF.js +329 -0
- package/dist/{chunk-6BSIQJPW.js → chunk-LTJDUBSQ.js} +1 -1
- package/dist/{chunk-66SAATRI.js → chunk-M5B42RL5.js} +9 -9
- package/dist/{chunk-6WD636E5.js → chunk-MI6U3OIN.js} +2 -2
- package/dist/{chunk-YCGU3UNU.js → chunk-MXB6CWVH.js} +1 -1
- package/dist/{chunk-Z5C4LEAD.js → chunk-NKM53WMI.js} +11 -11
- package/dist/{chunk-QTTDKWSM.js → chunk-OMBSUO4T.js} +2 -2
- package/dist/{chunk-AL2YEVOT.js → chunk-P7NTODQE.js} +3 -3
- package/dist/{chunk-BHVFTYSI.js → chunk-PO2SDVQA.js} +4 -1
- package/dist/{chunk-DDNS2674.js → chunk-PR7QQBSC.js} +1 -1
- package/dist/{chunk-FDL4HV44.js → chunk-Q2Y5OZCY.js} +2 -2
- package/dist/{chunk-P6HELLPU.js → chunk-QIJLIULK.js} +2 -2
- package/dist/{chunk-5OKZLMQK.js → chunk-RMIFSBRV.js} +1 -1
- package/dist/{chunk-AFIATIKS.js → chunk-SFUBSJFP.js} +1 -1
- package/dist/{chunk-LE7T4ML7.js → chunk-SP6XL3NP.js} +1 -1
- package/dist/{chunk-SEABQTBP.js → chunk-TPIG7ZBX.js} +9 -9
- package/dist/{chunk-POKK6XXU.js → chunk-U7SASZC5.js} +15 -15
- package/dist/{chunk-JF5L5SQ6.js → chunk-VC7JBNPS.js} +72 -107
- package/dist/{chunk-N53FLAMZ.js → chunk-VGCEMOQA.js} +10 -10
- package/dist/{normalize-U3SL5VG3.js → chunk-VHZ6DL3M.js} +3 -3
- package/dist/chunk-VX4AL2FQ.js +26 -0
- package/dist/{chunk-3BYMCR4O.js → chunk-VXM4BH23.js} +23 -12
- package/dist/{chunk-ZLL72U3I.js → chunk-WX7VCRM7.js} +2 -2
- package/dist/{chunk-KPJMBC4K.js → chunk-XHBX7QN6.js} +4 -4
- package/dist/{chunk-BYSBRF24.js → chunk-XPQSL5VS.js} +5 -120
- package/dist/{chunk-55RZG5SQ.js → chunk-Y475GD4L.js} +4 -4
- package/dist/{chunk-ZQXNL5DL.js → chunk-YDRX42P3.js} +6 -6
- package/dist/{chunk-4SFGME7K.js → chunk-YJDB4FLT.js} +1 -1
- package/dist/{chunk-QATWIE4K.js → chunk-YU2QRNWN.js} +2 -2
- package/dist/{chunk-BPUFVVSH.js → chunk-ZK3BQXHC.js} +1 -1
- package/dist/{chunk-QHRPB2JQ.js → chunk-ZKDKFJCK.js} +13 -13
- package/dist/{clean-3RY3Y2GX.js → clean-6QP7VAV4.js} +32 -31
- package/dist/cli.js +55 -55
- package/dist/{cloud-MLPBFCVE.js → cloud-5TME5ROM.js} +4 -4
- package/dist/{cloudrun-NQF5KFQI.js → cloudrun-F5VVCVF5.js} +6 -6
- package/dist/{compare-6EZX2754.js → compare-XPY2EXX6.js} +35 -35
- package/dist/{compiler-ACCPOZMQ.js → compiler-NPD3MYMO.js} +2 -2
- package/dist/{component-F5PQHP6A.js → component-OPVL3PUX.js} +4 -4
- package/dist/{compositions-AUHWSI2H.js → compositions-WSEOI454.js} +19 -19
- package/dist/{delete-VUF4SHHJ.js → delete-SLMH57VH.js} +11 -11
- package/dist/{dist-GPDOV3IQ.js → dist-CUIR3GFX.js} +2 -2
- package/dist/{doctor-3XHCA5JM.js → doctor-QZW3EKIH.js} +20 -19
- package/dist/{events-FKOIB3R3.js → events-6C3ZG7LS.js} +8 -8
- package/dist/{events-TIU72LZM.js → events-FIFWFRGC.js} +6 -6
- package/dist/{feedback-V6VATYBE.js → feedback-VKXM7YJ5.js} +24 -24
- package/dist/{ffmpeg-5V4FP3R6.js → ffmpeg-TZB5WAYE.js} +3 -2
- package/dist/{figma-YBJM2VGE.js → figma-3UYNADNA.js} +3 -3
- package/dist/fontLocalizeCli.js +10 -10
- package/dist/{get-3YVCGZBX.js → get-VH7VMRVX.js} +11 -11
- package/dist/{gpuPolicy-ZOUG66M7.js → gpuPolicy-M2JZGGVW.js} +5 -5
- package/dist/{grade-compare-MYXIRKQI.js → grade-compare-OSC2YQWN.js} +40 -39
- package/dist/{help-WFZ2SUUR.js → help-DCBFEZPT.js} +3 -3
- package/dist/{history-HWPRJFR5.js → history-XYJMQE26.js} +15 -15
- package/dist/hyperframe-runtime.js +62 -62
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +62 -62
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-WJDTQ4OZ.js → info-YEHGENAH.js} +17 -17
- package/dist/{init-EXHDN7RO.js → init-64SML7PY.js} +52 -51
- package/dist/{inspect-EAOLZOMQ.js → inspect-GFOQKRJI.js} +32 -32
- package/dist/{installer-LZ4X5TZZ.js → installer-Q4MMZKLA.js} +4 -4
- package/dist/{keyframes-FSZYNEDN.js → keyframes-ORYFWKBZ.js} +16 -16
- package/dist/{lambda-3GAKHMC3.js → lambda-DRMOJGTC.js} +8 -8
- package/dist/{layout-M2TQ2CIX.js → layout-ZEQBE6UQ.js} +32 -32
- package/dist/{lint-7C5UPTNQ.js → lint-67KGFY63.js} +19 -19
- package/dist/{list-GU5KBZ73.js → list-T6OU5ARJ.js} +11 -11
- package/dist/{login-ZL2NYBIZ.js → login-2PXIGDP7.js} +9 -9
- package/dist/{logout-B4KS4A7S.js → logout-DKJANASY.js} +3 -3
- package/dist/{manager-5ORDVWJB.js → manager-ES2UFT4X.js} +6 -4
- package/dist/{manager-BPSR6D3V.js → manager-GWU5J6RJ.js} +3 -2
- package/dist/{media-treatment-QC3TAHVU.js → media-treatment-NAAHID6M.js} +27 -26
- package/dist/{models-A54I4QR5.js → models-P6XB6RWK.js} +19 -17
- package/dist/{motionShot-ZXPK562F.js → motionShot-7MHRIV6V.js} +13 -13
- package/dist/normalize-4UDISLPL.js +24 -0
- package/dist/{normalize-audio-CAP3DAE6.js → normalize-audio-LWNFYR2F.js} +15 -15
- package/dist/{open-GUSBNMDB.js → open-DAP5C7UD.js} +13 -13
- package/dist/{parakeetRunner-GCCH72CO.js → parakeetRunner-3ZVFPOD4.js} +17 -27
- package/dist/{pipeline-SCJ2MWYH.js → pipeline-V4YJCPUX.js} +9 -9
- package/dist/{play-FP2QLMGM.js → play-UDCESJO3.js} +35 -35
- package/dist/{preflight-ONF5AJNO.js → preflight-JOD4OXGC.js} +5 -4
- package/dist/{present-H5SA4APW.js → present-DXTHBH3F.js} +26 -26
- package/dist/{preview-ATPVKA6K.js → preview-YHXKRXKB.js} +39 -37
- package/dist/{producer-VBYUC27R.js → producer-343ENLAM.js} +1 -1
- package/dist/{projectConfig-SBRMQZGG.js → projectConfig-YXKU3CTB.js} +6 -6
- package/dist/{publication-5BQICRZO.js → publication-ODXP3JI7.js} +2 -2
- package/dist/{publish-XDUZA3E3.js → publish-UEFBFGV3.js} +22 -22
- package/dist/{refresh-PVHBEABE.js → refresh-MGCVWX56.js} +3 -3
- package/dist/{remove-background-GA6F7JZW.js → remove-background-FMV6IDOH.js} +38 -34
- package/dist/{render-XCYXFZTL.js → render-N7QGX6RJ.js} +30 -30
- package/dist/{render-PCFO45RK.js → render-SYC4RPGT.js} +6 -6
- package/dist/{render-KUVZFNQD.js → render-ZTXNPRGF.js} +61 -60
- package/dist/{render-batch-7R2NRNVJ.js → render-batch-SZRPCRUJ.js} +6 -6
- package/dist/renderSetupWorker.js +4 -3
- package/dist/{resolver-C4FPX72I.js → resolver-7MYXNEAX.js} +4 -4
- package/dist/{sherpa-IQY52XU6.js → sherpa-M4Z2Q5Y2.js} +15 -14
- package/dist/sherpaWorker.js +3 -1
- package/dist/{skills-JSSAEKUW.js → skills-NEHNSHZK.js} +15 -15
- package/dist/{skillsUpdateCheck-XE5E2K2F.js → skillsUpdateCheck-O77QR72A.js} +3 -3
- package/dist/{snapshot-QMQOE2DD.js → snapshot-GDVXFBVY.js} +54 -53
- package/dist/{src-R55QLGWI.js → src-PTIV7IVV.js} +6 -6
- package/dist/{src-2GMPFYHL.js → src-VMTHSARJ.js} +6 -4
- package/dist/{staticProjectServer-YH2RHYKW.js → staticProjectServer-3D2NXQ6W.js} +14 -14
- package/dist/{status-PTKNQD2E.js → status-NBRMGL7D.js} +5 -5
- package/dist/studio/assets/{hyperframes-player-_eMxRXF_.js → hyperframes-player-C-2YwYre.js} +1 -1
- package/dist/studio/assets/{index-bXzd7tvF.js → index-ByJU5J6n.js} +115 -115
- package/dist/studio/assets/{index-CEq9KmY2.js → index-BybGk67U.js} +1 -1
- package/dist/studio/assets/{index-6okhHdnH.js → index-Cfs2r3fz.js} +1 -1
- package/dist/studio/assets/{index-CVd4O6eH.css → index-DkQKsFxx.css} +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/{studio-api-T2TS2CHL.js → studio-api-XIBDLRHB.js} +7 -7
- package/dist/{studioServer-Q4MT44LT.js → studioServer-QIQK47UN.js} +70 -69
- package/dist/{synthesize-UCI4X5O7.js → synthesize-22B7L5GX.js} +6 -6
- package/dist/{telemetry-V5JYZDS4.js → telemetry-565KDZUW.js} +8 -8
- package/dist/{timeline-KTCTOKF5.js → timeline-E6XB7I6W.js} +24 -24
- package/dist/{tokens-ZHREZPK6.js → tokens-3ZAJENSE.js} +3 -3
- package/dist/transcribe-WODP3T77.js +332 -0
- package/dist/{transcribe-CRAV4FU3.js → transcribe-XWQQCCBG.js} +13 -12
- package/dist/{tts-B6AHFQEO.js → tts-QSAQZVEZ.js} +3 -3
- package/dist/{updateCheck-E7RMSK3E.js → updateCheck-QPYU4GRL.js} +2 -2
- package/dist/{upgrade-27PFTDCV.js → upgrade-2FJ5ZEN6.js} +5 -5
- package/dist/{urlDownloader-EAF6PLUP.js → urlDownloader-352AY25I.js} +4 -4
- package/dist/{validate-OKNFDBMG.js → validate-SP2VGNEI.js} +25 -25
- package/dist/{video-IEVS4FIH.js → video-RVNPFEA6.js} +8 -8
- package/package.json +8 -1
- package/dist/chunk-6IHWCZ3W.js +0 -54
- package/dist/chunk-SQLK7SJL.js +0 -88
- package/dist/chunk-Z6FLHIDV.js +0 -3795
- package/dist/manager-RFZNG5YT.js +0 -30
- package/dist/renderCancellation-NIXEWRAO.js +0 -43
- package/dist/transcribe-4QDEWCE6.js +0 -466
- package/dist/{chunk-DKSDVDXG.js → chunk-NAMGMP3R.js} +3 -3
- package/dist/{policies-4FEXMXPK.js → policies-DCSIM4AB.js} +3 -3
- package/dist/{screenshotCapture-3JXXUZND.js → screenshotCapture-TEUIWXWN.js} +3 -3
- package/dist/{telemetry-W5AKPI4R.js → telemetry-CQYHCCPL.js} +3 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
|
|
8
|
+
// src/utils/processTree.ts
|
|
9
|
+
import { execFileSync, spawn } from "child_process";
|
|
10
|
+
import { readdirSync, readFileSync } from "fs";
|
|
11
|
+
function processIsAlive(pid) {
|
|
12
|
+
try {
|
|
13
|
+
process.kill(pid, 0);
|
|
14
|
+
return true;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
return error?.code !== "ESRCH";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function processGroupIsAlive(pid) {
|
|
20
|
+
if (process.platform === "linux") {
|
|
21
|
+
try {
|
|
22
|
+
return readdirSync("/proc").some((entry) => {
|
|
23
|
+
if (!/^\d+$/.test(entry)) return false;
|
|
24
|
+
try {
|
|
25
|
+
const stat = readFileSync(`/proc/${entry}/stat`, "utf8");
|
|
26
|
+
const fields = stat.slice(stat.lastIndexOf(") ") + 2).split(/\s+/);
|
|
27
|
+
return fields[2] === String(pid) && fields[0] !== "Z" && fields[0] !== "X";
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return processIsAlive(-pid);
|
|
36
|
+
}
|
|
37
|
+
function waitForDelay(delayMs) {
|
|
38
|
+
return new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
39
|
+
}
|
|
40
|
+
async function waitForProcessGroupExit(pid) {
|
|
41
|
+
while (processGroupIsAlive(pid)) await waitForDelay(20);
|
|
42
|
+
}
|
|
43
|
+
function windowsProcessTreeKillArgs(pid) {
|
|
44
|
+
return ["/PID", String(pid), "/T", "/F"];
|
|
45
|
+
}
|
|
46
|
+
function terminateWindowsProcessTree(pid, spawnProcess = (command, args, options) => spawn(command, [...args], options)) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const killer = spawnProcess("taskkill", windowsProcessTreeKillArgs(pid), {
|
|
49
|
+
stdio: "ignore",
|
|
50
|
+
windowsHide: true
|
|
51
|
+
});
|
|
52
|
+
killer.once("error", reject);
|
|
53
|
+
killer.once("close", (status) => {
|
|
54
|
+
if (status === 0) resolve();
|
|
55
|
+
else reject(new Error(`taskkill exited with status ${status ?? "unknown"}`));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function signalProcessGroup(pid, signal) {
|
|
60
|
+
try {
|
|
61
|
+
process.kill(-pid, signal);
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getDescendants(pid) {
|
|
66
|
+
let children;
|
|
67
|
+
try {
|
|
68
|
+
const raw = execFileSync("pgrep", ["-P", String(pid)], {
|
|
69
|
+
encoding: "utf8",
|
|
70
|
+
timeout: 2e3
|
|
71
|
+
}).trim();
|
|
72
|
+
children = raw.split(/\r?\n/).map(Number).filter((childPid) => Number.isInteger(childPid) && childPid > 0);
|
|
73
|
+
} catch {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
return children.flatMap((childPid) => [childPid, ...getDescendants(childPid)]);
|
|
77
|
+
}
|
|
78
|
+
function signalProcesses(pids, signal) {
|
|
79
|
+
for (const pid of pids) {
|
|
80
|
+
try {
|
|
81
|
+
process.kill(pid, signal);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function terminatePidTree(pid, signal) {
|
|
87
|
+
const pids = [...getDescendants(pid).reverse(), pid];
|
|
88
|
+
signalProcesses(pids, signal);
|
|
89
|
+
if (signal === "SIGKILL") return "SIGKILL";
|
|
90
|
+
await waitForDelay(500);
|
|
91
|
+
const survivors = pids.filter(processIsAlive);
|
|
92
|
+
signalProcesses(survivors, "SIGKILL");
|
|
93
|
+
return survivors.length > 0 ? "SIGKILL" : "SIGTERM";
|
|
94
|
+
}
|
|
95
|
+
async function terminateProcessGroup(pid, signal) {
|
|
96
|
+
signalProcessGroup(pid, signal);
|
|
97
|
+
if (signal === "SIGKILL") {
|
|
98
|
+
await waitForProcessGroupExit(pid);
|
|
99
|
+
return "SIGKILL";
|
|
100
|
+
}
|
|
101
|
+
await Promise.race([waitForProcessGroupExit(pid), waitForDelay(250)]);
|
|
102
|
+
if (!processGroupIsAlive(pid)) return "SIGTERM";
|
|
103
|
+
signalProcessGroup(pid, "SIGKILL");
|
|
104
|
+
await waitForProcessGroupExit(pid);
|
|
105
|
+
return "SIGKILL";
|
|
106
|
+
}
|
|
107
|
+
async function terminateProcessTree(pid, options = {}) {
|
|
108
|
+
if (process.platform === "win32") {
|
|
109
|
+
try {
|
|
110
|
+
await terminateWindowsProcessTree(pid, options.spawnProcess);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
try {
|
|
113
|
+
options.child?.kill("SIGKILL");
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
if (options.child) throw error;
|
|
117
|
+
}
|
|
118
|
+
return "SIGKILL";
|
|
119
|
+
}
|
|
120
|
+
const signal = options.signal ?? "SIGTERM";
|
|
121
|
+
return options.processGroup ? terminateProcessGroup(pid, signal) : terminatePidTree(pid, signal);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
processIsAlive,
|
|
126
|
+
terminateProcessTree
|
|
127
|
+
};
|
|
@@ -4,29 +4,29 @@ import { dirname as __hf_dirname } from "node:path";
|
|
|
4
4
|
var require = __hf_createRequire(import.meta.url);
|
|
5
5
|
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
emitWords
|
|
9
|
-
} from "./chunk-6IHWCZ3W.js";
|
|
10
7
|
import {
|
|
11
8
|
stoppedByCancelSignal
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-P7NTODQE.js";
|
|
13
10
|
import {
|
|
14
11
|
DEFAULT_MODEL,
|
|
15
12
|
ensureModel,
|
|
16
13
|
ensureWhisper,
|
|
17
14
|
hasFFmpeg
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CZQLCBWY.js";
|
|
19
16
|
import {
|
|
20
17
|
findFFmpeg,
|
|
21
18
|
findFFprobe,
|
|
22
19
|
getFFmpegInstallHint
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DUUFDLC4.js";
|
|
24
21
|
import {
|
|
25
22
|
findWavChunk
|
|
26
23
|
} from "./chunk-UOFAE5RF.js";
|
|
27
24
|
import {
|
|
28
25
|
TRANSCRIPT_FILE
|
|
29
26
|
} from "./chunk-IR35BCLK.js";
|
|
27
|
+
import {
|
|
28
|
+
stoppableExecFile
|
|
29
|
+
} from "./chunk-HU2SPFNG.js";
|
|
30
30
|
|
|
31
31
|
// src/whisper/transcribe.ts
|
|
32
32
|
import { execFile, execFileSync } from "child_process";
|
|
@@ -36,6 +36,60 @@ import { existsSync, readFileSync, mkdirSync, rmSync, statSync, unlinkSync } fro
|
|
|
36
36
|
import { basename, join, extname } from "path";
|
|
37
37
|
import { tmpdir } from "os";
|
|
38
38
|
import { randomUUID } from "crypto";
|
|
39
|
+
|
|
40
|
+
// src/whisper/modelForLanguage.ts
|
|
41
|
+
function initialModelForLanguage(model, language) {
|
|
42
|
+
const baseLanguage = language?.trim().toLowerCase().split(/[-_]/, 1)[0];
|
|
43
|
+
if (baseLanguage && baseLanguage !== "en" && model.endsWith(".en")) {
|
|
44
|
+
return model.slice(0, -3);
|
|
45
|
+
}
|
|
46
|
+
return model;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/whisper/progress.ts
|
|
50
|
+
var DESKTOP_MAX_LINE_BYTES = 16e3;
|
|
51
|
+
function emitWords(onEvent, model, words, through) {
|
|
52
|
+
const empty = Buffer.byteLength(JSON.stringify({ type: "words", model, words: [], through })) + 1;
|
|
53
|
+
let chunk = [];
|
|
54
|
+
let bytes = empty;
|
|
55
|
+
for (const word of words) {
|
|
56
|
+
const size = Buffer.byteLength(JSON.stringify(word)) + 1;
|
|
57
|
+
if (chunk.length > 0 && bytes + size > DESKTOP_MAX_LINE_BYTES) {
|
|
58
|
+
onEvent({ type: "words", model, words: chunk, through: chunk.at(-1).end });
|
|
59
|
+
chunk = [];
|
|
60
|
+
bytes = empty;
|
|
61
|
+
}
|
|
62
|
+
chunk.push(word);
|
|
63
|
+
bytes += size;
|
|
64
|
+
}
|
|
65
|
+
onEvent({ type: "words", model, words: chunk, through });
|
|
66
|
+
}
|
|
67
|
+
function createProgressWriter(stream) {
|
|
68
|
+
let blocked = false;
|
|
69
|
+
const pending = [];
|
|
70
|
+
const write = (event) => {
|
|
71
|
+
if (blocked) {
|
|
72
|
+
const previous = pending.at(-1);
|
|
73
|
+
if (event.type === "progress" && event.phase === "download" && previous?.type === "progress" && previous.phase === "download" && previous.model === event.model) {
|
|
74
|
+
pending[pending.length - 1] = event;
|
|
75
|
+
} else {
|
|
76
|
+
pending.push(event);
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
blocked = !stream.write(`${JSON.stringify(event)}
|
|
81
|
+
`);
|
|
82
|
+
if (blocked) {
|
|
83
|
+
stream.once("drain", () => {
|
|
84
|
+
blocked = false;
|
|
85
|
+
while (!blocked && pending.length > 0) write(pending.shift());
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return write;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/whisper/transcribe.ts
|
|
39
93
|
var WHISPER_TIMEOUT_FLOOR_MS = 3e5;
|
|
40
94
|
var WHISPER_TIMEOUT_PER_AUDIO_SECOND_MS = 1e4;
|
|
41
95
|
var WHISPER_TIMEOUT_CAP_MS = 432e5;
|
|
@@ -175,15 +229,17 @@ function isVideoFile(filePath) {
|
|
|
175
229
|
function tempWavPath() {
|
|
176
230
|
return join(tmpdir(), `hyperframes-audio-${process.pid}-${randomUUID()}.wav`);
|
|
177
231
|
}
|
|
178
|
-
function runFfmpeg(ffmpegPath, args, output, timeout) {
|
|
232
|
+
async function runFfmpeg(ffmpegPath, args, output, timeout, signal) {
|
|
179
233
|
try {
|
|
180
|
-
|
|
234
|
+
await stoppableExecFile(ffmpegPath, ["-nostats", "-hide_banner", ...args, "-y", output], {
|
|
181
235
|
stdio: ["ignore", "ignore", "pipe"],
|
|
182
236
|
maxBuffer: 64 * 1024 * 1024,
|
|
183
|
-
timeout
|
|
237
|
+
timeout,
|
|
238
|
+
signal
|
|
184
239
|
});
|
|
185
240
|
} catch (err) {
|
|
186
241
|
rmSync(output, { force: true });
|
|
242
|
+
if (signal?.aborted) throw err;
|
|
187
243
|
const stop = err;
|
|
188
244
|
if (stop.code) throw err;
|
|
189
245
|
const said = String(stop.stderr ?? "").trim();
|
|
@@ -193,7 +249,7 @@ function runFfmpeg(ffmpegPath, args, output, timeout) {
|
|
|
193
249
|
throw Object.assign(failure, { cancelled, stderr: said });
|
|
194
250
|
}
|
|
195
251
|
}
|
|
196
|
-
function extractAudio(videoPath) {
|
|
252
|
+
async function extractAudio(videoPath, signal) {
|
|
197
253
|
const ffmpegPath = findFFmpeg();
|
|
198
254
|
if (!ffmpegPath) {
|
|
199
255
|
throw new Error(
|
|
@@ -201,11 +257,12 @@ function extractAudio(videoPath) {
|
|
|
201
257
|
);
|
|
202
258
|
}
|
|
203
259
|
const wavPath = tempWavPath();
|
|
204
|
-
runFfmpeg(
|
|
260
|
+
await runFfmpeg(
|
|
205
261
|
ffmpegPath,
|
|
206
262
|
["-i", videoPath, "-vn", "-ar", "16000", "-ac", "1", "-f", "wav"],
|
|
207
263
|
wavPath,
|
|
208
|
-
resolveAudioPreparationTimeoutMs(getMediaDurationSeconds(videoPath))
|
|
264
|
+
resolveAudioPreparationTimeoutMs(getMediaDurationSeconds(videoPath)),
|
|
265
|
+
signal
|
|
209
266
|
);
|
|
210
267
|
return wavPath;
|
|
211
268
|
}
|
|
@@ -227,7 +284,7 @@ function isWav16kMono(filePath) {
|
|
|
227
284
|
return false;
|
|
228
285
|
}
|
|
229
286
|
}
|
|
230
|
-
function prepareAudio(audioPath) {
|
|
287
|
+
async function prepareAudio(audioPath, signal) {
|
|
231
288
|
if (extname(audioPath).toLowerCase() === ".wav" && isWav16kMono(audioPath)) {
|
|
232
289
|
return audioPath;
|
|
233
290
|
}
|
|
@@ -236,28 +293,22 @@ function prepareAudio(audioPath) {
|
|
|
236
293
|
throw new Error(`ffmpeg is required to prepare audio. Install: ${getFFmpegInstallHint()}`);
|
|
237
294
|
}
|
|
238
295
|
const wavPath = tempWavPath();
|
|
239
|
-
runFfmpeg(
|
|
296
|
+
await runFfmpeg(
|
|
240
297
|
ffmpegPath,
|
|
241
298
|
["-i", audioPath, "-ar", "16000", "-ac", "1", "-f", "wav"],
|
|
242
299
|
wavPath,
|
|
243
|
-
resolveAudioPreparationTimeoutMs(getMediaDurationSeconds(audioPath))
|
|
300
|
+
resolveAudioPreparationTimeoutMs(getMediaDurationSeconds(audioPath)),
|
|
301
|
+
signal
|
|
244
302
|
);
|
|
245
303
|
return wavPath;
|
|
246
304
|
}
|
|
247
305
|
function dtwPresetForModel(model) {
|
|
248
306
|
return model.replace(/-/g, ".");
|
|
249
307
|
}
|
|
250
|
-
function
|
|
251
|
-
const baseLanguage = language?.trim().toLowerCase().split(/[-_]/, 1)[0];
|
|
252
|
-
if (baseLanguage && baseLanguage !== "en" && model.endsWith(".en")) {
|
|
253
|
-
return model.slice(0, -3);
|
|
254
|
-
}
|
|
255
|
-
return model;
|
|
256
|
-
}
|
|
257
|
-
function prepareWav(inputPath, onProgress) {
|
|
308
|
+
async function prepareWav(inputPath, onProgress, signal) {
|
|
258
309
|
if (isAudioFile(inputPath)) {
|
|
259
310
|
onProgress?.("Preparing audio...");
|
|
260
|
-
return prepareAudio(inputPath);
|
|
311
|
+
return prepareAudio(inputPath, signal);
|
|
261
312
|
}
|
|
262
313
|
if (isVideoFile(inputPath)) {
|
|
263
314
|
if (!hasFFmpeg()) {
|
|
@@ -266,19 +317,24 @@ function prepareWav(inputPath, onProgress) {
|
|
|
266
317
|
);
|
|
267
318
|
}
|
|
268
319
|
onProgress?.("Extracting audio from video...");
|
|
269
|
-
return extractAudio(inputPath);
|
|
320
|
+
return extractAudio(inputPath, signal);
|
|
270
321
|
}
|
|
271
322
|
throw new Error(`Unsupported file type: ${extname(inputPath).toLowerCase()}`);
|
|
272
323
|
}
|
|
273
324
|
async function transcribe(inputPath, outputDir, options) {
|
|
274
325
|
const model = initialModelForLanguage(options?.model ?? DEFAULT_MODEL, options?.language);
|
|
326
|
+
const signal = options?.signal;
|
|
327
|
+
signal?.throwIfAborted();
|
|
275
328
|
options?.onProgress?.("Checking whisper...");
|
|
276
329
|
const whisper = await ensureWhisper({
|
|
277
330
|
onProgress: options?.onProgress,
|
|
278
|
-
installRuntime: options?.installRuntime
|
|
331
|
+
installRuntime: options?.installRuntime,
|
|
332
|
+
signal
|
|
279
333
|
});
|
|
334
|
+
signal?.throwIfAborted();
|
|
280
335
|
options?.onProgress?.("Checking model...");
|
|
281
336
|
const modelPath = await ensureModel(model, {
|
|
337
|
+
signal,
|
|
282
338
|
onProgress: options?.onProgress,
|
|
283
339
|
onDownloadProgress: options?.onEvent ? (receivedBytes, totalBytes) => options.onEvent?.({
|
|
284
340
|
type: "progress",
|
|
@@ -288,7 +344,9 @@ async function transcribe(inputPath, outputDir, options) {
|
|
|
288
344
|
totalBytes
|
|
289
345
|
}) : void 0
|
|
290
346
|
});
|
|
291
|
-
|
|
347
|
+
signal?.throwIfAborted();
|
|
348
|
+
const wavPath = await prepareWav(inputPath, options?.onProgress, signal);
|
|
349
|
+
signal?.throwIfAborted();
|
|
292
350
|
const automaticLanguage = options?.language === void 0 && !model.endsWith(".en");
|
|
293
351
|
const language = options?.language ?? (automaticLanguage ? "auto" : "en");
|
|
294
352
|
options?.onProgress?.("Transcribing...");
|
|
@@ -436,6 +494,9 @@ function wrapWhisperTimeoutError(err, options) {
|
|
|
436
494
|
}
|
|
437
495
|
|
|
438
496
|
export {
|
|
497
|
+
initialModelForLanguage,
|
|
498
|
+
emitWords,
|
|
499
|
+
createProgressWriter,
|
|
439
500
|
whisperModelSlowdownFactor,
|
|
440
501
|
resolveWhisperTimeoutMs,
|
|
441
502
|
resolveAudioPreparationTimeoutMs,
|
|
@@ -444,7 +505,6 @@ export {
|
|
|
444
505
|
detectSpeechOnset,
|
|
445
506
|
isPcm16kMono,
|
|
446
507
|
dtwPresetForModel,
|
|
447
|
-
initialModelForLanguage,
|
|
448
508
|
prepareWav,
|
|
449
509
|
transcribe,
|
|
450
510
|
isWhisperTimeoutError,
|
|
@@ -8,25 +8,91 @@ import {
|
|
|
8
8
|
loadOptionalPackage
|
|
9
9
|
} from "./chunk-3DKN5WKL.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./chunk-SQLK7SJL.js";
|
|
11
|
+
downloadFile
|
|
12
|
+
} from "./chunk-PO2SDVQA.js";
|
|
14
13
|
import {
|
|
15
14
|
findFFmpeg,
|
|
16
15
|
findFFprobe,
|
|
17
16
|
getFFmpegInstallHint
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DUUFDLC4.js";
|
|
19
18
|
import {
|
|
20
19
|
DEFAULT_VP9_CPU_USED,
|
|
21
20
|
SDR_RGB_TO_BT709_FILTER,
|
|
22
21
|
renderProvenanceArgs
|
|
23
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VC7JBNPS.js";
|
|
24
23
|
|
|
25
24
|
// src/background-removal/pipeline.ts
|
|
26
25
|
import { spawn } from "child_process";
|
|
27
26
|
import { randomUUID } from "crypto";
|
|
28
27
|
import { renameSync, rmSync } from "fs";
|
|
29
|
-
import { basename, dirname, extname, join } from "path";
|
|
28
|
+
import { basename, dirname, extname, join as join2 } from "path";
|
|
29
|
+
|
|
30
|
+
// src/background-removal/manager.ts
|
|
31
|
+
import { existsSync, mkdirSync } from "fs";
|
|
32
|
+
import { homedir, platform, arch } from "os";
|
|
33
|
+
import { join } from "path";
|
|
34
|
+
var MODELS_DIR = join(homedir(), ".cache", "hyperframes", "background-removal", "models");
|
|
35
|
+
var DEFAULT_MODEL = "u2net_human_seg";
|
|
36
|
+
var MODEL_URLS = {
|
|
37
|
+
u2net_human_seg: "https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx"
|
|
38
|
+
};
|
|
39
|
+
var MODEL_MEMORY_MB = {
|
|
40
|
+
u2net_human_seg: 1500
|
|
41
|
+
};
|
|
42
|
+
var DEVICES = ["auto", "cpu", "coreml", "cuda"];
|
|
43
|
+
function isDevice(value) {
|
|
44
|
+
return typeof value === "string" && DEVICES.includes(value);
|
|
45
|
+
}
|
|
46
|
+
function selectProviders(device = "auto") {
|
|
47
|
+
if (device === "cpu") return { providers: ["cpu"], label: "CPU" };
|
|
48
|
+
const available = listAvailableProviders();
|
|
49
|
+
const hasCoreML = available.includes("coreml");
|
|
50
|
+
const hasCUDA = available.includes("cuda");
|
|
51
|
+
if (device === "coreml") {
|
|
52
|
+
if (!hasCoreML) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
"CoreML execution provider not available. Install onnxruntime-node on Apple Silicon, or use --device cpu."
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return { providers: ["coreml", "cpu"], label: "CoreML" };
|
|
58
|
+
}
|
|
59
|
+
if (device === "cuda") {
|
|
60
|
+
if (!hasCUDA) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"CUDA execution provider not available. Use --device cpu or install an onnxruntime-node build with CUDA support."
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return { providers: ["cuda", "cpu"], label: "CUDA" };
|
|
66
|
+
}
|
|
67
|
+
if (hasCoreML && platform() === "darwin" && arch() === "arm64") {
|
|
68
|
+
return { providers: ["coreml", "cpu"], label: "CoreML" };
|
|
69
|
+
}
|
|
70
|
+
if (hasCUDA) return { providers: ["cuda", "cpu"], label: "CUDA" };
|
|
71
|
+
return { providers: ["cpu"], label: "CPU" };
|
|
72
|
+
}
|
|
73
|
+
var _cachedProviders;
|
|
74
|
+
function listAvailableProviders() {
|
|
75
|
+
if (_cachedProviders) return _cachedProviders;
|
|
76
|
+
const out = ["cpu"];
|
|
77
|
+
if (platform() === "darwin" && arch() === "arm64") out.push("coreml");
|
|
78
|
+
if (process.env["HYPERFRAMES_CUDA"] === "1") out.push("cuda");
|
|
79
|
+
_cachedProviders = out;
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
function modelPath(model = DEFAULT_MODEL) {
|
|
83
|
+
return join(MODELS_DIR, `${model}.onnx`);
|
|
84
|
+
}
|
|
85
|
+
async function ensureModel(model = DEFAULT_MODEL, options) {
|
|
86
|
+
const dest = modelPath(model);
|
|
87
|
+
if (existsSync(dest)) return dest;
|
|
88
|
+
mkdirSync(MODELS_DIR, { recursive: true });
|
|
89
|
+
options?.onProgress?.(`Downloading ${model} weights (~168 MB)...`);
|
|
90
|
+
await downloadFile(MODEL_URLS[model], dest);
|
|
91
|
+
if (!existsSync(dest)) {
|
|
92
|
+
throw new Error(`Model download failed: ${model}`);
|
|
93
|
+
}
|
|
94
|
+
return dest;
|
|
95
|
+
}
|
|
30
96
|
|
|
31
97
|
// src/background-removal/inference.ts
|
|
32
98
|
var INPUT_SIZE = 320;
|
|
@@ -203,7 +269,7 @@ function inferInputKind(inputPath) {
|
|
|
203
269
|
}
|
|
204
270
|
async function probeMedia(inputPath) {
|
|
205
271
|
const isImage = inferInputKind(inputPath) === "image";
|
|
206
|
-
const engine = await import("./src-
|
|
272
|
+
const engine = await import("./src-VMTHSARJ.js");
|
|
207
273
|
const meta = await engine.extractMediaMetadata(inputPath);
|
|
208
274
|
if (isImage) {
|
|
209
275
|
return { width: meta.width, height: meta.height, fps: 0, frameCount: 1 };
|
|
@@ -374,7 +440,7 @@ async function render(options) {
|
|
|
374
440
|
}
|
|
375
441
|
}
|
|
376
442
|
function tempBeside(path) {
|
|
377
|
-
return
|
|
443
|
+
return join2(dirname(path), `.tmp-${randomUUID()}-${basename(path)}`);
|
|
378
444
|
}
|
|
379
445
|
var RECENT_WINDOW = 30;
|
|
380
446
|
function spawnFfmpeg(ffmpegPath, args, label, stdio) {
|
|
@@ -484,6 +550,13 @@ function waitForExit(proc, label, getStderr) {
|
|
|
484
550
|
}
|
|
485
551
|
|
|
486
552
|
export {
|
|
553
|
+
DEFAULT_MODEL,
|
|
554
|
+
MODEL_MEMORY_MB,
|
|
555
|
+
DEVICES,
|
|
556
|
+
isDevice,
|
|
557
|
+
selectProviders,
|
|
558
|
+
listAvailableProviders,
|
|
559
|
+
modelPath,
|
|
487
560
|
QUALITIES,
|
|
488
561
|
DEFAULT_QUALITY,
|
|
489
562
|
isQuality,
|
|
@@ -14,13 +14,8 @@ import {
|
|
|
14
14
|
getInvocationId
|
|
15
15
|
} from "./chunk-54HJ63Q2.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
canaryFeatureProperties,
|
|
20
|
-
evaluateCanary,
|
|
21
|
-
findCanary,
|
|
22
|
-
parseCanaryOverride
|
|
23
|
-
} from "./chunk-FXMKHHPO.js";
|
|
17
|
+
c
|
|
18
|
+
} from "./chunk-ZTZA4UWZ.js";
|
|
24
19
|
import {
|
|
25
20
|
hostAnswers
|
|
26
21
|
} from "./chunk-K4WIOZFP.js";
|
|
@@ -34,10 +29,15 @@ import {
|
|
|
34
29
|
} from "./chunk-XUXGIA7H.js";
|
|
35
30
|
import {
|
|
36
31
|
VERSION
|
|
37
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-OMBSUO4T.js";
|
|
38
33
|
import {
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
CANARIES,
|
|
35
|
+
canaryEnvVar,
|
|
36
|
+
canaryFeatureProperties,
|
|
37
|
+
evaluateCanary,
|
|
38
|
+
findCanary,
|
|
39
|
+
parseCanaryOverride
|
|
40
|
+
} from "./chunk-FXMKHHPO.js";
|
|
41
41
|
|
|
42
42
|
// src/telemetry/transport.ts
|
|
43
43
|
import { spawn } from "child_process";
|