@marlinjai/studio-mcp 0.9.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 +121 -8
- package/dist/index.d.ts +11 -2
- package/dist/index.js +121 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,8 +104,8 @@ The token is held in memory only. It is never logged, never serialized into a re
|
|
|
104
104
|
| `studio_get_usage` | What limits the key's company and what it has used: month-to-date spend and job count in what the company paid, the monthly USD cap (`capUsd`) and requests-per-minute limit (`null` = none), a per-model breakdown, and `credits`. For a company on prepaid credits (every new company) `credits` is `{ balanceUsd, dailyLimitUsd, usedTodayUsd, dailyResetsAt, operatorMonthlyLimit }`: the balance, the daily limit, what left the balance today, when the day resets and whether the operator set a monthly limit on top; for a company held to a monthly cap it is `null`. Call before a large batch to check remaining room, or after a `402`/`429` to see what tripped. `usedUsd` includes in-flight (not yet settled) job estimates, so it can go DOWN as well as up: a job that later fails releases its estimate. |
|
|
105
105
|
| `studio_workflow_describe` | The node vocabulary: every task type with ports, prompt policy and runnability, the input types, the op types, the patch limits. Settings and models only with `includeSettings` / `includeModels`; filter with `tasks`. |
|
|
106
106
|
| `studio_workflow_get` | A saved workflow as a summary (nodes, wire counts, edge and group counts, `revision`, `readOnly`, `projection`), or the whole response with `full: true`. |
|
|
107
|
-
| `studio_workflow_create` | Build a new saved workflow from ops applied to an empty document. Returns `{ ok, savedId, revision, summary }
|
|
108
|
-
| `studio_workflow_apply` | Change a saved workflow atomically on top of `baseRevision`. Returns counts, the affected nodes, the projection and `replayed`; every refusal (stale base, invalid patch, missing scope, not editable, lossy import, idempotency mismatch) comes back as a structured `{ ok: false, code, hint }` result. Character references on an image-to-video node (models whose `studio_workflow_describe` entry carries `characterReferences`, Kling O3): `connect` each photo with `port: "reference"`, each character's frontal view first, and with more than one character `setNodeSetting` key `referenceElements`, value `{ "<sourceNodeId>": 2 }`; they never count as the start or end frame. |
|
|
107
|
+
| `studio_workflow_create` | Build a new saved workflow from ops applied to an empty document. Returns `{ ok, savedId, revision, summary, idempotencyKey }`; a retry with that `idempotencyKey` returns the first workflow (`replayed: true`) instead of a second one. |
|
|
108
|
+
| `studio_workflow_apply` | Change a saved workflow atomically on top of `baseRevision`. Returns counts, the affected nodes, the projection and `replayed`; every refusal (stale base, invalid patch, missing scope, not editable, lossy import, idempotency mismatch) comes back as a structured `{ ok: false, code, hint }` result. Character references on an image-to-video node (models whose `studio_workflow_describe` entry carries `characterReferences`, Kling O3): `connect` each photo with `port: "reference"`, each character's frontal view first, and with more than one character `setNodeSetting` key `referenceElements`, value `{ "<sourceNodeId>": 2 }`; they never count as the start or end frame. Gemini Omni 1.1 Flash with references takes 1 to 6 character images and sends the start frame as the first reference (KIE locks no first frame in that mode). |
|
|
109
109
|
| `studio_workflow_validate` | Dry-run a document (inline or by `savedId`) with optional ops and run params: the Studio's `{ apply, document, projection, run }` verdict, no side effects, no cost. |
|
|
110
110
|
| `studio_workflow_screenshot` | Render a saved workflow's document as a diagram (labelled boxes and wires, positioned by the document's own layout), the Figma `get_screenshot` equivalent for a workflow graph. Not a pixel-exact canvas preview, a diagnostic diagram for checking topology. Returns `{ url, width, height }` (a 24h signed link). Free, read-only. |
|
|
111
111
|
| `studio_list_assets` | A project's assets, newest first, optionally one subtype: `Image` for slide backgrounds, `Video` for reel clips, and earlier renders. Free, read-only. |
|
|
@@ -185,7 +185,10 @@ The six `studio_workflow_*` tools are the agent's side of the Studio's workflow
|
|
|
185
185
|
|
|
186
186
|
```
|
|
187
187
|
studio_workflow_describe what nodes exist, their ports, the op vocabulary
|
|
188
|
-
studio_workflow_create { ops, label
|
|
188
|
+
studio_workflow_create { ops, label?, projectId?, idempotencyKey? }
|
|
189
|
+
-> { ok: true, savedId, revision, summary, idempotencyKey, replayed? }
|
|
190
|
+
-> { ok: false, code: "idempotency_mismatch" } that key made a different workflow: use a fresh one
|
|
191
|
+
-> { ok: false, code: "network_error" | "server_error", idempotencyKey } retry with the SAME key, label and ops
|
|
189
192
|
studio_workflow_get { savedId, full? } -> summary (revision = the baseRevision for apply)
|
|
190
193
|
studio_workflow_apply { savedId, baseRevision, ops, idempotencyKey?, acknowledgeLossy? }
|
|
191
194
|
-> { ok: true, revision, appliedCount, inverseCount, affectedNodes, projection, idempotencyKey, replayed }
|
package/dist/cli.js
CHANGED
|
@@ -298,7 +298,12 @@ var StudioClient = class {
|
|
|
298
298
|
getWorkflowDocument(savedId2, opts = {}) {
|
|
299
299
|
return this.json("GET", `/api/v1/workflows/${encodeURIComponent(savedId2)}${projectQuery(opts.projectId)}`);
|
|
300
300
|
}
|
|
301
|
-
/**
|
|
301
|
+
/**
|
|
302
|
+
* Create a document by applying `ops` to an empty one (the same code path as
|
|
303
|
+
* apply). 201 created; 200 with `replayed: true` when a create with this
|
|
304
|
+
* idempotencyKey already made it; 409 `idempotency_mismatch` when that key
|
|
305
|
+
* made a different one.
|
|
306
|
+
*/
|
|
302
307
|
createWorkflow(body) {
|
|
303
308
|
return this.json("POST", "/api/v1/workflows", { json: body });
|
|
304
309
|
}
|
|
@@ -1169,6 +1174,21 @@ var CATALOG_ENTRIES = [
|
|
|
1169
1174
|
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.",
|
|
1170
1175
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
1171
1176
|
},
|
|
1177
|
+
{
|
|
1178
|
+
id: "kie/gemini-omni-flash-1-1-reference-to-video",
|
|
1179
|
+
provider: "kie",
|
|
1180
|
+
modality: "video",
|
|
1181
|
+
task: "image-to-video",
|
|
1182
|
+
label: "Gemini Omni 1.1 Flash with references (KIE)",
|
|
1183
|
+
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.",
|
|
1184
|
+
// `characterReferences` mirrors
|
|
1185
|
+
// KIE_VIDEO_SPECS['google/gemini-omni-flash-1-1/references'] (checked by a spec).
|
|
1186
|
+
capabilities: {
|
|
1187
|
+
needsImageInput: true,
|
|
1188
|
+
maxInputImages: 1,
|
|
1189
|
+
characterReferences: { maxElements: 6, minImagesPerElement: 1, maxImagesPerElement: 6, maxTotalImages: 6 }
|
|
1190
|
+
}
|
|
1191
|
+
},
|
|
1172
1192
|
{
|
|
1173
1193
|
id: "kie/kling-o3-image-to-video",
|
|
1174
1194
|
provider: "kie",
|
|
@@ -1565,6 +1585,21 @@ function routeEntry(id) {
|
|
|
1565
1585
|
function tryGetModel(id) {
|
|
1566
1586
|
return MODEL_CATALOG.find((m) => m.id === id) ?? routeEntry(id);
|
|
1567
1587
|
}
|
|
1588
|
+
function omniReferencesPrompt(prompt, elements) {
|
|
1589
|
+
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."];
|
|
1590
|
+
let next = 2;
|
|
1591
|
+
for (const [i, e] of elements.entries()) {
|
|
1592
|
+
const count2 = 1 + e.referenceImageUrls.length;
|
|
1593
|
+
const span = count2 === 1 ? `Image ${next} shows` : `Images ${next} to ${next + count2 - 1} show`;
|
|
1594
|
+
parts.push(
|
|
1595
|
+
`${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.`
|
|
1596
|
+
);
|
|
1597
|
+
next += count2;
|
|
1598
|
+
}
|
|
1599
|
+
const text = prompt?.trim() ?? "";
|
|
1600
|
+
return text ? `${parts.join(" ")} ${text}` : parts.join(" ");
|
|
1601
|
+
}
|
|
1602
|
+
var OMNI_MAX_REFERENCE_IMAGES = 7;
|
|
1568
1603
|
function veoSpec(model, label) {
|
|
1569
1604
|
return {
|
|
1570
1605
|
family: "veo",
|
|
@@ -1782,6 +1817,44 @@ var KIE_VIDEO_SPECS = {
|
|
|
1782
1817
|
...i.seed !== void 0 ? { seed: i.seed } : {}
|
|
1783
1818
|
})
|
|
1784
1819
|
},
|
|
1820
|
+
// Gemini Omni 1.1 Flash in its REFERENCE mode: up to seven `image_urls`
|
|
1821
|
+
// ("Multiple reference images can be uploaded to provide references for
|
|
1822
|
+
// characters, scenes, styles, or storyboards"; "Maximum of 7 images"), and
|
|
1823
|
+
// no locked first frame, because KIE makes `first_frame_url` "mutually
|
|
1824
|
+
// exclusive with `image_urls`" (docs.kie.ai, read 2026-10-24). The start
|
|
1825
|
+
// keyframe goes first among the images and the prompt names it the exact
|
|
1826
|
+
// scene and first frame (`omniReferencesPrompt`); each character's views
|
|
1827
|
+
// follow. Same model, same price as the first-frame mode.
|
|
1828
|
+
"google/gemini-omni-flash-1-1/references": {
|
|
1829
|
+
family: "job",
|
|
1830
|
+
label: "Gemini Omni 1.1 Flash with references",
|
|
1831
|
+
upstreamModel: "google/gemini-omni-flash-1-1",
|
|
1832
|
+
endFrame: false,
|
|
1833
|
+
aspectRatios: ["16:9", "9:16"],
|
|
1834
|
+
resolutions: ["720p", "1080p", "4k"],
|
|
1835
|
+
durations: { values: [4, 6, 8, 10] },
|
|
1836
|
+
defaultSeconds: 8,
|
|
1837
|
+
defaultResolution: "720p",
|
|
1838
|
+
audioSwitch: false,
|
|
1839
|
+
defaultAudio: false,
|
|
1840
|
+
// Six character images, because the start keyframe takes one of the seven.
|
|
1841
|
+
characterReferences: {
|
|
1842
|
+
maxElements: 6,
|
|
1843
|
+
minImagesPerElement: 1,
|
|
1844
|
+
maxImagesPerElement: 6,
|
|
1845
|
+
maxTotalImages: OMNI_MAX_REFERENCE_IMAGES - 1
|
|
1846
|
+
},
|
|
1847
|
+
maxPromptChars: 2e4,
|
|
1848
|
+
referencesPrompt: omniReferencesPrompt,
|
|
1849
|
+
build: (i) => ({
|
|
1850
|
+
prompt: i.prompt,
|
|
1851
|
+
image_urls: [i.start, ...(i.elements ?? []).flatMap((e) => [e.frontalImageUrl, ...e.referenceImageUrls])],
|
|
1852
|
+
duration: String(i.seconds),
|
|
1853
|
+
resolution: i.resolution,
|
|
1854
|
+
...i.aspectRatio ? { aspect_ratio: i.aspectRatio } : {},
|
|
1855
|
+
...i.seed !== void 0 ? { seed: i.seed } : {}
|
|
1856
|
+
})
|
|
1857
|
+
},
|
|
1785
1858
|
"kling-3.0-omni/image-to-video": {
|
|
1786
1859
|
family: "job",
|
|
1787
1860
|
label: "Kling O3",
|
|
@@ -3755,6 +3828,21 @@ var CATALOG_ENTRIES2 = [
|
|
|
3755
3828
|
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.",
|
|
3756
3829
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
3757
3830
|
},
|
|
3831
|
+
{
|
|
3832
|
+
id: "kie/gemini-omni-flash-1-1-reference-to-video",
|
|
3833
|
+
provider: "kie",
|
|
3834
|
+
modality: "video",
|
|
3835
|
+
task: "image-to-video",
|
|
3836
|
+
label: "Gemini Omni 1.1 Flash with references (KIE)",
|
|
3837
|
+
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.",
|
|
3838
|
+
// `characterReferences` mirrors
|
|
3839
|
+
// KIE_VIDEO_SPECS['google/gemini-omni-flash-1-1/references'] (checked by a spec).
|
|
3840
|
+
capabilities: {
|
|
3841
|
+
needsImageInput: true,
|
|
3842
|
+
maxInputImages: 1,
|
|
3843
|
+
characterReferences: { maxElements: 6, minImagesPerElement: 1, maxImagesPerElement: 6, maxTotalImages: 6 }
|
|
3844
|
+
}
|
|
3845
|
+
},
|
|
3758
3846
|
{
|
|
3759
3847
|
id: "kie/kling-o3-image-to-video",
|
|
3760
3848
|
provider: "kie",
|
|
@@ -5620,7 +5708,7 @@ function affectedNodes(doc, ids) {
|
|
|
5620
5708
|
// src/workflowTools.ts
|
|
5621
5709
|
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.');
|
|
5622
5710
|
var opsSchema = PatchSchema.shape.ops.describe(
|
|
5623
|
-
`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). With more than one character, set which one each image shows with setNodeSetting key "referenceElements", value { "<sourceNodeId>": 2 } (an unnamed source is character 1).`
|
|
5711
|
+
`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).`
|
|
5624
5712
|
);
|
|
5625
5713
|
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).");
|
|
5626
5714
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -5649,6 +5737,8 @@ function applyErrorOf(raw, ctx) {
|
|
|
5649
5737
|
}
|
|
5650
5738
|
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.";
|
|
5651
5739
|
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.";
|
|
5740
|
+
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.";
|
|
5741
|
+
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.";
|
|
5652
5742
|
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.";
|
|
5653
5743
|
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).";
|
|
5654
5744
|
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.";
|
|
@@ -5711,6 +5801,24 @@ function mapWriteFailure(err, ctx, info) {
|
|
|
5711
5801
|
}
|
|
5712
5802
|
return null;
|
|
5713
5803
|
}
|
|
5804
|
+
function mapCreateFailure(err, ctx, idempotencyKey) {
|
|
5805
|
+
if (!(err instanceof StudioApiError)) return null;
|
|
5806
|
+
const body = isRecord(err.body) ? err.body : {};
|
|
5807
|
+
if (err.status === 409 && body.code === "idempotency_mismatch") {
|
|
5808
|
+
return { ok: false, code: "idempotency_mismatch", message: messageOf(body, ctx), hint: CREATE_IDEMPOTENCY_HINT };
|
|
5809
|
+
}
|
|
5810
|
+
if (err.status === 0 || err.status >= 500) {
|
|
5811
|
+
return {
|
|
5812
|
+
ok: false,
|
|
5813
|
+
code: err.status === 0 ? "network_error" : "server_error",
|
|
5814
|
+
status: err.status,
|
|
5815
|
+
message: ctx.client.redact(err.message),
|
|
5816
|
+
idempotencyKey,
|
|
5817
|
+
hint: CREATE_RETRY_HINT
|
|
5818
|
+
};
|
|
5819
|
+
}
|
|
5820
|
+
return null;
|
|
5821
|
+
}
|
|
5714
5822
|
var studioWorkflowDescribe = defineTool({
|
|
5715
5823
|
name: "studio_workflow_describe",
|
|
5716
5824
|
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.",
|
|
@@ -5786,22 +5894,25 @@ var studioWorkflowGet = defineTool({
|
|
|
5786
5894
|
});
|
|
5787
5895
|
var studioWorkflowCreate = defineTool({
|
|
5788
5896
|
name: "studio_workflow_create",
|
|
5789
|
-
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.',
|
|
5897
|
+
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.',
|
|
5790
5898
|
inputSchema: {
|
|
5791
5899
|
ops: opsSchema,
|
|
5792
5900
|
label: LabelSchema.optional().describe("Display label of the saved workflow."),
|
|
5793
|
-
projectId: z7.string().min(1).optional().describe("Project id from studio_list_projects; omit for the default project.")
|
|
5901
|
+
projectId: z7.string().min(1).optional().describe("Project id from studio_list_projects; omit for the default project."),
|
|
5902
|
+
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.")
|
|
5794
5903
|
},
|
|
5795
5904
|
handler: async (args, ctx) => {
|
|
5905
|
+
const idempotencyKey = args.idempotencyKey ?? randomUUID();
|
|
5796
5906
|
let res;
|
|
5797
5907
|
try {
|
|
5798
5908
|
res = await ctx.client.createWorkflow({
|
|
5799
5909
|
ops: args.ops,
|
|
5910
|
+
idempotencyKey,
|
|
5800
5911
|
...args.label !== void 0 ? { label: args.label } : {},
|
|
5801
5912
|
...args.projectId !== void 0 ? { projectId: args.projectId } : {}
|
|
5802
5913
|
});
|
|
5803
5914
|
} catch (err) {
|
|
5804
|
-
const mapped = mapWriteFailure(err, ctx, {});
|
|
5915
|
+
const mapped = mapCreateFailure(err, ctx, idempotencyKey) ?? mapWriteFailure(err, ctx, {});
|
|
5805
5916
|
if (mapped) return mapped;
|
|
5806
5917
|
throw err;
|
|
5807
5918
|
}
|
|
@@ -5814,7 +5925,9 @@ var studioWorkflowCreate = defineTool({
|
|
|
5814
5925
|
savedId: res.savedId,
|
|
5815
5926
|
revision: res.revision,
|
|
5816
5927
|
...res.projection ? { projection: res.projection } : {}
|
|
5817
|
-
})
|
|
5928
|
+
}),
|
|
5929
|
+
idempotencyKey,
|
|
5930
|
+
...res.replayed === true ? { replayed: true } : {}
|
|
5818
5931
|
};
|
|
5819
5932
|
}
|
|
5820
5933
|
});
|
|
@@ -7078,7 +7191,7 @@ var studioUploadBrandReference = defineTool({
|
|
|
7078
7191
|
}
|
|
7079
7192
|
});
|
|
7080
7193
|
var workflowDefinitionSchema = WorkflowDefinitionSchema.describe(
|
|
7081
|
-
`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.`
|
|
7194
|
+
`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.`
|
|
7082
7195
|
);
|
|
7083
7196
|
var studioRunWorkflow = defineTool({
|
|
7084
7197
|
name: "studio_run_workflow",
|
|
@@ -7429,7 +7542,7 @@ function registerTools(server, base) {
|
|
|
7429
7542
|
|
|
7430
7543
|
// src/server.ts
|
|
7431
7544
|
var SERVER_NAME = "lumitra-studio";
|
|
7432
|
-
var SERVER_VERSION = "0.
|
|
7545
|
+
var SERVER_VERSION = "0.10.0";
|
|
7433
7546
|
function createStudioMcpServer(opts = {}) {
|
|
7434
7547
|
const config = opts.config ?? resolveConfig(opts.env ?? process.env);
|
|
7435
7548
|
const client = new StudioClient(config, {
|
package/dist/index.d.ts
CHANGED
|
@@ -1554,6 +1554,8 @@ interface WorkflowCreateResponse {
|
|
|
1554
1554
|
revision: number;
|
|
1555
1555
|
document: WorkflowDocument;
|
|
1556
1556
|
projection?: Projection;
|
|
1557
|
+
/** true when an earlier create with the same idempotencyKey made this workflow. */
|
|
1558
|
+
replayed?: boolean;
|
|
1557
1559
|
}
|
|
1558
1560
|
/** `PATCH /api/v1/workflows/:savedId`: 200. */
|
|
1559
1561
|
interface WorkflowApplyResponse {
|
|
@@ -1830,11 +1832,17 @@ declare class StudioClient {
|
|
|
1830
1832
|
getWorkflowDocument(savedId: string, opts?: {
|
|
1831
1833
|
projectId?: string;
|
|
1832
1834
|
}): Promise<WorkflowDocumentResponse>;
|
|
1833
|
-
/**
|
|
1835
|
+
/**
|
|
1836
|
+
* Create a document by applying `ops` to an empty one (the same code path as
|
|
1837
|
+
* apply). 201 created; 200 with `replayed: true` when a create with this
|
|
1838
|
+
* idempotencyKey already made it; 409 `idempotency_mismatch` when that key
|
|
1839
|
+
* made a different one.
|
|
1840
|
+
*/
|
|
1834
1841
|
createWorkflow(body: {
|
|
1835
1842
|
ops: Op[];
|
|
1836
1843
|
label?: string;
|
|
1837
1844
|
projectId?: string;
|
|
1845
|
+
idempotencyKey?: string;
|
|
1838
1846
|
}): Promise<WorkflowCreateResponse>;
|
|
1839
1847
|
/**
|
|
1840
1848
|
* Apply a patch atomically on top of `patch.baseRevision`. 409 on a stale
|
|
@@ -2043,7 +2051,7 @@ declare function registerTools(server: McpServer, base: ToolContext): void;
|
|
|
2043
2051
|
*/
|
|
2044
2052
|
|
|
2045
2053
|
declare const SERVER_NAME = "lumitra-studio";
|
|
2046
|
-
declare const SERVER_VERSION = "0.
|
|
2054
|
+
declare const SERVER_VERSION = "0.10.0";
|
|
2047
2055
|
interface CreateServerOptions {
|
|
2048
2056
|
config?: StudioConfig;
|
|
2049
2057
|
env?: NodeJS.ProcessEnv;
|
|
@@ -2391,6 +2399,7 @@ declare const studioWorkflowCreate: ToolDef<{
|
|
|
2391
2399
|
}, z.core.$strip>], "type">>;
|
|
2392
2400
|
label: z.ZodOptional<z.ZodString>;
|
|
2393
2401
|
projectId: z.ZodOptional<z.ZodString>;
|
|
2402
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
2394
2403
|
}>;
|
|
2395
2404
|
declare const studioWorkflowApply: ToolDef<{
|
|
2396
2405
|
savedId: z.ZodString;
|
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
|
}
|
|
@@ -1161,6 +1166,21 @@ var CATALOG_ENTRIES = [
|
|
|
1161
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.",
|
|
1162
1167
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
1163
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
|
+
},
|
|
1164
1184
|
{
|
|
1165
1185
|
id: "kie/kling-o3-image-to-video",
|
|
1166
1186
|
provider: "kie",
|
|
@@ -1557,6 +1577,21 @@ function routeEntry(id) {
|
|
|
1557
1577
|
function tryGetModel(id) {
|
|
1558
1578
|
return MODEL_CATALOG.find((m) => m.id === id) ?? routeEntry(id);
|
|
1559
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;
|
|
1560
1595
|
function veoSpec(model, label) {
|
|
1561
1596
|
return {
|
|
1562
1597
|
family: "veo",
|
|
@@ -1774,6 +1809,44 @@ var KIE_VIDEO_SPECS = {
|
|
|
1774
1809
|
...i.seed !== void 0 ? { seed: i.seed } : {}
|
|
1775
1810
|
})
|
|
1776
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
|
+
},
|
|
1777
1850
|
"kling-3.0-omni/image-to-video": {
|
|
1778
1851
|
family: "job",
|
|
1779
1852
|
label: "Kling O3",
|
|
@@ -3747,6 +3820,21 @@ var CATALOG_ENTRIES2 = [
|
|
|
3747
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.",
|
|
3748
3821
|
capabilities: { needsImageInput: true, maxInputImages: 1, acceptsEndFrame: true }
|
|
3749
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
|
+
},
|
|
3750
3838
|
{
|
|
3751
3839
|
id: "kie/kling-o3-image-to-video",
|
|
3752
3840
|
provider: "kie",
|
|
@@ -5615,7 +5703,7 @@ function affectedNodes(doc, ids) {
|
|
|
5615
5703
|
// src/workflowTools.ts
|
|
5616
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.');
|
|
5617
5705
|
var opsSchema = PatchSchema.shape.ops.describe(
|
|
5618
|
-
`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). With more than one character, set which one each image shows with setNodeSetting key "referenceElements", value { "<sourceNodeId>": 2 } (an unnamed source is character 1).`
|
|
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).`
|
|
5619
5707
|
);
|
|
5620
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).");
|
|
5621
5709
|
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -5644,6 +5732,8 @@ function applyErrorOf(raw, ctx) {
|
|
|
5644
5732
|
}
|
|
5645
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.";
|
|
5646
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.";
|
|
5647
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.";
|
|
5648
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).";
|
|
5649
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.";
|
|
@@ -5706,6 +5796,24 @@ function mapWriteFailure(err, ctx, info) {
|
|
|
5706
5796
|
}
|
|
5707
5797
|
return null;
|
|
5708
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
|
+
}
|
|
5709
5817
|
var studioWorkflowDescribe = defineTool({
|
|
5710
5818
|
name: "studio_workflow_describe",
|
|
5711
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.",
|
|
@@ -5781,22 +5889,25 @@ var studioWorkflowGet = defineTool({
|
|
|
5781
5889
|
});
|
|
5782
5890
|
var studioWorkflowCreate = defineTool({
|
|
5783
5891
|
name: "studio_workflow_create",
|
|
5784
|
-
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.',
|
|
5785
5893
|
inputSchema: {
|
|
5786
5894
|
ops: opsSchema,
|
|
5787
5895
|
label: LabelSchema.optional().describe("Display label of the saved workflow."),
|
|
5788
|
-
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.")
|
|
5789
5898
|
},
|
|
5790
5899
|
handler: async (args, ctx) => {
|
|
5900
|
+
const idempotencyKey = args.idempotencyKey ?? randomUUID();
|
|
5791
5901
|
let res;
|
|
5792
5902
|
try {
|
|
5793
5903
|
res = await ctx.client.createWorkflow({
|
|
5794
5904
|
ops: args.ops,
|
|
5905
|
+
idempotencyKey,
|
|
5795
5906
|
...args.label !== void 0 ? { label: args.label } : {},
|
|
5796
5907
|
...args.projectId !== void 0 ? { projectId: args.projectId } : {}
|
|
5797
5908
|
});
|
|
5798
5909
|
} catch (err) {
|
|
5799
|
-
const mapped = mapWriteFailure(err, ctx, {});
|
|
5910
|
+
const mapped = mapCreateFailure(err, ctx, idempotencyKey) ?? mapWriteFailure(err, ctx, {});
|
|
5800
5911
|
if (mapped) return mapped;
|
|
5801
5912
|
throw err;
|
|
5802
5913
|
}
|
|
@@ -5809,7 +5920,9 @@ var studioWorkflowCreate = defineTool({
|
|
|
5809
5920
|
savedId: res.savedId,
|
|
5810
5921
|
revision: res.revision,
|
|
5811
5922
|
...res.projection ? { projection: res.projection } : {}
|
|
5812
|
-
})
|
|
5923
|
+
}),
|
|
5924
|
+
idempotencyKey,
|
|
5925
|
+
...res.replayed === true ? { replayed: true } : {}
|
|
5813
5926
|
};
|
|
5814
5927
|
}
|
|
5815
5928
|
});
|
|
@@ -7073,7 +7186,7 @@ var studioUploadBrandReference = defineTool({
|
|
|
7073
7186
|
}
|
|
7074
7187
|
});
|
|
7075
7188
|
var workflowDefinitionSchema = WorkflowDefinitionSchema.describe(
|
|
7076
|
-
`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.`
|
|
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.`
|
|
7077
7190
|
);
|
|
7078
7191
|
var studioRunWorkflow = defineTool({
|
|
7079
7192
|
name: "studio_run_workflow",
|
|
@@ -7424,7 +7537,7 @@ function registerTools(server, base) {
|
|
|
7424
7537
|
|
|
7425
7538
|
// src/server.ts
|
|
7426
7539
|
var SERVER_NAME = "lumitra-studio";
|
|
7427
|
-
var SERVER_VERSION = "0.
|
|
7540
|
+
var SERVER_VERSION = "0.10.0";
|
|
7428
7541
|
function createStudioMcpServer(opts = {}) {
|
|
7429
7542
|
const config = opts.config ?? resolveConfig(opts.env ?? process.env);
|
|
7430
7543
|
const client = new StudioClient(config, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marlinjai/studio-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Model Context Protocol (MCP) server over the Lumitra Studio HTTP API: generate images, mint characters, run workflows, swap characters into video.",
|
|
6
6
|
"license": "MIT",
|