comfy-ts 2.19.0 → 2.20.1

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 (60) hide show
  1. package/README.md +9 -4
  2. package/claude-code/skills/setup/SKILL.md +1 -1
  3. package/dist/{ServeApp-qXcQfdgT.js → ServeApp-B469W26E.js} +5 -5
  4. package/dist/{ServeApp-qXcQfdgT.js.map → ServeApp-B469W26E.js.map} +1 -1
  5. package/dist/cli.js +12 -8
  6. package/dist/cli.js.map +1 -1
  7. package/dist/{exampleAssets-CE4PUy3n.js → exampleAssets-8MycEthF.js} +141 -55
  8. package/dist/exampleAssets-8MycEthF.js.map +1 -0
  9. package/dist/{findDefinedWorkflow-0lG-VTEd.js → findDefinedWorkflow-B90-xFxX.js} +2 -2
  10. package/dist/{findDefinedWorkflow-0lG-VTEd.js.map → findDefinedWorkflow-B90-xFxX.js.map} +1 -1
  11. package/dist/index.cjs +87 -6
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +12 -2
  14. package/dist/index.d.ts +12 -2
  15. package/dist/index.js +87 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/{run-run-C_yXY0vl.js → run-run-BslhZ0Qm.js} +5 -5
  18. package/dist/{run-run-C_yXY0vl.js.map → run-run-BslhZ0Qm.js.map} +1 -1
  19. package/dist/{run-serve-DaXzoVTS.js → run-serve-CsEYPGm9.js} +4 -4
  20. package/dist/{run-serve-DaXzoVTS.js.map → run-serve-CsEYPGm9.js.map} +1 -1
  21. package/dist/{run-tui-B3dsftdB.js → run-tui-Cxa8ksav.js} +9 -14
  22. package/dist/run-tui-Cxa8ksav.js.map +1 -0
  23. package/dist/{schemaDrift-CbsABBuk.js → schemaDrift-DaWsE-mt.js} +15 -15
  24. package/dist/{schemaDrift-CbsABBuk.js.map → schemaDrift-DaWsE-mt.js.map} +1 -1
  25. package/dist/serve-web.js +28 -28
  26. package/dist/web.d.ts +12 -2
  27. package/dist/web.js +87 -6
  28. package/dist/web.js.map +1 -1
  29. package/examples/README.md +1 -1
  30. package/examples/rvion/01-txt2img.cflow.ts +1 -1
  31. package/examples/rvion/02-img2img-upload.cflow.ts +1 -1
  32. package/examples/rvion/03-export-workflow-json.cflow.ts +1 -1
  33. package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +1 -1
  34. package/examples/rvion/06-qwen-image-edit.cflow.ts +1 -1
  35. package/examples/rvion/07-local-llm-text-gen.cflow.ts +1 -1
  36. package/examples/rvion/08-qwen-image-21-t2i.cflow.ts +1 -1
  37. package/examples/rvion/09-qwen-image-21-edit.cflow.ts +1 -1
  38. package/examples/rvion/10-anima-t2i.cflow.ts +1 -1
  39. package/examples/rvion/11-yue2-t2a.cflow.ts +1 -1
  40. package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +1 -1
  41. package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +1 -1
  42. package/examples/rvion/14-video-soundtrack.cflow.ts +1 -1
  43. package/examples/rvion/15-tts-voice-clone.cflow.ts +1 -1
  44. package/examples/rvion/16-tts-voice-design.cflow.ts +1 -1
  45. package/guide-for-agents.md +4 -4
  46. package/package.json +7 -6
  47. package/src/cli/comfy-ts-cli.ts +4 -2
  48. package/src/cli/gen.ts +6 -1
  49. package/src/cli/serve/ServeApp.ts +4 -4
  50. package/src/cli/serve/web/api.ts +1 -1
  51. package/src/cli/serve/web/state/RunSt.poll.test.ts +38 -0
  52. package/src/cli/serve/web/state/RunSt.ts +6 -2
  53. package/src/cli/tui/components/Header.tsx +1 -4
  54. package/src/cli/tui/components/HostPanel.tsx +1 -4
  55. package/src/cli/tui/state/HostSt.ts +2 -2
  56. package/src/host/ComfyHost.ts +37 -5
  57. package/src/host/hostFile.ts +57 -0
  58. package/src/state.ts +15 -9
  59. package/dist/exampleAssets-CE4PUy3n.js.map +0 -1
  60. package/dist/run-tui-B3dsftdB.js.map +0 -1
package/README.md CHANGED
@@ -165,9 +165,11 @@ This is not a ComfyUI type package that someone published once. One command read
165
165
 
166
166
  ```bash
167
167
  bunx comfy-ts gen --id my-gpu --host http://127.0.0.1:8188
168
- # → .comfy-ts/hosts/my-gpu/{object_info.json, embeddings.json, sdk.d.ts}
168
+ # → .comfy-ts/hosts/my-gpu/{object_info.json, embeddings.json, sdk.d.ts, host.json}
169
169
  ```
170
170
 
171
+ `host.json` keeps the address, so your code names the host by its id alone and never writes a machine name: `comfy.host({ id: 'my-gpu' })`.
172
+
171
173
  ```ts
172
174
  declare global {
173
175
  namespace Comfy {
@@ -312,7 +314,7 @@ No argument needed: it finds every `*.cflow.ts` under your project AND the examp
312
314
 
313
315
  ```bash
314
316
  bunx comfy-ts gen --id my-gpu --host http://127.0.0.1:8188
