comfy-ts 2.14.0 → 2.15.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-C3UIWR-o.js} +2 -2
- package/dist/{LogsSt-CUeo843w.js.map → LogsSt-C3UIWR-o.js.map} +1 -1
- package/dist/cli.js +4 -4
- package/dist/index.cjs +213 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +123 -21
- package/dist/index.d.ts +123 -21
- package/dist/index.js +207 -54
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-DUqcn0h3.js → run-serve-B5PfIuhK.js} +108 -38
- package/dist/run-serve-B5PfIuhK.js.map +1 -0
- package/dist/{run-tui-D-LaSqgB.js → run-tui-D-N4_yyX.js} +15 -9
- package/dist/run-tui-D-N4_yyX.js.map +1 -0
- package/dist/{schemaDrift-E95iTF7E.js → schemaDrift-BkN8rLiZ.js} +163 -25
- package/dist/schemaDrift-BkN8rLiZ.js.map +1 -0
- package/dist/serve-web.js +62 -48
- package/dist/{state-BytbdZ8s.js → state-CZsYJqB6.js} +45 -35
- package/dist/state-CZsYJqB6.js.map +1 -0
- package/dist/web.d.ts +120 -21
- package/dist/web.js +196 -51
- package/dist/web.js.map +1 -1
- package/examples/media/README.md +8 -0
- package/examples/media/sine_440hz_3s.flac +0 -0
- package/examples/media/testsrc_256x256_3s.mp4 +0 -0
- package/examples/rvion/14-video-soundtrack.cflow.ts +47 -0
- package/guide-for-agents.md +2 -1
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +101 -30
- 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/Gallery.tsx +84 -4
- package/src/cli/serve/web/components/VarsForm.tsx +5 -3
- package/src/cli/serve/web/components/controls/MediaControl.tsx +111 -0
- package/src/cli/serve/web/state/FormSt.ts +70 -2
- 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 +10 -0
- 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 +96 -22
- 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
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ function createNodeStorage() {
|
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region package.json
|
|
113
|
-
var version = "2.
|
|
113
|
+
var version = "2.15.0";
|
|
114
114
|
//#endregion
|
|
115
115
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
116
116
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -2017,6 +2017,8 @@ const types$1 = scope({
|
|
|
2017
2017
|
"previews?": [{ filepath: "string" }, "[]"],
|
|
2018
2018
|
"images?": "ComfyImageInfo[]",
|
|
2019
2019
|
"audio?": "ComfyImageInfo[]",
|
|
2020
|
+
"video?": "ComfyImageInfo[]",
|
|
2021
|
+
"gifs?": "ComfyImageInfo[]",
|
|
2020
2022
|
"text?": "unknown[]"
|
|
2021
2023
|
},
|
|
2022
2024
|
prompt_id: "PromptID"
|
|
@@ -2263,24 +2265,79 @@ var MediaImage = class MediaImage {
|
|
|
2263
2265
|
}
|
|
2264
2266
|
};
|
|
2265
2267
|
//#endregion
|
|
2266
|
-
//#region src/runner/
|
|
2267
|
-
/**
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2268
|
+
//#region src/runner/mediaKinds.ts
|
|
2269
|
+
/** picker defaults per kind, lowercase without dots */
|
|
2270
|
+
const DEFAULT_MEDIA_EXTENSIONS = {
|
|
2271
|
+
image: [
|
|
2272
|
+
"png",
|
|
2273
|
+
"jpg",
|
|
2274
|
+
"jpeg",
|
|
2275
|
+
"webp",
|
|
2276
|
+
"gif"
|
|
2277
|
+
],
|
|
2278
|
+
audio: [
|
|
2279
|
+
"wav",
|
|
2280
|
+
"flac",
|
|
2281
|
+
"mp3",
|
|
2282
|
+
"ogg",
|
|
2283
|
+
"opus",
|
|
2284
|
+
"m4a"
|
|
2285
|
+
],
|
|
2286
|
+
video: [
|
|
2287
|
+
"mp4",
|
|
2288
|
+
"webm",
|
|
2289
|
+
"mov",
|
|
2290
|
+
"mkv",
|
|
2291
|
+
"m4v"
|
|
2292
|
+
]
|
|
2293
|
+
};
|
|
2294
|
+
const MIMES = {
|
|
2295
|
+
png: "image/png",
|
|
2296
|
+
jpg: "image/jpeg",
|
|
2297
|
+
jpeg: "image/jpeg",
|
|
2298
|
+
webp: "image/webp",
|
|
2299
|
+
gif: "image/gif",
|
|
2273
2300
|
flac: "audio/flac",
|
|
2274
2301
|
mp3: "audio/mpeg",
|
|
2275
2302
|
opus: "audio/ogg",
|
|
2276
2303
|
ogg: "audio/ogg",
|
|
2277
2304
|
wav: "audio/wav",
|
|
2278
|
-
m4a: "audio/mp4"
|
|
2305
|
+
m4a: "audio/mp4",
|
|
2306
|
+
aac: "audio/aac",
|
|
2307
|
+
mp4: "video/mp4",
|
|
2308
|
+
m4v: "video/mp4",
|
|
2309
|
+
webm: "video/webm",
|
|
2310
|
+
mov: "video/quicktime",
|
|
2311
|
+
mkv: "video/x-matroska",
|
|
2312
|
+
avi: "video/x-msvideo"
|
|
2279
2313
|
};
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2314
|
+
/** video containers an output node can name. An animated webp or gif is an IMAGE: the
|
|
2315
|
+
* extension decides, never the `animated` flag */
|
|
2316
|
+
const VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2317
|
+
"mp4",
|
|
2318
|
+
"m4v",
|
|
2319
|
+
"webm",
|
|
2320
|
+
"mov",
|
|
2321
|
+
"mkv",
|
|
2322
|
+
"avi"
|
|
2323
|
+
]);
|
|
2324
|
+
function extensionOf(filename) {
|
|
2325
|
+
const dot = filename.lastIndexOf(".");
|
|
2326
|
+
return dot < 0 ? "" : filename.slice(dot + 1).toLowerCase();
|
|
2327
|
+
}
|
|
2328
|
+
function isVideoFilename(filename) {
|
|
2329
|
+
return VIDEO_EXTENSIONS.has(extensionOf(filename));
|
|
2283
2330
|
}
|
|
2331
|
+
function mediaMime(filename) {
|
|
2332
|
+
return MIMES[extensionOf(filename)] ?? "application/octet-stream";
|
|
2333
|
+
}
|
|
2334
|
+
//#endregion
|
|
2335
|
+
//#region src/runner/ComfyExecution.ts
|
|
2336
|
+
/** paths claimed by in-flight retrievals: two same-second runs on a
|
|
2337
|
+
* counter-resetting cloud host compute the same name before either writes.
|
|
2338
|
+
* A claim is released as soon as the write lands (the file itself then holds
|
|
2339
|
+
* the name) or fails (the name is free again) — the set never accumulates */
|
|
2340
|
+
const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
|
|
2284
2341
|
var ComfyExecution = class {
|
|
2285
2342
|
get host() {
|
|
2286
2343
|
return this.workflow.host;
|
|
@@ -2347,15 +2404,28 @@ var ComfyExecution = class {
|
|
|
2347
2404
|
text: entry
|
|
2348
2405
|
});
|
|
2349
2406
|
}
|
|
2350
|
-
const
|
|
2351
|
-
|
|
2407
|
+
const out = msg.data.output;
|
|
2408
|
+
const listed = [
|
|
2409
|
+
...out?.images ?? [],
|
|
2410
|
+
...out?.video ?? [],
|
|
2411
|
+
...out?.gifs ?? []
|
|
2412
|
+
].filter((f) => f.type !== "input");
|
|
2413
|
+
for (const video of listed.filter((f) => isVideoFilename(f.filename))) this.pendingPromises.push(this.retrieveFile("video", video, promptNodeID).catch((e) => {
|
|
2414
|
+
console.error(`🔴 failed to retrieve ${video.filename}:`, e);
|
|
2415
|
+
this.videoErrors.push({
|
|
2416
|
+
video,
|
|
2417
|
+
error: e
|
|
2418
|
+
});
|
|
2419
|
+
}));
|
|
2420
|
+
const images = listed.filter((f) => !isVideoFilename(f.filename));
|
|
2421
|
+
if (images.length > 0) for (const img of images) this.pendingPromises.push(this.retrieveImage(img, promptNodeID).catch((e) => {
|
|
2352
2422
|
console.error(`🔴 failed to retrieve ${img.filename}:`, e);
|
|
2353
2423
|
this.imageErrors.push({
|
|
2354
2424
|
image: img,
|
|
2355
2425
|
error: e
|
|
2356
2426
|
});
|
|
2357
2427
|
}));
|
|
2358
|
-
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.
|
|
2428
|
+
for (const audio of msg.data.output?.audio ?? []) this.pendingPromises.push(this.retrieveFile("audio", audio, promptNodeID).catch((e) => {
|
|
2359
2429
|
console.error(`🔴 failed to retrieve ${audio.filename}:`, e);
|
|
2360
2430
|
this.audioErrors.push({
|
|
2361
2431
|
audio,
|
|
@@ -2366,13 +2436,16 @@ var ComfyExecution = class {
|
|
|
2366
2436
|
this.pendingPromises = [];
|
|
2367
2437
|
this.audioErrors = [];
|
|
2368
2438
|
this.audios = [];
|
|
2369
|
-
this.
|
|
2439
|
+
this.videoErrors = [];
|
|
2440
|
+
this.videos = [];
|
|
2441
|
+
this.retrieveFile = async (kind, info, promptNodeID) => {
|
|
2370
2442
|
const response = await this.host.fetchFile("/view?" + new URLSearchParams(info).toString());
|
|
2371
2443
|
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
2372
|
-
const mime =
|
|
2444
|
+
const mime = mediaMime(info.filename);
|
|
2445
|
+
const list = kind === "audio" ? this.audios : this.videos;
|
|
2373
2446
|
const sf = this.save;
|
|
2374
2447
|
if (sf == null) {
|
|
2375
|
-
|
|
2448
|
+
list.push({
|
|
2376
2449
|
nodeId: promptNodeID,
|
|
2377
2450
|
filename: info.filename,
|
|
2378
2451
|
mime,
|
|
@@ -2392,7 +2465,7 @@ var ComfyExecution = class {
|
|
|
2392
2465
|
subfolder: info.subfolder,
|
|
2393
2466
|
filename: info.filename
|
|
2394
2467
|
});
|
|
2395
|
-
|
|
2468
|
+
list.push({
|
|
2396
2469
|
nodeId: promptNodeID,
|
|
2397
2470
|
filename: info.filename,
|
|
2398
2471
|
mime,
|
|
@@ -2572,6 +2645,7 @@ var ComfyExecution = class {
|
|
|
2572
2645
|
const p = this.progress;
|
|
2573
2646
|
const outputs = [`${this.images.length} image(s)`];
|
|
2574
2647
|
if (this.audios.length > 0) outputs.push(`${this.audios.length} audio(s)`);
|
|
2648
|
+
if (this.videos.length > 0) outputs.push(`${this.videos.length} video(s)`);
|
|
2575
2649
|
if (this.texts.length > 0) outputs.push(`${this.texts.length} text(s)`);
|
|
2576
2650
|
const line = `${this.status === "Failure" ? "🔴" : "🟢"} ${this.status.toLowerCase()} in ${(p.elapsedMs / 1e3).toFixed(1)}s · ${outputs.join(" · ")}`;
|
|
2577
2651
|
if (globalThis.process?.stdout?.isTTY) process.stdout.write(`\r\x1b[2K${line}\n`);
|
|
@@ -3921,15 +3995,23 @@ const ComfyUploadImageResult_ark = type({
|
|
|
3921
3995
|
var ComfyUploader = class {
|
|
3922
3996
|
constructor(host) {
|
|
3923
3997
|
this.host = host;
|
|
3998
|
+
this.uploaded = /* @__PURE__ */ new Set();
|
|
3924
3999
|
this.uploadImage = async (img, p) => {
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
4000
|
+
return await this.uploadInput({
|
|
4001
|
+
blob: img.getAsBlob(),
|
|
4002
|
+
name: img.enumName,
|
|
4003
|
+
...p,
|
|
4004
|
+
slot: "LoadImage.image"
|
|
4005
|
+
});
|
|
4006
|
+
};
|
|
4007
|
+
this.uploadInput = async (p) => {
|
|
4008
|
+
const expectedFinalName = p.subfolder ? `${p.subfolder}/${p.name}` : p.name;
|
|
4009
|
+
if (this.uploaded.has(expectedFinalName) || this.host.schema.stringValues(p.slot).includes(expectedFinalName)) {
|
|
4010
|
+
console.log(`[🌁] UPLOAD: 🩶 "${expectedFinalName}" already exists on current ComfyUI instance`);
|
|
3929
4011
|
return expectedFinalName;
|
|
3930
4012
|
}
|
|
3931
4013
|
const form = new FormData();
|
|
3932
|
-
form.set("image",
|
|
4014
|
+
form.set("image", p.blob, p.name);
|
|
3933
4015
|
if (p.type) form.set("type", p.type);
|
|
3934
4016
|
if (p.override ?? true) form.set("override", "true");
|
|
3935
4017
|
if (p.subfolder) form.set("subfolder", p.subfolder);
|
|
@@ -3939,11 +4021,11 @@ var ComfyUploader = class {
|
|
|
3939
4021
|
});
|
|
3940
4022
|
const result = softValidate(ComfyUploadImageResult_ark, await resp.json());
|
|
3941
4023
|
console.log("[🌁] UPLOAD: ✅ got", result);
|
|
3942
|
-
if (result.name == null) throw new Error(
|
|
4024
|
+
if (result.name == null) throw new Error(`upload of '${p.name}' failed: the host answered no name`);
|
|
3943
4025
|
const finalName = result.subfolder ? `${result.subfolder}/${result.name}` : result.name;
|
|
3944
4026
|
if (finalName !== expectedFinalName) console.warn(`[🌁] UPLOAD: ⚠️ expected "${expectedFinalName}" but got "${finalName}"`);
|
|
3945
|
-
|
|
3946
|
-
this.
|
|
4027
|
+
if (p.slot === "LoadImage.image") this.host.schema.unsafely_addImageInSchemaWithoutReloading(finalName);
|
|
4028
|
+
this.uploaded.add(finalName);
|
|
3947
4029
|
return finalName;
|
|
3948
4030
|
};
|
|
3949
4031
|
}
|
|
@@ -5328,42 +5410,55 @@ var SizeVar = class extends ComfyVar {
|
|
|
5328
5410
|
return `${width}×${height}${hit ? ` (${hit.label})` : ""}`;
|
|
5329
5411
|
}
|
|
5330
5412
|
};
|
|
5331
|
-
const DEFAULT_IMAGE_EXTENSIONS =
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
"
|
|
5337
|
-
|
|
5338
|
-
/** empty image var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
5339
|
-
var ImageVarEmptyError = class extends Error {
|
|
5340
|
-
constructor(varName) {
|
|
5341
|
-
super(`image var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/image.png'))`);
|
|
5413
|
+
const DEFAULT_IMAGE_EXTENSIONS = DEFAULT_MEDIA_EXTENSIONS.image;
|
|
5414
|
+
const DEFAULT_AUDIO_EXTENSIONS = DEFAULT_MEDIA_EXTENSIONS.audio;
|
|
5415
|
+
const DEFAULT_VIDEO_EXTENSIONS = DEFAULT_MEDIA_EXTENSIONS.video;
|
|
5416
|
+
/** empty media var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
5417
|
+
var MediaVarEmptyError = class extends Error {
|
|
5418
|
+
constructor(varName, media = "image") {
|
|
5419
|
+
super(`${media} var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/file'))`);
|
|
5342
5420
|
this.varName = varName;
|
|
5343
|
-
this.
|
|
5421
|
+
this.media = media;
|
|
5422
|
+
this.name = "MediaVarEmptyError";
|
|
5344
5423
|
}
|
|
5345
5424
|
};
|
|
5346
|
-
/**
|
|
5425
|
+
/** the image-only name this error had first; the same class */
|
|
5426
|
+
const ImageVarEmptyError = MediaVarEmptyError;
|
|
5427
|
+
/** trim + expand a leading `~/` — every media var write funnels through this */
|
|
5347
5428
|
function expandUserPath(raw) {
|
|
5348
5429
|
const trimmed = raw.trim();
|
|
5349
5430
|
return trimmed.startsWith("~/") ? join(getComfyStorage().homedir(), trimmed.slice(2)) : trimmed;
|
|
5350
5431
|
}
|
|
5432
|
+
/** the loader node each medium goes through, and its file input */
|
|
5433
|
+
const MEDIA_LOADERS = {
|
|
5434
|
+
image: {
|
|
5435
|
+
node: "LoadImage",
|
|
5436
|
+
input: "image"
|
|
5437
|
+
},
|
|
5438
|
+
audio: {
|
|
5439
|
+
node: "LoadAudio",
|
|
5440
|
+
input: "audio"
|
|
5441
|
+
},
|
|
5442
|
+
video: {
|
|
5443
|
+
node: "LoadVideo",
|
|
5444
|
+
input: "file"
|
|
5445
|
+
}
|
|
5446
|
+
};
|
|
5351
5447
|
/**
|
|
5352
|
-
* a local
|
|
5448
|
+
* a local media file path. The VALUE is a PLAIN PATH STRING — text-encodable,
|
|
5353
5449
|
* drafts persist it verbatim (toJSON = the string), hand-editable in the
|
|
5354
|
-
* draft json. Empty = unset: outValue()/absPath() throw
|
|
5355
|
-
* so a build never runs on a silent placeholder. The TUI opens the
|
|
5356
|
-
* picker overlay for kind
|
|
5450
|
+
* draft json. Empty = unset: outValue()/absPath() throw MediaVarEmptyError,
|
|
5451
|
+
* so a build never runs on a silent placeholder. The TUI opens the file
|
|
5452
|
+
* picker overlay for every media kind.
|
|
5357
5453
|
*/
|
|
5358
|
-
var
|
|
5454
|
+
var MediaVar = class extends ComfyVar {
|
|
5359
5455
|
constructor(defaultValue, opts = {}) {
|
|
5360
5456
|
super(expandUserPath(defaultValue), opts.label);
|
|
5361
5457
|
this.opts = opts;
|
|
5362
|
-
this.kind = "image";
|
|
5363
5458
|
}
|
|
5364
5459
|
/** what the picker lists (lowercase, no dots) */
|
|
5365
5460
|
get extensions() {
|
|
5366
|
-
return this.opts.extensions ??
|
|
5461
|
+
return this.opts.extensions ?? DEFAULT_MEDIA_EXTENSIONS[this.kind];
|
|
5367
5462
|
}
|
|
5368
5463
|
set(value) {
|
|
5369
5464
|
return super.set(expandUserPath(value));
|
|
@@ -5376,7 +5471,7 @@ var ImageVar = class extends ComfyVar {
|
|
|
5376
5471
|
return this.value !== "";
|
|
5377
5472
|
}
|
|
5378
5473
|
emptyError() {
|
|
5379
|
-
return new
|
|
5474
|
+
return new MediaVarEmptyError(this.name ?? this.label ?? this.kind, this.kind);
|
|
5380
5475
|
}
|
|
5381
5476
|
/** the ONE resolution helper: absolute kept as-is, relative resolved against opts.folder, else cwd */
|
|
5382
5477
|
absPath() {
|
|
@@ -5394,8 +5489,56 @@ var ImageVar = class extends ComfyVar {
|
|
|
5394
5489
|
const home = getComfyStorage().homedir();
|
|
5395
5490
|
return this.value.startsWith(`${home}/`) ? `~${this.value.slice(home.length)}` : this.value;
|
|
5396
5491
|
}
|
|
5492
|
+
/** upload the file hash-named (reruns dedupe) and add this medium's loader node. A dry
|
|
5493
|
+
* build names the file by its hash and uploads nothing */
|
|
5494
|
+
async loadVia(wf) {
|
|
5495
|
+
const loader = MEDIA_LOADERS[this.kind];
|
|
5496
|
+
const factory = wf.builderBase[loader.node];
|
|
5497
|
+
if (factory == null) throw new Error(`host '${wf.host.data.id}' has no ${loader.node} node: ${this.kind} var '${this.name ?? "?"}' cannot load`);
|
|
5498
|
+
const abs = this.absPath();
|
|
5499
|
+
const bytes = getComfyStorage().readBytes(abs);
|
|
5500
|
+
const ext = extensionOf(abs);
|
|
5501
|
+
const name = `${hashArrayBuffer(bytes)}${ext === "" ? "" : `.${ext}`}`;
|
|
5502
|
+
const onHost = wf.dry ? name : await wf.host.uploader.uploadInput({
|
|
5503
|
+
blob: new Blob([bytes], { type: mediaMime(abs) }),
|
|
5504
|
+
name,
|
|
5505
|
+
slot: `${loader.node}.${loader.input}`,
|
|
5506
|
+
type: "input"
|
|
5507
|
+
});
|
|
5508
|
+
return factory({ [loader.input]: onHost });
|
|
5509
|
+
}
|
|
5397
5510
|
};
|
|
5398
|
-
/**
|
|
5511
|
+
/** a local image path, loaded through LoadImage */
|
|
5512
|
+
var ImageVar = class extends MediaVar {
|
|
5513
|
+
constructor(..._args2) {
|
|
5514
|
+
super(..._args2);
|
|
5515
|
+
this.kind = "image";
|
|
5516
|
+
}
|
|
5517
|
+
async loadInWorkflow(wf) {
|
|
5518
|
+
return await this.loadVia(wf);
|
|
5519
|
+
}
|
|
5520
|
+
};
|
|
5521
|
+
/** a local audio path, loaded through LoadAudio */
|
|
5522
|
+
var AudioVar = class extends MediaVar {
|
|
5523
|
+
constructor(..._args3) {
|
|
5524
|
+
super(..._args3);
|
|
5525
|
+
this.kind = "audio";
|
|
5526
|
+
}
|
|
5527
|
+
async loadInWorkflow(wf) {
|
|
5528
|
+
return await this.loadVia(wf);
|
|
5529
|
+
}
|
|
5530
|
+
};
|
|
5531
|
+
/** a local video path, loaded through LoadVideo */
|
|
5532
|
+
var VideoVar = class extends MediaVar {
|
|
5533
|
+
constructor(..._args4) {
|
|
5534
|
+
super(..._args4);
|
|
5535
|
+
this.kind = "video";
|
|
5536
|
+
}
|
|
5537
|
+
async loadInWorkflow(wf) {
|
|
5538
|
+
return await this.loadVia(wf);
|
|
5539
|
+
}
|
|
5540
|
+
};
|
|
5541
|
+
/** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image / v.audio / v.video */
|
|
5399
5542
|
const v = {
|
|
5400
5543
|
text: (defaultValue, opts = {}) => new TextVar(defaultValue, typeof opts === "string" ? { label: opts } : opts),
|
|
5401
5544
|
prompt: (defaultValue, opts = {}) => new PromptVar(defaultValue, opts),
|
|
@@ -5410,7 +5553,9 @@ const v = {
|
|
|
5410
5553
|
choice,
|
|
5411
5554
|
loras: (options, initial = {}, label) => new LorasVar(options, initial, label),
|
|
5412
5555
|
size: (defaultValue, opts = {}) => new SizeVar(defaultValue, opts.presets ?? sizePresetsFor(defaultValue), opts.label, opts.image, opts.starred),
|
|
5413
|
-
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts)
|
|
5556
|
+
image: (defaultValue, opts = {}) => new ImageVar(defaultValue, opts),
|
|
5557
|
+
audio: (defaultValue, opts = {}) => new AudioVar(defaultValue, opts),
|
|
5558
|
+
video: (defaultValue, opts = {}) => new VideoVar(defaultValue, opts)
|
|
5414
5559
|
};
|
|
5415
5560
|
function varValues(vars) {
|
|
5416
5561
|
const out = {};
|
|
@@ -6862,10 +7007,18 @@ function bundledExamplesDir(moduleUrl = import.meta.url) {
|
|
|
6862
7007
|
* or the package's examples/ folder was pruned.
|
|
6863
7008
|
*/
|
|
6864
7009
|
function exampleImagePath(name) {
|
|
7010
|
+
return bundledExampleFile("images", name);
|
|
7011
|
+
}
|
|
7012
|
+
/** the same for a bundled `examples/media/` audio or video file, e.g.
|
|
7013
|
+
* `exampleMediaPath('sine_440hz_3s.flac')` — the default of audio and video example vars */
|
|
7014
|
+
function exampleMediaPath(name) {
|
|
7015
|
+
return bundledExampleFile("media", name);
|
|
7016
|
+
}
|
|
7017
|
+
function bundledExampleFile(folder, name) {
|
|
6865
7018
|
const examples = bundledExamplesDir();
|
|
6866
|
-
if (examples == null) throw new Error(`[comfy-ts] cannot resolve bundled example
|
|
6867
|
-
const abs = join(examples,
|
|
6868
|
-
if (!existsSync(abs)) throw new Error(`[comfy-ts] bundled example
|
|
7019
|
+
if (examples == null) throw new Error(`[comfy-ts] cannot resolve bundled example file '${name}': the package's examples/ folder is not on disk`);
|
|
7020
|
+
const abs = join(examples, folder, name);
|
|
7021
|
+
if (!existsSync(abs)) throw new Error(`[comfy-ts] bundled example file not found: ${abs}`);
|
|
6869
7022
|
return abs;
|
|
6870
7023
|
}
|
|
6871
7024
|
//#endregion
|
|
@@ -6928,6 +7081,6 @@ function isTuiActive() {
|
|
|
6928
7081
|
*/
|
|
6929
7082
|
setDefaultComfyStorage(createNodeStorage());
|
|
6930
7083
|
//#endregion
|
|
6931
|
-
export { ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, MultiChoiceVar, OptionalChoiceVar, PromptVar, ResilientWebSocketClient, SD15_SIZE_PRESETS, SeedVar, SizeVar, TextVar, ToggleVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, exampleImagePath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
7084
|
+
export { AudioVar, ChoiceVar, ComfyExecution, ComfyHost, ComfyHostAuthError, ComfyHostUnreachableError, ComfyManager, ComfyNode, ComfyNodeOutput, ComfySchema, ComfyTS, ComfyUploader, ComfyVar, ComfyVarBase, ComfyWorkflow, ComfyWorkflowBuilder, DEFAULT_AUDIO_EXTENSIONS, DEFAULT_IMAGE_EXTENSIONS, DEFAULT_SIZE_PRESETS, DEFAULT_STARRED_SIZES, DEFAULT_VIDEO_EXTENSIONS, DefinedWorkflow, FloatVar, ImageVar, ImageVarEmptyError, IntVar, InvalidPromptError, LorasVar, MediaImage, MediaVar, MediaVarEmptyError, MultiChoiceVar, OptionalChoiceVar, PromptVar, ResilientWebSocketClient, SD15_SIZE_PRESETS, SeedVar, SizeVar, TextVar, ToggleVar, VideoVar, WorkflowConvertError, WorkflowNormalizeError, __FAIL, __OK, activeLoras, activePresetLabel, asAbsolutePath, asHTMLContent, asMDContent, asRelativePath, auto, auto_, clearLoraKeywordOverride, codegenSDK, convertFlowToLiteGraphJSON, convertLiteGraphToPrompt, createMemoryStorage, exampleImagePath, exampleMediaPath, getComfyStorage, getLoraDisplayName, getLoraInfo, getLoraKeyword, getLoraPreviewUrl, getLoraTriggerWords, hostIdToNamespace, isLoraKeywordFromMirror, isTuiActive, loraKey, loraKeywordFromMirror, loraMatchesFilter, loraSearchNames, loraSearchText, loraTag, normalizeWorkflow, parseHostBase, parseWorkflowJson, promptEnhancerPresets, readPromptEnhancers, refreshLoraInfoCacheIfChanged, reloadLoraInfoCache, renderHttpBase, renderWsUrl, resultFailure, resultSuccess, setDefaultComfyStorage, setLoraKeyword, sizePresetsFor, toPresetList, v };
|
|
6932
7085
|
|
|
6933
7086
|
//# sourceMappingURL=index.js.map
|