@slatesvideo/shared 0.7.3 → 0.7.5

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.
Files changed (53) hide show
  1. package/dist/analytics/events.d.ts +155 -0
  2. package/dist/analytics/events.js +430 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +4 -0
  5. package/dist/manual/content.d.ts +1 -1
  6. package/dist/manual/content.js +1 -1
  7. package/dist/operations/index.d.ts +88 -82
  8. package/dist/operations/index.js +235 -45
  9. package/dist/operations/surface.js +1 -0
  10. package/dist/prompts/agent-doctrine.js +26 -7
  11. package/dist/prompts/banned-tokens.d.ts +18 -0
  12. package/dist/prompts/banned-tokens.js +59 -4
  13. package/dist/prompts/generation-policy.d.ts +1 -1
  14. package/dist/prompts/model-capabilities.d.ts +3 -3
  15. package/dist/prompts/model-capabilities.js +3 -3
  16. package/dist/prompts/model-facts.d.ts +1 -1
  17. package/dist/prompts/model-facts.js +2 -2
  18. package/dist/prompts/partials.generated.js +1 -1
  19. package/dist/prompts/prompting-tips.js +8 -8
  20. package/dist/prompts/shot-grammar.d.ts +2 -2
  21. package/dist/prompts/shot-grammar.js +2 -2
  22. package/dist/skills/content.js +18 -18
  23. package/dist/update-check.js +1 -1
  24. package/exports/slates-prompt-builder/generated/reference-character.md +2 -2
  25. package/exports/slates-prompt-builder/generated/reference-content-policy.md +3 -3
  26. package/exports/slates-prompt-builder/generated/reference-gpt-image-2-5.md +4 -4
  27. package/exports/slates-prompt-builder/generated/reference-kling.md +5 -6
  28. package/exports/slates-prompt-builder/generated/reference-omni-flash.md +1 -1
  29. package/exports/slates-prompt-builder/generated/reference-seedance-2-5.md +15 -15
  30. package/exports/slates-prompt-builder/generated/reference-seedance.md +3 -4
  31. package/exports/slates-prompt-builder/generated/slates-prompt-builder-manifest.json +26 -26
  32. package/exports/slates-prompt-builder/generated/slates-prompt-builder.skill +0 -0
  33. package/package.json +5 -2
  34. package/skills/_partials/cinematic-card.md +1 -1
  35. package/skills/_partials/model-routing.md +2 -2
  36. package/skills/slates-character-identity.md +2 -2
  37. package/skills/slates-content-policy.md +3 -3
  38. package/skills/slates-model-selection.md +3 -3
  39. package/skills/slates-prompting-elevenlabs.md +1 -1
  40. package/skills/slates-prompting-flux-2-max.md +1 -2
  41. package/skills/slates-prompting-gpt-image-2-5.md +5 -5
  42. package/skills/slates-prompting-inworld-tts.md +1 -1
  43. package/skills/slates-prompting-kling-v3.md +4 -5
  44. package/skills/slates-prompting-lip-sync.md +5 -8
  45. package/skills/slates-prompting-ltx-2-5.md +2 -2
  46. package/skills/slates-prompting-minimax-h3.md +5 -5
  47. package/skills/slates-prompting-motion-transfer.md +2 -4
  48. package/skills/slates-prompting-omni-flash.md +1 -1
  49. package/skills/slates-prompting-seed-audio.md +1 -1
  50. package/skills/slates-prompting-seedance-2-5.md +19 -19
  51. package/skills/slates-prompting-seedance.md +10 -11
  52. package/skills/slates-prompting-seedream-5-lite.md +2 -3
  53. package/skills/slates-vision-feedback-loop.md +117 -117
@@ -36,10 +36,11 @@ toolModelFor, CHATGPT_FRAMING_RATIOS, } from '../prompts/model-facts.js';
36
36
  // never re-state one of those constraints as a literal enum or a sentence
37
37
  // again. It did until 2026-08-16, and every axis had drifted: an invented
38
38
  // `9:21`, "Kling/Seedance support all" (Seedance takes 6 of 11 and has no
39
- // `4:5`), "Veo locks to 16:9" (two on fal), "Kling: 5-15" (min is 3), a
40
- // `videoResolution` line that never mentioned Kling, and 4s quoted for Veo at
41
- // 1080p. A customer burned a round trip on `4:5` + Seedance: accepted here,
42
- // queued, credits reserved, rejected by the provider asynchronously.
39
+ // `4:5`), a model said to lock to 16:9 (it took two on fal), "Kling: 5-15"
40
+ // (min is 3), a `videoResolution` line that never mentioned Kling, and 4s
41
+ // quoted for a model at 1080p that only took 8s there. A customer burned a
42
+ // round trip on `4:5` + Seedance: accepted here, queued, credits reserved,
43
+ // rejected by the provider asynchronously.
43
44
  import { AGENT_ROUTE_PROVIDER, defaultImageResolutionFor, aspectRatioUnion, videoResolutionUnion, durationBounds, aspectRatiosFor, getModelCapability, defaultVideoResolutionFor, checkAspectRatio, checkVideoResolution, checkDuration, describeAspectRatios, describeVideoResolutions, describeDurations, describeReferenceImageCaps, } from '../prompts/model-capabilities.js';
44
45
  // Per-model warnings are extracted from skill @banned blocks. They ride the
45
46
  // selected model's estimate and submitted-prompt result, never another model's schema.
@@ -228,6 +229,23 @@ const BACKGROUND_DESCRIBE = 'Return generationId(s) now instead of blocking; pol
228
229
  // folderId to the folder chosen in the window, so every op and the Studio Agent get it at once.
229
230
  const FOLDER_DESCRIBE = "Folder the result lands in (slates_list_folders). Omit it to follow the folder chosen in the user's Slates window, else the project root; null is the root, on purpose.";
230
231
  const folderIdField = z.string().uuid().nullable().optional().describe(FOLDER_DESCRIBE);
