Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(ai): let the agent see and place audio tracks

EtienneLescot00c1ce72279f
diff --git a/electron/ai-edition/agent-tools.test.ts b/electron/ai-edition/agent-tools.test.ts
index 8f8361e59..57c65eed0 100644
--- a/electron/ai-edition/agent-tools.test.ts
+++ b/electron/ai-edition/agent-tools.test.ts
@@ -172,6 +172,7 @@ describe("the mutating-tool table", () => {
expect([...MUTATING_TOOL_NAMES].sort()).toEqual(
[
"addAnnotation",
+ "addAudio",
"addCameraFullscreen",
"addSpeed",
"addTrim",
@@ -184,6 +185,7 @@ describe("the mutating-tool table", () => {
"removeTrim",
"replaceTimeline",
"setAnnotation",
+ "setAudio",
"setCameraFullscreen",
"setClipRange",
"setSpeed",
@@ -2054,3 +2056,133 @@ describe("setZoom answers for the focus it kept", () => {
expect(result.resultJson).not.toContain("cursorAnchor");
});
});
+
+// Issue #350 / #560 — the audio tools. #561 landed the timeline audio without any
+// agent surface, so these cover both that the model can see it and that it cannot
+// invent an asset to place.
+describe("addAudio / setAudio", () => {
+ /** The fixture plus one imported audio asset. */
+ function withAudioAsset(durationSec: number | null = 30): AxcutDocument {
+ const doc = fixtureDocument();
+ return documentSchema.parse({
+ ...doc,
+ assets: [
+ ...doc.assets,
+ {
+ id: "audio_1",
+ kind: "audio",
+ label: "bed.mp3",
+ originalPath: "C:/audio/bed.mp3",
+ ...(durationSec == null ? {} : { durationSec }),
+ },
+ ],
+ });
+ }
+
+ const place = (doc: AxcutDocument, args: Record<string, unknown>) =>
+ executeAgentTool(doc, "addAudio", JSON.stringify(args));
+
+ it("reports imported audio in the snapshot, with the asset kind beside it", () => {
+ // Without `kind` the model sees an asset it cannot explain and tries to place it
+ // as footage; without `audioTracks` it cannot see the lanes at all.
+ const placed = place(withAudioAsset(), {
+ assetId: "audio_1",
+ startSec: 2,
+ endSec: 6,
+ kind: "voiceover",
+ });
+ expect(placed.ok).toBe(true);
+ const snapshot = executeAgentTool(placed.document as AxcutDocument, "getCurrentDocument", "");
+ const parsed = JSON.parse(snapshot.resultJson);
+ expect(parsed.assets.find((a: { id: string }) => a.id === "audio_1").kind).toBe("audio");
+ expect(parsed.audioTracks).toHaveLength(1);
+ expect(parsed.audioTracks[0]).toMatchObject({
+ assetId: "audio_1",
+ kind: "voiceover",
+ startSec: 2,
+ endSec: 6,
+ });
+ });
+
+ it("anchors the placed track to the clip under it", () => {
+ const result = place(withAudioAsset(), { assetId: "audio_1", startSec: 2, endSec: 6 });
+ expect(result.ok).toBe(true);
+ const track = (result.document as AxcutDocument).audioTracks[0];
+ // The anchor is what makes it travel with its clip; a bare startMs/endMs would not.
+ expect(track.clipId).toBe("clip_1");
+ expect(track.origin).toBe("agent");
+ });
+
+ it("plays the whole file when endSec is omitted", () => {
+ const result = place(withAudioAsset(20), { assetId: "audio_1", startSec: 0, offsetSec: 5 });
+ expect(result.ok).toBe(true);
+ const track = (result.document as AxcutDocument).audioTracks[0];
+ // 20s file from an in-point of 5s = 15s of span, so the model never computes it.
+ expect(track.endMs - track.startMs).toBe(15_000);
+ });
+
+ it("refuses an offset at or past the end of a known file", () => {
+ // Otherwise the omitted-end fallback mints a 0.1s track that plays silence, and
+ // the model reports it as having placed audio.
+ const result = place(withAudioAsset(20), { assetId: "audio_1", startSec: 0, offsetSec: 20 });
+ expect(result.ok).toBe(false);
+ expect(result.resultJson).toContain("offsetSec");
+ });
+
+ it("allows any offset while the duration is unknown", () => {
+ // A failed probe leaves no duration; refusing on that would block a legitimate call.
+ expect(place(withAudioAsset(null), { assetId: "audio_1", startSec: 0, offsetSec: 99 }).ok).toBe(
+ true,
+ );
+ });
+
+ it("refuses an unknown asset and names the audio the project actually has", () => {
+ const result = place(withAudioAsset(), { assetId: "nope", startSec: 0, endSec: 4 });
+ expect(result.ok).toBe(false);
+ expect(result.resultJson).toContain("audio_1");
+ });
+
+ it("refuses a video asset, pointing at the tool that does place footage", () => {
+ const result = place(withAudioAsset(), { assetId: "asset_1", startSec: 0, endSec: 4 });
+ expect(result.ok).toBe(false);
+ expect(result.resultJson).toContain("replaceTimeline");
+ });
+
+ it("setAudio re-levels and re-lanes the track it names", () => {
+ const placed = place(withAudioAsset(), { assetId: "audio_1", startSec: 2, endSec: 6 });
+ const id = JSON.parse(placed.resultJson).audioId;
+ const result = executeAgentTool(
+ placed.document as AxcutDocument,
+ "setAudio",
+ JSON.stringify({ audioId: id, gainDb: -6, kind: "voiceover" }),
+ );
+ expect(result.ok).toBe(true);
+ expect((result.document as AxcutDocument).audioTracks[0]).toMatchObject({
+ gainDb: -6,
+ kind: "voiceover",
+ });
+ });
+
+ it("setAudio applies the same offset guard as addAudio", () => {
+ const placed = place(withAudioAsset(20), { assetId: "audio_1", startSec: 2, endSec: 6 });
+ const id = JSON.parse(placed.resultJson).audioId;
+ const result = executeAgentTool(
+ placed.document as AxcutDocument,
+ "setAudio",
+ JSON.stringify({ audioId: id, offsetSec: 25 }),
+ );
+ expect(result.ok).toBe(false);
+ });
+
+ it("removeModifier deletes an audio track by id, like every other kind", () => {
+ const placed = place(withAudioAsset(), { assetId: "audio_1", startSec: 2, endSec: 6 });
+ const id = JSON.parse(placed.resultJson).audioId;
+ const result = executeAgentTool(
+ placed.document as AxcutDocument,
+ "removeModifier",
+ JSON.stringify({ id }),
+ );
+ expect(result.ok).toBe(true);
+ expect((result.document as AxcutDocument).audioTracks).toEqual([]);
+ });
+});
diff --git a/electron/ai-edition/agent-tools.ts b/electron/ai-edition/agent-tools.ts
index 5a0966398..329346003 100644
--- a/electron/ai-edition/agent-tools.ts
+++ b/electron/ai-edition/agent-tools.ts
@@ -16,6 +16,12 @@
// described are gone (see `MUTATING_TOOL_NAMES`).
import { z } from "zod";
+import {
+ anchorAudioTrackFragments,
+ collapseTracksToPills,
+ patchAudioTrack,
+ trackGroupId,
+} from "../../src/lib/ai-edition/document/audioTracks";
import { createId } from "../../src/lib/ai-edition/document/ids";
import {
moveClip,
@@ -337,6 +343,11 @@ function droppedByEdit(before: AxcutDocument, after: AxcutDocument) {
// private — callers only ever need the composed `*Args`.)
const secondsSchema = z.number().finite().nonnegative();
+/** Span given to an agent-placed audio track when the asset has no probed duration
+ * yet. Short on purpose: a wrong guess the user has to lengthen beats one that
+ * silently covers the whole programme. */
+const DEFAULT_AGENT_AUDIO_SEC = 10;
+
export const addTrimArgs = z.object({
startSec: secondsSchema,
endSec: secondsSchema,
@@ -479,6 +490,26 @@ export const setAnnotationArgs = z.object({
text: z.string().optional(),
});
+export const addAudioArgs = z.object({
+ assetId: z.string().min(1),
+ startSec: secondsSchema,
+ endSec: secondsSchema.optional(),
+ kind: z.enum(["voiceover", "music"]).default("music"),
+ offsetSec: secondsSchema.default(0),
+ gainDb: z.number().min(-60).max(12).default(0),
+});
+
+export const setAudioArgs = z.object({
+ audioId: z.string().min(1),
+ startSec: secondsSchema.optional(),
+ endSec: secondsSchema.optional(),
+ kind: z.enum(["voiceover", "music"]).optional(),
+ offsetSec: secondsSchema.optional(),
+ gainDb: z.number().min(-60).max(12).optional(),
+ muted: z.boolean().optional(),
+ loop: z.boolean().optional(),
+});
+
export const addCameraFullscreenArgs = z.object({
startSec: secondsSchema,
endSec: secondsSchema,
@@ -541,6 +572,8 @@ export const OPENSCREEN_TOOL_NAMES = [
"setAnnotation",
"addCameraFullscreen",
"setCameraFullscreen",
+ "addAudio",
+ "setAudio",
"removeTrim",
"removeModifier",
"removeClip",
@@ -607,6 +640,8 @@ export const MUTATING_TOOL_NAMES: ReadonlySet<string> = new Set([
"setAnnotation",
"addCameraFullscreen",
"setCameraFullscreen",
+ "addAudio",
+ "setAudio",
"removeTrim",
"removeModifier",
"removeClip",
@@ -665,7 +700,9 @@ export function documentSnapshotForModel(
const autoFocusAll = legacy?.autoFocusAll === true;
return {
timeBaseNote:
- "clips and trims are in source-time seconds; zooms, speedRegions, annotations and cameraFullscreenRegions are in virtual (edited-timeline) seconds.",
+ "clips and trims are in source-time seconds; zooms, speedRegions, annotations, cameraFullscreenRegions and audioTracks are in virtual (edited-timeline) seconds.",
+ audioNote:
+ "audioTracks are imported voiceover / music files laid over the recording. They are clip-anchored like every other region, so they travel with their clip through reorder and trim, and they play at 1x whatever a speed region does to the picture under them. addAudio places an EXISTING asset of kind 'audio'; nothing here can import a file from disk or record one, so if the project has no audio asset, say so rather than inventing an id.",
zoomNote:
`renderedScale is what the viewer sees (depth is an ordinal, not a factor: ${ZOOM_DEPTH_LEGEND}). ` +
"When a zoom carries customScale it wins over depth and depthIsOverridden is true — " +
@@ -683,6 +720,10 @@ export function documentSnapshotForModel(
assets: document.assets.map((a) => ({
id: a.id,
label: a.label,
+ // "audio" is an imported voiceover / music file: it is never a clip, it is
+ // played by an audio track. Without this the model sees an asset it cannot
+ // explain and tries to place it on the timeline as footage.
+ kind: a.kind,
durationSec: a.durationSec ?? null,
hasCameraTrack: a.cameraTrack != null,
cameraVisible: a.cameraTrack?.visible ?? false,
@@ -755,6 +796,22 @@ export function documentSnapshotForModel(
startSec: roundSec(c.startMs),
endSec: roundSec(c.endMs),
})),
+ // Imported audio, collapsed to the pills the ruler draws — a track ventilated
+ // across a clip boundary is several fragments the user sees as one thing, and
+ // the model has to name what the user sees.
+ audioTracks: collapseTracksToPills(document.audioTracks).map((t) => ({
+ id: trackGroupId(t),
+ startSec: roundSec(t.startMs),
+ endSec: roundSec(t.endMs),
+ assetId: t.assetId,
+ // Which lane it sits on. Also decides whether it is transcribed at all.
+ kind: t.kind,
+ // Where in the FILE the track starts playing, in that file's own seconds.
+ offsetSec: roundSec(t.offsetMs),
+ gainDb: t.gainDb,
+ muted: t.muted,
+ loop: t.loop,
+ })),
hasTranscript: document.transcripts.length > 0 || document.transcript !== null,
};
}
@@ -1843,6 +1900,168 @@ export function executeAgentTool(
};
}
+ case "addAudio": {
+ const parsed = addAudioArgs.safeParse(args);
+ if (!parsed.success) return failure(parsed.error.message);
+ const { assetId, kind, offsetSec, gainDb } = parsed.data;
+ const asset = document.assets.find((a) => a.id === assetId);
+ // Two distinct refusals, because they need two different corrections: an
+ // unknown id is a hallucinated asset, a video id is the model reaching for
+ // footage. Naming the audio the project HAS is what stops the retry loop.
+ if (!asset) {
+ const available = document.assets.filter((a) => a.kind === "audio");
+ return failure(
+ `Unknown asset: ${assetId}.` +
+ (available.length
+ ? ` Imported audio in this project: ${available.map((a) => `${a.id} (${a.label})`).join(", ")}.`
+ : " This project has no imported audio; a file can only be imported or recorded from the editor, not from here."),
+ );
+ }
+ if (asset.kind !== "audio") {
+ return failure(
+ `Asset ${assetId} is video, not audio. addAudio plays an imported audio file over the recording; to place footage use replaceTimeline.`,
+ );
+ }
+ const durationSec = asset.durationSec ?? 0;
+ // "Start the file at offsetSec" is only answerable when there is file left
+ // there. Past the end it yields a track that plays silence, which the model
+ // then reports as having placed audio. Unknown duration is not a refusal: an
+ // import whose probe failed carries 0 until the renderer re-probes it.
+ if (durationSec > 0 && offsetSec >= durationSec) {
+ return failure(
+ `offsetSec ${offsetSec}s is at or past the end of ${assetId} (${durationSec}s), so the track would play nothing. Pick an offset inside the file.`,
+ );
+ }
+ // No endSec means "as long as the file is" — the natural span, and the one
+ // the editor's own add uses, so the model never has to compute it.
+ const startSec = parsed.data.startSec;
+ const endSec =
+ parsed.data.endSec ??
+ startSec + Math.max(0.1, (durationSec || DEFAULT_AGENT_AUDIO_SEC) - offsetSec);
+ const startMs = toMs(Math.min(startSec, endSec));
+ const endMs = toMs(Math.max(startSec, endSec));
+ const trackId = createId("audio");
+ const placed = anchorAudioTrackFragments(
+ {
+ id: trackId,
+ trackId,
+ startMs,
+ endMs,
+ assetId,
+ kind,
+ durationSec,
+ offsetMs: toMs(offsetSec),
+ gainDb,
+ loop: false,
+ fadeInMs: 0,
+ fadeOutMs: 0,
+ muted: false,
+ label: asset.label,
+ origin: "agent",
+ } as AxcutDocument["audioTracks"][number],
+ document.timeline.clips,
+ () => createId("audio"),
+ );
+ if (placed.length === 0) {
+ return coversNoClip("audio", startMs / 1000, endMs / 1000, document);
+ }
+ const next: AxcutDocument = {
+ ...document,
+ audioTracks: [...document.audioTracks, ...placed],
+ };
+ const landing = landingOf(placed, document);
+ return {
+ ok: true,
+ document: next,
+ resultJson: JSON.stringify({
+ audioId: trackId,
+ ...landingReport(landing, startMs / 1000, endMs / 1000),
+ }),
+ summary:
+ `added ${kind} "${asset.label}" ${formatSec(landing.startSec)} – ${formatSec(landing.endSec)}` +
+ landingSuffix(landing, startMs / 1000, endMs / 1000),
+ };
+ }
+
+ case "setAudio": {
+ const parsed = setAudioArgs.safeParse(args);
+ if (!parsed.success) return failure(parsed.error.message);
+ const { audioId } = parsed.data;
+ const pill = collapseTracksToPills(document.audioTracks).find(
+ (t) => trackGroupId(t) === audioId,
+ );
+ if (!pill) return failure(`Unknown audio track: ${audioId}`);
+
+ if (parsed.data.offsetSec !== undefined) {
+ const asset = document.assets.find((a) => a.id === pill.assetId);
+ const durationSec = asset?.durationSec ?? 0;
+ if (durationSec > 0 && parsed.data.offsetSec >= durationSec) {
+ return failure(
+ `offsetSec ${parsed.data.offsetSec}s is at or past the end of ${pill.assetId} (${durationSec}s), so the track would play nothing.`,
+ );
+ }
+ }
+
+ // Payload first, through the helper that keeps every fragment of the group in
+ // agreement — gain, mute, loop and the offset are all track-wide, and a patch
+ // that reached only one fragment would split the pill in two.
+ let next = patchAudioTrack(document, audioId, {
+ ...(parsed.data.gainDb !== undefined ? { gainDb: parsed.data.gainDb } : {}),
+ ...(parsed.data.muted !== undefined ? { muted: parsed.data.muted } : {}),
+ ...(parsed.data.loop !== undefined ? { loop: parsed.data.loop } : {}),
+ ...(parsed.data.offsetSec !== undefined ? { offsetMs: toMs(parsed.data.offsetSec) } : {}),
+ });
+
+ // A span or lane change re-anchors: drop the group and lay it down again, so
+ // the fragments are re-cut against the clips the new span covers rather than
+ // patched in place against the old ones.
+ const wantsRespan =
+ parsed.data.startSec !== undefined ||
+ parsed.data.endSec !== undefined ||
+ parsed.data.kind !== undefined;
+ if (wantsRespan) {
+ const current =
+ collapseTracksToPills(next.audioTracks).find((t) => trackGroupId(t) === audioId) ?? pill;
+ const { startMs, endMs } = resolveSpanMs(current, parsed.data.startSec, parsed.data.endSec);
+ const replaced = anchorAudioTrackFragments(
+ {
+ ...current,
+ id: audioId,
+ trackId: audioId,
+ startMs,
+ endMs,
+ ...(parsed.data.kind !== undefined ? { kind: parsed.data.kind } : {}),
+ },
+ document.timeline.clips,
+ () => createId("audio"),
+ );
+ if (replaced.length === 0) {
+ return coversNoClip("audio", startMs / 1000, endMs / 1000, document);
+ }
+ next = {
+ ...next,
+ audioTracks: [
+ ...next.audioTracks.filter((t) => trackGroupId(t) !== audioId),
+ ...replaced,
+ ],
+ };
+ }
+
+ const after = collapseTracksToPills(next.audioTracks).find(
+ (t) => trackGroupId(t) === audioId,
+ );
+ return {
+ ok: true,
+ document: next,
+ resultJson: JSON.stringify({
+ audioId,
+ startSec: roundSec(after?.startMs ?? pill.startMs),
+ endSec: roundSec(after?.endMs ?? pill.endMs),
+ }),
+ summary: `updated audio ${audioId} ${formatSec(roundSec(after?.startMs ?? pill.startMs))} – ${formatSec(roundSec(after?.endMs ?? pill.endMs))}`,
+ };
+ }
+
case "removeTrim": {
const parsed = removeTrimArgs.safeParse(args);
if (!parsed.success) return failure(parsed.error.message);
@@ -1872,6 +2091,7 @@ export function executeAgentTool(
else if (document.annotations.some((a) => a.id === id)) kind = "annotation";
else if (speedRegions.some((s) => s.id === id)) kind = "speed";
else if (cameraFullscreenRegions.some((c) => c.id === id)) kind = "cameraFullscreen";
+ else if (document.audioTracks.some((t) => trackGroupId(t) === id)) kind = "audio";
if (!kind) {
return failure(
`No zoom / speed / annotation / full-camera modifier with id ${id}. ` +
diff --git a/electron/ai-edition/deep-agent/service.test.ts b/electron/ai-edition/deep-agent/service.test.ts
index 7729bd624..f23970bc0 100644
--- a/electron/ai-edition/deep-agent/service.test.ts
+++ b/electron/ai-edition/deep-agent/service.test.ts
@@ -73,6 +73,10 @@ const ARGS: Record<string, unknown> = {
setAnnotation: { annotationId: "ann_nope" },
addCameraFullscreen: { startSec: 1, endSec: 2 },
setCameraFullscreen: { cameraFullscreenId: "cam_nope" },
+ // The fixture has no `kind: "audio"` asset, so these exercise the refusal branch —
+ // the honest one to pin: the agent can place imported audio, never import it.
+ addAudio: { assetId: "audio_nope", startSec: 1, endSec: 2 },
+ setAudio: { audioId: "audio_nope" },
removeTrim: { trimRangeId: "trim_1" },
removeModifier: { id: "nope" },
removeClip: { clipId: "clip_1" },
diff --git a/electron/ai-edition/deep-agent/service.ts b/electron/ai-edition/deep-agent/service.ts
index d804a3b1a..a67a1da2a 100644
--- a/electron/ai-edition/deep-agent/service.ts
+++ b/electron/ai-edition/deep-agent/service.ts
@@ -27,6 +27,7 @@ import type { AxcutDocument } from "../../../src/lib/ai-edition/schema";
import { ZOOM_DEPTH_LEGEND } from "../../../src/lib/ai-edition/timeline/zoom-scale";
import {
addAnnotationArgs,
+ addAudioArgs,
addCameraFullscreenArgs,
addSpeedArgs,
addTrimArgs,
@@ -45,6 +46,7 @@ import {
replaceTimelineArgs,
resolveCursorAssetId,
setAnnotationArgs,
+ setAudioArgs,
setCameraFullscreenArgs,
setClipRangeArgs,
setSpeedArgs,
@@ -115,6 +117,7 @@ const BASE_SYSTEM_PROMPT = [
"- Silences, pauses and dead stretches are removed as trims INSIDE the placed clip. Send them together with addTrims once you know the ranges; addTrim is for a single cut or a correction. The placed clip stays the canonical cut; it is not rebuilt to drop them.",
"- Changing where a clip starts or ends within its source is setClipRange — the clip's in/out, distinct from a trim.",
`- addZoom takes a virtual-timeline span (depth is an ordinal 1–6 selecting from a fixed table — ${ZOOM_DEPTH_LEGEND} — never a multiplier; focus in 0–1 frame fractions). addSpeed changes pacing over a span. addAnnotation puts text on screen. addCameraFullscreen enlarges the webcam, and only does something where assets[].hasCameraTrack is true.`,
+ "- addAudio lays an imported voiceover or music file over a span. It plays an asset the project already has (kind 'audio'); importing or recording one is the editor's job, not a tool you have — so when the project has none, say so rather than naming an id that does not exist.",
"- moveClip changes the order of placed clips, one call per clip that moves, preserving ids, source ranges, trims and anchored effects. replaceTimeline rebuilds the timeline from kept intervals and sorts them, so it cannot reorder anything.",
"- Deleting is a first-class action, not a workaround: removeTrim, removeModifier, removeClip. Never fake a deletion by re-adding an element or zeroing it out (span 0, speed 1×) — that leaves it in the document and misreports what you did.",
"If nothing in the list does what was asked, say so; do not approximate it with a bigger tool.",
@@ -170,10 +173,14 @@ export const TOOL_DESCRIPTIONS: Record<string, string> = {
"Add a camera-fullscreen region over a span of the edited timeline (virtual seconds): the webcam fills the frame for that span. This only does something when the footage under that span comes from an asset with a linked webcam — check assets[].hasCameraTrack (or hasAnyCamera) in getCurrentDocument first. On footage with no camera the call is refused rather than storing a region that would render nothing; say so instead of retrying.",
setCameraFullscreen:
"Move or resize an existing camera-fullscreen region by id (virtual-timeline seconds). Only the fields you pass are changed. Refused if the new span lands on footage with no linked webcam.",
+ addAudio:
+ "Lay an ALREADY-IMPORTED audio file over the recording across a span of the edited timeline (virtual seconds): a voiceover, or a music bed. assetId must name an asset whose kind is 'audio' — getCurrentDocument lists them; nothing here can import a file from disk or record one, so if there is none, say so instead of guessing an id. Omit endSec to play the whole file from offsetSec. kind picks the lane ('voiceover' or 'music'). offsetSec is where in the FILE playback starts, gainDb its level (0 unchanged, negative ducks it). A voiceover-lane track is also what gets transcribed, so the lane is not only cosmetic.",
+ setAudio:
+ "Move, resize, re-level, re-lane, mute, loop or re-point an existing audio track by id (virtual-timeline seconds). Only the fields you pass are changed. Use it to duck a bed under narration (gainDb), to shift what part of the file plays (offsetSec), or to move it between the voiceover and music lanes (kind). The whole track is edited, not one fragment of it, so a track split across a cut stays one thing.",
removeTrim:
"Delete a trim range by id — the cut is undone and that span plays/exports again. This is how you 'remove a trim'; never re-add a trim to undo one.",
removeModifier:
- "Delete a modifier (zoom / speed / annotation / camera-fullscreen) by id; the kind is resolved from the id. This is how you 'remove'/'delete' one — never neutralise it (span 0, speed 1×), which leaves it in the document. For a trim use removeTrim; for a clip use removeClip.",
+ "Delete a modifier (zoom / speed / annotation / camera-fullscreen / audio) by id; the kind is resolved from the id. This is how you 'remove'/'delete' one — never neutralise it (span 0, speed 1×), which leaves it in the document. For a trim use removeTrim; for a clip use removeClip.",
removeClip:
"Delete a placed clip by id; remaining clips close the gap and effects anchored to it are dropped. Use only when the user asks to remove a clip — to shorten one, use setClipRange.",
};
@@ -339,6 +346,8 @@ export function buildTools(
build("setAnnotation", setAnnotationArgs),
build("addCameraFullscreen", addCameraFullscreenArgs),
build("setCameraFullscreen", setCameraFullscreenArgs),
+ build("addAudio", addAudioArgs),
+ build("setAudio", setAudioArgs),
build("removeTrim", removeTrimArgs),
build("removeModifier", removeModifierArgs),
build("removeClip", removeClipArgs),