comfy-ts 0.4.0 → 1.1.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 (158) hide show
  1. package/README.md +385 -255
  2. package/dist/DefinedWorkflow-BYyu5dK9.js +669 -0
  3. package/dist/DefinedWorkflow-BYyu5dK9.js.map +1 -0
  4. package/dist/cli.js +4106 -152
  5. package/dist/cli.js.map +1 -1
  6. package/dist/index.cjs +1560 -333
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +7826 -467
  9. package/dist/index.d.ts +7808 -449
  10. package/dist/index.js +1550 -333
  11. package/dist/index.js.map +1 -1
  12. package/dist/{run-tui-SDSJo1Qf.js → run-tui-DZ22HDHI.js} +631 -657
  13. package/dist/run-tui-DZ22HDHI.js.map +1 -0
  14. package/examples/01-txt2img.cflow.ts +50 -0
  15. package/examples/02-img2img-upload.cflow.ts +55 -0
  16. package/examples/03-export-workflow-json.cflow.ts +56 -0
  17. package/examples/04-krea2-turbo-t2i.cflow.ts +125 -0
  18. package/examples/05-comfy-cloud.cflow.ts +51 -0
  19. package/examples/README.md +30 -0
  20. package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
  21. package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
  22. package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
  23. package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
  24. package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
  25. package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
  26. package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
  27. package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
  28. package/examples/comfy-cloud/cloudHost.ts +41 -0
  29. package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
  30. package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
  31. package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
  32. package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
  33. package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
  34. package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
  35. package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
  36. package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
  37. package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
  38. package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
  39. package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
  40. package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
  41. package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
  42. package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
  43. package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
  44. package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
  45. package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
  46. package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
  47. package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
  48. package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
  49. package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
  50. package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
  51. package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
  52. package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
  53. package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
  54. package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
  55. package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
  56. package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
  57. package/examples/comfy-cloud/sdk.d.ts +123062 -0
  58. package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
  59. package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
  60. package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
  61. package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
  62. package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
  63. package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
  64. package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
  65. package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
  66. package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
  67. package/examples/images/README.md +18 -0
  68. package/examples/images/bear_1024x1024.jpg +0 -0
  69. package/examples/images/deer_768x1344.jpg +0 -0
  70. package/examples/images/dog_512x512.jpg +0 -0
  71. package/examples/images/lioness_768x768.jpg +0 -0
  72. package/examples/images/pug_200x300.jpg +0 -0
  73. package/examples/images/walrus_1344x768.jpg +0 -0
  74. package/guide-for-agents.md +172 -0
  75. package/package.json +20 -4
  76. package/src/cli/comfy-ts-cli.ts +19 -2
  77. package/src/cli/gen.ts +21 -12
  78. package/src/cli/tui/components/PreviewPanel.tsx +9 -8
  79. package/src/cli/tui/components/StatusBar.tsx +11 -0
  80. package/src/cli/tui/components/TreePanel.tsx +15 -2
  81. package/src/cli/tui/components/TuiApp.tsx +18 -0
  82. package/src/cli/tui/discoverWorkflows.ts +45 -0
  83. package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
  84. package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
  85. package/src/cli/tui/imagePicker/fsListing.ts +46 -0
  86. package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
  87. package/src/cli/tui/run-tui.tsx +52 -23
  88. package/src/cli/tui/state/HostSt.ts +2 -3
  89. package/src/cli/tui/state/LorasSt.ts +14 -36
  90. package/src/cli/tui/state/PreviewSt.ts +28 -2
  91. package/src/cli/tui/state/TreeSt.ts +30 -6
  92. package/src/cli/tui/state/TuiSt.ts +27 -3
  93. package/src/cli/tui/state/WorkflowsSt.ts +15 -1
  94. package/src/exampleAssets.ts +56 -0
  95. package/src/graph/ComfyNode.ts +4 -1
  96. package/src/host/ComfyHost.ts +203 -77
  97. package/src/host/ComfyManager.ts +10 -9
  98. package/src/host/ComfyUploader.ts +1 -2
  99. package/src/host/ResilientWebsocket.ts +3 -1
  100. package/src/host/hostUrl.ts +59 -0
  101. package/src/host/loraManagerApi.ts +5 -4
  102. package/src/index.ts +27 -1
  103. package/src/litegraph/CanonicalWorkflow.ts +77 -0
  104. package/src/litegraph/LiteGraphGroup.ts +9 -7
  105. package/src/litegraph/LiteGraphJSON.ts +34 -13
  106. package/src/litegraph/LiteGraphLink.ts +32 -2
  107. package/src/litegraph/LiteGraphNode.ts +18 -33
  108. package/src/litegraph/LiteGraphNodeInput.ts +10 -8
  109. package/src/litegraph/LiteGraphNodeOutput.ts +2 -3
  110. package/src/litegraph/LiteGraphSubgraphDef.ts +74 -0
  111. package/src/litegraph/convertFlowToLiteGraphJSON.ts +4 -4
  112. package/src/litegraph/expandSubgraphs.ts +352 -0
  113. package/src/litegraph/normalizeWorkflow.ts +141 -0
  114. package/src/manager/ComfyRegistry.ts +37 -9
  115. package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
  116. package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
  117. package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
  118. package/src/manager/generated/KnownModel_Base.ts +23 -7
  119. package/src/manager/generated/KnownModel_FileName.ts +421 -0
  120. package/src/manager/generated/KnownModel_Name.ts +421 -0
  121. package/src/manager/generated/KnownModel_SavePath.ts +34 -8
  122. package/src/manager/generated/KnownModel_Type.ts +18 -14
  123. package/src/manager/json/alter-list.json +221 -221
  124. package/src/manager/json/custom-node-list.json +61020 -21946
  125. package/src/manager/json/extension-node-map.json +81077 -31176
  126. package/src/manager/json/github-stats.json +29321 -12601
  127. package/src/manager/json/model-list.json +5935 -4997
  128. package/src/manager/loaders/parseReport.ts +55 -0
  129. package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
  130. package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
  131. package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
  132. package/src/manager/loaders/step4_model-list-loader.ts +25 -36
  133. package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
  134. package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
  135. package/src/manager/script-update-manager.bun.ts +9 -1
  136. package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
  137. package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
  138. package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
  139. package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
  140. package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
  141. package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
  142. package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
  143. package/src/runner/ComfyExecution.ts +4 -5
  144. package/src/runner/ComfyWorkflow.ts +2 -2
  145. package/src/runner/wsBinaryFrame.ts +48 -0
  146. package/src/sdk-generator/ComfySchema.ts +14 -1
  147. package/src/sdk-generator/Primitives.ts +6 -24
  148. package/src/sdk-generator/comfy-api-json.ts +3 -1
  149. package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
  150. package/src/sdk-generator/inputWidgetKind.ts +196 -0
  151. package/src/sdk-generator/litegraphToApiRequestPayload.ts +372 -96
  152. package/src/state.ts +13 -2
  153. package/src/vars/ComfyVars.ts +82 -2
  154. package/src/vars/DefinedWorkflow.ts +7 -2
  155. package/dist/log-CdfgILde.js +0 -10
  156. package/dist/log-CdfgILde.js.map +0 -1
  157. package/dist/run-tui-SDSJo1Qf.js.map +0 -1
  158. package/src/utils/tryExtracting.ts +0 -41
