@marlinjai/studio-mcp 0.18.1 → 0.21.1

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/index.js CHANGED
@@ -622,6 +622,26 @@ var ROUTES = [
622
622
  withReferences: { "1080p": "fal/kling-o3-pro-reference-to-video" }
623
623
  }
624
624
  },
625
+ {
626
+ kind: "video",
627
+ id: "route/gemini-omni",
628
+ label: "Gemini Omni 1.1 Flash (KIE, fal fallback)",
629
+ primary: "kie/gemini-omni-flash-1-1-image-to-video",
630
+ // fal renders every length KIE does (4 to 10 s in even steps) and the same
631
+ // sizes and shapes, from the same frame fields (2026-11-03). One difference:
632
+ // fal always renders sound with the clip, so a clip that falls back has it.
633
+ fallback: { start: "fal/gemini-omni-flash-1-1-image-to-video" }
634
+ },
635
+ {
636
+ kind: "video",
637
+ id: "route/minimax-h3",
638
+ label: "MiniMax H3 (KIE, fal fallback)",
639
+ primary: "kie/minimax-h3-image-to-video",
640
+ // fal renders KIE's sizes (768P and 2K) and lengths from 5 to 15 s from the
641
+ // same frame fields (2026-11-04); KIE also renders 4 s, which fal does not,
642
+ // so a 4 s clip has no fallback. fal always renders sound with the clip.
643
+ fallback: { start: "fal/minimax-h3-image-to-video" }
644
+ },
625
645
  {
626
646
  kind: "video",
627
647
  id: "route/seedance-2-0",
@@ -921,6 +941,71 @@ var CATALOG_ENTRIES = [
921
941
  description: "ByteDance Seedream 5 Pro edit via fal, up to 10 reference images, 1K or 2K.",
922
942
  capabilities: { resolutions: ["1K", "2K"], needsImageInput: true, maxInputImages: 10 }
923
943
  },
944
+ // ── fal.ai: Ideogram 4.5 Edit, precise local edits ─────────────────────
945
+ {
946
+ id: "fal/ideogram-4-5-edit",
947
+ provider: "fal",
948
+ modality: "image",
949
+ task: "image-edit",
950
+ label: "Ideogram 4.5 Edit (fal)",
951
+ // Measured 2026-11-04 on a series of edits of one portrait: the background
952
+ // held at a structural similarity (SSIM) of 0.9999 between successive
953
+ // edits, against 0.98 for Nano Banana 2 Edit, which reframed the shot on
954
+ // the first edit. Ideogram's first edit smoothed the face a little; after
955
+ // that the face held.
956
+ description: "Ideogram 4.5 in precise edit mode: changes what the prompt asks for (a garment, a prop, the background) and keeps every pixel it did not touch, so a series of edits keeps the shot. Image 1 is the image edited, up to 4 more are references, and the result keeps the shape of image 1. Quality low, medium or high.",
957
+ capabilities: {
958
+ // The tiers carry Ideogram's QUALITY (providers/fal.ts, `ideogramQuality`):
959
+ // 0.5K low, 1K medium (the default), 2K high. fal's very_low is not
960
+ // offered (decided 2026-11-04). Labelled as qualities
961
+ // wherever shown (`imageTierLabel`).
962
+ resolutions: ["0.5K", "1K", "2K"],
963
+ tierKind: "quality",
964
+ editsFirstImage: true,
965
+ needsImageInput: true,
966
+ maxInputImages: 5
967
+ }
968
+ },
969
+ // ── fal.ai: OpenAI GPT Image 2, text in images and exact edits ─────────
970
+ // Added 2026-11-04 (plan 2026-11-04-skool-prompting, item M2): the course
971
+ // Marlin follows names it the best model for rendering text (labels,
972
+ // packaging) and for edits that change only what was asked.
973
+ {
974
+ id: "fal/gpt-image-2",
975
+ provider: "fal",
976
+ modality: "image",
977
+ task: "text-to-image",
978
+ label: "GPT Image 2 (fal)",
979
+ description: "OpenAI GPT Image 2 via fal: the strongest at text inside the image (labels, packaging, signs, posters) and at following long, detailed prompts. Slower than Nano Banana. Quality low, medium or high, about 1 megapixel in every shape; prompts up to about 4000 characters of English (4000 bytes).",
980
+ capabilities: {
981
+ // The tiers carry GPT Image 2's QUALITY (providers/fal.ts,
982
+ // `tierQuality`): 0.5K low, 1K medium (the default), 2K high. The size
983
+ // follows the shape alone (`FAL_GPT_IMAGE_2_SIZE_BY_ASPECT`).
984
+ resolutions: ["0.5K", "1K", "2K"],
985
+ tierKind: "quality",
986
+ maxInputImages: 0
987
+ }
988
+ },
989
+ {
990
+ id: "fal/gpt-image-2-edit",
991
+ provider: "fal",
992
+ modality: "image",
993
+ task: "image-edit",
994
+ label: "GPT Image 2 Edit (fal)",
995
+ description: "OpenAI GPT Image 2 edit via fal: changes only what the prompt asks for and renders text and labels cleanly (packaging, signs). Studio sends the image to edit first and up to 7 references after it; say in the prompt what to change. The result takes the shape you pick: pick the source image's shape to keep it. Slower than Nano Banana. Quality low, medium or high, about 1 megapixel in every shape; prompts up to about 4000 characters of English (4000 bytes).",
996
+ capabilities: {
997
+ resolutions: ["0.5K", "1K", "2K"],
998
+ tierKind: "quality",
999
+ // fal's `image_urls` is a plain list with no field for the image
1000
+ // edited. Studio's convention: the image to edit goes first and the
1001
+ // mention prompt names it image 1, which is what lets the composer, the
1002
+ // generate route and the canvas refuse an edit with no image before
1003
+ // anything is admitted (`editSourceHold`).
1004
+ editsFirstImage: true,
1005
+ needsImageInput: true,
1006
+ maxInputImages: 8
1007
+ }
1008
+ },
924
1009
  {
925
1010
  id: "fal/flux-1-1-pro",
926
1011
  provider: "fal",
@@ -1206,7 +1291,7 @@ var CATALOG_ENTRIES = [
1206
1291
  modality: "video",
1207
1292
  task: "image-to-video",
1208
1293
  label: "Gemini Omni 1.1 Flash (KIE)",
1209
- description: "Google Gemini Omni 1.1 Flash via KIE, first-and-last-frame mode. A start frame and an optional end frame, 4, 6, 8 or 10 s, 720p to 4K, 16:9 or 9:16. KIE refuses registered characters in this mode, so identity comes from the frames alone. Accepted a minted character's photoreal stills on 2026-09-24 (set 9:16 for a portrait still: it defaults to 16:9 and crops). No fal equivalent.",
1294
+ description: "Google Gemini Omni 1.1 Flash via KIE, first-and-last-frame mode. A start frame and an optional end frame, 4, 6, 8 or 10 s, 720p to 4K, 16:9 or 9:16. KIE refuses registered characters in this mode, so identity comes from the frames alone. Accepted a minted character's photoreal stills on 2026-09-24 (set 9:16 for a portrait still: it defaults to 16:9 and crops).",
1210
1295
  capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
1211
1296
  },
1212
1297
  {
@@ -1302,6 +1387,53 @@ var CATALOG_ENTRIES = [
1302
1387
  characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
1303
1388
  }
1304
1389
  },
1390
+ {
1391
+ id: "fal/gemini-omni-flash-1-1-image-to-video",
1392
+ provider: "fal",
1393
+ modality: "video",
1394
+ task: "image-to-video",
1395
+ label: "Gemini Omni 1.1 Flash (image-to-video)",
1396
+ description: "Google Gemini Omni 1.1 Flash via fal, the fallback for the KIE entry and the route that runs images of people. A start frame and an optional end frame, 3 to 10 s, 720p, 1080p or 4K, 16:9 or 9:16 (16:9 unless set, so set 9:16 for a portrait still), with audio included. No seed. Not yet tested with a minted character on fal (the KIE route accepted one).",
1397
+ // 8 s at fal's 720p default, the length and size the KIE entry renders.
1398
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
1399
+ },
1400
+ {
1401
+ id: "fal/kling-3-0-standard-image-to-video",
1402
+ provider: "fal",
1403
+ modality: "video",
1404
+ task: "image-to-video",
1405
+ label: "Kling 3.0 Standard (image-to-video)",
1406
+ description: "Kuaishou Kling 3.0 Standard via fal, a model of its own next to Kling O3 (Kling 3.0 Omni). A start frame and an optional end frame, 3 to 15 s, in the start frame's shape at the tier's size, silent unless the job sets generateAudio. Takes a negative prompt, no seed. Not yet tested with a minted character.",
1407
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
1408
+ },
1409
+ {
1410
+ id: "fal/kling-3-0-pro-image-to-video",
1411
+ provider: "fal",
1412
+ modality: "video",
1413
+ task: "image-to-video",
1414
+ label: "Kling 3.0 Pro (image-to-video)",
1415
+ description: "Kuaishou Kling 3.0 Pro via fal, a model of its own next to Kling O3 (Kling 3.0 Omni). A start frame and an optional end frame, 3 to 15 s, in the start frame's shape at the tier's size, silent unless the job sets generateAudio. Takes a negative prompt, no seed. Not yet tested with a minted character.",
1416
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
1417
+ },
1418
+ {
1419
+ id: "fal/minimax-h3-image-to-video",
1420
+ provider: "fal",
1421
+ modality: "video",
1422
+ task: "image-to-video",
1423
+ label: "MiniMax H3 (image-to-video)",
1424
+ description: "MiniMax H3 via fal (the base model, not fal's post-trained H3 Max), the fallback for the KIE entry and the route that runs images of people. A start frame and an optional end frame, 5 to 15 s, 768p (the 720p setting), 2K (the 1080p setting, used unless set) or 4K, in the start frame's shape, always with sound. Takes a seed, no negative prompt. Rendered a 5 s test clip on 2026-11-04; not yet tested with a minted character on fal (the KIE route accepted one).",
1425
+ // 5 s at fal's 2K default.
1426
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
1427
+ },
1428
+ {
1429
+ id: "fal/kling-4-0-image-to-video",
1430
+ provider: "fal",
1431
+ modality: "video",
1432
+ task: "image-to-video",
1433
+ label: "Kling 4.0 (image-to-video)",
1434
+ description: "Kuaishou Kling 4.0 via fal; not served by KIE. A start frame and an optional end frame, 3 to 30 s, 720p or 1080p (1080p unless set), in the start frame's shape, always with sound. No seed or negative prompt. fal also takes in-between keyframes and per-shot prompts, which Studio does not send yet. Rendered a 3 s test clip on 2026-11-03; not yet tested with a minted character.",
1435
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
1436
+ },
1305
1437
  {
1306
1438
  id: "fal/ltx-2-5-fast-image-to-video",
1307
1439
  provider: "fal",
@@ -1655,6 +1787,18 @@ function routeEntry(id) {
1655
1787
  function tryGetModel(id) {
1656
1788
  return MODEL_CATALOG.find((m) => m.id === id) ?? routeEntry(id);
1657
1789
  }
1790
+ var ASPECT_RATIOS = [
1791
+ "1:1",
1792
+ "3:2",
1793
+ "2:3",
1794
+ "3:4",
1795
+ "4:3",
1796
+ "4:5",
1797
+ "5:4",
1798
+ "9:16",
1799
+ "16:9",
1800
+ "21:9"
1801
+ ];
1658
1802
  function omniReferencesPrompt(prompt, elements) {
1659
1803
  const parts = ["Image 1 is the exact scene and the first frame of the video: start the clip on it and keep its setting, framing and light."];
1660
1804
  let next = 2;
@@ -1985,6 +2129,12 @@ var KLING_26_I2V_ENDPOINT = "fal-ai/kling-video/v2.6/pro/image-to-video";
1985
2129
  var KLING_O3_STANDARD_I2V_ENDPOINT = "fal-ai/kling-video/o3/standard/image-to-video";
1986
2130
  var KLING_O3_PRO_I2V_ENDPOINT = "fal-ai/kling-video/o3/pro/image-to-video";
1987
2131
  var KLING_O3_I2V_ENDPOINTS = [KLING_O3_STANDARD_I2V_ENDPOINT, KLING_O3_PRO_I2V_ENDPOINT];
2132
+ var GEMINI_OMNI_11_I2V_ENDPOINT = "google/gemini-omni-flash/v1.1/image-to-video";
2133
+ var KLING_V3_STANDARD_I2V_ENDPOINT = "fal-ai/kling-video/v3/standard/image-to-video";
2134
+ var KLING_V3_PRO_I2V_ENDPOINT = "fal-ai/kling-video/v3/pro/image-to-video";
2135
+ var KLING_V3_I2V_ENDPOINTS = [KLING_V3_STANDARD_I2V_ENDPOINT, KLING_V3_PRO_I2V_ENDPOINT];
2136
+ var KLING_V4_I2V_ENDPOINT = "kling/v4/image-to-video";
2137
+ var MINIMAX_H3_I2V_ENDPOINT = "minimax/h3/image-to-video";
1988
2138
  var KLING_O3_PRO_R2V_ENDPOINT = "fal-ai/kling-video/o3/pro/reference-to-video";
1989
2139
  var FAL_CHARACTER_REFERENCE_LIMITS = {
1990
2140
  [KLING_O3_PRO_R2V_ENDPOINT]: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
@@ -2018,7 +2168,10 @@ var VIDEO_FIXED_RESOLUTION = {
2018
2168
  // Not a resolution the caller picks: Kling O3's tier sets the size.
2019
2169
  [KLING_O3_STANDARD_I2V_ENDPOINT]: "fixed",
2020
2170
  [KLING_O3_PRO_I2V_ENDPOINT]: "fixed",
2021
- [KLING_O3_PRO_R2V_ENDPOINT]: "fixed"
2171
+ [KLING_O3_PRO_R2V_ENDPOINT]: "fixed",
2172
+ // Kling 3.0 likewise: its tier sets the size.
2173
+ [KLING_V3_STANDARD_I2V_ENDPOINT]: "fixed",
2174
+ [KLING_V3_PRO_I2V_ENDPOINT]: "fixed"
2022
2175
  };
2023
2176
  var VIDEO_PINNED_DEFAULT_SECONDS = {
2024
2177
  [GROK_IMAGINE_I2V_ENDPOINT]: 5,
@@ -2033,6 +2186,13 @@ var VIDEO_PINNED_DEFAULT_SECONDS = {
2033
2186
  [KLING_O3_STANDARD_I2V_ENDPOINT]: 5,
2034
2187
  [KLING_O3_PRO_I2V_ENDPOINT]: 5,
2035
2188
  [KLING_O3_PRO_R2V_ENDPOINT]: 5,
2189
+ [GEMINI_OMNI_11_I2V_ENDPOINT]: 8,
2190
+ // fal's own default on Kling 3.0 and 4.0 (schemas read 2026-11-03).
2191
+ [KLING_V3_STANDARD_I2V_ENDPOINT]: 5,
2192
+ [KLING_V3_PRO_I2V_ENDPOINT]: 5,
2193
+ [KLING_V4_I2V_ENDPOINT]: 5,
2194
+ // fal's own default on MiniMax H3 (schema read 2026-11-04).
2195
+ [MINIMAX_H3_I2V_ENDPOINT]: 5,
2036
2196
  // LTX-2.5 defaults to "auto", a length nobody can price up front; 6 s is its
2037
2197
  // shortest clip on both tiers.
2038
2198
  [LTX_25_FAST_I2V_ENDPOINT]: 6,
@@ -2065,6 +2225,12 @@ var VIDEO_DEFAULT_RESOLUTION = {
2065
2225
  [GROK_IMAGINE_15_I2V_ENDPOINT]: "720p",
2066
2226
  // fal schema default: Wan 3.0 renders 1080p unless asked for less.
2067
2227
  [WAN_30_I2V_ENDPOINT]: "1080p",
2228
+ // fal schema default: Gemini Omni renders 720p, as on KIE.
2229
+ [GEMINI_OMNI_11_I2V_ENDPOINT]: "720p",
2230
+ // fal schema default: Kling 4.0 renders 1080p unless asked for 720p.
2231
+ [KLING_V4_I2V_ENDPOINT]: "1080p",
2232
+ // fal schema default: MiniMax H3 renders 2K (the canvas's 1080p) unless asked.
2233
+ [MINIMAX_H3_I2V_ENDPOINT]: "1080p",
2068
2234
  // fal schema default: LTX-2.5 renders 1080p unless asked for less.
2069
2235
  [LTX_25_FAST_I2V_ENDPOINT]: "1080p",
2070
2236
  [LTX_25_PRO_I2V_ENDPOINT]: "1080p"
@@ -2111,7 +2277,18 @@ var VIDEO_ALLOWED_VALUES = {
2111
2277
  aspectRatio: ["auto", "16:9", "9:16"],
2112
2278
  resolution: ["720p", "1080p"],
2113
2279
  durationSeconds: { values: [6, 8, 10] }
2114
- }
2280
+ },
2281
+ // fal also renders 360p, which the canvas does not offer.
2282
+ [GEMINI_OMNI_11_I2V_ENDPOINT]: {
2283
+ aspectRatio: ["16:9", "9:16"],
2284
+ resolution: ["720p", "1080p", "4k"],
2285
+ durationSeconds: { min: 3, max: 10 }
2286
+ },
2287
+ ...Object.fromEntries(KLING_V3_I2V_ENDPOINTS.map((e) => [e, { durationSeconds: { min: 3, max: 15 } }])),
2288
+ [KLING_V4_I2V_ENDPOINT]: { resolution: ["720p", "1080p"], durationSeconds: { min: 3, max: 30 } },
2289
+ // fal also renders 480P, which the canvas does not offer. Its shortest clip
2290
+ // is 5 s (KIE's is 4 s), so a 4 s job on the H3 route has no fal fallback.
2291
+ [MINIMAX_H3_I2V_ENDPOINT]: { resolution: ["720p", "1080p", "4k"], durationSeconds: { min: 5, max: 15 } }
2115
2292
  };
2116
2293
  var VIDEO_MAX_SECONDS_AT_RESOLUTION = {
2117
2294
  [LTX_25_FAST_I2V_ENDPOINT]: { "4k": 10 }
@@ -2167,13 +2344,26 @@ var VIDEO_UNSUPPORTED_PARAMS = {
2167
2344
  ...Object.fromEntries(KLING_O3_I2V_ENDPOINTS.map((e) => [e, ["resolution", "aspectRatio", "seed", "negativePrompt"]])),
2168
2345
  // Its tier sets the size; it takes an aspect ratio, but no seed or negative prompt.
2169
2346
  [KLING_O3_PRO_R2V_ENDPOINT]: ["resolution", "seed", "negativePrompt"],
2170
- ...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, ["seed", "negativePrompt"]]))
2347
+ ...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, ["seed", "negativePrompt"]])),
2348
+ // Its schema declares no seed, negative prompt or audio switch: it always
2349
+ // renders audio, at no extra charge.
2350
+ [GEMINI_OMNI_11_I2V_ENDPOINT]: ["seed", "negativePrompt", "generateAudio"],
2351
+ // Kling 3.0: the tier sets the size and the start frame the shape; it takes a
2352
+ // negative prompt but no seed.
2353
+ ...Object.fromEntries(KLING_V3_I2V_ENDPOINTS.map((e) => [e, ["resolution", "aspectRatio", "seed"]])),
2354
+ // Kling 4.0 follows the start frame's shape and always renders sound.
2355
+ [KLING_V4_I2V_ENDPOINT]: ["aspectRatio", "seed", "negativePrompt", "generateAudio"],
2356
+ // MiniMax H3 follows the start frame's shape and always renders sound (a 5 s
2357
+ // test render of 2026-11-04 had a video and an audio track); it takes a seed.
2358
+ [MINIMAX_H3_I2V_ENDPOINT]: ["aspectRatio", "negativePrompt", "generateAudio"]
2171
2359
  };
2172
2360
  var VIDEO_AUDIO_SWITCH = {
2173
2361
  ...Object.fromEntries(VEO_ENDPOINTS.map((e) => [e, { default: false }])),
2174
2362
  [KLING_26_I2V_ENDPOINT]: { default: false },
2175
2363
  ...Object.fromEntries(KLING_O3_I2V_ENDPOINTS.map((e) => [e, { default: false }])),
2176
2364
  [KLING_O3_PRO_R2V_ENDPOINT]: { default: false },
2365
+ // Kling 3.0 renders sound unless sent false; Studio sends it silent unless asked.
2366
+ ...Object.fromEntries(KLING_V3_I2V_ENDPOINTS.map((e) => [e, { default: false }])),
2177
2367
  "bytedance/seedance-2.5/image-to-video": { default: true },
2178
2368
  "bytedance/seedance-2.0/image-to-video": { default: true },
2179
2369
  [WAN_30_I2V_ENDPOINT]: { default: true },
@@ -2895,6 +3085,10 @@ function searchMeshyAnimations(query, limit = 25) {
2895
3085
  }
2896
3086
  return out;
2897
3087
  }
3088
+ var IMAGE_ASPECT_RATIOS = ASPECT_RATIOS.map((value) => ({
3089
+ value,
3090
+ label: value
3091
+ }));
2898
3092
  var PORT_TYPES = ["text", "image", "video", "mask", "mesh3d", "audio", "json", "reference"];
2899
3093
  var INPUT_PORT_TYPES = PORT_TYPES.filter(
2900
3094
  (p) => p !== "mask" && p !== "reference"
@@ -3025,13 +3219,14 @@ var TASK_PORTS = {
3025
3219
  function taskPorts(task) {
3026
3220
  return TASK_PORTS[task];
3027
3221
  }
3222
+ var MAX_JSON_ARRAY_ITEMS = 1e4;
3028
3223
  var JsonValueSchema = z.lazy(
3029
3224
  () => z.union([
3030
3225
  z.string(),
3031
3226
  z.number().finite(),
3032
3227
  z.boolean(),
3033
3228
  z.null(),
3034
- z.array(JsonValueSchema),
3229
+ z.array(JsonValueSchema).max(MAX_JSON_ARRAY_ITEMS),
3035
3230
  z.record(z.string(), JsonValueSchema)
3036
3231
  ])
3037
3232
  );
@@ -3039,7 +3234,7 @@ var JsonNonNullValueSchema = z.union([
3039
3234
  z.string(),
3040
3235
  z.number().finite(),
3041
3236
  z.boolean(),
3042
- z.array(JsonValueSchema),
3237
+ z.array(JsonValueSchema).max(MAX_JSON_ARRAY_ITEMS),
3043
3238
  z.record(z.string(), JsonValueSchema)
3044
3239
  ]);
3045
3240
  function toJsonValue(value, what = "value") {
@@ -3047,6 +3242,11 @@ function toJsonValue(value, what = "value") {
3047
3242
  if (!r.success) throw new TypeError(`${what} is not a JSON value: ${r.error.issues[0]?.message ?? "invalid"}`);
3048
3243
  return r.data;
3049
3244
  }
3245
+ var MAX_DOCUMENT_NODES = 2e3;
3246
+ var MAX_DEFINITION_PARAMS = 200;
3247
+ var MAX_CAST_MEMBERS = 100;
3248
+ var MAX_CAST_SOURCES = 100;
3249
+ var MAX_LIST_BINDING_ITEMS = 500;
3050
3250
  var WORKFLOW_SCHEMA_VERSION = 1;
3051
3251
  var SchemaVersionSchema = z2.object({
3052
3252
  schema: z2.number().int().positive()
@@ -3080,7 +3280,7 @@ var ListItemBindingSchema = z2.discriminatedUnion("kind", [
3080
3280
  ]);
3081
3281
  var ListBindingSchema = z2.object({
3082
3282
  kind: z2.literal("list"),
3083
- items: z2.array(ListItemBindingSchema)
3283
+ items: z2.array(ListItemBindingSchema).max(MAX_LIST_BINDING_ITEMS)
3084
3284
  });
3085
3285
  var BindingSchema = z2.discriminatedUnion("kind", [
3086
3286
  LiteralBindingSchema,
@@ -3093,12 +3293,38 @@ var RetryPolicySchema = z2.object({
3093
3293
  maxAttempts: z2.number().int().positive(),
3094
3294
  backoffMs: z2.number().int().nonnegative()
3095
3295
  });
3296
+ var CastMemberSchema = z2.object({
3297
+ kind: z2.enum(["character", "product", "location"]),
3298
+ id: z2.string().min(1),
3299
+ name: z2.string(),
3300
+ sources: z2.array(z2.string()).max(MAX_CAST_SOURCES).optional()
3301
+ });
3096
3302
  var WorkflowNodeSchema = z2.object({
3097
3303
  id: z2.string().min(1),
3098
3304
  task: WorkflowTaskSchema,
3099
3305
  model: z2.string().min(1),
3100
3306
  inputs: z2.record(z2.string(), BindingSchema).default({}),
3101
- retry: RetryPolicySchema.optional()
3307
+ retry: RetryPolicySchema.optional(),
3308
+ /**
3309
+ * The cast the node's prompt names, in prompt order. Not a job input: the
3310
+ * executor reads it at send time to put the identity clauses Create sends
3311
+ * in front of the prompt (the reference order, the identity lock with each
3312
+ * character's description; for a clip, which element is who), and never
3313
+ * stores them in the node's prompt. Absent on a node that names no cast.
3314
+ */
3315
+ cast: z2.array(CastMemberSchema).max(MAX_CAST_MEMBERS).optional(),
3316
+ /**
3317
+ * The cast is what the node's own reference stack shows (its
3318
+ * `castReferences` setting), not mentions the canvas's prompt bar edits; a
3319
+ * fork of the run brings it back under that setting. Absent otherwise.
3320
+ */
3321
+ castOwn: z2.literal(true).optional(),
3322
+ /**
3323
+ * The node's images come from its image wire, which wins over a baked
3324
+ * stack: the cast's baked references are then not what is sent. Set with
3325
+ * `cast` only, so the executor can say which next step works.
3326
+ */
3327
+ imagesWired: z2.literal(true).optional()
3102
3328
  });
3103
3329
  var WorkflowParamSpecSchema = z2.object({
3104
3330
  name: z2.string().min(1),
@@ -3121,8 +3347,8 @@ var WorkflowDefinitionSchema = z2.object({
3121
3347
  version: SchemaVersionSchema.default({ schema: WORKFLOW_SCHEMA_VERSION }),
3122
3348
  id: z2.string().min(1),
3123
3349
  label: z2.string().optional(),
3124
- params: z2.array(WorkflowParamSpecSchema).default([]),
3125
- nodes: z2.array(WorkflowNodeSchema).min(1)
3350
+ params: z2.array(WorkflowParamSpecSchema).max(MAX_DEFINITION_PARAMS).default([]),
3351
+ nodes: z2.array(WorkflowNodeSchema).min(1).max(MAX_DOCUMENT_NODES)
3126
3352
  });
3127
3353
  function kahnOrder(ids, edges) {
3128
3354
  const indegree = /* @__PURE__ */ new Map();
@@ -3159,7 +3385,8 @@ var KeySchema = z3.string().regex(/^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/, "key must b
3159
3385
  var InputNameSchema = z3.string().regex(/^[A-Za-z_][A-Za-z0-9_-]{0,63}$/, "input name must be 1 to 64 chars of letters, digits, _ -").refine(notReserved, "reserved name");
3160
3386
  var LabelSchema = z3.string().max(200);
3161
3387
  var DescriptionSchema = z3.string().max(2e3);
3162
- var PromptTextSchema = z3.string().max(2e4);
3388
+ var MAX_PROMPT_TEXT_LENGTH = 2e4;
3389
+ var PromptTextSchema = z3.string().max(MAX_PROMPT_TEXT_LENGTH);
3163
3390
  var ModelIdSchema = z3.string().max(256);
3164
3391
  var UrlSchema = z3.string().max(4096);
3165
3392
  var AssetIdSchema = z3.string().max(128);
@@ -3250,7 +3477,7 @@ var DocEdgeSchema = z3.object({
3250
3477
  var DocGroupSchema = z3.object({
3251
3478
  id: IdSchema,
3252
3479
  label: LabelSchema.optional(),
3253
- nodeIds: z3.array(IdSchema).min(1)
3480
+ nodeIds: z3.array(IdSchema).min(1).max(MAX_DOCUMENT_NODES)
3254
3481
  });
3255
3482
  var EDGE_ROUTINGS = ["curved", "orthogonal"];
3256
3483
  var EdgeRoutingSchema = z3.enum(EDGE_ROUTINGS);
@@ -3268,7 +3495,7 @@ var WorkflowDocumentSchema = z3.object({
3268
3495
  schema: z3.number().int().positive(),
3269
3496
  id: IdSchema,
3270
3497
  label: LabelSchema.default(""),
3271
- nodes: z3.array(DocNodeSchema).max(2e3),
3498
+ nodes: z3.array(DocNodeSchema).max(MAX_DOCUMENT_NODES),
3272
3499
  edges: z3.array(DocEdgeSchema).max(8e3),
3273
3500
  layout: z3.record(IdSchema, PositionSchema).default({}),
3274
3501
  groups: z3.array(DocGroupSchema).max(500).default([]),
@@ -3357,6 +3584,26 @@ var ROUTES2 = [
3357
3584
  withReferences: { "1080p": "fal/kling-o3-pro-reference-to-video" }
3358
3585
  }
3359
3586
  },
3587
+ {
3588
+ kind: "video",
3589
+ id: "route/gemini-omni",
3590
+ label: "Gemini Omni 1.1 Flash (KIE, fal fallback)",
3591
+ primary: "kie/gemini-omni-flash-1-1-image-to-video",
3592
+ // fal renders every length KIE does (4 to 10 s in even steps) and the same
3593
+ // sizes and shapes, from the same frame fields (2026-11-03). One difference:
3594
+ // fal always renders sound with the clip, so a clip that falls back has it.
3595
+ fallback: { start: "fal/gemini-omni-flash-1-1-image-to-video" }
3596
+ },
3597
+ {
3598
+ kind: "video",
3599
+ id: "route/minimax-h3",
3600
+ label: "MiniMax H3 (KIE, fal fallback)",
3601
+ primary: "kie/minimax-h3-image-to-video",
3602
+ // fal renders KIE's sizes (768P and 2K) and lengths from 5 to 15 s from the
3603
+ // same frame fields (2026-11-04); KIE also renders 4 s, which fal does not,
3604
+ // so a 4 s clip has no fallback. fal always renders sound with the clip.
3605
+ fallback: { start: "fal/minimax-h3-image-to-video" }
3606
+ },
3360
3607
  {
3361
3608
  kind: "video",
3362
3609
  id: "route/seedance-2-0",
@@ -3656,6 +3903,71 @@ var CATALOG_ENTRIES2 = [
3656
3903
  description: "ByteDance Seedream 5 Pro edit via fal, up to 10 reference images, 1K or 2K.",
3657
3904
  capabilities: { resolutions: ["1K", "2K"], needsImageInput: true, maxInputImages: 10 }
3658
3905
  },
3906
+ // ── fal.ai: Ideogram 4.5 Edit, precise local edits ─────────────────────
3907
+ {
3908
+ id: "fal/ideogram-4-5-edit",
3909
+ provider: "fal",
3910
+ modality: "image",
3911
+ task: "image-edit",
3912
+ label: "Ideogram 4.5 Edit (fal)",
3913
+ // Measured 2026-11-04 on a series of edits of one portrait: the background
3914
+ // held at a structural similarity (SSIM) of 0.9999 between successive
3915
+ // edits, against 0.98 for Nano Banana 2 Edit, which reframed the shot on
3916
+ // the first edit. Ideogram's first edit smoothed the face a little; after
3917
+ // that the face held.
3918
+ description: "Ideogram 4.5 in precise edit mode: changes what the prompt asks for (a garment, a prop, the background) and keeps every pixel it did not touch, so a series of edits keeps the shot. Image 1 is the image edited, up to 4 more are references, and the result keeps the shape of image 1. Quality low, medium or high.",
3919
+ capabilities: {
3920
+ // The tiers carry Ideogram's QUALITY (providers/fal.ts, `ideogramQuality`):
3921
+ // 0.5K low, 1K medium (the default), 2K high. fal's very_low is not
3922
+ // offered (decided 2026-11-04). Labelled as qualities
3923
+ // wherever shown (`imageTierLabel`).
3924
+ resolutions: ["0.5K", "1K", "2K"],
3925
+ tierKind: "quality",
3926
+ editsFirstImage: true,
3927
+ needsImageInput: true,
3928
+ maxInputImages: 5
3929
+ }
3930
+ },
3931
+ // ── fal.ai: OpenAI GPT Image 2, text in images and exact edits ─────────
3932
+ // Added 2026-11-04 (plan 2026-11-04-skool-prompting, item M2): the course
3933
+ // Marlin follows names it the best model for rendering text (labels,
3934
+ // packaging) and for edits that change only what was asked.
3935
+ {
3936
+ id: "fal/gpt-image-2",
3937
+ provider: "fal",
3938
+ modality: "image",
3939
+ task: "text-to-image",
3940
+ label: "GPT Image 2 (fal)",
3941
+ description: "OpenAI GPT Image 2 via fal: the strongest at text inside the image (labels, packaging, signs, posters) and at following long, detailed prompts. Slower than Nano Banana. Quality low, medium or high, about 1 megapixel in every shape; prompts up to about 4000 characters of English (4000 bytes).",
3942
+ capabilities: {
3943
+ // The tiers carry GPT Image 2's QUALITY (providers/fal.ts,
3944
+ // `tierQuality`): 0.5K low, 1K medium (the default), 2K high. The size
3945
+ // follows the shape alone (`FAL_GPT_IMAGE_2_SIZE_BY_ASPECT`).
3946
+ resolutions: ["0.5K", "1K", "2K"],
3947
+ tierKind: "quality",
3948
+ maxInputImages: 0
3949
+ }
3950
+ },
3951
+ {
3952
+ id: "fal/gpt-image-2-edit",
3953
+ provider: "fal",
3954
+ modality: "image",
3955
+ task: "image-edit",
3956
+ label: "GPT Image 2 Edit (fal)",
3957
+ description: "OpenAI GPT Image 2 edit via fal: changes only what the prompt asks for and renders text and labels cleanly (packaging, signs). Studio sends the image to edit first and up to 7 references after it; say in the prompt what to change. The result takes the shape you pick: pick the source image's shape to keep it. Slower than Nano Banana. Quality low, medium or high, about 1 megapixel in every shape; prompts up to about 4000 characters of English (4000 bytes).",
3958
+ capabilities: {
3959
+ resolutions: ["0.5K", "1K", "2K"],
3960
+ tierKind: "quality",
3961
+ // fal's `image_urls` is a plain list with no field for the image
3962
+ // edited. Studio's convention: the image to edit goes first and the
3963
+ // mention prompt names it image 1, which is what lets the composer, the
3964
+ // generate route and the canvas refuse an edit with no image before
3965
+ // anything is admitted (`editSourceHold`).
3966
+ editsFirstImage: true,
3967
+ needsImageInput: true,
3968
+ maxInputImages: 8
3969
+ }
3970
+ },
3659
3971
  {
3660
3972
  id: "fal/flux-1-1-pro",
3661
3973
  provider: "fal",
@@ -3941,7 +4253,7 @@ var CATALOG_ENTRIES2 = [
3941
4253
  modality: "video",
3942
4254
  task: "image-to-video",
3943
4255
  label: "Gemini Omni 1.1 Flash (KIE)",
3944
- description: "Google Gemini Omni 1.1 Flash via KIE, first-and-last-frame mode. A start frame and an optional end frame, 4, 6, 8 or 10 s, 720p to 4K, 16:9 or 9:16. KIE refuses registered characters in this mode, so identity comes from the frames alone. Accepted a minted character's photoreal stills on 2026-09-24 (set 9:16 for a portrait still: it defaults to 16:9 and crops). No fal equivalent.",
4256
+ description: "Google Gemini Omni 1.1 Flash via KIE, first-and-last-frame mode. A start frame and an optional end frame, 4, 6, 8 or 10 s, 720p to 4K, 16:9 or 9:16. KIE refuses registered characters in this mode, so identity comes from the frames alone. Accepted a minted character's photoreal stills on 2026-09-24 (set 9:16 for a portrait still: it defaults to 16:9 and crops).",
3945
4257
  capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
3946
4258
  },
3947
4259
  {
@@ -4037,6 +4349,53 @@ var CATALOG_ENTRIES2 = [
4037
4349
  characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
4038
4350
  }
4039
4351
  },
4352
+ {
4353
+ id: "fal/gemini-omni-flash-1-1-image-to-video",
4354
+ provider: "fal",
4355
+ modality: "video",
4356
+ task: "image-to-video",
4357
+ label: "Gemini Omni 1.1 Flash (image-to-video)",
4358
+ description: "Google Gemini Omni 1.1 Flash via fal, the fallback for the KIE entry and the route that runs images of people. A start frame and an optional end frame, 3 to 10 s, 720p, 1080p or 4K, 16:9 or 9:16 (16:9 unless set, so set 9:16 for a portrait still), with audio included. No seed. Not yet tested with a minted character on fal (the KIE route accepted one).",
4359
+ // 8 s at fal's 720p default, the length and size the KIE entry renders.
4360
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
4361
+ },
4362
+ {
4363
+ id: "fal/kling-3-0-standard-image-to-video",
4364
+ provider: "fal",
4365
+ modality: "video",
4366
+ task: "image-to-video",
4367
+ label: "Kling 3.0 Standard (image-to-video)",
4368
+ description: "Kuaishou Kling 3.0 Standard via fal, a model of its own next to Kling O3 (Kling 3.0 Omni). A start frame and an optional end frame, 3 to 15 s, in the start frame's shape at the tier's size, silent unless the job sets generateAudio. Takes a negative prompt, no seed. Not yet tested with a minted character.",
4369
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
4370
+ },
4371
+ {
4372
+ id: "fal/kling-3-0-pro-image-to-video",
4373
+ provider: "fal",
4374
+ modality: "video",
4375
+ task: "image-to-video",
4376
+ label: "Kling 3.0 Pro (image-to-video)",
4377
+ description: "Kuaishou Kling 3.0 Pro via fal, a model of its own next to Kling O3 (Kling 3.0 Omni). A start frame and an optional end frame, 3 to 15 s, in the start frame's shape at the tier's size, silent unless the job sets generateAudio. Takes a negative prompt, no seed. Not yet tested with a minted character.",
4378
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
4379
+ },
4380
+ {
4381
+ id: "fal/minimax-h3-image-to-video",
4382
+ provider: "fal",
4383
+ modality: "video",
4384
+ task: "image-to-video",
4385
+ label: "MiniMax H3 (image-to-video)",
4386
+ description: "MiniMax H3 via fal (the base model, not fal's post-trained H3 Max), the fallback for the KIE entry and the route that runs images of people. A start frame and an optional end frame, 5 to 15 s, 768p (the 720p setting), 2K (the 1080p setting, used unless set) or 4K, in the start frame's shape, always with sound. Takes a seed, no negative prompt. Rendered a 5 s test clip on 2026-11-04; not yet tested with a minted character on fal (the KIE route accepted one).",
4387
+ // 5 s at fal's 2K default.
4388
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
4389
+ },
4390
+ {
4391
+ id: "fal/kling-4-0-image-to-video",
4392
+ provider: "fal",
4393
+ modality: "video",
4394
+ task: "image-to-video",
4395
+ label: "Kling 4.0 (image-to-video)",
4396
+ description: "Kuaishou Kling 4.0 via fal; not served by KIE. A start frame and an optional end frame, 3 to 30 s, 720p or 1080p (1080p unless set), in the start frame's shape, always with sound. No seed or negative prompt. fal also takes in-between keyframes and per-shot prompts, which Studio does not send yet. Rendered a 3 s test clip on 2026-11-03; not yet tested with a minted character.",
4397
+ capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
4398
+ },
4040
4399
  {
4041
4400
  id: "fal/ltx-2-5-fast-image-to-video",
4042
4401
  provider: "fal",
@@ -4368,6 +4727,143 @@ function withRouteNote2(entry) {
4368
4727
  return { ...entry, description: [entry.description ?? "", note, person ?? ""].filter(Boolean).join(" ").trim() };
4369
4728
  }
4370
4729
  var MODEL_CATALOG2 = CATALOG_ENTRIES2.map(withRouteNote2);
4730
+ var PROVIDER_API_NAMES = {
4731
+ "vertex/gemini-2-5-flash-image": "gemini-2.5-flash-image",
4732
+ "vertex/gemini-3-pro-image-preview": "gemini-3-pro-image-preview",
4733
+ "vertex/gemini-3-1-flash-image-preview": "gemini-3.1-flash-image-preview",
4734
+ "kie/nano-banana-2": "nano-banana-2",
4735
+ "kie/nano-banana-2-edit": "nano-banana-2",
4736
+ "kie/nano-banana-pro": "nano-banana-pro",
4737
+ "kie/nano-banana-pro-edit": "nano-banana-pro",
4738
+ "kie/seedream-5-lite": "seedream/5-lite-text-to-image",
4739
+ "kie/seedream-5-lite-edit": "seedream/5-lite-image-to-image",
4740
+ "kie/seedream-5-pro": "seedream/5-pro-text-to-image",
4741
+ "kie/seedream-5-pro-edit": "seedream/5-pro-image-to-image",
4742
+ "kie/imagen-4-fast": "google/imagen4-fast",
4743
+ "kie/seedream-v4": "bytedance/seedream-v4-text-to-image",
4744
+ // fal endpoint ids. The provider auto-routes nano-banana-2 to the `/edit`
4745
+ // variant when inputImages are present; both -edit and -edit-i2i catalog
4746
+ // entries share the same upstream id.
4747
+ "fal/nano-banana-2": "fal-ai/nano-banana-2",
4748
+ "fal/nano-banana-pro": "fal-ai/nano-banana-pro",
4749
+ "fal/nano-banana-pro-edit": "fal-ai/nano-banana-pro/edit",
4750
+ "fal/seedream-5-lite": "fal-ai/bytedance/seedream/v5/lite/text-to-image",
4751
+ "fal/seedream-5-lite-edit": "fal-ai/bytedance/seedream/v5/lite/edit",
4752
+ "fal/seedream-5-pro": "bytedance/seedream/v5/pro/text-to-image",
4753
+ "fal/seedream-5-pro-edit": "bytedance/seedream/v5/pro/edit",
4754
+ "fal/nano-banana-2-edit": "fal-ai/nano-banana-2/edit",
4755
+ // No fal-ai prefix: owner `ideogram`, alias `v4.5`, path `edit`.
4756
+ "fal/ideogram-4-5-edit": "ideogram/v4.5/edit",
4757
+ // No fal-ai prefix: owner `openai`. `fal-ai/gpt-image-2` is an alias of the
4758
+ // same model; the edit is `/edit` (there is no `image-to-image` path).
4759
+ "fal/gpt-image-2": "openai/gpt-image-2",
4760
+ "fal/gpt-image-2-edit": "openai/gpt-image-2/edit",
4761
+ "fal/nano-banana-2-edit-i2i": "fal-ai/nano-banana-2/edit",
4762
+ "fal/flux-1-1-pro": "fal-ai/flux-pro/v1.1",
4763
+ "fal/flux-schnell": "fal-ai/flux/schnell",
4764
+ "fal/flux-kontext-pro": "fal-ai/flux-pro/kontext",
4765
+ // fal virtual try-on endpoint (E3). Sync via subscribe (submit+poll wrapped).
4766
+ "fal/fashn-tryon-v1-6": "fal-ai/fashn/tryon/v1.6",
4767
+ // fal video endpoints (B1). Async via the queue API.
4768
+ "fal/kling-v2-5-image-to-video": "fal-ai/kling-video/v2.5-turbo/pro/image-to-video",
4769
+ "fal/seedance-pro-image-to-video": "fal-ai/bytedance/seedance/v1/pro/image-to-video",
4770
+ // Seedance 2.x ids carry no `fal-ai/` prefix and are nested (owner/alias/path),
4771
+ // like the Wan entry above; the fal SDK derives queue URLs from owner/alias.
4772
+ "fal/seedance-2-5-image-to-video": "bytedance/seedance-2.5/image-to-video",
4773
+ "fal/seedance-2-0-image-to-video": "bytedance/seedance-2.0/image-to-video",
4774
+ "fal/seedance-pro-text-to-video": "fal-ai/bytedance/seedance/v1/pro/text-to-video",
4775
+ // Grok Imagine: nested id, the SDK derives owner/alias itself.
4776
+ "fal/grok-imagine-image-to-video": "xai/grok-imagine-video/image-to-video",
4777
+ // KIE video: the upstream KIE model ids (providers/kie-video.ts).
4778
+ "kie/veo-3-1-lite": "veo3_lite",
4779
+ "kie/veo-3-1-fast": "veo3_fast",
4780
+ "kie/veo-3-1": "veo3",
4781
+ "kie/grok-imagine-image-to-video": "grok-imagine/image-to-video",
4782
+ "kie/grok-imagine-1-5-image-to-video": "grok-imagine-video-1-5-preview",
4783
+ "kie/kling-v2-5-turbo-pro-image-to-video": "kling/v2-5-turbo-image-to-video-pro",
4784
+ "kie/kling-2-6-image-to-video": "kling-2.6/image-to-video",
4785
+ "kie/seedance-2-0-image-to-video": "bytedance/seedance-2",
4786
+ "kie/seedance-2-5-image-to-video": "bytedance/seedance-2-5",
4787
+ "kie/wan-3-0-image-to-video": "wan/3-0-video",
4788
+ "kie/minimax-h3-image-to-video": "minimax-h3/image-to-video",
4789
+ "kie/gemini-omni-flash-1-1-image-to-video": "google/gemini-omni-flash-1-1",
4790
+ // The same KIE model in its reference mode: a spec key of its own, sent to
4791
+ // KIE as `google/gemini-omni-flash-1-1` (`KieVideoSpec.upstreamModel`).
4792
+ "kie/gemini-omni-flash-1-1-reference-to-video": "google/gemini-omni-flash-1-1/references",
4793
+ "kie/kling-o3-image-to-video": "kling-3.0-omni/image-to-video",
4794
+ // OpenRouter video: the OpenRouter model ids (providers/openrouter-video.ts).
4795
+ "openrouter/veo-3-1-lite": "google/veo-3.1-lite",
4796
+ "openrouter/veo-3-1-fast": "google/veo-3.1-fast",
4797
+ "openrouter/veo-3-1": "google/veo-3.1",
4798
+ // The fal twins of KIE-only models.
4799
+ "fal/grok-imagine-1-5-image-to-video": "xai/grok-imagine-video/v1.5/image-to-video",
4800
+ "fal/wan-3-0-image-to-video": "alibaba/wan-3.0/image-to-video",
4801
+ "fal/kling-2-6-image-to-video": "fal-ai/kling-video/v2.6/pro/image-to-video",
4802
+ "fal/kling-o3-standard-image-to-video": "fal-ai/kling-video/o3/standard/image-to-video",
4803
+ "fal/kling-o3-pro-image-to-video": "fal-ai/kling-video/o3/pro/image-to-video",
4804
+ "fal/kling-o3-pro-reference-to-video": "fal-ai/kling-video/o3/pro/reference-to-video",
4805
+ "fal/gemini-omni-flash-1-1-image-to-video": "google/gemini-omni-flash/v1.1/image-to-video",
4806
+ "fal/kling-3-0-standard-image-to-video": "fal-ai/kling-video/v3/standard/image-to-video",
4807
+ "fal/kling-3-0-pro-image-to-video": "fal-ai/kling-video/v3/pro/image-to-video",
4808
+ "fal/kling-4-0-image-to-video": "kling/v4/image-to-video",
4809
+ "fal/minimax-h3-image-to-video": "minimax/h3/image-to-video",
4810
+ // Lightricks LTX-2.5: nested ids, the SDK derives owner/alias itself.
4811
+ "fal/ltx-2-5-fast-image-to-video": "lightricks/ltx-2.5/image-to-video/fast",
4812
+ "fal/ltx-2-5-pro-image-to-video": "lightricks/ltx-2.5/image-to-video/pro",
4813
+ // Google Veo 3.1: nested ids, the SDK derives owner/alias itself.
4814
+ "fal/veo-3-1-lite-image-to-video": "fal-ai/veo3.1/lite/image-to-video",
4815
+ "fal/veo-3-1-lite-first-last-frame": "fal-ai/veo3.1/lite/first-last-frame-to-video",
4816
+ "fal/veo-3-1-fast-image-to-video": "fal-ai/veo3.1/fast/image-to-video",
4817
+ "fal/veo-3-1-fast-first-last-frame": "fal-ai/veo3.1/fast/first-last-frame-to-video",
4818
+ "fal/veo-3-1-image-to-video": "fal-ai/veo3.1/image-to-video",
4819
+ "fal/veo-3-1-first-last-frame": "fal-ai/veo3.1/first-last-frame-to-video",
4820
+ // FLUX.3 draft endpoints. Nested ids without the `fal-ai/` prefix, like Seedance 2.x.
4821
+ "fal/flux-3-image-to-video-draft": "blackforestlabs/flux-3/image-to-video/draft",
4822
+ "fal/flux-3-first-last-frame-to-video-draft": "blackforestlabs/flux-3/first-last-frame-to-video/draft",
4823
+ "fal/flux-3-keyframes-to-video-draft": "blackforestlabs/flux-3/keyframes-to-video/draft",
4824
+ "fal/flux-3-image-to-video": "blackforestlabs/flux-3/image-to-video",
4825
+ "fal/flux-3-first-last-frame-to-video": "blackforestlabs/flux-3/first-last-frame-to-video",
4826
+ "fal/flux-3-keyframes-to-video": "blackforestlabs/flux-3/keyframes-to-video",
4827
+ "fal/flux-3-draft-enhance": "blackforestlabs/flux-3/draft-enhance",
4828
+ // fal video-to-video (Wan 2.2 Animate Replace). Nested endpoint id: the queue
4829
+ // status / result URLs use only `fal-ai/wan` (owner/alias), which the fal SDK
4830
+ // derives itself (parseEndpointId); submit takes the full id.
4831
+ "fal/wan-animate-replace": "fal-ai/wan/v2.2-14b/animate/replace",
4832
+ // Kling O3 Pro Edit: nested id like Wan's, the SDK derives owner/alias itself.
4833
+ "fal/kling-o3-edit": "fal-ai/kling-video/o3/pro/video-to-video/edit",
4834
+ // fal vision + utility endpoints (B4). Sync via subscribe.
4835
+ "fal/florence-2-detailed-caption": "fal-ai/florence-2-large/detailed-caption",
4836
+ "fal/moondream-next-vqa": "fal-ai/moondream-next",
4837
+ // Judge (P3): same underlying endpoint as the entry above. Not dispatched
4838
+ // yet: a judge node parks the run on a person (J2) and does not call a model
4839
+ // until J5 wires the ranking. Mapped now so J5 needs no catalog change.
4840
+ "fal/moondream-next-vqa-judge": "fal-ai/moondream-next",
4841
+ "fal/meshy-rigging": "fal-ai/meshy/rigging",
4842
+ "fal/aura-sr-upscale": "fal-ai/aura-sr",
4843
+ "fal/birefnet-v2-background-remove": "fal-ai/birefnet/v2",
4844
+ // audio: Suno music via KIE (B2). The upstream `model` field KIE expects on
4845
+ // its Suno job API ("V5"), distinct from the dashed catalog id.
4846
+ "kie/suno-v5": "V5",
4847
+ // audio: ElevenLabs voice (B2). The upstream model_id the ElevenLabs API
4848
+ // expects on the TTS / STT endpoints.
4849
+ "elevenlabs/tts-multilingual-v2": "eleven_multilingual_v2",
4850
+ "elevenlabs/scribe-v1": "scribe_v1",
4851
+ // text: LLM director (B3). KIE-Claude expects the bare Anthropic model id on
4852
+ // its Messages endpoint; OpenRouter expects the provider-prefixed id.
4853
+ "kie/claude-sonnet-4-5": "claude-sonnet-4-5",
4854
+ "kie/claude-opus-4-5": "claude-opus-4-5",
4855
+ "openrouter/claude-sonnet-4-6": "anthropic/claude-sonnet-4-6",
4856
+ "openrouter/gpt-6-astra": "openai/gpt-6-astra",
4857
+ "openrouter/claude-opus-5-5": "anthropic/claude-opus-5.5"
4858
+ };
4859
+ function getProviderModelName(id) {
4860
+ const route = getRoute2(id);
4861
+ if (route) return getProviderModelName(route.primary);
4862
+ const mapped = PROVIDER_API_NAMES[id];
4863
+ if (mapped) return mapped;
4864
+ const slashIdx = id.indexOf("/");
4865
+ return slashIdx === -1 ? id : id.slice(slashIdx + 1);
4866
+ }
4371
4867
  var routeEntries2 = /* @__PURE__ */ new Map();
4372
4868
  function routeEntry2(id) {
4373
4869
  const cached = routeEntries2.get(id);
@@ -4390,6 +4886,24 @@ function routeEntry2(id) {
4390
4886
  function tryGetModel2(id) {
4391
4887
  return MODEL_CATALOG2.find((m) => m.id === id) ?? routeEntry2(id);
4392
4888
  }
4889
+ var IMAGE_SIZE_OF_TIER = {
4890
+ "0.5K": "512px",
4891
+ "1K": "1K",
4892
+ "2K": "2K",
4893
+ "4K": "4K"
4894
+ };
4895
+ var IMAGE_QUALITY_LABEL_OF_TIER = {
4896
+ "0.5K": "Low",
4897
+ "1K": "Medium",
4898
+ "2K": "High",
4899
+ // No quality model declares 4K today; named as fal names the step above high.
4900
+ "4K": "Very high"
4901
+ };
4902
+ function imageTierLabel(model, value) {
4903
+ const tier = imageResolutionTier(value);
4904
+ if (!tier) return value;
4905
+ return model?.capabilities?.tierKind === "quality" ? IMAGE_QUALITY_LABEL_OF_TIER[tier] : IMAGE_SIZE_OF_TIER[tier];
4906
+ }
4393
4907
  function imageResolutionTier(value) {
4394
4908
  if (typeof value !== "string") return null;
4395
4909
  switch (value.trim().toLowerCase()) {
@@ -4407,92 +4921,750 @@ function imageResolutionTier(value) {
4407
4921
  return null;
4408
4922
  }
4409
4923
  }
4410
- function supportedResolutions(model) {
4411
- const declared = model?.capabilities?.resolutions;
4412
- return declared ? declared : null;
4413
- }
4414
- function resolutionRefusal(model, resolution) {
4415
- if (resolution === void 0 || resolution === null || resolution === "") return null;
4416
- const supported = supportedResolutions(model);
4417
- if (!model || supported === null) return null;
4418
- const name = model.label ?? model.id;
4419
- if (supported.length === 0) {
4420
- return `${name} takes no resolution setting and always renders at its own size, so "${String(resolution)}" would be silently ignored. Clear the resolution, or pick a model that honours it, such as Nano Banana 2.`;
4421
- }
4422
- const tier = imageResolutionTier(resolution);
4423
- if (tier && supported.includes(tier)) return null;
4424
- return `${name} renders at ${supported.join(", ")}, not "${String(resolution)}". Pick one of those.`;
4425
- }
4426
- var PROMPT_REQUIRED = /* @__PURE__ */ new Set([
4427
- "text-to-image",
4428
- "image-to-image",
4429
- "image-edit",
4430
- "text-to-3d",
4431
- "image-to-3d",
4432
- "multiview-to-3d",
4433
- "text-to-video",
4434
- // Texture: 3D AI Studio refuses a texture request without a prompt or a
4435
- // reference image (probed 2026-09-26), and Studio sends no reference image,
4436
- // so the material description is required. It binds `texturePrompt`, see
4437
- // `promptInputKey`.
4438
- "texture",
4439
- // Audio is prompt-only: a music description (text-to-audio) / the text to
4440
- // speak (text-to-speech). No upstream wire, so no portBinding entry.
4441
- "text-to-audio",
4442
- "text-to-speech"
4443
- ]);
4444
- var PROMPT_OPTIONAL = /* @__PURE__ */ new Set(["image-to-video", "image-to-json", "video-to-video"]);
4445
- function taskNeedsPrompt(task) {
4446
- return PROMPT_REQUIRED.has(task) || PROMPT_OPTIONAL.has(task);
4447
- }
4448
- function taskRequiresPrompt(task) {
4449
- return PROMPT_REQUIRED.has(task);
4450
- }
4451
- function promptInputKey(task) {
4452
- return task === "texture" ? "texturePrompt" : "prompt";
4453
- }
4454
- function portBinding(task, port) {
4455
- if (port === "image" && (task === "image-to-3d" || task === "multiview-to-3d" || task === "image-to-video" || task === "image-to-text" || task === "image-to-json")) {
4456
- return { key: "inputImageUrl", path: "url" };
4457
- }
4458
- if (port === "reference" && task === "image-to-video") {
4459
- return { key: "referenceImageUrls", path: "url", wrap: "array" };
4460
- }
4461
- if (port === "mesh3d" && (task === "remesh" || task === "texture" || task === "rig")) {
4462
- return { key: "parentAssetId", path: "assetId" };
4463
- }
4464
- if (port === "video" && task === "video-to-text") {
4465
- return { key: "inputVideoUrl", path: "url" };
4466
- }
4467
- if (port === "video" && task === "video-to-video") {
4468
- return { key: "inputVideoUrl", path: "url" };
4469
- }
4470
- if (port === "image" && task === "video-to-video") {
4471
- return { key: "inputImages", path: "url", wrap: "array" };
4472
- }
4473
- if (port === "video" && task === "video-enhance") {
4474
- return { key: "draftCacheUrl", path: "draftCacheUrl" };
4475
- }
4476
- if (port === "image" && (task === "image-edit" || task === "image-to-image")) {
4477
- return { key: "inputImages", path: "url", wrap: "array" };
4478
- }
4479
- if (port === "text" && taskNeedsPrompt(task)) {
4480
- return { key: promptInputKey(task), path: "text" };
4481
- }
4482
- if (port === "image" && (task === "upscale" || task === "background-remove")) {
4483
- return { key: "parentAssetId", path: "assetId" };
4484
- }
4485
- if (port === "audio" && task === "speech-to-text") {
4486
- return { key: "inputAudioUrl", path: "url" };
4487
- }
4488
- if (port === "image" && task === "judge") {
4489
- return { key: "candidateAssetIds", path: "assetId", wrap: "array" };
4924
+ var ASPECT_RATIOS2 = [
4925
+ "1:1",
4926
+ "3:2",
4927
+ "2:3",
4928
+ "3:4",
4929
+ "4:3",
4930
+ "4:5",
4931
+ "5:4",
4932
+ "9:16",
4933
+ "16:9",
4934
+ "21:9"
4935
+ ];
4936
+ function omniReferencesPrompt2(prompt, elements) {
4937
+ const parts = ["Image 1 is the exact scene and the first frame of the video: start the clip on it and keep its setting, framing and light."];
4938
+ let next = 2;
4939
+ for (const [i, e] of elements.entries()) {
4940
+ const count2 = 1 + e.referenceImageUrls.length;
4941
+ const span = count2 === 1 ? `Image ${next} shows` : `Images ${next} to ${next + count2 - 1} show`;
4942
+ parts.push(
4943
+ `${span} character ${i + 1}${count2 > 1 ? ", the first of them from the front" : ""}; keep their face, hair and clothing exactly as shown for the whole clip.`
4944
+ );
4945
+ next += count2;
4490
4946
  }
4491
- return null;
4947
+ const text = prompt?.trim() ?? "";
4948
+ return text ? `${parts.join(" ")} ${text}` : parts.join(" ");
4492
4949
  }
4493
- function canConnect(sourceOut, targetTask, targetPort) {
4494
- if (sourceOut !== portContent(targetPort)) return false;
4495
- return portBinding(targetTask, targetPort) !== null;
4950
+ var OMNI_MAX_REFERENCE_IMAGES2 = 7;
4951
+ function veoSpec3(model, label) {
4952
+ return {
4953
+ family: "veo",
4954
+ label,
4955
+ endFrame: true,
4956
+ aspectRatios: ["auto", "16:9", "9:16"],
4957
+ resolutions: ["720p", "1080p", "4k"],
4958
+ durations: { values: [4, 6, 8] },
4959
+ defaultSeconds: 8,
4960
+ defaultResolution: "720p",
4961
+ audioSwitch: false,
4962
+ defaultAudio: true,
4963
+ build: (i) => ({
4964
+ prompt: i.prompt,
4965
+ model,
4966
+ imageUrls: i.end ? [i.start, i.end] : [i.start],
4967
+ // KIE's "Auto" letterboxed a 4:3 still into 16:9 on 2026-09-23; an explicit
4968
+ // ratio is honoured, so only auto maps to KIE's own word for it.
4969
+ ...i.aspectRatio ? { aspect_ratio: i.aspectRatio === "auto" ? "Auto" : i.aspectRatio } : {},
4970
+ resolution: i.resolution,
4971
+ duration: i.seconds
4972
+ })
4973
+ };
4974
+ }
4975
+ var SEEDANCE_ASPECTS2 = ["auto", "1:1", "4:3", "3:4", "16:9", "9:16", "21:9"];
4976
+ var seedanceAspect2 = (a) => a === "auto" ? "adaptive" : a;
4977
+ var KIE_VIDEO_SPECS2 = {
4978
+ veo3_lite: veoSpec3("veo3_lite", "Veo 3.1 Lite"),
4979
+ veo3_fast: veoSpec3("veo3_fast", "Veo 3.1 Fast"),
4980
+ veo3: veoSpec3("veo3", "Veo 3.1"),
4981
+ "grok-imagine/image-to-video": {
4982
+ family: "job",
4983
+ label: "Grok Imagine",
4984
+ endFrame: false,
4985
+ resolutions: ["480p", "720p", "1080p"],
4986
+ durations: { min: 6, max: 30 },
4987
+ defaultSeconds: 6,
4988
+ defaultResolution: "720p",
4989
+ // Not a contradiction with the catalog saying Grok renders with audio: xAI
4990
+ // always renders audio and KIE exposes no switch for it. `defaultAudio`
4991
+ // here only feeds `price()`, which ignores it, so it states no audio fact.
4992
+ audioSwitch: false,
4993
+ defaultAudio: false,
4994
+ build: (i) => ({
4995
+ image_urls: [i.start],
4996
+ prompt: i.prompt,
4997
+ mode: "normal",
4998
+ duration: String(i.seconds),
4999
+ resolution: i.resolution,
5000
+ nsfw_checker: true
5001
+ })
5002
+ },
5003
+ "grok-imagine-video-1-5-preview": {
5004
+ family: "job",
5005
+ label: "Grok Imagine 1.5",
5006
+ endFrame: false,
5007
+ // KIE lists no 1080p price for 1.5, so 1080p is not offered.
5008
+ resolutions: ["480p", "720p"],
5009
+ durations: { min: 1, max: 15 },
5010
+ defaultSeconds: 8,
5011
+ defaultResolution: "720p",
5012
+ // As for Grok Imagine 1.0 above: audio is always rendered, with no switch.
5013
+ audioSwitch: false,
5014
+ defaultAudio: false,
5015
+ build: (i) => ({
5016
+ image_urls: [i.start],
5017
+ prompt: i.prompt,
5018
+ duration: i.seconds,
5019
+ resolution: i.resolution,
5020
+ nsfw_checker: true
5021
+ })
5022
+ },
5023
+ "kling/v2-5-turbo-image-to-video-pro": {
5024
+ family: "job",
5025
+ label: "Kling 2.5 Turbo Pro",
5026
+ endFrame: true,
5027
+ resolutions: [],
5028
+ durations: { values: [5, 10] },
5029
+ defaultSeconds: 5,
5030
+ defaultResolution: "",
5031
+ audioSwitch: false,
5032
+ defaultAudio: false,
5033
+ build: (i) => ({
5034
+ prompt: i.prompt,
5035
+ image_url: i.start,
5036
+ ...i.end ? { tail_image_url: i.end } : {},
5037
+ duration: String(i.seconds),
5038
+ ...i.negativePrompt ? { negative_prompt: i.negativePrompt } : {}
5039
+ })
5040
+ },
5041
+ "kling-2.6/image-to-video": {
5042
+ family: "job",
5043
+ label: "Kling 2.6",
5044
+ endFrame: false,
5045
+ resolutions: [],
5046
+ durations: { values: [5, 10] },
5047
+ defaultSeconds: 5,
5048
+ defaultResolution: "",
5049
+ audioSwitch: true,
5050
+ defaultAudio: false,
5051
+ build: (i) => ({
5052
+ prompt: i.prompt,
5053
+ image_urls: [i.start],
5054
+ sound: i.audio,
5055
+ duration: String(i.seconds)
5056
+ })
5057
+ },
5058
+ "bytedance/seedance-2": {
5059
+ family: "job",
5060
+ label: "Seedance 2.0",
5061
+ endFrame: true,
5062
+ aspectRatios: SEEDANCE_ASPECTS2,
5063
+ resolutions: ["480p", "720p", "1080p", "4k"],
5064
+ durations: { min: 4, max: 15 },
5065
+ defaultSeconds: 5,
5066
+ defaultResolution: "720p",
5067
+ audioSwitch: true,
5068
+ defaultAudio: true,
5069
+ build: (i) => ({
5070
+ prompt: i.prompt,
5071
+ first_frame_url: i.start,
5072
+ ...i.end ? { last_frame_url: i.end } : {},
5073
+ generate_audio: i.audio,
5074
+ resolution: i.resolution,
5075
+ ...i.aspectRatio ? { aspect_ratio: seedanceAspect2(i.aspectRatio) } : {},
5076
+ duration: i.seconds,
5077
+ nsfw_checker: true
5078
+ })
5079
+ },
5080
+ "bytedance/seedance-2-5": {
5081
+ family: "job",
5082
+ label: "Seedance 2.5",
5083
+ endFrame: true,
5084
+ aspectRatios: SEEDANCE_ASPECTS2,
5085
+ resolutions: ["480p", "720p", "1080p"],
5086
+ durations: { min: 4, max: 30 },
5087
+ defaultSeconds: 5,
5088
+ defaultResolution: "720p",
5089
+ audioSwitch: true,
5090
+ defaultAudio: true,
5091
+ build: (i) => ({
5092
+ prompt: i.prompt,
5093
+ first_frame_url: i.start,
5094
+ ...i.end ? { last_frame_url: i.end } : {},
5095
+ generate_audio: i.audio,
5096
+ resolution: i.resolution,
5097
+ ...i.aspectRatio ? { aspect_ratio: seedanceAspect2(i.aspectRatio) } : {},
5098
+ duration: i.seconds,
5099
+ nsfw_checker: true
5100
+ })
5101
+ },
5102
+ "wan/3-0-video": {
5103
+ family: "job",
5104
+ label: "Wan 3.0",
5105
+ endFrame: true,
5106
+ aspectRatios: ["auto", "16:9", "4:3", "1:1", "3:4", "9:16"],
5107
+ resolutions: ["480p", "720p", "1080p"],
5108
+ durations: { min: 2, max: 30 },
5109
+ defaultSeconds: 5,
5110
+ defaultResolution: "720p",
5111
+ audioSwitch: true,
5112
+ defaultAudio: true,
5113
+ build: (i) => ({
5114
+ prompt: i.prompt,
5115
+ first_frame_url: i.start,
5116
+ ...i.end ? { last_frame_url: i.end } : {},
5117
+ resolution: i.resolution.toUpperCase(),
5118
+ ...i.aspectRatio ? { aspect_ratio: i.aspectRatio === "auto" ? "adaptive" : i.aspectRatio } : {},
5119
+ duration: i.seconds,
5120
+ audio: i.audio,
5121
+ ...i.seed !== void 0 ? { seed: i.seed } : {},
5122
+ nsfw_checker: true
5123
+ })
5124
+ },
5125
+ "minimax-h3/image-to-video": {
5126
+ family: "job",
5127
+ label: "MiniMax H3",
5128
+ endFrame: true,
5129
+ // KIE renders 768P or 2K; the canvas's 720p and 1080p map onto them.
5130
+ resolutions: ["720p", "1080p"],
5131
+ durations: { min: 4, max: 15 },
5132
+ defaultSeconds: 6,
5133
+ defaultResolution: "720p",
5134
+ audioSwitch: false,
5135
+ defaultAudio: false,
5136
+ build: (i) => ({
5137
+ prompt: i.prompt,
5138
+ first_frame_url: i.start,
5139
+ ...i.end ? { last_frame_url: i.end } : {},
5140
+ duration: i.seconds,
5141
+ resolution: i.resolution === "1080p" ? "2K" : "768P"
5142
+ })
5143
+ },
5144
+ "google/gemini-omni-flash-1-1": {
5145
+ family: "job",
5146
+ label: "Gemini Omni 1.1 Flash",
5147
+ endFrame: true,
5148
+ aspectRatios: ["16:9", "9:16"],
5149
+ // KIE also renders 360p; the canvas offers none below 480p.
5150
+ resolutions: ["720p", "1080p", "4k"],
5151
+ durations: { values: [4, 6, 8, 10] },
5152
+ defaultSeconds: 8,
5153
+ defaultResolution: "720p",
5154
+ audioSwitch: false,
5155
+ defaultAudio: false,
5156
+ // The first-and-last-frame mode: KIE refuses it combined with registered
5157
+ // characters, reference images, audio or video, so none are sent.
5158
+ build: (i) => ({
5159
+ prompt: i.prompt,
5160
+ first_frame_url: i.start,
5161
+ ...i.end ? { last_frame_url: i.end } : {},
5162
+ duration: String(i.seconds),
5163
+ resolution: i.resolution,
5164
+ ...i.aspectRatio ? { aspect_ratio: i.aspectRatio } : {},
5165
+ ...i.seed !== void 0 ? { seed: i.seed } : {}
5166
+ })
5167
+ },
5168
+ // Gemini Omni 1.1 Flash in its REFERENCE mode: up to seven `image_urls`
5169
+ // ("Multiple reference images can be uploaded to provide references for
5170
+ // characters, scenes, styles, or storyboards"; "Maximum of 7 images"), and
5171
+ // no locked first frame, because KIE makes `first_frame_url` "mutually
5172
+ // exclusive with `image_urls`" (docs.kie.ai, read 2026-10-24). The start
5173
+ // keyframe goes first among the images and the prompt names it the exact
5174
+ // scene and first frame (`omniReferencesPrompt`); each character's views
5175
+ // follow. Same model, same price as the first-frame mode.
5176
+ "google/gemini-omni-flash-1-1/references": {
5177
+ family: "job",
5178
+ label: "Gemini Omni 1.1 Flash with references",
5179
+ upstreamModel: "google/gemini-omni-flash-1-1",
5180
+ endFrame: false,
5181
+ aspectRatios: ["16:9", "9:16"],
5182
+ resolutions: ["720p", "1080p", "4k"],
5183
+ durations: { values: [4, 6, 8, 10] },
5184
+ defaultSeconds: 8,
5185
+ defaultResolution: "720p",
5186
+ audioSwitch: false,
5187
+ defaultAudio: false,
5188
+ // Six character images, because the start keyframe takes one of the seven.
5189
+ characterReferences: {
5190
+ maxElements: 6,
5191
+ minImagesPerElement: 1,
5192
+ maxImagesPerElement: 6,
5193
+ maxTotalImages: OMNI_MAX_REFERENCE_IMAGES2 - 1
5194
+ },
5195
+ maxPromptChars: 2e4,
5196
+ referencesPrompt: omniReferencesPrompt2,
5197
+ build: (i) => ({
5198
+ prompt: i.prompt,
5199
+ image_urls: [i.start, ...(i.elements ?? []).flatMap((e) => [e.frontalImageUrl, ...e.referenceImageUrls])],
5200
+ duration: String(i.seconds),
5201
+ resolution: i.resolution,
5202
+ ...i.aspectRatio ? { aspect_ratio: i.aspectRatio } : {},
5203
+ ...i.seed !== void 0 ? { seed: i.seed } : {}
5204
+ })
5205
+ },
5206
+ "kling-3.0-omni/image-to-video": {
5207
+ family: "job",
5208
+ label: "Kling O3",
5209
+ endFrame: true,
5210
+ // Kling O3 takes an aspect ratio only for multi-shot prompts; a single shot
5211
+ // follows the start frame.
5212
+ resolutions: ["720p", "1080p", "4k"],
5213
+ durations: { min: 3, max: 15 },
5214
+ defaultSeconds: 5,
5215
+ defaultResolution: "720p",
5216
+ audioSwitch: true,
5217
+ defaultAudio: false,
5218
+ // KIE's "Single First Frame" and "First and Last Frames" request shapes
5219
+ // both carry `elements`: "up to 3 subjects", and "for a multi-image
5220
+ // subject, provide 2 to 4 images" (docs.kie.ai, kling-3.0-omni
5221
+ // image-to-video, read 2026-10-23). Each element needs a name the prompt
5222
+ // can mention as `@name` and a description.
5223
+ characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 12 },
5224
+ maxPromptChars: 3072,
5225
+ build: (i) => ({
5226
+ prompt: i.prompt,
5227
+ image_urls: i.end ? [i.start, i.end] : [i.start],
5228
+ duration: i.seconds,
5229
+ resolution: i.resolution,
5230
+ audio: i.audio,
5231
+ // Named Element1, Element2, ... so one prompt convention (`@Element1`)
5232
+ // holds on KIE and on the fal twin alike.
5233
+ ...i.elements && i.elements.length > 0 ? {
5234
+ elements: i.elements.map((e, n) => ({
5235
+ name: `Element${n + 1}`,
5236
+ description: `character ${n + 1}`,
5237
+ element_input_urls: [e.frontalImageUrl, ...e.referenceImageUrls]
5238
+ }))
5239
+ } : {}
5240
+ })
5241
+ }
5242
+ };
5243
+ function veoSpec22(label, resolutions) {
5244
+ return {
5245
+ label,
5246
+ // OpenRouter's Veo has no auto: it renders exactly one of these.
5247
+ aspectRatios: ["16:9", "9:16"],
5248
+ resolutions,
5249
+ durations: { values: [4, 6, 8] },
5250
+ defaultSeconds: 8,
5251
+ defaultResolution: "720p"
5252
+ };
5253
+ }
5254
+ var OPENROUTER_VIDEO_SPECS2 = {
5255
+ "google/veo-3.1-lite": veoSpec22("Veo 3.1 Lite", ["720p", "1080p"]),
5256
+ "google/veo-3.1-fast": veoSpec22("Veo 3.1 Fast", ["720p", "1080p", "4k"]),
5257
+ "google/veo-3.1": veoSpec22("Veo 3.1", ["720p", "1080p", "4k"])
5258
+ };
5259
+ var GROK_IMAGINE_I2V_ENDPOINT2 = "xai/grok-imagine-video/image-to-video";
5260
+ var GROK_IMAGINE_15_I2V_ENDPOINT2 = "xai/grok-imagine-video/v1.5/image-to-video";
5261
+ var WAN_30_I2V_ENDPOINT2 = "alibaba/wan-3.0/image-to-video";
5262
+ var KLING_26_I2V_ENDPOINT2 = "fal-ai/kling-video/v2.6/pro/image-to-video";
5263
+ var KLING_O3_STANDARD_I2V_ENDPOINT2 = "fal-ai/kling-video/o3/standard/image-to-video";
5264
+ var KLING_O3_PRO_I2V_ENDPOINT2 = "fal-ai/kling-video/o3/pro/image-to-video";
5265
+ var KLING_O3_I2V_ENDPOINTS2 = [KLING_O3_STANDARD_I2V_ENDPOINT2, KLING_O3_PRO_I2V_ENDPOINT2];
5266
+ var GEMINI_OMNI_11_I2V_ENDPOINT2 = "google/gemini-omni-flash/v1.1/image-to-video";
5267
+ var KLING_V3_STANDARD_I2V_ENDPOINT2 = "fal-ai/kling-video/v3/standard/image-to-video";
5268
+ var KLING_V3_PRO_I2V_ENDPOINT2 = "fal-ai/kling-video/v3/pro/image-to-video";
5269
+ var KLING_V3_I2V_ENDPOINTS2 = [KLING_V3_STANDARD_I2V_ENDPOINT2, KLING_V3_PRO_I2V_ENDPOINT2];
5270
+ var KLING_V4_I2V_ENDPOINT2 = "kling/v4/image-to-video";
5271
+ var MINIMAX_H3_I2V_ENDPOINT2 = "minimax/h3/image-to-video";
5272
+ var KLING_O3_PRO_R2V_ENDPOINT2 = "fal-ai/kling-video/o3/pro/reference-to-video";
5273
+ var FAL_CHARACTER_REFERENCE_LIMITS2 = {
5274
+ [KLING_O3_PRO_R2V_ENDPOINT2]: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
5275
+ };
5276
+ var LTX_25_FAST_I2V_ENDPOINT2 = "lightricks/ltx-2.5/image-to-video/fast";
5277
+ var LTX_25_PRO_I2V_ENDPOINT2 = "lightricks/ltx-2.5/image-to-video/pro";
5278
+ var LTX_25_I2V_ENDPOINTS2 = [LTX_25_FAST_I2V_ENDPOINT2, LTX_25_PRO_I2V_ENDPOINT2];
5279
+ var VEO_LITE_I2V_ENDPOINT2 = "fal-ai/veo3.1/lite/image-to-video";
5280
+ var VEO_LITE_FLF_ENDPOINT2 = "fal-ai/veo3.1/lite/first-last-frame-to-video";
5281
+ var VEO_FAST_I2V_ENDPOINT2 = "fal-ai/veo3.1/fast/image-to-video";
5282
+ var VEO_FAST_FLF_ENDPOINT2 = "fal-ai/veo3.1/fast/first-last-frame-to-video";
5283
+ var VEO_I2V_ENDPOINT2 = "fal-ai/veo3.1/image-to-video";
5284
+ var VEO_FLF_ENDPOINT2 = "fal-ai/veo3.1/first-last-frame-to-video";
5285
+ var VEO_ENDPOINTS2 = [
5286
+ VEO_LITE_I2V_ENDPOINT2,
5287
+ VEO_LITE_FLF_ENDPOINT2,
5288
+ VEO_FAST_I2V_ENDPOINT2,
5289
+ VEO_FAST_FLF_ENDPOINT2,
5290
+ VEO_I2V_ENDPOINT2,
5291
+ VEO_FLF_ENDPOINT2
5292
+ ];
5293
+ var VIDEO_FIXED_RESOLUTION2 = {
5294
+ "blackforestlabs/flux-3/keyframes-to-video/draft": "720p",
5295
+ "blackforestlabs/flux-3/first-last-frame-to-video/draft": "720p",
5296
+ "blackforestlabs/flux-3/image-to-video/draft": "720p",
5297
+ "blackforestlabs/flux-3/draft-enhance": "1080p",
5298
+ // Not a resolution the caller picks: Kling O3 Edit renders at the source's.
5299
+ "fal-ai/kling-video/o3/pro/video-to-video/edit": "source",
5300
+ // Kling 2.6 Pro takes no resolution; it renders 1080p.
5301
+ [KLING_26_I2V_ENDPOINT2]: "1080p",
5302
+ // Not a resolution the caller picks: Kling O3's tier sets the size.
5303
+ [KLING_O3_STANDARD_I2V_ENDPOINT2]: "fixed",
5304
+ [KLING_O3_PRO_I2V_ENDPOINT2]: "fixed",
5305
+ [KLING_O3_PRO_R2V_ENDPOINT2]: "fixed",
5306
+ // Kling 3.0 likewise: its tier sets the size.
5307
+ [KLING_V3_STANDARD_I2V_ENDPOINT2]: "fixed",
5308
+ [KLING_V3_PRO_I2V_ENDPOINT2]: "fixed"
5309
+ };
5310
+ var VIDEO_PINNED_DEFAULT_SECONDS2 = {
5311
+ [GROK_IMAGINE_I2V_ENDPOINT2]: 5,
5312
+ // Veo defaults to 8 s itself, and 8 s is the only length Lite first-and-last
5313
+ // renders; pinning it keeps the bill and the clip in step either way.
5314
+ ...Object.fromEntries(VEO_ENDPOINTS2.map((e) => [e, 8])),
5315
+ // The fal twins render the length their KIE entries default to, so a clip
5316
+ // falling back from KIE to fal has the same length.
5317
+ [GROK_IMAGINE_15_I2V_ENDPOINT2]: 8,
5318
+ [WAN_30_I2V_ENDPOINT2]: 5,
5319
+ [KLING_26_I2V_ENDPOINT2]: 5,
5320
+ [KLING_O3_STANDARD_I2V_ENDPOINT2]: 5,
5321
+ [KLING_O3_PRO_I2V_ENDPOINT2]: 5,
5322
+ [KLING_O3_PRO_R2V_ENDPOINT2]: 5,
5323
+ [GEMINI_OMNI_11_I2V_ENDPOINT2]: 8,
5324
+ // fal's own default on Kling 3.0 and 4.0 (schemas read 2026-11-03).
5325
+ [KLING_V3_STANDARD_I2V_ENDPOINT2]: 5,
5326
+ [KLING_V3_PRO_I2V_ENDPOINT2]: 5,
5327
+ [KLING_V4_I2V_ENDPOINT2]: 5,
5328
+ // fal's own default on MiniMax H3 (schema read 2026-11-04).
5329
+ [MINIMAX_H3_I2V_ENDPOINT2]: 5,
5330
+ // LTX-2.5 defaults to "auto", a length nobody can price up front; 6 s is its
5331
+ // shortest clip on both tiers.
5332
+ [LTX_25_FAST_I2V_ENDPOINT2]: 6,
5333
+ [LTX_25_PRO_I2V_ENDPOINT2]: 6,
5334
+ // fal's own default is 5 s on these (schemas read 2026-10-25); sent so the
5335
+ // bill cannot drift from the clip if fal ever changes it.
5336
+ "fal-ai/kling-video/v2.5-turbo/pro/image-to-video": 5,
5337
+ "fal-ai/bytedance/seedance/v1/pro/image-to-video": 5,
5338
+ "fal-ai/bytedance/seedance/v1/pro/text-to-video": 5,
5339
+ "blackforestlabs/flux-3/first-last-frame-to-video": 5,
5340
+ "blackforestlabs/flux-3/first-last-frame-to-video/draft": 5,
5341
+ "blackforestlabs/flux-3/keyframes-to-video": 5,
5342
+ "blackforestlabs/flux-3/keyframes-to-video/draft": 5,
5343
+ // `auto` by default on these (fal schemas, 2026-10-25): the model would pick
5344
+ // a length nobody can price. 5 s is the shortest FLUX.3 renders and the clip
5345
+ // the Seedance anchors were priced at.
5346
+ "bytedance/seedance-2.0/image-to-video": 5,
5347
+ "bytedance/seedance-2.5/image-to-video": 5,
5348
+ "bytedance/seedance-2.5/text-to-video": 5,
5349
+ "blackforestlabs/flux-3/image-to-video": 5,
5350
+ "blackforestlabs/flux-3/image-to-video/draft": 5
5351
+ };
5352
+ var VIDEO_DEFAULT_RESOLUTION2 = {
5353
+ "blackforestlabs/flux-3/keyframes-to-video": "720p",
5354
+ "blackforestlabs/flux-3/first-last-frame-to-video": "720p",
5355
+ "blackforestlabs/flux-3/image-to-video": "720p",
5356
+ // fal schema default: Grok renders 720p.
5357
+ [GROK_IMAGINE_I2V_ENDPOINT2]: "720p",
5358
+ ...Object.fromEntries(VEO_ENDPOINTS2.map((e) => [e, "720p"])),
5359
+ [GROK_IMAGINE_15_I2V_ENDPOINT2]: "720p",
5360
+ // fal schema default: Wan 3.0 renders 1080p unless asked for less.
5361
+ [WAN_30_I2V_ENDPOINT2]: "1080p",
5362
+ // fal schema default: Gemini Omni renders 720p, as on KIE.
5363
+ [GEMINI_OMNI_11_I2V_ENDPOINT2]: "720p",
5364
+ // fal schema default: Kling 4.0 renders 1080p unless asked for 720p.
5365
+ [KLING_V4_I2V_ENDPOINT2]: "1080p",
5366
+ // fal schema default: MiniMax H3 renders 2K (the canvas's 1080p) unless asked.
5367
+ [MINIMAX_H3_I2V_ENDPOINT2]: "1080p",
5368
+ // fal schema default: LTX-2.5 renders 1080p unless asked for less.
5369
+ [LTX_25_FAST_I2V_ENDPOINT2]: "1080p",
5370
+ [LTX_25_PRO_I2V_ENDPOINT2]: "1080p"
5371
+ };
5372
+ var VIDEO_ALLOWED_VALUES2 = {
5373
+ // Seedance 2.5 derives its aspect from the input image.
5374
+ "bytedance/seedance-2.5/image-to-video": { aspectRatio: ["auto"] },
5375
+ "fal-ai/kling-video/v2.5-turbo/pro/image-to-video": {
5376
+ aspectRatio: ["16:9", "9:16", "1:1"],
5377
+ durationSeconds: { values: [5, 10] }
5378
+ },
5379
+ [GROK_IMAGINE_I2V_ENDPOINT2]: {
5380
+ aspectRatio: ["auto", "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16"],
5381
+ resolution: ["480p", "720p"],
5382
+ durationSeconds: { min: 1, max: 15 }
5383
+ },
5384
+ ...Object.fromEntries(
5385
+ VEO_ENDPOINTS2.map((e) => [
5386
+ e,
5387
+ {
5388
+ aspectRatio: ["auto", "16:9", "9:16"],
5389
+ resolution: e === VEO_LITE_I2V_ENDPOINT2 || e === VEO_LITE_FLF_ENDPOINT2 ? ["720p", "1080p"] : ["720p", "1080p", "4k"],
5390
+ // Lite first-and-last renders 8 s only (its schema pins the const).
5391
+ durationSeconds: { values: e === VEO_LITE_FLF_ENDPOINT2 ? [8] : [4, 6, 8] }
5392
+ }
5393
+ ])
5394
+ ),
5395
+ [GROK_IMAGINE_15_I2V_ENDPOINT2]: { resolution: ["480p", "720p", "1080p"], durationSeconds: { min: 1, max: 15 } },
5396
+ [WAN_30_I2V_ENDPOINT2]: {
5397
+ aspectRatio: ["auto", "16:9", "4:3", "1:1", "3:4", "9:16"],
5398
+ resolution: ["480p", "720p", "1080p"]
5399
+ },
5400
+ [KLING_26_I2V_ENDPOINT2]: { durationSeconds: { values: [5, 10] } },
5401
+ ...Object.fromEntries(KLING_O3_I2V_ENDPOINTS2.map((e) => [e, { durationSeconds: { min: 3, max: 15 } }])),
5402
+ // Reference-to-video renders at a set ratio (default 16:9), not the frame's.
5403
+ [KLING_O3_PRO_R2V_ENDPOINT2]: { aspectRatio: ["16:9", "9:16", "1:1"], durationSeconds: { min: 3, max: 15 } },
5404
+ [LTX_25_FAST_I2V_ENDPOINT2]: {
5405
+ aspectRatio: ["auto", "16:9", "9:16"],
5406
+ // fal also renders 1440p, which the canvas does not offer.
5407
+ resolution: ["720p", "1080p", "4k"],
5408
+ durationSeconds: { values: [6, 8, 10, 12, 14, 16, 18, 20] }
5409
+ },
5410
+ [LTX_25_PRO_I2V_ENDPOINT2]: {
5411
+ aspectRatio: ["auto", "16:9", "9:16"],
5412
+ resolution: ["720p", "1080p"],
5413
+ durationSeconds: { values: [6, 8, 10] }
5414
+ },
5415
+ // fal also renders 360p, which the canvas does not offer.
5416
+ [GEMINI_OMNI_11_I2V_ENDPOINT2]: {
5417
+ aspectRatio: ["16:9", "9:16"],
5418
+ resolution: ["720p", "1080p", "4k"],
5419
+ durationSeconds: { min: 3, max: 10 }
5420
+ },
5421
+ ...Object.fromEntries(KLING_V3_I2V_ENDPOINTS2.map((e) => [e, { durationSeconds: { min: 3, max: 15 } }])),
5422
+ [KLING_V4_I2V_ENDPOINT2]: { resolution: ["720p", "1080p"], durationSeconds: { min: 3, max: 30 } },
5423
+ // fal also renders 480P, which the canvas does not offer. Its shortest clip
5424
+ // is 5 s (KIE's is 4 s), so a 4 s job on the H3 route has no fal fallback.
5425
+ [MINIMAX_H3_I2V_ENDPOINT2]: { resolution: ["720p", "1080p", "4k"], durationSeconds: { min: 5, max: 15 } }
5426
+ };
5427
+ var VIDEO_MAX_SECONDS_AT_RESOLUTION2 = {
5428
+ [LTX_25_FAST_I2V_ENDPOINT2]: { "4k": 10 }
5429
+ };
5430
+ var VIDEO_UNSUPPORTED_PARAMS2 = {
5431
+ // Kling 2.5 Turbo and Seedance 1.0 Pro render silent clips and their schemas
5432
+ // declare no audio field at all (fal model schemas, checked 2026-10-25), so a
5433
+ // sound choice is refused before submit instead of being sent and ignored.
5434
+ "fal-ai/kling-video/v2.5-turbo/pro/image-to-video": ["generateAudio"],
5435
+ "fal-ai/bytedance/seedance/v1/pro/image-to-video": ["generateAudio"],
5436
+ "fal-ai/bytedance/seedance/v1/pro/text-to-video": ["generateAudio"],
5437
+ // Kling O3 Edit follows the source clip: its length, frame, size and look are
5438
+ // the source's, and the endpoint declares none of these knobs. A duration in
5439
+ // particular would only have been a (wrong) billing figure; the completer
5440
+ // measures the result instead.
5441
+ "fal-ai/kling-video/o3/pro/video-to-video/edit": [
5442
+ "resolution",
5443
+ "seed",
5444
+ "negativePrompt",
5445
+ "aspectRatio",
5446
+ "generateAudio",
5447
+ "durationSeconds"
5448
+ ],
5449
+ // Wan's output is also as long as its source; it takes resolution and seed.
5450
+ "fal-ai/wan/v2.2-14b/animate/replace": ["durationSeconds", "negativePrompt", "aspectRatio", "generateAudio"],
5451
+ "blackforestlabs/flux-3/keyframes-to-video/draft": ["resolution", "seed", "negativePrompt"],
5452
+ "blackforestlabs/flux-3/first-last-frame-to-video/draft": ["resolution", "seed", "negativePrompt"],
5453
+ "blackforestlabs/flux-3/image-to-video/draft": ["resolution", "seed", "negativePrompt"],
5454
+ // The direct tier adds `resolution` (720p | 1080p) and nothing else: `seed` is
5455
+ // OUTPUT only on every FLUX.3 endpoint, so a caller cannot pin a take by seed.
5456
+ "blackforestlabs/flux-3/keyframes-to-video": ["seed", "negativePrompt"],
5457
+ "blackforestlabs/flux-3/first-last-frame-to-video": ["seed", "negativePrompt"],
5458
+ "blackforestlabs/flux-3/image-to-video": ["seed", "negativePrompt"],
5459
+ // Enhance renders whatever the cache holds: duration, aspect, audio and prompt
5460
+ // are all baked in, and the output is a fixed 1080p. `durationSeconds` is NOT
5461
+ // banned although it is not forwarded either (buildFalVideoInput sends only
5462
+ // the cache url + safety_tolerance): the executor injects the upstream
5463
+ // draft's duration as a COST hint, since enhance bills per second and
5464
+ // the request itself carries nothing the estimate could read.
5465
+ "blackforestlabs/flux-3/draft-enhance": [
5466
+ "resolution",
5467
+ "seed",
5468
+ "negativePrompt",
5469
+ "aspectRatio",
5470
+ "generateAudio"
5471
+ ],
5472
+ // Grok's schema declares no seed, negative prompt or audio switch: it always
5473
+ // renders audio.
5474
+ [GROK_IMAGINE_I2V_ENDPOINT2]: ["seed", "negativePrompt", "generateAudio"],
5475
+ [GROK_IMAGINE_15_I2V_ENDPOINT2]: ["aspectRatio", "seed", "negativePrompt", "generateAudio"],
5476
+ [WAN_30_I2V_ENDPOINT2]: ["negativePrompt"],
5477
+ [KLING_26_I2V_ENDPOINT2]: ["resolution", "aspectRatio", "seed"],
5478
+ ...Object.fromEntries(KLING_O3_I2V_ENDPOINTS2.map((e) => [e, ["resolution", "aspectRatio", "seed", "negativePrompt"]])),
5479
+ // Its tier sets the size; it takes an aspect ratio, but no seed or negative prompt.
5480
+ [KLING_O3_PRO_R2V_ENDPOINT2]: ["resolution", "seed", "negativePrompt"],
5481
+ ...Object.fromEntries(LTX_25_I2V_ENDPOINTS2.map((e) => [e, ["seed", "negativePrompt"]])),
5482
+ // Its schema declares no seed, negative prompt or audio switch: it always
5483
+ // renders audio, at no extra charge.
5484
+ [GEMINI_OMNI_11_I2V_ENDPOINT2]: ["seed", "negativePrompt", "generateAudio"],
5485
+ // Kling 3.0: the tier sets the size and the start frame the shape; it takes a
5486
+ // negative prompt but no seed.
5487
+ ...Object.fromEntries(KLING_V3_I2V_ENDPOINTS2.map((e) => [e, ["resolution", "aspectRatio", "seed"]])),
5488
+ // Kling 4.0 follows the start frame's shape and always renders sound.
5489
+ [KLING_V4_I2V_ENDPOINT2]: ["aspectRatio", "seed", "negativePrompt", "generateAudio"],
5490
+ // MiniMax H3 follows the start frame's shape and always renders sound (a 5 s
5491
+ // test render of 2026-11-04 had a video and an audio track); it takes a seed.
5492
+ [MINIMAX_H3_I2V_ENDPOINT2]: ["aspectRatio", "negativePrompt", "generateAudio"]
5493
+ };
5494
+ var VIDEO_AUDIO_SWITCH2 = {
5495
+ ...Object.fromEntries(VEO_ENDPOINTS2.map((e) => [e, { default: false }])),
5496
+ [KLING_26_I2V_ENDPOINT2]: { default: false },
5497
+ ...Object.fromEntries(KLING_O3_I2V_ENDPOINTS2.map((e) => [e, { default: false }])),
5498
+ [KLING_O3_PRO_R2V_ENDPOINT2]: { default: false },
5499
+ // Kling 3.0 renders sound unless sent false; Studio sends it silent unless asked.
5500
+ ...Object.fromEntries(KLING_V3_I2V_ENDPOINTS2.map((e) => [e, { default: false }])),
5501
+ "bytedance/seedance-2.5/image-to-video": { default: true },
5502
+ "bytedance/seedance-2.0/image-to-video": { default: true },
5503
+ [WAN_30_I2V_ENDPOINT2]: { default: true },
5504
+ ...Object.fromEntries(LTX_25_I2V_ENDPOINTS2.map((e) => [e, { default: true }])),
5505
+ "blackforestlabs/flux-3/image-to-video/draft": { default: true },
5506
+ "blackforestlabs/flux-3/first-last-frame-to-video/draft": { default: true },
5507
+ "blackforestlabs/flux-3/keyframes-to-video/draft": { default: true },
5508
+ "blackforestlabs/flux-3/image-to-video": { default: true },
5509
+ "blackforestlabs/flux-3/first-last-frame-to-video": { default: true },
5510
+ "blackforestlabs/flux-3/keyframes-to-video": { default: true }
5511
+ };
5512
+ var NO_AUDIO_SWITCH = { switchable: false };
5513
+ function videoSettingSupport(model) {
5514
+ if (!model?.id || model.modality !== "video") return null;
5515
+ const upstream = getProviderModelName(model.id);
5516
+ if (model.provider === "kie") {
5517
+ const spec = KIE_VIDEO_SPECS2[upstream];
5518
+ if (!spec) return null;
5519
+ return {
5520
+ aspectRatios: spec.aspectRatios ?? [],
5521
+ resolutions: spec.resolutions,
5522
+ durations: spec.durations,
5523
+ defaultSeconds: spec.defaultSeconds,
5524
+ // The KIE spec says whether the job may switch audio (`audioSwitch`, the
5525
+ // rule its pre-submit check refuses by); its `defaultAudio` is the state
5526
+ // only where there is a switch.
5527
+ generateAudio: spec.audioSwitch ? { switchable: true, default: spec.defaultAudio } : NO_AUDIO_SWITCH
5528
+ };
5529
+ }
5530
+ if (model.provider === "openrouter") {
5531
+ const spec = OPENROUTER_VIDEO_SPECS2[upstream];
5532
+ if (!spec) return null;
5533
+ return {
5534
+ aspectRatios: spec.aspectRatios,
5535
+ resolutions: spec.resolutions,
5536
+ durations: spec.durations,
5537
+ defaultSeconds: spec.defaultSeconds,
5538
+ // Every OpenRouter video model is sent `generate_audio`, silent unless
5539
+ // the job asks (`openRouterVideoPlan`).
5540
+ generateAudio: { switchable: true, default: false }
5541
+ };
5542
+ }
5543
+ if (model.provider === "fal") {
5544
+ const allowed = VIDEO_ALLOWED_VALUES2[upstream];
5545
+ const unsupported = VIDEO_UNSUPPORTED_PARAMS2[upstream] ?? [];
5546
+ const pinned = VIDEO_PINNED_DEFAULT_SECONDS2[upstream];
5547
+ const maxSecondsAt = VIDEO_MAX_SECONDS_AT_RESOLUTION2[upstream];
5548
+ return {
5549
+ ...maxSecondsAt ? { maxSecondsAt } : {},
5550
+ aspectRatios: unsupported.includes("aspectRatio") ? [] : allowed?.aspectRatio ?? null,
5551
+ resolutions: unsupported.includes("resolution") ? [] : allowed?.resolution ?? null,
5552
+ durations: unsupported.includes("durationSeconds") ? { values: [] } : allowed?.durationSeconds ?? null,
5553
+ ...pinned !== void 0 ? { defaultSeconds: pinned } : {},
5554
+ generateAudio: falAudioSupport(upstream, unsupported)
5555
+ };
5556
+ }
5557
+ return null;
5558
+ }
5559
+ function falAudioSupport(endpoint, unsupported) {
5560
+ if (unsupported.includes("generateAudio")) return NO_AUDIO_SWITCH;
5561
+ const declared = VIDEO_AUDIO_SWITCH2[endpoint];
5562
+ return declared ? { switchable: true, default: declared.default } : null;
5563
+ }
5564
+ function supportedResolutions(model) {
5565
+ const declared = model?.capabilities?.resolutions;
5566
+ return declared ? declared : null;
5567
+ }
5568
+ function resolutionRefusal(model, resolution) {
5569
+ if (resolution === void 0 || resolution === null || resolution === "") return null;
5570
+ const supported = supportedResolutions(model);
5571
+ if (!model || supported === null) return null;
5572
+ const name = model.label ?? model.id;
5573
+ if (supported.length === 0) {
5574
+ return `${name} takes no resolution setting and always renders at its own size, so "${String(resolution)}" would be silently ignored. Clear the resolution, or pick a model that honours it, such as Nano Banana 2.`;
5575
+ }
5576
+ const tier = imageResolutionTier(resolution);
5577
+ if (tier && supported.includes(tier)) return null;
5578
+ if (model.capabilities?.tierKind === "quality") {
5579
+ const offered = supported.map((t) => `${imageTierLabel(model, t).toLowerCase()} (${IMAGE_SIZE_OF_TIER[t]})`).join(", ");
5580
+ return `${name} takes the quality ${offered}, not "${String(resolution)}". Pick one of those.`;
5581
+ }
5582
+ return `${name} renders at ${supported.join(", ")}, not "${String(resolution)}". Pick one of those.`;
5583
+ }
5584
+ function sendableSettings(settings, model) {
5585
+ if (!settings || !("generateAudio" in settings)) return settings;
5586
+ if (videoSettingSupport(model)?.generateAudio?.switchable === true) return settings;
5587
+ const kept = { ...settings };
5588
+ delete kept.generateAudio;
5589
+ return kept;
5590
+ }
5591
+ function sendableOptions(options, model) {
5592
+ if (!options || typeof options !== "object" || Array.isArray(options) || !("generateAudio" in options)) return options;
5593
+ if (videoSettingSupport(model)?.generateAudio?.switchable === true) return options;
5594
+ const kept = { ...options };
5595
+ delete kept.generateAudio;
5596
+ return kept;
5597
+ }
5598
+ var PROMPT_REQUIRED = /* @__PURE__ */ new Set([
5599
+ "text-to-image",
5600
+ "image-to-image",
5601
+ "image-edit",
5602
+ "text-to-3d",
5603
+ "image-to-3d",
5604
+ "multiview-to-3d",
5605
+ "text-to-video",
5606
+ // Texture: 3D AI Studio refuses a texture request without a prompt or a
5607
+ // reference image (probed 2026-09-26), and Studio sends no reference image,
5608
+ // so the material description is required. It binds `texturePrompt`, see
5609
+ // `promptInputKey`.
5610
+ "texture",
5611
+ // Audio is prompt-only: a music description (text-to-audio) / the text to
5612
+ // speak (text-to-speech). No upstream wire, so no portBinding entry.
5613
+ "text-to-audio",
5614
+ "text-to-speech"
5615
+ ]);
5616
+ var PROMPT_OPTIONAL = /* @__PURE__ */ new Set(["image-to-video", "image-to-json", "video-to-video"]);
5617
+ function taskNeedsPrompt(task) {
5618
+ return PROMPT_REQUIRED.has(task) || PROMPT_OPTIONAL.has(task);
5619
+ }
5620
+ function taskRequiresPrompt(task) {
5621
+ return PROMPT_REQUIRED.has(task);
5622
+ }
5623
+ function promptInputKey(task) {
5624
+ return task === "texture" ? "texturePrompt" : "prompt";
5625
+ }
5626
+ function portBinding(task, port) {
5627
+ if (port === "image" && (task === "image-to-3d" || task === "multiview-to-3d" || task === "image-to-video" || task === "image-to-text" || task === "image-to-json")) {
5628
+ return { key: "inputImageUrl", path: "url" };
5629
+ }
5630
+ if (port === "reference" && task === "image-to-video") {
5631
+ return { key: "referenceImageUrls", path: "url", wrap: "array" };
5632
+ }
5633
+ if (port === "mesh3d" && (task === "remesh" || task === "texture" || task === "rig")) {
5634
+ return { key: "parentAssetId", path: "assetId" };
5635
+ }
5636
+ if (port === "video" && task === "video-to-text") {
5637
+ return { key: "inputVideoUrl", path: "url" };
5638
+ }
5639
+ if (port === "video" && task === "video-to-video") {
5640
+ return { key: "inputVideoUrl", path: "url" };
5641
+ }
5642
+ if (port === "image" && task === "video-to-video") {
5643
+ return { key: "inputImages", path: "url", wrap: "array" };
5644
+ }
5645
+ if (port === "video" && task === "video-enhance") {
5646
+ return { key: "draftCacheUrl", path: "draftCacheUrl" };
5647
+ }
5648
+ if (port === "image" && (task === "image-edit" || task === "image-to-image")) {
5649
+ return { key: "inputImages", path: "url", wrap: "array" };
5650
+ }
5651
+ if (port === "text" && taskNeedsPrompt(task)) {
5652
+ return { key: promptInputKey(task), path: "text" };
5653
+ }
5654
+ if (port === "image" && (task === "upscale" || task === "background-remove")) {
5655
+ return { key: "parentAssetId", path: "assetId" };
5656
+ }
5657
+ if (port === "audio" && task === "speech-to-text") {
5658
+ return { key: "inputAudioUrl", path: "url" };
5659
+ }
5660
+ if (port === "image" && task === "judge") {
5661
+ return { key: "candidateAssetIds", path: "assetId", wrap: "array" };
5662
+ }
5663
+ return null;
5664
+ }
5665
+ function canConnect(sourceOut, targetTask, targetPort) {
5666
+ if (sourceOut !== portContent(targetPort)) return false;
5667
+ return portBinding(targetTask, targetPort) !== null;
4496
5668
  }
4497
5669
  function portCardinality(task, port, model) {
4498
5670
  if (portBinding(task, port) === null) return "none";
@@ -4542,10 +5714,10 @@ function orderedPortKey(task, port, ordinal, model) {
4542
5714
  if (portCardinality(task, port, model) === "two" && ordinal === 1) return "endImageUrl";
4543
5715
  return canonical.key;
4544
5716
  }
4545
- function sourcePortOf(node) {
4546
- switch (node.kind) {
5717
+ function sourcePortOf(node2) {
5718
+ switch (node2.kind) {
4547
5719
  case "task":
4548
- return taskPorts(node.task).output;
5720
+ return taskPorts(node2.task).output;
4549
5721
  case "prompt-source":
4550
5722
  return "text";
4551
5723
  case "image-source":
@@ -4553,35 +5725,35 @@ function sourcePortOf(node) {
4553
5725
  case "video-source":
4554
5726
  return "video";
4555
5727
  case "input":
4556
- return node.type;
5728
+ return node2.type;
4557
5729
  }
4558
5730
  }
4559
- function targetCardinality(node, port) {
4560
- if (node.kind !== "task") return "none";
4561
- return portCardinality(node.task, port, node.model);
5731
+ function targetCardinality(node2, port) {
5732
+ if (node2.kind !== "task") return "none";
5733
+ return portCardinality(node2.task, port, node2.model);
4562
5734
  }
4563
- function slotRefusal(node, port, wired) {
4564
- const cardinality = targetCardinality(node, port);
5735
+ function slotRefusal(node2, port, wired) {
5736
+ const cardinality = targetCardinality(node2, port);
4565
5737
  let limit = cardinalityLimit(cardinality);
4566
- if (port === "reference" && node.kind === "task") {
4567
- const refs = modelCharacterReferences(node.model);
5738
+ if (port === "reference" && node2.kind === "task") {
5739
+ const refs = modelCharacterReferences(node2.model);
4568
5740
  if (refs) limit = Math.min(limit, refs.maxTotalImages);
4569
5741
  if (wired < limit) return null;
4570
5742
  if (!refs) {
4571
- return `node "${node.id}" (${node.model || "no model"}) takes no character references; pick a model that holds identity from reference images (Kling elements) or remove the reference wires`;
5743
+ return `node "${node2.id}" (${node2.model || "no model"}) takes no character references; pick a model that holds identity from reference images (Kling elements) or remove the reference wires`;
4572
5744
  }
4573
- return `node "${node.id}" (${node.model}) takes at most ${limit} character reference images in all`;
5745
+ return `node "${node2.id}" (${node2.model}) takes at most ${limit} character reference images in all`;
4574
5746
  }
4575
- if (cardinality === "many" && node.kind === "task" && node.model) {
4576
- const cap = tryGetModel2(node.model)?.capabilities?.maxInputImages;
5747
+ if (cardinality === "many" && node2.kind === "task" && node2.model) {
5748
+ const cap = tryGetModel2(node2.model)?.capabilities?.maxInputImages;
4577
5749
  if (typeof cap === "number" && cap > 0) limit = Math.min(limit, cap);
4578
5750
  }
4579
5751
  if (wired < limit) return null;
4580
- if (cardinality === "one") return `node "${node.id}" accepts one ${port} wire, got more`;
5752
+ if (cardinality === "one") return `node "${node2.id}" accepts one ${port} wire, got more`;
4581
5753
  if (cardinality === "two") {
4582
- return `node "${node.id}" takes two ${port} wires (start frame, end frame), got more. A shot that needs more than two keyframes wants a keyframes model (FLUX.3 keyframes), which takes up to ten.`;
5754
+ return `node "${node2.id}" takes two ${port} wires (start frame, end frame), got more. A shot that needs more than two keyframes wants a keyframes model (FLUX.3 keyframes), which takes up to ten.`;
4583
5755
  }
4584
- return `node "${node.id}" (${node.kind === "task" ? node.model : node.kind}) takes at most ${limit} ${port} wires`;
5756
+ return `node "${node2.id}" (${node2.kind === "task" ? node2.model : node2.kind}) takes at most ${limit} ${port} wires`;
4585
5757
  }
4586
5758
  function wireLegality(source, target, port) {
4587
5759
  if (source.id === target.id) return { ok: false, code: "cycle", message: `node "${source.id}" cannot wire into itself` };
@@ -4643,17 +5815,17 @@ function validateDocument(doc) {
4643
5815
  };
4644
5816
  }
4645
5817
  const byId = /* @__PURE__ */ new Map();
4646
- for (const node of doc.nodes) {
4647
- if (byId.has(node.id)) return { ok: false, code: "conflict", message: `duplicate node id "${node.id}"` };
4648
- byId.set(node.id, node);
5818
+ for (const node2 of doc.nodes) {
5819
+ if (byId.has(node2.id)) return { ok: false, code: "conflict", message: `duplicate node id "${node2.id}"` };
5820
+ byId.set(node2.id, node2);
4649
5821
  }
4650
5822
  const inputNames = /* @__PURE__ */ new Set();
4651
- for (const node of doc.nodes) {
4652
- if (node.kind !== "input") continue;
4653
- if (inputNames.has(node.name)) {
4654
- return { ok: false, code: "conflict", message: `duplicate input name "${node.name}"` };
5823
+ for (const node2 of doc.nodes) {
5824
+ if (node2.kind !== "input") continue;
5825
+ if (inputNames.has(node2.name)) {
5826
+ return { ok: false, code: "conflict", message: `duplicate input name "${node2.name}"` };
4655
5827
  }
4656
- inputNames.add(node.name);
5828
+ inputNames.add(node2.name);
4657
5829
  }
4658
5830
  const edgeKeys = /* @__PURE__ */ new Set();
4659
5831
  const slots = /* @__PURE__ */ new Map();
@@ -4687,12 +5859,12 @@ function validateDocument(doc) {
4687
5859
  };
4688
5860
  }
4689
5861
  }
4690
- for (const node of doc.nodes) {
4691
- if (node.kind !== "task" || !node.model) continue;
4692
- const baked = node.bakedInputs?.imageSize;
4693
- const requested = node.settings?.resolution ?? (baked && baked.kind === "literal" ? baked.value : void 0);
4694
- const refusal = resolutionRefusal(tryGetModel2(node.model), requested);
4695
- if (refusal) return { ok: false, code: "unsupported", message: `"${node.id}": ${refusal}` };
5862
+ for (const node2 of doc.nodes) {
5863
+ if (node2.kind !== "task" || !node2.model) continue;
5864
+ const baked = node2.bakedInputs?.imageSize;
5865
+ const requested = node2.settings?.resolution ?? (baked && baked.kind === "literal" ? baked.value : void 0);
5866
+ const refusal = resolutionRefusal(tryGetModel2(node2.model), requested);
5867
+ if (refusal) return { ok: false, code: "unsupported", message: `"${node2.id}": ${refusal}` };
4696
5868
  }
4697
5869
  if (documentTopologicalOrder(doc) === null) {
4698
5870
  return { ok: false, code: "cycle", message: `document "${doc.id}" has a cycle in its wires` };
@@ -4757,7 +5929,7 @@ var InputNodePropsSchema = z4.object({
4757
5929
  }).partial().strict();
4758
5930
  var GroupPropsSchema = z4.object({
4759
5931
  label: LabelSchema.nullable(),
4760
- nodeIds: z4.array(IdSchema).min(1)
5932
+ nodeIds: z4.array(IdSchema).min(1).max(MAX_DOCUMENT_NODES)
4761
5933
  }).partial().strict();
4762
5934
  var DocumentPropsSchema = z4.object({
4763
5935
  label: LabelSchema,
@@ -4853,7 +6025,7 @@ var GroupOpSchema = z4.object({
4853
6025
  type: z4.literal("group"),
4854
6026
  id: IdSchema,
4855
6027
  label: LabelSchema.optional(),
4856
- nodeIds: z4.array(IdSchema).min(1),
6028
+ nodeIds: z4.array(IdSchema).min(1).max(MAX_DOCUMENT_NODES),
4857
6029
  index: Index.optional()
4858
6030
  });
4859
6031
  var UngroupOpSchema = z4.object({
@@ -4983,6 +6155,10 @@ function likenessConfirmationRequiredMessage() {
4983
6155
  function likenessConfirmationToolDescription() {
4984
6156
  return `Must be the literal true. It records this confirmation on the character: "${LIKENESS_ACKNOWLEDGEMENT}" Ask the human you act for and pass true only after they confirm it for this character; never assert it on your own. Terms and acceptable use: ${TERMS_URL}`;
4985
6157
  }
6158
+ var IMAGE_ASPECT_RATIOS2 = ASPECT_RATIOS2.map((value) => ({
6159
+ value,
6160
+ label: value
6161
+ }));
4986
6162
  function taskModality(task) {
4987
6163
  const out = taskPorts(task).output;
4988
6164
  switch (out) {
@@ -5007,6 +6183,12 @@ function lit(value) {
5007
6183
  function isFiniteNumber(v) {
5008
6184
  return typeof v === "number" && Number.isFinite(v);
5009
6185
  }
6186
+ function voiceSettingsOf(v) {
6187
+ if (!v || typeof v !== "object" || Array.isArray(v)) return null;
6188
+ const o = v;
6189
+ if (!isFiniteNumber(o.stability) || !isFiniteNumber(o.similarityBoost) || !isFiniteNumber(o.speed)) return null;
6190
+ return { stability: o.stability, similarityBoost: o.similarityBoost, speed: o.speed };
6191
+ }
5010
6192
  function settingsBindings(task, settings) {
5011
6193
  if (!task || !settings || Object.keys(settings).length === 0) return {};
5012
6194
  const modality = taskModality(task);
@@ -5027,11 +6209,17 @@ function settingsBindings(task, settings) {
5027
6209
  if (typeof settings.aspectRatio === "string") options.aspectRatio = settings.aspectRatio;
5028
6210
  if (typeof settings.resolution === "string") options.resolution = settings.resolution;
5029
6211
  if (isFiniteNumber(settings.duration)) options.durationSeconds = settings.duration;
6212
+ if (typeof settings.generateAudio === "boolean") options.generateAudio = settings.generateAudio;
5030
6213
  return Object.keys(options).length > 0 ? { options: lit(options) } : {};
5031
6214
  }
5032
6215
  case "audio": {
5033
6216
  const options = {};
5034
6217
  if (isFiniteNumber(settings.duration)) options.durationSeconds = settings.duration;
6218
+ if (task === "text-to-speech") {
6219
+ if (typeof settings.voiceId === "string" && settings.voiceId) options.voiceId = settings.voiceId;
6220
+ const voice = voiceSettingsOf(settings.voiceSettings);
6221
+ if (voice) options.voiceSettings = voice;
6222
+ }
5035
6223
  return Object.keys(options).length > 0 ? { options: lit(options) } : {};
5036
6224
  }
5037
6225
  default:
@@ -5084,6 +6272,41 @@ function keyframePositionsFor(sourceIds, settings) {
5084
6272
  return { ok: true, frames };
5085
6273
  }
5086
6274
  var REFERENCE_ELEMENTS_SETTING = "referenceElements";
6275
+ var CAST_MENTIONS_SETTING = "castMentions";
6276
+ var CAST_REFERENCES_SETTING = "castReferences";
6277
+ var CAST_TASKS = /* @__PURE__ */ new Set(["text-to-image", "image-edit", "image-to-image", "image-to-video"]);
6278
+ function castSettingOf(task, settings) {
6279
+ const none = { cast: [], own: false };
6280
+ if (!CAST_TASKS.has(task)) return none;
6281
+ const mentions = settings?.[CAST_MENTIONS_SETTING];
6282
+ const own = !(Array.isArray(mentions) && mentions.length > 0);
6283
+ const raw = own ? settings?.[CAST_REFERENCES_SETTING] : mentions;
6284
+ if (!Array.isArray(raw)) return none;
6285
+ const cast = raw.flatMap((r) => {
6286
+ const parsed = CastMemberSchema.safeParse(r);
6287
+ return parsed.success ? [parsed.data] : [];
6288
+ });
6289
+ return { cast, own: own && cast.length > 0 };
6290
+ }
6291
+ function castByElement(cast, elementOf) {
6292
+ const again = "Type the mention again in the prompt bar so its views are wired anew, or set the character number on its reference cards.";
6293
+ const characters = cast.filter((m) => m.kind === "character");
6294
+ const placed = [];
6295
+ for (const member of characters) {
6296
+ const elements = new Set((member.sources ?? []).filter((s) => elementOf.has(s)).map((s) => elementOf.get(s)));
6297
+ if (elements.size === 0) return { ok: false, reason: `${member.name}'s reference images are no longer wired into this clip. ${again}` };
6298
+ if (elements.size > 1) return { ok: false, reason: `${member.name}'s reference images are set to more than one character number. ${again}` };
6299
+ const element = [...elements][0];
6300
+ const twin = placed.find((p) => p.element === element);
6301
+ if (twin) return { ok: false, reason: `${twin.member.name} and ${member.name} are wired as the same character. ${again}` };
6302
+ placed.push({ member, element });
6303
+ }
6304
+ const wired = new Set(elementOf.values());
6305
+ if (wired.size !== placed.length) {
6306
+ return { ok: false, reason: `This clip's references show ${wired.size} character${wired.size === 1 ? "" : "s"}, and its prompt names ${placed.length}. Remove the reference cards of anyone the prompt does not name, or name them in the prompt.` };
6307
+ }
6308
+ return { ok: true, cast: placed.sort((a, b) => a.element - b.element).map((p) => p.member) };
6309
+ }
5087
6310
  function referenceElementsFor(sourceIds, settings, limits) {
5088
6311
  const raw = settings?.[REFERENCE_ELEMENTS_SETTING];
5089
6312
  if (raw !== void 0 && (raw === null || typeof raw !== "object" || Array.isArray(raw))) {
@@ -5247,26 +6470,28 @@ function documentToDefinition(doc, opts = {}) {
5247
6470
  ...n.default !== void 0 ? { default: n.default } : {}
5248
6471
  }));
5249
6472
  let nodes = [];
5250
- for (const node of doc.nodes) {
5251
- if (node.kind !== "task") continue;
5252
- const { task } = node;
6473
+ const elementOfSource = /* @__PURE__ */ new Map();
6474
+ const referencesRefused = /* @__PURE__ */ new Set();
6475
+ for (const node2 of doc.nodes) {
6476
+ if (node2.kind !== "task") continue;
6477
+ const { task } = node2;
5253
6478
  if (taskExecution(task) === null) {
5254
6479
  issues.push({
5255
6480
  code: "not_runnable",
5256
- nodeId: node.id,
5257
- message: `Node "${node.id}" (${task}) is not runnable yet.`
6481
+ nodeId: node2.id,
6482
+ message: `Node "${node2.id}" (${task}) is not runnable yet.`
5258
6483
  });
5259
6484
  continue;
5260
6485
  }
5261
- if (node.model.length === 0) {
6486
+ if (node2.model.length === 0) {
5262
6487
  issues.push({
5263
6488
  code: "no_model",
5264
- nodeId: node.id,
5265
- message: `Node "${node.id}" needs a model.`
6489
+ nodeId: node2.id,
6490
+ message: `Node "${node2.id}" needs a model.`
5266
6491
  });
5267
6492
  }
5268
6493
  const inputs = {};
5269
- const wires = incoming.get(node.id) ?? [];
6494
+ const wires = incoming.get(node2.id) ?? [];
5270
6495
  const textWire = wires.find((e) => e.port === "text");
5271
6496
  let promptMissing = false;
5272
6497
  if (taskNeedsPrompt(task)) {
@@ -5284,15 +6509,15 @@ function documentToDefinition(doc, opts = {}) {
5284
6509
  path: portBinding(task, "text").path
5285
6510
  };
5286
6511
  } else {
5287
- const text = node.prompt.trim();
6512
+ const text = node2.prompt.trim();
5288
6513
  if (text.length > 0) inputs[key] = { kind: "literal", value: text };
5289
6514
  }
5290
6515
  if (!(key in inputs) && taskRequiresPrompt(task)) {
5291
6516
  promptMissing = true;
5292
6517
  issues.push({
5293
6518
  code: "prompt_required",
5294
- nodeId: node.id,
5295
- message: `Node "${node.id}" (${task}) needs a prompt.`
6519
+ nodeId: node2.id,
6520
+ message: `Node "${node2.id}" (${task}) needs a prompt.`
5296
6521
  });
5297
6522
  }
5298
6523
  }
@@ -5305,17 +6530,17 @@ function documentToDefinition(doc, opts = {}) {
5305
6530
  }
5306
6531
  for (const [port, portWires] of byPort) {
5307
6532
  const b = portBinding(task, port);
5308
- const cardinality = portCardinality(task, port, node.model);
5309
- const keyframes = port === "image" && task === "image-to-video" && modelAcceptsKeyframes(node.model);
6533
+ const cardinality = portCardinality(task, port, node2.model);
6534
+ const keyframes = port === "image" && task === "image-to-video" && modelAcceptsKeyframes(node2.model);
5310
6535
  const references = port === "reference";
5311
- const listKey = orderedPortKey(task, port, 0, node.model) ?? b.key;
6536
+ const listKey = orderedPortKey(task, port, 0, node2.model) ?? b.key;
5312
6537
  const items2 = [];
5313
6538
  const itemSources = [];
5314
6539
  let uploading = false;
5315
6540
  for (const [ordinal, e] of portWires.entries()) {
5316
6541
  const source = byId.get(e.source);
5317
6542
  const single = !keyframes && !references && (cardinality !== "many" || portWires.length === 1);
5318
- const key = orderedPortKey(task, port, ordinal, node.model) ?? b.key;
6543
+ const key = orderedPortKey(task, port, ordinal, node2.model) ?? b.key;
5319
6544
  const wrap = single && b.wrap === "array";
5320
6545
  let item = null;
5321
6546
  if (source.kind === "image-source") {
@@ -5323,8 +6548,8 @@ function documentToDefinition(doc, opts = {}) {
5323
6548
  if (!isUsableSourceUrl(url)) {
5324
6549
  issues.push({
5325
6550
  code: "source_uploading",
5326
- nodeId: node.id,
5327
- message: `Image source for "${node.id}" is still uploading; wait for it to finish.`
6551
+ nodeId: node2.id,
6552
+ message: `Image source for "${node2.id}" is still uploading; wait for it to finish.`
5328
6553
  });
5329
6554
  uploading = true;
5330
6555
  continue;
@@ -5335,8 +6560,8 @@ function documentToDefinition(doc, opts = {}) {
5335
6560
  if (!isUsableSourceUrl(clip)) {
5336
6561
  issues.push({
5337
6562
  code: "source_uploading",
5338
- nodeId: node.id,
5339
- message: `Video source for "${node.id}" is still uploading; wait for it to finish.`
6563
+ nodeId: node2.id,
6564
+ message: `Video source for "${node2.id}" is still uploading; wait for it to finish.`
5340
6565
  });
5341
6566
  uploading = true;
5342
6567
  continue;
@@ -5355,20 +6580,21 @@ function documentToDefinition(doc, opts = {}) {
5355
6580
  }
5356
6581
  }
5357
6582
  if (references && !uploading && items2.length > 0) {
5358
- const limits = modelCharacterReferences(node.model);
6583
+ const limits = modelCharacterReferences(node2.model);
5359
6584
  const grouped = limits ? referenceElementsFor(
5360
6585
  itemSources,
5361
- node.settings,
6586
+ node2.settings,
5362
6587
  limits
5363
6588
  ) : {
5364
6589
  ok: false,
5365
- reason: `${node.model || "this model"} takes no character references`
6590
+ reason: `${node2.model || "this model"} takes no character references`
5366
6591
  };
5367
6592
  if (grouped.ok) {
5368
6593
  inputs[listKey] = {
5369
6594
  kind: "list",
5370
6595
  items: grouped.order.map((i) => items2[i])
5371
6596
  };
6597
+ elementOfSource.set(node2.id, new Map(grouped.order.map((i, k) => [itemSources[i], grouped.elements[k]])));
5372
6598
  inputs.referenceElementIndexes = {
5373
6599
  kind: "literal",
5374
6600
  value: grouped.elements
@@ -5376,9 +6602,10 @@ function documentToDefinition(doc, opts = {}) {
5376
6602
  } else {
5377
6603
  issues.push({
5378
6604
  code: "character_references",
5379
- nodeId: node.id,
5380
- message: `Node "${node.id}": ${grouped.reason}`
6605
+ nodeId: node2.id,
6606
+ message: `Node "${node2.id}": ${grouped.reason}`
5381
6607
  });
6608
+ referencesRefused.add(node2.id);
5382
6609
  }
5383
6610
  continue;
5384
6611
  }
@@ -5387,7 +6614,7 @@ function documentToDefinition(doc, opts = {}) {
5387
6614
  if (keyframes && !uploading && items2.length > 0) {
5388
6615
  const positions = keyframePositionsFor(
5389
6616
  portWires.map((e) => e.source),
5390
- node.settings
6617
+ node2.settings
5391
6618
  );
5392
6619
  if (positions.ok) {
5393
6620
  inputs.keyframeFrameIndexes = {
@@ -5397,30 +6624,48 @@ function documentToDefinition(doc, opts = {}) {
5397
6624
  } else {
5398
6625
  issues.push({
5399
6626
  code: "keyframe_positions",
5400
- nodeId: node.id,
5401
- message: `Node "${node.id}": ${positions.reason}`
6627
+ nodeId: node2.id,
6628
+ message: `Node "${node2.id}": ${positions.reason}`
5402
6629
  });
5403
6630
  }
5404
6631
  }
5405
6632
  }
5406
- for (const [key, binding] of Object.entries(node.bakedInputs))
5407
- if (!(key in inputs)) inputs[key] = binding;
6633
+ const imagesWired = "inputImages" in inputs;
6634
+ for (const [key, binding] of Object.entries(node2.bakedInputs)) {
6635
+ if (key in inputs) continue;
6636
+ if (key === "options" && binding.kind === "literal") {
6637
+ const kept = sendableOptions(binding.value, tryGetModel2(node2.model));
6638
+ inputs[key] = kept === binding.value ? binding : { kind: "literal", value: kept };
6639
+ } else inputs[key] = binding;
6640
+ }
5408
6641
  if (task === "image-to-video" && "referenceImageUrls" in inputs && !("inputImageUrl" in inputs)) {
5409
6642
  issues.push({
5410
6643
  code: "character_references",
5411
- nodeId: node.id,
5412
- message: `Node "${node.id}": character references need a start frame; wire one into the image port.`
6644
+ nodeId: node2.id,
6645
+ message: `Node "${node2.id}": character references need a start frame; wire one into the image port.`
5413
6646
  });
5414
6647
  }
5415
6648
  if (Object.keys(inputs).length === 0 && !promptMissing) {
5416
6649
  issues.push({
5417
6650
  code: "no_inputs",
5418
- nodeId: node.id,
5419
- message: `Node "${node.id}" (${task}) needs an input: wire in an upstream asset or type a prompt.`
6651
+ nodeId: node2.id,
6652
+ message: `Node "${node2.id}" (${task}) needs an input: wire in an upstream asset or type a prompt.`
5420
6653
  });
5421
6654
  }
5422
- Object.assign(inputs, settingsBindings(task, node.settings));
5423
- nodes.push({ id: node.id, task, model: node.model, inputs });
6655
+ Object.assign(inputs, settingsBindings(task, sendableSettings(node2.settings, tryGetModel2(node2.model))));
6656
+ const named = castSettingOf(task, node2.settings);
6657
+ const { own } = named;
6658
+ let cast = named.cast;
6659
+ if (task === "image-to-video" && cast.length > 0 && referencesRefused.has(node2.id)) cast = [];
6660
+ else if (task === "image-to-video" && cast.length > 0) {
6661
+ const placed = castByElement(cast, elementOfSource.get(node2.id) ?? /* @__PURE__ */ new Map());
6662
+ if (placed.ok) cast = placed.cast;
6663
+ else {
6664
+ issues.push({ code: "character_references", nodeId: node2.id, message: `Node "${node2.id}": ${placed.reason}` });
6665
+ cast = [];
6666
+ }
6667
+ }
6668
+ nodes.push({ id: node2.id, task, model: node2.model, inputs, ...cast.length > 0 ? { cast } : {}, ...own ? { castOwn: true } : {}, ...cast.length > 0 && imagesWired ? { imagesWired: true } : {} });
5424
6669
  }
5425
6670
  if (scope) {
5426
6671
  const projected = new Set(nodes.map((n) => n.id));
@@ -5469,13 +6714,19 @@ function documentToDefinition(doc, opts = {}) {
5469
6714
  }
5470
6715
 
5471
6716
  // src/characterSheet.ts
6717
+ var OVERVIEW_CATEGORY = "overview";
6718
+ var OVERVIEW_ASPECT_RATIO = "21:9";
6719
+ var OVERVIEW_RESOLUTION = "4K";
5472
6720
  var IDENTITY_INSTRUCTION = "This is the same person, same face, same identity as the reference image: keep the facial structure, features, hair, and proportions identical. Do not invent a new face.";
5473
- var NEUTRAL_STUDIO = "Plain light-gray seamless studio background, no props, no text, no watermark, photorealistic, sharp focus.";
6721
+ var NEUTRAL_STUDIO = "Plain light-gray seamless studio background, no props, no text, no labels, no numbers, no watermark, photorealistic, sharp focus. Natural, unretouched skin with visible texture and slight natural asymmetry; no beauty filter, no airbrushing.";
6722
+ var SCREEN_SIDE_INSTRUCTION = 'The camera stays fixed and the person rotates on the vertical axis only. "Screen-left" and "screen-right" mean the left and right edge of the image as the viewer sees it. Do not mirror or flip the image.';
6723
+ var CHAINED_BACK_INPUTS_INSTRUCTION = "Input images: image 1 is the person's face, the identity reference: keep the hair colour, hair length and texture, skin tone and build exactly as in image 1. Image 2 is the same person's front full-body view, the figure to turn round: keep its clothing, shoes, body proportions and stance exactly, and show them from behind.";
6724
+ var TURNAROUND_CAMERA_INSTRUCTION = "Camera: straight-on, at the person's chest height, the same height in every view, long lens with no wide-angle distortion, like an orthographic turnaround. Even, soft, neutral studio lighting.";
5474
6725
  var WARDROBE_STANDARD_PHRASE = "plain heather-gray crew-neck t-shirt";
5475
6726
  var WARDROBE_INSTRUCTION = `Wardrobe: the character is wearing a ${WARDROBE_STANDARD_PHRASE}, unbranded, with no logos, graphics, prints, or patterns.`;
5476
- var FULL_BODY_WARDROBE_INSTRUCTION = `Wardrobe: the character is wearing a ${WARDROBE_STANDARD_PHRASE} and plain dark straight-leg trousers, unbranded, with no logos, graphics, prints, or patterns.`;
6727
+ var FULL_BODY_WARDROBE_INSTRUCTION = `Wardrobe: the character is wearing a ${WARDROBE_STANDARD_PHRASE}, plain dark straight-leg trousers and plain dark shoes, unbranded, with no logos, graphics, prints, or patterns.`;
5477
6728
  function wardrobeInstructionForCategory(category) {
5478
- return category === "full-body" ? FULL_BODY_WARDROBE_INSTRUCTION : WARDROBE_INSTRUCTION;
6729
+ return category === "full-body" || category === "back" ? FULL_BODY_WARDROBE_INSTRUCTION : WARDROBE_INSTRUCTION;
5479
6730
  }
5480
6731
  function identityAnchor(description) {
5481
6732
  return `Character identity (keep identical in every view): ${description.trim()}`;
@@ -5491,30 +6742,49 @@ function seedFacePrompt(description) {
5491
6742
  ].join("\n\n");
5492
6743
  }
5493
6744
  var VIEW_INSTRUCTION = {
5494
- "three-quarter": "Three-quarter (45 degree) view: turn the head and upper body slightly to one side. Chest-up framing, square 1:1 crop. Even neutral studio lighting.",
5495
- profile: "Full side profile (90 degree) view. Chest-up framing, square 1:1 crop. Even neutral studio lighting.",
5496
- "full-body": "Full-body head-to-toe view: the character standing in a relaxed neutral pose, facing forward. 3:4 portrait crop with the whole figure in frame. Even neutral studio lighting.",
5497
- "close-up": "Tight front-facing close-up of the face, capturing fine facial detail. Square 1:1 crop. Even neutral studio lighting.",
5498
- "lighting-warm": "Front-facing head-and-shoulders portrait, square 1:1 crop, under warm golden-hour key lighting.",
5499
- "lighting-cool": "Front-facing head-and-shoulders portrait, square 1:1 crop, under cool blue-toned key lighting."
6745
+ "full-body": "FRONT VIEW, 0 degrees: full-body head-to-toe view, the person standing in a relaxed neutral pose facing directly toward the camera. Both eyes visible. Chest, hips, knees and feet facing forward. 3:4 portrait crop with the whole figure in frame, feet included.",
6746
+ "three-quarter-left": "45 DEGREE TURN TO SCREEN-LEFT: the person is rotated exactly 45 degrees toward screen-left. The nose points 45 degrees toward the left edge of the image. Both eyes visible, the far eye partly hidden by the bridge of the nose. Shoulders and chest rotated 45 degrees toward screen-left as well. The face must not turn toward screen-right. Chest-up framing, square 1:1 crop.",
6747
+ "profile-left": "90 DEGREE PROFILE FACING SCREEN-LEFT: a strict side profile, the person facing fully toward the left edge of the image. Exactly 90 degrees: only one eye visible, the nose silhouetted against the background on the left side of the face. Shoulders and chest aligned toward screen-left. The face must not turn toward screen-right or toward the camera. Chest-up framing, square 1:1 crop.",
6748
+ "profile-right": "90 DEGREE PROFILE FACING SCREEN-RIGHT: a strict side profile, the person facing fully toward the right edge of the image. Exactly 90 degrees: only one eye visible, the nose silhouetted against the background on the right side of the face. Shoulders and chest aligned toward screen-right. The face must not turn toward screen-left or toward the camera. Chest-up framing, square 1:1 crop.",
6749
+ "three-quarter-right": "45 DEGREE TURN TO SCREEN-RIGHT: the person is rotated exactly 45 degrees toward screen-right. The nose points 45 degrees toward the right edge of the image. Both eyes visible, the far eye partly hidden by the bridge of the nose. Shoulders and chest rotated 45 degrees toward screen-right as well. The face must not turn toward screen-left. Chest-up framing, square 1:1 crop.",
6750
+ back: "BACK VIEW, 180 degrees: full-body head-to-toe view of the person facing completely away from the camera. Show the back of the head and hair, the back of the clothing, the back silhouette and a rear-facing standing posture. No face visible, no eyes, no profile: the head is not turned. Heels, calves, hips and shoulders all face away from the camera. 3:4 portrait crop with the whole figure in frame, feet included."
5500
6751
  };
5501
6752
  function turnaroundViewPrompt(view, seedDescription) {
5502
6753
  return [
5503
6754
  identityAnchor(seedDescription),
5504
6755
  VIEW_INSTRUCTION[view],
6756
+ ...view === "back" ? [CHAINED_BACK_INPUTS_INSTRUCTION] : [],
6757
+ SCREEN_SIDE_INSTRUCTION,
6758
+ TURNAROUND_CAMERA_INSTRUCTION,
6759
+ // View strings mirror the freeze categories, so the wardrobe line keys off
6760
+ // the view directly (head-to-toe views add trousers and shoes).
5505
6761
  wardrobeInstructionForCategory(view),
5506
6762
  NEUTRAL_STUDIO,
5507
6763
  IDENTITY_INSTRUCTION
5508
6764
  ].join("\n\n");
5509
6765
  }
6766
+ function overviewSheetPrompt(description) {
6767
+ return [
6768
+ "Create one clean photorealistic character turnaround sheet of the person in the reference image.",
6769
+ `Character identity: ${description.trim()}`,
6770
+ `${FULL_BODY_WARDROBE_INSTRUCTION} The same outfit in every column.`,
6771
+ "Exactly six columns, no more and no fewer: six full-body figures in the top row and six portraits in the bottom row, twelve pictures of the same person in total. Never repeat a column and never add a seventh.",
6772
+ "Layout: six vertical columns of equal width side by side, separated by thin light borders, on a plain light-gray studio background. In each column, a full-body view head to toe on top, the whole figure inside its cell with the shoes and a little floor visible below them, and below it a head-and-shoulders portrait whose face points in exactly the same direction as the full body above it.",
6773
+ "The person turns step by step, the way a turnaround sheet reads, and directions are the edges of the picture as the viewer sees it. Column 1, the leftmost: facing the camera, both eyes visible. Column 2: turned halfway so the nose points toward the RIGHT EDGE of the picture, both eyes visible. Column 3: a strict side profile, the nose pointing at the RIGHT EDGE of the picture, only one eye visible. Column 4: a strict side profile, the nose pointing at the LEFT EDGE of the picture, only one eye visible. Column 5: turned halfway so the nose points toward the LEFT EDGE of the picture, both eyes visible. Column 6, the rightmost: seen from behind, no face; its portrait shows the back of the head. So the two profiles in columns 3 and 4 face each other.",
6774
+ "Same camera height for every full body, same crop for every portrait, no perspective distortion, photorealistic studio lighting, sharp detail.",
6775
+ "No text anywhere in the image: no headings, no titles, no angle numbers, no degree signs, no labels, no captions, no logos, no watermark. The background above the figures stays empty.",
6776
+ IDENTITY_INSTRUCTION
6777
+ ].join("\n\n");
6778
+ }
5510
6779
  var CHARACTER_SHEET_NODES = [
5511
6780
  { nodeId: "seed", param: "seedPrompt", category: "face", label: "Face" },
5512
- { nodeId: "view-three-quarter", param: "threeQuarterPrompt", category: "three-quarter", label: "Three-quarter", view: "three-quarter" },
5513
- { nodeId: "view-profile", param: "profilePrompt", category: "profile", label: "Profile", view: "profile" },
5514
- { nodeId: "view-full-body", param: "fullBodyPrompt", category: "full-body", label: "Full body", view: "full-body" },
5515
- { nodeId: "view-close-up", param: "closeUpPrompt", category: "close-up", label: "Close-up", view: "close-up" },
5516
- { nodeId: "view-lighting-warm", param: "lightingWarmPrompt", category: "lighting-warm", label: "Warm lighting", view: "lighting-warm" },
5517
- { nodeId: "view-lighting-cool", param: "lightingCoolPrompt", category: "lighting-cool", label: "Cool lighting", view: "lighting-cool" }
6781
+ { nodeId: "view-full-body", param: "fullBodyPrompt", category: "full-body", label: "Front", view: "full-body" },
6782
+ { nodeId: "view-three-quarter-left", param: "threeQuarterLeftPrompt", category: "three-quarter-left", label: "Turned left", view: "three-quarter-left" },
6783
+ { nodeId: "view-profile-left", param: "profileLeftPrompt", category: "profile-left", label: "Profile left", view: "profile-left" },
6784
+ { nodeId: "view-profile-right", param: "profileRightPrompt", category: "profile-right", label: "Profile right", view: "profile-right" },
6785
+ { nodeId: "view-three-quarter-right", param: "threeQuarterRightPrompt", category: "three-quarter-right", label: "Turned right", view: "three-quarter-right" },
6786
+ { nodeId: "view-back", param: "backPrompt", category: "back", label: "Back", view: "back" },
6787
+ { nodeId: "overview", param: "overviewPrompt", category: OVERVIEW_CATEGORY, label: "Overview", overview: true }
5518
6788
  ];
5519
6789
  var MINT_REFERENCE_CATEGORIES = Object.fromEntries(
5520
6790
  CHARACTER_SHEET_NODES.map((n) => [n.nodeId, n.category])
@@ -5524,14 +6794,15 @@ function categoryForNode(nodeId) {
5524
6794
  }
5525
6795
  function buildCharacterSheetParams(description) {
5526
6796
  const params = {};
5527
- for (const node of CHARACTER_SHEET_NODES) {
5528
- params[node.param] = node.view ? turnaroundViewPrompt(node.view, description) : seedFacePrompt(description);
6797
+ for (const node2 of CHARACTER_SHEET_NODES) {
6798
+ params[node2.param] = node2.view ? turnaroundViewPrompt(node2.view, description) : node2.overview ? overviewSheetPrompt(description) : seedFacePrompt(description);
5529
6799
  }
5530
6800
  return params;
5531
6801
  }
5532
6802
  var CHARACTER_SHEET_ID = "character-sheet";
5533
6803
  var SEED_MODEL = "fal/nano-banana-2";
5534
6804
  var VIEW_MODEL = "fal/nano-banana-2-edit";
6805
+ var OVERVIEW_MODEL = VIEW_MODEL;
5535
6806
  function viewNode(n, aspectRatio) {
5536
6807
  return {
5537
6808
  id: n.nodeId,
@@ -5544,6 +6815,7 @@ function viewNode(n, aspectRatio) {
5544
6815
  }
5545
6816
  };
5546
6817
  }
6818
+ var node = (id) => CHARACTER_SHEET_NODES.find((n) => n.nodeId === id);
5547
6819
  var CHARACTER_SHEET_DEFINITION = {
5548
6820
  version: { schema: 1 },
5549
6821
  id: CHARACTER_SHEET_ID,
@@ -5564,16 +6836,47 @@ var CHARACTER_SHEET_DEFINITION = {
5564
6836
  aspectRatio: { kind: "literal", value: "1:1" }
5565
6837
  }
5566
6838
  },
5567
- ...CHARACTER_SHEET_NODES.filter((n) => n.view !== void 0).map(
5568
- (n) => viewNode(n, n.category === "full-body" ? "3:4" : "1:1")
5569
- )
6839
+ viewNode(node("view-full-body"), "3:4"),
6840
+ viewNode(node("view-three-quarter-left"), "1:1"),
6841
+ viewNode(node("view-profile-left"), "1:1"),
6842
+ viewNode(node("view-profile-right"), "1:1"),
6843
+ viewNode(node("view-three-quarter-right"), "1:1"),
6844
+ // The back turns the front full body round, with the seed first as its
6845
+ // identity image ([face, full body]; its prompt says which is which).
6846
+ {
6847
+ id: "view-back",
6848
+ task: "image-edit",
6849
+ model: VIEW_MODEL,
6850
+ inputs: {
6851
+ prompt: { kind: "param", name: "backPrompt" },
6852
+ inputImages: {
6853
+ kind: "list",
6854
+ items: [
6855
+ { kind: "ref", node: "seed", path: "url" },
6856
+ { kind: "ref", node: "view-full-body", path: "url" }
6857
+ ]
6858
+ },
6859
+ aspectRatio: { kind: "literal", value: "3:4" }
6860
+ }
6861
+ },
6862
+ {
6863
+ id: "overview",
6864
+ task: "image-edit",
6865
+ model: OVERVIEW_MODEL,
6866
+ inputs: {
6867
+ prompt: { kind: "param", name: "overviewPrompt" },
6868
+ inputImages: { kind: "ref", node: "seed", path: "url", wrap: "array" },
6869
+ aspectRatio: { kind: "literal", value: OVERVIEW_ASPECT_RATIO },
6870
+ imageSize: { kind: "literal", value: OVERVIEW_RESOLUTION }
6871
+ }
6872
+ }
5570
6873
  ]
5571
6874
  };
5572
6875
  function characterSheetDefinition(overrides) {
5573
6876
  const def = structuredClone(CHARACTER_SHEET_DEFINITION);
5574
6877
  if (overrides?.seedModel || overrides?.viewModel) {
5575
6878
  def.nodes = def.nodes.map(
5576
- (node) => node.id === "seed" ? { ...node, model: overrides.seedModel ?? node.model } : { ...node, model: overrides.viewModel ?? node.model }
6879
+ (node2) => node2.id === "seed" ? { ...node2, model: overrides.seedModel ?? node2.model } : { ...node2, model: overrides.viewModel ?? node2.model }
5577
6880
  );
5578
6881
  }
5579
6882
  return def;
@@ -5753,13 +7056,20 @@ function buildCharacterSwapDefinition(input) {
5753
7056
  ]
5754
7057
  };
5755
7058
  }
5756
- var CHARACTER_REFERENCE_PREFERENCE = ["full-body", "three-quarter", "face"];
7059
+ var CHARACTER_REFERENCE_PREFERENCE = [
7060
+ "full-body",
7061
+ "three-quarter-left",
7062
+ "three-quarter-right",
7063
+ "three-quarter",
7064
+ "face"
7065
+ ];
7066
+ var NEVER_AUTOMATIC = /* @__PURE__ */ new Set(["back", "overview"]);
5757
7067
  function pickCharacterReferenceUrl(references) {
5758
7068
  for (const category of CHARACTER_REFERENCE_PREFERENCE) {
5759
7069
  const hit = references.find((r) => r.category === category && typeof r.url === "string" && r.url.length > 0);
5760
7070
  if (hit) return { url: hit.url, category };
5761
7071
  }
5762
- const any = references.find((r) => typeof r.url === "string" && r.url.length > 0);
7072
+ const any = references.find((r) => typeof r.url === "string" && r.url.length > 0 && !NEVER_AUTOMATIC.has(r.category));
5763
7073
  return any ? { url: any.url, category: any.category } : null;
5764
7074
  }
5765
7075
 
@@ -5795,7 +7105,7 @@ function parseDocument(raw, what) {
5795
7105
  }
5796
7106
  return r.data;
5797
7107
  }
5798
- var OpsSchema = z6.array(OpSchema);
7108
+ var OpsSchema = z6.array(OpSchema).max(MAX_PATCH_OPS * 20);
5799
7109
  function parseOps(raw, what) {
5800
7110
  const r = OpsSchema.safeParse(raw);
5801
7111
  if (!r.success) {
@@ -5826,32 +7136,32 @@ function wireCounts(doc) {
5826
7136
  }
5827
7137
  return counts;
5828
7138
  }
5829
- function summarizeNode(node, wires) {
5830
- const base = { id: node.id, kind: node.kind, wires: { ...wires } };
5831
- if (node.label !== void 0) base.label = node.label;
5832
- switch (node.kind) {
7139
+ function summarizeNode(node2, wires) {
7140
+ const base = { id: node2.id, kind: node2.kind, wires: { ...wires } };
7141
+ if (node2.label !== void 0) base.label = node2.label;
7142
+ switch (node2.kind) {
5833
7143
  case "task":
5834
- base.task = node.task;
5835
- base.model = node.model;
5836
- base.prompt = clipText(node.prompt);
5837
- base.promptLength = node.prompt.length;
5838
- if (node.activeGeneration !== void 0) base.activeGeneration = node.activeGeneration;
7144
+ base.task = node2.task;
7145
+ base.model = node2.model;
7146
+ base.prompt = clipText(node2.prompt);
7147
+ base.promptLength = node2.prompt.length;
7148
+ if (node2.activeGeneration !== void 0) base.activeGeneration = node2.activeGeneration;
5839
7149
  break;
5840
7150
  case "prompt-source":
5841
- base.prompt = clipText(node.text);
5842
- base.promptLength = node.text.length;
7151
+ base.prompt = clipText(node2.text);
7152
+ base.promptLength = node2.text.length;
5843
7153
  break;
5844
7154
  case "image-source":
5845
- base.imageUrl = clipText(node.imageUrl);
7155
+ base.imageUrl = clipText(node2.imageUrl);
5846
7156
  break;
5847
7157
  case "video-source":
5848
- base.videoUrl = clipText(node.videoUrl);
7158
+ base.videoUrl = clipText(node2.videoUrl);
5849
7159
  break;
5850
7160
  case "input":
5851
- base.name = node.name;
5852
- base.type = node.type;
5853
- base.required = node.required;
5854
- if (node.cardinality !== void 0) base.cardinality = node.cardinality;
7161
+ base.name = node2.name;
7162
+ base.type = node2.type;
7163
+ base.required = node2.required;
7164
+ if (node2.cardinality !== void 0) base.cardinality = node2.cardinality;
5855
7165
  break;
5856
7166
  }
5857
7167
  return base;
@@ -5884,8 +7194,8 @@ function affectedNodes(doc, ids) {
5884
7194
  const wires = wireCounts(doc);
5885
7195
  const byId = new Map(doc.nodes.map((n) => [n.id, n]));
5886
7196
  return ids.map((id) => {
5887
- const node = byId.get(id);
5888
- return node ? summarizeNode(node, wires.get(id) ?? { in: 0, out: 0 }) : { id, removed: true };
7197
+ const node2 = byId.get(id);
7198
+ return node2 ? summarizeNode(node2, wires.get(id) ?? { in: 0, out: 0 }) : { id, removed: true };
5889
7199
  });
5890
7200
  }
5891
7201
 
@@ -6281,6 +7591,8 @@ var ID = /^[A-Za-z0-9_][A-Za-z0-9_.:-]{0,127}$/;
6281
7591
  var CompositionIdSchema = z22.string().regex(ID, "an id is letters, digits and _ . : -");
6282
7592
  var COLOR_ROLE = z22.string().regex(/^[a-z0-9][a-z0-9-]{0,31}$/, "a colour is named by its kit id");
6283
7593
  var unit = z22.number().min(0).max(1);
7594
+ var STUDIO_DEFAULT_FONT_ROLE = "studio-default";
7595
+ var TEXT_FONT_ROLES = [...BRAND_KIT_FONT_ROLES, STUDIO_DEFAULT_FONT_ROLE];
6284
7596
  var BoxSchema = z22.object({ x: unit, y: unit, w: z22.number().min(MIN_BOX_SIDE).max(1), h: z22.number().min(MIN_BOX_SIDE).max(1) }).strict().refine((b) => b.x + b.w <= 1 + 1e-9 && b.y + b.h <= 1 + 1e-9, "a box must stay inside the frame");
6285
7597
  var TimingShape = {
6286
7598
  start: z22.number().min(0).optional(),
@@ -6292,7 +7604,7 @@ var TextOverlaySchema = z22.object({
6292
7604
  box: BoxSchema,
6293
7605
  text: z22.string().min(1, "a text overlay needs text").max(MAX_OVERLAY_TEXT),
6294
7606
  styleRole: z22.enum(BRAND_KIT_TYPE_ROLES),
6295
- fontRole: z22.enum(BRAND_KIT_FONT_ROLES),
7607
+ fontRole: z22.enum(TEXT_FONT_ROLES),
6296
7608
  weight: z22.number().int().min(100).max(900),
6297
7609
  italic: z22.boolean(),
6298
7610
  colorRole: COLOR_ROLE,
@@ -6352,7 +7664,9 @@ var CompositionDocumentSchema = z22.object({
6352
7664
  brandSlug: z22.string().min(1).max(64),
6353
7665
  /** The kit version the document was last edited against; a newer kit is worth a look before rendering. */
6354
7666
  kitVersionAtEdit: z22.number().int().nonnegative(),
6355
- items: z22.array(ItemSchema),
7667
+ // The larger of the two kinds' item caps, checked before any item is
7668
+ // parsed; the per-kind count is enforced by the integrity check below.
7669
+ items: z22.array(ItemSchema).max(Math.max(MAX_REEL_CLIPS, MAX_CAROUSEL_SLIDES)),
6356
7670
  /** Overlays across the whole reel (a logo bug, an end card line). Always empty on a carousel. */
6357
7671
  reelOverlays: z22.array(OverlaySchema).max(MAX_OVERLAYS_PER_ITEM)
6358
7672
  }).strict();
@@ -6507,7 +7821,7 @@ var studioListAssets = defineTool({
6507
7821
  });
6508
7822
  var studioBrandKitGet = defineTool({
6509
7823
  name: "studio_brand_kit_get",
6510
- description: "Read a brand kit: the only colours (by id), type sizes (headline, body), fonts (primary, secondary, with the weights and styles each has) and logos (light, dark) a composition overlay may use. Free, read-only. Use the ids and roles it lists in studio_composition_apply ops; anything else is refused.",
7824
+ description: 'Read a brand kit: the only colours (by id), type sizes (headline, body), fonts (primary, secondary, with the weights and styles each has) and logos (light, dark) a composition overlay may use. Free, read-only. Use the ids and roles it lists in studio_composition_apply ops; anything else is refused. While the kit has no font, text uses fontRole "studio-default" (Inter, built into Studio, weight 400 or 700).',
6511
7825
  inputSchema: { brandSlug: z9.string().min(1).describe("The brand slug, as studio_create_brand made it.") },
6512
7826
  handler: async (args, ctx) => {
6513
7827
  const { kit } = await ctx.client.getBrandKit(args.brandSlug);
@@ -6541,7 +7855,7 @@ var studioCompositionDescribe = defineTool({
6541
7855
  shapes: {
6542
7856
  slide: '{ id, type: "slide", background: { assetId?, fit: "cover"|"contain", focal: { x, y }, fill? (kit colour id) }, overlays: [] } (an image asset of the project, or a fill)',
6543
7857
  clip: '{ id, type: "clip", assetId (a video asset of the project), trimIn, trimOut (seconds), overlays: [] }',
6544
- text: '{ id, type: "text", box: { x, y, w, h } (fractions of the frame), text, styleRole: "headline"|"body", fontRole: "primary"|"secondary", weight (one the font has), italic, colorRole (kit colour id), align: "left"|"center"|"right", background?: { colorRole, opacity, padding }, start?, end? (reels only) }',
7858
+ text: '{ id, type: "text", box: { x, y, w, h } (fractions of the frame), text, styleRole: "headline"|"body", fontRole: "primary"|"secondary"|"studio-default" (Inter, built into Studio, for a brand whose kit has no font yet; weights 400 and 700, no italic), weight (one the font has), italic, colorRole (kit colour id), align: "left"|"center"|"right", background?: { colorRole, opacity, padding }, start?, end? (reels only) }',
6545
7859
  logo: '{ id, type: "logo", box, variant: "light"|"dark", start?, end? }',
6546
7860
  shape: '{ id, type: "shape", box, shape: "rect"|"pill", colorRole, opacity, start?, end? }'
6547
7861
  },
@@ -7072,6 +8386,7 @@ var studioPromptsDelete = defineTool({
7072
8386
  var PROMPT_TOOLS = [studioPromptsList, studioPromptsSave, studioPromptsDelete];
7073
8387
 
7074
8388
  // src/tools.ts
8389
+ var MAX_REFERENCE_TAGS = 50;
7075
8390
  var slug = z12.string().regex(/^[a-z0-9-]+$/, "lowercase letters, numbers and hyphens only").describe("URL-safe identifier: lowercase letters, numbers, hyphens.");
7076
8391
  var waitSeconds = z12.number().int().min(1).max(3600).default(DEFAULT_TIMEOUT_MS / 1e3).describe("Maximum seconds to wait before giving up and returning the id to poll later. Default 600.");
7077
8392
  var httpUrl = z12.string().url().refine((u) => /^https?:\/\//i.test(u), "must be an http(s) URL");
@@ -7173,6 +8488,9 @@ var studioGenerateImage = defineTool({
7173
8488
  candidateCount: z12.number().int().min(1).max(4).optional().describe(
7174
8489
  "Number of candidates (1 to 4). Not every model takes a count: most KIE image models render one image whatever is asked, and a `route/...` model runs on KIE first, so expect one there too (its fal fallback may render up to four). The result carries `candidates: { requested, rendered, mayRender? }`, plus a `notice` whenever fewer will be rendered than were asked for; only rendered images are charged."
7175
8490
  ),
8491
+ variety: z12.enum(["varied", "same"]).optional().describe(
8492
+ 'With candidateCount above 1: "varied" gives each image its own pose and camera line, chosen by the Studio from a curated list of editorial poses and lenses, so the candidates are genuinely different pictures; "same" (the default) renders the prompt as written for every candidate, which on Gemini-class models gives near-identical images. Varied applies on fal models with no attached image to edit; the answer then carries `variety: "varied"`. Same price either way.'
8493
+ ),
7176
8494
  wait: z12.boolean().default(true).describe("Poll until the job finishes (default true)."),
7177
8495
  waitSeconds
7178
8496
  },
@@ -7183,6 +8501,7 @@ var studioGenerateImage = defineTool({
7183
8501
  if (args.imageSize) settings.imageSize = args.imageSize;
7184
8502
  if (args.seed !== void 0) settings.seed = args.seed;
7185
8503
  if (args.candidateCount !== void 0) settings.candidateCount = args.candidateCount;
8504
+ if (args.variety) settings.variety = args.variety;
7186
8505
  const submitted = await ctx.client.generate({
7187
8506
  ...args.brandSlug ? { brandSlug: args.brandSlug } : {},
7188
8507
  ...args.brandMode ? { brandMode: args.brandMode } : {},
@@ -7194,7 +8513,8 @@ var studioGenerateImage = defineTool({
7194
8513
  });
7195
8514
  const plan = {
7196
8515
  ...submitted.candidates ? { candidates: submitted.candidates } : {},
7197
- ...typeof submitted.notice === "string" && submitted.notice.length > 0 ? { notice: submitted.notice } : {}
8516
+ ...typeof submitted.notice === "string" && submitted.notice.length > 0 ? { notice: submitted.notice } : {},
8517
+ ...submitted.variety === "varied" ? { variety: "varied" } : {}
7198
8518
  };
7199
8519
  if (!args.wait) return { jobId: submitted.jobId, kind: submitted.kind, status: "queued", ...plan };
7200
8520
  const done = await waitForJob(ctx.client, submitted.jobId, pollOpts(ctx, args.waitSeconds));
@@ -7316,8 +8636,8 @@ var studioRig3d = defineTool({
7316
8636
  });
7317
8637
  if (!args.wait) return { runId: started.runId, status: "queued" };
7318
8638
  const run = await waitForRun(ctx.client, started.runId, pollOpts(ctx, args.waitSeconds));
7319
- const node = run.nodeRuns.find((n) => n.nodeId === "rig");
7320
- const [rig, ...clips] = node?.results ?? [];
8639
+ const node2 = run.nodeRuns.find((n) => n.nodeId === "rig");
8640
+ const [rig, ...clips] = node2?.results ?? [];
7321
8641
  if (run.run.status !== "succeeded" || !rig?.url) {
7322
8642
  const failure = runFailureSummary(run);
7323
8643
  throw new Error(`Rig run ${started.runId} ended ${run.run.status}.${failure ? ` ${failure}.` : ""} Cost so far $${runCostUsd(run).toFixed(2)}.`);
@@ -7358,7 +8678,7 @@ var studioListCharacters = defineTool({
7358
8678
  });
7359
8679
  var studioGetCharacter = defineTool({
7360
8680
  name: "studio_get_character",
7361
- description: "Fetch one character by slug with its full context: descriptor and negative prompts plus every frozen reference image (category such as face, three-quarter, profile, full-body, close-up, lighting-warm, lighting-cool; URL). The full-body or face reference URL is what studio_replace_character_in_video needs as characterImageUrl. For a character your company owns the URL is a direct image URL. For a character another company shared (owned: false) it is a Studio address: pass it unchanged as an image input to any Studio tool and the Studio resolves it when the job runs, but it is not a public image URL, and it stops working the moment the owner stops sharing.",
8681
+ description: "Fetch one character by slug with its full context: descriptor and negative prompts plus every frozen reference image (category such as face, full-body, three-quarter-left, profile-left, profile-right, three-quarter-right, back, or on a character minted before November 2026 three-quarter, profile, close-up, lighting-warm, lighting-cool; URL; the back view shows no face, so use it only for a person seen from behind). The full-body or face reference URL is what studio_replace_character_in_video needs as characterImageUrl. For a character your company owns the URL is a direct image URL. For a character another company shared (owned: false) it is a Studio address: pass it unchanged as an image input to any Studio tool and the Studio resolves it when the job runs, but it is not a public image URL, and it stops working the moment the owner stops sharing.",
7362
8682
  inputSchema: { slug },
7363
8683
  annotations: { readOnlyHint: true },
7364
8684
  handler: async (args, ctx) => {
@@ -7379,7 +8699,9 @@ var studioPromptEnhance = defineTool({
7379
8699
  name: z12.string().max(200).optional()
7380
8700
  })
7381
8701
  ).max(10).optional().describe("Every mention token of the prompt (at most 10). The returned mentions carry the names your company gave them."),
7382
- model: z12.string().optional().describe('Optional. The image or video model the prompt will be rendered with (e.g. "kie/nano-banana-2"), so the rewrite suits it. It must make the target.'),
8702
+ model: z12.string().optional().describe('Optional. The image or video model the prompt will be rendered with (e.g. "kie/nano-banana-2"), so the rewrite suits it. It must make the target. A model that always edits its first image (Ideogram 4.5 Edit) always gets an edit instruction.'),
8703
+ startFrame: z12.boolean().optional().describe("Optional, video only. True when the clip starts from an image (a start frame): the image already shows the scene, so the rewrite describes only the motion, what the subject does and how the camera moves."),
8704
+ imageAttached: z12.boolean().optional().describe("Optional, image only. True when you will send an image with the generation (a reference or the image to edit): if the prompt asks to change that image, the rewrite is one edit instruction that keeps everything else; if it asks for a new picture, a scene."),
7383
8705
  brandSlug: slug.optional().describe("Optional. A brand of your company whose style the rewrite should follow."),
7384
8706
  brandMode: z12.string().optional().describe('Optional brand mode (e.g. "hero"). Only meaningful with brandSlug.')
7385
8707
  },
@@ -7390,6 +8712,8 @@ var studioPromptEnhance = defineTool({
7390
8712
  target: args.target,
7391
8713
  ...args.mentions && args.mentions.length > 0 ? { mentions: args.mentions } : {},
7392
8714
  ...args.model ? { model: args.model } : {},
8715
+ ...args.startFrame ? { startFrame: true } : {},
8716
+ ...args.imageAttached ? { imageAttached: true } : {},
7393
8717
  ...args.brandSlug ? { brandSlug: args.brandSlug } : {},
7394
8718
  ...args.brandMode ? { brandMode: args.brandMode } : {}
7395
8719
  });
@@ -7426,7 +8750,7 @@ var studioCreateCharacter = defineTool({
7426
8750
  });
7427
8751
  var studioMintCharacter = defineTool({
7428
8752
  name: "studio_mint_character",
7429
- description: "Mint a consistent character from a text description: runs the curated character-sheet workflow (a face with fal/nano-banana-2, then six identity-pinned edits with fal/nano-banana-2-edit: three-quarter, profile, full-body, close-up, warm lighting, cool lighting), waits for it, creates the character, and uploads the 7 views as frozen references with the right categories. Returns the slug, reference count, per-view URLs, the runId and total cost (about $0.30). The description should cover face, hair, age, build and distinguishing features; wardrobe is standardized to a plain gray tee. Takes 2 to 5 minutes. Requires likenessRightsConfirmed: true, which you may only pass after the human you act for confirmed it for this character; without it the tool refuses before the run starts, so nothing is spent.",
8753
+ description: "Mint a consistent character from a text description: runs the curated character-sheet workflow (a face with fal/nano-banana-2, then six identity-pinned edits with fal/nano-banana-2-edit: front full body, turned 45 degrees to screen-left, profile facing screen-left, profile facing screen-right, turned 45 degrees to screen-right, and the back, edited from the face and the front full body; plus one overview image of all six angles at 4K, for people only, never used as a reference), waits for it, creates the character, and uploads the views as frozen references with the right categories (face, full-body, three-quarter-left, profile-left, profile-right, three-quarter-right, back) and the overview as category overview. Returns the slug, reference count, per-view URLs, the runId and total cost (about $0.72 at provider prices). If only the overview failed, the character is still created and the result says so. The description should cover face, hair, age, build and distinguishing features; wardrobe is standardized to a plain gray tee, dark trousers and dark shoes. Takes 2 to 5 minutes. Requires likenessRightsConfirmed: true, which you may only pass after the human you act for confirmed it for this character; without it the tool refuses before the run starts, so nothing is spent.",
7430
8754
  inputSchema: {
7431
8755
  projectId: z12.string().min(1).describe("Project id from studio_list_projects."),
7432
8756
  name: z12.string().min(1).describe("Display name."),
@@ -7455,7 +8779,9 @@ var studioMintCharacter = defineTool({
7455
8779
  ...args.visibility ? { visibility: args.visibility } : {}
7456
8780
  });
7457
8781
  const run = await waitForRun(ctx.client, started.runId, pollOpts(ctx, args.waitSeconds));
7458
- const views = CHARACTER_SHEET_NODES.map((n) => ({ ...n, url: nodeUrl(run, n.nodeId) }));
8782
+ const outputs = CHARACTER_SHEET_NODES.map((n) => ({ ...n, url: nodeUrl(run, n.nodeId) }));
8783
+ const views = outputs.filter((v) => !v.overview);
8784
+ const overview = outputs.find((v) => v.overview);
7459
8785
  const missing = views.filter((v) => !v.url);
7460
8786
  if (missing.length > 0) {
7461
8787
  const failure = runFailureSummary(run);
@@ -7472,7 +8798,7 @@ var studioMintCharacter = defineTool({
7472
8798
  ...args.defaultModel !== void 0 ? { defaultModel: args.defaultModel } : {}
7473
8799
  });
7474
8800
  const references = [];
7475
- for (const view of views) {
8801
+ for (const view of overview?.url ? [...views, overview] : views) {
7476
8802
  const file = await ctx.client.downloadUrl(view.url);
7477
8803
  const category = MINT_REFERENCE_CATEGORIES[view.nodeId];
7478
8804
  const { reference } = await ctx.client.uploadCharacterReference(args.slug, {
@@ -7486,8 +8812,9 @@ var studioMintCharacter = defineTool({
7486
8812
  slug: character.slug,
7487
8813
  name: character.name,
7488
8814
  runId: started.runId,
7489
- referenceCount: references.length,
8815
+ referenceCount: references.filter((r) => r.category !== OVERVIEW_CATEGORY).length,
7490
8816
  references,
8817
+ overview: overview?.url ? { made: true } : { made: false, note: "The overview image failed; the character and its seven reference images were created without it." },
7491
8818
  costUsd: runCostUsd(run)
7492
8819
  };
7493
8820
  }
@@ -7523,7 +8850,7 @@ var studioUploadBrandReference = defineTool({
7523
8850
  source: z12.string().min(1).describe("Local file path or http(s) URL of an image."),
7524
8851
  category: z12.string().optional().describe('Library category, default "general".'),
7525
8852
  label: z12.string().optional().describe("Optional file name / label."),
7526
- tags: z12.array(z12.string()).optional(),
8853
+ tags: z12.array(z12.string()).max(MAX_REFERENCE_TAGS).optional(),
7527
8854
  score: z12.number().int().min(1).max(10).optional()
7528
8855
  },
7529
8856
  handler: async (args, ctx) => {
@@ -7538,7 +8865,8 @@ var studioUploadBrandReference = defineTool({
7538
8865
  return { reference };
7539
8866
  }
7540
8867
  });
7541
- var workflowDefinitionSchema = WorkflowDefinitionSchema.describe(
8868
+ var AgentDefinitionSchema = WorkflowDefinitionSchema.extend({ nodes: z12.array(WorkflowNodeSchema.omit({ cast: true, castOwn: true, imagesWired: true })).min(1).max(MAX_DOCUMENT_NODES) });
8869
+ var workflowDefinitionSchema = AgentDefinitionSchema.describe(
7542
8870
  `Inline workflow DAG: { id, label?, params?: [{ name, type: string|number|boolean|json, required?, label?, description?, inputType?, cardinality?: one|many, default? }], nodes: [{ id, task (one of the model tasks listed), model (catalog id, e.g. fal/nano-banana-2-edit), inputs, retry? }] }. Node inputs are bindings: {kind:"literal",value}, {kind:"param",name,wrap?:"array"}, {kind:"ref",node,path:"url",wrap?:"array"} or an ordered {kind:"list",items:[...]} of those. Image-edit nodes take inputImages (an array: one wrapped ref/param, or a list in reference order, scene frame first); image-to-video nodes take inputImageUrl (start frame) and optionally endImageUrl (end frame, on models that accept one), EXCEPT on a keyframes model (fal/flux-3-keyframes-to-video and its -draft tier), which instead takes keyframeImageUrls (an ordered list of up to 10 images) with keyframeFrameIndexes (one strictly increasing frame per image on a fixed 24 fps timeline). Pass one shape or the other, never both. To hold a character's identity through the clip, an image-to-video node on a model with character references (route/kling-o3 or fal/kling-o3-pro-reference-to-video; a model pinned to KIE, kie/..., is not available for images of people and refuses a run whose node carries a character, a try-on, a swap or an uploaded or referenced image or video, so use the fal or route/ entry for those) also takes referenceImageUrls (a list of character photos, grouped by character, each character's frontal view first, 2 to 4 images per character, up to 3 characters) with referenceElementIndexes (the 0-based character of each image, ascending without gaps, e.g. [0,0,0,1,1]); they never count as the start or end frame, and they need inputImageUrl. kie/gemini-omni-flash-1-1-reference-to-video takes the same two fields with 1 to 6 character images in all and no end frame: its start frame goes in as reference image 1, named in the prompt as the exact scene and first frame, because KIE does not lock a first frame in its reference mode. It runs on KIE, so while Studio keeps people off KIE it is refused for character references like every other kie/ model.`
7543
8871
  );
7544
8872
  var studioRunWorkflow = defineTool({
@@ -7549,7 +8877,7 @@ var studioRunWorkflow = defineTool({
7549
8877
  definition: workflowDefinitionSchema.optional(),
7550
8878
  savedId: z12.string().optional().describe("Id of a saved workflow (from studio_workflow_create, studio_workflow_get or a listed run) to run instead of an inline definition. An unknown id is a 404 naming it; a workflow that is not runnable yet comes back as not_runnable with per-node issues."),
7551
8879
  params: z12.record(z12.string(), z12.unknown()).optional().describe("Values for the definition's params."),
7552
- nodeIds: z12.array(z12.string()).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
8880
+ nodeIds: z12.array(z12.string()).max(MAX_DOCUMENT_NODES).optional().describe("Run only this subset of nodes (requires an inline `definition` or a `savedId`)."),
7553
8881
  upstreamGenerations: z12.record(z12.string(), z12.string()).optional().describe(
7554
8882
  'Pin WHICH generation of an upstream node feeds this subset run: { "<upstream node id>": "<node-run id>" } (the per-node `id` that studio_get_run returns). A verified pin is reused even when the planner has no matching cache key for it (an inline first batch, or a node edited and reverted), so a follow-up node wired from an earlier generation runs against exactly that image. An unknown id is refused naming the node, never silently replaced by the latest.'
7555
8883
  ),
@@ -7892,7 +9220,7 @@ function registerTools(server, base) {
7892
9220
 
7893
9221
  // src/server.ts
7894
9222
  var SERVER_NAME = "lumitra-studio";
7895
- var SERVER_VERSION = "0.18.1";
9223
+ var SERVER_VERSION = "0.21.1";
7896
9224
  function createStudioMcpServer(opts = {}) {
7897
9225
  const config = opts.config ?? resolveConfig(opts.env ?? process.env);
7898
9226
  const client = new StudioClient(config, {