comfy-ts 2.20.1 → 2.21.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 (31) hide show
  1. package/README.md +21 -3
  2. package/dist/{ServeApp-B469W26E.js → ServeApp-ByMobrWW.js} +3 -3
  3. package/dist/{ServeApp-B469W26E.js.map → ServeApp-ByMobrWW.js.map} +1 -1
  4. package/dist/cli.js +5 -5
  5. package/dist/{exampleAssets-8MycEthF.js → exampleAssets-B5sMqNia.js} +58 -3
  6. package/dist/exampleAssets-B5sMqNia.js.map +1 -0
  7. package/dist/{findDefinedWorkflow-B90-xFxX.js → findDefinedWorkflow-BNZgYIww.js} +2 -2
  8. package/dist/{findDefinedWorkflow-B90-xFxX.js.map → findDefinedWorkflow-BNZgYIww.js.map} +1 -1
  9. package/dist/index.cjs +87 -19
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +19 -3
  12. package/dist/index.d.ts +19 -3
  13. package/dist/index.js +87 -19
  14. package/dist/index.js.map +1 -1
  15. package/dist/{run-run-BslhZ0Qm.js → run-run-CuBSygku.js} +5 -5
  16. package/dist/{run-run-BslhZ0Qm.js.map → run-run-CuBSygku.js.map} +1 -1
  17. package/dist/{run-serve-CsEYPGm9.js → run-serve-COk_G0Qz.js} +4 -4
  18. package/dist/{run-serve-CsEYPGm9.js.map → run-serve-COk_G0Qz.js.map} +1 -1
  19. package/dist/{run-tui-Cxa8ksav.js → run-tui-CB6i_x2y.js} +4 -4
  20. package/dist/{run-tui-Cxa8ksav.js.map → run-tui-CB6i_x2y.js.map} +1 -1
  21. package/dist/{schemaDrift-DaWsE-mt.js → schemaDrift-CHDVYlaj.js} +32 -19
  22. package/dist/{schemaDrift-DaWsE-mt.js.map → schemaDrift-CHDVYlaj.js.map} +1 -1
  23. package/dist/web.d.ts +19 -3
  24. package/dist/web.js +87 -19
  25. package/dist/web.js.map +1 -1
  26. package/package.json +2 -2
  27. package/src/host/ComfyHost.ts +21 -0
  28. package/src/host/leastBusy.ts +37 -0
  29. package/src/state.ts +6 -0
  30. package/src/vars/DefinedWorkflow.ts +38 -21
  31. package/dist/exampleAssets-8MycEthF.js.map +0 -1
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # comfy-ts
2
2
 
3
- **Write ComfyUI workflows in TypeScript, then run them from code, one command, a terminal, a browser or an agent.**
3
+ **An efficient way to create, run, maintain and operate your ComfyUI workflows, for humans and agents.**
4
4
 
