hyperframes 0.8.119 → 0.8.121

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 (160) hide show
  1. package/dist/{add-LVDM5BBO.js → add-CGDIT7CT.js} +14 -14
  2. package/dist/{animatedGifPrep-RH5AEVNX.js → animatedGifPrep-KPT5VB5Q.js} +5 -5
  3. package/dist/{asset-PA7XD3CI.js → asset-6ZAZIWA7.js} +2 -2
  4. package/dist/{assetCataloger-QX37JS5D.js → assetCataloger-FWWCXIEX.js} +2 -2
  5. package/dist/{auth-SQIHPP3J.js → auth-W4WZ5KT2.js} +4 -4
  6. package/dist/{autoUpdate-JCG27FBW.js → autoUpdate-2KRUUCM2.js} +2 -2
  7. package/dist/{backgroundChecks-U7JCBAWI.js → backgroundChecks-M7YRL5G3.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-BBBUJETN.js → batchRender-2HXYPO62.js} +3 -3
  10. package/dist/{beats-6BSMZTE6.js → beats-KXLHRYXV.js} +13 -13
  11. package/dist/{benchmark-WOZCECBF.js → benchmark-TZRC6JEE.js} +11 -11
  12. package/dist/{browser-KNPH25NJ.js → browser-KFCZEHSG.js} +8 -8
  13. package/dist/{bundleWithLocalizedFonts-I4RJWHKR.js → bundleWithLocalizedFonts-3RRACCEV.js} +2 -2
  14. package/dist/{capture-4WXKXCCV.js → capture-3L7VTWDG.js} +8 -8
  15. package/dist/{capture-PZQOA465.js → capture-N25LJPGM.js} +2 -2
  16. package/dist/{catalog-OXCKYFHY.js → catalog-OJK3RAMA.js} +14 -14
  17. package/dist/{check-N4QDDW6N.js → check-DUQ2OHRX.js} +33 -33
  18. package/dist/{checkBrowser-D3L4OXTQ.js → checkBrowser-XHNFT3DB.js} +30 -30
  19. package/dist/{chunk-P6UJ22SS.js → chunk-2C6UJPQS.js} +1 -1
  20. package/dist/{chunk-TOOQJPUJ.js → chunk-2CGUG4XK.js} +5 -5
  21. package/dist/{chunk-2FJPEXII.js → chunk-2LWWIDPZ.js} +1 -1
  22. package/dist/{chunk-KWABBJYI.js → chunk-2XV3S6TA.js} +2 -2
  23. package/dist/{chunk-HNOJAFT2.js → chunk-3DCZIHXE.js} +21 -21
  24. package/dist/{chunk-WJP3UOB3.js → chunk-3WXWL7AY.js} +1 -1
  25. package/dist/{chunk-Y44PIZOH.js → chunk-44EFU366.js} +11 -11
  26. package/dist/{chunk-523Q6JDM.js → chunk-4JC7LDBQ.js} +2 -2
  27. package/dist/{chunk-OLFFCC2D.js → chunk-5OS5XIWZ.js} +1 -1
  28. package/dist/{chunk-KK7VGMEF.js → chunk-5PTKFXAS.js} +11 -11
  29. package/dist/{chunk-M6LKSPER.js → chunk-6WIWCYD5.js} +3 -3
  30. package/dist/{chunk-V5T6IA7D.js → chunk-6Z4E4GBX.js} +1 -1
  31. package/dist/{chunk-FRIRP3DN.js → chunk-7VXU7E5S.js} +1 -1
  32. package/dist/{chunk-KFKEMNSW.js → chunk-AA4KEZGW.js} +3 -3
  33. package/dist/{chunk-U7AMFQ6G.js → chunk-BN5KOC5O.js} +1 -1
  34. package/dist/{chunk-GVJMAHXQ.js → chunk-DISNXEWU.js} +2 -2
  35. package/dist/{chunk-7UXUVWOY.js → chunk-E5XIJTMU.js} +1 -1
  36. package/dist/{chunk-SUIF4D5H.js → chunk-GF4MOYGU.js} +8 -8
  37. package/dist/{chunk-5IABQ7OX.js → chunk-GPGWCFIA.js} +1 -1
  38. package/dist/{chunk-DNXD7TOA.js → chunk-I465DBM6.js} +27 -12
  39. package/dist/chunk-IGLEPPTN.js +24 -0
  40. package/dist/{chunk-MYSYOQPV.js → chunk-IVLJE3VX.js} +2 -2
  41. package/dist/{chunk-4PTKEI2C.js → chunk-JACPHNUK.js} +1 -1
  42. package/dist/{chunk-MVWXSRY6.js → chunk-JH556Q42.js} +69 -21
  43. package/dist/{chunk-BKQXLO55.js → chunk-JREV7WVY.js} +1 -1
  44. package/dist/{chunk-V2VNJNX6.js → chunk-JWGYWJ5F.js} +1 -1
  45. package/dist/{chunk-AMSNSTLK.js → chunk-JWHQKTVG.js} +3 -3
  46. package/dist/{chunk-FNX7RJIJ.js → chunk-KYDM3W7A.js} +2 -2
  47. package/dist/{chunk-U3CILSBM.js → chunk-LZN67SFR.js} +1 -1
  48. package/dist/{chunk-IUBZ3DSO.js → chunk-MNMD6XLG.js} +2 -2
  49. package/dist/{chunk-CDTPNYO3.js → chunk-NPHNGWJH.js} +3 -3
  50. package/dist/{chunk-EEXM24SY.js → chunk-OWPHLEDI.js} +5 -5
  51. package/dist/chunk-PATLRNZA.js +3541 -0
  52. package/dist/{chunk-2WKWEB4T.js → chunk-RCNDZEBU.js} +1 -1
  53. package/dist/{chunk-KNXXZ73S.js → chunk-RYSHGEZL.js} +4 -4
  54. package/dist/{chunk-OI3IIR2X.js → chunk-S6Y2LOTE.js} +1 -1
  55. package/dist/chunk-SHB5VDMH.js +51 -0
  56. package/dist/{chunk-OWMGDQBZ.js → chunk-SJ64QY5Z.js} +1 -1
  57. package/dist/{chunk-OV62R47Q.js → chunk-VU4KRDRL.js} +1 -1
  58. package/dist/{chunk-6Q3Q7HGA.js → chunk-WBRDOH4A.js} +1 -1
  59. package/dist/{chunk-3NXDJSD5.js → chunk-WG4IZWEH.js} +2 -2
  60. package/dist/{chunk-LHU6KXWL.js → chunk-WW7V2GQJ.js} +1 -1
  61. package/dist/{chunk-2MMAA5I3.js → chunk-XLG5C3XA.js} +1 -1
  62. package/dist/{chunk-RLYTIMTS.js → chunk-Y6W4DVPS.js} +4 -37
  63. package/dist/{chunk-BZKDN6BU.js → chunk-YE5UC4XH.js} +7 -7
  64. package/dist/{chunk-ZTU5PYQJ.js → chunk-YJMQLWG4.js} +36 -23
  65. package/dist/{chunk-PPTHGZTG.js → chunk-ZBMQOBQK.js} +1 -1
  66. package/dist/{chunk-RZAXPDIT.js → chunk-ZTZ7NCJT.js} +1 -1
  67. package/dist/{chunk-RMDKZTSI.js → chunk-ZUVO6Q5Q.js} +2 -2
  68. package/dist/{clean-VWT7OZEN.js → clean-NH5JTTXP.js} +17 -17
  69. package/dist/cli.js +52 -70
  70. package/dist/{cloud-BB7SW4DX.js → cloud-QKM43VWA.js} +4 -4
  71. package/dist/{cloudrun-OQLPEWGP.js → cloudrun-JQCGTNFP.js} +3 -3
  72. package/dist/{compare-3Z4BPHIZ.js → compare-2ZOO6GRL.js} +29 -29
  73. package/dist/{compiler-GPUSYMA6.js → compiler-WNWCQTI6.js} +2 -2
  74. package/dist/{component-6H2NIATV.js → component-Q5AECWP4.js} +3 -3
  75. package/dist/{compositions-I357YMW6.js → compositions-KEMPAOSU.js} +10 -10
  76. package/dist/{delete-YJQPGNJJ.js → delete-TWGIIVHU.js} +6 -5
  77. package/dist/{deterministicFonts-O7BTFDJU.js → deterministicFonts-ITMUXWD2.js} +2 -2
  78. package/dist/{dist-NP53GO3N.js → dist-JGUAVYZS.js} +2 -2
  79. package/dist/{doctor-NP34O2SX.js → doctor-COVUXJ2H.js} +9 -9
  80. package/dist/dotEnv-AI4SYVTX.js +39 -0
  81. package/dist/{events-T4KFU5HZ.js → events-6K4KG2RC.js} +8 -8
  82. package/dist/{events-NV6CNGUD.js → events-PNRVEJOH.js} +7 -7
  83. package/dist/{feedback-DKHIGKC4.js → feedback-YACZS7R7.js} +41 -17
  84. package/dist/{figma-ALVXXDIQ.js → figma-LEEL7JF7.js} +3 -3
  85. package/dist/fontLocalizeCli.js +9 -9
  86. package/dist/{get-CKKP6UBL.js → get-FX23HBPC.js} +6 -5
  87. package/dist/{gpuPolicy-WWBLJO6C.js → gpuPolicy-TCSAVM2S.js} +5 -5
  88. package/dist/{grade-compare-7POS3AY6.js → grade-compare-ENNPIMZX.js} +25 -25
  89. package/dist/{help-KGRXGCVJ.js → help-HNY5LMYR.js} +1 -1
  90. package/dist/{history-JLXPVI2L.js → history-325KQTJM.js} +17 -17
  91. package/dist/hyperframe-runtime.js +54 -54
  92. package/dist/hyperframe.manifest.json +1 -1
  93. package/dist/hyperframe.runtime.iife.js +54 -54
  94. package/dist/hyperframes-player.global.js +1 -1
  95. package/dist/{info-QA5UAYFS.js → info-GKPHG3QO.js} +10 -10
  96. package/dist/{init-7SM4AD76.js → init-UYF6SWL7.js} +21 -21
  97. package/dist/{inspect-ANJ2CRLP.js → inspect-A6DZG7KU.js} +26 -26
  98. package/dist/{installer-EUT2OZTH.js → installer-EY3AB44Q.js} +4 -4
  99. package/dist/{keyframes-H2ZUI3DC.js → keyframes-P62TMLKQ.js} +11 -11
  100. package/dist/{lambda-HZ2ZKLVH.js → lambda-HWU6V36S.js} +4 -4
  101. package/dist/{layout-EDDKQ67V.js → layout-GWF2HD5Z.js} +26 -26
  102. package/dist/{lint-SVXOETDR.js → lint-OBGOECOL.js} +13 -13
  103. package/dist/{list-YRBK24UM.js → list-ZOUMRWXQ.js} +6 -5
  104. package/dist/{login-VE7VGBOA.js → login-4H6ZVI6D.js} +6 -6
  105. package/dist/{logout-HJQT42RL.js → logout-Q654A3SI.js} +2 -2
  106. package/dist/{media-treatment-ZQOBGLJQ.js → media-treatment-GRBN3MG5.js} +13 -13
  107. package/dist/{models-GVMX5TFG.js → models-YFTLSJEG.js} +8 -8
  108. package/dist/{motionShot-2Z6LRHEV.js → motionShot-7VLC2ULG.js} +10 -10
  109. package/dist/{normalize-audio-QHMZWNNH.js → normalize-audio-SLBARKVY.js} +13 -13
  110. package/dist/{pipeline-HYULUMEV.js → pipeline-WRNKPJZH.js} +5 -5
  111. package/dist/{play-EYXIIZHG.js → play-PDEXRHV6.js} +28 -28
  112. package/dist/{preflight-KJHZ46FX.js → preflight-6TUK6Z7A.js} +6 -6
  113. package/dist/{present-YQ2BRUNH.js → present-UXWOO2YL.js} +18 -18
  114. package/dist/{preview-QMAPLY2S.js → preview-CWHCNYYZ.js} +26 -26
  115. package/dist/{producer-FS442D4D.js → producer-WDTJSNXK.js} +1 -1
  116. package/dist/{projectConfig-A4DXJF4P.js → projectConfig-DBP5POAQ.js} +6 -6
  117. package/dist/{publication-QY2H23JU.js → publication-SUAGUL5G.js} +2 -2
  118. package/dist/{publish-PCT6JM4B.js → publish-CDKO6FSQ.js} +39 -33
  119. package/dist/{refresh-IK6LUV5Z.js → refresh-K24ETHMA.js} +2 -2
  120. package/dist/{remove-background-O2J7EVEN.js → remove-background-QFMDODZ4.js} +6 -6
  121. package/dist/{render-6QXPYNLY.js → render-BYD7ZASF.js} +27 -27
  122. package/dist/{render-QUQJP5PP.js → render-NRNF56OV.js} +3 -3
  123. package/dist/{render-HYA6UBZD.js → render-XTI7E22A.js} +20 -19
  124. package/dist/{render-batch-OS4UEZA4.js → render-batch-L2AIXYA3.js} +3 -3
  125. package/dist/{renderCancellation-RWWLGOOD.js → renderCancellation-XR3W2AQT.js} +5 -5
  126. package/dist/{resolver-IM46W362.js → resolver-RYPIAEGU.js} +4 -4
  127. package/dist/{sherpa-COBFACPG.js → sherpa-MXQ34FFS.js} +8 -8
  128. package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +23 -6
  129. package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +42 -2
  130. package/dist/{skills-CT7TY7SZ.js → skills-MZQUKPEY.js} +10 -10
  131. package/dist/{skillsUpdateCheck-AWHTVNPB.js → skillsUpdateCheck-B5F5UR7U.js} +3 -3
  132. package/dist/{snapshot-C4PYM7G5.js → snapshot-HPBNWSSK.js} +31 -31
  133. package/dist/{src-QOQJLFDK.js → src-BS6B2UWS.js} +4 -4
  134. package/dist/{src-GGDAYPPK.js → src-RNEWLAP6.js} +8 -8
  135. package/dist/{staticProjectServer-RBGIJQMY.js → staticProjectServer-B44OD7QD.js} +13 -13
  136. package/dist/{status-FCLZF4FT.js → status-RYS52BAQ.js} +7 -7
  137. package/dist/studio/assets/{hyperframes-player-7Icl2uVN.js → hyperframes-player-GkN9yzzq.js} +1 -1
  138. package/dist/studio/assets/{index-7YcUqkoh.js → index-BpKhiuzT.js} +1 -1
  139. package/dist/studio/assets/{index-Dc8FEIEU.js → index-ByV72rWx.js} +1 -1
  140. package/dist/studio/assets/{index-DOO2cYhl.js → index-CyFqMHGS.js} +174 -174
  141. package/dist/studio/index.d.ts +5 -1
  142. package/dist/studio/index.html +1 -1
  143. package/dist/studio/index.js +72 -87
  144. package/dist/studio/index.js.map +1 -1
  145. package/dist/{studio-api-Y67F5TPC.js → studio-api-YCS6DZMR.js} +7 -7
  146. package/dist/{studioServer-SCAZGVUQ.js → studioServer-AEXETXZ2.js} +39 -39
  147. package/dist/{system-QUFWS7NN.js → system-TD2HPCOA.js} +5 -5
  148. package/dist/{telemetry-JJJQWUA3.js → telemetry-7KDXFPTK.js} +8 -8
  149. package/dist/{timeline-BEWRG3QA.js → timeline-P4IMRDIN.js} +17 -17
  150. package/dist/{tokens-GAZXBXWG.js → tokens-HKYWL774.js} +2 -2
  151. package/dist/{transcribe-UJUYNNEH.js → transcribe-2E4QY24M.js} +6 -6
  152. package/dist/{transcribe-ZCFEAIAW.js → transcribe-UIQMMHXI.js} +11 -11
  153. package/dist/{updateCheck-H5DKTWUO.js → updateCheck-KWLMTR35.js} +2 -2
  154. package/dist/{upgrade-RUBSQNRS.js → upgrade-E4TMMCGK.js} +2 -2
  155. package/dist/{urlDownloader-5FUUYAOT.js → urlDownloader-P2EJDWLH.js} +4 -4
  156. package/dist/{validate-5R3OJEGF.js → validate-IX47WBNJ.js} +15 -15
  157. package/dist/{video-RTC4AXZB.js → video-56EQZA6M.js} +5 -5
  158. package/package.json +1 -1
  159. package/dist/chunk-SHLFJFPM.js +0 -3541
  160. package/dist/{chunk-AIYKVE4Y.js → chunk-2GKO3X7F.js} +3 -3
