@hyperframes/producer 0.9.67 → 0.9.69

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.
@@ -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 the hash matches,
66
- * the file exists at the recorded size, and its frame count equals the slice
67
- * length. Anything else re-captures — the cost of re-capturing a good segment
68
- * is minutes; the cost of reusing a bad one is a silently wrong video.
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, expectedHash: string, probeFrames: (path: string) => Promise<number | null>): Promise<Set<number>>;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.67",
3
+ "version": "0.9.69",
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/core": "0.9.67",
39
- "@hyperframes/engine": "0.9.67",
40
- "@hyperframes/parsers": "0.9.67",
41
- "@hyperframes/studio-server": "0.9.67",
42
- "@hyperframes/lint": "0.9.67"
38
+ "@hyperframes/core": "0.9.69",
39
+ "@hyperframes/engine": "0.9.69",
40
+ "@hyperframes/lint": "0.9.69",
41
+ "@hyperframes/parsers": "0.9.69",
42
+ "@hyperframes/studio-server": "0.9.69"
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.67"
51
+ "@hyperframes/aws-lambda": "0.9.69"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"