hyperframes 0.8.160 → 0.8.162

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 (103) hide show
  1. package/dist/{add-OGBTJCU4.js → add-UW7GCPQF.js} +5 -5
  2. package/dist/{asset-DKQFFGPP.js → asset-TWBPYQOL.js} +2 -2
  3. package/dist/audio-DJIE4YLH.js +1153 -0
  4. package/dist/{auth-AQMRAFXN.js → auth-VTCEZYBT.js} +1 -1
  5. package/dist/{autoUpdate-NFQB7V2X.js → autoUpdate-JA3SV472.js} +2 -2
  6. package/dist/{backgroundChecks-7JKE2FIU.js → backgroundChecks-J3WJDPQJ.js} +3 -3
  7. package/dist/backgroundChecksWorker.js +3 -3
  8. package/dist/beats-QVJVXZV5.js +239 -0
  9. package/dist/{benchmark-RRU67WEY.js → benchmark-WNBAKOXS.js} +5 -5
  10. package/dist/{browser-K4TP4ZM2.js → browser-VJOTRIXL.js} +3 -3
  11. package/dist/{capture-T2TBROMS.js → capture-GUO23PVN.js} +1 -1
  12. package/dist/{catalog-IMIHQ4KX.js → catalog-SAC4GFIN.js} +5 -5
  13. package/dist/{catch-up-UY5MJWOG.js → catch-up-T5RIRFJF.js} +4 -4
  14. package/dist/{check-6NAJSJHQ.js → check-IRETF27J.js} +18 -18
  15. package/dist/{checkBrowser-JWNQFYTY.js → checkBrowser-5IXR4QCK.js} +14 -14
  16. package/dist/{chunk-VZ6LCTOZ.js → chunk-3LQEZ4EI.js} +1 -1
  17. package/dist/{chunk-TU2CQJO3.js → chunk-3NSVHCOH.js} +2 -2
  18. package/dist/{chunk-D2WGLWIK.js → chunk-5K34RPE5.js} +2 -2
  19. package/dist/{chunk-IYLHJV34.js → chunk-5UBZPG74.js} +1 -143
  20. package/dist/{chunk-VD7WQYTO.js → chunk-5YSHR4XC.js} +5 -5
  21. package/dist/{chunk-D46G5IQH.js → chunk-AAUK5GDI.js} +7 -7
  22. package/dist/{chunk-GOASXWDD.js → chunk-FF5TAEPT.js} +1 -1
  23. package/dist/chunk-FFJ5TDRD.js +1181 -0
  24. package/dist/{chunk-PINFPWRV.js → chunk-GIPNECWL.js} +12 -10
  25. package/dist/{chunk-KWRBEDJI.js → chunk-GNFWKGSQ.js} +2 -2
  26. package/dist/{chunk-4VYNMVMC.js → chunk-GS5EXZBV.js} +4 -4
  27. package/dist/chunk-J4L5TPLS.js +101 -0
  28. package/dist/{chunk-V2FQQILJ.js → chunk-JJYFRAI4.js} +1 -1
  29. package/dist/{chunk-IGTGLGML.js → chunk-KAKBRDU4.js} +2 -2
  30. package/dist/{chunk-TTFDAWCS.js → chunk-KIJO75L4.js} +1 -1
  31. package/dist/{chunk-3XPVZLAR.js → chunk-NQR5SBXX.js} +1 -1
  32. package/dist/{chunk-6MCASYIS.js → chunk-ON2HYNGB.js} +4 -4
  33. package/dist/{chunk-GOTCGKX6.js → chunk-RGYEL7QD.js} +1 -1
  34. package/dist/{chunk-7OFNPEKR.js → chunk-S6OLD4SL.js} +2 -2
  35. package/dist/{chunk-FRGYHRP6.js → chunk-T5BG7PYZ.js} +1 -1
  36. package/dist/{chunk-MYGXKD7A.js → chunk-T65MIV36.js} +2 -2
  37. package/dist/chunk-TDPVEMBS.js +156 -0
  38. package/dist/{chunk-SHVDJON6.js → chunk-XWWYGXJ5.js} +1 -1
  39. package/dist/{chunk-37LNY2EC.js → chunk-YJKUE3LV.js} +1 -1
  40. package/dist/{chunk-KRE55WLI.js → chunk-YLBV2PXM.js} +1 -1
  41. package/dist/{chunk-ICZVCVD3.js → chunk-ZEWX3GHP.js} +1 -1
  42. package/dist/{clean-RRE6PMKZ.js → clean-WB62QULT.js} +6 -6
  43. package/dist/cli.js +49 -49
  44. package/dist/{cloud-OIR6K7TS.js → cloud-E5WB4DWZ.js} +4 -4
  45. package/dist/{compare-E57W737I.js → compare-GHFVHZ5A.js} +11 -11
  46. package/dist/{component-I2O4AX56.js → component-ZGCC3MHX.js} +3 -3
  47. package/dist/{compositions-B6NKZHIN.js → compositions-THPEDDIX.js} +5 -5
  48. package/dist/{delete-DTUNBC6K.js → delete-6FWT7DZX.js} +4 -3
  49. package/dist/{doctor-SCNB73Z3.js → doctor-RDGDOUC4.js} +3 -3
  50. package/dist/{events-6LQNRKHZ.js → events-CU6FDXHC.js} +3 -3
  51. package/dist/{events-Q37UJL36.js → events-VHXICDA2.js} +2 -2
  52. package/dist/{feedback-FOEBE2OW.js → feedback-PUPN6EKP.js} +5 -5
  53. package/dist/{figma-54MRTBKH.js → figma-ZKWBF7QH.js} +3 -3
  54. package/dist/fontLocalizeCli.js +1 -1
  55. package/dist/{get-EPGHM2SA.js → get-JHIBQRPM.js} +4 -3
  56. package/dist/{grade-compare-LOJWX6SK.js → grade-compare-GPLUXDPW.js} +11 -11
  57. package/dist/{help-6FPZI3WP.js → help-GO6RGM37.js} +1 -1
  58. package/dist/{history-GRXSUA5R.js → history-RUTC4SH5.js} +6 -6
  59. package/dist/hyperframes-player.global.js +1 -1
  60. package/dist/{info-LV7DFCLD.js → info-773VXW37.js} +5 -5
  61. package/dist/{init-3J7BSAC3.js → init-YXSIRYZI.js} +6 -6
  62. package/dist/{inspect-5RON554C.js → inspect-L4RRJEAA.js} +13 -13
  63. package/dist/{keyframes-KHXTHI5C.js → keyframes-P5IOQ6AM.js} +6 -6
  64. package/dist/{layout-DVWWT2TR.js → layout-OH2VTN5E.js} +13 -13
  65. package/dist/{lint-Q5WFB5ST.js → lint-YEEPVE6Q.js} +6 -6
  66. package/dist/{list-RFEUTW6N.js → list-QURRZTVN.js} +4 -3
  67. package/dist/{login-WBHWA4M2.js → login-DFT4L5YY.js} +4 -4
  68. package/dist/{media-treatment-WRHVNWLS.js → media-treatment-ERQ2PBIN.js} +6 -6
  69. package/dist/{motionShot-BZLRN3SS.js → motionShot-C2YDYRNB.js} +5 -5
  70. package/dist/{normalize-audio-4YXE3RIF.js → normalize-audio-R23VODOA.js} +4 -4
  71. package/dist/{open-MCGYEFML.js → open-GEOB4L3S.js} +4 -4
  72. package/dist/{play-WXOV3BD7.js → play-BYUS37GA.js} +9 -9
  73. package/dist/{present-RVG4J6CJ.js → present-BZLRNHDY.js} +9 -9
  74. package/dist/{preview-PDUQR2JQ.js → preview-TXML6PQ7.js} +5 -5
  75. package/dist/publish-VX5OH4ST.js +1 -1
  76. package/dist/{render-5BGU3FXU.js → render-57SXH6NS.js} +7 -7
  77. package/dist/{render-JNJVFBFF.js → render-JTY7XQFQ.js} +11 -86
  78. package/dist/skills/hyperframes-cli/references/beats.md +2 -6
  79. package/dist/{skills-LKJA27ZN.js → skills-2LBVMKVY.js} +5 -5
  80. package/dist/{skillsUpdateCheck-RFZJKZC4.js → skillsUpdateCheck-5DRXL565.js} +3 -3
  81. package/dist/{snapshot-EOYA4MLG.js → snapshot-V2L77FCF.js} +13 -13
  82. package/dist/{staticProjectServer-S3NK3V4S.js → staticProjectServer-4CQ3KDQK.js} +5 -5
  83. package/dist/studio/assets/{hyperframes-player-CXL23NEv.js → hyperframes-player-CAclPB6q.js} +1 -1
  84. package/dist/studio/assets/{index-D7BvLHtZ.js → index-B82aOvgB.js} +118 -118
  85. package/dist/studio/assets/{index-CejKvBNw.js → index-DCwGKghK.js} +1 -1
  86. package/dist/studio/index.html +1 -1
  87. package/dist/{studio-api-YM5HLXUS.js → studio-api-RYCDLEOR.js} +3 -3
  88. package/dist/{studioServer-CEXJK5TC.js → studioServer-B7H7EQ4U.js} +9 -9
  89. package/dist/{telemetry-7AWYECPL.js → telemetry-WVHWY3DU.js} +3 -3
  90. package/dist/{timeline-G7H373XX.js → timeline-EDXJ5L45.js} +8 -8
  91. package/dist/{tokens-GYH7NXXA.js → tokens-UNJONAXT.js} +2 -2
  92. package/dist/{transcribe-CIC7WAT5.js → transcribe-VX7ZE2IZ.js} +3 -3
  93. package/dist/{updateCheck-MQ44KGUR.js → updateCheck-NLH5E44Q.js} +2 -2
  94. package/dist/{upgrade-OL47SID3.js → upgrade-RGQJA2B4.js} +2 -2
  95. package/dist/{validate-TDCH6X3C.js → validate-4AN4PDV7.js} +11 -11
  96. package/package.json +2 -3
  97. package/dist/audio-GK4OVVTH.js +0 -2086
  98. package/dist/beat-analyzer.global.js +0 -341
  99. package/dist/beats-C3ZSK2R2.js +0 -322
  100. package/dist/lib-TPG2ZMAX.js +0 -128
  101. package/dist/studio/assets/index-Bl_xrA5T.js +0 -1
  102. /package/dist/{capture-ZPRK3TOZ.js → capture-M5ZAD3BI.js} +0 -0
  103. /package/dist/{lambda-4KCSMIM6.js → lambda-RAJA6ZNA.js} +0 -0
