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.
Files changed (184) hide show
  1. package/dist/{add-5CNUY3EW.js → add-MG53577L.js} +18 -18
  2. package/dist/{animatedGifPrep-ZID2XJRQ.js → animatedGifPrep-HV4ZFVPV.js} +5 -5
  3. package/dist/api.d.ts +209 -0
  4. package/dist/api.js +75 -0
  5. package/dist/{asset-TFEENZ7K.js → asset-3GIBXLLL.js} +3 -3
  6. package/dist/{assetCataloger-GX4B55VB.js → assetCataloger-JJQ4JW2P.js} +2 -2
  7. package/dist/{auth-EJVZW6C3.js → auth-XQMT727H.js} +4 -4
  8. package/dist/{autoUpdate-MBNEZ2U4.js → autoUpdate-CREZJGMU.js} +2 -2
  9. package/dist/{backgroundChecks-DNW5NPTY.js → backgroundChecks-K3S5QKR3.js} +3 -3
  10. package/dist/backgroundChecksWorker.js +3 -3
  11. package/dist/{batchRender-T7S2CGJE.js → batchRender-42AKNX73.js} +6 -6
  12. package/dist/{beats-STXBGN6Z.js → beats-Y7IKETUS.js} +21 -21
  13. package/dist/{benchmark-AC6IGEQP.js → benchmark-22SAXSO5.js} +18 -18
  14. package/dist/{browser-FB5AK32T.js → browser-ABNISCC3.js} +14 -13
  15. package/dist/{bundleWithLocalizedFonts-HSCWGCFO.js → bundleWithLocalizedFonts-OE5ZI4JE.js} +5 -5
  16. package/dist/{capture-VEIVUHWB.js → capture-DBNHO4WJ.js} +2 -2
  17. package/dist/{capture-I24MXH3Y.js → capture-HQG5W42I.js} +19 -19
  18. package/dist/{catalog-JRC4VTTI.js → catalog-KICZFIDX.js} +34 -34
  19. package/dist/{catch-up-NTCK7Z3G.js → catch-up-ZCQUCI45.js} +13 -13
  20. package/dist/{check-7M7W4LPN.js → check-TGXIICEF.js} +48 -48
  21. package/dist/{checkBrowser-2YRVCAYB.js → checkBrowser-3N23I56J.js} +36 -36
  22. package/dist/{chunk-A72OAGNB.js → chunk-2HWB4TCI.js} +1 -1
  23. package/dist/chunk-3WD4JNMU.js +3795 -0
  24. package/dist/{chunk-XOJDBRNF.js → chunk-4S4VUXW3.js} +1 -1
  25. package/dist/{chunk-JBQJKC23.js → chunk-62RUQJ5J.js} +1 -1
  26. package/dist/{chunk-A6S35NYA.js → chunk-7IEGPJ4P.js} +1 -1
  27. package/dist/{chunk-BAKPN2D2.js → chunk-AHBYQRGI.js} +1 -1
  28. package/dist/{chunk-H7B6JSHI.js → chunk-AY2BONTF.js} +1 -1
  29. package/dist/{chunk-A4Q7W4LV.js → chunk-B3XLIBFL.js} +4 -2
  30. package/dist/{chunk-ZVZSFDW3.js → chunk-BNYRD7PQ.js} +2 -2
  31. package/dist/{chunk-DYWSCPCR.js → chunk-CNPJHUOX.js} +17 -17
  32. package/dist/{chunk-B45OFFOQ.js → chunk-CT6ZQRLD.js} +6 -8
  33. package/dist/chunk-CYFFYK2F.js +56 -0
  34. package/dist/{chunk-KVGDFUVO.js → chunk-CZQLCBWY.js} +26 -13
  35. package/dist/{chunk-6IIGT7BX.js → chunk-DNZMBQTH.js} +1 -1
  36. package/dist/{chunk-SYUGVPYH.js → chunk-DUUFDLC4.js} +1 -1
  37. package/dist/{chunk-3YUFN37G.js → chunk-GESJSXFH.js} +1 -1
  38. package/dist/chunk-HU2SPFNG.js +103 -0
  39. package/dist/{chunk-4OA4LDTU.js → chunk-IYLHJV34.js} +1 -1
  40. package/dist/{chunk-KBB4RG6F.js → chunk-JZIEZCQM.js} +9 -2
  41. package/dist/{chunk-XVIYZU3D.js → chunk-K35E45SI.js} +1 -1
  42. package/dist/{chunk-EGO6Z24R.js → chunk-K44HCHZN.js} +3 -3
  43. package/dist/{chunk-4YVMMRHR.js → chunk-K4RIT6PX.js} +2 -2
  44. package/dist/chunk-KGPLIH7B.js +127 -0
  45. package/dist/{chunk-B4P5VDFQ.js → chunk-KMAAOHLO.js} +1 -1
  46. package/dist/{chunk-MOL32UKR.js → chunk-KMJLHHBF.js} +1 -1
  47. package/dist/{chunk-3HSWLZ6S.js → chunk-KQHJKJ3V.js} +1 -1
  48. package/dist/{chunk-2IDHEEAN.js → chunk-KUTT3JXL.js} +88 -28
  49. package/dist/{chunk-3BETQ4XI.js → chunk-L274XRWA.js} +81 -8
  50. package/dist/{chunk-3PPO64IB.js → chunk-LACFOFWX.js} +10 -10
  51. package/dist/chunk-LCILS4AF.js +329 -0
  52. package/dist/{chunk-6BSIQJPW.js → chunk-LTJDUBSQ.js} +1 -1
  53. package/dist/{chunk-66SAATRI.js → chunk-M5B42RL5.js} +9 -9
  54. package/dist/{chunk-6WD636E5.js → chunk-MI6U3OIN.js} +2 -2
  55. package/dist/{chunk-YCGU3UNU.js → chunk-MXB6CWVH.js} +1 -1
  56. package/dist/{chunk-Z5C4LEAD.js → chunk-NKM53WMI.js} +11 -11
  57. package/dist/{chunk-QTTDKWSM.js → chunk-OMBSUO4T.js} +2 -2
  58. package/dist/{chunk-AL2YEVOT.js → chunk-P7NTODQE.js} +3 -3
  59. package/dist/{chunk-BHVFTYSI.js → chunk-PO2SDVQA.js} +4 -1
  60. package/dist/{chunk-DDNS2674.js → chunk-PR7QQBSC.js} +1 -1
  61. package/dist/{chunk-FDL4HV44.js → chunk-Q2Y5OZCY.js} +2 -2
  62. package/dist/{chunk-P6HELLPU.js → chunk-QIJLIULK.js} +2 -2
  63. package/dist/{chunk-5OKZLMQK.js → chunk-RMIFSBRV.js} +1 -1
  64. package/dist/{chunk-AFIATIKS.js → chunk-SFUBSJFP.js} +1 -1
  65. package/dist/{chunk-LE7T4ML7.js → chunk-SP6XL3NP.js} +1 -1
  66. package/dist/{chunk-SEABQTBP.js → chunk-TPIG7ZBX.js} +9 -9
  67. package/dist/{chunk-POKK6XXU.js → chunk-U7SASZC5.js} +15 -15
  68. package/dist/{chunk-JF5L5SQ6.js → chunk-VC7JBNPS.js} +72 -107
  69. package/dist/{chunk-N53FLAMZ.js → chunk-VGCEMOQA.js} +10 -10
  70. package/dist/{normalize-U3SL5VG3.js → chunk-VHZ6DL3M.js} +3 -3
  71. package/dist/chunk-VX4AL2FQ.js +26 -0
  72. package/dist/{chunk-3BYMCR4O.js → chunk-VXM4BH23.js} +23 -12
  73. package/dist/{chunk-ZLL72U3I.js → chunk-WX7VCRM7.js} +2 -2
  74. package/dist/{chunk-KPJMBC4K.js → chunk-XHBX7QN6.js} +4 -4
  75. package/dist/{chunk-BYSBRF24.js → chunk-XPQSL5VS.js} +5 -120
  76. package/dist/{chunk-55RZG5SQ.js → chunk-Y475GD4L.js} +4 -4
  77. package/dist/{chunk-ZQXNL5DL.js → chunk-YDRX42P3.js} +6 -6
  78. package/dist/{chunk-4SFGME7K.js → chunk-YJDB4FLT.js} +1 -1
  79. package/dist/{chunk-QATWIE4K.js → chunk-YU2QRNWN.js} +2 -2
  80. package/dist/{chunk-BPUFVVSH.js → chunk-ZK3BQXHC.js} +1 -1
  81. package/dist/{chunk-QHRPB2JQ.js → chunk-ZKDKFJCK.js} +13 -13
  82. package/dist/{clean-3RY3Y2GX.js → clean-6QP7VAV4.js} +32 -31
  83. package/dist/cli.js +55 -55
  84. package/dist/{cloud-MLPBFCVE.js → cloud-5TME5ROM.js} +4 -4
  85. package/dist/{cloudrun-NQF5KFQI.js → cloudrun-F5VVCVF5.js} +6 -6
  86. package/dist/{compare-6EZX2754.js → compare-XPY2EXX6.js} +35 -35
  87. package/dist/{compiler-ACCPOZMQ.js → compiler-NPD3MYMO.js} +2 -2
  88. package/dist/{component-F5PQHP6A.js → component-OPVL3PUX.js} +4 -4
  89. package/dist/{compositions-AUHWSI2H.js → compositions-WSEOI454.js} +19 -19
  90. package/dist/{delete-VUF4SHHJ.js → delete-SLMH57VH.js} +11 -11
  91. package/dist/{dist-GPDOV3IQ.js → dist-CUIR3GFX.js} +2 -2
  92. package/dist/{doctor-3XHCA5JM.js → doctor-QZW3EKIH.js} +20 -19
  93. package/dist/{events-FKOIB3R3.js → events-6C3ZG7LS.js} +8 -8
  94. package/dist/{events-TIU72LZM.js → events-FIFWFRGC.js} +6 -6
  95. package/dist/{feedback-V6VATYBE.js → feedback-VKXM7YJ5.js} +24 -24
  96. package/dist/{ffmpeg-5V4FP3R6.js → ffmpeg-TZB5WAYE.js} +3 -2
  97. package/dist/{figma-YBJM2VGE.js → figma-3UYNADNA.js} +3 -3
  98. package/dist/fontLocalizeCli.js +10 -10
  99. package/dist/{get-3YVCGZBX.js → get-VH7VMRVX.js} +11 -11
  100. package/dist/{gpuPolicy-ZOUG66M7.js → gpuPolicy-M2JZGGVW.js} +5 -5
  101. package/dist/{grade-compare-MYXIRKQI.js → grade-compare-OSC2YQWN.js} +40 -39
  102. package/dist/{help-WFZ2SUUR.js → help-DCBFEZPT.js} +3 -3
  103. package/dist/{history-HWPRJFR5.js → history-XYJMQE26.js} +15 -15
  104. package/dist/hyperframe-runtime.js +62 -62
  105. package/dist/hyperframe.manifest.json +1 -1
  106. package/dist/hyperframe.runtime.iife.js +62 -62
  107. package/dist/hyperframes-player.global.js +1 -1
  108. package/dist/{info-WJDTQ4OZ.js → info-YEHGENAH.js} +17 -17
  109. package/dist/{init-EXHDN7RO.js → init-64SML7PY.js} +52 -51
  110. package/dist/{inspect-EAOLZOMQ.js → inspect-GFOQKRJI.js} +32 -32
  111. package/dist/{installer-LZ4X5TZZ.js → installer-Q4MMZKLA.js} +4 -4
  112. package/dist/{keyframes-FSZYNEDN.js → keyframes-ORYFWKBZ.js} +16 -16
  113. package/dist/{lambda-3GAKHMC3.js → lambda-DRMOJGTC.js} +8 -8
  114. package/dist/{layout-M2TQ2CIX.js → layout-ZEQBE6UQ.js} +32 -32
  115. package/dist/{lint-7C5UPTNQ.js → lint-67KGFY63.js} +19 -19
  116. package/dist/{list-GU5KBZ73.js → list-T6OU5ARJ.js} +11 -11
  117. package/dist/{login-ZL2NYBIZ.js → login-2PXIGDP7.js} +9 -9
  118. package/dist/{logout-B4KS4A7S.js → logout-DKJANASY.js} +3 -3
  119. package/dist/{manager-5ORDVWJB.js → manager-ES2UFT4X.js} +6 -4
  120. package/dist/{manager-BPSR6D3V.js → manager-GWU5J6RJ.js} +3 -2
  121. package/dist/{media-treatment-QC3TAHVU.js → media-treatment-NAAHID6M.js} +27 -26
  122. package/dist/{models-A54I4QR5.js → models-P6XB6RWK.js} +19 -17
  123. package/dist/{motionShot-ZXPK562F.js → motionShot-7MHRIV6V.js} +13 -13
  124. package/dist/normalize-4UDISLPL.js +24 -0
  125. package/dist/{normalize-audio-CAP3DAE6.js → normalize-audio-LWNFYR2F.js} +15 -15
  126. package/dist/{open-GUSBNMDB.js → open-DAP5C7UD.js} +13 -13
  127. package/dist/{parakeetRunner-GCCH72CO.js → parakeetRunner-3ZVFPOD4.js} +17 -27
  128. package/dist/{pipeline-SCJ2MWYH.js → pipeline-V4YJCPUX.js} +9 -9
  129. package/dist/{play-FP2QLMGM.js → play-UDCESJO3.js} +35 -35
  130. package/dist/{preflight-ONF5AJNO.js → preflight-JOD4OXGC.js} +5 -4
  131. package/dist/{present-H5SA4APW.js → present-DXTHBH3F.js} +26 -26
  132. package/dist/{preview-ATPVKA6K.js → preview-YHXKRXKB.js} +39 -37
  133. package/dist/{producer-VBYUC27R.js → producer-343ENLAM.js} +1 -1
  134. package/dist/{projectConfig-SBRMQZGG.js → projectConfig-YXKU3CTB.js} +6 -6
  135. package/dist/{publication-5BQICRZO.js → publication-ODXP3JI7.js} +2 -2
  136. package/dist/{publish-XDUZA3E3.js → publish-UEFBFGV3.js} +22 -22
  137. package/dist/{refresh-PVHBEABE.js → refresh-MGCVWX56.js} +3 -3
  138. package/dist/{remove-background-GA6F7JZW.js → remove-background-FMV6IDOH.js} +38 -34
  139. package/dist/{render-XCYXFZTL.js → render-N7QGX6RJ.js} +30 -30
  140. package/dist/{render-PCFO45RK.js → render-SYC4RPGT.js} +6 -6
  141. package/dist/{render-KUVZFNQD.js → render-ZTXNPRGF.js} +61 -60
  142. package/dist/{render-batch-7R2NRNVJ.js → render-batch-SZRPCRUJ.js} +6 -6
  143. package/dist/renderSetupWorker.js +4 -3
  144. package/dist/{resolver-C4FPX72I.js → resolver-7MYXNEAX.js} +4 -4
  145. package/dist/{sherpa-IQY52XU6.js → sherpa-M4Z2Q5Y2.js} +15 -14
  146. package/dist/sherpaWorker.js +3 -1
  147. package/dist/{skills-JSSAEKUW.js → skills-NEHNSHZK.js} +15 -15
  148. package/dist/{skillsUpdateCheck-XE5E2K2F.js → skillsUpdateCheck-O77QR72A.js} +3 -3
  149. package/dist/{snapshot-QMQOE2DD.js → snapshot-GDVXFBVY.js} +54 -53
  150. package/dist/{src-R55QLGWI.js → src-PTIV7IVV.js} +6 -6
  151. package/dist/{src-2GMPFYHL.js → src-VMTHSARJ.js} +6 -4
  152. package/dist/{staticProjectServer-YH2RHYKW.js → staticProjectServer-3D2NXQ6W.js} +14 -14
  153. package/dist/{status-PTKNQD2E.js → status-NBRMGL7D.js} +5 -5
  154. package/dist/studio/assets/{hyperframes-player-_eMxRXF_.js → hyperframes-player-C-2YwYre.js} +1 -1
  155. package/dist/studio/assets/{index-bXzd7tvF.js → index-ByJU5J6n.js} +115 -115
  156. package/dist/studio/assets/{index-CEq9KmY2.js → index-BybGk67U.js} +1 -1
  157. package/dist/studio/assets/{index-6okhHdnH.js → index-Cfs2r3fz.js} +1 -1
  158. package/dist/studio/assets/{index-CVd4O6eH.css → index-DkQKsFxx.css} +1 -1
  159. package/dist/studio/index.html +2 -2
  160. package/dist/{studio-api-T2TS2CHL.js → studio-api-XIBDLRHB.js} +7 -7
  161. package/dist/{studioServer-Q4MT44LT.js → studioServer-QIQK47UN.js} +70 -69
  162. package/dist/{synthesize-UCI4X5O7.js → synthesize-22B7L5GX.js} +6 -6
  163. package/dist/{telemetry-V5JYZDS4.js → telemetry-565KDZUW.js} +8 -8
  164. package/dist/{timeline-KTCTOKF5.js → timeline-E6XB7I6W.js} +24 -24
  165. package/dist/{tokens-ZHREZPK6.js → tokens-3ZAJENSE.js} +3 -3
  166. package/dist/transcribe-WODP3T77.js +332 -0
  167. package/dist/{transcribe-CRAV4FU3.js → transcribe-XWQQCCBG.js} +13 -12
  168. package/dist/{tts-B6AHFQEO.js → tts-QSAQZVEZ.js} +3 -3
  169. package/dist/{updateCheck-E7RMSK3E.js → updateCheck-QPYU4GRL.js} +2 -2
  170. package/dist/{upgrade-27PFTDCV.js → upgrade-2FJ5ZEN6.js} +5 -5
  171. package/dist/{urlDownloader-EAF6PLUP.js → urlDownloader-352AY25I.js} +4 -4
  172. package/dist/{validate-OKNFDBMG.js → validate-SP2VGNEI.js} +25 -25
  173. package/dist/{video-IEVS4FIH.js → video-RVNPFEA6.js} +8 -8
  174. package/package.json +8 -1
  175. package/dist/chunk-6IHWCZ3W.js +0 -54
  176. package/dist/chunk-SQLK7SJL.js +0 -88
  177. package/dist/chunk-Z6FLHIDV.js +0 -3795
  178. package/dist/manager-RFZNG5YT.js +0 -30
  179. package/dist/renderCancellation-NIXEWRAO.js +0 -43
  180. package/dist/transcribe-4QDEWCE6.js +0 -466
  181. package/dist/{chunk-DKSDVDXG.js → chunk-NAMGMP3R.js} +3 -3
  182. package/dist/{policies-4FEXMXPK.js → policies-DCSIM4AB.js} +3 -3
  183. package/dist/{screenshotCapture-3JXXUZND.js → screenshotCapture-TEUIWXWN.js} +3 -3
  184. package/dist/{telemetry-W5AKPI4R.js → telemetry-CQYHCCPL.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,19 +18,18 @@ import {
18
18
  transcribe,
19
19
  whisperModelSlowdownFactor,
20
20
  wrapWhisperTimeoutError
21
- } from "./chunk-2IDHEEAN.js";
22
- import "./chunk-6IHWCZ3W.js";
23
- import "./chunk-AL2YEVOT.js";
24
- import "./chunk-KVGDFUVO.js";
25
- import "./chunk-BHVFTYSI.js";
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
- import "./chunk-JF5L5SQ6.js";
29
- import "./chunk-JBQJKC23.js";
27
+ import "./chunk-VC7JBNPS.js";
28
+ import "./chunk-62RUQJ5J.js";
30
29
  import "./chunk-NE55C6S5.js";
31
30
  import "./chunk-JYVGYKXG.js";
32
- import "./chunk-BAKPN2D2.js";
33
- import "./chunk-Z6FLHIDV.js";
31
+ import "./chunk-AHBYQRGI.js";
32
+ import "./chunk-3WD4JNMU.js";
34
33
  import "./chunk-VC76R6W2.js";
35
34
  import "./chunk-YA62XGXS.js";
36
35
  import "./chunk-LFNQDTSH.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-A4Q7W4LV.js";
43
- import "./chunk-BYSBRF24.js";
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-6IIGT7BX.js";
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-UCI4X5O7.js");
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-3YUFN37G.js";
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-QTTDKWSM.js";
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-3YUFN37G.js";
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-QTTDKWSM.js";
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
@@ -11,12 +11,12 @@ import {
11
11
  isHttpUrl,
12
12
  safeDownloadUrlIdentity,
13
13
  writeUrlDownloadTelemetry
14
- } from "./chunk-JF5L5SQ6.js";
15
- import "./chunk-JBQJKC23.js";
14
+ } from "./chunk-VC7JBNPS.js";
15
+ import "./chunk-62RUQJ5J.js";
16
16
  import "./chunk-NE55C6S5.js";
