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
createPipeline for multi-step studios; one mode per chain at creation (S9)
Claude38ab2c17d0c9
diff --git a/src/server/chains.ts b/src/server/chains.tsindex 9c474cff..a4f23248 100644--- a/src/server/chains.ts+++ b/src/server/chains.ts@@ -1,8 +1,11 @@import "server-only";import { nanoid } from "nanoid";import { getModel, supportsOp } from "@/lib/catalog";-import type { Engine, Generation, GenerationRequest, ModelDef } from "@/lib/catalog/types";-import { createGenerations } from "./generations";+import { routesFor } from "@/lib/catalog/plan";+import type { ChainSlot, Engine, Generation, GenerationRequest, ModelDef, Operation } from "@/lib/catalog/types";+import { db } from "./db";+import { cancelGeneration, chooseRoute, createGenerations, getGeneration, previewChained } from "./generations";+import { provider } from "./providers";/*** Multi-step jobs built from chained generations: each step waits for the ones it needs and@@ -11,6 +14,42 @@ import { createGenerations } from "./generations";const tidy = (p: string | undefined) => (p ?? "").trim().replace(/[.\s]+$/, "");+// ---------------------------------------------------------------------------+// One mode per chain: all real, or all demo++interface ModeStep {+ label: string;+ modelId: string;+ op: Operation;+}++const providerNames = (m: ModelDef, op: Operation) => [...new Set(routesFor(m, op).map((r) => (r.provider === "llm" ? "Claude or Ollama" : provider(r.provider).label)))].join(" or ");++/**+ * A chain must not mix paid and demo steps: a demo join of paid clips (or a paid step fed a demo+ * placeholder) wastes the money and returns the wrong result. Throws before any row is created.+ */+export function assertOneMode(steps: ModeStep[]): void {+ const modes = steps.map((s) => {+ const m = getModel(s.modelId);+ if (!m) throw new Error(`Unknown model ${s.modelId}`);+ return { ...s, model: m, demo: chooseRoute(routesFor(m, s.op)).demo };+ });+ const demo = modes.find((s) => s.demo);+ if (demo && modes.some((s) => !s.demo)) {+ throw new Error(`${demo.label} needs ${providerNames(demo.model, demo.op)} — connect it in Settings (the other steps would run for real), or turn on demo mode to try it all as a demo`);+ }+}++/** Steps still waiting for their inputs (nothing spent yet) are canceled when the chain they feed can't be made. */+function cancelWaiting(ids: string[]): void {+ for (const id of ids) {+ db()+ .prepare("UPDATE generations SET status = 'canceled', message = NULL, completed_at = ?, updated_at = ? WHERE id = ? AND status = 'queued' AND external_id IS NULL AND depends_on IS NOT NULL")+ .run(Date.now(), Date.now(), id);+ }+}+export interface JoinOptions {engine: Engine;feature: string;@@ -23,10 +62,31 @@ export interface JoinOptions {step?: GenerationRequest["step"];}+const joinModelId = (engine: Engine) => (engine === "open" ? "oss-join-clips" : "join-clips");+/** Join generations' clips, in order. ComfyUI joins 4 at a time, so longer films are joined in steps. */export function joinClips(ids: string[], o: JoinOptions): Generation {- const modelId = o.engine === "open" ? "oss-join-clips" : "join-clips";+ const modelId = joinModelId(o.engine);const max = o.engine === "open" ? 4 : 24;+ // The clips run for real: the join must too (S9). Clips still waiting are canceled rather than paid for.+ const real = ids.some((id) => {+ const g = getGeneration(id);+ return g && g.provider !== "mock";+ });+ if (real) {+ const m = getModel(modelId)!;+ let demo: boolean;+ try {+ demo = chooseRoute(routesFor(m, "concat")).demo;+ } catch (e) {+ cancelWaiting(ids);+ throw e;+ }+ if (demo) {+ cancelWaiting(ids);+ throw new Error(`Joining clips needs ${providerNames(m, "concat")} — connect it in Settings (the clips would render for real, but they couldn't be joined)`);+ }+ }const join = (group: string[], last: boolean): Generation =>createGenerations({@@ -60,9 +120,14 @@ export function createShotFilm(original: GenerationRequest, model: ModelDef): Geconst longest = Math.max(...(model.options.durations ?? [Infinity]));const tooLong = shots.find((s) => s.duration > longest);if (tooLong) throw new Error(`${model.name} makes clips up to ${longest}s — shorten “${tooLong.prompt.slice(0, 40)}”`);+ const canT2v = supportsOp(model, "t2v");+ const firstOp: Operation = original.inputs?.images?.length || !canT2v ? "i2v" : "t2v";+ assertOneMode([+ { label: `${model.name} shots`, modelId: model.id, op: firstOp },+ { label: "Joining the shots", modelId: joinModelId(model.engine), op: "concat" },+ ]);const batchId = nanoid(10);const overall = tidy(original.prompt);- const canT2v = supportsOp(model, "t2v");const params = { ...original.params };delete params.shots;delete params.multiShot;@@ -102,6 +167,11 @@ export function createExtendChain(original: GenerationRequest, model: ModelDef):const video = original.inputs?.video;if (!video) throw new Error("Add the video to continue");if (!supportsOp(model, "i2v")) throw new Error(`${model.name} can't continue a video`);+ assertOneMode([+ { label: "Taking the last frame", modelId: "extract-frame", op: "frame" },+ { label: model.name, modelId: model.id, op: "i2v" },+ { label: "Joining the clips", modelId: joinModelId(model.engine), op: "concat" },+ ]);const batchId = nanoid(10);const frame = createGenerations({ feature: original.feature, modelId: "extract-frame", op: "frame", inputs: { video }, step: { label: "Last frame", index: 0, of: 3 } },@@ -138,3 +208,143 @@ export function filmModel(engine: Engine, modelId?: string): ModelDef {if (!m || m.kind !== "video" || !supportsOp(m, "i2v")) throw new Error("Pick an image-to-video model");return m;}++// ---------------------------------------------------------------------------+// Pipelines: any DAG of steps++export interface PipelineStep {+ /** Unique name of the step within the pipeline (used by `after` and in `byKey`). */+ key: string;+ request: GenerationRequest;+ /** Steps whose first output this one takes, in the order of its chain slots. */+ after?: string | string[];+ /** Where each `after` step's output goes (defaults to `request.chain`, else the images). */+ chain?: ChainSlot[];+}++export interface PipelineOptions {+ /** Group the steps (defaults to a new batch id). */+ batchId?: string;+}++export interface Pipeline {+ batchId: string;+ /** Every generation created, in creation (topological) order. */+ items: Generation[];+ /** The generation each step made (for a step that expands into several rows, its final result). */+ byKey: Record<string, Generation>;+}++const asList = (a: string | string[] | undefined) => (a === undefined ? [] : Array.isArray(a) ? a : [a]);++/** Kahn's algorithm: steps in an order where every `after` comes first; throws on a cycle. */+function topoOrder(steps: PipelineStep[]): PipelineStep[] {+ const byKey = new Map(steps.map((s) => [s.key, s]));+ const indegree = new Map(steps.map((s) => [s.key, new Set(asList(s.after)).size]));+ const ready = steps.filter((s) => indegree.get(s.key) === 0);+ const out: PipelineStep[] = [];+ while (ready.length) {+ const s = ready.shift()!;+ out.push(s);+ for (const t of steps) {+ if (!new Set(asList(t.after)).has(s.key)) continue;+ const n = indegree.get(t.key)! - 1;+ indegree.set(t.key, n);+ if (n === 0) ready.push(byKey.get(t.key)!);+ }+ }+ if (out.length < steps.length) {+ const stuck = steps.filter((s) => !out.includes(s)).map((s) => `“${s.key}”`);+ throw new Error(`These steps wait for each other in a loop: ${stuck.join(", ")}`);+ }+ return out;+}++/**+ * Create a multi-step job from any graph of steps. Every step is validated (models, inputs,+ * engine mode, prices) and the graph is checked — unknown or duplicate keys, loops, a mix of+ * demo and real steps — before a single row is created; then the rows are created in+ * dependency order and the runner launches each step when the steps it waits for succeed.+ *+ * @example Dub a clip into Spanish with the speaker's own voice+ * ```ts+ * const video = "/api/files/uploads/2026-10-17/clip.mp4";+ * const { batchId, byKey } = createPipeline([+ * // Voice and background stems; the voice stem (the first audio output) is what we clone.+ * { key: "stems", request: { feature: "dub", modelId: "…separate-audio model", op: "separate-audio", inputs: { video } } },+ * { key: "words", request: { feature: "dub", modelId: "…transcribe model", op: "transcribe" }, after: "stems", chain: [{ slot: "audio" }] },+ * // A transcript's cues go in as a cue list, so the translation keeps the timing.+ * { key: "spanish", request: { feature: "dub", modelId: "text-llm", op: "translate", params: { targetLanguage: "Spanish" } }, after: "words", chain: [{ slot: "prompt" }] },+ * { key: "voice", request: { feature: "dub", modelId: "chatterbox-cloud", op: "tts" }, after: ["spanish", "stems"], chain: [{ slot: "prompt" }, { slot: "voiceAudio" }] },+ * { key: "lips", request: { feature: "dub", modelId: "sync-lipsync-3", op: "lipsync", inputs: { video } }, after: "voice", chain: [{ slot: "audio" }] },+ * { key: "film", request: { feature: "dub", modelId: "…mux model", op: "mux" }, after: ["lips", "voice"], chain: [{ slot: "video" }, { slot: "audio" }] },+ * ]);+ * // byKey.film is the finished video; every step shares batchId and shows "Step n of 6".+ * ```+ */+export function createPipeline(steps: PipelineStep[], opts: PipelineOptions = {}): Pipeline {+ if (!steps.length) throw new Error("A pipeline needs at least one step");+ const keys = new Set<string>();+ for (const s of steps) {+ if (!s.key?.trim()) throw new Error("Every step needs a key");+ if (keys.has(s.key)) throw new Error(`Two steps are called “${s.key}”`);+ keys.add(s.key);+ }+ for (const s of steps) {+ const after = asList(s.after);+ for (const a of after) {+ if (a === s.key) throw new Error(`Step “${s.key}” can't wait for itself`);+ if (!keys.has(a)) throw new Error(`Step “${s.key}” waits for “${a}”, which isn't in the pipeline`);+ }+ if (new Set(after).size !== after.length) throw new Error(`Step “${s.key}” lists the same step twice`);+ const chain = s.chain ?? s.request.chain;+ if (chain && chain.length !== after.length) throw new Error(`Step “${s.key}” has ${chain.length} chain slot${chain.length === 1 ? "" : "s"} for ${after.length} earlier step${after.length === 1 ? "" : "s"}`);+ }+ const ordered = topoOrder(steps);+ const n = steps.length;+ const indexOf = new Map(ordered.map((s, i) => [s.key, i]));+ const requests = new Map(+ ordered.map((s) => {+ const chain = s.chain ?? s.request.chain;+ const req: GenerationRequest = {+ ...s.request,+ ...(chain && { chain }),+ step: s.request.step ?? { label: `Step ${indexOf.get(s.key)! + 1} of ${n}`, index: indexOf.get(s.key)!, of: n },+ };+ return [s.key, req];+ }),+ );+ // Validate every step now, with placeholders for what earlier steps will make.+ const needed = new Set(steps.flatMap((s) => asList(s.after)));+ const previews = ordered.map((s) => {+ let p: ReturnType<typeof previewChained>;+ try {+ p = previewChained(requests.get(s.key)!, asList(s.after).length);+ } catch (e) {+ throw new Error(`Step “${s.key}”: ${(e as Error).message}`);+ }+ if (needed.has(s.key) && p.jobs > 1) throw new Error(`Step “${s.key}” makes ${p.jobs} jobs; later steps need one result — ask it for fewer outputs`);+ return { key: s.key, ...p };+ });+ const demo = previews.find((p) => p.demo);+ if (demo && previews.some((p) => !p.demo)) {+ throw new Error(`Step “${demo.key}” would run as a demo (${demo.model.name} needs ${providerNames(demo.model, demo.op)}) while the others run for real — connect it in Settings, or turn on demo mode to try it all as a demo`);+ }++ const batchId = opts.batchId ?? nanoid(10);+ const items: Generation[] = [];+ const byKey: Record<string, Generation> = {};+ try {+ for (const s of ordered) {+ const after = asList(s.after);+ const made = createGenerations(requests.get(s.key)!, { batchId, ...(after.length && { dependsOn: after.map((a) => byKey[a].id) }) });+ byKey[s.key] = made[0];+ items.push(...made);+ }+ } catch (e) {+ // Don't leave half a pipeline running.+ for (const g of items) void cancelGeneration(g.id);+ throw e;+ }+ return { batchId, items, byKey };+}diff --git a/tests/pipeline.test.ts b/tests/pipeline.test.tsnew file mode 100644index 00000000..ee62fb15--- /dev/null+++ b/tests/pipeline.test.ts@@ -0,0 +1,170 @@+import fs from "node:fs";+import http from "node:http";+import os from "node:os";+import path from "node:path";+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";+import type { Generation } from "@/lib/catalog/types";++vi.mock("@/lib/catalog", async (importOriginal) => {+ const mod = await importOriginal<typeof import("@/lib/catalog")>();+ const { ROUND3_FIXTURES } = await import("./fixtures/round3-models");+ return { ...mod, MODELS: [...mod.MODELS, ...ROUND3_FIXTURES], getModel: (id: string) => ROUND3_FIXTURES.find((m) => m.id === id) ?? mod.getModel(id) };+});+vi.setConfig({ testTimeout: 90_000 });++const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-pipeline-"));+process.env.FUOBE_DATA_DIR = dir;+process.env.COMFYUI_URL = "http://127.0.0.1:9";+process.env.OLLAMA_URL = "http://127.0.0.1:9";++const { setSetting } = await import("@/server/settings");+const gens = await import("@/server/generations");+const { createPipeline, assertOneMode } = await import("@/server/chains");+const { saveFile } = await import("@/server/storage");+const { db } = await import("@/server/db");+const { probeOllama } = await import("@/server/providers/llm");++beforeAll(() => setSetting("demoMode", "auto"));+afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));++async function settle(id: string, ms = 80_000): Promise<Generation> {+ const end = Date.now() + ms;+ for (;;) {+ const g = gens.getGeneration(id)!;+ if (["succeeded", "failed", "canceled"].includes(g.status)) return g;+ if (Date.now() > end) throw new Error(`timed out: ${g.status} ${g.message}`);+ await new Promise((r) => setTimeout(r, 250));+ }+}++const dependsOn = (id: string) => {+ const v = (db().prepare("SELECT depends_on FROM generations WHERE id = ?").get(id) as { depends_on: string | null }).depends_on;+ return !v ? [] : v.startsWith("[") ? (JSON.parse(v) as string[]) : [v];+};++const step = (key: string, modelId: string, extra: Record<string, unknown> = {}) => ({ key, request: { feature: "dub", modelId, prompt: key, ...extra } });++describe("createPipeline validation", () => {+ it("rejects unknown and duplicate keys, loops and mismatched slots before creating anything", () => {+ const before = (db().prepare("SELECT COUNT(*) AS n FROM generations").get() as { n: number }).n;+ expect(() => createPipeline([])).toThrow(/at least one step/);+ expect(() => createPipeline([step("a", "nano-banana-pro"), step("a", "nano-banana-pro")])).toThrow(/Two steps are called “a”/);+ expect(() => createPipeline([{ ...step("a", "nano-banana-pro"), after: "ghost" }])).toThrow(/waits for “ghost”, which isn't in the pipeline/);+ expect(() => createPipeline([{ ...step("a", "nano-banana-pro"), after: "a" }])).toThrow(/can't wait for itself/);+ expect(() =>+ createPipeline([+ { ...step("a", "nano-banana-pro"), after: "b" },+ { ...step("b", "nano-banana-pro"), after: "a" },+ ]),+ ).toThrow(/in a loop: “a”, “b”/);+ expect(() => createPipeline([step("a", "nano-banana-pro"), { ...step("b", "kling-3"), after: "a", chain: [{ slot: "images" }, { slot: "endImage" }] }])).toThrow(/2 chain slots for 1 earlier step/);+ expect(() => createPipeline([step("a", "nano-banana-pro"), { ...step("b", "text-llm", { op: "translate" }), after: "a", chain: [{ slot: "prompt" }] }])).toThrow(/Step “b”: Pick a language/);+ expect(() => createPipeline([step("a", "kling-3", { params: { numOutputs: 2 } }), { ...step("b", "kling-3"), after: "a" }])).toThrow(/makes 2 jobs/);+ expect((db().prepare("SELECT COUNT(*) AS n FROM generations").get() as { n: number }).n).toBe(before);+ });++ it("refuses to mix demo and paid steps (S9)", () => {+ setSetting("falKey", "fal-test-key");+ try {+ // The fixtures run on fal (now "connected"); the LLM has nothing to run on.+ expect(() => createPipeline([step("words", "test-transcribe"), { ...step("es", "text-llm", { op: "translate", params: { targetLanguage: "Spanish" } }), after: "words", chain: [{ slot: "prompt" }] }])).toThrow(+ /Step “es” would run as a demo \(Claude needs Claude or Ollama\)/,+ );+ expect(() => assertOneMode([{ label: "Joining clips", modelId: "join-clips", op: "concat" }, { label: "Writing", modelId: "text-llm", op: "write" }])).toThrow(/Writing needs Claude or Ollama/);+ } finally {+ setSetting("falKey", "");+ }+ expect(() => assertOneMode([{ label: "Joining clips", modelId: "join-clips", op: "concat" }, { label: "Writing", modelId: "text-llm", op: "write" }])).not.toThrow();+ });+});++describe("createPipeline on the demo provider", () => {+ it("dubs a clip: stems → transcript → translation → cloned voice → lipsync → mux", async () => {+ const video = saveFile({ data: fs.readFileSync(path.join(process.cwd(), "public/samples/demo-landscape.mp4")), contentType: "video/mp4", source: "upload" }).url;+ const p = createPipeline([+ { key: "film", request: { feature: "dub", modelId: "test-mux", op: "mux", prompt: "Final cut" }, after: ["lips", "voice"], chain: [{ slot: "video" }, { slot: "audio" }] },+ { key: "stems", request: { feature: "dub", modelId: "test-separate", op: "separate-audio", prompt: "Split", inputs: { video } } },+ { key: "words", request: { feature: "dub", modelId: "test-transcribe", op: "transcribe", prompt: "Transcribe" }, after: "stems", chain: [{ slot: "audio" }] },+ { key: "spanish", request: { feature: "dub", modelId: "text-llm", op: "translate", params: { targetLanguage: "Spanish" } }, after: "words", chain: [{ slot: "prompt" }] },+ { key: "voice", request: { feature: "dub", modelId: "chatterbox-cloud", op: "tts" }, after: ["spanish", "stems"], chain: [{ slot: "prompt" }, { slot: "voiceAudio" }] },+ { key: "lips", request: { feature: "dub", modelId: "sync-lipsync-3", op: "lipsync", inputs: { video } }, after: "voice", chain: [{ slot: "audio" }] },+ ]);+ // Created in dependency order, all in one batch, labelled by step.+ expect(p.items.map((g) => g.request.step?.label)).toEqual(["Step 1 of 6", "Step 2 of 6", "Step 3 of 6", "Step 4 of 6", "Step 5 of 6", "Step 6 of 6"]);+ expect(p.items.map((g) => g.op)).toEqual(["separate-audio", "transcribe", "translate", "tts", "lipsync", "mux"]);+ expect(new Set(p.items.map((g) => g.batchId))).toEqual(new Set([p.batchId]));+ expect(dependsOn(p.byKey.voice.id)).toEqual([p.byKey.spanish.id, p.byKey.stems.id]);+ expect(dependsOn(p.byKey.film.id)).toEqual([p.byKey.lips.id, p.byKey.voice.id]);+ // A waiting step shows its own words, not the placeholder text.+ expect(p.byKey.voice.prompt).toBeNull();++ const film = await settle(p.byKey.film.id);+ expect(film.status, film.error ?? "").toBe("succeeded");+ const get = (k: string) => gens.getGeneration(p.byKey[k].id)!;+ const [stems, words, spanish, voice, lips] = ["stems", "words", "spanish", "voice", "lips"].map(get);+ // The transcript goes in as cues, so the translation keeps the timing.+ expect(JSON.parse(spanish.request.prompt!)).toEqual(words.outputs[0].meta!.cues);+ expect((spanish.outputs[0].meta!.cues as { start: number }[]).map((c) => c.start)).toEqual((words.outputs[0].meta!.cues as { start: number }[]).map((c) => c.start));+ // "prompt": the translation is what gets spoken; "voiceAudio": the voice stem is cloned.+ expect(voice.request.prompt).toBe(spanish.outputs[0].text);+ expect(voice.prompt).toBe(spanish.outputs[0].text);+ expect(voice.request.inputs?.voiceAudio).toBe(stems.outputs.find((o) => o.meta?.stem === "voice")!.url);+ expect(words.request.inputs?.audio).toBe(stems.outputs[0].url);+ expect(lips.request.inputs).toMatchObject({ video, audio: voice.outputs[0].url });+ expect(film.request.inputs).toMatchObject({ video: lips.outputs[0].url, audio: voice.outputs[0].url });+ });+});++describe("one mode per chain at launch (S9)", () => {+ const insertDone = (id: string, providerId: string, outputs: unknown[]) =>+ db()+ .prepare(+ `INSERT INTO generations (id, feature, model_id, engine, provider, op, kind, status, request_json, outputs_json, external_id, created_at, updated_at, completed_at)+ VALUES (?, 'video', 'kling-3', 'cloud', ?, 'i2v', 'video', 'succeeded', '{"feature":"video","modelId":"kling-3"}', ?, 'x', ?, ?, ?)`,+ )+ .run(id, providerId, JSON.stringify(outputs), Date.now(), Date.now(), Date.now());++ it("won't join paid clips on the demo provider, and cancels the clips still waiting", async () => {+ const { joinClips } = await import("@/server/chains");+ for (const id of ["paid-a", "paid-b"]) {+ db()+ .prepare(+ `INSERT INTO generations (id, feature, model_id, engine, provider, op, kind, status, request_json, outputs_json, depends_on, created_at, updated_at)+ VALUES (?, 'storyboard-film', 'kling-3', 'cloud', 'higgsfield', 'i2v', 'video', 'queued', '{"feature":"storyboard-film","modelId":"kling-3"}', '[]', 'frame-x', ?, ?)`,+ )+ .run(id, Date.now(), Date.now());+ }+ expect(() => joinClips(["paid-a", "paid-b"], { engine: "cloud", feature: "storyboard-film", batchId: "b1", title: "Film" })).toThrow(/Joining clips needs fal\.ai — connect it in Settings/);+ expect(gens.getGeneration("paid-a")!.status).toBe("canceled");+ });++ it("fails a demo-only step that follows real ones, saying what to connect", async () => {+ const clip = saveFile({ data: Buffer.from("not really a video"), contentType: "video/mp4", source: "generation" }).url;+ insertDone("real-clip-1", "fal", [{ url: clip, kind: "video" }]);+ insertDone("real-clip-2", "fal", [{ url: clip, kind: "video" }]);+ const [join] = gens.createGenerations({ feature: "video", modelId: "join-clips", op: "concat", chain: [{ slot: "videos" }, { slot: "videos" }] }, { dependsOn: ["real-clip-1", "real-clip-2"] });+ const done = await settle(join.id, 10_000);+ expect(done.status).toBe("failed");+ expect(done.error).toMatch(/Join clips needs fal\.ai to continue what the earlier steps made for real/);+ });++ it("runs a real step after demo ones as a demo too", async () => {+ // A connected LLM (a stand-in Ollama) would run the step for real…+ const server = http.createServer((req, res) => res.end(JSON.stringify(req.url === "/api/tags" ? { models: [] } : { message: { content: "real" } })));+ await new Promise<void>((r) => server.listen(0, "127.0.0.1", r));+ setSetting("ollamaUrl", `http://127.0.0.1:${(server.address() as { port: number }).port}`);+ await probeOllama(true);+ try {+ insertDone("demo-words", "mock", [{ url: "/api/files/x.txt", kind: "text", text: "demo transcript" }]);+ const [w] = gens.createGenerations({ feature: "dub", modelId: "oss-text-llm", op: "write", prompt: "Summarize: {text}", chain: [{ slot: "prompt" }] }, { dependsOn: "demo-words" });+ const done = await settle(w.id, 15_000);+ // …but its input is a demo placeholder, so it stays a demo.+ expect(done.provider).toBe("mock");+ expect(done.status).toBe("succeeded");+ expect(done.request.prompt).toBe("Summarize: demo transcript");+ } finally {+ server.close();+ setSetting("ollamaUrl", "");+ }+ });+});