@@ -138,7 +138,7 @@ function replacementTimelineAssetId(document, element, newSrc) {
138
138
  return buildTimelineAssetId(decodedUrlPath(newSrc), ids);
139
139
  }
140
140
 
141
- // ../studio-server/dist/chunk-JBFOY5SI.js
141
+ // ../studio-server/dist/chunk-WUNFUTHB.js
142
142
  var import_postcss_selector_parser = __toESM(require_dist(), 1);
143
143
  import postcss from "postcss";
144
144
  function parseStyleDecls(style) {
@@ -189,16 +189,16 @@ function patchStyleAttrString(style, property, value) {
189
189
  }
190
190
  return serializeStyleDecls(props, order);
191
191
  }
192
+ var pinnedInSource = /* @__PURE__ */ new WeakMap();
192
193
  function parseSourceDocument(raw) {
193
194
  const source = ensureHfIds(raw);
194
195
  const hasDocumentShell = /<!doctype|<html[\s>]/i.test(source);
195
- if (hasDocumentShell) {
196
- return { document: parseHTML(source).document, wrappedFragment: false };
197
- }
198
- return {
199
- document: parseHTML(`<!DOCTYPE html><html><head></head><body>${source}</body></html>`).document,
200
- wrappedFragment: true
201
- };
196
+ const document = hasDocumentShell ? parseHTML(source).document : parseHTML(`<!DOCTYPE html><html><head></head><body>${source}</body></html>`).document;
197
+ pinnedInSource.set(
198
+ document,
199
+ new Set(Array.from(raw.matchAll(/\bdata-hf-id\s*=\s*["']?([^"'\s>]+)/gi), (m) => m[1]))
200
+ );
201
+ return { document, wrappedFragment: !hasDocumentShell };
202
202
  }
203
203
  function duplicateCssRulesForId(document, originalId, newId) {
204
204
  const idToken = `#${originalId}`;
@@ -263,14 +263,16 @@ function findTargetElement(document, target) {
263
263
  const el = findByHfId(document, target.hfId);
264
264
  if (el) return el;
265
265
  }
266
+ const pinned = pinnedInSource.get(document);
267
+ const unlessPinnedElsewhere = (el) => el && !(target.hfId && pinned?.has(el.getAttribute("data-hf-id") ?? "")) ? el : null;
266
268
  if (target.id) {
267
- const byId = document.getElementById(target.id);
269
+ const byId = unlessPinnedElsewhere(document.getElementById(target.id));
268
270
  if (byId) return byId;
269
271
  }
270
272
  if (!target.selector) return null;
271
273
  try {
272
274
  const matches = querySelectorAllWithTemplates(document, target.selector);
273
- return matches[target.selectorIndex ?? 0] ?? null;
275
+ return unlessPinnedElsewhere(matches[target.selectorIndex ?? 0]);
274
276
  } catch {
275
277
  return null;
276
278
  }
@@ -7,10 +7,10 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  trackLintReport,
9
9
  trackLintRuleStreak
10
- } from "./chunk-KRE55WLI.js";
10
+ } from "./chunk-YLBV2PXM.js";
11
11
  import {
12
12
  shouldTrack
13
- } from "./chunk-ICZVCVD3.js";
13
+ } from "./chunk-ZEWX3GHP.js";
14
14
  import {
15
15
  LINT_RULE_COUNT,
16
16
  LINT_RULE_GROUP_COUNTS
@@ -10,7 +10,7 @@ import {
10
10
  seekCompositionTimeline,
11
11
  waitForCompositionFonts,
12
12
  waitForRuntimeReady
13
- } from "./chunk-6MCASYIS.js";
13
+ } from "./chunk-ON2HYNGB.js";
14
14
  import {
15
15
  launchManagedBrowser,
16
16
  resolveManagedGpuMode
@@ -20,10 +20,10 @@ import {
20
20
  } from "./chunk-ERTJPFCH.js";
21
21
  import {
22
22
  resolveProject
23
- } from "./chunk-37LNY2EC.js";
23
+ } from "./chunk-YJKUE3LV.js";
24
24
  import {
25
25
  serveStaticProjectHtml
26
- } from "./chunk-GOTCGKX6.js";
26
+ } from "./chunk-RGYEL7QD.js";
27
27
  import {
28
28
  defineCommand
29
29
  } from "./chunk-S3S4TGEH.js";
@@ -37,7 +37,7 @@ import {
37
37
  import {
38
38
  printDeprecationNotice,
39
39
  withMeta
40
- } from "./chunk-FRGYHRP6.js";
40
+ } from "./chunk-T5BG7PYZ.js";
41
41
  import {
42
42
  normalizeErrorMessage
43
43
  } from "./chunk-KNU5COPB.js";
@@ -0,0 +1,101 @@
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
+ HyperframesApiError
9
+ } from "./chunk-5UBZPG74.js";
10
+
11
+ // src/cloud/upload.ts
12
+ import { createHash } from "crypto";
13
+ var COMPLETE_MAX_RETRIES = 5;
14
+ var COMPLETE_RETRY_BASE_MS = 500;
15
+ var CONTENT_TYPE_ZIP = "application/zip";
16
+ function sha256Hex(bytes) {
17
+ return createHash("sha256").update(bytes).digest("hex");
18
+ }
19
+ function sleep(ms) {
20
+ return new Promise((r) => setTimeout(r, ms));
21
+ }
22
+ function normalizeUploadHeaders(raw) {
23
+ const out = {};
24
+ for (const [k, v] of Object.entries(raw ?? {})) {
25
+ if (typeof v === "string") out[k] = v;
26
+ else if (typeof v === "number" || typeof v === "boolean") out[k] = String(v);
27
+ }
28
+ return out;
29
+ }
30
+ async function putBytesToPresignedUrl(fetchImpl, uploadUrl, uploadHeaders, bytes, contentType) {
31
+ const headers = {
32
+ "content-type": contentType,
33
+ ...normalizeUploadHeaders(uploadHeaders)
34
+ };
35
+ const res = await fetchImpl(uploadUrl, {
36
+ method: "PUT",
37
+ headers,
38
+ body: bytes
39
+ });
40
+ if (!res.ok) {
41
+ const detail = await res.text().catch(() => "");
42
+ throw new Error(
43
+ `Direct upload PUT failed: ${res.status} ${res.statusText}${detail ? ` \u2014 ${detail.slice(0, 300)}` : ""}`
44
+ );
45
+ }
46
+ }
47
+ async function completeWithRetry(client, asset_id, checksum_sha256) {
48
+ let lastErr;
49
+ for (let attempt = 0; attempt < COMPLETE_MAX_RETRIES; attempt++) {
50
+ try {
51
+ return await client.completeAssetUpload({
52
+ asset_id,
53
+ body: { checksum_sha256 }
54
+ });
55
+ } catch (err) {
56
+ const retryable = err instanceof HyperframesApiError && err.status === 409;
57
+ if (!retryable || attempt === COMPLETE_MAX_RETRIES - 1) {
58
+ throw err;
59
+ }
60
+ lastErr = err;
61
+ await sleep(COMPLETE_RETRY_BASE_MS * (attempt + 1));
62
+ }
63
+ }
64
+ throw lastErr ?? new Error("completeAssetUpload retries exhausted");
65
+ }
66
+ async function uploadAssetViaDirectUpload(opts) {
67
+ const start = Date.now();
68
+ const { bytes, filename, idempotencyKey } = opts;
69
+ const size_bytes = bytes.byteLength;
70
+ const checksum_sha256 = sha256Hex(bytes);
71
+ const fetchImpl = opts.fetchImpl ?? fetch;
72
+ opts.onProgress?.({ phase: "initialize" });
73
+ const initialize = await opts.client.createAssetUpload({
74
+ body: { filename, content_type: opts.contentType, size_bytes, checksum_sha256 },
75
+ idempotencyKey
76
+ });
77
+ opts.onProgress?.({ phase: "upload", percent: 0 });
78
+ await putBytesToPresignedUrl(
79
+ fetchImpl,
80
+ initialize.upload_url,
81
+ initialize.upload_headers,
82
+ bytes,
83
+ opts.contentType
84
+ );
85
+ opts.onProgress?.({ phase: "upload", percent: 100 });
86
+ opts.onProgress?.({ phase: "complete" });
87
+ const completed = await completeWithRetry(opts.client, initialize.asset_id, checksum_sha256);
88
+ return {
89
+ asset_id: completed.asset_id,
90
+ size_bytes,
91
+ duration_ms: Date.now() - start
92
+ };
93
+ }
94
+ function uploadZipViaDirectUpload(opts) {
95
+ return uploadAssetViaDirectUpload({ ...opts, contentType: CONTENT_TYPE_ZIP });
96
+ }
97
+
98
+ export {
99
+ uploadAssetViaDirectUpload,
100
+ uploadZipViaDirectUpload
101
+ };
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveProject
9
- } from "./chunk-37LNY2EC.js";
9
+ } from "./chunk-YJKUE3LV.js";
10
10
  import {
11
11
  findPreviewServerForProject,
12
12
  studioApiUrl
@@ -20,7 +20,7 @@ import {
20
20
  typeDirPath,
21
21
  updateRecord,
22
22
  withFigmaErrors
23
- } from "./chunk-VZ6LCTOZ.js";
23
+ } from "./chunk-3LQEZ4EI.js";
24
24
  import {
25
25
  defineCommand
26
26
  } from "./chunk-S3S4TGEH.js";
