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.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
MOSS N7-1 fixes: the GPU fits a layout's canvas as fal does, the Fast file's licence on record, bare MOSS prompts read as centred
Claude4145801c4371
diff --git a/scripts/comfy/README.md b/scripts/comfy/README.mdindex 161bd9ce..5e671465 100644--- a/scripts/comfy/README.md+++ b/scripts/comfy/README.md@@ -394,6 +394,11 @@ node validate-workflows.mjs moss-image-t2i --shared`optionalModels`). All Apache-2.0. The Workflows page's install commands fetch them; nothing is downloaded at build time.- **Settings**: Standard is the Comfy template's (25 steps, CFG 2.5, er_sde / simple), Best OpenMOSS's guide (50, 3, euler),Fast the DMD file at 8 steps and CFG 1 (`ModelOptions.controls[].sets` on `oss-moss-image` writes them).+- **Canvas**: a size the request names (`params.extra.width` / `height`, a layout's canvas) is fitted to the 16-pixel grid+ and 2048 px a side with its shape kept (`fitCanvas` in `src/lib/comfy.ts`), as fal's `image_size` is, so both engines+ render one size (2560 × 1000 becomes 2048 × 800 on both).+- **Licences, as information**: all Apache-2.0, the optional Fast file's too; the small decoder is byte-identical to BFL's+ Apache-2.0 FLUX.2-small-decoder (the manifest's `license` says so, and Settings → Models & licences shows it).- **Not installed on purpose**: LinXce's Comfyui-Moss-LayoutPrompt (its `MOSSImageLayoutPrompt` id collides with core's) andOpenMOSS's loader pack (core's native path is what its own README recommends). Fuobe compiles layouts itself(`src/lib/layout-prompt.ts`).diff --git a/scripts/comfy/library.spec.mjs b/scripts/comfy/library.spec.mjsindex 8a76b108..4b3e77d7 100644--- a/scripts/comfy/library.spec.mjs+++ b/scripts/comfy/library.spec.mjs@@ -677,7 +677,10 @@ export const SPEC = [limits: { maxWidth: 2048, maxHeight: 2048, dimensionMultiple: 16 },optionalModels: ['moss_image_sft_8stepdmd_int8_convrot.safetensors'],vramGb: 16,- license: 'Apache-2.0 (MOSS-Image SFT, Qwen3.5-9B, FLUX.2 small decoder)',+ // §4.5: each file's licence, the optional Fast file's too (Spectrallic's card is Apache-2.0).+ license:+ "Apache-2.0 (MOSS-Image SFT, Qwen3.5-9B, FLUX.2 small decoder, byte-identical to BFL's Apache-2.0 FLUX.2-small-decoder; " ++ "Fast: Spectrallic's MOSS-Image SFT 8-step DMD int8 file, Apache-2.0)",notes:'Core nodes only (MOSS-Image is native in the pinned ComfyUI): Comfy-Org\'s template image_moss_image_t2i_bboxes without its subgraph, TextGenerate upsampler and box nodes. ' +'The prompt is plain words or a compiled layout (src/lib/layout-prompt.ts compileMoss: summary + items with pixel boxes from the canvas centre, y before x), which reaches the model verbatim; ' +diff --git a/scripts/comfy/validation-state.json b/scripts/comfy/validation-state.jsonindex ab1bd0ec..478c0b26 100644--- a/scripts/comfy/validation-state.json+++ b/scripts/comfy/validation-state.json@@ -309,7 +309,7 @@"sha256": "e306a63bdc30998b0f1083662f906faae772de46d8f6a71c90e17ec299b2fae5","validated": true,"error": null,- "at": "2026-10-29T23:00:17.526Z"+ "at": "2026-10-30T09:40:38.592Z"},"music-ace-step-15": {"sha256": "a64cd8f69aaad6969b547e9c9b8354444cf938325c153ac7a253daae2d1b0ac7",diff --git a/src/lib/comfy.ts b/src/lib/comfy.tsindex b6e21177..6a968081 100644--- a/src/lib/comfy.ts+++ b/src/lib/comfy.ts@@ -251,6 +251,25 @@ export function computeDimensions(return { width: roundTo(height * ratio, multiple), height: roundTo(height, multiple) };}+/**+ * A canvas the request names (params.extra.width / height: a layout's, Soul's exact sizes) on the workflow's grid and+ * inside its maxWidth / maxHeight, the shape kept: rounded to the grid, then scaled down whole when a side is past its+ * limit. The cloud fits the same canvas the same way (payload.ts sizeValue), so 2560 × 1000 is 2048 × 800 on both.+ */+export function fitCanvas(width: number, height: number, limits: Record<string, number> | undefined): { width: number; height: number } {+ const multiple = Number(limits?.dimensionMultiple ?? 16) || 16;+ const maxW = Number(limits?.maxWidth ?? Infinity);+ const maxH = Number(limits?.maxHeight ?? Infinity);+ let w = roundTo(width, multiple);+ let h = roundTo(height, multiple);+ const k = Math.min(1, maxW / w, maxH / h);+ if (k < 1) {+ w = Math.min(Math.max(multiple, Math.floor(maxW / multiple) * multiple), roundTo(w * k, multiple));+ h = Math.min(Math.max(multiple, Math.floor(maxH / multiple) * multiple), roundTo(h * k, multiple));+ }+ return { width: w, height: h };+}+/** Frame count for a duration. Wan/Hunyuan want 4n+1, LTX wants 8n+1. */export function computeFrames(durationSec: number, fps: number, step = 4, maxFrames?: number): number {let frames = Math.round((durationSec * fps) / step) * step + 1;diff --git a/src/lib/layout-prompt.ts b/src/lib/layout-prompt.tsindex 4a13d75d..a6e6804e 100644--- a/src/lib/layout-prompt.ts+++ b/src/lib/layout-prompt.ts@@ -364,6 +364,19 @@ const sideOf = (v: unknown, fallback: number) => {return Number.isFinite(n) && n > 0 ? Math.round(n) : fallback;};+/**+ * Whether a pixel layout's boxes are MOSS's centred yxyx (a compiled prompt) or a LinXce draft's top-left xyxy: what its+ * root says, else centred when a box has a negative edge (only the centre is an origin that gives one) or when it carries+ * no size of its own (LinXce drafts always do) — as decodeMoss reads a prompt with the root's fields missing.+ */+function centredBoxes(v: Record<string, unknown>): boolean {+ if (v.bbox_coord_space === MOSS_COORD_SPACE || v.bbox_format === MOSS_BBOX_FORMAT) return true;+ if (v.bbox_coord_space === "abs" || v.bbox_format === "xyxy") return false;+ const sized = num(v.width) > 0 && num(v.height) > 0;+ const negative = (Array.isArray(v.items) ? v.items : []).some((it) => isObj(it) && (finiteBox(it.bbox) ?? []).some((n) => n < 0));+ return negative || !sized;+}+function fromLayoutValue(v: Record<string, unknown> | unknown[], width: number, height: number): ParsedLayout | null {if (Array.isArray(v)) return { draft: fromElements(v), width, height, from: "elements" };const w = sideOf(v.width, width);@@ -374,7 +387,7 @@ function fromLayoutValue(v: Record<string, unknown> | unknown[], width: number,}const own = readLayout(v);if (own) return { draft: own, width: w, height: h, from: "fuobe" };- const compiled = v.bbox_coord_space === MOSS_COORD_SPACE || v.bbox_format === MOSS_BBOX_FORMAT;+ const compiled = centredBoxes(v);const items = fromPixels(Array.isArray(v.items) ? v.items : [], w, h, compiled);return { draft: { summary: readSummary(v.summary), items }, width: w, height: h, from: compiled ? "compiled" : "linxce" };}diff --git a/src/server/providers/comfyui.ts b/src/server/providers/comfyui.tsindex 27863064..6bbfb376 100644--- a/src/server/providers/comfyui.ts+++ b/src/server/providers/comfyui.ts@@ -10,6 +10,7 @@ import {bypassNode,bypassReference,computeDimensions,+ fitCanvas,computeFrames,dropBranch,dropLoadedSound,@@ -1147,6 +1148,12 @@ export async function prepareWorkflow(endpointTemplate: string, input: GenInput,if (b.channels) values.channels = dbsChannelsFor(extra.channels, sourceChannels);for (const k of ["separationModel", "channels", "sourceChannels"]) delete extra[k];for (const [k, v] of Object.entries(extra)) values[k as BindingKey] = v;+ // A canvas the request names (a layout's, Soul's exact sizes) stays on the graph's grid and inside its limits, as the+ // cloud fits the same canvas (FieldMap.size): both engines render one size, the size a layout is compiled at.+ if (b.width && b.height && (extra.width !== undefined || extra.height !== undefined)) {+ const [w, h] = [Number(values.width), Number(values.height)];+ if (w > 0 && h > 0 && Number.isFinite(w * h)) Object.assign(values, fitCanvas(w, h, manifest.limits));+ }if (audio2 && ctx.op !== "dialogue" && ctx.op !== "voice-change") values.audio2 = audio2;// Soundtrack mix: a silent bed as long as the video, so neither track cuts the other short.if (ctx.op === "mux" && b.duration) {diff --git a/tests/comfy-library-7.test.ts b/tests/comfy-library-7.test.tsindex e4d4456f..650be9f3 100644--- a/tests/comfy-library-7.test.ts+++ b/tests/comfy-library-7.test.ts@@ -4,6 +4,8 @@ import path from "node:path";import { afterAll, describe, expect, it } from "vitest";import type { GenInput } from "@/lib/catalog/types";import type { ComfyWorkflow, Manifest } from "@/lib/comfy";+import { getModel } from "@/lib/catalog";+import { sizeValue } from "@/lib/catalog/payload";import { compileMoss } from "@/lib/layout-prompt";// Research #7 (docs/research/new-models-7.md §4.4, §4.6): MOSS-Image's core-node graph in the ComfyUI library, its pinned@@ -29,7 +31,11 @@ describe("moss-image-t2i in the manifest", () => {expect(Object.keys(entry.bindings).sort()).toEqual(["cfg", "filenamePrefix", "height", "negativePrompt", "prompt", "sampler", "scheduler", "seed", "steps", "unet", "width"]);expect(entry.limits).toEqual({ maxWidth: 2048, maxHeight: 2048, dimensionMultiple: 16 });expect(entry.defaults).toEqual({ width: 1024, height: 1024, steps: 25, cfg: 2.5, sampler: "er_sde", scheduler: "simple", unet: "moss_image_sft_int8_convrot.safetensors" });- expect(entry.license).toBe("Apache-2.0 (MOSS-Image SFT, Qwen3.5-9B, FLUX.2 small decoder)");+ // §4.5: every file's licence, the optional Fast file's too, and where the small decoder's bytes come from.+ expect(entry.license).toBe(+ "Apache-2.0 (MOSS-Image SFT, Qwen3.5-9B, FLUX.2 small decoder, byte-identical to BFL's Apache-2.0 FLUX.2-small-decoder; " ++ "Fast: Spectrallic's MOSS-Image SFT 8-step DMD int8 file, Apache-2.0)",+ );expect(entry.outputs).toEqual([{ node: "10", kind: "image" }]);expect(entry.notes).toMatch(/vramGb 16 is a guess/);expect(entry.notes).toMatch(/CUDA 13 \(cu130\): comfy\/quant_ops\.py/);@@ -97,6 +103,27 @@ describe("the provider fills moss-image-t2i", () => {expect(fast["8"].inputs).toMatchObject({ steps: 8, cfg: 1 });});+ it("fits an asked canvas to the graph's grid and 2048 px limit, the size the cloud sends for it", async () => {+ const fal = getModel("moss-image")!.routes[0].map!.size!;+ for (const [w, h] of [+ [2560, 1000],+ [1000, 1000],+ [4096, 1024],+ [1536, 1024],+ [1250, 3000],+ ]) {+ const wf = await prepare({ prompt: "a poster", extra: { width: w, height: h, layout: { summary: {}, items: [] } } });+ const got = wf["6"].inputs as { width: number; height: number };+ expect(got.width % 16, `${w}x${h}`).toBe(0);+ expect(got.height % 16, `${w}x${h}`).toBe(0);+ expect(Math.max(got.width, got.height), `${w}x${h}`).toBeLessThanOrEqual(2048);+ // Past 512 a side both engines render one size, so a layout compiled at it lands where it was drawn.+ if (Math.min(w, h) >= 512) expect({ width: got.width, height: got.height }, `${w}x${h}`).toEqual(sizeValue(fal, undefined, undefined, { width: w, height: h }));+ }+ const wide = await prepare({ prompt: "a poster", extra: { width: 2560, height: 1000 } });+ expect(wide["6"].inputs).toMatchObject({ width: 2048, height: 800 });+ });+it("keeps a wide shape within 2048 px on the 16-pixel grid", async () => {const wf = await prepare({ prompt: "a banner", aspectRatio: "21:9", resolution: "1.5K" });const { width, height } = wf["6"].inputs as { width: number; height: number };diff --git a/tests/layout-prompt.test.ts b/tests/layout-prompt.test.tsindex 011bf3aa..fbf47dff 100644--- a/tests/layout-prompt.test.ts+++ b/tests/layout-prompt.test.ts@@ -180,6 +180,22 @@ describe("parseLayout", () => {expect(p.draft.aspect).toBe("3:2");});+ it("reads a compiled prompt without the root's bbox fields as centred, as decodeMoss does", () => {+ const bare = '{"summary":{"caption":"x"},"items":[{"label":"text","caption":"t","text":"HI","bbox":[-416,-384,-288,384]}]}';+ const p = parseLayout(bare)!;+ expect(p.from).toBe("compiled");+ expect(p.draft.items[0].box).toEqual([0.125, 0.09375, 0.875, 0.21875]);+ expect(p.draft.items).toEqual(decodeMoss(bare, 1024, 1024)!.items);+ // No negative edge and no size of its own: still the centre's (only LinXce drafts carry their size).+ const quadrant = parseLayout('{"items":[{"label":"object","caption":"c","bbox":[0,0,256,512]}]}')!;+ expect(quadrant.from).toBe("compiled");+ expect(quadrant.draft.items[0].box).toEqual([0.5, 0.5, 1, 0.75]);+ // A sized draft with top-left boxes and no root fields stays LinXce's.+ const sized = parseLayout({ width: 1024, height: 1024, items: [{ label: "object", caption: "c", bbox: [128, 288, 896, 640] }] })!;+ expect(sized.from).toBe("linxce");+ expect(sized.draft.items[0].box).toEqual(px([128, 288, 896, 640], 1024, 1024));+ });+it("converts a legacy scene prompt (scene_type / gen_brief / elements / must_not)", () => {const scene = {scene_type: "Movie poster",diff --git a/workflows/comfyui/manifest.json b/workflows/comfyui/manifest.jsonindex 0dd40de6..1b7421b0 100644--- a/workflows/comfyui/manifest.json+++ b/workflows/comfyui/manifest.json@@ -1,6 +1,6 @@{"version": 1,- "generatedAt": "2026-10-29T23:00:06.691Z",+ "generatedAt": "2026-10-30T09:34:19.291Z","comfyuiCommit": "fc04da91b2ab12f99e4716371a7e4f98ac982597","comfyuiVersion": "0.41.0","workflowTemplatesVersion": "0.11.86",@@ -1321,7 +1321,7 @@],"customNodes": [],"vramGb": 16,- "license": "Apache-2.0 (MOSS-Image SFT, Qwen3.5-9B, FLUX.2 small decoder)",+ "license": "Apache-2.0 (MOSS-Image SFT, Qwen3.5-9B, FLUX.2 small decoder, byte-identical to BFL's Apache-2.0 FLUX.2-small-decoder; Fast: Spectrallic's MOSS-Image SFT 8-step DMD int8 file, Apache-2.0)","validated": true,"notes": "Core nodes only (MOSS-Image is native in the pinned ComfyUI): Comfy-Org's template image_moss_image_t2i_bboxes without its subgraph, TextGenerate upsampler and box nodes. The prompt is plain words or a compiled layout (src/lib/layout-prompt.ts compileMoss: summary + items with pixel boxes from the canvas centre, y before x), which reaches the model verbatim; width / height are the layout's canvas (multiples of 16, up to 2048). Standard = the template: 25 steps, CFG 2.5, er_sde / simple, skip-layer guidance on layer 22 for the first half; Quality = USERGUIDE: 50 steps, CFG 3, euler; Fast = Spectrallic's SFT with the 8-step DMD LoRA merged (unet), 8 steps, CFG 1 (whether it keeps layouts is untested). vramGb 16 is a guess: there is no official figure; about 13 GB of files (DiT 5.4 + encoder 7.3 + VAE 0.25) and ComfyUI offloads. The int8 / w4a8 files run through comfy-kitchen's kernels, which need a PyTorch built for CUDA 13 (cu130): comfy/quant_ops.py turns its CUDA backend off otherwise, logs a warning and (a guess) falls back to a slower path. Validated by /prompt on the CPU library server only: no render, speed or text accuracy measured here."},