@hyperframes/producer 0.9.11 → 0.9.13

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.
@@ -1124,27 +1124,25 @@ var materializeFileSystem = {
1124
1124
  rmSync
1125
1125
  };
1126
1126
  var warnedSymlinkFallback = false;
1127
+ var copyCannotFix = (error) => ["ENOSPC", "EDQUOT", "EEXIST", "ENOENT"].includes(
1128
+ error?.code ?? ""
1129
+ );
1127
1130
  function tryWindowsFrameJunction(fileSystem, src, dest) {
1128
1131
  if (process.platform !== "win32") return false;
1129
1132
  try {
1130
1133
  fileSystem.symlinkSync(src, dest, "junction");
1131
1134
  return true;
1132
1135
  } catch (error) {
1133
- const code = error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
1134
- if (["EPERM", "EACCES", "UNKNOWN", "EINVAL", "ENOSYS", "EOPNOTSUPP", "ENOTSUP"].includes(
1135
- code ?? ""
1136
- )) {
1137
- return false;
1138
- }
1139
- throw error;
1136
+ if (copyCannotFix(error)) throw error;
1137
+ return false;
1140
1138
  }
1141
1139
  }
1142
1140
  function linkOrCopyFrameDir(fileSystem, src, dest) {
1143
1141
  try {
1144
1142
  fileSystem.symlinkSync(src, dest, "dir");
1145
1143
  } catch (err) {
1144
+ if (copyCannotFix(err)) throw err;
1146
1145
  const code = err?.code;
1147
- if (code !== "EPERM" && code !== "EACCES" && code !== "UNKNOWN") throw err;
1148
1146
  if (tryWindowsFrameJunction(fileSystem, src, dest)) return;
1149
1147
  if (!warnedSymlinkFallback) {
1150
1148
  warnedSymlinkFallback = true;
@@ -1463,31 +1461,6 @@ function resolveCaptureStallTimeoutMs() {
1463
1461
  return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_CAPTURE_STALL_MS;
1464
1462
  }
1465
1463
 
1466
- // src/services/render/segmentManifest.ts
1467
- import { renameWithRetry as renameWithRetry2 } from "@hyperframes/engine";
1468
-
1469
- // src/services/render/hdrMode.ts
1470
- import {
1471
- analyzeCompositionHdr,
1472
- formatHdrAutoPromotionWarning,
1473
- gradingKeepsSdr,
1474
- HDR_AUTO_PROMOTION_PIPELINE,
1475
- isHdrColorSpace,
1476
- sanitizeHdrAutoPromotionAsset
1477
- } from "@hyperframes/engine";
1478
- function formatCarriesHdr(format) {
1479
- return format === "mp4";
1480
- }
1481
- function rendersSdrOnly(config, media) {
1482
- return config.hdrMode === "force-sdr" || gradingKeepsSdr(config.hdrMode, media) || !formatCarriesHdr(config.format ?? "mp4");
1483
- }
1484
-
1485
- // src/services/render/captureBeyondViewport.ts
1486
- function resolveVideoCaptureBeyondViewport(videoCount) {
1487
- if (videoCount <= 0) return void 0;
1488
- return true;
1489
- }
1490
-
1491
1464
  // src/services/render/captureCost.ts
1492
1465
  import { fpsToNumber as fpsToNumber4 } from "@hyperframes/core";
1493
1466
  import {
@@ -1574,6 +1547,31 @@ async function measureCaptureCostFromSession(session, totalFrames, fps, log) {
1574
1547
  };
1575
1548
  }
1576
1549
 
1550
+ // src/services/render/segmentManifest.ts
1551
+ import { renameWithRetry as renameWithRetry2 } from "@hyperframes/engine";
1552
+
1553
+ // src/services/render/hdrMode.ts
1554
+ import {
1555
+ analyzeCompositionHdr,
1556
+ formatHdrAutoPromotionWarning,
1557
+ gradingKeepsSdr,
1558
+ HDR_AUTO_PROMOTION_PIPELINE,
1559
+ isHdrColorSpace,
1560
+ sanitizeHdrAutoPromotionAsset
1561
+ } from "@hyperframes/engine";
1562
+ function formatCarriesHdr(format) {
1563
+ return format === "mp4";
1564
+ }
1565
+ function rendersSdrOnly(config, media) {
1566
+ return config.hdrMode === "force-sdr" || gradingKeepsSdr(config.hdrMode, media) || !formatCarriesHdr(config.format ?? "mp4");
1567
+ }
1568
+
1569
+ // src/services/render/captureBeyondViewport.ts
1570
+ function resolveVideoCaptureBeyondViewport(videoCount) {
1571
+ if (videoCount <= 0) return void 0;
1572
+ return true;
1573
+ }
1574
+
1577
1575
  // src/services/render/observability.ts
1578
1576
  import { redactTelemetryString } from "@hyperframes/core";
1579
1577
  import { CaptureFailure as CaptureFailure2 } from "@hyperframes/engine";
@@ -5585,17 +5583,24 @@ var VideoExtractionStageError = class extends Error {
5585
5583
  publicMetadata;
5586
5584
  };
5587
5585
  function assertVideoExtractionSucceeded(result) {
5588
- throwIfEncoderInterrupted(result);
5586
+ throwIfHostFailure(result);
5589
5587
  const error = buildVideoExtractionStageError(result);
5590
5588
  if (error) throw error;
5591
5589
  }
5592
- function throwIfEncoderInterrupted(result) {
5590
+ function throwIfHostFailure(result) {
5593
5591
  const interrupted = result.errors.find((failure) => failure.kind === "external_interruption");
5594
- if (!interrupted) return;
5595
- throw encoderFailureError("Video frame extraction failed", {
5596
- error: String(interrupted.error),
5597
- failureReason: "external_interruption"
5598
- });
5592
+ if (interrupted) {
5593
+ throw encoderFailureError("Video frame extraction failed", {
5594
+ error: String(interrupted.error),
5595
+ failureReason: "external_interruption"
5596
+ });
5597
+ }
5598
+ const full = result.errors.filter((failure) => failure.kind === "disk_full").length;
5599
+ if (full === 0) return;
5600
+ throw Object.assign(
5601
+ new Error(`ENOSPC: no space left on device, extracting the frames of ${full} video source(s)`),
5602
+ { code: "ENOSPC" }
5603
+ );
5599
5604
  }
5600
5605
  function buildVideoExtractionStageError(result) {
5601
5606
  if (result.success && result.errors.length === 0) return null;
@@ -5810,7 +5815,7 @@ async function runExtractVideosStage(input) {
5810
5815
  );
5811
5816
  extractionResult.phaseBreakdown.transientRetries = (extractionResult.phaseBreakdown.transientRetries ?? 0) + hdrProbeTransientRetries;
5812
5817
  assertNotAborted();
5813
- throwIfEncoderInterrupted(extractionResult);
5818
+ throwIfHostFailure(extractionResult);
5814
5819
  failureToEnforce = applyVideoExtractionFailurePolicy(extractionResult, extractionPolicy, log);
5815
5820
  materializeExtractedFramesForCompiledDir(extractionResult.extracted, compiledDir, {
5816
5821
  materializeSymlinks
@@ -7651,6 +7656,22 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
7651
7656
  }
7652
7657
  const remainingCount = countFrameRanges(remaining);
7653
7658
  const madeProgress = captureAttemptMadeProgress(frameCount, remainingCount);
7659
+ if (options.allowRetry && !madeProgress && (currentWorkers > 1 || initializationRetriesUsed === 0 && failure.kind === "protocol_timeout") && /\bNetwork\.enable timed out|Navigation timeout of \d+ ms exceeded/i.test(failure.message)) {
7660
+ initializationRetriesUsed++;
7661
+ const nextWorkers2 = getNextRetryWorkerCount(currentWorkers);
7662
+ options.log.warn(
7663
+ "[Render] Browser initialization timed out; retrying with fewer workers.",
7664
+ {
7665
+ fromWorkers: currentWorkers,
7666
+ toWorkers: nextWorkers2,
7667
+ error: failure.message
7668
+ }
7669
+ );
7670
+ currentWorkers = nextWorkers2;
7671
+ missingRanges = remaining;
7672
+ attempt++;
7673
+ continue;
7674
+ }
7654
7675
  if (options.allowRetry && isTransientCaptureRetryEligible(failure.kind, remaining, transientRetriesUsed)) {
7655
7676
  transientRetriesUsed++;
7656
7677
  options.log.warn(
@@ -7668,22 +7689,6 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
7668
7689
  pendingTransientRetry = true;
7669
7690
  continue;
7670
7691
  }
7671
- if (options.allowRetry && !madeProgress && initializationRetriesUsed === 0 && failure.kind === "protocol_timeout" && /\bNetwork\.enable timed out/i.test(failure.message)) {
7672
- initializationRetriesUsed++;
7673
- const nextWorkers2 = getNextRetryWorkerCount(currentWorkers);
7674
- options.log.warn(
7675
- "[Render] Browser initialization timed out; retrying once with fresh sessions.",
7676
- {
7677
- fromWorkers: currentWorkers,
7678
- toWorkers: nextWorkers2,
7679
- error: failure.message
7680
- }
7681
- );
7682
- currentWorkers = nextWorkers2;
7683
- missingRanges = remaining;
7684
- attempt++;
7685
- continue;
7686
- }
7687
7692
  if (!madeProgress) {
7688
7693
  options.log.warn(
7689
7694
  "[Render] Capture attempt made no forward progress; composition is likely structurally broken, not retrying.",