Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat(types): the IPC types are generated from Rust, gated fresh in CI

Jareerc21d85ee12d2
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c497eeef..31e6b689 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -36,6 +36,12 @@ jobs:
# public item without documentation fails here, not in review.
- run: cargo clippy --workspace --all-targets -- -D warnings
working-directory: engine
+ # The committed TypeScript IPC types must match the Rust source of
+ # truth: regenerate the engine-owned bindings and fail on any drift.
+ - name: IPC type freshness (engine)
+ run: |
+ scripts/generate-ipc-types.sh engine
+ git diff --exit-code desktop/src/lib/generated
app:
name: App (${{ matrix.platform }})
@@ -194,6 +200,15 @@ jobs:
run: cargo clippy --all-targets -- -D warnings
working-directory: desktop/src-tauri
+ # The host half of the IPC type freshness gate (EditorView and
+ # friends). Here rather than in engine-tests because compiling the
+ # host needs Tauri's system libraries, which this job already has.
+ - name: IPC type freshness (host)
+ if: matrix.platform == 'macos'
+ run: |
+ scripts/generate-ipc-types.sh host
+ git diff --exit-code desktop/src/lib/generated
+
# Full release build - LTO and codegen-units=1 make this the slow step.
- run: npm run app:build
working-directory: desktop
diff --git a/.gitignore b/.gitignore
index 962b1259..bfabe242 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,3 +74,8 @@ desktop/src-tauri/ffmpeg/*
# Guard against staging-script cwd mistakes: a `desktop/...`-relative copy run
# from inside desktop/ once committed a whisper-cli binary to git history.
desktop/desktop/
+
+# ts-rs's default export directory. The real output goes to
+# desktop/src/lib/generated/ via scripts/generate-ipc-types.sh; this appears
+# only when the `types` feature's tests run without TS_RS_EXPORT_DIR set.
+desktop/src-tauri/bindings/
diff --git a/desktop/src/lib/editor.ts b/desktop/src/lib/editor.ts
index 78db9a15..e0572133 100644
--- a/desktop/src/lib/editor.ts
+++ b/desktop/src/lib/editor.ts
@@ -18,73 +18,35 @@
* the echo never survives past its commit.
*/
-import type { AppliedEffect, ClipTransition } from "./effects";
-import type { ClipFilter } from "./filters";
-import type { TextStyle } from "./text";
-
-// ── the engine's types, mirrored ─────────────────────────────────────────────
-
-export type MediaKind = "video" | "audio" | "image";
-export type ClipKind = MediaKind | "text";
-
-export interface MediaItem {
- id: string;
- path: string;
- name: string;
- duration: number | null;
- kind: MediaKind;
- width: number | null;
- height: number | null;
- frameRate: number | null;
- frameRateFraction: string | null;
- videoCodec: string | null;
- audioCodec: string | null;
- hasAudio: boolean;
- /** True when this item is a template slot awaiting the user's own media.
- * Absent from documents that predate templates, which means false. */
- placeholder?: boolean;
-}
-
-export interface Track {
- id: string;
- name: string;
- visible: boolean;
- muted: boolean;
-}
-
-export interface Clip {
- id: string;
- trackId: string;
- mediaId: string;
- name: string;
- kind: ClipKind;
- start: number;
- duration: number;
- sourceStart: number;
- volume: number;
- fadeIn: number;
- fadeOut: number;
- scale: number;
- offsetX: number;
- offsetY: number;
- rotation: number;
- opacity: number;
- speed: number;
- preservePitch: boolean;
- filters: ClipFilter[];
- videoEffects: AppliedEffect[];
- muted?: boolean;
- detachedFrom?: string;
- transitionIn?: ClipTransition;
- text?: TextStyle;
-}
-
-export interface TimelineData {
- id: string;
- name: string;
- tracks: Track[];
- clips: Clip[];
-}
+import type { Clip } from "./generated/Clip";
+import type { ClipPatch } from "./generated/ClipPatch";
+import type { Command as EditorCommand } from "./generated/Command";
+import type { CustomFont as EngineFont } from "./generated/CustomFont";
+import type { EditorView as EngineEditorView } from "./generated/EditorView";
+import type { MediaItem } from "./generated/MediaItem";
+import type { Project } from "./generated/Project";
+import type { Timeline as TimelineData } from "./generated/Timeline";
+import type { Track } from "./generated/Track";
+
+// ── the engine's types, generated ────────────────────────────────────────────
+// These used to be hand-mirrored interfaces the compiler could not check
+// against serde. They are now generated from the Rust source of truth by
+// ts-rs (see ./generated/README.md) and re-exported here under the names the
+// UI has always used, so a wire change on the Rust side is a type error on
+// this one. `EditorCommand` is the engine's `Command`; `TimelineData` its
+// `Timeline`; `EditorSettings` the host's `SettingsView`.
+
+export type { MediaKind } from "./generated/MediaKind";
+export type { ClipKind } from "./generated/ClipKind";
+export type { MediaItem } from "./generated/MediaItem";
+export type { Track } from "./generated/Track";
+export type { Clip } from "./generated/Clip";
+export type { Timeline as TimelineData } from "./generated/Timeline";
+export type { SettingsView as EditorSettings } from "./generated/SettingsView";
+export type { ClipPatch } from "./generated/ClipPatch";
+export type { ClipMove } from "./generated/ClipMove";
+export type { NewMedia } from "./generated/NewMedia";
+export type { Command as EditorCommand } from "./generated/Command";
/** A timeline's identity, for the tab strip. */
export type TimelineMeta = Pick<TimelineData, "id" | "name">;
@@ -93,121 +55,19 @@ export type TimelineMeta = Pick<TimelineData, "id" | "name">;
export const MIN_SCALE = 0.05;
export const MAX_SCALE = 8;
-export interface CustomFont {
- family: string;
- path: string;
+/** The engine's font entry plus the one field that is legitimately the
+ * UI's - whether loading the face failed on this machine. */
+export type CustomFont = EngineFont & {
/** UI-only: a load attempt failed. Never sent to or from the engine. */
missing?: boolean;
-}
+};
-export interface EditorProject {
- media: MediaItem[];
- fonts: CustomFont[];
- timelines: TimelineData[];
- activeTimelineId: string;
-}
-
-export interface EditorSettings {
- name: string;
- width: number;
- height: number;
- rateNum: number;
- rateDen: number;
-}
+/** The engine's project, with fonts widened to carry the UI-only
+ * `missing` flag. Everything else is exactly what serde wrote. */
+export type EditorProject = Omit<Project, "fonts"> & { fonts: CustomFont[] };
/** What every editor call returns: the authoritative state. */
-export interface EditorView {
- project: EditorProject;
- canUndo: boolean;
- canRedo: boolean;
- settings: EditorSettings;
- createdId?: string;
-}
-
-// ── commands: the whole edit vocabulary ──────────────────────────────────────
-
-/** A partial clip update. `null` clears `transitionIn`/`text`; absent leaves
- * a field untouched - the wire distinction the engine's double-options keep. */
-export interface ClipPatch {
- name?: string;
- volume?: number;
- fadeIn?: number;
- fadeOut?: number;
- opacity?: number;
- preservePitch?: boolean;
- filters?: ClipFilter[];
- videoEffects?: AppliedEffect[];
- transitionIn?: ClipTransition | null;
- text?: TextStyle | null;
-}
-
-export interface ClipMove {
- clipId: string;
- start: number;
- trackId: string;
-}
-
-export interface NewMedia {
- path: string;
- name: string;
- duration: number | null;
- kind: MediaKind;
- width: number | null;
- height: number | null;
- frameRate: number | null;
- frameRateFraction: string | null;
- videoCodec: string | null;
- audioCodec: string | null;
- hasAudio: boolean;
-}
-
-export type EditorCommand =
- | { op: "addMedia"; item: NewMedia }
- | { op: "removeMedia"; mediaId: string }
- | { op: "setMediaPlaceholder"; mediaId: string; placeholder: boolean }
- | { op: "fillSlot"; mediaId: string; item: NewMedia }
- | { op: "batch"; commands: EditorCommand[] }
- | { op: "addClip"; mediaId: string; trackId: string; start: number }
- | { op: "addClipAtFirstFree"; mediaId: string; start: number }
- | {
- op: "addTextClip";
- trackId: string | null;
- start: number;
- style: TextStyle | null;
- /** Seconds on the timeline; the editorial default when absent. Lets a
- * caption run land as one batch - a batch cannot trim ids it cannot
- * know yet. */
- duration?: number;
- /** Vertical placement as a frame-height fraction; lower thirds. */
- offsetY?: number;
- }
- | { op: "moveClips"; moves: ClipMove[] }
- | { op: "trimClip"; clipId: string; edge: "start" | "end"; delta: number }
- | { op: "splitClips"; clipIds: string[]; time: number }
- | { op: "mergeClips"; clipIds: string[] }
- | { op: "removeClips"; clipIds: string[] }
- | { op: "updateClip"; clipId: string; patch: ClipPatch }
- | { op: "setClipSpeed"; clipId: string; speed: number }
- | {
- op: "setClipTransform";
- clipId: string;
- scale?: number;
- offsetX?: number;
- offsetY?: number;
- rotation?: number;
- }
- | { op: "detachAudio"; clipId: string }
- | { op: "reattachAudio"; clipId: string }
- | { op: "addTrack" }
- | { op: "removeTrack"; trackId: string }
- | { op: "renameTrack"; trackId: string; name: string }
- | { op: "setTrackFlag"; trackId: string; flag: "visible" | "muted"; value: boolean }
- | { op: "addTimeline" }
- | { op: "removeTimeline"; timelineId: string }
- | { op: "renameTimeline"; timelineId: string; name: string }
- | { op: "selectTimeline"; timelineId: string }
- | { op: "addFont"; family: string; path: string }
- | { op: "removeFont"; family: string };
+export type EditorView = Omit<EngineEditorView, "project"> & { project: EditorProject };
// ── selectors ────────────────────────────────────────────────────────────────
diff --git a/desktop/src/lib/engine.ts b/desktop/src/lib/engine.ts
index fa820cf2..292f46ac 100644
--- a/desktop/src/lib/engine.ts
+++ b/desktop/src/lib/engine.ts
@@ -5,13 +5,18 @@
* `@tauri-apps/api/core` for commands, so when a command's shape changes there
* is exactly one place to fix and the compiler finds every call site.
*
- * The types here mirror the serde structs in `src-tauri/src/lib.rs`. Keep them
- * in step - the IPC boundary is JSON, so TypeScript cannot check it for you.
+ * The engine-owned wire types (`EditorView`, `EditorCommand`, `ExportClip`,
+ * ...) are generated from the Rust serde structs by ts-rs and re-exported
+ * from `./generated/` - see the README there - so the compiler checks the
+ * IPC boundary against the source of truth. The smaller host-only shapes
+ * (probe results, template info, transcriber status) are still hand-mirrored
+ * here; keep those in step with `src-tauri/src/*.rs`.
*/
import { invoke } from "@tauri-apps/api/core";
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
import type { EditorCommand, EditorView, NewMedia } from "./editor";
+import type { ExportClip } from "./generated/export/ExportClip";
export interface VideoStreamInfo {
index: number;
@@ -325,48 +330,12 @@ export async function templatePoster(path: string): Promise<ArrayBuffer> {
return invoke<ArrayBuffer>("template_poster", { path });
}
-/** One clip, flattened for the exporter. */
-export interface ExportClip {
- path: string;
- kind: "video" | "audio" | "image";
- start: number;
- duration: number;
- sourceStart: number;
- /** Index into the track stack, zero being bottom-most. */
- track: number;
- hidden: boolean;
- muted: boolean;
- /** Linear gain, 1 being unity. */
- volume: number;
- fadeIn: number;
- fadeOut: number;
- /** FFmpeg filter chain, or empty for none. */
- filterChain: string;
- /** Playback rate, 1 being normal. */
- speed: number;
- preservePitch: boolean;
- /** Multiplier over the fitted size. 1 fills the frame, preserving aspect. */
- scale: number;
- /** Offset of the picture's centre from frame centre, frame-width fraction. */
- offsetX: number;
- /** Offset as a frame-height fraction. */
- offsetY: number;
- /** Clockwise rotation in degrees. */
- rotation: number;
- /** Blend strength over the layers beneath, 1 being solid. */
- opacity: number;
- /** FFmpeg video filter chain from the Effects tab, or empty for none. */
- videoFilterChain: string;
- /** The transition on the cut into this clip, or null. The host resolves the
- * pair by adjacency and does all the overlap arithmetic. */
- transition: { kind: string; duration: number } | null;
- /** The source's pixel size, when known - what makes an aspect-correct fit possible. */
- mediaWidth: number | null;
- mediaHeight: number | null;
- /** Whether the file carries an audio stream - the document knows from
- * import, and sending it saves the exporter a probe per file. */
- hasAudio: boolean;
-}
+/**
+ * One clip, flattened for the exporter - generated from the engine's own
+ * `wolfcut_export::ExportClip` (see ./generated/README.md), so the UI's
+ * rasterised title overlays are typed by the struct that deserialises them.
+ */
+export type { ExportClip } from "./generated/export/ExportClip";
export interface ExportRequest {
output: string;
diff --git a/desktop/src/lib/generated/AppliedFilter.ts b/desktop/src/lib/generated/AppliedFilter.ts
new file mode 100644
index 00000000..3f108a69
--- /dev/null
+++ b/desktop/src/lib/generated/AppliedFilter.ts
@@ -0,0 +1,22 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * One applied audio filter or video effect: a catalogue id plus whatever
+ * parameters were set. The catalogues themselves (and the FFmpeg strings
+ * they build) live in the UI today; the model only stores the numbers.
+ */
+export type AppliedFilter = {
+/**
+ * Which catalogue entry this is, e.g. "sepia". Not minted; an id the
+ * catalogue no longer knows is simply skipped at render time.
+ */
+id: string,
+/**
+ * The user's knob settings, keyed by parameter name. Missing keys mean
+ * the catalogue's defaults; ordered so serialisation is stable.
+ */
+params: { [key in string]: number },
+/**
+ * False bypasses without losing settings. Absent means enabled.
+ */
+enabled?: boolean, };
diff --git a/desktop/src/lib/generated/Clip.ts b/desktop/src/lib/generated/Clip.ts
new file mode 100644
index 00000000..2d8b6582
--- /dev/null
+++ b/desktop/src/lib/generated/Clip.ts
@@ -0,0 +1,114 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { AppliedFilter } from "./AppliedFilter";
+import type { ClipKind } from "./ClipKind";
+import type { TextStyle } from "./TextStyle";
+import type { Transition } from "./Transition";
+
+/**
+ * One placed piece of a timeline: a stretch of media (or a title) with its
+ * timing, mix, transform, and effects. Everything an edit decision touches
+ * lives here, which is why most commands are clip commands.
+ */
+export type Clip = {
+/**
+ * Minted by the editor ("c1", "c2", ...); how every command names its
+ * target. Survives splits - the head keeps the id - and merges.
+ */
+id: string,
+/**
+ * The lane this clip sits on. Always a track of the same timeline; the
+ * reader drops clips whose track vanished.
+ */
+trackId: string,
+/**
+ * Empty for a text clip, which has no file behind it.
+ */
+mediaId: string,
+/**
+ * Display label. Snapshotted from the media's name (or a title's first
+ * line) at creation, then the user's to change.
+ */
+name: string,
+/**
+ * What this clip renders as. Follows the media's kind, and is rewritten
+ * when a template slot is filled with a different kind of file.
+ */
+kind: ClipKind,
+/**
+ * Seconds from the start of the timeline.
+ */
+start: number,
+/**
+ * Seconds of timeline the clip occupies. Source seconds divided by
+ * `speed`; never below a sixtieth of a second.
+ */
+duration: number,
+/**
+ * In-point: how far into the media the clip starts.
+ */
+sourceStart: number,
+/**
+ * Linear gain, 1 being unity.
+ */
+volume: number,
+/**
+ * Seconds of audio ramp-in from silence at the head. Zero for none.
+ */
+fadeIn: number,
+/**
+ * Seconds of audio ramp-out to silence at the tail. Zero for none.
+ */
+fadeOut: number,
+/**
+ * Multiplier over the fitted size. 1 fills the frame, preserving aspect.
+ */
+scale: number,
+/**
+ * Offset from centred, as a fraction of frame width / height.
+ */
+offsetX: number,
+/**
+ * The vertical half of `offset_x`'s pair; positive moves down.
+ */
+offsetY: number,
+/**
+ * Clockwise rotation in degrees, about the picture's centre.
+ */
+rotation: number,
+/**
+ * Blend strength over whatever is beneath, in 0..1.
+ */
+opacity: number,
+/**
+ * Playback rate. 1 is normal.
+ */
+speed: number,
+/**
+ * Keep voices at their natural pitch when `speed` is not 1. On by
+ * default; off gives the tape-machine chipmunk/slow-motion sound.
+ */
+preservePitch: boolean,
+/**
+ * Audio filters, in order - order is audible.
+ */
+filters: Array<AppliedFilter>,
+/**
+ * Video effects, in order - the visual sibling of `filters`.
+ */
+videoEffects: Array<AppliedFilter>,
+/**
+ * True when a video clip's embedded audio is detached out of it.
+ */
+muted?: boolean,
+/**
+ * On a detached audio clip: the video clip the sound came from.
+ */
+detachedFrom?: string,
+/**
+ * The transition on the cut into this clip, if any.
+ */
+transitionIn?: Transition,
+/**
+ * The overlay, when this is a text clip.
+ */
+text?: TextStyle, };
diff --git a/desktop/src/lib/generated/ClipKind.ts b/desktop/src/lib/generated/ClipKind.ts
new file mode 100644
index 00000000..baca2cc6
--- /dev/null
+++ b/desktop/src/lib/generated/ClipKind.ts
@@ -0,0 +1,7 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * What a clip can be - wider than [`MediaKind`] because a text clip has no
+ * file behind it; it *is* its own content.
+ */
+export type ClipKind = "video" | "audio" | "image" | "text";
diff --git a/desktop/src/lib/generated/ClipMove.ts b/desktop/src/lib/generated/ClipMove.ts
new file mode 100644
index 00000000..d0d97375
--- /dev/null
+++ b/desktop/src/lib/generated/ClipMove.ts
@@ -0,0 +1,20 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * Where one clip is going, in a multi-clip move.
+ */
+export type ClipMove = {
+/**
+ * The clip to move. An unknown id is skipped, not an error - the rest
+ * of the batch of moves still lands.
+ */
+clipId: string,
+/**
+ * New timeline position in seconds, floored at 0.
+ */
+start: number,
+/**
+ * Destination track. An unknown id moves the clip in time but leaves it
+ * on its current track.
+ */
+trackId: string, };
diff --git a/desktop/src/lib/generated/ClipPatch.ts b/desktop/src/lib/generated/ClipPatch.ts
new file mode 100644
index 00000000..275c023b
--- /dev/null
+++ b/desktop/src/lib/generated/ClipPatch.ts
@@ -0,0 +1,56 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { AppliedFilter } from "./AppliedFilter";
+import type { TextStyle } from "./TextStyle";
+import type { Transition } from "./Transition";
+
+/**
+ * A partial update to one clip. Every field optional; `transition_in` and
+ * `text` are double-optional so "clear it" and "leave it alone" stay
+ * distinct on the wire (absent = untouched, null = cleared).
+ */
+export type ClipPatch = {
+/**
+ * New display name, taken verbatim. A later `text` patch overwrites it
+ * with the title's first line.
+ */
+name?: string,
+/**
+ * New gain; floored at 0, deliberately not capped at 1 - boosting quiet
+ * footage is legitimate.
+ */
+volume?: number,
+/**
+ * New fade-in length in seconds, floored at 0.
+ */
+fadeIn?: number,
+/**
+ * New fade-out length in seconds, floored at 0.
+ */
+fadeOut?: number,
+/**
+ * New opacity, clamped into 0..=1.
+ */
+opacity?: number,
+/**
+ * New pitch-preservation setting, taken as sent.
+ */
+preservePitch?: boolean,
+/**
+ * Wholesale replacement of the audio filter chain - the UI sends the
+ * full list, not a diff.
+ */
+filters?: Array<AppliedFilter>,
+/**
+ * Wholesale replacement of the video effect chain, like `filters`.
+ */
+videoEffects?: Array<AppliedFilter>,
+/**
+ * The transition on the cut into the clip: absent leaves it alone,
+ * null clears it, a value replaces it.
+ */
+transitionIn?: Transition | null,
+/**
+ * The title styling, same three-way wire semantics as `transition_in`.
+ * Setting a style also renames the clip after its first line.
+ */
+text?: TextStyle | null, };
diff --git a/desktop/src/lib/generated/Command.ts b/desktop/src/lib/generated/Command.ts
new file mode 100644
index 00000000..d168bebe
--- /dev/null
+++ b/desktop/src/lib/generated/Command.ts
@@ -0,0 +1,217 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { ClipMove } from "./ClipMove";
+import type { ClipPatch } from "./ClipPatch";
+import type { NewMedia } from "./NewMedia";
+import type { TextStyle } from "./TextStyle";
+import type { TrackFlag } from "./TrackFlag";
+import type { TrimEdge } from "./TrimEdge";
+
+/**
+ * Every edit, as the UI sends it over IPC: a tagged `op` plus camelCase
+ * fields. [`apply`] is the single place each variant's meaning lives; the
+ * notes here state the contract - clamps, tolerances, what gets minted -
+ * so a caller need not read `apply` to know what a command will do.
+ */
+export type Command = { "op": "addMedia",
+/**
+ * The probed file, as described by the host.
+ */
+item: NewMedia, } | { "op": "removeMedia",
+/**
+ * The bin item to remove. An unknown id is a no-op.
+ */
+mediaId: string, } | { "op": "setMediaPlaceholder",
+/**
+ * The bin item to mark. An unknown id is a no-op.
+ */
+mediaId: string,
+/**
+ * True to make it a slot, false to make it ordinary media again.
+ */
+placeholder: boolean, } | { "op": "fillSlot",
+/**
+ * The slot being filled - must have `placeholder` set.
+ */
+mediaId: string,
+/**
+ * The user's file that takes the slot's place.
+ */
+item: NewMedia, } | { "op": "batch",
+/**
+ * The commands, applied in order. Nesting is legal.
+ */
+commands: Array<Command>, } | { "op": "addClip",
+/**
+ * The bin item to cut from.
+ */
+mediaId: string,
+/**
+ * The lane to place it on.
+ */
+trackId: string,
+/**
+ * Timeline position in seconds, floored at 0.
+ */
+start: number, } | { "op": "addClipAtFirstFree",
+/**
+ * The bin item to cut from.
+ */
+mediaId: string,
+/**
+ * Timeline position in seconds, floored at 0.
+ */
+start: number, } | { "op": "addTextClip",
+/**
+ * The lane to place it on. None picks the first free track like
+ * [`Command::AddClipAtFirstFree`]; naming a vanished track errs.
+ */
+trackId: string | null,
+/**
+ * Timeline position in seconds, floored at 0.
+ */
+start: number,
+/**
+ * The words and their look. None means [`TextStyle::default`].
+ */
+style: TextStyle | null,
+/**
+ * Seconds on the timeline; the editorial default when absent. Here
+ * so a caption run can land as one batch instead of add-then-trim
+ * per clip - a batch cannot trim a clip whose id it cannot know yet.
+ */
+duration?: number,
+/**
+ * Vertical placement as a frame-height fraction, clamped like
+ * SetClipTransform. Lower thirds are made of this.
+ */
+offsetY?: number, } | { "op": "moveClips",
+/**
+ * Where each clip is going.
+ */
+moves: Array<ClipMove>, } | { "op": "trimClip",
+/**
+ * The clip to trim.
+ */
+clipId: string,
+/**
+ * Which edge is being dragged.
+ */
+edge: TrimEdge,
+/**
+ * Signed seconds of timeline the edge moves: positive drags the
+ * head right (shortening) or the tail right (lengthening).
+ */
+delta: number, } | { "op": "splitClips",
+/**
+ * The clips under the playhead - normally the selection.
+ */
+clipIds: Array<string>,
+/**
+ * The cut point, in timeline seconds.
+ */
+time: number, } | { "op": "mergeClips",
+/**
+ * The pieces to rejoin, any order.
+ */
+clipIds: Array<string>, } | { "op": "removeClips",
+/**
+ * The clips to delete.
+ */
+clipIds: Array<string>, } | { "op": "updateClip",
+/**
+ * The clip to patch.
+ */
+clipId: string,
+/**
+ * Which properties change, and to what.
+ */
+patch: ClipPatch, } | { "op": "setClipSpeed",
+/**
+ * The clip to retime. An unknown id is a no-op.
+ */
+clipId: string,
+/**
+ * The new rate, clamped into 0.0625..=16 (the engine's range).
+ */
+speed: number, } | { "op": "setClipTransform",
+/**
+ * The clip to place. An unknown id is a no-op.
+ */
+clipId: string,
+/**
+ * New scale, clamped into 0.05..=8.
+ */
+scale?: number,
+/**
+ * New horizontal offset as a frame-width fraction, clamped to ±3.
+ */
+offsetX?: number,
+/**
+ * New vertical offset as a frame-height fraction, clamped to ±3.
+ */
+offsetY?: number,
+/**
+ * New rotation in degrees, wrapped into (-180, 180] so a full drag
+ * never accumulates turns.
+ */
+rotation?: number, } | { "op": "detachAudio",
+/**
+ * The video clip to detach from.
+ */
+clipId: string, } | { "op": "reattachAudio",
+/**
+ * The video clip - or its detached sound.
+ */
+clipId: string, } | { "op": "addTrack" } | { "op": "removeTrack",
+/**
+ * The lane to delete.
+ */
+trackId: string, } | { "op": "renameTrack",
+/**
+ * The lane to rename.
+ */
+trackId: string,
+/**
+ * The new label; trimmed before it lands.
+ */
+name: string, } | { "op": "setTrackFlag",
+/**
+ * The lane to change.
+ */
+trackId: string,
+/**
+ * Which toggle: visibility or mute.
+ */
+flag: TrackFlag,
+/**
+ * The new setting.
+ */
+value: boolean, } | { "op": "addTimeline" } | { "op": "removeTimeline",
+/**
+ * The timeline to delete. An unknown id is a no-op.
+ */
+timelineId: string, } | { "op": "renameTimeline",
+/**
+ * The timeline to rename.
+ */
+timelineId: string,
+/**
+ * The new tab label; trimmed before it lands.
+ */
+name: string, } | { "op": "selectTimeline",
+/**
+ * The timeline to switch to.
+ */
+timelineId: string, } | { "op": "addFont",
+/**
+ * The family name titles will refer to.
+ */
+family: string,
+/**
+ * Where the font file lives on disk.
+ */
+path: string, } | { "op": "removeFont",
+/**
+ * The family to unregister.
+ */
+family: string, };
diff --git a/desktop/src/lib/generated/CustomFont.ts b/desktop/src/lib/generated/CustomFont.ts
new file mode 100644
index 00000000..71b3339e
--- /dev/null
+++ b/desktop/src/lib/generated/CustomFont.ts
@@ -0,0 +1,16 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * A font the user added from disk.
+ */
+export type CustomFont = {
+/**
+ * The family name titles refer to; removal leaves referring clips
+ * untouched so the face can come back when the file does.
+ */
+family: string,
+/**
+ * Where the font file lives on disk. Doubles as the duplicate check
+ * when adding.
+ */
+path: string, };
diff --git a/desktop/src/lib/generated/EditorView.ts b/desktop/src/lib/generated/EditorView.ts
new file mode 100644
index 00000000..9b6dd126
--- /dev/null
+++ b/desktop/src/lib/generated/EditorView.ts
@@ -0,0 +1,19 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { Project } from "./Project";
+import type { SettingsView } from "./SettingsView";
+
+/**
+ * What every mutating call returns: the authoritative state plus history
+ * availability, so the UI's undo/redo affordances are never guessing.
+ */
+export type EditorView = { project: Project, canUndo: boolean, canRedo: boolean,
+/**
+ * The settings as the session holds them - the document's own output
+ * size wins over the manifest's on open, exactly as the old loader
+ * preferred it.
+ */
+settings: SettingsView,
+/**
+ * The id a creating command minted, if any.
+ */
+createdId?: string, };
diff --git a/desktop/src/lib/generated/MediaItem.ts b/desktop/src/lib/generated/MediaItem.ts
new file mode 100644
index 00000000..a6e684f4
--- /dev/null
+++ b/desktop/src/lib/generated/MediaItem.ts
@@ -0,0 +1,68 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { MediaKind } from "./MediaKind";
+
+/**
+ * One entry in the media bin: a file the user imported, plus what the host's
+ * probe learned about it. The probe metadata is stored, not re-derived, so a
+ * document opens meaningfully even when the file itself is missing.
+ */
+export type MediaItem = {
+/**
+ * Minted by the editor ("m1", "m2", ...) and never re-issued, even
+ * across a save/load - clips reference media by this id.
+ */
+id: string,
+/**
+ * Absolute path on the user's disk. Doubles as the duplicate check:
+ * adding the same path twice is a no-op.
+ */
+path: string,
+/**
+ * Display name in the bin, normally the file's basename.
+ */
+name: string,
+/**
+ * Seconds. None when the container did not say.
+ */
+duration: number | null,
+/**
+ * What the probe decided the file is; fixes which [`ClipKind`] its
+ * clips get.
+ */
+kind: MediaKind,
+/**
+ * Pixel width, when the file has pictures and the probe found one.
+ */
+width: number | null,
+/**
+ * Pixel height, same terms as `width`.
+ */
+height: number | null,
+/**
+ * Frames per second as a decimal - convenient for display, not exact.
+ */
+frameRate: number | null,
+/**
+ * The exact fraction the engine works in, e.g. "30000/1001".
+ */
+frameRateFraction: string | null,
+/**
+ * Codec name as the probe reported it, e.g. "h264". Informational.
+ */
+videoCodec: string | null,
+/**
+ * Codec of the embedded audio, when there is any.
+ */
+audioCodec: string | null,
+/**
+ * Whether the file carries an audio stream; gates `DetachAudio`.
+ */
+hasAudio: boolean,
+/**
+ * True when this item is a template slot: a stand-in whose metadata says
+ * what kind of media belongs here, waiting to be replaced by the user's
+ * own file (`Command::FillSlot`). In a creator's own project the path is
+ * still real; only a packed template bundle blanks it. Skipped when
+ * false, so documents without templates stay byte-identical.
+ */
+placeholder?: boolean, };
diff --git a/desktop/src/lib/generated/MediaKind.ts b/desktop/src/lib/generated/MediaKind.ts
new file mode 100644
index 00000000..2f6cf46f
--- /dev/null
+++ b/desktop/src/lib/generated/MediaKind.ts
@@ -0,0 +1,7 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * What a piece of media is. A still is not a video with one frame: it has no
+ * intrinsic duration, so its length on a timeline is editorial.
+ */
+export type MediaKind = "video" | "audio" | "image";
diff --git a/desktop/src/lib/generated/NewMedia.ts b/desktop/src/lib/generated/NewMedia.ts
new file mode 100644
index 00000000..979b4907
--- /dev/null
+++ b/desktop/src/lib/generated/NewMedia.ts
@@ -0,0 +1,53 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { MediaKind } from "./MediaKind";
+
+/**
+ * A media item as probed by the host, before the model mints its id.
+ */
+export type NewMedia = {
+/**
+ * Absolute path on disk. Adding a path already in the bin is a no-op,
+ * so re-imports cannot duplicate media.
+ */
+path: string,
+/**
+ * Display name for the bin, normally the file's basename.
+ */
+name: string,
+/**
+ * Seconds, or None when the container did not report one - clips of
+ * such media get a five-second fallback length.
+ */
+duration: number | null,
+/**
+ * What the host's probe decided the file is.
+ */
+kind: MediaKind,
+/**
+ * Pixel width, when the probe found one.
+ */
+width: number | null,
+/**
+ * Pixel height, same terms as `width`.
+ */
+height: number | null,
+/**
+ * Frames per second as a decimal, for display.
+ */
+frameRate: number | null,
+/**
+ * The exact rate fraction the engine works in, e.g. "30000/1001".
+ */
+frameRateFraction: string | null,
+/**
+ * Codec name as probed, e.g. "h264". Informational.
+ */
+videoCodec: string | null,
+/**
+ * Codec of the embedded audio, when there is any.
+ */
+audioCodec: string | null,
+/**
+ * Whether the file carries an audio stream.
+ */
+hasAudio: boolean, };
diff --git a/desktop/src/lib/generated/Outcome.ts b/desktop/src/lib/generated/Outcome.ts
new file mode 100644
index 00000000..05ee8d1d
--- /dev/null
+++ b/desktop/src/lib/generated/Outcome.ts
@@ -0,0 +1,20 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * What a command produced, beyond the new state: the ids it minted, so the
+ * UI can select what it just created, and whether anything changed at all.
+ */
+export type Outcome = {
+/**
+ * The id of what the command created - a clip, track, timeline, or
+ * media item - or, for a batch, the last id minted inside it. Absent
+ * when nothing was created, including tolerated no-ops.
+ */
+createdId?: string,
+/**
+ * Whether the command actually changed the project. A tolerated no-op -
+ * a missing id, a field set to the value it already had - succeeds but
+ * reports false, which is how the editor knows not to record an undo
+ * snapshot for it. For a batch: whether any member changed anything.
+ */
+applied: boolean, };
diff --git a/desktop/src/lib/generated/Project.ts b/desktop/src/lib/generated/Project.ts
new file mode 100644
index 00000000..6addb1af
--- /dev/null
+++ b/desktop/src/lib/generated/Project.ts
@@ -0,0 +1,28 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { CustomFont } from "./CustomFont";
+import type { MediaItem } from "./MediaItem";
+import type { Timeline } from "./Timeline";
+
+/**
+ * The edit: everything the document stores except the app-level settings
+ * (name, output format) that the host manages around it.
+ */
+export type Project = {
+/**
+ * The bin: every imported file, shared by all timelines.
+ */
+media: Array<MediaItem>,
+/**
+ * Fonts the user added from disk, available to every title.
+ */
+fonts: Array<CustomFont>,
+/**
+ * Every timeline, in tab order. Always at least one.
+ */
+timelines: Array<Timeline>,
+/**
+ * Which timeline commands act on. Maintained by the command layer, so
+ * it always names a member of `timelines`; [`Project::active`] degrades
+ * to the first timeline if it somehow does not.
+ */
+activeTimelineId: string, };
diff --git a/desktop/src/lib/generated/README.md b/desktop/src/lib/generated/README.md
new file mode 100644
index 00000000..4fe0f8ab
--- /dev/null
+++ b/desktop/src/lib/generated/README.md
@@ -0,0 +1,40 @@
+# Generated IPC types
+
+Every `.ts` file in this directory is **generated from the Rust wire types**
+by [ts-rs](https://github.com/Aleph-Alpha/ts-rs) - do not edit them by hand.
+The Rust structs and enums are the source of truth:
+
+- `engine/crates/wolfcut-project` - the document model and the whole command
+ vocabulary (`Command`, `Clip`, `Project`, ...).
+- `engine/crates/wolfcut-export` - the flattened clip the UI sends as a
+ rasterised title overlay (`export/ExportClip.ts`).
+- `desktop/src-tauri/src/editor_api.rs` - the host's own wire types
+ (`EditorView`, `SettingsView`).
+
+`desktop/src/lib/editor.ts` and `engine.ts` re-export these under the names
+the UI has always used (`Command` as `EditorCommand`, `Timeline` as
+`TimelineData`, and so on), so nothing else imports from here directly.
+
+## Regenerating
+
+After changing any `#[ts(export)]` type, run from the repository root:
+
+```sh
+scripts/generate-ipc-types.sh # everything
+scripts/generate-ipc-types.sh engine # just the engine crates
+scripts/generate-ipc-types.sh host # just desktop/src-tauri
+```
+
+which is shorthand for (the export dir must be absolute):
+
+```sh
+export TS_RS_EXPORT_DIR="$PWD/desktop/src/lib/generated"
+(cd engine && cargo test -p wolfcut-project -p wolfcut-export \
+ --features wolfcut-project/types,wolfcut-export/types export_bindings)
+(cd desktop/src-tauri && cargo test --features types export_bindings)
+```
+
+The files are committed, and CI regenerates them and fails on any diff - so a
+Rust wire-type change that forgets to regenerate cannot land green. ts-rs
+never deletes files: if a Rust type is renamed or removed, delete its stale
+`.ts` file here by hand.
diff --git a/desktop/src/lib/generated/SettingsView.ts b/desktop/src/lib/generated/SettingsView.ts
new file mode 100644
index 00000000..66f31d57
--- /dev/null
+++ b/desktop/src/lib/generated/SettingsView.ts
@@ -0,0 +1,3 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+export type SettingsView = { name: string, width: number, height: number, rateNum: number, rateDen: number, };
diff --git a/desktop/src/lib/generated/TextAlign.ts b/desktop/src/lib/generated/TextAlign.ts
new file mode 100644
index 00000000..3d803936
--- /dev/null
+++ b/desktop/src/lib/generated/TextAlign.ts
@@ -0,0 +1,7 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * How a title's lines sit within their block. The block itself is placed by
+ * the clip's transform, so this only matters for multi-line text.
+ */
+export type TextAlign = "left" | "center" | "right";
diff --git a/desktop/src/lib/generated/TextStyle.ts b/desktop/src/lib/generated/TextStyle.ts
new file mode 100644
index 00000000..00043731
--- /dev/null
+++ b/desktop/src/lib/generated/TextStyle.ts
@@ -0,0 +1,71 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { TextAlign } from "./TextAlign";
+
+/**
+ * A title's styling. Sizes are fractions of the frame, so a title composed
+ * against 1080p lands correctly exported at 4K.
+ */
+export type TextStyle = {
+/**
+ * The words themselves, newlines included. The clip's display name is
+ * snapshotted from the first non-empty line.
+ */
+content: string,
+/**
+ * CSS-style family name, quotes included where the name needs them,
+ * e.g. `"Cabinet Grotesk"`. May name a [`CustomFont`] the user added.
+ */
+fontFamily: string,
+/**
+ * Cap height as a fraction of frame height.
+ */
+fontSize: number,
+/**
+ * CSS-scale weight, 100..=900; the reader clamps hand-edited values
+ * into that range.
+ */
+fontWeight: number,
+/**
+ * Italic when true. A style flag, not a separate face.
+ */
+italic: boolean,
+/**
+ * Fill colour as a CSS hex string, e.g. "#ffffff".
+ */
+color: string,
+/**
+ * Line alignment within the block; see [`TextAlign`].
+ */
+align: TextAlign,
+/**
+ * Opacity of the whole title in 0..=1, multiplied with the clip's own
+ * opacity.
+ */
+opacity: number,
+/**
+ * Outline thickness as a fraction of frame height. Zero - the default -
+ * means no stroke.
+ */
+strokeWidth: number,
+/**
+ * Outline colour, only visible when `stroke_width` is non-zero.
+ */
+strokeColor: string,
+/**
+ * A drop shadow for legibility over footage. On by default.
+ */
+shadow: boolean,
+/**
+ * A solid plate behind the text. Empty string for none.
+ */
+background: string,
+/**
+ * Baseline spacing as a multiple of the font size; the reader floors it
+ * at 0.5 so lines cannot collapse onto each other.
+ */
+lineHeight: number,
+/**
+ * Extra letter spacing, in the same frame-height fractions as
+ * `font_size`. Zero is the font's natural fit.
+ */
+tracking: number, };
diff --git a/desktop/src/lib/generated/Timeline.ts b/desktop/src/lib/generated/Timeline.ts
new file mode 100644
index 00000000..6021cd28
--- /dev/null
+++ b/desktop/src/lib/generated/Timeline.ts
@@ -0,0 +1,29 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { Clip } from "./Clip";
+import type { Track } from "./Track";
+
+/**
+ * One timeline: a name and its lanes and clips. Unlike the UI's provisional
+ * model there is no "shelf" - that split existed only so the TypeScript
+ * operations could stay ignorant of timelines. Here every operation takes
+ * the project and works on whichever timeline is active.
+ */
+export type Timeline = {
+/**
+ * Minted by the editor ("tl2", ...), except the founding "TL1".
+ */
+id: string,
+/**
+ * The tab label; "Timeline N" by default, renameable but never blank.
+ */
+name: string,
+/**
+ * The lanes, top to bottom. Never empty - `RemoveTrack` keeps a floor
+ * of one.
+ */
+tracks: Array<Track>,
+/**
+ * Every clip on this timeline, in insertion order, not time order -
+ * readers must sort by `start` where order matters.
+ */
+clips: Array<Clip>, };
diff --git a/desktop/src/lib/generated/Track.ts b/desktop/src/lib/generated/Track.ts
new file mode 100644
index 00000000..b19af3bb
--- /dev/null
+++ b/desktop/src/lib/generated/Track.ts
@@ -0,0 +1,24 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * A lane. Deliberately untyped: any media goes on any track.
+ */
+export type Track = {
+/**
+ * Minted per timeline ("t5", or "T1".."T4" for the first timeline's
+ * starter lanes); never shared between timelines.
+ */
+id: string,
+/**
+ * User-editable label. Renames to whitespace are ignored, so it is
+ * never blank.
+ */
+name: string,
+/**
+ * Video clips on this track are left out of the composite when false.
+ */
+visible: boolean,
+/**
+ * Audio on this track is silent when true.
+ */
+muted: boolean, };
diff --git a/desktop/src/lib/generated/TrackFlag.ts b/desktop/src/lib/generated/TrackFlag.ts
new file mode 100644
index 00000000..90c60666
--- /dev/null
+++ b/desktop/src/lib/generated/TrackFlag.ts
@@ -0,0 +1,6 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * Which per-track toggle a [`Command::SetTrackFlag`] flips.
+ */
+export type TrackFlag = "visible" | "muted";
diff --git a/desktop/src/lib/generated/Transition.ts b/desktop/src/lib/generated/Transition.ts
new file mode 100644
index 00000000..48d7659a
--- /dev/null
+++ b/desktop/src/lib/generated/Transition.ts
@@ -0,0 +1,14 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * A transition on the cut into a clip.
+ */
+export type Transition = {
+/**
+ * Which transition from the catalogue, e.g. "cross-fade".
+ */
+id: string,
+/**
+ * Seconds the transition covers.
+ */
+duration: number, };
diff --git a/desktop/src/lib/generated/TrimEdge.ts b/desktop/src/lib/generated/TrimEdge.ts
new file mode 100644
index 00000000..41bba0ad
--- /dev/null
+++ b/desktop/src/lib/generated/TrimEdge.ts
@@ -0,0 +1,7 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * Which end of a clip a trim drags. The two are not symmetric: see
+ * [`Command::TrimClip`].
+ */
+export type TrimEdge = "start" | "end";
diff --git a/desktop/src/lib/generated/export/ClipKind.ts b/desktop/src/lib/generated/export/ClipKind.ts
new file mode 100644
index 00000000..f8113ce3
--- /dev/null
+++ b/desktop/src/lib/generated/export/ClipKind.ts
@@ -0,0 +1,7 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * What a flattened clip is. Typed, so a kind check the compiler has not
+ * seen cannot exist - the wire still says "video"/"audio"/"image".
+ */
+export type ClipKind = "video" | "audio" | "image";
diff --git a/desktop/src/lib/generated/export/ExportClip.ts b/desktop/src/lib/generated/export/ExportClip.ts
new file mode 100644
index 00000000..2e37db0a
--- /dev/null
+++ b/desktop/src/lib/generated/export/ExportClip.ts
@@ -0,0 +1,117 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+import type { ClipKind } from "./ClipKind";
+import type { TransitionSpec } from "./TransitionSpec";
+
+/**
+ * One clip, as the frontend's flattener describes it.
+ */
+export type ExportClip = {
+/**
+ * The media file this clip shows or plays.
+ */
+path: string,
+/**
+ * Whether the clip is footage, sound or a still.
+ */
+kind: ClipKind,
+/**
+ * Seconds into the timeline where the clip begins.
+ */
+start: number,
+/**
+ * Seconds of timeline the clip covers.
+ */
+duration: number,
+/**
+ * Seconds into the source where playback begins.
+ */
+sourceStart: number,
+/**
+ * Index into the track stack, zero being bottom-most.
+ */
+track: number,
+/**
+ * The track's picture is switched off.
+ */
+hidden: boolean,
+/**
+ * The track's sound is switched off.
+ */
+muted: boolean,
+/**
+ * Linear gain, 1 being unity.
+ */
+volume: number,
+/**
+ * Audio fade up from the clip's start, in seconds.
+ */
+fadeIn: number,
+/**
+ * Audio fade out into the clip's end, in seconds.
+ */
+fadeOut: number,
+/**
+ * FFmpeg filter chain from the Filters tab, or empty.
+ */
+filterChain: string,
+/**
+ * Playback rate. 1 is normal.
+ */
+speed: number,
+/**
+ * False lets pitch rise with the rate, like tape.
+ */
+preservePitch: boolean,
+/**
+ * Multiplier over the fitted size. 1 fills the frame, preserving aspect.
+ */
+scale: number,
+/**
+ * Offset of the picture's centre from frame centre, frame-width fraction.
+ */
+offsetX: number,
+/**
+ * Offset as a frame-height fraction.
+ */
+offsetY: number,
+/**
+ * Clockwise rotation in degrees.
+ */
+rotation: number,
+/**
+ * Blend strength over the layers beneath, 1 being solid. Defaulted for
+ * requests from a UI that predates it.
+ */
+opacity: number,
+/**
+ * FFmpeg *video* filter chain from the Effects tab, or empty. Applied at
+ * decode, after scaling - see `DecodeOptions::filter_chain`.
+ */
+videoFilterChain: string,
+/**
+ * The transition into this clip's cut, when the UI put one there. The
+ * clip before it on the same track is found here, by adjacency - the UI
+ * only says what it wants, never how to overlap decoders.
+ */
+transition?: TransitionSpec | null,
+/**
+ * Video opacity ramp up from the clip's start, in seconds. Set by
+ * transition resolution below, never by the UI directly.
+ */
+videoFadeIn?: number,
+/**
+ * The source's pixel width, when the UI knows it. What makes an
+ * aspect-correct decode possible - absent, the frame is filled edge to
+ * edge the way it always was.
+ */
+mediaWidth?: number | null,
+/**
+ * The source's pixel height; see `media_width`.
+ */
+mediaHeight?: number | null,
+/**
+ * Whether the file carries an audio stream, when the UI knows (the
+ * document records it at import). Absent falls back to probing, so an
+ * older caller still exports correctly - just slower to start.
+ */
+hasAudio?: boolean | null, };
diff --git a/desktop/src/lib/generated/export/TransitionSpec.ts b/desktop/src/lib/generated/export/TransitionSpec.ts
new file mode 100644
index 00000000..f4b697e7
--- /dev/null
+++ b/desktop/src/lib/generated/export/TransitionSpec.ts
@@ -0,0 +1,14 @@
+// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
+
+/**
+ * A transition on the cut into a clip.
+ */
+export type TransitionSpec = {
+/**
+ * "cross-fade", "fade-black" or "fade-white". Anything else is ignored.
+ */
+kind: string,
+/**
+ * Seconds the transition covers.
+ */
+duration: number, };
diff --git a/scripts/generate-ipc-types.sh b/scripts/generate-ipc-types.sh
new file mode 100755
index 00000000..5db43316
--- /dev/null
+++ b/scripts/generate-ipc-types.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# Regenerates desktop/src/lib/generated/ from the Rust wire types.
+#
+# ts-rs exports each #[ts(export)] type when its crate's tests run with the
+# `types` feature on; TS_RS_EXPORT_DIR aims all of them at one directory.
+# CI runs this and fails on `git diff`, so the committed files can never
+# drift from the Rust source of truth.
+#
+# Usage: scripts/generate-ipc-types.sh [engine|host|all]
+set -euo pipefail
+
+root="$(cd "$(dirname "$0")/.." && pwd)"
+export TS_RS_EXPORT_DIR="$root/desktop/src/lib/generated"
+
+part="${1:-all}"
+
+if [ "$part" = "engine" ] || [ "$part" = "all" ]; then
+ (cd "$root/engine" && cargo test -p wolfcut-project -p wolfcut-export \
+ --features wolfcut-project/types,wolfcut-export/types export_bindings)
+fi
+
+if [ "$part" = "host" ] || [ "$part" = "all" ]; then
+ (cd "$root/desktop/src-tauri" && cargo test --features types export_bindings)
+fi