232
+ // A name and a note for an asset (`slates_upload_reference_image`, `slates_update_asset`). The desktop
233
+ // enforces both limits (slate/src/shared/assetLabel.ts, MAX_ASSET_LABEL and MAX_ASSET_NOTE); these copies
234
+ // give the model the refusal before the call, and lockstep check 13 holds the two equal.
235
+ const ASSET_LABEL_MAX = 120;
236
+ const ASSET_NOTE_MAX = 2000;
237
+ const assetLabelField = z
238
+ .string()
239
+ .trim()
240
+ .min(1)
241
+ .max(ASSET_LABEL_MAX)
242
+ .describe('The name shown on the asset card and in lists, with its code, e.g. "Ref: copper No".');
243
+ const assetNoteField = z
244
+ .string()
245
+ .trim()
246
+ .min(1)
247
+ .max(ASSET_NOTE_MAX)
248
+ .describe("What the asset is, stored as the asset's prompt text and read back by slates_get_asset.");
231
249
  /** The `folderId` part of a generate or upload body: present only when the caller named one (null is the root). */
232
250
  const folderBody = (folderId) => (folderId === undefined ? {} : { folderId });
233
251
  // ── Vision QC pointers (the "quality-check with vision" rule, made structural) ──
@@ -242,7 +260,11 @@ const folderBody = (folderId) => (folderId === undefined ? {} : { folderId });
242
260
  // it to re-fetch something already in front of it burns a turn for nothing:
243
261
  // a blocking image generation returns the pixels inline, a video generation
244
262
  // returns none, and a background submission has no asset yet.
245
- const IMAGE_INLINE_REVIEW = 'The image is attached to this result — look at it against the brief before you describe it. ' +
263
+ // The check is spelled out because looking was not enough: on 2026-10-07 the
264
+ // agent received the pixels of a lighthouse with its lantern cut off by the top
265
+ // edge, described the image, and called it on brief (fix-after-review, 2 of 8).
266
+ const IMAGE_INLINE_REVIEW = 'The image is attached to this result — look at it against the brief before you describe it: ' +
267
+ 'first the frame edges (is every subject whole, or is one cut off where the brief did not ask for a crop?), then each thing the brief named. ' +
246
268
  'Any claim about how it LOOKS must come from pixels you actually received (slates-vision-feedback-loop).';
247
269
  const VIDEO_REVIEW_POINTER = 'You have NOT seen this clip: call slates_get_asset_video_frames on the asset id above before ' +
248
270
  'describing visible composition or identity. Sampled stills do not establish continuous motion, lip sync or sound; use actual playback through a capable host for those, or report them unreviewed.';
