comfy-ts 2.17.1 → 2.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -3
- package/dist/index.cjs +1078 -190
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1185 -410
- package/dist/index.d.ts +1185 -410
- package/dist/index.js +1078 -190
- package/dist/index.js.map +1 -1
- package/dist/{run-run-tg82jUIk.js → run-run-Zr699h2S.js} +2 -2
- package/dist/{run-run-tg82jUIk.js.map → run-run-Zr699h2S.js.map} +1 -1
- package/dist/{run-tui-Bw7BA75d.js → run-tui-CeM1GOJP.js} +2 -2
- package/dist/{run-tui-Bw7BA75d.js.map → run-tui-CeM1GOJP.js.map} +1 -1
- package/dist/serve-web.js +47 -47
- package/dist/{state-zTow5ucI.js → state-C067Kbew.js} +1079 -191
- package/dist/state-C067Kbew.js.map +1 -0
- package/dist/web.d.ts +1203 -428
- package/dist/web.js +1078 -190
- package/dist/web.js.map +1 -1
- package/examples/comfy-cloud/ace-step15-t2a.cflow.ts +163 -0
- package/examples/comfy-cloud/anima-t2i-base.cflow.ts +57 -0
- package/examples/comfy-cloud/boogu-t2i.cflow.ts +55 -0
- package/examples/comfy-cloud/chronoedit-i2i.cflow.ts +95 -0
- package/examples/comfy-cloud/ernie-t2i-base.cflow.ts +81 -0
- package/examples/comfy-cloud/flux1-t2i-krea.cflow.ts +63 -0
- package/examples/comfy-cloud/flux2-i2i-dev.cflow.ts +83 -0
- package/examples/comfy-cloud/flux2-t2i-dev.cflow.ts +60 -0
- package/examples/comfy-cloud/hidream-o1-i2i.cflow.ts +71 -0
- package/examples/comfy-cloud/hidream-o1-t2i.cflow.ts +62 -0
- package/examples/comfy-cloud/krea2-i2i.cflow.ts +78 -0
- package/examples/comfy-cloud/ltx2-i2v.cflow.ts +175 -0
- package/examples/comfy-cloud/ltx2-t2v.cflow.ts +143 -0
- package/examples/comfy-cloud/ltx23-i2v.cflow.ts +189 -0
- package/examples/comfy-cloud/ltx23-t2v.cflow.ts +151 -0
- package/examples/comfy-cloud/mage-flow-i2i-turbo.cflow.ts +72 -0
- package/examples/comfy-cloud/mage-flow-i2i.cflow.ts +74 -0
- package/examples/comfy-cloud/mage-flow-t2i-turbo.cflow.ts +60 -0
- package/examples/comfy-cloud/mage-flow-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/minimax-h3-t2i.cflow.ts +64 -0
- package/examples/comfy-cloud/netayume-t2i.cflow.ts +60 -0
- package/examples/comfy-cloud/qwen-image-i2i-2509.cflow.ts +75 -0
- package/examples/comfy-cloud/qwen-image-t2i-2512.cflow.ts +63 -0
- package/examples/comfy-cloud/sdk.d.ts +21683 -13737
- package/examples/comfy-cloud/stable-audio3-t2a.cflow.ts +96 -0
- package/examples/comfy-cloud/z-image-t2i-base.cflow.ts +54 -0
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +1 -1
- package/package.json +2 -2
- package/src/graph/ComfyNode.ts +93 -12
- package/src/host/ComfyHost.ts +37 -46
- package/src/host/ComfyManager.ts +576 -64
- package/src/litegraph/CanonicalWorkflow.ts +3 -0
- package/src/litegraph/LiteGraphJSON.ts +2 -2
- package/src/litegraph/LiteGraphNodeInput.ts +2 -2
- package/src/litegraph/LiteGraphNodeOutput.ts +2 -2
- package/src/litegraph/convertFlowToLiteGraphJSON.ts +112 -37
- package/src/litegraph/expandSubgraphs.ts +72 -4
- package/src/litegraph/normalizeWorkflow.ts +7 -1
- package/src/manager/ComfyRegistry.ts +2 -0
- package/src/manager/generated/KnownComfyCustomNodeName.ts +6354 -1680
- package/src/manager/generated/KnownComfyPluginTitle.ts +718 -356
- package/src/manager/generated/KnownComfyPluginURL.ts +357 -181
- package/src/manager/generated/KnownModel_Base.ts +9 -5
- package/src/manager/generated/KnownModel_FileName.ts +135 -0
- package/src/manager/generated/KnownModel_Name.ts +135 -0
- package/src/manager/generated/KnownModel_SavePath.ts +16 -14
- package/src/manager/generated/KnownModel_Type.ts +15 -13
- package/src/manager/installedView.ts +178 -0
- package/src/manager/json/custom-node-list.json +4018 -2248
- package/src/manager/json/extension-node-map.json +8903 -2964
- package/src/manager/json/github-stats.json +10796 -10036
- package/src/manager/json/model-list.json +298 -1
- package/src/manager/loaders/step4_model-list-loader.ts +1 -0
- package/src/manager/types/ComfyManagerAPIModelList.ts +3 -0
- package/src/manager/types/ComfyManagerAPIPluginList.ts +19 -0
- package/src/runner/ComfyExecution.ts +4 -1
- package/src/runner/ComfyWsApi.ts +82 -15
- package/src/sdk-generator/ComfySchema.ts +10 -1
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +4 -1
- package/src/sdk-generator/comfyui-sdk-codegen.ts +61 -20
- package/src/sdk-generator/inputWidgetKind.ts +19 -4
- package/src/sdk-generator/litegraphToApiRequestPayload.ts +157 -35
- package/dist/state-zTow5ucI.js.map +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PURE builders of the public plugin and model lists where the Manager serves none (4.x default ui),
|
|
3
|
+
* from our mirror and what the host reports (agent/architecture.md, Manager HTTP client).
|
|
4
|
+
* A row the data cannot decide is left OUT (reads `unknown`), never given a guessed status.
|
|
5
|
+
*/
|
|
6
|
+
import { type } from 'arktype'
|
|
7
|
+
import type { KnownComfyPluginTitle } from 'src/manager/generated/KnownComfyPluginTitle.ts'
|
|
8
|
+
import type { ComfyManagerAPIModelList } from 'src/manager/types/ComfyManagerAPIModelList.ts'
|
|
9
|
+
import type { ComfyManagerAPIPluginList } from 'src/manager/types/ComfyManagerAPIPluginList.ts'
|
|
10
|
+
import type { ComfyManagerModelInfo } from 'src/manager/types/ComfyManagerModelInfo.ts'
|
|
11
|
+
import type { ComfyManagerPluginInfo } from 'src/manager/types/ComfyManagerPluginInfo.ts'
|
|
12
|
+
|
|
13
|
+
/** the part of the registry the views read */
|
|
14
|
+
export type ManagerMirror = {
|
|
15
|
+
plugins_byTitle: ReadonlyMap<KnownComfyPluginTitle, ComfyManagerPluginInfo>
|
|
16
|
+
plugins_byFile: ReadonlyMap<string, ComfyManagerPluginInfo>
|
|
17
|
+
plugins_byNodeKey: ReadonlyMap<string, readonly ComfyManagerPluginInfo[]>
|
|
18
|
+
/** every model row: upstream ships a few names twice, with different files */
|
|
19
|
+
modelRows: readonly ComfyManagerModelInfo[]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** `GET customnode/installed`: a disk scan, keyed by directory */
|
|
23
|
+
export const InstalledPacks_ark = type.Record(
|
|
24
|
+
'string',
|
|
25
|
+
type({ 'cnr_id?': 'string | null', 'aux_id?': 'string | null', enabled: 'boolean' }),
|
|
26
|
+
)
|
|
27
|
+
export type InstalledPacks = typeof InstalledPacks_ark.infer
|
|
28
|
+
|
|
29
|
+
/** `GET customnode/getmappings`: the extension-node-map, registered repos rekeyed by registry id */
|
|
30
|
+
export const PackMappings_ark = type.Record('string', type(['string[]', { 'title_aux?': 'string' }]))
|
|
31
|
+
export type PackMappings = typeof PackMappings_ark.infer
|
|
32
|
+
|
|
33
|
+
/** `https://github.com/Owner/Repo.git/` → `owner/repo` */
|
|
34
|
+
export const repoPath = (url: string): string =>
|
|
35
|
+
url
|
|
36
|
+
.toLowerCase()
|
|
37
|
+
.replace(/\/+$/, '')
|
|
38
|
+
.replace(/\.git$/, '')
|
|
39
|
+
.split('/')
|
|
40
|
+
.slice(-2)
|
|
41
|
+
.join('/')
|
|
42
|
+
|
|
43
|
+
/** one installed pack, joined to the mirror when the data allows it */
|
|
44
|
+
export type AttributedPack = { enabled: boolean; repo: string | null; title: string | null; id: string }
|
|
45
|
+
|
|
46
|
+
/** git clone → its `owner/repo`; registry install → its registry id's `title_aux` (= the mirror title) */
|
|
47
|
+
export const attributePacks = (installed: InstalledPacks, mappings: PackMappings): AttributedPack[] => {
|
|
48
|
+
// registry ids are case insensitive: the mappings keep the registry's casing, the scan lowercases
|
|
49
|
+
const titleById = new Map(Object.entries(mappings).map(([k, v]) => [k.toLowerCase(), v[1].title_aux]))
|
|
50
|
+
return Object.entries(installed).map(([dir, p]) => {
|
|
51
|
+
const aux = p.aux_id ?? null
|
|
52
|
+
const cnr = p.cnr_id != null && p.cnr_id !== '' ? p.cnr_id : null
|
|
53
|
+
const repo = aux != null && aux.includes('/') ? repoPath(aux) : null
|
|
54
|
+
const title = cnr != null ? (titleById.get(cnr.toLowerCase()) ?? null) : null
|
|
55
|
+
return { enabled: p.enabled, repo, title, id: cnr ?? aux ?? dir }
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** is this mirror row among the attributed packs, enabled? */
|
|
60
|
+
export const packIsInstalled = (
|
|
61
|
+
packs: AttributedPack[],
|
|
62
|
+
plugin: { title: string; files: string[]; reference: string },
|
|
63
|
+
): boolean => {
|
|
64
|
+
const repo = repoPath(plugin.files[0] ?? plugin.reference)
|
|
65
|
+
return packs.some((p) => p.enabled && (p.repo === repo || p.title === plugin.title))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export const buildPluginView = (p: {
|
|
69
|
+
mirror: ManagerMirror
|
|
70
|
+
installed: InstalledPacks
|
|
71
|
+
mappings: PackMappings
|
|
72
|
+
}): { list: ComfyManagerAPIPluginList; unattributed: string[] } => {
|
|
73
|
+
const packs = attributePacks(p.installed, p.mappings)
|
|
74
|
+
const plugins = [...p.mirror.plugins_byTitle.values()]
|
|
75
|
+
const mirrorRepos = new Set(plugins.flatMap((x) => x.files.map(repoPath)))
|
|
76
|
+
const mirrorTitles = new Set<string>(plugins.map((x) => x.title))
|
|
77
|
+
const joins = (x: AttributedPack): boolean =>
|
|
78
|
+
(x.repo != null && mirrorRepos.has(x.repo)) || (x.title != null && mirrorTitles.has(x.title))
|
|
79
|
+
// a git clone whose repo the mirror lacks is no mirror row; an enabled pack known by no repo that joins
|
|
80
|
+
// nothing could be one (a disabled one reads `False` whichever row it is, like a missing one)
|
|
81
|
+
const unattributed = packs.filter((x) => x.enabled && x.repo == null && !joins(x))
|
|
82
|
+
const serverTitles = new Set(
|
|
83
|
+
Object.values(p.mappings).flatMap((v) => (v[1].title_aux != null ? [v[1].title_aux] : [])),
|
|
84
|
+
)
|
|
85
|
+
const custom_nodes: ComfyManagerAPIPluginList['custom_nodes'] = []
|
|
86
|
+
for (const plugin of plugins) {
|
|
87
|
+
const repo = repoPath(plugin.files[0] ?? plugin.reference)
|
|
88
|
+
const joined = packs.filter((x) => x.repo === repo || x.title === plugin.title)
|
|
89
|
+
if (joined.some((x) => x.enabled)) custom_nodes.push({ title: plugin.title, installed: 'True' })
|
|
90
|
+
// an unattributed registry install can only be a row the server's mappings do not name
|
|
91
|
+
else if (joined.length === 0 && unattributed.length > 0 && !serverTitles.has(plugin.title)) continue
|
|
92
|
+
else custom_nodes.push({ title: plugin.title, installed: 'False' })
|
|
93
|
+
}
|
|
94
|
+
return { list: { chanel: 'default', custom_nodes }, unattributed: unattributed.map((x) => x.id) }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** the Manager's `type` → folder map for `save_path: default` (model_utils.get_model_dir, 4.4) */
|
|
98
|
+
const DEFAULT_FOLDER_BY_TYPE: Record<string, string> = {
|
|
99
|
+
checkpoints: 'checkpoints',
|
|
100
|
+
checkpoint: 'checkpoints',
|
|
101
|
+
unclip: 'checkpoints',
|
|
102
|
+
text_encoders: 'text_encoders',
|
|
103
|
+
clip: 'text_encoders',
|
|
104
|
+
vae: 'vae',
|
|
105
|
+
lora: 'loras',
|
|
106
|
+
't2i-adapter': 'controlnet',
|
|
107
|
+
't2i-style': 'controlnet',
|
|
108
|
+
controlnet: 'controlnet',
|
|
109
|
+
clip_vision: 'clip_vision',
|
|
110
|
+
gligen: 'gligen',
|
|
111
|
+
upscale: 'upscale_models',
|
|
112
|
+
embedding: 'embeddings',
|
|
113
|
+
embeddings: 'embeddings',
|
|
114
|
+
unet: 'diffusion_models',
|
|
115
|
+
diffusion_model: 'diffusion_models',
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** what core `get_filename_list` lists in the standard folders */
|
|
119
|
+
const LISTED_EXTENSIONS = ['.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft']
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* where this model counts as installed, in core's `/models/<folder>` terms; null when not decidable.
|
|
123
|
+
* The Manager's own check accepts the folder root as well as the `save_path` sub folder.
|
|
124
|
+
*/
|
|
125
|
+
export const modelLocation = (m: ComfyManagerModelInfo): { folder: string; files: string[] } | null => {
|
|
126
|
+
if (m.filename === '<huggingface>' || /[\\/:]/.test(m.filename)) return null
|
|
127
|
+
if (!LISTED_EXTENSIONS.some((ext) => m.filename.toLowerCase().endsWith(ext))) return null
|
|
128
|
+
if (m.save_path === 'default') {
|
|
129
|
+
const folder = DEFAULT_FOLDER_BY_TYPE[m.type.toLowerCase()]
|
|
130
|
+
return folder == null ? null : { folder, files: [m.filename] }
|
|
131
|
+
}
|
|
132
|
+
const parts = m.save_path
|
|
133
|
+
.replaceAll('\\', '/')
|
|
134
|
+
.split('/')
|
|
135
|
+
.filter((s) => s !== '')
|
|
136
|
+
const folder = parts[0]
|
|
137
|
+
if (folder == null || folder === 'custom_nodes' || parts.includes('..')) return null
|
|
138
|
+
const sub = [...parts.slice(1), m.filename].join('/')
|
|
139
|
+
return { folder, files: sub === m.filename ? [m.filename] : [m.filename, sub] }
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export const buildModelView = (p: {
|
|
143
|
+
models: readonly ComfyManagerModelInfo[]
|
|
144
|
+
/** registered folder → its relative file paths, for the folders core lists */
|
|
145
|
+
files: ReadonlyMap<string, readonly string[]>
|
|
146
|
+
}): ComfyManagerAPIModelList => {
|
|
147
|
+
const listed = new Map(
|
|
148
|
+
[...p.files].map(([folder, files]) => [folder, new Set(files.map((f) => f.replaceAll('\\', '/')))]),
|
|
149
|
+
)
|
|
150
|
+
const statusOf = (m: ComfyManagerModelInfo): 'True' | 'False' | null => {
|
|
151
|
+
const at = modelLocation(m)
|
|
152
|
+
const files = at == null ? null : listed.get(at.folder)
|
|
153
|
+
if (at == null || files == null) return null
|
|
154
|
+
return at.files.some((f) => files.has(f)) ? 'True' : 'False'
|
|
155
|
+
}
|
|
156
|
+
const byName = new Map<string, ComfyManagerModelInfo[]>()
|
|
157
|
+
for (const m of p.models) byName.set(m.name, [...(byName.get(m.name) ?? []), m])
|
|
158
|
+
const models: ComfyManagerAPIModelList['models'] = []
|
|
159
|
+
for (const rows of byName.values()) {
|
|
160
|
+
// a name shipped twice with different files is decided only when every row agrees
|
|
161
|
+
const statuses = new Set(rows.map(statusOf))
|
|
162
|
+
const first = rows[0]
|
|
163
|
+
const installed = statuses.size === 1 ? [...statuses][0] : null
|
|
164
|
+
if (first == null || installed == null) continue
|
|
165
|
+
models.push({
|
|
166
|
+
name: first.name,
|
|
167
|
+
installed,
|
|
168
|
+
filename: first.filename,
|
|
169
|
+
save_path: first.save_path,
|
|
170
|
+
base: first.base,
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
return { models }
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** the folders the views need listed */
|
|
177
|
+
export const modelFolders = (models: Iterable<ComfyManagerModelInfo>): Set<string> =>
|
|
178
|
+
new Set([...models].flatMap((m) => modelLocation(m)?.folder ?? []))
|