hyperframes 0.8.170 → 0.8.171

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 (105) hide show
  1. package/dist/{add-KDCZCEMQ.js → add-VMMGTSGT.js} +10 -9
  2. package/dist/{asset-6VH3OCEC.js → asset-ZERIT5FT.js} +2 -2
  3. package/dist/{audio-636CQSXK.js → audio-RQUGFWYT.js} +5 -5
  4. package/dist/{auth-AHLKM4M2.js → auth-I3FNB6N2.js} +1 -1
  5. package/dist/{autoUpdate-5UA6TJW7.js → autoUpdate-IBAS4JVK.js} +2 -2
  6. package/dist/{backgroundChecks-DP242536.js → backgroundChecks-7UQBIPQC.js} +3 -3
  7. package/dist/backgroundChecksWorker.js +3 -3
  8. package/dist/{beats-HKY5L463.js → beats-F2GFGFCV.js} +4 -4
  9. package/dist/{benchmark-4YQDVIO5.js → benchmark-XPQYX3OX.js} +5 -5
  10. package/dist/{browser-7ZPWXEYW.js → browser-QCV62F7R.js} +3 -3
  11. package/dist/{capture-572X5NDD.js → capture-OKPMCIAC.js} +1 -1
  12. package/dist/{capture-VXMUZSBI.js → capture-WE32B5UZ.js} +1 -1
  13. package/dist/{catalog-PUUTHPP7.js → catalog-2LWFMJM3.js} +10 -9
  14. package/dist/{catch-up-K6CV44WQ.js → catch-up-OWUGMOBS.js} +4 -4
  15. package/dist/{check-MBDLSWCY.js → check-7BK6UM3M.js} +23 -22
  16. package/dist/{checkBrowser-33UWWDZG.js → checkBrowser-VG745SEX.js} +19 -18
  17. package/dist/{chunk-PP64Q43K.js → chunk-4QIJFIR5.js} +1 -1
  18. package/dist/{chunk-WLNNWLIE.js → chunk-5GQB63WX.js} +6 -6
  19. package/dist/{chunk-FSP2JNAP.js → chunk-5HLJ4JMB.js} +1 -1
  20. package/dist/{chunk-4B6PUT4R.js → chunk-6I24ZSCR.js} +1 -1
  21. package/dist/{chunk-WZQSL7UX.js → chunk-77QCYRQH.js} +2 -2
  22. package/dist/{chunk-MSFON5DJ.js → chunk-7YZSOHSC.js} +2 -2
  23. package/dist/{chunk-EJYBYR4C.js → chunk-A3SQJCPU.js} +1 -1
  24. package/dist/{chunk-CFBGKAKQ.js → chunk-AAYNQ7WL.js} +5 -5
  25. package/dist/{chunk-OGVQJHNM.js → chunk-BMPNGUYD.js} +2 -2
  26. package/dist/{chunk-UQPH3Y45.js → chunk-BYFG74OA.js} +2 -2
  27. package/dist/{chunk-EHDKCMKX.js → chunk-CO6V4KXX.js} +1 -1
  28. package/dist/{chunk-BAW7UNLK.js → chunk-CSABTZ6S.js} +5 -5
  29. package/dist/{chunk-2UD6O6QG.js → chunk-D2QELIQB.js} +68 -18
  30. package/dist/{chunk-PCX3YF2U.js → chunk-EDGJ2OMH.js} +1 -1
  31. package/dist/{chunk-JGYHWVXQ.js → chunk-GMJ3ILLW.js} +34 -13
  32. package/dist/{chunk-GG3V5BHG.js → chunk-GSABLXZV.js} +1 -1
  33. package/dist/{chunk-KUFEPCR3.js → chunk-IWLOARQZ.js} +2 -2
  34. package/dist/chunk-JHOCK3DG.js +27 -0
  35. package/dist/{chunk-44GV6ZMC.js → chunk-JMJTXBVF.js} +22 -12
  36. package/dist/{chunk-YFGJVADL.js → chunk-KQCWIE76.js} +2 -2
  37. package/dist/{chunk-LWB3KZ5E.js → chunk-L32QQH2K.js} +1 -1
  38. package/dist/{chunk-T56MM7RC.js → chunk-PAFCKH3S.js} +2 -2
  39. package/dist/{chunk-G6GKIAEM.js → chunk-RSW6LGGW.js} +2 -2
  40. package/dist/{chunk-2E7NDKTN.js → chunk-RTW6WSC7.js} +3 -2
  41. package/dist/{chunk-AUMJ3QSO.js → chunk-SLTUINB4.js} +1 -1
  42. package/dist/{chunk-UDDJQEGS.js → chunk-TZ3I23TZ.js} +20 -6
  43. package/dist/{chunk-ZINH7YA2.js → chunk-UJQQITCY.js} +1 -1
  44. package/dist/{chunk-QABAVWEX.js → chunk-W47D3KOB.js} +1 -1
  45. package/dist/{chunk-QO3JEPEW.js → chunk-XGFYN53T.js} +1 -1
  46. package/dist/{chunk-MXMIVNUE.js → chunk-ZBUGFQ7Y.js} +32 -2
  47. package/dist/{clean-5AXXHD45.js → clean-FCBNQ3W2.js} +5 -5
  48. package/dist/cli.js +50 -50
  49. package/dist/{cloud-DQCCYKOB.js → cloud-3FZBQBOM.js} +4 -4
  50. package/dist/{compare-6RB5X3SO.js → compare-E4332OOZ.js} +15 -14
  51. package/dist/{component-7RRNNC5F.js → component-VKSV3OKW.js} +3 -3
  52. package/dist/{compositions-CANET3EJ.js → compositions-GOVXHFXC.js} +5 -5
  53. package/dist/{delete-KEZJPDWJ.js → delete-JYZTEBLQ.js} +2 -2
  54. package/dist/{doctor-5RAEGA6G.js → doctor-ND3FZM6S.js} +3 -3
  55. package/dist/{events-4ZJSJ76H.js → events-27JU7QRQ.js} +2 -2
  56. package/dist/{events-SHOWEHI5.js → events-VL2JIO4R.js} +3 -3
  57. package/dist/{feedback-4IIGUUYZ.js → feedback-PKVQWCVT.js} +4 -4
  58. package/dist/{figma-BFDECPE5.js → figma-FZ4T4SE3.js} +3 -3
  59. package/dist/fontLocalizeCli.js +1 -1
  60. package/dist/{get-BO32YZUQ.js → get-HUAIHWXR.js} +2 -2
  61. package/dist/{grade-compare-SW4SAG5R.js → grade-compare-CJ2ROYD6.js} +15 -14
  62. package/dist/{help-7AMSMPUF.js → help-OJ3QDJYS.js} +1 -1
  63. package/dist/{history-VXAQFJJV.js → history-P4LA65T5.js} +7 -7
  64. package/dist/hyperframes-player.global.js +3 -3
  65. package/dist/{info-KN4TX6T5.js → info-QHRJW6Y3.js} +5 -5
  66. package/dist/{init-7A2T7LDW.js → init-AG6YVVJN.js} +11 -10
  67. package/dist/{inspect-CCCV6JFV.js → inspect-TT66DYEC.js} +17 -16
  68. package/dist/{installer-ZCCZUOPN.js → installer-5ZKUQBWW.js} +2 -2
  69. package/dist/{keyframes-K6XNZGK3.js → keyframes-CJJGCW3R.js} +6 -6
  70. package/dist/{lambda-B2K237DX.js → lambda-3BMEOSP7.js} +1 -1
  71. package/dist/{layout-HAPR5OV4.js → layout-BSDCTMJK.js} +17 -16
  72. package/dist/{lint-3COFAXAJ.js → lint-6CL2R2FK.js} +6 -6
  73. package/dist/{list-QCNHO7DR.js → list-5VYOLEFN.js} +2 -2
  74. package/dist/{login-BAFYZS6W.js → login-PNRREAOC.js} +4 -4
  75. package/dist/{media-treatment-C53ZBW2B.js → media-treatment-KHJX73WZ.js} +5 -5
  76. package/dist/{motionShot-UOS26VLB.js → motionShot-VIUXVMTV.js} +3 -3
  77. package/dist/{normalize-audio-I7HGJGA5.js → normalize-audio-T5QMN476.js} +4 -4
  78. package/dist/{open-RFXGV4RY.js → open-T57KLGFX.js} +4 -4
  79. package/dist/{play-DRCWK35L.js → play-TQWHYMAT.js} +13 -12
  80. package/dist/{present-HUJV553D.js → present-U5OFT6IF.js} +8 -8
  81. package/dist/{preview-CZENYIGN.js → preview-WWTDQQSB.js} +14 -10
  82. package/dist/{projectConfig-R3FCIARW.js → projectConfig-OXNA35QN.js} +5 -4
  83. package/dist/{publish-XBW4NVFY.js → publish-WZD4NLWM.js} +5 -4
  84. package/dist/{render-WWAXTKYR.js → render-FTVXKXSQ.js} +14 -13
  85. package/dist/{render-DOHHCT2G.js → render-RZUU76V5.js} +5 -5
  86. package/dist/{render-batch-EK4ZBQHH.js → render-batch-FCR7RX6U.js} +4 -17
  87. package/dist/{resolver-5Y6VNMTC.js → resolver-4SPHOGY7.js} +3 -2
  88. package/dist/{skills-ONFYYL6R.js → skills-7LBLAEH4.js} +5 -5
  89. package/dist/{skillsUpdateCheck-JTHZOHRT.js → skillsUpdateCheck-AHK7CQUP.js} +3 -3
  90. package/dist/{snapshot-SUA62VQ2.js → snapshot-DOS6NQXM.js} +17 -16
  91. package/dist/{staticProjectServer-XQPUABYX.js → staticProjectServer-2YNWMUSU.js} +9 -8
  92. package/dist/studio/assets/{hyperframes-player-Dsmhm7Q8.js → hyperframes-player-DohJxMIU.js} +2 -2
  93. package/dist/studio/assets/{index-CV00F8qG.js → index-BOkm4Ooc.js} +101 -101
  94. package/dist/studio/assets/{index-DT1wigvW.js → index-DfwtrPPt.js} +1 -1
  95. package/dist/studio/index.html +1 -1
  96. package/dist/{studio-api-MBDDFEA2.js → studio-api-NEBM56HH.js} +2 -2
  97. package/dist/{studioServer-7HWDCLKT.js → studioServer-LYDRHW7D.js} +23 -17
  98. package/dist/{telemetry-763NW3QF.js → telemetry-FAYON6XS.js} +3 -3
  99. package/dist/{timeline-ZLFPNI27.js → timeline-UKJ53XLC.js} +7 -7
  100. package/dist/{tokens-RXJLVZKD.js → tokens-SO3ZXEFM.js} +2 -2
  101. package/dist/{transcribe-UDISJXCZ.js → transcribe-PS5XSTXN.js} +3 -3
  102. package/dist/{updateCheck-V2RXHFQL.js → updateCheck-ZV422M72.js} +2 -2
  103. package/dist/{upgrade-MJI3EW3W.js → upgrade-GHG5FWZJ.js} +2 -2
  104. package/dist/{validate-IM5NPJHI.js → validate-K4ZGXH2M.js} +10 -10
  105. package/package.json +1 -1
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-K2FLNJVB.js";
10
10
  import {
11
11
  trackCommandFailure
12
- } from "./chunk-4B6PUT4R.js";
12
+ } from "./chunk-6I24ZSCR.js";
13
13
  import {
14
14
  failCommand
15
15
  } from "./chunk-PBN6GBJE.js";
