Open source CapCut alternative.
TypeScript
fix(site): keep the project's frame under the user's control [rebuild]
David Le549729d20994
diff --git a/docs/guides/cut/brief-to-video.md b/docs/guides/cut/brief-to-video.mdindex ce7abb9a..89bb5eb5 100644--- a/docs/guides/cut/brief-to-video.md+++ b/docs/guides/cut/brief-to-video.md@@ -75,6 +75,10 @@ instead — the same fixed words every shot:reference-conditioned video from the sheets → text-only, where the cast'sfull written descriptions ride the prompt and identity drifts the most.+The project's frame is the user's setting. A run reads it when the plan is+approved and never changes it — a reference in another shape or a platform the+brief names is something to mention, not a reason to reframe someone's project.+## Where it's goingAudio follows the same principles later: wall-to-wall narration generalizes todiff --git a/site/src/cut/lib/aiTools.ts b/site/src/cut/lib/aiTools.tsindex 1cde473e..7e775d8f 100644--- a/site/src/cut/lib/aiTools.ts+++ b/site/src/cut/lib/aiTools.ts@@ -960,7 +960,6 @@ export async function runAiTool(...(isNum(input.target_seconds)? { targetSeconds: clamp(Math.round(input.target_seconds), 6, 90) }: {}),- ...(input.aspect === "16:9" || input.aspect === "9:16" ? { aspect: input.aspect } : {}),...(typeof input.style === "string" && input.style.trim() ? { style: input.style.trim() } : {}),...(Array.isArray(input.reference_asset_ids)? { referenceAssetIds: input.reference_asset_ids.map(String) }diff --git a/site/src/cut/lib/genScene.ts b/site/src/cut/lib/genScene.tsindex 35150756..c4a3443b 100644--- a/site/src/cut/lib/genScene.ts+++ b/site/src/cut/lib/genScene.ts@@ -72,7 +72,6 @@ export interface StartSceneParams {brief?: string;fromAudioAssetId?: string;targetSeconds?: number;- aspect?: Aspect;style?: string;referenceAssetIds?: string[];/** The chat thread that asked, so the run's media is tagged to it and stays@@ -261,9 +260,9 @@ function newProject(projectId: string, params: StartSceneParams): VideoProject {fps: GEN_FPS,durationFrames: audio ? Math.round(audio.duration * GEN_FPS) : 0,transcript: [],- // The plan owns its shape from the start (start() applies params.aspect to- // an empty timeline before this runs), so a background render can never- // pick up another open project's aspect.+ // The plan takes the project's shape once, at planning time: a run reads the+ // user's frame and never reshapes it, and a background render can't pick up+ // another open project's aspect later.aspect: nearestAspect(useEditor.getState().aspect, defaultVideoAspects()),style: params.style?.trim() ?? "",suiteLabel: "donkey-hosted",@@ -672,18 +671,9 @@ export const useGenScene = create<GenSceneState>((set, get) => ({"A video is already being generated for this project. Stop it with cancel_scene, or wait for it to finish.",};}- // Validate before any side effect — the aspect apply below reshapes the- // timeline and must not run for a request that gets rejected.if (!params.fromAudioAssetId && !params.brief?.trim()) {return { started: false, message: "Tell me what the video should be about." };}- // Only set the aspect on an empty timeline: reframing a project that already- // has clips is a committing edit, and this runs before the approval gate.- // Applied before newProject so the plan freezes the effective shape.- const ed = useEditor.getState();- if (params.aspect && ed.clips.length === 0 && ed.audioClips.length === 0) {- ed.setAspect(params.aspect);- }const project = newProject(projectId, params);if (project.audioMode === "generated" && !project.brief) {return { started: false, message: "Tell me what the video should be about." };diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.tsindex 42462400..b7b6ef0f 100644--- a/site/src/cut/server/ai/catalog.ts+++ b/site/src/cut/server/ai/catalog.ts@@ -351,7 +351,6 @@ export const AI_TOOLS: AiToolDef[] = [from_audio_asset_id: str("Animate this project audio asset (id from media) — shots tile over it instead of a new script"),audio_language: str("BCP-47 language of the from_audio asset's speech (e.g. ko-KR). REQUIRED with from_audio_asset_id whenever the speech is not English — the on-device transcriber picks its recognizer from it, and the wrong recognizer garbles every shot planned over the audio"),target_seconds: num("Rough total length in seconds, 6–90 (default ~24)"),- aspect: { type: "string", enum: ["9:16", "16:9"], description: "Output shape (default: the supported shape closest to the project aspect)" },style: str("Optional look to steer the whole video (e.g. 'moody neon, handheld'); usually left to the brief"),reference_asset_ids: {type: "array",@@ -709,7 +708,7 @@ export const AI_TOOLS: AiToolDef[] = [{name: "set_aspect",description:- "Set the project's output frame ratio as \"W:H\". Presets: 16:9 (YouTube), 9:16 (TikTok/Reels/Shorts), 1:1, 4:3, 3:4, 2:1 — but any ratio up to an 8:1 shape works, with whole or decimal sides (\"9:5\", \"2.39:1\" — stored reduced, so 2.39:1 becomes 239:100). The frame renders with its short side at 1080px: 9:16 → 1080×1920, 16:9 → 1920×1080, 9:5 → 1944×1080.",+ "Set the project's output frame ratio as \"W:H\". The frame is the user's own setting, so call this only when they asked for a shape or a format (\"make it vertical\", \"for TikTok\", \"square\") — never inferred from a reference image's shape, a platform named in passing, or what would suit a generation you are about to run. Presets: 16:9 (YouTube), 9:16 (TikTok/Reels/Shorts), 1:1, 4:3, 3:4, 2:1 — but any ratio up to an 8:1 shape works, with whole or decimal sides (\"9:5\", \"2.39:1\" — stored reduced, so 2.39:1 becomes 239:100). The frame renders with its short side at 1080px: 9:16 → 1080×1920, 16:9 → 1920×1080, 9:5 → 1944×1080.",inputSchema: obj({ aspect: { type: "string", description: "Output ratio as \"W:H\", e.g. \"9:16\", \"1:1\", \"9:5\", \"2.39:1\"" } }, ["aspect"]),},{@@ -838,7 +837,7 @@ If generation fails with a sign-in or credits message, relay that plainly — ge"scene-productions": `# Scene productions (generate_scene)generate_scene plans a narrated multi-shot cut; approve_scene renders it. Planning is free; every shot render spends credits, so present the plan card and wait for the user's go-ahead — never approve on your own. Per shot, the pipeline already guarantees: smooth continuous motion (no stop-motion or held poses), zero on-screen text, character consistency via a style bible plus reference sheets, gapless non-overlapping placement, and a reviewer that retakes failed renders. Audio: a brief-driven scene has NO separate narration track — the video model speaks each shot's line, so the clip plays its own burned-in narration with a soft music bed under it; a from-audio scene mutes the shots as b-roll under the user's spine instead.-Aspect: every shot renders at the plan's aspect, frozen from the project when approved. Shots render at 9:16 or 16:9 — a custom project ratio freezes the closest of the two and the shots letterbox in the frame. Check project.aspect first; when the user wants a specific format, set_aspect BEFORE approve_scene. Changing aspect after approval re-renders nothing.+Aspect: every shot renders at the project's shape, frozen when the plan is approved — 9:16 or 16:9, and a custom project ratio freezes the closest of the two, with the shots letterboxed in the frame. The project's shape is the user's own setting and a scene run never changes it: a reference in another shape, a platform the brief mentions, and the shots' own letterboxing are all reasons to say something, not to reframe their project. They asked for a vertical or horizontal video → set_aspect first, then plan.Look: the user's style reference is the strongest anchor — pass attached images/clips as reference_asset_ids; they anchor the style bible and every shot. A reference contributes the LOOK; when the user wants its pictured character or place in the video itself, say that in the brief — otherwise the pipeline designs a fresh cast in the reference's technique. The brief describes the same look in plain visual traits so words and image agree; with no reference, build the trait wording from the ask (a simple children's cartoon → "flat hand-drawn 2D animation, clean thick outlines, simple rounded characters, soft colors, gentle fluid motion"). Describe any show, franchise, or artist by traits — the generator rejects trademarked names. Name recurring wardrobe and props in the brief so independently rendered shots match.From an audio file (the audio rides the timeline as the spine): listen_audio first and extract every fact — who speaks, who appears, each topic in order. Then generate_scene with from_audio_asset_id PLUS a brief carrying those facts; the brief outranks transcript mishears. Speech in another language: write the brief's facts in English and pass audio_language so the on-device transcriber uses the right recognizer. Long silence or music in the source becomes filler shots — suggest trimming first (detect_silence); shots tile the full asset length, so warn on long files (many paid shots).Scope: deliver exactly what was asked — no subtitle tracks, titles, or extra music on top (brief mode lays its own soft music bed; from-audio mode adds none). One scene run at a time — cancel_scene stops the active one when the user wants it gone or replaced.@@ -870,7 +869,7 @@ Rules:- When the user says "this" (this clip, this text), they mean the current selection.- Keep replies short and concrete — one or two sentences about what you did, in that warm, lightly funny voice. You have no name and never name the app; a message that asks for nothing (a greeting, thanks) gets a short "How can I help?" / "What would you like to do?" back — words alone, no tool calls. No headings, no fluff, and never paste the editor_state snapshot or raw JSON back — say what it means in plain words (a failed render: name the error and offer to retry).- Edits are undoable (unlimited undo), so prefer doing over asking; only ask when the request is genuinely ambiguous. The existing cut is the user's work: adding media adds — never delete, trim, or reorder a timeline clip unless the user said to. Read "change it / make it X / try again / closer to the original" as a fresh take that lands on its own card beside the old, never as license to delete the old clip first; only an explicit "replace / delete / remove this" clears what's already there. Generation is different: undo removes the clip but the credits stay spent, so be certain the user asked for the media before calling a generation tool. Removing media is different too — delete_asset and library_organize deletes don't come back with undo, so they take an explicit ask naming the media.-- Times are seconds. The frame follows project.aspect in editor_state — any "W:H" ratio, short side 1080px; project.frame has the exact pixels.+- Times are seconds. The frame follows project.aspect in editor_state — any "W:H" ratio, short side 1080px; project.frame has the exact pixels. The frame is the user's setting: work within the shape they chose, and change it only when they ask for a different one. A generation that renders in another shape letterboxes inside their frame — mention that if it matters, and leave the choice to them.- Read list_skills / read_skill before working in an area you're unsure about — they document every setting.- Transcription tools write tracks the user sees — run subtitles_generate / captions_generate only when captions were asked for, never just to read the words: existing cues are in editor_state, and audio plays to you via listen_audio. Don't transcribe a video with no speech (subtitles_from_visuals narrates silent footage), and never invent a spoken transcript.- Voiceovers duck other audio by default so they stay audible. Steer a voiceover's delivery with \`direction\` and inline tags like [whispers] rather than rewriting the script.