comfy-ts 2.13.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.
Files changed (75) hide show
  1. package/README.md +1 -0
  2. package/dist/{LogsSt-CUeo843w.js → LogsSt-C3UIWR-o.js} +2 -2
  3. package/dist/{LogsSt-CUeo843w.js.map → LogsSt-C3UIWR-o.js.map} +1 -1
  4. package/dist/cli.js +4 -4
  5. package/dist/index.cjs +213 -53
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +123 -21
  8. package/dist/index.d.ts +123 -21
  9. package/dist/index.js +207 -54
  10. package/dist/index.js.map +1 -1
  11. package/dist/{run-serve-DlRBv_Nk.js → run-serve-B5PfIuhK.js} +310 -88
  12. package/dist/run-serve-B5PfIuhK.js.map +1 -0
  13. package/dist/{run-tui-B5uxm2_l.js → run-tui-D-N4_yyX.js} +15 -9
  14. package/dist/run-tui-D-N4_yyX.js.map +1 -0
  15. package/dist/{schemaDrift-E95iTF7E.js → schemaDrift-BkN8rLiZ.js} +163 -25
  16. package/dist/schemaDrift-BkN8rLiZ.js.map +1 -0
  17. package/dist/serve-web.js +160 -71
  18. package/dist/{state-CUp2J1Zy.js → state-CZsYJqB6.js} +45 -35
  19. package/dist/state-CZsYJqB6.js.map +1 -0
  20. package/dist/web.d.ts +120 -21
  21. package/dist/web.js +196 -51
  22. package/dist/web.js.map +1 -1
  23. package/examples/media/README.md +8 -0
  24. package/examples/media/sine_440hz_3s.flac +0 -0
  25. package/examples/media/testsrc_256x256_3s.mp4 +0 -0
  26. package/examples/rvion/14-video-soundtrack.cflow.ts +47 -0
  27. package/guide-for-agents.md +2 -1
  28. package/package.json +2 -2
  29. package/src/cli/serve/ServeApp.ts +189 -110
  30. package/src/cli/serve/applyVarPayload.ts +5 -3
  31. package/src/cli/serve/describeVar.ts +5 -3
  32. package/src/cli/serve/resultHistory.ts +141 -0
  33. package/src/cli/serve/run-serve.ts +4 -1
  34. package/src/cli/serve/runError.ts +23 -0
  35. package/src/cli/serve/serveSettings.ts +17 -1
  36. package/src/cli/serve/web/api.ts +33 -2
  37. package/src/cli/serve/web/components/App.tsx +6 -4
  38. package/src/cli/serve/web/components/Gallery.tsx +116 -11
  39. package/src/cli/serve/web/components/Icon.tsx +4 -0
  40. package/src/cli/serve/web/components/MemoryBudget.tsx +98 -0
  41. package/src/cli/serve/web/components/RunError.tsx +19 -0
  42. package/src/cli/serve/web/components/ShortcutsModal.tsx +54 -0
  43. package/src/cli/serve/web/components/SideMenu.tsx +14 -0
  44. package/src/cli/serve/web/components/VarsForm.tsx +75 -55
  45. package/src/cli/serve/web/components/controls/BasicControls.tsx +8 -1
  46. package/src/cli/serve/web/components/controls/LorasControl.tsx +6 -3
  47. package/src/cli/serve/web/components/controls/MediaControl.tsx +111 -0
  48. package/src/cli/serve/web/promptEditor/promptExtensions.ts +3 -1
  49. package/src/cli/serve/web/state/FormSt.ts +70 -2
  50. package/src/cli/serve/web/state/RunSt.ts +61 -3
  51. package/src/cli/serve/web/state/WebSt.ts +26 -2
  52. package/src/cli/serve/web/state/formRows.ts +9 -0
  53. package/src/cli/serve/web/state/host.ts +2 -0
  54. package/src/cli/serve/web/state/keptResults.ts +26 -0
  55. package/src/cli/serve/web/state/lightbox.ts +17 -0
  56. package/src/cli/serve/web/state/mediaDrop.ts +76 -0
  57. package/src/cli/serve/web/state/shortcutCatalog.ts +100 -0
  58. package/src/cli/serve/web/state/shortcuts.ts +10 -0
  59. package/src/cli/serve/web/styles.ts +112 -24
  60. package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +4 -1
  61. package/src/cli/tui/imagePicker/ImagePickerSt.ts +15 -6
  62. package/src/cli/tui/state/TuiSt.ts +1 -1
  63. package/src/coreExports.ts +10 -0
  64. package/src/exampleAssets.ts +13 -3
  65. package/src/host/ComfyUploader.ts +34 -27
  66. package/src/index.ts +1 -1
  67. package/src/runner/ComfyExecution.ts +38 -20
  68. package/src/runner/ComfyWsApi.ts +3 -0
  69. package/src/runner/mediaKinds.ts +51 -0
  70. package/src/vars/ComfyVars.ts +96 -22
  71. package/dist/run-serve-DlRBv_Nk.js.map +0 -1
  72. package/dist/run-tui-B5uxm2_l.js.map +0 -1
  73. package/dist/schemaDrift-E95iTF7E.js.map +0 -1
  74. package/dist/state-CUp2J1Zy.js.map +0 -1
  75. 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.13.0";
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/ComfyExecution.ts
2267
- /** paths claimed by in-flight retrievals: two same-second runs on a
2268
- * counter-resetting cloud host compute the same name before either writes.
2269
- * A claim is released as soon as the write lands (the file itself then holds
2270
- * the name) or fails (the name is free again) — the set never accumulates */
2271
- const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
2272
- const AUDIO_MIMES = {
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
- function audioMime(filename) {
2281
- const ext = filename.split(".").pop()?.toLowerCase() ?? "";
2282
- return AUDIO_MIMES[ext] ?? "application/octet-stream";
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 images = msg.data.output?.images;
2351
- if (images) for (const img of images) this.pendingPromises.push(this.retrieveImage(img, promptNodeID).catch((e) => {
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.retrieveAudio(audio, promptNodeID).catch((e) => {
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.retrieveAudio = async (info, promptNodeID) => {
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 = audioMime(info.filename);
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
- this.audios.push({
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
- this.audios.push({
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
- const uniqFileName = img.enumName;
3926
- const expectedFinalName = p.subfolder ? `${p.subfolder}/${uniqFileName}` : uniqFileName;
3927
- if (this.host.schema.hasImage(expectedFinalName)) {
3928
- console.log(`[🌁] UPLOAD: 🩶 "${img.absPath}" already exists on current ComfyUI instance`);
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", img.getAsBlob(), uniqFileName);
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("upload failed");
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
- else console.log(`[🌁] UPLOAD: ✅ finalName is "${finalName}"`);
3946
- this.host.schema.unsafely_addImageInSchemaWithoutReloading(finalName);
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
- "png",
5333
- "jpg",
5334
- "jpeg",
5335
- "webp",
5336
- "gif"
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.name = "ImageVarEmptyError";
5421
+ this.media = media;
5422
+ this.name = "MediaVarEmptyError";
5344
5423
  }
5345
5424
  };
5346
- /** trim + expand a leading `~/` — every ImageVar write funnels through this */
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 image path. The VALUE is a PLAIN PATH STRING — text-encodable,
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 ImageVarEmptyError,
5355
- * so a build never runs on a silent placeholder. The TUI opens the image
5356
- * picker overlay for kind 'image'.
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 ImageVar = class extends ComfyVar {
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 ?? DEFAULT_IMAGE_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 ImageVarEmptyError(this.name ?? this.label ?? "image");
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
- /** the var constructors: v.text / v.prompt / v.int / v.float / v.seed / v.toggle / v.choice / v.loras / v.size / v.image */
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 image '${name}': the package's examples/ folder is not on disk`);
6867
- const abs = join(examples, "images", name);
6868
- if (!existsSync(abs)) throw new Error(`[comfy-ts] bundled example image not found: ${abs}`);
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