@@ -0,0 +1,60 @@
1
+ // kandinsky5 t2i on Comfy Cloud — Kandinsky 5.0 Lite text to image (Qwen2.5-VL + clip_l dual encoder, flux ae VAE)
2
+ // source template: image_kandinsky5_t2i.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/kandinsky5-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 kandinsky5T2i = host.defineWorkflow({
11
+ id: 'kandinsky5-t2i',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'a joyful hiker in a mustard-yellow knit beanie and chunky sweater, jagged Dolomites peaks behind, warm golden-amber vintage filter, subtle film grain, crisp saturated blue sky',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(50, { min: 1, max: 60 }),
19
+ cfg: v.float(3.5, { min: 0, max: 30 }),
20
+ size: v.size({ width: 1024, height: 1024 }),
21
+ },
22
+ build: (b, vars) => {
23
+ const model = b.ModelSamplingSD3({
24
+ model: b.UNETLoader({ unet_name: 'kandinsky5lite_t2i.safetensors', weight_dtype: 'default' }),
25
+ shift: 3,
26
+ })
27
+ const clip = b.DualCLIPLoader({
28
+ clip_name1: 'qwen_2.5_vl_7b_fp8_scaled.safetensors',
29
+ clip_name2: 'clip_l.safetensors',
30
+ type: 'kandinsky5_image',
31
+ device: 'default',
32
+ })
33
+ const vae = b.VAELoader({ vae_name: 'ae.safetensors' })
34
+ const samples = b.KSampler({
35
+ model,
36
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
37
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
38
+ latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
39
+ seed: vars.seed,
40
+ steps: vars.steps,
41
+ cfg: vars.cfg,
42
+ sampler_name: 'euler',
43
+ scheduler: 'simple',
44
+ denoise: 1,
45
+ })
46
+ b.SaveImage({ images: b.VAEDecode({ samples, vae }), filename_prefix: 'comfy-ts-zoo/kandinsky5-t2i' })
47
+ },
48
+ })
49
+
50
+ export default kandinsky5T2i
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]) kandinsky5T2i.vars.prompt.set(process.argv[2])
56
+ if (process.argv[3]) kandinsky5T2i.vars.seed.set(Number(process.argv[3]))
57
+ const execution = await kandinsky5T2i.run({ log: true })
58
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
59
+ host.disconnect()
60
+ }
@@ -0,0 +1,78 @@
1
+ // kandinsky5 t2v on Comfy Cloud — Kandinsky 5.0 Lite text to video, 5s @ 24fps (hunyuan video VAE)
2
+ // source template: video_kandinsky5_t2v.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/kandinsky5-t2v.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 kandinsky5T2v = host.defineWorkflow({
11
+ id: 'kandinsky5-t2v',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'a woman with fluffy brown curly hair in a flowing white dress stands before a magnificent stained glass window at sunset, warm low-saturation tones, rim light, medium close-up, colorful light and shadow, cinematic',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(50, { min: 1, max: 60 }),
19
+ cfg: v.float(5, { min: 0, max: 30 }),
20
+ size: v.size({ width: 768, height: 512 }),
21
+ length: v.int(121, { min: 1, max: 241 }),
22
+ fps: v.int(24, { min: 1, max: 60 }),
23
+ },
24
+ build: (b, vars) => {
25
+ const model = b.ModelSamplingSD3({
26
+ model: b.UNETLoader({ unet_name: 'kandinsky5lite_t2v_sft_5s.safetensors', weight_dtype: 'default' }),
27
+ shift: 5,
28
+ })
29
+ const clip = b.DualCLIPLoader({
30
+ clip_name1: 'qwen_2.5_vl_7b_fp8_scaled.safetensors',
31
+ clip_name2: 'clip_l.safetensors',
32
+ type: 'kandinsky5',
33
+ device: 'default',
34
+ })
35
+ const vae = b.VAELoader({ vae_name: 'hunyuan_video_vae_bf16.safetensors' })
36
+ // conditioning + empty video latent come pre-packaged from the same node
37
+ const video = b.Kandinsky5ImageToVideo({
38
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
39
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
40
+ vae,
41
+ width: vars.size.width,
42
+ height: vars.size.height,
43
+ length: vars.length,
44
+ batch_size: 1,
45
+ })
46
+ const samples = b.KSampler({
47
+ model,
48
+ positive: video.outputs.positive,
49
+ negative: video.outputs.negative,
50
+ latent_image: video.outputs.latent,
51
+ seed: vars.seed,
52
+ steps: vars.steps,
53
+ cfg: vars.cfg,
54
+ sampler_name: 'euler_ancestral',
55
+ scheduler: 'beta',
56
+ denoise: 1,
57
+ })
58
+ b.SaveVideo({
59
+ video: b.CreateVideo({ images: b.VAEDecode({ samples, vae }), fps: vars.fps }),
60
+ filename_prefix: 'comfy-ts-zoo/kandinsky5-t2v',
61
+ format: 'mp4',
62
+ codec: 'h264',
63
+ })
64
+ },
65
+ })
66
+
67
+ export default kandinsky5T2v
68
+
69
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
70
+ if (import.meta.main) {
71
+ requireCloudKey()
72
+ if (process.argv[2]) kandinsky5T2v.vars.prompt.set(process.argv[2])
73
+ if (process.argv[3]) kandinsky5T2v.vars.seed.set(Number(process.argv[3]))
74
+ const execution = await kandinsky5T2v.run({ log: true })
75
+ // SaveVideo outputs land host side (no auto-download for video yet)
76
+ console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/kandinsky5-t2v`)
77
+ host.disconnect()
78
+ }
@@ -0,0 +1,59 @@
1
+ // krea2 t2i on Comfy Cloud — Krea 2 Turbo fp8, 8-step distilled text to image (cfg 1), cloud twin of example 04
2
+ // source template: image_krea2_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/krea2-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 krea2T2i = host.defineWorkflow({
11
+ id: 'krea2-t2i',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'A surreal digital illustration of a hand holding a martini glass, overlaid with whimsical ink-style doodles: a cartoon figure inside the glass, a drawn citrus wedge on the rim, abstract sketches on a clean white background.',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(8, { min: 1, max: 40 }),
19
+ size: v.size({ width: 1024, height: 1024 }),
20
+ },
21
+ build: (b, vars) => {
22
+ const model = b.UNETLoader({ unet_name: 'krea2_turbo_fp8_scaled.safetensors', weight_dtype: 'default' })
23
+ const clip = b.CLIPLoader({ clip_name: 'qwen3vl_4b_fp8_scaled.safetensors', type: 'krea2', device: 'default' })
24
+ const positive = b.CLIPTextEncode({ clip, text: vars.prompt.positive })
25
+ // turbo distill: no negative lines → zeroed-out conditioning (the template's own default)
26
+ const negative =
27
+ vars.prompt.negative === ''
28
+ ? b.ConditioningZeroOut({ conditioning: positive })
29
+ : b.CLIPTextEncode({ clip, text: vars.prompt.negative })
30
+ const samples = b.KSampler({
31
+ model,
32
+ positive,
33
+ negative,
34
+ latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
35
+ seed: vars.seed,
36
+ steps: vars.steps,
37
+ cfg: 1,
38
+ sampler_name: 'euler',
39
+ scheduler: 'simple',
40
+ denoise: 1,
41
+ })
42
+ b.SaveImage({
43
+ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'qwen_image_vae.safetensors' }) }),
44
+ filename_prefix: 'comfy-ts-zoo/krea2-t2i',
45
+ })
46
+ },
47
+ })
48
+
49
+ export default krea2T2i
50
+
51
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
52
+ if (import.meta.main) {
53
+ requireCloudKey()
54
+ if (process.argv[2]) krea2T2i.vars.prompt.set(process.argv[2])
55
+ if (process.argv[3]) krea2T2i.vars.seed.set(Number(process.argv[3]))
56
+ const execution = await krea2T2i.run({ log: true })
57
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
58
+ host.disconnect()
59
+ }
@@ -0,0 +1,62 @@
1
+ // lens t2i on Comfy Cloud — Lens Turbo bf16 (Flux-style UNET), 4-step distilled text to image (cfg 1)
2
+ // source template: image_lens_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/lens-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 lensT2i = host.defineWorkflow({
11
+ id: 'lens-t2i',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'A stylish vintage Porsche driving through a rainy neon city street at night, reflections shimmering across wet pavement, wide neon sign displaying "ComfyUI", glowing shop sign reading "Lens", cinematic atmosphere, moody retro lighting, analog film grain, 1980s movie still aesthetic',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(4, { min: 1, max: 20 }),
19
+ // the template's ResolutionSelector default: 2 megapixels, 1:1, snapped to a multiple of 8
20
+ size: v.size({ width: 1448, height: 1448 }),
21
+ },
22
+ build: (b, vars) => {
23
+ const shifted = b.ModelSamplingFlux({
24
+ model: b.UNETLoader({ unet_name: 'lens_turbo_bf16.safetensors', weight_dtype: 'default' }),
25
+ max_shift: 1.15,
26
+ base_shift: 0.5,
27
+ width: vars.size.width,
28
+ height: vars.size.height,
29
+ })
30
+ const clip = b.CLIPLoader({ clip_name: 'gpt_oss_20b_nvfp4.safetensors', type: 'lens', device: 'default' })
31
+ const samples = b.SamplerCustom({
32
+ model: b.CFGNorm({ model: shifted, strength: 1, pre_cfg: false }),
33
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
34
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
35
+ sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
36
+ sigmas: b.BasicScheduler({ model: shifted, scheduler: 'simple', steps: vars.steps, denoise: 1 }),
37
+ latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
38
+ add_noise: true,
39
+ noise_seed: vars.seed,
40
+ cfg: 1,
41
+ })
42
+ b.SaveImage({
43
+ images: b.VAEDecode({
44
+ samples: samples.outputs.output,
45
+ vae: b.VAELoader({ vae_name: 'flux2-vae.safetensors' }),
46
+ }),
47
+ filename_prefix: 'comfy-ts-zoo/lens-t2i',
48
+ })
49
+ },
50
+ })
51
+
52
+ export default lensT2i
53
+
54
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
55
+ if (import.meta.main) {
56
+ requireCloudKey()
57
+ if (process.argv[2]) lensT2i.vars.prompt.set(process.argv[2])
58
+ if (process.argv[3]) lensT2i.vars.seed.set(Number(process.argv[3]))
59
+ const execution = await lensT2i.run({ log: true })
60
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
61
+ host.disconnect()
62
+ }
@@ -0,0 +1,74 @@
1
+ // longcat i2i on Comfy Cloud — LongCat-Image-Edit (Meituan), instruction-driven image editing
2
+ // source template: image_longcat_image_edit.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/longcat-i2i.cflow.ts [path/to/image.png] ["edit instruction"]
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 longcatI2i = host.defineWorkflow({
14
+ id: 'longcat-i2i',
15
+ vars: {
16
+ image,
17
+ prompt: v.prompt('relight the scene with the warm light of a rising sun, early morning atmosphere'),
18
+ seed: v.seed(42),
19
+ // template defaults: 50 steps, cfg 4.5, guidance 4.5
20
+ steps: v.int(50, { min: 1, max: 60 }),
21
+ cfg: v.float(4.5, { min: 0, max: 30 }),
22
+ guidance: v.float(4.5, { min: 0, max: 20 }),
23
+ },
24
+ // async build: the input image is uploaded (hash-named, deduped) per run
25
+ build: async (b, vars, wf) => {
26
+ const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
27
+ const scaled = b.ImageScaleToTotalPixels({
28
+ image: await img.loadInWorkflow_viaLoadImageNode(wf),
29
+ upscale_method: 'lanczos',
30
+ megapixels: 1,
31
+ resolution_steps: 16,
32
+ })
33
+ const clip = b.CLIPLoader({
34
+ clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors',
35
+ type: 'longcat_image',
36
+ device: 'default',
37
+ })
38
+ const vae = b.VAELoader({ vae_name: 'ae.safetensors' })
39
+ // edit conditioning reads the input image itself: both branches reference it
40
+ const encode = (text: string) =>
41
+ b.FluxKontextMultiReferenceLatentMethod({
42
+ reference_latents_method: 'index',
43
+ conditioning: b.FluxGuidance({
44
+ conditioning: b.TextEncodeQwenImageEdit({ prompt: text, clip, vae, image: scaled }),
45
+ guidance: vars.guidance,
46
+ }),
47
+ })
48
+ const samples = b.KSampler({
49
+ model: b.UNETLoader({ unet_name: 'longcat_image_edit_bf16.safetensors', weight_dtype: 'default' }),
50
+ positive: encode(vars.prompt.positive),
51
+ negative: encode(vars.prompt.negative),
52
+ latent_image: b.VAEEncode({ pixels: scaled, vae }),
53
+ seed: vars.seed,
54
+ steps: vars.steps,
55
+ cfg: vars.cfg,
56
+ sampler_name: 'euler',
57
+ scheduler: 'simple',
58
+ denoise: 1,
59
+ })
60
+ b.SaveImage({ images: b.VAEDecode({ samples, vae }), filename_prefix: 'comfy-ts-zoo/longcat-i2i' })
61
+ },
62
+ })
63
+
64
+ export default longcatI2i
65
+
66
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
67
+ if (import.meta.main) {
68
+ requireCloudKey()
69
+ if (process.argv[2]) longcatI2i.vars.image.set(process.argv[2])
70
+ if (process.argv[3]) longcatI2i.vars.prompt.set(process.argv[3])
71
+ const execution = await longcatI2i.run({ log: true })
72
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
73
+ host.disconnect()
74
+ }
@@ -0,0 +1,65 @@
1
+ // longcat t2i on Comfy Cloud — LongCat-Image (Meituan), flux-style guidance + real negative branch (cfg 4)
2
+ // source template: image_longcat_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/longcat-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 longcatT2i = host.defineWorkflow({
11
+ id: 'longcat-t2i',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ 'high-fashion portrait of a man with a shaved head, round amber sunglasses, dark green turtleneck, monochromatic teal light, solid burnt orange background, hard directional lighting, editorial photography, 8K\n- blurry, low resolution, oversaturated, distorted face, watermark, text, logo',
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(20, { min: 1, max: 60 }),
19
+ cfg: v.float(4, { min: 0, max: 30 }),
20
+ guidance: v.float(4, { min: 0, max: 20 }),
21
+ size: v.size({ width: 1024, height: 1024 }),
22
+ },
23
+ build: (b, vars) => {
24
+ const clip = b.CLIPLoader({
25
+ clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors',
26
+ type: 'longcat_image',
27
+ device: 'default',
28
+ })
29
+ const encode = (text: string) =>
30
+ b.FluxGuidance({ conditioning: b.CLIPTextEncode({ clip, text }), guidance: vars.guidance })
31
+ const model = b.CFGNorm({
32
+ model: b.UNETLoader({ unet_name: 'longcat_image_bf16.safetensors', weight_dtype: 'default' }),
33
+ strength: 1,
34
+ pre_cfg: false,
35
+ })
36
+ const samples = b.KSampler({
37
+ model,
38
+ positive: encode(vars.prompt.positive),
39
+ negative: encode(vars.prompt.negative),
40
+ latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
41
+ seed: vars.seed,
42
+ steps: vars.steps,
43
+ cfg: vars.cfg,
44
+ sampler_name: 'euler',
45
+ scheduler: 'simple',
46
+ denoise: 1,
47
+ })
48
+ b.SaveImage({
49
+ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }),
50
+ filename_prefix: 'comfy-ts-zoo/longcat-t2i',
51
+ })
52
+ },
53
+ })
54
+
55
+ export default longcatT2i
56
+
57
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
58
+ if (import.meta.main) {
59
+ requireCloudKey()
60
+ if (process.argv[2]) longcatT2i.vars.prompt.set(process.argv[2])
61
+ if (process.argv[3]) longcatT2i.vars.seed.set(Number(process.argv[3]))
62
+ const execution = await longcatT2i.run({ log: true })
63
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
64
+ host.disconnect()
65
+ }
@@ -0,0 +1,92 @@
1
+ // ltxv i2v on Comfy Cloud — LTX-Video 2b (v0.9.5) image to video: a start image drives the first frame
2
+ // source template: ltxv_image_to_video.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/ltxv-i2v.cflow.ts [path/to/image.png] ["prompt"]
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('walrus_1344x768.jpg'))
12
+
13
+ export const ltxvI2v = host.defineWorkflow({
14
+ id: 'ltxv-i2v',
15
+ vars: {
16
+ image,
17
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
18
+ prompt: v.prompt(
19
+ 'A red fox moving gracefully, its russet coat vibrant against the white landscape, leaving perfect star-shaped prints behind as steam rises from its breath in the crisp winter air. The scene is wrapped in snow-muffled silence, broken only by the gentle murmur of water still flowing beneath the ice.\n- low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly',
20
+ ),
21
+ seed: v.seed(42),
22
+ steps: v.int(30, { min: 1, max: 100 }),
23
+ cfg: v.float(3, { min: 0, max: 30 }),
24
+ length: v.int(97, { min: 9, max: 257 }),
25
+ fps: v.int(24, { min: 1, max: 60 }),
26
+ },
27
+ // async build: the input image is uploaded (hash-named, deduped) per run
28
+ build: async (b, vars, wf) => {
29
+ const img = new MediaImage({ path: asAbsolutePath(image.absPath()) })
30
+ const loaded = await img.loadInWorkflow_viaLoadImageNode(wf)
31
+
32
+ const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'ltx-video-2b-v0.9.5.safetensors' })
33
+ const clip = b.CLIPLoader({ clip_name: 't5xxl_fp16.safetensors', type: 'ltxv', device: 'default' })
34
+ // the start image is encoded into the video latent's first frame; strength 0.15
35
+ // is the template's conditioning noise level, conditioning rides along
36
+ const video = b.LTXVImgToVideo({
37
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
38
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
39
+ vae: ckpt,
40
+ image: loaded,
41
+ width: 768,
42
+ height: 512,
43
+ length: vars.length,
44
+ batch_size: 1,
45
+ strength: 0.15,
46
+ })
47
+ // ltxv also conditions on the frame rate the model was trained against (template value)
48
+ const cond = b.LTXVConditioning({
49
+ positive: video.outputs.positive,
50
+ negative: video.outputs.negative,
51
+ frame_rate: 25,
52
+ })
53
+ const samples = b.SamplerCustom({
54
+ model: ckpt,
55
+ positive: cond.outputs.positive,
56
+ negative: cond.outputs.negative,
57
+ sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
58
+ // ltxv wants its dedicated sigma schedule, stretched from the latent's token count
59
+ sigmas: b.LTXVScheduler({
60
+ steps: vars.steps,
61
+ max_shift: 2.05,
62
+ base_shift: 0.95,
63
+ stretch: true,
64
+ terminal: 0.1,
65
+ latent: video.outputs.latent,
66
+ }),
67
+ latent_image: video.outputs.latent,
68
+ add_noise: true,
69
+ noise_seed: vars.seed,
70
+ cfg: vars.cfg,
71
+ })
72
+ b.SaveVideo({
73
+ video: b.CreateVideo({ images: b.VAEDecode({ samples: samples.outputs.output, vae: ckpt }), fps: vars.fps }),
74
+ filename_prefix: 'comfy-ts-zoo/ltxv-i2v',
75
+ format: 'auto',
76
+ codec: 'auto',
77
+ })
78
+ },
79
+ })
80
+
81
+ export default ltxvI2v
82
+
83
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
84
+ if (import.meta.main) {
85
+ requireCloudKey()
86
+ if (process.argv[2]) ltxvI2v.vars.image.set(process.argv[2])
87
+ if (process.argv[3]) ltxvI2v.vars.prompt.set(process.argv[3])
88
+ const execution = await ltxvI2v.run({ log: true })
89
+ // SaveVideo outputs land host side (no auto-download for video yet)
90
+ console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/ltxv-i2v`)
91
+ host.disconnect()
92
+ }
@@ -0,0 +1,78 @@
1
+ // ltxv t2v on Comfy Cloud — LTX-Video 2b (v0.9) text to video, 97 frames @ 24fps ≈ 4s
2
+ // source template: ltxv_text_to_video.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/ltxv-t2v.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 ltxvT2v = host.defineWorkflow({
11
+ id: 'ltxv-t2v',
12
+ vars: {
13
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
14
+ prompt: v.prompt(
15
+ "A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage.\n- low quality, worst quality, deformed, distorted, disfigured, motion smear, motion artifacts, fused fingers, bad anatomy, weird hand, ugly",
16
+ ),
17
+ seed: v.seed(42),
18
+ steps: v.int(30, { min: 1, max: 100 }),
19
+ cfg: v.float(3, { min: 0, max: 30 }),
20
+ size: v.size({ width: 768, height: 512 }),
21
+ length: v.int(97, { min: 9, max: 257 }),
22
+ fps: v.int(24, { min: 1, max: 60 }),
23
+ },
24
+ build: (b, vars) => {
25
+ const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'ltx-video-2b-v0.9.safetensors' })
26
+ const clip = b.CLIPLoader({ clip_name: 't5xxl_fp16.safetensors', type: 'ltxv', device: 'default' })
27
+ // ltxv also conditions on the frame rate the model was trained against (template value)
28
+ const cond = b.LTXVConditioning({
29
+ positive: b.CLIPTextEncode({ clip, text: vars.prompt.positive }),
30
+ negative: b.CLIPTextEncode({ clip, text: vars.prompt.negative }),
31
+ frame_rate: 25,
32
+ })
33
+ const latent = b.EmptyLTXVLatentVideo({
34
+ width: vars.size.width,
35
+ height: vars.size.height,
36
+ length: vars.length,
37
+ batch_size: 1,
38
+ })
39
+ const samples = b.SamplerCustom({
40
+ model: ckpt,
41
+ positive: cond.outputs.positive,
42
+ negative: cond.outputs.negative,
43
+ sampler: b.KSamplerSelect({ sampler_name: 'euler' }),
44
+ // ltxv wants its dedicated sigma schedule, stretched from the latent's token count
45
+ sigmas: b.LTXVScheduler({
46
+ steps: vars.steps,
47
+ max_shift: 2.05,
48
+ base_shift: 0.95,
49
+ stretch: true,
50
+ terminal: 0.1,
51
+ latent,
52
+ }),
53
+ latent_image: latent,
54
+ add_noise: true,
55
+ noise_seed: vars.seed,
56
+ cfg: vars.cfg,
57
+ })
58
+ b.SaveVideo({
59
+ video: b.CreateVideo({ images: b.VAEDecode({ samples: samples.outputs.output, vae: ckpt }), fps: vars.fps }),
60
+ filename_prefix: 'comfy-ts-zoo/ltxv-t2v',
61
+ format: 'auto',
62
+ codec: 'auto',
63
+ })
64
+ },
65
+ })
66
+
67
+ export default ltxvT2v
68
+
69
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
70
+ if (import.meta.main) {
71
+ requireCloudKey()
72
+ if (process.argv[2]) ltxvT2v.vars.prompt.set(process.argv[2])
73
+ if (process.argv[3]) ltxvT2v.vars.seed.set(Number(process.argv[3]))
74
+ const execution = await ltxvT2v.run({ log: true })
75
+ // SaveVideo outputs land host side (no auto-download for video yet)
76
+ console.log(`🟢 ${execution.status}: video saved on the host under comfy-ts-zoo/ltxv-t2v`)
77
+ host.disconnect()
78
+ }
@@ -0,0 +1,67 @@
1
+ // newbie t2i on Comfy Cloud — NewBie-Image Exp0.1 anime model (AuraFlow-style UNET, gemma3+jina dual CLIP)
2
+ // source template: image_newbieimage_exp0_1-t2i.json (official workflow-templates)
3
+ // needs COMFY_CLOUD_API_KEY (https://cloud.comfy.org, paid tiers)
4
+ // run directly: bun examples/comfy-cloud/newbie-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
+ // NewBie is instruction-tuned: both branches open with a fixed system prompt (from the template)
11
+ const POSITIVE_SYSTEM =
12
+ 'You are an assistant designed to generate high-quality anime images with the highest degree of image-text alignment based on xml format textual prompts. <Prompt Start>\n'
13
+ const NEGATIVE_SYSTEM =
14
+ 'You are an assistant designed to generate low-quality images based on textual prompts. <Prompt Start>\n'
15
+
16
+ export const newbieT2i = host.defineWorkflow({
17
+ id: 'newbie-t2i',
18
+ vars: {
19
+ // ONE prompt var: `- ` lines are the NEGATIVE prompt, `//` lines are comments
20
+ prompt: v.prompt(
21
+ 'masterpiece, best quality, newest, absurdres, 1girl, blue hair, long hair, ahoge, blue eyes, black witch hat, white and blue dress, pointing at viewer, swirling cerulean water vortex, glowing crystal petals, dramatic lighting, dutch angle, anime style illustration',
22
+ ),
23
+ seed: v.seed(42),
24
+ steps: v.int(20, { min: 1, max: 60 }),
25
+ cfg: v.float(5.5, { min: 0, max: 30 }),
26
+ size: v.size({ width: 1024, height: 1536 }),
27
+ },
28
+ build: (b, vars) => {
29
+ const clip = b.DualCLIPLoader({
30
+ clip_name1: 'gemma_3_4b_it_bf16.safetensors',
31
+ clip_name2: 'jina_clip_v2_bf16.safetensors',
32
+ type: 'newbie',
33
+ device: 'default',
34
+ })
35
+ const samples = b.KSampler({
36
+ model: b.ModelSamplingAuraFlow({
37
+ model: b.UNETLoader({ unet_name: 'NewBie-Image-Exp0.1-bf16.safetensors', weight_dtype: 'default' }),
38
+ shift: 6,
39
+ }),
40
+ positive: b.CLIPTextEncode({ clip, text: POSITIVE_SYSTEM + vars.prompt.positive }),
41
+ negative: b.CLIPTextEncode({ clip, text: NEGATIVE_SYSTEM + vars.prompt.negative }),
42
+ latent_image: b.EmptySD3LatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
43
+ seed: vars.seed,
44
+ steps: vars.steps,
45
+ cfg: vars.cfg,
46
+ sampler_name: 'res_multistep',
47
+ scheduler: 'simple',
48
+ denoise: 1,
49
+ })
50
+ b.SaveImage({
51
+ images: b.VAEDecode({ samples, vae: b.VAELoader({ vae_name: 'ae.safetensors' }) }),
52
+ filename_prefix: 'comfy-ts-zoo/newbie-t2i',
53
+ })
54
+ },
55
+ })
56
+
57
+ export default newbieT2i
58
+
59
+ // standalone run (skipped when another driver — e.g. the TUI — imports this module)
60
+ if (import.meta.main) {
61
+ requireCloudKey()
62
+ if (process.argv[2]) newbieT2i.vars.prompt.set(process.argv[2])
63
+ if (process.argv[3]) newbieT2i.vars.seed.set(Number(process.argv[3]))
64
+ const execution = await newbieT2i.run({ log: true })
65
+ for (const img of execution.images) console.log(`🟢 ${img.absPath}`)
66
+ host.disconnect()
67
+ }