@hyperframes/producer 0.9.53 → 0.9.54

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.
package/dist/index.js CHANGED
@@ -67,7 +67,7 @@ import {
67
67
  referenceBackgroundResult,
68
68
  createReferenceBackgroundRecorder
69
69
  } from "@hyperframes/engine";
70
- import { join as join32, dirname as dirname13, resolve as resolve8 } from "path";
70
+ import { join as join32, dirname as dirname14, resolve as resolve8 } from "path";
71
71
  import { totalmem as totalmem2 } from "node:os";
72
72
  import { randomUUID } from "crypto";
73
73
  import { fileURLToPath as fileURLToPath4 } from "url";
@@ -75,7 +75,7 @@ import { fileURLToPath as fileURLToPath4 } from "url";
75
75
  // src/services/fileServer.ts
76
76
  import { Hono } from "hono";
77
77
  import { serve } from "@hono/node-server";
78
- import { settleOnBrowserSafePort } from "@hyperframes/engine";
78
+ import { answerOwnLoopbackHostOnly, settleOnBrowserSafePort } from "@hyperframes/engine";
79
79
  import {
80
80
  existsSync as existsSync2,
81
81
  realpathSync,
@@ -92,7 +92,7 @@ import { Readable } from "node:stream";
92
92
  import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
93
93
  import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
94
94
  import { fpsToNumber } from "@hyperframes/core";
95
- import { isPrivateFileUnder, isVcsOrSecretPath } from "@hyperframes/core/safe-path";
95
+ import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
96
96
  import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
97
97
  import { openRangeEnd } from "@hyperframes/studio-server/media-range";
98
98
 
@@ -859,10 +859,12 @@ function createFileServer(options) {
859
859
  const bodyScripts = options.bodyScripts ?? [buildRenderModeScript(options.fps), HF_BRIDGE_SCRIPT];
860
860
  const app = new Hono();
861
861
  const warnLeftOut = (line) => console.warn(`[FileServer] ${line}`);
862
+ let listeningPort = -1;
862
863
  app.use(async function loadEachFileOnlyAsItsNamedType(c, next) {
863
864
  await next();
864
865
  c.res.headers.set("X-Content-Type-Options", "nosniff");
865
866
  });
867
+ answerOwnLoopbackHostOnly(app, () => listeningPort);
866
868
  app.get("/*", async (c) => {
867
869
  let requestPath = c.req.path;
868
870
  if (requestPath === "/") requestPath = "/index.html";
@@ -872,7 +874,7 @@ function createFileServer(options) {
872
874
  const candidate = join2(root, relativePath);
873
875
  const resolveSymlinks = !allowOutsideProjectAssets && root !== compiledDir;
874
876
  if (!isPathInside2(candidate, root, { resolveSymlinks })) continue;
875
- if (isPrivateFileUnder(root, candidate, isVcsOrSecretPath)) continue;
877
+ if (isPrivateFileUnder(root, candidate, isStudioPrivatePath)) continue;
876
878
  const checksLinks = allowOutsideProjectAssets && root !== compiledDir;
877
879
  if (checksLinks && refusesOutsideLink(root, candidate, warnLeftOut)) continue;
878
880
  file = openRegularFile(candidate);
@@ -958,6 +960,7 @@ function createFileServer(options) {
958
960
  const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
959
961
  const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
960
962
  bound.then((boundPort) => {
963
+ listeningPort = boundPort;
961
964
  resolve13({
962
965
  url: `http://localhost:${boundPort}`,
963
966
  port: boundPort,
@@ -6546,7 +6549,7 @@ import {
6546
6549
  } from "@hyperframes/parsers/css-url-scans";
6547
6550
  import { createHash as createHash6 } from "node:crypto";
6548
6551
  import { createReadStream as createReadStream2, existsSync as existsSync11, mkdirSync as mkdirSync9, readFileSync as readFileSync8 } from "fs";
6549
- import { join as join19, dirname as dirname8, resolve as resolve7, basename as basename5, relative as relative2, sep as sep3 } from "path";
6552
+ import { join as join19, dirname as dirname9, resolve as resolve7, basename as basename5, relative as relative2, sep as sep3 } from "path";
6550
6553
  import { parseHTML as parseHTML5 } from "linkedom";
6551
6554
 
6552
6555
  // src/services/bundledScripts.ts
@@ -6618,7 +6621,7 @@ import {
6618
6621
  readTextFile,
6619
6622
  resolveCompositionSrc
6620
6623
  } from "@hyperframes/parsers/asset-resolution";
6621
- import { isPrivateFileUnder as isPrivateFileUnder2, isVcsOrSecretPath as isVcsOrSecretPath2 } from "@hyperframes/core/safe-path";
6624
+ import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
6622
6625
 
6623
6626
  // src/services/renderMediaCollector.ts
6624
6627
  import { parseHTML as parseHTML2 } from "linkedom";
@@ -7450,9 +7453,11 @@ import { getPositionEditsRenderScript } from "@hyperframes/core/runtime/position
7450
7453
 
7451
7454
  // src/services/assetMediaType.ts
7452
7455
  import { existsSync as existsSync10 } from "node:fs";
7453
- import { join as join18 } from "node:path";
7456
+ import { dirname as dirname8, join as join18 } from "node:path";
7454
7457
  import {
7455
7458
  fingerprintElementId,
7459
+ isHttpUrl as isHttpUrl2,
7460
+ isInsideAssetRoots,
7456
7461
  isNotMediaPayload,
7457
7462
  playlistLeavesItsFolder,
7458
7463
  NotMediaPayloadError,
@@ -7498,17 +7503,17 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
7498
7503
  }
7499
7504
  ]);
7500
7505
  }
7501
- function isRemoteOrInlineSource(src) {
7502
- return /^(?:https?:|data:|blob:|about:)/i.test(src.trim());
7506
+ function mediaAssetRoots(projectDir, compiledDir) {
7507
+ return [projectDir, compiledDir, join18(dirname8(compiledDir), "downloads")];
7503
7508
  }
7504
7509
  function dropMediaOutsideProject(input) {
7505
7510
  const { projectDir, workDir, composition, log } = input;
7506
7511
  const compiledDir = join18(workDir, "compiled");
7507
- const roots = [projectDir, compiledDir, join18(workDir, "downloads")];
7512
+ const roots = mediaAssetRoots(projectDir, compiledDir);
7508
7513
  const staysInside = ({ id, src }) => {
7509
- if (!src || isRemoteOrInlineSource(src)) return true;
7514
+ if (!src || isHttpUrl2(src)) return true;
7510
7515
  const path = resolveProjectRelativeSrc3(src, projectDir, compiledDir);
7511
- if (roots.some((root) => !escapesAssetRoot(path, root))) return true;
7516
+ if (isInsideAssetRoots(path, roots)) return true;
7512
7517
  if (input.allowOutsideProjectAssets) {
7513
7518
  const refusal = outsideAssetRefusal(projectDir, path);
7514
7519
  if (refusal) log.warn(`[Render] ${leftOutOfRender(`Media "${id}"`, src, refusal)}`);
@@ -7546,7 +7551,7 @@ async function preflightCompositionAssetMediaTypes(input) {
7546
7551
  ];
7547
7552
  const byPath = /* @__PURE__ */ new Map();
7548
7553
  for (const reference of references) {
7549
- if (!reference.src || isRemoteOrInlineSource(reference.src)) continue;
7554
+ if (!reference.src || isHttpUrl2(reference.src)) continue;
7550
7555
  const resolvedPath = resolveProjectRelativeSrc3(
7551
7556
  reference.src,
7552
7557
  input.projectDir,
@@ -7656,7 +7661,7 @@ function resolveCompositionFile(projectDir, src, assetRoot) {
7656
7661
  const file = resolveCompositionPath(projectDir, src, assetRoot);
7657
7662
  return file !== null && COMPOSITION_FILE.test(file) ? file : null;
7658
7663
  }
7659
- var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isVcsOrSecretPath2);
7664
+ var isPrivateCompositionFile = (projectDir, filePath) => isPrivateFileUnder2(projectDir, filePath, isStudioPrivatePath2);
7660
7665
  function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @__PURE__ */ new Set()) {
7661
7666
  const { document: document2 } = parseHTML5(html);
7662
7667
  const hosts = [...document2.querySelectorAll("[data-composition-src]")];
@@ -7675,7 +7680,10 @@ function assertSubCompositionsUsable(html, projectDir, assetRoot, visited = /* @
7675
7680
  continue;
7676
7681
  }
7677
7682
  if (isPrivateCompositionFile(projectDir, filePath)) {
7678
- problems.push({ srcPath, detail: "it is git metadata or an env file" });
7683
+ problems.push({
7684
+ srcPath,
7685
+ detail: "it is git metadata, an env file or a private tool record"
7686
+ });
7679
7687
  continue;
7680
7688
  }
7681
7689
  if (!COMPOSITION_FILE.test(filePath)) {
@@ -8004,7 +8012,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, visited = /*
8004
8012
  workItems.map(async (item) => {
8005
8013
  const { html: compiledSub } = await compileHtmlFile(
8006
8014
  rewriteUnresolvableGsapToCdn(item.rawSubHtml, projectDir, item.srcPath),
8007
- dirname8(item.filePath),
8015
+ dirname9(item.filePath),
8008
8016
  downloadDir,
8009
8017
  void 0,
8010
8018
  urlByAbsentLocalPath,
@@ -8666,7 +8674,7 @@ function projectStylesheetFontFamilies(html, projectDir) {
8666
8674
  const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
8667
8675
  const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
8668
8676
  const path = decodedUrlPath(url);
8669
- const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(dirname8(sheet), path);
8677
+ const file = path.startsWith("/") ? resolve7(projectDir, `.${path}`) : resolve7(dirname9(sheet), path);
8670
8678
  return isPathInside(file, projectDir) && existsSync11(file);
8671
8679
  });
8672
8680
  if (family && shipsFile) families.push(family);
@@ -10383,7 +10391,8 @@ import {
10383
10391
  rebaseVideoToWindow,
10384
10392
  resolveFinalFrameExtractionWindow as resolveFinalFrameExtractionWindow2,
10385
10393
  resolveVideoExtractionWindow as resolveVideoExtractionWindow2,
10386
- isHttpUrl as isHttpUrl2,
10394
+ isHttpUrl as isHttpUrl3,
10395
+ isInsideAssetRoots as isInsideAssetRoots2,
10387
10396
  assertPublicHttpsUrl,
10388
10397
  downloadToTemp as downloadToTemp2,
10389
10398
  resolveRestrictPageNetwork,
@@ -10633,6 +10642,7 @@ async function runExtractVideosStage(input) {
10633
10642
  skipFrameExtractionIds = []
10634
10643
  } = input;
10635
10644
  const stage2Start = Date.now();
10645
+ const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
10636
10646
  const extractionPolicy = resolveVideoExtractionPolicy();
10637
10647
  composition.videos = composition.videos.filter(
10638
10648
  (video) => !isVideoPastTimelineEnd(video, composition.duration)
@@ -10651,7 +10661,7 @@ async function runExtractVideosStage(input) {
10651
10661
  const probeFailures = await Promise.all(
10652
10662
  composition.videos.map(async (v) => {
10653
10663
  const videoPath = resolveProjectRelativeSrc4(v.src, projectDir, compiledDir);
10654
- if (!existsSync13(videoPath)) return null;
10664
+ if (!opensLocally(videoPath, assetRoots)) return null;
10655
10665
  try {
10656
10666
  const attempted = extractionPolicy.maxTransientRetries === 0 ? { result: await extractMediaMetadata4(videoPath), retries: 0 } : await runVideoExtractionWithRetry2(() => extractMediaMetadata4(videoPath), {
10657
10667
  signal: abortSignal,
@@ -10689,7 +10699,7 @@ async function runExtractVideosStage(input) {
10689
10699
  const probed = await Promise.all(
10690
10700
  composition.images.map(async (img) => {
10691
10701
  const imgPath = resolveProjectRelativeSrc4(img.src, projectDir, compiledDir);
10692
- if (!existsSync13(imgPath)) return null;
10702
+ if (!opensLocally(imgPath, assetRoots)) return null;
10693
10703
  const colorSpace = await probeColorSpaceSafely(imgPath, log);
10694
10704
  if (isHdrColorSpace2(colorSpace)) {
10695
10705
  nativeHdrImageIds.add(img.id);
@@ -10708,6 +10718,7 @@ async function runExtractVideosStage(input) {
10708
10718
  composition,
10709
10719
  urlByAbsentLocalPath,
10710
10720
  downloadDir: audioDownloadDir,
10721
+ allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
10711
10722
  signal: abortSignal,
10712
10723
  log
10713
10724
  });
@@ -10741,6 +10752,7 @@ async function runExtractVideosStage(input) {
10741
10752
  shownBoxes,
10742
10753
  contentKeyedDirs: [join22(compiledDir, REMOTE_MEDIA_SUBDIR)],
10743
10754
  urlByAbsentLocalPath,
10755
+ assetRoots,
10744
10756
  onProgress: ({ planned = 0, done = 0 }) => {
10745
10757
  framesPlanned += planned;
10746
10758
  framesDone += done;
@@ -10817,10 +10829,14 @@ function isPublicHttpsUrl(url) {
10817
10829
  return false;
10818
10830
  }
10819
10831
  }
10832
+ function opensLocally(path, assetRoots) {
10833
+ return existsSync13(path) && (!assetRoots || isInsideAssetRoots2(path, assetRoots));
10834
+ }
10820
10835
  function localProbeSource(src, input) {
10821
10836
  const path = resolveProjectRelativeSrc4(src, input.projectDir, input.compiledDir);
10822
10837
  const readFrom = input.urlByAbsentLocalPath?.get(path) ?? path;
10823
- return isHttpUrl2(readFrom) || existsSync13(readFrom) ? readFrom : null;
10838
+ const roots = input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(input.projectDir, input.compiledDir);
10839
+ return isHttpUrl3(readFrom) || opensLocally(readFrom, roots) ? readFrom : null;
10824
10840
  }
10825
10841
  async function remoteProbeSource(video, input) {
10826
10842
  if (!isPublicHttpsUrl(video.src)) return null;
@@ -10846,7 +10862,7 @@ async function appendVideoAudioFromProbe(input) {
10846
10862
  );
10847
10863
  const probed = await Promise.all(
10848
10864
  videos.map(async (video) => {
10849
- const readFrom = isHttpUrl2(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
10865
+ const readFrom = isHttpUrl3(video.src) ? await remoteProbeSource(video, input) : localProbeSource(video.src, input);
10850
10866
  if (readFrom === null) return null;
10851
10867
  const metadata = await extractMediaMetadata4(readFrom);
10852
10868
  const window2 = await resolveFinalFrameExtractionWindow2(
@@ -10870,7 +10886,7 @@ async function appendVideoAudioFromProbe(input) {
10870
10886
  import { existsSync as existsSync14 } from "node:fs";
10871
10887
  import {
10872
10888
  buildVideoLayerInput,
10873
- isHttpUrl as isHttpUrl3,
10889
+ isHttpUrl as isHttpUrl4,
10874
10890
  qualifyVideoLayer,
10875
10891
  resolveProjectRelativeSrc as resolveProjectRelativeSrc5
10876
10892
  } from "@hyperframes/engine";
@@ -10933,7 +10949,7 @@ async function planVideoLayerPassthrough(input) {
10933
10949
  const q = qualifyVideoLayer(input.videos, input.duration);
10934
10950
  if (!q.qualifies) return { reason: q.reason };
10935
10951
  const { video } = q;
10936
- if (isHttpUrl3(video.src)) return { reason: "remote_source" };
10952
+ if (isHttpUrl4(video.src)) return { reason: "remote_source" };
10937
10953
  const path = resolveProjectRelativeSrc5(video.src, input.projectDir, input.compiledDir);
10938
10954
  if (!existsSync14(path)) return { reason: "source_missing" };
10939
10955
  const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
@@ -10962,7 +10978,7 @@ import {
10962
10978
 
10963
10979
  // src/services/render/audioDeliveryLimit.ts
10964
10980
  import { existsSync as existsSync15 } from "node:fs";
10965
- import { dirname as dirname10, join as join24 } from "node:path";
10981
+ import { dirname as dirname11, join as join24 } from "node:path";
10966
10982
  import {
10967
10983
  applyAudioFxChain,
10968
10984
  describeFfmpegFailure as describeFfmpegFailure3,
@@ -10972,7 +10988,7 @@ import {
10972
10988
 
10973
10989
  // src/services/render/audioPadTrim.ts
10974
10990
  import { spawn } from "node:child_process";
10975
- import { dirname as dirname9, join as join23 } from "node:path";
10991
+ import { dirname as dirname10, join as join23 } from "node:path";
10976
10992
  import {
10977
10993
  DEFAULT_CONFIG,
10978
10994
  describeFfmpegFailure as describeFfmpegFailure2,
@@ -11266,7 +11282,7 @@ async function cutSource(input, scratchDir, attenuationDb) {
11266
11282
  async function enforceAacTruePeak(input) {
11267
11283
  let scratchDir;
11268
11284
  try {
11269
- scratchDir = createStagingDir3(dirname9(input.audioPath), ".true-peak-");
11285
+ scratchDir = createStagingDir3(dirname10(input.audioPath), ".true-peak-");
11270
11286
  const correctedPath = join23(scratchDir, "audio.m4a");
11271
11287
  const measurements = [];
11272
11288
  let attenuationDb = 0;
@@ -11477,7 +11493,7 @@ async function limitDeliveryPeaks(input, deps = {
11477
11493
  const peak = await deps.measure(audioPath, { timeoutMs, signal });
11478
11494
  if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
11479
11495
  const alternating = ["a", "b"].map(
11480
- (k) => join24(dirname10(sourcePath), `audio-source-limited-${k}.wav`)
11496
+ (k) => join24(dirname11(sourcePath), `audio-source-limited-${k}.wav`)
11481
11497
  );
11482
11498
  let encodedFrom;
11483
11499
  let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
@@ -11635,7 +11651,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
11635
11651
  masterFxChain,
11636
11652
  urlByAbsentLocalPath,
11637
11653
  audioSidecarUrlByLocalPath,
11638
- keepEncoderInputAt: pcmSourcePath
11654
+ keepEncoderInputAt: pcmSourcePath,
11655
+ assetRoots: input.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir)
11639
11656
  },
11640
11657
  compiledDir
11641
11658
  );
@@ -12315,7 +12332,7 @@ import {
12315
12332
  // src/services/shaderTransitionWorkerPool.ts
12316
12333
  import { Worker } from "node:worker_threads";
12317
12334
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
12318
- import { dirname as dirname11, join as join28 } from "node:path";
12335
+ import { dirname as dirname12, join as join28 } from "node:path";
12319
12336
  import { createRequire } from "node:module";
12320
12337
  import { usableCpuCount } from "@hyperframes/engine";
12321
12338
  import { existsSync as existsSync18 } from "node:fs";
@@ -12328,7 +12345,7 @@ function resolveWorkerEntry(explicit) {
12328
12345
  const isTs = override.endsWith(".ts");
12329
12346
  return { path: override, isTs };
12330
12347
  }
12331
- const moduleDir = dirname11(fileURLToPath3(import.meta.url));
12348
+ const moduleDir = dirname12(fileURLToPath3(import.meta.url));
12332
12349
  const jsPath = join28(moduleDir, "shaderTransitionWorker.js");
12333
12350
  if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
12334
12351
  const tsPath = join28(moduleDir, "shaderTransitionWorker.ts");
@@ -13057,7 +13074,7 @@ import {
13057
13074
  writeFileSync as writeFileSync6
13058
13075
  } from "node:fs";
13059
13076
  import { readFile as readFile2 } from "node:fs/promises";
13060
- import { dirname as dirname12, join as join31 } from "node:path";
13077
+ import { dirname as dirname13, join as join31 } from "node:path";
13061
13078
  import {
13062
13079
  encodeFramesChunkedConcat,
13063
13080
  encodeFramesFromDir,
@@ -13375,7 +13392,7 @@ async function runEncodeStage(input) {
13375
13392
  const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
13376
13393
  fps: job.config.fps,
13377
13394
  loop,
13378
- palettePath: join31(dirname12(videoOnlyPath), "gif-palette.png"),
13395
+ palettePath: join31(dirname13(videoOnlyPath), "gif-palette.png"),
13379
13396
  preserveAlpha: needsAlpha,
13380
13397
  signal: abortSignal,
13381
13398
  timeout: engineCfg.ffmpegEncodeTimeout
@@ -13820,7 +13837,7 @@ function getNextRetryWorkerCount(currentWorkers) {
13820
13837
  }
13821
13838
  function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir2()) {
13822
13839
  if (platform2 === "win32" || platform2 === "darwin") return join32(systemTempDir, "hf-render-");
13823
- return join32(dirname13(outputPath), `work-${jobId}-`);
13840
+ return join32(dirname14(outputPath), `work-${jobId}-`);
13824
13841
  }
13825
13842
  var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
13826
13843
  function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
@@ -14546,7 +14563,7 @@ function deVerifyFallbackTelemetry(err) {
14546
14563
  };
14547
14564
  }
14548
14565
  function resolveRenderDebugDir() {
14549
- const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(dirname13(fileURLToPath4(import.meta.url)), "../..");
14566
+ const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve8(process.env.PRODUCER_RENDERS_DIR, "..") : resolve8(dirname14(fileURLToPath4(import.meta.url)), "../..");
14550
14567
  return join32(producerRoot, ".debug");
14551
14568
  }
14552
14569
  async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
@@ -14554,7 +14571,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
14554
14571
  validateDeliveryEncoderConfig(job.config);
14555
14572
  validateChromaSubsamplingConfig(job.config);
14556
14573
  const debugDir = resolveRenderDebugDir();
14557
- const outputDir = dirname13(outputPath);
14574
+ const outputDir = dirname14(outputPath);
14558
14575
  if (!existsSync21(outputDir)) mkdirSync12(outputDir, { recursive: true });
14559
14576
  const workDir = job.config.debug ? join32(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
14560
14577
  const pipelineStart = Date.now();
@@ -15053,6 +15070,7 @@ async function executeRenderPipeline(input) {
15053
15070
  audioGain: cfg.audioGain,
15054
15071
  audios: composition.audios,
15055
15072
  masterFxChain: composition.masterFxChain,
15073
+ allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
15056
15074
  abortSignal: executionSignal,
15057
15075
  assertNotAborted,
15058
15076
  log,
@@ -16725,7 +16743,7 @@ import { tmpdir as tmpdir4 } from "node:os";
16725
16743
  import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync13, rmSync as rmSync13 } from "node:fs";
16726
16744
  import { open } from "node:fs/promises";
16727
16745
  import { renameWithRetry as renameWithRetry7 } from "@hyperframes/engine";
16728
- import { basename as basename7, dirname as dirname14, join as join33 } from "node:path";
16746
+ import { basename as basename7, dirname as dirname15, join as join33 } from "node:path";
16729
16747
  import { finished, pipeline } from "node:stream/promises";
16730
16748
  import { createStagingDir as createStagingDir4 } from "@hyperframes/core/atomic-file";
16731
16749
  function boxAt(src, off, at, limit) {
@@ -17090,8 +17108,8 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
17090
17108
  const sourcePaths = audioPath ? [audioPath, ...chunkPaths] : chunkPaths;
17091
17109
  const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
17092
17110
  const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
17093
- mkdirSync13(dirname14(outputPath), { recursive: true });
17094
- const workDir = createStagingDir4(dirname14(outputPath), `${basename7(outputPath)}.stitch-`);
17111
+ mkdirSync13(dirname15(outputPath), { recursive: true });
17112
+ const workDir = createStagingDir4(dirname15(outputPath), `${basename7(outputPath)}.stitch-`);
17095
17113
  const out = createWriteStream(join33(workDir, "out.mp4"));
17096
17114
  try {
17097
17115
  out.write(header);
@@ -17157,7 +17175,7 @@ import {
17157
17175
 
17158
17176
  // src/services/distributed/shared.ts
17159
17177
  import { execFile as execFileCallback } from "node:child_process";
17160
- import { dirname as dirname15, join as join34 } from "node:path";
17178
+ import { dirname as dirname16, join as join34 } from "node:path";
17161
17179
  import { existsSync as existsSync22, readFileSync as readFileSync10 } from "node:fs";
17162
17180
  import { fileURLToPath as fileURLToPath5 } from "node:url";
17163
17181
  import { promisify as promisify2 } from "node:util";
@@ -17433,7 +17451,7 @@ function buildSyntheticRenderJob(input) {
17433
17451
  var cachedProducerVersion = null;
17434
17452
  function readProducerVersion() {
17435
17453
  if (cachedProducerVersion !== null) return cachedProducerVersion;
17436
- const startDir = dirname15(fileURLToPath5(import.meta.url));
17454
+ const startDir = dirname16(fileURLToPath5(import.meta.url));
17437
17455
  let current = startDir;
17438
17456
  for (let i = 0; i < 10; i++) {
17439
17457
  const candidate = join34(current, "package.json");
@@ -17447,7 +17465,7 @@ function readProducerVersion() {
17447
17465
  } catch {
17448
17466
  }
17449
17467
  }
17450
- const parent = dirname15(current);
17468
+ const parent = dirname16(current);
17451
17469
  if (parent === current) break;
17452
17470
  current = parent;
17453
17471
  }
@@ -19068,6 +19086,7 @@ function mixPlanAudio(c, compiledDir) {
19068
19086
  compiledDir,
19069
19087
  urlByAbsentLocalPath: c.urlByAbsentLocalPath,
19070
19088
  audioSidecarUrlByLocalPath: c.audioSidecarUrlByLocalPath,
19089
+ allowOutsideProjectAssets: c.job.config.allowOutsideProjectAssets,
19071
19090
  totalFrames: c.totalFrames,
19072
19091
  fps: c.job.config.fps,
19073
19092
  ffmpegProcessTimeout: c.cfg.ffmpegProcessTimeout,
@@ -19426,7 +19445,7 @@ import {
19426
19445
  writeFileSync as writeFileSync12
19427
19446
  } from "node:fs";
19428
19447
  import { tmpdir as tmpdir3 } from "node:os";
19429
- import { dirname as dirname17, isAbsolute as isAbsolute4, join as join44, relative as relative7, resolve as resolve10, sep as sep5 } from "node:path";
19448
+ import { dirname as dirname18, isAbsolute as isAbsolute4, join as join44, relative as relative7, resolve as resolve10, sep as sep5 } from "node:path";
19430
19449
  import { DISTRIBUTED_FPS, isDistributedFps } from "@hyperframes/core";
19431
19450
  import {
19432
19451
  createFrameLookupTable as createFrameLookupTable5,
@@ -19445,7 +19464,7 @@ import {
19445
19464
  writeFileSync as writeFileSync11
19446
19465
  } from "node:fs";
19447
19466
  import { renameWithRetry as renameWithRetry9 } from "@hyperframes/engine";
19448
- import { dirname as dirname16, join as join43 } from "node:path";
19467
+ import { dirname as dirname17, join as join43 } from "node:path";
19449
19468
 
19450
19469
  // src/services/distributed/planV2Errors.ts
19451
19470
  var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
@@ -19506,8 +19525,8 @@ var LocalPlanV2ArtifactPublisher = class {
19506
19525
  }
19507
19526
  this.destinationDir = destinationDir;
19508
19527
  this.#linkFile = options.linkFile ?? linkSync2;
19509
- mkdirSync17(dirname16(destinationDir), { recursive: true });
19510
- this.temporaryDir = createStagingDir5(dirname16(destinationDir), ".plan-v2-publish-");
19528
+ mkdirSync17(dirname17(destinationDir), { recursive: true });
19529
+ this.temporaryDir = createStagingDir5(dirname17(destinationDir), ".plan-v2-publish-");
19511
19530
  }
19512
19531
  async putBlob(blob) {
19513
19532
  const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
@@ -19519,8 +19538,8 @@ var LocalPlanV2ArtifactPublisher = class {
19519
19538
  }
19520
19539
  const destinationPath = planV2BlobPath(this.temporaryDir, digest);
19521
19540
  if (existsSync27(destinationPath)) return;
19522
- mkdirSync17(dirname16(destinationPath), { recursive: true });
19523
- const stagingDir = createStagingDir5(dirname16(destinationPath), ".plan-v2-blob-");
19541
+ mkdirSync17(dirname17(destinationPath), { recursive: true });
19542
+ const stagingDir = createStagingDir5(dirname17(destinationPath), ".plan-v2-blob-");
19524
19543
  const temporaryPath = join43(stagingDir, "blob");
19525
19544
  try {
19526
19545
  try {
@@ -19811,8 +19830,8 @@ function computeManifestHash(manifest) {
19811
19830
  }
19812
19831
  function writeBlob(sourcePath, destinationPath) {
19813
19832
  if (existsSync28(destinationPath)) return;
19814
- mkdirSync18(dirname17(destinationPath), { recursive: true });
19815
- const temporaryDir = createStagingDir6(dirname17(destinationPath), ".plan-v2-blob-");
19833
+ mkdirSync18(dirname18(destinationPath), { recursive: true });
19834
+ const temporaryDir = createStagingDir6(dirname18(destinationPath), ".plan-v2-blob-");
19816
19835
  const temporaryPath = join44(temporaryDir, "blob");
19817
19836
  try {
19818
19837
  copyFileSync8(sourcePath, temporaryPath);
@@ -19937,8 +19956,8 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
19937
19956
  if (publication.storedBlobs.length > 0) {
19938
19957
  throw new PlanV2IntegrityError("a local plan v2 directory cannot reference remote files");
19939
19958
  }
19940
- mkdirSync18(dirname17(planV2Dir), { recursive: true });
19941
- const tempDir = createStagingDir6(dirname17(planV2Dir), ".plan-v2-build-");
19959
+ mkdirSync18(dirname18(planV2Dir), { recursive: true });
19960
+ const tempDir = createStagingDir6(dirname18(planV2Dir), ".plan-v2-build-");
19942
19961
  try {
19943
19962
  for (const blob of publication.blobs) {
19944
19963
  writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
@@ -20022,7 +20041,7 @@ async function planV2(projectDir, config, planV2Dir) {
20022
20041
  }
20023
20042
  const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
20024
20043
  const manifest = await planV2WithPublisher(projectDir, config, publisher, {
20025
- stagingParentDir: dirname17(planV2Dir)
20044
+ stagingParentDir: dirname18(planV2Dir)
20026
20045
  });
20027
20046
  return resultFromManifest(planV2Dir, manifest);
20028
20047
  }
@@ -20215,12 +20234,12 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
20215
20234
  artifact,
20216
20235
  sourcePath: verifyBlob(planV2Dir, artifact)
20217
20236
  }));
20218
- mkdirSync18(dirname17(destinationDir), { recursive: true });
20219
- const tempDir = createStagingDir6(dirname17(destinationDir), ".plan-v2-materialize-");
20237
+ mkdirSync18(dirname18(destinationDir), { recursive: true });
20238
+ const tempDir = createStagingDir6(dirname18(destinationDir), ".plan-v2-materialize-");
20220
20239
  try {
20221
20240
  for (const { artifact, sourcePath } of verified) {
20222
20241
  const destinationPath = join44(tempDir, ...artifact.path.split("/"));
20223
- mkdirSync18(dirname17(destinationPath), { recursive: true });
20242
+ mkdirSync18(dirname18(destinationPath), { recursive: true });
20224
20243
  copyFileSync8(sourcePath, destinationPath);
20225
20244
  }
20226
20245
  if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
@@ -21699,7 +21718,7 @@ import {
21699
21718
  rmSync as rmSync19,
21700
21719
  createReadStream as createReadStream5
21701
21720
  } from "node:fs";
21702
- import { resolve as resolve12, dirname as dirname19, join as join49 } from "node:path";
21721
+ import { resolve as resolve12, dirname as dirname20, join as join49 } from "node:path";
21703
21722
  import { tmpdir as tmpdir5 } from "node:os";
21704
21723
  import { parseArgs } from "node:util";
21705
21724
  import { isIP } from "node:net";
@@ -21841,7 +21860,7 @@ async function runHyperframeLint(prepared) {
21841
21860
  // src/services/healthWorker.ts
21842
21861
  import { Worker as Worker2 } from "node:worker_threads";
21843
21862
  import { fileURLToPath as fileURLToPath6 } from "node:url";
21844
- import { dirname as dirname18, join as join48 } from "node:path";
21863
+ import { dirname as dirname19, join as join48 } from "node:path";
21845
21864
  import { existsSync as existsSync31 } from "node:fs";
21846
21865
  var DEFAULT_HEALTH_PORT = 9848;
21847
21866
  async function startHealthWorker(options = {}) {
@@ -21916,7 +21935,7 @@ function defaultLogger2() {
21916
21935
  };
21917
21936
  }
21918
21937
  function resolveWorkerEntry2() {
21919
- const here = dirname18(fileURLToPath6(import.meta.url));
21938
+ const here = dirname19(fileURLToPath6(import.meta.url));
21920
21939
  const candidates = [join48(here, "healthWorkerThread.js"), join48(here, "healthWorkerThread.ts")];
21921
21940
  for (const candidate of candidates) {
21922
21941
  if (existsSync31(candidate)) return candidate;
@@ -22086,7 +22105,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
22086
22105
  throw new Error("outputPath must be inside the renders directory");
22087
22106
  }
22088
22107
  }
22089
- const outputDir = dirname19(absoluteOutputPath);
22108
+ const outputDir = dirname20(absoluteOutputPath);
22090
22109
  if (!existsSync32(outputDir)) mkdirSync21(outputDir, { recursive: true });
22091
22110
  return { input, cleanupProjectDir, absoluteOutputPath };
22092
22111
  }
@@ -22798,7 +22817,7 @@ import {
22798
22817
  statSync as statSync15,
22799
22818
  writeFileSync as writeFileSync15
22800
22819
  } from "node:fs";
22801
- import { basename as basename8, dirname as dirname20, join as join50 } from "node:path";
22820
+ import { basename as basename8, dirname as dirname21, join as join50 } from "node:path";
22802
22821
  import {
22803
22822
  appendRateCapArgs as appendRateCapArgs2,
22804
22823
  appendRenderProvenanceArgs as appendRenderProvenanceArgs2,
@@ -22845,10 +22864,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
22845
22864
  }
22846
22865
  const format = plan2.dimensions.format;
22847
22866
  const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
22848
- if (!existsSync33(dirname20(outputPath))) {
22849
- mkdirSync22(dirname20(outputPath), { recursive: true });
22867
+ if (!existsSync33(dirname21(outputPath))) {
22868
+ mkdirSync22(dirname21(outputPath), { recursive: true });
22850
22869
  }
22851
- const workDir = createStagingDir7(dirname20(outputPath), `${basename8(outputPath)}.assemble-work-`);
22870
+ const workDir = createStagingDir7(dirname21(outputPath), `${basename8(outputPath)}.assemble-work-`);
22852
22871
  const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
22853
22872
  const stageMs = {};
22854
22873
  const ctx = {