@@ -9,17 +9,17 @@ import {
9
9
  resolveCliChromeGpuMode,
10
10
  seekCompositionTimeline,
11
11
  waitForRuntimeReady
12
- } from "./chunk-2UD6O6QG.js";
12
+ } from "./chunk-D2QELIQB.js";
13
13
  import {
14
14
  launchManagedBrowser,
15
15
  resolveManagedGpuMode
16
- } from "./chunk-UDDJQEGS.js";
16
+ } from "./chunk-TZ3I23TZ.js";
17
17
  import {
18
18
  resolveCompositionViewportFromHtml
19
19
  } from "./chunk-FH7WODJH.js";
20
20
  import {
21
21
  resolveProject
22
- } from "./chunk-EJYBYR4C.js";
22
+ } from "./chunk-A3SQJCPU.js";
23
23
  import {
24
24
  defineCommand
25
25
  } from "./chunk-S3S4TGEH.js";
@@ -33,7 +33,7 @@ import {
33
33
  import {
34
34
  printDeprecationNotice,
35
35
  withMeta
36
- } from "./chunk-GG3V5BHG.js";
36
+ } from "./chunk-GSABLXZV.js";
37
37
  import {
38
38
  decodeWellFormedEscapes
39
39
  } from "./chunk-BSQ7XANM.js";