315
- # → .comfy-ts/hosts/my-gpu/{object_info.json, embeddings.json, sdk.d.ts}
317
+ # → .comfy-ts/hosts/my-gpu/{object_info.json, embeddings.json, sdk.d.ts, host.json}
316
318
 
317
319
  bunx comfy-ts outline # what is inside that 2MB sdk.d.ts?
318
320
  bunx comfy-ts loras # mirror your loras' names + trigger words (below)
@@ -409,6 +411,9 @@ The honest support matrix: **local and LAN hosts connect directly** when ComfyUI
409
411
  Every Comfy works through one identical API: same mechanism, same codegen, same typed SDK, same TUI, whatever answers the protocol:
410
412
 
411
413
  ```ts
414
+ // the address `comfy-ts gen --id my-gpu --host …` saved: code that names no machine
415
+ comfy.host({ id: 'my-gpu' })
416
+
412
417
  // the box you are on
413
418
  comfy.host({ id: 'local', host: '127.0.0.1', port: 8188 })
414
419
 
@@ -499,7 +504,7 @@ Both carry the same skills, which read the guide above from the installed packag
499
504
 
500
505
  Every example is a runnable `*.cflow.ts` module: run it with bun, with `bunx comfy-ts run <name>`, or browse them all with `bunx comfy-ts tui`.
501
506
 
502
- Start with the didactic sequence in [`examples/rvion/`](examples/rvion/). These run against a local host: edit its `comfy.host({...})` line to point at yours, and the models each one names must be on that host.
507
+ Start with the didactic sequence in [`examples/rvion/`](examples/rvion/). These name their host by id only, `comfy.host({ id: 'windows-1' })`: run `bunx comfy-ts gen --id windows-1 --host http://<your-comfy>:8188` once and they find yours. The models each one names must be on that host.
503
508
 
504
509
  | example | shows |
505
510
  | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
@@ -536,7 +541,7 @@ Every zoo file imports offline and headless (no key, no cache needed: CI proves
536
541
 
537
542
  ## 🗂️ The `.comfy-ts/` folder
538
543
 
539
- One folder of local state per consumer repo: `hosts/` (schema dumps + the generated sdk per host), `outputs/`, `drafts/`, TUI settings, lora keywords. Gitignore all of it. `hosts/` is a full dump of that machine's models and paths (~10MB), so a commit of it publishes your setup. In a PRIVATE repo, a commit of it is what buys you typed CI.
544
+ One folder of local state per consumer repo: `hosts/` (schema dumps, the generated sdk and the saved address per host), `outputs/`, `drafts/`, TUI settings, lora keywords. Gitignore all of it. `hosts/` is a full dump of that machine's models and paths (~10MB), so a commit of it publishes your setup. In a PRIVATE repo, a commit of it is what buys you typed CI.
540
545
 
541
546
  ## ✅ Feature status
542
547
 
@@ -10,6 +10,6 @@ The host url is where ComfyUI listens (default `http://127.0.0.1:8188`); ask for
10
10
  1. Install with the project's package manager: `bun add comfy-ts` (or npm, pnpm, yarn). Workflow modules run under bun, so check `bun --version` too.
11
11
  2. Read `node_modules/comfy-ts/guide-for-agents.md`, section "Setup flow", and do each step for this host: `bunx comfy-ts gen --id <host-id> --host <host-url>`, the tsconfig `include`, the `.gitignore` line. A Comfy Cloud host also needs `--api-key` or `COMFY_CLOUD_API_KEY`.
12
12
  3. Add `@./node_modules/comfy-ts/guide-for-agents.md` as a line of the project's `CLAUDE.md`, so every session knows the library.
13
- 4. Check: `.comfy-ts/hosts/<host-id>/sdk.d.ts` exists and the project still typechecks.
13
+ 4. Check: `.comfy-ts/hosts/<host-id>/sdk.d.ts` and `host.json` exist and the project still typechecks. `host.json` is the saved address, so the project's modules name the host as `comfy.host({ id: '<host-id>' })` and never write the url.
14
14
 
15
15
  Report the host id, the node count `gen` printed, and every file you changed.
@@ -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, at as extractErrorMessage, b as getLoraInfo, c as isLoraLanes, d as isLoraStrength, et as MEDIA_KINDS, ht as sha1HexOfString, i as summarizeDrift, j as writeLoraMirror, k as refreshLoraInfoCacheIfChanged, l as isLorasInput, mt as statelessRegex, p as getLoraKeyword, r as driftChanged, st as bang, u as isPromptInput, v as getLoraAddedAt, x as getLoraPreviewUrl, y as getLoraDisplayName, z as lmFilePath } from "./schemaDrift-CbsABBuk.js";
2
- import { d as isDraftMetaKey, l as assembleLogChunks, o as draftsDirForFile, s as listDraftsForFile, u as ENHANCE_KEY } from "./findDefinedWorkflow-0lG-VTEd.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-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";
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";
@@ -1580,8 +1580,8 @@ var ServeApp = class {
1580
1580
  const byId = /* @__PURE__ */ new Map();
1581
1581
  for (const [id, host] of comfyts.hosts) byId.set(id, {
1582
1582
  id,
1583
- url: `${host.base.host}:${host.base.port}`,
1584
- httpUrl: host.getServerHostHTTP(),
1583
+ url: host.addressLabel,
1584
+ httpUrl: host.noAddress == null ? host.getServerHostHTTP() : null,
1585
1585
  modules: []
1586
1586
  });
1587
1587
  for (const mod of this.modules) {
@@ -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-qXcQfdgT.js.map
2520
+ //# sourceMappingURL=ServeApp-B469W26E.js.map