Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(ai-edition): measure a trim without clipId on every clip of its asset; say speed scales the move both ways
EtienneLescot349b42a06e7c
diff --git a/electron/ai-edition/agent-tools.test.ts b/electron/ai-edition/agent-tools.test.tsindex 35447804d..4bad12b91 100644--- a/electron/ai-edition/agent-tools.test.ts+++ b/electron/ai-edition/agent-tools.test.ts@@ -2541,6 +2541,47 @@ describe("zoom transitions are reported, not hidden (#1028)", () => {expect(snapshotZoom(trimmed.document).cutByTrim).toBe("out");});+ it("flags a zoom on the second clip of an asset that a trim without clipId cuts", () => {+ // Two clips over one recording, and a pre-v7 trim (no clipId): playback cuts it from+ // both clips, while the ruler maps it through the first one only.+ const base = shortSingleClip();+ const clip = base.timeline.clips[0];+ const length = (clip.sourceEndSec ?? 0) - clip.sourceStartSec;+ const twoClips: AxcutDocument = {+ ...base,+ timeline: {+ ...base.timeline,+ clips: [+ clip,+ {+ ...clip,+ id: "clip_2",+ timelineStartSec: length,+ timelineEndSec: 2 * length,+ },+ ],+ trimRanges: [+ {+ id: "trim_legacy",+ assetId: clip.assetId,+ startSec: 12,+ endSec: 14,+ reason: "",+ origin: "user",+ },+ ],+ },+ };+ const added = run(twoClips, "addZoom", {+ startSec: length + 10,+ endSec: length + 12,+ depth: 3,+ });+ expect(added.payload.cutTransitions).toEqual([+ { zoomId: added.payload.zoomId, side: "out", cutSec: MOVE_SEC },+ ]);+ });+it("stays quiet about a trim clear of both windows", () => {const trimmed = run(zoomedAt10to12().document, "addTrim", { startSec: 14, endSec: 15 });expect(trimmed.payload.cutTransitions).toBeUndefined();diff --git a/electron/ai-edition/agent-tools.ts b/electron/ai-edition/agent-tools.tsindex 2ecc3c514..b8ffb68a4 100644--- a/electron/ai-edition/agent-tools.ts+++ b/electron/ai-edition/agent-tools.ts@@ -729,9 +729,19 @@ function zoomTransitionsForAgent(document: AxcutDocument) {(legacy?.speedRegions as| Array<{ id: string; startMs: number; endMs: number; speed: number }>| undefined) ?? [];+ // A trim with no clipId cuts every clip of its asset in playback, while the ruler maps it+ // through one: measured per clip, so a zoom on any of them learns of the cut.const trims = document.timeline.trimRanges.flatMap((trim) => {- const span = trimToTimelineSpan(trim, document.timeline.clips);- return span ? [{ startMs: span.start * 1000, endMs: span.end * 1000 }] : [];+ const clips =+ trim.clipId !== undefined+ ? [trim]+ : document.timeline.clips+ .filter((clip) => clip.assetId === trim.assetId)+ .map((clip) => ({ ...trim, clipId: clip.id }));+ return clips.flatMap((anchored) => {+ const span = trimToTimelineSpan(anchored, document.timeline.clips);+ return span ? [{ startMs: span.start * 1000, endMs: span.end * 1000 }] : [];+ });});return coalesceForAgent(document.zoomRanges).map((zoom) => {const transitions = zoomTransitions({ ...zoom, scale: effectiveZoomScale(zoom) }, speedRegions);@@ -813,8 +823,8 @@ export function documentSnapshotForModel("When a zoom carries customScale it wins over depth and depthIsOverridden is true — " +"a setZoom that only changes depth on such a zoom clears customScale so the depth takes effect. " +"startSec–endSec is where the zoom HOLDS: it animates in over zoomInFromSec–startSec and out over " +- "endSec–zoomOutUntilSec (transitionSec of screen time each, stretched on the timeline by a speed " +- "region). cutByTrim names the move a trim cuts into (in, out or both): the export jumps at that cut.",+ "endSec–zoomOutUntilSec (transitionSec of screen time each; a speed region scales that on the " ++ "timeline, longer above 1x and shorter below, so read the bounds rather than adding transitionSec). cutByTrim names the move a trim cuts into (in, out or both): the export jumps at that cut.",project: { id: document.project.id, title: document.project.title },primaryAssetId: document.project.primaryAssetId ?? document.assets[0]?.id ?? null,autoFocusAll,diff --git a/electron/ai-edition/deep-agent/service.ts b/electron/ai-edition/deep-agent/service.tsindex dd1e308ce..b7924e870 100644--- a/electron/ai-edition/deep-agent/service.ts+++ b/electron/ai-edition/deep-agent/service.ts@@ -145,7 +145,7 @@ export function buildSystemPrompt(options: { editsAllowed: boolean }): string {export const SYSTEM_PROMPT = buildSystemPrompt({ editsAllowed: true });// #1028: a zoom's camera moves sit OUTSIDE its span, where nothing on the ruler shows them.-const ZOOM_TRANSITIONS_NOTE = `A zoom HOLDS over its span: it animates in during the window just before startSec and out during the window just after endSec. Each move lasts 0.6 s + 0.55 s × ln(renderedScale) of SCREEN time (${ZOOM_TRANSITION_LEGEND}), so inside a speed region it covers that many times more timeline. getCurrentDocument gives each zoom's zoomInFromSec and zoomOutUntilSec, in virtual seconds like the zoom. A trim inside either window cuts that move and the export jumps at the cut: leave the windows untrimmed.`;+const ZOOM_TRANSITIONS_NOTE = `A zoom HOLDS over its span: it animates in during the window just before startSec and out during the window just after endSec. Each move lasts 0.6 s + 0.55 s × ln(renderedScale) of SCREEN time (${ZOOM_TRANSITION_LEGEND}), so a speed region scales the timeline it covers by its speed: longer above 1×, shorter below. getCurrentDocument gives each zoom's zoomInFromSec and zoomOutUntilSec, in virtual seconds like the zoom. A trim inside either window cuts that move and the export jumps at the cut: leave the windows untrimmed.`;const CUT_TRANSITIONS_RESULT = `When the result cuts a zoom's move in or out, it carries \`cutTransitions\`: which zoom, which side, and cutSec, the timeline seconds of the move lost. It is a warning, nothing is refused: move the cut or the zoom unless a hard cut is what you want.`;export const TOOL_DESCRIPTIONS: Record<string, string> = {