@@ -229,7 +229,7 @@ var asset_default = defineCommand({
229
229
  rendered > 0 ? `(${results.length} nodes, ${rendered} rendered in 1 figma request)` : `(${results.length} nodes, all reused from cache \u2014 no figma request)`
230
230
  );
231
231
  }
232
- const { trackFigmaImport } = await import("./telemetry-7AWYECPL.js");
232
+ const { trackFigmaImport } = await import("./telemetry-WVHWY3DU.js");
233
233
  trackFigmaImport({
234
234
  phase: "asset",
235
235
  reused: results.every((r) => r.reused),
@@ -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-FRGYHRP6.js";
9
+ } from "./chunk-T5BG7PYZ.js";
10
10
  import {
11
11
  hostAnswers
12
12
  } from "./chunk-K4WIOZFP.js";
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-TU2CQJO3.js";
9
+ } from "./chunk-3NSVHCOH.js";
10
10
 
11
11
  // src/registry/compatibility.ts
12
12
  import { compareVersions } from "compare-versions";
@@ -4,14 +4,14 @@ 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
- resolveCompositionViewportFromHtml
9
- } from "./chunk-FH7WODJH.js";
10
7
  import {
11
8
  launchManagedBrowser,
12
9
  resolveManagedGpuMode,
13
10
  rethrowAfterBrowserCleanup
14
11
  } from "./chunk-B5FZ2CQM.js";
