hyperframes 0.8.140 → 0.8.142

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 (167) hide show
  1. package/dist/{add-7SPPQB64.js → add-YS2RCWEK.js} +11 -11
  2. package/dist/{animatedGifPrep-HN3CJSFX.js → animatedGifPrep-SAMCDT7T.js} +6 -7
  3. package/dist/{asset-AZMFUTRL.js → asset-BLWC2NWB.js} +2 -2
  4. package/dist/{assetCataloger-TQUWYLHE.js → assetCataloger-FVNBBRP3.js} +2 -2
  5. package/dist/{auth-XGY74R4A.js → auth-DRZB7OAC.js} +5 -4
  6. package/dist/{autoUpdate-44NTJBQU.js → autoUpdate-I5I3BOJK.js} +2 -2
  7. package/dist/{backgroundChecks-ET4DJEPG.js → backgroundChecks-VR2QHGNY.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-HTWWNF3P.js → batchRender-4YUHQI6X.js} +3 -3
  10. package/dist/{beats-4GYTZUZG.js → beats-7OT7ALV3.js} +11 -12
  11. package/dist/{benchmark-CJQHE3QN.js → benchmark-Q2XQCRTR.js} +8 -8
  12. package/dist/{browser-NXOVPGDG.js → browser-7VAWQQZC.js} +3 -3
  13. package/dist/{bundleWithLocalizedFonts-6PJP54TC.js → bundleWithLocalizedFonts-DDMLLL2R.js} +2 -2
  14. package/dist/{capture-EHOMO4MP.js → capture-HEJS6M5A.js} +74 -33
  15. package/dist/{capture-5EHGRJZM.js → capture-U7ABPKS5.js} +24 -8
  16. package/dist/{catalog-PTX5Z52R.js → catalog-DVJ3XPDN.js} +11 -11
  17. package/dist/{catch-up-I45SPSCU.js → catch-up-DF6AVSN2.js} +4 -4
  18. package/dist/{check-LJ7LG7OI.js → check-KXORRWAE.js} +75 -72
  19. package/dist/{checkBrowser-6EK5E4PG.js → checkBrowser-J7HZJTRH.js} +28 -29
  20. package/dist/{chunk-XTFJOR3K.js → chunk-4SFGME7K.js} +1 -1
  21. package/dist/{chunk-EDYBFSPE.js → chunk-6RAD4BCC.js} +5 -8
  22. package/dist/{chunk-MTVDXB6S.js → chunk-6UM3R7PP.js} +21 -13
  23. package/dist/{chunk-IRBESGJ7.js → chunk-6UYZB4TY.js} +1 -1
  24. package/dist/{chunk-VVJFZU6B.js → chunk-75JJVANE.js} +2 -2
  25. package/dist/{chunk-F3SPK6SO.js → chunk-7FCDA4RH.js} +1 -1
  26. package/dist/{chunk-R4QIE6UY.js → chunk-7M4KAPAA.js} +92 -31
  27. package/dist/{chunk-HKCNZITN.js → chunk-AM5L5YIA.js} +1 -1
  28. package/dist/{chunk-BRITLL56.js → chunk-B4P5VDFQ.js} +1 -1
  29. package/dist/{chunk-2GMKWYEH.js → chunk-B6SMSALD.js} +53 -12
  30. package/dist/{chunk-DQNOPYAG.js → chunk-BPZVDBHY.js} +1 -1
  31. package/dist/{chunk-246MOR5U.js → chunk-DKSDVDXG.js} +175 -162
  32. package/dist/{chunk-6U3MN4HW.js → chunk-DPHJKWP5.js} +2 -2
  33. package/dist/{chunk-MUINFURL.js → chunk-DZEVA7DI.js} +2 -2
  34. package/dist/{chunk-KMKWRIMC.js → chunk-EFDXGAAD.js} +1 -1
  35. package/dist/{chunk-LQG6GPVK.js → chunk-FWRNQOLT.js} +1 -1
  36. package/dist/{chunk-IFY57LUW.js → chunk-FZK35GT4.js} +1 -1
  37. package/dist/{chunk-PUBKHEEA.js → chunk-GYE63V4P.js} +10 -10
  38. package/dist/{chunk-WQBA3MH4.js → chunk-H2X52H2N.js} +3 -3
  39. package/dist/{chunk-QG3PDRSO.js → chunk-HMUF7FEO.js} +1 -1
  40. package/dist/{chunk-TPECLKPA.js → chunk-IDX52YJN.js} +5 -5
  41. package/dist/{chunk-ABJNXQUA.js → chunk-IMY4QQTQ.js} +7 -7
  42. package/dist/{chunk-WY5OODN5.js → chunk-IW2CKH6A.js} +3645 -3
  43. package/dist/{chunk-X3X3VETN.js → chunk-IXCTG2WY.js} +3 -3
  44. package/dist/chunk-J4UX3RS3.js +3717 -0
  45. package/dist/{chunk-DDQ4LOML.js → chunk-JLKMWY2T.js} +1 -1
  46. package/dist/{chunk-ASW6NWON.js → chunk-JOTLPC6S.js} +1 -1
  47. package/dist/{chunk-MU6C2VP6.js → chunk-JU6Y5TTZ.js} +2 -2
  48. package/dist/{chunk-PPKFM5WE.js → chunk-KYN364DU.js} +2 -2
  49. package/dist/{chunk-C2JUHIG5.js → chunk-LBKDQKWV.js} +1 -1
  50. package/dist/{chunk-PB3P4MKP.js → chunk-LJAU4TPS.js} +1 -1
  51. package/dist/{chunk-PFJFHNU3.js → chunk-LQASVU3I.js} +3 -3
  52. package/dist/{chunk-KJLY2SDJ.js → chunk-LTGGTEMA.js} +2 -2
  53. package/dist/{chunk-L2H2L22P.js → chunk-MVTUV4TP.js} +2 -2
  54. package/dist/{chunk-QBK7WKHT.js → chunk-OKCR3JTO.js} +104 -4
  55. package/dist/{chunk-BQKEGPPL.js → chunk-OSUKETIH.js} +1 -1
  56. package/dist/chunk-P36MALQF.js +15 -0
  57. package/dist/{chunk-KECV5G4V.js → chunk-QGRFOOLE.js} +10 -10
  58. package/dist/{chunk-5IKJONRY.js → chunk-QXPCARFE.js} +1 -1
  59. package/dist/{chunk-WKTHUC2R.js → chunk-R2JEKLDZ.js} +1 -1
  60. package/dist/{chunk-TYT2TLJR.js → chunk-TY6XOHEM.js} +1 -1
  61. package/dist/{chunk-SLEPCESN.js → chunk-WGVOWWVK.js} +2 -2
  62. package/dist/{chunk-KFQNMY36.js → chunk-WSGY5CDQ.js} +5 -5
  63. package/dist/{chunk-PE2I3AFA.js → chunk-WTMUCJ6Z.js} +1 -1
  64. package/dist/{chunk-JSGANFFH.js → chunk-XGMNQQTJ.js} +1 -1
  65. package/dist/{chunk-BJ5JWOES.js → chunk-XTLBLWOV.js} +1 -1
  66. package/dist/{chunk-QP3BRKGF.js → chunk-YFT3BL7N.js} +19 -1
  67. package/dist/{chunk-MHK5DE2P.js → chunk-YHRZQJXH.js} +59 -37
  68. package/dist/{clean-Y3AQITOX.js → clean-KTHTV5G5.js} +12 -13
  69. package/dist/cli.js +52 -52
  70. package/dist/{cloud-TDPOMBZF.js → cloud-ARSZWALC.js} +4 -4
  71. package/dist/{cloudrun-FPAVAVHP.js → cloudrun-NM7RXOCL.js} +3 -3
  72. package/dist/commands/layout-audit.browser.js +20 -20
  73. package/dist/{compare-LHL225ND.js → compare-CY4UO3RW.js} +23 -24
  74. package/dist/{compiler-RTU3KTLF.js → compiler-VTH2D3ID.js} +3 -4
  75. package/dist/{component-L2YX7J56.js → component-FRUIAXIR.js} +3 -3
  76. package/dist/{compositions-V2UZKG7S.js → compositions-CUSY6ZYY.js} +10 -11
  77. package/dist/{delete-OXZEXUQY.js → delete-KT3VHP4L.js} +5 -5
  78. package/dist/{deterministicFonts-GTITFRSJ.js → deterministicFonts-F6WIVL2W.js} +1 -1
  79. package/dist/{dist-N33CM63P.js → dist-2GC6XKRQ.js} +8 -2
  80. package/dist/{dist-NZSQCYOF.js → dist-7SZU7MA7.js} +1 -2
  81. package/dist/{doctor-MWTPSIVD.js → doctor-4ROTBL5U.js} +8 -9
  82. package/dist/{events-4TZGQZWF.js → events-Q5PXT5UC.js} +2 -2
  83. package/dist/{events-7VJJGC3D.js → events-QJDVMKSR.js} +3 -3
  84. package/dist/{feedback-HSGAPVN7.js → feedback-PQ7TWESA.js} +10 -10
  85. package/dist/{figma-AMC6FAK3.js → figma-JN5DDBDS.js} +3 -3
  86. package/dist/fontLocalizeCli.js +9 -10
  87. package/dist/{get-Y7DFEFYM.js → get-KT6OTERO.js} +5 -5
  88. package/dist/{gpuPolicy-A45VSUKR.js → gpuPolicy-LCBWVGEH.js} +6 -7
  89. package/dist/{grade-compare-ERSA3OUI.js → grade-compare-VS3RP73G.js} +23 -24
  90. package/dist/{help-TW2AADLZ.js → help-AD6FIZIO.js} +1 -1
  91. package/dist/{history-DKGDSVWF.js → history-ZRWYRY7R.js} +5 -5
  92. package/dist/hyperframe-runtime.js +54 -54
  93. package/dist/hyperframe.manifest.json +1 -1
  94. package/dist/hyperframe.runtime.iife.js +54 -54
  95. package/dist/hyperframes-player.global.js +3 -3
  96. package/dist/{info-I3NRRNX4.js → info-WBBQA2AX.js} +7 -7
  97. package/dist/{init-5Y3ZWZNF.js → init-A2XBDFGF.js} +21 -22
  98. package/dist/{inspect-BJQKBB3X.js → inspect-CLTZHA5O.js} +24 -25
  99. package/dist/{installer-27K4JS2I.js → installer-WQDRVXH4.js} +4 -4
  100. package/dist/{keyframes-6V2NZO22.js → keyframes-3FYOK6H6.js} +6 -6
  101. package/dist/{lambda-AIMF3K4A.js → lambda-Y2PA2BGS.js} +4 -4
  102. package/dist/{layout-YAPEBTU4.js → layout-4KP5O7IJ.js} +24 -25
  103. package/dist/{lint-3LWWUIV7.js → lint-V4GRFHOJ.js} +7 -8
  104. package/dist/{lintProject-LM3XZRPZ.js → lintProject-RG2KGAXB.js} +1 -2
  105. package/dist/{list-NTSGEZJ6.js → list-OQ4VED6E.js} +5 -5
  106. package/dist/{login-ZTDFGCCW.js → login-W47NKN5S.js} +20 -24
  107. package/dist/{logout-GJXZQKOA.js → logout-B4KS4A7S.js} +6 -6
  108. package/dist/{media-treatment-ARHX446F.js → media-treatment-HJYL3EME.js} +43 -24
  109. package/dist/{models-VHNQVTHG.js → models-DYBAD2GQ.js} +7 -8
  110. package/dist/{motionShot-35HCSNCI.js → motionShot-7NE2YBB3.js} +12 -13
  111. package/dist/{normalize-audio-AUC73JH3.js → normalize-audio-INKCLMS2.js} +4 -4
  112. package/dist/{open-C5LVNU3U.js → open-TYC5THVY.js} +4 -4
  113. package/dist/{pipeline-4GDTK54T.js → pipeline-EVKEPQEW.js} +6 -7
  114. package/dist/{play-U7UANF7Z.js → play-QMZEM6X3.js} +17 -18
  115. package/dist/{present-X6V6TX3E.js → present-Y7IK3C4W.js} +13 -14
  116. package/dist/{preview-K43RTRU2.js → preview-5OQRYE6A.js} +16 -17
  117. package/dist/{producer-PVMFMW23.js → producer-Q6G6JU7B.js} +1 -1
  118. package/dist/{projectConfig-PI6MEN2T.js → projectConfig-RJN3DKDB.js} +6 -6
  119. package/dist/{publication-67C7KVTL.js → publication-QCPGGN3U.js} +2 -2
  120. package/dist/{publish-RBV7EAMH.js → publish-VZLFIGYY.js} +15 -15
  121. package/dist/{refresh-MFITBIKV.js → refresh-PVHBEABE.js} +2 -2
  122. package/dist/{remove-background-Z2ECZX2Q.js → remove-background-TKOEHBA5.js} +7 -8
  123. package/dist/{render-EFU4BZRZ.js → render-KIIIF6PS.js} +13 -13
  124. package/dist/{render-YBS3XGRJ.js → render-X3NFNVEQ.js} +19 -20
  125. package/dist/{render-2GQMQBU3.js → render-XTXE5CRU.js} +3 -3
  126. package/dist/{render-batch-QC64OTB5.js → render-batch-M55YZLZ5.js} +3 -3
  127. package/dist/{renderCancellation-NTVU7IMB.js → renderCancellation-X5BEHAZU.js} +6 -7
  128. package/dist/renderSetupWorker.js +1 -2
  129. package/dist/{resolver-GBWYG3EI.js → resolver-GAMXRA42.js} +4 -4
  130. package/dist/{screenshotCapture-ECBTLCU6.js → screenshotCapture-TEUIWXWN.js} +53 -33
  131. package/dist/{sherpa-ZW6PWJS4.js → sherpa-ZYTNFHD5.js} +7 -8
  132. package/dist/skills/hyperframes-cli/references/cloud.md +1 -1
  133. package/dist/skills/media-use/SKILL.md +6 -4
  134. package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +47 -4
  135. package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +125 -18
  136. package/dist/skills/media-use/references/grading.md +4 -2
  137. package/dist/skills/media-use/references/setup-providers.md +13 -0
  138. package/dist/{skills-VKZAX5AS.js → skills-CZHVAD3J.js} +5 -5
  139. package/dist/{skillsUpdateCheck-PAY2OPDE.js → skillsUpdateCheck-6WLLX53A.js} +3 -3
  140. package/dist/{snapshot-SD5R3NWX.js → snapshot-K7BTJPYQ.js} +24 -25
  141. package/dist/{src-7SSERHNP.js → src-3I3RH3V5.js} +5 -6
  142. package/dist/{src-RXTXL3VL.js → src-YUW26JU5.js} +8 -9
  143. package/dist/{staticProjectServer-XELJXX4J.js → staticProjectServer-IKCSGN2B.js} +13 -14
  144. package/dist/{status-JA6SKQVH.js → status-LXPGSSKY.js} +6 -4
  145. package/dist/studio/assets/hyperframes-player-sAsRuV73.js +473 -0
  146. package/dist/studio/assets/{index-VAHDM_zL.js → index-B-wffzRH.js} +126 -126
  147. package/dist/studio/assets/{index-CWfuDCoA.js → index-D3Vij9t1.js} +1 -1
  148. package/dist/studio/assets/{index-Dr3Bo9uH.js → index-D5q2_7Gw.js} +1 -1
  149. package/dist/studio/index.html +1 -1
  150. package/dist/studio/index.js +46 -15
  151. package/dist/studio/index.js.map +1 -1
  152. package/dist/{studio-api-4FNUZPJ4.js → studio-api-SQ3NXFSM.js} +7 -8
  153. package/dist/{studioServer-GHLL3F2M.js → studioServer-VVEO7XCH.js} +36 -37
  154. package/dist/{telemetry-7AO77PMH.js → telemetry-FQDKR5XA.js} +3 -3
  155. package/dist/{timeline-6LTHSRXM.js → timeline-N6ZASFNE.js} +13 -14
  156. package/dist/{tokens-K6B46KNL.js → tokens-2OIIBBCW.js} +2 -2
  157. package/dist/{transcribe-CLLISRLZ.js → transcribe-4F6MK73N.js} +7 -8
  158. package/dist/{transcribe-K2OU6FZF.js → transcribe-7YTUCXDX.js} +6 -6
  159. package/dist/{updateCheck-X6UQBS6I.js → updateCheck-AZ2COZFR.js} +2 -2
  160. package/dist/{upgrade-BZFKEADI.js → upgrade-QAJEYB4X.js} +2 -2
  161. package/dist/{urlDownloader-VAVUXYEQ.js → urlDownloader-LSMFEO3R.js} +5 -6
  162. package/dist/{validate-VO5KEXWN.js → validate-GW5MDL36.js} +15 -16
  163. package/dist/{video-JV6Y4UJR.js → video-PRNOKUK3.js} +6 -7
  164. package/package.json +1 -1
  165. package/dist/chunk-24OWOBQH.js +0 -3656
  166. package/dist/chunk-B3I3XJ47.js +0 -3711
  167. package/dist/studio/assets/hyperframes-player-BLuyxnK7.js +0 -473
