@hyperframes/producer 0.9.86 → 0.9.87
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/compileWorker.js +3210 -0
- package/dist/distributed.js +388 -269
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/index.js +462 -342
- package/dist/public-server.js +274 -154
- package/dist/services/compileInWorker.d.ts +10 -0
- package/dist/services/compileWorker.d.ts +1 -0
- package/package.json +7 -7
package/dist/public-server.js
CHANGED
|
@@ -18,7 +18,7 @@ function requireOutputDimensions(expected, width, height) {
|
|
|
18
18
|
|
|
19
19
|
// src/server.ts
|
|
20
20
|
import {
|
|
21
|
-
existsSync as
|
|
21
|
+
existsSync as existsSync26,
|
|
22
22
|
mkdirSync as mkdirSync13,
|
|
23
23
|
statSync as statSync12,
|
|
24
24
|
mkdtempSync,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
rmSync as rmSync13,
|
|
27
27
|
createReadStream as createReadStream4
|
|
28
28
|
} from "node:fs";
|
|
29
|
-
import { resolve as resolve11, dirname as
|
|
29
|
+
import { resolve as resolve11, dirname as dirname19, join as join40 } from "node:path";
|
|
30
30
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
31
31
|
import { parseArgs } from "node:util";
|
|
32
32
|
import { isIP } from "node:net";
|
|
@@ -44,7 +44,7 @@ import { isSafePath as isSafePath4 } from "@hyperframes/core/safe-path";
|
|
|
44
44
|
// src/services/renderOrchestrator.ts
|
|
45
45
|
import { audioFailureDiagnostics as audioFailureDiagnostics2, cpuBudget } from "@hyperframes/engine";
|
|
46
46
|
import {
|
|
47
|
-
existsSync as
|
|
47
|
+
existsSync as existsSync22,
|
|
48
48
|
mkdirSync as mkdirSync12,
|
|
49
49
|
readdirSync as readdirSync6,
|
|
50
50
|
rmSync as rmSync12,
|
|
@@ -395,10 +395,10 @@ import {
|
|
|
395
395
|
referenceBackgroundResult,
|
|
396
396
|
createReferenceBackgroundRecorder
|
|
397
397
|
} from "@hyperframes/engine";
|
|
398
|
-
import { join as
|
|
398
|
+
import { join as join35, dirname as dirname15, resolve as resolve9 } from "path";
|
|
399
399
|
import { totalmem as totalmem2 } from "node:os";
|
|
400
400
|
import { randomUUID } from "crypto";
|
|
401
|
-
import { fileURLToPath as
|
|
401
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
402
402
|
|
|
403
403
|
// src/services/fileServer.ts
|
|
404
404
|
import { Hono } from "hono";
|
|
@@ -7147,14 +7147,20 @@ function countAuthoredTimedClips(html) {
|
|
|
7147
7147
|
}
|
|
7148
7148
|
|
|
7149
7149
|
// src/services/render/stages/compileStage.ts
|
|
7150
|
-
import { existsSync as
|
|
7151
|
-
import { join as
|
|
7150
|
+
import { existsSync as existsSync13, writeFileSync as writeFileSync4 } from "node:fs";
|
|
7151
|
+
import { join as join23, relative as relative4 } from "node:path";
|
|
7152
7152
|
import { privateCacheRoot } from "@hyperframes/engine";
|
|
7153
7153
|
import { suggestMatchingPreset } from "@hyperframes/core";
|
|
7154
7154
|
import { extractStandaloneEntryFromIndex, isTemplateEntry } from "@hyperframes/core/compiler";
|
|
7155
7155
|
import { readTextFile as readTextFile2 } from "@hyperframes/parsers/asset-resolution";
|
|
7156
7156
|
import { assertCompositionFileSize as assertCompositionFileSize2 } from "@hyperframes/core/compiler";
|
|
7157
7157
|
|
|
7158
|
+
// src/services/compileInWorker.ts
|
|
7159
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
7160
|
+
import { dirname as dirname10, join as join22 } from "node:path";
|
|
7161
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
7162
|
+
import { Worker } from "node:worker_threads";
|
|
7163
|
+
|
|
7158
7164
|
// src/services/htmlCompiler.ts
|
|
7159
7165
|
import { decodedUrlPath } from "@hyperframes/parsers/asset-paths";
|
|
7160
7166
|
import {
|
|
@@ -10467,11 +10473,119 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
|
|
|
10467
10473
|
};
|
|
10468
10474
|
}
|
|
10469
10475
|
|
|
10476
|
+
// src/services/compileInWorker.ts
|
|
10477
|
+
var DEFAULT_COMPILE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
10478
|
+
var TERMINATE_GRACE_MS = 2e3;
|
|
10479
|
+
var ADVISORY_GRACE_MS = 3e4;
|
|
10480
|
+
var MAX_TIMER_MS = 2 ** 31 - 1;
|
|
10481
|
+
var CompileTimeoutError = class extends Error {
|
|
10482
|
+
code = "COMPILE_TIMEOUT";
|
|
10483
|
+
owner = "user";
|
|
10484
|
+
retryable = false;
|
|
10485
|
+
publicMetadata;
|
|
10486
|
+
constructor(timeoutMs) {
|
|
10487
|
+
super(
|
|
10488
|
+
`Compiling the composition took longer than ${Math.round(timeoutMs / 1e3)} s, so it was stopped. Very large pages, or pages with very many style rules or media tags, are the usual cause.`
|
|
10489
|
+
);
|
|
10490
|
+
this.name = "CompileTimeoutError";
|
|
10491
|
+
this.publicMetadata = { timeoutMs };
|
|
10492
|
+
}
|
|
10493
|
+
};
|
|
10494
|
+
function compileTimeoutMs() {
|
|
10495
|
+
const fromEnv = Number(process.env.HYPERFRAMES_COMPILE_TIMEOUT_MS);
|
|
10496
|
+
return Number.isInteger(fromEnv) && fromEnv > 0 ? Math.min(fromEnv, MAX_TIMER_MS) : DEFAULT_COMPILE_TIMEOUT_MS;
|
|
10497
|
+
}
|
|
10498
|
+
var warnedMissingEntry = false;
|
|
10499
|
+
function resolveCompileWorkerEntry(explicit, log) {
|
|
10500
|
+
if (explicit) return explicit;
|
|
10501
|
+
const fromEnv = process.env.HF_COMPILE_WORKER_ENTRY;
|
|
10502
|
+
if (fromEnv) {
|
|
10503
|
+
if (existsSync12(fromEnv)) return fromEnv;
|
|
10504
|
+
if (!warnedMissingEntry) {
|
|
10505
|
+
warnedMissingEntry = true;
|
|
10506
|
+
log?.warn(
|
|
10507
|
+
"[Compiler] HF_COMPILE_WORKER_ENTRY names a missing file, so compiles run on the main thread with no deadline",
|
|
10508
|
+
{ entry: fromEnv }
|
|
10509
|
+
);
|
|
10510
|
+
}
|
|
10511
|
+
return void 0;
|
|
10512
|
+
}
|
|
10513
|
+
const sibling = join22(dirname10(fileURLToPath3(import.meta.url)), "compileWorker.js");
|
|
10514
|
+
return existsSync12(sibling) ? sibling : void 0;
|
|
10515
|
+
}
|
|
10516
|
+
function rebuildError({ name, message, stack, props }) {
|
|
10517
|
+
const error = Object.assign(new Error(message), props);
|
|
10518
|
+
error.name = name;
|
|
10519
|
+
if (stack) error.stack = stack;
|
|
10520
|
+
return error;
|
|
10521
|
+
}
|
|
10522
|
+
async function compileForRenderInWorker(projectDir, htmlPath, downloadDir, options = {}, worker = {}) {
|
|
10523
|
+
const { log, abortSignal, ...cloneable } = options;
|
|
10524
|
+
const entry = resolveCompileWorkerEntry(worker.entry, log);
|
|
10525
|
+
if (!entry) return compileForRender(projectDir, htmlPath, downloadDir, options);
|
|
10526
|
+
abortSignal?.throwIfAborted();
|
|
10527
|
+
const timeoutMs = worker.timeoutMs ?? compileTimeoutMs();
|
|
10528
|
+
return new Promise((resolve12, reject) => {
|
|
10529
|
+
const thread = new Worker(entry, {
|
|
10530
|
+
workerData: { projectDir, htmlPath, downloadDir, options: cloneable }
|
|
10531
|
+
});
|
|
10532
|
+
let settled = false;
|
|
10533
|
+
const settle = (finish) => {
|
|
10534
|
+
if (settled) return;
|
|
10535
|
+
settled = true;
|
|
10536
|
+
clearTimeout(timer);
|
|
10537
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
10538
|
+
finish();
|
|
10539
|
+
};
|
|
10540
|
+
const stop = () => {
|
|
10541
|
+
thread.postMessage({ type: "abort" });
|
|
10542
|
+
setTimeout(() => void thread.terminate(), TERMINATE_GRACE_MS).unref();
|
|
10543
|
+
};
|
|
10544
|
+
const timer = setTimeout(() => {
|
|
10545
|
+
stop();
|
|
10546
|
+
settle(() => reject(new CompileTimeoutError(timeoutMs)));
|
|
10547
|
+
}, timeoutMs);
|
|
10548
|
+
const onAbort = () => {
|
|
10549
|
+
stop();
|
|
10550
|
+
settle(() => reject(abortSignal?.reason ?? new Error("Compile aborted")));
|
|
10551
|
+
};
|
|
10552
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
10553
|
+
const retire = (graceMs) => {
|
|
10554
|
+
thread.unref();
|
|
10555
|
+
setTimeout(() => void thread.terminate(), graceMs).unref();
|
|
10556
|
+
};
|
|
10557
|
+
thread.on(
|
|
10558
|
+
"message",
|
|
10559
|
+
(message) => {
|
|
10560
|
+
if (message.type === "log" && message.level) {
|
|
10561
|
+
log?.[message.level](message.message ?? "", message.meta);
|
|
10562
|
+
} else if (message.type === "result" && message.compiled) {
|
|
10563
|
+
const { compiled } = message;
|
|
10564
|
+
settle(() => resolve12(compiled));
|
|
10565
|
+
retire(ADVISORY_GRACE_MS);
|
|
10566
|
+
} else if (message.type === "error" && message.error) {
|
|
10567
|
+
const { error } = message;
|
|
10568
|
+
settle(() => reject(rebuildError(error)));
|
|
10569
|
+
thread.postMessage({ type: "abort" });
|
|
10570
|
+
retire(TERMINATE_GRACE_MS);
|
|
10571
|
+
}
|
|
10572
|
+
}
|
|
10573
|
+
);
|
|
10574
|
+
thread.on("error", (error) => settle(() => reject(error)));
|
|
10575
|
+
thread.on(
|
|
10576
|
+
"exit",
|
|
10577
|
+
(code) => settle(
|
|
10578
|
+
() => reject(new Error(`The compile worker exited with code ${code} before answering`))
|
|
10579
|
+
)
|
|
10580
|
+
);
|
|
10581
|
+
});
|
|
10582
|
+
}
|
|
10583
|
+
|
|
10470
10584
|
// src/services/render/stages/compileStage.ts
|
|
10471
10585
|
function animatedGifCacheDir(extractCacheDir) {
|
|
10472
10586
|
try {
|
|
10473
10587
|
const root = extractCacheDir && privateCacheRoot(extractCacheDir);
|
|
10474
|
-
return root ?
|
|
10588
|
+
return root ? join23(root, "animated-gif") : void 0;
|
|
10475
10589
|
} catch {
|
|
10476
10590
|
return void 0;
|
|
10477
10591
|
}
|
|
@@ -10499,11 +10613,11 @@ function resolveEntryHtmlPath(input) {
|
|
|
10499
10613
|
assertCompositionFileSize2(path, relative4(projectDir, path));
|
|
10500
10614
|
return readTextFile2(path);
|
|
10501
10615
|
};
|
|
10502
|
-
const htmlPath =
|
|
10616
|
+
const htmlPath = join23(projectDir, entryFile);
|
|
10503
10617
|
const rawEntry = readEntry(htmlPath);
|
|
10504
10618
|
if (entryFile === "index.html" || !isTemplateEntry(rawEntry)) return htmlPath;
|
|
10505
|
-
const projectIndexPath =
|
|
10506
|
-
if (!
|
|
10619
|
+
const projectIndexPath = join23(projectDir, "index.html");
|
|
10620
|
+
if (!existsSync13(projectIndexPath)) {
|
|
10507
10621
|
throw new Error(
|
|
10508
10622
|
`Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
|
|
10509
10623
|
);
|
|
@@ -10518,7 +10632,7 @@ function resolveEntryHtmlPath(input) {
|
|
|
10518
10632
|
`Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
|
|
10519
10633
|
);
|
|
10520
10634
|
}
|
|
10521
|
-
const wrapperPath =
|
|
10635
|
+
const wrapperPath = join23(workDir, "standalone-entry.html");
|
|
10522
10636
|
writeFileSync4(wrapperPath, standaloneHtml, "utf-8");
|
|
10523
10637
|
log.info("Extracted standalone entry from index.html host context", { entryFile });
|
|
10524
10638
|
return wrapperPath;
|
|
@@ -10548,19 +10662,24 @@ async function runCompileStage(input) {
|
|
|
10548
10662
|
const assetRoot = job.config.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
10549
10663
|
const htmlPath = resolveEntryHtmlPath({ projectDir, workDir, entryFile, log, assetRoot });
|
|
10550
10664
|
const compileStart = Date.now();
|
|
10551
|
-
const compiled = await
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10665
|
+
const compiled = await compileForRenderInWorker(
|
|
10666
|
+
projectDir,
|
|
10667
|
+
htmlPath,
|
|
10668
|
+
join23(workDir, "downloads"),
|
|
10669
|
+
{
|
|
10670
|
+
log,
|
|
10671
|
+
failClosedFontFetch: failClosedFontFetch === true,
|
|
10672
|
+
allowSystemFontCapture,
|
|
10673
|
+
abortSignal,
|
|
10674
|
+
variables: input.variables,
|
|
10675
|
+
urlByAbsentLocalPath: input.urlByAbsentLocalPath,
|
|
10676
|
+
pageMotionBlur: input.pageMotionBlur,
|
|
10677
|
+
animatedGifCacheDir: animatedGifCacheDir(cfg.extractCacheDir),
|
|
10678
|
+
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout,
|
|
10679
|
+
allowOutsideProjectAssets: job.config.allowOutsideProjectAssets,
|
|
10680
|
+
includeOutsideScripts: job.config.includeOutsideScripts
|
|
10681
|
+
}
|
|
10682
|
+
);
|
|
10564
10683
|
assertNotAborted();
|
|
10565
10684
|
const compileOnlyMs = Date.now() - compileStart;
|
|
10566
10685
|
let deCompileGate;
|
|
@@ -10623,7 +10742,7 @@ async function runCompileStage(input) {
|
|
|
10623
10742
|
});
|
|
10624
10743
|
await preflightCompositionAssetMediaTypes({
|
|
10625
10744
|
projectDir,
|
|
10626
|
-
compiledDir:
|
|
10745
|
+
compiledDir: join23(workDir, "compiled"),
|
|
10627
10746
|
composition,
|
|
10628
10747
|
signal: abortSignal
|
|
10629
10748
|
});
|
|
@@ -10671,7 +10790,7 @@ async function runCompileStage(input) {
|
|
|
10671
10790
|
|
|
10672
10791
|
// src/services/render/stages/probeStage.ts
|
|
10673
10792
|
import { createHash as createHash7 } from "node:crypto";
|
|
10674
|
-
import { basename as basename7, join as
|
|
10793
|
+
import { basename as basename7, join as join24 } from "node:path";
|
|
10675
10794
|
import { parseHTML as parseHTML6 } from "linkedom";
|
|
10676
10795
|
import {
|
|
10677
10796
|
closeCaptureSession as closeCaptureSession4,
|
|
@@ -11025,7 +11144,7 @@ async function runProbeStage(input) {
|
|
|
11025
11144
|
});
|
|
11026
11145
|
fileServer = await createFileServer({
|
|
11027
11146
|
projectDir,
|
|
11028
|
-
compiledDir:
|
|
11147
|
+
compiledDir: join24(workDir, "compiled"),
|
|
11029
11148
|
port: 0,
|
|
11030
11149
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
11031
11150
|
fps: job.config.fps,
|
|
@@ -11039,7 +11158,7 @@ async function runProbeStage(input) {
|
|
|
11039
11158
|
composition.videos,
|
|
11040
11159
|
compiled.html,
|
|
11041
11160
|
projectDir,
|
|
11042
|
-
|
|
11161
|
+
join24(workDir, "compiled")
|
|
11043
11162
|
),
|
|
11044
11163
|
recordReferenceBackground: input.recordReferenceBackground,
|
|
11045
11164
|
width,
|
|
@@ -11068,7 +11187,7 @@ async function runProbeStage(input) {
|
|
|
11068
11187
|
log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
|
|
11069
11188
|
probeSession = await createCaptureSession4(
|
|
11070
11189
|
fileServer.url,
|
|
11071
|
-
|
|
11190
|
+
join24(workDir, "probe"),
|
|
11072
11191
|
captureOpts,
|
|
11073
11192
|
null,
|
|
11074
11193
|
probeCfg
|
|
@@ -11154,7 +11273,7 @@ async function runProbeStage(input) {
|
|
|
11154
11273
|
});
|
|
11155
11274
|
probeSession = await createCaptureSession4(
|
|
11156
11275
|
fileServer.url,
|
|
11157
|
-
|
|
11276
|
+
join24(workDir, "probe-screenshot"),
|
|
11158
11277
|
captureOpts,
|
|
11159
11278
|
null,
|
|
11160
11279
|
{ ...probeCfg, forceScreenshot: true }
|
|
@@ -11198,7 +11317,7 @@ async function runProbeStage(input) {
|
|
|
11198
11317
|
compiled,
|
|
11199
11318
|
resolutions,
|
|
11200
11319
|
projectDir,
|
|
11201
|
-
|
|
11320
|
+
join24(workDir, "downloads"),
|
|
11202
11321
|
job.config.allowOutsideProjectAssets ? void 0 : projectDir,
|
|
11203
11322
|
{ includeScripts: job.config.includeOutsideScripts }
|
|
11204
11323
|
);
|
|
@@ -11404,7 +11523,7 @@ async function runProbeStage(input) {
|
|
|
11404
11523
|
});
|
|
11405
11524
|
await preflightCompositionAssetMediaTypes({
|
|
11406
11525
|
projectDir,
|
|
11407
|
-
compiledDir:
|
|
11526
|
+
compiledDir: join24(workDir, "compiled"),
|
|
11408
11527
|
composition,
|
|
11409
11528
|
signal: abortSignal
|
|
11410
11529
|
});
|
|
@@ -11539,8 +11658,8 @@ function validateRenderDuration(input) {
|
|
|
11539
11658
|
}
|
|
11540
11659
|
|
|
11541
11660
|
// src/services/render/stages/extractVideosStage.ts
|
|
11542
|
-
import { existsSync as
|
|
11543
|
-
import { join as
|
|
11661
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
11662
|
+
import { join as join25 } from "node:path";
|
|
11544
11663
|
import {
|
|
11545
11664
|
classifyVideoExtractionError,
|
|
11546
11665
|
createFrameLookupTable as createFrameLookupTable3,
|
|
@@ -11905,7 +12024,7 @@ async function runExtractVideosStage(input) {
|
|
|
11905
12024
|
// because short boundary counts can differ by one frame.
|
|
11906
12025
|
{
|
|
11907
12026
|
fps: job.config.fps,
|
|
11908
|
-
outputDir:
|
|
12027
|
+
outputDir: join25(compiledDir, "__hyperframes_video_frames"),
|
|
11909
12028
|
format: job.config.videoFrameFormat ?? "auto",
|
|
11910
12029
|
toneMapHdrToSdr: rendersSdrOnly(job.config, composition),
|
|
11911
12030
|
timelineEnd: composition.duration,
|
|
@@ -11913,7 +12032,7 @@ async function runExtractVideosStage(input) {
|
|
|
11913
12032
|
collectProbeFailures: extractionPolicy.failureMode === "enforce",
|
|
11914
12033
|
deferRangeExtraction,
|
|
11915
12034
|
shownBoxes,
|
|
11916
|
-
contentKeyedDirs: [
|
|
12035
|
+
contentKeyedDirs: [join25(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
11917
12036
|
urlByAbsentLocalPath,
|
|
11918
12037
|
assetRoots,
|
|
11919
12038
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
@@ -11993,7 +12112,7 @@ function isPublicHttpsUrl(url) {
|
|
|
11993
12112
|
}
|
|
11994
12113
|
}
|
|
11995
12114
|
function opensLocally(path, assetRoots) {
|
|
11996
|
-
return
|
|
12115
|
+
return existsSync14(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
|
|
11997
12116
|
}
|
|
11998
12117
|
function localProbeSource(src, input) {
|
|
11999
12118
|
const path = resolveProjectRelativeSrc5(src, input.projectDir, input.compiledDir);
|
|
@@ -12005,7 +12124,7 @@ async function remoteProbeSource(video, input) {
|
|
|
12005
12124
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
12006
12125
|
if (!resolveRestrictPageNetwork()) return video.src;
|
|
12007
12126
|
if (!video.hasAudio || video.hidden) return null;
|
|
12008
|
-
const downloadDir = input.downloadDir ??
|
|
12127
|
+
const downloadDir = input.downloadDir ?? join25(input.compiledDir, REMOTE_MEDIA_SUBDIR);
|
|
12009
12128
|
try {
|
|
12010
12129
|
return await downloadToTemp2(video.src, downloadDir, void 0, input.signal, void 0, {
|
|
12011
12130
|
onTelemetry: writeUrlDownloadTelemetry2
|
|
@@ -12046,7 +12165,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
12046
12165
|
}
|
|
12047
12166
|
|
|
12048
12167
|
// src/services/render/videoLayerPassthroughPlan.ts
|
|
12049
|
-
import { existsSync as
|
|
12168
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
12050
12169
|
import {
|
|
12051
12170
|
buildVideoLayerInput,
|
|
12052
12171
|
isHttpUrl as isHttpUrl4,
|
|
@@ -12114,7 +12233,7 @@ async function planVideoLayerPassthrough(input) {
|
|
|
12114
12233
|
const { video } = q;
|
|
12115
12234
|
if (isHttpUrl4(video.src)) return { reason: "remote_source" };
|
|
12116
12235
|
const path = resolveProjectRelativeSrc6(video.src, input.projectDir, input.compiledDir);
|
|
12117
|
-
if (!
|
|
12236
|
+
if (!existsSync15(path)) return { reason: "source_missing" };
|
|
12118
12237
|
const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
|
|
12119
12238
|
if ("reason" in layout) return layout;
|
|
12120
12239
|
const layer = await buildVideoLayerInput(
|
|
@@ -12129,8 +12248,8 @@ async function planVideoLayerPassthrough(input) {
|
|
|
12129
12248
|
}
|
|
12130
12249
|
|
|
12131
12250
|
// src/services/render/stages/audioStage.ts
|
|
12132
|
-
import { existsSync as
|
|
12133
|
-
import { join as
|
|
12251
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
12252
|
+
import { join as join28 } from "node:path";
|
|
12134
12253
|
import {
|
|
12135
12254
|
MIXED_AUDIO_FILENAME,
|
|
12136
12255
|
audioFailureDiagnostics,
|
|
@@ -12141,8 +12260,8 @@ import {
|
|
|
12141
12260
|
} from "@hyperframes/engine";
|
|
12142
12261
|
|
|
12143
12262
|
// src/services/render/audioDeliveryLimit.ts
|
|
12144
|
-
import { existsSync as
|
|
12145
|
-
import { dirname as
|
|
12263
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
12264
|
+
import { dirname as dirname12, join as join27 } from "node:path";
|
|
12146
12265
|
import {
|
|
12147
12266
|
applyAudioFxChain,
|
|
12148
12267
|
describeFfmpegFailure as describeFfmpegFailure3,
|
|
@@ -12153,7 +12272,7 @@ import {
|
|
|
12153
12272
|
// src/services/render/audioPadTrim.ts
|
|
12154
12273
|
import { localContainerInputArgs } from "@hyperframes/parsers/ff-binaries";
|
|
12155
12274
|
import { spawn } from "node:child_process";
|
|
12156
|
-
import { dirname as
|
|
12275
|
+
import { dirname as dirname11, join as join26 } from "node:path";
|
|
12157
12276
|
import {
|
|
12158
12277
|
DEFAULT_CONFIG,
|
|
12159
12278
|
describeFfmpegFailure as describeFfmpegFailure2,
|
|
@@ -12434,7 +12553,7 @@ async function constrainAacTruePeak(input) {
|
|
|
12434
12553
|
}
|
|
12435
12554
|
async function cutSource(input, scratchDir, attenuationDb) {
|
|
12436
12555
|
if (!input.sourcePath || !input.rewriteSource) return true;
|
|
12437
|
-
const cutPath =
|
|
12556
|
+
const cutPath = join26(scratchDir, "source.wav");
|
|
12438
12557
|
try {
|
|
12439
12558
|
const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
|
|
12440
12559
|
if (!result.success) throw new Error(result.error);
|
|
@@ -12448,8 +12567,8 @@ async function cutSource(input, scratchDir, attenuationDb) {
|
|
|
12448
12567
|
async function enforceAacTruePeak(input) {
|
|
12449
12568
|
let scratchDir;
|
|
12450
12569
|
try {
|
|
12451
|
-
scratchDir = createStagingDir3(
|
|
12452
|
-
const correctedPath =
|
|
12570
|
+
scratchDir = createStagingDir3(dirname11(input.audioPath), ".true-peak-");
|
|
12571
|
+
const correctedPath = join26(scratchDir, "audio.m4a");
|
|
12453
12572
|
const measurements = [];
|
|
12454
12573
|
let attenuationDb = 0;
|
|
12455
12574
|
let sourcePeakDbfs;
|
|
@@ -12665,14 +12784,14 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
12665
12784
|
applyChain: applyAudioFxChain,
|
|
12666
12785
|
encode: encodeAac2,
|
|
12667
12786
|
rename: renameWithRetry5,
|
|
12668
|
-
sourceExists:
|
|
12787
|
+
sourceExists: existsSync16
|
|
12669
12788
|
}) {
|
|
12670
12789
|
const { audioPath, sourcePath, signal, timeoutMs } = input;
|
|
12671
12790
|
if (!deps.sourceExists(sourcePath)) return { success: true };
|
|
12672
12791
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
12673
12792
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
12674
12793
|
const alternating = ["a", "b"].map(
|
|
12675
|
-
(k) =>
|
|
12794
|
+
(k) => join27(dirname12(sourcePath), `audio-source-limited-${k}.wav`)
|
|
12676
12795
|
);
|
|
12677
12796
|
let encodedFrom;
|
|
12678
12797
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -12745,7 +12864,7 @@ function runAudioStage(input) {
|
|
|
12745
12864
|
}
|
|
12746
12865
|
async function runAudioStageScoped(input) {
|
|
12747
12866
|
const stageStart = Date.now();
|
|
12748
|
-
const pcmSourcePath =
|
|
12867
|
+
const pcmSourcePath = join28(input.workDir, "audio-source.wav");
|
|
12749
12868
|
const duration = input.totalFrames * input.fps.den / input.fps.num;
|
|
12750
12869
|
let deliverySourcePath;
|
|
12751
12870
|
try {
|
|
@@ -12761,7 +12880,7 @@ async function runAudioStageScoped(input) {
|
|
|
12761
12880
|
);
|
|
12762
12881
|
audioLoweredDb = guard.loweredDb;
|
|
12763
12882
|
input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
|
|
12764
|
-
if (input.keepDeliverySource && !guard.sourceStale &&
|
|
12883
|
+
if (input.keepDeliverySource && !guard.sourceStale && existsSync17(pcmSourcePath)) {
|
|
12765
12884
|
deliverySourcePath = pcmSourcePath;
|
|
12766
12885
|
}
|
|
12767
12886
|
}
|
|
@@ -12810,7 +12929,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
12810
12929
|
assertNotAborted,
|
|
12811
12930
|
log
|
|
12812
12931
|
} = input;
|
|
12813
|
-
const audioOutputPath =
|
|
12932
|
+
const audioOutputPath = join28(workDir, MIXED_AUDIO_FILENAME);
|
|
12814
12933
|
let hasAudio = false;
|
|
12815
12934
|
let audioError;
|
|
12816
12935
|
let audioFailures;
|
|
@@ -12890,8 +13009,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
12890
13009
|
}
|
|
12891
13010
|
|
|
12892
13011
|
// src/services/render/stages/captureStage.ts
|
|
12893
|
-
import { existsSync as
|
|
12894
|
-
import { join as
|
|
13012
|
+
import { existsSync as existsSync18, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "node:fs";
|
|
13013
|
+
import { join as join29 } from "node:path";
|
|
12895
13014
|
import {
|
|
12896
13015
|
classifyCaptureFailure as classifyCaptureFailure2,
|
|
12897
13016
|
frameFileExtension,
|
|
@@ -12961,16 +13080,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
|
|
|
12961
13080
|
}
|
|
12962
13081
|
function measureCaptureFrameBytes(workDir, framesDir) {
|
|
12963
13082
|
let total = sampleDirectoryBytes(framesDir);
|
|
12964
|
-
if (!
|
|
13083
|
+
if (!existsSync18(workDir)) return total;
|
|
12965
13084
|
for (const attempt of readdirSync4(workDir)) {
|
|
12966
13085
|
if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
|
|
12967
|
-
total += sampleDirectoryBytes(
|
|
13086
|
+
total += sampleDirectoryBytes(join29(workDir, attempt));
|
|
12968
13087
|
continue;
|
|
12969
13088
|
}
|
|
12970
13089
|
if (!/^capture-attempt-\d+$/.test(attempt)) continue;
|
|
12971
|
-
const attemptDir =
|
|
13090
|
+
const attemptDir = join29(workDir, attempt);
|
|
12972
13091
|
for (const name of readdirSync4(attemptDir)) {
|
|
12973
|
-
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(
|
|
13092
|
+
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join29(attemptDir, name));
|
|
12974
13093
|
}
|
|
12975
13094
|
}
|
|
12976
13095
|
return total;
|
|
@@ -13268,8 +13387,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
13268
13387
|
}
|
|
13269
13388
|
|
|
13270
13389
|
// src/services/render/stages/captureHdrStage.ts
|
|
13271
|
-
import { existsSync as
|
|
13272
|
-
import { join as
|
|
13390
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync10 } from "node:fs";
|
|
13391
|
+
import { join as join33 } from "node:path";
|
|
13273
13392
|
import {
|
|
13274
13393
|
closeCaptureSession as closeCaptureSession7,
|
|
13275
13394
|
cloneCaptureWarnings as cloneCaptureWarnings2,
|
|
@@ -13341,7 +13460,7 @@ function createHdrImageTransferCache(options = {}) {
|
|
|
13341
13460
|
}
|
|
13342
13461
|
|
|
13343
13462
|
// src/services/render/stages/captureHdrSequentialLoop.ts
|
|
13344
|
-
import { join as
|
|
13463
|
+
import { join as join30 } from "node:path";
|
|
13345
13464
|
import {
|
|
13346
13465
|
TRANSITIONS,
|
|
13347
13466
|
crossfade
|
|
@@ -13466,7 +13585,7 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
13466
13585
|
);
|
|
13467
13586
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
13468
13587
|
writeFileExclusiveSync(
|
|
13469
|
-
|
|
13588
|
+
join30(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
13470
13589
|
normalCanvas
|
|
13471
13590
|
);
|
|
13472
13591
|
}
|
|
@@ -13498,7 +13617,7 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
13498
13617
|
}
|
|
13499
13618
|
|
|
13500
13619
|
// src/services/render/stages/captureHdrHybridLoop.ts
|
|
13501
|
-
import { join as
|
|
13620
|
+
import { join as join32 } from "node:path";
|
|
13502
13621
|
import {
|
|
13503
13622
|
TRANSITIONS as TRANSITIONS2,
|
|
13504
13623
|
closeCaptureSession as closeCaptureSession6,
|
|
@@ -13510,12 +13629,12 @@ import {
|
|
|
13510
13629
|
} from "@hyperframes/engine";
|
|
13511
13630
|
|
|
13512
13631
|
// src/services/shaderTransitionWorkerPool.ts
|
|
13513
|
-
import { Worker } from "node:worker_threads";
|
|
13514
|
-
import { fileURLToPath as
|
|
13515
|
-
import { dirname as
|
|
13632
|
+
import { Worker as Worker2 } from "node:worker_threads";
|
|
13633
|
+
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
|
|
13634
|
+
import { dirname as dirname13, join as join31 } from "node:path";
|
|
13516
13635
|
import { createRequire } from "node:module";
|
|
13517
13636
|
import { usableCpuCount } from "@hyperframes/engine";
|
|
13518
|
-
import { existsSync as
|
|
13637
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
13519
13638
|
function resolveWorkerEntry(explicit) {
|
|
13520
13639
|
if (explicit && explicit.length > 0) {
|
|
13521
13640
|
return { path: explicit, isTs: explicit.endsWith(".ts") };
|
|
@@ -13525,10 +13644,10 @@ function resolveWorkerEntry(explicit) {
|
|
|
13525
13644
|
const isTs = override.endsWith(".ts");
|
|
13526
13645
|
return { path: override, isTs };
|
|
13527
13646
|
}
|
|
13528
|
-
const moduleDir =
|
|
13529
|
-
const jsPath =
|
|
13530
|
-
if (
|
|
13531
|
-
const tsPath =
|
|
13647
|
+
const moduleDir = dirname13(fileURLToPath4(import.meta.url));
|
|
13648
|
+
const jsPath = join31(moduleDir, "shaderTransitionWorker.js");
|
|
13649
|
+
if (existsSync19(jsPath)) return { path: jsPath, isTs: false };
|
|
13650
|
+
const tsPath = join31(moduleDir, "shaderTransitionWorker.ts");
|
|
13532
13651
|
return { path: tsPath, isTs: true };
|
|
13533
13652
|
}
|
|
13534
13653
|
function buildExecArgv(entryIsTs) {
|
|
@@ -13649,7 +13768,7 @@ async function createShaderTransitionWorkerPool(opts) {
|
|
|
13649
13768
|
};
|
|
13650
13769
|
try {
|
|
13651
13770
|
for (let i = 0; i < size; i++) {
|
|
13652
|
-
const worker = new
|
|
13771
|
+
const worker = new Worker2(entry, { execArgv });
|
|
13653
13772
|
const slot = { worker, busy: false, current: null, dead: false };
|
|
13654
13773
|
worker.on("message", (msg) => onWorkerMessage(slot, msg));
|
|
13655
13774
|
worker.on(
|
|
@@ -13896,7 +14015,7 @@ async function runHybridLayeredFrameLoop(input) {
|
|
|
13896
14015
|
);
|
|
13897
14016
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
13898
14017
|
writeFileExclusiveSync(
|
|
13899
|
-
|
|
14018
|
+
join32(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
13900
14019
|
canvas
|
|
13901
14020
|
);
|
|
13902
14021
|
}
|
|
@@ -14092,8 +14211,8 @@ async function runCaptureHdrStage(input) {
|
|
|
14092
14211
|
if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
|
|
14093
14212
|
}
|
|
14094
14213
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
14095
|
-
const debugDumpDir = debugDumpEnabled ?
|
|
14096
|
-
if (debugDumpDir && !
|
|
14214
|
+
const debugDumpDir = debugDumpEnabled ? join33(framesDir, "debug-composite") : null;
|
|
14215
|
+
if (debugDumpDir && !existsSync20(debugDumpDir)) {
|
|
14097
14216
|
mkdirSync10(debugDumpDir, { recursive: true });
|
|
14098
14217
|
}
|
|
14099
14218
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
@@ -14252,7 +14371,7 @@ async function runCaptureHdrStage(input) {
|
|
|
14252
14371
|
// src/services/render/stages/encodeStage.ts
|
|
14253
14372
|
import {
|
|
14254
14373
|
copyFileSync as copyFileSync4,
|
|
14255
|
-
existsSync as
|
|
14374
|
+
existsSync as existsSync21,
|
|
14256
14375
|
mkdirSync as mkdirSync11,
|
|
14257
14376
|
readdirSync as readdirSync5,
|
|
14258
14377
|
readFileSync as readFileSync9,
|
|
@@ -14261,7 +14380,7 @@ import {
|
|
|
14261
14380
|
writeFileSync as writeFileSync5
|
|
14262
14381
|
} from "node:fs";
|
|
14263
14382
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
14264
|
-
import { dirname as
|
|
14383
|
+
import { dirname as dirname14, join as join34 } from "node:path";
|
|
14265
14384
|
import {
|
|
14266
14385
|
encodeFramesChunkedConcat,
|
|
14267
14386
|
encodeFramesFromDir,
|
|
@@ -14386,7 +14505,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
14386
14505
|
const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
|
|
14387
14506
|
if (failure) return failure;
|
|
14388
14507
|
}
|
|
14389
|
-
const fileSize =
|
|
14508
|
+
const fileSize = existsSync21(outputPath) ? statSync9(outputPath).size : 0;
|
|
14390
14509
|
return {
|
|
14391
14510
|
success: true,
|
|
14392
14511
|
outputPath,
|
|
@@ -14480,7 +14599,7 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
14480
14599
|
await new Promise((resolve12) => wake = resolve12);
|
|
14481
14600
|
}
|
|
14482
14601
|
if (signal.aborted) return;
|
|
14483
|
-
const mergedPath =
|
|
14602
|
+
const mergedPath = join34(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
14484
14603
|
const frame = await readLandedFrame(landed.get(next), mergedPath);
|
|
14485
14604
|
landed.delete(next);
|
|
14486
14605
|
if (!await stream.writeFrame(frame)) {
|
|
@@ -14555,7 +14674,7 @@ async function runEncodeStage(input) {
|
|
|
14555
14674
|
const stage5Start = Date.now();
|
|
14556
14675
|
if (isPngSequence) {
|
|
14557
14676
|
const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
|
|
14558
|
-
if (!
|
|
14677
|
+
if (!existsSync21(outputPath)) mkdirSync11(outputPath, { recursive: true });
|
|
14559
14678
|
const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
14560
14679
|
if (captured.length === 0) {
|
|
14561
14680
|
throw new Error(
|
|
@@ -14563,11 +14682,11 @@ async function runEncodeStage(input) {
|
|
|
14563
14682
|
);
|
|
14564
14683
|
}
|
|
14565
14684
|
captured.forEach((name, i) => {
|
|
14566
|
-
const dst =
|
|
14567
|
-
copyFileSync4(
|
|
14685
|
+
const dst = join34(outputPath, formatExportFrameName(i, "png"));
|
|
14686
|
+
copyFileSync4(join34(framesDir, name), dst);
|
|
14568
14687
|
});
|
|
14569
|
-
if (hasAudio && audioOutputPath &&
|
|
14570
|
-
copyFileSync4(audioOutputPath,
|
|
14688
|
+
if (hasAudio && audioOutputPath && existsSync21(audioOutputPath)) {
|
|
14689
|
+
copyFileSync4(audioOutputPath, join34(outputPath, MIXED_AUDIO_FILENAME2));
|
|
14571
14690
|
log.info(
|
|
14572
14691
|
`[Render] png-sequence: ${MIXED_AUDIO_FILENAME2} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME2}`
|
|
14573
14692
|
);
|
|
@@ -14587,7 +14706,7 @@ async function runEncodeStage(input) {
|
|
|
14587
14706
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
14588
14707
|
fps: job.config.fps,
|
|
14589
14708
|
loop,
|
|
14590
|
-
palettePath:
|
|
14709
|
+
palettePath: join34(dirname14(videoOnlyPath), "gif-palette.png"),
|
|
14591
14710
|
preserveAlpha: needsAlpha,
|
|
14592
14711
|
signal: abortSignal,
|
|
14593
14712
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -14798,7 +14917,7 @@ function sampleDirectoryBytes(dir) {
|
|
|
14798
14917
|
continue;
|
|
14799
14918
|
}
|
|
14800
14919
|
for (const name of entries) {
|
|
14801
|
-
const full =
|
|
14920
|
+
const full = join35(current, name);
|
|
14802
14921
|
try {
|
|
14803
14922
|
const st = statSync10(full);
|
|
14804
14923
|
if (st.isDirectory()) {
|
|
@@ -14956,8 +15075,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
14956
15075
|
const ranges = [];
|
|
14957
15076
|
let rangeStart = null;
|
|
14958
15077
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
14959
|
-
const framePath =
|
|
14960
|
-
const missing = !
|
|
15078
|
+
const framePath = join35(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
15079
|
+
const missing = !existsSync22(framePath) || statSync10(framePath).size <= 8;
|
|
14961
15080
|
if (missing && rangeStart === null) {
|
|
14962
15081
|
rangeStart = frameIndex;
|
|
14963
15082
|
} else if (!missing && rangeStart !== null) {
|
|
@@ -14973,7 +15092,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
14973
15092
|
function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
|
|
14974
15093
|
const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
|
|
14975
15094
|
const batches = [];
|
|
14976
|
-
const outputDirFor = (batchIndex, workerId) =>
|
|
15095
|
+
const outputDirFor = (batchIndex, workerId) => join35(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
|
|
14977
15096
|
if (stride > 1) {
|
|
14978
15097
|
const spans = /* @__PURE__ */ new Map();
|
|
14979
15098
|
for (const range of ranges) {
|
|
@@ -15033,8 +15152,8 @@ function getNextRetryWorkerCount(currentWorkers) {
|
|
|
15033
15152
|
return Math.max(1, Math.floor(currentWorkers / 2));
|
|
15034
15153
|
}
|
|
15035
15154
|
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir3()) {
|
|
15036
|
-
if (platform2 === "win32" || platform2 === "darwin") return
|
|
15037
|
-
return
|
|
15155
|
+
if (platform2 === "win32" || platform2 === "darwin") return join35(systemTempDir, "hf-render-");
|
|
15156
|
+
return join35(dirname15(outputPath), `work-${jobId}-`);
|
|
15038
15157
|
}
|
|
15039
15158
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
15040
15159
|
function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
|
|
@@ -15089,8 +15208,8 @@ The composition is too large for the available memory. To reduce memory pressure
|
|
|
15089
15208
|
function countCapturedFrames(totalFrames, framesDir, frameExt) {
|
|
15090
15209
|
let captured = 0;
|
|
15091
15210
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
15092
|
-
const framePath =
|
|
15093
|
-
if (
|
|
15211
|
+
const framePath = join35(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
15212
|
+
if (existsSync22(framePath)) captured++;
|
|
15094
15213
|
}
|
|
15095
15214
|
return captured;
|
|
15096
15215
|
}
|
|
@@ -15115,7 +15234,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
15115
15234
|
reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
|
|
15116
15235
|
});
|
|
15117
15236
|
pendingTransientRetry = false;
|
|
15118
|
-
const attemptWorkDir =
|
|
15237
|
+
const attemptWorkDir = join35(options.workDir, `capture-attempt-${attempt}`);
|
|
15119
15238
|
const batches = missingRanges ? buildMissingFrameRetryBatches(
|
|
15120
15239
|
missingRanges,
|
|
15121
15240
|
currentWorkers,
|
|
@@ -15762,20 +15881,20 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
15762
15881
|
};
|
|
15763
15882
|
}
|
|
15764
15883
|
function resolveRenderDebugDir() {
|
|
15765
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve9(process.env.PRODUCER_RENDERS_DIR, "..") : resolve9(
|
|
15766
|
-
return
|
|
15884
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve9(process.env.PRODUCER_RENDERS_DIR, "..") : resolve9(dirname15(fileURLToPath5(import.meta.url)), "../..");
|
|
15885
|
+
return join35(producerRoot, ".debug");
|
|
15767
15886
|
}
|
|
15768
15887
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
15769
15888
|
validateHlsRenderConfig(job.config);
|
|
15770
15889
|
validateDeliveryEncoderConfig(job.config);
|
|
15771
15890
|
validateChromaSubsamplingConfig(job.config);
|
|
15772
15891
|
const debugDir = resolveRenderDebugDir();
|
|
15773
|
-
const outputDir =
|
|
15774
|
-
if (!
|
|
15775
|
-
const workDir = job.config.debug ?
|
|
15892
|
+
const outputDir = dirname15(outputPath);
|
|
15893
|
+
if (!existsSync22(outputDir)) mkdirSync12(outputDir, { recursive: true });
|
|
15894
|
+
const workDir = job.config.debug ? join35(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
|
|
15776
15895
|
const pipelineStart = Date.now();
|
|
15777
15896
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
15778
|
-
const logPath = job.config.debug ?
|
|
15897
|
+
const logPath = job.config.debug ? join35(workDir, "render.log") : null;
|
|
15779
15898
|
const execution = new RenderExecutionContext({
|
|
15780
15899
|
request: { renderJobId: job.id, projectDir, outputPath },
|
|
15781
15900
|
logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
|
|
@@ -15852,7 +15971,7 @@ async function executeRenderPipeline(input) {
|
|
|
15852
15971
|
imageDecodeFailures: 0
|
|
15853
15972
|
};
|
|
15854
15973
|
let hdrPerf;
|
|
15855
|
-
const perfOutputPath =
|
|
15974
|
+
const perfOutputPath = join35(workDir, "perf-summary.json");
|
|
15856
15975
|
const cfg = { ...job.config.producerConfig ?? resolveConfig2() };
|
|
15857
15976
|
const observability = new RenderObservabilityRecorder({
|
|
15858
15977
|
pipelineStartMs: pipelineStart,
|
|
@@ -15928,7 +16047,7 @@ async function executeRenderPipeline(input) {
|
|
|
15928
16047
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
15929
16048
|
assertNotAborted();
|
|
15930
16049
|
assertConfiguredFfmpegBinariesExist();
|
|
15931
|
-
if (!
|
|
16050
|
+
if (!existsSync22(workDir)) mkdirSync12(workDir, { recursive: true });
|
|
15932
16051
|
if (job.config.debug) {
|
|
15933
16052
|
log.info("[Render] Debug artifacts enabled", { workDir, logPath });
|
|
15934
16053
|
}
|
|
@@ -15957,8 +16076,8 @@ async function executeRenderPipeline(input) {
|
|
|
15957
16076
|
requestedWorkers: job.config.workers ?? "auto"
|
|
15958
16077
|
});
|
|
15959
16078
|
const entryFile = job.config.entryFile || "index.html";
|
|
15960
|
-
const htmlPath =
|
|
15961
|
-
if (!
|
|
16079
|
+
const htmlPath = join35(projectDir, entryFile);
|
|
16080
|
+
if (!existsSync22(htmlPath)) {
|
|
15962
16081
|
throw new Error(`Entry file not found: ${htmlPath}`);
|
|
15963
16082
|
}
|
|
15964
16083
|
assertNotAborted();
|
|
@@ -16055,7 +16174,7 @@ async function executeRenderPipeline(input) {
|
|
|
16055
16174
|
const largerThanCanvas = await oversizedVideos(
|
|
16056
16175
|
composition.videos,
|
|
16057
16176
|
projectDir,
|
|
16058
|
-
|
|
16177
|
+
join35(workDir, "compiled"),
|
|
16059
16178
|
{ width: outputWidth, height: outputHeight }
|
|
16060
16179
|
);
|
|
16061
16180
|
const probeResult = await observeRenderStage(
|
|
@@ -16152,7 +16271,7 @@ async function executeRenderPipeline(input) {
|
|
|
16152
16271
|
canvas: { width, height },
|
|
16153
16272
|
page: probeSession.page,
|
|
16154
16273
|
projectDir,
|
|
16155
|
-
compiledDir:
|
|
16274
|
+
compiledDir: join35(workDir, "compiled")
|
|
16156
16275
|
});
|
|
16157
16276
|
if (videoLayerPlan.videoId === void 0) {
|
|
16158
16277
|
log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
|
|
@@ -16170,7 +16289,7 @@ async function executeRenderPipeline(input) {
|
|
|
16170
16289
|
updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
|
|
16171
16290
|
code: "extract_video"
|
|
16172
16291
|
});
|
|
16173
|
-
const compiledDir =
|
|
16292
|
+
const compiledDir = join35(workDir, "compiled");
|
|
16174
16293
|
const segmentsCapture = (layeredOrEffectRoute) => shouldSegmentCapture({
|
|
16175
16294
|
env: process.env,
|
|
16176
16295
|
durationSeconds: probeResult.duration,
|
|
@@ -16311,7 +16430,7 @@ async function executeRenderPipeline(input) {
|
|
|
16311
16430
|
try {
|
|
16312
16431
|
fileServer = await createFileServer({
|
|
16313
16432
|
projectDir,
|
|
16314
|
-
compiledDir:
|
|
16433
|
+
compiledDir: join35(workDir, "compiled"),
|
|
16315
16434
|
port: 0,
|
|
16316
16435
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
16317
16436
|
fps: job.config.fps,
|
|
@@ -16331,8 +16450,8 @@ async function executeRenderPipeline(input) {
|
|
|
16331
16450
|
if (!activeFileServer) {
|
|
16332
16451
|
throw new Error("File server failed to initialize before frame capture");
|
|
16333
16452
|
}
|
|
16334
|
-
const framesDir =
|
|
16335
|
-
if (!
|
|
16453
|
+
const framesDir = join35(workDir, "captured-frames");
|
|
16454
|
+
if (!existsSync22(framesDir)) mkdirSync12(framesDir, { recursive: true });
|
|
16336
16455
|
updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
|
|
16337
16456
|
code: "start_browsers"
|
|
16338
16457
|
});
|
|
@@ -16912,7 +17031,7 @@ async function executeRenderPipeline(input) {
|
|
|
16912
17031
|
hls: ".mp4"
|
|
16913
17032
|
};
|
|
16914
17033
|
const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
|
|
16915
|
-
const videoOnlyPath =
|
|
17034
|
+
const videoOnlyPath = join35(workDir, `video-only${videoExt}`);
|
|
16916
17035
|
let usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
|
|
16917
17036
|
if (usePageSideCompositingForTransitions) {
|
|
16918
17037
|
activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
|
|
@@ -17774,7 +17893,7 @@ async function executeRenderPipeline(input) {
|
|
|
17774
17893
|
})
|
|
17775
17894
|
);
|
|
17776
17895
|
const totalElapsed = Date.now() - pipelineStart;
|
|
17777
|
-
const tmpPeakBytes =
|
|
17896
|
+
const tmpPeakBytes = existsSync22(workDir) ? sampleDirectoryBytes(workDir) : 0;
|
|
17778
17897
|
recordTransientRetryObservability();
|
|
17779
17898
|
observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
|
|
17780
17899
|
const observabilitySummary = observability.summary({
|
|
@@ -17855,8 +17974,8 @@ async function executeRenderPipeline(input) {
|
|
|
17855
17974
|
}
|
|
17856
17975
|
}
|
|
17857
17976
|
if (job.config.debug) {
|
|
17858
|
-
if (!isPngSequence && !isHls &&
|
|
17859
|
-
const debugOutput =
|
|
17977
|
+
if (!isPngSequence && !isHls && existsSync22(stagedOutputPath)) {
|
|
17978
|
+
const debugOutput = join35(workDir, `output${videoExt}`);
|
|
17860
17979
|
copyFileSync5(stagedOutputPath, debugOutput);
|
|
17861
17980
|
}
|
|
17862
17981
|
}
|
|
@@ -17971,7 +18090,7 @@ async function executeRenderPipeline(input) {
|
|
|
17971
18090
|
|
|
17972
18091
|
// src/services/hyperframeLint.ts
|
|
17973
18092
|
import {
|
|
17974
|
-
existsSync as
|
|
18093
|
+
existsSync as existsSync23,
|
|
17975
18094
|
readFileSync as readFileSync10,
|
|
17976
18095
|
statSync as statSync11,
|
|
17977
18096
|
openSync as openSync6,
|
|
@@ -17979,9 +18098,9 @@ import {
|
|
|
17979
18098
|
closeSync as closeSync6,
|
|
17980
18099
|
constants as constants4
|
|
17981
18100
|
} from "node:fs";
|
|
17982
|
-
import { resolve as resolve10, join as
|
|
17983
|
-
import { fileURLToPath as
|
|
17984
|
-
import { Worker as
|
|
18101
|
+
import { resolve as resolve10, join as join36, relative as relative5, isAbsolute as isAbsolute4, sep as sep5, dirname as dirname16 } from "node:path";
|
|
18102
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
18103
|
+
import { Worker as Worker3 } from "node:worker_threads";
|
|
17985
18104
|
function isStringRecord(value) {
|
|
17986
18105
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
17987
18106
|
return false;
|
|
@@ -18030,7 +18149,7 @@ function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
|
|
|
18030
18149
|
}
|
|
18031
18150
|
function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
18032
18151
|
const absProjectDir = resolve10(projectDir);
|
|
18033
|
-
if (!
|
|
18152
|
+
if (!existsSync23(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
18034
18153
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
18035
18154
|
}
|
|
18036
18155
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
@@ -18051,7 +18170,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
|
18051
18170
|
}
|
|
18052
18171
|
}
|
|
18053
18172
|
return {
|
|
18054
|
-
error: `No HTML entry file found in project directory: ${
|
|
18173
|
+
error: `No HTML entry file found in project directory: ${join36(absProjectDir, preferredEntryFile || "index.html")}`
|
|
18055
18174
|
};
|
|
18056
18175
|
}
|
|
18057
18176
|
function prepareHyperframeLintBody(body, isAllowedEntry) {
|
|
@@ -18118,10 +18237,10 @@ function freeLintSlot() {
|
|
|
18118
18237
|
waiting.shift()?.();
|
|
18119
18238
|
}
|
|
18120
18239
|
function resolveLintWorkerEntry() {
|
|
18121
|
-
const here =
|
|
18240
|
+
const here = dirname16(fileURLToPath6(import.meta.url));
|
|
18122
18241
|
for (const name of ["hyperframeLintWorker.js", "hyperframeLintWorker.ts"]) {
|
|
18123
|
-
const candidate =
|
|
18124
|
-
if (
|
|
18242
|
+
const candidate = join36(here, name);
|
|
18243
|
+
if (existsSync23(candidate)) return candidate;
|
|
18125
18244
|
}
|
|
18126
18245
|
return void 0;
|
|
18127
18246
|
}
|
|
@@ -18154,7 +18273,7 @@ async function runHyperframeLint(prepared, options = {}) {
|
|
|
18154
18273
|
return new Promise((resolvePromise, reject) => {
|
|
18155
18274
|
let worker;
|
|
18156
18275
|
try {
|
|
18157
|
-
worker = new
|
|
18276
|
+
worker = new Worker3(entry, {
|
|
18158
18277
|
workerData: {
|
|
18159
18278
|
html: prepared.html,
|
|
18160
18279
|
opts: { filePath: prepared.entryFile, compSrcPath: prepared.entryFile }
|
|
@@ -18189,10 +18308,10 @@ async function runHyperframeLint(prepared, options = {}) {
|
|
|
18189
18308
|
}
|
|
18190
18309
|
|
|
18191
18310
|
// src/services/healthWorker.ts
|
|
18192
|
-
import { Worker as
|
|
18193
|
-
import { fileURLToPath as
|
|
18194
|
-
import { dirname as
|
|
18195
|
-
import { existsSync as
|
|
18311
|
+
import { Worker as Worker4 } from "node:worker_threads";
|
|
18312
|
+
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
18313
|
+
import { dirname as dirname17, join as join37 } from "node:path";
|
|
18314
|
+
import { existsSync as existsSync24 } from "node:fs";
|
|
18196
18315
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
18197
18316
|
async function startHealthWorker(options = {}) {
|
|
18198
18317
|
const log = options.logger ?? defaultLogger2();
|
|
@@ -18203,7 +18322,7 @@ async function startHealthWorker(options = {}) {
|
|
|
18203
18322
|
"[healthWorker] could not resolve worker entry. Pass options.workerEntry or ensure healthWorkerThread.{js,ts} is co-located."
|
|
18204
18323
|
);
|
|
18205
18324
|
}
|
|
18206
|
-
const worker = new
|
|
18325
|
+
const worker = new Worker4(entry, {
|
|
18207
18326
|
workerData: { port },
|
|
18208
18327
|
// Keep stdio inherited so the worker's console logs land in the pod logs
|
|
18209
18328
|
// alongside the main thread's.
|
|
@@ -18266,10 +18385,10 @@ function defaultLogger2() {
|
|
|
18266
18385
|
};
|
|
18267
18386
|
}
|
|
18268
18387
|
function resolveWorkerEntry2() {
|
|
18269
|
-
const here =
|
|
18270
|
-
const candidates = [
|
|
18388
|
+
const here = dirname17(fileURLToPath7(import.meta.url));
|
|
18389
|
+
const candidates = [join37(here, "healthWorkerThread.js"), join37(here, "healthWorkerThread.ts")];
|
|
18271
18390
|
for (const candidate of candidates) {
|
|
18272
|
-
if (
|
|
18391
|
+
if (existsSync24(candidate)) return candidate;
|
|
18273
18392
|
}
|
|
18274
18393
|
return void 0;
|
|
18275
18394
|
}
|
|
@@ -18309,7 +18428,7 @@ import {
|
|
|
18309
18428
|
createReferenceBackgroundRecorder as createReferenceBackgroundRecorder2
|
|
18310
18429
|
} from "@hyperframes/engine";
|
|
18311
18430
|
import { audioFailureDiagnostics as audioFailureDiagnostics3 } from "@hyperframes/engine";
|
|
18312
|
-
import { extname as extname4, isAbsolute as isAbsolute5, join as
|
|
18431
|
+
import { extname as extname4, isAbsolute as isAbsolute5, join as join39, relative as relative6, sep as sep6 } from "node:path";
|
|
18313
18432
|
import {
|
|
18314
18433
|
fpsToNumber as fpsToNumber9,
|
|
18315
18434
|
HF_COLOR_GRADING_ATTR as HF_COLOR_GRADING_ATTR2
|
|
@@ -18342,9 +18461,9 @@ import {
|
|
|
18342
18461
|
|
|
18343
18462
|
// src/services/distributed/shared.ts
|
|
18344
18463
|
import { execFile as execFileCallback } from "node:child_process";
|
|
18345
|
-
import { dirname as
|
|
18346
|
-
import { existsSync as
|
|
18347
|
-
import { fileURLToPath as
|
|
18464
|
+
import { dirname as dirname18, join as join38 } from "node:path";
|
|
18465
|
+
import { existsSync as existsSync25, readFileSync as readFileSync11 } from "node:fs";
|
|
18466
|
+
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
18348
18467
|
import { promisify as promisify2 } from "node:util";
|
|
18349
18468
|
import {
|
|
18350
18469
|
getFfmpegBinary,
|
|
@@ -18355,11 +18474,11 @@ var execFile = promisify2(execFileCallback);
|
|
|
18355
18474
|
var cachedProducerVersion = null;
|
|
18356
18475
|
function readProducerVersion() {
|
|
18357
18476
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
18358
|
-
const startDir =
|
|
18477
|
+
const startDir = dirname18(fileURLToPath8(import.meta.url));
|
|
18359
18478
|
let current = startDir;
|
|
18360
18479
|
for (let i = 0; i < 10; i++) {
|
|
18361
|
-
const candidate =
|
|
18362
|
-
if (
|
|
18480
|
+
const candidate = join38(current, "package.json");
|
|
18481
|
+
if (existsSync25(candidate)) {
|
|
18363
18482
|
try {
|
|
18364
18483
|
const pkg = JSON.parse(readFileSync11(candidate, "utf-8"));
|
|
18365
18484
|
if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
|
|
@@ -18369,7 +18488,7 @@ function readProducerVersion() {
|
|
|
18369
18488
|
} catch {
|
|
18370
18489
|
}
|
|
18371
18490
|
}
|
|
18372
|
-
const parent =
|
|
18491
|
+
const parent = dirname18(current);
|
|
18373
18492
|
if (parent === current) break;
|
|
18374
18493
|
current = parent;
|
|
18375
18494
|
}
|
|
@@ -18456,9 +18575,9 @@ var PLAN_ROOT_CATEGORY = {
|
|
|
18456
18575
|
var PLAN_DIR_SIZE_LIMIT_BYTES = 2 * 1024 * 1024 * 1024;
|
|
18457
18576
|
var FREEZE_OWNED_PLAN_FILES = [
|
|
18458
18577
|
"plan.json",
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18578
|
+
join39("meta", "composition.json"),
|
|
18579
|
+
join39("meta", "encoder.json"),
|
|
18580
|
+
join39("meta", "chunks.json")
|
|
18462
18581
|
];
|
|
18463
18582
|
|
|
18464
18583
|
// src/services/distributed/renderConfigValidation.ts
|
|
@@ -18719,7 +18838,8 @@ var SAFE_RENDER_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
18719
18838
|
"PAGE_NEVER_READY",
|
|
18720
18839
|
"VARIABLES_INVALID",
|
|
18721
18840
|
"OUTPUT_DIMENSIONS_MISMATCH",
|
|
18722
|
-
"COMPOSITION_TOO_LARGE"
|
|
18841
|
+
"COMPOSITION_TOO_LARGE",
|
|
18842
|
+
"COMPILE_TIMEOUT"
|
|
18723
18843
|
]);
|
|
18724
18844
|
function extractSafeRenderErrorCode(error) {
|
|
18725
18845
|
if (typeof error !== "object" || error === null || !("code" in error)) return void 0;
|
|
@@ -18885,8 +19005,8 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
18885
19005
|
throw new Error("outputPath must be inside the renders directory");
|
|
18886
19006
|
}
|
|
18887
19007
|
}
|
|
18888
|
-
const outputDir =
|
|
18889
|
-
if (!
|
|
19008
|
+
const outputDir = dirname19(absoluteOutputPath);
|
|
19009
|
+
if (!existsSync26(outputDir)) mkdirSync13(outputDir, { recursive: true });
|
|
18890
19010
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
18891
19011
|
}
|
|
18892
19012
|
function prepareRenderJob(prepared, rendersDir, log, confineOutput) {
|
|
@@ -18964,12 +19084,12 @@ function prepareProjectDirectory(projectDir, options, policy) {
|
|
|
18964
19084
|
if (!candidate) return null;
|
|
18965
19085
|
const absProjectDir = policy ? resolve11(policy.projectsDir, candidate) : resolve11(candidate);
|
|
18966
19086
|
const shown = policy ? candidate : absProjectDir;
|
|
18967
|
-
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !
|
|
19087
|
+
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync26(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
18968
19088
|
return { error: `Project directory not found: ${shown}` };
|
|
18969
19089
|
}
|
|
18970
19090
|
const entry = options.entryFile || "index.html";
|
|
18971
19091
|
const entryPath = resolve11(absProjectDir, entry);
|
|
18972
|
-
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !
|
|
19092
|
+
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync26(entryPath)) {
|
|
18973
19093
|
return { error: `Entry file "${entry}" not found in project directory: ${shown}` };
|
|
18974
19094
|
}
|
|
18975
19095
|
return { prepared: { input: { projectDir: absProjectDir, ...options } } };
|
|
@@ -18990,8 +19110,8 @@ async function resolveInlineRenderHtml(body) {
|
|
|
18990
19110
|
}
|
|
18991
19111
|
function materializeInlineProject(html, options) {
|
|
18992
19112
|
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir4();
|
|
18993
|
-
const tempProjectDir = mkdtempSync(
|
|
18994
|
-
writeFileSync7(
|
|
19113
|
+
const tempProjectDir = mkdtempSync(join40(tempRoot, "producer-project-"));
|
|
19114
|
+
writeFileSync7(join40(tempProjectDir, "index.html"), html, "utf-8");
|
|
18995
19115
|
return {
|
|
18996
19116
|
prepared: {
|
|
18997
19117
|
input: { projectDir: tempProjectDir, ...options },
|
|
@@ -19067,7 +19187,7 @@ function publicPerfSummary(job) {
|
|
|
19067
19187
|
return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
|
|
19068
19188
|
}
|
|
19069
19189
|
function outputFileSize(path) {
|
|
19070
|
-
return
|
|
19190
|
+
return existsSync26(path) ? statSync12(path).size : 0;
|
|
19071
19191
|
}
|
|
19072
19192
|
function createBlockingProgressReporter(log, requestId) {
|
|
19073
19193
|
let lastLoggedPct = -10;
|
|
@@ -19394,7 +19514,7 @@ function createRenderHandlers(options = {}) {
|
|
|
19394
19514
|
if (!artifact) {
|
|
19395
19515
|
return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
|
|
19396
19516
|
}
|
|
19397
|
-
if (!
|
|
19517
|
+
if (!existsSync26(artifact.path)) {
|
|
19398
19518
|
store.delete(token);
|
|
19399
19519
|
return c.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
19400
19520
|
}
|