@slatesvideo/shared 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/events.d.ts +155 -0
- package/dist/analytics/events.js +430 -0
- package/dist/clients/cloud.d.ts +4 -0
- package/dist/clients/cloud.js +11 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -0
- package/dist/manual/content.d.ts +1 -1
- package/dist/manual/content.js +1 -1
- package/dist/operations/index.d.ts +14 -7
- package/dist/operations/index.js +379 -160
- package/dist/operations/surface.d.ts +6 -2
- package/dist/operations/surface.js +30 -5
- package/dist/prompts/agent-doctrine.d.ts +4 -4
- package/dist/prompts/agent-doctrine.js +63 -55
- package/dist/prompts/banned-tokens.d.ts +18 -0
- package/dist/prompts/banned-tokens.js +59 -4
- package/dist/prompts/guide-discovery.d.ts +23 -0
- package/dist/prompts/guide-discovery.js +39 -0
- package/dist/prompts/guide-retrieval.js +1 -1
- package/dist/prompts/model-capabilities.d.ts +8 -9
- package/dist/prompts/model-capabilities.js +13 -53
- package/dist/prompts/model-facts.d.ts +3 -3
- package/dist/prompts/model-facts.js +15 -26
- package/dist/prompts/partials.generated.js +6 -3
- package/dist/prompts/prompting-tips.d.ts +1 -1
- package/dist/prompts/prompting-tips.js +27 -69
- package/dist/prompts/search-terms.d.ts +3 -0
- package/dist/prompts/search-terms.js +24 -0
- package/dist/prompts/shot-grammar.d.ts +2 -2
- package/dist/prompts/shot-grammar.js +2 -2
- package/dist/skills/content.js +36 -37
- package/dist/skills/metadata.d.ts +7 -0
- package/dist/skills/metadata.js +29 -0
- package/dist/update-check.js +1 -1
- package/exports/slates-chatgpt-images/generated/SKILL.md +7 -1
- package/exports/slates-chatgpt-images/generated/slates-chatgpt-images.skill +0 -0
- package/exports/slates-prompt-builder/generated/SKILL.md +28 -16
- package/exports/slates-prompt-builder/generated/reference-character.md +12 -13
- package/exports/slates-prompt-builder/generated/reference-content-policy.md +2 -2
- package/exports/slates-prompt-builder/generated/reference-gpt-image-2-5.md +191 -0
- package/exports/slates-prompt-builder/generated/reference-kling.md +32 -11
- package/exports/slates-prompt-builder/generated/reference-nano-banana.md +24 -6
- package/exports/slates-prompt-builder/generated/reference-omni-flash.md +65 -0
- package/exports/slates-prompt-builder/generated/reference-seedance-2-5.md +362 -0
- package/exports/slates-prompt-builder/generated/reference-seedance.md +34 -4
- package/exports/slates-prompt-builder/generated/slates-prompt-builder-manifest.json +77 -23
- package/exports/slates-prompt-builder/generated/slates-prompt-builder.skill +0 -0
- package/package.json +6 -2
- package/skills/_partials/blender-action-curves.md +24 -0
- package/skills/_partials/iteration-diagnosis.md +5 -0
- package/skills/_partials/model-routing.md +35 -0
- package/skills/_partials/seedance-25-timestamps.md +2 -2
- package/skills/_partials/still-gate.md +2 -2
- package/skills/_partials/thresholds.md +1 -1
- package/skills/slates-blocking-to-prompt.md +15 -13
- package/skills/slates-camera-language.md +45 -7
- package/skills/slates-character-identity.md +8 -6
- package/skills/slates-chatgpt-images.md +7 -1
- package/skills/slates-cinematic-look.md +1 -1
- package/skills/slates-content-policy.md +4 -6
- package/skills/slates-cost-discipline.md +18 -12
- package/skills/slates-dialogue-blocking.md +6 -6
- package/skills/slates-direct-response-ad.md +1 -1
- package/skills/slates-edit-and-iterate.md +12 -4
- package/skills/slates-model-selection.md +82 -90
- package/skills/slates-one-prompt-film.md +1 -1
- package/skills/slates-previs-blocking.md +44 -13
- package/skills/slates-project-organization.md +2 -2
- package/skills/slates-prompting-elevenlabs.md +4 -4
- package/skills/slates-prompting-flux-2-max.md +2 -3
- package/skills/slates-prompting-gpt-image-2-5.md +2 -2
- package/skills/slates-prompting-inworld-tts.md +174 -174
- package/skills/slates-prompting-kling-v3.md +11 -9
- package/skills/slates-prompting-lip-sync.md +15 -15
- package/skills/slates-prompting-ltx-2-5.md +5 -6
- package/skills/slates-prompting-minimax-h3.md +11 -11
- package/skills/slates-prompting-motion-transfer.md +8 -8
- package/skills/slates-prompting-nano-banana-2.md +8 -4
- package/skills/slates-prompting-omni-flash.md +9 -9
- package/skills/slates-prompting-seed-audio.md +24 -4
- package/skills/slates-prompting-seedance-2-5.md +40 -30
- package/skills/slates-prompting-seedance.md +4 -4
- package/skills/slates-prompting-seedream-5-lite.md +6 -6
- package/skills/slates-restyle-from-blocking.md +2 -2
- package/skills/slates-script-craft.md +1 -1
- package/skills/slates-shot-variety.md +1 -1
- package/skills/slates-storyboard-from-script.md +1 -1
- package/skills/slates-style-prompting.md +56 -54
- package/skills/slates-ugc-influencer-ad.md +1 -1
- package/skills/slates-vision-feedback-loop.md +20 -12
- package/skills/slates-prompting-veo-3.md +0 -224
package/dist/operations/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MAX_IMAGE_VARIATIONS } from '../prompts/generation-policy.js';
|
|
2
|
+
import { discoverGuides, guideCatalog } from '../prompts/guide-discovery.js';
|
|
2
3
|
import { retrieveGuide } from '../prompts/guide-retrieval.js';
|
|
3
4
|
import { MINIMAX_MAX_REFERENCE, minimaxMaxReferenceTokens, MODEL_CAPABILITIES, GPT_QUALITY_TIERS, DEFAULT_GPT_QUALITY, GPT_BACKGROUNDS } from '../prompts/model-capabilities.js';
|
|
4
5
|
// Operations layer — the ONE place every Slates agent tool is defined.
|
|
@@ -13,7 +14,7 @@ import { MINIMAX_MAX_REFERENCE, minimaxMaxReferenceTokens, MODEL_CAPABILITIES, G
|
|
|
13
14
|
// - chooses its transport (cloud vs desktop) internally — callers
|
|
14
15
|
// don't need to know which side a given op talks to
|
|
15
16
|
import { z } from 'zod';
|
|
16
|
-
import { SlatesCloudClient } from '../clients/cloud.js';
|
|
17
|
+
import { SlatesCloudClient, SlatesCloudHttpError } from '../clients/cloud.js';
|
|
17
18
|
import { SlatesDesktopClient } from '../clients/desktop.js';
|
|
18
19
|
import { BlenderBridgeClient, BLENDER_SETUP_HINT, RENDER_TIMEOUT_MS } from '../clients/blender.js';
|
|
19
20
|
import { SKILLS } from '../skills/content.js';
|
|
@@ -35,10 +36,11 @@ toolModelFor, CHATGPT_FRAMING_RATIOS, } from '../prompts/model-facts.js';
|
|
|
35
36
|
// never re-state one of those constraints as a literal enum or a sentence
|
|
36
37
|
// again. It did until 2026-08-16, and every axis had drifted: an invented
|
|
37
38
|
// `9:21`, "Kling/Seedance support all" (Seedance takes 6 of 11 and has no
|
|
38
|
-
// `4:5`),
|
|
39
|
-
// `videoResolution` line that never mentioned Kling, and 4s
|
|
40
|
-
//
|
|
41
|
-
// queued, credits reserved,
|
|
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.
|
|
42
44
|
import { AGENT_ROUTE_PROVIDER, defaultImageResolutionFor, aspectRatioUnion, videoResolutionUnion, durationBounds, aspectRatiosFor, getModelCapability, defaultVideoResolutionFor, checkAspectRatio, checkVideoResolution, checkDuration, describeAspectRatios, describeVideoResolutions, describeDurations, describeReferenceImageCaps, } from '../prompts/model-capabilities.js';
|
|
43
45
|
// Per-model warnings are extracted from skill @banned blocks. They ride the
|
|
44
46
|
// selected model's estimate and submitted-prompt result, never another model's schema.
|
|
@@ -59,10 +61,12 @@ import { SHOT_SIZE_BUCKETS, CAMERA_MOVE_BUCKETS, SPEECH_RATE, } from '../prompts
|
|
|
59
61
|
// Annotations, tiers and the ONE schema renderer. Declared next door so this
|
|
60
62
|
// module never hand-sets a hint or a tier per op: `annotate()` derives all four
|
|
61
63
|
// from the id and the lockstep check re-derives them from the transport verbs.
|
|
62
|
-
import { annotate, groupFor, tierFor, toolDefinitions, GROUP_SUMMARY, OPERATION_GROUPS, } from './surface.js';
|
|
64
|
+
import { annotate, groupFor, tierFor, toolDefinitions, searchTools, GROUP_SUMMARY, OPERATION_GROUPS, } from './surface.js';
|
|
65
|
+
// One factory for every default context, so per-connection caches can key on it.
|
|
66
|
+
const defaultCloud = () => new SlatesCloudClient();
|
|
63
67
|
export function defaultContext() {
|
|
64
68
|
return {
|
|
65
|
-
cloud:
|
|
69
|
+
cloud: defaultCloud,
|
|
66
70
|
desktop: () => new SlatesDesktopClient(),
|
|
67
71
|
};
|
|
68
72
|
}
|
|
@@ -127,7 +131,10 @@ export const DEVIATION_FACTOR = 1.2;
|
|
|
127
131
|
* to find three wordings. Byte-stable (a template over a literal), so the
|
|
128
132
|
* desktop's prompt-cached prefix is unaffected.
|
|
129
133
|
*/
|
|
130
|
-
|
|
134
|
+
// The consent half rides every generation tool because a host may drop the
|
|
135
|
+
// server instructions: Codex CLI 0.159.1 passed none to the model (probes
|
|
136
|
+
// 2026-09-30 and 2026-10-02), so a small spend had no approval rule in view.
|
|
137
|
+
const CONFIRM_GATE_SENTENCE = `Show the user the estimate and wait for their OK before any generation, however small. Cost above ${CONFIRM_CREDITS} credits (and, on image and video, any attached reference) also returns requires_confirm — pass confirm=true only to relay that OK.`;
|
|
131
138
|
// Declared HERE, above every op, because `slates_estimate_generation_cost`
|
|
132
139
|
// renders them into its `duration` description at MODULE LOAD — a const
|
|
133
140
|
// declared below the first schema that reads it is a temporal-dead-zone
|
|
@@ -222,6 +229,23 @@ const BACKGROUND_DESCRIBE = 'Return generationId(s) now instead of blocking; pol
|
|
|
222
229
|
// folderId to the folder chosen in the window, so every op and the Studio Agent get it at once.
|
|
223
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.";
|
|
224
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.");
|
|
225
249
|
/** The `folderId` part of a generate or upload body: present only when the caller named one (null is the root). */
|
|
226
250
|
const folderBody = (folderId) => (folderId === undefined ? {} : { folderId });
|
|
227
251
|
// ── Vision QC pointers (the "quality-check with vision" rule, made structural) ──
|
|
@@ -236,12 +260,16 @@ const folderBody = (folderId) => (folderId === undefined ? {} : { folderId });
|
|
|
236
260
|
// it to re-fetch something already in front of it burns a turn for nothing:
|
|
237
261
|
// a blocking image generation returns the pixels inline, a video generation
|
|
238
262
|
// returns none, and a background submission has no asset yet.
|
|
239
|
-
|
|
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. ' +
|
|
240
268
|
'Any claim about how it LOOKS must come from pixels you actually received (slates-vision-feedback-loop).';
|
|
241
269
|
const VIDEO_REVIEW_POINTER = 'You have NOT seen this clip: call slates_get_asset_video_frames on the asset id above before ' +
|
|
242
|
-
'describing
|
|
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.';
|
|
243
271
|
const BACKGROUND_REVIEW_POINTER = 'When it completes, look at it before you describe it — slates_get_asset_image for images, ' +
|
|
244
|
-
'slates_get_asset_video_frames for video. For audio, audition the saved file;
|
|
272
|
+
'slates_get_asset_video_frames for video. For audio, audition the saved file only through a host that can receive/listen to audio; otherwise report it unreviewed. Metadata does not establish voice similarity or delivery quality.';
|
|
245
273
|
// The image saved, but reading it back off disk failed (best-effort fetch). The
|
|
246
274
|
// agent has an asset and NO pixels, which is the one state where a quality
|
|
247
275
|
// claim would be pure invention — so this branch has to say so rather than
|
|
@@ -437,6 +465,8 @@ const describeLooking = (v) => {
|
|
|
437
465
|
parts.push(`Folder ${v.media.folderId} is chosen: new pictures land in it.`);
|
|
438
466
|
if (v.viewer?.assetId)
|
|
439
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).`);
|
|
440
470
|
if (v.compare?.open)
|
|
441
471
|
parts.push(`Compare is open on ${v.compare.assetIds.length} items.`);
|
|
442
472
|
if (v.animatic?.open)
|
|
@@ -479,7 +509,7 @@ const describeView = (v) => {
|
|
|
479
509
|
*/
|
|
480
510
|
export const getView = {
|
|
481
511
|
id: 'slates_get_view',
|
|
482
|
-
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.",
|
|
483
513
|
input: z.object({}).strict(),
|
|
484
514
|
async run(_input, ctx) {
|
|
485
515
|
await ctx.desktop().requireCapability('view', 'the window layout');
|
|
@@ -507,7 +537,7 @@ export const getView = {
|
|
|
507
537
|
*/
|
|
508
538
|
export const setView = {
|
|
509
539
|
id: 'slates_set_view',
|
|
510
|
-
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.",
|
|
511
541
|
input: z
|
|
512
542
|
.object({
|
|
513
543
|
projectId: z.string().nullable().optional().describe('Open this project, or null for Home. Applied alone.'),
|
|
@@ -583,7 +613,7 @@ export const setView = {
|
|
|
583
613
|
.strict()
|
|
584
614
|
.optional(),
|
|
585
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."),
|
|
586
|
-
viewer: z.object({ assetId: z.string().nullable() }).strict().optional().describe(
|
|
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."),
|
|
587
617
|
compare: z
|
|
588
618
|
.object({ open: z.boolean().optional(), assetIds: z.array(z.string()).max(4).optional().describe('The compare set, two to four items.') })
|
|
589
619
|
.strict()
|
|
@@ -959,8 +989,6 @@ export const VIDEO_MODELS = [
|
|
|
959
989
|
'kling-v3.0-std',
|
|
960
990
|
'kling-v3.0-pro',
|
|
961
991
|
'kling-v3.0-omni',
|
|
962
|
-
'veo-3.1-fast',
|
|
963
|
-
'veo-3.1-standard',
|
|
964
992
|
'seedance-2',
|
|
965
993
|
// Seedance 2.5 is the DEFAULT video model (Eric, 2026-09-13): 30s takes, 30
|
|
966
994
|
// image references, audio-only references, up to 1080p (2026-08-24). 2.0 stays
|
|
@@ -985,8 +1013,8 @@ export const VIDEO_MODELS = [
|
|
|
985
1013
|
'minimax-h3-max',
|
|
986
1014
|
'minimax-h3-max-turbo',
|
|
987
1015
|
// LTX-2.5, two seats in one family (2026-08-29). Base is the VOLUME seat —
|
|
988
|
-
// cheapest
|
|
989
|
-
// only row reaching 1440p, and
|
|
1016
|
+
// cheapest 1080p second with sound included, free native audio at every tier,
|
|
1017
|
+
// the only row reaching 1440p, and clips up to 20s.
|
|
990
1018
|
// Pro is the fidelity seat and is NOT a superset: shorter ladder (no
|
|
991
1019
|
// 1440p/4K), shorter clips (6/8/10 only) and ~1/3 dearer.
|
|
992
1020
|
//
|
|
@@ -1108,7 +1136,7 @@ function editClipBounds(model) {
|
|
|
1108
1136
|
const EDIT_VIDEO_RESOLUTIONS = videoResolutionUnion(['seedance-2.5-edit']);
|
|
1109
1137
|
export const estimateGenerationCost = {
|
|
1110
1138
|
id: 'slates_estimate_generation_cost',
|
|
1111
|
-
description: 'Quote credits before any generate_* op. Accepts the
|
|
1139
|
+
description: 'Quote credits before any generate_* op. Accepts the generation model ids and parameters (edit seats other than Kling, lip-sync and motion-transfer engines need an exact registry cost key), or an exact registry cost key. Pairs with the confirm gate.',
|
|
1112
1140
|
input: z.object({
|
|
1113
1141
|
model: z.string().describe('Base model id as passed to the generate op (e.g. "seedance-2", "kling-v3.0-std", "nano-banana-2") or an exact registry cost key ("nano-banana-2-2k", "seedance-2-1080p-8s")'),
|
|
1114
1142
|
quantity: z.number().int().min(1).max(10).optional().describe('Number of generations (default 1)'),
|
|
@@ -1126,8 +1154,8 @@ export const estimateGenerationCost = {
|
|
|
1126
1154
|
videoResolution: zEnum(VIDEO_RESOLUTIONS).optional().describe('Video only. Omitted, each model quotes at its own default. Per-model ladders: see slates_generate_video\'s videoResolution.'),
|
|
1127
1155
|
resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('Image only. Omit for the model default; pass the same value to generation.'),
|
|
1128
1156
|
quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image tier; default ${DEFAULT_GPT_QUALITY}.`),
|
|
1129
|
-
aspectRatio: z.string().optional().describe('Image only
|
|
1130
|
-
sound: z.boolean().optional().describe('
|
|
1157
|
+
aspectRatio: z.string().optional().describe('GPT Image only: 1:1, 4:3 and 3:4 cost more than 16:9.'),
|
|
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.'),
|
|
1131
1159
|
seedanceFace: z.boolean().optional().describe('Seedance AI-face route (pricier key).'),
|
|
1132
1160
|
seedanceRealFace: z.boolean().optional().describe('Seedance consented real-face route (premium key).'),
|
|
1133
1161
|
videoRefSeconds: z.number().nonnegative().optional().describe('Combined reference-video seconds, measured from the clips.'),
|
|
@@ -1290,6 +1318,25 @@ export const estimateGenerationCost = {
|
|
|
1290
1318
|
const skill = promptingSkillFor(input.model);
|
|
1291
1319
|
const card = describeCraftCard(skill);
|
|
1292
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()}` : '';
|
|
1293
1340
|
return ok({
|
|
1294
1341
|
model: input.model,
|
|
1295
1342
|
cost_key: key,
|
|
@@ -1297,9 +1344,11 @@ export const estimateGenerationCost = {
|
|
|
1297
1344
|
cost_per_credits: perCredits,
|
|
1298
1345
|
total_credits: totalCredits,
|
|
1299
1346
|
requires_confirm: totalCredits > CONFIRM_CREDITS,
|
|
1347
|
+
...(cheaper?.shown.length ? { cheaper_options: cheaper.shown } : {}),
|
|
1300
1348
|
...(card ? { craft_card: card, craft_card_skill: skill } : {}),
|
|
1301
1349
|
...(banned ? { banned_tokens: banned } : {}),
|
|
1302
1350
|
}, `${input.model}${qty > 1 ? ` ×${qty}` : ''}: ${fmtCredits(totalCredits)} (${key}).` +
|
|
1351
|
+
cheaperLine +
|
|
1303
1352
|
(card ? `\n\n--- HOW TO PROMPT ${input.model} ---\n${card}` : '') +
|
|
1304
1353
|
(banned ? `\n\n${banned}` : ''));
|
|
1305
1354
|
},
|
|
@@ -1514,7 +1563,7 @@ export const getAssetsBatch = {
|
|
|
1514
1563
|
};
|
|
1515
1564
|
export const getAssetVideoFrames = {
|
|
1516
1565
|
id: 'slates_get_asset_video_frames',
|
|
1517
|
-
description: 'Extract
|
|
1566
|
+
description: 'Extract evenly-spaced sampled still frames from a video asset and return them inline as JPEGs. Inspect visible appearance, composition and identity before revising a prompt. Stills do not verify continuous motion, timing, lip sync or sound; actual playback through a capable host is needed for those claims. Default 3 samples; count can request more. The response includes the asset code and label; use them when discussing the clip.',
|
|
1518
1567
|
input: z.object({
|
|
1519
1568
|
id: z.string().uuid(),
|
|
1520
1569
|
count: z.number().int().min(1).max(8).optional().describe('Number of frames to extract. Default 3.'),
|
|
@@ -1616,7 +1665,7 @@ export const saveExternalImage = {
|
|
|
1616
1665
|
};
|
|
1617
1666
|
export const uploadReferenceImage = {
|
|
1618
1667
|
id: 'slates_upload_reference_image',
|
|
1619
|
-
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.',
|
|
1620
1669
|
input: z
|
|
1621
1670
|
.object({
|
|
1622
1671
|
projectId: z.string().uuid(),
|
|
@@ -1627,6 +1676,8 @@ export const uploadReferenceImage = {
|
|
|
1627
1676
|
.optional()
|
|
1628
1677
|
.describe('Asset kind for a filePath import — "image" (default), "video", or "audio". A dataUrl is always an image.'),
|
|
1629
1678
|
folderId: folderIdField,
|
|
1679
|
+
label: assetLabelField.optional(),
|
|
1680
|
+
note: assetNoteField.optional(),
|
|
1630
1681
|
})
|
|
1631
1682
|
.refine((d) => !!d.filePath !== !!d.dataUrl, {
|
|
1632
1683
|
message: 'Pass exactly one of filePath or dataUrl',
|
|
@@ -1636,12 +1687,17 @@ export const uploadReferenceImage = {
|
|
|
1636
1687
|
// A desktop before the folder rule ignores folderId and files at the root.
|
|
1637
1688
|
if (input.folderId !== undefined)
|
|
1638
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 } : {}) };
|
|
1639
1694
|
if (input.filePath) {
|
|
1640
1695
|
const r = await desktop.post('/agent/assets/upload', {
|
|
1641
1696
|
projectId: input.projectId,
|
|
1642
1697
|
filePath: input.filePath,
|
|
1643
1698
|
type: input.type ?? 'image',
|
|
1644
1699
|
...folderBody(input.folderId),
|
|
1700
|
+
...naming,
|
|
1645
1701
|
});
|
|
1646
1702
|
return ok(r);
|
|
1647
1703
|
}
|
|
@@ -1652,10 +1708,29 @@ export const uploadReferenceImage = {
|
|
|
1652
1708
|
projectId: input.projectId,
|
|
1653
1709
|
dataUrl: input.dataUrl,
|
|
1654
1710
|
...folderBody(input.folderId),
|
|
1711
|
+
...naming,
|
|
1655
1712
|
});
|
|
1656
1713
|
return ok(r);
|
|
1657
1714
|
},
|
|
1658
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
|
+
};
|
|
1659
1734
|
// ── Folders ─────────────────────────────────────────────────────
|
|
1660
1735
|
export const listFolders = {
|
|
1661
1736
|
id: 'slates_list_folders',
|
|
@@ -2176,6 +2251,49 @@ export function imageCostKey(model, resolution, quality = DEFAULT_GPT_QUALITY, a
|
|
|
2176
2251
|
return `${model}-${gptKeyTier(quality)}-${resolution}${gptKeyAspect(aspectRatio)}`;
|
|
2177
2252
|
return `nano-banana-2-${resolution}`;
|
|
2178
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
|
+
}
|
|
2179
2297
|
// The default image seat with a project to route through, READ from MODEL_FACTS
|
|
2180
2298
|
// `tier`. Asserted at load so a default moved to a seat this op cannot send
|
|
2181
2299
|
// fails the build instead of every omitted-model call.
|
|
@@ -2190,19 +2308,21 @@ const LEGACY_DESKTOP_IMAGE_BATCH = 4;
|
|
|
2190
2308
|
export const generateImage = {
|
|
2191
2309
|
id: 'slates_generate_image',
|
|
2192
2310
|
billable: true,
|
|
2193
|
-
description:
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
`${describeRouting('image')}\n` +
|
|
2198
|
-
'Full table: the slates-model-selection skill. ' +
|
|
2199
|
-
'Pass projectId to save into a Slates project (asset appears live in the desktop UI). All models except nano-banana-2 REQUIRE projectId (no headless path). REQUIRED before calling: read the slates-cost-discipline skill (and the model\'s slates-prompting-* skill). You MUST pass aspectRatio and resolution explicitly (the server returns requires_clarification when missing — defaults waste credits). ' +
|
|
2311
|
+
description:
|
|
2312
|
+
// Rules first: Claude Code keeps only the first 2,048 characters of a tool
|
|
2313
|
+
// description, and the generated roster below runs past that cut.
|
|
2314
|
+
'Generate an image via Slates credits. Pass projectId to save into a Slates project (asset appears live in the desktop UI). All models except nano-banana-2 REQUIRE projectId (no headless path). You MUST pass aspectRatio (the server returns requires_clarification when missing); resolution defaults to the model\'s own. ' +
|
|
2200
2315
|
CONFIRM_GATE_SENTENCE +
|
|
2201
|
-
' MCP/CLI generation always charges credits.
|
|
2316
|
+
' MCP/CLI generation always charges credits. The estimate returns the model\'s prompting card; load its slates-prompting-* guide with slates_get_prompting_guide for anything the card leaves out. ' +
|
|
2202
2317
|
// GENERATED from the skill file's own never-use list -- the one piece of
|
|
2203
2318
|
// prompting doctrine that is ALWAYS in context, because the agent has
|
|
2204
2319
|
// demonstrably skipped the call that would have taught it.
|
|
2205
|
-
describeBannedTokens('image')
|
|
2320
|
+
describeBannedTokens('image') +
|
|
2321
|
+
// GENERATED from MODEL_FACTS — the hand-typed model list that stood here
|
|
2322
|
+
// was a third copy of the routing doctrine, and it had already gone stale
|
|
2323
|
+
// (it still described nano-banana-2-lite by a capability the param owns).
|
|
2324
|
+
`\n${describeRouting('image')}\n` +
|
|
2325
|
+
'Full table: the slates-model-selection skill.',
|
|
2206
2326
|
input: z.object({
|
|
2207
2327
|
prompt: z.string().min(1).max(4000),
|
|
2208
2328
|
model: zEnum(IMAGE_MODELS).optional().describe(`Image model. Omitted: ${DEFAULT_IMAGE_MODEL} with projectId, nano-banana-2 (the only headless seat) without. Routing: slates-model-selection skill.`),
|
|
@@ -2211,7 +2331,7 @@ export const generateImage = {
|
|
|
2211
2331
|
quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image only. Default ${DEFAULT_GPT_QUALITY}; estimate the chosen tier before generation.`),
|
|
2212
2332
|
backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe('GPT Image only. transparent = alpha channel. Free.'),
|
|
2213
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)}`),
|
|
2214
|
-
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}.`),
|
|
2215
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.'),
|
|
2216
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."),
|
|
2217
2337
|
background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
|
|
@@ -2231,8 +2351,8 @@ export const generateImage = {
|
|
|
2231
2351
|
// which is where a rewrite is still free.
|
|
2232
2352
|
// Omitted model: the default seat when there is a project to route through,
|
|
2233
2353
|
// nano-banana-2 without one, because it is the only headless seat. The
|
|
2234
|
-
// desktop
|
|
2235
|
-
//
|
|
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.
|
|
2236
2356
|
const imageModel = input.model ?? (input.projectId ? DEFAULT_IMAGE_MODEL : 'nano-banana-2');
|
|
2237
2357
|
const promptWarning = bannedTokenWarning(input.prompt, 'image', promptingSkillFor(imageModel));
|
|
2238
2358
|
input = { ...input, resolution: input.resolution ?? defaultImageResolutionFor(imageModel) };
|
|
@@ -2477,7 +2597,7 @@ export const generateImage = {
|
|
|
2477
2597
|
};
|
|
2478
2598
|
}
|
|
2479
2599
|
// /proxy/generate kicks off a credit-aware job and returns a jobId
|
|
2480
|
-
// for fal
|
|
2600
|
+
// for fal (async providers). We poll /proxy/jobs/{jobId} until
|
|
2481
2601
|
// the status is `completed` or `failed`, then fetch each image URL
|
|
2482
2602
|
// and inline as base64 so the calling LLM sees the pixels.
|
|
2483
2603
|
// The fal endpoint differs by mode: bare model id for text-to-image,
|
|
@@ -2590,7 +2710,7 @@ const LEGACY_EDIT_REFERENCE_MODELS = ['nano-banana-2', 'nano-banana-2-lite', 'na
|
|
|
2590
2710
|
export const editImage = {
|
|
2591
2711
|
id: 'slates_edit_image',
|
|
2592
2712
|
billable: true,
|
|
2593
|
-
description: 'Surgically edit an image asset with a text instruction (e.g. \'make the jacket red\') instead of regenerating from scratch — use when ~90% of the image is already right. The result is a NEW asset (prompt prefixed \'[Edit]\'); the source is untouched. Default model ' + toolModelFor('image-edit') + ' (the image-edit tool seat, the model the app\'s Edit box opens on). Every model also takes referenceAssetIds, up to its reference cap less one: the source is image 1 of the request.
|
|
2713
|
+
description: 'Surgically edit an image asset with a text instruction (e.g. \'make the jacket red\') instead of regenerating from scratch — use when ~90% of the image is already right. The result is a NEW asset (prompt prefixed \'[Edit]\'); the source is untouched. Default model ' + toolModelFor('image-edit') + ' (the image-edit tool seat, the model the app\'s Edit box opens on). Every model also takes referenceAssetIds, up to its reference cap less one: the source is image 1 of the request. Use slates-edit-and-iterate for missing edit craft; reuse current guidance already in context.',
|
|
2594
2714
|
input: z.object({
|
|
2595
2715
|
projectId: z.string().uuid(),
|
|
2596
2716
|
sourceAssetId: z.string().uuid().describe('Image asset to edit. Must exist in the project.'),
|
|
@@ -2834,10 +2954,10 @@ export const extractGridCells = {
|
|
|
2834
2954
|
* same teaching `requires_clarification` shape as every other gate in this op,
|
|
2835
2955
|
* rather than a raw Zod error the agent has to guess its way out of.
|
|
2836
2956
|
*
|
|
2837
|
-
* `promptMode` matters
|
|
2838
|
-
*
|
|
2839
|
-
*
|
|
2840
|
-
*
|
|
2957
|
+
* `promptMode` matters for any row that declares `duration.modeOverrides.ingredients`
|
|
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
|
|
2960
|
+
* with no first/last frame IS ingredients mode.
|
|
2841
2961
|
*/
|
|
2842
2962
|
function assertVideoCapabilities(input) {
|
|
2843
2963
|
const freeRefs = (input.ingredientAssetIds?.length ?? 0) +
|
|
@@ -2866,7 +2986,6 @@ function assertVideoCapabilities(input) {
|
|
|
2866
2986
|
// shape (verified against /api/agent/models):
|
|
2867
2987
|
// Kling: kling-v3-{standard|pro|omni}-{N}s — note the user-facing
|
|
2868
2988
|
// model id `kling-v3.0-std` maps to registry key `kling-v3-standard`.
|
|
2869
|
-
// Veo: veo-3.1-{fast|standard}[-4k]-{N}s[-audio]
|
|
2870
2989
|
// Seedance: seedance-2-{res}-{N}s (BytePlus ModelArk, sole provider). The
|
|
2871
2990
|
// cost key encodes resolution (480p/720p/1080p/4k) — price scales with
|
|
2872
2991
|
// resolution, so the key MUST carry it or the pre-flight quote is wrong.
|
|
@@ -2932,29 +3051,21 @@ export function videoCostKey(input) {
|
|
|
2932
3051
|
}
|
|
2933
3052
|
return `${input.model}${face}-${res}-${input.duration}s`;
|
|
2934
3053
|
}
|
|
2935
|
-
if (input.model.startsWith('veo')) {
|
|
2936
|
-
const is4k = input.videoResolution === '4k';
|
|
2937
|
-
const audio = input.sound !== false; // default audio on for Veo
|
|
2938
|
-
const parts = [input.model];
|
|
2939
|
-
if (is4k)
|
|
2940
|
-
parts.push('4k');
|
|
2941
|
-
parts.push(`${input.duration}s`);
|
|
2942
|
-
if (audio)
|
|
2943
|
-
parts.push('audio');
|
|
2944
|
-
return parts.join('-');
|
|
2945
|
-
}
|
|
2946
3054
|
if (input.model.startsWith('kling-v3.0')) {
|
|
2947
3055
|
// Mirrors klingCreditKey() in slate/src/shared/pricing.ts. Kling native 4K
|
|
2948
3056
|
// bills flat-rate keys: std/pro/omni all get a `-4k` tier key, and omni-pro
|
|
2949
3057
|
// shares kling-v3-omni-4k (the o3/4k endpoint has one flat rate, audio
|
|
2950
3058
|
// included). At 1080p AUDIO IS A KEY DIMENSION (credits = COGS × markup,
|
|
2951
|
-
// locked 2026-07-05): sound → `-audio` variant.
|
|
3059
|
+
// locked 2026-07-05): sound → `-audio` variant. An OMITTED sound is ON: the
|
|
3060
|
+
// desktop agent route sends `sound ?? true` and bills the audio key, so a
|
|
3061
|
+
// quote that read omitted as silent under-quoted every default Kling take
|
|
3062
|
+
// (21 credits quoted, 32 billed at std 5s; found 2026-10-02).
|
|
2952
3063
|
const tier = KLING_TIER_MAP[input.model] ?? input.model;
|
|
2953
3064
|
if (input.videoResolution === '4k') {
|
|
2954
3065
|
const tier4k = tier === 'kling-v3-omni-pro' ? 'kling-v3-omni' : tier;
|
|
2955
3066
|
return `${tier4k}-4k-${input.duration}s`;
|
|
2956
3067
|
}
|
|
2957
|
-
return `${tier}-${input.duration}s${input.sound
|
|
3068
|
+
return `${tier}-${input.duration}s${input.sound !== false ? '-audio' : ''}`;
|
|
2958
3069
|
}
|
|
2959
3070
|
if (input.model === 'omni-flash') {
|
|
2960
3071
|
// Mirrors omniFlashCreditKey() in slate/src/shared/pricing.ts — flat 720p
|
|
@@ -3079,13 +3190,19 @@ function resolveVideoModel(raw) {
|
|
|
3079
3190
|
// so a pasted `minimax-h3-768p-10s-ref2` resolves instead of erroring. The
|
|
3080
3191
|
// number it carries is K (images PAST the free five), so it is converted back
|
|
3081
3192
|
// to a TOTAL before anything can re-surcharge it.
|
|
3193
|
+
// The free allowance differs per row (H3 five, H3 Max four), so the total is
|
|
3194
|
+
// computed once the model is known, in `withRefTotal`; reading `out.model`
|
|
3195
|
+
// here read the placeholder and gave every row five.
|
|
3082
3196
|
const ref = /-ref(\d+)\b/.exec(s);
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
(MINIMAX_FREE_REF_IMAGES_BY_MODEL[out.model] ?? MINIMAX_FREE_REF_IMAGES) +
|
|
3086
|
-
parseInt(ref[1], 10);
|
|
3197
|
+
const paidRefs = ref ? parseInt(ref[1], 10) : null;
|
|
3198
|
+
if (ref)
|
|
3087
3199
|
s = s.replace(/-ref(\d+)\b/, '');
|
|
3088
|
-
|
|
3200
|
+
const withRefTotal = (resolved) => {
|
|
3201
|
+
if (paidRefs !== null) {
|
|
3202
|
+
resolved.referenceImages = (MINIMAX_FREE_REF_IMAGES_BY_MODEL[resolved.model] ?? MINIMAX_FREE_REF_IMAGES) + paidRefs;
|
|
3203
|
+
}
|
|
3204
|
+
return resolved;
|
|
3205
|
+
};
|
|
3089
3206
|
// The RESOLUTION vocabulary is GENERATED from MODEL_CAPABILITIES — the
|
|
3090
3207
|
// hand-typed list that stood here went stale the day 768p and 2k shipped.
|
|
3091
3208
|
const resRe = new RegExp(`-(${VIDEO_RESOLUTION_VOCAB.join('|')})\\b`);
|
|
@@ -3111,7 +3228,7 @@ function resolveVideoModel(raw) {
|
|
|
3111
3228
|
const direct = VIDEO_MODELS.find((m) => m === s);
|
|
3112
3229
|
if (direct) {
|
|
3113
3230
|
out.model = direct;
|
|
3114
|
-
return out;
|
|
3231
|
+
return withRefTotal(out);
|
|
3115
3232
|
}
|
|
3116
3233
|
const aliases = {
|
|
3117
3234
|
'kling-v3-standard': 'kling-v3.0-std',
|
|
@@ -3133,8 +3250,6 @@ function resolveVideoModel(raw) {
|
|
|
3133
3250
|
'seedance-2-5': 'seedance-2.5',
|
|
3134
3251
|
'seedance2.5': 'seedance-2.5',
|
|
3135
3252
|
seedance: 'seedance-2',
|
|
3136
|
-
'veo-3.1': 'veo-3.1-fast',
|
|
3137
|
-
'veo-3': 'veo-3.1-fast',
|
|
3138
3253
|
'gemini-omni-flash': 'omni-flash',
|
|
3139
3254
|
'gemini-omni-flash-preview': 'omni-flash',
|
|
3140
3255
|
'omni-flash-preview': 'omni-flash',
|
|
@@ -3159,7 +3274,7 @@ function resolveVideoModel(raw) {
|
|
|
3159
3274
|
};
|
|
3160
3275
|
if (aliases[s]) {
|
|
3161
3276
|
out.model = aliases[s];
|
|
3162
|
-
return out;
|
|
3277
|
+
return withRefTotal(out);
|
|
3163
3278
|
}
|
|
3164
3279
|
return null;
|
|
3165
3280
|
}
|
|
@@ -3215,11 +3330,11 @@ const VIDEO_MODEL_GUIDES = [
|
|
|
3215
3330
|
export const generateVideo = {
|
|
3216
3331
|
id: 'slates_generate_video',
|
|
3217
3332
|
billable: true,
|
|
3218
|
-
description: 'Generate video via Slates credits.
|
|
3333
|
+
description: 'Generate video via Slates credits. Choose the model with slates-model-selection. Video models prompt very differently: the estimate returns the chosen model\'s prompting card, and its full guide (' +
|
|
3219
3334
|
VIDEO_MODEL_GUIDES +
|
|
3220
|
-
')
|
|
3335
|
+
') covers modes the card leaves out, via slates_get_prompting_guide. Read slates-content-policy when the scene involves conflict, creatures, crowds, destruction, weapons, or young characters. projectId, aspectRatio, and duration are required (requires_clarification otherwise). ' +
|
|
3221
3336
|
CONFIRM_GATE_SENTENCE +
|
|
3222
|
-
' Image-to-video via firstFrameAssetId; first+last frames
|
|
3337
|
+
' Image-to-video via firstFrameAssetId; first+last frames on every model except Omni Flash; ingredients via ingredientAssetIds (Kling Omni, Seedance, Omni Flash, H3 and H3 Max; Kling Std/Pro only with a first frame). Asset params take UUIDs or badge codes ("IMG-A8"). ' +
|
|
3223
3338
|
// GENERATED from the skill's own slop-token list. Always in context on both
|
|
3224
3339
|
// surfaces, so it survives an agent that skips slates_get_prompting_guide.
|
|
3225
3340
|
describeBannedTokens('video'),
|
|
@@ -3227,7 +3342,7 @@ export const generateVideo = {
|
|
|
3227
3342
|
prompt: z.string().min(1).max(4000),
|
|
3228
3343
|
// ROUTING doctrine only. Every capability number was stripped on 2026-08-16
|
|
3229
3344
|
// and now lives in the aspectRatio / duration / videoResolution descriptions
|
|
3230
|
-
// below, generated from MODEL_CAPABILITIES. "
|
|
3345
|
+
// below, generated from MODEL_CAPABILITIES. "16:9 only" for a model and
|
|
3231
3346
|
// "seedance-2.5 480p/720p" were both stated here AND there, and the two
|
|
3232
3347
|
// copies disagreed — and the second of those went stale on 2026-08-24 when
|
|
3233
3348
|
// 2.5 gained 1080p, which is exactly the failure mode generating it fixes.
|
|
@@ -3239,7 +3354,7 @@ export const generateVideo = {
|
|
|
3239
3354
|
`Full table: the slates-model-selection skill. Each model's legal aspect ratios, durations and ` +
|
|
3240
3355
|
`resolutions are in those params' own descriptions — read them there, not from memory. ` +
|
|
3241
3356
|
`For per-call cost, call slates_estimate_generation_cost.`),
|
|
3242
|
-
projectId: z.string().uuid().optional().describe('Save into this Slates project.
|
|
3357
|
+
projectId: z.string().uuid().optional().describe('Save into this Slates project. Required — the desktop UI shows a progress card live and the asset appears when complete.'),
|
|
3243
3358
|
// 🚨 THESE THREE DESCRIPTIONS ARE GENERATED FROM `MODEL_CAPABILITIES`.
|
|
3244
3359
|
// Never hand-write a ratio, resolution or duration into them again — every
|
|
3245
3360
|
// one of the hand-written claims that stood here had drifted, and an
|
|
@@ -3256,7 +3371,7 @@ export const generateVideo = {
|
|
|
3256
3371
|
// demand, by the one session that needs it. If you are about to explain
|
|
3257
3372
|
// WHY here, you are writing the skill in the wrong file.
|
|
3258
3373
|
firstFrameAssetId: z.string().optional().describe('Starting frame for image-to-video (UUID or badge code, resolved at call time).'),
|
|
3259
|
-
lastFrameAssetId: z.string().optional().describe('Ending frame
|
|
3374
|
+
lastFrameAssetId: z.string().optional().describe('Ending frame; every model except Omni Flash. Pairs with firstFrameAssetId.'),
|
|
3260
3375
|
ingredientAssetIds: z.array(z.string()).max(30).optional().describe(
|
|
3261
3376
|
// Caps DERIVED from MODEL_CAPABILITIES — the hand-typed list omitted
|
|
3262
3377
|
// kling-v3.0-omni-pro entirely and read as if 7 were an Omni Flash-only rule.
|
|
@@ -3271,15 +3386,15 @@ export const generateVideo = {
|
|
|
3271
3386
|
// The capacity sentences are DERIVED from MODEL_FACTS (see
|
|
3272
3387
|
// multimodalRefSummary) rather than hand-typed, so a cap change in one
|
|
3273
3388
|
// place cannot leave a stale number in a description an LLM reads.
|
|
3274
|
-
videoReferenceAssetIds: z.array(z.string()).optional().describe(`Reference VIDEOS, cited in the prompt as "video 1", "video 2"… in the order given. ${multimodalRefModels().join(' / ')} only; per-model caps are on audioReferenceAssetIds.
|
|
3389
|
+
videoReferenceAssetIds: z.array(z.string()).optional().describe(`Reference VIDEOS, cited in the prompt as "video 1", "video 2"… in the order given. ${multimodalRefModels().join(' / ')} only; per-model caps are on audioReferenceAssetIds. On Seedance, billing switches to the vref key (input+output seconds) — pass videoReferenceSecondsEach. Over the cap is REFUSED, never trimmed.`),
|
|
3275
3390
|
videoReferenceSecondsEach: z.array(z.number()).optional().describe('REQUIRED with videoReferenceAssetIds, same order and length: each clip\'s duration in seconds. Feeds the vref cost key; the server re-probes and corrects an understated value upward.'),
|
|
3276
|
-
audioReferenceAssetIds: z.array(z.string()).optional().describe(`Reference AUDIO, cited as "audio 1", "audio 2"… in the order given. ${multimodalRefModels().join(' / ')} only. No
|
|
3391
|
+
audioReferenceAssetIds: z.array(z.string()).optional().describe(`Reference AUDIO, cited as "audio 1", "audio 2"… in the order given. ${multimodalRefModels().join(' / ')} only. No surcharge on Seedance; on H3 Max, audio counts toward the reference-token pool. ${multimodalRefModels().map(multimodalRefSummary).join(' ')}`),
|
|
3277
3392
|
audioReferenceSpokenText: z.array(z.string()).optional().describe('The exact words in each reference clip — same order and length as audioReferenceAssetIds, "" for a clip with no speech. The model RE-TRANSCRIBES a take rather than using it verbatim, so audio decides voice/accent/timing and only this decides the WORDS. Omit it and the words are a guess.'),
|
|
3278
|
-
sound: z.boolean().optional().describe('Kling
|
|
3279
|
-
audioLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('Kling
|
|
3280
|
-
generateMusic: z.boolean().optional().describe('Kling
|
|
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.'),
|
|
3394
|
+
audioLanguage: z.enum(['EN', 'ZH', 'JA', 'KO', 'ES']).optional().describe('Any Kling model with sound on — language for dialogue.'),
|
|
3395
|
+
generateMusic: z.boolean().optional().describe('Any Kling model with sound on — auto-generate background music.'),
|
|
3281
3396
|
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.'),
|
|
3282
|
-
seedanceRealFace: z.boolean().optional().describe('Seedance ONLY: a reference shows a REAL person. Real-person route,
|
|
3397
|
+
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.'),
|
|
3283
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 route.'),
|
|
3284
3399
|
negativePrompt: z.string().optional(),
|
|
3285
3400
|
background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
|
|
@@ -3341,7 +3456,7 @@ export const generateVideo = {
|
|
|
3341
3456
|
`Missing required field(s): ${missing.join(', ')}. ` +
|
|
3342
3457
|
`Read the slates-cost-discipline + ${promptingSkillFor(input.model)} skills, ` +
|
|
3343
3458
|
// Generated from MODEL_CAPABILITIES. The prose that stood here claimed
|
|
3344
|
-
//
|
|
3459
|
+
// a model locked to 16:9, "Kling/Seedance support 1:1 16:9 9:16 4:3 3:4
|
|
3345
3460
|
// 21:9" and "Kling 5-15s" — three wrong claims in one sentence.
|
|
3346
3461
|
`or ask the user. ` +
|
|
3347
3462
|
`Aspect ratio for ${input.model}: ${aspectRatiosFor(input.model, AGENT_ROUTE_PROVIDER).join(', ')}. ` +
|
|
@@ -3369,7 +3484,7 @@ export const generateVideo = {
|
|
|
3369
3484
|
return ok({
|
|
3370
3485
|
requires_clarification: true,
|
|
3371
3486
|
missing: [],
|
|
3372
|
-
message: `Omni Flash takes a prompt, an optional start frame, and up to ${omniFlashRefCap} reference IMAGES — last frames and video/audio references are not supported. Drop those, or switch to seedance-2 (video/audio refs, last frame)
|
|
3487
|
+
message: `Omni Flash takes a prompt, an optional start frame, and up to ${omniFlashRefCap} reference IMAGES — last frames and video/audio references are not supported. Drop those, or switch to seedance-2.5 (video/audio refs, last frame).`,
|
|
3373
3488
|
});
|
|
3374
3489
|
}
|
|
3375
3490
|
const refCount = (input.ingredientAssetIds?.length ?? 0) +
|
|
@@ -3501,11 +3616,6 @@ export const generateVideo = {
|
|
|
3501
3616
|
});
|
|
3502
3617
|
}
|
|
3503
3618
|
}
|
|
3504
|
-
// ⛔ The hand-written Veo duration block that stood here is GONE. It read
|
|
3505
|
-
// `![4,6,8].includes(duration)` plus "4K only at 8s" — and the registry
|
|
3506
|
-
// forces 8s at 1080p TOO, so it happily quoted a 4s 1080p Veo the provider
|
|
3507
|
-
// rejects. `assertVideoCapabilities` above covers both, plus the
|
|
3508
|
-
// reference-to-video 8s rule it never knew about, from the SSOT.
|
|
3509
3619
|
// Resolve every asset reference (UUID or badge code) against the
|
|
3510
3620
|
// project AT CALL TIME. Codes the user just spoke ("a8 is the one")
|
|
3511
3621
|
// resolve to whatever exists NOW — including assets created in the UI
|
|
@@ -3847,10 +3957,9 @@ export const generateAudio = {
|
|
|
3847
3957
|
id: 'slates_generate_audio',
|
|
3848
3958
|
billable: true,
|
|
3849
3959
|
description: `Generate project audio using credits. Choose the surface via the model routing below. ` +
|
|
3850
|
-
'
|
|
3960
|
+
'The estimate returns the chosen surface\'s prompting card; its full guide (slates-prompting-seed-audio | slates-prompting-elevenlabs | slates-prompting-inworld-tts) covers what the card leaves out. ' +
|
|
3851
3961
|
'Seed Audio bills the requested duration, which is appended to the prompt regardless of output length. Kling "SFX:" / "Ambient noise:" syntax does not transfer. ' +
|
|
3852
|
-
CONFIRM_GATE_SENTENCE
|
|
3853
|
-
' No skill files installed? Call slates_get_prompting_guide first.',
|
|
3962
|
+
CONFIRM_GATE_SENTENCE,
|
|
3854
3963
|
input: z.object({
|
|
3855
3964
|
projectId: z.string().uuid().describe('Slates project the audio asset lands in. Required — the renderer refreshes live.'),
|
|
3856
3965
|
model: z
|
|
@@ -4102,7 +4211,8 @@ async function quoteToolBlocks(ctx, stem, seconds, voiceStep) {
|
|
|
4102
4211
|
export const generateLipSync = {
|
|
4103
4212
|
id: 'slates_generate_lip_sync',
|
|
4104
4213
|
billable: true,
|
|
4105
|
-
description: 'Lip-sync a still image (avatar) or a video clip to audio. KLING-ONLY — this tool wraps Kling\'s dedicated lip-sync endpoints and nothing else: sourceType=video re-syncs a clip, sourceType=image animates a still avatar (avatar-standard, or avatar-pro for the premium seat). Quote each with slates_estimate_generation_cost rather than from memory. Audio from TTS (ttsText + ttsVoice) or an uploaded file. Billed per 5s of the output (the clip, or on a still the voice track). For a Seedance version, do NOT look for an engine switch here — run a normal slates_generate_video on seedance-2 with the clip attached as a video reference and the dialogue written into the prompt; that is the same call, with the prompt visible and editable.
|
|
4214
|
+
description: 'Lip-sync a still image (avatar) or a video clip to audio. KLING-ONLY — this tool wraps Kling\'s dedicated lip-sync endpoints and nothing else: sourceType=video re-syncs a clip, sourceType=image animates a still avatar (avatar-standard, or avatar-pro for the premium seat). Quote each with slates_estimate_generation_cost rather than from memory. Audio from TTS (ttsText + ttsVoice) or an uploaded file. Billed per 5s of the output (the clip, or on a still the voice track). For a Seedance version, do NOT look for an engine switch here — run a normal slates_generate_video on seedance-2 with the clip attached as a video reference and the dialogue written into the prompt; that is the same call, with the prompt visible and editable. The craft is slates-prompting-lip-sync; the confirm response shows the exact cost before anything is charged. projectId is REQUIRED. ' +
|
|
4215
|
+
CONFIRM_GATE_SENTENCE,
|
|
4106
4216
|
input: z.object({
|
|
4107
4217
|
projectId: z.string().uuid().describe('Slates project the source asset lives in. The new lip-synced video lands here.'),
|
|
4108
4218
|
sourceAssetId: z.string().uuid().describe('Asset id of the still image (avatar flow) or video clip (lip-sync flow). Must already exist in the project — use slates_upload_reference_image or slates_generate_image / slates_generate_video first if needed.'),
|
|
@@ -4225,11 +4335,11 @@ export const generateLipSync = {
|
|
|
4225
4335
|
export const generateMotionTransfer = {
|
|
4226
4336
|
id: 'slates_generate_motion_transfer',
|
|
4227
4337
|
billable: true,
|
|
4228
|
-
description: 'Transfer the motion from a reference video onto a target image character. KLING-ONLY — this tool wraps Kling Motion Control and nothing else: kling-mc-std or kling-mc-pro, structured skeleton/depth retargeting, billed per 5s of the driving clip. For a Seedance version, do NOT look for an engine switch here — run a normal slates_generate_video on seedance-2 with the driving clip attached as a video reference and the motion described in the prompt ("the character from image 1 performs the exact motion from video 1"); that is the same call, with the prompt visible and editable.
|
|
4338
|
+
description: 'Transfer the motion from a reference video onto a target image character. KLING-ONLY — this tool wraps Kling Motion Control and nothing else: kling-mc-std or kling-mc-pro, structured skeleton/depth retargeting, billed per 5s of the driving clip. For a Seedance version, do NOT look for an engine switch here — run a normal slates_generate_video on seedance-2 with the driving clip attached as a video reference and the motion described in the prompt ("the character from image 1 performs the exact motion from video 1"); that is the same call, with the prompt visible and editable. The craft is slates-prompting-motion-transfer; the confirm response shows the exact cost before anything is charged. projectId is REQUIRED — both assets must exist in the project. ' +
|
|
4229
4339
|
CONFIRM_GATE_SENTENCE,
|
|
4230
4340
|
input: z.object({
|
|
4231
4341
|
projectId: z.string().uuid().describe('Slates project. Both source and target assets must live here.'),
|
|
4232
|
-
sourceVideoAssetId: z.string().uuid().describe('Asset id of the reference video — its motion will be retargeted onto the target image. Must already exist in the project. Up to 30s.'),
|
|
4342
|
+
sourceVideoAssetId: z.string().uuid().describe('Asset id of the reference video — its motion will be retargeted onto the target image. Must already exist in the project. Up to 30s with characterOrientation video, 10s with image; billed per 5s block.'),
|
|
4233
4343
|
targetImageAssetId: z.string().uuid().describe('Asset id of the target image (the character that will perform the motion). Must already exist in the project.'),
|
|
4234
4344
|
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.'),
|
|
4235
4345
|
characterOrientation: z.enum(['video', 'image']).optional().describe('"video" = use the source video\'s framing. "image" = use the target image\'s framing. Default video.'),
|
|
@@ -4336,7 +4446,7 @@ export const editVideo = {
|
|
|
4336
4446
|
// point to in a tool result) and go stale on the next rate change; the
|
|
4337
4447
|
// windows are owned by MODEL_CAPABILITIES and are generated below into the
|
|
4338
4448
|
// params that enforce them.
|
|
4339
|
-
'Edit an EXISTING video clip with one instruction — character swap, environment change, style transfer — in one pass, no masking. Original motion, camera, and audio are preserved; only what the prompt names changes. Use when a clip is ~90% right (fix it, don\'t re-roll it) or to AI-edit the user\'s own footage. Engines: Kling O3 edit (default — subject/style refs via elements), omni-flash-edit (PROMPT-ONLY, no refs, the
|
|
4449
|
+
'Edit an EXISTING video clip with one instruction — character swap, environment change, style transfer — in one pass, no masking. Original motion, camera, and audio are preserved; only what the prompt names changes. Use when a clip is ~90% right (fix it, don\'t re-roll it) or to AI-edit the user\'s own footage. Engines: Kling O3 edit (default — subject/style refs via elements), omni-flash-edit (PROMPT-ONLY, no refs, priced level with Kling O3 Edit Standard; the first pick in the routing guide for footage-synced edits), or seedance-2.5-edit (the only engine that takes a clip over 15s; seedanceFace:true for AI-character faces). Clip-length and resolution windows per engine are on the `model` param. Cost is per second of OUTPUT (≈ clip length, rounded up), and an edit bills input + output seconds on Seedance and output seconds on Kling and Omni Flash — read the quote from the confirm gate or slates_estimate_generation_cost, never from memory. Subjects to swap IN go as characterAssetIds (frontal + angle images become Kling elements — Kling models only); style refs as styleAssetIds; max 4 combined. The edited clip saves as a NEW asset linked to its parent (chain edits freely). Routing: Kling edit is the default (element lock + audio intact); omni-flash-edit for cheap prompt-only footage-synced swaps; Seedance edit for style-transfer-heavy jobs — see slates-model-selection. Prompting: slates-prompting-kling-v3 §Edit / slates-prompting-omni-flash.',
|
|
4340
4450
|
input: z.object({
|
|
4341
4451
|
projectId: z.string().uuid().describe('Project the source clip lives in.'),
|
|
4342
4452
|
sourceVideoAssetId: z.string().describe('The VIDEO asset to edit — UUID or badge code ("VID-V3", bare "V3"); codes resolve against the project at call time. Kling: 3–15s clips; omni-flash-edit: 3–10s.'),
|
|
@@ -4353,7 +4463,7 @@ export const editVideo = {
|
|
|
4353
4463
|
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.'),
|
|
4354
4464
|
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).'),
|
|
4355
4465
|
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.`),
|
|
4356
|
-
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
|
|
4466
|
+
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.'),
|
|
4357
4467
|
background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
|
|
4358
4468
|
confirm: z.boolean().optional().describe('Set true to bypass the cost confirm gate after the user OKs the spend.'),
|
|
4359
4469
|
folderId: folderIdField,
|
|
@@ -4503,7 +4613,7 @@ export const editVideo = {
|
|
|
4503
4613
|
// ── Trim a video to an exact window (fit-to-model primitive) ────
|
|
4504
4614
|
export const trimVideo = {
|
|
4505
4615
|
id: 'slates_trim_video',
|
|
4506
|
-
description: 'Trim a video asset to an exact [inSec, outSec] window and save the result as a NEW clip linked to the original (the original is untouched). This is the fit-to-model primitive: an 11s clip will not run on omni-flash-edit (3–10s)
|
|
4616
|
+
description: 'Trim a video asset to an exact [inSec, outSec] window and save the result as a NEW clip linked to the original (the original is untouched). This is the fit-to-model primitive: an 11s clip will not run on omni-flash-edit (3–10s), a 16s one not on Kling edit (3–15s), and a Seedance 2.0 video reference must be 2–15s (2.5 takes up to 30s combined) — trim it first, then edit the trimmed clip. EXACT re-encode (not a keyframe-snapped cut) so the result honors hard duration caps to the frame; any phone rotation flag is baked into the pixels in the same pass. The new clip lands with correct duration/width/height immediately. inSec defaults to 0. Pass pieces to cut the window into SEVERAL clips in one call, as the Trim & split dialog does (split points, or Auto-split by longest piece, with seconds shared between neighbours); every new clip comes back.',
|
|
4507
4617
|
input: z.object({
|
|
4508
4618
|
projectId: z.string().uuid().describe('Project the clip lives in.'),
|
|
4509
4619
|
assetId: z
|
|
@@ -4859,7 +4969,7 @@ export const exportVideo = {
|
|
|
4859
4969
|
};
|
|
4860
4970
|
export const exportTimelineXml = {
|
|
4861
4971
|
id: 'slates_export_timeline_xml',
|
|
4862
|
-
description: "Export the project's timeline as FCP7/XMEML XML — the file DaVinci Resolve imports directly (File → Import → Timeline) to recreate the edit with references to the original clip media on disk.
|
|
4972
|
+
description: "Export the project's timeline as FCP7/XMEML XML — the file DaVinci Resolve imports directly (File → Import → Timeline) to recreate the edit with references to the original clip media on disk. Use this for DaVinci Resolve or Premiere; current Final Cut Pro requires FCPXML, which this tool does not export. Pass an absolute outputPath ending in .xml; fails if the file exists unless overwrite=true.",
|
|
4863
4973
|
input: z
|
|
4864
4974
|
.object({
|
|
4865
4975
|
projectId: z.string().uuid().optional(),
|
|
@@ -5868,11 +5978,54 @@ export const createShot = {
|
|
|
5868
5978
|
? ` Saved from ${input.fromAssetId}: its recorded recipe is the Shot's, and that result is its first take (unless another Shot already holds it).` +
|
|
5869
5979
|
(r.unsavedPaths?.length ? ` ${r.unsavedPaths.length} recorded attachment(s) are not project assets and are not on the Shot.` : '')
|
|
5870
5980
|
: '';
|
|
5981
|
+
// 🔑 THE COUNTS RIDE THIS RESULT TOO (2026-10-07). Writing a shot list is
|
|
5982
|
+
// when sameness is cheapest to fix, and the eval showed the agent wrote
|
|
5983
|
+
// three Shots and never called slates_list_shots in 3 of 4 trials. Same
|
|
5984
|
+
// reasoning as describeVarietyReport: what it must choose to fetch does not
|
|
5985
|
+
// reach it, so the board's running counts arrive with each new Shot. A
|
|
5986
|
+
// storyboardId placed the Shot only when no frameId or sceneId came with it
|
|
5987
|
+
// (the schema ignores it then), so only then does it name the board.
|
|
5988
|
+
const varietyNote = await boardSoFar(desktop, {
|
|
5989
|
+
projectId: input.projectId,
|
|
5990
|
+
shotId: r.shot?.id,
|
|
5991
|
+
storyboardId: input.storyboardId && !input.frameId && !input.sceneId ? input.storyboardId : undefined,
|
|
5992
|
+
});
|
|
5871
5993
|
// The CODE is the address the user sees on the row — say it back so the
|
|
5872
5994
|
// next call, and the next sentence to the user, can point at it.
|
|
5873
|
-
return ok(r.shot, `${r.shot?.code || 'Shot'} — "${r.shot?.name || 'Untitled'}". ${refEcho}${fromNote}`.trim());
|
|
5995
|
+
return ok(r.shot, `${r.shot?.code || 'Shot'} — "${r.shot?.name || 'Untitled'}". ${refEcho}${fromNote}`.trim() + varietyNote);
|
|
5874
5996
|
},
|
|
5875
5997
|
};
|
|
5998
|
+
/**
|
|
5999
|
+
* The board's running counts after a Shot write, as the "Board so far" line, or ''.
|
|
6000
|
+
* Scoped to the Shot's OWN board: the listing falls back to every board in the
|
|
6001
|
+
* project when none is named, so an unscoped read would report other boards' cuts
|
|
6002
|
+
* as this one's. `storyboardId` is used only when it alone placed the Shot;
|
|
6003
|
+
* otherwise the board whose listing holds the Shot is found. No board found means
|
|
6004
|
+
* no counts, never project-wide ones. A failed read never fails the write.
|
|
6005
|
+
*/
|
|
6006
|
+
async function boardSoFar(desktop, where) {
|
|
6007
|
+
try {
|
|
6008
|
+
let board = null;
|
|
6009
|
+
if (where.storyboardId) {
|
|
6010
|
+
board = await desktop.get('/agent/shots', { storyboardId: where.storyboardId });
|
|
6011
|
+
}
|
|
6012
|
+
else if (where.shotId) {
|
|
6013
|
+
const { storyboards } = await desktop.get('/agent/storyboards', { projectId: where.projectId });
|
|
6014
|
+
for (const sb of (storyboards ?? []).slice(0, 10)) {
|
|
6015
|
+
const listed = await desktop.get('/agent/shots', { storyboardId: sb.id });
|
|
6016
|
+
if ((listed.shots ?? []).some((s) => s.id === where.shotId)) {
|
|
6017
|
+
board = listed;
|
|
6018
|
+
break;
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
}
|
|
6022
|
+
const described = describeVarietyReport(board?.variety);
|
|
6023
|
+
return described ? `\nBoard so far: ${described}` : '';
|
|
6024
|
+
}
|
|
6025
|
+
catch {
|
|
6026
|
+
return ''; // counts are a courtesy here; slates_list_shots is the full read
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
5876
6029
|
export const updateShot = {
|
|
5877
6030
|
id: 'slates_update_shot',
|
|
5878
6031
|
description: 'Change part of a Shot, or attach/detach it from a board frame — anything you omit is left exactly as it was. ' +
|
|
@@ -5919,7 +6072,10 @@ export const updateShot = {
|
|
|
5919
6072
|
posterAssetId: input.posterAssetId,
|
|
5920
6073
|
},
|
|
5921
6074
|
});
|
|
5922
|
-
|
|
6075
|
+
// An edit to framing changes the counts, and the agent read them BEFORE it
|
|
6076
|
+
// (agent eval round 11: two runs fixed a repeat and never saw the new counts).
|
|
6077
|
+
const varietyNote = await boardSoFar(desktop, { projectId: input.projectId, shotId: r.shot?.id });
|
|
6078
|
+
return ok(r.shot, JSON.stringify(r.shot) + varietyNote);
|
|
5923
6079
|
},
|
|
5924
6080
|
};
|
|
5925
6081
|
export const duplicateShot = {
|
|
@@ -6070,13 +6226,44 @@ export const listShots = {
|
|
|
6070
6226
|
credits: q?.credits ?? null,
|
|
6071
6227
|
};
|
|
6072
6228
|
});
|
|
6229
|
+
// 🚨 THE ROWS ARE IN THE TEXT. The desktop Studio Agent reads only `text`
|
|
6230
|
+
// (`opResultToContent` in slate's studio-agent/ops.ts); `data` reaches MCP
|
|
6231
|
+
// clients as structured content and nobody else. This text used to be the
|
|
6232
|
+
// totals alone, so the in-app agent could see "3 shot(s), 444 credits" and
|
|
6233
|
+
// no Shot it could name: on 2026-10-07 it listed the same board six times,
|
|
6234
|
+
// tried `slates_get_shot("SHOT-1")`, and the eval trial timed out.
|
|
6235
|
+
// The variety report comes first and the rows stop at SHOT_ROWS_CHARS, so a
|
|
6236
|
+
// long board can never push the report past the desktop's 12,000-character
|
|
6237
|
+
// result cap (TOOL_RESULT_CHAR_CAP in slate's studio-agent/ops.ts).
|
|
6238
|
+
const rowText = [];
|
|
6239
|
+
let rowChars = 0;
|
|
6240
|
+
for (const s of shots) {
|
|
6241
|
+
const line = [
|
|
6242
|
+
[s.place, s.code].filter(Boolean).join(' ') || '—',
|
|
6243
|
+
JSON.stringify(s.name),
|
|
6244
|
+
s.model ?? 'no model',
|
|
6245
|
+
s.credits == null ? 'unpriced' : fmtCredits(s.credits),
|
|
6246
|
+
`id ${s.id}`,
|
|
6247
|
+
].join(' · ');
|
|
6248
|
+
if (rowChars + line.length + 1 > SHOT_ROWS_CHARS)
|
|
6249
|
+
break;
|
|
6250
|
+
rowText.push(line);
|
|
6251
|
+
rowChars += line.length + 1;
|
|
6252
|
+
}
|
|
6253
|
+
const omitted = shots.length - rowText.length;
|
|
6254
|
+
const report = describeVarietyReport(r.variety);
|
|
6073
6255
|
return ok({ shots, total_credits: total, unpriced, variety: r.variety }, `${shots.length} shot(s), at least ${fmtCredits(total)} to fire them all` +
|
|
6074
6256
|
(unpriced > 0 ? ` (${unpriced} could not be priced — no model or no duration set).` : '.') +
|
|
6075
|
-
(
|
|
6076
|
-
|
|
6077
|
-
|
|
6257
|
+
(report ? `\n\n${report}` : '') +
|
|
6258
|
+
(rowText.length ? `\n\n${rowText.join('\n')}` : '') +
|
|
6259
|
+
(omitted > 0
|
|
6260
|
+
? `\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.`
|
|
6261
|
+
: ''));
|
|
6078
6262
|
},
|
|
6079
6263
|
};
|
|
6264
|
+
/** Room for Shot rows in the slates_list_shots text: about 65 rows, well inside the
|
|
6265
|
+
* desktop's 12,000-character result cap with the totals and the variety report. */
|
|
6266
|
+
const SHOT_ROWS_CHARS = 8000;
|
|
6080
6267
|
export const getShot = {
|
|
6081
6268
|
id: 'slates_get_shot',
|
|
6082
6269
|
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.',
|
|
@@ -6503,7 +6690,10 @@ export const generateFromShots = {
|
|
|
6503
6690
|
quote.items
|
|
6504
6691
|
.map((i) => `${i.code ?? i.name}: ${i.credits == null ? 'unpriced' : fmtCredits(i.credits)}${i.blocked ? ` — ${i.blocked}` : ''}`)
|
|
6505
6692
|
.join('\n') +
|
|
6506
|
-
|
|
6693
|
+
// Printed, not only in `data`: a client without elicitation reads this text
|
|
6694
|
+
// alone, and the confirm step refuses without the fingerprint (agent eval, round 9).
|
|
6695
|
+
`\nfingerprint: ${quote.fingerprint}` +
|
|
6696
|
+
'\nGet approval for these prices, then pass this fingerprint with confirm: true.');
|
|
6507
6697
|
}
|
|
6508
6698
|
return ok(await desktop.post('/agent/shots/batch-generate', {
|
|
6509
6699
|
shotIds: quote.items.map((i) => i.shotId),
|
|
@@ -6576,7 +6766,7 @@ export const editCut = {
|
|
|
6576
6766
|
};
|
|
6577
6767
|
export function resolveGuideTopic(topic) {
|
|
6578
6768
|
const t = topic.trim().toLowerCase();
|
|
6579
|
-
if (SKILLS
|
|
6769
|
+
if (Object.hasOwn(SKILLS, t))
|
|
6580
6770
|
return t;
|
|
6581
6771
|
if (t === 'slates-character-turnaround' || t === 'character-turnaround') {
|
|
6582
6772
|
return 'slates-character-identity';
|
|
@@ -6650,8 +6840,6 @@ export function resolveGuideTopic(topic) {
|
|
|
6650
6840
|
return 'slates-prompting-flux-2-max';
|
|
6651
6841
|
if (t.startsWith('seedream'))
|
|
6652
6842
|
return 'slates-prompting-seedream-5-lite';
|
|
6653
|
-
if (t.startsWith('veo'))
|
|
6654
|
-
return 'slates-prompting-veo-3';
|
|
6655
6843
|
if (t.startsWith('omni-flash') || t.startsWith('gemini-omni') || t === 'omni flash')
|
|
6656
6844
|
return 'slates-prompting-omni-flash';
|
|
6657
6845
|
// MiniMax H3 — both seats share one skill. Placed BEFORE the seed/seedance
|
|
@@ -6672,7 +6860,7 @@ export function resolveGuideTopic(topic) {
|
|
|
6672
6860
|
if (t.startsWith('kling-mc'))
|
|
6673
6861
|
return 'slates-prompting-motion-transfer';
|
|
6674
6862
|
if (t === 'edit-video' || t === 'video-edit' || t === 'edit video' || t === 'video edit')
|
|
6675
|
-
return '
|
|
6863
|
+
return resolveGuideTopic(defaultModelFor('video', 'edit'));
|
|
6676
6864
|
if (t.startsWith('kling-v3'))
|
|
6677
6865
|
return 'slates-prompting-kling-v3';
|
|
6678
6866
|
// Audio — the TTS seat FIRST, then seed-audio, then eleven-sfx.
|
|
@@ -6733,69 +6921,96 @@ export function resolveGuideTopic(topic) {
|
|
|
6733
6921
|
}
|
|
6734
6922
|
return null;
|
|
6735
6923
|
}
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6924
|
+
// Discovery is the first call of most briefs: a slow or unentitled member check
|
|
6925
|
+
// must not cost every call a round trip, or hang free craft behind a 30s read.
|
|
6926
|
+
const MEMBER_CATALOG_TTL_MS = 60_000;
|
|
6927
|
+
const MEMBER_CATALOG_TIMEOUT_MS = 5_000;
|
|
6928
|
+
const memberCatalogCache = new WeakMap();
|
|
6929
|
+
/** Private bodies stay on the entitled member feed, never in public packages. */
|
|
6930
|
+
function memberGuideCatalog(ctx) {
|
|
6931
|
+
const cached = memberCatalogCache.get(ctx.cloud);
|
|
6932
|
+
if (cached && Date.now() - cached.at < MEMBER_CATALOG_TTL_MS)
|
|
6933
|
+
return cached.value;
|
|
6934
|
+
const value = fetchMemberGuideCatalog(ctx);
|
|
6935
|
+
memberCatalogCache.set(ctx.cloud, { at: Date.now(), value });
|
|
6936
|
+
return value;
|
|
6937
|
+
}
|
|
6938
|
+
async function fetchMemberGuideCatalog(ctx) {
|
|
6939
|
+
try {
|
|
6940
|
+
// Request first: a missing token throws here, before any timer exists.
|
|
6941
|
+
const request = ctx.cloud().get('/members/manifest.json');
|
|
6942
|
+
let timer;
|
|
6943
|
+
const timeout = new Promise((_, reject) => { timer = setTimeout(() => reject(new Error('Member guide check timed out')), MEMBER_CATALOG_TIMEOUT_MS); });
|
|
6944
|
+
const manifest = await Promise.race([request, timeout]).finally(() => clearTimeout(timer));
|
|
6945
|
+
if (!Array.isArray(manifest?.skills))
|
|
6946
|
+
throw new Error('Invalid member guide manifest');
|
|
6947
|
+
// A malformed entry is skipped; it never hides the account's other playbooks.
|
|
6948
|
+
const entries = manifest.skills
|
|
6949
|
+
.filter(entry => entry.tier === 'paid' && typeof entry.name === 'string' && /^slates-[a-z0-9]+(?:-[a-z0-9]+)*$/.test(entry.name) && entry.name.length <= 64 && typeof entry.description === 'string' && entry.description.length <= 1024)
|
|
6950
|
+
.map(entry => ({ name: entry.name, description: entry.description, tier: 'paid' }));
|
|
6951
|
+
return { entries, access: 'available' };
|
|
6952
|
+
}
|
|
6953
|
+
catch (error) {
|
|
6954
|
+
if (error.code === 'CLOUD_TOKEN_MISSING')
|
|
6955
|
+
return { entries: [], access: 'not connected; bundled guides available' };
|
|
6956
|
+
if (error instanceof SlatesCloudHttpError && error.status === 402)
|
|
6957
|
+
return { entries: [], access: 'no active skills entitlement; bundled guides available' };
|
|
6958
|
+
if (error instanceof SlatesCloudHttpError && error.status === 404)
|
|
6959
|
+
return { entries: [], access: 'member feed unavailable on this API version; bundled guides available' };
|
|
6960
|
+
// Keep free craft usable during a cloud outage, but expose the failed access check.
|
|
6961
|
+
return { entries: [], access: error instanceof SlatesCloudHttpError && error.status === 401 ? 'reconnect Slates to access member guides; bundled guides available' : 'member access check failed; retry for private guides; bundled guides available' };
|
|
6962
|
+
}
|
|
6756
6963
|
}
|
|
6757
6964
|
export const getPromptingGuide = {
|
|
6758
6965
|
id: 'slates_get_prompting_guide',
|
|
6759
|
-
description: '
|
|
6760
|
-
// 🚨 NO "ALWAYS READ THIS FIRST" SENTENCE. It stood here for months and was
|
|
6761
|
-
// MEASURED at 13% compliance before and after the enforcement work — pointer
|
|
6762
|
-
// prose is the shape that does not move the agent. What replaced it is
|
|
6763
|
-
// structural: the never-use list rides the generate ops' descriptions and
|
|
6764
|
-
// the craft card rides the estimate result, so the facts arrive whether or
|
|
6765
|
-
// not this op is ever called.
|
|
6766
|
-
"Return a bundled Slates prompting/workflow guide. MCP-only clients (Claude Desktop, Smithery) don't get the CLI-installed skill files — call this instead. Accepts a guide name or a model id ('veo-3.1-fast', 'kling-v3.0-pro', 'seedance-2', 'nano-banana-2'), which maps to the right guide. Reach for it when a card is not enough: the failure modes, the worked examples and the sources are only in the full text.",
|
|
6966
|
+
description: 'Find production craft from the user vision: pass query alone with the brief (for example "two friends talking in a rainy diner") for keyword-ranked guides with matching sections, followed by every other guide\'s description so you choose by judgment. Omit topic and query, or use topic "catalog", for the whole catalog. Then request a guide name, model id or style name with card/index/section/full depth. Cards are short; query with a topic selects one section or cinematic technique; full returns worked examples, failure modes and sources. Reuse current guidance already in context. Entitled member playbooks are fetched privately through the connected Slates account. For exact buttons and UI paths use topic "app-manual" with relevant question keywords; no query returns its surface map. Users supply the vision; you find the guides.',
|
|
6767
6967
|
input: z.object({
|
|
6768
|
-
query: z.string().max(
|
|
6769
|
-
topic: z
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
depth: z.enum(['card', 'index', 'section', 'full']).optional().describe('Default "card" is a short overview. "index" lists sections; query selects one section or technique; "full" explicitly returns the complete guide.'),
|
|
6968
|
+
query: z.string().min(1).max(1000).optional().describe('Without topic: creative brief or craft need to discover guides. With topic: section keywords, heading or technique ID.'),
|
|
6969
|
+
topic: z.string().min(1).optional().describe('Optional guide name, model id, style name, catalog, or app-manual. Omit to search by intent or browse.'),
|
|
6970
|
+
depth: z.enum(['card', 'index', 'section', 'full']).optional().describe('Default card is a short overview; index lists sections; query selects a section; full returns the complete guide.'),
|
|
6971
|
+
limit: z.number().int().min(1).max(20).optional().describe('Page size: a search returns 8 ranked matches by default, browsing the whole catalog. Does not change guide bodies.'),
|
|
6972
|
+
offset: z.number().int().min(0).optional().describe('Catalog/search offset from nextOffset in the preceding result.'),
|
|
6774
6973
|
}),
|
|
6775
|
-
async run(input) {
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
: appManualIndex();
|
|
6974
|
+
async run(input, ctx) {
|
|
6975
|
+
const topic = input.topic?.trim().toLowerCase();
|
|
6976
|
+
if (topic === 'app-manual') {
|
|
6977
|
+
const content = input.query || input.depth === 'full' ? appManualSections(input.query) : appManualIndex();
|
|
6780
6978
|
return { text: content, data: { topic: 'app-manual', bytes: Buffer.byteLength(content, 'utf8'), guide: content } };
|
|
6781
6979
|
}
|
|
6782
|
-
const resolved = resolveGuideTopic(
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6980
|
+
const resolved = topic ? resolveGuideTopic(topic) : null;
|
|
6981
|
+
if (resolved) {
|
|
6982
|
+
const depth = input.depth ?? 'card';
|
|
6983
|
+
const guide = retrieveGuide(resolved, SKILLS[resolved], depth, input.query);
|
|
6984
|
+
return { text: guide, data: { topic: resolved, tier: 'free', depth, bytes: Buffer.byteLength(guide, 'utf8'), guide } };
|
|
6786
6985
|
}
|
|
6787
|
-
const
|
|
6788
|
-
const
|
|
6789
|
-
|
|
6790
|
-
|
|
6986
|
+
const member = await memberGuideCatalog(ctx);
|
|
6987
|
+
const privateEntry = member.entries.find(entry => entry.name === topic);
|
|
6988
|
+
if (privateEntry) {
|
|
6989
|
+
// The feed's 402/404 bodies are purchase pages; the agent needs the fact, not the page.
|
|
6990
|
+
const result = await ctx.cloud().get(`/members/skills/${encodeURIComponent(privateEntry.name)}.md?format=json`).catch((error) => {
|
|
6991
|
+
if (error instanceof SlatesCloudHttpError && error.status === 402)
|
|
6992
|
+
throw new SlatesCloudHttpError(`${privateEntry.name} needs an active skills entitlement; bundled guides remain available.`, 402);
|
|
6993
|
+
if (error instanceof SlatesCloudHttpError && error.status === 404)
|
|
6994
|
+
throw new SlatesCloudHttpError(`${privateEntry.name} is no longer in the member feed.`, 404);
|
|
6995
|
+
throw error;
|
|
6996
|
+
});
|
|
6997
|
+
if (typeof result?.markdown !== 'string')
|
|
6998
|
+
throw new Error('Invalid member guide body');
|
|
6999
|
+
const depth = input.depth ?? 'card';
|
|
7000
|
+
const guide = retrieveGuide(privateEntry.name, result.markdown, depth, input.query);
|
|
7001
|
+
return { text: guide, data: { topic: privateEntry.name, tier: 'paid', depth, bytes: Buffer.byteLength(guide, 'utf8'), guide } };
|
|
7002
|
+
}
|
|
7003
|
+
const catalog = [...guideCatalog(SKILLS), ...member.entries].sort((a, b) => a.name.localeCompare(b.name));
|
|
7004
|
+
const result = discoverGuides(catalog, SKILLS, input.query ?? (topic && topic !== 'catalog' && topic !== 'index' ? input.topic : undefined), input.limit, input.offset);
|
|
7005
|
+
const guide = result.guides.map(entry => `${entry.name} (${entry.tier}): ${entry.description}${entry.sections.length ? `\n Matching sections: ${entry.sections.join('; ')}` : ''}`).join('\n\n');
|
|
7006
|
+
const rest = result.rest.length ? `\n\nEvery other guide (keyword hints above only see shared words; choose by the brief):\n${result.rest.map(entry => `- ${entry.name} (${entry.tier}): ${entry.description}`).join('\n')}` : '';
|
|
7007
|
+
const text = `${result.fallback ? 'No keyword match; choose relevant craft from the catalog.\n\n' : ''}${guide}${rest}\n\n${result.total} ${result.query && !result.fallback ? 'keyword matches' : 'guides'}; nextOffset: ${result.nextOffset ?? 'none'}. Member guides: ${member.access}. Retrieve a name with depth card/index or query for a section. The user does not need to choose guides.`;
|
|
7008
|
+
return { text, data: { ...result, memberAccess: member.access, bytes: Buffer.byteLength(text, 'utf8') } };
|
|
6791
7009
|
},
|
|
6792
7010
|
};
|
|
6793
7011
|
/**
|
|
6794
|
-
*
|
|
6795
|
-
*
|
|
6796
|
-
* 🚨 IT EXISTS BECAUSE THE SURFACE IS 112 KB AND EVERY TURN PAYS FOR ALL OF IT.
|
|
6797
|
-
* Both surfaces start with the shared core set. Search returns compact metadata;
|
|
6798
|
-
* names/group returns exact schemas and replaces the optional selection.
|
|
7012
|
+
* Task discovery and exact schemas share one operation. The desktop uses
|
|
7013
|
+
* names/group to replace its optional selection; MCP keeps its full list fixed.
|
|
6799
7014
|
*/
|
|
6800
7015
|
export const loadTools = {
|
|
6801
7016
|
id: 'slates_load_tools',
|
|
@@ -6810,16 +7025,19 @@ export const loadTools = {
|
|
|
6810
7025
|
}).refine((v) => [v.group, v.query, v.names].filter(Boolean).length === 1, 'Pass exactly one of query, names, or group.'),
|
|
6811
7026
|
async run(input) {
|
|
6812
7027
|
if (input.query) {
|
|
6813
|
-
const
|
|
6814
|
-
const ranked = ALL_OPERATIONS.map((op) => ({ op, score: words.reduce((n, w) => n + (op.id.includes(w) ? 4 : op.description.toLowerCase().includes(w) ? 1 : 0), 0) }))
|
|
6815
|
-
.filter((x) => x.score > 0).sort((a, b) => b.score - a.score).slice(0, 10);
|
|
7028
|
+
const ranked = searchTools(ALL_OPERATIONS, input.query);
|
|
6816
7029
|
const matches = ranked.map(({ op }) => ({ name: op.id, description: op.description.split(/(?<=\.)\s/)[0], billable: !!op.billable, annotations: op.annotations }));
|
|
6817
7030
|
return ok({ matches }, matches.map((o) => `${o.name}: ${o.description}`).join('\n') || 'No matching tools. Try another task description.');
|
|
6818
7031
|
}
|
|
6819
7032
|
const names = input.names ?? OPERATION_GROUPS[input.group];
|
|
6820
7033
|
const unknown = names.filter((id) => !ALL_OPERATIONS.some((op) => op.id === id));
|
|
6821
|
-
if (unknown.length)
|
|
6822
|
-
|
|
7034
|
+
if (unknown.length) {
|
|
7035
|
+
// Name the real tools a guessed name was reaching for. On 2026-10-07 the
|
|
7036
|
+
// agent tried slates_generate_shot, slates_run_shot and slates_get_shots
|
|
7037
|
+
// one call at a time before finding slates_generate_from_shots.
|
|
7038
|
+
const near = [...new Set(unknown.flatMap((id) => searchTools(ALL_OPERATIONS, id.replace(/^slates_/, '').replace(/_/g, ' ')).slice(0, 3).map(({ op }) => op.id)))];
|
|
7039
|
+
throw new Error(`Unknown operation(s): ${unknown.join(', ')}.${near.length ? ` Closest real tools: ${near.join(', ')}.` : ''}`);
|
|
7040
|
+
}
|
|
6823
7041
|
const defs = toolDefinitions(ALL_OPERATIONS.filter((op) => names.includes(op.id)), { surface: 'mcp' });
|
|
6824
7042
|
return ok({ group: input.group, tools: defs }, `Loaded tools (call by name):\n${JSON.stringify(defs)}`);
|
|
6825
7043
|
},
|
|
@@ -7008,6 +7226,7 @@ export const ALL_OPERATIONS = [
|
|
|
7008
7226
|
getAssetsBatch,
|
|
7009
7227
|
getAssetVideoFrames,
|
|
7010
7228
|
uploadReferenceImage,
|
|
7229
|
+
updateAsset,
|
|
7011
7230
|
saveExternalImage,
|
|
7012
7231
|
getChatGptStatus,
|
|
7013
7232
|
connectChatGpt,
|