comfy-ts 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{LogsSt-CUeo843w.js → LogsSt-Ct7Le0S_.js} +2 -2
- package/dist/{LogsSt-CUeo843w.js.map → LogsSt-Ct7Le0S_.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +268 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +176 -26
- package/dist/index.d.ts +176 -26
- package/dist/index.js +262 -56
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-DUqcn0h3.js → run-serve-C78hD7t9.js} +119 -40
- package/dist/run-serve-C78hD7t9.js.map +1 -0
- package/dist/{run-tui-D-LaSqgB.js → run-tui-nPETFRmk.js} +15 -9
- package/dist/run-tui-nPETFRmk.js.map +1 -0
- package/dist/{schemaDrift-E95iTF7E.js → schemaDrift-wb5XkrHV.js} +218 -27
- package/dist/schemaDrift-wb5XkrHV.js.map +1 -0
- package/dist/serve-web.js +64 -50
- package/dist/{state-BytbdZ8s.js → state-BMW57_M0.js} +45 -35
- package/dist/state-BMW57_M0.js.map +1 -0
- package/dist/web.d.ts +173 -26
- package/dist/web.js +251 -53
- package/dist/web.js.map +1 -1
- package/examples/README.md +1 -0
- package/examples/media/README.md +9 -0
- package/examples/media/sine_440hz_3s.flac +0 -0
- package/examples/media/testsrc_256x256_3s.mp4 +0 -0
- package/examples/media/voice_en_6s.flac +0 -0
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +9 -1
- package/examples/rvion/10-anima-t2i.cflow.ts +8 -1
- package/examples/rvion/14-video-soundtrack.cflow.ts +47 -0
- package/examples/rvion/15-tts-voice-clone.cflow.ts +111 -0
- package/guide-for-agents.md +3 -1
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +115 -32
- package/src/cli/serve/applyVarPayload.ts +5 -3
- package/src/cli/serve/describeVar.ts +5 -3
- package/src/cli/serve/resultHistory.ts +22 -6
- package/src/cli/serve/run-serve.ts +4 -1
- package/src/cli/serve/web/api.ts +4 -0
- package/src/cli/serve/web/components/DraftTabs.tsx +2 -1
- package/src/cli/serve/web/components/Gallery.tsx +86 -5
- package/src/cli/serve/web/components/HistoryPicker.tsx +5 -3
- package/src/cli/serve/web/components/MenuButton.tsx +2 -4
- package/src/cli/serve/web/components/Omnibox.tsx +2 -1
- package/src/cli/serve/web/components/PromptEnhancer.tsx +4 -3
- package/src/cli/serve/web/components/ShortcutsModal.tsx +2 -1
- package/src/cli/serve/web/components/SideMenu.tsx +2 -1
- package/src/cli/serve/web/components/VarsForm.tsx +5 -3
- package/src/cli/serve/web/components/controls/LorasControl.tsx +4 -3
- package/src/cli/serve/web/components/controls/MediaControl.tsx +111 -0
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +2 -1
- package/src/cli/serve/web/components/controls/PromptControl.tsx +2 -1
- package/src/cli/serve/web/components/controls/SizeControl.tsx +2 -1
- package/src/cli/serve/web/state/FormSt.ts +70 -2
- package/src/cli/serve/web/state/escape.ts +16 -0
- package/src/cli/serve/web/state/host.ts +2 -0
- package/src/cli/serve/web/state/mediaDrop.ts +76 -0
- package/src/cli/serve/web/styles.ts +16 -2
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +4 -1
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +15 -6
- package/src/cli/tui/state/TuiSt.ts +1 -1
- package/src/coreExports.ts +20 -1
- package/src/exampleAssets.ts +13 -3
- package/src/host/ComfyUploader.ts +34 -27
- package/src/index.ts +1 -1
- package/src/runner/ComfyExecution.ts +38 -20
- package/src/runner/ComfyWsApi.ts +3 -0
- package/src/runner/mediaKinds.ts +51 -0
- package/src/vars/ComfyVars.ts +178 -34
- package/src/vars/DefinedWorkflow.ts +35 -2
- package/dist/run-serve-DUqcn0h3.js.map +0 -1
- package/dist/run-tui-D-LaSqgB.js.map +0 -1
- package/dist/schemaDrift-E95iTF7E.js.map +0 -1
- package/dist/state-BytbdZ8s.js.map +0 -1
- package/src/cli/serve/web/components/controls/ImageControl.tsx +0 -72
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X as ansi, a as DefinedWorkflow, at as extractErrorMessage, ct as getComfyStorage, dt as logError, ft as logInfo, ht as sha1HexOfString, it as hashArrayBuffer, lt as resolveComfyStorage, mt as statelessRegex, n as diffSchemas, nt as isVideoFilename, ot as isRecord$1, pt as logSuccess, rt as mediaMime, st as bang, t as MODEL_LISTS, ut as isQuiet } from "./schemaDrift-wb5XkrHV.js";
|
|
2
2
|
import { basename, join } from "pathe";
|
|
3
3
|
import { scope, type } from "arktype";
|
|
4
4
|
import { nanoid } from "nanoid";
|
|
@@ -850,7 +850,7 @@ var ComfySchema = class {
|
|
|
850
850
|
};
|
|
851
851
|
//#endregion
|
|
852
852
|
//#region package.json
|
|
853
|
-
var version = "2.
|
|
853
|
+
var version = "2.16.0";
|
|
854
854
|
//#endregion
|
|
855
855
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
856
856
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2344,11 +2344,6 @@ function exhaust(x) {
|
|
|
2344
2344
|
return x;
|
|
2345
2345
|
}
|
|
2346
2346
|
//#endregion
|
|
2347
|
-
//#region src/utils/hashArrayBuffer.ts
|
|
2348
|
-
const hashArrayBuffer = (buffer) => {
|
|
2349
|
-
return sha1Hex(buffer);
|
|
2350
|
-
};
|
|
2351
|
-
//#endregion
|
|
2352
2347
|
//#region src/graph/ComfyNodeID.ts
|
|
2353
2348
|
const ComfyNodeId_ark = type.string.as();
|
|
2354
2349
|
type({
|
|
@@ -2413,6 +2408,8 @@ const types$1 = scope({
|
|
|
2413
2408
|
"previews?": [{ filepath: "string" }, "[]"],
|
|
2414
2409
|
"images?": "ComfyImageInfo[]",
|
|
2415
2410
|
"audio?": "ComfyImageInfo[]",
|
|
2411
|
+
"video?": "ComfyImageInfo[]",
|
|
2412
|
+
"gifs?": "ComfyImageInfo[]",
|
|
2416
2413
|
"text?": "unknown[]"
|
|
2417
2414
|
},
|
|
2418
2415
|
prompt_id: "PromptID"
|
|
@@ -2665,18 +2662,6 @@ var MediaImage = class MediaImage {
|
|
|
2665
2662
|
* A claim is released as soon as the write lands (the file itself then holds
|
|
2666
2663
|
* the name) or fails (the name is free again) — the set never accumulates */
|
|
2667
2664
|
const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
|
|
2668
|
-
const AUDIO_MIMES = {
|
|
2669
|
-
flac: "audio/flac",
|
|
2670
|
-
mp3: "audio/mpeg",
|
|
2671
|
-
opus: "audio/ogg",
|
|
2672
|
-
ogg: "audio/ogg",
|
|
2673
|
-
wav: "audio/wav",
|
|
2674
|
-
m4a: "audio/mp4"
|
|
2675
|
-
};
|
|
2676
|
-
function audioMime(filename) {
|
|
2677
|
-
const ext = filename.split(".").pop()?.toLowerCase() ?? "";
|
|
2678
|
-
return AUDIO_MIMES[ext] ?? "application/octet-stream";
|
|
2679
|
-
}
|
|
2680
2665
|
var ComfyExecution = class {
|
|
2681
2666
|
get host() {
|
|
2682
2667
|
return this.workflow.host;
|
|
@@ -2743,15 +2728,28 @@ var ComfyExecution = class {
|
|
|
2743
2728
|
text: entry
|
|
2744
2729
|
});
|
|
2745
2730
|
}
|
|
2746
|
-
const
|
|
2747
|
-
|
|
2731
|
+
const out = msg.data.output;
|
|
2732
|
+
const listed = [
|
|
2733
|
+
...out?.images ?? [],
|
|
2734
|
+
...out?.video ?? [],
|
|
2735
|
+
...out?.gifs ?? []
|
|
2736
|
+
].filter((f) => f.type !== "input");
|
|
2737
|
+
for (const video of listed.filter((f) => isVideoFilename(f.filename))) this.pendingPromises.push(this.retrieveFile("video", video, promptNodeID).catch((e) => {
|
|
2738
|
+
console.error(`🔴 failed to retrieve ${video.filename}:`, e);
|
|
2739
|
+
this.videoErrors.push({
|
|
2740
|
+
video,
|
|
2741
|
+
error: e
|
|
2742
|
+
});
|
|
2743
|
+
}));
|
|
2744
|
+
const images = listed.filter((f) => !isVideoFilename(f.filename));
|
|
2745
|
+
if (images.length > 0) for (const img of images) this.pendingPromises.push(this.retrieveImage(img, promptNodeID).catch((e) => {
|
|
2748
2746
|
console.error(`🔴 failed to retrieve ${img.filename}:`, e);
|
|
2749
2747
|
this.imageErrors.push({
|
|
2750
2748
|
image: img,
|
|
2751
2749
|
error: e
|
|
2752
2750
|
});
|
|
2753
2751
|
}));
|
|
2754
|
-
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.
|
|
2752
|
+
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.retrieveFile("audio", audio, promptNodeID).catch((e) => {
|
|
2755
2753
|
console.error(`🔴 failed to retrieve ${audio.filename}:`, e);
|
|
2756
2754
|
this.audioErrors.push({
|
|
2757
2755
|
audio,
|
|
@@ -2762,13 +2760,16 @@ var ComfyExecution = class {
|
|
|
2762
2760
|
this.pendingPromises = [];
|
|
2763
2761
|
this.audioErrors = [];
|
|
2764
2762
|
this.audios = [];
|
|
2765
|
-
this.
|
|
2763
|
+
this.videoErrors = [];
|
|
2764
|
+
this.videos = [];
|
|
2765
|
+
this.retrieveFile = async (kind, info, promptNodeID) => {
|
|
2766
2766
|
const response = await this.host.fetchFile("/view?" + new URLSearchParams(info).toString());
|
|
2767
2767
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
2768
|
-
const mime =
|
|
2768
|
+
const mime = mediaMime(info.filename);
|
|
2769
|
+
const list = kind === "audio" ? this.audios : this.videos;
|
|
2769
2770
|
const sf = this.save;
|
|
2770
2771
|
if (sf == null) {
|
|
2771
|
-
|
|
2772
|
+
list.push({
|
|
2772
2773
|
nodeId: promptNodeID,
|
|
2773
2774
|
filename: info.filename,
|
|
2774
2775
|
mime,
|
|
@@ -2788,7 +2789,7 @@ var ComfyExecution = class {
|
|
|
2788
2789
|
subfolder: info.subfolder,
|
|
2789
2790
|
filename: info.filename
|
|
2790
2791
|
});
|
|
2791
|
-
|
|
2792
|
+
list.push({
|
|
2792
2793
|
nodeId: promptNodeID,
|
|
2793
2794
|
filename: info.filename,
|
|
2794
2795
|
mime,
|
|
@@ -2968,6 +2969,7 @@ var ComfyExecution = class {
|
|
|
2968
2969
|
const p = this.progress;
|
|
2969
2970
|
const outputs = [`${this.images.length} image(s)`];
|
|
2970
2971
|
if (this.audios.length > 0) outputs.push(`${this.audios.length} audio(s)`);
|
|
2972
|
+
if (this.videos.length > 0) outputs.push(`${this.videos.length} video(s)`);
|
|
2971
2973
|
if (this.texts.length > 0) outputs.push(`${this.texts.length} text(s)`);
|
|
2972
2974
|
const line = `${this.status === "Failure" ? "🔴" : "🟢"} ${this.status.toLowerCase()} in ${(p.elapsedMs / 1e3).toFixed(1)}s · ${outputs.join(" · ")}`;
|
|
2973
2975
|
if (globalThis.process?.stdout?.isTTY) process.stdout.write(`\r\x1b[2K${line}\n`);
|
|
@@ -3661,15 +3663,23 @@ const ComfyUploadImageResult_ark = type({
|
|
|
3661
3663
|
var ComfyUploader = class {
|
|
3662
3664
|
constructor(host) {
|
|
3663
3665
|
this.host = host;
|
|
3666
|
+
this.uploaded = /* @__PURE__ */ new Set();
|
|
3664
3667
|
this.uploadImage = async (img, p) => {
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3668
|
+
return await this.uploadInput({
|
|
3669
|
+
blob: img.getAsBlob(),
|
|
3670
|
+
name: img.enumName,
|
|
3671
|
+
...p,
|
|
3672
|
+
slot: "LoadImage.image"
|
|
3673
|
+
});
|
|
3674
|
+
};
|
|
3675
|
+
this.uploadInput = async (p) => {
|
|
3676
|
+
const expectedFinalName = p.subfolder ? `${p.subfolder}/${p.name}` : p.name;
|
|
3677
|
+
if (this.uploaded.has(expectedFinalName) || this.host.schema.stringValues(p.slot).includes(expectedFinalName)) {
|
|
3678
|
+
console.log(`[🌁] UPLOAD: 🩶 "${expectedFinalName}" already exists on current ComfyUI instance`);
|
|
3669
3679
|
return expectedFinalName;
|
|
3670
3680
|
}
|
|
3671
3681
|
const form = new FormData();
|
|
3672
|
-
form.set("image",
|
|
3682
|
+
form.set("image", p.blob, p.name);
|
|
3673
3683
|
if (p.type) form.set("type", p.type);
|
|
3674
3684
|
if (p.override ?? true) form.set("override", "true");
|
|
3675
3685
|
if (p.subfolder) form.set("subfolder", p.subfolder);
|
|
@@ -3679,11 +3689,11 @@ var ComfyUploader = class {
|
|
|
3679
3689
|
});
|
|
3680
3690
|
const result = softValidate(ComfyUploadImageResult_ark, await resp.json());
|
|
3681
3691
|
console.log("[🌁] UPLOAD: ✅ got", result);
|
|
3682
|
-
if (result.name == null) throw new Error(
|
|
3692
|
+
if (result.name == null) throw new Error(`upload of '${p.name}' failed: the host answered no name`);
|
|
3683
3693
|
const finalName = result.subfolder ? `${result.subfolder}/${result.name}` : result.name;
|
|
3684
3694
|
if (finalName !== expectedFinalName) console.warn(`[🌁] UPLOAD: ⚠️ expected "${expectedFinalName}" but got "${finalName}"`);
|
|
3685
|
-
|
|
3686
|
-
this.
|
|
3695
|
+
if (p.slot === "LoadImage.image") this.host.schema.unsafely_addImageInSchemaWithoutReloading(finalName);
|
|
3696
|
+
this.uploaded.add(finalName);
|
|
3687
3697
|
return finalName;
|
|
3688
3698
|
};
|
|
3689
3699
|
}
|
|
@@ -5128,4 +5138,4 @@ var ComfyTS = class ComfyTS {
|
|
|
5128
5138
|
//#endregion
|
|
5129
5139
|
export { ComfySchema as a, importSharp as i, settingsPathFor as n, readableStringify as r, ComfyTS as t };
|
|
5130
5140
|
|
|
5131
|
-
//# sourceMappingURL=state-
|
|
5141
|
+
//# sourceMappingURL=state-BMW57_M0.js.map
|