@hyperframes/producer 0.9.106 → 0.9.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -355,6 +355,7 @@ import {
|
|
|
355
355
|
getDrawElementVerificationDetails,
|
|
356
356
|
augmentProtocolTimeoutError,
|
|
357
357
|
augmentPageNavigationTimeoutError,
|
|
358
|
+
createCacheLease,
|
|
358
359
|
displaySize
|
|
359
360
|
} from "@hyperframes/engine";
|
|
360
361
|
import {
|
|
@@ -2092,94 +2093,21 @@ import {
|
|
|
2092
2093
|
mkdirSync as mkdirSync2,
|
|
2093
2094
|
readFileSync as readFileSync2,
|
|
2094
2095
|
readdirSync,
|
|
2095
|
-
readlinkSync as readlinkSync2,
|
|
2096
2096
|
rmSync as rmSync2,
|
|
2097
2097
|
writeFileSync as writeFileSync2
|
|
2098
2098
|
} from "node:fs";
|
|
2099
|
-
import {
|
|
2100
|
-
import {
|
|
2101
|
-
import { basename as basename4, dirname as dirname3, join as join5, win32 } from "node:path";
|
|
2099
|
+
import { basename as basename4, dirname as dirname3, join as join5 } from "node:path";
|
|
2100
|
+
import { ownerRecordState, processOwnerRecord } from "@hyperframes/engine";
|
|
2102
2101
|
import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
|
|
2103
2102
|
import { createStagingDir, toWin32LongPath } from "@hyperframes/core/atomic-file";
|
|
2104
2103
|
var OWNER_FILE = "owner.json";
|
|
2105
2104
|
var TRANSACTION_BACKUP = "backup";
|
|
2106
2105
|
var RENDER_JOB_DIR = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
|
|
2107
|
-
var machineIdRead;
|
|
2108
|
-
function machineId() {
|
|
2109
|
-
const read2 = (file, args, pattern) => {
|
|
2110
|
-
try {
|
|
2111
|
-
const out = execFileSync(file, args, {
|
|
2112
|
-
encoding: "utf-8",
|
|
2113
|
-
timeout: 2e3,
|
|
2114
|
-
windowsHide: true
|
|
2115
|
-
});
|
|
2116
|
-
return pattern.exec(out)?.[1];
|
|
2117
|
-
} catch {
|
|
2118
|
-
return void 0;
|
|
2119
|
-
}
|
|
2120
|
-
};
|
|
2121
|
-
if (machineIdRead?.platform === process.platform) return machineIdRead.id;
|
|
2122
|
-
const systemRoot = process.env.SystemRoot;
|
|
2123
|
-
machineIdRead = {
|
|
2124
|
-
platform: process.platform,
|
|
2125
|
-
id: process.platform === "darwin" ? read2(
|
|
2126
|
-
"/usr/sbin/ioreg",
|
|
2127
|
-
["-rd1", "-c", "IOPlatformExpertDevice"],
|
|
2128
|
-
/"IOPlatformUUID" = "([^"]+)"/
|
|
2129
|
-
) : process.platform === "win32" && systemRoot && /^[A-Za-z]:\\/.test(systemRoot) ? read2(
|
|
2130
|
-
win32.join(systemRoot, "System32", "reg.exe"),
|
|
2131
|
-
["query", "HKLM\\SOFTWARE\\Microsoft\\Cryptography", "/v", "MachineGuid"],
|
|
2132
|
-
/MachineGuid\s+REG_SZ\s+(\S+)/
|
|
2133
|
-
) : void 0
|
|
2134
|
-
};
|
|
2135
|
-
return machineIdRead.id;
|
|
2136
|
-
}
|
|
2137
|
-
function pidScope() {
|
|
2138
|
-
const attempt = (read2) => {
|
|
2139
|
-
try {
|
|
2140
|
-
return read2();
|
|
2141
|
-
} catch {
|
|
2142
|
-
return void 0;
|
|
2143
|
-
}
|
|
2144
|
-
};
|
|
2145
|
-
const bootId = attempt(() => readFileSync2("/proc/sys/kernel/random/boot_id", "utf-8").trim());
|
|
2146
|
-
return {
|
|
2147
|
-
host: hostname(),
|
|
2148
|
-
// Without /proc (macOS, Windows) the boot time in seconds stands in for the boot id, on this machine's own id.
|
|
2149
|
-
boot: bootId ?? attempt(() => `s:${Math.round(Date.now() / 1e3 - uptime())}`),
|
|
2150
|
-
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid")),
|
|
2151
|
-
machine: bootId === void 0 ? machineId() : void 0
|
|
2152
|
-
};
|
|
2153
|
-
}
|
|
2154
2106
|
function createOwnedRenderDir(prefix) {
|
|
2155
2107
|
const dir = createStagingDir(dirname3(prefix), basename4(prefix));
|
|
2156
|
-
|
|
2157
|
-
writeFileSync2(toWin32LongPath(join5(dir, OWNER_FILE)), JSON.stringify(owner));
|
|
2108
|
+
writeFileSync2(toWin32LongPath(join5(dir, OWNER_FILE)), JSON.stringify(processOwnerRecord()));
|
|
2158
2109
|
return dir;
|
|
2159
2110
|
}
|
|
2160
|
-
function alive(pid) {
|
|
2161
|
-
try {
|
|
2162
|
-
process.kill(pid, 0);
|
|
2163
|
-
return true;
|
|
2164
|
-
} catch (error) {
|
|
2165
|
-
return error.code === "EPERM";
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
function knownPidScope() {
|
|
2169
|
-
const scope = pidScope();
|
|
2170
|
-
const unknown = scope.boot === void 0 || process.platform === "linux" && scope.pidns === void 0 || scope.boot.startsWith("s:") && scope.machine === void 0;
|
|
2171
|
-
return unknown ? void 0 : scope;
|
|
2172
|
-
}
|
|
2173
|
-
function sameBoot(stamped, current) {
|
|
2174
|
-
if (stamped === current) return true;
|
|
2175
|
-
const seconds = (boot) => typeof boot === "string" ? /^s:(\d+)$/.exec(boot)?.[1] : void 0;
|
|
2176
|
-
const [a, b] = [seconds(stamped), seconds(current)];
|
|
2177
|
-
return a !== void 0 && b !== void 0 && Math.abs(Number(a) - Number(b)) <= 2;
|
|
2178
|
-
}
|
|
2179
|
-
function inThisPidScope(owner) {
|
|
2180
|
-
const scope = knownPidScope();
|
|
2181
|
-
return scope !== void 0 && owner.host === scope.host && sameBoot(owner.boot, scope.boot) && owner.pidns === scope.pidns && owner.machine === scope.machine;
|
|
2182
|
-
}
|
|
2183
2111
|
function ownerState(dir) {
|
|
2184
2112
|
let owner;
|
|
2185
2113
|
try {
|
|
@@ -2187,11 +2115,7 @@ function ownerState(dir) {
|
|
|
2187
2115
|
} catch (error) {
|
|
2188
2116
|
return error.code === "ENOENT" ? "none" : "unknown";
|
|
2189
2117
|
}
|
|
2190
|
-
|
|
2191
|
-
if (!inThisPidScope(owner) || typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) {
|
|
2192
|
-
return "unknown";
|
|
2193
|
-
}
|
|
2194
|
-
return alive(pid) ? "live" : "gone";
|
|
2118
|
+
return ownerRecordState(owner);
|
|
2195
2119
|
}
|
|
2196
2120
|
function newestWriteMs(path) {
|
|
2197
2121
|
const stat = lstatSync2(path);
|
|
@@ -11757,14 +11681,14 @@ async function runProbeStage(input) {
|
|
|
11757
11681
|
probeSession.beginFrameTimeTicks,
|
|
11758
11682
|
probeSession.beginFrameIntervalMs
|
|
11759
11683
|
);
|
|
11760
|
-
const
|
|
11684
|
+
const alive = await probeBeginFrameLiveness(
|
|
11761
11685
|
probeSession.page,
|
|
11762
11686
|
probeTimeoutMs,
|
|
11763
11687
|
probeTick,
|
|
11764
11688
|
probeSession.beginFrameIntervalMs
|
|
11765
11689
|
);
|
|
11766
11690
|
assertNotAborted();
|
|
11767
|
-
if (
|
|
11691
|
+
if (alive) {
|
|
11768
11692
|
log.info("BeginFrame liveness probe passed", {
|
|
11769
11693
|
probeMs: Date.now() - livenessStart
|
|
11770
11694
|
});
|
|
@@ -12478,7 +12402,8 @@ async function runExtractVideosStage(input) {
|
|
|
12478
12402
|
shownBoxes,
|
|
12479
12403
|
urlByAbsentLocalPath,
|
|
12480
12404
|
audioDownloadDir,
|
|
12481
|
-
skipFrameExtractionIds = []
|
|
12405
|
+
skipFrameExtractionIds = [],
|
|
12406
|
+
cacheLease
|
|
12482
12407
|
} = input;
|
|
12483
12408
|
const stage2Start = Date.now();
|
|
12484
12409
|
const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
|
|
@@ -12598,6 +12523,7 @@ async function runExtractVideosStage(input) {
|
|
|
12598
12523
|
contentKeyedDirs: [join26(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
12599
12524
|
urlByAbsentLocalPath,
|
|
12600
12525
|
assetRoots,
|
|
12526
|
+
cacheLease,
|
|
12601
12527
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
12602
12528
|
framesPlanned += planned;
|
|
12603
12529
|
framesDone += done;
|
|
@@ -16957,6 +16883,8 @@ async function executeRenderPipeline(input) {
|
|
|
16957
16883
|
reason
|
|
16958
16884
|
});
|
|
16959
16885
|
}
|
|
16886
|
+
const cacheLease = createCacheLease();
|
|
16887
|
+
execution.defer("release extraction cache lease", () => cacheLease.release());
|
|
16960
16888
|
const extractResult = await observeRenderStage(
|
|
16961
16889
|
observability,
|
|
16962
16890
|
"video_extract",
|
|
@@ -16974,6 +16902,7 @@ async function executeRenderPipeline(input) {
|
|
|
16974
16902
|
assertNotAborted,
|
|
16975
16903
|
// Local staging can use links; distributed plan() alone requires real copies.
|
|
16976
16904
|
materializeSymlinks: false,
|
|
16905
|
+
cacheLease,
|
|
16977
16906
|
deferRangeExtraction: windowVideoFrames ? true : void 0,
|
|
16978
16907
|
shownBoxes,
|
|
16979
16908
|
onProgress
|
|
@@ -24974,18 +24903,18 @@ function hostnameOf(host) {
|
|
|
24974
24903
|
return null;
|
|
24975
24904
|
}
|
|
24976
24905
|
}
|
|
24977
|
-
function isAllowedBrowserHostname(
|
|
24978
|
-
if (!
|
|
24979
|
-
if (
|
|
24980
|
-
if (isIP(
|
|
24981
|
-
return allowed.has(
|
|
24906
|
+
function isAllowedBrowserHostname(hostname, allowed) {
|
|
24907
|
+
if (!hostname) return false;
|
|
24908
|
+
if (hostname === "localhost" || hostname.endsWith(".localhost")) return true;
|
|
24909
|
+
if (isIP(hostname.replace(/^\[|\]$/g, "")) !== 0) return true;
|
|
24910
|
+
return allowed.has(hostname);
|
|
24982
24911
|
}
|
|
24983
24912
|
function allowedHostnames(options) {
|
|
24984
24913
|
const fromEnv = (process.env.PRODUCER_ALLOWED_HOSTS ?? "").split(",");
|
|
24985
24914
|
const names = /* @__PURE__ */ new Set();
|
|
24986
24915
|
for (const entry of [...options.allowedHosts ?? [], ...fromEnv]) {
|
|
24987
|
-
const
|
|
24988
|
-
if (
|
|
24916
|
+
const hostname = entry.trim() ? hostnameOf(entry.trim()) : null;
|
|
24917
|
+
if (hostname) names.add(hostname);
|
|
24989
24918
|
}
|
|
24990
24919
|
return names;
|
|
24991
24920
|
}
|
|
@@ -24999,8 +24928,8 @@ function hasBearerToken(c, token) {
|
|
|
24999
24928
|
digest(`Bearer ${token}`)
|
|
25000
24929
|
);
|
|
25001
24930
|
}
|
|
25002
|
-
function isLoopbackHostname(
|
|
25003
|
-
const host =
|
|
24931
|
+
function isLoopbackHostname(hostname) {
|
|
24932
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
25004
24933
|
return host === "localhost" || host === "::1" || isIP(host) === 4 && host.startsWith("127.");
|
|
25005
24934
|
}
|
|
25006
24935
|
function isDisallowedBrowserHost(c, allowed) {
|
|
@@ -25069,12 +24998,12 @@ function onEscapedRejection(reason, log) {
|
|
|
25069
24998
|
});
|
|
25070
24999
|
scope?.fail(err);
|
|
25071
25000
|
}
|
|
25072
|
-
function serverAuth(options,
|
|
25001
|
+
function serverAuth(options, hostname, port) {
|
|
25073
25002
|
const configured = resolveAuthToken(options);
|
|
25074
25003
|
if (configured) return { token: configured };
|
|
25075
|
-
if (!isLoopbackHostname(
|
|
25004
|
+
if (!isLoopbackHostname(hostname)) {
|
|
25076
25005
|
throw new Error(
|
|
25077
|
-
`Refusing to listen on ${
|
|
25006
|
+
`Refusing to listen on ${hostname} without an auth token. Set authToken or PRODUCER_AUTH_TOKEN, or listen on a loopback address.`
|
|
25078
25007
|
);
|
|
25079
25008
|
}
|
|
25080
25009
|
const file = resolve14(
|
|
@@ -25089,11 +25018,11 @@ function serverAuth(options, hostname2, port) {
|
|
|
25089
25018
|
}
|
|
25090
25019
|
function startServer(options = {}) {
|
|
25091
25020
|
const port = options.port ?? parseInt(process.env.PRODUCER_PORT ?? "9847", 10);
|
|
25092
|
-
const
|
|
25021
|
+
const hostname = options.hostname || process.env.PRODUCER_HOST || "127.0.0.1";
|
|
25093
25022
|
const log = options.logger ?? defaultLogger;
|
|
25094
|
-
const auth = serverAuth(options,
|
|
25023
|
+
const auth = serverAuth(options, hostname, port);
|
|
25095
25024
|
const app = createProducerApp({ ...options, authToken: auth.token });
|
|
25096
|
-
const server = serve2({ fetch: app.fetch, port, hostname
|
|
25025
|
+
const server = serve2({ fetch: app.fetch, port, hostname }, (info) => {
|
|
25097
25026
|
const address = info.family === "IPv6" ? `[${info.address}]` : info.address;
|
|
25098
25027
|
log.info(`Listening on http://${address}:${info.port}`);
|
|
25099
25028
|
if (auth.generatedFile) {
|
package/dist/public-server.js
CHANGED
|
@@ -397,6 +397,7 @@ import {
|
|
|
397
397
|
getDrawElementVerificationDetails,
|
|
398
398
|
augmentProtocolTimeoutError,
|
|
399
399
|
augmentPageNavigationTimeoutError,
|
|
400
|
+
createCacheLease,
|
|
400
401
|
displaySize
|
|
401
402
|
} from "@hyperframes/engine";
|
|
402
403
|
import {
|
|
@@ -2131,93 +2132,20 @@ import {
|
|
|
2131
2132
|
mkdirSync as mkdirSync2,
|
|
2132
2133
|
readFileSync as readFileSync2,
|
|
2133
2134
|
readdirSync,
|
|
2134
|
-
readlinkSync as readlinkSync2,
|
|
2135
2135
|
rmSync as rmSync2,
|
|
2136
2136
|
writeFileSync as writeFileSync2
|
|
2137
2137
|
} from "node:fs";
|
|
2138
|
-
import {
|
|
2139
|
-
import {
|
|
2140
|
-
import { basename as basename4, dirname as dirname3, join as join5, win32 } from "node:path";
|
|
2138
|
+
import { basename as basename4, dirname as dirname3, join as join5 } from "node:path";
|
|
2139
|
+
import { ownerRecordState, processOwnerRecord } from "@hyperframes/engine";
|
|
2141
2140
|
import { RENDER_TEMP_DIR } from "@hyperframes/core/project-folders";
|
|
2142
2141
|
import { createStagingDir, toWin32LongPath } from "@hyperframes/core/atomic-file";
|
|
2143
2142
|
var OWNER_FILE = "owner.json";
|
|
2144
2143
|
var TRANSACTION_BACKUP = "backup";
|
|
2145
|
-
var machineIdRead;
|
|
2146
|
-
function machineId() {
|
|
2147
|
-
const read2 = (file, args, pattern) => {
|
|
2148
|
-
try {
|
|
2149
|
-
const out = execFileSync(file, args, {
|
|
2150
|
-
encoding: "utf-8",
|
|
2151
|
-
timeout: 2e3,
|
|
2152
|
-
windowsHide: true
|
|
2153
|
-
});
|
|
2154
|
-
return pattern.exec(out)?.[1];
|
|
2155
|
-
} catch {
|
|
2156
|
-
return void 0;
|
|
2157
|
-
}
|
|
2158
|
-
};
|
|
2159
|
-
if (machineIdRead?.platform === process.platform) return machineIdRead.id;
|
|
2160
|
-
const systemRoot = process.env.SystemRoot;
|
|
2161
|
-
machineIdRead = {
|
|
2162
|
-
platform: process.platform,
|
|
2163
|
-
id: process.platform === "darwin" ? read2(
|
|
2164
|
-
"/usr/sbin/ioreg",
|
|
2165
|
-
["-rd1", "-c", "IOPlatformExpertDevice"],
|
|
2166
|
-
/"IOPlatformUUID" = "([^"]+)"/
|
|
2167
|
-
) : process.platform === "win32" && systemRoot && /^[A-Za-z]:\\/.test(systemRoot) ? read2(
|
|
2168
|
-
win32.join(systemRoot, "System32", "reg.exe"),
|
|
2169
|
-
["query", "HKLM\\SOFTWARE\\Microsoft\\Cryptography", "/v", "MachineGuid"],
|
|
2170
|
-
/MachineGuid\s+REG_SZ\s+(\S+)/
|
|
2171
|
-
) : void 0
|
|
2172
|
-
};
|
|
2173
|
-
return machineIdRead.id;
|
|
2174
|
-
}
|
|
2175
|
-
function pidScope() {
|
|
2176
|
-
const attempt = (read2) => {
|
|
2177
|
-
try {
|
|
2178
|
-
return read2();
|
|
2179
|
-
} catch {
|
|
2180
|
-
return void 0;
|
|
2181
|
-
}
|
|
2182
|
-
};
|
|
2183
|
-
const bootId = attempt(() => readFileSync2("/proc/sys/kernel/random/boot_id", "utf-8").trim());
|
|
2184
|
-
return {
|
|
2185
|
-
host: hostname(),
|
|
2186
|
-
// Without /proc (macOS, Windows) the boot time in seconds stands in for the boot id, on this machine's own id.
|
|
2187
|
-
boot: bootId ?? attempt(() => `s:${Math.round(Date.now() / 1e3 - uptime())}`),
|
|
2188
|
-
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid")),
|
|
2189
|
-
machine: bootId === void 0 ? machineId() : void 0
|
|
2190
|
-
};
|
|
2191
|
-
}
|
|
2192
2144
|
function createOwnedRenderDir(prefix) {
|
|
2193
2145
|
const dir = createStagingDir(dirname3(prefix), basename4(prefix));
|
|
2194
|
-
|
|
2195
|
-
writeFileSync2(toWin32LongPath(join5(dir, OWNER_FILE)), JSON.stringify(owner));
|
|
2146
|
+
writeFileSync2(toWin32LongPath(join5(dir, OWNER_FILE)), JSON.stringify(processOwnerRecord()));
|
|
2196
2147
|
return dir;
|
|
2197
2148
|
}
|
|
2198
|
-
function alive(pid) {
|
|
2199
|
-
try {
|
|
2200
|
-
process.kill(pid, 0);
|
|
2201
|
-
return true;
|
|
2202
|
-
} catch (error) {
|
|
2203
|
-
return error.code === "EPERM";
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
function knownPidScope() {
|
|
2207
|
-
const scope = pidScope();
|
|
2208
|
-
const unknown = scope.boot === void 0 || process.platform === "linux" && scope.pidns === void 0 || scope.boot.startsWith("s:") && scope.machine === void 0;
|
|
2209
|
-
return unknown ? void 0 : scope;
|
|
2210
|
-
}
|
|
2211
|
-
function sameBoot(stamped, current) {
|
|
2212
|
-
if (stamped === current) return true;
|
|
2213
|
-
const seconds = (boot) => typeof boot === "string" ? /^s:(\d+)$/.exec(boot)?.[1] : void 0;
|
|
2214
|
-
const [a, b] = [seconds(stamped), seconds(current)];
|
|
2215
|
-
return a !== void 0 && b !== void 0 && Math.abs(Number(a) - Number(b)) <= 2;
|
|
2216
|
-
}
|
|
2217
|
-
function inThisPidScope(owner) {
|
|
2218
|
-
const scope = knownPidScope();
|
|
2219
|
-
return scope !== void 0 && owner.host === scope.host && sameBoot(owner.boot, scope.boot) && owner.pidns === scope.pidns && owner.machine === scope.machine;
|
|
2220
|
-
}
|
|
2221
2149
|
function ownerState(dir) {
|
|
2222
2150
|
let owner;
|
|
2223
2151
|
try {
|
|
@@ -2225,11 +2153,7 @@ function ownerState(dir) {
|
|
|
2225
2153
|
} catch (error) {
|
|
2226
2154
|
return error.code === "ENOENT" ? "none" : "unknown";
|
|
2227
2155
|
}
|
|
2228
|
-
|
|
2229
|
-
if (!inThisPidScope(owner) || typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) {
|
|
2230
|
-
return "unknown";
|
|
2231
|
-
}
|
|
2232
|
-
return alive(pid) ? "live" : "gone";
|
|
2156
|
+
return ownerRecordState(owner);
|
|
2233
2157
|
}
|
|
2234
2158
|
function newestWriteMs(path) {
|
|
2235
2159
|
const stat = lstatSync2(path);
|
|
@@ -11776,14 +11700,14 @@ async function runProbeStage(input) {
|
|
|
11776
11700
|
probeSession.beginFrameTimeTicks,
|
|
11777
11701
|
probeSession.beginFrameIntervalMs
|
|
11778
11702
|
);
|
|
11779
|
-
const
|
|
11703
|
+
const alive = await probeBeginFrameLiveness(
|
|
11780
11704
|
probeSession.page,
|
|
11781
11705
|
probeTimeoutMs,
|
|
11782
11706
|
probeTick,
|
|
11783
11707
|
probeSession.beginFrameIntervalMs
|
|
11784
11708
|
);
|
|
11785
11709
|
assertNotAborted();
|
|
11786
|
-
if (
|
|
11710
|
+
if (alive) {
|
|
11787
11711
|
log.info("BeginFrame liveness probe passed", {
|
|
11788
11712
|
probeMs: Date.now() - livenessStart
|
|
11789
11713
|
});
|
|
@@ -12460,7 +12384,8 @@ async function runExtractVideosStage(input) {
|
|
|
12460
12384
|
shownBoxes,
|
|
12461
12385
|
urlByAbsentLocalPath,
|
|
12462
12386
|
audioDownloadDir,
|
|
12463
|
-
skipFrameExtractionIds = []
|
|
12387
|
+
skipFrameExtractionIds = [],
|
|
12388
|
+
cacheLease
|
|
12464
12389
|
} = input;
|
|
12465
12390
|
const stage2Start = Date.now();
|
|
12466
12391
|
const assetRoots = job.config.allowOutsideProjectAssets ? void 0 : mediaAssetRoots(projectDir, compiledDir);
|
|
@@ -12580,6 +12505,7 @@ async function runExtractVideosStage(input) {
|
|
|
12580
12505
|
contentKeyedDirs: [join26(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
12581
12506
|
urlByAbsentLocalPath,
|
|
12582
12507
|
assetRoots,
|
|
12508
|
+
cacheLease,
|
|
12583
12509
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
12584
12510
|
framesPlanned += planned;
|
|
12585
12511
|
framesDone += done;
|
|
@@ -16939,6 +16865,8 @@ async function executeRenderPipeline(input) {
|
|
|
16939
16865
|
reason
|
|
16940
16866
|
});
|
|
16941
16867
|
}
|
|
16868
|
+
const cacheLease = createCacheLease();
|
|
16869
|
+
execution.defer("release extraction cache lease", () => cacheLease.release());
|
|
16942
16870
|
const extractResult = await observeRenderStage(
|
|
16943
16871
|
observability,
|
|
16944
16872
|
"video_extract",
|
|
@@ -16956,6 +16884,7 @@ async function executeRenderPipeline(input) {
|
|
|
16956
16884
|
assertNotAborted,
|
|
16957
16885
|
// Local staging can use links; distributed plan() alone requires real copies.
|
|
16958
16886
|
materializeSymlinks: false,
|
|
16887
|
+
cacheLease,
|
|
16959
16888
|
deferRangeExtraction: windowVideoFrames ? true : void 0,
|
|
16960
16889
|
shownBoxes,
|
|
16961
16890
|
onProgress
|
|
@@ -20351,18 +20280,18 @@ function hostnameOf(host) {
|
|
|
20351
20280
|
return null;
|
|
20352
20281
|
}
|
|
20353
20282
|
}
|
|
20354
|
-
function isAllowedBrowserHostname(
|
|
20355
|
-
if (!
|
|
20356
|
-
if (
|
|
20357
|
-
if (isIP(
|
|
20358
|
-
return allowed.has(
|
|
20283
|
+
function isAllowedBrowserHostname(hostname, allowed) {
|
|
20284
|
+
if (!hostname) return false;
|
|
20285
|
+
if (hostname === "localhost" || hostname.endsWith(".localhost")) return true;
|
|
20286
|
+
if (isIP(hostname.replace(/^\[|\]$/g, "")) !== 0) return true;
|
|
20287
|
+
return allowed.has(hostname);
|
|
20359
20288
|
}
|
|
20360
20289
|
function allowedHostnames(options) {
|
|
20361
20290
|
const fromEnv = (process.env.PRODUCER_ALLOWED_HOSTS ?? "").split(",");
|
|
20362
20291
|
const names = /* @__PURE__ */ new Set();
|
|
20363
20292
|
for (const entry of [...options.allowedHosts ?? [], ...fromEnv]) {
|
|
20364
|
-
const
|
|
20365
|
-
if (
|
|
20293
|
+
const hostname = entry.trim() ? hostnameOf(entry.trim()) : null;
|
|
20294
|
+
if (hostname) names.add(hostname);
|
|
20366
20295
|
}
|
|
20367
20296
|
return names;
|
|
20368
20297
|
}
|
|
@@ -20376,8 +20305,8 @@ function hasBearerToken(c, token) {
|
|
|
20376
20305
|
digest(`Bearer ${token}`)
|
|
20377
20306
|
);
|
|
20378
20307
|
}
|
|
20379
|
-
function isLoopbackHostname(
|
|
20380
|
-
const host =
|
|
20308
|
+
function isLoopbackHostname(hostname) {
|
|
20309
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
20381
20310
|
return host === "localhost" || host === "::1" || isIP(host) === 4 && host.startsWith("127.");
|
|
20382
20311
|
}
|
|
20383
20312
|
function isDisallowedBrowserHost(c, allowed) {
|
|
@@ -20446,12 +20375,12 @@ function onEscapedRejection(reason, log) {
|
|
|
20446
20375
|
});
|
|
20447
20376
|
scope?.fail(err);
|
|
20448
20377
|
}
|
|
20449
|
-
function serverAuth(options,
|
|
20378
|
+
function serverAuth(options, hostname, port) {
|
|
20450
20379
|
const configured = resolveAuthToken(options);
|
|
20451
20380
|
if (configured) return { token: configured };
|
|
20452
|
-
if (!isLoopbackHostname(
|
|
20381
|
+
if (!isLoopbackHostname(hostname)) {
|
|
20453
20382
|
throw new Error(
|
|
20454
|
-
`Refusing to listen on ${
|
|
20383
|
+
`Refusing to listen on ${hostname} without an auth token. Set authToken or PRODUCER_AUTH_TOKEN, or listen on a loopback address.`
|
|
20455
20384
|
);
|
|
20456
20385
|
}
|
|
20457
20386
|
const file = resolve12(
|
|
@@ -20466,11 +20395,11 @@ function serverAuth(options, hostname2, port) {
|
|
|
20466
20395
|
}
|
|
20467
20396
|
function startServer(options = {}) {
|
|
20468
20397
|
const port = options.port ?? parseInt(process.env.PRODUCER_PORT ?? "9847", 10);
|
|
20469
|
-
const
|
|
20398
|
+
const hostname = options.hostname || process.env.PRODUCER_HOST || "127.0.0.1";
|
|
20470
20399
|
const log = options.logger ?? defaultLogger;
|
|
20471
|
-
const auth = serverAuth(options,
|
|
20400
|
+
const auth = serverAuth(options, hostname, port);
|
|
20472
20401
|
const app = createProducerApp({ ...options, authToken: auth.token });
|
|
20473
|
-
const server = serve2({ fetch: app.fetch, port, hostname
|
|
20402
|
+
const server = serve2({ fetch: app.fetch, port, hostname }, (info) => {
|
|
20474
20403
|
const address = info.family === "IPv6" ? `[${info.address}]` : info.address;
|
|
20475
20404
|
log.info(`Listening on http://${address}:${info.port}`);
|
|
20476
20405
|
if (auth.generatedFile) {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* machines (symlinks don't survive S3 / GCS round-trips). Default
|
|
28
28
|
* `false` preserves the in-process renderer's symlink behavior.
|
|
29
29
|
*/
|
|
30
|
-
import { type CaptureVideoMetadataHint, type EngineConfig, type ExtractionResult, type FrameLookupTable, type HdrTransfer, type VideoExtractionFailureKind, type VideoColorSpace, classifyVideoExtractionError, extractAllVideoFrames, type ShownBox } from "@hyperframes/engine";
|
|
30
|
+
import { type CacheLease, type CaptureVideoMetadataHint, type EngineConfig, type ExtractionResult, type FrameLookupTable, type HdrTransfer, type VideoExtractionFailureKind, type VideoColorSpace, classifyVideoExtractionError, extractAllVideoFrames, type ShownBox } from "@hyperframes/engine";
|
|
31
31
|
import { type RenderJob } from "../../renderOrchestrator.js";
|
|
32
32
|
import { type CompositionMetadata } from "../shared.js";
|
|
33
33
|
import type { ProgressCallback } from "../../renderOrchestrator.js";
|
|
@@ -57,6 +57,7 @@ export interface ExtractVideosStageInput {
|
|
|
57
57
|
urlByAbsentLocalPath?: ReadonlyMap<string, string>;
|
|
58
58
|
audioDownloadDir?: string;
|
|
59
59
|
onProgress?: ProgressCallback;
|
|
60
|
+
cacheLease?: CacheLease;
|
|
60
61
|
}
|
|
61
62
|
export interface ExtractVideosStageResult {
|
|
62
63
|
/** Result of `extractAllVideoFrames`, or `null` if the composition has no videos. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.107",
|
|
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.9.
|
|
39
|
-
"@hyperframes/engine": "0.9.
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/
|
|
42
|
-
"@hyperframes/
|
|
43
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/core": "0.9.107",
|
|
39
|
+
"@hyperframes/engine": "0.9.107",
|
|
40
|
+
"@hyperframes/parsers": "0.9.107",
|
|
41
|
+
"@hyperframes/lint": "0.9.107",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.107",
|
|
43
|
+
"@hyperframes/share": "0.9.107"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.0.10",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"tsx": "^4.21.0",
|
|
50
50
|
"typescript": "^5.7.2",
|
|
51
51
|
"vitest": "^4.1.12",
|
|
52
|
-
"@hyperframes/aws-lambda": "0.9.
|
|
52
|
+
"@hyperframes/aws-lambda": "0.9.107"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=22"
|