12
+ import {
13
+ resolveCompositionViewportFromHtml
14
+ } from "./chunk-FH7WODJH.js";
15
15
  import {
16
16
  resolveDiagnosticNavigationTimeoutMs,
17
17
  windowsChromeCrashRemediation
@@ -110,7 +110,7 @@ async function openSettledCompositionPage(html, url, options) {
110
110
  const puppeteer = await import("puppeteer-core");
111
111
  const { buildChromeArgs } = await import("./src-GPUDUKY6.js");
112
112
  const requestedGpuMode = options.browserGpuMode ?? resolveCliChromeGpuMode();
113
- const answer = (await import("./staticProjectServer-S3NK3V4S.js")).inProcessAnswer(url);
113
+ const answer = (await import("./staticProjectServer-4CQ3KDQK.js")).inProcessAnswer(url);
114
114
  const requiresWebGpu = compositionRequiresWebGpu(html);
115
115
  let softwareWebGpu = false;
116
116
  const launch = async (executablePath) => {
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  getMimeType,
9
9
  injectMediaCodecMapIntoHtml
10
- } from "./chunk-VD7WQYTO.js";
10
+ } from "./chunk-5YSHR4XC.js";
11
11
  import {
12
12
  PROXY_VARIANT_CONFIG,
13
13
  ProxyCapacityError,
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  RegistryCompatibilityError,
9
9
  gateRegistryItemsCompatibility
10
- } from "./chunk-3XPVZLAR.js";
10
+ } from "./chunk-NQR5SBXX.js";
11
11
  import {
12
12
  DEFAULT_PROJECT_CONFIG,
13
13
  createProjectConfig,
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-EVRUR7DW.js";
30
30
  import {
31
31
  trackRegistryItemAdded
32
- } from "./chunk-KRE55WLI.js";
32
+ } from "./chunk-YLBV2PXM.js";
33
33
  import {
34
34
  defineCommand
35
35
  } from "./chunk-S3S4TGEH.js";
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-ISN5GRYI.js";
18
18
  import {
19
19
  VERSION
20
- } from "./chunk-TU2CQJO3.js";
20
+ } from "./chunk-3NSVHCOH.js";
21
21
 