17
17
  import "./chunk-JYVGYKXG.js";
18
- import "./chunk-BAKPN2D2.js";
19
- import "./chunk-Z6FLHIDV.js";
18
+ import "./chunk-AHBYQRGI.js";
19
+ import "./chunk-3WD4JNMU.js";
20
20
  import "./chunk-VC76R6W2.js";
21
21
  import "./chunk-YA62XGXS.js";
22
22
  import "./chunk-LFNQDTSH.js";
@@ -14,40 +14,47 @@ import {
14
14
  shouldIgnoreHttpError,
15
15
  shouldIgnoreRequestFailure,
16
16
  validate_default
17
- } from "./chunk-DYWSCPCR.js";
18
- import "./chunk-AFIATIKS.js";
19
- import "./chunk-SEABQTBP.js";
17
+ } from "./chunk-CNPJHUOX.js";
18
+ import "./chunk-TPIG7ZBX.js";
20
19
  import "./chunk-FH7WODJH.js";
21
- import "./chunk-XOJDBRNF.js";
22
- import "./chunk-3HSWLZ6S.js";
20
+ import "./chunk-4S4VUXW3.js";
21
+ import "./chunk-KQHJKJ3V.js";
23
22
  import "./chunk-WPNE5NEP.js";
24
- import "./chunk-K2FLNJVB.js";
25
- import "./chunk-Z5C4LEAD.js";
26
- import "./chunk-A72OAGNB.js";
23
+ import "./chunk-NKM53WMI.js";
24
+ import "./chunk-2HWB4TCI.js";
27
25
  import "./chunk-FJWEYVEM.js";
