@slatesvideo/shared 0.7.17 → 0.7.18

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.
@@ -1073,14 +1073,22 @@ export declare const addFrame: Operation<{
1073
1073
  notes?: string;
1074
1074
  position?: number;
1075
1075
  }>;
1076
- export type ImageModelId = 'nano-banana-2-1' | 'gpt-image-2-6-flare' | 'gpt-image-2-6-sunburst' | 'flux-3' | 'seedream-5-lite';
1076
+ export type ImageModelId = 'nano-banana-2-1' | 'gpt-image-2-6-flare' | 'gpt-image-2-6-sunburst' | 'flux-3' | 'seedream-5-5';
1077
1077
  /** The exact `model` ids `slates_generate_image` accepts. */
1078
1078
  /** Derived compatibility export for callers enumerating the 3k ladder. */
1079
1079
  export declare const THREE_K_IMAGE_MODELS: string[];
1080
- export declare const IMAGE_MODELS: readonly ["nano-banana-2-1", "gpt-image-2-6-flare", "gpt-image-2-6-sunburst", "flux-3", "seedream-5-lite"];
1080
+ export declare const IMAGE_MODELS: readonly ["nano-banana-2-1", "gpt-image-2-6-flare", "gpt-image-2-6-sunburst", "flux-3", "seedream-5-5"];
1081
1081
  /** True for either GPT Image seat. Flare and Sunburst differ in latency
1082
1082
  * and routing advice, never in pricing shape or param surface. */
1083
1083
  export declare function isGptImageModel(model: string | undefined): boolean;
1084
+ /**
1085
+ * The image seats that take `backgroundMode` (transparent / opaque / auto): both
1086
+ * GPT Image seats and Seedream 5.5 (BytePlus `background`, read 2026-11-16). The
1087
+ * desktop's twin is the `transparentBackground` feature on its registry rows,
1088
+ * which shows the Background control; the wire field is `gptBackground` for
1089
+ * every seat, a name kept from when GPT Image was the only one.
1090
+ */
1091
+ export declare function takesBackgroundMode(model: string | undefined): boolean;
1084
1092
  /** True for either Gemini Omni Flash 1.2 seat, generation or edit. */
1085
1093
  export declare function isOmniFlash12Model(model: string | null | undefined): boolean;
1086
1094
  /**
@@ -1114,7 +1122,7 @@ export type GptQualityId = GptQuality;
1114
1122
  * part of any cost key. `auto` is fal's default and ours.
1115
1123
  */
1116
1124
  export type GptBackgroundId = GptBackground;
