comfy-ts 2.18.1 → 2.20.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 (65) hide show
  1. package/README.md +147 -97
  2. package/claude-code/.claude-plugin/plugin.json +9 -0
  3. package/claude-code/skills/convert/SKILL.md +25 -0
  4. package/claude-code/skills/guide/SKILL.md +21 -0
  5. package/claude-code/skills/run/SKILL.md +12 -0
  6. package/claude-code/skills/setup/SKILL.md +15 -0
  7. package/claude-code/skills/workflow/SKILL.md +19 -0
  8. package/dist/{ServeApp-qXcQfdgT.js → ServeApp-B469W26E.js} +5 -5
  9. package/dist/{ServeApp-qXcQfdgT.js.map → ServeApp-B469W26E.js.map} +1 -1
  10. package/dist/cli.js +228 -11
  11. package/dist/cli.js.map +1 -1
  12. package/dist/{state-C067Kbew.js → exampleAssets-j1f26nGc.js} +177 -56
  13. package/dist/{state-C067Kbew.js.map → exampleAssets-j1f26nGc.js.map} +1 -1
  14. package/dist/{findDefinedWorkflow-0lG-VTEd.js → findDefinedWorkflow-B90-xFxX.js} +2 -2
  15. package/dist/{findDefinedWorkflow-0lG-VTEd.js.map → findDefinedWorkflow-B90-xFxX.js.map} +1 -1
  16. package/dist/index.cjs +92 -10
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +12 -2
  19. package/dist/index.d.ts +12 -2
  20. package/dist/index.js +92 -10
  21. package/dist/index.js.map +1 -1
  22. package/dist/{run-run-Zr699h2S.js → run-run-QEoh7Wbh.js} +5 -6
  23. package/dist/{run-run-Zr699h2S.js.map → run-run-QEoh7Wbh.js.map} +1 -1
  24. package/dist/{run-serve-DaXzoVTS.js → run-serve-CsEYPGm9.js} +4 -4
  25. package/dist/{run-serve-DaXzoVTS.js.map → run-serve-CsEYPGm9.js.map} +1 -1
  26. package/dist/{run-tui-CeM1GOJP.js → run-tui-YxiSoNvK.js} +9 -15
  27. package/dist/run-tui-YxiSoNvK.js.map +1 -0
  28. package/dist/{schemaDrift-CbsABBuk.js → schemaDrift-DaWsE-mt.js} +15 -15
  29. package/dist/{schemaDrift-CbsABBuk.js.map → schemaDrift-DaWsE-mt.js.map} +1 -1
  30. package/dist/web.d.ts +30 -20
  31. package/dist/web.js +83 -6
  32. package/dist/web.js.map +1 -1
  33. package/examples/README.md +17 -11
  34. package/examples/rvion/01-txt2img.cflow.ts +1 -1
  35. package/examples/rvion/02-img2img-upload.cflow.ts +1 -1
  36. package/examples/rvion/03-export-workflow-json.cflow.ts +1 -1
  37. package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +1 -1
  38. package/examples/rvion/06-qwen-image-edit.cflow.ts +1 -1
  39. package/examples/rvion/07-local-llm-text-gen.cflow.ts +1 -1
  40. package/examples/rvion/08-qwen-image-21-t2i.cflow.ts +1 -1
  41. package/examples/rvion/09-qwen-image-21-edit.cflow.ts +1 -1
  42. package/examples/rvion/10-anima-t2i.cflow.ts +1 -1
  43. package/examples/rvion/11-yue2-t2a.cflow.ts +1 -1
  44. package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +1 -1
  45. package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +1 -1
  46. package/examples/rvion/14-video-soundtrack.cflow.ts +1 -1
  47. package/examples/rvion/15-tts-voice-clone.cflow.ts +1 -1
  48. package/examples/rvion/16-tts-voice-design.cflow.ts +1 -1
  49. package/guide-for-agents.md +8 -5
  50. package/package.json +8 -7
  51. package/src/cli/comfy-ts-cli.ts +12 -2
  52. package/src/cli/gen.ts +6 -1
  53. package/src/cli/serve/ServeApp.ts +4 -4
  54. package/src/cli/serve/web/api.ts +1 -1
  55. package/src/cli/skill.ts +207 -0
  56. package/src/cli/tui/components/Header.tsx +1 -4
  57. package/src/cli/tui/components/HostPanel.tsx +1 -4
  58. package/src/cli/tui/state/HostSt.ts +2 -2
  59. package/src/exampleAssets.ts +10 -4
  60. package/src/host/ComfyHost.ts +35 -5
  61. package/src/host/hostFile.ts +57 -0
  62. package/src/state.ts +15 -9
  63. package/dist/exampleAssets-BfWzygoM.js +0 -38
  64. package/dist/exampleAssets-BfWzygoM.js.map +0 -1
  65. package/dist/run-tui-CeM1GOJP.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Background for projects that use comfy-ts, the typed TypeScript SDK for ComfyUI. Use when code imports comfy-ts, touches a *.cflow.ts module or a .comfy-ts/ folder, or builds, runs, converts or debugs ComfyUI workflows from TypeScript.