28
26
  import "./chunk-ZFN6GQU4.js";
29
- import "./chunk-MOL32UKR.js";
27
+ import "./chunk-KMJLHHBF.js";
30
28
  import "./chunk-AIJS74LG.js";
31
- import "./chunk-EOVYQ3IG.js";
32
- import "./chunk-P6HELLPU.js";
29
+ import "./chunk-SFUBSJFP.js";
30
+ import "./chunk-K2FLNJVB.js";
31
+ import "./chunk-QIJLIULK.js";
33
32
  import "./chunk-442JNXRM.js";
34
33
  import "./chunk-374QQGBQ.js";
35
- import "./chunk-55RZG5SQ.js";
36
- import "./chunk-3PPO64IB.js";
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";
45
- import "./chunk-JF5L5SQ6.js";
46
- import "./chunk-JBQJKC23.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";
52
+ import "./chunk-VC7JBNPS.js";
53
+ import "./chunk-62RUQJ5J.js";
47
54
  import "./chunk-NE55C6S5.js";
48
55
  import "./chunk-JYVGYKXG.js";
49
- import "./chunk-BAKPN2D2.js";
50
- import "./chunk-Z6FLHIDV.js";
56
+ import "./chunk-AHBYQRGI.js";
57
+ import "./chunk-3WD4JNMU.js";
51
58
  import "./chunk-VC76R6W2.js";
