Open source CapCut alternative.
TypeScript
fix(app): stop the Cut AI deleting timeline clips the user didn't ask to remove [rebuild]
David Ledb2428a66384
diff --git a/site/scripts/eval-cut-chat.ts b/site/scripts/eval-cut-chat.tsindex e3b09e9d..561a30ec 100644--- a/site/scripts/eval-cut-chat.ts+++ b/site/scripts/eval-cut-chat.ts@@ -591,6 +591,37 @@ function cases(audio: { dataBase64: string; mimeType: string }): EvalCase[] {},},},+ {+ // The screenshot regression: iterating on an existing clip ("make me a+ // better version / closer to the original / a different take") ADDS a+ // fresh generation and leaves the clip in place. Without an explicit+ // "delete / replace / remove this", deleting the user's existing work+ // to "make room" is wrong — the trap word "instead"/"version" is not a+ // delete instruction.+ name: "iterate-keeps-existing-clip",+ input: () => [+ userTurn("the beach clip feels off — make me a better version, more of a golden-hour sunset"),+ ],+ reply: /version|render|sunset|golden|minute|new|preview|kept|left|place/i,+ requiredTools: ["generate_video"],+ simulate: () => (name) => {+ if (name === "delete_item")+ throw new Error("delete_item — iterating is not a delete/replace; the existing clip must stay");+ if (name === "delete_asset")+ throw new Error("delete_asset — iterating must not remove the existing clip's media");+ return undefined;+ },+ stubs: {+ generate_video: {+ kind: "video",+ started: true,+ jobId: "job-sunset",+ addToTimeline: false,+ note:+ "Rendering a new take — it previews in this chat when it lands, in a minute or two. Your current clip stays put.",+ },+ },+ },{// Fast path: audio generation goes straight to voiceover_generate// (list_voices is a fine extra hop, more than that is a detour).diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.tsindex 5ddca51e..b0d3a61d 100644--- a/site/src/cut/server/ai/catalog.ts+++ b/site/src/cut/server/ai/catalog.ts@@ -775,7 +775,7 @@ Rules:- Use ids exactly as given in the state, and act on what your tools return — each reports what it changed, so batch independent edits into one step and call get_state only when the snapshot is stale or a result surprised you. A tool that comes back "unreachable" or "no live editor session" is a dropped bridge, not a limit and not your request's fault — the editor never received the call, so quietly make the same call once more before doing anything else, and never tell the user to reconnect or restart the editor.- 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 clips already on the timeline unless that's what they asked for. 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.+- 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 is the project's aspect: 1080×1920 (9:16) or 1920×1080 (16:9) — see project.aspect in editor_state.- 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.