mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
feat(skills,studio,media-use): the intent layer, review loop, and user memory — BRIEF.md, companion mode, recipes; /website-to-video folds into /product-launch-video (#2133)
* feat(studio,cli): per-frame board comments, self-refreshing storyboard, status-aware preview landing Per-frame comment boxes on the storyboard board batch into .hyperframes/frame-comments.json (a resubmit wins per frame; unconsumed comments on other frames are kept). Submitted-but-unconsumed comments stay visible — a toolbar banner plus a per-tile echo — until the agent consumes the file; the banner also says what to do next (reply anything in the agent chat). The board keeps itself current: GET /projects/:id/signature exposes the watcher-cached project signature, the storyboard payload carries the signature it was derived from, and the view polls at 2s (hidden tabs skipped, re-checked on visibility), refetching in place with no loading flash. Posters bake the signature into their URL so tiles fill in as sketches land and a poster that failed mid-write retries on the next version; the empty state upgrades itself when STORYBOARD.md appears, and its handoff prompt now points the agent at the review loop and uses the parser's real status vocabulary (outline, not planned). preview lands the browser on the storyboard view while the board is the review surface — any frame built, or pure planning (srcs declared, none on disk yet) — and on the timeline once the video is assembled. * feat(skills): the review loop — plan, sketch, build as one shared process hyperframes-core/references/review-loop.md is the single source for the three-pass collaborative review: the plan proposed on a live board (§ 1), wireframe sketches marked built with one layout question (§ 2 — real words on plain blocks, run no CLI; a confirmed board is itself a valid deliverable when the user asked for a storyboard, not a video), the build dressing confirmed layouts (§ 3, worker or inline), and the final look (§ 4). Autonomous runs skip every gate and keep one question before render. The three narrative workflows' Steps 3/4/6 collapse to references plus their sketch stand-ins (captured-asset blocks for product-launch-video, plain code panels for pr-to-video); the confirmed-sketch handoff stays in each frame-worker prompt. general-video plans on a board for multi-scene narrative pieces in collaborative mode — its sketch pass is layout-before-animation with the user watching. The router treats "I want a storyboard" as a process request rather than a route, and closes exploratory intake by recommending a route plus how the run will review. The supporting contracts land next door: the comments channel (silent submit, one reply picks it up, check the file before the words) in brief-contract § 1; the sidecar schema and the built status rung in storyboard-format; the mode question asked first and alone in the three workflows' Step 0. * feat(media-use): user memory — remembered preferences and frozen recipes Two tiers of memory on media-use's existing two-tier storage split. Preferences (lightweight): confirmed brief answers — destination, aspect, language, mode, voice, style preset — recorded to the project's .media/preferences.json (committed, the team inherits it) and promoted to the personal ~/.media/preferences.json once the same value is confirmed in two different projects (a sightings ledger accumulates the cross-project evidence user-side, since project files can't see each other). prefs.mjs get/record; merge reads project-over-user; a changed value restarts its provenance. Recipes (heavyweight): one approved run frozen as a named, versioned bundle — frame.md, the storyboard skeleton (structure kept: durations, transitions, srcs, Video direction; statuses reset to outline; content blanked to per-frame fill-ins naming the beat's role), and the confirmed brief values. Named folders, not content hashes: re-freezing bumps version and archives <name>@v<N>; a freeze is already confirmed, so it promotes to the user tier immediately. recipe.mjs freeze/list/use, plus resolve --type recipe --entity <name> delegating like grade/lut. 16 new node --test cases; the media-use lib suite is 168/168. * feat(skills): wire user memory into the brief and the review loop brief-contract § 2 gains Remembered defaults: read the merged preferences before Round 2 and let a remembered value become the recommended option with a receipt naming its source project. Memory changes the default, never the question — every ask-marked field still gets asked, and what the request says this time beats what was picked last time. Record only what the user actually confirmed (a defaulted voice nobody chose is not an answer; a "go" that accepts the recommended defaults is). The first record announces itself once; after that the receipts carry the reminder. In autonomous mode a remembered value becomes the decided value, receipt included. The three narrative workflows read the remembered defaults before Round 2, record the confirmed answers at the Step 0 gate, record the chosen preset at the Step 2 gate (pr-to-video excepted — its preset is fixed), and fall back to the remembered voice when the request names none. general-video's discovery reads the same defaults. Recipes wire in at both ends: Step 0 checks for a matching recipe before the mode question — one question, plural-aware, and adopting one fills the brief, skips the design step, and drafts the storyboard from the frozen skeleton while every review gate still runs. The review loop's final look (§ 4) offers the freeze once after approval, and the confirmation teaches the recall phrase — the name is something the system reminds the user of, never something they must remember. The router recognizes a named recipe or "like last time" as a route. * docs(skills): the sketch pass names check, not the deprecated validate * feat(skills): intent-layer references — process, route briefs, capability menu, BRIEF.md format * feat(media-use): brief skeleton as the recipe's fourth artifact; flow/storyboard preference keys * feat(skills): the intent layer conducts every brief — workflows execute BRIEF.md * feat(skills): retire the mode preference key; sync catalog surfaces for intent layer * refactor(skills): dedupe router vs intent-layer guidance — one owner per rule * feat(skills): the design ask — own spec, pick by eye from showcases, or defer * docs(skills): the design ask says the honest line on capture routes * feat(skills): product-launch-video absorbs website-to-video as the tour angle * refactor(skills): keep product-launch-video pristine — a tour is brief intent, not a pipeline branch * feat(skills): production loop + genre lenses; general-video goes freeform (route yours, laws hold) * refactor(skills): /hyperframes is the front door - route tables and scope lists leave the workflows * docs(skills): review-loop pass across skill catalog * fix(cli): pass project dir to openStudioBrowser in background-server path * feat(skills): add pitch-round reference - verbalized sampling concept gate * feat(skills): wire pitch round into intent layer - completeness triage + route eligibility * feat(skills): editorial capability recommendations, handoff disciplines, menu-probe split * feat(skills): pitches carry their machinery; source-only-formed requests pitch the telling * feat(skills): companion goes director - ceiling treatment plus blueprint/rule citation discipline * fix(scripts): sandbox npx-leak guard - private npm global prefix keeps npx on the branch CLI * chore(skills): resync manifest hash after formatter pass reflowed general-video tables * fix(skills): recipe freeze reads workflow from BRIEF.md; style_preset records require workflow scope Two holes found by a live companion-run freeze: the agent-supplied --workflow contradicted the run's actual workflow (recipe.json said faceless-explainer, brief-skeleton said general-video), and the style_preset lookup missed because the preference had been recorded under the bare key. - freezeRecipe resolves the workflow from BRIEF.md frontmatter; the flag is a fallback for briefless projects and a contradicting flag is ignored (noted). - recordPreference refuses a bare style_preset — the scoped key is the only writable shape; freeze tolerates legacy bare records via read fallback. - review-loop § 4 / media-use SKILL / brief-format wording follow the machinery.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* This file generates a DATA INVENTORY that tells the AI agent what files
|
||||
* exist and what they contain. The actual workflow lives in the
|
||||
* website-to-video skill — this file points agents there.
|
||||
* product-launch-video skill — this file points agents there.
|
||||
*/
|
||||
|
||||
import { writeFileSync, readdirSync, existsSync } from "node:fs";
|
||||
@@ -198,7 +198,7 @@ function buildPrompt(
|
||||
|
||||
Source: ${url}
|
||||
|
||||
To create a video from this capture, use the \`website-to-video\` skill.
|
||||
To create a video from this capture, use the \`product-launch-video\` skill.
|
||||
|
||||
## What's in This Capture
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { studioLandingSearch } from "./preview.js";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
afterEach(() => {
|
||||
for (const dir of tempDirs.splice(0)) rmSync(dir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function projectWith(storyboard: string | null, frameFiles: string[] = []): string {
|
||||
const dir = mkdtempSync(join(tmpdir(), "hf-preview-landing-"));
|
||||
tempDirs.push(dir);
|
||||
if (storyboard !== null) writeFileSync(join(dir, "STORYBOARD.md"), storyboard);
|
||||
for (const file of frameFiles) {
|
||||
mkdirSync(join(dir, file, ".."), { recursive: true });
|
||||
writeFileSync(join(dir, file), "<div></div>");
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
const FRAME = (n: number, status: string) =>
|
||||
`## Frame ${n} — F${n}\n- status: ${status}\n- src: compositions/frames/0${n}.html\n\nBeat.\n`;
|
||||
|
||||
describe("studioLandingSearch", () => {
|
||||
it("returns no search without a storyboard", () => {
|
||||
expect(studioLandingSearch(projectWith(null))).toBe("");
|
||||
});
|
||||
|
||||
it("lands on the board while sketches are under review (any built frame)", () => {
|
||||
const dir = projectWith(`${FRAME(1, "built")}${FRAME(2, "outline")}`, [
|
||||
"compositions/frames/01.html",
|
||||
]);
|
||||
expect(studioLandingSearch(dir)).toBe("?view=storyboard");
|
||||
});
|
||||
|
||||
it("lands on the board during pure planning (srcs declared, none exist)", () => {
|
||||
const dir = projectWith(`${FRAME(1, "outline")}${FRAME(2, "outline")}`);
|
||||
expect(studioLandingSearch(dir)).toBe("?view=storyboard");
|
||||
});
|
||||
|
||||
it("lands on the timeline once frames exist without a built status", () => {
|
||||
const dir = projectWith(`${FRAME(1, "outline")}`, ["compositions/frames/01.html"]);
|
||||
expect(studioLandingSearch(dir)).toBe("");
|
||||
});
|
||||
|
||||
it("lands on the timeline for fully animated boards", () => {
|
||||
const dir = projectWith(`${FRAME(1, "animated")}`, ["compositions/frames/01.html"]);
|
||||
expect(studioLandingSearch(dir)).toBe("");
|
||||
});
|
||||
});
|
||||
@@ -22,7 +22,16 @@ export const examples: Example[] = [
|
||||
["List all active preview servers", "hyperframes preview --list"],
|
||||
["Kill all active preview servers", "hyperframes preview --kill-all"],
|
||||
];
|
||||
import { existsSync, lstatSync, symlinkSync, unlinkSync, readlinkSync, mkdirSync } from "node:fs";
|
||||
import {
|
||||
existsSync,
|
||||
lstatSync,
|
||||
mkdirSync,
|
||||
readFileSync,
|
||||
readlinkSync,
|
||||
symlinkSync,
|
||||
unlinkSync,
|
||||
} from "node:fs";
|
||||
import { parseStoryboard, STORYBOARD_FILENAME } from "@hyperframes/core/storyboard";
|
||||
import { resolve, dirname, basename, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createRequire } from "node:module";
|
||||
@@ -368,7 +377,7 @@ export default defineCommand({
|
||||
],
|
||||
footer: `Stop with: hyperframes preview ${JSON.stringify(dir)} --stop`,
|
||||
});
|
||||
openStudioBrowser(url, projectName, {
|
||||
openStudioBrowser(url, projectName, dir, {
|
||||
noOpen,
|
||||
browserPath,
|
||||
userDataDir,
|
||||
@@ -742,9 +751,47 @@ function compactSelectionPayload(selection: StudioSelectionSnapshot): CompactSel
|
||||
};
|
||||
}
|
||||
|
||||
function openStudioBrowser(url: string, projectName: string, options?: BrowserLaunchOptions): void {
|
||||
// Land the browser on the Storyboard view while the project is still planning
|
||||
// or sketching — the timeline only becomes the right landing once frames are
|
||||
// animated (or the storyboard never tracked statuses at all, e.g. beat plans).
|
||||
export function studioLandingSearch(projectDir: string): string {
|
||||
const storyboardPath = join(projectDir, STORYBOARD_FILENAME);
|
||||
if (!existsSync(storyboardPath)) return "";
|
||||
let frames;
|
||||
try {
|
||||
frames = parseStoryboard(readFileSync(storyboardPath, "utf8")).frames;
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
// Sketch review in progress — the board is the review surface.
|
||||
if (frames.some((f) => f.status === "built")) return "?view=storyboard";
|
||||
// Pure planning stage: frames declare src paths but none are built yet.
|
||||
const srcs = frames
|
||||
.map((f) => f.src)
|
||||
.filter((s): s is string => typeof s === "string" && s.length > 0);
|
||||
const planning =
|
||||
frames.length > 0 &&
|
||||
frames.every((f) => f.status === "outline") &&
|
||||
srcs.length > 0 &&
|
||||
!srcs.some((s) => existsSync(join(projectDir, s)));
|
||||
return planning ? "?view=storyboard" : "";
|
||||
}
|
||||
|
||||
// The full Studio URL to open or hand to the user: status-aware landing view
|
||||
// plus the project hash route. `url` never carries a trailing slash (both the
|
||||
// embedded server and the Vite `Local:` match strip it).
|
||||
function studioDeepLink(url: string, projectName: string, projectDir: string): string {
|
||||
return `${url}/${studioLandingSearch(projectDir)}#project/${projectName}`;
|
||||
}
|
||||
|
||||
function openStudioBrowser(
|
||||
url: string,
|
||||
projectName: string,
|
||||
projectDir: string,
|
||||
options?: BrowserLaunchOptions,
|
||||
): void {
|
||||
if (options?.noOpen) return;
|
||||
openBrowser(`${url}#project/${projectName}`, {
|
||||
openBrowser(studioDeepLink(url, projectName, projectDir), {
|
||||
browserPath: options?.browserPath,
|
||||
userDataDir: options?.userDataDir,
|
||||
remoteDebuggingPort: options?.remoteDebuggingPort,
|
||||
@@ -829,6 +876,7 @@ function attachStudioReadyHandler(
|
||||
child: StudioChildProcess,
|
||||
spinner: ReturnType<typeof clack.spinner>,
|
||||
projectName: string,
|
||||
projectDir: string,
|
||||
options?: BrowserLaunchOptions,
|
||||
): void {
|
||||
let detected = false;
|
||||
@@ -840,7 +888,7 @@ function attachStudioReadyHandler(
|
||||
detected = true;
|
||||
spinner.stop(c.success("Studio running"));
|
||||
printStudioSummary(projectName, url, { footer: "Press Ctrl+C to stop" });
|
||||
openStudioBrowser(url, projectName, options);
|
||||
openStudioBrowser(url, projectName, projectDir, options);
|
||||
child.stdout.removeListener("data", handleOutput);
|
||||
child.stderr.removeListener("data", handleOutput);
|
||||
}
|
||||
@@ -878,7 +926,7 @@ async function runDevMode(dir: string, options?: StudioLaunchOptions): Promise<v
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
|
||||
attachStudioReadyHandler(child, s, pName, options);
|
||||
attachStudioReadyHandler(child, s, pName, dir, options);
|
||||
removeSymlinkOnExit(createdSymlink, symlinkPath);
|
||||
|
||||
// Kill the child's entire process tree on SIGTERM/SIGINT. Ctrl+C sends
|
||||
@@ -927,7 +975,7 @@ async function runLocalStudioMode(dir: string, options?: StudioLaunchOptions): P
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
|
||||
attachStudioReadyHandler(child, s, pName, options);
|
||||
attachStudioReadyHandler(child, s, pName, dir, options);
|
||||
removeSymlinkOnExit(createdSymlink, symlinkPath);
|
||||
|
||||
// Same tree-kill handler as dev mode. No-op on Windows (see comment above).
|
||||
@@ -998,7 +1046,7 @@ async function runEmbeddedMode(
|
||||
printStudioSummary(pName, url, {
|
||||
details: ["Reusing existing server. Use --force-new to start a fresh instance."],
|
||||
});
|
||||
openStudioBrowser(url, pName, options);
|
||||
openStudioBrowser(url, pName, dir, options);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1016,7 +1064,7 @@ async function runEmbeddedMode(
|
||||
],
|
||||
footer: "Press Ctrl+C to stop",
|
||||
});
|
||||
openStudioBrowser(url, pName, options);
|
||||
openStudioBrowser(url, pName, dir, options);
|
||||
|
||||
// Block until Ctrl+C. Node would normally exit on SIGINT, but the listening
|
||||
// HTTP server keeps handles open, so the event loop stays alive after the
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
|
||||
**Always invoke the relevant skill before writing or modifying compositions.** Skills encode framework-specific patterns (e.g., `window.__timelines` registration, `data-*` attribute semantics, shader-compatible CSS rules) that are NOT in generic web docs. Skipping them produces broken compositions.
|
||||
|
||||
**Doing anything with HyperFrames?** Start at `/hyperframes` — it tells you what HyperFrames can do and which skill or workflow handles your intent (make a video, TTS / BGM, prep footage, author / animate, render, install blocks), and routes every "make me a…" request (a video, a deck, a composition port) to the right workflow. Read it first, especially when there's no project context to orient you. The workflows it routes to:
|
||||
**Doing anything with HyperFrames?** Start at `/hyperframes` — it tells you what HyperFrames can do and which skill or workflow handles your intent (make a video, TTS / BGM, prep footage, author / animate, render, install blocks), confirms your brief up front (the intent layer), and routes every "make me a…" request (a video, a deck, a composition port) to the right workflow. Read it first, especially when there's no project context to orient you. The workflows it routes to:
|
||||
|
||||
- `/product-launch-video` — a **product** URL or brief / script → 60-90s product launch / SaaS / promo video.
|
||||
- `/website-to-video` — a **general** website / URL → a video _of_ the site (tour / showcase / social clip from captured visuals); a product **launch / promo** is `/product-launch-video`.
|
||||
- `/product-launch-video` — any **website** URL or brief / script → a product launch / SaaS / promo video, or a site tour / showcase featuring the site's own captured visuals.
|
||||
- `/faceless-explainer` — arbitrary text (topic / article / notes), **no URL, no website capture** → 60-90s faceless explainer.
|
||||
- `/embedded-captions` — an existing talking-head video (MP4) → the same footage with captions / subtitles added (rail + embed, or pure-cinematic embed); the footage itself is untouched.
|
||||
- `/talking-head-recut` — an existing talking-head / interview / podcast video (MP4) → the same footage **packaged with designed graphic overlays** (kinetic titles, lower-thirds, data callouts, pull-quotes, side panels, pip) synced to the transcript; the clip plays unchanged underneath. (Plain captions/subtitles → `/embedded-captions`.)
|
||||
@@ -15,7 +14,7 @@
|
||||
- `/motion-graphics` — a short (typically under 10s) design-led **motion graphic**, motion-is-the-message, no narration: kinetic type, a stat / number count-up, a chart, a logo sting, a lower-third / overlay, or an animated tweet / headline / captured-page highlight; rendered to MP4 or a transparent overlay. Longer / narrated / custom → `/general-video`.
|
||||
- `/music-to-video` — a **music track** (audio file, or video to pull audio from) → beat-synced video (lyric / slideshow / kinetic promo). Music drives pacing; user-supplied images / videos are cut onto the same beat grid.
|
||||
- `/slideshow` — a **presentation / pitch deck / interactive deck** — discrete slides, fragment reveals, branching, hotspot navigation, presenter mode. Output is a navigable deck, not a rendered video.
|
||||
- `/general-video` — fallback for any other video (title card, longer brand / sizzle reel, multi-scene montage, static loop, custom composition); the original hyperframes authoring flow, any length.
|
||||
- `/general-video` — fallback for any other video (title card, longer brand / sizzle reel, multi-scene montage, static loop, custom composition) and the home of **companion mode** — co-create with the full HyperFrames toolbox; the original hyperframes authoring flow, any length.
|
||||
|
||||
**Porting an existing composition?** `/remotion-to-hyperframes` translates a Remotion (React) composition into HyperFrames HTML — a source migration, separate from the creation workflows above.
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
|
||||
**Always invoke the relevant skill before writing or modifying compositions.** Skills encode framework-specific patterns (e.g., `window.__timelines` registration, `data-*` attribute semantics, shader-compatible CSS rules) that are NOT in generic web docs. Skipping them produces broken compositions.
|
||||
|
||||
**Doing anything with HyperFrames?** Start at `/hyperframes` — it tells you what HyperFrames can do and which skill or workflow handles your intent (make a video, TTS / BGM, prep footage, author / animate, render, install blocks), and routes every "make me a…" request (a video, a deck, a composition port) to the right workflow. Read it first, especially when there's no project context to orient you. The workflows it routes to:
|
||||
**Doing anything with HyperFrames?** Start at `/hyperframes` — it tells you what HyperFrames can do and which skill or workflow handles your intent (make a video, TTS / BGM, prep footage, author / animate, render, install blocks), confirms your brief up front (the intent layer), and routes every "make me a…" request (a video, a deck, a composition port) to the right workflow. Read it first, especially when there's no project context to orient you. The workflows it routes to:
|
||||
|
||||
- `/product-launch-video` — a **product** URL or brief / script → 60-90s product launch / SaaS / promo video.
|
||||
- `/website-to-video` — a **general** website / URL → a video _of_ the site (tour / showcase / social clip from captured visuals); a product **launch / promo** is `/product-launch-video`.
|
||||
- `/product-launch-video` — any **website** URL or brief / script → a product launch / SaaS / promo video, or a site tour / showcase featuring the site's own captured visuals.
|
||||
- `/faceless-explainer` — arbitrary text (topic / article / notes), **no URL, no website capture** → 60-90s faceless explainer.
|
||||
- `/embedded-captions` — an existing talking-head video (MP4) → the same footage with captions / subtitles added (rail + embed, or pure-cinematic embed); the footage itself is untouched.
|
||||
- `/talking-head-recut` — an existing talking-head / interview / podcast video (MP4) → the same footage **packaged with designed graphic overlays** (kinetic titles, lower-thirds, data callouts, pull-quotes, side panels, pip) synced to the transcript; the clip plays unchanged underneath. (Plain captions/subtitles → `/embedded-captions`.)
|
||||
@@ -15,7 +14,7 @@
|
||||
- `/motion-graphics` — a short (typically under 10s) design-led **motion graphic**, motion-is-the-message, no narration: kinetic type, a stat / number count-up, a chart, a logo sting, a lower-third / overlay, or an animated tweet / headline / captured-page highlight; rendered to MP4 or a transparent overlay. Longer / narrated / custom → `/general-video`.
|
||||
- `/music-to-video` — a **music track** (audio file, or video to pull audio from) → beat-synced video (lyric / slideshow / kinetic promo). Music drives pacing; user-supplied images / videos are cut onto the same beat grid.
|
||||
- `/slideshow` — a **presentation / pitch deck / interactive deck** — discrete slides, fragment reveals, branching, hotspot navigation, presenter mode. Output is a navigable deck, not a rendered video.
|
||||
- `/general-video` — fallback for any other video (title card, longer brand / sizzle reel, multi-scene montage, static loop, custom composition); the original hyperframes authoring flow, any length.
|
||||
- `/general-video` — fallback for any other video (title card, longer brand / sizzle reel, multi-scene montage, static loop, custom composition) and the home of **companion mode** — co-create with the full HyperFrames toolbox; the original hyperframes authoring flow, any length.
|
||||
|
||||
**Porting an existing composition?** `/remotion-to-hyperframes` translates a Remotion (React) composition into HyperFrames HTML — a source migration, separate from the creation workflows above.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user