Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
refactor(studio): remove the storyboard view and its Storyboard/Preview switch (#4140)
Miguel Ángela25da94b771c
diff --git a/.fallowrc.jsonc b/.fallowrc.jsoncindex 700003a34b..3cef6d7b2e 100644--- a/.fallowrc.jsonc+++ b/.fallowrc.jsonc@@ -893,7 +893,6 @@"packages/studio/src/components/sidebar/BlocksTab.tsx","packages/studio/src/components/sidebar/CompositionsTab.tsx","packages/studio/src/components/sidebar/LeftSidebar.tsx",- "packages/studio/src/components/storyboard/StoryboardLoaded.tsx","packages/studio/src/components/StudioRightPanel.tsx","packages/studio/src/components/StudioToast.tsx","packages/studio/src/components/ui/Tooltip.tsx",diff --git a/bun.lock b/bun.lockindex 52b060cc06..07e9a09775 100644--- a/bun.lock+++ b/bun.lock@@ -338,9 +338,7 @@"@phosphor-icons/react": "^2.1.10","@tanstack/react-virtual": "^3.14.6","bpm-detective": "^2.0.5",- "dompurify": "^3.2.4","gsap": "^3.13.0",- "marked": "^14.1.4","mediabunny": "^1.45.3",},"devDependencies": {@@ -1195,8 +1193,6 @@"@types/tough-cookie": ["@types/[email protected]", "", {}, "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA=="],- "@types/trusted-types": ["@types/[email protected]", "", {}, "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw=="],-"@types/whatwg-mimetype": ["@types/[email protected]", "", {}, "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA=="],"@types/ws": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="],@@ -1441,8 +1437,6 @@"domhandler": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0" } }, "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w=="],- "dompurify": ["[email protected]", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-0xzNv0e7oYC6yyuOGZIABPM4qtg3QxLFniDNPP4ZP90wR8Yq3zgwpRbrNiT4N3IKqDbbYFEJLV+JWEs19aZ//w=="],-"domutils": ["[email protected]", "", { "dependencies": { "dom-serializer": "^2.0.0", "domelementtype": "^2.3.0", "domhandler": "^5.0.3" } }, "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw=="],"dot-prop": ["[email protected]", "", { "dependencies": { "is-obj": "^2.0.0" } }, "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q=="],@@ -1755,8 +1749,6 @@"make-dir": ["[email protected]", "", { "dependencies": { "semver": "^7.5.3" } }, "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw=="],- "marked": ["[email protected]", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-vkVZ8ONmUdPnjCKc5uTRvmkRbx4EAi2OkTOXmfTDhZz3OFqMNBM1oTTWwTr4HY4uAEojhzPf+Fy8F1DWa3Sndg=="],-"matcher": ["[email protected]", "", { "dependencies": { "escape-string-regexp": "^4.0.0" } }, "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng=="],"math-intrinsics": ["[email protected]", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],diff --git a/docs/docs.json b/docs/docs.jsonindex c12b0c5372..ea33cd5523 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -203,8 +203,7 @@{"group": "Start in Studio","pages": [- "studio/index",- "studio/storyboard"+ "studio/index"]},{diff --git a/docs/guides/faceless-explainer.mdx b/docs/guides/faceless-explainer.mdxindex 03800be910..198d916f21 100644--- a/docs/guides/faceless-explainer.mdx+++ b/docs/guides/faceless-explainer.mdx@@ -58,8 +58,7 @@ The visuals share one coherent language and develop with the explanation. A diag- The ending lands the sentence you wanted the viewer to remember.Ask the agent when the teaching sequence or evidence must change. Use-[Storyboard](/studio/storyboard) to inspect the sequence directly, or Studio-for a precise visual, timing, or animation correction.+Studio for a precise visual, timing, or animation correction.<Card title="Finish and share" icon="circle-check" href="/guides/export-and-share">Check the final project, render through your preferred surface, and review the file.@@ -68,5 +67,4 @@ for a precise visual, timing, or animation correction.## Related topics- [Prompt for explainers](/prompting/explainers)-- [Review the storyboard](/studio/storyboard)- [Create a product video from real screens](/guides/product-launch-video)diff --git a/docs/guides/general-video.mdx b/docs/guides/general-video.mdxindex 11ebc4c023..cd76459e50 100644--- a/docs/guides/general-video.mdx+++ b/docs/guides/general-video.mdx@@ -69,5 +69,4 @@ Before export, confirm:## Related topics- [Choose a focused workflow](/workflows)-- [Review the story before polishing](/studio/storyboard)- [Edit the built project in Studio](/studio)diff --git a/docs/guides/pr-to-video.mdx b/docs/guides/pr-to-video.mdxindex 81faff6aef..e6b26082e0 100644--- a/docs/guides/pr-to-video.mdx+++ b/docs/guides/pr-to-video.mdx@@ -57,8 +57,8 @@ The video should explain the change, not read the pull request description aloud- Tests and refactoring are not presented as product features.- Contributor names and release details are accurate.-Ask the agent when the explanation or evidence must change. Use Storyboard to-inspect the sequence directly, or Studio for a precise timing, code-framing, or+Ask the agent when the explanation or evidence must change. Use+Studio for a precise timing, code-framing, orcaption correction.<Card title="Finish and share" icon="circle-check" href="/guides/export-and-share">@@ -68,5 +68,4 @@ caption correction.## Related topics- [Prompt for code changes and pull requests](/prompting/code-and-prs)-- [Review the storyboard](/studio/storyboard)- [Create a custom video from several sources](/guides/general-video)diff --git a/docs/help.mdx b/docs/help.mdxindex 64133f52b3..7a5aad2ef3 100644--- a/docs/help.mdx+++ b/docs/help.mdx@@ -20,8 +20,7 @@ If the command cannot find a project, check that you are inside the project fold## Preview is wrong or staleA change is missing, playback looks old, or the preview is blank. Preview's Code-editor and visual controls save automatically. Storyboard drafts show a Save-action when they still need one. If you edited the project in another+editor and visual controls save automatically. If you edited the project in anotherapplication, save that file first.1. Wait for the project refresh, then reload Studio once.@@ -40,7 +39,6 @@ npx hyperframes checkSelection, canvas controls, timing, or an Inspector field is unavailable.- Open **Layers** and select the element there when clicking the canvas is difficult.-- Confirm you are in **Preview**, not Storyboard.- Scrub to a time where the element is actually visible.- Check whether the visual lives inside a nested composition.- Ask the agent when the change affects source structure rather than one visible element.diff --git a/docs/studio/index.mdx b/docs/studio/index.mdxindex c1848a1869..20eb83f30b 100644--- a/docs/studio/index.mdx+++ b/docs/studio/index.mdx@@ -30,8 +30,6 @@ npx hyperframes preview/></Frame>-- **Storyboard** shows the planned sequence, direction, voiceover, status, and- comments. Use it to review the story.- **Preview** shows the built project. The live frame is in the middle, thetimeline is below, project tools are on the left, and the Inspector is on theright.diff --git a/docs/studio/storyboard.mdx b/docs/studio/storyboard.mdxdeleted file mode 100644index 870c5f8a33..0000000000--- a/docs/studio/storyboard.mdx+++ /dev/null@@ -1,65 +0,0 @@-----title: "Review the storyboard"-description: "Review planned frames, direction, voiceover, status, and feedback before or during the build."------The Storyboard view is for reviewing the story, not fine-tuning pixels.--Each frame represents a planned moment and can include visual direction, voiceover, status, source details, and comments.--<Frame caption="Read the arc, inspect each planned frame, and leave story-level feedback before changing the build.">- <img- src="https://static.heygen.ai/hyperframes-oss/docs/images/studio/storyboard-v1.jpg"- alt="Storyboard with the video arc, frame statuses, visual sketches, and comments"- />-</Frame>--## Use the frame statuses--- **Outline** — the frame is still a plan.-- **Built** — a working scene exists.-- **Animated** — motion has been added and the scene is ready for closer review.--Treat a status as progress information, not proof that the frame is approved.--## Review one frame--1. Open Storyboard.-2. Focus the frame you want to inspect.-3. Read its visual direction and voiceover together.-4. Check whether the frame supports the main message.-5. Leave a concrete comment.-6. Choose **Save & copy message**, then paste the message into your agent chat.--Useful feedback describes the problem and desired outcome:--```text-This frame repeats the previous claim. Use it to show the product-workflow instead, and keep the voiceover line unchanged.-```--## Board view and source view--Use the board when you want to understand the sequence visually.--Use the source view when you need to inspect or edit the storyboard text and structured direction more directly.--The voiceover shown on the board is a guide. When the project has a `SCRIPT.md`, that file is the final source for generated narration.--## When to move to Preview--Built and Animated frames can include **Open in Preview**. Use it when the question becomes:--- Is the timing right?-- Is the text readable?-- Does the animation feel correct?-- Is an element aligned?-- Does the media crop work?--Those questions need the built composition rather than the plan alone.--## Related topics--- [Work on the built project in Studio](/studio)-- [Edit the visible frame](/studio/canvas)-- [Direct an agent more precisely](/prompting/anatomy)diff --git a/docs/studio/troubleshooting.mdx b/docs/studio/troubleshooting.mdxindex edf0c7efd6..5715d146c9 100644--- a/docs/studio/troubleshooting.mdx+++ b/docs/studio/troubleshooting.mdx@@ -26,8 +26,7 @@ Undo, zoom in, place the playhead more precisely, and retry. Check whether snapp## The preview did not update-- Preview's Code editor and visual controls save automatically. Storyboard- narration and feedback drafts show their own Save action. If the change came+- Preview's Code editor and visual controls save automatically. If the change camefrom another editor or an agent, confirm that the external file was saved.- Wait for the project refresh.- Check the terminal running `hyperframes preview`.diff --git a/packages/cli/src/commands/preview.test.ts b/packages/cli/src/commands/preview.test.tsindex 4d6c7528fd..885cdf0abf 100644--- a/packages/cli/src/commands/preview.test.ts+++ b/packages/cli/src/commands/preview.test.ts@@ -1,4 +1,4 @@-import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";import * as clack from "@clack/prompts";@@ -17,7 +17,6 @@ import {reportPreviewShutdown,studioReadyUrl,studioDeepLink,- studioLandingSearch,studioSummaryUrls,waitForStudioChildClose,} from "./preview.js";@@ -30,70 +29,25 @@ afterEach(() => {process.exitCode = undefined;});-function projectWith(storyboard: string | null, frameFiles: string[] = []): string {- const dir = mkdtempSync(join(tmpdir(), "hf-preview-landing-"));+function tempProject(): string {+ const dir = mkdtempSync(join(tmpdir(), "hf-preview-"));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("");- });-});-describe("Studio handoff URLs", () => {it("hands off the exact timeline project route", () => {- const dir = projectWith(null);- expect(studioDeepLink("http://127.0.0.1:3002", "demo", dir)).toBe(+ expect(studioDeepLink("http://127.0.0.1:3002", "demo")).toBe("http://127.0.0.1:3002/#project/demo",);- expect(studioSummaryUrls("demo", "http://127.0.0.1:3002", dir)).toEqual({+ expect(studioSummaryUrls("demo", "http://127.0.0.1:3002")).toEqual({serverUrl: "http://127.0.0.1:3002",studioUrl: "http://127.0.0.1:3002/#project/demo",});});- it("hands off the exact storyboard route while a project is still planning", () => {- const dir = projectWith(FRAME(1, "outline"));- expect(studioDeepLink("http://127.0.0.1:3002", "demo", dir)).toBe(- "http://127.0.0.1:3002/?view=storyboard#project/demo",- );- });-it("URL-encodes project names that have hash-route metacharacters", () => {- const dir = projectWith(null);- expect(studioDeepLink("http://127.0.0.1:3002", "Launch #1? 50%", dir)).toBe(+ expect(studioDeepLink("http://127.0.0.1:3002", "Launch #1? 50%")).toBe("http://127.0.0.1:3002/#project/Launch%20%231%3F%2050%25",);});@@ -365,7 +319,7 @@ describe("preview lifecycle JSON failures", () => {});it("wraps managed-start validation failures in one JSON document", async () => {- const dir = projectWith(null);+ const dir = tempProject();writeFileSync(join(dir, "index.html"), "<html></html>");const log = vi.spyOn(console, "log").mockImplementation(() => {});@@ -423,7 +377,7 @@ describe("preview lifecycle JSON failures", () => {describe("foreground preview JSON", () => {it("emits the same ready session contract before remaining attached", () => {- const dir = projectWith(null);+ const dir = tempProject();expect(foregroundPreviewReadyPayload("Launch #1", "http://localhost:4567", dir, 4321)).toEqual({schemaVersion: 1,operation: "start",diff --git a/packages/cli/src/commands/preview.ts b/packages/cli/src/commands/preview.tsindex f1f3858cff..cafafc4752 100644--- a/packages/cli/src/commands/preview.ts+++ b/packages/cli/src/commands/preview.ts@@ -33,16 +33,7 @@ export const examples: Example[] = ["hyperframes preview --lint-verbose",],];-import {- existsSync,- lstatSync,- mkdirSync,- readFileSync,- readlinkSync,- symlinkSync,- unlinkSync,-} from "node:fs";-import { parseStoryboard, STORYBOARD_FILENAME } from "@hyperframes/core/storyboard";+import { existsSync, lstatSync, mkdirSync, readlinkSync, symlinkSync, unlinkSync } from "node:fs";import { resolve, dirname, basename, join } from "node:path";import { fileURLToPath } from "node:url";import { createRequire } from "node:module";@@ -361,7 +352,7 @@ export default defineCommand({);return;}- printStudioSummary(project.name, previewBaseUrl(status.port), project.dir, {+ printStudioSummary(project.name, previewBaseUrl(status.port), {details: [`Background preview running (PID ${status.pid}).`, `Log: ${status.logPath}`],});return;@@ -547,7 +538,7 @@ export default defineCommand({);} else {clack.intro(c.bold("hyperframes preview"));- printStudioSummary(projectName, url, dir, {+ printStudioSummary(projectName, url, {details: [background.type === "reused"? "Reusing the background server already running for this project."@@ -557,7 +548,7 @@ export default defineCommand({footer: `Stop with: hyperframes preview ${JSON.stringify(dir)} --stop`,});}- openStudioBrowser(url, projectName, dir, {+ openStudioBrowser(url, projectName, {noOpen,browserPath,userDataDir,@@ -1181,47 +1172,19 @@ function compactSelectionPayload(selection: StudioSelectionSnapshot): CompactSel};}-// 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).-export function studioDeepLink(url: string, projectName: string, projectDir: string): string {- return `${url}/${studioLandingSearch(projectDir)}#project/${encodeURIComponent(projectName)}`;+// The full Studio URL to open or hand to the user. `url` never carries a+// trailing slash (both the embedded server and the Vite `Local:` match strip it).+export function studioDeepLink(url: string, projectName: string): string {+ return `${url}/#project/${encodeURIComponent(projectName)}`;}export function studioSummaryUrls(projectName: string,serverUrl: string,- projectDir: string,): { serverUrl: string; studioUrl: string } {return {serverUrl,- studioUrl: studioDeepLink(serverUrl, projectName, projectDir),+ studioUrl: studioDeepLink(serverUrl, projectName),};}@@ -1266,20 +1229,15 @@ function previewLifecycleSession(options: {port: options.port,pid: options.pid,serverUrl,- studioUrl: studioDeepLink(serverUrl, options.projectName, options.projectDir),+ studioUrl: studioDeepLink(serverUrl, options.projectName),ready: true,...(options.logPath ? { logPath: options.logPath } : {}),};}-function openStudioBrowser(- url: string,- projectName: string,- projectDir: string,- options?: BrowserLaunchOptions,-): void {+function openStudioBrowser(url: string, projectName: string, options?: BrowserLaunchOptions): void {if (options?.noOpen) return;- openBrowser(studioDeepLink(url, projectName, projectDir), {+ openBrowser(studioDeepLink(url, projectName), {browserPath: options?.browserPath,userDataDir: options?.userDataDir,remoteDebuggingPort: options?.remoteDebuggingPort,@@ -1290,10 +1248,9 @@ function openStudioBrowser(function printStudioSummary(projectName: string,serverUrl: string,- projectDir: string,opts: { details?: string[]; footer?: string } = {},): void {- const urls = studioSummaryUrls(projectName, serverUrl, projectDir);+ const urls = studioSummaryUrls(projectName, serverUrl);console.log();console.log(` ${c.dim("Project")} ${c.accent(projectName)}`);console.log(` ${c.dim("Studio")} ${c.accent(urls.studioUrl)}`);@@ -1406,11 +1363,11 @@ function attachStudioReadyHandler();} else {spinner.stop(c.success("Studio running"));- printStudioSummary(projectName, url, projectDir, {+ printStudioSummary(projectName, url, {footer: "Press Ctrl+C to stop",});}- openStudioBrowser(url, projectName, projectDir, options);+ openStudioBrowser(url, projectName, options);child.stdout.removeListener("data", handleOutput);child.stderr.removeListener("data", handleOutput);}@@ -1631,11 +1588,11 @@ async function runEmbeddedMode();} else {s.stop(c.success("Already running"));- printStudioSummary(pName, url, dir, {+ printStudioSummary(pName, url, {details: ["Reusing existing server. Use --force-new to start a fresh instance."],});}- openStudioBrowser(url, pName, dir, options);+ openStudioBrowser(url, pName, options);return;}@@ -1649,7 +1606,7 @@ async function runEmbeddedMode(console.log(` ${c.warn(`Port ${startPort} is in use, using ${result.port} instead`)}`);console.log();}- printStudioSummary(pName, url, dir, {+ printStudioSummary(pName, url, {details: ["Edit with your AI agent — it has HyperFrames skills installed.","Changes reload automatically in the studio.",@@ -1657,7 +1614,7 @@ async function runEmbeddedMode(footer: "Press Ctrl+C to stop",});}- openStudioBrowser(url, pName, dir, options);+ openStudioBrowser(url, pName, 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 thediff --git a/packages/core/src/storyboard/types.ts b/packages/core/src/storyboard/types.tsindex 6e783250ef..9e7cf144ae 100644--- a/packages/core/src/storyboard/types.ts+++ b/packages/core/src/storyboard/types.ts@@ -4,7 +4,7 @@* A storyboard is the plan for a video before any animation work happens: an* ordered set of frames (key moments) plus their narrative/script. It is* authored as a single canonical markdown file (`STORYBOARD.md`) and parsed- * into this normalized shape for the Studio's storyboard view and for agents.+ * into this normalized shape for agents.** See PRD: "Storyboarding in HyperFrames". The markdown stays canonical; this* is the derived structure the parser produces.diff --git a/packages/studio-server/src/createStudioApi.ts b/packages/studio-server/src/createStudioApi.tsindex 5976ced33a..cf5e676097 100644--- a/packages/studio-server/src/createStudioApi.ts+++ b/packages/studio-server/src/createStudioApi.ts@@ -1,7 +1,6 @@import { Hono } from "hono";import type { StudioApiAdapter } from "./types.js";import { registerProjectRoutes } from "./routes/projects.js";-import { registerStoryboardRoutes } from "./routes/storyboard.js";import { registerFileRoutes } from "./routes/files.js";import { registerPreviewRoutes } from "./routes/preview.js";import { registerLintRoutes } from "./routes/lint.js";@@ -24,7 +23,6 @@ export function createStudioApi(adapter: StudioApiAdapter): Hono {const api = new Hono();registerProjectRoutes(api, adapter);- registerStoryboardRoutes(api, adapter);registerFileRoutes(api, adapter);registerPreviewRoutes(api, adapter);registerLintRoutes(api, adapter);diff --git a/packages/studio-server/src/routes/projects.ts b/packages/studio-server/src/routes/projects.tsindex b0ca6ad2a5..a0a3580cb4 100644--- a/packages/studio-server/src/routes/projects.ts+++ b/packages/studio-server/src/routes/projects.ts@@ -40,9 +40,7 @@ export function registerProjectRoutes(api: Hono, adapter: StudioApiAdapter): voireturn c.json(result);});- // Current content signature for a project — a cheap poll target for clients- // that refresh themselves when files change on disk (the storyboard board- // re-fetches when this differs from the signature its data was loaded with).+ // Current content signature for a project: a cheap poll target for clients that refresh when files change on disk.api.get("/projects/:id/signature", async (c) => {const project = await adapter.resolveProject(c.req.param("id"));if (!project) return c.json({ error: "not found" }, 404);diff --git a/packages/studio-server/src/routes/storyboard.test.ts b/packages/studio-server/src/routes/storyboard.test.tsdeleted file mode 100644index a2fd535235..0000000000--- a/packages/studio-server/src/routes/storyboard.test.ts+++ /dev/null@@ -1,122 +0,0 @@-import { afterEach, describe, expect, it } from "vitest";-import { Hono } from "hono";-import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";-import { tmpdir } from "node:os";-import { join } from "node:path";-import { registerStoryboardRoutes } from "./storyboard.js";-import type { StudioApiAdapter } from "../types.js";--const tempDirs: string[] = [];--afterEach(() => {- for (const dir of tempDirs.splice(0)) {- rmSync(dir, { recursive: true, force: true });- }-});--function makeProject(): string {- const dir = mkdtempSync(join(tmpdir(), "storyboard-route-"));- tempDirs.push(dir);- return dir;-}--function makeApp(projectDir: string): Hono {- const adapter = {- resolveProject: (id: string) => (id === "p" ? { id: "p", dir: projectDir } : null),- } as unknown as StudioApiAdapter;- const app = new Hono();- registerStoryboardRoutes(app, adapter);- return app;-}--/** Request the storyboard for project "p" and return status + parsed JSON body. */-async function getStoryboard(projectDir: string) {- const res = await makeApp(projectDir).request("/projects/p/storyboard");- return { status: res.status, body: await res.json() };-}--describe("GET /projects/:id/storyboard", () => {- it("returns exists:false with empty frames when STORYBOARD.md is absent", async () => {- const { status, body } = await getStoryboard(makeProject());- expect(status).toBe(200);- expect(body.exists).toBe(false);- expect(body.frames).toEqual([]);- });-- it("404s for an unknown project", async () => {- const res = await makeApp(makeProject()).request("/projects/nope/storyboard");- expect(res.status).toBe(404);- });-- it("parses the manifest and resolves frame src existence on disk", async () => {- const dir = makeProject();- mkdirSync(join(dir, "compositions", "frames"), { recursive: true });- writeFileSync(join(dir, "compositions", "frames", "01-hook.html"), "<div></div>");- writeFileSync(- join(dir, "STORYBOARD.md"),- `----message: Hello world------## Frame 1 — Hook-- status: built-- src: compositions/frames/01-hook.html--Opening line.--## Frame 2 — Missing-- status: outline-- src: compositions/frames/02-missing.html--Not built yet.-`,- );-- const { status, body } = await getStoryboard(dir);- expect(status).toBe(200);- expect(body.exists).toBe(true);- expect(body.globals.message).toBe("Hello world");- expect(body.frames).toHaveLength(2);- expect(body.frames[0]).toMatchObject({ title: "Hook", status: "built", srcExists: true });- expect(body.frames[1]).toMatchObject({ title: "Missing", status: "outline", srcExists: false });- });-- it("surfaces the companion SCRIPT.md when present", async () => {- const dir = makeProject();- writeFileSync(join(dir, "STORYBOARD.md"), "## Frame 1\n\nHi.\n");- writeFileSync(join(dir, "SCRIPT.md"), "# Script\n\nLine 1.\n");- const { body } = await getStoryboard(dir);- expect(body.script).toMatchObject({ exists: true, path: "SCRIPT.md" });- expect(body.script.content).toContain("Line 1.");- });-- it("reports script.exists=false when there is no SCRIPT.md", async () => {- const dir = makeProject();- writeFileSync(join(dir, "STORYBOARD.md"), "## Frame 1\n\nHi.\n");- const { body } = await getStoryboard(dir);- expect(body.script.exists).toBe(false);- });-- it("does not resolve src paths that escape the project", async () => {- const dir = makeProject();- writeFileSync(- join(dir, "STORYBOARD.md"),- "## Frame 1\n- src: ../../etc/passwd\n\nEscape attempt.\n",- );- const { body } = await getStoryboard(dir);- expect(body.frames[0].srcExists).toBe(false);- });-- it("carries a project signature in both the absent and present branches", async () => {- const dir = makeProject();- const absent = await getStoryboard(dir);- expect(absent.body.exists).toBe(false);- expect(absent.body.signature).toMatch(/^[0-9a-f]{24}$/);-- writeFileSync(join(dir, "STORYBOARD.md"), "## Frame 1\n\nHi.\n");- const present = await getStoryboard(dir);- expect(present.body.exists).toBe(true);- expect(present.body.signature).toMatch(/^[0-9a-f]{24}$/);- expect(present.body.signature).not.toBe(absent.body.signature);- });-});diff --git a/packages/studio-server/src/routes/storyboard.ts b/packages/studio-server/src/routes/storyboard.tsdeleted file mode 100644index 519463b295..0000000000--- a/packages/studio-server/src/routes/storyboard.ts+++ /dev/null@@ -1,86 +0,0 @@-import { existsSync, readFileSync } from "node:fs";-import type { Hono } from "hono";-import type { StudioApiAdapter } from "../types.js";-import { resolveWithinProject } from "../helpers/safePath.js";-import { resolveProjectAndSignature } from "../helpers/projectSignature.js";-import {- parseStoryboard,- SCRIPT_FILENAME,- STORYBOARD_FILENAME,- type StoryboardFrame,-} from "@hyperframes/core/storyboard";--/** A frame enriched with disk-resolution info the Studio needs to render tiles. */-interface ResolvedStoryboardFrame extends StoryboardFrame {- /** Whether `src` resolves to an existing file inside the project. */- srcExists: boolean;-}--function resolveFrames(projectDir: string, frames: StoryboardFrame[]): ResolvedStoryboardFrame[] {- return frames.map((frame) => {- let srcExists = false;- if (frame.src) {- const abs = resolveWithinProject(projectDir, frame.src);- srcExists = abs ? existsSync(abs) : false;- }- return { ...frame, srcExists };- });-}--/** Read the companion SCRIPT.md narration doc if it exists alongside the storyboard. */-function readScript(projectDir: string): { exists: boolean; path: string; content: string } {- const abs = resolveWithinProject(projectDir, SCRIPT_FILENAME);- if (abs && existsSync(abs)) {- try {- return { exists: true, path: SCRIPT_FILENAME, content: readFileSync(abs, "utf-8") };- } catch {- /* fall through to absent */- }- }- return { exists: false, path: SCRIPT_FILENAME, content: "" };-}--export function registerStoryboardRoutes(api: Hono, adapter: StudioApiAdapter): void {- // Parsed storyboard manifest for a project. Markdown (STORYBOARD.md) stays- // canonical on disk; this returns the derived, normalized structure. When the- // file is absent we return `exists: false` with empty frames rather than 404,- // so the Studio can render an opt-in empty state.- api.get("/projects/:id/storyboard", async (c) => {- // The signature lets the board bust poster caches and lets the client tell- // whether this payload is already current (see /projects/:id/signature).- const resolved = await resolveProjectAndSignature(adapter, c.req.param("id"));- if (!resolved) return c.json({ error: "not found" }, 404);- const { project, signature } = resolved;-- const abs = resolveWithinProject(project.dir, STORYBOARD_FILENAME);- if (!abs || !existsSync(abs)) {- return c.json({- exists: false,- path: STORYBOARD_FILENAME,- globals: { extra: {} },- frames: [],- warnings: [],- script: readScript(project.dir),- signature,- });- }-- let source: string;- try {- source = readFileSync(abs, "utf-8");- } catch {- return c.json({ error: "failed to read storyboard" }, 500);- }-- const manifest = parseStoryboard(source);- return c.json({- exists: true,- path: STORYBOARD_FILENAME,- globals: manifest.globals,- frames: resolveFrames(project.dir, manifest.frames),- warnings: manifest.warnings,- script: readScript(project.dir),- signature,- });- });-}diff --git a/packages/studio-server/src/routes/thumbnail.test.ts b/packages/studio-server/src/routes/thumbnail.test.tsindex c45b94491b..cef84b0c2b 100644--- a/packages/studio-server/src/routes/thumbnail.test.ts+++ b/packages/studio-server/src/routes/thumbnail.test.ts@@ -94,13 +94,9 @@ describe("registerThumbnailRoutes", () => {const previewResponse = await app.request("http://localhost/projects/demo/thumbnail/index.html?t=1.2&output=preview",);- const storyboardResponse = await app.request(- "http://localhost/projects/demo/thumbnail/index.html?t=1.2&output=storyboard",- );expect(sourceResponse.status).toBe(200);expect(previewResponse.status).toBe(200);- expect(storyboardResponse.status).toBe(200);expect(adapter.generateThumbnail).toHaveBeenNthCalledWith(1,expect.objectContaining({@@ -113,30 +109,6 @@ describe("registerThumbnailRoutes", () => {2,expect.objectContaining({ outputWidth: 135, outputHeight: 135 }),);- expect(adapter.generateThumbnail).toHaveBeenNthCalledWith(- 3,- expect.objectContaining({ outputWidth: 1080, outputHeight: 1080 }),- );- });-- it("caps storyboard output at a 1080px longest side", async () => {- const adapter = createAdapter();- const app = new Hono();- registerThumbnailRoutes(app, adapter);- await writeComposition(adapter, 7680, 4320);-- const response = await app.request(- "http://localhost/projects/demo/thumbnail/index.html?t=1.2&output=storyboard",- );-- expect(response.status).toBe(200);- expect(adapter.generateThumbnail).toHaveBeenCalledWith(- expect.objectContaining({- format: "jpeg",- outputWidth: 1080,- outputHeight: 608,- }),- );});it("deduplicates concurrent generation and writes one complete cache entry", async () => {diff --git a/packages/studio-server/src/routes/thumbnail.ts b/packages/studio-server/src/routes/thumbnail.tsindex ab1a482fe7..fd94338cac 100644--- a/packages/studio-server/src/routes/thumbnail.ts+++ b/packages/studio-server/src/routes/thumbnail.ts@@ -21,7 +21,6 @@ import { thumbnailGenerationCoordinator } from "./thumbnailGenerationCoordinatorconst THUMBNAIL_CACHE_VERSION = "v4";const THUMBNAIL_MAX_OUTPUT_WIDTH = 240;const THUMBNAIL_MAX_OUTPUT_HEIGHT = 135;-const STORYBOARD_MAX_OUTPUT_DIMENSION = 1080;const THUMBNAIL_CACHE_MAX_BYTES = 512 * 1024 * 1024;const THUMBNAIL_CACHE_MAX_AGE_MS = 14 * 24 * 60 * 60 * 1000;const prunedCacheDirs = new Set<string>();@@ -101,13 +100,9 @@ export function registerThumbnailRoutes(api: Hono, adapter: StudioApiAdapter): v// PNG is the legacy source-density capture contract. Callers can opt either// format into the bounded preview contract explicitly.const outputMode =- requestedOutput === "source"+ requestedOutput === "source" || (requestedOutput !== "preview" && format === "png")? "source"- : requestedOutput === "storyboard"- ? "storyboard"- : requestedOutput !== "preview" && format === "png"- ? "source"- : "preview";+ : "preview";const rawSelectorIndex = Number.parseInt(url.searchParams.get("selectorIndex") || "0", 10);const selectorIndex =Number.isFinite(rawSelectorIndex) && rawSelectorIndex > 0 ? rawSelectorIndex : undefined;@@ -168,13 +163,7 @@ export function registerThumbnailRoutes(api: Hono, adapter: StudioApiAdapter): vconst outputScale =outputMode === "source"? 1- : outputMode === "storyboard"- ? Math.min(- 1,- STORYBOARD_MAX_OUTPUT_DIMENSION / compW,- STORYBOARD_MAX_OUTPUT_DIMENSION / compH,- )- : Math.min(1, THUMBNAIL_MAX_OUTPUT_WIDTH / compW, THUMBNAIL_MAX_OUTPUT_HEIGHT / compH);+ : Math.min(1, THUMBNAIL_MAX_OUTPUT_WIDTH / compW, THUMBNAIL_MAX_OUTPUT_HEIGHT / compH);const outputWidth = Math.max(1, Math.round(compW * outputScale));const outputHeight = Math.max(1, Math.round(compH * outputScale));const cacheKey = `${THUMBNAIL_CACHE_VERSION}${urlVersionKey}${projectSignatureKey}${manualEditsKey}${motionKey}${sourceKey}_${format}_${outputMode}_${compPath.replace(/\//g, "_")}_${compW}x${compH}_${outputWidth}x${outputHeight}_${sourceMtime}_${seekTime.toFixed(2)}${selectorKey}.${format === "png" ? "png" : "jpg"}`;diff --git a/packages/studio/fixtures/storyboard-sample/README.md b/packages/studio/fixtures/storyboard-sample/README.mddeleted file mode 100644index cf76a5b140..0000000000--- a/packages/studio/fixtures/storyboard-sample/README.md+++ /dev/null@@ -1,26 +0,0 @@-# storyboard-sample (Studio fixture)--A small, self-contained project for dogfooding the Studio **Storyboard** view.-Not a registry catalog item — it lives here purely as test content for the-storyboard UI/UX work.--It exercises the storyboard contract end to end:--- `STORYBOARD.md` — structured manifest (frontmatter + 5 frames) in the canonical- format the parser reads.-- `compositions/frames/0{1..4}-*.html` — live HTML frame sub-compositions- (`built` / `animated` statuses) the contact-sheet tiles render.-- Frame 5 (`05-cta.html`) is intentionally **absent** and `status: outline`, so- the grid has an outline placeholder to render.--Preview the storyboard view:--```bash-npx hyperframes preview packages/studio/fixtures/storyboard-sample-```--Inspect just the parsed manifest the Studio consumes:--```bash-curl localhost:<port>/api/projects/<id>/storyboard | jq-```diff --git a/packages/studio/fixtures/storyboard-sample/SCRIPT.md b/packages/studio/fixtures/storyboard-sample/SCRIPT.mddeleted file mode 100644index c58be55209..0000000000--- a/packages/studio/fixtures/storyboard-sample/SCRIPT.md+++ /dev/null@@ -1,52 +0,0 @@-# SCRIPT — storyboard-sample--**Voice:** Rachel (ElevenLabs)-**Voice settings:** stability 0.35 · similarity 0.75 · style 0.20-**Voice direction:** Confident, warm, a little playful. Sounds like a person, never a reader.-------## Line 1 — Hook (Frame 1)--**Time:** 0.0 – 3.0s-**Delivery:** Land the promise on the beat. Slight smile.--```-Ship a launch video in an afternoon.-```--## Line 2 — The problem (Frame 2)--**Time:** 3.0 – 7.0s-**Delivery:** Wry, a touch tired — the old grind.--```-The old way? Prompt, wait twenty minutes, get something that misses.-```--## Line 3 — The feature (Frame 3)--**Time:** 7.0 – 12.0s-**Delivery:** Lift into confidence on "then it animates."--```-You lock the story first — then it animates.-```--## Line 4 — Proof (Frame 4)--**Time:** 12.0 – 16.0s-**Delivery:** Punchy, two clean beats.--```-Fewer re-renders. More finished videos.-```--## Line 5 — CTA (Frame 5)--**Time:** 16.0 – 19.0s-**Delivery:** Calm, inviting. Let the command land.--```-Try it: npx hyperframes.-```diff --git a/packages/studio/fixtures/storyboard-sample/STORYBOARD.md b/packages/studio/fixtures/storyboard-sample/STORYBOARD.mddeleted file mode 100644index 45f3b79b62..0000000000--- a/packages/studio/fixtures/storyboard-sample/STORYBOARD.md+++ /dev/null@@ -1,71 +0,0 @@-----format: 1920x1080-message: "Ship a launch video in an afternoon"-arc: Hook → Problem → Solution → Proof → CTA-audience: indie devs on X-voice: Rachel — 5 lines from SCRIPT.md------## Frame 1 — Hook--- scene: Big type punches in on the beat-- duration: 3s-- poster: 2s-- transition_in: cut-- status: animated-- voiceover: "Ship a launch video in an afternoon."-- src: compositions/frames/01-hook.html--Open cold on the promise. Big type punches in on the beat: "Ship a launch-video in an afternoon." This is the thesis — everything after pays it off.--## Frame 2 — The problem--- scene: A 20-minute timer spins on a stack of rejected takes-- duration: 4s-- poster: 2.6s-- transition_in: crossfade-- status: animated-- voiceover: "The old way? Prompt, wait twenty minutes, get something that misses."-- src: compositions/frames/02-problem.html--The old way: prompt, wait twenty minutes, get something that misses. A timer-spins while a stack of rejected takes piles up. Establish the pain we remove.--## Frame 3 — The feature in action--- scene: Frames line up as a contact sheet-- duration: 5s-- poster: 3.3s-- transition_in: crossfade-- status: built-- voiceover: "You lock the story first — then it animates."-- src: compositions/frames/03-feature.html--Cut to the storyboard view itself. Frames line up as a contact sheet and the-narration says "...you lock the story first, then it animates." Show, don't tell.--## Frame 4 — Proof--- scene: A stat counts up to the payoff number-- duration: 4s-- poster: 2.6s-- transition_in: wipe-- status: built-- voiceover: "Fewer re-renders. More finished videos."-- src: compositions/frames/04-proof.html--A real metric lands: fewer re-renders per finished video. Number counts up-while a caption credits the storyboard-first flow.--## Frame 5 — Call to action--- scene: End card with the wordmark and a one-line CTA-- duration: 3s-- transition_in: crossfade-- status: outline-- voiceover: "Try it: npx hyperframes."-- src: compositions/frames/05-cta.html--End card, still an outline. "Try it: npx hyperframes" with the wordmark. Not-built yet — this frame should render as an outline placeholder in the grid.diff --git a/packages/studio/fixtures/storyboard-sample/compositions/frames/01-hook.html b/packages/studio/fixtures/storyboard-sample/compositions/frames/01-hook.htmldeleted file mode 100644index c67e1bda12..0000000000--- a/packages/studio/fixtures/storyboard-sample/compositions/frames/01-hook.html+++ /dev/null@@ -1,50 +0,0 @@-<template id="frame-01-hook-template">- <div data-composition-id="frame-01-hook" data-width="1920" data-height="1080" data-duration="3">- <div class="canvas">- <h1 class="headline">Ship a launch video<br /><em>in an afternoon</em></h1>- </div>-- <style>- [data-composition-id="frame-01-hook"] .canvas {- width: 1920px;- height: 1080px;- background: radial-gradient(circle at 50% 40%, #1b1140 0%, #07060f 70%);- display: flex;- align-items: center;- justify-content: center;- font-family: "Inter", system-ui, sans-serif;- overflow: hidden;- }- [data-composition-id="frame-01-hook"] .headline {- color: #fff;- font-size: 120px;- font-weight: 800;- line-height: 1.05;- letter-spacing: -0.03em;- text-align: center;- opacity: 0;- }- [data-composition-id="frame-01-hook"] .headline em {- color: #8b7bff;- font-style: normal;- }- </style>-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>- <script>- (function () {- const tl = gsap.timeline({ paused: true });- const h = '[data-composition-id="frame-01-hook"] .headline';- tl.fromTo(- h,- { opacity: 0, scale: 0.86 },- { opacity: 1, scale: 1, duration: 0.6, ease: "back.out(1.4)" },- 0.1,- );- tl.to(h, { scale: 1.04, duration: 2, ease: "none" }, 0.7);- window.__timelines = window.__timelines || {};- window.__timelines["frame-01-hook"] = tl;- })();- </script>- </div>-</template>diff --git a/packages/studio/fixtures/storyboard-sample/compositions/frames/02-problem.html b/packages/studio/fixtures/storyboard-sample/compositions/frames/02-problem.htmldeleted file mode 100644index af5dc65a36..0000000000--- a/packages/studio/fixtures/storyboard-sample/compositions/frames/02-problem.html+++ /dev/null@@ -1,62 +0,0 @@-<template id="frame-02-problem-template">- <div- data-composition-id="frame-02-problem"- data-width="1920"- data-height="1080"- data-duration="4"- >- <div class="canvas">- <div class="spinner"></div>- <div class="timer">20:00</div>- <div class="label">prompt · wait · miss · repeat</div>- </div>-- <style>- [data-composition-id="frame-02-problem"] .canvas {- width: 1920px;- height: 1080px;- background: #0c0a14;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- gap: 40px;- font-family: "Inter", system-ui, sans-serif;- overflow: hidden;- }- [data-composition-id="frame-02-problem"] .spinner {- width: 180px;- height: 180px;- border-radius: 50%;- border: 14px solid #2a2342;- border-top-color: #8b7bff;- }- [data-composition-id="frame-02-problem"] .timer {- color: #fff;- font-size: 96px;- font-weight: 700;- font-variant-numeric: tabular-nums;- letter-spacing: 0.02em;- }- [data-composition-id="frame-02-problem"] .label {- color: #6f6790;- font-size: 34px;- letter-spacing: 0.08em;- text-transform: uppercase;- opacity: 0;- }- </style>-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>- <script>- (function () {- const id = '[data-composition-id="frame-02-problem"]';- const tl = gsap.timeline({ paused: true });- tl.to(id + " .spinner", { rotation: 720, duration: 4, ease: "none" }, 0);- tl.to(id + " .label", { opacity: 1, duration: 0.5, ease: "power2.out" }, 0.8);- window.__timelines = window.__timelines || {};- window.__timelines["frame-02-problem"] = tl;- })();- </script>- </div>-</template>diff --git a/packages/studio/fixtures/storyboard-sample/compositions/frames/03-feature.html b/packages/studio/fixtures/storyboard-sample/compositions/frames/03-feature.htmldeleted file mode 100644index 8aae2f51b8..0000000000--- a/packages/studio/fixtures/storyboard-sample/compositions/frames/03-feature.html+++ /dev/null@@ -1,84 +0,0 @@-<template id="frame-03-feature-template">- <div- data-composition-id="frame-03-feature"- data-width="1920"- data-height="1080"- data-duration="5"- >- <div class="canvas">- <div class="sheet">- <div class="tile t1"></div>- <div class="tile t2"></div>- <div class="tile t3"></div>- <div class="tile t4"></div>- </div>- <div class="cap">Lock the story first. Then it animates.</div>- </div>-- <style>- [data-composition-id="frame-03-feature"] .canvas {- width: 1920px;- height: 1080px;- background: #f5f3ec;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- gap: 56px;- font-family: "Inter", system-ui, sans-serif;- overflow: hidden;- }- [data-composition-id="frame-03-feature"] .sheet {- display: grid;- grid-template-columns: repeat(2, 360px);- grid-auto-rows: 202px;- gap: 28px;- }- [data-composition-id="frame-03-feature"] .tile {- border-radius: 18px;- opacity: 0;- }- [data-composition-id="frame-03-feature"] .t1 {- background: #8b7bff;- }- [data-composition-id="frame-03-feature"] .t2 {- background: #ff7262;- }- [data-composition-id="frame-03-feature"] .t3 {- background: #1abcfe;- }- [data-composition-id="frame-03-feature"] .t4 {- background: #0acf83;- }- [data-composition-id="frame-03-feature"] .cap {- color: #1a1726;- font-size: 44px;- font-weight: 600;- letter-spacing: -0.01em;- opacity: 0;- }- </style>-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>- <script>- (function () {- const id = '[data-composition-id="frame-03-feature"]';- const tl = gsap.timeline({ paused: true });- tl.to(- id + " .tile",- { opacity: 1, y: 0, duration: 0.5, stagger: 0.18, ease: "back.out(1.3)" },- 0.2,- );- tl.fromTo(- id + " .tile",- { y: 30 },- { y: 0, duration: 0.5, stagger: 0.18, ease: "back.out(1.3)" },- 0.2,- );- tl.to(id + " .cap", { opacity: 1, duration: 0.6, ease: "power2.out" }, 1.4);- window.__timelines = window.__timelines || {};- window.__timelines["frame-03-feature"] = tl;- })();- </script>- </div>-</template>diff --git a/packages/studio/fixtures/storyboard-sample/compositions/frames/04-proof.html b/packages/studio/fixtures/storyboard-sample/compositions/frames/04-proof.htmldeleted file mode 100644index d02ad55a12..0000000000--- a/packages/studio/fixtures/storyboard-sample/compositions/frames/04-proof.html+++ /dev/null@@ -1,68 +0,0 @@-<template id="frame-04-proof-template">- <div data-composition-id="frame-04-proof" data-width="1920" data-height="1080" data-duration="4">- <div class="canvas">- <div class="stat"><span class="num">0</span><span class="unit">%</span></div>- <div class="cap">fewer re-renders per finished video</div>- </div>-- <style>- [data-composition-id="frame-04-proof"] .canvas {- width: 1920px;- height: 1080px;- background: linear-gradient(160deg, #07060f 0%, #161033 100%);- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- gap: 24px;- font-family: "Inter", system-ui, sans-serif;- overflow: hidden;- }- [data-composition-id="frame-04-proof"] .stat {- display: flex;- align-items: baseline;- color: #8b7bff;- font-weight: 800;- letter-spacing: -0.04em;- }- [data-composition-id="frame-04-proof"] .num {- font-size: 320px;- font-variant-numeric: tabular-nums;- }- [data-composition-id="frame-04-proof"] .unit {- font-size: 160px;- }- [data-composition-id="frame-04-proof"] .cap {- color: #cfc9ec;- font-size: 44px;- font-weight: 500;- opacity: 0;- }- </style>-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>- <script>- (function () {- const id = '[data-composition-id="frame-04-proof"]';- const numEl = document.querySelector(id + " .num");- const tl = gsap.timeline({ paused: true });- const counter = { v: 0 };- tl.to(- counter,- {- v: 41,- duration: 1.6,- ease: "power2.out",- onUpdate() {- if (numEl) numEl.textContent = String(Math.round(counter.v));- },- },- 0.3,- );- tl.to(id + " .cap", { opacity: 1, duration: 0.6, ease: "power2.out" }, 1.4);- window.__timelines = window.__timelines || {};- window.__timelines["frame-04-proof"] = tl;- })();- </script>- </div>-</template>diff --git a/packages/studio/fixtures/storyboard-sample/index.html b/packages/studio/fixtures/storyboard-sample/index.htmldeleted file mode 100644index 3d23dc6d60..0000000000--- a/packages/studio/fixtures/storyboard-sample/index.html+++ /dev/null@@ -1,81 +0,0 @@-<!doctype html>-<html lang="en">- <head>- <meta charset="UTF-8" />- <meta name="viewport" content="width=1920, height=1080" />- <title>Storyboard Demo</title>- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gsap.min.js"></script>- <style>- * {- margin: 0;- padding: 0;- box-sizing: border-box;- }- html,- body {- width: 1920px;- height: 1080px;- overflow: hidden;- background: #07060f;- }- .scene {- position: absolute;- inset: 0;- width: 100%;- height: 100%;- }- </style>- </head>- <body>- <div- id="root"- data-composition-id="main"- data-start="0"- data-duration="16"- data-width="1920"- data-height="1080"- >- <div- id="frame-1"- class="scene"- data-composition-id="frame-01-hook"- data-composition-src="compositions/frames/01-hook.html"- data-start="0"- data-duration="3"- data-track-index="1"- ></div>- <div- id="frame-2"- class="scene"- data-composition-id="frame-02-problem"- data-composition-src="compositions/frames/02-problem.html"- data-start="3"- data-duration="4"- data-track-index="1"- ></div>- <div- id="frame-3"- class="scene"- data-composition-id="frame-03-feature"- data-composition-src="compositions/frames/03-feature.html"- data-start="7"- data-duration="5"- data-track-index="1"- ></div>- <div- id="frame-4"- class="scene"- data-composition-id="frame-04-proof"- data-composition-src="compositions/frames/04-proof.html"- data-start="12"- data-duration="4"- data-track-index="1"- ></div>- </div>-- <script>- window.__timelines = window.__timelines || {};- window.__timelines["main"] = gsap.timeline({ paused: true });- </script>- </body>-</html>diff --git a/packages/studio/package.json b/packages/studio/package.jsonindex 6dc522f050..ea98f3b954 100644--- a/packages/studio/package.json+++ b/packages/studio/package.json@@ -76,9 +76,7 @@"@phosphor-icons/react": "^2.1.10","@tanstack/react-virtual": "^3.14.6","bpm-detective": "^2.0.5",- "dompurify": "^3.2.4","gsap": "^3.13.0",- "marked": "^14.1.4","mediabunny": "^1.45.3"},"devDependencies": {diff --git a/packages/studio/src/App.tsx b/packages/studio/src/App.tsxindex cd7ac40bbc..1877673daf 100644--- a/packages/studio/src/App.tsx+++ b/packages/studio/src/App.tsx@@ -53,8 +53,6 @@ import { StudioRightPanel } from "./components/StudioRightPanel";import { TimelineToolbar } from "./components/TimelineToolbar";import { StudioPlaybackProvider, StudioShellProvider } from "./contexts/StudioContext";import { PanelLayoutProvider } from "./contexts/PanelLayoutContext";-import { ViewModeProvider, useViewModeState } from "./contexts/ViewModeContext";-import { StoryboardView } from "./components/storyboard/StoryboardView";import { FileManagerProvider } from "./contexts/FileManagerContext";import { DomEditProvider } from "./contexts/DomEditContext";import { StudioSplash } from "./components/StudioSplash";@@ -68,7 +66,6 @@ const getTimelineSelectionSet = () => usePlayerStore.getState().selectedElementIexport function StudioApp() {const { projectId, resolving, waitingForServer } = useServerConnection();const initialUrlStateRef = useRef(readStudioUrlStateFromWindow());- const viewModeValue = useViewModeState();useStudioSessionStart(projectId, resolving, waitingForServer);const [compIdToSrc, setCompIdToSrc] = useState<Map<string, string>>(new Map());const [previewIframe, setPreviewIframe] = useState<HTMLIFrameElement | null>(null);@@ -441,144 +438,135 @@ export function StudioApp() {return (<StudioShellProvider value={studioCtxValue}><StudioPlaybackProvider value={studioCtxValue}>- <ViewModeProvider value={viewModeValue}>- <PanelLayoutProvider value={panelLayout}>- <FileManagerProvider value={fileManager}>- <DomEditProvider value={domEditSession}>- <div- className="flex flex-col h-full w-full bg-neutral-950 relative"- onDragOver={fileDrop.onDragOver}- onDrop={fileDrop.onDrop}- >- <StudioHeader- captureFrameHref={frameCapture.captureFrameHref}- captureFrameFilename={frameCapture.captureFrameFilename}- handleCaptureFrameClick={frameCapture.handleCaptureFrameClick}- refreshCaptureFrameTime={frameCapture.refreshCaptureFrameTime}- capturing={frameCapture.capturing}- inspectorButtonActive={inspectorButtonActive}- inspectorPanelActive={inspectorPanelActive}- onExport={() => {- void (async () => {- await previewPersistence.waitForPendingDomEditSaves();- await renderQueue.startRender(undefined);- })();- }}+ <PanelLayoutProvider value={panelLayout}>+ <FileManagerProvider value={fileManager}>+ <DomEditProvider value={domEditSession}>+ <div+ className="flex flex-col h-full w-full bg-neutral-950 relative"+ onDragOver={fileDrop.onDragOver}+ onDrop={fileDrop.onDrop}+ >+ <StudioHeader+ captureFrameHref={frameCapture.captureFrameHref}+ captureFrameFilename={frameCapture.captureFrameFilename}+ handleCaptureFrameClick={frameCapture.handleCaptureFrameClick}+ refreshCaptureFrameTime={frameCapture.refreshCaptureFrameTime}+ capturing={frameCapture.capturing}+ inspectorButtonActive={inspectorButtonActive}+ inspectorPanelActive={inspectorPanelActive}+ onExport={() => {+ void (async () => {+ await previewPersistence.waitForPendingDomEditSaves();+ await renderQueue.startRender(undefined);+ })();+ }}+ />+ {previewPersistence.domEditSaveQueuePaused && !externalFileChanges.blocked && (+ <SaveQueuePausedBanner+ message={previewPersistence.domEditSaveQueuePaused}+ onRetry={previewPersistence.resetDomEditSaveQueueBreaker}/>- {previewPersistence.domEditSaveQueuePaused && !externalFileChanges.blocked && (- <SaveQueuePausedBanner- message={previewPersistence.domEditSaveQueuePaused}- onRetry={previewPersistence.resetDomEditSaveQueueBreaker}- />- )}- <ExternalFileConflictBanner coordinator={externalFileChanges} />- {viewModeValue.viewMode === "storyboard" && (- <StoryboardView- projectId={projectId}+ )}+ <ExternalFileConflictBanner coordinator={externalFileChanges} />+ <EditorShell+ left={+ <StudioLeftSidebar+ leftSidebarRef={leftSidebarRef}onSelectComposition={handleSelectComposition}+ onAddBlock={handleAddBlock}+ onPreviewBlock={setBlockPreview}+ onLint={handleLint}+ linting={linting}+ lintFindingCount={lintModal?.length ?? findingsByFile.size}+ lintFindingsByFile={findingsByFile}+ onAddAssetToTimeline={handleAddAssetAtPlayhead}+ onAddCompositionToTimeline={handleAddCompositionAtPlayhead}/>- )}- <EditorShell- hidden={viewModeValue.viewMode === "storyboard"}- left={- <StudioLeftSidebar- leftSidebarRef={leftSidebarRef}- onSelectComposition={handleSelectComposition}- onAddBlock={handleAddBlock}- onPreviewBlock={setBlockPreview}- onLint={handleLint}- linting={linting}- lintFindingCount={lintModal?.length ?? findingsByFile.size}- lintFindingsByFile={findingsByFile}- onAddAssetToTimeline={handleAddAssetAtPlayhead}- onAddCompositionToTimeline={handleAddCompositionAtPlayhead}+ }+ right={+ panelLayout.effectiveRightCollapsed ? null : (+ <StudioRightPanel+ designPanelActive={designPanelActive}+ activeBlockParams={activeBlockParams}+ onCloseBlockParams={() => {+ setActiveBlockParams(null);+ panelLayout.setRightPanelTab("design");+ }}+ recordingState={gestureState}+ recordingDuration={gestureRecording.recordingDuration}+ onToggleRecording={handleToggleRecording}+ sdkSession={sdkHandle.session}+ publishSdkSession={sdkHandle.publish}+ forceReloadSdkSession={sdkHandle.forceReload}+ reloadPreview={reloadPreview}+ recordEdit={editHistory.recordEdit}+ onToggleElementHidden={timelineEditing.handleToggleElementHidden}+ onAutoGroupCarveSources={timelineEditing.handleAutoGroupCarveSources}+ onAddMediaOverlay={handleAddMediaOverlay}/>- }- right={- panelLayout.effectiveRightCollapsed ? null : (- <StudioRightPanel- designPanelActive={designPanelActive}- activeBlockParams={activeBlockParams}- onCloseBlockParams={() => {- setActiveBlockParams(null);- panelLayout.setRightPanelTab("design");- }}- recordingState={gestureState}- recordingDuration={gestureRecording.recordingDuration}- onToggleRecording={handleToggleRecording}- sdkSession={sdkHandle.session}- publishSdkSession={sdkHandle.publish}- forceReloadSdkSession={sdkHandle.forceReload}- reloadPreview={reloadPreview}- recordEdit={editHistory.recordEdit}- onToggleElementHidden={timelineEditing.handleToggleElementHidden}- onAutoGroupCarveSources={timelineEditing.handleAutoGroupCarveSources}- onAddMediaOverlay={handleAddMediaOverlay}- />- )- }- timelineToolbar={timelineToolbar}- renderClipContent={renderClipContent}- handleTimelineElementDelete={timelineEditing.handleTimelineElementDelete}- handleTimelineAssetDrop={timelineEditing.handleTimelineAssetDrop}- handleTimelineBlockDrop={handleTimelineBlockDrop}- handleTimelineCompositionDrop={timelineEditing.handleTimelineCompositionDrop}- handlePreviewBlockDrop={handlePreviewBlockDrop}- handleTimelineFileDrop={timelineEditing.handleTimelineFileDrop}- handleTimelineElementMove={timelineEditing.handleTimelineElementMove}- handleTimelineElementsMove={handleTimelineElementsMove}- handleTimelineElementResize={timelineEditing.handleTimelineElementResize}- handleTimelineGroupResize={timelineEditing.handleTimelineGroupResize}- handleToggleTrackHidden={timelineEditing.handleToggleTrackHidden}- setAudioGroupAttribute={timelineEditing.setAudioGroupAttribute}- handleGroupClips={timelineEditing.handleAutoGroupCarveSources}- setElementFxAttribute={timelineEditing.setElementFxAttribute}- handleBlockedTimelineEdit={timelineEditing.handleBlockedTimelineEdit}- handleTimelineElementSplit={timelineEditing.handleTimelineElementSplit}- handleRazorSplit={timelineEditing.handleRazorSplit}- handleRazorSplitAll={timelineEditing.handleRazorSplitAll}- onCopyClip={handleCopy}- onPasteClip={handlePaste}- onDuplicateClip={handleDuplicate}- canPasteClip={canPaste}- setCompIdToSrc={setCompIdToSrc}- setCompositionLoading={setCompositionLoading}- shouldShowMotionPath={shouldShowMotionPath}- shouldShowSelectedDomBounds={shouldShowSelectedDomBounds}- isGestureRecording={gestureState === "recording"}- recordingState={gestureState}- onToggleRecording={handleToggleRecording}- blockPreview={blockPreview}- gestureOverlay={- gestureState === "recording" && previewIframe ? (- <GestureTrailOverlay- samples={gestureRecording.samplesRef.current}- sampleCount={gestureRecording.samplesRef.current.length}- trail={gestureRecording.trailRef.current}- canvasRect={canvasRectRef.current!}- compositionSize={compositionDimensions ?? undefined}- mode="recording"- />- ) : undefined- }- />- <StudioOverlays- projectId={projectId}- projectDir={fileManager.projectDir}- lintModal={lintModal}- closeLintModal={closeLintModal}- consoleErrors={consoleErrors}- clearConsoleErrors={() => setConsoleErrors(null)}- domEditSession={domEditSession}- activeCompPath={activeCompPath}- toasts={toasts}- dismissToast={dismissToast}- />- </div>- </DomEditProvider>- </FileManagerProvider>- </PanelLayoutProvider>- </ViewModeProvider>+ )+ }+ timelineToolbar={timelineToolbar}+ renderClipContent={renderClipContent}+ handleTimelineElementDelete={timelineEditing.handleTimelineElementDelete}+ handleTimelineAssetDrop={timelineEditing.handleTimelineAssetDrop}+ handleTimelineBlockDrop={handleTimelineBlockDrop}+ handleTimelineCompositionDrop={timelineEditing.handleTimelineCompositionDrop}+ handlePreviewBlockDrop={handlePreviewBlockDrop}+ handleTimelineFileDrop={timelineEditing.handleTimelineFileDrop}+ handleTimelineElementMove={timelineEditing.handleTimelineElementMove}+ handleTimelineElementsMove={handleTimelineElementsMove}+ handleTimelineElementResize={timelineEditing.handleTimelineElementResize}+ handleTimelineGroupResize={timelineEditing.handleTimelineGroupResize}+ handleToggleTrackHidden={timelineEditing.handleToggleTrackHidden}+ setAudioGroupAttribute={timelineEditing.setAudioGroupAttribute}+ handleGroupClips={timelineEditing.handleAutoGroupCarveSources}+ setElementFxAttribute={timelineEditing.setElementFxAttribute}+ handleBlockedTimelineEdit={timelineEditing.handleBlockedTimelineEdit}+ handleTimelineElementSplit={timelineEditing.handleTimelineElementSplit}+ handleRazorSplit={timelineEditing.handleRazorSplit}+ handleRazorSplitAll={timelineEditing.handleRazorSplitAll}+ onCopyClip={handleCopy}+ onPasteClip={handlePaste}+ onDuplicateClip={handleDuplicate}+ canPasteClip={canPaste}+ setCompIdToSrc={setCompIdToSrc}+ setCompositionLoading={setCompositionLoading}+ shouldShowMotionPath={shouldShowMotionPath}+ shouldShowSelectedDomBounds={shouldShowSelectedDomBounds}+ isGestureRecording={gestureState === "recording"}+ recordingState={gestureState}+ onToggleRecording={handleToggleRecording}+ blockPreview={blockPreview}+ gestureOverlay={+ gestureState === "recording" && previewIframe ? (+ <GestureTrailOverlay+ samples={gestureRecording.samplesRef.current}+ sampleCount={gestureRecording.samplesRef.current.length}+ trail={gestureRecording.trailRef.current}+ canvasRect={canvasRectRef.current!}+ compositionSize={compositionDimensions ?? undefined}+ mode="recording"+ />+ ) : undefined+ }+ />+ <StudioOverlays+ projectId={projectId}+ projectDir={fileManager.projectDir}+ lintModal={lintModal}+ closeLintModal={closeLintModal}+ consoleErrors={consoleErrors}+ clearConsoleErrors={() => setConsoleErrors(null)}+ domEditSession={domEditSession}+ activeCompPath={activeCompPath}+ toasts={toasts}+ dismissToast={dismissToast}+ />+ </div>+ </DomEditProvider>+ </FileManagerProvider>+ </PanelLayoutProvider></StudioPlaybackProvider></StudioShellProvider>);diff --git a/packages/studio/src/captions/components/CaptionOverlayUtils.ts b/packages/studio/src/captions/components/CaptionOverlayUtils.tsindex c4d5bb9f5e..214b351ac0 100644--- a/packages/studio/src/captions/components/CaptionOverlayUtils.ts+++ b/packages/studio/src/captions/components/CaptionOverlayUtils.ts@@ -221,9 +221,8 @@ export function registerCaptionIframe(ref: React.RefObject<HTMLIFrameElement | n/*** True when the caption preview iframe is mounted AND visible. The caption- * store's isEditMode stays true while the preview is merely hidden (e.g.- * storyboard view), so hotkeys must not route ⌘Z to the caption stack unless- * the user can actually see the captions the undo would change.+ * store's isEditMode stays true while the preview is merely hidden, so hotkeys must not+ * route ⌘Z to the caption stack unless the user can see the captions the undo would change.*/export function isCaptionPreviewVisible(): boolean {const iframe = registeredIframe?.current;diff --git a/packages/studio/src/components/EditorShell.tsx b/packages/studio/src/components/EditorShell.tsxindex 25a97c6f2f..18185998a6 100644--- a/packages/studio/src/components/EditorShell.tsx+++ b/packages/studio/src/components/EditorShell.tsx@@ -30,8 +30,6 @@ export interface EditorShellProps extends TimelineEditCallbackDeps {left: ReactNode;/** Right panel (inspector/design) or null when collapsed, in the top row. */right: ReactNode;- /** Hide the whole shell (e.g. while the storyboard view is active). */- hidden?: boolean;timelineToolbar: ReactNode;renderClipContent: RenderClipContent;handleTimelineElementDelete: (element: TimelineElement) => Promise<void> | void;@@ -76,7 +74,6 @@ export interface EditorShellProps extends TimelineEditCallbackDeps {export function EditorShell({left,right,- hidden,timelineToolbar,renderClipContent,handleTimelineElementDelete,@@ -157,7 +154,7 @@ export function EditorShell({});return (- <div className={`flex flex-col flex-1 min-h-0${hidden ? " hidden" : ""}`}>+ <div className="flex flex-col flex-1 min-h-0"><TimelineEditProvider value={timelineEditCallbacks}><NLEProviderprojectId={projectId}diff --git a/packages/studio/src/components/StudioHeader.tsx b/packages/studio/src/components/StudioHeader.tsxindex b5980eee05..933c2d1029 100644--- a/packages/studio/src/components/StudioHeader.tsx+++ b/packages/studio/src/components/StudioHeader.tsx@@ -1,9 +1,8 @@-import { useRef, type MouseEvent } from "react";+import type { MouseEvent } from "react";import { RotateCcw, RotateCw, Camera } from "../icons/SystemIcons";import { getHistoryShortcutLabel } from "../utils/studioHelpers";import { useStudioShellContext } from "../contexts/StudioContext";import { usePanelLayoutContext } from "../contexts/PanelLayoutContext";-import { useViewMode, type StudioViewMode } from "../contexts/ViewModeContext";import { trackStudioEvent } from "../utils/studioTelemetry";import { Tooltip } from "./ui";@@ -139,63 +138,6 @@ function HyperframesLogo() {);}-const VIEW_MODE_OPTIONS: Array<{ mode: StudioViewMode; label: string }> = [- { mode: "storyboard", label: "Storyboard" },- { mode: "timeline", label: "Preview" },-];--/** Segmented control switching the main stage between storyboard and preview. */-export function ViewModeToggle() {- const { viewMode, setViewMode } = useViewMode();- const tabRefs = useRef<Array<HTMLButtonElement | null>>([]);-- const selectMode = (mode: StudioViewMode) => {- if (mode === viewMode) return;- if (setViewMode(mode)) trackStudioEvent("view_mode_toggle", { mode });- };-- // Complete APG tabs pattern: roving tabIndex + arrow-key navigation.- const handleKeyDown = (e: React.KeyboardEvent, index: number) => {- if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;- e.preventDefault();- const dir = e.key === "ArrowLeft" ? -1 : 1;- const next = (index + dir + VIEW_MODE_OPTIONS.length) % VIEW_MODE_OPTIONS.length;- tabRefs.current[next]?.focus();- selectMode(VIEW_MODE_OPTIONS[next].mode);- };-- return (- <div- className="flex items-center gap-0.5 rounded-md bg-neutral-800 p-0.5"- role="tablist"- aria-label="Studio view"- >- {VIEW_MODE_OPTIONS.map(({ mode, label }, index) => {- const active = viewMode === mode;- return (- <button- key={mode}- ref={(el) => {- tabRefs.current[index] = el;- }}- type="button"- role="tab"- aria-selected={active}- tabIndex={active ? 0 : -1}- onClick={() => selectMode(mode)}- onKeyDown={(e) => handleKeyDown(e, index)}- className={`rounded px-3 py-1 text-[11px] font-medium transition-colors active:scale-[0.98] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-studio-accent ${- active ? "bg-neutral-200 text-neutral-900" : "text-neutral-400 hover:text-neutral-200"- }`}- >- {label}- </button>- );- })}- </div>- );-}-/*** Does the header's Inspector button open the panel, or close it?*@@ -241,8 +183,6 @@ export function StudioHeader({</span><span className="text-[11px] font-medium text-neutral-300">{projectId}</span></div>- {/* Center: storyboard / preview toggle */}- <ViewModeToggle />{/* Right: toolbar buttons */}<div className="flex items-center gap-1.5"><Tooltipdiff --git a/packages/studio/src/components/feedback/feedbackTrigger.ts b/packages/studio/src/components/feedback/feedbackTrigger.tsindex 7506906066..23bab6ca2d 100644--- a/packages/studio/src/components/feedback/feedbackTrigger.ts+++ b/packages/studio/src/components/feedback/feedbackTrigger.ts@@ -76,7 +76,6 @@ const FOLLOW_UPS: readonly FollowUpQuestion[] = [{ label: "Layers panel", hint: "The layer tree on the right" },{ label: "Variables panel", hint: "Composition variables on the right" },{ label: "Blocks browser", hint: "The block library in the sidebar" },- { label: "Storyboard mode", hint: "The storyboard view next to Preview" },{ label: "Caption editing", hint: "Editing caption words and presets in Studio" },{ label: "Render history", hint: "The list of past exports" },{ label: "Nothing", hint: "It all earns its place" },diff --git a/packages/studio/src/components/storyboard/AgentChatMessageButton.test.tsx b/packages/studio/src/components/storyboard/AgentChatMessageButton.test.tsxdeleted file mode 100644index 3c72fa21cd..0000000000--- a/packages/studio/src/components/storyboard/AgentChatMessageButton.test.tsx+++ /dev/null@@ -1,47 +0,0 @@-// @vitest-environment happy-dom--import React, { act } from "react";-import { createRoot } from "react-dom/client";-import { afterEach, describe, expect, it, vi } from "vitest";-import { AgentChatMessageButton } from "./AgentChatMessageButton";--(globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;--afterEach(() => {- document.body.innerHTML = "";- vi.useRealTimers();- vi.restoreAllMocks();-});--describe("AgentChatMessageButton", () => {- it("reports a successful copy and resets to an explicit re-copy action", async () => {- vi.useFakeTimers();- const writeText = vi.fn().mockResolvedValue(undefined);- Object.defineProperty(navigator, "clipboard", {- configurable: true,- value: { writeText },- });- const onCopied = vi.fn();- const host = document.createElement("div");- document.body.append(host);- const root = createRoot(host);- act(() => {- root.render(<AgentChatMessageButton message="handoff" onCopied={onCopied} />);- });-- const button = host.querySelector("button");- if (!button) throw new Error("copy button not rendered");- await act(async () => {- button.dispatchEvent(new MouseEvent("click", { bubbles: true }));- await Promise.resolve();- });-- expect(writeText).toHaveBeenCalledWith("handoff");- expect(onCopied).toHaveBeenCalledOnce();- expect(button.textContent).toBe("Copied — paste in your agent chat");-- act(() => vi.advanceTimersByTime(3000));- expect(button.textContent).toBe("Copy again");- act(() => root.unmount());- });-});diff --git a/packages/studio/src/components/storyboard/AgentChatMessageButton.tsx b/packages/studio/src/components/storyboard/AgentChatMessageButton.tsxdeleted file mode 100644index e00446fe30..0000000000--- a/packages/studio/src/components/storyboard/AgentChatMessageButton.tsx+++ /dev/null@@ -1,45 +0,0 @@-import { useEffect, useState } from "react";-import { Button } from "../ui/Button";--export const APPLY_STORYBOARD_FEEDBACK_MESSAGE =- "Read the storyboard feedback I saved in .hyperframes/frame-comments.json and revise the frames.";--export function AgentChatMessageButton({- message,- label = "Copy prompt for agent",- onCopied,-}: {- message: string;- label?: string;- onCopied?: () => void;-}) {- const [copyState, setCopyState] = useState<"idle" | "copied" | "again" | "failed">("idle");-- useEffect(() => {- if (copyState !== "copied") return;- const timeout = window.setTimeout(() => setCopyState("again"), 3000);- return () => window.clearTimeout(timeout);- }, [copyState]);-- const copyMessage = async () => {- try {- await navigator.clipboard.writeText(message);- setCopyState("copied");- onCopied?.();- } catch {- setCopyState("failed");- }- };-- return (- <Button size="sm" variant="secondary" onClick={() => void copyMessage()}>- {copyState === "copied"- ? "Copied — paste in your agent chat"- : copyState === "again"- ? "Copy again"- : copyState === "failed"- ? "Copy failed"- : label}- </Button>- );-}diff --git a/packages/studio/src/components/storyboard/FramePoster.test.tsx b/packages/studio/src/components/storyboard/FramePoster.test.tsxdeleted file mode 100644index c1f1879583..0000000000--- a/packages/studio/src/components/storyboard/FramePoster.test.tsx+++ /dev/null@@ -1,61 +0,0 @@-// @vitest-environment happy-dom--import React, { act } from "react";-import { createRoot, type Root } from "react-dom/client";-import { afterEach, describe, expect, it } from "vitest";-import { FramePoster } from "./FramePoster";--(globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;--const roots: Root[] = [];--afterEach(() => {- act(() => roots.splice(0).forEach((root) => root.unmount()));- document.body.replaceChildren();-});--// A fresh host per render: several cases compare two surfaces side by side.-function renderPoster(surface?: "tile" | "hero"): HTMLImageElement {- const host = document.createElement("div");- document.body.appendChild(host);- const root = createRoot(host);- roots.push(root);- act(() => {- root.render(- <FramePoster- projectId="demo"- src="frames/01-hero.html"- seconds={3}- title="hero"- surface={surface}- />,- );- });- const img = host.querySelector("img");- if (!img) throw new Error("poster did not render an <img>");- return img;-}--describe("FramePoster", () => {- // Regression: the contact sheet stretched a 240x135 capture across a wide,- // high-density card, making body copy, thin lines, and sprite details blurry.- it.each([- [undefined, "storyboard"],- ["tile", "storyboard"],- ["hero", "source"],- ] as const)("captures the %s surface at %s density", (surface, output) => {- const url = new URL(renderPoster(surface).src);-- expect(url.searchParams.get("output")).toBe(output);- expect(url.pathname).toBe("/api/projects/demo/thumbnail/frames/01-hero.html");- });-- it("defaults to the tile surface", () => {- expect(renderPoster().className).toBe(renderPoster("tile").className);- });-- it("letterboxes only the hero, so a tile still fills its cell", () => {- expect(renderPoster("hero").className).toContain("object-contain");- expect(renderPoster("tile").className).toContain("object-cover");- });-});diff --git a/packages/studio/src/components/storyboard/FramePoster.tsx b/packages/studio/src/components/storyboard/FramePoster.tsxdeleted file mode 100644index 5f27139cc4..0000000000--- a/packages/studio/src/components/storyboard/FramePoster.tsx+++ /dev/null@@ -1,86 +0,0 @@-import { buildProjectApiPath } from "../../utils/projectRouting";-import { useEffect, useState } from "react";-import { buildCompositionThumbnailUrl } from "../../player/components/CompositionThumbnail";--export interface FramePosterProps {- projectId: string;- /** Project-relative path to the frame's HTML sub-composition. */- src: string;- /** Time (seconds) to seek to for the poster. */- seconds: number;- title: string;- /**- * Where this poster is rendered. A contact-sheet tile is ~300px wide and there- * are many of them; the focus hero is up to 900px wide and there is exactly- * one. Tiles use a bounded high-density capture; the hero uses source density.- * The surface also decides whether the result fills or letterboxes its cell.- */- surface?: "tile" | "hero";- /**- * Project content signature to key the poster URL on. The thumbnail route- * regenerates when the frame's source changes, but the browser only refetches- * when the URL does — so bake the signature in to pick up fresh posters after- * a background board refresh.- */- posterVersion?: string;-}--/**- * Server-rendered poster for a frame. The thumbnail route seeks the composition- * by time (at its real fps) and caches the result, so there's no live iframe,- * no postMessage seek, and no client-side fps assumption. Shared by the- * contact-sheet tile and the frame-focus view.- */-export function FramePoster({- projectId,- src,- seconds,- title,- surface = "tile",- posterVersion,-}: FramePosterProps) {- const [failed, setFailed] = useState(false);- // The <img> is reused (no key) when a tile/hero swaps to a different frame, so a- // prior load error would stick. Reset when the poster target changes — including- // a new posterVersion, so a frame that failed mid-write retries once it settles.- useEffect(() => setFailed(false), [src, seconds, posterVersion, surface]);- if (failed) {- return (- <div className="flex h-full w-full items-center justify-center text-[11px] text-neutral-600">- Preview unavailable- </div>- );- }- let url = buildCompositionThumbnailUrl({- previewUrl: buildProjectApiPath(projectId, `/preview/comp/${src}`),- seekTime: seconds,- duration: 0,- origin: window.location.origin,- // The normal 240x135 preview is unreadable in the contact sheet, while source- // density is unbounded across all tiles. Give tiles a capped review density- // and reserve true source output for the single focus hero.- output: surface === "hero" ? "source" : "storyboard",- });- if (posterVersion) {- const withVersion = new URL(url, window.location.origin);- withVersion.searchParams.set("sig", posterVersion);- url = withVersion.toString();- }- return (- <img- src={url}- alt={title}- draggable={false}- loading="lazy"- onError={() => setFailed(true)}- className={`h-full w-full ${surface === "hero" ? "object-contain" : "object-cover"}`}- />- );-}--/** Time (seconds) to show a frame at — past the intro so the key moment is visible. */-export function posterTime(frame: { poster?: number; durationSeconds?: number }): number {- if (frame.poster != null) return frame.poster;- if (frame.durationSeconds != null) return frame.durationSeconds * 0.66;- return 1.5;-}diff --git a/packages/studio/src/components/storyboard/StoryboardDirection.tsx b/packages/studio/src/components/storyboard/StoryboardDirection.tsxdeleted file mode 100644index dfe64e67ff..0000000000--- a/packages/studio/src/components/storyboard/StoryboardDirection.tsx+++ /dev/null@@ -1,45 +0,0 @@-import type { StoryboardGlobals } from "@hyperframes/core/storyboard";--export interface StoryboardDirectionProps {- globals: StoryboardGlobals;- frameCount: number;-}--/**- * Global direction header: the message/thesis plus arc, audience, and format.- * This is the storyboard's "north star" pulled from the manifest frontmatter.- */-export function StoryboardDirection({ globals, frameCount }: StoryboardDirectionProps) {- const meta = [- { label: "Arc", value: globals.arc },- { label: "Audience", value: globals.audience },- { label: "Voice", value: globals.extra.voice },- { label: "Format", value: globals.format },- { label: "Frames", value: String(frameCount) },- ].filter((item): item is { label: string; value: string } => Boolean(item.value));-- return (- <header className="border-b border-neutral-800 pb-5">- <div className="text-[11px] font-medium uppercase tracking-wider text-neutral-500">- Storyboard- </div>- {globals.message ? (- <h1 className="mt-1 text-2xl font-semibold leading-tight text-neutral-100">- {globals.message}- </h1>- ) : (- <h1 className="mt-1 text-2xl font-semibold leading-tight text-neutral-400">- Untitled storyboard- </h1>- )}- <dl className="mt-4 flex flex-wrap gap-x-8 gap-y-2">- {meta.map((item) => (- <div key={item.label} className="flex items-baseline gap-2">- <dt className="text-[11px] uppercase tracking-wider text-neutral-500">{item.label}</dt>- <dd className="text-sm text-neutral-300">{item.value}</dd>- </div>- ))}- </dl>- </header>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardFrameFocus.tsx b/packages/studio/src/components/storyboard/StoryboardFrameFocus.tsxdeleted file mode 100644index dacc060cd2..0000000000--- a/packages/studio/src/components/storyboard/StoryboardFrameFocus.tsx+++ /dev/null@@ -1,412 +0,0 @@-import { useCallback, useEffect, useState } from "react";-import { setFrameVoiceover } from "@hyperframes/core/storyboard";-import type { StoryboardFrameView } from "../../hooks/useStoryboard";-import { useFileManagerContext } from "../../contexts/FileManagerContext";-import { useViewMode } from "../../contexts/ViewModeContext";-import { Button } from "../ui/Button";-import { FramePoster, posterTime } from "./FramePoster";-import {- AgentChatMessageButton,- APPLY_STORYBOARD_FEEDBACK_MESSAGE,-} from "./AgentChatMessageButton";-import { FRAME_STATUS_META } from "./frameStatus";-import type { CommentsSubmitState } from "./useFrameComments";-import { isTypingTarget } from "../../utils/typingTarget";--export interface StoryboardFrameFocusProps {- projectId: string;- /** Path to STORYBOARD.md (edits are written here). */- storyboardPath: string;- frame: StoryboardFrameView;- frameCount: number;- onBack: () => void;- onNavigate: (delta: number) => void;- /** Re-parse the manifest after an edit is saved. */- onSaved: () => void;- /** Select a composition in the timeline (sets active comp + editing file + sidebar highlight). */- onSelectComposition: (path: string) => void;- /** Whether SCRIPT.md exists and owns final narration/TTS. */- scriptExists: boolean;- /** Shared board draft for this frame, preserved when entering/leaving focus. */- commentDraft: string;- onCommentDraftChange: (text: string) => void;- pendingComment: string | null;- pendingCommentCount: number;- commentDraftCount: number;- commentsSubmitState: CommentsSubmitState;- commentsSubmitError: string | null;- feedbackMessageCopied: boolean;- onFeedbackMessageCopied: () => void;- onSaveFeedback: () => void;- /** Project signature the board was loaded with (busts the poster cache). */- posterVersion?: string;-}--/**- * Full-area focus on a single frame: large poster, editable voiceover guide,- * review feedback, full narrative, and a jump into the live preview. Edits- * are written back to STORYBOARD.md in place (markdown stays canonical).- *- * Mounted with a `key` per frame, so `draft` initializes from the frame and a- * save-triggered reload never clobbers in-progress typing.- */-// fallow-ignore-next-line complexity-export function StoryboardFrameFocus({- projectId,- storyboardPath,- frame,- frameCount,- onBack,- onNavigate,- onSaved,- onSelectComposition,- scriptExists,- commentDraft,- onCommentDraftChange,- pendingComment,- pendingCommentCount,- commentDraftCount,- commentsSubmitState,- commentsSubmitError,- feedbackMessageCopied,- onFeedbackMessageCopied,- onSaveFeedback,- posterVersion,-}: StoryboardFrameFocusProps) {- const { readProjectFile, writeProjectFile } = useFileManagerContext();- const { setViewMode, registerViewModeGuard } = useViewMode();- const [draft, setDraft] = useState(frame.voiceover ?? "");- const [savedVoiceover, setSavedVoiceover] = useState(frame.voiceover ?? "");- const [busy, setBusy] = useState(false);- const [error, setError] = useState<string | null>(null);-- const applyEdit = useCallback(- async (edit: (source: string) => string) => {- if (busy) return false; // one read-modify-write at a time; avoids a lost update- setBusy(true);- setError(null);- try {- const source = await readProjectFile(storyboardPath);- await writeProjectFile(storyboardPath, edit(source));- onSaved();- return true;- } catch (err: unknown) {- setError(err instanceof Error ? err.message : "failed to save");- return false;- } finally {- setBusy(false);- }- },- [readProjectFile, writeProjectFile, storyboardPath, onSaved, busy],- );-- const title = frame.title ?? `Frame ${frame.index}`;- const dirty = draft !== savedVoiceover;- const canOpenPreview = frame.status !== "outline" && frame.srcExists && Boolean(frame.src);-- const saveVoiceover = useCallback(async () => {- const saved = await applyEdit((src) => setFrameVoiceover(src, frame.index, draft));- if (saved) setSavedVoiceover(draft);- }, [applyEdit, frame.index, draft]);-- // Closing the tab with a dirty voiceover would lose it silently — same- // guard the sibling markdown editor registers for the same class of loss.- useEffect(() => {- if (!dirty) return;- const onBeforeUnload = (e: BeforeUnloadEvent) => {- e.preventDefault();- };- window.addEventListener("beforeunload", onBeforeUnload);- return () => window.removeEventListener("beforeunload", onBeforeUnload);- }, [dirty]);-- // Leaving the frame drops the in-memory voiceover draft; confirm while it's- // dirty. An in-flight save does NOT count as safe: if it fails after unmount- // the error lands on an unmounted component and the draft is silently lost,- // so keep confirming until the save actually lands (dirty clears on success).- const confirmLeave = useCallback(- () => !dirty || window.confirm("Discard unsaved voiceover changes?"),- [dirty],- );- useEffect(() => registerViewModeGuard(confirmLeave), [confirmLeave, registerViewModeGuard]);-- const handleBack = () => {- if (confirmLeave()) onBack();- };- const handleNavigate = (delta: number) => {- if (confirmLeave()) onNavigate(delta);- };-- // ←/→ navigate frames, Esc returns to the Board — but never while typing in a field.- useEffect(() => {- // fallow-ignore-next-line complexity- const onKey = (e: KeyboardEvent) => {- if (isTypingTarget(document.activeElement)) return;- if (e.key === "Escape") handleBack();- else if (e.key === "ArrowLeft" && frame.index > 1) handleNavigate(-1);- else if (e.key === "ArrowRight" && frame.index < frameCount) handleNavigate(1);- };- window.addEventListener("keydown", onKey);- return () => window.removeEventListener("keydown", onKey);- });-- const openInPreview = () => {- if (!setViewMode("timeline")) return;- if (frame.src) onSelectComposition(frame.src);- };-- return (- <div className="flex w-full max-w-[100vw] flex-1 min-h-0 min-w-0 flex-col overflow-hidden bg-neutral-950 text-neutral-200">- <div className="flex items-center gap-3 border-b border-neutral-800 px-4 py-2">- <button- type="button"- onClick={handleBack}- className="rounded px-2 py-1 text-xs font-medium text-neutral-300 hover:bg-neutral-800"- >- ← Board- </button>- <span className="min-w-0 flex-1 truncate text-sm font-medium text-neutral-200">- Frame {frame.number ?? frame.index} — {title}- </span>- <div className="flex shrink-0 items-center gap-1">- <NavButton- label="‹ Prev"- disabled={frame.index <= 1}- onClick={() => handleNavigate(-1)}- />- <NavButton- label="Next ›"- disabled={frame.index >= frameCount}- onClick={() => handleNavigate(1)}- />- </div>- </div>-- {(commentDraftCount > 0 || pendingCommentCount > 0) && (- <div className="flex flex-wrap items-center justify-between gap-2 border-b border-neutral-800 bg-neutral-900/80 px-4 py-2">- <div>- <div className="text-xs font-medium text-neutral-200">- {commentDraftCount > 0 ? "Feedback ready to save" : "Feedback saved"}- </div>- <div className="text-[11px] text-neutral-500">- {commentDraftCount > 0- ? "Save this batch and copy the message for your agent."- : feedbackMessageCopied- ? "Message copied — paste it in your terminal or IDE agent chat."- : "The agent has not been notified yet."}- </div>- </div>- {commentDraftCount > 0 ? (- <Button- size="sm"- variant="primary"- onClick={onSaveFeedback}- loading={commentsSubmitState === "saving"}- >- Save & copy message ({commentDraftCount})- </Button>- ) : (- <AgentChatMessageButton- message={APPLY_STORYBOARD_FEEDBACK_MESSAGE}- label={feedbackMessageCopied ? "Copy again" : "Copy prompt for agent"}- onCopied={onFeedbackMessageCopied}- />- )}- </div>- )}-- <div className="flex flex-1 min-h-0 flex-col overflow-auto lg:flex-row lg:overflow-hidden">- <div className="flex w-full shrink-0 items-center justify-center bg-neutral-900/40 p-4 sm:p-8 lg:h-full lg:w-3/5">- <div className="aspect-video w-full max-w-[900px] overflow-hidden rounded-lg border border-neutral-800 bg-neutral-900">- {canOpenPreview && frame.src ? (- <FramePoster- projectId={projectId}- src={frame.src}- seconds={posterTime(frame)}- title={title}- surface="hero"- posterVersion={posterVersion}- />- ) : (- <FramePlan frame={frame} />- )}- </div>- </div>-- <div className="w-full shrink-0 space-y-6 border-t border-neutral-800 px-4 py-5 sm:px-6 lg:h-full lg:w-2/5 lg:overflow-auto lg:border-t-0 lg:border-l">- <ReadOnlyStatus status={frame.status} />-- <div className="flex flex-wrap gap-x-6 gap-y-1 text-[11px] text-neutral-500">- {frame.duration && <span>Duration {frame.duration}</span>}- {frame.transitionIn && <span>Transition {frame.transitionIn}</span>}- </div>-- <section>- <div className="mb-1 flex items-center justify-between">- <h3- className="text-xs font-semibold uppercase tracking-wider text-neutral-400"- title="Storyboard voiceover is a guide; SCRIPT.md is the final TTS source."- >- 🎙 Voiceover <span className="font-normal normal-case text-neutral-600">guide</span>- </h3>- <Button- size="sm"- variant="primary"- onClick={saveVoiceover}- disabled={!dirty}- loading={busy}- >- {busy ? "Saving…" : "Save voiceover"}- </Button>- </div>- <textarea- value={draft}- onChange={(e) => setDraft(e.target.value)}- rows={3}- placeholder="What the narrator says over this frame…"- className="w-full resize-y rounded border border-neutral-800 bg-neutral-900 p-2 text-sm text-neutral-200 outline-none focus:border-neutral-600"- />- <p className="mt-1 text-[11px] text-neutral-600">- {dirty- ? "Unsaved changes"- : scriptExists- ? "Saved. SCRIPT.md drives final TTS."- : "Saved to STORYBOARD.md. This voiceover guides narration for the frame."}- </p>- {error && <p className="mt-1 text-[11px] text-red-400">{error}</p>}- </section>-- <section>- <div className="mb-1">- <h3 className="text-xs font-semibold uppercase tracking-wider text-neutral-400">- Frame feedback- </h3>- </div>- <textarea- value={commentDraft}- onChange={(e) => onCommentDraftChange(e.target.value)}- rows={3}- placeholder="Tell your agent what to change in this frame…"- aria-label={`Comment on ${title}`}- className="w-full resize-y rounded border border-neutral-800 bg-neutral-900 p-2 text-sm text-neutral-200 placeholder:text-neutral-600 outline-none focus:border-sky-700"- />- {pendingCommentCount > 0 ? (- <div className="mt-2 flex flex-wrap items-center justify-between gap-2 rounded-md border border-sky-900/70 bg-sky-950/20 px-2.5 py-2">- <p className="text-[11px] text-sky-200">- Paste the agent prompt in your terminal or IDE chat.- </p>- <AgentChatMessageButton- message={APPLY_STORYBOARD_FEEDBACK_MESSAGE}- onCopied={onFeedbackMessageCopied}- />- </div>- ) : (- <p className="mt-1 text-[11px] text-neutral-600">- {commentDraftCount > 0- ? "Your change is ready. Save it using the review bar above."- : "Add a change to prepare feedback for the agent."}- </p>- )}- {pendingComment && (- <p className="mt-1 text-[11px] text-sky-400/90">- <span className="font-medium">Pending:</span> “{pendingComment}”- </p>- )}- {commentsSubmitError && (- <p className="mt-1 text-[11px] text-red-400">- Couldn’t submit: {commentsSubmitError}- </p>- )}- </section>-- {frame.narrative && (- <section>- <h3 className="mb-1 text-xs font-semibold uppercase tracking-wider text-neutral-400">- Narrative- </h3>- <p className="whitespace-pre-wrap text-sm text-neutral-300">{frame.narrative}</p>- </section>- )}-- {canOpenPreview ? (- <Button size="sm" variant="secondary" onClick={openInPreview}>- Open in Preview →- </Button>- ) : (- <div className="rounded-md border border-neutral-800 bg-neutral-900/60 px-3 py-2 text-xs text-neutral-500">- Preview becomes available after your agent builds this frame.- </div>- )}- </div>- </div>- </div>- );-}--function NavButton({- label,- disabled,- onClick,-}: {- label: string;- disabled: boolean;- onClick: () => void;-}) {- return (- <button- type="button"- onClick={onClick}- disabled={disabled}- className="rounded px-2 py-1 text-xs font-medium text-neutral-300 hover:bg-neutral-800 enabled:active:scale-[0.98] transition-transform disabled:opacity-30"- >- {label}- </button>- );-}--function ReadOnlyStatus({ status }: { status: StoryboardFrameView["status"] }) {- const meta = FRAME_STATUS_META[status];- return (- <div className="flex items-center gap-2">- <span className="text-xs font-semibold uppercase tracking-wider text-neutral-500">- Status- </span>- <span className={`rounded px-2 py-1 text-xs font-medium ${meta.chipClass}`}>- {meta.label}- </span>- <span className="text-[11px] text-neutral-600">Updated by your agent</span>- </div>- );-}--// The empty state selects copy from frame status and whichever storyboard fields are available.-// fallow-ignore-next-line complexity-function FramePlan({ frame }: { frame: StoryboardFrameView }) {- const title = frame.title ?? `Frame ${frame.index}`;- const isOutline = frame.status === "outline";- return (- <div className="flex h-full w-full items-center justify-center bg-[radial-gradient(circle_at_center,_rgba(38,38,38,0.8),_rgba(10,10,10,1))] p-10">- <div className="max-w-xl text-center">- <span className="rounded-full border border-neutral-700 px-2.5 py-1 text-[10px] font-semibold uppercase tracking-wider text-neutral-400">- {isOutline ? "Planned frame" : "Preview unavailable"}- </span>- <h2 className="mt-4 text-2xl font-semibold text-neutral-100">{title}</h2>- {frame.scene && (- <p className="mt-3 text-base leading-relaxed text-neutral-300">{frame.scene}</p>- )}- {!frame.scene && frame.narrative && (- <p className="mt-3 line-clamp-4 text-sm leading-relaxed text-neutral-400">- {frame.narrative}- </p>- )}- <p className="mt-5 text-xs text-neutral-600">- {isOutline- ? "A visual preview will appear when your agent builds the sketch."- : frame.src- ? `Frame file not found: ${frame.src}`- : "This frame does not link to a source file."}- </p>- </div>- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardFrameTile.tsx b/packages/studio/src/components/storyboard/StoryboardFrameTile.tsxdeleted file mode 100644index a128a6fbe8..0000000000--- a/packages/studio/src/components/storyboard/StoryboardFrameTile.tsx+++ /dev/null@@ -1,117 +0,0 @@-import type { StoryboardFrameView } from "../../hooks/useStoryboard";-import { FramePoster, posterTime } from "./FramePoster";-import { FRAME_STATUS_META } from "./frameStatus";--export interface StoryboardFrameTileProps {- projectId: string;- frame: StoryboardFrameView;- /** Open this frame in the full-area focus view. */- onOpen: (index: number) => void;- /** This frame's pending comment draft ("" when none). */- commentDraft: string;- onCommentDraftChange: (index: number, text: string) => void;- /** A submitted comment the agent has not consumed yet (null when none). */- pendingComment: string | null;- /** Project signature the board was loaded with (busts the poster cache). */- posterVersion?: string;-}--function firstLine(text: string): string {- return (- text- .split("\n")- .find((line) => line.trim().length > 0)- ?.trim() ?? ""- );-}--function placeholderMessage(frame: StoryboardFrameView): string {- if (frame.status === "outline") return "Not built yet";- if (frame.src && !frame.srcExists) return "Frame file not found";- return "No preview";-}--/** A single contact-sheet tile: poster preview + its metadata. Click to focus. */-// fallow-ignore-next-line complexity-export function StoryboardFrameTile({- projectId,- frame,- onOpen,- commentDraft,- onCommentDraftChange,- pendingComment,- posterVersion,-}: StoryboardFrameTileProps) {- const meta = FRAME_STATUS_META[frame.status];- const renderable = frame.srcExists && frame.status !== "outline";- const title = frame.title ?? `Frame ${frame.index}`;- const sceneLine = frame.scene ?? firstLine(frame.narrative);-- return (- <article className="min-w-0">- <button- type="button"- onClick={() => onOpen(frame.index)}- className="group relative block aspect-video w-full overflow-hidden rounded-lg border border-neutral-800 bg-neutral-900 text-left transition-colors hover:border-neutral-600"- >- <div className="absolute left-2 top-2 z-10 flex h-6 min-w-6 items-center justify-center rounded-full bg-black/70 px-1.5 text-xs font-semibold text-neutral-100">- {frame.number ?? frame.index}- </div>- {renderable && frame.src ? (- <FramePoster- projectId={projectId}- src={frame.src}- seconds={posterTime(frame)}- title={title}- posterVersion={posterVersion}- />- ) : (- <FrameTilePlaceholder frame={frame} />- )}- </button>-- <div className="mt-2 flex items-start justify-between gap-2">- <h3 className="truncate text-sm font-medium text-neutral-200">{title}</h3>- <span- title={meta.tooltip}- aria-label={`Status: ${meta.label} — ${meta.tooltip}`}- className={`shrink-0 cursor-default rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide ${meta.chipClass}`}- >- {meta.label}- </span>- </div>- {sceneLine && <p className="mt-0.5 line-clamp-2 text-xs text-neutral-400">{sceneLine}</p>}- {frame.voiceover && (- <p className="mt-1 line-clamp-2 text-xs italic text-neutral-500">- <span aria-hidden="true">🎙 </span>“{frame.voiceover}”- </p>- )}- <div className="mt-1 flex gap-3 text-[11px] text-neutral-600">- {frame.duration && <span>{frame.duration}</span>}- {frame.transitionIn && <span>↘ {frame.transitionIn}</span>}- </div>- <textarea- value={commentDraft}- onChange={(e) => onCommentDraftChange(frame.index, e.target.value)}- rows={2}- placeholder="Comment on this frame…"- aria-label={`Comment on ${title}`}- className="mt-2 w-full resize-none rounded-md border border-neutral-800 bg-neutral-900/60 px-2 py-1.5 text-xs text-neutral-200 placeholder:text-neutral-600 focus:border-sky-700 focus:outline-none"- />- {pendingComment && (- <p className="mt-1 text-[11px] text-sky-400/90">- <span className="font-medium">Pending:</span> “{pendingComment}”- </p>- )}- </article>- );-}--function FrameTilePlaceholder({ frame }: { frame: StoryboardFrameView }) {- return (- <div className="flex h-full w-full flex-col items-center justify-center gap-1 border border-dashed border-neutral-700 bg-neutral-950 text-center">- <span className="text-xs font-medium text-neutral-400">{frame.title ?? "Outline"}</span>- <span className="text-[11px] text-neutral-600">{placeholderMessage(frame)}</span>- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardGrid.tsx b/packages/studio/src/components/storyboard/StoryboardGrid.tsxdeleted file mode 100644index d35227bead..0000000000--- a/packages/studio/src/components/storyboard/StoryboardGrid.tsx+++ /dev/null@@ -1,55 +0,0 @@-import type { StoryboardFrameView } from "../../hooks/useStoryboard";-import type { FrameCommentEntry } from "./frameComments";-import { StoryboardFrameTile } from "./StoryboardFrameTile";--export interface StoryboardGridProps {- projectId: string;- frames: StoryboardFrameView[];- /** Open a frame in the full-area focus view. */- onOpenFrame: (index: number) => void;- /** Per-frame comment drafts, keyed by frame index. */- commentDrafts: Record<number, string>;- onCommentDraftChange: (index: number, text: string) => void;- /** Submitted comments the agent has not consumed yet. */- pendingComments: FrameCommentEntry[] | null;- /** Project signature the board was loaded with (busts poster caches). */- posterVersion?: string;-}--/** The contact sheet: ordered frame tiles in a responsive grid. */-export function StoryboardGrid({- projectId,- frames,- onOpenFrame,- commentDrafts,- onCommentDraftChange,- pendingComments,- posterVersion,-}: StoryboardGridProps) {- if (frames.length === 0) {- return (- <div className="mt-8 rounded-lg border border-dashed border-neutral-800 px-6 py-12 text-center text-sm text-neutral-500">- This storyboard has no frames yet.- </div>- );- }-- return (- <div className="mt-8 grid gap-x-6 gap-y-8 [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))]">- {frames.map((frame) => (- <StoryboardFrameTile- key={frame.index}- projectId={projectId}- frame={frame}- onOpen={onOpenFrame}- commentDraft={commentDrafts[frame.index] ?? ""}- onCommentDraftChange={onCommentDraftChange}- pendingComment={- pendingComments?.find((entry) => entry.frame === frame.index)?.text ?? null- }- posterVersion={posterVersion}- />- ))}- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardLoaded.tsx b/packages/studio/src/components/storyboard/StoryboardLoaded.tsxdeleted file mode 100644index 14d9b0cc0d..0000000000--- a/packages/studio/src/components/storyboard/StoryboardLoaded.tsx+++ /dev/null@@ -1,307 +0,0 @@-import { useEffect, useMemo, useState } from "react";-import type { StoryboardResponse } from "../../hooks/useStoryboard";-import { Button } from "../ui/Button";-import { StoryboardDirection } from "./StoryboardDirection";-import { StoryboardGrid } from "./StoryboardGrid";-import { StoryboardScriptPanel } from "./StoryboardScriptPanel";-import { StoryboardSourceEditor, type SourceFile } from "./StoryboardSourceEditor";-import { StoryboardFrameFocus } from "./StoryboardFrameFocus";-import { StoryboardReviewGuide } from "./StoryboardReviewGuide";-import {- AgentChatMessageButton,- APPLY_STORYBOARD_FEEDBACK_MESSAGE,-} from "./AgentChatMessageButton";-import { useFrameComments, type CommentsSubmitState } from "./useFrameComments";--type SubView = "board" | "source";--export interface StoryboardLoadedProps {- projectId: string;- data: StoryboardResponse;- /** Re-fetch the manifest after a source edit is saved. */- reload: () => void;- /** Select a composition in the timeline (used by "Open in Preview"). */- onSelectComposition: (path: string) => void;-}--function clampIndex(index: number, count: number): number {- return Math.max(1, Math.min(count, index));-}--/** A storyboard that exists on disk: Board (contact sheet) ↔ Source ↔ frame focus. */-// fallow-ignore-next-line complexity-export function StoryboardLoaded({- projectId,- data,- reload,- onSelectComposition,-}: StoryboardLoadedProps) {- const [subView, setSubView] = useState<SubView>("board");- const [sourceDirty, setSourceDirty] = useState(false);- const [focusedIndex, setFocusedIndex] = useState<number | null>(null);- const [feedbackMessageCopied, setFeedbackMessageCopied] = useState(false);- const comments = useFrameComments(data.frames);- // When the board refreshes off a project change (agent revised frames), the- // agent has likely consumed the comments file too — re-check so the pending- // banner clears the moment revisions land, not on the next window focus.- const { refreshPending } = comments;- useEffect(() => {- void refreshPending();- }, [data.signature, refreshPending]);- useEffect(() => {- if (comments.draftCount > 0) setFeedbackMessageCopied(false);- }, [comments.draftCount]);-- const saveFeedbackAndCopyMessage = async () => {- const saved = await comments.submit();- if (!saved) return;- try {- await navigator.clipboard.writeText(APPLY_STORYBOARD_FEEDBACK_MESSAGE);- setFeedbackMessageCopied(true);- } catch {- setFeedbackMessageCopied(false);- }- };- const sourceFiles = useMemo<SourceFile[]>(() => {- const files: SourceFile[] = [{ path: data.path, label: data.path }];- if (data.script?.exists) files.push({ path: data.script.path, label: data.script.path });- return files;- // Depend on the stable fields, not the `data.script` object — every reload()- // produces a fresh object and would needlessly re-create this array.- }, [data.path, data.script?.path, data.script?.exists]);-- // Leaving the source editor drops its in-memory buffer; confirm when it's dirty.- // fallow-ignore-next-line complexity- const changeSubView = (next: SubView) => {- if (next === subView) return;- if (- subView === "source" &&- sourceDirty &&- !window.confirm("Discard unsaved markdown changes?")- ) {- return;- }- setSubView(next);- };-- const focusedFrame =- focusedIndex != null ? (data.frames.find((f) => f.index === focusedIndex) ?? null) : null;-- if (focusedFrame) {- return (- <StoryboardFrameFocus- key={focusedFrame.index}- projectId={projectId}- storyboardPath={data.path}- frame={focusedFrame}- frameCount={data.frames.length}- onBack={() => setFocusedIndex(null)}- onNavigate={(delta) =>- setFocusedIndex(clampIndex(focusedFrame.index + delta, data.frames.length))- }- onSaved={reload}- onSelectComposition={onSelectComposition}- scriptExists={Boolean(data.script?.exists)}- commentDraft={comments.drafts[focusedFrame.index] ?? ""}- onCommentDraftChange={(text) => comments.setDraft(focusedFrame.index, text)}- pendingComment={- comments.pending?.find((entry) => entry.frame === focusedFrame.index)?.text ?? null- }- pendingCommentCount={comments.pending?.length ?? 0}- commentDraftCount={comments.draftCount}- commentsSubmitState={comments.submitState}- commentsSubmitError={comments.submitError}- feedbackMessageCopied={feedbackMessageCopied}- onFeedbackMessageCopied={() => setFeedbackMessageCopied(true)}- onSaveFeedback={() => void saveFeedbackAndCopyMessage()}- posterVersion={data.signature}- />- );- }-- return (- <div className="flex w-full max-w-[100vw] flex-1 min-h-0 min-w-0 flex-col overflow-hidden bg-neutral-950 text-neutral-200">- <div className="flex flex-wrap items-center gap-3 border-b border-neutral-800 px-4 py-2">- <SubViewToggle value={subView} onChange={changeSubView} />- {subView === "board" && (- <CommentsSubmitBar- draftCount={comments.draftCount}- pendingCount={comments.pending?.length ?? 0}- submitState={comments.submitState}- submitError={comments.submitError}- messageCopied={feedbackMessageCopied}- onSave={() => void saveFeedbackAndCopyMessage()}- onMessageCopied={() => setFeedbackMessageCopied(true)}- />- )}- </div>- {subView === "board" ? (- <div className="flex-1 min-h-0 overflow-auto">- <div className="mx-auto max-w-[1400px] px-4 py-5 sm:px-8 sm:py-8">- <StoryboardDirection globals={data.globals} frameCount={data.frames.length} />- <StoryboardReviewGuide- frames={data.frames}- draftCount={comments.draftCount}- pendingCount={comments.pending?.length ?? 0}- onFeedbackMessageCopied={() => setFeedbackMessageCopied(true)}- />- <StoryboardWarnings- warnings={data.warnings}- onOpenSource={() => changeSubView("source")}- />- <StoryboardGrid- projectId={projectId}- frames={data.frames}- onOpenFrame={setFocusedIndex}- commentDrafts={comments.drafts}- onCommentDraftChange={comments.setDraft}- pendingComments={comments.pending}- posterVersion={data.signature}- />- {data.script && <StoryboardScriptPanel script={data.script} />}- </div>- </div>- ) : (- <StoryboardSourceEditor- files={sourceFiles}- onSaved={reload}- onDirtyChange={setSourceDirty}- />- )}- </div>- );-}--/** Batch-submit the per-frame comment drafts to `.hyperframes/frame-comments.json`. */-function CommentsSubmitBar({- draftCount,- pendingCount,- submitState,- submitError,- messageCopied,- onSave,- onMessageCopied,-}: {- draftCount: number;- pendingCount: number;- submitState: CommentsSubmitState;- submitError: string | null;- messageCopied: boolean;- onSave: () => void;- onMessageCopied: () => void;-}) {- return (- <div className="ml-auto flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2 sm:flex-none">- {pendingCount > 0 && (- <>- <span className="text-xs text-sky-300">- {messageCopied- ? "Feedback saved · Message copied — paste it in your terminal or IDE agent chat."- : "Feedback saved · Agent not notified."}- </span>- <AgentChatMessageButton- message={APPLY_STORYBOARD_FEEDBACK_MESSAGE}- label={messageCopied ? "Copy again" : "Copy prompt for agent"}- onCopied={onMessageCopied}- />- </>- )}- {pendingCount === 0 && draftCount === 0 && (- <span className="text-xs text-neutral-500">Add frame comments to request changes.</span>- )}- {submitError && (- <span className="max-w-64 truncate text-xs text-red-400" title={submitError}>- Couldn’t submit: {submitError}- </span>- )}- {draftCount > 0 && (- <Button- variant="primary"- size="sm"- loading={submitState === "saving"}- disabled={submitState === "saving"}- onClick={onSave}- >- Save & copy message ({draftCount})- </Button>- )}- </div>- );-}--function StoryboardWarnings({- warnings,- onOpenSource,-}: {- warnings: StoryboardResponse["warnings"];- onOpenSource: () => void;-}) {- if (warnings.length === 0) return null;- return (- <details className="mt-3 rounded-lg border border-amber-900/60 bg-amber-950/20 px-4 py-2 text-xs text-amber-200">- <summary className="cursor-pointer font-medium">- {warnings.length} storyboard warning{warnings.length === 1 ? "" : "s"}- </summary>- <ul className="mt-2 space-y-1 text-amber-200/80">- {warnings.map((warning, index) => (- <li key={`${warning.line ?? "unknown"}-${index}`}>- {warning.line ? `Line ${warning.line}: ` : ""}- {warning.message}- </li>- ))}- </ul>- <button- type="button"- onClick={onOpenSource}- className="mt-2 rounded text-amber-100 underline underline-offset-2 hover:text-white"- >- Open source to fix- </button>- </details>- );-}--const SUB_VIEWS: Array<{ value: SubView; label: string }> = [- { value: "board", label: "Board" },- { value: "source", label: "Source" },-];--function SubViewToggle({ value, onChange }: { value: SubView; onChange: (next: SubView) => void }) {- // Complete tabs contract: roving tabIndex + arrow-key navigation (the roles- // alone promised keyboard behavior the buttons didn't have).- const handleKeyDown = (e: React.KeyboardEvent) => {- if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return;- e.preventDefault();- const currentIndex = SUB_VIEWS.findIndex((v) => v.value === value);- const delta = e.key === "ArrowRight" ? 1 : -1;- const next = SUB_VIEWS[(currentIndex + delta + SUB_VIEWS.length) % SUB_VIEWS.length];- if (next) onChange(next.value);- };-- return (- <div- className="flex items-center gap-0.5 rounded-md bg-neutral-900 p-0.5"- role="tablist"- aria-label="Storyboard view"- onKeyDown={handleKeyDown}- >- {SUB_VIEWS.map((option) => (- <button- key={option.value}- type="button"- role="tab"- aria-selected={value === option.value}- tabIndex={value === option.value ? 0 : -1}- onClick={() => onChange(option.value)}- className={`rounded px-3 py-1 text-xs font-medium transition-colors active:scale-[0.98] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-studio-accent ${- value === option.value- ? "bg-neutral-700 text-neutral-100"- : "text-neutral-400 hover:text-neutral-200"- }`}- >- {option.label}- </button>- ))}- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardReviewGuide.tsx b/packages/studio/src/components/storyboard/StoryboardReviewGuide.tsxdeleted file mode 100644index ea2d9e4eda..0000000000--- a/packages/studio/src/components/storyboard/StoryboardReviewGuide.tsx+++ /dev/null@@ -1,300 +0,0 @@-import type { StoryboardFrameView } from "../../hooks/useStoryboard";-import {- AgentChatMessageButton,- APPLY_STORYBOARD_FEEDBACK_MESSAGE,-} from "./AgentChatMessageButton";-import { FRAME_STATUS_META, FRAME_STATUS_ORDER } from "./frameStatus";-import {- deriveStoryboardHandoffStep,- deriveStoryboardReviewStage,- type StoryboardHandoffStep,- type StoryboardReviewStage,-} from "./storyboardReviewStage";--const GUIDE_COPY: Record<StoryboardReviewStage, { eyebrow: string; title: string; body: string }> =- {- empty: {- eyebrow: "Waiting for a plan",- title: "The storyboard has no frames yet",- body: "Ask your agent to draft the story plan. Frames will appear here automatically.",- },- "plan-review": {- eyebrow: "Ready for review",- title: "Review the story plan",- body: "Check the sequence, scene direction, and voiceover before visual work begins. Leave frame comments, save them, then reply in your terminal or IDE agent chat.",- },- "sketch-in-progress": {- eyebrow: "Build in progress",- title: "Visual sketches are in progress",- body: "New posters appear automatically as your agent builds them. You can comment now; wait until no frames remain in Outline before approving the layouts.",- },- "sketch-review": {- eyebrow: "Ready for review",- title: "Review the visual direction",- body: "Check composition, hierarchy, and copy. Save frame comments, then reply in your terminal or IDE agent chat.",- },- "animation-in-progress": {- eyebrow: "Build in progress",- title: "Animation is in progress",- body: "The board refreshes as frames advance. Review completed frames now; the final review is ready when every frame is Animated.",- },- "final-review": {- eyebrow: "Ready for review",- title: "Review motion and timing",- body: "Every frame is animated. Open a frame in Preview to review it in the timeline, or leave frame comments for another revision.",- },- };--const REVIEW_ACTION_COPY: Record<- StoryboardReviewStage,- { body: string; approvalMessage?: string }-> = {- empty: { body: "Add comments as previews arrive." },- "plan-review": {- body: "Add comments where you want changes. If everything looks right, approve this pass in agent chat.",- approvalMessage: "Approve this storyboard plan and continue to visual sketches.",- },- "sketch-in-progress": {- body: "Add comments as previews arrive. You’ll be prompted to approve when this pass is ready.",- },- "sketch-review": {- body: "Add comments where you want changes. If everything looks right, approve this pass in agent chat.",- approvalMessage: "Approve these storyboard sketches and continue to animation.",- },- "animation-in-progress": {- body: "Add comments as previews arrive. You’ll be prompted to approve when this pass is ready.",- },- "final-review": {- body: "Add comments where you want changes. If everything looks right, approve this pass in agent chat.",- approvalMessage: "Approve this final storyboard review and continue to rendering.",- },-};--type ReviewStepOffset = -1 | 0 | 1;-const REVIEW_STEP_STATES: Record<- ReviewStepOffset,- {- textClass: string;- numberClass: string;- ariaCurrent: "step" | undefined;- marker: (number: StoryboardHandoffStep) => StoryboardHandoffStep | string;- }-> = {- [-1]: {- textClass: "text-emerald-400",- numberClass: "border-emerald-700 bg-emerald-500/10",- ariaCurrent: undefined,- marker: () => "✓",- },- [0]: {- textClass: "text-sky-300",- numberClass: "border-sky-500 bg-sky-500/15",- ariaCurrent: "step",- marker: (number) => number,- },- [1]: {- textClass: "text-neutral-600",- numberClass: "border-neutral-700",- ariaCurrent: undefined,- marker: (number) => number,- },-};--const REVIEW_STEP_SEPARATOR_CLASS: Record<StoryboardHandoffStep, string> = {- 1: "invisible",- 2: "",- 3: "",-};--export interface StoryboardReviewGuideProps {- frames: StoryboardFrameView[];- draftCount: number;- pendingCount: number;- onFeedbackMessageCopied: () => void;-}--/** Stage-aware instructions plus the explicit Studio → agent handoff. */-export function StoryboardReviewGuide({- frames,- draftCount,- pendingCount,- onFeedbackMessageCopied,-}: StoryboardReviewGuideProps) {- const summary = deriveStoryboardReviewStage(frames);- const copy = GUIDE_COPY[summary.stage];- const handoffStep = deriveStoryboardHandoffStep(draftCount, pendingCount);- const progress = progressLabel(summary);-- return (- <section className="mt-5 rounded-lg border border-neutral-800 bg-neutral-900/60 px-4 py-3">- <div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">- <div className="max-w-3xl">- <div className="text-[10px] font-semibold uppercase tracking-wider text-sky-400">- {copy.eyebrow}- </div>- <h2 className="mt-0.5 text-sm font-semibold text-neutral-100">{copy.title}</h2>- <p className="mt-1 text-xs leading-relaxed text-neutral-400">{copy.body}</p>- </div>- {summary.frameCount > 0 && (- <div className="shrink-0">- <div className="mb-1.5 text-right text-[11px] font-medium text-neutral-300">- {progress}- </div>- <div className="flex flex-wrap justify-end gap-1.5" aria-label="Frame status summary">- {FRAME_STATUS_ORDER.map((status) => (- <span- key={status}- className={`rounded px-2 py-1 text-[10px] font-medium ${FRAME_STATUS_META[status].chipClass}`}- >- {summary.counts[status]} {FRAME_STATUS_META[status].label}- </span>- ))}- </div>- </div>- )}- </div>-- {summary.frameCount > 0 && (- <div className="mt-3 border-t border-neutral-800 pt-3">- <ReviewSteps current={handoffStep} />- <NextAction- stage={summary.stage}- step={handoffStep}- draftCount={draftCount}- onFeedbackMessageCopied={onFeedbackMessageCopied}- />- </div>- )}- </section>- );-}--function ReviewSteps({ current }: { current: StoryboardHandoffStep }) {- const steps = ["Review frames", "Save feedback", "Reply in agent chat"];- return (- <ol className="hidden items-center gap-2 sm:flex" aria-label="Storyboard review workflow">- {steps.map((label, index) => (- <ReviewStep- key={label}- label={label}- number={(index + 1) as StoryboardHandoffStep}- current={current}- />- ))}- </ol>- );-}--function ReviewStep({- label,- number,- current,-}: {- label: string;- number: StoryboardHandoffStep;- current: StoryboardHandoffStep;-}) {- const offset = Math.sign(number - current) as ReviewStepOffset;- const state = REVIEW_STEP_STATES[offset];-- return (- <li className="flex items-center gap-2">- <span- className={`text-neutral-700 ${REVIEW_STEP_SEPARATOR_CLASS[number]}`}- aria-hidden="true"- >- →- </span>- <span- aria-current={state.ariaCurrent}- className={`flex items-center gap-1.5 text-[11px] font-medium ${state.textClass}`}- >- <span- className={`flex h-5 w-5 items-center justify-center rounded-full border text-[10px] ${state.numberClass}`}- >- {state.marker(number)}- </span>- {label}- </span>- </li>- );-}--function NextAction({- stage,- step,- draftCount,- onFeedbackMessageCopied,-}: {- stage: StoryboardReviewStage;- step: StoryboardHandoffStep;- draftCount: number;- onFeedbackMessageCopied: () => void;-}) {- if (step === 3) {- return <AgentHandoffAction onFeedbackMessageCopied={onFeedbackMessageCopied} />;- }- if (step === 2) return <SaveFeedbackAction draftCount={draftCount} />;- return <ReviewFramesAction stage={stage} />;-}--function AgentHandoffAction({ onFeedbackMessageCopied }: { onFeedbackMessageCopied: () => void }) {- return (- <div className="mt-3 flex flex-col gap-3 rounded-md border border-sky-900/70 bg-sky-950/20 px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between">- <div className="max-w-3xl">- <div className="text-xs font-semibold text-sky-200">Next: return to your agent chat</div>- <p className="mt-0.5 text-[11px] text-neutral-400">- Feedback is saved, but the agent has not been notified. Paste this prompt in your terminal- or IDE agent chat.- </p>- </div>- <AgentChatMessageButton- message={APPLY_STORYBOARD_FEEDBACK_MESSAGE}- onCopied={onFeedbackMessageCopied}- />- </div>- );-}--function SaveFeedbackAction({ draftCount }: { draftCount: number }) {- return (- <div className="mt-3 rounded-md border border-neutral-800 bg-neutral-950/40 px-3 py-2.5">- <div>- <div className="text-xs font-semibold text-neutral-200">Next: save your feedback</div>- <p className="mt-0.5 text-[11px] text-neutral-500">- {draftCount} frame{draftCount === 1 ? " has" : "s have"} feedback ready. Use Save &- copy message above to prepare this batch for your agent.- </p>- </div>- </div>- );-}--function ReviewFramesAction({ stage }: { stage: StoryboardReviewStage }) {- const copy = REVIEW_ACTION_COPY[stage];-- return (- <div className="mt-3 flex flex-col gap-3 rounded-md border border-neutral-800 bg-neutral-950/40 px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between">- <div>- <div className="text-xs font-semibold text-neutral-200">Next: review the frames</div>- <p className="mt-0.5 text-[11px] text-neutral-500">{copy.body}</p>- </div>- {copy.approvalMessage && (- <AgentChatMessageButton message={copy.approvalMessage} label="Copy approval message" />- )}- </div>- );-}--// The label intentionally folds six workflow states into three user-facing progress formats.-// fallow-ignore-next-line complexity-function progressLabel(summary: ReturnType<typeof deriveStoryboardReviewStage>): string {- if (summary.stage === "sketch-in-progress" || summary.stage === "sketch-review") {- const ready = summary.frameCount - summary.counts.outline;- return `${ready} of ${summary.frameCount} visual sketches ready`;- }- if (summary.stage === "animation-in-progress" || summary.stage === "final-review") {- return `${summary.counts.animated} of ${summary.frameCount} animations ready`;- }- return `${summary.frameCount} plan frame${summary.frameCount === 1 ? "" : "s"} ready`;-}diff --git a/packages/studio/src/components/storyboard/StoryboardScriptPanel.tsx b/packages/studio/src/components/storyboard/StoryboardScriptPanel.tsxdeleted file mode 100644index 607f3d165b..0000000000--- a/packages/studio/src/components/storyboard/StoryboardScriptPanel.tsx+++ /dev/null@@ -1,26 +0,0 @@-import type { StoryboardScript } from "../../hooks/useStoryboard";--export interface StoryboardScriptPanelProps {- script: StoryboardScript;-}--/**- * Collapsible view of the companion narration script (SCRIPT.md). The mature- * pipeline keeps the full voiceover script — voice settings, per-line delivery- * and timing — in this file; here it's surfaced read-only alongside the frames.- * (Per-frame VO iteration will live in the frame focus view.)- */-export function StoryboardScriptPanel({ script }: StoryboardScriptPanelProps) {- if (!script.exists) return null;- return (- <details className="mt-10 rounded-lg border border-neutral-800 bg-neutral-900/50">- <summary className="cursor-pointer select-none px-4 py-3 text-sm font-medium text-neutral-300">- Narration script- <span className="ml-2 font-normal text-neutral-500">{script.path}</span>- </summary>- <pre className="max-h-[420px] overflow-auto whitespace-pre-wrap border-t border-neutral-800 px-4 py-3 text-xs leading-relaxed text-neutral-400">- {script.content}- </pre>- </details>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardSourceEditor.tsx b/packages/studio/src/components/storyboard/StoryboardSourceEditor.tsxdeleted file mode 100644index 5e305ed954..0000000000--- a/packages/studio/src/components/storyboard/StoryboardSourceEditor.tsx+++ /dev/null@@ -1,231 +0,0 @@-import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { marked } from "marked";-import DOMPurify from "dompurify";-import { SourceEditor } from "../editor/SourceEditor";-import { useFileManagerContext } from "../../contexts/FileManagerContext";--export interface SourceFile {- path: string;- label: string;-}--export interface StoryboardSourceEditorProps {- files: SourceFile[];- /** Called after a successful save so the Board can re-parse the updated file. */- onSaved: () => void;- /** Surfaces unsaved-edit state so the parent can guard the Board↔Source toggle. */- onDirtyChange?: (dirty: boolean) => void;-}--const DISCARD_PROMPT = "Discard unsaved markdown changes?";--interface EditableFile {- content: string;- setContent: (next: string) => void;- dirty: boolean;- loading: boolean;- saving: boolean;- error: string | null;- save: () => void;-}--/** Load a project file's raw text and track edits + save state via the shared file manager. */-function useEditableFile(path: string, onSaved: () => void): EditableFile {- const { readProjectFile, writeProjectFile } = useFileManagerContext();- const [content, setContent] = useState("");- const [saved, setSaved] = useState("");- const [loading, setLoading] = useState(true);- const [saving, setSaving] = useState(false);- const [error, setError] = useState<string | null>(null);-- useEffect(() => {- if (!path) return;- let cancelled = false;- setLoading(true);- setError(null);- readProjectFile(path)- .then((text) => {- if (cancelled) return;- setContent(text);- setSaved(text);- })- .catch((err: unknown) => {- if (!cancelled) setError(err instanceof Error ? err.message : "failed to load file");- })- .finally(() => {- if (!cancelled) setLoading(false);- });- return () => {- cancelled = true;- };- }, [path, readProjectFile]);-- const save = useCallback(() => {- if (saving) return; // coalesce a fast double Cmd+S into one PUT- setSaving(true);- setError(null);- writeProjectFile(path, content)- .then(() => {- setSaved(content);- onSaved();- })- .catch((err: unknown) => setError(err instanceof Error ? err.message : "failed to save"))- .finally(() => setSaving(false));- }, [writeProjectFile, path, content, onSaved, saving]);-- return { content, setContent, dirty: content !== saved, loading, saving, error, save };-}--/** Preview links open in a new tab with the `window.opener` back-channel severed. */-function hardenLinks(node: Element): void {- if (node.tagName === "A" && node.hasAttribute("href")) {- node.setAttribute("target", "_blank");- node.setAttribute("rel", "noopener noreferrer");- }-}--/** Render markdown to sanitized HTML, debounced so we don't re-parse on every keystroke. */-function useMarkdownPreview(source: string): string {- const [debounced, setDebounced] = useState(source);- const primed = useRef(false);- useEffect(() => {- // Paint the first non-empty content immediately (no 200ms blank window after a file- // loads), exactly once, then debounce all subsequent keystrokes.- if (!primed.current && source !== "") {- primed.current = true;- setDebounced(source);- return;- }- const id = window.setTimeout(() => setDebounced(source), 200);- return () => window.clearTimeout(id);- }, [source]);- return useMemo(() => {- // `{ async: false }` pins the synchronous string return (no Promise union to narrow).- const html = marked.parse(debounced, { async: false });- // Scope the link-hardening hook to this call; `finally` guarantees removal even if- // `sanitize` throws, so the hook can never leak into other DOMPurify consumers.- DOMPurify.addHook("afterSanitizeAttributes", hardenLinks);- try {- return DOMPurify.sanitize(html);- } finally {- DOMPurify.removeHook("afterSanitizeAttributes");- }- }, [debounced]);-}--function isSaveShortcut(event: React.KeyboardEvent): boolean {- return (event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "s";-}--// Minimal prose styling for the rendered preview (Tailwind doesn't style raw HTML).-const PREVIEW_PROSE =- "text-sm leading-relaxed text-neutral-300 " +- "[&_h1]:mb-2 [&_h1]:mt-5 [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:text-neutral-100 " +- "[&_h2]:mb-1.5 [&_h2]:mt-5 [&_h2]:text-base [&_h2]:font-semibold [&_h2]:text-neutral-100 " +- "[&_h3]:mt-4 [&_h3]:font-semibold [&_h3]:text-neutral-200 " +- "[&_p]:my-2 [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 " +- "[&_code]:rounded [&_code]:bg-neutral-800 [&_code]:px-1 [&_code]:text-[0.85em] [&_code]:text-neutral-200 " +- "[&_pre]:my-3 [&_pre]:overflow-auto [&_pre]:rounded [&_pre]:bg-neutral-900 [&_pre]:p-3 " +- "[&_pre_code]:bg-transparent [&_pre_code]:p-0 " +- "[&_hr]:my-4 [&_hr]:border-neutral-800 [&_a]:text-sky-400 [&_strong]:text-neutral-100 " +- "[&_img]:my-2 [&_img]:max-w-full [&_img]:h-auto [&_img]:rounded " +- "[&_table]:my-3 [&_th]:border [&_th]:border-neutral-800 [&_th]:px-2 [&_th]:py-1 " +- "[&_td]:border [&_td]:border-neutral-800 [&_td]:px-2 [&_td]:py-1";--/**- * Raw markdown editor + live preview for the storyboard's canonical files- * (STORYBOARD.md / SCRIPT.md). Markdown stays the source of truth: saving writes- * the file and re-parses the Board. Deliberately raw (not WYSIWYG) so the- * structured frame fields can't be mangled; the preview is sanitized before render.- */-// fallow-ignore-next-line complexity-export function StoryboardSourceEditor({- files,- onSaved,- onDirtyChange,-}: StoryboardSourceEditorProps) {- const [selected, setSelected] = useState(files[0]?.path ?? "");- // Reconcile against the current file list so a removed/renamed file can't strand the tab.- const activePath = files.some((f) => f.path === selected) ? selected : (files[0]?.path ?? "");- const file = useEditableFile(activePath, onSaved);- const previewHtml = useMarkdownPreview(file.content);-- // Surface dirty state to the parent (guards the Board↔Source toggle) and warn- // on browser-level navigation while there are unsaved edits.- useEffect(() => onDirtyChange?.(file.dirty), [onDirtyChange, file.dirty]);- useEffect(() => {- if (!file.dirty) return;- const onBeforeUnload = (event: BeforeUnloadEvent) => {- event.preventDefault();- event.returnValue = "";- };- window.addEventListener("beforeunload", onBeforeUnload);- return () => window.removeEventListener("beforeunload", onBeforeUnload);- }, [file.dirty]);-- // Switching files discards the in-memory buffer; confirm when there are unsaved edits.- const selectFile = (path: string) => {- if (path === activePath) return;- if (file.dirty && !window.confirm(DISCARD_PROMPT)) return;- setSelected(path);- };-- return (- <div- className="flex flex-1 min-h-0 flex-col"- onKeyDown={(e) => {- if (!isSaveShortcut(e)) return;- e.preventDefault();- if (file.dirty && !file.saving) file.save();- }}- >- <div className="flex items-center gap-1 border-b border-neutral-800 px-4 py-2">- {files.map((f) => (- <button- key={f.path}- type="button"- onClick={() => selectFile(f.path)}- className={`rounded px-2.5 py-1 text-xs font-medium transition-colors ${- activePath === f.path- ? "bg-neutral-800 text-neutral-100"- : "text-neutral-400 hover:text-neutral-200"- }`}- >- {f.label}- </button>- ))}- <div className="ml-auto flex items-center gap-3">- {file.error && <span className="text-xs text-red-400">{file.error}</span>}- <span className="text-xs text-neutral-500">- {file.saving ? "Saving…" : file.dirty ? "Unsaved changes" : "Saved"}- </span>- <button- type="button"- onClick={file.save}- disabled={!file.dirty || file.saving}- className="rounded bg-emerald-600 px-3 py-1 text-xs font-medium text-white disabled:opacity-40"- >- Save- </button>- </div>- </div>- <div className="flex flex-1 min-h-0">- <div className="w-1/2 min-w-0 border-r border-neutral-800">- {file.loading ? (- <div className="p-4 text-sm text-neutral-500">Loading {activePath}…</div>- ) : (- <SourceEditor- content={file.content}- language="markdown"- filePath={activePath}- onChange={file.setContent}- />- )}- </div>- <div className="w-1/2 min-w-0 overflow-auto bg-neutral-950 px-6 py-4">- <div className={PREVIEW_PROSE} dangerouslySetInnerHTML={{ __html: previewHtml }} />- </div>- </div>- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardStatusLegend.tsx b/packages/studio/src/components/storyboard/StoryboardStatusLegend.tsxdeleted file mode 100644index 5050e4de34..0000000000--- a/packages/studio/src/components/storyboard/StoryboardStatusLegend.tsx+++ /dev/null@@ -1,21 +0,0 @@-import { FRAME_STATUS_META, FRAME_STATUS_ORDER } from "./frameStatus";--/**- * Explains the frame lifecycle: a frame advances outline → built → animated.- * Mirrors the status chips on each tile (shares FRAME_STATUS_META).- */-export function StoryboardStatusLegend() {- return (- <div className="flex flex-wrap items-center gap-x-5 gap-y-1.5 text-[11px] text-neutral-500">- <span className="uppercase tracking-wider text-neutral-600">Status</span>- {FRAME_STATUS_ORDER.map((status, i) => (- <span key={status} className="flex items-center gap-1.5">- {i > 0 && <span className="text-neutral-700">→</span>}- <span className={`h-2 w-2 rounded-full ${FRAME_STATUS_META[status].dotClass}`} />- <span className="font-medium text-neutral-300">{FRAME_STATUS_META[status].label}</span>- <span className="text-neutral-500">— {FRAME_STATUS_META[status].description}</span>- </span>- ))}- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardView.tsx b/packages/studio/src/components/storyboard/StoryboardView.tsxdeleted file mode 100644index c17d7dfa95..0000000000--- a/packages/studio/src/components/storyboard/StoryboardView.tsx+++ /dev/null@@ -1,169 +0,0 @@-import { useState, type ReactNode } from "react";-import { Copy, Check } from "@phosphor-icons/react";-import { useStoryboard } from "../../hooks/useStoryboard";-import { useProjectSignaturePoll } from "../../hooks/useProjectSignaturePoll";-import { copyTextToClipboard } from "../../utils/clipboard";-import { Button } from "../ui/Button";-import { StoryboardLoaded } from "./StoryboardLoaded";--export interface StoryboardViewProps {- projectId: string;- /** Select a composition in the timeline (used by the frame focus "Open in Preview"). */- onSelectComposition: (path: string) => void;-}--/**- * Top-level storyboard stage. Replaces the timeline/preview when the view mode- * is `storyboard`. Handles the load states here; once a storyboard exists,- * {@link StoryboardLoaded} owns the Board ↔ Source experience.- */-// fallow-ignore-next-line complexity-export function StoryboardView({ projectId, onSelectComposition }: StoryboardViewProps) {- const { data, loading, error, reload } = useStoryboard(projectId);- // Keep the board current while an agent writes to the project: when the- // project signature moves past the one `data` was loaded with, refetch. Also- // upgrades the empty state the moment STORYBOARD.md lands on disk.- useProjectSignaturePoll(projectId, data?.signature, reload);-- if (loading) return <StoryboardFrame>{<Message>Loading storyboard…</Message>}</StoryboardFrame>;- if (error) {- return (- <StoryboardFrame>- <Message tone="error">Couldn’t load the storyboard: {error}</Message>- <div className="flex justify-center">- <Button size="sm" variant="secondary" onClick={reload}>- Retry- </Button>- </div>- </StoryboardFrame>- );- }- if (!data) return <StoryboardFrame>{null}</StoryboardFrame>;- if (!data.exists) {- return (- <StoryboardFrame>- <EmptyState path={data.path} />- </StoryboardFrame>- );- }-- return (- <StoryboardLoaded- projectId={projectId}- data={data}- reload={reload}- onSelectComposition={onSelectComposition}- />- );-}--function StoryboardFrame({ children }: { children: ReactNode }) {- return (- <div className="flex-1 min-h-0 overflow-auto bg-neutral-950 text-neutral-200">- <div className="mx-auto max-w-[1400px] px-8 py-8">{children}</div>- </div>- );-}--function Message({ children, tone = "muted" }: { children: ReactNode; tone?: "muted" | "error" }) {- return (- <div- className={`px-6 py-12 text-center text-sm ${- tone === "error" ? "text-red-400" : "text-neutral-500"- }`}- >- {children}- </div>- );-}--function handoffPrompt(path: string): string {- return `Create a \`${path}\` at the project root to plan this video frame by frame.--Use this format:------format: 1920x1080-message: <the one-line takeaway of the video>-arc: <the narrative shape, e.g. Problem → Solution>-audience: <who it's for>------## Frame 1 — <title>-- duration: 5s-- transition_in: crossfade-- status: outline-- src: compositions/frames/01-<slug>.html--<A sentence or two: what's on screen and what the narration says.>--Add one \`## Frame N\` section per beat. Keep the arc tight.--Then run the review loop from the hyperframes skill (references/review-loop.md): present the plan as a proposal, offer wireframe sketches on this board, and build on the confirmed layouts.`;-}--function EmptyState({ path }: { path: string }) {- const [copied, setCopied] = useState(false);- const prompt = handoffPrompt(path);-- const onCopy = async () => {- if (await copyTextToClipboard(prompt)) {- setCopied(true);- window.setTimeout(() => setCopied(false), 2000);- }- };-- return (- <div>- <div className="rounded-lg border border-dashed border-neutral-800 px-6 py-10 text-center">- <h2 className="text-base font-semibold text-neutral-300">No storyboard yet</h2>- <p className="mx-auto mt-2 max-w-md text-sm text-neutral-500">- Add a <code className="rounded bg-neutral-900 px-1 py-0.5 text-neutral-400">{path}</code>{" "}- at the project root to plan this video frame by frame. Hand this prompt to your coding- agent to scaffold it.- </p>-- <div className="mx-auto mt-6 max-w-2xl overflow-hidden rounded-lg border border-neutral-800 bg-neutral-900 text-left">- <div className="flex items-center justify-between border-b border-neutral-800 px-3 py-2">- <span className="font-mono text-xs text-neutral-500">Prompt for your agent</span>- <Button- size="sm"- variant="secondary"- onClick={onCopy}- icon={copied ? <Check size={14} /> : <Copy size={14} />}- >- {copied ? "Copied" : "Copy prompt"}- </Button>- </div>- <pre className="max-h-64 overflow-auto px-4 py-3 font-mono text-xs leading-relaxed text-neutral-400 whitespace-pre-wrap">- {prompt}- </pre>- </div>- </div>-- <SkeletonPreview />- </div>- );-}--/** Faded placeholder of a filled board so landing here isn't a dead end —- * it previews the contact-sheet layout {@link StoryboardGrid} renders. */-function SkeletonPreview() {- return (- <div aria-hidden="true" className="mt-10 select-none opacity-40">- <div className="mb-4 text-center text-xs uppercase tracking-wide text-neutral-600">- Preview- </div>- <div className="grid gap-x-6 gap-y-8 [grid-template-columns:repeat(auto-fill,minmax(300px,1fr))]">- {[0, 1, 2].map((i) => (- <div key={i} className="rounded-lg border border-neutral-800 bg-neutral-900/40 p-3">- <div className="aspect-video w-full rounded bg-neutral-800/60" />- <div className="mt-3 h-3 w-2/3 rounded bg-neutral-800/60" />- <div className="mt-2 h-2.5 w-full rounded bg-neutral-800/40" />- <div className="mt-1.5 h-2.5 w-4/5 rounded bg-neutral-800/40" />- </div>- ))}- </div>- </div>- );-}diff --git a/packages/studio/src/components/storyboard/StoryboardViewModeGuard.test.tsx b/packages/studio/src/components/storyboard/StoryboardViewModeGuard.test.tsxdeleted file mode 100644index d0f9fdae41..0000000000--- a/packages/studio/src/components/storyboard/StoryboardViewModeGuard.test.tsx+++ /dev/null@@ -1,187 +0,0 @@-// @vitest-environment happy-dom--import React, { act } from "react";-import { createRoot, type Root } from "react-dom/client";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { ViewModeProvider, useViewModeState } from "../../contexts/ViewModeContext";-import { ViewModeToggle } from "../StudioHeader";-import { StoryboardFrameFocus } from "./StoryboardFrameFocus";--(globalThis as unknown as { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;--vi.mock("../../contexts/FileManagerContext", () => ({- useFileManagerContext: () => ({- readProjectFile: vi.fn(),- writeProjectFile: vi.fn(),- }),-}));--vi.mock("../../utils/studioTelemetry", () => ({- trackStudioEvent: vi.fn(),-}));--vi.mock("./FramePoster", () => ({- FramePoster: () => <div>poster</div>,- posterTime: () => 0,-}));--const onSelectComposition = vi.fn();-const onNavigate = vi.fn();--function TestApp() {- const viewMode = useViewModeState();- return (- <ViewModeProvider value={viewMode}>- <span data-view-mode={viewMode.viewMode}>{viewMode.viewMode}</span>- <ViewModeToggle />- {viewMode.viewMode === "storyboard" && (- <StoryboardFrameFocus- projectId="project"- storyboardPath="STORYBOARD.md"- frame={{- index: 1,- number: 1,- title: "Opening",- status: "built",- src: "frames/01-opening.html",- srcExists: true,- voiceover: "Original voiceover",- narrative: "",- extra: {},- }}- frameCount={2}- onBack={vi.fn()}- onNavigate={onNavigate}- onSaved={vi.fn()}- onSelectComposition={onSelectComposition}- scriptExists={false}- commentDraft=""- onCommentDraftChange={vi.fn()}- pendingComment={null}- pendingCommentCount={0}- commentDraftCount={0}- commentsSubmitState="idle"- commentsSubmitError={null}- feedbackMessageCopied={false}- onFeedbackMessageCopied={vi.fn()}- onSaveFeedback={vi.fn()}- />- )}- </ViewModeProvider>- );-}--function renderApp(): { host: HTMLDivElement; root: Root } {- const host = document.createElement("div");- document.body.append(host);- const root = createRoot(host);- act(() => root.render(<TestApp />));- return { host, root };-}--function makeVoiceoverDirty(host: HTMLElement): void {- const textarea = host.querySelector<HTMLTextAreaElement>(- 'textarea[placeholder^="What the narrator says"]',- );- if (!textarea) throw new Error("voiceover textarea not rendered");- const valueSetter = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;- act(() => {- valueSetter?.call(textarea, "Changed voiceover");- textarea.dispatchEvent(new Event("input", { bubbles: true }));- });-}--function clickButton(host: HTMLElement, label: string): void {- const button = [...host.querySelectorAll("button")].find(- (candidate) => candidate.textContent?.trim() === label,- );- if (!button) throw new Error(`button not found: ${label}`);- act(() => button.dispatchEvent(new MouseEvent("click", { bubbles: true })));-}--async function goBack(): Promise<void> {- await act(async () => {- window.history.back();- await new Promise((resolve) => setTimeout(resolve, 0));- });-}--beforeEach(() => {- window.history.replaceState({ entry: "timeline" }, "", "/");- window.history.pushState({ entry: "storyboard" }, "", "/?view=storyboard");- onSelectComposition.mockReset();- onNavigate.mockReset();-});--afterEach(() => {- document.body.innerHTML = "";- vi.restoreAllMocks();-});--describe("dirty storyboard voiceover view-mode guard", () => {- it("guards the header Preview transition on decline and allows it on accept", () => {- const confirm = vi.spyOn(window, "confirm").mockReturnValue(false);- const { host, root } = renderApp();- makeVoiceoverDirty(host);-- clickButton(host, "Preview");- expect(host.querySelector("[data-view-mode]")?.textContent).toBe("storyboard");- expect(confirm).toHaveBeenCalledWith("Discard unsaved voiceover changes?");-- confirm.mockReturnValue(true);- clickButton(host, "Preview");- expect(host.querySelector("[data-view-mode]")?.textContent).toBe("timeline");- expect(onSelectComposition).not.toHaveBeenCalled();- act(() => root.unmount());- });-- it("guards Open in Preview on decline and selects the frame only after accept", () => {- const confirm = vi.spyOn(window, "confirm").mockReturnValue(false);- const { host, root } = renderApp();- makeVoiceoverDirty(host);-- clickButton(host, "Open in Preview →");- expect(host.querySelector("[data-view-mode]")?.textContent).toBe("storyboard");- expect(onSelectComposition).not.toHaveBeenCalled();-- confirm.mockReturnValue(true);- clickButton(host, "Open in Preview →");- expect(host.querySelector("[data-view-mode]")?.textContent).toBe("timeline");- expect(onSelectComposition).toHaveBeenCalledWith("frames/01-opening.html");- act(() => root.unmount());- });-- it("guards browser history transitions on decline and allows them on accept", async () => {- const confirm = vi.spyOn(window, "confirm").mockReturnValue(false);- const { host, root } = renderApp();- makeVoiceoverDirty(host);-- await goBack();- expect(host.querySelector("[data-view-mode]")?.textContent).toBe("storyboard");- expect(window.location.search).toBe("?view=storyboard");- expect(window.history.state).toEqual({ entry: "storyboard" });- expect(confirm).toHaveBeenCalledWith("Discard unsaved voiceover changes?");-- confirm.mockReturnValue(true);- await goBack();- expect(host.querySelector("[data-view-mode]")?.textContent).toBe("timeline");- expect(window.location.search).toBe("");- expect(window.history.state).toEqual({ entry: "timeline" });- act(() => root.unmount());- });-});--describe("storyboard frame keyboard navigation", () => {- it("leaves arrow keys with contenteditable text", () => {- const { host, root } = renderApp();- const editor = document.createElement("div");- editor.contentEditable = "true";- host.append(editor);- editor.focus();-- act(() => window.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowRight" })));-- expect(onNavigate).not.toHaveBeenCalled();- act(() => root.unmount());- });-});diff --git a/packages/studio/src/components/storyboard/frameComments.test.ts b/packages/studio/src/components/storyboard/frameComments.test.tsdeleted file mode 100644index 0161d3180a..0000000000--- a/packages/studio/src/components/storyboard/frameComments.test.ts+++ /dev/null@@ -1,95 +0,0 @@-import { describe, expect, it } from "vitest";-import { buildCommentsFile, draftEntries, parseCommentsFile, passForFrames } from "./frameComments";--const frames = [- { index: 1, status: "built" as const, src: "compositions/frames/01-hook.html", title: "Hook" },- {- index: 2,- status: "built" as const,- src: "compositions/frames/02-thesis.html",- title: "Thesis",- },- { index: 3, status: "built" as const, src: "compositions/frames/03-proof.html", title: "Proof" },-];--describe("passForFrames", () => {- it("maps the furthest status to the review pass", () => {- expect(passForFrames([{ status: "outline" }, { status: "outline" }])).toBe("storyboard");- expect(passForFrames([{ status: "outline" }, { status: "built" }])).toBe("sketch");- expect(passForFrames([{ status: "built" }, { status: "animated" }])).toBe("final");- });-});--describe("draftEntries", () => {- it("keeps only non-empty drafts, in board order, with src/title echoed", () => {- const entries = draftEntries(frames, { 3: "swap the chart", 1: " ", 2: "tighter kerning" });- expect(entries).toEqual([- { frame: 2, src: frames[1]?.src, title: "Thesis", text: "tighter kerning" },- { frame: 3, src: frames[2]?.src, title: "Proof", text: "swap the chart" },- ]);- });-});--describe("parseCommentsFile", () => {- it("reads a well-formed file", () => {- const parsed = parseCommentsFile(- JSON.stringify({- version: 1,- pass: "sketch",- submitted_at: "2026-07-10T00:00:00Z",- comments: [{ frame: 2, text: "hi" }],- }),- );- expect(parsed?.pass).toBe("sketch");- expect(parsed?.comments).toEqual([{ frame: 2, src: undefined, title: undefined, text: "hi" }]);- });-- it("treats empty or malformed input as no file", () => {- expect(parseCommentsFile("")).toBeNull();- expect(parseCommentsFile("not json")).toBeNull();- expect(parseCommentsFile(JSON.stringify({ comments: "nope" }))).toBeNull();- });-- it("drops malformed entries but keeps the valid ones", () => {- const parsed = parseCommentsFile(- JSON.stringify({ comments: [{ frame: 1, text: "ok" }, { frame: "x" }, null] }),- );- expect(parsed?.comments).toEqual([{ frame: 1, src: undefined, title: undefined, text: "ok" }]);- });-});--describe("buildCommentsFile", () => {- it("merges an unconsumed previous batch: new frames win, others stay", () => {- const previous = parseCommentsFile(- JSON.stringify({- version: 1,- pass: "sketch",- submitted_at: "2026-07-10T00:00:00Z",- comments: [- { frame: 1, text: "old note on hook" },- { frame: 3, text: "old note on proof" },- ],- }),- );- const file = buildCommentsFile(- frames,- { 3: "new note on proof" },- previous,- "2026-07-10T01:00:00Z",- );- expect(file.pass).toBe("sketch");- expect(file.submitted_at).toBe("2026-07-10T01:00:00Z");- expect(file.comments.map((c) => [c.frame, c.text])).toEqual([- [1, "old note on hook"],- [3, "new note on proof"],- ]);- });-- it("writes a fresh batch when no previous file exists", () => {- const file = buildCommentsFile(frames, { 2: "tighter" }, null, "2026-07-10T01:00:00Z");- expect(file.version).toBe(1);- expect(file.comments).toEqual([- { frame: 2, src: frames[1]?.src, title: "Thesis", text: "tighter" },- ]);- });-});diff --git a/packages/studio/src/components/storyboard/frameComments.ts b/packages/studio/src/components/storyboard/frameComments.tsdeleted file mode 100644index e8d715d948..0000000000--- a/packages/studio/src/components/storyboard/frameComments.ts+++ /dev/null@@ -1,115 +0,0 @@-import type { FrameStatus } from "@hyperframes/core/storyboard";--/**- * Frame comments — the storyboard review's structured feedback channel.- *- * The board's per-frame comment boxes write one batch file on submit; the- * consuming agent revises exactly the frames named, deletes the file, and- * re-presents. The file shape is a cross-repo contract — keep it in sync with- * skills/hyperframes/references/storyboard-format.md § Frame comments.- */-export const FRAME_COMMENTS_PATH = ".hyperframes/frame-comments.json";--export type FrameCommentsPass = "storyboard" | "sketch" | "final";--export interface FrameCommentEntry {- /** The frame's 1-based `index` in the manifest — the key. */- frame: number;- /** Copied from the frame at submit time so a post-submit reorder is detectable. */- src?: string;- title?: string;- text: string;-}--export interface FrameCommentsFile {- version: 1;- pass: FrameCommentsPass;- submitted_at: string;- comments: FrameCommentEntry[];-}--interface CommentableFrame {- index: number;- status: FrameStatus;- src?: string;- title?: string;-}--/** Which review the batch belongs to — the furthest status present on the board. */-export function passForFrames(frames: ReadonlyArray<{ status: FrameStatus }>): FrameCommentsPass {- if (frames.some((f) => f.status === "animated")) return "final";- if (frames.some((f) => f.status === "built")) return "sketch";- return "storyboard";-}--/** The non-empty drafts as file entries, in board order. */-export function draftEntries(- frames: readonly CommentableFrame[],- drafts: Readonly<Record<number, string>>,-): FrameCommentEntry[] {- const entries: FrameCommentEntry[] = [];- for (const frame of frames) {- const text = drafts[frame.index]?.trim();- if (!text) continue;- entries.push({ frame: frame.index, src: frame.src, title: frame.title, text });- }- return entries;-}--function isRecord(value: unknown): value is Record<string, unknown> {- return typeof value === "object" && value !== null;-}--function parseCommentEntry(item: unknown): FrameCommentEntry | null {- if (!isRecord(item)) return null;- if (typeof item.frame !== "number" || typeof item.text !== "string") return null;- return {- frame: item.frame,- src: typeof item.src === "string" ? item.src : undefined,- title: typeof item.title === "string" ? item.title : undefined,- text: item.text,- };-}--function parsePass(value: unknown): FrameCommentsPass {- return value === "sketch" || value === "final" ? value : "storyboard";-}--/** Tolerant read of an existing comments file — anything malformed counts as "no file". */-export function parseCommentsFile(raw: string): FrameCommentsFile | null {- if (!raw.trim()) return null;- let data: unknown;- try {- data = JSON.parse(raw);- } catch {- return null;- }- if (!isRecord(data) || !Array.isArray(data.comments)) return null;- const comments = data.comments- .map(parseCommentEntry)- .filter((entry): entry is FrameCommentEntry => entry !== null);- return {- version: 1,- pass: parsePass(data.pass),- submitted_at: typeof data.submitted_at === "string" ? data.submitted_at : "",- comments,- };-}--/**- * One file = the currently pending feedback. A resubmit before the agent- * consumed the previous batch keeps the pending entries for frames the new- * batch doesn't mention and overwrites the ones it does.- */-export function buildCommentsFile(- frames: readonly CommentableFrame[],- drafts: Readonly<Record<number, string>>,- previous: FrameCommentsFile | null,- submittedAt: string,-): FrameCommentsFile {- const fresh = draftEntries(frames, drafts);- const freshIndexes = new Set(fresh.map((entry) => entry.frame));- const kept = previous?.comments.filter((entry) => !freshIndexes.has(entry.frame)) ?? [];- const comments = [...kept, ...fresh].sort((a, b) => a.frame - b.frame);- return { version: 1, pass: passForFrames(frames), submitted_at: submittedAt, comments };-}diff --git a/packages/studio/src/components/storyboard/frameStatus.ts b/packages/studio/src/components/storyboard/frameStatus.tsdeleted file mode 100644index fff35bcc98..0000000000--- a/packages/studio/src/components/storyboard/frameStatus.ts+++ /dev/null@@ -1,36 +0,0 @@-import type { FrameStatus } from "@hyperframes/core/storyboard";--/**- * Single source of truth for how each frame lifecycle status is presented —- * label, tooltip, description, and the chip/dot color classes — so the tile- * chip and the legend dot can't drift apart.- */-export const FRAME_STATUS_META: Record<- FrameStatus,- { label: string; tooltip: string; description: string; chipClass: string; dotClass: string }-> = {- outline: {- label: "Outline",- tooltip: "Planned in text — no HTML frame built yet.",- description: "Planned in text. Story and intent exist; the visual isn’t built.",- chipClass: "bg-neutral-800 text-neutral-300",- dotClass: "bg-neutral-500",- },- built: {- label: "Built",- tooltip: "Static HTML frame built — not animated yet.",- description: "The HTML frame exists as a static key moment. Look is locked; motion isn’t.",- chipClass: "bg-sky-500/20 text-sky-300",- dotClass: "bg-sky-400",- },- animated: {- label: "Animated",- tooltip: "Keyframed and animated — plays in the final cut.",- description: "Keyframed into motion. This is the file stitched into the final video.",- chipClass: "bg-emerald-500/20 text-emerald-300",- dotClass: "bg-emerald-400",- },-};--/** The lifecycle order an agent advances each frame through. */-export const FRAME_STATUS_ORDER: FrameStatus[] = ["outline", "built", "animated"];diff --git a/packages/studio/src/components/storyboard/storyboardReviewStage.test.ts b/packages/studio/src/components/storyboard/storyboardReviewStage.test.tsdeleted file mode 100644index 18982f5eaf..0000000000--- a/packages/studio/src/components/storyboard/storyboardReviewStage.test.ts+++ /dev/null@@ -1,40 +0,0 @@-import { describe, expect, it } from "vitest";-import { deriveStoryboardHandoffStep, deriveStoryboardReviewStage } from "./storyboardReviewStage";--describe("deriveStoryboardReviewStage", () => {- it.each([- [[], "empty"],- [["outline", "outline"], "plan-review"],- [["outline", "built"], "sketch-in-progress"],- [["outline", "animated"], "sketch-in-progress"],- [["built", "built"], "sketch-review"],- [["built", "animated"], "animation-in-progress"],- [["animated", "animated"], "final-review"],- ] as const)("maps %j to %s", (statuses, expected) => {- expect(deriveStoryboardReviewStage(statuses.map((status) => ({ status }))).stage).toBe(- expected,- );- });-- it("returns counts for the visible progress summary", () => {- expect(- deriveStoryboardReviewStage([- { status: "outline" },- { status: "built" },- { status: "animated" },- { status: "animated" },- ]).counts,- ).toEqual({ outline: 1, built: 1, animated: 2 });- });-});--describe("storyboard review handoff", () => {- it.each([- [0, 0, 1],- [2, 0, 2],- [0, 3, 3],- [1, 3, 2],- ] as const)("maps %i drafts and %i pending comments to step %i", (drafts, pending, step) => {- expect(deriveStoryboardHandoffStep(drafts, pending)).toBe(step);- });-});diff --git a/packages/studio/src/components/storyboard/storyboardReviewStage.ts b/packages/studio/src/components/storyboard/storyboardReviewStage.tsdeleted file mode 100644index 6887d80122..0000000000--- a/packages/studio/src/components/storyboard/storyboardReviewStage.ts+++ /dev/null@@ -1,45 +0,0 @@-import type { FrameStatus } from "@hyperframes/core/storyboard";--export type StoryboardReviewStage =- | "empty"- | "plan-review"- | "sketch-in-progress"- | "sketch-review"- | "animation-in-progress"- | "final-review";--export interface StoryboardReviewSummary {- stage: StoryboardReviewStage;- counts: Record<FrameStatus, number>;- frameCount: number;-}--export type StoryboardHandoffStep = 1 | 2 | 3;--/** Current user action in the Studio → agent feedback handoff. */-export function deriveStoryboardHandoffStep(- draftCount: number,- pendingCount: number,-): StoryboardHandoffStep {- if (draftCount > 0) return 2;- if (pendingCount > 0) return 3;- return 1;-}--/** Derive the board-level review moment from agent-owned frame statuses. */-export function deriveStoryboardReviewStage(- frames: ReadonlyArray<{ status: FrameStatus }>,-): StoryboardReviewSummary {- const counts: Record<FrameStatus, number> = { outline: 0, built: 0, animated: 0 };- for (const frame of frames) counts[frame.status] += 1;-- let stage: StoryboardReviewStage;- if (frames.length === 0) stage = "empty";- else if (counts.outline === frames.length) stage = "plan-review";- else if (counts.outline > 0) stage = "sketch-in-progress";- else if (counts.built === frames.length) stage = "sketch-review";- else if (counts.built > 0) stage = "animation-in-progress";- else stage = "final-review";-- return { stage, counts, frameCount: frames.length };-}diff --git a/packages/studio/src/components/storyboard/useFrameComments.ts b/packages/studio/src/components/storyboard/useFrameComments.tsdeleted file mode 100644index 443bb618d3..0000000000--- a/packages/studio/src/components/storyboard/useFrameComments.ts+++ /dev/null@@ -1,98 +0,0 @@-import { useCallback, useEffect, useMemo, useState } from "react";-import { useFileManagerContext } from "../../contexts/FileManagerContext";-import type { StoryboardFrameView } from "../../hooks/useStoryboard";-import {- FRAME_COMMENTS_PATH,- buildCommentsFile,- parseCommentsFile,- type FrameCommentEntry,-} from "./frameComments";--export type CommentsSubmitState = "idle" | "saving";--export interface FrameCommentsValue {- /** Draft text per frame index — "" / absent means no comment. */- drafts: Record<number, string>;- setDraft: (index: number, text: string) => void;- /** How many frames currently carry a non-empty draft. */- draftCount: number;- submitState: CommentsSubmitState;- /** Most recent submit failure, shown next to the submit action. */- submitError: string | null;- /** Write the batch to `.hyperframes/frame-comments.json` and clear the drafts. */- submit: () => Promise<boolean>;- /**- * Comments already submitted but not yet consumed by the agent (the file- * still exists on disk). Refreshed on mount, after submit, and on window- * focus — the agent deletes the file once it has applied the feedback.- */- pending: FrameCommentEntry[] | null;- /** Re-read the comments file — callers hook this to board data refreshes. */- refreshPending: () => Promise<void>;-}--/** Per-frame comment drafts + the batch submit that writes the comments file. */-export function useFrameComments(frames: StoryboardFrameView[]): FrameCommentsValue {- const { writeProjectFile, readOptionalProjectFile } = useFileManagerContext();- const [drafts, setDrafts] = useState<Record<number, string>>({});- const [submitState, setSubmitState] = useState<CommentsSubmitState>("idle");- const [submitError, setSubmitError] = useState<string | null>(null);- const [pending, setPending] = useState<FrameCommentEntry[] | null>(null);-- const refreshPending = useCallback(async () => {- try {- const parsed = parseCommentsFile(await readOptionalProjectFile(FRAME_COMMENTS_PATH));- setPending(parsed && parsed.comments.length > 0 ? parsed.comments : null);- } catch {- // Transient read failure — keep whatever is currently shown.- }- }, [readOptionalProjectFile]);-- useEffect(() => {- void refreshPending();- const onFocus = () => void refreshPending();- window.addEventListener("focus", onFocus);- return () => window.removeEventListener("focus", onFocus);- }, [refreshPending]);-- const setDraft = useCallback((index: number, text: string) => {- setDrafts((prev) => ({ ...prev, [index]: text }));- }, []);-- const draftCount = useMemo(- () => Object.values(drafts).filter((text) => text.trim().length > 0).length,- [drafts],- );-- // One guarded async transaction owns loading, success, failure, and cleanup state.- // fallow-ignore-next-line complexity- const submit = useCallback(async () => {- if (draftCount === 0 || submitState === "saving") return false;- setSubmitState("saving");- setSubmitError(null);- try {- const previous = parseCommentsFile(await readOptionalProjectFile(FRAME_COMMENTS_PATH));- const file = buildCommentsFile(frames, drafts, previous, new Date().toISOString());- await writeProjectFile(FRAME_COMMENTS_PATH, `${JSON.stringify(file, null, 2)}\n`);- setDrafts({});- setPending(file.comments);- return true;- } catch (err: unknown) {- setSubmitError(err instanceof Error ? err.message : "Failed to submit comments");- return false;- } finally {- setSubmitState("idle");- }- }, [draftCount, submitState, frames, drafts, readOptionalProjectFile, writeProjectFile]);-- return {- drafts,- setDraft,- draftCount,- submitState,- submitError,- submit,- pending,- refreshPending,- };-}diff --git a/packages/studio/src/contexts/ViewModeContext.tsx b/packages/studio/src/contexts/ViewModeContext.tsxdeleted file mode 100644index adb7b13c2e..0000000000--- a/packages/studio/src/contexts/ViewModeContext.tsx+++ /dev/null@@ -1,142 +0,0 @@-import {- useCallback,- useContext,- useEffect,- useMemo,- useRef,- useState,- type ReactNode,-} from "react";-import { createStableContext } from "../utils/hmrStableContext";--/**- * Top-level Studio view mode.- *- * `timeline` is the existing NLE/preview stage. `storyboard` replaces that stage- * with the storyboard contact sheet. The mode is mirrored to the `?view=` query- * param so it survives reloads and — importantly — so an agent can deep-link the- * user straight into the storyboard by navigating the tab to `?view=storyboard`.- */-export type StudioViewMode = "timeline" | "storyboard";-export type ViewModeGuard = (nextMode: StudioViewMode) => boolean;--const VIEW_QUERY_PARAM = "view";--function readViewModeFromUrl(): StudioViewMode {- if (typeof window === "undefined") return "timeline";- return new URLSearchParams(window.location.search).get(VIEW_QUERY_PARAM) === "storyboard"- ? "storyboard"- : "timeline";-}--function writeViewModeToUrl(mode: StudioViewMode): void {- if (typeof window === "undefined") return;- const url = new URL(window.location.href);- if (mode === "storyboard") {- url.searchParams.set(VIEW_QUERY_PARAM, "storyboard");- } else {- url.searchParams.delete(VIEW_QUERY_PARAM);- }- window.history.replaceState(window.history.state, "", url);-}--interface HistoryLocation {- href: string;- state: unknown;-}--function readHistoryLocation(): HistoryLocation | null {- if (typeof window === "undefined") return null;- return {- href: window.location.href,- state: window.history.state,- };-}--export interface ViewModeValue {- viewMode: StudioViewMode;- /** Returns false when an active editor vetoes the transition. */- setViewMode: (mode: StudioViewMode) => boolean;- registerViewModeGuard: (guard: ViewModeGuard) => () => void;-}--/**- * Owns the view-mode state — initial read from `?view=`, toggling, popstate sync.- * Storyboard mode is always available; no flag gating.- */-export function useViewModeState(): ViewModeValue {- const [viewMode, setMode] = useState<StudioViewMode>(() => readViewModeFromUrl());- const guardsRef = useRef(new Set<ViewModeGuard>());- const acceptedLocationRef = useRef<HistoryLocation | null>(readHistoryLocation());-- const canSetViewMode = useCallback((mode: StudioViewMode) => {- for (const guard of guardsRef.current) {- if (!guard(mode)) return false;- }- return true;- }, []);-- // Reflect genuine browser back/forward between history entries with a different- // `?view=`. Note: our own writes use `replaceState` (below), which does NOT fire- // `popstate`, so this listener never sees them — `setViewMode` updates state directly.- // An agent deep-links by doing a full navigation to `?view=storyboard` (picked up by- // the mount-time read); a scripted `pushState`/`replaceState` to `?view=` would not be- // reflected here, by design.- useEffect(() => {- const onPopState = () => {- const mode = readViewModeFromUrl();- if (mode !== viewMode && !canSetViewMode(mode)) {- const acceptedLocation = acceptedLocationRef.current;- if (acceptedLocation) {- window.history.pushState(acceptedLocation.state, "", acceptedLocation.href);- }- return;- }- setMode(mode);- acceptedLocationRef.current = readHistoryLocation();- };- window.addEventListener("popstate", onPopState);- return () => window.removeEventListener("popstate", onPopState);- }, [canSetViewMode, viewMode]);-- const setViewMode = useCallback(- (mode: StudioViewMode) => {- if (!canSetViewMode(mode)) return false;- setMode(mode);- writeViewModeToUrl(mode);- acceptedLocationRef.current = readHistoryLocation();- return true;- },- [canSetViewMode],- );-- const registerViewModeGuard = useCallback((guard: ViewModeGuard) => {- guardsRef.current.add(guard);- return () => {- guardsRef.current.delete(guard);- };- }, []);-- return useMemo(- () => ({ viewMode, setViewMode, registerViewModeGuard }),- [viewMode, setViewMode, registerViewModeGuard],- );-}--const ViewModeContext = createStableContext<ViewModeValue | null>("ViewModeContext", null);--export function useViewMode(): ViewModeValue {- const ctx = useContext(ViewModeContext);- if (!ctx) throw new Error("useViewMode must be used within ViewModeProvider");- return ctx;-}--export function ViewModeProvider({- value,- children,-}: {- value: ViewModeValue;- children: ReactNode;-}) {- return <ViewModeContext value={value}>{children}</ViewModeContext>;-}diff --git a/packages/studio/src/hooks/useAppHotkeys.ts b/packages/studio/src/hooks/useAppHotkeys.tsindex 79101d9220..19d1295b7a 100644--- a/packages/studio/src/hooks/useAppHotkeys.ts+++ b/packages/studio/src/hooks/useAppHotkeys.ts@@ -189,7 +189,7 @@ export function useAppHotkeys({// earlier file edit (which would ALSO leave the caption change intact).const captionState = useCaptionStore.getState();// Only when the caption preview is actually visible: isEditMode stays- // true while the preview is hidden (storyboard view), and eating ⌘Z+ // true while the preview is hidden, and eating ⌘Z// there would pop invisible caption edits instead of file history.if (captionState.isEditMode && isCaptionPreviewVisible()) {const restored = direction === "undo" ? captionState.undo() : captionState.redo();diff --git a/packages/studio/src/hooks/useProjectSignaturePoll.test.tsx b/packages/studio/src/hooks/useProjectSignaturePoll.test.tsxdeleted file mode 100644index 61c417e607..0000000000--- a/packages/studio/src/hooks/useProjectSignaturePoll.test.tsx+++ /dev/null@@ -1,135 +0,0 @@-// @vitest-environment happy-dom--import React, { act } from "react";-import { createRoot, type Root } from "react-dom/client";-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";-import { useProjectSignaturePoll } from "./useProjectSignaturePoll";--Reflect.set(globalThis, "IS_REACT_ACT_ENVIRONMENT", true);--function HookHost({- signature,- onChange,-}: {- signature: string | undefined;- onChange: () => void;-}) {- useProjectSignaturePoll("demo", signature, onChange);- return null;-}--let root: Root | null = null;-let container: HTMLElement | null = null;--function mount(signature: string | undefined, onChange: () => void): void {- act(() => {- if (!root) {- container = document.createElement("div");- document.body.appendChild(container);- root = createRoot(container);- }- root.render(<HookHost signature={signature} onChange={onChange} />);- });-}--function unmount(): void {- if (root) {- act(() => root?.unmount());- root = null;- }- container?.remove();- container = null;-}--function mockSignatureResponse(signature: string): ReturnType<typeof vi.fn> {- const fetchMock = vi.fn(async () => ({ ok: true, json: async () => ({ signature }) }));- vi.stubGlobal("fetch", fetchMock);- return fetchMock;-}--describe("useProjectSignaturePoll", () => {- beforeEach(() => {- vi.useFakeTimers();- });-- afterEach(() => {- unmount();- vi.useRealTimers();- vi.unstubAllGlobals();- vi.restoreAllMocks();- });-- it("fires onChange when the polled signature moves past the loaded one", async () => {- const fetchMock = mockSignatureResponse("sig-b");- const onChange = vi.fn();- mount("sig-a", onChange);-- await vi.advanceTimersByTimeAsync(2000);- expect(fetchMock).toHaveBeenCalledWith("/api/projects/demo/signature");- expect(onChange).toHaveBeenCalledTimes(1);- });-- it("stays quiet while the polled signature matches", async () => {- mockSignatureResponse("sig-a");- const onChange = vi.fn();- mount("sig-a", onChange);-- await vi.advanceTimersByTimeAsync(6000);- expect(onChange).not.toHaveBeenCalled();- });-- it("does not poll before a baseline signature exists", async () => {- const fetchMock = mockSignatureResponse("sig-a");- const onChange = vi.fn();- mount(undefined, onChange);-- await vi.advanceTimersByTimeAsync(6000);- expect(fetchMock).not.toHaveBeenCalled();- expect(onChange).not.toHaveBeenCalled();- });-- it("re-arms against the caller's refreshed signature without re-mounting", async () => {- mockSignatureResponse("sig-b");- const onChange = vi.fn();- mount("sig-a", onChange);-- await vi.advanceTimersByTimeAsync(2000);- expect(onChange).toHaveBeenCalledTimes(1);-- // The caller refetched and now holds the polled signature — no more firing.- mount("sig-b", onChange);- await vi.advanceTimersByTimeAsync(6000);- expect(onChange).toHaveBeenCalledTimes(1);- });-- it("skips ticks while the tab is hidden and re-checks on visibility", async () => {- const fetchMock = mockSignatureResponse("sig-b");- const onChange = vi.fn();- let hidden = true;- vi.spyOn(document, "hidden", "get").mockImplementation(() => hidden);- mount("sig-a", onChange);-- await vi.advanceTimersByTimeAsync(6000);- expect(fetchMock).not.toHaveBeenCalled();-- hidden = false;- await act(async () => {- document.dispatchEvent(new Event("visibilitychange"));- await vi.advanceTimersByTimeAsync(0);- });- expect(onChange).toHaveBeenCalledTimes(1);- });-- it("stops polling after unmount", async () => {- mockSignatureResponse("sig-b");- const onChange = vi.fn();- mount("sig-a", onChange);-- await vi.advanceTimersByTimeAsync(2000);- expect(onChange).toHaveBeenCalledTimes(1);-- unmount();- await vi.advanceTimersByTimeAsync(10_000);- expect(onChange).toHaveBeenCalledTimes(1);- });-});diff --git a/packages/studio/src/hooks/useProjectSignaturePoll.ts b/packages/studio/src/hooks/useProjectSignaturePoll.tsdeleted file mode 100644index 5692252534..0000000000--- a/packages/studio/src/hooks/useProjectSignaturePoll.ts+++ /dev/null@@ -1,68 +0,0 @@-import { useEffect, useRef } from "react";-import { buildProjectApiPath } from "../utils/projectRouting";--const POLL_INTERVAL_MS = 2000;--/** One poll: the current signature, or null on any failure (skip this tick). */-async function fetchProjectSignature(projectId: string): Promise<string | null> {- try {- const res = await fetch(buildProjectApiPath(projectId, "/signature"));- if (!res.ok) return null;- const body = (await res.json()) as { signature?: string };- return typeof body.signature === "string" ? body.signature : null;- } catch {- return null;- }-}--/**- * Poll the project's content signature and fire `onChange` when it no longer- * matches `currentSignature` — the storyboard board uses this to refresh itself- * while an agent writes sketch frames to disk.- *- * The comparison baseline is the signature the caller's data was loaded with,- * so a refetch triggered by `onChange` naturally re-arms the poll with the new- * value. Ticks are skipped while the tab is hidden (a visibility flip re-checks- * immediately) and while a previous request is still in flight; request- * failures are ignored — polling degrades to today's manual-reload behavior.- */-export function useProjectSignaturePoll(- projectId: string | null,- currentSignature: string | undefined,- onChange: () => void,-): void {- const signatureRef = useRef(currentSignature);- const onChangeRef = useRef(onChange);- signatureRef.current = currentSignature;- onChangeRef.current = onChange;-- useEffect(() => {- if (!projectId) return;- let disposed = false;- let inFlight = false;-- const tick = async () => {- if (disposed || inFlight || document.hidden) return;- // No baseline yet (initial storyboard fetch still loading, or an older- // server without the signature field) — nothing to compare against.- if (signatureRef.current === undefined) return;- inFlight = true;- const latest = await fetchProjectSignature(projectId);- inFlight = false;- if (disposed || latest === null) return;- if (latest !== signatureRef.current) onChangeRef.current();- };-- const interval = window.setInterval(() => void tick(), POLL_INTERVAL_MS);- const onVisibilityChange = () => {- if (!document.hidden) void tick();- };- document.addEventListener("visibilitychange", onVisibilityChange);-- return () => {- disposed = true;- window.clearInterval(interval);- document.removeEventListener("visibilitychange", onVisibilityChange);- };- }, [projectId]);-}diff --git a/packages/studio/src/hooks/useStoryboard.ts b/packages/studio/src/hooks/useStoryboard.tsdeleted file mode 100644index debac2ead6..0000000000--- a/packages/studio/src/hooks/useStoryboard.ts+++ /dev/null@@ -1,99 +0,0 @@-import { useCallback, useEffect, useRef, useState } from "react";-import type {- StoryboardFrame,- StoryboardGlobals,- StoryboardWarning,-} from "@hyperframes/core/storyboard";-import { buildProjectApiPath } from "../utils/projectRouting";--/** A frame as returned by the API: parsed frame + disk-resolution info. */-export interface StoryboardFrameView extends StoryboardFrame {- /** Whether `src` resolves to an existing file inside the project. */- srcExists: boolean;-}--/** The companion narration script (SCRIPT.md), when present alongside the storyboard. */-export interface StoryboardScript {- exists: boolean;- path: string;- content: string;-}--/** Shape of `GET /api/projects/:id/storyboard`. */-export interface StoryboardResponse {- exists: boolean;- path: string;- globals: StoryboardGlobals;- frames: StoryboardFrameView[];- warnings: StoryboardWarning[];- script?: StoryboardScript;- /** Project content signature this payload was derived from (poster cache-bust + change poll). */- signature?: string;-}--export interface UseStoryboardResult {- data: StoryboardResponse | null;- loading: boolean;- error: string | null;- reload: () => void;-}--/**- * Load the parsed storyboard manifest for a project. Markdown stays canonical on- * disk; this fetches the server-derived JSON the storyboard view renders.- *- * `reload()` refetches in place: the blocking spinner only shows on first load- * and project switches, so background refreshes (file-change polling, post-save- * reloads) swap data without flashing the board.- */-export function useStoryboard(projectId: string | null): UseStoryboardResult {- const [data, setData] = useState<StoryboardResponse | null>(null);- const [loading, setLoading] = useState(true);- const [error, setError] = useState<string | null>(null);- const [reloadKey, setReloadKey] = useState(0);- const hasDataRef = useRef(false);- const lastProjectRef = useRef<string | null>(null);-- const reload = useCallback(() => setReloadKey((k) => k + 1), []);-- useEffect(() => {- if (!projectId) return;- let cancelled = false;- if (lastProjectRef.current !== projectId) {- lastProjectRef.current = projectId;- hasDataRef.current = false;- setData(null);- }- if (!hasDataRef.current) setLoading(true);- setError(null);-- // Route through buildProjectApiPath so the (URL-derived) projectId is encoded- // into the path rather than interpolated raw (CodeQL js/client-side-request-forgery).- fetch(buildProjectApiPath(projectId, "/storyboard"))- .then((res) => {- if (!res.ok) throw new Error(`storyboard request failed: ${res.status}`);- return res.json() as Promise<StoryboardResponse>;- })- .then((json) => {- if (cancelled) return;- hasDataRef.current = true;- setData(json);- })- .catch((err: unknown) => {- if (cancelled) return;- // A failed background refresh keeps the last good board on screen;- // the blocking error state is only for loads with nothing to show.- if (hasDataRef.current) return;- setError(err instanceof Error ? err.message : "failed to load storyboard");- })- .finally(() => {- if (!cancelled) setLoading(false);- });-- return () => {- cancelled = true;- };- }, [projectId, reloadKey]);-- return { data, loading, error, reload };-}diff --git a/packages/studio/src/player/components/CompositionThumbnail.test.ts b/packages/studio/src/player/components/CompositionThumbnail.test.tsindex d6240a0e7a..03673b2d8a 100644--- a/packages/studio/src/player/components/CompositionThumbnail.test.ts+++ b/packages/studio/src/player/components/CompositionThumbnail.test.ts@@ -87,9 +87,6 @@ describe("buildCompositionThumbnailUrl", () => {expect(buildCompositionThumbnailUrl(base)).not.toContain("output=");expect(buildCompositionThumbnailUrl({ ...base, output: "source" })).toContain("output=source");- expect(buildCompositionThumbnailUrl({ ...base, output: "storyboard" })).toContain(- "output=storyboard",- );});it("includes the persisted content revision in the cache identity", () => {diff --git a/packages/studio/src/player/components/CompositionThumbnail.tsx b/packages/studio/src/player/components/CompositionThumbnail.tsxindex ddb571dcd2..eef9f37324 100644--- a/packages/studio/src/player/components/CompositionThumbnail.tsx+++ b/packages/studio/src/player/components/CompositionThumbnail.tsx@@ -44,10 +44,9 @@ export function buildCompositionThumbnailUrl({/*** Capture density. Omitted, the route bounds the image to its preview cap —* right for the timeline, where thumbnails are small and numerous and their- * decoded bytes are budgeted. `"storyboard"` caps the longest side at a- * high-density review size; `"source"` uses the composition's own dimensions.+ * decoded bytes are budgeted. `"source"` uses the composition's own dimensions.*/- output?: "source" | "storyboard";+ output?: "source";contentRevision?: number;}): string {const thumbnailBase = previewUrldiff --git a/packages/studio/tsup.config.ts b/packages/studio/tsup.config.tsindex c889ed4331..85aca4eefa 100644--- a/packages/studio/tsup.config.ts+++ b/packages/studio/tsup.config.ts@@ -28,8 +28,6 @@ export default defineConfig({"@hyperframes/sdk","@phosphor-icons/react","bpm-detective",- "dompurify",- "marked","mediabunny","react","react-dom",diff --git a/scripts/check-no-main-deletions.mjs b/scripts/check-no-main-deletions.mjsindex 801645fdd9..f6de8d0b50 100644--- a/scripts/check-no-main-deletions.mjs+++ b/scripts/check-no-main-deletions.mjs@@ -36,6 +36,9 @@ const BASE_FLAG = "--base";* Entries are for deletions that are NOT renames — git already pairs those on* its own. Remove an entry once its deletion has landed on the base.*/+const STORYBOARD_VIEW_REASON =+ "owner-directed removal of the Studio storyboard view; its only readers were deleted with it";+export const ALLOWED_DELETIONS = new Map([["packages/studio/src/components/StudioGlobalDragOverlay.tsx",@@ -177,6 +180,44 @@ export const ALLOWED_DELETIONS = new Map(["packages/studio/src/player/hooks/useExpandedTimelineElements.test.ts","tests for the removed child-row expansion hook",],+ ...[+ "docs/studio/storyboard.mdx",+ "packages/studio-server/src/routes/storyboard.test.ts",+ "packages/studio-server/src/routes/storyboard.ts",+ "packages/studio/fixtures/storyboard-sample/README.md",+ "packages/studio/fixtures/storyboard-sample/SCRIPT.md",+ "packages/studio/fixtures/storyboard-sample/STORYBOARD.md",+ "packages/studio/fixtures/storyboard-sample/compositions/frames/01-hook.html",+ "packages/studio/fixtures/storyboard-sample/compositions/frames/02-problem.html",+ "packages/studio/fixtures/storyboard-sample/compositions/frames/03-feature.html",+ "packages/studio/fixtures/storyboard-sample/compositions/frames/04-proof.html",+ "packages/studio/fixtures/storyboard-sample/index.html",+ "packages/studio/src/components/storyboard/AgentChatMessageButton.test.tsx",+ "packages/studio/src/components/storyboard/AgentChatMessageButton.tsx",+ "packages/studio/src/components/storyboard/FramePoster.test.tsx",+ "packages/studio/src/components/storyboard/FramePoster.tsx",+ "packages/studio/src/components/storyboard/StoryboardDirection.tsx",+ "packages/studio/src/components/storyboard/StoryboardFrameFocus.tsx",+ "packages/studio/src/components/storyboard/StoryboardFrameTile.tsx",+ "packages/studio/src/components/storyboard/StoryboardGrid.tsx",+ "packages/studio/src/components/storyboard/StoryboardLoaded.tsx",+ "packages/studio/src/components/storyboard/StoryboardReviewGuide.tsx",+ "packages/studio/src/components/storyboard/StoryboardScriptPanel.tsx",+ "packages/studio/src/components/storyboard/StoryboardSourceEditor.tsx",+ "packages/studio/src/components/storyboard/StoryboardStatusLegend.tsx",+ "packages/studio/src/components/storyboard/StoryboardView.tsx",+ "packages/studio/src/components/storyboard/StoryboardViewModeGuard.test.tsx",+ "packages/studio/src/components/storyboard/frameComments.test.ts",+ "packages/studio/src/components/storyboard/frameComments.ts",+ "packages/studio/src/components/storyboard/frameStatus.ts",+ "packages/studio/src/components/storyboard/storyboardReviewStage.test.ts",+ "packages/studio/src/components/storyboard/storyboardReviewStage.ts",+ "packages/studio/src/components/storyboard/useFrameComments.ts",+ "packages/studio/src/contexts/ViewModeContext.tsx",+ "packages/studio/src/hooks/useProjectSignaturePoll.test.tsx",+ "packages/studio/src/hooks/useProjectSignaturePoll.ts",+ "packages/studio/src/hooks/useStoryboard.ts",+ ].map((path) => [path, STORYBOARD_VIEW_REASON]),]);export function parseBase(argv, fallback = "origin/main") {diff --git a/scripts/studio-runtime-smoke.mjs b/scripts/studio-runtime-smoke.mjsindex f1bb14d0fd..a30edda022 100644--- a/scripts/studio-runtime-smoke.mjs+++ b/scripts/studio-runtime-smoke.mjs@@ -41,17 +41,6 @@ const GET_RESPONSES = new Map([[`${PROJECT_PATH}/thumbnail/index.html`, text(SMOKE_THUMBNAIL_SVG, "image/svg+xml")],[`${PROJECT_PATH}/renders`, json({ renders: [] })],[`${PROJECT_PATH}/lint`, json({ findings: [] })],- [- `${PROJECT_PATH}/storyboard`,- json({- exists: false,- path: "STORYBOARD.md",- globals: { extra: {} },- frames: [],- warnings: [],- script: { exists: false, path: "SCRIPT.md", content: "" },- }),- ],[`${PROJECT_PATH}/selection`, json({ selection: null, updatedAt: null })],["/api/registry/blocks", json([])],["/api/fonts", json({ fonts: [] })],diff --git a/skills-manifest.json b/skills-manifest.jsonindex 05a45cd0c8..684952dc70 100644--- a/skills-manifest.json+++ b/skills-manifest.json@@ -6,7 +6,7 @@"files": 142},"faceless-explainer": {- "hash": "7ff529b85f588ffc",+ "hash": "b5a85c762928ba92","files": 24},"figma": {@@ -18,7 +18,7 @@"files": 4},"hyperframes": {- "hash": "ffacb7af2a96d788",+ "hash": "30397aa94f47ecc8","files": 26},"hyperframes-animation": {@@ -30,7 +30,7 @@"files": 7},"hyperframes-cli": {- "hash": "666010a0b0d30da7",+ "hash": "656d872004d9e2e8","files": 11},"hyperframes-core": {@@ -66,11 +66,11 @@"files": 169},"pr-to-video": {- "hash": "bbb3db51176b7e44",+ "hash": "4b550901e129c709","files": 30},"product-launch-video": {- "hash": "d87f7ae140e88403",+ "hash": "3ab59cd235681ee9","files": 30},"remotion-to-hyperframes": {diff --git a/skills/faceless-explainer/SKILL.md b/skills/faceless-explainer/SKILL.mdindex aac17fa0c3..55365bf37c 100644--- a/skills/faceless-explainer/SKILL.md+++ b/skills/faceless-explainer/SKILL.md@@ -87,7 +87,7 @@ Read `../hyperframes-creative/references/story-spine.md` (hook language, value-bUse `story-design.md` for the explainer structure (concept / how-to / listicle / story), hook strategy, clarity techniques, emotional beats, the type-enum mapping, and `VO_MODE`. The video's sequence comes from **narrative design, not the input text's paragraph order** — reorder, merge, omit, compress. As a **soft guide**, consult the role→blueprint menu in `../hyperframes-animation/blueprints-index.md`: for each beat, write the voiceover in the shape its candidate blueprint implies and tag that candidate `blueprint:` id when one fits. Teaching truth still decides which beats exist — never force a beat to fit a blueprint, and never invent a beat just because a proven shape is available. Faceless visuals are invented downstream, so frames do **not** carry an asset inventory: leave `asset_candidates` empty unless the user supplied a real `public/<basename>` image. Use the exact required fields from the storyboard and script references.-After drafting, run the review loop's plan pass — `../hyperframes/references/review-loop.md` § 1: open the board (don't ask whether to), present the plan as a proposal, and ask the two questions — approve or change, and **sketches first** (recommended) or skip. Feedback loops through chat or the board's comments file until approved. This is a **checkpoint gate** (brief contract § 1): in autonomous mode there is no board and nothing to ask — post the same summary as a heads-up and proceed; sketches collapse into the build, and the one preview question comes at Step 6.+After drafting, run the review loop's plan pass — `../hyperframes/references/review-loop.md` § 1: present the plan as a proposal, and ask the two questions — approve or change, and **sketches first** (recommended) or skip. Feedback loops through chat or the board's comments file until approved. This is a **checkpoint gate** (brief contract § 1): in autonomous mode there is no board and nothing to ask — post the same summary as a heads-up and proceed; sketches collapse into the build, and the one preview question comes at Step 6.**Gate:** `STORYBOARD.md` exists, every frame has the required narrative fields, `SCRIPT.md` exists when narration is needed, and the user approved the frame-by-frame plan (autonomous: the summary was posted as a heads-up).diff --git a/skills/faceless-explainer/scripts/assemble-index.mjs b/skills/faceless-explainer/scripts/assemble-index.mjsindex 93cefa23a6..85a0221096 100644--- a/skills/faceless-explainer/scripts/assemble-index.mjs+++ b/skills/faceless-explainer/scripts/assemble-index.mjs@@ -6,8 +6,7 @@//// index.html is a *standalone* composition (root <div id="root"> directly in// <body>, no <template> wrapper — template is for sub-comps). Structure is-// modeled on the canonical fixture packages/studio/fixtures/storyboard-sample/-// index.html and the authoritative head/audio template in+// modeled on the canonical fixture project index.html and the authoritative head/audio template in// packages/core/docs/quickstart-template.html. Frame mount order = STORYBOARD// document order. Transitions are NOT written here — the transitions injector// mutates this file afterward (data-start/duration/track-index + GSAP).diff --git a/skills/hyperframes-cli/SKILL.md b/skills/hyperframes-cli/SKILL.mdindex e02b6c8bd1..5661c54cdb 100644--- a/skills/hyperframes-cli/SKILL.md+++ b/skills/hyperframes-cli/SKILL.md@@ -57,10 +57,9 @@ ffprobe -v error -show_format -show_streams out.mp4Do not confuse these states:-| Surface | When it may open | Purpose |-| ------------------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------- |-| Storyboard board | Before composition checks, only when `storyboard: yes` | Review plan cards and wireframe sketches. Open `?view=storyboard#project/<name>`. |-| Final composition preview | After `check` passes | Review the assembled timeline before render. Open `#project/<name>`. |+| Surface | When it may open | Purpose |+| ------------------------- | -------------------- | -------------------------------------------------------------------- |+| Final composition preview | After `check` passes | Review the assembled timeline before render. Open `#project/<name>`. |The early board is not approval of the final video. Rendering always requires the final approval defined by `hyperframes/references/review-loop.md`.diff --git a/skills/hyperframes-cli/references/preview-render.md b/skills/hyperframes-cli/references/preview-render.mdindex e546ebc949..111a864409 100644--- a/skills/hyperframes-cli/references/preview-render.md+++ b/skills/hyperframes-cli/references/preview-render.md@@ -23,8 +23,6 @@ http://localhost:<port>/#project/<project-name>Use the actual port and project directory name; treat `index.html` as source-code context, not the preview surface. For example, after `npx hyperframes preview --background --port 3017` in `codex-openai-video`, report `http://localhost:3017/#project/codex-openai-video`.-To land the user on the **Storyboard view** instead of the timeline, put `?view=storyboard` ahead of the hash: `http://localhost:<port>/?view=storyboard#project/<project-name>`. Hand this URL whenever the storyboard is the thing to review and nothing is assembled yet — before `index.html` exists, the timeline stage has nothing to show, so the bare project URL opens on an empty player.-Two ways a handed URL turns out dead — check both before handing it back: the URL is missing its `#project/<project-name>` hash (Studio loads but has no project to open), or the server is not actually running. Bare `preview` automatically creates a managed persistent session in a non-TTY agent shell; `--background` remains the clearest explicit form. Verify the printed URL returns HTTP 200, keep it alive for the whole review, and stop it explicitly with `npx hyperframes preview --stop` afterward. Use the printed URL as-is: HyperFrames URL-encodes project names that contain route metacharacters.### Agent context from Studio selectiondiff --git a/skills/hyperframes/references/review-loop.md b/skills/hyperframes/references/review-loop.mdindex 8a9ecc3d67..5ba70fd89c 100644--- a/skills/hyperframes/references/review-loop.md+++ b/skills/hyperframes/references/review-loop.md@@ -4,11 +4,11 @@ How a `storyboard: yes` run earns fidelity one pass at a time: the plan is revieThis is the shared process for any workflow that plans on a storyboard. The contracts it leans on live next door: interaction mode, gate types, and the comments channel in `brief-contract.md`; the `STORYBOARD.md` format, the `outline → built → animated` statuses, and the comments sidecar in `storyboard-format.md`. A workflow's SKILL.md says **when** its steps hit each pass and supplies its **sketch stand-ins** (what the plain blocks represent); how the loop runs is defined here, once. The stage mechanics between the passes — audio, frames, assembly, transitions, captions, verify — live in `production-loop.md`; this file owns only the user-facing pauses.-## § 1 — The plan, on a live board+## § 1 — The plan, in chat-Open the **storyboard board** before presenting the plan: run `npx hyperframes preview --background` from the project directory, confirm it is serving, and open `http://localhost:<port>/?view=storyboard#project/<project-name>`. This is an early planning surface, not the final composition preview; it may open before composition checks. The plan appears as frame cards and refreshes as work lands.+Present the plan in chat and keep it in `STORYBOARD.md`, which is the source of truth as work lands.-Present the plan as a proposal (shape: `hyperframes-creative/references/story-spine.md` § 3): open by echoing **"This video tells [audience] that [message]"**, then the frame table — one row per frame: frame · beat (type, duration) · on screen · why (its `narrativeRole`, traced to the message). Hand the board URL with it, noting feedback lands in both places — comment on the board or reply here, one revision loop — and that a board submit still needs one reply here (anything) to get picked up.+Present the plan as a proposal (shape: `hyperframes-creative/references/story-spine.md` § 3): open by echoing **"This video tells [audience] that [message]"**, then the frame table — one row per frame: frame · beat (type, duration) · on screen · why (its `narrativeRole`, traced to the message). Feedback arrives as a reply here, one revision loop.In the same message ask two things: **(a)** approve or request changes, and **(b)** **sketches first** (recommended — a quick wireframe look check right after this approval) or skip sketches and build in one go. Iterate until approved — feedback arrives in chat or as the comments file (`brief-contract.md` § 1, the comments channel): revise exactly the frames it names, clear the file, re-present.diff --git a/skills/hyperframes/references/storyboard-format.md b/skills/hyperframes/references/storyboard-format.mdindex 8fe8102ff6..b680e611bc 100644--- a/skills/hyperframes/references/storyboard-format.md+++ b/skills/hyperframes/references/storyboard-format.md@@ -2,7 +2,7 @@Defines the storyboard's **base data format** only: the `STORYBOARD.md` file shape and the `StoryboardManifest` it parses into. How a workflow _generates_ a storyboard lives in that workflow; the optional narration/TTS file (`SCRIPT.md`) is a separate concern owned by the TTS step, not here.-A storyboard is the **plan layer** for a video — an ordered set of **frames** (key moments) in one markdown file. HyperFrames Studio renders it as a contact sheet (the Storyboard view, available by default in every Studio session). Parser: `@hyperframes/core/storyboard` → `StoryboardManifest`; read API: `GET /api/projects/<id>/storyboard`.+A storyboard is the **plan layer** for a video — an ordered set of **frames** (key moments) in one markdown file. Parser: `@hyperframes/core/storyboard` → `StoryboardManifest`.## Frontmatter (global direction)diff --git a/skills/pr-to-video/SKILL.md b/skills/pr-to-video/SKILL.mdindex 2edf6cf3aa..a3b85536a5 100644--- a/skills/pr-to-video/SKILL.md+++ b/skills/pr-to-video/SKILL.md@@ -115,7 +115,7 @@ Read `../hyperframes-creative/references/story-spine.md` (hook language, value-bUse `story-design.md` for the PR archetype (changelog / feature-reveal / fix-explainer / refactor-walkthrough), the PR-native frame types, hook, persuasion, beats, the per-frame word budget, and the credits close. The sequence comes from **narrative design, not the diff's file order** — explain the change, don't read the diff aloud. As a **soft guide**, consult the role→blueprint menu in `../hyperframes-animation/blueprints-index.md`: for each beat, write the voiceover in the shape its candidate blueprint implies and tag that candidate `blueprint:` id when one fits (story truth still decides which beats exist — never force a beat to fit a shape). Feature 2–4 real diff hunks (from `capture/diff.patch`), each a small legible snippet; name the `code-*` block each wants in the frame's `scene`. Frames carry no `asset_candidates` except the `credits` close (1–6 `assets/<login>.png` avatars). Use the exact required fields from the storyboard and script references.-After drafting, run the review loop's plan pass — `../hyperframes/references/review-loop.md` § 1: open the board (don't ask whether to — run the preview from `PROJECT_DIR` in the background), present the plan as a proposal, and ask the two questions — approve or change, and **sketches first** (recommended) or skip. Feedback loops through chat or the board's comments file until approved. This is a **checkpoint gate** (brief contract § 1): in autonomous mode there is no board and nothing to ask — post the same summary as a heads-up and proceed; sketches collapse into the build, and the one preview question comes at Step 6.+After drafting, run the review loop's plan pass — `../hyperframes/references/review-loop.md` § 1: present the plan as a proposal, and ask the two questions — approve or change, and **sketches first** (recommended) or skip. Feedback loops through chat or the board's comments file until approved. This is a **checkpoint gate** (brief contract § 1): in autonomous mode there is no board and nothing to ask — post the same summary as a heads-up and proceed; sketches collapse into the build, and the one preview question comes at Step 6.**Gate:** `STORYBOARD.md` exists, every frame has the required narrative fields, `SCRIPT.md` exists when narration is needed, and the user approved the plan (autonomous: the summary was posted as a heads-up).diff --git a/skills/pr-to-video/scripts/assemble-index.mjs b/skills/pr-to-video/scripts/assemble-index.mjsindex 24b81743af..9594a3cd49 100644--- a/skills/pr-to-video/scripts/assemble-index.mjs+++ b/skills/pr-to-video/scripts/assemble-index.mjs@@ -6,8 +6,7 @@//// index.html is a *standalone* composition (root <div id="root"> directly in// <body>, no <template> wrapper — template is for sub-comps). Structure is-// modeled on the canonical fixture packages/studio/fixtures/storyboard-sample/-// index.html and the authoritative head/audio template in+// modeled on the canonical fixture project index.html and the authoritative head/audio template in// packages/core/docs/quickstart-template.html. Frame mount order = STORYBOARD// document order. Transitions are NOT written here — the transitions injector// mutates this file afterward (data-start/duration/track-index + GSAP).diff --git a/skills/product-launch-video/SKILL.md b/skills/product-launch-video/SKILL.mdindex 60f2eeddad..308b7cf2ec 100644--- a/skills/product-launch-video/SKILL.md+++ b/skills/product-launch-video/SKILL.md@@ -110,7 +110,7 @@ Read `../hyperframes-creative/references/story-spine.md` (hook language, value-bUse `story-design.md` for story blueprint, hook, persuasion logic, beats, `VO_MODE`, and asset choices. As a **soft guide**, consult the role→blueprint menu in `../hyperframes-animation/blueprints-index.md`: for each beat, note a candidate blueprint id when one fits. Story truth still decides which beats exist — never force a beat to fit a blueprint, and never invent a beat just because a proven shape is available. Choose each visual frame's `asset_candidates` from `capture/extracted/asset-descriptions.md` (the canonical inventory) — don't browse raw `capture/assets/`. Do not ask the user to pick assets unless that inventory is missing or unusable. Use the exact required fields from the storyboard and script references.-After drafting, run the review loop's plan pass — `../hyperframes/references/review-loop.md` § 1: open the board (don't ask whether to), present the plan as a proposal, and ask the two questions — approve or change, and **sketches first** (recommended) or skip. Feedback loops through chat or the board's comments file until approved. This is a **checkpoint gate** (brief contract § 1): in autonomous mode there is no board and nothing to ask — post the same summary as a heads-up and proceed; sketches collapse into the build, and the one preview question comes at Step 6.+After drafting, run the review loop's plan pass — `../hyperframes/references/review-loop.md` § 1: present the plan as a proposal, and ask the two questions — approve or change, and **sketches first** (recommended) or skip. Feedback loops through chat or the board's comments file until approved. This is a **checkpoint gate** (brief contract § 1): in autonomous mode there is no board and nothing to ask — post the same summary as a heads-up and proceed; sketches collapse into the build, and the one preview question comes at Step 6.**Gate:** `STORYBOARD.md` exists, every visual frame has `asset_candidates`, `SCRIPT.md` exists when narration is needed, and the user approved the frame-by-frame plan (autonomous: the summary was posted as a heads-up).diff --git a/skills/product-launch-video/scripts/assemble-index.mjs b/skills/product-launch-video/scripts/assemble-index.mjsindex d4bceee21b..adb1be7665 100644--- a/skills/product-launch-video/scripts/assemble-index.mjs+++ b/skills/product-launch-video/scripts/assemble-index.mjs@@ -6,8 +6,7 @@//// index.html is a *standalone* composition (root <div id="root"> directly in// <body>, no <template> wrapper — template is for sub-comps). Structure is-// modeled on the canonical fixture packages/studio/fixtures/storyboard-sample/-// index.html and the authoritative head/audio template in+// modeled on the canonical fixture project index.html and the authoritative head/audio template in// packages/core/docs/quickstart-template.html. Frame mount order = STORYBOARD// document order. Transitions are NOT written here — the transitions injector// mutates this file afterward (data-start/duration/track-index + GSAP).