5
- [![CI](https://github.com/rvion/comfy-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/rvion/comfy-ts/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts) [![npm downloads](https://img.shields.io/npm/dm/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts) [![GitHub release](https://img.shields.io/github/v/release/rvion/comfy-ts)](https://github.com/rvion/comfy-ts/releases) [![types](https://img.shields.io/npm/types/comfy-ts)](https://www.npmjs.com/package/comfy-ts) [![license](https://img.shields.io/npm/l/comfy-ts.svg)](https://github.com/rvion/comfy-ts/blob/main/LICENSE) [![sponsor](https://img.shields.io/github/sponsors/rvion?label=sponsor&logo=githubsponsors)](https://github.com/sponsors/rvion)
5
+ <a href="https://youtu.be/eniEaCp_NS4"><img src="https://raw.githubusercontent.com/rvion/comfy-ts/main/trailer/comfy-ts/thumbnail.jpg" alt="The comfy-ts trailer on YouTube, 1:39" width="640"></a>
6
6
 
7
- Types come from your own ComfyUI: every node and model it has autocompletes, and a wrong graph is a compile error. Run on your GPU, another machine or Comfy Cloud, and get the images, audio and video back in your code or as files. 73 ready workflows cover 43 model families, from SDXL to Wan video and ACE-Step songs.
7
+ [![CI](https://github.com/rvion/comfy-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/rvion/comfy-ts/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts) [![npm downloads](https://img.shields.io/npm/dm/comfy-ts.svg)](https://www.npmjs.com/package/comfy-ts) [![GitHub release](https://img.shields.io/github/v/release/rvion/comfy-ts)](https://github.com/rvion/comfy-ts/releases) [![types](https://img.shields.io/npm/types/comfy-ts)](https://www.npmjs.com/package/comfy-ts) [![license](https://img.shields.io/npm/l/comfy-ts.svg)](https://github.com/rvion/comfy-ts/blob/main/LICENSE) [![sponsor](https://img.shields.io/github/sponsors/rvion?label=sponsor&logo=githubsponsors)](https://github.com/sponsors/rvion) [![discord](https://img.shields.io/discord/1087008112969531513?label=discord&logo=discord&logoColor=white)](https://discord.gg/GfAN6hF2ad)
8
+
9
+ Write ComfyUI workflows in TypeScript, then run them from code, one command, a terminal, a browser or an agent. Types come from your own ComfyUI: every node and model it has autocompletes, and a wrong graph is a compile error. Run on your GPU, another machine or Comfy Cloud, and get the images, audio and video back in your code or as files. 73 ready workflows cover 43 model families, from SDXL to Wan video and ACE-Step songs.
10
+
11
+ 💬 Questions, help, or something you made with it: come say hi on [the Discord](https://discord.gg/GfAN6hF2ad).
8
12
 
9
13
  | you want to | start here |
10
14
  | --- | --- |
@@ -436,6 +440,19 @@ Reaching a Comfy that runs on another one of your machines:
436
440
  - **tailscale**: `tailscale serve 8188` on the box gives a stable https url for `url:`. Plain tailnet hostnames work with `host:` too.
437
441
  - **cloudflared**: `cloudflared tunnel --url http://127.0.0.1:8188` prints a temporary public https url. Paste it into `url:`.
438
442
 
443
+ Several GPUs: `comfy.leastBusy` returns the host with the shortest queue, and `run({ host })` runs the workflow there.
444
+
445
+ ```ts
446
+ const gpus = [comfy.host({ id: 'gpu-1' }), comfy.host({ id: 'gpu-2' })]
447
+ const runs = prompts.map(async (prompt) => {
448
+ txt2img.vars.prompt.value = prompt
449
+ return txt2img.run({ host: await comfy.leastBusy(gpus) })
450
+ })
451
+ await Promise.all(runs)
452
+ ```
453
+
454
+ It counts the jobs in each server's queue, from every client, and the runs this process started that the server has not seen yet, so runs started together spread over the hosts. A host that does not answer is skipped. The graph is built against the host it runs on: a model that host does not have fails the run with ComfyUI's own error.
455
+
439
456
  ## 🔌 Custom nodes and models: ComfyUI-Manager
440
457
 
441
458
  The whole ComfyUI-Manager registry is mirrored into generated types: every known custom node pack, plugin title and model is a typed union. The generated files are committed, browsable TypeScript:
@@ -564,6 +581,7 @@ One folder of local state per consumer repo: `hosts/` (schema dumps, the generat
564
581
  | serve web panel: every var as a control, queue, gallery, phone | ✅ |
565
582
  | prompt refiner in the panel (OpenRouter or local Open WebUI) | ✅ |
566
583
  | cloud hosts: `url` + `X-API-Key` auth, Comfy Cloud ran live | ✅ |
584
+ | several GPUs: `comfy.leastBusy(hosts)` picks the shortest queue | 🔶 |
567
585
  | ComfyUI-Manager registry mirror + Known\* ecosystem unions | ✅ |
568
586
  | install custom nodes / models through the ComfyUI-Manager queue (V3.x, 4.x) | 🔶 |
569
587
  | content-addressed local asset cache | 🔶 |
@@ -1,5 +1,5 @@
1
- import { $ as DEFAULT_MEDIA_EXTENSIONS, A as reloadLoraInfoCache, B as lmFileSize, C as getLoraTriggers, E as lorasMissingFromMirror, F as fetchLoraList, G as lmTags, I as fetchLoraPreviewBytes, J as loraKey, L as lmBaseModel, M as fetchLoraCivitai, N as fetchLoraDescription, O as recordCivitaiMiss, P as fetchLoraExampleImages, R as lmCivitai, S as getLoraTriggerWords, T as loraMirrorEntries, U as lmNotes, V as lmFolder, W as lmSha256, X as ansi, Y as loraPreviewMapFrom, _ as buildLoraMirror, b as getLoraInfo, c as isLoraLanes, d as isLoraStrength, et as MEDIA_KINDS, ht as extractErrorMessage, i as summarizeDrift, j as writeLoraMirror, k as refreshLoraInfoCacheIfChanged, l as isLorasInput, mt as sha1HexOfString, ot as bang, p as getLoraKeyword, pt as statelessRegex, r as driftChanged, u as isPromptInput, v as getLoraAddedAt, x as getLoraPreviewUrl, y as getLoraDisplayName, z as lmFilePath } from "./schemaDrift-DaWsE-mt.js";
2
- import { d as isDraftMetaKey, l as assembleLogChunks, o as draftsDirForFile, s as listDraftsForFile, u as ENHANCE_KEY } from "./findDefinedWorkflow-B90-xFxX.js";
1
+ import { $ as DEFAULT_MEDIA_EXTENSIONS, A as reloadLoraInfoCache, B as lmFileSize, C as getLoraTriggers, E as lorasMissingFromMirror, F as fetchLoraList, G as lmTags, I as fetchLoraPreviewBytes, J as loraKey, L as lmBaseModel, M as fetchLoraCivitai, N as fetchLoraDescription, O as recordCivitaiMiss, P as fetchLoraExampleImages, R as lmCivitai, S as getLoraTriggerWords, T as loraMirrorEntries, U as lmNotes, V as lmFolder, W as lmSha256, X as ansi, Y as loraPreviewMapFrom, _ as buildLoraMirror, b as getLoraInfo, c as isLoraLanes, d as isLoraStrength, et as MEDIA_KINDS, ht as extractErrorMessage, i as summarizeDrift, j as writeLoraMirror, k as refreshLoraInfoCacheIfChanged, l as isLorasInput, mt as sha1HexOfString, ot as bang, p as getLoraKeyword, pt as statelessRegex, r as driftChanged, u as isPromptInput, v as getLoraAddedAt, x as getLoraPreviewUrl, y as getLoraDisplayName, z as lmFilePath } from "./schemaDrift-CHDVYlaj.js";
2
+ import { d as isDraftMetaKey, l as assembleLogChunks, o as draftsDirForFile, s as listDraftsForFile, u as ENHANCE_KEY } from "./findDefinedWorkflow-BNZgYIww.js";
3
3
  import { homedir } from "node:os";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -2517,4 +2517,4 @@ var ServeApp = class {
2517
2517
  //#endregion
2518
2518
  export { describeVar as n, renderDescriptorLine as r, ServeApp as t };
2519
2519
 
2520
- //# sourceMappingURL=ServeApp-B469W26E.js.map
2520
+ //# sourceMappingURL=ServeApp-ByMobrWW.js.map