comfy-ts 2.17.0 → 2.18.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 (100) hide show
  1. package/dist/{ServeApp-BSA5yzxZ.js → ServeApp-qXcQfdgT.js} +3 -3
  2. package/dist/ServeApp-qXcQfdgT.js.map +1 -0
  3. package/dist/cli.js +58 -8
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.cjs +956 -151
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +1154 -408
  8. package/dist/index.d.ts +1154 -408
  9. package/dist/index.js +956 -151
  10. package/dist/index.js.map +1 -1
  11. package/dist/{run-run-DnaMLCFn.js → run-run-Wn7H72Zg.js} +3 -3
  12. package/dist/{run-run-DnaMLCFn.js.map → run-run-Wn7H72Zg.js.map} +1 -1
  13. package/dist/{run-serve-CbKxIu6i.js → run-serve-DaXzoVTS.js} +58 -12
  14. package/dist/run-serve-DaXzoVTS.js.map +1 -0
  15. package/dist/{run-tui-B0AQWbad.js → run-tui-VWSj1D_j.js} +3 -3
  16. package/dist/{run-tui-B0AQWbad.js.map → run-tui-VWSj1D_j.js.map} +1 -1
  17. package/dist/serve-web.js +56 -48
  18. package/dist/{state-C2oDiQ26.js → state-DgwWhZWb.js} +957 -152
  19. package/dist/state-DgwWhZWb.js.map +1 -0
  20. package/dist/web.d.ts +1172 -426
  21. package/dist/web.js +956 -151
  22. package/dist/web.js.map +1 -1
  23. package/examples/comfy-cloud/ace-step15-t2a.cflow.ts +163 -0
  24. package/examples/comfy-cloud/anima-t2i-base.cflow.ts +57 -0
  25. package/examples/comfy-cloud/boogu-t2i.cflow.ts +55 -0
  26. package/examples/comfy-cloud/chronoedit-i2i.cflow.ts +95 -0
  27. package/examples/comfy-cloud/ernie-t2i-base.cflow.ts +81 -0
  28. package/examples/comfy-cloud/flux1-t2i-krea.cflow.ts +63 -0
  29. package/examples/comfy-cloud/flux2-i2i-dev.cflow.ts +83 -0
  30. package/examples/comfy-cloud/flux2-t2i-dev.cflow.ts +60 -0
  31. package/examples/comfy-cloud/hidream-o1-i2i.cflow.ts +71 -0
  32. package/examples/comfy-cloud/hidream-o1-t2i.cflow.ts +62 -0
  33. package/examples/comfy-cloud/krea2-i2i.cflow.ts +78 -0
  34. package/examples/comfy-cloud/ltx2-i2v.cflow.ts +175 -0
  35. package/examples/comfy-cloud/ltx2-t2v.cflow.ts +143 -0
  36. package/examples/comfy-cloud/ltx23-i2v.cflow.ts +189 -0
  37. package/examples/comfy-cloud/ltx23-t2v.cflow.ts +151 -0
  38. package/examples/comfy-cloud/mage-flow-i2i-turbo.cflow.ts +72 -0
  39. package/examples/comfy-cloud/mage-flow-i2i.cflow.ts +74 -0
  40. package/examples/comfy-cloud/mage-flow-t2i-turbo.cflow.ts +60 -0
  41. package/examples/comfy-cloud/mage-flow-t2i.cflow.ts +60 -0
  42. package/examples/comfy-cloud/minimax-h3-t2i.cflow.ts +64 -0
  43. package/examples/comfy-cloud/netayume-t2i.cflow.ts +60 -0
  44. package/examples/comfy-cloud/qwen-image-i2i-2509.cflow.ts +75 -0
  45. package/examples/comfy-cloud/qwen-image-t2i-2512.cflow.ts +63 -0
  46. package/examples/comfy-cloud/sdk.d.ts +21683 -13737
  47. package/examples/comfy-cloud/stable-audio3-t2a.cflow.ts +96 -0
  48. package/examples/comfy-cloud/z-image-t2i-base.cflow.ts +54 -0
  49. package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +1 -1
  50. package/package.json +2 -2
  51. package/src/cli/bunHop.ts +49 -0
  52. package/src/cli/comfy-ts-cli.ts +4 -4
  53. package/src/cli/serve/run-serve.ts +51 -13
  54. package/src/cli/serve/web/components/App.tsx +2 -0
  55. package/src/cli/serve/web/components/DialogLayer.tsx +55 -0
  56. package/src/cli/serve/web/components/DraftTabs.tsx +8 -3
  57. package/src/cli/serve/web/components/PromptEnhancer.tsx +15 -9
  58. package/src/cli/serve/web/components/SideMenu.tsx +16 -8
  59. package/src/cli/serve/web/state/WebSt.ts +10 -1
  60. package/src/cli/serve/web/state/dialog.ts +59 -0
  61. package/src/cli/serve/web/state/keptLines.ts +1 -1
  62. package/src/cli/serve/web/styles.ts +8 -0
  63. package/src/graph/ComfyNode.ts +93 -12
  64. package/src/host/ComfyHost.ts +31 -10
  65. package/src/host/ComfyManager.ts +448 -62
  66. package/src/litegraph/CanonicalWorkflow.ts +3 -0
  67. package/src/litegraph/LiteGraphJSON.ts +2 -2
  68. package/src/litegraph/LiteGraphNodeInput.ts +2 -2
  69. package/src/litegraph/LiteGraphNodeOutput.ts +2 -2
  70. package/src/litegraph/convertFlowToLiteGraphJSON.ts +127 -34
  71. package/src/litegraph/expandSubgraphs.ts +14 -0
  72. package/src/litegraph/normalizeWorkflow.ts +1 -0
  73. package/src/manager/ComfyRegistry.ts +2 -0
  74. package/src/manager/generated/KnownComfyCustomNodeName.ts +6354 -1680
  75. package/src/manager/generated/KnownComfyPluginTitle.ts +718 -356
  76. package/src/manager/generated/KnownComfyPluginURL.ts +357 -181
  77. package/src/manager/generated/KnownModel_Base.ts +9 -5
  78. package/src/manager/generated/KnownModel_FileName.ts +135 -0
  79. package/src/manager/generated/KnownModel_Name.ts +135 -0
  80. package/src/manager/generated/KnownModel_SavePath.ts +16 -14
  81. package/src/manager/generated/KnownModel_Type.ts +15 -13
  82. package/src/manager/installedView.ts +176 -0
  83. package/src/manager/json/custom-node-list.json +4018 -2248
  84. package/src/manager/json/extension-node-map.json +8903 -2964
  85. package/src/manager/json/github-stats.json +10796 -10036
  86. package/src/manager/json/model-list.json +298 -1
  87. package/src/manager/loaders/step4_model-list-loader.ts +1 -0
  88. package/src/manager/types/ComfyManagerAPIModelList.ts +3 -0
  89. package/src/manager/types/ComfyManagerAPIPluginList.ts +19 -0
  90. package/src/promptEnhancers.ts +1 -1
  91. package/src/runner/ComfyExecution.ts +4 -1
  92. package/src/runner/ComfyWsApi.ts +82 -15
  93. package/src/sdk-generator/ComfySchema.ts +10 -1
  94. package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +4 -1
  95. package/src/sdk-generator/comfyui-sdk-codegen.ts +61 -20
  96. package/src/sdk-generator/inputWidgetKind.ts +19 -4
  97. package/src/sdk-generator/litegraphToApiRequestPayload.ts +141 -33
  98. package/dist/ServeApp-BSA5yzxZ.js.map +0 -1
  99. package/dist/run-serve-CbKxIu6i.js.map +0 -1
  100. package/dist/state-C2oDiQ26.js.map +0 -1
