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 free check of a studio skill no longer shows up as a run in its history or use count
Claude739a0c1db0cb
diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.tsindex f3d51154..d39e7687 100644--- a/src/lib/catalog/types.ts+++ b/src/lib/catalog/types.ts@@ -1233,10 +1233,11 @@ export interface GenerationRequest {batchTitle?: string;/*** Server-set: made by a run of a skill's recipe (src/lib/recipe.ts): the skill's name and the run's id (its batch), so- * a run's history can be read back; `step` is the recipe step's key, so a failure is laid at the step that failed.- * Stripped from API input, like chainFilled.+ * a run's history can be read back; `step` is the recipe step's key, so a failure is laid at the step that failed;+ * `check` marks a free dry run's studio rows (they keep their studio's feature, not skill-check), which a skill's+ * history and use leave out as they do skill-check rows. Stripped from API input, like chainFilled.*/- skill?: { name: string; run: string; step?: string };+ skill?: { name: string; run: string; step?: string; check?: true };/*** Server-set: run on the demo provider whatever Settings → Demo mode says (a recipe's free dry run): chooseRoute* returns the demo route, and a waiting step runs as a demo after demo steps even with Demo mode off. Stripped fromdiff --git a/src/server/recipes.ts b/src/server/recipes.tsindex 3bb1abbc..ad4b4b4c 100644--- a/src/server/recipes.ts+++ b/src/server/recipes.ts@@ -1332,7 +1332,10 @@ interface HistoryRow {step: string | null;}-/** The owner's runs of a skill (its stamp in request_json), newest first; a skill's own dry runs don't count. */+/**+ * The owner's runs of a skill (its stamp in request_json), newest first; a skill's own dry runs don't count (a+ * pipeline's rows are skill-check, a studio step's keep their feature and carry skill.check).+ */function historyRows(name: string, limit = 2000): HistoryRow[] {return db().prepare(@@ -1340,7 +1343,8 @@ function historyRows(name: string, limit = 2000): HistoryRow[] {json_extract(g.request_json, '$.modelId') AS model, json_extract(g.request_json, '$.skill.run') AS run,json_extract(g.request_json, '$.skill.step') AS stepFROM generations g- WHERE json_extract(g.request_json, '$.skill.name') = ? AND g.feature != ? AND json_extract(g.request_json, '$.account') IS NULL+ WHERE json_extract(g.request_json, '$.skill.name') = ? AND g.feature != ? AND json_extract(g.request_json, '$.skill.check') IS NULL+ AND json_extract(g.request_json, '$.account') IS NULLORDER BY g.created_at DESC LIMIT ?`,).all(name, SKILL_CHECK_FEATURE, limit) as HistoryRow[];diff --git a/src/server/skill-runs.ts b/src/server/skill-runs.tsindex f5cde219..3530c229 100644--- a/src/server/skill-runs.ts+++ b/src/server/skill-runs.ts@@ -203,8 +203,9 @@ async function startPart(runId: string, skill: string, state: RunState, p: PartSp.studio = card?.studio;if (state.check) p.records = recordsOf(text, card?.href);// The studio's own rows carry the run's stamp, with the step's key (a failure is laid at this step, not at a- // generate step on the same model), and the skill's title, as a pipeline's do.- stampRequests(p.ids, () => ({ skill: { name: skill, run: runId, step }, batchTitle: state.title.slice(0, 200) }));+ // generate step on the same model), and the skill's title, as a pipeline's do. A check's rows say so: they keep+ // their studio's feature, so the skill's history and use tell them from its runs by the stamp.+ stampRequests(p.ids, () => ({ skill: { name: skill, run: runId, step, ...(state.check && { check: true as const }) }, batchTitle: state.title.slice(0, 200) }));p.status = p.ids.length ? "running" : "done";} catch (e) {p.status = "failed";diff --git a/src/server/skill-uses.ts b/src/server/skill-uses.tsindex 1bf809d0..df4b45b7 100644--- a/src/server/skill-uses.ts+++ b/src/server/skill-uses.ts@@ -4,7 +4,8 @@ import { db } from "./db";/*** How each saved skill is used, from the skill stamp on the owner's generations (request_json `skill.name`; a skill's- * own dry runs and an account's runs don't count). Assist ranks its skills index and list_skills by it (rankSkills).+ * own dry runs, skill-check rows or a studio step's rows stamped skill.check, and an account's runs don't count).+ * Assist ranks its skills index and list_skills by it (rankSkills).*/declare global {@@ -18,7 +19,8 @@ export function skillUses(now = Date.now()): Map<string, SkillUse> {const rows = db().prepare(`SELECT json_extract(request_json, '$.skill.name') AS name, COUNT(DISTINCT COALESCE(json_extract(request_json, '$.skill.run'), batch_id, id)) AS runs, MAX(created_at) AS last- FROM generations WHERE json_extract(request_json, '$.skill.name') IS NOT NULL AND feature != ? AND json_extract(request_json, '$.account') IS NULL+ FROM generations WHERE json_extract(request_json, '$.skill.name') IS NOT NULL AND feature != ? AND json_extract(request_json, '$.skill.check') IS NULL+ AND json_extract(request_json, '$.account') IS NULLGROUP BY name`,).all(SKILL_CHECK_FEATURE) as { name: string; runs: number; last: number }[];diff --git a/tests/skill-runs.test.ts b/tests/skill-runs.test.tsindex fb0f5553..d142fce9 100644--- a/tests/skill-runs.test.ts+++ b/tests/skill-runs.test.ts@@ -23,6 +23,7 @@ const { executeTool } = await import("@/server/assist/tools");const { inDemoScope, outsideDemo, runAsDemo } = await import("@/server/demo-scope");const { llmText } = await import("@/server/enhance");const lib = await import("@/lib/recipe");+const uses = await import("@/server/skill-uses");const runsRoute = await import("@/app/api/assist/skills/[name]/runs/route");afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));@@ -276,11 +277,28 @@ describe("the studio dry run", () => {expect(live.n).toBe(0);const made = db().prepare("SELECT COUNT(*) AS n FROM generations WHERE json_extract(request_json, '$.skill.name') = 'spanish-check'").get() as { n: number };expect(made.n).toBeGreaterThanOrEqual(3);+ // Its studio steps' rows keep their studio's feature, so they say they're a check: not a run in the skill's+ // history (W6) or in its use count (Assist's ranking).+ expect(recipes.skillHistory("spanish-check")).toMatchObject({ runs: 0, lastRun: null, recent: [] });+ uses.forgetSkillUses();+ expect(uses.skillUses().has("spanish-check")).toBe(false);} finally {setSetting("demoMode", "auto");}});+ it("checks a one-studio skill for free without the check counting as one of its runs", async () => {+ makeSkill("captions-check", { fuobeRecipe: 1, params: [{ id: "video", label: "Clip", type: "video", required: true, example: clip }], steps: [{ key: "captions", kind: "tool", tool: "add_captions", input: { video: "{{video}}" } }] }, "Captions");+ const check = await recipes.verifyRecipe("captions-check", "demo", "cloud");+ expect(check.engines[0].dryRun).toEqual({ ok: true, problems: [] });+ const rows = db().prepare("SELECT feature, json_extract(request_json, '$.skill.check') AS checked FROM generations WHERE json_extract(request_json, '$.skill.name') = 'captions-check'").all() as { feature: string; checked: number }[];+ expect(rows.length).toBeGreaterThan(0);+ expect(rows.every((r) => r.feature !== lib.SKILL_CHECK_FEATURE && r.checked === 1)).toBe(true);+ expect(recipes.skillHistory("captions-check")).toMatchObject({ runs: 0, lastRun: null, recent: [] });+ uses.forgetSkillUses();+ expect(uses.skillUses().has("captions-check")).toBe(false);+ });+it("checks a Faceless episode by its plan only: it goes on in Faceless Studio's own steps after its result", async () => {const scenes = Array.from({ length: 3 }, (_, i) => ({ narration: `Line ${i}`, visual: `Scene ${i}` }));makeSkill("faceless-check", { fuobeRecipe: 2, params: [], steps: [{ key: "ep", kind: "tool", tool: "faceless_episode", input: { scenes, style: "flat 2D" } }] }, "Episode");