@@ -443,6 +465,8 @@ const describeLooking = (v) => {
443
465
  parts.push(`Folder ${v.media.folderId} is chosen: new pictures land in it.`);
444
466
  if (v.viewer?.assetId)
445
467
  parts.push(`The picture viewer is open on ${v.viewer.assetId}.`);
468
+ if (v.viewer?.mode === 'source' && v.viewer.sourceAssetId)
469
+ parts.push(`The timeline's Viewer shows the clip ${v.viewer.sourceAssetId} (Source).`);
446
470
  if (v.compare?.open)
447
471
  parts.push(`Compare is open on ${v.compare.assetIds.length} items.`);
448
472
  if (v.animatic?.open)
@@ -485,7 +509,7 @@ const describeView = (v) => {
485
509
  */
486
510
  export const getView = {
487
511
  id: 'slates_get_view',
488
- 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, Compare, the animatic, Settings, whether the prompt box is hidden, the timeline and the side panels, and any dialog or menu open over the page. Read it before telling the user where to click.",
512
+ 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 any dialog or menu open over the page. Read it before telling the user where to click.",
489
513
  input: z.object({}).strict(),
490
514
  async run(_input, ctx) {
491
515
  await ctx.desktop().requireCapability('view', 'the window layout');
@@ -513,7 +537,7 @@ export const getView = {
513
537
  */
514
538
  export const setView = {
515
539
  id: 'slates_set_view',
516
- 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, the picture 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. 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.",
540
+ 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. 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.",
517
541
  input: z
518
542
  .object({
519
543
  projectId: z.string().nullable().optional().describe('Open this project, or null for Home. Applied alone.'),
@@ -589,7 +613,7 @@ export const setView = {
589
613
  .strict()
590
614
  .optional(),
591
615
  library: z.object({ categoryId: z.string().nullable() }).strict().optional().describe("Open a Library category's page in Media's place; null goes back to the grid."),
592
- viewer: z.object({ assetId: z.string().nullable() }).strict().optional().describe('Open the picture viewer on a picture; null closes it.'),
616
+ viewer: z.object({ assetId: z.string().nullable() }).strict().optional().describe("A picture opens in the picture viewer; a clip plays in the timeline's Viewer (Source), on desktops after 1.6.2. null closes the picture viewer."),
593
617
  compare: z
594
618
  .object({ open: z.boolean().optional(), assetIds: z.array(z.string()).max(4).optional().describe('The compare set, two to four items.') })
595
619
  .strict()
@@ -743,7 +767,7 @@ export const setComposer = {
743
767
  .string()
744
768
  .min(1)
745
769
  .optional()
746
- .describe('A model id (slates_list_available_models), `<id>::face` for a face route, `chatgpt`, `lip-sync` or `motion-transfer`.'),
770
+ .describe('A model id (slates_list_available_models), `<id>::face` for its Face row, `chatgpt`, `lip-sync` or `motion-transfer`.'),
747
771
  prompt: z.string().optional().describe('Replaces the words. @name and #name attach what they name, as typing does.'),
748
772
  addMentions: z
749
773
  .array(z.string().regex(/^[@#]\S+$/))
@@ -965,8 +989,6 @@ export const VIDEO_MODELS = [
965
989
  'kling-v3.0-std',
966
990
  'kling-v3.0-pro',
967
991
  'kling-v3.0-omni',
968
- // Veo 3.1 Fast and Standard were retired on 2026-10-02 (Eric). The server
969
- // keeps their keys for older desktops only; nothing here offers them.
970
992
  'seedance-2',
971
993
  // Seedance 2.5 is the DEFAULT video model (Eric, 2026-09-13): 30s takes, 30
972
994
  // image references, audio-only references, up to 1080p (2026-08-24). 2.0 stays
@@ -1134,8 +1156,8 @@ export const estimateGenerationCost = {
1134
1156
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image tier; default ${DEFAULT_GPT_QUALITY}.`),
1135
1157
  aspectRatio: z.string().optional().describe('GPT Image only: 1:1, 4:3 and 3:4 cost more than 16:9.'),
1136
1158
  sound: z.boolean().optional().describe('Kling 3.0: the audio flag changes the cost key. Omitted means sound on, as generation bills it; pass false to price a silent take. Kling 4K keys include audio.'),
1137
- seedanceFace: z.boolean().optional().describe('Seedance AI-face route (pricier key).'),
1138
- seedanceRealFace: z.boolean().optional().describe('Seedance consented real-face route (premium key).'),
1159
+ seedanceFace: z.boolean().optional().describe('Seedance Face row, for an AI character\'s face (pricier key).'),
1160
+ seedanceRealFace: z.boolean().optional().describe('Seedance with a consented real person (premium key).'),
1139
1161
  videoRefSeconds: z.number().nonnegative().optional().describe('Combined reference-video seconds, measured from the clips.'),
1140
1162
  audioRefSeconds: z.number().nonnegative().optional().describe('Combined reference-audio seconds, including attached character voices.'),
1141
1163
  referenceImages: z.number().int().min(0).optional().describe(`MiniMax H3 rows only — how many reference IMAGES the generation will carry. Each image past the row's free allowance is a paid dimension of the cost key, so a quote that omits this UNDER-REPORTS a reference-heavy job. The allowances differ: minimax-h3 gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3']} free, minimax-h3-max gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3-max']}. Ignored by every other model. Start/end frames are free on both rows and are not reference images.`),
@@ -1296,6 +1318,25 @@ export const estimateGenerationCost = {
1296
1318
  const skill = promptingSkillFor(input.model);
1297
1319
  const card = describeCraftCard(skill);
1298
1320
  const banned = describeBannedTokensForSkill(skill);
1321
+ // Before the card on purpose: the desktop strips a repeated card by cutting
1322
+ // the text at "--- HOW TO PROMPT", and this line must survive that.
1323
+ const ownImage = IMAGE_MODELS.includes(input.model) ? input.model : null;
1324
+ const cheaper = ownImage ? cheaperImageOptions(byKey, perCredits, ownImage, input.aspectRatio) : null;
1325
+ const framing = input.aspectRatio ?? '16:9';
1326
+ const unpricedNote = cheaper?.unpriced.length
1327
+ ? ` Not on the price list at ${framing}: ${cheaper.unpriced.join(', ')}; estimate one directly to price it.`
1328
+ : '';
1329
+ const cheaperLine = cheaper?.shown.length
1330
+ ? `\nCheaper per image on the price list at ${framing}` +
1331
+ `${cheaper.cheaper > cheaper.shown.length ? ` (${cheaper.shown.length} of ${cheaper.cheaper})` : ''}: ` +
1332
+ cheaper.shown.map((o) => {
1333
+ const settings = [
1334
+ ...(o.resolution !== defaultImageResolutionFor(o.model) ? [o.resolution] : []),
1335
+ ...(o.quality && o.quality !== DEFAULT_GPT_QUALITY ? [`quality ${o.quality}`] : []),
1336
+ ];
1337
+ return `${o.model} ${fmtCredits(o.credits)}${settings.length ? ` (${settings.join(', ')})` : ''}`;
1338
+ }).join('; ') + `.${unpricedNote}`
1339
+ : unpricedNote ? `\n${unpricedNote.trim()}` : '';
1299
1340
  return ok({
1300
1341
  model: input.model,
1301
1342
  cost_key: key,
@@ -1303,9 +1344,11 @@ export const estimateGenerationCost = {
1303
1344
  cost_per_credits: perCredits,
1304
1345
  total_credits: totalCredits,
1305
1346
  requires_confirm: totalCredits > CONFIRM_CREDITS,
1347
+ ...(cheaper?.shown.length ? { cheaper_options: cheaper.shown } : {}),
1306
1348
  ...(card ? { craft_card: card, craft_card_skill: skill } : {}),
1307
1349
  ...(banned ? { banned_tokens: banned } : {}),
1308
1350
  }, `${input.model}${qty > 1 ? ` ×${qty}` : ''}: ${fmtCredits(totalCredits)} (${key}).` +
1351
+ cheaperLine +
1309
1352
  (card ? `\n\n--- HOW TO PROMPT ${input.model} ---\n${card}` : '') +
1310
1353
  (banned ? `\n\n${banned}` : ''));
1311
1354
  },
@@ -1622,7 +1665,7 @@ export const saveExternalImage = {
1622
1665
  };
1623
1666
  export const uploadReferenceImage = {
1624
1667
  id: 'slates_upload_reference_image',
1625
- 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. Default type is "image". dataUrl is image-only.',
1668
+ 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. 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.',
1626
1669
  input: z
1627
1670
  .object({
1628
1671
  projectId: z.string().uuid(),
@@ -1633,6 +1676,8 @@ export const uploadReferenceImage = {
1633
1676
  .optional()
1634
1677
  .describe('Asset kind for a filePath import — "image" (default), "video", or "audio". A dataUrl is always an image.'),
1635
1678
  folderId: folderIdField,
1679
+ label: assetLabelField.optional(),
1680
+ note: assetNoteField.optional(),
1636
1681
  })
1637
1682
  .refine((d) => !!d.filePath !== !!d.dataUrl, {
1638
1683
  message: 'Pass exactly one of filePath or dataUrl',
@@ -1642,12 +1687,17 @@ export const uploadReferenceImage = {
1642
1687
  // A desktop before the folder rule ignores folderId and files at the root.
1643
1688
  if (input.folderId !== undefined)
1644
1689
  await desktop.requireCapability('media-folder', 'choosing the folder a result lands in');
1690
+ // A desktop before the name ignores label and note and imports it as "Imported file".
1691
+ if (input.label !== undefined || input.note !== undefined)
1692
+ await desktop.requireCapability('asset-naming', 'naming an upload');
1693
+ const naming = { ...(input.label !== undefined ? { label: input.label } : {}), ...(input.note !== undefined ? { note: input.note } : {}) };
1645
1694
  if (input.filePath) {
1646
1695
  const r = await desktop.post('/agent/assets/upload', {
1647
1696
  projectId: input.projectId,
1648
1697
  filePath: input.filePath,
1649
1698
  type: input.type ?? 'image',
1650
1699
  ...folderBody(input.folderId),
1700
+ ...naming,
1651
1701
  });
1652
1702
  return ok(r);
1653
1703
  }
@@ -1658,10 +1708,29 @@ export const uploadReferenceImage = {
1658
1708
  projectId: input.projectId,
1659
1709
  dataUrl: input.dataUrl,
1660
1710
  ...folderBody(input.folderId),
1711
+ ...naming,
1661
1712
  });
1662
1713
  return ok(r);
1663
1714
  },
1664
1715
  };
1716
+ export const updateAsset = {
1717
+ id: 'slates_update_asset',
1718
+ 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.",
1719
+ input: z
1720
+ .object({ projectId: z.string().uuid(), assetId: z.string().min(1), label: assetLabelField.optional(), note: assetNoteField.optional() })
1721
+ .strict()
1722
+ .refine((d) => d.label !== undefined || d.note !== undefined, { message: 'Pass a label, a note or both' }),
1723
+ async run(input, ctx) {
1724
+ await ctx.desktop().requireCapability('asset-naming', 'naming an asset');
1725
+ const id = (await resolveAssetRefs(ctx, input.projectId, [input.assetId])).get(input.assetId).id;
1726
+ const { asset } = await ctx.desktop().post('/agent/assets/update', {
1727
+ assetId: id,
1728
+ ...(input.label !== undefined ? { label: input.label } : {}),
1729
+ ...(input.note !== undefined ? { note: input.note } : {}),
1730
+ });
1731
+ return ok({ asset: { ...compactAsset(asset), note: asset.prompt } });
1732
+ },
1733
+ };
1665
1734
  // ── Folders ─────────────────────────────────────────────────────
1666
1735
  export const listFolders = {
1667
1736
  id: 'slates_list_folders',
@@ -2182,6 +2251,49 @@ export function imageCostKey(model, resolution, quality = DEFAULT_GPT_QUALITY, a
2182
2251
  return `${model}-${gptKeyTier(quality)}-${resolution}${gptKeyAspect(aspectRatio)}`;
2183
2252
  return `nano-banana-2-${resolution}`;
2184
2253
  }
2254
+ /**
2255
+ * Image settings on the price list that cost less per image than `than`: each
2256
+ * seat's cheapest legal resolution (and GPT Image tier), ties going to the
2257
+ * seat's default resolution and then the higher tier. The quoted seat's own
2258
+ * cheaper setting is kept first, then the cheapest others, four in all.
2259
+ * Priced at `aspectRatio` (GPT Image prices square and 4:3 frames higher) and
2260
+ * read only from the registry the estimate already fetched: a seat whose key
2261
+ * at that framing is not on the list is reported unpriced, never fetched.
2262
+ *
2263
+ * WHY IT RIDES THE ESTIMATE: asked for "the cheapest and best version" on
2264
+ * 2026-10-07, the agent priced Nano Banana 2 alone (6 credits), called it the
2265
+ * cheapest option and generated; 1- and 2-credit seats were never compared.
2266
+ * Which seat is right stays the agent's call ("cheap" and "best" trade), so
2267
+ * nothing is routed here: the comparison is a fact in front of it instead.
2268
+ */
2269
+ function cheaperImageOptions(byKey, than, own, aspectRatio) {
2270
+ const all = [];
2271
+ const unpriced = [];
2272
+ for (const model of IMAGE_MODELS) {
2273
+ const qualities = isGptImageModel(model) ? [...GPT_QUALITY_TIERS] : [undefined];
2274
+ const fallback = defaultImageResolutionFor(model);
2275
+ let best = null;
2276
+ for (const resolution of MODEL_CAPABILITIES[model]?.imageResolutions ?? []) {
2277
+ for (const quality of qualities) {
2278
+ const credits = byKey.get(imageCostKey(model, resolution, quality, aspectRatio));
2279
+ if (credits == null)
2280
+ continue;
2281
+ const better = !best || credits < best.credits || (credits === best.credits && ((resolution === fallback && best.resolution !== fallback) ||
2282
+ (resolution === best.resolution && quality != null && best.quality != null &&
2283
+ GPT_QUALITY_TIERS.indexOf(quality) > GPT_QUALITY_TIERS.indexOf(best.quality))));
2284
+ if (better)
2285
+ best = { model, credits, resolution, ...(quality ? { quality } : {}) };
2286
+ }
2287
+ }
2288
+ if (!best)
2289
+ unpriced.push(model);
2290
+ else if (best.credits < than)
2291
+ all.push(best);
2292
+ }
2293
+ const sorted = all.sort((x, y) => x.credits - y.credits || x.model.localeCompare(y.model));
2294
+ const mine = sorted.filter((o) => o.model === own);
2295
+ return { shown: [...mine, ...sorted.filter((o) => o.model !== own)].slice(0, 4), cheaper: sorted.length, unpriced };
2296
+ }
2185
2297
  // The default image seat with a project to route through, READ from MODEL_FACTS
2186
2298
  // `tier`. Asserted at load so a default moved to a seat this op cannot send
2187
2299
  // fails the build instead of every omitted-model call.
@@ -2219,7 +2331,7 @@ export const generateImage = {
2219
2331
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image only. Default ${DEFAULT_GPT_QUALITY}; estimate the chosen tier before generation.`),
2220
2332
  backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe('GPT Image only. transparent = alpha channel. Free.'),
2221
2333
  aspectRatio: zEnum(IMAGE_ASPECT_RATIOS).optional().describe(`Pick from the use case: cinematic 16:9 · TikTok/Reels 9:16 · IG square 1:1 · ultra-wide 21:9. 1:1 costs most on GPT Image. Per model: ${describeAspectRatios(IMAGE_MODELS)}`),
2222
- count: z.number().int().min(1).max(MAX_IMAGE_VARIATIONS).optional().describe(`Up to ${MAX_IMAGE_VARIATIONS} with projectId; headless caps at ${HEADLESS_BATCH_CAP}.`),
2334
+ count: z.number().int().min(1).max(MAX_IMAGE_VARIATIONS).optional().describe(`Variations of this one prompt: every image gets the same prompt, so different subjects are separate calls. Up to ${MAX_IMAGE_VARIATIONS} with projectId; headless caps at ${HEADLESS_BATCH_CAP}.`),
2223
2335
  referenceImageUrls: z.array(z.string().url()).max(14).optional().describe('Headless (no projectId) nano-banana-2 only. With a projectId, upload via slates_upload_reference_image. Label every image role in the prompt.'),
2224
2336
  referenceAssetIds: z.array(z.string()).max(16).optional().describe("Project assets as references — UUIDs or badge codes (\"IMG-A8\"), resolved at call time. Requires projectId. Caps: GPT Image 16, nano-banana-2 14, FLUX/Seedream lower. Label every reference role in the prompt."),
2225
2337
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
@@ -2239,8 +2351,8 @@ export const generateImage = {
2239
2351
  // which is where a rewrite is still free.
2240
2352
  // Omitted model: the default seat when there is a project to route through,
2241
2353
  // nano-banana-2 without one, because it is the only headless seat. The
2242
- // desktop's pre-flight guard (`estimateOpCostCents`, src/main/studio-agent/
2243
- // ops.ts) picks the same seat: change both together.
2354
+ // desktop resolves the same seat for its cost and plan-model guards
2355
+ // (`imageModelFor`, slate src/main/studio-agent/guards.ts): change both together.
2244
2356
  const imageModel = input.model ?? (input.projectId ? DEFAULT_IMAGE_MODEL : 'nano-banana-2');
2245
2357
  const promptWarning = bannedTokenWarning(input.prompt, 'image', promptingSkillFor(imageModel));
2246
2358
  input = { ...input, resolution: input.resolution ?? defaultImageResolutionFor(imageModel) };
@@ -2305,7 +2417,7 @@ export const generateImage = {
2305
2417
  return ok({
2306
2418
  requires_clarification: true,
2307
2419
  missing: ['projectId'],
2308
- message: `count above ${HEADLESS_BATCH_CAP} needs a projectId. The headless path asks fal for one batch and nano-banana-2 caps a batch at ${HEADLESS_BATCH_CAP}; with a projectId the desktop fires them as separate generations and the limit is ${MAX_IMAGE_VARIATIONS}.`,
2420
+ message: `count above ${HEADLESS_BATCH_CAP} needs a projectId. The headless path asks for one batch and nano-banana-2 caps a batch at ${HEADLESS_BATCH_CAP}; with a projectId the desktop fires them as separate generations and the limit is ${MAX_IMAGE_VARIATIONS}.`,
2309
2421
  });
2310
2422
  }
2311
2423
  let refEcho = '';
@@ -2843,7 +2955,8 @@ export const extractGridCells = {
2843
2955
  * rather than a raw Zod error the agent has to guess its way out of.
2844
2956
  *
2845
2957
  * `promptMode` matters for any row that declares `duration.modeOverrides.ingredients`
2846
- * (retired Veo's reference-to-video endpoint was 8s only). Free reference images
2958
+ * (for an endpoint whose reference-to-video mode takes fewer durations than its
2959
+ * frame modes; no row sets one today). Free reference images
2847
2960
  * with no first/last frame IS ingredients mode.
2848
2961
  */
2849
2962
  function assertVideoCapabilities(input) {
@@ -3229,7 +3342,7 @@ export const generateVideo = {
3229
3342
  prompt: z.string().min(1).max(4000),
3230
3343
  // ROUTING doctrine only. Every capability number was stripped on 2026-08-16
3231
3344
  // and now lives in the aspectRatio / duration / videoResolution descriptions
3232
- // below, generated from MODEL_CAPABILITIES. "Veo = 16:9 only" and
3345
+ // below, generated from MODEL_CAPABILITIES. "16:9 only" for a model and
3233
3346
  // "seedance-2.5 480p/720p" were both stated here AND there, and the two
3234
3347
  // copies disagreed — and the second of those went stale on 2026-08-24 when
3235
3348
  // 2.5 gained 1080p, which is exactly the failure mode generating it fixes.
@@ -3280,9 +3393,9 @@ export const generateVideo = {
3280
3393
  sound: z.boolean().optional().describe('Kling (every tier) and LTX: sound on (default) or silent (false); Kling bills audio as its own key. Seedance, Omni Flash and H3 always generate audio.'),
3281
3394
  audioLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('Any Kling model with sound on — language for dialogue.'),
3282
3395
  generateMusic: z.boolean().optional().describe('Any Kling model with sound on — auto-generate background music.'),
3283
- seedanceFace: z.boolean().optional().describe('Seedance ONLY: a reference shows an AI CHARACTER\'s face. Faces are blocked on the default route, so this reroutes to a face-capable provider at ~45% more. A REAL person fails here with [REAL_FACE_DETECTED] — see seedanceRealFace.'),
3284
- seedanceRealFace: z.boolean().optional().describe('Seedance ONLY: a reference shows a REAL person. Real-person route, about 1.4x the AI-face price (about 2x faceless) — quote it first. REQUIRES realFaceConsent=true.'),
3285
- 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 route.'),
3396
+ seedanceFace: z.boolean().optional().describe('Seedance ONLY: a reference shows an AI CHARACTER\'s face. Without it, faces are blocked; with it the generation costs ~45% more. A REAL person fails here with [REAL_FACE_DETECTED] — see seedanceRealFace.'),
3397
+ seedanceRealFace: z.boolean().optional().describe('Seedance ONLY: a reference shows a REAL person. The real-person tier, about 1.4x the Face price (about 2x faceless) — quote it first. REQUIRES realFaceConsent=true.'),
3398
+ 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.'),
3286
3399
  negativePrompt: z.string().optional(),
3287
3400
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
3288
3401
  confirm: z.boolean().optional().describe('Set true after explicit user OK to bypass the confirm gate (which fires for almost every video gen since they\'re expensive).'),
@@ -3343,7 +3456,7 @@ export const generateVideo = {
3343
3456
  `Missing required field(s): ${missing.join(', ')}. ` +
3344
3457
  `Read the slates-cost-discipline + ${promptingSkillFor(input.model)} skills, ` +
3345
3458
  // Generated from MODEL_CAPABILITIES. The prose that stood here claimed
3346
- // "Veo locks to 16:9", "Kling/Seedance support 1:1 16:9 9:16 4:3 3:4
3459
+ // a model locked to 16:9, "Kling/Seedance support 1:1 16:9 9:16 4:3 3:4
3347
3460
  // 21:9" and "Kling 5-15s" — three wrong claims in one sentence.
3348
3461
  `or ask the user. ` +
3349
3462
  `Aspect ratio for ${input.model}: ${aspectRatiosFor(input.model, AGENT_ROUTE_PROVIDER).join(', ')}. ` +
@@ -3503,11 +3616,6 @@ export const generateVideo = {
3503
3616
  });
3504
3617
  }
3505
3618
  }
3506
- // ⛔ The hand-written Veo duration block that stood here is GONE. It read
3507
- // `![4,6,8].includes(duration)` plus "4K only at 8s" — and the registry
3508
- // forces 8s at 1080p TOO, so it happily quoted a 4s 1080p Veo the provider
3509
- // rejects. `assertVideoCapabilities` above covers both, plus the
3510
- // reference-to-video 8s rule it never knew about, from the SSOT.
3511
3619
  // Resolve every asset reference (UUID or badge code) against the
3512
3620
  // project AT CALL TIME. Codes the user just spoke ("a8 is the one")
3513
3621
  // resolve to whatever exists NOW — including assets created in the UI
@@ -3593,7 +3701,7 @@ export const generateVideo = {
3593
3701
  return ok({
3594
3702
  requires_clarification: true,
3595
3703
  missing: ['videoReferenceSeconds'],
3596
- message: 'A Seedance video reference bills on combined input+output seconds (on 2.5 AI-face, max(input, output) + output). Pass videoReferenceSeconds (the reference clip\'s duration, shown in slates_list_assets) so the pre-flight quote matches the bill.',
3704
+ message: 'A Seedance video reference bills on combined input+output seconds (on a 2.5 Face row, max(input, output) + output). Pass videoReferenceSeconds (the reference clip\'s duration, shown in slates_list_assets) so the pre-flight quote matches the bill.',
3597
3705
  });
3598
3706
  }
3599
3707
  const pluralRefCount = input.videoReferenceAssetIds?.length ?? 0;
@@ -3602,7 +3710,7 @@ export const generateVideo = {
3602
3710
  return ok({
3603
3711
  requires_clarification: true,
3604
3712
  missing: ['videoReferenceSecondsEach'],
3605
- message: `A Seedance video reference bills on combined input+output seconds (on 2.5 AI-face, max(input, output) + output). Pass videoReferenceSecondsEach with exactly ${pluralRefCount} duration${pluralRefCount === 1 ? '' : 's'}, in the same order as videoReferenceAssetIds (durations are shown in slates_list_assets), so the pre-flight quote matches the bill.`,
3713
+ message: `A Seedance video reference bills on combined input+output seconds (on a 2.5 Face row, max(input, output) + output). Pass videoReferenceSecondsEach with exactly ${pluralRefCount} duration${pluralRefCount === 1 ? '' : 's'}, in the same order as videoReferenceAssetIds (durations are shown in slates_list_assets), so the pre-flight quote matches the bill.`,
3606
3714
  });
3607
3715
  }
3608
3716
  const cloud = ctx.cloud();
@@ -4116,7 +4224,6 @@ export const generateLipSync = {
4116
4224
  ttsSpeed: z.number().min(0.5).max(2).optional().describe('TTS speech rate. Default 1.0. Range 0.5-2.0.'),
4117
4225
  audioFilePath: z.string().optional().describe('Required when audioMethod=upload. Absolute path to the audio file on the user\'s machine (mp3, wav, m4a).'),
4118
4226
  avatarModel: z.enum(['avatar-standard', 'avatar-pro']).optional().describe('Image-source only. avatar-standard (~14 credits/5s) for general use. avatar-pro (~29 credits/5s) for sharper face fidelity.'),
4119
- klingProvider: z.enum(['fal', 'kling']).optional().describe('Provider routing. Leave unset: all agent generations bill Slates credits (BYOK is retired).'),
4120
4227
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4121
4228
  confirm: z.boolean().optional().describe('Set true to bypass the confirm gate. Required for avatar-pro.'),
4122
4229
  }),
@@ -4187,7 +4294,6 @@ export const generateLipSync = {
4187
4294
  ttsSpeed: input.ttsSpeed,
4188
4295
  audioFilePath: input.audioFilePath,
4189
4296
  avatarModel: input.avatarModel,
4190
- klingProvider: input.klingProvider,
4191
4297
  // No estimatedCost: the desktop prices the media itself, in dollars.
4192
4298
  // This op's figure is CREDITS, which a 1.5.8 desktop recorded as dollars.
4193
4299
  background: input.background,
@@ -4236,7 +4342,6 @@ export const generateMotionTransfer = {
4236
4342
  motionModel: z.enum(['kling-mc-std', 'kling-mc-pro']).optional().describe('kling-mc-std general motion; kling-mc-pro cleaner anatomy — default. Quote both with slates_estimate_generation_cost.'),
4237
4343
  characterOrientation: z.enum(['video', 'image']).optional().describe('"video" = use the source video\'s framing. "image" = use the target image\'s framing. Default video.'),
4238
4344
  prompt: z.string().optional().describe('Optional refinement. Read slates-prompting-motion-transfer.'),
4239
- klingProvider: z.enum(['fal', 'kling']).optional().describe('Provider routing. "fal" (default) uses Slates credits.'),
4240
4345
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4241
4346
  confirm: z.boolean().optional().describe('Set true to bypass the confirm gate. Required — both tiers exceed.'),
4242
4347
  }),
@@ -4290,7 +4395,6 @@ export const generateMotionTransfer = {
4290
4395
  motionModel,
4291
4396
  characterOrientation: input.characterOrientation ?? 'video',
4292
4397
  prompt: input.prompt,
4293
- klingProvider: input.klingProvider,
4294
4398
  // No estimatedCost: the desktop prices the media itself, in dollars.
4295
4399
  // This op's figure is CREDITS, which a 1.5.8 desktop recorded as dollars.
4296
4400
  background: input.background,
@@ -4355,7 +4459,7 @@ export const editVideo = {
4355
4459
  styleAssetIds: z.array(z.string()).max(4).optional().describe('Style/appearance reference images (@ImageN). Max 4 combined with characterAssetIds. KLING MODELS ONLY — rejected on omni-flash-edit.'),
4356
4460
  keepAudio: z.boolean().optional().describe('Preserve the original audio track (default true; Kling models only — omni-flash-edit and seedance-2.5-edit output carry their own audio).'),
4357
4461
  videoResolution: zEnum(EDIT_VIDEO_RESOLUTIONS).optional().describe(`seedance-2.5-edit ONLY (default ${defaultVideoResolutionFor('seedance-2.5-edit')}). Ignored by the Kling and Omni Flash engines, whose output follows the source clip.`),
4358
- seedanceFace: z.boolean().optional().describe('seedance-2.5-edit ONLY: set true when a CHARACTER FACE is visible in the clip. Faceless edits run on BytePlus; faces are blocked there and must route to the relaxed provider, which costs about 40-50% more. A face edit submitted without this flag is rejected by the provider, not silently downgraded.'),
4462
+ seedanceFace: z.boolean().optional().describe('seedance-2.5-edit ONLY: set true when a CHARACTER FACE is visible in the clip. Without it a face is blocked outright; with it the edit costs about 40-50% more. A face edit submitted without this flag is rejected, not silently downgraded.'),
4359
4463
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
4360
4464
  confirm: z.boolean().optional().describe('Set true to bypass the cost confirm gate after the user OKs the spend.'),
4361
4465
  folderId: folderIdField,
@@ -5529,7 +5633,7 @@ function shotParamsShape(described) {
5529
5633
  imageQuantity: d(z.number().int().min(1).max(10).optional(), 'Image models only.'),
5530
5634
  negativePrompt: z.string().optional(),
5531
5635
  sound: d(z.boolean().optional(), 'Video models that co-generate audio.'),
5532
- seedanceFace: d(z.boolean().optional(), "Seedance only — a reference shows an AI character's FACE; reroutes to a face-capable provider, ~45% more."),
5636
+ seedanceFace: d(z.boolean().optional(), "Seedance only — a reference shows an AI character's FACE; without it faces are blocked, and it costs ~45% more."),
5533
5637
  audioDurationSeconds: d(z.number().int().min(1).max(120).optional(), 'Audio lane. On seed-audio the requested duration IS the bill.'),
5534
5638
  // The TTS voice — the same three fields slates_generate_audio takes, so a
5535
5639
  // Shot is the audio call, serialized. Exactly one of them, enforced at fire.
@@ -5870,11 +5974,54 @@ export const createShot = {
5870
5974
  ? ` Saved from ${input.fromAssetId}: its recorded recipe is the Shot's, and that result is its first take (unless another Shot already holds it).` +
5871
5975
  (r.unsavedPaths?.length ? ` ${r.unsavedPaths.length} recorded attachment(s) are not project assets and are not on the Shot.` : '')
5872
5976
  : '';
5977
+ // 🔑 THE COUNTS RIDE THIS RESULT TOO (2026-10-07). Writing a shot list is
5978
+ // when sameness is cheapest to fix, and the eval showed the agent wrote
5979
+ // three Shots and never called slates_list_shots in 3 of 4 trials. Same
5980
+ // reasoning as describeVarietyReport: what it must choose to fetch does not
5981
+ // reach it, so the board's running counts arrive with each new Shot. A
5982
+ // storyboardId placed the Shot only when no frameId or sceneId came with it
5983
+ // (the schema ignores it then), so only then does it name the board.
5984
+ const varietyNote = await boardSoFar(desktop, {
5985
+ projectId: input.projectId,
5986
+ shotId: r.shot?.id,
5987
+ storyboardId: input.storyboardId && !input.frameId && !input.sceneId ? input.storyboardId : undefined,
5988
+ });
5873
5989
  // The CODE is the address the user sees on the row — say it back so the
5874
5990
  // next call, and the next sentence to the user, can point at it.
5875
- return ok(r.shot, `${r.shot?.code || 'Shot'} — "${r.shot?.name || 'Untitled'}". ${refEcho}${fromNote}`.trim());
5991
+ return ok(r.shot, `${r.shot?.code || 'Shot'} — "${r.shot?.name || 'Untitled'}". ${refEcho}${fromNote}`.trim() + varietyNote);
5876
5992
  },
5877
5993
  };
5994
+ /**
5995
+ * The board's running counts after a Shot write, as the "Board so far" line, or ''.
5996
+ * Scoped to the Shot's OWN board: the listing falls back to every board in the
5997
+ * project when none is named, so an unscoped read would report other boards' cuts
5998
+ * as this one's. `storyboardId` is used only when it alone placed the Shot;
5999
+ * otherwise the board whose listing holds the Shot is found. No board found means
6000
+ * no counts, never project-wide ones. A failed read never fails the write.
6001
+ */
6002
+ async function boardSoFar(desktop, where) {
6003
+ try {
6004
+ let board = null;
6005
+ if (where.storyboardId) {
6006
+ board = await desktop.get('/agent/shots', { storyboardId: where.storyboardId });
6007
+ }
6008
+ else if (where.shotId) {
6009
+ const { storyboards } = await desktop.get('/agent/storyboards', { projectId: where.projectId });
6010
+ for (const sb of (storyboards ?? []).slice(0, 10)) {
6011
+ const listed = await desktop.get('/agent/shots', { storyboardId: sb.id });
6012
+ if ((listed.shots ?? []).some((s) => s.id === where.shotId)) {
6013
+ board = listed;
6014
+ break;
6015
+ }
6016
+ }
6017
+ }
6018
+ const described = describeVarietyReport(board?.variety);
6019
+ return described ? `\nBoard so far: ${described}` : '';
6020
+ }
6021
+ catch {
6022
+ return ''; // counts are a courtesy here; slates_list_shots is the full read
6023
+ }
6024
+ }
5878
6025
  export const updateShot = {
5879
6026
  id: 'slates_update_shot',
5880
6027
  description: 'Change part of a Shot, or attach/detach it from a board frame — anything you omit is left exactly as it was. ' +
@@ -5921,7 +6068,10 @@ export const updateShot = {
5921
6068
  posterAssetId: input.posterAssetId,
5922
6069
  },
5923
6070
  });
5924
- return ok(r.shot);
6071
+ // An edit to framing changes the counts, and the agent read them BEFORE it
6072
+ // (agent eval round 11: two runs fixed a repeat and never saw the new counts).
6073
+ const varietyNote = await boardSoFar(desktop, { projectId: input.projectId, shotId: r.shot?.id });
6074
+ return ok(r.shot, JSON.stringify(r.shot) + varietyNote);
5925
6075
  },
5926
6076
  };
5927
6077
  export const duplicateShot = {
@@ -6072,13 +6222,44 @@ export const listShots = {
6072
6222
  credits: q?.credits ?? null,
6073
6223
  };
6074
6224
  });
6225
+ // 🚨 THE ROWS ARE IN THE TEXT. The desktop Studio Agent reads only `text`
6226
+ // (`opResultToContent` in slate's studio-agent/ops.ts); `data` reaches MCP
6227
+ // clients as structured content and nobody else. This text used to be the
6228
+ // totals alone, so the in-app agent could see "3 shot(s), 444 credits" and
6229
+ // no Shot it could name: on 2026-10-07 it listed the same board six times,
6230
+ // tried `slates_get_shot("SHOT-1")`, and the eval trial timed out.
6231
+ // The variety report comes first and the rows stop at SHOT_ROWS_CHARS, so a
6232
+ // long board can never push the report past the desktop's 12,000-character
6233
+ // result cap (TOOL_RESULT_CHAR_CAP in slate's studio-agent/ops.ts).
6234
+ const rowText = [];
6235
+ let rowChars = 0;
6236
+ for (const s of shots) {
6237
+ const line = [
6238
+ [s.place, s.code].filter(Boolean).join(' ') || '—',
6239
+ JSON.stringify(s.name),
6240
+ s.model ?? 'no model',
6241
+ s.credits == null ? 'unpriced' : fmtCredits(s.credits),
6242
+ `id ${s.id}`,
6243
+ ].join(' · ');
6244
+ if (rowChars + line.length + 1 > SHOT_ROWS_CHARS)
6245
+ break;
6246
+ rowText.push(line);
6247
+ rowChars += line.length + 1;
6248
+ }
6249
+ const omitted = shots.length - rowText.length;
6250
+ const report = describeVarietyReport(r.variety);
6075
6251
  return ok({ shots, total_credits: total, unpriced, variety: r.variety }, `${shots.length} shot(s), at least ${fmtCredits(total)} to fire them all` +
6076
6252
  (unpriced > 0 ? ` (${unpriced} could not be priced — no model or no duration set).` : '.') +
6077
- (describeVarietyReport(r.variety) ? `
6078
-
6079
- ${describeVarietyReport(r.variety)}` : ''));
6253
+ (report ? `\n\n${report}` : '') +
6254
+ (rowText.length ? `\n\n${rowText.join('\n')}` : '') +
6255
+ (omitted > 0
6256
+ ? `\n…and ${omitted} more Shot(s) not listed here: pass storyboardId or frameId to list part of the board, or read one with slates_get_shot.`
6257
+ : ''));
6080
6258
  },
6081
6259
  };
6260
+ /** Room for Shot rows in the slates_list_shots text: about 65 rows, well inside the
6261
+ * desktop's 12,000-character result cap with the totals and the variety report. */
6262
+ const SHOT_ROWS_CHARS = 8000;
6082
6263
  export const getShot = {
6083
6264
  id: 'slates_get_shot',
6084
6265
  description: 'Read one Shot in full — the COMPOSED prompt the request will actually carry, its numbered references, anything it points at that no longer exists, its exact credit quote, and its place on the board (2C, as the window shows it). Audit your own work here before firing.',
@@ -6505,7 +6686,10 @@ export const generateFromShots = {
6505
6686
  quote.items
6506
6687
  .map((i) => `${i.code ?? i.name}: ${i.credits == null ? 'unpriced' : fmtCredits(i.credits)}${i.blocked ? ` — ${i.blocked}` : ''}`)
6507
6688
  .join('\n') +
6508
- '\nGet approval for these prices, then pass their fingerprint with confirm: true.');
6689
+ // Printed, not only in `data`: a client without elicitation reads this text
6690
+ // alone, and the confirm step refuses without the fingerprint (agent eval, round 9).
6691
+ `\nfingerprint: ${quote.fingerprint}` +
6692
+ '\nGet approval for these prices, then pass this fingerprint with confirm: true.');
6509
6693
  }
6510
6694
  return ok(await desktop.post('/agent/shots/batch-generate', {
6511
6695
  shotIds: quote.items.map((i) => i.shotId),
@@ -6843,8 +7027,13 @@ export const loadTools = {
6843
7027
  }
6844
7028
  const names = input.names ?? OPERATION_GROUPS[input.group];
6845
7029
  const unknown = names.filter((id) => !ALL_OPERATIONS.some((op) => op.id === id));
6846
- if (unknown.length)
6847
- throw new Error(`Unknown operation(s): ${unknown.join(', ')}`);
7030
+ if (unknown.length) {
7031
+ // Name the real tools a guessed name was reaching for. On 2026-10-07 the
7032
+ // agent tried slates_generate_shot, slates_run_shot and slates_get_shots
7033
+ // one call at a time before finding slates_generate_from_shots.
7034
+ const near = [...new Set(unknown.flatMap((id) => searchTools(ALL_OPERATIONS, id.replace(/^slates_/, '').replace(/_/g, ' ')).slice(0, 3).map(({ op }) => op.id)))];
7035
+ throw new Error(`Unknown operation(s): ${unknown.join(', ')}.${near.length ? ` Closest real tools: ${near.join(', ')}.` : ''}`);
7036
+ }
6848
7037
  const defs = toolDefinitions(ALL_OPERATIONS.filter((op) => names.includes(op.id)), { surface: 'mcp' });
6849
7038
  return ok({ group: input.group, tools: defs }, `Loaded tools (call by name):\n${JSON.stringify(defs)}`);
6850
7039
  },
@@ -7033,6 +7222,7 @@ export const ALL_OPERATIONS = [
7033
7222
  getAssetsBatch,
7034
7223
  getAssetVideoFrames,
7035
7224
  uploadReferenceImage,
7225
+ updateAsset,
7036
7226
  saveExternalImage,
7037
7227
  getChatGptStatus,
7038
7228
  connectChatGpt,
@@ -169,6 +169,7 @@ export const OPERATION_GROUPS = {
169
169
  // Rename, delete, reorder. The 63-op CRUD tail the review measured at 39.5 KB.
170
170
  admin: [
171
171
  'slates_update_project',
172
+ 'slates_update_asset',
172
173
  'slates_delete_project',
173
174
  'slates_delete_asset',
174
175
  'slates_update_character',