mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
* feat(studio): show the agent's storyboard in a Storyboard tab beside the preview The board an agent writes per the storyboard recipe (boards/storyboard.html, or a root storyboard.html) now shows in Studio the way HyperFrames Desktop shows it: a Preview | Storyboard strip over the preview panel, only while the project has a board. Studio reads the page's class="frame" boxes into a board of stills, with acts, titles, times and words, and one frame at a time with arrow keys. A page with no frames shows as written in a script-less iframe. A board written while Studio is open brings its tab to the front, as Desktop does at the agent's stop. A rewrite of the page, a still beside it or STORYBOARD.md reloads it in place, and a dot marks a rewrite seen from the preview. "Show in preview" goes back to the film at the frame's start. Notes, drawings and the go belong to Desktop's agent, so the board's bar carries the desktop-app button. Its funnel events now say which button was pressed (placement: header or storyboard). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * refactor(studio): split the storyboard view and its frame reader into smaller parts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * docs(skills): the agent's storyboard stop points at the Storyboard tab, not the file With the board shown beside the preview in Studio as in Desktop, the recipe's stop and style-sampling's stop 1 tell the person to look in the Storyboard tab, and to start a preview and give its link when none is running, instead of handing over boards/storyboard.html to open from disk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * fix(studio): the storyboard listens on Studio's own file-change channel, and its notes are trimmed The board opened its own /api/events stream, which the Vite dev server behind the runtime smoke does not serve. It now subscribes through subscribeFileChanges, the one channel picker the external-change coordinator already uses (test adapter, Vite HMR, then SSE), so dev and built Studio deliver the same changes to both. The new files' comments are cut to the package's share, and the recipe's Storyboard-tab line moves to the paragraph that names the board, leaving the stop step as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * fix(studio): the board hears file changes through the coordinator, not a second subscription The external-change coordinator stays the one subscriber to the file-change transport (HMR in dev, SSE when built), as externalFileChangeOwnership asserts. It announces each decoded change through fileChangeFanout, and the storyboard listens there. Mounting EditorShell alone, as its tests do, no longer opens an EventSource, and the coordinator file stays under the line cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * feat(studio): the storyboard's Open in desktop app asks the app to open on the board, and its card says why - The storyboard bar's button posts `doc: "storyboard"` with its page id. The preview server passes only that value on, and `openInDesktop` writes it into `.hyperframes/desktop-cta.json` beside the page id, so the app can open the project on its Storyboard tab with Build in sight (hyperframes-internal reads it). - The guide card opened from the storyboard says "Approve this storyboard in the desktop app" and "Comment on a frame, draw on it, then press Build", and its last step says the app opens on this storyboard. The header's card is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * feat(studio): approve the storyboard in Studio; comments on frames stay in the desktop app A Studio user without the desktop app had no way to approve the board from the tab, and the bar said approval was in the desktop app, so the tab read as a dead end. Studio talks to the person's own agent through their chat, so the bar's Approve copies "The storyboard is approved. Build the video from it." for them to paste to it, and says so in a toast (or spells the words out when the clipboard refuses). Commenting and drawing on frames stay in the desktop app. The storyboard recipe tells the agent those pasted words are the person's go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * fix(studio): the storyboard's desktop card offers commenting, since approving now happens in Studio Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * fix(studio): hand-off intent before dispatch, steady film under the board, stills outside the board folder - openInDesktop writes desktop-cta.json before sending the folder, so a running app reads the storyboard ask on arrival; a plain or header open drops an earlier storyboard ask; a failed open puts the earlier record back. - PreviewStage keeps the film at one place in the tree with or without a board, so a board appearing never remounts it; the automatic switch goes through the same pause as a click, and a play while the board is up is paused. - The board reloads when a still it draws changes, including a root board's stills/ and a boards/ page's ../assets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * chore(cli): fit the Storyboard tab in the CLI's size budget; reword a record helper's doc The CLI tarball carries Studio's build, which now holds the Storyboard tab; merged with main it measures 7,982,002 bytes packed, 7 bytes past the 1% tolerance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy * fix(studio): hold the player while the storyboard covers the film A pause after the fact let J's reverse loop schedule its next frame, so the hidden film kept seeking. The stage now takes the player's own hold while the board is up (and only when no one else holds it), so J, Space and playback requests are refused before they start; Preview releases it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HebQXPiLcYKQfvPWB3Fgxy --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
310 lines
9.8 KiB
TypeScript
310 lines
9.8 KiB
TypeScript
import { ArrowSquareOut, Check, Copy } from "@phosphor-icons/react";
|
|
import { useEffect, useState, type ReactNode } from "react";
|
|
import { copyTextToClipboard } from "../utils/clipboard";
|
|
import { FrameyGlyph, type FrameyMood } from "./FrameyGlyph";
|
|
import { Button, cn } from "./ui";
|
|
|
|
// The desktop-app guide card under OpenInDesktopButton: Framey and three steps (download, install, open), all drawn
|
|
// from one `Progress`.
|
|
|
|
export type DesktopCtaPlacement = "header" | "storyboard";
|
|
|
|
export type DesktopRoute = {
|
|
handoff: boolean;
|
|
downloadUrl: string | null;
|
|
context: {
|
|
os: string;
|
|
app_installed: boolean;
|
|
download_available: boolean;
|
|
placement: DesktopCtaPlacement;
|
|
};
|
|
};
|
|
|
|
/** The OS for the download, and what "this …" calls the machine. */
|
|
const platformName = (os: string): string =>
|
|
os === "darwin" ? "Mac" : os === "linux" ? "Linux" : os === "win32" ? "Windows" : "your computer";
|
|
const deviceName = (os: string): string => (os === "darwin" ? "Mac" : "computer");
|
|
|
|
const NOTE = "mt-0.5 text-step-12 text-text-2 text-pretty";
|
|
|
|
/** Re-keys on `value`, so text that changes settles in rather than snapping. */
|
|
export function Swap({ value, children }: { value: string; children: ReactNode }) {
|
|
return (
|
|
<span key={value} className="hf-guide-swap inline-block">
|
|
{children}
|
|
</span>
|
|
);
|
|
}
|
|
|
|
type StepState = "todo" | "now" | "done" | "bad";
|
|
const TODO: StepState = "todo";
|
|
const NOW: StepState = "now";
|
|
const DONE: StepState = "done";
|
|
const BAD: StepState = "bad";
|
|
|
|
function Step({
|
|
n,
|
|
state,
|
|
title,
|
|
children,
|
|
}: {
|
|
n: number;
|
|
state: StepState;
|
|
title: string;
|
|
children: ReactNode;
|
|
}) {
|
|
return (
|
|
<li
|
|
className="grid grid-cols-[22px_minmax(0,1fr)] gap-2.5 border-border py-2 not-first:border-t"
|
|
data-step={n}
|
|
data-state={state}
|
|
>
|
|
<span
|
|
className={cn(
|
|
"grid size-[22px] place-items-center rounded-full text-step-11 font-bold tabular-nums",
|
|
state === "now" && "bg-accent text-on-accent shadow-[0_0_0_3px_var(--color-on)]",
|
|
state === "done" && "bg-on text-accent-ink",
|
|
state === "bad" && "bg-danger/15 text-danger-ink",
|
|
state === "todo" && "bg-hover text-text-2",
|
|
)}
|
|
>
|
|
{state === "done" ? <Check size={12} weight="bold" className="hf-guide-tick" /> : n}
|
|
</span>
|
|
<div className="min-w-0">
|
|
<b
|
|
title={title}
|
|
className={cn(
|
|
"block truncate text-step-13 font-semibold",
|
|
state === "todo" ? "text-text-muted" : "text-text-0",
|
|
)}
|
|
>
|
|
{title}
|
|
</b>
|
|
{children}
|
|
</div>
|
|
</li>
|
|
);
|
|
}
|
|
|
|
function Spinner() {
|
|
return (
|
|
<span
|
|
aria-hidden="true"
|
|
className="size-3 shrink-0 animate-spin rounded-full border-2 border-on-hover border-t-accent motion-reduce:animate-none"
|
|
/>
|
|
);
|
|
}
|
|
|
|
/** The project folder, with a copy control that confirms for a moment. */
|
|
function FolderPath({ dir }: { dir: string }) {
|
|
const [copied, setCopied] = useState(false);
|
|
useEffect(() => {
|
|
if (!copied) return;
|
|
const timer = setTimeout(() => setCopied(false), 1500);
|
|
return () => clearTimeout(timer);
|
|
}, [copied]);
|
|
return (
|
|
<div className="mt-1.5 flex min-w-0 items-center gap-1.5">
|
|
<span
|
|
title={dir}
|
|
data-testid="desktop-guide-folder"
|
|
className="min-w-0 flex-1 truncate rounded-md border border-border bg-bg-0 px-2 py-1.5 font-mono text-step-11 text-text-0"
|
|
>
|
|
{dir}
|
|
</span>
|
|
<Button
|
|
variant="secondary"
|
|
aria-label={copied ? "Copied" : "Copy folder path"}
|
|
className="w-ctl px-0"
|
|
onClick={() => void copyTextToClipboard(dir).then((ok) => ok && setCopied(true))}
|
|
>
|
|
{copied ? <Check size={14} className="hf-guide-tick" /> : <Copy size={14} />}
|
|
</Button>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
/** Where the person is: what the button says, how Framey looks, and each step's state all derive from this. */
|
|
export type Progress = {
|
|
route: DesktopRoute;
|
|
opening: boolean;
|
|
failed: boolean;
|
|
downloaded: boolean;
|
|
slow: boolean;
|
|
/** The app turned up on this page (not already there): Framey hops once. */
|
|
arrived: boolean;
|
|
};
|
|
|
|
const isInstalled = (p: Progress) => p.route.context.app_installed;
|
|
export const isWaiting = (p: Progress) => p.downloaded && !isInstalled(p);
|
|
|
|
export function moodOf(p: Progress): FrameyMood {
|
|
if (p.opening) return "opening";
|
|
if (p.failed) return "error";
|
|
if (isWaiting(p)) return "thinking";
|
|
return p.arrived ? "found" : "idle";
|
|
}
|
|
|
|
export function labelOf(p: Progress): string {
|
|
if (p.opening) return "Opening in the app…";
|
|
if (p.failed) return "Couldn't open";
|
|
if (p.route.handoff) return "Open in desktop app";
|
|
return isWaiting(p) ? "Finish installing" : "Install the desktop app";
|
|
}
|
|
|
|
const boardFirst = (p: Progress) => p.route.context.placement === "storyboard";
|
|
|
|
function subtitleOf(p: Progress): string {
|
|
if (p.failed) return "Almost there: the last step needs another try.";
|
|
if (!isInstalled(p))
|
|
return boardFirst(p)
|
|
? "Comment on a frame, draw on it, then press Build. Three steps, about two minutes."
|
|
: "Watch it, click a frame, tell Framey what to change. Three steps, about two minutes.";
|
|
return p.route.handoff
|
|
? "Everything is ready. One press and you're in."
|
|
: "Almost there: one last step.";
|
|
}
|
|
|
|
type CardProps = {
|
|
progress: Progress;
|
|
projectDir: string | null;
|
|
onDownload: () => void;
|
|
onOpen: () => void;
|
|
};
|
|
|
|
function DownloadStep({ progress, onDownload }: CardProps) {
|
|
const { context, downloadUrl } = progress.route;
|
|
const where = platformName(context.os);
|
|
const installed = isInstalled(progress);
|
|
if (!progress.downloaded && !installed)
|
|
return (
|
|
<Step n={1} state={NOW} title={`Download HyperFrames for ${where}`}>
|
|
<p className={NOTE}>Free. Opens hyperframes.studio in a new tab.</p>
|
|
<Button
|
|
variant="primary"
|
|
className="mt-2"
|
|
icon={<ArrowSquareOut size={14} />}
|
|
onClick={onDownload}
|
|
>
|
|
Download for {where}
|
|
</Button>
|
|
</Step>
|
|
);
|
|
return (
|
|
<Step n={1} state={DONE} title={`Download HyperFrames for ${where}`}>
|
|
<p className={NOTE}>
|
|
{installed ? `Already on this ${deviceName(context.os)}.` : "Started in your browser."}
|
|
{!installed && downloadUrl && (
|
|
<button
|
|
type="button"
|
|
className="ml-1.5 cursor-pointer font-medium text-accent-ink hover:underline"
|
|
onClick={onDownload}
|
|
>
|
|
Download again
|
|
</button>
|
|
)}
|
|
</p>
|
|
</Step>
|
|
);
|
|
}
|
|
|
|
function InstallStep({ progress }: CardProps) {
|
|
const { os } = progress.route.context;
|
|
if (isInstalled(progress))
|
|
return (
|
|
<Step n={2} state={DONE} title="Install it">
|
|
<p className={NOTE}>
|
|
<Swap value="found">Found HyperFrames on this {deviceName(os)}.</Swap>
|
|
</p>
|
|
</Step>
|
|
);
|
|
return (
|
|
<Step n={2} state={progress.downloaded ? NOW : TODO} title="Install it">
|
|
<p className={NOTE}>
|
|
{os === "darwin"
|
|
? "Open the download and drag HyperFrames into Applications."
|
|
: "Open the download to install HyperFrames."}
|
|
</p>
|
|
{progress.downloaded && (
|
|
<p className="mt-1.5 flex items-center gap-2 text-step-12 text-text-2" role="status">
|
|
<Spinner />
|
|
<Swap value={String(progress.slow)}>
|
|
{progress.slow ? "Still looking. Did the download finish?" : "Looking for the app…"}
|
|
</Swap>
|
|
</p>
|
|
)}
|
|
</Step>
|
|
);
|
|
}
|
|
|
|
function OpenStep({ progress, projectDir, onOpen }: CardProps) {
|
|
const title = `Open ${projectDir?.split(/[\\/]/).filter(Boolean).pop() ?? "this project"}`;
|
|
const folder = projectDir && <FolderPath dir={projectDir} />;
|
|
if (progress.failed)
|
|
return (
|
|
<Step n={3} state={BAD} title={title}>
|
|
<p className={NOTE}>
|
|
The app didn't start. Try again, or open HyperFrames and drop this folder in:
|
|
</p>
|
|
{folder}
|
|
<Button variant="primary" className="mt-2" loading={progress.opening} onClick={onOpen}>
|
|
Try again
|
|
</Button>
|
|
</Step>
|
|
);
|
|
const installed = isInstalled(progress);
|
|
// Installed, but this platform's app cannot take a handed-over project yet: the folder is the way in.
|
|
if (installed && !progress.route.handoff)
|
|
return (
|
|
<Step n={3} state={NOW} title={title}>
|
|
<p className={NOTE}>Open HyperFrames and drop this folder in:</p>
|
|
{folder}
|
|
</Step>
|
|
);
|
|
return (
|
|
<Step n={3} state={installed ? NOW : TODO} title={title}>
|
|
<p className={NOTE}>
|
|
{boardFirst(progress)
|
|
? "Same project, same files. It opens on this storyboard."
|
|
: "Same project, same files, in the desktop app."}
|
|
</p>
|
|
<Button
|
|
variant="primary"
|
|
className="mt-2"
|
|
disabled={!progress.route.handoff}
|
|
loading={progress.opening}
|
|
onClick={onOpen}
|
|
>
|
|
Open in desktop app
|
|
</Button>
|
|
</Step>
|
|
);
|
|
}
|
|
|
|
export function GuideCard(props: CardProps) {
|
|
const { progress } = props;
|
|
const subtitle = subtitleOf(progress);
|
|
return (
|
|
<div data-testid="desktop-guide">
|
|
<div className="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-3 bg-linear-to-b from-accent/8 to-transparent px-4 pt-4 pb-3">
|
|
<FrameyGlyph size={46} mood={moodOf(progress)} />
|
|
<div className="min-w-0">
|
|
<p className="text-step-14 font-semibold text-balance text-text-0">
|
|
{boardFirst(progress)
|
|
? "Comment on this storyboard in the desktop app"
|
|
: "Edit this video in the desktop app"}
|
|
</p>
|
|
<p className={NOTE}>
|
|
<Swap value={subtitle}>{subtitle}</Swap>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<ol className="m-0 grid list-none px-4 pt-1 pb-4">
|
|
<DownloadStep {...props} />
|
|
<InstallStep {...props} />
|
|
<OpenStep {...props} />
|
|
</ol>
|
|
</div>
|
|
);
|
|
}
|