@marlinjai/studio-mcp 0.8.0 → 0.10.0
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/README.md +6 -3
- package/dist/cli.js +348 -25
- package/dist/index.d.ts +24 -3
- package/dist/index.js +348 -25
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -245,7 +245,12 @@ var StudioClient = class {
|
|
|
245
245
|
getWorkflowDocument(savedId2, opts = {}) {
|
|
246
246
|
return this.json("GET", `/api/v1/workflows/${encodeURIComponent(savedId2)}${projectQuery(opts.projectId)}`);
|
|
247
247
|
}
|
|
248
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Create a document by applying `ops` to an empty one (the same code path as
|
|
250
|
+
* apply). 201 created; 200 with `replayed: true` when a create with this
|
|
251
|
+
* idempotencyKey already made it; 409 `idempotency_mismatch` when that key
|
|
252
|
+
* made a different one.
|
|
253
|
+
*/
|
|
249
254
|
createWorkflow(body) {
|
|
250
255
|
return this.json("POST", "/api/v1/workflows", { json: body });
|
|
251
256
|
}
|
|
@@ -574,7 +579,10 @@ var ROUTES = [
|
|
|
574
579
|
"720p": "fal/kling-o3-standard-image-to-video",
|
|
575
580
|
"1080p": "fal/kling-o3-pro-image-to-video"
|
|
576
581
|
},
|
|
577
|
-
label: "fal renders Kling O3 at 720p (Standard) or 1080p (Pro)"
|
|
582
|
+
label: "fal renders Kling O3 at 720p (Standard) or 1080p (Pro)",
|
|
583
|
+
// Only the Pro tier of reference-to-video is in the catalog: a 720p job
|
|
584
|
+
// with references runs on KIE alone.
|
|
585
|
+
withReferences: { "1080p": "fal/kling-o3-pro-reference-to-video" }
|
|
578
586
|
}
|
|
579
587
|
},
|
|
580
588
|
{
|
|
@@ -1158,14 +1166,36 @@ var CATALOG_ENTRIES = [
|
|
|
1158
1166
|
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.",
|
|
1159
1167
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
1160
1168
|
},
|
|
1169
|
+
{
|
|
1170
|
+
id: "kie/gemini-omni-flash-1-1-reference-to-video",
|
|
1171
|
+
provider: "kie",
|
|
1172
|
+
modality: "video",
|
|
1173
|
+
task: "image-to-video",
|
|
1174
|
+
label: "Gemini Omni 1.1 Flash with references (KIE)",
|
|
1175
|
+
description: "Google Gemini Omni 1.1 Flash via KIE in its reference mode: the start keyframe and up to 6 character images wired into the reference port go in as up to 7 reference images, and the prompt names the keyframe as the exact scene and first frame and each character's images in order. KIE does not lock the first frame in this mode (it refuses a first frame together with references), so the clip follows the keyframe closely but may not start on it pixel for pixel; for a locked first frame with references use Kling O3. 4, 6, 8 or 10 s, 720p to 4K, 16:9 or 9:16. No end frame.",
|
|
1176
|
+
// `characterReferences` mirrors
|
|
1177
|
+
// KIE_VIDEO_SPECS['google/gemini-omni-flash-1-1/references'] (checked by a spec).
|
|
1178
|
+
capabilities: {
|
|
1179
|
+
needsImageInput: true,
|
|
1180
|
+
maxInputImages: 1,
|
|
1181
|
+
characterReferences: { maxElements: 6, minImagesPerElement: 1, maxImagesPerElement: 6, maxTotalImages: 6 }
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1161
1184
|
{
|
|
1162
1185
|
id: "kie/kling-o3-image-to-video",
|
|
1163
1186
|
provider: "kie",
|
|
1164
1187
|
modality: "video",
|
|
1165
1188
|
task: "image-to-video",
|
|
1166
1189
|
label: "Kling O3 (KIE)",
|
|
1167
|
-
description: "Kuaishou Kling O3 (KIE calls it Kling 3.0 Omni) via KIE. A start frame and an optional end frame, 3 to 15 s, 720p to 4K in the start frame's shape, silent unless the job sets generateAudio. Accepted a minted character's photoreal stills on 2026-09-24.",
|
|
1168
|
-
|
|
1190
|
+
description: "Kuaishou Kling O3 (KIE calls it Kling 3.0 Omni) via KIE. A start frame and an optional end frame, 3 to 15 s, 720p to 4K in the start frame's shape, silent unless the job sets generateAudio. Accepted a minted character's photoreal stills on 2026-09-24. Holds a character's identity through the clip from character references wired into its reference port: up to 3 characters, 2 to 4 images each (frontal view first).",
|
|
1191
|
+
// `characterReferences` mirrors KIE_VIDEO_SPECS['kling-3.0-omni/image-to-video']
|
|
1192
|
+
// (catalog.spec checks they agree).
|
|
1193
|
+
capabilities: {
|
|
1194
|
+
needsImageInput: true,
|
|
1195
|
+
maxInputImages: 1,
|
|
1196
|
+
acceptsEndFrame: true,
|
|
1197
|
+
characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 12 }
|
|
1198
|
+
}
|
|
1169
1199
|
},
|
|
1170
1200
|
{
|
|
1171
1201
|
id: "fal/grok-imagine-1-5-image-to-video",
|
|
@@ -1213,6 +1243,22 @@ var CATALOG_ENTRIES = [
|
|
|
1213
1243
|
description: "Kuaishou Kling O3 Pro via fal, a fallback for the KIE entry. 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. Not yet tested with a minted character.",
|
|
1214
1244
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
1215
1245
|
},
|
|
1246
|
+
{
|
|
1247
|
+
id: "fal/kling-o3-pro-reference-to-video",
|
|
1248
|
+
provider: "fal",
|
|
1249
|
+
modality: "video",
|
|
1250
|
+
task: "image-to-video",
|
|
1251
|
+
label: "Kling O3 Pro with character references (fal)",
|
|
1252
|
+
description: "Kuaishou Kling O3 Pro reference-to-video via fal, the fal fallback for Kling O3 with character references. A start frame, an optional end frame and up to 3 characters wired into the reference port (2 to 4 images each, frontal view first, 7 images in all), 3 to 15 s at the Pro tier's size. Renders at a set aspect ratio (16:9, 9:16 or 1:1, 16:9 unless set), so set the ratio of the start frame. Silent unless the job sets generateAudio.",
|
|
1253
|
+
// `characterReferences` mirrors FAL_CHARACTER_REFERENCE_LIMITS (catalog.spec
|
|
1254
|
+
// checks they agree).
|
|
1255
|
+
capabilities: {
|
|
1256
|
+
needsImageInput: true,
|
|
1257
|
+
maxInputImages: 1,
|
|
1258
|
+
acceptsEndFrame: true,
|
|
1259
|
+
characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1216
1262
|
{
|
|
1217
1263
|
id: "fal/ltx-2-5-fast-image-to-video",
|
|
1218
1264
|
provider: "fal",
|
|
@@ -1531,6 +1577,21 @@ function routeEntry(id) {
|
|
|
1531
1577
|
function tryGetModel(id) {
|
|
1532
1578
|
return MODEL_CATALOG.find((m) => m.id === id) ?? routeEntry(id);
|
|
1533
1579
|
}
|
|
1580
|
+
function omniReferencesPrompt(prompt, elements) {
|
|
1581
|
+
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."];
|
|
1582
|
+
let next = 2;
|
|
1583
|
+
for (const [i, e] of elements.entries()) {
|
|
1584
|
+
const count2 = 1 + e.referenceImageUrls.length;
|
|
1585
|
+
const span = count2 === 1 ? `Image ${next} shows` : `Images ${next} to ${next + count2 - 1} show`;
|
|
1586
|
+
parts.push(
|
|
1587
|
+
`${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.`
|
|
1588
|
+
);
|
|
1589
|
+
next += count2;
|
|
1590
|
+
}
|
|
1591
|
+
const text = prompt?.trim() ?? "";
|
|
1592
|
+
return text ? `${parts.join(" ")} ${text}` : parts.join(" ");
|
|
1593
|
+
}
|
|
1594
|
+
var OMNI_MAX_REFERENCE_IMAGES = 7;
|
|
1534
1595
|
function veoSpec(model, label) {
|
|
1535
1596
|
return {
|
|
1536
1597
|
family: "veo",
|
|
@@ -1748,6 +1809,44 @@ var KIE_VIDEO_SPECS = {
|
|
|
1748
1809
|
...i.seed !== void 0 ? { seed: i.seed } : {}
|
|
1749
1810
|
})
|
|
1750
1811
|
},
|
|
1812
|
+
// Gemini Omni 1.1 Flash in its REFERENCE mode: up to seven `image_urls`
|
|
1813
|
+
// ("Multiple reference images can be uploaded to provide references for
|
|
1814
|
+
// characters, scenes, styles, or storyboards"; "Maximum of 7 images"), and
|
|
1815
|
+
// no locked first frame, because KIE makes `first_frame_url` "mutually
|
|
1816
|
+
// exclusive with `image_urls`" (docs.kie.ai, read 2026-10-24). The start
|
|
1817
|
+
// keyframe goes first among the images and the prompt names it the exact
|
|
1818
|
+
// scene and first frame (`omniReferencesPrompt`); each character's views
|
|
1819
|
+
// follow. Same model, same price as the first-frame mode.
|
|
1820
|
+
"google/gemini-omni-flash-1-1/references": {
|
|
1821
|
+
family: "job",
|
|
1822
|
+
label: "Gemini Omni 1.1 Flash with references",
|
|
1823
|
+
upstreamModel: "google/gemini-omni-flash-1-1",
|
|
1824
|
+
endFrame: false,
|
|
1825
|
+
aspectRatios: ["16:9", "9:16"],
|
|
1826
|
+
resolutions: ["720p", "1080p", "4k"],
|
|
1827
|
+
durations: { values: [4, 6, 8, 10] },
|
|
1828
|
+
defaultSeconds: 8,
|
|
1829
|
+
defaultResolution: "720p",
|
|
1830
|
+
audioSwitch: false,
|
|
1831
|
+
defaultAudio: false,
|
|
1832
|
+
// Six character images, because the start keyframe takes one of the seven.
|
|
1833
|
+
characterReferences: {
|
|
1834
|
+
maxElements: 6,
|
|
1835
|
+
minImagesPerElement: 1,
|
|
1836
|
+
maxImagesPerElement: 6,
|
|
1837
|
+
maxTotalImages: OMNI_MAX_REFERENCE_IMAGES - 1
|
|
1838
|
+
},
|
|
1839
|
+
maxPromptChars: 2e4,
|
|
1840
|
+
referencesPrompt: omniReferencesPrompt,
|
|
1841
|
+
build: (i) => ({
|
|
1842
|
+
prompt: i.prompt,
|
|
1843
|
+
image_urls: [i.start, ...(i.elements ?? []).flatMap((e) => [e.frontalImageUrl, ...e.referenceImageUrls])],
|
|
1844
|
+
duration: String(i.seconds),
|
|
1845
|
+
resolution: i.resolution,
|
|
1846
|
+
...i.aspectRatio ? { aspect_ratio: i.aspectRatio } : {},
|
|
1847
|
+
...i.seed !== void 0 ? { seed: i.seed } : {}
|
|
1848
|
+
})
|
|
1849
|
+
},
|
|
1751
1850
|
"kling-3.0-omni/image-to-video": {
|
|
1752
1851
|
family: "job",
|
|
1753
1852
|
label: "Kling O3",
|
|
@@ -1760,12 +1859,28 @@ var KIE_VIDEO_SPECS = {
|
|
|
1760
1859
|
defaultResolution: "720p",
|
|
1761
1860
|
audioSwitch: true,
|
|
1762
1861
|
defaultAudio: false,
|
|
1862
|
+
// KIE's "Single First Frame" and "First and Last Frames" request shapes
|
|
1863
|
+
// both carry `elements`: "up to 3 subjects", and "for a multi-image
|
|
1864
|
+
// subject, provide 2 to 4 images" (docs.kie.ai, kling-3.0-omni
|
|
1865
|
+
// image-to-video, read 2026-10-23). Each element needs a name the prompt
|
|
1866
|
+
// can mention as `@name` and a description.
|
|
1867
|
+
characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 12 },
|
|
1868
|
+
maxPromptChars: 3072,
|
|
1763
1869
|
build: (i) => ({
|
|
1764
1870
|
prompt: i.prompt,
|
|
1765
1871
|
image_urls: i.end ? [i.start, i.end] : [i.start],
|
|
1766
1872
|
duration: i.seconds,
|
|
1767
1873
|
resolution: i.resolution,
|
|
1768
|
-
audio: i.audio
|
|
1874
|
+
audio: i.audio,
|
|
1875
|
+
// Named Element1, Element2, ... so one prompt convention (`@Element1`)
|
|
1876
|
+
// holds on KIE and on the fal twin alike.
|
|
1877
|
+
...i.elements && i.elements.length > 0 ? {
|
|
1878
|
+
elements: i.elements.map((e, n) => ({
|
|
1879
|
+
name: `Element${n + 1}`,
|
|
1880
|
+
description: `character ${n + 1}`,
|
|
1881
|
+
element_input_urls: [e.frontalImageUrl, ...e.referenceImageUrls]
|
|
1882
|
+
}))
|
|
1883
|
+
} : {}
|
|
1769
1884
|
})
|
|
1770
1885
|
}
|
|
1771
1886
|
};
|
|
@@ -1792,6 +1907,10 @@ var KLING_26_I2V_ENDPOINT = "fal-ai/kling-video/v2.6/pro/image-to-video";
|
|
|
1792
1907
|
var KLING_O3_STANDARD_I2V_ENDPOINT = "fal-ai/kling-video/o3/standard/image-to-video";
|
|
1793
1908
|
var KLING_O3_PRO_I2V_ENDPOINT = "fal-ai/kling-video/o3/pro/image-to-video";
|
|
1794
1909
|
var KLING_O3_I2V_ENDPOINTS = [KLING_O3_STANDARD_I2V_ENDPOINT, KLING_O3_PRO_I2V_ENDPOINT];
|
|
1910
|
+
var KLING_O3_PRO_R2V_ENDPOINT = "fal-ai/kling-video/o3/pro/reference-to-video";
|
|
1911
|
+
var FAL_CHARACTER_REFERENCE_LIMITS = {
|
|
1912
|
+
[KLING_O3_PRO_R2V_ENDPOINT]: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
|
|
1913
|
+
};
|
|
1795
1914
|
var LTX_25_FAST_I2V_ENDPOINT = "lightricks/ltx-2.5/image-to-video/fast";
|
|
1796
1915
|
var LTX_25_PRO_I2V_ENDPOINT = "lightricks/ltx-2.5/image-to-video/pro";
|
|
1797
1916
|
var LTX_25_I2V_ENDPOINTS = [LTX_25_FAST_I2V_ENDPOINT, LTX_25_PRO_I2V_ENDPOINT];
|
|
@@ -1820,7 +1939,8 @@ var VIDEO_FIXED_RESOLUTION = {
|
|
|
1820
1939
|
[KLING_26_I2V_ENDPOINT]: "1080p",
|
|
1821
1940
|
// Not a resolution the caller picks: Kling O3's tier sets the size.
|
|
1822
1941
|
[KLING_O3_STANDARD_I2V_ENDPOINT]: "fixed",
|
|
1823
|
-
[KLING_O3_PRO_I2V_ENDPOINT]: "fixed"
|
|
1942
|
+
[KLING_O3_PRO_I2V_ENDPOINT]: "fixed",
|
|
1943
|
+
[KLING_O3_PRO_R2V_ENDPOINT]: "fixed"
|
|
1824
1944
|
};
|
|
1825
1945
|
var VIDEO_PINNED_DEFAULT_SECONDS = {
|
|
1826
1946
|
[GROK_IMAGINE_I2V_ENDPOINT]: 5,
|
|
@@ -1834,6 +1954,7 @@ var VIDEO_PINNED_DEFAULT_SECONDS = {
|
|
|
1834
1954
|
[KLING_26_I2V_ENDPOINT]: 5,
|
|
1835
1955
|
[KLING_O3_STANDARD_I2V_ENDPOINT]: 5,
|
|
1836
1956
|
[KLING_O3_PRO_I2V_ENDPOINT]: 5,
|
|
1957
|
+
[KLING_O3_PRO_R2V_ENDPOINT]: 5,
|
|
1837
1958
|
// LTX-2.5 defaults to "auto", a length nobody can price up front; 6 s is its
|
|
1838
1959
|
// shortest clip on both tiers.
|
|
1839
1960
|
[LTX_25_FAST_I2V_ENDPOINT]: 6,
|
|
@@ -1883,6 +2004,8 @@ var VIDEO_ALLOWED_VALUES = {
|
|
|
1883
2004
|
},
|
|
1884
2005
|
[KLING_26_I2V_ENDPOINT]: { durationSeconds: { values: [5, 10] } },
|
|
1885
2006
|
...Object.fromEntries(KLING_O3_I2V_ENDPOINTS.map((e) => [e, { durationSeconds: { min: 3, max: 15 } }])),
|
|
2007
|
+
// Reference-to-video renders at a set ratio (default 16:9), not the frame's.
|
|
2008
|
+
[KLING_O3_PRO_R2V_ENDPOINT]: { aspectRatio: ["16:9", "9:16", "1:1"], durationSeconds: { min: 3, max: 15 } },
|
|
1886
2009
|
[LTX_25_FAST_I2V_ENDPOINT]: {
|
|
1887
2010
|
aspectRatio: ["auto", "16:9", "9:16"],
|
|
1888
2011
|
// fal also renders 1440p, which the canvas does not offer.
|
|
@@ -1941,6 +2064,8 @@ var VIDEO_UNSUPPORTED_PARAMS = {
|
|
|
1941
2064
|
[WAN_30_I2V_ENDPOINT]: ["negativePrompt"],
|
|
1942
2065
|
[KLING_26_I2V_ENDPOINT]: ["resolution", "aspectRatio", "seed"],
|
|
1943
2066
|
...Object.fromEntries(KLING_O3_I2V_ENDPOINTS.map((e) => [e, ["resolution", "aspectRatio", "seed", "negativePrompt"]])),
|
|
2067
|
+
// Its tier sets the size; it takes an aspect ratio, but no seed or negative prompt.
|
|
2068
|
+
[KLING_O3_PRO_R2V_ENDPOINT]: ["resolution", "seed", "negativePrompt"],
|
|
1944
2069
|
...Object.fromEntries(LTX_25_I2V_ENDPOINTS.map((e) => [e, ["seed", "negativePrompt"]]))
|
|
1945
2070
|
};
|
|
1946
2071
|
var ROWS = [
|
|
@@ -2653,8 +2778,10 @@ function searchMeshyAnimations(query, limit = 25) {
|
|
|
2653
2778
|
}
|
|
2654
2779
|
return out;
|
|
2655
2780
|
}
|
|
2656
|
-
var PORT_TYPES = ["text", "image", "video", "mask", "mesh3d", "audio", "json"];
|
|
2657
|
-
var INPUT_PORT_TYPES = PORT_TYPES.filter(
|
|
2781
|
+
var PORT_TYPES = ["text", "image", "video", "mask", "mesh3d", "audio", "json", "reference"];
|
|
2782
|
+
var INPUT_PORT_TYPES = PORT_TYPES.filter(
|
|
2783
|
+
(p) => p !== "mask" && p !== "reference"
|
|
2784
|
+
);
|
|
2658
2785
|
|
|
2659
2786
|
// src/rig.ts
|
|
2660
2787
|
var RIG_MODEL_ID = "fal/meshy-rigging";
|
|
@@ -2719,8 +2846,13 @@ var MODEL_TASKS = [
|
|
|
2719
2846
|
"background-remove",
|
|
2720
2847
|
"segmentation"
|
|
2721
2848
|
];
|
|
2722
|
-
var PORT_TYPES2 = ["text", "image", "video", "mask", "mesh3d", "audio", "json"];
|
|
2723
|
-
|
|
2849
|
+
var PORT_TYPES2 = ["text", "image", "video", "mask", "mesh3d", "audio", "json", "reference"];
|
|
2850
|
+
function portContent(port) {
|
|
2851
|
+
return port === "reference" ? "image" : port;
|
|
2852
|
+
}
|
|
2853
|
+
var INPUT_PORT_TYPES2 = PORT_TYPES2.filter(
|
|
2854
|
+
(p) => p !== "mask" && p !== "reference"
|
|
2855
|
+
);
|
|
2724
2856
|
var TASK_PORTS = {
|
|
2725
2857
|
// GENERATE: born from text (or a mesh prompt), no upstream asset input.
|
|
2726
2858
|
"text-to-image": { inputs: ["text"], output: "image" },
|
|
@@ -2732,7 +2864,11 @@ var TASK_PORTS = {
|
|
|
2732
2864
|
// Two image inputs (garment + person); the port type set is coarse (both are
|
|
2733
2865
|
// 'image'), the two-image contract lives in the fal adapter, not the ports.
|
|
2734
2866
|
"virtual-try-on": { inputs: ["image"], output: "image" },
|
|
2735
|
-
|
|
2867
|
+
// The `image` port takes the start frame (and the end frame, or a keyframe
|
|
2868
|
+
// timeline); the `reference` port takes character reference images for the
|
|
2869
|
+
// models that hold identity from them (Kling elements). A model without that
|
|
2870
|
+
// capability gives the reference port no wires at all (`portCardinality`).
|
|
2871
|
+
"image-to-video": { inputs: ["image", "reference"], output: "video" },
|
|
2736
2872
|
// Video-to-video (character replace): a source video plus ONE reference image
|
|
2737
2873
|
// (the person to swap in). The two-input contract lives in the fal adapter.
|
|
2738
2874
|
"video-to-video": { inputs: ["video", "image"], output: "video" },
|
|
@@ -3097,7 +3233,10 @@ var ROUTES2 = [
|
|
|
3097
3233
|
"720p": "fal/kling-o3-standard-image-to-video",
|
|
3098
3234
|
"1080p": "fal/kling-o3-pro-image-to-video"
|
|
3099
3235
|
},
|
|
3100
|
-
label: "fal renders Kling O3 at 720p (Standard) or 1080p (Pro)"
|
|
3236
|
+
label: "fal renders Kling O3 at 720p (Standard) or 1080p (Pro)",
|
|
3237
|
+
// Only the Pro tier of reference-to-video is in the catalog: a 720p job
|
|
3238
|
+
// with references runs on KIE alone.
|
|
3239
|
+
withReferences: { "1080p": "fal/kling-o3-pro-reference-to-video" }
|
|
3101
3240
|
}
|
|
3102
3241
|
},
|
|
3103
3242
|
{
|
|
@@ -3681,14 +3820,36 @@ var CATALOG_ENTRIES2 = [
|
|
|
3681
3820
|
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.",
|
|
3682
3821
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
3683
3822
|
},
|
|
3823
|
+
{
|
|
3824
|
+
id: "kie/gemini-omni-flash-1-1-reference-to-video",
|
|
3825
|
+
provider: "kie",
|
|
3826
|
+
modality: "video",
|
|
3827
|
+
task: "image-to-video",
|
|
3828
|
+
label: "Gemini Omni 1.1 Flash with references (KIE)",
|
|
3829
|
+
description: "Google Gemini Omni 1.1 Flash via KIE in its reference mode: the start keyframe and up to 6 character images wired into the reference port go in as up to 7 reference images, and the prompt names the keyframe as the exact scene and first frame and each character's images in order. KIE does not lock the first frame in this mode (it refuses a first frame together with references), so the clip follows the keyframe closely but may not start on it pixel for pixel; for a locked first frame with references use Kling O3. 4, 6, 8 or 10 s, 720p to 4K, 16:9 or 9:16. No end frame.",
|
|
3830
|
+
// `characterReferences` mirrors
|
|
3831
|
+
// KIE_VIDEO_SPECS['google/gemini-omni-flash-1-1/references'] (checked by a spec).
|
|
3832
|
+
capabilities: {
|
|
3833
|
+
needsImageInput: true,
|
|
3834
|
+
maxInputImages: 1,
|
|
3835
|
+
characterReferences: { maxElements: 6, minImagesPerElement: 1, maxImagesPerElement: 6, maxTotalImages: 6 }
|
|
3836
|
+
}
|
|
3837
|
+
},
|
|
3684
3838
|
{
|
|
3685
3839
|
id: "kie/kling-o3-image-to-video",
|
|
3686
3840
|
provider: "kie",
|
|
3687
3841
|
modality: "video",
|
|
3688
3842
|
task: "image-to-video",
|
|
3689
3843
|
label: "Kling O3 (KIE)",
|
|
3690
|
-
description: "Kuaishou Kling O3 (KIE calls it Kling 3.0 Omni) via KIE. A start frame and an optional end frame, 3 to 15 s, 720p to 4K in the start frame's shape, silent unless the job sets generateAudio. Accepted a minted character's photoreal stills on 2026-09-24.",
|
|
3691
|
-
|
|
3844
|
+
description: "Kuaishou Kling O3 (KIE calls it Kling 3.0 Omni) via KIE. A start frame and an optional end frame, 3 to 15 s, 720p to 4K in the start frame's shape, silent unless the job sets generateAudio. Accepted a minted character's photoreal stills on 2026-09-24. Holds a character's identity through the clip from character references wired into its reference port: up to 3 characters, 2 to 4 images each (frontal view first).",
|
|
3845
|
+
// `characterReferences` mirrors KIE_VIDEO_SPECS['kling-3.0-omni/image-to-video']
|
|
3846
|
+
// (catalog.spec checks they agree).
|
|
3847
|
+
capabilities: {
|
|
3848
|
+
needsImageInput: true,
|
|
3849
|
+
maxInputImages: 1,
|
|
3850
|
+
acceptsEndFrame: true,
|
|
3851
|
+
characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 12 }
|
|
3852
|
+
}
|
|
3692
3853
|
},
|
|
3693
3854
|
{
|
|
3694
3855
|
id: "fal/grok-imagine-1-5-image-to-video",
|
|
@@ -3736,6 +3897,22 @@ var CATALOG_ENTRIES2 = [
|
|
|
3736
3897
|
description: "Kuaishou Kling O3 Pro via fal, a fallback for the KIE entry. 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. Not yet tested with a minted character.",
|
|
3737
3898
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
3738
3899
|
},
|
|
3900
|
+
{
|
|
3901
|
+
id: "fal/kling-o3-pro-reference-to-video",
|
|
3902
|
+
provider: "fal",
|
|
3903
|
+
modality: "video",
|
|
3904
|
+
task: "image-to-video",
|
|
3905
|
+
label: "Kling O3 Pro with character references (fal)",
|
|
3906
|
+
description: "Kuaishou Kling O3 Pro reference-to-video via fal, the fal fallback for Kling O3 with character references. A start frame, an optional end frame and up to 3 characters wired into the reference port (2 to 4 images each, frontal view first, 7 images in all), 3 to 15 s at the Pro tier's size. Renders at a set aspect ratio (16:9, 9:16 or 1:1, 16:9 unless set), so set the ratio of the start frame. Silent unless the job sets generateAudio.",
|
|
3907
|
+
// `characterReferences` mirrors FAL_CHARACTER_REFERENCE_LIMITS (catalog.spec
|
|
3908
|
+
// checks they agree).
|
|
3909
|
+
capabilities: {
|
|
3910
|
+
needsImageInput: true,
|
|
3911
|
+
maxInputImages: 1,
|
|
3912
|
+
acceptsEndFrame: true,
|
|
3913
|
+
characterReferences: { maxElements: 3, minImagesPerElement: 2, maxImagesPerElement: 4, maxTotalImages: 7 }
|
|
3914
|
+
}
|
|
3915
|
+
},
|
|
3739
3916
|
{
|
|
3740
3917
|
id: "fal/ltx-2-5-fast-image-to-video",
|
|
3741
3918
|
provider: "fal",
|
|
@@ -4119,6 +4296,9 @@ function portBinding(task, port) {
|
|
|
4119
4296
|
if (port === "image" && (task === "image-to-3d" || task === "multiview-to-3d" || task === "image-to-video" || task === "image-to-text" || task === "image-to-json")) {
|
|
4120
4297
|
return { key: "inputImageUrl", path: "url" };
|
|
4121
4298
|
}
|
|
4299
|
+
if (port === "reference" && task === "image-to-video") {
|
|
4300
|
+
return { key: "referenceImageUrls", path: "url", wrap: "array" };
|
|
4301
|
+
}
|
|
4122
4302
|
if (port === "mesh3d" && (task === "remesh" || task === "texture" || task === "rig")) {
|
|
4123
4303
|
return { key: "parentAssetId", path: "assetId" };
|
|
4124
4304
|
}
|
|
@@ -4152,7 +4332,7 @@ function portBinding(task, port) {
|
|
|
4152
4332
|
return null;
|
|
4153
4333
|
}
|
|
4154
4334
|
function canConnect(sourceOut, targetTask, targetPort) {
|
|
4155
|
-
if (sourceOut !== targetPort) return false;
|
|
4335
|
+
if (sourceOut !== portContent(targetPort)) return false;
|
|
4156
4336
|
return portBinding(targetTask, targetPort) !== null;
|
|
4157
4337
|
}
|
|
4158
4338
|
function portCardinality(task, port, model) {
|
|
@@ -4161,11 +4341,18 @@ function portCardinality(task, port, model) {
|
|
|
4161
4341
|
if (port === "image" && task === "image-to-video") {
|
|
4162
4342
|
return modelAcceptsKeyframes(model) ? "many" : "two";
|
|
4163
4343
|
}
|
|
4344
|
+
if (port === "reference") {
|
|
4345
|
+
return modelCharacterReferences(model) ? "many" : "none";
|
|
4346
|
+
}
|
|
4164
4347
|
if (port === "image" && task === "video-to-video") {
|
|
4165
4348
|
return modelTakesSeveralReferences(model) ? "many" : "one";
|
|
4166
4349
|
}
|
|
4167
4350
|
return "one";
|
|
4168
4351
|
}
|
|
4352
|
+
function modelCharacterReferences(model) {
|
|
4353
|
+
if (!model) return null;
|
|
4354
|
+
return tryGetModel2(model)?.capabilities?.characterReferences ?? null;
|
|
4355
|
+
}
|
|
4169
4356
|
function modelTakesSeveralReferences(model) {
|
|
4170
4357
|
if (!model) return false;
|
|
4171
4358
|
const cap = tryGetModel2(model)?.capabilities?.maxInputImages;
|
|
@@ -4217,6 +4404,15 @@ function targetCardinality(node, port) {
|
|
|
4217
4404
|
function slotRefusal(node, port, wired) {
|
|
4218
4405
|
const cardinality = targetCardinality(node, port);
|
|
4219
4406
|
let limit = cardinalityLimit(cardinality);
|
|
4407
|
+
if (port === "reference" && node.kind === "task") {
|
|
4408
|
+
const refs = modelCharacterReferences(node.model);
|
|
4409
|
+
if (refs) limit = Math.min(limit, refs.maxTotalImages);
|
|
4410
|
+
if (wired < limit) return null;
|
|
4411
|
+
if (!refs) {
|
|
4412
|
+
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`;
|
|
4413
|
+
}
|
|
4414
|
+
return `node "${node.id}" (${node.model}) takes at most ${limit} character reference images in all`;
|
|
4415
|
+
}
|
|
4220
4416
|
if (cardinality === "many" && node.kind === "task" && node.model) {
|
|
4221
4417
|
const cap = tryGetModel2(node.model)?.capabilities?.maxInputImages;
|
|
4222
4418
|
if (typeof cap === "number" && cap > 0) limit = Math.min(limit, cap);
|
|
@@ -4231,7 +4427,7 @@ function slotRefusal(node, port, wired) {
|
|
|
4231
4427
|
function wireLegality(source, target, port) {
|
|
4232
4428
|
if (source.id === target.id) return { ok: false, code: "cycle", message: `node "${source.id}" cannot wire into itself` };
|
|
4233
4429
|
const produced = sourcePortOf(source);
|
|
4234
|
-
if (produced !== port) {
|
|
4430
|
+
if (produced !== portContent(port)) {
|
|
4235
4431
|
return { ok: false, code: "invalid_port", message: `node "${source.id}" produces ${produced}, not ${port}` };
|
|
4236
4432
|
}
|
|
4237
4433
|
if (target.kind !== "task") {
|
|
@@ -4240,6 +4436,13 @@ function wireLegality(source, target, port) {
|
|
|
4240
4436
|
if (!canConnect(produced, target.task, port)) {
|
|
4241
4437
|
return { ok: false, code: "invalid_port", message: `a ${port} wire into "${target.id}" (${target.task}) is not supported` };
|
|
4242
4438
|
}
|
|
4439
|
+
if (source.kind === "input" && source.cardinality === "many" && port === "reference") {
|
|
4440
|
+
return {
|
|
4441
|
+
ok: false,
|
|
4442
|
+
code: "invalid_port",
|
|
4443
|
+
message: `list input "${source.id}" cannot feed character references; wire one image input per reference image into "${target.id}"`
|
|
4444
|
+
};
|
|
4445
|
+
}
|
|
4243
4446
|
if (source.kind === "input" && source.cardinality === "many" && portBinding(target.task, port)?.wrap !== "array") {
|
|
4244
4447
|
return {
|
|
4245
4448
|
ok: false,
|
|
@@ -4623,6 +4826,7 @@ function taskModality(task) {
|
|
|
4623
4826
|
return "text";
|
|
4624
4827
|
case "image":
|
|
4625
4828
|
case "mask":
|
|
4829
|
+
case "reference":
|
|
4626
4830
|
return "image";
|
|
4627
4831
|
}
|
|
4628
4832
|
}
|
|
@@ -4708,6 +4912,60 @@ function keyframePositionsFor(sourceIds, settings) {
|
|
|
4708
4912
|
}
|
|
4709
4913
|
return { ok: true, frames };
|
|
4710
4914
|
}
|
|
4915
|
+
var REFERENCE_ELEMENTS_SETTING = "referenceElements";
|
|
4916
|
+
function referenceElementsFor(sourceIds, settings, limits) {
|
|
4917
|
+
const raw = settings?.[REFERENCE_ELEMENTS_SETTING];
|
|
4918
|
+
if (raw !== void 0 && (raw === null || typeof raw !== "object" || Array.isArray(raw))) {
|
|
4919
|
+
return { ok: false, reason: `${REFERENCE_ELEMENTS_SETTING} must map a reference source to its character number` };
|
|
4920
|
+
}
|
|
4921
|
+
const explicit = raw ?? {};
|
|
4922
|
+
const numbers = [];
|
|
4923
|
+
for (const id of sourceIds) {
|
|
4924
|
+
const v = Object.prototype.hasOwnProperty.call(explicit, id) ? explicit[id] : 1;
|
|
4925
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 1) {
|
|
4926
|
+
return {
|
|
4927
|
+
ok: false,
|
|
4928
|
+
reason: `reference "${id}" is set to character ${JSON.stringify(v)}; a character number is a whole number from 1`
|
|
4929
|
+
};
|
|
4930
|
+
}
|
|
4931
|
+
numbers.push(v);
|
|
4932
|
+
}
|
|
4933
|
+
if (sourceIds.length > limits.maxTotalImages) {
|
|
4934
|
+
return {
|
|
4935
|
+
ok: false,
|
|
4936
|
+
reason: `this model takes at most ${limits.maxTotalImages} reference images in all, got ${sourceIds.length}`
|
|
4937
|
+
};
|
|
4938
|
+
}
|
|
4939
|
+
const distinct = [...new Set(numbers)].sort((a, b) => a - b);
|
|
4940
|
+
if (distinct.length > limits.maxElements) {
|
|
4941
|
+
return {
|
|
4942
|
+
ok: false,
|
|
4943
|
+
reason: `this model takes at most ${limits.maxElements} character${limits.maxElements === 1 ? "" : "s"} as references, got ${distinct.length}`
|
|
4944
|
+
};
|
|
4945
|
+
}
|
|
4946
|
+
const order = [];
|
|
4947
|
+
const elements = [];
|
|
4948
|
+
for (const [element, n] of distinct.entries()) {
|
|
4949
|
+
const members = numbers.flatMap((m, i) => m === n ? [i] : []);
|
|
4950
|
+
if (members.length > limits.maxImagesPerElement) {
|
|
4951
|
+
return {
|
|
4952
|
+
ok: false,
|
|
4953
|
+
reason: `character ${element + 1} has ${members.length} reference images; this model takes at most ${limits.maxImagesPerElement} per character (the first wire is the frontal view)`
|
|
4954
|
+
};
|
|
4955
|
+
}
|
|
4956
|
+
if (members.length < limits.minImagesPerElement) {
|
|
4957
|
+
return {
|
|
4958
|
+
ok: false,
|
|
4959
|
+
reason: `character ${element + 1} has ${members.length} reference image${members.length === 1 ? "" : "s"}; this model needs at least ${limits.minImagesPerElement} per character: the frontal view first, then further views such as three-quarter, back or full body`
|
|
4960
|
+
};
|
|
4961
|
+
}
|
|
4962
|
+
for (const i of members) {
|
|
4963
|
+
order.push(i);
|
|
4964
|
+
elements.push(element);
|
|
4965
|
+
}
|
|
4966
|
+
}
|
|
4967
|
+
return { ok: true, order, elements };
|
|
4968
|
+
}
|
|
4711
4969
|
var TASK_TO_KIND = {
|
|
4712
4970
|
// image
|
|
4713
4971
|
"text-to-image": "generate_image",
|
|
@@ -4878,12 +5136,14 @@ function documentToDefinition(doc, opts = {}) {
|
|
|
4878
5136
|
const b = portBinding(task, port);
|
|
4879
5137
|
const cardinality = portCardinality(task, port, node.model);
|
|
4880
5138
|
const keyframes = port === "image" && task === "image-to-video" && modelAcceptsKeyframes(node.model);
|
|
5139
|
+
const references = port === "reference";
|
|
4881
5140
|
const listKey = orderedPortKey(task, port, 0, node.model) ?? b.key;
|
|
4882
5141
|
const items = [];
|
|
5142
|
+
const itemSources = [];
|
|
4883
5143
|
let uploading = false;
|
|
4884
5144
|
for (const [ordinal, e] of portWires.entries()) {
|
|
4885
5145
|
const source = byId.get(e.source);
|
|
4886
|
-
const single = !keyframes && (cardinality !== "many" || portWires.length === 1);
|
|
5146
|
+
const single = !keyframes && !references && (cardinality !== "many" || portWires.length === 1);
|
|
4887
5147
|
const key = orderedPortKey(task, port, ordinal, node.model) ?? b.key;
|
|
4888
5148
|
const wrap = single && b.wrap === "array";
|
|
4889
5149
|
let item = null;
|
|
@@ -4918,7 +5178,38 @@ function documentToDefinition(doc, opts = {}) {
|
|
|
4918
5178
|
}
|
|
4919
5179
|
if (!item) continue;
|
|
4920
5180
|
if (single) inputs[key] = item;
|
|
4921
|
-
else
|
|
5181
|
+
else {
|
|
5182
|
+
items.push(item);
|
|
5183
|
+
itemSources.push(e.source);
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
if (references && !uploading && items.length > 0) {
|
|
5187
|
+
const limits = modelCharacterReferences(node.model);
|
|
5188
|
+
const grouped = limits ? referenceElementsFor(
|
|
5189
|
+
itemSources,
|
|
5190
|
+
node.settings,
|
|
5191
|
+
limits
|
|
5192
|
+
) : {
|
|
5193
|
+
ok: false,
|
|
5194
|
+
reason: `${node.model || "this model"} takes no character references`
|
|
5195
|
+
};
|
|
5196
|
+
if (grouped.ok) {
|
|
5197
|
+
inputs[listKey] = {
|
|
5198
|
+
kind: "list",
|
|
5199
|
+
items: grouped.order.map((i) => items[i])
|
|
5200
|
+
};
|
|
5201
|
+
inputs.referenceElementIndexes = {
|
|
5202
|
+
kind: "literal",
|
|
5203
|
+
value: grouped.elements
|
|
5204
|
+
};
|
|
5205
|
+
} else {
|
|
5206
|
+
issues.push({
|
|
5207
|
+
code: "character_references",
|
|
5208
|
+
nodeId: node.id,
|
|
5209
|
+
message: `Node "${node.id}": ${grouped.reason}`
|
|
5210
|
+
});
|
|
5211
|
+
}
|
|
5212
|
+
continue;
|
|
4922
5213
|
}
|
|
4923
5214
|
if (!uploading && items.length > 0)
|
|
4924
5215
|
inputs[listKey] = { kind: "list", items };
|
|
@@ -4943,6 +5234,13 @@ function documentToDefinition(doc, opts = {}) {
|
|
|
4943
5234
|
}
|
|
4944
5235
|
for (const [key, binding] of Object.entries(node.bakedInputs))
|
|
4945
5236
|
if (!(key in inputs)) inputs[key] = binding;
|
|
5237
|
+
if (task === "image-to-video" && "referenceImageUrls" in inputs && !("inputImageUrl" in inputs)) {
|
|
5238
|
+
issues.push({
|
|
5239
|
+
code: "character_references",
|
|
5240
|
+
nodeId: node.id,
|
|
5241
|
+
message: `Node "${node.id}": character references need a start frame; wire one into the image port.`
|
|
5242
|
+
});
|
|
5243
|
+
}
|
|
4946
5244
|
if (Object.keys(inputs).length === 0 && !promptMissing) {
|
|
4947
5245
|
issues.push({
|
|
4948
5246
|
code: "no_inputs",
|
|
@@ -5405,7 +5703,7 @@ function affectedNodes(doc, ids) {
|
|
|
5405
5703
|
// src/workflowTools.ts
|
|
5406
5704
|
var savedId = z7.string().min(1).describe('The saved workflow id (it carries a "saved:" prefix), from studio_workflow_create or the Studio workflow list.');
|
|
5407
5705
|
var opsSchema = PatchSchema.shape.ops.describe(
|
|
5408
|
-
`The ops to apply in order, 1 to ${MAX_PATCH_OPS}: addNode, removeNode, setNodeProps, setNodeSetting, setBakedInput, connect, disconnect, exposeAsInput, freezeInput, setActiveGeneration, setLayout, group, ungroup, setGroupProps, setDocumentProps. Node ids are yours to choose (UUIDv7 recommended); a later op may reference an id added earlier in the same list.`
|
|
5706
|
+
`The ops to apply in order, 1 to ${MAX_PATCH_OPS}: addNode, removeNode, setNodeProps, setNodeSetting, setBakedInput, connect, disconnect, exposeAsInput, freezeInput, setActiveGeneration, setLayout, group, ungroup, setGroupProps, setDocumentProps. Node ids are yours to choose (UUIDv7 recommended); a later op may reference an id added earlier in the same list. Character references on an image-to-video node: connect each image (an image-source, an image input or an image-producing node) with port "reference", in order, each character's frontal view first; they never count as the start or end frame (those are the "image" port). Only a model whose studio_workflow_describe entry carries characterReferences takes them (Kling O3: 2 to 4 images per character, a locked first frame; Gemini Omni 1.1 Flash with references: 1 to 6 images in all, the start frame sent as the first reference rather than locked). With more than one character, set which one each image shows with setNodeSetting key "referenceElements", value { "<sourceNodeId>": 2 } (an unnamed source is character 1).`
|
|
5409
5707
|
);
|
|
5410
5708
|
var paramsSchema = z7.record(z7.string(), z7.unknown()).describe("Run parameters by input-node name, checked against the declared inputs (unknown names, missing required values and wrong shapes are issues).");
|
|
5411
5709
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -5434,6 +5732,8 @@ function applyErrorOf(raw, ctx) {
|
|
|
5434
5732
|
}
|
|
5435
5733
|
var REBASE_HINT = "Re-read the workflow (studio_workflow_get), rebase your ops on the current revision (node ids are stable) and apply again with that revision as baseRevision.";
|
|
5436
5734
|
var RETRY_HINT = "The outcome of this attempt is unknown. Retry studio_workflow_apply with the SAME idempotencyKey and baseRevision: if the first attempt landed, the Studio returns its original result instead of applying the patch twice.";
|
|
5735
|
+
var CREATE_RETRY_HINT = "The outcome of this attempt is unknown. Retry studio_workflow_create with the SAME idempotencyKey, label and ops: if the first attempt landed, the Studio returns that workflow (replayed: true) instead of making a second one.";
|
|
5736
|
+
var CREATE_IDEMPOTENCY_HINT = "This is not a replay: that idempotencyKey was already used to create a different workflow. Send this create with a NEW idempotencyKey.";
|
|
5437
5737
|
var NOT_EDITABLE_HINT = "This workflow is readable (studio_workflow_get) and runnable (studio_run_workflow with its savedId), but it cannot be patched. Build a new workflow with studio_workflow_create instead of trying to edit this one.";
|
|
5438
5738
|
var LOSSY_HINT = "Read the notes: they name what the import drops for good. To go ahead, resend the SAME ops with acknowledgeLossy: true and a NEW idempotencyKey (the first patch materializes the imported document).";
|
|
5439
5739
|
var IDEMPOTENCY_HINT = "This is not a replay: that key was used for a different patch. Send this patch again with a NEW idempotencyKey, on the revision above.";
|
|
@@ -5496,6 +5796,24 @@ function mapWriteFailure(err, ctx, info) {
|
|
|
5496
5796
|
}
|
|
5497
5797
|
return null;
|
|
5498
5798
|
}
|
|
5799
|
+
function mapCreateFailure(err, ctx, idempotencyKey) {
|
|
5800
|
+
if (!(err instanceof StudioApiError)) return null;
|
|
5801
|
+
const body = isRecord(err.body) ? err.body : {};
|
|
5802
|
+
if (err.status === 409 && body.code === "idempotency_mismatch") {
|
|
5803
|
+
return { ok: false, code: "idempotency_mismatch", message: messageOf(body, ctx), hint: CREATE_IDEMPOTENCY_HINT };
|
|
5804
|
+
}
|
|
5805
|
+
if (err.status === 0 || err.status >= 500) {
|
|
5806
|
+
return {
|
|
5807
|
+
ok: false,
|
|
5808
|
+
code: err.status === 0 ? "network_error" : "server_error",
|
|
5809
|
+
status: err.status,
|
|
5810
|
+
message: ctx.client.redact(err.message),
|
|
5811
|
+
idempotencyKey,
|
|
5812
|
+
hint: CREATE_RETRY_HINT
|
|
5813
|
+
};
|
|
5814
|
+
}
|
|
5815
|
+
return null;
|
|
5816
|
+
}
|
|
5499
5817
|
var studioWorkflowDescribe = defineTool({
|
|
5500
5818
|
name: "studio_workflow_describe",
|
|
5501
5819
|
description: "Describe the node vocabulary before authoring a workflow (read-only, free). Returns { tasks: [{ task, label, family, modality, jobKind, runnable, output, inputs: [{ port, wireable, cardinality, binding }], prompt: { needed, required, key } | null, settingCount, modelCount }], inputTypes (what an input node can declare), opTypes (what studio_workflow_apply accepts), limits: { maxPatchOps } }. Settings knobs and the model catalog are large, so they are dropped unless includeSettings / includeModels is true; filter with tasks to keep the result small.",
|
|
@@ -5571,22 +5889,25 @@ var studioWorkflowGet = defineTool({
|
|
|
5571
5889
|
});
|
|
5572
5890
|
var studioWorkflowCreate = defineTool({
|
|
5573
5891
|
name: "studio_workflow_create",
|
|
5574
|
-
description: 'Create a new saved workflow by applying ops to an empty document (call studio_workflow_describe first for the task vocabulary and ports). Returns { ok: true, savedId, revision, summary } (the studio_workflow_get summary shape, its projection tells you whether it can run). A bad patch returns { ok: false, code: "invalid_patch", error: { opIndex, code, message } } naming the offending op; a missing credential scope returns { ok: false, code: "forbidden", opIndex, missingScope }. Creating is free; running it with studio_run_workflow (savedId) is what spends money.',
|
|
5892
|
+
description: 'Create a new saved workflow by applying ops to an empty document (call studio_workflow_describe first for the task vocabulary and ports). Returns { ok: true, savedId, revision, summary, idempotencyKey } (the studio_workflow_get summary shape, its projection tells you whether it can run), plus replayed: true when an earlier attempt with the same idempotencyKey had already made it (revision is then its current one). A bad patch returns { ok: false, code: "invalid_patch", error: { opIndex, code, message } } naming the offending op; a missing credential scope returns { ok: false, code: "forbidden", opIndex, missingScope }; "idempotency_mismatch" means that key was used for a different create (send a new one); "network_error" / "server_error" carry the idempotencyKey to retry with, so a retry can never make a second workflow. A key is scoped to its project (the same key on another project makes a new workflow), and a retry after the workflow was deleted creates a new one. Creating is free; running it with studio_run_workflow (savedId) is what spends money.',
|
|
5575
5893
|
inputSchema: {
|
|
5576
5894
|
ops: opsSchema,
|
|
5577
5895
|
label: LabelSchema.optional().describe("Display label of the saved workflow."),
|
|
5578
|
-
projectId: z7.string().min(1).optional().describe("Project id from studio_list_projects; omit for the default project.")
|
|
5896
|
+
projectId: z7.string().min(1).optional().describe("Project id from studio_list_projects; omit for the default project."),
|
|
5897
|
+
idempotencyKey: z7.string().min(1).max(200).optional().describe("Omit on a first call (one is generated). After a network_error or server_error, retry with the idempotencyKey that result returned: the first workflow comes back instead of a second one.")
|
|
5579
5898
|
},
|
|
5580
5899
|
handler: async (args, ctx) => {
|
|
5900
|
+
const idempotencyKey = args.idempotencyKey ?? randomUUID();
|
|
5581
5901
|
let res;
|
|
5582
5902
|
try {
|
|
5583
5903
|
res = await ctx.client.createWorkflow({
|
|
5584
5904
|
ops: args.ops,
|
|
5905
|
+
idempotencyKey,
|
|
5585
5906
|
...args.label !== void 0 ? { label: args.label } : {},
|
|
5586
5907
|
...args.projectId !== void 0 ? { projectId: args.projectId } : {}
|
|
5587
5908
|
});
|
|
5588
5909
|
} catch (err) {
|
|
5589
|
-
const mapped = mapWriteFailure(err, ctx, {});
|
|
5910
|
+
const mapped = mapCreateFailure(err, ctx, idempotencyKey) ?? mapWriteFailure(err, ctx, {});
|
|
5590
5911
|
if (mapped) return mapped;
|
|
5591
5912
|
throw err;
|
|
5592
5913
|
}
|
|
@@ -5599,7 +5920,9 @@ var studioWorkflowCreate = defineTool({
|
|
|
5599
5920
|
savedId: res.savedId,
|
|
5600
5921
|
revision: res.revision,
|
|
5601
5922
|
...res.projection ? { projection: res.projection } : {}
|
|
5602
|
-
})
|
|
5923
|
+
}),
|
|
5924
|
+
idempotencyKey,
|
|
5925
|
+
...res.replayed === true ? { replayed: true } : {}
|
|
5603
5926
|
};
|
|
5604
5927
|
}
|
|
5605
5928
|
});
|
|
@@ -6863,7 +7186,7 @@ var studioUploadBrandReference = defineTool({
|
|
|
6863
7186
|
}
|
|
6864
7187
|
});
|
|
6865
7188
|
var workflowDefinitionSchema = WorkflowDefinitionSchema.describe(
|
|
6866
|
-
|
|
7189
|
+
`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, kie/kling-o3-image-to-video, fal/kling-o3-pro-reference-to-video) 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.`
|
|
6867
7190
|
);
|
|
6868
7191
|
var studioRunWorkflow = defineTool({
|
|
6869
7192
|
name: "studio_run_workflow",
|
|
@@ -7214,7 +7537,7 @@ function registerTools(server, base) {
|
|
|
7214
7537
|
|
|
7215
7538
|
// src/server.ts
|
|
7216
7539
|
var SERVER_NAME = "lumitra-studio";
|
|
7217
|
-
var SERVER_VERSION = "0.
|
|
7540
|
+
var SERVER_VERSION = "0.10.0";
|
|
7218
7541
|
function createStudioMcpServer(opts = {}) {
|
|
7219
7542
|
const config = opts.config ?? resolveConfig(opts.env ?? process.env);
|
|
7220
7543
|
const client = new StudioClient(config, {
|