mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
initial code (#2)
* feat: initial code port from hyperframes-internal Port all OSS-ready packages from the internal monorepo: - @hyperframes/core — shared types, HTML generation, GSAP utilities, runtime - @hyperframes/cli — CLI for creating, previewing, and rendering compositions - @hyperframes/engine — framework-agnostic rendering engine (BeginFrame + FFmpeg) - @hyperframes/producer — video rendering pipeline (Puppeteer + FFmpeg) - @hyperframes/ui-player — browser-based video player component - @hyperframes/studio — composition editor (React frontend + Hono backend) Includes regression test suite with Docker-based test harness. All HeyGen-internal references, deployment infrastructure, and proprietary assets have been removed. Package names migrated from @app/* to @hyperframes/*. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: scrub internal codenames and stale references from OSS port - Replace static.heygen.ai runtime URLs in test fixtures - Remove internal CDN publish script (publish-hyperframe-runtime.ts) - Replace sandbox-studio, sandbox-interceptor, __magicEditRuntime with neutral names (studio, hyperframe-runtime, __hyperframeRuntime) - Fix stale Vault API / localhost references in docs - Remove broken deprecated_studio link Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove remaining internal codenames and stale references - Delete stale producer README.md and PIPELINE.md (referenced nonexistent files) - Replace "Cerberus" codename with "HyperFrames" in test design reviews - Replace magic-edit postMessage identifiers with hf-preview/hf-parent - Rename debug-magic-edit-timeline.ts to debug-timeline.ts - Replace "Motion Cut" with "HyperFrames" in Timeline comments - Fix studio/CLI references to nonexistent archive package (use local data/projects/ dir, stub render proxy) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
10621e7903
commit
9f8e5ba5a1
@@ -0,0 +1,44 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { distributeFrames } from "./parallelCoordinator.js";
|
||||
|
||||
describe("distributeFrames", () => {
|
||||
it("distributes frames evenly across workers", () => {
|
||||
const tasks = distributeFrames(100, 4, "/tmp/work");
|
||||
expect(tasks).toHaveLength(4);
|
||||
|
||||
// First worker: frames 0-24
|
||||
expect(tasks[0]?.startFrame).toBe(0);
|
||||
expect(tasks[0]?.endFrame).toBe(25);
|
||||
|
||||
// Last worker: frames 75-99
|
||||
expect(tasks[3]?.startFrame).toBe(75);
|
||||
expect(tasks[3]?.endFrame).toBe(100);
|
||||
});
|
||||
|
||||
it("handles single worker", () => {
|
||||
const tasks = distributeFrames(50, 1, "/tmp/work");
|
||||
expect(tasks).toHaveLength(1);
|
||||
expect(tasks[0]?.startFrame).toBe(0);
|
||||
expect(tasks[0]?.endFrame).toBe(50);
|
||||
});
|
||||
|
||||
it("does not create empty tasks when workers exceed frames", () => {
|
||||
const tasks = distributeFrames(3, 10, "/tmp/work");
|
||||
// Can't have more tasks than frames
|
||||
expect(tasks.length).toBeLessThanOrEqual(3);
|
||||
// All frames are covered
|
||||
const totalFrames = tasks.reduce((sum, t) => sum + (t.endFrame - t.startFrame), 0);
|
||||
expect(totalFrames).toBe(3);
|
||||
});
|
||||
|
||||
it("assigns worker output directories", () => {
|
||||
const tasks = distributeFrames(60, 2, "/tmp/my-work");
|
||||
expect(tasks[0]?.outputDir).toContain("worker-0");
|
||||
expect(tasks[1]?.outputDir).toContain("worker-1");
|
||||
});
|
||||
|
||||
it("assigns sequential worker IDs", () => {
|
||||
const tasks = distributeFrames(100, 3, "/tmp/work");
|
||||
expect(tasks.map((t) => t.workerId)).toEqual([0, 1, 2]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user