@slatesvideo/shared 0.7.11 → 0.7.12
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 +352 -59
- package/dist/operations/index.js +438 -36
- package/dist/operations/surface.js +6 -0
- package/dist/skills/content.js +9 -4
- package/dist/skills/hyperframes-content.js +11 -11
- package/package.json +1 -1
- package/skills/hyperframes/NOTICE +24 -0
- package/skills/hyperframes/SLATES-MAPPING.md +5 -4
- package/skills/hyperframes/faceless-explainer/references/motion-language.md +13 -17
- package/skills/hyperframes/faceless-explainer/references/visual-design.md +10 -10
- package/skills/hyperframes/hyperframes/references/frame-worker-core.md +1 -1
- package/skills/hyperframes/hyperframes-animation/adapters/gsap-easing-and-stagger.md +20 -24
- package/skills/hyperframes/hyperframes-animation/rules/sine-wave-loop.md +1 -1
- package/skills/hyperframes/hyperframes-animation/rules/spring-pop-entrance.md +18 -25
- package/skills/hyperframes/pr-to-video/references/motion-language.md +13 -17
- package/skills/hyperframes/pr-to-video/references/visual-design.md +8 -8
- package/skills/hyperframes/product-launch-video/references/motion-language.md +13 -17
- package/skills/hyperframes/product-launch-video/references/visual-design.md +10 -10
- package/skills/slates-start-here.md +20 -14
package/dist/operations/index.js
CHANGED
|
@@ -1010,7 +1010,7 @@ export const getUsage = {
|
|
|
1010
1010
|
};
|
|
1011
1011
|
export const getAppSettings = {
|
|
1012
1012
|
id: 'slates_get_app_settings',
|
|
1013
|
-
description: "The app's own settings an agent may read: the app version, the projects folder, which tab a never-opened project lands on (newProjectLens), whether ChatGPT images is on,
|
|
1013
|
+
description: "The app's own settings an agent may read: the app version, the projects folder, which tab a never-opened project lands on (newProjectLens), whether ChatGPT images is on, (from Slates 1.6.1) who does Slates Director's thinking (studioAgentHost: slates, codex or claude) with each host's model and thinking level ('' is its default), and (newer Slates) makeProxiesAtImport (off by default) with proxies: what the clips' proxies take on disk, per project. Never keys or sign-in.",
|
|
1014
1014
|
input: z.object({}).strict(),
|
|
1015
1015
|
async run(_input, ctx) {
|
|
1016
1016
|
await ctx.desktop().requireCapability('app-settings', 'app settings');
|
|
@@ -1020,7 +1020,7 @@ export const getAppSettings = {
|
|
|
1020
1020
|
const HOST_KEYS = ['studioAgentHost', 'studioAgentCodexModel', 'studioAgentCodexEffort', 'studioAgentClaudeModel', 'studioAgentClaudeEffort'];
|
|
1021
1021
|
export const setAppSettings = {
|
|
1022
1022
|
id: 'slates_set_app_settings',
|
|
1023
|
-
description: "Change an app setting the user asked you to: newProjectLens (the tab a never-opened project lands on: media, script or board), chatGptImagesEnabled (Settings → AI tools → ChatGPT images), or who does Slates Director's thinking: studioAgentHost (slates, codex for the user's own Codex on their ChatGPT plan, claude for their own Claude Code on their Claude plan) and each host's model and thinking level, ids from the host's own list or '' for its default. The projects folder, keys and sign-in are the user's to change.",
|
|
1023
|
+
description: "Change an app setting the user asked you to: newProjectLens (the tab a never-opened project lands on: media, script or board), chatGptImagesEnabled (Settings → AI tools → ChatGPT images), or who does Slates Director's thinking: studioAgentHost (slates, codex for the user's own Codex on their ChatGPT plan, claude for their own Claude Code on their Claude plan) and each host's model and thinking level, ids from the host's own list or '' for its default; makeProxiesAtImport (Settings → Storage → Make proxies automatically at import: never turn it on unless the user asked, it starts off); clearProxies ('all', or a project id) deletes those proxies, which the clips' own files replace until one is made again. The projects folder, keys and sign-in are the user's to change.",
|
|
1024
1024
|
input: z
|
|
1025
1025
|
.object({
|
|
1026
1026
|
newProjectLens: z.enum(['media', 'script', 'board']).optional(),
|
|
@@ -1030,6 +1030,8 @@ export const setAppSettings = {
|
|
|
1030
1030
|
studioAgentCodexEffort: z.string().max(120).optional(),
|
|
1031
1031
|
studioAgentClaudeModel: z.string().max(120).optional(),
|
|
1032
1032
|
studioAgentClaudeEffort: z.string().max(120).optional(),
|
|
1033
|
+
makeProxiesAtImport: z.boolean().optional().describe('Only when the user asked: on, every camera file that needs a proxy gets one at import.'),
|
|
1034
|
+
clearProxies: z.union([z.literal('all'), z.string().uuid()]).optional().describe("'all', or one project's id: deletes its proxies."),
|
|
1033
1035
|
})
|
|
1034
1036
|
.strict(),
|
|
1035
1037
|
async run(input, ctx) {
|
|
@@ -1038,6 +1040,9 @@ export const setAppSettings = {
|
|
|
1038
1040
|
if (HOST_KEYS.some((key) => input[key] !== undefined)) {
|
|
1039
1041
|
await ctx.desktop().requireCapability('agent-host', "choosing who does Slates Director's thinking");
|
|
1040
1042
|
}
|
|
1043
|
+
if (input.makeProxiesAtImport !== undefined || input.clearProxies !== undefined) {
|
|
1044
|
+
await ctx.desktop().requireCapability('proxies', 'proxies');
|
|
1045
|
+
}
|
|
1041
1046
|
return ok(await ctx.desktop().post('/agent/app-settings', input));
|
|
1042
1047
|
},
|
|
1043
1048
|
};
|
|
@@ -1304,6 +1309,263 @@ export const cutToBeats = {
|
|
|
1304
1309
|
return ok(r, `${split ? 'Cut at' : 'Moved'} ${r.cuts.length} ${split ? 'beat' : 'cut'}${r.cuts.length === 1 ? '' : 's'}${split ? '' : ' onto the beat'}.${skipped}`);
|
|
1305
1310
|
},
|
|
1306
1311
|
};
|
|
1312
|
+
// A video clip's subject masks (slate subject masks plan step 2): the desktop routes are GET /agent/timeline/masks
|
|
1313
|
+
// (list, or one mask's report) and POST /agent/timeline/masks (make, refine, cancel, delete, pin), the same core as
|
|
1314
|
+
// the Viewer's Mask tool (slate `src/main/subjectMask/service.ts`). Reading and changing are two ops because the
|
|
1315
|
+
// approval hint is per tool. The asset or clip is named as for a beat grid.
|
|
1316
|
+
const maskTarget = {
|
|
1317
|
+
assetId: z.string().min(1).optional().describe('A video asset: its code (VID-A2) or id. Or name clipId.'),
|
|
1318
|
+
clipId: z.string().uuid().optional().describe("A video clip on the timeline: its file's masks. With a clip, a prompt or stroke may name timelineFrame."),
|
|
1319
|
+
};
|
|
1320
|
+
const maskMoment = {
|
|
1321
|
+
frame: z.number().int().min(0).optional().describe("The file's own frame (0 is its first)."),
|
|
1322
|
+
sec: z.number().min(0).optional().describe("Or seconds into the file."),
|
|
1323
|
+
timelineFrame: z.number().min(0).optional().describe('Or, with clipId (required for it), a frame of the cut inside that clip.'),
|
|
1324
|
+
};
|
|
1325
|
+
const maskPoint = z.object({
|
|
1326
|
+
x: z.number().min(0).max(1).describe('Fraction of the picture width from the left.'),
|
|
1327
|
+
y: z.number().min(0).max(1).describe('Fraction of the picture height from the top.'),
|
|
1328
|
+
positive: z.boolean().optional().describe('true (default) keeps what is under it; false takes it out.'),
|
|
1329
|
+
}).strict();
|
|
1330
|
+
const maskPrompt = z.object({
|
|
1331
|
+
...maskMoment,
|
|
1332
|
+
points: z.array(maskPoint).max(16).optional().describe('Clicks on the subject (and negative ones on what is not it).'),
|
|
1333
|
+
box: z.tuple([z.number(), z.number(), z.number(), z.number()]).optional().describe('[x, y, width, height] around the subject, fractions of the picture.'),
|
|
1334
|
+
name: z.string().min(1).max(80).optional().describe('What the subject is ("the dog", "red car"): the best match on that frame is used as its box.'),
|
|
1335
|
+
}).strict();
|
|
1336
|
+
const maskStroke = z.object({
|
|
1337
|
+
...maskMoment,
|
|
1338
|
+
mode: z.enum(['add', 'remove']).describe('add paints the stroke into the mask; remove takes it out.'),
|
|
1339
|
+
radius: z.number().min(0.002).max(0.2).optional().describe('Brush radius, a fraction of the picture\'s long edge. Default 0.02.'),
|
|
1340
|
+
path: z.array(z.tuple([z.number().min(0).max(1), z.number().min(0).max(1)])).min(1).max(2000).describe('[x, y] points of the stroke, fractions of the picture.'),
|
|
1341
|
+
}).strict();
|
|
1342
|
+
const maskParams = z.object({
|
|
1343
|
+
feather: z.number().min(0).max(0.05).optional().describe("Edge softness, a fraction of the long edge. Default 0.002."),
|
|
1344
|
+
grow: z.number().min(-0.05).max(0.05).optional().describe('Grow the edge out (positive) or shrink it in (negative), a fraction of the long edge. Default 0.'),
|
|
1345
|
+
smoothing: z.number().min(0).max(1).optional().describe('Smooth edge flicker over time, 0 none to 1 most. Default 0.3.'),
|
|
1346
|
+
}).strict();
|
|
1347
|
+
function maskWords(m) {
|
|
1348
|
+
if (m.status === 'failed')
|
|
1349
|
+
return `Mask ${m.maskId} failed: ${m.error ?? 'unknown error'}.`;
|
|
1350
|
+
if (m.status !== 'ready') {
|
|
1351
|
+
const p = m.progress ? ` (${m.progress.stage} ${m.progress.percent}%${m.progress.totalMB ? `, ${m.progress.downloadedMB} of ${m.progress.totalMB} MB` : ''})` : '';
|
|
1352
|
+
return `Mask ${m.maskId} is still being made${p}. Read it with slates_get_subject_mask and waitSeconds.`;
|
|
1353
|
+
}
|
|
1354
|
+
const spans = (list) => list.slice(0, 6).map((s) => `frames ${s.start}-${s.end} (${s.fromSec}-${s.toSec} s)`).join(', ');
|
|
1355
|
+
const lost = m.lostSpans.length
|
|
1356
|
+
? ` ${m.lostSpans.length} lost span${m.lostSpans.length === 1 ? '' : 's'} (the subject hidden or the track unsure; look at the contact sheet before adding a point): ${spans(m.lostSpans)}.`
|
|
1357
|
+
: ' No lost spans.';
|
|
1358
|
+
const out = m.outOfFrameSpans?.length ? ` Out of frame (nothing to fix): ${spans(m.outOfFrameSpans)}.` : '';
|
|
1359
|
+
const sheet = m.contactSheet ? ` Contact sheet: ${m.contactSheet}${m.contactSheetLost ? ` (frames ${m.contactSheetLost.shown} of the ${m.contactSheetLost.of} lost spans, the longest)` : ''}` : '';
|
|
1360
|
+
return `Mask ${m.maskId} "${m.label}" is ready: ${m.frameCount} frames, mean confidence ${m.meanConfidence} over the frames the subject is in.${lost}${out}${sheet}`;
|
|
1361
|
+
}
|
|
1362
|
+
async function maskTargetBody(ctx, input) {
|
|
1363
|
+
if (input.clipId)
|
|
1364
|
+
return { projectId: input.projectId, clipId: input.clipId };
|
|
1365
|
+
// A mask id is unique: the desktop finds its file.
|
|
1366
|
+
if (!input.assetId && input.maskId)
|
|
1367
|
+
return { projectId: input.projectId };
|
|
1368
|
+
if (!input.assetId)
|
|
1369
|
+
throw new Error('Name assetId or clipId (or maskId, to read or change one mask).');
|
|
1370
|
+
return { projectId: input.projectId, assetId: (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id };
|
|
1371
|
+
}
|
|
1372
|
+
export const getSubjectMask = {
|
|
1373
|
+
id: 'slates_get_subject_mask',
|
|
1374
|
+
description: "Read a video file's subject masks (a mask is a matte that follows one subject, a person or a thing, through the whole file). Without maskId: every mask on the file with its status, mean confidence and lost spans. With maskId (alone, or with the file or clip): that mask in full: status (pending, working with progress, ready, failed), confidence for every file frame from 0 to 1, lostSpans (runs under 0.5 where the track is unsure: the subject hidden or the track gone, in frames and seconds), outOfFrameSpans (the subject out of the picture: nothing to fix), meanConfidence over the frames the subject is in, the prompts and strokes it was made from, its hand controls and mattePath. sheet true saves a contact sheet PNG (frames across the file with the mask tinted over them, each labelled with its confidence, the middle of the four longest lost spans framed in red) and returns its path: look at it to judge the mask, and before adding a point in a lost span. boxes true adds the subject's box on every frame ([x, y, w, h], null where lost). waitSeconds (up to 50) waits for a mask still being made. Free; runs on this machine. Requires subject-mask; update Slates on capability refusal.",
|
|
1375
|
+
input: z
|
|
1376
|
+
.object({
|
|
1377
|
+
projectId: z.string().uuid(),
|
|
1378
|
+
...maskTarget,
|
|
1379
|
+
maskId: z.string().min(1).max(80).optional().describe('One mask, from the list or from slates_mask_subject.'),
|
|
1380
|
+
sheet: z.boolean().optional().describe('Save a contact sheet PNG and return its path.'),
|
|
1381
|
+
boxes: z.boolean().optional().describe("Add the subject's box on every frame."),
|
|
1382
|
+
waitSeconds: z.number().min(0).max(50).optional().describe('Wait up to this long for a mask still being made.'),
|
|
1383
|
+
})
|
|
1384
|
+
.strict(),
|
|
1385
|
+
async run(input, ctx) {
|
|
1386
|
+
await ctx.desktop().requireCapability('subject-mask', 'subject masks');
|
|
1387
|
+
const body = await maskTargetBody(ctx, input);
|
|
1388
|
+
if (!input.maskId) {
|
|
1389
|
+
const r = await ctx.desktop().get('/agent/timeline/masks', body);
|
|
1390
|
+
const list = r.masks.map((m) => `${m.maskId} "${m.label}" ${m.status}${m.meanConfidence !== null ? `, confidence ${m.meanConfidence}` : ''}${m.lostSpans.length ? `, ${m.lostSpans.length} lost` : ''}`);
|
|
1391
|
+
return ok(r, r.masks.length ? `${r.masks.length} mask${r.masks.length === 1 ? '' : 's'}: ${list.join('; ')}.` : 'No subject masks on this file yet: slates_mask_subject makes one (free, on this machine).');
|
|
1392
|
+
}
|
|
1393
|
+
const r = await ctx.desktop().get('/agent/timeline/masks', {
|
|
1394
|
+
...body, maskId: input.maskId, ...(input.sheet ? { sheet: true } : {}), ...(input.boxes ? { boxes: true } : {}),
|
|
1395
|
+
...(input.waitSeconds ? { waitSeconds: input.waitSeconds } : {}),
|
|
1396
|
+
});
|
|
1397
|
+
return ok(r, `${maskWords(r)} ${JSON.stringify(r)}`);
|
|
1398
|
+
},
|
|
1399
|
+
};
|
|
1400
|
+
export const maskSubject = {
|
|
1401
|
+
id: 'slates_mask_subject',
|
|
1402
|
+
billable: false,
|
|
1403
|
+
description: "Make, fix or remove a subject mask on a video file, as the Viewer's Mask tool does: a matte that follows one subject through the whole file, which a clip's matte (slates_update_clip) and the subject transitions draw through. Free: it runs on this machine and spends nothing; the first mask downloads the subject mask model once (firstRunDownloadMB). action make: prompts on any frame (clicks, a box or a name; a box or a name is surest on a person) track forward and back through the file; it answers at once while it works, so pass waitSeconds (up to 50) or read slates_get_subject_mask with waitSeconds. action refine (maskId): addPrompts adds points on any frame and tracks again (the fix for a lost span, once the contact sheet shows the subject there: a positive point on it inside the span), removePrompts drops prompts by their place in the list, addStrokes paints into or out of one frame only, clearStrokesOn drops a frame's strokes, params sets feather, grow and smoothing (only those change: no tracking again); every prompt and stroke is kept through any recompute. action cancel stops a mask being made. action delete removes the mask and its files, answering madeFrom (its prompts, strokes and params) so it can be made again. action pin (clipId the subject's clip, hudClipId a title, picture or graphic clip over it on the same timeline): writes position keys so the HUD clip rides beside the subject (side right, left, above or below; gap and offset in fractions of the frame; hudSize [w, h] for a title), smoothed, each key editable; it replaces the HUD clip's position keys. Answers the mask as slates_get_subject_mask does. Requires subject-mask; update Slates on capability refusal.",
|
|
1404
|
+
input: z
|
|
1405
|
+
.object({
|
|
1406
|
+
projectId: z.string().uuid(),
|
|
1407
|
+
action: z.enum(['make', 'refine', 'cancel', 'delete', 'pin']),
|
|
1408
|
+
...maskTarget,
|
|
1409
|
+
maskId: z.string().min(1).max(80).optional().describe('refine, cancel, delete: the mask. pin: the subject clip\'s mask (default: its matte\'s, else its newest).'),
|
|
1410
|
+
label: z.string().min(1).max(60).optional().describe('What the mask is called in the app.'),
|
|
1411
|
+
prompts: z.array(maskPrompt).max(64).optional().describe('make: the prompts. refine: replaces every prompt.'),
|
|
1412
|
+
strokes: z.array(maskStroke).max(256).optional().describe('make: strokes to paint. refine: replaces every stroke.'),
|
|
1413
|
+
addPrompts: z.array(maskPrompt).max(64).optional().describe('refine: prompts added to the ones it has.'),
|
|
1414
|
+
removePrompts: z.array(z.number().int().min(0)).optional().describe('refine: places in the prompt list to drop (0 is the first).'),
|
|
1415
|
+
addStrokes: z.array(maskStroke).max(256).optional().describe('refine: strokes added to the ones it has.'),
|
|
1416
|
+
clearStrokesOn: z.array(z.number().int().min(0)).optional().describe('refine: file frames whose strokes are dropped.'),
|
|
1417
|
+
params: maskParams.optional().describe('The hand controls.'),
|
|
1418
|
+
edges: z.boolean().optional().describe('Refine hair and soft edges (default false): for hair or fur against a plain background; it can pull in things passing in front, and takes longer.'),
|
|
1419
|
+
sheet: z.boolean().optional().describe('With waitSeconds: save a contact sheet PNG of the result.'),
|
|
1420
|
+
boxes: z.boolean().optional().describe("Add the subject's box on every frame to the answer."),
|
|
1421
|
+
waitSeconds: z.number().min(0).max(50).optional().describe('make, refine: wait up to this long for the mask.'),
|
|
1422
|
+
hudClipId: z.string().uuid().optional().describe('pin: the clip that rides beside the subject.'),
|
|
1423
|
+
side: z.enum(['right', 'left', 'above', 'below']).optional().describe('pin: which side of the subject. Default right.'),
|
|
1424
|
+
gap: z.number().min(0).max(0.5).optional().describe('pin: space between the subject and the HUD, a fraction of the frame height. Default 0.02.'),
|
|
1425
|
+
offset: z.object({ x: z.number().min(-2).max(2).optional(), y: z.number().min(-2).max(2).optional() }).strict().optional().describe('pin: moved further by this, fractions of the frame.'),
|
|
1426
|
+
hudSize: z.tuple([z.number().min(0).max(4), z.number().min(0).max(4)]).optional().describe("pin: the HUD's [width, height] in fractions of the frame, for a title whose size the cut does not know."),
|
|
1427
|
+
})
|
|
1428
|
+
.strict(),
|
|
1429
|
+
async run(input, ctx) {
|
|
1430
|
+
await ctx.desktop().requireCapability('subject-mask', 'subject masks');
|
|
1431
|
+
if (input.action === 'pin') {
|
|
1432
|
+
if (!input.clipId || !input.hudClipId)
|
|
1433
|
+
throw new Error('pin needs clipId (the subject\'s clip) and hudClipId.');
|
|
1434
|
+
const { projectId, action, clipId, hudClipId, maskId, side, gap, offset, hudSize } = input;
|
|
1435
|
+
const r = await ctx.desktop().post('/agent/timeline/masks', { projectId, action, clipId, hudClipId, maskId, side, gap, offset, hudSize });
|
|
1436
|
+
const held = r.held.length ? ` It holds still where the subject is lost: ${r.held.map((h) => `frames ${h.fromFrame}-${h.toFrame}`).join(', ')} of the HUD clip.` : '';
|
|
1437
|
+
return ok(r, `Pinned the HUD clip ${r.side} of the subject over ${r.frames} frames with ${r.keys} position keys.${held}`);
|
|
1438
|
+
}
|
|
1439
|
+
if (input.action !== 'make' && !input.maskId)
|
|
1440
|
+
throw new Error(`${input.action} needs maskId.`);
|
|
1441
|
+
const moments = [input.prompts, input.strokes, input.addPrompts, input.addStrokes].flatMap((l) => l ?? []);
|
|
1442
|
+
if (!input.clipId && moments.some((m) => m.timelineFrame !== undefined))
|
|
1443
|
+
throw new Error('timelineFrame is a frame of a clip on the cut: name clipId, or give frame or sec of the file.');
|
|
1444
|
+
const { assetId: _a, clipId: _c, projectId: _p, ...rest } = input;
|
|
1445
|
+
const r = await ctx.desktop().post('/agent/timeline/masks', { ...(await maskTargetBody(ctx, input)), ...rest });
|
|
1446
|
+
if (input.action === 'cancel')
|
|
1447
|
+
return ok(r, r.stopped ? 'Stopped. The mask keeps its last finished matte.' : 'Nothing was being made.');
|
|
1448
|
+
if (input.action === 'delete')
|
|
1449
|
+
return ok(r, r.deleted ? `Deleted. madeFrom holds what it was made from. ${JSON.stringify(r)}` : 'There was no such mask.');
|
|
1450
|
+
const first = r.firstRunDownloadMB ? ` The first mask downloads the ${r.firstRunDownloadMB} MB subject mask model once.` : '';
|
|
1451
|
+
return ok(r, `${maskWords(r)}${first} ${JSON.stringify(r)}`);
|
|
1452
|
+
},
|
|
1453
|
+
};
|
|
1454
|
+
// Whip pans in the user's own footage (slate subject masks plan step 5): the desktop routes are
|
|
1455
|
+
// /agent/timeline/whip-pans (GET reads, POST finds), /agent/timeline/whip-pans/edit and
|
|
1456
|
+
// /agent/timeline/join-on-whip, the same core as the clip's whip marks and its menu's Join on whip
|
|
1457
|
+
// (slate `src/main/whips/service.ts`, `src/main/whips/join.ts`). The asset or clip is named as for a beat grid.
|
|
1458
|
+
const whipTarget = {
|
|
1459
|
+
assetId: z.string().min(1).optional().describe('A video asset: its code (VID-A2) or id. Or name clipId.'),
|
|
1460
|
+
clipId: z.string().uuid().optional().describe("A clip on the timeline: its file's whips, plus where each lands on the cut (onTimeline, in frames)."),
|
|
1461
|
+
};
|
|
1462
|
+
function whipWords(r) {
|
|
1463
|
+
if (!r.whips)
|
|
1464
|
+
return r.hint ?? 'Not searched yet.';
|
|
1465
|
+
if (!r.whips.length)
|
|
1466
|
+
return 'No whip pans in this file.';
|
|
1467
|
+
const list = r.whips.map((w) => `${w.direction} at frame ${w.peak} (${w.start}-${w.end}, ${w.speed} widths/s, confidence ${w.confidence})${w.sheet ? `, sheet ${w.sheet}` : ''}`);
|
|
1468
|
+
return `${r.whips.length} whip pan${r.whips.length === 1 ? '' : 's'}: ${list.join('; ')}.`;
|
|
1469
|
+
}
|
|
1470
|
+
export const getWhipPans = {
|
|
1471
|
+
id: 'slates_get_whip_pans',
|
|
1472
|
+
description: "Read the whip pans found in a video file (fast camera swings an editor can hide a cut inside): each whip's start, peak and end in the file's own frames (the peak is the fastest, blurriest frame), direction (where the camera turned: right, up-right, up, up-left, left, down-left, down, down-right), speed in frame widths a second, confidence from 0 to 1 (hand-set ones read 1) and the hand edits kept on it. With a clipId it also gives onTimeline: where each lands on the cut, in frames. sheets true saves a contact sheet PNG per whip (five frames from start to end, the peak framed, an arrow for the direction) and returns each path: look at it to judge a whip. Never searches: whips null with a hint means not searched yet (slates_find_whip_pans, free). Correct one with slates_edit_whip_pans. Requires whip-pans; update Slates on capability refusal.",
|
|
1473
|
+
input: z
|
|
1474
|
+
.object({
|
|
1475
|
+
projectId: z.string().uuid(),
|
|
1476
|
+
...whipTarget,
|
|
1477
|
+
sheets: z.boolean().optional().describe('Save a contact sheet per whip and return its path.'),
|
|
1478
|
+
})
|
|
1479
|
+
.strict(),
|
|
1480
|
+
async run(input, ctx) {
|
|
1481
|
+
await ctx.desktop().requireCapability('whip-pans', 'whip pans');
|
|
1482
|
+
const body = await beatTargetBody(ctx, input);
|
|
1483
|
+
const r = await ctx.desktop().get('/agent/timeline/whip-pans', { ...body, ...(input.sheets ? { sheets: true } : {}) });
|
|
1484
|
+
return ok(r, `${whipWords(r)} ${JSON.stringify(r)}`);
|
|
1485
|
+
},
|
|
1486
|
+
};
|
|
1487
|
+
export const findWhipPans = {
|
|
1488
|
+
id: 'slates_find_whip_pans',
|
|
1489
|
+
billable: false,
|
|
1490
|
+
description: "Find the whip pans in a video file on the user's machine, as Find whip pans in the clip's menu does: fast camera swings that smear the whole picture in one direction, the moment an editor cuts inside to join two shots. Free: it spends no credits and nothing leaves the machine; a long file takes a while. Answers each whip's start, peak and end (frames of the file), direction, speed, confidence and a contact sheet PNG (sheets false skips them); look at a sheet before trusting a low-confidence whip. Slow pans, someone crossing the lens, walking and handheld shake are left alone, and a swing that rolls the camera is often missed: mark it with slates_edit_whip_pans. Hand edits already on the file are kept over the new find. Next: slates_join_on_whip. Requires whip-pans; update Slates on capability refusal.",
|
|
1491
|
+
input: z
|
|
1492
|
+
.object({
|
|
1493
|
+
projectId: z.string().uuid(),
|
|
1494
|
+
...whipTarget,
|
|
1495
|
+
sheets: z.boolean().optional().describe('Contact sheets per whip; default true.'),
|
|
1496
|
+
})
|
|
1497
|
+
.strict(),
|
|
1498
|
+
async run(input, ctx) {
|
|
1499
|
+
await ctx.desktop().requireCapability('whip-pans', 'finding whip pans');
|
|
1500
|
+
const r = await ctx.desktop().post('/agent/timeline/whip-pans', { ...(await beatTargetBody(ctx, input)), ...(input.sheets === false ? { sheets: false } : {}) });
|
|
1501
|
+
return ok(r, `${whipWords(r)} ${JSON.stringify(r)}`);
|
|
1502
|
+
},
|
|
1503
|
+
};
|
|
1504
|
+
const whipDirection = z.enum(['right', 'up-right', 'up', 'up-left', 'left', 'down-left', 'down', 'down-right']);
|
|
1505
|
+
const whipEditInput = z.discriminatedUnion('kind', [
|
|
1506
|
+
z.object({
|
|
1507
|
+
kind: z.literal('move'),
|
|
1508
|
+
at: z.number().int().min(0).describe('A frame inside the whip, or within 12 frames of it, naming which one.'),
|
|
1509
|
+
start: z.number().int().min(0).optional(),
|
|
1510
|
+
peak: z.number().int().min(0).optional(),
|
|
1511
|
+
end: z.number().int().min(0).optional(),
|
|
1512
|
+
direction: whipDirection.optional(),
|
|
1513
|
+
}).strict(),
|
|
1514
|
+
z.object({
|
|
1515
|
+
kind: z.literal('add'),
|
|
1516
|
+
start: z.number().int().min(0),
|
|
1517
|
+
peak: z.number().int().min(0),
|
|
1518
|
+
end: z.number().int().min(0),
|
|
1519
|
+
direction: whipDirection.describe('Where the camera turned.'),
|
|
1520
|
+
}).strict(),
|
|
1521
|
+
z.object({ kind: z.literal('delete'), at: z.number().int().min(0).describe('A frame inside the whip to delete.') }).strict(),
|
|
1522
|
+
]);
|
|
1523
|
+
export const editWhipPans = {
|
|
1524
|
+
id: 'slates_edit_whip_pans',
|
|
1525
|
+
billable: false,
|
|
1526
|
+
description: "Correct a video file's whip pans by hand, as dragging the whip marks on a clip does: move a whip's start, peak or end, or set its direction; add a whip the finder missed (start, peak, end, direction); delete a false one. Frames are the file's own, as slates_get_whip_pans gives them; a whip is named by a frame inside it (at). Edits apply in order and are kept: finding again never overwrites them. undo takes back the last edit; clearEdits drops them all. The marks on the clip follow at once. Free. Returns the whips as slates_get_whip_pans does. Requires whip-pans; update Slates on capability refusal.",
|
|
1527
|
+
input: z
|
|
1528
|
+
.object({
|
|
1529
|
+
projectId: z.string().uuid(),
|
|
1530
|
+
...whipTarget,
|
|
1531
|
+
edits: z.array(whipEditInput).min(1).optional().describe('Edits to apply, in order.'),
|
|
1532
|
+
undo: z.boolean().optional().describe('Take back the last hand edit.'),
|
|
1533
|
+
clearEdits: z.boolean().optional().describe('Drop every hand edit and show what was found.'),
|
|
1534
|
+
})
|
|
1535
|
+
.strict(),
|
|
1536
|
+
async run(input, ctx) {
|
|
1537
|
+
if (!input.edits && !input.undo && !input.clearEdits)
|
|
1538
|
+
throw new Error('Send edits, undo: true or clearEdits: true.');
|
|
1539
|
+
await ctx.desktop().requireCapability('whip-pans', 'editing whip pans');
|
|
1540
|
+
const r = await ctx.desktop().post('/agent/timeline/whip-pans/edit', {
|
|
1541
|
+
...(await beatTargetBody(ctx, input)),
|
|
1542
|
+
...(input.undo ? { undo: true } : input.clearEdits ? { clearEdits: true } : { edits: input.edits }),
|
|
1543
|
+
});
|
|
1544
|
+
return ok(r, `Saved. ${whipWords(r)} ${JSON.stringify(r)}`);
|
|
1545
|
+
},
|
|
1546
|
+
};
|
|
1547
|
+
export const joinOnWhip = {
|
|
1548
|
+
id: 'slates_join_on_whip',
|
|
1549
|
+
billable: false,
|
|
1550
|
+
description: "Join two shots on their whip pans, as Join on whip in the clip's menu does: the outgoing clip is trimmed to end on its whip's peak and the incoming one to start on its own, so the frame at the cut shows both peaks, then a short blend is centred on the cut and the cut hides inside the blur. The two clips must meet on one picture lane, and both files need whips (slates_find_whip_pans, or slates_edit_whip_pans to mark one). It uses the outgoing whip nearest the clip's out point and the incoming whip nearest its in point; fromPeak and toPeak (file frames) pick others. blend dissolve (default), whip (the whip-pan transition, turned to sweep the way the outgoing whip turns) or none; blendFrames 2 to 12, default 4. One edit; the trims ripple the lane. Answers the clips written, cutFrame, aligned (both peaks land on the cut), shown (the file frames at the cut), directionMatch, speedRatio, brightnessGap and warnings: a mismatch is reported, never hidden, so tell the user. whoosh.atFrame is where a whoosh's loudest moment goes; making one with Sound Effects costs credits, so ask first. Requires whip-pans; update Slates on capability refusal.",
|
|
1551
|
+
input: z
|
|
1552
|
+
.object({
|
|
1553
|
+
projectId: z.string().uuid(),
|
|
1554
|
+
fromClipId: z.string().uuid().describe('The outgoing clip.'),
|
|
1555
|
+
toClipId: z.string().uuid().describe('The incoming clip; it starts where the outgoing one ends.'),
|
|
1556
|
+
fromPeak: z.number().int().min(0).optional().describe('The outgoing whip, by a frame of its file inside it.'),
|
|
1557
|
+
toPeak: z.number().int().min(0).optional().describe('The incoming whip, by a frame of its file inside it.'),
|
|
1558
|
+
blend: z.enum(['dissolve', 'whip', 'none']).optional().describe('The blend across the cut. Default dissolve.'),
|
|
1559
|
+
blendFrames: z.number().int().min(2).max(12).optional().describe('The blend in frames, centred on the cut. Default 4.'),
|
|
1560
|
+
})
|
|
1561
|
+
.strict(),
|
|
1562
|
+
async run(input, ctx) {
|
|
1563
|
+
await ctx.desktop().requireCapability('whip-pans', 'joining on a whip');
|
|
1564
|
+
const r = await ctx.desktop().post('/agent/timeline/join-on-whip', input);
|
|
1565
|
+
const warn = r.warnings.length ? ` Tell the user: ${r.warnings.join(' ')}` : '';
|
|
1566
|
+
return ok(r, `Joined on the whip at frame ${r.cutFrame}${r.aligned ? ', both peaks on the cut' : ''}.${warn}`);
|
|
1567
|
+
},
|
|
1568
|
+
};
|
|
1307
1569
|
export const extractVideoFrame = {
|
|
1308
1570
|
id: 'slates_extract_video_frame',
|
|
1309
1571
|
description: "Save one frame of a clip as a new picture in Media, as the clip card's camera does: at 'first', 'last' (default 'first') or a second. Free. The usual continuity move: extract a clip's last frame and use it as the next clip's first frame. To only look at a clip, use slates_get_asset_video_frames; this one adds a picture to the project.",
|
|
@@ -2087,7 +2349,7 @@ export const saveExternalImage = {
|
|
|
2087
2349
|
};
|
|
2088
2350
|
export const uploadReferenceImage = {
|
|
2089
2351
|
id: 'slates_upload_reference_image',
|
|
2090
|
-
description: 'Add a reference image, video clip, or audio file to a Slates project from disk. Pass either filePath (absolute path to a local file) or dataUrl (base64 data: URL) — exactly one. Set type:"video" to bring in a clip (the user\'s own footage to edit/relocate/trim) or type:"audio" for music/VO/SFX they already have; both are probed on ingest, so duration (and for video, dimensions) are available immediately, and audio gets its waveform. A camera clip the timeline cannot play smoothly (ProRes, HEVC, 4K, sparse keyframes) answers
|
|
2352
|
+
description: 'Add a reference image, video clip, or audio file to a Slates project from disk. Pass either filePath (absolute path to a local file) or dataUrl (base64 data: URL) — exactly one. Set type:"video" to bring in a clip (the user\'s own footage to edit/relocate/trim) or type:"audio" for music/VO/SFX they already have; both are probed on ingest, so duration (and for video, dimensions) are available immediately, and audio gets its waveform. A camera clip the timeline cannot play smoothly (ProRes, HEVC, 4K, sparse keyframes) answers proxy {state:"needed", reason}: tell the user and offer to make its proxy (slates_update_asset proxy:"make"), a lighter copy the timeline and Viewer play while export and generation read the original; make one only on their yes. With Make proxies automatically at import on, it answers proxy {state:"making", percent} instead (older Slates: playableCopy). Default type is "image". dataUrl is image-only. Pass label to name it and note to record what it is; without them it is "Imported file". A picture derived from a project asset (edited, masked, upscaled or converted outside Slates) belongs in slates_save_external_image with referenceAssetIds, so its source and prompt are recorded.',
|
|
2091
2353
|
input: z
|
|
2092
2354
|
.object({
|
|
2093
2355
|
projectId: z.string().uuid(),
|
|
@@ -2137,20 +2399,49 @@ export const uploadReferenceImage = {
|
|
|
2137
2399
|
};
|
|
2138
2400
|
export const updateAsset = {
|
|
2139
2401
|
id: 'slates_update_asset',
|
|
2140
|
-
description: "Rename an asset (its label, shown with its code on its card and in lists) and/or replace the note stored as its prompt text. UUID or badge code. A note changes only an upload or a picture saved from an external host; a generated asset keeps the prompt that made it but can still be renamed."
|
|
2402
|
+
description: "Rename an asset (its label, shown with its code on its card and in lists) and/or replace the note stored as its prompt text. UUID or badge code. A note changes only an upload or a picture saved from an external host; a generated asset keeps the prompt that made it but can still be renamed. " +
|
|
2403
|
+
"For a clip, proxy:\"make\" makes its proxy (a lighter copy the timeline and the Viewer play; export reads the original; a failed one again) and proxy:\"remove\" deletes it; playOriginal:true plays the camera file and keeps the proxy, false goes back. Make one only when the user said yes: slates_get_timeline's notices say which clips need one. Answers the clip's proxy state.",
|
|
2141
2404
|
input: z
|
|
2142
|
-
.object({
|
|
2405
|
+
.object({
|
|
2406
|
+
projectId: z.string().uuid(),
|
|
2407
|
+
assetId: z.string().min(1),
|
|
2408
|
+
label: assetLabelField.optional(),
|
|
2409
|
+
note: assetNoteField.optional(),
|
|
2410
|
+
proxy: z.enum(['make', 'remove']).optional().describe("A clip's proxy: make it (only on the user's yes) or remove it."),
|
|
2411
|
+
playOriginal: z.boolean().optional().describe('A clip with a proxy: true plays the camera file instead, false the proxy again.'),
|
|
2412
|
+
})
|
|
2143
2413
|
.strict()
|
|
2144
|
-
.refine((d) => d.label !== undefined || d.note !== undefined
|
|
2414
|
+
.refine((d) => d.label !== undefined || d.note !== undefined || d.proxy !== undefined || d.playOriginal !== undefined, {
|
|
2415
|
+
message: 'Pass a label, a note, proxy or playOriginal',
|
|
2416
|
+
}),
|
|
2145
2417
|
async run(input, ctx) {
|
|
2146
|
-
|
|
2418
|
+
const desktop = ctx.desktop();
|
|
2419
|
+
const naming = input.label !== undefined || input.note !== undefined;
|
|
2420
|
+
const proxying = input.proxy !== undefined || input.playOriginal !== undefined;
|
|
2421
|
+
if (naming)
|
|
2422
|
+
await desktop.requireCapability('asset-naming', 'naming an asset');
|
|
2423
|
+
if (proxying)
|
|
2424
|
+
await desktop.requireCapability('proxies', "a clip's proxy");
|
|
2147
2425
|
const id = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
|
|
2148
|
-
const
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2426
|
+
const result = {};
|
|
2427
|
+
if (naming) {
|
|
2428
|
+
const { asset } = await desktop.post('/agent/assets/update', {
|
|
2429
|
+
assetId: id,
|
|
2430
|
+
...(input.label !== undefined ? { label: input.label } : {}),
|
|
2431
|
+
...(input.note !== undefined ? { note: input.note } : {}),
|
|
2432
|
+
});
|
|
2433
|
+
result.asset = { ...compactAsset(asset), note: asset.prompt };
|
|
2434
|
+
}
|
|
2435
|
+
if (proxying) {
|
|
2436
|
+
const { proxy } = await desktop.post('/agent/assets/proxy', {
|
|
2437
|
+
assetId: id,
|
|
2438
|
+
...(input.proxy !== undefined ? { action: input.proxy } : {}),
|
|
2439
|
+
...(input.playOriginal !== undefined ? { playOriginal: input.playOriginal } : {}),
|
|
2440
|
+
});
|
|
2441
|
+
result.assetId = id;
|
|
2442
|
+
result.proxy = proxy;
|
|
2443
|
+
}
|
|
2444
|
+
return ok(result);
|
|
2154
2445
|
},
|
|
2155
2446
|
};
|
|
2156
2447
|
// ── Folders ─────────────────────────────────────────────────────
|
|
@@ -5518,21 +5809,28 @@ async function requireNamedCut(desktop, timelineId) {
|
|
|
5518
5809
|
}
|
|
5519
5810
|
export const getTimeline = {
|
|
5520
5811
|
id: 'slates_get_timeline',
|
|
5521
|
-
description: 'Get (or lazily create) a named editing timeline, or the stable legacy default when timelineId is omitted, with all tracks, clips, markers, and a flat clipIndex mapping every clip back to its source asset (assetId + code + label). Frames are the unit of time; durationSec is provided. Call this before adding, reordering, or removing clips, and before exporting — it tells you the timeline id, frame rate, resolution, and current end frame.',
|
|
5522
|
-
input: z.object({
|
|
5812
|
+
description: 'Get (or lazily create) a named editing timeline, or the stable legacy default when timelineId is omitted, with all tracks, clips, markers, and a flat clipIndex mapping every clip back to its source asset (assetId + code + label). Frames are the unit of time; durationSec is provided. Call this before adding, reordering, or removing clips, and before exporting — it tells you the timeline id, frame rate, resolution, and current end frame. A clip whose file has or needs a proxy carries proxy (needed with a reason, making, ready, failed; playsSlowly when the monitor measured it stuttering); notices, printed first, name the clips that may show no picture or play slowly: tell the user and offer the proxy, making one only on their yes. eqs reads every EQ on a clip, a lane or the master as its bands and its level in dB by octave; eq lists the bands, types, slopes, ranges and presets an EQ takes. transitionKinds lists every transition kind with its own length and its settings (params: defaults, ranges, words). objectWipes: true adds objectWipes: candidates, the cuts a subject crossing the frame could carry as an object wipe, best first, each with its confidence, the transition to add and the trim that puts the crossing on the cut (make the trim with slates_edit_timeline_clips in the trim’s mode: roll where the other clip has the media to give, else ripple; then slates_add_transition); and unmasked, the clips at a cut whose footage has no subject mask yet: make the mask of what moves there and ask again.',
|
|
5813
|
+
input: z.object({
|
|
5814
|
+
projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
|
|
5815
|
+
objectWipes: z.boolean().optional().describe('Also find object wipes: cuts a moving subject could carry, read from the subject masks the clips already have.'),
|
|
5816
|
+
}),
|
|
5523
5817
|
async run(input, ctx) {
|
|
5524
5818
|
const desktop = ctx.desktop();
|
|
5525
5819
|
await desktop.requireCapability('timeline', 'timeline editing');
|
|
5526
5820
|
await requireNamedCut(desktop, input.timelineId);
|
|
5821
|
+
if (input.objectWipes)
|
|
5822
|
+
await desktop.requireCapability('matte-transitions', 'object wipes');
|
|
5527
5823
|
const r = await desktop.get('/agent/timeline', {
|
|
5528
|
-
projectId: input.projectId, timelineId: input.timelineId,
|
|
5824
|
+
projectId: input.projectId, timelineId: input.timelineId, ...(input.objectWipes ? { objectWipes: 'true' } : {}),
|
|
5529
5825
|
});
|
|
5530
5826
|
const t = r.timeline ?? {};
|
|
5531
5827
|
const clipCount = r.clipIndex?.length ??
|
|
5532
5828
|
(t.tracks ?? []).reduce((n, tr) => n + (tr.clips?.length ?? 0), 0);
|
|
5533
5829
|
const durationSec = t.durationSec ?? r.durationSec;
|
|
5534
5830
|
const dims = t.width && t.height ? `${t.width}x${t.height}` : '?';
|
|
5535
|
-
|
|
5831
|
+
const notices = r.notices ?? [];
|
|
5832
|
+
return ok(r, (notices.length ? `Notices:\n${notices.map((n) => `- ${n}`).join('\n')}\n\n` : '') +
|
|
5833
|
+
`Timeline for project ${input.projectId}: ${clipCount} clip(s) on ${t.tracks?.length ?? '?'} track(s), ` +
|
|
5536
5834
|
`${durationSec ?? '?'}s at ${t.frameRate ?? '?'} fps, ${dims}.\n\n` +
|
|
5537
5835
|
JSON.stringify(r, null, 2));
|
|
5538
5836
|
},
|
|
@@ -5671,10 +5969,10 @@ export const removeClip = {
|
|
|
5671
5969
|
// them as transitionKinds), so none is typed here; an unknown kind is refused with the list.
|
|
5672
5970
|
const transitionShape = {
|
|
5673
5971
|
kind: z.string().optional().describe("A kind from slates_get_timeline's transitionKinds for this lane: picture kinds on video and overlay lanes, sound kinds on audio lanes. Default: a dissolve, or a crossfade on sound."),
|
|
5674
|
-
durationFrames: z.number().int().positive().optional().describe('How long it lasts, in timeline frames. Default 0.5 s, shortened to what the clips allow; a length you name that is too long is refused with the longest that fits.'),
|
|
5972
|
+
durationFrames: z.number().int().positive().optional().describe('How long it lasts, in timeline frames. Default the length transitionKinds gives its kind (defaultSeconds, else 0.5 s), shortened to what the clips allow; a length you name that is too long is refused with the longest that fits.'),
|
|
5675
5973
|
durationSec: z.number().positive().optional().describe('The same, in seconds.'),
|
|
5676
5974
|
alignment: z.enum(['center', 'start', 'end']).optional().describe('center (default) straddles the cut; start begins at the cut; end finishes at it.'),
|
|
5677
|
-
params: z.record(z.string(), z.unknown()).optional().describe("The kind's settings. freeze: true holds the edge frame where the media runs short. On a picture transition, audio: false stops the clips' sound crossfading with it."),
|
|
5975
|
+
params: z.record(z.string(), z.unknown()).optional().describe("The kind's settings, listed with defaults and ranges as its params in transitionKinds: wipe, push and slide take direction (left, right, up, down), zoom strength, whip-pan whipAngle (the way the camera turns, degrees counter-clockwise: 0 right, 90 up, 180 left, 270 down; a found whip's angle); luma-fade and color-range key on the picture; track-matte reveals through a matte (matte linear at angle, radial from centerX/centerY, subject: a clip's subject mask by maskClip and maskId, clip: matteClipId's brightness); object-wipe follows a subject crossing the frame and names its mask (maskId, maskClip; slates_get_timeline objectWipes finds them). A matte that is missing draws a dissolve. freeze: true holds the edge frame where the media runs short. On a picture transition, audio: false stops the clips' sound crossfading with it."),
|
|
5678
5976
|
durationMs: z.number().min(SOUND_CROSSFADE_MS.min).max(SOUND_CROSSFADE_MS.max).optional().describe(`Audio lane: the crossfade's length in milliseconds (${SOUND_CROSSFADE_MS.min} to ${SOUND_CROSSFADE_MS.max}), placed to the sample, so it may be shorter than a frame. Instead of durationFrames or durationSec.`),
|
|
5679
5977
|
curve: z.enum(SOUND_CURVES).optional().describe("Audio lane: 'equal-power' (default) for two different sounds, 'linear' (straight lines, a triangular crossfade) for a join inside one piece of music."),
|
|
5680
5978
|
};
|
|
@@ -5731,14 +6029,14 @@ export const removeTransition = {
|
|
|
5731
6029
|
// settings. Both run through the same core as the Cut's own tools.
|
|
5732
6030
|
export const editTimelineClips = {
|
|
5733
6031
|
id: 'slates_edit_timeline_clips',
|
|
5734
|
-
description: "Trim, roll, ripple, slip, move or split clips on the timeline, as the Cut's tools do; the source files are untouched (to cut a new file, use slates_trim_video). trim moves one edge (edge, then frame or deltaFrames): mode overwrite (default) covers a neighbour it grows into, ripple moves the lane's later clips by the change, roll moves the cut shared with the clip that meets this edge. A trim cuts media and never changes speed. slip changes which part of the media a clip shows without moving it (deltaFrames in timeline frames, or deltaSourceFrames in the file's). move takes clipId or clipIds, keeps their spacing, to startFrame or by deltaFrames, optionally onto trackId (a lane of the same type); mode overwrite cuts what they land on, insert pushes the lane's later clips right (a landing inside a clip moves to its nearer edge). split cuts at frame (or sec) every clip under it on the timeline, or only clipIds. Returns the clips it wrote as they now stand, the ids it deleted, the cut's durationFrames and any staleTransitions (whose clips no longer meet); a refused edit says why.",
|
|
6032
|
+
description: "Trim, roll, ripple, slip, move or split clips on the timeline, as the Cut's tools do; the source files are untouched (to cut a new file, use slates_trim_video). trim moves one edge (edge, then frame or deltaFrames): mode overwrite (default) covers a neighbour it grows into, ripple moves the lane's later clips by the change, roll moves the cut shared with the clip that meets this edge. A trim cuts media and never changes speed. slip changes which part of the media a clip shows without moving it (deltaFrames in timeline frames, or deltaSourceFrames in the file's). move takes clipId or clipIds, keeps their spacing, to startFrame or by deltaFrames, optionally onto trackId (a lane of the same type); mode overwrite cuts what they land on, insert pushes the lane's later clips right (a landing inside a clip moves to its nearer edge). split cuts at frame (or sec) every clip under it on the timeline, or only clipIds. layout makes compartments from picture clips on different lanes: clipIds in panel order, the leading clip (the speaker) first, and layout grid (four equal), one-plus-three (one large, three small), one-plus-four (one large, four small, a bento) or side-by-side (two); from frame (default the latest start among them) the leading clip shrinks from where it is into the first panel and the others rise into theirs one after another, with rounded corners and a soft shadow, inside the frame's safe area on 16:9 and 9:16. It writes ordinary keys (position, scale, crop, opacity, radius, shadow), so slates_set_clip_keyframes can retime them, and answers each clip's panel and the frames it arrives over. Returns the clips it wrote as they now stand, the ids it deleted, the cut's durationFrames and any staleTransitions (whose clips no longer meet); a refused edit says why.",
|
|
5735
6033
|
input: z.object({
|
|
5736
6034
|
projectId: z.string().uuid(),
|
|
5737
|
-
action: z.enum(['trim', 'slip', 'move', 'split']),
|
|
6035
|
+
action: z.enum(['trim', 'slip', 'move', 'split', 'layout']),
|
|
5738
6036
|
clipId: z.string().uuid().optional(),
|
|
5739
|
-
clipIds: z.array(z.string().uuid()).min(1).optional().describe('move or split: several clips of one timeline.'),
|
|
6037
|
+
clipIds: z.array(z.string().uuid()).min(1).optional().describe('move or split: several clips of one timeline. layout: the clips in panel order, the leading one first.'),
|
|
5740
6038
|
edge: z.enum(['start', 'end']).optional().describe('trim: which edge.'),
|
|
5741
|
-
frame: z.number().int().min(0).optional().describe('trim: where the edge goes. split: where to cut. Timeline frames.'),
|
|
6039
|
+
frame: z.number().int().min(0).optional().describe('trim: where the edge goes. split: where to cut. layout: where the move starts. Timeline frames.'),
|
|
5742
6040
|
sec: z.number().min(0).optional().describe('split: where to cut, in seconds.'),
|
|
5743
6041
|
deltaFrames: z.number().int().optional().describe('trim, slip or move: how far, in timeline frames; negative is left (slip: earlier media).'),
|
|
5744
6042
|
deltaSourceFrames: z.number().int().optional().describe("slip: how far, in the file's own frames."),
|
|
@@ -5746,6 +6044,11 @@ export const editTimelineClips = {
|
|
|
5746
6044
|
trackId: z.string().uuid().optional().describe('move: another lane of the same type.'),
|
|
5747
6045
|
timelineId: z.string().uuid().optional().describe("split without clipIds: a named cut; omit for the project's timeline."),
|
|
5748
6046
|
mode: z.enum(['overwrite', 'ripple', 'roll', 'insert']).optional().describe('trim: overwrite, ripple or roll. move: overwrite or insert.'),
|
|
6047
|
+
layout: z.enum(['grid', 'one-plus-three', 'one-plus-four', 'side-by-side']).optional().describe('layout: the arrangement; a tall frame stacks it.'),
|
|
6048
|
+
gap: z.number().min(0).max(0.2).optional().describe("layout: space between panels, in fractions of the frame's shorter side. Default 0.02."),
|
|
6049
|
+
margin: z.number().min(0).max(0.3).optional().describe("layout: space round the edge, past the safe area, in fractions of the frame's shorter side. Default 0.04."),
|
|
6050
|
+
seconds: z.number().min(0).max(10).optional().describe('layout: how long each panel takes to arrive. Default 0.6.'),
|
|
6051
|
+
staggerSeconds: z.number().min(0).max(5).optional().describe('layout: how far apart the panels arrive. Default 0.12.'),
|
|
5749
6052
|
}),
|
|
5750
6053
|
async run(input, ctx) {
|
|
5751
6054
|
const desktop = ctx.desktop();
|
|
@@ -5759,6 +6062,12 @@ export const editTimelineClips = {
|
|
|
5759
6062
|
throw new Error('move needs clipId or clipIds.');
|
|
5760
6063
|
if (action === 'split' && input.frame === undefined && input.sec === undefined)
|
|
5761
6064
|
throw new Error('split needs a frame or sec.');
|
|
6065
|
+
if (action === 'layout') {
|
|
6066
|
+
if (!input.clipIds || !input.layout)
|
|
6067
|
+
throw new Error('layout needs clipIds (the leading clip first) and a layout.');
|
|
6068
|
+
await desktop.requireCapability('clip-panels', 'laying clips out as panels');
|
|
6069
|
+
return ok(await desktop.post('/agent/timeline/layout', body));
|
|
6070
|
+
}
|
|
5762
6071
|
if (action === 'trim')
|
|
5763
6072
|
return ok(await desktop.post('/agent/timeline/trim-clip', body));
|
|
5764
6073
|
if (action === 'slip')
|
|
@@ -5789,21 +6098,64 @@ async function requireKeysBetweenFrames(desktop, ...lists) {
|
|
|
5789
6098
|
if (keysBetweenFrames(...lists))
|
|
5790
6099
|
await desktop.requireCapability('keys-between-frames', 'keys between frames (a frame such as 110.4)');
|
|
5791
6100
|
}
|
|
5792
|
-
/**
|
|
6101
|
+
/** One band of an eq effect's `bands` (`EqBandInput` in `slate/src/shared/audioEffects.ts`). */
|
|
6102
|
+
const eqBand = z
|
|
6103
|
+
.object({
|
|
6104
|
+
band: z.enum(['highpass', 'lowshelf', 'bell1', 'bell2', 'bell3', 'bell4', 'bell5', 'bell6', 'highshelf', 'lowpass']).optional()
|
|
6105
|
+
.describe('Its slot. Left out: a cut takes its own, a shelf its own if free, anything else the next free bell.'),
|
|
6106
|
+
type: z.enum(['highpass', 'lowpass', 'bell', 'lowshelf', 'highshelf', 'notch', 'bandpass'])
|
|
6107
|
+
.describe('highpass and lowpass cut below or above frequency; bell boosts or cuts around it; a shelf lifts or lowers everything below or above it; notch takes out a narrow band; bandpass keeps only the sound around it.'),
|
|
6108
|
+
on: z.boolean().optional().describe('Default true.'),
|
|
6109
|
+
frequency: z.number().optional().describe('Hz, 20 to 20000; keys sweep by octave.'),
|
|
6110
|
+
gain: z.number().optional().describe('dB, -24 to +24: a bell or a shelf.'),
|
|
6111
|
+
q: z.number().optional().describe('Width, 0.1 to 30, higher is narrower (bell, notch, bandpass); a cut\'s resonance at its corner, 0.1 to 10, 0.707 flat. None on a shelf or a 6 dB cut.'),
|
|
6112
|
+
slope: z.number().optional().describe('A cut\'s dB per octave: 6, 12, 24, 36 or 48. Default 12.'),
|
|
6113
|
+
keyframes: z.record(keyframeKeys.max(4000)).optional().describe('Keys by frequency, gain or q, in the effect list\'s frames.'),
|
|
6114
|
+
})
|
|
6115
|
+
.strict();
|
|
6116
|
+
/** An effect list as the desktop stores it (`slate/src/shared/audioEffects.ts`); slates_get_timeline's audioEffects lists each type's parameters and ranges, and eq what a band list takes. */
|
|
5793
6117
|
const audioEffectList = z
|
|
5794
6118
|
.array(z
|
|
5795
6119
|
.object({
|
|
5796
6120
|
id: z.string().max(64).optional().describe('Kept when sent back; a new effect gets one.'),
|
|
5797
|
-
type: z.enum(['volume', 'eq']).describe("volume: gain in dB (param gainDb, -60 silent to +12). eq:
|
|
6121
|
+
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."),
|
|
5798
6122
|
bypass: z.boolean().optional(),
|
|
5799
|
-
params: z.record(z.number()).optional().describe(
|
|
6123
|
+
params: z.record(z.number()).optional().describe("Fixed values by parameter name ('gainDb'; an eq's '<band>.<name>', as 'bell3.gain' or 'highpass.slope')."),
|
|
5800
6124
|
keyframes: z.record(keyframeKeys.max(4000)).optional().describe('Keys by parameter name; a keyed parameter reads its keys instead of its fixed value.'),
|
|
6125
|
+
bands: z.array(eqBand).max(10).optional().describe("An eq's bands, the ones it plays; a band not listed is off. slates_get_timeline's eq lists the presets as band lists."),
|
|
5801
6126
|
})
|
|
5802
6127
|
.strict())
|
|
5803
6128
|
.max(16);
|
|
6129
|
+
/** True when an effect list uses the ten-band EQ: a band list, or a parameter an older desktop does not know. */
|
|
6130
|
+
function usesEqBands(effects) {
|
|
6131
|
+
const legacy = new Set(['lowpass.frequency', 'lowpass.q']);
|
|
6132
|
+
return (effects ?? []).some((e) => e.type === 'eq' && (e.bands !== undefined
|
|
6133
|
+
|| [...Object.keys(e.params ?? {}), ...Object.keys(e.keyframes ?? {})].some((name) => !legacy.has(name))));
|
|
6134
|
+
}
|
|
6135
|
+
/** An older desktop refuses every eq band but the low-pass; ask first, so the refusal names the update. */
|
|
6136
|
+
async function requireEqBands(desktop, effects) {
|
|
6137
|
+
if (usesEqBands(effects))
|
|
6138
|
+
await desktop.requireCapability('eq-bands', 'the ten-band EQ');
|
|
6139
|
+
}
|
|
6140
|
+
/** A clip's panel (slate's `src/shared/clipPanel.ts`): lengths in fractions of the frame's height. */
|
|
6141
|
+
const clipPanel = z.object({
|
|
6142
|
+
radius: z.number().min(0).max(0.5).optional().describe('Corner radius.'),
|
|
6143
|
+
shadow: z.object({
|
|
6144
|
+
x: z.number().min(-0.5).max(0.5).optional().describe('Offset right; default 0.'),
|
|
6145
|
+
y: z.number().min(-0.5).max(0.5).optional().describe('Offset down; default 0.02.'),
|
|
6146
|
+
blur: z.number().min(0).max(0.25).optional().describe('Softness; default 0.04.'),
|
|
6147
|
+
opacity: z.number().min(0).max(1).optional().describe('Default 0.5.'),
|
|
6148
|
+
color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).optional().describe('#rrggbb; default black.'),
|
|
6149
|
+
}).strict().optional().describe('Present is on: {} is the default shadow.'),
|
|
6150
|
+
border: z.object({
|
|
6151
|
+
width: z.number().min(0).max(0.05).optional().describe('Drawn inside the edge; default 0.002.'),
|
|
6152
|
+
opacity: z.number().min(0).max(1).optional().describe('Default 0.35.'),
|
|
6153
|
+
color: z.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/).optional().describe('#rrggbb; default white.'),
|
|
6154
|
+
}).strict().optional().describe('Present is on: {} is the default border.'),
|
|
6155
|
+
}).strict();
|
|
5804
6156
|
export const updateClip = {
|
|
5805
6157
|
id: 'slates_update_clip',
|
|
5806
|
-
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 and
|
|
6158
|
+
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.",
|
|
5807
6159
|
input: z.object({
|
|
5808
6160
|
projectId: z.string().uuid(),
|
|
5809
6161
|
clipId: z.string().uuid(),
|
|
@@ -5818,7 +6170,23 @@ export const updateClip = {
|
|
|
5818
6170
|
blend: z.enum(['normal', 'multiply', 'screen', 'overlay', 'soft-light']).optional(),
|
|
5819
6171
|
grain: z.number().min(0).max(1).optional(),
|
|
5820
6172
|
saturation: z.number().min(0).max(2).optional(),
|
|
5821
|
-
|
|
6173
|
+
exposure: z.number().min(-4).max(4).optional().describe('Stops of light: 1 is twice as bright, -1 half.'),
|
|
6174
|
+
}).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.'),
|
|
6175
|
+
matte: z.object({
|
|
6176
|
+
maskId: z.string().regex(/^[A-Za-z0-9_-]{1,80}$/).describe("One of the clip's own media's subject masks."),
|
|
6177
|
+
mode: z.enum(['subject', 'background']).optional().describe('subject (default) draws only the subject; background everything but it.'),
|
|
6178
|
+
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.'),
|
|
6179
|
+
}).strict().nullable().optional().describe('A video clip drawn through a subject mask; null draws the whole picture.'),
|
|
6180
|
+
space: z.object({
|
|
6181
|
+
pitch: z.number().min(-85).max(85).optional().describe('Degrees; positive leans the top away.'),
|
|
6182
|
+
yaw: z.number().min(-85).max(85).optional().describe('Degrees; positive turns the right edge away.'),
|
|
6183
|
+
perspective: z.number().min(0).max(1).optional().describe('0 flat, 0.5 a normal lens (default), 1 very wide.'),
|
|
6184
|
+
}).strict().nullable().optional().describe('The clip turned in 3D about its centre; null lays it flat.'),
|
|
6185
|
+
panel: clipPanel.nullable().optional().describe('Rounded corners, a soft shadow and a border; null takes them off.'),
|
|
6186
|
+
blur: z.object({
|
|
6187
|
+
amount: z.number().min(0).max(1).describe('0 sharp to 1 very soft: a point spreads over 5% of the frame height.'),
|
|
6188
|
+
maskId: z.string().regex(/^[A-Za-z0-9_-]{1,80}$/).optional().describe('A subject mask of the clip: only what is around the subject blurs.'),
|
|
6189
|
+
}).strict().nullable().optional().describe('A lens blur with bright soft highlights; null takes it off.'),
|
|
5822
6190
|
effects: audioEffectList.nullable().optional().describe("A clip with sound: its effect list, sent whole; null clears it. A split picture's go to its sound clip."),
|
|
5823
6191
|
speedRamp: keyframeKeys.max(4000).nullable().optional().describe("Speeds (0.05 to 20) keyed in frames from the clip's start; null goes back to one speed. Its linked sound follows."),
|
|
5824
6192
|
speedSound: z.enum(['tape', 'keep-pitch']).nullable().optional().describe("How a constant speed's sound plays: tape moves pitch with speed; keep-pitch (or null) holds it. A ramp's is always tape."),
|
|
@@ -5832,13 +6200,17 @@ export const updateClip = {
|
|
|
5832
6200
|
throw new Error('Send speed (one speed) or speedRamp (keyed), not both.');
|
|
5833
6201
|
if (input.effects !== undefined || input.speedRamp !== undefined || input.speedSound !== undefined) {
|
|
5834
6202
|
await desktop.requireCapability('audio-effects', 'audio effects and speed ramps');
|
|
6203
|
+
await requireEqBands(desktop, input.effects);
|
|
5835
6204
|
await requireKeysBetweenFrames(desktop, input.speedRamp, input.effects);
|
|
5836
6205
|
}
|
|
5837
6206
|
// An empty look would clear the clip's look without saying so; null is how to ask for that.
|
|
5838
6207
|
if (input.look && Object.keys(input.look).length === 0)
|
|
5839
|
-
throw new Error('look needs at least one of blend, grain or
|
|
6208
|
+
throw new Error('look needs at least one of blend, grain, saturation or exposure; send look: null to clear it');
|
|
5840
6209
|
if (input.look !== undefined)
|
|
5841
6210
|
await desktop.requireCapability('clip-look', "a clip's blend, grain and colour");
|
|
6211
|
+
if (input.look?.exposure !== undefined || input.matte !== undefined || input.space !== undefined || input.panel !== undefined || input.blur !== undefined) {
|
|
6212
|
+
await desktop.requireCapability('clip-panels', 'subject mask layers, 3D panels and lens blur');
|
|
6213
|
+
}
|
|
5842
6214
|
if (asksSoundEdges(input)) {
|
|
5843
6215
|
if (input.speed !== undefined || input.speedRamp !== undefined)
|
|
5844
6216
|
throw new Error("Set a clip's speed and its edges in seconds or samples in two calls.");
|
|
@@ -5871,17 +6243,23 @@ export const manageTimelineMarker = {
|
|
|
5871
6243
|
};
|
|
5872
6244
|
export const addTimelineTrack = {
|
|
5873
6245
|
id: 'slates_add_timeline_track',
|
|
5874
|
-
description: "Add a track to the project's timeline (default: an audio track, for layering voiceover + music + AI audio). A video or audio track is appended below the existing tracks; an overlay track, for text and image overlays, goes on top so it draws over every other track. Returns the new track and the full timeline.",
|
|
6246
|
+
description: "Add a track to the project's timeline (default: an audio track, for layering voiceover + music + AI audio). A video or audio track is appended below the existing tracks; an overlay track, for text and image overlays, goes on top so it draws over every other track. above or below (a lane id) puts it just there instead: picture lanes draw in their order, the top one in front, so an overlay lane between two video lanes draws behind the upper one. Returns the new track and the full timeline.",
|
|
5875
6247
|
input: z.object({
|
|
5876
6248
|
projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
|
|
5877
6249
|
type: z.enum(['video', 'audio', 'overlay']).optional().describe('Default: audio. overlay needs a desktop with text and image overlays.'),
|
|
5878
6250
|
name: z.string().optional().describe("Default: 'Audio N', 'Video N' or 'Overlay N'."),
|
|
6251
|
+
above: z.string().uuid().optional().describe('A lane of the timeline: the new one goes just above it.'),
|
|
6252
|
+
below: z.string().uuid().optional().describe('A lane of the timeline: the new one goes just below it.'),
|
|
5879
6253
|
}),
|
|
5880
6254
|
async run(input, ctx) {
|
|
5881
6255
|
const desktop = ctx.desktop();
|
|
5882
6256
|
await desktop.requireCapability('timeline-tracks', 'timeline tracks + audio mixing');
|
|
5883
6257
|
if (input.type === 'overlay')
|
|
5884
6258
|
await desktop.requireCapability('timeline-overlays', 'text and image overlays');
|
|
6259
|
+
if (input.above !== undefined && input.below !== undefined)
|
|
6260
|
+
throw new Error('Send above or below, not both.');
|
|
6261
|
+
if (input.above !== undefined || input.below !== undefined)
|
|
6262
|
+
await desktop.requireCapability('clip-panels', 'placing a lane among the others');
|
|
5885
6263
|
await requireNamedCut(desktop, input.timelineId);
|
|
5886
6264
|
return ok(await desktop.post('/agent/timeline/add-track', input));
|
|
5887
6265
|
},
|
|
@@ -6111,10 +6489,16 @@ export const updateOverlayClip = {
|
|
|
6111
6489
|
return ok(await desktop.post('/agent/timeline/update-overlay', { ...input, items }));
|
|
6112
6490
|
},
|
|
6113
6491
|
};
|
|
6114
|
-
const KEYFRAME_PROPERTY_IDS = ['positionX', 'positionY', 'scale', 'rotation', 'opacity', 'cropLeft', 'cropTop', 'cropRight', 'cropBottom', 'focusX', 'focusY', 'zoom'
|
|
6492
|
+
const KEYFRAME_PROPERTY_IDS = ['positionX', 'positionY', 'scale', 'rotation', 'opacity', 'cropLeft', 'cropTop', 'cropRight', 'cropBottom', 'focusX', 'focusY', 'zoom',
|
|
6493
|
+
'saturation', 'grain', 'exposure', 'pitch', 'yaw', 'perspective', 'radius', 'shadowX', 'shadowY', 'shadowBlur', 'shadowOpacity', 'borderWidth', 'borderOpacity',
|
|
6494
|
+
'shadowRed', 'shadowGreen', 'shadowBlue', 'borderRed', 'borderGreen', 'borderBlue', 'blur'];
|
|
6495
|
+
/** The keys a desktop before layers and panels refuses. */
|
|
6496
|
+
const PANEL_KEY_IDS = new Set(KEYFRAME_PROPERTY_IDS.slice(KEYFRAME_PROPERTY_IDS.indexOf('saturation')));
|
|
6497
|
+
/** A panel colour's channels, which a desktop before panel colour keys refuses. */
|
|
6498
|
+
const PANEL_COLOUR_KEY_IDS = new Set(['shadowRed', 'shadowGreen', 'shadowBlue', 'borderRed', 'borderGreen', 'borderBlue']);
|
|
6115
6499
|
export const setClipKeyframes = {
|
|
6116
6500
|
id: 'slates_set_clip_keyframes',
|
|
6117
|
-
description: "Animate or set a timeline clip's transform with keyframes: a punch-in, a slow push, a Ken Burns move, a slide, a spin, a fade, a crop. Each property you name gets exactly the keys you send ([] clears it back to its static value); properties you leave out keep theirs, and all of them land in one transaction. One key holds a value for the whole clip. Frames count from the clip's start and may fall between frames (110.4), read at that exact time. Units: positionX/positionY move the picture's centre in frame widths/heights (0.1 = a tenth of the frame right or down, -4..4); scale multiplies the framed size about the frame's centre (1 = as framed, 0.01..20); rotation is degrees clockwise; opacity 0..1; cropLeft/Top/Right/Bottom remove that fraction of the source from its side (0..0.99); focusX/focusY (0..1) and zoom (1..20) animate the clip's reframe for the aspect being exported. Drawn by the Cut's monitor and its export alike, both the timeline engine. Returns the clip's keys; slates_get_timeline lists every clip's keys in timeline.keyframes. Requires timeline-keyframes; update Slates on capability refusal.",
|
|
6501
|
+
description: "Animate or set a timeline clip's transform with keyframes: a punch-in, a slow push, a Ken Burns move, a slide, a spin, a fade, a crop. Each property you name gets exactly the keys you send ([] clears it back to its static value); properties you leave out keep theirs, and all of them land in one transaction. One key holds a value for the whole clip. Frames count from the clip's start and may fall between frames (110.4), read at that exact time. Units: positionX/positionY move the picture's centre in frame widths/heights (0.1 = a tenth of the frame right or down, -4..4); scale multiplies the framed size about the frame's centre (1 = as framed, 0.01..20); rotation is degrees clockwise; opacity 0..1; cropLeft/Top/Right/Bottom remove that fraction of the source from its side (0..0.99); focusX/focusY (0..1) and zoom (1..20) animate the clip's reframe for the aspect being exported. The look and the panel key too, each key replacing the clip's own value: saturation 0..2 (1 as shot), grain 0..1, exposure -4..4 stops; pitch and yaw -85..85 degrees, perspective 0..1; radius 0..0.5, shadowX and shadowY -0.5..0.5, shadowBlur 0..0.25 and borderWidth 0..0.05, all in frame heights; shadowOpacity and borderOpacity 0..1 (a key above 0 draws a shadow or border the clip has none of); a shadow or border colour keys as its red, green and blue, each 0..1 (shadowRed, shadowGreen, shadowBlue; borderRed, borderGreen, borderBlue), keyed on the same frames so the colour eases from key to key; blur 0..1. Drawn by the Cut's monitor and its export alike, both the timeline engine. Returns the clip's keys; slates_get_timeline lists every clip's keys in timeline.keyframes. Requires timeline-keyframes; update Slates on capability refusal.",
|
|
6118
6502
|
input: z.object({
|
|
6119
6503
|
projectId: z.string().uuid(),
|
|
6120
6504
|
timelineId: z.string().uuid(),
|
|
@@ -6128,6 +6512,10 @@ export const setClipKeyframes = {
|
|
|
6128
6512
|
async run(input, ctx) {
|
|
6129
6513
|
const desktop = ctx.desktop();
|
|
6130
6514
|
await desktop.requireCapability('timeline-keyframes', 'clip keyframes');
|
|
6515
|
+
if (Object.keys(input.properties).some((id) => PANEL_KEY_IDS.has(id)))
|
|
6516
|
+
await desktop.requireCapability('clip-panels', "keys on a clip's look, 3D, panel and blur");
|
|
6517
|
+
if (Object.keys(input.properties).some((id) => PANEL_COLOUR_KEY_IDS.has(id)))
|
|
6518
|
+
await desktop.requireCapability('panel-colour-keys', "keys on a panel's shadow and border colours");
|
|
6131
6519
|
await requireKeysBetweenFrames(desktop, ...Object.values(input.properties));
|
|
6132
6520
|
return ok(await desktop.post('/agent/timeline/keyframes', input));
|
|
6133
6521
|
},
|
|
@@ -6144,7 +6532,7 @@ const CAPTION_COMPONENTS = [
|
|
|
6144
6532
|
'caption-gradient-fill', 'caption-kinetic-slam', 'caption-clip-wipe', 'caption-matrix-decode', 'caption-particle-burst',
|
|
6145
6533
|
'caption-neon-accent', 'caption-editorial-emphasis',
|
|
6146
6534
|
];
|
|
6147
|
-
const htmlCompositionInput = z.string().min(1).describe('A composition: a whole HTML document whose GSAP timeline is registered on window.__timelines.');
|
|
6535
|
+
const htmlCompositionInput = z.string().min(1).describe('A composition: a whole HTML document whose GSAP timeline is registered on window.__timelines. Slates seeks that timeline to every frame with its callbacks off, so onUpdate, onComplete and the other callbacks never run; drive a number or text that changes with a tween on a function property, which is called with the new value on every frame drawn.');
|
|
6148
6536
|
const htmlVariablesInput = z.record(z.union([z.string(), z.number(), z.boolean()])).describe("Values for the composition's or block's declared variables, by name: text, numbers or true/false. A picture (declared type image) takes an image asset id (UUID) of this project, or \"\" for the layer's own picture, and reads back as its path in the project folder (images/logo.png); a web address or another project's picture is refused.");
|
|
6149
6537
|
export const addCaptions = {
|
|
6150
6538
|
id: 'slates_add_captions',
|
|
@@ -6287,7 +6675,7 @@ export const listMotionBlocks = {
|
|
|
6287
6675
|
};
|
|
6288
6676
|
export const updateTimelineTrack = {
|
|
6289
6677
|
id: 'slates_update_timeline_track',
|
|
6290
|
-
description: 'Update a timeline track: rename, mute/unmute, lock/unlock, or set its volume fader (linear gain, -∞ to +12 dB). Track volume applies to both preview and MP4 export — audio-track clips are mixed at this gain; a muted video track still shows video but its embedded audio is silenced. effects puts an effect list on a sound lane, heard after its clips\' own (the same shape as slates_update_clip, keys in frames from the timeline start).',
|
|
6678
|
+
description: 'Update a timeline track: rename, mute/unmute, lock/unlock, or set its volume fader (linear gain, -∞ to +12 dB). Track volume applies to both preview and MP4 export — audio-track clips are mixed at this gain; a muted video track still shows video but its embedded audio is silenced. effects puts an effect list on a sound lane, heard after its clips\' own (the same shape as slates_update_clip, keys in frames from the timeline start). above or below (another lane\'s id) moves the lane just there: picture lanes draw in their order, the top one in front, video and overlay lanes alike.',
|
|
6291
6679
|
input: z.object({
|
|
6292
6680
|
projectId: z.string().uuid(),
|
|
6293
6681
|
trackId: z.string().uuid(),
|
|
@@ -6296,13 +6684,20 @@ export const updateTimelineTrack = {
|
|
|
6296
6684
|
locked: z.boolean().optional(),
|
|
6297
6685
|
volume: z.number().min(0).max(4).optional().describe('Track fader as LINEAR gain: 0 = -∞ (silent), 1 = 0 dB (unity), ~3.98 = +12 dB (max boost).'),
|
|
6298
6686
|
effects: audioEffectList.nullable().optional().describe('A video or audio lane: its effect list, sent whole; null clears it.'),
|
|
6687
|
+
above: z.string().uuid().optional().describe('Another lane of the timeline: this one moves just above it.'),
|
|
6688
|
+
below: z.string().uuid().optional().describe('Another lane of the timeline: this one moves just below it.'),
|
|
6299
6689
|
}),
|
|
6300
6690
|
async run(input, ctx) {
|
|
6301
6691
|
const desktop = ctx.desktop();
|
|
6302
6692
|
await desktop.requireCapability('timeline-tracks', 'timeline tracks + audio mixing');
|
|
6303
6693
|
if (input.effects !== undefined)
|
|
6304
6694
|
await desktop.requireCapability('audio-effects', 'audio effects on a lane');
|
|
6695
|
+
await requireEqBands(desktop, input.effects);
|
|
6305
6696
|
await requireKeysBetweenFrames(desktop, input.effects);
|
|
6697
|
+
if (input.above !== undefined && input.below !== undefined)
|
|
6698
|
+
throw new Error('Send above or below, not both.');
|
|
6699
|
+
if (input.above !== undefined || input.below !== undefined)
|
|
6700
|
+
await desktop.requireCapability('clip-panels', 'placing a lane among the others');
|
|
6306
6701
|
return ok(await desktop.post('/agent/timeline/update-track', input));
|
|
6307
6702
|
},
|
|
6308
6703
|
};
|
|
@@ -6321,7 +6716,7 @@ export const removeTimelineTrack = {
|
|
|
6321
6716
|
};
|
|
6322
6717
|
export const updateTimelineSettings = {
|
|
6323
6718
|
id: 'slates_update_timeline_settings',
|
|
6324
|
-
description: "Update a timeline's output settings: resolution, frame rate (24/30/60; all clips are conformed to it on export), masterVolume, or delivery formats, naming taxonomy and explicit variant grid bindings. New fields require ad-variant-export; null clears them. Read aspects and dimensions from slates_get_variant_grid. Delivery-only updates on an explicit timeline return the computed formats. masterVolume is the output fader (linear gain: 0 is silent, 1 is unity, 4 is the maximum boost) applied to the preview and the final mix; use it to prevent clipping when stacking loud tracks. These are normally auto-managed: the first video clip sets fps and resolution, higher-res clips raise the canvas, and delivery preserves the master aspect. Changing frameRate keeps clip positions, lengths and markers in seconds, rounded to the nearest new frame. effects puts an effect list on the master, after the output fader (the same shape as slates_update_clip, keys in frames from the timeline start). audioBitrate is the exported MP4's sound in kb/s, the Sound bitrate the settings button shows.",
|
|
6719
|
+
description: "Update a timeline's output settings: resolution, frame rate (24/30/60; all clips are conformed to it on export), masterVolume, or delivery formats, naming taxonomy and explicit variant grid bindings. New fields require ad-variant-export; null clears them. Read aspects and dimensions from slates_get_variant_grid. Delivery-only updates on an explicit timeline return the computed formats. masterVolume is the output fader (linear gain: 0 is silent, 1 is unity, 4 is the maximum boost) applied to the preview and the final mix; use it to prevent clipping when stacking loud tracks. These are normally auto-managed: the first video clip sets fps and resolution, higher-res clips raise the canvas, and delivery preserves the master aspect. A width or height set here (or in the app's settings button) stays: from then on clips never resize the timeline, and the first clip still sets fps. Changing frameRate keeps clip positions, lengths and markers in seconds, rounded to the nearest new frame. effects puts an effect list on the master, after the output fader (the same shape as slates_update_clip, keys in frames from the timeline start). audioBitrate is the exported MP4's sound in kb/s, the Sound bitrate the settings button shows.",
|
|
6325
6720
|
input: z.object({
|
|
6326
6721
|
projectId: z.string().uuid(), timelineId: z.string().uuid().optional(),
|
|
6327
6722
|
width: z.number().int().min(16).optional(),
|
|
@@ -6337,6 +6732,7 @@ export const updateTimelineSettings = {
|
|
|
6337
6732
|
await desktop.requireCapability('timeline-tracks', 'timeline tracks + audio mixing');
|
|
6338
6733
|
if (input.effects !== undefined)
|
|
6339
6734
|
await desktop.requireCapability('audio-effects', 'audio effects on the master');
|
|
6735
|
+
await requireEqBands(desktop, input.effects);
|
|
6340
6736
|
await requireKeysBetweenFrames(desktop, input.effects);
|
|
6341
6737
|
if (input.audioBitrate !== undefined)
|
|
6342
6738
|
await requireSoundPrecision(desktop);
|
|
@@ -6355,7 +6751,7 @@ const ABSOLUTE_PATH_RE = /^([A-Za-z]:[\\/]|\/)/;
|
|
|
6355
6751
|
export const exportVideo = {
|
|
6356
6752
|
id: 'slates_export_video',
|
|
6357
6753
|
billable: false,
|
|
6358
|
-
description: "Render the project's timeline to an MP4 file on disk through the desktop app's timeline engine, the renderer its monitor shows, so the file matches the preview (H.264 + AAC, every video lane composited with its transitions, fades and keyframes, gaps rendered as black; the Slates window must be open). No dialogs — pass an absolute outputPath ending in .mp4. 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).",
|
|
6754
|
+
description: "Render the project's timeline to an MP4 file on disk through the desktop app's timeline engine, the renderer its monitor shows, so the file matches the preview (H.264 + AAC, 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. 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).",
|
|
6359
6755
|
input: z
|
|
6360
6756
|
.object({
|
|
6361
6757
|
projectId: z.string().uuid().optional(),
|
|
@@ -8967,10 +9363,16 @@ export const ALL_OPERATIONS = [
|
|
|
8967
9363
|
getAssetTranscript,
|
|
8968
9364
|
editAssetTranscript,
|
|
8969
9365
|
cutByTranscript,
|
|
9366
|
+
getSubjectMask,
|
|
9367
|
+
maskSubject,
|
|
8970
9368
|
getBeatGrid,
|
|
8971
9369
|
findBeats,
|
|
8972
9370
|
editBeatGrid,
|
|
8973
9371
|
cutToBeats,
|
|
9372
|
+
getWhipPans,
|
|
9373
|
+
findWhipPans,
|
|
9374
|
+
editWhipPans,
|
|
9375
|
+
joinOnWhip,
|
|
8974
9376
|
extractVideoFrame,
|
|
8975
9377
|
getMe,
|
|
8976
9378
|
getCreditBalance,
|