@hyperframes/producer 0.9.97 → 0.9.99
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 +85 -23
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +66 -66
- package/dist/index.js +149 -59
- package/dist/public-server.js +149 -59
- package/dist/services/render/stages/captureStreamingStage.d.ts +1 -0
- package/dist/services/render/videoFrameCoverage.d.ts +15 -0
- package/package.json +8 -7
package/dist/distributed.js
CHANGED
|
@@ -385,6 +385,7 @@ import { fromEmptyFolder } from "@hyperframes/parsers/ff-binaries";
|
|
|
385
385
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
386
386
|
|
|
387
387
|
// src/services/fileServer.ts
|
|
388
|
+
import { referencedFontResponse } from "@hyperframes/share/referencedFont.mjs";
|
|
388
389
|
import { Hono } from "hono";
|
|
389
390
|
import { serve } from "@hono/node-server";
|
|
390
391
|
import {
|
|
@@ -1093,6 +1094,8 @@ function createFileServer(options) {
|
|
|
1093
1094
|
if (file) break;
|
|
1094
1095
|
}
|
|
1095
1096
|
if (!file) {
|
|
1097
|
+
const font = await referencedFontResponse(projectDir, new URL(c.req.url), c.req.raw.method);
|
|
1098
|
+
if (font) return font;
|
|
1096
1099
|
if (!/favicon\.ico$/i.test(requestPath)) {
|
|
1097
1100
|
console.warn(`[FileServer] 404 Not Found: ${terminalText2(boundedPageText(requestPath))}`);
|
|
1098
1101
|
}
|
|
@@ -1832,6 +1835,19 @@ function captureModeLabel(mode) {
|
|
|
1832
1835
|
if (mode === "beginframe") return "BeginFrame";
|
|
1833
1836
|
return "screenshot";
|
|
1834
1837
|
}
|
|
1838
|
+
var OPENING_CAPTURE_SESSION = {
|
|
1839
|
+
captureMode: "screenshot",
|
|
1840
|
+
captureStep: "opening the capture session"
|
|
1841
|
+
};
|
|
1842
|
+
async function openCaptureSessionWithinBudget(withinInitBudget, opening) {
|
|
1843
|
+
try {
|
|
1844
|
+
return await withinInitBudget(opening, OPENING_CAPTURE_SESSION);
|
|
1845
|
+
} catch (error) {
|
|
1846
|
+
void opening.then(closeCaptureSession).catch(() => {
|
|
1847
|
+
});
|
|
1848
|
+
throw error;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1835
1851
|
var SequentialCaptureStallError = class extends Error {
|
|
1836
1852
|
captureMode;
|
|
1837
1853
|
constructor(session, stallTimeoutMs, frameIndex, totalFrames) {
|
|
@@ -1845,20 +1861,44 @@ var SequentialCaptureStallError = class extends Error {
|
|
|
1845
1861
|
};
|
|
1846
1862
|
function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
1847
1863
|
return new Promise((resolve11, reject) => {
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1850
|
-
signal?.aborted ? new Error(
|
|
1851
|
-
`[Render] Sequential ${captureModeLabel(input.session.captureMode)} capture aborted while a capture call was in flight (frame ${input.frameIndex}/${input.totalFrames}).`
|
|
1852
|
-
) : new SequentialCaptureStallError(
|
|
1853
|
-
input.session,
|
|
1854
|
-
input.stallTimeoutMs,
|
|
1855
|
-
input.frameIndex,
|
|
1856
|
-
input.totalFrames
|
|
1857
|
-
)
|
|
1864
|
+
const abortError3 = () => new Error(
|
|
1865
|
+
`[Render] Sequential ${captureModeLabel(input.session.captureMode)} capture aborted while a capture call was in flight (frame ${input.frameIndex}/${input.totalFrames}).`
|
|
1858
1866
|
);
|
|
1867
|
+
if (signal?.aborted) {
|
|
1868
|
+
promise.catch(() => {
|
|
1869
|
+
});
|
|
1870
|
+
reject(abortError3());
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
const clock = createStallClock();
|
|
1874
|
+
let settled = false;
|
|
1875
|
+
let timer;
|
|
1876
|
+
const cleanup = () => {
|
|
1877
|
+
clearTimeout(timer);
|
|
1878
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1879
|
+
};
|
|
1880
|
+
const onAbort = () => {
|
|
1881
|
+
if (settled) return;
|
|
1882
|
+
settled = true;
|
|
1883
|
+
cleanup();
|
|
1884
|
+
reject(abortError3());
|
|
1885
|
+
};
|
|
1886
|
+
const trip = () => {
|
|
1887
|
+
if (settled) return;
|
|
1888
|
+
settled = true;
|
|
1889
|
+
cleanup();
|
|
1890
|
+
reject(
|
|
1891
|
+
signal?.aborted ? abortError3() : new SequentialCaptureStallError(
|
|
1892
|
+
input.session,
|
|
1893
|
+
input.stallTimeoutMs,
|
|
1894
|
+
input.frameIndex,
|
|
1895
|
+
input.totalFrames
|
|
1896
|
+
)
|
|
1897
|
+
);
|
|
1898
|
+
};
|
|
1899
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1859
1900
|
const deadline = Math.max(0, deadlineMs);
|
|
1860
1901
|
let wait = Math.min(deadline, DE_STALL_POLL_MS);
|
|
1861
|
-
let timer;
|
|
1862
1902
|
const look = () => {
|
|
1863
1903
|
const idle = clock.idle(wait);
|
|
1864
1904
|
if (idle >= deadline) return trip();
|
|
@@ -1868,11 +1908,15 @@ function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
|
1868
1908
|
timer = setTimeout(look, wait);
|
|
1869
1909
|
promise.then(
|
|
1870
1910
|
(value) => {
|
|
1871
|
-
|
|
1911
|
+
if (settled) return;
|
|
1912
|
+
settled = true;
|
|
1913
|
+
cleanup();
|
|
1872
1914
|
resolve11(value);
|
|
1873
1915
|
},
|
|
1874
1916
|
(error) => {
|
|
1875
|
-
|
|
1917
|
+
if (settled) return;
|
|
1918
|
+
settled = true;
|
|
1919
|
+
cleanup();
|
|
1876
1920
|
reject(error);
|
|
1877
1921
|
}
|
|
1878
1922
|
);
|
|
@@ -8637,25 +8681,26 @@ async function runSequentialDiskCapture(input, captureOptions, captureCfg, check
|
|
|
8637
8681
|
assertNotAborted();
|
|
8638
8682
|
attempt?.throwIfAborted();
|
|
8639
8683
|
};
|
|
8684
|
+
const attemptSignal = combineAbortSignals(abortSignal, attempt);
|
|
8685
|
+
const initBudget = { frameIndex: resumeFrom, totalFrames, abortSignal: attemptSignal };
|
|
8640
8686
|
const videoInjector = createRenderVideoFrameInjector();
|
|
8641
|
-
const session = probeSession ?? await
|
|
8642
|
-
|
|
8687
|
+
const session = probeSession ?? await openSequentialDiskSession({
|
|
8688
|
+
assertAttemptActive,
|
|
8689
|
+
initBudget,
|
|
8690
|
+
fileServerUrl: fileServer.url,
|
|
8643
8691
|
framesDir,
|
|
8644
8692
|
captureOptions,
|
|
8645
8693
|
videoInjector,
|
|
8646
|
-
captureCfg
|
|
8647
|
-
|
|
8694
|
+
captureCfg,
|
|
8695
|
+
attemptSignal
|
|
8696
|
+
});
|
|
8648
8697
|
captureBeyondViewport = session.options.captureBeyondViewport;
|
|
8649
8698
|
try {
|
|
8650
8699
|
if (probeSession) {
|
|
8651
8700
|
await prepareCaptureSessionForReuse3(session, framesDir, videoInjector);
|
|
8652
8701
|
probeSession = null;
|
|
8653
8702
|
}
|
|
8654
|
-
await ensureSessionReady(session,
|
|
8655
|
-
frameIndex: resumeFrom,
|
|
8656
|
-
totalFrames,
|
|
8657
|
-
abortSignal: input.abortSignal
|
|
8658
|
-
});
|
|
8703
|
+
await ensureSessionReady(session, initBudget);
|
|
8659
8704
|
assertAttemptActive();
|
|
8660
8705
|
lastBrowserConsole = session.browserConsoleBuffer;
|
|
8661
8706
|
await captureSessionFrames(session, {
|
|
@@ -8707,9 +8752,26 @@ function planTransientResume(error, ctx) {
|
|
|
8707
8752
|
if (!firstMissing) return null;
|
|
8708
8753
|
return isTransientCaptureRetryEligible(failure.kind, missing, ctx.retriesUsed) ? firstMissing.startFrame : null;
|
|
8709
8754
|
}
|
|
8755
|
+
function combineAbortSignals(first, second) {
|
|
8756
|
+
if (first && second) return AbortSignal.any([first, second]);
|
|
8757
|
+
return second ?? first;
|
|
8758
|
+
}
|
|
8759
|
+
async function openSequentialDiskSession(args) {
|
|
8760
|
+
args.assertAttemptActive();
|
|
8761
|
+
return openCaptureSessionWithinBudget(
|
|
8762
|
+
createSessionInitBudget(args.initBudget),
|
|
8763
|
+
createCaptureSession5(
|
|
8764
|
+
args.fileServerUrl,
|
|
8765
|
+
args.framesDir,
|
|
8766
|
+
args.captureOptions,
|
|
8767
|
+
args.videoInjector,
|
|
8768
|
+
{ ...args.captureCfg, signal: args.attemptSignal }
|
|
8769
|
+
)
|
|
8770
|
+
);
|
|
8771
|
+
}
|
|
8710
8772
|
async function ensureSessionReady(session, budget) {
|
|
8711
8773
|
if (!session.isInitialized) {
|
|
8712
|
-
await initializeSession5(session);
|
|
8774
|
+
await createSessionInitBudget(budget)(initializeSession5(session), session);
|
|
8713
8775
|
return;
|
|
8714
8776
|
}
|
|
8715
8777
|
if (process.env.PRODUCER_EXPERIMENTAL_FAST_CAPTURE === "true") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "0.1.0",
|
|
3
3
|
"buildId": "dev",
|
|
4
|
-
"sha256": "
|
|
4
|
+
"sha256": "42385bb89dcd0cb34d9b3a60cc195da961d989c904f7bc483a3186f6da01ee43",
|
|
5
5
|
"artifacts": {
|
|
6
6
|
"iife": "hyperframe.runtime.iife.js",
|
|
7
7
|
"esm": "hyperframe.runtime.mjs"
|