52
59
  import "./chunk-YA62XGXS.js";
53
60
  import "./chunk-LFNQDTSH.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-3YUFN37G.js";
70
- import "./chunk-K4WIOZFP.js";
71
- import "./chunk-XUXGIA7H.js";
72
- import "./chunk-WERLJGIC.js";
73
- import "./chunk-ISN5GRYI.js";
74
- import "./chunk-QTTDKWSM.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,
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  CAPTURE_USER_AGENT,
9
9
  safeFetch
10
- } from "./chunk-H7B6JSHI.js";
10
+ } from "./chunk-AY2BONTF.js";
11
11
  import {
12
12
  ensureCaptureDirSync
13
13
  } from "./chunk-MRF4AMKD.js";
@@ -15,12 +15,15 @@ import "./chunk-AWDFDFI3.js";
15
15
  import {
16
16
  setCommandExitCode
17
17
  } from "./chunk-PBN6GBJE.js";
18
- import "./chunk-JF5L5SQ6.js";
19
- import "./chunk-JBQJKC23.js";
18
+ import {
19
+ c
20
+ } from "./chunk-ZTZA4UWZ.js";
21
+ import "./chunk-VC7JBNPS.js";
22
+ import "./chunk-62RUQJ5J.js";
20
23
  import "./chunk-NE55C6S5.js";
21
24
  import "./chunk-JYVGYKXG.js";
22
- import "./chunk-BAKPN2D2.js";
23
- import "./chunk-Z6FLHIDV.js";
25
+ import "./chunk-AHBYQRGI.js";
26
+ import "./chunk-3WD4JNMU.js";
24
27
  import "./chunk-VC76R6W2.js";
25
28
  import "./chunk-YA62XGXS.js";
26
29
  import "./chunk-LFNQDTSH.js";
@@ -40,9 +43,6 @@ import "./chunk-SDYDNHEE.js";
40
43
  import "./chunk-2PSPARWP.js";
41
44
  import "./chunk-IXLUTE6N.js";
42
45
  import "./chunk-3GXQPCJC.js";
43
- import {
44
- c
45
- } from "./chunk-ZTZA4UWZ.js";
46
46
  import "./chunk-M2WBOQ2Q.js";
47
47
 
48
48
  // src/commands/capture/video.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperframes",
3
- "version": "0.8.147",
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",
@@ -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
- };