@slatesvideo/shared 0.7.18 → 0.7.19

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.
@@ -21,6 +21,7 @@ import { SlatesDesktopClient } from '../clients/desktop.js';
21
21
  import { BlenderBridgeClient, BLENDER_SETUP_HINT, RENDER_TIMEOUT_MS } from '../clients/blender.js';
22
22
  import { SKILLS } from '../skills/content.js';
23
23
  import { brainSkills, myBrainDir, myBrainPreload, noteUsed } from '../skills/my-brain.js';
24
+ import { remember } from '../skills/my-brain-write.js';
24
25
  import { brainFiles, refreshServedBrain, servedBrain } from '../skills/served.js';
25
26
  import { HYPERFRAMES_MAPPING, findHyperframesGuide, hyperframesCard, hyperframesCatalog, hyperframesFilesOf, hyperframesGuideHeader, hyperframesSkillBodies, loadHyperframes } from '../skills/hyperframes.js';
26
27
  import { appManualIndex, appManualSections } from '../manual/index.js';
@@ -541,10 +542,11 @@ export const setSelection = {
541
542
  const VIEW_LENSES = ['board', 'media', 'script'];
542
543
  const VIEW_CUT_SIDES = ['bottom', 'left', 'right'];
543
544
  const VIEW_DOCK_SECTIONS = ['storyboards', 'library', 'folders', 'pinned'];
544
- // W3: the one window's two layouts (`WINDOW_LAYOUTS`).
545
+ // W3: the one window's two layouts (`WINDOW_LAYOUTS`), and its shape (`SHAPE_SETTINGS`).
545
546
  const VIEW_WINDOW_LAYOUTS = ['plan', 'edit'];
546
547
  // What the timeline's Viewer shows (`VIEWER_MODES`).
547
548
  const VIEW_VIEWER_MODES = ['source', 'timeline'];
549
+ const VIEW_SHAPE_SETTINGS = ['auto', 'landscape', 'vertical'];
548
550
  // 1.6.1: what the user is looking at. Mirrors slate's `@shared/types/view` (lockstep check 12).
549
551
  const VIEW_BOARD_LEVELS = ['film', 'scenes', 'shot'];
550
552
  const VIEW_BOARD_FILTERS = ['all', 'with-clip', 'without-clip'];
@@ -645,7 +647,7 @@ const describeView = (v) => {
645
647
  `The project navigator is ${v.leftDock.open ? `open (${v.leftDock.width}px)` : 'closed'}, and ${agent}.` +
646
648
  (v.leftDock.folded?.length ? ` Folded in the navigator: ${v.leftDock.folded.map((f) => DOCK_SECTION_NAMES[f] ?? f).join(', ')}.` : '') +
647
649
  (v.window
648
- ? ` The window is in the ${v.window.layout === 'edit' ? 'Edit' : 'Plan'} layout, showing ${areas.length > 1 ? `${areas.slice(0, -1).join(', ')} and ${areas.at(-1)}` : areas[0] ?? 'none of its areas'}.`
650
+ ? ` The window is in the ${v.window.presetName ?? (v.window.layout === 'edit' ? 'Edit' : 'Plan')} layout${v.window.changed ? ' (changed since it was saved)' : ''}${v.window.shape ? `, ${v.window.shape}` : ''}, showing ${areas.length > 1 ? `${areas.slice(0, -1).join(', ')} and ${areas.at(-1)}` : areas[0] ?? 'none of its areas'}.`
649
651
  : '') +
650
652
  (v.script ? ` The Script page shows ${v.script.details ? 'Words + shots (each shot\'s picture beside its words)' : 'Words (the words alone)'}.` : '') +
651
653
  describeLooking(v));
@@ -657,7 +659,7 @@ const describeView = (v) => {
657
659
  */
658
660
  export const getView = {
659
661
  id: 'slates_get_view',
660
- description: "What the user is looking at in Slates: Home or a project, the tab (Media, Script or Board), the open board and its View and Filter, Media's tab, chosen folder and narrowing, a Library page, the picture viewer, the timeline Viewer's mode and clip, Compare, the animatic, Settings, whether the prompt box is hidden, the timeline and the side panels, and, from a desktop with the one-window layout, the window's layout (Plan or Edit, which areas show, the Viewer's Inspector drawer open or shut for want of room), and any dialog or menu open over the page. New desktops also report cut.format and the selected variant grid rows and aspects. Read it before telling the user where to click.",
662
+ description: "What the user is looking at in Slates: Home or a project, the tab (Media, Script or Board), the open board and its View and Filter, Media's tab, chosen folder and narrowing, a Library page, the picture viewer, the timeline Viewer's mode and clip, Compare, the animatic, Settings, whether the prompt box is hidden, the timeline and the side panels, and, from a desktop with the one-window layout, the window's layout (Edit, Plan or one the user saved, whether it changed since saved, the landscape or vertical shape, which areas show, the Viewer's Inspector drawer open or shut for want of room), and any dialog or menu open over the page. New desktops also report cut.format and the selected variant grid rows and aspects. Read it before telling the user where to click.",
661
663
  input: z.object({}).strict(),
662
664
  async run(_input, ctx) {
663
665
  await ctx.desktop().requireCapability('view', 'the window layout');
@@ -685,7 +687,7 @@ export const getView = {
685
687
  */
686
688
  export const setView = {
687
689
  id: 'slates_set_view',
688
- 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 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.",
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.",
689
691
  input: z
690
692
  .object({
691
693
  projectId: z.string().nullable().optional().describe('Open this project, or null for Home. Applied alone.'),
@@ -781,13 +783,23 @@ export const setView = {
781
783
  window: z
782
784
  .object({
783
785
  layout: z.enum(VIEW_WINDOW_LAYOUTS).optional().describe('edit gives the Viewer the room, with Media, Board and Script a column at its left; plan gives it to them, with the Viewer a column at their right.'),
786
+ preset: z
787
+ .string()
788
+ .min(1)
789
+ .optional()
790
+ .describe("Switch to this layout, by id or by name in any case: Edit, Plan or one the user saved (slates_get_view lists them in window.presets). An unknown name comes back as a note naming the layouts."),
791
+ reset: z.boolean().optional().describe("true puts the current layout back as it was saved (the Layout map's Reset layout)."),
792
+ shape: z
793
+ .enum(VIEW_SHAPE_SETTINGS)
794
+ .optional()
795
+ .describe('landscape: the timeline full width along the bottom. vertical: the Viewer and the Inspector full height at the right, Media, Board and Script over the timeline at the left. auto follows the open timeline (vertical while it is taller than wide).'),
784
796
  viewer: z.boolean().optional().describe('Show or hide the Viewer.'),
785
797
  inspector: z.boolean().optional().describe("Open or shut the Inspector, the Viewer's drawer (opening it shows the Viewer); in a window with no room, Media, Board and Script fold to make room."),
786
798
  lensWidth: z.number().optional().describe("The Media, Board and Script column's width in px in the Edit layout."),
787
799
  })
788
800
  .strict()
789
801
  .optional()
790
- .describe('The one window (desktops with it): its layout and which areas show.'),
802
+ .describe('The one window (desktops with it): its layout, its shape and which areas show.'),
791
803
  })
792
804
  .strict(),
793
805
  async run(input, ctx) {
@@ -803,6 +815,9 @@ export const setView = {
803
815
  input.script?.panelShotId !== undefined;
804
816
  if (widened)
805
817
  await ctx.desktop().requireCapability('view-v2', 'showing and opening things in the window');
818
+ if (input.window?.preset !== undefined || input.window?.reset !== undefined || input.window?.shape !== undefined) {
819
+ await ctx.desktop().requireCapability('layout-presets', 'choosing a layout or the window shape');
820
+ }
806
821
  if (input.cut?.format !== undefined || input.cut?.gridSelection !== undefined) {
807
822
  await ctx.desktop().requireCapability('ad-variant-export', 'delivery preview and variant grid selection');
808
823
  }
@@ -1866,6 +1881,7 @@ export const estimateGenerationCost = {
1866
1881
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image tier; default ${DEFAULT_GPT_QUALITY}.`),
1867
1882
  aspectRatio: z.string().optional().describe('GPT Image: the frame shape changes the price; pass the generation\'s value.'),
1868
1883
  sound: z.boolean().optional().describe('Kling 3.0: a silent take prices differently from one with sound. Omitted means sound on, as generation bills it; pass false to price a silent take. Kling 4K keys include audio.'),
1884
+ seedanceDraft: z.boolean().optional().describe('Create a finishable Seedance 2.5 preview at 480p.'),
1869
1885
  seedanceFace: z.boolean().optional().describe('Seedance Face row, for an AI character\'s face.'),
1870
1886
  seedanceRealFace: z.boolean().optional().describe('Seedance with a consented real person (premium key).'),
1871
1887
  videoRefSeconds: z.number().nonnegative().optional().describe('Combined reference-video seconds, measured from the clips.'),
@@ -1879,10 +1895,14 @@ export const estimateGenerationCost = {
1879
1895
  if (retired) {
1880
1896
  throw new Error(`${retired} was retired and ${RETIRED_MODELS[retired]} replaced it. Quote ${RETIRED_MODELS[retired]} with the same parameters.`);
1881
1897
  }
1898
+ if (input.seedanceDraft) {
1899
+ const video = resolveVideoModel(input.model);
1900
+ input.videoResolution = draftResolution(video?.model, input.videoResolution ?? video?.videoResolution);
1901
+ }
1882
1902
  const registry = await ctx.cloud().get('/api/agent/models');
1883
1903
  const byKey = new Map(registry.models.filter((m) => !retiredModelOfKey(m.model)).map((m) => [m.model, creditCost(m)]));
1884
1904
  // 1) exact registry cost key
1885
- let key = byKey.has(input.model) ? input.model : null;
1905
+ let key = !input.seedanceDraft && byKey.has(input.model) ? input.model : null;
1886
1906
  // 2) image base id + resolution (+ quality for GPT Image)
1887
1907
  if (!key) {
1888
1908
  // IMAGE_MODELS, never a second hand-typed copy: this list is declared
@@ -2002,7 +2022,7 @@ export const estimateGenerationCost = {
2002
2022
  resolved.videoResolution ??
2003
2023
  // Seedance quotes are resolution-scaled, so a missing resolution has
2004
2024
  // to fall back to the model's OWN default — the ladders differ per
2005
- // row (2.5 has no 4K) and a blanket literal quotes a key that does
2025
+ // row and a blanket literal can quote a key that does
2006
2026
  // not exist. Read from the SSOT; this used to be a hand-typed
2007
2027
  // model-id ternary.
2008
2028
  defaultVideoResolutionFor(resolved.model),
@@ -4013,7 +4033,7 @@ export function videoCostKey(input) {
4013
4033
  // (fal partner endpoint). A reference video flips to `-vref-{res}-{T}s`,
4014
4034
  // T = in + out, or max(in, out) + out on the AI-face route.
4015
4035
  //
4016
- // ⚠️ EVERY BOUND HERE IS VERSION-SCOPED. 2.5 runs 480p/720p/1080p (no 4K),
4036
+ // ⚠️ EVERY BOUND HERE IS VERSION-SCOPED. 2.5 runs through native 4K,
4017
4037
  // reaches 30s, and takes references to 30s combined — so its vref total
4018
4038
  // reaches 60, DOUBLE 2.0's ceiling of 30. Clamping a 2.5 quote at 30 would
4019
4039
  // quote a real key at a fraction of the real bill. The ladder itself lives in
@@ -4363,6 +4383,12 @@ function promptingSkillFor(model) {
4363
4383
  const VIDEO_MODEL_GUIDES = [
4364
4384
  ...new Set(VIDEO_MODELS.map((m) => promptingSkillFor(m))),
4365
4385
  ].join(' / ');
4386
+ function draftResolution(model, resolution) {
4387
+ if (model !== 'seedance-2.5' || (resolution != null && resolution !== '480p')) {
4388
+ throw new Error('Draft previews require Seedance 2.5 at 480p.');
4389
+ }
4390
+ return '480p';
4391
+ }
4366
4392
  export const generateVideo = {
4367
4393
  id: 'slates_generate_video',
4368
4394
  billable: true,
@@ -4429,6 +4455,7 @@ export const generateVideo = {
4429
4455
  sound: z.boolean().optional().describe('Kling 3.0 (every tier), LTX and Wan 3.0: sound on (default) or silent (false); Kling 3.0 bills audio as its own key. Seedance, Omni Flash, H3 and Kling 4.0 always generate audio.'),
4430
4456
  audioLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('Any Kling 3.0 model with sound on — language for dialogue.'),
4431
4457
  generateMusic: z.boolean().optional().describe('Any Kling 3.0 model with sound on — auto-generate background music.'),
4458
+ seedanceDraft: z.boolean().optional().describe('Create a finishable Seedance 2.5 preview at 480p.'),
4432
4459
  seedanceFace: z.boolean().optional().describe('Seedance only: a reference shows an AI character\'s face. Without it, faces are blocked; the estimate prices it. A real person fails here with [REAL_FACE_DETECTED]; see seedanceRealFace.'),
4433
4460
  seedanceRealFace: z.boolean().optional().describe('Seedance ONLY: a reference shows a REAL person. The real-person tier, priced above Face: estimate it with the flag set first. REQUIRES realFaceConsent=true.'),
4434
4461
  realFaceConsent: z.boolean().optional().describe('MANDATORY with seedanceRealFace: true ONLY after the user has explicitly confirmed they hold rights/consent to this likeness and it does not impersonate or misrepresent them. Refused without it; public figures fail on every tier.'),
@@ -4452,6 +4479,11 @@ export const generateVideo = {
4452
4479
  `pass the base id and set duration / videoResolution as separate params.`);
4453
4480
  }
4454
4481
  input.model = resolved.model;
4482
+ if (input.seedanceDraft || (input.model === 'seedance-2.5' && (input.videoResolution ?? resolved.videoResolution) === '4k')) {
4483
+ await ctx.desktop().requireCapability('seedance-drafts', 'Seedance 2.5 drafts and 4K output');
4484
+ }
4485
+ if (input.seedanceDraft)
4486
+ input.videoResolution = draftResolution(input.model, input.videoResolution ?? resolved.videoResolution);
4455
4487
  requireGuideRead(ctx, input.model);
4456
4488
  if (input.duration == null && resolved.duration != null)
4457
4489
  input.duration = resolved.duration;
@@ -4976,6 +5008,7 @@ export const generateVideo = {
4976
5008
  generateMusic: input.generateMusic,
4977
5009
  seedanceFace: input.seedanceFace,
4978
5010
  seedanceRealFace: input.seedanceRealFace,
5011
+ seedanceDraft: input.seedanceDraft,
4979
5012
  realFaceConsent: input.realFaceConsent,
4980
5013
  negativePrompt: input.negativePrompt,
4981
5014
  ...folderBody(input.folderId),
@@ -7896,6 +7929,7 @@ function shotParamsShape(described) {
7896
7929
  imageQuantity: d(z.number().int().min(1).max(10).optional(), 'Image models only.'),
7897
7930
  negativePrompt: z.string().optional(),
7898
7931
  sound: d(z.boolean().optional(), 'Video models that co-generate audio.'),
7932
+ seedanceDraft: d(z.boolean().optional(), 'Make a finishable Seedance 2.5 preview at 480p.'),
7899
7933
  seedanceFace: d(z.boolean().optional(), "Seedance only — a reference shows an AI character's face; without it faces are blocked. The estimate prices it."),
7900
7934
  audioDurationSeconds: d(z.number().int().min(1).max(120).optional(), 'Audio lane. On seed-audio the requested duration IS the bill.'),
7901
7935
  // The TTS voice — the same three fields slates_generate_audio takes, so a
@@ -8004,6 +8038,8 @@ function shotParamsPatch(p) {
8004
8038
  for (const [k, v] of Object.entries(p))
8005
8039
  if (v !== undefined)
8006
8040
  out[k] = v;
8041
+ if (p.seedanceDraft && p.videoResolution === undefined)
8042
+ out.videoResolution = '480p';
8007
8043
  return out;
8008
8044
  }
8009
8045
  /**
@@ -8166,6 +8202,8 @@ function namedSpecPatch(input, spec) {
8166
8202
  * model, which is worse than the gap.
8167
8203
  */
8168
8204
  function assertShotCapabilities(model, params) {
8205
+ if (params?.seedanceDraft && model)
8206
+ draftResolution(model, params.videoResolution);
8169
8207
  if (!model || !VIDEO_MODELS.includes(model))
8170
8208
  return null;
8171
8209
  const err = assertVideoCapabilities({
@@ -8176,6 +8214,16 @@ function assertShotCapabilities(model, params) {
8176
8214
  });
8177
8215
  return err ? ok(err) : null;
8178
8216
  }
8217
+ async function requireDraftShotDesktop(desktop, model, params, shotId) {
8218
+ if (params?.seedanceDraft) {
8219
+ await desktop.requireCapability('seedance-drafts', 'saving a Seedance 2.5 draft');
8220
+ }
8221
+ else if (params?.videoResolution === '4k') {
8222
+ const target = model ?? (shotId ? (await desktop.get('/agent/shots/get', { id: shotId })).shot.model : undefined);
8223
+ if (target === 'seedance-2.5')
8224
+ await desktop.requireCapability('seedance-drafts', 'saving a native 4K Seedance Shot');
8225
+ }
8226
+ }
8179
8227
  /** Fetch a dynamic cloud cost key for the standalone generation estimate. */
8180
8228
  async function loadDynamicPrice(ctx, byKey, key) {
8181
8229
  if (!key || byKey.has(key))
@@ -8219,6 +8267,7 @@ export const createShot = {
8219
8267
  return alignErr;
8220
8268
  const desktop = ctx.desktop();
8221
8269
  await desktop.requireCapability('shots', 'saved Shots');
8270
+ await requireDraftShotDesktop(desktop, input.model, input.params);
8222
8271
  // 1.6.0 ignores fromAssetId, and would then refuse the missing prompt.
8223
8272
  if (input.fromAssetId)
8224
8273
  await desktop.requireCapability('shot-from-asset', 'saving a result as a Shot');
@@ -8321,6 +8370,7 @@ export const updateShot = {
8321
8370
  return alignErr;
8322
8371
  const desktop = ctx.desktop();
8323
8372
  await desktop.requireCapability('shots', 'saved Shots');
8373
+ await requireDraftShotDesktop(desktop, input.model, input.params, input.shotId);
8324
8374
  const { spec, seatNote } = await buildShotSpecInput(ctx, input.projectId, input);
8325
8375
  // Only send the halves the caller actually named; the route merges a PARTIAL
8326
8376
  // spec over the stored one, so an omitted field is never silently cleared.
@@ -8358,6 +8408,7 @@ export const duplicateShot = {
8358
8408
  return capErr;
8359
8409
  const desktop = ctx.desktop();
8360
8410
  await desktop.requireCapability('shots', 'saved Shots');
8411
+ await requireDraftShotDesktop(desktop, input.model, input.params, input.shotId);
8361
8412
  // Only the halves actually named. The route merges two levels deep, so an
8362
8413
  // omitted param on the copy keeps the original's value rather than clearing it.
8363
8414
  const spec = {};
@@ -8954,6 +9005,12 @@ export const generateFromShots = {
8954
9005
  await desktop.requireCapability('board-quote', 'Shot prices');
8955
9006
  // Resolved first so a SHOT-A code fails here, not halfway through a billed run.
8956
9007
  const details = await Promise.all(input.shotIds.map((id) => desktop.get('/agent/shots/get', { id })));
9008
+ // Older desktops drop the draft flag when reading a saved recipe. Its persisted 480p
9009
+ // resolution survives, so require a capable desktop before firing an ambiguous video Shot.
9010
+ if (!input.draft && details.some(({ shot }) => shot.model === 'seedance-2.5' &&
9011
+ (shot.params?.seedanceDraft || ['480p', '4k'].includes(String(shot.params?.videoResolution))))) {
9012
+ await desktop.requireCapability('seedance-drafts', 'generating saved Seedance 2.5 preview or 4K Shots');
9013
+ }
8957
9014
  const { draft, note: seatNote } = await desktopDraft(desktop, input.draft);
8958
9015
  const quote = await desktop.get('/agent/shots/quote', {
8959
9016
  input: JSON.stringify({ projectId: details[0].shot.projectId, shotIds: details.map((d) => d.shot.id), draft }),
@@ -9011,6 +9068,107 @@ export const getBoardProgress = {
9011
9068
  return ok(await ctx.desktop().get('/agent/shots/progress', input));
9012
9069
  },
9013
9070
  };
9071
+ const draftFinishInput = z.object({
9072
+ projectId: z.string().uuid(),
9073
+ assetId: z.string().describe('Draft video asset ID or badge code.'),
9074
+ resolution: z.enum(['1080p', '4k']),
9075
+ });
9076
+ const draftApproval = {
9077
+ confirm: z.literal(true).describe('The user approved this finish at the quoted price.'),
9078
+ maxCredits: z.number().int().nonnegative().describe('Maximum credits the user approved for the finish.'),
9079
+ };
9080
+ const paidDraftFinishInput = draftFinishInput.extend(draftApproval);
9081
+ export const quoteDraftFinish = {
9082
+ id: 'slates_quote_draft_finish',
9083
+ description: 'Quote a draft take at its full source duration and check its expiry or existing final.',
9084
+ input: draftFinishInput,
9085
+ async run(input, ctx) {
9086
+ const desktop = ctx.desktop();
9087
+ await desktop.requireCapability('seedance-drafts', 'finishing draft takes');
9088
+ const refs = await resolveAssetRefs(ctx, input.projectId, [input.assetId]);
9089
+ return ok(await desktop.get('/agent/assets/quote-draft-finish', { ...input, assetId: refs.get(input.assetId).id }));
9090
+ },
9091
+ };
9092
+ export const finishDraft = {
9093
+ id: 'slates_finish_draft',
9094
+ description: 'Finish an approved draft at 1080p or 4K. Quote the full price first. Check a background generation with slates_get_generation_status.',
9095
+ input: paidDraftFinishInput,
9096
+ billable: true,
9097
+ async run(input, ctx) {
9098
+ requireGuideRead(ctx, 'seedance-2.5');
9099
+ const desktop = ctx.desktop();
9100
+ await desktop.requireCapability('seedance-drafts', 'finishing draft takes');
9101
+ const refs = await resolveAssetRefs(ctx, input.projectId, [input.assetId]);
9102
+ const receipt = await desktop.post('/agent/assets/finish-draft', { ...input, assetId: refs.get(input.assetId).id, background: true });
9103
+ if (!ctx.waitForCutFinish || receipt.status === 'completed')
9104
+ return ok(receipt);
9105
+ if (!receipt.generationId)
9106
+ throw new Error('The finish did not return a generation ID.');
9107
+ for (;;) {
9108
+ if (ctx.signal?.aborted)
9109
+ throw new OperationCancelledError('check the submitted finish in Generations');
9110
+ const status = await desktop.get('/agent/generation/status', { id: receipt.generationId });
9111
+ if (status.generation.status === 'completed') {
9112
+ const cost = receipt.cost_credits === 0 ? 0 : status.generation.draftFinishCredits ?? receipt.cost_credits;
9113
+ return ok({ ...receipt, status: 'completed', cost_credits: cost, assetId: status.asset?.id ?? status.generation.assetId });
9114
+ }
9115
+ if (status.generation.status !== 'processing' && status.generation.status !== 'pending') {
9116
+ throw new Error(status.generation.error || 'The draft finish failed.');
9117
+ }
9118
+ await new Promise(resolve => setTimeout(resolve, 2000));
9119
+ }
9120
+ },
9121
+ };
9122
+ const cutDraftInput = z.object({ projectId: z.string().uuid(), timelineId: z.string().uuid() });
9123
+ const quoteCutInput = cutDraftInput.extend({
9124
+ resolutions: z.record(z.enum(['1080p', '4k'])).optional().describe('Target resolution by draft asset UUID. Defaults to 1080p.'),
9125
+ });
9126
+ const cutFinishStatusInput = cutDraftInput.extend({
9127
+ quoteId: z.string().min(1).describe('Identifier returned by slates_quote_cut_drafts.'),
9128
+ });
9129
+ const finishCutInput = cutFinishStatusInput.extend(draftApproval);
9130
+ export const quoteCutDrafts = {
9131
+ id: 'slates_quote_cut_drafts',
9132
+ description: 'Price the distinct draft sources used in a cut. Returns full-source prices, expiry and a quote ID for approval.',
9133
+ input: quoteCutInput,
9134
+ async run(input, ctx) {
9135
+ const desktop = ctx.desktop();
9136
+ await desktop.requireCapability('seedance-drafts', 'finishing drafts in a cut');
9137
+ return ok(await desktop.post('/agent/timeline/cut', { ...input, action: 'quoteDrafts' }));
9138
+ },
9139
+ };
9140
+ export const finishCutDrafts = {
9141
+ id: 'slates_finish_cut_drafts',
9142
+ description: 'Start finishing the approved cut in the background. Each ready final replaces its draft throughout the cut. Check progress with slates_get_cut_draft_status.',
9143
+ input: finishCutInput,
9144
+ billable: true,
9145
+ async run(input, ctx) {
9146
+ requireGuideRead(ctx, 'seedance-2.5');
9147
+ const desktop = ctx.desktop();
9148
+ await desktop.requireCapability('seedance-drafts', 'finishing drafts in a cut');
9149
+ const query = { projectId: input.projectId, timelineId: input.timelineId, quoteId: input.quoteId };
9150
+ let receipt = await desktop.post('/agent/timeline/cut', {
9151
+ ...input, action: 'finishDrafts', background: true,
9152
+ });
9153
+ while (ctx.waitForCutFinish && receipt.status === 'running') {
9154
+ if (ctx.signal?.aborted)
9155
+ throw new OperationCancelledError('check the cut finish status for any source already submitted');
9156
+ await new Promise(resolve => setTimeout(resolve, 2000));
9157
+ receipt = await desktop.get('/agent/timeline/draft-finish', query);
9158
+ }
9159
+ return ok(receipt);
9160
+ },
9161
+ };
9162
+ export const getCutDraftStatus = {
9163
+ id: 'slates_get_cut_draft_status',
9164
+ description: 'Check which sources in an approved cut have been finished, replaced, or kept as drafts.',
9165
+ input: cutFinishStatusInput,
9166
+ async run(input, ctx) {
9167
+ const desktop = ctx.desktop();
9168
+ await desktop.requireCapability('seedance-drafts', 'finishing drafts in a cut');
9169
+ return ok(await desktop.get('/agent/timeline/draft-finish', input));
9170
+ },
9171
+ };
9014
9172
  export const editCut = {
9015
9173
  id: 'slates_edit_cut',
9016
9174
  description: 'Build the timeline from the board\'s chosen clips (a marker per scene), or keep it in step with the board\'s favourite takes: read pending preferred-take changes, explicitly replace one clip, sync a board’s preferred clips, or build a cut in board order. Read changes first for the count. Swaps keep timeline starts and source timing when possible; shorter takes are visibly marked. Never changes a shot recipe or poster. Undo swaps with restore and the returned before snapshots; undo a build with undo-build and its clipIds/markerIds.',
@@ -9489,6 +9647,23 @@ export const getPromptingGuide = {
9489
9647
  return { text, data: { ...result, ...(tied.length ? { tied } : {}), memberAccess: member.access, bytes: Buffer.byteLength(text, 'utf8') } };
9490
9648
  },
9491
9649
  };
9650
+ export const rememberInMyBrain = {
9651
+ id: 'slates_remember',
9652
+ description: 'Save a lesson to the user\'s own brain (My brain, on their machine; it wins over the shared brain on every later job). Call it without asking when they say remember, always or never, or correct the same thing a second time; then tell them in one line what was saved and that "undo" removes it. One lesson per call, in their words. file groups lessons by topic (hooks, captions, profile for who they are and what they make; a shared guide\'s name adds to that guide for them). To change a rule pass replaces with the old line; to undo or forget pass replaces alone. A refusal names why (a cap, a lesson the shared brain already holds): merge into an existing line instead. Free.',
9653
+ input: z.object({
9654
+ lesson: z.string().min(3).max(300).optional().describe('One rule or preset in the user\'s words, for example "cut every hook to its first word". Omit with replaces to remove a line.'),
9655
+ file: z.string().min(1).max(60).optional().describe('Their file, lowercase-hyphenated: a topic (hooks), profile, or a shared guide name. Default my-rules.'),
9656
+ source: z.string().max(120).optional().describe('What taught it: "said always", "corrected twice", "kept take IMG-A8".'),
9657
+ replaces: z.string().min(3).max(300).optional().describe('Text of the existing line this lesson replaces; alone, the line to remove.'),
9658
+ }),
9659
+ async run(input) {
9660
+ const result = remember(input);
9661
+ const text = result.unchanged ? `Already in your brain (${result.file}): ${result.saved}`
9662
+ : result.saved ? `Saved to your brain (${result.file}): ${result.saved}${result.removed ? ` (replaces: ${result.removed})` : ''}`
9663
+ : `Removed from your brain (${result.file}): ${result.removed}`;
9664
+ return { text, data: { ...result } };
9665
+ },
9666
+ };
9492
9667
  /**
9493
9668
  * Task discovery and exact schemas share one operation. The desktop uses
9494
9669
  * names/group to replace its optional selection; MCP keeps its full list fixed.
@@ -9903,8 +10078,14 @@ export const ALL_OPERATIONS = [
9903
10078
  generateFromShots,
9904
10079
  quoteBoard,
9905
10080
  getBoardProgress,
10081
+ quoteDraftFinish,
10082
+ finishDraft,
10083
+ quoteCutDrafts,
10084
+ finishCutDrafts,
10085
+ getCutDraftStatus,
9906
10086
  editCut,
9907
10087
  getPromptingGuide,
10088
+ rememberInMyBrain,
9908
10089
  loadTools,
9909
10090
  // ── Blender previs, LAST and deliberately ────────────────────────────
9910
10091
  // These six landed at the TOP once, which put a third transport nobody
@@ -42,6 +42,8 @@ const READ_ONLY_PREFIXES = [
42
42
  'slates_blender_search_docs',
43
43
  // Runs HyperFrames' check on a composition and writes nothing; it POSTs because the document is the payload.
44
44
  'slates_check_composition',
45
+ 'slates_quote_cut_drafts',
46
+ 'slates_quote_draft_finish',
45
47
  ];
46
48
  /**
47
49
  * Ops whose effect a user cannot undo from inside Slates.
@@ -154,6 +156,7 @@ export const OPERATION_GROUPS = {
154
156
  'slates_update_style',
155
157
  'slates_delete_style',
156
158
  'slates_list_library',
159
+ 'slates_quote_draft_finish', 'slates_finish_draft',
157
160
  'slates_create_library_item',
158
161
  'slates_update_library_item',
159
162
  'slates_delete_library_item',
@@ -174,6 +177,7 @@ export const OPERATION_GROUPS = {
174
177
  script: ['slates_get_script_document', 'slates_update_script_document', 'slates_get_script_sections', 'slates_update_script_section', 'slates_get_script_suggestions', 'slates_update_script_suggestions', 'slates_get_script_uses', 'slates_preview_script_variation', 'slates_create_script_variation', 'slates_get_shot_inputs', 'slates_reuse_shot_take'],
175
178
  timeline: [
176
179
  'slates_list_timelines', 'slates_save_timeline', 'slates_export_cuts',
180
+ 'slates_quote_cut_drafts', 'slates_finish_cut_drafts', 'slates_get_cut_draft_status',
177
181
  'slates_get_export_batch', 'slates_cancel_export_batch', 'slates_get_variant_grid', 'slates_get_recipe',
178
182
  'slates_reframe_clip', 'slates_get_reframe_report',
179
183
  'slates_get_timeline',
@@ -118,7 +118,7 @@ export const WORKING_METHOD = [
118
118
  // the exception: it is multi-line and generated, and supplies its own bullet.
119
119
  export const HARD_RULES = [
120
120
  // FORKED: "outside an approved plan" names the desktop's code-level gate.
121
- fork(`- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation outside an approved plan. Estimate before you promise. Batch related generations into one plan. When the user says cheap or cheapest, price decides: plan the lowest-priced setting the estimates show (at a tie, the better quality at that price); "best" then means the best picture at that price, never a dearer tier. A dearer tier is named in words, never generated unless the user asks for it.`, `- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation the user has not agreed to. Estimate before you promise. Batch related generations into one quote so the user approves a total, not a drip.`),
121
+ fork(`- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation outside an approved plan. Estimate before you promise, and say each price exactly as the estimate gives it, never rounded. Batch related generations into one plan. When the user says cheap or cheapest, price decides: plan the lowest-priced setting the estimates show (at a tie, the better quality at that price); "best" then means the best picture at that price, never a dearer tier. A dearer tier is named in words, never generated unless the user asks for it.`, `- COST DISCIPLINE (slates-cost-discipline): never fire a billable generation the user has not agreed to. Estimate before you promise, and say each price exactly as the estimate gives it, never rounded. Batch related generations into one quote so the user approves a total, not a drip.`),
122
122
  both(`- CONTENT POLICY: before writing prompts involving real people/celebrities, minors, brands/logos, weapons, or gore, load slates-content-policy and build the scene safe from the first word. If a provider rejects (e.g. real-face detection), explain in plain language — refunds for provider rejections are automatic.`),
123
123
  both(`- PROMPT IS LAW (reference doctrine): references are cited inline by name and image number ("Marcus (images 1 and 2)"); the prompt text leads. Never write role-essays about what each reference is "for".`),
124
124
  both(`- NAMES AND DESCRIPTIONS ARE THE USER'S UI, NOT YOUR NOTEPAD. A project, board or shot name is rendered at the top of the user's screen at all times. Name it after the piece ("Kaiju selfie"), never after your process, and NEVER append your own status or housekeeping — no "shot list", no "v2", no "Written from IMG-A172 and IMG-A182", no "Delete freely", no "scratch". Leave the description empty unless the user gave you one worth keeping: a note-to-self at the top of the screen reads as part of the product, and the user has to look at it every day. Say that kind of thing in your reply to them instead.`),
@@ -640,15 +640,8 @@ export const MODEL_CAPABILITIES = {
640
640
  },
641
641
  'seedance-2.5': {
642
642
  aspectRatios: SEEDANCE_ASPECT_RATIOS,
643
- // 1080p landed 2026-08-24 on ALL THREE rails — BytePlus and EvoLink publish
644
- // 1080p rate rows and fal's live OpenAPI enum reads
645
- // ['480p','720p','1080p']. There is still NO 4K on 2.5 (2.0 is the only
646
- // Seedance with one), which is what keeps `is4kVideoKey` version-blind.
647
- //
648
- // DEFAULT STAYS 720p, deliberately: a 30s take at 1080p is ~853 credits
649
- // against a 1,000-credit welcome grant. Reaching a tier and defaulting to it
650
- // are different decisions.
651
- videoResolution: { options: ['480p', '720p', '1080p'], default: '720p' },
643
+ // Keep 720p as the default: a 30s take at 1080p is ~853 credits.
644
+ videoResolution: { options: ['480p', '720p', '1080p', '4k'], default: '720p' },
652
645
  duration: { min: 4, max: 30, mode: 'continuous' },
653
646
  maxIngredientImages: 30,
654
647
  maxReferenceVideos: 10,
@@ -660,10 +653,7 @@ export const MODEL_CAPABILITIES = {
660
653
  },
661
654
  'seedance-2.5-edit': {
662
655
  aspectRatios: SEEDANCE_ASPECT_RATIOS,
663
- // Same ladder as the generation row (1080p added 2026-08-24). EvoLink's
664
- // rate card carries 1080p on the edit/extend row and BytePlus's video-input
665
- // column runs the full tier list; an edit bills that tier × 2.
666
- videoResolution: { options: ['480p', '720p', '1080p'], default: '720p' },
656
+ videoResolution: { options: ['480p', '720p', '1080p', '4k'], default: '720p' },
667
657
  duration: { min: 4, max: 30, mode: 'continuous' },
668
658
  // 🚨 ZERO, AND IT MUST MATCH WHAT THE HANDLER SENDS. The model's edit task
669
659
  // type does accept reference images, but slate's
@@ -207,7 +207,7 @@ export const MODEL_FACTS = [
207
207
  kind: 'video',
208
208
  ...caps('seedance-2'),
209
209
  audioRefNeedsCompanion: true,
210
- notes: 'THE 4K AND VALUE SEAT beside the 2.5 default — the only Seedance with native 4K (Pro-gated; base accounts get PRO_REQUIRED) and cheaper than 2.5 at every resolution they share, with the same physics, effects and scale strengths; shorter takes, fewer references, no timestamps. VIDEO-ONLY. A bare "seedance" still resolves here for older CLIs that expect 4K.',
210
+ notes: 'The lower-cost Seedance seat through native 4K (Pro), with the same physics, effects and scale strengths; shorter takes, fewer references, no timestamps. VIDEO-ONLY. A bare "seedance" still resolves here for older CLIs that expect 4K.',
211
211
  },
212
212
  {
213
213
  id: 'seedance-2.5',
@@ -218,7 +218,7 @@ export const MODEL_FACTS = [
218
218
  ...caps('seedance-2.5'),
219
219
  // No companion requirement — audio-only references are one of the things
220
220
  // the second seat actually buys.
221
- notes: 'DEFAULT VIDEO MODEL — the strongest seat for physics, effects, scale and hero shots, and the only Seedance that takes long single takes, many references, audio-only references and integer-second timestamps. No 4K, and dearer than 2.0 at every shared resolution: go to 2.0 for 4K or the same resolution cheaper. LENGTH is the price dial — quote long takes first. VIDEO-ONLY. Timestamp grammar and the edit/extend words that make the provider reclassify and fail a generation are in slates-prompting-seedance-2-5.',
221
+ notes: 'DEFAULT VIDEO MODEL — the strongest seat for physics, effects, scale and hero shots, and the only Seedance that takes long single takes, many references, audio-only references and integer-second timestamps. Generate directly through native 4K (Pro), or finish a selected 480p draft at 1080p or 4K. The final is billed separately at full duration. LENGTH is the price dial — quote long takes first. VIDEO-ONLY. Timestamp grammar and the edit/extend words that make the provider reclassify and fail a generation are in slates-prompting-seedance-2-5.',
222
222
  },
223
223
  {
224
224
  id: 'seedance-2.5-edit',
@@ -121,7 +121,7 @@ const SEEDANCE_25 = {
121
121
  ...SEEDANCE,
122
122
  label: 'Seedance 2.5',
123
123
  intro: [
124
- 'Seedance 2.5 is the default video model. Against 2.0 it buys one 30-second take instead of 15, up to 30 image references (plus 10 video and 10 audio), audio-only references and integer-second timestamps — and it gives up 4K. It runs at 480p, 720p or 1080p, and it costs more than 2.0 at every tier they share, so pick 2.0 when you want the same resolution cheaper or you want 4K.',
124
+ 'Seedance 2.5 supports takes up to 30 seconds, up to 30 image references plus 10 video and 10 audio references, audio-only references and integer-second timestamps. Both 2.0 and 2.5 can generate directly at native 4K with Pro. Choose 2.5 to cut with 480p drafts and finish approved takes at 1080p or 4K.',
125
125
  "ByteDance's official advanced formula has 8 slots: precise subject + action details + scene/environment + lighting & color tone + camera movement + visual style + image quality + constraints. Sweet spot 60-150 words for a single shot, longer for multi-shot.",
126
126
  ],
127
127
  columns: [
@@ -144,7 +144,7 @@ const SEEDANCE_25 = {
144
144
  {
145
145
  heading: '720p is not the cheap one here',
146
146
  example: '30s \u00b7 720p \u00b7 Seedance 2.5 Face = 489 credits\n15s \u00b7 1080p \u00b7 Seedance 2.0 Face = 411 credits',
147
- note: 'Length is what moves the price, and 2.5 doubles the length ceiling — so a 30-second 720p clip can cost more than a 15-second 1080p one, against a 1,000-credit starting balance. Explore at short LENGTH rather than low resolution: cut the seconds to 4-8 while you are finding the shot, and stay at the resolution you actually want. A 480p pass does not de-risk a 720p render — generation is stochastic, so the 720p run is a different take, not the same shot rendered better. The Generate button always shows the exact number first.',
147
+ note: 'Length affects the price. Try 4–8 seconds while finding the shot. For a take you can finish later, select Draft before generating and save the 480p proxy. The finish quote covers the whole source at the chosen resolution, including referenced video, even if the cut uses only a few seconds. The draft and final are billed separately.',
148
148
  critical: true,
149
149
  },
150
150
  {
@@ -80,6 +80,7 @@ export interface ShotParams {
80
80
  audioLanguage?: string;
81
81
  audioAccent?: string;
82
82
  generateMusic?: boolean;
83
+ seedanceDraft?: boolean;
83
84
  seedanceFace?: boolean;
84
85
  multiShot?: boolean;
85
86
  multiShotSegments?: Array<{
@@ -193,10 +193,13 @@ function readParams(v) {
193
193
  n('audioPromptInfluence');
194
194
  b('sound');
195
195
  b('generateMusic');
196
+ b('seedanceDraft');
196
197
  b('seedanceFace');
197
198
  b('multiShot');
198
199
  b('audioLoop');
199
200
  b('audioMultilingual');
201
+ if (out.seedanceDraft && out.videoResolution === undefined)
202
+ out.videoResolution = '480p';
200
203
  // Shape validation only. The pre-2026-09-09 tier MIGRATION deliberately does
201
204
  // NOT live here: this file is a dependency-free leaf, and the migration's
202
205
  // SSOT is `migrateGptQuality` in slate/src/shared/pricing.ts, applied in
@@ -35,6 +35,7 @@ export const BRAIN_SHAPE = {
35
35
  "rule": [
36
36
  "slates-blocking-to-prompt",
37
37
  "slates-camera-language",
38
+ "slates-cinematic-advertisement",
38
39
  "slates-cinematic-look",
39
40
  "slates-content-policy",
40
41
  "slates-cost-discipline",
@@ -45,6 +46,7 @@ export const BRAIN_SHAPE = {
45
46
  "slates-shot-variety",
46
47
  "slates-style-prompting",
47
48
  "slates-transitions",
49
+ "slates-ugc-advertisement",
48
50
  "slates-vision-feedback-loop"
49
51
  ],
50
52
  "model": [
@@ -74,8 +76,8 @@ export const BRAIN_SHAPE = {
74
76
  "model": 6500
75
77
  },
76
78
  "layerWords": {
77
- "playbook": 29500,
78
- "rule": 25000,
79
+ "playbook": 29600,
80
+ "rule": 29000,
79
81
  "model": 43000
80
82
  },
81
83
  "mine": {
@@ -0,0 +1,34 @@
1
+ /** The file a lesson goes to when the agent names none. */
2
+ export declare const MY_BRAIN_RULES = "my-rules";
3
+ export interface RememberInput {
4
+ /** One lesson in the user's words, as a rule or a preset ("cut every hook to its first word"). */
5
+ lesson?: string;
6
+ /** Their file to put it in; a shared guide's name adds to that guide for them. */
7
+ file?: string;
8
+ /** What taught it: "said always", "corrected twice", "kept take IMG-A8". */
9
+ source?: string;
10
+ /** An existing line this lesson replaces, or with no lesson, the line to remove (undo, forget). */
11
+ replaces?: string;
12
+ }
13
+ export interface RememberResult {
14
+ file: string;
15
+ saved?: string;
16
+ removed?: string;
17
+ unchanged?: boolean;
18
+ }
19
+ /** Whether agents may save lessons on their own. On unless the user switched it off (the desktop's My brain panel). */
20
+ export declare function myBrainLearning(dir?: string): boolean;
21
+ export declare function setMyBrainLearning(on: boolean, dir?: string): void;
22
+ export interface MyBrainLesson {
23
+ text: string;
24
+ source: string;
25
+ date: string;
26
+ }
27
+ /** Every saved lesson, file by file, for a panel that lists them; lines written by hand are not lessons and are left out. */
28
+ export declare function myBrainLessons(dir?: string): Array<{
29
+ file: string;
30
+ lessons: MyBrainLesson[];
31
+ }>;
32
+ /** Add, replace or remove one lesson. Throws with a reason the agent can act on. */
33
+ export declare function remember(input: RememberInput, dir?: string, now?: Date): RememberResult;
34
+ //# sourceMappingURL=my-brain-write.d.ts.map