@mengine/medeo-client 2.0.1 → 2.1.1-dsl.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,442 @@
1
+ import { a as speechIdSchema, c as timelineMsSchema, i as positiveMsSchema, l as voiceSchema, n as clipIdsSchema, o as speechIdsSchema, r as mediaIdSchema, s as speedShiftSchema, t as clipIdSchema, u as volumeSchema } from "./shared-iWnU2osE.js";
2
+ import { z } from "zod";
3
+ //#region src/editor/schemas/speech-assets.ts
4
+ /**
5
+ * The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
6
+ * `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
7
+ * §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
8
+ * stable speech + caption parts and writes them as authoritative facts. No
9
+ * cascade runs on write — the projection derives absolute positions on read.
10
+ *
11
+ * Each speech carries the anchoring fact directly (RFC 02 §4): the host video
12
+ * clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
13
+ * already knows which clip a speech attaches to, so the op writes
14
+ * `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
15
+ * host-picking. Captions anchor to their speech via the caption part's
16
+ * `start_ms` (offset within the speech).
17
+ */
18
+ const speechAssetSchema = z.object({
19
+ speech_id: speechIdSchema.describe("The speech part ID (= side-effect speech_parts[].id)"),
20
+ anchor_part_id: clipIdSchema.describe("Host video clip part ID the speech anchors to (RFC 02 §4)"),
21
+ offset_ms: timelineMsSchema.describe("Offset within the host clip (speech.abs = host.abs + offset_ms)"),
22
+ audio_storage_key: z.string().min(1),
23
+ duration_ms: positiveMsSchema,
24
+ audio_script: z.string(),
25
+ volume: volumeSchema,
26
+ voice: voiceSchema,
27
+ origin_speech_id: z.string().min(1),
28
+ caption_ids: z.array(z.string().min(1)).describe("Caption part IDs owned by this speech")
29
+ });
30
+ const captionAssetSchema = z.object({
31
+ caption_id: z.string().min(1).describe("The caption part ID (= side-effect created_caption_parts[].id)"),
32
+ speech_part_id: speechIdSchema.describe("The owning speech part ID"),
33
+ text: z.string(),
34
+ start_ms: timelineMsSchema.describe("Offset within the host speech (caption.abs = speech.abs + start_ms)"),
35
+ duration_ms: positiveMsSchema
36
+ });
37
+ /** A materialized speech-subtree write (speeches + their captions). */
38
+ const speechAssetsSchema = z.object({
39
+ speeches: z.array(speechAssetSchema).min(1).describe("Materialized speech parts to write"),
40
+ captions: z.array(captionAssetSchema).describe("Materialized caption parts owned by the speeches")
41
+ });
42
+ //#endregion
43
+ //#region src/editor/schemas/add-speeches.ts
44
+ /**
45
+ * Add speeches (and their captions). TTS runs upstream; the stable speech /
46
+ * caption parts arrive materialized (see `speech-assets.ts`). The op writes the
47
+ * parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
48
+ * verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
49
+ * derives absolute positions on read.
50
+ */
51
+ const addSpeechesInputSchema = speechAssetsSchema.describe("Materialized speeches + captions to add");
52
+ //#endregion
53
+ //#region src/editor/schemas/add-video-clips.ts
54
+ /**
55
+ * Add video clips to a track. Each clip's duration facts are separated so a
56
+ * single number is never overloaded (RFC 02 / `reference/16` §0b):
57
+ *
58
+ * - `media_duration_ms` is the source media's intrinsic full length (a resource
59
+ * fact, written to the part);
60
+ * - `play_in` / `play_out` are the optional trim window into that media; when
61
+ * omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
62
+ *
63
+ * The clip's effective timeline duration is derived by the projection from the
64
+ * trim window and `speed_shift` — it is never an input here.
65
+ */
66
+ const addVideoClipsInputSchema = z.object({
67
+ clips: z.array(z.object({
68
+ media_id: mediaIdSchema.describe("The media asset ID for the video clip"),
69
+ start_ms: timelineMsSchema.optional().describe("Absolute start time in milliseconds on the timeline"),
70
+ media_duration_ms: positiveMsSchema.describe("The source media's intrinsic full length in ms"),
71
+ play_in: timelineMsSchema.optional().describe("Trim window start in the media (default 0)"),
72
+ play_out: positiveMsSchema.optional().describe("Trim window end in the media (default media_duration_ms)"),
73
+ track_id: z.string().min(1).optional().describe("Target track ID (optional, defaults to main track)")
74
+ })).min(1).describe("List of video clips to create"),
75
+ before_clip_id: z.string().min(1).optional().describe("Insert new clips before this clip ID"),
76
+ after_clip_id: z.string().min(1).optional().describe("Insert new clips after this clip ID")
77
+ }).superRefine((data, ctx) => {
78
+ if (data.before_clip_id != null && data.after_clip_id != null) {
79
+ ctx.addIssue({
80
+ code: z.ZodIssueCode.custom,
81
+ message: "Cannot provide both before_clip_id and after_clip_id"
82
+ });
83
+ return;
84
+ }
85
+ const hasRelative = data.before_clip_id != null || data.after_clip_id != null;
86
+ for (let i = 0; i < data.clips.length; i++) {
87
+ const clip = data.clips[i];
88
+ if (hasRelative && clip.start_ms != null) ctx.addIssue({
89
+ code: z.ZodIssueCode.custom,
90
+ message: `clips[${i}].start_ms must not be provided when using before_clip_id or after_clip_id`,
91
+ path: [
92
+ "clips",
93
+ i,
94
+ "start_ms"
95
+ ]
96
+ });
97
+ if (!hasRelative && clip.start_ms == null) ctx.addIssue({
98
+ code: z.ZodIssueCode.custom,
99
+ message: `clips[${i}].start_ms is required when not using relative positioning`,
100
+ path: [
101
+ "clips",
102
+ i,
103
+ "start_ms"
104
+ ]
105
+ });
106
+ const playIn = clip.play_in ?? 0;
107
+ const playOut = clip.play_out ?? clip.media_duration_ms;
108
+ if (playOut > clip.media_duration_ms) ctx.addIssue({
109
+ code: z.ZodIssueCode.custom,
110
+ message: `clips[${i}].play_out ${playOut}ms exceeds media_duration_ms ${clip.media_duration_ms}ms`,
111
+ path: [
112
+ "clips",
113
+ i,
114
+ "play_out"
115
+ ]
116
+ });
117
+ if (playIn >= playOut) ctx.addIssue({
118
+ code: z.ZodIssueCode.custom,
119
+ message: `clips[${i}].play_in ${playIn}ms must be less than play_out ${playOut}ms`,
120
+ path: [
121
+ "clips",
122
+ i,
123
+ "play_in"
124
+ ]
125
+ });
126
+ }
127
+ });
128
+ //#endregion
129
+ //#region src/editor/schemas/adjust-bgm-volume.ts
130
+ const adjustBgmVolumeInputSchema = z.object({ bgm: z.array(z.object({
131
+ bgm_id: clipIdSchema.describe("The bgm part ID to adjust volume for"),
132
+ volume: volumeSchema.describe("Volume in decibels (-60.0 to 20.0; 0.0 = original)")
133
+ })).min(1).describe("List of bgm parts with their new volume settings") });
134
+ //#endregion
135
+ //#region src/editor/schemas/adjust-speech-volume.ts
136
+ const adjustSpeechVolumeInputSchema = z.object({ speeches: z.array(z.object({
137
+ speech_id: speechIdSchema.describe("The speech part ID to adjust volume for"),
138
+ volume: volumeSchema.describe("Volume in decibels (-60.0 to 20.0; 0.0 = original)")
139
+ })).min(1).describe("List of speeches with their new volume settings") });
140
+ //#endregion
141
+ //#region src/editor/schemas/adjust-video-clip-duration.ts
142
+ /**
143
+ * Re-trim existing video clips (the user-facing "adjust duration" gesture is a
144
+ * trim of the source window). The new `play_in` / `play_out` are the facts; the
145
+ * effective timeline duration is derived from them and the clip's `speed_shift`,
146
+ * and the change reflows downstream clips, speeches, and the timeline inside the
147
+ * op's transaction (no caller-materialized cascade).
148
+ */
149
+ const adjustVideoClipDurationInputSchema = z.object({ clips: z.array(z.object({
150
+ clip_id: clipIdSchema.describe("The video clip part ID to re-trim"),
151
+ play_in: timelineMsSchema.describe("New trim window start in the source media"),
152
+ play_out: positiveMsSchema.describe("New trim window end in the source media")
153
+ })).min(1).describe("Video clips with their new trim windows") });
154
+ //#endregion
155
+ //#region src/editor/schemas/adjust-video-clip-volume.ts
156
+ const adjustVideoClipVolumeInputSchema = z.object({ clips: z.array(z.object({
157
+ clip_id: clipIdSchema.describe("The video clip part ID to adjust volume for"),
158
+ volume: volumeSchema.describe("Volume in decibels (-60.0 to 20.0; 0.0 = original)")
159
+ })).min(1).describe("List of video clips with their new volume settings") });
160
+ //#endregion
161
+ //#region src/editor/schemas/change-speech.ts
162
+ /**
163
+ * Change a speech's script or voice. Both re-run TTS upstream and return the
164
+ * regenerated speech / caption parts in the same materialized shape as
165
+ * `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
166
+ * id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
167
+ * caption parts no longer owned by the speech are removed via `caption_ids`.
168
+ */
169
+ const changeSpeechScriptInputSchema = speechAssetsSchema.describe("Regenerated speeches + captions (new script)");
170
+ const changeSpeechVoiceInputSchema = speechAssetsSchema.describe("Regenerated speeches + captions (new voice)");
171
+ //#endregion
172
+ //#region src/editor/schemas/delete-bgm.ts
173
+ /**
174
+ * Remove the document BGM. Pure document edit: clears the bgm lane and removes
175
+ * the bgm part. Takes no input (a document holds at most one bgm); an empty
176
+ * object keeps the op signature uniform with the rest.
177
+ */
178
+ const deleteBgmInputSchema = z.object({}).describe("Remove the document BGM (no parameters)");
179
+ //#endregion
180
+ //#region src/editor/schemas/delete-speeches.ts
181
+ /**
182
+ * Delete speeches with their captions. Pure document edit (no side effect): the
183
+ * op removes each speech part, cascade-deletes the captions it owns (via
184
+ * `caption_ids` / `speech_part_id`), drops their track items, and reflows.
185
+ */
186
+ const deleteSpeechesInputSchema = z.object({ speech_ids: speechIdsSchema.describe("Speech part IDs to delete (their captions cascade-delete)") });
187
+ //#endregion
188
+ //#region src/editor/schemas/delete-video-clips.ts
189
+ /**
190
+ * How a delete handles the anchored subtree (speeches anchored to a deleted clip,
191
+ * and their captions) — a delete-op policy, not a data-model field (reference/17
192
+ * §6). `cascade` (default) removes the subtree; `detach` keeps the direct
193
+ * anchored children, re-pinning them to `absolute` so they stay on the timeline.
194
+ */
195
+ const anchoredDeletePolicySchema = z.enum(["cascade", "detach"]);
196
+ const deleteVideoClipsInputSchema = z.object({
197
+ clip_ids: clipIdsSchema.describe("List of video clip part IDs to delete from the main track"),
198
+ on_anchored: anchoredDeletePolicySchema.optional().describe("How to treat anchored children (default cascade)")
199
+ });
200
+ //#endregion
201
+ //#region src/editor/schemas/move-speeches.ts
202
+ /**
203
+ * Move speeches in time. Pure document edit: the op re-seats each speech at its
204
+ * new absolute `start_ms`; the cascade reassigns it to the host video clip,
205
+ * resolves overlaps, and reflows. Captions follow their speech.
206
+ */
207
+ const moveSpeechesInputSchema = z.object({ speeches: z.array(z.object({
208
+ speech_id: speechIdSchema.describe("The speech part ID to move"),
209
+ new_start_ms: timelineMsSchema.describe("New absolute start time on the timeline")
210
+ })).min(1).describe("Speeches to move to new positions") });
211
+ //#endregion
212
+ //#region src/editor/schemas/move-video-clips-by-anchor.ts
213
+ /**
214
+ * Where the moved block lands on the main track.
215
+ *
216
+ * A discriminated union rather than two optional `before_clip_id` /
217
+ * `after_clip_id` fields (the shape `addVideoClips` had to use, because there the
218
+ * two modes share a whole clip description): here the alternatives carry nothing
219
+ * in common, so making them mutually exclusive *by type* removes three runtime
220
+ * `superRefine` checks that would otherwise have to be written and tested.
221
+ *
222
+ * `track_start` is an explicit member, not the absence of an anchor. The
223
+ * agent-harness mutation this maps from treats "neither anchor given" as
224
+ * "move to the front" (`applyBatchMoveVideoClips` falls back to `insertIndex = 0`),
225
+ * which is a default buried in a tool description. Requiring the caller to name
226
+ * that intent keeps a forgotten field from silently reordering the timeline.
227
+ */
228
+ const moveAnchorSchema = z.discriminatedUnion("position", [
229
+ z.object({
230
+ position: z.literal("before"),
231
+ clip_id: clipIdSchema.describe("The moved block lands immediately before this clip")
232
+ }),
233
+ z.object({
234
+ position: z.literal("after"),
235
+ clip_id: clipIdSchema.describe("The moved block lands immediately after this clip")
236
+ }),
237
+ z.object({ position: z.literal("track_start") })
238
+ ]).describe("Where the moved block lands: before/after a reference clip, or at the head of the track");
239
+ /**
240
+ * What happens to the speeches anchored to the clips being moved.
241
+ *
242
+ * - `follow` keeps each speech anchored where it is, so it travels with its clip
243
+ * to the new position. In the anchored model this is the *no-op* branch: a
244
+ * speech's authoritative fact is `{ anchorPartId, offsetMs }` and its absolute
245
+ * time is derived on read from the host's position, so moving the host moves
246
+ * the speech with no write to the speech at all.
247
+ * - `keep_absolute` preserves each speech's current absolute landing instead, then
248
+ * re-anchors it to whichever clip now covers that time (RFC 02 §9.1/§11.1). This
249
+ * is the branch that costs an extra pass, and the one the FE timeline uses.
250
+ *
251
+ * **Required, with no default**, matching `deleteVideoClips` and
252
+ * `replaceVideoClipSequence`. The two branches decide which picture the user's
253
+ * narration ends up over, which is too consequential to infer from a missing
254
+ * field — and neither branch is "safe enough" to be the implicit one.
255
+ */
256
+ const movedClipAnchoredPolicySchema = z.enum(["follow", "keep_absolute"]);
257
+ /**
258
+ * Reorder a set of main-track clips relative to a reference clip.
259
+ *
260
+ * Distinct from `moveVideoClips`, which positions clips by absolute time
261
+ * (`new_start_ms`) and is what the FE timeline dispatches after a drag. Main-track
262
+ * clips are `sequential`-positioned, so absolute time is not authoritative state
263
+ * there (RFC 02 §4/§7): `moveVideoClips` has to *guess* an index back out of the
264
+ * time it was handed, whereas an anchor already is the ordinal fact being changed.
265
+ * Keeping them separate also isolates blast radius — this method can diverge on
266
+ * speech policy without touching the FE path.
267
+ *
268
+ * `clip_ids` need not be contiguous. They move as one block, keeping their
269
+ * relative order, which is the agent-harness `batch_move_video_clips` contract.
270
+ */
271
+ const moveVideoClipsByAnchorInputSchema = z.object({
272
+ clip_ids: clipIdsSchema.describe("Clips to move as one block, keeping their relative order. Need not be contiguous on the track."),
273
+ anchor: moveAnchorSchema,
274
+ on_anchored: movedClipAnchoredPolicySchema.describe("What happens to speeches anchored to the moved clips (required — see the policy doc)")
275
+ });
276
+ //#endregion
277
+ //#region src/editor/schemas/move-video-clips.ts
278
+ const moveVideoClipsInputSchema = z.object({ clips: z.array(z.object({
279
+ clip_id: clipIdSchema.describe("The video clip part ID to move"),
280
+ new_start_ms: timelineMsSchema.describe("New absolute start time in milliseconds on the timeline"),
281
+ new_track_id: z.string().min(1).optional().describe("Target track ID to move the clip to (optional)")
282
+ })).min(1).describe("List of video clips to move to new positions") });
283
+ //#endregion
284
+ //#region src/editor/schemas/replace-video-clip-content.ts
285
+ /**
286
+ * Replace the media backing existing video clips. The media import runs upstream
287
+ * (Director); its stable result — the new media id, intrinsic length, and the
288
+ * reset trim window — arrives materialized (see
289
+ * `results/phase-4-side-effect-payload-contract.md` §4). Director resets
290
+ * `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
291
+ * replacement. The clip `part_id`s (hence their track items) are unchanged; the
292
+ * editor reflows the main track from the new effective durations.
293
+ */
294
+ const replaceVideoClipContentInputSchema = z.object({ clips: z.array(z.object({
295
+ clip_id: clipIdSchema.describe("Existing video clip part ID to re-point"),
296
+ origin_media_id: mediaIdSchema.describe("The new media asset ID"),
297
+ media_duration_ms: positiveMsSchema.describe("The new media's intrinsic full length"),
298
+ play_in: timelineMsSchema.describe("Trim window start in the new media (usually 0)"),
299
+ play_out: positiveMsSchema.describe("Trim window end in the new media (usually = media_duration_ms)"),
300
+ volume: volumeSchema
301
+ })).min(1).describe("Video clips whose media is being replaced") });
302
+ //#endregion
303
+ //#region src/editor/schemas/replace-video-clip-sequence.ts
304
+ /**
305
+ * What happens to the speeches anchored to the clips being replaced.
306
+ *
307
+ * - `remap` re-anchors each surviving speech to the new clip in the SAME POSITION
308
+ * of the sequence, keeping its offset — old[i]'s children become new[i]'s
309
+ * children. An old clip with no counterpart (fewer new clips than old) has its
310
+ * subtree deleted, because there is nothing left to anchor to.
311
+ * - `cascade` deletes every anchored speech (and its captions) outright, like
312
+ * `deleteVideoClips`.
313
+ *
314
+ * **Required, with no default.** The two branches differ in whether the user's
315
+ * narration survives, and the agent tool that drives this op makes its
316
+ * `preserve_speeches` flag required for that reason. A default here would let a
317
+ * caller that forgot the field silently delete speech.
318
+ */
319
+ const anchoredReplacePolicySchema = z.enum(["remap", "cascade"]);
320
+ /**
321
+ * Replace a contiguous run of main-track clips with a new run.
322
+ *
323
+ * A composite of delete + insert that cannot be expressed as the two ops in
324
+ * sequence, because the anchored speeches have to survive *across* the swap: with
325
+ * `remap` they are re-anchored positionally, which needs both the old and the new
326
+ * ids in the same transaction (ADR 0009 — the cascade stays in the editor, callers
327
+ * never re-wire anchors themselves).
328
+ *
329
+ * Duration facts follow `addVideoClips`: `media_duration_ms` is the source's
330
+ * intrinsic length and the trim window defaults to the whole media. The effective
331
+ * timeline duration is derived by the projection, never an input.
332
+ *
333
+ * `media_id` is optional: omitting it creates a **deliberate empty placeholder
334
+ * clip** (`origin_media_id: ''`) — structure with no picture. This is the only op
335
+ * that can produce one, and it is authoritative state, unlike the gap fillers the
336
+ * read-side solve mints (which never enter the document).
337
+ */
338
+ const replaceVideoClipSequenceInputSchema = z.object({
339
+ old_clip_ids: clipIdsSchema.describe("The clips being replaced: a contiguous main-track run, listed in timeline order"),
340
+ new_clips: z.array(z.object({
341
+ media_id: mediaIdSchema.optional().describe("The replacement media asset ID. Omit to create an empty placeholder clip."),
342
+ media_duration_ms: positiveMsSchema.describe("The source media's intrinsic full length in ms"),
343
+ play_in: timelineMsSchema.optional().describe("Trim window start in the media (default 0)"),
344
+ play_out: positiveMsSchema.optional().describe("Trim window end in the media (default media_duration_ms)")
345
+ })).min(1).describe("The replacement clips, in the order they take on the track"),
346
+ on_anchored: anchoredReplacePolicySchema.describe("What happens to speeches anchored to the replaced clips (required — see the policy doc)")
347
+ }).superRefine((data, ctx) => {
348
+ for (let i = 0; i < data.new_clips.length; i++) {
349
+ const clip = data.new_clips[i];
350
+ const playIn = clip.play_in ?? 0;
351
+ const playOut = clip.play_out ?? clip.media_duration_ms;
352
+ if (playOut > clip.media_duration_ms) ctx.addIssue({
353
+ code: z.ZodIssueCode.custom,
354
+ message: `new_clips[${i}].play_out ${playOut}ms exceeds media_duration_ms ${clip.media_duration_ms}ms`,
355
+ path: [
356
+ "new_clips",
357
+ i,
358
+ "play_out"
359
+ ]
360
+ });
361
+ if (playIn >= playOut) ctx.addIssue({
362
+ code: z.ZodIssueCode.custom,
363
+ message: `new_clips[${i}].play_in ${playIn}ms must be less than play_out ${playOut}ms`,
364
+ path: [
365
+ "new_clips",
366
+ i,
367
+ "play_in"
368
+ ]
369
+ });
370
+ }
371
+ });
372
+ //#endregion
373
+ //#region src/editor/schemas/set-bgm.ts
374
+ /**
375
+ * Set the document BGM. The media's stable result (storage key) arrives
376
+ * materialized from upstream (see
377
+ * `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
378
+ * part and seats it on the bgm lane; its effective length is always the whole
379
+ * timeline, derived by the projection on read — so there is no `duration_ms`
380
+ * input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
381
+ * existing bgm part by id.
382
+ */
383
+ const setBgmInputSchema = z.object({
384
+ bgm_id: z.string().min(1).describe("The bgm part ID to write"),
385
+ audio_storage_key: z.string().min(1),
386
+ origin_media_id: mediaIdSchema,
387
+ volume: volumeSchema
388
+ });
389
+ //#endregion
390
+ //#region src/editor/schemas/set-caption-style.ts
391
+ /**
392
+ * Set the caption visual style. GLOBAL by design: the style applies to every
393
+ * caption part in the document — it carries NO `caption_id`. This mirrors the FE,
394
+ * whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
395
+ * ALL captions and writes the same normalized style to each; the product has a
396
+ * single document-wide caption style, not per-caption styling.
397
+ *
398
+ * Every field is optional and maps to a `CaptionStyle` attribute (snake_case
399
+ * IDL). A field present in the input is written to every caption; a field ABSENT
400
+ * from the input is left untouched on each caption (the editor merges the patch
401
+ * onto each caption's existing style — this is a value edit, not a full-style
402
+ * replace, so a partial patch such as "recolor only" does not wipe font size).
403
+ *
404
+ * Pure document edit, no cascade — captions keep their positions; only the style
405
+ * sub-map of each caption part changes.
406
+ */
407
+ const setCaptionStyleInputSchema = z.object({
408
+ font_id: z.string().min(1).optional().describe("Font ID referencing a font from the font library"),
409
+ font_size: z.number().positive().optional().describe("Font size in points"),
410
+ font_color: z.string().min(1).optional().describe("Font color as hex string, e.g. \"#FFFFFF\""),
411
+ font_weight: z.number().int().optional().describe("Numeric font weight, e.g. 400 or 700"),
412
+ entrance_animation: z.string().optional().describe("Entrance animation preset ID, e.g. \"fade\" or \"none\""),
413
+ entrance_animation_duration_ms: z.number().min(0).optional().describe("Entrance animation duration in ms"),
414
+ stroke_color: z.string().min(1).optional().describe("Outline/stroke color as hex string, e.g. \"#000000\""),
415
+ stroke_width: z.number().min(0).optional().describe("Outline/stroke width in pixels"),
416
+ position_x: z.number().optional().describe("Caption center X as a fraction (0.0 to 1.0)"),
417
+ position_y: z.number().optional().describe("Caption center Y as a fraction (0.0 to 1.0)")
418
+ }).describe("Document-wide caption style patch (no caption_id; applies to every caption)");
419
+ //#endregion
420
+ //#region src/editor/schemas/set-caption-visibility.ts
421
+ /**
422
+ * Toggle caption visibility (the caption track's `is_hidden` flag). Pure
423
+ * document edit, no cascade — captions keep their positions; only the lane's
424
+ * hidden flag changes.
425
+ */
426
+ const setCaptionVisibilityInputSchema = z.object({ is_hidden: z.boolean().describe("Whether the caption track is hidden") });
427
+ //#endregion
428
+ //#region src/editor/schemas/set-video-clip-speed-shift.ts
429
+ /**
430
+ * Set the playback speed of existing video clips. Per the speed-shift decision
431
+ * (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
432
+ * store an effective `duration_ms` (projection derives it from the trim window /
433
+ * speed) and does NOT scale anchored speeches' relative offsets (offsets stay
434
+ * put; the cascade reflows absolute positions). A `null` speed_shift clears the
435
+ * speed back to original (1×).
436
+ */
437
+ const setVideoClipSpeedShiftInputSchema = z.object({ clips: z.array(z.object({
438
+ clip_id: clipIdSchema.describe("The video clip part ID to set speed for"),
439
+ speed_shift: speedShiftSchema.nullable().describe("The new speed setting, or null to reset to 1×")
440
+ })).min(1).describe("Video clips with their new speed settings") });
441
+ //#endregion
442
+ export { addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, anchoredDeletePolicySchema, anchoredReplacePolicySchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, clipIdSchema, clipIdsSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, mediaIdSchema, moveAnchorSchema, moveSpeechesInputSchema, moveVideoClipsByAnchorInputSchema, moveVideoClipsInputSchema, movedClipAnchoredPolicySchema, positiveMsSchema, replaceVideoClipContentInputSchema, replaceVideoClipSequenceInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, speechAssetsSchema, speechIdSchema, speechIdsSchema, speedShiftSchema, timelineMsSchema, voiceSchema, volumeSchema };
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ //#region src/editor/schemas/shared.ts
3
+ const clipIdSchema = z.string().min(1).describe("The clip part ID on the timeline");
4
+ const clipIdsSchema = z.array(clipIdSchema).min(1).refine((ids) => new Set(ids).size === ids.length, { message: "Duplicate clip IDs are not allowed" }).describe("List of clip part IDs (no duplicates allowed)");
5
+ const mediaIdSchema = z.string().min(1).describe("The media asset ID");
6
+ const speechIdSchema = z.string().min(1).describe("The speech part ID on the timeline");
7
+ const timelineMsSchema = z.number().int().min(0).describe("Time position in milliseconds on the timeline (>= 0)");
8
+ const positiveMsSchema = z.number().int().positive().describe("Duration in milliseconds (> 0)");
9
+ const volumeSchema = z.number().min(-60).max(20).describe("Volume in decibels (-60.0 to 20.0; 0.0 = original, -60 = mute, +20 = max)");
10
+ const speechIdsSchema = z.array(speechIdSchema).min(1).refine((ids) => new Set(ids).size === ids.length, { message: "Duplicate speech IDs are not allowed" }).describe("List of speech part IDs (no duplicates allowed)");
11
+ const tangentHandleSchema = z.object({
12
+ x: z.number().finite(),
13
+ y: z.number().finite()
14
+ }).describe("Bezier tangent handle (x, y)");
15
+ const speedKeyframeSchema = z.object({
16
+ position: z.number().min(0).max(1),
17
+ rate: z.number().min(0),
18
+ in_tangent: tangentHandleSchema.optional(),
19
+ out_tangent: tangentHandleSchema.optional()
20
+ }).describe("A speed keyframe: normalized position (0..1), rate, optional tangents");
21
+ /**
22
+ * A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
23
+ * Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
24
+ * is a discriminated union — `{ linear: { speed } }` for a constant multiplier
25
+ * (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
26
+ * keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
27
+ * §0). Exactly one of `linear` / `curve` is present.
28
+ */
29
+ const speedShiftSchema = z.object({
30
+ category: z.enum(["linear", "curve"]),
31
+ mode: z.string(),
32
+ config: z.union([z.object({ linear: z.object({ speed: z.number().finite().positive() }) }), z.object({ curve: z.object({ keyframes: z.array(speedKeyframeSchema).min(2) }) })])
33
+ }).describe("Speed shift: linear multiplier or Bezier curve, mirroring the IDL shape");
34
+ const voiceSchema = z.object({
35
+ id: z.string().min(1),
36
+ name: z.string()
37
+ }).describe("TTS voice summary attached to a speech");
38
+ //#endregion
39
+ export { speechIdSchema as a, timelineMsSchema as c, positiveMsSchema as i, voiceSchema as l, clipIdsSchema as n, speechIdsSchema as o, mediaIdSchema as r, speedShiftSchema as s, clipIdSchema as t, volumeSchema as u };