@@ -14,6 +14,19 @@ import {
14
14
  c
15
15
  } from "./chunk-ZTZA4UWZ.js";
16
16
 
17
+ // src/auth/paths.ts
18
+ import { homedir } from "os";
19
+ import { join } from "path";
20
+ var CREDENTIAL_FILENAME = "credentials";
21
+ function configDir() {
22
+ const override = process.env["HEYGEN_CONFIG_DIR"];
23
+ if (override && override.length > 0) return override;
24
+ return join(homedir(), ".heygen");
25
+ }
26
+ function credentialPath() {
27
+ return join(configDir(), CREDENTIAL_FILENAME);
28
+ }
29
+
17
30
  // src/auth/errors.ts
18
31
  var AuthError = class extends Error {
19
32
  code;
@@ -70,154 +83,6 @@ function isAuthError(err) {
70
83
  return err instanceof AuthError;
71
84
  }
72
85
 
73
- // src/auth/scrub.ts
74
- var HEYGEN_KEY = /\b(hg|sk)_[A-Za-z0-9_-]{4,}/g;
75
- var HEADER_LINE = /(authorization|x-api-key)[ \t]*[:=][ \t]*[^\r\n]+/gi;
76
- var JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
77
- var SECRET_FIELDS = [
78
- "access_token",
79
- "refresh_token",
80
- "code_verifier",
81
- "client_secret",
82
- "id_token",
83
- "token",
84
- "code"
85
- ];
86
- var FORM_FIELD = new RegExp(`\\b(${SECRET_FIELDS.join("|")})=[^&\\s"']+`, "gi");
87
- var JSON_FIELD = new RegExp(`("(?:${SECRET_FIELDS.join("|")})"\\s*:\\s*)"[^"]*"`, "gi");
88
- function scrubCredentials(s) {
89
- return s.replace(HEYGEN_KEY, "$1_<redacted>").replace(HEADER_LINE, "$1: <redacted>").replace(JWT, "<jwt-redacted>").replace(FORM_FIELD, "$1=<redacted>").replace(JSON_FIELD, '$1"<redacted>"');
90
- }
91
-
92
- // src/auth/client.ts
93
- var DEFAULT_BASE_URL = "https://api.heygen.com";
94
- var HEYGEN_CLI_SOURCE_HEADER = "X-HeyGen-Source";
95
- var HEYGEN_CLI_SOURCE = "cli";
96
- var HEYGEN_CLIENT_SOURCE_HEADER = "X-HeyGen-Client-Source";
97
- var HEYGEN_CLIENT_SOURCE = "hyperframes";
98
- function apiBaseUrl() {
99
- const override = process.env["HEYGEN_API_URL"];
100
- return override && override.length > 0 ? override.replace(/\/+$/, "") : DEFAULT_BASE_URL;
101
- }
102
- var AuthClient = class {
103
- base;
104
- fetchImpl;
105
- onRefresh;
106
- constructor(opts = {}) {
107
- this.base = (opts.baseUrl ?? apiBaseUrl()).replace(/\/+$/, "");
108
- this.fetchImpl = opts.fetchImpl ?? fetch;
109
- this.onRefresh = opts.onUnauthenticatedRefresh;
110
- }
111
- /**
112
- * `GET /v3/users/me`. Throws `ErrUnauthenticated` on 401, `ErrApi`
113
- * on any other non-2xx or non-JSON body.
114
- *
115
- * On OAuth 401 with a refresh hook configured, the request is
116
- * retried once after refreshing the access token. The retry's
117
- * outcome is what the caller sees — if the refresh itself fails
118
- * (REFRESH_FAILED) or the retry still 401s, the user lands on a
119
- * "please log in again" path upstream.
120
- */
121
- async getCurrentUser(credential) {
122
- const url = `${this.base}/v3/users/me`;
123
- return await this.fetchUser(url, credential, true);
124
- }
125
- // fallow-ignore-next-line complexity
126
- async fetchUser(url, credential, allowRefresh) {
127
- const headers = buildAuthHeaders(credential);
128
- const res = await this.fetchImpl(url, { method: "GET", headers });
129
- if (res.status === 401) {
130
- if (allowRefresh && credential.type === "oauth" && credential.refresh_token && this.onRefresh) {
131
- const refreshed = await this.tryRefresh(credential.refresh_token);
132
- if (refreshed) {
133
- const next = {
134
- ...credential,
135
- access_token: refreshed.access_token,
136
- ...refreshed.refresh_token ? { refresh_token: refreshed.refresh_token } : {}
137
- };
138
- return await this.fetchUser(url, next, false);
139
- }
140
- }
141
- const detail = await safeText(res);
142
- throw ErrUnauthenticated(detail || `${res.status} ${res.statusText}`);
143
- }
144
- if (!res.ok) {
145
- throw ErrApi(res.status, await safeText(res) || res.statusText);
146
- }
147
- let payload;
148
- try {
149
- payload = await res.json();
150
- } catch (err) {
151
- throw ErrApi(res.status, `non-JSON body: ${err.message}`);
152
- }
153
- return extractUserInfo(payload);
154
- }
155
- async tryRefresh(refresh_token) {
156
- if (!this.onRefresh) return null;
157
- try {
158
- return await this.onRefresh(refresh_token);
159
- } catch (err) {
160
- if (isAuthError(err) && err.code === "REFRESH_FAILED") return null;
161
- throw err;
162
- }
163
- }
164
- };
165
- function buildAuthHeaders(credential) {
166
- if (credential.type === "oauth") {
167
- return {
168
- authorization: `Bearer ${credential.access_token}`,
169
- [HEYGEN_CLI_SOURCE_HEADER]: HEYGEN_CLI_SOURCE,
170
- [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE
171
- };
172
- }
173
- return { "x-api-key": credential.key, [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE };
174
- }
175
- async function safeText(res) {
176
- try {
177
- const body = (await res.text()).slice(0, 500);
178
- return scrubCredentials(body);
179
- } catch {
180
- return "";
181
- }
182
- }
183
- function extractUserInfo(payload) {
184
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) return {};
185
- const obj = payload;
186
- const wrapped = obj["data"];
187
- const data = wrapped && typeof wrapped === "object" && !Array.isArray(wrapped) ? wrapped : obj;
188
- return {
189
- username: pickString(data, "username"),
190
- email: pickString(data, "email"),
191
- first_name: pickString(data, "first_name"),
192
- last_name: pickString(data, "last_name"),
193
- billing_type: pickString(data, "billing_type"),
194
- wallet: pickObject(data, "wallet"),
195
- subscription: pickObject(data, "subscription"),
196
- usage_based: pickObject(data, "usage_based")
197
- };
198
- }
199
- function pickString(obj, key) {
200
- const v = obj[key];
201
- return typeof v === "string" ? v : void 0;
202
- }
203
- function pickObject(obj, key) {
204
- const v = obj[key];
205
- return v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
206
- }
207
-
208
- // src/auth/paths.ts
209
- import { homedir } from "os";
210
- import { join } from "path";
211
- var CREDENTIAL_FILENAME = "credentials";
212
- function configDir() {
213
- const override = process.env["HEYGEN_CONFIG_DIR"];
214
- if (override && override.length > 0) return override;
215
- return join(homedir(), ".heygen");
216
- }
217
- function credentialPath() {
218
- return join(configDir(), CREDENTIAL_FILENAME);
219
- }
220
-
221
86
  // src/auth/store.ts
222
87
  import { promises as fs } from "fs";
223
88
  import { dirname } from "path";
@@ -451,23 +316,27 @@ function looksLikeApiKey(s) {
451
316
  }
452
317
 
453
318
  // src/auth/resolver.ts
319
+ var ENV_CREDENTIAL_VAR = {
320
+ env: "HEYGEN_API_KEY",
321
+ env_alias: "HYPERFRAMES_API_KEY",
322
+ env_oauth: "HEYGEN_ACCESS_TOKEN"
323
+ };
324
+ var envCredentialVar = (source) => source in ENV_CREDENTIAL_VAR ? ENV_CREDENTIAL_VAR[source] : void 0;
454
325
  var EXPIRY_SKEW_MS = 60 * 1e3;
455
326
  async function resolveCredential(opts = {}) {
456
327
  const now = (opts.now ?? (() => /* @__PURE__ */ new Date()))();
457
- const heygenEnv = process.env["HEYGEN_API_KEY"];
458
- if (heygenEnv && heygenEnv.length > 0) {
459
- if (!isHeaderSafe(heygenEnv)) {
460
- throw ErrInvalidStore("HEYGEN_API_KEY contains control characters");
461
- }
328
+ const heygenEnv = headerSafeEnv(ENV_CREDENTIAL_VAR.env);
329
+ if (heygenEnv) {
462
330
  return { type: "api_key", key: heygenEnv, source: "env" };
463
331
  }
464
- const hfEnv = process.env["HYPERFRAMES_API_KEY"];
465
- if (hfEnv && hfEnv.length > 0) {
466
- if (!isHeaderSafe(hfEnv)) {
467
- throw ErrInvalidStore("HYPERFRAMES_API_KEY contains control characters");
468
- }
332
+ const hfEnv = headerSafeEnv(ENV_CREDENTIAL_VAR.env_alias);
333
+ if (hfEnv) {
469
334
  return { type: "api_key", key: hfEnv, source: "env_alias" };
470
335
  }
336
+ const accessToken = headerSafeEnv(ENV_CREDENTIAL_VAR.env_oauth);
337
+ if (accessToken) {
338
+ return { type: "oauth", access_token: accessToken, source: "env_oauth", refreshable: false };
339
+ }
471
340
  const { credentials, source } = await readStore();
472
341
  if (source === "absent") throw ErrNotConfigured();
473
342
  const fileSource = source === "file_legacy" ? "file_legacy" : "file_json";
@@ -478,6 +347,13 @@ async function resolveCredential(opts = {}) {
478
347
  }
479
348
  throw credentials.oauth ? ErrLoginExpired() : ErrNotConfigured();
480
349
  }
350
+ function headerSafeEnv(name) {
351
+ const value = process.env[name];
352
+ if (value && !isHeaderSafe(value)) {
353
+ throw ErrInvalidStore(`${name} contains control characters`);
354
+ }
355
+ return value;
356
+ }
481
357
  async function tryResolveCredential(opts = {}) {
482
358
  try {
483
359
  return await resolveCredential(opts);
@@ -512,6 +388,141 @@ function parseDate(s) {
512
388
  return Number.isNaN(d.getTime()) ? void 0 : d;
513
389
  }
514
390
 
391
+ // src/auth/scrub.ts
392
+ var HEYGEN_KEY = /\b(hg|sk)_[A-Za-z0-9_-]{4,}/g;
393
+ var HEADER_LINE = /(authorization|x-api-key)[ \t]*[:=][ \t]*[^\r\n]+/gi;
394
+ var JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g;
395
+ var SECRET_FIELDS = [
396
+ "access_token",
397
+ "refresh_token",
398
+ "code_verifier",
399
+ "client_secret",
400
+ "id_token",
401
+ "token",
402
+ "code"
403
+ ];
404
+ var FORM_FIELD = new RegExp(`\\b(${SECRET_FIELDS.join("|")})=[^&\\s"']+`, "gi");
405
+ var JSON_FIELD = new RegExp(`("(?:${SECRET_FIELDS.join("|")})"\\s*:\\s*)"[^"]*"`, "gi");
406
+ function scrubCredentials(s) {
407
+ return s.replace(HEYGEN_KEY, "$1_<redacted>").replace(HEADER_LINE, "$1: <redacted>").replace(JWT, "<jwt-redacted>").replace(FORM_FIELD, "$1=<redacted>").replace(JSON_FIELD, '$1"<redacted>"');
408
+ }
409
+
410
+ // src/auth/client.ts
411
+ var DEFAULT_BASE_URL = "https://api.heygen.com";
412
+ var HEYGEN_CLI_SOURCE_HEADER = "X-HeyGen-Source";
413
+ var HEYGEN_CLI_SOURCE = "cli";
414
+ var HEYGEN_CLIENT_SOURCE_HEADER = "X-HeyGen-Client-Source";
415
+ var HEYGEN_CLIENT_SOURCE = "hyperframes";
416
+ function apiBaseUrl() {
417
+ const override = process.env["HEYGEN_API_URL"];
418
+ return override && override.length > 0 ? override.replace(/\/+$/, "") : DEFAULT_BASE_URL;
419
+ }
420
+ var AuthClient = class {
421
+ base;
422
+ fetchImpl;
423
+ onRefresh;
424
+ constructor(opts = {}) {
425
+ this.base = (opts.baseUrl ?? apiBaseUrl()).replace(/\/+$/, "");
426
+ this.fetchImpl = opts.fetchImpl ?? fetch;
427
+ this.onRefresh = opts.onUnauthenticatedRefresh;
428
+ }
429
+ /**
430
+ * `GET /v3/users/me`. Throws `ErrUnauthenticated` on 401, `ErrApi`
431
+ * on any other non-2xx or non-JSON body.
432
+ *
433
+ * On OAuth 401 with a refresh hook configured, the request is
434
+ * retried once after refreshing the access token. The retry's
435
+ * outcome is what the caller sees — if the refresh itself fails
436
+ * (REFRESH_FAILED) or the retry still 401s, the user lands on a
437
+ * "please log in again" path upstream.
438
+ */
439
+ async getCurrentUser(credential) {
440
+ const url = `${this.base}/v3/users/me`;
441
+ return await this.fetchUser(url, credential, true);
442
+ }
443
+ // fallow-ignore-next-line complexity
444
+ async fetchUser(url, credential, allowRefresh) {
445
+ const headers = buildAuthHeaders(credential);
446
+ const res = await this.fetchImpl(url, { method: "GET", headers });
447
+ if (res.status === 401) {
448
+ if (allowRefresh && credential.type === "oauth" && credential.refresh_token && this.onRefresh) {
449
+ const refreshed = await this.tryRefresh(credential.refresh_token);
450
+ if (refreshed) {
451
+ const next = {
452
+ ...credential,
453
+ access_token: refreshed.access_token,
454
+ ...refreshed.refresh_token ? { refresh_token: refreshed.refresh_token } : {}
455
+ };
456
+ return await this.fetchUser(url, next, false);
457
+ }
458
+ }
459
+ const detail = await safeText(res);
460
+ throw ErrUnauthenticated(detail || `${res.status} ${res.statusText}`);
461
+ }
462
+ if (!res.ok) {
463
+ throw ErrApi(res.status, await safeText(res) || res.statusText);
464
+ }
465
+ let payload;
466
+ try {
467
+ payload = await res.json();
468
+ } catch (err) {
469
+ throw ErrApi(res.status, `non-JSON body: ${err.message}`);
470
+ }
471
+ return extractUserInfo(payload);
472
+ }
473
+ async tryRefresh(refresh_token) {
474
+ if (!this.onRefresh) return null;
475
+ try {
476
+ return await this.onRefresh(refresh_token);
477
+ } catch (err) {
478
+ if (isAuthError(err) && err.code === "REFRESH_FAILED") return null;
479
+ throw err;
480
+ }
481
+ }
482
+ };
483
+ function buildAuthHeaders(credential) {
484
+ if (credential.type === "oauth") {
485
+ return {
486
+ authorization: `Bearer ${credential.access_token}`,
487
+ [HEYGEN_CLI_SOURCE_HEADER]: HEYGEN_CLI_SOURCE,
488
+ [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE
489
+ };
490
+ }
491
+ return { "x-api-key": credential.key, [HEYGEN_CLIENT_SOURCE_HEADER]: HEYGEN_CLIENT_SOURCE };
492
+ }
493
+ async function safeText(res) {
494
+ try {
495
+ const body = (await res.text()).slice(0, 500);
496
+ return scrubCredentials(body);
497
+ } catch {
498
+ return "";
499
+ }
500
+ }
501
+ function extractUserInfo(payload) {
502
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return {};
503
+ const obj = payload;
504
+ const wrapped = obj["data"];
505
+ const data = wrapped && typeof wrapped === "object" && !Array.isArray(wrapped) ? wrapped : obj;
506
+ return {
507
+ username: pickString(data, "username"),
508
+ email: pickString(data, "email"),
509
+ first_name: pickString(data, "first_name"),
510
+ last_name: pickString(data, "last_name"),
511
+ billing_type: pickString(data, "billing_type"),
512
+ wallet: pickObject(data, "wallet"),
513
+ subscription: pickObject(data, "subscription"),
514
+ usage_based: pickObject(data, "usage_based")
515
+ };
516
+ }
517
+ function pickString(obj, key) {
518
+ const v = obj[key];
519
+ return typeof v === "string" ? v : void 0;
520
+ }
521
+ function pickObject(obj, key) {
522
+ const v = obj[key];
523
+ return v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
524
+ }
525
+
515
526
  // src/auth/pkce.ts
516
527
  import { createHash, randomBytes } from "crypto";
517
528
  var VERIFIER_BYTES = 64;
@@ -1190,21 +1201,23 @@ async function safeText2(res) {
1190
1201
  }
1191
1202
 
1192
1203
  export {
1193
- isAuthError,
1194
- apiBaseUrl,
1195
- AuthClient,
1196
- buildAuthHeaders,
1197
1204
  configDir,
1198
1205
  credentialPath,
1206
+ isAuthError,
1199
1207
  readStore,
1200
1208
  writeStore,
1201
1209
  deleteStore,
1202
1210
  hasPreservedUnknownData,
1203
1211
  clearOAuth,
1204
1212
  isHeaderSafe,
1213
+ ENV_CREDENTIAL_VAR,
1214
+ envCredentialVar,
1205
1215
  resolveCredential,
1206
1216
  tryResolveCredential,
1207
1217
  isTokenExpired,
1218
+ apiBaseUrl,
1219
+ AuthClient,
1220
+ buildAuthHeaders,
1208
1221
  assertOAuthConfiguredOrExit,
1209
1222
  startAuthorizationCodeFlow,
1210
1223
  startDeviceAuthorizationFlow,
@@ -35,7 +35,7 @@ import {
35
35
  stripEmbeddedRuntimeScripts,
36
36
  styleElementsFor,
37
37
  warnUnknownEnumValues
38
- } from "./chunk-B3I3XJ47.js";
38
+ } from "./chunk-J4UX3RS3.js";
39
39
  import {
40
40
  cssVariableName
41
41
  } from "./chunk-VC76R6W2.js";
@@ -45,7 +45,7 @@ import {
45
45
  } from "./chunk-OFQWTKPW.js";
46
46
  import {
47
47
  lintHyperframeHtml
48
- } from "./chunk-WY5OODN5.js";
48
+ } from "./chunk-IW2CKH6A.js";
49
49
  import {
50
50
  CSS_URL_RE,
51
51
  checkSubCompositionUsability,
@@ -6,8 +6,8 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
 
8
8
  // src/version.ts
9
- var VERSION = true ? "0.8.140" : "0.0.0-dev";
10
- var PRODUCER_VERSION = true ? "0.8.140" : "0.0.0-dev";
9
+ var VERSION = true ? "0.8.142" : "0.0.0-dev";
10
+ var PRODUCER_VERSION = true ? "0.8.142" : "0.0.0-dev";
11
11
 
12
12
  export {
13
13
  VERSION,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-HVW7ABXD.js";
13
13
  import {
14
14
  DEFAULT_REGISTRY_URL
15
- } from "./chunk-5IKJONRY.js";
15
+ } from "./chunk-QXPCARFE.js";
16
16
 
17
17
  // src/utils/projectConfig.ts
18
18
  import { readFileSync, writeFileSync } from "fs";
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  setHostHandlesSigint
9
- } from "./chunk-TPECLKPA.js";
9
+ } from "./chunk-IDX52YJN.js";
10
10
  import {
11
11
  processAncestorSnapshot,
12
12
  processIdentity,
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  updateNoticesSuppressed
9
- } from "./chunk-DDQ4LOML.js";
9
+ } from "./chunk-JLKMWY2T.js";
10
10
  import {
11
11
  hostAnswers
12
12
  } from "./chunk-K4WIOZFP.js";
@@ -6,20 +6,20 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveProject
9
- } from "./chunk-PB3P4MKP.js";
9
+ } from "./chunk-LJAU4TPS.js";
10
10
  import {
11
11
  installPageFunctionGuard,
12
12
  resolveCliChromeGpuMode,
13
13
  seekCompositionTimeline,
14
14
  waitForRuntimeReady
15
- } from "./chunk-KFQNMY36.js";
15
+ } from "./chunk-WSGY5CDQ.js";
16
16
  import {
17
17
  resolveCompositionViewportFromHtml
18
18
  } from "./chunk-5Z63TBTX.js";
19
19
  import {
20
20
  launchManagedBrowser,
21
21
  resolveManagedGpuMode
22
- } from "./chunk-BQKEGPPL.js";
22
+ } from "./chunk-OSUKETIH.js";
23
23
  import {
24
24
  defineCommand
25
25
  } from "./chunk-S3S4TGEH.js";
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  printDeprecationNotice,
32
32
  withMeta