@@ -251,7 +251,7 @@ async function validateInBrowser(project, opts) {
251
251
  const projectDir = project.dir;
252
252
  const { bundleToSingleHtml } = await import("./compiler-GU5GPO5A.js");
253
253
  const { ensureBrowser } = await import("./manager-HEUPD2YB.js");
254
- const { serveStaticProjectHtml } = await import("./staticProjectServer-XQPUABYX.js");
254
+ const { serveStaticProjectHtml } = await import("./staticProjectServer-2YNWMUSU.js");
255
255
  const { lintProject } = await import("./lintProject-PXB5Y6TX.js");
256
256
  const lintResult = await lintProject(projectDir);
257
257
  const compositionErrors = extractCompositionErrorsFromLint(lintResult);
@@ -7,10 +7,10 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  trackLintReport,
9
9
  trackLintRuleStreak
10
- } from "./chunk-4B6PUT4R.js";
10
+ } from "./chunk-6I24ZSCR.js";
11
11
  import {
12
12
  shouldTrack
13
- } from "./chunk-FSP2JNAP.js";
13
+ } from "./chunk-5HLJ4JMB.js";
14
14
  import {
15
15
  LINT_RULE_COUNT,
16
16
  LINT_RULE_GROUP_COUNTS
@@ -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.170" : "0.0.0-dev";
10
- var PRODUCER_VERSION = true ? "0.8.170" : "0.0.0-dev";
9
+ var VERSION = true ? "0.8.171" : "0.0.0-dev";
10
+ var PRODUCER_VERSION = true ? "0.8.171" : "0.0.0-dev";
11
11
 
12
12
  export {
13
13
  VERSION,
@@ -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-GG3V5BHG.js";
9
+ } from "./chunk-GSABLXZV.js";
10
10
  import {
11
11
  hostAnswers
12
12
  } from "./chunk-K4WIOZFP.js";
@@ -10,21 +10,21 @@ import {
10
10
  seekCompositionTimeline,
11
11
  waitForCompositionFonts,
12
12
  waitForRuntimeReady
13
- } from "./chunk-2UD6O6QG.js";
13
+ } from "./chunk-D2QELIQB.js";
14
14
  import {
15
15
  gotoWhenSent,
16
16
  launchManagedBrowser,
17
17
  resolveManagedGpuMode
18
- } from "./chunk-UDDJQEGS.js";
18
+ } from "./chunk-TZ3I23TZ.js";
19
19
  import {
20
20
  resolveDiagnosticNavigationTimeoutMs
21
21
  } from "./chunk-LMMFO5UV.js";
22
22
  import {
23
23
  resolveProject
24
- } from "./chunk-EJYBYR4C.js";
24
+ } from "./chunk-A3SQJCPU.js";
25
25
  import {
26
26
  serveStaticProjectHtml
27
- } from "./chunk-MSFON5DJ.js";
27
+ } from "./chunk-7YZSOHSC.js";
28
28
  import {
29
29
  defineCommand
30
30
  } from "./chunk-S3S4TGEH.js";
