Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Canvas: a skill whose step takes another's result by reference says why it doesn't open as a canvas

Claude22378b4b9f0d
diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.ts
index 161c58cc..5e66eb95 100644
--- a/src/lib/catalog/canvas.ts
+++ b/src/lib/catalog/canvas.ts
@@ -2621,6 +2621,8 @@ const FILE_PORT: Record<string, InputPortId> = { images: "images", endImage: "en
const CHAIN_PORT: Partial<Record<ChainSlot["slot"], InputPortId>> = { prompt: "prompt", ...(FILE_PORT as Partial<Record<ChainSlot["slot"], InputPortId>>) };
const EXACT_PH = /^\{\{\s*([A-Za-z][A-Za-z0-9_]*)\s*\}\}$/;
const ANY_PH = /\{\{\s*([A-Za-z][A-Za-z0-9_]*)\s*\}\}/g;
+/** A step reference ({{steps.<key>.output}}, recipe version 2). */
+const STEP_REF_PH = /\{\{\s*steps\./;
const INPUT_NODE = { image: "image-input", video: "video-input", audio: "audio-input", text: "prompt", element: "element" } as const satisfies Record<string, CanvasNodeType>;
const SENTINEL_EXT = { image: "png", video: "mp4", audio: "wav" } as const;
const SENTINEL = /^\/api\/files\/recipe-input\/([A-Za-z][A-Za-z0-9_]*)\.(png|mp4|wav)$/;
@@ -2673,6 +2675,9 @@ export function recipeToCanvas(recipe: Recipe, opts: { elements?: readonly Eleme
if (tool) return refuse("It runs one studio step, which shows as a note: open it from Skills", tool.tool);
const params = new Map(recipe.params.map((p) => [p.id, p]));
const steps = recipe.steps as GenerateStep[];
+ // A step that takes an earlier step's output by reference (recipe version 2) runs in parts: a canvas has no wire for it.
+ const byRef = steps.find((s) => STEP_REF_PH.test(JSON.stringify(s.request)));
+ if (byRef) return refuse(`“${byRef.label ?? byRef.key}” takes an earlier step's result by reference, which a canvas can't wire yet`);
// A settings input (a number or a choice) rides on the nodes whose settings it fills: each node shows its value and
// keeps the input for the way back. It must be a whole setting (params.<name>) with a value to show.
const isSetting = (p: RecipeParam | undefined) => p?.type === "number" || p?.type === "choice";
diff --git a/tests/canvas-recipe.test.ts b/tests/canvas-recipe.test.ts
index b22f2a07..d8fe80dd 100644
--- a/tests/canvas-recipe.test.ts
+++ b/tests/canvas-recipe.test.ts
@@ -112,6 +112,11 @@ describe("what isn't drawn", () => {
expect(refused(withStep(patch))).toMatch(/can't wire yet/);
});
+ it("a step that takes an earlier step's result by reference (recipe version 2)", () => {
+ const r = withStep({ request: { ...base.request, inputs: { images: ["{{steps.cutout.output}}"] } } });
+ expect(refused({ ...r, fuobeRecipe: 2 })).toMatch(/by reference, which a canvas can't wire yet/);
+ });
+
it("an input a canvas has no port for", () => {
expect(refused(withStep({ request: { ...base.request, inputs: { mask: "/api/files/m.png" } } }))).toMatch(/no port/);
});