@@ -21,7 +21,7 @@ import {
21
21
  shouldClampResolvedMediaDuration,
22
22
  stripEmbeddedRuntimeScripts,
23
23
  warnUnknownEnumValues
24
- } from "./chunk-SHLFJFPM.js";
24
+ } from "./chunk-PATLRNZA.js";
25
25
  import {
26
26
  cssVariableName
27
27
  } from "./chunk-VC76R6W2.js";
@@ -51,6 +51,16 @@ var ErrRefreshFailed = (detail) => new AuthError(
51
51
  detail ? `Failed to refresh OAuth tokens: ${detail}` : "Failed to refresh OAuth tokens",
52
52
  "Run `hyperframes auth login` to re-authenticate."
53
53
  );
54
+ var ErrLoginExpired = () => new AuthError(
55
+ "LOGIN_EXPIRED",
56
+ "Your HeyGen login expired",
57
+ "Run `hyperframes auth login` to sign in again."
58
+ );
59
+ var ErrLoginChanged = () => new AuthError(
60
+ "LOGIN_CHANGED",
61
+ "Your HeyGen login changed while this command ran",
62
+ "Run the command again."
63
+ );
54
64
  var ErrDeviceAuthFailed = (detail) => new AuthError(
55
65
  "DEVICE_AUTH_FAILED",
56
66
  `Device authorization failed: ${detail}`,
@@ -461,14 +471,12 @@ async function resolveCredential(opts = {}) {
461
471
  const { credentials, source } = await readStore();
462
472
  if (source === "absent") throw ErrNotConfigured();
463
473
  const fileSource = source === "file_legacy" ? "file_legacy" : "file_json";
464
- if (credentials.oauth) {
465
- const oauth = pickOAuth(credentials.oauth, now, fileSource);
466
- if (oauth) return oauth;
467
- }
474
+ const oauth = credentials.oauth ? pickOAuth(credentials.oauth, now, fileSource) : null;
475
+ if (oauth) return oauth;
468
476
  if (credentials.api_key) {
469
477
  return { type: "api_key", key: credentials.api_key, source: fileSource };
470
478
  }
471
- throw ErrNotConfigured();
479
+ throw credentials.oauth ? ErrLoginExpired() : ErrNotConfigured();
472
480
  }
473
481
  async function tryResolveCredential(opts = {}) {
474
482
  try {
@@ -482,7 +490,7 @@ async function tryResolveCredential(opts = {}) {
482
490
  }
483
491
  function pickOAuth(tokens, now, source) {
484
492
  const expiresAt = parseDate(tokens.expires_at);
485
- const expired = expiresAt !== void 0 && expiresAt.getTime() - EXPIRY_SKEW_MS < now.getTime();
493
+ const expired = isTokenExpired(expiresAt, now);
486
494
  if (expired && !tokens.refresh_token) return null;
487
495
  const out = {
488
496
  type: "oauth",
@@ -495,6 +503,9 @@ function pickOAuth(tokens, now, source) {
495
503
  if (tokens.scope) out.scope = tokens.scope;
496
504
  return out;
497
505
  }
506
+ function isTokenExpired(expiresAt, now) {
507
+ return expiresAt !== void 0 && expiresAt.getTime() - EXPIRY_SKEW_MS < now.getTime();
508
+ }
498
509
  function parseDate(s) {
499
510
  if (!s) return void 0;
500
511
  const d = new Date(s);
@@ -736,7 +747,7 @@ async function startAuthorizationCodeFlow(opts = {}) {
736
747
  verifier: pkce.verifier,
737
748
  fetchImpl: opts.fetchImpl
738
749
  });
739
- await persistOAuth(tokens, { preserveMissing: false });
750
+ await persistOAuth(tokens);
740
751
  return { tokens };
741
752
  }
742
753
  async function startDeviceAuthorizationFlow(opts = {}) {
@@ -884,7 +895,7 @@ async function refreshTokens(refresh_token, opts = {}) {
884
895
  }
885
896
  const payload = await readJsonOrThrow(res);
886
897
  const tokens = parseTokenResponse(payload);
887
- await persistOAuth(tokens, { preserveMissing: true });
898
+ await persistOAuth(tokens, { refreshed: refresh_token });
888
899
  return tokens;
889
900
  }
890
901
  async function revokeTokens(token, opts = {}) {
@@ -1009,15 +1020,18 @@ function numericField(obj, key) {
1009
1020
  }
1010
1021
  return void 0;
1011
1022
  }
1012
- async function persistOAuth(tokens, opts) {
1023
+ async function persistOAuth(tokens, opts = {}) {
1013
1024
  let existing = {};
1014
1025
  try {
1015
1026
  const { credentials } = await readStore();
1016
1027
  existing = credentials;
1017
- } catch {
1018
- existing = {};
1028
+ } catch (err) {
1029
+ if (opts.refreshed !== void 0) throw err;
1030
+ }
1031
+ if (opts.refreshed !== void 0 && existing.oauth?.refresh_token !== opts.refreshed) {
1032
+ throw ErrLoginChanged();
1019
1033
  }
1020
- const oauth = opts.preserveMissing ? { ...existing.oauth, ...tokens } : { ...tokens };
1034
+ const oauth = opts.refreshed !== void 0 ? { ...existing.oauth, ...tokens } : { ...tokens };
1021
1035
  await writeStore({ ...existing, oauth });
1022
1036
  }
1023
1037
  async function persistVerifiedOAuthSession(tokens, user) {
@@ -1190,6 +1204,7 @@ export {
1190
1204
  isHeaderSafe,
1191
1205
  resolveCredential,
1192
1206
  tryResolveCredential,
1207
+ isTokenExpired,
1193
1208
  assertOAuthConfiguredOrExit,
1194
1209
  startAuthorizationCodeFlow,
1195
1210
  startDeviceAuthorizationFlow,
@@ -0,0 +1,24 @@
1
+ import { createRequire as __hf_createRequire } from "node:module";
2
+ import { fileURLToPath as __hf_fileURLToPath } from "node:url";
3
+ import { dirname as __hf_dirname } from "node:path";
4
+ var require = __hf_createRequire(import.meta.url);
5
+ var __filename = __hf_fileURLToPath(import.meta.url);
6
+ var __dirname = __hf_dirname(__filename);
7
+
8
+ // src/utils/feedbackSource.ts
9
+ var SOURCES = ["person", "agent"];
10
+ function parseFeedbackSource(raw) {
11
+ if (raw === void 0) return void 0;
12
+ const source = raw.trim();
13
+ return SOURCES.includes(source) ? source : null;
14
+ }
15
+ var FEEDBACK_EMAIL_ENV = "HYPERFRAMES_FEEDBACK_EMAIL";
16
+ function feedbackEmail(env = process.env) {
17
+ return env[FEEDBACK_EMAIL_ENV]?.trim() || void 0;
18
+ }
19
+
20
+ export {
21
+ parseFeedbackSource,
22
+ FEEDBACK_EMAIL_ENV,
23
+ feedbackEmail
24
+ };
@@ -20,7 +20,7 @@ import {
20
20
  typeDirPath,
21
21
  updateRecord,
22
22
  withFigmaErrors
23
- } from "./chunk-2FJPEXII.js";
23
+ } from "./chunk-2LWWIDPZ.js";
24
24
  import {
25
25
  defineCommand
26
26
  } from "./chunk-S3S4TGEH.js";
@@ -221,7 +221,7 @@ var asset_default = defineCommand({
221
221
  rendered > 0 ? `(${results.length} nodes, ${rendered} rendered in 1 figma request)` : `(${results.length} nodes, all reused from cache \u2014 no figma request)`
222
222
  );
223
223
  }
224
- const { trackFigmaImport } = await import("./telemetry-JJJQWUA3.js");
224
+ const { trackFigmaImport } = await import("./telemetry-7KDXFPTK.js");
225
225
  trackFigmaImport({
226
226
  phase: "asset",
227
227
  reused: results.every((r) => r.reused),
@@ -8,7 +8,7 @@ import {
8
8
  DEFAULT_REGISTRY_URL,
9
9
  fetchItemManifest,
10
10
  fetchRegistryManifest
11
- } from "./chunk-PPTHGZTG.js";
11
+ } from "./chunk-ZBMQOBQK.js";
12
12
 
13
13
  // src/registry/resolver.ts
14
14
  function defaultWarn(message) {
@@ -4,10 +4,15 @@ import { dirname as __hf_dirname } from "node:path";
4
4
  var require = __hf_createRequire(import.meta.url);
5
5
  var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
+ import {
8
+ refreshIfNeeded
9
+ } from "./chunk-SHB5VDMH.js";
7
10
  import {
8
11
  buildAuthHeaders,
12
+ isAuthError,
13
+ isTokenExpired,
9
14
  tryResolveCredential
10
- } from "./chunk-DNXD7TOA.js";
15
+ } from "./chunk-I465DBM6.js";
11
16
  import {
12
17
  CSS_URL_RE,
13
18
  isNonRelativeUrl,
@@ -191,6 +196,36 @@ function getUploadHeaders(data, uploadUrl, contentType, archiveByteLength) {
191
196
  async function readJson(response) {
192
197
  return response.clone().json().catch(() => null);
193
198
  }
199
+ var CredentialRejectedError = class extends Error {
200
+ };
201
+ async function metadataRequestError(response, fallback) {
202
+ const message = await readErrorMessage(response, fallback);
203
+ return response.status === 401 ? new CredentialRejectedError(message) : new Error(message);
204
+ }
205
+ var LOGIN_EXPIRED = "Your login expired. Run hyperframes auth login, then publish again.";
206
+ var LOGIN_CHANGED = "Your login changed during publish. Run publish again.";
207
+ var API_KEY_ENV_VAR = { env: "HEYGEN_API_KEY", env_alias: "HYPERFRAMES_API_KEY" };
208
+ function rejectedCredentialMessage(credential) {
209
+ if (credential.type === "api_key" && (credential.source === "env" || credential.source === "env_alias")) {
210
+ return `${API_KEY_ENV_VAR[credential.source]} was rejected. Fix or unset it, then publish again.`;
211
+ }
212
+ return LOGIN_EXPIRED;
213
+ }
214
+ async function resolvePublishCredential(checked) {
215
+ try {
216
+ const credential = checked === void 0 ? await tryResolveCredential() : checked;
217
+ if (!credential) return null;
218
+ const expired = credential.type === "oauth" && isTokenExpired(credential.expires_at, /* @__PURE__ */ new Date());
219
+ if (expired && !credential.refresh_token) throw new Error(LOGIN_EXPIRED);
220
+ return await refreshIfNeeded(expired ? { ...credential, refreshable: true } : credential);
221
+ } catch (error) {
222
+ if (isAuthError(error) && (error.code === "REFRESH_FAILED" || error.code === "LOGIN_EXPIRED")) {
223
+ throw new Error(LOGIN_EXPIRED);
224
+ }
225
+ if (isAuthError(error) && error.code === "LOGIN_CHANGED") throw new Error(LOGIN_CHANGED);
226
+ throw error;
227
+ }
228
+ }
194
229
  async function readErrorMessage(response, fallback) {
195
230
  const contentType = response.headers.get("content-type") || "";
196
231
  if (contentType.includes("application/json")) {
@@ -477,7 +512,7 @@ async function publishProjectArchiveDirect(apiBaseUrl, title, archive, isPublic,
477
512
  const payload = await readJson(response);
478
513
  const publishedProject = parsePublishedProjectResponse(payload);
479
514
  if (!response.ok || !publishedProject) {
480
- throw new Error(await readErrorMessage(response, "Failed to publish project"));
515
+ throw await metadataRequestError(response, "Failed to publish project");
481
516
  }
482
517
  return publishedProject;
483
518
  }
@@ -526,7 +561,7 @@ async function publishProjectArchiveStaged(apiBaseUrl, title, archive, isPublic,
526
561
  const uploadPayload = await readJson(uploadResponse);
527
562
  const stagedUpload = parseStagedUploadResponse(uploadPayload, archive.buffer.byteLength);
528
563
  if (!uploadResponse.ok || !stagedUpload) {
529
- throw new Error(await readErrorMessage(uploadResponse, "Failed to prepare project upload"));
564
+ throw await metadataRequestError(uploadResponse, "Failed to prepare project upload");
530
565
  }
531
566
  await uploadArchiveToPresignedUrl(stagedUpload, archive);
532
567
  const completeResponse = await fetchForPublish(
@@ -551,7 +586,7 @@ async function publishProjectArchiveStaged(apiBaseUrl, title, archive, isPublic,
551
586
  const completePayload = await readJson(completeResponse);
552
587
  const publishedProject = parsePublishedProjectResponse(completePayload);
553
588
  if (!completeResponse.ok || !publishedProject) {
554
- throw new Error(await readErrorMessage(completeResponse, "Failed to publish project"));
589
+ throw await metadataRequestError(completeResponse, "Failed to publish project");
555
590
  }
556
591
  return publishedProject;
557
592
  }
@@ -560,27 +595,38 @@ async function publishProjectArchive(projectDir, opts = {}) {
560
595
  const title = basename(projectDir);
561
596
  const archive = opts.archive ?? createPublishArchive(projectDir);
562
597
  const apiBaseUrl = getPublishApiBaseUrl();
563
- const credential = await tryResolveCredential();
598
+ const credential = await resolvePublishCredential(opts.credential);
564
599
  const authHeaders = credential ? buildAuthHeaders(credential) : {};
565
600
  const projectId = credential ? opts.projectId : void 0;
566
601
  const spaceId = credential ? opts.spaceId : void 0;
567
602
  const metadataHeaders = spaceId ? { ...authHeaders, "x-space-id": spaceId } : authHeaders;
568
- const result = await publishProjectArchiveStaged(
569
- apiBaseUrl,
570
- title,
571
- archive,
572
- isPublic,
573
- metadataHeaders,
574
- projectId
575
- ) ?? await publishProjectArchiveDirect(
576
- apiBaseUrl,
577
- title,
578
- archive,
579
- isPublic,
580
- metadataHeaders,
581
- projectId
582
- );
583
- if (credential) {
603
+ let result;
604
+ try {
605
+ result = await publishProjectArchiveStaged(
606
+ apiBaseUrl,
607
+ title,
608
+ archive,
609
+ isPublic,
610
+ metadataHeaders,
611
+ projectId
612
+ ) ?? await publishProjectArchiveDirect(
613
+ apiBaseUrl,
614
+ title,
615
+ archive,
616
+ isPublic,
617
+ metadataHeaders,
618
+ projectId
619
+ );
620
+ if (credential?.type === "oauth" && !result.claimed) {
621
+ throw new CredentialRejectedError("unclaimed publish");
622
+ }
623
+ } catch (error) {
624
+ if (error instanceof CredentialRejectedError && credential) {
625
+ throw new Error(rejectedCredentialMessage(credential));
626
+ }
627
+ throw error;
628
+ }
629
+ if (result.claimed) {
584
630
  writeProjectLink(projectDir, { projectId: result.projectId, url: result.url });
585
631
  }
586
632
  return result;
@@ -591,6 +637,8 @@ export {
591
637
  ensureProjectId,
592
638
  readTeamProject,
593
639
  writeTeamProject,
640
+ API_KEY_ENV_VAR,
641
+ resolvePublishCredential,
594
642
  rewriteHtmlAttributes,
595
643
  buildPublishFileMap,
596
644
  zipPublishFileMap,
@@ -8,7 +8,7 @@ import {
8
8
  MAX_AUDIO_GAIN_DB,
9
9
  formatAudioGain,
10
10
  isAudibleVideoElement
11
- } from "./chunk-SHLFJFPM.js";
11
+ } from "./chunk-PATLRNZA.js";
12
12
  import {
13
13
  findFfBinary
14
14
  } from "./chunk-PJ3HDUCY.js";
@@ -14,7 +14,7 @@ import {
14
14
  } from "./chunk-AWDFDFI3.js";
15
15
  import {
16
16
  isBlockedNetworkHost
17
- } from "./chunk-IUBZ3DSO.js";
17
+ } from "./chunk-MNMD6XLG.js";
18
18
  import {
19
19
  DOMParser,
20
20
  parseHTML
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  getMimeType,
9
9
  injectMediaCodecMapIntoHtml
10
- } from "./chunk-ZTU5PYQJ.js";
10
+ } from "./chunk-YJMQLWG4.js";
11
11
  import {
12
12
  PROXY_VARIANT_CONFIG,
13
13
  ProxyCapacityError,
@@ -18,10 +18,10 @@ import {
18
18
  recordProxyRequest,
19
19
  resolveProxy,
20
20
  resolveProxyVariantRequest
21
- } from "./chunk-OWMGDQBZ.js";
21
+ } from "./chunk-SJ64QY5Z.js";
22
22
  import {
23
23
  resolveAutoProxy
24
- } from "./chunk-WJP3UOB3.js";
24
+ } from "./chunk-3WXWL7AY.js";
25
25
 
26
26
  // src/utils/staticProjectServer.ts
27
27
  import { createServer } from "http";
@@ -8,14 +8,14 @@ import {
8
8
  DEFAULT_REGISTRY_URL,
9
9
  fetchItemFile,
10
10
  validRegistryItem
11
- } from "./chunk-PPTHGZTG.js";
11
+ } from "./chunk-ZBMQOBQK.js";
12
12
  import {
13
13
  publishRegistryFile,
14
14
  registryTargetPath
15
15
  } from "./chunk-GMECXFAN.js";
16
16
  import {
17
17
  validateVariables
18
- } from "./chunk-2WKWEB4T.js";
18
+ } from "./chunk-RCNDZEBU.js";
19
19
  import {
20
20
  realProjectRoot
21
21
  } from "./chunk-OFQWTKPW.js";
@@ -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-IUBZ3DSO.js";
9
+ } from "./chunk-MNMD6XLG.js";
10
10
  import {
11
11
  processAncestorSnapshot,
12
12
  processIdentity,
@@ -22,7 +22,7 @@ import {
22
22
  renderFrameIdForRenderId,
23
23
  resolveAuthoredTimingWindow,
24
24
  toFps
25
- } from "./chunk-2WKWEB4T.js";
25
+ } from "./chunk-RCNDZEBU.js";
26
26
  import {
27
27
  AUDIO_GROUP_RENDER_ID_ATTR,
28
28
  COLOR_GRADING_SOURCE_HIDDEN_ATTR,
@@ -52,7 +52,7 @@ import {
52
52
  shiftRateLane,
53
53
  sourceTimeAt,
54
54
  timeAtSourceTime
55
- } from "./chunk-SHLFJFPM.js";
55
+ } from "./chunk-PATLRNZA.js";
56
56
  import {
57
57
  chromeMajorCeiling,
58
58
  exceedsChromeCeiling
@@ -8,16 +8,16 @@ import {
8
8
  flush,
9
9
  shouldTrack,
10
10
  trackEvent
11
- } from "./chunk-M6LKSPER.js";
11
+ } from "./chunk-6WIWCYD5.js";
12
12
  import {
13
13
  getPowerState
14
- } from "./chunk-U7AMFQ6G.js";
14
+ } from "./chunk-BN5KOC5O.js";
15
15
  import {
16
16
  CliRuntimeError
17
17
  } from "./chunk-PBN6GBJE.js";
18
18
  import {
19
19
  redactTelemetryString
20
- } from "./chunk-2WKWEB4T.js";
20
+ } from "./chunk-RCNDZEBU.js";
21
21
  import {
22
22
  readConfig
23
23
  } from "./chunk-XUXGIA7H.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-5ETJX6WM.js";
17
17
  import {
18
18
  runEnvironmentChecks
19
- } from "./chunk-OV62R47Q.js";
19
+ } from "./chunk-VU4KRDRL.js";
20
20
  import {
21
21
  c
22
22
  } from "./chunk-ZTZA4UWZ.js";
@@ -25,24 +25,24 @@ import {
25
25
  getFreeDiskMb,
26
26
  getShmSizeMb,
27
27
  getSystemMeta
28
- } from "./chunk-U7AMFQ6G.js";
28
+ } from "./chunk-BN5KOC5O.js";
29
29
  import {
30
30
  defineCommand
31
31
  } from "./chunk-S3S4TGEH.js";
32
32
  import {
33
33
  resolveExtractCacheDir
34
- } from "./chunk-IUBZ3DSO.js";
34
+ } from "./chunk-MNMD6XLG.js";
35
35
  import {
36
36
  getUpdateMeta,
37
37
  withMeta
38
- } from "./chunk-FRIRP3DN.js";
38
+ } from "./chunk-7VXU7E5S.js";
39
39
  import {
40
40
  CONFIG_PATH,
41
41
  withFileLock
42
42
  } from "./chunk-XUXGIA7H.js";
43
43
  import {
44
44
  VERSION
45
- } from "./chunk-3NXDJSD5.js";
45
+ } from "./chunk-WG4IZWEH.js";
46
46
  import {
47
47
  normalizeErrorMessage
48
48
  } from "./chunk-KNU5COPB.js";