hyperframes 0.8.148 → 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-JAHZJYB7.js → add-MG53577L.js} +12 -12
- package/dist/api.d.ts +209 -0
- package/dist/api.js +75 -0
- package/dist/{asset-SJA7DT6Q.js → asset-3GIBXLLL.js} +3 -3
- package/dist/{auth-RR3OIXLH.js → auth-XQMT727H.js} +4 -4
- package/dist/{autoUpdate-KLDV2XWV.js → autoUpdate-CREZJGMU.js} +2 -2
- package/dist/{backgroundChecks-OVL3E2RK.js → backgroundChecks-K3S5QKR3.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-2SAJGOHU.js → batchRender-42AKNX73.js} +4 -4
- package/dist/{beats-HTYS42CC.js → beats-Y7IKETUS.js} +15 -15
- package/dist/{benchmark-CAHP4GLB.js → benchmark-22SAXSO5.js} +15 -15
- package/dist/{browser-M7I67IGX.js → browser-ABNISCC3.js} +14 -13
- package/dist/{capture-P5SNZ6HL.js → capture-DBNHO4WJ.js} +2 -2
- package/dist/{capture-YZQZ5LKM.js → capture-HQG5W42I.js} +11 -11
- package/dist/{catalog-LREZPRJS.js → catalog-KICZFIDX.js} +28 -28
- package/dist/{catch-up-2MLRYAYP.js → catch-up-ZCQUCI45.js} +13 -13
- package/dist/{check-BH6NUR22.js → check-TGXIICEF.js} +34 -34
- package/dist/{checkBrowser-BM6JBFST.js → checkBrowser-3N23I56J.js} +22 -22
- package/dist/{chunk-A6S35NYA.js → chunk-7IEGPJ4P.js} +1 -1
- package/dist/{chunk-A4Q7W4LV.js → chunk-B3XLIBFL.js} +4 -2
- package/dist/{chunk-VHJPGKUW.js → chunk-BNYRD7PQ.js} +1 -1
- package/dist/{chunk-JN4EK6MC.js → chunk-CNPJHUOX.js} +12 -12
- package/dist/{chunk-54TV77W5.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-ASEJ2FBO.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-BB3HJLHD.js → chunk-K44HCHZN.js} +1 -1
- package/dist/chunk-KGPLIH7B.js +127 -0
- package/dist/{chunk-B4P5VDFQ.js → chunk-KMAAOHLO.js} +1 -1
- package/dist/{chunk-RKBES4XP.js → chunk-KUTT3JXL.js} +88 -28
- package/dist/{chunk-OLENCLFE.js → chunk-L274XRWA.js} +79 -6
- package/dist/{chunk-QX26JK43.js → chunk-LACFOFWX.js} +10 -10
- package/dist/chunk-LCILS4AF.js +329 -0
- package/dist/{chunk-ELACLQPC.js → chunk-LTJDUBSQ.js} +1 -1
- package/dist/{chunk-66SAATRI.js → chunk-M5B42RL5.js} +9 -9
- package/dist/{chunk-YQK445YQ.js → chunk-MI6U3OIN.js} +2 -2
- package/dist/{chunk-S7E2I3HT.js → chunk-MXB6CWVH.js} +1 -1
- package/dist/{chunk-KQESKXAC.js → chunk-OMBSUO4T.js} +2 -2
- package/dist/{chunk-UTBQSOEC.js → chunk-P7NTODQE.js} +2 -2
- package/dist/{chunk-BHVFTYSI.js → chunk-PO2SDVQA.js} +4 -1
- package/dist/{chunk-NT7EK6ET.js → chunk-RMIFSBRV.js} +1 -1
- package/dist/{chunk-URYAKNQ2.js → chunk-SFUBSJFP.js} +1 -1
- package/dist/{chunk-74JDPWQ3.js → chunk-TPIG7ZBX.js} +4 -4
- package/dist/{chunk-24GKVAEE.js → chunk-U7SASZC5.js} +10 -10
- package/dist/{chunk-TLGJRK6Q.js → chunk-VGCEMOQA.js} +5 -5
- package/dist/{normalize-U3SL5VG3.js → chunk-VHZ6DL3M.js} +3 -3
- package/dist/chunk-VX4AL2FQ.js +26 -0
- package/dist/{chunk-6VKQ5JT3.js → chunk-WX7VCRM7.js} +2 -2
- package/dist/{chunk-BYSBRF24.js → chunk-XPQSL5VS.js} +5 -120
- package/dist/{chunk-X2G54Y2V.js → chunk-Y475GD4L.js} +4 -4
- package/dist/{chunk-XIL7KT5Q.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-CNEYCO24.js → chunk-ZKDKFJCK.js} +13 -13
- package/dist/{clean-K7GYTLQE.js → clean-6QP7VAV4.js} +25 -24
- package/dist/cli.js +55 -55
- package/dist/{cloud-I3J5HTN7.js → cloud-5TME5ROM.js} +4 -4
- package/dist/{cloudrun-MJQ363PB.js → cloudrun-F5VVCVF5.js} +4 -4
- package/dist/{compare-LHW6NEFR.js → compare-XPY2EXX6.js} +21 -21
- package/dist/{component-LTPK2D3K.js → component-OPVL3PUX.js} +4 -4
- package/dist/{compositions-QGEHXGIL.js → compositions-WSEOI454.js} +15 -15
- package/dist/{delete-ATNRBUDJ.js → delete-SLMH57VH.js} +11 -11
- package/dist/{doctor-6B76R5BJ.js → doctor-QZW3EKIH.js} +16 -15
- package/dist/{events-33GOPHSS.js → events-6C3ZG7LS.js} +8 -8
- package/dist/{events-BLABPRD5.js → events-FIFWFRGC.js} +6 -6
- package/dist/{feedback-HLXEG7RT.js → feedback-VKXM7YJ5.js} +22 -22
- package/dist/{ffmpeg-5V4FP3R6.js → ffmpeg-TZB5WAYE.js} +3 -2
- package/dist/{figma-T6W7H23L.js → figma-3UYNADNA.js} +3 -3
- package/dist/fontLocalizeCli.js +4 -4
- package/dist/{get-UDMLOTKJ.js → get-VH7VMRVX.js} +11 -11
- package/dist/{grade-compare-P4CHFVBR.js → grade-compare-OSC2YQWN.js} +26 -25
- package/dist/{help-4MW6L6YB.js → help-DCBFEZPT.js} +3 -3
- package/dist/{history-336VM6SH.js → history-XYJMQE26.js} +15 -15
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-FPMIDMD5.js → info-YEHGENAH.js} +15 -15
- package/dist/{init-IWM4PWLO.js → init-64SML7PY.js} +44 -43
- package/dist/{inspect-IIG7756C.js → inspect-GFOQKRJI.js} +19 -19
- package/dist/{keyframes-TWO4BXBA.js → keyframes-ORYFWKBZ.js} +16 -16
- package/dist/{lambda-2JB2QUK2.js → lambda-DRMOJGTC.js} +6 -6
- package/dist/{layout-TPKEKFQQ.js → layout-ZEQBE6UQ.js} +19 -19
- package/dist/{lint-H3KL7KSX.js → lint-67KGFY63.js} +19 -19
- package/dist/{list-LYPO4KRE.js → list-T6OU5ARJ.js} +11 -11
- package/dist/{login-SQQWKWTD.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-KSRINVUA.js → media-treatment-NAAHID6M.js} +24 -23
- package/dist/{models-WUBF6GDB.js → models-P6XB6RWK.js} +15 -13
- package/dist/{motionShot-STKG4KYQ.js → motionShot-7MHRIV6V.js} +4 -4
- package/dist/{manager-RFZNG5YT.js → normalize-4UDISLPL.js} +14 -20
- package/dist/{normalize-audio-CA47XZ4I.js → normalize-audio-LWNFYR2F.js} +15 -15
- package/dist/{open-B5WYEM3Z.js → open-DAP5C7UD.js} +13 -13
- package/dist/{parakeetRunner-JBK2JPEH.js → parakeetRunner-3ZVFPOD4.js} +13 -23
- package/dist/{pipeline-FEAAD2RJ.js → pipeline-V4YJCPUX.js} +5 -5
- package/dist/{play-2LC5XRM6.js → play-UDCESJO3.js} +26 -26
- package/dist/{preflight-ONF5AJNO.js → preflight-JOD4OXGC.js} +5 -4
- package/dist/{present-XKYF3VGC.js → present-DXTHBH3F.js} +23 -23
- package/dist/{preview-WDPZRHE5.js → preview-YHXKRXKB.js} +29 -27
- package/dist/{publish-3OYXNY44.js → publish-UEFBFGV3.js} +15 -15
- package/dist/{refresh-PVHBEABE.js → refresh-MGCVWX56.js} +3 -3
- package/dist/{remove-background-F6QTJIPZ.js → remove-background-FMV6IDOH.js} +34 -30
- package/dist/{render-JKB6GZDB.js → render-N7QGX6RJ.js} +28 -28
- package/dist/{render-SC77I7FT.js → render-SYC4RPGT.js} +4 -4
- package/dist/{render-QQ7NUREG.js → render-ZTXNPRGF.js} +51 -50
- package/dist/{render-batch-4F44JFAB.js → render-batch-SZRPCRUJ.js} +4 -4
- package/dist/renderSetupWorker.js +4 -3
- package/dist/{sherpa-FOXB4XBN.js → sherpa-M4Z2Q5Y2.js} +11 -10
- package/dist/sherpaWorker.js +3 -1
- package/dist/{skills-GG756RCG.js → skills-NEHNSHZK.js} +15 -15
- package/dist/{skillsUpdateCheck-N2LDCNAS.js → skillsUpdateCheck-O77QR72A.js} +3 -3
- package/dist/{snapshot-2LDOY65W.js → snapshot-GDVXFBVY.js} +40 -39
- package/dist/{staticProjectServer-QBB6WUAY.js → staticProjectServer-3D2NXQ6W.js} +5 -5
- package/dist/{status-PTKNQD2E.js → status-NBRMGL7D.js} +5 -5
- package/dist/studio/assets/{hyperframes-player-BBBg-uvu.js → hyperframes-player-C-2YwYre.js} +1 -1
- package/dist/studio/assets/{index-BJIpZeuk.js → index-ByJU5J6n.js} +4 -4
- package/dist/studio/assets/{index-BXJLeCqB.js → index-BybGk67U.js} +1 -1
- package/dist/studio/assets/{index-DARhiE_i.js → index-Cfs2r3fz.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-VPTZF2AW.js → studio-api-XIBDLRHB.js} +2 -2
- package/dist/{studioServer-VZKX2MG7.js → studioServer-QIQK47UN.js} +45 -44
- package/dist/{synthesize-UCI4X5O7.js → synthesize-22B7L5GX.js} +6 -6
- package/dist/{telemetry-76XND6XK.js → telemetry-565KDZUW.js} +8 -8
- package/dist/{timeline-UJLTA4AX.js → timeline-E6XB7I6W.js} +18 -18
- package/dist/{tokens-VMWANYJY.js → tokens-3ZAJENSE.js} +3 -3
- package/dist/transcribe-WODP3T77.js +332 -0
- package/dist/{transcribe-JNOG667L.js → transcribe-XWQQCCBG.js} +9 -8
- package/dist/{tts-B6AHFQEO.js → tts-QSAQZVEZ.js} +3 -3
- package/dist/{updateCheck-WI3HYM72.js → updateCheck-QPYU4GRL.js} +2 -2
- package/dist/{upgrade-52RIOKFX.js → upgrade-2FJ5ZEN6.js} +5 -5
- package/dist/{validate-MJVNR7YY.js → validate-SP2VGNEI.js} +16 -16
- package/package.json +8 -1
- package/dist/chunk-6IHWCZ3W.js +0 -54
- package/dist/chunk-SQLK7SJL.js +0 -88
- package/dist/renderCancellation-7OEBNE2L.js +0 -43
- package/dist/transcribe-FD7A2SH3.js +0 -466
- package/dist/{bundleWithLocalizedFonts-EKRXJBXU.js → bundleWithLocalizedFonts-OE5ZI4JE.js} +3 -3
- package/dist/{chunk-DKSDVDXG.js → chunk-NAMGMP3R.js} +3 -3
- package/dist/{chunk-C24LU5XD.js → chunk-NKM53WMI.js} +5 -5
- package/dist/{chunk-O3EALI4M.js → chunk-XHBX7QN6.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
- package/dist/{video-72VNEQEI.js → video-RVNPFEA6.js} +3 -3
|
@@ -0,0 +1,332 @@
|
|
|
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
|
+
import {
|
|
8
|
+
trackTranscribeUnavailable
|
|
9
|
+
} from "./chunk-Y475GD4L.js";
|
|
10
|
+
import "./chunk-LACFOFWX.js";
|
|
11
|
+
import "./chunk-VWG7OQKU.js";
|
|
12
|
+
import "./chunk-XBSPQ52S.js";
|
|
13
|
+
import {
|
|
14
|
+
ft
|
|
15
|
+
} from "./chunk-WMQNIQDJ.js";
|
|
16
|
+
import {
|
|
17
|
+
defineCommand
|
|
18
|
+
} from "./chunk-S3S4TGEH.js";
|
|
19
|
+
import "./chunk-54HJ63Q2.js";
|
|
20
|
+
import {
|
|
21
|
+
failCommand,
|
|
22
|
+
setCommandExitCode
|
|
23
|
+
} from "./chunk-PBN6GBJE.js";
|
|
24
|
+
import {
|
|
25
|
+
c
|
|
26
|
+
} from "./chunk-ZTZA4UWZ.js";
|
|
27
|
+
import "./chunk-K4WIOZFP.js";
|
|
28
|
+
import "./chunk-XUXGIA7H.js";
|
|
29
|
+
import "./chunk-WERLJGIC.js";
|
|
30
|
+
import "./chunk-ISN5GRYI.js";
|
|
31
|
+
import "./chunk-OMBSUO4T.js";
|
|
32
|
+
import {
|
|
33
|
+
MIN_TIMEOUT_MS,
|
|
34
|
+
TranscribeError,
|
|
35
|
+
runTranscribe
|
|
36
|
+
} from "./chunk-LCILS4AF.js";
|
|
37
|
+
import "./chunk-VX4AL2FQ.js";
|
|
38
|
+
import "./chunk-CT6ZQRLD.js";
|
|
39
|
+
import "./chunk-BXCMXMJQ.js";
|
|
40
|
+
import "./chunk-3DKN5WKL.js";
|
|
41
|
+
import "./chunk-EOVYQ3IG.js";
|
|
42
|
+
import {
|
|
43
|
+
createProgressWriter
|
|
44
|
+
} from "./chunk-KUTT3JXL.js";
|
|
45
|
+
import "./chunk-P7NTODQE.js";
|
|
46
|
+
import "./chunk-VHZ6DL3M.js";
|
|
47
|
+
import "./chunk-6BEFEWFB.js";
|
|
48
|
+
import {
|
|
49
|
+
DEFAULT_MODEL
|
|
50
|
+
} from "./chunk-CZQLCBWY.js";
|
|
51
|
+
import "./chunk-PO2SDVQA.js";
|
|
52
|
+
import "./chunk-DUUFDLC4.js";
|
|
53
|
+
import "./chunk-AMKC3AXA.js";
|
|
54
|
+
import "./chunk-VC7JBNPS.js";
|
|
55
|
+
import "./chunk-62RUQJ5J.js";
|
|
56
|
+
import "./chunk-NE55C6S5.js";
|
|
57
|
+
import "./chunk-JYVGYKXG.js";
|
|
58
|
+
import "./chunk-AHBYQRGI.js";
|
|
59
|
+
import "./chunk-3WD4JNMU.js";
|
|
60
|
+
import "./chunk-VC76R6W2.js";
|
|
61
|
+
import "./chunk-YA62XGXS.js";
|
|
62
|
+
import "./chunk-LFNQDTSH.js";
|
|
63
|
+
import "./chunk-OFQWTKPW.js";
|
|
64
|
+
import "./chunk-DPVXBVLL.js";
|
|
65
|
+
import "./chunk-T76PLPD6.js";
|
|
66
|
+
import "./chunk-FXMKHHPO.js";
|
|
67
|
+
import "./chunk-RQVDTPGD.js";
|
|
68
|
+
import "./chunk-B3XLIBFL.js";
|
|
69
|
+
import "./chunk-XPQSL5VS.js";
|
|
70
|
+
import "./chunk-TWWSYAKJ.js";
|
|
71
|
+
import "./chunk-JDB65PPT.js";
|
|
72
|
+
import "./chunk-IWFLMU2N.js";
|
|
73
|
+
import "./chunk-APDLWWFG.js";
|
|
74
|
+
import "./chunk-VAS6HQX3.js";
|
|
75
|
+
import "./chunk-3RM2ETQT.js";
|
|
76
|
+
import "./chunk-BSQ7XANM.js";
|
|
77
|
+
import "./chunk-SDYDNHEE.js";
|
|
78
|
+
import "./chunk-2PSPARWP.js";
|
|
79
|
+
import "./chunk-IXLUTE6N.js";
|
|
80
|
+
import "./chunk-KNU5COPB.js";
|
|
81
|
+
import "./chunk-JZIEZCQM.js";
|
|
82
|
+
import "./chunk-UOFAE5RF.js";
|
|
83
|
+
import "./chunk-IR35BCLK.js";
|
|
84
|
+
import "./chunk-HU2SPFNG.js";
|
|
85
|
+
import "./chunk-KGPLIH7B.js";
|
|
86
|
+
import "./chunk-3GXQPCJC.js";
|
|
87
|
+
import "./chunk-M2WBOQ2Q.js";
|
|
88
|
+
|
|
89
|
+
// src/commands/transcribe.ts
|
|
90
|
+
var examples = [
|
|
91
|
+
["Transcribe an audio file", "hyperframes transcribe audio.mp3"],
|
|
92
|
+
["Transcribe a video file", "hyperframes transcribe video.mp4"],
|
|
93
|
+
["Use a larger model for better accuracy", "hyperframes transcribe audio.mp3 --model medium.en"],
|
|
94
|
+
["Set language to filter non-target speech", "hyperframes transcribe audio.mp3 --language en"],
|
|
95
|
+
["Import an existing SRT file", "hyperframes transcribe subtitles.srt"],
|
|
96
|
+
["Import an OpenAI Whisper JSON response", "hyperframes transcribe response.json"],
|
|
97
|
+
["Export captions to SRT", "hyperframes transcribe transcript.json --to srt"],
|
|
98
|
+
["Transcribe a video straight to VTT captions", "hyperframes transcribe video.mp4 --to vtt"],
|
|
99
|
+
[
|
|
100
|
+
"Export single-word/CJK captions without re-grouping",
|
|
101
|
+
"hyperframes transcribe transcript.json --to vtt --preserve-cues"
|
|
102
|
+
]
|
|
103
|
+
];
|
|
104
|
+
var transcribe_default = defineCommand({
|
|
105
|
+
meta: {
|
|
106
|
+
name: "transcribe",
|
|
107
|
+
description: "Transcribe audio/video to word-level timestamps, or import an existing transcript"
|
|
108
|
+
},
|
|
109
|
+
args: {
|
|
110
|
+
input: {
|
|
111
|
+
type: "positional",
|
|
112
|
+
description: "Audio/video file to transcribe, or transcript file to import (.json, .srt, .vtt)",
|
|
113
|
+
required: true
|
|
114
|
+
},
|
|
115
|
+
dir: {
|
|
116
|
+
type: "string",
|
|
117
|
+
description: "Project directory (default: current directory)",
|
|
118
|
+
alias: "d"
|
|
119
|
+
},
|
|
120
|
+
engine: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "ASR engine: auto (Parakeet if installed and it covers --language, else whisper), parakeet, or whisper. Default: auto. Parakeet is more accurate and faster; install it with `hyperframes models install parakeet`.",
|
|
123
|
+
alias: "e"
|
|
124
|
+
},
|
|
125
|
+
model: {
|
|
126
|
+
type: "string",
|
|
127
|
+
description: `Whisper model (default: ${DEFAULT_MODEL}). Options: tiny.en, base.en, small.en, medium.en, large-v3`,
|
|
128
|
+
alias: "m"
|
|
129
|
+
},
|
|
130
|
+
language: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "Language code (e.g. en, es, ja). Whisper transcribes as this language; Parakeet, used when it covers it, detects the language itself.",
|
|
133
|
+
alias: "l"
|
|
134
|
+
},
|
|
135
|
+
json: {
|
|
136
|
+
type: "boolean",
|
|
137
|
+
description: "Output result as JSON; progress JSON lines go to stderr",
|
|
138
|
+
default: false
|
|
139
|
+
},
|
|
140
|
+
to: {
|
|
141
|
+
type: "string",
|
|
142
|
+
description: "Write an srt or vtt caption sidecar: exported from a transcript file, or written after transcribing audio/video"
|
|
143
|
+
},
|
|
144
|
+
output: {
|
|
145
|
+
type: "string",
|
|
146
|
+
alias: "o",
|
|
147
|
+
description: "Output path for exported SRT/VTT sidecar"
|
|
148
|
+
},
|
|
149
|
+
"preserve-cues": {
|
|
150
|
+
type: "boolean",
|
|
151
|
+
description: "Keep each transcript entry as its own caption cue (skip word-level grouping). Use when exporting an already-cued transcript whose entries have no internal spaces, e.g. single-word or CJK captions.",
|
|
152
|
+
default: false
|
|
153
|
+
},
|
|
154
|
+
"runtime-install": {
|
|
155
|
+
type: "boolean",
|
|
156
|
+
default: true,
|
|
157
|
+
description: "Allow installing the Whisper runtime. Use --no-runtime-install to require an existing runtime; model downloads remain allowed."
|
|
158
|
+
},
|
|
159
|
+
optional: {
|
|
160
|
+
type: "boolean",
|
|
161
|
+
description: "Treat captions as optional: if whisper-cpp is unavailable, skip and exit 0 instead of failing. For pipelines that continue without captions.",
|
|
162
|
+
default: false
|
|
163
|
+
},
|
|
164
|
+
timeout: {
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "Whisper spawn timeout in ms. Overrides the duration+model auto-scaled default. Increase on slow CPUs (e.g. emulated arm64/x64, low-power laptops) where whisper.cpp takes many seconds per audio second on medium/large models. Applies to the whisper engine only; Parakeet has a separate fixed timeout. Minimum 5000 (5 s). Env: HYPERFRAMES_TRANSCRIBE_TIMEOUT_MS."
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
async run({ args }) {
|
|
170
|
+
const { json } = args;
|
|
171
|
+
const ui = { spin: null };
|
|
172
|
+
let result;
|
|
173
|
+
try {
|
|
174
|
+
result = await runTranscribe({
|
|
175
|
+
input: args.input,
|
|
176
|
+
dir: args.dir,
|
|
177
|
+
engine: args.engine,
|
|
178
|
+
model: args.model,
|
|
179
|
+
language: args.language,
|
|
180
|
+
installRuntime: args["runtime-install"],
|
|
181
|
+
timeoutMs: readTimeout(args.timeout)?.ms,
|
|
182
|
+
captions: { format: args.to, outputPath: args.output, preserveCues: args["preserve-cues"] },
|
|
183
|
+
stopOnProcessSignals: true,
|
|
184
|
+
onStatus: json ? void 0 : (message) => ui.spin?.message(message),
|
|
185
|
+
onProgress: json ? createProgressWriter(process.stderr) : void 0,
|
|
186
|
+
onEngine: (event) => {
|
|
187
|
+
ui.spin = showEngine(event, ui.spin, { json, model: args.model });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
} catch (err) {
|
|
191
|
+
if (!(err instanceof TranscribeError)) throw err;
|
|
192
|
+
if (isRunFailure(err)) {
|
|
193
|
+
reportRunFailure(err, ui.spin, { json, optional: args.optional === true });
|
|
194
|
+
} else {
|
|
195
|
+
reportSetupFailure(err, json, args.timeout);
|
|
196
|
+
}
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
reportResult(result, json, ui.spin);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
function readTimeout(raw) {
|
|
203
|
+
const source = raw ?? process.env["HYPERFRAMES_TRANSCRIBE_TIMEOUT_MS"];
|
|
204
|
+
if (source == null || source === "") return void 0;
|
|
205
|
+
const origin = raw != null ? "--timeout" : "HYPERFRAMES_TRANSCRIBE_TIMEOUT_MS";
|
|
206
|
+
return { ms: Number.parseInt(source, 10), source, origin };
|
|
207
|
+
}
|
|
208
|
+
function showEngine(event, spin, opts) {
|
|
209
|
+
const label = c.accent(event.runner === "whisper" ? opts.model ?? DEFAULT_MODEL : "Parakeet");
|
|
210
|
+
if (event.fallbackReason !== void 0) {
|
|
211
|
+
spin?.clear();
|
|
212
|
+
console.error(c.warn(`${event.fallbackReason}. Using ${event.runner} for this run.`));
|
|
213
|
+
spin?.start(`Transcribing with ${label}...`);
|
|
214
|
+
return spin;
|
|
215
|
+
}
|
|
216
|
+
if (event.runner !== "whisper" && opts.model && !opts.json) {
|
|
217
|
+
console.error(
|
|
218
|
+
c.dim(` Note: --model applies to the whisper engine only; ignored under Parakeet.`)
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
const started = opts.json ? null : ft();
|
|
222
|
+
started?.start(`Transcribing with ${label}...`);
|
|
223
|
+
return started;
|
|
224
|
+
}
|
|
225
|
+
function failWith(message, json) {
|
|
226
|
+
if (json) {
|
|
227
|
+
console.log(JSON.stringify({ ok: false, error: message }));
|
|
228
|
+
} else {
|
|
229
|
+
console.error(c.error(message));
|
|
230
|
+
}
|
|
231
|
+
failCommand(1, message);
|
|
232
|
+
}
|
|
233
|
+
function isRunFailure(err) {
|
|
234
|
+
if (err.code === "caption_write_failed") return err.transcriptPath !== void 0;
|
|
235
|
+
return err.code === "cancelled" || err.code === "whisper_unavailable" || err.code === "failed";
|
|
236
|
+
}
|
|
237
|
+
function reportSetupFailure(err, json, timeoutFlag) {
|
|
238
|
+
if (err.code === "input_not_found") {
|
|
239
|
+
console.error(c.error(err.message));
|
|
240
|
+
failCommand(1, err.message);
|
|
241
|
+
}
|
|
242
|
+
if (err.code === "invalid_transcript") throw err.cause;
|
|
243
|
+
const timeout = err.code === "invalid_timeout" ? readTimeout(timeoutFlag) : void 0;
|
|
244
|
+
if (timeout) {
|
|
245
|
+
failWith(
|
|
246
|
+
`Invalid ${timeout.origin}: "${timeout.source}". Must be an integer >= ${MIN_TIMEOUT_MS} (ms).`,
|
|
247
|
+
json
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
failWith(err.message, json);
|
|
251
|
+
}
|
|
252
|
+
function reportRunFailure(err, spin, opts) {
|
|
253
|
+
if (err.code === "whisper_unavailable") return reportWhisperUnavailable(err, spin, opts);
|
|
254
|
+
if (err.code === "cancelled" || err.code === "caption_write_failed") {
|
|
255
|
+
if (opts.json) console.log(JSON.stringify({ ok: false, error: err.message }));
|
|
256
|
+
else spin?.stop(err.code === "cancelled" ? c.warn(err.message) : c.error(err.message));
|
|
257
|
+
setCommandExitCode(err.code === "cancelled" ? 130 : 1);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (opts.json) {
|
|
261
|
+
console.log(JSON.stringify({ ok: false, error: err.message }));
|
|
262
|
+
} else {
|
|
263
|
+
spin?.stop(c.error(`Transcription failed: ${err.message}`));
|
|
264
|
+
}
|
|
265
|
+
failCommand(1, err.cause);
|
|
266
|
+
}
|
|
267
|
+
function reportWhisperUnavailable(err, spin, opts) {
|
|
268
|
+
trackTranscribeUnavailable({ optional: opts.optional });
|
|
269
|
+
const { install } = err;
|
|
270
|
+
if (opts.json) {
|
|
271
|
+
console.log(
|
|
272
|
+
JSON.stringify({ ok: false, skipped: true, reason: "whisper_unavailable", install })
|
|
273
|
+
);
|
|
274
|
+
} else {
|
|
275
|
+
const orParakeet = install ? `
|
|
276
|
+
Or transcribe with Parakeet after: ${install}` : "";
|
|
277
|
+
spin?.stop(c.warn(`Captions skipped \u2014 ${err.message}${orParakeet}`));
|
|
278
|
+
}
|
|
279
|
+
setCommandExitCode(opts.optional ? 0 : 1);
|
|
280
|
+
}
|
|
281
|
+
function reportSidecar(to, wordCount, outPath) {
|
|
282
|
+
console.log(
|
|
283
|
+
`${c.success("\u25C7")} Exported ${c.accent(String(wordCount))} words to ${c.accent(to.toUpperCase())} \u2192 ${c.accent(outPath)}`
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
function reportResult(result, json, spin) {
|
|
287
|
+
if (result.kind === "imported") {
|
|
288
|
+
const { format, wordCount, transcriptPath } = result;
|
|
289
|
+
if (json) {
|
|
290
|
+
console.log(JSON.stringify({ ok: true, format, wordCount, transcriptPath }));
|
|
291
|
+
} else {
|
|
292
|
+
console.log(
|
|
293
|
+
`${c.success("\u25C7")} Imported ${c.accent(String(wordCount))} words from ${c.accent(format)} format \u2192 ${c.accent("transcript.json")}`
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (result.kind === "exported") {
|
|
299
|
+
const { format, wordCount, outputPath } = result;
|
|
300
|
+
if (json) console.log(JSON.stringify({ ok: true, format, wordCount, outputPath }));
|
|
301
|
+
else reportSidecar(format, wordCount, outputPath);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const { captions } = result;
|
|
305
|
+
if (json) {
|
|
306
|
+
console.log(
|
|
307
|
+
JSON.stringify({
|
|
308
|
+
ok: true,
|
|
309
|
+
engine: result.engine,
|
|
310
|
+
model: result.model,
|
|
311
|
+
detectedLanguage: result.detectedLanguage,
|
|
312
|
+
wordCount: result.wordCount,
|
|
313
|
+
durationSeconds: result.durationSeconds,
|
|
314
|
+
speechOnsetSeconds: result.speechOnsetSeconds,
|
|
315
|
+
transcriptPath: result.transcriptPath,
|
|
316
|
+
...captions
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const onsetNote = result.speechOnsetSeconds != null ? ` \u2014 speech detected at ${result.speechOnsetSeconds.toFixed(1)}s` : "";
|
|
322
|
+
spin?.stop(
|
|
323
|
+
c.success(
|
|
324
|
+
`Transcribed ${c.accent(String(result.wordCount))} words (${result.durationSeconds.toFixed(1)}s${onsetNote})`
|
|
325
|
+
)
|
|
326
|
+
);
|
|
327
|
+
if (captions) reportSidecar(captions.format, result.wordCount, captions.outputPath);
|
|
328
|
+
}
|
|
329
|
+
export {
|
|
330
|
+
transcribe_default as default,
|
|
331
|
+
examples
|
|
332
|
+
};
|
|
@@ -18,12 +18,11 @@ import {
|
|
|
18
18
|
transcribe,
|
|
19
19
|
whisperModelSlowdownFactor,
|
|
20
20
|
wrapWhisperTimeoutError
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-SYUGVPYH.js";
|
|
21
|
+
} from "./chunk-KUTT3JXL.js";
|
|
22
|
+
import "./chunk-P7NTODQE.js";
|
|
23
|
+
import "./chunk-CZQLCBWY.js";
|
|
24
|
+
import "./chunk-PO2SDVQA.js";
|
|
25
|
+
import "./chunk-DUUFDLC4.js";
|
|
27
26
|
import "./chunk-AMKC3AXA.js";
|
|
28
27
|
import "./chunk-VC7JBNPS.js";
|
|
29
28
|
import "./chunk-62RUQJ5J.js";
|
|
@@ -39,8 +38,8 @@ import "./chunk-DPVXBVLL.js";
|
|
|
39
38
|
import "./chunk-T76PLPD6.js";
|
|
40
39
|
import "./chunk-FXMKHHPO.js";
|
|
41
40
|
import "./chunk-RQVDTPGD.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-B3XLIBFL.js";
|
|
42
|
+
import "./chunk-XPQSL5VS.js";
|
|
44
43
|
import "./chunk-TWWSYAKJ.js";
|
|
45
44
|
import "./chunk-JDB65PPT.js";
|
|
46
45
|
import "./chunk-IWFLMU2N.js";
|
|
@@ -54,6 +53,8 @@ import "./chunk-IXLUTE6N.js";
|
|
|
54
53
|
import "./chunk-KNU5COPB.js";
|
|
55
54
|
import "./chunk-UOFAE5RF.js";
|
|
56
55
|
import "./chunk-IR35BCLK.js";
|
|
56
|
+
import "./chunk-HU2SPFNG.js";
|
|
57
|
+
import "./chunk-KGPLIH7B.js";
|
|
57
58
|
import "./chunk-3GXQPCJC.js";
|
|
58
59
|
import "./chunk-M2WBOQ2Q.js";
|
|
59
60
|
export {
|
|
@@ -10,11 +10,10 @@ import {
|
|
|
10
10
|
SUPPORTED_LANGS,
|
|
11
11
|
inferLangFromVoiceId,
|
|
12
12
|
isSupportedLang
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DNZMBQTH.js";
|
|
14
14
|
import {
|
|
15
15
|
errorBox
|
|
16
16
|
} from "./chunk-K2FLNJVB.js";
|
|
17
|
-
import "./chunk-BHVFTYSI.js";
|
|
18
17
|
import {
|
|
19
18
|
ft
|
|
20
19
|
} from "./chunk-WMQNIQDJ.js";
|
|
@@ -31,6 +30,7 @@ import {
|
|
|
31
30
|
import {
|
|
32
31
|
c
|
|
33
32
|
} from "./chunk-ZTZA4UWZ.js";
|
|
33
|
+
import "./chunk-PO2SDVQA.js";
|
|
34
34
|
import "./chunk-M2WBOQ2Q.js";
|
|
35
35
|
|
|
36
36
|
// src/commands/tts.ts
|
|
@@ -152,7 +152,7 @@ var tts_default = defineCommand({
|
|
|
152
152
|
)
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
|
-
const { synthesize } = await import("./synthesize-
|
|
155
|
+
const { synthesize } = await import("./synthesize-22B7L5GX.js");
|
|
156
156
|
const spin = args.json ? null : ft();
|
|
157
157
|
spin?.start(`Generating speech with ${c.accent(voice)} (${lang})...`);
|
|
158
158
|
try {
|
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
updateCheckDue,
|
|
17
17
|
updateNoticesSuppressed,
|
|
18
18
|
withMeta
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GESJSXFH.js";
|
|
20
20
|
import "./chunk-K4WIOZFP.js";
|
|
21
21
|
import "./chunk-XUXGIA7H.js";
|
|
22
22
|
import "./chunk-WERLJGIC.js";
|
|
23
23
|
import "./chunk-ISN5GRYI.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-OMBSUO4T.js";
|
|
25
25
|
import "./chunk-KNU5COPB.js";
|
|
26
26
|
import "./chunk-M2WBOQ2Q.js";
|
|
27
27
|
export {
|
|
@@ -17,6 +17,9 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
setCommandExitCode
|
|
19
19
|
} from "./chunk-PBN6GBJE.js";
|
|
20
|
+
import {
|
|
21
|
+
c
|
|
22
|
+
} from "./chunk-ZTZA4UWZ.js";
|
|
20
23
|
import {
|
|
21
24
|
checkForUpdate,
|
|
22
25
|
detectInstaller,
|
|
@@ -25,18 +28,15 @@ import {
|
|
|
25
28
|
rewritePinnedHyperframesText,
|
|
26
29
|
rewriteProjectPinnedScripts,
|
|
27
30
|
withMeta
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-GESJSXFH.js";
|
|
29
32
|
import "./chunk-K4WIOZFP.js";
|
|
30
33
|
import "./chunk-XUXGIA7H.js";
|
|
31
34
|
import "./chunk-WERLJGIC.js";
|
|
32
35
|
import "./chunk-ISN5GRYI.js";
|
|
33
36
|
import {
|
|
34
37
|
VERSION
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-OMBSUO4T.js";
|
|
36
39
|
import "./chunk-KNU5COPB.js";
|
|
37
|
-
import {
|
|
38
|
-
c
|
|
39
|
-
} from "./chunk-ZTZA4UWZ.js";
|
|
40
40
|
import "./chunk-M2WBOQ2Q.js";
|
|
41
41
|
|
|
42
42
|
// src/commands/upgrade.ts
|
|
@@ -14,34 +14,41 @@ import {
|
|
|
14
14
|
shouldIgnoreHttpError,
|
|
15
15
|
shouldIgnoreRequestFailure,
|
|
16
16
|
validate_default
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-74JDPWQ3.js";
|
|
17
|
+
} from "./chunk-CNPJHUOX.js";
|
|
18
|
+
import "./chunk-TPIG7ZBX.js";
|
|
20
19
|
import "./chunk-FH7WODJH.js";
|
|
21
20
|
import "./chunk-4S4VUXW3.js";
|
|
22
21
|
import "./chunk-KQHJKJ3V.js";
|
|
23
22
|
import "./chunk-WPNE5NEP.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-C24LU5XD.js";
|
|
23
|
+
import "./chunk-NKM53WMI.js";
|
|
26
24
|
import "./chunk-2HWB4TCI.js";
|
|
27
25
|
import "./chunk-FJWEYVEM.js";
|
|
28
26
|
import "./chunk-ZFN6GQU4.js";
|
|
29
27
|
import "./chunk-KMJLHHBF.js";
|
|
30
28
|
import "./chunk-AIJS74LG.js";
|
|
31
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-SFUBSJFP.js";
|
|
30
|
+
import "./chunk-K2FLNJVB.js";
|
|
32
31
|
import "./chunk-QIJLIULK.js";
|
|
33
32
|
import "./chunk-442JNXRM.js";
|
|
34
33
|
import "./chunk-374QQGBQ.js";
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-Y475GD4L.js";
|
|
35
|
+
import "./chunk-LACFOFWX.js";
|
|
37
36
|
import "./chunk-VWG7OQKU.js";
|
|
38
37
|
import "./chunk-XBSPQ52S.js";
|
|
39
|
-
import "./chunk-AMKC3AXA.js";
|
|
40
38
|
import "./chunk-S3S4TGEH.js";
|
|
41
39
|
import "./chunk-54HJ63Q2.js";
|
|
42
40
|
import "./chunk-PBN6GBJE.js";
|
|
41
|
+
import "./chunk-ZTZA4UWZ.js";
|
|
43
42
|
import "./chunk-EOOEC32M.js";
|
|
44
43
|
import "./chunk-TJSTGSAW.js";
|
|
44
|
+
import "./chunk-GESJSXFH.js";
|
|
45
|
+
import "./chunk-K4WIOZFP.js";
|
|
46
|
+
import "./chunk-XUXGIA7H.js";
|
|
47
|
+
import "./chunk-WERLJGIC.js";
|
|
48
|
+
import "./chunk-ISN5GRYI.js";
|
|
49
|
+
import "./chunk-OMBSUO4T.js";
|
|
50
|
+
import "./chunk-EOVYQ3IG.js";
|
|
51
|
+
import "./chunk-AMKC3AXA.js";
|
|
45
52
|
import "./chunk-VC7JBNPS.js";
|
|
46
53
|
import "./chunk-62RUQJ5J.js";
|
|
47
54
|
import "./chunk-NE55C6S5.js";
|
|
@@ -66,15 +73,8 @@ import "./chunk-BSQ7XANM.js";
|
|
|
66
73
|
import "./chunk-SDYDNHEE.js";
|
|
67
74
|
import "./chunk-2PSPARWP.js";
|
|
68
75
|
import "./chunk-IXLUTE6N.js";
|
|
69
|
-
import "./chunk-ASEJ2FBO.js";
|
|
70
|
-
import "./chunk-K4WIOZFP.js";
|
|
71
|
-
import "./chunk-XUXGIA7H.js";
|
|
72
|
-
import "./chunk-WERLJGIC.js";
|
|
73
|
-
import "./chunk-ISN5GRYI.js";
|
|
74
|
-
import "./chunk-KQESKXAC.js";
|
|
75
76
|
import "./chunk-KNU5COPB.js";
|
|
76
77
|
import "./chunk-3GXQPCJC.js";
|
|
77
|
-
import "./chunk-ZTZA4UWZ.js";
|
|
78
78
|
import "./chunk-M2WBOQ2Q.js";
|
|
79
79
|
export {
|
|
80
80
|
auditClipDurations,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperframes",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.149",
|
|
4
4
|
"description": "HyperFrames CLI — create, preview, and render HTML video compositions",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
"./api": {
|
|
22
|
+
"import": "./dist/api.js",
|
|
23
|
+
"types": "./dist/api.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
20
27
|
"scripts": {
|
|
21
28
|
"test": "vitest run",
|
|
22
29
|
"dev": "tsx src/cli.ts",
|
package/dist/chunk-6IHWCZ3W.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
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/whisper/progress.ts
|
|
9
|
-
var DESKTOP_MAX_LINE_BYTES = 16e3;
|
|
10
|
-
function emitWords(onEvent, model, words, through) {
|
|
11
|
-
const empty = Buffer.byteLength(JSON.stringify({ type: "words", model, words: [], through })) + 1;
|
|
12
|
-
let chunk = [];
|
|
13
|
-
let bytes = empty;
|
|
14
|
-
for (const word of words) {
|
|
15
|
-
const size = Buffer.byteLength(JSON.stringify(word)) + 1;
|
|
16
|
-
if (chunk.length > 0 && bytes + size > DESKTOP_MAX_LINE_BYTES) {
|
|
17
|
-
onEvent({ type: "words", model, words: chunk, through: chunk.at(-1).end });
|
|
18
|
-
chunk = [];
|
|
19
|
-
bytes = empty;
|
|
20
|
-
}
|
|
21
|
-
chunk.push(word);
|
|
22
|
-
bytes += size;
|
|
23
|
-
}
|
|
24
|
-
onEvent({ type: "words", model, words: chunk, through });
|
|
25
|
-
}
|
|
26
|
-
function createProgressWriter(stream) {
|
|
27
|
-
let blocked = false;
|
|
28
|
-
const pending = [];
|
|
29
|
-
const write = (event) => {
|
|
30
|
-
if (blocked) {
|
|
31
|
-
const previous = pending.at(-1);
|
|
32
|
-
if (event.type === "progress" && event.phase === "download" && previous?.type === "progress" && previous.phase === "download" && previous.model === event.model) {
|
|
33
|
-
pending[pending.length - 1] = event;
|
|
34
|
-
} else {
|
|
35
|
-
pending.push(event);
|
|
36
|
-
}
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
blocked = !stream.write(`${JSON.stringify(event)}
|
|
40
|
-
`);
|
|
41
|
-
if (blocked) {
|
|
42
|
-
stream.once("drain", () => {
|
|
43
|
-
blocked = false;
|
|
44
|
-
while (!blocked && pending.length > 0) write(pending.shift());
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
return write;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
emitWords,
|
|
53
|
-
createProgressWriter
|
|
54
|
-
};
|
package/dist/chunk-SQLK7SJL.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
import {
|
|
8
|
-
downloadFile
|
|
9
|
-
} from "./chunk-BHVFTYSI.js";
|
|
10
|
-
|
|
11
|
-
// src/background-removal/manager.ts
|
|
12
|
-
import { existsSync, mkdirSync } from "fs";
|
|
13
|
-
import { homedir, platform, arch } from "os";
|
|
14
|
-
import { join } from "path";
|
|
15
|
-
var MODELS_DIR = join(homedir(), ".cache", "hyperframes", "background-removal", "models");
|
|
16
|
-
var DEFAULT_MODEL = "u2net_human_seg";
|
|
17
|
-
var MODEL_URLS = {
|
|
18
|
-
u2net_human_seg: "https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx"
|
|
19
|
-
};
|
|
20
|
-
var MODEL_MEMORY_MB = {
|
|
21
|
-
u2net_human_seg: 1500
|
|
22
|
-
};
|
|
23
|
-
var DEVICES = ["auto", "cpu", "coreml", "cuda"];
|
|
24
|
-
function isDevice(value) {
|
|
25
|
-
return typeof value === "string" && DEVICES.includes(value);
|
|
26
|
-
}
|
|
27
|
-
function selectProviders(device = "auto") {
|
|
28
|
-
if (device === "cpu") return { providers: ["cpu"], label: "CPU" };
|
|
29
|
-
const available = listAvailableProviders();
|
|
30
|
-
const hasCoreML = available.includes("coreml");
|
|
31
|
-
const hasCUDA = available.includes("cuda");
|
|
32
|
-
if (device === "coreml") {
|
|
33
|
-
if (!hasCoreML) {
|
|
34
|
-
throw new Error(
|
|
35
|
-
"CoreML execution provider not available. Install onnxruntime-node on Apple Silicon, or use --device cpu."
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
return { providers: ["coreml", "cpu"], label: "CoreML" };
|
|
39
|
-
}
|
|
40
|
-
if (device === "cuda") {
|
|
41
|
-
if (!hasCUDA) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"CUDA execution provider not available. Use --device cpu or install an onnxruntime-node build with CUDA support."
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return { providers: ["cuda", "cpu"], label: "CUDA" };
|
|
47
|
-
}
|
|
48
|
-
if (hasCoreML && platform() === "darwin" && arch() === "arm64") {
|
|
49
|
-
return { providers: ["coreml", "cpu"], label: "CoreML" };
|
|
50
|
-
}
|
|
51
|
-
if (hasCUDA) return { providers: ["cuda", "cpu"], label: "CUDA" };
|
|
52
|
-
return { providers: ["cpu"], label: "CPU" };
|
|
53
|
-
}
|
|
54
|
-
var _cachedProviders;
|
|
55
|
-
function listAvailableProviders() {
|
|
56
|
-
if (_cachedProviders) return _cachedProviders;
|
|
57
|
-
const out = ["cpu"];
|
|
58
|
-
if (platform() === "darwin" && arch() === "arm64") out.push("coreml");
|
|
59
|
-
if (process.env["HYPERFRAMES_CUDA"] === "1") out.push("cuda");
|
|
60
|
-
_cachedProviders = out;
|
|
61
|
-
return out;
|
|
62
|
-
}
|
|
63
|
-
function modelPath(model = DEFAULT_MODEL) {
|
|
64
|
-
return join(MODELS_DIR, `${model}.onnx`);
|
|
65
|
-
}
|
|
66
|
-
async function ensureModel(model = DEFAULT_MODEL, options) {
|
|
67
|
-
const dest = modelPath(model);
|
|
68
|
-
if (existsSync(dest)) return dest;
|
|
69
|
-
mkdirSync(MODELS_DIR, { recursive: true });
|
|
70
|
-
options?.onProgress?.(`Downloading ${model} weights (~168 MB)...`);
|
|
71
|
-
await downloadFile(MODEL_URLS[model], dest);
|
|
72
|
-
if (!existsSync(dest)) {
|
|
73
|
-
throw new Error(`Model download failed: ${model}`);
|
|
74
|
-
}
|
|
75
|
-
return dest;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
MODELS_DIR,
|
|
80
|
-
DEFAULT_MODEL,
|
|
81
|
-
MODEL_MEMORY_MB,
|
|
82
|
-
DEVICES,
|
|
83
|
-
isDevice,
|
|
84
|
-
selectProviders,
|
|
85
|
-
listAvailableProviders,
|
|
86
|
-
modelPath,
|
|
87
|
-
ensureModel
|
|
88
|
-
};
|