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
Skills: a skill's dialog shows each run that spans studios, step by step, with Open in the studio
Claudee76624db43ad
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 2e0e4bd7..091ba26c 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -459,6 +459,7 @@ Round 5 part 1 (Work2Skill W1 and W2; plan in `docs/research/work2skill-7.md`).- **Runs on the server** (`src/server/recipes.ts`; routes under `src/app/api/assist/skills/[name]/` with `src/server/recipe-routes.ts`). `compileRun` sends every filled request through the API's own `GenerationRequestSchema` and puts a dual-engine Original on the run's engine. Fuobe never moves a step to the other engine: `recipeEngines` is the engines every step allows under Settings → Engine mode. `estimateRecipe` prices one run or many with `planSteps` / `planFor`, as Assist's approval card does. `runRecipe` starts one `createPipeline` per row, or one `executeTool` call per row whose rows `stampRequests` (`generations.ts`) stamps afterwards. A run is refused with 409 until the plan check has passed on that engine, or while the skill is switched off; a CSV with a header and no rows is a 422.- **Checks** (`verifyRecipe`, `POST …/verify`). `plan`: each step planned and priced as it would start; when every refusal is only a provider to connect (`onlyConnect`: messages that start "Connect"), the same run on the demo route stands in, with a note. `demo` (the default): the plan check, then a free dry run on the mock provider whatever Settings → Demo mode says (`request.demo`; at most 120 s per engine; small stand-in files for media inputs with no example), whose hidden rows go to the Trash; a Run doesn't wait for it. `real` (API only, needs `confirm: true`, holds the request up to 15 minutes): the examples on the user's keys, outputs checked by their structure (`probeMedia`) and the look judged only by a model that sees images (`llmSeesImages`; on the GPU only Ollama, never paid Claude). Tool steps get the plan check only. `needsRecheck` asks for a check again when a step's model was retired (`REPLACED_BY`) or switched off, or the plan hash changed. A check that finds the recipe changed while it ran refuses with 409 and keeps the edit. An uploaded `recipe.json` loses its `verified` dates, and the .zip download (`?format=zip`) never carries this install's checks; examples and source stay out unless `&examples=1`.- **Making a skill from results** (W2; `src/server/recipe-builder.ts`, `src/lib/recipe-builder.ts`, `src/components/skills/*`). `draftFromGenerations` walks the picked results back through `depends_on` and chain slots to the exact requests that made them. Results handed on by hand in the composer (Edit, Animate) are linked by matching file URLs (`linkByFile`); a stack that ran as one job per result becomes one step (`jobsOf`); an expansion comes back as the request it was asked as (`GenerationRequest.asked`; older ones are told apart by step labels and refused with `STEPS_REFUSAL`); a retired model moves to its replacement (`currentRequest`); and Translate & dub, Katana and Captions are lifted to their Assist tools (`dub_video`, `katana`, `add_captions`). Other studios that plan their own steps are refused by name (`STUDIOS`, `notSupported`). Every input starts Fixed. The review screen marks what varies (media, @elements, whole prompts, words picked in a prompt, and the takes, shape, length and quality), and `buildRecipe` and `skillBody` write the recipe and SKILL.md live. `POST /api/assist/skills/draft` returns the draft and the refusals; `/draft/check` runs the plan check and the dry run on an unsaved recipe (kept in memory by recipe hash, `draftKey`: 200 entries for 6 hours, so a restart loses a passed dry run); `/draft/name` is an optional naming pass by Claude or Ollama; `/draft/save` checks the plan again and saves, with 409 for a taken name and 422 for a failing plan. "draft" is a reserved skill name; a user skill already called that would have its GET, PATCH and DELETE routes shadowed by the POST-only draft route (read from the routing, not tested, and nothing renames it). A skill made from demo results says so in its Run form (`DEMO_NOTE`, `source.demo`) until a real test passes.+- **Skills that span studios** (W7; `src/server/skill-runs.ts`, `src/server/demo-scope.ts`). Recipe version 2 (`fuobeRecipe: 2`; version 1 files still load and run as before) puts `{{steps.<key>.output}}` in a step's input: the whole field takes that earlier step's first output of the kind the field takes (`fieldKind`; a studio tool's output kind is `TOOL_MAKES`), and tool steps may sit anywhere in the order. `recipeProblems` checks that each reference points at an earlier step of a kind that fits, that a step's output fills a whole field, that a generate step doesn't wait (`after`) for a studio step, that a dub feeding a later step dubs in one go (`review: false`), and that no parts wait for each other. Such a recipe compiles to `staged` parts (`recipeParts`): each graph of generate steps joined by `after` is one `createPipeline`, each tool step one `executeTool` call. `runRecipe` starts a `skill_runs` row per run (`startSkillRun`) and every part whose inputs exist; `advanceSkillRun` settles running parts, fails the parts that wait for a failure ("Didn't start: Dub failed", the run saying which step failed and why), and starts each waiting part with its references filled from the finished steps (`fillRefs`). A 10 s sweep started with the generation runner (`ensureSkillRunSweep`, `src/instrumentation.ts`) advances every running run, so a run carries on after a restart. `createPipeline`'s `existing` option is not used: every later step waits for the sweep. A run's result names its `run` and the steps that `wait`; `run_skill` tells the agent so, the CLI's `--wait` follows `GET /api/assist/skills/[name]/runs`, and the skill's dialog shows each run as "Dub · done → Captions · running → 9:16 cut · waiting" with "Open in <Studio>" (`components/assist/skill-runs.tsx`). Plans price each part with stand-ins for references (a studio that keeps a clip's length is priced on the clip it takes). Studio dry runs: inside `runAsDemo` (an `AsyncLocalStorage` scope) `chooseRoute` returns the demo route and `createGenerations` stamps `request.demo`, so a studio module runs as a free demo with no change to its code; the check (also for a single tool step now) then trashes what it made and deletes the studio records it opened (a dub, a Layers project, a Shorts session, a Faceless episode, Katana jobs naming its results). Save as skill (`draftFromThread`) writes a chat's result handed into or out of a studio call as a step reference (`linkStudios`) instead of refusing it; the Library builder still makes one studio step per skill. The routes are the owner's: guests and accounts are refused by the proxy like the rest of Assist.- **UI.** A recipe skill's card on the Skills page shows "Runs by itself", and its dialog shows where it was checked or why it needs a re-check (`skills-view.tsx`). The Run form (`run-skill-dialog.tsx`, `/assist/skills?run=<name>`) builds its fields from the inputs, offers only engines whose check passed, prices live, lists the steps (`plan-jobs.tsx`) and has a Many tab for CSV rows. ⌘K lists "Run <skill>…" (`skillEntries` in `src/lib/command-search.ts`). "Make a skill from this…" is in every finished result's ⋯ menu and "Make a skill" in the Library's selection bar; `SkillBuilderProvider` wraps `StudioChrome` (`app-sidebar.tsx`), so the viewer opened from ⌘K or a job notification has it too, and loads the review screen on first open.- **Checked** in demo mode only: unit and API tests (`recipe`, `recipes`, `recipe-builder`) with Demo mode off and no keys, and the browser checks `skills-run` and `skills-builder`. No skill has run with a paid key or on a GPU, the naming pass and look judging have not met a live Claude or Ollama vision model, the three lifts are tested as drafts only, and the real check level has no button. The text agents read (the "Run it" section, a built skill's SKILL.md) mentions a `run_skill` MCP tool that comes with W3 and doesn't exist yet.@@ -514,6 +515,7 @@ SQLite (WAL). Migrations are an append-only list in `db.ts`, applied once each a| 23 | main's GPU pre-flight: `gpu_snapshots` (what a ComfyUI had at its last check, per target, the install or an account's own GPU, and per way it was read; only the facts the requirement index asks about), `gpu_audit` (every check) with index `gpu_audit_target`, and `generations.fix_json` (what a failed run was missing, so its tile offers "Fix it") || 24 | main's public sign-up: `assets.account_id` (an account's uploads and the files of its runs carry its id, the owner's stay NULL; files made before go by the run that made them) and indexes `assets_account`, `assets_rel` and `assets_generation` || 26 | `assist_schedules.skill_json` (Skills W4: a task that runs a saved skill instead of a request, `{ name, values, sources }`: one set of the recipe's inputs as text, a file as its `/api/files/…` URL, and the file inputs that take the newest upload of their kind when the run starts; NULL for a request). It only adds a column, so an older build can still open the database; the column is in `ASSET_REFS`, so a file a task names survives Empty trash |+| 27 | `skill_runs` (Skills W7: a run of a skill that spans studios: `id`, `skill`, `status` (running, done or failed, indexed for the sweep), `values_json` (the values it runs with) and `state_json` (each part's status, generation ids, studio page and failure), `created_at`, `updated_at`; index `skill_runs_skill`). It only adds a table, so an older build can still open the database; `values_json` and `state_json` are in `ASSET_REFS`, so a file a run names survives Empty trash. The integrator renumbers it if another migration lands first |Round 4 part 3 adds no migration. It changes what some existing columns hold: `canvases.graph_json` is written as `{pages: [{id, name, graph}]}` and a row saved before reads as page 1 (`readPages`) until it is saved again (an older build can't read a board after that save); `runs_json`'s node runs gain `out`, `rows` and `rowSigs`; `generations.request_json` keeps the engine a Fuobe Original ran on; and output meta gains `finished`, `original`, `grade`, `overlay` and `crop`, with `meta.formats` and `meta.preview` now stored as local files.diff --git a/src/components/assist/run-skill-dialog.tsx b/src/components/assist/run-skill-dialog.tsxindex 073a9aa9..9b47427a 100644--- a/src/components/assist/run-skill-dialog.tsx+++ b/src/components/assist/run-skill-dialog.tsx@@ -172,6 +172,17 @@ function Loaded({ view, onClose, examples, intro }: { view: RecipeView; onClose:const r = await actions.run(name, JSON.parse(key) as typeof body);const started = r.runs.filter((x) => !x.error);const failed = r.runs.filter((x) => x.error);+ // A skill that spans studios: its later steps start by themselves; the toast opens the run's progress.+ const waiting = [...new Set(started.flatMap((x) => x.waiting ?? []))];+ if (started.some((x) => x.run)) {+ const title = failed.length ? `Started ${started.length} of ${r.runs.length} runs` : started.length > 1 ? `Started ${started.length} runs` : "Started the run";+ (failed.length ? toast.warning : toast.success)(title, {+ description: failed.length ? failed[0].error : `${waiting.length ? `${waiting.join(", ")} start${waiting.length === 1 ? "s" : ""} by ${waiting.length === 1 ? "itself" : "themselves"} when the step before is done.` : `${view.title}: same steps, new take.`}${r.demo ? " A demo run — no provider connected." : ""}`,+ action: { label: "See progress", onClick: () => router.push(`/assist/skills?skill=${encodeURIComponent(name)}`) },+ });+ onClose();+ return;+ }const href = started[0]?.href ?? "/library";const studio = href.startsWith("/library") ? "Library" : href.startsWith("/video-tools/captions") ? "Captions" : "the studio";const title = failed.length ? `Started ${started.length} of ${r.runs.length} runs` : started.length > 1 ? `Started ${started.length} runs` : "Started the run";diff --git a/src/components/assist/skill-runs.tsx b/src/components/assist/skill-runs.tsxnew file mode 100644index 00000000..f1eed4f9--- /dev/null+++ b/src/components/assist/skill-runs.tsx@@ -0,0 +1,89 @@+"use client";++import { useQuery } from "@tanstack/react-query";+import { ArrowRight, Check, Clock, ExternalLink, Loader2, X } from "lucide-react";+import Link from "next/link";+import { useHydrated } from "@/lib/api";+import type { SkillRunStep, SkillRunView } from "@/lib/recipe";+import { cn } from "@/lib/utils";++/**+ * A skill's runs that span studios (recipe version 2, package W7), in its dialog: "Dub · done → Captions · running →+ * 9:16 cut · waiting", each step with "Open in <Studio>" when its studio gave a page. Polls while a run is going.+ */+export function SkillRuns({ name }: { name: string }) {+ const hydrated = useHydrated();+ const runs = useQuery({+ queryKey: ["assist-skill-runs", name],+ enabled: hydrated,+ retry: false,+ queryFn: async () => {+ const res = await fetch(`/api/assist/skills/${encodeURIComponent(name)}/runs`);+ // A visitor (or a skill that's gone) has no runs to show.+ if (!res.ok) return [];+ return ((await res.json()) as { items: SkillRunView[] }).items;+ },+ refetchInterval: (q) => (q.state.data?.some((r) => r.status === "running") ? 3000 : false),+ });+ const items = runs.data ?? [];+ if (!items.length) return null;+ return (+ <section className="mb-4" aria-label="Runs">+ <p className="text-[12px] font-medium">Runs</p>+ <ul className="mt-1.5 space-y-2">+ {items.map((r) => (+ <RunRow key={r.id} run={r} />+ ))}+ </ul>+ </section>+ );+}++const RUN_WORDS: Record<SkillRunView["status"], string> = { running: "Running", done: "Done", failed: "Stopped" };+const STEP_WORDS: Record<SkillRunStep["status"], string> = { waiting: "waiting", running: "running", done: "done", failed: "failed" };++function RunRow({ run }: { run: SkillRunView }) {+ const when = new Date(run.createdAt).toLocaleString(undefined, { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" });+ return (+ <li className="rounded-xl border px-3 py-2.5">+ <div className="flex items-center justify-between gap-2 text-[12px] text-muted-foreground">+ <span>{when}</span>+ <span+ className={cn(+ "inline-flex h-5 items-center rounded-full px-2 font-medium",+ run.status === "done" && "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",+ run.status === "running" && "bg-brand-faint text-brand-text",+ run.status === "failed" && "bg-destructive/10 text-destructive",+ )}+ >+ {RUN_WORDS[run.status]}+ </span>+ </div>+ <ol className="mt-2 flex flex-wrap items-center gap-x-1.5 gap-y-2 text-[13px]">+ {run.steps.map((s, i) => (+ <li key={s.key} className="flex min-w-0 max-w-full flex-wrap items-center gap-x-1.5 gap-y-1">+ {i > 0 && <ArrowRight className="size-3.5 shrink-0 text-muted-foreground" aria-hidden />}+ <span className={cn("inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1", s.status === "failed" && "bg-destructive/10")}>+ <StepIcon status={s.status} />+ <span className="truncate">{s.label}</span>+ <span className="shrink-0 text-muted-foreground">· {STEP_WORDS[s.status]}</span>+ </span>+ {s.href && s.studio && (+ <Link href={s.href} className="inline-flex items-center gap-1 text-[12px] text-brand-text underline underline-offset-2">+ Open in {s.studio} <ExternalLink className="size-3" aria-hidden />+ </Link>+ )}+ </li>+ ))}+ </ol>+ {run.error && <p className="mt-2 text-[12px] break-words text-destructive">{run.error}</p>}+ </li>+ );+}++function StepIcon({ status }: { status: SkillRunStep["status"] }) {+ if (status === "done") return <Check className="size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" aria-hidden />;+ if (status === "running") return <Loader2 className="size-3.5 shrink-0 animate-spin text-brand-text" aria-hidden />;+ if (status === "failed") return <X className="size-3.5 shrink-0 text-destructive" aria-hidden />;+ return <Clock className="size-3.5 shrink-0 text-muted-foreground" aria-hidden />;+}diff --git a/src/components/assist/skills-view.tsx b/src/components/assist/skills-view.tsxindex 3d24848c..97156d30 100644--- a/src/components/assist/skills-view.tsx+++ b/src/components/assist/skills-view.tsx@@ -35,6 +35,7 @@ import { refusalShown, toastError } from "@/lib/refusals";import { radioKeys } from "@/components/studio/radio-keys";import { useRecipe, useRecipeActions, useSkill, useSkillActions, useSkills, type RecipeFailure, type SkillForm } from "./hooks";import { RunSkillDialog } from "./run-skill-dialog";+import { SkillRuns } from "./skill-runs";import { RailButton } from "./shell";import { SKILL_ICONS, SkillIcon } from "./skill-icon";import { AssistVisitorNote } from "./visitor-note";@@ -358,6 +359,7 @@ function SkillDetail({ name, owner, onClose, onEdit, onRun }: { name: string | n</div></DialogHeader><div className="min-h-0 flex-1 overflow-y-auto px-5 py-4">+ {owner && s.recipe && <SkillRuns name={s.name} />}{s.whenToUse && (<div className="mb-4 rounded-xl bg-muted/60 px-4 py-3 text-[13px]"><p className="font-medium">When Assist uses it</p>diff --git a/src/server/assist/skill-tools.ts b/src/server/assist/skill-tools.tsindex 77c5c87f..f3975c92 100644--- a/src/server/assist/skill-tools.ts+++ b/src/server/assist/skill-tools.ts@@ -150,13 +150,25 @@ async function runFound(input: RunSkill, ctx: ToolContext, found: { recipe: Reciconst out = await runRecipe(found.name, body, asked);const ids = out.runs.flatMap((r) => r.ids);const href = out.runs.find((r) => r.href && r.href !== "/library")?.href;+ const waiting = [...new Set(out.runs.flatMap((r) => r.waiting ?? []))];return {content: JSON.stringify({skill: found.name,engine: out.engine,- runs: out.runs.map((r) => ({ started: r.ids, ...(r.batchId && { batch: r.batchId }), ...(r.href && { href: r.href }), ...(r.error && { error: r.error }) })),+ runs: out.runs.map((r) => ({+ started: r.ids,+ ...(r.run && { run: r.run }),+ ...(r.waiting?.length && { waiting: r.waiting }),+ ...(r.batchId && { batch: r.batchId }),+ ...(r.href && { href: r.href }),+ ...(r.error && { error: r.error }),+ })),...(out.demo && { demo: true }),- note: href ? "The skill's studio job opens at href; its results appear there and in the Library." : "Each run's steps start by themselves as the ones they wait for finish; results appear in the Library.",+ note: waiting.length+ ? `It spans studios: the first step has started, and ${waiting.join(", ")} start${waiting.length === 1 ? "s" : ""} by ${waiting.length === 1 ? "itself" : "themselves"} when the steps before finish (minutes, not seconds). Tell the user it's running and that its progress is under the skill in Skills; don't start the waiting steps yourself.`+ : href+ ? "The skill's studio job opens at href; its results appear there and in the Library."+ : "Each run's steps start by themselves as the ones they wait for finish; results appear in the Library.",}),items: ids.length ? [{ id: "", role: "generations", ids }] : undefined,};diff --git a/tests/public-signup.test.ts b/tests/public-signup.test.tsindex ad74b5b1..c0514278 100644--- a/tests/public-signup.test.ts+++ b/tests/public-signup.test.ts@@ -127,7 +127,7 @@ describe("proxy with public sign-up on", () => {const list = proxy(req("/api/generations?limit=40"));expect(list.status).toBe(200);expect(await list.json()).toEqual({ items: [] });- for (const p of ["/api/files/outputs/a.png", "/api/settings", "/api/auth/tokens", "/api/generations/abc", "/api/layers/abc", "/api/uploads", "/api/assist/t1"]) {+ for (const p of ["/api/files/outputs/a.png", "/api/settings", "/api/auth/tokens", "/api/generations/abc", "/api/layers/abc", "/api/uploads", "/api/assist/t1", "/api/assist/skills/s1/runs"]) {const r = proxy(req(p));expect(r.status, p).toBe(401);expect(r.headers.get(access.GUEST_HEADER), p).toBe("1");@@ -289,8 +289,9 @@ describe("accounts never see or change the owner's library", () => {storyboards: { lists: [], records: ["/api/storyboards"], changes: [["POST", "/api/storyboards"]] },assist: {lists: ["/api/assist/projects", "/api/assist/memory"],- records: ["/api/assist/t1", "/api/assist/projects/p1"],- changes: [["PATCH", "/api/assist/t1"], ["DELETE", "/api/assist/t1"], ["POST", "/api/assist/projects"], ["POST", "/api/assist/memory"]],+ // A skill's runs that span studios (W7) are the owner's, and so is running a skill.+ records: ["/api/assist/t1", "/api/assist/projects/p1", "/api/assist/skills/s1/runs"],+ changes: [["PATCH", "/api/assist/t1"], ["DELETE", "/api/assist/t1"], ["POST", "/api/assist/projects"], ["POST", "/api/assist/memory"], ["POST", "/api/assist/skills/s1/run"]],},brands: { lists: ["/api/brands", "/api/products"], records: ["/api/brands/b1"], changes: [["POST", "/api/brands"], ["DELETE", "/api/brands/b1"], ["POST", "/api/products"]] },};diff --git a/tests/skill-runs.test.ts b/tests/skill-runs.test.tsindex 6a422755..46fe506b 100644--- a/tests/skill-runs.test.ts+++ b/tests/skill-runs.test.ts@@ -152,6 +152,15 @@ describe("a skill that spans studios, in demo mode", () => {expect(lib.runLine(done.steps)).toBe("Dub · done → Captions · done → 9:16 cut · done");});+ it("run_skill's result names the run and says which steps wait, so the agent doesn't start them itself", async () => {+ const out = await executeTool("run_skill", { name: "spanish-short", values: { video: clip } }, { engine: "cloud" });+ expect(out.isError).toBeFalsy();+ const body = JSON.parse(out.content as string) as { runs: { run: string; waiting: string[]; href: string }[]; note: string };+ expect(body.runs[0]).toMatchObject({ run: expect.any(String), waiting: ["Captions", "9:16 cut"], href: expect.stringContaining("dub=") });+ expect(body.note).toMatch(/Captions, 9:16 cut start by themselves when the steps before finish/);+ expect((await finish(body.runs[0].run)).status).toBe("done");+ });+it("a failed dub fails the steps after it, and says which step failed and why", async () => {const out = await recipes.runRecipe("spanish-short", { values: { video: clip } }, "cloud");const id = out.runs[0].run!;