@hyperframes/producer 0.9.61 → 0.9.63
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/distributed.js +24 -12
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/index.js +70 -43
- package/dist/public-server.js +67 -40
- package/dist/services/distributed/projectHash.d.ts +7 -8
- package/dist/services/render/stages/encodeStage.d.ts +4 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@hyperframes/engine";
|
|
8
8
|
|
|
9
9
|
// src/services/renderOrchestrator.ts
|
|
10
|
-
import { audioFailureDiagnostics as audioFailureDiagnostics2 } from "@hyperframes/engine";
|
|
10
|
+
import { audioFailureDiagnostics as audioFailureDiagnostics2, usableCpuCount as usableCpuCount2 } from "@hyperframes/engine";
|
|
11
11
|
import {
|
|
12
12
|
existsSync as existsSync21,
|
|
13
13
|
mkdirSync as mkdirSync12,
|
|
@@ -385,7 +385,10 @@ import { Readable } from "node:stream";
|
|
|
385
385
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
386
386
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
387
387
|
import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
388
|
-
import {
|
|
388
|
+
import {
|
|
389
|
+
PREVIEW_FOR_ANOTHER_SITE_META,
|
|
390
|
+
serviceWorkerScriptFetch
|
|
391
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
389
392
|
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
390
393
|
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
391
394
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
@@ -1167,6 +1170,12 @@ function createFileServer(options) {
|
|
|
1167
1170
|
c.res.headers.set("X-Content-Type-Options", "nosniff");
|
|
1168
1171
|
});
|
|
1169
1172
|
answerOwnLoopbackHostOnly(app, () => listeningPort);
|
|
1173
|
+
app.use(async function refuseServiceWorkerScripts(c, next) {
|
|
1174
|
+
const serviceWorker = c.req.header("service-worker");
|
|
1175
|
+
if (!serviceWorkerScriptFetch({ serviceWorker, fetchDest: c.req.header("sec-fetch-dest") }))
|
|
1176
|
+
return next();
|
|
1177
|
+
return c.text("Forbidden", 403);
|
|
1178
|
+
});
|
|
1170
1179
|
app.get("/*", async (c) => {
|
|
1171
1180
|
let requestPath = c.req.path;
|
|
1172
1181
|
if (requestPath === "/") requestPath = "/index.html";
|
|
@@ -13906,7 +13915,7 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
13906
13915
|
error: String(failure ?? result?.error)
|
|
13907
13916
|
}
|
|
13908
13917
|
);
|
|
13909
|
-
return runEncodeStage(input);
|
|
13918
|
+
return runEncodeStage({ ...input, hasAudio: false });
|
|
13910
13919
|
},
|
|
13911
13920
|
abort: async () => {
|
|
13912
13921
|
stop.abort();
|
|
@@ -14234,6 +14243,7 @@ var RenderQualityError = class extends Error {
|
|
|
14234
14243
|
}
|
|
14235
14244
|
warnings;
|
|
14236
14245
|
};
|
|
14246
|
+
var MIN_CPUS_TO_CAPTURE_DURING_MIX = 4;
|
|
14237
14247
|
function applyRenderWarningPolicy(job, captureWarnings, log = defaultLogger) {
|
|
14238
14248
|
job.warnings ??= [];
|
|
14239
14249
|
const existing = new Set(
|
|
@@ -15204,8 +15214,14 @@ async function executeRenderPipeline(input) {
|
|
|
15204
15214
|
const onProgress = execution.onProgress;
|
|
15205
15215
|
const tooSlow = new AbortController();
|
|
15206
15216
|
let tooSlowError;
|
|
15217
|
+
const audioFailed = new AbortController();
|
|
15218
|
+
let audioFailure;
|
|
15207
15219
|
let calibrationEvaluateTimedOut = false;
|
|
15208
|
-
const executionSignal =
|
|
15220
|
+
const executionSignal = AbortSignal.any([
|
|
15221
|
+
audioFailed.signal,
|
|
15222
|
+
...job.config.maxRenderMs ? [tooSlow.signal] : [],
|
|
15223
|
+
...execution.signal ? [execution.signal] : []
|
|
15224
|
+
]);
|
|
15209
15225
|
let fileServer = null;
|
|
15210
15226
|
let probeSession = null;
|
|
15211
15227
|
let lastBrowserConsole = [];
|
|
@@ -16468,33 +16484,41 @@ async function executeRenderPipeline(input) {
|
|
|
16468
16484
|
}
|
|
16469
16485
|
const effectiveQuality = job.config.crf ?? preset.quality;
|
|
16470
16486
|
const effectiveBitrate = job.config.crf != null ? void 0 : job.config.videoBitrate;
|
|
16471
|
-
const
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16483
|
-
|
|
16484
|
-
|
|
16485
|
-
|
|
16486
|
-
|
|
16487
|
-
|
|
16488
|
-
|
|
16489
|
-
|
|
16490
|
-
|
|
16491
|
-
|
|
16487
|
+
const audioReady = audioStage.then((audioResult) => {
|
|
16488
|
+
perfStages.audioProcessMs = audioResult.audioProcessMs;
|
|
16489
|
+
recordLimiterAttenuation(job, audioResult.audioLoweredDb);
|
|
16490
|
+
if (audioResult.audioError) {
|
|
16491
|
+
const audioFailures = audioResult.audioFailures ?? [];
|
|
16492
|
+
const failureOwner = audioFailures.length === 0 ? void 0 : audioFailures.some((failure) => failure.owner === "system") ? "system" : "user";
|
|
16493
|
+
const retryable = audioFailures.length === 0 ? void 0 : audioFailures.every((failure) => failure.retryable);
|
|
16494
|
+
applyRenderWarningPolicy(
|
|
16495
|
+
job,
|
|
16496
|
+
[
|
|
16497
|
+
{
|
|
16498
|
+
code: "audio_processing_failed",
|
|
16499
|
+
message: `Audio mix failed; output would be video-only: ${audioResult.audioError}`,
|
|
16500
|
+
details: {
|
|
16501
|
+
mediaType: "audio",
|
|
16502
|
+
audioFailures: audioFailureDiagnostics2(audioFailures),
|
|
16503
|
+
failureReasons: [...new Set(audioFailures.map((failure) => failure.reason))],
|
|
16504
|
+
failureStages: [...new Set(audioFailures.map((failure) => failure.stage))],
|
|
16505
|
+
failureOwner,
|
|
16506
|
+
retryable
|
|
16507
|
+
}
|
|
16492
16508
|
}
|
|
16493
|
-
|
|
16494
|
-
|
|
16495
|
-
|
|
16496
|
-
|
|
16497
|
-
|
|
16509
|
+
],
|
|
16510
|
+
log
|
|
16511
|
+
);
|
|
16512
|
+
}
|
|
16513
|
+
return audioResult;
|
|
16514
|
+
});
|
|
16515
|
+
audioReady.catch((error) => {
|
|
16516
|
+
if (executionSignal.aborted) return;
|
|
16517
|
+
audioFailure = error;
|
|
16518
|
+
audioFailed.abort(error);
|
|
16519
|
+
});
|
|
16520
|
+
const mixedAudio = () => audioWait.wait(audioReady);
|
|
16521
|
+
if (usableCpuCount2() < MIN_CPUS_TO_CAPTURE_DURING_MIX) await mixedAudio();
|
|
16498
16522
|
resetCaptureAttemptProgress(job);
|
|
16499
16523
|
if (capturePlan.kind === "hdr_layered") {
|
|
16500
16524
|
const layeredPlan = capturePlan;
|
|
@@ -16677,7 +16701,7 @@ async function executeRenderPipeline(input) {
|
|
|
16677
16701
|
} catch (err) {
|
|
16678
16702
|
const isVerifyError = isDrawElementVerificationError(err);
|
|
16679
16703
|
const isDeStall = isDeRendererStallError(err);
|
|
16680
|
-
if (!isVerifyError && !isDrawElementCaptureError(err) && !isDeStall || err instanceof RenderCancelledError || executionSignal
|
|
16704
|
+
if (!isVerifyError && !isDrawElementCaptureError(err) && !isDeStall || err instanceof RenderCancelledError || executionSignal.aborted === true) {
|
|
16681
16705
|
throw err;
|
|
16682
16706
|
}
|
|
16683
16707
|
deSelfVerifyFallback = isVerifyError;
|
|
@@ -16820,7 +16844,7 @@ async function executeRenderPipeline(input) {
|
|
|
16820
16844
|
const isSequentialStall = isSequentialCaptureStallError(err);
|
|
16821
16845
|
const isParallelStall = isParallelCaptureStallError(err);
|
|
16822
16846
|
const isEncoderDeath = isRetryableEncoderDeath(err);
|
|
16823
|
-
const isCancellation = err instanceof RenderCancelledError || executionSignal
|
|
16847
|
+
const isCancellation = err instanceof RenderCancelledError || executionSignal.aborted === true;
|
|
16824
16848
|
if (!shouldRetryViaPinnedFallback({
|
|
16825
16849
|
isVerifyError,
|
|
16826
16850
|
isDeCaptureError,
|
|
@@ -16949,8 +16973,6 @@ async function executeRenderPipeline(input) {
|
|
|
16949
16973
|
height,
|
|
16950
16974
|
needsAlpha,
|
|
16951
16975
|
captureImageFormat: captureOptions.format ?? "jpeg",
|
|
16952
|
-
hasAudio,
|
|
16953
|
-
audioOutputPath,
|
|
16954
16976
|
isPngSequence,
|
|
16955
16977
|
isGif,
|
|
16956
16978
|
preset,
|
|
@@ -17003,7 +17025,7 @@ async function executeRenderPipeline(input) {
|
|
|
17003
17025
|
captureRes = await invokeDiskCapture(capturePlan);
|
|
17004
17026
|
} catch (err) {
|
|
17005
17027
|
await overlap?.abort();
|
|
17006
|
-
if (!isDrawElementVerificationError(err) && !isDrawElementCaptureError(err) || err instanceof RenderCancelledError || executionSignal
|
|
17028
|
+
if (!isDrawElementVerificationError(err) && !isDrawElementCaptureError(err) || err instanceof RenderCancelledError || executionSignal.aborted === true) {
|
|
17007
17029
|
throw err;
|
|
17008
17030
|
}
|
|
17009
17031
|
deSelfVerifyFallback = isDrawElementVerificationError(err);
|
|
@@ -17062,16 +17084,17 @@ async function executeRenderPipeline(input) {
|
|
|
17062
17084
|
perfStages.captureMs = Date.now() - stage4Start;
|
|
17063
17085
|
perfStages.captureFrameMs = captureFrameMs;
|
|
17064
17086
|
perfStages.captureSetupMs = Math.max(0, perfStages.captureMs - captureFrameMs);
|
|
17087
|
+
const { hasAudio: hasAudio2, audioOutputPath: audioOutputPath2 } = await mixedAudio();
|
|
17065
17088
|
const encodeRes = await observeRenderStage(
|
|
17066
17089
|
observability,
|
|
17067
17090
|
"encode",
|
|
17068
17091
|
captureStageObservationData({
|
|
17069
|
-
hasAudio,
|
|
17092
|
+
hasAudio: hasAudio2,
|
|
17070
17093
|
isPngSequence,
|
|
17071
17094
|
isGif,
|
|
17072
17095
|
chunkedEncode: enableChunkedEncode
|
|
17073
17096
|
}),
|
|
17074
|
-
() => overlap ? overlap.finish() : runEncodeStage(encodeInput)
|
|
17097
|
+
() => overlap ? overlap.finish() : runEncodeStage({ ...encodeInput, hasAudio: hasAudio2, audioOutputPath: audioOutputPath2 })
|
|
17075
17098
|
);
|
|
17076
17099
|
perfStages.encodeMs = encodeRes.encodeMs;
|
|
17077
17100
|
}
|
|
@@ -17091,6 +17114,7 @@ async function executeRenderPipeline(input) {
|
|
|
17091
17114
|
if (frameLookup) frameLookup.cleanup();
|
|
17092
17115
|
closeFileServerSafely(fileServer, "renderOrchestrator", log);
|
|
17093
17116
|
fileServer = null;
|
|
17117
|
+
const { audioOutputPath, deliverySourcePath, hasAudio } = await mixedAudio();
|
|
17094
17118
|
if (!isPngSequence && !isGif) {
|
|
17095
17119
|
const assembleRes = await observeRenderStage(
|
|
17096
17120
|
observability,
|
|
@@ -17226,8 +17250,11 @@ async function executeRenderPipeline(input) {
|
|
|
17226
17250
|
framesRendered: job.framesRendered ?? 0,
|
|
17227
17251
|
error: caught
|
|
17228
17252
|
});
|
|
17229
|
-
const error = surfaceScriptFailure(
|
|
17230
|
-
|
|
17253
|
+
const error = surfaceScriptFailure(
|
|
17254
|
+
tooSlowError ?? audioFailure ?? pageNeverReady ?? caught,
|
|
17255
|
+
job
|
|
17256
|
+
);
|
|
17257
|
+
if (!tooSlowError && !audioFailure && (error instanceof RenderCancelledError || executionSignal.aborted)) {
|
|
17231
17258
|
job.error = error instanceof Error ? error.message : "render_cancelled";
|
|
17232
17259
|
updateJobStatus(job, "cancelled", "Render cancelled", job.progress, onProgress);
|
|
17233
17260
|
await eventPublisher.flush();
|
|
@@ -17269,7 +17296,7 @@ async function executeRenderPipeline(input) {
|
|
|
17269
17296
|
`Parallel capture timed out with ${captureObservability.workerCount ?? "auto"} workers. Video-heavy compositions often need sequential capture. Retry with --workers 1`
|
|
17270
17297
|
);
|
|
17271
17298
|
}
|
|
17272
|
-
const failedStage = job.currentStage || "pipeline";
|
|
17299
|
+
const failedStage = audioFailure === void 0 ? job.currentStage || "pipeline" : AUDIO_STAGE;
|
|
17273
17300
|
const observabilitySummary = observability.summary({
|
|
17274
17301
|
lastBrowserConsole,
|
|
17275
17302
|
capture: withCapturedBeyondViewport(captureObservability, dedupPerfs),
|
|
@@ -20024,7 +20051,7 @@ import {
|
|
|
20024
20051
|
probeBeginFrameLiveness as probeBeginFrameLiveness2,
|
|
20025
20052
|
readWebGlVendorInfoFromCanvas,
|
|
20026
20053
|
resolveConfig as resolveConfig4,
|
|
20027
|
-
usableCpuCount as
|
|
20054
|
+
usableCpuCount as usableCpuCount3
|
|
20028
20055
|
} from "@hyperframes/engine";
|
|
20029
20056
|
|
|
20030
20057
|
// src/services/distributed/planV2.ts
|
|
@@ -21448,9 +21475,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
21448
21475
|
const captureSession = session;
|
|
21449
21476
|
session = null;
|
|
21450
21477
|
verifyStarted = Date.now();
|
|
21451
|
-
overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount,
|
|
21478
|
+
overlap.current = canEncodeWhileCapturing(encodeInput, chunkWorkerCount, usableCpuCount3()) ? encodeWhileCapturing(encodeInput, framesInChunk, {
|
|
21452
21479
|
workerCount: chunkWorkerCount,
|
|
21453
|
-
cpuCount:
|
|
21480
|
+
cpuCount: usableCpuCount3()
|
|
21454
21481
|
}) : null;
|
|
21455
21482
|
await observeRenderStage(
|
|
21456
21483
|
new RenderObservabilityRecorder({ pipelineStartMs: start, log }),
|
package/dist/public-server.js
CHANGED
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import { isSafePath as isSafePath3 } from "@hyperframes/core/safe-path";
|
|
43
43
|
|
|
44
44
|
// src/services/renderOrchestrator.ts
|
|
45
|
-
import { audioFailureDiagnostics as audioFailureDiagnostics2 } from "@hyperframes/engine";
|
|
45
|
+
import { audioFailureDiagnostics as audioFailureDiagnostics2, usableCpuCount as usableCpuCount2 } from "@hyperframes/engine";
|
|
46
46
|
import {
|
|
47
47
|
existsSync as existsSync21,
|
|
48
48
|
mkdirSync as mkdirSync12,
|
|
@@ -420,7 +420,10 @@ import { Readable } from "node:stream";
|
|
|
420
420
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
421
421
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
422
422
|
import { injectTagsAtHeadStart } from "@hyperframes/core/compiler/html-document";
|
|
423
|
-
import {
|
|
423
|
+
import {
|
|
424
|
+
PREVIEW_FOR_ANOTHER_SITE_META,
|
|
425
|
+
serviceWorkerScriptFetch
|
|
426
|
+
} from "@hyperframes/core/studio-preview-mark";
|
|
424
427
|
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
425
428
|
import { isPrivateFileUnder, isStudioPrivatePath } from "@hyperframes/core/safe-path";
|
|
426
429
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
@@ -1202,6 +1205,12 @@ function createFileServer(options) {
|
|
|
1202
1205
|
c.res.headers.set("X-Content-Type-Options", "nosniff");
|
|
1203
1206
|
});
|
|
1204
1207
|
answerOwnLoopbackHostOnly(app, () => listeningPort);
|
|
1208
|
+
app.use(async function refuseServiceWorkerScripts(c, next) {
|
|
1209
|
+
const serviceWorker = c.req.header("service-worker");
|
|
1210
|
+
if (!serviceWorkerScriptFetch({ serviceWorker, fetchDest: c.req.header("sec-fetch-dest") }))
|
|
1211
|
+
return next();
|
|
1212
|
+
return c.text("Forbidden", 403);
|
|
1213
|
+
});
|
|
1205
1214
|
app.get("/*", async (c) => {
|
|
1206
1215
|
let requestPath = c.req.path;
|
|
1207
1216
|
if (requestPath === "/") requestPath = "/index.html";
|
|
@@ -13881,7 +13890,7 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
13881
13890
|
error: String(failure ?? result?.error)
|
|
13882
13891
|
}
|
|
13883
13892
|
);
|
|
13884
|
-
return runEncodeStage(input);
|
|
13893
|
+
return runEncodeStage({ ...input, hasAudio: false });
|
|
13885
13894
|
},
|
|
13886
13895
|
abort: async () => {
|
|
13887
13896
|
stop.abort();
|
|
@@ -14209,6 +14218,7 @@ var RenderQualityError = class extends Error {
|
|
|
14209
14218
|
}
|
|
14210
14219
|
warnings;
|
|
14211
14220
|
};
|
|
14221
|
+
var MIN_CPUS_TO_CAPTURE_DURING_MIX = 4;
|
|
14212
14222
|
function applyRenderWarningPolicy(job, captureWarnings, log = defaultLogger) {
|
|
14213
14223
|
job.warnings ??= [];
|
|
14214
14224
|
const existing = new Set(
|
|
@@ -15179,8 +15189,14 @@ async function executeRenderPipeline(input) {
|
|
|
15179
15189
|
const onProgress = execution.onProgress;
|
|
15180
15190
|
const tooSlow = new AbortController();
|
|
15181
15191
|
let tooSlowError;
|
|
15192
|
+
const audioFailed = new AbortController();
|
|
15193
|
+
let audioFailure;
|
|
15182
15194
|
let calibrationEvaluateTimedOut = false;
|
|
15183
|
-
const executionSignal =
|
|
15195
|
+
const executionSignal = AbortSignal.any([
|
|
15196
|
+
audioFailed.signal,
|
|
15197
|
+
...job.config.maxRenderMs ? [tooSlow.signal] : [],
|
|
15198
|
+
...execution.signal ? [execution.signal] : []
|
|
15199
|
+
]);
|
|
15184
15200
|
let fileServer = null;
|
|
15185
15201
|
let probeSession = null;
|
|
15186
15202
|
let lastBrowserConsole = [];
|
|
@@ -16443,33 +16459,41 @@ async function executeRenderPipeline(input) {
|
|
|
16443
16459
|
}
|
|
16444
16460
|
const effectiveQuality = job.config.crf ?? preset.quality;
|
|
16445
16461
|
const effectiveBitrate = job.config.crf != null ? void 0 : job.config.videoBitrate;
|
|
16446
|
-
const
|
|
16447
|
-
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16462
|
+
const audioReady = audioStage.then((audioResult) => {
|
|
16463
|
+
perfStages.audioProcessMs = audioResult.audioProcessMs;
|
|
16464
|
+
recordLimiterAttenuation(job, audioResult.audioLoweredDb);
|
|
16465
|
+
if (audioResult.audioError) {
|
|
16466
|
+
const audioFailures = audioResult.audioFailures ?? [];
|
|
16467
|
+
const failureOwner = audioFailures.length === 0 ? void 0 : audioFailures.some((failure) => failure.owner === "system") ? "system" : "user";
|
|
16468
|
+
const retryable = audioFailures.length === 0 ? void 0 : audioFailures.every((failure) => failure.retryable);
|
|
16469
|
+
applyRenderWarningPolicy(
|
|
16470
|
+
job,
|
|
16471
|
+
[
|
|
16472
|
+
{
|
|
16473
|
+
code: "audio_processing_failed",
|
|
16474
|
+
message: `Audio mix failed; output would be video-only: ${audioResult.audioError}`,
|
|
16475
|
+
details: {
|
|
16476
|
+
mediaType: "audio",
|
|
16477
|
+
audioFailures: audioFailureDiagnostics2(audioFailures),
|
|
16478
|
+
failureReasons: [...new Set(audioFailures.map((failure) => failure.reason))],
|
|
16479
|
+
failureStages: [...new Set(audioFailures.map((failure) => failure.stage))],
|
|
16480
|
+
failureOwner,
|
|
16481
|
+
retryable
|
|
16482
|
+
}
|
|
16467
16483
|
}
|
|
16468
|
-
|
|
16469
|
-
|
|
16470
|
-
|
|
16471
|
-
|
|
16472
|
-
|
|
16484
|
+
],
|
|
16485
|
+
log
|
|
16486
|
+
);
|
|
16487
|
+
}
|
|
16488
|
+
return audioResult;
|
|
16489
|
+
});
|
|
16490
|
+
audioReady.catch((error) => {
|
|
16491
|
+
if (executionSignal.aborted) return;
|
|
16492
|
+
audioFailure = error;
|
|
16493
|
+
audioFailed.abort(error);
|
|
16494
|
+
});
|
|
16495
|
+
const mixedAudio = () => audioWait.wait(audioReady);
|
|
16496
|
+
if (usableCpuCount2() < MIN_CPUS_TO_CAPTURE_DURING_MIX) await mixedAudio();
|
|
16473
16497
|
resetCaptureAttemptProgress(job);
|
|
16474
16498
|
if (capturePlan.kind === "hdr_layered") {
|
|
16475
16499
|
const layeredPlan = capturePlan;
|
|
@@ -16652,7 +16676,7 @@ async function executeRenderPipeline(input) {
|
|
|
16652
16676
|
} catch (err) {
|
|
16653
16677
|
const isVerifyError = isDrawElementVerificationError(err);
|
|
16654
16678
|
const isDeStall = isDeRendererStallError(err);
|
|
16655
|
-
if (!isVerifyError && !isDrawElementCaptureError(err) && !isDeStall || err instanceof RenderCancelledError || executionSignal
|
|
16679
|
+
if (!isVerifyError && !isDrawElementCaptureError(err) && !isDeStall || err instanceof RenderCancelledError || executionSignal.aborted === true) {
|
|
16656
16680
|
throw err;
|
|
16657
16681
|
}
|
|
16658
16682
|
deSelfVerifyFallback = isVerifyError;
|
|
@@ -16795,7 +16819,7 @@ async function executeRenderPipeline(input) {
|
|
|
16795
16819
|
const isSequentialStall = isSequentialCaptureStallError(err);
|
|
16796
16820
|
const isParallelStall = isParallelCaptureStallError(err);
|
|
16797
16821
|
const isEncoderDeath = isRetryableEncoderDeath(err);
|
|
16798
|
-
const isCancellation = err instanceof RenderCancelledError || executionSignal
|
|
16822
|
+
const isCancellation = err instanceof RenderCancelledError || executionSignal.aborted === true;
|
|
16799
16823
|
if (!shouldRetryViaPinnedFallback({
|
|
16800
16824
|
isVerifyError,
|
|
16801
16825
|
isDeCaptureError,
|
|
@@ -16924,8 +16948,6 @@ async function executeRenderPipeline(input) {
|
|
|
16924
16948
|
height,
|
|
16925
16949
|
needsAlpha,
|
|
16926
16950
|
captureImageFormat: captureOptions.format ?? "jpeg",
|
|
16927
|
-
hasAudio,
|
|
16928
|
-
audioOutputPath,
|
|
16929
16951
|
isPngSequence,
|
|
16930
16952
|
isGif,
|
|
16931
16953
|
preset,
|
|
@@ -16978,7 +17000,7 @@ async function executeRenderPipeline(input) {
|
|
|
16978
17000
|
captureRes = await invokeDiskCapture(capturePlan);
|
|
16979
17001
|
} catch (err) {
|
|
16980
17002
|
await overlap?.abort();
|
|
16981
|
-
if (!isDrawElementVerificationError(err) && !isDrawElementCaptureError(err) || err instanceof RenderCancelledError || executionSignal
|
|
17003
|
+
if (!isDrawElementVerificationError(err) && !isDrawElementCaptureError(err) || err instanceof RenderCancelledError || executionSignal.aborted === true) {
|
|
16982
17004
|
throw err;
|
|
16983
17005
|
}
|
|
16984
17006
|
deSelfVerifyFallback = isDrawElementVerificationError(err);
|
|
@@ -17037,16 +17059,17 @@ async function executeRenderPipeline(input) {
|
|
|
17037
17059
|
perfStages.captureMs = Date.now() - stage4Start;
|
|
17038
17060
|
perfStages.captureFrameMs = captureFrameMs;
|
|
17039
17061
|
perfStages.captureSetupMs = Math.max(0, perfStages.captureMs - captureFrameMs);
|
|
17062
|
+
const { hasAudio: hasAudio2, audioOutputPath: audioOutputPath2 } = await mixedAudio();
|
|
17040
17063
|
const encodeRes = await observeRenderStage(
|
|
17041
17064
|
observability,
|
|
17042
17065
|
"encode",
|
|
17043
17066
|
captureStageObservationData({
|
|
17044
|
-
hasAudio,
|
|
17067
|
+
hasAudio: hasAudio2,
|
|
17045
17068
|
isPngSequence,
|
|
17046
17069
|
isGif,
|
|
17047
17070
|
chunkedEncode: enableChunkedEncode
|
|
17048
17071
|
}),
|
|
17049
|
-
() => overlap ? overlap.finish() : runEncodeStage(encodeInput)
|
|
17072
|
+
() => overlap ? overlap.finish() : runEncodeStage({ ...encodeInput, hasAudio: hasAudio2, audioOutputPath: audioOutputPath2 })
|
|
17050
17073
|
);
|
|
17051
17074
|
perfStages.encodeMs = encodeRes.encodeMs;
|
|
17052
17075
|
}
|
|
@@ -17066,6 +17089,7 @@ async function executeRenderPipeline(input) {
|
|
|
17066
17089
|
if (frameLookup) frameLookup.cleanup();
|
|
17067
17090
|
closeFileServerSafely(fileServer, "renderOrchestrator", log);
|
|
17068
17091
|
fileServer = null;
|
|
17092
|
+
const { audioOutputPath, deliverySourcePath, hasAudio } = await mixedAudio();
|
|
17069
17093
|
if (!isPngSequence && !isGif) {
|
|
17070
17094
|
const assembleRes = await observeRenderStage(
|
|
17071
17095
|
observability,
|
|
@@ -17201,8 +17225,11 @@ async function executeRenderPipeline(input) {
|
|
|
17201
17225
|
framesRendered: job.framesRendered ?? 0,
|
|
17202
17226
|
error: caught
|
|
17203
17227
|
});
|
|
17204
|
-
const error = surfaceScriptFailure(
|
|
17205
|
-
|
|
17228
|
+
const error = surfaceScriptFailure(
|
|
17229
|
+
tooSlowError ?? audioFailure ?? pageNeverReady ?? caught,
|
|
17230
|
+
job
|
|
17231
|
+
);
|
|
17232
|
+
if (!tooSlowError && !audioFailure && (error instanceof RenderCancelledError || executionSignal.aborted)) {
|
|
17206
17233
|
job.error = error instanceof Error ? error.message : "render_cancelled";
|
|
17207
17234
|
updateJobStatus(job, "cancelled", "Render cancelled", job.progress, onProgress);
|
|
17208
17235
|
await eventPublisher.flush();
|
|
@@ -17244,7 +17271,7 @@ async function executeRenderPipeline(input) {
|
|
|
17244
17271
|
`Parallel capture timed out with ${captureObservability.workerCount ?? "auto"} workers. Video-heavy compositions often need sequential capture. Retry with --workers 1`
|
|
17245
17272
|
);
|
|
17246
17273
|
}
|
|
17247
|
-
const failedStage = job.currentStage || "pipeline";
|
|
17274
|
+
const failedStage = audioFailure === void 0 ? job.currentStage || "pipeline" : AUDIO_STAGE;
|
|
17248
17275
|
const observabilitySummary = observability.summary({
|
|
17249
17276
|
lastBrowserConsole,
|
|
17250
17277
|
capture: withCapturedBeyondViewport(captureObservability, dedupPerfs),
|
|
@@ -12,17 +12,16 @@
|
|
|
12
12
|
export declare const isPrivateSitePath: (relPath: string) => boolean;
|
|
13
13
|
/**
|
|
14
14
|
* The files a site upload ships, as `/`-separated paths under `projectDir`. Symlinks are followed
|
|
15
|
-
* (root included),
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* the project is left out too, and `onOutside` hears it, a folder once.
|
|
15
|
+
* (root included), out of the project only with `onOutside` `"include"`; top-level
|
|
16
|
+
* {@link PLAN_PROJECT_DIR_SKIP_SEGMENTS} are left out as the plan stage does, and a dangling link
|
|
17
|
+
* throws. Private files (env, Git, credentials, tool and agent state, app records) are left out at
|
|
18
|
+
* every depth, by name or by link target. `onPrivate` and `onOutside` hear each, a folder once.
|
|
20
19
|
*/
|
|
21
|
-
export declare function listSiteFiles(projectDir: string, onPrivate?: (relPath: string) => void, onOutside?: (relPath: string) => void): string[];
|
|
20
|
+
export declare function listSiteFiles(projectDir: string, onPrivate?: (relPath: string) => void, onOutside?: ((relPath: string) => void) | "include"): string[];
|
|
22
21
|
/**
|
|
23
22
|
* {@link listSiteFiles} for an upload: one line to `onNotice` names the private files left out.
|
|
24
|
-
* Files linked in from outside
|
|
25
|
-
*
|
|
23
|
+
* Files linked in from outside ship only with `includeOutsideFiles`, else a second line names them.
|
|
24
|
+
* The upload reads each path again after this check, so a link swapped in meanwhile still ships.
|
|
26
25
|
*/
|
|
27
26
|
export declare function listSiteFilesForUpload(projectDir: string, onNotice?: (message: string) => void, includeOutsideFiles?: boolean): string[];
|
|
28
27
|
/**
|
|
@@ -100,12 +100,13 @@ export interface EncodeStageInput {
|
|
|
100
100
|
*/
|
|
101
101
|
gopSize?: number;
|
|
102
102
|
}
|
|
103
|
+
export type VideoEncodeInput = Omit<EncodeStageInput, "hasAudio" | "audioOutputPath">;
|
|
103
104
|
export interface EncodeStageResult {
|
|
104
105
|
/** Wall-clock ms for the encode (or png-copy) phase. */
|
|
105
106
|
encodeMs: number;
|
|
106
107
|
}
|
|
107
108
|
export declare function overlapEncoderThreads(workerCount: number, cpuCount: number): number;
|
|
108
|
-
export declare function videoEncoderOptions(input:
|
|
109
|
+
export declare function videoEncoderOptions(input: VideoEncodeInput, engineCfg: Pick<EngineConfig, "vp9CpuUsed">, softwareEncoderThreads?: number): {
|
|
109
110
|
fps: Fps;
|
|
110
111
|
width: number;
|
|
111
112
|
height: number;
|
|
@@ -129,7 +130,7 @@ export declare function videoEncoderOptions(input: EncodeStageInput, engineCfg:
|
|
|
129
130
|
* h264 from JPEG only, software or GPU: the streaming encoder then runs the disk encoder's
|
|
130
131
|
* arguments. Needs a core the capture workers leave free.
|
|
131
132
|
*/
|
|
132
|
-
export declare function canEncodeWhileCapturing(input:
|
|
133
|
+
export declare function canEncodeWhileCapturing(input: VideoEncodeInput, workerCount: number, cpuCount: number): boolean;
|
|
133
134
|
export interface EncodeWhileCapturing {
|
|
134
135
|
/** A worker finished writing this frame. */
|
|
135
136
|
onFrameLanded: (frame: LandedFrame) => void;
|
|
@@ -144,7 +145,7 @@ export interface EncodeWhileCapturing {
|
|
|
144
145
|
* Feeds frames 0, 1, 2… to the encoder as each lands; capture never waits on it.
|
|
145
146
|
* On failure `finish` re-runs `runEncodeStage` on the same frames.
|
|
146
147
|
*/
|
|
147
|
-
export declare function encodeWhileCapturing(input:
|
|
148
|
+
export declare function encodeWhileCapturing(input: VideoEncodeInput, totalFrames: number, captureBudget?: {
|
|
148
149
|
workerCount: number;
|
|
149
150
|
cpuCount: number;
|
|
150
151
|
}): EncodeWhileCapturing;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.63",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"postcss": "^8.4.0",
|
|
36
36
|
"puppeteer": "~25.13.0",
|
|
37
37
|
"puppeteer-core": "^25.13.0",
|
|
38
|
-
"@hyperframes/
|
|
39
|
-
"@hyperframes/core": "0.9.
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/studio-server": "0.9.
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/engine": "0.9.63",
|
|
39
|
+
"@hyperframes/core": "0.9.63",
|
|
40
|
+
"@hyperframes/lint": "0.9.63",
|
|
41
|
+
"@hyperframes/studio-server": "0.9.63",
|
|
42
|
+
"@hyperframes/parsers": "0.9.63"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.0.10",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsx": "^4.21.0",
|
|
49
49
|
"typescript": "^5.7.2",
|
|
50
50
|
"vitest": "^4.1.12",
|
|
51
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
51
|
+
"@hyperframes/aws-lambda": "0.9.63"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|