33
- } from "./chunk-DDQ4LOML.js";
33
+ } from "./chunk-JLKMWY2T.js";
34
34
  import {
35
35
  normalizeErrorMessage
36
36
  } from "./chunk-KNU5COPB.js";
@@ -222,7 +222,7 @@ function extractCompositionErrorsFromLint(lintResult) {
222
222
  async function localizeRemoteAssets(html) {
223
223
  let dir;
224
224
  try {
225
- const { loadProducer } = await import("./producer-PVMFMW23.js");
225
+ const { loadProducer } = await import("./producer-Q6G6JU7B.js");
226
226
  const { localizeRemoteMediaSources, localizeRemoteImageSources, localizeRemoteFontFaces } = await loadProducer();
227
227
  dir = mkdtempSync(join(tmpdir(), "hf-validate-assets-"));
228
228
  const assetDir = dir;
@@ -243,10 +243,10 @@ async function localizeRemoteAssets(html) {
243
243
  }
244
244
  async function validateInBrowser(project, opts) {
245
245
  const projectDir = project.dir;
246
- const { bundleToSingleHtml } = await import("./compiler-RTU3KTLF.js");
246
+ const { bundleToSingleHtml } = await import("./compiler-VTH2D3ID.js");
247
247
  const { ensureBrowser } = await import("./manager-CT3D67CG.js");
248
- const { serveStaticProjectHtml } = await import("./staticProjectServer-XELJXX4J.js");
249
- const { lintProject } = await import("./lintProject-LM3XZRPZ.js");
248
+ const { serveStaticProjectHtml } = await import("./staticProjectServer-IKCSGN2B.js");
249
+ const { lintProject } = await import("./lintProject-RG2KGAXB.js");
250
250
  const lintResult = await lintProject(projectDir);
251
251
  const compositionErrors = extractCompositionErrorsFromLint(lintResult);
252
252
  const html = await bundleToSingleHtml(projectDir);
@@ -267,9 +267,9 @@ async function validateInBrowser(project, opts) {
267
267
  try {
268
268
  const browser = await ensureBrowser();
269
269
  const puppeteer = await import("puppeteer-core");
270
- const { buildChromeArgs, analyzeClipMediaFit } = await import("./src-7SSERHNP.js");
270
+ const { buildChromeArgs, analyzeClipMediaFit } = await import("./src-3I3RH3V5.js");
271
271
  const requestedGpuMode = resolveCliChromeGpuMode();
272
- const { assertWebGpuAdapterAvailable, compositionRequiresWebGpu } = await import("./gpuPolicy-A45VSUKR.js");
272
+ const { assertWebGpuAdapterAvailable, compositionRequiresWebGpu } = await import("./gpuPolicy-LCBWVGEH.js");
273
273
  const resolvedGpuMode = await resolveManagedGpuMode(requestedGpuMode, browser.executablePath);
274
274
  const requiresWebGpu = compositionRequiresWebGpu(html);
275
275
  const chromeBrowser = await launchManagedBrowser(puppeteer.default, {
@@ -7,14 +7,14 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  trackLintReport,
9
9
  trackLintRuleStreak
10
- } from "./chunk-JSGANFFH.js";
10
+ } from "./chunk-XGMNQQTJ.js";
11
11
  import {
12
12
  shouldTrack
13
- } from "./chunk-C2JUHIG5.js";
13
+ } from "./chunk-LBKDQKWV.js";
14
14
  import {
15
15
  LINT_RULE_COUNT,
16
16
  LINT_RULE_GROUP_COUNTS
17
- } from "./chunk-WY5OODN5.js";
17
+ } from "./chunk-IW2CKH6A.js";
18
18
 
19
19
  // src/telemetry/lintStreaks.ts
20
20
  import { createHash } from "crypto";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-AWDFDFI3.js";
15
15
  import {
16
16
  isBlockedNetworkHost
17
- } from "./chunk-TPECLKPA.js";
17
+ } from "./chunk-IDX52YJN.js";
18
18
  import {
19
19
  DOMParser,
20
20
  parseHTML
@@ -26,7 +26,7 @@ import {
26
26
  renderFrameIdForRenderId,
27
27
  resolveAuthoredTimingWindow,
28
28
  toFps
29
- } from "./chunk-QP3BRKGF.js";
29
+ } from "./chunk-YFT3BL7N.js";
30
30
  import {
31
31
  AUDIO_GROUP_RENDER_ID_ATTR,
32
32
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
@@ -55,7 +55,7 @@ import {
55
55
  shiftRateLane,
56
56
  sourceTimeAt,
57
57
  timeAtSourceTime
58
- } from "./chunk-B3I3XJ47.js";
58
+ } from "./chunk-J4UX3RS3.js";
59
59
  import {
60
60
  clampAudioGain,
61
61
  isAudibleVideoElement
@@ -9316,9 +9316,9 @@ function buildStreamingArgs(options, outputPath, gpuEncoder = null) {
9316
9316
  } else {
9317
9317
  args.push(xParamsFlag, `aq-mode=3:aq-strength=0.8:deblock=1,1:${colorParams}${gopParams}`);
9318
9318
  }
9319
- if (codec === "h265") {
9320
- args.push("-tag:v", "hvc1");
9321
- }
9319
+ }
9320
+ if (codec === "h265") {
9321
+ args.push("-tag:v", "hvc1");
9322
9322
  }
9323
9323
  } else if (codec === "vp9") {
9324
9324
  args.push("-c:v", "libvpx-vp9", "-b:v", bitrate || "0", "-crf", String(quality));
@@ -7,29 +7,29 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  RegistryCompatibilityError,
9
9
  gateRegistryItemsCompatibility
10
- } from "./chunk-DQNOPYAG.js";
10
+ } from "./chunk-BPZVDBHY.js";
11
11
  import {
12
12
  DEFAULT_PROJECT_CONFIG,
13
13
  createProjectConfig,
14
14
  loadProjectConfig,
15
15
  projectConfigPath,
16
16
  recordProjectRegistryItems
17
- } from "./chunk-KMKWRIMC.js";
17
+ } from "./chunk-EFDXGAAD.js";
18
18
  import {
19
19
  resolveItemWithDependencies,
20
20
  resolveItemsByTag
21
- } from "./chunk-ASW6NWON.js";
21
+ } from "./chunk-JOTLPC6S.js";
22
22
  import {
23
23
  InvalidVariableValuesError,
24
24
  prepareItem,
25
25
  publishItem
26
- } from "./chunk-VVJFZU6B.js";
26
+ } from "./chunk-75JJVANE.js";
27
27
  import {
28
28
  DEFAULT_REGISTRY_URL
29
- } from "./chunk-5IKJONRY.js";
29
+ } from "./chunk-QXPCARFE.js";
30
30
  import {
31
31
  trackRegistryItemAdded
32
- } from "./chunk-JSGANFFH.js";
32
+ } from "./chunk-XGMNQQTJ.js";
33
33
  import {
34
34
  defineCommand
35
35
  } from "./chunk-S3S4TGEH.js";
@@ -38,7 +38,7 @@ import {
38
38
  } from "./chunk-PBN6GBJE.js";
39
39
  import {
40
40
  ITEM_TYPE_DIRS
41
- } from "./chunk-QP3BRKGF.js";
41
+ } from "./chunk-YFT3BL7N.js";
42
42
  import {
43
43
  isProjectRootMissing,
44
44
  realpath