@@ -0,0 +1,163 @@
1
+ // ace-step15 t2a on Comfy Cloud — ACE-Step 1.5 text to song: a caption + tagged lyrics to a full mp3 track, four models behind one choice
2
+ // source template: audio_ace_step_1_5_split.json (official workflow-templates), the xl choices follow audio_ace_step1_5_xl_{turbo,sft,base}.json
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // note: audio outputs PERSIST on the host (upstream ships no websocket saver for audio — image examples stream ephemerally)
5
+ // run directly: bun examples/comfy-cloud/ace-step15-t2a.cflow.ts ["prompt"] [seed]
6
+ import { v } from 'comfy-ts'
7
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
8
+
9
+ const host = await cloudHost()
10
+
11
+ // each model with its own template's sampling and lm encoder
12
+ const MODELS = {
13
+ turbo: { unet: 'acestep_v1.5_turbo.safetensors', lm: 'qwen_1.7b_ace15.safetensors', steps: 8, cfg: 1, topP: 0.9 },
14
+ 'xl turbo': {
15
+ unet: 'acestep_v1.5_xl_turbo_bf16.safetensors',
16
+ lm: 'qwen_4b_ace15.safetensors',
17
+ steps: 8,
18
+ cfg: 1,
19
+ topP: 0.9,
20
+ },
21
+ 'xl sft': {
22
+ unet: 'acestep_v1.5_xl_sft_bf16.safetensors',
23
+ lm: 'qwen_4b_ace15.safetensors',
24
+ steps: 50,
25
+ cfg: 7,
26
+ topP: 1,
27
+ },
28
+ 'xl base': {
29
+ unet: 'acestep_v1.5_xl_base_bf16.safetensors',
30
+ lm: 'qwen_4b_ace15.safetensors',
31
+ steps: 50,
32
+ cfg: 6,
33
+ topP: 0.9,
34
+ },
35
+ } as const
36
+
37
+ // the 12 keys of each mode, spelled the way the encoder's keyscale list spells them
38
+ const KEYS = [
39
+ 'C major',
40
+ 'C# major',
41
+ 'D major',
42
+ 'Eb major',
43
+ 'E major',
44
+ 'F major',
45
+ 'F# major',
46
+ 'G major',
47
+ 'Ab major',
48
+ 'A major',
49
+ 'Bb major',
50
+ 'B major',
51
+ 'C minor',
52
+ 'C# minor',
53
+ 'D minor',
54
+ 'Eb minor',
55
+ 'E minor',
56
+ 'F minor',
57
+ 'F# minor',
58
+ 'G minor',
59
+ 'Ab minor',
60
+ 'A minor',
61
+ 'Bb minor',
62
+ 'B minor',
63
+ ] as const
64
+
65
+ export const aceStep15T2a = host.defineWorkflow({
66
+ id: 'ace-step15-t2a',
67
+ vars: {
68
+ // ONE prompt var: FIRST line = the caption (genre, instruments, vocals, production), remaining lines = lyrics
69
+ // with [Verse] [Chorus] [Bridge] tags (`//` lines are comments)
70
+ prompt: v.prompt(
71
+ [
72
+ 'K-Pop: A slick, maximalist K-pop track that genre-hops with precision and style: a hard-hitting trap-influenced verse with rapid-fire rapping, a softer R&B pre-chorus with breathy vocals and lush harmonies, then an explosive, synth-driven pop chorus with an earworm hook.',
73
+ '',
74
+ '[Intro - Synth Rise & Vocal Chop]',
75
+ 'yeah',
76
+ 'turn it up',
77
+ '',
78
+ '[Verse 1 - Trap Rap]',
79
+ 'Click-clack, camera flash, we never miss',
80
+ 'Run the board, every move calculated',
81
+ 'Big bass hit when I step in the frame',
82
+ 'Too fast, they can never say my name',
83
+ '',
84
+ '[Pre-Chorus - R&B]',
85
+ 'Pull me closer, slow it down',
86
+ 'Heartbeat under the sound',
87
+ '',
88
+ '[Chorus - Pop Explosion]',
89
+ 'Boom, boom, feel it in your chest',
90
+ 'When the beat drop, we the best',
91
+ 'Hands up high, do not overthink',
92
+ 'Say my name, make the whole world blink',
93
+ ].join('\n'),
94
+ ),
95
+ seed: v.seed(42),
96
+ model: v.choice(['turbo', 'xl turbo', 'xl sft', 'xl base'], 'turbo', 'model'),
97
+ // the encoder plans the song to this length, the latent is sized to it
98
+ seconds: v.float(120, { min: 10, max: 600 }),
99
+ bpm: v.int(190, { min: 10, max: 300 }),
100
+ key: v.choice(KEYS, 'E minor', 'key'),
101
+ language: v.choice(['en', 'fr', 'es', 'de', 'it', 'pt', 'ja', 'ko', 'zh'], 'en', 'language'),
102
+ },
103
+ build: (b, vars) => {
104
+ const m = MODELS[vars.model]
105
+ const [captionLine, ...lyricLines] = vars.prompt.positive.split('\n')
106
+ // a 0.6b qwen embeds the text, a larger one writes the audio codes the dit follows
107
+ const positive = b['TextEncodeAceStepAudio1.5']({
108
+ clip: b.DualCLIPLoader({
109
+ clip_name1: 'qwen_0.6b_ace15.safetensors',
110
+ clip_name2: m.lm,
111
+ type: 'ace',
112
+ device: 'default',
113
+ }),
114
+ tags: captionLine ?? '',
115
+ lyrics: lyricLines.join('\n').trim(),
116
+ seed: vars.seed,
117
+ bpm: vars.bpm,
118
+ duration: vars.seconds,
119
+ timesignature: '4',
120
+ language: vars.language,
121
+ keyscale: vars.key,
122
+ generate_audio_codes: true,
123
+ cfg_scale: 2,
124
+ temperature: 0.85,
125
+ top_p: m.topP,
126
+ top_k: 0,
127
+ min_p: 0,
128
+ })
129
+ const samples = b.KSampler({
130
+ model: b.ModelSamplingAuraFlow({
131
+ model: b.UNETLoader({ unet_name: m.unet, weight_dtype: 'default' }),
132
+ shift: 3,
133
+ }),
134
+ positive,
135
+ negative: b.ConditioningZeroOut({ conditioning: positive }),
136
+ latent_image: b['EmptyAceStep1.5LatentAudio']({ seconds: vars.seconds, batch_size: 1 }),
137
+ seed: vars.seed,
138
+ steps: m.steps,
139
+ cfg: m.cfg,
140
+ sampler_name: 'euler',
141
+ scheduler: 'simple',
142
+ denoise: 1,
143
+ })
144
+ b.SaveAudioAdvanced({
145
+ audio: b.VAEDecodeAudio({ samples, vae: b.VAELoader({ vae_name: 'ace_1.5_vae.safetensors' }) }),
146
+ filename_prefix: 'comfy-ts-zoo/ace-step15-t2a',
147
+ format: 'mp3',
148
+ 'format.quality': 'V0',
149
+ })
150
+ },
151
+ })
152
+
153
+ export default aceStep15T2a
154
+
155
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
156
+ if (import.meta.main) {
157
+ requireCloudKey()
158
+ if (process.argv[2]) aceStep15T2a.vars.prompt.set(process.argv[2])
159
+ if (process.argv[3]) aceStep15T2a.vars.seed.set(Number(process.argv[3]))
160
+ const execution = await aceStep15T2a.run({ log: true, save: { prefix: 'comfy-ts-zoo/ace-step15-t2a' } })
161
+ for (const audio of execution.audios) console.log(`🟢 ${audio.absPath}`)
162
+ host.disconnect()
163
+ }
@@ -0,0 +1,57 @@
1
+ // anima t2i base on Comfy Cloud — Anima base v1.0 (anime UNET, qwen3 text encoder), the released base model after the previews
2
+ // source template: image_anima_base_v1.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/anima-t2i-base.cflow.ts ["prompt"] [seed]
5
+ import { v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ export const animaT2iBase = host.defineWorkflow({
11
+ id: 'anima-t2i-base',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'Anime monochrome cyberpunk front portrait, male figure, sleek skin with delicate mechanical lines, piercing glowing eyes, partially exposed metallic mecha components and light cables, sharp cool style, textured anime brushwork, faint circuit background, high contrast chiaroscuro lighting, ultra fine details, futuristic dystopian mood\n- worst quality, low quality, score_1, score_2, score_3, blurry, jpeg artifacts, sepia',
16
+ ),
17
+ seed: v.seed(42),
18
+ // template defaults: 30 steps / cfg 4 (its optional 8-step turbo lora branch ships off, dropped here)
19
+ steps: v.int(30, { min: 1, max: 60 }),
20
+ cfg: v.float(4, { min: 0, max: 30 }),
21
+ size: v.size({ width: 1024, height: 1024 }),
22
+ },
23
+ build: (b, vars) => {
24
+ const clip = b.CLIPLoader({
25
+ clip_name: 'qwen_3_06b_base.safetensors',
26
+ type: 'stable_diffusion',
27
+ device: 'default',
28
+ })
29
+ const samples = b.KSampler({
30
+ model: b.UNETLoader({ unet_name: 'anima-base-v1.0.safetensors', weight_dtype: 'default' }),
31
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
32
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
33
+ latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
34
+ seed: vars.seed,
35
+ steps: vars.steps,
36
+ cfg: vars.cfg,
37
+ sampler_name: 'euler',
38
+ scheduler: 'simple',
39
+ denoise: 1,
40
+ })
41
+ b.SaveImageWebsocket({
42
+ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'qwen_image_vae.safetensors' }) }),
43
+ })
44
+ },
45
+ })
46
+
47
+ export default animaT2iBase
48
+
49
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
50
+ if (import.meta.main) {
51
+ requireCloudKey()
52
+ if (process.argv[2]) animaT2iBase.vars.prompt.set(process.argv[2])
53
+ if (process.argv[3]) animaT2iBase.vars.seed.set(Number(process.argv[3]))
54
+ const execution = await animaT2iBase.run({ log: true, save: { prefix: 'comfy-ts-zoo/anima-t2i-base' } })
55
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
56
+ host.disconnect()
57
+ }
@@ -0,0 +1,55 @@
1
+ // boogu t2i on Comfy Cloud — Boogu Image 0.1 Turbo fp8, 4-step distilled text to image (lcm, cfg 1, qwen3vl text encoder)
2
+ // source template: image_boogu_image_0_1_turbo_t2i.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/boogu-t2i.cflow.ts ["prompt"] [seed]
5
+ import { v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ export const booguT2i = host.defineWorkflow({
11
+ id: 'boogu-t2i',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'Abstract close-up portrait of a young man wearing a cream turtleneck, captured with severe horizontal motion blur and double exposure effect that distorts his facial features, rendered in an analog film grain style with muted earthy background tones, framed tightly on his face to emphasize the blur streaks across his eyes, nose, and lips while retaining the texture of the knit collar and soft ambient lighting.',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(4, { min: 1, max: 30 }),
19
+ size: v.size({ width: 1024, height: 1024 }),
20
+ },
21
+ build: (b, vars) => {
22
+ const clip = b.CLIPLoader({ clip_name: 'qwen3vl_8b_fp8_scaled.safetensors', type: 'boogu', device: 'default' })
23
+ const positive = b.CLIPTextEncode({ clip, text: vars.prompt.positive })
24
+ // turbo distill: no negative lines → zeroed-out conditioning (the template's own default)
25
+ const negative =
26
+ vars.prompt.negative === ''
27
+ ? b.ConditioningZeroOut({ conditioning: positive })
28
+ : b.CLIPTextEncode({ clip, text: vars.prompt.negative })
29
+ const samples = b.KSampler({
30
+ model: b.UNETLoader({ unet_name: 'boogu_image_turbo_fp8_scaled.safetensors', weight_dtype: 'default' }),
31
+ positive,
32
+ negative,
33
+ latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
34
+ seed: vars.seed,
35
+ steps: vars.steps,
36
+ cfg: 1,
37
+ sampler_name: 'lcm',
38
+ scheduler: 'sgm_uniform',
39
+ denoise: 1,
40
+ })
41
+ b.SaveImageWebsocket({ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }) })
42
+ },
43
+ })
44
+
45
+ export default booguT2i
46
+
47
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
48
+ if (import.meta.main) {
49
+ requireCloudKey()
50
+ if (process.argv[2]) booguT2i.vars.prompt.set(process.argv[2])
51
+ if (process.argv[3]) booguT2i.vars.seed.set(Number(process.argv[3]))
52
+ const execution = await booguT2i.run({ log: true, save: { prefix: 'comfy-ts-zoo/boogu-t2i' } })
53
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
54
+ host.disconnect()
55
+ }
@@ -0,0 +1,95 @@
1
+ // chronoedit i2i on Comfy Cloud — NVIDIA ChronoEdit 14B (a Wan2.1 i2v fine-tune): the edit is the last frame of a 5-frame video from the input image
2
+ // source template: image_chrono_edit_14B.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/chronoedit-i2i.cflow.ts [path/to/image.png] ["edit prompt"] [seed]
5
+ import { asAbsolutePath, exampleImagePath, MediaImage, v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ // bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
11
+ const image = v.image(exampleImagePath('lioness_768x768.jpg'))
12
+
13
+ export const chronoeditI2i = host.defineWorkflow({
14
+ id: 'chronoedit-i2i',
15
+ vars: {
16
+ image,
17
+ // ONE prompt var: describe the edited picture; the `- ` line is the template's own wan negative (standard Chinese quality list)
18
+ prompt: v.prompt(
19
+ [
20
+ 'The lioness wears a small golden crown, same pose, same background, photorealistic, high detail.',
21
+ '- 色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走',
22
+ ].join('\n'),
23
+ ),
24
+ seed: v.seed(42),
25
+ steps: v.int(20, { min: 1, max: 60 }),
26
+ cfg: v.float(4, { min: 1, max: 10 }),
27
+ },
28
+ // async build: the input image is uploaded (hash-named, deduped) per run
29
+ build: async (b, vars, wf) => {
30
+ const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
31
+ const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
32
+
33
+ const clip = b.CLIPLoader({ clip_name: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', type: 'wan', device: 'default' })
34
+ const vae = b.VAELoader({ vae_name: 'wan_2.1_vae.safetensors' })
35
+ // the temporal rope stretched x7: five frames travel as far as a long clip would
36
+ const model = b.ScaleROPE({
37
+ model: b.ModelSamplingSD3({
38
+ model: b.UNETLoader({ unet_name: 'chrono_edit_14B_fp16.safetensors', weight_dtype: 'fp8_e4m3fn' }),
39
+ shift: 5,
40
+ }),
41
+ scale_x: 1,
42
+ shift_x: 0,
43
+ scale_y: 1,
44
+ shift_y: 0,
45
+ scale_t: 7,
46
+ shift_t: 0,
47
+ })
48
+
49
+ // the input image is the first frame, also seen by clip vision
50
+ const video = b.WanImageToVideo({
51
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
52
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
53
+ vae,
54
+ clip_vision_output: b.CLIPVisionEncode({
55
+ clip_vision: b.CLIPVisionLoader({ clip_name: 'clip_vision_h.safetensors' }),
56
+ image: loaded,
57
+ crop: 'none',
58
+ }),
59
+ start_image: loaded,
60
+ width: 720,
61
+ height: 720,
62
+ length: 5,
63
+ batch_size: 1,
64
+ })
65
+ const samples = b.KSampler({
66
+ model,
67
+ positive: video.outputs.positive,
68
+ negative: video.outputs.negative,
69
+ latent_image: video.outputs.latent,
70
+ seed: vars.seed,
71
+ steps: vars.steps,
72
+ cfg: vars.cfg,
73
+ sampler_name: 'uni_pc',
74
+ scheduler: 'simple',
75
+ denoise: 1,
76
+ })
77
+ // frame 4 of 0..4: the finished edit
78
+ b.SaveImageWebsocket({
79
+ images: b.ImageFromBatch({ image: b.VAEDecode({ samples, vae }), batch_index: 4, length: 1 }),
80
+ })
81
+ },
82
+ })
83
+
84
+ export default chronoeditI2i
85
+
86
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
87
+ if (import.meta.main) {
88
+ requireCloudKey()
89
+ if (process.argv[2]) chronoeditI2i.vars.image.set(process.argv[2])
90
+ if (process.argv[3]) chronoeditI2i.vars.prompt.set(process.argv[3])
91
+ if (process.argv[4]) chronoeditI2i.vars.seed.set(Number(process.argv[4]))
92
+ const execution = await chronoeditI2i.run({ log: true, save: { prefix: 'comfy-ts-zoo/chronoedit-i2i' } })
93
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
94
+ host.disconnect()
95
+ }
@@ -0,0 +1,81 @@
1
+ // ernie t2i base on Comfy Cloud — ERNIE Image (Baidu), the undistilled model: 20 steps at cfg 4, with its own prompt enhancer (flux2 vae)
2
+ // source template: image_ernie_image.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/ernie-t2i-base.cflow.ts ["prompt"] [seed]
5
+ import { v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ // the enhancer's chat turn, verbatim from the template: the short description and the target size go in, a rich description comes out
11
+ const ENHANCER_TURN =
12
+ '<s>[SYSTEM_PROMPT]你是一个专业的文生图 Prompt 增强助手。你将收到用户的简短图片描述及目标生成分辨率,请据此扩写为一段内容丰富、细节充分的视觉描述,以帮助文生图模型生成高质量的图片。仅输出增强后的描述,不要包含任何解释或前缀。[/SYSTEM_PROMPT][INST]{"prompt": "{prompt}", "width": {width}, "height": {height}}[/INST]'
13
+
14
+ export const ernieT2iBase = host.defineWorkflow({
15
+ id: 'ernie-t2i-base',
16
+ vars: {
17
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
18
+ prompt: v.prompt(
19
+ 'High-fashion summer outfit infographic: a straw hat, a sleeveless organic cotton top, a flowing pleated skirt, handcrafted leather sandals and a woven palm leaf handbag float in an elegant circular composition, with fine annotations on fabric and comfort. Warm neutral palette of ivory, terracotta, sand and soft tan, gentle fabric swirls, bright natural sunlight, Mediterranean style.',
20
+ ),
21
+ seed: v.seed(42),
22
+ // on: ERNIE's prompt enhancer model first expands the description for the target size
23
+ enhance: v.toggle(true, 'enhance prompt'),
24
+ steps: v.int(20, { min: 1, max: 80 }),
25
+ cfg: v.float(4, { min: 1, max: 10 }),
26
+ size: v.size({ width: 1024, height: 1024 }),
27
+ },
28
+ build: (b, vars) => {
29
+ const clip = b.CLIPLoader({ clip_name: 'ministral-3-3b.safetensors', type: 'flux2', device: 'default' })
30
+ const text = vars.enhance
31
+ ? b.TextGenerate({
32
+ clip: b.CLIPLoader({
33
+ clip_name: 'ernie-image-prompt-enhancer.safetensors',
34
+ type: 'flux2',
35
+ device: 'default',
36
+ }),
37
+ prompt: ENHANCER_TURN.replace('{prompt}', vars.prompt.positive)
38
+ .replace('{width}', String(vars.size.width))
39
+ .replace('{height}', String(vars.size.height)),
40
+ max_length: 2048,
41
+ sampling_mode: 'on',
42
+ 'sampling_mode.temperature': 0.6,
43
+ 'sampling_mode.top_k': 64,
44
+ 'sampling_mode.top_p': 0.8,
45
+ 'sampling_mode.min_p': 0.05,
46
+ 'sampling_mode.repetition_penalty': 1.05,
47
+ 'sampling_mode.seed': 0,
48
+ thinking: false,
49
+ use_default_template: true,
50
+ mtp: 'auto',
51
+ }).outputs.generated_text
52
+ : vars.prompt.positive
53
+ const samples = b.KSampler({
54
+ model: b.UNETLoader({ unet_name: 'ernie-image.safetensors', weight_dtype: 'default' }),
55
+ positive: b.CLIPTextEncode({ clip, text }),
56
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
57
+ latent_image: b.EmptyFlux2LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
58
+ seed: vars.seed,
59
+ steps: vars.steps,
60
+ cfg: vars.cfg,
61
+ sampler_name: 'euler',
62
+ scheduler: 'simple',
63
+ denoise: 1,
64
+ })
65
+ b.SaveImageWebsocket({
66
+ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'flux2-vae.safetensors' }) }),
67
+ })
68
+ },
69
+ })
70
+
71
+ export default ernieT2iBase
72
+
73
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
74
+ if (import.meta.main) {
75
+ requireCloudKey()
76
+ if (process.argv[2]) ernieT2iBase.vars.prompt.set(process.argv[2])
77
+ if (process.argv[3]) ernieT2iBase.vars.seed.set(Number(process.argv[3]))
78
+ const execution = await ernieT2iBase.run({ log: true, save: { prefix: 'comfy-ts-zoo/ernie-t2i-base' } })
79
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
80
+ host.disconnect()
81
+ }
@@ -0,0 +1,63 @@
1
+ // flux1 t2i krea on Comfy Cloud — FLUX.1 Krea Dev fp8 (UNET + dual CLIP), the photoreal aesthetic fine-tune of Flux.1 Dev: cfg 1, zeroed negative
2
+ // source template: flux1_krea_dev.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/flux1-t2i-krea.cflow.ts ["prompt"] [seed]
5
+ import { v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ export const flux1T2iKrea = host.defineWorkflow({
11
+ id: 'flux1-t2i-krea',
12
+ vars: {
13
+ prompt: v.prompt(
14
+ 'Highly realistic portrait of a Nordic woman with blonde hair and blue eyes, gaze sharp and intellectual, the cool light of Northern Europe. Minimalist modern outfit, background blurred in cool tones. Solo, centered composition.',
15
+ ),
16
+ seed: v.seed(42),
17
+ steps: v.int(20, { min: 1, max: 50 }),
18
+ size: v.size({ width: 1024, height: 1024 }),
19
+ },
20
+ build: (b, vars) => {
21
+ const model = b.UNETLoader({ unet_name: 'flux1-krea-dev_fp8_scaled.safetensors', weight_dtype: 'default' })
22
+ const clip = b.DualCLIPLoader({
23
+ clip_name1: 'clip_l.safetensors',
24
+ clip_name2: 't5xxl_fp16.safetensors',
25
+ type: 'flux',
26
+ device: 'default',
27
+ })
28
+ const vae = b.VAELoader({ vae_name: 'ae.safetensors' })
29
+
30
+ const positive = b.CLIPTextEncode({ clip, text: vars.prompt.positive })
31
+ // distilled model ignores cfg: empty negative stays zeroed out, like the template
32
+ const negative =
33
+ vars.prompt.negative === ''
34
+ ? b.ConditioningZeroOut({ conditioning: positive })
35
+ : b.CLIPTextEncode({ clip, text: vars.prompt.negative })
36
+
37
+ const samples = b.KSampler({
38
+ model,
39
+ positive,
40
+ negative,
41
+ latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
42
+ seed: vars.seed,
43
+ steps: vars.steps,
44
+ cfg: 1,
45
+ sampler_name: 'euler',
46
+ scheduler: 'simple',
47
+ denoise: 1,
48
+ })
49
+ b.SaveImageWebsocket({ images: b.VAEDecode({ samples, vae }) })
50
+ },
51
+ })
52
+
53
+ export default flux1T2iKrea
54
+
55
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
56
+ if (import.meta.main) {
57
+ requireCloudKey()
58
+ if (process.argv[2]) flux1T2iKrea.vars.prompt.set(process.argv[2])
59
+ if (process.argv[3]) flux1T2iKrea.vars.seed.set(Number(process.argv[3]))
60
+ const execution = await flux1T2iKrea.run({ log: true, save: { prefix: 'comfy-ts-zoo/flux1-t2i-krea' } })
61
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
62
+ host.disconnect()
63
+ }
@@ -0,0 +1,83 @@
1
+ // flux2 i2i dev on Comfy Cloud — FLUX.2 Dev fp8mixed (32B, mistral 3 small text encoder), prompt-driven image edit through a reference latent
2
+ // source template: image_flux2.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/flux2-i2i-dev.cflow.ts [path/to/image.png] ["edit prompt"] [seed]
5
+ import { asAbsolutePath, exampleImagePath, MediaImage, v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ // bundled default input (examples/images/, ships in the tarball) — the TUI picker or argv[2] swap it
11
+ const image = v.image(exampleImagePath('bear_1024x1024.jpg'))
12
+
13
+ export const flux2I2iDev = host.defineWorkflow({
14
+ id: 'flux2-i2i-dev',
15
+ vars: {
16
+ image,
17
+ // ONE prompt var, positive only: the guidance is baked into the model, no negative branch
18
+ prompt: v.prompt(
19
+ 'The bear is wearing a small pale yellow knitted beanie, with a white fabric patch on the front embroidered with big gray text "FLUX.2 COMFY". Keep everything else unchanged.',
20
+ ),
21
+ seed: v.seed(42),
22
+ // template defaults: 20 steps (its optional 8-step turbo lora branch ships off, dropped here)
23
+ steps: v.int(20, { min: 1, max: 60 }),
24
+ guidance: v.float(4, { min: 1, max: 10 }),
25
+ },
26
+ // async build: the input image is uploaded (hash-named, deduped) per run
27
+ build: async (b, vars, wf) => {
28
+ const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
29
+ const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
30
+
31
+ const model = b.UNETLoader({ unet_name: 'flux2_dev_fp8mixed.safetensors', weight_dtype: 'default' })
32
+ const clip = b.CLIPLoader({
33
+ clip_name: 'mistral_3_small_flux2_bf16.safetensors',
34
+ type: 'flux2',
35
+ device: 'default',
36
+ })
37
+ const vae = b.VAELoader({ vae_name: 'full_encoder_small_decoder.safetensors' })
38
+
39
+ // reference image → ~1MP; its size drives both the latent and the scheduler
40
+ const scaled = b.ImageScaleToTotalPixels({
41
+ image: loaded,
42
+ upscale_method: 'lanczos',
43
+ megapixels: 1,
44
+ resolution_steps: 1,
45
+ })
46
+ const size = b.GetImageSize({ image: scaled })
47
+
48
+ const samples = b.SamplerCustomAdvanced({
49
+ noise: b.RandomNoise({ noise_seed: vars.seed }),
50
+ guider: b.BasicGuider({
51
+ model,
52
+ conditioning: b.ReferenceLatent({
53
+ conditioning: b.FluxGuidance({
54
+ conditioning: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
55
+ guidance: vars.guidance,
56
+ }),
57
+ latent: b.VAEEncode({ pixels: scaled, vae }),
58
+ }),
59
+ }),
60
+ sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
61
+ sigmas: b.Flux2Scheduler({ steps: vars.steps, width: size.outputs.width, height: size.outputs.height }),
62
+ latent_image: b.EmptyFlux2LatentImage({
63
+ width: size.outputs.width,
64
+ height: size.outputs.height,
65
+ batch_size: 1,
66
+ }),
67
+ })
68
+ b.SaveImageWebsocket({ images: b.VAEDecode({ samples: samples.outputs.output, vae }) })
69
+ },
70
+ })
71
+
72
+ export default flux2I2iDev
73
+
74
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
75
+ if (import.meta.main) {
76
+ requireCloudKey()
77
+ if (process.argv[2]) flux2I2iDev.vars.image.set(process.argv[2])
78
+ if (process.argv[3]) flux2I2iDev.vars.prompt.set(process.argv[3])
79
+ if (process.argv[4]) flux2I2iDev.vars.seed.set(Number(process.argv[4]))
80
+ const execution = await flux2I2iDev.run({ log: true, save: { prefix: 'comfy-ts-zoo/flux2-i2i-dev' } })
81
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
82
+ host.disconnect()
83
+ }
@@ -0,0 +1,60 @@
1
+ // flux2 t2i dev on Comfy Cloud — FLUX.2 Dev fp8mixed (32B, mistral 3 small text encoder), guidance-distilled text to image
2
+ // source template: image_flux2_text_to_image.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/flux2-t2i-dev.cflow.ts ["prompt"] [seed]
5
+ import { v } from 'comfy-ts'
6
+ import { cloudHost, requireCloudKey } from './cloudHost.ts'
7
+
8
+ const host = await cloudHost()
9
+
10
+ export const flux2T2iDev = host.defineWorkflow({
11
+ id: 'flux2-t2i-dev',
12
+ vars: {
13
+ // ONE prompt var, positive only: the guidance is baked into the model, no negative branch
14
+ prompt: v.prompt(
15
+ 'high fashion, vintage couture, street photography, luxury fashion shoot, neo brutalist architecture, pastel paints',
16
+ ),
17
+ seed: v.seed(42),
18
+ // template defaults: 20 steps (its optional 8-step turbo lora branch ships off, dropped here)
19
+ steps: v.int(20, { min: 1, max: 60 }),
20
+ guidance: v.float(4, { min: 1, max: 10 }),
21
+ size: v.size({ width: 1024, height: 1024 }),
22
+ },
23
+ build: (b, vars) => {
24
+ const model = b.UNETLoader({ unet_name: 'flux2_dev_fp8mixed.safetensors', weight_dtype: 'default' })
25
+ const clip = b.CLIPLoader({
26
+ clip_name: 'mistral_3_small_flux2_bf16.safetensors',
27
+ type: 'flux2',
28
+ device: 'default',
29
+ })
30
+ // full encoder, small decoder: the lighter flux2 vae the template picks
31
+ const vae = b.VAELoader({ vae_name: 'full_encoder_small_decoder.safetensors' })
32
+
33
+ const samples = b.SamplerCustomAdvanced({
34
+ noise: b.RandomNoise({ noise_seed: vars.seed }),
35
+ guider: b.BasicGuider({
36
+ model,
37
+ conditioning: b.FluxGuidance({
38
+ conditioning: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
39
+ guidance: vars.guidance,
40
+ }),
41
+ }),
42
+ sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
43
+ sigmas: b.Flux2Scheduler({ steps: vars.steps, width: vars.size.width, height: vars.size.height }),
44
+ latent_image: b.EmptyFlux2LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
45
+ })
46
+ b.SaveImageWebsocket({ images: b.VAEDecode({ samples: samples.outputs.output, vae }) })
47
+ },
48
+ })
49
+
50
+ export default flux2T2iDev
51
+
52
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
53
+ if (import.meta.main) {
54
+ requireCloudKey()
55
+ if (process.argv[2]) flux2T2iDev.vars.prompt.set(process.argv[2])
56
+ if (process.argv[3]) flux2T2iDev.vars.seed.set(Number(process.argv[3]))
57
+ const execution = await flux2T2iDev.run({ log: true, save: { prefix: 'comfy-ts-zoo/flux2-t2i-dev' } })
58
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
59
+ host.disconnect()
60
+ }