3
+ argument-hint: "[question about comfy-ts]"
4
+ ---
5
+
6
+ # comfy-ts
7
+
8
+ comfy-ts generates one typed SDK per ComfyUI host and builds workflows in TypeScript with autocomplete on every node, then runs them over the host's websocket.
9
+
10
+ Before you write or change comfy-ts code, read the guide of the installed version: `node_modules/comfy-ts/guide-for-agents.md` (in a workspace it can sit in a parent `node_modules`). It holds the workflow pattern, the var kinds, running, import and export, and the gotchas. No such file means comfy-ts is not installed yet: set it up first.
11
+
12
+ Where things are:
13
+
14
+ - `.comfy-ts/hosts/<id>/sdk.d.ts`: the generated types of host `<id>`. Grep it, never read it whole: the first ` <NodeName>: {` block lists that node's inputs, the next one its outputs. `bunx comfy-ts outline` lists its sections.
15
+ - `.comfy-ts/hosts/<id>/object_info.json`: the raw schema those types come from.
16
+ - `node_modules/comfy-ts/examples/`: working `*.cflow.ts` modules to copy patterns from.
17
+ - `bunx comfy-ts help`: every CLI command.
18
+
19
+ Model files, loras and enum values are literal unions of the real host: take them from `sdk.d.ts`, never invent one.
20
+
21
+ When the user typed a question with this command, answer it from the guide, the sdk and the examples.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Generate with comfy-ts, one headless run of a *.cflow.ts workflow module or a bundled example through comfy-ts run, returning the output files. Use when the user wants an image, video, audio or text generated.
3
+ argument-hint: "[module] [--var value ...]"
4
+ ---
5
+
6
+ Generate with comfy-ts: $ARGUMENTS
7
+
8
+ 1. Find the module: `bunx comfy-ts run` lists the modules of the cwd and the bundled examples. A path, a module key, the key without its number, or a unique part of it selects one. A bundled example runs on the host its file declares, so prefer the project's own modules.
9
+ 2. Read its vars: `bunx comfy-ts run <module> --help`. Each var is a flag; pass only the vars the request changes. `--<var>-file <path>` reads a long text var from a file.
10
+ 3. Run: `bunx comfy-ts run <module> --<var> <value> --out <path> --json`. The one JSON line carries `ok` and the absolute `outputs`.
11
+ 4. A failed run exits 1 with the reason (host down, missing model, bad value). Report it as given; never retry with invented values.
12
+ 5. Look at an image output before you say it worked, then give the user the paths.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Set up comfy-ts in this project, install it and generate the typed SDK of a ComfyUI host. Use when a project starts using comfy-ts or adds a ComfyUI host.
3
+ argument-hint: "[host-url] [host-id]"
4
+ ---
5
+
6
+ Set up comfy-ts in this project. Arguments: $ARGUMENTS
7
+
8
+ The host url is where ComfyUI listens (default `http://127.0.0.1:8188`); ask for it when none is given and the default does not answer. The host id is a short stable name of your choice (`local`, `my-gpu`): it names the generated types, so never change it later.
9
+
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
+ 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
+ 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` 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
+
15
+ Report the host id, the node count `gen` printed, and every file you changed.
@@ -0,0 +1,19 @@
1
+ ---
2
+ description: Write a new comfy-ts workflow module (*.cflow.ts) that generates an image, video, audio or text on a ComfyUI host. Use when the user wants a new generation pipeline in TypeScript.
3
+ argument-hint: "[what it should generate]"
4
+ ---
5
+
6
+ Write a new comfy-ts workflow module for: $ARGUMENTS
7
+
8
+ 1. Read `node_modules/comfy-ts/guide-for-agents.md`: the module pattern and the var kinds. No `.comfy-ts/hosts/<id>/sdk.d.ts` yet means the project needs its setup first.
9
+ 2. Start from the closest bundled example: `grep -rl <NodeName> node_modules/comfy-ts/examples --include=*.cflow.ts`. Keep the project's own host, never the example's.
10
+ 3. Take every node, input name, model file and enum value from the host's `sdk.d.ts` (grep ` <NodeName>: {`). A model the user may swap becomes a `v.model` var, never a typed file name.
11
+ 4. Make vars of what a user tunes (prompt, seed, size, steps, input media) and keep the rest as constants.
12
+ 5. Save it as `<name>.cflow.ts` with the workflow as its default export and the `import.meta.main` block of the guide.
13
+ 6. Check it offline:
14
+ - the project typechecks;
15
+ - `bunx comfy-ts run ./<name>.cflow.ts --help` lists the vars;
16
+ - a dry build reports no problem: `bun -e "const m = await import('./<name>.cflow.ts'); const wf = await m.default.build({ dry: true }); console.log(wf.problems)"` prints `[]`.
17
+ 7. Generate only when the user asks: `bunx comfy-ts run ./<name>.cflow.ts --out <path>`.
18
+
19
+ Report the file, its vars, and the checks you ran.
@@ -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