@hyperframes/producer 0.9.66 → 0.9.68
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 +97 -50
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +64 -64
- package/dist/index.d.ts +1 -0
- package/dist/index.js +836 -642
- package/dist/public-server.js +621 -428
- package/dist/services/compositionSizeLimit.d.ts +2 -0
- package/dist/services/htmlCompiler.d.ts +5 -2
- package/dist/services/render/cleanup.d.ts +2 -0
- package/dist/services/render/missingPath.d.ts +15 -0
- package/dist/services/render/observability.d.ts +1 -0
- package/dist/services/render/segmentManifest.d.ts +29 -6
- package/dist/services/render/segmentPlan.d.ts +2 -5
- package/dist/services/render/stages/captureSegmentedStage.d.ts +1 -2
- package/dist/services/renderOrchestrator.d.ts +2 -0
- package/package.json +7 -7
|
@@ -9,6 +9,8 @@ export declare const MAX_COMPOSITION_HTML_BYTES: number;
|
|
|
9
9
|
* above, but a few small files that mount each other many times assemble a page far larger.
|
|
10
10
|
*/
|
|
11
11
|
export declare const MAX_EXPANDED_COMPOSITION_BYTES: number;
|
|
12
|
+
export declare const REMOTE_SCRIPTS = "remote scripts";
|
|
13
|
+
export declare const REMOTE_STYLESHEETS = "remote stylesheets";
|
|
12
14
|
/** Adds up every mount a render inlines, and what it generates for them, and throws past a limit. */
|
|
13
15
|
export declare class CompositionExpansionBudget {
|
|
14
16
|
private bytes;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RateSpec, type ResolvedDuration, type UnresolvedElement } from "@hyperframes/core";
|
|
2
|
+
import { CompositionExpansionBudget } from "./compositionSizeLimit.js";
|
|
2
3
|
import { type OutsideFilePolicy } from "../utils/paths.js";
|
|
3
4
|
import { type VideoElement, type ImageElement, type AudioElement, type AudioVolumeKeyframe } from "@hyperframes/engine";
|
|
4
5
|
import type { Page } from "puppeteer-core";
|
|
@@ -56,9 +57,11 @@ export declare function detectAncestorBackgroundImage(html: string): boolean;
|
|
|
56
57
|
export declare function detectShaderTransitionUsage(html: string): boolean;
|
|
57
58
|
/**
|
|
58
59
|
* Download external CDN scripts and inline them into the HTML so rendering
|
|
59
|
-
* works without network access (Docker, CI, restricted environments).
|
|
60
|
+
* works without network access (Docker, CI, restricted environments). Each URL
|
|
61
|
+
* is fetched once, a few at a time, and every inlined copy is charged to the
|
|
62
|
+
* render's budget as it arrives, so going over stops the downloads still queued.
|
|
60
63
|
*/
|
|
61
|
-
export declare function inlineExternalScripts(html: string): Promise<string>;
|
|
64
|
+
export declare function inlineExternalScripts(html: string, budget?: CompositionExpansionBudget): Promise<string>;
|
|
62
65
|
/**
|
|
63
66
|
* Scan compiled HTML for asset references that resolve outside projectDir.
|
|
64
67
|
* For each, map the normalized in-HTML path to the real filesystem path so
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { type SubTimelineWaitOutcome } from "@hyperframes/engine";
|
|
3
3
|
import type { HdrDiagnostics, RenderJob } from "../renderOrchestrator.js";
|
|
4
4
|
import type { RenderObservabilitySummary } from "./observability.js";
|
|
5
|
+
import type { MissingPathFacts } from "./missingPath.js";
|
|
5
6
|
/**
|
|
6
7
|
* Build the `RenderJob.errorDetails` shape downstream consumers (SSE,
|
|
7
8
|
* sync `/render` response, queue introspection) read on failure.
|
|
@@ -14,4 +15,5 @@ export declare function buildRenderErrorDetails(input: {
|
|
|
14
15
|
hdrDiagnostics: HdrDiagnostics;
|
|
15
16
|
observability?: RenderObservabilitySummary;
|
|
16
17
|
subTimelineWait?: SubTimelineWaitOutcome;
|
|
18
|
+
missingPath?: MissingPathFacts;
|
|
17
19
|
}): NonNullable<RenderJob["errorDetails"]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** What was gone around a missing path when the render failed, from closed lists only: never a path or a name. */
|
|
2
|
+
export interface MissingPathFacts {
|
|
3
|
+
/** The highest thing gone on the path; a link on the way is read through to its target. */
|
|
4
|
+
scope: "file" | "link_target" | "cache_entry" | "cache_partial" | "cache_root" | "work_dir" | "temp_root" | "other";
|
|
5
|
+
/** Under a folder a sync app owns (OneDrive, Dropbox, iCloud, Google Drive). */
|
|
6
|
+
synced: boolean;
|
|
7
|
+
root: "system_temp" | "cache_dir" | "other";
|
|
8
|
+
}
|
|
9
|
+
/** What was gone around the path a failed render's ENOENT names; undefined when it names none or the look fails.
|
|
10
|
+
* Only the render's own folders are looked at, never a share; call it before the render's own cleanup runs. */
|
|
11
|
+
export declare function describeMissingPath(error: unknown, { cacheDir, workDir, tempRoot, }?: {
|
|
12
|
+
cacheDir?: string;
|
|
13
|
+
workDir?: string;
|
|
14
|
+
tempRoot?: string;
|
|
15
|
+
}): MissingPathFacts | undefined;
|
|
@@ -214,6 +214,7 @@ export interface RenderExtractionObservability {
|
|
|
214
214
|
vfrPreflightCount?: number;
|
|
215
215
|
cacheHits?: number;
|
|
216
216
|
cacheMisses?: number;
|
|
217
|
+
cachePublishFailures?: number;
|
|
217
218
|
/** Per-source transient download/metadata/FFmpeg retries performed during extraction. */
|
|
218
219
|
transientRetries?: number;
|
|
219
220
|
/**
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { type SegmentSlice } from "./segmentPlan.js";
|
|
1
2
|
export interface SegmentManifestEntry {
|
|
2
3
|
index: number;
|
|
3
4
|
startFrame: number;
|
|
4
5
|
endFrame: number;
|
|
5
6
|
path: string;
|
|
6
7
|
bytes: number;
|
|
8
|
+
/** Hex SHA-256 of the segment file, taken when it finished. */
|
|
9
|
+
sha256: string;
|
|
7
10
|
completedAt: string;
|
|
8
11
|
}
|
|
9
12
|
export interface SegmentManifest {
|
|
@@ -12,6 +15,8 @@ export interface SegmentManifest {
|
|
|
12
15
|
totalFrames: number;
|
|
13
16
|
segmentFrames: number;
|
|
14
17
|
completed: SegmentManifestEntry[];
|
|
18
|
+
/** HMAC by this user's manifest key; resume trusts no manifest without a valid one. */
|
|
19
|
+
mac?: string;
|
|
15
20
|
}
|
|
16
21
|
export interface SegmentPlanHashInput {
|
|
17
22
|
compositionHash: string;
|
|
@@ -47,8 +52,14 @@ export interface SegmentPlanHashInput {
|
|
|
47
52
|
export declare function computeSegmentPlanHash(input: SegmentPlanHashInput): string;
|
|
48
53
|
export declare function segmentDirFor(projectRendersDir: string, planHash: string): string;
|
|
49
54
|
export declare function readSegmentManifest(segmentDir: string): SegmentManifest | null;
|
|
55
|
+
/**
|
|
56
|
+
* The key that signs segment manifests, derived from this user's preview token, which lives in the
|
|
57
|
+
* user's home outside every project. Null when no token can be read or made; resume then reuses nothing.
|
|
58
|
+
*/
|
|
59
|
+
export declare function segmentManifestKey(token?: string | null): Buffer | null;
|
|
60
|
+
export declare function hashSegmentFile(path: string): Promise<string>;
|
|
50
61
|
/** Atomic: write to a temp name, then rename over the manifest. */
|
|
51
|
-
export declare function writeSegmentManifest(segmentDir: string, manifest: SegmentManifest): void;
|
|
62
|
+
export declare function writeSegmentManifest(segmentDir: string, manifest: SegmentManifest, key: Buffer | null): void;
|
|
52
63
|
/**
|
|
53
64
|
* Frame count of a finished segment, derived from its probed duration and
|
|
54
65
|
* frame rate. There is no exact-count reader in the engine's ffprobe utils
|
|
@@ -61,10 +72,22 @@ export declare function probeSegmentFrameCount(path: string, probe: (path: strin
|
|
|
61
72
|
videoStreamDurationSeconds: number;
|
|
62
73
|
fps: number;
|
|
63
74
|
}>): Promise<number | null>;
|
|
75
|
+
export interface SegmentResumeCheck {
|
|
76
|
+
expectedHash: string;
|
|
77
|
+
segmentDir: string;
|
|
78
|
+
/** This render's segments; manifest entries are trusted only where they match one. */
|
|
79
|
+
plan: readonly SegmentSlice[];
|
|
80
|
+
key: Buffer | null;
|
|
81
|
+
probeFrames: (path: string) => Promise<number | null>;
|
|
82
|
+
}
|
|
64
83
|
/**
|
|
65
|
-
* Indices safe to skip on resume. A segment counts only if
|
|
66
|
-
* the
|
|
67
|
-
*
|
|
68
|
-
*
|
|
84
|
+
* Indices safe to skip on resume. A segment counts only if this user's key
|
|
85
|
+
* signed the manifest, the plan hash matches, the entry matches a slice of
|
|
86
|
+
* this plan, and the file the join will read (the slice's own path in
|
|
87
|
+
* `segmentDir`, never the manifest's `path`) is a plain file at the recorded
|
|
88
|
+
* size and hash whose frame count equals the slice length. The hash is
|
|
89
|
+
* checked before the prober opens the file. Anything else re-captures:
|
|
90
|
+
* re-capturing a good segment costs minutes, reusing a bad one silently
|
|
91
|
+
* produces a wrong video.
|
|
69
92
|
*/
|
|
70
|
-
export declare function validateCompletedSegments(manifest: SegmentManifest,
|
|
93
|
+
export declare function validateCompletedSegments(manifest: SegmentManifest, check: SegmentResumeCheck): Promise<Set<number>>;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Segment planning for long-form capture (spec §5 Phase 2). A segment is a
|
|
3
|
-
* half-open frame range captured into its own closed-GOP encoder process so
|
|
4
|
-
* a crash costs one segment, not the render, and scratch is encoded video.
|
|
5
|
-
*/
|
|
6
1
|
export interface SegmentSlice {
|
|
7
2
|
index: number;
|
|
8
3
|
startFrame: number;
|
|
@@ -14,4 +9,6 @@ export declare const DEFAULT_SEGMENT_FRAMES = 3000;
|
|
|
14
9
|
/** Tiny GOPs cost bitrate and per-encoder spawn overhead; 1 s at 30 fps is the floor. */
|
|
15
10
|
export declare const MIN_SEGMENT_FRAMES = 30;
|
|
16
11
|
export declare function planSegments(totalFrames: number, segmentFrames: number): SegmentSlice[];
|
|
12
|
+
/** Zero-padded so lexical order equals frame order in the concat list and on disk. */
|
|
13
|
+
export declare function segmentOutputPath(segmentDir: string, index: number): string;
|
|
17
14
|
export declare function resolveSegmentFrames(env: NodeJS.ProcessEnv): number;
|
|
@@ -52,6 +52,7 @@ export interface CaptureSegmentedStageInput {
|
|
|
52
52
|
endFrame: number;
|
|
53
53
|
path: string;
|
|
54
54
|
bytes: number;
|
|
55
|
+
sha256: string;
|
|
55
56
|
}) => void;
|
|
56
57
|
/** Parallel capture sessions pulling from one segment queue. Default 1. */
|
|
57
58
|
workerCount?: number;
|
|
@@ -93,6 +94,4 @@ export type CaptureSegmentedStageResult = {
|
|
|
93
94
|
| {
|
|
94
95
|
success: false;
|
|
95
96
|
};
|
|
96
|
-
/** Zero-padded so lexical order equals frame order in the concat list and on disk. */
|
|
97
|
-
export declare function segmentOutputPath(segmentDir: string, index: number): string;
|
|
98
97
|
export declare function runCaptureSegmentedStage(input: CaptureSegmentedStageInput): Promise<CaptureSegmentedStageResult>;
|
|
@@ -5,6 +5,7 @@ import { type EngineConfig, type ExtractionPhaseBreakdown, type VideoFrameFormat
|
|
|
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";
|
|
8
|
+
import { type MissingPathFacts } from "./render/missingPath.js";
|
|
8
9
|
import { type RenderCaptureObservability, type RenderObservabilitySummary, type OpenStallAttempt, type StageStallRule } from "./render/observability.js";
|
|
9
10
|
import { type HdrPerfSummary } from "./render/hdrPerf.js";
|
|
10
11
|
export declare function sampleDirectoryBytes(dir: string): number;
|
|
@@ -473,6 +474,7 @@ export interface RenderJob extends Partial<ReferenceBackgroundResult> {
|
|
|
473
474
|
observability?: RenderObservabilitySummary;
|
|
474
475
|
/** Worst sub-composition timeline wait outcome across sessions captured before the failure. */
|
|
475
476
|
subTimelineWait?: SubTimelineWaitOutcome;
|
|
477
|
+
missingPath?: MissingPathFacts;
|
|
476
478
|
};
|
|
477
479
|
}
|
|
478
480
|
export type ProgressCallback = (job: RenderJob, message: string) => void | Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/producer",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.68",
|
|
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/
|
|
40
|
-
"@hyperframes/
|
|
41
|
-
"@hyperframes/lint": "0.9.
|
|
42
|
-
"@hyperframes/
|
|
38
|
+
"@hyperframes/engine": "0.9.68",
|
|
39
|
+
"@hyperframes/core": "0.9.68",
|
|
40
|
+
"@hyperframes/parsers": "0.9.68",
|
|
41
|
+
"@hyperframes/lint": "0.9.68",
|
|
42
|
+
"@hyperframes/studio-server": "0.9.68"
|
|
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.68"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=22"
|