@slatesvideo/shared 0.7.19 → 0.7.21
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.
- package/dist/manual/content.d.ts +1 -1
- package/dist/manual/content.js +1 -1
- package/dist/operations/index.d.ts +704 -226
- package/dist/operations/index.js +662 -22
- package/dist/operations/surface.js +15 -1
- package/package.json +1 -1
package/dist/operations/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { MAX_IMAGE_VARIATIONS, SHEET_TOOL_ASPECT_RATIO, SHEET_TOOL_GPT_QUALITY } from '../prompts/generation-policy.js';
|
|
2
3
|
import { STYLE_LIBRARY, DEFAULT_STYLE_ID } from '../prompts/style-library.js';
|
|
3
4
|
import { discoverGuides, guideCatalog } from '../prompts/guide-discovery.js';
|
|
@@ -557,11 +558,28 @@ const DOCK_SECTION_NAMES = { storyboards: 'Boards', library: 'Library', folders:
|
|
|
557
558
|
// Delivery ids and dimensions come from the desktop catalog, not model capabilities.
|
|
558
559
|
const deliveryAspectInput = z.string().min(1).describe('Delivery format id from slates_get_variant_grid.formats; the desktop validates it and supplies dimensions.');
|
|
559
560
|
const gridSelectionInput = z.object({ rowKeys: z.array(z.string()), aspects: z.array(deliveryAspectInput) }).strict();
|
|
561
|
+
// A file's encoding. Mirrors slate's `@shared/deliveryFormats` (PLATFORM_PRESET_IDS, EXPORT_VIDEO_CODECS,
|
|
562
|
+
// EXPORT_FRAME_RATES, VIDEO_BITRATE_RANGE); the desktop validates every value again.
|
|
563
|
+
const PLATFORM_PRESET_IDS = ['tiktok', 'reels', 'meta-feed', 'stories', 'shorts', 'youtube'];
|
|
564
|
+
const exportEncodingShape = {
|
|
565
|
+
presetId: z.enum(PLATFORM_PRESET_IDS).optional().describe("A platform's targets: its frame size, H.264 bitrate, frame-rate ceiling and sound."),
|
|
566
|
+
codec: z.enum(['h264', 'h265', 'prores']).optional().describe('h264 (default) and h265 write an .mp4; prores writes a .mov with PCM sound for editing elsewhere.'),
|
|
567
|
+
videoBitrateMbps: z.number().min(2).max(120).nullable().optional().describe("The picture's Mb/s; null is Auto (the preset's, else the engine's own). Ignored by prores."),
|
|
568
|
+
fps: z.union([z.literal(24), z.literal(30), z.literal(60)]).nullable().optional().describe("The file's frame rate; null is the timeline's."),
|
|
569
|
+
};
|
|
570
|
+
const exportEncodingInput = z.object(exportEncodingShape).strict();
|
|
560
571
|
const deliveryInput = z.object({
|
|
561
572
|
formats: z.array(deliveryAspectInput).min(1),
|
|
562
573
|
shortSide: z.number().int().positive().optional().describe('Optional short side supported by the desktop delivery settings.'),
|
|
563
574
|
mode: z.enum(['fill', 'fit']).optional().describe('Fill crops around focus; fit pads the frame.'),
|
|
575
|
+
presetId: z.enum(PLATFORM_PRESET_IDS).nullable().optional().describe('The platform the cut is made for: its encoding targets and its safe-area guide.'),
|
|
576
|
+
encoding: exportEncodingInput.nullable().optional().describe("The cut's own encoding over the preset's; every export of it uses it."),
|
|
564
577
|
}).strict();
|
|
578
|
+
/** A delivery naming a preset or an encoding: an older desktop drops both without a word. */
|
|
579
|
+
async function requireDeliveryEncoding(desktop, delivery) {
|
|
580
|
+
if (delivery && (delivery.presetId != null || delivery.encoding != null))
|
|
581
|
+
await desktop.requireCapability('export-encoding', 'platform presets and export encoding');
|
|
582
|
+
}
|
|
565
583
|
const taxonomyInput = z.object({
|
|
566
584
|
concept: z.string().min(1), variant: z.string().min(1),
|
|
567
585
|
hook: z.string().optional(), body: z.string().optional(), cast: z.string().optional(),
|
|
@@ -687,7 +705,7 @@ export const getView = {
|
|
|
687
705
|
*/
|
|
688
706
|
export const setView = {
|
|
689
707
|
id: 'slates_set_view',
|
|
690
|
-
description: "Change what the user is looking at, as their own clicks would: open a project or go Home, switch tab, open a board, jump to a scene, set the Board's View and Filter, set Media's tab, folder and narrowing, jump to a card in Media, open a Library page, a picture in the picture viewer or a clip in the timeline's Viewer, Compare, the animatic or Settings on a pane, show or hide the prompt box, open or park the timeline or switch the cut on it, open a Shot's panel on Script, set the side panels (the project navigator and its folded sections, the Slates Director panel), the Script page's Words or Words + shots and its text size, the Board's card size and linked clips, and on a desktop with the one-window layout the layout (Edit, Plan or one the user saved), its shape and which areas show. Only the fields you name change; the app clamps sizes, answers with what it settled on, and names any field it could not apply. A project change is applied alone (it restores that project's own view). Use it when the user asks you to show or open something, not to answer a question they can see for themselves.",
|
|
708
|
+
description: "Change what the user is looking at, as their own clicks would: open a project or go Home, switch tab, open a board, jump to a scene, set the Board's View and Filter, set Media's tab, folder and narrowing, jump to a card in Media, open a Library page, a picture in the picture viewer or a clip in the timeline's Viewer, Compare, Review mode (review, reviewAssetIds), the animatic or Settings on a pane, show or hide the prompt box, open or park the timeline or switch the cut on it, open a Shot's panel on Script, set the side panels (the project navigator and its folded sections, the Slates Director panel), the Script page's Words or Words + shots and its text size, the Board's card size and linked clips, and on a desktop with the one-window layout the layout (Edit, Plan or one the user saved), its shape and which areas show. Only the fields you name change; the app clamps sizes, answers with what it settled on, and names any field it could not apply. A project change is applied alone (it restores that project's own view). Use it when the user asks you to show or open something, not to answer a question they can see for themselves.",
|
|
691
709
|
input: z
|
|
692
710
|
.object({
|
|
693
711
|
projectId: z.string().nullable().optional().describe('Open this project, or null for Home. Applied alone.'),
|
|
@@ -777,6 +795,8 @@ export const setView = {
|
|
|
777
795
|
.object({ open: z.boolean().optional(), assetIds: z.array(z.string()).max(4).optional().describe('The compare set, two to four items.') })
|
|
778
796
|
.strict()
|
|
779
797
|
.optional(),
|
|
798
|
+
review: z.boolean().optional().describe("Review mode on or off, as the Viewer's Review button: on shows the Viewer with the Notes view in its drawer, where the person marks, rates and sends notes."),
|
|
799
|
+
reviewAssetIds: z.array(z.string()).nullable().optional().describe('With review on: the pictures and clips the arrow keys step through (a round to review); null steps through what is on screen. Turns review on.'),
|
|
780
800
|
animatic: z.object({ open: z.boolean(), fromShotId: z.string().optional() }).strict().optional().describe('Play the board as a rough cut from a Shot (the Board or Script tab must be showing).'),
|
|
781
801
|
settings: z.object({ open: z.boolean(), pane: z.enum(VIEW_SETTINGS_PANES).optional() }).strict().optional().describe('Open Settings, on a pane (ai is AI tools, keys is API keys).'),
|
|
782
802
|
composer: z.object({ open: z.boolean() }).strict().optional().describe('Show or hide the prompt box.'),
|
|
@@ -821,6 +841,8 @@ export const setView = {
|
|
|
821
841
|
if (input.cut?.format !== undefined || input.cut?.gridSelection !== undefined) {
|
|
822
842
|
await ctx.desktop().requireCapability('ad-variant-export', 'delivery preview and variant grid selection');
|
|
823
843
|
}
|
|
844
|
+
if (input.review !== undefined || input.reviewAssetIds !== undefined)
|
|
845
|
+
await ctx.desktop().requireCapability('view-review', 'Review mode');
|
|
824
846
|
// A desktop from before the one window has no capability token for it, and refuses a patch holding only
|
|
825
847
|
// `window` as empty; its view report has no `window`, so read that first.
|
|
826
848
|
if (input.window !== undefined && Object.entries(input).every(([k, v]) => k === 'window' || v === undefined)) {
|
|
@@ -6091,20 +6113,551 @@ const reframeClipInput = reframeReportInput.extend({ clipId: z.string().uuid(),
|
|
|
6091
6113
|
mode: z.enum(['fill', 'fit']).optional(), focusX: z.number().min(0).max(1).optional(),
|
|
6092
6114
|
focusY: z.number().min(0).max(1).optional(), zoom: z.number().min(1).optional(),
|
|
6093
6115
|
}).strict().nullable().optional().describe('Normalized focus and zoom for this clip/aspect. Null resets the override; the desktop binds it to the current take. Required unless follow is set.'),
|
|
6094
|
-
follow: z.enum(['face', 'off']).optional().describe('"face" finds the face in the clip and keys its focusX/focusY to it (smooth, held where the face is lost; every format draws those keys, each keyframe editable by hand or with slates_set_clip_keyframes); "off" removes those keys. Runs on the computer and spends nothing.') });
|
|
6116
|
+
follow: z.union([z.enum(['face', 'off']), z.object({ maskId: z.string().regex(/^[A-Za-z0-9_-]{1,80}$/) }).strict()]).optional().describe('"face" finds the face in the clip and keys its focusX/focusY to it (smooth, held where the face is lost; every format draws those keys, each keyframe editable by hand or with slates_set_clip_keyframes); { maskId } follows one of the clip\'s subject masks instead (slates_get_subject_mask lists them); "off" removes those keys. Runs on the computer and spends nothing.') });
|
|
6095
6117
|
export const reframeClip = {
|
|
6096
|
-
id: 'slates_reframe_clip', description: 'Set or reset a clip framing override for one delivery aspect and return the desktop computed framing report. Changes focus, fill/fit and zoom without duplicating the timeline or generating media. follow: "face" makes a vertical cut follow a talking head (framing, when sent too, lands first) and answers follow: the clip keyframes, samples, found, still and the lost spans in seconds. Requires ad-variant-export, and reframe-follow for follow; update Slates on capability refusal.',
|
|
6118
|
+
id: 'slates_reframe_clip', description: 'Set or reset a clip framing override for one delivery aspect and return the desktop computed framing report. Changes focus, fill/fit and zoom without duplicating the timeline or generating media. follow: "face" makes a vertical cut follow a talking head, or { maskId } a subject mask (framing, when sent too, lands first) and answers follow: the clip keyframes, samples, found, still and the lost spans in seconds. Requires ad-variant-export, and reframe-follow for follow; update Slates on capability refusal.',
|
|
6097
6119
|
billable: false,
|
|
6098
6120
|
input: reframeClipInput,
|
|
6099
6121
|
async run(input, ctx) {
|
|
6100
6122
|
await ctx.desktop().requireCapability('ad-variant-export', 'clip delivery reframing');
|
|
6101
6123
|
if (input.follow)
|
|
6102
6124
|
await ctx.desktop().requireCapability('reframe-follow', 'following a face');
|
|
6125
|
+
if (typeof input.follow === 'object')
|
|
6126
|
+
await ctx.desktop().requireCapability('subject-follow', 'following a subject mask');
|
|
6103
6127
|
else if (input.framing === undefined)
|
|
6104
6128
|
throw new Error('Send framing (null resets it) or follow');
|
|
6105
6129
|
return ok(await ctx.desktop().post('/agent/timeline/reframe', input));
|
|
6106
6130
|
},
|
|
6107
6131
|
};
|
|
6132
|
+
// ── The Cut's finishing tools and Review mode (slate roadmap Waves 1 to 3) ─────────────
|
|
6133
|
+
// Desktop routes in slate `src/main/agent/routes-finishing.ts`; each calls the core the window's own control
|
|
6134
|
+
// calls. A clip's grade, LUT, colour key, shape mask and reverse are fields on slates_update_clip.
|
|
6135
|
+
const clipTargetInput = {
|
|
6136
|
+
projectId: z.string().uuid(),
|
|
6137
|
+
clipId: z.string().uuid().describe('The clip on the timeline (slates_get_timeline lists them).'),
|
|
6138
|
+
};
|
|
6139
|
+
export const freezeFrame = {
|
|
6140
|
+
id: 'slates_freeze_frame',
|
|
6141
|
+
billable: false,
|
|
6142
|
+
description: "Hold one frame of a video clip as a still, as the Inspector's Freeze frame does: the frame at the timeline point named (frame, or sec) is saved as a new picture and placed on the clip's own lane for seconds (default 2), the clip splitting around it and everything after moving later; linked: false leaves the clip's linked sound where it is. Returns the clips written, stillClipId and stillAssetId. Free, on this machine. Requires freeze-frame; update Slates on capability refusal.",
|
|
6143
|
+
input: z.object({
|
|
6144
|
+
...clipTargetInput,
|
|
6145
|
+
frame: z.number().int().min(0).optional().describe('The timeline frame to hold. Or sec.'),
|
|
6146
|
+
sec: z.number().min(0).optional().describe('The timeline second to hold. Or frame.'),
|
|
6147
|
+
seconds: z.number().min(0.1).max(60).optional().describe('How long the still holds, 0.1 to 60 seconds. Default 2.'),
|
|
6148
|
+
linked: z.boolean().optional().describe("False: leave the linked sound in place. Default true."),
|
|
6149
|
+
}).strict(),
|
|
6150
|
+
async run(input, ctx) {
|
|
6151
|
+
if (input.frame === undefined && input.sec === undefined)
|
|
6152
|
+
throw new Error('Name the frame to hold: frame (timeline frames) or sec (timeline seconds).');
|
|
6153
|
+
await ctx.desktop().requireCapability('freeze-frame', 'freeze frame');
|
|
6154
|
+
return ok(await ctx.desktop().post('/agent/timeline/freeze-frame', input));
|
|
6155
|
+
},
|
|
6156
|
+
};
|
|
6157
|
+
export const stabilizeClip = {
|
|
6158
|
+
id: 'slates_stabilize_clip',
|
|
6159
|
+
billable: false,
|
|
6160
|
+
description: "Steady a shaky video clip, as the Inspector's Stabilize does: the file's motion is analysed on this machine and a steadied copy plays in its place (the original file is untouched). strength light keeps most of the move and crops least, strong holds the frame stillest and crops most; null turns it off. Takes about as long as the clip runs. Free. Requires stabilize; update Slates on capability refusal.",
|
|
6161
|
+
input: z.object({
|
|
6162
|
+
...clipTargetInput,
|
|
6163
|
+
strength: z.enum(['light', 'standard', 'strong']).nullable().describe('How steady; null turns stabilize off.'),
|
|
6164
|
+
}).strict(),
|
|
6165
|
+
async run(input, ctx) {
|
|
6166
|
+
await ctx.desktop().requireCapability('stabilize', 'stabilize');
|
|
6167
|
+
return ok(await ctx.desktop().post('/agent/timeline/stabilize', input));
|
|
6168
|
+
},
|
|
6169
|
+
};
|
|
6170
|
+
export const slideClip = {
|
|
6171
|
+
id: 'slates_slide_clip',
|
|
6172
|
+
billable: false,
|
|
6173
|
+
description: "Slide a clip between its neighbours, as the Slide tool does: the clip keeps its own content and length and moves deltaFrames later (or earlier, negative), the clip before it growing and the one after shrinking to fill, so nothing else on the timeline moves. Needs a clip touching each side; held to the media each neighbour has. Returns the clips written and slidFrames, the move made. Free. Requires slide-edit; update Slates on capability refusal.",
|
|
6174
|
+
input: z.object({
|
|
6175
|
+
...clipTargetInput,
|
|
6176
|
+
deltaFrames: z.number().int().describe('Frames to move: positive later, negative earlier.'),
|
|
6177
|
+
}).strict(),
|
|
6178
|
+
async run(input, ctx) {
|
|
6179
|
+
await ctx.desktop().requireCapability('slide-edit', 'slide edit');
|
|
6180
|
+
return ok(await ctx.desktop().post('/agent/timeline/slide-clip', input));
|
|
6181
|
+
},
|
|
6182
|
+
};
|
|
6183
|
+
export const punchIn = {
|
|
6184
|
+
id: 'slates_punch_in',
|
|
6185
|
+
billable: false,
|
|
6186
|
+
description: "Punch in on a video clip or picture, as the Inspector's Punch in does: scale and position keys that push in about the subject (its framing focus). From a point: fromFrame (frames from the clip's start, default 0) to the clip's end. On emphasis words: words (indexes into slates_get_asset_transcript's words) each punch in on the word and back out holdSec after it (default about half a second). style: cut (a hard punch), ease-in, slow-push. amount is the scale, above 1 and at most 1.5 (default 1.15). off: true takes the punch away. A clip with hand-set scale or position keys is refused unless replaceKeys: true. Returns the clip's keyframes and the punch read back. Every key stays editable with slates_set_clip_keyframes. Free. Requires punch-in; update Slates on capability refusal.",
|
|
6187
|
+
input: z.object({
|
|
6188
|
+
...clipTargetInput,
|
|
6189
|
+
amount: z.number().gt(1).max(1.5).optional().describe('The scale, above 1 and at most 1.5. Default 1.15.'),
|
|
6190
|
+
style: z.enum(['cut', 'ease-in', 'slow-push']).optional(),
|
|
6191
|
+
fromFrame: z.number().int().min(0).optional().describe("Where the punch starts, in frames from the clip's start."),
|
|
6192
|
+
words: z.array(z.number().int().min(0)).min(1).optional().describe("Punch on these words, by index in the clip's transcript words."),
|
|
6193
|
+
holdSec: z.number().min(0).max(5).optional().describe('With words: how long each punch holds past its word, 0 to 5 seconds.'),
|
|
6194
|
+
off: z.boolean().optional().describe('True removes the punch in.'),
|
|
6195
|
+
replaceKeys: z.boolean().optional().describe("True puts the punch in place of the clip's own scale and position keys."),
|
|
6196
|
+
}).strict(),
|
|
6197
|
+
async run(input, ctx) {
|
|
6198
|
+
await ctx.desktop().requireCapability('punch-in', 'punch in');
|
|
6199
|
+
return ok(await ctx.desktop().post('/agent/timeline/punch-in', input));
|
|
6200
|
+
},
|
|
6201
|
+
};
|
|
6202
|
+
const dialogueCleanupOptions = z.object({
|
|
6203
|
+
fillers: z.boolean().optional().describe('Filler words (um, uh, like as a filler). Default on.'),
|
|
6204
|
+
pauses: z.boolean().optional().describe('Long pauses. Default on.'),
|
|
6205
|
+
repeats: z.boolean().optional().describe('A word or phrase said twice in a row: the first goes. Default on.'),
|
|
6206
|
+
minPauseSec: z.number().min(0).optional().describe('A pause counts from this long.'),
|
|
6207
|
+
keepAirSec: z.number().min(0).optional().describe('Air kept at each side of a cut pause.'),
|
|
6208
|
+
}).strict();
|
|
6209
|
+
export const cleanUpDialogue = {
|
|
6210
|
+
id: 'slates_clean_up_dialogue',
|
|
6211
|
+
billable: false,
|
|
6212
|
+
description: "Clean up a talking clip by its transcript, as the Transcript page's Clean up does. scan (default, writes nothing) lists the fillers, long pauses and repeated words found, with counts, the top fillers, what apply would cut and the joins an earlier clean-up left. apply cuts them all in one edit (ripple; the linked sound and captions follow unless linked: false) and lists each join. restore puts one join's cut back (range, as scan or apply listed it); nudge moves the clip edge at a join (edge start or end) by deltaFrames. options turns each kind on or off and sets the pause length and the air kept. The clip needs a transcript (slates_transcribe_asset, free). For words picked one by one, slates_cut_by_transcript. Free. Requires dialogue-cleanup; update Slates on capability refusal.",
|
|
6213
|
+
input: z.object({
|
|
6214
|
+
...clipTargetInput,
|
|
6215
|
+
action: z.enum(['scan', 'apply', 'restore', 'nudge']).optional().describe('Default scan.'),
|
|
6216
|
+
options: dialogueCleanupOptions.optional(),
|
|
6217
|
+
range: z.object({ startSec: z.number().min(0), endSec: z.number().min(0) }).strict().optional().describe("restore: the join's range, in the file's own seconds."),
|
|
6218
|
+
edge: z.enum(['start', 'end']).optional().describe('nudge: start (where the cut begins) or end (where it stops).'),
|
|
6219
|
+
deltaFrames: z.number().int().optional().describe('nudge: frames to move the edge, positive later.'),
|
|
6220
|
+
linked: z.boolean().optional().describe("False: cut only the clip's lane. Default true."),
|
|
6221
|
+
}).strict(),
|
|
6222
|
+
async run(input, ctx) {
|
|
6223
|
+
if (input.action === 'restore' && !input.range)
|
|
6224
|
+
throw new Error('restore needs range: a join as scan or apply listed it.');
|
|
6225
|
+
if (input.action === 'nudge' && (!input.edge || input.deltaFrames === undefined))
|
|
6226
|
+
throw new Error('nudge needs edge and deltaFrames.');
|
|
6227
|
+
await ctx.desktop().requireCapability('dialogue-cleanup', 'dialogue clean-up');
|
|
6228
|
+
return ok(await ctx.desktop().post('/agent/timeline/dialogue-cleanup', input));
|
|
6229
|
+
},
|
|
6230
|
+
};
|
|
6231
|
+
export const autoColourClip = {
|
|
6232
|
+
id: 'slates_auto_colour_clip',
|
|
6233
|
+
billable: false,
|
|
6234
|
+
description: "Give a video clip or picture a neutral grade from its own frame, as the Inspector's Auto colour does: the frame at frame or sec (default the clip's middle) is read, and exposure, contrast, temperature, tint, highlights and shadows are written to the clip's look as ordinary values (other look fields kept), each editable with slates_update_clip. Returns the values, the look and the frame read. Free, on this machine. Requires clip-grade; update Slates on capability refusal.",
|
|
6235
|
+
input: z.object({
|
|
6236
|
+
...clipTargetInput,
|
|
6237
|
+
frame: z.number().int().min(0).optional().describe('The timeline frame to read.'),
|
|
6238
|
+
sec: z.number().min(0).optional().describe('The timeline second to read.'),
|
|
6239
|
+
}).strict(),
|
|
6240
|
+
async run(input, ctx) {
|
|
6241
|
+
await ctx.desktop().requireCapability('clip-grade', 'auto colour');
|
|
6242
|
+
return ok(await ctx.desktop().post('/agent/timeline/auto-colour', input));
|
|
6243
|
+
},
|
|
6244
|
+
};
|
|
6245
|
+
export const autoDuck = {
|
|
6246
|
+
id: 'slates_auto_duck',
|
|
6247
|
+
billable: false,
|
|
6248
|
+
description: "Dip music under speech, as the lane's Auto duck does: a music lane (trackId) or one clip (clipId) drops by duckDb wherever another lane speaks, read from the transcripts (a clip with no transcript counts as speech for its whole sound). attackSec and releaseSec shape the dip, holdSec keeps it down past each word, bridgeSec joins gaps shorter than that. Written as one effect on the lane or clip, redone on each call; off: true takes it away. Returns dips, the number of dips. Transcribe the voice first for word-tight dips (slates_transcribe_asset, free). Free. Requires audio-suite; update Slates on capability refusal.",
|
|
6249
|
+
input: z.object({
|
|
6250
|
+
projectId: z.string().uuid(),
|
|
6251
|
+
trackId: z.string().min(1).optional().describe('The music lane. Or clipId.'),
|
|
6252
|
+
clipId: z.string().uuid().optional().describe('One clip. Or trackId.'),
|
|
6253
|
+
duckDb: z.number().min(-40).max(0).optional().describe('The dip in dB, -40 to 0. Default -12.'),
|
|
6254
|
+
attackSec: z.number().min(0).max(10).optional().describe('How fast it dips. Default 0.15.'),
|
|
6255
|
+
releaseSec: z.number().min(0).max(10).optional().describe('How fast it comes back. Default 0.3.'),
|
|
6256
|
+
holdSec: z.number().min(0).max(10).optional().describe('How long it stays down past a word. Default 0.1.'),
|
|
6257
|
+
bridgeSec: z.number().min(0).max(10).optional().describe('Gaps in speech shorter than this stay ducked. Default 0.6.'),
|
|
6258
|
+
off: z.boolean().optional().describe('True removes the auto duck.'),
|
|
6259
|
+
}).strict(),
|
|
6260
|
+
async run(input, ctx) {
|
|
6261
|
+
if ((input.trackId === undefined) === (input.clipId === undefined))
|
|
6262
|
+
throw new Error('Name trackId (a lane) or clipId (one clip), not both.');
|
|
6263
|
+
await ctx.desktop().requireCapability('audio-suite', 'auto duck');
|
|
6264
|
+
return ok(await ctx.desktop().post('/agent/timeline/auto-duck', input));
|
|
6265
|
+
},
|
|
6266
|
+
};
|
|
6267
|
+
export const matchLoudness = {
|
|
6268
|
+
id: 'slates_match_loudness',
|
|
6269
|
+
billable: false,
|
|
6270
|
+
description: "Bring a mix or one lane to -14 LUFS, the level social platforms play at, as the Output level popover's Match does: the sound is measured as the export writes it, then one gain is set on the master (or on the lane, with trackId) to land on -14 LUFS integrated under a -1 dBTP true peak (held lower when the peak would pass it). Redone on each call. Returns the target, what was measured, the gain set and the effects. Measure without changing anything with slates_get_timeline_loudness. Free. Requires audio-suite; update Slates on capability refusal.",
|
|
6271
|
+
input: z.object({
|
|
6272
|
+
projectId: z.string().uuid(),
|
|
6273
|
+
timelineId: z.string().uuid().optional().describe("The cut; absent: the project's default timeline."),
|
|
6274
|
+
trackId: z.string().min(1).optional().describe('Match this lane alone; absent: the whole mix, on the master.'),
|
|
6275
|
+
}).strict(),
|
|
6276
|
+
async run(input, ctx) {
|
|
6277
|
+
const desktop = ctx.desktop();
|
|
6278
|
+
await desktop.requireCapability('audio-suite', 'loudness match');
|
|
6279
|
+
await requireNamedCut(desktop, input.timelineId);
|
|
6280
|
+
return ok(await desktop.post('/agent/timeline/match-loudness', input));
|
|
6281
|
+
},
|
|
6282
|
+
};
|
|
6283
|
+
export const upscaleImage = {
|
|
6284
|
+
id: 'slates_upscale_image',
|
|
6285
|
+
billable: true,
|
|
6286
|
+
description: "Make a sharper copy of a picture at 2x or 4x its size, as the picture viewer's Upscale does: faithful (no new content), saved as a new picture beside the original, which is untouched. Priced by the picture's size; a picture that would pass 144 megapixels at 4x is refused (try 2x). " +
|
|
6287
|
+
CONFIRM_GATE_SENTENCE +
|
|
6288
|
+
' Supply a new UUID requestId once per intended upscale and reuse it for a retry: the same id never pays twice (a retry waits for the same run, or returns its picture). Returns the new picture (id, code, file, size) and cost_credits spent. Requires image-upscale; update Slates on capability refusal.',
|
|
6289
|
+
input: z.object({
|
|
6290
|
+
projectId: z.string().uuid(),
|
|
6291
|
+
assetId: z.string().min(1).describe('The picture: its code (IMG-A4) or id.'),
|
|
6292
|
+
factor: z.union([z.literal(2), z.literal(4)]).describe('2 or 4 times the size.'),
|
|
6293
|
+
confirm: z.boolean().optional().describe(CONFIRM_PARAM),
|
|
6294
|
+
requestId: z.string().uuid().optional().describe('A new UUID per intended upscale; the same one on a retry. Absent: one is made for this call.'),
|
|
6295
|
+
}).strict(),
|
|
6296
|
+
async run(input, ctx) {
|
|
6297
|
+
const desktop = ctx.desktop();
|
|
6298
|
+
await desktop.requireCapability('image-upscale', 'picture upscale');
|
|
6299
|
+
const id = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
|
|
6300
|
+
const quote = await desktop.get('/agent/generation/upscale-quote', { projectId: input.projectId, assetId: id, factor: String(input.factor) });
|
|
6301
|
+
if (quote.credits === null)
|
|
6302
|
+
throw new Error(quote.refused ?? 'This picture cannot be upscaled at that size.');
|
|
6303
|
+
const name = quote.code ?? id;
|
|
6304
|
+
const size = `${quote.width}x${quote.height} to ${quote.outWidth}x${quote.outHeight}`;
|
|
6305
|
+
if (quote.credits > CONFIRM_CREDITS && !input.confirm) {
|
|
6306
|
+
return ok({
|
|
6307
|
+
requires_confirm: true, estimated_credits: quote.credits, estimated_cents: quote.credits, factor: quote.factor,
|
|
6308
|
+
width: quote.width, height: quote.height, outWidth: quote.outWidth, outHeight: quote.outHeight,
|
|
6309
|
+
message: `Cost: ${fmtCredits(quote.credits)} to upscale ${name} ${quote.factor}x (${size}). Re-call with confirm=true after the user explicitly OKs the spend.`,
|
|
6310
|
+
});
|
|
6311
|
+
}
|
|
6312
|
+
const requestId = input.requestId ?? randomUUID();
|
|
6313
|
+
const r = await desktop.post('/agent/generation/upscale-image', { projectId: input.projectId, assetId: id, factor: input.factor, expectedCredits: quote.credits, requestId });
|
|
6314
|
+
if (!r.asset)
|
|
6315
|
+
return ok({ ...r, requestId }, `The upscale of ${name} under this requestId is still running; check slates_get_generation_status with ${r.generationId ?? requestId}. Do not start it again with a new requestId.`);
|
|
6316
|
+
const spent = r.cost_credits ?? r.credits ?? quote.credits;
|
|
6317
|
+
return ok({ ...r, cost_credits: spent, requestId }, `Upscaled ${name} ${quote.factor}x (${size}) into ${r.asset.code ?? r.asset.id} for ${fmtCredits(spent)}.`);
|
|
6318
|
+
},
|
|
6319
|
+
};
|
|
6320
|
+
export const getReviewPacket = {
|
|
6321
|
+
id: 'slates_get_review_packet',
|
|
6322
|
+
description: "Read the notes the person sent from Review mode (the Viewer's Review button): each note with its number, its words or a wordless mark (mark: true, no words: 'this is off'), what it points at (a picture region, a clip span, a transition, a transcript join) with a still, its thread, and the ratings changed since (stars, favourite, rejected, redo, more like this). By default the oldest packet the person sent and nobody has read; include: open reads notes and ratings not yet sent; include: all reads every note and rating in the project, with the packets they were sent in, and claims nothing. Reading a sent packet claims it, so the person sees it was picked up (claim: false only peeks). Answer each note with slates_resolve_review_note. null with a reason when nothing waits. Free. Requires review-mode; update Slates on capability refusal.",
|
|
6323
|
+
input: z.object({
|
|
6324
|
+
projectId: z.string().uuid(),
|
|
6325
|
+
packetId: z.string().min(1).optional().describe('One packet by id; absent: the oldest unread.'),
|
|
6326
|
+
include: z.enum(['sent', 'open', 'all']).optional().describe('sent (default): a packet the person sent. open: unsent notes and ratings. all: every note and rating, with its packets; never claims.'),
|
|
6327
|
+
claim: z.boolean().optional().describe('False reads without claiming. Default true for a sent packet.'),
|
|
6328
|
+
}).strict(),
|
|
6329
|
+
async run(input, ctx) {
|
|
6330
|
+
await ctx.desktop().requireCapability('review-mode', 'Review mode');
|
|
6331
|
+
return ok(await ctx.desktop().get('/agent/review/packet', {
|
|
6332
|
+
projectId: input.projectId,
|
|
6333
|
+
...(input.packetId ? { packetId: input.packetId } : {}),
|
|
6334
|
+
...(input.include ? { include: input.include } : {}),
|
|
6335
|
+
...(input.claim !== undefined ? { claim: String(input.claim) } : {}),
|
|
6336
|
+
}));
|
|
6337
|
+
},
|
|
6338
|
+
};
|
|
6339
|
+
export const resolveReviewNote = {
|
|
6340
|
+
id: 'slates_resolve_review_note',
|
|
6341
|
+
description: "Answer the person's review notes, on the note where it was pinned, as the Notes view shows it. One reply per note: fixed (done; text optional), question (ask what they meant), why_not (why it stays as is), alternates (two or three takes to choose from, assetIds), note (anything else). A wordless mark (mark: true with no words) is answered with alternates, two or three versions, never one guess, unless the person has since written in its thread. Only a sent note can be answered (not one still being written, nor one already answered or done); alternates are two or three different pictures or clips; every take is in this project. Returns each note's new state and how many in its packet still wait. Free. Requires review-mode; update Slates on capability refusal.",
|
|
6342
|
+
input: z.object({
|
|
6343
|
+
projectId: z.string().uuid(),
|
|
6344
|
+
replies: z.array(z.object({
|
|
6345
|
+
noteId: z.string().min(1),
|
|
6346
|
+
kind: z.enum(['fixed', 'question', 'why_not', 'alternates', 'note']),
|
|
6347
|
+
text: z.string().max(4000).optional().describe('The answer. Needed for question, why_not and note.'),
|
|
6348
|
+
assetIds: z.array(z.string().min(1)).max(3).optional().describe('alternates: two or three takes, codes or ids. fixed: the take that fixes it.'),
|
|
6349
|
+
}).strict()).min(1),
|
|
6350
|
+
}).strict(),
|
|
6351
|
+
async run(input, ctx) {
|
|
6352
|
+
await ctx.desktop().requireCapability('review-mode', 'Review mode');
|
|
6353
|
+
const refs = [...new Set(input.replies.flatMap((r) => r.assetIds ?? []))];
|
|
6354
|
+
const resolved = refs.length ? await resolveAssetRefs(ctx, input.projectId, refs) : new Map();
|
|
6355
|
+
const replies = input.replies.map((r) => (r.assetIds ? { ...r, assetIds: r.assetIds.map((a) => resolved.get(a).id) } : r));
|
|
6356
|
+
return ok(await ctx.desktop().post('/agent/review/resolve', { projectId: input.projectId, replies }));
|
|
6357
|
+
},
|
|
6358
|
+
};
|
|
6359
|
+
// ── Wave 6: the Winners Loop, Visual QA, stacked video edits, diagnostics, winning ads ──
|
|
6360
|
+
const META_WINNERS = 'the Winners Loop (ad results per recipe)';
|
|
6361
|
+
export const getAdWinners = {
|
|
6362
|
+
id: 'slates_get_ad_winners',
|
|
6363
|
+
description: "What each exported ad recipe earned in the person's ad account over the last pulled range, as the account reports it: spend, purchases, ROAS, the person's winner or loser mark, the losers, and the project's split tests (splitTests: each local id for slates_evaluate_split_test_winner, campaign, status and stored winner). Never remake a recipe listed in losers. Read this before planning more variants of an ad. Free. Requires meta-winners; update Slates on capability refusal.",
|
|
6364
|
+
input: z.object({ projectId: z.string().uuid().optional().describe('One project; absent: every project.') }).strict(),
|
|
6365
|
+
async run(input, ctx) {
|
|
6366
|
+
await ctx.desktop().requireCapability('meta-winners', META_WINNERS);
|
|
6367
|
+
return ok(await ctx.desktop().get('/agent/meta/winners', { projectId: input.projectId }));
|
|
6368
|
+
},
|
|
6369
|
+
};
|
|
6370
|
+
export const setRecipeVerdict = {
|
|
6371
|
+
id: 'slates_set_recipe_verdict',
|
|
6372
|
+
description: "Mark an ad recipe a winner or a loser (null clears the mark), as the person decided from its results. A loser is never remade; More like this starts from a winner. Free. Requires meta-winners; update Slates on capability refusal.",
|
|
6373
|
+
input: z.object({
|
|
6374
|
+
recipeId: z.string().min(1).describe('The recipe ID from slates_get_ad_winners or an export.'),
|
|
6375
|
+
projectId: z.string().uuid().nullable().optional(),
|
|
6376
|
+
verdict: z.enum(['winner', 'loser']).nullable(),
|
|
6377
|
+
note: z.string().max(2000).optional(),
|
|
6378
|
+
}).strict(),
|
|
6379
|
+
async run(input, ctx) {
|
|
6380
|
+
await ctx.desktop().requireCapability('meta-winners', META_WINNERS);
|
|
6381
|
+
return ok(await ctx.desktop().post('/agent/meta/verdict', input));
|
|
6382
|
+
},
|
|
6383
|
+
};
|
|
6384
|
+
export const moreLikeThis = {
|
|
6385
|
+
id: 'slates_more_like_this',
|
|
6386
|
+
description: "Start a new cut from a winning export: its hook becomes a slot holding the winning hook plus open ones, and the answer quotes what finishing the variants would cost. Nothing is generated; show the person the quote before filling an open hook. Free. Requires meta-winners; update Slates on capability refusal.",
|
|
6387
|
+
input: z.object({
|
|
6388
|
+
exportRef: z.string().min(1).describe('The export reference from slates_get_ad_winners (exportRef).'),
|
|
6389
|
+
openHookSlot: z.boolean().optional().describe('Default true: the hook becomes a slot.'),
|
|
6390
|
+
extraHookCount: z.number().int().min(1).optional().describe('Open hook alternatives to add; the app caps it.'),
|
|
6391
|
+
}).strict(),
|
|
6392
|
+
async run(input, ctx) {
|
|
6393
|
+
await ctx.desktop().requireCapability('meta-winners', META_WINNERS);
|
|
6394
|
+
return ok(await ctx.desktop().post('/agent/meta/more-like-this', input));
|
|
6395
|
+
},
|
|
6396
|
+
};
|
|
6397
|
+
const SPLIT_TEST_INPUT = z.object({
|
|
6398
|
+
projectId: z.string().uuid(),
|
|
6399
|
+
accountId: z.string().min(1).describe('The ad account id.'),
|
|
6400
|
+
campaignName: z.string().min(1),
|
|
6401
|
+
dailyBudgetMinor: z.number().int().positive().describe("The ad set's daily budget in the currency's minor units (cents)."),
|
|
6402
|
+
currency: z.string().min(3).max(3),
|
|
6403
|
+
exportRefs: z.array(z.string().min(1)).min(2).describe('The exported variants, one paused ad each.'),
|
|
6404
|
+
country: z.string().length(2).describe('Two-letter audience country.'),
|
|
6405
|
+
specialAdCategories: z.array(z.string()).nullable().describe('[] when none apply; the plan refuses null.'),
|
|
6406
|
+
pageId: z.string().min(1),
|
|
6407
|
+
destinationUrl: z.string().url(),
|
|
6408
|
+
headline: z.string().optional(),
|
|
6409
|
+
primaryText: z.string().optional(),
|
|
6410
|
+
cta: z.string().optional(),
|
|
6411
|
+
thresholdSpend: z.number().nonnegative().nullable().optional(),
|
|
6412
|
+
thresholdImpressions: z.number().int().nonnegative().nullable().optional(),
|
|
6413
|
+
}).strict();
|
|
6414
|
+
export const planSplitTest = {
|
|
6415
|
+
id: 'slates_plan_split_test',
|
|
6416
|
+
description: "Plan a split test of exported variants: one campaign, one ad set and one paused ad per variant, checked against the spend caps, with every problem named. Creates nothing; the person creates the paused test from New split test… in Meta Ads. Free. Requires meta-winners; update Slates on capability refusal.",
|
|
6417
|
+
input: SPLIT_TEST_INPUT,
|
|
6418
|
+
async run(input, ctx) {
|
|
6419
|
+
await ctx.desktop().requireCapability('meta-winners', META_WINNERS);
|
|
6420
|
+
return ok(await ctx.desktop().post('/agent/meta/split-test/plan', input));
|
|
6421
|
+
},
|
|
6422
|
+
};
|
|
6423
|
+
export const evaluateSplitTestWinner = {
|
|
6424
|
+
id: 'slates_evaluate_split_test_winner',
|
|
6425
|
+
description: "Call a split test's winner from the ad account's report for that test's own ads only (read now, from the day the test was made): no call until every variant has results and passes the spend and impression thresholds; it compares ROAS (else cost per purchase, else click rate) and labels every figure as the ad account reports it. A tie or no call clears an older stored winner. Free. Requires meta-winners; update Slates on capability refusal.",
|
|
6426
|
+
input: z.object({
|
|
6427
|
+
testId: z.string().min(1).describe('The local split test id, from splitTests in slates_get_ad_winners.'),
|
|
6428
|
+
thresholds: z.object({
|
|
6429
|
+
minSpend: z.number().nonnegative().nullable().optional(),
|
|
6430
|
+
minImpressions: z.number().int().nonnegative().nullable().optional(),
|
|
6431
|
+
}).strict().optional().describe("Absent: the test's own thresholds."),
|
|
6432
|
+
}).strict(),
|
|
6433
|
+
async run(input, ctx) {
|
|
6434
|
+
await ctx.desktop().requireCapability('meta-winners', META_WINNERS);
|
|
6435
|
+
return ok(await ctx.desktop().post('/agent/meta/split-test/winner', input));
|
|
6436
|
+
},
|
|
6437
|
+
};
|
|
6438
|
+
const VISUAL_QA = 'Visual QA';
|
|
6439
|
+
export const visualQaSample = {
|
|
6440
|
+
id: 'slates_visual_qa_sample',
|
|
6441
|
+
description: "Visual QA, step one of a round: stills of the cut's overlay beats, transition middles and cuts, returned inline so you see every frame, with what this machine measured in them (clipped or crowded text, contrast, hold times, gaps), the rubric and the critique prompt. Score every still against the rubric, then answer with slates_visual_qa_record_round. Pass runId to take the next round's stills after your fixes. Free: the looking is yours. Requires visual-qa; update Slates on capability refusal.",
|
|
6442
|
+
input: z.object({
|
|
6443
|
+
projectId: z.string().uuid().optional().describe('Defaults to the open project.'),
|
|
6444
|
+
timelineId: z.string().min(1).optional().describe("Defaults to the project's timeline."),
|
|
6445
|
+
runId: z.string().min(1).optional().describe('Continue this run with its next round; absent starts a run.'),
|
|
6446
|
+
maxRounds: z.number().int().positive().optional().describe("Rounds a new run takes; the app's default and limits apply."),
|
|
6447
|
+
// 24 is the desktop's MAX_VISUAL_QA_SAMPLES (slate src/shared/visualQa.ts), which the route enforces too.
|
|
6448
|
+
budget: z.number().int().positive().max(24).optional().describe("The most stills a round takes, up to 24; the app's default applies."),
|
|
6449
|
+
}).strict(),
|
|
6450
|
+
async run(input, ctx) {
|
|
6451
|
+
await ctx.desktop().requireCapability('visual-qa', VISUAL_QA);
|
|
6452
|
+
const r = await ctx.desktop().post('/agent/timeline/visual-qa/sample', input);
|
|
6453
|
+
const stills = r.stills ?? [];
|
|
6454
|
+
const { stills: _inline, ...data } = r;
|
|
6455
|
+
const when = new Map((r.samples ?? []).map((s) => [s.id, s.sec]));
|
|
6456
|
+
return {
|
|
6457
|
+
text: `${JSON.stringify(data)}\n\nStills, in order: ${stills.map((s) => `${s.sampleId} (${when.get(s.sampleId) ?? '?'}s)`).join(', ') || 'none could be read'}.`,
|
|
6458
|
+
images: stills.map((s) => ({ data: s.data, mimeType: s.mimeType })),
|
|
6459
|
+
data,
|
|
6460
|
+
};
|
|
6461
|
+
},
|
|
6462
|
+
};
|
|
6463
|
+
const VQA_DIMENSION = z.enum(['alignment', 'legibility', 'hierarchy', 'pacing', 'transitions', 'motion', 'restraint']);
|
|
6464
|
+
export const visualQaRecordRound = {
|
|
6465
|
+
id: 'slates_visual_qa_record_round',
|
|
6466
|
+
description: "Visual QA, step two: record your scores (0-10 per rubric dimension) and findings for the round slates_visual_qa_sample handed you, each finding on its still with what is wrong and the exact fix. A measured finding stays unless your finding restates it (findingId) at the same or a higher severity. Answers pass or iterate, the score change and what stays open; after fixing, sample the next round with the same runId. A round is recorded once: on the final round pass promoteToReview: true, which turns what stays open into Review notes for the person only if the round does not pass. Free. Requires visual-qa; update Slates on capability refusal.",
|
|
6467
|
+
input: z.object({
|
|
6468
|
+
runId: z.string().min(1).describe('From slates_visual_qa_sample.'),
|
|
6469
|
+
scores: z.record(VQA_DIMENSION, z.number().min(0).max(10)).describe('Every rubric dimension, 0-10.'),
|
|
6470
|
+
findings: z.array(z.object({
|
|
6471
|
+
sampleId: z.string().min(1).describe('The still it was seen in.'),
|
|
6472
|
+
dimension: VQA_DIMENSION,
|
|
6473
|
+
severity: z.enum(['blocker', 'should-fix', 'polish']),
|
|
6474
|
+
diagnosis: z.string().min(1).describe('What is wrong, in that frame.'),
|
|
6475
|
+
exactFix: z.string().min(1).describe('The change that fixes it: what to set, to what.'),
|
|
6476
|
+
region: z.object({ x: z.number(), y: z.number(), w: z.number(), h: z.number() }).strict().nullable().optional().describe('Where in the frame, as fractions 0-1.'),
|
|
6477
|
+
span: z.object({ startSec: z.number(), endSec: z.number() }).strict().nullable().optional(),
|
|
6478
|
+
targetClipId: z.string().optional(),
|
|
6479
|
+
targetTransitionId: z.string().optional(),
|
|
6480
|
+
findingId: z.string().optional().describe("The measured finding's id this one restates; it replaces it only at the same or a higher severity."),
|
|
6481
|
+
}).strict()),
|
|
6482
|
+
summary: z.string().optional(),
|
|
6483
|
+
promoteToReview: z.boolean().optional(),
|
|
6484
|
+
}).strict(),
|
|
6485
|
+
async run(input, ctx) {
|
|
6486
|
+
await ctx.desktop().requireCapability('visual-qa', VISUAL_QA);
|
|
6487
|
+
return ok(await ctx.desktop().post('/agent/timeline/visual-qa/round', input));
|
|
6488
|
+
},
|
|
6489
|
+
};
|
|
6490
|
+
export const listVisualQaRuns = {
|
|
6491
|
+
id: 'slates_list_visual_qa_runs',
|
|
6492
|
+
description: "A timeline's Visual QA runs, newest first: status, rounds, round one's score against the last and the gain; runId reads one run in full. Free. Requires visual-qa; update Slates on capability refusal.",
|
|
6493
|
+
input: z.object({
|
|
6494
|
+
projectId: z.string().uuid().optional().describe('Defaults to the open project.'),
|
|
6495
|
+
timelineId: z.string().min(1).optional(),
|
|
6496
|
+
runId: z.string().min(1).optional(),
|
|
6497
|
+
}).strict(),
|
|
6498
|
+
async run(input, ctx) {
|
|
6499
|
+
await ctx.desktop().requireCapability('visual-qa', VISUAL_QA);
|
|
6500
|
+
return ok(await ctx.desktop().get('/agent/timeline/visual-qa/runs', input));
|
|
6501
|
+
},
|
|
6502
|
+
};
|
|
6503
|
+
const V2V = 'stacked video edits';
|
|
6504
|
+
const V2V_KIND = z.enum(['swap-person', 'change-angle', 'change-location', 'move-camera', 'relight', 'video-brush']);
|
|
6505
|
+
const V2V_RECIPE = {
|
|
6506
|
+
model: z.string().min(1).optional().describe("The edit model; absent: the app's default."),
|
|
6507
|
+
prompt: z.string().optional(),
|
|
6508
|
+
params: z.record(z.unknown()).optional().describe('The kind\'s settings: subjectAssetId, locationAssetId, preset, directionDeg, colorTemp, diffusion, brushMode, videoResolution. Asset ids or badge codes.'),
|
|
6509
|
+
referenceAssetIds: z.array(z.string().min(1)).optional().describe('Asset ids or badge codes.'),
|
|
6510
|
+
startFrame: z.number().int().nonnegative().optional().describe('Timeline frame where the edited moment starts.'),
|
|
6511
|
+
endFrame: z.number().int().positive().optional().describe('Timeline frame where it ends (exclusive).'),
|
|
6512
|
+
};
|
|
6513
|
+
/** A pass's asset references (UUIDs or badge codes) resolved against the project at call time. */
|
|
6514
|
+
async function resolvePassAssets(ctx, projectId, input) {
|
|
6515
|
+
const params = input.params ?? {};
|
|
6516
|
+
const named = ['subjectAssetId', 'locationAssetId'].filter((k) => typeof params[k] === 'string');
|
|
6517
|
+
const refs = [...named.map((k) => params[k]), ...(input.referenceAssetIds ?? [])];
|
|
6518
|
+
if (!refs.length)
|
|
6519
|
+
return input;
|
|
6520
|
+
const resolved = await resolveAssetRefs(ctx, projectId, refs);
|
|
6521
|
+
const id = (ref) => resolved.get(ref).id;
|
|
6522
|
+
return {
|
|
6523
|
+
...input,
|
|
6524
|
+
...(input.params ? { params: { ...params, ...Object.fromEntries(named.map((k) => [k, id(params[k])])) } } : {}),
|
|
6525
|
+
...(input.referenceAssetIds ? { referenceAssetIds: input.referenceAssetIds.map(id) } : {}),
|
|
6526
|
+
};
|
|
6527
|
+
}
|
|
6528
|
+
export const listV2vPasses = {
|
|
6529
|
+
id: 'slates_list_v2v_passes',
|
|
6530
|
+
description: "The stacked video edits on a timeline (or one clip), bottom first: each pass's kind, moment, settings, recipe ID, status, output and estimated credits. Free. Requires v2v-edits; update Slates on capability refusal.",
|
|
6531
|
+
input: z.object({ projectId: z.string().uuid(), timelineId: z.string().min(1), clipId: z.string().min(1).optional() }).strict(),
|
|
6532
|
+
async run(input, ctx) {
|
|
6533
|
+
await ctx.desktop().requireCapability('v2v-edits', V2V);
|
|
6534
|
+
return ok(await ctx.desktop().get('/agent/timeline/v2v', input));
|
|
6535
|
+
},
|
|
6536
|
+
};
|
|
6537
|
+
export const editV2vPass = {
|
|
6538
|
+
id: 'slates_edit_v2v_pass',
|
|
6539
|
+
description: "Add, change, remove or reorder a stacked video edit on a video clip's moment: swap the person, change the angle or location, move the camera, relight, or a brushed region. Each pass edits the output of the one under it. Saving a pass generates nothing; quote with slates_quote_v2v_passes, then run. Free. Requires v2v-edits; update Slates on capability refusal.",
|
|
6540
|
+
input: z.object({
|
|
6541
|
+
projectId: z.string().uuid(),
|
|
6542
|
+
action: z.enum(['create', 'update', 'delete', 'reorder']),
|
|
6543
|
+
input: z.object({ timelineId: z.string().min(1), clipId: z.string().min(1), kind: V2V_KIND, label: z.string().optional(), ...V2V_RECIPE }).strict().optional().describe('create: the new pass.'),
|
|
6544
|
+
passId: z.string().min(1).optional().describe('update and delete.'),
|
|
6545
|
+
patch: z.object({ label: z.string().optional(), enabled: z.boolean().optional(), orderIndex: z.number().int().nonnegative().optional(), ...V2V_RECIPE }).strict().optional().describe('update: the fields to change.'),
|
|
6546
|
+
timelineId: z.string().min(1).optional().describe('reorder.'),
|
|
6547
|
+
clipId: z.string().min(1).optional().describe('reorder.'),
|
|
6548
|
+
orderedIds: z.array(z.string().min(1)).optional().describe('reorder: every pass on the clip, bottom first.'),
|
|
6549
|
+
}).strict(),
|
|
6550
|
+
async run(input, ctx) {
|
|
6551
|
+
await ctx.desktop().requireCapability('v2v-edits', V2V);
|
|
6552
|
+
const body = {
|
|
6553
|
+
...input,
|
|
6554
|
+
...(input.input ? { input: await resolvePassAssets(ctx, input.projectId, input.input) } : {}),
|
|
6555
|
+
...(input.patch ? { patch: await resolvePassAssets(ctx, input.projectId, input.patch) } : {}),
|
|
6556
|
+
};
|
|
6557
|
+
return ok(await ctx.desktop().post('/agent/timeline/v2v/pass', body));
|
|
6558
|
+
},
|
|
6559
|
+
};
|
|
6560
|
+
export const quoteV2vPasses = {
|
|
6561
|
+
id: 'slates_quote_v2v_passes',
|
|
6562
|
+
description: "Price stacked video edits before running them: per pass the billed seconds, credits, warnings or what blocks it, its recipe ID, and the total. Show the person the total; slates_run_v2v_passes takes it as maxCredits and quoteFingerprint as the quote it runs. Free. Requires v2v-edits; update Slates on capability refusal.",
|
|
6563
|
+
input: z.object({ projectId: z.string().uuid(), passIds: z.array(z.string().min(1)).min(1) }).strict(),
|
|
6564
|
+
async run(input, ctx) {
|
|
6565
|
+
await ctx.desktop().requireCapability('v2v-edits', V2V);
|
|
6566
|
+
return ok(await ctx.desktop().post('/agent/timeline/v2v/quote', input));
|
|
6567
|
+
},
|
|
6568
|
+
};
|
|
6569
|
+
export const runV2vPasses = {
|
|
6570
|
+
id: 'slates_run_v2v_passes',
|
|
6571
|
+
billable: true,
|
|
6572
|
+
description: "Run stacked video edits that slates_quote_v2v_passes priced and the person approved: each pass edits the output of the one under it, independent passes in parallel. maxCredits is the approved total and quoteFingerprint the quote's own; a run that would cost more, or whose passes changed since the quote, is refused before anything runs. Pass a requestId of your own: a retry with the same one returns the first run's result and spends nothing again. The answer's cost_credits is what the run charged. Spends credits. Requires v2v-edits; update Slates on capability refusal.",
|
|
6573
|
+
input: z.object({
|
|
6574
|
+
projectId: z.string().uuid(),
|
|
6575
|
+
timelineId: z.string().min(1).describe("The passes' timeline; every pass must be on it."),
|
|
6576
|
+
passIds: z.array(z.string().min(1)).min(1),
|
|
6577
|
+
maxCredits: z.number().int().nonnegative().describe("The quote's total the person approved."),
|
|
6578
|
+
quoteFingerprint: z.string().min(1).describe('quoteFingerprint from slates_quote_v2v_passes for these passes.'),
|
|
6579
|
+
requestId: z.string().min(1).max(200).optional().describe('Your idempotency key for this run; reuse it only to retry the same run.'),
|
|
6580
|
+
maxParallel: z.number().int().positive().optional(),
|
|
6581
|
+
}).strict(),
|
|
6582
|
+
async run(input, ctx) {
|
|
6583
|
+
const desktop = ctx.desktop();
|
|
6584
|
+
await desktop.requireCapability('v2v-edits', V2V);
|
|
6585
|
+
// Every selected pass must be on the named timeline: the model guides checked are those of exactly the passes run.
|
|
6586
|
+
const { passes } = await desktop.get('/agent/timeline/v2v', { projectId: input.projectId, timelineId: input.timelineId });
|
|
6587
|
+
const byId = new Map(passes.map((p) => [p.id, p]));
|
|
6588
|
+
const missing = input.passIds.filter((id) => !byId.has(id));
|
|
6589
|
+
if (missing.length)
|
|
6590
|
+
throw new Error(`These passes are not on timeline ${input.timelineId}: ${missing.join(', ')}. Run passes of one timeline at a time.`);
|
|
6591
|
+
for (const model of new Set(input.passIds.map((id) => byId.get(id).model)))
|
|
6592
|
+
requireGuideRead(ctx, model);
|
|
6593
|
+
return ok(await desktop.post('/agent/timeline/v2v/run', input));
|
|
6594
|
+
},
|
|
6595
|
+
};
|
|
6596
|
+
export const v2vPassesToVariants = {
|
|
6597
|
+
id: 'slates_v2v_passes_to_variants',
|
|
6598
|
+
description: "Send finished video edits of one clip's moment to the variant grid: a slot on the timeline with one alternative per pass, each keeping its recipe ID, so they export as ad variants. Free. Requires v2v-edits; update Slates on capability refusal.",
|
|
6599
|
+
input: z.object({ projectId: z.string().uuid(), timelineId: z.string().min(1), passIds: z.array(z.string().min(1)).min(1), slotName: z.string().min(1).optional() }).strict(),
|
|
6600
|
+
async run(input, ctx) {
|
|
6601
|
+
await ctx.desktop().requireCapability('v2v-edits', V2V);
|
|
6602
|
+
return ok(await ctx.desktop().post('/agent/timeline/v2v/to-variants', input));
|
|
6603
|
+
},
|
|
6604
|
+
};
|
|
6605
|
+
export const getDiagnosticsStatus = {
|
|
6606
|
+
id: 'slates_get_diagnostics_status',
|
|
6607
|
+
description: "Whether this Slates shares crash and error reports and what it last caught, each marked captured locally / queued: delivery is never confirmed, so tell the person a bug was captured and queued, not that it arrived. Reads only. Free. Requires diagnostics; update Slates on capability refusal.",
|
|
6608
|
+
input: z.object({}).strict(),
|
|
6609
|
+
async run(_input, ctx) {
|
|
6610
|
+
await ctx.desktop().requireCapability('diagnostics', 'the diagnostics status');
|
|
6611
|
+
return ok(await ctx.desktop().get('/agent/diagnostics/status'));
|
|
6612
|
+
},
|
|
6613
|
+
};
|
|
6614
|
+
const WINNING_ADS = 'winning ads';
|
|
6615
|
+
export const findWinningAds = {
|
|
6616
|
+
id: 'slates_find_winning_ads',
|
|
6617
|
+
description: "Search proven ads: the ads that ran longest, by niche, platform, format and words in the advertiser, headline, body or button, each with how long it ran, its variations and its link. The answer says where the list came from and how fresh it is. Break one down into shots with slates_break_down_winning_ad. Free. Requires winning-ads; update Slates on capability refusal.",
|
|
6618
|
+
input: z.object({
|
|
6619
|
+
query: z.string().optional(),
|
|
6620
|
+
niche: z.string().optional().describe('A niche id from slates_list_winning_ad_niches.'),
|
|
6621
|
+
platform: z.enum(['all', 'meta', 'google']).optional(),
|
|
6622
|
+
minRunDays: z.number().int().nonnegative().optional(),
|
|
6623
|
+
format: z.enum(['all', 'video', 'image']).optional(),
|
|
6624
|
+
activeOnly: z.boolean().optional(),
|
|
6625
|
+
hasBreakdown: z.boolean().optional(),
|
|
6626
|
+
sort: z.enum(['run_length', 'variations', 'recent']).optional(),
|
|
6627
|
+
limit: z.number().int().positive().optional().describe("The app caps it."),
|
|
6628
|
+
offset: z.number().int().nonnegative().optional(),
|
|
6629
|
+
}).strict(),
|
|
6630
|
+
async run(input, ctx) {
|
|
6631
|
+
await ctx.desktop().requireCapability('winning-ads', WINNING_ADS);
|
|
6632
|
+
return ok(await ctx.desktop().get('/agent/reference/winning-ads', input));
|
|
6633
|
+
},
|
|
6634
|
+
};
|
|
6635
|
+
export const listWinningAdNiches = {
|
|
6636
|
+
id: 'slates_list_winning_ad_niches',
|
|
6637
|
+
description: 'The winning-ads niches and how many ads each holds, for slates_find_winning_ads. Free. Requires winning-ads; update Slates on capability refusal.',
|
|
6638
|
+
input: z.object({}).strict(),
|
|
6639
|
+
async run(_input, ctx) {
|
|
6640
|
+
await ctx.desktop().requireCapability('winning-ads', WINNING_ADS);
|
|
6641
|
+
return ok(await ctx.desktop().get('/agent/reference/winning-ads/niches'));
|
|
6642
|
+
},
|
|
6643
|
+
};
|
|
6644
|
+
export const breakDownWinningAd = {
|
|
6645
|
+
id: 'slates_break_down_winning_ad',
|
|
6646
|
+
description: "Break a winning ad from slates_find_winning_ads down into shots: one shot per cut with its words, built as a board in the project, the same run as slates_break_down_reference. The board copies the ad's structure and generates nothing; the ad's own footage is never used in it. Free. Requires winning-ads; update Slates on capability refusal.",
|
|
6647
|
+
input: z.object({
|
|
6648
|
+
projectId: z.string().uuid().optional().describe('Defaults to the open project.'),
|
|
6649
|
+
adId: z.string().min(1).describe('The adId from slates_find_winning_ads.'),
|
|
6650
|
+
platform: z.enum(['meta', 'google']).optional().describe('Default meta.'),
|
|
6651
|
+
build: z.boolean().optional().describe('As on slates_break_down_reference.'),
|
|
6652
|
+
name: z.string().optional(),
|
|
6653
|
+
model: z.string().optional(),
|
|
6654
|
+
jobId: z.string().optional(),
|
|
6655
|
+
}).strict(),
|
|
6656
|
+
async run(input, ctx) {
|
|
6657
|
+
await ctx.desktop().requireCapability('winning-ads', WINNING_ADS);
|
|
6658
|
+
return ok(await ctx.desktop().post('/agent/reference/winning-ads/breakdown', input));
|
|
6659
|
+
},
|
|
6660
|
+
};
|
|
6108
6661
|
export const listTimelines = {
|
|
6109
6662
|
id: 'slates_list_timelines', description: "List the independent named cuts in a project (not a slot's alternative timelines: slates_get_variants names those). Use the selected timelineId for edits, builds and exports.",
|
|
6110
6663
|
input: z.object({ projectId: z.string().uuid() }),
|
|
@@ -6121,6 +6674,7 @@ export const saveTimeline = {
|
|
|
6121
6674
|
if (input.delivery !== undefined || input.taxonomy !== undefined || input.gridBinding !== undefined) {
|
|
6122
6675
|
await ctx.desktop().requireCapability('ad-variant-export', 'cut delivery, naming and grid bindings');
|
|
6123
6676
|
}
|
|
6677
|
+
await requireDeliveryEncoding(ctx.desktop(), input.delivery);
|
|
6124
6678
|
return ok(await ctx.desktop().post('/agent/timelines', input));
|
|
6125
6679
|
},
|
|
6126
6680
|
};
|
|
@@ -6445,7 +6999,7 @@ const audioEffectList = z
|
|
|
6445
6999
|
.array(z
|
|
6446
7000
|
.object({
|
|
6447
7001
|
id: z.string().max(64).optional().describe('Kept when sent back; a new effect gets one.'),
|
|
6448
|
-
type: z.enum(['volume', 'eq']).describe("volume: gain in dB (param gainDb, -60 silent to +12). eq: ten bands in this order: a high-pass, a low shelf, six bells, a high shelf, a low-pass; send the ones it plays as bands. An older eq's 'lowpass.frequency' and 'lowpass.q' read as the low-pass at 12 dB."),
|
|
7002
|
+
type: z.enum(['volume', 'eq', 'denoise', 'voice_enhance']).describe("volume: gain in dB (param gainDb, -60 silent to +12). eq: ten bands in this order: a high-pass, a low shelf, six bells, a high shelf, a low-pass; send the ones it plays as bands. An older eq's 'lowpass.frequency' and 'lowpass.q' read as the low-pass at 12 dB. denoise: pushes the noise between words down (amount 0 to 1, floorDb -48 to -12). voice_enhance: a broadcast voice chain, EQ and levelling (amount 0 to 1)."),
|
|
6449
7003
|
bypass: z.boolean().optional(),
|
|
6450
7004
|
params: z.record(z.number()).optional().describe("Fixed values by parameter name ('gainDb'; an eq's '<band>.<name>', as 'bell3.gain' or 'highpass.slope')."),
|
|
6451
7005
|
keyframes: z.record(keyframeKeys.max(4000)).optional().describe('Keys by parameter name; a keyed parameter reads its keys instead of its fixed value.'),
|
|
@@ -6453,6 +7007,8 @@ const audioEffectList = z
|
|
|
6453
7007
|
})
|
|
6454
7008
|
.strict())
|
|
6455
7009
|
.max(16);
|
|
7010
|
+
/** True when an effect list holds a voice cleaner (denoise, voice_enhance), which an older desktop refuses. */
|
|
7011
|
+
const usesVoiceCleaners = (effects) => (effects ?? []).some((e) => e.type === 'denoise' || e.type === 'voice_enhance');
|
|
6456
7012
|
/** True when an effect list uses the ten-band EQ: a band list, or a parameter an older desktop does not know. */
|
|
6457
7013
|
function usesEqBands(effects) {
|
|
6458
7014
|
const legacy = new Set(['lowpass.frequency', 'lowpass.q']);
|
|
@@ -6463,6 +7019,8 @@ function usesEqBands(effects) {
|
|
|
6463
7019
|
async function requireEqBands(desktop, effects) {
|
|
6464
7020
|
if (usesEqBands(effects))
|
|
6465
7021
|
await desktop.requireCapability('eq-bands', 'the ten-band EQ');
|
|
7022
|
+
if (usesVoiceCleaners(effects))
|
|
7023
|
+
await desktop.requireCapability('audio-suite', 'denoise and voice enhance');
|
|
6466
7024
|
}
|
|
6467
7025
|
/** A clip's panel (slate's `src/shared/clipPanel.ts`): lengths in fractions of the frame's height. */
|
|
6468
7026
|
const clipPanel = z.object({
|
|
@@ -6480,9 +7038,53 @@ const clipPanel = z.object({
|
|
|
6480
7038
|
color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).optional().describe('#rrggbb; default white.'),
|
|
6481
7039
|
}).strict().optional().describe('Present is on: {} is the default border.'),
|
|
6482
7040
|
}).strict();
|
|
7041
|
+
/** A clip's look (slate's `src/shared/clipLook.ts`): blend, grain, colour, exposure, the grade and a LUT. */
|
|
7042
|
+
const GRADE_DESCRIBE = '-1 to 1; 0 is as shot.';
|
|
7043
|
+
const clipLookInput = z.object({
|
|
7044
|
+
blend: z.enum(['normal', 'multiply', 'screen', 'overlay', 'soft-light']).optional(),
|
|
7045
|
+
grain: z.number().min(0).max(1).optional(),
|
|
7046
|
+
saturation: z.number().min(0).max(2).optional(),
|
|
7047
|
+
exposure: z.number().min(-4).max(4).optional().describe('Stops of light: 1 is twice as bright, -1 half.'),
|
|
7048
|
+
contrast: z.number().min(-1).max(1).optional().describe(`Flat (-1) to punchy (1). ${GRADE_DESCRIBE}`),
|
|
7049
|
+
temperature: z.number().min(-1).max(1).optional().describe(`Cool blue (-1) to warm amber (1). ${GRADE_DESCRIBE}`),
|
|
7050
|
+
tint: z.number().min(-1).max(1).optional().describe(`Green (-1) to magenta (1). ${GRADE_DESCRIBE}`),
|
|
7051
|
+
highlights: z.number().min(-1).max(1).optional().describe(`Pulls the bright parts down (-1) or lifts them (1). ${GRADE_DESCRIBE}`),
|
|
7052
|
+
shadows: z.number().min(-1).max(1).optional().describe(`Crushes the dark parts (-1) or opens them (1). ${GRADE_DESCRIBE}`),
|
|
7053
|
+
lutPath: localFile('lutPath', ['cube']).optional().describe('A 3D LUT (.cube) laid on after the grade, by its absolute path; the app copies it into the project.'),
|
|
7054
|
+
lutIntensity: z.number().min(0).max(1).optional().describe('How much of the LUT shows, 0 to 1 (default 1).'),
|
|
7055
|
+
}).strict();
|
|
7056
|
+
const GRADE_FIELDS = ['contrast', 'temperature', 'tint', 'highlights', 'shadows', 'lutPath', 'lutIntensity'];
|
|
7057
|
+
/** A clip's matte (slate's `src/shared/clipMatte.ts`): a subject mask, a shape, or a colour key. One kind at a time. */
|
|
7058
|
+
const clipMatteInput = z.union([
|
|
7059
|
+
z.object({
|
|
7060
|
+
maskId: z.string().regex(/^[A-Za-z0-9_-]{1,80}$/).describe("One of the clip's own media's subject masks."),
|
|
7061
|
+
mode: z.enum(['subject', 'background']).optional().describe('subject (default) draws only the subject; background everything but it.'),
|
|
7062
|
+
feather: z.number().min(0).max(1).optional().describe('How soft the edge is: 0 as made, 1 softened over about 3% of the picture height. Default 0.'),
|
|
7063
|
+
}).strict(),
|
|
7064
|
+
z.object({
|
|
7065
|
+
shape: z.object({
|
|
7066
|
+
kind: z.enum(['rect', 'ellipse']),
|
|
7067
|
+
x: z.number().min(0).max(1).describe('Centre, 0 left to 1 right.'),
|
|
7068
|
+
y: z.number().min(0).max(1).describe('Centre, 0 top to 1 bottom.'),
|
|
7069
|
+
w: z.number().min(0.01).max(2).describe("Width as a fraction of the picture's."),
|
|
7070
|
+
h: z.number().min(0.01).max(2).describe("Height as a fraction of the picture's."),
|
|
7071
|
+
rotation: z.number().min(-180).max(180).optional().describe('Degrees clockwise.'),
|
|
7072
|
+
feather: z.number().min(0).max(1).optional().describe('0 crisp to 1 soft.'),
|
|
7073
|
+
invert: z.boolean().optional().describe('Draw what is outside the shape instead.'),
|
|
7074
|
+
}).strict(),
|
|
7075
|
+
}).strict(),
|
|
7076
|
+
z.object({
|
|
7077
|
+
chroma: z.object({
|
|
7078
|
+
color: z.string().regex(/^#[0-9a-fA-F]{6}$/).describe("The screen's colour, #rrggbb (#00ff00 green, #0000ff blue)."),
|
|
7079
|
+
tolerance: z.number().min(0).max(1).describe('How far from the colour still keys out; 0.35 is a good start.'),
|
|
7080
|
+
softness: z.number().min(0).max(1).describe('Width of the soft edge; 0.2 is a good start.'),
|
|
7081
|
+
spill: z.number().min(0).max(1).optional().describe("How much of the screen's colour is pulled off the subject."),
|
|
7082
|
+
}).strict(),
|
|
7083
|
+
}).strict(),
|
|
7084
|
+
]);
|
|
6483
7085
|
export const updateClip = {
|
|
6484
7086
|
id: 'slates_update_clip',
|
|
6485
|
-
description: "Set a timeline clip's own speed, volume, split edit (J-cut or L-cut) and fades, as the Cut's Inspector does. Only the fields you name change; null puts one back to the default. speed keeps the clip's media in and out points and its start and changes its length (2 is twice as fast, half as long); with ripple: true the lane's later clips move by the change, otherwise a longer clip covers what follows. audioOffsetFrames, on a video clip, moves its own sound against its picture in sync: below 0 is a J-cut (the sound starts first), above 0 an L-cut (it runs on). Fades are frames: fadeIn/fadeOut for the picture, audioFadeIn/audioFadeOut for the sound. volume is linear gain (1 = 0 dB, 0 = silent). look, on a clip with a picture, is the Inspector's Blend, Grain, Colour and Exposure, sent whole: blend mixes the picture with what is under it (multiply darkens, screen lightens, overlay and soft-light add contrast), grain is film grain from 0 to 1, saturation is colour from 0 (black and white) through 1 (as shot) to 2, exposure is stops of light from -4 to 4 (1 twice as bright); null clears the look. matte draws a video clip through one of its subject masks (slates_get_subject_mask lists them): mode subject draws only the subject, background everything but it, feather softens the edge from 0 to 1; lay a matted copy over the clip and put a title on a lane between them (slates_update_timeline_track above or below) to put the title behind the subject. space turns any picture clip in 3D about its centre: pitch leans the top away (degrees, -85 to 85), yaw turns the right edge away (-85 to 85), perspective 0 flat to 1 very wide (0.5 a normal lens). panel makes it a floating panel: radius rounds the corners, shadow puts a soft shadow under it, border a line just inside its edge; lengths are fractions of the frame's height (0.02 is about 22 px at 1080p). blur is a lens blur, amount 0 sharp to 1 (a point spreads over 5% of the frame's height), with a maskId to blur only around the subject and keep it sharp. Each of matte, space, panel and blur is sent whole and null clears it; their amounts can be keyed with slates_set_clip_keyframes. effects is the clip's sound effects, sent whole, in order: a volume (gain in dB) and an eq (up to ten bands: high- and low-pass cuts at 6 to 48 dB per octave, shelves, bells, a notch, a band-pass), each value fixed or keyed in frames from the clip's start, the same in preview and export. speedRamp keys the speed over the clip (a slow-motion ramp): media in and out stay, the length becomes what the keys take, and the sound follows tape-style; not with speed. speedSound 'tape' makes a constant speed's sound change pitch with it. On an audio lane, startSec, sourceInSec and sourceOutSec (or sourceInSample and sourceOutSample) set where its sound starts and its media in and out to the sample, for a music edit between frames; a longer clip covers what follows unless ripple; not with speed in the same call.",
|
|
7087
|
+
description: "Set a timeline clip's own speed, volume, split edit (J-cut or L-cut) and fades, as the Cut's Inspector does. Only the fields you name change; null puts one back to the default. speed keeps the clip's media in and out points and its start and changes its length (2 is twice as fast, half as long); with ripple: true the lane's later clips move by the change, otherwise a longer clip covers what follows. audioOffsetFrames, on a video clip, moves its own sound against its picture in sync: below 0 is a J-cut (the sound starts first), above 0 an L-cut (it runs on). Fades are frames: fadeIn/fadeOut for the picture, audioFadeIn/audioFadeOut for the sound. volume is linear gain (1 = 0 dB, 0 = silent). look, on a clip with a picture, is the Inspector's Blend, Grain, Colour and Exposure, sent whole: blend mixes the picture with what is under it (multiply darkens, screen lightens, overlay and soft-light add contrast), grain is film grain from 0 to 1, saturation is colour from 0 (black and white) through 1 (as shot) to 2, exposure is stops of light from -4 to 4 (1 twice as bright); null clears the look. matte draws a video clip through one of its subject masks (slates_get_subject_mask lists them): mode subject draws only the subject, background everything but it, feather softens the edge from 0 to 1; lay a matted copy over the clip and put a title on a lane between them (slates_update_timeline_track above or below) to put the title behind the subject. space turns any picture clip in 3D about its centre: pitch leans the top away (degrees, -85 to 85), yaw turns the right edge away (-85 to 85), perspective 0 flat to 1 very wide (0.5 a normal lens). panel makes it a floating panel: radius rounds the corners, shadow puts a soft shadow under it, border a line just inside its edge; lengths are fractions of the frame's height (0.02 is about 22 px at 1080p). blur is a lens blur, amount 0 sharp to 1 (a point spreads over 5% of the frame's height), with a maskId to blur only around the subject and keep it sharp. look also takes a grade and a .cube LUT, matte a shape mask or a colour key, and reversed plays it backward (each field says how). Each of matte, space, panel and blur is sent whole and null clears it; their amounts can be keyed with slates_set_clip_keyframes. effects is the clip's sound effects, sent whole, in order: a volume (gain in dB) and an eq (up to ten bands: high- and low-pass cuts at 6 to 48 dB per octave, shelves, bells, a notch, a band-pass), each value fixed or keyed in frames from the clip's start, the same in preview and export. speedRamp keys the speed over the clip (a slow-motion ramp): media in and out stay, the length becomes what the keys take, and the sound follows tape-style; not with speed. speedSound 'tape' makes a constant speed's sound change pitch with it. On an audio lane, startSec, sourceInSec and sourceOutSec (or sourceInSample and sourceOutSample) set where its sound starts and its media in and out to the sample, for a music edit between frames; a longer clip covers what follows unless ripple; not with speed in the same call.",
|
|
6486
7088
|
input: z.object({
|
|
6487
7089
|
projectId: z.string().uuid(),
|
|
6488
7090
|
clipId: z.string().uuid(),
|
|
@@ -6493,17 +7095,9 @@ export const updateClip = {
|
|
|
6493
7095
|
fadeOutFrames: z.number().int().min(0).nullable().optional(),
|
|
6494
7096
|
audioFadeInFrames: z.number().int().min(0).nullable().optional(),
|
|
6495
7097
|
audioFadeOutFrames: z.number().int().min(0).nullable().optional(),
|
|
6496
|
-
look:
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
saturation: z.number().min(0).max(2).optional(),
|
|
6500
|
-
exposure: z.number().min(-4).max(4).optional().describe('Stops of light: 1 is twice as bright, -1 half.'),
|
|
6501
|
-
}).strict().nullable().optional().describe('The whole look, at least one field; a field left out is its default (normal, no grain, colour 1, exposure 0). null clears it.'),
|
|
6502
|
-
matte: z.object({
|
|
6503
|
-
maskId: z.string().regex(/^[A-Za-z0-9_-]{1,80}$/).describe("One of the clip's own media's subject masks."),
|
|
6504
|
-
mode: z.enum(['subject', 'background']).optional().describe('subject (default) draws only the subject; background everything but it.'),
|
|
6505
|
-
feather: z.number().min(0).max(1).optional().describe('How soft the edge is: 0 as made, 1 softened over about 3% of the picture height. Default 0.'),
|
|
6506
|
-
}).strict().nullable().optional().describe('A video clip drawn through a subject mask; null draws the whole picture.'),
|
|
7098
|
+
look: clipLookInput.nullable().optional().describe('The whole look, at least one field; a field left out is its default (normal, no grain, colour 1, exposure 0, no grade, no LUT). null clears it.'),
|
|
7099
|
+
matte: clipMatteInput.nullable().optional().describe('A subject mask ({ maskId }), a shape ({ shape }) or a colour key ({ chroma }); null draws the whole picture.'),
|
|
7100
|
+
reversed: z.boolean().nullable().optional().describe("true plays the clip's media backward (its linked sound too); false or null forward."),
|
|
6507
7101
|
space: z.object({
|
|
6508
7102
|
pitch: z.number().min(-85).max(85).optional().describe('Degrees; positive leans the top away.'),
|
|
6509
7103
|
yaw: z.number().min(-85).max(85).optional().describe('Degrees; positive turns the right edge away.'),
|
|
@@ -6532,7 +7126,11 @@ export const updateClip = {
|
|
|
6532
7126
|
}
|
|
6533
7127
|
// An empty look would clear the clip's look without saying so; null is how to ask for that.
|
|
6534
7128
|
if (input.look && Object.keys(input.look).length === 0)
|
|
6535
|
-
throw new Error('look needs at least one
|
|
7129
|
+
throw new Error('look needs at least one field (blend, grain, saturation, exposure, a grade value or a LUT); send look: null to clear it');
|
|
7130
|
+
const matteKind = input.matte && ('shape' in input.matte || 'chroma' in input.matte);
|
|
7131
|
+
if (GRADE_FIELDS.some((f) => input.look?.[f] !== undefined) || matteKind || input.reversed !== undefined) {
|
|
7132
|
+
await desktop.requireCapability('clip-grade', 'the grade, LUTs, colour keys, shape masks and reverse');
|
|
7133
|
+
}
|
|
6536
7134
|
if (input.look !== undefined)
|
|
6537
7135
|
await desktop.requireCapability('clip-look', "a clip's blend, grain and colour");
|
|
6538
7136
|
if (input.look?.exposure !== undefined || input.matte !== undefined || input.space !== undefined || input.panel !== undefined || input.blur !== undefined) {
|
|
@@ -6596,7 +7194,9 @@ export const addTimelineTrack = {
|
|
|
6596
7194
|
// and the batch cap slate's `src/main/agent/routes-editor.ts`, which this package cannot import;
|
|
6597
7195
|
// lockstep check 12 fails when they differ. The 0..1 position and
|
|
6598
7196
|
// opacity are fractions by definition, not a desktop choice.
|
|
6599
|
-
|
|
7197
|
+
// A desktop before the caption presets refuses one of the last six by name, so they need no gate.
|
|
7198
|
+
const TEXT_STYLE_IDS = ['word-pop', 'keyword', 'subtitle', 'headline', 'clean', 'plain',
|
|
7199
|
+
'active-pill', 'reel-bold', 'impact-hook', 'lower-third', 'minimal-caption', 'kinetic-pop'];
|
|
6600
7200
|
// A text clip set exactly (slate 1.6.x, capability text-fonts): the fonts Slates carries, the exact size,
|
|
6601
7201
|
// the picture before the words and a line of clips, mirrored from slate's `src/shared/textStyles.ts` and
|
|
6602
7202
|
// `src/shared/overlays.ts` like the rest (lockstep check 12).
|
|
@@ -7067,6 +7667,7 @@ export const updateTimelineSettings = {
|
|
|
7067
7667
|
if (input.delivery !== undefined || input.taxonomy !== undefined || input.gridBinding !== undefined) {
|
|
7068
7668
|
await desktop.requireCapability('ad-variant-export', 'cut delivery, naming and grid bindings');
|
|
7069
7669
|
}
|
|
7670
|
+
await requireDeliveryEncoding(desktop, input.delivery);
|
|
7070
7671
|
if (input.timelineId && input.delivery !== undefined && Object.keys(input).every(key => ['projectId', 'timelineId', 'delivery'].includes(key))) {
|
|
7071
7672
|
return ok(await desktop.post('/agent/timeline/delivery', input));
|
|
7072
7673
|
}
|
|
@@ -7077,16 +7678,17 @@ export const updateTimelineSettings = {
|
|
|
7077
7678
|
export const exportVideo = {
|
|
7078
7679
|
id: 'slates_export_video',
|
|
7079
7680
|
billable: false,
|
|
7080
|
-
description: "Render the project's timeline to
|
|
7681
|
+
description: "Render the project's timeline to a video file on disk through the desktop app's timeline engine, the renderer its monitor shows, so the file matches the preview (H.264 + AAC by default, every video lane composited with its transitions, fades and keyframes, gaps rendered as black; the Slates window must be open, and the export opens the timeline's project there first, answering openedProject: true when it did). No dialogs — pass an absolute outputPath ending in .mp4 (.mov for codec prores). presetId exports for a platform (tiktok, reels, meta-feed, stories, shorts, youtube: its bitrate, frame-rate ceiling and sound); codec, videoBitrateMbps and fps override it, or the cut's own encoding, for this file. Fails if the file exists unless overwrite=true. Blocks until encoding finishes (can take minutes for long timelines) and returns the real file size and probed duration. After success, consider slates_reveal_file to show the file to the user. Requires at least one video clip on the timeline. The sound is AAC at the timeline's Sound bitrate (slates_update_timeline_settings audioBitrate; default 320 kb/s) unless audioBitrate names one for this file. Pass exactly one of projectId (the project's default timeline) or timelineId (a named cut).",
|
|
7081
7682
|
input: z
|
|
7082
7683
|
.object({
|
|
7083
7684
|
projectId: z.string().uuid().optional(),
|
|
7084
7685
|
timelineId: z.string().uuid().optional(),
|
|
7085
|
-
outputPath: localFile('outputPath', ['mp4'])
|
|
7086
|
-
.describe('Absolute path for the rendered file, ending in .mp4 (e.g. C:\\Users\\you\\Videos\\ad.mp4 or /Users/you/ad.mp4). slates_get_project_directory gives a sensible default folder.'),
|
|
7686
|
+
outputPath: localFile('outputPath', ['mp4', 'mov'])
|
|
7687
|
+
.describe('Absolute path for the rendered file, ending in .mp4, or .mov for prores (e.g. C:\\Users\\you\\Videos\\ad.mp4 or /Users/you/ad.mp4). slates_get_project_directory gives a sensible default folder.'),
|
|
7087
7688
|
overwrite: z.boolean().optional(),
|
|
7088
7689
|
aspect: deliveryAspectInput.optional().describe('Optional delivery aspect from slates_get_variant_grid; requires ad-variant-export. Omission keeps existing export behavior.'),
|
|
7089
7690
|
audioBitrate: audioBitrateInput.optional().describe(`This file's AAC sound in kb/s (${AUDIO_BITRATES.join(', ')}); omit for the timeline's Sound bitrate.`),
|
|
7691
|
+
...exportEncodingShape,
|
|
7090
7692
|
})
|
|
7091
7693
|
.refine((d) => !!d.projectId !== !!d.timelineId, {
|
|
7092
7694
|
message: 'Pass exactly one of projectId or timelineId',
|
|
@@ -7094,6 +7696,12 @@ export const exportVideo = {
|
|
|
7094
7696
|
async run(input, ctx) {
|
|
7095
7697
|
const desktop = ctx.desktop();
|
|
7096
7698
|
await desktop.requireCapability('export', 'video export');
|
|
7699
|
+
if (input.presetId !== undefined || input.codec !== undefined || input.videoBitrateMbps !== undefined || input.fps !== undefined) {
|
|
7700
|
+
await desktop.requireCapability('export-encoding', 'platform presets and export encoding');
|
|
7701
|
+
}
|
|
7702
|
+
if (input.codec !== undefined && (input.codec === 'prores') !== /\.mov$/i.test(input.outputPath)) {
|
|
7703
|
+
throw new Error('A prores export writes a .mov file and every other codec an .mp4: change outputPath to match.');
|
|
7704
|
+
}
|
|
7097
7705
|
if (input.aspect !== undefined)
|
|
7098
7706
|
await desktop.requireCapability('ad-variant-export', 'single video delivery export');
|
|
7099
7707
|
if (input.audioBitrate !== undefined)
|
|
@@ -7105,9 +7713,13 @@ export const exportVideo = {
|
|
|
7105
7713
|
overwrite: input.overwrite,
|
|
7106
7714
|
aspect: input.aspect,
|
|
7107
7715
|
audioBitrate: input.audioBitrate,
|
|
7716
|
+
presetId: input.presetId,
|
|
7717
|
+
codec: input.codec,
|
|
7718
|
+
videoBitrateMbps: input.videoBitrateMbps,
|
|
7719
|
+
fps: input.fps,
|
|
7108
7720
|
});
|
|
7109
7721
|
const mb = r.fileSizeBytes != null ? (r.fileSizeBytes / (1024 * 1024)).toFixed(1) : '?';
|
|
7110
|
-
return ok(r, `Exported ${r.durationSec ?? '?'}s MP4 (${mb} MB) to ${r.outputPath ?? input.outputPath}.`);
|
|
7722
|
+
return ok(r, `Exported ${r.durationSec ?? '?'}s ${/\.mov$/i.test(input.outputPath) ? 'MOV' : 'MP4'} (${mb} MB) to ${r.outputPath ?? input.outputPath}.`);
|
|
7111
7723
|
},
|
|
7112
7724
|
};
|
|
7113
7725
|
export const exportTimelineXml = {
|
|
@@ -9975,6 +10587,34 @@ export const ALL_OPERATIONS = [
|
|
|
9975
10587
|
getRecipe,
|
|
9976
10588
|
reframeClip,
|
|
9977
10589
|
getReframeReport,
|
|
10590
|
+
freezeFrame,
|
|
10591
|
+
stabilizeClip,
|
|
10592
|
+
slideClip,
|
|
10593
|
+
punchIn,
|
|
10594
|
+
cleanUpDialogue,
|
|
10595
|
+
autoColourClip,
|
|
10596
|
+
autoDuck,
|
|
10597
|
+
matchLoudness,
|
|
10598
|
+
upscaleImage,
|
|
10599
|
+
getReviewPacket,
|
|
10600
|
+
resolveReviewNote,
|
|
10601
|
+
getAdWinners,
|
|
10602
|
+
setRecipeVerdict,
|
|
10603
|
+
moreLikeThis,
|
|
10604
|
+
planSplitTest,
|
|
10605
|
+
evaluateSplitTestWinner,
|
|
10606
|
+
visualQaSample,
|
|
10607
|
+
visualQaRecordRound,
|
|
10608
|
+
listVisualQaRuns,
|
|
10609
|
+
listV2vPasses,
|
|
10610
|
+
editV2vPass,
|
|
10611
|
+
quoteV2vPasses,
|
|
10612
|
+
runV2vPasses,
|
|
10613
|
+
v2vPassesToVariants,
|
|
10614
|
+
getDiagnosticsStatus,
|
|
10615
|
+
findWinningAds,
|
|
10616
|
+
listWinningAdNiches,
|
|
10617
|
+
breakDownWinningAd,
|
|
9978
10618
|
getTimeline,
|
|
9979
10619
|
getTimelineLoudness,
|
|
9980
10620
|
addClipToTimeline,
|