@hyperframes/producer 0.9.107 → 0.10.1
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/README.md +1 -1
- package/dist/distributed.js +97 -21
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/index.js +97 -21
- package/dist/public-server.js +10 -8
- package/dist/services/distributed/renderChunk.d.ts +32 -1
- package/dist/services/render/stages/captureStage.d.ts +3 -1
- package/dist/services/renderOrchestrator.d.ts +3 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -392,11 +392,8 @@ import { promisify } from "node:util";
|
|
|
392
392
|
import { Readable } from "node:stream";
|
|
393
393
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
394
394
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
395
|
-
import {
|
|
396
|
-
import {
|
|
397
|
-
PREVIEW_FOR_ANOTHER_SITE_META,
|
|
398
|
-
serviceWorkerScriptFetch
|
|
399
|
-
} from "@hyperframes/core/studio-preview-mark";
|
|
395
|
+
import { markForAnotherSite } from "@hyperframes/core/compiler/html-document";
|
|
396
|
+
import { serviceWorkerScriptFetch } from "@hyperframes/core/studio-preview-mark";
|
|
400
397
|
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
401
398
|
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
402
399
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
@@ -1116,7 +1113,6 @@ var HF_BRIDGE_SCRIPT = `(function() {
|
|
|
1116
1113
|
if (bridge()) __realClearInterval(iv);
|
|
1117
1114
|
}, 50);
|
|
1118
1115
|
})();`;
|
|
1119
|
-
var OFFER_NO_FRAMING_SITE_AN_EDITING_PORT = `<meta name="${PREVIEW_FOR_ANOTHER_SITE_META}">`;
|
|
1120
1116
|
var RENDER_CAPTURE_MODE_SHIM = "globalThis.__HF_RENDER_CAPTURE_MODE = true;";
|
|
1121
1117
|
function closeFileServerSafely(fileServer, label, log = defaultLogger) {
|
|
1122
1118
|
try {
|
|
@@ -1215,7 +1211,7 @@ function createFileServer(options) {
|
|
|
1215
1211
|
html = injectScriptsAtHeadStart(html, preHeadScripts);
|
|
1216
1212
|
}
|
|
1217
1213
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
1218
|
-
html =
|
|
1214
|
+
html = markForAnotherSite(html);
|
|
1219
1215
|
return c.text(html, 200, { "Content-Type": contentType });
|
|
1220
1216
|
}
|
|
1221
1217
|
if (ext === ".png") {
|
|
@@ -13672,6 +13668,8 @@ async function runCaptureStage(input) {
|
|
|
13672
13668
|
pageErrorLines: workerPageErrors,
|
|
13673
13669
|
openAttempt: input.openAttempt,
|
|
13674
13670
|
verifyFirstSession: input.verifyFirstSession,
|
|
13671
|
+
prepareSession: input.prepareSession,
|
|
13672
|
+
onSessionUnprepared: input.onSessionUnprepared,
|
|
13675
13673
|
onProgress: (progress) => {
|
|
13676
13674
|
if (progress.latestWorkerPhase) {
|
|
13677
13675
|
if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
|
|
@@ -15840,7 +15838,11 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
15840
15838
|
} : void 0,
|
|
15841
15839
|
void 0,
|
|
15842
15840
|
options.cfg,
|
|
15843
|
-
{
|
|
15841
|
+
{
|
|
15842
|
+
verifyFirstSession: options.verifyFirstSession,
|
|
15843
|
+
prepareSession: options.prepareSession,
|
|
15844
|
+
onSessionUnprepared: options.onSessionUnprepared
|
|
15845
|
+
}
|
|
15844
15846
|
);
|
|
15845
15847
|
pushWorkerDedupPerfs(workerResults, options.dedupPerfs);
|
|
15846
15848
|
if (options.pageErrorLines) pushWorkerPageErrors(workerResults, options.pageErrorLines);
|
|
@@ -21031,7 +21033,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
21031
21033
|
const composition = compileResult.composition;
|
|
21032
21034
|
const { deviceScaleFactor } = compileResult;
|
|
21033
21035
|
let forceScreenshot = compileResult.forceScreenshot;
|
|
21034
|
-
if (cfg.lowMemoryMode) forceScreenshot = true;
|
|
21036
|
+
if (cfg.lowMemoryMode || deviceScaleFactor !== 1) forceScreenshot = true;
|
|
21035
21037
|
const { width, height } = composition;
|
|
21036
21038
|
if (config.rejectOnSystemFonts !== false) {
|
|
21037
21039
|
validateNoSystemFonts(compiled.html);
|
|
@@ -21455,8 +21457,8 @@ import { join as join49 } from "node:path";
|
|
|
21455
21457
|
import {
|
|
21456
21458
|
assertSwiftShader,
|
|
21457
21459
|
BROWSER_GPU_NOT_SOFTWARE as BROWSER_GPU_NOT_SOFTWARE4,
|
|
21458
|
-
calculateOptimalWorkers as calculateOptimalWorkers2,
|
|
21459
21460
|
classifyCaptureFailure as classifyCaptureFailure4,
|
|
21461
|
+
computeWorkerSizing as computeWorkerSizing2,
|
|
21460
21462
|
closeCaptureSession as closeCaptureSession11,
|
|
21461
21463
|
createCaptureSession as createCaptureSession11,
|
|
21462
21464
|
createFrameLookupTable as createFrameLookupTable6,
|
|
@@ -21464,6 +21466,8 @@ import {
|
|
|
21464
21466
|
getEncoderPreset as getEncoderPreset5,
|
|
21465
21467
|
initializeSession as initializeSession10,
|
|
21466
21468
|
measureVideoShownBoxes,
|
|
21469
|
+
measureVideoShownBoxPart,
|
|
21470
|
+
mergeVideoShownBoxParts,
|
|
21467
21471
|
probeBeginFrameLiveness as probeBeginFrameLiveness2,
|
|
21468
21472
|
readWebGlVendorInfoFromCanvas,
|
|
21469
21473
|
resolveConfig as resolveConfig4,
|
|
@@ -22384,6 +22388,23 @@ function resolveChunkCaptureWorkers(framesInChunk, machineSized, maxCaptureWorke
|
|
|
22384
22388
|
const byFrames = Math.floor(framesInChunk / MIN_FRAMES_PER_CHUNK_BROWSER);
|
|
22385
22389
|
return Math.max(machineSized, Math.floor(Math.min(maxCaptureWorkers, byFrames)));
|
|
22386
22390
|
}
|
|
22391
|
+
function chunkCaptureSizingLog(input) {
|
|
22392
|
+
const { machineSizing } = input;
|
|
22393
|
+
return {
|
|
22394
|
+
chunkIndex: input.chunkIndex,
|
|
22395
|
+
frames: input.framesEncoded,
|
|
22396
|
+
workers: input.workers,
|
|
22397
|
+
machineSizedWorkers: machineSizing.workers,
|
|
22398
|
+
boundBy: machineSizing.boundBy,
|
|
22399
|
+
cpuBasedWorkers: machineSizing.cpuBasedWorkers,
|
|
22400
|
+
memoryBasedWorkers: machineSizing.memoryBasedWorkers,
|
|
22401
|
+
frameBasedWorkers: machineSizing.frameBasedWorkers,
|
|
22402
|
+
maxCaptureWorkers: input.maxCaptureWorkers ?? null,
|
|
22403
|
+
captureMode: input.captureMode,
|
|
22404
|
+
captureStageMs: input.captureStageMs,
|
|
22405
|
+
captureMsPerFrame: input.framesEncoded > 0 ? Math.round(input.captureStageMs / input.framesEncoded * 10) / 10 : null
|
|
22406
|
+
};
|
|
22407
|
+
}
|
|
22387
22408
|
function resolveChunkFrameRange(slice, chunkIndex, frameRange) {
|
|
22388
22409
|
if (frameRange === void 0) return { startFrame: slice.startFrame, endFrame: slice.endFrame };
|
|
22389
22410
|
const { startFrame, endFrame } = frameRange;
|
|
@@ -22477,6 +22498,35 @@ async function beginFrameSessionNeedsScreenshotFallback(session, probe = probeBe
|
|
|
22477
22498
|
);
|
|
22478
22499
|
return !await probe(session.page, timeoutMs, probeTick, session.beginFrameIntervalMs);
|
|
22479
22500
|
}
|
|
22501
|
+
function createSharedBoxMeasure(onDone) {
|
|
22502
|
+
const started = Date.now();
|
|
22503
|
+
let done = false;
|
|
22504
|
+
let workerCount = 0;
|
|
22505
|
+
const shares = /* @__PURE__ */ new Map();
|
|
22506
|
+
return {
|
|
22507
|
+
settled: () => done,
|
|
22508
|
+
fullSize: () => {
|
|
22509
|
+
if (done) return;
|
|
22510
|
+
done = true;
|
|
22511
|
+
onDone(void 0);
|
|
22512
|
+
},
|
|
22513
|
+
add: (worker, part, cost) => {
|
|
22514
|
+
if (done) return;
|
|
22515
|
+
if (worker.workerCount !== workerCount) shares.clear();
|
|
22516
|
+
workerCount = worker.workerCount;
|
|
22517
|
+
shares.set(worker.workerId, { part, ...cost });
|
|
22518
|
+
if (shares.size < workerCount) return;
|
|
22519
|
+
done = true;
|
|
22520
|
+
const all = [...shares.values()];
|
|
22521
|
+
onDone(mergeVideoShownBoxParts(all.map((share) => share.part)), {
|
|
22522
|
+
workers: workerCount,
|
|
22523
|
+
frames: all.reduce((sum2, share) => sum2 + share.frames, 0),
|
|
22524
|
+
durationMs: Date.now() - started,
|
|
22525
|
+
slowestShareMs: Math.max(...all.map((share) => share.durationMs))
|
|
22526
|
+
});
|
|
22527
|
+
}
|
|
22528
|
+
};
|
|
22529
|
+
}
|
|
22480
22530
|
function hashChunkOutput(outputPath, kind) {
|
|
22481
22531
|
if (kind === "file") return sha256Hex(readFileSync15(outputPath));
|
|
22482
22532
|
const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
@@ -22653,9 +22703,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22653
22703
|
});
|
|
22654
22704
|
captureOptions.onStaticDedupActivity = () => noteCaptureActivity(job);
|
|
22655
22705
|
const captureFrames = effectiveChunkFrames(framesInChunk, slice.captureCost);
|
|
22706
|
+
const machineSizing = computeWorkerSizing2(captureFrames, void 0, cfg);
|
|
22656
22707
|
const chunkWorkerCount = resolveChunkCaptureWorkers(
|
|
22657
22708
|
captureFrames,
|
|
22658
|
-
|
|
22709
|
+
machineSizing.workers,
|
|
22659
22710
|
options?.maxCaptureWorkers
|
|
22660
22711
|
);
|
|
22661
22712
|
let session = null;
|
|
@@ -22682,13 +22733,25 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22682
22733
|
});
|
|
22683
22734
|
boxesReady.catch(() => {
|
|
22684
22735
|
});
|
|
22736
|
+
const shownVideoIds = [...shownFrames.keys()];
|
|
22737
|
+
const chunkFrameTimes = chunkFrameNumbers.map(
|
|
22738
|
+
(frame) => frame * chunkFps.den / chunkFps.num
|
|
22739
|
+
);
|
|
22685
22740
|
const measureBoxes = async (page) => {
|
|
22686
|
-
shownBoxes = await measureVideoShownBoxes(
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22741
|
+
shownBoxes = await measureVideoShownBoxes(page, shownVideoIds, chunkFrameTimes);
|
|
22742
|
+
boxesMeasured();
|
|
22743
|
+
};
|
|
22744
|
+
const sharedBoxes = createSharedBoxMeasure((boxes2, pass) => {
|
|
22745
|
+
shownBoxes = boxes2;
|
|
22691
22746
|
boxesMeasured();
|
|
22747
|
+
if (pass) log.info("[renderChunk] video boxes measured", { chunkIndex, ...pass });
|
|
22748
|
+
});
|
|
22749
|
+
const measureShare = async (session2, worker) => {
|
|
22750
|
+
if (sharedBoxes.settled()) return;
|
|
22751
|
+
const started = Date.now();
|
|
22752
|
+
const times = chunkFrameTimes.filter((_, i) => i % worker.workerCount === worker.workerId);
|
|
22753
|
+
const part = await measureVideoShownBoxPart(session2.page, shownVideoIds, times);
|
|
22754
|
+
sharedBoxes.add(worker, part, { frames: times.length, durationMs: Date.now() - started });
|
|
22692
22755
|
};
|
|
22693
22756
|
if (chunkWorkerCount === 1) {
|
|
22694
22757
|
const bootStarted = Date.now();
|
|
@@ -22731,14 +22794,13 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22731
22794
|
);
|
|
22732
22795
|
sessionBootMs += Date.now() - screenshotBootStarted;
|
|
22733
22796
|
}
|
|
22734
|
-
} else if (!verifyInWorker) {
|
|
22735
|
-
|
|
22797
|
+
} else if (!verifyInWorker || shownVideoIds.length === 0) {
|
|
22798
|
+
sharedBoxes.fullSize();
|
|
22736
22799
|
}
|
|
22737
22800
|
let verification;
|
|
22738
22801
|
const verifyFirstWorker = (first) => verification ??= (async () => {
|
|
22739
22802
|
sessionBootMs = Date.now() - verifyStarted;
|
|
22740
22803
|
try {
|
|
22741
|
-
await measureBoxes(first.page);
|
|
22742
22804
|
const selectedScreenshot = first.launchCaptureMode === "screenshot";
|
|
22743
22805
|
if (selectedScreenshot || await beginFrameSessionNeedsScreenshotFallback(first)) {
|
|
22744
22806
|
forceScreenshotForChunk = true;
|
|
@@ -22923,7 +22985,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22923
22985
|
onFrameLanded: (frame) => overlap.current?.onFrameLanded(frame),
|
|
22924
22986
|
interleaveFrames: interleavesCapture(overlap.current !== null, options),
|
|
22925
22987
|
openAttempt,
|
|
22926
|
-
verifyFirstSession: forceScreenshot || !verifyInWorker ? void 0 : verifyFirstWorker
|
|
22988
|
+
verifyFirstSession: forceScreenshot || !verifyInWorker ? void 0 : verifyFirstWorker,
|
|
22989
|
+
prepareSession: forceScreenshot || !verifyInWorker ? void 0 : measureShare,
|
|
22990
|
+
onSessionUnprepared: () => sharedBoxes.fullSize()
|
|
22927
22991
|
}),
|
|
22928
22992
|
{ stall: frameStallRule(job, framesInChunk, void 0) }
|
|
22929
22993
|
).catch(async (captureError) => {
|
|
@@ -22935,7 +22999,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
22935
22999
|
},
|
|
22936
23000
|
resetForScreenshotRetry: () => {
|
|
22937
23001
|
rmSync18(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
22938
|
-
|
|
23002
|
+
sharedBoxes.fullSize();
|
|
22939
23003
|
mkdirSync22(framesDir, { recursive: true });
|
|
22940
23004
|
capturePerfs.length = 0;
|
|
22941
23005
|
captureAttempts.length = 0;
|
|
@@ -23030,6 +23094,18 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
23030
23094
|
};
|
|
23031
23095
|
writeFileSync14(perfPath, `${JSON.stringify(perfPayload, null, 2)}
|
|
23032
23096
|
`, "utf-8");
|
|
23097
|
+
log.info(
|
|
23098
|
+
"[renderChunk] capture sizing",
|
|
23099
|
+
chunkCaptureSizingLog({
|
|
23100
|
+
chunkIndex,
|
|
23101
|
+
framesEncoded,
|
|
23102
|
+
workers: chunkWorkerCount,
|
|
23103
|
+
machineSizing,
|
|
23104
|
+
maxCaptureWorkers: options?.maxCaptureWorkers,
|
|
23105
|
+
captureMode,
|
|
23106
|
+
captureStageMs
|
|
23107
|
+
})
|
|
23108
|
+
);
|
|
23033
23109
|
try {
|
|
23034
23110
|
rmSync18(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
23035
23111
|
rmSync18(videoFramesDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
package/dist/public-server.js
CHANGED
|
@@ -434,11 +434,8 @@ import { promisify } from "node:util";
|
|
|
434
434
|
import { Readable } from "node:stream";
|
|
435
435
|
import { join as join2, extname, resolve as resolve2, sep as sep2 } from "node:path";
|
|
436
436
|
import { injectScriptsAtHeadStart, injectScriptsIntoHtml } from "@hyperframes/core/compiler";
|
|
437
|
-
import {
|
|
438
|
-
import {
|
|
439
|
-
PREVIEW_FOR_ANOTHER_SITE_META,
|
|
440
|
-
serviceWorkerScriptFetch
|
|
441
|
-
} from "@hyperframes/core/studio-preview-mark";
|
|
437
|
+
import { markForAnotherSite } from "@hyperframes/core/compiler/html-document";
|
|
438
|
+
import { serviceWorkerScriptFetch } from "@hyperframes/core/studio-preview-mark";
|
|
442
439
|
import { fpsToNumber, terminalText as terminalText2 } from "@hyperframes/core";
|
|
443
440
|
import { isPrivateFileUnder as isPrivateFileUnder2, isStudioPrivatePath as isStudioPrivatePath2 } from "@hyperframes/core/safe-path";
|
|
444
441
|
import { stripSdrPngColourTags } from "@hyperframes/core/compiler/png-colour-tags";
|
|
@@ -1158,7 +1155,6 @@ var HF_BRIDGE_SCRIPT = `(function() {
|
|
|
1158
1155
|
if (bridge()) __realClearInterval(iv);
|
|
1159
1156
|
}, 50);
|
|
1160
1157
|
})();`;
|
|
1161
|
-
var OFFER_NO_FRAMING_SITE_AN_EDITING_PORT = `<meta name="${PREVIEW_FOR_ANOTHER_SITE_META}">`;
|
|
1162
1158
|
var RENDER_CAPTURE_MODE_SHIM = "globalThis.__HF_RENDER_CAPTURE_MODE = true;";
|
|
1163
1159
|
function closeFileServerSafely(fileServer, label, log = defaultLogger) {
|
|
1164
1160
|
try {
|
|
@@ -1257,7 +1253,7 @@ function createFileServer(options) {
|
|
|
1257
1253
|
html = injectScriptsAtHeadStart(html, preHeadScripts);
|
|
1258
1254
|
}
|
|
1259
1255
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
1260
|
-
html =
|
|
1256
|
+
html = markForAnotherSite(html);
|
|
1261
1257
|
return c.text(html, 200, { "Content-Type": contentType });
|
|
1262
1258
|
}
|
|
1263
1259
|
if (ext === ".png") {
|
|
@@ -13654,6 +13650,8 @@ async function runCaptureStage(input) {
|
|
|
13654
13650
|
pageErrorLines: workerPageErrors,
|
|
13655
13651
|
openAttempt: input.openAttempt,
|
|
13656
13652
|
verifyFirstSession: input.verifyFirstSession,
|
|
13653
|
+
prepareSession: input.prepareSession,
|
|
13654
|
+
onSessionUnprepared: input.onSessionUnprepared,
|
|
13657
13655
|
onProgress: (progress) => {
|
|
13658
13656
|
if (progress.latestWorkerPhase) {
|
|
13659
13657
|
if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
|
|
@@ -15822,7 +15820,11 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
15822
15820
|
} : void 0,
|
|
15823
15821
|
void 0,
|
|
15824
15822
|
options.cfg,
|
|
15825
|
-
{
|
|
15823
|
+
{
|
|
15824
|
+
verifyFirstSession: options.verifyFirstSession,
|
|
15825
|
+
prepareSession: options.prepareSession,
|
|
15826
|
+
onSessionUnprepared: options.onSessionUnprepared
|
|
15827
|
+
}
|
|
15826
15828
|
);
|
|
15827
15829
|
pushWorkerDedupPerfs(workerResults, options.dedupPerfs);
|
|
15828
15830
|
if (options.pageErrorLines) pushWorkerPageErrors(workerResults, options.pageErrorLines);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* Every other determinism toggle above is opt-in — only this primitive enables them.
|
|
33
33
|
* In-process renders (`executeRenderJob`) leave them off.
|
|
34
34
|
*/
|
|
35
|
-
import { assertSwiftShader, type CaptureOptions, type CaptureMode, type CapturePerfSummary, type CaptureSession, closeCaptureSession, createCaptureSession, type EngineConfig, initializeSession, probeBeginFrameLiveness, readWebGlVendorInfoFromCanvas } from "@hyperframes/engine";
|
|
35
|
+
import { assertSwiftShader, type CaptureOptions, type CaptureMode, type CapturePerfSummary, type CaptureSession, type WorkerSizing, closeCaptureSession, createCaptureSession, type EngineConfig, initializeSession, type ShownBoxPart, probeBeginFrameLiveness, readWebGlVendorInfoFromCanvas, type ShownBox } from "@hyperframes/engine";
|
|
36
36
|
import { type ChunkSliceJson, type LockedRenderConfig } from "../render/stages/freezePlan.js";
|
|
37
37
|
import { type PlanVideosJson } from "./shared.js";
|
|
38
38
|
export { CHUNK_FRAME_RANGE_INVALID, CHUNK_INDEX_OUT_OF_RANGE, createChunkVideoFrameInjectorFactory, extractDeferredVideoFramesForChunk, FFMPEG_VERSION_MISMATCH, INVALID_VIDEO_METADATA, MISSING_PLAN_ARTIFACT, MISSING_RUNTIME_ENV_SNAPSHOT, PLAN_HASH_MISMATCH, rebuildExtractedFramesFromPlanDir, RenderChunkValidationError, } from "./chunkFrames.js";
|
|
@@ -119,6 +119,16 @@ export interface RenderChunkOptions {
|
|
|
119
119
|
export declare function interleavesCapture(overlapping: boolean, options?: RenderChunkOptions): boolean;
|
|
120
120
|
/** Capture browsers for a chunk: the machine-wide sizing, raised by the runtime's budget. */
|
|
121
121
|
export declare function resolveChunkCaptureWorkers(framesInChunk: number, machineSized: number, maxCaptureWorkers: number | undefined): number;
|
|
122
|
+
/** One chunk's capture in a line: how many browsers it ran and why, and what a frame cost in wall time. */
|
|
123
|
+
export declare function chunkCaptureSizingLog(input: {
|
|
124
|
+
chunkIndex: number;
|
|
125
|
+
framesEncoded: number;
|
|
126
|
+
workers: number;
|
|
127
|
+
machineSizing: Pick<WorkerSizing, "workers" | "boundBy" | "cpuBasedWorkers" | "memoryBasedWorkers" | "frameBasedWorkers">;
|
|
128
|
+
maxCaptureWorkers: number | undefined;
|
|
129
|
+
captureMode: CaptureMode;
|
|
130
|
+
captureStageMs: number;
|
|
131
|
+
}): Record<string, string | number | null>;
|
|
122
132
|
/** The frames a chunk renders: its slice, or a validated sub-range of it. */
|
|
123
133
|
export declare function resolveChunkFrameRange(slice: ChunkSliceJson, chunkIndex: number, frameRange: ChunkFrameRange | undefined): ChunkFrameRange;
|
|
124
134
|
/** Compatibility-safe adapter seam for built-in or injected chunk renderers. */
|
|
@@ -166,6 +176,27 @@ export declare function runCaptureWithScreenshotFallback<T>(input: {
|
|
|
166
176
|
* and frame zero. `true` means the entire chunk should use screenshot mode.
|
|
167
177
|
*/
|
|
168
178
|
export declare function beginFrameSessionNeedsScreenshotFallback(session: Pick<CaptureSession, "page" | "launchCaptureMode" | "beginFrameTimeTicks" | "beginFrameIntervalMs">, probe?: typeof probeBeginFrameLiveness): Promise<boolean>;
|
|
179
|
+
/**
|
|
180
|
+
* Joins the shares of the box-measuring pass that a chunk's capture workers each run on their own page.
|
|
181
|
+
* `onDone` gets the merged boxes once every worker of one pool has reported, or none when the chunk extracts
|
|
182
|
+
* at full size. It runs once; later shares are dropped.
|
|
183
|
+
*/
|
|
184
|
+
export declare function createSharedBoxMeasure(onDone: (boxes: Map<string, ShownBox> | undefined, pass?: {
|
|
185
|
+
workers: number;
|
|
186
|
+
frames: number;
|
|
187
|
+
durationMs: number;
|
|
188
|
+
slowestShareMs: number;
|
|
189
|
+
}) => void): {
|
|
190
|
+
add: (worker: {
|
|
191
|
+
workerId: number;
|
|
192
|
+
workerCount: number;
|
|
193
|
+
}, part: ShownBoxPart, cost: {
|
|
194
|
+
frames: number;
|
|
195
|
+
durationMs: number;
|
|
196
|
+
}) => void;
|
|
197
|
+
fullSize: () => void;
|
|
198
|
+
settled: () => boolean;
|
|
199
|
+
};
|
|
169
200
|
/**
|
|
170
201
|
* Re-export the runtime-env apply helper so adapters that import only
|
|
171
202
|
* this subpath can prime `process.env` before instantiating their own
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* `renderOrchestrator.ts`, which imports the stage (a cycle that resolves at module init). The
|
|
31
31
|
* capture helpers should move to a shared module so stages stop reaching back into the orchestrator.
|
|
32
32
|
*/
|
|
33
|
-
import { type BeforeCaptureHook, type CaptureOptions, type CapturePerfSummary, type CaptureSession, type EngineConfig, type LandedFrame } from "@hyperframes/engine";
|
|
33
|
+
import { type BeforeCaptureHook, type CaptureOptions, type CapturePerfSummary, type CaptureSession, type EngineConfig, type LandedFrame, type ParallelCaptureHooks } from "@hyperframes/engine";
|
|
34
34
|
import type { FileServerHandle } from "../../fileServer.js";
|
|
35
35
|
import type { ProducerLogger } from "../../../logger.js";
|
|
36
36
|
import { type CaptureAttemptSummary, type ProgressCallback, type RenderConfig, type RenderJob } from "../../renderOrchestrator.js";
|
|
@@ -89,6 +89,8 @@ export interface CaptureStageInput {
|
|
|
89
89
|
/** Each capture attempt opens one, so a stalled attempt is retried by the ladders below. */
|
|
90
90
|
openAttempt?: OpenStallAttempt;
|
|
91
91
|
verifyFirstSession?: (session: CaptureSession) => Promise<void>;
|
|
92
|
+
prepareSession?: ParallelCaptureHooks["prepareSession"];
|
|
93
|
+
onSessionUnprepared?: ParallelCaptureHooks["onSessionUnprepared"];
|
|
92
94
|
}
|
|
93
95
|
export interface CaptureStageResult {
|
|
94
96
|
/** Final worker count after any adaptive retry. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExpectedOutputDimensions } from "./render/outputDimensions.js";
|
|
2
2
|
import { type CanvasResolution, type Fps, type FpsInput, type HfVfxCapture } from "@hyperframes/core";
|
|
3
3
|
import type { CompileForRenderOptions } from "./htmlCompiler.js";
|
|
4
|
-
import { type EngineConfig, type ExtractionPhaseBreakdown, type VideoFrameFormat, closeCaptureSession, initializeSession, type CaptureOptions, type CaptureVideoMetadataHint, type CaptureSession, type BeforeCaptureHook, type ProresProfile, type ParallelProgress, type WorkerTask, type CapturePerfSummary, type CaptureWarning, type SubTimelineWaitOutcome, type WorkerSizing, type StaticVerificationOutcome, explainDrawElementDisabled, type CaptureFailureKind, displaySize, type ChromaSubsampling, type MotionBlurOptions, type PageMotionBlurSummary } from "@hyperframes/engine";
|
|
4
|
+
import { type EngineConfig, type ExtractionPhaseBreakdown, type VideoFrameFormat, closeCaptureSession, initializeSession, type CaptureOptions, type CaptureVideoMetadataHint, type CaptureSession, type BeforeCaptureHook, type ProresProfile, type ParallelProgress, type WorkerTask, type CapturePerfSummary, type CaptureWarning, type SubTimelineWaitOutcome, type WorkerSizing, type StaticVerificationOutcome, explainDrawElementDisabled, type CaptureFailureKind, displaySize, type ChromaSubsampling, type MotionBlurOptions, type PageMotionBlurSummary, type ParallelCaptureHooks } from "@hyperframes/engine";
|
|
5
5
|
import { type ReferenceBackgroundResult } from "@hyperframes/engine";
|
|
6
6
|
import { type ProducerLogger } from "../logger.js";
|
|
7
7
|
import { type RenderOutputFormat } from "./render/renderFormat.js";
|
|
@@ -648,6 +648,8 @@ export declare function executeDiskCaptureWithAdaptiveRetry(options: {
|
|
|
648
648
|
pageErrorLines?: string[];
|
|
649
649
|
openAttempt?: OpenStallAttempt;
|
|
650
650
|
verifyFirstSession?: (session: CaptureSession) => Promise<void>;
|
|
651
|
+
prepareSession?: ParallelCaptureHooks["prepareSession"];
|
|
652
|
+
onSessionUnprepared?: ParallelCaptureHooks["onSessionUnprepared"];
|
|
651
653
|
}): Promise<CaptureAttemptSummary[]>;
|
|
652
654
|
export type RenderConfigInput = Omit<RenderConfig, "fps"> & {
|
|
653
655
|
fps: FpsInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"postcss": "^8.4.0",
|
|
36
36
|
"puppeteer": "~25.13.0",
|
|
37
37
|
"puppeteer-core": "^25.13.0",
|
|
38
|
-
"@hyperframes/core": "0.
|
|
39
|
-
"@hyperframes/engine": "0.
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
43
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.10.1",
|
|
39
|
+
"@hyperframes/engine": "0.10.1",
|
|
40
|
+
"@hyperframes/lint": "0.10.1",
|
|
41
|
+
"@hyperframes/share": "0.10.1",
|
|
42
|
+
"@hyperframes/parsers": "0.10.1",
|
|
43
|
+
"@hyperframes/studio-server": "0.10.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.0.10",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"tsx": "^4.21.0",
|
|
50
50
|
"typescript": "^5.7.2",
|
|
51
51
|
"vitest": "^4.1.12",
|
|
52
|
-
"@hyperframes/aws-lambda": "0.
|
|
52
|
+
"@hyperframes/aws-lambda": "0.10.1"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
|
-
"node": ">=22"
|
|
55
|
+
"node": ">=22.19.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "bun run build:hf-early-stub && bun run --cwd ../.. build:hyperframes-runtime:modular && node build.mjs",
|