@@ -38,7 +38,7 @@ import {
38
38
  import {
39
39
  printDeprecationNotice,
40
40
  withMeta
41
- } from "./chunk-GG3V5BHG.js";
41
+ } from "./chunk-GSABLXZV.js";
42
42
  import {
43
43
  normalizeErrorMessage
44
44
  } from "./chunk-KNU5COPB.js";
@@ -9,7 +9,7 @@ import {
9
9
  launchManagedBrowser,
10
10
  resolveManagedGpuMode,
11
11
  rethrowAfterBrowserCleanup
12
- } from "./chunk-UDDJQEGS.js";
12
+ } from "./chunk-TZ3I23TZ.js";
13
13
  import {
14
14
  resolveCompositionViewportFromHtml
15
15
  } from "./chunk-FH7WODJH.js";
@@ -52,7 +52,8 @@ var DENSE_GEOMETRY_SEEK_OPTIONS = {
52
52
  animationFrameSettle: "none",
53
53
  waitForFontsMs: 0,
54
54
  settleMs: 0,
55
- waitForVideoFrames: false
55
+ waitForVideoFrames: false,
56
+ skipWebglDraws: true
56
57
  };
57
58
  function resolveCliChromeGpuMode(envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
58
59
  return resolveLocalBrowserGpuMode(void 0, envMode);
@@ -115,7 +116,7 @@ async function openSettledCompositionPage(html, url, options) {
115
116
  const puppeteer = await import("puppeteer-core");
116
117
  const { buildChromeArgs } = await import("./src-VFTQPSQD.js");
117
118
  const requestedGpuMode = options.browserGpuMode ?? resolveCliChromeGpuMode();
118
- const answer = (await import("./staticProjectServer-XQPUABYX.js")).inProcessAnswer(url);
119
+ const answer = (await import("./staticProjectServer-2YNWMUSU.js")).inProcessAnswer(url);
119
120
  const requiresWebGpu = compositionRequiresWebGpu(html);
120
121
  let softwareWebGpu = false;
121
122
  const launch = async (executablePath) => {
@@ -193,7 +194,7 @@ async function seekCompositionTimeline(page, timeSeconds, options = {}) {
193
194
  await page.evaluate(
194
195
  // Serialized into the page; the seek-target cascade must stay one function.
195
196
  // fallow-ignore-next-line complexity
196
- (t, fallbackToBridgeAndTimelines, exactTime) => {
197
+ (t, fallbackToBridgeAndTimelines, exactTime, skipDraws) => {
197
198
  const getProperty = (target, key) => {
198
199
  if ((typeof target !== "object" || target === null) && typeof target !== "function") {
199
200
  return void 0;
@@ -212,26 +213,75 @@ async function seekCompositionTimeline(page, timeSeconds, options = {}) {
212
213
  const playerSeek = getProperty(player, "seek");
213
214
  const hf = Reflect.get(window, "__hf");
214
215
  const bridgeSeek = getProperty(hf, "seek");
215
- if (call(renderSeek, player, exactTime ? [safe, { exact: true }] : [safe])) {
216
- } else if (fallbackToBridgeAndTimelines && call(bridgeSeek, hf, [safe])) {
217
- } else if (call(playerSeek, player, [safe])) {
218
- } else if (fallbackToBridgeAndTimelines) {
219
- const timelines = Reflect.get(window, "__timelines");
220
- if (typeof timelines === "object" && timelines !== null) {
221
- for (const key of Object.keys(timelines)) {
222
- const timeline = Reflect.get(timelines, key);
223
- call(getProperty(timeline, "pause"), timeline, []);
224
- call(getProperty(timeline, "seek"), timeline, [safe]);
216
+ const gsap = Reflect.get(window, "gsap");
217
+ const ticker = getProperty(gsap, "ticker");
218
+ const seekTo = (time) => {
219
+ if (call(renderSeek, player, exactTime ? [time, { exact: true }] : [time])) {
220
+ } else if (fallbackToBridgeAndTimelines && call(bridgeSeek, hf, [time])) {
221
+ } else if (call(playerSeek, player, [time])) {
222
+ } else if (fallbackToBridgeAndTimelines) {
223
+ const timelines = Reflect.get(window, "__timelines");
224
+ if (typeof timelines === "object" && timelines !== null) {
225
+ for (const key of Object.keys(timelines)) {
226
+ const timeline = Reflect.get(timelines, key);
227
+ call(getProperty(timeline, "pause"), timeline, []);
228
+ call(getProperty(timeline, "seek"), timeline, [time]);
229
+ }
230
+ }
231
+ }
232
+ call(getProperty(ticker, "tick"), ticker, []);
233
+ };
234
+ const gateSlot = /* @__PURE__ */ Symbol.for("hyperframes.webglDrawGate");
235
+ let gate = Reflect.get(window, gateSlot);
236
+ if (skipDraws && !gate) {
237
+ const installed = { skip: false, skipped: false };
238
+ for (const name of ["WebGLRenderingContext", "WebGL2RenderingContext"]) {
239
+ const proto = getProperty(Reflect.get(window, name), "prototype");
240
+ if (!proto) continue;
241
+ for (const method of [
242
+ "clear",
243
+ "drawArrays",
244
+ "drawElements",
245
+ "drawArraysInstanced",
246
+ "drawElementsInstanced",
247
+ "drawRangeElements",
248
+ "blitFramebuffer"
249
+ ]) {
250
+ const draw = getProperty(proto, method);
251
+ if (typeof draw !== "function") continue;
252
+ Reflect.set(proto, method, function(...args) {
253
+ if (!installed.skip) return Reflect.apply(draw, this, args);
254
+ installed.skipped = true;
255
+ return void 0;
256
+ });
225
257
  }
226
258
  }
259
+ Reflect.set(window, gateSlot, installed);
260
+ gate = installed;
227
261
  }
228
- const gsap = Reflect.get(window, "gsap");
229
- const ticker = getProperty(gsap, "ticker");
230
- call(getProperty(ticker, "tick"), ticker, []);
262
+ const seekWithoutDraws = (time) => {
263
+ if (!gate) return seekTo(time);
264
+ gate.skip = true;
265
+ try {
266
+ seekTo(time);
267
+ } finally {
268
+ gate.skip = false;
269
+ }
270
+ };
271
+ if (skipDraws) {
272
+ seekWithoutDraws(safe);
273
+ return;
274
+ }
275
+ if (gate?.skipped) {
276
+ seekWithoutDraws(safe >= 1e-3 ? safe - 1e-3 : safe + 1e-3);
277
+ gate.skipped = false;
278
+ }
279
+ seekTo(safe);
231
280
  },
232
281
  timeSeconds,
233
282
  options.fallbackToBridgeAndTimelines === true,
234
- options.exactTime === true
283
+ options.exactTime === true,
284
+ options.skipWebglDraws === true
235
285
  );
236
286
  await page.evaluate(
237
287
  async (barrier) => {
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-HVW7ABXD.js";
13
13
  import {
14
14
  DEFAULT_REGISTRY_URL
15
- } from "./chunk-2E7NDKTN.js";
15
+ } from "./chunk-RTW6WSC7.js";
16
16
 
17
17
  // src/utils/projectConfig.ts
18
18
  import { readFileSync, writeFileSync } from "fs";
@@ -18,7 +18,7 @@ import {
18
18
  mkdirWithinProject
19
19
  } from "./chunk-OFQWTKPW.js";
20
20
 
21
- // ../studio-server/dist/chunk-SZF3L5MT.js
21
+ // ../studio-server/dist/chunk-GG4AS4RK.js
22
22
  import { randomUUID as randomUUID7 } from "crypto";
23
23
  import { mkdir as mkdir2, readdir as readdir3, rm as rm3, rmdir, writeFile } from "fs/promises";
24
24
  import {
@@ -37,7 +37,7 @@ import { createHash, randomUUID } from "crypto";
37
37
  import { readFileSync as readFileSync2 } from "fs";
38
38
  import { isAbsolute, relative, resolve, sep } from "path";
39
39
  import { randomUUID as randomUUID2 } from "crypto";
40
- import { linkSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
40
+ import { linkSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
41
41
  import { join } from "path";
42
42
  import { createHash as createHash2 } from "crypto";
43
43
  import { lstatSync, readFileSync as readFileSync3, readdirSync } from "fs";
@@ -61,14 +61,14 @@ var PREVIEW_IGNORED_DIRS = /* @__PURE__ */ new Set([
61
61
  "renders"
62
62
  ]);
63
63
 
64
- // ../studio-server/dist/chunk-SZF3L5MT.js
64
+ // ../studio-server/dist/chunk-GG4AS4RK.js
65
65
  import { createHash as createHash3, randomUUID as randomUUID3 } from "crypto";
66
- import { constants, createReadStream, createWriteStream, renameSync } from "fs";
66
+ import { constants, createReadStream, createWriteStream, renameSync as renameSync2 } from "fs";
67
67
  import { copyFile, mkdir, readdir, readFile, rename, rm, stat } from "fs/promises";
68
68
  import { dirname, join as join2 } from "path";
69
69
  import { pipeline } from "stream/promises";
70
70
  import { randomUUID as randomUUID5 } from "crypto";
71
- import { readdirSync as readdirSync2, readFileSync as readFileSync5, renameSync as renameSync2, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
71
+ import { readdirSync as readdirSync2, readFileSync as readFileSync5, renameSync as renameSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
72
72
  import { lstat, readdir as readdir2, rm as rm2 } from "fs/promises";
73
73
  import { tmpdir } from "os";
74
74
  import { dirname as dirname2, join as join4 } from "path";
@@ -76,7 +76,7 @@ import { randomUUID as randomUUID4 } from "crypto";
76
76
  import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync4, statSync, writeFileSync as writeFileSync2 } from "fs";
77
77
  import { basename, join as join3, resolve as resolve3 } from "path";
78
78
  import { createHash as createHash5, randomUUID as randomUUID6 } from "crypto";
79
- import { createReadStream as createReadStream2, existsSync as existsSync2, readFileSync as readFileSync8, renameSync as renameSync3, statSync as statSync3 } from "fs";
79
+ import { createReadStream as createReadStream2, existsSync as existsSync2, readFileSync as readFileSync8, renameSync as renameSync4, statSync as statSync3 } from "fs";
80
80
  import { isAbsolute as isAbsolute4, join as join7, resolve as resolve6 } from "path";
81
81
  import { createHash as createHash4 } from "crypto";
82
82
  import {
@@ -182,12 +182,14 @@ function newestReceipt(absPath, expectedVersion) {
182
182
  }
183
183
  var consumeFileWriteReceipt = identifyFileWrite;
184
184
  var HistoryBusyError = class extends Error {
185
- constructor(pid) {
185
+ constructor(pid, url) {
186
186
  super(`This project's history is open in another process (pid ${pid}).`);
187
187
  this.pid = pid;
188
+ this.url = url;
188
189
  this.name = "HistoryBusyError";
189
190
  }
190
191
  pid;
192
+ url;
191
193
  };
192
194
  function alive(pid) {
193
195
  if (!Number.isInteger(pid) || pid <= 0) return false;
@@ -238,14 +240,32 @@ function evictDeadOwner(file) {
238
240
  releaseOwn(evictor);
239
241
  }
240
242
  }
241
- async function takeHistoryOwnership(home, waitMs) {
243
+ function advertise(urlFile, url) {
244
+ if (!url) return rmSync(urlFile, { force: true });
245
+ const draft = `${urlFile}-${process.pid}-${randomUUID2()}.tmp`;
246
+ writeFileSync(draft, JSON.stringify({ pid: process.pid, url }));
247
+ renameSync(draft, urlFile);
248
+ }
249
+ function servedBy(file, urlFile, pid) {
250
+ try {
251
+ const said = JSON.parse(readFileSync(urlFile, "utf-8"));
252
+ const live = said.pid === pid && alive(pid) && ownerOf(file) === pid;
253
+ return live && typeof said.url === "string" ? said.url : void 0;
254
+ } catch {
255
+ return void 0;
256
+ }
257
+ }
258
+ async function takeHistoryOwnership(home, waitMs, url) {
242
259
  const file = join(home, "owner.pid");
260
+ const urlFile = join(home, "owner-url.json");
243
261
  const deadline = Date.now() + waitMs;
244
262
  mkdirSync(home, { recursive: true });
245
263
  for (; ; ) {
246
264
  if (claim(file)) {
265
+ advertise(urlFile, url);
247
266
  let held = true;
248
267
  return () => {
268
+ if (held && servedBy(file, urlFile, process.pid)) rmSync(urlFile, { force: true });
249
269
  if (held) releaseOwn(file);
250
270
  held = false;
251
271
  };
@@ -253,7 +273,7 @@ async function takeHistoryOwnership(home, waitMs) {
253
273
  const pid = ownerOf(file);
254
274
  if (pid === null) continue;
255
275
  if (!alive(pid) && evictDeadOwner(file)) continue;
256
- if (Date.now() >= deadline) throw new HistoryBusyError(pid);
276
+ if (Date.now() >= deadline) throw new HistoryBusyError(pid, servedBy(file, urlFile, pid));
257
277
  await new Promise((settle) => setTimeout(settle, 50));
258
278
  }
259
279
  }
@@ -496,7 +516,7 @@ async function cloneOrCopy(from, to, beforeReplace) {
496
516
  try {
497
517
  await copyFile(from, temp, constants.COPYFILE_FICLONE);
498
518
  beforeReplace?.();
499
- renameSync(temp, to);
519
+ renameSync2(temp, to);
500
520
  } catch (error) {
501
521
  await rm(temp, { force: true });
502
522
  throw error;
@@ -697,7 +717,7 @@ function recheckAndMoveAway(historyRoot, id, { now, dryRun, tempDir }) {
697
717
  if (projectDir === null) return null;
698
718
  if (dryRun) return { projectDir, trash: null };
699
719
  const trash = join4(historyRoot, `${PRUNED_PREFIX}${id}-${randomUUID5()}`);
700
- renameSync2(home, trash);
720
+ renameSync3(home, trash);
701
721
  return { projectDir, trash };
702
722
  }
703
723
  function abandonedProject(home, id, now, tempDir) {
@@ -1119,7 +1139,7 @@ async function updateState(dir, update) {
1119
1139
  state = readState(dir);
1120
1140
  } catch (error) {
1121
1141
  if (!(error instanceof SyntaxError)) throw error;
1122
- renameSync3(statePath(dir), `${statePath(dir)}.invalid-${randomUUID6()}`);
1142
+ renameSync4(statePath(dir), `${statePath(dir)}.invalid-${randomUUID6()}`);
1123
1143
  state = emptyState();
1124
1144
  }
1125
1145
  update(state);
@@ -2401,7 +2421,8 @@ async function openProjectHistory(options) {
2401
2421
  const projectId = projectHistoryId(options.projectDir, options.historyRoot);
2402
2422
  const release = await takeHistoryOwnership(
2403
2423
  join8(options.historyRoot, projectId),
2404
- options.ownerWaitMs ?? 5e3
2424
+ options.ownerWaitMs ?? 5e3,
2425
+ options.ownerUrl
2405
2426
  );
2406
2427
  try {
2407
2428
  const blobs = await openBlobStore(join8(options.historyRoot, projectId, "blobs"));
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-ISN5GRYI.js";
18
18
  import {
19
19
  VERSION
20
- } from "./chunk-UQPH3Y45.js";
20
+ } from "./chunk-BYFG74OA.js";
21
21
 
22
22
  // src/utils/updateCheck.ts
23
23
  import { existsSync, readFileSync } from "fs";
@@ -6,14 +6,14 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  resolveProject
9
- } from "./chunk-EJYBYR4C.js";
9
+ } from "./chunk-A3SQJCPU.js";
10
10
  import {
11
11
  DEFAULT_HISTORY_ROOT,
12
12
  HistoryBusyError,
13
13
  MAX_WINDOW_IDLE_MS,
14
14
  openProjectHistory,
15
15
  readProjectHistory
16
- } from "./chunk-JGYHWVXQ.js";
16
+ } from "./chunk-GMJ3ILLW.js";
17
17
  import {
18
18
  findPreviewServerForProject,
19
19
  studioApiUrl
@@ -0,0 +1,27 @@
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/concurrency.ts
9
+ async function runWithConcurrencyLimit(inputs, limit, worker) {
10
+ if (limit < 1) throw new Error(`runWithConcurrencyLimit: limit must be \u2265 1, got ${limit}`);
11
+ const results = new Array(inputs.length);
12
+ let cursor = 0;
13
+ const workerCount = Math.min(limit, inputs.length);
14
+ await Promise.all(
15
+ Array.from({ length: workerCount }, async () => {
16
+ while (cursor < inputs.length) {
17
+ const idx = cursor++;
18
+ results[idx] = await worker(inputs[idx], idx);
19
+ }
20
+ })
21
+ );
22
+ return results;
23
+ }
24
+
25
+ export {
26
+ runWithConcurrencyLimit
27
+ };
@@ -4,11 +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
+ runWithConcurrencyLimit
9
+ } from "./chunk-JHOCK3DG.js";
7
10
  import {
8
11
  DEFAULT_REGISTRY_URL,
9
12
  fetchItemManifest,
10
13
  fetchRegistryManifest
11
- } from "./chunk-2E7NDKTN.js";
14
+ } from "./chunk-RTW6WSC7.js";
12
15
 
13
16
  // src/registry/resolver.ts
14
17
  function defaultWarn(message) {
@@ -22,22 +25,29 @@ async function listRegistryItems(filter, options = {}) {
22
25
  if (!filter?.type) return manifest.items;
23
26
  return manifest.items.filter((item) => item.type === filter.type);
24
27
  }
28
+ var ITEM_FETCH_CONCURRENCY = 32;
25
29
  async function loadAllItems(entries, options = {}) {
26
30
  const baseUrl = options.baseUrl ?? DEFAULT_REGISTRY_URL;
27
31
  const warn = options.onWarn ?? defaultWarn;
28
- const results = await Promise.allSettled(
29
- entries.map((e) => fetchItemManifest(e.name, e.type, baseUrl))
30
- );
31
- const items = [];
32
- results.forEach((r, i) => {
33
- if (r.status === "fulfilled") {
34
- items.push(r.value);
35
- } else {
36
- const name = entries[i]?.name ?? "<unknown>";
37
- warn(`skipped item "${name}": ${String(r.reason)}`);
32
+ const skipped = [];
33
+ let firstReason = "";
34
+ let timedOut = false;
35
+ const loaded = await runWithConcurrencyLimit(entries, ITEM_FETCH_CONCURRENCY, async (e) => {
36
+ try {
37
+ return await fetchItemManifest(e.name, e.type, baseUrl, { cacheOnly: timedOut });
38
+ } catch (err) {
39
+ if (err instanceof Error && err.name === "TimeoutError") timedOut = true;
40
+ skipped.push(`"${e.name}"`);
41
+ firstReason ||= String(err);
42
+ return void 0;
38
43
  }
39
44
  });
40
- return items;
45
+ if (skipped.length === 1) warn(`skipped item ${skipped[0]}: ${firstReason}`);
46
+ else if (skipped.length > 1)
47
+ warn(
48
+ `skipped ${skipped.length} items (${skipped.slice(0, 3).join(", ")}${skipped.length > 3 ? ", ..." : ""}): ${firstReason}`
49
+ );
50
+ return loaded.filter((item) => item !== void 0);
41
51
  }
42
52
  async function resolveItem(name, options = {}) {
43
53
  const items = await resolveItemWithDependencies(name, options);
@@ -6,10 +6,10 @@ var __filename = __hf_fileURLToPath(import.meta.url);
6
6
  var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  withOwner
9
- } from "./chunk-KUFEPCR3.js";
9
+ } from "./chunk-IWLOARQZ.js";
10
10
  import {
11
11
  beginArtifactCapture
12
- } from "./chunk-JGYHWVXQ.js";
12
+ } from "./chunk-GMJ3ILLW.js";
13
13
 
14
14
  // src/utils/artifactCapture.ts
15
15
  var SKIP_BUSY_HISTORY = { ownerWaitMs: 0 };
@@ -1278,7 +1278,7 @@ async function withFigmaErrors(command, fn) {
1278
1278
  } catch (err) {
1279
1279
  if (err instanceof Error) {
1280
1280
  try {
1281
- const { trackCommandFailure } = await import("./events-SHOWEHI5.js");
1281
+ const { trackCommandFailure } = await import("./events-VL2JIO4R.js");
1282
1282
  trackCommandFailure(
1283
1283
  command,
1284
1284
  err,
@@ -7,10 +7,10 @@ var __dirname = __hf_dirname(__filename);
7
7
  import {
8
8
  parseFeedbackRating,
9
9
  trackRenderFeedback
10
- } from "./chunk-4B6PUT4R.js";
10
+ } from "./chunk-6I24ZSCR.js";
11
11
  import {
12
12
  shouldTrack
13
- } from "./chunk-FSP2JNAP.js";
13
+ } from "./chunk-5HLJ4JMB.js";
14
14
  import {
15
15
  detectAgentRuntime
16
16
  } from "./chunk-QWQ6GQTI.js";
@@ -32,14 +32,14 @@ import {
32
32
  import {
33
33
  getUpdateMeta,
34
34
  withMeta
35
- } from "./chunk-GG3V5BHG.js";
35
+ } from "./chunk-GSABLXZV.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-UQPH3Y45.js";
42
+ } from "./chunk-BYFG74OA.js";
43
43
  import {
44
44
  OPTIONAL_PACKAGES,
45
45
  installedOptionalPackageVersion
@@ -2866,7 +2866,7 @@ async function fetchRegistryManifest(baseUrl = DEFAULT_REGISTRY_URL, options) {
2866
2866
  return cached?.data;
2867
2867
  }
2868
2868
  }
2869
- async function fetchItemManifest(name, type, baseUrl = DEFAULT_REGISTRY_URL) {
2869
+ async function fetchItemManifest(name, type, baseUrl = DEFAULT_REGISTRY_URL, options) {
2870
2870
  if (!validRegistryName(name) || !Object.hasOwn(ITEM_TYPE_DIRS, type))
2871
2871
  throw new Error("Invalid registry item name or type");
2872
2872
  const dir = ITEM_TYPE_DIRS[type];
@@ -2874,7 +2874,8 @@ async function fetchItemManifest(name, type, baseUrl = DEFAULT_REGISTRY_URL) {
2874
2874
  const url = registryPathUrl(baseUrl, dir, name, "registry-item.json");
2875
2875
  const cacheFile = cachePath(baseUrl, `${dir}__${name}`);
2876
2876
  const cached = readCacheEntry(cacheFile, validate);
2877
- if (cached && isFresh(cached)) return cached.data;
2877
+ if (cached && (isFresh(cached) || options?.cacheOnly)) return cached.data;
2878
+ if (options?.cacheOnly) throw new Error("not fetched after an earlier registry timeout");
2878
2879
  try {
2879
2880
  const item = await fetchJson(url, validate);
2880
2881
  writeCache(cacheFile, item);
@@ -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-MXMIVNUE.js";
9
+ } from "./chunk-ZBUGFQ7Y.js";
10
10
  import {
11
11
  injectTagsAtHeadStart
12
12
  } from "./chunk-6M3IPJS6.js";
@@ -36,6 +36,7 @@ var closing = /* @__PURE__ */ new WeakMap();
36
36
  var pending = /* @__PURE__ */ new Map();
37
37
  var sessionCleanups = /* @__PURE__ */ new Set();
38
38
  var CLOSE_GRACE_MS = 1e3;
39
+ var LAUNCH_TIMEOUT_MS = 3e4;
39
40
  var EXIT_POLL_MS = 50;
40
41
  var listening = false;
41
42
  var shutdown;
@@ -58,6 +59,7 @@ function ownSignals() {
58
59
  }
59
60
  async function resolveManagedGpuMode(requestedMode, chromePath, context = {}) {
60
61
  ownSignals();
62
+ if (requestedMode === "auto" && inAgentSandbox()) return "software";
61
63
  return resolveCaptureBrowserGpuMode(requestedMode, chromePath, {
62
64
  launch: async (puppeteer, options) => {
63
65
  context.signal?.throwIfAborted();
@@ -99,12 +101,15 @@ async function launchOwnedBrowser(puppeteer, options) {
99
101
  ownSignals();
100
102
  const abort = new AbortController();
101
103
  const signal = options.signal ? AbortSignal.any([options.signal, abort.signal]) : abort.signal;
102
- const launch = puppeteer.launch({
103
- ...options,
104
- signal,
105
- handleSIGINT: false,
106
- handleSIGTERM: false
107
- });
104
+ const launch = untilLaunchOrAbort(
105
+ puppeteer.launch({ ...options, signal, handleSIGINT: false, handleSIGTERM: false }),
106
+ signal
107
+ );
108
+ const limit = options.timeout ?? LAUNCH_TIMEOUT_MS;
109
+ const timer = limit > 0 ? setTimeout(
110
+ () => abort.abort(new Error(`The browser did not finish starting within ${limit} ms.`)),
111
+ limit
112
+ ) : void 0;
108
113
  pending.set(launch, abort);
109
114
  try {
110
115
  const browser = await launch;
@@ -114,9 +119,18 @@ async function launchOwnedBrowser(puppeteer, options) {
114
119
  child.once("exit", () => browsers.delete(browser));
115
120
  return browser;
116
121
  } finally {
122
+ clearTimeout(timer);
117
123
  pending.delete(launch);
118
124
  }
119
125
  }
126
+ function untilLaunchOrAbort(launch, signal) {
127
+ const aborted = new Promise((_, reject) => {
128
+ if (signal.aborted) reject(signal.reason);
129
+ signal.addEventListener("abort", () => reject(signal.reason), { once: true });
130
+ });
131
+ void launch.then((late) => signal.aborted ? closeManagedBrowser(late) : void 0).catch(() => void 0);
132
+ return Promise.race([launch, aborted]);
133
+ }
120
134
  async function closeManagedBrowsers() {
121
135
  for (const abort of pending.values()) abort.abort();
122
136
  await Promise.allSettled(pending.keys());