comfy-ts 1.0.0 → 1.2.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.
- package/README.md +60 -11
- package/dist/cli.js +4 -4439
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +445 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7439 -340
- package/dist/index.d.ts +7457 -358
- package/dist/index.js +444 -172
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-BFhba_oG.js → run-tui-BAdizWsO.js} +1244 -201
- package/dist/run-tui-BAdizWsO.js.map +1 -0
- package/dist/state-BYbxDgfr.js +5258 -0
- package/dist/state-BYbxDgfr.js.map +1 -0
- package/examples/README.md +32 -0
- package/examples/comfy-cloud/ace-step-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/anima-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/boogu-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/capybara-i2i.cflow.ts +85 -0
- package/examples/comfy-cloud/capybara-i2v.cflow.ts +90 -0
- package/examples/comfy-cloud/capybara-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/chatterbox-t2a.cflow.ts +79 -0
- package/examples/comfy-cloud/chroma-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/cloudHost.ts +41 -0
- package/examples/comfy-cloud/ernie-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/firered-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/flux1-i2i.cflow.ts +76 -0
- package/examples/comfy-cloud/flux1-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/flux2-i2i.cflow.ts +80 -0
- package/examples/comfy-cloud/flux2-t2i.cflow.ts +57 -0
- package/examples/comfy-cloud/hidream-i2i.cflow.ts +89 -0
- package/examples/comfy-cloud/hidream-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/hunyuan-video-i2v.cflow.ts +93 -0
- package/examples/comfy-cloud/hunyuan-video-t2v.cflow.ts +74 -0
- package/examples/comfy-cloud/ideogram4-t2i.cflow.ts +80 -0
- package/examples/comfy-cloud/kandinsky5-i2v.cflow.ts +95 -0
- package/examples/comfy-cloud/kandinsky5-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/kandinsky5-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/krea2-t2i.cflow.ts +59 -0
- package/examples/comfy-cloud/lens-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/longcat-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/longcat-t2i.cflow.ts +65 -0
- package/examples/comfy-cloud/ltxv-i2v.cflow.ts +92 -0
- package/examples/comfy-cloud/ltxv-t2v.cflow.ts +78 -0
- package/examples/comfy-cloud/newbie-t2i.cflow.ts +67 -0
- package/examples/comfy-cloud/omnigen2-i2i.cflow.ts +86 -0
- package/examples/comfy-cloud/omnigen2-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/ovis-t2i.cflow.ts +56 -0
- package/examples/comfy-cloud/pixeldit-t2i.cflow.ts +63 -0
- package/examples/comfy-cloud/qwen-image-i2i.cflow.ts +69 -0
- package/examples/comfy-cloud/qwen-image-t2i.cflow.ts +55 -0
- package/examples/comfy-cloud/sd35-t2i.cflow.ts +48 -0
- package/examples/comfy-cloud/sdk.d.ts +445 -57
- package/examples/comfy-cloud/sdxl-t2i.cflow.ts +69 -0
- package/examples/comfy-cloud/stable-audio-t2a.cflow.ts +53 -0
- package/examples/comfy-cloud/svd-i2v.cflow.ts +75 -0
- package/examples/comfy-cloud/wan21-i2v.cflow.ts +83 -0
- package/examples/comfy-cloud/wan21-t2v.cflow.ts +64 -0
- package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +69 -0
- package/examples/comfy-cloud/wan22-i2v.cflow.ts +107 -0
- package/examples/comfy-cloud/wan22-t2v.cflow.ts +98 -0
- package/examples/comfy-cloud/z-image-t2i.cflow.ts +62 -0
- package/examples/images/README.md +18 -0
- package/examples/images/bear_1024x1024.jpg +0 -0
- package/examples/images/deer_768x1344.jpg +0 -0
- package/examples/images/dog_512x512.jpg +0 -0
- package/examples/images/lioness_768x768.jpg +0 -0
- package/examples/images/pug_200x300.jpg +0 -0
- package/examples/images/walrus_1344x768.jpg +0 -0
- package/examples/{01-txt2img.cflow.ts → rvion/01-txt2img.cflow.ts} +1 -1
- package/examples/{02-img2img-upload.cflow.ts → rvion/02-img2img-upload.cflow.ts} +7 -18
- package/examples/{03-export-workflow-json.cflow.ts → rvion/03-export-workflow-json.cflow.ts} +1 -1
- package/examples/{04-krea2-turbo-t2i.cflow.ts → rvion/04-krea2-turbo-t2i.cflow.ts} +2 -2
- package/examples/rvion/05-comfy-cloud.cflow.ts +51 -0
- package/examples/rvion/06-qwen-image-edit.cflow.ts +89 -0
- package/guide-for-agents.md +7 -1
- package/package.json +18 -4
- package/src/cli/tui/components/CopyOverlay.tsx +25 -0
- package/src/cli/tui/components/Header.tsx +9 -4
- package/src/cli/tui/components/HostPanel.tsx +3 -2
- package/src/cli/tui/components/HostsOverlay.tsx +33 -0
- package/src/cli/tui/components/PreviewPanel.tsx +9 -8
- package/src/cli/tui/components/StatusBar.tsx +39 -9
- package/src/cli/tui/components/TreePanel.tsx +17 -7
- package/src/cli/tui/components/TuiApp.tsx +65 -5
- package/src/cli/tui/discoverWorkflows.ts +7 -41
- package/src/cli/tui/imagePicker/ImagePickerOverlay.tsx +72 -0
- package/src/cli/tui/imagePicker/ImagePickerSt.ts +288 -0
- package/src/cli/tui/imagePicker/fsListing.ts +48 -0
- package/src/cli/tui/imagePicker/pickerPrefs.ts +78 -0
- package/src/cli/tui/run-tui.tsx +49 -8
- package/src/cli/tui/state/DraftsSt.ts +3 -2
- package/src/cli/tui/state/ExecSt.ts +108 -12
- package/src/cli/tui/state/HostSt.ts +94 -10
- package/src/cli/tui/state/LorasSt.ts +14 -36
- package/src/cli/tui/state/PickerSt.ts +8 -2
- package/src/cli/tui/state/PreviewSt.ts +28 -2
- package/src/cli/tui/state/QueueSt.ts +2 -2
- package/src/cli/tui/state/SettingsSt.ts +25 -7
- package/src/cli/tui/state/TreeSt.ts +139 -36
- package/src/cli/tui/state/TuiSt.ts +53 -6
- package/src/cli/tui/state/WorkflowsSt.ts +14 -2
- package/src/cli/tui/treeRows.ts +165 -0
- package/src/exampleAssets.ts +56 -0
- package/src/graph/ComfyNode.ts +4 -1
- package/src/host/ComfyHost.ts +7 -0
- package/src/index.ts +7 -0
- package/src/manager/ComfyRegistry.ts +37 -9
- package/src/manager/generated/KnownComfyCustomNodeName.ts +23852 -1926
- package/src/manager/generated/KnownComfyPluginTitle.ts +6854 -236
- package/src/manager/generated/KnownComfyPluginURL.ts +3425 -111
- package/src/manager/generated/KnownModel_Base.ts +23 -7
- package/src/manager/generated/KnownModel_FileName.ts +421 -0
- package/src/manager/generated/KnownModel_Name.ts +421 -0
- package/src/manager/generated/KnownModel_SavePath.ts +34 -8
- package/src/manager/generated/KnownModel_Type.ts +18 -14
- package/src/manager/json/alter-list.json +221 -221
- package/src/manager/json/custom-node-list.json +61020 -21946
- package/src/manager/json/extension-node-map.json +81077 -31176
- package/src/manager/json/github-stats.json +29321 -12601
- package/src/manager/json/model-list.json +5935 -4997
- package/src/manager/loaders/parseReport.ts +55 -0
- package/src/manager/loaders/step1_downloadComfyManagerJSONs.ts +15 -49
- package/src/manager/loaders/step2_custom-node-list-loader.ts +38 -83
- package/src/manager/loaders/step3_extension-node-map-loader.ts +36 -142
- package/src/manager/loaders/step4_model-list-loader.ts +25 -36
- package/src/manager/loaders/step5_alter-list-loader.ts +29 -0
- package/src/manager/loaders/step6_github-stats-loader.ts +23 -0
- package/src/manager/script-update-manager.bun.ts +9 -1
- package/src/manager/types/ComfyManagerAlterInfo.ts +13 -0
- package/src/manager/types/ComfyManagerFileModelInfo.ts +7 -3
- package/src/manager/types/ComfyManagerFilePluginContent.ts +6 -9
- package/src/manager/types/ComfyManagerFilePluginList.ts +3 -3
- package/src/manager/types/ComfyManagerGithubStats.ts +9 -0
- package/src/manager/types/ComfyManagerPluginContentMetadata.ts +2 -3
- package/src/manager/types/ComfyManagerPluginInfo.ts +48 -34
- package/src/runner/ComfyWorkflowLayout.ts +6 -4
- package/src/sdk-generator/ComfySchema.ts +14 -1
- package/src/sdk-generator/comfyui-sdk-codegen.ts +15 -0
- package/src/sdk-generator/inputWidgetKind.ts +17 -0
- package/src/state.ts +7 -1
- package/src/vars/ComfyVars.ts +106 -5
- package/src/vars/DefinedWorkflow.ts +28 -10
- package/dist/DefinedWorkflow-O3ynII3Y.js +0 -598
- package/dist/DefinedWorkflow-O3ynII3Y.js.map +0 -1
- package/dist/run-tui-BFhba_oG.js.map +0 -1
- package/examples/05-comfy-cloud.cflow.ts +0 -67
- package/src/utils/tryExtracting.ts +0 -41
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// txt2img on Comfy Cloud (https://cloud.comfy.org) — the managed catalog is
|
|
2
|
-
// the same for every account, so its sdk is COMMITTED at examples/comfy-cloud/sdk.d.ts
|
|
3
|
-
// (regenerate deliberately: bun run gen:sdk:cloud)
|
|
4
|
-
// needs COMFY_CLOUD_API_KEY in the env (cloud.comfy.org api key, paid tiers)
|
|
5
|
-
// run directly: COMFY_CLOUD_API_KEY=… bun examples/05-comfy-cloud.cflow.ts ["prompt"] [seed]
|
|
6
|
-
import { ComfyTS, v } from 'comfy-ts'
|
|
7
|
-
|
|
8
|
-
const apiKey = process.env.COMFY_CLOUD_API_KEY
|
|
9
|
-
if (apiKey == null || apiKey === '')
|
|
10
|
-
// the TUI surfaces an import throw as a red ✗ tree row with this message
|
|
11
|
-
throw new Error(
|
|
12
|
-
'[05-comfy-cloud] COMFY_CLOUD_API_KEY is not set — export your Comfy Cloud API key (https://cloud.comfy.org, paid tiers) to load this workflow',
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
const comfy = ComfyTS.create()
|
|
16
|
-
const host = comfy.host({
|
|
17
|
-
id: 'comfy-cloud',
|
|
18
|
-
url: 'https://cloud.comfy.org',
|
|
19
|
-
apiKey,
|
|
20
|
-
// the cloud sdk home is the COMMITTED examples/comfy-cloud/sdk.d.ts — a second
|
|
21
|
-
// copy under .comfy-ts/hosts/ would double-declare the globals
|
|
22
|
-
sdkAutoWrite: false,
|
|
23
|
-
})
|
|
24
|
-
await host.loadSchemaFromCache() // offline import; run() connects lazily
|
|
25
|
-
|
|
26
|
-
export const cloudTxt2img = host.defineWorkflow({
|
|
27
|
-
id: 'cloud-txt2img',
|
|
28
|
-
vars: {
|
|
29
|
-
prompt: v.text('a lighthouse on a cliff at dusk, dramatic clouds'),
|
|
30
|
-
negative: v.text('blurry, low quality'),
|
|
31
|
-
seed: v.seed(42),
|
|
32
|
-
steps: v.int(12, { min: 1, max: 60 }),
|
|
33
|
-
cfg: v.float(7, { min: 0, max: 30 }),
|
|
34
|
-
size: v.size({ width: 512, height: 512 }),
|
|
35
|
-
prefix: v.text('comfy-ts-cloud-example'),
|
|
36
|
-
},
|
|
37
|
-
build: (b, vars) => {
|
|
38
|
-
const ckpt = b.CheckpointLoaderSimple({ ckpt_name: 'v1-5-pruned-emaonly-fp16.safetensors' })
|
|
39
|
-
const samples = b.KSampler({
|
|
40
|
-
model: ckpt,
|
|
41
|
-
positive: b.CLIPTextEncode({ clip: ckpt, text: vars.prompt }),
|
|
42
|
-
negative: b.CLIPTextEncode({ clip: ckpt, text: vars.negative }),
|
|
43
|
-
latent_image: b.EmptyLatentImage({ width: vars.size.width, height: vars.size.height, batch_size: 1 }),
|
|
44
|
-
seed: vars.seed,
|
|
45
|
-
steps: vars.steps,
|
|
46
|
-
cfg: vars.cfg,
|
|
47
|
-
sampler_name: 'euler',
|
|
48
|
-
scheduler: 'normal',
|
|
49
|
-
denoise: 1,
|
|
50
|
-
})
|
|
51
|
-
b.SaveImage({ images: b.VAEDecode({ samples, vae: ckpt }), filename_prefix: vars.prefix })
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
export default cloudTxt2img
|
|
56
|
-
|
|
57
|
-
// standalone run (skipped when another driver — e.g. the TUI — imports this module)
|
|
58
|
-
if (import.meta.main) {
|
|
59
|
-
if (process.argv[2]) cloudTxt2img.vars.prompt.set(process.argv[2])
|
|
60
|
-
if (process.argv[3]) cloudTxt2img.vars.seed.set(Number(process.argv[3]))
|
|
61
|
-
|
|
62
|
-
const t0 = Date.now()
|
|
63
|
-
const execution = await cloudTxt2img.run({ log: true })
|
|
64
|
-
console.log(`🟢 done in ${((Date.now() - t0) / 1000).toFixed(1)}s — ${execution.images.length} image(s):`)
|
|
65
|
-
for (const img of execution.images) console.log(` ${img.absPath} (${img.width}x${img.height})`)
|
|
66
|
-
host.disconnect()
|
|
67
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Maybe } from 'src/types/index.ts'
|
|
2
|
-
|
|
3
|
-
/** quick utility to verbosely attempt various data recovery tricks */
|
|
4
|
-
export enum RecoveryVerbosity {
|
|
5
|
-
Quiet = 0,
|
|
6
|
-
info = 1,
|
|
7
|
-
Verbose = 2,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function tryRecovering<T>({
|
|
11
|
-
verbose = RecoveryVerbosity.Quiet,
|
|
12
|
-
property,
|
|
13
|
-
hacks,
|
|
14
|
-
onFail,
|
|
15
|
-
onSuccess,
|
|
16
|
-
}: {
|
|
17
|
-
verbose?: RecoveryVerbosity
|
|
18
|
-
property: string
|
|
19
|
-
hacks: {
|
|
20
|
-
level?: RecoveryVerbosity
|
|
21
|
-
attempt: string
|
|
22
|
-
fn: () => Maybe<T>
|
|
23
|
-
}[]
|
|
24
|
-
onFail?: (propName: string) => void
|
|
25
|
-
onSuccess?: (propName: string, value: T) => void
|
|
26
|
-
}): T {
|
|
27
|
-
if (verbose >= RecoveryVerbosity.Verbose) console.log(`[🔶] trying to find a suitable value for ${property}...`)
|
|
28
|
-
|
|
29
|
-
for (const hack of hacks) {
|
|
30
|
-
if (verbose >= RecoveryVerbosity.Verbose) console.log(` > trying to use ${hack.attempt}...`)
|
|
31
|
-
const value = hack.fn()
|
|
32
|
-
if (value != null) {
|
|
33
|
-
if (verbose >= (hack.level ?? RecoveryVerbosity.info))
|
|
34
|
-
if (verbose) console.log(` 🔶 recovered ${property} using ${hack.attempt}.`)
|
|
35
|
-
onSuccess?.(property, value)
|
|
36
|
-
return value
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
onFail?.(property)
|
|
40
|
-
throw new Error(`[🔶] ${property} could not be recovered`)
|
|
41
|
-
}
|