22
22
  // src/utils/updateCheck.ts
23
23
  import { existsSync, readFileSync } from "fs";
@@ -32,14 +32,14 @@ import {
32
32
  import {
33
33
  getUpdateMeta,
34
34
  withMeta
35
- } from "./chunk-FRGYHRP6.js";
35
+ } from "./chunk-T5BG7PYZ.js";
36
36
  import {
37
37
  CONFIG_PATH,
38
38
  withFileLock
39
39
  } from "./chunk-XUXGIA7H.js";
40
40
  import {
41
41
  VERSION
42
- } from "./chunk-TU2CQJO3.js";
42
+ } from "./chunk-3NSVHCOH.js";
43
43
  import {
44
44
  OPTIONAL_PACKAGES,
45
45
  installedOptionalPackageVersion
@@ -0,0 +1,156 @@
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
+ HyperframesApiError,
9
+ HyperframesCloudClient
10
+ } from "./chunk-5UBZPG74.js";
11
+ import {
12
+ forceRefreshCredentials,
13
+ resolveCloudAuthHeaders,
14
+ resolveCloudBaseUrl
15
+ } from "./chunk-KMAAOHLO.js";
16
+ import {
17
+ errorBox
18
+ } from "./chunk-K2FLNJVB.js";
19
+ import {
20
+ failCommand
21
+ } from "./chunk-PBN6GBJE.js";
22
+
23
+ // src/cloud/poll.ts
24
+ var DEFAULT_POLL_INTERVAL_MS = 1e4;
25
+ var DEFAULT_MAX_WAIT_MS = 60 * 60 * 1e3;
26
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed"]);
27
+ var PollTimeoutError = class extends Error {
28
+ lastDetail;
29
+ constructor(lastDetail, elapsedMs) {
30
+ super(
31
+ `Render ${lastDetail.render_id} did not reach a terminal state within ${Math.round(elapsedMs / 1e3)}s`
32
+ );
33
+ this.name = "PollTimeoutError";
34
+ this.lastDetail = lastDetail;
35
+ }
36
+ };
37
+ function isTerminal(status) {
38
+ return TERMINAL_STATUSES.has(status);
39
+ }
40
+ async function pollUntilTerminal(client, renderId, options = {}) {
41
+ const intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
42
+ const maxWaitMs = options.maxWaitMs ?? DEFAULT_MAX_WAIT_MS;
43
+ const now = options.now ?? (() => Date.now());
44
+ const sleep = options.sleep ?? defaultAbortableSleep(options.signal);
45
+ const started = now();
46
+ while (true) {
47
+ if (options.signal?.aborted) {
48
+ throw signalAbortError(options.signal);
49
+ }
50
+ const detail = await client.getRender({ render_id: renderId, signal: options.signal });
51
+ const elapsed = now() - started;
52
+ options.onTick?.(detail, elapsed);
53
+ if (isTerminal(detail.status)) {
54
+ return detail;
55
+ }
56
+ if (elapsed >= maxWaitMs) {
57
+ throw new PollTimeoutError(detail, elapsed);
58
+ }
59
+ await sleep(intervalMs);
60
+ }
61
+ }
62
+ function signalAbortError(signal) {
63
+ const reason = signal.reason;
64
+ return reason instanceof Error ? reason : new Error("Poll aborted");
65
+ }
66
+ function defaultAbortableSleep(signal) {
67
+ return (ms) => new Promise((resolve, reject) => {
68
+ const onAbort = () => {
69
+ clearTimeout(timer);
70
+ reject(signalAbortError(signal));
71
+ };
72
+ const timer = setTimeout(() => {
73
+ signal?.removeEventListener("abort", onAbort);
74
+ resolve();
75
+ }, ms);
76
+ signal?.addEventListener("abort", onAbort, { once: true });
77
+ });
78
+ }
79
+
80
+ // src/cloud/index.ts
81
+ async function createCloudClient() {
82
+ const client = new HyperframesCloudClient({
83
+ baseUrl: resolveCloudBaseUrl(),
84
+ getAuthHeaders: resolveCloudAuthHeaders
85
+ });
86
+ return wrapWith401Retry(client);
87
+ }
88
+ function wrapWith401Retry(client) {
89
+ return new Proxy(client, {
90
+ get(target, prop, receiver) {
91
+ const value = Reflect.get(target, prop, receiver);
92
+ if (typeof value !== "function") return value;
93
+ const original = value.bind(target);
94
+ return async (...args) => {
95
+ try {
96
+ return await original(...args);
97
+ } catch (err) {
98
+ if (err instanceof HyperframesApiError && err.status === 401) {
99
+ try {
100
+ await forceRefreshCredentials();
101
+ } catch {
102
+ throw err;
103
+ }
104
+ return await original(...args);
105
+ }
106
+ throw err;
107
+ }
108
+ };
109
+ }
110
+ });
111
+ }
112
+
113
+ // src/cloud/errors.ts
114
+ var ERROR_CODE_HINTS = {
115
+ hyperframes_project_too_large: "The zip exceeded the 200 MB limit. Run `hyperframes cloud render --dry-run`, then add only verified-unneeded paths to `.hyperframesignore` or pre-host required large media.",
116
+ hyperframes_render_not_found: "The render_id no longer exists \u2014 either soft-deleted or never created.",
117
+ invalid_parameter: "Check the listed parameter against `hyperframes cloud render --help` for the accepted values.",
118
+ authentication_failed: "Run `hyperframes auth status` to confirm your credential; `hyperframes auth login` to re-auth.",
119
+ rate_limit_exceeded: "Retry after the duration in the Retry-After header."
120
+ };
121
+ function reportApiError(stage, err, options = {}) {
122
+ const hints = { ...ERROR_CODE_HINTS, ...options.extraHints };
123
+ if (err instanceof HyperframesApiError) {
124
+ if (err.status === 404 && options.notFound) {
125
+ errorBox("Not found", options.notFound);
126
+ failCommand();
127
+ }
128
+ const hint = err.code ? hints[err.code] : void 0;
129
+ const title = `${stage} (HTTP ${err.status})`;
130
+ if (hint) {
131
+ errorBox(title, err.message, hint);
132
+ } else if (options.suggestion) {
133
+ errorBox(title, err.message, options.suggestion);
134
+ } else if (err.code) {
135
+ errorBox(title, err.message, `code: ${err.code}`);
136
+ } else {
137
+ errorBox(title, err.message);
138
+ }
139
+ failCommand();
140
+ }
141
+ if (err instanceof Error) {
142
+ errorBox(stage, err.message, options.suggestion);
143
+ failCommand();
144
+ }
145
+ errorBox(stage, String(err), options.suggestion);
146
+ failCommand();
147
+ }
148
+
149
+ export {
150
+ DEFAULT_POLL_INTERVAL_MS,
151
+ DEFAULT_MAX_WAIT_MS,
152
+ PollTimeoutError,
153
+ pollUntilTerminal,
154
+ createCloudClient,
155
+ reportApiError
156
+ };
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  getMimeType
9
- } from "./chunk-VD7WQYTO.js";
9
+ } from "./chunk-5YSHR4XC.js";
10
10
  import {
11
11
  injectTagsAtHeadStart
12
12
  } from "./chunk-P47XYVEQ.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-K2FLNJVB.js";