1117
- export declare function imageCostKey(model: ImageModelId, resolution: '1k' | '2k' | '3k' | '4k', quality?: GptQualityId, aspectRatio?: string): string;
1125
+ export declare function imageCostKey(model: ImageModelId, resolution: '1k' | '2k' | '3k' | '4k', quality?: GptQualityId, aspectRatio?: string, referenceCount?: number): string;
1118
1126
  export declare const generateImage: Operation<{
1119
1127
  prompt: string;
1120
1128
  model?: ImageModelId;
@@ -1128,6 +1136,7 @@ export declare const generateImage: Operation<{
1128
1136
  referenceAssetIds?: string[];
1129
1137
  background?: boolean;
1130
1138
  confirm?: boolean;
1139
+ approvedCredits?: number;
1131
1140
  folderId?: string | null;
1132
1141
  }>;
1133
1142
  export declare const editImage: Operation<{
@@ -1151,7 +1160,7 @@ export declare const editImage: Operation<{
1151
1160
  * with no `confirm`, the op answers with the price and the exact prompt, and spends nothing.
1152
1161
  */
1153
1162
  /** The seats the viewer's Cells box offers. Mirrors slate's `GRID_EXTRACT_MODELS` (`shared/prompts/storyboard-grids.ts`), which this package cannot import. */
1154
- declare const GRID_EXTRACT_SEATS: readonly ["nano-banana-2-1", "flux-3", "seedream-5-lite"];
1163
+ declare const GRID_EXTRACT_SEATS: readonly ["nano-banana-2-1", "flux-3", "seedream-5-5"];
1155
1164
  export declare const extractGridCells: Operation<{
1156
1165
  projectId: string;
1157
1166
  assetId: string;
@@ -3,7 +3,7 @@ import { STYLE_LIBRARY, DEFAULT_STYLE_ID } from '../prompts/style-library.js';
3
3
  import { discoverGuides, guideCatalog } from '../prompts/guide-discovery.js';
4
4
  import { retrieveGuide, servedDepth } from '../prompts/guide-retrieval.js';
5
5
  import { BRAIN_ROUTER, MY_BRAIN_TOPIC, ROUTER_ALIASES } from '../prompts/brain.js';
6
- import { MINIMAX_MAX_REFERENCE, minimaxMaxReferenceTokens, MODEL_CAPABILITIES, RETIRED_MODELS, retiredModelOfKey, checkReferenceShape, GPT_QUALITY_TIERS, DEFAULT_GPT_QUALITY, GPT_BACKGROUNDS } from '../prompts/model-capabilities.js';
6
+ import { MINIMAX_MAX_REFERENCE, minimaxMaxReferenceTokens, MODEL_CAPABILITIES, RETIRED_MODELS, retiredModelOfKey, checkReferenceShape, GPT_QUALITY_TIERS, DEFAULT_GPT_QUALITY, GPT_BACKGROUNDS, seedream55CostKey } from '../prompts/model-capabilities.js';
7
7
  // Operations layer — the ONE place every Slates agent tool is defined.
8
8
  // Both the MCP server and the CLI register these as their tool / command
9
9
  // surface. Every operation:
@@ -1870,7 +1870,7 @@ export const estimateGenerationCost = {
1870
1870
  seedanceRealFace: z.boolean().optional().describe('Seedance with a consented real person (premium key).'),
1871
1871
  videoRefSeconds: z.number().nonnegative().optional().describe('Combined reference-video seconds, measured from the clips.'),
1872
1872
  audioRefSeconds: z.number().nonnegative().optional().describe('Combined reference-audio seconds, including attached character voices.'),
1873
- referenceImages: z.number().int().min(0).optional().describe(`MiniMax H3 rows only — how many reference IMAGES the generation will carry. Each image past the row's free allowance is a paid dimension of the cost key, so a quote that omits this UNDER-REPORTS a reference-heavy job. The allowances differ: minimax-h3 gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3']} free, minimax-h3-max gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3-max']}. Ignored by every other model. Start/end frames are free on both rows and are not reference images.`),
1873
+ referenceImages: z.number().int().min(0).optional().describe(`MiniMax H3 rows and seedream-5-5 — how many reference IMAGES the generation will carry. They are a paid dimension of the cost key, so a quote that omits this UNDER-REPORTS a reference-heavy job. seedream-5-5 pays for every input image, @mention pictures included, and an edit's source picture counts as one. The MiniMax allowances differ: minimax-h3 gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3']} free, minimax-h3-max gives ${MINIMAX_FREE_REF_IMAGES_BY_MODEL['minimax-h3-max']}; start/end frames are free on both rows and are not reference images. Ignored by every other model.`),
1874
1874
  }),
1875
1875
  async run(input, ctx) {
1876
1876
  // A retired seat is never quoted: its keys still bill older desktops, and `nano-banana-2-1k` (the
@@ -1897,7 +1897,7 @@ export const estimateGenerationCost = {
1897
1897
  // generation quoted 1 cr for a 2 cr job. Four separate copies of one
1898
1898
  // default is what made that possible; there are now none.
1899
1899
  if (img)
1900
- key = imageCostKey(img, input.resolution ?? defaultImageResolutionFor(img), input.quality, input.aspectRatio);
1900
+ key = imageCostKey(img, input.resolution ?? defaultImageResolutionFor(img), input.quality, input.aspectRatio, input.referenceImages ?? 0);
1901
1901
  }
1902
1902
  // 2a) audio base id → seconds. Both surfaces bill per second, so a
1903
1903
  // duration is always required. Runs BEFORE the video resolver: it is
@@ -2038,7 +2038,7 @@ export const estimateGenerationCost = {
2038
2038
  // Before the card on purpose: the desktop strips a repeated card by cutting
2039
2039
  // the text at "--- HOW TO PROMPT", and this line must survive that.
2040
2040
  const ownImage = IMAGE_MODELS.includes(input.model) ? input.model : null;
2041
- const cheaper = ownImage ? cheaperImageOptions(byKey, perCredits, ownImage, input.aspectRatio) : null;
2041
+ const cheaper = ownImage ? cheaperImageOptions(byKey, perCredits, ownImage, input.aspectRatio, input.referenceImages ?? 0) : null;
2042
2042
  const framing = input.aspectRatio ?? '16:9';
2043
2043
  const unpricedNote = cheaper?.unpriced.length
2044
2044
  ? ` Not on the price list at ${framing}: ${cheaper.unpriced.join(', ')}; estimate one directly to price it.`
@@ -2985,7 +2985,7 @@ export const IMAGE_MODELS = [
2985
2985
  'gpt-image-2-6-flare',
2986
2986
  'gpt-image-2-6-sunburst',
2987
2987
  'flux-3',
2988
- 'seedream-5-lite',
2988
+ 'seedream-5-5',
2989
2989
  ];
2990
2990
  /** True for either GPT Image seat. Flare and Sunburst differ in latency
2991
2991
  * and routing advice, never in pricing shape or param surface. */
@@ -3020,6 +3020,45 @@ async function gptImageSeatFor(desktop, model, feature) {
3020
3020
  function gptImageSubstitution(asked, sent) {
3021
3021
  return sent === asked ? '' : `${sent} ran in place of ${asked}, at the same price: this Slates desktop predates GPT Image 2.6. Update Slates to run 2.6.`;
3022
3022
  }
3023
+ /**
3024
+ * The image seats that take `backgroundMode` (transparent / opaque / auto): both
3025
+ * GPT Image seats and Seedream 5.5 (BytePlus `background`, read 2026-11-16). The
3026
+ * desktop's twin is the `transparentBackground` feature on its registry rows,
3027
+ * which shows the Background control; the wire field is `gptBackground` for
3028
+ * every seat, a name kept from when GPT Image was the only one.
3029
+ */
3030
+ export function takesBackgroundMode(model) {
3031
+ return isGptImageModel(model) || model === 'seedream-5-5';
3032
+ }
3033
+ /** The default image seat before Seedream 5.5 took it, which an older desktop still renders. */
3034
+ const PREVIOUS_DEFAULT_IMAGE_MODEL = 'gpt-image-2-6-sunburst';
3035
+ /**
3036
+ * The seat to run when the caller left `model` out, on this desktop. Seedream
3037
+ * 5.5 is the default, and only a desktop advertising `image-models-v6` (1.7.0
3038
+ * and newer) knows it: an older one would render its Nano Banana fallback at a
3039
+ * Seedream quote. So an unnamed call on such a desktop runs the previous
3040
+ * default, which it knows, and the result says so; a call that NAMES Seedream
3041
+ * 5.5 is refused with the update message instead, since the caller asked for it.
3042
+ */
3043
+ async function defaultImageSeatFor(desktop, named, feature) {
3044
+ const model = named ?? DEFAULT_IMAGE_MODEL;
3045
+ if (model !== 'seedream-5-5')
3046
+ return { model, note: '' };
3047
+ if (named) {
3048
+ await desktop().requireCapability('image-models-v6', feature);
3049
+ return { model, note: '' };
3050
+ }
3051
+ try {
3052
+ await desktop().requireCapability('image-models-v6', feature);
3053
+ return { model, note: '' };
3054
+ }
3055
+ catch {
3056
+ return {
3057
+ model: PREVIOUS_DEFAULT_IMAGE_MODEL,
3058
+ note: `${PREVIOUS_DEFAULT_IMAGE_MODEL} ran as the default image model: this Slates desktop predates Seedream 5.5, the default now. Update Slates to run it.`,
3059
+ };
3060
+ }
3061
+ }
3023
3062
  /** True for either Gemini Omni Flash 1.2 seat, generation or edit. */
3024
3063
  export function isOmniFlash12Model(model) {
3025
3064
  return model === 'omni-flash-1-2' || model === 'omni-flash-1-2-edit';
@@ -3142,11 +3181,19 @@ function gptKeyAspect(aspectRatio) {
3142
3181
  // imports it and asserts, key by key, that it equals the desktop's
3143
3182
  // `imageCreditKey`. Before that check existed the byte-match was a comment and
3144
3183
  // a hope — the two are in different repos and nothing compared them.
3145
- export function imageCostKey(model, resolution, quality = DEFAULT_GPT_QUALITY, aspectRatio) {
3184
+ /**
3185
+ * BytePlus bills every input image of a Seedream 5.5 call, so its key names the
3186
+ * reference count (`seedream55CostKey`, model-capabilities.ts), and a quote made
3187
+ * before the desktop composes @mention pictures can be short of the bill.
3188
+ */
3189
+ function billsEachInputImage(model) {
3190
+ return model === 'seedream-5-5';
3191
+ }
3192
+ export function imageCostKey(model, resolution, quality = DEFAULT_GPT_QUALITY, aspectRatio, referenceCount = 0) {
3146
3193
  if (model === 'flux-3')
3147
3194
  return `flux-3-${resolution}`;
3148
- if (model === 'seedream-5-lite')
3149
- return 'seedream-5-lite';
3195
+ if (billsEachInputImage(model))
3196
+ return seedream55CostKey(resolution, referenceCount);
3150
3197
  if (isGptImageModel(model))
3151
3198
  return `${model}-${gptKeyTier(quality)}-${resolution}${gptKeyAspect(aspectRatio)}`;
3152
3199
  return `nano-banana-2-1-${resolution}`;
@@ -3166,7 +3213,7 @@ export function imageCostKey(model, resolution, quality = DEFAULT_GPT_QUALITY, a
3166
3213
  * Which seat is right stays the agent's call ("cheap" and "best" trade), so
3167
3214
  * nothing is routed here: the comparison is a fact in front of it instead.
3168
3215
  */
3169
- function cheaperImageOptions(byKey, than, own, aspectRatio) {
3216
+ function cheaperImageOptions(byKey, than, own, aspectRatio, referenceCount = 0) {
3170
3217
  const all = [];
3171
3218
  const unpriced = [];
3172
3219
  for (const model of IMAGE_MODELS) {
@@ -3175,7 +3222,7 @@ function cheaperImageOptions(byKey, than, own, aspectRatio) {
3175
3222
  let best = null;
3176
3223
  for (const resolution of MODEL_CAPABILITIES[model]?.imageResolutions ?? []) {
3177
3224
  for (const quality of qualities) {
3178
- const credits = byKey.get(imageCostKey(model, resolution, quality, aspectRatio));
3225
+ const credits = byKey.get(imageCostKey(model, resolution, quality, aspectRatio, referenceCount));
3179
3226
  if (credits == null)
3180
3227
  continue;
3181
3228
  const better = !best || credits < best.credits || (credits === best.credits && ((resolution === fallback && best.resolution !== fallback) ||
@@ -3228,13 +3275,14 @@ export const generateImage = {
3228
3275
  projectId: z.string().uuid().optional().describe(`Save into this Slates project. Renderer refreshes live. Required for every model except ${HEADLESS_IMAGE_MODEL}.`),
3229
3276
  resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('Omit for the selected model default. Override for a specific delivery size; use the same setting when estimating.'),
3230
3277
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image only. Default ${DEFAULT_GPT_QUALITY}; estimate the chosen tier before generation.`),
3231
- backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe('GPT Image only. transparent = alpha channel. Free.'),
3278
+ backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe(`${IMAGE_MODELS.filter(takesBackgroundMode).join(', ')} only. transparent = alpha channel (PNG). Free.`),
3232
3279
  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)}`),
3233
3280
  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}. A 2x2 or 3x3 grid in one picture is a Shot's or the prompt box's Grid (params.gridMode), not count.`),
3234
3281
  referenceImageUrls: z.array(z.string().url()).max(14).optional().describe(`Headless (no projectId) ${HEADLESS_IMAGE_MODEL} only. With a projectId, upload via slates_upload_reference_image. Label every image role in the prompt.`),
3235
3282
  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: ${describeReferenceImageCaps(IMAGE_MODELS)}. Label every reference role in the prompt.`),
3236
3283
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
3237
3284
  confirm: z.boolean().optional().describe(CONFIRM_PARAM),
3285
+ approvedCredits: z.number().int().positive().optional().describe('Only after a reply with `quote_exceeded`: the credits that reply named, once the user has approved them. The desktop counts @mention pictures as paid inputs on seedream-5-5 and runs nothing above the approved total.'),
3238
3286
  folderId: z.string().uuid().nullable().optional().describe(`${FOLDER_DESCRIBE} Needs projectId.`),
3239
3287
  }),
3240
3288
  async run(input, ctx) {
@@ -3252,7 +3300,10 @@ export const generateImage = {
3252
3300
  // HEADLESS_IMAGE_MODEL without one, because it is the only headless seat. The
3253
3301
  // desktop resolves the same seat for its cost and plan-model guards
3254
3302
  // (`imageModelFor`, slate src/main/studio-agent/guards.ts): change both together.
3255
- const imageModel = input.model ?? (input.projectId ? DEFAULT_IMAGE_MODEL : HEADLESS_IMAGE_MODEL);
3303
+ const seat = input.projectId
3304
+ ? await defaultImageSeatFor(() => ctx.desktop(), input.model, `${input.model ?? DEFAULT_IMAGE_MODEL} generation`)
3305
+ : { model: input.model ?? HEADLESS_IMAGE_MODEL, note: '' };
3306
+ const imageModel = seat.model;
3256
3307
  requireGuideRead(ctx, imageModel);
3257
3308
  const promptWarning = bannedTokenWarning(input.prompt, 'image', promptingSkillFor(imageModel));
3258
3309
  input = { ...input, resolution: input.resolution ?? defaultImageResolutionFor(imageModel) };
@@ -3349,7 +3400,7 @@ export const generateImage = {
3349
3400
  if (input.projectId && (input.count ?? 1) > LEGACY_DESKTOP_IMAGE_BATCH) {
3350
3401
  await ctx.desktop().requireCapability('image-variations', 'more than 4 images per call');
3351
3402
  }
3352
- const costKey = imageCostKey(imageModel, resolution, input.quality, input.aspectRatio ?? '1:1');
3403
+ const costKey = imageCostKey(imageModel, resolution, input.quality, input.aspectRatio ?? '1:1', referenceAssetIds.length);
3353
3404
  const cloud = ctx.cloud();
3354
3405
  const registry = await cloud.get('/api/agent/models');
3355
3406
  const entry = registry.models.find((m) => m.model === costKey) ??
@@ -3419,11 +3470,27 @@ export const generateImage = {
3419
3470
  resolution,
3420
3471
  aspectRatio: input.aspectRatio ?? '1:1',
3421
3472
  count: input.count ?? 1,
3422
- ...(isGptImageModel(imageModel) ? { gptQuality: input.quality ?? DEFAULT_GPT_QUALITY, gptBackground: input.backgroundMode } : {}),
3473
+ ...(isGptImageModel(imageModel) ? { gptQuality: input.quality ?? DEFAULT_GPT_QUALITY } : {}),
3474
+ ...(takesBackgroundMode(imageModel) ? { gptBackground: input.backgroundMode } : {}),
3423
3475
  ...(referenceAssetIds.length > 0 ? { referenceAssetIds } : {}),
3476
+ // The desktop adds @mention pictures this op cannot see; on a seat that bills
3477
+ // each input it runs nothing above what the user was quoted or approved.
3478
+ ...(billsEachInputImage(sentModel) ? { maxCredits: Math.max(totalCents, input.approvedCredits ?? 0) } : {}),
3424
3479
  ...folderBody(input.folderId),
3425
3480
  background: input.background,
3426
3481
  });
3482
+ if (result.quoteExceeded) {
3483
+ const { credits, costKey: billedKey } = result.quoteExceeded;
3484
+ return ok({
3485
+ requires_confirm: true,
3486
+ quote_exceeded: true,
3487
+ model: billedKey,
3488
+ estimated_cents: credits,
3489
+ estimated_credits: credits,
3490
+ message: `Nothing ran. The @mention pictures in the prompt are paid inputs on ${imageModel}: this call bills ${fmtCredits(credits)} (${billedKey}), ` +
3491
+ `not the ${fmtCredits(totalCents)} quoted. Tell the user, and once they approve, re-call with confirm=true and approvedCredits=${credits}.`,
3492
+ });
3493
+ }
3427
3494
  // Partial multi-image failure: the desktop attaches an error message
3428
3495
  // but result.assets still holds the images that DID save. Throwing
3429
3496
  // here would discard real, paid-for assets and invite a full retry
@@ -3432,7 +3499,7 @@ export const generateImage = {
3432
3499
  if (!result.success && !partialFailure) {
3433
3500
  throw new Error(result.error ?? 'Generation failed');
3434
3501
  }
3435
- const substitution = gptImageSubstitution(imageModel, sentModel);
3502
+ const substitution = [seat.note, gptImageSubstitution(imageModel, sentModel)].filter(Boolean).join(' ');
3436
3503
  if (result.background) {
3437
3504
  const ids = result.generationIds ?? (result.generationId ? [result.generationId] : []);
3438
3505
  return backgroundSubmitted(`${imageModel} image generation`, ids, {
@@ -3619,9 +3686,9 @@ export const editImage = {
3619
3686
  prompt: z.string().min(1).max(4000).describe('The change, not the whole image. @name and #look words attach nothing here: pass those pictures in referenceAssetIds.'),
3620
3687
  editModel: zEnum(IMAGE_MODELS).optional(),
3621
3688
  referenceAssetIds: z.array(z.string().uuid().describe(ASSET_UUID_ONLY)).max(Math.max(...IMAGE_MODELS.map(editReferenceCap))).optional().describe(`Images beside the source, which is image 1. Each model's own cap: ${IMAGE_MODELS.map((m) => `${m} ${editReferenceCap(m)}`).join(', ')}.`),
3622
- resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe('3k = GPT Image/seedream-5-lite only.'),
3689
+ resolution: z.enum(['1k', '2k', '3k', '4k']).optional().describe(`Omit for the model's default. Per model: ${IMAGE_MODELS.map((m) => `${m} ${(MODEL_CAPABILITIES[m]?.imageResolutions ?? []).join('/')}`).join(', ')}.`),
3623
3690
  quality: z.enum(GPT_QUALITY_TIERS).optional().describe(`GPT Image tier; default ${DEFAULT_GPT_QUALITY}.`),
3624
- backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe('GPT Image only. transparent = alpha channel. Free.'),
3691
+ backgroundMode: z.enum(GPT_BACKGROUNDS).optional().describe(`${IMAGE_MODELS.filter(takesBackgroundMode).join(', ')} only. transparent = alpha channel (PNG). Free.`),
3625
3692
  aspectRatio: z.string().optional(),
3626
3693
  confirm: z.boolean().optional().describe(CONFIRM_PARAM),
3627
3694
  background: z.boolean().optional().describe(BACKGROUND_DESCRIBE),
@@ -3632,8 +3699,14 @@ export const editImage = {
3632
3699
  if (input.background) {
3633
3700
  await desktop.requireCapability('background-generation', 'background generation');
3634
3701
  }
3635
- // The image-edit tool's seat (TOOL_SEAT), the model the app's own Edit uses.
3636
- const editModel = input.editModel ?? toolModelFor('image-edit');
3702
+ // The image-edit tool's seat (TOOL_SEAT), the model the app's own Edit uses;
3703
+ // on a desktop that predates Seedream 5.5, the seat it knows (defaultImageSeatFor).
3704
+ const seat = input.editModel
3705
+ ? await defaultImageSeatFor(() => desktop, input.editModel, `${input.editModel} editing`)
3706
+ : toolModelFor('image-edit') === DEFAULT_IMAGE_MODEL
3707
+ ? await defaultImageSeatFor(() => desktop, undefined, 'image editing')
3708
+ : { model: toolModelFor('image-edit'), note: '' };
3709
+ const editModel = seat.model;
3637
3710
  requireGuideRead(ctx, editModel);
3638
3711
  const resolution = input.resolution ?? defaultImageResolutionFor(editModel);
3639
3712
  let sentModel = editModel;
@@ -3651,13 +3724,15 @@ export const editImage = {
3651
3724
  }
3652
3725
  // Past the model's cap the desktop sends the first ones and says so in its reply (`note`).
3653
3726
  const referencesOver = (input.referenceAssetIds?.length ?? 0) - editReferenceCap(editModel);
3654
- // Nano Banana and GPT Image edits charge the same key as gen;
3655
- // FLUX / Seedream route to dedicated edit endpoints priced under '-edit' keys.
3727
+ // Nano Banana and GPT Image edits charge the same key as gen; FLUX routes to
3728
+ // a dedicated edit endpoint priced under an '-edit' key; Seedream 5.5 bills
3729
+ // every input image, the source included, so its key counts them.
3656
3730
  // Mirrors `editCreditKey` in the desktop's src/shared/imageEdit.ts, which
3657
3731
  // this package cannot import: change both together.
3658
- const costKey = editModel === 'flux-3' || editModel === 'seedream-5-lite'
3732
+ const editInputs = 1 + Math.min(input.referenceAssetIds?.length ?? 0, editReferenceCap(editModel));
3733
+ const costKey = editModel === 'flux-3'
3659
3734
  ? `${imageCostKey(editModel, resolution)}-edit`
3660
- : imageCostKey(editModel, resolution, input.quality, input.aspectRatio);
3735
+ : imageCostKey(editModel, resolution, input.quality, input.aspectRatio, editInputs);
3661
3736
  const cloud = ctx.cloud();
3662
3737
  const registry = await cloud.get('/api/agent/models');
3663
3738
  const entry = registry.models.find((m) => m.model === costKey) ??
@@ -3686,13 +3761,14 @@ export const editImage = {
3686
3761
  editModel: sentModel,
3687
3762
  referenceAssetIds: input.referenceAssetIds,
3688
3763
  resolution,
3689
- ...(isGptImageModel(editModel) ? { gptQuality: input.quality ?? DEFAULT_GPT_QUALITY, gptBackground: input.backgroundMode } : {}),
3764
+ ...(isGptImageModel(editModel) ? { gptQuality: input.quality ?? DEFAULT_GPT_QUALITY } : {}),
3765
+ ...(takesBackgroundMode(editModel) ? { gptBackground: input.backgroundMode } : {}),
3690
3766
  aspectRatio: input.aspectRatio,
3691
3767
  background: input.background,
3692
3768
  });
3693
3769
  if (!result.success)
3694
3770
  throw new Error(result.error ?? 'Image edit failed');
3695
- const substitution = gptImageSubstitution(editModel, sentModel);
3771
+ const substitution = [seat.note, gptImageSubstitution(editModel, sentModel)].filter(Boolean).join(' ');
3696
3772
  if (result.background) {
3697
3773
  const ids = result.generationIds ?? (result.generationId ? [result.generationId] : []);
3698
3774
  return backgroundSubmitted(`${editModel} image edit`, ids, {
@@ -3750,7 +3826,7 @@ export const editImage = {
3750
3826
  * with no `confirm`, the op answers with the price and the exact prompt, and spends nothing.
3751
3827
  */
3752
3828
  /** The seats the viewer's Cells box offers. Mirrors slate's `GRID_EXTRACT_MODELS` (`shared/prompts/storyboard-grids.ts`), which this package cannot import. */
3753
- const GRID_EXTRACT_SEATS = ['nano-banana-2-1', 'flux-3', 'seedream-5-lite'];
3829
+ const GRID_EXTRACT_SEATS = ['nano-banana-2-1', 'flux-3', 'seedream-5-5'];
3754
3830
  export const extractGridCells = {
3755
3831
  id: 'slates_extract_grid_cells',
3756
3832
  billable: true,
@@ -9065,7 +9141,7 @@ export function resolveGuideTopic(topic) {
9065
9141
  if (t.startsWith('flux'))
9066
9142
  return 'slates-prompting-flux-3';
9067
9143
  if (t.startsWith('seedream'))
9068
- return 'slates-prompting-seedream-5-lite';
9144
+ return 'slates-prompting-seedream-5-5';
9069
9145
  if (t.startsWith('omni-flash') || t.startsWith('gemini-omni') || t === 'omni flash')
9070
9146
  return 'slates-prompting-omni-flash';
9071
9147
  if (t.startsWith('wan') || t === 'alibaba-wan-3.0')
@@ -2,7 +2,7 @@
2
2
  * This is NOT a model capability or provider batch limit. Desktop mirror is
3
3
  * generated by slate/scripts/sync-generation-policy.mjs; never edit it there. */
4
4
  export declare const IMAGE_QUANTITIES: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
5
- export declare const MAX_IMAGE_VARIATIONS: 9 | 3 | 1 | 4 | 5 | 2 | 6 | 10 | 8 | 7;
5
+ export declare const MAX_IMAGE_VARIATIONS: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
6
6
  export type ImageQuantity = typeof IMAGE_QUANTITIES[number];
7
7
  export declare const clampImageQuantity: (count?: number) => ImageQuantity;
8
8
  /** Default saved-recipe framing, shared by composer restore, quote and dispatch. */
@@ -26,8 +26,13 @@ export const DEFAULT_SHOT_ASPECT_RATIO = '16:9';
26
26
  export const BUILT_IN_TOOLS = ['character-sheet', 'environment-plate', 'grid-extract', 'image-edit'];
27
27
  export const DEFAULT_IMAGE_SEAT = 'default-image';
28
28
  export const TOOL_SEAT = {
29
- 'character-sheet': DEFAULT_IMAGE_SEAT,
30
- 'environment-plate': DEFAULT_IMAGE_SEAT,
29
+ // Pinned to the seat they ran on when Seedream 5.5 became the default image
30
+ // model (2026-11-16). A sheet is a panelled identity frame built from one base
31
+ // image, the layout work GPT Image is routed for, and on Seedream 5.5 every
32
+ // input image bills on its own; moving the sheets is a pick with a side-by-side
33
+ // of its own, not a side effect of the default changing.
34
+ 'character-sheet': 'gpt-image-2-6-sunburst',
35
+ 'environment-plate': 'gpt-image-2-6-sunburst',
31
36
  // Pinned: the image viewer offers grid extraction a fixed short list of seats,
32
37
  // and the cell-extraction prompt has a variant per seat family. Moving it is a
33
38
  // picker and a prompt change first.
@@ -102,6 +102,45 @@ export declare const GPT_IMAGE_25_SIZES: Record<string, Record<string, {
102
102
  width: number;
103
103
  height: number;
104
104
  }>>;
105
+ /**
106
+ * Seedream 5.5's output `size` (`WxH`) per Slates rung and aspect ratio, sent to
107
+ * BytePlus ModelArk direct (`dola-seedream-5-5-261028`).
108
+ *
109
+ * 🚨 A BILLING INPUT. BytePlus bills an output by its total pixels P: $0.020 when
110
+ * P ≤ 1536² × 1.05² (2,601,123.84), $0.035 up to 2048² × 1.05² (4,624,220.16)
111
+ * (pricing page, ripped 2026-11-16 to second-brain/business/projects/slates/
112
+ * provider-docs/byteplus-seedream-5-5-docs.md). The proxy derives the cost key's
113
+ * rung from the body's `size` by that same line (`seedream55RungOfSize`), so every
114
+ * size here must sit inside its rung's band.
115
+ *
116
+ * Rungs are named by pixel width, as GPT Image's are (`2k` ≈ 2048 px wide, `3k`
117
+ * ≈ 2816): `2k` is BytePlus's "1.5K" preset class, `3k` its "2K" class. The 1K
118
+ * preset is not offered: it bills the same $0.020 as 1.5K for a smaller picture.
119
+ * Eight aspects are BytePlus's own preset dimensions (API reference, `size`,
120
+ * "Seedream 5.5 (image generation)"); `4:5` and `5:4`, which it does not list,
121
+ * hold the 1:1 preset's pixel count in multiples of 8. Exact `WxH` is sent rather
122
+ * than a bare preset because a preset lets the prompt choose the aspect.
123
+ * BytePlus's band: total pixels [921,600, 4,624,220], aspect [1/16, 16].
124
+ */
125
+ export declare const SEEDREAM_5_5_SIZES: Record<'2k' | '3k', Record<AspectRatio, {
126
+ width: number;
127
+ height: number;
128
+ }>>;
129
+ /** BytePlus's pixel line between Seedream 5.5's two price tiers, and its band. */
130
+ export declare const SEEDREAM_5_5_PIXEL_BOUNDS: {
131
+ readonly min: 921600;
132
+ readonly tierLine: 2601123;
133
+ readonly max: 4624220;
134
+ };
135
+ /**
136
+ * The rung a Seedream 5.5 `WxH` bills at, by BytePlus's pixel line, or null when
137
+ * the size is outside the band or malformed. The proxy's one reading of a 5.5
138
+ * request's price tier; the desktop's sizes come from `SEEDREAM_5_5_SIZES`.
139
+ */
140
+ export declare function seedream55RungOfSize(size: unknown): '2k' | '3k' | null;
141
+ export declare function seedream55CostKey(resolution: string | undefined, referenceCount: number): string;
142
+ /** Seedream 5.5's `size` string for a rung and aspect ratio. */
143
+ export declare function seedream55Size(aspectRatio: string | undefined, resolution: string | undefined): string;
105
144
  /**
106
145
  * fal's named ~1MP presets per aspect ratio, with custom dims where fal has no
107
146
  * preset. The `1k` rung of every non-GPT image model resolves through this.
@@ -151,6 +151,100 @@ export const GPT_IMAGE_25_SIZES = {
151
151
  '3:4': { width: 2448, height: 3264 },
152
152
  },
153
153
  };
154
+ /**
155
+ * Seedream 5.5's output `size` (`WxH`) per Slates rung and aspect ratio, sent to
156
+ * BytePlus ModelArk direct (`dola-seedream-5-5-261028`).
157
+ *
158
+ * 🚨 A BILLING INPUT. BytePlus bills an output by its total pixels P: $0.020 when
159
+ * P ≤ 1536² × 1.05² (2,601,123.84), $0.035 up to 2048² × 1.05² (4,624,220.16)
160
+ * (pricing page, ripped 2026-11-16 to second-brain/business/projects/slates/
161
+ * provider-docs/byteplus-seedream-5-5-docs.md). The proxy derives the cost key's
162
+ * rung from the body's `size` by that same line (`seedream55RungOfSize`), so every
163
+ * size here must sit inside its rung's band.
164
+ *
165
+ * Rungs are named by pixel width, as GPT Image's are (`2k` ≈ 2048 px wide, `3k`
166
+ * ≈ 2816): `2k` is BytePlus's "1.5K" preset class, `3k` its "2K" class. The 1K
167
+ * preset is not offered: it bills the same $0.020 as 1.5K for a smaller picture.
168
+ * Eight aspects are BytePlus's own preset dimensions (API reference, `size`,
169
+ * "Seedream 5.5 (image generation)"); `4:5` and `5:4`, which it does not list,
170
+ * hold the 1:1 preset's pixel count in multiples of 8. Exact `WxH` is sent rather
171
+ * than a bare preset because a preset lets the prompt choose the aspect.
172
+ * BytePlus's band: total pixels [921,600, 4,624,220], aspect [1/16, 16].
173
+ */
174
+ export const SEEDREAM_5_5_SIZES = {
175
+ '2k': {
176
+ '1:1': { width: 1536, height: 1536 },
177
+ '16:9': { width: 2048, height: 1152 },
178
+ '9:16': { width: 1152, height: 2048 },
179
+ '4:3': { width: 1792, height: 1344 },
180
+ '3:4': { width: 1344, height: 1792 },
181
+ '3:2': { width: 1872, height: 1248 },
182
+ '2:3': { width: 1248, height: 1872 },
183
+ '5:4': { width: 1720, height: 1376 },
184
+ '4:5': { width: 1376, height: 1720 },
185
+ '21:9': { width: 2352, height: 1008 },
186
+ },
187
+ '3k': {
188
+ '1:1': { width: 2048, height: 2048 },
189
+ '16:9': { width: 2816, height: 1584 },
190
+ '9:16': { width: 1584, height: 2816 },
191
+ '4:3': { width: 2368, height: 1776 },
192
+ '3:4': { width: 1776, height: 2368 },
193
+ '3:2': { width: 2496, height: 1664 },
194
+ '2:3': { width: 1664, height: 2496 },
195
+ '5:4': { width: 2288, height: 1832 },
196
+ '4:5': { width: 1832, height: 2288 },
197
+ '21:9': { width: 3136, height: 1344 },
198
+ },
199
+ };
200
+ /** BytePlus's pixel line between Seedream 5.5's two price tiers, and its band. */
201
+ export const SEEDREAM_5_5_PIXEL_BOUNDS = { min: 921_600, tierLine: 2_601_123, max: 4_624_220 };
202
+ /**
203
+ * The rung a Seedream 5.5 `WxH` bills at, by BytePlus's pixel line, or null when
204
+ * the size is outside the band or malformed. The proxy's one reading of a 5.5
205
+ * request's price tier; the desktop's sizes come from `SEEDREAM_5_5_SIZES`.
206
+ */
207
+ export function seedream55RungOfSize(size) {
208
+ if (typeof size !== 'string')
209
+ return null;
210
+ const m = /^(\d{2,5})x(\d{2,5})$/.exec(size);
211
+ if (!m)
212
+ return null;
213
+ const w = Number(m[1]);
214
+ const h = Number(m[2]);
215
+ const pixels = w * h;
216
+ if (w / h < 1 / 16 || w / h > 16)
217
+ return null;
218
+ if (pixels < SEEDREAM_5_5_PIXEL_BOUNDS.min || pixels > SEEDREAM_5_5_PIXEL_BOUNDS.max)
219
+ return null;
220
+ return pixels <= SEEDREAM_5_5_PIXEL_BOUNDS.tierLine ? '2k' : '3k';
221
+ }
222
+ /**
223
+ * Seedream 5.5's billing key: its price rung, then the input-image count when
224
+ * there is one (`seedream-5-5-3k`, `seedream-5-5-3k-ref2`). BytePlus bills each
225
+ * input image ($0.008) on top of the output, so the count is part of the price.
226
+ * THE ONE HOME of the key's shape: the op quote, the desktop's `imageCreditKey`
227
+ * and the proxy's key derivation all call this. Counts clamp to the model's cap,
228
+ * which the proxy refuses past.
229
+ */
230
+ /** A requested rung, or the model's default when none (or an unknown one) is named. */
231
+ function seedream55Rung(resolution) {
232
+ if (resolution === '2k' || resolution === '3k')
233
+ return resolution;
234
+ return MODEL_CAPABILITIES['seedream-5-5']?.defaultImageResolution === '3k' ? '3k' : '2k';
235
+ }
236
+ export function seedream55CostKey(resolution, referenceCount) {
237
+ const rung = seedream55Rung(resolution);
238
+ const cap = MODEL_CAPABILITIES['seedream-5-5']?.maxRefImages ?? 0;
239
+ const refs = Math.max(0, Math.min(cap, Number.isFinite(referenceCount) ? Math.floor(referenceCount) : 0));
240
+ return `seedream-5-5-${rung}${refs > 0 ? `-ref${refs}` : ''}`;
241
+ }
242
+ /** Seedream 5.5's `size` string for a rung and aspect ratio. */
243
+ export function seedream55Size(aspectRatio, resolution) {
244
+ const rung = seedream55Rung(resolution);
245
+ const dims = SEEDREAM_5_5_SIZES[rung][(aspectRatio ?? '16:9')] ?? SEEDREAM_5_5_SIZES[rung]['16:9'];
246
+ return `${dims.width}x${dims.height}`;
247
+ }
154
248
  /**
155
249
  * fal's named ~1MP presets per aspect ratio, with custom dims where fal has no
156
250
  * preset. The `1k` rung of every non-GPT image model resolves through this.
@@ -203,8 +297,11 @@ export function falImageSize(model, aspectRatio, resolution) {
203
297
  if (res === '1k') {
204
298
  return FAL_1MP_SIZES[ar] || 'landscape_16_9';
205
299
  }
206
- // Seedream 5 Lite: custom dims must be ≥3.69MP (2560×1440) and ≤9.44MP
207
- // (3072×3072), so its three rungs target 4 / 7 / 9 MP — all inside that band.
300
+ // Seedream 5 Lite, retired 2026-11-16 for Seedream 5.5 (which never comes
301
+ // here: it runs on BytePlus with `seedream55Size`). Kept because slates-api
302
+ // still validates and bills 5 Lite requests from desktops 1.6.9 and older.
303
+ // Custom dims must be ≥3.69MP (2560×1440) and ≤9.44MP (3072×3072), so its
304
+ // three rungs target 4 / 7 / 9 MP, all inside that band.
208
305
  if (isSeedream5) {
209
306
  if (res === '4k')
210
307
  return computeFalDimensions(ar, 9);
@@ -341,9 +438,17 @@ export const MODEL_CAPABILITIES = {
341
438
  aspectRatios: FULL_ASPECT_RATIOS,
342
439
  maxRefImages: 10,
343
440
  },
344
- 'seedream-5-lite': {
345
- defaultImageResolution: '2k',
346
- imageResolutions: ['2k', '3k', '4k'],
441
+ // Seedream 5.5 on BytePlus ModelArk direct (`dola-seedream-5-5-261028`),
442
+ // replacing Seedream 5 Lite 2026-11-16 (Eric) and THE DEFAULT IMAGE SEAT
443
+ // (MODEL_FACTS tier). Read off the ModelArk API reference, ripped 2026-11-16
444
+ // (provider-docs/byteplus-seedream-5-5-docs.md): "Seedream 5.5 ... support up
445
+ // to 10 reference images"; aspect ratio [1/16, 16] covers all ten of ours.
446
+ // Rungs and sizes: SEEDREAM_5_5_SIZES above. Default 3k (2816 px wide at
447
+ // 16:9; Eric, 2026-11-16: "Why wouldn't we make the default 3K? It's cheap
448
+ // enough"); 2k is the cheaper option. 5 Lite is in RETIRED_MODELS below.
449
+ 'seedream-5-5': {
450
+ defaultImageResolution: '3k',
451
+ imageResolutions: ['2k', '3k'],
347
452
  aspectRatios: FULL_ASPECT_RATIOS,
348
453
  maxRefImages: 10,
349
454
  },
@@ -832,6 +937,8 @@ export const RETIRED_MODELS = {
832
937
  // 2026-11-10 (Eric, "Yes, same release"): Gemini Omni Flash 1.2 replaced 1.1, seat for seat.
833
938
  'omni-flash': 'omni-flash-1-2',
834
939
  'omni-flash-edit': 'omni-flash-1-2-edit',
940
+ // 2026-11-16 (Eric): Seedream 5.5 replaced Seedream 5 Lite and became the default image seat.
941
+ 'seedream-5-lite': 'seedream-5-5',
835
942
  };
836
943
  /**
837
944
  * The retired seat a cost key bills, or null when the key belongs to a current
@@ -169,11 +169,12 @@ export const MODEL_FACTS = [
169
169
  {
170
170
  id: 'gpt-image-2-6-sunburst',
171
171
  route: 'generate',
172
- tier: 'default',
172
+ // The default image seat until 2026-11-16, when Seedream 5.5 took it (Eric).
173
+ tier: 'specialist',
173
174
  label: 'GPT Image 2.6 Sunburst',
174
175
  kind: 'image',
175
176
  ...caps('gpt-image-2-6-sunburst'),
176
- notes: 'THE QUALITY GPT IMAGE SEAT — OpenAI\'s most capable image model, same price as Flare, deliberately SLOWER. Route here unless speed is the point: finals, hero frames, photoreal people, and multi-reference edits where every reference must survive into one frame. Explore on Flare, finish on Sunburst.',
177
+ notes: 'THE QUALITY GPT IMAGE SEAT — OpenAI\'s most capable image model, same price as Flare, deliberately SLOWER. Route here for polish over realism: designed graphics, dense in-image text and layout, and multi-reference edits where every reference must survive into one frame. Explore on Flare, finish on Sunburst.',
177
178
  },
178
179
  {
179
180
  id: 'flux-3',
@@ -186,13 +187,17 @@ export const MODEL_FACTS = [
186
187
  notes: 'The premium less-filtered image seat: photoreal frames, precise layout and in-image text, at its loosest safety setting, which can still reject a prompt. Auto-routes to its edit endpoint when references are present.',
187
188
  },
188
189
  {
189
- id: 'seedream-5-lite',
190
+ id: 'seedream-5-5',
190
191
  route: 'generate',
191
- tier: 'specialist',
192
- label: 'Seedream 5 Lite',
192
+ tier: 'default',
193
+ // ByteDance's Seedream 5.5 on BytePlus ModelArk direct, replacing Seedream
194
+ // 5 Lite and taking the default image seat from Sunburst, 2026-11-16 (Eric:
195
+ // "there's no comparison in Fidelity for video frames and realistic looking
196
+ // images"). Stored 5 Lite ids migrate through RETIRED_MODELS.
197
+ label: 'Seedream 5.5',
193
198
  kind: 'image',
194
- ...caps('seedream-5-lite'),
195
- notes: 'Cheapest flat-priced image seat (GPT Image at low quality costs less per image). Less filtered, though it can still reject a prompt. Routes to its edit endpoint when references are present.',
199
+ ...caps('seedream-5-5'),
200
+ notes: 'DEFAULT IMAGE MODEL — the realism seat: photoreal people, places and products, and start and end frames for video, where it holds fidelity better than the GPT Image seats. Cheaper than every other seat at full quality (GPT Image on its low and medium tiers costs less) and less filtered, though it can still reject a prompt. Renders a TRANSPARENT background on request (backgroundMode). Go to Sunburst for designed graphics and dense in-image text.',
196
201
  },
197
202
  {
198
203
  id: 'seedance-2',
@@ -62,7 +62,7 @@ export const BRAIN_SHAPE = {
62
62
  "slates-prompting-seed-audio",
63
63
  "slates-prompting-seedance",
64
64
  "slates-prompting-seedance-2-5",
65
- "slates-prompting-seedream-5-lite",
65
+ "slates-prompting-seedream-5-5",
66
66
  "slates-prompting-wan-3"
67
67
  ]
68
68
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slatesvideo/shared",
3
- "version": "0.7.17",
3
+ "version": "0.7.18",
4
4
  "description": "Shared operations layer for the Slates MCP server and CLI: auth, cloud/desktop clients, and the single tool surface both consume. Most users want @slatesvideo/mcp-server or @slatesvideo/cli instead.",
5
5
  "license": "MIT",
6
6
  "type": "module",