10
10
  import {
11
11
  trackCommandFailure
12
- } from "./chunk-KRE55WLI.js";
12
+ } from "./chunk-YLBV2PXM.js";
13
13
  import {
14
14
  failCommand
15
15
  } from "./chunk-PBN6GBJE.js";
@@ -8,7 +8,7 @@ import {
8
8
  flush,
9
9
  shouldTrack,
10
10
  trackEvent
11
- } from "./chunk-ICZVCVD3.js";
11
+ } from "./chunk-ZEWX3GHP.js";
12
12
  import {
13
13
  getPowerState
14
14
  } from "./chunk-QWQ6GQTI.js";
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-XUXGIA7H.js";
30
30
  import {
31
31
  VERSION
32
- } from "./chunk-TU2CQJO3.js";
32
+ } from "./chunk-3NSVHCOH.js";
33
33
  import {
34
34
  CANARIES,
35
35
  canaryEnvVar,
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  redactHome
9
- } from "./chunk-MYGXKD7A.js";
9
+ } from "./chunk-T65MIV36.js";
10
10
  import "./chunk-Z27A7NUB.js";
11
11
  import "./chunk-5ETJX6WM.js";
12
12
  import {
@@ -16,10 +16,10 @@ import {
16
16
  formatBytes
17
17
  } from "./chunk-K2FLNJVB.js";
18
18
  import "./chunk-A2DMF2Q6.js";
19
- import "./chunk-VD7WQYTO.js";
20
- import "./chunk-PINFPWRV.js";
21
- import "./chunk-C6TPGUWD.js";
19
+ import "./chunk-5YSHR4XC.js";
20
+ import "./chunk-GIPNECWL.js";
22
21
  import "./chunk-6JR2XUEE.js";
22
+ import "./chunk-C6TPGUWD.js";
23
23
  import {
24
24
  CACHE_DIR_NAME,
25
25
  cleanupProxyCache
@@ -47,12 +47,12 @@ import "./chunk-TJSTGSAW.js";
47
47
  import "./chunk-XRKMITSS.js";
48
48
  import {
49
49
  withMeta
50
- } from "./chunk-FRGYHRP6.js";
50
+ } from "./chunk-T5BG7PYZ.js";
51
51
  import "./chunk-K4WIOZFP.js";
52
52
  import "./chunk-XUXGIA7H.js";
53
53
  import "./chunk-WERLJGIC.js";
54
54
  import "./chunk-ISN5GRYI.js";
55
- import "./chunk-TU2CQJO3.js";
55
+ import "./chunk-3NSVHCOH.js";
56
56
  import "./chunk-3DKN5WKL.js";
57
57
  import "./chunk-EOVYQ3IG.js";
58
58
  import "./chunk-6BEFEWFB.js";